@loopstack/web-module 0.2.0

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.
Files changed (65) hide show
  1. package/dist/constants.d.ts +10 -0
  2. package/dist/constants.d.ts.map +1 -0
  3. package/dist/constants.js +13 -0
  4. package/dist/constants.js.map +1 -0
  5. package/dist/index.d.ts +7 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +23 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/services/index.d.ts +4 -0
  10. package/dist/services/index.d.ts.map +1 -0
  11. package/dist/services/index.js +20 -0
  12. package/dist/services/index.js.map +1 -0
  13. package/dist/services/webfetch-fetcher.service.d.ts +20 -0
  14. package/dist/services/webfetch-fetcher.service.d.ts.map +1 -0
  15. package/dist/services/webfetch-fetcher.service.js +218 -0
  16. package/dist/services/webfetch-fetcher.service.js.map +1 -0
  17. package/dist/services/webfetch-markdown.service.d.ts +6 -0
  18. package/dist/services/webfetch-markdown.service.d.ts.map +1 -0
  19. package/dist/services/webfetch-markdown.service.js +66 -0
  20. package/dist/services/webfetch-markdown.service.js.map +1 -0
  21. package/dist/services/webfetch-summarizer.service.d.ts +15 -0
  22. package/dist/services/webfetch-summarizer.service.d.ts.map +1 -0
  23. package/dist/services/webfetch-summarizer.service.js +57 -0
  24. package/dist/services/webfetch-summarizer.service.js.map +1 -0
  25. package/dist/tools/index.d.ts +2 -0
  26. package/dist/tools/index.d.ts.map +1 -0
  27. package/dist/tools/index.js +18 -0
  28. package/dist/tools/index.js.map +1 -0
  29. package/dist/tools/web-fetch.tool.d.ts +20 -0
  30. package/dist/tools/web-fetch.tool.d.ts.map +1 -0
  31. package/dist/tools/web-fetch.tool.js +163 -0
  32. package/dist/tools/web-fetch.tool.js.map +1 -0
  33. package/dist/types/index.d.ts +2 -0
  34. package/dist/types/index.d.ts.map +1 -0
  35. package/dist/types/index.js +18 -0
  36. package/dist/types/index.js.map +1 -0
  37. package/dist/types/webfetch.types.d.ts +31 -0
  38. package/dist/types/webfetch.types.d.ts.map +1 -0
  39. package/dist/types/webfetch.types.js +3 -0
  40. package/dist/types/webfetch.types.js.map +1 -0
  41. package/dist/utils/errors.d.ts +18 -0
  42. package/dist/utils/errors.d.ts.map +1 -0
  43. package/dist/utils/errors.js +43 -0
  44. package/dist/utils/errors.js.map +1 -0
  45. package/dist/utils/index.d.ts +5 -0
  46. package/dist/utils/index.d.ts.map +1 -0
  47. package/dist/utils/index.js +21 -0
  48. package/dist/utils/index.js.map +1 -0
  49. package/dist/utils/preapproved-hosts.d.ts +4 -0
  50. package/dist/utils/preapproved-hosts.d.ts.map +1 -0
  51. package/dist/utils/preapproved-hosts.js +63 -0
  52. package/dist/utils/preapproved-hosts.js.map +1 -0
  53. package/dist/utils/secondary-model-prompt.d.ts +2 -0
  54. package/dist/utils/secondary-model-prompt.d.ts.map +1 -0
  55. package/dist/utils/secondary-model-prompt.js +23 -0
  56. package/dist/utils/secondary-model-prompt.js.map +1 -0
  57. package/dist/utils/url.utils.d.ts +10 -0
  58. package/dist/utils/url.utils.d.ts.map +1 -0
  59. package/dist/utils/url.utils.js +52 -0
  60. package/dist/utils/url.utils.js.map +1 -0
  61. package/dist/web.module.d.ts +3 -0
  62. package/dist/web.module.d.ts.map +1 -0
  63. package/dist/web.module.js +25 -0
  64. package/dist/web.module.js.map +1 -0
  65. package/package.json +78 -0
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.WebFetchTool = exports.WebFetchSchema = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const zod_1 = require("zod");
15
+ const common_2 = require("@loopstack/common");
16
+ const constants_1 = require("../constants");
17
+ const services_1 = require("../services");
18
+ exports.WebFetchSchema = zod_1.z
19
+ .object({
20
+ url: zod_1.z.url().describe('The URL to fetch content from'),
21
+ prompt: zod_1.z
22
+ .string()
23
+ .optional()
24
+ .describe('Optional instruction applied to the fetched content by a small model. ' +
25
+ 'When omitted, the raw Markdown is returned (truncated if very long).'),
26
+ claude: zod_1.z
27
+ .object({
28
+ model: zod_1.z.string().optional(),
29
+ envApiKey: zod_1.z.string().optional(),
30
+ maxTokens: zod_1.z.number().optional(),
31
+ })
32
+ .optional()
33
+ .describe('Model configuration for the summarization step. Only used when `prompt` is provided.'),
34
+ })
35
+ .strict();
36
+ let WebFetchTool = class WebFetchTool extends common_2.BaseTool {
37
+ fetcher;
38
+ summarizer;
39
+ async call(args) {
40
+ const start = performance.now();
41
+ const outcome = await this.fetcher.fetch(args.url);
42
+ if (outcome.type === 'redirect') {
43
+ const { originalUrl, redirectUrl, statusCode } = outcome.redirect;
44
+ const message = buildRedirectMessage(originalUrl, redirectUrl, statusCode, args.prompt);
45
+ return {
46
+ data: {
47
+ url: args.url,
48
+ bytes: Buffer.byteLength(message),
49
+ code: statusCode,
50
+ codeText: redirectStatusText(statusCode),
51
+ contentType: 'text/plain',
52
+ result: message,
53
+ truncated: false,
54
+ cached: false,
55
+ durationMs: performance.now() - start,
56
+ redirect: { originalUrl, redirectUrl, statusCode },
57
+ },
58
+ };
59
+ }
60
+ const { content, cached } = outcome;
61
+ if (content.isBinary) {
62
+ const note = `[Binary content fetched — ${content.contentType}, ${content.bytes} bytes. No text extraction performed.]`;
63
+ return {
64
+ data: {
65
+ url: args.url,
66
+ bytes: content.bytes,
67
+ code: content.code,
68
+ codeText: content.codeText,
69
+ contentType: content.contentType,
70
+ result: note,
71
+ truncated: false,
72
+ cached,
73
+ durationMs: performance.now() - start,
74
+ },
75
+ };
76
+ }
77
+ const markdown = await this.fetcher.htmlToMarkdown(content);
78
+ let result;
79
+ let truncated = false;
80
+ if (args.prompt) {
81
+ const summary = await this.summarizer.summarize(args.url, markdown, args.prompt, {
82
+ model: args.claude?.model,
83
+ envApiKey: args.claude?.envApiKey,
84
+ maxTokens: args.claude?.maxTokens,
85
+ });
86
+ result = summary.summary;
87
+ truncated = summary.truncated;
88
+ }
89
+ else {
90
+ if (markdown.length > constants_1.MAX_MARKDOWN_LENGTH) {
91
+ result = markdown.slice(0, constants_1.MAX_MARKDOWN_LENGTH) + '\n\n[Content truncated due to length...]';
92
+ truncated = true;
93
+ }
94
+ else {
95
+ result = markdown;
96
+ }
97
+ }
98
+ result = capResultSize(result);
99
+ return {
100
+ data: {
101
+ url: args.url,
102
+ bytes: content.bytes,
103
+ code: content.code,
104
+ codeText: content.codeText,
105
+ contentType: content.contentType,
106
+ result,
107
+ truncated,
108
+ cached,
109
+ durationMs: performance.now() - start,
110
+ },
111
+ };
112
+ }
113
+ };
114
+ exports.WebFetchTool = WebFetchTool;
115
+ __decorate([
116
+ (0, common_1.Inject)(),
117
+ __metadata("design:type", services_1.WebFetchFetcherService)
118
+ ], WebFetchTool.prototype, "fetcher", void 0);
119
+ __decorate([
120
+ (0, common_1.Inject)(),
121
+ __metadata("design:type", services_1.WebFetchSummarizerService)
122
+ ], WebFetchTool.prototype, "summarizer", void 0);
123
+ exports.WebFetchTool = WebFetchTool = __decorate([
124
+ (0, common_2.Tool)({
125
+ uiConfig: {
126
+ description: 'Fetches content from a URL, converts HTML to Markdown, and optionally summarizes it with a small Claude model against a user-provided prompt. ' +
127
+ 'Supports HTTPS upgrade, same-origin redirect following with cross-host report, a 15-minute in-memory cache, size and redirect caps, and a preapproved-host allowlist.',
128
+ },
129
+ schema: exports.WebFetchSchema,
130
+ })
131
+ ], WebFetchTool);
132
+ function buildRedirectMessage(originalUrl, redirectUrl, statusCode, prompt) {
133
+ const promptLine = prompt ? `- prompt: "${prompt}"\n` : '';
134
+ return (`REDIRECT DETECTED: The URL redirects to a different host.\n\n` +
135
+ `Original URL: ${originalUrl}\n` +
136
+ `Redirect URL: ${redirectUrl}\n` +
137
+ `Status: ${statusCode} ${redirectStatusText(statusCode)}\n\n` +
138
+ `To complete your request, call WebFetch again with these parameters:\n` +
139
+ `- url: "${redirectUrl}"\n` +
140
+ promptLine);
141
+ }
142
+ function redirectStatusText(status) {
143
+ switch (status) {
144
+ case 301:
145
+ return 'Moved Permanently';
146
+ case 302:
147
+ return 'Found';
148
+ case 303:
149
+ return 'See Other';
150
+ case 307:
151
+ return 'Temporary Redirect';
152
+ case 308:
153
+ return 'Permanent Redirect';
154
+ default:
155
+ return 'Redirect';
156
+ }
157
+ }
158
+ function capResultSize(text) {
159
+ if (text.length <= constants_1.MAX_RESULT_SIZE_CHARS)
160
+ return text;
161
+ return text.slice(0, constants_1.MAX_RESULT_SIZE_CHARS) + `\n\n[Result truncated at ${constants_1.MAX_RESULT_SIZE_CHARS} characters]`;
162
+ }
163
+ //# sourceMappingURL=web-fetch.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-fetch.tool.js","sourceRoot":"","sources":["../../src/tools/web-fetch.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,6BAAwB;AACxB,8CAA+D;AAC/D,4CAA0E;AAC1E,0CAAgF;AAGnE,QAAA,cAAc,GAAG,OAAC;KAC5B,MAAM,CAAC;IACN,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IACtD,MAAM,EAAE,OAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,wEAAwE;QACtE,sEAAsE,CACzE;IACH,M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E;QACxE,WAAW,WAAW,KAAK;QAC3B,UAAU,CACX,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAc;IACxC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG;YACN,OAAO,mBAAmB,CAAC;QAC7B,KAAK,GAAG;YACN,OAAO,OAAO,CAAC;QACjB,KAAK,GAAG;YACN,OAAO,WAAW,CAAC;QACrB,KAAK,GAAG;YACN,OAAO,oBAAoB,CAAC;QAC9B,KAAK,GAAG;YACN,OAAO,oBAAoB,CAAC;QAC9B;YACE,OAAO,UAAU,CAAC;IACtB,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,IAAI,CAAC,MAAM,IAAI,iCAAqB;QAAE,OAAO,IAAI,CAAC;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,iCAAqB,CAAC,GAAG,4BAA4B,iCAAqB,cAAc,CAAC;AAChH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './webfetch.types';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./webfetch.types"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
@@ -0,0 +1,31 @@
1
+ export interface FetchedContent {
2
+ content: string;
3
+ bytes: number;
4
+ code: number;
5
+ codeText: string;
6
+ contentType: string;
7
+ isBinary: boolean;
8
+ }
9
+ export interface RedirectInfo {
10
+ type: 'redirect';
11
+ originalUrl: string;
12
+ redirectUrl: string;
13
+ statusCode: number;
14
+ }
15
+ export interface WebFetchResult {
16
+ url: string;
17
+ bytes: number;
18
+ code: number;
19
+ codeText: string;
20
+ contentType: string;
21
+ result: string;
22
+ truncated: boolean;
23
+ cached: boolean;
24
+ durationMs: number;
25
+ redirect?: {
26
+ originalUrl: string;
27
+ redirectUrl: string;
28
+ statusCode: number;
29
+ };
30
+ }
31
+ //# sourceMappingURL=webfetch.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webfetch.types.d.ts","sourceRoot":"","sources":["../../src/types/webfetch.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QACT,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=webfetch.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webfetch.types.js","sourceRoot":"","sources":["../../src/types/webfetch.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ export declare class InvalidUrlError extends Error {
2
+ constructor(url: string, reason: string);
3
+ }
4
+ export declare class ContentTooLargeError extends Error {
5
+ readonly limitBytes: number;
6
+ constructor(limitBytes: number);
7
+ }
8
+ export declare class RedirectLimitExceededError extends Error {
9
+ constructor(limit: number);
10
+ }
11
+ export declare class EgressBlockedError extends Error {
12
+ readonly domain: string;
13
+ constructor(domain: string);
14
+ }
15
+ export declare class FetchTimeoutError extends Error {
16
+ constructor(timeoutMs: number);
17
+ }
18
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAIxC;AAED,qBAAa,oBAAqB,SAAQ,KAAK;aACjB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAED,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,KAAK,EAAE,MAAM;CAI1B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;aACf,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM;CAI3C;AAED,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,SAAS,EAAE,MAAM;CAI9B"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FetchTimeoutError = exports.EgressBlockedError = exports.RedirectLimitExceededError = exports.ContentTooLargeError = exports.InvalidUrlError = void 0;
4
+ class InvalidUrlError extends Error {
5
+ constructor(url, reason) {
6
+ super(`Invalid URL "${url}": ${reason}`);
7
+ this.name = 'InvalidUrlError';
8
+ }
9
+ }
10
+ exports.InvalidUrlError = InvalidUrlError;
11
+ class ContentTooLargeError extends Error {
12
+ limitBytes;
13
+ constructor(limitBytes) {
14
+ super(`Response body exceeded ${limitBytes} bytes and was aborted.`);
15
+ this.limitBytes = limitBytes;
16
+ this.name = 'ContentTooLargeError';
17
+ }
18
+ }
19
+ exports.ContentTooLargeError = ContentTooLargeError;
20
+ class RedirectLimitExceededError extends Error {
21
+ constructor(limit) {
22
+ super(`Too many redirects (exceeded ${limit}).`);
23
+ this.name = 'RedirectLimitExceededError';
24
+ }
25
+ }
26
+ exports.RedirectLimitExceededError = RedirectLimitExceededError;
27
+ class EgressBlockedError extends Error {
28
+ domain;
29
+ constructor(domain) {
30
+ super(`Access to ${domain} is blocked by the network egress proxy.`);
31
+ this.domain = domain;
32
+ this.name = 'EgressBlockedError';
33
+ }
34
+ }
35
+ exports.EgressBlockedError = EgressBlockedError;
36
+ class FetchTimeoutError extends Error {
37
+ constructor(timeoutMs) {
38
+ super(`Fetch timed out after ${timeoutMs}ms.`);
39
+ this.name = 'FetchTimeoutError';
40
+ }
41
+ }
42
+ exports.FetchTimeoutError = FetchTimeoutError;
43
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,GAAW,EAAE,MAAc;QACrC,KAAK,CAAC,gBAAgB,GAAG,MAAM,MAAM,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,oBAAqB,SAAQ,KAAK;IACjB;IAA5B,YAA4B,UAAkB;QAC5C,KAAK,CAAC,0BAA0B,UAAU,yBAAyB,CAAC,CAAC;QAD3C,eAAU,GAAV,UAAU,CAAQ;QAE5C,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AALD,oDAKC;AAED,MAAa,0BAA2B,SAAQ,KAAK;IACnD,YAAY,KAAa;QACvB,KAAK,CAAC,gCAAgC,KAAK,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC3C,CAAC;CACF;AALD,gEAKC;AAED,MAAa,kBAAmB,SAAQ,KAAK;IACf;IAA5B,YAA4B,MAAc;QACxC,KAAK,CAAC,aAAa,MAAM,0CAA0C,CAAC,CAAC;QAD3C,WAAM,GAAN,MAAM,CAAQ;QAExC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AALD,gDAKC;AAED,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,SAAiB;QAC3B,KAAK,CAAC,yBAAyB,SAAS,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC"}
@@ -0,0 +1,5 @@
1
+ export * from './errors';
2
+ export * from './preapproved-hosts';
3
+ export * from './secondary-model-prompt';
4
+ export * from './url.utils';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./errors"), exports);
18
+ __exportStar(require("./preapproved-hosts"), exports);
19
+ __exportStar(require("./secondary-model-prompt"), exports);
20
+ __exportStar(require("./url.utils"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,sDAAoC;AACpC,2DAAyC;AACzC,8CAA4B"}
@@ -0,0 +1,4 @@
1
+ export declare const PREAPPROVED_HOSTS: ReadonlySet<string>;
2
+ export declare function isPreapprovedHost(hostname: string, pathname: string): boolean;
3
+ export declare function isPreapprovedUrl(url: string): boolean;
4
+ //# sourceMappingURL=preapproved-hosts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preapproved-hosts.d.ts","sourceRoot":"","sources":["../../src/utils/preapproved-hosts.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAehD,CAAC;AAoBH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAS7E;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOrD"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PREAPPROVED_HOSTS = void 0;
4
+ exports.isPreapprovedHost = isPreapprovedHost;
5
+ exports.isPreapprovedUrl = isPreapprovedUrl;
6
+ exports.PREAPPROVED_HOSTS = new Set([
7
+ 'www.typescriptlang.org',
8
+ 'nodejs.org',
9
+ 'expressjs.com',
10
+ 'jestjs.io',
11
+ 'www.mongodb.com',
12
+ 'redis.io',
13
+ 'www.postgresql.org',
14
+ 'dev.mysql.com',
15
+ 'www.sqlite.org',
16
+ 'graphql.org',
17
+ 'prisma.io',
18
+ 'docs.nestjs.com',
19
+ 'typeorm.io',
20
+ 'loopstack.ai',
21
+ ]);
22
+ const { HOSTNAME_ONLY, PATH_PREFIXES } = (() => {
23
+ const hosts = new Set();
24
+ const paths = new Map();
25
+ exports.PREAPPROVED_HOSTS.forEach((entry) => {
26
+ const slash = entry.indexOf('/');
27
+ if (slash === -1) {
28
+ hosts.add(entry);
29
+ }
30
+ else {
31
+ const host = entry.slice(0, slash);
32
+ const path = entry.slice(slash);
33
+ const prefixes = paths.get(host);
34
+ if (prefixes)
35
+ prefixes.push(path);
36
+ else
37
+ paths.set(host, [path]);
38
+ }
39
+ });
40
+ return { HOSTNAME_ONLY: hosts, PATH_PREFIXES: paths };
41
+ })();
42
+ function isPreapprovedHost(hostname, pathname) {
43
+ if (HOSTNAME_ONLY.has(hostname))
44
+ return true;
45
+ const prefixes = PATH_PREFIXES.get(hostname);
46
+ if (prefixes) {
47
+ for (const p of prefixes) {
48
+ if (pathname === p || pathname.startsWith(p + '/'))
49
+ return true;
50
+ }
51
+ }
52
+ return false;
53
+ }
54
+ function isPreapprovedUrl(url) {
55
+ try {
56
+ const parsed = new URL(url);
57
+ return isPreapprovedHost(parsed.hostname, parsed.pathname);
58
+ }
59
+ catch {
60
+ return false;
61
+ }
62
+ }
63
+ //# sourceMappingURL=preapproved-hosts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preapproved-hosts.js","sourceRoot":"","sources":["../../src/utils/preapproved-hosts.ts"],"names":[],"mappings":";;;AA2CA,8CASC;AAED,4CAOC;AArDY,QAAA,iBAAiB,GAAwB,IAAI,GAAG,CAAC;IAC5D,wBAAwB;IACxB,YAAY;IACZ,eAAe;IACf,WAAW;IACX,iBAAiB;IACjB,UAAU;IACV,oBAAoB;IACpB,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,cAAc;CACf,CAAC,CAAC;AAEH,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,CAAC,GAAG,EAAE;IAC7C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC1C,yBAAiB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAClC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;YACnC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAChC,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,QAAQ;gBAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;gBAC7B,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AACxD,CAAC,CAAC,EAAE,CAAC;AAEL,SAAgB,iBAAiB,CAAC,QAAgB,EAAE,QAAgB;IAClE,IAAI,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,QAAQ,EAAE,CAAC;QACb,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;YACzB,IAAI,QAAQ,KAAK,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC;QAClE,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function makeSecondaryModelPrompt(markdownContent: string, prompt: string, isPreapprovedDomain: boolean): string;
2
+ //# sourceMappingURL=secondary-model-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secondary-model-prompt.d.ts","sourceRoot":"","sources":["../../src/utils/secondary-model-prompt.ts"],"names":[],"mappings":"AAAA,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,OAAO,GAC3B,MAAM,CAmBR"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeSecondaryModelPrompt = makeSecondaryModelPrompt;
4
+ function makeSecondaryModelPrompt(markdownContent, prompt, isPreapprovedDomain) {
5
+ const guidelines = isPreapprovedDomain
6
+ ? `Provide a concise response based on the content above. Include relevant details, code examples, and documentation excerpts as needed.`
7
+ : `Provide a concise response based only on the content above. In your response:
8
+ - Enforce a strict 125-character maximum for quotes from any source document. Open Source Software is ok as long as we respect the license.
9
+ - Use quotation marks for exact language from articles; any language outside of the quotation should never be word-for-word the same.
10
+ - You are not a lawyer and never comment on the legality of your own prompts and responses.
11
+ - Never produce or reproduce exact song lyrics.`;
12
+ return `
13
+ Web page content:
14
+ ---
15
+ ${markdownContent}
16
+ ---
17
+
18
+ ${prompt}
19
+
20
+ ${guidelines}
21
+ `;
22
+ }
23
+ //# sourceMappingURL=secondary-model-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secondary-model-prompt.js","sourceRoot":"","sources":["../../src/utils/secondary-model-prompt.ts"],"names":[],"mappings":";;AAAA,4DAuBC;AAvBD,SAAgB,wBAAwB,CACtC,eAAuB,EACvB,MAAc,EACd,mBAA4B;IAE5B,MAAM,UAAU,GAAG,mBAAmB;QACpC,CAAC,CAAC,uIAAuI;QACzI,CAAC,CAAC;;;;iDAI2C,CAAC;IAEhD,OAAO;;;EAGP,eAAe;;;EAGf,MAAM;;EAEN,UAAU;CACX,CAAC;AACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function validateURL(url: string): {
2
+ ok: true;
3
+ parsed: URL;
4
+ } | {
5
+ ok: false;
6
+ reason: string;
7
+ };
8
+ export declare function isPermittedRedirect(originalUrl: string, redirectUrl: string): boolean;
9
+ export declare function isBinaryContentType(contentType: string): boolean;
10
+ //# sourceMappingURL=url.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.utils.d.ts","sourceRoot":"","sources":["../../src/utils/url.utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA0BlG;AAQD,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAcrF;AAID,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAGhE"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateURL = validateURL;
4
+ exports.isPermittedRedirect = isPermittedRedirect;
5
+ exports.isBinaryContentType = isBinaryContentType;
6
+ const constants_1 = require("../constants");
7
+ function validateURL(url) {
8
+ if (url.length > constants_1.MAX_URL_LENGTH) {
9
+ return { ok: false, reason: `URL exceeds ${constants_1.MAX_URL_LENGTH} characters` };
10
+ }
11
+ let parsed;
12
+ try {
13
+ parsed = new URL(url);
14
+ }
15
+ catch {
16
+ return { ok: false, reason: 'URL could not be parsed' };
17
+ }
18
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
19
+ return { ok: false, reason: `unsupported protocol "${parsed.protocol}"` };
20
+ }
21
+ if (parsed.username || parsed.password) {
22
+ return { ok: false, reason: 'URLs with embedded credentials are not allowed' };
23
+ }
24
+ const parts = parsed.hostname.split('.');
25
+ if (parts.length < 2) {
26
+ return { ok: false, reason: 'hostname must be publicly resolvable' };
27
+ }
28
+ return { ok: true, parsed };
29
+ }
30
+ function isPermittedRedirect(originalUrl, redirectUrl) {
31
+ try {
32
+ const original = new URL(originalUrl);
33
+ const redirect = new URL(redirectUrl);
34
+ if (redirect.protocol !== original.protocol)
35
+ return false;
36
+ if (redirect.port !== original.port)
37
+ return false;
38
+ if (redirect.username || redirect.password)
39
+ return false;
40
+ const strip = (h) => h.replace(/^www\./, '');
41
+ return strip(original.hostname) === strip(redirect.hostname);
42
+ }
43
+ catch {
44
+ return false;
45
+ }
46
+ }
47
+ const BINARY_CONTENT_TYPE_PREFIXES = ['application/pdf', 'image/', 'audio/', 'video/', 'application/octet-stream'];
48
+ function isBinaryContentType(contentType) {
49
+ const lower = contentType.toLowerCase();
50
+ return BINARY_CONTENT_TYPE_PREFIXES.some((prefix) => lower.startsWith(prefix));
51
+ }
52
+ //# sourceMappingURL=url.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../src/utils/url.utils.ts"],"names":[],"mappings":";;AAEA,kCA0BC;AAQD,kDAcC;AAID,kDAGC;AAzDD,4CAA8C;AAE9C,SAAgB,WAAW,CAAC,GAAW;IACrC,IAAI,GAAG,CAAC,MAAM,GAAG,0BAAc,EAAE,CAAC;QAChC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,0BAAc,aAAa,EAAE,CAAC;IAC3E,CAAC;IAED,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC;IAC1D,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAChE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,yBAAyB,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;IAC5E,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,gDAAgD,EAAE,CAAC;IACjF,CAAC;IAED,MAAM,KAAK,G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,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AACjF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare class WebModule {
2
+ }
3
+ //# sourceMappingURL=web.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.module.d.ts","sourceRoot":"","sources":["../src/web.module.ts"],"names":[],"mappings":"AAMA,qBAKa,SAAS;CAAG"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.WebModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const claude_module_1 = require("@loopstack/claude-module");
12
+ const core_1 = require("@loopstack/core");
13
+ const services_1 = require("./services");
14
+ const tools_1 = require("./tools");
15
+ let WebModule = class WebModule {
16
+ };
17
+ exports.WebModule = WebModule;
18
+ exports.WebModule = WebModule = __decorate([
19
+ (0, common_1.Module)({
20
+ imports: [core_1.LoopCoreModule, claude_module_1.ClaudeModule],
21
+ providers: [services_1.WebFetchMarkdownService, services_1.WebFetchFetcherService, services_1.WebFetchSummarizerService, tools_1.WebFetchTool],
22
+ exports: [tools_1.WebFetchTool],
23
+ })
24
+ ], WebModule);
25
+ //# sourceMappingURL=web.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.module.js","sourceRoot":"","sources":["../src/web.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,4DAAwD;AACxD,0CAAiD;AACjD,yCAAwG;AACxG,mCAAuC;AAOhC,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IALrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAc,EAAE,4BAAY,CAAC;QACvC,SAAS,EAAE,CAAC,kCAAuB,EAAE,iCAAsB,EAAE,oCAAyB,EAAE,oBAAY,CAAC;QACrG,OAAO,EAAE,CAAC,oBAAY,CAAC;KACxB,CAAC;GACW,SAAS,CAAG"}