@modainteract/moda-interact-shared 0.13.1 → 0.14.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.
@@ -25,11 +25,25 @@ import {
25
25
  CommerceToolResultSchema,
26
26
  CommerceToolRevisionIdentitySchema,
27
27
  CommerceTurnIdentitySchema,
28
+ ConnectionCommandSchema,
29
+ ConnectionIssueSchema,
30
+ ConnectionResultSchema,
31
+ ConnectionRevisionViewSchema,
32
+ ConnectionViewSchema,
28
33
  ContractVersionSchema,
34
+ CredentialStatusSchema,
29
35
  CurrencySchema,
30
36
  DateSchema,
31
37
  DetailsSchemaSchema,
32
38
  EMPTY_RESPONSE_CONTRACT,
39
+ ExternalHttpExecutionSchema,
40
+ ExternalHttpResultDataSchema,
41
+ ExternalPathSchema,
42
+ ExternalQueryMappingSchema,
43
+ ExternalQueryMappingsSchema,
44
+ ExternalQueryValueSchema,
45
+ ExternalResponseFormatSchema,
46
+ FieldProjectionSchema,
33
47
  GrantedToolSchema,
34
48
  GrantedToolsSchema,
35
49
  HashSchema,
@@ -41,12 +55,18 @@ import {
41
55
  POLICY_OPERATIONS,
42
56
  POLICY_OPERATION_DESCRIPTORS,
43
57
  ReferralReasonSchema,
58
+ ResponseFilterSchema,
59
+ ResponseProcessingSchema,
44
60
  ResponseTemplateSchema,
61
+ RevisionInputSchema,
45
62
  SemverSchema,
46
63
  ToolBindingSchema,
47
64
  ToolBindingsSchema,
48
65
  ToolDescriptorSchema,
49
66
  ToolNameSchema,
67
+ TransformResponseSchema,
68
+ TransformSampleSchema,
69
+ VisualResponseProcessingSchema,
50
70
  boundedJson,
51
71
  canonicalJson,
52
72
  capabilityHashInput,
@@ -73,7 +93,7 @@ import {
73
93
  validateDefinitionVersion,
74
94
  validateSubset,
75
95
  verifyResponseContract
76
- } from "../chunk-OIRLIV5F.js";
96
+ } from "../chunk-WVQWQFVR.js";
77
97
  import "../chunk-B6Y3QQLI.js";
78
98
 
79
99
  // src/commerce/fixtures.ts
@@ -200,11 +220,25 @@ export {
200
220
  CommerceToolResultSchema,
201
221
  CommerceToolRevisionIdentitySchema,
202
222
  CommerceTurnIdentitySchema,
223
+ ConnectionCommandSchema,
224
+ ConnectionIssueSchema,
225
+ ConnectionResultSchema,
226
+ ConnectionRevisionViewSchema,
227
+ ConnectionViewSchema,
203
228
  ContractVersionSchema,
229
+ CredentialStatusSchema,
204
230
  CurrencySchema,
205
231
  DateSchema,
206
232
  DetailsSchemaSchema,
207
233
  EMPTY_RESPONSE_CONTRACT,
234
+ ExternalHttpExecutionSchema,
235
+ ExternalHttpResultDataSchema,
236
+ ExternalPathSchema,
237
+ ExternalQueryMappingSchema,
238
+ ExternalQueryMappingsSchema,
239
+ ExternalQueryValueSchema,
240
+ ExternalResponseFormatSchema,
241
+ FieldProjectionSchema,
208
242
  GrantedToolSchema,
209
243
  GrantedToolsSchema,
210
244
  HashSchema,
@@ -216,12 +250,18 @@ export {
216
250
  POLICY_OPERATIONS,
217
251
  POLICY_OPERATION_DESCRIPTORS,
218
252
  ReferralReasonSchema,
253
+ ResponseFilterSchema,
254
+ ResponseProcessingSchema,
219
255
  ResponseTemplateSchema,
256
+ RevisionInputSchema,
220
257
  SemverSchema,
221
258
  ToolBindingSchema,
222
259
  ToolBindingsSchema,
223
260
  ToolDescriptorSchema,
224
261
  ToolNameSchema,
262
+ TransformResponseSchema,
263
+ TransformSampleSchema,
264
+ VisualResponseProcessingSchema,
225
265
  boundedJson,
226
266
  canonicalJson,
227
267
  capabilityHashInput,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commerce/fixtures.ts"],"sourcesContent":["/** Synthetic examples; no provider identity, schema artifact or publication claim. */\nimport type {\n CommerceManifest,\n CommerceConversationGrant,\n CommerceTurnIdentity,\n} from \"./schemas\";\nimport {\n EMPTY_RESPONSE_CONTRACT,\n type CommerceFinalResponse,\n} from \"./response\";\nimport type { Digest } from \"./canonical-json\";\nimport { responseContractCanonicalJson } from \"./canonical-json\";\nimport type { ToolDescriptor, CommerceToolDefinition } from \"./definitions\";\nexport const exampleTool: ToolDescriptor = {\n toolId: \"tool-fixture\",\n toolRevisionId: \"revision-fixture\",\n name: \"never_seeded_catalogue_facts\",\n definitionVersion: \"1.0.0\",\n description: \"Read synthetic catalogue facts.\",\n inputSchema: {\n type: \"object\",\n properties: { handle: { type: \"string\", minLength: 1, maxLength: 255 } },\n required: [\"handle\"],\n additionalProperties: false,\n },\n};\nexport const exampleDefinition: CommerceToolDefinition = {\n name: exampleTool.name,\n definitionVersion: \"1.0.0\",\n description: exampleTool.description,\n inputSchema: exampleTool.inputSchema,\n execution: {\n kind: \"SHOPIFY_STOREFRONT_QUERY\",\n executorVersion: \"1.0.0\",\n apiVersion: \"2026-07\",\n schemaHash: \"a\".repeat(64),\n document:\n \"query ProductDetails($handle: String!) { product(handle: $handle) { title description } }\",\n operationName: \"ProductDetails\",\n variables: { handle: { input: \"handle\" } },\n resultPath: \"product\",\n },\n responseTemplate: {\n kind: \"text\",\n text: \"{{result.values.title}}: {{result.values.description}}\",\n unavailable: \"Product details could not be verified.\",\n },\n};\nexport const exampleTurn: CommerceTurnIdentity = {\n contractVersion: \"commerce.v1\",\n shopId: \"shop-fixture\",\n checkoutRecoveryId: \"recovery-fixture\",\n conversationId: \"conversation-fixture\",\n inboundVersion: 1,\n};\nexport function exampleManifest(\n digest: Digest,\n withTool = false,\n): CommerceManifest {\n const capabilities = [\n {\n key: \"conversation_core\",\n revisionId: \"core-revision\",\n position: 0,\n promptName: \"commerce/release-fixture/conversation_core/core-revision\",\n configuration: {},\n toolDescriptors: withTool ? [structuredClone(exampleTool)] : [],\n },\n ];\n return {\n contractVersion: \"commerce.v1\",\n releaseId: \"release-fixture\",\n runnerCompatibility: \"^1.0.0\",\n capabilities,\n selectedCapabilityKeys: [\"conversation_core\"],\n grantedTools: withTool\n ? [\n {\n toolId: exampleTool.toolId,\n toolRevisionId: exampleTool.toolRevisionId,\n toolName: exampleTool.name,\n definitionVersion: \"1.0.0\",\n capabilityKeys: [\"conversation_core\"],\n },\n ]\n : [],\n responseContract: structuredClone(EMPTY_RESPONSE_CONTRACT),\n responseContractHash: digest(\n responseContractCanonicalJson(EMPTY_RESPONSE_CONTRACT),\n ),\n };\n}\nexport function exampleGrant(\n manifest: CommerceManifest,\n): CommerceConversationGrant {\n return {\n id: \"grant-fixture\",\n shopId: exampleTurn.shopId,\n conversationId: exampleTurn.conversationId,\n initialInboundVersion: 1,\n releaseId: manifest.releaseId,\n selectedCapabilityKeys: [...manifest.selectedCapabilityKeys],\n grantedTools: structuredClone(manifest.grantedTools),\n runnerVersion: \"1.0.0\",\n createdAt: \"2026-09-20T00:00:00.000Z\",\n expiresAt: null,\n };\n}\nexport const exampleFinal: CommerceFinalResponse = {\n answerKind: \"REFER_TO_STORE\",\n replyText:\n \"I cannot verify that information. Please contact the store directly.\",\n referralReason: \"INSUFFICIENT_TOOLS\",\n detectedLanguageTag: null,\n detectedLanguageConfidence: null,\n evidenceIds: [],\n details: {},\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,IAAM,cAA8B;AAAA,EACzC,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,MAAM;AAAA,EACN,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,aAAa;AAAA,IACX,MAAM;AAAA,IACN,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,WAAW,GAAG,WAAW,IAAI,EAAE;AAAA,IACvE,UAAU,CAAC,QAAQ;AAAA,IACnB,sBAAsB;AAAA,EACxB;AACF;AACO,IAAM,oBAA4C;AAAA,EACvD,MAAM,YAAY;AAAA,EAClB,mBAAmB;AAAA,EACnB,aAAa,YAAY;AAAA,EACzB,aAAa,YAAY;AAAA,EACzB,WAAW;AAAA,IACT,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,YAAY,I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BAAgB,SAAS,YAAY;AAAA,IACnD,eAAe;AAAA,IACf,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;AACO,IAAM,eAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WACE;AAAA,EACF,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,4BAA4B;AAAA,EAC5B,aAAa,CAAC;AAAA,EACd,SAAS,CAAC;AACZ;","names":[]}
1
+ {"version":3,"sources":["../../src/commerce/fixtures.ts"],"sourcesContent":["/** Synthetic examples; no provider identity, schema artifact or publication claim. */\nimport type {\n CommerceManifest,\n CommerceConversationGrant,\n CommerceTurnIdentity,\n} from \"./schemas\";\nimport {\n EMPTY_RESPONSE_CONTRACT,\n type CommerceFinalResponse,\n} from \"./response\";\nimport type { Digest } from \"./canonical-json\";\nimport { responseContractCanonicalJson } from \"./canonical-json\";\nimport type { ToolDescriptor, CommerceToolDefinition } from \"./definitions\";\nexport const exampleTool: ToolDescriptor = {\n toolId: \"tool-fixture\",\n toolRevisionId: \"revision-fixture\",\n name: \"never_seeded_catalogue_facts\",\n definitionVersion: \"1.0.0\",\n description: \"Read synthetic catalogue facts.\",\n inputSchema: {\n type: \"object\",\n properties: { handle: { type: \"string\", minLength: 1, maxLength: 255 } },\n required: [\"handle\"],\n additionalProperties: false,\n },\n};\nexport const exampleDefinition: CommerceToolDefinition = {\n name: exampleTool.name,\n definitionVersion: \"1.0.0\",\n description: exampleTool.description,\n inputSchema: exampleTool.inputSchema,\n execution: {\n kind: \"SHOPIFY_STOREFRONT_QUERY\",\n executorVersion: \"1.0.0\",\n apiVersion: \"2026-07\",\n schemaHash: \"a\".repeat(64),\n document:\n \"query ProductDetails($handle: String!) { product(handle: $handle) { title description } }\",\n operationName: \"ProductDetails\",\n variables: { handle: { input: \"handle\" } },\n resultPath: \"product\",\n },\n responseTemplate: {\n kind: \"text\",\n text: \"{{result.values.title}}: {{result.values.description}}\",\n unavailable: \"Product details could not be verified.\",\n },\n};\nexport const exampleTurn: CommerceTurnIdentity = {\n contractVersion: \"commerce.v1\",\n shopId: \"shop-fixture\",\n checkoutRecoveryId: \"recovery-fixture\",\n conversationId: \"conversation-fixture\",\n inboundVersion: 1,\n};\nexport function exampleManifest(\n digest: Digest,\n withTool = false,\n): CommerceManifest {\n const capabilities = [\n {\n key: \"conversation_core\",\n revisionId: \"core-revision\",\n position: 0,\n promptName: \"commerce/release-fixture/conversation_core/core-revision\",\n configuration: {},\n toolDescriptors: withTool ? [structuredClone(exampleTool)] : [],\n },\n ];\n return {\n contractVersion: \"commerce.v1\",\n releaseId: \"release-fixture\",\n runnerCompatibility: \"^1.0.0\",\n capabilities,\n selectedCapabilityKeys: [\"conversation_core\"],\n grantedTools: withTool\n ? [\n {\n toolId: exampleTool.toolId,\n toolRevisionId: exampleTool.toolRevisionId,\n toolName: exampleTool.name,\n definitionVersion: \"1.0.0\",\n capabilityKeys: [\"conversation_core\"],\n },\n ]\n : [],\n responseContract: structuredClone(EMPTY_RESPONSE_CONTRACT),\n responseContractHash: digest(\n responseContractCanonicalJson(EMPTY_RESPONSE_CONTRACT),\n ),\n };\n}\nexport function exampleGrant(\n manifest: CommerceManifest,\n): CommerceConversationGrant {\n return {\n id: \"grant-fixture\",\n shopId: exampleTurn.shopId,\n conversationId: exampleTurn.conversationId,\n initialInboundVersion: 1,\n releaseId: manifest.releaseId,\n selectedCapabilityKeys: [...manifest.selectedCapabilityKeys],\n grantedTools: structuredClone(manifest.grantedTools),\n runnerVersion: \"1.0.0\",\n createdAt: \"2026-09-20T00:00:00.000Z\",\n expiresAt: null,\n };\n}\nexport const exampleFinal: CommerceFinalResponse = {\n answerKind: \"REFER_TO_STORE\",\n replyText:\n \"I cannot verify that information. Please contact the store directly.\",\n referralReason: \"INSUFFICIENT_TOOLS\",\n detectedLanguageTag: null,\n detectedLanguageConfidence: null,\n evidenceIds: [],\n details: {},\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,wBAAwB,CAAC,mBAAmB;AAAA,IAC5C,cAAc,WACV;AAAA,MACE;AAAA,QACE,QAAQ,YAAY;AAAA,QACpB,gBAAgB,YAAY;AAAA,QAC5B,UAAU,YAAY;AAAA,QACtB,mBAAmB;AAAA,QACnB,gBAAgB,CAAC,mBAAmB;AAAA,MACtC;AAAA,IACF,IACA,CAAC;AAAA,IACL,kBAAkB,gBAAgB,uBAAuB;AAAA,IACzD,sBAAsB;AAAA,MACpB,8BAA8B,uBAAuB;AAAA,IACvD;AAAA,EACF;AACF;AACO,SAAS,aACd,UAC2B;AAC3B,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,QAAQ,YAAY;AAAA,IACpB,gBAAgB,YAAY;AAAA,IAC5B,uBAAuB;AAAA,IACvB,WAAW,SAAS;AAAA,IACpB,wBAAwB,CAAC,GAAG,SAAS,sBAAsB;AAAA,IAC3D,cAAc,gBAAgB,SAAS,YAAY;AAAA,IACnD,eAAe;AAAA,IACf,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;AACO,IAAM,eAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WACE;AAAA,EACF,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,4BAA4B;AAAA,EAC5B,aAAa,CAAC;AAAA,EACd,SAAS,CAAC;AACZ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { C as CommerceTurnIdentity, a as CommerceConversationGrant, b as CommerceManifest, T as ToolDescriptor, G as GrantedTool, c as CommerceToolResult, D as Digest, d as CommerceFinalResponse } from '../../response-CrhM-N0k.js';
1
+ import { C as CommerceTurnIdentity, a as CommerceConversationGrant, b as CommerceManifest, T as ToolDescriptor, G as GrantedTool, c as CommerceToolResult, D as Digest, d as CommerceFinalResponse } from '../../response-D3LgdEbH.js';
2
2
  import 'zod';
3
3
 
4
4
  declare const runnerVersion = "1.0.0";
@@ -12,7 +12,7 @@ import {
12
12
  jsonBytes,
13
13
  manifestMatchesGrant,
14
14
  verifyResponseContract
15
- } from "../../chunk-OIRLIV5F.js";
15
+ } from "../../chunk-WVQWQFVR.js";
16
16
  import {
17
17
  LanguageSourceSchema
18
18
  } from "../../chunk-B6Y3QQLI.js";
@@ -67,6 +67,71 @@ declare const ToolDescriptorSchema: z.ZodObject<{
67
67
  inputSchema: z.ZodCustom<SubsetSchema, SubsetSchema>;
68
68
  }, z.core.$strict>;
69
69
  declare const POLICY_OPERATIONS: readonly ["recovery.getBasket", "shopify.searchProducts", "discounts.getOptions", "discounts.evaluate", "products.findQualifying", "products.findSimilar"];
70
+ declare const ExternalHttpExecutionSchema: z.ZodObject<{
71
+ kind: z.ZodLiteral<"EXTERNAL_HTTP">;
72
+ executorVersion: z.ZodLiteral<"1.0.0">;
73
+ connectionRevisionId: z.ZodString;
74
+ method: z.ZodLiteral<"GET">;
75
+ path: z.ZodString;
76
+ query: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
77
+ input: z.ZodString;
78
+ omitIfMissing: z.ZodOptional<z.ZodLiteral<true>>;
79
+ }, z.core.$strict>, z.ZodObject<{
80
+ literal: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
81
+ }, z.core.$strict>]>>;
82
+ responseFormat: z.ZodObject<{
83
+ mode: z.ZodEnum<{
84
+ JSON: "JSON";
85
+ TEXT: "TEXT";
86
+ }>;
87
+ mediaTypes: z.ZodArray<z.ZodString>;
88
+ }, z.core.$strict>;
89
+ resultPath: z.ZodString;
90
+ responseProcessing: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
91
+ kind: z.ZodLiteral<"OBJECT">;
92
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
93
+ path: z.ZodString;
94
+ omitIfMissing: z.ZodOptional<z.ZodLiteral<true>>;
95
+ }, z.core.$strict>>;
96
+ }, z.core.$strict>, z.ZodObject<{
97
+ kind: z.ZodLiteral<"LIST">;
98
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
99
+ path: z.ZodString;
100
+ omitIfMissing: z.ZodOptional<z.ZodLiteral<true>>;
101
+ }, z.core.$strict>>;
102
+ filters: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
103
+ path: z.ZodString;
104
+ op: z.ZodEnum<{
105
+ GT: "GT";
106
+ LT: "LT";
107
+ NE: "NE";
108
+ EQ: "EQ";
109
+ GTE: "GTE";
110
+ LTE: "LTE";
111
+ CONTAINS: "CONTAINS";
112
+ STARTS_WITH: "STARTS_WITH";
113
+ }>;
114
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>;
115
+ }, z.core.$strict>, z.ZodObject<{
116
+ path: z.ZodString;
117
+ op: z.ZodLiteral<"IN">;
118
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>>;
119
+ }, z.core.$strict>], "op">>;
120
+ sort: z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
121
+ path: z.ZodString;
122
+ direction: z.ZodEnum<{
123
+ ASC: "ASC";
124
+ DESC: "DESC";
125
+ }>;
126
+ }, z.core.$strict>]>;
127
+ limit: z.ZodInt;
128
+ }, z.core.$strict>]>, z.ZodObject<{
129
+ kind: z.ZodLiteral<"JAVASCRIPT">;
130
+ runtimeVersion: z.ZodLiteral<"quickjs-sync.v1">;
131
+ source: z.ZodString;
132
+ }, z.core.$strict>]>;
133
+ resultSchema: z.ZodCustom<SubsetSchema, SubsetSchema>;
134
+ }, z.core.$strict>;
70
135
  declare const CommerceExecutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
71
136
  kind: z.ZodLiteral<"SHOPIFY_STOREFRONT_QUERY">;
72
137
  executorVersion: z.ZodLiteral<"1.0.0">;
@@ -98,7 +163,74 @@ declare const CommerceExecutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
98
163
  }, z.core.$strict>, z.ZodObject<{
99
164
  literal: z.ZodUnknown;
100
165
  }, z.core.$strict>]>>;
166
+ }, z.core.$strict>, z.ZodObject<{
167
+ kind: z.ZodLiteral<"EXTERNAL_HTTP">;
168
+ executorVersion: z.ZodLiteral<"1.0.0">;
169
+ connectionRevisionId: z.ZodString;
170
+ method: z.ZodLiteral<"GET">;
171
+ path: z.ZodString;
172
+ query: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
173
+ input: z.ZodString;
174
+ omitIfMissing: z.ZodOptional<z.ZodLiteral<true>>;
175
+ }, z.core.$strict>, z.ZodObject<{
176
+ literal: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
177
+ }, z.core.$strict>]>>;
178
+ responseFormat: z.ZodObject<{
179
+ mode: z.ZodEnum<{
180
+ JSON: "JSON";
181
+ TEXT: "TEXT";
182
+ }>;
183
+ mediaTypes: z.ZodArray<z.ZodString>;
184
+ }, z.core.$strict>;
185
+ resultPath: z.ZodString;
186
+ responseProcessing: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
187
+ kind: z.ZodLiteral<"OBJECT">;
188
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
189
+ path: z.ZodString;
190
+ omitIfMissing: z.ZodOptional<z.ZodLiteral<true>>;
191
+ }, z.core.$strict>>;
192
+ }, z.core.$strict>, z.ZodObject<{
193
+ kind: z.ZodLiteral<"LIST">;
194
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
195
+ path: z.ZodString;
196
+ omitIfMissing: z.ZodOptional<z.ZodLiteral<true>>;
197
+ }, z.core.$strict>>;
198
+ filters: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
199
+ path: z.ZodString;
200
+ op: z.ZodEnum<{
201
+ GT: "GT";
202
+ LT: "LT";
203
+ NE: "NE";
204
+ EQ: "EQ";
205
+ GTE: "GTE";
206
+ LTE: "LTE";
207
+ CONTAINS: "CONTAINS";
208
+ STARTS_WITH: "STARTS_WITH";
209
+ }>;
210
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>;
211
+ }, z.core.$strict>, z.ZodObject<{
212
+ path: z.ZodString;
213
+ op: z.ZodLiteral<"IN">;
214
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>>;
215
+ }, z.core.$strict>], "op">>;
216
+ sort: z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
217
+ path: z.ZodString;
218
+ direction: z.ZodEnum<{
219
+ ASC: "ASC";
220
+ DESC: "DESC";
221
+ }>;
222
+ }, z.core.$strict>]>;
223
+ limit: z.ZodInt;
224
+ }, z.core.$strict>]>, z.ZodObject<{
225
+ kind: z.ZodLiteral<"JAVASCRIPT">;
226
+ runtimeVersion: z.ZodLiteral<"quickjs-sync.v1">;
227
+ source: z.ZodString;
228
+ }, z.core.$strict>]>;
229
+ resultSchema: z.ZodCustom<SubsetSchema, SubsetSchema>;
101
230
  }, z.core.$strict>], "kind">;
231
+ type ExternalHttpExecution = Extract<z.infer<typeof CommerceExecutionSchema>, {
232
+ kind: "EXTERNAL_HTTP";
233
+ }>;
102
234
  declare const ResponseTemplateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
103
235
  kind: z.ZodLiteral<"text">;
104
236
  text: z.ZodString;
@@ -143,6 +275,70 @@ declare const CommerceToolDefinitionSchema: z.ZodObject<{
143
275
  }, z.core.$strict>, z.ZodObject<{
144
276
  literal: z.ZodUnknown;
145
277
  }, z.core.$strict>]>>;
278
+ }, z.core.$strict>, z.ZodObject<{
279
+ kind: z.ZodLiteral<"EXTERNAL_HTTP">;
280
+ executorVersion: z.ZodLiteral<"1.0.0">;
281
+ connectionRevisionId: z.ZodString;
282
+ method: z.ZodLiteral<"GET">;
283
+ path: z.ZodString;
284
+ query: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
285
+ input: z.ZodString;
286
+ omitIfMissing: z.ZodOptional<z.ZodLiteral<true>>;
287
+ }, z.core.$strict>, z.ZodObject<{
288
+ literal: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
289
+ }, z.core.$strict>]>>;
290
+ responseFormat: z.ZodObject<{
291
+ mode: z.ZodEnum<{
292
+ JSON: "JSON";
293
+ TEXT: "TEXT";
294
+ }>;
295
+ mediaTypes: z.ZodArray<z.ZodString>;
296
+ }, z.core.$strict>;
297
+ resultPath: z.ZodString;
298
+ responseProcessing: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
299
+ kind: z.ZodLiteral<"OBJECT">;
300
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
301
+ path: z.ZodString;
302
+ omitIfMissing: z.ZodOptional<z.ZodLiteral<true>>;
303
+ }, z.core.$strict>>;
304
+ }, z.core.$strict>, z.ZodObject<{
305
+ kind: z.ZodLiteral<"LIST">;
306
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
307
+ path: z.ZodString;
308
+ omitIfMissing: z.ZodOptional<z.ZodLiteral<true>>;
309
+ }, z.core.$strict>>;
310
+ filters: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
311
+ path: z.ZodString;
312
+ op: z.ZodEnum<{
313
+ GT: "GT";
314
+ LT: "LT";
315
+ NE: "NE";
316
+ EQ: "EQ";
317
+ GTE: "GTE";
318
+ LTE: "LTE";
319
+ CONTAINS: "CONTAINS";
320
+ STARTS_WITH: "STARTS_WITH";
321
+ }>;
322
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>;
323
+ }, z.core.$strict>, z.ZodObject<{
324
+ path: z.ZodString;
325
+ op: z.ZodLiteral<"IN">;
326
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>>;
327
+ }, z.core.$strict>], "op">>;
328
+ sort: z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
329
+ path: z.ZodString;
330
+ direction: z.ZodEnum<{
331
+ ASC: "ASC";
332
+ DESC: "DESC";
333
+ }>;
334
+ }, z.core.$strict>]>;
335
+ limit: z.ZodInt;
336
+ }, z.core.$strict>]>, z.ZodObject<{
337
+ kind: z.ZodLiteral<"JAVASCRIPT">;
338
+ runtimeVersion: z.ZodLiteral<"quickjs-sync.v1">;
339
+ source: z.ZodString;
340
+ }, z.core.$strict>]>;
341
+ resultSchema: z.ZodCustom<SubsetSchema, SubsetSchema>;
146
342
  }, z.core.$strict>], "kind">;
147
343
  responseTemplate: z.ZodDiscriminatedUnion<[z.ZodObject<{
148
344
  kind: z.ZodLiteral<"text">;
@@ -181,6 +377,55 @@ interface CommerceDefinitionCompiler {
181
377
  declare function validateDefinitionForPublication(raw: unknown, compiler: CommerceDefinitionCompiler): {
182
378
  inputSchema: SubsetSchema;
183
379
  execution: {
380
+ kind: "EXTERNAL_HTTP";
381
+ executorVersion: "1.0.0";
382
+ connectionRevisionId: string;
383
+ method: "GET";
384
+ path: string;
385
+ query: Record<string, {
386
+ input: string;
387
+ omitIfMissing?: true | undefined;
388
+ } | {
389
+ literal: string | number | boolean;
390
+ }>;
391
+ responseFormat: {
392
+ mode: "JSON" | "TEXT";
393
+ mediaTypes: string[];
394
+ };
395
+ resultPath: string;
396
+ responseProcessing: {
397
+ kind: "OBJECT";
398
+ fields: Record<string, {
399
+ path: string;
400
+ omitIfMissing?: true | undefined;
401
+ }>;
402
+ } | {
403
+ kind: "LIST";
404
+ fields: Record<string, {
405
+ path: string;
406
+ omitIfMissing?: true | undefined;
407
+ }>;
408
+ filters: ({
409
+ path: string;
410
+ op: "GT" | "LT" | "NE" | "EQ" | "GTE" | "LTE" | "CONTAINS" | "STARTS_WITH";
411
+ value: string | number | boolean | null;
412
+ } | {
413
+ path: string;
414
+ op: "IN";
415
+ values: (string | number | boolean | null)[];
416
+ })[];
417
+ sort: {
418
+ path: string;
419
+ direction: "ASC" | "DESC";
420
+ } | null;
421
+ limit: number;
422
+ } | {
423
+ kind: "JAVASCRIPT";
424
+ runtimeVersion: "quickjs-sync.v1";
425
+ source: string;
426
+ };
427
+ resultSchema: SubsetSchema;
428
+ } | {
184
429
  kind: "SHOPIFY_STOREFRONT_QUERY";
185
430
  executorVersion: "1.0.0";
186
431
  apiVersion: "2026-07";
@@ -231,6 +476,55 @@ declare const toolHashInput: (definition: CommerceToolDefinition) => {
231
476
  definition: {
232
477
  inputSchema: SubsetSchema;
233
478
  execution: {
479
+ kind: "EXTERNAL_HTTP";
480
+ executorVersion: "1.0.0";
481
+ connectionRevisionId: string;
482
+ method: "GET";
483
+ path: string;
484
+ query: Record<string, {
485
+ input: string;
486
+ omitIfMissing?: true | undefined;
487
+ } | {
488
+ literal: string | number | boolean;
489
+ }>;
490
+ responseFormat: {
491
+ mode: "JSON" | "TEXT";
492
+ mediaTypes: string[];
493
+ };
494
+ resultPath: string;
495
+ responseProcessing: {
496
+ kind: "OBJECT";
497
+ fields: Record<string, {
498
+ path: string;
499
+ omitIfMissing?: true | undefined;
500
+ }>;
501
+ } | {
502
+ kind: "LIST";
503
+ fields: Record<string, {
504
+ path: string;
505
+ omitIfMissing?: true | undefined;
506
+ }>;
507
+ filters: ({
508
+ path: string;
509
+ op: "GT" | "LT" | "NE" | "EQ" | "GTE" | "LTE" | "CONTAINS" | "STARTS_WITH";
510
+ value: string | number | boolean | null;
511
+ } | {
512
+ path: string;
513
+ op: "IN";
514
+ values: (string | number | boolean | null)[];
515
+ })[];
516
+ sort: {
517
+ path: string;
518
+ direction: "ASC" | "DESC";
519
+ } | null;
520
+ limit: number;
521
+ } | {
522
+ kind: "JAVASCRIPT";
523
+ runtimeVersion: "quickjs-sync.v1";
524
+ source: string;
525
+ };
526
+ resultSchema: SubsetSchema;
527
+ } | {
234
528
  kind: "SHOPIFY_STOREFRONT_QUERY";
235
529
  executorVersion: "1.0.0";
236
530
  apiVersion: "2026-07";
@@ -590,13 +884,13 @@ declare const CommerceAlternativeSchema: z.ZodObject<{
590
884
  similarityReasons: z.ZodArray<z.ZodString>;
591
885
  }, z.core.$strict>;
592
886
  declare const CommerceErrorCodeSchema: z.ZodEnum<{
887
+ DEADLINE: "DEADLINE";
888
+ THROTTLED: "THROTTLED";
593
889
  INVALID_INPUT: "INVALID_INPUT";
594
890
  DENIED: "DENIED";
595
891
  STALE_TURN: "STALE_TURN";
596
892
  NOT_FOUND: "NOT_FOUND";
597
893
  UNAVAILABLE: "UNAVAILABLE";
598
- THROTTLED: "THROTTLED";
599
- DEADLINE: "DEADLINE";
600
894
  INCOMPATIBLE_VERSION: "INCOMPATIBLE_VERSION";
601
895
  }>;
602
896
  declare function commerceToolResultSchema<T extends z.ZodType>(data: T): z.ZodUnion<readonly [z.ZodObject<{
@@ -608,13 +902,13 @@ declare function commerceToolResultSchema<T extends z.ZodType>(data: T): z.ZodUn
608
902
  contractVersion: z.ZodLiteral<"commerce.v1">;
609
903
  status: z.ZodLiteral<"ERROR">;
610
904
  code: z.ZodEnum<{
905
+ DEADLINE: "DEADLINE";
906
+ THROTTLED: "THROTTLED";
611
907
  INVALID_INPUT: "INVALID_INPUT";
612
908
  DENIED: "DENIED";
613
909
  STALE_TURN: "STALE_TURN";
614
910
  NOT_FOUND: "NOT_FOUND";
615
911
  UNAVAILABLE: "UNAVAILABLE";
616
- THROTTLED: "THROTTLED";
617
- DEADLINE: "DEADLINE";
618
912
  INCOMPATIBLE_VERSION: "INCOMPATIBLE_VERSION";
619
913
  }>;
620
914
  retryable: z.ZodBoolean;
@@ -629,13 +923,13 @@ declare const CommerceToolResultSchema: z.ZodUnion<readonly [z.ZodObject<{
629
923
  contractVersion: z.ZodLiteral<"commerce.v1">;
630
924
  status: z.ZodLiteral<"ERROR">;
631
925
  code: z.ZodEnum<{
926
+ DEADLINE: "DEADLINE";
927
+ THROTTLED: "THROTTLED";
632
928
  INVALID_INPUT: "INVALID_INPUT";
633
929
  DENIED: "DENIED";
634
930
  STALE_TURN: "STALE_TURN";
635
931
  NOT_FOUND: "NOT_FOUND";
636
932
  UNAVAILABLE: "UNAVAILABLE";
637
- THROTTLED: "THROTTLED";
638
- DEADLINE: "DEADLINE";
639
933
  INCOMPATIBLE_VERSION: "INCOMPATIBLE_VERSION";
640
934
  }>;
641
935
  retryable: z.ZodBoolean;
@@ -1001,4 +1295,4 @@ declare function verifyResponseContract(definition: unknown, hash: string, diges
1001
1295
  /** JSON Schema branches retain the immutable envelope; only ANSWER details vary. */
1002
1296
  declare function finalResponseToolSchema(definition: CommerceResponseContract): Json;
1003
1297
 
1004
- export { ToolNameSchema as $, type CommerceToolDraftDefinition as A, CommerceToolDraftDefinitionSchema as B, type CommerceTurnIdentity as C, type Digest as D, CommerceToolIdentitySchema as E, CommerceToolInputs as F, type GrantedTool as G, CommerceToolOutputs as H, CommerceToolResultSchema as I, CommerceToolRevisionIdentitySchema as J, CommerceTurnIdentitySchema as K, DetailsSchemaSchema as L, EMPTY_RESPONSE_CONTRACT as M, GrantedToolSchema as N, GrantedToolsSchema as O, InputSchemaSchema as P, type Json as Q, MONEY_PATTERN as R, type SubsetSchema as S, type ToolDescriptor as T, POLICY_OPERATIONS as U, POLICY_OPERATION_DESCRIPTORS as V, ReferralReasonSchema as W, ResponseTemplateSchema as X, ToolBindingSchema as Y, ToolBindingsSchema as Z, ToolDescriptorSchema as _, type CommerceConversationGrant as a, canonicalJson as a0, capabilityHashInput as a1, commerceToolResultSchema as a2, compileSubset as a3, definitionToMcpDescriptor as a4, finalResponseSchema as a5, finalResponseToolSchema as a6, jsonBytes as a7, mapToolArguments as a8, matchesSubset as a9, productBelongsToDomain as aa, responseContractCanonicalJson as ab, safeName as ac, safePath as ad, toolHashInput as ae, validateDefinitionForPublication as af, validateDefinitionVersion as ag, validateSubset as ah, verifyResponseContract as ai, type CommerceManifest as b, type CommerceToolResult as c, type CommerceFinalResponse as d, type CommerceToolDefinition as e, CommerceAlternativeSchema as f, CommerceAssertionSchema as g, CommerceBasketSchema as h, CommerceConfigurationSchema as i, CommerceConversationGrantSchema as j, type CommerceDefinitionCompiler as k, CommerceErrorCodeSchema as l, type CommerceEvidence as m, CommerceEvidenceSchema as n, CommerceExecuteAssertionSchema as o, CommerceExecutionSchema as p, CommerceFinalResponseSchema as q, CommerceManifestSchema as r, CommerceOfferSchema as s, CommerceProductSchema as t, CommerceProposalSchema as u, CommerceReleaseIdentitySchema as v, CommerceResolveAssertionSchema as w, type CommerceResponseContract as x, CommerceResponseContractSchema as y, CommerceToolDefinitionSchema as z };
1298
+ export { ToolBindingsSchema as $, type CommerceToolDraftDefinition as A, CommerceToolDraftDefinitionSchema as B, type CommerceTurnIdentity as C, type Digest as D, CommerceToolIdentitySchema as E, CommerceToolInputs as F, type GrantedTool as G, CommerceToolOutputs as H, CommerceToolResultSchema as I, CommerceToolRevisionIdentitySchema as J, CommerceTurnIdentitySchema as K, DetailsSchemaSchema as L, EMPTY_RESPONSE_CONTRACT as M, type ExternalHttpExecution as N, ExternalHttpExecutionSchema as O, GrantedToolSchema as P, GrantedToolsSchema as Q, InputSchemaSchema as R, type SubsetSchema as S, type ToolDescriptor as T, type Json as U, MONEY_PATTERN as V, POLICY_OPERATIONS as W, POLICY_OPERATION_DESCRIPTORS as X, ReferralReasonSchema as Y, ResponseTemplateSchema as Z, ToolBindingSchema as _, type CommerceConversationGrant as a, ToolDescriptorSchema as a0, ToolNameSchema as a1, canonicalJson as a2, capabilityHashInput as a3, commerceToolResultSchema as a4, compileSubset as a5, definitionToMcpDescriptor as a6, finalResponseSchema as a7, finalResponseToolSchema as a8, jsonBytes as a9, mapToolArguments as aa, matchesSubset as ab, productBelongsToDomain as ac, responseContractCanonicalJson as ad, safeName as ae, safePath as af, toolHashInput as ag, validateDefinitionForPublication as ah, validateDefinitionVersion as ai, validateSubset as aj, verifyResponseContract as ak, type CommerceManifest as b, type CommerceToolResult as c, type CommerceFinalResponse as d, type CommerceToolDefinition as e, CommerceAlternativeSchema as f, CommerceAssertionSchema as g, CommerceBasketSchema as h, CommerceConfigurationSchema as i, CommerceConversationGrantSchema as j, type CommerceDefinitionCompiler as k, CommerceErrorCodeSchema as l, type CommerceEvidence as m, CommerceEvidenceSchema as n, CommerceExecuteAssertionSchema as o, CommerceExecutionSchema as p, CommerceFinalResponseSchema as q, CommerceManifestSchema as r, CommerceOfferSchema as s, CommerceProductSchema as t, CommerceProposalSchema as u, CommerceReleaseIdentitySchema as v, CommerceResolveAssertionSchema as w, type CommerceResponseContract as x, CommerceResponseContractSchema as y, CommerceToolDefinitionSchema as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modainteract/moda-interact-shared",
3
- "version": "0.13.1",
3
+ "version": "0.14.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -88,6 +88,7 @@
88
88
  "build": "tsup",
89
89
  "typecheck": "tsc --noEmit",
90
90
  "test": "tsx --test \"src/**/*.test.ts\"",
91
+ "test:arch020-external-contracts": "tsx --test src/commerce/external-contracts.test.ts",
91
92
  "validate:billing-entrypoint": "npm run build && node scripts/validate-billing-entrypoint.mjs",
92
93
  "validate:recovery-policy-entrypoint": "npm run build && node scripts/validate-recovery-policy-entrypoint.mjs",
93
94
  "validate:internationalization-entrypoint": "npm run build && node scripts/validate-internationalization-entrypoint.mjs",