linkque-cli-v2 1.2.5 → 1.2.6

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
@@ -39,7 +39,6 @@ var init_types = __esm({
39
39
  "../linkque-agent-runtime/dist/esm/core/types.js"() {
40
40
  "use strict";
41
41
  (function(EDebugLogScope2) {
42
- EDebugLogScope2["A2UI_ACTION"] = "A2UI_ACTION";
43
42
  EDebugLogScope2["CONFIG"] = "CONFIG";
44
43
  EDebugLogScope2["LLM"] = "LLM";
45
44
  EDebugLogScope2["PI_EVENT"] = "PI_EVENT";
@@ -3318,6 +3317,7 @@ var require_utils = __commonJS({
3318
3317
  "use strict";
3319
3318
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3320
3319
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
3320
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
3321
3321
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3322
3322
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3323
3323
  var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
@@ -3783,8 +3783,12 @@ var require_utils = __commonJS({
3783
3783
  uriTokens.push(host);
3784
3784
  }
3785
3785
  if (typeof component.port === "number" || typeof component.port === "string") {
3786
+ const port = String(component.port);
3787
+ if (!isPort(port)) {
3788
+ throw new TypeError("URI port is malformed.");
3789
+ }
3786
3790
  uriTokens.push(":");
3787
- uriTokens.push(String(component.port));
3791
+ uriTokens.push(port);
3788
3792
  }
3789
3793
  return uriTokens.length ? uriTokens.join("") : void 0;
3790
3794
  }
@@ -4227,12 +4231,15 @@ var require_fast_uri = __commonJS({
4227
4231
  }
4228
4232
  return false;
4229
4233
  }
4234
+ function isIPLiteral(host) {
4235
+ return host[0] === "[" && host[host.length - 1] === "]";
4236
+ }
4230
4237
  function hasMalformedComponentPercentEncoding(matches) {
4231
4238
  const host = matches[4];
4232
- return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !(host[0] === "[" && host[host.length - 1] === "]") && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4239
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4233
4240
  }
4234
4241
  function canonicalizeHost(parsed, options, schemeHandler, isIP2) {
4235
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && parsed.host[0] !== "[" && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP2 === false && nonSimpleDomain(parsed.host)) {
4242
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP2 === false && nonSimpleDomain(parsed.host)) {
4236
4243
  try {
4237
4244
  parsed.host = new URL("http://" + parsed.host).hostname;
4238
4245
  } catch (e2) {
@@ -4319,10 +4326,11 @@ var require_fast_uri = __commonJS({
4319
4326
  if (parsed.host) {
4320
4327
  const ipv4result = isIPv4(parsed.host);
4321
4328
  if (ipv4result === false) {
4322
- const bracketedIPLiteral = parsed.host[0] === "[" && parsed.host[parsed.host.length - 1] === "]";
4329
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
4330
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
4323
4331
  const ipv6result = normalizeIPv6(parsed.host);
4324
4332
  isIP2 = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
4325
- malformedIPLiteral = bracketedIPLiteral && ipv6result.error === true;
4333
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4326
4334
  parsed.host = isIP2 ? ipv6result.host : ipv6result.host.toLowerCase();
4327
4335
  if (malformedIPLiteral) {
4328
4336
  parsed.error = parsed.error || "URI host is malformed.";
@@ -4345,7 +4353,9 @@ var require_fast_uri = __commonJS({
4345
4353
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
4346
4354
  }
4347
4355
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
4348
- malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP2);
4356
+ if (!malformedIPLiteral) {
4357
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP2);
4358
+ }
4349
4359
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4350
4360
  if (uri.indexOf("%") !== -1) {
4351
4361
  if (parsed.host !== void 0 && !malformedIPLiteral) {
@@ -9734,6 +9744,8 @@ function validateComponents(payload, path6, surfaces, issues) {
9734
9744
  if (value !== void 0)
9735
9745
  validateProperty(value, property, `${componentPath}.${name}`, issues, name);
9736
9746
  }
9747
+ if (component.component === "Tag" && component.icon === void 0 && component.gap !== void 0)
9748
+ issues.push(issue2(`${componentPath}.gap`, "TAG_GAP_REQUIRES_ICON", "Tag.gap requires Tag.icon"));
9737
9749
  if (component["x2-overflow"] !== void 0)
9738
9750
  validateOverflow(component, componentPath, issues);
9739
9751
  if (component.component === "TextField")
@@ -9747,7 +9759,7 @@ function validateComponents(payload, path6, surfaces, issues) {
9747
9759
  validateStepper(component, componentPath, issues);
9748
9760
  if (component.checks !== void 0)
9749
9761
  validateChecks(component.checks, `${componentPath}.checks`, issues);
9750
- if (component.format !== void 0 && component.component === "Text")
9762
+ if (component.format !== void 0 && (component.component === "Text" || component.component === "Tag"))
9751
9763
  validateNumberFormat(component.format, `${componentPath}.format`, issues);
9752
9764
  if (component.action !== void 0)
9753
9765
  validateAction(component.action, `${componentPath}.action`, issues, 0);
@@ -9761,11 +9773,6 @@ function validateProperty(value, schema, path6, issues, propertyName) {
9761
9773
  issues.push(issue2(path6, "INVALID_DISPLAY_VALUE", `display value must be ${stringOnly ? "a string" : "a string or finite number"}, or a compatible display binding`));
9762
9774
  return;
9763
9775
  }
9764
- if (schema.kind === "child") {
9765
- if (!isSafeIdentifier(value))
9766
- issues.push(issue2(path6, "INVALID_CHILD", "child must be a safe component id"));
9767
- return;
9768
- }
9769
9776
  if (schema.kind === "children") {
9770
9777
  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);
9771
9778
  if (!valid)
@@ -10006,27 +10013,20 @@ function validateReferences(surfaces, path6, issues) {
10006
10013
  issues.push(issue2(`${path6}.surfaces.${surfaceId}`, "MISSING_ROOT_COMPONENT", "surface must define root"));
10007
10014
  const edges = /* @__PURE__ */ new Map();
10008
10015
  for (const [id, component] of components) {
10009
- const refs = getComponentReferences(component);
10016
+ const children = component.children;
10017
+ const refs = Array.isArray(children) ? children.filter((entry) => typeof entry === "string") : isPlainRecord(children) && typeof children.componentId === "string" ? [children.componentId] : [];
10010
10018
  edges.set(id, refs);
10011
10019
  refs.forEach((ref) => {
10012
10020
  if (!components.has(ref))
10013
- issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.${component.child !== void 0 ? "child" : "children"}`, "MISSING_COMPONENT_REFERENCE", `component ${ref} does not exist`));
10021
+ issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.children`, "MISSING_COMPONENT_REFERENCE", `component ${ref} does not exist`));
10014
10022
  });
10015
10023
  if ((component.component === "Button" || component.component === "Card" && component.action !== void 0) && refs.some((ref) => hasInteractiveDescendant(ref, components, /* @__PURE__ */ new Set())))
10016
- issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.${component.child !== void 0 ? "child" : "children"}`, "NESTED_INTERACTION", "action components cannot contain interactive descendants"));
10024
+ issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.children`, "NESTED_INTERACTION", "action components cannot contain interactive descendants"));
10017
10025
  collectSurfaceOpenReferences(component.action).forEach((targetSurfaceId) => {
10018
10026
  if (!surfaces.has(targetSurfaceId))
10019
10027
  issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.action`, "MISSING_SURFACE_REFERENCE", `surface ${targetSurfaceId} does not exist`));
10020
10028
  });
10021
10029
  }
10022
- components.forEach((component, id) => {
10023
- if (component.grow === void 0)
10024
- return;
10025
- const parents = [...components.values()].filter((parent) => getComponentReferences(parent).includes(id));
10026
- if (id === "root" || parents.length === 0 || parents.some((parent) => parent.component !== "Row" && parent.component !== "Column")) {
10027
- issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.grow`, "INVALID_LAYOUT_PARENT", "grow requires a direct Row or Column parent in every occurrence"));
10028
- }
10029
- });
10030
10030
  const visiting = /* @__PURE__ */ new Set();
10031
10031
  const visited2 = /* @__PURE__ */ new Set();
10032
10032
  const walk = (id) => {
@@ -10057,14 +10057,6 @@ function collectSurfaceOpenReferences(value, result = /* @__PURE__ */ new Set())
10057
10057
  }
10058
10058
  return result;
10059
10059
  }
10060
- function getComponentReferences(component) {
10061
- if (typeof component.child === "string")
10062
- return [component.child];
10063
- const children = component.children;
10064
- if (Array.isArray(children))
10065
- return children.filter((entry) => typeof entry === "string");
10066
- return isPlainRecord(children) && typeof children.componentId === "string" ? [children.componentId] : [];
10067
- }
10068
10060
  function hasInteractiveDescendant(id, components, visited2) {
10069
10061
  if (visited2.has(id))
10070
10062
  return false;
@@ -10074,20 +10066,22 @@ function hasInteractiveDescendant(id, components, visited2) {
10074
10066
  return false;
10075
10067
  if (component.component === "Button" || component.action !== void 0 || ["TextField", "ChoicePicker", "Stepper"].includes(String(component.component)))
10076
10068
  return true;
10077
- const refs = getComponentReferences(component);
10069
+ const children = component.children;
10070
+ const refs = Array.isArray(children) ? children : isPlainRecord(children) ? [children.componentId] : [];
10078
10071
  return refs.some((ref) => typeof ref === "string" && hasInteractiveDescendant(ref, components, visited2));
10079
10072
  }
10080
- var spacing, colors, iconNames, layoutItem, width, radius, decoration, typography, container, _listJustify, listContainer, A2UI_V4_COMPONENT_CATALOG;
10073
+ var spacing, colors, iconNames, box, typography, container, A2UI_V4_COMPONENT_CATALOG;
10081
10074
  var init_v4Catalog = __esm({
10082
10075
  "../agent-a2ui-card-contract/dist/esm/v4Catalog.js"() {
10083
10076
  "use strict";
10084
- init_json2();
10085
10077
  init_protocol();
10078
+ init_json2();
10086
10079
  spacing = ["none", "xs", "sm", "md", "lg"];
10087
10080
  colors = [
10088
10081
  "default",
10089
10082
  "muted",
10090
10083
  "primary",
10084
+ "accent",
10091
10085
  "success",
10092
10086
  "warning",
10093
10087
  "error",
@@ -10139,18 +10133,8 @@ var init_v4Catalog = __esm({
10139
10133
  "warning",
10140
10134
  "arrow-right-long"
10141
10135
  ];
10142
- layoutItem = {
10143
- grow: {
10144
- kind: "number",
10145
- values: [0, 1, 2, 3, 4],
10146
- parentComponents: ["Row", "Column"]
10147
- }
10148
- };
10149
- width = { width: { kind: "string", values: ["fit", "fill"] } };
10150
- radius = {
10151
- radius: { kind: "string", values: ["none", "xs", "sm", "md", "full"] }
10152
- };
10153
- decoration = {
10136
+ box = {
10137
+ margin: { kind: "string", values: spacing },
10154
10138
  padding: { kind: "string", values: spacing },
10155
10139
  background: {
10156
10140
  kind: "string",
@@ -10168,17 +10152,29 @@ var init_v4Catalog = __esm({
10168
10152
  kind: "string",
10169
10153
  values: ["none", "subtle", "card-border", "primary"]
10170
10154
  },
10171
- ...radius
10155
+ radius: { kind: "string", values: ["none", "xs", "sm", "md", "full"] },
10156
+ width: { kind: "string", values: ["fit", "fill"] },
10157
+ grow: { kind: "number", values: [0, 1, 2, 3, 4] },
10158
+ shrink: { kind: "boolean" }
10172
10159
  };
10173
10160
  typography = {
10174
10161
  color: { kind: "string", values: colors },
10175
- fontSize: { kind: "string", values: ["xs", "sm", "md", "lg", "xl", "xxl"] },
10162
+ fontSize: {
10163
+ kind: "string",
10164
+ values: [
10165
+ "small",
10166
+ "medium",
10167
+ "large",
10168
+ "striking",
10169
+ "display",
10170
+ "badge",
10171
+ "merchant"
10172
+ ]
10173
+ },
10176
10174
  fontWeight: { kind: "string", values: ["normal", "semibold", "bold"] }
10177
10175
  };
10178
10176
  container = {
10179
- ...layoutItem,
10180
- ...width,
10181
- padding: { kind: "string", values: spacing },
10177
+ ...box,
10182
10178
  children: { kind: "children", required: true },
10183
10179
  gap: { kind: "string", values: spacing },
10184
10180
  align: {
@@ -10198,7 +10194,6 @@ var init_v4Catalog = __esm({
10198
10194
  },
10199
10195
  "x2-overflow": { kind: "format" }
10200
10196
  };
10201
- ({ justify: _listJustify, ...listContainer } = container);
10202
10197
  A2UI_V4_COMPONENT_CATALOG = Object.freeze({
10203
10198
  catalogId: LINKQUE_A2UI_V4_CATALOG_ID,
10204
10199
  protocolVersion: "0.9",
@@ -10206,10 +10201,7 @@ var init_v4Catalog = __esm({
10206
10201
  Card: {
10207
10202
  interaction: "action",
10208
10203
  properties: {
10209
- ...layoutItem,
10210
- ...width,
10211
- ...decoration,
10212
- child: { kind: "child", required: true },
10204
+ ...container,
10213
10205
  action: { kind: "action" },
10214
10206
  disabled: { kind: "boolean" }
10215
10207
  }
@@ -10225,7 +10217,7 @@ var init_v4Catalog = __esm({
10225
10217
  List: {
10226
10218
  interaction: "none",
10227
10219
  properties: {
10228
- ...listContainer,
10220
+ ...container,
10229
10221
  variant: {
10230
10222
  kind: "string",
10231
10223
  required: true,
@@ -10236,9 +10228,8 @@ var init_v4Catalog = __esm({
10236
10228
  Text: {
10237
10229
  interaction: "none",
10238
10230
  properties: {
10239
- ...layoutItem,
10231
+ ...box,
10240
10232
  ...typography,
10241
- shrink: { kind: "boolean" },
10242
10233
  text: { kind: "binding", required: true },
10243
10234
  maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
10244
10235
  decoration: { kind: "string", values: ["line-through"] },
@@ -10248,31 +10239,19 @@ var init_v4Catalog = __esm({
10248
10239
  Tag: {
10249
10240
  interaction: "none",
10250
10241
  properties: {
10251
- ...layoutItem,
10242
+ ...box,
10243
+ ...typography,
10252
10244
  text: { kind: "binding", required: true },
10253
10245
  icon: { kind: "string", values: iconNames },
10254
- tone: {
10255
- kind: "string",
10256
- values: [
10257
- "default",
10258
- "muted",
10259
- "primary",
10260
- "success",
10261
- "warning",
10262
- "error"
10263
- ]
10264
- },
10265
- variant: { kind: "string", values: ["soft", "outline", "plain"] },
10266
- size: { kind: "string", values: ["sm", "md"] },
10267
- shrink: { kind: "boolean" },
10268
- maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] }
10246
+ gap: { kind: "string", values: spacing },
10247
+ maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
10248
+ format: { kind: "format" }
10269
10249
  }
10270
10250
  },
10271
10251
  Button: {
10272
10252
  interaction: "action",
10273
10253
  properties: {
10274
- ...layoutItem,
10275
- ...width,
10254
+ ...box,
10276
10255
  label: { kind: "binding", required: true },
10277
10256
  action: { kind: "action", required: true },
10278
10257
  checks: { kind: "format" },
@@ -10290,29 +10269,34 @@ var init_v4Catalog = __esm({
10290
10269
  Image: {
10291
10270
  interaction: "none",
10292
10271
  properties: {
10293
- ...layoutItem,
10294
- ...radius,
10272
+ ...box,
10295
10273
  src: { kind: "binding", required: true },
10296
10274
  alt: { kind: "binding" },
10297
10275
  fit: {
10298
10276
  kind: "string",
10299
10277
  values: ["contain", "cover", "fill", "none", "scale-down"]
10300
10278
  },
10301
- aspectRatio: {
10302
- kind: "string",
10303
- values: ["square", "portrait", "landscape", "wide", "banner"]
10304
- },
10305
- height: { kind: "string", values: ["auto", "fill"] },
10306
- size: {
10279
+ variant: {
10307
10280
  kind: "string",
10308
- values: ["xs", "sm", "md", "lg", "xl", "full"]
10281
+ values: [
10282
+ "icon",
10283
+ "avatar",
10284
+ "merchantLogo",
10285
+ "smallFeature",
10286
+ "mediumFeature",
10287
+ "portraitFeature",
10288
+ "productThumbnail",
10289
+ "voucherThumbnail",
10290
+ "largeFeature",
10291
+ "header"
10292
+ ]
10309
10293
  }
10310
10294
  }
10311
10295
  },
10312
10296
  Icon: {
10313
10297
  interaction: "none",
10314
10298
  properties: {
10315
- ...layoutItem,
10299
+ ...box,
10316
10300
  name: { kind: "string", required: true, values: iconNames },
10317
10301
  label: { kind: "string" },
10318
10302
  color: { kind: "string", values: colors },
@@ -10325,15 +10309,15 @@ var init_v4Catalog = __esm({
10325
10309
  Divider: {
10326
10310
  interaction: "none",
10327
10311
  properties: {
10328
- ...layoutItem,
10312
+ ...box,
10329
10313
  axis: { kind: "string", values: ["horizontal", "vertical"] }
10330
10314
  }
10331
10315
  },
10332
10316
  TextField: {
10333
10317
  interaction: "input",
10334
10318
  properties: {
10335
- ...layoutItem,
10336
- ...width,
10319
+ ...box,
10320
+ ...typography,
10337
10321
  label: { kind: "string", required: true },
10338
10322
  value: { kind: "binding", required: true },
10339
10323
  checks: { kind: "format" },
@@ -10357,8 +10341,7 @@ var init_v4Catalog = __esm({
10357
10341
  ChoicePicker: {
10358
10342
  interaction: "input",
10359
10343
  properties: {
10360
- ...layoutItem,
10361
- ...width,
10344
+ ...box,
10362
10345
  label: { kind: "string", required: true },
10363
10346
  value: { kind: "binding", required: true },
10364
10347
  options: { kind: "options", required: true },
@@ -10373,8 +10356,7 @@ var init_v4Catalog = __esm({
10373
10356
  Stepper: {
10374
10357
  interaction: "input",
10375
10358
  properties: {
10376
- ...layoutItem,
10377
- ...width,
10359
+ ...box,
10378
10360
  label: { kind: "string", required: true },
10379
10361
  value: { kind: "binding", required: true },
10380
10362
  min: { kind: "number" },
@@ -11914,11 +11896,7 @@ var init_mcpProxyTool = __esm({
11914
11896
  return;
11915
11897
  try {
11916
11898
  await entry.server.close?.();
11917
- } catch (error40) {
11918
- try {
11919
- this.debugLog(`[mcp] server ${entry.server.serverName} close failed: ${error40 instanceof Error ? error40.message : "unknown error"}`, EDebugLogScope.MCP);
11920
- } catch {
11921
- }
11899
+ } catch {
11922
11900
  }
11923
11901
  }));
11924
11902
  }
@@ -31883,6 +31861,9 @@ function getConversationRunRequestIssues(value) {
31883
31861
  issues.push("attachments must be an array");
31884
31862
  } else {
31885
31863
  value.attachments.forEach((attachment, index2) => validateAttachment(attachment, index2, issues));
31864
+ if (value.attachments.length > 0 && (!Array.isArray(value.messages) || !value.messages.some((message) => isRecord3(message) && message.role === "user"))) {
31865
+ issues.push("non-empty attachments require at least one user message");
31866
+ }
31886
31867
  }
31887
31868
  if (!isRecord3(value.metadata))
31888
31869
  issues.push("metadata must be an object");
@@ -32023,6 +32004,9 @@ function validateAttachment(value, index2, issues) {
32023
32004
  if (value.size !== void 0 && (!Number.isSafeInteger(value.size) || Number(value.size) < 0)) {
32024
32005
  issues.push(`attachments[${index2}].size must be a non-negative safe integer when provided`);
32025
32006
  }
32007
+ if (value.availability !== void 0 && value.availability !== "resolvable" && value.availability !== "current_turn_only") {
32008
+ issues.push(`attachments[${index2}].availability must be resolvable or current_turn_only when provided`);
32009
+ }
32026
32010
  if (value.metadata !== void 0 && !isRecord3(value.metadata)) {
32027
32011
  issues.push(`attachments[${index2}].metadata must be an object when provided`);
32028
32012
  }
@@ -190142,10 +190126,6 @@ var init_followUpQuestionGenerator = __esm({
190142
190126
  FOLLOW_UP_QUESTION_TOOL_NAME = "submit_follow_up_questions";
190143
190127
  FOLLOW_UP_QUESTION_TIMEOUT_MS = 4500;
190144
190128
  SYSTEM_PROMPT = `\u6839\u636E\u5BF9\u8BDD\u8C03\u7528 submit_follow_up_questions\uFF0C\u63D0\u4EA4\u7528\u6237\u63A5\u4E0B\u6765\u53EF\u80FD\u63D0\u51FA\u7684\u8FFD\u95EE\uFF1A
190145
- - \u8FD9\u4E9B\u5EFA\u8BAE\u70B9\u51FB\u540E\u4F1A\u76F4\u63A5\u4F5C\u4E3A\u4E0B\u4E00\u6761\u7528\u6237\u6D88\u606F\u53D1\u9001\u3002\u7AD9\u5728\u5F53\u524D\u6D88\u8D39\u8005/\u670D\u52A1\u4F7F\u7528\u8005\u7684\u89C6\u89D2\u5411\u52A9\u624B\u63D0\u95EE\uFF0C\u4E0D\u8981\u66FF\u5546\u6237\u3001\u5BA2\u670D\u6216\u52A9\u624B\u5411\u7528\u6237\u53D1\u95EE\u3002
190146
- - \u4FDD\u6301\u5F53\u524D\u7528\u6237\u7684\u8EAB\u4EFD\u548C\u610F\u56FE\uFF1B\u53EA\u6709\u7528\u6237\u660E\u786E\u4EE5\u5546\u6237\u8EAB\u4EFD\u54A8\u8BE2\u7ECF\u8425\u95EE\u9898\u65F6\uFF0C\u624D\u6CBF\u7528\u8BE5\u8EAB\u4EFD\u3002\u4E0D\u8981\u56E0\u4E3A\u52A9\u624B\u7684\u63AA\u8F9E\u6539\u53D8\u7528\u6237\u89D2\u8272\u3002
190147
- - \u4F8B\u5982\u8D2D\u7968\u573A\u666F\u53EF\u95EE\u201C\u53EF\u4EE5\u9884\u7EA6\u8BB2\u89E3\u670D\u52A1\u5417\uFF1F\u201D\u6216\u201C\u513F\u7AE5\u7968\u600E\u4E48\u4E70\uFF1F\u201D\uFF0C\u4E0D\u8981\u5199\u201C\u9700\u8981\u9884\u7EA6\u8BB2\u89E3\u670D\u52A1\u5417\uFF1F\u201D\u201C\u8BF7\u63D0\u4F9B\u6BCF\u4F4D\u5165\u56ED\u4EBA\u7684\u8EAB\u4EFD\u8BC1\u4FE1\u606F\u201D\u3002
190148
- - \u52A9\u624B\u6B63\u5728\u8BE2\u95EE\u4EBA\u6570\u3001\u65E5\u671F\u3001\u9884\u7B97\u7B49\u4FE1\u606F\u65F6\uFF0C\u4E0D\u8981\u91CD\u590D\u5B83\u7684\u53CD\u95EE\uFF0C\u4E0D\u8981\u7F16\u9020\u7528\u6237\u5C1A\u672A\u63D0\u4F9B\u7684\u7B54\u6848\u6216\u66FF\u7528\u6237\u627F\u8BFA\u4E0B\u5355\u3001\u652F\u4ED8\uFF1B\u53EF\u5EFA\u8BAE\u76F8\u5173\u89C4\u5219\u95EE\u9898\uFF0C\u6CA1\u6709\u5408\u9002\u95EE\u9898\u5C31\u7559\u7A7A\u3002
190149
190129
  - 0\uFF5E3 \u6761\uFF0C\u81EA\u7136\u3001\u76F8\u5173\u3001\u4E0D\u91CD\u590D\uFF1B\u6CA1\u6709\u5408\u9002\u8FFD\u95EE\u65F6\u63D0\u4EA4\u7A7A\u6570\u7EC4\u3002
190150
190130
  - \u8DDF\u968F\u6700\u540E\u4E00\u6761\u7528\u6237\u6D88\u606F\u7684\u8BED\u8A00\uFF0C\u6BCF\u6761 JavaScript \u5B57\u7B26\u4E32\u957F\u5EA6\u4E3A 1\uFF5E20\u3002
190151
190131
  - \u5386\u53F2\u8FFD\u95EE\u662F\u7CFB\u7EDF\u66FE\u751F\u6210\u7684\u5EFA\u8BAE\uFF0C\u4E0D\u662F\u7528\u6237\u8BF4\u8FC7\u7684\u8BDD\uFF1B\u4EC5\u7528\u4E8E\u7406\u89E3\u8BDD\u9898\u548C\u907F\u514D\u91CD\u590D\u3002
@@ -190184,10 +190164,8 @@ var init_followUpQuestionGenerator = __esm({
190184
190164
  tools: [
190185
190165
  {
190186
190166
  name: FOLLOW_UP_QUESTION_TOOL_NAME,
190187
- description: "\u63D0\u4EA4\u5F53\u524D\u7528\u6237\u63A5\u4E0B\u6765\u5411\u52A9\u624B\u63D0\u51FA\u7684\u95EE\u9898\uFF0C\u9ED8\u8BA4\u91C7\u7528\u6D88\u8D39\u8005\u89C6\u89D2\uFF1B\u70B9\u51FB\u540E\u4F5C\u4E3A\u7528\u6237\u6D88\u606F\u53D1\u9001\uFF0C\u4E0D\u80FD\u662F\u5BA2\u670D\u5411\u6D88\u8D39\u8005\u7684\u53CD\u95EE\u6216\u8D44\u6599\u7D22\u53D6\u3002",
190188
- parameters: typebox_exports.Object({
190189
- questions: typebox_exports.Array(typebox_exports.String({ minLength: 1, maxLength: 20 }), { maxItems: 3 })
190190
- }, { additionalProperties: false })
190167
+ description: "\u63D0\u4EA4\u6700\u7EC8\u8FFD\u95EE\u5217\u8868\u3002",
190168
+ parameters: typebox_exports.Object({ questions: typebox_exports.Array(typebox_exports.String(), { maxItems: 3 }) }, { additionalProperties: false })
190191
190169
  }
190192
190170
  ]
190193
190171
  };
@@ -191769,12 +191747,6 @@ var init_imageUnderstandingPlugin = __esm({
191769
191747
  ]
191770
191748
  }
191771
191749
  });
191772
- if (!input.agentConfig.agent.multimodel.enabled)
191773
- return currentImage ? {
191774
- ok: false,
191775
- code: "IMAGE_DISABLED",
191776
- message: "\u5F53\u524D Agent \u672A\u5F00\u542F\u591A\u6A21\u6001\uFF0C\u8BF7\u79FB\u9664\u56FE\u7247\u6216\u5F00\u542F\u540E\u91CD\u8BD5"
191777
- } : unavailable();
191778
191750
  const images = selected.turn.attachments;
191779
191751
  if (images.length !== 1)
191780
191752
  return currentImage ? {
@@ -192066,61 +192038,6 @@ function failure(code, message, retryable) {
192066
192038
  return { ok: false, error: { code, message, retryable } };
192067
192039
  }
192068
192040
 
192069
- // ../linkque-agent-runtime/dist/esm/core/cardActionDiagnostics.js
192070
- init_types();
192071
- var CardActionDiagnostics = class {
192072
- sink;
192073
- layer;
192074
- stage = "validate";
192075
- context;
192076
- debugLog;
192077
- startedAt = performance.now();
192078
- constructor(sink, context2, layer = "runtime") {
192079
- this.sink = sink;
192080
- this.layer = layer;
192081
- this.context = { ...context2 };
192082
- if (sink) {
192083
- this.debugLog = (line, scope) => {
192084
- this.write("diagnostic", { message: line }, scope);
192085
- };
192086
- }
192087
- }
192088
- write(event, fields = {}, scope = EDebugLogScope.A2UI_ACTION) {
192089
- if (!this.sink)
192090
- return;
192091
- try {
192092
- const record3 = { ...this.context, ...fields };
192093
- if (record3.message)
192094
- record3.message = sanitizeDiagnosticText(record3.message);
192095
- if (record3.errorName)
192096
- record3.errorName = sanitizeDiagnosticText(record3.errorName);
192097
- this.sink(JSON.stringify({
192098
- operation: "a2uiAction.execute",
192099
- layer: this.layer,
192100
- event,
192101
- stage: this.stage,
192102
- ...record3,
192103
- costMs: Math.max(0, Math.round(performance.now() - this.startedAt))
192104
- }), scope);
192105
- } catch {
192106
- }
192107
- }
192108
- error(event, error40) {
192109
- if (!this.sink)
192110
- return;
192111
- try {
192112
- this.write(event, {
192113
- errorName: error40 instanceof Error ? error40.name : typeof error40,
192114
- message: error40 instanceof Error ? error40.message : typeof error40 === "string" ? error40 : "\u975E\u6807\u51C6\u5F02\u5E38"
192115
- });
192116
- } catch {
192117
- }
192118
- }
192119
- };
192120
- function sanitizeDiagnosticText(value) {
192121
- return value.replace(/\b(?:body|arguments|payload|headers)\s*[:=][\s\S]*/giu, "<payload>").replace(/\{[\s\S]*/gu, "<payload>").replace(/https?:\/\/[^\s]+/giu, "<url>").replace(/\b(?:authorization|cookie|set-cookie)\s*[:=][^\r\n]*/giu, "<redacted>").replace(/\bbearer\s+[^\s,;]+/giu, "Bearer <redacted>").replace(/\b((?:api[_-]?key|access[_-]?key|token|secret|password|ak|sk|tradeNO|userId|orderId)\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;]+)/giu, "$1<redacted>").replace(/\s+/gu, " ").slice(0, 300);
192122
- }
192123
-
192124
192041
  // ../linkque-agent-runtime/dist/esm/core/cardActionExecutor.js
192125
192042
  init_esm3();
192126
192043
  init_esm2();
@@ -192128,33 +192045,12 @@ init_esm();
192128
192045
  init_mcpAggregator();
192129
192046
  init_mcpProxyTool();
192130
192047
  async function executeCardAction(input) {
192131
- const diagnostics = new CardActionDiagnostics(input.debugLog, {
192132
- agentId: input.protocol.agentId,
192133
- threadId: input.runtimeContext.threadId
192134
- });
192135
- diagnostics.write("started");
192136
- try {
192137
- const response = await executeCardActionInternal(input, diagnostics);
192138
- diagnostics.write(response.ok ? "completed" : "failed", response.ok ? {} : { code: response.error.code, retryable: response.error.retryable });
192139
- return response;
192140
- } catch (error40) {
192141
- diagnostics.error("failed", error40);
192142
- throw error40;
192143
- }
192144
- }
192145
- async function executeCardActionInternal(input, diagnostics) {
192146
192048
  let request;
192147
192049
  try {
192148
192050
  request = parseA2UIActionExecuteRequest(input.request);
192149
192051
  } catch (error40) {
192150
192052
  return failure2("INVALID_INPUT", errorMessage(error40, "\u652F\u4ED8\u52A8\u4F5C\u8BF7\u6C42\u65E0\u6548"), false);
192151
192053
  }
192152
- Object.assign(diagnostics.context, {
192153
- invocationId: request.invocationId,
192154
- actionId: request.actionId,
192155
- cardRef: request.source.cardRef,
192156
- cardRevision: request.source.cardRevision
192157
- });
192158
192054
  if (request.agentId !== input.protocol.agentId) {
192159
192055
  return failure2("AGENT_MISMATCH", "\u652F\u4ED8\u52A8\u4F5C\u4E0E\u5F53\u524D Agent \u4E0D\u5339\u914D", false);
192160
192056
  }
@@ -192164,38 +192060,24 @@ async function executeCardActionInternal(input, diagnostics) {
192164
192060
  if (!input.runtimeContext.userId.trim()) {
192165
192061
  return failure2("AUTH_REQUIRED", "\u652F\u4ED8\u52A8\u4F5C\u7F3A\u5C11\u53EF\u4FE1\u7528\u6237\u8EAB\u4EFD", false);
192166
192062
  }
192167
- diagnostics.write("validated");
192168
- diagnostics.stage = "binding";
192169
192063
  const resolved = resolvePaymentBinding(input.protocol, request.source, request.actionId);
192170
192064
  if (!resolved.ok)
192171
192065
  return resolved.response;
192172
- Object.assign(diagnostics.context, {
192173
- mcpResourceId: resolved.binding.createTrade.mcpResourceId,
192174
- toolName: resolved.binding.createTrade.toolName
192175
- });
192176
- diagnostics.write("binding_resolved");
192177
- diagnostics.stage = "tool_resolve";
192178
- const registry2 = createRegistry(input.protocol, input.mcpServerProvider, diagnostics.debugLog);
192066
+ const registry2 = createRegistry(input.protocol, input.mcpServerProvider);
192179
192067
  try {
192180
192068
  const tool = await registry2.resolve(resolved.binding.createTrade.mcpResourceId, resolved.binding.createTrade.toolName, input.signal);
192181
192069
  if (!tool) {
192182
192070
  return failure2("TOOL_NOT_ALLOWED", "\u521B\u5EFA\u4EA4\u6613 MCP Tool \u4E0D\u5B58\u5728\u6216\u672A\u6388\u6743", false);
192183
192071
  }
192184
- diagnostics.stage = "tool_input";
192185
192072
  const args = createToolInput(resolved.binding.createTrade.inputBindings, request.actionContext, input.runtimeContext);
192186
192073
  if (!args)
192187
192074
  return failure2("INVALID_INPUT", "\u65E0\u6CD5\u751F\u6210\u521B\u5EFA\u4EA4\u6613 MCP \u5165\u53C2", false);
192188
192075
  let result;
192189
- diagnostics.stage = "tool_execute";
192190
- diagnostics.write("tool_started");
192191
192076
  try {
192192
192077
  result = await tool.execute(args, input.signal);
192193
- diagnostics.write("tool_completed");
192194
- } catch (error40) {
192195
- diagnostics.error("tool_failed", error40);
192078
+ } catch {
192196
192079
  return failure2("EXECUTION_FAILED", "\u521B\u5EFA\u4EA4\u6613\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5", true);
192197
192080
  }
192198
- diagnostics.stage = "tool_output";
192199
192081
  const structured = readStructuredContent3(result);
192200
192082
  const tradeNO = readJsonPointer(structured, resolved.binding.createTrade.tradeNoPath);
192201
192083
  if (typeof tradeNO !== "string" || !tradeNO.trim() || tradeNO.length > 64) {
@@ -192207,10 +192089,7 @@ async function executeCardActionInternal(input, diagnostics) {
192207
192089
  result: { kind: "payment", tradeNO }
192208
192090
  };
192209
192091
  } finally {
192210
- const stage = diagnostics.stage;
192211
- diagnostics.stage = "cleanup";
192212
192092
  await registry2.closeAll();
192213
- diagnostics.stage = stage;
192214
192093
  }
192215
192094
  }
192216
192095
  function resolvePaymentBinding(protocol, source, actionId) {
@@ -192240,9 +192119,9 @@ function resolvePaymentBinding(protocol, source, actionId) {
192240
192119
  }
192241
192120
  return { ok: true, binding };
192242
192121
  }
192243
- function createRegistry(protocol, provider, debugLog) {
192122
+ function createRegistry(protocol, provider) {
192244
192123
  const resources = protocol.agent.resources.filter((resource) => resource.resourceType === EResourceType.MCP || resource.resourceType === EResourceType.MCP_TOOL);
192245
- return new McpProxyTool(provider, aggregateMcpServers(resources, protocol.agentId), { debugLog });
192124
+ return new McpProxyTool(provider, aggregateMcpServers(resources, protocol.agentId));
192246
192125
  }
192247
192126
  function createToolInput(bindings, actionContext, runtimeContext, tradeNO, callback) {
192248
192127
  const result = {};
@@ -199028,7 +198907,7 @@ var handleHomeData = async (req, res, input) => {
199028
198907
  );
199029
198908
  }
199030
198909
  };
199031
- var handleA2UIAction = async (req, res, input, debugLog) => {
198910
+ var handleA2UIAction = async (req, res, input) => {
199032
198911
  if (!executeCardAction2 || !createMcpServerProvider) {
199033
198912
  writeJsonError2(res, 500, "AGENTDEV_NOT_READY", "agent runtime not loaded");
199034
198913
  return;
@@ -199052,8 +198931,7 @@ var handleA2UIAction = async (req, res, input, debugLog) => {
199052
198931
  userId: proxyInput.userId,
199053
198932
  ...proxyInput.tenantId ? { tenantId: proxyInput.tenantId } : {}
199054
198933
  },
199055
- mcpServerProvider: createMcpServerProvider(protocol),
199056
- debugLog
198934
+ mcpServerProvider: createMcpServerProvider(protocol)
199057
198935
  });
199058
198936
  res.writeHead(200, { "content-type": "application/json; charset=utf-8" });
199059
198937
  res.end(JSON.stringify(result));
@@ -199231,7 +199109,7 @@ var main = async () => {
199231
199109
  return;
199232
199110
  }
199233
199111
  if (req.method === "POST" && pathname === input.a2uiActionPath) {
199234
- void handleA2UIAction(req, res, input, debugLog);
199112
+ void handleA2UIAction(req, res, input);
199235
199113
  return;
199236
199114
  }
199237
199115
  const cancelMatch = pathname.match(