linkque-cli-v2 1.3.3 → 1.3.4

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.
Files changed (17) hide show
  1. package/linkquejs.js +106 -241
  2. package/package.json +1 -1
  3. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-BWCMNWG2.js → chunk-23PMJWOG.js} +18 -30
  4. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-JXQYQ563.js → chunk-VSZ3UDC7.js} +1 -1
  5. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-CM4N2PT3.js → chunk-YSRA6KFZ.js} +1736 -1839
  6. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +101 -140
  7. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
  8. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
  9. package/vendor/linkque-agent-appwrite-integrate/package.json +1 -1
  10. package/worker.js +701 -502
  11. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{anthropic-messages-5DOLTIGP.js → anthropic-messages-EL2IU4YU.js} +3 -3
  12. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{azure-openai-responses-HVAVRLTK.js → azure-openai-responses-A4XURCOX.js} +1 -1
  13. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-UJBDG2KY.js → mistral-conversations-TQA2MPJJ.js} +10 -10
  14. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-codex-responses-3KOC6KHN.js → openai-codex-responses-WLREQPZK.js} +1 -1
  15. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-completions-HG6OJRL5.js → openai-completions-U6LUBY4P.js} +3 -3
  16. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-responses-F6V2PG3Y.js → openai-responses-SFZAU5JA.js} +1 -1
  17. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{pi-messages-DC4DVRAJ.js → pi-messages-QQA6ZGV2.js} +3 -3
package/linkquejs.js CHANGED
@@ -21232,207 +21232,6 @@ function candidateKey(resourceId, toolName) {
21232
21232
  return `${resourceId}\0${toolName}`;
21233
21233
  }
21234
21234
 
21235
- // ../agent-a2ui-card-contract/dist/esm/payment-action.js
21236
- var A2UI_PAYMENT_ACTION_NAME = "payment.trade-pay";
21237
- var A2UI_PAYMENT_CALLBACK_MAX_BYTES = 16 * 1024;
21238
- function getA2UICardActionBindingIssues(value, path23 = "actionBindings") {
21239
- if (!Array.isArray(value)) {
21240
- return [
21241
- issue2(path23, "INVALID_ACTION_BINDINGS", "actionBindings must be an array")
21242
- ];
21243
- }
21244
- const issues = [];
21245
- const actionIds = /* @__PURE__ */ new Set();
21246
- value.forEach((candidate, index) => {
21247
- const itemPath = `${path23}[${index}]`;
21248
- if (!isPlainRecord(candidate)) {
21249
- issues.push(issue2(itemPath, "INVALID_ACTION_BINDING", "action binding must be an object"));
21250
- return;
21251
- }
21252
- if (!isSafeIdentifier(candidate.actionId)) {
21253
- issues.push(issue2(`${itemPath}.actionId`, "INVALID_ACTION_ID", "actionId is invalid"));
21254
- } else if (actionIds.has(candidate.actionId)) {
21255
- issues.push(issue2(`${itemPath}.actionId`, "DUPLICATE_ACTION_ID", "actionId must be unique"));
21256
- } else {
21257
- actionIds.add(candidate.actionId);
21258
- }
21259
- if (candidate.kind !== "payment") {
21260
- issues.push(issue2(`${itemPath}.kind`, "INVALID_ACTION_KIND", "kind must be payment"));
21261
- return;
21262
- }
21263
- rejectExtraKeys(candidate, ["actionId", "kind", "createTrade", "queryTrade"], itemPath, issues);
21264
- validateToolBinding(candidate.createTrade, `${itemPath}.createTrade`, "create", issues);
21265
- validateToolBinding(candidate.queryTrade, `${itemPath}.queryTrade`, "query", issues);
21266
- });
21267
- return issues;
21268
- }
21269
- function getA2UIPaymentActionReferenceIssues(card, bindings, path23 = "a2uiTemplate.content") {
21270
- const issues = [];
21271
- const bindingIds = new Set(bindings.map((binding) => binding.actionId));
21272
- const referenced = /* @__PURE__ */ new Set();
21273
- card.forEach((message, messageIndex) => {
21274
- message.datas.forEach((instruction, instructionIndex) => {
21275
- const instructionRecord = instruction;
21276
- const update = isPlainRecord(instructionRecord.updateComponents) ? instructionRecord.updateComponents : void 0;
21277
- const components = update && Array.isArray(update.components) ? update.components : [];
21278
- components.forEach((component, componentIndex) => {
21279
- if (!isPlainRecord(component))
21280
- return;
21281
- collectPaymentActionReferences(component.action, `${path23}[${messageIndex}].datas[${instructionIndex}].updateComponents.components[${componentIndex}].action`, referenced, issues);
21282
- });
21283
- });
21284
- });
21285
- for (const actionId of referenced) {
21286
- if (!bindingIds.has(actionId)) {
21287
- issues.push(issue2(path23, "PAYMENT_ACTION_BINDING_MISSING", `payment action ${actionId} has no action binding`));
21288
- }
21289
- }
21290
- for (const actionId of bindingIds) {
21291
- if (!referenced.has(actionId)) {
21292
- issues.push(issue2(path23, "PAYMENT_ACTION_UNUSED", `payment action binding ${actionId} is not referenced`));
21293
- }
21294
- }
21295
- return issues;
21296
- }
21297
- function validateToolBinding(value, path23, phase, issues) {
21298
- if (!isPlainRecord(value)) {
21299
- issues.push(issue2(path23, "INVALID_PAYMENT_TOOL", `${path23} must be an object`));
21300
- return;
21301
- }
21302
- rejectExtraKeys(value, phase === "create" ? ["mcpResourceId", "toolName", "inputBindings", "tradeNoPath"] : [
21303
- "mcpResourceId",
21304
- "toolName",
21305
- "inputBindings",
21306
- "statusPath",
21307
- "paidValues"
21308
- ], path23, issues);
21309
- if (!isSafeIdentifier(value.mcpResourceId)) {
21310
- issues.push(issue2(`${path23}.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
21311
- }
21312
- if (typeof value.toolName !== "string" || !value.toolName.trim()) {
21313
- issues.push(issue2(`${path23}.toolName`, "INVALID_TOOL_NAME", "toolName is required"));
21314
- }
21315
- validateInputBindings2(value.inputBindings, `${path23}.inputBindings`, phase, issues);
21316
- if (phase === "create") {
21317
- if (!isSafeJsonPointer(value.tradeNoPath)) {
21318
- issues.push(issue2(`${path23}.tradeNoPath`, "INVALID_TRADE_NO_PATH", "tradeNoPath must be an absolute JSON Pointer"));
21319
- }
21320
- return;
21321
- }
21322
- if (!isSafeJsonPointer(value.statusPath)) {
21323
- issues.push(issue2(`${path23}.statusPath`, "INVALID_PAYMENT_STATUS_PATH", "statusPath must be an absolute JSON Pointer"));
21324
- }
21325
- if (!Array.isArray(value.inputBindings) || !value.inputBindings.some((binding) => isPlainRecord(binding) && isPlainRecord(binding.source) && binding.source.kind === "trade-no")) {
21326
- issues.push(issue2(`${path23}.inputBindings`, "PAYMENT_TRADE_NO_BINDING_MISSING", "queryTrade must map tradeNO"));
21327
- }
21328
- if (!Array.isArray(value.paidValues) || value.paidValues.length === 0 || value.paidValues.some((entry) => !isJsonPrimitive(entry))) {
21329
- issues.push(issue2(`${path23}.paidValues`, "INVALID_PAID_VALUES", "paidValues must contain JSON primitives"));
21330
- }
21331
- }
21332
- function collectPaymentActionReferences(value, path23, referenced, issues) {
21333
- if (!isPlainRecord(value))
21334
- return;
21335
- if (isPlainRecord(value.client) && value.client.name === A2UI_PAYMENT_ACTION_NAME) {
21336
- const context = value.client.context;
21337
- if (!isPlainRecord(context) || !isSafeIdentifier(context.actionId)) {
21338
- issues.push(issue2(path23, "INVALID_PAYMENT_ACTION", "payment action requires a safe actionId"));
21339
- return;
21340
- }
21341
- rejectExtraKeys(context, ["actionId", "actionContext"], `${path23}.client.context`, issues);
21342
- if (!isPlainRecord(context.actionContext)) {
21343
- issues.push(issue2(path23, "INVALID_PAYMENT_ACTION", "payment action requires an object actionContext"));
21344
- }
21345
- referenced.add(context.actionId);
21346
- return;
21347
- }
21348
- if (!isPlainRecord(value.select))
21349
- return;
21350
- if (Array.isArray(value.select.cases)) {
21351
- value.select.cases.forEach((entry, index) => {
21352
- if (isPlainRecord(entry)) {
21353
- collectPaymentActionReferences(entry.action, `${path23}.select.cases[${index}].action`, referenced, issues);
21354
- }
21355
- });
21356
- }
21357
- collectPaymentActionReferences(value.select.default, `${path23}.select.default`, referenced, issues);
21358
- }
21359
- function validateInputBindings2(value, path23, phase, issues) {
21360
- if (!Array.isArray(value) || value.length > 128) {
21361
- issues.push(issue2(path23, "INVALID_PAYMENT_INPUT_BINDINGS", "inputBindings must be an array of at most 128 entries"));
21362
- return;
21363
- }
21364
- const targets = /* @__PURE__ */ new Set();
21365
- value.forEach((candidate, index) => {
21366
- const itemPath = `${path23}[${index}]`;
21367
- if (!isPlainRecord(candidate) || !isSafeJsonPointer(candidate.inputPath)) {
21368
- issues.push(issue2(itemPath, "INVALID_PAYMENT_INPUT_BINDING", "inputPath must be an absolute JSON Pointer"));
21369
- return;
21370
- }
21371
- rejectExtraKeys(candidate, ["inputPath", "source"], itemPath, issues);
21372
- if (targets.has(candidate.inputPath)) {
21373
- issues.push(issue2(`${itemPath}.inputPath`, "DUPLICATE_PAYMENT_INPUT_PATH", "inputPath must be unique"));
21374
- }
21375
- targets.add(candidate.inputPath);
21376
- validateInputSource(candidate.source, `${itemPath}.source`, phase, issues);
21377
- });
21378
- }
21379
- function validateInputSource(value, path23, phase, issues) {
21380
- if (!isPlainRecord(value) || typeof value.kind !== "string") {
21381
- issues.push(issue2(path23, "INVALID_PAYMENT_INPUT_SOURCE", "source must be an object"));
21382
- return;
21383
- }
21384
- if (value.kind === "action-context") {
21385
- rejectExtraKeys(value, ["kind", "path"], path23, issues);
21386
- if (!isSafeJsonPointer(value.path, true)) {
21387
- issues.push(issue2(`${path23}.path`, "INVALID_PAYMENT_SOURCE_PATH", "action context path must be a JSON Pointer"));
21388
- }
21389
- return;
21390
- }
21391
- if (value.kind === "runtime-context") {
21392
- rejectExtraKeys(value, ["kind", "key"], path23, issues);
21393
- if (!RUNTIME_CONTEXT_KEYS2.has(String(value.key))) {
21394
- issues.push(issue2(`${path23}.key`, "INVALID_RUNTIME_CONTEXT_KEY", "runtime context key is unsupported"));
21395
- }
21396
- return;
21397
- }
21398
- if (value.kind === "literal") {
21399
- rejectExtraKeys(value, ["kind", "value"], path23, issues);
21400
- if (!isJsonValue(value.value)) {
21401
- issues.push(issue2(`${path23}.value`, "INVALID_PAYMENT_LITERAL", "literal must be JSON"));
21402
- }
21403
- return;
21404
- }
21405
- if (phase === "query" && value.kind === "trade-no") {
21406
- rejectExtraKeys(value, ["kind"], path23, issues);
21407
- return;
21408
- }
21409
- if (phase === "query" && value.kind === "callback") {
21410
- rejectExtraKeys(value, ["kind", "path"], path23, issues);
21411
- if (!isSafeJsonPointer(value.path, true)) {
21412
- issues.push(issue2(`${path23}.path`, "INVALID_PAYMENT_CALLBACK_PATH", "callback path must be a JSON Pointer"));
21413
- }
21414
- return;
21415
- }
21416
- issues.push(issue2(path23, "INVALID_PAYMENT_INPUT_SOURCE", `${value.kind} is unavailable for ${phase}`));
21417
- }
21418
- function rejectExtraKeys(value, allowed, path23, issues) {
21419
- const allowedKeys = new Set(allowed);
21420
- for (const key of Object.keys(value)) {
21421
- if (!allowedKeys.has(key)) {
21422
- issues.push(issue2(`${path23}.${key}`, "UNEXPECTED_ACTION_BINDING_FIELD", `${key} is not allowed`));
21423
- }
21424
- }
21425
- }
21426
- function isJsonPrimitive(value) {
21427
- return value === null || ["string", "number", "boolean"].includes(typeof value);
21428
- }
21429
- var RUNTIME_CONTEXT_KEYS2 = /* @__PURE__ */ new Set([
21430
- "agentId",
21431
- "tenantId",
21432
- "threadId",
21433
- "userId"
21434
- ]);
21435
-
21436
21235
  // ../agent-a2ui-card-contract/dist/esm/v4Catalog.js
21437
21236
  var spacing = ["none", "xs", "sm", "md", "lg"];
21438
21237
  var colors = [
@@ -21923,7 +21722,7 @@ function validateAction(value, path23, issues, depth) {
21923
21722
  issues.push(issue2(path23, "INVALID_ACTION", "action must be an object with at most four nested selects"));
21924
21723
  return;
21925
21724
  }
21926
- const branches = ["event", "local", "client", "select"].filter((key) => key in value);
21725
+ const branches = ["event", "function", "local", "client", "select"].filter((key) => key in value);
21927
21726
  if (branches.length !== 1 || Object.keys(value).length !== 1) {
21928
21727
  issues.push(issue2(path23, "INVALID_ACTION", "action must contain exactly one branch"));
21929
21728
  return;
@@ -21944,6 +21743,10 @@ function validateAction(value, path23, issues, depth) {
21944
21743
  issues.push(issue2(`${path23}.event.x2-user-message`, "INVALID_ACTION_CONTEXT", "x2-user-message must be a string or strict binding"));
21945
21744
  if (body.target !== void 0)
21946
21745
  validateOverlayTarget(body.target, `${path23}.event.target`, issues);
21746
+ } else if (branch === "function") {
21747
+ rejectUnknownKeys(body, ["ref"], `${path23}.function`, issues);
21748
+ if (!isFunctionActionRef(body.ref))
21749
+ issues.push(issue2(`${path23}.function.ref`, "INVALID_FUNCTION_ACTION_REF", "function ref must be a dot-separated identifier up to 128 characters"));
21947
21750
  } else if (branch === "local") {
21948
21751
  rejectUnknownKeys(body, ["name", "path", "value"], `${path23}.local`, issues);
21949
21752
  if (body.name !== "data.set" || typeof body.path !== "string" || !isSafePath(body.path) || !Object.prototype.hasOwnProperty.call(body, "value"))
@@ -21970,6 +21773,9 @@ function validateAction(value, path23, issues, depth) {
21970
21773
  validateAction(body.default, `${path23}.select.default`, issues, depth + 1);
21971
21774
  }
21972
21775
  }
21776
+ function isFunctionActionRef(value) {
21777
+ return typeof value === "string" && value.length <= 128 && /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u.test(value);
21778
+ }
21973
21779
  function validateClientAction(body, path23, issues) {
21974
21780
  rejectUnknownKeys(body, ["name", "context"], path23, issues);
21975
21781
  if (body.name === "ui.overlay.close") {
@@ -21990,14 +21796,50 @@ function validateClientAction(body, path23, issues) {
21990
21796
  return;
21991
21797
  }
21992
21798
  if (body.name === "payment.trade-pay") {
21993
- if (!isPlainRecord(body.context) || typeof body.context.actionId !== "string" || !isPlainRecord(body.context.actionContext) || Object.keys(body.context).length !== 2)
21994
- issues.push(issue2(`${path23}.context`, "INVALID_CLIENT_ACTION_CONTEXT", "payment.trade-pay requires actionId and actionContext"));
21995
- else
21996
- validateActionDynamicValue(body.context.actionContext, `${path23}.context.actionContext`, issues);
21799
+ validatePaymentActionContext(body.context, `${path23}.context`, issues);
21997
21800
  return;
21998
21801
  }
21999
21802
  issues.push(issue2(`${path23}.name`, "UNSUPPORTED_CLIENT_ACTION", `unsupported client action ${String(body.name)}`));
22000
21803
  }
21804
+ function validatePaymentActionContext(value, path23, issues) {
21805
+ if (!isPlainRecord(value)) {
21806
+ issues.push(issue2(path23, "INVALID_CLIENT_ACTION_CONTEXT", "payment.trade-pay requires createTrade and onSuccess"));
21807
+ return;
21808
+ }
21809
+ rejectUnknownKeys(value, ["createTrade", "onSuccess"], path23, issues);
21810
+ const createTrade = isPlainRecord(value.createTrade) ? value.createTrade : void 0;
21811
+ if (!createTrade) {
21812
+ issues.push(issue2(`${path23}.createTrade`, "INVALID_PAYMENT_CREATE_TRADE", "createTrade must be an object"));
21813
+ } else {
21814
+ rejectUnknownKeys(createTrade, ["mcpResourceId", "toolName", "input", "tradeNoPath"], `${path23}.createTrade`, issues);
21815
+ if (!isSafeIdentifier(createTrade.mcpResourceId))
21816
+ issues.push(issue2(`${path23}.createTrade.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
21817
+ if (typeof createTrade.toolName !== "string" || !createTrade.toolName.trim())
21818
+ issues.push(issue2(`${path23}.createTrade.toolName`, "INVALID_TOOL_NAME", "toolName is required"));
21819
+ if (!isPlainRecord(createTrade.input))
21820
+ issues.push(issue2(`${path23}.createTrade.input`, "INVALID_PAYMENT_INPUT", "input must be an object"));
21821
+ else
21822
+ validateActionDynamicValue(createTrade.input, `${path23}.createTrade.input`, issues);
21823
+ if (!isSafeJsonPointer(createTrade.tradeNoPath))
21824
+ issues.push(issue2(`${path23}.createTrade.tradeNoPath`, "INVALID_TRADE_NO_PATH", "tradeNoPath must be an absolute JSON Pointer"));
21825
+ }
21826
+ const onSuccess = isPlainRecord(value.onSuccess) ? value.onSuccess : void 0;
21827
+ const event = onSuccess && isPlainRecord(onSuccess.event) ? onSuccess.event : void 0;
21828
+ if (!onSuccess || !event) {
21829
+ issues.push(issue2(`${path23}.onSuccess`, "INVALID_PAYMENT_SUCCESS_EVENT", "onSuccess.event is required"));
21830
+ return;
21831
+ }
21832
+ rejectUnknownKeys(onSuccess, ["event"], `${path23}.onSuccess`, issues);
21833
+ rejectUnknownKeys(event, ["name", "context", "x2-user-message"], `${path23}.onSuccess.event`, issues);
21834
+ if (typeof event.name !== "string" || !/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/.test(event.name) || event.name.length > 96)
21835
+ issues.push(issue2(`${path23}.onSuccess.event.name`, "INVALID_ACTION_NAME", "event name is invalid"));
21836
+ if (event.context !== void 0 && !isPlainRecord(event.context))
21837
+ issues.push(issue2(`${path23}.onSuccess.event.context`, "INVALID_ACTION_CONTEXT", "event context must be an object"));
21838
+ else if (event.context !== void 0)
21839
+ validateActionDynamicValue(event.context, `${path23}.onSuccess.event.context`, issues);
21840
+ if (typeof event["x2-user-message"] !== "string" || !event["x2-user-message"].trim())
21841
+ issues.push(issue2(`${path23}.onSuccess.event.x2-user-message`, "INVALID_ACTION_CONTEXT", "x2-user-message must be a non-empty string"));
21842
+ }
22001
21843
  function validateActionDynamicValue(value, path23, issues) {
22002
21844
  if (Array.isArray(value)) {
22003
21845
  value.forEach((entry, index) => validateActionDynamicValue(entry, `${path23}[${index}]`, issues));
@@ -22216,7 +22058,7 @@ var FIELD_SOURCES = [
22216
22058
  "runtime-context",
22217
22059
  "local"
22218
22060
  ];
22219
- var RUNTIME_CONTEXT_KEYS3 = /* @__PURE__ */ new Set([
22061
+ var RUNTIME_CONTEXT_KEYS2 = /* @__PURE__ */ new Set([
22220
22062
  "agentId",
22221
22063
  "tenantId",
22222
22064
  "threadId",
@@ -22252,9 +22094,6 @@ function getA2UICardDraftBundleIssues(value) {
22252
22094
  issues.push(...getPersistedV4ProtocolIssues(card, "draft.card"));
22253
22095
  validateV4BindingContracts(card, analysis.occurrences, manifest.fields, "draft.card", issues);
22254
22096
  }
22255
- if (manifest?.schemaVersion === "3" || manifest?.schemaVersion === "4") {
22256
- issues.push(...getA2UIPaymentActionReferenceIssues(card, manifest.actionBindings ?? [], "draft.card"));
22257
- }
22258
22097
  }
22259
22098
  return issues;
22260
22099
  }
@@ -22412,6 +22251,9 @@ function getA2UICardResourceConfigIssues(value) {
22412
22251
  }
22413
22252
  function getA2UICardResourceConfigV3Issues(value) {
22414
22253
  const issues = [];
22254
+ if (value.actionBindings !== void 0) {
22255
+ issues.push(issue2("config.actionBindings", "LEGACY_PAYMENT_ACTION_BINDINGS_UNSUPPORTED", "payment actions must be defined inline in card JSON"));
22256
+ }
22415
22257
  exactKeys(value, [
22416
22258
  "schemaVersion",
22417
22259
  "revision",
@@ -22422,7 +22264,6 @@ function getA2UICardResourceConfigV3Issues(value) {
22422
22264
  "fields",
22423
22265
  "dataSources",
22424
22266
  "bindings",
22425
- "actionBindings",
22426
22267
  "a2uiTemplate"
22427
22268
  ], "config", issues);
22428
22269
  if (value.schemaVersion !== "3" && value.schemaVersion !== "4") {
@@ -22446,11 +22287,6 @@ function getA2UICardResourceConfigV3Issues(value) {
22446
22287
  issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"));
22447
22288
  issues.push(...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
22448
22289
  }
22449
- const actionBindings = value.actionBindings === void 0 ? [] : value.actionBindings;
22450
- issues.push(...getA2UICardActionBindingIssues(actionBindings, "config.actionBindings"));
22451
- if (card && Array.isArray(actionBindings)) {
22452
- issues.push(...getA2UIPaymentActionReferenceIssues(card, actionBindings, "config.a2uiTemplate.content"));
22453
- }
22454
22290
  if (fields && dataSources && bindings) {
22455
22291
  validateV3Coverage(fields, dataSources, bindings, issues, { card });
22456
22292
  }
@@ -22646,6 +22482,9 @@ function validateManifest(value, path23, issues) {
22646
22482
  return void 0;
22647
22483
  }
22648
22484
  if (value.schemaVersion === "3" || value.schemaVersion === "4") {
22485
+ if (value.actionBindings !== void 0) {
22486
+ issues.push(issue2(`${path23}.actionBindings`, "LEGACY_PAYMENT_ACTION_BINDINGS_UNSUPPORTED", "payment actions must be defined inline in card JSON"));
22487
+ }
22649
22488
  exactKeys(value, [
22650
22489
  "schemaVersion",
22651
22490
  "draftId",
@@ -22656,8 +22495,7 @@ function validateManifest(value, path23, issues) {
22656
22495
  "whenToUse",
22657
22496
  "whenNotToUse",
22658
22497
  "fields",
22659
- "bindings",
22660
- "actionBindings"
22498
+ "bindings"
22661
22499
  ], path23, issues);
22662
22500
  if (!isSafeIdentifier(value.draftId)) {
22663
22501
  issues.push(issue2(`${path23}.draftId`, "INVALID_DRAFT_ID", "draftId is invalid"));
@@ -22677,9 +22515,6 @@ function validateManifest(value, path23, issues) {
22677
22515
  if (value.bindings !== void 0) {
22678
22516
  validateV3BindingSelections(value.bindings, `${path23}.bindings`, fields2, issues);
22679
22517
  }
22680
- if (value.actionBindings !== void 0) {
22681
- issues.push(...getA2UICardActionBindingIssues(value.actionBindings, `${path23}.actionBindings`));
22682
- }
22683
22518
  return fields2 ? value : void 0;
22684
22519
  }
22685
22520
  exactKeys(value, [
@@ -22812,7 +22647,7 @@ function validateFieldSource(candidate, itemPath, issues) {
22812
22647
  issues.push(issue2(`${itemPath}.sourcePath`, "UNEXPECTED_FIELD_SOURCE_PATH", "sourcePath is only allowed for invocation fields"));
22813
22648
  }
22814
22649
  if (candidate.source === "runtime-context") {
22815
- if (!RUNTIME_CONTEXT_KEYS3.has(candidate.runtimeContextKey)) {
22650
+ if (!RUNTIME_CONTEXT_KEYS2.has(candidate.runtimeContextKey)) {
22816
22651
  issues.push(issue2(`${itemPath}.runtimeContextKey`, "INVALID_RUNTIME_CONTEXT", "runtime-context fields require an allowed runtimeContextKey"));
22817
22652
  }
22818
22653
  } else if (candidate.runtimeContextKey !== void 0) {
@@ -22864,11 +22699,11 @@ function validateResolverCalls(value, path23, issues) {
22864
22699
  issues.push(issue2(`${itemPath}.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
22865
22700
  }
22866
22701
  requiredString(candidate.toolName, `${itemPath}.toolName`, issues);
22867
- validateInputBindings3(candidate.inputBindings, `${itemPath}.inputBindings`, issues);
22702
+ validateInputBindings2(candidate.inputBindings, `${itemPath}.inputBindings`, issues);
22868
22703
  });
22869
22704
  return value;
22870
22705
  }
22871
- function validateInputBindings3(value, path23, issues) {
22706
+ function validateInputBindings2(value, path23, issues) {
22872
22707
  if (!Array.isArray(value)) {
22873
22708
  issues.push(issue2(path23, "INVALID_INPUT_BINDINGS", "inputBindings must be an array"));
22874
22709
  return void 0;
@@ -22888,11 +22723,11 @@ function validateInputBindings3(value, path23, issues) {
22888
22723
  } else {
22889
22724
  paths.add(candidate.inputPath);
22890
22725
  }
22891
- validateInputSource2(candidate.source, `${itemPath}.source`, issues);
22726
+ validateInputSource(candidate.source, `${itemPath}.source`, issues);
22892
22727
  });
22893
22728
  return value;
22894
22729
  }
22895
- function validateInputSource2(value, path23, issues) {
22730
+ function validateInputSource(value, path23, issues) {
22896
22731
  if (!isPlainRecord(value)) {
22897
22732
  issues.push(issue2(path23, "INVALID_INPUT_SOURCE", "source must be an object"));
22898
22733
  return;
@@ -22906,7 +22741,7 @@ function validateInputSource2(value, path23, issues) {
22906
22741
  }
22907
22742
  if (value.kind === "runtime-context") {
22908
22743
  exactKeys(value, ["kind", "key"], path23, issues);
22909
- if (!RUNTIME_CONTEXT_KEYS3.has(value.key)) {
22744
+ if (!RUNTIME_CONTEXT_KEYS2.has(value.key)) {
22910
22745
  issues.push(issue2(`${path23}.key`, "INVALID_RUNTIME_CONTEXT", "runtime context key is invalid"));
22911
22746
  }
22912
22747
  return;
@@ -23270,9 +23105,6 @@ function compileModernResource(draft, revision, bindings, tools) {
23270
23105
  fields: draft.manifest.fields,
23271
23106
  dataSources: [...sourceById.values()].sort((left, right) => left.sourceId.localeCompare(right.sourceId)),
23272
23107
  bindings: outputBindings.sort((left, right) => left.fieldId.localeCompare(right.fieldId)),
23273
- ...draft.manifest.actionBindings?.length ? {
23274
- actionBindings: JSON.parse(JSON.stringify(draft.manifest.actionBindings))
23275
- } : {},
23276
23108
  a2uiTemplate: {
23277
23109
  argsSchema: createA2UICardViewModelSchema(draft.manifest.fields),
23278
23110
  content: stableJsonStringify(draft.card)
@@ -23541,6 +23373,9 @@ var SHA256_CONSTANTS = [
23541
23373
  3329325298
23542
23374
  ];
23543
23375
 
23376
+ // ../agent-a2ui-card-contract/dist/esm/payment-action.js
23377
+ var A2UI_PAYMENT_ACTION_NAME = "payment.trade-pay";
23378
+
23544
23379
  // ../agent-a2ui-card-contract/dist/esm/authoring-model.js
23545
23380
  var INTERNAL_KEYS = /* @__PURE__ */ new Set([
23546
23381
  "__proto__",
@@ -23593,7 +23428,7 @@ function extractA2UICardAuthoringModel(bundle, options = {}) {
23593
23428
  discoverComponentTargets(component, occurrenceId, projection, targets);
23594
23429
  allFieldOccurrenceTargets.push(...fieldTargets(component, occurrenceId, fields, componentOccurrences, false));
23595
23430
  targets.push(...fieldTargets(component, occurrenceId, fields, componentOccurrences, true));
23596
- targets.push(...actionTargets(component, occurrenceId, bundle.manifest.schemaVersion === "3" || bundle.manifest.schemaVersion === "4" ? bundle.manifest.actionBindings : void 0));
23431
+ targets.push(...actionTargets(component, occurrenceId));
23597
23432
  }
23598
23433
  if (targets.length === 0) {
23599
23434
  targets.push({
@@ -23786,7 +23621,7 @@ function discoverTargets(value, occurrenceId, propertyPath, targets) {
23786
23621
  });
23787
23622
  }
23788
23623
  }
23789
- function actionTargets(component, occurrenceId, actionBindings) {
23624
+ function actionTargets(component, occurrenceId) {
23790
23625
  if (!isPlainRecord(component.action))
23791
23626
  return [];
23792
23627
  const action = component.action;
@@ -23809,6 +23644,19 @@ function actionTargets(component, occurrenceId, actionBindings) {
23809
23644
  }
23810
23645
  return [agentOnlyAction(occurrenceId, "\u52A8\u6001\u6216\u590D\u6742\u4E8B\u4EF6\u901A\u8FC7\u667A\u80FD\u4F53\u4FEE\u6539")];
23811
23646
  }
23647
+ const functionAction = isPlainRecord(action.function) ? action.function : void 0;
23648
+ if (functionAction && typeof functionAction.ref === "string") {
23649
+ return [
23650
+ {
23651
+ kind: "function",
23652
+ targetId: createA2UICardAuthoringTargetId(occurrenceId, "action"),
23653
+ occurrenceId,
23654
+ propertyPath: "action",
23655
+ label: "\u524D\u7AEF\u51FD\u6570",
23656
+ ref: functionAction.ref
23657
+ }
23658
+ ];
23659
+ }
23812
23660
  const client = isPlainRecord(action.client) ? action.client : void 0;
23813
23661
  if (client?.name === "ui.page.open") {
23814
23662
  const context = isPlainRecord(client.context) ? client.context : void 0;
@@ -23827,9 +23675,7 @@ function actionTargets(component, occurrenceId, actionBindings) {
23827
23675
  }
23828
23676
  if (client?.name === A2UI_PAYMENT_ACTION_NAME) {
23829
23677
  const context = isPlainRecord(client.context) ? client.context : void 0;
23830
- const actionId = typeof context?.actionId === "string" ? context.actionId : "";
23831
- const actionContext = isPlainRecord(context?.actionContext) ? context.actionContext : {};
23832
- const binding = actionBindings?.find((candidate) => candidate.kind === "payment" && candidate.actionId === actionId);
23678
+ const payment = context ? JSON.parse(JSON.stringify(context)) : void 0;
23833
23679
  return [
23834
23680
  {
23835
23681
  kind: "payment",
@@ -23837,10 +23683,8 @@ function actionTargets(component, occurrenceId, actionBindings) {
23837
23683
  occurrenceId,
23838
23684
  propertyPath: "action",
23839
23685
  label: "\u652F\u4ED8",
23840
- actionId,
23841
- actionContext,
23842
- ...binding ? { binding } : {},
23843
- configured: Boolean(actionId && binding)
23686
+ ...payment ? { payment } : {},
23687
+ configured: Boolean(payment)
23844
23688
  }
23845
23689
  ];
23846
23690
  }
@@ -34743,7 +34587,6 @@ var A2UI_ACTION_TABLE_COLUMNS = [
34743
34587
  "ownerId",
34744
34588
  "agentId",
34745
34589
  "threadId",
34746
- "actionId",
34747
34590
  "cardRef",
34748
34591
  "cardRevision",
34749
34592
  "surfaceId",
@@ -34773,7 +34616,7 @@ var A2UI_ACTION_TABLE_COLUMNS = [
34773
34616
  default: null
34774
34617
  },
34775
34618
  {
34776
- key: "actionContext",
34619
+ key: "input",
34777
34620
  type: "text",
34778
34621
  required: true,
34779
34622
  array: false,
@@ -36285,6 +36128,7 @@ var HEALTH_PATH = "/healthz";
36285
36128
  var RUNS_PATH = "/runs";
36286
36129
  var HOME_DATA_PATH = "/home-data";
36287
36130
  var A2UI_ACTION_PATH = "/a2ui-action";
36131
+ var FUNCTION_ACTION_MCP_PATH = "/function-actions/mcp";
36288
36132
  var AGENT_RUNTIME_PROTOCOL = "conversation-runs-v2";
36289
36133
  var API_KEY_ENV = "LINKQUE_AGENT_API_KEY";
36290
36134
  var stopped = (health) => ({
@@ -36553,6 +36397,7 @@ var spawnAgentOwner = (cwd, config3, port, apiKey, statePath) => {
36553
36397
  healthPath: HEALTH_PATH,
36554
36398
  homeDataPath: HOME_DATA_PATH,
36555
36399
  a2uiActionPath: A2UI_ACTION_PATH,
36400
+ functionActionMcpPath: FUNCTION_ACTION_MCP_PATH,
36556
36401
  logPath: import_path15.default.join(cwd, AGENT_LOG),
36557
36402
  port,
36558
36403
  runsPath: RUNS_PATH,
@@ -40886,6 +40731,12 @@ async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum) {
40886
40731
  `\u5F53\u524D Runtime \u4E0D\u652F\u6301\u5361\u7247\u534F\u8BAE V${bundle.manifest.schemaVersion}\uFF0C\u8BF7\u5148\u5347\u7EA7 Runtime`
40887
40732
  );
40888
40733
  }
40734
+ if (bundle.manifest.schemaVersion === "4" && containsFunctionAction(bundle.card) && !await readRuntimeSupportsFunctionActions(cwd)) {
40735
+ throw new LinkqueCliError(
40736
+ "CARD_RUNTIME_SCHEMA_UNSUPPORTED",
40737
+ "\u5F53\u524D Runtime \u4E0D\u652F\u6301\u524D\u7AEF\u51FD\u6570 Action\uFF0C\u8BF7\u5148\u5347\u7EA7 Runtime"
40738
+ );
40739
+ }
40889
40740
  const context = parseOptionalBindingContext(
40890
40741
  await readOptionalJson(import_path22.default.join(directory, "binding-context.json"))
40891
40742
  );
@@ -41190,6 +41041,20 @@ async function readRuntimeSupportedSchemaVersions(cwd) {
41190
41041
  }
41191
41042
  return [...new Set(versions)];
41192
41043
  }
41044
+ async function readRuntimeSupportsFunctionActions(cwd) {
41045
+ const value = await readOptionalJson(
41046
+ import_path22.default.join(cwd, RUNTIME_CAPABILITIES_PATH)
41047
+ ).catch(() => void 0);
41048
+ return isJsonObject(value) && value.schemaVersion === 1 && isJsonObject(value.a2uiCard) && value.a2uiCard.frontendFunctionActions === true;
41049
+ }
41050
+ function containsFunctionAction(value) {
41051
+ if (Array.isArray(value)) return value.some(containsFunctionAction);
41052
+ if (!isJsonObject(value)) return false;
41053
+ if (isJsonObject(value.action) && isJsonObject(value.action.function)) {
41054
+ return true;
41055
+ }
41056
+ return Object.values(value).some(containsFunctionAction);
41057
+ }
41193
41058
  async function readOptionalJsonObject(file) {
41194
41059
  const value = await readOptionalJson(file);
41195
41060
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkque-cli-v2",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Public Linkque CLI bundle for sandbox debugging",
5
5
  "bin": {
6
6
  "linkquejs": "linkquejs.js"