@easynet/agent-tool 1.0.104 → 1.0.105
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/expose/openapiHttp.d.ts.map +1 -1
- package/dist/{chunk-2THI5UWA.cjs → chunk-MQXOFUSU.cjs} +42 -39
- package/dist/chunk-MQXOFUSU.cjs.map +1 -0
- package/dist/{chunk-2MSEJB6X.js → chunk-OZUNZILF.js} +40 -37
- package/dist/chunk-OZUNZILF.js.map +1 -0
- package/dist/index.cjs +17 -17
- package/dist/index.js +1 -1
- package/dist/utils/cli/index.cjs +14 -14
- package/dist/utils/cli/index.js +1 -1
- package/package.json +14 -14
- package/dist/chunk-2MSEJB6X.js.map +0 -1
- package/dist/chunk-2THI5UWA.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapiHttp.d.ts","sourceRoot":"","sources":["../../../src/api/expose/openapiHttp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAgB,EAAE,KAAK,OAAO,EAAkD,MAAM,SAAS,CAAC;AAChG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAMpE,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAExC,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,WAAW,CAAC;CAC5D;
|
|
1
|
+
{"version":3,"file":"openapiHttp.d.ts","sourceRoot":"","sources":["../../../src/api/expose/openap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C,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChG,kDAAkD;IAClD,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAyB,SAAQ,wBAAwB;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE9B,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -1947,7 +1947,7 @@ async function importFromCache(packageRoot) {
|
|
|
1947
1947
|
fileUrl
|
|
1948
1948
|
);
|
|
1949
1949
|
}
|
|
1950
|
-
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1950
|
+
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-MQXOFUSU.cjs', document.baseURI).href)));
|
|
1951
1951
|
function getProjectRequire() {
|
|
1952
1952
|
const cwd = process.cwd();
|
|
1953
1953
|
if (fs.existsSync(path.join(cwd, "package.json"))) return module$1.createRequire(path.join(cwd, "package.json"));
|
|
@@ -2116,7 +2116,7 @@ function parseNpmDescriptor(entry) {
|
|
|
2116
2116
|
var DEFAULT_EXTENSION_PACKAGES = [];
|
|
2117
2117
|
|
|
2118
2118
|
// src/api/runtimeFromConfig.ts
|
|
2119
|
-
var requireFromPackage2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2119
|
+
var requireFromPackage2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-MQXOFUSU.cjs', document.baseURI).href)));
|
|
2120
2120
|
function resolveEffectiveCoreTools(options) {
|
|
2121
2121
|
if (options.coreTools) return options.coreTools;
|
|
2122
2122
|
if (options.configFilePath) return {};
|
|
@@ -2875,42 +2875,27 @@ async function invokeAndSend(runtime, ctx, res, tool, args) {
|
|
|
2875
2875
|
details: result.error?.details
|
|
2876
2876
|
});
|
|
2877
2877
|
}
|
|
2878
|
-
function
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
app.use(express__default.default.text({ type: "*/*" }));
|
|
2884
|
-
router.get("/", (_req, res) => {
|
|
2885
|
-
const specPath = basePath ? `${basePath}/openapi.json` : "/openapi.json";
|
|
2886
|
-
res.type("text/html; charset=utf-8").send(swaggerUiHtml(specPath));
|
|
2878
|
+
function buildSpec(runtime, basePath) {
|
|
2879
|
+
return toolsToOpenAPISpec(runtime.getRegistry(), {
|
|
2880
|
+
title: "Tool API",
|
|
2881
|
+
version: "1.0.0",
|
|
2882
|
+
basePath: basePath || void 0
|
|
2887
2883
|
});
|
|
2888
|
-
|
|
2884
|
+
}
|
|
2885
|
+
function registerSpecRoutes(router, runtime, basePath) {
|
|
2886
|
+
const sendSpec = (_req, res) => {
|
|
2887
|
+
sendJson(res, 200, buildSpec(runtime, basePath));
|
|
2888
|
+
};
|
|
2889
|
+
const sendSwagger = (_req, res) => {
|
|
2889
2890
|
const specPath = basePath ? `${basePath}/openapi.json` : "/openapi.json";
|
|
2890
2891
|
res.type("text/html; charset=utf-8").send(swaggerUiHtml(specPath));
|
|
2891
|
-
}
|
|
2892
|
-
router.get("/
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
version: "1.0.0",
|
|
2899
|
-
basePath: basePath || void 0
|
|
2900
|
-
})
|
|
2901
|
-
);
|
|
2902
|
-
});
|
|
2903
|
-
router.get("/spec", (_req, res) => {
|
|
2904
|
-
sendJson(
|
|
2905
|
-
res,
|
|
2906
|
-
200,
|
|
2907
|
-
toolsToOpenAPISpec(runtime.getRegistry(), {
|
|
2908
|
-
title: "Tool API",
|
|
2909
|
-
version: "1.0.0",
|
|
2910
|
-
basePath: basePath || void 0
|
|
2911
|
-
})
|
|
2912
|
-
);
|
|
2913
|
-
});
|
|
2892
|
+
};
|
|
2893
|
+
router.get("/", sendSwagger);
|
|
2894
|
+
router.get("/swagger", sendSwagger);
|
|
2895
|
+
router.get("/openapi.json", sendSpec);
|
|
2896
|
+
router.get("/spec", sendSpec);
|
|
2897
|
+
}
|
|
2898
|
+
function registerToolRoutes(router, runtime, ctxFactory) {
|
|
2914
2899
|
router.get("/tools", async (_req, res, next) => {
|
|
2915
2900
|
try {
|
|
2916
2901
|
const { enrichSpecWithCanonicalSchema: enrichSpecWithCanonicalSchema2 } = await import('./canonicalCoreSchemas-TY7NCWCC.cjs');
|
|
@@ -2950,11 +2935,15 @@ function createOpenAPIHttpServer(runtime, options = {}) {
|
|
|
2950
2935
|
}
|
|
2951
2936
|
await invokeAndSend(runtime, ctxFactory(req), res, slugToToolName(req.params?.slug ?? ""), args);
|
|
2952
2937
|
});
|
|
2938
|
+
}
|
|
2939
|
+
function mountRouter(app, router, basePath) {
|
|
2953
2940
|
if (basePath) {
|
|
2954
2941
|
app.use(basePath, router);
|
|
2955
|
-
|
|
2956
|
-
app.use(router);
|
|
2942
|
+
return;
|
|
2957
2943
|
}
|
|
2944
|
+
app.use(router);
|
|
2945
|
+
}
|
|
2946
|
+
function registerErrorHandlers(app) {
|
|
2958
2947
|
app.use((req, res) => {
|
|
2959
2948
|
sendJson(res, 404, { error: "Not found", path: req.url ?? "/" });
|
|
2960
2949
|
});
|
|
@@ -2962,6 +2951,8 @@ function createOpenAPIHttpServer(runtime, options = {}) {
|
|
|
2962
2951
|
const message = err instanceof Error ? err.message : String(err);
|
|
2963
2952
|
sendJson(res, 500, { error: message, kind: "INTERNAL_ERROR" });
|
|
2964
2953
|
});
|
|
2954
|
+
}
|
|
2955
|
+
function patchListenDefaults(app, options) {
|
|
2965
2956
|
const originalListen = app.listen.bind(app);
|
|
2966
2957
|
const defaultPort = options.port;
|
|
2967
2958
|
const defaultHost = options.host;
|
|
@@ -2974,6 +2965,18 @@ function createOpenAPIHttpServer(runtime, options = {}) {
|
|
|
2974
2965
|
}
|
|
2975
2966
|
return originalListen(...args);
|
|
2976
2967
|
});
|
|
2968
|
+
}
|
|
2969
|
+
function createOpenAPIHttpServer(runtime, options = {}) {
|
|
2970
|
+
const app = express__default.default();
|
|
2971
|
+
const router = express__default.default.Router();
|
|
2972
|
+
const basePath = (options.basePath ?? "").replace(/\/$/, "");
|
|
2973
|
+
const ctxFactory = options.execContextFactory ?? (() => ({ ...DEFAULT_CTX2 }));
|
|
2974
|
+
app.use(express__default.default.text({ type: "*/*" }));
|
|
2975
|
+
registerSpecRoutes(router, runtime, basePath);
|
|
2976
|
+
registerToolRoutes(router, runtime, ctxFactory);
|
|
2977
|
+
mountRouter(app, router, basePath);
|
|
2978
|
+
registerErrorHandlers(app);
|
|
2979
|
+
patchListenDefaults(app, options);
|
|
2977
2980
|
return app;
|
|
2978
2981
|
}
|
|
2979
2982
|
function listenOpenAPIHttpServer(app, options = {}) {
|
|
@@ -3036,5 +3039,5 @@ exports.resolveSandboxedPath = resolveSandboxedPath;
|
|
|
3036
3039
|
exports.resolveToolDescriptor = resolveToolDescriptor;
|
|
3037
3040
|
exports.runMCPServerOverStdio = runMCPServerOverStdio;
|
|
3038
3041
|
exports.toToolObservationText = toToolObservationText;
|
|
3039
|
-
//# sourceMappingURL=chunk-
|
|
3040
|
-
//# sourceMappingURL=chunk-
|
|
3042
|
+
//# sourceMappingURL=chunk-MQXOFUSU.cjs.map
|
|
3043
|
+
//# sourceMappingURL=chunk-MQXOFUSU.cjs.map
|