@obelyzk/sdk 1.4.0 → 1.6.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 +7 -7
- package/dist/chunk-ASKP7TIW.mjs +153 -0
- package/dist/chunk-DGYMDV5X.mjs +153 -0
- package/dist/chunk-EHI6MQFS.mjs +566 -0
- package/dist/chunk-G3GLKFP5.mjs +0 -0
- package/dist/chunk-GK4FKSZ4.mjs +697 -0
- package/dist/chunk-NQ4E7ULF.mjs +338 -0
- package/dist/chunk-XGB3TDIC.mjs +42 -0
- package/dist/chunk-Y4PBMUWM.mjs +533 -0
- package/dist/client-DFxKbDns.d.mts +199 -0
- package/dist/client-DFxKbDns.d.ts +199 -0
- package/dist/firewall/index.d.mts +236 -130
- package/dist/firewall/index.d.ts +236 -130
- package/dist/firewall/index.js +479 -2
- package/dist/firewall/index.mjs +12 -4
- package/dist/index.d.mts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +231 -6
- package/dist/index.mjs +54 -9
- package/dist/mcp-policy/index.d.mts +1 -0
- package/dist/mcp-policy/index.d.ts +1 -0
- package/dist/mcp-policy/index.js +27903 -0
- package/dist/mcp-policy/index.mjs +27351 -0
- package/dist/obelysk/index.mjs +2 -2
- package/dist/privacy/index.mjs +2 -2
- package/dist/react/index.mjs +2 -2
- package/examples/.claude/rules/starknet.md +17 -0
- package/examples/CLAUDE.md +59 -0
- package/examples/claude-settings.json +52 -0
- package/examples/test_confidential_swap_api.ts +313 -0
- package/package.json +12 -4
- package/src/hooks/post-tool-use.sh +116 -0
- package/src/hooks/pre-tool-use.sh +112 -0
- package/src/hooks/session-start.sh +50 -0
package/dist/firewall/index.js
CHANGED
|
@@ -20,7 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/firewall/index.ts
|
|
21
21
|
var firewall_exports = {};
|
|
22
22
|
__export(firewall_exports, {
|
|
23
|
-
AgentFirewallSDK: () => AgentFirewallSDK
|
|
23
|
+
AgentFirewallSDK: () => AgentFirewallSDK,
|
|
24
|
+
CiroClient: () => CiroClient,
|
|
25
|
+
PolicyEnforcer: () => PolicyEnforcer,
|
|
26
|
+
createPolicyEnforcer: () => createPolicyEnforcer
|
|
24
27
|
});
|
|
25
28
|
module.exports = __toCommonJS(firewall_exports);
|
|
26
29
|
|
|
@@ -166,6 +169,124 @@ var AgentFirewallSDK = class {
|
|
|
166
169
|
);
|
|
167
170
|
return contract.is_trusted(agentId);
|
|
168
171
|
}
|
|
172
|
+
/** Get the decision for an action (0=pending, 1=approved, 2=escalated, 3=blocked). */
|
|
173
|
+
async getActionDecision(actionId) {
|
|
174
|
+
const contract = new import_starknet.Contract(
|
|
175
|
+
FIREWALL_ABI,
|
|
176
|
+
this.config.firewallContract,
|
|
177
|
+
this.provider
|
|
178
|
+
);
|
|
179
|
+
return Number(await contract.get_action_decision(actionId));
|
|
180
|
+
}
|
|
181
|
+
/** Get the threat score for a resolved action. */
|
|
182
|
+
async getActionThreatScore(actionId) {
|
|
183
|
+
const contract = new import_starknet.Contract(
|
|
184
|
+
FIREWALL_ABI,
|
|
185
|
+
this.config.firewallContract,
|
|
186
|
+
this.provider
|
|
187
|
+
);
|
|
188
|
+
return Number(await contract.get_action_threat_score(actionId));
|
|
189
|
+
}
|
|
190
|
+
/** Get the IO commitment for an action. */
|
|
191
|
+
async getActionIoCommitment(actionId) {
|
|
192
|
+
const contract = new import_starknet.Contract(
|
|
193
|
+
FIREWALL_ABI,
|
|
194
|
+
this.config.firewallContract,
|
|
195
|
+
this.provider
|
|
196
|
+
);
|
|
197
|
+
const result = await contract.get_action_io_commitment(actionId);
|
|
198
|
+
return `0x${BigInt(result).toString(16)}`;
|
|
199
|
+
}
|
|
200
|
+
// ── On-Chain Actions ────────────────────────────────────────────────
|
|
201
|
+
/**
|
|
202
|
+
* Submit a pending action to the firewall contract.
|
|
203
|
+
* Returns the action_id assigned by the contract.
|
|
204
|
+
*/
|
|
205
|
+
async submitAction(agentId, target, value, selector, ioCommitment) {
|
|
206
|
+
this.requireAccount();
|
|
207
|
+
const tx = await this.config.account.execute({
|
|
208
|
+
contractAddress: this.config.firewallContract,
|
|
209
|
+
entrypoint: "submit_action",
|
|
210
|
+
calldata: import_starknet.CallData.compile({
|
|
211
|
+
agent_id: agentId,
|
|
212
|
+
target,
|
|
213
|
+
value,
|
|
214
|
+
selector,
|
|
215
|
+
io_commitment: ioCommitment
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
const receipt = await this.provider.waitForTransaction(tx.transaction_hash);
|
|
219
|
+
let actionId = 0;
|
|
220
|
+
const events = receipt.events;
|
|
221
|
+
if (Array.isArray(events)) {
|
|
222
|
+
for (const event of events) {
|
|
223
|
+
if (event.data && event.data.length >= 2) {
|
|
224
|
+
const candidateId = Number(BigInt(event.data[0]));
|
|
225
|
+
if (candidateId > 0) {
|
|
226
|
+
actionId = candidateId;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return { actionId, txHash: tx.transaction_hash };
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Resolve a pending action with a verified ZKML proof.
|
|
236
|
+
* The proof must already be verified on the ObelyskVerifier contract.
|
|
237
|
+
*/
|
|
238
|
+
async resolveAction(actionId, proofHash, originalIoLen, packedRawIo) {
|
|
239
|
+
this.requireAccount();
|
|
240
|
+
const tx = await this.config.account.execute({
|
|
241
|
+
contractAddress: this.config.firewallContract,
|
|
242
|
+
entrypoint: "resolve_action_with_proof",
|
|
243
|
+
calldata: import_starknet.CallData.compile({
|
|
244
|
+
action_id: actionId,
|
|
245
|
+
proof_hash: proofHash,
|
|
246
|
+
original_io_len: originalIoLen,
|
|
247
|
+
packed_raw_io: packedRawIo
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
|
+
const receipt = await this.provider.waitForTransaction(tx.transaction_hash);
|
|
251
|
+
let decision = "approve";
|
|
252
|
+
let threatScore = 0;
|
|
253
|
+
const resolveEvents = receipt.events;
|
|
254
|
+
if (Array.isArray(resolveEvents)) {
|
|
255
|
+
for (const event of resolveEvents) {
|
|
256
|
+
if (event.data && event.data.length >= 4) {
|
|
257
|
+
const decisionCode = Number(BigInt(event.data[2]));
|
|
258
|
+
threatScore = Number(BigInt(event.data[3]));
|
|
259
|
+
if (decisionCode === 1) decision = "approve";
|
|
260
|
+
else if (decisionCode === 2) decision = "escalate";
|
|
261
|
+
else if (decisionCode === 3) decision = "block";
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return { decision, threatScore, txHash: tx.transaction_hash };
|
|
267
|
+
}
|
|
268
|
+
/** Approve an escalated action (human-in-the-loop). */
|
|
269
|
+
async approveEscalated(actionId) {
|
|
270
|
+
this.requireAccount();
|
|
271
|
+
const tx = await this.config.account.execute({
|
|
272
|
+
contractAddress: this.config.firewallContract,
|
|
273
|
+
entrypoint: "approve_escalated",
|
|
274
|
+
calldata: import_starknet.CallData.compile({ action_id: actionId })
|
|
275
|
+
});
|
|
276
|
+
await this.provider.waitForTransaction(tx.transaction_hash);
|
|
277
|
+
return tx.transaction_hash;
|
|
278
|
+
}
|
|
279
|
+
/** Reject an escalated action and add a strike. */
|
|
280
|
+
async rejectEscalated(actionId) {
|
|
281
|
+
this.requireAccount();
|
|
282
|
+
const tx = await this.config.account.execute({
|
|
283
|
+
contractAddress: this.config.firewallContract,
|
|
284
|
+
entrypoint: "reject_escalated",
|
|
285
|
+
calldata: import_starknet.CallData.compile({ action_id: actionId })
|
|
286
|
+
});
|
|
287
|
+
await this.provider.waitForTransaction(tx.transaction_hash);
|
|
288
|
+
return tx.transaction_hash;
|
|
289
|
+
}
|
|
169
290
|
// ── Helpers ────────────────────────────────────────────────────────
|
|
170
291
|
requireAccount() {
|
|
171
292
|
if (!this.config.account) {
|
|
@@ -224,9 +345,365 @@ var FIREWALL_ABI = [
|
|
|
224
345
|
inputs: [{ name: "action_id", type: "felt" }],
|
|
225
346
|
outputs: [{ type: "felt" }],
|
|
226
347
|
state_mutability: "view"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: "get_action_threat_score",
|
|
351
|
+
type: "function",
|
|
352
|
+
inputs: [{ name: "action_id", type: "felt" }],
|
|
353
|
+
outputs: [{ type: "felt" }],
|
|
354
|
+
state_mutability: "view"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
name: "get_action_io_commitment",
|
|
358
|
+
type: "function",
|
|
359
|
+
inputs: [{ name: "action_id", type: "felt" }],
|
|
360
|
+
outputs: [{ type: "felt" }],
|
|
361
|
+
state_mutability: "view"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: "get_owner",
|
|
365
|
+
type: "function",
|
|
366
|
+
inputs: [],
|
|
367
|
+
outputs: [{ type: "felt" }],
|
|
368
|
+
state_mutability: "view"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
name: "get_verifier",
|
|
372
|
+
type: "function",
|
|
373
|
+
inputs: [],
|
|
374
|
+
outputs: [{ type: "felt" }],
|
|
375
|
+
state_mutability: "view"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
name: "get_classifier_model_id",
|
|
379
|
+
type: "function",
|
|
380
|
+
inputs: [],
|
|
381
|
+
outputs: [{ type: "felt" }],
|
|
382
|
+
state_mutability: "view"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: "get_thresholds",
|
|
386
|
+
type: "function",
|
|
387
|
+
inputs: [],
|
|
388
|
+
outputs: [{ type: "felt" }, { type: "felt" }, { type: "felt" }],
|
|
389
|
+
state_mutability: "view"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: "get_agent_owner",
|
|
393
|
+
type: "function",
|
|
394
|
+
inputs: [{ name: "agent_id", type: "felt" }],
|
|
395
|
+
outputs: [{ type: "felt" }],
|
|
396
|
+
state_mutability: "view"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: "get_action_agent",
|
|
400
|
+
type: "function",
|
|
401
|
+
inputs: [{ name: "action_id", type: "felt" }],
|
|
402
|
+
outputs: [{ type: "felt" }],
|
|
403
|
+
state_mutability: "view"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
name: "is_paused",
|
|
407
|
+
type: "function",
|
|
408
|
+
inputs: [],
|
|
409
|
+
outputs: [{ type: "felt" }],
|
|
410
|
+
state_mutability: "view"
|
|
227
411
|
}
|
|
228
412
|
];
|
|
413
|
+
|
|
414
|
+
// src/firewall/middleware.ts
|
|
415
|
+
function createPolicyEnforcer(config) {
|
|
416
|
+
return new PolicyEnforcer(config);
|
|
417
|
+
}
|
|
418
|
+
var PolicyEnforcer = class {
|
|
419
|
+
sdk;
|
|
420
|
+
config;
|
|
421
|
+
blockThreshold;
|
|
422
|
+
escalateThreshold;
|
|
423
|
+
constructor(config) {
|
|
424
|
+
this.config = config;
|
|
425
|
+
this.blockThreshold = config.blockThreshold ?? 7e4;
|
|
426
|
+
this.escalateThreshold = config.escalateThreshold ?? 4e4;
|
|
427
|
+
this.sdk = new AgentFirewallSDK({
|
|
428
|
+
proverUrl: config.proverUrl,
|
|
429
|
+
firewallContract: config.firewallContract ?? "",
|
|
430
|
+
verifierContract: config.verifierContract ?? "",
|
|
431
|
+
rpcUrl: config.rpcUrl ?? "https://starknet-sepolia.public.blastapi.io",
|
|
432
|
+
apiKey: config.apiKey
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Check whether an action should be allowed.
|
|
437
|
+
* Calls the ZKML classifier and returns a structured decision.
|
|
438
|
+
*/
|
|
439
|
+
async checkAction(tx) {
|
|
440
|
+
const result = await this.sdk.classify(tx);
|
|
441
|
+
const allowed = result.decision === "approve";
|
|
442
|
+
let reason;
|
|
443
|
+
switch (result.decision) {
|
|
444
|
+
case "approve":
|
|
445
|
+
reason = `Approved: threat_score=${result.threatScore}`;
|
|
446
|
+
break;
|
|
447
|
+
case "escalate":
|
|
448
|
+
reason = `Escalated: threat_score=${result.threatScore}. Requires human approval.`;
|
|
449
|
+
break;
|
|
450
|
+
case "block":
|
|
451
|
+
reason = `Blocked: threat_score=${result.threatScore}. Action rejected by ZKML classifier.`;
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
return {
|
|
455
|
+
allowed,
|
|
456
|
+
decision: result.decision,
|
|
457
|
+
threatScore: result.threatScore,
|
|
458
|
+
reason,
|
|
459
|
+
ioCommitment: result.ioCommitment,
|
|
460
|
+
policyCommitment: result.policyCommitment,
|
|
461
|
+
proveTimeMs: result.proveTimeMs
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Check if a Bash command contains an on-chain transaction pattern.
|
|
466
|
+
* Returns the target address if found, null otherwise.
|
|
467
|
+
*/
|
|
468
|
+
extractTarget(command) {
|
|
469
|
+
if (!/(?:starkli|sncast)\s+(?:invoke|deploy)/.test(command) && !/(?:cast\s+send|transfer|approve)/.test(command)) {
|
|
470
|
+
return null;
|
|
471
|
+
}
|
|
472
|
+
const match = command.match(/0x[0-9a-fA-F]{10,66}/);
|
|
473
|
+
return match ? match[0] : null;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Build a canUseTool callback for the Claude Agent SDK.
|
|
477
|
+
*
|
|
478
|
+
* Returns an async function that:
|
|
479
|
+
* - Auto-allows ObelyZK policy tools
|
|
480
|
+
* - Auto-allows safe read-only tools (Read, Glob, Grep)
|
|
481
|
+
* - Classifies Bash commands containing on-chain transactions
|
|
482
|
+
* - Blocks everything else
|
|
483
|
+
*/
|
|
484
|
+
buildCanUseTool() {
|
|
485
|
+
return async (tool, input) => {
|
|
486
|
+
if (tool.startsWith("mcp__obelyzk-policy__")) {
|
|
487
|
+
return { approved: true };
|
|
488
|
+
}
|
|
489
|
+
const safeTools = ["Read", "Glob", "Grep", "Bash"];
|
|
490
|
+
if (!safeTools.includes(tool)) {
|
|
491
|
+
return {
|
|
492
|
+
approved: false,
|
|
493
|
+
reason: `Tool '${tool}' not in allowlist. Only safe tools and ObelyZK policy tools are allowed.`
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
if (tool === "Bash") {
|
|
497
|
+
const command = input.command || "";
|
|
498
|
+
const target = this.extractTarget(command);
|
|
499
|
+
if (target) {
|
|
500
|
+
const check = await this.checkAction({ target });
|
|
501
|
+
if (!check.allowed) {
|
|
502
|
+
return { approved: false, reason: check.reason };
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return { approved: true };
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Get the MCP server configuration for .claude/settings.json
|
|
511
|
+
* or Claude Agent SDK's mcpServers option.
|
|
512
|
+
*/
|
|
513
|
+
getMcpServerConfig() {
|
|
514
|
+
const mcpPath = this.config.mcpServerPath ?? "./node_modules/@obelyzk/sdk/src/mcp-policy/index.ts";
|
|
515
|
+
return {
|
|
516
|
+
"obelyzk-policy": {
|
|
517
|
+
command: "npx",
|
|
518
|
+
args: ["ts-node", mcpPath],
|
|
519
|
+
env: {
|
|
520
|
+
PROVER_URL: this.config.proverUrl,
|
|
521
|
+
STARKNET_RPC: this.config.rpcUrl ?? "",
|
|
522
|
+
FIREWALL_CONTRACT: this.config.firewallContract ?? "",
|
|
523
|
+
VERIFIER_CONTRACT: this.config.verifierContract ?? "",
|
|
524
|
+
PROVER_API_KEY: this.config.apiKey ?? ""
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Get the list of allowed tools for Claude Agent SDK.
|
|
531
|
+
* Includes safe read-only tools and all ObelyZK policy tools.
|
|
532
|
+
*/
|
|
533
|
+
getAllowedTools() {
|
|
534
|
+
return [
|
|
535
|
+
"Read",
|
|
536
|
+
"Glob",
|
|
537
|
+
"Grep",
|
|
538
|
+
"Bash",
|
|
539
|
+
"mcp__obelyzk-policy__obelyzk_classify",
|
|
540
|
+
"mcp__obelyzk-policy__obelyzk_agent_status",
|
|
541
|
+
"mcp__obelyzk-policy__obelyzk_check_action",
|
|
542
|
+
"mcp__obelyzk-policy__obelyzk_health",
|
|
543
|
+
"mcp__obelyzk-policy__obelyzk_get_policy",
|
|
544
|
+
"mcp__obelyzk-policy__obelyzk_list_models",
|
|
545
|
+
"mcp__obelyzk-policy__obelyzk_verify_proof",
|
|
546
|
+
"mcp__obelyzk-policy__obelyzk_register_agent",
|
|
547
|
+
"mcp__obelyzk-policy__obelyzk_submit_action",
|
|
548
|
+
"mcp__obelyzk-policy__obelyzk_resolve_action",
|
|
549
|
+
"mcp__obelyzk-policy__obelyzk_approve_escalated",
|
|
550
|
+
"mcp__obelyzk-policy__obelyzk_reject_escalated"
|
|
551
|
+
];
|
|
552
|
+
}
|
|
553
|
+
/** Get the underlying AgentFirewallSDK for advanced use. */
|
|
554
|
+
getSDK() {
|
|
555
|
+
return this.sdk;
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
// src/firewall/ciro.ts
|
|
560
|
+
var CiroClient = class {
|
|
561
|
+
baseUrl;
|
|
562
|
+
apiKey;
|
|
563
|
+
org;
|
|
564
|
+
timeout;
|
|
565
|
+
constructor(config) {
|
|
566
|
+
this.baseUrl = config.baseUrl.replace(/\/+$/, "");
|
|
567
|
+
this.apiKey = config.apiKey;
|
|
568
|
+
this.org = config.org ?? "obelyzk";
|
|
569
|
+
this.timeout = config.timeout ?? 1e4;
|
|
570
|
+
}
|
|
571
|
+
get apiBase() {
|
|
572
|
+
return `${this.baseUrl}/api/v1/blockchain`;
|
|
573
|
+
}
|
|
574
|
+
async request(method, path, body) {
|
|
575
|
+
const url = `${this.apiBase}${path}`;
|
|
576
|
+
const headers = {
|
|
577
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
578
|
+
"Content-Type": "application/json",
|
|
579
|
+
"X-Client": "obelyzk-sdk/1.0"
|
|
580
|
+
};
|
|
581
|
+
const controller = new AbortController();
|
|
582
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
583
|
+
try {
|
|
584
|
+
const response = await fetch(url, {
|
|
585
|
+
method,
|
|
586
|
+
headers,
|
|
587
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
588
|
+
signal: controller.signal
|
|
589
|
+
});
|
|
590
|
+
if (!response.ok) {
|
|
591
|
+
const error = await response.json().catch(() => ({ error: response.statusText }));
|
|
592
|
+
throw new Error(
|
|
593
|
+
`CIRO API error (${response.status}): ${error.error || response.statusText}`
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
return await response.json();
|
|
597
|
+
} finally {
|
|
598
|
+
clearTimeout(timer);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Enrich a transaction with CIRO intelligence.
|
|
603
|
+
* Returns target risk, sanctions status, Forta alerts, and behavioral context.
|
|
604
|
+
*/
|
|
605
|
+
async enrichTransaction(params) {
|
|
606
|
+
const raw = await this.request(
|
|
607
|
+
"POST",
|
|
608
|
+
"/transactions/enrich",
|
|
609
|
+
{
|
|
610
|
+
target: params.target,
|
|
611
|
+
sender: params.sender,
|
|
612
|
+
value: params.value ?? "0",
|
|
613
|
+
selector: params.selector ?? "0x0",
|
|
614
|
+
chain: "starknet"
|
|
615
|
+
}
|
|
616
|
+
);
|
|
617
|
+
return {
|
|
618
|
+
targetRisk: raw.target_risk ?? "unknown",
|
|
619
|
+
targetRiskScore: raw.target_risk_score ?? 0,
|
|
620
|
+
targetVerified: raw.target_verified ?? false,
|
|
621
|
+
targetIsProxy: raw.target_is_proxy ?? false,
|
|
622
|
+
targetHasSource: raw.target_has_source ?? false,
|
|
623
|
+
targetInteractionCount: raw.target_interaction_count ?? 0,
|
|
624
|
+
targetUniqueCallers: raw.target_unique_callers ?? 0,
|
|
625
|
+
targetFirstSeenBlocksAgo: raw.target_first_seen_blocks_ago ?? 0,
|
|
626
|
+
isSanctioned: raw.is_sanctioned ?? false,
|
|
627
|
+
sanctionLists: raw.sanction_lists ?? [],
|
|
628
|
+
fortaAlerts24h: raw.forta_alerts_24h ?? 0,
|
|
629
|
+
fortaSeverityMax: raw.forta_severity_max ?? null,
|
|
630
|
+
senderTxFrequency: raw.sender_tx_frequency ?? 0,
|
|
631
|
+
senderUniqueTargets24h: raw.sender_unique_targets_24h ?? 0,
|
|
632
|
+
senderAvgValue24h: raw.sender_avg_value_24h ?? 0,
|
|
633
|
+
senderMaxValue24h: raw.sender_max_value_24h ?? 0,
|
|
634
|
+
senderAgeBlocks: raw.sender_age_blocks ?? 0,
|
|
635
|
+
dataFreshnessS: raw.data_freshness_s ?? 0,
|
|
636
|
+
enrichmentTimeMs: raw.enrichment_time_ms ?? 0
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Get risk assessment for a specific address.
|
|
641
|
+
*/
|
|
642
|
+
async getAddressRisk(address) {
|
|
643
|
+
const raw = await this.request(
|
|
644
|
+
"GET",
|
|
645
|
+
`/addresses/${address}/risk`
|
|
646
|
+
);
|
|
647
|
+
return {
|
|
648
|
+
address: raw.address ?? address,
|
|
649
|
+
chain: raw.chain ?? "starknet",
|
|
650
|
+
riskLevel: raw.risk ?? "unknown",
|
|
651
|
+
riskScore: raw.risk_score ?? 0,
|
|
652
|
+
isContract: raw.is_contract ?? false,
|
|
653
|
+
isVerified: raw.is_verified ?? false,
|
|
654
|
+
isProxy: raw.is_proxy ?? false,
|
|
655
|
+
isSanctioned: raw.is_sanctioned ?? false,
|
|
656
|
+
sanctionLists: raw.sanction_lists ?? [],
|
|
657
|
+
fortaAlertsCount: raw.forta_alerts_count ?? 0,
|
|
658
|
+
knownExploitInvolvement: raw.known_exploit_involvement ?? false,
|
|
659
|
+
exploitNames: raw.exploit_names ?? [],
|
|
660
|
+
totalTxCount: raw.total_tx_count ?? 0,
|
|
661
|
+
clusterSize: raw.cluster_size ?? 0
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Get recent alerts from CIRO's detection pipeline.
|
|
666
|
+
*/
|
|
667
|
+
async getRecentAlerts(params) {
|
|
668
|
+
const query = new URLSearchParams();
|
|
669
|
+
if (params?.severity) query.set("severity", params.severity);
|
|
670
|
+
if (params?.limit) query.set("limit", String(params.limit));
|
|
671
|
+
const queryStr = query.toString();
|
|
672
|
+
const path = `/alerts/recent${queryStr ? `?${queryStr}` : ""}`;
|
|
673
|
+
const raw = await this.request("GET", path);
|
|
674
|
+
const alerts = raw.alerts ?? [];
|
|
675
|
+
return alerts.map((a) => ({
|
|
676
|
+
alertId: a.alert_id ?? "",
|
|
677
|
+
source: a.source ?? "",
|
|
678
|
+
severity: a.severity ?? "INFO",
|
|
679
|
+
chain: a.chain ?? "starknet",
|
|
680
|
+
timestamp: a.timestamp ?? "",
|
|
681
|
+
addresses: a.addresses ?? [],
|
|
682
|
+
txHash: a.tx_hash ?? null,
|
|
683
|
+
name: a.name ?? "",
|
|
684
|
+
description: a.description ?? ""
|
|
685
|
+
}));
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Get data lake statistics.
|
|
689
|
+
*/
|
|
690
|
+
async getStats() {
|
|
691
|
+
const raw = await this.request("GET", "/stats");
|
|
692
|
+
return {
|
|
693
|
+
totalTransactions: raw.total_transactions ?? 0,
|
|
694
|
+
labeledTransactions: raw.labeled_transactions ?? 0,
|
|
695
|
+
labelDistribution: raw.label_distribution ?? {},
|
|
696
|
+
lastUpdated: raw.last_updated ?? "",
|
|
697
|
+
fortaBotsActive: raw.forta_bots_active ?? 0,
|
|
698
|
+
addressesIndexed: raw.addresses_indexed ?? 0,
|
|
699
|
+
sanctionedAddresses: raw.sanctioned_addresses ?? 0
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
};
|
|
229
703
|
// Annotate the CommonJS export names for ESM import in node:
|
|
230
704
|
0 && (module.exports = {
|
|
231
|
-
AgentFirewallSDK
|
|
705
|
+
AgentFirewallSDK,
|
|
706
|
+
CiroClient,
|
|
707
|
+
PolicyEnforcer,
|
|
708
|
+
createPolicyEnforcer
|
|
232
709
|
});
|
package/dist/firewall/index.mjs
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
PolicyEnforcer,
|
|
3
|
+
createPolicyEnforcer
|
|
4
|
+
} from "../chunk-DGYMDV5X.mjs";
|
|
5
|
+
import {
|
|
6
|
+
AgentFirewallSDK,
|
|
7
|
+
CiroClient
|
|
8
|
+
} from "../chunk-Y4PBMUWM.mjs";
|
|
9
|
+
import "../chunk-XGB3TDIC.mjs";
|
|
5
10
|
export {
|
|
6
|
-
AgentFirewallSDK
|
|
11
|
+
AgentFirewallSDK,
|
|
12
|
+
CiroClient,
|
|
13
|
+
PolicyEnforcer,
|
|
14
|
+
createPolicyEnforcer
|
|
7
15
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { W as WsConfig, a as WebSocketClient, b as WsEvent, P as PrivacyKeyPair, E as ECPoint, c as ElGamalCiphertext, A as AEHint, d as EncryptedBalance, S as SchnorrProof, T as TransferProof } from './tee-CiR0hpfm.mjs';
|
|
2
2
|
export { cv as AccountHints, cz as AuditReport, ag as BatchClient, aS as BatchJobResponse, aV as BatchOperation, aU as BatchOperationType, bZ as BatchStatus, aT as BatchStatusResponse, aX as BatchVerifyRequest, aY as BatchVerifyResponse, B as BitSageClient, bH as BurnEvent, au as CAPABILITY_FLAGS, c6 as ChallengeParams, c7 as ChallengeStatus, cL as CheckpointStatus, C as ClientConfig, c4 as CompressedProof, c3 as CompressionStats, cK as ComputeCheckpoint, I as ContractClient, _ as ContractConfig, aa as ContractRegistry, bN as CreateProposalParams, co as DAILY_CAPS, D as DEFAULT_CONFIG, K as DEFAULT_CONTRACT_CONFIG, cP as DEFAULT_DISCOUNT_TIERS, cQ as DEFAULT_FEE_DISTRIBUTION, y as DEFAULT_HTTP_CONFIG, z as DEFAULT_WS_CONFIG, bs as DKGShare, ch as DailyStats, ae as DashboardClient, bP as DelegationInfo, cD as DiscountTiers, b7 as DisputeRecord, cR as DisputeStatus, bI as EcosystemEmissionStatus, c5 as EnclaveInfo, cT as ExecutionMetrics, ab as ExternalTokens, v as FaucetClaimResponse, F as FaucetStatus, cE as FeeDistribution, az as GOVERNANCE_CONFIG, cp as GPU_MULTIPLIERS, aW as GasEstimate, ax as GovernanceClient, bx as GovernanceClientConfig, bB as GovernanceProposal, bC as GovernanceRights, bD as GovernanceStats, by as GovernanceTransactionResult, ce as GpuAttestation, aI as GpuMetrics, aJ as GpuMetricsResponse, bY as GpuTeeProofParams, G as GpuTier, cq as HALVENING_SCHEDULE, aL as HistoryPeriod, b2 as HolderTier, H as HttpClient, U as HttpConfig, aO as JobAnalytics, J as JobId, cH as JobPaymentRecord, t as JobResult, i as JobStatus, s as JobStatusResponse, h as JobType, V as JobUpdateEvent, a3 as LOCAL_CONTRACTS, bg as LeaderboardEntry, bf as LeaderboardMetric, L as ListJobsParams, u as ListJobsResponse, a2 as MAINNET_CONTRACTS, a7 as MAINNET_TOKENS, ai as MAX_BATCH_SIZE, an as MIN_STAKE, bK as MilestoneStatus, ac as MiningClient, aF as MiningClientConfig, ck as MiningConfig, cm as MiningGpuTier, cj as MiningPoolStatus, bq as MixingOutput, bp as MixingTransaction, cy as MultiAssetBalance, bu as MultiAssetBalances, N as Network, o as NetworkStats, Y as NetworkStatsEvent, aR as NetworkWorkersResponse, cF as OTCConfig, a9 as PRAGMA_ORACLE, cC as PaymentQuote, cG as PaymentStats, cI as PaymentStatus, cB as PaymentToken, aj as PaymentsClient, aZ as PaymentsClientConfig, bM as PendingTransfer, be as PerformanceData, bE as PoolBalances, bk as PrivacyAsset, av as PrivacyClient, bi as PrivacyClientConfig, cM as PrivacyCreditDeposit, cN as PrivacyCreditUsage, bj as PrivacyTransactionResult, bl as PrivateAccount, bv as PrivateSwapParams, bm as PrivateTransferParams, bn as PrivateTransferWithAuditParams, cA as PrivateWorkerPayment, n as ProofDetails, b_ as ProofJobSpec, bX as ProofMetadata, c0 as ProofPriority, bU as ProofSource, c1 as ProofSubmission, b$ as ProofType, k as ProofVerificationStatus, Z as ProofVerifiedEvent, bz as ProposalStatus, bA as ProposalType, c2 as ProverMetrics, br as RagequitProof, bL as RateLimitInfo, aP as RecentJob, bh as RegisterWorkerParams, aM as RewardHistoryEntry, aN as RewardHistoryResponse, cl as RewardResult, aK as RewardsInfo, cw as RingMember, cx as RingSignature, a1 as SEPOLIA_CONTRACTS, a6 as SEPOLIA_TOKENS, ao as SLASH_PERCENTAGES, cn as STAKE_TIER_THRESHOLDS, cu as SameEncryption3Proof, e as SdkError, bG as SecurityBudget, b3 as SlashReason, b6 as SlashRecord, p as StakeInfo, cg as StakeTier, al as StakingClient, a_ as StakingClientConfig, b5 as StakingConfig, a$ as StakingTransactionResult, bw as StealthAddress, bo as SteganographicTransaction, aA as StwoClient, bR as StwoClientConfig, bV as StwoTeeType, bS as StwoTransactionResult, q as SubmitJobRequest, r as SubmitJobResponse, bW as TeeAttestation, cc as TeeChallengeParams, cd as TeeChallengeStatus, aD as TeeClient, c8 as TeeClientConfig, cb as TeeJobResult, cS as TeeQuote, ca as TeeResultParams, c9 as TeeTransactionResult, b0 as TeeType, bt as ThresholdDecryptionRequest, bJ as TokenFlowSummary, $ as TransactionReceipt, cO as TransactionResult, a0 as TxStatus, ap as UNSTAKE_LOCKUP_SECS, b9 as UnstakeRequest, aC as VERIFICATION_CONFIG, aG as ValidatorStatus, aH as ValidatorStatusResponse, cJ as VerificationSource, bT as VerificationStatus, bF as VestingStatus, bO as VoteDirection, bQ as VoterInfo, f as WalletConfig, l as WorkerCapabilities, bc as WorkerCapabilitiesExtended, g as WorkerId, m as WorkerInfo, ci as WorkerMiningStats, bd as WorkerProfile, b4 as WorkerStake, j as WorkerStatus, aQ as WorkerSummary, cf as WorkerTeeStatus, b1 as WorkerTier, b8 as WorkerTierBenefits, X as WorkerUpdateEvent, as as WorkersClient, ba as WorkersClientConfig, bb as WorkersTransactionResult, ah as createBatchClient, af as createDashboardClient, ay as createGovernanceClient, ad as createMiningClient, ak as createPaymentsClient, aw as createPrivacyClient, am as createStakingClient, aB as createStwoClient, aE as createTeeClient, at as createWorkersClient, O as fromFelt, a4 as getContractsForNetwork, cs as getDailyCapForTier, ct as getGpuMultiplier, x as getGpuTier, w as getMinStake, ar as getMinStakeForTier, cr as getStakeTierFromAmount, a8 as getTokensForNetwork, a5 as isContractConfigured, aq as isWorkerEligible, R as joinU256, Q as splitU256, M as toFelt } from './tee-CiR0hpfm.mjs';
|
|
3
|
-
export { AgentFirewallSDK, AgentStatus, ClassifyResult, Decision, FirewallConfig, TransactionFeatures } from './
|
|
3
|
+
export { A as AgentFirewallSDK, a as AgentStatus, C as ClassifyResult, D as Decision, F as FirewallConfig, T as TransactionFeatures } from './client-DFxKbDns.mjs';
|
|
4
4
|
export { AssetId, BalanceProof, CURVE_ORDER, ConfidentialOrder, ConfidentialSwapClient, ConfidentialSwapConfig, CreateOrderRequest, CreateOrderResponse, ElGamalKeyPair, FIELD_PRIME, GENERATOR_G, GENERATOR_H, ElGamalCiphertext as ObelyskCiphertext, EncryptionProof as ObelyskEncryptionProof, default as ObelyskPrivacy, RangeProof, RateProof, SwapHistoryEntry, SwapProofBundle, TakeOrderResponse, addMod, ecAdd, ecDouble, ecMul, invMod, isIdentity, mulMod, poseidonHash, powMod, randomScalar, subMod } from './privacy/index.mjs';
|
|
5
5
|
import 'starknet';
|
|
6
6
|
|
|
@@ -692,6 +692,34 @@ declare class StwoProverClient {
|
|
|
692
692
|
/**
|
|
693
693
|
* Generate proof for AI/ML inference
|
|
694
694
|
*/
|
|
695
|
+
/**
|
|
696
|
+
* Verifiable chat inference — send a prompt, get a response with on-chain proof.
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```typescript
|
|
700
|
+
* const result = await prover.chat("What is 2+2?", { model: "local", maxTokens: 1 });
|
|
701
|
+
* console.log(result.text); // model output
|
|
702
|
+
* console.log(result.txHash); // Starknet TX hash
|
|
703
|
+
* console.log(result.explorerUrl); // Starkscan link
|
|
704
|
+
* console.log(result.calldataFelts); // ~950 felts
|
|
705
|
+
* console.log(result.modelId); // weight commitment hash
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
chat(prompt: string, options?: {
|
|
709
|
+
model?: string;
|
|
710
|
+
maxTokens?: number;
|
|
711
|
+
sessionId?: string;
|
|
712
|
+
}): Promise<{
|
|
713
|
+
text: string;
|
|
714
|
+
txHash?: string;
|
|
715
|
+
proofHash?: string;
|
|
716
|
+
modelId?: string;
|
|
717
|
+
ioCommitment?: string;
|
|
718
|
+
calldataFelts?: number;
|
|
719
|
+
explorerUrl?: string;
|
|
720
|
+
proveTimeSecs?: number;
|
|
721
|
+
trustModel: string;
|
|
722
|
+
}>;
|
|
695
723
|
proveInference(modelId: string, inputs: bigint[], outputs: bigint[], options?: {
|
|
696
724
|
priority?: ProofJobPriority;
|
|
697
725
|
requireTee?: boolean;
|
|
@@ -911,4 +939,4 @@ declare function printObelyskanBanner(): void;
|
|
|
911
939
|
*/
|
|
912
940
|
declare function getVersionBanner(version: string): string;
|
|
913
941
|
|
|
914
|
-
export { AEHint, BITSAGE_BANNER, BITSAGE_LOGO, BITSAGE_TAGLINE, type BatchProofRequest, type BatchProofResponse, DEFAULT_PROVER_CONFIG, ECPoint, ElGamalCiphertext, EncryptedBalance, EncryptionHelper, GPU_TIERS, OBELYSK_BANNER, OBELYSK_LOGO, OBELYSK_TAGLINE, PROOF_TYPES, PrivacyKeyManager, PrivacyKeyPair, type ProofCostEstimate, type ProofGenerationStatus, type ProofJobPriority, type ProofJobRequest, type ProofJobResponse, type ProofJobStatus, type ProofResult, SchnorrProof, type GpuTier as StwoGpuTier, type ProofType as StwoProofType, StwoProverClient, type StwoProverConfig, type ProverMetrics as StwoProverMetrics, TransferProof, type UseWebSocketResult, WebSocketClient, WsConfig, WsEvent, createStwoProverClient, createTransferProof, createWebSocketClient, getPrivacyDerivationMessage, getVersionBanner, isValidPublicKey, printBitsageBanner, printObelyskanBanner, verifyTransferProof };
|
|
942
|
+
export { AEHint, BITSAGE_BANNER, BITSAGE_LOGO, BITSAGE_TAGLINE, type BatchProofRequest, type BatchProofResponse, DEFAULT_PROVER_CONFIG, ECPoint, ElGamalCiphertext, EncryptedBalance, EncryptionHelper, GPU_TIERS, OBELYSK_BANNER, OBELYSK_LOGO, OBELYSK_TAGLINE, PROOF_TYPES, PrivacyKeyManager, PrivacyKeyPair, type ProofCostEstimate, type ProofGenerationStatus, type ProofJobPriority, type ProofJobRequest, type ProofJobResponse, type ProofJobStatus, type ProofResult, SchnorrProof, type GpuTier as StwoGpuTier, type ProofType as StwoProofType, StwoProverClient, type StwoProverConfig, type ProverMetrics as StwoProverMetrics, TransferProof, type UseWebSocketResult, WebSocketClient, WsConfig, WsEvent, createStwoProverClient as createProverClient, createStwoProverClient, createTransferProof, createWebSocketClient, getPrivacyDerivationMessage, getVersionBanner, isValidPublicKey, printBitsageBanner, printObelyskanBanner, verifyTransferProof };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { W as WsConfig, a as WebSocketClient, b as WsEvent, P as PrivacyKeyPair, E as ECPoint, c as ElGamalCiphertext, A as AEHint, d as EncryptedBalance, S as SchnorrProof, T as TransferProof } from './tee-CiR0hpfm.js';
|
|
2
2
|
export { cv as AccountHints, cz as AuditReport, ag as BatchClient, aS as BatchJobResponse, aV as BatchOperation, aU as BatchOperationType, bZ as BatchStatus, aT as BatchStatusResponse, aX as BatchVerifyRequest, aY as BatchVerifyResponse, B as BitSageClient, bH as BurnEvent, au as CAPABILITY_FLAGS, c6 as ChallengeParams, c7 as ChallengeStatus, cL as CheckpointStatus, C as ClientConfig, c4 as CompressedProof, c3 as CompressionStats, cK as ComputeCheckpoint, I as ContractClient, _ as ContractConfig, aa as ContractRegistry, bN as CreateProposalParams, co as DAILY_CAPS, D as DEFAULT_CONFIG, K as DEFAULT_CONTRACT_CONFIG, cP as DEFAULT_DISCOUNT_TIERS, cQ as DEFAULT_FEE_DISTRIBUTION, y as DEFAULT_HTTP_CONFIG, z as DEFAULT_WS_CONFIG, bs as DKGShare, ch as DailyStats, ae as DashboardClient, bP as DelegationInfo, cD as DiscountTiers, b7 as DisputeRecord, cR as DisputeStatus, bI as EcosystemEmissionStatus, c5 as EnclaveInfo, cT as ExecutionMetrics, ab as ExternalTokens, v as FaucetClaimResponse, F as FaucetStatus, cE as FeeDistribution, az as GOVERNANCE_CONFIG, cp as GPU_MULTIPLIERS, aW as GasEstimate, ax as GovernanceClient, bx as GovernanceClientConfig, bB as GovernanceProposal, bC as GovernanceRights, bD as GovernanceStats, by as GovernanceTransactionResult, ce as GpuAttestation, aI as GpuMetrics, aJ as GpuMetricsResponse, bY as GpuTeeProofParams, G as GpuTier, cq as HALVENING_SCHEDULE, aL as HistoryPeriod, b2 as HolderTier, H as HttpClient, U as HttpConfig, aO as JobAnalytics, J as JobId, cH as JobPaymentRecord, t as JobResult, i as JobStatus, s as JobStatusResponse, h as JobType, V as JobUpdateEvent, a3 as LOCAL_CONTRACTS, bg as LeaderboardEntry, bf as LeaderboardMetric, L as ListJobsParams, u as ListJobsResponse, a2 as MAINNET_CONTRACTS, a7 as MAINNET_TOKENS, ai as MAX_BATCH_SIZE, an as MIN_STAKE, bK as MilestoneStatus, ac as MiningClient, aF as MiningClientConfig, ck as MiningConfig, cm as MiningGpuTier, cj as MiningPoolStatus, bq as MixingOutput, bp as MixingTransaction, cy as MultiAssetBalance, bu as MultiAssetBalances, N as Network, o as NetworkStats, Y as NetworkStatsEvent, aR as NetworkWorkersResponse, cF as OTCConfig, a9 as PRAGMA_ORACLE, cC as PaymentQuote, cG as PaymentStats, cI as PaymentStatus, cB as PaymentToken, aj as PaymentsClient, aZ as PaymentsClientConfig, bM as PendingTransfer, be as PerformanceData, bE as PoolBalances, bk as PrivacyAsset, av as PrivacyClient, bi as PrivacyClientConfig, cM as PrivacyCreditDeposit, cN as PrivacyCreditUsage, bj as PrivacyTransactionResult, bl as PrivateAccount, bv as PrivateSwapParams, bm as PrivateTransferParams, bn as PrivateTransferWithAuditParams, cA as PrivateWorkerPayment, n as ProofDetails, b_ as ProofJobSpec, bX as ProofMetadata, c0 as ProofPriority, bU as ProofSource, c1 as ProofSubmission, b$ as ProofType, k as ProofVerificationStatus, Z as ProofVerifiedEvent, bz as ProposalStatus, bA as ProposalType, c2 as ProverMetrics, br as RagequitProof, bL as RateLimitInfo, aP as RecentJob, bh as RegisterWorkerParams, aM as RewardHistoryEntry, aN as RewardHistoryResponse, cl as RewardResult, aK as RewardsInfo, cw as RingMember, cx as RingSignature, a1 as SEPOLIA_CONTRACTS, a6 as SEPOLIA_TOKENS, ao as SLASH_PERCENTAGES, cn as STAKE_TIER_THRESHOLDS, cu as SameEncryption3Proof, e as SdkError, bG as SecurityBudget, b3 as SlashReason, b6 as SlashRecord, p as StakeInfo, cg as StakeTier, al as StakingClient, a_ as StakingClientConfig, b5 as StakingConfig, a$ as StakingTransactionResult, bw as StealthAddress, bo as SteganographicTransaction, aA as StwoClient, bR as StwoClientConfig, bV as StwoTeeType, bS as StwoTransactionResult, q as SubmitJobRequest, r as SubmitJobResponse, bW as TeeAttestation, cc as TeeChallengeParams, cd as TeeChallengeStatus, aD as TeeClient, c8 as TeeClientConfig, cb as TeeJobResult, cS as TeeQuote, ca as TeeResultParams, c9 as TeeTransactionResult, b0 as TeeType, bt as ThresholdDecryptionRequest, bJ as TokenFlowSummary, $ as TransactionReceipt, cO as TransactionResult, a0 as TxStatus, ap as UNSTAKE_LOCKUP_SECS, b9 as UnstakeRequest, aC as VERIFICATION_CONFIG, aG as ValidatorStatus, aH as ValidatorStatusResponse, cJ as VerificationSource, bT as VerificationStatus, bF as VestingStatus, bO as VoteDirection, bQ as VoterInfo, f as WalletConfig, l as WorkerCapabilities, bc as WorkerCapabilitiesExtended, g as WorkerId, m as WorkerInfo, ci as WorkerMiningStats, bd as WorkerProfile, b4 as WorkerStake, j as WorkerStatus, aQ as WorkerSummary, cf as WorkerTeeStatus, b1 as WorkerTier, b8 as WorkerTierBenefits, X as WorkerUpdateEvent, as as WorkersClient, ba as WorkersClientConfig, bb as WorkersTransactionResult, ah as createBatchClient, af as createDashboardClient, ay as createGovernanceClient, ad as createMiningClient, ak as createPaymentsClient, aw as createPrivacyClient, am as createStakingClient, aB as createStwoClient, aE as createTeeClient, at as createWorkersClient, O as fromFelt, a4 as getContractsForNetwork, cs as getDailyCapForTier, ct as getGpuMultiplier, x as getGpuTier, w as getMinStake, ar as getMinStakeForTier, cr as getStakeTierFromAmount, a8 as getTokensForNetwork, a5 as isContractConfigured, aq as isWorkerEligible, R as joinU256, Q as splitU256, M as toFelt } from './tee-CiR0hpfm.js';
|
|
3
|
-
export { AgentFirewallSDK, AgentStatus, ClassifyResult, Decision, FirewallConfig, TransactionFeatures } from './
|
|
3
|
+
export { A as AgentFirewallSDK, a as AgentStatus, C as ClassifyResult, D as Decision, F as FirewallConfig, T as TransactionFeatures } from './client-DFxKbDns.js';
|
|
4
4
|
export { AssetId, BalanceProof, CURVE_ORDER, ConfidentialOrder, ConfidentialSwapClient, ConfidentialSwapConfig, CreateOrderRequest, CreateOrderResponse, ElGamalKeyPair, FIELD_PRIME, GENERATOR_G, GENERATOR_H, ElGamalCiphertext as ObelyskCiphertext, EncryptionProof as ObelyskEncryptionProof, default as ObelyskPrivacy, RangeProof, RateProof, SwapHistoryEntry, SwapProofBundle, TakeOrderResponse, addMod, ecAdd, ecDouble, ecMul, invMod, isIdentity, mulMod, poseidonHash, powMod, randomScalar, subMod } from './privacy/index.js';
|
|
5
5
|
import 'starknet';
|
|
6
6
|
|
|
@@ -692,6 +692,34 @@ declare class StwoProverClient {
|
|
|
692
692
|
/**
|
|
693
693
|
* Generate proof for AI/ML inference
|
|
694
694
|
*/
|
|
695
|
+
/**
|
|
696
|
+
* Verifiable chat inference — send a prompt, get a response with on-chain proof.
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```typescript
|
|
700
|
+
* const result = await prover.chat("What is 2+2?", { model: "local", maxTokens: 1 });
|
|
701
|
+
* console.log(result.text); // model output
|
|
702
|
+
* console.log(result.txHash); // Starknet TX hash
|
|
703
|
+
* console.log(result.explorerUrl); // Starkscan link
|
|
704
|
+
* console.log(result.calldataFelts); // ~950 felts
|
|
705
|
+
* console.log(result.modelId); // weight commitment hash
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
chat(prompt: string, options?: {
|
|
709
|
+
model?: string;
|
|
710
|
+
maxTokens?: number;
|
|
711
|
+
sessionId?: string;
|
|
712
|
+
}): Promise<{
|
|
713
|
+
text: string;
|
|
714
|
+
txHash?: string;
|
|
715
|
+
proofHash?: string;
|
|
716
|
+
modelId?: string;
|
|
717
|
+
ioCommitment?: string;
|
|
718
|
+
calldataFelts?: number;
|
|
719
|
+
explorerUrl?: string;
|
|
720
|
+
proveTimeSecs?: number;
|
|
721
|
+
trustModel: string;
|
|
722
|
+
}>;
|
|
695
723
|
proveInference(modelId: string, inputs: bigint[], outputs: bigint[], options?: {
|
|
696
724
|
priority?: ProofJobPriority;
|
|
697
725
|
requireTee?: boolean;
|
|
@@ -911,4 +939,4 @@ declare function printObelyskanBanner(): void;
|
|
|
911
939
|
*/
|
|
912
940
|
declare function getVersionBanner(version: string): string;
|
|
913
941
|
|
|
914
|
-
export { AEHint, BITSAGE_BANNER, BITSAGE_LOGO, BITSAGE_TAGLINE, type BatchProofRequest, type BatchProofResponse, DEFAULT_PROVER_CONFIG, ECPoint, ElGamalCiphertext, EncryptedBalance, EncryptionHelper, GPU_TIERS, OBELYSK_BANNER, OBELYSK_LOGO, OBELYSK_TAGLINE, PROOF_TYPES, PrivacyKeyManager, PrivacyKeyPair, type ProofCostEstimate, type ProofGenerationStatus, type ProofJobPriority, type ProofJobRequest, type ProofJobResponse, type ProofJobStatus, type ProofResult, SchnorrProof, type GpuTier as StwoGpuTier, type ProofType as StwoProofType, StwoProverClient, type StwoProverConfig, type ProverMetrics as StwoProverMetrics, TransferProof, type UseWebSocketResult, WebSocketClient, WsConfig, WsEvent, createStwoProverClient, createTransferProof, createWebSocketClient, getPrivacyDerivationMessage, getVersionBanner, isValidPublicKey, printBitsageBanner, printObelyskanBanner, verifyTransferProof };
|
|
942
|
+
export { AEHint, BITSAGE_BANNER, BITSAGE_LOGO, BITSAGE_TAGLINE, type BatchProofRequest, type BatchProofResponse, DEFAULT_PROVER_CONFIG, ECPoint, ElGamalCiphertext, EncryptedBalance, EncryptionHelper, GPU_TIERS, OBELYSK_BANNER, OBELYSK_LOGO, OBELYSK_TAGLINE, PROOF_TYPES, PrivacyKeyManager, PrivacyKeyPair, type ProofCostEstimate, type ProofGenerationStatus, type ProofJobPriority, type ProofJobRequest, type ProofJobResponse, type ProofJobStatus, type ProofResult, SchnorrProof, type GpuTier as StwoGpuTier, type ProofType as StwoProofType, StwoProverClient, type StwoProverConfig, type ProverMetrics as StwoProverMetrics, TransferProof, type UseWebSocketResult, WebSocketClient, WsConfig, WsEvent, createStwoProverClient as createProverClient, createStwoProverClient, createTransferProof, createWebSocketClient, getPrivacyDerivationMessage, getVersionBanner, isValidPublicKey, printBitsageBanner, printObelyskanBanner, verifyTransferProof };
|