indusagi-coding-agent 0.1.25 → 0.1.26

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 (83) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/cli/file-processor.js +1 -1
  3. package/dist/cli/file-processor.js.map +1 -1
  4. package/dist/core/agent-session.d.ts +1 -1
  5. package/dist/core/agent-session.d.ts.map +1 -1
  6. package/dist/core/agent-session.js +1 -1
  7. package/dist/core/agent-session.js.map +1 -1
  8. package/dist/core/bash-executor.d.ts +1 -1
  9. package/dist/core/bash-executor.d.ts.map +1 -1
  10. package/dist/core/bash-executor.js +1 -1
  11. package/dist/core/bash-executor.js.map +1 -1
  12. package/dist/core/extensions/types.d.ts +1 -3
  13. package/dist/core/extensions/types.d.ts.map +1 -1
  14. package/dist/core/settings-manager.js +1 -1
  15. package/dist/core/settings-manager.js.map +1 -1
  16. package/dist/core/task-session-manager.d.ts.map +1 -1
  17. package/dist/core/task-session-manager.js +1 -7
  18. package/dist/core/task-session-manager.js.map +1 -1
  19. package/dist/core/tools/bg-process.d.ts +1 -1
  20. package/dist/core/tools/index.d.ts +57 -50
  21. package/dist/core/tools/index.d.ts.map +1 -1
  22. package/dist/core/tools/index.js +89 -21
  23. package/dist/core/tools/index.js.map +1 -1
  24. package/dist/core/tools/todo.d.ts +4 -4
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
  29. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  30. package/dist/modes/interactive/components/bash-execution.js +1 -1
  31. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  32. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  33. package/dist/modes/interactive/components/tool-execution.js +2 -2
  34. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  35. package/package.json +3 -3
  36. package/dist/core/tools/bash.d.ts +0 -428
  37. package/dist/core/tools/bash.d.ts.map +0 -1
  38. package/dist/core/tools/bash.js +0 -498
  39. package/dist/core/tools/bash.js.map +0 -1
  40. package/dist/core/tools/edit-diff.d.ts +0 -63
  41. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  42. package/dist/core/tools/edit-diff.js +0 -243
  43. package/dist/core/tools/edit-diff.js.map +0 -1
  44. package/dist/core/tools/edit.d.ts +0 -315
  45. package/dist/core/tools/edit.d.ts.map +0 -1
  46. package/dist/core/tools/edit.js +0 -384
  47. package/dist/core/tools/edit.js.map +0 -1
  48. package/dist/core/tools/find.d.ts +0 -201
  49. package/dist/core/tools/find.d.ts.map +0 -1
  50. package/dist/core/tools/find.js +0 -342
  51. package/dist/core/tools/find.js.map +0 -1
  52. package/dist/core/tools/grep.d.ts +0 -323
  53. package/dist/core/tools/grep.d.ts.map +0 -1
  54. package/dist/core/tools/grep.js +0 -486
  55. package/dist/core/tools/grep.js.map +0 -1
  56. package/dist/core/tools/ls.d.ts +0 -44
  57. package/dist/core/tools/ls.d.ts.map +0 -1
  58. package/dist/core/tools/ls.js +0 -124
  59. package/dist/core/tools/ls.js.map +0 -1
  60. package/dist/core/tools/path-utils.d.ts +0 -8
  61. package/dist/core/tools/path-utils.d.ts.map +0 -1
  62. package/dist/core/tools/path-utils.js +0 -53
  63. package/dist/core/tools/path-utils.js.map +0 -1
  64. package/dist/core/tools/read.d.ts +0 -338
  65. package/dist/core/tools/read.d.ts.map +0 -1
  66. package/dist/core/tools/read.js +0 -397
  67. package/dist/core/tools/read.js.map +0 -1
  68. package/dist/core/tools/truncate.d.ts +0 -70
  69. package/dist/core/tools/truncate.d.ts.map +0 -1
  70. package/dist/core/tools/truncate.js +0 -205
  71. package/dist/core/tools/truncate.js.map +0 -1
  72. package/dist/core/tools/webfetch.d.ts +0 -174
  73. package/dist/core/tools/webfetch.d.ts.map +0 -1
  74. package/dist/core/tools/webfetch.js +0 -380
  75. package/dist/core/tools/webfetch.js.map +0 -1
  76. package/dist/core/tools/websearch.d.ts +0 -190
  77. package/dist/core/tools/websearch.d.ts.map +0 -1
  78. package/dist/core/tools/websearch.js +0 -267
  79. package/dist/core/tools/websearch.js.map +0 -1
  80. package/dist/core/tools/write.d.ts +0 -273
  81. package/dist/core/tools/write.d.ts.map +0 -1
  82. package/dist/core/tools/write.js +0 -288
  83. package/dist/core/tools/write.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../../src/core/tools/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO;AACnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC,CAAC,gCAAgC;AAkCzE;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;QAClB,OAAO,GAAG,KAAK,GAAG,CAAC;IACpB,CAAC;SAAM,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QAChC,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACzC,CAAC;SAAM,CAAC;QACP,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,UAA6B,EAAE;IAC5E,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IAEvD,MAAM,UAAU,GAAG,MAAM,CA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AO,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC3B,IAAY,EACZ,WAAmB,oBAAoB;IAEvC,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,iBAAiB,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAClF,CAAC"}
@@ -1,174 +0,0 @@
1
- /**
2
- * Web Fetch Tool - Retrieve and transform content from URLs
3
- *
4
- * @module core/tools/webfetch
5
- * @description
6
- * Implements the web fetch tool for the agent. Retrieves content from URLs with:
7
- * - Multiple format options (text, markdown, HTML)
8
- * - HTML to markdown conversion
9
- * - Response size limiting
10
- * - Timeout enforcement
11
- * - Custom fetch implementations
12
- * - Error handling and validation
13
- *
14
- * ## Tool Interface
15
- *
16
- * **Input Parameters:**
17
- * - `url` (required): URL to fetch (must start with http:// or https://)
18
- * - `format` (optional): Output format (text, markdown, html; default: markdown)
19
- * - `timeout` (optional): Timeout in seconds (max 120; default: 30)
20
- *
21
- * **Output:**
22
- * - Content in requested format
23
- * - Details: Original URL, format, content type, bytes fetched
24
- * - Error if URL invalid, fetch fails, or timeout
25
- *
26
- * **Error Behavior:**
27
- * - Invalid URL: Tool error "Invalid URL"
28
- * - Network error: Tool error "Failed to fetch URL"
29
- * - Timeout: Tool error "Request timed out after N seconds"
30
- * - Large response: Tool error "Response too large (N > 5MB)"
31
- *
32
- * ## Usage in Agent
33
- *
34
- * The agent uses this tool to:
35
- * - Research topics from web pages
36
- * - Fetch API documentation
37
- * - Get current information (news, status pages)
38
- * - Read blog posts and articles
39
- * - Access public datasets and APIs
40
- *
41
- * ## Features
42
- *
43
- * **Format Options:**
44
- * - **text**: Plain text (HTML stripped)
45
- * - **markdown**: Readable markdown (converted from HTML)
46
- * - **html**: Raw HTML (unmodified)
47
- *
48
- * **HTML to Markdown:**
49
- * - Preserves heading structure
50
- * - Converts lists and tables
51
- * - Preserves links with markdown syntax
52
- * - Removes scripts and styles
53
- * - Cleans up extra whitespace
54
- *
55
- * **Response Safety:**
56
- * - Size limited to 5MB by default
57
- * - Timeout enforcement (max 120s)
58
- * - Character encoding detection
59
- * - Error handling for network issues
60
- *
61
- * **User-Agent:**
62
- * - Standard browser user-agent
63
- * - Identifies as coding agent
64
- * - Follows robots.txt appropriately
65
- *
66
- * ## Security
67
- *
68
- * **URL validation:**
69
- * - Only http and https allowed
70
- * - No file:// or data: URLs
71
- * - Localhost URLs allowed (for local services)
72
- *
73
- * **Response safety:**
74
- * - Size limited (prevents OOM)
75
- * - Timeout prevents hangs
76
- * - Character encoding validated
77
- * - JavaScript/scripts not executed
78
- *
79
- * **Data safety:**
80
- * - No cookies sent by default
81
- * - No authentication (caller provides if needed)
82
- * - HTTPS preferred over HTTP
83
- *
84
- * ## Examples
85
- *
86
- * ### Fetch webpage as markdown
87
- * ```typescript
88
- * // Agent calls: webfetch {
89
- * // url: "https://example.com",
90
- * // format: "markdown"
91
- * // }
92
- * // Returns: Page content as markdown
93
- * ```
94
- *
95
- * ### Fetch with timeout
96
- * ```typescript
97
- * // Agent calls: webfetch {
98
- * // url: "https://api.example.com/data",
99
- * // timeout: 10
100
- * // }
101
- * // Returns: Content or error after 10 seconds
102
- * ```
103
- *
104
- * ### Fetch raw HTML
105
- * ```typescript
106
- * // Agent calls: webfetch {
107
- * // url: "https://example.com",
108
- * // format: "html"
109
- * // }
110
- * // Returns: Raw HTML content
111
- * ```
112
- *
113
- * ## Attribution
114
- *
115
- * Based on: indusagi-agent webfetch tool
116
- * Modifications:
117
- * - Added HTML to markdown conversion
118
- * - Added format options
119
- * - Added custom operations interface
120
- * - Improved error handling and messages
121
- */
122
- import type { AgentTool } from "indusagi/agent";
123
- declare const webFetchSchema: import("@sinclair/typebox").TObject<{
124
- url: import("@sinclair/typebox").TString;
125
- format: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"text">, import("@sinclair/typebox").TLiteral<"markdown">, import("@sinclair/typebox").TLiteral<"html">]>>;
126
- timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
127
- }>;
128
- export interface WebFetchToolDetails {
129
- url: string;
130
- format?: "text" | "markdown" | "html";
131
- timeout?: number;
132
- contentType?: string;
133
- fetchedBytes?: number;
134
- }
135
- export interface WebFetchToolOptions {
136
- /** Maximum response size in bytes (default: 5MB) */
137
- maxResponseSize?: number;
138
- /** Default timeout in milliseconds (default: 30000) */
139
- defaultTimeout?: number;
140
- }
141
- /**
142
- * Pluggable operations for the web fetch tool.
143
- * Override these to delegate fetching to alternative providers.
144
- */
145
- export interface WebFetchOperations {
146
- /**
147
- * Fetch content from a URL
148
- */
149
- fetch: (url: string, options: RequestInit & {
150
- timeout?: number;
151
- }, signal?: AbortSignal) => Promise<{
152
- arrayBuffer: ArrayBuffer;
153
- headers: Headers;
154
- status: number;
155
- statusText: string;
156
- }>;
157
- /**
158
- * Convert HTML to text
159
- */
160
- htmlToText: (html: string) => Promise<string>;
161
- /**
162
- * Convert HTML to markdown
163
- */
164
- htmlToMarkdown: (html: string) => string;
165
- }
166
- export declare function createWebFetchTool(options?: WebFetchToolOptions): AgentTool<typeof webFetchSchema>;
167
- /** Default web fetch tool */
168
- export declare const webFetchTool: AgentTool<import("@sinclair/typebox").TObject<{
169
- url: import("@sinclair/typebox").TString;
170
- format: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"text">, import("@sinclair/typebox").TLiteral<"markdown">, import("@sinclair/typebox").TLiteral<"html">]>>;
171
- timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
172
- }>, any>;
173
- export {};
174
- //# sourceMappingURL=webfetch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webfetch.d.ts","sourceRoot":"","sources":["../../../src/core/tools/webfetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwHG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQhD,QAAA,MAAM,cAAc;;;;EAclB,CAAC;AAEH,MAAM,WAAW,mBAAmB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IACnC,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC;QAClG,WAAW,EAAE,WAAW,CAAC;QACzB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH;;OAEG;IACH,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C;;OAEG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC;AAgKD,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC,OAAO,cAAc,CAAC,CAgJlG;AAED,6BAA6B;AAC7B,eAAO,MAAM,YAAY;;;;QAAuB,CAAC"}
@@ -1,380 +0,0 @@
1
- /**
2
- * Web Fetch Tool - Retrieve and transform content from URLs
3
- *
4
- * @module core/tools/webfetch
5
- * @description
6
- * Implements the web fetch tool for the agent. Retrieves content from URLs with:
7
- * - Multiple format options (text, markdown, HTML)
8
- * - HTML to markdown conversion
9
- * - Response size limiting
10
- * - Timeout enforcement
11
- * - Custom fetch implementations
12
- * - Error handling and validation
13
- *
14
- * ## Tool Interface
15
- *
16
- * **Input Parameters:**
17
- * - `url` (required): URL to fetch (must start with http:// or https://)
18
- * - `format` (optional): Output format (text, markdown, html; default: markdown)
19
- * - `timeout` (optional): Timeout in seconds (max 120; default: 30)
20
- *
21
- * **Output:**
22
- * - Content in requested format
23
- * - Details: Original URL, format, content type, bytes fetched
24
- * - Error if URL invalid, fetch fails, or timeout
25
- *
26
- * **Error Behavior:**
27
- * - Invalid URL: Tool error "Invalid URL"
28
- * - Network error: Tool error "Failed to fetch URL"
29
- * - Timeout: Tool error "Request timed out after N seconds"
30
- * - Large response: Tool error "Response too large (N > 5MB)"
31
- *
32
- * ## Usage in Agent
33
- *
34
- * The agent uses this tool to:
35
- * - Research topics from web pages
36
- * - Fetch API documentation
37
- * - Get current information (news, status pages)
38
- * - Read blog posts and articles
39
- * - Access public datasets and APIs
40
- *
41
- * ## Features
42
- *
43
- * **Format Options:**
44
- * - **text**: Plain text (HTML stripped)
45
- * - **markdown**: Readable markdown (converted from HTML)
46
- * - **html**: Raw HTML (unmodified)
47
- *
48
- * **HTML to Markdown:**
49
- * - Preserves heading structure
50
- * - Converts lists and tables
51
- * - Preserves links with markdown syntax
52
- * - Removes scripts and styles
53
- * - Cleans up extra whitespace
54
- *
55
- * **Response Safety:**
56
- * - Size limited to 5MB by default
57
- * - Timeout enforcement (max 120s)
58
- * - Character encoding detection
59
- * - Error handling for network issues
60
- *
61
- * **User-Agent:**
62
- * - Standard browser user-agent
63
- * - Identifies as coding agent
64
- * - Follows robots.txt appropriately
65
- *
66
- * ## Security
67
- *
68
- * **URL validation:**
69
- * - Only http and https allowed
70
- * - No file:// or data: URLs
71
- * - Localhost URLs allowed (for local services)
72
- *
73
- * **Response safety:**
74
- * - Size limited (prevents OOM)
75
- * - Timeout prevents hangs
76
- * - Character encoding validated
77
- * - JavaScript/scripts not executed
78
- *
79
- * **Data safety:**
80
- * - No cookies sent by default
81
- * - No authentication (caller provides if needed)
82
- * - HTTPS preferred over HTTP
83
- *
84
- * ## Examples
85
- *
86
- * ### Fetch webpage as markdown
87
- * ```typescript
88
- * // Agent calls: webfetch {
89
- * // url: "https://example.com",
90
- * // format: "markdown"
91
- * // }
92
- * // Returns: Page content as markdown
93
- * ```
94
- *
95
- * ### Fetch with timeout
96
- * ```typescript
97
- * // Agent calls: webfetch {
98
- * // url: "https://api.example.com/data",
99
- * // timeout: 10
100
- * // }
101
- * // Returns: Content or error after 10 seconds
102
- * ```
103
- *
104
- * ### Fetch raw HTML
105
- * ```typescript
106
- * // Agent calls: webfetch {
107
- * // url: "https://example.com",
108
- * // format: "html"
109
- * // }
110
- * // Returns: Raw HTML content
111
- * ```
112
- *
113
- * ## Attribution
114
- *
115
- * Based on: indusagi-agent webfetch tool
116
- * Modifications:
117
- * - Added HTML to markdown conversion
118
- * - Added format options
119
- * - Added custom operations interface
120
- * - Improved error handling and messages
121
- */
122
- import { Type } from "@sinclair/typebox";
123
- const MAX_RESPONSE_SIZE = 5 * 1024 * 1024; // 5MB
124
- const DEFAULT_TIMEOUT = 30 * 1000; // 30 seconds
125
- const MAX_TIMEOUT = 120 * 1000; // 2 minutes
126
- const webFetchSchema = Type.Object({
127
- url: Type.String({ description: "The URL to fetch content from (must start with http:// or https://)" }),
128
- format: Type.Optional(Type.Union([
129
- Type.Literal("text"),
130
- Type.Literal("markdown"),
131
- Type.Literal("html"),
132
- ], {
133
- description: "The format to return the content in (text, markdown, or html). Defaults to markdown.",
134
- })),
135
- timeout: Type.Optional(Type.Number({ description: "Optional timeout in seconds (max 120). Default: 30" })),
136
- });
137
- /**
138
- * Simple HTML to text converter - strips HTML tags
139
- */
140
- async function htmlToTextSimple(html) {
141
- // Remove script and style elements
142
- let text = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "");
143
- text = text.replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi, "");
144
- text = text.replace(/<noscript\b[^<]*(?:(?!<\/noscript>)<[^<]*)*<\/noscript>/gi, "");
145
- // Decode HTML entities
146
- text = text.replace(/&amp;/g, "&");
147
- text = text.replace(/&lt;/g, "<");
148
- text = text.replace(/&gt;/g, ">");
149
- text = text.replace(/&quot;/g, '"');
150
- text = text.replace(/&#39;/g, "'");
151
- text = text.replace(/&nbsp;/g, " ");
152
- // Remove all remaining HTML tags
153
- text = text.replace(/<[^>]+>/g, " ");
154
- // Normalize whitespace
155
- text = text.replace(/\s+/g, " ");
156
- text = text.trim();
157
- return text;
158
- }
159
- /**
160
- * Simple HTML to markdown converter - basic conversion only
161
- */
162
- function htmlToMarkdownSimple(html) {
163
- let markdown = html;
164
- // Remove script, style, noscript, meta, link elements
165
- markdown = markdown.replace(/<(script|style|noscript|meta|link)\b[^<]*(?:(?!<\/\1>)<[^<]*)*<\/\1>/gi, "");
166
- // Headers
167
- markdown = markdown.replace(/<h1\b[^>]*>(.*?)<\/h1>/gi, "# $1\n");
168
- markdown = markdown.replace(/<h2\b[^>]*>(.*?)<\/h2>/gi, "## $1\n");
169
- markdown = markdown.replace(/<h3\b[^>]*>(.*?)<\/h3>/gi, "### $1\n");
170
- markdown = markdown.replace(/<h4\b[^>]*>(.*?)<\/h4>/gi, "#### $1\n");
171
- markdown = markdown.replace(/<h5\b[^>]*>(.*?)<\/h5>/gi, "##### $1\n");
172
- markdown = markdown.replace(/<h6\b[^>]*>(.*?)<\/h6>/gi, "###### $1\n");
173
- // Bold and italic
174
- markdown = markdown.replace(/<strong\b[^>]*>(.*?)<\/strong>/gi, "**$1**");
175
- markdown = markdown.replace(/<b\b[^>]*>(.*?)<\/b>/gi, "**$1**");
176
- markdown = markdown.replace(/<em\b[^>]*>(.*?)<\/em>/gi, "*$1*");
177
- markdown = markdown.replace(/<i\b[^>]*>(.*?)<\/i>/gi, "*$1*");
178
- // Links
179
- markdown = markdown.replace(/<a\b[^>]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi, "[$2]($1)");
180
- // Images
181
- markdown = markdown.replace(/<img\b[^>]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi, "![$2]($1)");
182
- markdown = markdown.replace(/<img\b[^>]*src="([^"]*)"[^>]*>/gi, "![]($1)");
183
- // Code blocks
184
- markdown = markdown.replace(/<pre\b[^>]*><code\b[^>]*>(.*?)<\/code><\/pre>/gis, "```\n$1\n```");
185
- markdown = markdown.replace(/<code\b[^>]*>(.*?)<\/code>/gi, "`$1`");
186
- // Lists (basic)
187
- markdown = markdown.replace(/<ul\b[^>]*>/gi, "");
188
- markdown = markdown.replace(/<\/ul>/gi, "");
189
- markdown = markdown.replace(/<ol\b[^>]*>/gi, "");
190
- markdown = markdown.replace(/<\/ol>/gi, "");
191
- markdown = markdown.replace(/<li\b[^>]*>/gi, "- ");
192
- markdown = markdown.replace(/<\/li>/gi, "\n");
193
- // Blockquotes
194
- markdown = markdown.replace(/<blockquote\b[^>]*>(.*?)<\/blockquote>/gis, (match, content) => {
195
- return content.split("\n").map((line) => `> ${line}`).join("\n");
196
- });
197
- // Horizontal rule
198
- markdown = markdown.replace(/<hr\b[^>]*>/gi, "\n---\n");
199
- // Paragraphs
200
- markdown = markdown.replace(/<p\b[^>]*>/gi, "");
201
- markdown = markdown.replace(/<\/p>/gi, "\n\n");
202
- // Line breaks
203
- markdown = markdown.replace(/<br\b[^>]*>/gi, "\n");
204
- // Remove all remaining tags
205
- markdown = markdown.replace(/<[^>]+>/g, "");
206
- // Normalize whitespace
207
- markdown = markdown.replace(/\n{3,}/g, "\n\n");
208
- markdown = markdown.replace(/[ \t]+/g, " ");
209
- markdown = markdown.trim();
210
- return markdown;
211
- }
212
- /**
213
- * Default fetch with timeout support
214
- */
215
- async function fetchWithTimeout(url, options = {}, signal) {
216
- const timeout = options.timeout || DEFAULT_TIMEOUT;
217
- // Create an abort controller for timeout
218
- const timeoutController = new AbortController();
219
- const timeoutId = setTimeout(() => timeoutController.abort(), timeout);
220
- // If an external signal is provided, abort timeout controller when it aborts
221
- if (signal) {
222
- if (signal.aborted) {
223
- clearTimeout(timeoutId);
224
- throw new Error("Request aborted by user");
225
- }
226
- signal.addEventListener("abort", () => {
227
- clearTimeout(timeoutId);
228
- }, { once: true });
229
- }
230
- try {
231
- const response = await fetch(url, {
232
- ...options,
233
- signal: timeoutController.signal,
234
- });
235
- clearTimeout(timeoutId);
236
- return response;
237
- }
238
- catch (error) {
239
- clearTimeout(timeoutId);
240
- if (error.name === "AbortError") {
241
- if (signal?.aborted) {
242
- throw new Error("Request aborted by user");
243
- }
244
- throw new Error(`Request timed out after ${timeout / 1000} seconds`);
245
- }
246
- throw error;
247
- }
248
- }
249
- const defaultWebFetchOperations = {
250
- fetch: async (url, options, signal) => {
251
- const response = await fetchWithTimeout(url, options, signal);
252
- if (!response.ok) {
253
- throw new Error(`Request failed with status code: ${response.status}`);
254
- }
255
- return {
256
- arrayBuffer: await response.arrayBuffer(),
257
- headers: response.headers,
258
- status: response.status,
259
- statusText: response.statusText,
260
- };
261
- },
262
- htmlToText: htmlToTextSimple,
263
- htmlToMarkdown: htmlToMarkdownSimple,
264
- };
265
- export function createWebFetchTool(options) {
266
- const maxResponseSize = options?.maxResponseSize || MAX_RESPONSE_SIZE;
267
- const defaultTimeout = options?.defaultTimeout || DEFAULT_TIMEOUT;
268
- const ops = defaultWebFetchOperations;
269
- return {
270
- name: "webfetch",
271
- label: "webfetch",
272
- description: "Fetches content from a specified URL. Takes a URL and optional format as input. Fetches the URL content, converts to requested format (markdown by default). Returns the content in the specified format. Use this tool when you need to retrieve and analyze web content. The URL must be a fully-formed valid URL starting with http:// or https://. Format options: 'markdown' (default), 'text', or 'html'. This tool is read-only and does not modify any files. Results may be summarized if the content is very large.",
273
- parameters: webFetchSchema,
274
- execute: async (_toolCallId, params, signal) => {
275
- // Check if already aborted
276
- if (signal?.aborted) {
277
- throw new Error("Web fetch aborted");
278
- }
279
- // Validate URL
280
- if (!params.url.startsWith("http://") && !params.url.startsWith("https://")) {
281
- throw new Error("URL must start with http:// or https://");
282
- }
283
- // Calculate timeout
284
- const timeout = Math.min((params.timeout ?? defaultTimeout / 1000) * 1000, MAX_TIMEOUT);
285
- // Build Accept header based on requested format
286
- let acceptHeader = "*/*";
287
- switch (params.format) {
288
- case "markdown":
289
- acceptHeader =
290
- "text/markdown;q=1.0, text/x-markdown;q=0.9, text/plain;q=0.8, text/html;q=0.7, */*;q=0.1";
291
- break;
292
- case "text":
293
- acceptHeader = "text/plain;q=1.0, text/markdown;q=0.9, text/html;q=0.8, */*;q=0.1";
294
- break;
295
- case "html":
296
- acceptHeader =
297
- "text/html;q=1.0, application/xhtml+xml;q=0.9, text/plain;q=0.8, text/markdown;q=0.7, */*;q=0.1";
298
- break;
299
- default:
300
- acceptHeader =
301
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8";
302
- }
303
- const headers = {
304
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36",
305
- Accept: acceptHeader,
306
- "Accept-Language": "en-US,en;q=0.9",
307
- };
308
- // Fetch the URL
309
- const result = await ops.fetch(params.url, { ...headers, timeout }, signal);
310
- // Check content length
311
- const contentLength = result.headers.get("content-length");
312
- if (contentLength && parseInt(contentLength) > maxResponseSize) {
313
- throw new Error(`Response too large (exceeds ${(maxResponseSize / 1024 / 1024).toFixed(0)}MB limit)`);
314
- }
315
- const fetchedBytes = result.arrayBuffer.byteLength;
316
- if (fetchedBytes > maxResponseSize) {
317
- throw new Error(`Response too large (exceeds ${(maxResponseSize / 1024 / 1024).toFixed(0)}MB limit)`);
318
- }
319
- // Get content type
320
- const contentType = result.headers.get("content-type") || "";
321
- const mime = contentType.split(";")[0]?.trim().toLowerCase() || "";
322
- // Check if response is an image
323
- const isImage = mime.startsWith("image/") &&
324
- mime !== "image/svg+xml" &&
325
- mime !== "image/vnd.fastbidsheet";
326
- // Build details
327
- const details = {
328
- url: params.url,
329
- format: params.format,
330
- timeout: params.timeout,
331
- contentType,
332
- fetchedBytes,
333
- };
334
- // Return content based on type
335
- if (isImage) {
336
- const base64Content = Buffer.from(result.arrayBuffer).toString("base64");
337
- return {
338
- content: [
339
- { type: "text", text: "Image fetched successfully" },
340
- { type: "image", data: base64Content, mimeType: mime },
341
- ],
342
- details,
343
- };
344
- }
345
- const content = Buffer.from(result.arrayBuffer).toString("utf-8");
346
- let output;
347
- // Handle content based on requested format and actual content type
348
- const format = params.format || "markdown";
349
- switch (format) {
350
- case "markdown":
351
- if (contentType.includes("text/html")) {
352
- const markdown = ops.htmlToMarkdown(content);
353
- output = [{ type: "text", text: markdown }];
354
- }
355
- else {
356
- output = [{ type: "text", text: content }];
357
- }
358
- break;
359
- case "text":
360
- if (contentType.includes("text/html")) {
361
- const text = await ops.htmlToText(content);
362
- output = [{ type: "text", text: text }];
363
- }
364
- else {
365
- output = [{ type: "text", text: content }];
366
- }
367
- break;
368
- case "html":
369
- output = [{ type: "text", text: content }];
370
- break;
371
- default:
372
- output = [{ type: "text", text: content }];
373
- }
374
- return { content: output, details };
375
- },
376
- };
377
- }
378
- /** Default web fetch tool */
379
- export const webFetchTool = createWebFetchTool();
380
- //# sourceMappingURL=webfetch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"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