@vorim/sdk 3.8.1 → 3.10.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/dist/index.cjs +208 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +133 -3
- package/dist/index.d.ts +133 -3
- package/dist/index.js +208 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/anthropic.d.cts +1 -1
- package/dist/integrations/anthropic.d.ts +1 -1
- package/dist/integrations/ap2.cjs +218 -0
- package/dist/integrations/ap2.cjs.map +1 -0
- package/dist/integrations/ap2.d.cts +95 -0
- package/dist/integrations/ap2.d.ts +95 -0
- package/dist/integrations/ap2.js +192 -0
- package/dist/integrations/ap2.js.map +1 -0
- package/dist/integrations/bank-rails.cjs +173 -0
- package/dist/integrations/bank-rails.cjs.map +1 -0
- package/dist/integrations/bank-rails.d.cts +87 -0
- package/dist/integrations/bank-rails.d.ts +87 -0
- package/dist/integrations/bank-rails.js +147 -0
- package/dist/integrations/bank-rails.js.map +1 -0
- package/dist/integrations/circle.cjs +159 -0
- package/dist/integrations/circle.cjs.map +1 -0
- package/dist/integrations/circle.d.cts +75 -0
- package/dist/integrations/circle.d.ts +75 -0
- package/dist/integrations/circle.js +133 -0
- package/dist/integrations/circle.js.map +1 -0
- package/dist/integrations/crewai.d.cts +1 -1
- package/dist/integrations/crewai.d.ts +1 -1
- package/dist/integrations/hermes.d.cts +1 -1
- package/dist/integrations/hermes.d.ts +1 -1
- package/dist/integrations/langchain.d.cts +1 -1
- package/dist/integrations/langchain.d.ts +1 -1
- package/dist/integrations/langgraph.d.cts +1 -1
- package/dist/integrations/langgraph.d.ts +1 -1
- package/dist/integrations/llamaindex.d.cts +1 -1
- package/dist/integrations/llamaindex.d.ts +1 -1
- package/dist/integrations/modern-treasury.cjs +178 -0
- package/dist/integrations/modern-treasury.cjs.map +1 -0
- package/dist/integrations/modern-treasury.d.cts +90 -0
- package/dist/integrations/modern-treasury.d.ts +90 -0
- package/dist/integrations/modern-treasury.js +152 -0
- package/dist/integrations/modern-treasury.js.map +1 -0
- package/dist/integrations/nekuda.cjs +165 -0
- package/dist/integrations/nekuda.cjs.map +1 -0
- package/dist/integrations/nekuda.d.cts +79 -0
- package/dist/integrations/nekuda.d.ts +79 -0
- package/dist/integrations/nekuda.js +139 -0
- package/dist/integrations/nekuda.js.map +1 -0
- package/dist/integrations/openai.d.cts +1 -1
- package/dist/integrations/openai.d.ts +1 -1
- package/dist/integrations/paypal-agent.cjs +215 -0
- package/dist/integrations/paypal-agent.cjs.map +1 -0
- package/dist/integrations/paypal-agent.d.cts +87 -0
- package/dist/integrations/paypal-agent.d.ts +87 -0
- package/dist/integrations/paypal-agent.js +189 -0
- package/dist/integrations/paypal-agent.js.map +1 -0
- package/dist/integrations/plaid.cjs +174 -0
- package/dist/integrations/plaid.cjs.map +1 -0
- package/dist/integrations/plaid.d.cts +86 -0
- package/dist/integrations/plaid.d.ts +86 -0
- package/dist/integrations/plaid.js +148 -0
- package/dist/integrations/plaid.js.map +1 -0
- package/dist/integrations/siem.d.cts +1 -1
- package/dist/integrations/siem.d.ts +1 -1
- package/dist/integrations/skyfire.cjs +166 -0
- package/dist/integrations/skyfire.cjs.map +1 -0
- package/dist/integrations/skyfire.d.cts +80 -0
- package/dist/integrations/skyfire.d.ts +80 -0
- package/dist/integrations/skyfire.js +140 -0
- package/dist/integrations/skyfire.js.map +1 -0
- package/dist/integrations/stripe-acp.d.cts +1 -1
- package/dist/integrations/stripe-acp.d.ts +1 -1
- package/dist/integrations/ucp.d.cts +1 -1
- package/dist/integrations/ucp.d.ts +1 -1
- package/dist/integrations/vercel-ai.d.cts +1 -1
- package/dist/integrations/vercel-ai.d.ts +1 -1
- package/dist/integrations/x402.cjs +211 -0
- package/dist/integrations/x402.cjs.map +1 -0
- package/dist/integrations/x402.d.cts +87 -0
- package/dist/integrations/x402.d.ts +87 -0
- package/dist/integrations/x402.js +185 -0
- package/dist/integrations/x402.js.map +1 -0
- package/dist/{types-Cb6V-boJ.d.cts → types-zzK9YOoa.d.cts} +86 -1
- package/dist/{types-Cb6V-boJ.d.ts → types-zzK9YOoa.d.ts} +86 -1
- package/package.json +91 -1
package/dist/index.cjs
CHANGED
|
@@ -124,7 +124,7 @@ async function prepareReplayContext(inputs) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// src/index.ts
|
|
127
|
-
var SDK_VERSION = true ? "3.
|
|
127
|
+
var SDK_VERSION = true ? "3.10.0" : "0.0.0";
|
|
128
128
|
var USER_AGENT = `vorim-sdk/${SDK_VERSION}`;
|
|
129
129
|
function sleep(ms) {
|
|
130
130
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -423,6 +423,213 @@ var VorimSDK = class _VorimSDK {
|
|
|
423
423
|
async revokeAgentDelegation(agentId, chainId) {
|
|
424
424
|
return this.delete(`/agents/${agentId}/delegations/${chainId}`);
|
|
425
425
|
}
|
|
426
|
+
/**
|
|
427
|
+
* Reconstruct a multi-agent workflow's provenance graph from a delegation
|
|
428
|
+
* chain id — the nodes (agents), edges (who delegated what to whom), and the
|
|
429
|
+
* audit events attributed to each agent within that workflow. Multi-agent
|
|
430
|
+
* fabric Phase 1: the tamper-evident answer to "which agents did what, and
|
|
431
|
+
* who authorised whom?" across a whole hand-off chain.
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```ts
|
|
435
|
+
* const graph = await vorim.getWorkflowGraph('chain_abc123');
|
|
436
|
+
* for (const edge of graph.edges) {
|
|
437
|
+
* console.log(`${edge.from} -> ${edge.to} [${edge.scopes.join(', ')}]`);
|
|
438
|
+
* }
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
async getWorkflowGraph(chainId, options) {
|
|
442
|
+
const qs = options?.maxEvents ? `?max_events=${options.maxEvents}` : "";
|
|
443
|
+
return this.get(`/audit/workflow-graph/${chainId}${qs}`);
|
|
444
|
+
}
|
|
445
|
+
// ─── Governed Shared Memory (multi-agent fabric, Phase 2) ──────────
|
|
446
|
+
/**
|
|
447
|
+
* Write (upsert) an entry into the org's governed shared-memory pool,
|
|
448
|
+
* attributed to `agentId`.
|
|
449
|
+
*
|
|
450
|
+
* If the SDK holds the agent's private key (via {@link VorimSDK.register}
|
|
451
|
+
* or {@link VorimSDK.useAgentKey}), the entry is signed at source with the
|
|
452
|
+
* agent's Ed25519 key over the canonical entry (namespace + key + value +
|
|
453
|
+
* agent_id) before it leaves the process, and the server verifies it against
|
|
454
|
+
* the agent's stored public key — rejecting a bad signature (fail closed).
|
|
455
|
+
* This is what makes a poisoned entry always traceable to its source
|
|
456
|
+
* (OWASP ASI06). If no key is available, the entry is written unsigned.
|
|
457
|
+
*
|
|
458
|
+
* A write to an existing (namespace, key) updates it, recording the new
|
|
459
|
+
* writer + signature.
|
|
460
|
+
*
|
|
461
|
+
* Requires an API key with the `memory:write` scope.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```ts
|
|
465
|
+
* await vorim.writeMemory('agid_researcher_abc', {
|
|
466
|
+
* namespace: 'research-run-42',
|
|
467
|
+
* key: 'sources',
|
|
468
|
+
* value: { urls: ['https://…'], gathered_at: '2026-07-25T…' },
|
|
469
|
+
* });
|
|
470
|
+
* ```
|
|
471
|
+
*/
|
|
472
|
+
async writeMemory(agentId, entry) {
|
|
473
|
+
const body = {
|
|
474
|
+
agent_id: agentId,
|
|
475
|
+
namespace: entry.namespace,
|
|
476
|
+
key: entry.key,
|
|
477
|
+
value: entry.value
|
|
478
|
+
};
|
|
479
|
+
const key = this.agentKeys.get(agentId);
|
|
480
|
+
if (key) {
|
|
481
|
+
try {
|
|
482
|
+
const canonical = jcsCanonicalise({
|
|
483
|
+
agent_id: agentId,
|
|
484
|
+
key: entry.key,
|
|
485
|
+
namespace: entry.namespace,
|
|
486
|
+
value: entry.value
|
|
487
|
+
});
|
|
488
|
+
body.signature = await this.sign(canonical, key);
|
|
489
|
+
} catch {
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return this.post("/memory", body);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Read one shared-memory entry by (namespace, key). Throws a 404
|
|
496
|
+
* {@link VorimError} if it does not exist. Returns the value plus
|
|
497
|
+
* provenance (which agent wrote it, content hash, whether it is signed).
|
|
498
|
+
*
|
|
499
|
+
* Requires an API key with the `memory:read` scope.
|
|
500
|
+
*/
|
|
501
|
+
async readMemory(input) {
|
|
502
|
+
return this.get(`/memory/${encodeURIComponent(input.namespace)}/${encodeURIComponent(input.key)}`);
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* List entries in a namespace (paginated). Returns `{ entries, meta }`.
|
|
506
|
+
*
|
|
507
|
+
* Requires an API key with the `memory:read` scope.
|
|
508
|
+
*/
|
|
509
|
+
async listMemory(input) {
|
|
510
|
+
const params = new URLSearchParams();
|
|
511
|
+
if (input.page) params.set("page", String(input.page));
|
|
512
|
+
if (input.perPage) params.set("per_page", String(input.perPage));
|
|
513
|
+
const qs = params.toString();
|
|
514
|
+
const envelope = await this.requestEnvelope(
|
|
515
|
+
"GET",
|
|
516
|
+
`/memory/${encodeURIComponent(input.namespace)}${qs ? `?${qs}` : ""}`
|
|
517
|
+
);
|
|
518
|
+
return {
|
|
519
|
+
entries: envelope.data ?? [],
|
|
520
|
+
meta: envelope.meta
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Delete one shared-memory entry by (namespace, key).
|
|
525
|
+
*
|
|
526
|
+
* Requires an API key with the `memory:write` scope.
|
|
527
|
+
*/
|
|
528
|
+
async deleteMemory(input) {
|
|
529
|
+
return this.delete(`/memory/${encodeURIComponent(input.namespace)}/${encodeURIComponent(input.key)}`);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Verified hand-off — the multi-agent-fabric primitive.
|
|
533
|
+
*
|
|
534
|
+
* Hands a task from one agent to another as ONE auditable operation that
|
|
535
|
+
* composes the three trust primitives:
|
|
536
|
+
* 1. (optional) VERIFY the receiving agent is trusted + active before
|
|
537
|
+
* handing it anything — fails closed if it is not (unless you opt out).
|
|
538
|
+
* 2. DELEGATE a strictly-attenuated subset of the sender's scopes to the
|
|
539
|
+
* receiver (the server enforces child ⊆ parent + depth; a scope the
|
|
540
|
+
* sender doesn't hold is rejected). Optionally as a signed capability
|
|
541
|
+
* link so the hand-off is offline-verifiable by `@vorim/verify`.
|
|
542
|
+
* 3. EMIT a signed audit event recording the hand-off, stamped with the
|
|
543
|
+
* delegation-chain provenance so the whole multi-agent workflow is
|
|
544
|
+
* reconstructable later.
|
|
545
|
+
*
|
|
546
|
+
* Returns the delegation record (with `public_chain_id`) plus the verification
|
|
547
|
+
* result. Throws before delegating if verification fails.
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```ts
|
|
551
|
+
* const { chain } = await vorim.handOff('agid_planner', {
|
|
552
|
+
* to: 'agid_researcher',
|
|
553
|
+
* scopes: ['agent:read'], // researcher gets read-only, nothing more
|
|
554
|
+
* task: 'gather sources for Q3 report',
|
|
555
|
+
* maxChainDepth: 0, // researcher cannot re-delegate
|
|
556
|
+
* minTrustScore: 60,
|
|
557
|
+
* });
|
|
558
|
+
* console.log(chain.publicChainId);
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
561
|
+
async handOff(fromAgentId, input) {
|
|
562
|
+
let verification;
|
|
563
|
+
if (!input.skipVerify) {
|
|
564
|
+
try {
|
|
565
|
+
verification = await this.verify(input.to);
|
|
566
|
+
} catch {
|
|
567
|
+
throw new VorimError(
|
|
568
|
+
400,
|
|
569
|
+
"HANDOFF_VERIFY_FAILED",
|
|
570
|
+
`Could not verify receiving agent ${input.to} \u2014 refusing hand-off (fail closed).`
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
const minScore = input.minTrustScore ?? 50;
|
|
574
|
+
if (verification.status !== "active") {
|
|
575
|
+
throw new VorimError(
|
|
576
|
+
403,
|
|
577
|
+
"HANDOFF_RECEIVER_INACTIVE",
|
|
578
|
+
`Receiving agent ${input.to} is ${verification.status}, not active \u2014 refusing hand-off.`
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
if ((verification.trust_score ?? 0) < minScore) {
|
|
582
|
+
throw new VorimError(
|
|
583
|
+
403,
|
|
584
|
+
"HANDOFF_RECEIVER_UNTRUSTED",
|
|
585
|
+
`Receiving agent ${input.to} trust score ${verification.trust_score} is below minimum ${minScore}.`
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
const delegationInput = {
|
|
590
|
+
delegate_agent_id: input.to,
|
|
591
|
+
scopes_delegated: input.scopes,
|
|
592
|
+
max_chain_depth: input.maxChainDepth ?? 0,
|
|
593
|
+
...input.validUntil ? { valid_until: input.validUntil } : {}
|
|
594
|
+
};
|
|
595
|
+
if (input.signed) {
|
|
596
|
+
const chainId = `chain_pending_${input.to}`;
|
|
597
|
+
const signed = await this.signDelegationLink({
|
|
598
|
+
v: 0,
|
|
599
|
+
type: "vaip-delegation-link",
|
|
600
|
+
chain_id: chainId,
|
|
601
|
+
depth: 1,
|
|
602
|
+
delegator: fromAgentId,
|
|
603
|
+
delegate: input.to,
|
|
604
|
+
scopes: input.scopes,
|
|
605
|
+
max_chain_depth: input.maxChainDepth ?? 0,
|
|
606
|
+
valid_from: (/* @__PURE__ */ new Date()).toISOString(),
|
|
607
|
+
valid_until: input.validUntil ?? null,
|
|
608
|
+
parent_link_hash: null
|
|
609
|
+
});
|
|
610
|
+
delegationInput.signed_link = signed;
|
|
611
|
+
}
|
|
612
|
+
const chain = await this.delegateToAgent(fromAgentId, delegationInput);
|
|
613
|
+
try {
|
|
614
|
+
await this.emit({
|
|
615
|
+
agent_id: fromAgentId,
|
|
616
|
+
event_type: "permission_change",
|
|
617
|
+
action: "agent.handoff",
|
|
618
|
+
resource: input.to,
|
|
619
|
+
result: "success",
|
|
620
|
+
delegation_chain_id: chain.publicChainId,
|
|
621
|
+
metadata: {
|
|
622
|
+
framework: "fabric",
|
|
623
|
+
to: input.to,
|
|
624
|
+
scopes: input.scopes,
|
|
625
|
+
task: input.task,
|
|
626
|
+
receiver_trust_score: verification?.trust_score
|
|
627
|
+
}
|
|
628
|
+
}, { sign: true });
|
|
629
|
+
} catch {
|
|
630
|
+
}
|
|
631
|
+
return { chain, verification };
|
|
632
|
+
}
|
|
426
633
|
// ─── Runtime Control (Strategy A) ──────────────────────────────────
|
|
427
634
|
/**
|
|
428
635
|
* Gate an agent action BEFORE it is performed. Calls
|