@bedolla/enriweb 0.1.5 → 0.1.7
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 +48 -20
- package/dist/client/EnriProxyClient.d.ts +176 -5
- package/dist/client/EnriProxyClient.d.ts.map +1 -1
- package/dist/client/EnriProxyClient.js +255 -31
- package/dist/client/EnriProxyClient.js.map +1 -1
- package/dist/index.js +65 -25
- package/dist/index.js.map +1 -1
- package/dist/package-info.d.ts +26 -0
- package/dist/package-info.d.ts.map +1 -1
- package/dist/package-info.js +29 -2
- package/dist/package-info.js.map +1 -1
- package/dist/server/EnriWebServer.d.ts +33 -0
- package/dist/server/EnriWebServer.d.ts.map +1 -1
- package/dist/server/EnriWebServer.js +338 -28
- package/dist/server/EnriWebServer.js.map +1 -1
- package/dist/shared/Utf8SafeTextSlicer.d.ts +47 -0
- package/dist/shared/Utf8SafeTextSlicer.d.ts.map +1 -0
- package/dist/shared/Utf8SafeTextSlicer.js +97 -0
- package/dist/shared/Utf8SafeTextSlicer.js.map +1 -0
- package/dist/shared/validation.d.ts +13 -1
- package/dist/shared/validation.d.ts.map +1 -1
- package/dist/shared/validation.js +41 -17
- package/dist/shared/validation.js.map +1 -1
- package/dist/tools/WebFetchNpmProjection.d.ts +143 -0
- package/dist/tools/WebFetchNpmProjection.d.ts.map +1 -0
- package/dist/tools/WebFetchNpmProjection.js +480 -0
- package/dist/tools/WebFetchNpmProjection.js.map +1 -0
- package/dist/tools/WebFetchParamsParser.d.ts +26 -0
- package/dist/tools/WebFetchParamsParser.d.ts.map +1 -0
- package/dist/tools/WebFetchParamsParser.js +157 -0
- package/dist/tools/WebFetchParamsParser.js.map +1 -0
- package/dist/tools/WebFetchRangesExecutor.d.ts +86 -0
- package/dist/tools/WebFetchRangesExecutor.d.ts.map +1 -0
- package/dist/tools/WebFetchRangesExecutor.js +277 -0
- package/dist/tools/WebFetchRangesExecutor.js.map +1 -0
- package/dist/tools/WebFetchTool.d.ts +187 -71
- package/dist/tools/WebFetchTool.d.ts.map +1 -1
- package/dist/tools/WebFetchTool.js +145 -367
- package/dist/tools/WebFetchTool.js.map +1 -1
- package/dist/tools/WebFetchToolTextFormatter.d.ts +57 -0
- package/dist/tools/WebFetchToolTextFormatter.d.ts.map +1 -0
- package/dist/tools/WebFetchToolTextFormatter.js +135 -0
- package/dist/tools/WebFetchToolTextFormatter.js.map +1 -0
- package/dist/tools/WebSearchRegistryHttpReader.d.ts +116 -0
- package/dist/tools/WebSearchRegistryHttpReader.d.ts.map +1 -0
- package/dist/tools/WebSearchRegistryHttpReader.js +157 -0
- package/dist/tools/WebSearchRegistryHttpReader.js.map +1 -0
- package/dist/tools/WebSearchRegistryVerifier.d.ts +111 -6
- package/dist/tools/WebSearchRegistryVerifier.d.ts.map +1 -1
- package/dist/tools/WebSearchRegistryVerifier.js +406 -125
- package/dist/tools/WebSearchRegistryVerifier.js.map +1 -1
- package/dist/tools/WebSearchTool.d.ts +85 -2
- package/dist/tools/WebSearchTool.d.ts.map +1 -1
- package/dist/tools/WebSearchTool.js +197 -19
- package/dist/tools/WebSearchTool.js.map +1 -1
- package/package.json +3 -2
package/dist/package-info.d.ts
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the installed package version for MCP server metadata.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* The manifest is resolved relative to this module (not the process cwd), so
|
|
6
|
+
* global installs and dev checkouts both resolve their own package.json. The
|
|
7
|
+
* first successful read is cached for the process lifetime; an unreadable
|
|
8
|
+
* manifest degrades to "0.0.0" instead of failing server startup.
|
|
9
|
+
*/
|
|
1
10
|
export declare class PackageInfoService {
|
|
11
|
+
/**
|
|
12
|
+
* Manifest require function bound to this module's location.
|
|
13
|
+
*/
|
|
2
14
|
private readonly require;
|
|
15
|
+
/**
|
|
16
|
+
* Cached version string, or null before the first resolution.
|
|
17
|
+
*/
|
|
3
18
|
private cachedVersion;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new {@link PackageInfoService}.
|
|
21
|
+
*/
|
|
4
22
|
constructor();
|
|
23
|
+
/**
|
|
24
|
+
* Gets the installed package version.
|
|
25
|
+
*
|
|
26
|
+
* @returns Manifest version, or "0.0.0" when the manifest is unreadable.
|
|
27
|
+
*/
|
|
5
28
|
getVersion(): string;
|
|
6
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Process-wide package info service instance.
|
|
32
|
+
*/
|
|
7
33
|
export declare const packageInfoService: PackageInfoService;
|
|
8
34
|
//# sourceMappingURL=package-info.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-info.d.ts","sourceRoot":"","sources":["../src/package-info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-info.d.ts","sourceRoot":"","sources":["../src/package-info.ts"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,qBAAa,kBAAkB;IAC7B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IAEtC;;OAEG;IACH,OAAO,CAAC,aAAa,CAAuB;IAE5C;;OAEG;;IAKH;;;;OAIG;IACI,UAAU,IAAI,MAAM;CAoB5B;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAA6C,CAAC"}
|
package/dist/package-info.js
CHANGED
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the installed package version for MCP server metadata.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The manifest is resolved relative to this module (not the process cwd), so
|
|
7
|
+
* global installs and dev checkouts both resolve their own package.json. The
|
|
8
|
+
* first successful read is cached for the process lifetime; an unreadable
|
|
9
|
+
* manifest degrades to "0.0.0" instead of failing server startup.
|
|
10
|
+
*/
|
|
2
11
|
export class PackageInfoService {
|
|
12
|
+
/**
|
|
13
|
+
* Manifest require function bound to this module's location.
|
|
14
|
+
*/
|
|
3
15
|
require;
|
|
16
|
+
/**
|
|
17
|
+
* Cached version string, or null before the first resolution.
|
|
18
|
+
*/
|
|
4
19
|
cachedVersion = null;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new {@link PackageInfoService}.
|
|
22
|
+
*/
|
|
5
23
|
constructor() {
|
|
6
24
|
this.require = createRequire(import.meta.url);
|
|
7
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Gets the installed package version.
|
|
28
|
+
*
|
|
29
|
+
* @returns Manifest version, or "0.0.0" when the manifest is unreadable.
|
|
30
|
+
*/
|
|
8
31
|
getVersion() {
|
|
9
|
-
if (this.cachedVersion !== null)
|
|
32
|
+
if (this.cachedVersion !== null) {
|
|
10
33
|
return this.cachedVersion;
|
|
34
|
+
}
|
|
11
35
|
const fallback = "0.0.0";
|
|
12
36
|
try {
|
|
13
37
|
const pkg = this.require("../package.json");
|
|
@@ -18,11 +42,14 @@ export class PackageInfoService {
|
|
|
18
42
|
}
|
|
19
43
|
}
|
|
20
44
|
catch {
|
|
21
|
-
//
|
|
45
|
+
// Manifest unreadable (embedded/bundled contexts): fall back below.
|
|
22
46
|
}
|
|
23
47
|
this.cachedVersion = fallback;
|
|
24
48
|
return fallback;
|
|
25
49
|
}
|
|
26
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Process-wide package info service instance.
|
|
53
|
+
*/
|
|
27
54
|
export const packageInfoService = new PackageInfoService();
|
|
28
55
|
//# sourceMappingURL=package-info.js.map
|
package/dist/package-info.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-info.js","sourceRoot":"","sources":["../src/package-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"package-info.js","sourceRoot":"","sources":["../src/package-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAY5C;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;OAEG;IACc,OAAO,CAAc;IAEtC;;OAEG;IACK,aAAa,GAAkB,IAAI,CAAC;IAE5C;;OAEG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACI,UAAU;QACf,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;QAED,MAAM,QAAQ,GAAG,OAAO,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAqB,CAAC;YAChE,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YAC5B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7D,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;gBAC7B,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,oEAAoE;QACtE,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;QAC9B,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAuB,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -54,6 +54,39 @@ export declare class EnriWebServer {
|
|
|
54
54
|
* Registers tool list and tool call handlers.
|
|
55
55
|
*/
|
|
56
56
|
private registerToolHandlers;
|
|
57
|
+
/**
|
|
58
|
+
* Reports whether one failure is caller cancellation.
|
|
59
|
+
*
|
|
60
|
+
* @param error - Failure value.
|
|
61
|
+
* @returns True for typed abort errors and our own Spanish cancellation
|
|
62
|
+
* marker only; message-based "aborted" matches are deliberately
|
|
63
|
+
* excluded (they also cover socket resets, which are retryable
|
|
64
|
+
* transport failures rather than cancellations).
|
|
65
|
+
*/
|
|
66
|
+
private static isAbortError;
|
|
67
|
+
/**
|
|
68
|
+
* Formats one tool failure for MCP text output.
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* Proxy HTTP failures carry the server diagnostic in `EnriProxyHttpError`
|
|
72
|
+
* (status + truncated body). Known diagnostics (EnriProxy answers Spanish
|
|
73
|
+
* messages; legacy English strings stay mapped) are summarized into
|
|
74
|
+
* Spanish model guidance; unknown bodies surface a generic Spanish message
|
|
75
|
+
* with the raw payload preserved under `detalle_tecnico` (truncated to
|
|
76
|
+
* ~500 chars) so the model never depends on foreign-language passthrough.
|
|
77
|
+
*
|
|
78
|
+
* @param error - Failure from parsing or execution.
|
|
79
|
+
* @returns Spanish error text for the model.
|
|
80
|
+
*/
|
|
81
|
+
private static formatToolError;
|
|
82
|
+
/**
|
|
83
|
+
* Maps known proxy/client diagnostics to Spanish model guidance.
|
|
84
|
+
*
|
|
85
|
+
* @param source - Truncated proxy response body or error message.
|
|
86
|
+
* @param status - HTTP status code, when available.
|
|
87
|
+
* @returns Full Spanish guidance text, or null when unknown.
|
|
88
|
+
*/
|
|
89
|
+
private static translateKnownProxyMessage;
|
|
57
90
|
/**
|
|
58
91
|
* Returns the JSON schema tool definition for `web_search`.
|
|
59
92
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnriWebServer.d.ts","sourceRoot":"","sources":["../../src/server/EnriWebServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EnriWebServer.d.ts","sourceRoot":"","sources":["../../src/server/EnriWebServer.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAQ/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACrC;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAE9C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAE5C;;;;OAIG;gBACgB,MAAM,EAAE,mBAAmB;IAkB9C;;;;OAIG;IACU,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAgE5B;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAU3B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IA4B9B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAsCzC;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IA0LlC;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;CAoLlC"}
|