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/linkquejs.js CHANGED
@@ -38476,16 +38476,6 @@ var EHookExecutorName;
38476
38476
  // ../agent-a2ui-card-contract/dist/esm/protocol.js
38477
38477
  var LINKQUE_A2UI_V4_CATALOG_ID = "urn:linkque:a2ui:runtime:4";
38478
38478
 
38479
- // ../agent-a2ui-card-contract/dist/esm/types.js
38480
- var A2UI_CARD_TRANSFORM_LANGUAGE = "jmespath";
38481
- var A2UI_CARD_TRANSFORM_PROFILE = "linkque-structural-v1";
38482
- var A2UI_CARD_EXPRESSION_MAX_LENGTH = 4096;
38483
- var A2UI_CARD_EXPRESSION_MAX_AST_NODES = 512;
38484
- var A2UI_CARD_EXPRESSION_MAX_AST_DEPTH = 32;
38485
- var A2UI_CARD_DATA_TRANSFORM_LANGUAGE = "javascript";
38486
- var A2UI_CARD_DATA_TRANSFORM_PROFILE = "linkque-card-data-transform-v1";
38487
- var A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES = 32 * 1024;
38488
-
38489
38479
  // ../linkque-agent-data-binding-contract/dist/esm/json.js
38490
38480
  var BLOCKED_PATH_SEGMENTS = /* @__PURE__ */ new Set([
38491
38481
  "__proto__",
@@ -38585,222 +38575,145 @@ function issue2(path28, code, message) {
38585
38575
  function exactKeys(value, allowed, path28, issues) {
38586
38576
  }
38587
38577
 
38588
- // ../agent-a2ui-card-contract/dist/esm/binding-analyzer.js
38589
- var INPUT_COMPONENTS = /* @__PURE__ */ new Set(["ChoicePicker", "Stepper", "TextField"]);
38590
- function analyzeA2UIBindings(protocol) {
38591
- const issues = [];
38592
- const occurrences = [];
38593
- const surfaces = /* @__PURE__ */ new Set();
38594
- const componentsBySurface = /* @__PURE__ */ new Map();
38595
- protocol.forEach((message, messageIndex) => {
38596
- if (!isPlainRecord(message) || !Array.isArray(message.datas)) {
38597
- issues.push(issue2(`card[${messageIndex}]`, "INVALID_A2UI_MESSAGE", "A2UI message must contain a datas array"));
38598
- return;
38599
- }
38600
- if (message.version !== "0.9") {
38601
- 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;
38602
38603
  }
38603
- message.datas.forEach((instruction, instructionIndex) => {
38604
- if (!isPlainRecord(instruction)) {
38605
- issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}]`, "INVALID_A2UI_INSTRUCTION", "instruction must be an object"));
38606
- return;
38607
- }
38608
- if ("createSurface" in instruction) {
38609
- if (!isPlainRecord(instruction.createSurface))
38610
- return;
38611
- const surfaceId = instruction.createSurface.surfaceId;
38612
- if (!isSafeIdentifier(surfaceId)) {
38613
- issues.push(issue2(`card[${messageIndex}].datas[${instructionIndex}].createSurface.surfaceId`, "INVALID_SURFACE_ID", "surfaceId must be a non-empty safe identifier"));
38614
- } else {
38615
- surfaces.add(surfaceId);
38616
- }
38617
- }
38618
- if ("updateComponents" in instruction) {
38619
- if (!isPlainRecord(instruction.updateComponents))
38620
- return;
38621
- const { surfaceId, components: rawComponents } = instruction.updateComponents;
38622
- if (!isSafeIdentifier(surfaceId) || !Array.isArray(rawComponents)) {
38623
- return;
38624
- }
38625
- surfaces.add(surfaceId);
38626
- const components = componentsBySurface.get(surfaceId) ?? [];
38627
- components.push(...rawComponents.filter((component) => isPlainRecord(component) && typeof component.id === "string" && typeof component.component === "string"));
38628
- componentsBySurface.set(surfaceId, components);
38629
- }
38630
- });
38631
- });
38632
- for (const [surfaceId, components] of componentsBySurface) {
38633
- const componentById = /* @__PURE__ */ new Map();
38634
- for (const component of components) {
38635
- if (!isSafeIdentifier(component.id)) {
38636
- issues.push(issue2(`card.surfaces.${surfaceId}.components`, "INVALID_COMPONENT_ID", "Every component must have a non-empty safe id"));
38637
- continue;
38638
- }
38639
- if (componentById.has(component.id)) {
38640
- issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}`, "DUPLICATE_COMPONENT_ID", `Component id ${component.id} is duplicated in surface ${surfaceId}`));
38641
- continue;
38642
- }
38643
- 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);
38644
38610
  }
38645
- const listRoots = inferListRoots(components, issues);
38646
- for (const component of components) {
38647
- const context = {
38648
- surfaceId,
38649
- component,
38650
- listRoot: listRoots.get(component.id),
38651
- occurrences,
38652
- issues
38653
- };
38654
- visitValue(component, "", context);
38655
- const children = component.children;
38656
- if (isPlainRecord(children) && typeof children.path === "string") {
38657
- const canonicalPath = canonicalizeBindingPath(children.path, context.listRoot);
38658
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
38659
- issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}.children.path`, "INVALID_BINDING_PATH", `Invalid list path ${children.path}`));
38660
- } else {
38661
- occurrences.push({
38662
- surfaceId,
38663
- componentId: component.id,
38664
- componentName: component.component,
38665
- propertyPath: "children.path",
38666
- rawPath: children.path,
38667
- canonicalPath,
38668
- ...context.listRoot ? { listRoot: context.listRoot } : {},
38669
- usage: "list"
38670
- });
38671
- }
38672
- }
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);
38673
38627
  }
38628
+ state = state.map((v2, index) => add(v2, [a, b3, c, d, e3, f3, g2, h][index]));
38674
38629
  }
38675
- return {
38676
- surfaceIds: [...surfaces],
38677
- surfaceId: surfaces.size === 1 ? [...surfaces][0] : void 0,
38678
- occurrences,
38679
- issues
38680
- };
38630
+ return state.map((v2) => (v2 >>> 0).toString(16).padStart(8, "0")).join("");
38681
38631
  }
38682
- function collectReferencedA2UICardBusinessFieldIds(protocol, fields) {
38683
- const businessFields = fields.filter((field) => field.source === "business").slice().sort((left, right) => right.path.length - left.path.length);
38684
- const result = /* @__PURE__ */ new Set();
38685
- for (const occurrence of analyzeA2UIBindings(protocol).occurrences) {
38686
- const field = businessFields.find((candidate) => occurrence.canonicalPath === candidate.path || occurrence.canonicalPath.startsWith(`${candidate.path}/*/`) || occurrence.canonicalPath.startsWith(`${candidate.path}/`));
38687
- if (field)
38688
- result.add(field.fieldId);
38689
- }
38690
- return result;
38632
+ function createA2UICardDraftStructureChecksum(draft) {
38633
+ const cloned = JSON.parse(JSON.stringify(draft));
38634
+ delete cloned.manifest.bindings;
38635
+ return sha256Hex(stableJsonStringify(cloned));
38691
38636
  }
38692
- function visitValue(value, propertyPath, context) {
38693
- if (propertyPath === "action.local.path" && typeof value === "string") {
38694
- addOccurrence(value, propertyPath, "local", context);
38695
- return;
38696
- }
38697
- if (Array.isArray(value)) {
38698
- value.forEach((entry, index) => {
38699
- visitValue(entry, appendProperty(propertyPath, String(index)), context);
38700
- });
38701
- return;
38702
- }
38703
- if (!isPlainRecord(value))
38704
- return;
38705
- const keys2 = Object.keys(value);
38706
- const isStrictBinding2 = keys2.length === 1 && typeof value.path === "string";
38707
- const isDisplayBinding2 = DISPLAY_BINDING_PROPERTIES.has(propertyPath) && keys2.every((key) => key === "path" || key === "fallback") && typeof value.path === "string";
38708
- if (isStrictBinding2 || isDisplayBinding2) {
38709
- addOccurrence(value.path, propertyPath, bindingUsage(context.component.component, propertyPath), context);
38710
- return;
38711
- }
38712
- for (const [key, entry] of Object.entries(value)) {
38713
- if (propertyPath === "" && (key === "children" || key === "id" || key === "component")) {
38714
- continue;
38715
- }
38716
- visitValue(entry, appendProperty(propertyPath, key), context);
38717
- }
38637
+ function createA2UICardMcpConfigChecksum(resources) {
38638
+ return sha256Hex(stableJsonStringify(resources));
38718
38639
  }
38719
- var DISPLAY_BINDING_PROPERTIES = /* @__PURE__ */ new Set(["alt", "label", "src", "text"]);
38720
- function addOccurrence(rawPath, propertyPath, usage, context) {
38721
- const canonicalPath = canonicalizeBindingPath(rawPath, context.listRoot);
38722
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
38723
- context.issues.push(issue2(`card.components.${context.component.id}.${propertyPath}`, "INVALID_BINDING_PATH", `Invalid binding path ${rawPath}`));
38724
- return;
38725
- }
38726
- context.occurrences.push({
38727
- surfaceId: context.surfaceId,
38728
- componentId: context.component.id,
38729
- componentName: context.component.component,
38730
- propertyPath,
38731
- rawPath,
38732
- canonicalPath,
38733
- ...context.listRoot ? { listRoot: context.listRoot } : {},
38734
- usage
38735
- });
38640
+ function createA2UICardRevision(draftChecksum2, bindings) {
38641
+ const digest = sha256Hex(`${draftChecksum2}
38642
+ ${stableJsonStringify(bindings)}`);
38643
+ return `card-${digest.slice(0, 24)}`;
38736
38644
  }
38737
- function bindingUsage(componentName, propertyPath) {
38738
- if (propertyPath.startsWith("action.event."))
38739
- return "event";
38740
- if (propertyPath.startsWith("action.local."))
38741
- return "local";
38742
- if (INPUT_COMPONENTS.has(componentName) && (propertyPath === "value" || propertyPath.endsWith(".value"))) {
38743
- return "input";
38744
- }
38745
- return "display";
38645
+ function rotateRight(value, bits) {
38646
+ return value >>> bits | value << 32 - bits;
38746
38647
  }
38747
- function inferListRoots(components, issues) {
38748
- const result = /* @__PURE__ */ new Map();
38749
- const byId = new Map(components.map((component) => [component.id, component]));
38750
- const queue = [];
38751
- const assign = (childId, listRoot, ownerId) => {
38752
- const existing = result.get(childId);
38753
- if (existing && existing !== listRoot) {
38754
- issues.push(issue2(`card.components.${ownerId}.children`, "AMBIGUOUS_LIST_CONTEXT", `Component ${childId} is reused by multiple list roots`));
38755
- return;
38756
- }
38757
- if (!existing) {
38758
- result.set(childId, listRoot);
38759
- queue.push(childId);
38760
- }
38761
- };
38762
- for (const component of components) {
38763
- const children = component.children;
38764
- if (!isPlainRecord(children) || typeof children.componentId !== "string" || typeof children.path !== "string") {
38765
- continue;
38766
- }
38767
- if (children.path.startsWith("."))
38768
- continue;
38769
- const canonicalPath = canonicalizeBindingPath(children.path);
38770
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath))
38771
- continue;
38772
- assign(children.componentId, canonicalPath, component.id);
38773
- }
38774
- const visited = /* @__PURE__ */ new Set();
38775
- while (queue.length > 0) {
38776
- const componentId = queue.shift();
38777
- if (visited.has(componentId))
38778
- continue;
38779
- visited.add(componentId);
38780
- const component = byId.get(componentId);
38781
- const listRoot = result.get(componentId);
38782
- if (!component || !listRoot)
38783
- continue;
38784
- const templatedChildren = component.children;
38785
- if (isPlainRecord(templatedChildren) && typeof templatedChildren.componentId === "string" && typeof templatedChildren.path === "string") {
38786
- const nestedRoot = canonicalizeBindingPath(templatedChildren.path, listRoot);
38787
- if (nestedRoot && isSafeJsonPointer(nestedRoot, true)) {
38788
- assign(templatedChildren.componentId, nestedRoot, componentId);
38789
- }
38790
- }
38791
- const childIds = [
38792
- ...typeof component.child === "string" ? [component.child] : [],
38793
- ...Array.isArray(component.children) ? component.children.filter((entry) => typeof entry === "string") : []
38794
- ];
38795
- for (const childId of childIds) {
38796
- assign(childId, listRoot, componentId);
38797
- }
38798
- }
38799
- return result;
38800
- }
38801
- function appendProperty(base, segment) {
38802
- return base ? `${base}.${segment}` : segment;
38648
+ function add(...values) {
38649
+ return values.reduce((sum, value) => sum + value | 0, 0);
38803
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
+ ];
38804
38717
 
38805
38718
  // ../agent-a2ui-card-contract/dist/esm/schema.js
38806
38719
  var SCHEMA_TYPES = /* @__PURE__ */ new Set([
@@ -39057,88 +38970,315 @@ function validateValue(schema2, value, path28, issues) {
39057
38970
  continue;
39058
38971
  validateValue(childSchema, value[key], `${path28}/${key}`, issues);
39059
38972
  }
39060
- if (schema2.additionalProperties === false) {
39061
- for (const key of Object.keys(value)) {
39062
- if (!(key in properties)) {
39063
- issues.push(issue2(`${path28}/${key}`, "SCHEMA_ADDITIONAL_PROPERTY", `property ${key} is not allowed`));
39064
- }
39065
- }
38973
+ if (schema2.additionalProperties === false) {
38974
+ for (const key of Object.keys(value)) {
38975
+ if (!(key in properties)) {
38976
+ issues.push(issue2(`${path28}/${key}`, "SCHEMA_ADDITIONAL_PROPERTY", `property ${key} is not allowed`));
38977
+ }
38978
+ }
38979
+ }
38980
+ }
38981
+ if (schema2.type === "array" && Array.isArray(value) && isPlainRecord(schema2.items)) {
38982
+ value.forEach((entry, index) => {
38983
+ validateValue(schema2.items, entry, `${path28}/${index}`, issues);
38984
+ });
38985
+ }
38986
+ }
38987
+ function compareSchemas(source, target, path28, issues) {
38988
+ if (!areJsonSchemaTypesCompatible(source.type, target.type)) {
38989
+ issues.push(issue2(path28, "SCHEMA_TYPE_INCOMPATIBLE", `source type ${String(source.type)} cannot supply ${String(target.type)}`));
38990
+ return;
38991
+ }
38992
+ if (source.type === "array" && target.type === "array" && isPlainRecord(source.items) && isPlainRecord(target.items)) {
38993
+ compareSchemas(source.items, target.items, `${path28}[*]`, issues);
38994
+ }
38995
+ if (source.type === "object" && target.type === "object" && isPlainRecord(source.properties) && isPlainRecord(target.properties)) {
38996
+ const required2 = Array.isArray(target.required) ? target.required.filter((entry) => typeof entry === "string") : [];
38997
+ for (const name of required2) {
38998
+ const sourceChild = source.properties[name];
38999
+ const targetChild = target.properties[name];
39000
+ if (!isPlainRecord(sourceChild) || !isPlainRecord(targetChild)) {
39001
+ issues.push(issue2(`${path28}.${name}`, "SCHEMA_REQUIRED_MISSING", `source does not provide required property ${name}`));
39002
+ continue;
39003
+ }
39004
+ compareSchemas(sourceChild, targetChild, `${path28}.${name}`, issues);
39005
+ }
39006
+ }
39007
+ }
39008
+ function matchesType(type, value) {
39009
+ switch (type) {
39010
+ case "array":
39011
+ return Array.isArray(value);
39012
+ case "boolean":
39013
+ return typeof value === "boolean";
39014
+ case "integer":
39015
+ return typeof value === "number" && Number.isInteger(value);
39016
+ case "null":
39017
+ return value === null;
39018
+ case "number":
39019
+ return typeof value === "number" && Number.isFinite(value);
39020
+ case "object":
39021
+ return isPlainRecord(value);
39022
+ case "string":
39023
+ return typeof value === "string";
39024
+ default:
39025
+ return false;
39026
+ }
39027
+ }
39028
+ function valueType(value) {
39029
+ if (value === null)
39030
+ return "null";
39031
+ if (Array.isArray(value))
39032
+ return "array";
39033
+ if (typeof value === "number" && Number.isInteger(value))
39034
+ return "integer";
39035
+ return typeof value;
39036
+ }
39037
+ function numericSample(schema2, integer2) {
39038
+ const minimum = typeof schema2.minimum === "number" && Number.isFinite(schema2.minimum) ? schema2.minimum : 1;
39039
+ return integer2 ? Math.ceil(minimum) : minimum;
39040
+ }
39041
+ function sampleForFormat(format) {
39042
+ switch (format) {
39043
+ case "date":
39044
+ return "2026-01-01";
39045
+ case "date-time":
39046
+ return "2026-01-01T00:00:00.000Z";
39047
+ case "email":
39048
+ return "example@example.com";
39049
+ case "uri":
39050
+ case "url":
39051
+ return "https://example.com";
39052
+ default:
39053
+ return "\u793A\u4F8B\u6587\u672C";
39054
+ }
39055
+ }
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;
39066
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);
39067
39252
  }
39068
- if (schema2.type === "array" && Array.isArray(value) && isPlainRecord(schema2.items)) {
39069
- value.forEach((entry, index) => {
39070
- validateValue(schema2.items, entry, `${path28}/${index}`, issues);
39071
- });
39072
- }
39073
- }
39074
- function compareSchemas(source, target, path28, issues) {
39075
- if (!areJsonSchemaTypesCompatible(source.type, target.type)) {
39076
- issues.push(issue2(path28, "SCHEMA_TYPE_INCOMPATIBLE", `source type ${String(source.type)} cannot supply ${String(target.type)}`));
39077
- return;
39078
- }
39079
- if (source.type === "array" && target.type === "array" && isPlainRecord(source.items) && isPlainRecord(target.items)) {
39080
- compareSchemas(source.items, target.items, `${path28}[*]`, issues);
39081
- }
39082
- if (source.type === "object" && target.type === "object" && isPlainRecord(source.properties) && isPlainRecord(target.properties)) {
39083
- const required2 = Array.isArray(target.required) ? target.required.filter((entry) => typeof entry === "string") : [];
39084
- for (const name of required2) {
39085
- const sourceChild = source.properties[name];
39086
- const targetChild = target.properties[name];
39087
- if (!isPlainRecord(sourceChild) || !isPlainRecord(targetChild)) {
39088
- issues.push(issue2(`${path28}.${name}`, "SCHEMA_REQUIRED_MISSING", `source does not provide required property ${name}`));
39089
- continue;
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);
39090
39268
  }
39091
- compareSchemas(sourceChild, targetChild, `${path28}.${name}`, issues);
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);
39092
39276
  }
39093
39277
  }
39278
+ return result;
39094
39279
  }
39095
- function matchesType(type, value) {
39096
- switch (type) {
39097
- case "array":
39098
- return Array.isArray(value);
39099
- case "boolean":
39100
- return typeof value === "boolean";
39101
- case "integer":
39102
- return typeof value === "number" && Number.isInteger(value);
39103
- case "null":
39104
- return value === null;
39105
- case "number":
39106
- return typeof value === "number" && Number.isFinite(value);
39107
- case "object":
39108
- return isPlainRecord(value);
39109
- case "string":
39110
- return typeof value === "string";
39111
- default:
39112
- return false;
39113
- }
39114
- }
39115
- function valueType(value) {
39116
- if (value === null)
39117
- return "null";
39118
- if (Array.isArray(value))
39119
- return "array";
39120
- if (typeof value === "number" && Number.isInteger(value))
39121
- return "integer";
39122
- return typeof value;
39123
- }
39124
- function numericSample(schema2, integer2) {
39125
- const minimum = typeof schema2.minimum === "number" && Number.isFinite(schema2.minimum) ? schema2.minimum : 1;
39126
- return integer2 ? Math.ceil(minimum) : minimum;
39127
- }
39128
- function sampleForFormat(format) {
39129
- switch (format) {
39130
- case "date":
39131
- return "2026-01-01";
39132
- case "date-time":
39133
- return "2026-01-01T00:00:00.000Z";
39134
- case "email":
39135
- return "example@example.com";
39136
- case "uri":
39137
- case "url":
39138
- return "https://example.com";
39139
- default:
39140
- return "\u793A\u4F8B\u6587\u672C";
39141
- }
39280
+ function appendProperty(base, segment) {
39281
+ return base ? `${base}.${segment}` : segment;
39142
39282
  }
39143
39283
 
39144
39284
  // ../agent-a2ui-card-contract/dist/esm/expression.js
@@ -40701,7 +40841,7 @@ function getA2UICardResourceConfigIssues(value) {
40701
40841
  validateResolverCoverage(fields, resolver, issues, card);
40702
40842
  return issues;
40703
40843
  }
40704
- function getA2UICardResourceConfigV4PipelineIssues(value) {
40844
+ function getA2UICardResourceConfigV4PipelineIssues(value, standard = false) {
40705
40845
  const issues = [];
40706
40846
  exactKeys(value, [
40707
40847
  "schemaVersion",
@@ -40740,7 +40880,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
40740
40880
  }
40741
40881
  validateDataTransform(value.dataTransform, "config.dataTransform", issues);
40742
40882
  const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, "config.dataModelSchema", issues);
40743
- const card = validateTemplate(value.a2uiTemplate, fields, issues);
40883
+ const card = standard ? void 0 : validateTemplate(value.a2uiTemplate, fields, issues);
40744
40884
  if (card) {
40745
40885
  issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"), ...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
40746
40886
  }
@@ -40752,7 +40892,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
40752
40892
  }
40753
40893
  return issues;
40754
40894
  }
40755
- function getA2UICardResourceConfigV3Issues(value) {
40895
+ function getA2UICardResourceConfigV3Issues(value, standard = false) {
40756
40896
  const issues = [];
40757
40897
  if (value.actionBindings !== void 0) {
40758
40898
  issues.push(issue2("config.actionBindings", "LEGACY_PAYMENT_ACTION_BINDINGS_UNSUPPORTED", "payment actions must be defined inline in card JSON"));
@@ -40785,7 +40925,7 @@ function getA2UICardResourceConfigV3Issues(value) {
40785
40925
  }
40786
40926
  const dataSources = validateDataSources(value.dataSources, "config.dataSources", issues);
40787
40927
  const bindings = validateV3OutputBindings(value.bindings, "config.bindings", issues);
40788
- const card = validateTemplate(value.a2uiTemplate, fields, issues);
40928
+ const card = standard ? void 0 : validateTemplate(value.a2uiTemplate, fields, issues);
40789
40929
  if (value.schemaVersion === "4" && card) {
40790
40930
  issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"));
40791
40931
  issues.push(...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
@@ -41930,146 +42070,6 @@ function cloneSelection(selection) {
41930
42070
  return JSON.parse(JSON.stringify(selection));
41931
42071
  }
41932
42072
 
41933
- // ../agent-a2ui-card-contract/dist/esm/digest.js
41934
- function sha256Hex(value) {
41935
- const bytes = new TextEncoder().encode(value);
41936
- const words = [];
41937
- for (let index = 0; index < bytes.length; index += 1) {
41938
- words[index >> 2] = (words[index >> 2] ?? 0) | bytes[index] << 24 - index % 4 * 8;
41939
- }
41940
- const bitLength = bytes.length * 8;
41941
- words[bitLength >> 5] = (words[bitLength >> 5] ?? 0) | 128 << 24 - bitLength % 32;
41942
- words[(bitLength + 64 >> 9 << 4) + 15] = bitLength;
41943
- const constants2 = SHA256_CONSTANTS;
41944
- let state = [
41945
- 1779033703,
41946
- 3144134277,
41947
- 1013904242,
41948
- 2773480762,
41949
- 1359893119,
41950
- 2600822924,
41951
- 528734635,
41952
- 1541459225
41953
- ];
41954
- for (let offset = 0; offset < words.length; offset += 16) {
41955
- const schedule = Array.from({ length: 64 }, () => 0);
41956
- for (let index = 0; index < 16; index += 1) {
41957
- schedule[index] = words[offset + index] ?? 0;
41958
- }
41959
- for (let index = 16; index < 64; index += 1) {
41960
- const left = schedule[index - 15];
41961
- const right = schedule[index - 2];
41962
- const s0 = rotateRight(left, 7) ^ rotateRight(left, 18) ^ left >>> 3;
41963
- const s1 = rotateRight(right, 17) ^ rotateRight(right, 19) ^ right >>> 10;
41964
- schedule[index] = add(schedule[index - 16], s0, schedule[index - 7], s1);
41965
- }
41966
- let [a, b3, c, d, e3, f3, g2, h] = state;
41967
- for (let index = 0; index < 64; index += 1) {
41968
- const sum1 = rotateRight(e3, 6) ^ rotateRight(e3, 11) ^ rotateRight(e3, 25);
41969
- const choice = e3 & f3 ^ ~e3 & g2;
41970
- const temporary1 = add(h, sum1, choice, constants2[index], schedule[index]);
41971
- const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
41972
- const majority = a & b3 ^ a & c ^ b3 & c;
41973
- const temporary2 = add(sum0, majority);
41974
- h = g2;
41975
- g2 = f3;
41976
- f3 = e3;
41977
- e3 = add(d, temporary1);
41978
- d = c;
41979
- c = b3;
41980
- b3 = a;
41981
- a = add(temporary1, temporary2);
41982
- }
41983
- state = state.map((v2, index) => add(v2, [a, b3, c, d, e3, f3, g2, h][index]));
41984
- }
41985
- return state.map((v2) => (v2 >>> 0).toString(16).padStart(8, "0")).join("");
41986
- }
41987
- function createA2UICardDraftStructureChecksum(draft) {
41988
- const cloned = JSON.parse(JSON.stringify(draft));
41989
- delete cloned.manifest.bindings;
41990
- return sha256Hex(stableJsonStringify(cloned));
41991
- }
41992
- function createA2UICardMcpConfigChecksum(resources) {
41993
- return sha256Hex(stableJsonStringify(resources));
41994
- }
41995
- function createA2UICardRevision(draftChecksum2, bindings) {
41996
- const digest = sha256Hex(`${draftChecksum2}
41997
- ${stableJsonStringify(bindings)}`);
41998
- return `card-${digest.slice(0, 24)}`;
41999
- }
42000
- function rotateRight(value, bits) {
42001
- return value >>> bits | value << 32 - bits;
42002
- }
42003
- function add(...values) {
42004
- return values.reduce((sum, value) => sum + value | 0, 0);
42005
- }
42006
- var SHA256_CONSTANTS = [
42007
- 1116352408,
42008
- 1899447441,
42009
- 3049323471,
42010
- 3921009573,
42011
- 961987163,
42012
- 1508970993,
42013
- 2453635748,
42014
- 2870763221,
42015
- 3624381080,
42016
- 310598401,
42017
- 607225278,
42018
- 1426881987,
42019
- 1925078388,
42020
- 2162078206,
42021
- 2614888103,
42022
- 3248222580,
42023
- 3835390401,
42024
- 4022224774,
42025
- 264347078,
42026
- 604807628,
42027
- 770255983,
42028
- 1249150122,
42029
- 1555081692,
42030
- 1996064986,
42031
- 2554220882,
42032
- 2821834349,
42033
- 2952996808,
42034
- 3210313671,
42035
- 3336571891,
42036
- 3584528711,
42037
- 113926993,
42038
- 338241895,
42039
- 666307205,
42040
- 773529912,
42041
- 1294757372,
42042
- 1396182291,
42043
- 1695183700,
42044
- 1986661051,
42045
- 2177026350,
42046
- 2456956037,
42047
- 2730485921,
42048
- 2820302411,
42049
- 3259730800,
42050
- 3345764771,
42051
- 3516065817,
42052
- 3600352804,
42053
- 4094571909,
42054
- 275423344,
42055
- 430227734,
42056
- 506948616,
42057
- 659060556,
42058
- 883997877,
42059
- 958139571,
42060
- 1322822218,
42061
- 1537002063,
42062
- 1747873779,
42063
- 1955562222,
42064
- 2024104815,
42065
- 2227730452,
42066
- 2361852424,
42067
- 2428436474,
42068
- 2756734187,
42069
- 3204031479,
42070
- 3329325298
42071
- ];
42072
-
42073
42073
  // ../agent-a2ui-card-contract/dist/esm/authoring-model.js
42074
42074
  var INTERNAL_KEYS = /* @__PURE__ */ new Set([
42075
42075
  "__proto__",