@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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog — @vorim/sdk
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Added
6
+
7
+ - **Mistral AI** (`@vorim/sdk/integrations/mistral`). Every custom function tool an agent calls through Mistral is permission-checked (or decided by your runtime rules) and signed before it runs. Works with the official `@mistralai/mistralai` client (camelCase fields) and with any OpenAI-compatible client pointed at Mistral; object-shaped `arguments` and missing tool-call ids are normalised. `MISTRAL_EU_BASE_URL` keeps inference in EU and EFTA data centres. For the Agents API, `executeMistralFunctionCalls` gates your own `function.call` entries and returns the `function.result` entries, and `decideMistralConfirmations` answers Mistral's pending tool confirmations (web search, code interpreter, connectors you list in `requires_confirmation`) with allow or deny, signed, failing closed. Checked end to end against the real `@mistralai/mistralai` 3.4.0 and `openai` 4 clients on a local server speaking Mistral's wire format; not yet run against a live Mistral account.
8
+ - **European AI hosts** (`@vorim/sdk/integrations/eu-providers`). `EU_PROVIDERS` presets (base URL, a tool-capable model, the provider's own residency wording) for Scaleway, OVHcloud AI Endpoints, IONOS AI Model Hub, STACKIT, Nebius, Hugging Face Inference Providers and H Company's Models API; `runEuAgentLoop` gates and signs each tool call and labels the audit event with the host. `executeHCompanyToolCalls` gates H Company Agents API `pending_tool_calls` and builds the tool-result bodies.
9
+ - `VorimToolRegistry` takes an optional `framework` label (default `'openai'`) for `metadata.framework` on its audit events, and gains `has(name)`.
10
+
11
+ ## 4.2.0
12
+
13
+ ### Added
14
+
15
+ - **Agent behaviour and intent.** `declareIntent({ agentId, goal, expectedActionTypes?, expectedTargets?, maxAmount?, amountCurrency?, amountField?, maxActions?, ttlSeconds?, workflowId? })` records what an agent is about to do before it acts; pass the returned `intent_id` as `intentId` on every `beforeAction()` of that job and Vorim judges each action against it. `RuntimeDecision.intent` carries `{ id, alignment: 'aligned' | 'off_intent' | 'none', reasons }`. `completeIntent(intentId, 'completed' | 'abandoned', outcome?)` closes it; `listIntents({ agentId?, status?, limit? })` lists them; `getIntentLedger({ agentId?, days? })` returns a platform-signed ledger of declared intents for a counterparty to verify offline against `GET /trust/keys`.
16
+ - When the SDK holds the agent's key (`useAgentKey`, or a registration in this process) the declaration is signed with it, so the intent is the agent's own word; `canonicalIntent()` is exported so callers can verify what was signed.
17
+ - Rules can now use `intent_required` (actions with no intent), `off_intent` (actions that crossed their intent) and `behaviour_drift_gt` (the agent's last 24 hours against its 30-day baseline, 0-100). Nothing changes for callers that never declare an intent.
18
+
3
19
  ## 4.1.1
4
20
 
5
21
  ### Fixed
@@ -1,5 +1,5 @@
1
1
  import { VorimSDK } from './index.js';
2
- import { P as PermissionScope } from './types-DphtTyIC.js';
2
+ import { P as PermissionScope } from './types-DwPEBj7p.js';
3
3
  import { E as EscalationPolicy } from './_runtime-gate-DOJUKJBu.js';
4
4
 
5
5
  /** What a ceiling an operation is measured against. */
@@ -1,5 +1,5 @@
1
1
  import { VorimSDK } from './index.cjs';
2
- import { P as PermissionScope } from './types-DphtTyIC.cjs';
2
+ import { P as PermissionScope } from './types-DwPEBj7p.cjs';
3
3
  import { E as EscalationPolicy } from './_runtime-gate-DOJUKJBu.cjs';
4
4
 
5
5
  /** What a ceiling an operation is measured against. */
package/dist/index.cjs CHANGED
@@ -37,6 +37,7 @@ __export(index_exports, {
37
37
  VorimDeniedError: () => VorimDeniedError,
38
38
  VorimError: () => VorimError,
39
39
  VorimSDK: () => VorimSDK,
40
+ canonicalIntent: () => canonicalIntent,
40
41
  canonicalPayloadV0: () => canonicalPayloadV0,
41
42
  canonicalPayloadV1: () => canonicalPayloadV1,
42
43
  commitPayload: () => commitPayload,
@@ -931,7 +932,15 @@ async function verifyHttpRequest(request, options) {
931
932
  }
932
933
 
933
934
  // src/index.ts
934
- var SDK_VERSION = true ? "4.1.1" : "0.0.0";
935
+ function canonicalIntent(value) {
936
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
937
+ if (Array.isArray(value)) return `[${value.map((v) => v === void 0 ? "null" : canonicalIntent(v)).join(",")}]`;
938
+ if (value instanceof Date) return JSON.stringify(value.toISOString());
939
+ const obj = value;
940
+ const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
941
+ return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalIntent(obj[k])}`).join(",")}}`;
942
+ }
943
+ var SDK_VERSION = true ? "4.3.0" : "0.0.0";
935
944
  var USER_AGENT = `vorim-sdk/${SDK_VERSION}`;
936
945
  function sleep(ms) {
937
946
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -1552,7 +1561,8 @@ var VorimSDK = class _VorimSDK {
1552
1561
  estimated_tokens: input.estimatedTokens,
1553
1562
  trace_id: input.traceId,
1554
1563
  span_id: input.spanId,
1555
- traceparent: input.traceparent
1564
+ traceparent: input.traceparent,
1565
+ intent_id: input.intentId
1556
1566
  };
1557
1567
  let raw;
1558
1568
  try {
@@ -1574,7 +1584,8 @@ var VorimSDK = class _VorimSDK {
1574
1584
  policyVersion: 0,
1575
1585
  swarmId: null,
1576
1586
  escalationResolution: null,
1577
- approval: null
1587
+ approval: null,
1588
+ intent: null
1578
1589
  };
1579
1590
  }
1580
1591
  throw err;
@@ -1723,7 +1734,12 @@ var VorimSDK = class _VorimSDK {
1723
1734
  policyVersion: raw?.policy_version ?? 0,
1724
1735
  swarmId: typeof raw?.swarm_id === "string" ? raw.swarm_id : null,
1725
1736
  escalationResolution: resolution,
1726
- approval: toApprovalAttestation(raw?.approval)
1737
+ approval: toApprovalAttestation(raw?.approval),
1738
+ intent: raw?.intent && typeof raw.intent === "object" ? {
1739
+ id: typeof raw.intent.id === "string" ? raw.intent.id : null,
1740
+ alignment: raw.intent.alignment === "aligned" || raw.intent.alignment === "off_intent" ? raw.intent.alignment : "none",
1741
+ reasons: Array.isArray(raw.intent.reasons) ? raw.intent.reasons.filter((r) => typeof r === "string") : []
1742
+ } : null
1727
1743
  };
1728
1744
  }
1729
1745
  // ─── Audit ────────────────────────────────────────────────────────
@@ -2036,6 +2052,70 @@ var VorimSDK = class _VorimSDK {
2036
2052
  async getSwarmScore(swarmId) {
2037
2053
  return this.get(`/swarms/${encodeURIComponent(swarmId)}/score`);
2038
2054
  }
2055
+ // ─── Agent behaviour and intent ───────────────────────────────────────
2056
+ //
2057
+ // An intent is what the agent says it is about to do, declared before it
2058
+ // acts. Pass its id as `intentId` on every beforeAction() of that job and
2059
+ // Vorim judges each action against it (aligned / off_intent); the Behaviour
2060
+ // page shows the goal next to the steps, and rules can hold or block work
2061
+ // that is off intent or undeclared (`off_intent`, `intent_required`).
2062
+ /**
2063
+ * Declare an intent for an agent. Needs the `agents:write` scope.
2064
+ *
2065
+ * @example
2066
+ * const intent = await vorim.declareIntent({
2067
+ * agentId: 'agid_acme_refunds',
2068
+ * goal: 'Refund order 4471: the item arrived damaged',
2069
+ * expectedActionTypes: ['lookup', 'refund', 'email'],
2070
+ * expectedTargets: ['shopify:order', 'stripe:refund', 'email:customer'],
2071
+ * maxAmount: 8000, amountCurrency: 'GBP', ttlSeconds: 1800,
2072
+ * });
2073
+ * await vorim.beforeAction({ agentId, actionType: 'refund', actionTarget: 'stripe:refund', requiredScope: 'agent:transact', payload: { amount: 7900 }, intentId: intent.intent_id });
2074
+ * await vorim.completeIntent(intent.intent_id, 'completed', 'Refunded 79.00');
2075
+ */
2076
+ async declareIntent(input) {
2077
+ const list = (xs) => Array.from(new Set((xs ?? []).map((s) => String(s).trim()).filter(Boolean)));
2078
+ const fields = {
2079
+ agent_id: input.agentId,
2080
+ goal: String(input.goal).trim(),
2081
+ expected_action_types: list(input.expectedActionTypes),
2082
+ expected_targets: list(input.expectedTargets),
2083
+ max_amount: typeof input.maxAmount === "number" ? input.maxAmount : null,
2084
+ amount_currency: input.amountCurrency ? input.amountCurrency.toUpperCase() : null,
2085
+ amount_field: input.amountField ?? null,
2086
+ max_actions: typeof input.maxActions === "number" ? input.maxActions : null,
2087
+ ttl_seconds: typeof input.ttlSeconds === "number" ? input.ttlSeconds : 86400
2088
+ };
2089
+ const key = this.agentKeys.get(input.agentId);
2090
+ let signed;
2091
+ if (key) {
2092
+ const signed_at = (/* @__PURE__ */ new Date()).toISOString();
2093
+ const signature = await this.sign(canonicalIntent({ type: "vorim-agent-intent", v: 1, ...fields, signed_at }), key);
2094
+ signed = { signature, signed_at };
2095
+ }
2096
+ return this.post("/intents", { ...fields, workflow_id: input.workflowId, ...signed });
2097
+ }
2098
+ /** A platform-signed ledger of intents over a period, for a counterparty to verify offline. */
2099
+ async getIntentLedger(params = {}) {
2100
+ const q = new URLSearchParams();
2101
+ if (params.agentId) q.set("agent_id", params.agentId);
2102
+ if (params.days) q.set("days", String(params.days));
2103
+ const s = q.toString();
2104
+ return this.get(`/intents/ledger${s ? `?${s}` : ""}`);
2105
+ }
2106
+ /** Close an intent when the job ends. Further actions under it are off intent. */
2107
+ async completeIntent(intentId, status = "completed", outcome) {
2108
+ return this.post(`/intents/${encodeURIComponent(intentId)}/complete`, { status, outcome });
2109
+ }
2110
+ /** Intents for the org, newest first; filter by agent or status. */
2111
+ async listIntents(params = {}) {
2112
+ const q = new URLSearchParams();
2113
+ if (params.agentId) q.set("agent_id", params.agentId);
2114
+ if (params.status) q.set("status", params.status);
2115
+ if (params.limit) q.set("limit", String(params.limit));
2116
+ const s = q.toString();
2117
+ return this.get(`/intents${s ? `?${s}` : ""}`);
2118
+ }
2039
2119
  /**
2040
2120
  * Issue a platform-signed attestation of the swarm as it is now: roster
2041
2121
  * and its hash, policy version and rules hash, charter, budget, kills,
@@ -2446,6 +2526,7 @@ async function deviceLogin(opts) {
2446
2526
  VorimDeniedError,
2447
2527
  VorimError,
2448
2528
  VorimSDK,
2529
+ canonicalIntent,
2449
2530
  canonicalPayloadV0,
2450
2531
  canonicalPayloadV1,
2451
2532
  commitPayload,