linkque-cli-v2 1.6.22 → 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/linkquejs.js CHANGED
@@ -34500,9 +34500,19 @@ function splitAgentCards(input) {
34500
34500
  for (const resource of config3.agent.resources ?? []) {
34501
34501
  if (resource.resourceType !== "CARD")
34502
34502
  continue;
34503
+ const { config: inline } = resource;
34504
+ const directory = `cards/${encodeURIComponent(resource.resourceId)}/${contentChecksum(inline)}`;
34505
+ const definitionRef = `${directory}/card.json`;
34506
+ const bindingRef = `${directory}/binding.json`;
34507
+ if (inline.format === "alipay-a2ui") {
34508
+ const { protocol, ...binding2 } = inline;
34509
+ files[definitionRef] = { format: inline.format, protocol };
34510
+ files[bindingRef] = { ...binding2, definitionRef };
34511
+ resource.config = { format: inline.format, bindingRef };
34512
+ continue;
34513
+ }
34503
34514
  if (resource.config.schemaVersion !== "4")
34504
34515
  throw new Error("\u5361\u7247\u5B58\u50A8\u53EA\u652F\u6301 V4");
34505
- const directory = `cards/${encodeURIComponent(resource.resourceId)}/${contentChecksum(resource.config)}`;
34506
34516
  const template = resource.config.a2uiTemplate;
34507
34517
  const definition = {
34508
34518
  format: "linkque-a2ui",
@@ -34510,12 +34520,12 @@ function splitAgentCards(input) {
34510
34520
  };
34511
34521
  const binding = {
34512
34522
  ...resource.config,
34513
- definitionRef: `${directory}/card.json`,
34523
+ definitionRef,
34514
34524
  a2uiTemplate: { argsSchema: template.argsSchema }
34515
34525
  };
34516
- files[`${directory}/card.json`] = definition;
34517
- files[`${directory}/binding.json`] = binding;
34518
- resource.config = { bindingRef: `${directory}/binding.json` };
34526
+ files[definitionRef] = definition;
34527
+ files[bindingRef] = binding;
34528
+ resource.config = { bindingRef };
34519
34529
  }
34520
34530
  return { config: config3, files };
34521
34531
  }
@@ -34525,6 +34535,8 @@ async function hydrateAgentCards(input, readJson) {
34525
34535
  if (resource.resourceType !== "CARD")
34526
34536
  continue;
34527
34537
  if (!("bindingRef" in resource.config)) {
34538
+ if (resource.config.format === "alipay-a2ui")
34539
+ continue;
34528
34540
  if (resource.config.schemaVersion !== "4")
34529
34541
  throw new Error("\u5361\u7247\u5B58\u50A8\u53EA\u652F\u6301 V4");
34530
34542
  const template = resource.config.a2uiTemplate;
@@ -34536,16 +34548,26 @@ async function hydrateAgentCards(input, readJson) {
34536
34548
  assertCardPath(binding.definitionRef);
34537
34549
  const definition = await readJson(binding.definitionRef);
34538
34550
  const { definitionRef: _ref, ...execution } = binding;
34539
- resource.config = {
34540
- ...execution,
34541
- a2uiTemplate: {
34542
- ...execution.a2uiTemplate,
34543
- content: canonicalJson(definition.protocol)
34544
- }
34545
- };
34551
+ resource.config = inlineCard(execution, definition);
34546
34552
  }
34547
34553
  return config3;
34548
34554
  }
34555
+ function inlineCard(binding, definition) {
34556
+ if (definition.format === "alipay-a2ui") {
34557
+ return {
34558
+ ...binding,
34559
+ format: definition.format,
34560
+ protocol: definition.protocol
34561
+ };
34562
+ }
34563
+ return {
34564
+ ...binding,
34565
+ a2uiTemplate: {
34566
+ ...binding.a2uiTemplate,
34567
+ content: canonicalJson(definition.protocol)
34568
+ }
34569
+ };
34570
+ }
34549
34571
 
34550
34572
  // src/utils/files.ts
34551
34573
  var import_crypto = require("crypto");
@@ -38454,16 +38476,6 @@ var EHookExecutorName;
38454
38476
  // ../agent-a2ui-card-contract/dist/esm/protocol.js
38455
38477
  var LINKQUE_A2UI_V4_CATALOG_ID = "urn:linkque:a2ui:runtime:4";
38456
38478
 
38457
- // ../agent-a2ui-card-contract/dist/esm/types.js
38458
- var A2UI_CARD_TRANSFORM_LANGUAGE = "jmespath";
38459
- var A2UI_CARD_TRANSFORM_PROFILE = "linkque-structural-v1";
38460
- var A2UI_CARD_EXPRESSION_MAX_LENGTH = 4096;
38461
- var A2UI_CARD_EXPRESSION_MAX_AST_NODES = 512;
38462
- var A2UI_CARD_EXPRESSION_MAX_AST_DEPTH = 32;
38463
- var A2UI_CARD_DATA_TRANSFORM_LANGUAGE = "javascript";
38464
- var A2UI_CARD_DATA_TRANSFORM_PROFILE = "linkque-card-data-transform-v1";
38465
- var A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES = 32 * 1024;
38466
-
38467
38479
  // ../linkque-agent-data-binding-contract/dist/esm/json.js
38468
38480
  var BLOCKED_PATH_SEGMENTS = /* @__PURE__ */ new Set([
38469
38481
  "__proto__",
@@ -38563,222 +38575,145 @@ function issue2(path28, code, message) {
38563
38575
  function exactKeys(value, allowed, path28, issues) {
38564
38576
  }
38565
38577
 
38566
- // ../agent-a2ui-card-contract/dist/esm/binding-analyzer.js
38567
- var INPUT_COMPONENTS = /* @__PURE__ */ new Set(["ChoicePicker", "Stepper", "TextField"]);
38568
- function analyzeA2UIBindings(protocol) {
38569
- const issues = [];
38570
- const occurrences = [];
38571
- const surfaces = /* @__PURE__ */ new Set();
38572
- const componentsBySurface = /* @__PURE__ */ new Map();
38573
- protocol.forEach((message, messageIndex) => {
38574
- if (!isPlainRecord(message) || !Array.isArray(message.datas)) {
38575
- issues.push(issue2(`card[${messageIndex}]`, "INVALID_A2UI_MESSAGE", "A2UI message must contain a datas array"));
38576
- return;
38577
- }
38578
- if (message.version !== "0.9") {
38579
- issues.push(issue2(`card[${messageIndex}].version`, "UNSUPPORTED_PROTOCOL_VERSION", "A2UI card resources must use protocol version 0.9"));
38578
+ // ../agent-a2ui-card-contract/dist/esm/digest.js
38579
+ function sha256Hex(value) {
38580
+ const bytes = new TextEncoder().encode(value);
38581
+ const words = [];
38582
+ for (let index = 0; index < bytes.length; index += 1) {
38583
+ words[index >> 2] = (words[index >> 2] ?? 0) | bytes[index] << 24 - index % 4 * 8;
38584
+ }
38585
+ const bitLength = bytes.length * 8;
38586
+ words[bitLength >> 5] = (words[bitLength >> 5] ?? 0) | 128 << 24 - bitLength % 32;
38587
+ words[(bitLength + 64 >> 9 << 4) + 15] = bitLength;
38588
+ const constants2 = SHA256_CONSTANTS;
38589
+ let state = [
38590
+ 1779033703,
38591
+ 3144134277,
38592
+ 1013904242,
38593
+ 2773480762,
38594
+ 1359893119,
38595
+ 2600822924,
38596
+ 528734635,
38597
+ 1541459225
38598
+ ];
38599
+ for (let offset = 0; offset < words.length; offset += 16) {
38600
+ const schedule = Array.from({ length: 64 }, () => 0);
38601
+ for (let index = 0; index < 16; index += 1) {
38602
+ schedule[index] = words[offset + index] ?? 0;
38580
38603
  }
38581
- message.datas.forEach((instruction, instructionIndex) => {
38582
- if (!isPlainRecord(instruction)) {
38583
- issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}]`, "INVALID_A2UI_INSTRUCTION", "instruction must be an object"));
38584
- return;
38585
- }
38586
- if ("createSurface" in instruction) {
38587
- if (!isPlainRecord(instruction.createSurface))
38588
- return;
38589
- const surfaceId = instruction.createSurface.surfaceId;
38590
- if (!isSafeIdentifier(surfaceId)) {
38591
- issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}].createSurface.surfaceId`, "INVALID_SURFACE_ID", "surfaceId must be a non-empty safe identifier"));
38592
- } else {
38593
- surfaces.add(surfaceId);
38594
- }
38595
- }
38596
- if ("updateComponents" in instruction) {
38597
- if (!isPlainRecord(instruction.updateComponents))
38598
- return;
38599
- const { surfaceId, components: rawComponents } = instruction.updateComponents;
38600
- if (!isSafeIdentifier(surfaceId) || !Array.isArray(rawComponents)) {
38601
- return;
38602
- }
38603
- surfaces.add(surfaceId);
38604
- const components = componentsBySurface.get(surfaceId) ?? [];
38605
- components.push(...rawComponents.filter((component) => isPlainRecord(component) && typeof component.id === "string" && typeof component.component === "string"));
38606
- componentsBySurface.set(surfaceId, components);
38607
- }
38608
- });
38609
- });
38610
- for (const [surfaceId, components] of componentsBySurface) {
38611
- const componentById = /* @__PURE__ */ new Map();
38612
- for (const component of components) {
38613
- if (!isSafeIdentifier(component.id)) {
38614
- issues.push(issue2(`card.surfaces.${surfaceId}.components`, "INVALID_COMPONENT_ID", "Every component must have a non-empty safe id"));
38615
- continue;
38616
- }
38617
- if (componentById.has(component.id)) {
38618
- issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}`, "DUPLICATE_COMPONENT_ID", `Component id ${component.id} is duplicated in surface ${surfaceId}`));
38619
- continue;
38620
- }
38621
- componentById.set(component.id, component);
38604
+ for (let index = 16; index < 64; index += 1) {
38605
+ const left = schedule[index - 15];
38606
+ const right = schedule[index - 2];
38607
+ const s0 = rotateRight(left, 7) ^ rotateRight(left, 18) ^ left >>> 3;
38608
+ const s1 = rotateRight(right, 17) ^ rotateRight(right, 19) ^ right >>> 10;
38609
+ schedule[index] = add(schedule[index - 16], s0, schedule[index - 7], s1);
38622
38610
  }
38623
- const listRoots = inferListRoots(components, issues);
38624
- for (const component of components) {
38625
- const context = {
38626
- surfaceId,
38627
- component,
38628
- listRoot: listRoots.get(component.id),
38629
- occurrences,
38630
- issues
38631
- };
38632
- visitValue(component, "", context);
38633
- const children = component.children;
38634
- if (isPlainRecord(children) && typeof children.path === "string") {
38635
- const canonicalPath = canonicalizeBindingPath(children.path, context.listRoot);
38636
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
38637
- issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}.children.path`, "INVALID_BINDING_PATH", `Invalid list path ${children.path}`));
38638
- } else {
38639
- occurrences.push({
38640
- surfaceId,
38641
- componentId: component.id,
38642
- componentName: component.component,
38643
- propertyPath: "children.path",
38644
- rawPath: children.path,
38645
- canonicalPath,
38646
- ...context.listRoot ? { listRoot: context.listRoot } : {},
38647
- usage: "list"
38648
- });
38649
- }
38650
- }
38611
+ let [a, b3, c, d, e3, f3, g2, h] = state;
38612
+ for (let index = 0; index < 64; index += 1) {
38613
+ const sum1 = rotateRight(e3, 6) ^ rotateRight(e3, 11) ^ rotateRight(e3, 25);
38614
+ const choice = e3 & f3 ^ ~e3 & g2;
38615
+ const temporary1 = add(h, sum1, choice, constants2[index], schedule[index]);
38616
+ const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
38617
+ const majority = a & b3 ^ a & c ^ b3 & c;
38618
+ const temporary2 = add(sum0, majority);
38619
+ h = g2;
38620
+ g2 = f3;
38621
+ f3 = e3;
38622
+ e3 = add(d, temporary1);
38623
+ d = c;
38624
+ c = b3;
38625
+ b3 = a;
38626
+ a = add(temporary1, temporary2);
38651
38627
  }
38628
+ state = state.map((v2, index) => add(v2, [a, b3, c, d, e3, f3, g2, h][index]));
38652
38629
  }
38653
- return {
38654
- surfaceIds: [...surfaces],
38655
- surfaceId: surfaces.size === 1 ? [...surfaces][0] : void 0,
38656
- occurrences,
38657
- issues
38658
- };
38630
+ return state.map((v2) => (v2 >>> 0).toString(16).padStart(8, "0")).join("");
38659
38631
  }
38660
- function collectReferencedA2UICardBusinessFieldIds(protocol, fields) {
38661
- const businessFields = fields.filter((field) => field.source === "business").slice().sort((left, right) => right.path.length - left.path.length);
38662
- const result = /* @__PURE__ */ new Set();
38663
- for (const occurrence of analyzeA2UIBindings(protocol).occurrences) {
38664
- const field = businessFields.find((candidate) => occurrence.canonicalPath === candidate.path || occurrence.canonicalPath.startsWith(`${candidate.path}/*/`) || occurrence.canonicalPath.startsWith(`${candidate.path}/`));
38665
- if (field)
38666
- result.add(field.fieldId);
38667
- }
38668
- return result;
38632
+ function createA2UICardDraftStructureChecksum(draft) {
38633
+ const cloned = JSON.parse(JSON.stringify(draft));
38634
+ delete cloned.manifest.bindings;
38635
+ return sha256Hex(stableJsonStringify(cloned));
38669
38636
  }
38670
- function visitValue(value, propertyPath, context) {
38671
- if (propertyPath === "action.local.path" && typeof value === "string") {
38672
- addOccurrence(value, propertyPath, "local", context);
38673
- return;
38674
- }
38675
- if (Array.isArray(value)) {
38676
- value.forEach((entry, index) => {
38677
- visitValue(entry, appendProperty(propertyPath, String(index)), context);
38678
- });
38679
- return;
38680
- }
38681
- if (!isPlainRecord(value))
38682
- return;
38683
- const keys2 = Object.keys(value);
38684
- const isStrictBinding2 = keys2.length === 1 && typeof value.path === "string";
38685
- const isDisplayBinding2 = DISPLAY_BINDING_PROPERTIES.has(propertyPath) && keys2.every((key) => key === "path" || key === "fallback") && typeof value.path === "string";
38686
- if (isStrictBinding2 || isDisplayBinding2) {
38687
- addOccurrence(value.path, propertyPath, bindingUsage(context.component.component, propertyPath), context);
38688
- return;
38689
- }
38690
- for (const [key, entry] of Object.entries(value)) {
38691
- if (propertyPath === "" && (key === "children" || key === "id" || key === "component")) {
38692
- continue;
38693
- }
38694
- visitValue(entry, appendProperty(propertyPath, key), context);
38695
- }
38637
+ function createA2UICardMcpConfigChecksum(resources) {
38638
+ return sha256Hex(stableJsonStringify(resources));
38696
38639
  }
38697
- var DISPLAY_BINDING_PROPERTIES = /* @__PURE__ */ new Set(["alt", "label", "src", "text"]);
38698
- function addOccurrence(rawPath, propertyPath, usage, context) {
38699
- const canonicalPath = canonicalizeBindingPath(rawPath, context.listRoot);
38700
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
38701
- context.issues.push(issue2(`card.components.${context.component.id}.${propertyPath}`, "INVALID_BINDING_PATH", `Invalid binding path ${rawPath}`));
38702
- return;
38703
- }
38704
- context.occurrences.push({
38705
- surfaceId: context.surfaceId,
38706
- componentId: context.component.id,
38707
- componentName: context.component.component,
38708
- propertyPath,
38709
- rawPath,
38710
- canonicalPath,
38711
- ...context.listRoot ? { listRoot: context.listRoot } : {},
38712
- usage
38713
- });
38640
+ function createA2UICardRevision(draftChecksum2, bindings) {
38641
+ const digest = sha256Hex(`${draftChecksum2}
38642
+ ${stableJsonStringify(bindings)}`);
38643
+ return `card-${digest.slice(0, 24)}`;
38714
38644
  }
38715
- function bindingUsage(componentName, propertyPath) {
38716
- if (propertyPath.startsWith("action.event."))
38717
- return "event";
38718
- if (propertyPath.startsWith("action.local."))
38719
- return "local";
38720
- if (INPUT_COMPONENTS.has(componentName) && (propertyPath === "value" || propertyPath.endsWith(".value"))) {
38721
- return "input";
38722
- }
38723
- return "display";
38645
+ function rotateRight(value, bits) {
38646
+ return value >>> bits | value << 32 - bits;
38724
38647
  }
38725
- function inferListRoots(components, issues) {
38726
- const result = /* @__PURE__ */ new Map();
38727
- const byId = new Map(components.map((component) => [component.id, component]));
38728
- const queue = [];
38729
- const assign = (childId, listRoot, ownerId) => {
38730
- const existing = result.get(childId);
38731
- if (existing && existing !== listRoot) {
38732
- issues.push(issue2(`card.components.${ownerId}.children`, "AMBIGUOUS_LIST_CONTEXT", `Component ${childId} is reused by multiple list roots`));
38733
- return;
38734
- }
38735
- if (!existing) {
38736
- result.set(childId, listRoot);
38737
- queue.push(childId);
38738
- }
38739
- };
38740
- for (const component of components) {
38741
- const children = component.children;
38742
- if (!isPlainRecord(children) || typeof children.componentId !== "string" || typeof children.path !== "string") {
38743
- continue;
38744
- }
38745
- if (children.path.startsWith("."))
38746
- continue;
38747
- const canonicalPath = canonicalizeBindingPath(children.path);
38748
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath))
38749
- continue;
38750
- assign(children.componentId, canonicalPath, component.id);
38751
- }
38752
- const visited = /* @__PURE__ */ new Set();
38753
- while (queue.length > 0) {
38754
- const componentId = queue.shift();
38755
- if (visited.has(componentId))
38756
- continue;
38757
- visited.add(componentId);
38758
- const component = byId.get(componentId);
38759
- const listRoot = result.get(componentId);
38760
- if (!component || !listRoot)
38761
- continue;
38762
- const templatedChildren = component.children;
38763
- if (isPlainRecord(templatedChildren) && typeof templatedChildren.componentId === "string" && typeof templatedChildren.path === "string") {
38764
- const nestedRoot = canonicalizeBindingPath(templatedChildren.path, listRoot);
38765
- if (nestedRoot && isSafeJsonPointer(nestedRoot, true)) {
38766
- assign(templatedChildren.componentId, nestedRoot, componentId);
38767
- }
38768
- }
38769
- const childIds = [
38770
- ...typeof component.child === "string" ? [component.child] : [],
38771
- ...Array.isArray(component.children) ? component.children.filter((entry) => typeof entry === "string") : []
38772
- ];
38773
- for (const childId of childIds) {
38774
- assign(childId, listRoot, componentId);
38775
- }
38776
- }
38777
- return result;
38778
- }
38779
- function appendProperty(base, segment) {
38780
- return base ? `${base}.${segment}` : segment;
38648
+ function add(...values) {
38649
+ return values.reduce((sum, value) => sum + value | 0, 0);
38781
38650
  }
38651
+ var SHA256_CONSTANTS = [
38652
+ 1116352408,
38653
+ 1899447441,
38654
+ 3049323471,
38655
+ 3921009573,
38656
+ 961987163,
38657
+ 1508970993,
38658
+ 2453635748,
38659
+ 2870763221,
38660
+ 3624381080,
38661
+ 310598401,
38662
+ 607225278,
38663
+ 1426881987,
38664
+ 1925078388,
38665
+ 2162078206,
38666
+ 2614888103,
38667
+ 3248222580,
38668
+ 3835390401,
38669
+ 4022224774,
38670
+ 264347078,
38671
+ 604807628,
38672
+ 770255983,
38673
+ 1249150122,
38674
+ 1555081692,
38675
+ 1996064986,
38676
+ 2554220882,
38677
+ 2821834349,
38678
+ 2952996808,
38679
+ 3210313671,
38680
+ 3336571891,
38681
+ 3584528711,
38682
+ 113926993,
38683
+ 338241895,
38684
+ 666307205,
38685
+ 773529912,
38686
+ 1294757372,
38687
+ 1396182291,
38688
+ 1695183700,
38689
+ 1986661051,
38690
+ 2177026350,
38691
+ 2456956037,
38692
+ 2730485921,
38693
+ 2820302411,
38694
+ 3259730800,
38695
+ 3345764771,
38696
+ 3516065817,
38697
+ 3600352804,
38698
+ 4094571909,
38699
+ 275423344,
38700
+ 430227734,
38701
+ 506948616,
38702
+ 659060556,
38703
+ 883997877,
38704
+ 958139571,
38705
+ 1322822218,
38706
+ 1537002063,
38707
+ 1747873779,
38708
+ 1955562222,
38709
+ 2024104815,
38710
+ 2227730452,
38711
+ 2361852424,
38712
+ 2428436474,
38713
+ 2756734187,
38714
+ 3204031479,
38715
+ 3329325298
38716
+ ];
38782
38717
 
38783
38718
  // ../agent-a2ui-card-contract/dist/esm/schema.js
38784
38719
  var SCHEMA_TYPES = /* @__PURE__ */ new Set([
@@ -39119,6 +39054,233 @@ function sampleForFormat(format) {
39119
39054
  }
39120
39055
  }
39121
39056
 
39057
+ // ../agent-a2ui-card-contract/dist/esm/types.js
39058
+ var A2UI_CARD_TRANSFORM_LANGUAGE = "jmespath";
39059
+ var A2UI_CARD_TRANSFORM_PROFILE = "linkque-structural-v1";
39060
+ var A2UI_CARD_EXPRESSION_MAX_LENGTH = 4096;
39061
+ var A2UI_CARD_EXPRESSION_MAX_AST_NODES = 512;
39062
+ var A2UI_CARD_EXPRESSION_MAX_AST_DEPTH = 32;
39063
+ var A2UI_CARD_DATA_TRANSFORM_LANGUAGE = "javascript";
39064
+ var A2UI_CARD_DATA_TRANSFORM_PROFILE = "linkque-card-data-transform-v1";
39065
+ var A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES = 32 * 1024;
39066
+
39067
+ // ../agent-a2ui-card-contract/dist/esm/binding-analyzer.js
39068
+ var INPUT_COMPONENTS = /* @__PURE__ */ new Set(["ChoicePicker", "Stepper", "TextField"]);
39069
+ function analyzeA2UIBindings(protocol) {
39070
+ const issues = [];
39071
+ const occurrences = [];
39072
+ const surfaces = /* @__PURE__ */ new Set();
39073
+ const componentsBySurface = /* @__PURE__ */ new Map();
39074
+ protocol.forEach((message, messageIndex) => {
39075
+ if (!isPlainRecord(message) || !Array.isArray(message.datas)) {
39076
+ issues.push(issue2(`card[${messageIndex}]`, "INVALID_A2UI_MESSAGE", "A2UI message must contain a datas array"));
39077
+ return;
39078
+ }
39079
+ if (message.version !== "0.9") {
39080
+ issues.push(issue2(`card[${messageIndex}].version`, "UNSUPPORTED_PROTOCOL_VERSION", "A2UI card resources must use protocol version 0.9"));
39081
+ }
39082
+ message.datas.forEach((instruction, instructionIndex) => {
39083
+ if (!isPlainRecord(instruction)) {
39084
+ issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}]`, "INVALID_A2UI_INSTRUCTION", "instruction must be an object"));
39085
+ return;
39086
+ }
39087
+ if ("createSurface" in instruction) {
39088
+ if (!isPlainRecord(instruction.createSurface))
39089
+ return;
39090
+ const surfaceId = instruction.createSurface.surfaceId;
39091
+ if (!isSafeIdentifier(surfaceId)) {
39092
+ issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}].createSurface.surfaceId`, "INVALID_SURFACE_ID", "surfaceId must be a non-empty safe identifier"));
39093
+ } else {
39094
+ surfaces.add(surfaceId);
39095
+ }
39096
+ }
39097
+ if ("updateComponents" in instruction) {
39098
+ if (!isPlainRecord(instruction.updateComponents))
39099
+ return;
39100
+ const { surfaceId, components: rawComponents } = instruction.updateComponents;
39101
+ if (!isSafeIdentifier(surfaceId) || !Array.isArray(rawComponents)) {
39102
+ return;
39103
+ }
39104
+ surfaces.add(surfaceId);
39105
+ const components = componentsBySurface.get(surfaceId) ?? [];
39106
+ components.push(...rawComponents.filter((component) => isPlainRecord(component) && typeof component.id === "string" && typeof component.component === "string"));
39107
+ componentsBySurface.set(surfaceId, components);
39108
+ }
39109
+ });
39110
+ });
39111
+ for (const [surfaceId, components] of componentsBySurface) {
39112
+ const componentById = /* @__PURE__ */ new Map();
39113
+ for (const component of components) {
39114
+ if (!isSafeIdentifier(component.id)) {
39115
+ issues.push(issue2(`card.surfaces.${surfaceId}.components`, "INVALID_COMPONENT_ID", "Every component must have a non-empty safe id"));
39116
+ continue;
39117
+ }
39118
+ if (componentById.has(component.id)) {
39119
+ issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}`, "DUPLICATE_COMPONENT_ID", `Component id ${component.id} is duplicated in surface ${surfaceId}`));
39120
+ continue;
39121
+ }
39122
+ componentById.set(component.id, component);
39123
+ }
39124
+ const listRoots = inferListRoots(components, issues);
39125
+ for (const component of components) {
39126
+ const context = {
39127
+ surfaceId,
39128
+ component,
39129
+ listRoot: listRoots.get(component.id),
39130
+ occurrences,
39131
+ issues
39132
+ };
39133
+ visitValue(component, "", context);
39134
+ const children = component.children;
39135
+ if (isPlainRecord(children) && typeof children.path === "string") {
39136
+ const canonicalPath = canonicalizeBindingPath(children.path, context.listRoot);
39137
+ if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
39138
+ issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}.children.path`, "INVALID_BINDING_PATH", `Invalid list path ${children.path}`));
39139
+ } else {
39140
+ occurrences.push({
39141
+ surfaceId,
39142
+ componentId: component.id,
39143
+ componentName: component.component,
39144
+ propertyPath: "children.path",
39145
+ rawPath: children.path,
39146
+ canonicalPath,
39147
+ ...context.listRoot ? { listRoot: context.listRoot } : {},
39148
+ usage: "list"
39149
+ });
39150
+ }
39151
+ }
39152
+ }
39153
+ }
39154
+ return {
39155
+ surfaceIds: [...surfaces],
39156
+ surfaceId: surfaces.size === 1 ? [...surfaces][0] : void 0,
39157
+ occurrences,
39158
+ issues
39159
+ };
39160
+ }
39161
+ function collectReferencedA2UICardBusinessFieldIds(protocol, fields) {
39162
+ const businessFields = fields.filter((field) => field.source === "business").slice().sort((left, right) => right.path.length - left.path.length);
39163
+ const result = /* @__PURE__ */ new Set();
39164
+ for (const occurrence of analyzeA2UIBindings(protocol).occurrences) {
39165
+ const field = businessFields.find((candidate) => occurrence.canonicalPath === candidate.path || occurrence.canonicalPath.startsWith(`${candidate.path}/*/`) || occurrence.canonicalPath.startsWith(`${candidate.path}/`));
39166
+ if (field)
39167
+ result.add(field.fieldId);
39168
+ }
39169
+ return result;
39170
+ }
39171
+ function visitValue(value, propertyPath, context) {
39172
+ if (propertyPath === "action.local.path" && typeof value === "string") {
39173
+ addOccurrence(value, propertyPath, "local", context);
39174
+ return;
39175
+ }
39176
+ if (Array.isArray(value)) {
39177
+ value.forEach((entry, index) => {
39178
+ visitValue(entry, appendProperty(propertyPath, String(index)), context);
39179
+ });
39180
+ return;
39181
+ }
39182
+ if (!isPlainRecord(value))
39183
+ return;
39184
+ const keys2 = Object.keys(value);
39185
+ const isStrictBinding2 = keys2.length === 1 && typeof value.path === "string";
39186
+ const isDisplayBinding2 = DISPLAY_BINDING_PROPERTIES.has(propertyPath) && keys2.every((key) => key === "path" || key === "fallback") && typeof value.path === "string";
39187
+ if (isStrictBinding2 || isDisplayBinding2) {
39188
+ addOccurrence(value.path, propertyPath, bindingUsage(context.component.component, propertyPath), context);
39189
+ return;
39190
+ }
39191
+ for (const [key, entry] of Object.entries(value)) {
39192
+ if (propertyPath === "" && (key === "children" || key === "id" || key === "component")) {
39193
+ continue;
39194
+ }
39195
+ visitValue(entry, appendProperty(propertyPath, key), context);
39196
+ }
39197
+ }
39198
+ var DISPLAY_BINDING_PROPERTIES = /* @__PURE__ */ new Set(["alt", "label", "src", "text"]);
39199
+ function addOccurrence(rawPath, propertyPath, usage, context) {
39200
+ const canonicalPath = canonicalizeBindingPath(rawPath, context.listRoot);
39201
+ if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
39202
+ context.issues.push(issue2(`card.components.${context.component.id}.${propertyPath}`, "INVALID_BINDING_PATH", `Invalid binding path ${rawPath}`));
39203
+ return;
39204
+ }
39205
+ context.occurrences.push({
39206
+ surfaceId: context.surfaceId,
39207
+ componentId: context.component.id,
39208
+ componentName: context.component.component,
39209
+ propertyPath,
39210
+ rawPath,
39211
+ canonicalPath,
39212
+ ...context.listRoot ? { listRoot: context.listRoot } : {},
39213
+ usage
39214
+ });
39215
+ }
39216
+ function bindingUsage(componentName, propertyPath) {
39217
+ if (propertyPath.startsWith("action.event."))
39218
+ return "event";
39219
+ if (propertyPath.startsWith("action.local."))
39220
+ return "local";
39221
+ if (INPUT_COMPONENTS.has(componentName) && (propertyPath === "value" || propertyPath.endsWith(".value"))) {
39222
+ return "input";
39223
+ }
39224
+ return "display";
39225
+ }
39226
+ function inferListRoots(components, issues) {
39227
+ const result = /* @__PURE__ */ new Map();
39228
+ const byId = new Map(components.map((component) => [component.id, component]));
39229
+ const queue = [];
39230
+ const assign = (childId, listRoot, ownerId) => {
39231
+ const existing = result.get(childId);
39232
+ if (existing && existing !== listRoot) {
39233
+ issues.push(issue2(`card.components.${ownerId}.children`, "AMBIGUOUS_LIST_CONTEXT", `Component ${childId} is reused by multiple list roots`));
39234
+ return;
39235
+ }
39236
+ if (!existing) {
39237
+ result.set(childId, listRoot);
39238
+ queue.push(childId);
39239
+ }
39240
+ };
39241
+ for (const component of components) {
39242
+ const children = component.children;
39243
+ if (!isPlainRecord(children) || typeof children.componentId !== "string" || typeof children.path !== "string") {
39244
+ continue;
39245
+ }
39246
+ if (children.path.startsWith("."))
39247
+ continue;
39248
+ const canonicalPath = canonicalizeBindingPath(children.path);
39249
+ if (!canonicalPath || !isSafeJsonPointer(canonicalPath))
39250
+ continue;
39251
+ assign(children.componentId, canonicalPath, component.id);
39252
+ }
39253
+ const visited = /* @__PURE__ */ new Set();
39254
+ while (queue.length > 0) {
39255
+ const componentId = queue.shift();
39256
+ if (visited.has(componentId))
39257
+ continue;
39258
+ visited.add(componentId);
39259
+ const component = byId.get(componentId);
39260
+ const listRoot = result.get(componentId);
39261
+ if (!component || !listRoot)
39262
+ continue;
39263
+ const templatedChildren = component.children;
39264
+ if (isPlainRecord(templatedChildren) && typeof templatedChildren.componentId === "string" && typeof templatedChildren.path === "string") {
39265
+ const nestedRoot = canonicalizeBindingPath(templatedChildren.path, listRoot);
39266
+ if (nestedRoot && isSafeJsonPointer(nestedRoot, true)) {
39267
+ assign(templatedChildren.componentId, nestedRoot, componentId);
39268
+ }
39269
+ }
39270
+ const childIds = [
39271
+ ...typeof component.child === "string" ? [component.child] : [],
39272
+ ...Array.isArray(component.children) ? component.children.filter((entry) => typeof entry === "string") : []
39273
+ ];
39274
+ for (const childId of childIds) {
39275
+ assign(childId, listRoot, componentId);
39276
+ }
39277
+ }
39278
+ return result;
39279
+ }
39280
+ function appendProperty(base, segment) {
39281
+ return base ? `${base}.${segment}` : segment;
39282
+ }
39283
+
39122
39284
  // ../agent-a2ui-card-contract/dist/esm/expression.js
39123
39285
  var import_jmespath2 = __toESM(require_jmespath(), 1);
39124
39286
  var ALLOWED_AST_TYPES = /* @__PURE__ */ new Set([
@@ -40679,7 +40841,7 @@ function getA2UICardResourceConfigIssues(value) {
40679
40841
  validateResolverCoverage(fields, resolver, issues, card);
40680
40842
  return issues;
40681
40843
  }
40682
- function getA2UICardResourceConfigV4PipelineIssues(value) {
40844
+ function getA2UICardResourceConfigV4PipelineIssues(value, standard = false) {
40683
40845
  const issues = [];
40684
40846
  exactKeys(value, [
40685
40847
  "schemaVersion",
@@ -40718,7 +40880,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
40718
40880
  }
40719
40881
  validateDataTransform(value.dataTransform, "config.dataTransform", issues);
40720
40882
  const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, "config.dataModelSchema", issues);
40721
- const card = validateTemplate(value.a2uiTemplate, fields, issues);
40883
+ const card = standard ? void 0 : validateTemplate(value.a2uiTemplate, fields, issues);
40722
40884
  if (card) {
40723
40885
  issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"), ...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
40724
40886
  }
@@ -40730,7 +40892,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
40730
40892
  }
40731
40893
  return issues;
40732
40894
  }
40733
- function getA2UICardResourceConfigV3Issues(value) {
40895
+ function getA2UICardResourceConfigV3Issues(value, standard = false) {
40734
40896
  const issues = [];
40735
40897
  if (value.actionBindings !== void 0) {
40736
40898
  issues.push(issue2("config.actionBindings", "LEGACY_PAYMENT_ACTION_BINDINGS_UNSUPPORTED", "payment actions must be defined inline in card JSON"));
@@ -40763,7 +40925,7 @@ function getA2UICardResourceConfigV3Issues(value) {
40763
40925
  }
40764
40926
  const dataSources = validateDataSources(value.dataSources, "config.dataSources", issues);
40765
40927
  const bindings = validateV3OutputBindings(value.bindings, "config.bindings", issues);
40766
- const card = validateTemplate(value.a2uiTemplate, fields, issues);
40928
+ const card = standard ? void 0 : validateTemplate(value.a2uiTemplate, fields, issues);
40767
40929
  if (value.schemaVersion === "4" && card) {
40768
40930
  issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"));
40769
40931
  issues.push(...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
@@ -41908,146 +42070,6 @@ function cloneSelection(selection) {
41908
42070
  return JSON.parse(JSON.stringify(selection));
41909
42071
  }
41910
42072
 
41911
- // ../agent-a2ui-card-contract/dist/esm/digest.js
41912
- function sha256Hex(value) {
41913
- const bytes = new TextEncoder().encode(value);
41914
- const words = [];
41915
- for (let index = 0; index < bytes.length; index += 1) {
41916
- words[index >> 2] = (words[index >> 2] ?? 0) | bytes[index] << 24 - index % 4 * 8;
41917
- }
41918
- const bitLength = bytes.length * 8;
41919
- words[bitLength >> 5] = (words[bitLength >> 5] ?? 0) | 128 << 24 - bitLength % 32;
41920
- words[(bitLength + 64 >> 9 << 4) + 15] = bitLength;
41921
- const constants2 = SHA256_CONSTANTS;
41922
- let state = [
41923
- 1779033703,
41924
- 3144134277,
41925
- 1013904242,
41926
- 2773480762,
41927
- 1359893119,
41928
- 2600822924,
41929
- 528734635,
41930
- 1541459225
41931
- ];
41932
- for (let offset = 0; offset < words.length; offset += 16) {
41933
- const schedule = Array.from({ length: 64 }, () => 0);
41934
- for (let index = 0; index < 16; index += 1) {
41935
- schedule[index] = words[offset + index] ?? 0;
41936
- }
41937
- for (let index = 16; index < 64; index += 1) {
41938
- const left = schedule[index - 15];
41939
- const right = schedule[index - 2];
41940
- const s0 = rotateRight(left, 7) ^ rotateRight(left, 18) ^ left >>> 3;
41941
- const s1 = rotateRight(right, 17) ^ rotateRight(right, 19) ^ right >>> 10;
41942
- schedule[index] = add(schedule[index - 16], s0, schedule[index - 7], s1);
41943
- }
41944
- let [a, b3, c, d, e3, f3, g2, h] = state;
41945
- for (let index = 0; index < 64; index += 1) {
41946
- const sum1 = rotateRight(e3, 6) ^ rotateRight(e3, 11) ^ rotateRight(e3, 25);
41947
- const choice = e3 & f3 ^ ~e3 & g2;
41948
- const temporary1 = add(h, sum1, choice, constants2[index], schedule[index]);
41949
- const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
41950
- const majority = a & b3 ^ a & c ^ b3 & c;
41951
- const temporary2 = add(sum0, majority);
41952
- h = g2;
41953
- g2 = f3;
41954
- f3 = e3;
41955
- e3 = add(d, temporary1);
41956
- d = c;
41957
- c = b3;
41958
- b3 = a;
41959
- a = add(temporary1, temporary2);
41960
- }
41961
- state = state.map((v2, index) => add(v2, [a, b3, c, d, e3, f3, g2, h][index]));
41962
- }
41963
- return state.map((v2) => (v2 >>> 0).toString(16).padStart(8, "0")).join("");
41964
- }
41965
- function createA2UICardDraftStructureChecksum(draft) {
41966
- const cloned = JSON.parse(JSON.stringify(draft));
41967
- delete cloned.manifest.bindings;
41968
- return sha256Hex(stableJsonStringify(cloned));
41969
- }
41970
- function createA2UICardMcpConfigChecksum(resources) {
41971
- return sha256Hex(stableJsonStringify(resources));
41972
- }
41973
- function createA2UICardRevision(draftChecksum2, bindings) {
41974
- const digest = sha256Hex(`${draftChecksum2}
41975
- ${stableJsonStringify(bindings)}`);
41976
- return `card-${digest.slice(0, 24)}`;
41977
- }
41978
- function rotateRight(value, bits) {
41979
- return value >>> bits | value << 32 - bits;
41980
- }
41981
- function add(...values) {
41982
- return values.reduce((sum, value) => sum + value | 0, 0);
41983
- }
41984
- var SHA256_CONSTANTS = [
41985
- 1116352408,
41986
- 1899447441,
41987
- 3049323471,
41988
- 3921009573,
41989
- 961987163,
41990
- 1508970993,
41991
- 2453635748,
41992
- 2870763221,
41993
- 3624381080,
41994
- 310598401,
41995
- 607225278,
41996
- 1426881987,
41997
- 1925078388,
41998
- 2162078206,
41999
- 2614888103,
42000
- 3248222580,
42001
- 3835390401,
42002
- 4022224774,
42003
- 264347078,
42004
- 604807628,
42005
- 770255983,
42006
- 1249150122,
42007
- 1555081692,
42008
- 1996064986,
42009
- 2554220882,
42010
- 2821834349,
42011
- 2952996808,
42012
- 3210313671,
42013
- 3336571891,
42014
- 3584528711,
42015
- 113926993,
42016
- 338241895,
42017
- 666307205,
42018
- 773529912,
42019
- 1294757372,
42020
- 1396182291,
42021
- 1695183700,
42022
- 1986661051,
42023
- 2177026350,
42024
- 2456956037,
42025
- 2730485921,
42026
- 2820302411,
42027
- 3259730800,
42028
- 3345764771,
42029
- 3516065817,
42030
- 3600352804,
42031
- 4094571909,
42032
- 275423344,
42033
- 430227734,
42034
- 506948616,
42035
- 659060556,
42036
- 883997877,
42037
- 958139571,
42038
- 1322822218,
42039
- 1537002063,
42040
- 1747873779,
42041
- 1955562222,
42042
- 2024104815,
42043
- 2227730452,
42044
- 2361852424,
42045
- 2428436474,
42046
- 2756734187,
42047
- 3204031479,
42048
- 3329325298
42049
- ];
42050
-
42051
42073
  // ../agent-a2ui-card-contract/dist/esm/authoring-model.js
42052
42074
  var INTERNAL_KEYS = /* @__PURE__ */ new Set([
42053
42075
  "__proto__",