@vorim/sdk 4.1.1 → 4.3.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 (152) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{_commerce-core-Dyr_dHVP.d.ts → _commerce-core-BIqTJ7Om.d.ts} +1 -1
  3. package/dist/{_commerce-core-wY2jC6rC.d.cts → _commerce-core-BQbISpWe.d.cts} +1 -1
  4. package/dist/index.cjs +85 -4
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +38 -3
  7. package/dist/index.d.ts +38 -3
  8. package/dist/index.js +84 -4
  9. package/dist/index.js.map +1 -1
  10. package/dist/integrations/amazon.d.cts +2 -2
  11. package/dist/integrations/amazon.d.ts +2 -2
  12. package/dist/integrations/anthropic.d.cts +1 -1
  13. package/dist/integrations/anthropic.d.ts +1 -1
  14. package/dist/integrations/ap2.d.cts +1 -1
  15. package/dist/integrations/ap2.d.ts +1 -1
  16. package/dist/integrations/aws-iam.d.cts +1 -1
  17. package/dist/integrations/aws-iam.d.ts +1 -1
  18. package/dist/integrations/bank-rails.d.cts +1 -1
  19. package/dist/integrations/bank-rails.d.ts +1 -1
  20. package/dist/integrations/circle.d.cts +1 -1
  21. package/dist/integrations/circle.d.ts +1 -1
  22. package/dist/integrations/cloudflare.d.cts +1 -1
  23. package/dist/integrations/cloudflare.d.ts +1 -1
  24. package/dist/integrations/coinbase-cdp.d.cts +1 -1
  25. package/dist/integrations/coinbase-cdp.d.ts +1 -1
  26. package/dist/integrations/commerce-agents.d.cts +1 -1
  27. package/dist/integrations/commerce-agents.d.ts +1 -1
  28. package/dist/integrations/crewai.d.cts +1 -1
  29. package/dist/integrations/crewai.d.ts +1 -1
  30. package/dist/integrations/delivery.d.cts +2 -2
  31. package/dist/integrations/delivery.d.ts +2 -2
  32. package/dist/integrations/ebay.d.cts +2 -2
  33. package/dist/integrations/ebay.d.ts +2 -2
  34. package/dist/integrations/entra.d.cts +1 -1
  35. package/dist/integrations/entra.d.ts +1 -1
  36. package/dist/integrations/etsy.d.cts +2 -2
  37. package/dist/integrations/etsy.d.ts +2 -2
  38. package/dist/integrations/eu-providers.cjs +463 -0
  39. package/dist/integrations/eu-providers.cjs.map +1 -0
  40. package/dist/integrations/eu-providers.d.cts +123 -0
  41. package/dist/integrations/eu-providers.d.ts +123 -0
  42. package/dist/integrations/eu-providers.js +420 -0
  43. package/dist/integrations/eu-providers.js.map +1 -0
  44. package/dist/integrations/fhir.d.cts +1 -1
  45. package/dist/integrations/fhir.d.ts +1 -1
  46. package/dist/integrations/google-merchant.d.cts +2 -2
  47. package/dist/integrations/google-merchant.d.ts +2 -2
  48. package/dist/integrations/grok.cjs +9 -3
  49. package/dist/integrations/grok.cjs.map +1 -1
  50. package/dist/integrations/grok.d.cts +1 -1
  51. package/dist/integrations/grok.d.ts +1 -1
  52. package/dist/integrations/grok.js +9 -3
  53. package/dist/integrations/grok.js.map +1 -1
  54. package/dist/integrations/guidewire.d.cts +1 -1
  55. package/dist/integrations/guidewire.d.ts +1 -1
  56. package/dist/integrations/hermes.d.cts +1 -1
  57. package/dist/integrations/hermes.d.ts +1 -1
  58. package/dist/integrations/jira.d.cts +1 -1
  59. package/dist/integrations/jira.d.ts +1 -1
  60. package/dist/integrations/langchain.cjs +26 -7
  61. package/dist/integrations/langchain.cjs.map +1 -1
  62. package/dist/integrations/langchain.d.cts +1 -1
  63. package/dist/integrations/langchain.d.ts +1 -1
  64. package/dist/integrations/langchain.js +26 -7
  65. package/dist/integrations/langchain.js.map +1 -1
  66. package/dist/integrations/langgraph.d.cts +1 -1
  67. package/dist/integrations/langgraph.d.ts +1 -1
  68. package/dist/integrations/legal.d.cts +1 -1
  69. package/dist/integrations/legal.d.ts +1 -1
  70. package/dist/integrations/life-sciences.d.cts +1 -1
  71. package/dist/integrations/life-sciences.d.ts +1 -1
  72. package/dist/integrations/linear.d.cts +1 -1
  73. package/dist/integrations/linear.d.ts +1 -1
  74. package/dist/integrations/lithic.d.cts +1 -1
  75. package/dist/integrations/lithic.d.ts +1 -1
  76. package/dist/integrations/llamaindex.d.cts +1 -1
  77. package/dist/integrations/llamaindex.d.ts +1 -1
  78. package/dist/integrations/marqeta.d.cts +1 -1
  79. package/dist/integrations/marqeta.d.ts +1 -1
  80. package/dist/integrations/meta.d.cts +2 -2
  81. package/dist/integrations/meta.d.ts +2 -2
  82. package/dist/integrations/mistral.cjs +487 -0
  83. package/dist/integrations/mistral.cjs.map +1 -0
  84. package/dist/integrations/mistral.d.cts +133 -0
  85. package/dist/integrations/mistral.d.ts +133 -0
  86. package/dist/integrations/mistral.js +439 -0
  87. package/dist/integrations/mistral.js.map +1 -0
  88. package/dist/integrations/modern-treasury.d.cts +1 -1
  89. package/dist/integrations/modern-treasury.d.ts +1 -1
  90. package/dist/integrations/muse.cjs +9 -3
  91. package/dist/integrations/muse.cjs.map +1 -1
  92. package/dist/integrations/muse.d.cts +1 -1
  93. package/dist/integrations/muse.d.ts +1 -1
  94. package/dist/integrations/muse.js +9 -3
  95. package/dist/integrations/muse.js.map +1 -1
  96. package/dist/integrations/nekuda.d.cts +1 -1
  97. package/dist/integrations/nekuda.d.ts +1 -1
  98. package/dist/integrations/okta.d.cts +1 -1
  99. package/dist/integrations/okta.d.ts +1 -1
  100. package/dist/integrations/openai.cjs +9 -3
  101. package/dist/integrations/openai.cjs.map +1 -1
  102. package/dist/integrations/openai.d.cts +11 -1
  103. package/dist/integrations/openai.d.ts +11 -1
  104. package/dist/integrations/openai.js +9 -3
  105. package/dist/integrations/openai.js.map +1 -1
  106. package/dist/integrations/openrouter.cjs +9 -3
  107. package/dist/integrations/openrouter.cjs.map +1 -1
  108. package/dist/integrations/openrouter.d.cts +1 -1
  109. package/dist/integrations/openrouter.d.ts +1 -1
  110. package/dist/integrations/openrouter.js +9 -3
  111. package/dist/integrations/openrouter.js.map +1 -1
  112. package/dist/integrations/paypal-agent.d.cts +1 -1
  113. package/dist/integrations/paypal-agent.d.ts +1 -1
  114. package/dist/integrations/perplexity.cjs +9 -3
  115. package/dist/integrations/perplexity.cjs.map +1 -1
  116. package/dist/integrations/perplexity.d.cts +1 -1
  117. package/dist/integrations/perplexity.d.ts +1 -1
  118. package/dist/integrations/perplexity.js +9 -3
  119. package/dist/integrations/perplexity.js.map +1 -1
  120. package/dist/integrations/plaid.d.cts +1 -1
  121. package/dist/integrations/plaid.d.ts +1 -1
  122. package/dist/integrations/ramp.d.cts +1 -1
  123. package/dist/integrations/ramp.d.ts +1 -1
  124. package/dist/integrations/shopify.d.cts +1 -1
  125. package/dist/integrations/shopify.d.ts +1 -1
  126. package/dist/integrations/siem.d.cts +1 -1
  127. package/dist/integrations/siem.d.ts +1 -1
  128. package/dist/integrations/skyfire.d.cts +1 -1
  129. package/dist/integrations/skyfire.d.ts +1 -1
  130. package/dist/integrations/social-ads.d.cts +2 -2
  131. package/dist/integrations/social-ads.d.ts +2 -2
  132. package/dist/integrations/stripe-acp.d.cts +1 -1
  133. package/dist/integrations/stripe-acp.d.ts +1 -1
  134. package/dist/integrations/stripe-issuing.d.cts +1 -1
  135. package/dist/integrations/stripe-issuing.d.ts +1 -1
  136. package/dist/integrations/tiktok-shop.d.cts +2 -2
  137. package/dist/integrations/tiktok-shop.d.ts +2 -2
  138. package/dist/integrations/truanon.d.cts +1 -1
  139. package/dist/integrations/truanon.d.ts +1 -1
  140. package/dist/integrations/typesafe.d.cts +1 -1
  141. package/dist/integrations/typesafe.d.ts +1 -1
  142. package/dist/integrations/ucp.d.cts +1 -1
  143. package/dist/integrations/ucp.d.ts +1 -1
  144. package/dist/integrations/vercel-ai.d.cts +1 -1
  145. package/dist/integrations/vercel-ai.d.ts +1 -1
  146. package/dist/integrations/walmart.d.cts +2 -2
  147. package/dist/integrations/walmart.d.ts +2 -2
  148. package/dist/integrations/x402.d.cts +1 -1
  149. package/dist/integrations/x402.d.ts +1 -1
  150. package/dist/{types-DphtTyIC.d.cts → types-DwPEBj7p.d.cts} +56 -1
  151. package/dist/{types-DphtTyIC.d.ts → types-DwPEBj7p.d.ts} +56 -1
  152. package/package.json +21 -1
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, S as SuspendPreview, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, e as SharedMemoryWriteInput, f as SharedMemoryEntry, g as SharedMemoryListResult, B as BeforeActionInput, h as TokenBudgetInput, i as TokenBudget, j as BudgetSpend, k as AuditEventInput, l as SwarmView } from './types-DphtTyIC.cjs';
2
- export { m as AgentStatus, n as ApprovalAttestation, o as AuditEventType, p as AuditResult, q as BudgetEnforcement, r as BudgetScope, s as DecisionVerdict, t as WorkflowGraphEdge, u as WorkflowGraphEvent, v as WorkflowGraphNode } from './types-DphtTyIC.cjs';
1
+ import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, S as SuspendPreview, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, e as SharedMemoryWriteInput, f as SharedMemoryEntry, g as SharedMemoryListResult, B as BeforeActionInput, h as TokenBudgetInput, i as TokenBudget, j as BudgetSpend, k as AuditEventInput, l as SwarmView, m as DeclareIntentInput, I as Intent } from './types-DwPEBj7p.cjs';
2
+ export { n as AgentStatus, o as ApprovalAttestation, p as AuditEventType, q as AuditResult, r as BudgetEnforcement, s as BudgetScope, t as DecisionVerdict, u as WorkflowGraphEdge, v as WorkflowGraphEvent, w as WorkflowGraphNode } from './types-DwPEBj7p.cjs';
3
3
  import { PortableSignedReceipt } from '@vorim/shared-types';
4
4
  export { PortableSignedReceipt, portableReceiptCanonicalBytes } from '@vorim/shared-types';
5
5
  import { HttpRequestLike, SignHttpRequestOptions, SignHttpRequestResult } from './httpSignatures.cjs';
@@ -186,6 +186,13 @@ declare function isKeyedCommitment(digest: unknown): boolean;
186
186
  */
187
187
  declare function isDigest(digest: unknown): boolean;
188
188
 
189
+ /**
190
+ * The server's canonical JSON for an intent declaration (services/intents.ts
191
+ * `intentSigningPayload`): keys sorted at every level, `undefined` dropped,
192
+ * arrays kept in order. Exported so a caller can verify what the SDK signed.
193
+ */
194
+ declare function canonicalIntent(value: unknown): string;
195
+
189
196
  interface VorimConfig {
190
197
  apiKey: string;
191
198
  baseUrl?: string;
@@ -1046,6 +1053,34 @@ declare class VorimSDK {
1046
1053
  * (for anything derived from peer reports), per member.
1047
1054
  */
1048
1055
  getSwarmScore(swarmId: string): Promise<any>;
1056
+ /**
1057
+ * Declare an intent for an agent. Needs the `agents:write` scope.
1058
+ *
1059
+ * @example
1060
+ * const intent = await vorim.declareIntent({
1061
+ * agentId: 'agid_acme_refunds',
1062
+ * goal: 'Refund order 4471: the item arrived damaged',
1063
+ * expectedActionTypes: ['lookup', 'refund', 'email'],
1064
+ * expectedTargets: ['shopify:order', 'stripe:refund', 'email:customer'],
1065
+ * maxAmount: 8000, amountCurrency: 'GBP', ttlSeconds: 1800,
1066
+ * });
1067
+ * await vorim.beforeAction({ agentId, actionType: 'refund', actionTarget: 'stripe:refund', requiredScope: 'agent:transact', payload: { amount: 7900 }, intentId: intent.intent_id });
1068
+ * await vorim.completeIntent(intent.intent_id, 'completed', 'Refunded 79.00');
1069
+ */
1070
+ declareIntent(input: DeclareIntentInput): Promise<Intent>;
1071
+ /** A platform-signed ledger of intents over a period, for a counterparty to verify offline. */
1072
+ getIntentLedger(params?: {
1073
+ agentId?: string;
1074
+ days?: number;
1075
+ }): Promise<any>;
1076
+ /** Close an intent when the job ends. Further actions under it are off intent. */
1077
+ completeIntent(intentId: string, status?: 'completed' | 'abandoned', outcome?: string): Promise<any>;
1078
+ /** Intents for the org, newest first; filter by agent or status. */
1079
+ listIntents(params?: {
1080
+ agentId?: string;
1081
+ status?: 'active' | 'completed' | 'abandoned' | 'expired';
1082
+ limit?: number;
1083
+ }): Promise<Intent[]>;
1049
1084
  /**
1050
1085
  * Issue a platform-signed attestation of the swarm as it is now: roster
1051
1086
  * and its hash, policy version and rules hash, charter, budget, kills,
@@ -1305,4 +1340,4 @@ interface DeviceLoginResult {
1305
1340
  */
1306
1341
  declare function deviceLogin(opts: DeviceLoginOptions): Promise<DeviceLoginResult>;
1307
1342
 
1308
- export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, type CommitmentKey, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, HMAC_SHA256_PREFIX, HttpRequestLike, type HttpSignatureVerification, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SHA256_PREFIX, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, SignHttpRequestOptions, SignHttpRequestResult, SuspendPreview, SwarmView, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalPayloadV0, canonicalPayloadV1, commitPayload, createVorim as default, deviceLogin, eventDigest, foldTraceparent, hashPayload, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, isDigest, isKeyedCommitment, jcsCanonicalise, prepareReplayContext };
1343
+ export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, type CommitmentKey, DeclareIntentInput, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, HMAC_SHA256_PREFIX, HttpRequestLike, type HttpSignatureVerification, Intent, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SHA256_PREFIX, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, SignHttpRequestOptions, SignHttpRequestResult, SuspendPreview, SwarmView, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalIntent, canonicalPayloadV0, canonicalPayloadV1, commitPayload, createVorim as default, deviceLogin, eventDigest, foldTraceparent, hashPayload, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, isDigest, isKeyedCommitment, jcsCanonicalise, prepareReplayContext };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, S as SuspendPreview, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, e as SharedMemoryWriteInput, f as SharedMemoryEntry, g as SharedMemoryListResult, B as BeforeActionInput, h as TokenBudgetInput, i as TokenBudget, j as BudgetSpend, k as AuditEventInput, l as SwarmView } from './types-DphtTyIC.js';
2
- export { m as AgentStatus, n as ApprovalAttestation, o as AuditEventType, p as AuditResult, q as BudgetEnforcement, r as BudgetScope, s as DecisionVerdict, t as WorkflowGraphEdge, u as WorkflowGraphEvent, v as WorkflowGraphNode } from './types-DphtTyIC.js';
1
+ import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, S as SuspendPreview, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, e as SharedMemoryWriteInput, f as SharedMemoryEntry, g as SharedMemoryListResult, B as BeforeActionInput, h as TokenBudgetInput, i as TokenBudget, j as BudgetSpend, k as AuditEventInput, l as SwarmView, m as DeclareIntentInput, I as Intent } from './types-DwPEBj7p.js';
2
+ export { n as AgentStatus, o as ApprovalAttestation, p as AuditEventType, q as AuditResult, r as BudgetEnforcement, s as BudgetScope, t as DecisionVerdict, u as WorkflowGraphEdge, v as WorkflowGraphEvent, w as WorkflowGraphNode } from './types-DwPEBj7p.js';
3
3
  import { PortableSignedReceipt } from '@vorim/shared-types';
4
4
  export { PortableSignedReceipt, portableReceiptCanonicalBytes } from '@vorim/shared-types';
5
5
  import { HttpRequestLike, SignHttpRequestOptions, SignHttpRequestResult } from './httpSignatures.js';
@@ -186,6 +186,13 @@ declare function isKeyedCommitment(digest: unknown): boolean;
186
186
  */
187
187
  declare function isDigest(digest: unknown): boolean;
188
188
 
189
+ /**
190
+ * The server's canonical JSON for an intent declaration (services/intents.ts
191
+ * `intentSigningPayload`): keys sorted at every level, `undefined` dropped,
192
+ * arrays kept in order. Exported so a caller can verify what the SDK signed.
193
+ */
194
+ declare function canonicalIntent(value: unknown): string;
195
+
189
196
  interface VorimConfig {
190
197
  apiKey: string;
191
198
  baseUrl?: string;
@@ -1046,6 +1053,34 @@ declare class VorimSDK {
1046
1053
  * (for anything derived from peer reports), per member.
1047
1054
  */
1048
1055
  getSwarmScore(swarmId: string): Promise<any>;
1056
+ /**
1057
+ * Declare an intent for an agent. Needs the `agents:write` scope.
1058
+ *
1059
+ * @example
1060
+ * const intent = await vorim.declareIntent({
1061
+ * agentId: 'agid_acme_refunds',
1062
+ * goal: 'Refund order 4471: the item arrived damaged',
1063
+ * expectedActionTypes: ['lookup', 'refund', 'email'],
1064
+ * expectedTargets: ['shopify:order', 'stripe:refund', 'email:customer'],
1065
+ * maxAmount: 8000, amountCurrency: 'GBP', ttlSeconds: 1800,
1066
+ * });
1067
+ * await vorim.beforeAction({ agentId, actionType: 'refund', actionTarget: 'stripe:refund', requiredScope: 'agent:transact', payload: { amount: 7900 }, intentId: intent.intent_id });
1068
+ * await vorim.completeIntent(intent.intent_id, 'completed', 'Refunded 79.00');
1069
+ */
1070
+ declareIntent(input: DeclareIntentInput): Promise<Intent>;
1071
+ /** A platform-signed ledger of intents over a period, for a counterparty to verify offline. */
1072
+ getIntentLedger(params?: {
1073
+ agentId?: string;
1074
+ days?: number;
1075
+ }): Promise<any>;
1076
+ /** Close an intent when the job ends. Further actions under it are off intent. */
1077
+ completeIntent(intentId: string, status?: 'completed' | 'abandoned', outcome?: string): Promise<any>;
1078
+ /** Intents for the org, newest first; filter by agent or status. */
1079
+ listIntents(params?: {
1080
+ agentId?: string;
1081
+ status?: 'active' | 'completed' | 'abandoned' | 'expired';
1082
+ limit?: number;
1083
+ }): Promise<Intent[]>;
1049
1084
  /**
1050
1085
  * Issue a platform-signed attestation of the swarm as it is now: roster
1051
1086
  * and its hash, policy version and rules hash, charter, budget, kills,
@@ -1305,4 +1340,4 @@ interface DeviceLoginResult {
1305
1340
  */
1306
1341
  declare function deviceLogin(opts: DeviceLoginOptions): Promise<DeviceLoginResult>;
1307
1342
 
1308
- export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, type CommitmentKey, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, HMAC_SHA256_PREFIX, HttpRequestLike, type HttpSignatureVerification, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SHA256_PREFIX, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, SignHttpRequestOptions, SignHttpRequestResult, SuspendPreview, SwarmView, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalPayloadV0, canonicalPayloadV1, commitPayload, createVorim as default, deviceLogin, eventDigest, foldTraceparent, hashPayload, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, isDigest, isKeyedCommitment, jcsCanonicalise, prepareReplayContext };
1343
+ export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, type CommitmentKey, DeclareIntentInput, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, HMAC_SHA256_PREFIX, HttpRequestLike, type HttpSignatureVerification, Intent, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SHA256_PREFIX, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, SignHttpRequestOptions, SignHttpRequestResult, SuspendPreview, SwarmView, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalIntent, canonicalPayloadV0, canonicalPayloadV1, commitPayload, createVorim as default, deviceLogin, eventDigest, foldTraceparent, hashPayload, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, isDigest, isKeyedCommitment, jcsCanonicalise, prepareReplayContext };
package/dist/index.js CHANGED
@@ -867,7 +867,15 @@ async function verifyHttpRequest(request, options) {
867
867
  }
868
868
 
869
869
  // src/index.ts
870
- var SDK_VERSION = true ? "4.1.1" : "0.0.0";
870
+ function canonicalIntent(value) {
871
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
872
+ if (Array.isArray(value)) return `[${value.map((v) => v === void 0 ? "null" : canonicalIntent(v)).join(",")}]`;
873
+ if (value instanceof Date) return JSON.stringify(value.toISOString());
874
+ const obj = value;
875
+ const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
876
+ return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalIntent(obj[k])}`).join(",")}}`;
877
+ }
878
+ var SDK_VERSION = true ? "4.3.0" : "0.0.0";
871
879
  var USER_AGENT = `vorim-sdk/${SDK_VERSION}`;
872
880
  function sleep(ms) {
873
881
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -1488,7 +1496,8 @@ var VorimSDK = class _VorimSDK {
1488
1496
  estimated_tokens: input.estimatedTokens,
1489
1497
  trace_id: input.traceId,
1490
1498
  span_id: input.spanId,
1491
- traceparent: input.traceparent
1499
+ traceparent: input.traceparent,
1500
+ intent_id: input.intentId
1492
1501
  };
1493
1502
  let raw;
1494
1503
  try {
@@ -1510,7 +1519,8 @@ var VorimSDK = class _VorimSDK {
1510
1519
  policyVersion: 0,
1511
1520
  swarmId: null,
1512
1521
  escalationResolution: null,
1513
- approval: null
1522
+ approval: null,
1523
+ intent: null
1514
1524
  };
1515
1525
  }
1516
1526
  throw err;
@@ -1659,7 +1669,12 @@ var VorimSDK = class _VorimSDK {
1659
1669
  policyVersion: raw?.policy_version ?? 0,
1660
1670
  swarmId: typeof raw?.swarm_id === "string" ? raw.swarm_id : null,
1661
1671
  escalationResolution: resolution,
1662
- approval: toApprovalAttestation(raw?.approval)
1672
+ approval: toApprovalAttestation(raw?.approval),
1673
+ intent: raw?.intent && typeof raw.intent === "object" ? {
1674
+ id: typeof raw.intent.id === "string" ? raw.intent.id : null,
1675
+ alignment: raw.intent.alignment === "aligned" || raw.intent.alignment === "off_intent" ? raw.intent.alignment : "none",
1676
+ reasons: Array.isArray(raw.intent.reasons) ? raw.intent.reasons.filter((r) => typeof r === "string") : []
1677
+ } : null
1663
1678
  };
1664
1679
  }
1665
1680
  // ─── Audit ────────────────────────────────────────────────────────
@@ -1972,6 +1987,70 @@ var VorimSDK = class _VorimSDK {
1972
1987
  async getSwarmScore(swarmId) {
1973
1988
  return this.get(`/swarms/${encodeURIComponent(swarmId)}/score`);
1974
1989
  }
1990
+ // ─── Agent behaviour and intent ───────────────────────────────────────
1991
+ //
1992
+ // An intent is what the agent says it is about to do, declared before it
1993
+ // acts. Pass its id as `intentId` on every beforeAction() of that job and
1994
+ // Vorim judges each action against it (aligned / off_intent); the Behaviour
1995
+ // page shows the goal next to the steps, and rules can hold or block work
1996
+ // that is off intent or undeclared (`off_intent`, `intent_required`).
1997
+ /**
1998
+ * Declare an intent for an agent. Needs the `agents:write` scope.
1999
+ *
2000
+ * @example
2001
+ * const intent = await vorim.declareIntent({
2002
+ * agentId: 'agid_acme_refunds',
2003
+ * goal: 'Refund order 4471: the item arrived damaged',
2004
+ * expectedActionTypes: ['lookup', 'refund', 'email'],
2005
+ * expectedTargets: ['shopify:order', 'stripe:refund', 'email:customer'],
2006
+ * maxAmount: 8000, amountCurrency: 'GBP', ttlSeconds: 1800,
2007
+ * });
2008
+ * await vorim.beforeAction({ agentId, actionType: 'refund', actionTarget: 'stripe:refund', requiredScope: 'agent:transact', payload: { amount: 7900 }, intentId: intent.intent_id });
2009
+ * await vorim.completeIntent(intent.intent_id, 'completed', 'Refunded 79.00');
2010
+ */
2011
+ async declareIntent(input) {
2012
+ const list = (xs) => Array.from(new Set((xs ?? []).map((s) => String(s).trim()).filter(Boolean)));
2013
+ const fields = {
2014
+ agent_id: input.agentId,
2015
+ goal: String(input.goal).trim(),
2016
+ expected_action_types: list(input.expectedActionTypes),
2017
+ expected_targets: list(input.expectedTargets),
2018
+ max_amount: typeof input.maxAmount === "number" ? input.maxAmount : null,
2019
+ amount_currency: input.amountCurrency ? input.amountCurrency.toUpperCase() : null,
2020
+ amount_field: input.amountField ?? null,
2021
+ max_actions: typeof input.maxActions === "number" ? input.maxActions : null,
2022
+ ttl_seconds: typeof input.ttlSeconds === "number" ? input.ttlSeconds : 86400
2023
+ };
2024
+ const key = this.agentKeys.get(input.agentId);
2025
+ let signed;
2026
+ if (key) {
2027
+ const signed_at = (/* @__PURE__ */ new Date()).toISOString();
2028
+ const signature = await this.sign(canonicalIntent({ type: "vorim-agent-intent", v: 1, ...fields, signed_at }), key);
2029
+ signed = { signature, signed_at };
2030
+ }
2031
+ return this.post("/intents", { ...fields, workflow_id: input.workflowId, ...signed });
2032
+ }
2033
+ /** A platform-signed ledger of intents over a period, for a counterparty to verify offline. */
2034
+ async getIntentLedger(params = {}) {
2035
+ const q = new URLSearchParams();
2036
+ if (params.agentId) q.set("agent_id", params.agentId);
2037
+ if (params.days) q.set("days", String(params.days));
2038
+ const s = q.toString();
2039
+ return this.get(`/intents/ledger${s ? `?${s}` : ""}`);
2040
+ }
2041
+ /** Close an intent when the job ends. Further actions under it are off intent. */
2042
+ async completeIntent(intentId, status = "completed", outcome) {
2043
+ return this.post(`/intents/${encodeURIComponent(intentId)}/complete`, { status, outcome });
2044
+ }
2045
+ /** Intents for the org, newest first; filter by agent or status. */
2046
+ async listIntents(params = {}) {
2047
+ const q = new URLSearchParams();
2048
+ if (params.agentId) q.set("agent_id", params.agentId);
2049
+ if (params.status) q.set("status", params.status);
2050
+ if (params.limit) q.set("limit", String(params.limit));
2051
+ const s = q.toString();
2052
+ return this.get(`/intents${s ? `?${s}` : ""}`);
2053
+ }
1975
2054
  /**
1976
2055
  * Issue a platform-signed attestation of the swarm as it is now: roster
1977
2056
  * and its hash, policy version and rules hash, charter, budget, kills,
@@ -2381,6 +2460,7 @@ export {
2381
2460
  VorimDeniedError,
2382
2461
  VorimError,
2383
2462
  VorimSDK,
2463
+ canonicalIntent,
2384
2464
  canonicalPayloadV0,
2385
2465
  canonicalPayloadV1,
2386
2466
  commitPayload,