linkque-cli-v2 1.1.5 → 1.2.0
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 +270 -11
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-IMZDZMKV.js → chunk-HPOFEAMP.js} +472 -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 +569 -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,192 @@ 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((instruction, instructionIndex) => {
|
|
26396
|
+
const instructionRecord = instruction;
|
|
26397
|
+
const update = isPlainRecord(instructionRecord.updateComponents) ? instructionRecord.updateComponents : void 0;
|
|
26398
|
+
const components = update && Array.isArray(update.components) ? update.components : [];
|
|
26399
|
+
components.forEach((component, componentIndex) => {
|
|
26400
|
+
if (!isPlainRecord(component))
|
|
26401
|
+
return;
|
|
26402
|
+
collectPaymentActionReferences(component.action, `${path22}[${instructionIndex}].updateComponents.components[${componentIndex}].action`, referenced, issues);
|
|
26403
|
+
});
|
|
26404
|
+
});
|
|
26405
|
+
for (const actionId of referenced) {
|
|
26406
|
+
if (!bindingIds.has(actionId)) {
|
|
26407
|
+
issues.push(issue2(path22, "PAYMENT_ACTION_BINDING_MISSING", `payment action ${actionId} has no action binding`));
|
|
26408
|
+
}
|
|
26409
|
+
}
|
|
26410
|
+
for (const actionId of bindingIds) {
|
|
26411
|
+
if (!referenced.has(actionId)) {
|
|
26412
|
+
issues.push(issue2(path22, "PAYMENT_ACTION_UNUSED", `payment action binding ${actionId} is not referenced`));
|
|
26413
|
+
}
|
|
26414
|
+
}
|
|
26415
|
+
return issues;
|
|
26416
|
+
}
|
|
26417
|
+
function validateToolBinding(value, path22, phase, issues) {
|
|
26418
|
+
if (!isPlainRecord(value)) {
|
|
26419
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_TOOL", `${path22} must be an object`));
|
|
26420
|
+
return;
|
|
26421
|
+
}
|
|
26422
|
+
rejectExtraKeys(value, phase === "create" ? ["mcpResourceId", "toolName", "inputBindings", "tradeNoPath"] : ["mcpResourceId", "toolName", "inputBindings", "statusPath", "paidValues"], path22, issues);
|
|
26423
|
+
if (!isSafeIdentifier(value.mcpResourceId)) {
|
|
26424
|
+
issues.push(issue2(`${path22}.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
|
|
26425
|
+
}
|
|
26426
|
+
if (typeof value.toolName !== "string" || !value.toolName.trim()) {
|
|
26427
|
+
issues.push(issue2(`${path22}.toolName`, "INVALID_TOOL_NAME", "toolName is required"));
|
|
26428
|
+
}
|
|
26429
|
+
validateInputBindings2(value.inputBindings, `${path22}.inputBindings`, phase, issues);
|
|
26430
|
+
if (phase === "create") {
|
|
26431
|
+
if (!isSafeJsonPointer(value.tradeNoPath)) {
|
|
26432
|
+
issues.push(issue2(`${path22}.tradeNoPath`, "INVALID_TRADE_NO_PATH", "tradeNoPath must be an absolute JSON Pointer"));
|
|
26433
|
+
}
|
|
26434
|
+
return;
|
|
26435
|
+
}
|
|
26436
|
+
if (!isSafeJsonPointer(value.statusPath)) {
|
|
26437
|
+
issues.push(issue2(`${path22}.statusPath`, "INVALID_PAYMENT_STATUS_PATH", "statusPath must be an absolute JSON Pointer"));
|
|
26438
|
+
}
|
|
26439
|
+
if (!Array.isArray(value.inputBindings) || !value.inputBindings.some((binding) => isPlainRecord(binding) && isPlainRecord(binding.source) && binding.source.kind === "trade-no")) {
|
|
26440
|
+
issues.push(issue2(`${path22}.inputBindings`, "PAYMENT_TRADE_NO_BINDING_MISSING", "queryTrade must map tradeNO"));
|
|
26441
|
+
}
|
|
26442
|
+
if (!Array.isArray(value.paidValues) || value.paidValues.length === 0 || value.paidValues.some((entry) => !isJsonPrimitive(entry))) {
|
|
26443
|
+
issues.push(issue2(`${path22}.paidValues`, "INVALID_PAID_VALUES", "paidValues must contain JSON primitives"));
|
|
26444
|
+
}
|
|
26445
|
+
}
|
|
26446
|
+
function collectPaymentActionReferences(value, path22, referenced, issues) {
|
|
26447
|
+
if (!isPlainRecord(value))
|
|
26448
|
+
return;
|
|
26449
|
+
if (isPlainRecord(value.client) && value.client.name === A2UI_PAYMENT_ACTION_NAME) {
|
|
26450
|
+
const context = value.client.context;
|
|
26451
|
+
if (!isPlainRecord(context) || !isSafeIdentifier(context.actionId)) {
|
|
26452
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_ACTION", "payment action requires a safe actionId"));
|
|
26453
|
+
return;
|
|
26454
|
+
}
|
|
26455
|
+
rejectExtraKeys(context, ["actionId", "actionContext"], `${path22}.client.context`, issues);
|
|
26456
|
+
if (!isPlainRecord(context.actionContext)) {
|
|
26457
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_ACTION", "payment action requires an object actionContext"));
|
|
26458
|
+
}
|
|
26459
|
+
referenced.add(context.actionId);
|
|
26460
|
+
return;
|
|
26461
|
+
}
|
|
26462
|
+
if (!isPlainRecord(value.select))
|
|
26463
|
+
return;
|
|
26464
|
+
if (Array.isArray(value.select.cases)) {
|
|
26465
|
+
value.select.cases.forEach((entry, index) => {
|
|
26466
|
+
if (isPlainRecord(entry)) {
|
|
26467
|
+
collectPaymentActionReferences(entry.action, `${path22}.select.cases[${index}].action`, referenced, issues);
|
|
26468
|
+
}
|
|
26469
|
+
});
|
|
26470
|
+
}
|
|
26471
|
+
collectPaymentActionReferences(value.select.default, `${path22}.select.default`, referenced, issues);
|
|
26472
|
+
}
|
|
26473
|
+
function validateInputBindings2(value, path22, phase, issues) {
|
|
26474
|
+
if (!Array.isArray(value) || value.length > 128) {
|
|
26475
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_INPUT_BINDINGS", "inputBindings must be an array of at most 128 entries"));
|
|
26476
|
+
return;
|
|
26477
|
+
}
|
|
26478
|
+
const targets = /* @__PURE__ */ new Set();
|
|
26479
|
+
value.forEach((candidate, index) => {
|
|
26480
|
+
const itemPath = `${path22}[${index}]`;
|
|
26481
|
+
if (!isPlainRecord(candidate) || !isSafeJsonPointer(candidate.inputPath)) {
|
|
26482
|
+
issues.push(issue2(itemPath, "INVALID_PAYMENT_INPUT_BINDING", "inputPath must be an absolute JSON Pointer"));
|
|
26483
|
+
return;
|
|
26484
|
+
}
|
|
26485
|
+
rejectExtraKeys(candidate, ["inputPath", "source"], itemPath, issues);
|
|
26486
|
+
if (targets.has(candidate.inputPath)) {
|
|
26487
|
+
issues.push(issue2(`${itemPath}.inputPath`, "DUPLICATE_PAYMENT_INPUT_PATH", "inputPath must be unique"));
|
|
26488
|
+
}
|
|
26489
|
+
targets.add(candidate.inputPath);
|
|
26490
|
+
validateInputSource(candidate.source, `${itemPath}.source`, phase, issues);
|
|
26491
|
+
});
|
|
26492
|
+
}
|
|
26493
|
+
function validateInputSource(value, path22, phase, issues) {
|
|
26494
|
+
if (!isPlainRecord(value) || typeof value.kind !== "string") {
|
|
26495
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_INPUT_SOURCE", "source must be an object"));
|
|
26496
|
+
return;
|
|
26497
|
+
}
|
|
26498
|
+
if (value.kind === "action-context") {
|
|
26499
|
+
rejectExtraKeys(value, ["kind", "path"], path22, issues);
|
|
26500
|
+
if (!isSafeJsonPointer(value.path, true)) {
|
|
26501
|
+
issues.push(issue2(`${path22}.path`, "INVALID_PAYMENT_SOURCE_PATH", "action context path must be a JSON Pointer"));
|
|
26502
|
+
}
|
|
26503
|
+
return;
|
|
26504
|
+
}
|
|
26505
|
+
if (value.kind === "runtime-context") {
|
|
26506
|
+
rejectExtraKeys(value, ["kind", "key"], path22, issues);
|
|
26507
|
+
if (!RUNTIME_CONTEXT_KEYS2.has(String(value.key))) {
|
|
26508
|
+
issues.push(issue2(`${path22}.key`, "INVALID_RUNTIME_CONTEXT_KEY", "runtime context key is unsupported"));
|
|
26509
|
+
}
|
|
26510
|
+
return;
|
|
26511
|
+
}
|
|
26512
|
+
if (value.kind === "literal") {
|
|
26513
|
+
rejectExtraKeys(value, ["kind", "value"], path22, issues);
|
|
26514
|
+
if (!isJsonValue(value.value)) {
|
|
26515
|
+
issues.push(issue2(`${path22}.value`, "INVALID_PAYMENT_LITERAL", "literal must be JSON"));
|
|
26516
|
+
}
|
|
26517
|
+
return;
|
|
26518
|
+
}
|
|
26519
|
+
if (phase === "query" && value.kind === "trade-no") {
|
|
26520
|
+
rejectExtraKeys(value, ["kind"], path22, issues);
|
|
26521
|
+
return;
|
|
26522
|
+
}
|
|
26523
|
+
if (phase === "query" && value.kind === "callback") {
|
|
26524
|
+
rejectExtraKeys(value, ["kind", "path"], path22, issues);
|
|
26525
|
+
if (!isSafeJsonPointer(value.path, true)) {
|
|
26526
|
+
issues.push(issue2(`${path22}.path`, "INVALID_PAYMENT_CALLBACK_PATH", "callback path must be a JSON Pointer"));
|
|
26527
|
+
}
|
|
26528
|
+
return;
|
|
26529
|
+
}
|
|
26530
|
+
issues.push(issue2(path22, "INVALID_PAYMENT_INPUT_SOURCE", `${value.kind} is unavailable for ${phase}`));
|
|
26531
|
+
}
|
|
26532
|
+
function rejectExtraKeys(value, allowed, path22, issues) {
|
|
26533
|
+
const allowedKeys = new Set(allowed);
|
|
26534
|
+
for (const key of Object.keys(value)) {
|
|
26535
|
+
if (!allowedKeys.has(key)) {
|
|
26536
|
+
issues.push(issue2(`${path22}.${key}`, "UNEXPECTED_ACTION_BINDING_FIELD", `${key} is not allowed`));
|
|
26537
|
+
}
|
|
26538
|
+
}
|
|
26539
|
+
}
|
|
26540
|
+
function isJsonPrimitive(value) {
|
|
26541
|
+
return value === null || ["string", "number", "boolean"].includes(typeof value);
|
|
26542
|
+
}
|
|
26543
|
+
var RUNTIME_CONTEXT_KEYS2 = /* @__PURE__ */ new Set(["agentId", "tenantId", "threadId", "userId"]);
|
|
26544
|
+
|
|
26319
26545
|
// ../agent-a2ui-card-contract/dist/esm/validation.js
|
|
26320
26546
|
var FIELD_TYPES = [
|
|
26321
26547
|
"array",
|
|
@@ -26331,7 +26557,7 @@ var FIELD_SOURCES = [
|
|
|
26331
26557
|
"runtime-context",
|
|
26332
26558
|
"local"
|
|
26333
26559
|
];
|
|
26334
|
-
var
|
|
26560
|
+
var RUNTIME_CONTEXT_KEYS3 = /* @__PURE__ */ new Set([
|
|
26335
26561
|
"agentId",
|
|
26336
26562
|
"tenantId",
|
|
26337
26563
|
"threadId",
|
|
@@ -26355,11 +26581,14 @@ function getA2UICardDraftBundleIssues(value) {
|
|
|
26355
26581
|
}
|
|
26356
26582
|
const issues = [];
|
|
26357
26583
|
exactKeys(value, ["manifest", "card", "fixture"], "draft", issues);
|
|
26358
|
-
validateManifest(value.manifest, "draft.manifest", issues);
|
|
26584
|
+
const manifest = validateManifest(value.manifest, "draft.manifest", issues);
|
|
26359
26585
|
const card = validateProtocol(value.card, "draft.card", issues);
|
|
26360
26586
|
if (card) {
|
|
26361
26587
|
const analysis = analyzeA2UIBindings(card);
|
|
26362
26588
|
issues.push(...analysis.issues);
|
|
26589
|
+
if (manifest?.schemaVersion === "3") {
|
|
26590
|
+
issues.push(...getA2UIPaymentActionReferenceIssues(card, manifest.actionBindings ?? [], "draft.card"));
|
|
26591
|
+
}
|
|
26363
26592
|
}
|
|
26364
26593
|
return issues;
|
|
26365
26594
|
}
|
|
@@ -26427,6 +26656,7 @@ function getA2UICardResourceConfigV3Issues(value) {
|
|
|
26427
26656
|
"fields",
|
|
26428
26657
|
"dataSources",
|
|
26429
26658
|
"bindings",
|
|
26659
|
+
"actionBindings",
|
|
26430
26660
|
"a2uiTemplate"
|
|
26431
26661
|
], "config", issues);
|
|
26432
26662
|
if (value.schemaVersion !== A2UI_CARD_SCHEMA_VERSION) {
|
|
@@ -26446,6 +26676,11 @@ function getA2UICardResourceConfigV3Issues(value) {
|
|
|
26446
26676
|
const dataSources = validateDataSources(value.dataSources, "config.dataSources", issues);
|
|
26447
26677
|
const bindings = validateV3OutputBindings(value.bindings, "config.bindings", issues);
|
|
26448
26678
|
const card = validateTemplate(value.a2uiTemplate, fields, issues);
|
|
26679
|
+
const actionBindings = value.actionBindings === void 0 ? [] : value.actionBindings;
|
|
26680
|
+
issues.push(...getA2UICardActionBindingIssues(actionBindings, "config.actionBindings"));
|
|
26681
|
+
if (card && Array.isArray(actionBindings)) {
|
|
26682
|
+
issues.push(...getA2UIPaymentActionReferenceIssues(card, actionBindings, "config.a2uiTemplate.content"));
|
|
26683
|
+
}
|
|
26449
26684
|
if (fields && dataSources && bindings) {
|
|
26450
26685
|
validateV3Coverage(fields, dataSources, bindings, issues, { card });
|
|
26451
26686
|
}
|
|
@@ -26651,7 +26886,8 @@ function validateManifest(value, path22, issues) {
|
|
|
26651
26886
|
"whenToUse",
|
|
26652
26887
|
"whenNotToUse",
|
|
26653
26888
|
"fields",
|
|
26654
|
-
"bindings"
|
|
26889
|
+
"bindings",
|
|
26890
|
+
"actionBindings"
|
|
26655
26891
|
], path22, issues);
|
|
26656
26892
|
if (!isSafeIdentifier(value.draftId)) {
|
|
26657
26893
|
issues.push(issue2(`${path22}.draftId`, "INVALID_DRAFT_ID", "draftId is invalid"));
|
|
@@ -26671,6 +26907,9 @@ function validateManifest(value, path22, issues) {
|
|
|
26671
26907
|
if (value.bindings !== void 0) {
|
|
26672
26908
|
validateV3BindingSelections(value.bindings, `${path22}.bindings`, fields2, issues);
|
|
26673
26909
|
}
|
|
26910
|
+
if (value.actionBindings !== void 0) {
|
|
26911
|
+
issues.push(...getA2UICardActionBindingIssues(value.actionBindings, `${path22}.actionBindings`));
|
|
26912
|
+
}
|
|
26674
26913
|
return fields2 ? value : void 0;
|
|
26675
26914
|
}
|
|
26676
26915
|
exactKeys(value, [
|
|
@@ -26778,7 +27017,7 @@ function validateFieldSource(candidate, itemPath, issues) {
|
|
|
26778
27017
|
issues.push(issue2(`${itemPath}.sourcePath`, "UNEXPECTED_FIELD_SOURCE_PATH", "sourcePath is only allowed for invocation fields"));
|
|
26779
27018
|
}
|
|
26780
27019
|
if (candidate.source === "runtime-context") {
|
|
26781
|
-
if (!
|
|
27020
|
+
if (!RUNTIME_CONTEXT_KEYS3.has(candidate.runtimeContextKey)) {
|
|
26782
27021
|
issues.push(issue2(`${itemPath}.runtimeContextKey`, "INVALID_RUNTIME_CONTEXT", "runtime-context fields require an allowed runtimeContextKey"));
|
|
26783
27022
|
}
|
|
26784
27023
|
} else if (candidate.runtimeContextKey !== void 0) {
|
|
@@ -26830,11 +27069,11 @@ function validateResolverCalls(value, path22, issues) {
|
|
|
26830
27069
|
issues.push(issue2(`${itemPath}.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
|
|
26831
27070
|
}
|
|
26832
27071
|
requiredString(candidate.toolName, `${itemPath}.toolName`, issues);
|
|
26833
|
-
|
|
27072
|
+
validateInputBindings3(candidate.inputBindings, `${itemPath}.inputBindings`, issues);
|
|
26834
27073
|
});
|
|
26835
27074
|
return value;
|
|
26836
27075
|
}
|
|
26837
|
-
function
|
|
27076
|
+
function validateInputBindings3(value, path22, issues) {
|
|
26838
27077
|
if (!Array.isArray(value)) {
|
|
26839
27078
|
issues.push(issue2(path22, "INVALID_INPUT_BINDINGS", "inputBindings must be an array"));
|
|
26840
27079
|
return void 0;
|
|
@@ -26854,11 +27093,11 @@ function validateInputBindings2(value, path22, issues) {
|
|
|
26854
27093
|
} else {
|
|
26855
27094
|
paths.add(candidate.inputPath);
|
|
26856
27095
|
}
|
|
26857
|
-
|
|
27096
|
+
validateInputSource2(candidate.source, `${itemPath}.source`, issues);
|
|
26858
27097
|
});
|
|
26859
27098
|
return value;
|
|
26860
27099
|
}
|
|
26861
|
-
function
|
|
27100
|
+
function validateInputSource2(value, path22, issues) {
|
|
26862
27101
|
if (!isPlainRecord(value)) {
|
|
26863
27102
|
issues.push(issue2(path22, "INVALID_INPUT_SOURCE", "source must be an object"));
|
|
26864
27103
|
return;
|
|
@@ -26872,7 +27111,7 @@ function validateInputSource(value, path22, issues) {
|
|
|
26872
27111
|
}
|
|
26873
27112
|
if (value.kind === "runtime-context") {
|
|
26874
27113
|
exactKeys(value, ["kind", "key"], path22, issues);
|
|
26875
|
-
if (!
|
|
27114
|
+
if (!RUNTIME_CONTEXT_KEYS3.has(value.key)) {
|
|
26876
27115
|
issues.push(issue2(`${path22}.key`, "INVALID_RUNTIME_CONTEXT", "runtime context key is invalid"));
|
|
26877
27116
|
}
|
|
26878
27117
|
return;
|
|
@@ -27236,6 +27475,9 @@ function compileV3Resource(draft, revision, bindings, tools) {
|
|
|
27236
27475
|
fields: draft.manifest.fields,
|
|
27237
27476
|
dataSources: [...sourceById.values()].sort((left, right) => left.sourceId.localeCompare(right.sourceId)),
|
|
27238
27477
|
bindings: outputBindings.sort((left, right) => left.fieldId.localeCompare(right.fieldId)),
|
|
27478
|
+
...draft.manifest.actionBindings?.length ? {
|
|
27479
|
+
actionBindings: JSON.parse(JSON.stringify(draft.manifest.actionBindings))
|
|
27480
|
+
} : {},
|
|
27239
27481
|
a2uiTemplate: {
|
|
27240
27482
|
argsSchema: createA2UICardViewModelSchema(draft.manifest.fields),
|
|
27241
27483
|
content: stableJsonStringify(draft.card)
|
|
@@ -27556,7 +27798,7 @@ function extractA2UICardAuthoringModel(bundle, options = {}) {
|
|
|
27556
27798
|
discoverComponentTargets(component, occurrenceId, projection, targets);
|
|
27557
27799
|
allFieldOccurrenceTargets.push(...fieldTargets(component, occurrenceId, fields, componentOccurrences, false));
|
|
27558
27800
|
targets.push(...fieldTargets(component, occurrenceId, fields, componentOccurrences, true));
|
|
27559
|
-
targets.push(...actionTargets(component, occurrenceId));
|
|
27801
|
+
targets.push(...actionTargets(component, occurrenceId, bundle.manifest.schemaVersion === "3" ? bundle.manifest.actionBindings : void 0));
|
|
27560
27802
|
}
|
|
27561
27803
|
if (targets.length === 0) {
|
|
27562
27804
|
targets.push({
|
|
@@ -27745,7 +27987,7 @@ function discoverTargets(value, occurrenceId, propertyPath, targets) {
|
|
|
27745
27987
|
});
|
|
27746
27988
|
}
|
|
27747
27989
|
}
|
|
27748
|
-
function actionTargets(component, occurrenceId) {
|
|
27990
|
+
function actionTargets(component, occurrenceId, actionBindings) {
|
|
27749
27991
|
if (!isPlainRecord(component.action))
|
|
27750
27992
|
return [];
|
|
27751
27993
|
const action = component.action;
|
|
@@ -27784,6 +28026,23 @@ function actionTargets(component, occurrenceId) {
|
|
|
27784
28026
|
}
|
|
27785
28027
|
];
|
|
27786
28028
|
}
|
|
28029
|
+
if (client?.name === "payment.trade-pay") {
|
|
28030
|
+
const context = isPlainRecord(client.context) ? client.context : void 0;
|
|
28031
|
+
const actionId = typeof context?.actionId === "string" ? context.actionId : "";
|
|
28032
|
+
const actionContext = isPlainRecord(context?.actionContext) ? context.actionContext : {};
|
|
28033
|
+
const binding = actionBindings?.find((candidate) => candidate.kind === "payment" && candidate.actionId === actionId);
|
|
28034
|
+
return [{
|
|
28035
|
+
kind: "payment",
|
|
28036
|
+
targetId: createA2UICardAuthoringTargetId(occurrenceId, "action"),
|
|
28037
|
+
occurrenceId,
|
|
28038
|
+
propertyPath: "action",
|
|
28039
|
+
label: "\u652F\u4ED8",
|
|
28040
|
+
actionId,
|
|
28041
|
+
actionContext,
|
|
28042
|
+
...binding ? { binding } : {},
|
|
28043
|
+
configured: Boolean(actionId && binding)
|
|
28044
|
+
}];
|
|
28045
|
+
}
|
|
27787
28046
|
return [agentOnlyAction(occurrenceId, "\u8BE5\u884C\u4E3A\u53EA\u80FD\u901A\u8FC7 Coding Agent \u4FEE\u6539")];
|
|
27788
28047
|
}
|
|
27789
28048
|
function fieldTargets(component, occurrenceId, fields, occurrences, projectedOnly) {
|