linkque-cli-v2 1.6.0 → 1.6.2
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 +69 -2
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-3WYLH7P7.js → chunk-2CFN5G5A.js} +50 -2
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-TSJX2OMA.js → chunk-2HV35GH7.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-GPVKBHKR.js → chunk-SDEXPSW4.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +142 -13
- 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 +205 -13
package/linkquejs.js
CHANGED
|
@@ -20467,6 +20467,7 @@ var EHookExecutorName;
|
|
|
20467
20467
|
EHookExecutorName2["SecurityAnswerHookExecutor"] = "SecurityAnswerHookExecutor";
|
|
20468
20468
|
EHookExecutorName2["ImageUnderstandingHookExecutor"] = "ImageUnderstandingHookExecutor";
|
|
20469
20469
|
EHookExecutorName2["McpDiscoveryHookExecutor"] = "McpDiscoveryHookExecutor";
|
|
20470
|
+
EHookExecutorName2["CurrentTimeHookExecutor"] = "CurrentTimeHookExecutor";
|
|
20470
20471
|
})(EHookExecutorName || (EHookExecutorName = {}));
|
|
20471
20472
|
|
|
20472
20473
|
// ../agent-a2ui-card-contract/dist/esm/protocol.js
|
|
@@ -22447,6 +22448,34 @@ function hasInteractiveDescendant(id, components, visited) {
|
|
|
22447
22448
|
return refs.some((ref) => typeof ref === "string" && hasInteractiveDescendant(ref, components, visited));
|
|
22448
22449
|
}
|
|
22449
22450
|
|
|
22451
|
+
// ../agent-a2ui-card-contract/dist/esm/pipeline-input.js
|
|
22452
|
+
function createA2UICardPipelineModelInputSchema(sources) {
|
|
22453
|
+
const properties = {};
|
|
22454
|
+
const required2 = [];
|
|
22455
|
+
sources.forEach((source, index) => {
|
|
22456
|
+
const name = `input${index}`;
|
|
22457
|
+
properties[name] = {
|
|
22458
|
+
...scopeLocalReferences(source.inputSchema, `#/properties/${name}`),
|
|
22459
|
+
description: `\u7B2C ${index} \u4E2A\u6570\u636E\u6E90 ${source.toolName} \u7684 MCP \u8C03\u7528\u53C2\u6570\u3002${source.purpose}`
|
|
22460
|
+
};
|
|
22461
|
+
required2.push(name);
|
|
22462
|
+
});
|
|
22463
|
+
return { type: "object", properties, required: required2, additionalProperties: false };
|
|
22464
|
+
}
|
|
22465
|
+
function scopeLocalReferences(schema, root) {
|
|
22466
|
+
const visit = (value) => {
|
|
22467
|
+
if (Array.isArray(value))
|
|
22468
|
+
return value.map(visit);
|
|
22469
|
+
if (value === null || typeof value !== "object")
|
|
22470
|
+
return value;
|
|
22471
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
22472
|
+
key,
|
|
22473
|
+
key === "$ref" && typeof entry === "string" && (entry === "#" || entry.startsWith("#/")) ? `${root}${entry.slice(1)}` : visit(entry)
|
|
22474
|
+
]));
|
|
22475
|
+
};
|
|
22476
|
+
return visit(schema);
|
|
22477
|
+
}
|
|
22478
|
+
|
|
22450
22479
|
// ../agent-a2ui-card-contract/dist/esm/validation.js
|
|
22451
22480
|
var FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
22452
22481
|
"array",
|
|
@@ -22661,6 +22690,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
22661
22690
|
exactKeys(value, [
|
|
22662
22691
|
"schemaVersion",
|
|
22663
22692
|
"dataMode",
|
|
22693
|
+
"argumentMode",
|
|
22664
22694
|
"revision",
|
|
22665
22695
|
"displayName",
|
|
22666
22696
|
"description",
|
|
@@ -22676,6 +22706,9 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
22676
22706
|
if (value.schemaVersion !== "4" || value.dataMode !== "pipeline") {
|
|
22677
22707
|
issues.push(issue2("config.dataMode", "INVALID_DATA_MODE", "pipeline cards require schemaVersion 4 and dataMode pipeline"));
|
|
22678
22708
|
}
|
|
22709
|
+
if (value.argumentMode !== void 0 && value.argumentMode !== "model") {
|
|
22710
|
+
issues.push(issue2("config.argumentMode", "INVALID_ARGUMENT_MODE", "argumentMode must be model"));
|
|
22711
|
+
}
|
|
22679
22712
|
if (!isSafeIdentifier(value.revision)) {
|
|
22680
22713
|
issues.push(issue2("config.revision", "INVALID_CARD_REVISION", "revision must be a stable safe identifier"));
|
|
22681
22714
|
}
|
|
@@ -22685,7 +22718,10 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
22685
22718
|
optionalString(value.whenNotToUse, "config.whenNotToUse", issues);
|
|
22686
22719
|
validateLooseJsonSchema(value.presentationInputSchema, "config.presentationInputSchema", issues);
|
|
22687
22720
|
const fields = validateFields(value.fields, "config.fields", issues);
|
|
22688
|
-
validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
|
|
22721
|
+
const pipelineSources = validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
|
|
22722
|
+
if (value.argumentMode === "model" && pipelineSources) {
|
|
22723
|
+
validateModelPipelineArguments(value, pipelineSources, "config", issues);
|
|
22724
|
+
}
|
|
22689
22725
|
validateDataTransform(value.dataTransform, "config.dataTransform", issues);
|
|
22690
22726
|
const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, "config.dataModelSchema", issues);
|
|
22691
22727
|
const card = validateTemplate(value.a2uiTemplate, fields, issues);
|
|
@@ -22811,6 +22847,17 @@ function validateDataSources(value, path24, issues, options = {}) {
|
|
|
22811
22847
|
}
|
|
22812
22848
|
return value;
|
|
22813
22849
|
}
|
|
22850
|
+
function validateModelPipelineArguments(value, sources, path24, issues) {
|
|
22851
|
+
sources.forEach((source, index) => {
|
|
22852
|
+
if (isPlainRecord(source.fixedInput) && Object.keys(source.fixedInput).length || Array.isArray(source.inputBindings) && source.inputBindings.length) {
|
|
22853
|
+
issues.push(issue2(`${path24}.dataSources[${index}]`, "MODEL_ARGUMENTS_CONFLICT", "model arguments cannot be combined with fixedInput or inputBindings"));
|
|
22854
|
+
}
|
|
22855
|
+
});
|
|
22856
|
+
const expected = createA2UICardPipelineModelInputSchema(sources);
|
|
22857
|
+
if (isJsonValue(value.presentationInputSchema) && stableJsonStringify(value.presentationInputSchema) !== stableJsonStringify(expected)) {
|
|
22858
|
+
issues.push(issue2(`${path24}.presentationInputSchema`, "MODEL_ARGUMENT_SCHEMA_MISMATCH", "presentationInputSchema must match the configured MCP input schemas"));
|
|
22859
|
+
}
|
|
22860
|
+
}
|
|
22814
22861
|
function validatePipelineDataSources(value, path24, issues) {
|
|
22815
22862
|
if (!Array.isArray(value) || value.length === 0) {
|
|
22816
22863
|
issues.push(issue2(path24, "INVALID_DATA_SOURCES", "pipeline dataSources must be a non-empty array"));
|
|
@@ -23017,6 +23064,7 @@ function validateManifest(value, path24, issues) {
|
|
|
23017
23064
|
exactKeys(value, [
|
|
23018
23065
|
"schemaVersion",
|
|
23019
23066
|
"dataMode",
|
|
23067
|
+
"argumentMode",
|
|
23020
23068
|
"draftId",
|
|
23021
23069
|
"resourceId",
|
|
23022
23070
|
"baseRevision",
|
|
@@ -23033,6 +23081,9 @@ function validateManifest(value, path24, issues) {
|
|
|
23033
23081
|
if (!isSafeIdentifier(value.draftId)) {
|
|
23034
23082
|
issues.push(issue2(`${path24}.draftId`, "INVALID_DRAFT_ID", "draftId is invalid"));
|
|
23035
23083
|
}
|
|
23084
|
+
if (value.argumentMode !== void 0 && value.argumentMode !== "model") {
|
|
23085
|
+
issues.push(issue2(`${path24}.argumentMode`, "INVALID_ARGUMENT_MODE", "argumentMode must be model"));
|
|
23086
|
+
}
|
|
23036
23087
|
if (!isSafeIdentifier(value.resourceId)) {
|
|
23037
23088
|
issues.push(issue2(`${path24}.resourceId`, "INVALID_RESOURCE_ID", "resourceId is invalid"));
|
|
23038
23089
|
}
|
|
@@ -23043,7 +23094,10 @@ function validateManifest(value, path24, issues) {
|
|
|
23043
23094
|
optionalString(value.whenNotToUse, `${path24}.whenNotToUse`, issues);
|
|
23044
23095
|
validateLooseJsonSchema(value.presentationInputSchema, `${path24}.presentationInputSchema`, issues);
|
|
23045
23096
|
const fields2 = validateFields(value.fields, `${path24}.fields`, issues);
|
|
23046
|
-
validatePipelineDataSources(value.dataSources, `${path24}.dataSources`, issues);
|
|
23097
|
+
const pipelineSources = validatePipelineDataSources(value.dataSources, `${path24}.dataSources`, issues);
|
|
23098
|
+
if (value.argumentMode === "model" && pipelineSources) {
|
|
23099
|
+
validateModelPipelineArguments(value, pipelineSources, path24, issues);
|
|
23100
|
+
}
|
|
23047
23101
|
validateDataTransform(value.dataTransform, `${path24}.dataTransform`, issues);
|
|
23048
23102
|
const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, `${path24}.dataModelSchema`, issues);
|
|
23049
23103
|
if (fields2 && dataModelSchema) {
|
|
@@ -23600,6 +23654,7 @@ function compilePipelineResource(draft, revision) {
|
|
|
23600
23654
|
const resource = {
|
|
23601
23655
|
schemaVersion: "4",
|
|
23602
23656
|
dataMode: "pipeline",
|
|
23657
|
+
...draft.manifest.argumentMode ? { argumentMode: draft.manifest.argumentMode } : {},
|
|
23603
23658
|
revision,
|
|
23604
23659
|
displayName: draft.manifest.displayName,
|
|
23605
23660
|
description: draft.manifest.description,
|
|
@@ -41482,6 +41537,12 @@ async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum) {
|
|
|
41482
41537
|
"\u5F53\u524D Agent Runtime \u4E0D\u652F\u6301\u670D\u52A1\u7AEF\u6570\u636E\u8F6C\u6362 pipeline\uFF0C\u8BF7\u5148\u5347\u7EA7 Runtime"
|
|
41483
41538
|
);
|
|
41484
41539
|
}
|
|
41540
|
+
if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline" && bundle.manifest.argumentMode === "model" && !await readRuntimeSupportsModelFilledPipelineArguments(cwd)) {
|
|
41541
|
+
throw new LinkqueCliError(
|
|
41542
|
+
"CARD_RUNTIME_SCHEMA_UNSUPPORTED",
|
|
41543
|
+
"\u5F53\u524D Agent Runtime \u4E0D\u652F\u6301\u6A21\u578B\u586B\u5199\u591A MCP \u53C2\u6570\uFF0C\u8BF7\u5148\u5347\u7EA7 Runtime"
|
|
41544
|
+
);
|
|
41545
|
+
}
|
|
41485
41546
|
if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline") {
|
|
41486
41547
|
const executor = new DataTransformExecutor();
|
|
41487
41548
|
try {
|
|
@@ -41838,6 +41899,12 @@ async function readRuntimeSupportsDataPipeline(cwd) {
|
|
|
41838
41899
|
).catch(() => void 0);
|
|
41839
41900
|
return isJsonObject(value) && value.schemaVersion === 1 && isJsonObject(value.a2uiCard) && value.a2uiCard.serverDataPipeline === true;
|
|
41840
41901
|
}
|
|
41902
|
+
async function readRuntimeSupportsModelFilledPipelineArguments(cwd) {
|
|
41903
|
+
const value = await readOptionalJson(
|
|
41904
|
+
import_path22.default.join(cwd, RUNTIME_CAPABILITIES_PATH)
|
|
41905
|
+
).catch(() => void 0);
|
|
41906
|
+
return isJsonObject(value) && value.schemaVersion === 1 && isJsonObject(value.a2uiCard) && value.a2uiCard.serverDataPipeline === true && value.a2uiCard.modelFilledPipelineArguments === true;
|
|
41907
|
+
}
|
|
41841
41908
|
function containsFunctionAction(value) {
|
|
41842
41909
|
if (Array.isArray(value)) return value.some(containsFunctionAction);
|
|
41843
41910
|
if (!isJsonObject(value)) return false;
|
package/package.json
CHANGED
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-3WYLH7P7.js → chunk-2CFN5G5A.js}
RENAMED
|
@@ -22684,6 +22684,7 @@ var EHookExecutorName;
|
|
|
22684
22684
|
EHookExecutorName2["SecurityAnswerHookExecutor"] = "SecurityAnswerHookExecutor";
|
|
22685
22685
|
EHookExecutorName2["ImageUnderstandingHookExecutor"] = "ImageUnderstandingHookExecutor";
|
|
22686
22686
|
EHookExecutorName2["McpDiscoveryHookExecutor"] = "McpDiscoveryHookExecutor";
|
|
22687
|
+
EHookExecutorName2["CurrentTimeHookExecutor"] = "CurrentTimeHookExecutor";
|
|
22687
22688
|
})(EHookExecutorName || (EHookExecutorName = {}));
|
|
22688
22689
|
|
|
22689
22690
|
// ../linkque-agent-runtime/dist/esm/core/followUpQuestions.js
|
|
@@ -24766,6 +24767,34 @@ function hasInteractiveDescendant(id, components, visited) {
|
|
|
24766
24767
|
return refs.some((ref) => typeof ref === "string" && hasInteractiveDescendant(ref, components, visited));
|
|
24767
24768
|
}
|
|
24768
24769
|
|
|
24770
|
+
// ../agent-a2ui-card-contract/dist/esm/pipeline-input.js
|
|
24771
|
+
function createA2UICardPipelineModelInputSchema(sources) {
|
|
24772
|
+
const properties = {};
|
|
24773
|
+
const required = [];
|
|
24774
|
+
sources.forEach((source, index) => {
|
|
24775
|
+
const name = `input${index}`;
|
|
24776
|
+
properties[name] = {
|
|
24777
|
+
...scopeLocalReferences(source.inputSchema, `#/properties/${name}`),
|
|
24778
|
+
description: `\u7B2C ${index} \u4E2A\u6570\u636E\u6E90 ${source.toolName} \u7684 MCP \u8C03\u7528\u53C2\u6570\u3002${source.purpose}`
|
|
24779
|
+
};
|
|
24780
|
+
required.push(name);
|
|
24781
|
+
});
|
|
24782
|
+
return { type: "object", properties, required, additionalProperties: false };
|
|
24783
|
+
}
|
|
24784
|
+
function scopeLocalReferences(schema, root) {
|
|
24785
|
+
const visit = (value) => {
|
|
24786
|
+
if (Array.isArray(value))
|
|
24787
|
+
return value.map(visit);
|
|
24788
|
+
if (value === null || typeof value !== "object")
|
|
24789
|
+
return value;
|
|
24790
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
24791
|
+
key,
|
|
24792
|
+
key === "$ref" && typeof entry === "string" && (entry === "#" || entry.startsWith("#/")) ? `${root}${entry.slice(1)}` : visit(entry)
|
|
24793
|
+
]));
|
|
24794
|
+
};
|
|
24795
|
+
return visit(schema);
|
|
24796
|
+
}
|
|
24797
|
+
|
|
24769
24798
|
// ../agent-a2ui-card-contract/dist/esm/validation.js
|
|
24770
24799
|
var FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
24771
24800
|
"array",
|
|
@@ -24867,6 +24896,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
24867
24896
|
exactKeys(value, [
|
|
24868
24897
|
"schemaVersion",
|
|
24869
24898
|
"dataMode",
|
|
24899
|
+
"argumentMode",
|
|
24870
24900
|
"revision",
|
|
24871
24901
|
"displayName",
|
|
24872
24902
|
"description",
|
|
@@ -24882,6 +24912,9 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
24882
24912
|
if (value.schemaVersion !== "4" || value.dataMode !== "pipeline") {
|
|
24883
24913
|
issues.push(issue2("config.dataMode", "INVALID_DATA_MODE", "pipeline cards require schemaVersion 4 and dataMode pipeline"));
|
|
24884
24914
|
}
|
|
24915
|
+
if (value.argumentMode !== void 0 && value.argumentMode !== "model") {
|
|
24916
|
+
issues.push(issue2("config.argumentMode", "INVALID_ARGUMENT_MODE", "argumentMode must be model"));
|
|
24917
|
+
}
|
|
24885
24918
|
if (!isSafeIdentifier(value.revision)) {
|
|
24886
24919
|
issues.push(issue2("config.revision", "INVALID_CARD_REVISION", "revision must be a stable safe identifier"));
|
|
24887
24920
|
}
|
|
@@ -24891,7 +24924,10 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
24891
24924
|
optionalString(value.whenNotToUse, "config.whenNotToUse", issues);
|
|
24892
24925
|
validateLooseJsonSchema(value.presentationInputSchema, "config.presentationInputSchema", issues);
|
|
24893
24926
|
const fields = validateFields(value.fields, "config.fields", issues);
|
|
24894
|
-
validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
|
|
24927
|
+
const pipelineSources = validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
|
|
24928
|
+
if (value.argumentMode === "model" && pipelineSources) {
|
|
24929
|
+
validateModelPipelineArguments(value, pipelineSources, "config", issues);
|
|
24930
|
+
}
|
|
24895
24931
|
validateDataTransform(value.dataTransform, "config.dataTransform", issues);
|
|
24896
24932
|
const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, "config.dataModelSchema", issues);
|
|
24897
24933
|
const card = validateTemplate(value.a2uiTemplate, fields, issues);
|
|
@@ -25017,6 +25053,17 @@ function validateDataSources(value, path2, issues, options = {}) {
|
|
|
25017
25053
|
}
|
|
25018
25054
|
return value;
|
|
25019
25055
|
}
|
|
25056
|
+
function validateModelPipelineArguments(value, sources, path2, issues) {
|
|
25057
|
+
sources.forEach((source, index) => {
|
|
25058
|
+
if (isPlainRecord(source.fixedInput) && Object.keys(source.fixedInput).length || Array.isArray(source.inputBindings) && source.inputBindings.length) {
|
|
25059
|
+
issues.push(issue2(`${path2}.dataSources[${index}]`, "MODEL_ARGUMENTS_CONFLICT", "model arguments cannot be combined with fixedInput or inputBindings"));
|
|
25060
|
+
}
|
|
25061
|
+
});
|
|
25062
|
+
const expected = createA2UICardPipelineModelInputSchema(sources);
|
|
25063
|
+
if (isJsonValue(value.presentationInputSchema) && stableJsonStringify(value.presentationInputSchema) !== stableJsonStringify(expected)) {
|
|
25064
|
+
issues.push(issue2(`${path2}.presentationInputSchema`, "MODEL_ARGUMENT_SCHEMA_MISMATCH", "presentationInputSchema must match the configured MCP input schemas"));
|
|
25065
|
+
}
|
|
25066
|
+
}
|
|
25020
25067
|
function validatePipelineDataSources(value, path2, issues) {
|
|
25021
25068
|
if (!Array.isArray(value) || value.length === 0) {
|
|
25022
25069
|
issues.push(issue2(path2, "INVALID_DATA_SOURCES", "pipeline dataSources must be a non-empty array"));
|
|
@@ -36531,7 +36578,7 @@ function createArgsMappingPlan(toolName, args, rules) {
|
|
|
36531
36578
|
continue;
|
|
36532
36579
|
}
|
|
36533
36580
|
if (rule.valueType === EArgsMappingValueType.DEFAULT) {
|
|
36534
|
-
if (getByPath(out, segments) === void 0) {
|
|
36581
|
+
if (rule.value !== void 0 && getByPath(out, segments) === void 0) {
|
|
36535
36582
|
setByPath(out, segments, rule.value);
|
|
36536
36583
|
}
|
|
36537
36584
|
continue;
|
|
@@ -39184,6 +39231,7 @@ export {
|
|
|
39184
39231
|
writeJsonPointer,
|
|
39185
39232
|
validateJsonSchemaValue2 as validateJsonSchemaValue,
|
|
39186
39233
|
normalizeCardDataValue,
|
|
39234
|
+
createA2UICardPipelineModelInputSchema,
|
|
39187
39235
|
executeA2UICardResolver,
|
|
39188
39236
|
parseA2UIFunctionMcpExecuteRequest,
|
|
39189
39237
|
stableToolName,
|
|
@@ -39,13 +39,13 @@ import {
|
|
|
39
39
|
resolveRunStorage,
|
|
40
40
|
toAgentRunMessages,
|
|
41
41
|
withIsoTimestamp
|
|
42
|
-
} from "../../chunk-
|
|
42
|
+
} from "../../chunk-2HV35GH7.js";
|
|
43
43
|
import "../../chunk-IWOFD643.js";
|
|
44
44
|
import "../../chunk-PXCGFBV5.js";
|
|
45
45
|
import "../../chunk-ETG6PNHQ.js";
|
|
46
46
|
import {
|
|
47
47
|
getBakedProtocol
|
|
48
|
-
} from "../../chunk-
|
|
48
|
+
} from "../../chunk-SDEXPSW4.js";
|
|
49
49
|
import {
|
|
50
50
|
ACTIVATE_SKILL_TOOL_NAME,
|
|
51
51
|
CANCEL_CONVERSATION_RUN_OPERATION,
|
|
@@ -126,6 +126,7 @@ import {
|
|
|
126
126
|
buildSkillCatalog,
|
|
127
127
|
cloneJsonObject,
|
|
128
128
|
cloneJsonValue,
|
|
129
|
+
createA2UICardPipelineModelInputSchema,
|
|
129
130
|
createActivateSkillTool,
|
|
130
131
|
createCardPresentationToolName,
|
|
131
132
|
createKnowledgeTools,
|
|
@@ -181,7 +182,7 @@ import {
|
|
|
181
182
|
warnLogFailure,
|
|
182
183
|
wrapToolWithHooks,
|
|
183
184
|
writeJsonPointer
|
|
184
|
-
} from "../../chunk-
|
|
185
|
+
} from "../../chunk-2CFN5G5A.js";
|
|
185
186
|
import "../../chunk-EAODRPW4.js";
|
|
186
187
|
import "../../chunk-XUFLSZM4.js";
|
|
187
188
|
import "../../chunk-GAYNLDWK.js";
|
|
@@ -41790,17 +41791,17 @@ async function executeCardDataPipeline(input) {
|
|
|
41790
41791
|
if (!invocation) {
|
|
41791
41792
|
throw new CardDataPipelineError("CARD_PIPELINE_INPUT_INVALID", "\u5361\u7247\u52A8\u6001\u53C2\u6570\u5FC5\u987B\u662F JSON \u5BF9\u8C61", void 0, "input");
|
|
41792
41793
|
}
|
|
41793
|
-
assertSchema(input.config.presentationInputSchema, invocation, "CARD_PIPELINE_INPUT_INVALID", "\u5361\u7247\u52A8\u6001\u53C2\u6570");
|
|
41794
|
+
assertSchema(input.config.argumentMode === "model" ? createA2UICardPipelineModelInputSchema(input.config.dataSources) : input.config.presentationInputSchema, invocation, "CARD_PIPELINE_INPUT_INVALID", "\u5361\u7247\u52A8\u6001\u53C2\u6570");
|
|
41794
41795
|
const prepared = await Promise.all(input.config.dataSources.map(async (source, index2) => {
|
|
41795
41796
|
const handle = await input.registry.resolve(source.mcpResourceId, source.toolName, input.signal);
|
|
41796
41797
|
if (!handle) {
|
|
41797
41798
|
throw new CardDataPipelineError("CARD_PIPELINE_MCP_UNAVAILABLE", `\u7B2C ${index2} \u4E2A MCP \u5DE5\u5177 ${source.mcpResourceId}/${source.toolName} \u5F53\u524D\u4E0D\u53EF\u7528`, index2, "mcp");
|
|
41798
41799
|
}
|
|
41799
|
-
const callInput = cloneJsonObject(source.fixedInput);
|
|
41800
|
+
const callInput = cloneJsonObject(input.config.argumentMode === "model" ? invocation[`input${index2}`] : source.fixedInput);
|
|
41800
41801
|
if (!callInput) {
|
|
41801
|
-
throw new CardDataPipelineError("CARD_PIPELINE_INPUT_INVALID", `\u7B2C ${index2} \u4E2A MCP \u56FA\u5B9A\u53C2\u6570\u4E0D\u662F JSON \u5BF9\u8C61`, index2, "input");
|
|
41802
|
+
throw new CardDataPipelineError("CARD_PIPELINE_INPUT_INVALID", input.config.argumentMode === "model" ? `\u7B2C ${index2} \u4E2A MCP \u6A21\u578B\u53C2\u6570\u4E0D\u662F JSON \u5BF9\u8C61` : `\u7B2C ${index2} \u4E2A MCP \u56FA\u5B9A\u53C2\u6570\u4E0D\u662F JSON \u5BF9\u8C61`, index2, "input");
|
|
41802
41803
|
}
|
|
41803
|
-
for (const binding of source.inputBindings) {
|
|
41804
|
+
for (const binding of input.config.argumentMode === "model" ? [] : source.inputBindings) {
|
|
41804
41805
|
const value = binding.source.kind === "invocation" ? readJsonPointer(invocation, binding.source.path) : input.runtimeContext[binding.source.key];
|
|
41805
41806
|
const cloned = value === void 0 ? void 0 : cloneJsonValue(value);
|
|
41806
41807
|
if (cloned === void 0 || !writeJsonPointer(callInput, binding.inputPath, cloned)) {
|
|
@@ -41937,7 +41938,7 @@ var CardRenderMcpServer = class {
|
|
|
41937
41938
|
label: config.displayName,
|
|
41938
41939
|
description: `${createPresentationDescription(config)}
|
|
41939
41940
|
\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`,
|
|
41940
|
-
inputSchema: config.presentationInputSchema,
|
|
41941
|
+
inputSchema: config.argumentMode === "model" ? createA2UICardPipelineModelInputSchema(config.dataSources) : config.presentationInputSchema,
|
|
41941
41942
|
execute: async (args, signal, context) => {
|
|
41942
41943
|
const startedAt = Date.now();
|
|
41943
41944
|
try {
|
|
@@ -41979,7 +41980,9 @@ var CardRenderMcpServer = class {
|
|
|
41979
41980
|
const state2 = {
|
|
41980
41981
|
selected: false,
|
|
41981
41982
|
results: /* @__PURE__ */ new Map(),
|
|
41982
|
-
|
|
41983
|
+
resultRefs: /* @__PURE__ */ new Map(),
|
|
41984
|
+
executionId: void 0,
|
|
41985
|
+
skipped: false
|
|
41983
41986
|
};
|
|
41984
41987
|
this.states.set(resource.resourceId, state2);
|
|
41985
41988
|
const finishName = createCardFinishToolName(resource.resourceId);
|
|
@@ -41990,13 +41993,15 @@ var CardRenderMcpServer = class {
|
|
|
41990
41993
|
resourceId: resource.resourceId,
|
|
41991
41994
|
label: config.displayName,
|
|
41992
41995
|
description: `${createPresentationDescription(config)}
|
|
41993
|
-
\u5148\u9009\u62E9\u6B64\u5361\u7247\uFF0C\u518D\u4F9D\u6B21\u8C03\u7528\u5B83\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\u548C card_finish \u5C55\u793A\u5DE5\u5177\u3002${CARD_SEQUENCE}`,
|
|
41996
|
+
\u5148\u9009\u62E9\u6B64\u5361\u7247\uFF0C\u518D\u4F9D\u6B21\u8C03\u7528\u5B83\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\u548C card_finish \u5C55\u793A\u5DE5\u5177\u3002${CARD_SEQUENCE} \u82E5\u5361\u7247\u5DE5\u5177\u8FD4\u56DE card_skipped\uFF0C\u8BFB\u53D6\u5DF2\u6709\u6570\u636E\u7F13\u5B58\u5E76\u7528 Markdown \u56DE\u7B54\uFF0C\u4E0D\u8981\u91CD\u8C03 MCP \u6216\u5411\u7528\u6237\u63D0\u53CA\u5361\u7247\u6280\u672F\u6545\u969C\u3002`,
|
|
41994
41997
|
inputSchema: {
|
|
41995
41998
|
type: "object",
|
|
41996
41999
|
properties: {},
|
|
41997
42000
|
additionalProperties: false
|
|
41998
42001
|
},
|
|
41999
42002
|
execute: async (_args, _signal, context) => {
|
|
42003
|
+
if (state2.skipped)
|
|
42004
|
+
return skippedCardResult(state2.resultRefs);
|
|
42000
42005
|
state2.executionId = context?.toolCallId;
|
|
42001
42006
|
this.observeCard(context, resource, config, "prepare", state2.executionId);
|
|
42002
42007
|
for (const candidate of this.states.values())
|
|
@@ -42004,6 +42009,7 @@ var CardRenderMcpServer = class {
|
|
|
42004
42009
|
this.activeCardId = resource.resourceId;
|
|
42005
42010
|
state2.selected = true;
|
|
42006
42011
|
state2.results.clear();
|
|
42012
|
+
state2.resultRefs.clear();
|
|
42007
42013
|
return {
|
|
42008
42014
|
status: "selected",
|
|
42009
42015
|
card: resource.resourceId,
|
|
@@ -42032,7 +42038,7 @@ var CardRenderMcpServer = class {
|
|
|
42032
42038
|
modelName: sourceToolName,
|
|
42033
42039
|
resourceId: resource.resourceId,
|
|
42034
42040
|
label: source.purpose,
|
|
42035
|
-
description: `\u9009\u62E9 ${name} \u540E\u4F7F\u7528\u3002${source.purpose}\u3002\u6839\u636E\u5BF9\u8BDD\u548C\u5DF2\u6709\u6570\u636E\u6E90\u7ED3\u679C\u786E\u5B9A\u6240\u6709 MCP \u53C2\u6570\u3002${CARD_SEQUENCE}`,
|
|
42041
|
+
description: `\u9009\u62E9 ${name} \u540E\u4F7F\u7528\u3002${source.purpose}\u3002\u6839\u636E\u5BF9\u8BDD\u548C\u5DF2\u6709\u6570\u636E\u6E90\u7ED3\u679C\u786E\u5B9A\u6240\u6709 MCP \u53C2\u6570\u3002\u53EF\u9009\u53C2\u6570\u4E0D\u9700\u8981\u65F6\u76F4\u63A5\u7701\u7565\uFF0C\u4E0D\u4F20\u7A7A\u5BF9\u8C61\uFF1B\u53EF\u9009\u5BF9\u8C61\u6216\u6570\u7EC4\u7684\u5B50\u5B57\u6BB5\u4EC5\u5728\u7236\u5B57\u6BB5\u5B58\u5728\u65F6\u624D\u8981\u6C42\u586B\u5199\u3002\u679A\u4E3E\u5B57\u6BB5\u5FC5\u987B\u4F7F\u7528 Schema \u5217\u51FA\u7684\u539F\u503C\u548C\u5927\u5C0F\u5199\u3002\u65E5\u671F\u672A\u7ED9\u5E74\u4EFD\u65F6\u5148\u786E\u8BA4\u5F53\u524D\u65E5\u671F\uFF0C\u9009\u62E9\u5C1A\u672A\u8FC7\u53BB\u7684\u5BF9\u5E94\u65E5\u671F\uFF0C\u4E0D\u8981\u731C\u6D4B\u4E3A\u4E0A\u4E00\u5E74\uFF1B\u91CD\u8BD5\u65F6\u4FDD\u7559\u7528\u6237\u6307\u5B9A\u7684\u65E5\u671F\uFF0C\u4E0D\u5F97\u7701\u7565\u6216\u6539\u6210\u5176\u4ED6\u65E5\u671F\u3002${CARD_SEQUENCE}`,
|
|
42036
42042
|
inputSchema: normalizeMcpInputSchema(discoveredHandle?.inputSchema),
|
|
42037
42043
|
outputSchema: CARD_SOURCE_RECEIPT_SCHEMA,
|
|
42038
42044
|
execute: async (args, signal, context) => {
|
|
@@ -42085,6 +42091,7 @@ var CardRenderMcpServer = class {
|
|
|
42085
42091
|
...cacheEntry,
|
|
42086
42092
|
executionId
|
|
42087
42093
|
});
|
|
42094
|
+
state2.resultRefs.set(source.sourceId, cacheEntry.resultRef);
|
|
42088
42095
|
this.logMetric(() => `source=${source.sourceId} mcpMs=${projectionStartedAt - mcpStartedAt} projectionMs=${Date.now() - projectionStartedAt} rawBytes=${byteLength(structured)} receiptBytes=${byteLength(receipt)}`);
|
|
42089
42096
|
return receipt;
|
|
42090
42097
|
}
|
|
@@ -42118,7 +42125,7 @@ var CardRenderMcpServer = class {
|
|
|
42118
42125
|
modelName: finishName,
|
|
42119
42126
|
resourceId: resource.resourceId,
|
|
42120
42127
|
label: `\u5C55\u793A${config.displayName}`,
|
|
42121
|
-
description: `\u6240\u6709\u5FC5\u9700\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\u6210\u529F\u540E\uFF0C\u5B8C\u6210\u5E76\u5C55\u793A${config.displayName}\u3002${CARD_SEQUENCE}
|
|
42128
|
+
description: `\u6240\u6709\u5FC5\u9700\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\u6210\u529F\u540E\uFF0C\u5B8C\u6210\u5E76\u5C55\u793A${config.displayName}\u3002\u82E5\u8FD4\u56DE card_skipped\uFF0C\u4E0D\u8981\u91CD\u8BD5\u5361\u7247\u6216 MCP\uFF1B\u8BFB\u53D6\u5DF2\u6709\u7F13\u5B58\u5E76\u4F9D\u636E\u771F\u5B9E\u7ED3\u679C\u7528 Markdown \u56DE\u7B54\uFF0C\u4E0D\u5411\u7528\u6237\u63D0\u53CA\u5361\u7247\u6E32\u67D3\u6216\u6280\u672F\u95EE\u9898\u3002${CARD_SEQUENCE}
|
|
42122
42129
|
${AFTER_CARD_DESCRIPTION}`,
|
|
42123
42130
|
inputSchema: {
|
|
42124
42131
|
type: "object",
|
|
@@ -42142,8 +42149,22 @@ ${AFTER_CARD_DESCRIPTION}`,
|
|
|
42142
42149
|
if (!state2.selected || this.activeCardId !== resource.resourceId)
|
|
42143
42150
|
throw new Error(`\u5B8C\u6210\u5C55\u793A\u524D\uFF0C\u8BF7\u5148\u9009\u62E9\u5361\u7247 ${name}`);
|
|
42144
42151
|
const afterCard = readAfterCard(args);
|
|
42152
|
+
if (config.dataSources.some((source) => source.required && !state2.results.has(source.sourceId))) {
|
|
42153
|
+
throw new Error("\u5FC5\u9700\u7684\u6570\u636E\u6E90\u5C1A\u672A\u6210\u529F\uFF0C\u4E0D\u80FD\u751F\u6210\u5361\u7247");
|
|
42154
|
+
}
|
|
42145
42155
|
const finishStartedAt = Date.now();
|
|
42146
|
-
|
|
42156
|
+
let result;
|
|
42157
|
+
try {
|
|
42158
|
+
result = await executeCardPresentationFromSources(resource, this.runtimeContext, state2.results, signal);
|
|
42159
|
+
} catch (error) {
|
|
42160
|
+
if (signal?.aborted)
|
|
42161
|
+
throw error;
|
|
42162
|
+
state2.selected = false;
|
|
42163
|
+
state2.skipped = true;
|
|
42164
|
+
this.activeCardId = void 0;
|
|
42165
|
+
this.logMetric(`card=${resource.resourceId} finishMs=${Date.now() - finishStartedAt} status=skipped code=${error instanceof CardMappingError ? error.details.code : "CARD_PRESENTATION_FAILED"}`);
|
|
42166
|
+
return skippedCardResult(state2.resultRefs);
|
|
42167
|
+
}
|
|
42147
42168
|
if (context?.observation)
|
|
42148
42169
|
this.deliveries.set(result.card, context.observation);
|
|
42149
42170
|
if (afterCard !== void 0) {
|
|
@@ -42352,6 +42373,17 @@ function readAfterCard(args) {
|
|
|
42352
42373
|
throw new Error("card_only \u6A21\u5F0F\u4E0B afterCard \u5FC5\u987B\u4E3A\u7A7A\u5B57\u7B26\u4E32\uFF1B\u5361\u7247\u5DF2\u7ECF\u56DE\u7B54\u4E86\u67E5\u8BE2");
|
|
42353
42374
|
return value.trim();
|
|
42354
42375
|
}
|
|
42376
|
+
function skippedCardResult(resultRefs) {
|
|
42377
|
+
return {
|
|
42378
|
+
status: "card_skipped",
|
|
42379
|
+
sources: [...resultRefs].map(([sourceId, resultRef]) => ({
|
|
42380
|
+
sourceId,
|
|
42381
|
+
resultRef,
|
|
42382
|
+
view: "raw"
|
|
42383
|
+
})),
|
|
42384
|
+
next: "\u672C\u8F6E\u5361\u7247\u65E0\u6CD5\u5C55\u793A\uFF0C\u4E0D\u8981\u91CD\u8BD5\u5361\u7247\u6216\u91CD\u65B0\u8C03\u7528 MCP\u3002\u6309 sources \u4E2D\u7684 resultRef \u548C view \u8C03\u7528\u672C\u5361\u7247\u7684 card_source_read\uFF0C\u53EA\u6839\u636E\u5DF2\u67E5\u8BE2\u5230\u7684\u6570\u636E\u7528 Markdown \u56DE\u7B54\u7528\u6237\uFF1B\u82E5\u7ED3\u679C\u4E3A\u7A7A\uFF0C\u5982\u5B9E\u8BF4\u660E\u6682\u65E0\u7ED3\u679C\uFF0C\u4E0D\u731C\u6D4B\u539F\u56E0\u3002\u4E0D\u8981\u5411\u7528\u6237\u63D0\u53CA\u5361\u7247\u3001\u6E32\u67D3\u6216\u6280\u672F\u6545\u969C\u3002"
|
|
42385
|
+
};
|
|
42386
|
+
}
|
|
42355
42387
|
function createCardSourceToolName(resourceId, sourceId) {
|
|
42356
42388
|
return stableToolName("card_source", `${resourceId}_${sourceId}`);
|
|
42357
42389
|
}
|
|
@@ -43772,6 +43804,100 @@ var DefaultHarnessPromptPlugin = class {
|
|
|
43772
43804
|
};
|
|
43773
43805
|
};
|
|
43774
43806
|
|
|
43807
|
+
// ../linkque-agent-runtime/dist/esm/impl/plugin/currentTimePlugin.js
|
|
43808
|
+
var CURRENT_TIME_PLUGIN_NAME = "current-time";
|
|
43809
|
+
var CURRENT_TIME_TOOL_NAME = "get_current_time";
|
|
43810
|
+
function createCurrentTimeTool() {
|
|
43811
|
+
return {
|
|
43812
|
+
name: CURRENT_TIME_TOOL_NAME,
|
|
43813
|
+
modelName: CURRENT_TIME_TOOL_NAME,
|
|
43814
|
+
label: "\u5F53\u524D\u65F6\u95F4",
|
|
43815
|
+
description: "\u67E5\u8BE2\u5F53\u524D\u65E5\u671F\u3001\u65F6\u95F4\u3001\u661F\u671F\u548C\u65F6\u533A\uFF0C\u4E3A\u6D89\u53CA\u65F6\u95F4\u7684\u63D0\u95EE\u4E0E\u4EFB\u52A1\u63D0\u4F9B\u5B9E\u65F6\u57FA\u51C6\u3002\u4F7F\u7528\u573A\u666F\uFF1A\u7528\u6237\u8BE2\u95EE\u73B0\u5728\u51E0\u70B9\u3001\u4ECA\u5929\u51E0\u53F7\u6216\u661F\u671F\u51E0\uFF1B\u9700\u8981\u628A\u201C\u4ECA\u5929\uFF0F\u660E\u5929\uFF0F\u672C\u5468\uFF0F\u6700\u8FD1\u201D\u7B49\u76F8\u5BF9\u65F6\u95F4\u8F6C\u6210\u5177\u4F53\u65E5\u671F\uFF1B\u8FDB\u884C\u4EFB\u52A1\u89C4\u5212\u3001\u6392\u671F\u3001\u622A\u6B62\u65F6\u95F4\u6216\u5269\u4F59\u65F6\u957F\u8BA1\u7B97\u3001\u5224\u65AD\u662F\u5426\u8FC7\u671F\uFF0C\u6216\u4E3A\u641C\u7D22\u786E\u5B9A\u76F8\u5BF9\u65F6\u95F4\u8303\u56F4\u65F6\uFF0C\u5E94\u5148\u8C03\u7528\u672C\u5DE5\u5177\u3002\u7528\u6237\u65E0\u9700\u660E\u786E\u6307\u5B9A\u5DE5\u5177\u540D\u3002\u4E0D\u8981\u5C06\u8BAD\u7EC3\u77E5\u8BC6\u3001\u5386\u53F2\u6D88\u606F\u65F6\u95F4\u6216\u5148\u524D\u5DE5\u5177\u7ED3\u679C\u5F53\u4F5C\u5F53\u524D\u65F6\u95F4\uFF1B\u957F\u4EFB\u52A1\u518D\u6B21\u4F9D\u8D56\u201C\u73B0\u5728\u201D\u65F6\u5E94\u91CD\u65B0\u67E5\u8BE2\u3002timeZone \u53EF\u9009\uFF0C\u4F7F\u7528 IANA \u65F6\u533A\u540D\u79F0\uFF0C\u4F8B\u5982 Asia/Shanghai\u3001America/New_York\uFF1B\u9ED8\u8BA4 Asia/Shanghai\uFF08\u5317\u4EAC\u65F6\u95F4\uFF09\uFF0C\u4E0D\u4EE3\u8868\u5DF2\u8BC6\u522B\u7528\u6237\u6240\u5728\u5730\u3002\u7528\u6237\u6307\u5B9A\u5176\u4ED6\u65F6\u533A\u65F6\u5E94\u4F20\u5165\u5BF9\u5E94\u65F6\u533A\uFF1B\u4EFB\u52A1\u5BF9\u65F6\u533A\u654F\u611F\u4E14\u7528\u6237\u6240\u5728\u5730\u4E0D\u660E\u65F6\u5E94\u786E\u8BA4\u65F6\u533A\u3002\u8FD4\u56DE\u6307\u5B9A\u65F6\u533A\u7684\u65E5\u671F\u65F6\u95F4\u3001\u661F\u671F\u548C UTC \u504F\u79FB\uFF0C\u4EE5\u53CA UTC \u65F6\u95F4\u548C\u6BEB\u79D2\u65F6\u95F4\u6233\u3002\u4EC5\u67E5\u8BE2\u65F6\u95F4\uFF0C\u4E0D\u521B\u5EFA\u63D0\u9192\u6216\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u4E5F\u4E0D\u9A8C\u8BC1\u65B0\u95FB\u7B49\u4E8B\u5B9E\u662F\u5426\u6700\u65B0\uFF1B\u5DF2\u6709\u660E\u786E\u65E5\u671F\u4E14\u4E0D\u4F9D\u8D56\u5F53\u524D\u65F6\u95F4\u7684\u8BA1\u7B97\u65E0\u9700\u8C03\u7528\u3002",
|
|
43816
|
+
inputSchema: {
|
|
43817
|
+
type: "object",
|
|
43818
|
+
properties: {
|
|
43819
|
+
timeZone: {
|
|
43820
|
+
type: "string",
|
|
43821
|
+
minLength: 1,
|
|
43822
|
+
description: "IANA \u65F6\u533A\u540D\u79F0\uFF0C\u9ED8\u8BA4 Asia/Shanghai"
|
|
43823
|
+
}
|
|
43824
|
+
},
|
|
43825
|
+
additionalProperties: false
|
|
43826
|
+
},
|
|
43827
|
+
annotations: { readOnlyHint: true },
|
|
43828
|
+
execute: async (args, signal) => {
|
|
43829
|
+
signal?.throwIfAborted();
|
|
43830
|
+
if (typeof args !== "object" || args === null || Array.isArray(args) || Object.keys(args).some((key) => key !== "timeZone"))
|
|
43831
|
+
throw new Error("\u53C2\u6570\u5FC5\u987B\u662F\u4EC5\u5305\u542B\u53EF\u9009 timeZone \u7684\u5BF9\u8C61");
|
|
43832
|
+
const requested = args.timeZone;
|
|
43833
|
+
if (requested !== void 0 && (typeof requested !== "string" || !requested.trim()))
|
|
43834
|
+
throw new Error("timeZone \u5FC5\u987B\u662F\u6709\u6548\u7684 IANA \u65F6\u533A\u540D\u79F0");
|
|
43835
|
+
const timeZone = typeof requested === "string" ? requested.trim() : "Asia/Shanghai";
|
|
43836
|
+
const formatter = new Intl.DateTimeFormat("zh-CN", {
|
|
43837
|
+
timeZone,
|
|
43838
|
+
calendar: "gregory",
|
|
43839
|
+
numberingSystem: "latn",
|
|
43840
|
+
year: "numeric",
|
|
43841
|
+
month: "2-digit",
|
|
43842
|
+
day: "2-digit",
|
|
43843
|
+
hour: "2-digit",
|
|
43844
|
+
minute: "2-digit",
|
|
43845
|
+
second: "2-digit",
|
|
43846
|
+
hourCycle: "h23",
|
|
43847
|
+
weekday: "long",
|
|
43848
|
+
timeZoneName: "longOffset"
|
|
43849
|
+
});
|
|
43850
|
+
const now = /* @__PURE__ */ new Date();
|
|
43851
|
+
const parts = Object.fromEntries(formatter.formatToParts(now).map((part) => [part.type, part.value]));
|
|
43852
|
+
return {
|
|
43853
|
+
timeZone: formatter.resolvedOptions().timeZone,
|
|
43854
|
+
date: `${parts.year}-${parts.month}-${parts.day}`,
|
|
43855
|
+
time: `${parts.hour}:${parts.minute}:${parts.second}`,
|
|
43856
|
+
weekday: parts.weekday,
|
|
43857
|
+
utcOffset: parts.timeZoneName === "GMT" ? "+00:00" : parts.timeZoneName.replace("GMT", ""),
|
|
43858
|
+
utc: now.toISOString(),
|
|
43859
|
+
timestampMs: now.getTime()
|
|
43860
|
+
};
|
|
43861
|
+
}
|
|
43862
|
+
};
|
|
43863
|
+
}
|
|
43864
|
+
var CurrentTimePlugin = class {
|
|
43865
|
+
name = CURRENT_TIME_PLUGIN_NAME;
|
|
43866
|
+
hookExecutorList = [
|
|
43867
|
+
{
|
|
43868
|
+
name: EHookExecutorName.CurrentTimeHookExecutor,
|
|
43869
|
+
matches: (_resource, stage) => stage === EHookStage.PREPARE_AGENT_LOOP,
|
|
43870
|
+
execute: async (_resource, context) => context.stage === EHookStage.PREPARE_AGENT_LOOP ? {
|
|
43871
|
+
ok: true,
|
|
43872
|
+
patch: {
|
|
43873
|
+
stage: EHookStage.PREPARE_AGENT_LOOP,
|
|
43874
|
+
additionalTools: [createCurrentTimeTool()]
|
|
43875
|
+
}
|
|
43876
|
+
} : { ok: true, skipped: true }
|
|
43877
|
+
}
|
|
43878
|
+
];
|
|
43879
|
+
modifyAgentConfig = (config) => {
|
|
43880
|
+
const existing = config.agent.resources.filter((resource) => resource.resourceType === EResourceType.HOOK && resource.config.executorName === EHookExecutorName.CurrentTimeHookExecutor);
|
|
43881
|
+
if (existing.length) {
|
|
43882
|
+
const hook = existing[0].config;
|
|
43883
|
+
if (existing.length !== 1 || hook.stage !== EHookStage.PREPARE_AGENT_LOOP || hook.hasSideEffects !== true || hook.enabled === false || hook.matcher !== void 0)
|
|
43884
|
+
throw new Error("\u5F53\u524D\u65F6\u95F4 Hook \u5FC5\u987B\u542F\u7528 PREPARE_AGENT_LOOP + hasSideEffects=true\uFF0C\u4E14\u4E0D\u914D\u7F6E matcher");
|
|
43885
|
+
return;
|
|
43886
|
+
}
|
|
43887
|
+
config.agent.resources.push({
|
|
43888
|
+
resourceId: "current-time-prepare-agent-loop",
|
|
43889
|
+
resourceType: EResourceType.HOOK,
|
|
43890
|
+
providerType: EResourceProviderType.LINK_QUE,
|
|
43891
|
+
config: {
|
|
43892
|
+
name: "\u5F53\u524D\u65F6\u95F4\u5DE5\u5177\u6CE8\u5165",
|
|
43893
|
+
executorName: EHookExecutorName.CurrentTimeHookExecutor,
|
|
43894
|
+
stage: EHookStage.PREPARE_AGENT_LOOP,
|
|
43895
|
+
hasSideEffects: true
|
|
43896
|
+
}
|
|
43897
|
+
});
|
|
43898
|
+
};
|
|
43899
|
+
};
|
|
43900
|
+
|
|
43775
43901
|
// ../linkque-agent-appwrite-integrate/dist/esm/runtime/ports/appbaseSessionManager.js
|
|
43776
43902
|
var AppbaseSessionManager = class {
|
|
43777
43903
|
store;
|
|
@@ -44058,6 +44184,9 @@ function createAppBaseRuntime(protocol, env = process.env, ports = {}, logCtx) {
|
|
|
44058
44184
|
if (!plugins.some((plugin) => plugin.name === MCP_DISCOVERY_PLUGIN_NAME)) {
|
|
44059
44185
|
plugins.push(new McpDiscoveryPlugin());
|
|
44060
44186
|
}
|
|
44187
|
+
if (!plugins.some((plugin) => plugin.name === CURRENT_TIME_PLUGIN_NAME)) {
|
|
44188
|
+
plugins.push(new CurrentTimePlugin());
|
|
44189
|
+
}
|
|
44061
44190
|
if (plugins.length > 0) {
|
|
44062
44191
|
runtimePorts.plugins = plugins;
|
|
44063
44192
|
}
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
runClientCapability,
|
|
4
4
|
runClientCapabilityCleanup,
|
|
5
5
|
runClientCapabilityResult
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-2HV35GH7.js";
|
|
7
7
|
import "../../chunk-IWOFD643.js";
|
|
8
8
|
import "../../chunk-PXCGFBV5.js";
|
|
9
9
|
import "../../chunk-ETG6PNHQ.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-2CFN5G5A.js";
|
|
11
11
|
import "../../chunk-EAODRPW4.js";
|
|
12
12
|
import "../../chunk-XUFLSZM4.js";
|
|
13
13
|
import "../../chunk-GAYNLDWK.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getBakedProtocol,
|
|
3
3
|
setBakedProtocol
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-SDEXPSW4.js";
|
|
5
|
+
import "../chunk-2CFN5G5A.js";
|
|
6
6
|
import "../chunk-EAODRPW4.js";
|
|
7
7
|
import "../chunk-XUFLSZM4.js";
|
|
8
8
|
import "../chunk-GAYNLDWK.js";
|
package/worker.js
CHANGED
|
@@ -388,6 +388,7 @@ var init_agentProtocol = __esm({
|
|
|
388
388
|
EHookExecutorName2["SecurityAnswerHookExecutor"] = "SecurityAnswerHookExecutor";
|
|
389
389
|
EHookExecutorName2["ImageUnderstandingHookExecutor"] = "ImageUnderstandingHookExecutor";
|
|
390
390
|
EHookExecutorName2["McpDiscoveryHookExecutor"] = "McpDiscoveryHookExecutor";
|
|
391
|
+
EHookExecutorName2["CurrentTimeHookExecutor"] = "CurrentTimeHookExecutor";
|
|
391
392
|
})(EHookExecutorName || (EHookExecutorName = {}));
|
|
392
393
|
}
|
|
393
394
|
});
|
|
@@ -10501,6 +10502,39 @@ var init_v4Catalog = __esm({
|
|
|
10501
10502
|
}
|
|
10502
10503
|
});
|
|
10503
10504
|
|
|
10505
|
+
// ../agent-a2ui-card-contract/dist/esm/pipeline-input.js
|
|
10506
|
+
function createA2UICardPipelineModelInputSchema(sources) {
|
|
10507
|
+
const properties = {};
|
|
10508
|
+
const required2 = [];
|
|
10509
|
+
sources.forEach((source, index2) => {
|
|
10510
|
+
const name = `input${index2}`;
|
|
10511
|
+
properties[name] = {
|
|
10512
|
+
...scopeLocalReferences(source.inputSchema, `#/properties/${name}`),
|
|
10513
|
+
description: `\u7B2C ${index2} \u4E2A\u6570\u636E\u6E90 ${source.toolName} \u7684 MCP \u8C03\u7528\u53C2\u6570\u3002${source.purpose}`
|
|
10514
|
+
};
|
|
10515
|
+
required2.push(name);
|
|
10516
|
+
});
|
|
10517
|
+
return { type: "object", properties, required: required2, additionalProperties: false };
|
|
10518
|
+
}
|
|
10519
|
+
function scopeLocalReferences(schema, root) {
|
|
10520
|
+
const visit = (value) => {
|
|
10521
|
+
if (Array.isArray(value))
|
|
10522
|
+
return value.map(visit);
|
|
10523
|
+
if (value === null || typeof value !== "object")
|
|
10524
|
+
return value;
|
|
10525
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
10526
|
+
key,
|
|
10527
|
+
key === "$ref" && typeof entry === "string" && (entry === "#" || entry.startsWith("#/")) ? `${root}${entry.slice(1)}` : visit(entry)
|
|
10528
|
+
]));
|
|
10529
|
+
};
|
|
10530
|
+
return visit(schema);
|
|
10531
|
+
}
|
|
10532
|
+
var init_pipeline_input = __esm({
|
|
10533
|
+
"../agent-a2ui-card-contract/dist/esm/pipeline-input.js"() {
|
|
10534
|
+
"use strict";
|
|
10535
|
+
}
|
|
10536
|
+
});
|
|
10537
|
+
|
|
10504
10538
|
// ../agent-a2ui-card-contract/dist/esm/validation.js
|
|
10505
10539
|
function getPersistedV4ProtocolIssues(card, path9) {
|
|
10506
10540
|
const issues = [];
|
|
@@ -10582,6 +10616,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
10582
10616
|
exactKeys(value, [
|
|
10583
10617
|
"schemaVersion",
|
|
10584
10618
|
"dataMode",
|
|
10619
|
+
"argumentMode",
|
|
10585
10620
|
"revision",
|
|
10586
10621
|
"displayName",
|
|
10587
10622
|
"description",
|
|
@@ -10597,6 +10632,9 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
10597
10632
|
if (value.schemaVersion !== "4" || value.dataMode !== "pipeline") {
|
|
10598
10633
|
issues.push(issue2("config.dataMode", "INVALID_DATA_MODE", "pipeline cards require schemaVersion 4 and dataMode pipeline"));
|
|
10599
10634
|
}
|
|
10635
|
+
if (value.argumentMode !== void 0 && value.argumentMode !== "model") {
|
|
10636
|
+
issues.push(issue2("config.argumentMode", "INVALID_ARGUMENT_MODE", "argumentMode must be model"));
|
|
10637
|
+
}
|
|
10600
10638
|
if (!isSafeIdentifier(value.revision)) {
|
|
10601
10639
|
issues.push(issue2("config.revision", "INVALID_CARD_REVISION", "revision must be a stable safe identifier"));
|
|
10602
10640
|
}
|
|
@@ -10606,7 +10644,10 @@ function getA2UICardResourceConfigV4PipelineIssues(value) {
|
|
|
10606
10644
|
optionalString(value.whenNotToUse, "config.whenNotToUse", issues);
|
|
10607
10645
|
validateLooseJsonSchema(value.presentationInputSchema, "config.presentationInputSchema", issues);
|
|
10608
10646
|
const fields = validateFields(value.fields, "config.fields", issues);
|
|
10609
|
-
validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
|
|
10647
|
+
const pipelineSources = validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
|
|
10648
|
+
if (value.argumentMode === "model" && pipelineSources) {
|
|
10649
|
+
validateModelPipelineArguments(value, pipelineSources, "config", issues);
|
|
10650
|
+
}
|
|
10610
10651
|
validateDataTransform(value.dataTransform, "config.dataTransform", issues);
|
|
10611
10652
|
const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, "config.dataModelSchema", issues);
|
|
10612
10653
|
const card = validateTemplate(value.a2uiTemplate, fields, issues);
|
|
@@ -10732,6 +10773,17 @@ function validateDataSources(value, path9, issues, options = {}) {
|
|
|
10732
10773
|
}
|
|
10733
10774
|
return value;
|
|
10734
10775
|
}
|
|
10776
|
+
function validateModelPipelineArguments(value, sources, path9, issues) {
|
|
10777
|
+
sources.forEach((source, index2) => {
|
|
10778
|
+
if (isPlainRecord(source.fixedInput) && Object.keys(source.fixedInput).length || Array.isArray(source.inputBindings) && source.inputBindings.length) {
|
|
10779
|
+
issues.push(issue2(`${path9}.dataSources[${index2}]`, "MODEL_ARGUMENTS_CONFLICT", "model arguments cannot be combined with fixedInput or inputBindings"));
|
|
10780
|
+
}
|
|
10781
|
+
});
|
|
10782
|
+
const expected = createA2UICardPipelineModelInputSchema(sources);
|
|
10783
|
+
if (isJsonValue(value.presentationInputSchema) && stableJsonStringify(value.presentationInputSchema) !== stableJsonStringify(expected)) {
|
|
10784
|
+
issues.push(issue2(`${path9}.presentationInputSchema`, "MODEL_ARGUMENT_SCHEMA_MISMATCH", "presentationInputSchema must match the configured MCP input schemas"));
|
|
10785
|
+
}
|
|
10786
|
+
}
|
|
10735
10787
|
function validatePipelineDataSources(value, path9, issues) {
|
|
10736
10788
|
if (!Array.isArray(value) || value.length === 0) {
|
|
10737
10789
|
issues.push(issue2(path9, "INVALID_DATA_SOURCES", "pipeline dataSources must be a non-empty array"));
|
|
@@ -11261,6 +11313,7 @@ var init_validation = __esm({
|
|
|
11261
11313
|
init_types2();
|
|
11262
11314
|
init_binding_context();
|
|
11263
11315
|
init_v4Catalog();
|
|
11316
|
+
init_pipeline_input();
|
|
11264
11317
|
FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
11265
11318
|
"array",
|
|
11266
11319
|
"boolean",
|
|
@@ -11768,6 +11821,7 @@ var init_esm3 = __esm({
|
|
|
11768
11821
|
init_function_action();
|
|
11769
11822
|
init_presentation();
|
|
11770
11823
|
init_v4Catalog();
|
|
11824
|
+
init_pipeline_input();
|
|
11771
11825
|
}
|
|
11772
11826
|
});
|
|
11773
11827
|
|
|
@@ -208409,17 +208463,17 @@ async function executeCardDataPipeline(input) {
|
|
|
208409
208463
|
if (!invocation) {
|
|
208410
208464
|
throw new CardDataPipelineError("CARD_PIPELINE_INPUT_INVALID", "\u5361\u7247\u52A8\u6001\u53C2\u6570\u5FC5\u987B\u662F JSON \u5BF9\u8C61", void 0, "input");
|
|
208411
208465
|
}
|
|
208412
|
-
assertSchema(input.config.presentationInputSchema, invocation, "CARD_PIPELINE_INPUT_INVALID", "\u5361\u7247\u52A8\u6001\u53C2\u6570");
|
|
208466
|
+
assertSchema(input.config.argumentMode === "model" ? createA2UICardPipelineModelInputSchema(input.config.dataSources) : input.config.presentationInputSchema, invocation, "CARD_PIPELINE_INPUT_INVALID", "\u5361\u7247\u52A8\u6001\u53C2\u6570");
|
|
208413
208467
|
const prepared = await Promise.all(input.config.dataSources.map(async (source, index2) => {
|
|
208414
208468
|
const handle = await input.registry.resolve(source.mcpResourceId, source.toolName, input.signal);
|
|
208415
208469
|
if (!handle) {
|
|
208416
208470
|
throw new CardDataPipelineError("CARD_PIPELINE_MCP_UNAVAILABLE", `\u7B2C ${index2} \u4E2A MCP \u5DE5\u5177 ${source.mcpResourceId}/${source.toolName} \u5F53\u524D\u4E0D\u53EF\u7528`, index2, "mcp");
|
|
208417
208471
|
}
|
|
208418
|
-
const callInput = cloneJsonObject(source.fixedInput);
|
|
208472
|
+
const callInput = cloneJsonObject(input.config.argumentMode === "model" ? invocation[`input${index2}`] : source.fixedInput);
|
|
208419
208473
|
if (!callInput) {
|
|
208420
|
-
throw new CardDataPipelineError("CARD_PIPELINE_INPUT_INVALID", `\u7B2C ${index2} \u4E2A MCP \u56FA\u5B9A\u53C2\u6570\u4E0D\u662F JSON \u5BF9\u8C61`, index2, "input");
|
|
208474
|
+
throw new CardDataPipelineError("CARD_PIPELINE_INPUT_INVALID", input.config.argumentMode === "model" ? `\u7B2C ${index2} \u4E2A MCP \u6A21\u578B\u53C2\u6570\u4E0D\u662F JSON \u5BF9\u8C61` : `\u7B2C ${index2} \u4E2A MCP \u56FA\u5B9A\u53C2\u6570\u4E0D\u662F JSON \u5BF9\u8C61`, index2, "input");
|
|
208421
208475
|
}
|
|
208422
|
-
for (const binding of source.inputBindings) {
|
|
208476
|
+
for (const binding of input.config.argumentMode === "model" ? [] : source.inputBindings) {
|
|
208423
208477
|
const value = binding.source.kind === "invocation" ? readJsonPointer(invocation, binding.source.path) : input.runtimeContext[binding.source.key];
|
|
208424
208478
|
const cloned = value === void 0 ? void 0 : cloneJsonValue(value);
|
|
208425
208479
|
if (cloned === void 0 || !writeJsonPointer(callInput, binding.inputPath, cloned)) {
|
|
@@ -208539,6 +208593,17 @@ function readAfterCard(args) {
|
|
|
208539
208593
|
throw new Error("card_only \u6A21\u5F0F\u4E0B afterCard \u5FC5\u987B\u4E3A\u7A7A\u5B57\u7B26\u4E32\uFF1B\u5361\u7247\u5DF2\u7ECF\u56DE\u7B54\u4E86\u67E5\u8BE2");
|
|
208540
208594
|
return value.trim();
|
|
208541
208595
|
}
|
|
208596
|
+
function skippedCardResult(resultRefs) {
|
|
208597
|
+
return {
|
|
208598
|
+
status: "card_skipped",
|
|
208599
|
+
sources: [...resultRefs].map(([sourceId, resultRef]) => ({
|
|
208600
|
+
sourceId,
|
|
208601
|
+
resultRef,
|
|
208602
|
+
view: "raw"
|
|
208603
|
+
})),
|
|
208604
|
+
next: "\u672C\u8F6E\u5361\u7247\u65E0\u6CD5\u5C55\u793A\uFF0C\u4E0D\u8981\u91CD\u8BD5\u5361\u7247\u6216\u91CD\u65B0\u8C03\u7528 MCP\u3002\u6309 sources \u4E2D\u7684 resultRef \u548C view \u8C03\u7528\u672C\u5361\u7247\u7684 card_source_read\uFF0C\u53EA\u6839\u636E\u5DF2\u67E5\u8BE2\u5230\u7684\u6570\u636E\u7528 Markdown \u56DE\u7B54\u7528\u6237\uFF1B\u82E5\u7ED3\u679C\u4E3A\u7A7A\uFF0C\u5982\u5B9E\u8BF4\u660E\u6682\u65E0\u7ED3\u679C\uFF0C\u4E0D\u731C\u6D4B\u539F\u56E0\u3002\u4E0D\u8981\u5411\u7528\u6237\u63D0\u53CA\u5361\u7247\u3001\u6E32\u67D3\u6216\u6280\u672F\u6545\u969C\u3002"
|
|
208605
|
+
};
|
|
208606
|
+
}
|
|
208542
208607
|
function createCardSourceToolName(resourceId, sourceId) {
|
|
208543
208608
|
return stableToolName("card_source", `${resourceId}_${sourceId}`);
|
|
208544
208609
|
}
|
|
@@ -208560,6 +208625,7 @@ var init_cardRenderMcpServer = __esm({
|
|
|
208560
208625
|
"../linkque-agent-runtime/dist/esm/core/cardRenderMcpServer.js"() {
|
|
208561
208626
|
"use strict";
|
|
208562
208627
|
init_telemetry();
|
|
208628
|
+
init_esm3();
|
|
208563
208629
|
init_cardSourceResult();
|
|
208564
208630
|
init_cardTools();
|
|
208565
208631
|
init_mcpNaming();
|
|
@@ -208625,7 +208691,7 @@ var init_cardRenderMcpServer = __esm({
|
|
|
208625
208691
|
label: config2.displayName,
|
|
208626
208692
|
description: `${createPresentationDescription(config2)}
|
|
208627
208693
|
\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`,
|
|
208628
|
-
inputSchema: config2.presentationInputSchema,
|
|
208694
|
+
inputSchema: config2.argumentMode === "model" ? createA2UICardPipelineModelInputSchema(config2.dataSources) : config2.presentationInputSchema,
|
|
208629
208695
|
execute: async (args, signal, context2) => {
|
|
208630
208696
|
const startedAt = Date.now();
|
|
208631
208697
|
try {
|
|
@@ -208667,7 +208733,9 @@ var init_cardRenderMcpServer = __esm({
|
|
|
208667
208733
|
const state2 = {
|
|
208668
208734
|
selected: false,
|
|
208669
208735
|
results: /* @__PURE__ */ new Map(),
|
|
208670
|
-
|
|
208736
|
+
resultRefs: /* @__PURE__ */ new Map(),
|
|
208737
|
+
executionId: void 0,
|
|
208738
|
+
skipped: false
|
|
208671
208739
|
};
|
|
208672
208740
|
this.states.set(resource.resourceId, state2);
|
|
208673
208741
|
const finishName = createCardFinishToolName(resource.resourceId);
|
|
@@ -208678,13 +208746,15 @@ var init_cardRenderMcpServer = __esm({
|
|
|
208678
208746
|
resourceId: resource.resourceId,
|
|
208679
208747
|
label: config2.displayName,
|
|
208680
208748
|
description: `${createPresentationDescription(config2)}
|
|
208681
|
-
\u5148\u9009\u62E9\u6B64\u5361\u7247\uFF0C\u518D\u4F9D\u6B21\u8C03\u7528\u5B83\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\u548C card_finish \u5C55\u793A\u5DE5\u5177\u3002${CARD_SEQUENCE}`,
|
|
208749
|
+
\u5148\u9009\u62E9\u6B64\u5361\u7247\uFF0C\u518D\u4F9D\u6B21\u8C03\u7528\u5B83\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\u548C card_finish \u5C55\u793A\u5DE5\u5177\u3002${CARD_SEQUENCE} \u82E5\u5361\u7247\u5DE5\u5177\u8FD4\u56DE card_skipped\uFF0C\u8BFB\u53D6\u5DF2\u6709\u6570\u636E\u7F13\u5B58\u5E76\u7528 Markdown \u56DE\u7B54\uFF0C\u4E0D\u8981\u91CD\u8C03 MCP \u6216\u5411\u7528\u6237\u63D0\u53CA\u5361\u7247\u6280\u672F\u6545\u969C\u3002`,
|
|
208682
208750
|
inputSchema: {
|
|
208683
208751
|
type: "object",
|
|
208684
208752
|
properties: {},
|
|
208685
208753
|
additionalProperties: false
|
|
208686
208754
|
},
|
|
208687
208755
|
execute: async (_args, _signal, context2) => {
|
|
208756
|
+
if (state2.skipped)
|
|
208757
|
+
return skippedCardResult(state2.resultRefs);
|
|
208688
208758
|
state2.executionId = context2?.toolCallId;
|
|
208689
208759
|
this.observeCard(context2, resource, config2, "prepare", state2.executionId);
|
|
208690
208760
|
for (const candidate of this.states.values())
|
|
@@ -208692,6 +208762,7 @@ var init_cardRenderMcpServer = __esm({
|
|
|
208692
208762
|
this.activeCardId = resource.resourceId;
|
|
208693
208763
|
state2.selected = true;
|
|
208694
208764
|
state2.results.clear();
|
|
208765
|
+
state2.resultRefs.clear();
|
|
208695
208766
|
return {
|
|
208696
208767
|
status: "selected",
|
|
208697
208768
|
card: resource.resourceId,
|
|
@@ -208720,7 +208791,7 @@ var init_cardRenderMcpServer = __esm({
|
|
|
208720
208791
|
modelName: sourceToolName,
|
|
208721
208792
|
resourceId: resource.resourceId,
|
|
208722
208793
|
label: source.purpose,
|
|
208723
|
-
description: `\u9009\u62E9 ${name} \u540E\u4F7F\u7528\u3002${source.purpose}\u3002\u6839\u636E\u5BF9\u8BDD\u548C\u5DF2\u6709\u6570\u636E\u6E90\u7ED3\u679C\u786E\u5B9A\u6240\u6709 MCP \u53C2\u6570\u3002${CARD_SEQUENCE}`,
|
|
208794
|
+
description: `\u9009\u62E9 ${name} \u540E\u4F7F\u7528\u3002${source.purpose}\u3002\u6839\u636E\u5BF9\u8BDD\u548C\u5DF2\u6709\u6570\u636E\u6E90\u7ED3\u679C\u786E\u5B9A\u6240\u6709 MCP \u53C2\u6570\u3002\u53EF\u9009\u53C2\u6570\u4E0D\u9700\u8981\u65F6\u76F4\u63A5\u7701\u7565\uFF0C\u4E0D\u4F20\u7A7A\u5BF9\u8C61\uFF1B\u53EF\u9009\u5BF9\u8C61\u6216\u6570\u7EC4\u7684\u5B50\u5B57\u6BB5\u4EC5\u5728\u7236\u5B57\u6BB5\u5B58\u5728\u65F6\u624D\u8981\u6C42\u586B\u5199\u3002\u679A\u4E3E\u5B57\u6BB5\u5FC5\u987B\u4F7F\u7528 Schema \u5217\u51FA\u7684\u539F\u503C\u548C\u5927\u5C0F\u5199\u3002\u65E5\u671F\u672A\u7ED9\u5E74\u4EFD\u65F6\u5148\u786E\u8BA4\u5F53\u524D\u65E5\u671F\uFF0C\u9009\u62E9\u5C1A\u672A\u8FC7\u53BB\u7684\u5BF9\u5E94\u65E5\u671F\uFF0C\u4E0D\u8981\u731C\u6D4B\u4E3A\u4E0A\u4E00\u5E74\uFF1B\u91CD\u8BD5\u65F6\u4FDD\u7559\u7528\u6237\u6307\u5B9A\u7684\u65E5\u671F\uFF0C\u4E0D\u5F97\u7701\u7565\u6216\u6539\u6210\u5176\u4ED6\u65E5\u671F\u3002${CARD_SEQUENCE}`,
|
|
208724
208795
|
inputSchema: normalizeMcpInputSchema(discoveredHandle?.inputSchema),
|
|
208725
208796
|
outputSchema: CARD_SOURCE_RECEIPT_SCHEMA,
|
|
208726
208797
|
execute: async (args, signal, context2) => {
|
|
@@ -208773,6 +208844,7 @@ var init_cardRenderMcpServer = __esm({
|
|
|
208773
208844
|
...cacheEntry,
|
|
208774
208845
|
executionId
|
|
208775
208846
|
});
|
|
208847
|
+
state2.resultRefs.set(source.sourceId, cacheEntry.resultRef);
|
|
208776
208848
|
this.logMetric(() => `source=${source.sourceId} mcpMs=${projectionStartedAt - mcpStartedAt} projectionMs=${Date.now() - projectionStartedAt} rawBytes=${byteLength(structured)} receiptBytes=${byteLength(receipt)}`);
|
|
208777
208849
|
return receipt;
|
|
208778
208850
|
}
|
|
@@ -208806,7 +208878,7 @@ var init_cardRenderMcpServer = __esm({
|
|
|
208806
208878
|
modelName: finishName,
|
|
208807
208879
|
resourceId: resource.resourceId,
|
|
208808
208880
|
label: `\u5C55\u793A${config2.displayName}`,
|
|
208809
|
-
description: `\u6240\u6709\u5FC5\u9700\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\u6210\u529F\u540E\uFF0C\u5B8C\u6210\u5E76\u5C55\u793A${config2.displayName}\u3002${CARD_SEQUENCE}
|
|
208881
|
+
description: `\u6240\u6709\u5FC5\u9700\u7684 card_source \u6570\u636E\u6E90\u5DE5\u5177\u6210\u529F\u540E\uFF0C\u5B8C\u6210\u5E76\u5C55\u793A${config2.displayName}\u3002\u82E5\u8FD4\u56DE card_skipped\uFF0C\u4E0D\u8981\u91CD\u8BD5\u5361\u7247\u6216 MCP\uFF1B\u8BFB\u53D6\u5DF2\u6709\u7F13\u5B58\u5E76\u4F9D\u636E\u771F\u5B9E\u7ED3\u679C\u7528 Markdown \u56DE\u7B54\uFF0C\u4E0D\u5411\u7528\u6237\u63D0\u53CA\u5361\u7247\u6E32\u67D3\u6216\u6280\u672F\u95EE\u9898\u3002${CARD_SEQUENCE}
|
|
208810
208882
|
${AFTER_CARD_DESCRIPTION}`,
|
|
208811
208883
|
inputSchema: {
|
|
208812
208884
|
type: "object",
|
|
@@ -208830,8 +208902,22 @@ ${AFTER_CARD_DESCRIPTION}`,
|
|
|
208830
208902
|
if (!state2.selected || this.activeCardId !== resource.resourceId)
|
|
208831
208903
|
throw new Error(`\u5B8C\u6210\u5C55\u793A\u524D\uFF0C\u8BF7\u5148\u9009\u62E9\u5361\u7247 ${name}`);
|
|
208832
208904
|
const afterCard = readAfterCard(args);
|
|
208905
|
+
if (config2.dataSources.some((source) => source.required && !state2.results.has(source.sourceId))) {
|
|
208906
|
+
throw new Error("\u5FC5\u9700\u7684\u6570\u636E\u6E90\u5C1A\u672A\u6210\u529F\uFF0C\u4E0D\u80FD\u751F\u6210\u5361\u7247");
|
|
208907
|
+
}
|
|
208833
208908
|
const finishStartedAt = Date.now();
|
|
208834
|
-
|
|
208909
|
+
let result;
|
|
208910
|
+
try {
|
|
208911
|
+
result = await executeCardPresentationFromSources(resource, this.runtimeContext, state2.results, signal);
|
|
208912
|
+
} catch (error40) {
|
|
208913
|
+
if (signal?.aborted)
|
|
208914
|
+
throw error40;
|
|
208915
|
+
state2.selected = false;
|
|
208916
|
+
state2.skipped = true;
|
|
208917
|
+
this.activeCardId = void 0;
|
|
208918
|
+
this.logMetric(`card=${resource.resourceId} finishMs=${Date.now() - finishStartedAt} status=skipped code=${error40 instanceof CardMappingError ? error40.details.code : "CARD_PRESENTATION_FAILED"}`);
|
|
208919
|
+
return skippedCardResult(state2.resultRefs);
|
|
208920
|
+
}
|
|
208835
208921
|
if (context2?.observation)
|
|
208836
208922
|
this.deliveries.set(result.card, context2.observation);
|
|
208837
208923
|
if (afterCard !== void 0) {
|
|
@@ -210682,9 +210768,113 @@ var init_defaultHarnessPromptPlugin = __esm({
|
|
|
210682
210768
|
}
|
|
210683
210769
|
});
|
|
210684
210770
|
|
|
210771
|
+
// ../linkque-agent-runtime/dist/esm/impl/plugin/currentTimePlugin.js
|
|
210772
|
+
function createCurrentTimeTool() {
|
|
210773
|
+
return {
|
|
210774
|
+
name: CURRENT_TIME_TOOL_NAME,
|
|
210775
|
+
modelName: CURRENT_TIME_TOOL_NAME,
|
|
210776
|
+
label: "\u5F53\u524D\u65F6\u95F4",
|
|
210777
|
+
description: "\u67E5\u8BE2\u5F53\u524D\u65E5\u671F\u3001\u65F6\u95F4\u3001\u661F\u671F\u548C\u65F6\u533A\uFF0C\u4E3A\u6D89\u53CA\u65F6\u95F4\u7684\u63D0\u95EE\u4E0E\u4EFB\u52A1\u63D0\u4F9B\u5B9E\u65F6\u57FA\u51C6\u3002\u4F7F\u7528\u573A\u666F\uFF1A\u7528\u6237\u8BE2\u95EE\u73B0\u5728\u51E0\u70B9\u3001\u4ECA\u5929\u51E0\u53F7\u6216\u661F\u671F\u51E0\uFF1B\u9700\u8981\u628A\u201C\u4ECA\u5929\uFF0F\u660E\u5929\uFF0F\u672C\u5468\uFF0F\u6700\u8FD1\u201D\u7B49\u76F8\u5BF9\u65F6\u95F4\u8F6C\u6210\u5177\u4F53\u65E5\u671F\uFF1B\u8FDB\u884C\u4EFB\u52A1\u89C4\u5212\u3001\u6392\u671F\u3001\u622A\u6B62\u65F6\u95F4\u6216\u5269\u4F59\u65F6\u957F\u8BA1\u7B97\u3001\u5224\u65AD\u662F\u5426\u8FC7\u671F\uFF0C\u6216\u4E3A\u641C\u7D22\u786E\u5B9A\u76F8\u5BF9\u65F6\u95F4\u8303\u56F4\u65F6\uFF0C\u5E94\u5148\u8C03\u7528\u672C\u5DE5\u5177\u3002\u7528\u6237\u65E0\u9700\u660E\u786E\u6307\u5B9A\u5DE5\u5177\u540D\u3002\u4E0D\u8981\u5C06\u8BAD\u7EC3\u77E5\u8BC6\u3001\u5386\u53F2\u6D88\u606F\u65F6\u95F4\u6216\u5148\u524D\u5DE5\u5177\u7ED3\u679C\u5F53\u4F5C\u5F53\u524D\u65F6\u95F4\uFF1B\u957F\u4EFB\u52A1\u518D\u6B21\u4F9D\u8D56\u201C\u73B0\u5728\u201D\u65F6\u5E94\u91CD\u65B0\u67E5\u8BE2\u3002timeZone \u53EF\u9009\uFF0C\u4F7F\u7528 IANA \u65F6\u533A\u540D\u79F0\uFF0C\u4F8B\u5982 Asia/Shanghai\u3001America/New_York\uFF1B\u9ED8\u8BA4 Asia/Shanghai\uFF08\u5317\u4EAC\u65F6\u95F4\uFF09\uFF0C\u4E0D\u4EE3\u8868\u5DF2\u8BC6\u522B\u7528\u6237\u6240\u5728\u5730\u3002\u7528\u6237\u6307\u5B9A\u5176\u4ED6\u65F6\u533A\u65F6\u5E94\u4F20\u5165\u5BF9\u5E94\u65F6\u533A\uFF1B\u4EFB\u52A1\u5BF9\u65F6\u533A\u654F\u611F\u4E14\u7528\u6237\u6240\u5728\u5730\u4E0D\u660E\u65F6\u5E94\u786E\u8BA4\u65F6\u533A\u3002\u8FD4\u56DE\u6307\u5B9A\u65F6\u533A\u7684\u65E5\u671F\u65F6\u95F4\u3001\u661F\u671F\u548C UTC \u504F\u79FB\uFF0C\u4EE5\u53CA UTC \u65F6\u95F4\u548C\u6BEB\u79D2\u65F6\u95F4\u6233\u3002\u4EC5\u67E5\u8BE2\u65F6\u95F4\uFF0C\u4E0D\u521B\u5EFA\u63D0\u9192\u6216\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u4E5F\u4E0D\u9A8C\u8BC1\u65B0\u95FB\u7B49\u4E8B\u5B9E\u662F\u5426\u6700\u65B0\uFF1B\u5DF2\u6709\u660E\u786E\u65E5\u671F\u4E14\u4E0D\u4F9D\u8D56\u5F53\u524D\u65F6\u95F4\u7684\u8BA1\u7B97\u65E0\u9700\u8C03\u7528\u3002",
|
|
210778
|
+
inputSchema: {
|
|
210779
|
+
type: "object",
|
|
210780
|
+
properties: {
|
|
210781
|
+
timeZone: {
|
|
210782
|
+
type: "string",
|
|
210783
|
+
minLength: 1,
|
|
210784
|
+
description: "IANA \u65F6\u533A\u540D\u79F0\uFF0C\u9ED8\u8BA4 Asia/Shanghai"
|
|
210785
|
+
}
|
|
210786
|
+
},
|
|
210787
|
+
additionalProperties: false
|
|
210788
|
+
},
|
|
210789
|
+
annotations: { readOnlyHint: true },
|
|
210790
|
+
execute: async (args, signal) => {
|
|
210791
|
+
signal?.throwIfAborted();
|
|
210792
|
+
if (typeof args !== "object" || args === null || Array.isArray(args) || Object.keys(args).some((key) => key !== "timeZone"))
|
|
210793
|
+
throw new Error("\u53C2\u6570\u5FC5\u987B\u662F\u4EC5\u5305\u542B\u53EF\u9009 timeZone \u7684\u5BF9\u8C61");
|
|
210794
|
+
const requested = args.timeZone;
|
|
210795
|
+
if (requested !== void 0 && (typeof requested !== "string" || !requested.trim()))
|
|
210796
|
+
throw new Error("timeZone \u5FC5\u987B\u662F\u6709\u6548\u7684 IANA \u65F6\u533A\u540D\u79F0");
|
|
210797
|
+
const timeZone = typeof requested === "string" ? requested.trim() : "Asia/Shanghai";
|
|
210798
|
+
const formatter = new Intl.DateTimeFormat("zh-CN", {
|
|
210799
|
+
timeZone,
|
|
210800
|
+
calendar: "gregory",
|
|
210801
|
+
numberingSystem: "latn",
|
|
210802
|
+
year: "numeric",
|
|
210803
|
+
month: "2-digit",
|
|
210804
|
+
day: "2-digit",
|
|
210805
|
+
hour: "2-digit",
|
|
210806
|
+
minute: "2-digit",
|
|
210807
|
+
second: "2-digit",
|
|
210808
|
+
hourCycle: "h23",
|
|
210809
|
+
weekday: "long",
|
|
210810
|
+
timeZoneName: "longOffset"
|
|
210811
|
+
});
|
|
210812
|
+
const now = /* @__PURE__ */ new Date();
|
|
210813
|
+
const parts = Object.fromEntries(formatter.formatToParts(now).map((part) => [part.type, part.value]));
|
|
210814
|
+
return {
|
|
210815
|
+
timeZone: formatter.resolvedOptions().timeZone,
|
|
210816
|
+
date: `${parts.year}-${parts.month}-${parts.day}`,
|
|
210817
|
+
time: `${parts.hour}:${parts.minute}:${parts.second}`,
|
|
210818
|
+
weekday: parts.weekday,
|
|
210819
|
+
utcOffset: parts.timeZoneName === "GMT" ? "+00:00" : parts.timeZoneName.replace("GMT", ""),
|
|
210820
|
+
utc: now.toISOString(),
|
|
210821
|
+
timestampMs: now.getTime()
|
|
210822
|
+
};
|
|
210823
|
+
}
|
|
210824
|
+
};
|
|
210825
|
+
}
|
|
210826
|
+
var CURRENT_TIME_PLUGIN_NAME, CURRENT_TIME_TOOL_NAME, CurrentTimePlugin;
|
|
210827
|
+
var init_currentTimePlugin = __esm({
|
|
210828
|
+
"../linkque-agent-runtime/dist/esm/impl/plugin/currentTimePlugin.js"() {
|
|
210829
|
+
"use strict";
|
|
210830
|
+
init_esm();
|
|
210831
|
+
CURRENT_TIME_PLUGIN_NAME = "current-time";
|
|
210832
|
+
CURRENT_TIME_TOOL_NAME = "get_current_time";
|
|
210833
|
+
CurrentTimePlugin = class {
|
|
210834
|
+
name = CURRENT_TIME_PLUGIN_NAME;
|
|
210835
|
+
hookExecutorList = [
|
|
210836
|
+
{
|
|
210837
|
+
name: EHookExecutorName.CurrentTimeHookExecutor,
|
|
210838
|
+
matches: (_resource, stage) => stage === EHookStage.PREPARE_AGENT_LOOP,
|
|
210839
|
+
execute: async (_resource, context2) => context2.stage === EHookStage.PREPARE_AGENT_LOOP ? {
|
|
210840
|
+
ok: true,
|
|
210841
|
+
patch: {
|
|
210842
|
+
stage: EHookStage.PREPARE_AGENT_LOOP,
|
|
210843
|
+
additionalTools: [createCurrentTimeTool()]
|
|
210844
|
+
}
|
|
210845
|
+
} : { ok: true, skipped: true }
|
|
210846
|
+
}
|
|
210847
|
+
];
|
|
210848
|
+
modifyAgentConfig = (config2) => {
|
|
210849
|
+
const existing = config2.agent.resources.filter((resource) => resource.resourceType === EResourceType.HOOK && resource.config.executorName === EHookExecutorName.CurrentTimeHookExecutor);
|
|
210850
|
+
if (existing.length) {
|
|
210851
|
+
const hook = existing[0].config;
|
|
210852
|
+
if (existing.length !== 1 || hook.stage !== EHookStage.PREPARE_AGENT_LOOP || hook.hasSideEffects !== true || hook.enabled === false || hook.matcher !== void 0)
|
|
210853
|
+
throw new Error("\u5F53\u524D\u65F6\u95F4 Hook \u5FC5\u987B\u542F\u7528 PREPARE_AGENT_LOOP + hasSideEffects=true\uFF0C\u4E14\u4E0D\u914D\u7F6E matcher");
|
|
210854
|
+
return;
|
|
210855
|
+
}
|
|
210856
|
+
config2.agent.resources.push({
|
|
210857
|
+
resourceId: "current-time-prepare-agent-loop",
|
|
210858
|
+
resourceType: EResourceType.HOOK,
|
|
210859
|
+
providerType: EResourceProviderType.LINK_QUE,
|
|
210860
|
+
config: {
|
|
210861
|
+
name: "\u5F53\u524D\u65F6\u95F4\u5DE5\u5177\u6CE8\u5165",
|
|
210862
|
+
executorName: EHookExecutorName.CurrentTimeHookExecutor,
|
|
210863
|
+
stage: EHookStage.PREPARE_AGENT_LOOP,
|
|
210864
|
+
hasSideEffects: true
|
|
210865
|
+
}
|
|
210866
|
+
});
|
|
210867
|
+
};
|
|
210868
|
+
};
|
|
210869
|
+
}
|
|
210870
|
+
});
|
|
210871
|
+
|
|
210685
210872
|
// ../linkque-agent-runtime/dist/esm/impl/plugin/index.js
|
|
210686
210873
|
var plugin_exports = {};
|
|
210687
210874
|
__export(plugin_exports, {
|
|
210875
|
+
CURRENT_TIME_PLUGIN_NAME: () => CURRENT_TIME_PLUGIN_NAME,
|
|
210876
|
+
CURRENT_TIME_TOOL_NAME: () => CURRENT_TIME_TOOL_NAME,
|
|
210877
|
+
CurrentTimePlugin: () => CurrentTimePlugin,
|
|
210688
210878
|
DEFAULT_HARNESS_PROMPT: () => DEFAULT_HARNESS_PROMPT,
|
|
210689
210879
|
DEFAULT_HARNESS_PROMPT_PLUGIN_NAME: () => DEFAULT_HARNESS_PROMPT_PLUGIN_NAME,
|
|
210690
210880
|
DefaultHarnessPromptPlugin: () => DefaultHarnessPromptPlugin,
|
|
@@ -210708,6 +210898,7 @@ var init_plugin = __esm({
|
|
|
210708
210898
|
init_linkquegwEventPlugin();
|
|
210709
210899
|
init_mcpDiscoveryPlugin();
|
|
210710
210900
|
init_defaultHarnessPromptPlugin();
|
|
210901
|
+
init_currentTimePlugin();
|
|
210711
210902
|
}
|
|
210712
210903
|
});
|
|
210713
210904
|
|
|
@@ -216424,7 +216615,7 @@ function createArgsMappingPlan(toolName, args, rules) {
|
|
|
216424
216615
|
continue;
|
|
216425
216616
|
}
|
|
216426
216617
|
if (rule.valueType === EArgsMappingValueType.DEFAULT) {
|
|
216427
|
-
if (getByPath(out, segments) === void 0) {
|
|
216618
|
+
if (rule.value !== void 0 && getByPath(out, segments) === void 0) {
|
|
216428
216619
|
setByPath(out, segments, rule.value);
|
|
216429
216620
|
}
|
|
216430
216621
|
continue;
|
|
@@ -219911,7 +220102,8 @@ var main = async () => {
|
|
|
219911
220102
|
...linkqueBaseUrl ? { baseUrl: linkqueBaseUrl } : {},
|
|
219912
220103
|
allowSandboxAccessKeyPlaceholder: true
|
|
219913
220104
|
}),
|
|
219914
|
-
new pluginModule.McpDiscoveryPlugin()
|
|
220105
|
+
new pluginModule.McpDiscoveryPlugin(),
|
|
220106
|
+
new pluginModule.CurrentTimePlugin()
|
|
219915
220107
|
];
|
|
219916
220108
|
const buildSkillLoader = () => new WebSkillLoader({
|
|
219917
220109
|
root: input.cwd,
|