@vorim/sdk 1.0.1 → 1.0.2

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 (2) hide show
  1. package/README.md +220 -47
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,11 +1,31 @@
1
1
  # @vorim/sdk
2
2
 
3
- The official TypeScript SDK for **[Vorim AI](https://vorim.ai)** — the identity and trust layer for AI agents.
3
+ **The identity and trust layer for AI agents.**
4
4
 
5
- Register agents with cryptographic identities, enforce scoped permissions, emit tamper-evident audit trails, and verify trust scores — all in a few lines of code.
5
+ Register agents with cryptographic Ed25519 identities, enforce scoped permissions in under 5ms, emit tamper-evident audit trails, and verify trust scores — all in a few lines of code.
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@vorim/sdk.svg)](https://www.npmjs.com/package/@vorim/sdk)
8
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue.svg)](https://www.typescriptlang.org/)
10
+ [![Node](https://img.shields.io/badge/Node.js-18%2B-green.svg)](https://nodejs.org/)
11
+ [![Zero Dependencies](https://img.shields.io/badge/Dependencies-0-brightgreen.svg)]()
12
+
13
+ ---
14
+
15
+ ## Why Vorim?
16
+
17
+ AI agents are shipping into production without identity, permissions, or audit trails. This is a problem:
18
+
19
+ - **No identity** — agents share API keys. You can't tell which agent did what.
20
+ - **No permissions** — agents get all-or-nothing access. No scoped, time-bounded controls.
21
+ - **No audit trail** — no tamper-evident record of agent actions. Compliance teams are blind.
22
+ - **No trust signal** — third parties can't verify an agent before interacting with it.
23
+
24
+ Vorim solves all four. One SDK. One protocol. Ships in minutes.
25
+
26
+ > **EU AI Act** (enforced Aug 2025) mandates traceability and audit trails for high-risk AI systems. Vorim makes your agents compliant out of the box.
27
+
28
+ ---
9
29
 
10
30
  ## Install
11
31
 
@@ -14,13 +34,14 @@ npm install @vorim/sdk
14
34
  ```
15
35
 
16
36
  ```bash
37
+ # or
17
38
  yarn add @vorim/sdk
18
- ```
19
-
20
- ```bash
39
+ # or
21
40
  pnpm add @vorim/sdk
22
41
  ```
23
42
 
43
+ ---
44
+
24
45
  ## Quick Start
25
46
 
26
47
  ```typescript
@@ -30,17 +51,17 @@ const vorim = createVorim({
30
51
  apiKey: "agid_sk_live_...",
31
52
  });
32
53
 
33
- // 1. Register an agent — returns Ed25519 keypair (private key shown once)
54
+ // 1. Register an agent — Ed25519 keypair generated, private key shown once
34
55
  const { agent, private_key } = await vorim.register({
35
56
  name: "invoice-processor",
36
57
  capabilities: ["read_documents", "extract_data"],
37
58
  scopes: ["agent:read", "agent:execute"],
38
59
  });
39
60
 
40
- console.log(agent.agent_id); // agid_acme_a1b2c3d4
41
- console.log(agent.trust_score); // 50 (initial score)
61
+ console.log(agent.agent_id); // agid_acme_a1b2c3d4
62
+ console.log(agent.trust_score); // 50 (initial)
42
63
 
43
- // 2. Check permissions before acting (sub-5ms via Redis cache)
64
+ // 2. Check permissions before acting (<5ms via Redis)
44
65
  const { allowed } = await vorim.check(agent.agent_id, "agent:execute");
45
66
 
46
67
  if (allowed) {
@@ -55,31 +76,119 @@ if (allowed) {
55
76
  });
56
77
  }
57
78
 
58
- // 4. Verify any agent's trust (public API, no auth needed)
79
+ // 4. Verify any agent's trust (public endpoint, no auth required)
59
80
  const trust = await vorim.verify(agent.agent_id);
60
- console.log(trust.trust_score); // 0–100
81
+ console.log(trust.trust_score); // 0–100
61
82
  console.log(trust.active_scopes); // ['agent:read', 'agent:execute']
62
83
  ```
63
84
 
64
- ## Features
85
+ ---
65
86
 
66
- | Feature | Description |
67
- |---------|-------------|
68
- | **Cryptographic Identity** | Ed25519 keypairs with SHA-256 fingerprints for every agent |
69
- | **7 Permission Scopes** | `read`, `write`, `execute`, `transact`, `communicate`, `delegate`, `elevate` |
70
- | **Immutable Audit Trail** | ULID-ordered events with input/output content hashing |
71
- | **Trust Scoring** | 5-factor algorithm producing a 0–100 score |
72
- | **Payload Signing** | Client-side Ed25519 signatures via Web Crypto or Node.js |
73
- | **Dual Runtime** | Works in Node.js 18+ and modern browsers |
74
- | **Zero Dependencies** | Types are bundled — no external dependencies |
87
+ ## Framework Integration
88
+
89
+ ### LangChain
90
+
91
+ ```typescript
92
+ import createVorim from "@vorim/sdk";
93
+ import { ChatOpenAI } from "@langchain/openai";
94
+ import { AgentExecutor } from "langchain/agents";
95
+
96
+ const vorim = createVorim({ apiKey: "agid_sk_live_..." });
97
+
98
+ // Register your LangChain agent with Vorim
99
+ const { agent: identity } = await vorim.register({
100
+ name: "langchain-research-agent",
101
+ capabilities: ["web_browsing", "api_calls"],
102
+ scopes: ["agent:read", "agent:execute", "agent:communicate"],
103
+ });
104
+
105
+ // Check permissions before every tool call
106
+ async function guardedToolCall(toolName: string, input: any) {
107
+ const { allowed } = await vorim.check(identity.agent_id, "agent:execute");
108
+ if (!allowed) throw new Error("Permission denied by Vorim");
109
+
110
+ const result = await executeTool(toolName, input);
111
+
112
+ // Audit every action
113
+ await vorim.emit({
114
+ agent_id: identity.agent_id,
115
+ event_type: "tool_call",
116
+ action: `${toolName}: ${JSON.stringify(input)}`,
117
+ result: "success",
118
+ });
119
+
120
+ return result;
121
+ }
122
+ ```
123
+
124
+ ### CrewAI
125
+
126
+ ```typescript
127
+ import createVorim from "@vorim/sdk";
128
+
129
+ const vorim = createVorim({ apiKey: "agid_sk_live_..." });
130
+
131
+ // Register each crew member as a Vorim agent
132
+ const researcher = await vorim.register({
133
+ name: "crew-researcher",
134
+ capabilities: ["web_browsing"],
135
+ scopes: ["agent:read"],
136
+ });
137
+
138
+ const writer = await vorim.register({
139
+ name: "crew-writer",
140
+ capabilities: ["file_access"],
141
+ scopes: ["agent:read", "agent:write"],
142
+ });
143
+
144
+ // Verify permissions before delegation
145
+ const { allowed } = await vorim.check(writer.agent.agent_id, "agent:write");
146
+ ```
147
+
148
+ ### OpenAI Agents SDK
149
+
150
+ ```typescript
151
+ import createVorim from "@vorim/sdk";
152
+ import OpenAI from "openai";
153
+
154
+ const vorim = createVorim({ apiKey: "agid_sk_live_..." });
155
+ const openai = new OpenAI();
156
+
157
+ // Register your OpenAI agent
158
+ const { agent: identity } = await vorim.register({
159
+ name: "openai-assistant",
160
+ capabilities: ["api_calls", "code_execution"],
161
+ scopes: ["agent:read", "agent:execute"],
162
+ });
163
+
164
+ // Wrap function calls with Vorim permission checks
165
+ async function handleFunctionCall(call: any) {
166
+ const { allowed } = await vorim.check(identity.agent_id, "agent:execute");
167
+ if (!allowed) return { error: "Blocked by Vorim trust layer" };
168
+
169
+ const result = await executeFunction(call);
170
+
171
+ await vorim.emit({
172
+ agent_id: identity.agent_id,
173
+ event_type: "tool_call",
174
+ action: call.name,
175
+ resource: JSON.stringify(call.arguments),
176
+ result: "success",
177
+ });
178
+
179
+ return result;
180
+ }
181
+ ```
182
+
183
+ ---
75
184
 
76
185
  ## API Reference
77
186
 
78
187
  ### Identity
79
188
 
80
189
  ```typescript
81
- // Register a new agent (returns keypairprivate key shown once)
82
- const result = await vorim.register({
190
+ // Register a new agent (private key returned once store it securely)
191
+ const { agent, private_key } = await vorim.register({
83
192
  name: "my-agent",
84
193
  description: "Processes invoices",
85
194
  capabilities: ["read_documents"],
@@ -99,20 +208,20 @@ await vorim.revoke("agid_acme_a1b2c3d4");
99
208
  ### Permissions
100
209
 
101
210
  ```typescript
102
- // Check if an agent has a specific permission
211
+ // Check if an agent has a specific permission (<5ms)
103
212
  const { allowed, remaining_quota } = await vorim.check(
104
213
  "agid_acme_a1b2c3d4",
105
214
  "agent:execute"
106
215
  );
107
216
 
108
- // Grant a time-bounded permission with rate limiting
217
+ // Grant a time-bounded, rate-limited permission
109
218
  await vorim.grant("agid_acme_a1b2c3d4", "agent:transact", {
110
219
  valid_until: "2026-06-01T00:00:00Z",
111
220
  rate_limit: { max: 100, window: "1h" },
112
221
  });
113
222
  ```
114
223
 
115
- ### Permission Scopes
224
+ #### Permission Scopes
116
225
 
117
226
  | Scope | Description |
118
227
  |-------|-------------|
@@ -151,16 +260,16 @@ await vorim.emitBatch([
151
260
  // Public endpoint — no API key required
152
261
  const trust = await vorim.verify("agid_acme_a1b2c3d4");
153
262
 
154
- console.log(trust.verified); // true
155
- console.log(trust.trust_score); // 82
156
- console.log(trust.status); // 'active'
157
- console.log(trust.owner.org_name); // 'Acme Corp'
158
- console.log(trust.active_scopes); // ['agent:read', 'agent:execute']
159
- console.log(trust.key_fingerprint); // 'a1b2c3d4...'
160
- console.log(trust.revocation_status); // false
263
+ trust.verified; // true
264
+ trust.trust_score; // 82
265
+ trust.status; // 'active'
266
+ trust.owner.org_name; // 'Acme Corp'
267
+ trust.active_scopes; // ['agent:read', 'agent:execute']
268
+ trust.key_fingerprint; // 'a1b2c3d4...'
269
+ trust.revocation_status; // false
161
270
  ```
162
271
 
163
- **Trust Score Factors:**
272
+ **Trust score factors:**
164
273
  - Agent status (active, suspended, revoked)
165
274
  - Account age (older = more trusted)
166
275
  - Success rate over last 30 days
@@ -170,7 +279,7 @@ console.log(trust.revocation_status); // false
170
279
  ### Payload Signing
171
280
 
172
281
  ```typescript
173
- // Sign a payload with the agent's Ed25519 private key
282
+ // Sign a payload with the agent's Ed25519 private key (client-side)
174
283
  const signature = await vorim.sign(
175
284
  JSON.stringify({ action: "transfer", amount: 500 }),
176
285
  privateKeyPem
@@ -187,20 +296,43 @@ await vorim.emit({
187
296
  });
188
297
  ```
189
298
 
299
+ ### Embeddable Trust Badge
300
+
301
+ Every registered agent gets a public SVG trust badge you can embed anywhere:
302
+
303
+ ```html
304
+ <!-- Embed in your docs, landing page, or agent marketplace listing -->
305
+ <img src="https://api.vorim.ai/v1/trust/badge/agid_acme_a1b2c3d4.svg" alt="Vorim Trust Badge" />
306
+ ```
307
+
308
+ The badge displays the agent's current trust score and updates in real-time. Use it to signal trust to end users, partners, and other agents.
309
+
310
+ ---
311
+
190
312
  ## Configuration
191
313
 
192
314
  ```typescript
193
315
  import createVorim from "@vorim/sdk";
194
316
 
195
317
  const vorim = createVorim({
196
- apiKey: "agid_sk_live_...", // Required
197
- baseUrl: "https://api.vorim.ai", // Optional (default)
198
- timeout: 10000, // Optional — ms (default: 10000)
318
+ apiKey: "agid_sk_live_...", // Required — your Vorim API key
319
+ baseUrl: "https://api.vorim.ai", // Optional (default)
320
+ timeout: 10000, // Optional — request timeout in ms (default: 10000)
199
321
  });
200
322
  ```
201
323
 
324
+ | Option | Type | Default | Description |
325
+ |--------|------|---------|-------------|
326
+ | `apiKey` | `string` | — | Your Vorim API key (`agid_sk_live_...` or `agid_sk_test_...`) |
327
+ | `baseUrl` | `string` | `https://api.vorim.ai` | API base URL (override for self-hosted) |
328
+ | `timeout` | `number` | `10000` | Request timeout in milliseconds |
329
+
330
+ ---
331
+
202
332
  ## Error Handling
203
333
 
334
+ All errors throw `VorimError` with structured fields:
335
+
204
336
  ```typescript
205
337
  import createVorim, { VorimError } from "@vorim/sdk";
206
338
 
@@ -208,24 +340,65 @@ try {
208
340
  await vorim.check("invalid_id", "agent:read");
209
341
  } catch (err) {
210
342
  if (err instanceof VorimError) {
211
- console.log(err.status); // 404
212
- console.log(err.code); // 'AGENT_NOT_FOUND'
213
- console.log(err.message); // 'Agent invalid_id not found in the trust registry'
214
- console.log(err.details); // Additional error context
343
+ err.status; // 404
344
+ err.code; // 'AGENT_NOT_FOUND'
345
+ err.message; // 'Agent invalid_id not found in the trust registry'
346
+ err.details; // Additional context (optional)
215
347
  }
216
348
  }
217
349
  ```
218
350
 
351
+ | Error Code | Status | Meaning |
352
+ |-----------|--------|---------|
353
+ | `INVALID_CREDENTIALS` | 401 | Bad or expired API key |
354
+ | `AGENT_NOT_FOUND` | 404 | Agent ID doesn't exist |
355
+ | `PERMISSION_DENIED` | 403 | Agent lacks required scope |
356
+ | `RATE_LIMITED` | 429 | Too many requests |
357
+ | `VALIDATION_ERROR` | 400 | Invalid request payload |
358
+
359
+ ---
360
+
361
+ ## Features
362
+
363
+ | Feature | Details |
364
+ |---------|---------|
365
+ | **Cryptographic Identity** | Ed25519 keypairs with SHA-256 fingerprints |
366
+ | **7 Permission Scopes** | `read`, `write`, `execute`, `transact`, `communicate`, `delegate`, `elevate` |
367
+ | **Immutable Audit Trail** | Append-only events with content hashing |
368
+ | **Trust Scoring** | 5-factor algorithm producing a 0–100 score |
369
+ | **Payload Signing** | Client-side Ed25519 via Web Crypto or Node.js crypto |
370
+ | **Dual Runtime** | Node.js 18+ and modern browsers |
371
+ | **Zero Dependencies** | Types bundled — nothing extra to install |
372
+ | **ESM + CJS** | Dual module output for any bundler or runtime |
373
+
374
+ ---
375
+
219
376
  ## Protocol
220
377
 
221
- `@vorim/sdk` implements the [Vorim Agent Identity Protocol (VAIP)](https://github.com/Kzino/vorim-protocol) — an open standard for AI agent identity, permissions, and cryptographic audit trails.
378
+ This SDK implements the **[Vorim Agent Identity Protocol (VAIP)](https://github.com/Kzino/vorim-protocol)** — an open standard for AI agent identity, permissions, and cryptographic audit trails.
222
379
 
223
- Read the full specification: [SPEC.md](https://github.com/Kzino/vorim-protocol/blob/main/SPEC.md)
380
+ VAIP defines 5 conformance levels, from basic identity to full cryptographic signing. The protocol is open-source under Apache 2.0 — anyone can implement it.
381
+
382
+ Read the full specification: **[SPEC.md](https://github.com/Kzino/vorim-protocol/blob/main/SPEC.md)**
383
+
384
+ ---
224
385
 
225
386
  ## Requirements
226
387
 
227
- - Node.js 18+ or modern browser with Web Crypto API
228
- - TypeScript 5.0+ (optional, but recommended)
388
+ - **Node.js** 18+ or modern browser with Web Crypto API
389
+ - **TypeScript** 5.0+ (optional but recommended)
390
+
391
+ ---
392
+
393
+ ## Links
394
+
395
+ - **Website:** [vorim.ai](https://vorim.ai)
396
+ - **Protocol Spec:** [github.com/Kzino/vorim-protocol](https://github.com/Kzino/vorim-protocol)
397
+ - **npm:** [@vorim/sdk](https://www.npmjs.com/package/@vorim/sdk)
398
+ - **X:** [@vorim_ai_x](https://x.com/vorim_ai_x)
399
+ - **Issues:** [GitHub Issues](https://github.com/Kzino/vorim-protocol/issues)
400
+
401
+ ---
229
402
 
230
403
  ## License
231
404
 
@@ -233,4 +406,4 @@ MIT — see [LICENSE](LICENSE) for details.
233
406
 
234
407
  ---
235
408
 
236
- Built by [Vorim AI](https://vorim.ai)
409
+ Built by **[Vorim AI](https://vorim.ai)**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vorim/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Official TypeScript SDK for Vorim AI — AI Agent Identity, Permissions & Audit",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",