linkque-cli-v2 1.6.23 → 1.6.24

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
@@ -530,24 +530,8 @@ var init_protocol = __esm({
530
530
  }
531
531
  });
532
532
 
533
- // ../agent-a2ui-card-contract/dist/esm/types.js
534
- var A2UI_CARD_TRANSFORM_LANGUAGE, A2UI_CARD_TRANSFORM_PROFILE, A2UI_CARD_EXPRESSION_MAX_LENGTH, A2UI_CARD_EXPRESSION_MAX_AST_NODES, A2UI_CARD_EXPRESSION_MAX_AST_DEPTH, A2UI_CARD_DATA_TRANSFORM_LANGUAGE, A2UI_CARD_DATA_TRANSFORM_PROFILE, A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES;
535
- var init_types2 = __esm({
536
- "../agent-a2ui-card-contract/dist/esm/types.js"() {
537
- "use strict";
538
- A2UI_CARD_TRANSFORM_LANGUAGE = "jmespath";
539
- A2UI_CARD_TRANSFORM_PROFILE = "linkque-structural-v1";
540
- A2UI_CARD_EXPRESSION_MAX_LENGTH = 4096;
541
- A2UI_CARD_EXPRESSION_MAX_AST_NODES = 512;
542
- A2UI_CARD_EXPRESSION_MAX_AST_DEPTH = 32;
543
- A2UI_CARD_DATA_TRANSFORM_LANGUAGE = "javascript";
544
- A2UI_CARD_DATA_TRANSFORM_PROFILE = "linkque-card-data-transform-v1";
545
- A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES = 32 * 1024;
546
- }
547
- });
548
-
549
533
  // ../linkque-agent-data-binding-contract/dist/esm/types.js
550
- var init_types3 = __esm({
534
+ var init_types2 = __esm({
551
535
  "../linkque-agent-data-binding-contract/dist/esm/types.js"() {
552
536
  "use strict";
553
537
  }
@@ -607,6 +591,9 @@ function isSafeJsonPointer(value, allowWildcard = false) {
607
591
  return !BLOCKED_PATH_SEGMENTS.has(segment) && (allowWildcard || segment !== "*");
608
592
  });
609
593
  }
594
+ function encodePointerSegment(value) {
595
+ return value.replace(/~/gu, "~0").replace(/\//gu, "~1");
596
+ }
610
597
  function decodePointerSegment(value) {
611
598
  return value.replace(/~1/gu, "/").replace(/~0/gu, "~");
612
599
  }
@@ -9303,7 +9290,7 @@ var init_homeCard = __esm({
9303
9290
  var init_esm2 = __esm({
9304
9291
  "../linkque-agent-data-binding-contract/dist/esm/index.js"() {
9305
9292
  "use strict";
9306
- init_types3();
9293
+ init_types2();
9307
9294
  init_json();
9308
9295
  init_schema();
9309
9296
  init_structural();
@@ -9341,227 +9328,137 @@ var init_json2 = __esm({
9341
9328
  }
9342
9329
  });
9343
9330
 
9344
- // ../agent-a2ui-card-contract/dist/esm/binding-analyzer.js
9345
- function analyzeA2UIBindings(protocol) {
9346
- const issues = [];
9347
- const occurrences = [];
9348
- const surfaces = /* @__PURE__ */ new Set();
9349
- const componentsBySurface = /* @__PURE__ */ new Map();
9350
- protocol.forEach((message, messageIndex) => {
9351
- if (!isPlainRecord(message) || !Array.isArray(message.datas)) {
9352
- issues.push(issue2(`card[${messageIndex}]`, "INVALID_A2UI_MESSAGE", "A2UI message must contain a datas array"));
9353
- return;
9354
- }
9355
- if (message.version !== "0.9") {
9356
- issues.push(issue2(`card[${messageIndex}].version`, "UNSUPPORTED_PROTOCOL_VERSION", "A2UI card resources must use protocol version 0.9"));
9357
- }
9358
- message.datas.forEach((instruction, instructionIndex) => {
9359
- if (!isPlainRecord(instruction)) {
9360
- issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}]`, "INVALID_A2UI_INSTRUCTION", "instruction must be an object"));
9361
- return;
9362
- }
9363
- if ("createSurface" in instruction) {
9364
- if (!isPlainRecord(instruction.createSurface))
9365
- return;
9366
- const surfaceId = instruction.createSurface.surfaceId;
9367
- if (!isSafeIdentifier(surfaceId)) {
9368
- issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}].createSurface.surfaceId`, "INVALID_SURFACE_ID", "surfaceId must be a non-empty safe identifier"));
9369
- } else {
9370
- surfaces.add(surfaceId);
9371
- }
9372
- }
9373
- if ("updateComponents" in instruction) {
9374
- if (!isPlainRecord(instruction.updateComponents))
9375
- return;
9376
- const { surfaceId, components: rawComponents } = instruction.updateComponents;
9377
- if (!isSafeIdentifier(surfaceId) || !Array.isArray(rawComponents)) {
9378
- return;
9379
- }
9380
- surfaces.add(surfaceId);
9381
- const components = componentsBySurface.get(surfaceId) ?? [];
9382
- components.push(...rawComponents.filter((component) => isPlainRecord(component) && typeof component.id === "string" && typeof component.component === "string"));
9383
- componentsBySurface.set(surfaceId, components);
9384
- }
9385
- });
9386
- });
9387
- for (const [surfaceId, components] of componentsBySurface) {
9388
- const componentById = /* @__PURE__ */ new Map();
9389
- for (const component of components) {
9390
- if (!isSafeIdentifier(component.id)) {
9391
- issues.push(issue2(`card.surfaces.${surfaceId}.components`, "INVALID_COMPONENT_ID", "Every component must have a non-empty safe id"));
9392
- continue;
9393
- }
9394
- if (componentById.has(component.id)) {
9395
- issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}`, "DUPLICATE_COMPONENT_ID", `Component id ${component.id} is duplicated in surface ${surfaceId}`));
9396
- continue;
9397
- }
9398
- componentById.set(component.id, component);
9399
- }
9400
- const listRoots = inferListRoots(components, issues);
9401
- for (const component of components) {
9402
- const context2 = {
9403
- surfaceId,
9404
- component,
9405
- listRoot: listRoots.get(component.id),
9406
- occurrences,
9407
- issues
9408
- };
9409
- visitValue(component, "", context2);
9410
- const children = component.children;
9411
- if (isPlainRecord(children) && typeof children.path === "string") {
9412
- const canonicalPath = canonicalizeBindingPath(children.path, context2.listRoot);
9413
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
9414
- issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}.children.path`, "INVALID_BINDING_PATH", `Invalid list path ${children.path}`));
9415
- } else {
9416
- occurrences.push({
9417
- surfaceId,
9418
- componentId: component.id,
9419
- componentName: component.component,
9420
- propertyPath: "children.path",
9421
- rawPath: children.path,
9422
- canonicalPath,
9423
- ...context2.listRoot ? { listRoot: context2.listRoot } : {},
9424
- usage: "list"
9425
- });
9426
- }
9427
- }
9428
- }
9429
- }
9430
- return {
9431
- surfaceIds: [...surfaces],
9432
- surfaceId: surfaces.size === 1 ? [...surfaces][0] : void 0,
9433
- occurrences,
9434
- issues
9435
- };
9436
- }
9437
- function collectReferencedA2UICardBusinessFieldIds(protocol, fields) {
9438
- const businessFields = fields.filter((field) => field.source === "business").slice().sort((left, right) => right.path.length - left.path.length);
9439
- const result = /* @__PURE__ */ new Set();
9440
- for (const occurrence of analyzeA2UIBindings(protocol).occurrences) {
9441
- const field = businessFields.find((candidate) => occurrence.canonicalPath === candidate.path || occurrence.canonicalPath.startsWith(`${candidate.path}/*/`) || occurrence.canonicalPath.startsWith(`${candidate.path}/`));
9442
- if (field)
9443
- result.add(field.fieldId);
9444
- }
9445
- return result;
9446
- }
9447
- function visitValue(value, propertyPath, context2) {
9448
- if (propertyPath === "action.local.path" && typeof value === "string") {
9449
- addOccurrence(value, propertyPath, "local", context2);
9450
- return;
9451
- }
9452
- if (Array.isArray(value)) {
9453
- value.forEach((entry, index2) => {
9454
- visitValue(entry, appendProperty(propertyPath, String(index2)), context2);
9455
- });
9456
- return;
9457
- }
9458
- if (!isPlainRecord(value))
9459
- return;
9460
- const keys3 = Object.keys(value);
9461
- const isStrictBinding2 = keys3.length === 1 && typeof value.path === "string";
9462
- const isDisplayBinding2 = DISPLAY_BINDING_PROPERTIES.has(propertyPath) && keys3.every((key2) => key2 === "path" || key2 === "fallback") && typeof value.path === "string";
9463
- if (isStrictBinding2 || isDisplayBinding2) {
9464
- addOccurrence(value.path, propertyPath, bindingUsage(context2.component.component, propertyPath), context2);
9465
- return;
9466
- }
9467
- for (const [key2, entry] of Object.entries(value)) {
9468
- if (propertyPath === "" && (key2 === "children" || key2 === "id" || key2 === "component")) {
9469
- continue;
9470
- }
9471
- visitValue(entry, appendProperty(propertyPath, key2), context2);
9472
- }
9473
- }
9474
- function addOccurrence(rawPath, propertyPath, usage, context2) {
9475
- const canonicalPath = canonicalizeBindingPath(rawPath, context2.listRoot);
9476
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
9477
- context2.issues.push(issue2(`card.components.${context2.component.id}.${propertyPath}`, "INVALID_BINDING_PATH", `Invalid binding path ${rawPath}`));
9478
- return;
9479
- }
9480
- context2.occurrences.push({
9481
- surfaceId: context2.surfaceId,
9482
- componentId: context2.component.id,
9483
- componentName: context2.component.component,
9484
- propertyPath,
9485
- rawPath,
9486
- canonicalPath,
9487
- ...context2.listRoot ? { listRoot: context2.listRoot } : {},
9488
- usage
9489
- });
9490
- }
9491
- function bindingUsage(componentName, propertyPath) {
9492
- if (propertyPath.startsWith("action.event."))
9493
- return "event";
9494
- if (propertyPath.startsWith("action.local."))
9495
- return "local";
9496
- if (INPUT_COMPONENTS.has(componentName) && (propertyPath === "value" || propertyPath.endsWith(".value"))) {
9497
- return "input";
9498
- }
9499
- return "display";
9500
- }
9501
- function inferListRoots(components, issues) {
9502
- const result = /* @__PURE__ */ new Map();
9503
- const byId = new Map(components.map((component) => [component.id, component]));
9504
- const queue = [];
9505
- const assign = (childId, listRoot, ownerId) => {
9506
- const existing = result.get(childId);
9507
- if (existing && existing !== listRoot) {
9508
- issues.push(issue2(`card.components.${ownerId}.children`, "AMBIGUOUS_LIST_CONTEXT", `Component ${childId} is reused by multiple list roots`));
9509
- return;
9510
- }
9511
- if (!existing) {
9512
- result.set(childId, listRoot);
9513
- queue.push(childId);
9514
- }
9515
- };
9516
- for (const component of components) {
9517
- const children = component.children;
9518
- if (!isPlainRecord(children) || typeof children.componentId !== "string" || typeof children.path !== "string") {
9519
- continue;
9520
- }
9521
- if (children.path.startsWith("."))
9522
- continue;
9523
- const canonicalPath = canonicalizeBindingPath(children.path);
9524
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath))
9525
- continue;
9526
- assign(children.componentId, canonicalPath, component.id);
9527
- }
9528
- const visited2 = /* @__PURE__ */ new Set();
9529
- while (queue.length > 0) {
9530
- const componentId = queue.shift();
9531
- if (visited2.has(componentId))
9532
- continue;
9533
- visited2.add(componentId);
9534
- const component = byId.get(componentId);
9535
- const listRoot = result.get(componentId);
9536
- if (!component || !listRoot)
9537
- continue;
9538
- const templatedChildren = component.children;
9539
- if (isPlainRecord(templatedChildren) && typeof templatedChildren.componentId === "string" && typeof templatedChildren.path === "string") {
9540
- const nestedRoot = canonicalizeBindingPath(templatedChildren.path, listRoot);
9541
- if (nestedRoot && isSafeJsonPointer(nestedRoot, true)) {
9542
- assign(templatedChildren.componentId, nestedRoot, componentId);
9543
- }
9544
- }
9545
- const childIds = [
9546
- ...typeof component.child === "string" ? [component.child] : [],
9547
- ...Array.isArray(component.children) ? component.children.filter((entry) => typeof entry === "string") : []
9548
- ];
9549
- for (const childId of childIds) {
9550
- assign(childId, listRoot, componentId);
9551
- }
9552
- }
9553
- return result;
9554
- }
9555
- function appendProperty(base, segment) {
9556
- return base ? `${base}.${segment}` : segment;
9557
- }
9558
- var INPUT_COMPONENTS, DISPLAY_BINDING_PROPERTIES;
9559
- var init_binding_analyzer = __esm({
9560
- "../agent-a2ui-card-contract/dist/esm/binding-analyzer.js"() {
9331
+ // ../agent-a2ui-card-contract/dist/esm/digest.js
9332
+ function sha256Hex(value) {
9333
+ const bytes2 = new TextEncoder().encode(value);
9334
+ const words = [];
9335
+ for (let index2 = 0; index2 < bytes2.length; index2 += 1) {
9336
+ words[index2 >> 2] = (words[index2 >> 2] ?? 0) | bytes2[index2] << 24 - index2 % 4 * 8;
9337
+ }
9338
+ const bitLength = bytes2.length * 8;
9339
+ words[bitLength >> 5] = (words[bitLength >> 5] ?? 0) | 128 << 24 - bitLength % 32;
9340
+ words[(bitLength + 64 >> 9 << 4) + 15] = bitLength;
9341
+ const constants = SHA256_CONSTANTS;
9342
+ let state2 = [
9343
+ 1779033703,
9344
+ 3144134277,
9345
+ 1013904242,
9346
+ 2773480762,
9347
+ 1359893119,
9348
+ 2600822924,
9349
+ 528734635,
9350
+ 1541459225
9351
+ ];
9352
+ for (let offset = 0; offset < words.length; offset += 16) {
9353
+ const schedule = Array.from({ length: 64 }, () => 0);
9354
+ for (let index2 = 0; index2 < 16; index2 += 1) {
9355
+ schedule[index2] = words[offset + index2] ?? 0;
9356
+ }
9357
+ for (let index2 = 16; index2 < 64; index2 += 1) {
9358
+ const left = schedule[index2 - 15];
9359
+ const right = schedule[index2 - 2];
9360
+ const s0 = rotateRight(left, 7) ^ rotateRight(left, 18) ^ left >>> 3;
9361
+ const s1 = rotateRight(right, 17) ^ rotateRight(right, 19) ^ right >>> 10;
9362
+ schedule[index2] = add(schedule[index2 - 16], s0, schedule[index2 - 7], s1);
9363
+ }
9364
+ let [a, b, c, d, e2, f3, g, h2] = state2;
9365
+ for (let index2 = 0; index2 < 64; index2 += 1) {
9366
+ const sum1 = rotateRight(e2, 6) ^ rotateRight(e2, 11) ^ rotateRight(e2, 25);
9367
+ const choice = e2 & f3 ^ ~e2 & g;
9368
+ const temporary1 = add(h2, sum1, choice, constants[index2], schedule[index2]);
9369
+ const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
9370
+ const majority = a & b ^ a & c ^ b & c;
9371
+ const temporary2 = add(sum0, majority);
9372
+ h2 = g;
9373
+ g = f3;
9374
+ f3 = e2;
9375
+ e2 = add(d, temporary1);
9376
+ d = c;
9377
+ c = b;
9378
+ b = a;
9379
+ a = add(temporary1, temporary2);
9380
+ }
9381
+ state2 = state2.map((v, index2) => add(v, [a, b, c, d, e2, f3, g, h2][index2]));
9382
+ }
9383
+ return state2.map((v) => (v >>> 0).toString(16).padStart(8, "0")).join("");
9384
+ }
9385
+ function rotateRight(value, bits2) {
9386
+ return value >>> bits2 | value << 32 - bits2;
9387
+ }
9388
+ function add(...values) {
9389
+ return values.reduce((sum, value) => sum + value | 0, 0);
9390
+ }
9391
+ var SHA256_CONSTANTS;
9392
+ var init_digest = __esm({
9393
+ "../agent-a2ui-card-contract/dist/esm/digest.js"() {
9561
9394
  "use strict";
9562
9395
  init_json2();
9563
- INPUT_COMPONENTS = /* @__PURE__ */ new Set(["ChoicePicker", "Stepper", "TextField"]);
9564
- DISPLAY_BINDING_PROPERTIES = /* @__PURE__ */ new Set(["alt", "label", "src", "text"]);
9396
+ SHA256_CONSTANTS = [
9397
+ 1116352408,
9398
+ 1899447441,
9399
+ 3049323471,
9400
+ 3921009573,
9401
+ 961987163,
9402
+ 1508970993,
9403
+ 2453635748,
9404
+ 2870763221,
9405
+ 3624381080,
9406
+ 310598401,
9407
+ 607225278,
9408
+ 1426881987,
9409
+ 1925078388,
9410
+ 2162078206,
9411
+ 2614888103,
9412
+ 3248222580,
9413
+ 3835390401,
9414
+ 4022224774,
9415
+ 264347078,
9416
+ 604807628,
9417
+ 770255983,
9418
+ 1249150122,
9419
+ 1555081692,
9420
+ 1996064986,
9421
+ 2554220882,
9422
+ 2821834349,
9423
+ 2952996808,
9424
+ 3210313671,
9425
+ 3336571891,
9426
+ 3584528711,
9427
+ 113926993,
9428
+ 338241895,
9429
+ 666307205,
9430
+ 773529912,
9431
+ 1294757372,
9432
+ 1396182291,
9433
+ 1695183700,
9434
+ 1986661051,
9435
+ 2177026350,
9436
+ 2456956037,
9437
+ 2730485921,
9438
+ 2820302411,
9439
+ 3259730800,
9440
+ 3345764771,
9441
+ 3516065817,
9442
+ 3600352804,
9443
+ 4094571909,
9444
+ 275423344,
9445
+ 430227734,
9446
+ 506948616,
9447
+ 659060556,
9448
+ 883997877,
9449
+ 958139571,
9450
+ 1322822218,
9451
+ 1537002063,
9452
+ 1747873779,
9453
+ 1955562222,
9454
+ 2024104815,
9455
+ 2227730452,
9456
+ 2361852424,
9457
+ 2428436474,
9458
+ 2756734187,
9459
+ 3204031479,
9460
+ 3329325298
9461
+ ];
9565
9462
  }
9566
9463
  });
9567
9464
 
@@ -9608,6 +9505,29 @@ function normalizeCardDataValue(schema, value, required2 = true) {
9608
9505
  }
9609
9506
  return !required2 && validateJsonSchemaValue2(schema, normalized).length > 0 ? void 0 : normalized;
9610
9507
  }
9508
+ function inferJsonSchemaFromValue(value) {
9509
+ if (value === null)
9510
+ return { type: "null" };
9511
+ if (Array.isArray(value)) {
9512
+ return {
9513
+ type: "array",
9514
+ items: value.length > 0 ? inferJsonSchemaFromValue(value[0]) : {}
9515
+ };
9516
+ }
9517
+ if (typeof value === "object") {
9518
+ const keys3 = Object.keys(value).sort();
9519
+ return {
9520
+ type: "object",
9521
+ additionalProperties: false,
9522
+ required: keys3,
9523
+ properties: Object.fromEntries(keys3.map((key2) => [key2, inferJsonSchemaFromValue(value[key2])]))
9524
+ };
9525
+ }
9526
+ if (typeof value === "number") {
9527
+ return { type: Number.isInteger(value) ? "integer" : "number" };
9528
+ }
9529
+ return { type: typeof value };
9530
+ }
9611
9531
  function getJsonSchemaAtDataPointer(schema, pointer) {
9612
9532
  if (!isSafeJsonPointer(pointer, true))
9613
9533
  return void 0;
@@ -9782,6 +9702,345 @@ var init_schema2 = __esm({
9782
9702
  }
9783
9703
  });
9784
9704
 
9705
+ // ../agent-a2ui-card-contract/dist/esm/standard-card-data.js
9706
+ function standardCardSurfaceSchemas(message) {
9707
+ const models = /* @__PURE__ */ new Map();
9708
+ for (const instruction of message.datas) {
9709
+ if ("createSurface" in instruction) {
9710
+ models.set(instruction.createSurface.surfaceId, {});
9711
+ } else if ("deleteSurface" in instruction) {
9712
+ models.delete(instruction.deleteSurface.surfaceId);
9713
+ } else if ("updateDataModel" in instruction) {
9714
+ const { surfaceId, path: path10, value } = instruction.updateDataModel;
9715
+ const root = models.get(surfaceId);
9716
+ if (!root || !isSafeJsonPointer(path10) || !isJsonValue(value)) {
9717
+ throw new Error(`\u6807\u51C6\u5361\u6570\u636E\u6A21\u578B\u66F4\u65B0\u65E0\u6548\uFF1A${surfaceId} ${path10}`);
9718
+ }
9719
+ if (path10 === "/") {
9720
+ if (!isPlainRecord(value))
9721
+ throw new Error("\u6807\u51C6\u5361\u6570\u636E\u6A21\u578B\u6839\u8282\u70B9\u5FC5\u987B\u662F\u5BF9\u8C61");
9722
+ models.set(surfaceId, structuredClone(value));
9723
+ continue;
9724
+ }
9725
+ const segments = path10.slice(1).split("/").map(decodePointerSegment);
9726
+ let parent = root;
9727
+ for (const [index2, segment] of segments.entries()) {
9728
+ if (parent === null || typeof parent !== "object")
9729
+ throw new Error(`\u65E0\u6548\u7684\u6570\u636E\u6A21\u578B\u8DEF\u5F84\uFF1A${path10}`);
9730
+ const last = index2 === segments.length - 1;
9731
+ if (Array.isArray(parent)) {
9732
+ const offset = Number(segment);
9733
+ if (!Number.isSafeInteger(offset) || offset < 0 || String(offset) !== segment || offset > parent.length) {
9734
+ throw new Error(`\u65E0\u6548\u7684\u6570\u636E\u6A21\u578B\u6570\u7EC4\u4E0B\u6807\uFF1A${path10}`);
9735
+ }
9736
+ if (last)
9737
+ parent[offset] = structuredClone(value);
9738
+ else if (offset === parent.length)
9739
+ parent.push({});
9740
+ parent = parent[offset];
9741
+ } else {
9742
+ if (last)
9743
+ parent[segment] = structuredClone(value);
9744
+ else if (!Object.prototype.hasOwnProperty.call(parent, segment))
9745
+ parent[segment] = {};
9746
+ parent = parent[segment];
9747
+ }
9748
+ }
9749
+ }
9750
+ }
9751
+ return new Map(Array.from(models, ([id2, model]) => [id2, inferJsonSchemaFromValue(model)]));
9752
+ }
9753
+ function standardCardBindingModel(message) {
9754
+ const surfaces = standardCardSurfaceSchemas(message);
9755
+ const fields = [];
9756
+ for (const [surfaceId, schema2] of surfaces) {
9757
+ for (const [key2, valueSchema] of Object.entries(schema2.properties)) {
9758
+ const path10 = "/" + [surfaceId, key2].map(encodePointerSegment).join("/");
9759
+ if (!isSafeJsonPointer(path10))
9760
+ throw new Error(`\u65E0\u6548\u7684\u6807\u51C6\u5361\u7ED1\u5B9A\u8DEF\u5F84\uFF1A${path10}`);
9761
+ const type = valueSchema.type;
9762
+ if (type !== "array" && type !== "object" && type !== "string" && type !== "number" && type !== "integer" && type !== "boolean")
9763
+ throw new Error(`\u65E0\u6CD5\u786E\u5B9A\u6807\u51C6\u5361\u5B57\u6BB5\u7C7B\u578B\uFF1A${path10}`);
9764
+ fields.push({
9765
+ fieldId: "field-" + sha256Hex(path10).slice(0, 32),
9766
+ path: path10,
9767
+ label: surfaces.size === 1 ? key2 : surfaceId + " / " + key2,
9768
+ source: "business",
9769
+ required: true,
9770
+ type,
9771
+ valueSchema
9772
+ });
9773
+ }
9774
+ }
9775
+ const schema = {
9776
+ type: "object",
9777
+ properties: Object.fromEntries(surfaces),
9778
+ required: [...surfaces].filter(([, item]) => Object.keys(item.properties).length).map(([id2]) => id2),
9779
+ additionalProperties: false
9780
+ };
9781
+ return { fields, schema };
9782
+ }
9783
+ function renderStandardCardData(message, data) {
9784
+ const datas = message.datas.filter((instruction) => !("updateDataModel" in instruction));
9785
+ const updates = [];
9786
+ for (const [surfaceId, schema] of standardCardSurfaceSchemas(message)) {
9787
+ const value = data[surfaceId] ?? {};
9788
+ const issues = validateJsonSchemaValue2(schema, value);
9789
+ if (issues.length)
9790
+ throw new Error(`\u6807\u51C6\u5361\u6570\u636E\u4E0D\u5339\u914D\uFF1A${surfaceId} ${issues[0].path} ${issues[0].message}`);
9791
+ updates.push({ updateDataModel: { surfaceId, path: "/", value } });
9792
+ }
9793
+ return { ...message, datas: [...datas, ...updates] };
9794
+ }
9795
+ var init_standard_card_data = __esm({
9796
+ "../agent-a2ui-card-contract/dist/esm/standard-card-data.js"() {
9797
+ "use strict";
9798
+ init_json2();
9799
+ init_digest();
9800
+ init_schema2();
9801
+ }
9802
+ });
9803
+
9804
+ // ../agent-a2ui-card-contract/dist/esm/types.js
9805
+ var A2UI_CARD_TRANSFORM_LANGUAGE, A2UI_CARD_TRANSFORM_PROFILE, A2UI_CARD_EXPRESSION_MAX_LENGTH, A2UI_CARD_EXPRESSION_MAX_AST_NODES, A2UI_CARD_EXPRESSION_MAX_AST_DEPTH, A2UI_CARD_DATA_TRANSFORM_LANGUAGE, A2UI_CARD_DATA_TRANSFORM_PROFILE, A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES;
9806
+ var init_types3 = __esm({
9807
+ "../agent-a2ui-card-contract/dist/esm/types.js"() {
9808
+ "use strict";
9809
+ A2UI_CARD_TRANSFORM_LANGUAGE = "jmespath";
9810
+ A2UI_CARD_TRANSFORM_PROFILE = "linkque-structural-v1";
9811
+ A2UI_CARD_EXPRESSION_MAX_LENGTH = 4096;
9812
+ A2UI_CARD_EXPRESSION_MAX_AST_NODES = 512;
9813
+ A2UI_CARD_EXPRESSION_MAX_AST_DEPTH = 32;
9814
+ A2UI_CARD_DATA_TRANSFORM_LANGUAGE = "javascript";
9815
+ A2UI_CARD_DATA_TRANSFORM_PROFILE = "linkque-card-data-transform-v1";
9816
+ A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES = 32 * 1024;
9817
+ }
9818
+ });
9819
+
9820
+ // ../agent-a2ui-card-contract/dist/esm/binding-analyzer.js
9821
+ function analyzeA2UIBindings(protocol) {
9822
+ const issues = [];
9823
+ const occurrences = [];
9824
+ const surfaces = /* @__PURE__ */ new Set();
9825
+ const componentsBySurface = /* @__PURE__ */ new Map();
9826
+ protocol.forEach((message, messageIndex) => {
9827
+ if (!isPlainRecord(message) || !Array.isArray(message.datas)) {
9828
+ issues.push(issue2(`card[${messageIndex}]`, "INVALID_A2UI_MESSAGE", "A2UI message must contain a datas array"));
9829
+ return;
9830
+ }
9831
+ if (message.version !== "0.9") {
9832
+ issues.push(issue2(`card[${messageIndex}].version`, "UNSUPPORTED_PROTOCOL_VERSION", "A2UI card resources must use protocol version 0.9"));
9833
+ }
9834
+ message.datas.forEach((instruction, instructionIndex) => {
9835
+ if (!isPlainRecord(instruction)) {
9836
+ issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}]`, "INVALID_A2UI_INSTRUCTION", "instruction must be an object"));
9837
+ return;
9838
+ }
9839
+ if ("createSurface" in instruction) {
9840
+ if (!isPlainRecord(instruction.createSurface))
9841
+ return;
9842
+ const surfaceId = instruction.createSurface.surfaceId;
9843
+ if (!isSafeIdentifier(surfaceId)) {
9844
+ issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}].createSurface.surfaceId`, "INVALID_SURFACE_ID", "surfaceId must be a non-empty safe identifier"));
9845
+ } else {
9846
+ surfaces.add(surfaceId);
9847
+ }
9848
+ }
9849
+ if ("updateComponents" in instruction) {
9850
+ if (!isPlainRecord(instruction.updateComponents))
9851
+ return;
9852
+ const { surfaceId, components: rawComponents } = instruction.updateComponents;
9853
+ if (!isSafeIdentifier(surfaceId) || !Array.isArray(rawComponents)) {
9854
+ return;
9855
+ }
9856
+ surfaces.add(surfaceId);
9857
+ const components = componentsBySurface.get(surfaceId) ?? [];
9858
+ components.push(...rawComponents.filter((component) => isPlainRecord(component) && typeof component.id === "string" && typeof component.component === "string"));
9859
+ componentsBySurface.set(surfaceId, components);
9860
+ }
9861
+ });
9862
+ });
9863
+ for (const [surfaceId, components] of componentsBySurface) {
9864
+ const componentById = /* @__PURE__ */ new Map();
9865
+ for (const component of components) {
9866
+ if (!isSafeIdentifier(component.id)) {
9867
+ issues.push(issue2(`card.surfaces.${surfaceId}.components`, "INVALID_COMPONENT_ID", "Every component must have a non-empty safe id"));
9868
+ continue;
9869
+ }
9870
+ if (componentById.has(component.id)) {
9871
+ issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}`, "DUPLICATE_COMPONENT_ID", `Component id ${component.id} is duplicated in surface ${surfaceId}`));
9872
+ continue;
9873
+ }
9874
+ componentById.set(component.id, component);
9875
+ }
9876
+ const listRoots = inferListRoots(components, issues);
9877
+ for (const component of components) {
9878
+ const context2 = {
9879
+ surfaceId,
9880
+ component,
9881
+ listRoot: listRoots.get(component.id),
9882
+ occurrences,
9883
+ issues
9884
+ };
9885
+ visitValue(component, "", context2);
9886
+ const children = component.children;
9887
+ if (isPlainRecord(children) && typeof children.path === "string") {
9888
+ const canonicalPath = canonicalizeBindingPath(children.path, context2.listRoot);
9889
+ if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
9890
+ issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}.children.path`, "INVALID_BINDING_PATH", `Invalid list path ${children.path}`));
9891
+ } else {
9892
+ occurrences.push({
9893
+ surfaceId,
9894
+ componentId: component.id,
9895
+ componentName: component.component,
9896
+ propertyPath: "children.path",
9897
+ rawPath: children.path,
9898
+ canonicalPath,
9899
+ ...context2.listRoot ? { listRoot: context2.listRoot } : {},
9900
+ usage: "list"
9901
+ });
9902
+ }
9903
+ }
9904
+ }
9905
+ }
9906
+ return {
9907
+ surfaceIds: [...surfaces],
9908
+ surfaceId: surfaces.size === 1 ? [...surfaces][0] : void 0,
9909
+ occurrences,
9910
+ issues
9911
+ };
9912
+ }
9913
+ function collectReferencedA2UICardBusinessFieldIds(protocol, fields) {
9914
+ const businessFields = fields.filter((field) => field.source === "business").slice().sort((left, right) => right.path.length - left.path.length);
9915
+ const result = /* @__PURE__ */ new Set();
9916
+ for (const occurrence of analyzeA2UIBindings(protocol).occurrences) {
9917
+ const field = businessFields.find((candidate) => occurrence.canonicalPath === candidate.path || occurrence.canonicalPath.startsWith(`${candidate.path}/*/`) || occurrence.canonicalPath.startsWith(`${candidate.path}/`));
9918
+ if (field)
9919
+ result.add(field.fieldId);
9920
+ }
9921
+ return result;
9922
+ }
9923
+ function visitValue(value, propertyPath, context2) {
9924
+ if (propertyPath === "action.local.path" && typeof value === "string") {
9925
+ addOccurrence(value, propertyPath, "local", context2);
9926
+ return;
9927
+ }
9928
+ if (Array.isArray(value)) {
9929
+ value.forEach((entry, index2) => {
9930
+ visitValue(entry, appendProperty(propertyPath, String(index2)), context2);
9931
+ });
9932
+ return;
9933
+ }
9934
+ if (!isPlainRecord(value))
9935
+ return;
9936
+ const keys3 = Object.keys(value);
9937
+ const isStrictBinding2 = keys3.length === 1 && typeof value.path === "string";
9938
+ const isDisplayBinding2 = DISPLAY_BINDING_PROPERTIES.has(propertyPath) && keys3.every((key2) => key2 === "path" || key2 === "fallback") && typeof value.path === "string";
9939
+ if (isStrictBinding2 || isDisplayBinding2) {
9940
+ addOccurrence(value.path, propertyPath, bindingUsage(context2.component.component, propertyPath), context2);
9941
+ return;
9942
+ }
9943
+ for (const [key2, entry] of Object.entries(value)) {
9944
+ if (propertyPath === "" && (key2 === "children" || key2 === "id" || key2 === "component")) {
9945
+ continue;
9946
+ }
9947
+ visitValue(entry, appendProperty(propertyPath, key2), context2);
9948
+ }
9949
+ }
9950
+ function addOccurrence(rawPath, propertyPath, usage, context2) {
9951
+ const canonicalPath = canonicalizeBindingPath(rawPath, context2.listRoot);
9952
+ if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
9953
+ context2.issues.push(issue2(`card.components.${context2.component.id}.${propertyPath}`, "INVALID_BINDING_PATH", `Invalid binding path ${rawPath}`));
9954
+ return;
9955
+ }
9956
+ context2.occurrences.push({
9957
+ surfaceId: context2.surfaceId,
9958
+ componentId: context2.component.id,
9959
+ componentName: context2.component.component,
9960
+ propertyPath,
9961
+ rawPath,
9962
+ canonicalPath,
9963
+ ...context2.listRoot ? { listRoot: context2.listRoot } : {},
9964
+ usage
9965
+ });
9966
+ }
9967
+ function bindingUsage(componentName, propertyPath) {
9968
+ if (propertyPath.startsWith("action.event."))
9969
+ return "event";
9970
+ if (propertyPath.startsWith("action.local."))
9971
+ return "local";
9972
+ if (INPUT_COMPONENTS.has(componentName) && (propertyPath === "value" || propertyPath.endsWith(".value"))) {
9973
+ return "input";
9974
+ }
9975
+ return "display";
9976
+ }
9977
+ function inferListRoots(components, issues) {
9978
+ const result = /* @__PURE__ */ new Map();
9979
+ const byId = new Map(components.map((component) => [component.id, component]));
9980
+ const queue = [];
9981
+ const assign = (childId, listRoot, ownerId) => {
9982
+ const existing = result.get(childId);
9983
+ if (existing && existing !== listRoot) {
9984
+ issues.push(issue2(`card.components.${ownerId}.children`, "AMBIGUOUS_LIST_CONTEXT", `Component ${childId} is reused by multiple list roots`));
9985
+ return;
9986
+ }
9987
+ if (!existing) {
9988
+ result.set(childId, listRoot);
9989
+ queue.push(childId);
9990
+ }
9991
+ };
9992
+ for (const component of components) {
9993
+ const children = component.children;
9994
+ if (!isPlainRecord(children) || typeof children.componentId !== "string" || typeof children.path !== "string") {
9995
+ continue;
9996
+ }
9997
+ if (children.path.startsWith("."))
9998
+ continue;
9999
+ const canonicalPath = canonicalizeBindingPath(children.path);
10000
+ if (!canonicalPath || !isSafeJsonPointer(canonicalPath))
10001
+ continue;
10002
+ assign(children.componentId, canonicalPath, component.id);
10003
+ }
10004
+ const visited2 = /* @__PURE__ */ new Set();
10005
+ while (queue.length > 0) {
10006
+ const componentId = queue.shift();
10007
+ if (visited2.has(componentId))
10008
+ continue;
10009
+ visited2.add(componentId);
10010
+ const component = byId.get(componentId);
10011
+ const listRoot = result.get(componentId);
10012
+ if (!component || !listRoot)
10013
+ continue;
10014
+ const templatedChildren = component.children;
10015
+ if (isPlainRecord(templatedChildren) && typeof templatedChildren.componentId === "string" && typeof templatedChildren.path === "string") {
10016
+ const nestedRoot = canonicalizeBindingPath(templatedChildren.path, listRoot);
10017
+ if (nestedRoot && isSafeJsonPointer(nestedRoot, true)) {
10018
+ assign(templatedChildren.componentId, nestedRoot, componentId);
10019
+ }
10020
+ }
10021
+ const childIds = [
10022
+ ...typeof component.child === "string" ? [component.child] : [],
10023
+ ...Array.isArray(component.children) ? component.children.filter((entry) => typeof entry === "string") : []
10024
+ ];
10025
+ for (const childId of childIds) {
10026
+ assign(childId, listRoot, componentId);
10027
+ }
10028
+ }
10029
+ return result;
10030
+ }
10031
+ function appendProperty(base, segment) {
10032
+ return base ? `${base}.${segment}` : segment;
10033
+ }
10034
+ var INPUT_COMPONENTS, DISPLAY_BINDING_PROPERTIES;
10035
+ var init_binding_analyzer = __esm({
10036
+ "../agent-a2ui-card-contract/dist/esm/binding-analyzer.js"() {
10037
+ "use strict";
10038
+ init_json2();
10039
+ INPUT_COMPONENTS = /* @__PURE__ */ new Set(["ChoicePicker", "Stepper", "TextField"]);
10040
+ DISPLAY_BINDING_PROPERTIES = /* @__PURE__ */ new Set(["alt", "label", "src", "text"]);
10041
+ }
10042
+ });
10043
+
9785
10044
  // ../agent-a2ui-card-contract/dist/esm/expression.js
9786
10045
  function getA2UICardTransformIssues(value, path10 = "transform") {
9787
10046
  if (!isPlainRecord(value)) {
@@ -9869,7 +10128,7 @@ var init_expression = __esm({
9869
10128
  import_jmespath2 = __toESM(require_jmespath(), 1);
9870
10129
  init_json2();
9871
10130
  init_schema2();
9872
- init_types2();
10131
+ init_types3();
9873
10132
  ALLOWED_AST_TYPES2 = /* @__PURE__ */ new Set([
9874
10133
  "Current",
9875
10134
  "Field",
@@ -10804,7 +11063,10 @@ function getA2UICardResourceConfigIssues(value) {
10804
11063
  validateResolverCoverage(fields, resolver, issues, card);
10805
11064
  return issues;
10806
11065
  }
10807
- function getA2UICardResourceConfigV4PipelineIssues(value) {
11066
+ function getStandardCardExecutionIssues(value) {
11067
+ return value.dataMode === "pipeline" ? getA2UICardResourceConfigV4PipelineIssues(value, true) : getA2UICardResourceConfigV3Issues(value, true);
11068
+ }
11069
+ function getA2UICardResourceConfigV4PipelineIssues(value, standard = false) {
10808
11070
  const issues = [];
10809
11071
  exactKeys(value, [
10810
11072
  "schemaVersion",
@@ -10843,7 +11105,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
10843
11105
  }
10844
11106
  validateDataTransform(value.dataTransform, "config.dataTransform", issues);
10845
11107
  const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, "config.dataModelSchema", issues);
10846
- const card = validateTemplate(value.a2uiTemplate, fields, issues);
11108
+ const card = standard ? void 0 : validateTemplate(value.a2uiTemplate, fields, issues);
10847
11109
  if (card) {
10848
11110
  issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"), ...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
10849
11111
  }
@@ -10855,7 +11117,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
10855
11117
  }
10856
11118
  return issues;
10857
11119
  }
10858
- function getA2UICardResourceConfigV3Issues(value) {
11120
+ function getA2UICardResourceConfigV3Issues(value, standard = false) {
10859
11121
  const issues = [];
10860
11122
  if (value.actionBindings !== void 0) {
10861
11123
  issues.push(issue2("config.actionBindings", "LEGACY_PAYMENT_ACTION_BINDINGS_UNSUPPORTED", "payment actions must be defined inline in card JSON"));
@@ -10888,7 +11150,7 @@ function getA2UICardResourceConfigV3Issues(value) {
10888
11150
  }
10889
11151
  const dataSources = validateDataSources(value.dataSources, "config.dataSources", issues);
10890
11152
  const bindings = validateV3OutputBindings(value.bindings, "config.bindings", issues);
10891
- const card = validateTemplate(value.a2uiTemplate, fields, issues);
11153
+ const card = standard ? void 0 : validateTemplate(value.a2uiTemplate, fields, issues);
10892
11154
  if (value.schemaVersion === "4" && card) {
10893
11155
  issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"));
10894
11156
  issues.push(...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
@@ -11501,7 +11763,7 @@ var init_validation = __esm({
11501
11763
  init_binding_analyzer();
11502
11764
  init_json2();
11503
11765
  init_schema2();
11504
- init_types2();
11766
+ init_types3();
11505
11767
  init_binding_context();
11506
11768
  init_v4Catalog();
11507
11769
  init_pipeline_input();
@@ -11734,14 +11996,6 @@ var init_resolver = __esm({
11734
11996
  }
11735
11997
  });
11736
11998
 
11737
- // ../agent-a2ui-card-contract/dist/esm/digest.js
11738
- var init_digest = __esm({
11739
- "../agent-a2ui-card-contract/dist/esm/digest.js"() {
11740
- "use strict";
11741
- init_json2();
11742
- }
11743
- });
11744
-
11745
11999
  // ../agent-a2ui-card-contract/dist/esm/preview-binding.js
11746
12000
  var init_preview_binding = __esm({
11747
12001
  "../agent-a2ui-card-contract/dist/esm/preview-binding.js"() {
@@ -12002,7 +12256,8 @@ var init_esm3 = __esm({
12002
12256
  "../agent-a2ui-card-contract/dist/esm/index.js"() {
12003
12257
  "use strict";
12004
12258
  init_protocol();
12005
- init_types2();
12259
+ init_standard_card_data();
12260
+ init_types3();
12006
12261
  init_json2();
12007
12262
  init_binding_analyzer();
12008
12263
  init_schema2();
@@ -12173,7 +12428,7 @@ async function executeCardPresentation(resource, registry2, runtimeContext, args
12173
12428
  return createPresentationResult(resource, config2, viewModel);
12174
12429
  }
12175
12430
  async function executeCardPresentationFromSources(resource, runtimeContext, sourceResults, signal, cardProvider) {
12176
- const config2 = parseCardConfig(resource);
12431
+ const config2 = await resolveStandardCardExecution(resource, parseCardConfig(resource), cardProvider, signal);
12177
12432
  if (config2.schemaVersion !== "3" && config2.schemaVersion !== "4") {
12178
12433
  throw new Error("Source-result rendering is only available for schema v3/v4 cards");
12179
12434
  }
@@ -12242,7 +12497,13 @@ async function executeCardPresentationFromSources(resource, runtimeContext, sour
12242
12497
  }
12243
12498
  async function createPresentationResult(resource, config2, viewModel, cardProvider, signal) {
12244
12499
  const content = config2.a2uiTemplate.content ?? await cardProvider.loadDefinition(resource.resourceId, signal);
12245
- const protocol = injectResolvedViewModel(JSON.parse(content), viewModel);
12500
+ const standardCard = "format" in resource.config && resource.config.format === "alipay-a2ui";
12501
+ const payload = standardCard ? {
12502
+ format: "alipay-a2ui",
12503
+ protocol: renderStandardCardData(JSON.parse(content), viewModel)
12504
+ } : {
12505
+ protocol: injectResolvedViewModel(JSON.parse(content), viewModel)
12506
+ };
12246
12507
  const cardInstanceId = `card-instance-${(0, import_node_crypto3.randomUUID)()}`;
12247
12508
  const receipt = {
12248
12509
  version: 1,
@@ -12261,7 +12522,7 @@ async function createPresentationResult(resource, config2, viewModel, cardProvid
12261
12522
  card: {
12262
12523
  type: "a2ui_card",
12263
12524
  itemId: cardInstanceId,
12264
- payload: { protocol },
12525
+ payload,
12265
12526
  metadata: {
12266
12527
  cardRef: resource.resourceId,
12267
12528
  cardRevision: config2.revision,
@@ -12291,6 +12552,13 @@ function projectPresentationReceiptForModel(receipt) {
12291
12552
  };
12292
12553
  }
12293
12554
  function parseCardConfig(resource) {
12555
+ if ("format" in resource.config && resource.config.format === "alipay-a2ui") {
12556
+ const stored = resource.config;
12557
+ if (stored.schemaVersion !== "4" || !stored.revision || !Array.isArray(stored.dataSources))
12558
+ throw new Error("\u6807\u51C6\u5361\u5C1A\u672A\u914D\u7F6E\u6267\u884C\u53C2\u6570");
12559
+ const a2uiTemplate = { content: "", argsSchema: {} };
12560
+ return stored.dataMode === "pipeline" ? { ...stored, fields: [], a2uiTemplate, dataModelSchema: {} } : { ...stored, fields: [], a2uiTemplate };
12561
+ }
12294
12562
  if ("definitionRef" in resource.config && resource.config.schemaVersion === "4")
12295
12563
  return resource.config;
12296
12564
  const parsed = parseA2UICardResourceConfig(resource.config);
@@ -12299,6 +12567,25 @@ function parseCardConfig(resource) {
12299
12567
  }
12300
12568
  return parsed.data;
12301
12569
  }
12570
+ async function resolveStandardCardExecution(resource, config2, provider, signal) {
12571
+ if (!("format" in resource.config) || resource.config.format !== "alipay-a2ui")
12572
+ return config2;
12573
+ if (!provider)
12574
+ throw new Error("\u6807\u51C6\u5361\u7F3A\u5C11\u7ED3\u6784\u8BFB\u53D6\u670D\u52A1");
12575
+ const content = await provider.loadDefinition(resource.resourceId, signal);
12576
+ const { fields, schema } = standardCardBindingModel(JSON.parse(content));
12577
+ const issues = getStandardCardExecutionIssues({
12578
+ ...resource.config,
12579
+ fields,
12580
+ dataModelSchema: schema
12581
+ });
12582
+ if (issues.length)
12583
+ throw new Error(issues.map((issue4) => issue4.message).join("\uFF1B"));
12584
+ const a2uiTemplate = { content, argsSchema: schema };
12585
+ if (config2.schemaVersion === "4" && config2.dataMode === "pipeline")
12586
+ return { ...config2, fields, a2uiTemplate, dataModelSchema: schema };
12587
+ return { ...config2, fields, a2uiTemplate };
12588
+ }
12302
12589
  function isAgentPresentationToolResult(value) {
12303
12590
  if (!isJsonObject(value))
12304
12591
  return false;
@@ -96719,8 +97006,8 @@ Content-Type: ${partContentType}\r
96719
97006
  static mergeHeaders(base, ...append) {
96720
97007
  base = base instanceof Headers ? base : new Headers(base);
96721
97008
  for (const headers of append) {
96722
- const add = headers instanceof Headers ? headers : new Headers(headers);
96723
- add.forEach((value, key2) => {
97009
+ const add2 = headers instanceof Headers ? headers : new Headers(headers);
97010
+ add2.forEach((value, key2) => {
96724
97011
  key2 === "set-cookie" ? base.append(key2, value) : base.set(key2, value);
96725
97012
  });
96726
97013
  }
@@ -219949,7 +220236,7 @@ var require_YAMLMap = __commonJS({
219949
220236
  static from(schema, obj, ctx) {
219950
220237
  const { keepUndefined, replacer } = ctx;
219951
220238
  const map2 = new this(schema);
219952
- const add = (key2, value) => {
220239
+ const add2 = (key2, value) => {
219953
220240
  if (typeof replacer === "function")
219954
220241
  value = replacer.call(obj, key2, value);
219955
220242
  else if (Array.isArray(replacer) && !replacer.includes(key2))
@@ -219959,10 +220246,10 @@ var require_YAMLMap = __commonJS({
219959
220246
  };
219960
220247
  if (obj instanceof Map) {
219961
220248
  for (const [key2, value] of obj)
219962
- add(key2, value);
220249
+ add2(key2, value);
219963
220250
  } else if (obj && typeof obj === "object") {
219964
220251
  for (const key2 of Object.keys(obj))
219965
- add(key2, obj[key2]);
220252
+ add2(key2, obj[key2]);
219966
220253
  }
219967
220254
  if (typeof schema.sortMapEntries === "function") {
219968
220255
  map2.items.sort(schema.sortMapEntries);
@@ -229072,7 +229359,7 @@ var init_cardRenderMcpServer = __esm({
229072
229359
  try {
229073
229360
  const result = await executeCardDataPipeline({
229074
229361
  resource,
229075
- config: config2,
229362
+ config: await resolveStandardCardExecution(resource, config2, this.cardProvider, signal),
229076
229363
  cardProvider: this.cardProvider,
229077
229364
  registry: this.registry,
229078
229365
  runtimeContext: this.runtimeContext,
@@ -229177,6 +229464,7 @@ var init_cardRenderMcpServer = __esm({
229177
229464
  const missingDependencies = (source.dependsOn ?? []).filter((dependency) => !state2.results.has(dependency));
229178
229465
  if (missingDependencies.length)
229179
229466
  throw new Error(`\u6570\u636E\u6E90 ${source.sourceId} \u9700\u8981\u5148\u5B8C\u6210\u4EE5\u4E0B\u4F9D\u8D56\uFF1A${missingDependencies.join(", ")}`);
229467
+ const { fields } = await resolveStandardCardExecution(resource, config2, this.cardProvider, signal);
229180
229468
  const handle = discoveredHandle ?? await this.registry.resolve(source.mcpResourceId, source.toolName, signal);
229181
229469
  if (!handle)
229182
229470
  throw new Error(`MCP \u5DE5\u5177 ${source.mcpResourceId}/${source.toolName} \u5F53\u524D\u4E0D\u53EF\u7528`);
@@ -229188,7 +229476,7 @@ var init_cardRenderMcpServer = __esm({
229188
229476
  const structured = readStructuredContent(result);
229189
229477
  if (structured === void 0) {
229190
229478
  const binding = config2.bindings.find((candidate) => candidate.sourceId === source.sourceId);
229191
- const field = config2.fields.find((candidate) => candidate.fieldId === binding?.fieldId);
229479
+ const field = fields.find((candidate) => candidate.fieldId === binding?.fieldId);
229192
229480
  throw new CardMappingError({
229193
229481
  code: "MCP_RESULT_UNSUPPORTED",
229194
229482
  cardId: resource.resourceId,
@@ -229203,7 +229491,7 @@ var init_cardRenderMcpServer = __esm({
229203
229491
  const projectionStartedAt = Date.now();
229204
229492
  const completedSourceIds = new Set(state2.results.keys());
229205
229493
  const { receipt, cacheEntry } = await createCardSourceReceipt({
229206
- config: config2,
229494
+ config: { ...config2, fields },
229207
229495
  cardId: resource.resourceId,
229208
229496
  sourceId: source.sourceId,
229209
229497
  raw: structured,
@@ -238708,10 +238996,10 @@ var inflt = function(dat, st, buf, dict) {
238708
238996
  lpos = pos, lm = null;
238709
238997
  break;
238710
238998
  } else {
238711
- var add = sym - 254;
238999
+ var add2 = sym - 254;
238712
239000
  if (sym > 264) {
238713
239001
  var i2 = sym - 257, b = fleb[i2];
238714
- add = bits(dat, pos, (1 << b) - 1) + fl[i2];
239002
+ add2 = bits(dat, pos, (1 << b) - 1) + fl[i2];
238715
239003
  pos += b;
238716
239004
  }
238717
239005
  var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
@@ -238730,7 +239018,7 @@ var inflt = function(dat, st, buf, dict) {
238730
239018
  }
238731
239019
  if (resize)
238732
239020
  cbuf(bt + 131072);
238733
- var end = bt + add;
239021
+ var end = bt + add2;
238734
239022
  if (bt < dt) {
238735
239023
  var shift = dl - dt, dend = Math.min(dt, end);
238736
239024
  if (shift + bt < 0)