@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.
- package/dist/{chunk-OIRLIV5F.js → chunk-WVQWQFVR.js} +293 -161
- package/dist/chunk-WVQWQFVR.js.map +1 -0
- package/dist/commerce/index.d.ts +305 -3
- package/dist/commerce/index.js +41 -1
- package/dist/commerce/index.js.map +1 -1
- package/dist/commerce/runner/index.d.ts +1 -1
- package/dist/commerce/runner/index.js +1 -1
- package/dist/{response-CrhM-N0k.d.ts → response-D3LgdEbH.d.ts} +301 -7
- package/package.json +2 -1
- package/dist/chunk-OIRLIV5F.js.map +0 -1
|
@@ -218,8 +218,65 @@ var boundedJson = (bytes) => z2.unknown().refine((v) => {
|
|
|
218
218
|
}
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
-
// src/commerce/
|
|
221
|
+
// src/commerce/external.ts
|
|
222
222
|
import { z as z3 } from "zod";
|
|
223
|
+
var utf8 = (value, maximum) => new TextEncoder().encode(value).length <= maximum;
|
|
224
|
+
var scalar = z3.union([z3.string().refine((value) => utf8(value, 2048)), z3.number().finite(), z3.boolean()]);
|
|
225
|
+
var ExternalQueryValueSchema = scalar;
|
|
226
|
+
var scalarOrNull = z3.union([scalar, z3.null()]);
|
|
227
|
+
var record = (item, max) => z3.record(z3.string().refine(safeName), item).refine((value) => Object.keys(value).length <= max);
|
|
228
|
+
var ExternalQueryMappingSchema = z3.union([
|
|
229
|
+
z3.strictObject({ input: z3.string().refine(safeName), omitIfMissing: z3.literal(true).optional() }),
|
|
230
|
+
z3.strictObject({ literal: scalar })
|
|
231
|
+
]);
|
|
232
|
+
var ExternalQueryMappingsSchema = record(ExternalQueryMappingSchema, 32).superRefine((value, ctx) => {
|
|
233
|
+
const reserved = /^(authorization|cookie|set-cookie|host|x-api-key|api_key|apikey|access_token|token|secret|password)$/i;
|
|
234
|
+
for (const key of Object.keys(value)) if (reserved.test(key)) ctx.addIssue({ code: "custom", path: [key], message: "Reserved query key" });
|
|
235
|
+
});
|
|
236
|
+
var ExternalPathSchema = z3.string().max(1024).refine(
|
|
237
|
+
(value) => utf8(value, 1024) && /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]*\/?$/.test(value) && !value.includes("//") && !value.includes("%") && !value.includes("\\") && !value.includes("?") && !value.includes("#") && !value.includes("{") && !value.includes("}") && value.split("/").every((segment) => segment !== "." && segment !== "..")
|
|
238
|
+
);
|
|
239
|
+
var mediaType = z3.string().min(1).max(128).refine((value) => value === value.toLowerCase() && /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/.test(value));
|
|
240
|
+
var jsonMime = (value) => value === "application/json" || /^application\/[a-z0-9!#$&^_.+-]+\+json$/.test(value);
|
|
241
|
+
var textMime = (value) => /^text\/[a-z0-9!#$&^_.+-]+$/.test(value) || value === "application/xml" || /^application\/[a-z0-9!#$&^_.+-]+\+xml$/.test(value) || jsonMime(value);
|
|
242
|
+
var ExternalResponseFormatSchema = z3.strictObject({ mode: z3.enum(["JSON", "TEXT"]), mediaTypes: z3.array(mediaType).min(1).max(8).refine((values) => new Set(values).size === values.length) }).refine((value) => value.mediaTypes.every(value.mode === "JSON" ? jsonMime : textMime));
|
|
243
|
+
var FieldProjectionSchema = record(z3.strictObject({ path: z3.string().refine(safePath), omitIfMissing: z3.literal(true).optional() }), 32).refine((value) => Object.keys(value).length >= 1);
|
|
244
|
+
var ResponseFilterSchema = z3.discriminatedUnion("op", [
|
|
245
|
+
z3.strictObject({ path: z3.string().refine(safePath), op: z3.enum(["EQ", "NE", "GT", "GTE", "LT", "LTE", "CONTAINS", "STARTS_WITH"]), value: scalarOrNull }),
|
|
246
|
+
z3.strictObject({ path: z3.string().refine(safePath), op: z3.literal("IN"), values: z3.array(scalarOrNull).min(1).max(20) })
|
|
247
|
+
]);
|
|
248
|
+
var visualObject = z3.strictObject({ kind: z3.literal("OBJECT"), fields: FieldProjectionSchema });
|
|
249
|
+
var visualList = z3.strictObject({ kind: z3.literal("LIST"), fields: FieldProjectionSchema, filters: z3.array(ResponseFilterSchema).max(8), sort: z3.union([z3.null(), z3.strictObject({ path: z3.string().refine(safePath), direction: z3.enum(["ASC", "DESC"]) })]), limit: z3.int().min(1).max(20) });
|
|
250
|
+
var VisualResponseProcessingSchema = z3.union([visualObject, visualList]);
|
|
251
|
+
var ResponseProcessingSchema = z3.union([VisualResponseProcessingSchema, z3.strictObject({ kind: z3.literal("JAVASCRIPT"), runtimeVersion: z3.literal("quickjs-sync.v1"), source: z3.string().min(1).refine((value) => utf8(value, 16384)) })]);
|
|
252
|
+
var TransformResponseSchema = z3.strictObject({ status: z3.int().min(200).max(299), contentType: z3.string().min(1).max(128), bodyText: z3.string().refine((value) => utf8(value, 262144)), json: z3.union([z3.null(), z3.json()]) });
|
|
253
|
+
var TransformSampleSchema = z3.strictObject({ status: z3.int().min(200).max(299), contentType: z3.string().min(1).max(128), bodyText: z3.string().refine((value) => utf8(value, 262144)) }).refine((value) => jsonBytes(value) <= 524288);
|
|
254
|
+
var boundedValues = z3.custom((value) => {
|
|
255
|
+
const visit = (node, depth) => depth <= 20 && (node === null || typeof node === "string" || typeof node === "boolean" || typeof node === "number" && Number.isFinite(node) || Array.isArray(node) && node.every((child) => visit(child, depth + 1)) || !!node && typeof node === "object" && !Array.isArray(node) && Object.getPrototypeOf(node) === Object.prototype && Object.entries(node).every(([key, child]) => !["__proto__", "prototype", "constructor"].includes(key) && visit(child, depth + 1)));
|
|
256
|
+
try {
|
|
257
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && visit(value, 1) && jsonBytes(value) <= 49152;
|
|
258
|
+
} catch {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
var ExternalHttpResultDataSchema = z3.strictObject({ source: z3.literal("EXTERNAL_HTTP"), connectionRevisionId: IdSchema, observedAt: DateSchema, values: boundedValues });
|
|
263
|
+
var ConnectionRevisionViewSchema = z3.strictObject({ id: IdSchema, connectionId: IdSchema, revisionNumber: z3.int().positive(), origin: z3.string().min(1).max(2048), scope: z3.enum(["PLATFORM", "PER_SHOP"]), authMode: z3.enum(["NONE", "BEARER", "API_KEY"]), authHeader: z3.string().min(1).max(128).nullable(), documentation: z3.string().max(16e3), createdAt: z3.iso.datetime({ offset: false }) });
|
|
264
|
+
var ConnectionViewSchema = z3.strictObject({ id: IdSchema, key: z3.string().regex(/^[a-z][a-z0-9_]{0,127}$/), displayName: z3.string().min(1).max(255), description: z3.string().max(4096), enabled: z3.boolean(), editVersion: z3.int().positive(), revisions: z3.array(ConnectionRevisionViewSchema) });
|
|
265
|
+
var CredentialStatusSchema = z3.strictObject({ connectionRevisionId: IdSchema, shopId: IdSchema.nullable(), configured: z3.boolean(), editVersion: z3.int().positive().nullable(), updatedAt: z3.iso.datetime({ offset: false }).nullable() });
|
|
266
|
+
var ConnectionCommandSchema = z3.strictObject({ operationId: IdSchema, reason: z3.string().trim().min(1).max(1e3) });
|
|
267
|
+
var RevisionInputSchema = z3.strictObject({ origin: z3.string().min(1).max(2048), scope: z3.enum(["PLATFORM", "PER_SHOP"]), authMode: z3.enum(["NONE", "BEARER", "API_KEY"]), authHeader: z3.string().min(1).max(128).nullable(), documentation: z3.string().max(16e3) });
|
|
268
|
+
var ConnectionIssueSchema = z3.strictObject({ path: z3.string().max(256), message: z3.string().min(1).max(512) });
|
|
269
|
+
var ConnectionResultSchema = (value) => z3.discriminatedUnion("kind", [
|
|
270
|
+
z3.strictObject({ kind: z3.literal("ok"), value }),
|
|
271
|
+
z3.strictObject({ kind: z3.literal("not-found") }),
|
|
272
|
+
z3.strictObject({ kind: z3.literal("forbidden") }),
|
|
273
|
+
z3.strictObject({ kind: z3.literal("unavailable") }),
|
|
274
|
+
z3.strictObject({ kind: z3.literal("invalid"), issues: z3.array(ConnectionIssueSchema).max(32) }),
|
|
275
|
+
z3.strictObject({ kind: z3.literal("conflict"), code: z3.enum(["STALE_CAS", "CONFLICTING_REPLAY"]) })
|
|
276
|
+
]);
|
|
277
|
+
|
|
278
|
+
// src/commerce/definitions.ts
|
|
279
|
+
import { z as z4 } from "zod";
|
|
223
280
|
import { gt } from "semver";
|
|
224
281
|
|
|
225
282
|
// src/commerce/definition-size.ts
|
|
@@ -260,38 +317,38 @@ var definitionFitsStorage = (value) => {
|
|
|
260
317
|
var DEFINITION_SIZE_MESSAGE = "Definition exceeds the 65536-byte jsonb text limit";
|
|
261
318
|
|
|
262
319
|
// src/commerce/definitions.ts
|
|
263
|
-
var ToolNameSchema =
|
|
264
|
-
var ToolBindingSchema =
|
|
320
|
+
var ToolNameSchema = z4.string().regex(/^[a-z][a-z0-9_]{0,127}$/).refine((n) => n !== "finalResponse");
|
|
321
|
+
var ToolBindingSchema = z4.strictObject({
|
|
265
322
|
toolId: IdSchema,
|
|
266
323
|
toolRevisionId: IdSchema
|
|
267
324
|
});
|
|
268
|
-
var ToolBindingsSchema =
|
|
269
|
-
var GrantedToolSchema =
|
|
325
|
+
var ToolBindingsSchema = z4.array(ToolBindingSchema).max(32).refine((v) => distinct(v.map((x) => x.toolId)));
|
|
326
|
+
var GrantedToolSchema = z4.strictObject({
|
|
270
327
|
toolId: IdSchema,
|
|
271
328
|
toolRevisionId: IdSchema,
|
|
272
329
|
toolName: ToolNameSchema,
|
|
273
330
|
definitionVersion: SemverSchema,
|
|
274
|
-
capabilityKeys:
|
|
331
|
+
capabilityKeys: z4.array(IdSchema).min(1).max(32).refine((v) => distinct(v) && v.join("\0") === [...v].sort().join("\0"))
|
|
275
332
|
});
|
|
276
|
-
var GrantedToolsSchema =
|
|
333
|
+
var GrantedToolsSchema = z4.array(GrantedToolSchema).max(32).refine(
|
|
277
334
|
(v) => distinct(v.map((x) => x.toolId)) && distinct(v.map((x) => x.toolName))
|
|
278
335
|
);
|
|
279
|
-
var ToolDescriptorSchema =
|
|
336
|
+
var ToolDescriptorSchema = z4.strictObject({
|
|
280
337
|
toolId: IdSchema,
|
|
281
338
|
toolRevisionId: IdSchema,
|
|
282
339
|
name: ToolNameSchema,
|
|
283
340
|
definitionVersion: SemverSchema,
|
|
284
|
-
description:
|
|
341
|
+
description: z4.string().min(1).max(4096),
|
|
285
342
|
inputSchema: InputSchemaSchema
|
|
286
343
|
});
|
|
287
|
-
var MappingSchema =
|
|
288
|
-
|
|
289
|
-
input:
|
|
290
|
-
omitIfMissing:
|
|
344
|
+
var MappingSchema = z4.union([
|
|
345
|
+
z4.strictObject({
|
|
346
|
+
input: z4.string().refine(safeName),
|
|
347
|
+
omitIfMissing: z4.literal(true).optional()
|
|
291
348
|
}),
|
|
292
|
-
|
|
349
|
+
z4.strictObject({ literal: boundedJson(8192) })
|
|
293
350
|
]);
|
|
294
|
-
var MappingsSchema =
|
|
351
|
+
var MappingsSchema = z4.record(z4.string().refine(safeName), MappingSchema).refine((v) => Object.keys(v).length <= 32);
|
|
295
352
|
var POLICY_OPERATIONS = [
|
|
296
353
|
"recovery.getBasket",
|
|
297
354
|
"shopify.searchProducts",
|
|
@@ -300,23 +357,41 @@ var POLICY_OPERATIONS = [
|
|
|
300
357
|
"products.findQualifying",
|
|
301
358
|
"products.findSimilar"
|
|
302
359
|
];
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
360
|
+
var ExternalHttpExecutionSchema = z4.strictObject({
|
|
361
|
+
kind: z4.literal("EXTERNAL_HTTP"),
|
|
362
|
+
executorVersion: z4.literal("1.0.0"),
|
|
363
|
+
connectionRevisionId: IdSchema,
|
|
364
|
+
method: z4.literal("GET"),
|
|
365
|
+
path: ExternalPathSchema,
|
|
366
|
+
query: ExternalQueryMappingsSchema,
|
|
367
|
+
responseFormat: ExternalResponseFormatSchema,
|
|
368
|
+
resultPath: z4.string().refine((value) => value === "" || safePath(value)),
|
|
369
|
+
responseProcessing: ResponseProcessingSchema,
|
|
370
|
+
resultSchema: DetailsSchemaSchema
|
|
371
|
+
}).superRefine((value, ctx) => {
|
|
372
|
+
if (value.responseProcessing.kind === "JAVASCRIPT" && value.resultPath !== "")
|
|
373
|
+
ctx.addIssue({ code: "custom", path: ["resultPath"], message: "JAVASCRIPT processing requires an empty resultPath" });
|
|
374
|
+
if (value.responseProcessing.kind !== "JAVASCRIPT" && value.responseFormat.mode !== "JSON")
|
|
375
|
+
ctx.addIssue({ code: "custom", path: ["responseFormat", "mode"], message: "Visual processing requires JSON" });
|
|
376
|
+
});
|
|
377
|
+
var CommerceExecutionSchema = z4.discriminatedUnion("kind", [
|
|
378
|
+
z4.strictObject({
|
|
379
|
+
kind: z4.literal("SHOPIFY_STOREFRONT_QUERY"),
|
|
380
|
+
executorVersion: z4.literal("1.0.0"),
|
|
381
|
+
apiVersion: z4.literal("2026-07"),
|
|
308
382
|
schemaHash: HashSchema,
|
|
309
|
-
document:
|
|
310
|
-
operationName:
|
|
383
|
+
document: z4.string().min(1).refine((v) => new TextEncoder().encode(v).length <= 16384),
|
|
384
|
+
operationName: z4.string().refine(safeName),
|
|
311
385
|
variables: MappingsSchema,
|
|
312
|
-
resultPath:
|
|
386
|
+
resultPath: z4.string().refine(safePath)
|
|
313
387
|
}),
|
|
314
|
-
|
|
315
|
-
kind:
|
|
316
|
-
operation:
|
|
317
|
-
operationVersion:
|
|
388
|
+
z4.strictObject({
|
|
389
|
+
kind: z4.literal("POLICY_OPERATION"),
|
|
390
|
+
operation: z4.enum(POLICY_OPERATIONS),
|
|
391
|
+
operationVersion: z4.literal("1.0.0"),
|
|
318
392
|
arguments: MappingsSchema
|
|
319
|
-
})
|
|
393
|
+
}),
|
|
394
|
+
ExternalHttpExecutionSchema
|
|
320
395
|
]);
|
|
321
396
|
function tokensValid(text, root) {
|
|
322
397
|
if (/[<>]/.test(text)) return false;
|
|
@@ -326,17 +401,17 @@ function tokensValid(text, root) {
|
|
|
326
401
|
);
|
|
327
402
|
return !residue.includes("{{") && !residue.includes("}}");
|
|
328
403
|
}
|
|
329
|
-
var fixed =
|
|
330
|
-
var ResponseTemplateSchema =
|
|
331
|
-
|
|
332
|
-
kind:
|
|
333
|
-
text:
|
|
404
|
+
var fixed = z4.string().max(4096).refine((v) => !/[<>]|\{\{|\}\}/.test(v));
|
|
405
|
+
var ResponseTemplateSchema = z4.discriminatedUnion("kind", [
|
|
406
|
+
z4.strictObject({
|
|
407
|
+
kind: z4.literal("text"),
|
|
408
|
+
text: z4.string().max(4096).refine((v) => tokensValid(v, "result")),
|
|
334
409
|
unavailable: fixed
|
|
335
410
|
}),
|
|
336
|
-
|
|
337
|
-
kind:
|
|
338
|
-
itemsPath:
|
|
339
|
-
item:
|
|
411
|
+
z4.strictObject({
|
|
412
|
+
kind: z4.literal("items"),
|
|
413
|
+
itemsPath: z4.string().refine(safePath),
|
|
414
|
+
item: z4.string().max(4096).refine((v) => tokensValid(v, "item")),
|
|
340
415
|
empty: fixed,
|
|
341
416
|
unavailable: fixed
|
|
342
417
|
})
|
|
@@ -344,10 +419,11 @@ var ResponseTemplateSchema = z3.discriminatedUnion("kind", [
|
|
|
344
419
|
var identity = {
|
|
345
420
|
name: ToolNameSchema,
|
|
346
421
|
definitionVersion: SemverSchema,
|
|
347
|
-
description:
|
|
422
|
+
description: z4.string().min(1).max(4096)
|
|
348
423
|
};
|
|
349
424
|
var forbiddenInput = /^(shopid|customerid|checkoutrecoveryid|conversationid|grantid|releaseid|token|accesstoken|domain|headers|url|graphql|document|authorization)$/i;
|
|
350
|
-
var
|
|
425
|
+
var forbiddenExternalInput = /^(authorization|cookie|set-cookie|host|x-api-key|api_key|apikey|access_token|token|secret|password)$/i;
|
|
426
|
+
var CommerceToolDefinitionSchema = z4.strictObject({
|
|
351
427
|
...identity,
|
|
352
428
|
inputSchema: InputSchemaSchema,
|
|
353
429
|
execution: CommerceExecutionSchema,
|
|
@@ -362,7 +438,7 @@ var CommerceToolDefinitionSchema = z3.strictObject({
|
|
|
362
438
|
code: "custom",
|
|
363
439
|
message: "Authority/credential inputs are forbidden"
|
|
364
440
|
});
|
|
365
|
-
const mapping = d.execution.kind === "POLICY_OPERATION" ? d.execution.arguments : d.execution.variables;
|
|
441
|
+
const mapping = d.execution.kind === "POLICY_OPERATION" ? d.execution.arguments : d.execution.kind === "SHOPIFY_STOREFRONT_QUERY" ? d.execution.variables : d.execution.query;
|
|
366
442
|
for (const [name, m] of Object.entries(mapping))
|
|
367
443
|
if ("input" in m && !Object.hasOwn(properties, m.input))
|
|
368
444
|
ctx.addIssue({
|
|
@@ -370,16 +446,49 @@ var CommerceToolDefinitionSchema = z3.strictObject({
|
|
|
370
446
|
path: ["execution", name],
|
|
371
447
|
message: "Unknown mapped input"
|
|
372
448
|
});
|
|
449
|
+
if (d.execution.kind === "EXTERNAL_HTTP") {
|
|
450
|
+
for (const [name, mapping2] of Object.entries(d.execution.query))
|
|
451
|
+
if ("input" in mapping2) {
|
|
452
|
+
const target = properties[mapping2.input];
|
|
453
|
+
const type = target && (Array.isArray(target.type) ? target.type[0] : target.type);
|
|
454
|
+
if (forbiddenExternalInput.test(mapping2.input) || !["string", "integer", "boolean"].includes(type ?? ""))
|
|
455
|
+
ctx.addIssue({ code: "custom", path: ["execution", "query", name], message: "External mappings require a top-level scalar input" });
|
|
456
|
+
}
|
|
457
|
+
}
|
|
373
458
|
});
|
|
374
459
|
var draftObject = boundedJson(65536).refine(
|
|
375
460
|
(v) => !!v && typeof v === "object" && !Array.isArray(v)
|
|
376
461
|
);
|
|
377
|
-
var CommerceToolDraftDefinitionSchema =
|
|
462
|
+
var CommerceToolDraftDefinitionSchema = z4.strictObject({
|
|
378
463
|
...identity,
|
|
379
464
|
inputSchema: draftObject,
|
|
380
465
|
execution: draftObject,
|
|
381
466
|
responseTemplate: draftObject
|
|
382
467
|
}).refine(definitionFitsStorage, { message: DEFINITION_SIZE_MESSAGE });
|
|
468
|
+
function externalOutputSchema(execution) {
|
|
469
|
+
return {
|
|
470
|
+
type: "object",
|
|
471
|
+
properties: { values: execution.resultSchema },
|
|
472
|
+
required: ["values"],
|
|
473
|
+
additionalProperties: false
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function scalarSchema(schema) {
|
|
477
|
+
const type = schema && (Array.isArray(schema.type) ? schema.type[0] : schema.type);
|
|
478
|
+
return !!schema && ["string", "integer", "number", "boolean"].includes(type ?? "");
|
|
479
|
+
}
|
|
480
|
+
function visualPublicationCompatible(execution) {
|
|
481
|
+
if (execution.responseProcessing.kind === "JAVASCRIPT") return true;
|
|
482
|
+
const processing = execution.responseProcessing;
|
|
483
|
+
const schema = execution.resultSchema;
|
|
484
|
+
if (processing.kind === "LIST" && (!schema.properties?.items || schema.properties.items.type !== "array" || !(schema.required ?? []).includes("items"))) return false;
|
|
485
|
+
const output = processing.kind === "OBJECT" ? schema : schema.properties?.items?.items;
|
|
486
|
+
if (!output || output.type !== "object" || !output.properties || output.additionalProperties !== false) return false;
|
|
487
|
+
const fields = processing.fields;
|
|
488
|
+
if (Object.keys(output.properties).some((name) => !Object.hasOwn(fields, name) || !scalarSchema(output.properties[name]))) return false;
|
|
489
|
+
if (Object.keys(fields).some((name) => !Object.hasOwn(output.properties, name))) return false;
|
|
490
|
+
return (output.required ?? []).every((name) => !fields[name]?.omitIfMissing);
|
|
491
|
+
}
|
|
383
492
|
function at(schema, path) {
|
|
384
493
|
let current = schema;
|
|
385
494
|
for (const part of path.split(".")) current = current?.properties?.[part];
|
|
@@ -387,10 +496,9 @@ function at(schema, path) {
|
|
|
387
496
|
}
|
|
388
497
|
function validateDefinitionForPublication(raw, compiler) {
|
|
389
498
|
const definition = CommerceToolDefinitionSchema.parse(raw);
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
);
|
|
499
|
+
if (definition.execution.kind === "EXTERNAL_HTTP" && !visualPublicationCompatible(definition.execution))
|
|
500
|
+
throw new TypeError("External visual projection is incompatible with resultSchema");
|
|
501
|
+
const compiled = definition.execution.kind === "EXTERNAL_HTTP" ? { outputSchema: externalOutputSchema(definition.execution), validateMappedArguments: () => true } : compiler.compile(definition.execution, definition.inputSchema);
|
|
394
502
|
if (!compiled.validateMappedArguments(definition.execution))
|
|
395
503
|
throw new TypeError("Invalid variable/operation mapping");
|
|
396
504
|
const template = definition.responseTemplate;
|
|
@@ -415,12 +523,16 @@ function definitionToMcpDescriptor(definition) {
|
|
|
415
523
|
}
|
|
416
524
|
function mapToolArguments(definition, raw) {
|
|
417
525
|
const input = compileSubset(definition.inputSchema, "input").parse(raw);
|
|
418
|
-
const mapping = definition.execution.kind === "POLICY_OPERATION" ? definition.execution.arguments : definition.execution.variables;
|
|
526
|
+
const mapping = definition.execution.kind === "POLICY_OPERATION" ? definition.execution.arguments : definition.execution.kind === "SHOPIFY_STOREFRONT_QUERY" ? definition.execution.variables : definition.execution.query;
|
|
419
527
|
const result = /* @__PURE__ */ Object.create(null);
|
|
420
528
|
for (const [key, m] of Object.entries(mapping)) {
|
|
421
529
|
if ("literal" in m) result[key] = m.literal;
|
|
422
|
-
else if (Object.hasOwn(input, m.input))
|
|
423
|
-
|
|
530
|
+
else if (Object.hasOwn(input, m.input)) {
|
|
531
|
+
const value = input[m.input];
|
|
532
|
+
if (definition.execution.kind === "EXTERNAL_HTTP" && !ExternalQueryValueSchema.safeParse(value).success)
|
|
533
|
+
throw new TypeError("Invalid external mapped scalar");
|
|
534
|
+
result[key] = value;
|
|
535
|
+
} else if (!m.omitIfMissing) throw new TypeError("Missing mapped input");
|
|
424
536
|
}
|
|
425
537
|
return result;
|
|
426
538
|
}
|
|
@@ -446,12 +558,12 @@ function validateDefinitionVersion(proposed, highestPublished) {
|
|
|
446
558
|
SemverSchema.parse(highestPublished);
|
|
447
559
|
return gt(proposed, highestPublished);
|
|
448
560
|
}
|
|
449
|
-
var CommerceToolIdentitySchema =
|
|
561
|
+
var CommerceToolIdentitySchema = z4.strictObject({
|
|
450
562
|
id: IdSchema,
|
|
451
563
|
name: ToolNameSchema,
|
|
452
|
-
enabled:
|
|
564
|
+
enabled: z4.boolean()
|
|
453
565
|
});
|
|
454
|
-
var CommerceToolRevisionIdentitySchema =
|
|
566
|
+
var CommerceToolRevisionIdentitySchema = z4.strictObject({
|
|
455
567
|
toolId: IdSchema,
|
|
456
568
|
toolRevisionId: IdSchema,
|
|
457
569
|
definitionVersion: SemverSchema,
|
|
@@ -462,10 +574,10 @@ var POLICY_OPERATION_DESCRIPTORS = POLICY_OPERATIONS.map(
|
|
|
462
574
|
);
|
|
463
575
|
|
|
464
576
|
// src/commerce/response.ts
|
|
465
|
-
import { z as
|
|
466
|
-
var CommerceResponseContractSchema =
|
|
467
|
-
version:
|
|
468
|
-
instructions:
|
|
577
|
+
import { z as z5 } from "zod";
|
|
578
|
+
var CommerceResponseContractSchema = z5.strictObject({
|
|
579
|
+
version: z5.literal("response.v1"),
|
|
580
|
+
instructions: z5.string().min(1).max(8e3),
|
|
469
581
|
detailsSchema: DetailsSchemaSchema
|
|
470
582
|
}).refine((v) => jsonBytes(v) <= 32768);
|
|
471
583
|
var EMPTY_RESPONSE_CONTRACT = {
|
|
@@ -478,20 +590,20 @@ var EMPTY_RESPONSE_CONTRACT = {
|
|
|
478
590
|
additionalProperties: false
|
|
479
591
|
}
|
|
480
592
|
};
|
|
481
|
-
var ReferralReasonSchema =
|
|
593
|
+
var ReferralReasonSchema = z5.enum([
|
|
482
594
|
"INSUFFICIENT_TOOLS",
|
|
483
595
|
"UNVERIFIABLE_FACTS",
|
|
484
596
|
"TOOL_UNAVAILABLE",
|
|
485
597
|
"TOOL_REVOKED"
|
|
486
598
|
]);
|
|
487
|
-
var CommerceFinalResponseSchema =
|
|
488
|
-
answerKind:
|
|
489
|
-
replyText:
|
|
599
|
+
var CommerceFinalResponseSchema = z5.strictObject({
|
|
600
|
+
answerKind: z5.enum(["ANSWER", "REFER_TO_STORE"]),
|
|
601
|
+
replyText: z5.string().min(1).max(4096),
|
|
490
602
|
referralReason: ReferralReasonSchema.nullable(),
|
|
491
603
|
detectedLanguageTag: LanguageSchema.nullable(),
|
|
492
|
-
detectedLanguageConfidence:
|
|
493
|
-
evidenceIds:
|
|
494
|
-
details:
|
|
604
|
+
detectedLanguageConfidence: z5.number().min(0).max(1).nullable(),
|
|
605
|
+
evidenceIds: z5.array(IdSchema).max(3).refine((v) => new Set(v).size === v.length),
|
|
606
|
+
details: z5.record(z5.string(), z5.unknown()).refine((v) => {
|
|
495
607
|
try {
|
|
496
608
|
return jsonBytes(v) <= 16384;
|
|
497
609
|
} catch {
|
|
@@ -602,22 +714,22 @@ function finalResponseToolSchema(definition) {
|
|
|
602
714
|
}
|
|
603
715
|
|
|
604
716
|
// src/commerce/schemas.ts
|
|
605
|
-
import { z as
|
|
717
|
+
import { z as z6 } from "zod";
|
|
606
718
|
import { validRange } from "semver";
|
|
607
|
-
var CommerceTurnIdentitySchema =
|
|
719
|
+
var CommerceTurnIdentitySchema = z6.strictObject({
|
|
608
720
|
contractVersion: ContractVersionSchema,
|
|
609
721
|
shopId: IdSchema,
|
|
610
722
|
checkoutRecoveryId: IdSchema,
|
|
611
723
|
conversationId: IdSchema,
|
|
612
|
-
inboundVersion:
|
|
724
|
+
inboundVersion: z6.number().int().positive()
|
|
613
725
|
});
|
|
614
|
-
var CommerceConversationGrantSchema =
|
|
726
|
+
var CommerceConversationGrantSchema = z6.strictObject({
|
|
615
727
|
id: IdSchema,
|
|
616
728
|
shopId: IdSchema,
|
|
617
729
|
conversationId: IdSchema,
|
|
618
|
-
initialInboundVersion:
|
|
730
|
+
initialInboundVersion: z6.number().int().positive(),
|
|
619
731
|
releaseId: IdSchema,
|
|
620
|
-
selectedCapabilityKeys:
|
|
732
|
+
selectedCapabilityKeys: z6.array(IdSchema).min(1).max(32).refine((v) => distinct(v) && v.includes("conversation_core")),
|
|
621
733
|
grantedTools: GrantedToolsSchema,
|
|
622
734
|
runnerVersion: SemverSchema,
|
|
623
735
|
createdAt: DateSchema,
|
|
@@ -630,25 +742,25 @@ var CommerceConversationGrantSchema = z5.strictObject({
|
|
|
630
742
|
))
|
|
631
743
|
c.addIssue({ code: "custom", message: "Unselected grant provenance" });
|
|
632
744
|
});
|
|
633
|
-
var CommerceConfigurationSchema =
|
|
634
|
-
maxRecommendations:
|
|
635
|
-
maxSearchResults:
|
|
745
|
+
var CommerceConfigurationSchema = z6.strictObject({
|
|
746
|
+
maxRecommendations: z6.number().int().min(1).max(3).optional(),
|
|
747
|
+
maxSearchResults: z6.number().int().min(1).max(20).optional()
|
|
636
748
|
});
|
|
637
|
-
var CommerceManifestSchema =
|
|
749
|
+
var CommerceManifestSchema = z6.strictObject({
|
|
638
750
|
contractVersion: ContractVersionSchema,
|
|
639
751
|
releaseId: IdSchema,
|
|
640
|
-
runnerCompatibility:
|
|
641
|
-
capabilities:
|
|
642
|
-
|
|
752
|
+
runnerCompatibility: z6.string().min(1).max(128).refine((v) => !!validRange(v)),
|
|
753
|
+
capabilities: z6.array(
|
|
754
|
+
z6.strictObject({
|
|
643
755
|
key: IdSchema,
|
|
644
756
|
revisionId: IdSchema,
|
|
645
|
-
position:
|
|
646
|
-
promptName:
|
|
757
|
+
position: z6.number().int().nonnegative(),
|
|
758
|
+
promptName: z6.string().min(1).max(512),
|
|
647
759
|
configuration: CommerceConfigurationSchema,
|
|
648
|
-
toolDescriptors:
|
|
760
|
+
toolDescriptors: z6.array(ToolDescriptorSchema).max(32)
|
|
649
761
|
})
|
|
650
762
|
).min(1).max(32),
|
|
651
|
-
selectedCapabilityKeys:
|
|
763
|
+
selectedCapabilityKeys: z6.array(IdSchema).min(1).max(32).refine(distinct),
|
|
652
764
|
grantedTools: GrantedToolsSchema,
|
|
653
765
|
responseContract: CommerceResponseContractSchema,
|
|
654
766
|
responseContractHash: HashSchema
|
|
@@ -699,32 +811,32 @@ var CommerceManifestSchema = z5.strictObject({
|
|
|
699
811
|
message: "Grant must equal selected binding union"
|
|
700
812
|
});
|
|
701
813
|
});
|
|
702
|
-
var CommerceReleaseIdentitySchema =
|
|
814
|
+
var CommerceReleaseIdentitySchema = z6.strictObject({
|
|
703
815
|
contractVersion: ContractVersionSchema,
|
|
704
816
|
releaseId: IdSchema,
|
|
705
|
-
runnerCompatibility:
|
|
817
|
+
runnerCompatibility: z6.string().min(1).max(128).refine((v) => !!validRange(v))
|
|
706
818
|
});
|
|
707
819
|
var CommerceResolveAssertionSchema = CommerceTurnIdentitySchema.extend(
|
|
708
|
-
{ purpose:
|
|
820
|
+
{ purpose: z6.literal("resolve") }
|
|
709
821
|
);
|
|
710
822
|
var CommerceExecuteAssertionSchema = CommerceTurnIdentitySchema.extend(
|
|
711
|
-
{ purpose:
|
|
823
|
+
{ purpose: z6.literal("execute"), grantId: IdSchema, releaseId: IdSchema }
|
|
712
824
|
);
|
|
713
|
-
var CommerceAssertionSchema =
|
|
825
|
+
var CommerceAssertionSchema = z6.discriminatedUnion("purpose", [
|
|
714
826
|
CommerceResolveAssertionSchema,
|
|
715
827
|
CommerceExecuteAssertionSchema
|
|
716
828
|
]);
|
|
717
|
-
var qty =
|
|
718
|
-
var CommerceProposalSchema =
|
|
719
|
-
operations:
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
kind:
|
|
829
|
+
var qty = z6.number().int().min(1).max(999);
|
|
830
|
+
var CommerceProposalSchema = z6.strictObject({
|
|
831
|
+
operations: z6.array(
|
|
832
|
+
z6.discriminatedUnion("kind", [
|
|
833
|
+
z6.strictObject({
|
|
834
|
+
kind: z6.literal("ADD"),
|
|
723
835
|
variantId: IdSchema,
|
|
724
836
|
quantity: qty
|
|
725
837
|
}),
|
|
726
|
-
|
|
727
|
-
kind:
|
|
838
|
+
z6.strictObject({
|
|
839
|
+
kind: z6.literal("REPLACE"),
|
|
728
840
|
lineId: IdSchema,
|
|
729
841
|
variantId: IdSchema,
|
|
730
842
|
quantity: qty
|
|
@@ -736,13 +848,13 @@ var CommerceProposalSchema = z5.strictObject({
|
|
|
736
848
|
v.operations.flatMap((o) => o.kind === "REPLACE" ? [o.lineId] : [])
|
|
737
849
|
)
|
|
738
850
|
);
|
|
739
|
-
var CommerceBasketSchema =
|
|
851
|
+
var CommerceBasketSchema = z6.strictObject({
|
|
740
852
|
basketId: IdSchema,
|
|
741
|
-
source:
|
|
853
|
+
source: z6.enum(["RECOVERY_SNAPSHOT", "PROPOSED"]),
|
|
742
854
|
observedAt: DateSchema,
|
|
743
855
|
currency: CurrencySchema.nullable(),
|
|
744
|
-
lines:
|
|
745
|
-
|
|
856
|
+
lines: z6.array(
|
|
857
|
+
z6.strictObject({
|
|
746
858
|
lineId: IdSchema,
|
|
747
859
|
productId: IdSchema.nullable(),
|
|
748
860
|
variantId: IdSchema.nullable(),
|
|
@@ -751,40 +863,40 @@ var CommerceBasketSchema = z5.strictObject({
|
|
|
751
863
|
})
|
|
752
864
|
).max(100),
|
|
753
865
|
fingerprint: HashSchema,
|
|
754
|
-
unknownFields:
|
|
866
|
+
unknownFields: z6.array(z6.string().min(1).max(256)).max(128)
|
|
755
867
|
}).refine((v) => distinct(v.lines.map((line) => line.lineId)));
|
|
756
|
-
var CommerceProductSchema =
|
|
868
|
+
var CommerceProductSchema = z6.strictObject({
|
|
757
869
|
productId: IdSchema,
|
|
758
870
|
variantId: IdSchema,
|
|
759
|
-
title:
|
|
760
|
-
url:
|
|
871
|
+
title: z6.string().min(1).max(512),
|
|
872
|
+
url: z6.url({ protocol: /^https$/ }).refine((v) => {
|
|
761
873
|
const u = new URL(v);
|
|
762
874
|
return !u.username && !u.password && !u.port;
|
|
763
875
|
}).nullable(),
|
|
764
|
-
available:
|
|
876
|
+
available: z6.boolean().nullable(),
|
|
765
877
|
unitPrice: MoneySchema.nullable(),
|
|
766
878
|
currency: CurrencySchema.nullable(),
|
|
767
|
-
productType:
|
|
768
|
-
vendor:
|
|
879
|
+
productType: z6.string().max(512).nullable(),
|
|
880
|
+
vendor: z6.string().max(512).nullable(),
|
|
769
881
|
observedAt: DateSchema
|
|
770
882
|
});
|
|
771
|
-
var CommerceOfferSchema =
|
|
883
|
+
var CommerceOfferSchema = z6.strictObject({
|
|
772
884
|
offerId: IdSchema,
|
|
773
|
-
title:
|
|
774
|
-
method:
|
|
775
|
-
code:
|
|
885
|
+
title: z6.string().min(1).max(512),
|
|
886
|
+
method: z6.enum(["AUTOMATIC", "CODE"]),
|
|
887
|
+
code: z6.string().min(1).max(128).nullable(),
|
|
776
888
|
startsAt: DateSchema.nullable(),
|
|
777
889
|
endsAt: DateSchema.nullable(),
|
|
778
|
-
support:
|
|
779
|
-
reasonCodes:
|
|
890
|
+
support: z6.enum(["SUPPORTED", "UNSUPPORTED", "UNKNOWN"]),
|
|
891
|
+
reasonCodes: z6.array(z6.string().min(1).max(64)).max(16)
|
|
780
892
|
}).refine(
|
|
781
893
|
(v) => (v.startsAt === null || v.endsAt === null || Date.parse(v.startsAt) < Date.parse(v.endsAt)) && (v.method !== "AUTOMATIC" || v.code === null)
|
|
782
894
|
);
|
|
783
|
-
var condition =
|
|
784
|
-
code:
|
|
785
|
-
description:
|
|
895
|
+
var condition = z6.strictObject({
|
|
896
|
+
code: z6.string().min(1).max(64),
|
|
897
|
+
description: z6.string().max(256)
|
|
786
898
|
});
|
|
787
|
-
var CommerceEvidenceSchema =
|
|
899
|
+
var CommerceEvidenceSchema = z6.strictObject({
|
|
788
900
|
evidenceId: HashSchema,
|
|
789
901
|
turn: CommerceTurnIdentitySchema,
|
|
790
902
|
grantId: IdSchema,
|
|
@@ -795,7 +907,7 @@ var CommerceEvidenceSchema = z5.strictObject({
|
|
|
795
907
|
ruleFingerprint: HashSchema,
|
|
796
908
|
evaluatedAt: DateSchema,
|
|
797
909
|
expiresAt: DateSchema,
|
|
798
|
-
outcome:
|
|
910
|
+
outcome: z6.enum([
|
|
799
911
|
"QUALIFIES_FOR_KNOWN_RULES",
|
|
800
912
|
"DOES_NOT_QUALIFY",
|
|
801
913
|
"UNKNOWN",
|
|
@@ -804,8 +916,8 @@ var CommerceEvidenceSchema = z5.strictObject({
|
|
|
804
916
|
currency: CurrencySchema.nullable(),
|
|
805
917
|
savings: MoneySchema.nullable(),
|
|
806
918
|
resultingTotal: MoneySchema.nullable(),
|
|
807
|
-
evaluatedConditions:
|
|
808
|
-
unresolvedConditions:
|
|
919
|
+
evaluatedConditions: z6.array(condition).max(32),
|
|
920
|
+
unresolvedConditions: z6.array(condition).max(32)
|
|
809
921
|
}).superRefine((v, c) => {
|
|
810
922
|
if (Date.parse(v.expiresAt) - Date.parse(v.evaluatedAt) > 6e4)
|
|
811
923
|
c.addIssue({
|
|
@@ -815,16 +927,16 @@ var CommerceEvidenceSchema = z5.strictObject({
|
|
|
815
927
|
if (v.outcome === "QUALIFIES_FOR_KNOWN_RULES" && (v.unresolvedConditions.length || Date.parse(v.expiresAt) <= Date.parse(v.evaluatedAt) || v.currency === null || v.savings === null || v.resultingTotal === null))
|
|
816
928
|
c.addIssue({ code: "custom", message: "Unsupported qualifying claim" });
|
|
817
929
|
});
|
|
818
|
-
var CommerceAlternativeSchema =
|
|
930
|
+
var CommerceAlternativeSchema = z6.strictObject({
|
|
819
931
|
product: CommerceProductSchema,
|
|
820
932
|
proposal: CommerceProposalSchema,
|
|
821
933
|
extraSpend: MoneySchema.nullable(),
|
|
822
934
|
resultingTotal: MoneySchema.nullable(),
|
|
823
935
|
currency: CurrencySchema.nullable(),
|
|
824
936
|
evidence: CommerceEvidenceSchema.nullable(),
|
|
825
|
-
similarityReasons:
|
|
937
|
+
similarityReasons: z6.array(z6.string().max(256)).max(3)
|
|
826
938
|
}).refine((v) => v.product.available === true);
|
|
827
|
-
var CommerceErrorCodeSchema =
|
|
939
|
+
var CommerceErrorCodeSchema = z6.enum([
|
|
828
940
|
"INVALID_INPUT",
|
|
829
941
|
"DENIED",
|
|
830
942
|
"STALE_TURN",
|
|
@@ -835,66 +947,66 @@ var CommerceErrorCodeSchema = z5.enum([
|
|
|
835
947
|
"INCOMPATIBLE_VERSION"
|
|
836
948
|
]);
|
|
837
949
|
function commerceToolResultSchema(data) {
|
|
838
|
-
return
|
|
839
|
-
|
|
950
|
+
return z6.union([
|
|
951
|
+
z6.strictObject({
|
|
840
952
|
contractVersion: ContractVersionSchema,
|
|
841
|
-
status:
|
|
953
|
+
status: z6.literal("OK"),
|
|
842
954
|
data,
|
|
843
|
-
renderedText:
|
|
955
|
+
renderedText: z6.string().max(4096)
|
|
844
956
|
}),
|
|
845
|
-
|
|
957
|
+
z6.strictObject({
|
|
846
958
|
contractVersion: ContractVersionSchema,
|
|
847
|
-
status:
|
|
959
|
+
status: z6.literal("ERROR"),
|
|
848
960
|
code: CommerceErrorCodeSchema,
|
|
849
|
-
retryable:
|
|
850
|
-
renderedText:
|
|
961
|
+
retryable: z6.boolean(),
|
|
962
|
+
renderedText: z6.string().max(4096).optional()
|
|
851
963
|
})
|
|
852
964
|
]);
|
|
853
965
|
}
|
|
854
966
|
var CommerceToolResultSchema = commerceToolResultSchema(
|
|
855
967
|
boundedJson(262144)
|
|
856
968
|
);
|
|
857
|
-
var limit =
|
|
969
|
+
var limit = z6.number().int().min(1).max(3).default(3);
|
|
858
970
|
var CommerceToolInputs = {
|
|
859
|
-
commerce_get_basket:
|
|
860
|
-
commerce_search_products:
|
|
861
|
-
query:
|
|
971
|
+
commerce_get_basket: z6.strictObject({}),
|
|
972
|
+
commerce_search_products: z6.strictObject({
|
|
973
|
+
query: z6.string().min(1).max(200),
|
|
862
974
|
maximumPrice: MoneySchema.optional(),
|
|
863
|
-
availableOnly:
|
|
864
|
-
limit:
|
|
865
|
-
cursor:
|
|
975
|
+
availableOnly: z6.boolean().default(true),
|
|
976
|
+
limit: z6.number().int().min(1).max(20).default(10),
|
|
977
|
+
cursor: z6.string().max(2048).nullable().default(null)
|
|
866
978
|
}),
|
|
867
|
-
commerce_get_discount_options:
|
|
868
|
-
commerce_evaluate_discount:
|
|
979
|
+
commerce_get_discount_options: z6.strictObject({}),
|
|
980
|
+
commerce_evaluate_discount: z6.strictObject({
|
|
869
981
|
offerId: IdSchema,
|
|
870
982
|
proposal: CommerceProposalSchema.nullable()
|
|
871
983
|
}),
|
|
872
|
-
commerce_find_qualifying_products:
|
|
984
|
+
commerce_find_qualifying_products: z6.strictObject({
|
|
873
985
|
offerId: IdSchema,
|
|
874
|
-
query:
|
|
986
|
+
query: z6.string().min(1).max(200).nullable(),
|
|
875
987
|
limit
|
|
876
988
|
}),
|
|
877
|
-
commerce_find_similar_products:
|
|
989
|
+
commerce_find_similar_products: z6.strictObject({
|
|
878
990
|
variantId: IdSchema,
|
|
879
991
|
offerId: IdSchema.nullable(),
|
|
880
992
|
limit
|
|
881
993
|
})
|
|
882
994
|
};
|
|
883
|
-
var alternatives =
|
|
884
|
-
alternatives:
|
|
885
|
-
truncated:
|
|
995
|
+
var alternatives = z6.strictObject({
|
|
996
|
+
alternatives: z6.array(CommerceAlternativeSchema).max(3),
|
|
997
|
+
truncated: z6.boolean()
|
|
886
998
|
});
|
|
887
999
|
var CommerceToolOutputs = {
|
|
888
1000
|
commerce_get_basket: CommerceBasketSchema,
|
|
889
|
-
commerce_search_products:
|
|
890
|
-
products:
|
|
891
|
-
cursor:
|
|
892
|
-
truncated:
|
|
1001
|
+
commerce_search_products: z6.strictObject({
|
|
1002
|
+
products: z6.array(CommerceProductSchema).max(20),
|
|
1003
|
+
cursor: z6.string().max(2048).nullable(),
|
|
1004
|
+
truncated: z6.boolean()
|
|
893
1005
|
}),
|
|
894
|
-
commerce_get_discount_options:
|
|
895
|
-
mode:
|
|
896
|
-
offers:
|
|
897
|
-
truncated:
|
|
1006
|
+
commerce_get_discount_options: z6.strictObject({
|
|
1007
|
+
mode: z6.enum(["NONE", "FIXED", "AI_BEST_APPLICABLE"]),
|
|
1008
|
+
offers: z6.array(CommerceOfferSchema).max(50),
|
|
1009
|
+
truncated: z6.boolean()
|
|
898
1010
|
}),
|
|
899
1011
|
commerce_evaluate_discount: CommerceEvidenceSchema,
|
|
900
1012
|
commerce_find_qualifying_products: alternatives,
|
|
@@ -909,20 +1021,20 @@ function productBelongsToDomain(product, verifiedDomain) {
|
|
|
909
1021
|
}
|
|
910
1022
|
|
|
911
1023
|
// src/commerce/selection.ts
|
|
912
|
-
import { z as
|
|
913
|
-
var CommerceCapabilityBindingSchema =
|
|
914
|
-
|
|
915
|
-
kind:
|
|
916
|
-
key:
|
|
1024
|
+
import { z as z7 } from "zod";
|
|
1025
|
+
var CommerceCapabilityBindingSchema = z7.discriminatedUnion("kind", [
|
|
1026
|
+
z7.strictObject({
|
|
1027
|
+
kind: z7.literal("BASE"),
|
|
1028
|
+
key: z7.literal("conversation_core")
|
|
917
1029
|
}),
|
|
918
|
-
|
|
919
|
-
kind:
|
|
1030
|
+
z7.strictObject({
|
|
1031
|
+
kind: z7.literal("FEATURE"),
|
|
920
1032
|
key: IdSchema,
|
|
921
1033
|
featureId: IdSchema
|
|
922
1034
|
}),
|
|
923
|
-
|
|
924
|
-
kind:
|
|
925
|
-
key:
|
|
1035
|
+
z7.strictObject({
|
|
1036
|
+
kind: z7.literal("RECOVERY_POLICY"),
|
|
1037
|
+
key: z7.literal("discount_assistance")
|
|
926
1038
|
})
|
|
927
1039
|
]);
|
|
928
1040
|
function selectCapabilities(candidates, facts) {
|
|
@@ -1009,6 +1121,25 @@ export {
|
|
|
1009
1121
|
LanguageSchema,
|
|
1010
1122
|
distinct,
|
|
1011
1123
|
boundedJson,
|
|
1124
|
+
ExternalQueryValueSchema,
|
|
1125
|
+
ExternalQueryMappingSchema,
|
|
1126
|
+
ExternalQueryMappingsSchema,
|
|
1127
|
+
ExternalPathSchema,
|
|
1128
|
+
ExternalResponseFormatSchema,
|
|
1129
|
+
FieldProjectionSchema,
|
|
1130
|
+
ResponseFilterSchema,
|
|
1131
|
+
VisualResponseProcessingSchema,
|
|
1132
|
+
ResponseProcessingSchema,
|
|
1133
|
+
TransformResponseSchema,
|
|
1134
|
+
TransformSampleSchema,
|
|
1135
|
+
ExternalHttpResultDataSchema,
|
|
1136
|
+
ConnectionRevisionViewSchema,
|
|
1137
|
+
ConnectionViewSchema,
|
|
1138
|
+
CredentialStatusSchema,
|
|
1139
|
+
ConnectionCommandSchema,
|
|
1140
|
+
RevisionInputSchema,
|
|
1141
|
+
ConnectionIssueSchema,
|
|
1142
|
+
ConnectionResultSchema,
|
|
1012
1143
|
ToolNameSchema,
|
|
1013
1144
|
ToolBindingSchema,
|
|
1014
1145
|
ToolBindingsSchema,
|
|
@@ -1016,6 +1147,7 @@ export {
|
|
|
1016
1147
|
GrantedToolsSchema,
|
|
1017
1148
|
ToolDescriptorSchema,
|
|
1018
1149
|
POLICY_OPERATIONS,
|
|
1150
|
+
ExternalHttpExecutionSchema,
|
|
1019
1151
|
CommerceExecutionSchema,
|
|
1020
1152
|
ResponseTemplateSchema,
|
|
1021
1153
|
CommerceToolDefinitionSchema,
|
|
@@ -1063,4 +1195,4 @@ export {
|
|
|
1063
1195
|
parseCommerceManifest,
|
|
1064
1196
|
currentlyGrantedTools
|
|
1065
1197
|
};
|
|
1066
|
-
//# sourceMappingURL=chunk-
|
|
1198
|
+
//# sourceMappingURL=chunk-WVQWQFVR.js.map
|