@vorim/sdk 3.5.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.
- package/CHANGELOG.md +35 -0
- package/dist/_runtime-gate-DZQTkw4J.d.cts +11 -0
- package/dist/_runtime-gate-DZQTkw4J.d.ts +11 -0
- package/dist/index.cjs +13 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -233
- package/dist/index.d.ts +6 -233
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/integrations/anthropic.cjs +54 -5
- package/dist/integrations/anthropic.cjs.map +1 -1
- package/dist/integrations/anthropic.d.cts +30 -1
- package/dist/integrations/anthropic.d.ts +30 -1
- package/dist/integrations/anthropic.js +54 -5
- package/dist/integrations/anthropic.js.map +1 -1
- package/dist/integrations/crewai.d.cts +2 -1
- package/dist/integrations/crewai.d.ts +2 -1
- package/dist/integrations/langchain.cjs +12 -14
- package/dist/integrations/langchain.cjs.map +1 -1
- package/dist/integrations/langchain.d.cts +9 -1
- package/dist/integrations/langchain.d.ts +9 -1
- package/dist/integrations/langchain.js +12 -14
- package/dist/integrations/langchain.js.map +1 -1
- package/dist/integrations/langgraph.cjs +200 -0
- package/dist/integrations/langgraph.cjs.map +1 -0
- package/dist/integrations/langgraph.d.cts +20 -0
- package/dist/integrations/langgraph.d.ts +20 -0
- package/dist/integrations/langgraph.js +162 -0
- package/dist/integrations/langgraph.js.map +1 -0
- package/dist/integrations/llamaindex.cjs +3 -4
- package/dist/integrations/llamaindex.cjs.map +1 -1
- package/dist/integrations/llamaindex.d.cts +2 -1
- package/dist/integrations/llamaindex.d.ts +2 -1
- package/dist/integrations/llamaindex.js +3 -4
- package/dist/integrations/llamaindex.js.map +1 -1
- package/dist/integrations/openai.cjs +66 -11
- package/dist/integrations/openai.cjs.map +1 -1
- package/dist/integrations/openai.d.cts +37 -1
- package/dist/integrations/openai.d.ts +37 -1
- package/dist/integrations/openai.js +66 -11
- package/dist/integrations/openai.js.map +1 -1
- package/dist/integrations/siem.cjs +128 -0
- package/dist/integrations/siem.cjs.map +1 -0
- package/dist/integrations/siem.d.cts +57 -0
- package/dist/integrations/siem.d.ts +57 -0
- package/dist/integrations/siem.js +102 -0
- package/dist/integrations/siem.js.map +1 -0
- package/dist/integrations/stripe-acp.cjs +179 -0
- package/dist/integrations/stripe-acp.cjs.map +1 -0
- package/dist/integrations/stripe-acp.d.cts +69 -0
- package/dist/integrations/stripe-acp.d.ts +69 -0
- package/dist/integrations/stripe-acp.js +153 -0
- package/dist/integrations/stripe-acp.js.map +1 -0
- package/dist/integrations/vercel-ai.cjs +252 -0
- package/dist/integrations/vercel-ai.cjs.map +1 -0
- package/dist/integrations/vercel-ai.d.cts +67 -0
- package/dist/integrations/vercel-ai.d.ts +67 -0
- package/dist/integrations/vercel-ai.js +214 -0
- package/dist/integrations/vercel-ai.js.map +1 -0
- package/dist/types-B22WnXEW.d.cts +234 -0
- package/dist/types-B22WnXEW.d.ts +234 -0
- package/package.json +41 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,235 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
}
|
|
1
|
+
import { R as RuntimeDecision, b as AgentRegistrationInput, A as AgentRegistrationResult, T as TrustRecord, c as Agent, P as PermissionScope, d as PermissionCheckResult, D as DelegationLinkClaims, e as AgentDelegationRecord, B as BeforeActionInput, a as AuditEventInput } from './types-B22WnXEW.cjs';
|
|
2
|
+
export { f as AgentStatus, g as AuditEventType, h as AuditResult, i as DecisionVerdict } from './types-B22WnXEW.cjs';
|
|
233
3
|
|
|
234
4
|
/**
|
|
235
5
|
* Replayable agent decision evidence helpers.
|
|
@@ -906,6 +676,9 @@ declare class VorimSDK {
|
|
|
906
676
|
private post;
|
|
907
677
|
private patch;
|
|
908
678
|
private delete;
|
|
679
|
+
/** Like request() but returns the FULL { data, meta, ... } envelope
|
|
680
|
+
* instead of unwrapping to `data`. Used where meta (pagination) matters. */
|
|
681
|
+
private requestEnvelope;
|
|
909
682
|
private request;
|
|
910
683
|
private pemToArrayBuffer;
|
|
911
684
|
private arrayBufferToBase64;
|
|
@@ -928,4 +701,4 @@ declare class VorimDeniedError extends VorimError {
|
|
|
928
701
|
}
|
|
929
702
|
declare function createVorim(config: VorimConfig): VorimSDK;
|
|
930
703
|
|
|
931
|
-
export {
|
|
704
|
+
export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, DelegationLinkClaims, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, canonicalPayloadV0, canonicalPayloadV1, createVorim as default, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, jcsCanonicalise, prepareReplayContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,235 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
}
|
|
1
|
+
import { R as RuntimeDecision, b as AgentRegistrationInput, A as AgentRegistrationResult, T as TrustRecord, c as Agent, P as PermissionScope, d as PermissionCheckResult, D as DelegationLinkClaims, e as AgentDelegationRecord, B as BeforeActionInput, a as AuditEventInput } from './types-B22WnXEW.js';
|
|
2
|
+
export { f as AgentStatus, g as AuditEventType, h as AuditResult, i as DecisionVerdict } from './types-B22WnXEW.js';
|
|
233
3
|
|
|
234
4
|
/**
|
|
235
5
|
* Replayable agent decision evidence helpers.
|
|
@@ -906,6 +676,9 @@ declare class VorimSDK {
|
|
|
906
676
|
private post;
|
|
907
677
|
private patch;
|
|
908
678
|
private delete;
|
|
679
|
+
/** Like request() but returns the FULL { data, meta, ... } envelope
|
|
680
|
+
* instead of unwrapping to `data`. Used where meta (pagination) matters. */
|
|
681
|
+
private requestEnvelope;
|
|
909
682
|
private request;
|
|
910
683
|
private pemToArrayBuffer;
|
|
911
684
|
private arrayBufferToBase64;
|
|
@@ -928,4 +701,4 @@ declare class VorimDeniedError extends VorimError {
|
|
|
928
701
|
}
|
|
929
702
|
declare function createVorim(config: VorimConfig): VorimSDK;
|
|
930
703
|
|
|
931
|
-
export {
|
|
704
|
+
export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, DelegationLinkClaims, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, canonicalPayloadV0, canonicalPayloadV1, createVorim as default, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, jcsCanonicalise, prepareReplayContext };
|
package/dist/index.js
CHANGED
|
@@ -17,10 +17,9 @@ function jcsCanonicalise(value) {
|
|
|
17
17
|
return "[" + value.map(jcsCanonicalise).join(",") + "]";
|
|
18
18
|
}
|
|
19
19
|
if (typeof value === "object") {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
});
|
|
20
|
+
const obj = value;
|
|
21
|
+
const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
|
|
22
|
+
const parts = keys.map((k) => JSON.stringify(k) + ":" + jcsCanonicalise(obj[k]));
|
|
24
23
|
return "{" + parts.join(",") + "}";
|
|
25
24
|
}
|
|
26
25
|
throw new Error(`jcsCanonicalise: unsupported value type: ${typeof value}`);
|
|
@@ -70,7 +69,7 @@ async function prepareReplayContext(inputs) {
|
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
// src/index.ts
|
|
73
|
-
var SDK_VERSION = true ? "3.
|
|
72
|
+
var SDK_VERSION = true ? "3.6.1" : "0.0.0";
|
|
74
73
|
var USER_AGENT = `vorim-sdk/${SDK_VERSION}`;
|
|
75
74
|
function sleep(ms) {
|
|
76
75
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -239,7 +238,8 @@ var VorimSDK = class _VorimSDK {
|
|
|
239
238
|
*/
|
|
240
239
|
async listAgents(params) {
|
|
241
240
|
const qs = new URLSearchParams(params).toString();
|
|
242
|
-
|
|
241
|
+
const env = await this.requestEnvelope("GET", `/agents${qs ? "?" + qs : ""}`);
|
|
242
|
+
return { agents: env.data ?? [], meta: env.meta ?? null };
|
|
243
243
|
}
|
|
244
244
|
/**
|
|
245
245
|
* Update an agent's metadata.
|
|
@@ -787,7 +787,12 @@ var VorimSDK = class _VorimSDK {
|
|
|
787
787
|
async delete(path) {
|
|
788
788
|
return this.request("DELETE", path);
|
|
789
789
|
}
|
|
790
|
-
|
|
790
|
+
/** Like request() but returns the FULL { data, meta, ... } envelope
|
|
791
|
+
* instead of unwrapping to `data`. Used where meta (pagination) matters. */
|
|
792
|
+
async requestEnvelope(method, path, body) {
|
|
793
|
+
return this.request(method, path, body, false);
|
|
794
|
+
}
|
|
795
|
+
async request(method, path, body, unwrap = true) {
|
|
791
796
|
const controller = new AbortController();
|
|
792
797
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
793
798
|
try {
|
|
@@ -811,7 +816,7 @@ var VorimSDK = class _VorimSDK {
|
|
|
811
816
|
);
|
|
812
817
|
}
|
|
813
818
|
const json = await response.json();
|
|
814
|
-
return json.data;
|
|
819
|
+
return unwrap ? json.data : json;
|
|
815
820
|
} finally {
|
|
816
821
|
clearTimeout(timeoutId);
|
|
817
822
|
}
|