indusagi-coding-agent 0.1.28 → 0.1.30
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 +23 -0
- package/LICENSE.md +22 -0
- package/README.md +2 -0
- package/dist/core/messages.d.ts +1 -76
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +1 -122
- package/dist/core/messages.js.map +1 -1
- package/dist/core/session-manager.d.ts +1 -447
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1 -1203
- package/dist/core/session-manager.js.map +1 -1
- package/package.json +2 -2
- package/docs/COMPLETE-GUIDE.md +0 -300
- package/docs/COMPREHENSIVE-CLI-SUMMARY.md +0 -900
- package/docs/MODES-ARCHITECTURE.md +0 -565
- package/docs/PRINT-MODE-GUIDE.md +0 -456
- package/docs/README.md +0 -78
- package/docs/RPC-GUIDE.md +0 -705
- package/docs/UTILS-IMPLEMENTATION-SUMMARY.md +0 -647
- package/docs/UTILS-MODULE-OVERVIEW.md +0 -1480
- package/docs/UTILS-QA-CHECKLIST.md +0 -1061
- package/docs/UTILS-USAGE-GUIDE.md +0 -1419
- package/docs/compaction.md +0 -390
- package/docs/custom-provider.md +0 -538
- package/docs/development.md +0 -69
- package/docs/extensions.md +0 -1733
- package/docs/hooks.md +0 -378
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/json.md +0 -79
- package/docs/keybindings.md +0 -162
- package/docs/models.md +0 -193
- package/docs/packages.md +0 -163
- package/docs/prompt-templates.md +0 -67
- package/docs/providers.md +0 -147
- package/docs/rpc.md +0 -1048
- package/docs/sdk.md +0 -969
- package/docs/session.md +0 -412
- package/docs/settings.md +0 -219
- package/docs/shell-aliases.md +0 -13
- package/docs/skills.md +0 -226
- package/docs/subagents.md +0 -225
- package/docs/terminal-setup.md +0 -65
- package/docs/themes.md +0 -295
- package/docs/tree.md +0 -219
- package/docs/tui.md +0 -887
- package/docs/web-tools.md +0 -304
- package/docs/windows.md +0 -17
- package/examples/README.md +0 -25
- package/examples/extensions/README.md +0 -192
- package/examples/extensions/antigravity-image-gen.ts +0 -414
- package/examples/extensions/auto-commit-on-exit.ts +0 -49
- package/examples/extensions/bookmark.ts +0 -50
- package/examples/extensions/claude-rules.ts +0 -86
- package/examples/extensions/confirm-destructive.ts +0 -59
- package/examples/extensions/custom-compaction.ts +0 -115
- package/examples/extensions/custom-footer.ts +0 -65
- package/examples/extensions/custom-header.ts +0 -73
- package/examples/extensions/custom-provider-anthropic/index.ts +0 -605
- package/examples/extensions/custom-provider-anthropic/package-lock.json +0 -24
- package/examples/extensions/custom-provider-anthropic/package.json +0 -19
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +0 -350
- package/examples/extensions/custom-provider-gitlab-duo/package.json +0 -16
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +0 -83
- package/examples/extensions/dirty-repo-guard.ts +0 -56
- package/examples/extensions/doom-overlay/README.md +0 -46
- package/examples/extensions/doom-overlay/doom/build/doom.js +0 -21
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +0 -152
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
- package/examples/extensions/doom-overlay/doom-component.ts +0 -133
- package/examples/extensions/doom-overlay/doom-engine.ts +0 -173
- package/examples/extensions/doom-overlay/doom-keys.ts +0 -105
- package/examples/extensions/doom-overlay/index.ts +0 -74
- package/examples/extensions/doom-overlay/wad-finder.ts +0 -51
- package/examples/extensions/event-bus.ts +0 -43
- package/examples/extensions/file-trigger.ts +0 -41
- package/examples/extensions/git-checkpoint.ts +0 -53
- package/examples/extensions/handoff.ts +0 -151
- package/examples/extensions/hello.ts +0 -25
- package/examples/extensions/inline-bash.ts +0 -94
- package/examples/extensions/input-transform.ts +0 -43
- package/examples/extensions/interactive-shell.ts +0 -196
- package/examples/extensions/mac-system-theme.ts +0 -47
- package/examples/extensions/message-renderer.ts +0 -60
- package/examples/extensions/modal-editor.ts +0 -86
- package/examples/extensions/model-status.ts +0 -31
- package/examples/extensions/notify.ts +0 -25
- package/examples/extensions/overlay-qa-tests.ts +0 -882
- package/examples/extensions/overlay-test.ts +0 -151
- package/examples/extensions/permission-gate.ts +0 -34
- package/examples/extensions/pirate.ts +0 -47
- package/examples/extensions/plan-mode/README.md +0 -65
- package/examples/extensions/plan-mode/index.ts +0 -341
- package/examples/extensions/plan-mode/utils.ts +0 -168
- package/examples/extensions/preset.ts +0 -399
- package/examples/extensions/protected-paths.ts +0 -30
- package/examples/extensions/qna.ts +0 -120
- package/examples/extensions/question.ts +0 -265
- package/examples/extensions/questionnaire.ts +0 -428
- package/examples/extensions/rainbow-editor.ts +0 -88
- package/examples/extensions/sandbox/index.ts +0 -318
- package/examples/extensions/sandbox/package-lock.json +0 -92
- package/examples/extensions/sandbox/package.json +0 -19
- package/examples/extensions/send-user-message.ts +0 -97
- package/examples/extensions/session-name.ts +0 -27
- package/examples/extensions/shutdown-command.ts +0 -63
- package/examples/extensions/snake.ts +0 -344
- package/examples/extensions/space-invaders.ts +0 -561
- package/examples/extensions/ssh.ts +0 -220
- package/examples/extensions/status-line.ts +0 -40
- package/examples/extensions/subagent/README.md +0 -172
- package/examples/extensions/subagent/agents/planner.md +0 -37
- package/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/examples/extensions/subagent/agents/scout.md +0 -50
- package/examples/extensions/subagent/agents/worker.md +0 -24
- package/examples/extensions/subagent/agents.ts +0 -127
- package/examples/extensions/subagent/index.ts +0 -964
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/examples/extensions/subagent/prompts/implement.md +0 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
- package/examples/extensions/summarize.ts +0 -196
- package/examples/extensions/timed-confirm.ts +0 -70
- package/examples/extensions/todo.ts +0 -300
- package/examples/extensions/tool-override.ts +0 -144
- package/examples/extensions/tools.ts +0 -147
- package/examples/extensions/trigger-compact.ts +0 -40
- package/examples/extensions/truncated-tool.ts +0 -193
- package/examples/extensions/widget-placement.ts +0 -17
- package/examples/extensions/with-deps/index.ts +0 -36
- package/examples/extensions/with-deps/package-lock.json +0 -31
- package/examples/extensions/with-deps/package.json +0 -22
- package/examples/sdk/01-minimal.ts +0 -22
- package/examples/sdk/02-custom-model.ts +0 -50
- package/examples/sdk/03-custom-prompt.ts +0 -55
- package/examples/sdk/04-skills.ts +0 -46
- package/examples/sdk/05-tools.ts +0 -56
- package/examples/sdk/06-extensions.ts +0 -88
- package/examples/sdk/07-context-files.ts +0 -40
- package/examples/sdk/08-prompt-templates.ts +0 -47
- package/examples/sdk/09-api-keys-and-oauth.ts +0 -48
- package/examples/sdk/10-settings.ts +0 -38
- package/examples/sdk/11-sessions.ts +0 -48
- package/examples/sdk/12-full-control.ts +0 -82
- package/examples/sdk/13-codex-oauth.ts +0 -37
- package/examples/sdk/README.md +0 -144
package/docs/web-tools.md
DELETED
|
@@ -1,304 +0,0 @@
|
|
|
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/docs/windows.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Windows Setup
|
|
2
|
-
|
|
3
|
-
Indusagi requires a bash shell on Windows. Checked locations (in order):
|
|
4
|
-
|
|
5
|
-
1. Custom path from `~/.indusagi/agent/settings.json`
|
|
6
|
-
2. Git Bash (`C:\Program Files\Git\bin\bash.exe`)
|
|
7
|
-
3. `bash.exe` on PATH (Cygwin, MSYS2, WSL)
|
|
8
|
-
|
|
9
|
-
For most users, [Git for Windows](https://git-scm.com/download/win) is sufficient.
|
|
10
|
-
|
|
11
|
-
## Custom Shell Path
|
|
12
|
-
|
|
13
|
-
```json
|
|
14
|
-
{
|
|
15
|
-
"shellPath": "C:\\cygwin64\\bin\\bash.exe"
|
|
16
|
-
}
|
|
17
|
-
```
|
package/examples/README.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Examples
|
|
2
|
-
|
|
3
|
-
Example code for indusagi-coding-agent SDK and extensions.
|
|
4
|
-
|
|
5
|
-
## Directories
|
|
6
|
-
|
|
7
|
-
### [sdk/](sdk/)
|
|
8
|
-
Programmatic usage via `createAgentSession()`. Shows how to customize models, prompts, tools, extensions, and session management.
|
|
9
|
-
|
|
10
|
-
### [extensions/](extensions/)
|
|
11
|
-
Example extensions demonstrating:
|
|
12
|
-
- Lifecycle event handlers (tool interception, safety gates, context modifications)
|
|
13
|
-
- Custom tools (todo lists, questions, subagents, output truncation)
|
|
14
|
-
- Commands and keyboard shortcuts
|
|
15
|
-
- Custom UI (footers, headers, editors, overlays)
|
|
16
|
-
- Git integration (checkpoints, auto-commit)
|
|
17
|
-
- System prompt modifications and custom compaction
|
|
18
|
-
- External integrations (SSH, file watchers, system theme sync)
|
|
19
|
-
- Custom providers (Anthropic with custom streaming, GitLab Duo)
|
|
20
|
-
|
|
21
|
-
## Documentation
|
|
22
|
-
|
|
23
|
-
- [SDK Reference](sdk/README.md)
|
|
24
|
-
- [Extensions Documentation](../docs/extensions.md)
|
|
25
|
-
- [Skills Documentation](../docs/skills.md)
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
# Extension Examples
|
|
2
|
-
|
|
3
|
-
Example extensions for indusagi-coding-agent.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Load an extension with --extension flag
|
|
9
|
-
indusagi --extension examples/extensions/permission-gate.ts
|
|
10
|
-
|
|
11
|
-
# Or copy to extensions directory for auto-discovery
|
|
12
|
-
cp permission-gate.ts ~/.indusagi/agent/extensions/
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Examples
|
|
16
|
-
|
|
17
|
-
### Lifecycle & Safety
|
|
18
|
-
|
|
19
|
-
| Extension | Description |
|
|
20
|
-
|-----------|-------------|
|
|
21
|
-
| `permission-gate.ts` | Prompts for confirmation before dangerous bash commands (rm -rf, sudo, etc.) |
|
|
22
|
-
| `protected-paths.ts` | Blocks writes to protected paths (.env, .git/, node_modules/) |
|
|
23
|
-
| `confirm-destructive.ts` | Confirms before destructive session actions (clear, switch, fork) |
|
|
24
|
-
| `dirty-repo-guard.ts` | Prevents session changes with uncommitted git changes |
|
|
25
|
-
| `sandbox/` | OS-level sandboxing using `@anthropic-ai/sandbox-runtime` with per-project config |
|
|
26
|
-
|
|
27
|
-
### Custom Tools
|
|
28
|
-
|
|
29
|
-
| Extension | Description |
|
|
30
|
-
|-----------|-------------|
|
|
31
|
-
| `todo.ts` | Todo list tool + `/todos` command with custom rendering and state persistence |
|
|
32
|
-
| `hello.ts` | Minimal custom tool example |
|
|
33
|
-
| `question.ts` | Demonstrates `ctx.ui.select()` for asking the user questions with custom UI |
|
|
34
|
-
| `questionnaire.ts` | Multi-question input with tab bar navigation between questions |
|
|
35
|
-
| `tool-override.ts` | Override built-in tools (e.g., add logging/access control to `read`) |
|
|
36
|
-
| `truncated-tool.ts` | Wraps ripgrep with proper output truncation (50KB/2000 lines) |
|
|
37
|
-
| `antigravity-image-gen.ts` | Generate images via Google Antigravity with optional save-to-disk modes |
|
|
38
|
-
| `ssh.ts` | Delegate all tools to a remote machine via SSH using pluggable operations |
|
|
39
|
-
| `subagent/` | Delegate tasks to specialized subagents with isolated context windows |
|
|
40
|
-
|
|
41
|
-
### Commands & UI
|
|
42
|
-
|
|
43
|
-
| Extension | Description |
|
|
44
|
-
|-----------|-------------|
|
|
45
|
-
| `preset.ts` | Named presets for model, thinking level, tools, and instructions via `--preset` flag and `/preset` command |
|
|
46
|
-
| `plan-mode/` | Claude Code-style plan mode for read-only exploration with `/plan` command and step tracking |
|
|
47
|
-
| `tools.ts` | Interactive `/tools` command to enable/disable tools with session persistence |
|
|
48
|
-
| `handoff.ts` | Transfer context to a new focused session via `/handoff <goal>` |
|
|
49
|
-
| `qna.ts` | Extracts questions from last response into editor via `ctx.ui.setEditorText()` |
|
|
50
|
-
| `status-line.ts` | Shows turn progress in footer via `ctx.ui.setStatus()` with themed colors |
|
|
51
|
-
| `widget-placement.ts` | Shows widgets above and below the editor via `ctx.ui.setWidget()` placement |
|
|
52
|
-
| `model-status.ts` | Shows model changes in status bar via `model_select` hook |
|
|
53
|
-
| `snake.ts` | Snake game with custom UI, keyboard handling, and session persistence |
|
|
54
|
-
| `send-user-message.ts` | Demonstrates `indusagi.sendUserMessage()` for sending user messages from extensions |
|
|
55
|
-
| `timed-confirm.ts` | Demonstrates AbortSignal for auto-dismissing `ctx.ui.confirm()` and `ctx.ui.select()` dialogs |
|
|
56
|
-
| `modal-editor.ts` | Custom vim-like modal editor via `ctx.ui.setEditorComponent()` |
|
|
57
|
-
| `rainbow-editor.ts` | Animated rainbow text effect via custom editor |
|
|
58
|
-
| `notify.ts` | Desktop notifications via OSC 777 when agent finishes (Ghostty, iTerm2, WezTerm) |
|
|
59
|
-
| `summarize.ts` | Summarize conversation with GPT-5.2 and show in transient UI |
|
|
60
|
-
| `custom-footer.ts` | Custom footer with git branch and token stats via `ctx.ui.setFooter()` |
|
|
61
|
-
| `custom-header.ts` | Custom header via `ctx.ui.setHeader()` |
|
|
62
|
-
| `overlay-test.ts` | Test overlay compositing with inline text inputs and edge cases |
|
|
63
|
-
| `overlay-qa-tests.ts` | Comprehensive overlay QA tests: anchors, margins, stacking, overflow, animation |
|
|
64
|
-
| `doom-overlay/` | DOOM game running as an overlay at 35 FPS (demonstrates real-time game rendering) |
|
|
65
|
-
| `shutdown-command.ts` | Adds `/quit` command demonstrating `ctx.shutdown()` |
|
|
66
|
-
| `interactive-shell.ts` | Run interactive commands (vim, htop) with full terminal via `user_bash` hook |
|
|
67
|
-
| `inline-bash.ts` | Expands `!{command}` patterns in prompts via `input` event transformation |
|
|
68
|
-
|
|
69
|
-
### Git Integration
|
|
70
|
-
|
|
71
|
-
| Extension | Description |
|
|
72
|
-
|-----------|-------------|
|
|
73
|
-
| `git-checkpoint.ts` | Creates git stash checkpoints at each turn for code restoration on fork |
|
|
74
|
-
| `auto-commit-on-exit.ts` | Auto-commits on exit using last assistant message for commit message |
|
|
75
|
-
|
|
76
|
-
### System Prompt & Compaction
|
|
77
|
-
|
|
78
|
-
| Extension | Description |
|
|
79
|
-
|-----------|-------------|
|
|
80
|
-
| `pirate.ts` | Demonstrates `systemPromptAppend` to dynamically modify system prompt |
|
|
81
|
-
| `claude-rules.ts` | Scans `.claude/rules/` folder and lists rules in system prompt |
|
|
82
|
-
| `custom-compaction.ts` | Custom compaction that summarizes entire conversation |
|
|
83
|
-
| `trigger-compact.ts` | Triggers compaction when context usage exceeds 100k tokens and adds `/trigger-compact` command |
|
|
84
|
-
|
|
85
|
-
### System Integration
|
|
86
|
-
|
|
87
|
-
| Extension | Description |
|
|
88
|
-
|-----------|-------------|
|
|
89
|
-
| `mac-system-theme.ts` | Syncs indusagi theme with macOS dark/light mode |
|
|
90
|
-
|
|
91
|
-
### Messages & Communication
|
|
92
|
-
|
|
93
|
-
| Extension | Description |
|
|
94
|
-
|-----------|-------------|
|
|
95
|
-
| `message-renderer.ts` | Custom message rendering with colors and expandable details via `registerMessageRenderer` |
|
|
96
|
-
| `event-bus.ts` | Inter-extension communication via `indusagi.events` |
|
|
97
|
-
|
|
98
|
-
### Session Metadata
|
|
99
|
-
|
|
100
|
-
| Extension | Description |
|
|
101
|
-
|-----------|-------------|
|
|
102
|
-
| `session-name.ts` | Name sessions for the session selector via `setSessionName` |
|
|
103
|
-
| `bookmark.ts` | Bookmark entries with labels for `/tree` navigation via `setLabel` |
|
|
104
|
-
|
|
105
|
-
### Custom Providers
|
|
106
|
-
|
|
107
|
-
| Extension | Description |
|
|
108
|
-
|-----------|-------------|
|
|
109
|
-
| `custom-provider-anthropic/` | Custom Anthropic provider with OAuth support and custom streaming implementation |
|
|
110
|
-
| `custom-provider-gitlab-duo/` | GitLab Duo provider using indusagi-ai's built-in Anthropic/OpenAI streaming via proxy |
|
|
111
|
-
|
|
112
|
-
### External Dependencies
|
|
113
|
-
|
|
114
|
-
| Extension | Description |
|
|
115
|
-
|-----------|-------------|
|
|
116
|
-
| `with-deps/` | Extension with its own package.json and dependencies (demonstrates jiti module resolution) |
|
|
117
|
-
| `file-trigger.ts` | Watches a trigger file and injects contents into conversation |
|
|
118
|
-
|
|
119
|
-
## Writing Extensions
|
|
120
|
-
|
|
121
|
-
See [docs/extensions.md](../../docs/extensions.md) for full documentation.
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
import type { ExtensionAPI } from "indusagi-coding-agent";
|
|
125
|
-
import { Type } from "@sinclair/typebox";
|
|
126
|
-
|
|
127
|
-
export default function (indusagi: ExtensionAPI) {
|
|
128
|
-
// Subscribe to lifecycle events
|
|
129
|
-
indusagi.on("tool_call", async (event, ctx) => {
|
|
130
|
-
if (event.toolName === "bash" && event.input.command?.includes("rm -rf")) {
|
|
131
|
-
const ok = await ctx.ui.confirm("Dangerous!", "Allow rm -rf?");
|
|
132
|
-
if (!ok) return { block: true, reason: "Blocked by user" };
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// Register custom tools
|
|
137
|
-
indusagi.registerTool({
|
|
138
|
-
name: "greet",
|
|
139
|
-
label: "Greeting",
|
|
140
|
-
description: "Generate a greeting",
|
|
141
|
-
parameters: Type.Object({
|
|
142
|
-
name: Type.String({ description: "Name to greet" }),
|
|
143
|
-
}),
|
|
144
|
-
async execute(toolCallId, params, onUpdate, ctx, signal) {
|
|
145
|
-
return {
|
|
146
|
-
content: [{ type: "text", text: `Hello, ${params.name}!` }],
|
|
147
|
-
details: {},
|
|
148
|
-
};
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// Register commands
|
|
153
|
-
indusagi.registerCommand("hello", {
|
|
154
|
-
description: "Say hello",
|
|
155
|
-
handler: async (args, ctx) => {
|
|
156
|
-
ctx.ui.notify("Hello!", "info");
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## Key Patterns
|
|
163
|
-
|
|
164
|
-
**Use StringEnum for string parameters** (required for Google API compatibility):
|
|
165
|
-
```typescript
|
|
166
|
-
import { StringEnum } from "indusagi-ai";
|
|
167
|
-
|
|
168
|
-
// Good
|
|
169
|
-
action: StringEnum(["list", "add"] as const)
|
|
170
|
-
|
|
171
|
-
// Bad - doesn't work with Google
|
|
172
|
-
action: Type.Union([Type.Literal("list"), Type.Literal("add")])
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
**State persistence via details:**
|
|
176
|
-
```typescript
|
|
177
|
-
// Store state in tool result details for proper forking support
|
|
178
|
-
return {
|
|
179
|
-
content: [{ type: "text", text: "Done" }],
|
|
180
|
-
details: { todos: [...todos], nextId }, // Persisted in session
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// Reconstruct on session events
|
|
184
|
-
indusagi.on("session_start", async (_event, ctx) => {
|
|
185
|
-
for (const entry of ctx.sessionManager.getBranch()) {
|
|
186
|
-
if (entry.type === "message" && entry.message.toolName === "my_tool") {
|
|
187
|
-
const details = entry.message.details;
|
|
188
|
-
// Reconstruct state from details
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
```
|