indusagi-coding-agent 0.1.21 → 0.1.23
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 +10 -0
- package/README.md +12 -0
- package/dist/core/tools/webfetch.d.ts +59 -0
- package/dist/core/tools/webfetch.d.ts.map +1 -0
- package/dist/core/tools/webfetch.js +265 -0
- package/dist/core/tools/webfetch.js.map +1 -0
- package/dist/core/tools/websearch.d.ts +63 -0
- package/dist/core/tools/websearch.d.ts.map +1 -0
- package/dist/core/tools/websearch.js +140 -0
- package/dist/core/tools/websearch.js.map +1 -0
- package/docs/README.md +78 -0
- package/docs/extensions.md +1 -1
- package/docs/hooks.md +378 -0
- package/docs/sdk.md +12 -0
- package/docs/subagents.md +225 -0
- package/docs/web-tools.md +304 -0
- package/package.json +2 -2
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# Web Tools
|
|
2
|
+
|
|
3
|
+
Indusagi Coding Agent includes built-in tools for web operations - web search and web fetch. These tools allow the agent to access real-time information from the internet beyond its knowledge cutoff.
|
|
4
|
+
|
|
5
|
+
## Web Search Tool
|
|
6
|
+
|
|
7
|
+
### Overview
|
|
8
|
+
|
|
9
|
+
The `websearch` tool performs real-time web searches using the Exa AI API, providing up-to-date information for current events and recent data.
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- **Real-time search** - Access information beyond knowledge cutoff
|
|
14
|
+
- **Configurable results** - Control number of results returned (1-10)
|
|
15
|
+
- **Live crawling** - Two modes:
|
|
16
|
+
- `fallback` (default): Use live crawling as backup if cached content unavailable
|
|
17
|
+
- `preferred`: Prioritize live crawling for fresh content
|
|
18
|
+
- **Search types** - Three modes:
|
|
19
|
+
- `auto` (default): Balanced search
|
|
20
|
+
- `fast`: Quick results
|
|
21
|
+
- `deep`: Comprehensive search
|
|
22
|
+
- **Context optimization** - Configurable character limits for LLM-friendly output
|
|
23
|
+
|
|
24
|
+
### Usage
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Interactive mode - agent will use websearch automatically
|
|
28
|
+
indusagi "Search for latest TypeScript news 2026"
|
|
29
|
+
|
|
30
|
+
# Non-interactive mode
|
|
31
|
+
indusagi -p "Search for AI developments in 2026"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Parameters
|
|
35
|
+
|
|
36
|
+
| Parameter | Type | Description | Default |
|
|
37
|
+
|-----------|------|-------------|---------|
|
|
38
|
+
| `query` | string | Web search query | - |
|
|
39
|
+
| `numResults` | number | Number of results (1-10) | 8 |
|
|
40
|
+
| `livecrawl` | "fallback" \| "preferred" | Live crawl mode | "fallback" |
|
|
41
|
+
| `type` | "auto" \| "fast" \| "deep" | Search type | "auto" |
|
|
42
|
+
| `contextMaxCharacters` | number | Max context chars for LLM | 10000 |
|
|
43
|
+
|
|
44
|
+
### Examples
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Basic search
|
|
48
|
+
indusagi "Search for Node.js latest release"
|
|
49
|
+
|
|
50
|
+
# With specific parameters
|
|
51
|
+
indusagi "Search for 'machine learning frameworks' and return 5 results with fast mode"
|
|
52
|
+
|
|
53
|
+
# Current events
|
|
54
|
+
indusagi "Search for AI news February 2026"
|
|
55
|
+
|
|
56
|
+
# Deep search for comprehensive results
|
|
57
|
+
indusagi "Do a deep search for Kubernetes security best practices"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Output
|
|
61
|
+
|
|
62
|
+
The tool returns search results with:
|
|
63
|
+
- Title and URL of each result
|
|
64
|
+
- Snippet/summary of content
|
|
65
|
+
- Relevance ranking
|
|
66
|
+
- LLM-formatted context for easy processing
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Web Fetch Tool
|
|
71
|
+
|
|
72
|
+
### Overview
|
|
73
|
+
|
|
74
|
+
The `webfetch` tool fetches content from any URL with automatic format conversion. It can retrieve webpages, documentation, or any web-accessible content.
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
- **URL fetching** - Get content from any http/https URL
|
|
79
|
+
- **Format conversion** - Three output formats:
|
|
80
|
+
- `markdown` (default): HTML → Markdown conversion
|
|
81
|
+
- `text`: HTML → Plain text extraction
|
|
82
|
+
- `html`: Raw HTML content
|
|
83
|
+
- **Image support** - Fetch images and return as base64 attachments
|
|
84
|
+
- **Size limits** - 5MB maximum response size
|
|
85
|
+
- **Timeout control** - Configurable timeout up to 120 seconds
|
|
86
|
+
- **Smart headers** - User-Agent and Accept headers for better compatibility
|
|
87
|
+
|
|
88
|
+
### Usage
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Fetch webpage (markdown by default)
|
|
92
|
+
indusagi "Fetch https://github.com/nodejs/node README"
|
|
93
|
+
|
|
94
|
+
# Fetch as plain text
|
|
95
|
+
indusagi "Get https://example.com content as text"
|
|
96
|
+
|
|
97
|
+
# Fetch raw HTML
|
|
98
|
+
indusagi "Fetch https://example.com as HTML"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Parameters
|
|
102
|
+
|
|
103
|
+
| Parameter | Type | Description | Default |
|
|
104
|
+
|-----------|------|-------------|---------|
|
|
105
|
+
| `url` | string | URL to fetch (http:// or https://) | - |
|
|
106
|
+
| `format` | "markdown" \| "text" \| "html" | Output format | "markdown" |
|
|
107
|
+
| `timeout` | number | Timeout in seconds (max 120) | 30 |
|
|
108
|
+
|
|
109
|
+
### Examples
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Fetch GitHub README
|
|
113
|
+
indusagi "Fetch https://raw.githubusercontent.com/nodejs/node/main/README.md"
|
|
114
|
+
|
|
115
|
+
# Fetch documentation
|
|
116
|
+
indusagi "Get the React docs at https://react.dev"
|
|
117
|
+
|
|
118
|
+
# Fetch with custom timeout
|
|
119
|
+
indusagi "Fetch https://slow-website.com with timeout 60 seconds"
|
|
120
|
+
|
|
121
|
+
# Fetch as text
|
|
122
|
+
indusagi "Fetch https://example.com as plain text"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Output
|
|
126
|
+
|
|
127
|
+
- **Text/Markdown**: Returns converted content with formatting preserved
|
|
128
|
+
- **Images**: Returns image data as base64 attachment with metadata
|
|
129
|
+
- **Error handling**: Returns helpful error messages for:
|
|
130
|
+
- Invalid URLs
|
|
131
|
+
- Timeout errors
|
|
132
|
+
- Size limit exceeded
|
|
133
|
+
- HTTP errors (404, 500, etc.)
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Tool Availability
|
|
138
|
+
|
|
139
|
+
Both web tools are included in the **default tool set** and work automatically without any additional configuration:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Available by default
|
|
143
|
+
indusagi "Search for something online"
|
|
144
|
+
|
|
145
|
+
# Explicit selection (optional)
|
|
146
|
+
indusagi --tools websearch,webfetch "Fetch https://example.com"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Default tools: `read`, `bash`, `edit`, `write`, `task`, `todoread`, `todowrite`, **`websearch`**, **`webfetch`**
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Use Cases
|
|
154
|
+
|
|
155
|
+
### Research
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Search for documentation and fetch specific pages
|
|
159
|
+
indusagi "Find TypeScript 5.7 release notes"
|
|
160
|
+
# Agent may search and then fetch specific documentation links
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Current Events
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Get latest news
|
|
167
|
+
indusagi "What are the latest developments in AI for 2026?"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Code Examples
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Search and fetch code examples
|
|
174
|
+
indusagi "Search for 'React useEffect examples' and fetch the best result"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Documentation
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Fetch documentation from URL
|
|
181
|
+
indusagi "Read the documentation at https://developer.mozilla.org/en-US/docs/Web/API"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Best Practices
|
|
187
|
+
|
|
188
|
+
1. **Be specific with queries** - More specific search terms yield better results
|
|
189
|
+
2. **Use current year** - When searching for recent info, include the year (e.g., "2026")
|
|
190
|
+
3. **Start with search** - Use websearch to find relevant URLs, then use webfetch for specific pages
|
|
191
|
+
4. **Check format** - For code/documentation, markdown format is usually best
|
|
192
|
+
5. **Respect limits** - Large pages may be truncated; use offset/limit for large files via read tool
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Configuration
|
|
197
|
+
|
|
198
|
+
The tools can be configured via the `createAgentSession` API:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
import { createAgentSession } from "indusagi-coding-agent";
|
|
202
|
+
|
|
203
|
+
await createAgentSession({
|
|
204
|
+
cwd: process.cwd(),
|
|
205
|
+
tools: {
|
|
206
|
+
websearch: { baseUrl: "https://custom-endpoint.com" },
|
|
207
|
+
webfetch: { maxResponseSize: 10 * 1024 * 1024 } // 10MB
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### WebSearchToolOptions
|
|
213
|
+
|
|
214
|
+
| Option | Type | Description | Default |
|
|
215
|
+
|---------|------|-------------|---------|
|
|
216
|
+
| `baseUrl` | string | Custom API endpoint | "https://mcp.exa.ai" |
|
|
217
|
+
| `apiKey` | string | API key for Exa AI | undefined |
|
|
218
|
+
|
|
219
|
+
### WebFetchToolOptions
|
|
220
|
+
|
|
221
|
+
| Option | Type | Description | Default |
|
|
222
|
+
|---------|------|-------------|---------|
|
|
223
|
+
| `maxResponseSize` | number | Max response size in bytes | 5242880 (5MB) |
|
|
224
|
+
| `defaultTimeout` | number | Default timeout in ms | 30000 (30s) |
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Permissions
|
|
229
|
+
|
|
230
|
+
Both tools require permission before execution. The agent will prompt for confirmation when:
|
|
231
|
+
|
|
232
|
+
- First use of websearch
|
|
233
|
+
- Each webfetch request with a new URL
|
|
234
|
+
|
|
235
|
+
Permission settings can be configured in global settings:
|
|
236
|
+
- `websearch.always` - List of patterns to auto-allow
|
|
237
|
+
- `webfetch.always` - List of URL patterns to auto-allow
|
|
238
|
+
|
|
239
|
+
Example in `.indusagi/settings.json`:
|
|
240
|
+
|
|
241
|
+
```json
|
|
242
|
+
{
|
|
243
|
+
"websearch": {
|
|
244
|
+
"always": ["*"] // Auto-allow all web searches
|
|
245
|
+
},
|
|
246
|
+
"webfetch": {
|
|
247
|
+
"always": ["https://github.com/*", "https://docs.github.com/*"] // Auto-allow GitHub
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Troubleshooting
|
|
255
|
+
|
|
256
|
+
### Web Search Issues
|
|
257
|
+
|
|
258
|
+
**No results found:**
|
|
259
|
+
- Try broader search terms
|
|
260
|
+
- Check spelling of query
|
|
261
|
+
- Use `fast` or `deep` search type
|
|
262
|
+
|
|
263
|
+
**Timeout errors:**
|
|
264
|
+
- Network connectivity issues
|
|
265
|
+
- API temporarily unavailable
|
|
266
|
+
- Try again later
|
|
267
|
+
|
|
268
|
+
### Web Fetch Issues
|
|
269
|
+
|
|
270
|
+
**404 Not Found:**
|
|
271
|
+
- URL is incorrect or page moved
|
|
272
|
+
- Check URL spelling
|
|
273
|
+
|
|
274
|
+
**Timeout:**
|
|
275
|
+
- Increase timeout: `"Fetch URL with timeout 60"`
|
|
276
|
+
- Check network connection
|
|
277
|
+
|
|
278
|
+
**Large content truncated:**
|
|
279
|
+
- Content exceeds 5MB limit
|
|
280
|
+
- Consider using `read` tool with offset/limit for large local files
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## API Details
|
|
285
|
+
|
|
286
|
+
### Exa AI (Web Search)
|
|
287
|
+
|
|
288
|
+
- **Endpoint**: `https://mcp.exa.ai/mcp`
|
|
289
|
+
- **Method**: Server-Sent Events (SSE)
|
|
290
|
+
- **Response**: JSON-RPC 2.0 format
|
|
291
|
+
- **Rate limiting**: Default limits apply
|
|
292
|
+
|
|
293
|
+
### Native Fetch (Web Fetch)
|
|
294
|
+
|
|
295
|
+
- **Implementation**: Native `fetch()` API
|
|
296
|
+
- **Headers**: Accept, User-Agent, Accept-Language
|
|
297
|
+
- **Redirects**: Automatically followed
|
|
298
|
+
- **SSL**: HTTPS with certificate verification
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## License
|
|
303
|
+
|
|
304
|
+
MIT - Same as indusagi-coding-agent
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "indusagi-coding-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management. Now with Kimi (Moonshot AI) support and login command!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"indusagiConfig": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"diff": "^8.0.2",
|
|
51
51
|
"file-type": "^21.1.1",
|
|
52
52
|
"glob": "^11.0.3",
|
|
53
|
-
"indusagi": "0.12.
|
|
53
|
+
"indusagi": "^0.12.8",
|
|
54
54
|
"marked": "^15.0.12",
|
|
55
55
|
"minimatch": "^10.1.1",
|
|
56
56
|
"proper-lockfile": "^4.1.2",
|