linkque-cli-v2 1.1.5 → 1.2.1
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 +272 -11
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-IMZDZMKV.js → chunk-IXJFWSVE.js} +474 -25
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-B56A2RV5.js → chunk-NRTXRI33.js} +155 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +222 -4
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +1 -1
- package/worker.js +571 -54
package/linkquejs.js
CHANGED
|
@@ -19550,6 +19550,30 @@ var SEARCH_DATABASE_ID = "linkque";
|
|
|
19550
19550
|
var SEARCH_TABLE_ID = "linkque_conversation_message_search";
|
|
19551
19551
|
var CLIENT_CAPABILITY_DATABASE_ID = "linkque";
|
|
19552
19552
|
var CLIENT_CAPABILITY_TABLE_ID = "linkque_client_cap_invocations";
|
|
19553
|
+
var A2UI_ACTION_DATABASE_ID = "linkque";
|
|
19554
|
+
var A2UI_ACTION_TABLE_ID = "linkque_a2ui_action_invocations";
|
|
19555
|
+
var A2UI_ACTION_TABLE_COLUMNS = [
|
|
19556
|
+
...["ownerId", "agentId", "threadId", "actionId", "cardRef", "cardRevision", "surfaceId", "componentId"].map((key) => ({
|
|
19557
|
+
key,
|
|
19558
|
+
type: "varchar",
|
|
19559
|
+
required: true,
|
|
19560
|
+
array: false,
|
|
19561
|
+
size: 128,
|
|
19562
|
+
default: null
|
|
19563
|
+
})),
|
|
19564
|
+
{ key: "cardInstanceId", type: "varchar", required: true, array: false, size: 256, default: null },
|
|
19565
|
+
{ key: "status", type: "varchar", required: true, array: false, size: 32, default: null },
|
|
19566
|
+
{ key: "actionContext", type: "text", required: true, array: false, size: 0, default: null },
|
|
19567
|
+
{ key: "tradeNO", type: "varchar", required: false, array: false, size: 64, default: null },
|
|
19568
|
+
{ key: "callback", type: "text", required: false, array: false, size: 0, default: null },
|
|
19569
|
+
{ key: "verification", type: "text", required: false, array: false, size: 0, default: null },
|
|
19570
|
+
{ key: "createdAt", type: "varchar", required: true, array: false, size: 32, default: null },
|
|
19571
|
+
{ key: "expiresAt", type: "varchar", required: true, array: false, size: 32, default: null }
|
|
19572
|
+
];
|
|
19573
|
+
var A2UI_ACTION_TABLE_INDEXES = [
|
|
19574
|
+
{ key: "thread_status", type: "key", columns: ["threadId", "status"], orders: ["asc", "asc"] },
|
|
19575
|
+
{ key: "expires_at", type: "key", columns: ["expiresAt"], orders: ["asc"] }
|
|
19576
|
+
];
|
|
19553
19577
|
var CLIENT_CAPABILITY_TABLE_COLUMNS = [
|
|
19554
19578
|
...["ownerId", "agentId", "threadId", "runId", "toolCallId"].map((key) => ({
|
|
19555
19579
|
key,
|
|
@@ -20148,6 +20172,8 @@ var FUNCTION_DEFS = [
|
|
|
20148
20172
|
value: CLIENT_CAPABILITY_DATABASE_ID
|
|
20149
20173
|
},
|
|
20150
20174
|
{ key: "CLIENT_CAPABILITY_TABLE_ID", value: CLIENT_CAPABILITY_TABLE_ID },
|
|
20175
|
+
{ key: "A2UI_ACTION_DATABASE_ID", value: A2UI_ACTION_DATABASE_ID },
|
|
20176
|
+
{ key: "A2UI_ACTION_TABLE_ID", value: A2UI_ACTION_TABLE_ID },
|
|
20151
20177
|
{ key: "RUN_CHUNK_SIZE", value: "10" },
|
|
20152
20178
|
{ key: "RUN_CANCEL_POLL_INTERVAL_MS", value: "500" },
|
|
20153
20179
|
// linkquegw 出站地址:线上套(无 x-linkque-env 头时生效)。
|
|
@@ -20198,6 +20224,8 @@ var FUNCTION_DEFS = [
|
|
|
20198
20224
|
value: CLIENT_CAPABILITY_DATABASE_ID
|
|
20199
20225
|
},
|
|
20200
20226
|
{ key: "CLIENT_CAPABILITY_TABLE_ID", value: CLIENT_CAPABILITY_TABLE_ID },
|
|
20227
|
+
{ key: "A2UI_ACTION_DATABASE_ID", value: A2UI_ACTION_DATABASE_ID },
|
|
20228
|
+
{ key: "A2UI_ACTION_TABLE_ID", value: A2UI_ACTION_TABLE_ID },
|
|
20201
20229
|
{
|
|
20202
20230
|
key: "LINKQUEGW_MCP_SIGN_ENDPOINT",
|
|
20203
20231
|
value: LINKQUEGW_MCP_SIGN_ENDPOINT
|
|
@@ -20273,6 +20301,16 @@ var TABLES = [
|
|
|
20273
20301
|
permissions: [],
|
|
20274
20302
|
columns: CLIENT_CAPABILITY_TABLE_COLUMNS,
|
|
20275
20303
|
indexes: CLIENT_CAPABILITY_TABLE_INDEXES
|
|
20304
|
+
},
|
|
20305
|
+
{
|
|
20306
|
+
$id: A2UI_ACTION_TABLE_ID,
|
|
20307
|
+
databaseId: A2UI_ACTION_DATABASE_ID,
|
|
20308
|
+
name: A2UI_ACTION_TABLE_ID,
|
|
20309
|
+
enabled: true,
|
|
20310
|
+
rowSecurity: true,
|
|
20311
|
+
permissions: [],
|
|
20312
|
+
columns: A2UI_ACTION_TABLE_COLUMNS,
|
|
20313
|
+
indexes: A2UI_ACTION_TABLE_INDEXES
|
|
20276
20314
|
}
|
|
20277
20315
|
];
|
|
20278
20316
|
var buildAppwriteConfigTemplate = (envOverrides = {}) => ({
|
|
@@ -21040,6 +21078,7 @@ var AGENT_LOG = ".linkque/logs/agent.log";
|
|
|
21040
21078
|
var HEALTH_PATH = "/healthz";
|
|
21041
21079
|
var RUNS_PATH = "/runs";
|
|
21042
21080
|
var HOME_DATA_PATH = "/home-data";
|
|
21081
|
+
var A2UI_ACTION_PATH = "/a2ui-action";
|
|
21043
21082
|
var AGENT_RUNTIME_PROTOCOL = "conversation-runs-v2";
|
|
21044
21083
|
var API_KEY_ENV = "LINKQUE_AGENT_API_KEY";
|
|
21045
21084
|
var stopped = (health) => ({
|
|
@@ -21307,6 +21346,7 @@ var spawnAgentOwner = (cwd, config2, port, apiKey, statePath) => {
|
|
|
21307
21346
|
cwd,
|
|
21308
21347
|
healthPath: HEALTH_PATH,
|
|
21309
21348
|
homeDataPath: HOME_DATA_PATH,
|
|
21349
|
+
a2uiActionPath: A2UI_ACTION_PATH,
|
|
21310
21350
|
logPath: import_path15.default.join(cwd, AGENT_LOG),
|
|
21311
21351
|
port,
|
|
21312
21352
|
runsPath: RUNS_PATH,
|
|
@@ -26316,6 +26356,194 @@ function candidateKey(resourceId, toolName) {
|
|
|
26316
26356
|
return `${resourceId}\0${toolName}`;
|
|
26317
26357
|
}
|
|
26318
26358
|
|
|
26359
|
+
// ../agent-a2ui-card-contract/dist/esm/payment-action.js
|
|
26360
|
+
var A2UI_PAYMENT_ACTION_NAME = "payment.trade-pay";
|
|
26361
|
+
var A2UI_PAYMENT_CALLBACK_MAX_BYTES = 16 * 1024;
|
|
26362
|
+
function getA2UICardActionBindingIssues(value, path22 = "actionBindings") {
|
|
26363
|
+
if (!Array.isArray(value)) {
|
|
26364
|
+
return [issue2(path22, "INVALID_ACTION_BINDINGS", "actionBindings must be an array")];
|
|
26365
|
+
}
|
|
26366
|
+
const issues = [];
|
|
26367
|
+
const actionIds = /* @__PURE__ */ new Set();
|
|
26368
|
+
value.forEach((candidate, index) => {
|
|
26369
|
+
const itemPath = `${path22}[${index}]`;
|
|
26370
|
+
if (!isPlainRecord(candidate)) {
|
|
26371
|
+
issues.push(issue2(itemPath, "INVALID_ACTION_BINDING", "action binding must be an object"));
|
|
26372
|
+
return;
|
|
26373
|
+
}
|
|
26374
|
+
if (!isSafeIdentifier(candidate.actionId)) {
|
|
26375
|
+
issues.push(issue2(`${itemPath}.actionId`, "INVALID_ACTION_ID", "actionId is invalid"));
|
|
26376
|
+
} else if (actionIds.has(candidate.actionId)) {
|
|
26377
|
+
issues.push(issue2(`${itemPath}.actionId`, "DUPLICATE_ACTION_ID", "actionId must be unique"));
|
|
26378
|
+
} else {
|
|
26379
|
+
actionIds.add(candidate.actionId);
|
|
26380
|
+
}
|
|
26381
|
+
if (candidate.kind !== "payment") {
|
|
26382
|
+
issues.push(issue2(`${itemPath}.kind`, "INVALID_ACTION_KIND", "kind must be payment"));
|
|
26383
|
+
return;
|
|
26384
|
+
}
|
|
26385
|
+
rejectExtraKeys(candidate, ["actionId", "kind", "createTrade", "queryTrade"], itemPath, issues);
|
|
26386
|
+
validateToolBinding(candidate.createTrade, `${itemPath}.createTrade`, "create", issues);
|
|
26387
|
+
validateToolBinding(candidate.queryTrade, `${itemPath}.queryTrade`, "query", issues);
|
|
26388
|
+
});
|
|
26389
|
+
return issues;
|
|
26390
|
+
}
|
|
26391
|
+
function getA2UIPaymentActionReferenceIssues(card, bindings, path22 = "a2uiTemplate.content") {
|
|
26392
|
+
const issues = [];
|
|
26393
|
+
const bindingIds = new Set(bindings.map((binding) => binding.actionId));
|
|
26394
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
26395
|
+
card.forEach((message, messageIndex) => {
|
|
26396
|
+
message.datas.forEach((instruction, instructionIndex) => {
|
|
26397
|
+
const instructionRecord = instruction;
|
|
26398
|
+
const update = isPlainRecord(instructionRecord.updateComponents) ? instructionRecord.updateComponents : void 0;
|
|
26399
|
+
const components = update && Array.isArray(update.components) ? update.components : [];
|
|
26400
|
+
components.forEach((component, componentIndex) => {
|
|
26401
|
+
if (!isPlainRecord(component))
|
|
26402
|
+
return;
|
|
26403
|
+
collectPaymentActionReferences(component.action, `${path22}[${messageIndex}].datas[${instructionIndex}].updateComponents.components[${componentIndex}].action`, referenced, issues);
|
|
26404
|
+
});
|
|
26405
|
+
});
|
|
26406
|
+
});
|
|
26407
|
+
for (const actionId of referenced) {
|
|
26408
|
+
if (!bindingIds.has(actionId)) {
|
|
26409
|
+
issues.push(issue2(path22, "PAYMENT_ACTION_BINDING_MISSING", `payment action ${actionId} has no action binding`));
|
|
26410
|
+
}
|
|
26411
|
+
}
|
|
26412
|
+
for (const actionId of bindingIds) {
|
|
26413
|
+
if (!referenced.has(actionId)) {
|
|
26414
|
+
issues.push(issue2(path22, "PAYMENT_ACTION_UNUSED", `payment action binding ${actionId} is not referenced`));
|
|
26415
|
+
}
|
|
26416
|
+
}
|
|
26417
|
+
return issues;
|
|
26418
|
+
}
|
|
26419
|
+
function validateToolBinding(value, path22, phase, issues) {
|
|
26420
|
+
if (!isPlainRecord(value)) {
|
|
26421
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_TOOL", `${path22} must be an object`));
|
|
26422
|
+
return;
|
|
26423
|
+
}
|
|
26424
|
+
rejectExtraKeys(value, phase === "create" ? ["mcpResourceId", "toolName", "inputBindings", "tradeNoPath"] : ["mcpResourceId", "toolName", "inputBindings", "statusPath", "paidValues"], path22, issues);
|
|
26425
|
+
if (!isSafeIdentifier(value.mcpResourceId)) {
|
|
26426
|
+
issues.push(issue2(`${path22}.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
|
|
26427
|
+
}
|
|
26428
|
+
if (typeof value.toolName !== "string" || !value.toolName.trim()) {
|
|
26429
|
+
issues.push(issue2(`${path22}.toolName`, "INVALID_TOOL_NAME", "toolName is required"));
|
|
26430
|
+
}
|
|
26431
|
+
validateInputBindings2(value.inputBindings, `${path22}.inputBindings`, phase, issues);
|
|
26432
|
+
if (phase === "create") {
|
|
26433
|
+
if (!isSafeJsonPointer(value.tradeNoPath)) {
|
|
26434
|
+
issues.push(issue2(`${path22}.tradeNoPath`, "INVALID_TRADE_NO_PATH", "tradeNoPath must be an absolute JSON Pointer"));
|
|
26435
|
+
}
|
|
26436
|
+
return;
|
|
26437
|
+
}
|
|
26438
|
+
if (!isSafeJsonPointer(value.statusPath)) {
|
|
26439
|
+
issues.push(issue2(`${path22}.statusPath`, "INVALID_PAYMENT_STATUS_PATH", "statusPath must be an absolute JSON Pointer"));
|
|
26440
|
+
}
|
|
26441
|
+
if (!Array.isArray(value.inputBindings) || !value.inputBindings.some((binding) => isPlainRecord(binding) && isPlainRecord(binding.source) && binding.source.kind === "trade-no")) {
|
|
26442
|
+
issues.push(issue2(`${path22}.inputBindings`, "PAYMENT_TRADE_NO_BINDING_MISSING", "queryTrade must map tradeNO"));
|
|
26443
|
+
}
|
|
26444
|
+
if (!Array.isArray(value.paidValues) || value.paidValues.length === 0 || value.paidValues.some((entry) => !isJsonPrimitive(entry))) {
|
|
26445
|
+
issues.push(issue2(`${path22}.paidValues`, "INVALID_PAID_VALUES", "paidValues must contain JSON primitives"));
|
|
26446
|
+
}
|
|
26447
|
+
}
|
|
26448
|
+
function collectPaymentActionReferences(value, path22, referenced, issues) {
|
|
26449
|
+
if (!isPlainRecord(value))
|
|
26450
|
+
return;
|
|
26451
|
+
if (isPlainRecord(value.client) && value.client.name === A2UI_PAYMENT_ACTION_NAME) {
|
|
26452
|
+
const context = value.client.context;
|
|
26453
|
+
if (!isPlainRecord(context) || !isSafeIdentifier(context.actionId)) {
|
|
26454
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_ACTION", "payment action requires a safe actionId"));
|
|
26455
|
+
return;
|
|
26456
|
+
}
|
|
26457
|
+
rejectExtraKeys(context, ["actionId", "actionContext"], `${path22}.client.context`, issues);
|
|
26458
|
+
if (!isPlainRecord(context.actionContext)) {
|
|
26459
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_ACTION", "payment action requires an object actionContext"));
|
|
26460
|
+
}
|
|
26461
|
+
referenced.add(context.actionId);
|
|
26462
|
+
return;
|
|
26463
|
+
}
|
|
26464
|
+
if (!isPlainRecord(value.select))
|
|
26465
|
+
return;
|
|
26466
|
+
if (Array.isArray(value.select.cases)) {
|
|
26467
|
+
value.select.cases.forEach((entry, index) => {
|
|
26468
|
+
if (isPlainRecord(entry)) {
|
|
26469
|
+
collectPaymentActionReferences(entry.action, `${path22}.select.cases[${index}].action`, referenced, issues);
|
|
26470
|
+
}
|
|
26471
|
+
});
|
|
26472
|
+
}
|
|
26473
|
+
collectPaymentActionReferences(value.select.default, `${path22}.select.default`, referenced, issues);
|
|
26474
|
+
}
|
|
26475
|
+
function validateInputBindings2(value, path22, phase, issues) {
|
|
26476
|
+
if (!Array.isArray(value) || value.length > 128) {
|
|
26477
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_INPUT_BINDINGS", "inputBindings must be an array of at most 128 entries"));
|
|
26478
|
+
return;
|
|
26479
|
+
}
|
|
26480
|
+
const targets = /* @__PURE__ */ new Set();
|
|
26481
|
+
value.forEach((candidate, index) => {
|
|
26482
|
+
const itemPath = `${path22}[${index}]`;
|
|
26483
|
+
if (!isPlainRecord(candidate) || !isSafeJsonPointer(candidate.inputPath)) {
|
|
26484
|
+
issues.push(issue2(itemPath, "INVALID_PAYMENT_INPUT_BINDING", "inputPath must be an absolute JSON Pointer"));
|
|
26485
|
+
return;
|
|
26486
|
+
}
|
|
26487
|
+
rejectExtraKeys(candidate, ["inputPath", "source"], itemPath, issues);
|
|
26488
|
+
if (targets.has(candidate.inputPath)) {
|
|
26489
|
+
issues.push(issue2(`${itemPath}.inputPath`, "DUPLICATE_PAYMENT_INPUT_PATH", "inputPath must be unique"));
|
|
26490
|
+
}
|
|
26491
|
+
targets.add(candidate.inputPath);
|
|
26492
|
+
validateInputSource(candidate.source, `${itemPath}.source`, phase, issues);
|
|
26493
|
+
});
|
|
26494
|
+
}
|
|
26495
|
+
function validateInputSource(value, path22, phase, issues) {
|
|
26496
|
+
if (!isPlainRecord(value) || typeof value.kind !== "string") {
|
|
26497
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_INPUT_SOURCE", "source must be an object"));
|
|
26498
|
+
return;
|
|
26499
|
+
}
|
|
26500
|
+
if (value.kind === "action-context") {
|
|
26501
|
+
rejectExtraKeys(value, ["kind", "path"], path22, issues);
|
|
26502
|
+
if (!isSafeJsonPointer(value.path, true)) {
|
|
26503
|
+
issues.push(issue2(`${path22}.path`, "INVALID_PAYMENT_SOURCE_PATH", "action context path must be a JSON Pointer"));
|
|
26504
|
+
}
|
|
26505
|
+
return;
|
|
26506
|
+
}
|
|
26507
|
+
if (value.kind === "runtime-context") {
|
|
26508
|
+
rejectExtraKeys(value, ["kind", "key"], path22, issues);
|
|
26509
|
+
if (!RUNTIME_CONTEXT_KEYS2.has(String(value.key))) {
|
|
26510
|
+
issues.push(issue2(`${path22}.key`, "INVALID_RUNTIME_CONTEXT_KEY", "runtime context key is unsupported"));
|
|
26511
|
+
}
|
|
26512
|
+
return;
|
|
26513
|
+
}
|
|
26514
|
+
if (value.kind === "literal") {
|
|
26515
|
+
rejectExtraKeys(value, ["kind", "value"], path22, issues);
|
|
26516
|
+
if (!isJsonValue(value.value)) {
|
|
26517
|
+
issues.push(issue2(`${path22}.value`, "INVALID_PAYMENT_LITERAL", "literal must be JSON"));
|
|
26518
|
+
}
|
|
26519
|
+
return;
|
|
26520
|
+
}
|
|
26521
|
+
if (phase === "query" && value.kind === "trade-no") {
|
|
26522
|
+
rejectExtraKeys(value, ["kind"], path22, issues);
|
|
26523
|
+
return;
|
|
26524
|
+
}
|
|
26525
|
+
if (phase === "query" && value.kind === "callback") {
|
|
26526
|
+
rejectExtraKeys(value, ["kind", "path"], path22, issues);
|
|
26527
|
+
if (!isSafeJsonPointer(value.path, true)) {
|
|
26528
|
+
issues.push(issue2(`${path22}.path`, "INVALID_PAYMENT_CALLBACK_PATH", "callback path must be a JSON Pointer"));
|
|
26529
|
+
}
|
|
26530
|
+
return;
|
|
26531
|
+
}
|
|
26532
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_INPUT_SOURCE", `${value.kind} is unavailable for ${phase}`));
|
|
26533
|
+
}
|
|
26534
|
+
function rejectExtraKeys(value, allowed, path22, issues) {
|
|
26535
|
+
const allowedKeys = new Set(allowed);
|
|
26536
|
+
for (const key of Object.keys(value)) {
|
|
26537
|
+
if (!allowedKeys.has(key)) {
|
|
26538
|
+
issues.push(issue2(`${path22}.${key}`, "UNEXPECTED_ACTION_BINDING_FIELD", `${key} is not allowed`));
|
|
26539
|
+
}
|
|
26540
|
+
}
|
|
26541
|
+
}
|
|
26542
|
+
function isJsonPrimitive(value) {
|
|
26543
|
+
return value === null || ["string", "number", "boolean"].includes(typeof value);
|
|
26544
|
+
}
|
|
26545
|
+
var RUNTIME_CONTEXT_KEYS2 = /* @__PURE__ */ new Set(["agentId", "tenantId", "threadId", "userId"]);
|
|
26546
|
+
|
|
26319
26547
|
// ../agent-a2ui-card-contract/dist/esm/validation.js
|
|
26320
26548
|
var FIELD_TYPES = [
|
|
26321
26549
|
"array",
|
|
@@ -26331,7 +26559,7 @@ var FIELD_SOURCES = [
|
|
|
26331
26559
|
"runtime-context",
|
|
26332
26560
|
"local"
|
|
26333
26561
|
];
|
|
26334
|
-
var
|
|
26562
|
+
var RUNTIME_CONTEXT_KEYS3 = /* @__PURE__ */ new Set([
|
|
26335
26563
|
"agentId",
|
|
26336
26564
|
"tenantId",
|
|
26337
26565
|
"threadId",
|
|
@@ -26355,11 +26583,14 @@ function getA2UICardDraftBundleIssues(value) {
|
|
|
26355
26583
|
}
|
|
26356
26584
|
const issues = [];
|
|
26357
26585
|
exactKeys(value, ["manifest", "card", "fixture"], "draft", issues);
|
|
26358
|
-
validateManifest(value.manifest, "draft.manifest", issues);
|
|
26586
|
+
const manifest = validateManifest(value.manifest, "draft.manifest", issues);
|
|
26359
26587
|
const card = validateProtocol(value.card, "draft.card", issues);
|
|
26360
26588
|
if (card) {
|
|
26361
26589
|
const analysis = analyzeA2UIBindings(card);
|
|
26362
26590
|
issues.push(...analysis.issues);
|
|
26591
|
+
if (manifest?.schemaVersion === "3") {
|
|
26592
|
+
issues.push(...getA2UIPaymentActionReferenceIssues(card, manifest.actionBindings ?? [], "draft.card"));
|
|
26593
|
+
}
|
|
26363
26594
|
}
|
|
26364
26595
|
return issues;
|
|
26365
26596
|
}
|
|
@@ -26427,6 +26658,7 @@ function getA2UICardResourceConfigV3Issues(value) {
|
|
|
26427
26658
|
"fields",
|
|
26428
26659
|
"dataSources",
|
|
26429
26660
|
"bindings",
|
|
26661
|
+
"actionBindings",
|
|
26430
26662
|
"a2uiTemplate"
|
|
26431
26663
|
], "config", issues);
|
|
26432
26664
|
if (value.schemaVersion !== A2UI_CARD_SCHEMA_VERSION) {
|
|
@@ -26446,6 +26678,11 @@ function getA2UICardResourceConfigV3Issues(value) {
|
|
|
26446
26678
|
const dataSources = validateDataSources(value.dataSources, "config.dataSources", issues);
|
|
26447
26679
|
const bindings = validateV3OutputBindings(value.bindings, "config.bindings", issues);
|
|
26448
26680
|
const card = validateTemplate(value.a2uiTemplate, fields, issues);
|
|
26681
|
+
const actionBindings = value.actionBindings === void 0 ? [] : value.actionBindings;
|
|
26682
|
+
issues.push(...getA2UICardActionBindingIssues(actionBindings, "config.actionBindings"));
|
|
26683
|
+
if (card && Array.isArray(actionBindings)) {
|
|
26684
|
+
issues.push(...getA2UIPaymentActionReferenceIssues(card, actionBindings, "config.a2uiTemplate.content"));
|
|
26685
|
+
}
|
|
26449
26686
|
if (fields && dataSources && bindings) {
|
|
26450
26687
|
validateV3Coverage(fields, dataSources, bindings, issues, { card });
|
|
26451
26688
|
}
|
|
@@ -26651,7 +26888,8 @@ function validateManifest(value, path22, issues) {
|
|
|
26651
26888
|
"whenToUse",
|
|
26652
26889
|
"whenNotToUse",
|
|
26653
26890
|
"fields",
|
|
26654
|
-
"bindings"
|
|
26891
|
+
"bindings",
|
|
26892
|
+
"actionBindings"
|
|
26655
26893
|
], path22, issues);
|
|
26656
26894
|
if (!isSafeIdentifier(value.draftId)) {
|
|
26657
26895
|
issues.push(issue2(`${path22}.draftId`, "INVALID_DRAFT_ID", "draftId is invalid"));
|
|
@@ -26671,6 +26909,9 @@ function validateManifest(value, path22, issues) {
|
|
|
26671
26909
|
if (value.bindings !== void 0) {
|
|
26672
26910
|
validateV3BindingSelections(value.bindings, `${path22}.bindings`, fields2, issues);
|
|
26673
26911
|
}
|
|
26912
|
+
if (value.actionBindings !== void 0) {
|
|
26913
|
+
issues.push(...getA2UICardActionBindingIssues(value.actionBindings, `${path22}.actionBindings`));
|
|
26914
|
+
}
|
|
26674
26915
|
return fields2 ? value : void 0;
|
|
26675
26916
|
}
|
|
26676
26917
|
exactKeys(value, [
|
|
@@ -26778,7 +27019,7 @@ function validateFieldSource(candidate, itemPath, issues) {
|
|
|
26778
27019
|
issues.push(issue2(`${itemPath}.sourcePath`, "UNEXPECTED_FIELD_SOURCE_PATH", "sourcePath is only allowed for invocation fields"));
|
|
26779
27020
|
}
|
|
26780
27021
|
if (candidate.source === "runtime-context") {
|
|
26781
|
-
if (!
|
|
27022
|
+
if (!RUNTIME_CONTEXT_KEYS3.has(candidate.runtimeContextKey)) {
|
|
26782
27023
|
issues.push(issue2(`${itemPath}.runtimeContextKey`, "INVALID_RUNTIME_CONTEXT", "runtime-context fields require an allowed runtimeContextKey"));
|
|
26783
27024
|
}
|
|
26784
27025
|
} else if (candidate.runtimeContextKey !== void 0) {
|
|
@@ -26830,11 +27071,11 @@ function validateResolverCalls(value, path22, issues) {
|
|
|
26830
27071
|
issues.push(issue2(`${itemPath}.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
|
|
26831
27072
|
}
|
|
26832
27073
|
requiredString(candidate.toolName, `${itemPath}.toolName`, issues);
|
|
26833
|
-
|
|
27074
|
+
validateInputBindings3(candidate.inputBindings, `${itemPath}.inputBindings`, issues);
|
|
26834
27075
|
});
|
|
26835
27076
|
return value;
|
|
26836
27077
|
}
|
|
26837
|
-
function
|
|
27078
|
+
function validateInputBindings3(value, path22, issues) {
|
|
26838
27079
|
if (!Array.isArray(value)) {
|
|
26839
27080
|
issues.push(issue2(path22, "INVALID_INPUT_BINDINGS", "inputBindings must be an array"));
|
|
26840
27081
|
return void 0;
|
|
@@ -26854,11 +27095,11 @@ function validateInputBindings2(value, path22, issues) {
|
|
|
26854
27095
|
} else {
|
|
26855
27096
|
paths.add(candidate.inputPath);
|
|
26856
27097
|
}
|
|
26857
|
-
|
|
27098
|
+
validateInputSource2(candidate.source, `${itemPath}.source`, issues);
|
|
26858
27099
|
});
|
|
26859
27100
|
return value;
|
|
26860
27101
|
}
|
|
26861
|
-
function
|
|
27102
|
+
function validateInputSource2(value, path22, issues) {
|
|
26862
27103
|
if (!isPlainRecord(value)) {
|
|
26863
27104
|
issues.push(issue2(path22, "INVALID_INPUT_SOURCE", "source must be an object"));
|
|
26864
27105
|
return;
|
|
@@ -26872,7 +27113,7 @@ function validateInputSource(value, path22, issues) {
|
|
|
26872
27113
|
}
|
|
26873
27114
|
if (value.kind === "runtime-context") {
|
|
26874
27115
|
exactKeys(value, ["kind", "key"], path22, issues);
|
|
26875
|
-
if (!
|
|
27116
|
+
if (!RUNTIME_CONTEXT_KEYS3.has(value.key)) {
|
|
26876
27117
|
issues.push(issue2(`${path22}.key`, "INVALID_RUNTIME_CONTEXT", "runtime context key is invalid"));
|
|
26877
27118
|
}
|
|
26878
27119
|
return;
|
|
@@ -27236,6 +27477,9 @@ function compileV3Resource(draft, revision, bindings, tools) {
|
|
|
27236
27477
|
fields: draft.manifest.fields,
|
|
27237
27478
|
dataSources: [...sourceById.values()].sort((left, right) => left.sourceId.localeCompare(right.sourceId)),
|
|
27238
27479
|
bindings: outputBindings.sort((left, right) => left.fieldId.localeCompare(right.fieldId)),
|
|
27480
|
+
...draft.manifest.actionBindings?.length ? {
|
|
27481
|
+
actionBindings: JSON.parse(JSON.stringify(draft.manifest.actionBindings))
|
|
27482
|
+
} : {},
|
|
27239
27483
|
a2uiTemplate: {
|
|
27240
27484
|
argsSchema: createA2UICardViewModelSchema(draft.manifest.fields),
|
|
27241
27485
|
content: stableJsonStringify(draft.card)
|
|
@@ -27556,7 +27800,7 @@ function extractA2UICardAuthoringModel(bundle, options = {}) {
|
|
|
27556
27800
|
discoverComponentTargets(component, occurrenceId, projection, targets);
|
|
27557
27801
|
allFieldOccurrenceTargets.push(...fieldTargets(component, occurrenceId, fields, componentOccurrences, false));
|
|
27558
27802
|
targets.push(...fieldTargets(component, occurrenceId, fields, componentOccurrences, true));
|
|
27559
|
-
targets.push(...actionTargets(component, occurrenceId));
|
|
27803
|
+
targets.push(...actionTargets(component, occurrenceId, bundle.manifest.schemaVersion === "3" ? bundle.manifest.actionBindings : void 0));
|
|
27560
27804
|
}
|
|
27561
27805
|
if (targets.length === 0) {
|
|
27562
27806
|
targets.push({
|
|
@@ -27745,7 +27989,7 @@ function discoverTargets(value, occurrenceId, propertyPath, targets) {
|
|
|
27745
27989
|
});
|
|
27746
27990
|
}
|
|
27747
27991
|
}
|
|
27748
|
-
function actionTargets(component, occurrenceId) {
|
|
27992
|
+
function actionTargets(component, occurrenceId, actionBindings) {
|
|
27749
27993
|
if (!isPlainRecord(component.action))
|
|
27750
27994
|
return [];
|
|
27751
27995
|
const action = component.action;
|
|
@@ -27784,6 +28028,23 @@ function actionTargets(component, occurrenceId) {
|
|
|
27784
28028
|
}
|
|
27785
28029
|
];
|
|
27786
28030
|
}
|
|
28031
|
+
if (client?.name === "payment.trade-pay") {
|
|
28032
|
+
const context = isPlainRecord(client.context) ? client.context : void 0;
|
|
28033
|
+
const actionId = typeof context?.actionId === "string" ? context.actionId : "";
|
|
28034
|
+
const actionContext = isPlainRecord(context?.actionContext) ? context.actionContext : {};
|
|
28035
|
+
const binding = actionBindings?.find((candidate) => candidate.kind === "payment" && candidate.actionId === actionId);
|
|
28036
|
+
return [{
|
|
28037
|
+
kind: "payment",
|
|
28038
|
+
targetId: createA2UICardAuthoringTargetId(occurrenceId, "action"),
|
|
28039
|
+
occurrenceId,
|
|
28040
|
+
propertyPath: "action",
|
|
28041
|
+
label: "\u652F\u4ED8",
|
|
28042
|
+
actionId,
|
|
28043
|
+
actionContext,
|
|
28044
|
+
...binding ? { binding } : {},
|
|
28045
|
+
configured: Boolean(actionId && binding)
|
|
28046
|
+
}];
|
|
28047
|
+
}
|
|
27787
28048
|
return [agentOnlyAction(occurrenceId, "\u8BE5\u884C\u4E3A\u53EA\u80FD\u901A\u8FC7 Coding Agent \u4FEE\u6539")];
|
|
27788
28049
|
}
|
|
27789
28050
|
function fieldTargets(component, occurrenceId, fields, occurrences, projectedOnly) {
|