linkque-cli-v2 1.2.1 → 1.2.3
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 +714 -351
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-NRTXRI33.js → chunk-F3IESVDW.js} +27 -6
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-IXJFWSVE.js → chunk-RRQKGME5.js} +342 -69
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +348 -21
- 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 +326 -71
package/worker.js
CHANGED
|
@@ -5024,6 +5024,7 @@ var init_agentProtocol = __esm({
|
|
|
5024
5024
|
EHookStage2["RUN_STARTED"] = "RUN_STARTED";
|
|
5025
5025
|
EHookStage2["RUN_COMPLETED"] = "RUN_COMPLETED";
|
|
5026
5026
|
EHookStage2["RUN_FAILED"] = "RUN_FAILED";
|
|
5027
|
+
EHookStage2["RUN_READ"] = "RUN_READ";
|
|
5027
5028
|
EHookStage2["BEFORE_TOOL_CALL"] = "BEFORE_TOOL_CALL";
|
|
5028
5029
|
EHookStage2["AFTER_TOOL_CALL"] = "AFTER_TOOL_CALL";
|
|
5029
5030
|
EHookStage2["TOOL_CALL_FAILED"] = "TOOL_CALL_FAILED";
|
|
@@ -12058,7 +12059,7 @@ var require_jmespath = __commonJS({
|
|
|
12058
12059
|
return false;
|
|
12059
12060
|
}
|
|
12060
12061
|
}
|
|
12061
|
-
function
|
|
12062
|
+
function isObject3(obj) {
|
|
12062
12063
|
if (obj !== null) {
|
|
12063
12064
|
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
12064
12065
|
} else {
|
|
@@ -12084,7 +12085,7 @@ var require_jmespath = __commonJS({
|
|
|
12084
12085
|
}
|
|
12085
12086
|
return true;
|
|
12086
12087
|
}
|
|
12087
|
-
if (
|
|
12088
|
+
if (isObject3(first) === true) {
|
|
12088
12089
|
var keysSeen = {};
|
|
12089
12090
|
for (var key in first) {
|
|
12090
12091
|
if (hasOwnProperty.call(first, key)) {
|
|
@@ -12110,7 +12111,7 @@ var require_jmespath = __commonJS({
|
|
|
12110
12111
|
return true;
|
|
12111
12112
|
} else if (isArray4(obj) && obj.length === 0) {
|
|
12112
12113
|
return true;
|
|
12113
|
-
} else if (
|
|
12114
|
+
} else if (isObject3(obj)) {
|
|
12114
12115
|
for (var key in obj) {
|
|
12115
12116
|
if (obj.hasOwnProperty(key)) {
|
|
12116
12117
|
return false;
|
|
@@ -12827,7 +12828,7 @@ var require_jmespath = __commonJS({
|
|
|
12827
12828
|
var matched, current, result, first, second, field, left, right, collected, i2;
|
|
12828
12829
|
switch (node.type) {
|
|
12829
12830
|
case "Field":
|
|
12830
|
-
if (value !== null &&
|
|
12831
|
+
if (value !== null && isObject3(value)) {
|
|
12831
12832
|
field = value[node.name];
|
|
12832
12833
|
if (field === void 0) {
|
|
12833
12834
|
return null;
|
|
@@ -12897,7 +12898,7 @@ var require_jmespath = __commonJS({
|
|
|
12897
12898
|
return collected;
|
|
12898
12899
|
case "ValueProjection":
|
|
12899
12900
|
base = this.visit(node.children[0], value);
|
|
12900
|
-
if (!
|
|
12901
|
+
if (!isObject3(base)) {
|
|
12901
12902
|
return null;
|
|
12902
12903
|
}
|
|
12903
12904
|
collected = [];
|
|
@@ -13294,7 +13295,7 @@ var require_jmespath = __commonJS({
|
|
|
13294
13295
|
return Math.floor(resolvedArgs[0]);
|
|
13295
13296
|
},
|
|
13296
13297
|
_functionLength: function(resolvedArgs) {
|
|
13297
|
-
if (!
|
|
13298
|
+
if (!isObject3(resolvedArgs[0])) {
|
|
13298
13299
|
return resolvedArgs[0].length;
|
|
13299
13300
|
} else {
|
|
13300
13301
|
return Object.keys(resolvedArgs[0]).length;
|
|
@@ -14286,7 +14287,15 @@ function getA2UIActionExecuteRequestIssues(value) {
|
|
|
14286
14287
|
if (!isPlainRecord(value))
|
|
14287
14288
|
return ["request must be an object"];
|
|
14288
14289
|
const issues = [];
|
|
14289
|
-
rejectExtraKeysAsStrings(value, [
|
|
14290
|
+
rejectExtraKeysAsStrings(value, [
|
|
14291
|
+
"schemaVersion",
|
|
14292
|
+
"agentId",
|
|
14293
|
+
"threadId",
|
|
14294
|
+
"invocationId",
|
|
14295
|
+
"actionId",
|
|
14296
|
+
"source",
|
|
14297
|
+
"actionContext"
|
|
14298
|
+
], "request", issues);
|
|
14290
14299
|
if (value.schemaVersion !== "1")
|
|
14291
14300
|
issues.push("schemaVersion must be 1");
|
|
14292
14301
|
requiredIdentifier(value.agentId, "agentId", issues);
|
|
@@ -14301,7 +14310,9 @@ function getA2UIActionExecuteRequestIssues(value) {
|
|
|
14301
14310
|
}
|
|
14302
14311
|
function parseA2UIPaymentResultEventPayload(value) {
|
|
14303
14312
|
if (!isPlainRecord(value)) {
|
|
14304
|
-
throw new A2UIActionContractError([
|
|
14313
|
+
throw new A2UIActionContractError([
|
|
14314
|
+
"payment result payload must be an object"
|
|
14315
|
+
]);
|
|
14305
14316
|
}
|
|
14306
14317
|
const issues = [];
|
|
14307
14318
|
rejectExtraKeysAsStrings(value, ["actionId", "actionInvocationId", "tradeNO", "actionContext", "callback"], "payment result payload", issues);
|
|
@@ -14325,7 +14336,9 @@ function parseA2UIPaymentResultEventPayload(value) {
|
|
|
14325
14336
|
}
|
|
14326
14337
|
function getA2UICardActionBindingIssues(value, path6 = "actionBindings") {
|
|
14327
14338
|
if (!Array.isArray(value)) {
|
|
14328
|
-
return [
|
|
14339
|
+
return [
|
|
14340
|
+
issue2(path6, "INVALID_ACTION_BINDINGS", "actionBindings must be an array")
|
|
14341
|
+
];
|
|
14329
14342
|
}
|
|
14330
14343
|
const issues = [];
|
|
14331
14344
|
const actionIds = /* @__PURE__ */ new Set();
|
|
@@ -14385,7 +14398,13 @@ function validateToolBinding(value, path6, phase, issues) {
|
|
|
14385
14398
|
issues.push(issue2(path6, "INVALID_PAYMENT_TOOL", `${path6} must be an object`));
|
|
14386
14399
|
return;
|
|
14387
14400
|
}
|
|
14388
|
-
rejectExtraKeys(value, phase === "create" ? ["mcpResourceId", "toolName", "inputBindings", "tradeNoPath"] : [
|
|
14401
|
+
rejectExtraKeys(value, phase === "create" ? ["mcpResourceId", "toolName", "inputBindings", "tradeNoPath"] : [
|
|
14402
|
+
"mcpResourceId",
|
|
14403
|
+
"toolName",
|
|
14404
|
+
"inputBindings",
|
|
14405
|
+
"statusPath",
|
|
14406
|
+
"paidValues"
|
|
14407
|
+
], path6, issues);
|
|
14389
14408
|
if (!isSafeIdentifier(value.mcpResourceId)) {
|
|
14390
14409
|
issues.push(issue2(`${path6}.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
|
|
14391
14410
|
}
|
|
@@ -14559,7 +14578,12 @@ var init_payment_action = __esm({
|
|
|
14559
14578
|
this.name = "A2UIActionContractError";
|
|
14560
14579
|
}
|
|
14561
14580
|
};
|
|
14562
|
-
RUNTIME_CONTEXT_KEYS = /* @__PURE__ */ new Set([
|
|
14581
|
+
RUNTIME_CONTEXT_KEYS = /* @__PURE__ */ new Set([
|
|
14582
|
+
"agentId",
|
|
14583
|
+
"tenantId",
|
|
14584
|
+
"threadId",
|
|
14585
|
+
"userId"
|
|
14586
|
+
]);
|
|
14563
14587
|
}
|
|
14564
14588
|
});
|
|
14565
14589
|
|
|
@@ -14799,7 +14823,8 @@ function validateFields(value, path6, issues) {
|
|
|
14799
14823
|
"valueSchema",
|
|
14800
14824
|
"sourcePath",
|
|
14801
14825
|
"runtimeContextKey",
|
|
14802
|
-
"consistencyGroup"
|
|
14826
|
+
"consistencyGroup",
|
|
14827
|
+
"presentation"
|
|
14803
14828
|
], itemPath, issues);
|
|
14804
14829
|
if (!isSafeIdentifier(candidate.fieldId)) {
|
|
14805
14830
|
issues.push(issue2(`${itemPath}.fieldId`, "INVALID_FIELD_ID", "fieldId is invalid"));
|
|
@@ -14835,9 +14860,33 @@ function validateFields(value, path6, issues) {
|
|
|
14835
14860
|
}
|
|
14836
14861
|
validateFieldSource(candidate, itemPath, issues);
|
|
14837
14862
|
optionalString(candidate.consistencyGroup, `${itemPath}.consistencyGroup`, issues);
|
|
14863
|
+
validateFieldPresentation(candidate.presentation, itemPath, issues);
|
|
14838
14864
|
});
|
|
14839
14865
|
return value;
|
|
14840
14866
|
}
|
|
14867
|
+
function validateFieldPresentation(value, itemPath, issues) {
|
|
14868
|
+
if (value === void 0)
|
|
14869
|
+
return;
|
|
14870
|
+
const path6 = `${itemPath}.presentation`;
|
|
14871
|
+
if (!isPlainRecord(value)) {
|
|
14872
|
+
issues.push(issue2(path6, "INVALID_FIELD_PRESENTATION", `${path6} must be an object`));
|
|
14873
|
+
return;
|
|
14874
|
+
}
|
|
14875
|
+
if (!["echo", "reference-only", "never"].includes(String(value.visibility))) {
|
|
14876
|
+
issues.push(issue2(`${path6}.visibility`, "INVALID_PRESENTATION_VISIBILITY", "presentation visibility must be echo, reference-only or never"));
|
|
14877
|
+
}
|
|
14878
|
+
if (value.labelPath !== void 0 && !isSafeJsonPointer(value.labelPath)) {
|
|
14879
|
+
issues.push(issue2(`${path6}.labelPath`, "INVALID_PRESENTATION_PATH", "labelPath must be a safe JSON pointer"));
|
|
14880
|
+
}
|
|
14881
|
+
if (value.attributePaths !== void 0) {
|
|
14882
|
+
if (!Array.isArray(value.attributePaths) || value.attributePaths.length > 3 || value.attributePaths.some((candidate) => !isSafeJsonPointer(candidate))) {
|
|
14883
|
+
issues.push(issue2(`${path6}.attributePaths`, "INVALID_PRESENTATION_PATHS", "attributePaths must contain at most 3 safe JSON pointers"));
|
|
14884
|
+
}
|
|
14885
|
+
}
|
|
14886
|
+
if (value.maxItems !== void 0 && (!Number.isInteger(value.maxItems) || Number(value.maxItems) < 1 || Number(value.maxItems) > 10)) {
|
|
14887
|
+
issues.push(issue2(`${path6}.maxItems`, "INVALID_PRESENTATION_MAX_ITEMS", "maxItems must be an integer between 1 and 10"));
|
|
14888
|
+
}
|
|
14889
|
+
}
|
|
14841
14890
|
function validateFieldSource(candidate, itemPath, issues) {
|
|
14842
14891
|
if (candidate.source === "invocation") {
|
|
14843
14892
|
if (!isSafeJsonPointer(candidate.sourcePath)) {
|
|
@@ -15390,6 +15439,7 @@ var init_authoring_model = __esm({
|
|
|
15390
15439
|
"use strict";
|
|
15391
15440
|
init_binding_analyzer();
|
|
15392
15441
|
init_json2();
|
|
15442
|
+
init_payment_action();
|
|
15393
15443
|
init_validation();
|
|
15394
15444
|
}
|
|
15395
15445
|
});
|
|
@@ -15403,6 +15453,129 @@ var init_authoring_operation = __esm({
|
|
|
15403
15453
|
}
|
|
15404
15454
|
});
|
|
15405
15455
|
|
|
15456
|
+
// ../agent-a2ui-card-contract/dist/esm/presentation.js
|
|
15457
|
+
function createA2UICardPresentationReceiptContent(fields, viewModel) {
|
|
15458
|
+
const coverage = [];
|
|
15459
|
+
const entities = [];
|
|
15460
|
+
const omissions = [];
|
|
15461
|
+
for (const field of fields.slice(0, MAX_FIELDS)) {
|
|
15462
|
+
const policy = field.presentation;
|
|
15463
|
+
if (policy?.visibility === "never") {
|
|
15464
|
+
omissions.push({ fieldId: field.fieldId, reason: "policy" });
|
|
15465
|
+
continue;
|
|
15466
|
+
}
|
|
15467
|
+
const value = readJsonPointer(viewModel, field.path);
|
|
15468
|
+
coverage.push({
|
|
15469
|
+
fieldId: field.fieldId,
|
|
15470
|
+
label: truncateText(field.label).value,
|
|
15471
|
+
present: value !== void 0,
|
|
15472
|
+
valueType: field.type,
|
|
15473
|
+
...Array.isArray(value) && { itemCount: value.length }
|
|
15474
|
+
});
|
|
15475
|
+
if (!policy || value === void 0)
|
|
15476
|
+
continue;
|
|
15477
|
+
const isCollection = Array.isArray(value);
|
|
15478
|
+
const values = isCollection ? value : [value];
|
|
15479
|
+
const remainingBudget = MAX_ENTITIES - entities.length;
|
|
15480
|
+
const fieldBudget = Math.min(policy.maxItems ?? DEFAULT_FIELD_ITEMS, MAX_FIELD_ITEMS, remainingBudget);
|
|
15481
|
+
const selected = values.slice(0, Math.max(0, fieldBudget));
|
|
15482
|
+
for (const [index2, candidate] of selected.entries()) {
|
|
15483
|
+
const entity = createEntity(field, candidate, index2, isCollection, policy.visibility);
|
|
15484
|
+
if (entity)
|
|
15485
|
+
entities.push(entity);
|
|
15486
|
+
else
|
|
15487
|
+
omissions.push({ fieldId: field.fieldId, reason: "unsupported-value" });
|
|
15488
|
+
}
|
|
15489
|
+
if (values.length > selected.length) {
|
|
15490
|
+
omissions.push({
|
|
15491
|
+
fieldId: field.fieldId,
|
|
15492
|
+
reason: "budget",
|
|
15493
|
+
omittedCount: values.length - selected.length
|
|
15494
|
+
});
|
|
15495
|
+
}
|
|
15496
|
+
}
|
|
15497
|
+
if (fields.length > MAX_FIELDS) {
|
|
15498
|
+
omissions.push({
|
|
15499
|
+
fieldId: "*",
|
|
15500
|
+
reason: "budget",
|
|
15501
|
+
omittedCount: fields.length - MAX_FIELDS
|
|
15502
|
+
});
|
|
15503
|
+
}
|
|
15504
|
+
return { coverage, entities, omissions };
|
|
15505
|
+
}
|
|
15506
|
+
function createEntity(field, value, index2, isCollection, visibility) {
|
|
15507
|
+
const ref = `${field.fieldId}:${index2 + 1}`;
|
|
15508
|
+
if (visibility === "reference-only") {
|
|
15509
|
+
return {
|
|
15510
|
+
ref,
|
|
15511
|
+
fieldId: field.fieldId,
|
|
15512
|
+
...isCollection && { ordinal: index2 + 1 },
|
|
15513
|
+
label: isCollection ? `${field.label} ${index2 + 1}` : field.label
|
|
15514
|
+
};
|
|
15515
|
+
}
|
|
15516
|
+
if (isPrimitive(value)) {
|
|
15517
|
+
const normalized = normalizePrimitive(value);
|
|
15518
|
+
return {
|
|
15519
|
+
ref,
|
|
15520
|
+
fieldId: field.fieldId,
|
|
15521
|
+
label: field.label,
|
|
15522
|
+
value: normalized.value,
|
|
15523
|
+
...normalized.truncated && { truncated: true }
|
|
15524
|
+
};
|
|
15525
|
+
}
|
|
15526
|
+
if (!isObject(value))
|
|
15527
|
+
return void 0;
|
|
15528
|
+
const rawLabel = field.presentation?.labelPath ? readJsonPointer(value, field.presentation.labelPath) : void 0;
|
|
15529
|
+
const normalizedLabel = isPrimitive(rawLabel) ? truncateText(String(rawLabel)) : truncateText(`${field.label} ${index2 + 1}`);
|
|
15530
|
+
const attributes = {};
|
|
15531
|
+
let truncated = normalizedLabel.truncated;
|
|
15532
|
+
for (const path6 of (field.presentation?.attributePaths ?? []).slice(0, MAX_ATTRIBUTES)) {
|
|
15533
|
+
const attribute = readJsonPointer(value, path6);
|
|
15534
|
+
if (!isPrimitive(attribute))
|
|
15535
|
+
continue;
|
|
15536
|
+
const normalized = normalizePrimitive(attribute);
|
|
15537
|
+
attributes[path6] = normalized.value;
|
|
15538
|
+
truncated || (truncated = normalized.truncated);
|
|
15539
|
+
}
|
|
15540
|
+
return {
|
|
15541
|
+
ref,
|
|
15542
|
+
fieldId: field.fieldId,
|
|
15543
|
+
...isCollection && { ordinal: index2 + 1 },
|
|
15544
|
+
label: normalizedLabel.value,
|
|
15545
|
+
...Object.keys(attributes).length > 0 && { attributes },
|
|
15546
|
+
...truncated && { truncated: true }
|
|
15547
|
+
};
|
|
15548
|
+
}
|
|
15549
|
+
function isObject(value) {
|
|
15550
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
15551
|
+
}
|
|
15552
|
+
function isPrimitive(value) {
|
|
15553
|
+
return value === null || ["string", "number", "boolean"].includes(typeof value);
|
|
15554
|
+
}
|
|
15555
|
+
function normalizePrimitive(value) {
|
|
15556
|
+
if (typeof value !== "string")
|
|
15557
|
+
return { value, truncated: false };
|
|
15558
|
+
return truncateText(value);
|
|
15559
|
+
}
|
|
15560
|
+
function truncateText(value) {
|
|
15561
|
+
if (value.length <= MAX_TEXT_LENGTH)
|
|
15562
|
+
return { value, truncated: false };
|
|
15563
|
+
return { value: `${value.slice(0, MAX_TEXT_LENGTH - 1)}\u2026`, truncated: true };
|
|
15564
|
+
}
|
|
15565
|
+
var MAX_FIELDS, MAX_ENTITIES, DEFAULT_FIELD_ITEMS, MAX_FIELD_ITEMS, MAX_ATTRIBUTES, MAX_TEXT_LENGTH;
|
|
15566
|
+
var init_presentation = __esm({
|
|
15567
|
+
"../agent-a2ui-card-contract/dist/esm/presentation.js"() {
|
|
15568
|
+
"use strict";
|
|
15569
|
+
init_json2();
|
|
15570
|
+
MAX_FIELDS = 32;
|
|
15571
|
+
MAX_ENTITIES = 10;
|
|
15572
|
+
DEFAULT_FIELD_ITEMS = 3;
|
|
15573
|
+
MAX_FIELD_ITEMS = 10;
|
|
15574
|
+
MAX_ATTRIBUTES = 3;
|
|
15575
|
+
MAX_TEXT_LENGTH = 160;
|
|
15576
|
+
}
|
|
15577
|
+
});
|
|
15578
|
+
|
|
15406
15579
|
// ../agent-a2ui-card-contract/dist/esm/index.js
|
|
15407
15580
|
var init_esm4 = __esm({
|
|
15408
15581
|
"../agent-a2ui-card-contract/dist/esm/index.js"() {
|
|
@@ -15423,6 +15596,7 @@ var init_esm4 = __esm({
|
|
|
15423
15596
|
init_authoring_model();
|
|
15424
15597
|
init_authoring_operation();
|
|
15425
15598
|
init_payment_action();
|
|
15599
|
+
init_presentation();
|
|
15426
15600
|
}
|
|
15427
15601
|
});
|
|
15428
15602
|
|
|
@@ -15483,22 +15657,7 @@ async function executeCardPresentation(resource, registry2, runtimeContext, args
|
|
|
15483
15657
|
})),
|
|
15484
15658
|
signal
|
|
15485
15659
|
});
|
|
15486
|
-
|
|
15487
|
-
const cardInstanceId = `card-instance-${(0, import_node_crypto2.randomUUID)()}`;
|
|
15488
|
-
return {
|
|
15489
|
-
type: "linkque.presentation-tool-result",
|
|
15490
|
-
modelText: PRESENTATION_RESULT_TEXT,
|
|
15491
|
-
card: {
|
|
15492
|
-
type: "a2ui_card",
|
|
15493
|
-
itemId: cardInstanceId,
|
|
15494
|
-
payload: { protocol },
|
|
15495
|
-
metadata: {
|
|
15496
|
-
cardRef: resource.resourceId,
|
|
15497
|
-
cardRevision: config2.revision,
|
|
15498
|
-
cardInstanceId
|
|
15499
|
-
}
|
|
15500
|
-
}
|
|
15501
|
-
};
|
|
15660
|
+
return createPresentationResult(resource, config2, viewModel);
|
|
15502
15661
|
}
|
|
15503
15662
|
async function executeCardPresentationFromSources(resource, runtimeContext, sourceResults, signal) {
|
|
15504
15663
|
const config2 = parseCardConfig(resource);
|
|
@@ -15568,9 +15727,19 @@ async function executeCardPresentationFromSources(resource, runtimeContext, sour
|
|
|
15568
15727
|
function createPresentationResult(resource, config2, viewModel) {
|
|
15569
15728
|
const protocol = injectResolvedViewModel(JSON.parse(config2.a2uiTemplate.content), viewModel);
|
|
15570
15729
|
const cardInstanceId = `card-instance-${(0, import_node_crypto2.randomUUID)()}`;
|
|
15730
|
+
const receipt = {
|
|
15731
|
+
version: 1,
|
|
15732
|
+
cardRef: resource.resourceId,
|
|
15733
|
+
cardRevision: config2.revision,
|
|
15734
|
+
cardInstanceId,
|
|
15735
|
+
status: "emitted",
|
|
15736
|
+
...createA2UICardPresentationReceiptContent(config2.fields, viewModel),
|
|
15737
|
+
responsePolicy: { verbatimEcho: "forbidden", hint: "acknowledge" }
|
|
15738
|
+
};
|
|
15571
15739
|
return {
|
|
15572
15740
|
type: "linkque.presentation-tool-result",
|
|
15573
|
-
modelText:
|
|
15741
|
+
modelText: formatPresentationReceiptForModel(receipt),
|
|
15742
|
+
receipt,
|
|
15574
15743
|
card: {
|
|
15575
15744
|
type: "a2ui_card",
|
|
15576
15745
|
itemId: cardInstanceId,
|
|
@@ -15583,6 +15752,14 @@ function createPresentationResult(resource, config2, viewModel) {
|
|
|
15583
15752
|
}
|
|
15584
15753
|
};
|
|
15585
15754
|
}
|
|
15755
|
+
function formatPresentationReceiptForModel(receipt) {
|
|
15756
|
+
return [
|
|
15757
|
+
"<a2ui-presentation-receipt>",
|
|
15758
|
+
JSON.stringify(receipt),
|
|
15759
|
+
"</a2ui-presentation-receipt>",
|
|
15760
|
+
"The card above already presents these results. Do not repeat or restate its items as Markdown. Reply only with a brief acknowledgement or information not already presented by the card."
|
|
15761
|
+
].join("\n");
|
|
15762
|
+
}
|
|
15586
15763
|
function parseCardConfig(resource) {
|
|
15587
15764
|
const parsed = parseA2UICardResourceConfig(resource.config);
|
|
15588
15765
|
if (!parsed.success) {
|
|
@@ -15705,14 +15882,13 @@ function normalizeMcpInputSchema(value) {
|
|
|
15705
15882
|
function isJsonObject(value) {
|
|
15706
15883
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15707
15884
|
}
|
|
15708
|
-
var import_node_crypto2,
|
|
15885
|
+
var import_node_crypto2, FALLBACK_OBJECT_SCHEMA, CardMappingError;
|
|
15709
15886
|
var init_cardTools = __esm({
|
|
15710
15887
|
"../linkque-agent-runtime/dist/esm/core/cardTools.js"() {
|
|
15711
15888
|
"use strict";
|
|
15712
15889
|
import_node_crypto2 = require("node:crypto");
|
|
15713
15890
|
init_esm4();
|
|
15714
15891
|
init_mcpNaming();
|
|
15715
|
-
PRESENTATION_RESULT_TEXT = "\u5361\u7247\u5DF2\u5C55\u793A\u3002";
|
|
15716
15892
|
FALLBACK_OBJECT_SCHEMA = {
|
|
15717
15893
|
type: "object",
|
|
15718
15894
|
additionalProperties: true
|
|
@@ -16426,15 +16602,27 @@ async function verifyPaymentResult(input) {
|
|
|
16426
16602
|
function resolvePaymentBinding(protocol, source, actionId) {
|
|
16427
16603
|
const card = protocol.agent.resources.find((resource) => resource.resourceType === EResourceType.CARD && resource.resourceId === source.cardRef);
|
|
16428
16604
|
if (!card)
|
|
16429
|
-
return {
|
|
16605
|
+
return {
|
|
16606
|
+
ok: false,
|
|
16607
|
+
response: failure2("CARD_NOT_FOUND", "\u652F\u4ED8\u5361\u7247\u4E0D\u5B58\u5728", false)
|
|
16608
|
+
};
|
|
16430
16609
|
if (card.config.revision !== source.cardRevision) {
|
|
16431
|
-
return {
|
|
16610
|
+
return {
|
|
16611
|
+
ok: false,
|
|
16612
|
+
response: failure2("CARD_REVISION_MISMATCH", "\u652F\u4ED8\u5361\u7247\u7248\u672C\u5DF2\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5", false)
|
|
16613
|
+
};
|
|
16432
16614
|
}
|
|
16433
16615
|
const binding = card.config.schemaVersion === "3" ? card.config.actionBindings?.find((candidate) => candidate.actionId === actionId) : void 0;
|
|
16434
16616
|
if (!binding)
|
|
16435
|
-
return {
|
|
16617
|
+
return {
|
|
16618
|
+
ok: false,
|
|
16619
|
+
response: failure2("ACTION_NOT_FOUND", "\u652F\u4ED8\u52A8\u4F5C\u672A\u7ED1\u5B9A", false)
|
|
16620
|
+
};
|
|
16436
16621
|
if (binding.kind !== "payment") {
|
|
16437
|
-
return {
|
|
16622
|
+
return {
|
|
16623
|
+
ok: false,
|
|
16624
|
+
response: failure2("ACTION_KIND_MISMATCH", "\u52A8\u4F5C\u4E0D\u662F\u652F\u4ED8\u7C7B\u578B", false)
|
|
16625
|
+
};
|
|
16438
16626
|
}
|
|
16439
16627
|
return { ok: true, binding };
|
|
16440
16628
|
}
|
|
@@ -16915,6 +17103,9 @@ var init_hookDispatcher = __esm({
|
|
|
16915
17103
|
run: {
|
|
16916
17104
|
...subject.runDurationMs !== void 0 && {
|
|
16917
17105
|
durationMs: subject.runDurationMs
|
|
17106
|
+
},
|
|
17107
|
+
...subject.messageContent !== void 0 && {
|
|
17108
|
+
messageContent: subject.messageContent
|
|
16918
17109
|
}
|
|
16919
17110
|
}
|
|
16920
17111
|
};
|
|
@@ -16924,6 +17115,12 @@ var init_hookDispatcher = __esm({
|
|
|
16924
17115
|
stage: EHookStage.RUN_FAILED,
|
|
16925
17116
|
error: subject.error ?? { message: "unknown error" }
|
|
16926
17117
|
};
|
|
17118
|
+
case EHookStage.RUN_READ:
|
|
17119
|
+
return {
|
|
17120
|
+
...base,
|
|
17121
|
+
stage: EHookStage.RUN_READ,
|
|
17122
|
+
read: { readAt: subject.readAt ?? now() }
|
|
17123
|
+
};
|
|
16927
17124
|
case EHookStage.BEFORE_TOOL_CALL:
|
|
16928
17125
|
return {
|
|
16929
17126
|
...base,
|
|
@@ -16958,7 +17155,9 @@ var init_hookDispatcher = __esm({
|
|
|
16958
17155
|
eventId: context2.eventId,
|
|
16959
17156
|
runId: context2.commonParams.runId,
|
|
16960
17157
|
conversationId: context2.commonParams.conversationId,
|
|
16961
|
-
|
|
17158
|
+
...context2.commonParams.runIndex !== void 0 && {
|
|
17159
|
+
runIndex: context2.commonParams.runIndex
|
|
17160
|
+
},
|
|
16962
17161
|
agentId: context2.commonParams.agentId,
|
|
16963
17162
|
...context2.commonParams.sessionId !== void 0 && {
|
|
16964
17163
|
sessionId: context2.commonParams.sessionId
|
|
@@ -16989,7 +17188,9 @@ var init_hookDispatcher = __esm({
|
|
|
16989
17188
|
eventId: context2.eventId,
|
|
16990
17189
|
runId: context2.commonParams.runId,
|
|
16991
17190
|
conversationId: context2.commonParams.conversationId,
|
|
16992
|
-
|
|
17191
|
+
...context2.commonParams.runIndex !== void 0 && {
|
|
17192
|
+
runIndex: context2.commonParams.runIndex
|
|
17193
|
+
},
|
|
16993
17194
|
agentId: context2.commonParams.agentId,
|
|
16994
17195
|
...context2.commonParams.sessionId !== void 0 && {
|
|
16995
17196
|
sessionId: context2.commonParams.sessionId
|
|
@@ -17017,7 +17218,9 @@ var init_hookDispatcher = __esm({
|
|
|
17017
17218
|
eventId: context2.eventId,
|
|
17018
17219
|
runId: context2.commonParams.runId,
|
|
17019
17220
|
conversationId: context2.commonParams.conversationId,
|
|
17020
|
-
|
|
17221
|
+
...context2.commonParams.runIndex !== void 0 && {
|
|
17222
|
+
runIndex: context2.commonParams.runIndex
|
|
17223
|
+
},
|
|
17021
17224
|
agentId: context2.commonParams.agentId,
|
|
17022
17225
|
...context2.commonParams.sessionId !== void 0 && {
|
|
17023
17226
|
sessionId: context2.commonParams.sessionId
|
|
@@ -17182,7 +17385,9 @@ var init_sideEffectRunner = __esm({
|
|
|
17182
17385
|
eventId: context2.eventId,
|
|
17183
17386
|
runId: context2.commonParams.runId,
|
|
17184
17387
|
conversationId: context2.commonParams.conversationId,
|
|
17185
|
-
|
|
17388
|
+
...context2.commonParams.runIndex !== void 0 && {
|
|
17389
|
+
runIndex: context2.commonParams.runIndex
|
|
17390
|
+
},
|
|
17186
17391
|
agentId: context2.commonParams.agentId,
|
|
17187
17392
|
...context2.commonParams.sessionId !== void 0 && {
|
|
17188
17393
|
sessionId: context2.commonParams.sessionId
|
|
@@ -17484,11 +17689,22 @@ var init_httpLoggingFetch = __esm({
|
|
|
17484
17689
|
});
|
|
17485
17690
|
|
|
17486
17691
|
// ../linkque-agent-runtime/dist/esm/core/hook/linkquegwEventHookExecutor.js
|
|
17487
|
-
function
|
|
17692
|
+
function truncateMessageContent(messageContent) {
|
|
17693
|
+
return Array.from(messageContent).slice(0, LINKQUEGW_MESSAGE_CONTENT_MAX_LENGTH).join("");
|
|
17694
|
+
}
|
|
17695
|
+
function buildLinkquegwEventBody(context2, temporaryFrontendAppId) {
|
|
17488
17696
|
const eventType = LINKQUEGW_EVENT_TYPE_BY_STAGE[context2.stage];
|
|
17489
17697
|
if (eventType === void 0)
|
|
17490
17698
|
return void 0;
|
|
17491
17699
|
const { commonParams } = context2;
|
|
17700
|
+
const payload = {
|
|
17701
|
+
...temporaryFrontendAppId !== void 0 && {
|
|
17702
|
+
appId: temporaryFrontendAppId
|
|
17703
|
+
},
|
|
17704
|
+
...context2.stage === EHookStage.RUN_COMPLETED && context2.run.messageContent !== void 0 && {
|
|
17705
|
+
messageContent: truncateMessageContent(context2.run.messageContent)
|
|
17706
|
+
}
|
|
17707
|
+
};
|
|
17492
17708
|
return {
|
|
17493
17709
|
agentId: commonParams.agentId,
|
|
17494
17710
|
eventType,
|
|
@@ -17501,10 +17717,16 @@ function buildLinkquegwEventBody(context2) {
|
|
|
17501
17717
|
sessionId: commonParams.sessionId
|
|
17502
17718
|
},
|
|
17503
17719
|
runId: commonParams.runId,
|
|
17504
|
-
|
|
17720
|
+
...commonParams.runIndex !== void 0 && {
|
|
17721
|
+
runIndex: commonParams.runIndex
|
|
17722
|
+
},
|
|
17723
|
+
...context2.stage === EHookStage.RUN_READ && {
|
|
17724
|
+
readAt: context2.read.readAt
|
|
17725
|
+
},
|
|
17726
|
+
...Object.keys(payload).length > 0 && { payload }
|
|
17505
17727
|
};
|
|
17506
17728
|
}
|
|
17507
|
-
var DEFAULT_LINKQUEGW_EVENT_BASE_URL, LINKQUEGW_AGENT_EVENT_TRIGGER_PATH, LINKQUEGW_EVENT_TYPE_BY_STAGE, LinkquegwEventHookExecutor;
|
|
17729
|
+
var DEFAULT_LINKQUEGW_EVENT_BASE_URL, LINKQUEGW_AGENT_EVENT_TRIGGER_PATH, LINKQUEGW_MESSAGE_CONTENT_MAX_LENGTH, LINKQUEGW_EVENT_TYPE_BY_STAGE, LinkquegwEventHookExecutor;
|
|
17508
17730
|
var init_linkquegwEventHookExecutor = __esm({
|
|
17509
17731
|
"../linkque-agent-runtime/dist/esm/core/hook/linkquegwEventHookExecutor.js"() {
|
|
17510
17732
|
"use strict";
|
|
@@ -17513,10 +17735,12 @@ var init_linkquegwEventHookExecutor = __esm({
|
|
|
17513
17735
|
init_hookMetrics();
|
|
17514
17736
|
DEFAULT_LINKQUEGW_EVENT_BASE_URL = "https://linkquegw.alipay.com";
|
|
17515
17737
|
LINKQUEGW_AGENT_EVENT_TRIGGER_PATH = "/api/agent/event/trigger";
|
|
17738
|
+
LINKQUEGW_MESSAGE_CONTENT_MAX_LENGTH = 2048;
|
|
17516
17739
|
LINKQUEGW_EVENT_TYPE_BY_STAGE = {
|
|
17517
17740
|
[EHookStage.RUN_STARTED]: "RUN_STARTED",
|
|
17518
17741
|
[EHookStage.RUN_COMPLETED]: "RUN_ENDED",
|
|
17519
|
-
[EHookStage.RUN_FAILED]: "RUN_ENDED"
|
|
17742
|
+
[EHookStage.RUN_FAILED]: "RUN_ENDED",
|
|
17743
|
+
[EHookStage.RUN_READ]: "RUN_READ"
|
|
17520
17744
|
};
|
|
17521
17745
|
LinkquegwEventHookExecutor = class {
|
|
17522
17746
|
name = EHookExecutorName.LinkquegwEventHookExecutor;
|
|
@@ -17524,6 +17748,7 @@ var init_linkquegwEventHookExecutor = __esm({
|
|
|
17524
17748
|
getAuthHeaders;
|
|
17525
17749
|
fetchImpl;
|
|
17526
17750
|
metricsSink;
|
|
17751
|
+
temporaryFrontendAppId;
|
|
17527
17752
|
now;
|
|
17528
17753
|
constructor(options) {
|
|
17529
17754
|
this.baseUrl = options.baseUrl ?? DEFAULT_LINKQUEGW_EVENT_BASE_URL;
|
|
@@ -17531,6 +17756,7 @@ var init_linkquegwEventHookExecutor = __esm({
|
|
|
17531
17756
|
const baseFetch = options.fetchImpl ?? globalThis.fetch;
|
|
17532
17757
|
this.fetchImpl = options.debugLog ? createHttpLoggingFetch(options.debugLog, "hook-linkque", baseFetch) : baseFetch;
|
|
17533
17758
|
this.metricsSink = options.metricsSink;
|
|
17759
|
+
this.temporaryFrontendAppId = options.temporaryFrontendAppId;
|
|
17534
17760
|
this.now = options.now ?? Date.now;
|
|
17535
17761
|
}
|
|
17536
17762
|
async execute(resource, context2, options) {
|
|
@@ -17542,7 +17768,7 @@ var init_linkquegwEventHookExecutor = __esm({
|
|
|
17542
17768
|
message: `hook \u671F\u671B executor=${resource.config.executorName} provider=${resource.providerType},\u975E LinkquegwEventHookExecutor \u6D88\u8D39\u8303\u56F4`
|
|
17543
17769
|
};
|
|
17544
17770
|
}
|
|
17545
|
-
const body = buildLinkquegwEventBody(context2);
|
|
17771
|
+
const body = buildLinkquegwEventBody(context2, this.temporaryFrontendAppId);
|
|
17546
17772
|
if (body === void 0) {
|
|
17547
17773
|
return {
|
|
17548
17774
|
ok: true,
|
|
@@ -38105,11 +38331,11 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
38105
38331
|
throw new TypeError(`${context2} is not a function.`);
|
|
38106
38332
|
}
|
|
38107
38333
|
}
|
|
38108
|
-
function
|
|
38334
|
+
function isObject3(x2) {
|
|
38109
38335
|
return typeof x2 === "object" && x2 !== null || typeof x2 === "function";
|
|
38110
38336
|
}
|
|
38111
38337
|
function assertObject(x2, context2) {
|
|
38112
|
-
if (!
|
|
38338
|
+
if (!isObject3(x2)) {
|
|
38113
38339
|
throw new TypeError(`${context2} is not an object.`);
|
|
38114
38340
|
}
|
|
38115
38341
|
}
|
|
@@ -49605,11 +49831,11 @@ var require_verify_stream = __commonJS({
|
|
|
49605
49831
|
var toString = require_tostring();
|
|
49606
49832
|
var util2 = require("util");
|
|
49607
49833
|
var JWS_REGEX = /^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;
|
|
49608
|
-
function
|
|
49834
|
+
function isObject3(thing) {
|
|
49609
49835
|
return Object.prototype.toString.call(thing) === "[object Object]";
|
|
49610
49836
|
}
|
|
49611
49837
|
function safeJsonParse(thing) {
|
|
49612
|
-
if (
|
|
49838
|
+
if (isObject3(thing))
|
|
49613
49839
|
return thing;
|
|
49614
49840
|
try {
|
|
49615
49841
|
return JSON.parse(thing);
|
|
@@ -83905,7 +84131,7 @@ __export(util_exports, {
|
|
|
83905
84131
|
getLengthableOrigin: () => getLengthableOrigin,
|
|
83906
84132
|
getParsedType: () => getParsedType2,
|
|
83907
84133
|
getSizableOrigin: () => getSizableOrigin,
|
|
83908
|
-
isObject: () =>
|
|
84134
|
+
isObject: () => isObject2,
|
|
83909
84135
|
isPlainObject: () => isPlainObject,
|
|
83910
84136
|
issue: () => issue3,
|
|
83911
84137
|
joinValues: () => joinValues,
|
|
@@ -84037,17 +84263,17 @@ function randomString(length = 10) {
|
|
|
84037
84263
|
function esc(str2) {
|
|
84038
84264
|
return JSON.stringify(str2);
|
|
84039
84265
|
}
|
|
84040
|
-
function
|
|
84266
|
+
function isObject2(data) {
|
|
84041
84267
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
84042
84268
|
}
|
|
84043
84269
|
function isPlainObject(o) {
|
|
84044
|
-
if (
|
|
84270
|
+
if (isObject2(o) === false)
|
|
84045
84271
|
return false;
|
|
84046
84272
|
const ctor = o.constructor;
|
|
84047
84273
|
if (ctor === void 0)
|
|
84048
84274
|
return true;
|
|
84049
84275
|
const prot = ctor.prototype;
|
|
84050
|
-
if (
|
|
84276
|
+
if (isObject2(prot) === false)
|
|
84051
84277
|
return false;
|
|
84052
84278
|
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
84053
84279
|
return false;
|
|
@@ -86234,7 +86460,7 @@ var init_schemas = __esm({
|
|
|
86234
86460
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
86235
86461
|
};
|
|
86236
86462
|
let fastpass;
|
|
86237
|
-
const
|
|
86463
|
+
const isObject3 = isObject2;
|
|
86238
86464
|
const jit = !globalConfig.jitless;
|
|
86239
86465
|
const allowsEval2 = allowsEval;
|
|
86240
86466
|
const fastEnabled = jit && allowsEval2.value;
|
|
@@ -86243,7 +86469,7 @@ var init_schemas = __esm({
|
|
|
86243
86469
|
inst._zod.parse = (payload, ctx) => {
|
|
86244
86470
|
value ?? (value = _normalized.value);
|
|
86245
86471
|
const input = payload.value;
|
|
86246
|
-
if (!
|
|
86472
|
+
if (!isObject3(input)) {
|
|
86247
86473
|
payload.issues.push({
|
|
86248
86474
|
expected: "object",
|
|
86249
86475
|
code: "invalid_type",
|
|
@@ -86387,7 +86613,7 @@ var init_schemas = __esm({
|
|
|
86387
86613
|
});
|
|
86388
86614
|
inst._zod.parse = (payload, ctx) => {
|
|
86389
86615
|
const input = payload.value;
|
|
86390
|
-
if (!
|
|
86616
|
+
if (!isObject2(input)) {
|
|
86391
86617
|
payload.issues.push({
|
|
86392
86618
|
code: "invalid_type",
|
|
86393
86619
|
expected: "object",
|
|
@@ -95598,8 +95824,8 @@ function discriminatedUnion2(inputPropertyName, options, opts = {}) {
|
|
|
95598
95824
|
[outputPropertyName ?? inputPropertyName]: unknownValue,
|
|
95599
95825
|
isUnknown: true
|
|
95600
95826
|
}, { [UNKNOWN]: { value: true, enumerable: false, configurable: false } });
|
|
95601
|
-
const
|
|
95602
|
-
if (!
|
|
95827
|
+
const isObject3 = typeof input === "object" && input !== null;
|
|
95828
|
+
if (!isObject3)
|
|
95603
95829
|
return fallback;
|
|
95604
95830
|
const discriminator = input[inputPropertyName];
|
|
95605
95831
|
if (typeof discriminator !== "string")
|
|
@@ -189326,6 +189552,7 @@ var init_agentRuntime = __esm({
|
|
|
189326
189552
|
init_mcpProxyTool();
|
|
189327
189553
|
init_mcpAggregator();
|
|
189328
189554
|
init_cardRenderMcpServer();
|
|
189555
|
+
init_cardTools();
|
|
189329
189556
|
init_cardRenderMcpServerProvider();
|
|
189330
189557
|
init_knowledgeMcpServer();
|
|
189331
189558
|
init_noopKnowledgeSearchPort();
|
|
@@ -189587,6 +189814,7 @@ var init_agentRuntime = __esm({
|
|
|
189587
189814
|
await hookDispatcher.dispatch(EHookStage.RUN_STARTED, hookCommonParams);
|
|
189588
189815
|
}
|
|
189589
189816
|
let assistantText = "";
|
|
189817
|
+
const presentationReceipts = [];
|
|
189590
189818
|
let failed = false;
|
|
189591
189819
|
let runError;
|
|
189592
189820
|
let terminalHookDispatched = false;
|
|
@@ -189600,12 +189828,21 @@ var init_agentRuntime = __esm({
|
|
|
189600
189828
|
});
|
|
189601
189829
|
return;
|
|
189602
189830
|
}
|
|
189603
|
-
await hookDispatcher.dispatch(EHookStage.RUN_COMPLETED, hookCommonParams, {
|
|
189831
|
+
await hookDispatcher.dispatch(EHookStage.RUN_COMPLETED, hookCommonParams, {
|
|
189832
|
+
runDurationMs: Date.now() - runStartedAt,
|
|
189833
|
+
...assistantText !== "" && { messageContent: assistantText }
|
|
189834
|
+
});
|
|
189604
189835
|
};
|
|
189605
189836
|
try {
|
|
189606
189837
|
for await (const ev of this.agentLoop.run(agentReq)) {
|
|
189607
189838
|
if (ev.type === "delta")
|
|
189608
189839
|
assistantText += ev.content;
|
|
189840
|
+
if (ev.type === "tool_end" && !ev.isError) {
|
|
189841
|
+
const details = ev.result && typeof ev.result === "object" && "details" in ev.result ? ev.result.details : void 0;
|
|
189842
|
+
if (isAgentPresentationToolResult(details) && details.receipt && !presentationReceipts.some((receipt) => receipt.cardInstanceId === details.receipt?.cardInstanceId)) {
|
|
189843
|
+
presentationReceipts.push(details.receipt);
|
|
189844
|
+
}
|
|
189845
|
+
}
|
|
189609
189846
|
if (ev.type === "error") {
|
|
189610
189847
|
failed = true;
|
|
189611
189848
|
runError = { message: ev.error.message, code: ev.error.code };
|
|
@@ -189614,6 +189851,11 @@ var init_agentRuntime = __esm({
|
|
|
189614
189851
|
if (ev.type === "done" && !failed && sessionId !== void 0) {
|
|
189615
189852
|
const completedTurns = [
|
|
189616
189853
|
...newTurns,
|
|
189854
|
+
...presentationReceipts.map((receipt) => ({
|
|
189855
|
+
role: "tool",
|
|
189856
|
+
name: "a2ui_presentation_receipt",
|
|
189857
|
+
content: { type: "a2ui.presentation-receipt", receipt }
|
|
189858
|
+
})),
|
|
189617
189859
|
{ role: "assistant", content: assistantText }
|
|
189618
189860
|
];
|
|
189619
189861
|
if (this.sessionManager.appendMany) {
|
|
@@ -197452,13 +197694,25 @@ var init_conversationBridge = __esm({
|
|
|
197452
197694
|
|
|
197453
197695
|
// ../linkque-agent-runtime/dist/esm/impl/agui/runConversation.js
|
|
197454
197696
|
function toAgentRunRequest(req) {
|
|
197697
|
+
const lastUserMessageIndex = req.messages.map((message) => message.role).lastIndexOf("user");
|
|
197455
197698
|
return {
|
|
197456
197699
|
threadId: req.threadId,
|
|
197457
197700
|
runId: req.runId,
|
|
197458
|
-
messages: req.messages.map((m2) => ({
|
|
197701
|
+
messages: req.messages.map((m2, index2) => ({
|
|
197459
197702
|
role: m2.role,
|
|
197460
197703
|
content: m2.content,
|
|
197461
|
-
...m2.name !== void 0 && { name: m2.name }
|
|
197704
|
+
...m2.name !== void 0 && { name: m2.name },
|
|
197705
|
+
...index2 === lastUserMessageIndex && req.attachments.length > 0 ? {
|
|
197706
|
+
attachments: req.attachments.map((attachment) => ({
|
|
197707
|
+
id: attachment.id,
|
|
197708
|
+
name: attachment.name,
|
|
197709
|
+
mimeType: attachment.mimeType,
|
|
197710
|
+
...attachment.resourceId !== void 0 && {
|
|
197711
|
+
resourceId: attachment.resourceId
|
|
197712
|
+
},
|
|
197713
|
+
...attachment.url !== void 0 && { url: attachment.url }
|
|
197714
|
+
}))
|
|
197715
|
+
} : {}
|
|
197462
197716
|
})),
|
|
197463
197717
|
clientCapabilities: req.clientCapabilities
|
|
197464
197718
|
};
|
|
@@ -197652,7 +197906,7 @@ var init_examplePlugin = __esm({
|
|
|
197652
197906
|
});
|
|
197653
197907
|
|
|
197654
197908
|
// ../linkque-agent-runtime/dist/esm/impl/plugin/linkquegwEventPlugin.js
|
|
197655
|
-
var LINKQUEGW_EVENT_PLUGIN_NAME, LINKQUEGW_EVENT_HOOK_RESOURCE_ID, LINKQUEGW_RUN_COMPLETED_HOOK_RESOURCE_ID, LINKQUEGW_RUN_FAILED_HOOK_RESOURCE_ID, DEFAULT_LINKQUEGW_EVENT_HOOKS, createLinkquegwEventHookResource, isUserTokenAuthorization, isLinkquegwEventHook, LinkquegwEventPlugin;
|
|
197909
|
+
var LINKQUEGW_EVENT_PLUGIN_NAME, LINKQUEGW_EVENT_HOOK_RESOURCE_ID, LINKQUEGW_RUN_COMPLETED_HOOK_RESOURCE_ID, LINKQUEGW_RUN_FAILED_HOOK_RESOURCE_ID, LINKQUEGW_RUN_READ_HOOK_RESOURCE_ID, DEFAULT_LINKQUEGW_EVENT_HOOKS, createLinkquegwEventHookResource, isUserTokenAuthorization, isLinkquegwEventHook, LinkquegwEventPlugin;
|
|
197656
197910
|
var init_linkquegwEventPlugin = __esm({
|
|
197657
197911
|
"../linkque-agent-runtime/dist/esm/impl/plugin/linkquegwEventPlugin.js"() {
|
|
197658
197912
|
"use strict";
|
|
@@ -197662,6 +197916,7 @@ var init_linkquegwEventPlugin = __esm({
|
|
|
197662
197916
|
LINKQUEGW_EVENT_HOOK_RESOURCE_ID = "linkquegw-event-run-started";
|
|
197663
197917
|
LINKQUEGW_RUN_COMPLETED_HOOK_RESOURCE_ID = "linkquegw-event-run-completed";
|
|
197664
197918
|
LINKQUEGW_RUN_FAILED_HOOK_RESOURCE_ID = "linkquegw-event-run-failed";
|
|
197919
|
+
LINKQUEGW_RUN_READ_HOOK_RESOURCE_ID = "linkquegw-event-run-read";
|
|
197665
197920
|
DEFAULT_LINKQUEGW_EVENT_HOOKS = [
|
|
197666
197921
|
{
|
|
197667
197922
|
resourceId: LINKQUEGW_EVENT_HOOK_RESOURCE_ID,
|
|
@@ -197674,6 +197929,10 @@ var init_linkquegwEventPlugin = __esm({
|
|
|
197674
197929
|
{
|
|
197675
197930
|
resourceId: LINKQUEGW_RUN_FAILED_HOOK_RESOURCE_ID,
|
|
197676
197931
|
stage: EHookStage.RUN_FAILED
|
|
197932
|
+
},
|
|
197933
|
+
{
|
|
197934
|
+
resourceId: LINKQUEGW_RUN_READ_HOOK_RESOURCE_ID,
|
|
197935
|
+
stage: EHookStage.RUN_READ
|
|
197677
197936
|
}
|
|
197678
197937
|
];
|
|
197679
197938
|
createLinkquegwEventHookResource = (resourceId, stage) => ({
|
|
@@ -197715,6 +197974,9 @@ var init_linkquegwEventPlugin = __esm({
|
|
|
197715
197974
|
...options.metricsSink !== void 0 && {
|
|
197716
197975
|
metricsSink: options.metricsSink
|
|
197717
197976
|
},
|
|
197977
|
+
...options.temporaryFrontendAppId !== void 0 && {
|
|
197978
|
+
temporaryFrontendAppId: options.temporaryFrontendAppId
|
|
197979
|
+
},
|
|
197718
197980
|
...options.now !== void 0 && { now: options.now }
|
|
197719
197981
|
};
|
|
197720
197982
|
this.hookExecutorList = [new LinkquegwEventHookExecutor(executorOptions)];
|
|
@@ -197740,6 +198002,7 @@ __export(plugin_exports, {
|
|
|
197740
198002
|
LINKQUEGW_EVENT_PLUGIN_NAME: () => LINKQUEGW_EVENT_PLUGIN_NAME,
|
|
197741
198003
|
LINKQUEGW_RUN_COMPLETED_HOOK_RESOURCE_ID: () => LINKQUEGW_RUN_COMPLETED_HOOK_RESOURCE_ID,
|
|
197742
198004
|
LINKQUEGW_RUN_FAILED_HOOK_RESOURCE_ID: () => LINKQUEGW_RUN_FAILED_HOOK_RESOURCE_ID,
|
|
198005
|
+
LINKQUEGW_RUN_READ_HOOK_RESOURCE_ID: () => LINKQUEGW_RUN_READ_HOOK_RESOURCE_ID,
|
|
197743
198006
|
LinkquegwEventPlugin: () => LinkquegwEventPlugin
|
|
197744
198007
|
});
|
|
197745
198008
|
var init_plugin = __esm({
|
|
@@ -197921,15 +198184,6 @@ var handleSandboxChat = async (req, res, deps, activeRuns2, cancelActiveRun2) =>
|
|
|
197921
198184
|
);
|
|
197922
198185
|
return;
|
|
197923
198186
|
}
|
|
197924
|
-
if (request.attachments.length > 0) {
|
|
197925
|
-
writeJsonError(
|
|
197926
|
-
res,
|
|
197927
|
-
400,
|
|
197928
|
-
"ATTACHMENTS_UNSUPPORTED",
|
|
197929
|
-
"attachments are not supported by agentdev"
|
|
197930
|
-
);
|
|
197931
|
-
return;
|
|
197932
|
-
}
|
|
197933
198187
|
if (request.resumeFrom || req.headers["last-event-id"]) {
|
|
197934
198188
|
writeJsonError(
|
|
197935
198189
|
res,
|
|
@@ -198283,7 +198537,8 @@ var parseHomeDataProxyInput = (value) => {
|
|
|
198283
198537
|
var parseA2UIActionProxyInput = (value) => {
|
|
198284
198538
|
const trustedContext = isRecord6(value) ? value[HOME_DATA_TRUSTED_CONTEXT_FIELD] : void 0;
|
|
198285
198539
|
const userId = isRecord6(trustedContext) && typeof trustedContext.userId === "string" ? trustedContext.userId.trim() : "";
|
|
198286
|
-
if (!isRecord6(value) || !userId)
|
|
198540
|
+
if (!isRecord6(value) || !userId)
|
|
198541
|
+
throw new Error("a2ui action trusted user is invalid");
|
|
198287
198542
|
const request = { ...value };
|
|
198288
198543
|
delete request[HOME_DATA_TRUSTED_CONTEXT_FIELD];
|
|
198289
198544
|
const tenantId = isRecord6(trustedContext) && typeof trustedContext.tenantId === "string" ? trustedContext.tenantId.trim() : void 0;
|