linkque-cli-v2 1.2.9 → 1.3.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/worker.js CHANGED
@@ -8689,9 +8689,6 @@ function validateAst(ast) {
8689
8689
  if (!ALLOWED_AST_TYPES.has(value.type)) {
8690
8690
  throw new StructuralExpressionError("STRUCTURAL_EXPRESSION_NODE_FORBIDDEN", `JMESPath node ${value.type} is not allowed`);
8691
8691
  }
8692
- if (value.type === "Index" && (typeof value.value !== "number" || !Number.isSafeInteger(value.value) || value.value < 0)) {
8693
- throw new StructuralExpressionError("STRUCTURAL_EXPRESSION_INVALID", "array index must be a non-negative safe integer");
8694
- }
8695
8692
  if (value.type === "Function" && value.name !== "not_null") {
8696
8693
  throw new StructuralExpressionError("STRUCTURAL_EXPRESSION_FUNCTION_FORBIDDEN", `JMESPath function ${String(value.name)} is not allowed`);
8697
8694
  }
@@ -8717,8 +8714,6 @@ var init_structural = __esm({
8717
8714
  "Field",
8718
8715
  "Function",
8719
8716
  "Identity",
8720
- "Index",
8721
- "IndexExpression",
8722
8717
  "KeyValuePair",
8723
8718
  "Literal",
8724
8719
  "MultiSelectHash",
@@ -9296,9 +9291,6 @@ function validateAst2(ast) {
9296
9291
  if (!ALLOWED_AST_TYPES2.has(value.type)) {
9297
9292
  throw new A2UICardExpressionError("CARD_EXPRESSION_NODE_FORBIDDEN", `JMESPath node ${value.type} is not allowed by ${A2UI_CARD_TRANSFORM_PROFILE}`);
9298
9293
  }
9299
- if (value.type === "Index" && (typeof value.value !== "number" || !Number.isSafeInteger(value.value) || value.value < 0)) {
9300
- throw new A2UICardExpressionError("CARD_EXPRESSION_INVALID", "array index must be a non-negative safe integer");
9301
- }
9302
9294
  if (value.type === "Function" && value.name !== "not_null") {
9303
9295
  throw new A2UICardExpressionError("CARD_EXPRESSION_FUNCTION_FORBIDDEN", `JMESPath function ${String(value.name)} is not allowed`);
9304
9296
  }
@@ -9323,8 +9315,6 @@ var init_expression = __esm({
9323
9315
  "Field",
9324
9316
  "Function",
9325
9317
  "Identity",
9326
- "Index",
9327
- "IndexExpression",
9328
9318
  "KeyValuePair",
9329
9319
  "Literal",
9330
9320
  "MultiSelectHash",
@@ -9756,6 +9746,8 @@ function validateComponents(payload, path6, surfaces, issues) {
9756
9746
  if (value !== void 0)
9757
9747
  validateProperty(value, property, `${componentPath}.${name}`, issues, name);
9758
9748
  }
9749
+ if (component.component === "Tag" && component.icon === void 0 && component.gap !== void 0)
9750
+ issues.push(issue2(`${componentPath}.gap`, "TAG_GAP_REQUIRES_ICON", "Tag.gap requires Tag.icon"));
9759
9751
  if (component["x2-overflow"] !== void 0)
9760
9752
  validateOverflow(component, componentPath, issues);
9761
9753
  if (component.component === "TextField")
@@ -9769,7 +9761,7 @@ function validateComponents(payload, path6, surfaces, issues) {
9769
9761
  validateStepper(component, componentPath, issues);
9770
9762
  if (component.checks !== void 0)
9771
9763
  validateChecks(component.checks, `${componentPath}.checks`, issues);
9772
- if (component.format !== void 0 && component.component === "Text")
9764
+ if (component.format !== void 0 && (component.component === "Text" || component.component === "Tag"))
9773
9765
  validateNumberFormat(component.format, `${componentPath}.format`, issues);
9774
9766
  if (component.action !== void 0)
9775
9767
  validateAction(component.action, `${componentPath}.action`, issues, 0);
@@ -9783,11 +9775,6 @@ function validateProperty(value, schema, path6, issues, propertyName) {
9783
9775
  issues.push(issue2(path6, "INVALID_DISPLAY_VALUE", `display value must be ${stringOnly ? "a string" : "a string or finite number"}, or a compatible display binding`));
9784
9776
  return;
9785
9777
  }
9786
- if (schema.kind === "child") {
9787
- if (!isSafeIdentifier(value))
9788
- issues.push(issue2(path6, "INVALID_CHILD", "child must be a safe component id"));
9789
- return;
9790
- }
9791
9778
  if (schema.kind === "children") {
9792
9779
  const valid = Array.isArray(value) ? value.every(isSafeIdentifier) : isPlainRecord(value) && Object.keys(value).length === 2 && isSafeIdentifier(value.componentId) && typeof value.path === "string" && isSafePath(value.path);
9793
9780
  if (!valid)
@@ -10028,27 +10015,20 @@ function validateReferences(surfaces, path6, issues) {
10028
10015
  issues.push(issue2(`${path6}.surfaces.${surfaceId}`, "MISSING_ROOT_COMPONENT", "surface must define root"));
10029
10016
  const edges = /* @__PURE__ */ new Map();
10030
10017
  for (const [id, component] of components) {
10031
- const refs = getComponentReferences(component);
10018
+ const children = component.children;
10019
+ const refs = Array.isArray(children) ? children.filter((entry) => typeof entry === "string") : isPlainRecord(children) && typeof children.componentId === "string" ? [children.componentId] : [];
10032
10020
  edges.set(id, refs);
10033
10021
  refs.forEach((ref) => {
10034
10022
  if (!components.has(ref))
10035
- issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.${component.child !== void 0 ? "child" : "children"}`, "MISSING_COMPONENT_REFERENCE", `component ${ref} does not exist`));
10023
+ issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.children`, "MISSING_COMPONENT_REFERENCE", `component ${ref} does not exist`));
10036
10024
  });
10037
10025
  if ((component.component === "Button" || component.component === "Card" && component.action !== void 0) && refs.some((ref) => hasInteractiveDescendant(ref, components, /* @__PURE__ */ new Set())))
10038
- issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.${component.child !== void 0 ? "child" : "children"}`, "NESTED_INTERACTION", "action components cannot contain interactive descendants"));
10026
+ issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.children`, "NESTED_INTERACTION", "action components cannot contain interactive descendants"));
10039
10027
  collectSurfaceOpenReferences(component.action).forEach((targetSurfaceId) => {
10040
10028
  if (!surfaces.has(targetSurfaceId))
10041
10029
  issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.action`, "MISSING_SURFACE_REFERENCE", `surface ${targetSurfaceId} does not exist`));
10042
10030
  });
10043
10031
  }
10044
- components.forEach((component, id) => {
10045
- if (component.grow === void 0)
10046
- return;
10047
- const parents = [...components.values()].filter((parent) => getComponentReferences(parent).includes(id));
10048
- if (id === "root" || parents.length === 0 || parents.some((parent) => parent.component !== "Row" && parent.component !== "Column")) {
10049
- issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.grow`, "INVALID_LAYOUT_PARENT", "grow requires a direct Row or Column parent in every occurrence"));
10050
- }
10051
- });
10052
10032
  const visiting = /* @__PURE__ */ new Set();
10053
10033
  const visited2 = /* @__PURE__ */ new Set();
10054
10034
  const walk = (id) => {
@@ -10079,14 +10059,6 @@ function collectSurfaceOpenReferences(value, result = /* @__PURE__ */ new Set())
10079
10059
  }
10080
10060
  return result;
10081
10061
  }
10082
- function getComponentReferences(component) {
10083
- if (typeof component.child === "string")
10084
- return [component.child];
10085
- const children = component.children;
10086
- if (Array.isArray(children))
10087
- return children.filter((entry) => typeof entry === "string");
10088
- return isPlainRecord(children) && typeof children.componentId === "string" ? [children.componentId] : [];
10089
- }
10090
10062
  function hasInteractiveDescendant(id, components, visited2) {
10091
10063
  if (visited2.has(id))
10092
10064
  return false;
@@ -10096,20 +10068,22 @@ function hasInteractiveDescendant(id, components, visited2) {
10096
10068
  return false;
10097
10069
  if (component.component === "Button" || component.action !== void 0 || ["TextField", "ChoicePicker", "Stepper"].includes(String(component.component)))
10098
10070
  return true;
10099
- const refs = getComponentReferences(component);
10071
+ const children = component.children;
10072
+ const refs = Array.isArray(children) ? children : isPlainRecord(children) ? [children.componentId] : [];
10100
10073
  return refs.some((ref) => typeof ref === "string" && hasInteractiveDescendant(ref, components, visited2));
10101
10074
  }
10102
- var spacing, colors, iconNames, layoutItem, width, radius, decoration, typography, container, _listJustify, listContainer, A2UI_V4_COMPONENT_CATALOG;
10075
+ var spacing, colors, iconNames, box, typography, container, A2UI_V4_COMPONENT_CATALOG;
10103
10076
  var init_v4Catalog = __esm({
10104
10077
  "../agent-a2ui-card-contract/dist/esm/v4Catalog.js"() {
10105
10078
  "use strict";
10106
- init_json2();
10107
10079
  init_protocol();
10080
+ init_json2();
10108
10081
  spacing = ["none", "xs", "sm", "md", "lg"];
10109
10082
  colors = [
10110
10083
  "default",
10111
10084
  "muted",
10112
10085
  "primary",
10086
+ "accent",
10113
10087
  "success",
10114
10088
  "warning",
10115
10089
  "error",
@@ -10161,18 +10135,8 @@ var init_v4Catalog = __esm({
10161
10135
  "warning",
10162
10136
  "arrow-right-long"
10163
10137
  ];
10164
- layoutItem = {
10165
- grow: {
10166
- kind: "number",
10167
- values: [0, 1, 2, 3, 4],
10168
- parentComponents: ["Row", "Column"]
10169
- }
10170
- };
10171
- width = { width: { kind: "string", values: ["fit", "fill"] } };
10172
- radius = {
10173
- radius: { kind: "string", values: ["none", "xs", "sm", "md", "full"] }
10174
- };
10175
- decoration = {
10138
+ box = {
10139
+ margin: { kind: "string", values: spacing },
10176
10140
  padding: { kind: "string", values: spacing },
10177
10141
  background: {
10178
10142
  kind: "string",
@@ -10190,17 +10154,29 @@ var init_v4Catalog = __esm({
10190
10154
  kind: "string",
10191
10155
  values: ["none", "subtle", "card-border", "primary"]
10192
10156
  },
10193
- ...radius
10157
+ radius: { kind: "string", values: ["none", "xs", "sm", "md", "full"] },
10158
+ width: { kind: "string", values: ["fit", "fill"] },
10159
+ grow: { kind: "number", values: [0, 1, 2, 3, 4] },
10160
+ shrink: { kind: "boolean" }
10194
10161
  };
10195
10162
  typography = {
10196
10163
  color: { kind: "string", values: colors },
10197
- fontSize: { kind: "string", values: ["xs", "sm", "md", "lg", "xl", "xxl"] },
10164
+ fontSize: {
10165
+ kind: "string",
10166
+ values: [
10167
+ "small",
10168
+ "medium",
10169
+ "large",
10170
+ "striking",
10171
+ "display",
10172
+ "badge",
10173
+ "merchant"
10174
+ ]
10175
+ },
10198
10176
  fontWeight: { kind: "string", values: ["normal", "semibold", "bold"] }
10199
10177
  };
10200
10178
  container = {
10201
- ...layoutItem,
10202
- ...width,
10203
- padding: { kind: "string", values: spacing },
10179
+ ...box,
10204
10180
  children: { kind: "children", required: true },
10205
10181
  gap: { kind: "string", values: spacing },
10206
10182
  align: {
@@ -10220,7 +10196,6 @@ var init_v4Catalog = __esm({
10220
10196
  },
10221
10197
  "x2-overflow": { kind: "format" }
10222
10198
  };
10223
- ({ justify: _listJustify, ...listContainer } = container);
10224
10199
  A2UI_V4_COMPONENT_CATALOG = Object.freeze({
10225
10200
  catalogId: LINKQUE_A2UI_V4_CATALOG_ID,
10226
10201
  protocolVersion: "0.9",
@@ -10228,10 +10203,7 @@ var init_v4Catalog = __esm({
10228
10203
  Card: {
10229
10204
  interaction: "action",
10230
10205
  properties: {
10231
- ...layoutItem,
10232
- ...width,
10233
- ...decoration,
10234
- child: { kind: "child", required: true },
10206
+ ...container,
10235
10207
  action: { kind: "action" },
10236
10208
  disabled: { kind: "boolean" }
10237
10209
  }
@@ -10241,14 +10213,13 @@ var init_v4Catalog = __esm({
10241
10213
  interaction: "none",
10242
10214
  properties: {
10243
10215
  ...container,
10244
- wrap: { kind: "string", values: ["wrap", "nowrap"] },
10245
- layout: { kind: "string", values: ["flex", "inline"] }
10216
+ wrap: { kind: "string", values: ["wrap", "nowrap"] }
10246
10217
  }
10247
10218
  },
10248
10219
  List: {
10249
10220
  interaction: "none",
10250
10221
  properties: {
10251
- ...listContainer,
10222
+ ...container,
10252
10223
  variant: {
10253
10224
  kind: "string",
10254
10225
  required: true,
@@ -10259,9 +10230,8 @@ var init_v4Catalog = __esm({
10259
10230
  Text: {
10260
10231
  interaction: "none",
10261
10232
  properties: {
10262
- ...layoutItem,
10233
+ ...box,
10263
10234
  ...typography,
10264
- shrink: { kind: "boolean" },
10265
10235
  text: { kind: "binding", required: true },
10266
10236
  maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
10267
10237
  decoration: { kind: "string", values: ["line-through"] },
@@ -10271,31 +10241,19 @@ var init_v4Catalog = __esm({
10271
10241
  Tag: {
10272
10242
  interaction: "none",
10273
10243
  properties: {
10274
- ...layoutItem,
10244
+ ...box,
10245
+ ...typography,
10275
10246
  text: { kind: "binding", required: true },
10276
10247
  icon: { kind: "string", values: iconNames },
10277
- tone: {
10278
- kind: "string",
10279
- values: [
10280
- "default",
10281
- "muted",
10282
- "primary",
10283
- "success",
10284
- "warning",
10285
- "error"
10286
- ]
10287
- },
10288
- variant: { kind: "string", values: ["soft", "outline", "plain"] },
10289
- size: { kind: "string", values: ["sm", "md"] },
10290
- shrink: { kind: "boolean" },
10291
- maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] }
10248
+ gap: { kind: "string", values: spacing },
10249
+ maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
10250
+ format: { kind: "format" }
10292
10251
  }
10293
10252
  },
10294
10253
  Button: {
10295
10254
  interaction: "action",
10296
10255
  properties: {
10297
- ...layoutItem,
10298
- ...width,
10256
+ ...box,
10299
10257
  label: { kind: "binding", required: true },
10300
10258
  action: { kind: "action", required: true },
10301
10259
  checks: { kind: "format" },
@@ -10313,29 +10271,34 @@ var init_v4Catalog = __esm({
10313
10271
  Image: {
10314
10272
  interaction: "none",
10315
10273
  properties: {
10316
- ...layoutItem,
10317
- ...radius,
10274
+ ...box,
10318
10275
  src: { kind: "binding", required: true },
10319
10276
  alt: { kind: "binding" },
10320
10277
  fit: {
10321
10278
  kind: "string",
10322
10279
  values: ["contain", "cover", "fill", "none", "scale-down"]
10323
10280
  },
10324
- aspectRatio: {
10325
- kind: "string",
10326
- values: ["square", "portrait", "landscape", "wide", "banner"]
10327
- },
10328
- height: { kind: "string", values: ["auto", "fill"] },
10329
- size: {
10281
+ variant: {
10330
10282
  kind: "string",
10331
- values: ["xs", "sm", "md", "lg", "xl", "full"]
10283
+ values: [
10284
+ "icon",
10285
+ "avatar",
10286
+ "merchantLogo",
10287
+ "smallFeature",
10288
+ "mediumFeature",
10289
+ "portraitFeature",
10290
+ "productThumbnail",
10291
+ "voucherThumbnail",
10292
+ "largeFeature",
10293
+ "header"
10294
+ ]
10332
10295
  }
10333
10296
  }
10334
10297
  },
10335
10298
  Icon: {
10336
10299
  interaction: "none",
10337
10300
  properties: {
10338
- ...layoutItem,
10301
+ ...box,
10339
10302
  name: { kind: "string", required: true, values: iconNames },
10340
10303
  label: { kind: "string" },
10341
10304
  color: { kind: "string", values: colors },
@@ -10348,15 +10311,15 @@ var init_v4Catalog = __esm({
10348
10311
  Divider: {
10349
10312
  interaction: "none",
10350
10313
  properties: {
10351
- ...layoutItem,
10314
+ ...box,
10352
10315
  axis: { kind: "string", values: ["horizontal", "vertical"] }
10353
10316
  }
10354
10317
  },
10355
10318
  TextField: {
10356
10319
  interaction: "input",
10357
10320
  properties: {
10358
- ...layoutItem,
10359
- ...width,
10321
+ ...box,
10322
+ ...typography,
10360
10323
  label: { kind: "string", required: true },
10361
10324
  value: { kind: "binding", required: true },
10362
10325
  checks: { kind: "format" },
@@ -10380,8 +10343,7 @@ var init_v4Catalog = __esm({
10380
10343
  ChoicePicker: {
10381
10344
  interaction: "input",
10382
10345
  properties: {
10383
- ...layoutItem,
10384
- ...width,
10346
+ ...box,
10385
10347
  label: { kind: "string", required: true },
10386
10348
  value: { kind: "binding", required: true },
10387
10349
  options: { kind: "options", required: true },
@@ -10396,8 +10358,7 @@ var init_v4Catalog = __esm({
10396
10358
  Stepper: {
10397
10359
  interaction: "input",
10398
10360
  properties: {
10399
- ...layoutItem,
10400
- ...width,
10361
+ ...box,
10401
10362
  label: { kind: "string", required: true },
10402
10363
  value: { kind: "binding", required: true },
10403
10364
  min: { kind: "number" },
@@ -32038,6 +31999,9 @@ function getConversationRunRequestIssues(value) {
32038
31999
  issues.push("attachments must be an array");
32039
32000
  } else {
32040
32001
  value.attachments.forEach((attachment, index2) => validateAttachment(attachment, index2, issues));
32002
+ if (value.attachments.length > 0 && (!Array.isArray(value.messages) || !value.messages.some((message) => isRecord3(message) && message.role === "user"))) {
32003
+ issues.push("non-empty attachments require at least one user message");
32004
+ }
32041
32005
  }
32042
32006
  if (!isRecord3(value.metadata))
32043
32007
  issues.push("metadata must be an object");
@@ -32178,6 +32142,9 @@ function validateAttachment(value, index2, issues) {
32178
32142
  if (value.size !== void 0 && (!Number.isSafeInteger(value.size) || Number(value.size) < 0)) {
32179
32143
  issues.push(`attachments[${index2}].size must be a non-negative safe integer when provided`);
32180
32144
  }
32145
+ if (value.availability !== void 0 && value.availability !== "resolvable" && value.availability !== "current_turn_only") {
32146
+ issues.push(`attachments[${index2}].availability must be resolvable or current_turn_only when provided`);
32147
+ }
32181
32148
  if (value.metadata !== void 0 && !isRecord3(value.metadata)) {
32182
32149
  issues.push(`attachments[${index2}].metadata must be an object when provided`);
32183
32150
  }
@@ -191712,7 +191679,8 @@ var init_io = __esm({
191712
191679
  "use strict";
191713
191680
  DEFAULT_IMAGE_URL_RULES = [
191714
191681
  { host: "mass.alipay.com", pathPrefix: "/linkque/afts/img/" },
191715
- { host: "masspre.alipay.com", pathPrefix: "/linkque/afts/img/" }
191682
+ { host: "masspre.alipay.com", pathPrefix: "/linkque/afts/img/" },
191683
+ { host: "mdn.alipayobjects.com", pathPrefix: "/linkque/afts/img/" }
191716
191684
  ];
191717
191685
  MAX_BYTES2 = 2 * 1024 * 1024;
191718
191686
  }