linkque-cli-v2 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/linkquejs.js +1 -1
- package/package.json +2 -2
- package/worker.js +3 -37
package/README.md
CHANGED
package/linkquejs.js
CHANGED
|
@@ -31602,5 +31602,5 @@ var runCliFromProcess = () => {
|
|
|
31602
31602
|
});
|
|
31603
31603
|
};
|
|
31604
31604
|
|
|
31605
|
-
// scripts/
|
|
31605
|
+
// scripts/publicEntry.ts
|
|
31606
31606
|
void runCliFromProcess();
|
package/package.json
CHANGED
package/worker.js
CHANGED
|
@@ -12027,21 +12027,6 @@ function getJsonSchemaIssues(value, path6 = "schema") {
|
|
|
12027
12027
|
function isObjectJsonSchema(value) {
|
|
12028
12028
|
return isPlainRecord(value) && value.type === "object" && getJsonSchemaIssues(value).length === 0;
|
|
12029
12029
|
}
|
|
12030
|
-
function validateJsonSchemaValue(schema, value, path6 = "$") {
|
|
12031
|
-
let validate;
|
|
12032
|
-
try {
|
|
12033
|
-
validate = ajv.compile(schema);
|
|
12034
|
-
} catch (error40) {
|
|
12035
|
-
return [
|
|
12036
|
-
issue(path6, "INVALID_JSON_SCHEMA", error40 instanceof Error ? error40.message : "schema is invalid")
|
|
12037
|
-
];
|
|
12038
|
-
}
|
|
12039
|
-
return validate(value) ? [] : (validate.errors ?? []).map(errorToIssue.bind(null, path6));
|
|
12040
|
-
}
|
|
12041
|
-
function errorToIssue(root, error40) {
|
|
12042
|
-
const suffix = error40.instancePath.split("/").filter(Boolean).map((segment) => segment.replace(/~1/gu, "/").replace(/~0/gu, "~")).map((segment) => `[${JSON.stringify(segment)}]`).join("");
|
|
12043
|
-
return issue(`${root}${suffix}`, "JSON_SCHEMA_VALUE_INVALID", error40.message ?? "value does not match schema");
|
|
12044
|
-
}
|
|
12045
12030
|
var import_ajv, AjvConstructor, ajv;
|
|
12046
12031
|
var init_schema = __esm({
|
|
12047
12032
|
"../linkque-agent-data-binding-contract/dist/esm/schema.js"() {
|
|
@@ -15836,14 +15821,6 @@ async function executeHomeData(input) {
|
|
|
15836
15821
|
if (!handle) {
|
|
15837
15822
|
return failure("TOOL_NOT_ALLOWED", "MCP \u5DE5\u5177\u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u7528", false);
|
|
15838
15823
|
}
|
|
15839
|
-
if (handle.readOnly !== true) {
|
|
15840
|
-
return failure("TOOL_NOT_READ_ONLY", "\u9996\u9875\u5361\u7247\u53EA\u80FD\u8C03\u7528\u660E\u786E\u58F0\u660E\u4E3A\u53EA\u8BFB\u7684\u5DE5\u5177", false);
|
|
15841
|
-
}
|
|
15842
|
-
const inputSchema = cloneJsonObject(handle.inputSchema);
|
|
15843
|
-
const outputSchema = cloneJsonObject(handle.outputSchema);
|
|
15844
|
-
if (!inputSchema || !outputSchema) {
|
|
15845
|
-
return failure("INVALID_OUTPUT", "\u9996\u9875\u5361\u7247\u8981\u6C42 MCP \u5DE5\u5177\u58F0\u660E\u5B8C\u6574\u7684\u8F93\u5165\u548C\u8F93\u51FA Schema", false);
|
|
15846
|
-
}
|
|
15847
15824
|
const toolInput = {};
|
|
15848
15825
|
for (const mapping of request.binding.input) {
|
|
15849
15826
|
let value;
|
|
@@ -15862,10 +15839,6 @@ async function executeHomeData(input) {
|
|
|
15862
15839
|
return failure("INVALID_INPUT", `\u65E0\u6CD5\u751F\u6210 MCP \u5165\u53C2 ${mapping.target}`, false);
|
|
15863
15840
|
}
|
|
15864
15841
|
}
|
|
15865
|
-
const inputIssues = validateJsonSchemaValue(inputSchema, toolInput);
|
|
15866
|
-
if (inputIssues.length > 0) {
|
|
15867
|
-
return failure("INVALID_INPUT", inputIssues[0].message, false);
|
|
15868
|
-
}
|
|
15869
15842
|
let result;
|
|
15870
15843
|
try {
|
|
15871
15844
|
result = await handle.execute(toolInput, input.signal);
|
|
@@ -15873,10 +15846,6 @@ async function executeHomeData(input) {
|
|
|
15873
15846
|
return failure("EXECUTION_FAILED", error40 instanceof Error ? error40.message : "MCP \u5DE5\u5177\u8C03\u7528\u5931\u8D25", true);
|
|
15874
15847
|
}
|
|
15875
15848
|
const structured = readStructuredContent2(result);
|
|
15876
|
-
const outputIssues = validateJsonSchemaValue(outputSchema, structured);
|
|
15877
|
-
if (outputIssues.length > 0) {
|
|
15878
|
-
return failure("INVALID_OUTPUT", outputIssues[0].message, false);
|
|
15879
|
-
}
|
|
15880
15849
|
let cardData = structured;
|
|
15881
15850
|
if (request.binding.transform) {
|
|
15882
15851
|
try {
|
|
@@ -15889,10 +15858,6 @@ async function executeHomeData(input) {
|
|
|
15889
15858
|
if (!cardDataObject) {
|
|
15890
15859
|
return failure("INVALID_CARD_DATA", "\u9996\u9875\u5361\u7247\u6570\u636E\u5FC5\u987B\u662F JSON object", false);
|
|
15891
15860
|
}
|
|
15892
|
-
const cardIssues = validateJsonSchemaValue(request.dataSchema, cardDataObject);
|
|
15893
|
-
if (cardIssues.length > 0) {
|
|
15894
|
-
return failure("INVALID_CARD_DATA", cardIssues[0].message, false);
|
|
15895
|
-
}
|
|
15896
15861
|
return { ok: true, data: cardDataObject };
|
|
15897
15862
|
} finally {
|
|
15898
15863
|
await registry2.closeAll();
|
|
@@ -197271,12 +197236,13 @@ var handleHomeData = async (req, res, input) => {
|
|
|
197271
197236
|
var parseHomeDataProxyInput = (value) => {
|
|
197272
197237
|
const trustedContext = isRecord6(value) ? value[HOME_DATA_TRUSTED_CONTEXT_FIELD] : void 0;
|
|
197273
197238
|
const trustedUserId = isRecord6(trustedContext) ? trustedContext.userId : void 0;
|
|
197274
|
-
|
|
197239
|
+
const normalizedUserId = typeof trustedUserId === "string" ? trustedUserId.trim() : "";
|
|
197240
|
+
if (!isRecord6(value) || !normalizedUserId) {
|
|
197275
197241
|
throw new Error("home-data trusted user is invalid");
|
|
197276
197242
|
}
|
|
197277
197243
|
const request = { ...value };
|
|
197278
197244
|
delete request[HOME_DATA_TRUSTED_CONTEXT_FIELD];
|
|
197279
|
-
return { request, userId:
|
|
197245
|
+
return { request, userId: normalizedUserId };
|
|
197280
197246
|
};
|
|
197281
197247
|
var isRecord6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
197282
197248
|
var errorMessage2 = (error40) => error40 instanceof Error ? error40.message : "unknown agent error";
|