linkque-cli-v2 1.6.12 → 1.6.13
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 +29 -9
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-3J4AB676.js → chunk-A3WEBQGR.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-DPHKD4SK.js → chunk-WO3KBDHU.js} +55 -18
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-EHNI5TX3.js → chunk-YJPCNMFN.js} +8 -8
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +189 -76
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
- package/worker.js +225 -74
package/linkquejs.js
CHANGED
|
@@ -17693,8 +17693,8 @@ function validateClientAction(body, path25, issues) {
|
|
|
17693
17693
|
if (body.name === "ui.page.open" || body.name === "ui.miniprogram.embed") {
|
|
17694
17694
|
if (!isPlainRecord(body.context) || Object.keys(body.context).length !== 1 || typeof body.context.url !== "string" && !isStrictBinding(body.context.url))
|
|
17695
17695
|
issues.push(issue2(`${path25}.context`, "INVALID_CLIENT_ACTION_CONTEXT", `${body.name} requires one literal or bound URL`));
|
|
17696
|
-
else if (typeof body.context.url === "string" && !isSafePageUrl(body.context.url))
|
|
17697
|
-
issues.push(issue2(`${path25}.context.url`, "INVALID_PAGE_URL",
|
|
17696
|
+
else if (typeof body.context.url === "string" && !isSafePageUrl(body.context.url, body.name))
|
|
17697
|
+
issues.push(issue2(`${path25}.context.url`, "INVALID_PAGE_URL", body.name === "ui.miniprogram.embed" ? "ui.miniprogram.embed URL must include appId parameter" : "ui.page.open URL must use https or the approved Alipay scheme"));
|
|
17698
17698
|
return;
|
|
17699
17699
|
}
|
|
17700
17700
|
issues.push(issue2(`${path25}.name`, "UNSUPPORTED_CLIENT_ACTION", `unsupported client action ${String(body.name)}`));
|
|
@@ -17801,8 +17801,17 @@ function rejectUnknownKeys(value, allowed, path25, issues) {
|
|
|
17801
17801
|
issues.push(issue2(`${path25}.${key}`, "UNKNOWN_PROTOCOL_FIELD", `unknown field ${key}`));
|
|
17802
17802
|
});
|
|
17803
17803
|
}
|
|
17804
|
-
function isSafePageUrl(value) {
|
|
17805
|
-
|
|
17804
|
+
function isSafePageUrl(value, actionName) {
|
|
17805
|
+
if (value.length > 2e3)
|
|
17806
|
+
return false;
|
|
17807
|
+
if (actionName === "ui.miniprogram.embed") {
|
|
17808
|
+
try {
|
|
17809
|
+
return Boolean(new URL(value).searchParams.get("appId"));
|
|
17810
|
+
} catch {
|
|
17811
|
+
return false;
|
|
17812
|
+
}
|
|
17813
|
+
}
|
|
17814
|
+
return value.startsWith("https://") || value.startsWith("alipays://");
|
|
17806
17815
|
}
|
|
17807
17816
|
function validateReferences(surfaces, path25, issues) {
|
|
17808
17817
|
for (const [surfaceId, components] of surfaces) {
|
|
@@ -19652,11 +19661,11 @@ function getA2UICardAuthoringDiagnostics(bundle, partial2) {
|
|
|
19652
19661
|
const client = action && isPlainRecord(action.client) ? action.client : void 0;
|
|
19653
19662
|
if (client?.name === "ui.page.open" || client?.name === "ui.miniprogram.embed") {
|
|
19654
19663
|
const context = isPlainRecord(client.context) ? client.context : void 0;
|
|
19655
|
-
if (typeof context?.url === "string" && !isSafePageUrl2(context.url)) {
|
|
19664
|
+
if (typeof context?.url === "string" && !isSafePageUrl2(context.url, typeof client?.name === "string" ? client.name : void 0)) {
|
|
19656
19665
|
diagnostics.push({
|
|
19657
19666
|
code: "UNSAFE_PAGE_URL",
|
|
19658
19667
|
path: `${group.occurrenceId}.action.client.context.url`,
|
|
19659
|
-
message: "\u9875\u9762\u5730\u5740\u5FC5\u987B\u662F\u5B89\u5168\u7684 http(s) \u5730\u5740\u6216\u7AD9\u5185\u7EDD\u5BF9\u8DEF\u5F84",
|
|
19668
|
+
message: client?.name === "ui.miniprogram.embed" ? "\u5C0F\u7A0B\u5E8F\u534A\u5C4F\u6253\u5F00\u5FC5\u987B\u6709 appId \u53C2\u6570" : "\u9875\u9762\u5730\u5740\u5FC5\u987B\u662F\u5B89\u5168\u7684 http(s) \u5730\u5740\u6216\u7AD9\u5185\u7EDD\u5BF9\u8DEF\u5F84",
|
|
19660
19669
|
severity: "hard-error",
|
|
19661
19670
|
occurrenceId: group.occurrenceId
|
|
19662
19671
|
});
|
|
@@ -19682,7 +19691,7 @@ function createA2UICardAuthoringOccurrenceId(surfaceId, componentId) {
|
|
|
19682
19691
|
function createA2UICardAuthoringTargetId(occurrenceId, propertyPath) {
|
|
19683
19692
|
return `${occurrenceId}:${encodeURIComponent(propertyPath)}`;
|
|
19684
19693
|
}
|
|
19685
|
-
function isSafePageUrl2(url2) {
|
|
19694
|
+
function isSafePageUrl2(url2, actionName) {
|
|
19686
19695
|
const trimmed = url2.trim();
|
|
19687
19696
|
if (trimmed.length === 0 || trimmed.length > 2e3)
|
|
19688
19697
|
return false;
|
|
@@ -19701,7 +19710,11 @@ function isSafePageUrl2(url2) {
|
|
|
19701
19710
|
if (candidate.includes("{{") || candidate.includes("}}"))
|
|
19702
19711
|
return false;
|
|
19703
19712
|
try {
|
|
19704
|
-
|
|
19713
|
+
const parsedUrl = new URL(candidate);
|
|
19714
|
+
if (actionName === "ui.miniprogram.embed") {
|
|
19715
|
+
return Boolean(parsedUrl.searchParams.get("appId"));
|
|
19716
|
+
}
|
|
19717
|
+
return ["https:", "alipays:"].includes(parsedUrl.protocol);
|
|
19705
19718
|
} catch {
|
|
19706
19719
|
return false;
|
|
19707
19720
|
}
|
|
@@ -19799,7 +19812,7 @@ function actionTargets(component, occurrenceId) {
|
|
|
19799
19812
|
targetId: createA2UICardAuthoringTargetId(occurrenceId, "action"),
|
|
19800
19813
|
occurrenceId,
|
|
19801
19814
|
propertyPath: "action",
|
|
19802
|
-
label: client.name === "ui.miniprogram.embed" ? "\
|
|
19815
|
+
label: client.name === "ui.miniprogram.embed" ? "\u534A\u5C4F\u6253\u5F00\u5C0F\u7A0B\u5E8F" : "\u6253\u5F00\u9875\u9762",
|
|
19803
19816
|
...typeof url2 === "string" ? { url: url2 } : {},
|
|
19804
19817
|
dynamic: isPlainRecord(url2) && typeof url2.path === "string"
|
|
19805
19818
|
}
|
|
@@ -27568,6 +27581,7 @@ var OAUTH_ERRORS = {
|
|
|
27568
27581
|
|
|
27569
27582
|
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/argsMapper.js
|
|
27570
27583
|
var USER_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u7528\u6237\u6807\u8BC6");
|
|
27584
|
+
var APP_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u5C0F\u7A0B\u5E8F\u6807\u8BC6");
|
|
27571
27585
|
|
|
27572
27586
|
// ../linkque-agent-runtime/dist/esm/impl/knowledge/linkqueKnowledgeSearchPort.js
|
|
27573
27587
|
var DEFAULT_LINKQUEGW_KNOWLEDGE_BASE_URL = RUNTIME_CONFIG_DEFAULTS.LINKQUEGW_KNOWLEDGE_BASE_URL;
|
|
@@ -40673,6 +40687,12 @@ function parseDetail(value, mounted) {
|
|
|
40673
40687
|
...typeof readOnlyHint === "boolean" ? { annotations: { readOnlyHint } } : {}
|
|
40674
40688
|
};
|
|
40675
40689
|
});
|
|
40690
|
+
if (mounted.allowedTools?.some((name) => !names.has(name))) {
|
|
40691
|
+
throw new LinkqueCliError(
|
|
40692
|
+
"MCP_DETAIL_CONFIG_STALE",
|
|
40693
|
+
"\u5DF2\u914D\u7F6E\u7684\u5DE5\u5177\u8C03\u7528\u540D\u4E0E Mng \u8FD4\u56DE\u7684\u5DE5\u5177\u8BE6\u60C5\u4E0D\u5339\u914D\uFF0C\u8BF7\u5E73\u53F0\u68C0\u67E5 toolEnName \u6620\u5C04\u53CA\u6302\u8F7D\u914D\u7F6E"
|
|
40694
|
+
);
|
|
40695
|
+
}
|
|
40676
40696
|
return {
|
|
40677
40697
|
schemaVersion: "3",
|
|
40678
40698
|
abilityCode: mounted.abilityCode,
|
package/package.json
CHANGED
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-DPHKD4SK.js → chunk-WO3KBDHU.js}
RENAMED
|
@@ -24275,8 +24275,8 @@ function validateClientAction(body, path2, issues) {
|
|
|
24275
24275
|
if (body.name === "ui.page.open" || body.name === "ui.miniprogram.embed") {
|
|
24276
24276
|
if (!isPlainRecord(body.context) || Object.keys(body.context).length !== 1 || typeof body.context.url !== "string" && !isStrictBinding(body.context.url))
|
|
24277
24277
|
issues.push(issue2(`${path2}.context`, "INVALID_CLIENT_ACTION_CONTEXT", `${body.name} requires one literal or bound URL`));
|
|
24278
|
-
else if (typeof body.context.url === "string" && !isSafePageUrl(body.context.url))
|
|
24279
|
-
issues.push(issue2(`${path2}.context.url`, "INVALID_PAGE_URL",
|
|
24278
|
+
else if (typeof body.context.url === "string" && !isSafePageUrl(body.context.url, body.name))
|
|
24279
|
+
issues.push(issue2(`${path2}.context.url`, "INVALID_PAGE_URL", body.name === "ui.miniprogram.embed" ? "ui.miniprogram.embed URL must include appId parameter" : "ui.page.open URL must use https or the approved Alipay scheme"));
|
|
24280
24280
|
return;
|
|
24281
24281
|
}
|
|
24282
24282
|
issues.push(issue2(`${path2}.name`, "UNSUPPORTED_CLIENT_ACTION", `unsupported client action ${String(body.name)}`));
|
|
@@ -24383,8 +24383,17 @@ function rejectUnknownKeys(value, allowed, path2, issues) {
|
|
|
24383
24383
|
issues.push(issue2(`${path2}.${key}`, "UNKNOWN_PROTOCOL_FIELD", `unknown field ${key}`));
|
|
24384
24384
|
});
|
|
24385
24385
|
}
|
|
24386
|
-
function isSafePageUrl(value) {
|
|
24387
|
-
|
|
24386
|
+
function isSafePageUrl(value, actionName) {
|
|
24387
|
+
if (value.length > 2e3)
|
|
24388
|
+
return false;
|
|
24389
|
+
if (actionName === "ui.miniprogram.embed") {
|
|
24390
|
+
try {
|
|
24391
|
+
return Boolean(new URL(value).searchParams.get("appId"));
|
|
24392
|
+
} catch {
|
|
24393
|
+
return false;
|
|
24394
|
+
}
|
|
24395
|
+
}
|
|
24396
|
+
return value.startsWith("https://") || value.startsWith("alipays://");
|
|
24388
24397
|
}
|
|
24389
24398
|
function validateReferences(surfaces, path2, issues) {
|
|
24390
24399
|
for (const [surfaceId, components] of surfaces) {
|
|
@@ -25974,13 +25983,27 @@ function collectA2UISurfaceIdsForLegacyContract(protocol) {
|
|
|
25974
25983
|
}
|
|
25975
25984
|
return [...surfaceIds];
|
|
25976
25985
|
}
|
|
25986
|
+
var CARD_SEQUENCE = "\u540C\u4E00\u65F6\u95F4\u53EA\u80FD\u5236\u4F5C\u4E00\u5F20\u5361\u7247\uFF1A\u5148\u5B8C\u6210\u5F53\u524D\u5361\u7247\u7684\u9009\u62E9 \u2192 \u6570\u636E\u6E90\u8C03\u7528 \u2192 \u5C55\u793A\uFF0C\u518D\u9009\u62E9\u4E0B\u4E00\u5F20\u5361\u7247\u3002\u4E0D\u8981\u4EA4\u53C9\u8C03\u7528\u4E0D\u540C\u672A\u5B8C\u6210\u5361\u7247\u7684\u5DE5\u5177\u3002";
|
|
25987
|
+
function bindingSequence(hasSources) {
|
|
25988
|
+
return hasSources ? `\u5148\u9009\u62E9\u6B64\u5361\u7247\uFF0C\u518D\u6309\u4F9D\u8D56\u8C03\u7528\u5B83\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\uFF0C\u6240\u6709\u5FC5\u9700\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\u6210\u529F\u540E\uFF0C\u6700\u540E\u8C03\u7528 card_finish\u3002${CARD_SEQUENCE}` : "\u5148\u9009\u62E9\u6B64\u5361\u7247\uFF0C\u518D\u8C03\u7528\u5B83\u7684 card_finish \u5C55\u793A\u5DE5\u5177\uFF1B\u6B64\u5361\u7247\u6CA1\u6709\u6570\u636E\u6E90\uFF0C\u4E0D\u9700\u8981\u8C03\u7528 card_source \u6216\u8BFB\u53D6\u7F13\u5B58\u3002";
|
|
25989
|
+
}
|
|
25990
|
+
function cacheGuidance(hasSources) {
|
|
25991
|
+
return hasSources ? "\u82E5\u8FD4\u56DE card_skipped\uFF0C\u4EC5\u4F7F\u7528\u672C\u5361\u7247\u6570\u636E\u6E90\u56DE\u6267\u4E2D\u771F\u5B9E\u7684 resultRef \u8BFB\u53D6\u7F13\u5B58\u5E76\u56DE\u7B54\uFF1B\u6CA1\u6709\u6709\u6548\u5F15\u7528\u65F6\u4E0D\u8981\u8C03\u7528\u8BFB\u53D6\u5DE5\u5177\uFF0C\u4E0D\u8981\u91CD\u8C03\u4E1A\u52A1 MCP\u3002" : "\u82E5\u672A\u5C55\u793A\u5361\u7247\uFF0C\u4F9D\u636E\u5DF2\u6709\u4FE1\u606F\u56DE\u7B54\uFF0C\u4E0D\u8981\u7F16\u9020 resultRef \u6216\u8BFB\u53D6\u5176\u4ED6\u5361\u7247\u7684\u7F13\u5B58\u3002";
|
|
25992
|
+
}
|
|
25977
25993
|
function createPresentationDescription(config) {
|
|
25978
|
-
|
|
25994
|
+
const description = [
|
|
25979
25995
|
config.description,
|
|
25980
25996
|
`\u9002\u7528\u573A\u666F\uFF1A${config.whenToUse}`,
|
|
25981
25997
|
...config.whenNotToUse ? [`\u4E0D\u9002\u7528\u573A\u666F\uFF1A${config.whenNotToUse}`] : [],
|
|
25982
25998
|
"\u53EA\u63D0\u4F9B\u5DF2\u58F0\u660E\u7684\u6807\u8BC6\u6216\u7B5B\u9009\u53C2\u6570\u3002\u6743\u5A01\u4E1A\u52A1\u6570\u636E\u7531\u5E73\u53F0\u89E3\u6790\u83B7\u53D6\u3002"
|
|
25983
|
-
]
|
|
25999
|
+
];
|
|
26000
|
+
if (config.schemaVersion === "4" && config.dataMode === "pipeline") {
|
|
26001
|
+
description.push("\u8C03\u7528\u540E\u4F1A\u4E00\u6B21\u6027\u6821\u9A8C\u53C2\u6570\u3001\u5E76\u884C\u83B7\u53D6\u5168\u90E8\u6570\u636E\u5E76\u751F\u6210\u5361\u7247\uFF1B\u4E0D\u9700\u8981\u518D\u8C03\u7528 card_source \u6216 card_finish\u3002\u6210\u529F\u540E\u6839\u636E\u5C55\u793A\u56DE\u6267\u56DE\u7B54\uFF1B\u672A\u5C55\u793A\u65F6\u4F9D\u636E\u5DF2\u6709\u4FE1\u606F\u56DE\u7B54\uFF0C\u4E0D\u8981\u7F16\u9020 resultRef \u6216\u8C03\u7528\u5176\u4ED6\u5361\u7247\u7684\u8BFB\u53D6\u5DE5\u5177\u3002");
|
|
26002
|
+
} else if (config.schemaVersion === "3" || config.schemaVersion === "4") {
|
|
26003
|
+
const hasSources = (config.dataSources?.length ?? 0) > 0;
|
|
26004
|
+
description.push(`${bindingSequence(hasSources)} ${cacheGuidance(hasSources)}`);
|
|
26005
|
+
}
|
|
26006
|
+
return description.join("\n");
|
|
25984
26007
|
}
|
|
25985
26008
|
function cloneJsonObject2(value, label) {
|
|
25986
26009
|
if (!isJsonObject(value))
|
|
@@ -29143,15 +29166,13 @@ var LINKQUEGW_EVENT_TYPE_BY_STAGE = {
|
|
|
29143
29166
|
function truncateMessageContent(messageContent) {
|
|
29144
29167
|
return Array.from(messageContent).slice(0, LINKQUEGW_MESSAGE_CONTENT_MAX_LENGTH).join("");
|
|
29145
29168
|
}
|
|
29146
|
-
function buildLinkquegwEventBody(context2,
|
|
29169
|
+
function buildLinkquegwEventBody(context2, frontendAppId) {
|
|
29147
29170
|
const eventType = LINKQUEGW_EVENT_TYPE_BY_STAGE[context2.stage];
|
|
29148
29171
|
if (eventType === void 0)
|
|
29149
29172
|
return void 0;
|
|
29150
29173
|
const { commonParams } = context2;
|
|
29151
29174
|
const payload = {
|
|
29152
|
-
...
|
|
29153
|
-
appId: temporaryFrontendAppId
|
|
29154
|
-
},
|
|
29175
|
+
...frontendAppId !== void 0 && { appId: frontendAppId },
|
|
29155
29176
|
...context2.stage === EHookStage.RUN_COMPLETED && context2.run.messageContent !== void 0 && {
|
|
29156
29177
|
messageContent: truncateMessageContent(context2.run.messageContent)
|
|
29157
29178
|
}
|
|
@@ -29183,7 +29204,7 @@ var LinkquegwEventHookExecutor = class {
|
|
|
29183
29204
|
getAuthHeaders;
|
|
29184
29205
|
fetchImpl;
|
|
29185
29206
|
metricsSink;
|
|
29186
|
-
|
|
29207
|
+
frontendAppId;
|
|
29187
29208
|
now;
|
|
29188
29209
|
constructor(options) {
|
|
29189
29210
|
this.baseUrl = options.baseUrl ?? DEFAULT_LINKQUEGW_EVENT_BASE_URL;
|
|
@@ -29191,7 +29212,7 @@ var LinkquegwEventHookExecutor = class {
|
|
|
29191
29212
|
const baseFetch = options.fetchImpl ?? globalThis.fetch;
|
|
29192
29213
|
this.fetchImpl = options.debugLog ? createHttpLoggingFetch(options.debugLog, "hook-linkque", baseFetch) : baseFetch;
|
|
29193
29214
|
this.metricsSink = options.metricsSink;
|
|
29194
|
-
this.
|
|
29215
|
+
this.frontendAppId = options.frontendAppId ?? options.temporaryFrontendAppId;
|
|
29195
29216
|
this.now = options.now ?? Date.now;
|
|
29196
29217
|
}
|
|
29197
29218
|
async execute(resource, context2, options) {
|
|
@@ -29203,7 +29224,7 @@ var LinkquegwEventHookExecutor = class {
|
|
|
29203
29224
|
message: `hook \u671F\u671B executor=${resource.config.executorName} provider=${resource.providerType},\u975E LinkquegwEventHookExecutor \u6D88\u8D39\u8303\u56F4`
|
|
29204
29225
|
};
|
|
29205
29226
|
}
|
|
29206
|
-
const body = buildLinkquegwEventBody(context2, this.
|
|
29227
|
+
const body = buildLinkquegwEventBody(context2, this.frontendAppId);
|
|
29207
29228
|
if (body === void 0) {
|
|
29208
29229
|
return {
|
|
29209
29230
|
ok: true,
|
|
@@ -40323,6 +40344,7 @@ function createStreamableHttpTransport(config, signer, onTraceId, debugLog, getC
|
|
|
40323
40344
|
|
|
40324
40345
|
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/argsMapper.js
|
|
40325
40346
|
var USER_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u7528\u6237\u6807\u8BC6");
|
|
40347
|
+
var APP_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u5C0F\u7A0B\u5E8F\u6807\u8BC6");
|
|
40326
40348
|
function assertSafePath(segments) {
|
|
40327
40349
|
if (segments.some((s) => ["__proto__", "constructor", "prototype"].includes(String(s)))) {
|
|
40328
40350
|
throw new McpInvocationError("MCP_SYSTEM_VARIABLE_INVALID", "\u6620\u5C04\u8DEF\u5F84\u7981\u6B62\u8BBF\u95EE\u539F\u578B");
|
|
@@ -40419,10 +40441,10 @@ function createArgsMappingPlan(toolName, args, rules) {
|
|
|
40419
40441
|
continue;
|
|
40420
40442
|
}
|
|
40421
40443
|
if (rule.valueType === EArgsMappingValueType.SYSTEM_VARIABLE) {
|
|
40422
|
-
if (rule.value
|
|
40444
|
+
if (!["${userId}", "${appId}"].includes(rule.value ?? "") || segments.length === 0) {
|
|
40423
40445
|
throw new McpInvocationError("MCP_SYSTEM_VARIABLE_INVALID", "\u7CFB\u7EDF\u53D8\u91CF\u914D\u7F6E\u65E0\u6548");
|
|
40424
40446
|
}
|
|
40425
|
-
setByPath(out, segments, USER_ID);
|
|
40447
|
+
setByPath(out, segments, rule.value === "${userId}" ? USER_ID : APP_ID);
|
|
40426
40448
|
continue;
|
|
40427
40449
|
}
|
|
40428
40450
|
if (rule.valueType === EArgsMappingValueType.CONST) {
|
|
@@ -40436,17 +40458,24 @@ function createArgsMappingPlan(toolName, args, rules) {
|
|
|
40436
40458
|
continue;
|
|
40437
40459
|
}
|
|
40438
40460
|
}
|
|
40439
|
-
const contains = (value) => value ===
|
|
40440
|
-
const requiresUserId = contains(out);
|
|
40461
|
+
const contains = (value, marker) => value === marker || value !== null && typeof value === "object" && Object.values(value).some((item) => contains(item, marker));
|
|
40462
|
+
const requiresUserId = contains(out, USER_ID);
|
|
40463
|
+
const requiresAppId = contains(out, APP_ID);
|
|
40441
40464
|
return {
|
|
40442
40465
|
requiresUserId,
|
|
40466
|
+
requiresAppId,
|
|
40443
40467
|
resolve(identity) {
|
|
40444
40468
|
if (requiresUserId && !identity?.userId?.trim()) {
|
|
40445
40469
|
throw new McpInvocationError("MCP_USER_AUTH_REQUIRED", "\u7CFB\u7EDF\u53D8\u91CF\u9700\u8981\u53EF\u4FE1\u7528\u6237\u8EAB\u4EFD");
|
|
40446
40470
|
}
|
|
40471
|
+
if (requiresAppId && !identity?.appId?.trim()) {
|
|
40472
|
+
throw new McpInvocationError("MCP_APP_ID_UNAVAILABLE", "\u5F53\u524D\u73AF\u5883\u65E0\u6CD5\u83B7\u53D6\u5C0F\u7A0B\u5E8F AppId");
|
|
40473
|
+
}
|
|
40447
40474
|
const visit = (value) => {
|
|
40448
40475
|
if (value === USER_ID)
|
|
40449
40476
|
return identity.userId;
|
|
40477
|
+
if (value === APP_ID)
|
|
40478
|
+
return identity.appId;
|
|
40450
40479
|
if (Array.isArray(value))
|
|
40451
40480
|
return value.map(visit);
|
|
40452
40481
|
if (value !== null && typeof value === "object") {
|
|
@@ -40524,6 +40553,7 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
40524
40553
|
invocationContext = new McpInvocationContext();
|
|
40525
40554
|
createTokenVerifier;
|
|
40526
40555
|
resolveConfig;
|
|
40556
|
+
clientContext;
|
|
40527
40557
|
getAuthorizationHeader;
|
|
40528
40558
|
createSigner;
|
|
40529
40559
|
createClient;
|
|
@@ -40531,6 +40561,7 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
40531
40561
|
debugLog;
|
|
40532
40562
|
constructor(options) {
|
|
40533
40563
|
this.resolveConfig = options.resolveConfig;
|
|
40564
|
+
this.clientContext = { ...options.clientContext };
|
|
40534
40565
|
this.createTokenVerifier = options.createTokenVerifier;
|
|
40535
40566
|
this.getAuthorizationHeader = options.getAuthorizationHeader;
|
|
40536
40567
|
this.createSigner = options.createSigner;
|
|
@@ -40638,7 +40669,10 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
40638
40669
|
agentId: identity.agentId
|
|
40639
40670
|
};
|
|
40640
40671
|
}
|
|
40641
|
-
const mapped = resolveArgsMappingPlan(plan,
|
|
40672
|
+
const mapped = resolveArgsMappingPlan(plan, {
|
|
40673
|
+
...invocation.auth,
|
|
40674
|
+
appId: this.clientContext.appId
|
|
40675
|
+
});
|
|
40642
40676
|
recordMcpContentSection(innerObservation, ETelemetryContentSection.MCP_INPUT, mapped, options?.toolSchema?.inputSchema);
|
|
40643
40677
|
invocation.signal.throwIfAborted();
|
|
40644
40678
|
const remaining = Math.max(1, invocation.deadline - performance.now());
|
|
@@ -43126,6 +43160,9 @@ export {
|
|
|
43126
43160
|
parseCardConfig,
|
|
43127
43161
|
isAgentPresentationToolResult,
|
|
43128
43162
|
isAgentPresentationSkippedToolResult,
|
|
43163
|
+
CARD_SEQUENCE,
|
|
43164
|
+
bindingSequence,
|
|
43165
|
+
cacheGuidance,
|
|
43129
43166
|
createPresentationDescription,
|
|
43130
43167
|
readStructuredContent,
|
|
43131
43168
|
normalizeMcpInputSchema,
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-EHNI5TX3.js → chunk-YJPCNMFN.js}
RENAMED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
RUNTIME_CONFIG_DEFAULTS,
|
|
23
23
|
RuntimeConfigProvider,
|
|
24
24
|
isDebugLoggingEnabled
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-WO3KBDHU.js";
|
|
26
26
|
import {
|
|
27
27
|
__commonJS,
|
|
28
28
|
__require,
|
|
@@ -15664,7 +15664,7 @@ var TRIGGER_HEADER = "x-appwrite-trigger";
|
|
|
15664
15664
|
var ENV_SELECTOR_HEADER = "x-linkque-env";
|
|
15665
15665
|
var TRACE_ID_HEADER = "x-trace-id";
|
|
15666
15666
|
var OTEL_TRACE_ID_HEADER = "x-linkque-otel-trace-id";
|
|
15667
|
-
var
|
|
15667
|
+
var FRONTEND_APP_ID_HEADER = "x-linkque-alipay-app-id";
|
|
15668
15668
|
var ALIPAY_AUTH_CODE_HEADER = "x-alipay-authcode";
|
|
15669
15669
|
var AUTH_UNAVAILABLE_HEADER = "x-linkque-phone-auth-unavailable";
|
|
15670
15670
|
function readMcpPhoneAuthorization(headers) {
|
|
@@ -15765,20 +15765,20 @@ function readOtelTraceId(headers) {
|
|
|
15765
15765
|
const traceId = raw.toLowerCase();
|
|
15766
15766
|
return /^[0-9a-f]{32}$/u.test(traceId) && traceId !== "00000000000000000000000000000000" ? { kind: "valid", traceId } : { kind: "invalid" };
|
|
15767
15767
|
}
|
|
15768
|
-
function
|
|
15768
|
+
function readFrontendAppId(headers) {
|
|
15769
15769
|
if (!headers)
|
|
15770
15770
|
return void 0;
|
|
15771
|
-
const direct =
|
|
15771
|
+
const direct = normalizeFrontendAppId(headers[FRONTEND_APP_ID_HEADER]);
|
|
15772
15772
|
if (direct)
|
|
15773
15773
|
return direct;
|
|
15774
15774
|
for (const [key, value] of Object.entries(headers)) {
|
|
15775
|
-
if (key.toLowerCase() ===
|
|
15776
|
-
return
|
|
15775
|
+
if (key.toLowerCase() === FRONTEND_APP_ID_HEADER) {
|
|
15776
|
+
return normalizeFrontendAppId(value);
|
|
15777
15777
|
}
|
|
15778
15778
|
}
|
|
15779
15779
|
return void 0;
|
|
15780
15780
|
}
|
|
15781
|
-
function
|
|
15781
|
+
function normalizeFrontendAppId(value) {
|
|
15782
15782
|
const normalized = headValue(value);
|
|
15783
15783
|
return normalized && !/[\r\n]/u.test(normalized) ? normalized : void 0;
|
|
15784
15784
|
}
|
|
@@ -15940,7 +15940,7 @@ export {
|
|
|
15940
15940
|
readEnvSelector,
|
|
15941
15941
|
readTraceId,
|
|
15942
15942
|
readOtelTraceId,
|
|
15943
|
-
|
|
15943
|
+
readFrontendAppId,
|
|
15944
15944
|
readAuthenticatedUserId,
|
|
15945
15945
|
readAppwriteApiKey,
|
|
15946
15946
|
createClientCapabilityStore,
|