@vorim/sdk 3.20.0 → 3.22.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/CHANGELOG.md +7 -0
- package/README.md +12 -6
- package/dist/index.cjs +117 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -2
- package/dist/index.d.ts +43 -2
- package/dist/index.js +116 -3
- package/dist/index.js.map +1 -1
- package/dist/integrations/anthropic.d.cts +2 -1
- package/dist/integrations/anthropic.d.ts +2 -1
- package/dist/integrations/ap2.d.cts +2 -1
- package/dist/integrations/ap2.d.ts +2 -1
- package/dist/integrations/aws-iam.d.cts +2 -1
- package/dist/integrations/aws-iam.d.ts +2 -1
- package/dist/integrations/bank-rails.d.cts +2 -1
- package/dist/integrations/bank-rails.d.ts +2 -1
- package/dist/integrations/circle.d.cts +2 -1
- package/dist/integrations/circle.d.ts +2 -1
- package/dist/integrations/cloudflare.d.cts +2 -1
- package/dist/integrations/cloudflare.d.ts +2 -1
- package/dist/integrations/coinbase-cdp.d.cts +2 -1
- package/dist/integrations/coinbase-cdp.d.ts +2 -1
- package/dist/integrations/commerce-agents.d.cts +2 -1
- package/dist/integrations/commerce-agents.d.ts +2 -1
- package/dist/integrations/crewai.d.cts +2 -1
- package/dist/integrations/crewai.d.ts +2 -1
- package/dist/integrations/entra.d.cts +2 -1
- package/dist/integrations/entra.d.ts +2 -1
- package/dist/integrations/fhir.d.cts +2 -1
- package/dist/integrations/fhir.d.ts +2 -1
- package/dist/integrations/grok.d.cts +2 -1
- package/dist/integrations/grok.d.ts +2 -1
- package/dist/integrations/guidewire.d.cts +2 -1
- package/dist/integrations/guidewire.d.ts +2 -1
- package/dist/integrations/hermes.d.cts +2 -1
- package/dist/integrations/hermes.d.ts +2 -1
- package/dist/integrations/jira.d.cts +2 -1
- package/dist/integrations/jira.d.ts +2 -1
- package/dist/integrations/langchain.d.cts +2 -1
- package/dist/integrations/langchain.d.ts +2 -1
- package/dist/integrations/langgraph.d.cts +2 -1
- package/dist/integrations/langgraph.d.ts +2 -1
- package/dist/integrations/legal.d.cts +2 -1
- package/dist/integrations/legal.d.ts +2 -1
- package/dist/integrations/life-sciences.d.cts +2 -1
- package/dist/integrations/life-sciences.d.ts +2 -1
- package/dist/integrations/linear.d.cts +2 -1
- package/dist/integrations/linear.d.ts +2 -1
- package/dist/integrations/lithic.d.cts +2 -1
- package/dist/integrations/lithic.d.ts +2 -1
- package/dist/integrations/llamaindex.d.cts +2 -1
- package/dist/integrations/llamaindex.d.ts +2 -1
- package/dist/integrations/marqeta.d.cts +2 -1
- package/dist/integrations/marqeta.d.ts +2 -1
- package/dist/integrations/modern-treasury.d.cts +2 -1
- package/dist/integrations/modern-treasury.d.ts +2 -1
- package/dist/integrations/muse.cjs +437 -0
- package/dist/integrations/muse.cjs.map +1 -0
- package/dist/integrations/muse.d.cts +72 -0
- package/dist/integrations/muse.d.ts +72 -0
- package/dist/integrations/muse.js +394 -0
- package/dist/integrations/muse.js.map +1 -0
- package/dist/integrations/nekuda.d.cts +2 -1
- package/dist/integrations/nekuda.d.ts +2 -1
- package/dist/integrations/okta.d.cts +2 -1
- package/dist/integrations/okta.d.ts +2 -1
- package/dist/integrations/openai.d.cts +2 -1
- package/dist/integrations/openai.d.ts +2 -1
- package/dist/integrations/openrouter.d.cts +2 -1
- package/dist/integrations/openrouter.d.ts +2 -1
- package/dist/integrations/paypal-agent.d.cts +2 -1
- package/dist/integrations/paypal-agent.d.ts +2 -1
- package/dist/integrations/perplexity.d.cts +2 -1
- package/dist/integrations/perplexity.d.ts +2 -1
- package/dist/integrations/plaid.d.cts +2 -1
- package/dist/integrations/plaid.d.ts +2 -1
- package/dist/integrations/ramp.d.cts +2 -1
- package/dist/integrations/ramp.d.ts +2 -1
- package/dist/integrations/shopify.d.cts +2 -1
- package/dist/integrations/shopify.d.ts +2 -1
- package/dist/integrations/siem.d.cts +1 -1
- package/dist/integrations/siem.d.ts +1 -1
- package/dist/integrations/skyfire.d.cts +2 -1
- package/dist/integrations/skyfire.d.ts +2 -1
- package/dist/integrations/stripe-acp.d.cts +2 -1
- package/dist/integrations/stripe-acp.d.ts +2 -1
- package/dist/integrations/stripe-issuing.d.cts +2 -1
- package/dist/integrations/stripe-issuing.d.ts +2 -1
- package/dist/integrations/truanon.d.cts +2 -1
- package/dist/integrations/truanon.d.ts +2 -1
- package/dist/integrations/typesafe.cjs +268 -0
- package/dist/integrations/typesafe.cjs.map +1 -0
- package/dist/integrations/typesafe.d.cts +145 -0
- package/dist/integrations/typesafe.d.ts +145 -0
- package/dist/integrations/typesafe.js +221 -0
- package/dist/integrations/typesafe.js.map +1 -0
- package/dist/integrations/ucp.d.cts +2 -1
- package/dist/integrations/ucp.d.ts +2 -1
- package/dist/integrations/vercel-ai.d.cts +2 -1
- package/dist/integrations/vercel-ai.d.ts +2 -1
- package/dist/integrations/x402.d.cts +2 -1
- package/dist/integrations/x402.d.ts +2 -1
- package/dist/{types-BmeluKHI.d.cts → types-BrDQAJdl.d.cts} +36 -1
- package/dist/{types-BmeluKHI.d.ts → types-BrDQAJdl.d.ts} +36 -1
- package/package.json +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog — @vorim/sdk
|
|
2
2
|
|
|
3
|
+
## 3.22.1
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `emit()` and `emitBatch()` return types now include the `events` array the API already returns (`{ ingested, events?: { event_id, digest? }[], rejected_invalid_signature?, replayed? }`), so `const { events } = await vorim.emit(...)` type-checks.
|
|
8
|
+
- README: quick start states the key scopes it needs (agents:read, agents:write, permissions:read, audit:read, audit:write), how to run it as an ES module, that public `verify()` returns no `active_scopes`, and that `register()` needs at least one scope.
|
|
9
|
+
|
|
3
10
|
## 3.20.0
|
|
4
11
|
|
|
5
12
|
### Added
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Register agents with cryptographic Ed25519 identities, enforce scoped permission
|
|
|
10
10
|
[](https://nodejs.org/)
|
|
11
11
|
[]()
|
|
12
12
|
|
|
13
|
-
> **
|
|
13
|
+
> **API key**: create one in the Vorim dashboard under Settings, API keys. No account yet? Request access at [vorim.ai](https://vorim.ai).
|
|
14
14
|
> **[Documentation](https://vorim.ai/docs)** — Full API reference, framework integrations, and examples.
|
|
15
15
|
> **[Quick Start](https://vorim.ai/quickstart)** — Set up in under 5 minutes.
|
|
16
16
|
|
|
@@ -48,6 +48,10 @@ pnpm add @vorim/sdk
|
|
|
48
48
|
|
|
49
49
|
## Quick Start
|
|
50
50
|
|
|
51
|
+
The key for this quick start needs the `agents:read`, `agents:write`, `permissions:read`, `audit:read` and `audit:write` scopes. Scopes are independent, so `agents:write` does not include `agents:read`.
|
|
52
|
+
|
|
53
|
+
The example uses top-level `await`, so run it as ES module code. Save it as a `.mjs` file, set `"type": "module"` in your `package.json`, or run the `.ts` file with `npx tsx`.
|
|
54
|
+
|
|
51
55
|
```typescript
|
|
52
56
|
import createVorim from "@vorim/sdk";
|
|
53
57
|
|
|
@@ -83,7 +87,9 @@ if (allowed) {
|
|
|
83
87
|
// 4. Verify any agent's trust (public endpoint, no auth required)
|
|
84
88
|
const trust = await vorim.verify(agent.agent_id);
|
|
85
89
|
console.log(trust.trust_score); // 0–100
|
|
86
|
-
|
|
90
|
+
// The public endpoint does not reveal scopes (active_scopes is always []).
|
|
91
|
+
// As the agent's owner, list them with your API key:
|
|
92
|
+
const permissions = await vorim.listPermissions(agent.agent_id);
|
|
87
93
|
```
|
|
88
94
|
|
|
89
95
|
---
|
|
@@ -334,8 +340,8 @@ trust.verified; // true
|
|
|
334
340
|
trust.trust_score; // 82
|
|
335
341
|
trust.status; // 'active'
|
|
336
342
|
trust.owner.org_name; // 'Acme Corp'
|
|
337
|
-
trust.active_scopes; // [
|
|
338
|
-
trust.key_fingerprint; // '
|
|
343
|
+
trust.active_scopes; // [] (not revealed publicly; owners use vorim.listPermissions(agentId))
|
|
344
|
+
trust.key_fingerprint; // '' (not revealed publicly)
|
|
339
345
|
trust.revocation_status; // false
|
|
340
346
|
```
|
|
341
347
|
|
|
@@ -351,7 +357,7 @@ trust.revocation_status; // false
|
|
|
351
357
|
From v3.1.0, the SDK signs every audit event at source with the agent's Ed25519 private key. No code change required — `register()` caches the key in memory and `emit()` adds the signature transparently.
|
|
352
358
|
|
|
353
359
|
```typescript
|
|
354
|
-
const { agent } = await vorim.register({ name: "agent", capabilities: [], scopes: [] });
|
|
360
|
+
const { agent } = await vorim.register({ name: "agent", capabilities: [], scopes: ["agent:execute"] });
|
|
355
361
|
|
|
356
362
|
// Auto-signed. The signature is attached before the request leaves the process.
|
|
357
363
|
await vorim.emit({
|
|
@@ -481,7 +487,7 @@ const { events } = await vorim.emit({ /* ... */ });
|
|
|
481
487
|
// events: [{ event_id: "evt_...", digest: "sha256:..." }]
|
|
482
488
|
|
|
483
489
|
import { eventDigest } from "@vorim/sdk";
|
|
484
|
-
await eventDigest(sentEvent) === events[0].digest; // true
|
|
490
|
+
await eventDigest(sentEvent) === events?.[0].digest; // true
|
|
485
491
|
```
|
|
486
492
|
|
|
487
493
|
Byte-identical in `@vorim/verify` and the Python SDK. A content digest, not an
|
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
isDigest: () => isDigest,
|
|
51
51
|
isKeyedCommitment: () => isKeyedCommitment,
|
|
52
52
|
jcsCanonicalise: () => jcsCanonicalise,
|
|
53
|
+
portableReceiptCanonicalBytes: () => portableReceiptCanonicalBytes,
|
|
53
54
|
prepareReplayContext: () => prepareReplayContext
|
|
54
55
|
});
|
|
55
56
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -130,6 +131,71 @@ async function prepareReplayContext(inputs) {
|
|
|
130
131
|
return ctx;
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
// ../shared-types/src/index.ts
|
|
135
|
+
function jcsCanonicalise2(value) {
|
|
136
|
+
if (value === null) return "null";
|
|
137
|
+
if (value === true) return "true";
|
|
138
|
+
if (value === false) return "false";
|
|
139
|
+
if (typeof value === "number") {
|
|
140
|
+
if (!Number.isFinite(value)) {
|
|
141
|
+
throw new Error("jcsCanonicalise: NaN and Infinity are not JCS-valid");
|
|
142
|
+
}
|
|
143
|
+
const abs = Math.abs(value);
|
|
144
|
+
if (value !== 0 && (abs >= 1e21 || abs < 1e-4 || Number.isInteger(value) && abs > 2 ** 53)) {
|
|
145
|
+
throw new Error(
|
|
146
|
+
`jcsCanonicalise: numbers in the ranges where JS and Python formatting diverge (|x| >= 1e21, |x| < 1e-4, or integer |x| > 2^53) are not supported in signed metadata. Use a string instead of ${value}.`
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
return value.toString();
|
|
150
|
+
}
|
|
151
|
+
if (typeof value === "string") {
|
|
152
|
+
return JSON.stringify(value);
|
|
153
|
+
}
|
|
154
|
+
if (Array.isArray(value)) {
|
|
155
|
+
return "[" + value.map(jcsCanonicalise2).join(",") + "]";
|
|
156
|
+
}
|
|
157
|
+
if (typeof value === "object") {
|
|
158
|
+
const obj = value;
|
|
159
|
+
const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
|
|
160
|
+
const parts = keys.map((k) => JSON.stringify(k) + ":" + jcsCanonicalise2(obj[k]));
|
|
161
|
+
return "{" + parts.join(",") + "}";
|
|
162
|
+
}
|
|
163
|
+
throw new Error(`jcsCanonicalise: unsupported value type: ${typeof value}`);
|
|
164
|
+
}
|
|
165
|
+
function portableReceiptCanonicalBytes(receipt) {
|
|
166
|
+
return jcsCanonicalise2({
|
|
167
|
+
version: receipt.version,
|
|
168
|
+
org_id: receipt.org_id,
|
|
169
|
+
issued_at: receipt.issued_at,
|
|
170
|
+
canonical_form: receipt.canonical_form,
|
|
171
|
+
decision: {
|
|
172
|
+
decision_id: receipt.decision.decision_id,
|
|
173
|
+
verdict: receipt.decision.verdict,
|
|
174
|
+
agent_id: receipt.decision.agent_id,
|
|
175
|
+
required_scope: receipt.decision.required_scope,
|
|
176
|
+
action_type: receipt.decision.action_type,
|
|
177
|
+
action_target: receipt.decision.action_target,
|
|
178
|
+
policy_version: receipt.decision.policy_version,
|
|
179
|
+
decision_rule_id: receipt.decision.decision_rule_id,
|
|
180
|
+
requested_at: receipt.decision.requested_at,
|
|
181
|
+
expires_at: receipt.decision.expires_at
|
|
182
|
+
},
|
|
183
|
+
binding: {
|
|
184
|
+
original_intent_hash: receipt.binding.original_intent_hash,
|
|
185
|
+
effective_intent_hash: receipt.binding.effective_intent_hash,
|
|
186
|
+
policy_modified: receipt.binding.policy_modified
|
|
187
|
+
},
|
|
188
|
+
approval: receipt.approval === null ? null : {
|
|
189
|
+
resolution: receipt.approval.resolution,
|
|
190
|
+
resolved_at: receipt.approval.resolved_at,
|
|
191
|
+
approver_ref: receipt.approval.approver_ref,
|
|
192
|
+
alg: receipt.approval.alg,
|
|
193
|
+
kid: receipt.approval.kid,
|
|
194
|
+
signature: receipt.approval.signature
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
133
199
|
// src/commit.ts
|
|
134
200
|
var HMAC_SHA256_PREFIX = "hmac-sha256:";
|
|
135
201
|
var SHA256_PREFIX = "sha256:";
|
|
@@ -180,7 +246,7 @@ function isDigest(digest) {
|
|
|
180
246
|
}
|
|
181
247
|
|
|
182
248
|
// src/index.ts
|
|
183
|
-
var SDK_VERSION = true ? "3.
|
|
249
|
+
var SDK_VERSION = true ? "3.22.1" : "0.0.0";
|
|
184
250
|
var USER_AGENT = `vorim-sdk/${SDK_VERSION}`;
|
|
185
251
|
function sleep(ms) {
|
|
186
252
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -207,6 +273,22 @@ async function eventDigest(event) {
|
|
|
207
273
|
function idempotencyHeader(key) {
|
|
208
274
|
return key ? { "Idempotency-Key": key } : void 0;
|
|
209
275
|
}
|
|
276
|
+
function toApprovalAttestation(raw) {
|
|
277
|
+
if (!raw || typeof raw !== "object") return null;
|
|
278
|
+
if (raw.resolution !== "approved") return null;
|
|
279
|
+
if (raw.alg !== "Ed25519") return null;
|
|
280
|
+
if (typeof raw.kid !== "string" || !raw.kid) return null;
|
|
281
|
+
if (typeof raw.signature !== "string" || !raw.signature.startsWith("ed25519:")) return null;
|
|
282
|
+
if (typeof raw.resolved_at !== "string" || Number.isNaN(Date.parse(raw.resolved_at))) return null;
|
|
283
|
+
return {
|
|
284
|
+
resolution: "approved",
|
|
285
|
+
resolvedAt: raw.resolved_at,
|
|
286
|
+
approverRef: typeof raw.approver_ref === "string" ? raw.approver_ref : null,
|
|
287
|
+
alg: "Ed25519",
|
|
288
|
+
kid: raw.kid,
|
|
289
|
+
signature: raw.signature
|
|
290
|
+
};
|
|
291
|
+
}
|
|
210
292
|
var VorimSDK = class _VorimSDK {
|
|
211
293
|
apiKey;
|
|
212
294
|
baseUrl;
|
|
@@ -776,7 +858,8 @@ var VorimSDK = class _VorimSDK {
|
|
|
776
858
|
latencyMs: 0,
|
|
777
859
|
isFallback: true,
|
|
778
860
|
policyVersion: 0,
|
|
779
|
-
escalationResolution: null
|
|
861
|
+
escalationResolution: null,
|
|
862
|
+
approval: null
|
|
780
863
|
};
|
|
781
864
|
}
|
|
782
865
|
throw err;
|
|
@@ -849,6 +932,35 @@ var VorimSDK = class _VorimSDK {
|
|
|
849
932
|
{ decisionId }
|
|
850
933
|
);
|
|
851
934
|
}
|
|
935
|
+
/**
|
|
936
|
+
* Mint a portable signed receipt for a decision: a self-contained,
|
|
937
|
+
* offline-verifiable statement that Vorim authorised this action.
|
|
938
|
+
*
|
|
939
|
+
* Use it when something OUTSIDE Vorim has to be convinced — a settlement
|
|
940
|
+
* layer, a downstream anchor, a counterparty's auditor. Verification needs
|
|
941
|
+
* the receipt and the public key from `GET /trust/keys`: no call back to
|
|
942
|
+
* Vorim, no chain, no network.
|
|
943
|
+
*
|
|
944
|
+
* Reproduce the signed bytes with `portableReceiptCanonicalBytes` from
|
|
945
|
+
* `@vorim/shared-types` (also re-exported here), then check `signature`
|
|
946
|
+
* against the key matching `kid`. Never re-derive those bytes by hand: the
|
|
947
|
+
* canonical form is defined once precisely so two implementations cannot
|
|
948
|
+
* drift into signatures that do not verify.
|
|
949
|
+
*
|
|
950
|
+
* Throws 409 when the decision is not an authorisation — a denial, a
|
|
951
|
+
* fail-open fallback, an unresolved escalation, or one a human refused.
|
|
952
|
+
* A receipt only ever means yes, so there is nothing to return for a no.
|
|
953
|
+
*
|
|
954
|
+
* @example
|
|
955
|
+
* const d = await vorim.beforeAction({ ... });
|
|
956
|
+
* if (d.decision === 'allow') {
|
|
957
|
+
* const receipt = await vorim.mintPortableSignedReceipt(d.decisionId);
|
|
958
|
+
* await settleWith(receipt); // the counterparty verifies it alone
|
|
959
|
+
* }
|
|
960
|
+
*/
|
|
961
|
+
async mintPortableSignedReceipt(decisionId) {
|
|
962
|
+
return this.get(`/runtime/decisions/${decisionId}/receipt`);
|
|
963
|
+
}
|
|
852
964
|
/**
|
|
853
965
|
* Map a snake_case decision row (from POST or GET) to the camelCase
|
|
854
966
|
* {@link RuntimeDecision}. The SDK has no generic camelizer, so the
|
|
@@ -887,7 +999,8 @@ var VorimSDK = class _VorimSDK {
|
|
|
887
999
|
latencyMs: raw?.latency_ms ?? 0,
|
|
888
1000
|
isFallback: raw?.is_fallback ?? !hasVerdict,
|
|
889
1001
|
policyVersion: raw?.policy_version ?? 0,
|
|
890
|
-
escalationResolution: resolution
|
|
1002
|
+
escalationResolution: resolution,
|
|
1003
|
+
approval: toApprovalAttestation(raw?.approval)
|
|
891
1004
|
};
|
|
892
1005
|
}
|
|
893
1006
|
// ─── Audit ────────────────────────────────────────────────────────
|
|
@@ -1398,6 +1511,7 @@ async function deviceLogin(opts) {
|
|
|
1398
1511
|
isDigest,
|
|
1399
1512
|
isKeyedCommitment,
|
|
1400
1513
|
jcsCanonicalise,
|
|
1514
|
+
portableReceiptCanonicalBytes,
|
|
1401
1515
|
prepareReplayContext
|
|
1402
1516
|
});
|
|
1403
1517
|
//# sourceMappingURL=index.cjs.map
|