@easynet/agent-tool 1.0.87 → 1.0.89
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/dist/api/adapters/LangChainToolsHub.d.ts.map +1 -1
- package/dist/api/expose/mcpServer.d.ts.map +1 -1
- package/dist/{chunk-PJDINB7G.cjs → chunk-AK3C5LLW.cjs} +68 -7
- package/dist/chunk-AK3C5LLW.cjs.map +1 -0
- package/dist/{chunk-BBNQ6AWK.js → chunk-GAC3N3KH.js} +66 -6
- package/dist/chunk-GAC3N3KH.js.map +1 -0
- package/dist/core/runtime/PTCRuntime.d.ts.map +1 -1
- package/dist/core/runtime/toolObservation.d.ts +7 -0
- package/dist/core/runtime/toolObservation.d.ts.map +1 -0
- package/dist/core/types/ToolResult.d.ts +9 -0
- package/dist/core/types/ToolResult.d.ts.map +1 -1
- package/dist/index.cjs +11 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -13
- package/dist/index.js.map +1 -1
- package/dist/utils/cli/index.cjs +12 -12
- package/dist/utils/cli/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-BBNQ6AWK.js.map +0 -1
- package/dist/chunk-PJDINB7G.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LangChainToolsHub.d.ts","sourceRoot":"","sources":["../../../src/api/adapters/LangChainToolsHub.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAyB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"LangChainToolsHub.d.ts","sourceRoot":"","sources":["../../../src/api/adapters/LangChainToolsHub.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAyB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AA0DlE,MAAM,MAAM,kBAAkB,GAAG,MAAM,WAAW,CAAC;AAiBnD;;;;GAIG;AACH,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,OAAO,EAAE,UAAU,EACnB,UAAU,GAAE,kBAAwC;IAGvE;;;OAGG;IACH,iBAAiB,IAAI,uBAAuB,EAAE;IAO9C;;OAEG;IACH,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,uBAAuB,EAAE;IAOzE,OAAO,CAAC,mBAAmB;CAmB5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../../src/api/expose/mcpServer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../../src/api/expose/mcpServer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAA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AO,CAAC,eAAe,CAAC,CAAC;AAuB5B;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,gBAAgB,GACzB,wBAAwB,CAAC;AAE5B,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAsCrC,MAAM,WAAW,oCAAqC,SAAQ,gBAAgB;IAC5E,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,oCAAoC,GAC7C,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAE1C,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE,oCAAoC,GAC7C,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAqC1C;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,UAAU,EACnB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAI1B"}
|
|
@@ -1655,6 +1655,7 @@ var PTCRuntime = class {
|
|
|
1655
1655
|
});
|
|
1656
1656
|
}
|
|
1657
1657
|
const validatedOutput = validateOutput(pipeline.spec, pipeline.result, this.validator);
|
|
1658
|
+
const toolFeedback = asToolReturnedFeedback(validatedOutput);
|
|
1658
1659
|
const durationMs = Date.now() - startTime;
|
|
1659
1660
|
const builtEvidence = buildEvidence({
|
|
1660
1661
|
spec: pipeline.spec,
|
|
@@ -1678,6 +1679,7 @@ var PTCRuntime = class {
|
|
|
1678
1679
|
return {
|
|
1679
1680
|
ok: true,
|
|
1680
1681
|
result: validatedOutput,
|
|
1682
|
+
feedback: toolFeedback ?? void 0,
|
|
1681
1683
|
evidence,
|
|
1682
1684
|
raw: this.config.includeRaw !== false ? pipeline.raw : void 0
|
|
1683
1685
|
};
|
|
@@ -1720,6 +1722,25 @@ function asToolReturnedError(result) {
|
|
|
1720
1722
|
}
|
|
1721
1723
|
return { message: msg.trim(), details: r.details };
|
|
1722
1724
|
}
|
|
1725
|
+
function asToolReturnedFeedback(result) {
|
|
1726
|
+
if (result == null || typeof result !== "object" || Array.isArray(result)) return null;
|
|
1727
|
+
const rec = result;
|
|
1728
|
+
const feedbackRaw = rec.feedback;
|
|
1729
|
+
if (!feedbackRaw || typeof feedbackRaw !== "object" || Array.isArray(feedbackRaw)) return null;
|
|
1730
|
+
const feedback = feedbackRaw;
|
|
1731
|
+
const status = typeof feedback.status === "string" ? feedback.status.trim() : "";
|
|
1732
|
+
const allowed = /* @__PURE__ */ new Set(["resolved", "needs_retry", "needs_input", "blocked"]);
|
|
1733
|
+
if (!allowed.has(status)) return null;
|
|
1734
|
+
const message = typeof feedback.message === "string" ? feedback.message.trim() : "";
|
|
1735
|
+
if (!message) return null;
|
|
1736
|
+
return {
|
|
1737
|
+
status,
|
|
1738
|
+
message,
|
|
1739
|
+
hint: typeof feedback.hint === "string" ? feedback.hint : void 0,
|
|
1740
|
+
suggested_intent_patch: feedback.suggested_intent_patch && typeof feedback.suggested_intent_patch === "object" && !Array.isArray(feedback.suggested_intent_patch) ? feedback.suggested_intent_patch : void 0,
|
|
1741
|
+
suggested_tool_args: feedback.suggested_tool_args && typeof feedback.suggested_tool_args === "object" && !Array.isArray(feedback.suggested_tool_args) ? feedback.suggested_tool_args : void 0
|
|
1742
|
+
};
|
|
1743
|
+
}
|
|
1723
1744
|
function buildInputSchemaHint(inputSchema) {
|
|
1724
1745
|
const schema = inputSchema;
|
|
1725
1746
|
const required = schema.required;
|
|
@@ -1730,7 +1751,7 @@ function buildInputSchemaHint(inputSchema) {
|
|
|
1730
1751
|
if (names.length === 0) return null;
|
|
1731
1752
|
return `This tool expects input property ${names.length === 1 ? `'${names[0]}'` : `one of [${names.map((n) => `'${n}'`).join(", ")}]`}. Use the exact property names from the tool schema.`;
|
|
1732
1753
|
}
|
|
1733
|
-
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1754
|
+
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-AK3C5LLW.cjs', document.baseURI).href)));
|
|
1734
1755
|
function getProjectRequire() {
|
|
1735
1756
|
const cwd = process.cwd();
|
|
1736
1757
|
if (fs.existsSync(path.join(cwd, "package.json"))) return module$1.createRequire(path.join(cwd, "package.json"));
|
|
@@ -1896,7 +1917,7 @@ function parseNpmDescriptor(entry) {
|
|
|
1896
1917
|
}
|
|
1897
1918
|
|
|
1898
1919
|
// src/api/runtimeFromConfig.ts
|
|
1899
|
-
var requireFromPackage2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1920
|
+
var requireFromPackage2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-AK3C5LLW.cjs', document.baseURI).href)));
|
|
1900
1921
|
var DEFAULT_EXTENSION_PACKAGES = [];
|
|
1901
1922
|
function resolveFileDescriptorPath(descriptor, configFilePath) {
|
|
1902
1923
|
const parsed = parseToolPath(descriptor.trim());
|
|
@@ -2208,6 +2229,46 @@ async function createRuntimeFromConfig(options = {}) {
|
|
|
2208
2229
|
return createRuntimeFromConfigSync(options);
|
|
2209
2230
|
}
|
|
2210
2231
|
|
|
2232
|
+
// src/core/runtime/toolObservation.ts
|
|
2233
|
+
var PTC_FEEDBACK_MARKER = "__PTC_FEEDBACK__:";
|
|
2234
|
+
function tryStringify(value) {
|
|
2235
|
+
if (typeof value === "string") return value;
|
|
2236
|
+
try {
|
|
2237
|
+
return JSON.stringify(value);
|
|
2238
|
+
} catch {
|
|
2239
|
+
return String(value);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
function extractObservationText(value) {
|
|
2243
|
+
if (!value || typeof value !== "object") return null;
|
|
2244
|
+
const record = value;
|
|
2245
|
+
const nested = record.result;
|
|
2246
|
+
if (nested && typeof nested === "object" && typeof nested.output === "string") {
|
|
2247
|
+
return nested.output;
|
|
2248
|
+
}
|
|
2249
|
+
if (typeof record.output === "string") return record.output;
|
|
2250
|
+
return null;
|
|
2251
|
+
}
|
|
2252
|
+
function encodeFeedback(feedback, includeFeedbackMarker) {
|
|
2253
|
+
if (!includeFeedbackMarker || !feedback) return "";
|
|
2254
|
+
return `${PTC_FEEDBACK_MARKER}${tryStringify(feedback)}
|
|
2255
|
+
`;
|
|
2256
|
+
}
|
|
2257
|
+
function toToolObservationText(result, opts = {}) {
|
|
2258
|
+
const includeFeedbackMarker = opts.includeFeedbackMarker === true;
|
|
2259
|
+
if (result.ok) {
|
|
2260
|
+
const prefix = encodeFeedback(result.feedback, includeFeedbackMarker);
|
|
2261
|
+
if (typeof result.result === "string") return `${prefix}${result.result}`;
|
|
2262
|
+
const observation = extractObservationText(result.result);
|
|
2263
|
+
if (observation != null) return `${prefix}${observation}`;
|
|
2264
|
+
return `${prefix}${tryStringify(result.result)}`;
|
|
2265
|
+
}
|
|
2266
|
+
const err = result.error;
|
|
2267
|
+
const message = err?.message ?? "Tool failed";
|
|
2268
|
+
const details = err?.details;
|
|
2269
|
+
return tryStringify(details != null ? { error: message, kind: err?.kind, details } : { error: message, kind: err?.kind });
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2211
2272
|
// src/api/expose/mcpServer.ts
|
|
2212
2273
|
var DEFAULT_CTX = {
|
|
2213
2274
|
requestId: `mcp-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
@@ -2250,14 +2311,13 @@ async function createMcpServerWithTools(runtime, options) {
|
|
|
2250
2311
|
ctx
|
|
2251
2312
|
);
|
|
2252
2313
|
if (result.ok) {
|
|
2253
|
-
return { content: [{ type: "text", text:
|
|
2314
|
+
return { content: [{ type: "text", text: toToolObservationText(result) }] };
|
|
2254
2315
|
}
|
|
2255
|
-
const err = result.error;
|
|
2256
2316
|
return {
|
|
2257
2317
|
content: [
|
|
2258
2318
|
{
|
|
2259
2319
|
type: "text",
|
|
2260
|
-
text:
|
|
2320
|
+
text: toToolObservationText(result)
|
|
2261
2321
|
}
|
|
2262
2322
|
],
|
|
2263
2323
|
isError: true
|
|
@@ -2738,5 +2798,6 @@ exports.npmDescriptorToPackagePrefixWithVersion = npmDescriptorToPackagePrefixWi
|
|
|
2738
2798
|
exports.resolveSandboxedPath = resolveSandboxedPath;
|
|
2739
2799
|
exports.resolveToolDescriptor = resolveToolDescriptor;
|
|
2740
2800
|
exports.runMCPServerOverStdio = runMCPServerOverStdio;
|
|
2741
|
-
|
|
2742
|
-
//# sourceMappingURL=chunk-
|
|
2801
|
+
exports.toToolObservationText = toToolObservationText;
|
|
2802
|
+
//# sourceMappingURL=chunk-AK3C5LLW.cjs.map
|
|
2803
|
+
//# sourceMappingURL=chunk-AK3C5LLW.cjs.map
|