@vorim/sdk 3.19.0 → 3.22.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 (109) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +73 -1
  3. package/dist/index.cjs +261 -9
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +140 -3
  6. package/dist/index.d.ts +140 -3
  7. package/dist/index.js +253 -9
  8. package/dist/index.js.map +1 -1
  9. package/dist/integrations/anthropic.d.cts +2 -1
  10. package/dist/integrations/anthropic.d.ts +2 -1
  11. package/dist/integrations/ap2.d.cts +2 -1
  12. package/dist/integrations/ap2.d.ts +2 -1
  13. package/dist/integrations/aws-iam.d.cts +2 -1
  14. package/dist/integrations/aws-iam.d.ts +2 -1
  15. package/dist/integrations/bank-rails.d.cts +2 -1
  16. package/dist/integrations/bank-rails.d.ts +2 -1
  17. package/dist/integrations/circle.d.cts +2 -1
  18. package/dist/integrations/circle.d.ts +2 -1
  19. package/dist/integrations/cloudflare.d.cts +2 -1
  20. package/dist/integrations/cloudflare.d.ts +2 -1
  21. package/dist/integrations/coinbase-cdp.d.cts +2 -1
  22. package/dist/integrations/coinbase-cdp.d.ts +2 -1
  23. package/dist/integrations/commerce-agents.cjs +467 -0
  24. package/dist/integrations/commerce-agents.cjs.map +1 -0
  25. package/dist/integrations/commerce-agents.d.cts +200 -0
  26. package/dist/integrations/commerce-agents.d.ts +200 -0
  27. package/dist/integrations/commerce-agents.js +429 -0
  28. package/dist/integrations/commerce-agents.js.map +1 -0
  29. package/dist/integrations/crewai.d.cts +2 -1
  30. package/dist/integrations/crewai.d.ts +2 -1
  31. package/dist/integrations/entra.d.cts +2 -1
  32. package/dist/integrations/entra.d.ts +2 -1
  33. package/dist/integrations/fhir.d.cts +2 -1
  34. package/dist/integrations/fhir.d.ts +2 -1
  35. package/dist/integrations/grok.d.cts +2 -1
  36. package/dist/integrations/grok.d.ts +2 -1
  37. package/dist/integrations/guidewire.d.cts +2 -1
  38. package/dist/integrations/guidewire.d.ts +2 -1
  39. package/dist/integrations/hermes.d.cts +2 -1
  40. package/dist/integrations/hermes.d.ts +2 -1
  41. package/dist/integrations/jira.d.cts +2 -1
  42. package/dist/integrations/jira.d.ts +2 -1
  43. package/dist/integrations/langchain.d.cts +2 -1
  44. package/dist/integrations/langchain.d.ts +2 -1
  45. package/dist/integrations/langgraph.d.cts +2 -1
  46. package/dist/integrations/langgraph.d.ts +2 -1
  47. package/dist/integrations/legal.d.cts +2 -1
  48. package/dist/integrations/legal.d.ts +2 -1
  49. package/dist/integrations/life-sciences.d.cts +2 -1
  50. package/dist/integrations/life-sciences.d.ts +2 -1
  51. package/dist/integrations/linear.d.cts +2 -1
  52. package/dist/integrations/linear.d.ts +2 -1
  53. package/dist/integrations/lithic.d.cts +2 -1
  54. package/dist/integrations/lithic.d.ts +2 -1
  55. package/dist/integrations/llamaindex.d.cts +2 -1
  56. package/dist/integrations/llamaindex.d.ts +2 -1
  57. package/dist/integrations/marqeta.d.cts +2 -1
  58. package/dist/integrations/marqeta.d.ts +2 -1
  59. package/dist/integrations/modern-treasury.d.cts +2 -1
  60. package/dist/integrations/modern-treasury.d.ts +2 -1
  61. package/dist/integrations/muse.cjs +437 -0
  62. package/dist/integrations/muse.cjs.map +1 -0
  63. package/dist/integrations/muse.d.cts +72 -0
  64. package/dist/integrations/muse.d.ts +72 -0
  65. package/dist/integrations/muse.js +394 -0
  66. package/dist/integrations/muse.js.map +1 -0
  67. package/dist/integrations/nekuda.d.cts +2 -1
  68. package/dist/integrations/nekuda.d.ts +2 -1
  69. package/dist/integrations/okta.d.cts +2 -1
  70. package/dist/integrations/okta.d.ts +2 -1
  71. package/dist/integrations/openai.d.cts +2 -1
  72. package/dist/integrations/openai.d.ts +2 -1
  73. package/dist/integrations/openrouter.d.cts +2 -1
  74. package/dist/integrations/openrouter.d.ts +2 -1
  75. package/dist/integrations/paypal-agent.d.cts +2 -1
  76. package/dist/integrations/paypal-agent.d.ts +2 -1
  77. package/dist/integrations/perplexity.d.cts +2 -1
  78. package/dist/integrations/perplexity.d.ts +2 -1
  79. package/dist/integrations/plaid.d.cts +2 -1
  80. package/dist/integrations/plaid.d.ts +2 -1
  81. package/dist/integrations/ramp.d.cts +2 -1
  82. package/dist/integrations/ramp.d.ts +2 -1
  83. package/dist/integrations/shopify.d.cts +2 -1
  84. package/dist/integrations/shopify.d.ts +2 -1
  85. package/dist/integrations/siem.d.cts +1 -1
  86. package/dist/integrations/siem.d.ts +1 -1
  87. package/dist/integrations/skyfire.d.cts +2 -1
  88. package/dist/integrations/skyfire.d.ts +2 -1
  89. package/dist/integrations/stripe-acp.d.cts +2 -1
  90. package/dist/integrations/stripe-acp.d.ts +2 -1
  91. package/dist/integrations/stripe-issuing.d.cts +2 -1
  92. package/dist/integrations/stripe-issuing.d.ts +2 -1
  93. package/dist/integrations/truanon.d.cts +2 -1
  94. package/dist/integrations/truanon.d.ts +2 -1
  95. package/dist/integrations/typesafe.cjs +268 -0
  96. package/dist/integrations/typesafe.cjs.map +1 -0
  97. package/dist/integrations/typesafe.d.cts +145 -0
  98. package/dist/integrations/typesafe.d.ts +145 -0
  99. package/dist/integrations/typesafe.js +221 -0
  100. package/dist/integrations/typesafe.js.map +1 -0
  101. package/dist/integrations/ucp.d.cts +2 -1
  102. package/dist/integrations/ucp.d.ts +2 -1
  103. package/dist/integrations/vercel-ai.d.cts +2 -1
  104. package/dist/integrations/vercel-ai.d.ts +2 -1
  105. package/dist/integrations/x402.d.cts +2 -1
  106. package/dist/integrations/x402.d.ts +2 -1
  107. package/dist/{types-BmeluKHI.d.cts → types-BrDQAJdl.d.cts} +36 -1
  108. package/dist/{types-BmeluKHI.d.ts → types-BrDQAJdl.d.ts} +36 -1
  109. package/package.json +31 -1
package/dist/index.d.cts CHANGED
@@ -1,5 +1,7 @@
1
- import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, S as SharedMemoryWriteInput, e as SharedMemoryEntry, f as SharedMemoryListResult, B as BeforeActionInput, g as TokenBudgetInput, h as TokenBudget, i as BudgetSpend, j as AuditEventInput } from './types-BmeluKHI.cjs';
2
- export { k as AgentStatus, l as AuditEventType, m as AuditResult, n as BudgetEnforcement, o as BudgetScope, p as DecisionVerdict, q as WorkflowGraphEdge, r as WorkflowGraphEvent, s as WorkflowGraphNode } from './types-BmeluKHI.cjs';
1
+ import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, S as SharedMemoryWriteInput, e as SharedMemoryEntry, f as SharedMemoryListResult, B as BeforeActionInput, g as TokenBudgetInput, h as TokenBudget, i as BudgetSpend, j as AuditEventInput } from './types-BrDQAJdl.cjs';
2
+ export { k as AgentStatus, l as ApprovalAttestation, m as AuditEventType, n as AuditResult, o as BudgetEnforcement, p as BudgetScope, q as DecisionVerdict, r as WorkflowGraphEdge, s as WorkflowGraphEvent, t as WorkflowGraphNode } from './types-BrDQAJdl.cjs';
3
+ import { PortableSignedReceipt } from '@vorim/shared-types';
4
+ export { PortableSignedReceipt, portableReceiptCanonicalBytes } from '@vorim/shared-types';
3
5
 
4
6
  /**
5
7
  * Replayable agent decision evidence helpers.
@@ -133,6 +135,55 @@ interface ReplayContext {
133
135
  */
134
136
  declare function prepareReplayContext(inputs: ReplayInputs): Promise<ReplayContext>;
135
137
 
138
+ /** Prefix used for keyed commitments. */
139
+ declare const HMAC_SHA256_PREFIX = "hmac-sha256:";
140
+ /** Prefix used for bare digests. */
141
+ declare const SHA256_PREFIX = "sha256:";
142
+ /**
143
+ * Key material for a payload commitment. Never transmitted by the SDK.
144
+ *
145
+ * A string is UTF-8 encoded. Prefer at least 32 bytes from a CSPRNG, held
146
+ * wherever you already hold secrets. One key per org is fine; one per agent
147
+ * or per tenant narrows what a single leaked key exposes.
148
+ */
149
+ type CommitmentKey = string | Uint8Array;
150
+ /**
151
+ * Bare SHA-256 digest of `content`, as `sha256:<hex>`.
152
+ *
153
+ * Correct only when `content` has enough entropy that guessing it is
154
+ * infeasible. For prompts, responses, tool arguments or anything else a
155
+ * human or a model wrote, use {@link commitPayload} instead.
156
+ */
157
+ declare function hashPayload(content: string | Uint8Array): Promise<string>;
158
+ /**
159
+ * Keyed commitment to `content`, as `hmac-sha256:<hex>`.
160
+ *
161
+ * `key` never leaves this process. Vorim stores and signs over the digest
162
+ * with no way to test a candidate plaintext against it.
163
+ *
164
+ * To disclose later, hand the verifier the content and the key; they
165
+ * recompute and compare. Disclosure is per-key, so a key scoped to one agent
166
+ * or one tenant lets you open that subset without opening the rest.
167
+ *
168
+ * Rotating the key does not invalidate past events. Old digests stay
169
+ * verifiable under the old key, which is why the key you used has to be
170
+ * retained for as long as you might need to prove the events it covers.
171
+ */
172
+ declare function commitPayload(content: string | Uint8Array, key: CommitmentKey): Promise<string>;
173
+ /**
174
+ * True when `digest` is a keyed commitment rather than a bare hash.
175
+ *
176
+ * Useful in a review or an export check: a bundle whose `input_hash` values
177
+ * are all `sha256:` carries content that a determined reader may be able to
178
+ * recover, and that is worth knowing before the bundle leaves the building.
179
+ */
180
+ declare function isKeyedCommitment(digest: unknown): boolean;
181
+ /**
182
+ * True when `digest` is a well-formed `<alg>:<64 hex>` value in a form the
183
+ * server and `@vorim/verify` both understand.
184
+ */
185
+ declare function isDigest(digest: unknown): boolean;
186
+
136
187
  interface VorimConfig {
137
188
  apiKey: string;
138
189
  baseUrl?: string;
@@ -164,6 +215,37 @@ interface VorimConfig {
164
215
  * a failure). Chain integrity is checked by `@vorim/verify`.
165
216
  */
166
217
  chainEvents?: boolean;
218
+ /**
219
+ * Refuse to transmit agent content. Default `false`.
220
+ *
221
+ * Vorim's event schema was already digest-shaped: `input_hash`,
222
+ * `output_hash` and `system_prompt_hash` are the fields prompts and
223
+ * responses are meant to travel as. Nothing enforced it, though. `metadata`
224
+ * is `Record<string, unknown>`, so a caller could put a whole prompt in it
225
+ * without noticing, and "we never receive your content" was a property of
226
+ * how you happened to call the SDK rather than a guarantee.
227
+ *
228
+ * With `noPayload` on, {@link VorimSDK.emit} and {@link VorimSDK.emitBatch}
229
+ * throw before anything is sent when an event would carry content:
230
+ *
231
+ * - any `metadata` value that is not a string, number, boolean or null
232
+ * (objects and arrays can nest arbitrary text)
233
+ * - any `metadata` string longer than `maxMetadataChars` (default 256)
234
+ * - any hash field that is not a well-formed `sha256:` / `hmac-sha256:`
235
+ * digest, which catches a raw prompt passed to `input_hash`
236
+ *
237
+ * This is distinct from the server-side Zero Data Retention setting. ZDR
238
+ * drops `metadata` at persistence, so the content still crossed the network
239
+ * and passed through our process. `noPayload` means it never left yours.
240
+ * Enterprises asking "can we send you nothing?" are asking for this one.
241
+ *
242
+ * It does not restrict `action` or `resource`. Both are short structural
243
+ * identifiers, both are covered by the v1 signature, and stripping them
244
+ * would break bundle verification. Keep tool names in them, not arguments.
245
+ */
246
+ noPayload?: boolean | {
247
+ maxMetadataChars?: number;
248
+ };
167
249
  /**
168
250
  * Client-side fail-open behaviour for {@link VorimSDK.beforeAction} when
169
251
  * the runtime decision API itself is unreachable (network error, DNS,
@@ -203,6 +285,21 @@ declare function canonicalPayloadV0(event: AuditEventInput): string;
203
285
  * script enforces equivalence with the Python SDK.
204
286
  */
205
287
  declare function canonicalPayloadV1(event: AuditEventInput): string;
288
+ /**
289
+ * Stable content digest of an audit event: `sha256:<hex>` over the event's
290
+ * canonical bytes, dispatched on `canonical_form` the same way signing is.
291
+ *
292
+ * Byte-identical to `eventDigest` in `@vorim/verify` and to the digest the
293
+ * server returns from `POST /audit/events`, so a counterparty can bind to a
294
+ * reference you computed locally without trusting either of us to compute it.
295
+ * It is also what `prev_event_hash` references, so a hash-chained emitter is
296
+ * already producing these whether it names them or not.
297
+ *
298
+ * Content digest, not an identity: two byte-identical events share one
299
+ * digest. Pair it with the `event_id` the server returns when you need a
300
+ * unique handle.
301
+ */
302
+ declare function eventDigest(event: AuditEventInput): Promise<string>;
206
303
  declare class VorimSDK {
207
304
  private apiKey;
208
305
  private baseUrl;
@@ -211,6 +308,8 @@ declare class VorimSDK {
211
308
  private canonicalForm;
212
309
  private chainEvents;
213
310
  private runtimeFailOpen;
311
+ private noPayload;
312
+ private maxMetadataChars;
214
313
  /**
215
314
  * In-memory keyring mapping agent_id -> PEM-encoded Ed25519 private key.
216
315
  * Populated automatically by register() and registerEphemeral(), or
@@ -638,6 +737,33 @@ declare class VorimSDK {
638
737
  timeoutMs?: number;
639
738
  pollIntervalMs?: number;
640
739
  }): Promise<RuntimeDecision>;
740
+ /**
741
+ * Mint a portable signed receipt for a decision: a self-contained,
742
+ * offline-verifiable statement that Vorim authorised this action.
743
+ *
744
+ * Use it when something OUTSIDE Vorim has to be convinced — a settlement
745
+ * layer, a downstream anchor, a counterparty's auditor. Verification needs
746
+ * the receipt and the public key from `GET /trust/keys`: no call back to
747
+ * Vorim, no chain, no network.
748
+ *
749
+ * Reproduce the signed bytes with `portableReceiptCanonicalBytes` from
750
+ * `@vorim/shared-types` (also re-exported here), then check `signature`
751
+ * against the key matching `kid`. Never re-derive those bytes by hand: the
752
+ * canonical form is defined once precisely so two implementations cannot
753
+ * drift into signatures that do not verify.
754
+ *
755
+ * Throws 409 when the decision is not an authorisation — a denial, a
756
+ * fail-open fallback, an unresolved escalation, or one a human refused.
757
+ * A receipt only ever means yes, so there is nothing to return for a no.
758
+ *
759
+ * @example
760
+ * const d = await vorim.beforeAction({ ... });
761
+ * if (d.decision === 'allow') {
762
+ * const receipt = await vorim.mintPortableSignedReceipt(d.decisionId);
763
+ * await settleWith(receipt); // the counterparty verifies it alone
764
+ * }
765
+ */
766
+ mintPortableSignedReceipt(decisionId: string): Promise<PortableSignedReceipt>;
641
767
  /**
642
768
  * Map a snake_case decision row (from POST or GET) to the camelCase
643
769
  * {@link RuntimeDecision}. The SDK has no generic camelizer, so the
@@ -670,6 +796,7 @@ declare class VorimSDK {
670
796
  */
671
797
  emit(event: AuditEventInput, options?: {
672
798
  sign?: boolean;
799
+ idempotencyKey?: string;
673
800
  }): Promise<{
674
801
  ingested: number;
675
802
  }>;
@@ -685,6 +812,7 @@ declare class VorimSDK {
685
812
  */
686
813
  emitBatch(events: AuditEventInput[], options?: {
687
814
  sign?: boolean;
815
+ idempotencyKey?: string;
688
816
  }): Promise<{
689
817
  ingested: number;
690
818
  }>;
@@ -712,6 +840,15 @@ declare class VorimSDK {
712
840
  * - Chain ops are serialised per-agent via `chainLocks` so
713
841
  * concurrent emits to the same agent build a deterministic chain.
714
842
  */
843
+ /**
844
+ * Fail closed when `noPayload` is on and an event would carry content.
845
+ *
846
+ * Runs before signing and before any network call, so a rejected event is
847
+ * one Vorim never saw. Throwing rather than stripping is deliberate: a
848
+ * silent strip would leave the caller believing they had logged something
849
+ * they had not, and would change the bytes after they were signed.
850
+ */
851
+ private assertNoPayload;
715
852
  private prepareEvent;
716
853
  /** Serialise per-agent and apply chain hash + sign. */
717
854
  private prepareEventChained;
@@ -924,4 +1061,4 @@ interface DeviceLoginResult {
924
1061
  */
925
1062
  declare function deviceLogin(opts: DeviceLoginOptions): Promise<DeviceLoginResult>;
926
1063
 
927
- export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalPayloadV0, canonicalPayloadV1, createVorim as default, deviceLogin, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, jcsCanonicalise, prepareReplayContext };
1064
+ export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, type CommitmentKey, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, HMAC_SHA256_PREFIX, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SHA256_PREFIX, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalPayloadV0, canonicalPayloadV1, commitPayload, createVorim as default, deviceLogin, eventDigest, hashPayload, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, isDigest, isKeyedCommitment, jcsCanonicalise, prepareReplayContext };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, S as SharedMemoryWriteInput, e as SharedMemoryEntry, f as SharedMemoryListResult, B as BeforeActionInput, g as TokenBudgetInput, h as TokenBudget, i as BudgetSpend, j as AuditEventInput } from './types-BmeluKHI.js';
2
- export { k as AgentStatus, l as AuditEventType, m as AuditResult, n as BudgetEnforcement, o as BudgetScope, p as DecisionVerdict, q as WorkflowGraphEdge, r as WorkflowGraphEvent, s as WorkflowGraphNode } from './types-BmeluKHI.js';
1
+ import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, S as SharedMemoryWriteInput, e as SharedMemoryEntry, f as SharedMemoryListResult, B as BeforeActionInput, g as TokenBudgetInput, h as TokenBudget, i as BudgetSpend, j as AuditEventInput } from './types-BrDQAJdl.js';
2
+ export { k as AgentStatus, l as ApprovalAttestation, m as AuditEventType, n as AuditResult, o as BudgetEnforcement, p as BudgetScope, q as DecisionVerdict, r as WorkflowGraphEdge, s as WorkflowGraphEvent, t as WorkflowGraphNode } from './types-BrDQAJdl.js';
3
+ import { PortableSignedReceipt } from '@vorim/shared-types';
4
+ export { PortableSignedReceipt, portableReceiptCanonicalBytes } from '@vorim/shared-types';
3
5
 
4
6
  /**
5
7
  * Replayable agent decision evidence helpers.
@@ -133,6 +135,55 @@ interface ReplayContext {
133
135
  */
134
136
  declare function prepareReplayContext(inputs: ReplayInputs): Promise<ReplayContext>;
135
137
 
138
+ /** Prefix used for keyed commitments. */
139
+ declare const HMAC_SHA256_PREFIX = "hmac-sha256:";
140
+ /** Prefix used for bare digests. */
141
+ declare const SHA256_PREFIX = "sha256:";
142
+ /**
143
+ * Key material for a payload commitment. Never transmitted by the SDK.
144
+ *
145
+ * A string is UTF-8 encoded. Prefer at least 32 bytes from a CSPRNG, held
146
+ * wherever you already hold secrets. One key per org is fine; one per agent
147
+ * or per tenant narrows what a single leaked key exposes.
148
+ */
149
+ type CommitmentKey = string | Uint8Array;
150
+ /**
151
+ * Bare SHA-256 digest of `content`, as `sha256:<hex>`.
152
+ *
153
+ * Correct only when `content` has enough entropy that guessing it is
154
+ * infeasible. For prompts, responses, tool arguments or anything else a
155
+ * human or a model wrote, use {@link commitPayload} instead.
156
+ */
157
+ declare function hashPayload(content: string | Uint8Array): Promise<string>;
158
+ /**
159
+ * Keyed commitment to `content`, as `hmac-sha256:<hex>`.
160
+ *
161
+ * `key` never leaves this process. Vorim stores and signs over the digest
162
+ * with no way to test a candidate plaintext against it.
163
+ *
164
+ * To disclose later, hand the verifier the content and the key; they
165
+ * recompute and compare. Disclosure is per-key, so a key scoped to one agent
166
+ * or one tenant lets you open that subset without opening the rest.
167
+ *
168
+ * Rotating the key does not invalidate past events. Old digests stay
169
+ * verifiable under the old key, which is why the key you used has to be
170
+ * retained for as long as you might need to prove the events it covers.
171
+ */
172
+ declare function commitPayload(content: string | Uint8Array, key: CommitmentKey): Promise<string>;
173
+ /**
174
+ * True when `digest` is a keyed commitment rather than a bare hash.
175
+ *
176
+ * Useful in a review or an export check: a bundle whose `input_hash` values
177
+ * are all `sha256:` carries content that a determined reader may be able to
178
+ * recover, and that is worth knowing before the bundle leaves the building.
179
+ */
180
+ declare function isKeyedCommitment(digest: unknown): boolean;
181
+ /**
182
+ * True when `digest` is a well-formed `<alg>:<64 hex>` value in a form the
183
+ * server and `@vorim/verify` both understand.
184
+ */
185
+ declare function isDigest(digest: unknown): boolean;
186
+
136
187
  interface VorimConfig {
137
188
  apiKey: string;
138
189
  baseUrl?: string;
@@ -164,6 +215,37 @@ interface VorimConfig {
164
215
  * a failure). Chain integrity is checked by `@vorim/verify`.
165
216
  */
166
217
  chainEvents?: boolean;
218
+ /**
219
+ * Refuse to transmit agent content. Default `false`.
220
+ *
221
+ * Vorim's event schema was already digest-shaped: `input_hash`,
222
+ * `output_hash` and `system_prompt_hash` are the fields prompts and
223
+ * responses are meant to travel as. Nothing enforced it, though. `metadata`
224
+ * is `Record<string, unknown>`, so a caller could put a whole prompt in it
225
+ * without noticing, and "we never receive your content" was a property of
226
+ * how you happened to call the SDK rather than a guarantee.
227
+ *
228
+ * With `noPayload` on, {@link VorimSDK.emit} and {@link VorimSDK.emitBatch}
229
+ * throw before anything is sent when an event would carry content:
230
+ *
231
+ * - any `metadata` value that is not a string, number, boolean or null
232
+ * (objects and arrays can nest arbitrary text)
233
+ * - any `metadata` string longer than `maxMetadataChars` (default 256)
234
+ * - any hash field that is not a well-formed `sha256:` / `hmac-sha256:`
235
+ * digest, which catches a raw prompt passed to `input_hash`
236
+ *
237
+ * This is distinct from the server-side Zero Data Retention setting. ZDR
238
+ * drops `metadata` at persistence, so the content still crossed the network
239
+ * and passed through our process. `noPayload` means it never left yours.
240
+ * Enterprises asking "can we send you nothing?" are asking for this one.
241
+ *
242
+ * It does not restrict `action` or `resource`. Both are short structural
243
+ * identifiers, both are covered by the v1 signature, and stripping them
244
+ * would break bundle verification. Keep tool names in them, not arguments.
245
+ */
246
+ noPayload?: boolean | {
247
+ maxMetadataChars?: number;
248
+ };
167
249
  /**
168
250
  * Client-side fail-open behaviour for {@link VorimSDK.beforeAction} when
169
251
  * the runtime decision API itself is unreachable (network error, DNS,
@@ -203,6 +285,21 @@ declare function canonicalPayloadV0(event: AuditEventInput): string;
203
285
  * script enforces equivalence with the Python SDK.
204
286
  */
205
287
  declare function canonicalPayloadV1(event: AuditEventInput): string;
288
+ /**
289
+ * Stable content digest of an audit event: `sha256:<hex>` over the event's
290
+ * canonical bytes, dispatched on `canonical_form` the same way signing is.
291
+ *
292
+ * Byte-identical to `eventDigest` in `@vorim/verify` and to the digest the
293
+ * server returns from `POST /audit/events`, so a counterparty can bind to a
294
+ * reference you computed locally without trusting either of us to compute it.
295
+ * It is also what `prev_event_hash` references, so a hash-chained emitter is
296
+ * already producing these whether it names them or not.
297
+ *
298
+ * Content digest, not an identity: two byte-identical events share one
299
+ * digest. Pair it with the `event_id` the server returns when you need a
300
+ * unique handle.
301
+ */
302
+ declare function eventDigest(event: AuditEventInput): Promise<string>;
206
303
  declare class VorimSDK {
207
304
  private apiKey;
208
305
  private baseUrl;
@@ -211,6 +308,8 @@ declare class VorimSDK {
211
308
  private canonicalForm;
212
309
  private chainEvents;
213
310
  private runtimeFailOpen;
311
+ private noPayload;
312
+ private maxMetadataChars;
214
313
  /**
215
314
  * In-memory keyring mapping agent_id -> PEM-encoded Ed25519 private key.
216
315
  * Populated automatically by register() and registerEphemeral(), or
@@ -638,6 +737,33 @@ declare class VorimSDK {
638
737
  timeoutMs?: number;
639
738
  pollIntervalMs?: number;
640
739
  }): Promise<RuntimeDecision>;
740
+ /**
741
+ * Mint a portable signed receipt for a decision: a self-contained,
742
+ * offline-verifiable statement that Vorim authorised this action.
743
+ *
744
+ * Use it when something OUTSIDE Vorim has to be convinced — a settlement
745
+ * layer, a downstream anchor, a counterparty's auditor. Verification needs
746
+ * the receipt and the public key from `GET /trust/keys`: no call back to
747
+ * Vorim, no chain, no network.
748
+ *
749
+ * Reproduce the signed bytes with `portableReceiptCanonicalBytes` from
750
+ * `@vorim/shared-types` (also re-exported here), then check `signature`
751
+ * against the key matching `kid`. Never re-derive those bytes by hand: the
752
+ * canonical form is defined once precisely so two implementations cannot
753
+ * drift into signatures that do not verify.
754
+ *
755
+ * Throws 409 when the decision is not an authorisation — a denial, a
756
+ * fail-open fallback, an unresolved escalation, or one a human refused.
757
+ * A receipt only ever means yes, so there is nothing to return for a no.
758
+ *
759
+ * @example
760
+ * const d = await vorim.beforeAction({ ... });
761
+ * if (d.decision === 'allow') {
762
+ * const receipt = await vorim.mintPortableSignedReceipt(d.decisionId);
763
+ * await settleWith(receipt); // the counterparty verifies it alone
764
+ * }
765
+ */
766
+ mintPortableSignedReceipt(decisionId: string): Promise<PortableSignedReceipt>;
641
767
  /**
642
768
  * Map a snake_case decision row (from POST or GET) to the camelCase
643
769
  * {@link RuntimeDecision}. The SDK has no generic camelizer, so the
@@ -670,6 +796,7 @@ declare class VorimSDK {
670
796
  */
671
797
  emit(event: AuditEventInput, options?: {
672
798
  sign?: boolean;
799
+ idempotencyKey?: string;
673
800
  }): Promise<{
674
801
  ingested: number;
675
802
  }>;
@@ -685,6 +812,7 @@ declare class VorimSDK {
685
812
  */
686
813
  emitBatch(events: AuditEventInput[], options?: {
687
814
  sign?: boolean;
815
+ idempotencyKey?: string;
688
816
  }): Promise<{
689
817
  ingested: number;
690
818
  }>;
@@ -712,6 +840,15 @@ declare class VorimSDK {
712
840
  * - Chain ops are serialised per-agent via `chainLocks` so
713
841
  * concurrent emits to the same agent build a deterministic chain.
714
842
  */
843
+ /**
844
+ * Fail closed when `noPayload` is on and an event would carry content.
845
+ *
846
+ * Runs before signing and before any network call, so a rejected event is
847
+ * one Vorim never saw. Throwing rather than stripping is deliberate: a
848
+ * silent strip would leave the caller believing they had logged something
849
+ * they had not, and would change the bytes after they were signed.
850
+ */
851
+ private assertNoPayload;
715
852
  private prepareEvent;
716
853
  /** Serialise per-agent and apply chain hash + sign. */
717
854
  private prepareEventChained;
@@ -924,4 +1061,4 @@ interface DeviceLoginResult {
924
1061
  */
925
1062
  declare function deviceLogin(opts: DeviceLoginOptions): Promise<DeviceLoginResult>;
926
1063
 
927
- export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalPayloadV0, canonicalPayloadV1, createVorim as default, deviceLogin, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, jcsCanonicalise, prepareReplayContext };
1064
+ export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, type CommitmentKey, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, HMAC_SHA256_PREFIX, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SHA256_PREFIX, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalPayloadV0, canonicalPayloadV1, commitPayload, createVorim as default, deviceLogin, eventDigest, hashPayload, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, isDigest, isKeyedCommitment, jcsCanonicalise, prepareReplayContext };