@agledger/sdk 1.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 +34 -0
- package/README.md +209 -0
- package/dist/client.d.ts +46 -0
- package/dist/client.js +68 -0
- package/dist/errors.d.ts +64 -0
- package/dist/errors.js +114 -0
- package/dist/http.d.ts +47 -0
- package/dist/http.js +272 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +12 -0
- package/dist/resources/a2a.d.ts +22 -0
- package/dist/resources/a2a.js +33 -0
- package/dist/resources/admin.d.ts +39 -0
- package/dist/resources/admin.js +57 -0
- package/dist/resources/capabilities.d.ts +23 -0
- package/dist/resources/capabilities.js +21 -0
- package/dist/resources/compliance.d.ts +34 -0
- package/dist/resources/compliance.js +54 -0
- package/dist/resources/dashboard.d.ts +14 -0
- package/dist/resources/dashboard.js +20 -0
- package/dist/resources/disputes.d.ts +16 -0
- package/dist/resources/disputes.js +26 -0
- package/dist/resources/events.d.ts +21 -0
- package/dist/resources/events.js +22 -0
- package/dist/resources/health.d.ts +15 -0
- package/dist/resources/health.js +21 -0
- package/dist/resources/mandates.d.ts +48 -0
- package/dist/resources/mandates.js +89 -0
- package/dist/resources/notarize.d.ts +20 -0
- package/dist/resources/notarize.js +44 -0
- package/dist/resources/proxy.d.ts +74 -0
- package/dist/resources/proxy.js +149 -0
- package/dist/resources/receipts.d.ts +28 -0
- package/dist/resources/receipts.js +27 -0
- package/dist/resources/registration.d.ts +30 -0
- package/dist/resources/registration.js +39 -0
- package/dist/resources/reputation.d.ts +16 -0
- package/dist/resources/reputation.js +17 -0
- package/dist/resources/schemas.d.ts +20 -0
- package/dist/resources/schemas.js +24 -0
- package/dist/resources/verification.d.ts +13 -0
- package/dist/resources/verification.js +17 -0
- package/dist/resources/webhooks.d.ts +25 -0
- package/dist/resources/webhooks.js +37 -0
- package/dist/types.d.ts +1134 -0
- package/dist/types.js +6 -0
- package/dist/webhooks/verify.d.ts +37 -0
- package/dist/webhooks/verify.js +86 -0
- package/package.json +74 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,1134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGLedger™ SDK — Type Definitions
|
|
3
|
+
* Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
/** Rate limit metadata parsed from response headers. */
|
|
6
|
+
export interface RateLimitInfo {
|
|
7
|
+
/** Max requests per window */
|
|
8
|
+
limit: number;
|
|
9
|
+
/** Remaining requests in current window */
|
|
10
|
+
remaining: number;
|
|
11
|
+
/** Unix timestamp (seconds) when the window resets */
|
|
12
|
+
reset: number;
|
|
13
|
+
}
|
|
14
|
+
export interface AgledgerClientOptions {
|
|
15
|
+
/** API key (Bearer token) */
|
|
16
|
+
apiKey: string;
|
|
17
|
+
/** Base URL (default: https://api.agledger.ai) */
|
|
18
|
+
baseUrl?: string;
|
|
19
|
+
/** Environment shorthand — sets baseUrl automatically. Overridden by explicit baseUrl. */
|
|
20
|
+
environment?: 'production' | 'sandbox';
|
|
21
|
+
/** Max retries for 429/5xx/network errors (default: 3) */
|
|
22
|
+
maxRetries?: number;
|
|
23
|
+
/** Request timeout in ms (default: 30_000) */
|
|
24
|
+
timeout?: number;
|
|
25
|
+
/** Custom fetch implementation (for testing or non-standard runtimes) */
|
|
26
|
+
fetch?: typeof globalThis.fetch;
|
|
27
|
+
/** Prefix prepended to auto-generated idempotency keys */
|
|
28
|
+
idempotencyKeyPrefix?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface RequestOptions {
|
|
31
|
+
/** Override idempotency key for this request */
|
|
32
|
+
idempotencyKey?: string;
|
|
33
|
+
/** Abort signal for cancellation */
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
/** Override timeout for this request (ms) */
|
|
36
|
+
timeout?: number;
|
|
37
|
+
}
|
|
38
|
+
/** Parameters accepted by all list endpoints. */
|
|
39
|
+
export interface ListParams {
|
|
40
|
+
limit?: number;
|
|
41
|
+
offset?: number;
|
|
42
|
+
cursor?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Unified page type for all list endpoints.
|
|
46
|
+
* Every list method returns `Page<T>` — no exceptions.
|
|
47
|
+
*/
|
|
48
|
+
export interface Page<T> {
|
|
49
|
+
data: T[];
|
|
50
|
+
hasMore: boolean;
|
|
51
|
+
nextCursor?: string | null;
|
|
52
|
+
total?: number;
|
|
53
|
+
}
|
|
54
|
+
/** Options for auto-pagination. */
|
|
55
|
+
export interface AutoPaginateOptions {
|
|
56
|
+
/** Maximum number of pages to fetch (default: 100). Safety ceiling. */
|
|
57
|
+
maxPages?: number;
|
|
58
|
+
/** Maximum total items to yield before stopping (default: unlimited). */
|
|
59
|
+
maxItems?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface BatchResult<T> {
|
|
62
|
+
results: Array<{
|
|
63
|
+
index: number;
|
|
64
|
+
status: 'created' | 'skipped' | 'failed';
|
|
65
|
+
data?: T;
|
|
66
|
+
error?: string;
|
|
67
|
+
}>;
|
|
68
|
+
summary: {
|
|
69
|
+
total: number;
|
|
70
|
+
created: number;
|
|
71
|
+
skipped: number;
|
|
72
|
+
failed: number;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface BulkCreateResult {
|
|
76
|
+
results: Array<{
|
|
77
|
+
index: number;
|
|
78
|
+
status: number;
|
|
79
|
+
data?: Mandate;
|
|
80
|
+
error?: string;
|
|
81
|
+
}>;
|
|
82
|
+
summary: {
|
|
83
|
+
total: number;
|
|
84
|
+
succeeded: number;
|
|
85
|
+
failed: number;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export type ContractType = 'ACH-PROC-v1' | 'ACH-DLVR-v1' | 'ACH-DATA-v1' | 'ACH-TXN-v1' | 'ACH-ORCH-v1' | 'ACH-COMM-v1' | 'ACH-AUTH-v1' | 'ACH-INFRA-v1' | 'ACH-DEL-v1' | 'ACH-ANALYZE-v1' | 'ACH-COORD-v1' | (string & {});
|
|
89
|
+
export interface Denomination {
|
|
90
|
+
amount: number;
|
|
91
|
+
currency: string;
|
|
92
|
+
}
|
|
93
|
+
/** ACH-PROC-v1: Resource acquisition and provisioning requests. */
|
|
94
|
+
export interface ProcurementCriteria {
|
|
95
|
+
item_spec: string;
|
|
96
|
+
quantity?: {
|
|
97
|
+
target: number;
|
|
98
|
+
tolerance_pct?: number;
|
|
99
|
+
unit?: string;
|
|
100
|
+
};
|
|
101
|
+
price_ceiling?: Denomination;
|
|
102
|
+
deadline?: string;
|
|
103
|
+
supplier_requirements?: {
|
|
104
|
+
approved_list_ref?: string;
|
|
105
|
+
min_rating?: number;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** ACH-DLVR-v1: Reports, documents, and generated artifacts. */
|
|
109
|
+
export interface DeliverableCriteria {
|
|
110
|
+
description: string;
|
|
111
|
+
output_format?: string;
|
|
112
|
+
language?: string;
|
|
113
|
+
min_items?: number;
|
|
114
|
+
budget?: Denomination;
|
|
115
|
+
deadline?: string;
|
|
116
|
+
}
|
|
117
|
+
/** ACH-DATA-v1: Data processing, ETL, analysis, and transformation. */
|
|
118
|
+
export interface DataProcessingCriteria {
|
|
119
|
+
description: string;
|
|
120
|
+
output_format?: string;
|
|
121
|
+
row_count_min?: number;
|
|
122
|
+
budget?: Denomination;
|
|
123
|
+
deadline?: string;
|
|
124
|
+
}
|
|
125
|
+
/** ACH-TXN-v1: Internal transfers, ledger entries, and settlements. */
|
|
126
|
+
export interface TransactionCriteria {
|
|
127
|
+
description: string;
|
|
128
|
+
budget?: Denomination;
|
|
129
|
+
deadline?: string;
|
|
130
|
+
}
|
|
131
|
+
/** ACH-ORCH-v1: Task delegation and multi-agent coordination. */
|
|
132
|
+
export interface OrchestrationCriteria {
|
|
133
|
+
description: string;
|
|
134
|
+
target_agent?: string;
|
|
135
|
+
priority?: 'low' | 'medium' | 'high' | 'critical';
|
|
136
|
+
deadline?: string;
|
|
137
|
+
delegation_depth?: number;
|
|
138
|
+
parent_mandate_ref?: string;
|
|
139
|
+
}
|
|
140
|
+
/** ACH-COMM-v1: Notifications, messages, and alerting. */
|
|
141
|
+
export interface CommunicationCriteria {
|
|
142
|
+
description: string;
|
|
143
|
+
channel_type?: 'email' | 'chat' | 'sms' | 'webhook' | 'notification' | 'ticket';
|
|
144
|
+
recipient?: string;
|
|
145
|
+
subject?: string;
|
|
146
|
+
priority?: 'low' | 'normal' | 'high' | 'critical';
|
|
147
|
+
requires_delivery_confirmation?: boolean;
|
|
148
|
+
}
|
|
149
|
+
/** ACH-AUTH-v1: Permission changes, credential grants, and access control. */
|
|
150
|
+
export interface AuthorizationCriteria {
|
|
151
|
+
description: string;
|
|
152
|
+
action_type?: 'grant' | 'revoke' | 'create_credential' | 'rotate' | 'user_management';
|
|
153
|
+
target_identity?: string;
|
|
154
|
+
permission_scope?: string;
|
|
155
|
+
resource_scope?: string;
|
|
156
|
+
expiration?: string;
|
|
157
|
+
}
|
|
158
|
+
/** ACH-INFRA-v1: Infrastructure changes, cloud provisioning, and config updates. */
|
|
159
|
+
export interface InfrastructureCriteria {
|
|
160
|
+
description: string;
|
|
161
|
+
action_type?: 'ddl' | 'provision' | 'deploy' | 'config_change';
|
|
162
|
+
resource_name?: string;
|
|
163
|
+
resource_type?: string;
|
|
164
|
+
environment?: string;
|
|
165
|
+
region?: string;
|
|
166
|
+
rollback_possible?: boolean;
|
|
167
|
+
}
|
|
168
|
+
/** ACH-ANALYZE-v1: Analysis, research, synthesis, and evaluation tasks. */
|
|
169
|
+
export interface AnalyzeCriteria {
|
|
170
|
+
objective: string;
|
|
171
|
+
scope?: string;
|
|
172
|
+
output_format?: string;
|
|
173
|
+
depth?: 'overview' | 'standard' | 'deep_dive';
|
|
174
|
+
constraints?: {
|
|
175
|
+
max_sources?: number;
|
|
176
|
+
time_budget_seconds?: number;
|
|
177
|
+
cost_budget?: Denomination;
|
|
178
|
+
};
|
|
179
|
+
evaluation_criteria?: string[];
|
|
180
|
+
deadline?: string;
|
|
181
|
+
}
|
|
182
|
+
/** ACH-COORD-v1: Multi-agent coordination, planning, and orchestration. */
|
|
183
|
+
export interface CoordinationCriteria {
|
|
184
|
+
objective: string;
|
|
185
|
+
participants?: string[];
|
|
186
|
+
deliverables?: string[];
|
|
187
|
+
success_criteria?: Record<string, unknown>;
|
|
188
|
+
budget?: Denomination;
|
|
189
|
+
deadline?: string;
|
|
190
|
+
}
|
|
191
|
+
/** ACH-DEL-v1: Deletions, cancellations, and reversals. */
|
|
192
|
+
export interface DestructiveCriteria {
|
|
193
|
+
description: string;
|
|
194
|
+
action_type?: 'delete' | 'cancel' | 'refund' | 'archive' | 'terminate';
|
|
195
|
+
target_identifier?: string;
|
|
196
|
+
is_cascade?: boolean;
|
|
197
|
+
justification?: string;
|
|
198
|
+
original_ref?: string;
|
|
199
|
+
reversal_amount?: number;
|
|
200
|
+
}
|
|
201
|
+
/** ACH-PROC-v1 receipt evidence. */
|
|
202
|
+
export interface ProcurementEvidence {
|
|
203
|
+
item_secured: string;
|
|
204
|
+
quantity: number;
|
|
205
|
+
total_cost: Denomination;
|
|
206
|
+
supplier: {
|
|
207
|
+
id: string;
|
|
208
|
+
name: string;
|
|
209
|
+
rating?: number;
|
|
210
|
+
};
|
|
211
|
+
confirmation_ref: string;
|
|
212
|
+
unit_price?: Denomination;
|
|
213
|
+
submitted_at?: string;
|
|
214
|
+
}
|
|
215
|
+
/** ACH-DLVR-v1 receipt evidence. */
|
|
216
|
+
export interface DeliverableEvidence {
|
|
217
|
+
deliverable: string;
|
|
218
|
+
deliverable_type: string;
|
|
219
|
+
output_format?: string;
|
|
220
|
+
language?: string;
|
|
221
|
+
item_count?: number;
|
|
222
|
+
total_cost?: Denomination;
|
|
223
|
+
submitted_at?: string;
|
|
224
|
+
}
|
|
225
|
+
/** ACH-DATA-v1 receipt evidence. */
|
|
226
|
+
export interface DataProcessingEvidence {
|
|
227
|
+
deliverable: string;
|
|
228
|
+
deliverable_type: string;
|
|
229
|
+
output_format?: string;
|
|
230
|
+
row_count?: number;
|
|
231
|
+
total_cost?: Denomination;
|
|
232
|
+
submitted_at?: string;
|
|
233
|
+
}
|
|
234
|
+
/** ACH-TXN-v1 receipt evidence. */
|
|
235
|
+
export interface TransactionEvidence {
|
|
236
|
+
confirmations: Array<{
|
|
237
|
+
type?: string;
|
|
238
|
+
provider?: string;
|
|
239
|
+
ref?: string;
|
|
240
|
+
transaction_id?: string;
|
|
241
|
+
amount?: number | Denomination;
|
|
242
|
+
status?: string;
|
|
243
|
+
timestamp?: string;
|
|
244
|
+
cost?: Denomination;
|
|
245
|
+
}>;
|
|
246
|
+
total_cost?: Denomination;
|
|
247
|
+
summary?: string;
|
|
248
|
+
submitted_at?: string;
|
|
249
|
+
}
|
|
250
|
+
/** ACH-ORCH-v1 receipt evidence. */
|
|
251
|
+
export interface OrchestrationEvidence {
|
|
252
|
+
task_id: string;
|
|
253
|
+
status?: string;
|
|
254
|
+
deliverable?: string;
|
|
255
|
+
completed_by?: string;
|
|
256
|
+
completed_at?: string;
|
|
257
|
+
}
|
|
258
|
+
/** ACH-COMM-v1 receipt evidence. */
|
|
259
|
+
export interface CommunicationEvidence {
|
|
260
|
+
action: string;
|
|
261
|
+
message_id?: string;
|
|
262
|
+
recipient?: string;
|
|
263
|
+
channel?: string;
|
|
264
|
+
delivery_status?: string;
|
|
265
|
+
sent_at?: string;
|
|
266
|
+
webhook_url?: string;
|
|
267
|
+
event_type?: string;
|
|
268
|
+
response_code?: number;
|
|
269
|
+
}
|
|
270
|
+
/** ACH-AUTH-v1 receipt evidence. */
|
|
271
|
+
export interface AuthorizationEvidence {
|
|
272
|
+
action: string;
|
|
273
|
+
target_identity?: string;
|
|
274
|
+
permission_scope?: string;
|
|
275
|
+
resource_scope?: string;
|
|
276
|
+
credential_id?: string;
|
|
277
|
+
status?: string;
|
|
278
|
+
expires_at?: string;
|
|
279
|
+
performed_at?: string;
|
|
280
|
+
}
|
|
281
|
+
/** ACH-INFRA-v1 receipt evidence. */
|
|
282
|
+
export interface InfrastructureEvidence {
|
|
283
|
+
action: string;
|
|
284
|
+
resource_name?: string;
|
|
285
|
+
resource_type?: string;
|
|
286
|
+
status?: string;
|
|
287
|
+
deployment_id?: string;
|
|
288
|
+
environment?: string;
|
|
289
|
+
config_key?: string;
|
|
290
|
+
previous_value?: string;
|
|
291
|
+
new_value?: string;
|
|
292
|
+
performed_at?: string;
|
|
293
|
+
}
|
|
294
|
+
/** ACH-ANALYZE-v1 receipt evidence. */
|
|
295
|
+
export interface AnalyzeEvidence {
|
|
296
|
+
deliverable: string;
|
|
297
|
+
deliverable_type: string;
|
|
298
|
+
summary: string;
|
|
299
|
+
sources_consulted?: number;
|
|
300
|
+
confidence_score?: number;
|
|
301
|
+
submitted_at?: string;
|
|
302
|
+
}
|
|
303
|
+
/** ACH-COORD-v1 receipt evidence. */
|
|
304
|
+
export interface CoordinationEvidence {
|
|
305
|
+
deliverable: string;
|
|
306
|
+
deliverable_type: string;
|
|
307
|
+
summary: string;
|
|
308
|
+
participants_engaged?: number;
|
|
309
|
+
sub_mandates_created?: number;
|
|
310
|
+
sub_mandates_fulfilled?: number;
|
|
311
|
+
submitted_at?: string;
|
|
312
|
+
}
|
|
313
|
+
/** ACH-DEL-v1 receipt evidence. */
|
|
314
|
+
export interface DestructiveEvidence {
|
|
315
|
+
action: string;
|
|
316
|
+
target_identifier?: string;
|
|
317
|
+
deletion_count?: number;
|
|
318
|
+
status?: string;
|
|
319
|
+
cancellation_ref?: string;
|
|
320
|
+
reversal_ref?: string;
|
|
321
|
+
reversal_amount?: number;
|
|
322
|
+
justification?: string;
|
|
323
|
+
performed_at?: string;
|
|
324
|
+
}
|
|
325
|
+
/** Maps known contract type strings to their criteria interfaces. */
|
|
326
|
+
export interface CriteriaMap {
|
|
327
|
+
'ACH-PROC-v1': ProcurementCriteria;
|
|
328
|
+
'ACH-DLVR-v1': DeliverableCriteria;
|
|
329
|
+
'ACH-DATA-v1': DataProcessingCriteria;
|
|
330
|
+
'ACH-TXN-v1': TransactionCriteria;
|
|
331
|
+
'ACH-ORCH-v1': OrchestrationCriteria;
|
|
332
|
+
'ACH-COMM-v1': CommunicationCriteria;
|
|
333
|
+
'ACH-AUTH-v1': AuthorizationCriteria;
|
|
334
|
+
'ACH-INFRA-v1': InfrastructureCriteria;
|
|
335
|
+
'ACH-DEL-v1': DestructiveCriteria;
|
|
336
|
+
'ACH-ANALYZE-v1': AnalyzeCriteria;
|
|
337
|
+
'ACH-COORD-v1': CoordinationCriteria;
|
|
338
|
+
}
|
|
339
|
+
/** Maps known contract type strings to their evidence interfaces. */
|
|
340
|
+
export interface EvidenceMap {
|
|
341
|
+
'ACH-PROC-v1': ProcurementEvidence;
|
|
342
|
+
'ACH-DLVR-v1': DeliverableEvidence;
|
|
343
|
+
'ACH-DATA-v1': DataProcessingEvidence;
|
|
344
|
+
'ACH-TXN-v1': TransactionEvidence;
|
|
345
|
+
'ACH-ORCH-v1': OrchestrationEvidence;
|
|
346
|
+
'ACH-COMM-v1': CommunicationEvidence;
|
|
347
|
+
'ACH-AUTH-v1': AuthorizationEvidence;
|
|
348
|
+
'ACH-INFRA-v1': InfrastructureEvidence;
|
|
349
|
+
'ACH-DEL-v1': DestructiveEvidence;
|
|
350
|
+
'ACH-ANALYZE-v1': AnalyzeEvidence;
|
|
351
|
+
'ACH-COORD-v1': CoordinationEvidence;
|
|
352
|
+
}
|
|
353
|
+
/** Resolves to the typed criteria for known contract types, or Record<string, unknown> for unknown types. */
|
|
354
|
+
export type CriteriaFor<T extends string> = T extends keyof CriteriaMap ? CriteriaMap[T] & Record<string, unknown> : Record<string, unknown>;
|
|
355
|
+
/** Resolves to the typed evidence for known contract types, or Record<string, unknown> for unknown types. */
|
|
356
|
+
export type EvidenceFor<T extends string> = T extends keyof EvidenceMap ? EvidenceMap[T] & Record<string, unknown> : Record<string, unknown>;
|
|
357
|
+
/** Typed mandate creation params for a specific contract type. */
|
|
358
|
+
export type TypedCreateMandateParams<T extends string> = Omit<CreateMandateParams, 'contractType' | 'criteria'> & {
|
|
359
|
+
contractType: T;
|
|
360
|
+
criteria: CriteriaFor<T>;
|
|
361
|
+
};
|
|
362
|
+
/** Typed receipt submission params for a specific contract type. */
|
|
363
|
+
export type TypedSubmitReceiptParams<T extends string> = Omit<SubmitReceiptParams, 'evidence'> & {
|
|
364
|
+
evidence: EvidenceFor<T>;
|
|
365
|
+
};
|
|
366
|
+
export interface ContractSchema {
|
|
367
|
+
contractType: ContractType;
|
|
368
|
+
mandateSchema: Record<string, unknown>;
|
|
369
|
+
receiptSchema: Record<string, unknown>;
|
|
370
|
+
rulesConfig?: {
|
|
371
|
+
syncRuleIds: string[];
|
|
372
|
+
asyncRuleIds: string[];
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
export interface SchemaValidationResult {
|
|
376
|
+
valid: boolean;
|
|
377
|
+
errors?: Array<{
|
|
378
|
+
keyword: string;
|
|
379
|
+
message: string;
|
|
380
|
+
instancePath?: string;
|
|
381
|
+
schemaPath?: string;
|
|
382
|
+
}>;
|
|
383
|
+
}
|
|
384
|
+
export type MandateStatus = 'DRAFT' | 'PROPOSED' | 'ACCEPTED' | 'COUNTER_PROPOSED' | 'REJECTED' | 'REGISTERED' | 'ACTIVE' | 'PENDING_VERIFICATION' | 'FULFILLED' | 'FAILED' | 'DISPUTED' | 'CANCELLED' | 'REMEDIATED' | 'EXPIRED' | 'RECEIPT_INVALID' | 'RECEIPT_ACCEPTED' | 'VERIFYING' | 'VERIFIED_PASS' | 'VERIFIED_FAIL' | 'CANCELLED_DRAFT' | 'CANCELLED_PRE_WORK' | 'CANCELLED_IN_PROGRESS' | (string & {});
|
|
385
|
+
export type MandateTransitionAction = 'register' | 'activate' | 'settle' | 'cancel' | 'refund' | (string & {});
|
|
386
|
+
export type OperatingMode = 'standard' | 'encrypted' | 'cleartext';
|
|
387
|
+
export type RiskClassification = 'unacceptable' | 'high' | 'limited' | 'minimal' | 'unclassified';
|
|
388
|
+
export interface Mandate {
|
|
389
|
+
id: string;
|
|
390
|
+
enterpriseId: string;
|
|
391
|
+
agentId: string | null;
|
|
392
|
+
contractType: ContractType;
|
|
393
|
+
contractVersion: string;
|
|
394
|
+
platform: string;
|
|
395
|
+
platformRef?: string;
|
|
396
|
+
status: MandateStatus;
|
|
397
|
+
criteria: Record<string, unknown>;
|
|
398
|
+
tolerance?: Record<string, unknown>;
|
|
399
|
+
deadline?: string;
|
|
400
|
+
commissionPct?: number;
|
|
401
|
+
operatingMode?: OperatingMode;
|
|
402
|
+
riskClassification?: RiskClassification;
|
|
403
|
+
euAiActDomain?: string;
|
|
404
|
+
humanOversight?: Record<string, unknown>;
|
|
405
|
+
acceptanceStatus?: 'PENDING' | 'ACCEPTED' | 'REJECTED' | 'COUNTER_PROPOSED';
|
|
406
|
+
projectRef?: string;
|
|
407
|
+
parentMandateId?: string;
|
|
408
|
+
rootMandateId?: string;
|
|
409
|
+
chainDepth?: number;
|
|
410
|
+
lastTransitionReason?: string | null;
|
|
411
|
+
lastTransitionBy?: string | null;
|
|
412
|
+
version: number;
|
|
413
|
+
createdAt: string;
|
|
414
|
+
updatedAt: string;
|
|
415
|
+
activatedAt?: string;
|
|
416
|
+
fulfilledAt?: string;
|
|
417
|
+
}
|
|
418
|
+
export interface CreateMandateParams {
|
|
419
|
+
enterpriseId: string;
|
|
420
|
+
contractType: ContractType;
|
|
421
|
+
contractVersion: string;
|
|
422
|
+
platform: string;
|
|
423
|
+
platformRef?: string;
|
|
424
|
+
projectRef?: string;
|
|
425
|
+
criteria: Record<string, unknown>;
|
|
426
|
+
tolerance?: Record<string, unknown>;
|
|
427
|
+
deadline?: string;
|
|
428
|
+
agentId?: string;
|
|
429
|
+
commissionPct?: number;
|
|
430
|
+
operatingMode?: OperatingMode;
|
|
431
|
+
riskClassification?: RiskClassification;
|
|
432
|
+
euAiActDomain?: string;
|
|
433
|
+
humanOversight?: Record<string, unknown>;
|
|
434
|
+
}
|
|
435
|
+
export interface UpdateMandateParams {
|
|
436
|
+
criteria?: Record<string, unknown>;
|
|
437
|
+
tolerance?: Record<string, unknown>;
|
|
438
|
+
deadline?: string;
|
|
439
|
+
riskClassification?: RiskClassification;
|
|
440
|
+
euAiActDomain?: string;
|
|
441
|
+
humanOversight?: Record<string, unknown>;
|
|
442
|
+
}
|
|
443
|
+
export interface ListMandatesParams extends ListParams {
|
|
444
|
+
enterpriseId: string;
|
|
445
|
+
}
|
|
446
|
+
export interface SearchMandatesParams extends ListParams {
|
|
447
|
+
enterpriseId: string;
|
|
448
|
+
status?: MandateStatus;
|
|
449
|
+
contractType?: ContractType;
|
|
450
|
+
agentId?: string;
|
|
451
|
+
from?: string;
|
|
452
|
+
to?: string;
|
|
453
|
+
sort?: string;
|
|
454
|
+
order?: 'asc' | 'desc';
|
|
455
|
+
}
|
|
456
|
+
export interface DelegateMandateParams {
|
|
457
|
+
principalAgentId: string;
|
|
458
|
+
performerAgentId?: string;
|
|
459
|
+
contractType: ContractType;
|
|
460
|
+
contractVersion: string;
|
|
461
|
+
platform?: string;
|
|
462
|
+
criteria: Record<string, unknown>;
|
|
463
|
+
commissionPct?: number;
|
|
464
|
+
}
|
|
465
|
+
export interface CreateAgentMandateParams {
|
|
466
|
+
principalAgentId: string;
|
|
467
|
+
performerAgentId?: string;
|
|
468
|
+
contractType: ContractType;
|
|
469
|
+
contractVersion: string;
|
|
470
|
+
platform?: string;
|
|
471
|
+
projectRef?: string;
|
|
472
|
+
criteria: Record<string, unknown>;
|
|
473
|
+
tolerance?: Record<string, unknown>;
|
|
474
|
+
parentMandateId?: string;
|
|
475
|
+
commissionPct?: number;
|
|
476
|
+
deadline?: string;
|
|
477
|
+
}
|
|
478
|
+
export interface RespondToMandateParams {
|
|
479
|
+
action: 'accept' | 'reject' | 'counter';
|
|
480
|
+
reason?: string;
|
|
481
|
+
counterTerms?: Record<string, unknown>;
|
|
482
|
+
}
|
|
483
|
+
export type ReceiptStatus = 'SUBMITTED' | 'ACCEPTED' | 'REJECTED' | 'INVALID' | (string & {});
|
|
484
|
+
export interface Receipt {
|
|
485
|
+
id: string;
|
|
486
|
+
mandateId: string;
|
|
487
|
+
agentId: string;
|
|
488
|
+
status: ReceiptStatus;
|
|
489
|
+
evidence: Record<string, unknown>;
|
|
490
|
+
evidenceHash?: string;
|
|
491
|
+
notes?: string;
|
|
492
|
+
verificationPhase?: string;
|
|
493
|
+
verificationResult?: Record<string, unknown>;
|
|
494
|
+
verificationOutcome?: VerificationOutcome;
|
|
495
|
+
verificationCompletedAt?: string;
|
|
496
|
+
validationErrors?: string[] | null;
|
|
497
|
+
mandateStatus?: MandateStatus;
|
|
498
|
+
idempotencyKey?: string | null;
|
|
499
|
+
createdAt: string;
|
|
500
|
+
updatedAt?: string;
|
|
501
|
+
}
|
|
502
|
+
export interface SubmitReceiptParams {
|
|
503
|
+
agentId: string;
|
|
504
|
+
evidence: Record<string, unknown>;
|
|
505
|
+
notes?: string;
|
|
506
|
+
idempotencyKey?: string;
|
|
507
|
+
}
|
|
508
|
+
export interface UpdateReceiptParams {
|
|
509
|
+
evidence?: Record<string, unknown>;
|
|
510
|
+
notes?: string;
|
|
511
|
+
}
|
|
512
|
+
export type VerificationOutcome = 'PASS' | 'FAIL' | 'REVIEW_REQUIRED' | (string & {});
|
|
513
|
+
export type SettlementSignal = 'SETTLE' | 'HOLD' | 'RELEASE' | (string & {});
|
|
514
|
+
export interface VerificationResult {
|
|
515
|
+
mandateId: string;
|
|
516
|
+
receipts: Array<{
|
|
517
|
+
receiptId: string;
|
|
518
|
+
phase1Result?: Record<string, unknown>;
|
|
519
|
+
phase2Result?: Record<string, unknown>;
|
|
520
|
+
}>;
|
|
521
|
+
overallStatus: string;
|
|
522
|
+
}
|
|
523
|
+
export interface VerificationStatus {
|
|
524
|
+
mandateId: string;
|
|
525
|
+
phase1Status: string;
|
|
526
|
+
phase2Status: string;
|
|
527
|
+
lastVerifiedAt?: string;
|
|
528
|
+
pendingRules?: string[];
|
|
529
|
+
}
|
|
530
|
+
export type DisputeStatus = 'OPEN' | 'TIER_1_REVIEW' | 'EVIDENCE_WINDOW' | 'TIER_2_REVIEW' | 'ESCALATED' | 'TIER_3_ARBITRATION' | 'RESOLVED' | 'WITHDRAWN' | (string & {});
|
|
531
|
+
export interface Dispute {
|
|
532
|
+
id: string;
|
|
533
|
+
mandateId: string;
|
|
534
|
+
receiptId: string;
|
|
535
|
+
status: DisputeStatus;
|
|
536
|
+
reason: string;
|
|
537
|
+
evidence?: Record<string, unknown>;
|
|
538
|
+
currentTier: number;
|
|
539
|
+
tierHistory?: Record<string, unknown>[];
|
|
540
|
+
resolution?: string;
|
|
541
|
+
amount?: number;
|
|
542
|
+
createdAt: string;
|
|
543
|
+
updatedAt?: string;
|
|
544
|
+
resolvedAt?: string;
|
|
545
|
+
}
|
|
546
|
+
export interface CreateDisputeParams {
|
|
547
|
+
grounds: string;
|
|
548
|
+
context?: string;
|
|
549
|
+
}
|
|
550
|
+
export interface ResolveDisputeParams {
|
|
551
|
+
resolution: string;
|
|
552
|
+
amount?: number;
|
|
553
|
+
}
|
|
554
|
+
export type WebhookEventType = 'receipt.submitted' | 'receipt.verified' | 'receipt.accepted' | 'receipt.rejected' | 'mandate.created' | 'mandate.registered' | 'mandate.activated' | 'mandate.fulfilled' | 'mandate.failed' | 'mandate.cancelled' | 'mandate.delegated' | 'mandate.released' | 'dispute.created' | 'dispute.resolved' | 'signal.emitted' | 'verification.complete' | (string & {});
|
|
555
|
+
export interface Webhook {
|
|
556
|
+
id: string;
|
|
557
|
+
url: string;
|
|
558
|
+
events: WebhookEventType[];
|
|
559
|
+
eventTypes?: string[] | null;
|
|
560
|
+
secret?: string;
|
|
561
|
+
createdAt: string;
|
|
562
|
+
lastTriggeredAt?: string;
|
|
563
|
+
failureCount?: number;
|
|
564
|
+
}
|
|
565
|
+
export interface CreateWebhookParams {
|
|
566
|
+
url: string;
|
|
567
|
+
events: WebhookEventType[];
|
|
568
|
+
eventTypes?: string[];
|
|
569
|
+
secret?: string;
|
|
570
|
+
}
|
|
571
|
+
export interface UpdateWebhookParams {
|
|
572
|
+
url?: string;
|
|
573
|
+
events?: WebhookEventType[];
|
|
574
|
+
eventTypes?: string[] | null;
|
|
575
|
+
}
|
|
576
|
+
export interface WebhookDelivery {
|
|
577
|
+
id: string;
|
|
578
|
+
webhookId: string;
|
|
579
|
+
event: string;
|
|
580
|
+
payload?: Record<string, unknown>;
|
|
581
|
+
requestBody?: string;
|
|
582
|
+
signature?: string;
|
|
583
|
+
responseBody?: string;
|
|
584
|
+
responseStatus?: number;
|
|
585
|
+
httpStatus?: number;
|
|
586
|
+
timestamp: string;
|
|
587
|
+
retryCount?: number;
|
|
588
|
+
attemptNumber?: number;
|
|
589
|
+
nextRetryAt?: string;
|
|
590
|
+
status: string;
|
|
591
|
+
}
|
|
592
|
+
export interface WebhookTestResult {
|
|
593
|
+
statusCode: number;
|
|
594
|
+
body: string;
|
|
595
|
+
durationMs: number;
|
|
596
|
+
success?: boolean;
|
|
597
|
+
deliveryId?: string;
|
|
598
|
+
}
|
|
599
|
+
export type ReputationTier = 'platinum' | 'gold' | 'silver' | 'bronze' | (string & {});
|
|
600
|
+
export interface ReputationScore {
|
|
601
|
+
agentId: string;
|
|
602
|
+
score: number;
|
|
603
|
+
tier: ReputationTier;
|
|
604
|
+
completionRate: number;
|
|
605
|
+
onTimeRate: number;
|
|
606
|
+
disputeRate: number;
|
|
607
|
+
lastUpdatedAt: string;
|
|
608
|
+
factorsBreakdown?: Record<string, unknown>;
|
|
609
|
+
}
|
|
610
|
+
export interface ReputationHistoryEntry {
|
|
611
|
+
timestamp: string;
|
|
612
|
+
score: number;
|
|
613
|
+
tier: ReputationTier;
|
|
614
|
+
changeReason?: string;
|
|
615
|
+
}
|
|
616
|
+
export interface AgledgerEvent {
|
|
617
|
+
id: string;
|
|
618
|
+
mandateId: string;
|
|
619
|
+
eventType: string;
|
|
620
|
+
actor: string;
|
|
621
|
+
actorId?: string;
|
|
622
|
+
timestamp: string;
|
|
623
|
+
changes?: Record<string, unknown>;
|
|
624
|
+
details?: Record<string, unknown>;
|
|
625
|
+
}
|
|
626
|
+
export interface AuditChain {
|
|
627
|
+
mandateId: string;
|
|
628
|
+
chainStart: string;
|
|
629
|
+
entries: Array<{
|
|
630
|
+
index: number;
|
|
631
|
+
hash: string;
|
|
632
|
+
previousHash: string | null;
|
|
633
|
+
event: string;
|
|
634
|
+
actor: string;
|
|
635
|
+
timestamp: string;
|
|
636
|
+
signature?: string;
|
|
637
|
+
}>;
|
|
638
|
+
isValid: boolean;
|
|
639
|
+
}
|
|
640
|
+
export interface DashboardSummary {
|
|
641
|
+
totalMandates: number;
|
|
642
|
+
activeCount: number;
|
|
643
|
+
fulfilledCount: number;
|
|
644
|
+
disputedCount: number;
|
|
645
|
+
avgCompletionTime?: number;
|
|
646
|
+
topAgents?: Array<{
|
|
647
|
+
agentId: string;
|
|
648
|
+
successRate: number;
|
|
649
|
+
}>;
|
|
650
|
+
totalSettlementSignals?: number;
|
|
651
|
+
signalBreakdown?: {
|
|
652
|
+
settle: number;
|
|
653
|
+
hold: number;
|
|
654
|
+
release: number;
|
|
655
|
+
};
|
|
656
|
+
disputeValue?: number;
|
|
657
|
+
}
|
|
658
|
+
export interface DashboardAgent {
|
|
659
|
+
id: string;
|
|
660
|
+
displayName: string;
|
|
661
|
+
trustLevel: string;
|
|
662
|
+
compositeScore: number | null;
|
|
663
|
+
reliabilityScore: number | null;
|
|
664
|
+
totalMandates: number;
|
|
665
|
+
mandateCount: number;
|
|
666
|
+
activeCount: number;
|
|
667
|
+
errorCount: number;
|
|
668
|
+
}
|
|
669
|
+
export interface DashboardAgentParams extends ListParams {
|
|
670
|
+
sort?: 'compositeScore' | 'reliabilityScore' | 'totalMandates' | 'displayName';
|
|
671
|
+
order?: 'asc' | 'desc';
|
|
672
|
+
trustLevel?: string;
|
|
673
|
+
minScore?: number;
|
|
674
|
+
maxScore?: number;
|
|
675
|
+
}
|
|
676
|
+
export interface DashboardMetrics {
|
|
677
|
+
granularity?: string;
|
|
678
|
+
from?: string | null;
|
|
679
|
+
to?: string | null;
|
|
680
|
+
series: Array<{
|
|
681
|
+
timestamp: string;
|
|
682
|
+
mandates: number;
|
|
683
|
+
receipts: number;
|
|
684
|
+
disputes: number;
|
|
685
|
+
avgVerificationTime?: number;
|
|
686
|
+
}>;
|
|
687
|
+
}
|
|
688
|
+
export interface DashboardMetricsParams {
|
|
689
|
+
from?: string;
|
|
690
|
+
to?: string;
|
|
691
|
+
granularity?: 'daily' | 'weekly' | 'monthly';
|
|
692
|
+
}
|
|
693
|
+
export interface ComplianceExport {
|
|
694
|
+
exportId: string;
|
|
695
|
+
status: 'processing' | 'ready';
|
|
696
|
+
downloadUrl?: string;
|
|
697
|
+
createdAt?: string;
|
|
698
|
+
expiresAt?: string;
|
|
699
|
+
recordCount?: number;
|
|
700
|
+
}
|
|
701
|
+
export interface ExportComplianceParams {
|
|
702
|
+
format: 'csv' | 'json';
|
|
703
|
+
filters?: {
|
|
704
|
+
enterpriseId?: string;
|
|
705
|
+
from?: string;
|
|
706
|
+
to?: string;
|
|
707
|
+
contractTypes?: ContractType[];
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
export interface AiImpactAssessment {
|
|
711
|
+
id: string;
|
|
712
|
+
mandateId: string;
|
|
713
|
+
riskLevel: RiskClassification;
|
|
714
|
+
domain: string;
|
|
715
|
+
overseerName?: string;
|
|
716
|
+
humanOversight?: Record<string, unknown>;
|
|
717
|
+
testingResults?: Record<string, unknown>;
|
|
718
|
+
createdAt: string;
|
|
719
|
+
}
|
|
720
|
+
export interface CreateAiImpactAssessmentParams {
|
|
721
|
+
riskLevel: RiskClassification;
|
|
722
|
+
domain: string;
|
|
723
|
+
humanOversight?: Record<string, unknown>;
|
|
724
|
+
testingResults?: Record<string, unknown>;
|
|
725
|
+
}
|
|
726
|
+
export interface EuAiActReport {
|
|
727
|
+
mandates: Array<{
|
|
728
|
+
id: string;
|
|
729
|
+
riskClassification: RiskClassification;
|
|
730
|
+
domain: string;
|
|
731
|
+
humanOversightDesignated: boolean;
|
|
732
|
+
assessmentDate?: string;
|
|
733
|
+
}>;
|
|
734
|
+
summary: {
|
|
735
|
+
highRiskCount: number;
|
|
736
|
+
auditedCount: number;
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
export type AccountType = 'enterprise' | 'agent' | 'platform';
|
|
740
|
+
export interface RegisterParams {
|
|
741
|
+
accountType: AccountType;
|
|
742
|
+
email: string;
|
|
743
|
+
legalName: string;
|
|
744
|
+
contactEmail?: string;
|
|
745
|
+
}
|
|
746
|
+
export interface RegisterResult {
|
|
747
|
+
apiKey: string;
|
|
748
|
+
sandboxMode: boolean;
|
|
749
|
+
verificationRequired: string;
|
|
750
|
+
}
|
|
751
|
+
export interface AccountProfile {
|
|
752
|
+
id: string;
|
|
753
|
+
accountType: AccountType;
|
|
754
|
+
displayName?: string;
|
|
755
|
+
trustLevel?: string;
|
|
756
|
+
enterpriseId?: string;
|
|
757
|
+
capabilities?: ContractType[];
|
|
758
|
+
sandboxMode?: boolean;
|
|
759
|
+
createdAt: string;
|
|
760
|
+
}
|
|
761
|
+
export interface HealthResponse {
|
|
762
|
+
status: string;
|
|
763
|
+
version?: string;
|
|
764
|
+
uptime?: number;
|
|
765
|
+
database?: string;
|
|
766
|
+
timestamp: string;
|
|
767
|
+
}
|
|
768
|
+
export interface StatusComponent {
|
|
769
|
+
name: string;
|
|
770
|
+
status: string;
|
|
771
|
+
latencyMs?: number;
|
|
772
|
+
}
|
|
773
|
+
export interface StatusResponse {
|
|
774
|
+
status: 'operational' | 'degraded' | 'maintenance' | 'outage' | (string & {});
|
|
775
|
+
components: StatusComponent[];
|
|
776
|
+
activeIncidents: Array<Record<string, unknown>>;
|
|
777
|
+
uptime: number;
|
|
778
|
+
timestamp: string;
|
|
779
|
+
}
|
|
780
|
+
export interface ConformanceResponse {
|
|
781
|
+
protocolVersion: string;
|
|
782
|
+
features: string[];
|
|
783
|
+
contractTypes: ContractType[];
|
|
784
|
+
maxBatchSize?: number;
|
|
785
|
+
rateLimits?: {
|
|
786
|
+
requests: number;
|
|
787
|
+
windowSeconds: number;
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
export interface AdminEnterprise {
|
|
791
|
+
id: string;
|
|
792
|
+
legalName: string;
|
|
793
|
+
trustLevel: string;
|
|
794
|
+
createdAt: string;
|
|
795
|
+
}
|
|
796
|
+
export interface AdminAgent {
|
|
797
|
+
id: string;
|
|
798
|
+
displayName: string;
|
|
799
|
+
enterpriseId: string;
|
|
800
|
+
trustLevel: string;
|
|
801
|
+
capabilities?: ContractType[];
|
|
802
|
+
createdAt: string;
|
|
803
|
+
}
|
|
804
|
+
export interface AdminApiKey {
|
|
805
|
+
id: string;
|
|
806
|
+
ownerId: string;
|
|
807
|
+
ownerType: AccountType;
|
|
808
|
+
active: boolean;
|
|
809
|
+
createdAt: string;
|
|
810
|
+
lastUsedAt?: string;
|
|
811
|
+
}
|
|
812
|
+
export interface WebhookDlqEntry {
|
|
813
|
+
id: string;
|
|
814
|
+
webhookId: string;
|
|
815
|
+
event: string;
|
|
816
|
+
payload: Record<string, unknown>;
|
|
817
|
+
failureReason: string;
|
|
818
|
+
attemptCount: number;
|
|
819
|
+
createdAt: string;
|
|
820
|
+
}
|
|
821
|
+
export interface SystemHealth {
|
|
822
|
+
database: string;
|
|
823
|
+
queue: string;
|
|
824
|
+
cache: string;
|
|
825
|
+
uptime: number;
|
|
826
|
+
activeConnections: number;
|
|
827
|
+
}
|
|
828
|
+
export interface UpdateTrustLevelParams {
|
|
829
|
+
trustLevel: 'sandbox' | 'active' | 'verified';
|
|
830
|
+
}
|
|
831
|
+
export interface SetCapabilitiesParams {
|
|
832
|
+
capabilities: ContractType[];
|
|
833
|
+
}
|
|
834
|
+
export interface AgentCard {
|
|
835
|
+
name: string;
|
|
836
|
+
description?: string;
|
|
837
|
+
url: string;
|
|
838
|
+
capabilities?: Record<string, unknown>;
|
|
839
|
+
authentication?: Record<string, unknown>;
|
|
840
|
+
skills?: Array<{
|
|
841
|
+
id: string;
|
|
842
|
+
name: string;
|
|
843
|
+
description?: string;
|
|
844
|
+
}>;
|
|
845
|
+
}
|
|
846
|
+
export interface JsonRpcRequest {
|
|
847
|
+
jsonrpc: '2.0';
|
|
848
|
+
method: string;
|
|
849
|
+
params?: Record<string, unknown>;
|
|
850
|
+
id?: string | number;
|
|
851
|
+
}
|
|
852
|
+
export interface JsonRpcResponse {
|
|
853
|
+
jsonrpc: '2.0';
|
|
854
|
+
result?: unknown;
|
|
855
|
+
error?: {
|
|
856
|
+
code: number;
|
|
857
|
+
message: string;
|
|
858
|
+
data?: unknown;
|
|
859
|
+
};
|
|
860
|
+
id?: string | number;
|
|
861
|
+
}
|
|
862
|
+
export type ProxyMode = 'observe' | 'advisory' | 'enforced';
|
|
863
|
+
export type InterceptorAction = 'ALLOWED' | 'BLOCKED' | 'ANNOTATED' | (string & {});
|
|
864
|
+
export type ConfidenceLevel = 'low' | 'medium' | 'high';
|
|
865
|
+
export type SidecarMandateStatus = 'SHADOW' | 'FORMALIZED' | 'DISMISSED';
|
|
866
|
+
export type SessionOutcome = 'active' | 'zero_action' | 'undetected' | 'inactive';
|
|
867
|
+
export interface ProxySession {
|
|
868
|
+
id: string;
|
|
869
|
+
enterpriseId: string;
|
|
870
|
+
agentId?: string;
|
|
871
|
+
proxyInstanceId?: string;
|
|
872
|
+
startedAt: string;
|
|
873
|
+
endedAt?: string;
|
|
874
|
+
totalCalls: number;
|
|
875
|
+
matchedCalls: number;
|
|
876
|
+
coveragePercent: number;
|
|
877
|
+
sidecarMandateCount: number;
|
|
878
|
+
sidecarReceiptCount: number;
|
|
879
|
+
proxyMode: ProxyMode;
|
|
880
|
+
agentName?: string;
|
|
881
|
+
agentExternalId?: string;
|
|
882
|
+
agentMetadata?: Record<string, unknown>;
|
|
883
|
+
errorCount: number;
|
|
884
|
+
blockedCount: number;
|
|
885
|
+
sessionOutcome?: SessionOutcome;
|
|
886
|
+
createdAt: string;
|
|
887
|
+
updatedAt: string;
|
|
888
|
+
}
|
|
889
|
+
export interface CreateSessionParams {
|
|
890
|
+
startedAt: string;
|
|
891
|
+
proxyMode: ProxyMode;
|
|
892
|
+
proxyInstanceId?: string;
|
|
893
|
+
endedAt?: string;
|
|
894
|
+
agentName?: string;
|
|
895
|
+
agentExternalId?: string;
|
|
896
|
+
agentMetadata?: Record<string, unknown>;
|
|
897
|
+
errorCount?: number;
|
|
898
|
+
blockedCount?: number;
|
|
899
|
+
sessionOutcome?: SessionOutcome;
|
|
900
|
+
}
|
|
901
|
+
export interface ToolCallBatchItem {
|
|
902
|
+
toolName: string;
|
|
903
|
+
upstreamName?: string;
|
|
904
|
+
arguments: Record<string, unknown>;
|
|
905
|
+
result?: Record<string, unknown> | string;
|
|
906
|
+
durationMs?: number;
|
|
907
|
+
patternMatch?: Record<string, unknown>;
|
|
908
|
+
sidecarMandateId?: string;
|
|
909
|
+
sidecarReceiptId?: string;
|
|
910
|
+
interceptorAction?: InterceptorAction;
|
|
911
|
+
proxyToolCallId?: string;
|
|
912
|
+
occurredAt: string;
|
|
913
|
+
isError?: boolean;
|
|
914
|
+
errorMessage?: string;
|
|
915
|
+
}
|
|
916
|
+
export interface SidecarMandateBatchItem {
|
|
917
|
+
contractType: ContractType;
|
|
918
|
+
confidence: ConfidenceLevel;
|
|
919
|
+
confidenceScore: number;
|
|
920
|
+
extractedCriteria: Record<string, unknown>;
|
|
921
|
+
sourceToolCallId?: string;
|
|
922
|
+
proxySidecarMandateId?: string;
|
|
923
|
+
batchCount?: number;
|
|
924
|
+
ruleId?: string;
|
|
925
|
+
correlationId?: string | null;
|
|
926
|
+
}
|
|
927
|
+
export interface SidecarReceiptBatchItem {
|
|
928
|
+
sidecarMandateId: string;
|
|
929
|
+
extractedEvidence?: Record<string, unknown>;
|
|
930
|
+
confidence: ConfidenceLevel;
|
|
931
|
+
confidenceScore: number;
|
|
932
|
+
sourceToolCallId?: string;
|
|
933
|
+
proxySidecarReceiptId?: string;
|
|
934
|
+
correlationId?: string | null;
|
|
935
|
+
}
|
|
936
|
+
export interface ToolCatalogBatchItem {
|
|
937
|
+
upstreamName: string;
|
|
938
|
+
toolName: string;
|
|
939
|
+
description?: string;
|
|
940
|
+
inputSchema?: Record<string, unknown>;
|
|
941
|
+
discoveredAt: string;
|
|
942
|
+
}
|
|
943
|
+
export interface SyncSessionParams {
|
|
944
|
+
session: CreateSessionParams;
|
|
945
|
+
toolCalls?: ToolCallBatchItem[];
|
|
946
|
+
sidecarMandates?: SidecarMandateBatchItem[];
|
|
947
|
+
sidecarReceipts?: SidecarReceiptBatchItem[];
|
|
948
|
+
toolCatalog?: ToolCatalogBatchItem[];
|
|
949
|
+
}
|
|
950
|
+
export interface SyncSessionResult {
|
|
951
|
+
session: ProxySession;
|
|
952
|
+
toolCalls: BatchResult<unknown>['summary'];
|
|
953
|
+
sidecarMandates: BatchResult<unknown>['summary'];
|
|
954
|
+
sidecarReceipts: BatchResult<unknown>['summary'];
|
|
955
|
+
toolCatalog: BatchResult<unknown>['summary'];
|
|
956
|
+
mandateIdMap: Record<string, string>;
|
|
957
|
+
}
|
|
958
|
+
export interface ProxySidecarMandate {
|
|
959
|
+
id: string;
|
|
960
|
+
sessionId: string;
|
|
961
|
+
contractType: ContractType;
|
|
962
|
+
confidence: ConfidenceLevel;
|
|
963
|
+
confidenceScore: number;
|
|
964
|
+
extractedCriteria: Record<string, unknown>;
|
|
965
|
+
status: SidecarMandateStatus;
|
|
966
|
+
formalizedMandateId?: string;
|
|
967
|
+
sourceToolCallId?: string;
|
|
968
|
+
batchCount?: number;
|
|
969
|
+
ruleId?: string;
|
|
970
|
+
correlationId?: string;
|
|
971
|
+
createdAt: string;
|
|
972
|
+
updatedAt: string;
|
|
973
|
+
}
|
|
974
|
+
export interface ProxySidecarReceipt {
|
|
975
|
+
id: string;
|
|
976
|
+
sessionId: string;
|
|
977
|
+
sidecarMandateId: string;
|
|
978
|
+
extractedEvidence?: Record<string, unknown>;
|
|
979
|
+
confidence: ConfidenceLevel;
|
|
980
|
+
confidenceScore: number;
|
|
981
|
+
sourceToolCallId?: string;
|
|
982
|
+
correlationId?: string;
|
|
983
|
+
createdAt: string;
|
|
984
|
+
}
|
|
985
|
+
export interface ProxyToolCall {
|
|
986
|
+
id: string;
|
|
987
|
+
sessionId: string;
|
|
988
|
+
toolName: string;
|
|
989
|
+
upstreamName?: string;
|
|
990
|
+
arguments: Record<string, unknown>;
|
|
991
|
+
result?: Record<string, unknown> | string;
|
|
992
|
+
durationMs?: number;
|
|
993
|
+
patternMatch?: Record<string, unknown>;
|
|
994
|
+
sidecarMandateId?: string;
|
|
995
|
+
sidecarReceiptId?: string;
|
|
996
|
+
interceptorAction?: InterceptorAction;
|
|
997
|
+
isError: boolean;
|
|
998
|
+
errorMessage?: string;
|
|
999
|
+
occurredAt: string;
|
|
1000
|
+
}
|
|
1001
|
+
export interface ProxyToolCatalogEntry {
|
|
1002
|
+
id: string;
|
|
1003
|
+
sessionId: string;
|
|
1004
|
+
upstreamName: string;
|
|
1005
|
+
toolName: string;
|
|
1006
|
+
description?: string;
|
|
1007
|
+
inputSchema?: Record<string, unknown>;
|
|
1008
|
+
discoveredAt: string;
|
|
1009
|
+
}
|
|
1010
|
+
export interface SessionAnalytics {
|
|
1011
|
+
totalCalls: number;
|
|
1012
|
+
matchedCount: number;
|
|
1013
|
+
coveragePercent: number;
|
|
1014
|
+
errorCount: number;
|
|
1015
|
+
blockedCount: number;
|
|
1016
|
+
callsByTool: Record<string, number>;
|
|
1017
|
+
estimatedTokenOverhead: number;
|
|
1018
|
+
}
|
|
1019
|
+
export interface AnalyticsSummary {
|
|
1020
|
+
totalSessions: number;
|
|
1021
|
+
totalCalls: number;
|
|
1022
|
+
avgCoveragePercent: number;
|
|
1023
|
+
contractTypeBreakdown: Record<string, number>;
|
|
1024
|
+
}
|
|
1025
|
+
export interface UpdateSidecarMandateParams {
|
|
1026
|
+
status?: SidecarMandateStatus;
|
|
1027
|
+
formalizedMandateId?: string;
|
|
1028
|
+
}
|
|
1029
|
+
export interface MandateSummary {
|
|
1030
|
+
sessionId: string;
|
|
1031
|
+
totalSidecarMandates: number;
|
|
1032
|
+
formalized: number;
|
|
1033
|
+
dismissed: number;
|
|
1034
|
+
pending: number;
|
|
1035
|
+
contractTypes: Record<string, number>;
|
|
1036
|
+
}
|
|
1037
|
+
export interface AlignmentAnalysis {
|
|
1038
|
+
sessionId: string;
|
|
1039
|
+
coveragePercent: number;
|
|
1040
|
+
missingCategories?: string[];
|
|
1041
|
+
recommendations?: string[];
|
|
1042
|
+
}
|
|
1043
|
+
export type NotarizeStatus = 'NOTARIZED' | 'ACCEPTED' | 'COUNTER_PROPOSED' | 'RECEIPT_SUBMITTED' | 'VERDICT_PASS' | 'VERDICT_FAIL' | (string & {});
|
|
1044
|
+
export interface NotarizedMandate {
|
|
1045
|
+
id: string;
|
|
1046
|
+
hash: string;
|
|
1047
|
+
contractType: ContractType;
|
|
1048
|
+
principalId: string;
|
|
1049
|
+
performerId?: string;
|
|
1050
|
+
status: NotarizeStatus;
|
|
1051
|
+
metadata?: Record<string, unknown>;
|
|
1052
|
+
createdAt: string;
|
|
1053
|
+
updatedAt: string;
|
|
1054
|
+
}
|
|
1055
|
+
export interface NotarizeTransition {
|
|
1056
|
+
status: NotarizeStatus;
|
|
1057
|
+
actor: string;
|
|
1058
|
+
hash?: string;
|
|
1059
|
+
timestamp: string;
|
|
1060
|
+
}
|
|
1061
|
+
export interface NotarizeMandateParams {
|
|
1062
|
+
contractType: ContractType;
|
|
1063
|
+
payload: Record<string, unknown>;
|
|
1064
|
+
performerHint?: string;
|
|
1065
|
+
metadata?: Record<string, unknown>;
|
|
1066
|
+
}
|
|
1067
|
+
export interface NotarizeMandateResult {
|
|
1068
|
+
mandate: NotarizedMandate;
|
|
1069
|
+
payload: Record<string, unknown>;
|
|
1070
|
+
}
|
|
1071
|
+
export interface NotarizeCounterProposeParams {
|
|
1072
|
+
payload: Record<string, unknown>;
|
|
1073
|
+
reason?: string;
|
|
1074
|
+
}
|
|
1075
|
+
export interface NotarizeReceiptParams {
|
|
1076
|
+
payload: Record<string, unknown>;
|
|
1077
|
+
}
|
|
1078
|
+
export interface NotarizeReceiptResult {
|
|
1079
|
+
receiptId: string;
|
|
1080
|
+
hash: string;
|
|
1081
|
+
mandateId: string;
|
|
1082
|
+
mandate: NotarizedMandate;
|
|
1083
|
+
payload: Record<string, unknown>;
|
|
1084
|
+
}
|
|
1085
|
+
export interface NotarizeVerdictParams {
|
|
1086
|
+
outcome: 'PASS' | 'FAIL';
|
|
1087
|
+
reason?: string;
|
|
1088
|
+
}
|
|
1089
|
+
export interface NotarizeVerifyParams {
|
|
1090
|
+
id: string;
|
|
1091
|
+
payload: Record<string, unknown>;
|
|
1092
|
+
}
|
|
1093
|
+
export interface NotarizeVerifyResult {
|
|
1094
|
+
match: boolean;
|
|
1095
|
+
storedHash: string;
|
|
1096
|
+
providedHash: string;
|
|
1097
|
+
}
|
|
1098
|
+
export interface NotarizeHistory {
|
|
1099
|
+
mandateId: string;
|
|
1100
|
+
transitions: NotarizeTransition[];
|
|
1101
|
+
}
|
|
1102
|
+
export interface ApiErrorResponse {
|
|
1103
|
+
error: string;
|
|
1104
|
+
message: string;
|
|
1105
|
+
requestId?: string;
|
|
1106
|
+
code?: string;
|
|
1107
|
+
retryable?: boolean;
|
|
1108
|
+
details?: ValidationErrorDetail[] | Record<string, unknown>;
|
|
1109
|
+
}
|
|
1110
|
+
export interface ValidationErrorDetail {
|
|
1111
|
+
field: string;
|
|
1112
|
+
message: string;
|
|
1113
|
+
constraint?: string;
|
|
1114
|
+
expected?: unknown;
|
|
1115
|
+
actual?: unknown;
|
|
1116
|
+
}
|
|
1117
|
+
/** @deprecated Use `Page<T>` instead. */
|
|
1118
|
+
export type PaginationParams = ListParams;
|
|
1119
|
+
/** @deprecated Use `Page<T>` instead. */
|
|
1120
|
+
export interface PaginatedResponse<T> {
|
|
1121
|
+
data: T[];
|
|
1122
|
+
total: number;
|
|
1123
|
+
limit: number;
|
|
1124
|
+
offset: number;
|
|
1125
|
+
}
|
|
1126
|
+
/** @deprecated Use `Page<T>` instead. */
|
|
1127
|
+
export interface CursorPaginatedResponse<T> {
|
|
1128
|
+
data: T[];
|
|
1129
|
+
nextCursor?: string | null;
|
|
1130
|
+
next_cursor?: string | null;
|
|
1131
|
+
}
|
|
1132
|
+
/** @deprecated Use `AgledgerEvent` instead. */
|
|
1133
|
+
export type AuditEvent = AgledgerEvent;
|
|
1134
|
+
//# sourceMappingURL=types.d.ts.map
|