indusagi-coding-agent 0.1.23 → 0.1.24
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/CHANGELOG.md +65 -0
- package/README.md +2 -0
- package/dist/cli/args.d.ts +117 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +221 -52
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts +58 -2
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +130 -12
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts +70 -2
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +240 -15
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/list-models.d.ts +63 -3
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +202 -27
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/login-handler.d.ts +82 -8
- package/dist/cli/login-handler.d.ts.map +1 -1
- package/dist/cli/login-handler.js +410 -77
- package/dist/cli/login-handler.js.map +1 -1
- package/dist/cli/session-picker.d.ts +74 -2
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +236 -12
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/core/agent-session.d.ts +214 -9
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +214 -9
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts +302 -12
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +302 -12
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/diagnostics.d.ts +191 -0
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/diagnostics.js +142 -0
- package/dist/core/diagnostics.js.map +1 -1
- package/dist/core/event-bus.d.ts +146 -0
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js +93 -0
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts +4 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +4 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/index.d.ts +128 -0
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +128 -0
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts +4 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +4 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/keybindings.d.ts +142 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +142 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-registry.d.ts +98 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +98 -1
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +99 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +99 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/session-manager.d.ts +127 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +125 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/subagents.js.map +1 -1
- package/dist/core/tools/bash.d.ts +391 -11
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +269 -2
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +284 -6
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +238 -0
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +169 -5
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +136 -0
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +285 -5
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +247 -0
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts +6 -0
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +6 -0
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +308 -7
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +231 -0
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/webfetch.d.ts +118 -3
- package/dist/core/tools/webfetch.d.ts.map +1 -1
- package/dist/core/tools/webfetch.js +118 -3
- package/dist/core/tools/webfetch.js.map +1 -1
- package/dist/core/tools/websearch.d.ts +130 -3
- package/dist/core/tools/websearch.d.ts.map +1 -1
- package/dist/core/tools/websearch.js +130 -3
- package/dist/core/tools/websearch.js.map +1 -1
- package/dist/core/tools/write.d.ts +251 -5
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +210 -0
- package/dist/core/tools/write.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +164 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +164 -1
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +297 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +297 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +251 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +186 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +186 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1567 -13
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1567 -13
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +422 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +422 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts +538 -5
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +538 -5
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +921 -8
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +921 -8
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +802 -9
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +802 -9
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +356 -3
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +356 -3
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/shared.d.ts +386 -0
- package/dist/modes/shared.d.ts.map +1 -0
- package/dist/modes/shared.js +543 -0
- package/dist/modes/shared.js.map +1 -0
- package/dist/utils/array.d.ts +389 -0
- package/dist/utils/array.d.ts.map +1 -0
- package/dist/utils/array.js +585 -0
- package/dist/utils/array.js.map +1 -0
- package/dist/utils/color-formatter.d.ts +318 -0
- package/dist/utils/color-formatter.d.ts.map +1 -0
- package/dist/utils/color-formatter.js +442 -0
- package/dist/utils/color-formatter.js.map +1 -0
- package/dist/utils/data-transformer.d.ts +326 -0
- package/dist/utils/data-transformer.d.ts.map +1 -0
- package/dist/utils/data-transformer.js +512 -0
- package/dist/utils/data-transformer.js.map +1 -0
- package/dist/utils/date-formatter.d.ts +281 -0
- package/dist/utils/date-formatter.d.ts.map +1 -0
- package/dist/utils/date-formatter.js +503 -0
- package/dist/utils/date-formatter.js.map +1 -0
- package/dist/utils/error-handler.d.ts +541 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +726 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/file-operations.d.ts +297 -0
- package/dist/utils/file-operations.d.ts.map +1 -0
- package/dist/utils/file-operations.js +505 -0
- package/dist/utils/file-operations.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +268 -6
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +500 -21
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/json-formatter.d.ts +259 -0
- package/dist/utils/json-formatter.d.ts.map +1 -0
- package/dist/utils/json-formatter.js +517 -0
- package/dist/utils/json-formatter.js.map +1 -0
- package/dist/utils/logger.d.ts +176 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +346 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/markdown-formatter.d.ts +211 -0
- package/dist/utils/markdown-formatter.d.ts.map +1 -0
- package/dist/utils/markdown-formatter.js +482 -0
- package/dist/utils/markdown-formatter.js.map +1 -0
- package/dist/utils/path-validator.d.ts +603 -0
- package/dist/utils/path-validator.d.ts.map +1 -0
- package/dist/utils/path-validator.js +870 -0
- package/dist/utils/path-validator.js.map +1 -0
- package/dist/utils/string-formatter.d.ts +609 -0
- package/dist/utils/string-formatter.d.ts.map +1 -0
- package/dist/utils/string-formatter.js +806 -0
- package/dist/utils/string-formatter.js.map +1 -0
- package/dist/utils/type-guards.d.ts +629 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils/type-guards.js +662 -0
- package/dist/utils/type-guards.js.map +1 -0
- package/docs/COMPLETE-GUIDE.md +300 -0
- package/docs/MODES-ARCHITECTURE.md +565 -0
- package/docs/PRINT-MODE-GUIDE.md +456 -0
- package/docs/RPC-GUIDE.md +705 -0
- package/docs/UTILS-IMPLEMENTATION-SUMMARY.md +647 -0
- package/docs/UTILS-MODULE-OVERVIEW.md +1480 -0
- package/docs/UTILS-QA-CHECKLIST.md +1061 -0
- package/docs/UTILS-USAGE-GUIDE.md +1419 -0
- package/package.json +1 -1
|
@@ -1,8 +1,123 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Web Fetch Tool
|
|
2
|
+
* Web Fetch Tool - Retrieve and transform content from URLs
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
|
6
121
|
*/
|
|
7
122
|
import type { AgentTool } from "indusagi/agent";
|
|
8
123
|
declare const webFetchSchema: import("@sinclair/typebox").TObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webfetch.d.ts","sourceRoot":"","sources":["../../../src/core/tools/webfetch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"webfetch.d.ts","sourceRoot":"","sources":["../../../src/core/tools/webfetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;QAAuB,CAAC"}
|
|
@@ -1,8 +1,123 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Web Fetch Tool
|
|
2
|
+
* Web Fetch Tool - Retrieve and transform content from URLs
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
|
6
121
|
*/
|
|
7
122
|
import { Type } from "@sinclair/typebox";
|
|
8
123
|
const MAX_RESPONSE_SIZE = 5 * 1024 * 1024; // 5MB
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webfetch.js","sourceRoot":"","sources":["../../../src/core/tools/webfetch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"webfetch.js","sourceRoot":"","sources":["../../../src/core/tools/webfetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwHG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,MAAM;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CAAC,CAAC;oBAC5C,CAAC;oBACD,MAAM;gBAEP,KAAK,MAAM;oBACV,IAAI,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;wBACvC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;wBAC3C,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;oBACzC,CAAC;yBAAM,CAAC;wBACP,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC5C,CAAC;oBACD,MAAM;gBAEP,KAAK,MAAM;oBACV,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC3C,MAAM;gBAEP;oBACC,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QACrC,CAAC;KACD,CAAC;AACH,CAAC;AAED,6BAA6B;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,8 +1,135 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Web Search Tool
|
|
2
|
+
* Web Search Tool - Real-time search using Exa AI API
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* @module core/tools/websearch
|
|
5
|
+
* @description
|
|
6
|
+
* Implements the web search tool for the agent. Performs real-time web searches with:
|
|
7
|
+
* - Query-based information retrieval
|
|
8
|
+
* - Configurable result count
|
|
9
|
+
* - Search type options (fast, deep, auto)
|
|
10
|
+
* - Live crawling options
|
|
11
|
+
* - LLM-optimized context
|
|
12
|
+
* - Exa AI API integration
|
|
13
|
+
*
|
|
14
|
+
* ## Tool Interface
|
|
15
|
+
*
|
|
16
|
+
* **Input Parameters:**
|
|
17
|
+
* - `query` (required): Search query
|
|
18
|
+
* - `numResults` (optional): Number of results (1-10; default: 8)
|
|
19
|
+
* - `livecrawl` (optional): Crawling mode (fallback, preferred; default: fallback)
|
|
20
|
+
* - `type` (optional): Search type (auto, fast, deep; default: auto)
|
|
21
|
+
* - `contextMaxCharacters` (optional): Max context chars (default: 10000)
|
|
22
|
+
*
|
|
23
|
+
* **Output:**
|
|
24
|
+
* - Search results with snippets
|
|
25
|
+
* - URLs and relevance info
|
|
26
|
+
* - LLM-optimized context string
|
|
27
|
+
* - Error if API fails or disabled
|
|
28
|
+
*
|
|
29
|
+
* **Error Behavior:**
|
|
30
|
+
* - No API key: Tool error "Web search not available (no API key)"
|
|
31
|
+
* - Network error: Tool error "Search failed: ..."
|
|
32
|
+
* - API error: Tool error "Search API error: ..."
|
|
33
|
+
* - Timeout: Tool error "Search request timed out"
|
|
34
|
+
*
|
|
35
|
+
* ## Usage in Agent
|
|
36
|
+
*
|
|
37
|
+
* The agent uses this tool to:
|
|
38
|
+
* - Search for current information
|
|
39
|
+
* - Find recent news and events
|
|
40
|
+
* - Look up facts and statistics
|
|
41
|
+
* - Research new topics
|
|
42
|
+
* - Answer questions about current events
|
|
43
|
+
*
|
|
44
|
+
* ## Features
|
|
45
|
+
*
|
|
46
|
+
* **Search Types:**
|
|
47
|
+
* - **auto**: Balanced search (recommended)
|
|
48
|
+
* - **fast**: Quick results, less comprehensive
|
|
49
|
+
* - **deep**: Comprehensive search, more thorough
|
|
50
|
+
*
|
|
51
|
+
* **Live Crawling:**
|
|
52
|
+
* - **fallback**: Use cached content, crawl if needed
|
|
53
|
+
* - **preferred**: Prioritize live crawling for fresh content
|
|
54
|
+
*
|
|
55
|
+
* **LLM Optimization:**
|
|
56
|
+
* - Context formatted for language models
|
|
57
|
+
* - Configurable max characters
|
|
58
|
+
* - Snippets and relevance info included
|
|
59
|
+
* - Structured for easy parsing
|
|
60
|
+
*
|
|
61
|
+
* **Result Limiting:**
|
|
62
|
+
* - Min 1, max 10 results
|
|
63
|
+
* - Default 8 results
|
|
64
|
+
* - Configurable per query
|
|
65
|
+
*
|
|
66
|
+
* ## Security
|
|
67
|
+
*
|
|
68
|
+
* **API Authentication:**
|
|
69
|
+
* - Requires Exa AI API key
|
|
70
|
+
* - Key from environment variable or options
|
|
71
|
+
* - No key = tool not available
|
|
72
|
+
*
|
|
73
|
+
* **Query Validation:**
|
|
74
|
+
* - Non-empty query required
|
|
75
|
+
* - No injection attacks (sent to API as-is)
|
|
76
|
+
* - Safe to include user input
|
|
77
|
+
*
|
|
78
|
+
* **Rate Limiting:**
|
|
79
|
+
* - API enforces rate limits
|
|
80
|
+
* - Errors returned if exceeded
|
|
81
|
+
* - Exponential backoff recommended
|
|
82
|
+
*
|
|
83
|
+
* ## Customization
|
|
84
|
+
*
|
|
85
|
+
* **Custom Search Provider:**
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const customTool = createWebSearchTool({
|
|
88
|
+
* operations: {
|
|
89
|
+
* search: async (request, signal) => {
|
|
90
|
+
* // Custom search implementation
|
|
91
|
+
* return JSON.stringify(results);
|
|
92
|
+
* },
|
|
93
|
+
* },
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* ## Examples
|
|
98
|
+
*
|
|
99
|
+
* ### Basic search
|
|
100
|
+
* ```typescript
|
|
101
|
+
* // Agent calls: websearch {query: "latest news about AI"}
|
|
102
|
+
* // Returns: Top 8 news results
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* ### Deep search with more results
|
|
106
|
+
* ```typescript
|
|
107
|
+
* // Agent calls: websearch {
|
|
108
|
+
* // query: "TypeScript generics best practices",
|
|
109
|
+
* // numResults: 10,
|
|
110
|
+
* // type: "deep"
|
|
111
|
+
* // }
|
|
112
|
+
* // Returns: 10 comprehensive results
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* ### Fast search with live crawling
|
|
116
|
+
* ```typescript
|
|
117
|
+
* // Agent calls: websearch {
|
|
118
|
+
* // query: "stock market today",
|
|
119
|
+
* // type: "fast",
|
|
120
|
+
* // livecrawl: "preferred"
|
|
121
|
+
* // }
|
|
122
|
+
* // Returns: Quick results with live data
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* ## Attribution
|
|
126
|
+
*
|
|
127
|
+
* Based on: indusagi-agent websearch tool
|
|
128
|
+
* Modifications:
|
|
129
|
+
* - Added search type options
|
|
130
|
+
* - Added live crawl configuration
|
|
131
|
+
* - Added context optimization
|
|
132
|
+
* - Improved error handling
|
|
6
133
|
*/
|
|
7
134
|
import type { AgentTool } from "indusagi/agent";
|
|
8
135
|
declare const webSearchSchema: import("@sinclair/typebox").TObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websearch.d.ts","sourceRoot":"","sources":["../../../src/core/tools/websearch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"websearch.d.ts","sourceRoot":"","sources":["../../../src/core/tools/websearch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAYhD,QAAA,MAAM,eAAe;;;;;;EA6BnB,CAAC;AAEH,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACpC,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,MAAM,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7E;AAED,UAAU,gBAAgB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE;YACV,KAAK,EAAE,MAAM,CAAC;YACd,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,SAAS,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;YACrC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;YAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;SAC9B,CAAC;KACF,CAAC;CACF;AAqED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC,OAAO,eAAe,CAAC,CAoErG;AAED,8BAA8B;AAC9B,eAAO,MAAM,aAAa;;;;;;QAAwB,CAAC"}
|
|
@@ -1,8 +1,135 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Web Search Tool
|
|
2
|
+
* Web Search Tool - Real-time search using Exa AI API
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* @module core/tools/websearch
|
|
5
|
+
* @description
|
|
6
|
+
* Implements the web search tool for the agent. Performs real-time web searches with:
|
|
7
|
+
* - Query-based information retrieval
|
|
8
|
+
* - Configurable result count
|
|
9
|
+
* - Search type options (fast, deep, auto)
|
|
10
|
+
* - Live crawling options
|
|
11
|
+
* - LLM-optimized context
|
|
12
|
+
* - Exa AI API integration
|
|
13
|
+
*
|
|
14
|
+
* ## Tool Interface
|
|
15
|
+
*
|
|
16
|
+
* **Input Parameters:**
|
|
17
|
+
* - `query` (required): Search query
|
|
18
|
+
* - `numResults` (optional): Number of results (1-10; default: 8)
|
|
19
|
+
* - `livecrawl` (optional): Crawling mode (fallback, preferred; default: fallback)
|
|
20
|
+
* - `type` (optional): Search type (auto, fast, deep; default: auto)
|
|
21
|
+
* - `contextMaxCharacters` (optional): Max context chars (default: 10000)
|
|
22
|
+
*
|
|
23
|
+
* **Output:**
|
|
24
|
+
* - Search results with snippets
|
|
25
|
+
* - URLs and relevance info
|
|
26
|
+
* - LLM-optimized context string
|
|
27
|
+
* - Error if API fails or disabled
|
|
28
|
+
*
|
|
29
|
+
* **Error Behavior:**
|
|
30
|
+
* - No API key: Tool error "Web search not available (no API key)"
|
|
31
|
+
* - Network error: Tool error "Search failed: ..."
|
|
32
|
+
* - API error: Tool error "Search API error: ..."
|
|
33
|
+
* - Timeout: Tool error "Search request timed out"
|
|
34
|
+
*
|
|
35
|
+
* ## Usage in Agent
|
|
36
|
+
*
|
|
37
|
+
* The agent uses this tool to:
|
|
38
|
+
* - Search for current information
|
|
39
|
+
* - Find recent news and events
|
|
40
|
+
* - Look up facts and statistics
|
|
41
|
+
* - Research new topics
|
|
42
|
+
* - Answer questions about current events
|
|
43
|
+
*
|
|
44
|
+
* ## Features
|
|
45
|
+
*
|
|
46
|
+
* **Search Types:**
|
|
47
|
+
* - **auto**: Balanced search (recommended)
|
|
48
|
+
* - **fast**: Quick results, less comprehensive
|
|
49
|
+
* - **deep**: Comprehensive search, more thorough
|
|
50
|
+
*
|
|
51
|
+
* **Live Crawling:**
|
|
52
|
+
* - **fallback**: Use cached content, crawl if needed
|
|
53
|
+
* - **preferred**: Prioritize live crawling for fresh content
|
|
54
|
+
*
|
|
55
|
+
* **LLM Optimization:**
|
|
56
|
+
* - Context formatted for language models
|
|
57
|
+
* - Configurable max characters
|
|
58
|
+
* - Snippets and relevance info included
|
|
59
|
+
* - Structured for easy parsing
|
|
60
|
+
*
|
|
61
|
+
* **Result Limiting:**
|
|
62
|
+
* - Min 1, max 10 results
|
|
63
|
+
* - Default 8 results
|
|
64
|
+
* - Configurable per query
|
|
65
|
+
*
|
|
66
|
+
* ## Security
|
|
67
|
+
*
|
|
68
|
+
* **API Authentication:**
|
|
69
|
+
* - Requires Exa AI API key
|
|
70
|
+
* - Key from environment variable or options
|
|
71
|
+
* - No key = tool not available
|
|
72
|
+
*
|
|
73
|
+
* **Query Validation:**
|
|
74
|
+
* - Non-empty query required
|
|
75
|
+
* - No injection attacks (sent to API as-is)
|
|
76
|
+
* - Safe to include user input
|
|
77
|
+
*
|
|
78
|
+
* **Rate Limiting:**
|
|
79
|
+
* - API enforces rate limits
|
|
80
|
+
* - Errors returned if exceeded
|
|
81
|
+
* - Exponential backoff recommended
|
|
82
|
+
*
|
|
83
|
+
* ## Customization
|
|
84
|
+
*
|
|
85
|
+
* **Custom Search Provider:**
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const customTool = createWebSearchTool({
|
|
88
|
+
* operations: {
|
|
89
|
+
* search: async (request, signal) => {
|
|
90
|
+
* // Custom search implementation
|
|
91
|
+
* return JSON.stringify(results);
|
|
92
|
+
* },
|
|
93
|
+
* },
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* ## Examples
|
|
98
|
+
*
|
|
99
|
+
* ### Basic search
|
|
100
|
+
* ```typescript
|
|
101
|
+
* // Agent calls: websearch {query: "latest news about AI"}
|
|
102
|
+
* // Returns: Top 8 news results
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* ### Deep search with more results
|
|
106
|
+
* ```typescript
|
|
107
|
+
* // Agent calls: websearch {
|
|
108
|
+
* // query: "TypeScript generics best practices",
|
|
109
|
+
* // numResults: 10,
|
|
110
|
+
* // type: "deep"
|
|
111
|
+
* // }
|
|
112
|
+
* // Returns: 10 comprehensive results
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* ### Fast search with live crawling
|
|
116
|
+
* ```typescript
|
|
117
|
+
* // Agent calls: websearch {
|
|
118
|
+
* // query: "stock market today",
|
|
119
|
+
* // type: "fast",
|
|
120
|
+
* // livecrawl: "preferred"
|
|
121
|
+
* // }
|
|
122
|
+
* // Returns: Quick results with live data
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* ## Attribution
|
|
126
|
+
*
|
|
127
|
+
* Based on: indusagi-agent websearch tool
|
|
128
|
+
* Modifications:
|
|
129
|
+
* - Added search type options
|
|
130
|
+
* - Added live crawl configuration
|
|
131
|
+
* - Added context optimization
|
|
132
|
+
* - Improved error handling
|
|
6
133
|
*/
|
|
7
134
|
import { Type } from "@sinclair/typebox";
|
|
8
135
|
const API_CONFIG = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websearch.js","sourceRoot":"","sources":["../../../src/core/tools/websearch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"websearch.js","sourceRoot":"","sources":["../../../src/core/tools/websearch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoIG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,MAAM,UAAU,GAAG;IAClB,QAAQ,EAAE,oBAAoB;IAC9B,SAAS,EAAE;QACV,MAAM,EAAE,MAAM;KACd;IACD,mBAAmB,EAAE,CAAC;CACb,CAAC;AAEX,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;IACvD,UAAU,EAAE,IAAI,CAA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