@reinconsole/core 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 +44 -0
- package/dist/index.cjs +498 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2588 -0
- package/dist/index.d.ts +2588 -0
- package/dist/index.js +444 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,2588 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Chains Rein observes/governs. x402 is multi-chain; Base and Solana ship
|
|
5
|
+
* first, Polygon and BNB follow. The policy/ledger domain is rail-agnostic —
|
|
6
|
+
* this enum is the only place chains are enumerated.
|
|
7
|
+
*/
|
|
8
|
+
declare const Chain: z.ZodEnum<["base", "solana", "polygon", "bnb"]>;
|
|
9
|
+
type Chain = z.infer<typeof Chain>;
|
|
10
|
+
/** Stablecoins settled over x402. */
|
|
11
|
+
declare const Asset: z.ZodEnum<["USDC", "USDT", "EURC"]>;
|
|
12
|
+
type Asset = z.infer<typeof Asset>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Monetary amounts in Rein are always non-negative **decimal strings**, never
|
|
16
|
+
* floats. Float arithmetic silently loses precision on values like 0.1 + 0.2,
|
|
17
|
+
* which is unacceptable for money. All comparison/aggregation goes through the
|
|
18
|
+
* BigInt-backed helpers below.
|
|
19
|
+
*/
|
|
20
|
+
declare const DecimalString: z.ZodString;
|
|
21
|
+
type DecimalString = z.infer<typeof DecimalString>;
|
|
22
|
+
declare function isValidDecimal(value: string): boolean;
|
|
23
|
+
/** Compare two decimal strings. Returns -1 (a<b), 0 (a==b), or 1 (a>b). */
|
|
24
|
+
declare function compareDecimal(a: string, b: string): -1 | 0 | 1;
|
|
25
|
+
/** Sum a list of decimal strings without floating-point error. */
|
|
26
|
+
declare function sumDecimal(values: readonly string[]): string;
|
|
27
|
+
/** Multiply two decimal strings exactly (e.g. median * "3" for price-sanity). */
|
|
28
|
+
declare function mulDecimal(a: string, b: string): string;
|
|
29
|
+
/** Convenience: a > b. */
|
|
30
|
+
declare function gt(a: string, b: string): boolean;
|
|
31
|
+
/** Convenience: a < b. */
|
|
32
|
+
declare function lt(a: string, b: string): boolean;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Minimal, safe glob matcher supporting only the `*` wildcard (matches any run
|
|
36
|
+
* of characters, including none). Used for vendor host allowlists
|
|
37
|
+
* (e.g. "*.trusted.io"), agent-id targeting (e.g. "agt_research_*"), and
|
|
38
|
+
* Gate route pricing (e.g. "/api/reports/*").
|
|
39
|
+
*
|
|
40
|
+
* Deliberately NOT a regex from user input — the pattern is escaped so a
|
|
41
|
+
* malicious policy value cannot inject regex behavior (ReDoS, etc.).
|
|
42
|
+
*/
|
|
43
|
+
declare function globMatch(pattern: string, value: string): boolean;
|
|
44
|
+
/** True if `value` matches any pattern in the list. */
|
|
45
|
+
declare function globMatchAny(patterns: readonly string[], value: string): boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Minimal ULID generation, dependency-free. ULIDs are lexicographically
|
|
49
|
+
* sortable (time-prefixed) and url-safe, which is why Rein uses them for all
|
|
50
|
+
* primary keys instead of UUIDs. Works in Node 22 and modern browsers/edge via
|
|
51
|
+
* the WebCrypto `globalThis.crypto`.
|
|
52
|
+
*/
|
|
53
|
+
/** Generate a 26-character ULID. */
|
|
54
|
+
declare function ulid(seedTime?: number): string;
|
|
55
|
+
/** Generate a Stripe-style prefixed id, e.g. `newId('agt')` -> `agt_01J...`. */
|
|
56
|
+
declare function newId<P extends string>(prefix: P): `${P}_${string}`;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A zod schema for a Stripe-style prefixed ULID, e.g. `agt_01J7...`.
|
|
60
|
+
* Centralizing this keeps id formats consistent across DB rows, API payloads,
|
|
61
|
+
* and SDK types.
|
|
62
|
+
*/
|
|
63
|
+
declare function prefixedId(prefix: string): z.ZodString;
|
|
64
|
+
declare const OrgId: z.ZodString;
|
|
65
|
+
type OrgId = z.infer<typeof OrgId>;
|
|
66
|
+
declare const AgentId: z.ZodString;
|
|
67
|
+
type AgentId = z.infer<typeof AgentId>;
|
|
68
|
+
declare const PolicyId: z.ZodString;
|
|
69
|
+
type PolicyId = z.infer<typeof PolicyId>;
|
|
70
|
+
declare const IntentId: z.ZodString;
|
|
71
|
+
type IntentId = z.infer<typeof IntentId>;
|
|
72
|
+
declare const DecisionId: z.ZodString;
|
|
73
|
+
type DecisionId = z.infer<typeof DecisionId>;
|
|
74
|
+
declare const ReceiptId: z.ZodString;
|
|
75
|
+
type ReceiptId = z.infer<typeof ReceiptId>;
|
|
76
|
+
declare const SessionId: z.ZodString;
|
|
77
|
+
type SessionId = z.infer<typeof SessionId>;
|
|
78
|
+
declare const GateReceiptId: z.ZodString;
|
|
79
|
+
type GateReceiptId = z.infer<typeof GateReceiptId>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Enforcement tier of a given agent wallet:
|
|
83
|
+
* - `observed` — Rein sees spend on-chain but has no control (no SDK either).
|
|
84
|
+
* - `sdk` — agent uses @reinconsole/sdk; advisory + observability (bypassable).
|
|
85
|
+
* - `session-key` — signer-level scope; out-of-policy txs cannot be signed.
|
|
86
|
+
*/
|
|
87
|
+
declare const EnforcementMode: z.ZodEnum<["observed", "sdk", "session-key"]>;
|
|
88
|
+
type EnforcementMode = z.infer<typeof EnforcementMode>;
|
|
89
|
+
declare const AgentWallet: z.ZodObject<{
|
|
90
|
+
chain: z.ZodEnum<["base", "solana", "polygon", "bnb"]>;
|
|
91
|
+
address: z.ZodString;
|
|
92
|
+
mode: z.ZodEnum<["observed", "sdk", "session-key"]>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
95
|
+
address: string;
|
|
96
|
+
mode: "observed" | "sdk" | "session-key";
|
|
97
|
+
}, {
|
|
98
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
99
|
+
address: string;
|
|
100
|
+
mode: "observed" | "sdk" | "session-key";
|
|
101
|
+
}>;
|
|
102
|
+
type AgentWallet = z.infer<typeof AgentWallet>;
|
|
103
|
+
declare const AgentStatus: z.ZodEnum<["active", "frozen"]>;
|
|
104
|
+
type AgentStatus = z.infer<typeof AgentStatus>;
|
|
105
|
+
declare const Agent: z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
orgId: z.ZodString;
|
|
108
|
+
name: z.ZodString;
|
|
109
|
+
/** On-chain ERC-8004 identity, if the agent is registered. */
|
|
110
|
+
erc8004Id: z.ZodOptional<z.ZodString>;
|
|
111
|
+
wallets: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
112
|
+
chain: z.ZodEnum<["base", "solana", "polygon", "bnb"]>;
|
|
113
|
+
address: z.ZodString;
|
|
114
|
+
mode: z.ZodEnum<["observed", "sdk", "session-key"]>;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
117
|
+
address: string;
|
|
118
|
+
mode: "observed" | "sdk" | "session-key";
|
|
119
|
+
}, {
|
|
120
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
121
|
+
address: string;
|
|
122
|
+
mode: "observed" | "sdk" | "session-key";
|
|
123
|
+
}>, "many">>;
|
|
124
|
+
status: z.ZodDefault<z.ZodEnum<["active", "frozen"]>>;
|
|
125
|
+
createdAt: z.ZodDate;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
status: "active" | "frozen";
|
|
128
|
+
id: string;
|
|
129
|
+
orgId: string;
|
|
130
|
+
name: string;
|
|
131
|
+
wallets: {
|
|
132
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
133
|
+
address: string;
|
|
134
|
+
mode: "observed" | "sdk" | "session-key";
|
|
135
|
+
}[];
|
|
136
|
+
createdAt: Date;
|
|
137
|
+
erc8004Id?: string | undefined;
|
|
138
|
+
}, {
|
|
139
|
+
id: string;
|
|
140
|
+
orgId: string;
|
|
141
|
+
name: string;
|
|
142
|
+
createdAt: Date;
|
|
143
|
+
status?: "active" | "frozen" | undefined;
|
|
144
|
+
erc8004Id?: string | undefined;
|
|
145
|
+
wallets?: {
|
|
146
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
147
|
+
address: string;
|
|
148
|
+
mode: "observed" | "sdk" | "session-key";
|
|
149
|
+
}[] | undefined;
|
|
150
|
+
}>;
|
|
151
|
+
type Agent = z.infer<typeof Agent>;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The canonical string form of an ERC-8004 agent identity:
|
|
155
|
+
*
|
|
156
|
+
* eip155:{chainId}:{identityRegistry}/{tokenId}
|
|
157
|
+
*
|
|
158
|
+
* The part before the `/` is the spec's registry reference verbatim (the
|
|
159
|
+
* `agentRegistry` field of a registration file, CAIP-10 account form); the
|
|
160
|
+
* tokenId is the ERC-721 id the Identity Registry minted (`agentId` in the
|
|
161
|
+
* spec). This exact string is what `Agent.erc8004Id` / `Vendor.erc8004Id`
|
|
162
|
+
* carry, AND the reputation-subject id a registered agent's evidence keys by.
|
|
163
|
+
*
|
|
164
|
+
* Casing is load-bearing: reputation subject keys for agent-kind ids are
|
|
165
|
+
* case-sensitive unless they start with `0x` (see @reinconsole/graph
|
|
166
|
+
* `normalizeSubject`), and an eip155 string does not. `formatErc8004Id`
|
|
167
|
+
* therefore always emits the registry address in lowercase, and consumers must
|
|
168
|
+
* never hand-build the string — parse then re-format to normalize.
|
|
169
|
+
*/
|
|
170
|
+
interface Erc8004Ref {
|
|
171
|
+
/** EIP-155 chain id (e.g. 8453 Base, 84532 Base Sepolia). */
|
|
172
|
+
chainId: number;
|
|
173
|
+
/** Identity Registry contract address, lowercase 0x-hex. */
|
|
174
|
+
registry: string;
|
|
175
|
+
/** ERC-721 tokenId — the spec's `agentId`. bigint: token ids exceed 2^53. */
|
|
176
|
+
tokenId: bigint;
|
|
177
|
+
}
|
|
178
|
+
/** Build the canonical id string. Throws on a malformed ref (programmer error). */
|
|
179
|
+
declare function formatErc8004Id(ref: Erc8004Ref): string;
|
|
180
|
+
/**
|
|
181
|
+
* Parse a canonical (or hand-written) id string. Accepts any address casing
|
|
182
|
+
* and returns a lowercase ref, or undefined when malformed — so
|
|
183
|
+
* `formatErc8004Id(parseErc8004Id(x)!)` is the normalization step.
|
|
184
|
+
*/
|
|
185
|
+
declare function parseErc8004Id(value: string): Erc8004Ref | undefined;
|
|
186
|
+
/** Strict boundary schema for the id string (the fields themselves stay free-form). */
|
|
187
|
+
declare const Erc8004Id: z.ZodEffects<z.ZodString, string, string>;
|
|
188
|
+
type Erc8004Id = z.infer<typeof Erc8004Id>;
|
|
189
|
+
|
|
190
|
+
declare const Vendor: z.ZodObject<{
|
|
191
|
+
host: z.ZodString;
|
|
192
|
+
address: z.ZodString;
|
|
193
|
+
erc8004Id: z.ZodOptional<z.ZodString>;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
address: string;
|
|
196
|
+
host: string;
|
|
197
|
+
erc8004Id?: string | undefined;
|
|
198
|
+
}, {
|
|
199
|
+
address: string;
|
|
200
|
+
host: string;
|
|
201
|
+
erc8004Id?: string | undefined;
|
|
202
|
+
}>;
|
|
203
|
+
type Vendor = z.infer<typeof Vendor>;
|
|
204
|
+
/**
|
|
205
|
+
* The observability gold: links every micro-payment back to the task and run
|
|
206
|
+
* that caused it, so finance teams can answer "what was this spend for?".
|
|
207
|
+
*/
|
|
208
|
+
declare const TaskContext: z.ZodObject<{
|
|
209
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
210
|
+
parentRunId: z.ZodOptional<z.ZodString>;
|
|
211
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
taskId?: string | undefined;
|
|
214
|
+
parentRunId?: string | undefined;
|
|
215
|
+
purpose?: string | undefined;
|
|
216
|
+
}, {
|
|
217
|
+
taskId?: string | undefined;
|
|
218
|
+
parentRunId?: string | undefined;
|
|
219
|
+
purpose?: string | undefined;
|
|
220
|
+
}>;
|
|
221
|
+
type TaskContext = z.infer<typeof TaskContext>;
|
|
222
|
+
/**
|
|
223
|
+
* A request to spend, submitted to the policy engine BEFORE any signature is
|
|
224
|
+
* released. The `nonce` provides replay protection on the signer path.
|
|
225
|
+
*/
|
|
226
|
+
declare const PaymentIntent: z.ZodObject<{
|
|
227
|
+
id: z.ZodString;
|
|
228
|
+
agentId: z.ZodString;
|
|
229
|
+
vendor: z.ZodObject<{
|
|
230
|
+
host: z.ZodString;
|
|
231
|
+
address: z.ZodString;
|
|
232
|
+
erc8004Id: z.ZodOptional<z.ZodString>;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
address: string;
|
|
235
|
+
host: string;
|
|
236
|
+
erc8004Id?: string | undefined;
|
|
237
|
+
}, {
|
|
238
|
+
address: string;
|
|
239
|
+
host: string;
|
|
240
|
+
erc8004Id?: string | undefined;
|
|
241
|
+
}>;
|
|
242
|
+
resource: z.ZodString;
|
|
243
|
+
amount: z.ZodString;
|
|
244
|
+
asset: z.ZodEnum<["USDC", "USDT", "EURC"]>;
|
|
245
|
+
chain: z.ZodEnum<["base", "solana", "polygon", "bnb"]>;
|
|
246
|
+
taskContext: z.ZodDefault<z.ZodObject<{
|
|
247
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
248
|
+
parentRunId: z.ZodOptional<z.ZodString>;
|
|
249
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
250
|
+
}, "strip", z.ZodTypeAny, {
|
|
251
|
+
taskId?: string | undefined;
|
|
252
|
+
parentRunId?: string | undefined;
|
|
253
|
+
purpose?: string | undefined;
|
|
254
|
+
}, {
|
|
255
|
+
taskId?: string | undefined;
|
|
256
|
+
parentRunId?: string | undefined;
|
|
257
|
+
purpose?: string | undefined;
|
|
258
|
+
}>>;
|
|
259
|
+
nonce: z.ZodString;
|
|
260
|
+
createdAt: z.ZodDate;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
263
|
+
id: string;
|
|
264
|
+
createdAt: Date;
|
|
265
|
+
agentId: string;
|
|
266
|
+
vendor: {
|
|
267
|
+
address: string;
|
|
268
|
+
host: string;
|
|
269
|
+
erc8004Id?: string | undefined;
|
|
270
|
+
};
|
|
271
|
+
resource: string;
|
|
272
|
+
amount: string;
|
|
273
|
+
asset: "USDC" | "USDT" | "EURC";
|
|
274
|
+
taskContext: {
|
|
275
|
+
taskId?: string | undefined;
|
|
276
|
+
parentRunId?: string | undefined;
|
|
277
|
+
purpose?: string | undefined;
|
|
278
|
+
};
|
|
279
|
+
nonce: string;
|
|
280
|
+
}, {
|
|
281
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
282
|
+
id: string;
|
|
283
|
+
createdAt: Date;
|
|
284
|
+
agentId: string;
|
|
285
|
+
vendor: {
|
|
286
|
+
address: string;
|
|
287
|
+
host: string;
|
|
288
|
+
erc8004Id?: string | undefined;
|
|
289
|
+
};
|
|
290
|
+
resource: string;
|
|
291
|
+
amount: string;
|
|
292
|
+
asset: "USDC" | "USDT" | "EURC";
|
|
293
|
+
nonce: string;
|
|
294
|
+
taskContext?: {
|
|
295
|
+
taskId?: string | undefined;
|
|
296
|
+
parentRunId?: string | undefined;
|
|
297
|
+
purpose?: string | undefined;
|
|
298
|
+
} | undefined;
|
|
299
|
+
}>;
|
|
300
|
+
type PaymentIntent = z.infer<typeof PaymentIntent>;
|
|
301
|
+
|
|
302
|
+
declare const DecisionOutcome: z.ZodEnum<["allow", "deny", "escalate"]>;
|
|
303
|
+
type DecisionOutcome = z.infer<typeof DecisionOutcome>;
|
|
304
|
+
/**
|
|
305
|
+
* The signed, hash-chained record of a single policy evaluation. Written BEFORE
|
|
306
|
+
* any signature is released. `prevHash` + `hash` form a tamper-evident chain;
|
|
307
|
+
* `signature` is the policy service's signing key over `hash`. The eventual
|
|
308
|
+
* on-chain `txHash` is attached later by the indexer (see SettledPayment).
|
|
309
|
+
*/
|
|
310
|
+
declare const Decision: z.ZodObject<{
|
|
311
|
+
id: z.ZodString;
|
|
312
|
+
intentId: z.ZodString;
|
|
313
|
+
/**
|
|
314
|
+
* sha256 of the intent's canonical content (see canonical.ts). Binds the
|
|
315
|
+
* decision to the exact transfer it judged — amount, recipient, asset,
|
|
316
|
+
* chain — so a signer can verify an {intent, decision} pair offline as a
|
|
317
|
+
* self-contained spend voucher, not just a reference by id.
|
|
318
|
+
*/
|
|
319
|
+
intentHash: z.ZodString;
|
|
320
|
+
outcome: z.ZodEnum<["allow", "deny", "escalate"]>;
|
|
321
|
+
/** Ids of the rules that fired, for explainability. */
|
|
322
|
+
matchedRules: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
323
|
+
/** Human-readable explanation surfaced in the dashboard. */
|
|
324
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
325
|
+
policyId: z.ZodString;
|
|
326
|
+
policyVersion: z.ZodString;
|
|
327
|
+
/** Hash of the previous decision in the chain (tamper-evident log). */
|
|
328
|
+
prevHash: z.ZodString;
|
|
329
|
+
/** Hash of this decision's canonical content. */
|
|
330
|
+
hash: z.ZodString;
|
|
331
|
+
/** Service signing-key signature over `hash`. */
|
|
332
|
+
signature: z.ZodString;
|
|
333
|
+
latencyMs: z.ZodNumber;
|
|
334
|
+
decidedAt: z.ZodDate;
|
|
335
|
+
}, "strip", z.ZodTypeAny, {
|
|
336
|
+
id: string;
|
|
337
|
+
intentId: string;
|
|
338
|
+
intentHash: string;
|
|
339
|
+
outcome: "allow" | "deny" | "escalate";
|
|
340
|
+
matchedRules: string[];
|
|
341
|
+
policyId: string;
|
|
342
|
+
policyVersion: string;
|
|
343
|
+
prevHash: string;
|
|
344
|
+
hash: string;
|
|
345
|
+
signature: string;
|
|
346
|
+
latencyMs: number;
|
|
347
|
+
decidedAt: Date;
|
|
348
|
+
reason?: string | undefined;
|
|
349
|
+
}, {
|
|
350
|
+
id: string;
|
|
351
|
+
intentId: string;
|
|
352
|
+
intentHash: string;
|
|
353
|
+
outcome: "allow" | "deny" | "escalate";
|
|
354
|
+
policyId: string;
|
|
355
|
+
policyVersion: string;
|
|
356
|
+
prevHash: string;
|
|
357
|
+
hash: string;
|
|
358
|
+
signature: string;
|
|
359
|
+
latencyMs: number;
|
|
360
|
+
decidedAt: Date;
|
|
361
|
+
matchedRules?: string[] | undefined;
|
|
362
|
+
reason?: string | undefined;
|
|
363
|
+
}>;
|
|
364
|
+
type Decision = z.infer<typeof Decision>;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Canonical byte forms shared by the policy engine (which hashes and signs
|
|
368
|
+
* them) and the signer (which verifies them offline). Field order is fixed,
|
|
369
|
+
* dates are ISO strings, and absent optionals are explicit nulls, so the same
|
|
370
|
+
* parsed object always canonicalizes to the same bytes — including after a
|
|
371
|
+
* JSON round-trip over HTTP.
|
|
372
|
+
*
|
|
373
|
+
* These builders are pure (no node:crypto) so @reinconsole/core stays loadable in a
|
|
374
|
+
* browser; services hash the strings with whatever sha256 they have.
|
|
375
|
+
*/
|
|
376
|
+
/** Canonical form of an intent — what `Decision.intentHash` commits to. */
|
|
377
|
+
declare function canonicalIntent(intent: PaymentIntent): string;
|
|
378
|
+
/** The decision fields covered by `Decision.hash` (and thus its signature). */
|
|
379
|
+
interface DecisionContent {
|
|
380
|
+
intentId: string;
|
|
381
|
+
intentHash: string;
|
|
382
|
+
outcome: DecisionOutcome;
|
|
383
|
+
matchedRules: string[];
|
|
384
|
+
policyId: string;
|
|
385
|
+
policyVersion: string;
|
|
386
|
+
prevHash: string;
|
|
387
|
+
decidedAt: Date;
|
|
388
|
+
}
|
|
389
|
+
/** Canonical form of a decision — what `Decision.hash` is computed over. */
|
|
390
|
+
declare function canonicalDecision(d: DecisionContent): string;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* A session-key grant: the signer tier's unit of delegated authority. The
|
|
394
|
+
* agent process holds only the bearer token — the wallet key never leaves the
|
|
395
|
+
* signer — and the stored record keeps a hash of the token, never the token
|
|
396
|
+
* itself (it is returned exactly once, at creation).
|
|
397
|
+
*
|
|
398
|
+
* Caps here are the signer-side backstop UNDER whatever policy says: a
|
|
399
|
+
* signature is released only when the engine allowed the intent AND the
|
|
400
|
+
* session has room. Amounts are decimal strings in the asset's human units.
|
|
401
|
+
*/
|
|
402
|
+
declare const Session: z.ZodObject<{
|
|
403
|
+
id: z.ZodString;
|
|
404
|
+
agentId: z.ZodString;
|
|
405
|
+
/** sha256 hex of the bearer token. */
|
|
406
|
+
tokenHash: z.ZodString;
|
|
407
|
+
/** Cumulative ceiling across the session's lifetime. Absent = uncapped. */
|
|
408
|
+
capAmount: z.ZodOptional<z.ZodString>;
|
|
409
|
+
/** Ceiling per individual signature. Absent = uncapped. */
|
|
410
|
+
maxPerPayment: z.ZodOptional<z.ZodString>;
|
|
411
|
+
expiresAt: z.ZodDate;
|
|
412
|
+
createdAt: z.ZodDate;
|
|
413
|
+
revokedAt: z.ZodOptional<z.ZodDate>;
|
|
414
|
+
}, "strip", z.ZodTypeAny, {
|
|
415
|
+
id: string;
|
|
416
|
+
createdAt: Date;
|
|
417
|
+
agentId: string;
|
|
418
|
+
tokenHash: string;
|
|
419
|
+
expiresAt: Date;
|
|
420
|
+
capAmount?: string | undefined;
|
|
421
|
+
maxPerPayment?: string | undefined;
|
|
422
|
+
revokedAt?: Date | undefined;
|
|
423
|
+
}, {
|
|
424
|
+
id: string;
|
|
425
|
+
createdAt: Date;
|
|
426
|
+
agentId: string;
|
|
427
|
+
tokenHash: string;
|
|
428
|
+
expiresAt: Date;
|
|
429
|
+
capAmount?: string | undefined;
|
|
430
|
+
maxPerPayment?: string | undefined;
|
|
431
|
+
revokedAt?: Date | undefined;
|
|
432
|
+
}>;
|
|
433
|
+
type Session = z.infer<typeof Session>;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* On-chain confirmation of a settled payment, reconciled by the indexer against
|
|
437
|
+
* the originating intent (amount + recipient + nonce, or facilitator webhook).
|
|
438
|
+
*/
|
|
439
|
+
declare const SettledPayment: z.ZodObject<{
|
|
440
|
+
intentId: z.ZodString;
|
|
441
|
+
txHash: z.ZodString;
|
|
442
|
+
chain: z.ZodEnum<["base", "solana", "polygon", "bnb"]>;
|
|
443
|
+
blockNumber: z.ZodBigInt;
|
|
444
|
+
facilitator: z.ZodOptional<z.ZodString>;
|
|
445
|
+
feePaid: z.ZodOptional<z.ZodString>;
|
|
446
|
+
confirmedAt: z.ZodDate;
|
|
447
|
+
}, "strip", z.ZodTypeAny, {
|
|
448
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
449
|
+
intentId: string;
|
|
450
|
+
txHash: string;
|
|
451
|
+
blockNumber: bigint;
|
|
452
|
+
confirmedAt: Date;
|
|
453
|
+
facilitator?: string | undefined;
|
|
454
|
+
feePaid?: string | undefined;
|
|
455
|
+
}, {
|
|
456
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
457
|
+
intentId: string;
|
|
458
|
+
txHash: string;
|
|
459
|
+
blockNumber: bigint;
|
|
460
|
+
confirmedAt: Date;
|
|
461
|
+
facilitator?: string | undefined;
|
|
462
|
+
feePaid?: string | undefined;
|
|
463
|
+
}>;
|
|
464
|
+
type SettledPayment = z.infer<typeof SettledPayment>;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* What the SDK reports back after settlement: the `X-PAYMENT-RESPONSE` header
|
|
468
|
+
* a vendor returns once payment clears. Mock facilitators fill this in v0.1;
|
|
469
|
+
* the indexer reconciles it against on-chain truth later (see SettledPayment).
|
|
470
|
+
*/
|
|
471
|
+
declare const ReceiptSettlement: z.ZodObject<{
|
|
472
|
+
txHash: z.ZodOptional<z.ZodString>;
|
|
473
|
+
networkId: z.ZodOptional<z.ZodString>;
|
|
474
|
+
/** Raw header payload, kept for forensics until the indexer confirms. */
|
|
475
|
+
raw: z.ZodOptional<z.ZodString>;
|
|
476
|
+
}, "strip", z.ZodTypeAny, {
|
|
477
|
+
txHash?: string | undefined;
|
|
478
|
+
networkId?: string | undefined;
|
|
479
|
+
raw?: string | undefined;
|
|
480
|
+
}, {
|
|
481
|
+
txHash?: string | undefined;
|
|
482
|
+
networkId?: string | undefined;
|
|
483
|
+
raw?: string | undefined;
|
|
484
|
+
}>;
|
|
485
|
+
type ReceiptSettlement = z.infer<typeof ReceiptSettlement>;
|
|
486
|
+
/**
|
|
487
|
+
* The SDK-side record of one guarded payment attempt: which request triggered
|
|
488
|
+
* it, what the engine decided, and (if allowed and paid) how it settled.
|
|
489
|
+
* Receipts are the observability primitive — every 402 the guard touches
|
|
490
|
+
* produces exactly one, whether the payment was allowed or blocked.
|
|
491
|
+
*/
|
|
492
|
+
declare const Receipt: z.ZodObject<{
|
|
493
|
+
id: z.ZodString;
|
|
494
|
+
agentId: z.ZodString;
|
|
495
|
+
intentId: z.ZodString;
|
|
496
|
+
decisionId: z.ZodString;
|
|
497
|
+
outcome: z.ZodEnum<["allow", "deny", "escalate"]>;
|
|
498
|
+
/** The URL the agent actually fetched (the paywalled resource). */
|
|
499
|
+
url: z.ZodString;
|
|
500
|
+
method: z.ZodDefault<z.ZodString>;
|
|
501
|
+
vendorHost: z.ZodString;
|
|
502
|
+
amount: z.ZodString;
|
|
503
|
+
asset: z.ZodEnum<["USDC", "USDT", "EURC"]>;
|
|
504
|
+
chain: z.ZodEnum<["base", "solana", "polygon", "bnb"]>;
|
|
505
|
+
taskContext: z.ZodDefault<z.ZodObject<{
|
|
506
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
507
|
+
parentRunId: z.ZodOptional<z.ZodString>;
|
|
508
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
509
|
+
}, "strip", z.ZodTypeAny, {
|
|
510
|
+
taskId?: string | undefined;
|
|
511
|
+
parentRunId?: string | undefined;
|
|
512
|
+
purpose?: string | undefined;
|
|
513
|
+
}, {
|
|
514
|
+
taskId?: string | undefined;
|
|
515
|
+
parentRunId?: string | undefined;
|
|
516
|
+
purpose?: string | undefined;
|
|
517
|
+
}>>;
|
|
518
|
+
/** Human-readable explanation copied from the decision. */
|
|
519
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
520
|
+
/** Present only once a payment was made and the vendor confirmed it. */
|
|
521
|
+
settlement: z.ZodOptional<z.ZodObject<{
|
|
522
|
+
txHash: z.ZodOptional<z.ZodString>;
|
|
523
|
+
networkId: z.ZodOptional<z.ZodString>;
|
|
524
|
+
/** Raw header payload, kept for forensics until the indexer confirms. */
|
|
525
|
+
raw: z.ZodOptional<z.ZodString>;
|
|
526
|
+
}, "strip", z.ZodTypeAny, {
|
|
527
|
+
txHash?: string | undefined;
|
|
528
|
+
networkId?: string | undefined;
|
|
529
|
+
raw?: string | undefined;
|
|
530
|
+
}, {
|
|
531
|
+
txHash?: string | undefined;
|
|
532
|
+
networkId?: string | undefined;
|
|
533
|
+
raw?: string | undefined;
|
|
534
|
+
}>>;
|
|
535
|
+
createdAt: z.ZodDate;
|
|
536
|
+
}, "strip", z.ZodTypeAny, {
|
|
537
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
538
|
+
id: string;
|
|
539
|
+
createdAt: Date;
|
|
540
|
+
agentId: string;
|
|
541
|
+
amount: string;
|
|
542
|
+
asset: "USDC" | "USDT" | "EURC";
|
|
543
|
+
taskContext: {
|
|
544
|
+
taskId?: string | undefined;
|
|
545
|
+
parentRunId?: string | undefined;
|
|
546
|
+
purpose?: string | undefined;
|
|
547
|
+
};
|
|
548
|
+
intentId: string;
|
|
549
|
+
outcome: "allow" | "deny" | "escalate";
|
|
550
|
+
decisionId: string;
|
|
551
|
+
url: string;
|
|
552
|
+
method: string;
|
|
553
|
+
vendorHost: string;
|
|
554
|
+
reason?: string | undefined;
|
|
555
|
+
settlement?: {
|
|
556
|
+
txHash?: string | undefined;
|
|
557
|
+
networkId?: string | undefined;
|
|
558
|
+
raw?: string | undefined;
|
|
559
|
+
} | undefined;
|
|
560
|
+
}, {
|
|
561
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
562
|
+
id: string;
|
|
563
|
+
createdAt: Date;
|
|
564
|
+
agentId: string;
|
|
565
|
+
amount: string;
|
|
566
|
+
asset: "USDC" | "USDT" | "EURC";
|
|
567
|
+
intentId: string;
|
|
568
|
+
outcome: "allow" | "deny" | "escalate";
|
|
569
|
+
decisionId: string;
|
|
570
|
+
url: string;
|
|
571
|
+
vendorHost: string;
|
|
572
|
+
taskContext?: {
|
|
573
|
+
taskId?: string | undefined;
|
|
574
|
+
parentRunId?: string | undefined;
|
|
575
|
+
purpose?: string | undefined;
|
|
576
|
+
} | undefined;
|
|
577
|
+
reason?: string | undefined;
|
|
578
|
+
method?: string | undefined;
|
|
579
|
+
settlement?: {
|
|
580
|
+
txHash?: string | undefined;
|
|
581
|
+
networkId?: string | undefined;
|
|
582
|
+
raw?: string | undefined;
|
|
583
|
+
} | undefined;
|
|
584
|
+
}>;
|
|
585
|
+
type Receipt = z.infer<typeof Receipt>;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The vendor-side twin of `Receipt`: one settled x402 payment as the GATE saw
|
|
589
|
+
* it — who paid, for which priced route, and the settlement transaction. The
|
|
590
|
+
* agent-side Receipt records what an agent tried to spend; a GateReceipt
|
|
591
|
+
* records what a vendor actually earned.
|
|
592
|
+
*/
|
|
593
|
+
declare const GateReceipt: z.ZodObject<{
|
|
594
|
+
id: z.ZodString;
|
|
595
|
+
at: z.ZodDate;
|
|
596
|
+
/** The route pattern that priced this request, e.g. "/api/reports/*". */
|
|
597
|
+
route: z.ZodString;
|
|
598
|
+
/** The concrete resource paid for (URL path actually requested). */
|
|
599
|
+
resource: z.ZodString;
|
|
600
|
+
method: z.ZodString;
|
|
601
|
+
/** The paying wallet address, as asserted by the settled payment. */
|
|
602
|
+
payer: z.ZodString;
|
|
603
|
+
payTo: z.ZodString;
|
|
604
|
+
/** Human-unit decimal amount, e.g. "0.05". */
|
|
605
|
+
amount: z.ZodString;
|
|
606
|
+
/** The same amount in the asset's atomic units, e.g. "50000". */
|
|
607
|
+
amountAtomic: z.ZodString;
|
|
608
|
+
/** Token symbol or contract address, exactly as quoted in the requirement. */
|
|
609
|
+
asset: z.ZodString;
|
|
610
|
+
network: z.ZodString;
|
|
611
|
+
/** Settlement transaction hash (mock ledger or on-chain). */
|
|
612
|
+
transaction: z.ZodString;
|
|
613
|
+
}, "strip", z.ZodTypeAny, {
|
|
614
|
+
at: Date;
|
|
615
|
+
id: string;
|
|
616
|
+
resource: string;
|
|
617
|
+
amount: string;
|
|
618
|
+
asset: string;
|
|
619
|
+
method: string;
|
|
620
|
+
route: string;
|
|
621
|
+
payer: string;
|
|
622
|
+
payTo: string;
|
|
623
|
+
amountAtomic: string;
|
|
624
|
+
network: string;
|
|
625
|
+
transaction: string;
|
|
626
|
+
}, {
|
|
627
|
+
at: Date;
|
|
628
|
+
id: string;
|
|
629
|
+
resource: string;
|
|
630
|
+
amount: string;
|
|
631
|
+
asset: string;
|
|
632
|
+
method: string;
|
|
633
|
+
route: string;
|
|
634
|
+
payer: string;
|
|
635
|
+
payTo: string;
|
|
636
|
+
amountAtomic: string;
|
|
637
|
+
network: string;
|
|
638
|
+
transaction: string;
|
|
639
|
+
}>;
|
|
640
|
+
type GateReceipt = z.infer<typeof GateReceipt>;
|
|
641
|
+
|
|
642
|
+
/** A rolling-window spec, e.g. "24h", "1h", "30m", "7d". */
|
|
643
|
+
declare const Window: z.ZodString;
|
|
644
|
+
type Window = z.infer<typeof Window>;
|
|
645
|
+
/** A relative multiplier, e.g. "3x" (used for price-sanity checks). */
|
|
646
|
+
declare const Multiplier: z.ZodString;
|
|
647
|
+
type Multiplier = z.infer<typeof Multiplier>;
|
|
648
|
+
/**
|
|
649
|
+
* The set of predicates a rule can test. Multiple predicates in one condition
|
|
650
|
+
* are ANDed together. Each maps to an evaluator in the policy engine.
|
|
651
|
+
*/
|
|
652
|
+
declare const Condition: z.ZodEffects<z.ZodObject<{
|
|
653
|
+
/** Per-transaction amount exceeds this value. */
|
|
654
|
+
amountGt: z.ZodOptional<z.ZodString>;
|
|
655
|
+
/** Sum of spend in a rolling window exceeds `gt`. */
|
|
656
|
+
rollingSum: z.ZodOptional<z.ZodObject<{
|
|
657
|
+
window: z.ZodString;
|
|
658
|
+
gt: z.ZodString;
|
|
659
|
+
}, "strip", z.ZodTypeAny, {
|
|
660
|
+
window: string;
|
|
661
|
+
gt: string;
|
|
662
|
+
}, {
|
|
663
|
+
window: string;
|
|
664
|
+
gt: string;
|
|
665
|
+
}>>;
|
|
666
|
+
/** Transaction count in a rolling window exceeds `gt`. */
|
|
667
|
+
txCount: z.ZodOptional<z.ZodObject<{
|
|
668
|
+
window: z.ZodString;
|
|
669
|
+
gt: z.ZodNumber;
|
|
670
|
+
}, "strip", z.ZodTypeAny, {
|
|
671
|
+
window: string;
|
|
672
|
+
gt: number;
|
|
673
|
+
}, {
|
|
674
|
+
window: string;
|
|
675
|
+
gt: number;
|
|
676
|
+
}>>;
|
|
677
|
+
/** Vendor host matches one of these patterns (supports `*` globs). */
|
|
678
|
+
vendorHostIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
679
|
+
/** First time Rein has seen this vendor for the agent. */
|
|
680
|
+
vendorFirstSeen: z.ZodOptional<z.ZodBoolean>;
|
|
681
|
+
/** Vendor reputation score is below this threshold (Phase 3 hook). */
|
|
682
|
+
vendorReputationLt: z.ZodOptional<z.ZodNumber>;
|
|
683
|
+
/** Amount is more than `gt`-times the observed median for this resource. */
|
|
684
|
+
amountVsResourceMedian: z.ZodOptional<z.ZodObject<{
|
|
685
|
+
gt: z.ZodString;
|
|
686
|
+
}, "strip", z.ZodTypeAny, {
|
|
687
|
+
gt: string;
|
|
688
|
+
}, {
|
|
689
|
+
gt: string;
|
|
690
|
+
}>>;
|
|
691
|
+
}, "strip", z.ZodTypeAny, {
|
|
692
|
+
amountGt?: string | undefined;
|
|
693
|
+
rollingSum?: {
|
|
694
|
+
window: string;
|
|
695
|
+
gt: string;
|
|
696
|
+
} | undefined;
|
|
697
|
+
txCount?: {
|
|
698
|
+
window: string;
|
|
699
|
+
gt: number;
|
|
700
|
+
} | undefined;
|
|
701
|
+
vendorHostIn?: string[] | undefined;
|
|
702
|
+
vendorFirstSeen?: boolean | undefined;
|
|
703
|
+
vendorReputationLt?: number | undefined;
|
|
704
|
+
amountVsResourceMedian?: {
|
|
705
|
+
gt: string;
|
|
706
|
+
} | undefined;
|
|
707
|
+
}, {
|
|
708
|
+
amountGt?: string | undefined;
|
|
709
|
+
rollingSum?: {
|
|
710
|
+
window: string;
|
|
711
|
+
gt: string;
|
|
712
|
+
} | undefined;
|
|
713
|
+
txCount?: {
|
|
714
|
+
window: string;
|
|
715
|
+
gt: number;
|
|
716
|
+
} | undefined;
|
|
717
|
+
vendorHostIn?: string[] | undefined;
|
|
718
|
+
vendorFirstSeen?: boolean | undefined;
|
|
719
|
+
vendorReputationLt?: number | undefined;
|
|
720
|
+
amountVsResourceMedian?: {
|
|
721
|
+
gt: string;
|
|
722
|
+
} | undefined;
|
|
723
|
+
}>, {
|
|
724
|
+
amountGt?: string | undefined;
|
|
725
|
+
rollingSum?: {
|
|
726
|
+
window: string;
|
|
727
|
+
gt: string;
|
|
728
|
+
} | undefined;
|
|
729
|
+
txCount?: {
|
|
730
|
+
window: string;
|
|
731
|
+
gt: number;
|
|
732
|
+
} | undefined;
|
|
733
|
+
vendorHostIn?: string[] | undefined;
|
|
734
|
+
vendorFirstSeen?: boolean | undefined;
|
|
735
|
+
vendorReputationLt?: number | undefined;
|
|
736
|
+
amountVsResourceMedian?: {
|
|
737
|
+
gt: string;
|
|
738
|
+
} | undefined;
|
|
739
|
+
}, {
|
|
740
|
+
amountGt?: string | undefined;
|
|
741
|
+
rollingSum?: {
|
|
742
|
+
window: string;
|
|
743
|
+
gt: string;
|
|
744
|
+
} | undefined;
|
|
745
|
+
txCount?: {
|
|
746
|
+
window: string;
|
|
747
|
+
gt: number;
|
|
748
|
+
} | undefined;
|
|
749
|
+
vendorHostIn?: string[] | undefined;
|
|
750
|
+
vendorFirstSeen?: boolean | undefined;
|
|
751
|
+
vendorReputationLt?: number | undefined;
|
|
752
|
+
amountVsResourceMedian?: {
|
|
753
|
+
gt: string;
|
|
754
|
+
} | undefined;
|
|
755
|
+
}>;
|
|
756
|
+
type Condition = z.infer<typeof Condition>;
|
|
757
|
+
/**
|
|
758
|
+
* A single rule: an id plus exactly one action (allow / deny / escalate) whose
|
|
759
|
+
* value is the condition that triggers it.
|
|
760
|
+
*/
|
|
761
|
+
declare const Rule: z.ZodEffects<z.ZodObject<{
|
|
762
|
+
id: z.ZodString;
|
|
763
|
+
allow: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
764
|
+
/** Per-transaction amount exceeds this value. */
|
|
765
|
+
amountGt: z.ZodOptional<z.ZodString>;
|
|
766
|
+
/** Sum of spend in a rolling window exceeds `gt`. */
|
|
767
|
+
rollingSum: z.ZodOptional<z.ZodObject<{
|
|
768
|
+
window: z.ZodString;
|
|
769
|
+
gt: z.ZodString;
|
|
770
|
+
}, "strip", z.ZodTypeAny, {
|
|
771
|
+
window: string;
|
|
772
|
+
gt: string;
|
|
773
|
+
}, {
|
|
774
|
+
window: string;
|
|
775
|
+
gt: string;
|
|
776
|
+
}>>;
|
|
777
|
+
/** Transaction count in a rolling window exceeds `gt`. */
|
|
778
|
+
txCount: z.ZodOptional<z.ZodObject<{
|
|
779
|
+
window: z.ZodString;
|
|
780
|
+
gt: z.ZodNumber;
|
|
781
|
+
}, "strip", z.ZodTypeAny, {
|
|
782
|
+
window: string;
|
|
783
|
+
gt: number;
|
|
784
|
+
}, {
|
|
785
|
+
window: string;
|
|
786
|
+
gt: number;
|
|
787
|
+
}>>;
|
|
788
|
+
/** Vendor host matches one of these patterns (supports `*` globs). */
|
|
789
|
+
vendorHostIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
790
|
+
/** First time Rein has seen this vendor for the agent. */
|
|
791
|
+
vendorFirstSeen: z.ZodOptional<z.ZodBoolean>;
|
|
792
|
+
/** Vendor reputation score is below this threshold (Phase 3 hook). */
|
|
793
|
+
vendorReputationLt: z.ZodOptional<z.ZodNumber>;
|
|
794
|
+
/** Amount is more than `gt`-times the observed median for this resource. */
|
|
795
|
+
amountVsResourceMedian: z.ZodOptional<z.ZodObject<{
|
|
796
|
+
gt: z.ZodString;
|
|
797
|
+
}, "strip", z.ZodTypeAny, {
|
|
798
|
+
gt: string;
|
|
799
|
+
}, {
|
|
800
|
+
gt: string;
|
|
801
|
+
}>>;
|
|
802
|
+
}, "strip", z.ZodTypeAny, {
|
|
803
|
+
amountGt?: string | undefined;
|
|
804
|
+
rollingSum?: {
|
|
805
|
+
window: string;
|
|
806
|
+
gt: string;
|
|
807
|
+
} | undefined;
|
|
808
|
+
txCount?: {
|
|
809
|
+
window: string;
|
|
810
|
+
gt: number;
|
|
811
|
+
} | undefined;
|
|
812
|
+
vendorHostIn?: string[] | undefined;
|
|
813
|
+
vendorFirstSeen?: boolean | undefined;
|
|
814
|
+
vendorReputationLt?: number | undefined;
|
|
815
|
+
amountVsResourceMedian?: {
|
|
816
|
+
gt: string;
|
|
817
|
+
} | undefined;
|
|
818
|
+
}, {
|
|
819
|
+
amountGt?: string | undefined;
|
|
820
|
+
rollingSum?: {
|
|
821
|
+
window: string;
|
|
822
|
+
gt: string;
|
|
823
|
+
} | undefined;
|
|
824
|
+
txCount?: {
|
|
825
|
+
window: string;
|
|
826
|
+
gt: number;
|
|
827
|
+
} | undefined;
|
|
828
|
+
vendorHostIn?: string[] | undefined;
|
|
829
|
+
vendorFirstSeen?: boolean | undefined;
|
|
830
|
+
vendorReputationLt?: number | undefined;
|
|
831
|
+
amountVsResourceMedian?: {
|
|
832
|
+
gt: string;
|
|
833
|
+
} | undefined;
|
|
834
|
+
}>, {
|
|
835
|
+
amountGt?: string | undefined;
|
|
836
|
+
rollingSum?: {
|
|
837
|
+
window: string;
|
|
838
|
+
gt: string;
|
|
839
|
+
} | undefined;
|
|
840
|
+
txCount?: {
|
|
841
|
+
window: string;
|
|
842
|
+
gt: number;
|
|
843
|
+
} | undefined;
|
|
844
|
+
vendorHostIn?: string[] | undefined;
|
|
845
|
+
vendorFirstSeen?: boolean | undefined;
|
|
846
|
+
vendorReputationLt?: number | undefined;
|
|
847
|
+
amountVsResourceMedian?: {
|
|
848
|
+
gt: string;
|
|
849
|
+
} | undefined;
|
|
850
|
+
}, {
|
|
851
|
+
amountGt?: string | undefined;
|
|
852
|
+
rollingSum?: {
|
|
853
|
+
window: string;
|
|
854
|
+
gt: string;
|
|
855
|
+
} | undefined;
|
|
856
|
+
txCount?: {
|
|
857
|
+
window: string;
|
|
858
|
+
gt: number;
|
|
859
|
+
} | undefined;
|
|
860
|
+
vendorHostIn?: string[] | undefined;
|
|
861
|
+
vendorFirstSeen?: boolean | undefined;
|
|
862
|
+
vendorReputationLt?: number | undefined;
|
|
863
|
+
amountVsResourceMedian?: {
|
|
864
|
+
gt: string;
|
|
865
|
+
} | undefined;
|
|
866
|
+
}>>;
|
|
867
|
+
deny: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
868
|
+
/** Per-transaction amount exceeds this value. */
|
|
869
|
+
amountGt: z.ZodOptional<z.ZodString>;
|
|
870
|
+
/** Sum of spend in a rolling window exceeds `gt`. */
|
|
871
|
+
rollingSum: z.ZodOptional<z.ZodObject<{
|
|
872
|
+
window: z.ZodString;
|
|
873
|
+
gt: z.ZodString;
|
|
874
|
+
}, "strip", z.ZodTypeAny, {
|
|
875
|
+
window: string;
|
|
876
|
+
gt: string;
|
|
877
|
+
}, {
|
|
878
|
+
window: string;
|
|
879
|
+
gt: string;
|
|
880
|
+
}>>;
|
|
881
|
+
/** Transaction count in a rolling window exceeds `gt`. */
|
|
882
|
+
txCount: z.ZodOptional<z.ZodObject<{
|
|
883
|
+
window: z.ZodString;
|
|
884
|
+
gt: z.ZodNumber;
|
|
885
|
+
}, "strip", z.ZodTypeAny, {
|
|
886
|
+
window: string;
|
|
887
|
+
gt: number;
|
|
888
|
+
}, {
|
|
889
|
+
window: string;
|
|
890
|
+
gt: number;
|
|
891
|
+
}>>;
|
|
892
|
+
/** Vendor host matches one of these patterns (supports `*` globs). */
|
|
893
|
+
vendorHostIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
894
|
+
/** First time Rein has seen this vendor for the agent. */
|
|
895
|
+
vendorFirstSeen: z.ZodOptional<z.ZodBoolean>;
|
|
896
|
+
/** Vendor reputation score is below this threshold (Phase 3 hook). */
|
|
897
|
+
vendorReputationLt: z.ZodOptional<z.ZodNumber>;
|
|
898
|
+
/** Amount is more than `gt`-times the observed median for this resource. */
|
|
899
|
+
amountVsResourceMedian: z.ZodOptional<z.ZodObject<{
|
|
900
|
+
gt: z.ZodString;
|
|
901
|
+
}, "strip", z.ZodTypeAny, {
|
|
902
|
+
gt: string;
|
|
903
|
+
}, {
|
|
904
|
+
gt: string;
|
|
905
|
+
}>>;
|
|
906
|
+
}, "strip", z.ZodTypeAny, {
|
|
907
|
+
amountGt?: string | undefined;
|
|
908
|
+
rollingSum?: {
|
|
909
|
+
window: string;
|
|
910
|
+
gt: string;
|
|
911
|
+
} | undefined;
|
|
912
|
+
txCount?: {
|
|
913
|
+
window: string;
|
|
914
|
+
gt: number;
|
|
915
|
+
} | undefined;
|
|
916
|
+
vendorHostIn?: string[] | undefined;
|
|
917
|
+
vendorFirstSeen?: boolean | undefined;
|
|
918
|
+
vendorReputationLt?: number | undefined;
|
|
919
|
+
amountVsResourceMedian?: {
|
|
920
|
+
gt: string;
|
|
921
|
+
} | undefined;
|
|
922
|
+
}, {
|
|
923
|
+
amountGt?: string | undefined;
|
|
924
|
+
rollingSum?: {
|
|
925
|
+
window: string;
|
|
926
|
+
gt: string;
|
|
927
|
+
} | undefined;
|
|
928
|
+
txCount?: {
|
|
929
|
+
window: string;
|
|
930
|
+
gt: number;
|
|
931
|
+
} | undefined;
|
|
932
|
+
vendorHostIn?: string[] | undefined;
|
|
933
|
+
vendorFirstSeen?: boolean | undefined;
|
|
934
|
+
vendorReputationLt?: number | undefined;
|
|
935
|
+
amountVsResourceMedian?: {
|
|
936
|
+
gt: string;
|
|
937
|
+
} | undefined;
|
|
938
|
+
}>, {
|
|
939
|
+
amountGt?: string | undefined;
|
|
940
|
+
rollingSum?: {
|
|
941
|
+
window: string;
|
|
942
|
+
gt: string;
|
|
943
|
+
} | undefined;
|
|
944
|
+
txCount?: {
|
|
945
|
+
window: string;
|
|
946
|
+
gt: number;
|
|
947
|
+
} | undefined;
|
|
948
|
+
vendorHostIn?: string[] | undefined;
|
|
949
|
+
vendorFirstSeen?: boolean | undefined;
|
|
950
|
+
vendorReputationLt?: number | undefined;
|
|
951
|
+
amountVsResourceMedian?: {
|
|
952
|
+
gt: string;
|
|
953
|
+
} | undefined;
|
|
954
|
+
}, {
|
|
955
|
+
amountGt?: string | undefined;
|
|
956
|
+
rollingSum?: {
|
|
957
|
+
window: string;
|
|
958
|
+
gt: string;
|
|
959
|
+
} | undefined;
|
|
960
|
+
txCount?: {
|
|
961
|
+
window: string;
|
|
962
|
+
gt: number;
|
|
963
|
+
} | undefined;
|
|
964
|
+
vendorHostIn?: string[] | undefined;
|
|
965
|
+
vendorFirstSeen?: boolean | undefined;
|
|
966
|
+
vendorReputationLt?: number | undefined;
|
|
967
|
+
amountVsResourceMedian?: {
|
|
968
|
+
gt: string;
|
|
969
|
+
} | undefined;
|
|
970
|
+
}>>;
|
|
971
|
+
escalate: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
972
|
+
/** Per-transaction amount exceeds this value. */
|
|
973
|
+
amountGt: z.ZodOptional<z.ZodString>;
|
|
974
|
+
/** Sum of spend in a rolling window exceeds `gt`. */
|
|
975
|
+
rollingSum: z.ZodOptional<z.ZodObject<{
|
|
976
|
+
window: z.ZodString;
|
|
977
|
+
gt: z.ZodString;
|
|
978
|
+
}, "strip", z.ZodTypeAny, {
|
|
979
|
+
window: string;
|
|
980
|
+
gt: string;
|
|
981
|
+
}, {
|
|
982
|
+
window: string;
|
|
983
|
+
gt: string;
|
|
984
|
+
}>>;
|
|
985
|
+
/** Transaction count in a rolling window exceeds `gt`. */
|
|
986
|
+
txCount: z.ZodOptional<z.ZodObject<{
|
|
987
|
+
window: z.ZodString;
|
|
988
|
+
gt: z.ZodNumber;
|
|
989
|
+
}, "strip", z.ZodTypeAny, {
|
|
990
|
+
window: string;
|
|
991
|
+
gt: number;
|
|
992
|
+
}, {
|
|
993
|
+
window: string;
|
|
994
|
+
gt: number;
|
|
995
|
+
}>>;
|
|
996
|
+
/** Vendor host matches one of these patterns (supports `*` globs). */
|
|
997
|
+
vendorHostIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
998
|
+
/** First time Rein has seen this vendor for the agent. */
|
|
999
|
+
vendorFirstSeen: z.ZodOptional<z.ZodBoolean>;
|
|
1000
|
+
/** Vendor reputation score is below this threshold (Phase 3 hook). */
|
|
1001
|
+
vendorReputationLt: z.ZodOptional<z.ZodNumber>;
|
|
1002
|
+
/** Amount is more than `gt`-times the observed median for this resource. */
|
|
1003
|
+
amountVsResourceMedian: z.ZodOptional<z.ZodObject<{
|
|
1004
|
+
gt: z.ZodString;
|
|
1005
|
+
}, "strip", z.ZodTypeAny, {
|
|
1006
|
+
gt: string;
|
|
1007
|
+
}, {
|
|
1008
|
+
gt: string;
|
|
1009
|
+
}>>;
|
|
1010
|
+
}, "strip", z.ZodTypeAny, {
|
|
1011
|
+
amountGt?: string | undefined;
|
|
1012
|
+
rollingSum?: {
|
|
1013
|
+
window: string;
|
|
1014
|
+
gt: string;
|
|
1015
|
+
} | undefined;
|
|
1016
|
+
txCount?: {
|
|
1017
|
+
window: string;
|
|
1018
|
+
gt: number;
|
|
1019
|
+
} | undefined;
|
|
1020
|
+
vendorHostIn?: string[] | undefined;
|
|
1021
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1022
|
+
vendorReputationLt?: number | undefined;
|
|
1023
|
+
amountVsResourceMedian?: {
|
|
1024
|
+
gt: string;
|
|
1025
|
+
} | undefined;
|
|
1026
|
+
}, {
|
|
1027
|
+
amountGt?: string | undefined;
|
|
1028
|
+
rollingSum?: {
|
|
1029
|
+
window: string;
|
|
1030
|
+
gt: string;
|
|
1031
|
+
} | undefined;
|
|
1032
|
+
txCount?: {
|
|
1033
|
+
window: string;
|
|
1034
|
+
gt: number;
|
|
1035
|
+
} | undefined;
|
|
1036
|
+
vendorHostIn?: string[] | undefined;
|
|
1037
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1038
|
+
vendorReputationLt?: number | undefined;
|
|
1039
|
+
amountVsResourceMedian?: {
|
|
1040
|
+
gt: string;
|
|
1041
|
+
} | undefined;
|
|
1042
|
+
}>, {
|
|
1043
|
+
amountGt?: string | undefined;
|
|
1044
|
+
rollingSum?: {
|
|
1045
|
+
window: string;
|
|
1046
|
+
gt: string;
|
|
1047
|
+
} | undefined;
|
|
1048
|
+
txCount?: {
|
|
1049
|
+
window: string;
|
|
1050
|
+
gt: number;
|
|
1051
|
+
} | undefined;
|
|
1052
|
+
vendorHostIn?: string[] | undefined;
|
|
1053
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1054
|
+
vendorReputationLt?: number | undefined;
|
|
1055
|
+
amountVsResourceMedian?: {
|
|
1056
|
+
gt: string;
|
|
1057
|
+
} | undefined;
|
|
1058
|
+
}, {
|
|
1059
|
+
amountGt?: string | undefined;
|
|
1060
|
+
rollingSum?: {
|
|
1061
|
+
window: string;
|
|
1062
|
+
gt: string;
|
|
1063
|
+
} | undefined;
|
|
1064
|
+
txCount?: {
|
|
1065
|
+
window: string;
|
|
1066
|
+
gt: number;
|
|
1067
|
+
} | undefined;
|
|
1068
|
+
vendorHostIn?: string[] | undefined;
|
|
1069
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1070
|
+
vendorReputationLt?: number | undefined;
|
|
1071
|
+
amountVsResourceMedian?: {
|
|
1072
|
+
gt: string;
|
|
1073
|
+
} | undefined;
|
|
1074
|
+
}>>;
|
|
1075
|
+
}, "strip", z.ZodTypeAny, {
|
|
1076
|
+
id: string;
|
|
1077
|
+
allow?: {
|
|
1078
|
+
amountGt?: string | undefined;
|
|
1079
|
+
rollingSum?: {
|
|
1080
|
+
window: string;
|
|
1081
|
+
gt: string;
|
|
1082
|
+
} | undefined;
|
|
1083
|
+
txCount?: {
|
|
1084
|
+
window: string;
|
|
1085
|
+
gt: number;
|
|
1086
|
+
} | undefined;
|
|
1087
|
+
vendorHostIn?: string[] | undefined;
|
|
1088
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1089
|
+
vendorReputationLt?: number | undefined;
|
|
1090
|
+
amountVsResourceMedian?: {
|
|
1091
|
+
gt: string;
|
|
1092
|
+
} | undefined;
|
|
1093
|
+
} | undefined;
|
|
1094
|
+
deny?: {
|
|
1095
|
+
amountGt?: string | undefined;
|
|
1096
|
+
rollingSum?: {
|
|
1097
|
+
window: string;
|
|
1098
|
+
gt: string;
|
|
1099
|
+
} | undefined;
|
|
1100
|
+
txCount?: {
|
|
1101
|
+
window: string;
|
|
1102
|
+
gt: number;
|
|
1103
|
+
} | undefined;
|
|
1104
|
+
vendorHostIn?: string[] | undefined;
|
|
1105
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1106
|
+
vendorReputationLt?: number | undefined;
|
|
1107
|
+
amountVsResourceMedian?: {
|
|
1108
|
+
gt: string;
|
|
1109
|
+
} | undefined;
|
|
1110
|
+
} | undefined;
|
|
1111
|
+
escalate?: {
|
|
1112
|
+
amountGt?: string | undefined;
|
|
1113
|
+
rollingSum?: {
|
|
1114
|
+
window: string;
|
|
1115
|
+
gt: string;
|
|
1116
|
+
} | undefined;
|
|
1117
|
+
txCount?: {
|
|
1118
|
+
window: string;
|
|
1119
|
+
gt: number;
|
|
1120
|
+
} | undefined;
|
|
1121
|
+
vendorHostIn?: string[] | undefined;
|
|
1122
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1123
|
+
vendorReputationLt?: number | undefined;
|
|
1124
|
+
amountVsResourceMedian?: {
|
|
1125
|
+
gt: string;
|
|
1126
|
+
} | undefined;
|
|
1127
|
+
} | undefined;
|
|
1128
|
+
}, {
|
|
1129
|
+
id: string;
|
|
1130
|
+
allow?: {
|
|
1131
|
+
amountGt?: string | undefined;
|
|
1132
|
+
rollingSum?: {
|
|
1133
|
+
window: string;
|
|
1134
|
+
gt: string;
|
|
1135
|
+
} | undefined;
|
|
1136
|
+
txCount?: {
|
|
1137
|
+
window: string;
|
|
1138
|
+
gt: number;
|
|
1139
|
+
} | undefined;
|
|
1140
|
+
vendorHostIn?: string[] | undefined;
|
|
1141
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1142
|
+
vendorReputationLt?: number | undefined;
|
|
1143
|
+
amountVsResourceMedian?: {
|
|
1144
|
+
gt: string;
|
|
1145
|
+
} | undefined;
|
|
1146
|
+
} | undefined;
|
|
1147
|
+
deny?: {
|
|
1148
|
+
amountGt?: string | undefined;
|
|
1149
|
+
rollingSum?: {
|
|
1150
|
+
window: string;
|
|
1151
|
+
gt: string;
|
|
1152
|
+
} | undefined;
|
|
1153
|
+
txCount?: {
|
|
1154
|
+
window: string;
|
|
1155
|
+
gt: number;
|
|
1156
|
+
} | undefined;
|
|
1157
|
+
vendorHostIn?: string[] | undefined;
|
|
1158
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1159
|
+
vendorReputationLt?: number | undefined;
|
|
1160
|
+
amountVsResourceMedian?: {
|
|
1161
|
+
gt: string;
|
|
1162
|
+
} | undefined;
|
|
1163
|
+
} | undefined;
|
|
1164
|
+
escalate?: {
|
|
1165
|
+
amountGt?: string | undefined;
|
|
1166
|
+
rollingSum?: {
|
|
1167
|
+
window: string;
|
|
1168
|
+
gt: string;
|
|
1169
|
+
} | undefined;
|
|
1170
|
+
txCount?: {
|
|
1171
|
+
window: string;
|
|
1172
|
+
gt: number;
|
|
1173
|
+
} | undefined;
|
|
1174
|
+
vendorHostIn?: string[] | undefined;
|
|
1175
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1176
|
+
vendorReputationLt?: number | undefined;
|
|
1177
|
+
amountVsResourceMedian?: {
|
|
1178
|
+
gt: string;
|
|
1179
|
+
} | undefined;
|
|
1180
|
+
} | undefined;
|
|
1181
|
+
}>, {
|
|
1182
|
+
id: string;
|
|
1183
|
+
allow?: {
|
|
1184
|
+
amountGt?: string | undefined;
|
|
1185
|
+
rollingSum?: {
|
|
1186
|
+
window: string;
|
|
1187
|
+
gt: string;
|
|
1188
|
+
} | undefined;
|
|
1189
|
+
txCount?: {
|
|
1190
|
+
window: string;
|
|
1191
|
+
gt: number;
|
|
1192
|
+
} | undefined;
|
|
1193
|
+
vendorHostIn?: string[] | undefined;
|
|
1194
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1195
|
+
vendorReputationLt?: number | undefined;
|
|
1196
|
+
amountVsResourceMedian?: {
|
|
1197
|
+
gt: string;
|
|
1198
|
+
} | undefined;
|
|
1199
|
+
} | undefined;
|
|
1200
|
+
deny?: {
|
|
1201
|
+
amountGt?: string | undefined;
|
|
1202
|
+
rollingSum?: {
|
|
1203
|
+
window: string;
|
|
1204
|
+
gt: string;
|
|
1205
|
+
} | undefined;
|
|
1206
|
+
txCount?: {
|
|
1207
|
+
window: string;
|
|
1208
|
+
gt: number;
|
|
1209
|
+
} | undefined;
|
|
1210
|
+
vendorHostIn?: string[] | undefined;
|
|
1211
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1212
|
+
vendorReputationLt?: number | undefined;
|
|
1213
|
+
amountVsResourceMedian?: {
|
|
1214
|
+
gt: string;
|
|
1215
|
+
} | undefined;
|
|
1216
|
+
} | undefined;
|
|
1217
|
+
escalate?: {
|
|
1218
|
+
amountGt?: string | undefined;
|
|
1219
|
+
rollingSum?: {
|
|
1220
|
+
window: string;
|
|
1221
|
+
gt: string;
|
|
1222
|
+
} | undefined;
|
|
1223
|
+
txCount?: {
|
|
1224
|
+
window: string;
|
|
1225
|
+
gt: number;
|
|
1226
|
+
} | undefined;
|
|
1227
|
+
vendorHostIn?: string[] | undefined;
|
|
1228
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1229
|
+
vendorReputationLt?: number | undefined;
|
|
1230
|
+
amountVsResourceMedian?: {
|
|
1231
|
+
gt: string;
|
|
1232
|
+
} | undefined;
|
|
1233
|
+
} | undefined;
|
|
1234
|
+
}, {
|
|
1235
|
+
id: string;
|
|
1236
|
+
allow?: {
|
|
1237
|
+
amountGt?: string | undefined;
|
|
1238
|
+
rollingSum?: {
|
|
1239
|
+
window: string;
|
|
1240
|
+
gt: string;
|
|
1241
|
+
} | undefined;
|
|
1242
|
+
txCount?: {
|
|
1243
|
+
window: string;
|
|
1244
|
+
gt: number;
|
|
1245
|
+
} | undefined;
|
|
1246
|
+
vendorHostIn?: string[] | undefined;
|
|
1247
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1248
|
+
vendorReputationLt?: number | undefined;
|
|
1249
|
+
amountVsResourceMedian?: {
|
|
1250
|
+
gt: string;
|
|
1251
|
+
} | undefined;
|
|
1252
|
+
} | undefined;
|
|
1253
|
+
deny?: {
|
|
1254
|
+
amountGt?: string | undefined;
|
|
1255
|
+
rollingSum?: {
|
|
1256
|
+
window: string;
|
|
1257
|
+
gt: string;
|
|
1258
|
+
} | undefined;
|
|
1259
|
+
txCount?: {
|
|
1260
|
+
window: string;
|
|
1261
|
+
gt: number;
|
|
1262
|
+
} | undefined;
|
|
1263
|
+
vendorHostIn?: string[] | undefined;
|
|
1264
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1265
|
+
vendorReputationLt?: number | undefined;
|
|
1266
|
+
amountVsResourceMedian?: {
|
|
1267
|
+
gt: string;
|
|
1268
|
+
} | undefined;
|
|
1269
|
+
} | undefined;
|
|
1270
|
+
escalate?: {
|
|
1271
|
+
amountGt?: string | undefined;
|
|
1272
|
+
rollingSum?: {
|
|
1273
|
+
window: string;
|
|
1274
|
+
gt: string;
|
|
1275
|
+
} | undefined;
|
|
1276
|
+
txCount?: {
|
|
1277
|
+
window: string;
|
|
1278
|
+
gt: number;
|
|
1279
|
+
} | undefined;
|
|
1280
|
+
vendorHostIn?: string[] | undefined;
|
|
1281
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1282
|
+
vendorReputationLt?: number | undefined;
|
|
1283
|
+
amountVsResourceMedian?: {
|
|
1284
|
+
gt: string;
|
|
1285
|
+
} | undefined;
|
|
1286
|
+
} | undefined;
|
|
1287
|
+
}>;
|
|
1288
|
+
type Rule = z.infer<typeof Rule>;
|
|
1289
|
+
declare const PolicyDefault: z.ZodEnum<["allow", "deny"]>;
|
|
1290
|
+
type PolicyDefault = z.infer<typeof PolicyDefault>;
|
|
1291
|
+
declare const AppliesTo: z.ZodObject<{
|
|
1292
|
+
/** Agent id patterns (supports `*` globs, e.g. "agt_research_*"). */
|
|
1293
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1294
|
+
chains: z.ZodOptional<z.ZodArray<z.ZodEnum<["base", "solana", "polygon", "bnb"]>, "many">>;
|
|
1295
|
+
}, "strip", z.ZodTypeAny, {
|
|
1296
|
+
agents?: string[] | undefined;
|
|
1297
|
+
chains?: ("base" | "solana" | "polygon" | "bnb")[] | undefined;
|
|
1298
|
+
}, {
|
|
1299
|
+
agents?: string[] | undefined;
|
|
1300
|
+
chains?: ("base" | "solana" | "polygon" | "bnb")[] | undefined;
|
|
1301
|
+
}>;
|
|
1302
|
+
type AppliesTo = z.infer<typeof AppliesTo>;
|
|
1303
|
+
declare const Escalation: z.ZodObject<{
|
|
1304
|
+
approvers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1305
|
+
timeoutAction: z.ZodDefault<z.ZodEnum<["allow", "deny"]>>;
|
|
1306
|
+
timeoutMin: z.ZodDefault<z.ZodNumber>;
|
|
1307
|
+
}, "strip", z.ZodTypeAny, {
|
|
1308
|
+
approvers: string[];
|
|
1309
|
+
timeoutAction: "allow" | "deny";
|
|
1310
|
+
timeoutMin: number;
|
|
1311
|
+
}, {
|
|
1312
|
+
approvers?: string[] | undefined;
|
|
1313
|
+
timeoutAction?: "allow" | "deny" | undefined;
|
|
1314
|
+
timeoutMin?: number | undefined;
|
|
1315
|
+
}>;
|
|
1316
|
+
type Escalation = z.infer<typeof Escalation>;
|
|
1317
|
+
/**
|
|
1318
|
+
* A declarative, versioned, immutable-once-active policy. Evaluation order in
|
|
1319
|
+
* the engine is: explicit DENY > ESCALATE > ALLOW > `default`.
|
|
1320
|
+
*/
|
|
1321
|
+
declare const Policy: z.ZodObject<{
|
|
1322
|
+
policyId: z.ZodString;
|
|
1323
|
+
version: z.ZodDefault<z.ZodString>;
|
|
1324
|
+
appliesTo: z.ZodDefault<z.ZodObject<{
|
|
1325
|
+
/** Agent id patterns (supports `*` globs, e.g. "agt_research_*"). */
|
|
1326
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1327
|
+
chains: z.ZodOptional<z.ZodArray<z.ZodEnum<["base", "solana", "polygon", "bnb"]>, "many">>;
|
|
1328
|
+
}, "strip", z.ZodTypeAny, {
|
|
1329
|
+
agents?: string[] | undefined;
|
|
1330
|
+
chains?: ("base" | "solana" | "polygon" | "bnb")[] | undefined;
|
|
1331
|
+
}, {
|
|
1332
|
+
agents?: string[] | undefined;
|
|
1333
|
+
chains?: ("base" | "solana" | "polygon" | "bnb")[] | undefined;
|
|
1334
|
+
}>>;
|
|
1335
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
1336
|
+
id: z.ZodString;
|
|
1337
|
+
allow: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
1338
|
+
/** Per-transaction amount exceeds this value. */
|
|
1339
|
+
amountGt: z.ZodOptional<z.ZodString>;
|
|
1340
|
+
/** Sum of spend in a rolling window exceeds `gt`. */
|
|
1341
|
+
rollingSum: z.ZodOptional<z.ZodObject<{
|
|
1342
|
+
window: z.ZodString;
|
|
1343
|
+
gt: z.ZodString;
|
|
1344
|
+
}, "strip", z.ZodTypeAny, {
|
|
1345
|
+
window: string;
|
|
1346
|
+
gt: string;
|
|
1347
|
+
}, {
|
|
1348
|
+
window: string;
|
|
1349
|
+
gt: string;
|
|
1350
|
+
}>>;
|
|
1351
|
+
/** Transaction count in a rolling window exceeds `gt`. */
|
|
1352
|
+
txCount: z.ZodOptional<z.ZodObject<{
|
|
1353
|
+
window: z.ZodString;
|
|
1354
|
+
gt: z.ZodNumber;
|
|
1355
|
+
}, "strip", z.ZodTypeAny, {
|
|
1356
|
+
window: string;
|
|
1357
|
+
gt: number;
|
|
1358
|
+
}, {
|
|
1359
|
+
window: string;
|
|
1360
|
+
gt: number;
|
|
1361
|
+
}>>;
|
|
1362
|
+
/** Vendor host matches one of these patterns (supports `*` globs). */
|
|
1363
|
+
vendorHostIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1364
|
+
/** First time Rein has seen this vendor for the agent. */
|
|
1365
|
+
vendorFirstSeen: z.ZodOptional<z.ZodBoolean>;
|
|
1366
|
+
/** Vendor reputation score is below this threshold (Phase 3 hook). */
|
|
1367
|
+
vendorReputationLt: z.ZodOptional<z.ZodNumber>;
|
|
1368
|
+
/** Amount is more than `gt`-times the observed median for this resource. */
|
|
1369
|
+
amountVsResourceMedian: z.ZodOptional<z.ZodObject<{
|
|
1370
|
+
gt: z.ZodString;
|
|
1371
|
+
}, "strip", z.ZodTypeAny, {
|
|
1372
|
+
gt: string;
|
|
1373
|
+
}, {
|
|
1374
|
+
gt: string;
|
|
1375
|
+
}>>;
|
|
1376
|
+
}, "strip", z.ZodTypeAny, {
|
|
1377
|
+
amountGt?: string | undefined;
|
|
1378
|
+
rollingSum?: {
|
|
1379
|
+
window: string;
|
|
1380
|
+
gt: string;
|
|
1381
|
+
} | undefined;
|
|
1382
|
+
txCount?: {
|
|
1383
|
+
window: string;
|
|
1384
|
+
gt: number;
|
|
1385
|
+
} | undefined;
|
|
1386
|
+
vendorHostIn?: string[] | undefined;
|
|
1387
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1388
|
+
vendorReputationLt?: number | undefined;
|
|
1389
|
+
amountVsResourceMedian?: {
|
|
1390
|
+
gt: string;
|
|
1391
|
+
} | undefined;
|
|
1392
|
+
}, {
|
|
1393
|
+
amountGt?: string | undefined;
|
|
1394
|
+
rollingSum?: {
|
|
1395
|
+
window: string;
|
|
1396
|
+
gt: string;
|
|
1397
|
+
} | undefined;
|
|
1398
|
+
txCount?: {
|
|
1399
|
+
window: string;
|
|
1400
|
+
gt: number;
|
|
1401
|
+
} | undefined;
|
|
1402
|
+
vendorHostIn?: string[] | undefined;
|
|
1403
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1404
|
+
vendorReputationLt?: number | undefined;
|
|
1405
|
+
amountVsResourceMedian?: {
|
|
1406
|
+
gt: string;
|
|
1407
|
+
} | undefined;
|
|
1408
|
+
}>, {
|
|
1409
|
+
amountGt?: string | undefined;
|
|
1410
|
+
rollingSum?: {
|
|
1411
|
+
window: string;
|
|
1412
|
+
gt: string;
|
|
1413
|
+
} | undefined;
|
|
1414
|
+
txCount?: {
|
|
1415
|
+
window: string;
|
|
1416
|
+
gt: number;
|
|
1417
|
+
} | undefined;
|
|
1418
|
+
vendorHostIn?: string[] | undefined;
|
|
1419
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1420
|
+
vendorReputationLt?: number | undefined;
|
|
1421
|
+
amountVsResourceMedian?: {
|
|
1422
|
+
gt: string;
|
|
1423
|
+
} | undefined;
|
|
1424
|
+
}, {
|
|
1425
|
+
amountGt?: string | undefined;
|
|
1426
|
+
rollingSum?: {
|
|
1427
|
+
window: string;
|
|
1428
|
+
gt: string;
|
|
1429
|
+
} | undefined;
|
|
1430
|
+
txCount?: {
|
|
1431
|
+
window: string;
|
|
1432
|
+
gt: number;
|
|
1433
|
+
} | undefined;
|
|
1434
|
+
vendorHostIn?: string[] | undefined;
|
|
1435
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1436
|
+
vendorReputationLt?: number | undefined;
|
|
1437
|
+
amountVsResourceMedian?: {
|
|
1438
|
+
gt: string;
|
|
1439
|
+
} | undefined;
|
|
1440
|
+
}>>;
|
|
1441
|
+
deny: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
1442
|
+
/** Per-transaction amount exceeds this value. */
|
|
1443
|
+
amountGt: z.ZodOptional<z.ZodString>;
|
|
1444
|
+
/** Sum of spend in a rolling window exceeds `gt`. */
|
|
1445
|
+
rollingSum: z.ZodOptional<z.ZodObject<{
|
|
1446
|
+
window: z.ZodString;
|
|
1447
|
+
gt: z.ZodString;
|
|
1448
|
+
}, "strip", z.ZodTypeAny, {
|
|
1449
|
+
window: string;
|
|
1450
|
+
gt: string;
|
|
1451
|
+
}, {
|
|
1452
|
+
window: string;
|
|
1453
|
+
gt: string;
|
|
1454
|
+
}>>;
|
|
1455
|
+
/** Transaction count in a rolling window exceeds `gt`. */
|
|
1456
|
+
txCount: z.ZodOptional<z.ZodObject<{
|
|
1457
|
+
window: z.ZodString;
|
|
1458
|
+
gt: z.ZodNumber;
|
|
1459
|
+
}, "strip", z.ZodTypeAny, {
|
|
1460
|
+
window: string;
|
|
1461
|
+
gt: number;
|
|
1462
|
+
}, {
|
|
1463
|
+
window: string;
|
|
1464
|
+
gt: number;
|
|
1465
|
+
}>>;
|
|
1466
|
+
/** Vendor host matches one of these patterns (supports `*` globs). */
|
|
1467
|
+
vendorHostIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1468
|
+
/** First time Rein has seen this vendor for the agent. */
|
|
1469
|
+
vendorFirstSeen: z.ZodOptional<z.ZodBoolean>;
|
|
1470
|
+
/** Vendor reputation score is below this threshold (Phase 3 hook). */
|
|
1471
|
+
vendorReputationLt: z.ZodOptional<z.ZodNumber>;
|
|
1472
|
+
/** Amount is more than `gt`-times the observed median for this resource. */
|
|
1473
|
+
amountVsResourceMedian: z.ZodOptional<z.ZodObject<{
|
|
1474
|
+
gt: z.ZodString;
|
|
1475
|
+
}, "strip", z.ZodTypeAny, {
|
|
1476
|
+
gt: string;
|
|
1477
|
+
}, {
|
|
1478
|
+
gt: string;
|
|
1479
|
+
}>>;
|
|
1480
|
+
}, "strip", z.ZodTypeAny, {
|
|
1481
|
+
amountGt?: string | undefined;
|
|
1482
|
+
rollingSum?: {
|
|
1483
|
+
window: string;
|
|
1484
|
+
gt: string;
|
|
1485
|
+
} | undefined;
|
|
1486
|
+
txCount?: {
|
|
1487
|
+
window: string;
|
|
1488
|
+
gt: number;
|
|
1489
|
+
} | undefined;
|
|
1490
|
+
vendorHostIn?: string[] | undefined;
|
|
1491
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1492
|
+
vendorReputationLt?: number | undefined;
|
|
1493
|
+
amountVsResourceMedian?: {
|
|
1494
|
+
gt: string;
|
|
1495
|
+
} | undefined;
|
|
1496
|
+
}, {
|
|
1497
|
+
amountGt?: string | undefined;
|
|
1498
|
+
rollingSum?: {
|
|
1499
|
+
window: string;
|
|
1500
|
+
gt: string;
|
|
1501
|
+
} | undefined;
|
|
1502
|
+
txCount?: {
|
|
1503
|
+
window: string;
|
|
1504
|
+
gt: number;
|
|
1505
|
+
} | undefined;
|
|
1506
|
+
vendorHostIn?: string[] | undefined;
|
|
1507
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1508
|
+
vendorReputationLt?: number | undefined;
|
|
1509
|
+
amountVsResourceMedian?: {
|
|
1510
|
+
gt: string;
|
|
1511
|
+
} | undefined;
|
|
1512
|
+
}>, {
|
|
1513
|
+
amountGt?: string | undefined;
|
|
1514
|
+
rollingSum?: {
|
|
1515
|
+
window: string;
|
|
1516
|
+
gt: string;
|
|
1517
|
+
} | undefined;
|
|
1518
|
+
txCount?: {
|
|
1519
|
+
window: string;
|
|
1520
|
+
gt: number;
|
|
1521
|
+
} | undefined;
|
|
1522
|
+
vendorHostIn?: string[] | undefined;
|
|
1523
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1524
|
+
vendorReputationLt?: number | undefined;
|
|
1525
|
+
amountVsResourceMedian?: {
|
|
1526
|
+
gt: string;
|
|
1527
|
+
} | undefined;
|
|
1528
|
+
}, {
|
|
1529
|
+
amountGt?: string | undefined;
|
|
1530
|
+
rollingSum?: {
|
|
1531
|
+
window: string;
|
|
1532
|
+
gt: string;
|
|
1533
|
+
} | undefined;
|
|
1534
|
+
txCount?: {
|
|
1535
|
+
window: string;
|
|
1536
|
+
gt: number;
|
|
1537
|
+
} | undefined;
|
|
1538
|
+
vendorHostIn?: string[] | undefined;
|
|
1539
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1540
|
+
vendorReputationLt?: number | undefined;
|
|
1541
|
+
amountVsResourceMedian?: {
|
|
1542
|
+
gt: string;
|
|
1543
|
+
} | undefined;
|
|
1544
|
+
}>>;
|
|
1545
|
+
escalate: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
1546
|
+
/** Per-transaction amount exceeds this value. */
|
|
1547
|
+
amountGt: z.ZodOptional<z.ZodString>;
|
|
1548
|
+
/** Sum of spend in a rolling window exceeds `gt`. */
|
|
1549
|
+
rollingSum: z.ZodOptional<z.ZodObject<{
|
|
1550
|
+
window: z.ZodString;
|
|
1551
|
+
gt: z.ZodString;
|
|
1552
|
+
}, "strip", z.ZodTypeAny, {
|
|
1553
|
+
window: string;
|
|
1554
|
+
gt: string;
|
|
1555
|
+
}, {
|
|
1556
|
+
window: string;
|
|
1557
|
+
gt: string;
|
|
1558
|
+
}>>;
|
|
1559
|
+
/** Transaction count in a rolling window exceeds `gt`. */
|
|
1560
|
+
txCount: z.ZodOptional<z.ZodObject<{
|
|
1561
|
+
window: z.ZodString;
|
|
1562
|
+
gt: z.ZodNumber;
|
|
1563
|
+
}, "strip", z.ZodTypeAny, {
|
|
1564
|
+
window: string;
|
|
1565
|
+
gt: number;
|
|
1566
|
+
}, {
|
|
1567
|
+
window: string;
|
|
1568
|
+
gt: number;
|
|
1569
|
+
}>>;
|
|
1570
|
+
/** Vendor host matches one of these patterns (supports `*` globs). */
|
|
1571
|
+
vendorHostIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1572
|
+
/** First time Rein has seen this vendor for the agent. */
|
|
1573
|
+
vendorFirstSeen: z.ZodOptional<z.ZodBoolean>;
|
|
1574
|
+
/** Vendor reputation score is below this threshold (Phase 3 hook). */
|
|
1575
|
+
vendorReputationLt: z.ZodOptional<z.ZodNumber>;
|
|
1576
|
+
/** Amount is more than `gt`-times the observed median for this resource. */
|
|
1577
|
+
amountVsResourceMedian: z.ZodOptional<z.ZodObject<{
|
|
1578
|
+
gt: z.ZodString;
|
|
1579
|
+
}, "strip", z.ZodTypeAny, {
|
|
1580
|
+
gt: string;
|
|
1581
|
+
}, {
|
|
1582
|
+
gt: string;
|
|
1583
|
+
}>>;
|
|
1584
|
+
}, "strip", z.ZodTypeAny, {
|
|
1585
|
+
amountGt?: string | undefined;
|
|
1586
|
+
rollingSum?: {
|
|
1587
|
+
window: string;
|
|
1588
|
+
gt: string;
|
|
1589
|
+
} | undefined;
|
|
1590
|
+
txCount?: {
|
|
1591
|
+
window: string;
|
|
1592
|
+
gt: number;
|
|
1593
|
+
} | undefined;
|
|
1594
|
+
vendorHostIn?: string[] | undefined;
|
|
1595
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1596
|
+
vendorReputationLt?: number | undefined;
|
|
1597
|
+
amountVsResourceMedian?: {
|
|
1598
|
+
gt: string;
|
|
1599
|
+
} | undefined;
|
|
1600
|
+
}, {
|
|
1601
|
+
amountGt?: string | undefined;
|
|
1602
|
+
rollingSum?: {
|
|
1603
|
+
window: string;
|
|
1604
|
+
gt: string;
|
|
1605
|
+
} | undefined;
|
|
1606
|
+
txCount?: {
|
|
1607
|
+
window: string;
|
|
1608
|
+
gt: number;
|
|
1609
|
+
} | undefined;
|
|
1610
|
+
vendorHostIn?: string[] | undefined;
|
|
1611
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1612
|
+
vendorReputationLt?: number | undefined;
|
|
1613
|
+
amountVsResourceMedian?: {
|
|
1614
|
+
gt: string;
|
|
1615
|
+
} | undefined;
|
|
1616
|
+
}>, {
|
|
1617
|
+
amountGt?: string | undefined;
|
|
1618
|
+
rollingSum?: {
|
|
1619
|
+
window: string;
|
|
1620
|
+
gt: string;
|
|
1621
|
+
} | undefined;
|
|
1622
|
+
txCount?: {
|
|
1623
|
+
window: string;
|
|
1624
|
+
gt: number;
|
|
1625
|
+
} | undefined;
|
|
1626
|
+
vendorHostIn?: string[] | undefined;
|
|
1627
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1628
|
+
vendorReputationLt?: number | undefined;
|
|
1629
|
+
amountVsResourceMedian?: {
|
|
1630
|
+
gt: string;
|
|
1631
|
+
} | undefined;
|
|
1632
|
+
}, {
|
|
1633
|
+
amountGt?: string | undefined;
|
|
1634
|
+
rollingSum?: {
|
|
1635
|
+
window: string;
|
|
1636
|
+
gt: string;
|
|
1637
|
+
} | undefined;
|
|
1638
|
+
txCount?: {
|
|
1639
|
+
window: string;
|
|
1640
|
+
gt: number;
|
|
1641
|
+
} | undefined;
|
|
1642
|
+
vendorHostIn?: string[] | undefined;
|
|
1643
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1644
|
+
vendorReputationLt?: number | undefined;
|
|
1645
|
+
amountVsResourceMedian?: {
|
|
1646
|
+
gt: string;
|
|
1647
|
+
} | undefined;
|
|
1648
|
+
}>>;
|
|
1649
|
+
}, "strip", z.ZodTypeAny, {
|
|
1650
|
+
id: string;
|
|
1651
|
+
allow?: {
|
|
1652
|
+
amountGt?: string | undefined;
|
|
1653
|
+
rollingSum?: {
|
|
1654
|
+
window: string;
|
|
1655
|
+
gt: string;
|
|
1656
|
+
} | undefined;
|
|
1657
|
+
txCount?: {
|
|
1658
|
+
window: string;
|
|
1659
|
+
gt: number;
|
|
1660
|
+
} | undefined;
|
|
1661
|
+
vendorHostIn?: string[] | undefined;
|
|
1662
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1663
|
+
vendorReputationLt?: number | undefined;
|
|
1664
|
+
amountVsResourceMedian?: {
|
|
1665
|
+
gt: string;
|
|
1666
|
+
} | undefined;
|
|
1667
|
+
} | undefined;
|
|
1668
|
+
deny?: {
|
|
1669
|
+
amountGt?: string | undefined;
|
|
1670
|
+
rollingSum?: {
|
|
1671
|
+
window: string;
|
|
1672
|
+
gt: string;
|
|
1673
|
+
} | undefined;
|
|
1674
|
+
txCount?: {
|
|
1675
|
+
window: string;
|
|
1676
|
+
gt: number;
|
|
1677
|
+
} | undefined;
|
|
1678
|
+
vendorHostIn?: string[] | undefined;
|
|
1679
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1680
|
+
vendorReputationLt?: number | undefined;
|
|
1681
|
+
amountVsResourceMedian?: {
|
|
1682
|
+
gt: string;
|
|
1683
|
+
} | undefined;
|
|
1684
|
+
} | undefined;
|
|
1685
|
+
escalate?: {
|
|
1686
|
+
amountGt?: string | undefined;
|
|
1687
|
+
rollingSum?: {
|
|
1688
|
+
window: string;
|
|
1689
|
+
gt: string;
|
|
1690
|
+
} | undefined;
|
|
1691
|
+
txCount?: {
|
|
1692
|
+
window: string;
|
|
1693
|
+
gt: number;
|
|
1694
|
+
} | undefined;
|
|
1695
|
+
vendorHostIn?: string[] | undefined;
|
|
1696
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1697
|
+
vendorReputationLt?: number | undefined;
|
|
1698
|
+
amountVsResourceMedian?: {
|
|
1699
|
+
gt: string;
|
|
1700
|
+
} | undefined;
|
|
1701
|
+
} | undefined;
|
|
1702
|
+
}, {
|
|
1703
|
+
id: string;
|
|
1704
|
+
allow?: {
|
|
1705
|
+
amountGt?: string | undefined;
|
|
1706
|
+
rollingSum?: {
|
|
1707
|
+
window: string;
|
|
1708
|
+
gt: string;
|
|
1709
|
+
} | undefined;
|
|
1710
|
+
txCount?: {
|
|
1711
|
+
window: string;
|
|
1712
|
+
gt: number;
|
|
1713
|
+
} | undefined;
|
|
1714
|
+
vendorHostIn?: string[] | undefined;
|
|
1715
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1716
|
+
vendorReputationLt?: number | undefined;
|
|
1717
|
+
amountVsResourceMedian?: {
|
|
1718
|
+
gt: string;
|
|
1719
|
+
} | undefined;
|
|
1720
|
+
} | undefined;
|
|
1721
|
+
deny?: {
|
|
1722
|
+
amountGt?: string | undefined;
|
|
1723
|
+
rollingSum?: {
|
|
1724
|
+
window: string;
|
|
1725
|
+
gt: string;
|
|
1726
|
+
} | undefined;
|
|
1727
|
+
txCount?: {
|
|
1728
|
+
window: string;
|
|
1729
|
+
gt: number;
|
|
1730
|
+
} | undefined;
|
|
1731
|
+
vendorHostIn?: string[] | undefined;
|
|
1732
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1733
|
+
vendorReputationLt?: number | undefined;
|
|
1734
|
+
amountVsResourceMedian?: {
|
|
1735
|
+
gt: string;
|
|
1736
|
+
} | undefined;
|
|
1737
|
+
} | undefined;
|
|
1738
|
+
escalate?: {
|
|
1739
|
+
amountGt?: string | undefined;
|
|
1740
|
+
rollingSum?: {
|
|
1741
|
+
window: string;
|
|
1742
|
+
gt: string;
|
|
1743
|
+
} | undefined;
|
|
1744
|
+
txCount?: {
|
|
1745
|
+
window: string;
|
|
1746
|
+
gt: number;
|
|
1747
|
+
} | undefined;
|
|
1748
|
+
vendorHostIn?: string[] | undefined;
|
|
1749
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1750
|
+
vendorReputationLt?: number | undefined;
|
|
1751
|
+
amountVsResourceMedian?: {
|
|
1752
|
+
gt: string;
|
|
1753
|
+
} | undefined;
|
|
1754
|
+
} | undefined;
|
|
1755
|
+
}>, {
|
|
1756
|
+
id: string;
|
|
1757
|
+
allow?: {
|
|
1758
|
+
amountGt?: string | undefined;
|
|
1759
|
+
rollingSum?: {
|
|
1760
|
+
window: string;
|
|
1761
|
+
gt: string;
|
|
1762
|
+
} | undefined;
|
|
1763
|
+
txCount?: {
|
|
1764
|
+
window: string;
|
|
1765
|
+
gt: number;
|
|
1766
|
+
} | undefined;
|
|
1767
|
+
vendorHostIn?: string[] | undefined;
|
|
1768
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1769
|
+
vendorReputationLt?: number | undefined;
|
|
1770
|
+
amountVsResourceMedian?: {
|
|
1771
|
+
gt: string;
|
|
1772
|
+
} | undefined;
|
|
1773
|
+
} | undefined;
|
|
1774
|
+
deny?: {
|
|
1775
|
+
amountGt?: string | undefined;
|
|
1776
|
+
rollingSum?: {
|
|
1777
|
+
window: string;
|
|
1778
|
+
gt: string;
|
|
1779
|
+
} | undefined;
|
|
1780
|
+
txCount?: {
|
|
1781
|
+
window: string;
|
|
1782
|
+
gt: number;
|
|
1783
|
+
} | undefined;
|
|
1784
|
+
vendorHostIn?: string[] | undefined;
|
|
1785
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1786
|
+
vendorReputationLt?: number | undefined;
|
|
1787
|
+
amountVsResourceMedian?: {
|
|
1788
|
+
gt: string;
|
|
1789
|
+
} | undefined;
|
|
1790
|
+
} | undefined;
|
|
1791
|
+
escalate?: {
|
|
1792
|
+
amountGt?: string | undefined;
|
|
1793
|
+
rollingSum?: {
|
|
1794
|
+
window: string;
|
|
1795
|
+
gt: string;
|
|
1796
|
+
} | undefined;
|
|
1797
|
+
txCount?: {
|
|
1798
|
+
window: string;
|
|
1799
|
+
gt: number;
|
|
1800
|
+
} | undefined;
|
|
1801
|
+
vendorHostIn?: string[] | undefined;
|
|
1802
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1803
|
+
vendorReputationLt?: number | undefined;
|
|
1804
|
+
amountVsResourceMedian?: {
|
|
1805
|
+
gt: string;
|
|
1806
|
+
} | undefined;
|
|
1807
|
+
} | undefined;
|
|
1808
|
+
}, {
|
|
1809
|
+
id: string;
|
|
1810
|
+
allow?: {
|
|
1811
|
+
amountGt?: string | undefined;
|
|
1812
|
+
rollingSum?: {
|
|
1813
|
+
window: string;
|
|
1814
|
+
gt: string;
|
|
1815
|
+
} | undefined;
|
|
1816
|
+
txCount?: {
|
|
1817
|
+
window: string;
|
|
1818
|
+
gt: number;
|
|
1819
|
+
} | undefined;
|
|
1820
|
+
vendorHostIn?: string[] | undefined;
|
|
1821
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1822
|
+
vendorReputationLt?: number | undefined;
|
|
1823
|
+
amountVsResourceMedian?: {
|
|
1824
|
+
gt: string;
|
|
1825
|
+
} | undefined;
|
|
1826
|
+
} | undefined;
|
|
1827
|
+
deny?: {
|
|
1828
|
+
amountGt?: string | undefined;
|
|
1829
|
+
rollingSum?: {
|
|
1830
|
+
window: string;
|
|
1831
|
+
gt: string;
|
|
1832
|
+
} | undefined;
|
|
1833
|
+
txCount?: {
|
|
1834
|
+
window: string;
|
|
1835
|
+
gt: number;
|
|
1836
|
+
} | undefined;
|
|
1837
|
+
vendorHostIn?: string[] | undefined;
|
|
1838
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1839
|
+
vendorReputationLt?: number | undefined;
|
|
1840
|
+
amountVsResourceMedian?: {
|
|
1841
|
+
gt: string;
|
|
1842
|
+
} | undefined;
|
|
1843
|
+
} | undefined;
|
|
1844
|
+
escalate?: {
|
|
1845
|
+
amountGt?: string | undefined;
|
|
1846
|
+
rollingSum?: {
|
|
1847
|
+
window: string;
|
|
1848
|
+
gt: string;
|
|
1849
|
+
} | undefined;
|
|
1850
|
+
txCount?: {
|
|
1851
|
+
window: string;
|
|
1852
|
+
gt: number;
|
|
1853
|
+
} | undefined;
|
|
1854
|
+
vendorHostIn?: string[] | undefined;
|
|
1855
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1856
|
+
vendorReputationLt?: number | undefined;
|
|
1857
|
+
amountVsResourceMedian?: {
|
|
1858
|
+
gt: string;
|
|
1859
|
+
} | undefined;
|
|
1860
|
+
} | undefined;
|
|
1861
|
+
}>, "many">>;
|
|
1862
|
+
default: z.ZodDefault<z.ZodEnum<["allow", "deny"]>>;
|
|
1863
|
+
/** Below this amount, fail-open is permitted during a policy-service outage. */
|
|
1864
|
+
denyFloor: z.ZodDefault<z.ZodString>;
|
|
1865
|
+
escalation: z.ZodOptional<z.ZodObject<{
|
|
1866
|
+
approvers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1867
|
+
timeoutAction: z.ZodDefault<z.ZodEnum<["allow", "deny"]>>;
|
|
1868
|
+
timeoutMin: z.ZodDefault<z.ZodNumber>;
|
|
1869
|
+
}, "strip", z.ZodTypeAny, {
|
|
1870
|
+
approvers: string[];
|
|
1871
|
+
timeoutAction: "allow" | "deny";
|
|
1872
|
+
timeoutMin: number;
|
|
1873
|
+
}, {
|
|
1874
|
+
approvers?: string[] | undefined;
|
|
1875
|
+
timeoutAction?: "allow" | "deny" | undefined;
|
|
1876
|
+
timeoutMin?: number | undefined;
|
|
1877
|
+
}>>;
|
|
1878
|
+
}, "strip", z.ZodTypeAny, {
|
|
1879
|
+
policyId: string;
|
|
1880
|
+
version: string;
|
|
1881
|
+
appliesTo: {
|
|
1882
|
+
agents?: string[] | undefined;
|
|
1883
|
+
chains?: ("base" | "solana" | "polygon" | "bnb")[] | undefined;
|
|
1884
|
+
};
|
|
1885
|
+
rules: {
|
|
1886
|
+
id: string;
|
|
1887
|
+
allow?: {
|
|
1888
|
+
amountGt?: string | undefined;
|
|
1889
|
+
rollingSum?: {
|
|
1890
|
+
window: string;
|
|
1891
|
+
gt: string;
|
|
1892
|
+
} | undefined;
|
|
1893
|
+
txCount?: {
|
|
1894
|
+
window: string;
|
|
1895
|
+
gt: number;
|
|
1896
|
+
} | undefined;
|
|
1897
|
+
vendorHostIn?: string[] | undefined;
|
|
1898
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1899
|
+
vendorReputationLt?: number | undefined;
|
|
1900
|
+
amountVsResourceMedian?: {
|
|
1901
|
+
gt: string;
|
|
1902
|
+
} | undefined;
|
|
1903
|
+
} | undefined;
|
|
1904
|
+
deny?: {
|
|
1905
|
+
amountGt?: string | undefined;
|
|
1906
|
+
rollingSum?: {
|
|
1907
|
+
window: string;
|
|
1908
|
+
gt: string;
|
|
1909
|
+
} | undefined;
|
|
1910
|
+
txCount?: {
|
|
1911
|
+
window: string;
|
|
1912
|
+
gt: number;
|
|
1913
|
+
} | undefined;
|
|
1914
|
+
vendorHostIn?: string[] | undefined;
|
|
1915
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1916
|
+
vendorReputationLt?: number | undefined;
|
|
1917
|
+
amountVsResourceMedian?: {
|
|
1918
|
+
gt: string;
|
|
1919
|
+
} | undefined;
|
|
1920
|
+
} | undefined;
|
|
1921
|
+
escalate?: {
|
|
1922
|
+
amountGt?: string | undefined;
|
|
1923
|
+
rollingSum?: {
|
|
1924
|
+
window: string;
|
|
1925
|
+
gt: string;
|
|
1926
|
+
} | undefined;
|
|
1927
|
+
txCount?: {
|
|
1928
|
+
window: string;
|
|
1929
|
+
gt: number;
|
|
1930
|
+
} | undefined;
|
|
1931
|
+
vendorHostIn?: string[] | undefined;
|
|
1932
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1933
|
+
vendorReputationLt?: number | undefined;
|
|
1934
|
+
amountVsResourceMedian?: {
|
|
1935
|
+
gt: string;
|
|
1936
|
+
} | undefined;
|
|
1937
|
+
} | undefined;
|
|
1938
|
+
}[];
|
|
1939
|
+
default: "allow" | "deny";
|
|
1940
|
+
denyFloor: string;
|
|
1941
|
+
escalation?: {
|
|
1942
|
+
approvers: string[];
|
|
1943
|
+
timeoutAction: "allow" | "deny";
|
|
1944
|
+
timeoutMin: number;
|
|
1945
|
+
} | undefined;
|
|
1946
|
+
}, {
|
|
1947
|
+
policyId: string;
|
|
1948
|
+
version?: string | undefined;
|
|
1949
|
+
appliesTo?: {
|
|
1950
|
+
agents?: string[] | undefined;
|
|
1951
|
+
chains?: ("base" | "solana" | "polygon" | "bnb")[] | undefined;
|
|
1952
|
+
} | undefined;
|
|
1953
|
+
rules?: {
|
|
1954
|
+
id: string;
|
|
1955
|
+
allow?: {
|
|
1956
|
+
amountGt?: string | undefined;
|
|
1957
|
+
rollingSum?: {
|
|
1958
|
+
window: string;
|
|
1959
|
+
gt: string;
|
|
1960
|
+
} | undefined;
|
|
1961
|
+
txCount?: {
|
|
1962
|
+
window: string;
|
|
1963
|
+
gt: number;
|
|
1964
|
+
} | undefined;
|
|
1965
|
+
vendorHostIn?: string[] | undefined;
|
|
1966
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1967
|
+
vendorReputationLt?: number | undefined;
|
|
1968
|
+
amountVsResourceMedian?: {
|
|
1969
|
+
gt: string;
|
|
1970
|
+
} | undefined;
|
|
1971
|
+
} | undefined;
|
|
1972
|
+
deny?: {
|
|
1973
|
+
amountGt?: string | undefined;
|
|
1974
|
+
rollingSum?: {
|
|
1975
|
+
window: string;
|
|
1976
|
+
gt: string;
|
|
1977
|
+
} | undefined;
|
|
1978
|
+
txCount?: {
|
|
1979
|
+
window: string;
|
|
1980
|
+
gt: number;
|
|
1981
|
+
} | undefined;
|
|
1982
|
+
vendorHostIn?: string[] | undefined;
|
|
1983
|
+
vendorFirstSeen?: boolean | undefined;
|
|
1984
|
+
vendorReputationLt?: number | undefined;
|
|
1985
|
+
amountVsResourceMedian?: {
|
|
1986
|
+
gt: string;
|
|
1987
|
+
} | undefined;
|
|
1988
|
+
} | undefined;
|
|
1989
|
+
escalate?: {
|
|
1990
|
+
amountGt?: string | undefined;
|
|
1991
|
+
rollingSum?: {
|
|
1992
|
+
window: string;
|
|
1993
|
+
gt: string;
|
|
1994
|
+
} | undefined;
|
|
1995
|
+
txCount?: {
|
|
1996
|
+
window: string;
|
|
1997
|
+
gt: number;
|
|
1998
|
+
} | undefined;
|
|
1999
|
+
vendorHostIn?: string[] | undefined;
|
|
2000
|
+
vendorFirstSeen?: boolean | undefined;
|
|
2001
|
+
vendorReputationLt?: number | undefined;
|
|
2002
|
+
amountVsResourceMedian?: {
|
|
2003
|
+
gt: string;
|
|
2004
|
+
} | undefined;
|
|
2005
|
+
} | undefined;
|
|
2006
|
+
}[] | undefined;
|
|
2007
|
+
default?: "allow" | "deny" | undefined;
|
|
2008
|
+
denyFloor?: string | undefined;
|
|
2009
|
+
escalation?: {
|
|
2010
|
+
approvers?: string[] | undefined;
|
|
2011
|
+
timeoutAction?: "allow" | "deny" | undefined;
|
|
2012
|
+
timeoutMin?: number | undefined;
|
|
2013
|
+
} | undefined;
|
|
2014
|
+
}>;
|
|
2015
|
+
type Policy = z.infer<typeof Policy>;
|
|
2016
|
+
|
|
2017
|
+
declare const ReputationSubject: z.ZodObject<{
|
|
2018
|
+
kind: z.ZodEnum<["agent", "vendor"]>;
|
|
2019
|
+
id: z.ZodString;
|
|
2020
|
+
}, "strip", z.ZodTypeAny, {
|
|
2021
|
+
id: string;
|
|
2022
|
+
kind: "vendor" | "agent";
|
|
2023
|
+
}, {
|
|
2024
|
+
id: string;
|
|
2025
|
+
kind: "vendor" | "agent";
|
|
2026
|
+
}>;
|
|
2027
|
+
type ReputationSubject = z.infer<typeof ReputationSubject>;
|
|
2028
|
+
declare const ReputationComponents: z.ZodObject<{
|
|
2029
|
+
volume: z.ZodNumber;
|
|
2030
|
+
longevity: z.ZodNumber;
|
|
2031
|
+
disputeRate: z.ZodNumber;
|
|
2032
|
+
counterpartyQuality: z.ZodNumber;
|
|
2033
|
+
settlementReliability: z.ZodNumber;
|
|
2034
|
+
}, "strip", z.ZodTypeAny, {
|
|
2035
|
+
volume: number;
|
|
2036
|
+
longevity: number;
|
|
2037
|
+
disputeRate: number;
|
|
2038
|
+
counterpartyQuality: number;
|
|
2039
|
+
settlementReliability: number;
|
|
2040
|
+
}, {
|
|
2041
|
+
volume: number;
|
|
2042
|
+
longevity: number;
|
|
2043
|
+
disputeRate: number;
|
|
2044
|
+
counterpartyQuality: number;
|
|
2045
|
+
settlementReliability: number;
|
|
2046
|
+
}>;
|
|
2047
|
+
type ReputationComponents = z.infer<typeof ReputationComponents>;
|
|
2048
|
+
/**
|
|
2049
|
+
* A reputation score for an agent or vendor (Phase 3 — Graph). `confidence` is
|
|
2050
|
+
* first-class: a thin-history subject returns LOW confidence rather than a
|
|
2051
|
+
* misleadingly high score, so policy can avoid both false trust and unfair
|
|
2052
|
+
* freezing.
|
|
2053
|
+
*/
|
|
2054
|
+
declare const ReputationScore: z.ZodObject<{
|
|
2055
|
+
subject: z.ZodObject<{
|
|
2056
|
+
kind: z.ZodEnum<["agent", "vendor"]>;
|
|
2057
|
+
id: z.ZodString;
|
|
2058
|
+
}, "strip", z.ZodTypeAny, {
|
|
2059
|
+
id: string;
|
|
2060
|
+
kind: "vendor" | "agent";
|
|
2061
|
+
}, {
|
|
2062
|
+
id: string;
|
|
2063
|
+
kind: "vendor" | "agent";
|
|
2064
|
+
}>;
|
|
2065
|
+
score: z.ZodNumber;
|
|
2066
|
+
components: z.ZodObject<{
|
|
2067
|
+
volume: z.ZodNumber;
|
|
2068
|
+
longevity: z.ZodNumber;
|
|
2069
|
+
disputeRate: z.ZodNumber;
|
|
2070
|
+
counterpartyQuality: z.ZodNumber;
|
|
2071
|
+
settlementReliability: z.ZodNumber;
|
|
2072
|
+
}, "strip", z.ZodTypeAny, {
|
|
2073
|
+
volume: number;
|
|
2074
|
+
longevity: number;
|
|
2075
|
+
disputeRate: number;
|
|
2076
|
+
counterpartyQuality: number;
|
|
2077
|
+
settlementReliability: number;
|
|
2078
|
+
}, {
|
|
2079
|
+
volume: number;
|
|
2080
|
+
longevity: number;
|
|
2081
|
+
disputeRate: number;
|
|
2082
|
+
counterpartyQuality: number;
|
|
2083
|
+
settlementReliability: number;
|
|
2084
|
+
}>;
|
|
2085
|
+
confidence: z.ZodNumber;
|
|
2086
|
+
asOf: z.ZodDate;
|
|
2087
|
+
/** Hash-anchored attestation, optionally published on-chain (ERC-8004). */
|
|
2088
|
+
evidenceUri: z.ZodOptional<z.ZodString>;
|
|
2089
|
+
}, "strip", z.ZodTypeAny, {
|
|
2090
|
+
subject: {
|
|
2091
|
+
id: string;
|
|
2092
|
+
kind: "vendor" | "agent";
|
|
2093
|
+
};
|
|
2094
|
+
score: number;
|
|
2095
|
+
components: {
|
|
2096
|
+
volume: number;
|
|
2097
|
+
longevity: number;
|
|
2098
|
+
disputeRate: number;
|
|
2099
|
+
counterpartyQuality: number;
|
|
2100
|
+
settlementReliability: number;
|
|
2101
|
+
};
|
|
2102
|
+
confidence: number;
|
|
2103
|
+
asOf: Date;
|
|
2104
|
+
evidenceUri?: string | undefined;
|
|
2105
|
+
}, {
|
|
2106
|
+
subject: {
|
|
2107
|
+
id: string;
|
|
2108
|
+
kind: "vendor" | "agent";
|
|
2109
|
+
};
|
|
2110
|
+
score: number;
|
|
2111
|
+
components: {
|
|
2112
|
+
volume: number;
|
|
2113
|
+
longevity: number;
|
|
2114
|
+
disputeRate: number;
|
|
2115
|
+
counterpartyQuality: number;
|
|
2116
|
+
settlementReliability: number;
|
|
2117
|
+
};
|
|
2118
|
+
confidence: number;
|
|
2119
|
+
asOf: Date;
|
|
2120
|
+
evidenceUri?: string | undefined;
|
|
2121
|
+
}>;
|
|
2122
|
+
type ReputationScore = z.infer<typeof ReputationScore>;
|
|
2123
|
+
|
|
2124
|
+
/**
|
|
2125
|
+
* The canonical event envelope published on the bus (NATS in production).
|
|
2126
|
+
* `shadow.spend` is emitted when the indexer sees on-chain spend from a managed
|
|
2127
|
+
* wallet with NO corresponding ALLOW decision — the bypass signal that catches
|
|
2128
|
+
* SDK-mode evasion and drives the upgrade to the signer tier.
|
|
2129
|
+
* `signature.released` / `signature.refused` are that tier's heartbeat: every
|
|
2130
|
+
* time the signer does or does not put a key to work, the bus knows why.
|
|
2131
|
+
* `gate.*` is the vendor side of the wire: every quote a Gate issues, every
|
|
2132
|
+
* payment it accepts, every payment it turns away.
|
|
2133
|
+
*/
|
|
2134
|
+
declare const ReinEvent: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2135
|
+
type: z.ZodLiteral<"intent.created">;
|
|
2136
|
+
at: z.ZodDate;
|
|
2137
|
+
intent: z.ZodObject<{
|
|
2138
|
+
id: z.ZodString;
|
|
2139
|
+
agentId: z.ZodString;
|
|
2140
|
+
vendor: z.ZodObject<{
|
|
2141
|
+
host: z.ZodString;
|
|
2142
|
+
address: z.ZodString;
|
|
2143
|
+
erc8004Id: z.ZodOptional<z.ZodString>;
|
|
2144
|
+
}, "strip", z.ZodTypeAny, {
|
|
2145
|
+
address: string;
|
|
2146
|
+
host: string;
|
|
2147
|
+
erc8004Id?: string | undefined;
|
|
2148
|
+
}, {
|
|
2149
|
+
address: string;
|
|
2150
|
+
host: string;
|
|
2151
|
+
erc8004Id?: string | undefined;
|
|
2152
|
+
}>;
|
|
2153
|
+
resource: z.ZodString;
|
|
2154
|
+
amount: z.ZodString;
|
|
2155
|
+
asset: z.ZodEnum<["USDC", "USDT", "EURC"]>;
|
|
2156
|
+
chain: z.ZodEnum<["base", "solana", "polygon", "bnb"]>;
|
|
2157
|
+
taskContext: z.ZodDefault<z.ZodObject<{
|
|
2158
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
2159
|
+
parentRunId: z.ZodOptional<z.ZodString>;
|
|
2160
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
2161
|
+
}, "strip", z.ZodTypeAny, {
|
|
2162
|
+
taskId?: string | undefined;
|
|
2163
|
+
parentRunId?: string | undefined;
|
|
2164
|
+
purpose?: string | undefined;
|
|
2165
|
+
}, {
|
|
2166
|
+
taskId?: string | undefined;
|
|
2167
|
+
parentRunId?: string | undefined;
|
|
2168
|
+
purpose?: string | undefined;
|
|
2169
|
+
}>>;
|
|
2170
|
+
nonce: z.ZodString;
|
|
2171
|
+
createdAt: z.ZodDate;
|
|
2172
|
+
}, "strip", z.ZodTypeAny, {
|
|
2173
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2174
|
+
id: string;
|
|
2175
|
+
createdAt: Date;
|
|
2176
|
+
agentId: string;
|
|
2177
|
+
vendor: {
|
|
2178
|
+
address: string;
|
|
2179
|
+
host: string;
|
|
2180
|
+
erc8004Id?: string | undefined;
|
|
2181
|
+
};
|
|
2182
|
+
resource: string;
|
|
2183
|
+
amount: string;
|
|
2184
|
+
asset: "USDC" | "USDT" | "EURC";
|
|
2185
|
+
taskContext: {
|
|
2186
|
+
taskId?: string | undefined;
|
|
2187
|
+
parentRunId?: string | undefined;
|
|
2188
|
+
purpose?: string | undefined;
|
|
2189
|
+
};
|
|
2190
|
+
nonce: string;
|
|
2191
|
+
}, {
|
|
2192
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2193
|
+
id: string;
|
|
2194
|
+
createdAt: Date;
|
|
2195
|
+
agentId: string;
|
|
2196
|
+
vendor: {
|
|
2197
|
+
address: string;
|
|
2198
|
+
host: string;
|
|
2199
|
+
erc8004Id?: string | undefined;
|
|
2200
|
+
};
|
|
2201
|
+
resource: string;
|
|
2202
|
+
amount: string;
|
|
2203
|
+
asset: "USDC" | "USDT" | "EURC";
|
|
2204
|
+
nonce: string;
|
|
2205
|
+
taskContext?: {
|
|
2206
|
+
taskId?: string | undefined;
|
|
2207
|
+
parentRunId?: string | undefined;
|
|
2208
|
+
purpose?: string | undefined;
|
|
2209
|
+
} | undefined;
|
|
2210
|
+
}>;
|
|
2211
|
+
}, "strip", z.ZodTypeAny, {
|
|
2212
|
+
at: Date;
|
|
2213
|
+
type: "intent.created";
|
|
2214
|
+
intent: {
|
|
2215
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2216
|
+
id: string;
|
|
2217
|
+
createdAt: Date;
|
|
2218
|
+
agentId: string;
|
|
2219
|
+
vendor: {
|
|
2220
|
+
address: string;
|
|
2221
|
+
host: string;
|
|
2222
|
+
erc8004Id?: string | undefined;
|
|
2223
|
+
};
|
|
2224
|
+
resource: string;
|
|
2225
|
+
amount: string;
|
|
2226
|
+
asset: "USDC" | "USDT" | "EURC";
|
|
2227
|
+
taskContext: {
|
|
2228
|
+
taskId?: string | undefined;
|
|
2229
|
+
parentRunId?: string | undefined;
|
|
2230
|
+
purpose?: string | undefined;
|
|
2231
|
+
};
|
|
2232
|
+
nonce: string;
|
|
2233
|
+
};
|
|
2234
|
+
}, {
|
|
2235
|
+
at: Date;
|
|
2236
|
+
type: "intent.created";
|
|
2237
|
+
intent: {
|
|
2238
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2239
|
+
id: string;
|
|
2240
|
+
createdAt: Date;
|
|
2241
|
+
agentId: string;
|
|
2242
|
+
vendor: {
|
|
2243
|
+
address: string;
|
|
2244
|
+
host: string;
|
|
2245
|
+
erc8004Id?: string | undefined;
|
|
2246
|
+
};
|
|
2247
|
+
resource: string;
|
|
2248
|
+
amount: string;
|
|
2249
|
+
asset: "USDC" | "USDT" | "EURC";
|
|
2250
|
+
nonce: string;
|
|
2251
|
+
taskContext?: {
|
|
2252
|
+
taskId?: string | undefined;
|
|
2253
|
+
parentRunId?: string | undefined;
|
|
2254
|
+
purpose?: string | undefined;
|
|
2255
|
+
} | undefined;
|
|
2256
|
+
};
|
|
2257
|
+
}>, z.ZodObject<{
|
|
2258
|
+
type: z.ZodLiteral<"decision.made">;
|
|
2259
|
+
at: z.ZodDate;
|
|
2260
|
+
decision: z.ZodObject<{
|
|
2261
|
+
id: z.ZodString;
|
|
2262
|
+
intentId: z.ZodString;
|
|
2263
|
+
intentHash: z.ZodString;
|
|
2264
|
+
outcome: z.ZodEnum<["allow", "deny", "escalate"]>;
|
|
2265
|
+
matchedRules: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2266
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
2267
|
+
policyId: z.ZodString;
|
|
2268
|
+
policyVersion: z.ZodString;
|
|
2269
|
+
prevHash: z.ZodString;
|
|
2270
|
+
hash: z.ZodString;
|
|
2271
|
+
signature: z.ZodString;
|
|
2272
|
+
latencyMs: z.ZodNumber;
|
|
2273
|
+
decidedAt: z.ZodDate;
|
|
2274
|
+
}, "strip", z.ZodTypeAny, {
|
|
2275
|
+
id: string;
|
|
2276
|
+
intentId: string;
|
|
2277
|
+
intentHash: string;
|
|
2278
|
+
outcome: "allow" | "deny" | "escalate";
|
|
2279
|
+
matchedRules: string[];
|
|
2280
|
+
policyId: string;
|
|
2281
|
+
policyVersion: string;
|
|
2282
|
+
prevHash: string;
|
|
2283
|
+
hash: string;
|
|
2284
|
+
signature: string;
|
|
2285
|
+
latencyMs: number;
|
|
2286
|
+
decidedAt: Date;
|
|
2287
|
+
reason?: string | undefined;
|
|
2288
|
+
}, {
|
|
2289
|
+
id: string;
|
|
2290
|
+
intentId: string;
|
|
2291
|
+
intentHash: string;
|
|
2292
|
+
outcome: "allow" | "deny" | "escalate";
|
|
2293
|
+
policyId: string;
|
|
2294
|
+
policyVersion: string;
|
|
2295
|
+
prevHash: string;
|
|
2296
|
+
hash: string;
|
|
2297
|
+
signature: string;
|
|
2298
|
+
latencyMs: number;
|
|
2299
|
+
decidedAt: Date;
|
|
2300
|
+
matchedRules?: string[] | undefined;
|
|
2301
|
+
reason?: string | undefined;
|
|
2302
|
+
}>;
|
|
2303
|
+
}, "strip", z.ZodTypeAny, {
|
|
2304
|
+
at: Date;
|
|
2305
|
+
type: "decision.made";
|
|
2306
|
+
decision: {
|
|
2307
|
+
id: string;
|
|
2308
|
+
intentId: string;
|
|
2309
|
+
intentHash: string;
|
|
2310
|
+
outcome: "allow" | "deny" | "escalate";
|
|
2311
|
+
matchedRules: string[];
|
|
2312
|
+
policyId: string;
|
|
2313
|
+
policyVersion: string;
|
|
2314
|
+
prevHash: string;
|
|
2315
|
+
hash: string;
|
|
2316
|
+
signature: string;
|
|
2317
|
+
latencyMs: number;
|
|
2318
|
+
decidedAt: Date;
|
|
2319
|
+
reason?: string | undefined;
|
|
2320
|
+
};
|
|
2321
|
+
}, {
|
|
2322
|
+
at: Date;
|
|
2323
|
+
type: "decision.made";
|
|
2324
|
+
decision: {
|
|
2325
|
+
id: string;
|
|
2326
|
+
intentId: string;
|
|
2327
|
+
intentHash: string;
|
|
2328
|
+
outcome: "allow" | "deny" | "escalate";
|
|
2329
|
+
policyId: string;
|
|
2330
|
+
policyVersion: string;
|
|
2331
|
+
prevHash: string;
|
|
2332
|
+
hash: string;
|
|
2333
|
+
signature: string;
|
|
2334
|
+
latencyMs: number;
|
|
2335
|
+
decidedAt: Date;
|
|
2336
|
+
matchedRules?: string[] | undefined;
|
|
2337
|
+
reason?: string | undefined;
|
|
2338
|
+
};
|
|
2339
|
+
}>, z.ZodObject<{
|
|
2340
|
+
type: z.ZodLiteral<"payment.settled">;
|
|
2341
|
+
at: z.ZodDate;
|
|
2342
|
+
payment: z.ZodObject<{
|
|
2343
|
+
intentId: z.ZodString;
|
|
2344
|
+
txHash: z.ZodString;
|
|
2345
|
+
chain: z.ZodEnum<["base", "solana", "polygon", "bnb"]>;
|
|
2346
|
+
blockNumber: z.ZodBigInt;
|
|
2347
|
+
facilitator: z.ZodOptional<z.ZodString>;
|
|
2348
|
+
feePaid: z.ZodOptional<z.ZodString>;
|
|
2349
|
+
confirmedAt: z.ZodDate;
|
|
2350
|
+
}, "strip", z.ZodTypeAny, {
|
|
2351
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2352
|
+
intentId: string;
|
|
2353
|
+
txHash: string;
|
|
2354
|
+
blockNumber: bigint;
|
|
2355
|
+
confirmedAt: Date;
|
|
2356
|
+
facilitator?: string | undefined;
|
|
2357
|
+
feePaid?: string | undefined;
|
|
2358
|
+
}, {
|
|
2359
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2360
|
+
intentId: string;
|
|
2361
|
+
txHash: string;
|
|
2362
|
+
blockNumber: bigint;
|
|
2363
|
+
confirmedAt: Date;
|
|
2364
|
+
facilitator?: string | undefined;
|
|
2365
|
+
feePaid?: string | undefined;
|
|
2366
|
+
}>;
|
|
2367
|
+
}, "strip", z.ZodTypeAny, {
|
|
2368
|
+
at: Date;
|
|
2369
|
+
type: "payment.settled";
|
|
2370
|
+
payment: {
|
|
2371
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2372
|
+
intentId: string;
|
|
2373
|
+
txHash: string;
|
|
2374
|
+
blockNumber: bigint;
|
|
2375
|
+
confirmedAt: Date;
|
|
2376
|
+
facilitator?: string | undefined;
|
|
2377
|
+
feePaid?: string | undefined;
|
|
2378
|
+
};
|
|
2379
|
+
}, {
|
|
2380
|
+
at: Date;
|
|
2381
|
+
type: "payment.settled";
|
|
2382
|
+
payment: {
|
|
2383
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2384
|
+
intentId: string;
|
|
2385
|
+
txHash: string;
|
|
2386
|
+
blockNumber: bigint;
|
|
2387
|
+
confirmedAt: Date;
|
|
2388
|
+
facilitator?: string | undefined;
|
|
2389
|
+
feePaid?: string | undefined;
|
|
2390
|
+
};
|
|
2391
|
+
}>, z.ZodObject<{
|
|
2392
|
+
type: z.ZodLiteral<"shadow.spend">;
|
|
2393
|
+
at: z.ZodDate;
|
|
2394
|
+
agentId: z.ZodString;
|
|
2395
|
+
txHash: z.ZodString;
|
|
2396
|
+
chain: z.ZodEnum<["base", "solana", "polygon", "bnb"]>;
|
|
2397
|
+
amount: z.ZodString;
|
|
2398
|
+
}, "strip", z.ZodTypeAny, {
|
|
2399
|
+
at: Date;
|
|
2400
|
+
type: "shadow.spend";
|
|
2401
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2402
|
+
agentId: string;
|
|
2403
|
+
amount: string;
|
|
2404
|
+
txHash: string;
|
|
2405
|
+
}, {
|
|
2406
|
+
at: Date;
|
|
2407
|
+
type: "shadow.spend";
|
|
2408
|
+
chain: "base" | "solana" | "polygon" | "bnb";
|
|
2409
|
+
agentId: string;
|
|
2410
|
+
amount: string;
|
|
2411
|
+
txHash: string;
|
|
2412
|
+
}>, z.ZodObject<{
|
|
2413
|
+
type: z.ZodLiteral<"signature.released">;
|
|
2414
|
+
at: z.ZodDate;
|
|
2415
|
+
sessionId: z.ZodString;
|
|
2416
|
+
agentId: z.ZodString;
|
|
2417
|
+
intentId: z.ZodString;
|
|
2418
|
+
decisionId: z.ZodString;
|
|
2419
|
+
amount: z.ZodString;
|
|
2420
|
+
}, "strip", z.ZodTypeAny, {
|
|
2421
|
+
at: Date;
|
|
2422
|
+
type: "signature.released";
|
|
2423
|
+
agentId: string;
|
|
2424
|
+
amount: string;
|
|
2425
|
+
intentId: string;
|
|
2426
|
+
decisionId: string;
|
|
2427
|
+
sessionId: string;
|
|
2428
|
+
}, {
|
|
2429
|
+
at: Date;
|
|
2430
|
+
type: "signature.released";
|
|
2431
|
+
agentId: string;
|
|
2432
|
+
amount: string;
|
|
2433
|
+
intentId: string;
|
|
2434
|
+
decisionId: string;
|
|
2435
|
+
sessionId: string;
|
|
2436
|
+
}>, z.ZodObject<{
|
|
2437
|
+
type: z.ZodLiteral<"signature.refused">;
|
|
2438
|
+
at: z.ZodDate;
|
|
2439
|
+
/** Refusal code, e.g. "decision_replayed" (see @reinconsole/signer). */
|
|
2440
|
+
code: z.ZodString;
|
|
2441
|
+
reason: z.ZodString;
|
|
2442
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2443
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
2444
|
+
intentId: z.ZodOptional<z.ZodString>;
|
|
2445
|
+
}, "strip", z.ZodTypeAny, {
|
|
2446
|
+
at: Date;
|
|
2447
|
+
code: string;
|
|
2448
|
+
type: "signature.refused";
|
|
2449
|
+
reason: string;
|
|
2450
|
+
agentId?: string | undefined;
|
|
2451
|
+
intentId?: string | undefined;
|
|
2452
|
+
sessionId?: string | undefined;
|
|
2453
|
+
}, {
|
|
2454
|
+
at: Date;
|
|
2455
|
+
code: string;
|
|
2456
|
+
type: "signature.refused";
|
|
2457
|
+
reason: string;
|
|
2458
|
+
agentId?: string | undefined;
|
|
2459
|
+
intentId?: string | undefined;
|
|
2460
|
+
sessionId?: string | undefined;
|
|
2461
|
+
}>, z.ZodObject<{
|
|
2462
|
+
type: z.ZodLiteral<"gate.quoted">;
|
|
2463
|
+
at: z.ZodDate;
|
|
2464
|
+
resource: z.ZodString;
|
|
2465
|
+
method: z.ZodString;
|
|
2466
|
+
amount: z.ZodString;
|
|
2467
|
+
asset: z.ZodString;
|
|
2468
|
+
network: z.ZodString;
|
|
2469
|
+
}, "strip", z.ZodTypeAny, {
|
|
2470
|
+
at: Date;
|
|
2471
|
+
type: "gate.quoted";
|
|
2472
|
+
resource: string;
|
|
2473
|
+
amount: string;
|
|
2474
|
+
asset: string;
|
|
2475
|
+
method: string;
|
|
2476
|
+
network: string;
|
|
2477
|
+
}, {
|
|
2478
|
+
at: Date;
|
|
2479
|
+
type: "gate.quoted";
|
|
2480
|
+
resource: string;
|
|
2481
|
+
amount: string;
|
|
2482
|
+
asset: string;
|
|
2483
|
+
method: string;
|
|
2484
|
+
network: string;
|
|
2485
|
+
}>, z.ZodObject<{
|
|
2486
|
+
type: z.ZodLiteral<"gate.settled">;
|
|
2487
|
+
at: z.ZodDate;
|
|
2488
|
+
receipt: z.ZodObject<{
|
|
2489
|
+
id: z.ZodString;
|
|
2490
|
+
at: z.ZodDate;
|
|
2491
|
+
route: z.ZodString;
|
|
2492
|
+
resource: z.ZodString;
|
|
2493
|
+
method: z.ZodString;
|
|
2494
|
+
payer: z.ZodString;
|
|
2495
|
+
payTo: z.ZodString;
|
|
2496
|
+
amount: z.ZodString;
|
|
2497
|
+
amountAtomic: z.ZodString;
|
|
2498
|
+
asset: z.ZodString;
|
|
2499
|
+
network: z.ZodString;
|
|
2500
|
+
transaction: z.ZodString;
|
|
2501
|
+
}, "strip", z.ZodTypeAny, {
|
|
2502
|
+
at: Date;
|
|
2503
|
+
id: string;
|
|
2504
|
+
resource: string;
|
|
2505
|
+
amount: string;
|
|
2506
|
+
asset: string;
|
|
2507
|
+
method: string;
|
|
2508
|
+
route: string;
|
|
2509
|
+
payer: string;
|
|
2510
|
+
payTo: string;
|
|
2511
|
+
amountAtomic: string;
|
|
2512
|
+
network: string;
|
|
2513
|
+
transaction: string;
|
|
2514
|
+
}, {
|
|
2515
|
+
at: Date;
|
|
2516
|
+
id: string;
|
|
2517
|
+
resource: string;
|
|
2518
|
+
amount: string;
|
|
2519
|
+
asset: string;
|
|
2520
|
+
method: string;
|
|
2521
|
+
route: string;
|
|
2522
|
+
payer: string;
|
|
2523
|
+
payTo: string;
|
|
2524
|
+
amountAtomic: string;
|
|
2525
|
+
network: string;
|
|
2526
|
+
transaction: string;
|
|
2527
|
+
}>;
|
|
2528
|
+
}, "strip", z.ZodTypeAny, {
|
|
2529
|
+
at: Date;
|
|
2530
|
+
type: "gate.settled";
|
|
2531
|
+
receipt: {
|
|
2532
|
+
at: Date;
|
|
2533
|
+
id: string;
|
|
2534
|
+
resource: string;
|
|
2535
|
+
amount: string;
|
|
2536
|
+
asset: string;
|
|
2537
|
+
method: string;
|
|
2538
|
+
route: string;
|
|
2539
|
+
payer: string;
|
|
2540
|
+
payTo: string;
|
|
2541
|
+
amountAtomic: string;
|
|
2542
|
+
network: string;
|
|
2543
|
+
transaction: string;
|
|
2544
|
+
};
|
|
2545
|
+
}, {
|
|
2546
|
+
at: Date;
|
|
2547
|
+
type: "gate.settled";
|
|
2548
|
+
receipt: {
|
|
2549
|
+
at: Date;
|
|
2550
|
+
id: string;
|
|
2551
|
+
resource: string;
|
|
2552
|
+
amount: string;
|
|
2553
|
+
asset: string;
|
|
2554
|
+
method: string;
|
|
2555
|
+
route: string;
|
|
2556
|
+
payer: string;
|
|
2557
|
+
payTo: string;
|
|
2558
|
+
amountAtomic: string;
|
|
2559
|
+
network: string;
|
|
2560
|
+
transaction: string;
|
|
2561
|
+
};
|
|
2562
|
+
}>, z.ZodObject<{
|
|
2563
|
+
type: z.ZodLiteral<"gate.refused">;
|
|
2564
|
+
at: z.ZodDate;
|
|
2565
|
+
/** Refusal code, e.g. "payment_replayed" (see @reinconsole/gate). */
|
|
2566
|
+
code: z.ZodString;
|
|
2567
|
+
reason: z.ZodString;
|
|
2568
|
+
resource: z.ZodString;
|
|
2569
|
+
/** Known only when the payment header decoded far enough to name a payer. */
|
|
2570
|
+
payer: z.ZodOptional<z.ZodString>;
|
|
2571
|
+
}, "strip", z.ZodTypeAny, {
|
|
2572
|
+
at: Date;
|
|
2573
|
+
code: string;
|
|
2574
|
+
type: "gate.refused";
|
|
2575
|
+
resource: string;
|
|
2576
|
+
reason: string;
|
|
2577
|
+
payer?: string | undefined;
|
|
2578
|
+
}, {
|
|
2579
|
+
at: Date;
|
|
2580
|
+
code: string;
|
|
2581
|
+
type: "gate.refused";
|
|
2582
|
+
resource: string;
|
|
2583
|
+
reason: string;
|
|
2584
|
+
payer?: string | undefined;
|
|
2585
|
+
}>]>;
|
|
2586
|
+
type ReinEvent = z.infer<typeof ReinEvent>;
|
|
2587
|
+
|
|
2588
|
+
export { Agent, AgentId, AgentStatus, AgentWallet, AppliesTo, Asset, Chain, Condition, DecimalString, Decision, type DecisionContent, DecisionId, DecisionOutcome, EnforcementMode, Erc8004Id, type Erc8004Ref, Escalation, GateReceipt, GateReceiptId, IntentId, Multiplier, OrgId, PaymentIntent, Policy, PolicyDefault, PolicyId, Receipt, ReceiptId, ReceiptSettlement, ReinEvent, ReputationComponents, ReputationScore, ReputationSubject, Rule, Session, SessionId, SettledPayment, TaskContext, Vendor, Window, canonicalDecision, canonicalIntent, compareDecimal, formatErc8004Id, globMatch, globMatchAny, gt, isValidDecimal, lt, mulDecimal, newId, parseErc8004Id, prefixedId, sumDecimal, ulid };
|