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 +394 -372
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-5YW4CWBG.js → chunk-2D6TBUEQ.js} +511 -231
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-27TIUPEZ.js → chunk-HC6DKXYK.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-Q6N5427R.js → chunk-X2R6PIPU.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +8 -6
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
- package/worker.js +556 -268
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-5YW4CWBG.js → chunk-2D6TBUEQ.js}
RENAMED
|
@@ -43042,16 +43042,6 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
43042
43042
|
// ../agent-a2ui-card-contract/dist/esm/protocol.js
|
|
43043
43043
|
var LINKQUE_A2UI_V4_CATALOG_ID = "urn:linkque:a2ui:runtime:4";
|
|
43044
43044
|
|
|
43045
|
-
// ../agent-a2ui-card-contract/dist/esm/types.js
|
|
43046
|
-
var A2UI_CARD_TRANSFORM_LANGUAGE = "jmespath";
|
|
43047
|
-
var A2UI_CARD_TRANSFORM_PROFILE = "linkque-structural-v1";
|
|
43048
|
-
var A2UI_CARD_EXPRESSION_MAX_LENGTH = 4096;
|
|
43049
|
-
var A2UI_CARD_EXPRESSION_MAX_AST_NODES = 512;
|
|
43050
|
-
var A2UI_CARD_EXPRESSION_MAX_AST_DEPTH = 32;
|
|
43051
|
-
var A2UI_CARD_DATA_TRANSFORM_LANGUAGE = "javascript";
|
|
43052
|
-
var A2UI_CARD_DATA_TRANSFORM_PROFILE = "linkque-card-data-transform-v1";
|
|
43053
|
-
var A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES = 32 * 1024;
|
|
43054
|
-
|
|
43055
43045
|
// ../linkque-agent-data-binding-contract/dist/esm/json.js
|
|
43056
43046
|
var BLOCKED_PATH_SEGMENTS = /* @__PURE__ */ new Set([
|
|
43057
43047
|
"__proto__",
|
|
@@ -43111,6 +43101,9 @@ function isSafeJsonPointer(value, allowWildcard = false) {
|
|
|
43111
43101
|
return !BLOCKED_PATH_SEGMENTS.has(segment) && (allowWildcard || segment !== "*");
|
|
43112
43102
|
});
|
|
43113
43103
|
}
|
|
43104
|
+
function encodePointerSegment(value) {
|
|
43105
|
+
return value.replace(/~/gu, "~0").replace(/\//gu, "~1");
|
|
43106
|
+
}
|
|
43114
43107
|
function decodePointerSegment(value) {
|
|
43115
43108
|
return value.replace(/~1/gu, "/").replace(/~0/gu, "~");
|
|
43116
43109
|
}
|
|
@@ -43380,6 +43373,467 @@ function issue2(path2, code, message) {
|
|
|
43380
43373
|
function exactKeys(value, allowed, path2, issues) {
|
|
43381
43374
|
}
|
|
43382
43375
|
|
|
43376
|
+
// ../agent-a2ui-card-contract/dist/esm/digest.js
|
|
43377
|
+
function sha256Hex(value) {
|
|
43378
|
+
const bytes2 = new TextEncoder().encode(value);
|
|
43379
|
+
const words = [];
|
|
43380
|
+
for (let index = 0; index < bytes2.length; index += 1) {
|
|
43381
|
+
words[index >> 2] = (words[index >> 2] ?? 0) | bytes2[index] << 24 - index % 4 * 8;
|
|
43382
|
+
}
|
|
43383
|
+
const bitLength = bytes2.length * 8;
|
|
43384
|
+
words[bitLength >> 5] = (words[bitLength >> 5] ?? 0) | 128 << 24 - bitLength % 32;
|
|
43385
|
+
words[(bitLength + 64 >> 9 << 4) + 15] = bitLength;
|
|
43386
|
+
const constants = SHA256_CONSTANTS;
|
|
43387
|
+
let state = [
|
|
43388
|
+
1779033703,
|
|
43389
|
+
3144134277,
|
|
43390
|
+
1013904242,
|
|
43391
|
+
2773480762,
|
|
43392
|
+
1359893119,
|
|
43393
|
+
2600822924,
|
|
43394
|
+
528734635,
|
|
43395
|
+
1541459225
|
|
43396
|
+
];
|
|
43397
|
+
for (let offset = 0; offset < words.length; offset += 16) {
|
|
43398
|
+
const schedule = Array.from({ length: 64 }, () => 0);
|
|
43399
|
+
for (let index = 0; index < 16; index += 1) {
|
|
43400
|
+
schedule[index] = words[offset + index] ?? 0;
|
|
43401
|
+
}
|
|
43402
|
+
for (let index = 16; index < 64; index += 1) {
|
|
43403
|
+
const left = schedule[index - 15];
|
|
43404
|
+
const right = schedule[index - 2];
|
|
43405
|
+
const s0 = rotateRight(left, 7) ^ rotateRight(left, 18) ^ left >>> 3;
|
|
43406
|
+
const s1 = rotateRight(right, 17) ^ rotateRight(right, 19) ^ right >>> 10;
|
|
43407
|
+
schedule[index] = add(schedule[index - 16], s0, schedule[index - 7], s1);
|
|
43408
|
+
}
|
|
43409
|
+
let [a, b, c, d, e, f, g, h] = state;
|
|
43410
|
+
for (let index = 0; index < 64; index += 1) {
|
|
43411
|
+
const sum1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);
|
|
43412
|
+
const choice = e & f ^ ~e & g;
|
|
43413
|
+
const temporary1 = add(h, sum1, choice, constants[index], schedule[index]);
|
|
43414
|
+
const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
|
|
43415
|
+
const majority = a & b ^ a & c ^ b & c;
|
|
43416
|
+
const temporary2 = add(sum0, majority);
|
|
43417
|
+
h = g;
|
|
43418
|
+
g = f;
|
|
43419
|
+
f = e;
|
|
43420
|
+
e = add(d, temporary1);
|
|
43421
|
+
d = c;
|
|
43422
|
+
c = b;
|
|
43423
|
+
b = a;
|
|
43424
|
+
a = add(temporary1, temporary2);
|
|
43425
|
+
}
|
|
43426
|
+
state = state.map((v, index) => add(v, [a, b, c, d, e, f, g, h][index]));
|
|
43427
|
+
}
|
|
43428
|
+
return state.map((v) => (v >>> 0).toString(16).padStart(8, "0")).join("");
|
|
43429
|
+
}
|
|
43430
|
+
function rotateRight(value, bits2) {
|
|
43431
|
+
return value >>> bits2 | value << 32 - bits2;
|
|
43432
|
+
}
|
|
43433
|
+
function add(...values) {
|
|
43434
|
+
return values.reduce((sum, value) => sum + value | 0, 0);
|
|
43435
|
+
}
|
|
43436
|
+
var SHA256_CONSTANTS = [
|
|
43437
|
+
1116352408,
|
|
43438
|
+
1899447441,
|
|
43439
|
+
3049323471,
|
|
43440
|
+
3921009573,
|
|
43441
|
+
961987163,
|
|
43442
|
+
1508970993,
|
|
43443
|
+
2453635748,
|
|
43444
|
+
2870763221,
|
|
43445
|
+
3624381080,
|
|
43446
|
+
310598401,
|
|
43447
|
+
607225278,
|
|
43448
|
+
1426881987,
|
|
43449
|
+
1925078388,
|
|
43450
|
+
2162078206,
|
|
43451
|
+
2614888103,
|
|
43452
|
+
3248222580,
|
|
43453
|
+
3835390401,
|
|
43454
|
+
4022224774,
|
|
43455
|
+
264347078,
|
|
43456
|
+
604807628,
|
|
43457
|
+
770255983,
|
|
43458
|
+
1249150122,
|
|
43459
|
+
1555081692,
|
|
43460
|
+
1996064986,
|
|
43461
|
+
2554220882,
|
|
43462
|
+
2821834349,
|
|
43463
|
+
2952996808,
|
|
43464
|
+
3210313671,
|
|
43465
|
+
3336571891,
|
|
43466
|
+
3584528711,
|
|
43467
|
+
113926993,
|
|
43468
|
+
338241895,
|
|
43469
|
+
666307205,
|
|
43470
|
+
773529912,
|
|
43471
|
+
1294757372,
|
|
43472
|
+
1396182291,
|
|
43473
|
+
1695183700,
|
|
43474
|
+
1986661051,
|
|
43475
|
+
2177026350,
|
|
43476
|
+
2456956037,
|
|
43477
|
+
2730485921,
|
|
43478
|
+
2820302411,
|
|
43479
|
+
3259730800,
|
|
43480
|
+
3345764771,
|
|
43481
|
+
3516065817,
|
|
43482
|
+
3600352804,
|
|
43483
|
+
4094571909,
|
|
43484
|
+
275423344,
|
|
43485
|
+
430227734,
|
|
43486
|
+
506948616,
|
|
43487
|
+
659060556,
|
|
43488
|
+
883997877,
|
|
43489
|
+
958139571,
|
|
43490
|
+
1322822218,
|
|
43491
|
+
1537002063,
|
|
43492
|
+
1747873779,
|
|
43493
|
+
1955562222,
|
|
43494
|
+
2024104815,
|
|
43495
|
+
2227730452,
|
|
43496
|
+
2361852424,
|
|
43497
|
+
2428436474,
|
|
43498
|
+
2756734187,
|
|
43499
|
+
3204031479,
|
|
43500
|
+
3329325298
|
|
43501
|
+
];
|
|
43502
|
+
|
|
43503
|
+
// ../agent-a2ui-card-contract/dist/esm/schema.js
|
|
43504
|
+
var SCHEMA_TYPES = /* @__PURE__ */ new Set([
|
|
43505
|
+
"array",
|
|
43506
|
+
"boolean",
|
|
43507
|
+
"integer",
|
|
43508
|
+
"null",
|
|
43509
|
+
"number",
|
|
43510
|
+
"object",
|
|
43511
|
+
"string"
|
|
43512
|
+
]);
|
|
43513
|
+
function getJsonSchemaIssues2(value, path2 = "schema", options = {}) {
|
|
43514
|
+
const issues = [];
|
|
43515
|
+
validateSchemaNode(value, path2, issues, options);
|
|
43516
|
+
return issues;
|
|
43517
|
+
}
|
|
43518
|
+
function normalizeTargetJsonSchema(schema) {
|
|
43519
|
+
const cloned = JSON.parse(JSON.stringify(schema));
|
|
43520
|
+
normalizeObjectDefaults(cloned);
|
|
43521
|
+
return cloned;
|
|
43522
|
+
}
|
|
43523
|
+
function validateJsonSchemaValue2(schema, value, path2 = "$") {
|
|
43524
|
+
const issues = [];
|
|
43525
|
+
validateValue(schema, value, path2, issues);
|
|
43526
|
+
return issues;
|
|
43527
|
+
}
|
|
43528
|
+
function normalizeCardDataValue(schema, value, required = true) {
|
|
43529
|
+
if (value === void 0 || value === null)
|
|
43530
|
+
return required ? value : void 0;
|
|
43531
|
+
let normalized = value;
|
|
43532
|
+
if (schema.type === "string" && (typeof value === "boolean" || typeof value === "number" && Number.isFinite(value))) {
|
|
43533
|
+
normalized = String(value);
|
|
43534
|
+
} else if ((schema.type === "number" || schema.type === "integer") && typeof value === "string") {
|
|
43535
|
+
const text = value.trim();
|
|
43536
|
+
if (/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u.test(text)) {
|
|
43537
|
+
const number2 = Number(text);
|
|
43538
|
+
if (Number.isFinite(number2) && (schema.type !== "integer" || Number.isSafeInteger(number2))) {
|
|
43539
|
+
normalized = number2;
|
|
43540
|
+
}
|
|
43541
|
+
}
|
|
43542
|
+
} else if (schema.type === "object" && isPlainRecord(value)) {
|
|
43543
|
+
const properties = isPlainRecord(schema.properties) ? schema.properties : {};
|
|
43544
|
+
const requiredKeys = new Set(Array.isArray(schema.required) ? schema.required : []);
|
|
43545
|
+
normalized = Object.fromEntries(Object.entries(value).flatMap(([key, child]) => {
|
|
43546
|
+
const childSchema = properties[key];
|
|
43547
|
+
const next = isPlainRecord(childSchema) ? normalizeCardDataValue(childSchema, child, requiredKeys.has(key)) : child;
|
|
43548
|
+
return next === void 0 ? [] : [[key, next]];
|
|
43549
|
+
}));
|
|
43550
|
+
} else if (schema.type === "array" && Array.isArray(value) && isPlainRecord(schema.items)) {
|
|
43551
|
+
normalized = value.map((child) => normalizeCardDataValue(schema.items, child));
|
|
43552
|
+
}
|
|
43553
|
+
return !required && validateJsonSchemaValue2(schema, normalized).length > 0 ? void 0 : normalized;
|
|
43554
|
+
}
|
|
43555
|
+
function inferJsonSchemaFromValue(value) {
|
|
43556
|
+
if (value === null)
|
|
43557
|
+
return { type: "null" };
|
|
43558
|
+
if (Array.isArray(value)) {
|
|
43559
|
+
return {
|
|
43560
|
+
type: "array",
|
|
43561
|
+
items: value.length > 0 ? inferJsonSchemaFromValue(value[0]) : {}
|
|
43562
|
+
};
|
|
43563
|
+
}
|
|
43564
|
+
if (typeof value === "object") {
|
|
43565
|
+
const keys2 = Object.keys(value).sort();
|
|
43566
|
+
return {
|
|
43567
|
+
type: "object",
|
|
43568
|
+
additionalProperties: false,
|
|
43569
|
+
required: keys2,
|
|
43570
|
+
properties: Object.fromEntries(keys2.map((key) => [key, inferJsonSchemaFromValue(value[key])]))
|
|
43571
|
+
};
|
|
43572
|
+
}
|
|
43573
|
+
if (typeof value === "number") {
|
|
43574
|
+
return { type: Number.isInteger(value) ? "integer" : "number" };
|
|
43575
|
+
}
|
|
43576
|
+
return { type: typeof value };
|
|
43577
|
+
}
|
|
43578
|
+
function getJsonSchemaAtDataPointer(schema, pointer) {
|
|
43579
|
+
if (!isSafeJsonPointer(pointer, true))
|
|
43580
|
+
return void 0;
|
|
43581
|
+
if (pointer === "/")
|
|
43582
|
+
return schema;
|
|
43583
|
+
return getJsonSchemaAtPath(schema, pointer.slice(1).split("/").map(decodePointerSegment));
|
|
43584
|
+
}
|
|
43585
|
+
function getJsonSchemaAtPath(schema, path2) {
|
|
43586
|
+
let current = schema;
|
|
43587
|
+
for (const segment of path2) {
|
|
43588
|
+
if (!current)
|
|
43589
|
+
return void 0;
|
|
43590
|
+
if (segment === "*" || current.type === "array") {
|
|
43591
|
+
if (!isPlainRecord(current.items))
|
|
43592
|
+
return void 0;
|
|
43593
|
+
current = current.items;
|
|
43594
|
+
if (segment === "*")
|
|
43595
|
+
continue;
|
|
43596
|
+
}
|
|
43597
|
+
if (current.type !== "object" || !isPlainRecord(current.properties)) {
|
|
43598
|
+
return void 0;
|
|
43599
|
+
}
|
|
43600
|
+
const child = current.properties[segment];
|
|
43601
|
+
current = isPlainRecord(child) ? child : void 0;
|
|
43602
|
+
}
|
|
43603
|
+
return current;
|
|
43604
|
+
}
|
|
43605
|
+
function validateSchemaNode(value, path2, issues, options) {
|
|
43606
|
+
if (!isPlainRecord(value) || !isJsonValue(value)) {
|
|
43607
|
+
issues.push(issue2(path2, "INVALID_JSON_SCHEMA", `${path2} must be a JSON object`));
|
|
43608
|
+
return false;
|
|
43609
|
+
}
|
|
43610
|
+
if (value.type === void 0 && options.allowMissingType) {
|
|
43611
|
+
return true;
|
|
43612
|
+
}
|
|
43613
|
+
if (typeof value.type !== "string" || !SCHEMA_TYPES.has(value.type)) {
|
|
43614
|
+
issues.push(issue2(`${path2}.type`, "INVALID_JSON_SCHEMA_TYPE", `${path2}.type must be a supported scalar, object or array type`));
|
|
43615
|
+
return false;
|
|
43616
|
+
}
|
|
43617
|
+
if (value.required !== void 0 && (!Array.isArray(value.required) || value.required.some((entry) => typeof entry !== "string"))) {
|
|
43618
|
+
issues.push(issue2(`${path2}.required`, "INVALID_JSON_SCHEMA_REQUIRED", `${path2}.required must be a string array`));
|
|
43619
|
+
}
|
|
43620
|
+
if (value.type === "object") {
|
|
43621
|
+
if (!isPlainRecord(value.properties)) {
|
|
43622
|
+
if (options.requireCompleteStructures) {
|
|
43623
|
+
issues.push(issue2(`${path2}.properties`, "INCOMPLETE_OBJECT_SCHEMA", "object schemas must declare properties"));
|
|
43624
|
+
}
|
|
43625
|
+
} else {
|
|
43626
|
+
for (const [name, child] of Object.entries(value.properties)) {
|
|
43627
|
+
validateSchemaNode(child, `${path2}.properties.${name}`, issues, options);
|
|
43628
|
+
}
|
|
43629
|
+
const required = Array.isArray(value.required) ? value.required.filter((entry) => typeof entry === "string") : [];
|
|
43630
|
+
for (const name of required) {
|
|
43631
|
+
if (!(name in value.properties)) {
|
|
43632
|
+
issues.push(issue2(`${path2}.required`, "UNKNOWN_REQUIRED_PROPERTY", `required property ${name} is not declared`));
|
|
43633
|
+
}
|
|
43634
|
+
}
|
|
43635
|
+
}
|
|
43636
|
+
if (value.additionalProperties !== void 0 && typeof value.additionalProperties !== "boolean" && !isPlainRecord(value.additionalProperties)) {
|
|
43637
|
+
issues.push(issue2(`${path2}.additionalProperties`, "INVALID_ADDITIONAL_PROPERTIES", "additionalProperties must be a boolean or schema"));
|
|
43638
|
+
}
|
|
43639
|
+
}
|
|
43640
|
+
if (value.type === "array") {
|
|
43641
|
+
if (!isPlainRecord(value.items)) {
|
|
43642
|
+
if (options.requireCompleteStructures) {
|
|
43643
|
+
issues.push(issue2(`${path2}.items`, "INCOMPLETE_ARRAY_SCHEMA", "array schemas must declare items"));
|
|
43644
|
+
}
|
|
43645
|
+
} else {
|
|
43646
|
+
validateSchemaNode(value.items, `${path2}.items`, issues, options);
|
|
43647
|
+
}
|
|
43648
|
+
}
|
|
43649
|
+
return true;
|
|
43650
|
+
}
|
|
43651
|
+
function normalizeObjectDefaults(schema) {
|
|
43652
|
+
if (schema.type === "object") {
|
|
43653
|
+
if (schema.additionalProperties === void 0) {
|
|
43654
|
+
schema.additionalProperties = false;
|
|
43655
|
+
}
|
|
43656
|
+
const properties = isPlainRecord(schema.properties) ? schema.properties : {};
|
|
43657
|
+
for (const child of Object.values(properties)) {
|
|
43658
|
+
if (isPlainRecord(child)) {
|
|
43659
|
+
normalizeObjectDefaults(child);
|
|
43660
|
+
}
|
|
43661
|
+
}
|
|
43662
|
+
} else if (schema.type === "array" && isPlainRecord(schema.items)) {
|
|
43663
|
+
normalizeObjectDefaults(schema.items);
|
|
43664
|
+
}
|
|
43665
|
+
}
|
|
43666
|
+
function validateValue(schema, value, path2, issues) {
|
|
43667
|
+
if (typeof schema.type === "string" && !matchesType(schema.type, value)) {
|
|
43668
|
+
issues.push(issue2(path2, "SCHEMA_TYPE_MISMATCH", `expected ${schema.type}, received ${valueType(value)}`));
|
|
43669
|
+
return;
|
|
43670
|
+
}
|
|
43671
|
+
if (Array.isArray(schema.enum) && !schema.enum.some((entry) => Object.is(entry, value))) {
|
|
43672
|
+
issues.push(issue2(path2, "SCHEMA_ENUM_MISMATCH", "value is not in the declared enum"));
|
|
43673
|
+
return;
|
|
43674
|
+
}
|
|
43675
|
+
if (schema.const !== void 0 && !Object.is(schema.const, value)) {
|
|
43676
|
+
issues.push(issue2(path2, "SCHEMA_CONST_MISMATCH", "value does not match const"));
|
|
43677
|
+
return;
|
|
43678
|
+
}
|
|
43679
|
+
if (schema.type === "object" && isPlainRecord(value)) {
|
|
43680
|
+
const required = Array.isArray(schema.required) ? schema.required.filter((entry) => typeof entry === "string") : [];
|
|
43681
|
+
for (const key of required) {
|
|
43682
|
+
if (!(key in value)) {
|
|
43683
|
+
issues.push(issue2(`${path2}/${key}`, "SCHEMA_REQUIRED_MISSING", `required property ${key} is missing`));
|
|
43684
|
+
}
|
|
43685
|
+
}
|
|
43686
|
+
const properties = isPlainRecord(schema.properties) ? schema.properties : {};
|
|
43687
|
+
for (const [key, childSchema] of Object.entries(properties)) {
|
|
43688
|
+
if (!(key in value) || !isPlainRecord(childSchema))
|
|
43689
|
+
continue;
|
|
43690
|
+
validateValue(childSchema, value[key], `${path2}/${key}`, issues);
|
|
43691
|
+
}
|
|
43692
|
+
if (schema.additionalProperties === false) {
|
|
43693
|
+
for (const key of Object.keys(value)) {
|
|
43694
|
+
if (!(key in properties)) {
|
|
43695
|
+
issues.push(issue2(`${path2}/${key}`, "SCHEMA_ADDITIONAL_PROPERTY", `property ${key} is not allowed`));
|
|
43696
|
+
}
|
|
43697
|
+
}
|
|
43698
|
+
}
|
|
43699
|
+
}
|
|
43700
|
+
if (schema.type === "array" && Array.isArray(value) && isPlainRecord(schema.items)) {
|
|
43701
|
+
value.forEach((entry, index) => {
|
|
43702
|
+
validateValue(schema.items, entry, `${path2}/${index}`, issues);
|
|
43703
|
+
});
|
|
43704
|
+
}
|
|
43705
|
+
}
|
|
43706
|
+
function matchesType(type, value) {
|
|
43707
|
+
switch (type) {
|
|
43708
|
+
case "array":
|
|
43709
|
+
return Array.isArray(value);
|
|
43710
|
+
case "boolean":
|
|
43711
|
+
return typeof value === "boolean";
|
|
43712
|
+
case "integer":
|
|
43713
|
+
return typeof value === "number" && Number.isInteger(value);
|
|
43714
|
+
case "null":
|
|
43715
|
+
return value === null;
|
|
43716
|
+
case "number":
|
|
43717
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
43718
|
+
case "object":
|
|
43719
|
+
return isPlainRecord(value);
|
|
43720
|
+
case "string":
|
|
43721
|
+
return typeof value === "string";
|
|
43722
|
+
default:
|
|
43723
|
+
return false;
|
|
43724
|
+
}
|
|
43725
|
+
}
|
|
43726
|
+
function valueType(value) {
|
|
43727
|
+
if (value === null)
|
|
43728
|
+
return "null";
|
|
43729
|
+
if (Array.isArray(value))
|
|
43730
|
+
return "array";
|
|
43731
|
+
if (typeof value === "number" && Number.isInteger(value))
|
|
43732
|
+
return "integer";
|
|
43733
|
+
return typeof value;
|
|
43734
|
+
}
|
|
43735
|
+
|
|
43736
|
+
// ../agent-a2ui-card-contract/dist/esm/standard-card-data.js
|
|
43737
|
+
function standardCardSurfaceSchemas(message) {
|
|
43738
|
+
const models = /* @__PURE__ */ new Map();
|
|
43739
|
+
for (const instruction of message.datas) {
|
|
43740
|
+
if ("createSurface" in instruction) {
|
|
43741
|
+
models.set(instruction.createSurface.surfaceId, {});
|
|
43742
|
+
} else if ("deleteSurface" in instruction) {
|
|
43743
|
+
models.delete(instruction.deleteSurface.surfaceId);
|
|
43744
|
+
} else if ("updateDataModel" in instruction) {
|
|
43745
|
+
const { surfaceId, path: path2, value } = instruction.updateDataModel;
|
|
43746
|
+
const root = models.get(surfaceId);
|
|
43747
|
+
if (!root || !isSafeJsonPointer(path2) || !isJsonValue(value)) {
|
|
43748
|
+
throw new Error(`\u6807\u51C6\u5361\u6570\u636E\u6A21\u578B\u66F4\u65B0\u65E0\u6548\uFF1A${surfaceId} ${path2}`);
|
|
43749
|
+
}
|
|
43750
|
+
if (path2 === "/") {
|
|
43751
|
+
if (!isPlainRecord(value))
|
|
43752
|
+
throw new Error("\u6807\u51C6\u5361\u6570\u636E\u6A21\u578B\u6839\u8282\u70B9\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
43753
|
+
models.set(surfaceId, structuredClone(value));
|
|
43754
|
+
continue;
|
|
43755
|
+
}
|
|
43756
|
+
const segments = path2.slice(1).split("/").map(decodePointerSegment);
|
|
43757
|
+
let parent = root;
|
|
43758
|
+
for (const [index, segment] of segments.entries()) {
|
|
43759
|
+
if (parent === null || typeof parent !== "object")
|
|
43760
|
+
throw new Error(`\u65E0\u6548\u7684\u6570\u636E\u6A21\u578B\u8DEF\u5F84\uFF1A${path2}`);
|
|
43761
|
+
const last = index === segments.length - 1;
|
|
43762
|
+
if (Array.isArray(parent)) {
|
|
43763
|
+
const offset = Number(segment);
|
|
43764
|
+
if (!Number.isSafeInteger(offset) || offset < 0 || String(offset) !== segment || offset > parent.length) {
|
|
43765
|
+
throw new Error(`\u65E0\u6548\u7684\u6570\u636E\u6A21\u578B\u6570\u7EC4\u4E0B\u6807\uFF1A${path2}`);
|
|
43766
|
+
}
|
|
43767
|
+
if (last)
|
|
43768
|
+
parent[offset] = structuredClone(value);
|
|
43769
|
+
else if (offset === parent.length)
|
|
43770
|
+
parent.push({});
|
|
43771
|
+
parent = parent[offset];
|
|
43772
|
+
} else {
|
|
43773
|
+
if (last)
|
|
43774
|
+
parent[segment] = structuredClone(value);
|
|
43775
|
+
else if (!Object.prototype.hasOwnProperty.call(parent, segment))
|
|
43776
|
+
parent[segment] = {};
|
|
43777
|
+
parent = parent[segment];
|
|
43778
|
+
}
|
|
43779
|
+
}
|
|
43780
|
+
}
|
|
43781
|
+
}
|
|
43782
|
+
return new Map(Array.from(models, ([id2, model]) => [id2, inferJsonSchemaFromValue(model)]));
|
|
43783
|
+
}
|
|
43784
|
+
function standardCardBindingModel(message) {
|
|
43785
|
+
const surfaces = standardCardSurfaceSchemas(message);
|
|
43786
|
+
const fields = [];
|
|
43787
|
+
for (const [surfaceId, schema2] of surfaces) {
|
|
43788
|
+
for (const [key, valueSchema] of Object.entries(schema2.properties)) {
|
|
43789
|
+
const path2 = "/" + [surfaceId, key].map(encodePointerSegment).join("/");
|
|
43790
|
+
if (!isSafeJsonPointer(path2))
|
|
43791
|
+
throw new Error(`\u65E0\u6548\u7684\u6807\u51C6\u5361\u7ED1\u5B9A\u8DEF\u5F84\uFF1A${path2}`);
|
|
43792
|
+
const type = valueSchema.type;
|
|
43793
|
+
if (type !== "array" && type !== "object" && type !== "string" && type !== "number" && type !== "integer" && type !== "boolean")
|
|
43794
|
+
throw new Error(`\u65E0\u6CD5\u786E\u5B9A\u6807\u51C6\u5361\u5B57\u6BB5\u7C7B\u578B\uFF1A${path2}`);
|
|
43795
|
+
fields.push({
|
|
43796
|
+
fieldId: "field-" + sha256Hex(path2).slice(0, 32),
|
|
43797
|
+
path: path2,
|
|
43798
|
+
label: surfaces.size === 1 ? key : surfaceId + " / " + key,
|
|
43799
|
+
source: "business",
|
|
43800
|
+
required: true,
|
|
43801
|
+
type,
|
|
43802
|
+
valueSchema
|
|
43803
|
+
});
|
|
43804
|
+
}
|
|
43805
|
+
}
|
|
43806
|
+
const schema = {
|
|
43807
|
+
type: "object",
|
|
43808
|
+
properties: Object.fromEntries(surfaces),
|
|
43809
|
+
required: [...surfaces].filter(([, item]) => Object.keys(item.properties).length).map(([id2]) => id2),
|
|
43810
|
+
additionalProperties: false
|
|
43811
|
+
};
|
|
43812
|
+
return { fields, schema };
|
|
43813
|
+
}
|
|
43814
|
+
function renderStandardCardData(message, data) {
|
|
43815
|
+
const datas = message.datas.filter((instruction) => !("updateDataModel" in instruction));
|
|
43816
|
+
const updates = [];
|
|
43817
|
+
for (const [surfaceId, schema] of standardCardSurfaceSchemas(message)) {
|
|
43818
|
+
const value = data[surfaceId] ?? {};
|
|
43819
|
+
const issues = validateJsonSchemaValue2(schema, value);
|
|
43820
|
+
if (issues.length)
|
|
43821
|
+
throw new Error(`\u6807\u51C6\u5361\u6570\u636E\u4E0D\u5339\u914D\uFF1A${surfaceId} ${issues[0].path} ${issues[0].message}`);
|
|
43822
|
+
updates.push({ updateDataModel: { surfaceId, path: "/", value } });
|
|
43823
|
+
}
|
|
43824
|
+
return { ...message, datas: [...datas, ...updates] };
|
|
43825
|
+
}
|
|
43826
|
+
|
|
43827
|
+
// ../agent-a2ui-card-contract/dist/esm/types.js
|
|
43828
|
+
var A2UI_CARD_TRANSFORM_LANGUAGE = "jmespath";
|
|
43829
|
+
var A2UI_CARD_TRANSFORM_PROFILE = "linkque-structural-v1";
|
|
43830
|
+
var A2UI_CARD_EXPRESSION_MAX_LENGTH = 4096;
|
|
43831
|
+
var A2UI_CARD_EXPRESSION_MAX_AST_NODES = 512;
|
|
43832
|
+
var A2UI_CARD_EXPRESSION_MAX_AST_DEPTH = 32;
|
|
43833
|
+
var A2UI_CARD_DATA_TRANSFORM_LANGUAGE = "javascript";
|
|
43834
|
+
var A2UI_CARD_DATA_TRANSFORM_PROFILE = "linkque-card-data-transform-v1";
|
|
43835
|
+
var A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES = 32 * 1024;
|
|
43836
|
+
|
|
43383
43837
|
// ../agent-a2ui-card-contract/dist/esm/binding-analyzer.js
|
|
43384
43838
|
var INPUT_COMPONENTS = /* @__PURE__ */ new Set(["ChoicePicker", "Stepper", "TextField"]);
|
|
43385
43839
|
function analyzeA2UIBindings(protocol) {
|
|
@@ -43597,216 +44051,6 @@ function appendProperty(base, segment) {
|
|
|
43597
44051
|
return base ? `${base}.${segment}` : segment;
|
|
43598
44052
|
}
|
|
43599
44053
|
|
|
43600
|
-
// ../agent-a2ui-card-contract/dist/esm/schema.js
|
|
43601
|
-
var SCHEMA_TYPES = /* @__PURE__ */ new Set([
|
|
43602
|
-
"array",
|
|
43603
|
-
"boolean",
|
|
43604
|
-
"integer",
|
|
43605
|
-
"null",
|
|
43606
|
-
"number",
|
|
43607
|
-
"object",
|
|
43608
|
-
"string"
|
|
43609
|
-
]);
|
|
43610
|
-
function getJsonSchemaIssues2(value, path2 = "schema", options = {}) {
|
|
43611
|
-
const issues = [];
|
|
43612
|
-
validateSchemaNode(value, path2, issues, options);
|
|
43613
|
-
return issues;
|
|
43614
|
-
}
|
|
43615
|
-
function normalizeTargetJsonSchema(schema) {
|
|
43616
|
-
const cloned = JSON.parse(JSON.stringify(schema));
|
|
43617
|
-
normalizeObjectDefaults(cloned);
|
|
43618
|
-
return cloned;
|
|
43619
|
-
}
|
|
43620
|
-
function validateJsonSchemaValue2(schema, value, path2 = "$") {
|
|
43621
|
-
const issues = [];
|
|
43622
|
-
validateValue(schema, value, path2, issues);
|
|
43623
|
-
return issues;
|
|
43624
|
-
}
|
|
43625
|
-
function normalizeCardDataValue(schema, value, required = true) {
|
|
43626
|
-
if (value === void 0 || value === null)
|
|
43627
|
-
return required ? value : void 0;
|
|
43628
|
-
let normalized = value;
|
|
43629
|
-
if (schema.type === "string" && (typeof value === "boolean" || typeof value === "number" && Number.isFinite(value))) {
|
|
43630
|
-
normalized = String(value);
|
|
43631
|
-
} else if ((schema.type === "number" || schema.type === "integer") && typeof value === "string") {
|
|
43632
|
-
const text = value.trim();
|
|
43633
|
-
if (/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u.test(text)) {
|
|
43634
|
-
const number2 = Number(text);
|
|
43635
|
-
if (Number.isFinite(number2) && (schema.type !== "integer" || Number.isSafeInteger(number2))) {
|
|
43636
|
-
normalized = number2;
|
|
43637
|
-
}
|
|
43638
|
-
}
|
|
43639
|
-
} else if (schema.type === "object" && isPlainRecord(value)) {
|
|
43640
|
-
const properties = isPlainRecord(schema.properties) ? schema.properties : {};
|
|
43641
|
-
const requiredKeys = new Set(Array.isArray(schema.required) ? schema.required : []);
|
|
43642
|
-
normalized = Object.fromEntries(Object.entries(value).flatMap(([key, child]) => {
|
|
43643
|
-
const childSchema = properties[key];
|
|
43644
|
-
const next = isPlainRecord(childSchema) ? normalizeCardDataValue(childSchema, child, requiredKeys.has(key)) : child;
|
|
43645
|
-
return next === void 0 ? [] : [[key, next]];
|
|
43646
|
-
}));
|
|
43647
|
-
} else if (schema.type === "array" && Array.isArray(value) && isPlainRecord(schema.items)) {
|
|
43648
|
-
normalized = value.map((child) => normalizeCardDataValue(schema.items, child));
|
|
43649
|
-
}
|
|
43650
|
-
return !required && validateJsonSchemaValue2(schema, normalized).length > 0 ? void 0 : normalized;
|
|
43651
|
-
}
|
|
43652
|
-
function getJsonSchemaAtDataPointer(schema, pointer) {
|
|
43653
|
-
if (!isSafeJsonPointer(pointer, true))
|
|
43654
|
-
return void 0;
|
|
43655
|
-
if (pointer === "/")
|
|
43656
|
-
return schema;
|
|
43657
|
-
return getJsonSchemaAtPath(schema, pointer.slice(1).split("/").map(decodePointerSegment));
|
|
43658
|
-
}
|
|
43659
|
-
function getJsonSchemaAtPath(schema, path2) {
|
|
43660
|
-
let current = schema;
|
|
43661
|
-
for (const segment of path2) {
|
|
43662
|
-
if (!current)
|
|
43663
|
-
return void 0;
|
|
43664
|
-
if (segment === "*" || current.type === "array") {
|
|
43665
|
-
if (!isPlainRecord(current.items))
|
|
43666
|
-
return void 0;
|
|
43667
|
-
current = current.items;
|
|
43668
|
-
if (segment === "*")
|
|
43669
|
-
continue;
|
|
43670
|
-
}
|
|
43671
|
-
if (current.type !== "object" || !isPlainRecord(current.properties)) {
|
|
43672
|
-
return void 0;
|
|
43673
|
-
}
|
|
43674
|
-
const child = current.properties[segment];
|
|
43675
|
-
current = isPlainRecord(child) ? child : void 0;
|
|
43676
|
-
}
|
|
43677
|
-
return current;
|
|
43678
|
-
}
|
|
43679
|
-
function validateSchemaNode(value, path2, issues, options) {
|
|
43680
|
-
if (!isPlainRecord(value) || !isJsonValue(value)) {
|
|
43681
|
-
issues.push(issue2(path2, "INVALID_JSON_SCHEMA", `${path2} must be a JSON object`));
|
|
43682
|
-
return false;
|
|
43683
|
-
}
|
|
43684
|
-
if (value.type === void 0 && options.allowMissingType) {
|
|
43685
|
-
return true;
|
|
43686
|
-
}
|
|
43687
|
-
if (typeof value.type !== "string" || !SCHEMA_TYPES.has(value.type)) {
|
|
43688
|
-
issues.push(issue2(`${path2}.type`, "INVALID_JSON_SCHEMA_TYPE", `${path2}.type must be a supported scalar, object or array type`));
|
|
43689
|
-
return false;
|
|
43690
|
-
}
|
|
43691
|
-
if (value.required !== void 0 && (!Array.isArray(value.required) || value.required.some((entry) => typeof entry !== "string"))) {
|
|
43692
|
-
issues.push(issue2(`${path2}.required`, "INVALID_JSON_SCHEMA_REQUIRED", `${path2}.required must be a string array`));
|
|
43693
|
-
}
|
|
43694
|
-
if (value.type === "object") {
|
|
43695
|
-
if (!isPlainRecord(value.properties)) {
|
|
43696
|
-
if (options.requireCompleteStructures) {
|
|
43697
|
-
issues.push(issue2(`${path2}.properties`, "INCOMPLETE_OBJECT_SCHEMA", "object schemas must declare properties"));
|
|
43698
|
-
}
|
|
43699
|
-
} else {
|
|
43700
|
-
for (const [name, child] of Object.entries(value.properties)) {
|
|
43701
|
-
validateSchemaNode(child, `${path2}.properties.${name}`, issues, options);
|
|
43702
|
-
}
|
|
43703
|
-
const required = Array.isArray(value.required) ? value.required.filter((entry) => typeof entry === "string") : [];
|
|
43704
|
-
for (const name of required) {
|
|
43705
|
-
if (!(name in value.properties)) {
|
|
43706
|
-
issues.push(issue2(`${path2}.required`, "UNKNOWN_REQUIRED_PROPERTY", `required property ${name} is not declared`));
|
|
43707
|
-
}
|
|
43708
|
-
}
|
|
43709
|
-
}
|
|
43710
|
-
if (value.additionalProperties !== void 0 && typeof value.additionalProperties !== "boolean" && !isPlainRecord(value.additionalProperties)) {
|
|
43711
|
-
issues.push(issue2(`${path2}.additionalProperties`, "INVALID_ADDITIONAL_PROPERTIES", "additionalProperties must be a boolean or schema"));
|
|
43712
|
-
}
|
|
43713
|
-
}
|
|
43714
|
-
if (value.type === "array") {
|
|
43715
|
-
if (!isPlainRecord(value.items)) {
|
|
43716
|
-
if (options.requireCompleteStructures) {
|
|
43717
|
-
issues.push(issue2(`${path2}.items`, "INCOMPLETE_ARRAY_SCHEMA", "array schemas must declare items"));
|
|
43718
|
-
}
|
|
43719
|
-
} else {
|
|
43720
|
-
validateSchemaNode(value.items, `${path2}.items`, issues, options);
|
|
43721
|
-
}
|
|
43722
|
-
}
|
|
43723
|
-
return true;
|
|
43724
|
-
}
|
|
43725
|
-
function normalizeObjectDefaults(schema) {
|
|
43726
|
-
if (schema.type === "object") {
|
|
43727
|
-
if (schema.additionalProperties === void 0) {
|
|
43728
|
-
schema.additionalProperties = false;
|
|
43729
|
-
}
|
|
43730
|
-
const properties = isPlainRecord(schema.properties) ? schema.properties : {};
|
|
43731
|
-
for (const child of Object.values(properties)) {
|
|
43732
|
-
if (isPlainRecord(child)) {
|
|
43733
|
-
normalizeObjectDefaults(child);
|
|
43734
|
-
}
|
|
43735
|
-
}
|
|
43736
|
-
} else if (schema.type === "array" && isPlainRecord(schema.items)) {
|
|
43737
|
-
normalizeObjectDefaults(schema.items);
|
|
43738
|
-
}
|
|
43739
|
-
}
|
|
43740
|
-
function validateValue(schema, value, path2, issues) {
|
|
43741
|
-
if (typeof schema.type === "string" && !matchesType(schema.type, value)) {
|
|
43742
|
-
issues.push(issue2(path2, "SCHEMA_TYPE_MISMATCH", `expected ${schema.type}, received ${valueType(value)}`));
|
|
43743
|
-
return;
|
|
43744
|
-
}
|
|
43745
|
-
if (Array.isArray(schema.enum) && !schema.enum.some((entry) => Object.is(entry, value))) {
|
|
43746
|
-
issues.push(issue2(path2, "SCHEMA_ENUM_MISMATCH", "value is not in the declared enum"));
|
|
43747
|
-
return;
|
|
43748
|
-
}
|
|
43749
|
-
if (schema.const !== void 0 && !Object.is(schema.const, value)) {
|
|
43750
|
-
issues.push(issue2(path2, "SCHEMA_CONST_MISMATCH", "value does not match const"));
|
|
43751
|
-
return;
|
|
43752
|
-
}
|
|
43753
|
-
if (schema.type === "object" && isPlainRecord(value)) {
|
|
43754
|
-
const required = Array.isArray(schema.required) ? schema.required.filter((entry) => typeof entry === "string") : [];
|
|
43755
|
-
for (const key of required) {
|
|
43756
|
-
if (!(key in value)) {
|
|
43757
|
-
issues.push(issue2(`${path2}/${key}`, "SCHEMA_REQUIRED_MISSING", `required property ${key} is missing`));
|
|
43758
|
-
}
|
|
43759
|
-
}
|
|
43760
|
-
const properties = isPlainRecord(schema.properties) ? schema.properties : {};
|
|
43761
|
-
for (const [key, childSchema] of Object.entries(properties)) {
|
|
43762
|
-
if (!(key in value) || !isPlainRecord(childSchema))
|
|
43763
|
-
continue;
|
|
43764
|
-
validateValue(childSchema, value[key], `${path2}/${key}`, issues);
|
|
43765
|
-
}
|
|
43766
|
-
if (schema.additionalProperties === false) {
|
|
43767
|
-
for (const key of Object.keys(value)) {
|
|
43768
|
-
if (!(key in properties)) {
|
|
43769
|
-
issues.push(issue2(`${path2}/${key}`, "SCHEMA_ADDITIONAL_PROPERTY", `property ${key} is not allowed`));
|
|
43770
|
-
}
|
|
43771
|
-
}
|
|
43772
|
-
}
|
|
43773
|
-
}
|
|
43774
|
-
if (schema.type === "array" && Array.isArray(value) && isPlainRecord(schema.items)) {
|
|
43775
|
-
value.forEach((entry, index) => {
|
|
43776
|
-
validateValue(schema.items, entry, `${path2}/${index}`, issues);
|
|
43777
|
-
});
|
|
43778
|
-
}
|
|
43779
|
-
}
|
|
43780
|
-
function matchesType(type, value) {
|
|
43781
|
-
switch (type) {
|
|
43782
|
-
case "array":
|
|
43783
|
-
return Array.isArray(value);
|
|
43784
|
-
case "boolean":
|
|
43785
|
-
return typeof value === "boolean";
|
|
43786
|
-
case "integer":
|
|
43787
|
-
return typeof value === "number" && Number.isInteger(value);
|
|
43788
|
-
case "null":
|
|
43789
|
-
return value === null;
|
|
43790
|
-
case "number":
|
|
43791
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
43792
|
-
case "object":
|
|
43793
|
-
return isPlainRecord(value);
|
|
43794
|
-
case "string":
|
|
43795
|
-
return typeof value === "string";
|
|
43796
|
-
default:
|
|
43797
|
-
return false;
|
|
43798
|
-
}
|
|
43799
|
-
}
|
|
43800
|
-
function valueType(value) {
|
|
43801
|
-
if (value === null)
|
|
43802
|
-
return "null";
|
|
43803
|
-
if (Array.isArray(value))
|
|
43804
|
-
return "array";
|
|
43805
|
-
if (typeof value === "number" && Number.isInteger(value))
|
|
43806
|
-
return "integer";
|
|
43807
|
-
return typeof value;
|
|
43808
|
-
}
|
|
43809
|
-
|
|
43810
44054
|
// ../agent-a2ui-card-contract/dist/esm/expression.js
|
|
43811
44055
|
var import_jmespath2 = __toESM(require_jmespath(), 1);
|
|
43812
44056
|
var ALLOWED_AST_TYPES2 = /* @__PURE__ */ new Set([
|
|
@@ -44816,7 +45060,10 @@ function getA2UICardResourceConfigIssues(value) {
|
|
|
44816
45060
|
validateResolverCoverage(fields, resolver, issues, card);
|
|
44817
45061
|
return issues;
|
|
44818
45062
|
}
|
|
44819
|
-
function
|
|
45063
|
+
function getStandardCardExecutionIssues(value) {
|
|
45064
|
+
return value.dataMode === "pipeline" ? getA2UICardResourceConfigV4PipelineIssues(value, true) : getA2UICardResourceConfigV3Issues(value, true);
|
|
45065
|
+
}
|
|
45066
|
+
function getA2UICardResourceConfigV4PipelineIssues(value, standard = false) {
|
|
44820
45067
|
const issues = [];
|
|
44821
45068
|
exactKeys(value, [
|
|
44822
45069
|
"schemaVersion",
|
|
@@ -44855,7 +45102,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
44855
45102
|
}
|
|
44856
45103
|
validateDataTransform(value.dataTransform, "config.dataTransform", issues);
|
|
44857
45104
|
const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, "config.dataModelSchema", issues);
|
|
44858
|
-
const card = validateTemplate(value.a2uiTemplate, fields, issues);
|
|
45105
|
+
const card = standard ? void 0 : validateTemplate(value.a2uiTemplate, fields, issues);
|
|
44859
45106
|
if (card) {
|
|
44860
45107
|
issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"), ...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
|
|
44861
45108
|
}
|
|
@@ -44867,7 +45114,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
44867
45114
|
}
|
|
44868
45115
|
return issues;
|
|
44869
45116
|
}
|
|
44870
|
-
function getA2UICardResourceConfigV3Issues(value) {
|
|
45117
|
+
function getA2UICardResourceConfigV3Issues(value, standard = false) {
|
|
44871
45118
|
const issues = [];
|
|
44872
45119
|
if (value.actionBindings !== void 0) {
|
|
44873
45120
|
issues.push(issue2("config.actionBindings", "LEGACY_PAYMENT_ACTION_BINDINGS_UNSUPPORTED", "payment actions must be defined inline in card JSON"));
|
|
@@ -44900,7 +45147,7 @@ function getA2UICardResourceConfigV3Issues(value) {
|
|
|
44900
45147
|
}
|
|
44901
45148
|
const dataSources = validateDataSources(value.dataSources, "config.dataSources", issues);
|
|
44902
45149
|
const bindings = validateV3OutputBindings(value.bindings, "config.bindings", issues);
|
|
44903
|
-
const card = validateTemplate(value.a2uiTemplate, fields, issues);
|
|
45150
|
+
const card = standard ? void 0 : validateTemplate(value.a2uiTemplate, fields, issues);
|
|
44904
45151
|
if (value.schemaVersion === "4" && card) {
|
|
44905
45152
|
issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"));
|
|
44906
45153
|
issues.push(...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
|
|
@@ -46039,7 +46286,7 @@ async function executeCardPresentation(resource, registry, runtimeContext, args,
|
|
|
46039
46286
|
return createPresentationResult(resource, config, viewModel);
|
|
46040
46287
|
}
|
|
46041
46288
|
async function executeCardPresentationFromSources(resource, runtimeContext, sourceResults, signal, cardProvider) {
|
|
46042
|
-
const config = parseCardConfig(resource);
|
|
46289
|
+
const config = await resolveStandardCardExecution(resource, parseCardConfig(resource), cardProvider, signal);
|
|
46043
46290
|
if (config.schemaVersion !== "3" && config.schemaVersion !== "4") {
|
|
46044
46291
|
throw new Error("Source-result rendering is only available for schema v3/v4 cards");
|
|
46045
46292
|
}
|
|
@@ -46108,7 +46355,13 @@ async function executeCardPresentationFromSources(resource, runtimeContext, sour
|
|
|
46108
46355
|
}
|
|
46109
46356
|
async function createPresentationResult(resource, config, viewModel, cardProvider, signal) {
|
|
46110
46357
|
const content = config.a2uiTemplate.content ?? await cardProvider.loadDefinition(resource.resourceId, signal);
|
|
46111
|
-
const
|
|
46358
|
+
const standardCard = "format" in resource.config && resource.config.format === "alipay-a2ui";
|
|
46359
|
+
const payload = standardCard ? {
|
|
46360
|
+
format: "alipay-a2ui",
|
|
46361
|
+
protocol: renderStandardCardData(JSON.parse(content), viewModel)
|
|
46362
|
+
} : {
|
|
46363
|
+
protocol: injectResolvedViewModel(JSON.parse(content), viewModel)
|
|
46364
|
+
};
|
|
46112
46365
|
const cardInstanceId = `card-instance-${randomUUID2()}`;
|
|
46113
46366
|
const receipt = {
|
|
46114
46367
|
version: 1,
|
|
@@ -46127,7 +46380,7 @@ async function createPresentationResult(resource, config, viewModel, cardProvide
|
|
|
46127
46380
|
card: {
|
|
46128
46381
|
type: "a2ui_card",
|
|
46129
46382
|
itemId: cardInstanceId,
|
|
46130
|
-
payload
|
|
46383
|
+
payload,
|
|
46131
46384
|
metadata: {
|
|
46132
46385
|
cardRef: resource.resourceId,
|
|
46133
46386
|
cardRevision: config.revision,
|
|
@@ -46157,7 +46410,14 @@ function projectPresentationReceiptForModel(receipt) {
|
|
|
46157
46410
|
};
|
|
46158
46411
|
}
|
|
46159
46412
|
function parseCardConfig(resource) {
|
|
46160
|
-
if ("
|
|
46413
|
+
if ("format" in resource.config && resource.config.format === "alipay-a2ui") {
|
|
46414
|
+
const stored = resource.config;
|
|
46415
|
+
if (stored.schemaVersion !== "4" || !stored.revision || !Array.isArray(stored.dataSources))
|
|
46416
|
+
throw new Error("\u6807\u51C6\u5361\u5C1A\u672A\u914D\u7F6E\u6267\u884C\u53C2\u6570");
|
|
46417
|
+
const a2uiTemplate = { content: "", argsSchema: {} };
|
|
46418
|
+
return stored.dataMode === "pipeline" ? { ...stored, fields: [], a2uiTemplate, dataModelSchema: {} } : { ...stored, fields: [], a2uiTemplate };
|
|
46419
|
+
}
|
|
46420
|
+
if ("definitionRef" in resource.config && resource.config.schemaVersion === "4")
|
|
46161
46421
|
return resource.config;
|
|
46162
46422
|
const parsed = parseA2UICardResourceConfig(resource.config);
|
|
46163
46423
|
if (!parsed.success) {
|
|
@@ -46165,6 +46425,25 @@ function parseCardConfig(resource) {
|
|
|
46165
46425
|
}
|
|
46166
46426
|
return parsed.data;
|
|
46167
46427
|
}
|
|
46428
|
+
async function resolveStandardCardExecution(resource, config, provider, signal) {
|
|
46429
|
+
if (!("format" in resource.config) || resource.config.format !== "alipay-a2ui")
|
|
46430
|
+
return config;
|
|
46431
|
+
if (!provider)
|
|
46432
|
+
throw new Error("\u6807\u51C6\u5361\u7F3A\u5C11\u7ED3\u6784\u8BFB\u53D6\u670D\u52A1");
|
|
46433
|
+
const content = await provider.loadDefinition(resource.resourceId, signal);
|
|
46434
|
+
const { fields, schema } = standardCardBindingModel(JSON.parse(content));
|
|
46435
|
+
const issues = getStandardCardExecutionIssues({
|
|
46436
|
+
...resource.config,
|
|
46437
|
+
fields,
|
|
46438
|
+
dataModelSchema: schema
|
|
46439
|
+
});
|
|
46440
|
+
if (issues.length)
|
|
46441
|
+
throw new Error(issues.map((issue3) => issue3.message).join("\uFF1B"));
|
|
46442
|
+
const a2uiTemplate = { content, argsSchema: schema };
|
|
46443
|
+
if (config.schemaVersion === "4" && config.dataMode === "pipeline")
|
|
46444
|
+
return { ...config, fields, a2uiTemplate, dataModelSchema: schema };
|
|
46445
|
+
return { ...config, fields, a2uiTemplate };
|
|
46446
|
+
}
|
|
46168
46447
|
function isAgentPresentationToolResult(value) {
|
|
46169
46448
|
if (!isJsonObject(value))
|
|
46170
46449
|
return false;
|
|
@@ -57443,10 +57722,10 @@ var inflt = function(dat, st, buf, dict) {
|
|
|
57443
57722
|
lpos = pos, lm = null;
|
|
57444
57723
|
break;
|
|
57445
57724
|
} else {
|
|
57446
|
-
var
|
|
57725
|
+
var add2 = sym - 254;
|
|
57447
57726
|
if (sym > 264) {
|
|
57448
57727
|
var i = sym - 257, b = fleb[i];
|
|
57449
|
-
|
|
57728
|
+
add2 = bits(dat, pos, (1 << b) - 1) + fl[i];
|
|
57450
57729
|
pos += b;
|
|
57451
57730
|
}
|
|
57452
57731
|
var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
|
|
@@ -57465,7 +57744,7 @@ var inflt = function(dat, st, buf, dict) {
|
|
|
57465
57744
|
}
|
|
57466
57745
|
if (resize)
|
|
57467
57746
|
cbuf(bt + 131072);
|
|
57468
|
-
var end = bt +
|
|
57747
|
+
var end = bt + add2;
|
|
57469
57748
|
if (bt < dt) {
|
|
57470
57749
|
var shift = dl - dt, dend = Math.min(dt, end);
|
|
57471
57750
|
if (shift + bt < 0)
|
|
@@ -59219,6 +59498,7 @@ export {
|
|
|
59219
59498
|
createPresentationResult,
|
|
59220
59499
|
projectPresentationReceiptForModel,
|
|
59221
59500
|
parseCardConfig,
|
|
59501
|
+
resolveStandardCardExecution,
|
|
59222
59502
|
isAgentPresentationToolResult,
|
|
59223
59503
|
isAgentPresentationSkippedToolResult,
|
|
59224
59504
|
CARD_SEQUENCE,
|