kontext-sdk 0.10.0 → 0.11.1

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/README.md CHANGED
@@ -1,180 +1,45 @@
1
1
  # kontext-sdk
2
2
 
3
- Compliance audit trail CLI and SDK for AI agents making stablecoin payments on Base.
3
+ The trust layer for agentic stablecoin and fiat payments.
4
4
 
5
- **USDC** · **USDT** · **DAI** · **EURC** · **USDP** · **USDG** · **x402** · **Circle Programmable Wallets**
6
-
7
- ---
8
-
9
- ## 30-Second Demo
10
-
11
- ```bash
12
- npx kontext-sdk check 0xAgentWallet 0xMerchant --amount 5000 --token USDC
13
- ```
14
-
15
- ```
16
- OFAC Sanctions: CLEAR
17
- Travel Rule: TRIGGERED ($5,000 >= $3,000 EDD threshold)
18
- CTR Threshold: CLEAR ($5,000 < $10,000)
19
- Large TX Alert: CLEAR ($5,000 < $50,000)
20
- Risk Level: medium
21
- ```
22
-
23
- No install. No config. No API key. One command.
5
+ Cryptographic verifiable intent for org-wide payments using one line of code and a CLI.
24
6
 
25
7
  ## Install
26
8
 
27
9
  ```bash
28
- npm install -g kontext-sdk
29
- ```
30
-
31
- Then run `kontext` from anywhere. Or use `npx kontext-sdk` for one-off checks.
32
-
33
- ## Claude Code / Cursor / Windsurf
34
-
35
- ```json
36
- {
37
- "mcpServers": {
38
- "kontext": {
39
- "command": "npx",
40
- "args": ["-y", "kontext-sdk", "mcp"]
41
- }
42
- }
43
- }
44
- ```
45
-
46
- Then ask: *"verify this USDC transaction for compliance"*
47
-
48
- ## CLI Commands
49
-
50
- ### `kontext check <from> <to>` — stateless compliance check
51
-
52
- ```bash
53
- npx kontext-sdk check 0xSender 0xReceiver --amount 5000 --token USDC
54
- ```
55
-
56
- Instant OFAC screening + threshold checks. No state, no persistence.
57
-
58
- ### `kontext verify` — log + check + digest proof
59
-
60
- ```bash
61
- npx kontext-sdk verify --tx 0xabc123 --amount 5000 --token USDC \
62
- --from 0xAgent --to 0xMerchant --agent my-bot
63
- ```
64
-
65
- Runs compliance checks, logs the transaction, appends to the tamper-evident digest chain. Persists to `.kontext/` in the current directory.
66
-
67
- ### `kontext reason` — log agent reasoning
68
-
69
- ```bash
70
- npx kontext-sdk reason "API returned data I need. Price within budget." \
71
- --agent my-bot --session sess_abc --step 1
10
+ npm install kontext-sdk
72
11
  ```
73
12
 
74
- ### `kontext cert` — export compliance certificate
13
+ ## Auto-instrumentation (recommended)
75
14
 
76
15
  ```bash
77
- npx kontext-sdk cert --agent my-bot --output cert.json
78
- ```
79
-
80
- ### `kontext audit` — verify digest chain integrity
81
-
82
- ```bash
83
- npx kontext-sdk audit --verify
84
- ```
85
-
86
- ### `kontext mcp` — MCP server mode
87
-
88
- ```bash
89
- npx kontext-sdk mcp
16
+ npx kontext init
17
+ # Creates kontext.config.json with your wallets, tokens, chains, and compliance mode
90
18
  ```
91
19
 
92
- Starts an MCP server on stdio for Claude Code, Cursor, and Windsurf.
93
-
94
- ### Flags
95
-
96
- - `--json` on any command outputs structured JSON
97
- - `--amount <number>` transaction amount in token units
98
- - `--token <symbol>` one of USDC, USDT, DAI, EURC, USDP, USDG
99
-
100
- ## SDK — Programmatic Usage
101
-
102
- For tighter integration, use the SDK directly:
103
-
104
20
  ```typescript
105
- import { Kontext, FileStorage } from 'kontext-sdk';
106
-
107
- const ctx = Kontext.init({
108
- projectId: 'my-agent',
109
- environment: 'production',
110
- storage: new FileStorage('.kontext'),
111
- });
112
-
113
- // One-call: compliance check + transaction log + digest proof
114
- const result = await ctx.verify({
115
- txHash: '0xabc...',
116
- chain: 'base',
117
- amount: '5000',
118
- token: 'USDC',
119
- from: '0xAgent...',
120
- to: '0xMerchant...',
121
- agentId: 'payment-agent',
122
- });
123
-
124
- // result.compliant = true/false
125
- // result.checks = [{ name: 'OFAC Sanctions', passed: true }, ...]
126
- // result.riskLevel = 'low' | 'medium' | 'high' | 'critical'
127
- // result.digestProof = 'sha256:a1b2c3...'
128
- ```
129
-
130
- ### Log Reasoning
131
-
132
- ```typescript
133
- await ctx.logReasoning({
134
- agentId: 'payment-agent',
135
- action: 'approve-transfer',
136
- reasoning: 'Price within budget. Merchant verified.',
137
- confidence: 0.95,
138
- });
139
- ```
21
+ import { Kontext, withKontextCompliance } from 'kontext-sdk';
140
22
 
141
- ### Compliance Certificate
23
+ const kontext = Kontext.init(); // reads kontext.config.json
24
+ const client = withKontextCompliance(walletClient, kontext);
142
25
 
143
- ```typescript
144
- const cert = await ctx.generateComplianceCertificate({
145
- agentId: 'payment-agent',
146
- includeReasoning: true,
147
- });
26
+ // Every USDC/USDT/DAI/EURC transfer is now auto-verified
27
+ await client.sendTransaction({ to: usdcAddress, data: transferCalldata });
148
28
  ```
149
29
 
150
- ### Trust Score
30
+ Two interception layers for full coverage:
31
+ - **Code wrap** -- intercepts `sendTransaction`/`writeContract` on your viem client
32
+ - **Chain listener** -- watches monitored wallets on-chain for all outgoing stablecoin transfers
151
33
 
152
- ```typescript
153
- const score = await ctx.getTrustScore('payment-agent');
154
- // score.score = 87, score.level = 'high'
155
- ```
34
+ ## Explicit verify
156
35
 
157
- ### Verify Digest Chain
36
+ For direct control over individual transactions:
158
37
 
159
38
  ```typescript
160
- const chain = ctx.verifyDigestChain();
161
- console.log(chain.valid); // true — no tampering
162
- ```
163
-
164
- ### Agent Provenance
165
-
166
- Three layers of accountability: session delegation, action binding, and human attestation.
39
+ import { Kontext } from 'kontext-sdk';
167
40
 
168
- ```typescript
169
- // Layer 1: Session delegation — record who authorized the agent
170
- const session = await ctx.createAgentSession({
171
- agentId: 'treasury-agent',
172
- delegatedBy: 'user:vinay',
173
- scope: ['transfer', 'approve'],
174
- expiresAt: new Date(Date.now() + 3600_000).toISOString(),
175
- });
41
+ const ctx = Kontext.init({ projectId: 'my-agent' });
176
42
 
177
- // Layer 2: Action binding — tie every call to the session
178
43
  const result = await ctx.verify({
179
44
  txHash: '0xabc...',
180
45
  chain: 'base',
@@ -182,138 +47,67 @@ const result = await ctx.verify({
182
47
  token: 'USDC',
183
48
  from: '0xAgent...',
184
49
  to: '0xMerchant...',
185
- agentId: 'treasury-agent',
186
- sessionId: session.sessionId,
187
- });
188
-
189
- // Layer 3: Human attestation — reviewer signs off
190
- const checkpoint = await ctx.createCheckpoint({
191
- sessionId: session.sessionId,
192
- actionIds: [result.transaction.id],
193
- summary: 'Reviewed $5K transfer to known vendor',
194
- });
195
-
196
- await ctx.attestCheckpoint({
197
- checkpointId: checkpoint.checkpointId,
198
- attestedBy: 'compliance@company.com',
199
- signature: reviewerSignature,
200
- });
201
-
202
- // End session, list sessions, list checkpoints
203
- await ctx.endAgentSession(session.sessionId);
204
- const sessions = ctx.getAgentSessions('treasury-agent');
205
- const checkpoints = ctx.getCheckpoints(session.sessionId);
206
- ```
207
-
208
- #### CLI Commands
209
-
210
- ```bash
211
- npx kontext-sdk session create --agent treasury-agent --delegated-by user:vinay --scope transfer,approve
212
- npx kontext-sdk session list --agent treasury-agent
213
- npx kontext-sdk session end <sessionId>
214
- npx kontext-sdk checkpoint create --session <sessionId> --actions act_1,act_2 --summary "Reviewed transfers"
215
- npx kontext-sdk checkpoint attest <checkpointId> --attested-by compliance@company.com
216
- npx kontext-sdk checkpoint list --session <sessionId>
217
- ```
218
-
219
- ### Persist Across Restarts
220
-
221
- ```typescript
222
- import { FileStorage } from 'kontext-sdk';
223
-
224
- const ctx = Kontext.init({
225
- projectId: 'my-agent',
226
- environment: 'production',
227
- storage: new FileStorage('.kontext'),
50
+ agentId: 'payment-agent',
228
51
  });
229
52
 
230
- // Data persists to .kontext/ directory
231
- // Call ctx.flush() to write, ctx.restore() to reload
53
+ // result.compliant -- true/false
54
+ // result.checks -- OFAC, Travel Rule, CTR thresholds
55
+ // result.riskLevel -- low | medium | high | critical
56
+ // result.digestProof -- tamper-evident SHA-256 chain
232
57
  ```
233
58
 
234
- ## Auto-Instrumentation (viem)
235
-
236
- Run `npx kontext init` to generate a config file, then wrap your viem client — every stablecoin transfer is automatically logged.
237
-
238
- ```bash
239
- npx kontext init
240
- # Wizard asks: project name, agent ID, wallets to monitor, tokens, chains, mode
241
- # Creates kontext.config.json
242
- ```
243
-
244
- ```typescript
245
- import { Kontext, withKontextCompliance } from 'kontext-sdk';
246
- import { createWalletClient, http } from 'viem';
247
- import { base } from 'viem/chains';
59
+ ## What's verified
248
60
 
249
- const kontext = Kontext.init(); // reads kontext.config.json
250
- const client = withKontextCompliance(
251
- createWalletClient({ chain: base, transport: http() }),
252
- kontext,
253
- );
254
-
255
- // Every USDC/USDT/DAI/EURC transfer now auto-logged with compliance proof
256
- await client.sendTransaction({ to: USDC_ADDRESS, data: transferCalldata });
257
- ```
258
-
259
- **Two interception layers:**
260
- - **Code wrap:** `withKontextCompliance()` intercepts `sendTransaction`/`writeContract` calls. Can block pre-send if non-compliant.
261
- - **Chain listener:** SDK watches monitored wallet addresses on-chain for ERC-20 Transfer events — catches ALL outgoing stablecoin transfers regardless of origin.
61
+ Every stablecoin transfer gets:
62
+ - OFAC sanctions screening (built-in SDN list, no API key)
63
+ - Travel Rule threshold detection ($3K EDD, $10K CTR, $50K large tx)
64
+ - Tamper-evident audit trail (patented digest chain)
65
+ - Agent trust score (0-100)
66
+ - Compliance certificate with SHA-256 proof
262
67
 
263
- ## Pluggable Sanctions Screening
68
+ ## Pluggable screening
264
69
 
265
- Multi-provider screening with consensus strategies. Bring your own API keys, or use the built-in OFAC SDN list at zero cost.
70
+ Bring your own providers or use the built-in OFAC list:
266
71
 
267
72
  ```typescript
268
- import {
269
- ScreeningAggregator,
270
- OFACAddressProvider,
271
- UKOFSIProvider,
272
- OpenSanctionsProvider,
273
- ChainalysisOracleProvider,
274
- } from 'kontext-sdk';
73
+ import { ScreeningAggregator, OFACAddressProvider, OpenSanctionsProvider } from 'kontext-sdk';
275
74
 
276
75
  const screener = new ScreeningAggregator({
277
76
  providers: [
278
- new OFACAddressProvider(), // built-in, no API key
279
- new UKOFSIProvider(), // built-in, no API key
280
- new OpenSanctionsProvider({ apiKey: 'os_...' }), // 331+ sources
281
- new ChainalysisOracleProvider({ apiKey: 'ch_...' }), // on-chain oracle
77
+ new OFACAddressProvider(), // built-in, free
78
+ new OpenSanctionsProvider({ apiKey: 'os_...' }), // 331+ sources
282
79
  ],
283
80
  consensus: 'ANY_MATCH',
284
81
  });
285
-
286
- const result = await screener.screenAddress('0x...');
287
- // result.flagged = true/false
288
- // result.matches = [{ provider, list, matchType, confidence, ... }]
289
- // result.providerResults = per-provider breakdown
290
82
  ```
291
83
 
292
- **Built-in providers (no API key):** OFAC SDN addresses, UK OFSI addresses
293
- **API providers:** OpenSanctions (address + entity), Chainalysis Oracle (address), Chainalysis Free API (address)
294
- **Local providers:** OpenSanctions local dataset (download via `kontext sync`)
84
+ ## Agent reasoning
295
85
 
296
- ## Compliance Thresholds
86
+ ```typescript
87
+ await ctx.logReasoning({
88
+ agentId: 'payment-agent',
89
+ action: 'approve-transfer',
90
+ reasoning: 'Amount within daily limit. Recipient on allowlist.',
91
+ confidence: 0.95,
92
+ });
93
+ ```
297
94
 
298
- | Threshold | Amount | Trigger |
299
- |-----------|--------|---------|
300
- | **EDD / Travel Rule** | $3,000 | Enhanced Due Diligence required |
301
- | **CTR** | $10,000 | Currency Transaction Report |
302
- | **Large TX Alert** | $50,000 | Large Transaction Alert |
95
+ ## MCP server
303
96
 
304
- OFAC sanctions screening uses the built-in SDN list. No API key required.
97
+ ```json
98
+ {
99
+ "mcpServers": {
100
+ "kontext": {
101
+ "command": "npx",
102
+ "args": ["-y", "@kontext-sdk/cli", "mcp"]
103
+ }
104
+ }
105
+ }
106
+ ```
305
107
 
306
- ## What's Included
108
+ ## Zero runtime dependencies
307
109
 
308
- - Tamper-evident audit trail (patented digest chain)
309
- - OFAC sanctions screening (SDN list, no API key)
310
- - Pluggable multi-provider screening (OFAC, UK OFSI, OpenSanctions, Chainalysis)
311
- - Compliance certificates with SHA-256 proof
312
- - Agent reasoning logs
313
- - Trust scoring and anomaly detection
314
- - Agent provenance — session delegation, action binding, human attestation
315
- - MCP server mode for AI coding tools
316
- - Zero runtime dependencies
110
+ The SDK has no `dependencies`. Works in Node.js 18+, TypeScript 5.0+.
317
111
 
318
112
  ## License
319
113
 
@@ -321,6 +115,4 @@ MIT
321
115
 
322
116
  ---
323
117
 
324
- Kontext provides compliance logging tools. Regulatory responsibility remains with the operator. This software does not constitute legal advice and does not guarantee regulatory compliance. Consult qualified legal counsel for your specific obligations.
325
-
326
118
  Built by [Legaci Labs](https://www.getkontext.com)
package/dist/index.d.mts CHANGED
@@ -981,6 +981,8 @@ interface VerifyResult {
981
981
  task?: Task;
982
982
  /** ERC-8021 builder attribution (present when erc8021 config provided and tx has attribution) */
983
983
  attribution?: ERC8021Attribution;
984
+ /** Coverage warning when using built-in screening only (no external providers configured) */
985
+ coverageWarning?: string;
984
986
  }
985
987
  /**
986
988
  * Input for logging an agent's reasoning/decision step.
@@ -3849,6 +3851,103 @@ declare class ChainalysisOracleProvider implements ScreeningProvider {
3849
3851
  private errorResult;
3850
3852
  }
3851
3853
 
3854
+ interface KontextCloudScreeningConfig {
3855
+ /** Kontext API key (not a third-party key) */
3856
+ apiKey: string;
3857
+ /** Kontext project ID */
3858
+ projectId: string;
3859
+ /** API base URL (default: https://api.getkontext.com) */
3860
+ apiUrl?: string;
3861
+ /** Fuzzy match threshold for entity names (default: 0.85) */
3862
+ threshold?: number;
3863
+ /** Max entity results (default: 5) */
3864
+ maxResults?: number;
3865
+ }
3866
+ /**
3867
+ * Kontext Cloud Screening Provider.
3868
+ *
3869
+ * Screens addresses and entity names against Kontext's pre-cached
3870
+ * government sanctions data. Covers OFAC SDN (~69K entities, ~1,245
3871
+ * crypto addresses), UK Sanctions List (~12K entities), and EU FSF
3872
+ * (~14K entities).
3873
+ *
3874
+ * - **Pay-as-you-go**, requires Kontext API key
3875
+ * - **Browser-compatible** — all HTTP
3876
+ * - Supports address + entity name queries
3877
+ *
3878
+ * @example
3879
+ * ```typescript
3880
+ * const provider = new KontextCloudScreeningProvider({
3881
+ * apiKey: 'sk_live_...',
3882
+ * projectId: 'my-project',
3883
+ * });
3884
+ *
3885
+ * // Address lookup (O(1) sub-ms on server)
3886
+ * const result = await provider.screen('0x1234...');
3887
+ *
3888
+ * // Entity name search (fuzzy, 1-5ms on server)
3889
+ * const result = await provider.screen('Lazarus Group');
3890
+ * ```
3891
+ */
3892
+ declare class KontextCloudScreeningProvider implements ScreeningProvider {
3893
+ readonly id = "kontext-cloud";
3894
+ readonly name = "Kontext Cloud Screening";
3895
+ readonly lists: readonly SanctionsList[];
3896
+ readonly requiresApiKey = true;
3897
+ readonly browserCompatible = true;
3898
+ readonly queryTypes: readonly QueryType[];
3899
+ private readonly apiKey;
3900
+ private readonly projectId;
3901
+ private readonly apiUrl;
3902
+ private readonly threshold;
3903
+ private readonly maxResults;
3904
+ constructor(config: KontextCloudScreeningConfig);
3905
+ isAvailable(): boolean;
3906
+ screen(query: string, _context?: ScreeningContext): Promise<ScreeningResult>;
3907
+ private screenAddress;
3908
+ private screenEntity;
3909
+ private errorResult;
3910
+ }
3911
+
3912
+ interface TRMLabsConfig {
3913
+ /** TRM Labs API key */
3914
+ apiKey: string;
3915
+ /** API base URL (default: https://api.trmlabs.com/public/v2) */
3916
+ baseUrl?: string;
3917
+ }
3918
+ /**
3919
+ * TRM Labs Sanctions Screening Provider.
3920
+ *
3921
+ * Screens blockchain addresses via the TRM Labs free sanctions API.
3922
+ * Covers 25 blockchains with cross-chain detection. Address-only —
3923
+ * does not support entity name screening.
3924
+ *
3925
+ * - **Free** — 100K req/day with API key
3926
+ * - **Browser-compatible** — simple REST API
3927
+ *
3928
+ * @example
3929
+ * ```typescript
3930
+ * const provider = new TRMLabsProvider({
3931
+ * apiKey: process.env.TRM_API_KEY!,
3932
+ * });
3933
+ * const result = await provider.screen('0x098B716B8Aaf21512996dC57EB0615e2383E2f96');
3934
+ * ```
3935
+ */
3936
+ declare class TRMLabsProvider implements ScreeningProvider {
3937
+ readonly id = "trm-labs";
3938
+ readonly name = "TRM Labs Sanctions Screening";
3939
+ readonly lists: readonly SanctionsList[];
3940
+ readonly requiresApiKey = true;
3941
+ readonly browserCompatible = true;
3942
+ readonly queryTypes: readonly QueryType[];
3943
+ private readonly apiKey;
3944
+ private readonly baseUrl;
3945
+ constructor(config: TRMLabsConfig);
3946
+ isAvailable(): boolean;
3947
+ screen(query: string, _context?: ScreeningContext): Promise<ScreeningResult>;
3948
+ private errorResult;
3949
+ }
3950
+
3852
3951
  type ConsensusStrategy = 'ANY_MATCH' | 'ALL_MATCH' | 'MAJORITY';
3853
3952
  interface ScreeningAggregatorConfig {
3854
3953
  providers: ScreeningProvider[];
@@ -4034,4 +4133,4 @@ interface KontextConfigFile {
4034
4133
  */
4035
4134
  declare function loadConfigFile(startDir?: string): KontextConfigFile | null;
4036
4135
 
4037
- export { type ActionLog, type AgentCard, type AgentData, type AgentIdentity, AgentIdentityRegistry, type AgentLink, type AgentSession, type AggregatedScreeningResult, type AnchorResult, type AnchorVerification, type AnomalyCallback, type AnomalyDetectionConfig, AnomalyDetector, type AnomalyEvent, type AnomalyRuleType, type AnomalySeverity, type AnomalyThresholds, type AttestationDecision, type AttestationPayload, type AttestationRequest, type AttestationResponse, type AttestationSignature, type BehavioralEmbedding, BehavioralFingerprinter, CHAIN_ID_MAP, CURRENCY_REQUIRED_LISTS, type Chain, ChainalysisFreeAPIProvider, ChainalysisOracleProvider, type CheckpointStatus, type ClusteringEvidence, type ClusteringHeuristic, type ComplianceCertificate, type ComplianceCheckResult, type ComplianceReport, type ConfirmTaskInput, type ConsensusStrategy, ConsoleExporter, type CounterpartyAttestation, type CounterpartyConfig, type CreateCheckpointInput, type CreateSessionInput, type CreateTaskInput, CrossSessionLinker, type CrossSessionLinkerConfig, type DateRange, DigestChain, type DigestLink, type DigestVerification, type ERC8021Attribution, type ERC8021Config, type EntityStatus, type EntityType, type Environment, type EventExporter, type ExportFormat, type ExportOptions, type ExportResult, type ExporterResult, type FeatureFlag, type FeatureFlagConfig, FeatureFlagManager, FileStorage, type FinancialFeatures, type FlagPlanTargeting, type FlagScope, type FlagTargeting, type GatedFeature, type GenerateComplianceCertificateInput, type HumanAttestation, JsonFileExporter, type Jurisdiction, KONTEXT_BUILDER_CODE, type KYAConfidenceLevel, type KYAConfidenceScore, KYAConfidenceScorer, type KYAConfidenceScorerConfig, type KYAEnvelope, type KYAScoreComponent, type KYCProviderReference, type KYCStatus, Kontext, type KontextConfig, KontextError, KontextErrorCode, type KontextMode, type LimitEvent, type LinkSignal, type LinkStatus, type LogActionInput, type LogLevel, type LogReasoningInput, type LogTransactionInput, type MatchType, MemoryStorage, type MetadataValidator, type NetworkFeatures, NoopExporter, OFACAddressProvider, OFACEntityProvider, type OnChainAnchorConfig, OnChainExporter, OpenSanctionsLocalProvider, OpenSanctionsProvider, type OperationalFeatures, PLAN_LIMITS, PaymentCompliance, type PlanConfig, PlanManager, type PlanTier, type PlanUsage, type PolicyConfig, type PrecisionTimestamp, type ProvenanceAction, type ProvenanceAttestor, type ProvenanceBundle, type ProvenanceBundleVerification, type ProvenanceCheckpoint, ProvenanceManager, type QueryType, type ReasoningEntry, type RegisterIdentityInput, type ReportOptions, type ReportType, type RiskFactor, STABLECOIN_CONTRACTS, type SanctionsCheckResult, type SanctionsList, ScreeningAggregator, type ScreeningAggregatorConfig, type ScreeningConfig, type ScreeningContext, type ScreeningMatch, type ScreeningProvider, type ScreeningResult, type SessionConstraints, type SessionStatus, type StorageAdapter, TOKEN_REQUIRED_LISTS, type Task, type TaskEvidence, type TaskStatus, type TemporalFeatures, type Token, type TransactionEvaluation, type TransactionRecord, type TrustFactor, type TrustScore, TrustScorer, UKOFSIProvider, type UpdateIdentityInput, UsdcCompliance, type UsdcComplianceCheck, type VerificationKey, type VerifyInput, type VerifyResult, ViemComplianceError, type ViemInstrumentationOptions, type WalletClientLike, type WalletCluster, WalletClusterer, type WalletClusteringConfig, type WalletMapping, WalletMonitor, type WalletMonitoringConfig, anchorDigest, encodeERC8021Suffix, exchangeAttestation, fetchAgentCard, fetchTransactionAttribution, getAnchor, getRequiredLists, isBlockchainAddress, isCryptoTransaction, isFeatureAvailable, loadConfigFile, parseERC8021Suffix, providerSupportsQuery, requirePlan, verifyAnchor, verifyExportedChain, withKontextCompliance };
4136
+ export { type ActionLog, type AgentCard, type AgentData, type AgentIdentity, AgentIdentityRegistry, type AgentLink, type AgentSession, type AggregatedScreeningResult, type AnchorResult, type AnchorVerification, type AnomalyCallback, type AnomalyDetectionConfig, AnomalyDetector, type AnomalyEvent, type AnomalyRuleType, type AnomalySeverity, type AnomalyThresholds, type AttestationDecision, type AttestationPayload, type AttestationRequest, type AttestationResponse, type AttestationSignature, type BehavioralEmbedding, BehavioralFingerprinter, CHAIN_ID_MAP, CURRENCY_REQUIRED_LISTS, type Chain, ChainalysisFreeAPIProvider, ChainalysisOracleProvider, type CheckpointStatus, type ClusteringEvidence, type ClusteringHeuristic, type ComplianceCertificate, type ComplianceCheckResult, type ComplianceReport, type ConfirmTaskInput, type ConsensusStrategy, ConsoleExporter, type CounterpartyAttestation, type CounterpartyConfig, type CreateCheckpointInput, type CreateSessionInput, type CreateTaskInput, CrossSessionLinker, type CrossSessionLinkerConfig, type DateRange, DigestChain, type DigestLink, type DigestVerification, type ERC8021Attribution, type ERC8021Config, type EntityStatus, type EntityType, type Environment, type EventExporter, type ExportFormat, type ExportOptions, type ExportResult, type ExporterResult, type FeatureFlag, type FeatureFlagConfig, FeatureFlagManager, FileStorage, type FinancialFeatures, type FlagPlanTargeting, type FlagScope, type FlagTargeting, type GatedFeature, type GenerateComplianceCertificateInput, type HumanAttestation, JsonFileExporter, type Jurisdiction, KONTEXT_BUILDER_CODE, type KYAConfidenceLevel, type KYAConfidenceScore, KYAConfidenceScorer, type KYAConfidenceScorerConfig, type KYAEnvelope, type KYAScoreComponent, type KYCProviderReference, type KYCStatus, Kontext, type KontextCloudScreeningConfig, KontextCloudScreeningProvider, type KontextConfig, KontextError, KontextErrorCode, type KontextMode, type LimitEvent, type LinkSignal, type LinkStatus, type LogActionInput, type LogLevel, type LogReasoningInput, type LogTransactionInput, type MatchType, MemoryStorage, type MetadataValidator, type NetworkFeatures, NoopExporter, OFACAddressProvider, OFACEntityProvider, type OnChainAnchorConfig, OnChainExporter, OpenSanctionsLocalProvider, OpenSanctionsProvider, type OperationalFeatures, PLAN_LIMITS, PaymentCompliance, type PlanConfig, PlanManager, type PlanTier, type PlanUsage, type PolicyConfig, type PrecisionTimestamp, type ProvenanceAction, type ProvenanceAttestor, type ProvenanceBundle, type ProvenanceBundleVerification, type ProvenanceCheckpoint, ProvenanceManager, type QueryType, type ReasoningEntry, type RegisterIdentityInput, type ReportOptions, type ReportType, type RiskFactor, STABLECOIN_CONTRACTS, type SanctionsCheckResult, type SanctionsList, ScreeningAggregator, type ScreeningAggregatorConfig, type ScreeningConfig, type ScreeningContext, type ScreeningMatch, type ScreeningProvider, type ScreeningResult, type SessionConstraints, type SessionStatus, type StorageAdapter, TOKEN_REQUIRED_LISTS, type TRMLabsConfig, TRMLabsProvider, type Task, type TaskEvidence, type TaskStatus, type TemporalFeatures, type Token, type TransactionEvaluation, type TransactionRecord, type TrustFactor, type TrustScore, TrustScorer, UKOFSIProvider, type UpdateIdentityInput, UsdcCompliance, type UsdcComplianceCheck, type VerificationKey, type VerifyInput, type VerifyResult, ViemComplianceError, type ViemInstrumentationOptions, type WalletClientLike, type WalletCluster, WalletClusterer, type WalletClusteringConfig, type WalletMapping, WalletMonitor, type WalletMonitoringConfig, anchorDigest, encodeERC8021Suffix, exchangeAttestation, fetchAgentCard, fetchTransactionAttribution, getAnchor, getRequiredLists, isBlockchainAddress, isCryptoTransaction, isFeatureAvailable, loadConfigFile, parseERC8021Suffix, providerSupportsQuery, requirePlan, verifyAnchor, verifyExportedChain, withKontextCompliance };
package/dist/index.d.ts CHANGED
@@ -981,6 +981,8 @@ interface VerifyResult {
981
981
  task?: Task;
982
982
  /** ERC-8021 builder attribution (present when erc8021 config provided and tx has attribution) */
983
983
  attribution?: ERC8021Attribution;
984
+ /** Coverage warning when using built-in screening only (no external providers configured) */
985
+ coverageWarning?: string;
984
986
  }
985
987
  /**
986
988
  * Input for logging an agent's reasoning/decision step.
@@ -3849,6 +3851,103 @@ declare class ChainalysisOracleProvider implements ScreeningProvider {
3849
3851
  private errorResult;
3850
3852
  }
3851
3853
 
3854
+ interface KontextCloudScreeningConfig {
3855
+ /** Kontext API key (not a third-party key) */
3856
+ apiKey: string;
3857
+ /** Kontext project ID */
3858
+ projectId: string;
3859
+ /** API base URL (default: https://api.getkontext.com) */
3860
+ apiUrl?: string;
3861
+ /** Fuzzy match threshold for entity names (default: 0.85) */
3862
+ threshold?: number;
3863
+ /** Max entity results (default: 5) */
3864
+ maxResults?: number;
3865
+ }
3866
+ /**
3867
+ * Kontext Cloud Screening Provider.
3868
+ *
3869
+ * Screens addresses and entity names against Kontext's pre-cached
3870
+ * government sanctions data. Covers OFAC SDN (~69K entities, ~1,245
3871
+ * crypto addresses), UK Sanctions List (~12K entities), and EU FSF
3872
+ * (~14K entities).
3873
+ *
3874
+ * - **Pay-as-you-go**, requires Kontext API key
3875
+ * - **Browser-compatible** — all HTTP
3876
+ * - Supports address + entity name queries
3877
+ *
3878
+ * @example
3879
+ * ```typescript
3880
+ * const provider = new KontextCloudScreeningProvider({
3881
+ * apiKey: 'sk_live_...',
3882
+ * projectId: 'my-project',
3883
+ * });
3884
+ *
3885
+ * // Address lookup (O(1) sub-ms on server)
3886
+ * const result = await provider.screen('0x1234...');
3887
+ *
3888
+ * // Entity name search (fuzzy, 1-5ms on server)
3889
+ * const result = await provider.screen('Lazarus Group');
3890
+ * ```
3891
+ */
3892
+ declare class KontextCloudScreeningProvider implements ScreeningProvider {
3893
+ readonly id = "kontext-cloud";
3894
+ readonly name = "Kontext Cloud Screening";
3895
+ readonly lists: readonly SanctionsList[];
3896
+ readonly requiresApiKey = true;
3897
+ readonly browserCompatible = true;
3898
+ readonly queryTypes: readonly QueryType[];
3899
+ private readonly apiKey;
3900
+ private readonly projectId;
3901
+ private readonly apiUrl;
3902
+ private readonly threshold;
3903
+ private readonly maxResults;
3904
+ constructor(config: KontextCloudScreeningConfig);
3905
+ isAvailable(): boolean;
3906
+ screen(query: string, _context?: ScreeningContext): Promise<ScreeningResult>;
3907
+ private screenAddress;
3908
+ private screenEntity;
3909
+ private errorResult;
3910
+ }
3911
+
3912
+ interface TRMLabsConfig {
3913
+ /** TRM Labs API key */
3914
+ apiKey: string;
3915
+ /** API base URL (default: https://api.trmlabs.com/public/v2) */
3916
+ baseUrl?: string;
3917
+ }
3918
+ /**
3919
+ * TRM Labs Sanctions Screening Provider.
3920
+ *
3921
+ * Screens blockchain addresses via the TRM Labs free sanctions API.
3922
+ * Covers 25 blockchains with cross-chain detection. Address-only —
3923
+ * does not support entity name screening.
3924
+ *
3925
+ * - **Free** — 100K req/day with API key
3926
+ * - **Browser-compatible** — simple REST API
3927
+ *
3928
+ * @example
3929
+ * ```typescript
3930
+ * const provider = new TRMLabsProvider({
3931
+ * apiKey: process.env.TRM_API_KEY!,
3932
+ * });
3933
+ * const result = await provider.screen('0x098B716B8Aaf21512996dC57EB0615e2383E2f96');
3934
+ * ```
3935
+ */
3936
+ declare class TRMLabsProvider implements ScreeningProvider {
3937
+ readonly id = "trm-labs";
3938
+ readonly name = "TRM Labs Sanctions Screening";
3939
+ readonly lists: readonly SanctionsList[];
3940
+ readonly requiresApiKey = true;
3941
+ readonly browserCompatible = true;
3942
+ readonly queryTypes: readonly QueryType[];
3943
+ private readonly apiKey;
3944
+ private readonly baseUrl;
3945
+ constructor(config: TRMLabsConfig);
3946
+ isAvailable(): boolean;
3947
+ screen(query: string, _context?: ScreeningContext): Promise<ScreeningResult>;
3948
+ private errorResult;
3949
+ }
3950
+
3852
3951
  type ConsensusStrategy = 'ANY_MATCH' | 'ALL_MATCH' | 'MAJORITY';
3853
3952
  interface ScreeningAggregatorConfig {
3854
3953
  providers: ScreeningProvider[];
@@ -4034,4 +4133,4 @@ interface KontextConfigFile {
4034
4133
  */
4035
4134
  declare function loadConfigFile(startDir?: string): KontextConfigFile | null;
4036
4135
 
4037
- export { type ActionLog, type AgentCard, type AgentData, type AgentIdentity, AgentIdentityRegistry, type AgentLink, type AgentSession, type AggregatedScreeningResult, type AnchorResult, type AnchorVerification, type AnomalyCallback, type AnomalyDetectionConfig, AnomalyDetector, type AnomalyEvent, type AnomalyRuleType, type AnomalySeverity, type AnomalyThresholds, type AttestationDecision, type AttestationPayload, type AttestationRequest, type AttestationResponse, type AttestationSignature, type BehavioralEmbedding, BehavioralFingerprinter, CHAIN_ID_MAP, CURRENCY_REQUIRED_LISTS, type Chain, ChainalysisFreeAPIProvider, ChainalysisOracleProvider, type CheckpointStatus, type ClusteringEvidence, type ClusteringHeuristic, type ComplianceCertificate, type ComplianceCheckResult, type ComplianceReport, type ConfirmTaskInput, type ConsensusStrategy, ConsoleExporter, type CounterpartyAttestation, type CounterpartyConfig, type CreateCheckpointInput, type CreateSessionInput, type CreateTaskInput, CrossSessionLinker, type CrossSessionLinkerConfig, type DateRange, DigestChain, type DigestLink, type DigestVerification, type ERC8021Attribution, type ERC8021Config, type EntityStatus, type EntityType, type Environment, type EventExporter, type ExportFormat, type ExportOptions, type ExportResult, type ExporterResult, type FeatureFlag, type FeatureFlagConfig, FeatureFlagManager, FileStorage, type FinancialFeatures, type FlagPlanTargeting, type FlagScope, type FlagTargeting, type GatedFeature, type GenerateComplianceCertificateInput, type HumanAttestation, JsonFileExporter, type Jurisdiction, KONTEXT_BUILDER_CODE, type KYAConfidenceLevel, type KYAConfidenceScore, KYAConfidenceScorer, type KYAConfidenceScorerConfig, type KYAEnvelope, type KYAScoreComponent, type KYCProviderReference, type KYCStatus, Kontext, type KontextConfig, KontextError, KontextErrorCode, type KontextMode, type LimitEvent, type LinkSignal, type LinkStatus, type LogActionInput, type LogLevel, type LogReasoningInput, type LogTransactionInput, type MatchType, MemoryStorage, type MetadataValidator, type NetworkFeatures, NoopExporter, OFACAddressProvider, OFACEntityProvider, type OnChainAnchorConfig, OnChainExporter, OpenSanctionsLocalProvider, OpenSanctionsProvider, type OperationalFeatures, PLAN_LIMITS, PaymentCompliance, type PlanConfig, PlanManager, type PlanTier, type PlanUsage, type PolicyConfig, type PrecisionTimestamp, type ProvenanceAction, type ProvenanceAttestor, type ProvenanceBundle, type ProvenanceBundleVerification, type ProvenanceCheckpoint, ProvenanceManager, type QueryType, type ReasoningEntry, type RegisterIdentityInput, type ReportOptions, type ReportType, type RiskFactor, STABLECOIN_CONTRACTS, type SanctionsCheckResult, type SanctionsList, ScreeningAggregator, type ScreeningAggregatorConfig, type ScreeningConfig, type ScreeningContext, type ScreeningMatch, type ScreeningProvider, type ScreeningResult, type SessionConstraints, type SessionStatus, type StorageAdapter, TOKEN_REQUIRED_LISTS, type Task, type TaskEvidence, type TaskStatus, type TemporalFeatures, type Token, type TransactionEvaluation, type TransactionRecord, type TrustFactor, type TrustScore, TrustScorer, UKOFSIProvider, type UpdateIdentityInput, UsdcCompliance, type UsdcComplianceCheck, type VerificationKey, type VerifyInput, type VerifyResult, ViemComplianceError, type ViemInstrumentationOptions, type WalletClientLike, type WalletCluster, WalletClusterer, type WalletClusteringConfig, type WalletMapping, WalletMonitor, type WalletMonitoringConfig, anchorDigest, encodeERC8021Suffix, exchangeAttestation, fetchAgentCard, fetchTransactionAttribution, getAnchor, getRequiredLists, isBlockchainAddress, isCryptoTransaction, isFeatureAvailable, loadConfigFile, parseERC8021Suffix, providerSupportsQuery, requirePlan, verifyAnchor, verifyExportedChain, withKontextCompliance };
4136
+ export { type ActionLog, type AgentCard, type AgentData, type AgentIdentity, AgentIdentityRegistry, type AgentLink, type AgentSession, type AggregatedScreeningResult, type AnchorResult, type AnchorVerification, type AnomalyCallback, type AnomalyDetectionConfig, AnomalyDetector, type AnomalyEvent, type AnomalyRuleType, type AnomalySeverity, type AnomalyThresholds, type AttestationDecision, type AttestationPayload, type AttestationRequest, type AttestationResponse, type AttestationSignature, type BehavioralEmbedding, BehavioralFingerprinter, CHAIN_ID_MAP, CURRENCY_REQUIRED_LISTS, type Chain, ChainalysisFreeAPIProvider, ChainalysisOracleProvider, type CheckpointStatus, type ClusteringEvidence, type ClusteringHeuristic, type ComplianceCertificate, type ComplianceCheckResult, type ComplianceReport, type ConfirmTaskInput, type ConsensusStrategy, ConsoleExporter, type CounterpartyAttestation, type CounterpartyConfig, type CreateCheckpointInput, type CreateSessionInput, type CreateTaskInput, CrossSessionLinker, type CrossSessionLinkerConfig, type DateRange, DigestChain, type DigestLink, type DigestVerification, type ERC8021Attribution, type ERC8021Config, type EntityStatus, type EntityType, type Environment, type EventExporter, type ExportFormat, type ExportOptions, type ExportResult, type ExporterResult, type FeatureFlag, type FeatureFlagConfig, FeatureFlagManager, FileStorage, type FinancialFeatures, type FlagPlanTargeting, type FlagScope, type FlagTargeting, type GatedFeature, type GenerateComplianceCertificateInput, type HumanAttestation, JsonFileExporter, type Jurisdiction, KONTEXT_BUILDER_CODE, type KYAConfidenceLevel, type KYAConfidenceScore, KYAConfidenceScorer, type KYAConfidenceScorerConfig, type KYAEnvelope, type KYAScoreComponent, type KYCProviderReference, type KYCStatus, Kontext, type KontextCloudScreeningConfig, KontextCloudScreeningProvider, type KontextConfig, KontextError, KontextErrorCode, type KontextMode, type LimitEvent, type LinkSignal, type LinkStatus, type LogActionInput, type LogLevel, type LogReasoningInput, type LogTransactionInput, type MatchType, MemoryStorage, type MetadataValidator, type NetworkFeatures, NoopExporter, OFACAddressProvider, OFACEntityProvider, type OnChainAnchorConfig, OnChainExporter, OpenSanctionsLocalProvider, OpenSanctionsProvider, type OperationalFeatures, PLAN_LIMITS, PaymentCompliance, type PlanConfig, PlanManager, type PlanTier, type PlanUsage, type PolicyConfig, type PrecisionTimestamp, type ProvenanceAction, type ProvenanceAttestor, type ProvenanceBundle, type ProvenanceBundleVerification, type ProvenanceCheckpoint, ProvenanceManager, type QueryType, type ReasoningEntry, type RegisterIdentityInput, type ReportOptions, type ReportType, type RiskFactor, STABLECOIN_CONTRACTS, type SanctionsCheckResult, type SanctionsList, ScreeningAggregator, type ScreeningAggregatorConfig, type ScreeningConfig, type ScreeningContext, type ScreeningMatch, type ScreeningProvider, type ScreeningResult, type SessionConstraints, type SessionStatus, type StorageAdapter, TOKEN_REQUIRED_LISTS, type TRMLabsConfig, TRMLabsProvider, type Task, type TaskEvidence, type TaskStatus, type TemporalFeatures, type Token, type TransactionEvaluation, type TransactionRecord, type TrustFactor, type TrustScore, TrustScorer, UKOFSIProvider, type UpdateIdentityInput, UsdcCompliance, type UsdcComplianceCheck, type VerificationKey, type VerifyInput, type VerifyResult, ViemComplianceError, type ViemInstrumentationOptions, type WalletClientLike, type WalletCluster, WalletClusterer, type WalletClusteringConfig, type WalletMapping, WalletMonitor, type WalletMonitoringConfig, anchorDigest, encodeERC8021Suffix, exchangeAttestation, fetchAgentCard, fetchTransactionAttribution, getAnchor, getRequiredLists, isBlockchainAddress, isCryptoTransaction, isFeatureAvailable, loadConfigFile, parseERC8021Suffix, providerSupportsQuery, requirePlan, verifyAnchor, verifyExportedChain, withKontextCompliance };