settld-api-sdk 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/src/index.d.ts ADDED
@@ -0,0 +1,1372 @@
1
+ export type ProtocolVersion = `${number}.${number}`;
2
+
3
+ export type SettldClientOptions = {
4
+ baseUrl: string;
5
+ tenantId: string;
6
+ protocol?: ProtocolVersion;
7
+ apiKey?: string;
8
+ xApiKey?: string;
9
+ fetch?: typeof fetch;
10
+ userAgent?: string;
11
+ };
12
+
13
+ export type RequestOptions = {
14
+ requestId?: string;
15
+ idempotencyKey?: string;
16
+ expectedPrevChainHash?: string;
17
+ signal?: AbortSignal;
18
+ };
19
+
20
+ export type SettldError = {
21
+ status: number;
22
+ code?: string | null;
23
+ message: string;
24
+ details?: unknown;
25
+ requestId?: string | null;
26
+ };
27
+
28
+ export type SettldResponse<T> = {
29
+ ok: boolean;
30
+ status: number;
31
+ requestId: string | null;
32
+ body: T;
33
+ headers: Record<string, string>;
34
+ };
35
+
36
+ export type InteractionEntityType = "agent" | "human" | "robot" | "machine";
37
+
38
+ export type AgentIdentityV1 = {
39
+ schemaVersion: "AgentIdentity.v1";
40
+ agentId: string;
41
+ tenantId: string;
42
+ displayName: string;
43
+ description?: string | null;
44
+ status: "active" | "suspended" | "revoked";
45
+ owner: { ownerType: "human" | "business" | "service"; ownerId: string };
46
+ keys: { keyId: string; algorithm: "ed25519"; publicKeyPem: string };
47
+ capabilities: string[];
48
+ walletPolicy?: {
49
+ maxPerTransactionCents?: number;
50
+ maxDailyCents?: number;
51
+ requireApprovalAboveCents?: number;
52
+ } | null;
53
+ metadata?: Record<string, unknown> | null;
54
+ revision?: number;
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ };
58
+
59
+ export type AgentRunV1 = {
60
+ schemaVersion: "AgentRun.v1";
61
+ runId: string;
62
+ agentId: string;
63
+ tenantId: string;
64
+ taskType?: string | null;
65
+ inputRef?: string | null;
66
+ status: "created" | "running" | "completed" | "failed";
67
+ evidenceRefs?: string[];
68
+ metrics?: Record<string, unknown> | null;
69
+ failure?: { code?: string | null; message?: string | null } | null;
70
+ startedAt?: string | null;
71
+ completedAt?: string | null;
72
+ failedAt?: string | null;
73
+ lastEventId?: string | null;
74
+ lastChainHash?: string | null;
75
+ revision?: number;
76
+ createdAt: string;
77
+ updatedAt: string;
78
+ };
79
+
80
+ export type AgentEventV1 = {
81
+ schemaVersion: "AgentEvent.v1";
82
+ v: 1;
83
+ id: string;
84
+ streamId: string;
85
+ type: "RUN_CREATED" | "RUN_STARTED" | "RUN_HEARTBEAT" | "EVIDENCE_ADDED" | "RUN_COMPLETED" | "RUN_FAILED";
86
+ at: string;
87
+ actor: { type: string; id: string } & Record<string, unknown>;
88
+ payload: Record<string, unknown>;
89
+ payloadHash?: string | null;
90
+ prevChainHash?: string | null;
91
+ chainHash?: string | null;
92
+ signature?: string | null;
93
+ signerKeyId?: string | null;
94
+ };
95
+
96
+ export type AgentWalletV1 = {
97
+ schemaVersion: "AgentWallet.v1";
98
+ walletId: string;
99
+ agentId: string;
100
+ tenantId: string;
101
+ currency: string;
102
+ availableCents: number;
103
+ escrowLockedCents: number;
104
+ totalDebitedCents: number;
105
+ totalCreditedCents: number;
106
+ revision: number;
107
+ createdAt: string;
108
+ updatedAt: string;
109
+ };
110
+
111
+ export type RunDisputeContextV1 = {
112
+ type: "quality" | "delivery" | "fraud" | "policy" | "payment" | "other";
113
+ priority: "low" | "normal" | "high" | "critical";
114
+ channel: "counterparty" | "policy_engine" | "arbiter" | "external";
115
+ escalationLevel: "l1_counterparty" | "l2_arbiter" | "l3_external";
116
+ openedByAgentId?: string | null;
117
+ reason?: string | null;
118
+ evidenceRefs?: string[];
119
+ };
120
+
121
+ export type RunDisputeResolutionV1 = {
122
+ outcome: "accepted" | "rejected" | "partial" | "withdrawn" | "unresolved";
123
+ escalationLevel: "l1_counterparty" | "l2_arbiter" | "l3_external";
124
+ closedByAgentId?: string | null;
125
+ summary?: string | null;
126
+ closedAt?: string | null;
127
+ evidenceRefs?: string[];
128
+ };
129
+
130
+ export type RunDisputeEvidenceSubmissionV1 = {
131
+ evidenceRef: string;
132
+ submittedAt: string;
133
+ submittedByAgentId?: string | null;
134
+ };
135
+
136
+ export type RunDisputeEscalationV1 = {
137
+ previousEscalationLevel: "l1_counterparty" | "l2_arbiter" | "l3_external";
138
+ escalationLevel: "l1_counterparty" | "l2_arbiter" | "l3_external";
139
+ channel: "counterparty" | "policy_engine" | "arbiter" | "external";
140
+ escalatedAt: string;
141
+ escalatedByAgentId?: string | null;
142
+ };
143
+
144
+ export type AgentRunSettlementV1 = {
145
+ schemaVersion: "AgentRunSettlement.v1";
146
+ settlementId: string;
147
+ runId: string;
148
+ tenantId: string;
149
+ agentId: string;
150
+ payerAgentId: string;
151
+ amountCents: number;
152
+ currency: string;
153
+ status: "locked" | "released" | "refunded";
154
+ lockedAt: string;
155
+ resolvedAt?: string | null;
156
+ resolutionEventId?: string | null;
157
+ runStatus?: string | null;
158
+ releasedAmountCents?: number;
159
+ refundedAmountCents?: number;
160
+ releaseRatePct?: number | null;
161
+ disputeWindowDays?: number;
162
+ disputeWindowEndsAt?: string | null;
163
+ disputeStatus?: "none" | "open" | "closed" | null;
164
+ disputeId?: string | null;
165
+ disputeOpenedAt?: string | null;
166
+ disputeClosedAt?: string | null;
167
+ disputeVerdictId?: string | null;
168
+ disputeVerdictHash?: string | null;
169
+ disputeVerdictArtifactId?: string | null;
170
+ disputeVerdictSignerKeyId?: string | null;
171
+ disputeVerdictIssuedAt?: string | null;
172
+ disputeContext?: RunDisputeContextV1 | null;
173
+ disputeResolution?: RunDisputeResolutionV1 | null;
174
+ decisionStatus?: "pending" | "auto_resolved" | "manual_review_required" | "manual_resolved" | null;
175
+ decisionMode?: "automatic" | "manual-review" | null;
176
+ decisionPolicyHash?: string | null;
177
+ decisionReason?: string | null;
178
+ decisionTrace?: Record<string, unknown> | null;
179
+ decisionUpdatedAt?: string | null;
180
+ revision: number;
181
+ createdAt: string;
182
+ updatedAt: string;
183
+ };
184
+
185
+ export type AgentReputationV1 = {
186
+ schemaVersion: "AgentReputation.v1";
187
+ agentId: string;
188
+ tenantId: string;
189
+ trustScore: number;
190
+ riskTier: "low" | "guarded" | "elevated" | "high";
191
+ totalRuns: number;
192
+ terminalRuns: number;
193
+ createdRuns: number;
194
+ runningRuns: number;
195
+ completedRuns: number;
196
+ failedRuns: number;
197
+ runsWithEvidence: number;
198
+ totalSettlements: number;
199
+ lockedSettlements: number;
200
+ releasedSettlements: number;
201
+ refundedSettlements: number;
202
+ runCompletionRatePct: number | null;
203
+ evidenceCoverageRatePct: number | null;
204
+ settlementReleaseRatePct: number | null;
205
+ avgRunDurationMs: number | null;
206
+ scoreBreakdown: {
207
+ runQuality: number;
208
+ settlementQuality: number;
209
+ evidenceQuality: number;
210
+ activityScore: number;
211
+ };
212
+ computedAt: string;
213
+ };
214
+
215
+ export type AgentReputationWindowV2 = {
216
+ trustScore: number;
217
+ riskTier: "low" | "guarded" | "elevated" | "high";
218
+ totalRuns: number;
219
+ terminalRuns: number;
220
+ createdRuns: number;
221
+ runningRuns: number;
222
+ completedRuns: number;
223
+ failedRuns: number;
224
+ runsWithEvidence: number;
225
+ totalSettlements: number;
226
+ lockedSettlements: number;
227
+ releasedSettlements: number;
228
+ refundedSettlements: number;
229
+ runCompletionRatePct: number | null;
230
+ evidenceCoverageRatePct: number | null;
231
+ settlementReleaseRatePct: number | null;
232
+ avgRunDurationMs: number | null;
233
+ scoreBreakdown: {
234
+ runQuality: number;
235
+ settlementQuality: number;
236
+ evidenceQuality: number;
237
+ activityScore: number;
238
+ };
239
+ computedAt: string;
240
+ };
241
+
242
+ export type AgentReputationV2 = {
243
+ schemaVersion: "AgentReputation.v2";
244
+ agentId: string;
245
+ tenantId: string;
246
+ primaryWindow: "7d" | "30d" | "allTime";
247
+ trustScore: number;
248
+ riskTier: "low" | "guarded" | "elevated" | "high";
249
+ windows: {
250
+ "7d": AgentReputationWindowV2;
251
+ "30d": AgentReputationWindowV2;
252
+ allTime: AgentReputationWindowV2;
253
+ };
254
+ computedAt: string;
255
+ };
256
+
257
+ export type AgentReputation = AgentReputationV1 | AgentReputationV2;
258
+
259
+ export type MarketplaceRfqV1 = {
260
+ schemaVersion: "MarketplaceRfq.v1";
261
+ rfqId: string;
262
+ tenantId: string;
263
+ title: string;
264
+ description?: string | null;
265
+ capability?: string | null;
266
+ fromType?: InteractionEntityType;
267
+ toType?: InteractionEntityType;
268
+ posterAgentId?: string | null;
269
+ status: "open" | "assigned" | "cancelled" | "closed";
270
+ budgetCents?: number | null;
271
+ currency: string;
272
+ deadlineAt?: string | null;
273
+ acceptedBidId?: string | null;
274
+ acceptedBidderAgentId?: string | null;
275
+ acceptedAt?: string | null;
276
+ acceptedByAgentId?: string | null;
277
+ counterOfferPolicy?: MarketplaceCounterOfferPolicyV1 | null;
278
+ runId?: string | null;
279
+ agreementId?: string | null;
280
+ agreement?: Record<string, unknown> | null;
281
+ settlementId?: string | null;
282
+ settlementStatus?: "locked" | "released" | "refunded" | null;
283
+ settlementResolvedAt?: string | null;
284
+ settlementReleaseRatePct?: number | null;
285
+ settlementDecisionStatus?: "pending" | "auto_resolved" | "manual_review_required" | "manual_resolved" | null;
286
+ settlementDecisionReason?: string | null;
287
+ metadata?: Record<string, unknown> | null;
288
+ createdAt: string;
289
+ updatedAt: string;
290
+ };
291
+
292
+ export type VerificationMethodV1 = {
293
+ schemaVersion: "VerificationMethod.v1";
294
+ mode: "deterministic" | "attested" | "discretionary";
295
+ source?: string | null;
296
+ attestor?: string | null;
297
+ notes?: string | null;
298
+ };
299
+
300
+ export type SettlementPolicyV1 = {
301
+ schemaVersion: "SettlementPolicy.v1";
302
+ policyVersion: number;
303
+ mode: "automatic" | "manual-review";
304
+ policyHash: string;
305
+ rules: {
306
+ requireDeterministicVerification: boolean;
307
+ autoReleaseOnGreen: boolean;
308
+ autoReleaseOnAmber: boolean;
309
+ autoReleaseOnRed: boolean;
310
+ greenReleaseRatePct: number;
311
+ amberReleaseRatePct: number;
312
+ redReleaseRatePct: number;
313
+ maxAutoReleaseAmountCents?: number | null;
314
+ manualReason?: string | null;
315
+ };
316
+ };
317
+
318
+ export type MarketplaceSettlementPolicyRefV1 = {
319
+ schemaVersion: "MarketplaceSettlementPolicyRef.v1";
320
+ source: "tenant_registry" | "inline";
321
+ policyId?: string | null;
322
+ policyVersion: number;
323
+ policyHash: string;
324
+ verificationMethodHash: string;
325
+ };
326
+
327
+ export type TenantSettlementPolicyV1 = {
328
+ schemaVersion: "TenantSettlementPolicy.v1";
329
+ tenantId: string;
330
+ policyId: string;
331
+ policyVersion: number;
332
+ policyHash: string;
333
+ verificationMethodHash: string;
334
+ verificationMethod: VerificationMethodV1;
335
+ policy: SettlementPolicyV1;
336
+ description?: string | null;
337
+ metadata?: Record<string, unknown> | null;
338
+ createdAt: string;
339
+ updatedAt: string;
340
+ };
341
+
342
+ export type MarketplaceAgreementMilestoneV1 = {
343
+ milestoneId: string;
344
+ label?: string | null;
345
+ releaseRatePct: number;
346
+ statusGate: "green" | "amber" | "red" | "any";
347
+ requiredEvidenceCount?: number | null;
348
+ };
349
+
350
+ export type MarketplaceAgreementCancellationV1 = {
351
+ allowCancellationBeforeStart: boolean;
352
+ killFeeRatePct: number;
353
+ requireEvidenceOnCancellation: boolean;
354
+ };
355
+
356
+ export type MarketplaceAgreementChangeOrderPolicyV1 = {
357
+ enabled: boolean;
358
+ maxChangeOrders: number;
359
+ requireCounterpartyAcceptance: boolean;
360
+ };
361
+
362
+ export type MarketplaceAgreementTermsV1 = {
363
+ title?: string | null;
364
+ capability?: string | null;
365
+ deadlineAt?: string | null;
366
+ etaSeconds?: number | null;
367
+ milestones: MarketplaceAgreementMilestoneV1[];
368
+ cancellation: MarketplaceAgreementCancellationV1;
369
+ changeOrderPolicy: MarketplaceAgreementChangeOrderPolicyV1;
370
+ changeOrders: Record<string, unknown>[];
371
+ };
372
+
373
+ export type MarketplaceAgreementTermsInput = {
374
+ milestones?: Array<{
375
+ milestoneId: string;
376
+ label?: string;
377
+ releaseRatePct: number;
378
+ statusGate?: "green" | "amber" | "red" | "any";
379
+ requiredEvidenceCount?: number;
380
+ }>;
381
+ cancellation?: {
382
+ allowCancellationBeforeStart?: boolean;
383
+ killFeeRatePct?: number;
384
+ requireEvidenceOnCancellation?: boolean;
385
+ };
386
+ changeOrderPolicy?: {
387
+ enabled?: boolean;
388
+ maxChangeOrders?: number;
389
+ requireCounterpartyAcceptance?: boolean;
390
+ };
391
+ };
392
+
393
+ export type MarketplaceCounterOfferPolicyV1 = {
394
+ schemaVersion: "MarketplaceCounterOfferPolicy.v1";
395
+ allowPosterCounterOffers: boolean;
396
+ allowBidderCounterOffers: boolean;
397
+ maxRevisions: number;
398
+ timeoutSeconds: number;
399
+ };
400
+
401
+ export type MarketplaceBidAcceptanceV1 = {
402
+ schemaVersion: "MarketplaceBidAcceptance.v1";
403
+ acceptedAt: string;
404
+ acceptedByAgentId?: string | null;
405
+ acceptedProposalId?: string | null;
406
+ acceptedRevision?: number | null;
407
+ };
408
+
409
+ export type MarketplaceAgreementAcceptanceV1 = {
410
+ schemaVersion: "MarketplaceAgreementAcceptance.v1";
411
+ acceptedAt?: string | null;
412
+ acceptedByAgentId?: string | null;
413
+ acceptedProposalId?: string | null;
414
+ acceptedRevision?: number | null;
415
+ acceptedProposalHash?: string | null;
416
+ offerChainHash?: string | null;
417
+ proposalCount: number;
418
+ };
419
+
420
+ export type AgentDelegationLinkV1 = {
421
+ schemaVersion: "AgentDelegationLink.v1";
422
+ delegationId: string;
423
+ tenantId: string;
424
+ principalAgentId: string;
425
+ delegateAgentId: string;
426
+ scope?: string | null;
427
+ issuedAt: string;
428
+ expiresAt?: string | null;
429
+ signerKeyId: string;
430
+ delegationHash: string;
431
+ signature: string;
432
+ };
433
+
434
+ export type AgentActingOnBehalfOfV1 = {
435
+ schemaVersion: "AgentActingOnBehalfOf.v1";
436
+ principalAgentId: string;
437
+ delegateAgentId?: string | null;
438
+ delegationChain: AgentDelegationLinkV1[];
439
+ chainHash?: string | null;
440
+ };
441
+
442
+ export type MarketplaceAgreementAcceptanceSignatureV2 = {
443
+ schemaVersion: "MarketplaceAgreementAcceptanceSignature.v2";
444
+ agreementId: string;
445
+ tenantId: string;
446
+ rfqId: string;
447
+ runId: string;
448
+ bidId: string;
449
+ acceptedByAgentId: string;
450
+ acceptedProposalId?: string | null;
451
+ acceptedRevision?: number | null;
452
+ acceptedProposalHash?: string | null;
453
+ offerChainHash?: string | null;
454
+ proposalCount?: number | null;
455
+ actingOnBehalfOfPrincipalAgentId?: string | null;
456
+ actingOnBehalfOfDelegateAgentId?: string | null;
457
+ actingOnBehalfOfChainHash?: string | null;
458
+ signerAgentId: string;
459
+ signerKeyId: string;
460
+ signedAt: string;
461
+ actingOnBehalfOf?: AgentActingOnBehalfOfV1 | null;
462
+ acceptanceHash: string;
463
+ signature: string;
464
+ };
465
+
466
+ export type MarketplaceAgreementAcceptanceSignatureInput = {
467
+ signerAgentId?: string;
468
+ signerKeyId: string;
469
+ signedAt?: string;
470
+ actingOnBehalfOf?: AgentActingOnBehalfOfV1;
471
+ signature: string;
472
+ };
473
+
474
+ export type MarketplaceAgreementChangeOrderAcceptanceSignatureV2 = {
475
+ schemaVersion: "MarketplaceAgreementChangeOrderAcceptanceSignature.v2";
476
+ tenantId: string;
477
+ runId: string;
478
+ agreementId: string;
479
+ rfqId: string;
480
+ bidId: string;
481
+ changeOrderId: string;
482
+ requestedByAgentId: string;
483
+ acceptedByAgentId: string;
484
+ reason: string;
485
+ note?: string | null;
486
+ previousTermsHash?: string | null;
487
+ milestonesHash: string;
488
+ cancellationHash: string;
489
+ actingOnBehalfOfPrincipalAgentId?: string | null;
490
+ actingOnBehalfOfDelegateAgentId?: string | null;
491
+ actingOnBehalfOfChainHash?: string | null;
492
+ signerAgentId: string;
493
+ signerKeyId: string;
494
+ signedAt: string;
495
+ actingOnBehalfOf?: AgentActingOnBehalfOfV1 | null;
496
+ acceptanceHash: string;
497
+ signature: string;
498
+ };
499
+
500
+ export type MarketplaceAgreementCancellationAcceptanceSignatureV2 = {
501
+ schemaVersion: "MarketplaceAgreementCancellationAcceptanceSignature.v2";
502
+ tenantId: string;
503
+ runId: string;
504
+ agreementId: string;
505
+ rfqId: string;
506
+ bidId: string;
507
+ cancellationId: string;
508
+ cancelledByAgentId: string;
509
+ acceptedByAgentId: string;
510
+ reason: string;
511
+ evidenceRef?: string | null;
512
+ termsHash: string;
513
+ killFeeRatePct: number;
514
+ actingOnBehalfOfPrincipalAgentId?: string | null;
515
+ actingOnBehalfOfDelegateAgentId?: string | null;
516
+ actingOnBehalfOfChainHash?: string | null;
517
+ signerAgentId: string;
518
+ signerKeyId: string;
519
+ signedAt: string;
520
+ actingOnBehalfOf?: AgentActingOnBehalfOfV1 | null;
521
+ acceptanceHash: string;
522
+ signature: string;
523
+ };
524
+
525
+ export type MarketplaceAgreementPolicyBindingV2 = {
526
+ schemaVersion: "MarketplaceAgreementPolicyBinding.v2";
527
+ agreementId: string;
528
+ tenantId: string;
529
+ rfqId: string;
530
+ runId: string;
531
+ bidId: string;
532
+ acceptedAt?: string | null;
533
+ acceptedByAgentId?: string | null;
534
+ offerChainHash?: string | null;
535
+ acceptedProposalId?: string | null;
536
+ acceptedRevision?: number | null;
537
+ acceptedProposalHash?: string | null;
538
+ termsHash: string;
539
+ policyHash: string;
540
+ verificationMethodHash: string;
541
+ policyRefHash: string;
542
+ policyRef: MarketplaceSettlementPolicyRefV1;
543
+ signerKeyId: string;
544
+ signedAt: string;
545
+ bindingHash: string;
546
+ signature: string;
547
+ };
548
+
549
+ export type MarketplaceBidNegotiationProposalV1 = {
550
+ schemaVersion: "MarketplaceBidProposal.v1";
551
+ proposalId: string;
552
+ bidId: string;
553
+ revision: number;
554
+ proposerAgentId: string;
555
+ amountCents: number;
556
+ currency: string;
557
+ etaSeconds?: number | null;
558
+ note?: string | null;
559
+ verificationMethod: VerificationMethodV1;
560
+ policy: SettlementPolicyV1;
561
+ policyRef: MarketplaceSettlementPolicyRefV1;
562
+ policyRefHash: string;
563
+ prevProposalHash?: string | null;
564
+ proposalHash: string;
565
+ metadata?: Record<string, unknown> | null;
566
+ proposedAt: string;
567
+ };
568
+
569
+ export type MarketplaceBidNegotiationV1 = {
570
+ schemaVersion: "MarketplaceBidNegotiation.v1";
571
+ bidId: string;
572
+ state: "open" | "accepted" | "rejected" | "cancelled" | "expired";
573
+ latestRevision: number;
574
+ acceptedRevision?: number | null;
575
+ acceptedProposalId?: string | null;
576
+ acceptedAt?: string | null;
577
+ acceptance?: MarketplaceBidAcceptanceV1 | null;
578
+ counterOfferPolicy: MarketplaceCounterOfferPolicyV1;
579
+ expiresAt?: string | null;
580
+ expiredAt?: string | null;
581
+ createdAt: string;
582
+ updatedAt: string;
583
+ proposals: MarketplaceBidNegotiationProposalV1[];
584
+ };
585
+
586
+ export type MarketplaceAgreementNegotiationV1 = {
587
+ schemaVersion: "MarketplaceAgreementNegotiation.v1";
588
+ state: "open" | "accepted" | "rejected" | "cancelled" | "expired";
589
+ latestRevision: number;
590
+ acceptedRevision?: number | null;
591
+ acceptedProposalId?: string | null;
592
+ proposalCount: number;
593
+ };
594
+
595
+ export type MarketplaceTaskAgreementV2 = {
596
+ schemaVersion: "MarketplaceTaskAgreement.v2";
597
+ agreementId: string;
598
+ tenantId: string;
599
+ rfqId: string;
600
+ runId: string;
601
+ bidId: string;
602
+ payerAgentId: string;
603
+ payeeAgentId: string;
604
+ fromType: InteractionEntityType;
605
+ toType: InteractionEntityType;
606
+ amountCents: number;
607
+ currency: string;
608
+ acceptedAt: string;
609
+ acceptedByAgentId?: string | null;
610
+ disputeWindowDays: number;
611
+ agreementRevision?: number | null;
612
+ updatedAt?: string | null;
613
+ offerChainHash?: string | null;
614
+ acceptedProposalId?: string | null;
615
+ acceptedRevision?: number | null;
616
+ acceptedProposalHash?: string | null;
617
+ negotiation?: MarketplaceAgreementNegotiationV1 | null;
618
+ acceptance?: MarketplaceAgreementAcceptanceV1 | null;
619
+ acceptanceSignature?: MarketplaceAgreementAcceptanceSignatureV2 | null;
620
+ termsHash: string;
621
+ verificationMethodHash: string;
622
+ policyHash: string;
623
+ policyRef: MarketplaceSettlementPolicyRefV1;
624
+ policyBinding?: MarketplaceAgreementPolicyBindingV2 | null;
625
+ verificationMethod?: VerificationMethodV1;
626
+ policy?: SettlementPolicyV1;
627
+ terms?: MarketplaceAgreementTermsV1;
628
+ };
629
+
630
+ export type MarketplaceBidV1 = {
631
+ schemaVersion: "MarketplaceBid.v1";
632
+ bidId: string;
633
+ rfqId: string;
634
+ tenantId: string;
635
+ fromType?: InteractionEntityType;
636
+ toType?: InteractionEntityType;
637
+ bidderAgentId: string;
638
+ amountCents: number;
639
+ currency: string;
640
+ etaSeconds?: number | null;
641
+ note?: string | null;
642
+ verificationMethod?: VerificationMethodV1;
643
+ policy?: SettlementPolicyV1;
644
+ policyRef?: MarketplaceSettlementPolicyRefV1 | null;
645
+ status: "pending" | "accepted" | "rejected";
646
+ acceptedAt?: string | null;
647
+ rejectedAt?: string | null;
648
+ negotiation?: MarketplaceBidNegotiationV1 | null;
649
+ counterOfferPolicy?: MarketplaceCounterOfferPolicyV1 | null;
650
+ metadata?: Record<string, unknown> | null;
651
+ createdAt: string;
652
+ updatedAt: string;
653
+ };
654
+
655
+ export type MarketplaceRfqBidV1 = MarketplaceBidV1;
656
+
657
+ export type AgentRegistrationInput = {
658
+ publicKeyPem: string;
659
+ agentId?: string;
660
+ displayName?: string;
661
+ description?: string;
662
+ status?: "active" | "suspended" | "revoked";
663
+ ownerType?: "human" | "business" | "service";
664
+ ownerId?: string;
665
+ owner?: { ownerType?: "human" | "business" | "service"; ownerId?: string };
666
+ capabilities?: string[];
667
+ walletPolicy?: { maxPerTransactionCents?: number; maxDailyCents?: number; requireApprovalAboveCents?: number };
668
+ metadata?: Record<string, unknown>;
669
+ };
670
+
671
+ export type FirstVerifiedRunParams = {
672
+ payeeAgent: AgentRegistrationInput;
673
+ payerAgent?: AgentRegistrationInput;
674
+ payerCredit?: { amountCents: number; currency?: string };
675
+ run?: {
676
+ runId?: string;
677
+ taskType?: string;
678
+ inputRef?: string;
679
+ settlement?: { payerAgentId: string; amountCents: number; currency?: string };
680
+ };
681
+ settlement?: { payerAgentId?: string; amountCents: number; currency?: string };
682
+ actor?: Record<string, unknown>;
683
+ startedPayload?: Record<string, unknown>;
684
+ evidenceRef?: string;
685
+ evidencePayload?: Record<string, unknown>;
686
+ outputRef?: string;
687
+ completedPayload?: Record<string, unknown>;
688
+ completedMetrics?: Record<string, unknown>;
689
+ };
690
+
691
+ export type FirstVerifiedRunOptions = {
692
+ signal?: AbortSignal;
693
+ idempotencyPrefix?: string;
694
+ requestIdPrefix?: string;
695
+ };
696
+
697
+ export type FirstVerifiedRunResult = {
698
+ ids: { runId: string; payeeAgentId: string; payerAgentId: string | null };
699
+ payeeRegistration: SettldResponse<{ agentIdentity: AgentIdentityV1; keyId: string }>;
700
+ payerRegistration: SettldResponse<{ agentIdentity: AgentIdentityV1; keyId: string }> | null;
701
+ payerCredit: SettldResponse<{ wallet: AgentWalletV1 }> | null;
702
+ runCreated: SettldResponse<{ run: AgentRunV1; event: AgentEventV1; settlement?: AgentRunSettlementV1 | null }>;
703
+ runStarted: SettldResponse<{ event: AgentEventV1; run: AgentRunV1; settlement?: AgentRunSettlementV1 | null }>;
704
+ runEvidenceAdded: SettldResponse<{ event: AgentEventV1; run: AgentRunV1; settlement?: AgentRunSettlementV1 | null }>;
705
+ runCompleted: SettldResponse<{ event: AgentEventV1; run: AgentRunV1; settlement?: AgentRunSettlementV1 | null }>;
706
+ run: SettldResponse<{ run: AgentRunV1; verification: Record<string, unknown>; settlement?: AgentRunSettlementV1 | null }>;
707
+ verification: SettldResponse<Record<string, unknown>>;
708
+ settlement: SettldResponse<{ settlement: AgentRunSettlementV1 }> | null;
709
+ };
710
+
711
+ export type TenantAnalyticsQuery = {
712
+ month?: string;
713
+ bucket?: "day" | "week" | "month";
714
+ limit?: number;
715
+ };
716
+
717
+ export type TenantTrustGraphQuery = {
718
+ month?: string;
719
+ minRuns?: number;
720
+ maxEdges?: number;
721
+ };
722
+
723
+ export type TenantTrustGraphSnapshotCreateInput = {
724
+ month?: string;
725
+ minRuns?: number;
726
+ maxEdges?: number;
727
+ };
728
+
729
+ export type TenantTrustGraphDiffQuery = {
730
+ baseMonth?: string;
731
+ compareMonth?: string;
732
+ limit?: number;
733
+ minRuns?: number;
734
+ maxEdges?: number;
735
+ includeUnchanged?: boolean;
736
+ };
737
+
738
+ export class SettldClient {
739
+ constructor(opts: SettldClientOptions);
740
+
741
+ capabilities(opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
742
+ openApi(opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
743
+
744
+ createJob(body: { templateId: string } & Record<string, unknown>, opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
745
+ getJob(jobId: string, opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
746
+ registerAgent(
747
+ body: AgentRegistrationInput,
748
+ opts?: RequestOptions
749
+ ): Promise<SettldResponse<{ agentIdentity: AgentIdentityV1; keyId: string }>>;
750
+ listAgents(
751
+ params?: {
752
+ status?: "active" | "suspended" | "revoked";
753
+ capability?: string;
754
+ minTrustScore?: number;
755
+ includeReputation?: boolean;
756
+ reputationVersion?: "v1" | "v2";
757
+ reputationWindow?: "7d" | "30d" | "allTime";
758
+ limit?: number;
759
+ offset?: number;
760
+ },
761
+ opts?: RequestOptions
762
+ ): Promise<SettldResponse<{ agents: AgentIdentityV1[]; reputations?: Record<string, AgentReputation>; limit: number; offset: number }>>;
763
+ getAgent(agentId: string, opts?: RequestOptions): Promise<SettldResponse<{ agentIdentity: AgentIdentityV1 }>>;
764
+ getAgentReputation(
765
+ agentId: string,
766
+ opts?: RequestOptions & { reputationVersion?: "v1" | "v2"; reputationWindow?: "7d" | "30d" | "allTime" }
767
+ ): Promise<SettldResponse<{ reputation: AgentReputation }>>;
768
+ searchMarketplaceAgents(
769
+ params?: {
770
+ status?: "active" | "suspended" | "revoked" | "all";
771
+ capability?: string;
772
+ minTrustScore?: number;
773
+ riskTier?: "low" | "guarded" | "elevated" | "high";
774
+ includeReputation?: boolean;
775
+ reputationVersion?: "v1" | "v2";
776
+ reputationWindow?: "7d" | "30d" | "allTime";
777
+ scoreStrategy?: "balanced" | "recent_bias";
778
+ limit?: number;
779
+ offset?: number;
780
+ },
781
+ opts?: RequestOptions
782
+ ): Promise<
783
+ SettldResponse<{
784
+ reputationVersion: "v1" | "v2";
785
+ reputationWindow: "7d" | "30d" | "allTime";
786
+ scoreStrategy: "balanced" | "recent_bias";
787
+ total: number;
788
+ limit: number;
789
+ offset: number;
790
+ results: Array<{
791
+ rank: number;
792
+ rankingScore: number;
793
+ riskTier: "low" | "guarded" | "elevated" | "high";
794
+ agentIdentity: AgentIdentityV1;
795
+ reputation?: AgentReputation;
796
+ }>;
797
+ }>
798
+ >;
799
+ upsertMarketplaceSettlementPolicy(
800
+ body: {
801
+ policyId: string;
802
+ policyVersion?: number;
803
+ verificationMethod?: {
804
+ verificationMethodHash?: string;
805
+ mode?: "deterministic" | "attested" | "discretionary";
806
+ source?: string;
807
+ attestor?: string;
808
+ notes?: string;
809
+ };
810
+ policy: {
811
+ policyHash?: string;
812
+ policyVersion?: number;
813
+ mode?: "automatic" | "manual-review";
814
+ rules?: {
815
+ requireDeterministicVerification?: boolean;
816
+ autoReleaseOnGreen?: boolean;
817
+ autoReleaseOnAmber?: boolean;
818
+ autoReleaseOnRed?: boolean;
819
+ greenReleaseRatePct?: number;
820
+ amberReleaseRatePct?: number;
821
+ redReleaseRatePct?: number;
822
+ maxAutoReleaseAmountCents?: number;
823
+ manualReason?: string;
824
+ };
825
+ };
826
+ description?: string;
827
+ metadata?: Record<string, unknown>;
828
+ },
829
+ opts?: RequestOptions
830
+ ): Promise<SettldResponse<{ policy: TenantSettlementPolicyV1 }>>;
831
+ listMarketplaceSettlementPolicies(
832
+ params?: { policyId?: string; limit?: number; offset?: number },
833
+ opts?: RequestOptions
834
+ ): Promise<SettldResponse<{ policies: TenantSettlementPolicyV1[]; total: number; limit: number; offset: number }>>;
835
+ getMarketplaceSettlementPolicy(
836
+ policyId: string,
837
+ policyVersion: number,
838
+ opts?: RequestOptions
839
+ ): Promise<SettldResponse<{ policy: TenantSettlementPolicyV1 }>>;
840
+ createMarketplaceRfq(
841
+ body: {
842
+ rfqId?: string;
843
+ title?: string;
844
+ description?: string;
845
+ capability?: string;
846
+ fromType?: InteractionEntityType;
847
+ toType?: InteractionEntityType;
848
+ posterAgentId?: string;
849
+ budgetCents?: number;
850
+ currency?: string;
851
+ deadlineAt?: string;
852
+ counterOfferPolicy?: {
853
+ allowPosterCounterOffers?: boolean;
854
+ allowBidderCounterOffers?: boolean;
855
+ maxRevisions?: number;
856
+ timeoutSeconds?: number;
857
+ };
858
+ metadata?: Record<string, unknown>;
859
+ },
860
+ opts?: RequestOptions
861
+ ): Promise<SettldResponse<{ rfq: MarketplaceRfqV1 }>>;
862
+ listMarketplaceRfqs(
863
+ params?: {
864
+ status?: "open" | "assigned" | "cancelled" | "closed" | "all";
865
+ capability?: string;
866
+ posterAgentId?: string;
867
+ limit?: number;
868
+ offset?: number;
869
+ },
870
+ opts?: RequestOptions
871
+ ): Promise<SettldResponse<{ rfqs: MarketplaceRfqV1[]; total: number; limit: number; offset: number }>>;
872
+ submitMarketplaceBid(
873
+ rfqId: string,
874
+ body: {
875
+ bidId?: string;
876
+ proposalId?: string;
877
+ fromType?: InteractionEntityType;
878
+ toType?: InteractionEntityType;
879
+ bidderAgentId: string;
880
+ amountCents: number;
881
+ currency?: string;
882
+ etaSeconds?: number;
883
+ note?: string;
884
+ verificationMethod?: {
885
+ verificationMethodHash?: string;
886
+ mode?: "deterministic" | "attested" | "discretionary";
887
+ source?: string;
888
+ attestor?: string;
889
+ notes?: string;
890
+ };
891
+ policy?: {
892
+ policyHash?: string;
893
+ policyVersion?: number;
894
+ mode?: "automatic" | "manual-review";
895
+ rules?: {
896
+ requireDeterministicVerification?: boolean;
897
+ autoReleaseOnGreen?: boolean;
898
+ autoReleaseOnAmber?: boolean;
899
+ autoReleaseOnRed?: boolean;
900
+ greenReleaseRatePct?: number;
901
+ amberReleaseRatePct?: number;
902
+ redReleaseRatePct?: number;
903
+ maxAutoReleaseAmountCents?: number;
904
+ manualReason?: string;
905
+ };
906
+ };
907
+ policyRef?: {
908
+ source?: "tenant_registry" | "inline";
909
+ policyId?: string;
910
+ policyVersion?: number;
911
+ policyHash?: string;
912
+ verificationMethodHash?: string;
913
+ };
914
+ metadata?: Record<string, unknown>;
915
+ },
916
+ opts?: RequestOptions
917
+ ): Promise<SettldResponse<{ rfq: MarketplaceRfqV1; bid: MarketplaceRfqBidV1 }>>;
918
+ listMarketplaceBids(
919
+ rfqId: string,
920
+ params?: {
921
+ status?: "pending" | "accepted" | "rejected" | "all";
922
+ bidderAgentId?: string;
923
+ limit?: number;
924
+ offset?: number;
925
+ },
926
+ opts?: RequestOptions
927
+ ): Promise<SettldResponse<{ rfqId: string; bids: MarketplaceRfqBidV1[]; total: number; limit: number; offset: number }>>;
928
+ applyMarketplaceBidCounterOffer(
929
+ rfqId: string,
930
+ bidId: string,
931
+ body: {
932
+ proposalId?: string;
933
+ proposerAgentId: string;
934
+ amountCents?: number;
935
+ currency?: string;
936
+ etaSeconds?: number | null;
937
+ note?: string | null;
938
+ verificationMethod?: {
939
+ verificationMethodHash?: string;
940
+ mode?: "deterministic" | "attested" | "discretionary";
941
+ source?: string;
942
+ attestor?: string;
943
+ notes?: string;
944
+ };
945
+ policy?: {
946
+ policyHash?: string;
947
+ policyVersion?: number;
948
+ mode?: "automatic" | "manual-review";
949
+ rules?: {
950
+ requireDeterministicVerification?: boolean;
951
+ autoReleaseOnGreen?: boolean;
952
+ autoReleaseOnAmber?: boolean;
953
+ autoReleaseOnRed?: boolean;
954
+ greenReleaseRatePct?: number;
955
+ amberReleaseRatePct?: number;
956
+ redReleaseRatePct?: number;
957
+ maxAutoReleaseAmountCents?: number;
958
+ manualReason?: string;
959
+ };
960
+ };
961
+ policyRef?: {
962
+ source?: "tenant_registry" | "inline";
963
+ policyId?: string;
964
+ policyVersion?: number;
965
+ policyHash?: string;
966
+ verificationMethodHash?: string;
967
+ };
968
+ metadata?: Record<string, unknown> | null;
969
+ },
970
+ opts?: RequestOptions
971
+ ): Promise<
972
+ SettldResponse<{
973
+ rfq: MarketplaceRfqV1;
974
+ bid: MarketplaceRfqBidV1;
975
+ negotiation: MarketplaceBidNegotiationV1;
976
+ proposal: MarketplaceBidNegotiationProposalV1;
977
+ }>
978
+ >;
979
+ acceptMarketplaceBid(
980
+ rfqId: string,
981
+ body: {
982
+ bidId: string;
983
+ acceptedByAgentId?: string;
984
+ runId?: string;
985
+ taskType?: string;
986
+ inputRef?: string;
987
+ payerAgentId?: string;
988
+ fromType?: InteractionEntityType;
989
+ toType?: InteractionEntityType;
990
+ disputeWindowDays?: number;
991
+ acceptanceSignature?: MarketplaceAgreementAcceptanceSignatureInput;
992
+ agreementTerms?: MarketplaceAgreementTermsInput;
993
+ verificationMethod?: {
994
+ verificationMethodHash?: string;
995
+ mode?: "deterministic" | "attested" | "discretionary";
996
+ source?: string;
997
+ attestor?: string;
998
+ notes?: string;
999
+ };
1000
+ policy?: {
1001
+ policyHash?: string;
1002
+ policyVersion?: number;
1003
+ mode?: "automatic" | "manual-review";
1004
+ rules?: {
1005
+ requireDeterministicVerification?: boolean;
1006
+ autoReleaseOnGreen?: boolean;
1007
+ autoReleaseOnAmber?: boolean;
1008
+ autoReleaseOnRed?: boolean;
1009
+ greenReleaseRatePct?: number;
1010
+ amberReleaseRatePct?: number;
1011
+ redReleaseRatePct?: number;
1012
+ maxAutoReleaseAmountCents?: number;
1013
+ manualReason?: string;
1014
+ };
1015
+ };
1016
+ policyRef?: {
1017
+ source?: "tenant_registry" | "inline";
1018
+ policyId?: string;
1019
+ policyVersion?: number;
1020
+ policyHash?: string;
1021
+ verificationMethodHash?: string;
1022
+ };
1023
+ settlement?: {
1024
+ payerAgentId?: string;
1025
+ fromType?: InteractionEntityType;
1026
+ toType?: InteractionEntityType;
1027
+ amountCents?: number;
1028
+ currency?: string;
1029
+ disputeWindowDays?: number;
1030
+ agreementTerms?: MarketplaceAgreementTermsInput;
1031
+ verificationMethod?: {
1032
+ verificationMethodHash?: string;
1033
+ mode?: "deterministic" | "attested" | "discretionary";
1034
+ source?: string;
1035
+ attestor?: string;
1036
+ notes?: string;
1037
+ };
1038
+ policy?: {
1039
+ policyHash?: string;
1040
+ policyVersion?: number;
1041
+ mode?: "automatic" | "manual-review";
1042
+ rules?: {
1043
+ requireDeterministicVerification?: boolean;
1044
+ autoReleaseOnGreen?: boolean;
1045
+ autoReleaseOnAmber?: boolean;
1046
+ autoReleaseOnRed?: boolean;
1047
+ greenReleaseRatePct?: number;
1048
+ amberReleaseRatePct?: number;
1049
+ redReleaseRatePct?: number;
1050
+ maxAutoReleaseAmountCents?: number;
1051
+ manualReason?: string;
1052
+ };
1053
+ };
1054
+ policyRef?: {
1055
+ source?: "tenant_registry" | "inline";
1056
+ policyId?: string;
1057
+ policyVersion?: number;
1058
+ policyHash?: string;
1059
+ verificationMethodHash?: string;
1060
+ };
1061
+ };
1062
+ },
1063
+ opts?: RequestOptions
1064
+ ): Promise<
1065
+ SettldResponse<{
1066
+ rfq: MarketplaceRfqV1;
1067
+ acceptedBid: MarketplaceRfqBidV1 | null;
1068
+ run: AgentRunV1;
1069
+ settlement: AgentRunSettlementV1;
1070
+ agreement: MarketplaceTaskAgreementV2;
1071
+ }>
1072
+ >;
1073
+ getAgentWallet(agentId: string, opts?: RequestOptions): Promise<SettldResponse<{ wallet: AgentWalletV1 }>>;
1074
+ creditAgentWallet(
1075
+ agentId: string,
1076
+ body: { amountCents: number; currency?: string },
1077
+ opts?: RequestOptions
1078
+ ): Promise<SettldResponse<{ wallet: AgentWalletV1 }>>;
1079
+ createAgentRun(
1080
+ agentId: string,
1081
+ body?: {
1082
+ runId?: string;
1083
+ taskType?: string;
1084
+ inputRef?: string;
1085
+ settlement?: { payerAgentId: string; amountCents: number; currency?: string };
1086
+ },
1087
+ opts?: RequestOptions
1088
+ ): Promise<SettldResponse<{ run: AgentRunV1; event: AgentEventV1; settlement?: AgentRunSettlementV1 | null }>>;
1089
+ listAgentRuns(
1090
+ agentId: string,
1091
+ params?: { status?: "created" | "running" | "completed" | "failed"; limit?: number; offset?: number },
1092
+ opts?: RequestOptions
1093
+ ): Promise<SettldResponse<{ runs: AgentRunV1[]; total: number; limit: number; offset: number }>>;
1094
+ getAgentRun(
1095
+ agentId: string,
1096
+ runId: string,
1097
+ opts?: RequestOptions
1098
+ ): Promise<SettldResponse<{ run: AgentRunV1; verification: Record<string, unknown>; settlement?: AgentRunSettlementV1 | null }>>;
1099
+ listAgentRunEvents(agentId: string, runId: string, opts?: RequestOptions): Promise<SettldResponse<{ events: AgentEventV1[] }>>;
1100
+ appendAgentRunEvent(
1101
+ agentId: string,
1102
+ runId: string,
1103
+ body: {
1104
+ type: "RUN_STARTED" | "RUN_HEARTBEAT" | "EVIDENCE_ADDED" | "RUN_COMPLETED" | "RUN_FAILED";
1105
+ at?: string;
1106
+ actor?: Record<string, unknown>;
1107
+ payload: Record<string, unknown>;
1108
+ },
1109
+ opts: RequestOptions
1110
+ ): Promise<SettldResponse<{ event: AgentEventV1; run: AgentRunV1; settlement?: AgentRunSettlementV1 | null }>>;
1111
+ getRunVerification(runId: string, opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1112
+ getRunSettlement(runId: string, opts?: RequestOptions): Promise<SettldResponse<{ settlement: AgentRunSettlementV1 }>>;
1113
+ getRunAgreement(
1114
+ runId: string,
1115
+ opts?: RequestOptions
1116
+ ): Promise<
1117
+ SettldResponse<{
1118
+ runId: string;
1119
+ rfqId?: string | null;
1120
+ agreementId?: string | null;
1121
+ agreement: MarketplaceTaskAgreementV2;
1122
+ policyRef?: MarketplaceSettlementPolicyRefV1 | null;
1123
+ policyHash?: string | null;
1124
+ verificationMethodHash?: string | null;
1125
+ policyBindingVerification: Record<string, unknown>;
1126
+ acceptanceSignatureVerification: Record<string, unknown>;
1127
+ }>
1128
+ >;
1129
+ applyRunAgreementChangeOrder(
1130
+ runId: string,
1131
+ body: {
1132
+ changeOrderId?: string;
1133
+ requestedByAgentId: string;
1134
+ acceptedByAgentId?: string;
1135
+ acceptanceSignature?: MarketplaceAgreementAcceptanceSignatureInput;
1136
+ reason: string;
1137
+ note?: string;
1138
+ milestones?: MarketplaceAgreementTermsInput["milestones"];
1139
+ cancellation?: MarketplaceAgreementTermsInput["cancellation"];
1140
+ },
1141
+ opts?: RequestOptions
1142
+ ): Promise<
1143
+ SettldResponse<{
1144
+ runId: string;
1145
+ rfq: MarketplaceRfqV1;
1146
+ agreement: MarketplaceTaskAgreementV2;
1147
+ changeOrder: Record<string, unknown>;
1148
+ acceptanceSignatureVerification: Record<string, unknown>;
1149
+ }>
1150
+ >;
1151
+ cancelRunAgreement(
1152
+ runId: string,
1153
+ body: {
1154
+ cancellationId?: string;
1155
+ cancelledByAgentId: string;
1156
+ acceptedByAgentId?: string;
1157
+ acceptanceSignature?: MarketplaceAgreementAcceptanceSignatureInput;
1158
+ reason: string;
1159
+ evidenceRef?: string;
1160
+ },
1161
+ opts?: RequestOptions
1162
+ ): Promise<
1163
+ SettldResponse<{
1164
+ runId: string;
1165
+ rfq: MarketplaceRfqV1;
1166
+ run: AgentRunV1;
1167
+ settlement: AgentRunSettlementV1;
1168
+ agreement: MarketplaceTaskAgreementV2 | null;
1169
+ cancellation: Record<string, unknown>;
1170
+ acceptanceSignatureVerification: Record<string, unknown>;
1171
+ }>
1172
+ >;
1173
+ getRunSettlementPolicyReplay(
1174
+ runId: string,
1175
+ opts?: RequestOptions
1176
+ ): Promise<
1177
+ SettldResponse<{
1178
+ runId: string;
1179
+ agreementId?: string | null;
1180
+ policyVersion?: number | null;
1181
+ policyHash?: string | null;
1182
+ verificationMethodHash?: string | null;
1183
+ policyRef?: MarketplaceSettlementPolicyRefV1 | null;
1184
+ policyBinding?: MarketplaceAgreementPolicyBindingV2 | null;
1185
+ policyBindingVerification: Record<string, unknown>;
1186
+ acceptanceSignatureVerification: Record<string, unknown>;
1187
+ runStatus?: string | null;
1188
+ verificationStatus: "green" | "amber" | "red";
1189
+ replay: Record<string, unknown>;
1190
+ settlement: AgentRunSettlementV1;
1191
+ matchesStoredDecision: boolean;
1192
+ }>
1193
+ >;
1194
+ resolveRunSettlement(
1195
+ runId: string,
1196
+ body: {
1197
+ status: "released" | "refunded";
1198
+ releaseRatePct?: number;
1199
+ releasedAmountCents?: number;
1200
+ refundedAmountCents?: number;
1201
+ reason?: string;
1202
+ resolvedByAgentId?: string;
1203
+ resolutionEventId?: string;
1204
+ },
1205
+ opts?: RequestOptions
1206
+ ): Promise<SettldResponse<{ settlement: AgentRunSettlementV1 }>>;
1207
+
1208
+ opsLockToolCallHold(body: Record<string, unknown>, opts?: RequestOptions): Promise<SettldResponse<{ hold: Record<string, unknown> }>>;
1209
+ opsListToolCallHolds(
1210
+ params?: { agreementHash?: string; status?: string; limit?: number; offset?: number },
1211
+ opts?: RequestOptions
1212
+ ): Promise<
1213
+ SettldResponse<{
1214
+ ok: boolean;
1215
+ tenantId: string;
1216
+ agreementHash: string | null;
1217
+ status: string | null;
1218
+ limit: number;
1219
+ offset: number;
1220
+ holds: Array<Record<string, unknown>>;
1221
+ }>
1222
+ >;
1223
+ opsGetToolCallHold(holdHash: string, opts?: RequestOptions): Promise<SettldResponse<{ ok: boolean; tenantId: string; hold: Record<string, unknown> }>>;
1224
+ opsRunToolCallHoldbackMaintenance(
1225
+ body?: { dryRun?: boolean; limit?: number; maxHolds?: number } & Record<string, unknown>,
1226
+ opts?: RequestOptions
1227
+ ): Promise<SettldResponse<Record<string, unknown>>>;
1228
+ toolCallListArbitrationCases(
1229
+ params?: { agreementHash?: string; status?: string },
1230
+ opts?: RequestOptions
1231
+ ): Promise<
1232
+ SettldResponse<{
1233
+ agreementHash: string;
1234
+ runId: string;
1235
+ cases: Array<Record<string, unknown>>;
1236
+ }>
1237
+ >;
1238
+ toolCallGetArbitrationCase(caseId: string, opts?: RequestOptions): Promise<SettldResponse<{ caseId: string; arbitrationCase: Record<string, unknown> }>>;
1239
+ toolCallOpenArbitration(body: Record<string, unknown>, opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1240
+ toolCallSubmitArbitrationVerdict(body: Record<string, unknown>, opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1241
+ opsGetSettlementAdjustment(adjustmentId: string, opts?: RequestOptions): Promise<SettldResponse<{ ok: boolean; tenantId: string; adjustment: Record<string, unknown> }>>;
1242
+
1243
+ openRunDispute(
1244
+ runId: string,
1245
+ body?: {
1246
+ disputeId?: string;
1247
+ disputeType?: "quality" | "delivery" | "fraud" | "policy" | "payment" | "other";
1248
+ disputePriority?: "low" | "normal" | "high" | "critical";
1249
+ disputeChannel?: "counterparty" | "policy_engine" | "arbiter" | "external";
1250
+ escalationLevel?: "l1_counterparty" | "l2_arbiter" | "l3_external";
1251
+ openedByAgentId?: string;
1252
+ reason?: string;
1253
+ evidenceRefs?: string[];
1254
+ },
1255
+ opts?: RequestOptions
1256
+ ): Promise<
1257
+ SettldResponse<{
1258
+ settlement: AgentRunSettlementV1;
1259
+ disputeEvidence?: RunDisputeEvidenceSubmissionV1 | null;
1260
+ disputeEscalation?: RunDisputeEscalationV1 | null;
1261
+ verdict?: Record<string, unknown> | null;
1262
+ verdictArtifact?: Record<string, unknown> | null;
1263
+ }>
1264
+ >;
1265
+ closeRunDispute(
1266
+ runId: string,
1267
+ body?: {
1268
+ disputeId?: string;
1269
+ resolution?: Partial<RunDisputeResolutionV1> | null;
1270
+ resolutionOutcome?: "accepted" | "rejected" | "partial" | "withdrawn" | "unresolved";
1271
+ resolutionEscalationLevel?: "l1_counterparty" | "l2_arbiter" | "l3_external";
1272
+ resolutionSummary?: string;
1273
+ closedByAgentId?: string;
1274
+ resolutionEvidenceRefs?: string[];
1275
+ verdict?: Record<string, unknown>;
1276
+ },
1277
+ opts?: RequestOptions
1278
+ ): Promise<
1279
+ SettldResponse<{
1280
+ settlement: AgentRunSettlementV1;
1281
+ disputeEvidence?: RunDisputeEvidenceSubmissionV1 | null;
1282
+ disputeEscalation?: RunDisputeEscalationV1 | null;
1283
+ verdict?: Record<string, unknown> | null;
1284
+ verdictArtifact?: Record<string, unknown> | null;
1285
+ }>
1286
+ >;
1287
+ submitRunDisputeEvidence(
1288
+ runId: string,
1289
+ body: {
1290
+ evidenceRef: string;
1291
+ disputeId?: string;
1292
+ submittedByAgentId?: string;
1293
+ reason?: string;
1294
+ },
1295
+ opts?: RequestOptions
1296
+ ): Promise<
1297
+ SettldResponse<{
1298
+ settlement: AgentRunSettlementV1;
1299
+ disputeEvidence?: RunDisputeEvidenceSubmissionV1 | null;
1300
+ disputeEscalation?: RunDisputeEscalationV1 | null;
1301
+ verdict?: Record<string, unknown> | null;
1302
+ verdictArtifact?: Record<string, unknown> | null;
1303
+ }>
1304
+ >;
1305
+ escalateRunDispute(
1306
+ runId: string,
1307
+ body: {
1308
+ escalationLevel: "l1_counterparty" | "l2_arbiter" | "l3_external";
1309
+ disputeId?: string;
1310
+ channel?: "counterparty" | "policy_engine" | "arbiter" | "external";
1311
+ escalatedByAgentId?: string;
1312
+ reason?: string;
1313
+ },
1314
+ opts?: RequestOptions
1315
+ ): Promise<
1316
+ SettldResponse<{
1317
+ settlement: AgentRunSettlementV1;
1318
+ disputeEvidence?: RunDisputeEvidenceSubmissionV1 | null;
1319
+ disputeEscalation?: RunDisputeEscalationV1 | null;
1320
+ verdict?: Record<string, unknown> | null;
1321
+ verdictArtifact?: Record<string, unknown> | null;
1322
+ }>
1323
+ >;
1324
+ firstVerifiedRun(params: FirstVerifiedRunParams, opts?: FirstVerifiedRunOptions): Promise<FirstVerifiedRunResult>;
1325
+ quoteJob(jobId: string, body: Record<string, unknown>, opts: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1326
+ bookJob(jobId: string, body: Record<string, unknown>, opts: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1327
+ appendJobEvent(jobId: string, body: Record<string, unknown>, opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1328
+
1329
+ opsStatus(opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1330
+ listPartyStatements(
1331
+ params: { period: string; partyId?: string; status?: string },
1332
+ opts?: RequestOptions
1333
+ ): Promise<SettldResponse<Record<string, unknown>>>;
1334
+ getPartyStatement(partyId: string, period: string, opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1335
+ enqueuePayout(partyId: string, period: string, opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1336
+
1337
+ requestMonthClose(body: { month: string; basis?: string }, opts?: RequestOptions): Promise<SettldResponse<Record<string, unknown>>>;
1338
+ getTenantAnalytics(
1339
+ tenantId: string,
1340
+ params?: TenantAnalyticsQuery,
1341
+ opts?: RequestOptions
1342
+ ): Promise<SettldResponse<{ ok: true; report: Record<string, unknown> }>>;
1343
+ getTenantTrustGraph(
1344
+ tenantId: string,
1345
+ params?: TenantTrustGraphQuery,
1346
+ opts?: RequestOptions
1347
+ ): Promise<SettldResponse<{ ok: true; graph: Record<string, unknown> }>>;
1348
+ listTenantTrustGraphSnapshots(
1349
+ tenantId: string,
1350
+ params?: { limit?: number },
1351
+ opts?: RequestOptions
1352
+ ): Promise<
1353
+ SettldResponse<{
1354
+ ok: true;
1355
+ schemaVersion: "MagicLinkTrustGraphSnapshotList.v1";
1356
+ tenantId: string;
1357
+ generatedAt: string;
1358
+ count: number;
1359
+ rows: Array<Record<string, unknown>>;
1360
+ }>
1361
+ >;
1362
+ createTenantTrustGraphSnapshot(
1363
+ tenantId: string,
1364
+ body?: TenantTrustGraphSnapshotCreateInput,
1365
+ opts?: RequestOptions
1366
+ ): Promise<SettldResponse<{ ok: true; snapshot: Record<string, unknown> }>>;
1367
+ diffTenantTrustGraph(
1368
+ tenantId: string,
1369
+ params?: TenantTrustGraphDiffQuery,
1370
+ opts?: RequestOptions
1371
+ ): Promise<SettldResponse<{ ok: true; diff: Record<string, unknown> }>>;
1372
+ }