@vorim/sdk 3.6.0 → 3.6.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/_runtime-gate-DZQTkw4J.d.cts +11 -0
  3. package/dist/_runtime-gate-DZQTkw4J.d.ts +11 -0
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.cts +3 -233
  6. package/dist/index.d.ts +3 -233
  7. package/dist/index.js +1 -1
  8. package/dist/integrations/anthropic.cjs +38 -9
  9. package/dist/integrations/anthropic.cjs.map +1 -1
  10. package/dist/integrations/anthropic.d.cts +17 -1
  11. package/dist/integrations/anthropic.d.ts +17 -1
  12. package/dist/integrations/anthropic.js +38 -9
  13. package/dist/integrations/anthropic.js.map +1 -1
  14. package/dist/integrations/crewai.d.cts +2 -1
  15. package/dist/integrations/crewai.d.ts +2 -1
  16. package/dist/integrations/langchain.cjs +9 -10
  17. package/dist/integrations/langchain.cjs.map +1 -1
  18. package/dist/integrations/langchain.d.cts +9 -1
  19. package/dist/integrations/langchain.d.ts +9 -1
  20. package/dist/integrations/langchain.js +9 -10
  21. package/dist/integrations/langchain.js.map +1 -1
  22. package/dist/integrations/langgraph.cjs +200 -0
  23. package/dist/integrations/langgraph.cjs.map +1 -0
  24. package/dist/integrations/langgraph.d.cts +20 -0
  25. package/dist/integrations/langgraph.d.ts +20 -0
  26. package/dist/integrations/langgraph.js +162 -0
  27. package/dist/integrations/langgraph.js.map +1 -0
  28. package/dist/integrations/llamaindex.d.cts +2 -1
  29. package/dist/integrations/llamaindex.d.ts +2 -1
  30. package/dist/integrations/openai.cjs +38 -9
  31. package/dist/integrations/openai.cjs.map +1 -1
  32. package/dist/integrations/openai.d.cts +17 -1
  33. package/dist/integrations/openai.d.ts +17 -1
  34. package/dist/integrations/openai.js +38 -9
  35. package/dist/integrations/openai.js.map +1 -1
  36. package/dist/integrations/siem.cjs +128 -0
  37. package/dist/integrations/siem.cjs.map +1 -0
  38. package/dist/integrations/siem.d.cts +57 -0
  39. package/dist/integrations/siem.d.ts +57 -0
  40. package/dist/integrations/siem.js +102 -0
  41. package/dist/integrations/siem.js.map +1 -0
  42. package/dist/integrations/stripe-acp.cjs +179 -0
  43. package/dist/integrations/stripe-acp.cjs.map +1 -0
  44. package/dist/integrations/stripe-acp.d.cts +69 -0
  45. package/dist/integrations/stripe-acp.d.ts +69 -0
  46. package/dist/integrations/stripe-acp.js +153 -0
  47. package/dist/integrations/stripe-acp.js.map +1 -0
  48. package/dist/integrations/vercel-ai.cjs +252 -0
  49. package/dist/integrations/vercel-ai.cjs.map +1 -0
  50. package/dist/integrations/vercel-ai.d.cts +67 -0
  51. package/dist/integrations/vercel-ai.d.ts +67 -0
  52. package/dist/integrations/vercel-ai.js +214 -0
  53. package/dist/integrations/vercel-ai.js.map +1 -0
  54. package/dist/types-B22WnXEW.d.cts +234 -0
  55. package/dist/types-B22WnXEW.d.ts +234 -0
  56. package/package.json +41 -1
@@ -0,0 +1,234 @@
1
+ type AgentStatus = 'pending' | 'active' | 'suspended' | 'revoked' | 'expired';
2
+ interface Agent {
3
+ id: string;
4
+ agent_id: string;
5
+ org_id: string;
6
+ owner_user_id: string;
7
+ name: string;
8
+ description?: string;
9
+ status: AgentStatus;
10
+ key_fingerprint: string;
11
+ trust_score: number;
12
+ capabilities: string[];
13
+ metadata: Record<string, unknown>;
14
+ expires_at?: string;
15
+ created_at: string;
16
+ updated_at: string;
17
+ revoked_at?: string;
18
+ revoked_by?: string;
19
+ }
20
+ interface AgentRegistrationInput {
21
+ name: string;
22
+ description?: string;
23
+ capabilities: string[];
24
+ scopes: PermissionScope[];
25
+ }
26
+ interface AgentRegistrationResult {
27
+ agent: Agent;
28
+ private_key: string;
29
+ public_key: string;
30
+ key_fingerprint: string;
31
+ }
32
+ type PermissionScope = 'agent:read' | 'agent:write' | 'agent:execute' | 'agent:transact' | 'agent:communicate' | 'agent:delegate' | 'agent:elevate';
33
+ interface PermissionCheckResult {
34
+ allowed: boolean;
35
+ scope: PermissionScope;
36
+ agent_id: string;
37
+ reason?: string;
38
+ remaining_quota?: number;
39
+ }
40
+ type AuditEventType = 'tool_call' | 'api_request' | 'message_sent' | 'permission_change' | 'status_change' | 'key_rotation' | 'login' | 'export';
41
+ type AuditResult = 'success' | 'denied' | 'error';
42
+ interface AuditEventInput {
43
+ agent_id: string;
44
+ event_type: AuditEventType;
45
+ action: string;
46
+ resource?: string;
47
+ input_hash?: string;
48
+ output_hash?: string;
49
+ permission?: PermissionScope;
50
+ result: AuditResult;
51
+ latency_ms?: number;
52
+ error_code?: string;
53
+ signature?: string;
54
+ metadata?: Record<string, unknown>;
55
+ /**
56
+ * Replayable agent decision evidence (VAIP -02 schema fields).
57
+ *
58
+ * Stored and exported but NOT covered by the v0 canonical signature
59
+ * form. They will enter canonical bytes in v1 (RFC 8785 JCS) in a
60
+ * follow-up release. Until then, advisory.
61
+ *
62
+ * Use the helpers from this package to compute the hashes:
63
+ * - {@link hashToolCatalogue}
64
+ * - {@link hashSystemPrompt}
65
+ */
66
+ model_version?: string;
67
+ tool_catalogue_hash?: string;
68
+ system_prompt_hash?: string;
69
+ prev_event_hash?: string;
70
+ /**
71
+ * Canonical-form recipe the `signature` was computed over.
72
+ * Absent/null ↔ 'v0' (pipe-joined six-field form). Set to 'v1' for
73
+ * RFC 8785 JCS over the full event minus signature and canonical_form.
74
+ * The SDK sets this automatically when {@link VorimConfig.canonicalForm}
75
+ * is `"v1"`; you can also pass it on a per-event basis.
76
+ */
77
+ canonical_form?: 'v0' | 'v1';
78
+ /**
79
+ * Per-event delegation context (VAIP -02 § 6). Populated by the
80
+ * server when the emitting agent is acting via a delegation chain;
81
+ * callers may also set these manually for events recorded outside
82
+ * the standard delegation flow. v1 signatures cover these fields.
83
+ */
84
+ on_behalf_of?: string;
85
+ delegator_agent_id?: string;
86
+ delegation_chain_id?: string;
87
+ delegation_depth?: number;
88
+ /**
89
+ * Runtime-control linkage. When this action was gated through
90
+ * {@link VorimSDK.beforeAction} before being performed, pass the
91
+ * returned `decisionId` here (the SDK maps it to `decision_id` on the
92
+ * wire) so the audit event links back to the runtime decision that
93
+ * authorised it.
94
+ */
95
+ decision_id?: string;
96
+ }
97
+ /**
98
+ * Claims structure for one VAIP -02 § 5 delegation link.
99
+ *
100
+ * Each delegation step in a chain is one of these objects, RFC 8785 JCS
101
+ * canonicalised and Ed25519-signed by the delegator. Mirrors the same
102
+ * type in `@vorim/shared-types`; duplicated here so the SDK ships zero
103
+ * runtime dependencies. Byte-equivalence with the shared definition is
104
+ * enforced by the cross-language parity script.
105
+ */
106
+ interface DelegationLinkClaims {
107
+ v: 0;
108
+ type: 'vaip-delegation-link';
109
+ chain_id: string;
110
+ depth: number;
111
+ delegator: string;
112
+ delegate: string;
113
+ scopes: string[];
114
+ max_chain_depth: number;
115
+ valid_from: string;
116
+ valid_until: string | null;
117
+ parent_link_hash: string | null;
118
+ }
119
+ /**
120
+ * One step in an agent-to-agent identity delegation chain (VAIP -02 § 5).
121
+ *
122
+ * Returned by {@link VorimSDK.delegateToAgent} and the listing endpoints.
123
+ */
124
+ interface AgentDelegationRecord {
125
+ /** Internal row id. */
126
+ id: string;
127
+ /** Public chain identifier (format `chain_<32hex>`). Stamped on
128
+ * every audit event in this chain. */
129
+ publicChainId: string;
130
+ /** Organisation id. */
131
+ orgId: string;
132
+ /** Internal DB id of the delegator agent. */
133
+ delegatorAgentId: string;
134
+ /** Internal DB id of the delegate agent. */
135
+ delegateAgentId: string;
136
+ /** Public agent_id of the delegator (e.g. agid_acme_abc). */
137
+ delegatorAgentPublicId: string;
138
+ /** Public agent_id of the delegate. */
139
+ delegateAgentPublicId: string;
140
+ /** Scopes the delegate may exercise. */
141
+ scopesDelegated: string[];
142
+ /** How many further hops the delegate is permitted. */
143
+ maxChainDepth: number;
144
+ /** This step's depth from the root (root delegator step = 1). */
145
+ currentDepth: number;
146
+ /** Active / suspended / revoked / expired. */
147
+ status: 'active' | 'suspended' | 'revoked' | 'expired';
148
+ /** Parent delegation row (null for the root of an identity chain). */
149
+ parentDelegationId: string | null;
150
+ /** Public agent_id of the root principal of this chain. */
151
+ onBehalfOf: string;
152
+ /** ISO8601 creation timestamp. */
153
+ createdAt: string;
154
+ /** Optional ISO8601 expiry. */
155
+ validUntil: string | null;
156
+ }
157
+ interface TrustRecord {
158
+ agent_id: string;
159
+ owner: {
160
+ org_name: string;
161
+ verified: boolean;
162
+ };
163
+ trust_score: number;
164
+ status: AgentStatus;
165
+ created_at: string;
166
+ active_scopes: PermissionScope[];
167
+ key_fingerprint: string;
168
+ revocation_status: boolean;
169
+ last_active?: string;
170
+ }
171
+ /**
172
+ * The verdict a runtime decision can carry.
173
+ *
174
+ * - `allow` — proceed with the action.
175
+ * - `deny` — do NOT perform the action. {@link VorimSDK.beforeAction}
176
+ * throws {@link VorimDeniedError} on this when `throwOnDeny`.
177
+ * - `modify` — proceed, but with `modifiedPayload` instead of the
178
+ * original payload (e.g. PII masked by a policy rule).
179
+ * - `escalate` — a human must approve. Poll
180
+ * {@link VorimSDK.waitForDecisionResolution} for the outcome.
181
+ * - `fallback` — the engine could not decide (timeout / error) and the
182
+ * org's fail-open/closed setting was applied. `isFallback`
183
+ * is true. The SDK also returns this shape locally when the
184
+ * decision API is unreachable and `runtimeFailOpen` is set.
185
+ */
186
+ type DecisionVerdict = 'allow' | 'deny' | 'modify' | 'escalate' | 'fallback';
187
+ /** Input to {@link VorimSDK.beforeAction}. Always use the public `agid_*` id. */
188
+ interface BeforeActionInput {
189
+ /** Public agent identifier (`agid_*`). UUIDs are accepted but discouraged. */
190
+ agentId: string;
191
+ /** Coarse action category, e.g. `tool_call`, `api_request`. */
192
+ actionType: string;
193
+ /** Specific target, e.g. the tool name `sendEmail`. */
194
+ actionTarget?: string;
195
+ /** The action's arguments. Capped at 64KB serialised by the server. */
196
+ payload?: Record<string, unknown>;
197
+ /** Free-form context the policy engine may match on. */
198
+ context?: Record<string, unknown>;
199
+ /** Permission scope the action requires; checked against the agent's grants. */
200
+ requiredScope?: string;
201
+ /**
202
+ * Idempotency key. Pass the SAME key when retrying a failed request so
203
+ * the server returns the original decision instead of creating a new one.
204
+ */
205
+ idempotencyKey?: string;
206
+ }
207
+ /** A runtime decision, as returned by {@link VorimSDK.beforeAction}. */
208
+ interface RuntimeDecision {
209
+ /** Server-assigned id. Carry into {@link AuditEventInput.decision_id}. */
210
+ decisionId: string;
211
+ decision: DecisionVerdict;
212
+ reason: string;
213
+ /** The policy rule that produced this decision, or null for defaults. */
214
+ decisionRuleId: string | null;
215
+ /** Present (object) when `decision === 'modify'`; null otherwise. */
216
+ modifiedPayload: Record<string, unknown> | null;
217
+ /** ISO8601 — after this the decision is stale and should not be relied on. */
218
+ expiresAt: string;
219
+ latencyMs: number;
220
+ /** True when the engine fell back (timeout/error/unreachable). */
221
+ isFallback: boolean;
222
+ policyVersion: number;
223
+ /**
224
+ * The human verdict on an escalation, once resolved by an operator:
225
+ * `'approved'`, `'denied'`, or `null` if not (yet) an escalation outcome.
226
+ *
227
+ * When this is set, {@link decision} is already translated for you
228
+ * (`approved` → `'allow'`, `denied` → `'deny'`) so the normal verdict
229
+ * checks work — this field is the raw resolution for callers who want it.
230
+ */
231
+ escalationResolution: 'approved' | 'denied' | null;
232
+ }
233
+
234
+ export type { AgentRegistrationResult as A, BeforeActionInput as B, DelegationLinkClaims as D, PermissionScope as P, RuntimeDecision as R, TrustRecord as T, AuditEventInput as a, AgentRegistrationInput as b, Agent as c, PermissionCheckResult as d, AgentDelegationRecord as e, AgentStatus as f, AuditEventType as g, AuditResult as h, DecisionVerdict as i };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vorim/sdk",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Official TypeScript SDK for Vorim AI — AI Agent Identity, Permissions & Audit",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -66,6 +66,46 @@
66
66
  "types": "./dist/integrations/anthropic.d.cts",
67
67
  "default": "./dist/integrations/anthropic.cjs"
68
68
  }
69
+ },
70
+ "./integrations/langgraph": {
71
+ "import": {
72
+ "types": "./dist/integrations/langgraph.d.ts",
73
+ "default": "./dist/integrations/langgraph.js"
74
+ },
75
+ "require": {
76
+ "types": "./dist/integrations/langgraph.d.cts",
77
+ "default": "./dist/integrations/langgraph.cjs"
78
+ }
79
+ },
80
+ "./integrations/vercel-ai": {
81
+ "import": {
82
+ "types": "./dist/integrations/vercel-ai.d.ts",
83
+ "default": "./dist/integrations/vercel-ai.js"
84
+ },
85
+ "require": {
86
+ "types": "./dist/integrations/vercel-ai.d.cts",
87
+ "default": "./dist/integrations/vercel-ai.cjs"
88
+ }
89
+ },
90
+ "./integrations/stripe-acp": {
91
+ "import": {
92
+ "types": "./dist/integrations/stripe-acp.d.ts",
93
+ "default": "./dist/integrations/stripe-acp.js"
94
+ },
95
+ "require": {
96
+ "types": "./dist/integrations/stripe-acp.d.cts",
97
+ "default": "./dist/integrations/stripe-acp.cjs"
98
+ }
99
+ },
100
+ "./integrations/siem": {
101
+ "import": {
102
+ "types": "./dist/integrations/siem.d.ts",
103
+ "default": "./dist/integrations/siem.js"
104
+ },
105
+ "require": {
106
+ "types": "./dist/integrations/siem.d.cts",
107
+ "default": "./dist/integrations/siem.cjs"
108
+ }
69
109
  }
70
110
  },
71
111
  "files": [