kontext-sdk 0.7.0 → 0.9.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/README.md CHANGED
@@ -161,6 +161,61 @@ const chain = ctx.verifyDigestChain();
161
161
  console.log(chain.valid); // true — no tampering
162
162
  ```
163
163
 
164
+ ### Agent Provenance
165
+
166
+ Three layers of accountability: session delegation, action binding, and human attestation.
167
+
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
+ });
176
+
177
+ // Layer 2: Action binding — tie every call to the session
178
+ const result = await ctx.verify({
179
+ txHash: '0xabc...',
180
+ chain: 'base',
181
+ amount: '5000',
182
+ token: 'USDC',
183
+ from: '0xAgent...',
184
+ 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
+
164
219
  ### Persist Across Restarts
165
220
 
166
221
  ```typescript
@@ -176,6 +231,39 @@ const ctx = Kontext.init({
176
231
  // Call ctx.flush() to write, ctx.restore() to reload
177
232
  ```
178
233
 
234
+ ## Pluggable Sanctions Screening
235
+
236
+ Multi-provider screening with consensus strategies. Bring your own API keys, or use the built-in OFAC SDN list at zero cost.
237
+
238
+ ```typescript
239
+ import {
240
+ ScreeningAggregator,
241
+ OFACAddressProvider,
242
+ UKOFSIProvider,
243
+ OpenSanctionsProvider,
244
+ ChainalysisOracleProvider,
245
+ } from 'kontext-sdk';
246
+
247
+ const screener = new ScreeningAggregator({
248
+ providers: [
249
+ new OFACAddressProvider(), // built-in, no API key
250
+ new UKOFSIProvider(), // built-in, no API key
251
+ new OpenSanctionsProvider({ apiKey: 'os_...' }), // 331+ sources
252
+ new ChainalysisOracleProvider({ apiKey: 'ch_...' }), // on-chain oracle
253
+ ],
254
+ consensus: 'ANY_MATCH',
255
+ });
256
+
257
+ const result = await screener.screenAddress('0x...');
258
+ // result.flagged = true/false
259
+ // result.matches = [{ provider, list, matchType, confidence, ... }]
260
+ // result.providerResults = per-provider breakdown
261
+ ```
262
+
263
+ **Built-in providers (no API key):** OFAC SDN addresses, UK OFSI addresses
264
+ **API providers:** OpenSanctions (address + entity), Chainalysis Oracle (address), Chainalysis Free API (address)
265
+ **Local providers:** OpenSanctions local dataset (download via `kontext sync`)
266
+
179
267
  ## Compliance Thresholds
180
268
 
181
269
  | Threshold | Amount | Trigger |
@@ -190,9 +278,11 @@ OFAC sanctions screening uses the built-in SDN list. No API key required.
190
278
 
191
279
  - Tamper-evident audit trail (patented digest chain)
192
280
  - OFAC sanctions screening (SDN list, no API key)
281
+ - Pluggable multi-provider screening (OFAC, UK OFSI, OpenSanctions, Chainalysis)
193
282
  - Compliance certificates with SHA-256 proof
194
283
  - Agent reasoning logs
195
284
  - Trust scoring and anomaly detection
285
+ - Agent provenance — session delegation, action binding, human attestation
196
286
  - MCP server mode for AI coding tools
197
287
  - Zero runtime dependencies
198
288