@vorim/sdk 3.22.1 → 4.0.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +48 -0
  3. package/dist/httpSignatures.cjs +726 -0
  4. package/dist/httpSignatures.cjs.map +1 -0
  5. package/dist/httpSignatures.d.cts +131 -0
  6. package/dist/httpSignatures.d.ts +131 -0
  7. package/dist/httpSignatures.js +686 -0
  8. package/dist/httpSignatures.js.map +1 -0
  9. package/dist/index.cjs +975 -26
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +243 -16
  12. package/dist/index.d.ts +243 -16
  13. package/dist/index.js +967 -25
  14. package/dist/index.js.map +1 -1
  15. package/dist/integrations/anthropic.d.cts +2 -1
  16. package/dist/integrations/anthropic.d.ts +2 -1
  17. package/dist/integrations/ap2.d.cts +2 -1
  18. package/dist/integrations/ap2.d.ts +2 -1
  19. package/dist/integrations/aws-iam.d.cts +2 -1
  20. package/dist/integrations/aws-iam.d.ts +2 -1
  21. package/dist/integrations/bank-rails.d.cts +2 -1
  22. package/dist/integrations/bank-rails.d.ts +2 -1
  23. package/dist/integrations/circle.d.cts +2 -1
  24. package/dist/integrations/circle.d.ts +2 -1
  25. package/dist/integrations/cloudflare.d.cts +2 -1
  26. package/dist/integrations/cloudflare.d.ts +2 -1
  27. package/dist/integrations/coinbase-cdp.d.cts +2 -1
  28. package/dist/integrations/coinbase-cdp.d.ts +2 -1
  29. package/dist/integrations/commerce-agents.d.cts +2 -1
  30. package/dist/integrations/commerce-agents.d.ts +2 -1
  31. package/dist/integrations/crewai.d.cts +2 -1
  32. package/dist/integrations/crewai.d.ts +2 -1
  33. package/dist/integrations/entra.d.cts +2 -1
  34. package/dist/integrations/entra.d.ts +2 -1
  35. package/dist/integrations/fhir.d.cts +2 -1
  36. package/dist/integrations/fhir.d.ts +2 -1
  37. package/dist/integrations/grok.d.cts +2 -1
  38. package/dist/integrations/grok.d.ts +2 -1
  39. package/dist/integrations/guidewire.d.cts +2 -1
  40. package/dist/integrations/guidewire.d.ts +2 -1
  41. package/dist/integrations/hermes.d.cts +2 -1
  42. package/dist/integrations/hermes.d.ts +2 -1
  43. package/dist/integrations/jira.d.cts +2 -1
  44. package/dist/integrations/jira.d.ts +2 -1
  45. package/dist/integrations/langchain.d.cts +2 -1
  46. package/dist/integrations/langchain.d.ts +2 -1
  47. package/dist/integrations/langgraph.d.cts +2 -1
  48. package/dist/integrations/langgraph.d.ts +2 -1
  49. package/dist/integrations/legal.d.cts +2 -1
  50. package/dist/integrations/legal.d.ts +2 -1
  51. package/dist/integrations/life-sciences.d.cts +2 -1
  52. package/dist/integrations/life-sciences.d.ts +2 -1
  53. package/dist/integrations/linear.d.cts +2 -1
  54. package/dist/integrations/linear.d.ts +2 -1
  55. package/dist/integrations/lithic.d.cts +2 -1
  56. package/dist/integrations/lithic.d.ts +2 -1
  57. package/dist/integrations/llamaindex.d.cts +2 -1
  58. package/dist/integrations/llamaindex.d.ts +2 -1
  59. package/dist/integrations/marqeta.d.cts +2 -1
  60. package/dist/integrations/marqeta.d.ts +2 -1
  61. package/dist/integrations/modern-treasury.d.cts +2 -1
  62. package/dist/integrations/modern-treasury.d.ts +2 -1
  63. package/dist/integrations/muse.d.cts +2 -1
  64. package/dist/integrations/muse.d.ts +2 -1
  65. package/dist/integrations/nekuda.d.cts +2 -1
  66. package/dist/integrations/nekuda.d.ts +2 -1
  67. package/dist/integrations/okta.d.cts +2 -1
  68. package/dist/integrations/okta.d.ts +2 -1
  69. package/dist/integrations/openai.d.cts +2 -1
  70. package/dist/integrations/openai.d.ts +2 -1
  71. package/dist/integrations/openrouter.d.cts +2 -1
  72. package/dist/integrations/openrouter.d.ts +2 -1
  73. package/dist/integrations/paypal-agent.d.cts +2 -1
  74. package/dist/integrations/paypal-agent.d.ts +2 -1
  75. package/dist/integrations/perplexity.d.cts +2 -1
  76. package/dist/integrations/perplexity.d.ts +2 -1
  77. package/dist/integrations/plaid.d.cts +2 -1
  78. package/dist/integrations/plaid.d.ts +2 -1
  79. package/dist/integrations/ramp.d.cts +2 -1
  80. package/dist/integrations/ramp.d.ts +2 -1
  81. package/dist/integrations/shopify.d.cts +2 -1
  82. package/dist/integrations/shopify.d.ts +2 -1
  83. package/dist/integrations/siem.d.cts +1 -1
  84. package/dist/integrations/siem.d.ts +1 -1
  85. package/dist/integrations/skyfire.d.cts +2 -1
  86. package/dist/integrations/skyfire.d.ts +2 -1
  87. package/dist/integrations/stripe-acp.d.cts +2 -1
  88. package/dist/integrations/stripe-acp.d.ts +2 -1
  89. package/dist/integrations/stripe-issuing.d.cts +2 -1
  90. package/dist/integrations/stripe-issuing.d.ts +2 -1
  91. package/dist/integrations/truanon.d.cts +2 -1
  92. package/dist/integrations/truanon.d.ts +2 -1
  93. package/dist/integrations/typesafe.d.cts +2 -1
  94. package/dist/integrations/typesafe.d.ts +2 -1
  95. package/dist/integrations/ucp.d.cts +2 -1
  96. package/dist/integrations/ucp.d.ts +2 -1
  97. package/dist/integrations/vercel-ai.d.cts +2 -1
  98. package/dist/integrations/vercel-ai.d.ts +2 -1
  99. package/dist/integrations/x402.d.cts +2 -1
  100. package/dist/integrations/x402.d.ts +2 -1
  101. package/dist/{types-BrDQAJdl.d.cts → types-DphtTyIC.d.cts} +72 -3
  102. package/dist/{types-BrDQAJdl.d.ts → types-DphtTyIC.d.ts} +72 -3
  103. package/package.json +11 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog — @vorim/sdk
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Changed (breaking)
6
+
7
+ - **`beforeAction` fails closed by default.** `runtimeFailOpen` now defaults to `false`: when the runtime decision API is unreachable (network error, DNS, timeout, 5xx) the transport error is re-thrown instead of returning a synthetic `fallback` allow. A blocked or slowed path to Vorim could previously be turned into an allow. Pass `runtimeFailOpen: true` to keep the old behaviour; choose it per deployment. A reachable server that returns `deny` still denies either way, and the framework integration gates already failed closed. The server default changed on the same day: `runtime_settings.fail_open` is `false` for new orgs.
8
+
9
+ ### Fixed
10
+
11
+ - `setBudget`, `listBudgets`, `getBudgetSpend` and `deleteBudget` work with an API key. The routes were session-only, so every call from the SDK got `401 WRONG_CREDENTIAL_TYPE` while these docs said an API key worked. The key needs the new `runtime:manage` scope (separate from `runtime:decide`, so an agent's own key cannot raise its ceiling).
12
+
13
+ ### Added
14
+
15
+ - **Server-minted swarm id.** Agents gain `swarm_id`: minted on a root agent at its first delegation or ephemeral spawn and inherited by every member; nothing in a request can set it. The server stamps it on runtime decisions (`RuntimeDecision.swarmId`), audit events (in the signed bundle's attestation envelope, not the signed body) and shared-memory writes. `registerEphemeral({ parent_agent_id })` puts a spawned worker in its parent's swarm. `getSwarm(agentId)` lists a swarm. Budgets accept `scope: 'swarm'`, and a policy rule can set `behavior_scope: 'swarm'` so velocity, fan-out and `sod_conflict` read the whole swarm's window instead of one agent's. `workflow_id` remains a caller-supplied label.
16
+ - **Suspend cascades through delegation subtrees.** `updateAgent(id, { status: 'suspended' })` now also suspends every agent reachable through the agent's active identity delegations (pass `cascade: false` to stop only the one agent); `status: 'active'` on a suspended agent reverses exactly that cascade, leaving directly suspended descendants alone. `revoke()` suspends the subtree and revokes the identity links beneath the agent. Every affected agent is announced individually (webhooks, SSF/CAEP). The returned agent carries `cascade.suspended` / `cascade.reactivated`. New `suspendPreview(id)` returns the blast radius first (descendants, how many are active, open escalations, live delegation links).
17
+ - `escalationResolution` can now be `'timed_out'`. The server resolves escalations nobody answers within the org's `escalation_timeout_ms` as `timed_out` (platform-signed, like a human resolution), and `waitForDecisionResolution` translates it to `decision: 'deny'`, the same as a human denial. Previously polling stopped on the resolution but the verdict stayed `escalate`, so a caller's deny check never fired.
18
+ - **Swarm charter and conservation ledger.** `getSwarm()` members carry `parent_agent_id`, `is_ephemeral` and `is_guardian`. `delegateToAgent(...)` and `registerEphemeral(...)` accept `budget_tokens`: a share of the swarm's token budget granted out of the delegator's or parent's own share, refused with `409 ALLOCATION_EXCEEDED` when it would not fit (the ledger's invariant: granted to children plus own spend never exceeds what you hold). Joins that would break the swarm's charter (depth, children per parent, live members, lifetime) are refused with `409 SWARM_CHARTER_EXCEEDED` or `SWARM_EXPIRED`.
19
+ - **Guardian agents.** `listGuardianEscalations(agentId)` returns the pending escalations assigned to the guardians of the agent's swarm, and `guardianResolve(agentId, decisionId, resolution)` signs the canonical approval line (`vorim-escalation-approval|v1|…`) with the agent's cached key and submits it. A rule with `approver_role: 'guardian'` and `quorum_n` needs that many distinct approvals; one veto denies.
20
+ - **Trace context.** `beforeAction()` and `emit()` accept `trace_id` / `span_id` or a W3C `traceparent`; `foldTraceparent()` folds the header into the two ids before signing, so a v1 signature covers stored columns only. `otelAttributes(agentId)` returns `gen_ai.agent.id`, `vorim.swarm.id` and `vorim.parent_agent.id` for the agent's own spans (cached 60 s). Trace ids are correlation only, never authorisation.
21
+ - **Bulk registration.** `registerMany({ agents })` or `registerMany({ template, count })` registers up to 50 agents in one call, optionally grouped into a new swarm; each returned private key is cached like `register()`.
22
+ - **Declarative swarm spec.** `applySwarmSpec(yamlOrObject, { dryRun })` plans or applies a `vorim.swarm/v1` document (members, guardians, charter, budget and shares, breakers, tripwires, attention budget); `getSwarmSpec(swarmId)` exports the current swarm as `{ spec, yaml }`.
23
+ - **Rehearsals, score and attestation.** `rehearseSwarm(swarmId, { preset: 'hazards' | 'replay' } | { scenarios })` runs every active member through the real decision pipeline with nothing written and stores a platform-signed attestation; `listSwarmRehearsals(swarmId)`. `getSwarmScore(swarmId)` gives the members' trust as `min` (gate on it), `weighted_mean` (display) and `trimmed_mean` (peer-derived). `attestSwarm(swarmId)` issues a platform-signed statement of the swarm now (roster hash, policy hash, charter, budget, kills, rehearsal, receipt head, scores), valid 24 hours and verifiable offline against `GET /trust/keys`; `listSwarmAttestations(swarmId)`.
24
+ - **Attention budget.** `getSwarmAttention(swarmId)` reports escalations per hour against the swarm's budget, median time to resolve, mean time between interventions and the fan-out estimate after Olsen and Goodrich; `setSwarmAttention(swarmId, { perHour, onExceed })` sets the budget (past it, escalations are denied unread or the swarm is suspended).
25
+
26
+ ## 3.23.0
27
+
28
+ ### Added
29
+
30
+ - **HTTP Message Signatures (RFC 9421) with Content-Digest (RFC 9530)**, as `@vorim/sdk/http-signatures` and from the package root. `signHttpRequest`, `verifyHttpRequest`, `createSignatureBase` and `contentDigest` sign and verify any request over the components you choose. Algorithms are `ed25519` and `ecdsa-p256-sha256` (raw r||s). The algorithm comes from the key, and a conflicting `alg` parameter fails verification. Verification checks `expires`, an optional max age, required components, and recomputes Content-Digest when the body is supplied. Passes the RFC 9421 Appendix B.2.6 Ed25519 vector. Uses Web Crypto and falls back to `node:crypto`.
31
+ - `vorim.signHttpRequest(agentId, request, options?)` signs with the agent's cached key (`keyid` = agent_id, `alg` = ed25519, `tag` = vorim) and throws `AGENT_KEY_NOT_LOADED` when no key is cached. `vorim.verifyHttpRequest(request, { label?, maxAgeSeconds? })` calls `POST /v1/http-signatures/verify` and returns the agent, org, status and trust score behind the signature. Parity with `sign_http_request` / `verify_http_request` in the Python SDK.
32
+
3
33
  ## 3.22.1
4
34
 
5
35
  ### Fixed
package/README.md CHANGED
@@ -389,6 +389,54 @@ const vorim = createVorim({ apiKey, autoSign: false });
389
389
 
390
390
  **Manual signing.** For payloads you sign yourself, `vorim.sign(payload, privateKeyPem)` returns an `ed25519:` prefixed signature. Any event with a pre-existing `signature` field is passed through unchanged.
391
391
 
392
+ ### HTTP Message Signatures (RFC 9421)
393
+
394
+ An agent can sign the HTTP requests it sends, so the service on the other end can check which agent made the call and that nobody changed it on the way. The signature follows RFC 9421 and goes in the `Signature-Input` and `Signature` headers. When the request has a body, the SDK adds an RFC 9530 `Content-Digest` header and puts it under the signature, which ties the body to it too.
395
+
396
+ Signing uses the key that `register()` or `useAgentKey()` cached for that agent. `keyid` is the agent_id, the algorithm is `ed25519`, and `tag` is `vorim`.
397
+
398
+ ```typescript
399
+ const body = JSON.stringify({ task: "summarise", doc_id: "d_91" });
400
+ const request = {
401
+ method: "POST",
402
+ url: "https://agent-b.example.com/tasks",
403
+ headers: { "content-type": "application/json" },
404
+ body,
405
+ };
406
+
407
+ const { headers } = await vorim.signHttpRequest(agent.agent_id, request);
408
+ await fetch(request.url, {
409
+ method: "POST",
410
+ headers: { ...request.headers, ...headers }, // Signature-Input, Signature, Content-Digest
411
+ body,
412
+ });
413
+ ```
414
+
415
+ On the receiving side, `verifyHttpRequest` sends the request to Vorim. Vorim looks up the signing agent's registered public key and refuses agents that are suspended or revoked. The result also carries the agent's org name, status and trust score. Pass the raw body if you want the digest checked; `content_digest_checked` tells you whether it was.
416
+
417
+ ```typescript
418
+ const result = await vorim.verifyHttpRequest(
419
+ { method: req.method, url: fullUrl, headers: req.headers, body: rawBody },
420
+ { maxAgeSeconds: 300 },
421
+ );
422
+ if (!result.valid) throw new Error(result.reason);
423
+ console.log(result.agent_id, result.trust_score);
424
+ ```
425
+
426
+ You can also verify locally with a public key you already hold, with no call to Vorim. The standalone module works in Node, browsers and Workers, and it also signs with ECDSA P-256 keys (`ecdsa-p256-sha256`), which is the curve iOS Secure Enclave and Android StrongBox keys use.
427
+
428
+ ```typescript
429
+ import { verifyHttpRequest, signHttpRequest } from "@vorim/sdk/http-signatures";
430
+
431
+ const result = await verifyHttpRequest(request, {
432
+ publicKey: agentPublicKeyPem, // SPKI PEM, Ed25519 or P-256
433
+ maxAgeSeconds: 300,
434
+ requiredComponents: ["@method", "@target-uri", "content-digest"],
435
+ });
436
+ ```
437
+
438
+ The module passes the Ed25519 test vector in RFC 9421 Appendix B.2.6. It supports every derived component in the RFC, and the `req`, `name` and `bs` component parameters. `sf`, `key` and `tr` raise an error because they aren't supported yet.
439
+
392
440
  ### Embeddable Trust Badge
393
441
 
394
442
  Every registered agent gets a public SVG trust badge you can embed anywhere: