@link-assistant/agent 0.0.9 → 0.0.12
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/EXAMPLES.md +36 -0
- package/MODELS.md +72 -24
- package/README.md +59 -2
- package/TOOLS.md +20 -0
- package/package.json +35 -2
- package/src/agent/agent.ts +68 -54
- package/src/auth/claude-oauth.ts +426 -0
- package/src/auth/index.ts +28 -26
- package/src/auth/plugins.ts +876 -0
- package/src/bun/index.ts +53 -43
- package/src/bus/global.ts +5 -5
- package/src/bus/index.ts +59 -53
- package/src/cli/bootstrap.js +12 -12
- package/src/cli/bootstrap.ts +6 -6
- package/src/cli/cmd/agent.ts +97 -92
- package/src/cli/cmd/auth.ts +469 -0
- package/src/cli/cmd/cmd.ts +2 -2
- package/src/cli/cmd/export.ts +41 -41
- package/src/cli/cmd/mcp.ts +144 -119
- package/src/cli/cmd/models.ts +30 -29
- package/src/cli/cmd/run.ts +269 -213
- package/src/cli/cmd/stats.ts +185 -146
- package/src/cli/error.ts +17 -13
- package/src/cli/ui.ts +39 -24
- package/src/command/index.ts +26 -26
- package/src/config/config.ts +528 -288
- package/src/config/markdown.ts +15 -15
- package/src/file/ripgrep.ts +201 -169
- package/src/file/time.ts +21 -18
- package/src/file/watcher.ts +51 -42
- package/src/file.ts +1 -1
- package/src/flag/flag.ts +26 -11
- package/src/format/formatter.ts +206 -162
- package/src/format/index.ts +61 -61
- package/src/global/index.ts +21 -21
- package/src/id/id.ts +47 -33
- package/src/index.js +346 -199
- package/src/json-standard/index.ts +67 -51
- package/src/mcp/index.ts +135 -128
- package/src/patch/index.ts +336 -267
- package/src/project/bootstrap.ts +15 -15
- package/src/project/instance.ts +43 -36
- package/src/project/project.ts +47 -47
- package/src/project/state.ts +37 -33
- package/src/provider/models-macro.ts +5 -5
- package/src/provider/models.ts +32 -32
- package/src/provider/opencode.js +19 -19
- package/src/provider/provider.ts +518 -277
- package/src/provider/transform.ts +143 -102
- package/src/server/project.ts +21 -21
- package/src/server/server.ts +111 -105
- package/src/session/agent.js +66 -60
- package/src/session/compaction.ts +136 -111
- package/src/session/index.ts +189 -156
- package/src/session/message-v2.ts +312 -268
- package/src/session/message.ts +73 -57
- package/src/session/processor.ts +180 -166
- package/src/session/prompt.ts +678 -533
- package/src/session/retry.ts +26 -23
- package/src/session/revert.ts +76 -62
- package/src/session/status.ts +26 -26
- package/src/session/summary.ts +97 -76
- package/src/session/system.ts +77 -63
- package/src/session/todo.ts +22 -16
- package/src/snapshot/index.ts +92 -76
- package/src/storage/storage.ts +157 -120
- package/src/tool/bash.ts +116 -106
- package/src/tool/batch.ts +73 -59
- package/src/tool/codesearch.ts +60 -53
- package/src/tool/edit.ts +319 -263
- package/src/tool/glob.ts +32 -28
- package/src/tool/grep.ts +72 -53
- package/src/tool/invalid.ts +7 -7
- package/src/tool/ls.ts +77 -64
- package/src/tool/multiedit.ts +30 -21
- package/src/tool/patch.ts +121 -94
- package/src/tool/read.ts +140 -122
- package/src/tool/registry.ts +38 -38
- package/src/tool/task.ts +93 -60
- package/src/tool/todo.ts +16 -16
- package/src/tool/tool.ts +45 -36
- package/src/tool/webfetch.ts +97 -74
- package/src/tool/websearch.ts +78 -64
- package/src/tool/write.ts +21 -15
- package/src/util/binary.ts +27 -19
- package/src/util/context.ts +8 -8
- package/src/util/defer.ts +7 -5
- package/src/util/error.ts +24 -19
- package/src/util/eventloop.ts +16 -10
- package/src/util/filesystem.ts +37 -33
- package/src/util/fn.ts +11 -8
- package/src/util/iife.ts +1 -1
- package/src/util/keybind.ts +44 -44
- package/src/util/lazy.ts +7 -7
- package/src/util/locale.ts +20 -16
- package/src/util/lock.ts +43 -38
- package/src/util/log.ts +95 -85
- package/src/util/queue.ts +8 -8
- package/src/util/rpc.ts +35 -23
- package/src/util/scrap.ts +4 -4
- package/src/util/signal.ts +5 -5
- package/src/util/timeout.ts +6 -6
- package/src/util/token.ts +2 -2
- package/src/util/wildcard.ts +38 -27
package/EXAMPLES.md
CHANGED
|
@@ -17,6 +17,7 @@ This document provides practical examples for using each tool with both `@link-a
|
|
|
17
17
|
### Simplest Examples - Start Here!
|
|
18
18
|
|
|
19
19
|
**Plain text (@link-assistant/agent only, easiest!):**
|
|
20
|
+
|
|
20
21
|
```bash
|
|
21
22
|
echo "hi" | agent
|
|
22
23
|
```
|
|
@@ -24,11 +25,13 @@ echo "hi" | agent
|
|
|
24
25
|
**Simple JSON message (both @link-assistant/agent and opencode):**
|
|
25
26
|
|
|
26
27
|
@link-assistant/agent:
|
|
28
|
+
|
|
27
29
|
```bash
|
|
28
30
|
echo '{"message":"hi"}' | agent
|
|
29
31
|
```
|
|
30
32
|
|
|
31
33
|
opencode:
|
|
34
|
+
|
|
32
35
|
```bash
|
|
33
36
|
echo '{"message":"hi"}' | opencode run --format json --model opencode/grok-code
|
|
34
37
|
```
|
|
@@ -49,11 +52,13 @@ echo "search the web for latest React news" | agent
|
|
|
49
52
|
### JSON Input Examples
|
|
50
53
|
|
|
51
54
|
**@link-assistant/agent:**
|
|
55
|
+
|
|
52
56
|
```bash
|
|
53
57
|
echo '{"message":"hello world"}' | agent
|
|
54
58
|
```
|
|
55
59
|
|
|
56
60
|
**opencode:**
|
|
61
|
+
|
|
57
62
|
```bash
|
|
58
63
|
echo '{"message":"hello world"}' | opencode run --format json --model opencode/grok-code
|
|
59
64
|
```
|
|
@@ -65,16 +70,19 @@ echo '{"message":"hello world"}' | opencode run --format json --model opencode/g
|
|
|
65
70
|
Execute shell commands.
|
|
66
71
|
|
|
67
72
|
**@link-assistant/agent:**
|
|
73
|
+
|
|
68
74
|
```bash
|
|
69
75
|
echo '{"message":"run command","tools":[{"name":"bash","params":{"command":"echo hello world"}}]}' | agent
|
|
70
76
|
```
|
|
71
77
|
|
|
72
78
|
**opencode:**
|
|
79
|
+
|
|
73
80
|
```bash
|
|
74
81
|
echo '{"message":"run command","tools":[{"name":"bash","params":{"command":"echo hello world"}}]}' | opencode run --format json --model opencode/grok-code
|
|
75
82
|
```
|
|
76
83
|
|
|
77
84
|
**Example with description:**
|
|
85
|
+
|
|
78
86
|
```bash
|
|
79
87
|
echo '{"message":"list files","tools":[{"name":"bash","params":{"command":"ls -la","description":"List all files in current directory"}}]}' | agent
|
|
80
88
|
```
|
|
@@ -84,11 +92,13 @@ echo '{"message":"list files","tools":[{"name":"bash","params":{"command":"ls -l
|
|
|
84
92
|
Read file contents.
|
|
85
93
|
|
|
86
94
|
**@link-assistant/agent:**
|
|
95
|
+
|
|
87
96
|
```bash
|
|
88
97
|
echo '{"message":"read file","tools":[{"name":"read","params":{"file_path":"/path/to/file.txt"}}]}' | agent
|
|
89
98
|
```
|
|
90
99
|
|
|
91
100
|
**opencode:**
|
|
101
|
+
|
|
92
102
|
```bash
|
|
93
103
|
echo '{"message":"read file","tools":[{"name":"read","params":{"file_path":"/path/to/file.txt"}}]}' | opencode run --format json --model opencode/grok-code
|
|
94
104
|
```
|
|
@@ -98,11 +108,13 @@ echo '{"message":"read file","tools":[{"name":"read","params":{"file_path":"/pat
|
|
|
98
108
|
Write content to a file.
|
|
99
109
|
|
|
100
110
|
**@link-assistant/agent:**
|
|
111
|
+
|
|
101
112
|
```bash
|
|
102
113
|
echo '{"message":"write file","tools":[{"name":"write","params":{"file_path":"/tmp/test.txt","content":"Hello World"}}]}' | agent
|
|
103
114
|
```
|
|
104
115
|
|
|
105
116
|
**opencode:**
|
|
117
|
+
|
|
106
118
|
```bash
|
|
107
119
|
echo '{"message":"write file","tools":[{"name":"write","params":{"file_path":"/tmp/test.txt","content":"Hello World"}}]}' | opencode run --format json --model opencode/grok-code
|
|
108
120
|
```
|
|
@@ -112,11 +124,13 @@ echo '{"message":"write file","tools":[{"name":"write","params":{"file_path":"/t
|
|
|
112
124
|
Edit file with string replacement.
|
|
113
125
|
|
|
114
126
|
**@link-assistant/agent:**
|
|
127
|
+
|
|
115
128
|
```bash
|
|
116
129
|
echo '{"message":"edit file","tools":[{"name":"edit","params":{"file_path":"/tmp/test.txt","old_string":"Hello","new_string":"Hi"}}]}' | agent
|
|
117
130
|
```
|
|
118
131
|
|
|
119
132
|
**opencode:**
|
|
133
|
+
|
|
120
134
|
```bash
|
|
121
135
|
echo '{"message":"edit file","tools":[{"name":"edit","params":{"file_path":"/tmp/test.txt","old_string":"Hello","new_string":"Hi"}}]}' | opencode run --format json --model opencode/grok-code
|
|
122
136
|
```
|
|
@@ -126,11 +140,13 @@ echo '{"message":"edit file","tools":[{"name":"edit","params":{"file_path":"/tmp
|
|
|
126
140
|
List directory contents.
|
|
127
141
|
|
|
128
142
|
**@link-assistant/agent:**
|
|
143
|
+
|
|
129
144
|
```bash
|
|
130
145
|
echo '{"message":"list directory","tools":[{"name":"list","params":{"path":"."}}]}' | agent
|
|
131
146
|
```
|
|
132
147
|
|
|
133
148
|
**opencode:**
|
|
149
|
+
|
|
134
150
|
```bash
|
|
135
151
|
echo '{"message":"list directory","tools":[{"name":"list","params":{"path":"."}}]}' | opencode run --format json --model opencode/grok-code
|
|
136
152
|
```
|
|
@@ -142,6 +158,7 @@ echo '{"message":"list directory","tools":[{"name":"list","params":{"path":"."}}
|
|
|
142
158
|
Find files using glob patterns.
|
|
143
159
|
|
|
144
160
|
**@link-assistant/agent:**
|
|
161
|
+
|
|
145
162
|
```bash
|
|
146
163
|
# Find all JavaScript files
|
|
147
164
|
echo '{"message":"find js files","tools":[{"name":"glob","params":{"pattern":"**/*.js"}}]}' | agent
|
|
@@ -151,6 +168,7 @@ echo '{"message":"find ts files","tools":[{"name":"glob","params":{"pattern":"sr
|
|
|
151
168
|
```
|
|
152
169
|
|
|
153
170
|
**opencode:**
|
|
171
|
+
|
|
154
172
|
```bash
|
|
155
173
|
echo '{"message":"find js files","tools":[{"name":"glob","params":{"pattern":"**/*.js"}}]}' | opencode run --format json --model opencode/grok-code
|
|
156
174
|
```
|
|
@@ -160,6 +178,7 @@ echo '{"message":"find js files","tools":[{"name":"glob","params":{"pattern":"**
|
|
|
160
178
|
Search text in files with regex.
|
|
161
179
|
|
|
162
180
|
**@link-assistant/agent:**
|
|
181
|
+
|
|
163
182
|
```bash
|
|
164
183
|
# Search for pattern in files
|
|
165
184
|
echo '{"message":"search pattern","tools":[{"name":"grep","params":{"pattern":"function","output_mode":"files_with_matches"}}]}' | agent
|
|
@@ -172,6 +191,7 @@ echo '{"message":"search error","tools":[{"name":"grep","params":{"pattern":"err
|
|
|
172
191
|
```
|
|
173
192
|
|
|
174
193
|
**opencode:**
|
|
194
|
+
|
|
175
195
|
```bash
|
|
176
196
|
echo '{"message":"search pattern","tools":[{"name":"grep","params":{"pattern":"TODO","output_mode":"content"}}]}' | opencode run --format json --model opencode/grok-code
|
|
177
197
|
```
|
|
@@ -181,6 +201,7 @@ echo '{"message":"search pattern","tools":[{"name":"grep","params":{"pattern":"T
|
|
|
181
201
|
Search the web using Exa API.
|
|
182
202
|
|
|
183
203
|
**@link-assistant/agent (no environment variable needed!):**
|
|
204
|
+
|
|
184
205
|
```bash
|
|
185
206
|
echo '{"message":"search web","tools":[{"name":"websearch","params":{"query":"TypeScript latest features"}}]}' | agent
|
|
186
207
|
|
|
@@ -188,6 +209,7 @@ echo '{"message":"search web","tools":[{"name":"websearch","params":{"query":"Re
|
|
|
188
209
|
```
|
|
189
210
|
|
|
190
211
|
**opencode (requires OPENCODE_EXPERIMENTAL_EXA=true):**
|
|
212
|
+
|
|
191
213
|
```bash
|
|
192
214
|
echo '{"message":"search web","tools":[{"name":"websearch","params":{"query":"TypeScript latest features"}}]}' | OPENCODE_EXPERIMENTAL_EXA=true opencode run --format json --model opencode/grok-code
|
|
193
215
|
```
|
|
@@ -197,6 +219,7 @@ echo '{"message":"search web","tools":[{"name":"websearch","params":{"query":"Ty
|
|
|
197
219
|
Search code repositories and documentation.
|
|
198
220
|
|
|
199
221
|
**@link-assistant/agent (no environment variable needed!):**
|
|
222
|
+
|
|
200
223
|
```bash
|
|
201
224
|
echo '{"message":"search code","tools":[{"name":"codesearch","params":{"query":"React hooks implementation"}}]}' | agent
|
|
202
225
|
|
|
@@ -204,6 +227,7 @@ echo '{"message":"search code","tools":[{"name":"codesearch","params":{"query":"
|
|
|
204
227
|
```
|
|
205
228
|
|
|
206
229
|
**opencode (requires OPENCODE_EXPERIMENTAL_EXA=true):**
|
|
230
|
+
|
|
207
231
|
```bash
|
|
208
232
|
echo '{"message":"search code","tools":[{"name":"codesearch","params":{"query":"React hooks implementation"}}]}' | OPENCODE_EXPERIMENTAL_EXA=true opencode run --format json --model opencode/grok-code
|
|
209
233
|
```
|
|
@@ -215,11 +239,13 @@ echo '{"message":"search code","tools":[{"name":"codesearch","params":{"query":"
|
|
|
215
239
|
Batch multiple tool calls together for optimal performance.
|
|
216
240
|
|
|
217
241
|
**@link-assistant/agent (no configuration needed!):**
|
|
242
|
+
|
|
218
243
|
```bash
|
|
219
244
|
echo '{"message":"run batch","tools":[{"name":"batch","params":{"tool_calls":[{"tool":"bash","parameters":{"command":"echo hello"}},{"tool":"bash","parameters":{"command":"echo world"}}]}}]}' | agent
|
|
220
245
|
```
|
|
221
246
|
|
|
222
247
|
**opencode (requires experimental config):**
|
|
248
|
+
|
|
223
249
|
```bash
|
|
224
250
|
# Create config file first
|
|
225
251
|
mkdir -p .opencode
|
|
@@ -234,11 +260,13 @@ echo '{"message":"run batch","tools":[{"name":"batch","params":{"tool_calls":[{"
|
|
|
234
260
|
Launch specialized agents for complex tasks.
|
|
235
261
|
|
|
236
262
|
**@link-assistant/agent:**
|
|
263
|
+
|
|
237
264
|
```bash
|
|
238
265
|
echo '{"message":"launch task","tools":[{"name":"task","params":{"description":"Analyze codebase","prompt":"Find all TODO comments in JavaScript files","subagent_type":"general-purpose"}}]}' | agent
|
|
239
266
|
```
|
|
240
267
|
|
|
241
268
|
**opencode:**
|
|
269
|
+
|
|
242
270
|
```bash
|
|
243
271
|
echo '{"message":"launch task","tools":[{"name":"task","params":{"description":"Analyze codebase","prompt":"Find all TODO comments in JavaScript files","subagent_type":"general-purpose"}}]}' | opencode run --format json --model opencode/grok-code
|
|
244
272
|
```
|
|
@@ -250,6 +278,7 @@ echo '{"message":"launch task","tools":[{"name":"task","params":{"description":"
|
|
|
250
278
|
Read and write TODO items for task tracking.
|
|
251
279
|
|
|
252
280
|
**@link-assistant/agent:**
|
|
281
|
+
|
|
253
282
|
```bash
|
|
254
283
|
# Write todos
|
|
255
284
|
echo '{"message":"add todos","tools":[{"name":"todowrite","params":{"todos":[{"content":"Implement feature X","status":"pending","activeForm":"Implementing feature X"},{"content":"Write tests","status":"pending","activeForm":"Writing tests"}]}}]}' | agent
|
|
@@ -259,6 +288,7 @@ echo '{"message":"read todos","tools":[{"name":"todoread","params":{}}]}' | agen
|
|
|
259
288
|
```
|
|
260
289
|
|
|
261
290
|
**opencode:**
|
|
291
|
+
|
|
262
292
|
```bash
|
|
263
293
|
echo '{"message":"add todos","tools":[{"name":"todowrite","params":{"todos":[{"content":"Implement feature X","status":"pending","activeForm":"Implementing feature X"}]}}]}' | opencode run --format json --model opencode/grok-code
|
|
264
294
|
```
|
|
@@ -268,11 +298,13 @@ echo '{"message":"add todos","tools":[{"name":"todowrite","params":{"todos":[{"c
|
|
|
268
298
|
Fetch and process web content.
|
|
269
299
|
|
|
270
300
|
**@link-assistant/agent:**
|
|
301
|
+
|
|
271
302
|
```bash
|
|
272
303
|
echo '{"message":"fetch url","tools":[{"name":"webfetch","params":{"url":"https://example.com","prompt":"Summarize the content"}}]}' | agent
|
|
273
304
|
```
|
|
274
305
|
|
|
275
306
|
**opencode:**
|
|
307
|
+
|
|
276
308
|
```bash
|
|
277
309
|
echo '{"message":"fetch url","tools":[{"name":"webfetch","params":{"url":"https://example.com","prompt":"Summarize the content"}}]}' | opencode run --format json --model opencode/grok-code
|
|
278
310
|
```
|
|
@@ -309,6 +341,7 @@ echo "hi" | agent
|
|
|
309
341
|
```
|
|
310
342
|
|
|
311
343
|
Output (pretty-printed JSON events):
|
|
344
|
+
|
|
312
345
|
```json
|
|
313
346
|
{
|
|
314
347
|
"type": "step_start",
|
|
@@ -343,6 +376,7 @@ Output (pretty-printed JSON events):
|
|
|
343
376
|
```
|
|
344
377
|
|
|
345
378
|
This format is designed for:
|
|
379
|
+
|
|
346
380
|
- **Readability**: Pretty-printed JSON is easy to read and debug
|
|
347
381
|
- **Streaming**: Events output in real-time as they occur
|
|
348
382
|
- **Compatibility**: 100% compatible with OpenCode's event structure
|
|
@@ -357,6 +391,7 @@ echo "hi" | agent --json-standard claude
|
|
|
357
391
|
```
|
|
358
392
|
|
|
359
393
|
Output (compact NDJSON):
|
|
394
|
+
|
|
360
395
|
```json
|
|
361
396
|
{"type":"init","timestamp":"2025-01-01T00:00:00.000Z","session_id":"ses_560236487ffe3ROK1ThWvPwTEF"}
|
|
362
397
|
{"type":"message","timestamp":"2025-01-01T00:00:01.000Z","session_id":"ses_560236487ffe3ROK1ThWvPwTEF","role":"assistant","content":[{"type":"text","text":"Hi! How can I help with your coding tasks today?"}]}
|
|
@@ -364,6 +399,7 @@ Output (compact NDJSON):
|
|
|
364
399
|
```
|
|
365
400
|
|
|
366
401
|
Key differences from OpenCode format:
|
|
402
|
+
|
|
367
403
|
- **Compact**: One JSON per line (no pretty-printing)
|
|
368
404
|
- **Event Types**: `init`, `message`, `tool_use`, `tool_result`, `result`
|
|
369
405
|
- **Timestamps**: ISO 8601 strings instead of Unix milliseconds
|
package/MODELS.md
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
# Models
|
|
2
2
|
|
|
3
|
-
This agent uses models from the [OpenCode Zen](https://opencode.ai/docs/zen/) subscription service.
|
|
3
|
+
This agent supports multiple model providers. By default, it uses models from the [OpenCode Zen](https://opencode.ai/docs/zen/) subscription service. Additionally, you can use models directly from providers like [Groq](https://groq.com/) by setting the appropriate API key.
|
|
4
|
+
|
|
5
|
+
## Supported Providers
|
|
6
|
+
|
|
7
|
+
| Provider | Format | API Key Env Variable | Documentation |
|
|
8
|
+
| ------------ | ------------------------- | ---------------------------- | -------------------------------------------------- |
|
|
9
|
+
| OpenCode Zen | `opencode/<model-id>` | N/A (public for free models) | [OpenCode Zen](https://opencode.ai/docs/zen/) |
|
|
10
|
+
| Anthropic | `anthropic/<model-id>` | `ANTHROPIC_API_KEY` | [Anthropic Docs](https://docs.anthropic.com/) |
|
|
11
|
+
| Claude OAuth | `claude-oauth/<model-id>` | `CLAUDE_CODE_OAUTH_TOKEN` | [Claude OAuth Documentation](docs/claude-oauth.md) |
|
|
12
|
+
| Groq | `groq/<model-id>` | `GROQ_API_KEY` | [Groq Documentation](docs/groq.md) |
|
|
13
|
+
|
|
14
|
+
> **Claude OAuth:** The `claude-oauth` provider allows using your Claude Pro/Max subscription. Authenticate with `agent auth claude` or use existing Claude Code CLI credentials with `--use-existing-claude-oauth`.
|
|
4
15
|
|
|
5
16
|
## Available Models
|
|
6
17
|
|
|
7
|
-
All models are accessed using the format
|
|
18
|
+
All models are accessed using the format `<provider>/<model-id>`. Use the `--model` option to specify which model to use:
|
|
8
19
|
|
|
9
20
|
```bash
|
|
10
21
|
echo "hi" | agent --model opencode/grok-code
|
|
@@ -14,29 +25,29 @@ echo "hi" | agent --model opencode/grok-code
|
|
|
14
25
|
|
|
15
26
|
Below are the prices per 1M tokens for OpenCode Zen models. Models are sorted by output price (lowest first) for best pricing visibility.
|
|
16
27
|
|
|
17
|
-
| Model
|
|
18
|
-
|
|
19
|
-
| **Free Models (Output: $0.00)**
|
|
20
|
-
| Grok Code Fast 1
|
|
21
|
-
| GPT 5 Nano
|
|
22
|
-
| Big Pickle
|
|
28
|
+
| Model | Model ID | Input | Output | Cached Read | Cached Write |
|
|
29
|
+
| ---------------------------------------- | --------------------------- | ------ | ------ | ----------- | ------------ |
|
|
30
|
+
| **Free Models (Output: $0.00)** |
|
|
31
|
+
| Grok Code Fast 1 | `opencode/grok-code` | Free | Free | Free | - |
|
|
32
|
+
| GPT 5 Nano | `opencode/gpt-5-nano` | Free | Free | Free | - |
|
|
33
|
+
| Big Pickle | `opencode/big-pickle` | Free | Free | Free | - |
|
|
23
34
|
| **Paid Models (sorted by output price)** |
|
|
24
|
-
| Qwen3 Coder 480B
|
|
25
|
-
| GLM 4.6
|
|
26
|
-
| Kimi K2
|
|
27
|
-
| Claude Haiku 3.5
|
|
28
|
-
| Claude Haiku 4.5
|
|
29
|
-
| GPT 5.1
|
|
30
|
-
| GPT 5.1 Codex
|
|
31
|
-
| GPT 5
|
|
32
|
-
| GPT 5 Codex
|
|
33
|
-
| Gemini 3 Pro (≤ 200K tokens)
|
|
34
|
-
| Claude Sonnet 4.5 (≤ 200K tokens)
|
|
35
|
-
| Claude Sonnet 4 (≤ 200K tokens)
|
|
36
|
-
| Gemini 3 Pro (> 200K tokens)
|
|
37
|
-
| Claude Sonnet 4.5 (> 200K tokens)
|
|
38
|
-
| Claude Sonnet 4 (> 200K tokens)
|
|
39
|
-
| Claude Opus 4.1
|
|
35
|
+
| Qwen3 Coder 480B | `opencode/qwen3-coder-480b` | $0.45 | $1.50 | - | - |
|
|
36
|
+
| GLM 4.6 | `opencode/glm-4-6` | $0.60 | $2.20 | $0.10 | - |
|
|
37
|
+
| Kimi K2 | `opencode/kimi-k2` | $0.60 | $2.50 | $0.36 | - |
|
|
38
|
+
| Claude Haiku 3.5 | `opencode/claude-haiku-3-5` | $0.80 | $4.00 | $0.08 | $1.00 |
|
|
39
|
+
| Claude Haiku 4.5 | `opencode/haiku` | $1.00 | $5.00 | $0.10 | $1.25 |
|
|
40
|
+
| GPT 5.1 | `opencode/gpt-5-1` | $1.25 | $10.00 | $0.125 | - |
|
|
41
|
+
| GPT 5.1 Codex | `opencode/gpt-5-1-codex` | $1.25 | $10.00 | $0.125 | - |
|
|
42
|
+
| GPT 5 | `opencode/gpt-5` | $1.25 | $10.00 | $0.125 | - |
|
|
43
|
+
| GPT 5 Codex | `opencode/gpt-5-codex` | $1.25 | $10.00 | $0.125 | - |
|
|
44
|
+
| Gemini 3 Pro (≤ 200K tokens) | `opencode/gemini-3-pro` | $2.00 | $12.00 | $0.20 | - |
|
|
45
|
+
| Claude Sonnet 4.5 (≤ 200K tokens) | `opencode/sonnet` | $3.00 | $15.00 | $0.30 | $3.75 |
|
|
46
|
+
| Claude Sonnet 4 (≤ 200K tokens) | `opencode/claude-sonnet-4` | $3.00 | $15.00 | $0.30 | $3.75 |
|
|
47
|
+
| Gemini 3 Pro (> 200K tokens) | `opencode/gemini-3-pro` | $4.00 | $18.00 | $0.40 | - |
|
|
48
|
+
| Claude Sonnet 4.5 (> 200K tokens) | `opencode/sonnet` | $6.00 | $22.50 | $0.60 | $7.50 |
|
|
49
|
+
| Claude Sonnet 4 (> 200K tokens) | `opencode/claude-sonnet-4` | $6.00 | $22.50 | $0.60 | $7.50 |
|
|
50
|
+
| Claude Opus 4.1 | `opencode/opus` | $15.00 | $75.00 | $1.50 | $18.75 |
|
|
40
51
|
|
|
41
52
|
## Default Model
|
|
42
53
|
|
|
@@ -93,3 +104,40 @@ For complete details about OpenCode Zen subscription and pricing, visit the [Ope
|
|
|
93
104
|
- Cache pricing applies when using prompt caching features
|
|
94
105
|
- Token context limits vary by model
|
|
95
106
|
- Free models have no token costs but may have rate limits
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Groq Provider
|
|
111
|
+
|
|
112
|
+
[Groq](https://groq.com/) provides ultra-fast inference for open-source large language models. To use Groq models, set your API key:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
export GROQ_API_KEY=your_api_key_here
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Groq Models
|
|
119
|
+
|
|
120
|
+
| Model | Model ID | Context Window | Tool Use |
|
|
121
|
+
| ----------------------- | ------------------------------ | -------------- | -------- |
|
|
122
|
+
| Llama 3.3 70B Versatile | `groq/llama-3.3-70b-versatile` | 131,072 tokens | Yes |
|
|
123
|
+
| Llama 3.1 8B Instant | `groq/llama-3.1-8b-instant` | 131,072 tokens | Yes |
|
|
124
|
+
| GPT-OSS 120B | `groq/openai/gpt-oss-120b` | 131,072 tokens | Yes |
|
|
125
|
+
| GPT-OSS 20B | `groq/openai/gpt-oss-20b` | 131,072 tokens | Yes |
|
|
126
|
+
| Qwen3 32B | `groq/qwen/qwen3-32b` | 131,072 tokens | Yes |
|
|
127
|
+
| Compound | `groq/groq/compound` | 131,072 tokens | Yes |
|
|
128
|
+
| Compound Mini | `groq/groq/compound-mini` | 131,072 tokens | Yes |
|
|
129
|
+
|
|
130
|
+
### Groq Usage Examples
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Using Llama 3.3 70B (recommended)
|
|
134
|
+
echo "hello" | agent --model groq/llama-3.3-70b-versatile
|
|
135
|
+
|
|
136
|
+
# Using faster Llama 3.1 8B
|
|
137
|
+
echo "hello" | agent --model groq/llama-3.1-8b-instant
|
|
138
|
+
|
|
139
|
+
# Using Compound (agentic with server-side tools)
|
|
140
|
+
echo "hello" | agent --model groq/groq/compound
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
For more details, see the [Groq Documentation](docs/groq.md).
|
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
> 🚨 **SECURITY WARNING: 100% UNSAFE AND AUTONOMOUS** 🚨
|
|
9
9
|
>
|
|
10
10
|
> This agent operates with **ZERO RESTRICTIONS** and **FULL AUTONOMY**:
|
|
11
|
+
>
|
|
11
12
|
> - ❌ **No Sandbox** - Complete unrestricted file system access
|
|
12
13
|
> - ❌ **No Permissions System** - No approval required for any actions
|
|
13
14
|
> - ❌ **No Safety Guardrails** - Can execute ANY command with full privileges
|
|
@@ -21,7 +22,7 @@ This is an MVP implementation of an OpenCode-compatible CLI agent, focused on ma
|
|
|
21
22
|
|
|
22
23
|
- ✅ **JSON Input/Output**: Compatible with `opencode run --format json --model opencode/grok-code`
|
|
23
24
|
- ✅ **Plain Text Input**: Also accepts plain text messages (auto-converted to JSON format)
|
|
24
|
-
- ✅ **Flexible Model Selection**: Defaults to free OpenCode Zen Grok Code Fast 1, supports
|
|
25
|
+
- ✅ **Flexible Model Selection**: Defaults to free OpenCode Zen Grok Code Fast 1, supports [OpenCode Zen](https://opencode.ai/docs/zen/), [Claude OAuth](docs/claude-oauth.md), and [Groq](docs/groq.md) providers
|
|
25
26
|
- ✅ **No Restrictions**: Fully unrestricted file system and command execution access (no sandbox)
|
|
26
27
|
- ✅ **Minimal Footprint**: Built with Bun.sh for maximum efficiency
|
|
27
28
|
- ✅ **Full Tool Support**: 13 tools including websearch, codesearch, batch - all enabled by default
|
|
@@ -75,7 +76,7 @@ The agent streams events as they occur, providing the same real-time experience
|
|
|
75
76
|
- **Plain Text Input**: Also accepts plain text messages (auto-converted to JSON format)
|
|
76
77
|
- **Unrestricted Access**: Full file system and command execution access (no sandbox, no restrictions)
|
|
77
78
|
- **Tool Support**: 13 tools including websearch, codesearch, batch - all enabled by default
|
|
78
|
-
- **Flexible Model Selection**: Defaults to free Grok Code Fast 1, supports
|
|
79
|
+
- **Flexible Model Selection**: Defaults to free Grok Code Fast 1, supports [OpenCode Zen](https://opencode.ai/docs/zen/), [Claude OAuth](docs/claude-oauth.md), and [Groq](docs/groq.md) - see [MODELS.md](MODELS.md)
|
|
79
80
|
- **Bun.sh First**: Built with Bun for maximum efficiency and minimal resource usage
|
|
80
81
|
- **No TUI**: Pure JSON CLI interface for automation and integration
|
|
81
82
|
- **Public Domain**: Unlicense - use it however you want
|
|
@@ -83,6 +84,7 @@ The agent streams events as they occur, providing the same real-time experience
|
|
|
83
84
|
## Installation
|
|
84
85
|
|
|
85
86
|
**Requirements:**
|
|
87
|
+
|
|
86
88
|
- [Bun](https://bun.sh) >= 1.0.0 (Node.js and Deno are NOT supported)
|
|
87
89
|
|
|
88
90
|
```bash
|
|
@@ -103,16 +105,19 @@ After installation, the `agent` command will be available globally.
|
|
|
103
105
|
### Simplest Examples
|
|
104
106
|
|
|
105
107
|
**Plain text (easiest):**
|
|
108
|
+
|
|
106
109
|
```bash
|
|
107
110
|
echo "hi" | agent
|
|
108
111
|
```
|
|
109
112
|
|
|
110
113
|
**Simple JSON message:**
|
|
114
|
+
|
|
111
115
|
```bash
|
|
112
116
|
echo '{"message":"hi"}' | agent
|
|
113
117
|
```
|
|
114
118
|
|
|
115
119
|
**With custom model:**
|
|
120
|
+
|
|
116
121
|
```bash
|
|
117
122
|
echo "hi" | agent --model opencode/grok-code
|
|
118
123
|
```
|
|
@@ -120,17 +125,20 @@ echo "hi" | agent --model opencode/grok-code
|
|
|
120
125
|
### More Examples
|
|
121
126
|
|
|
122
127
|
**Plain Text Input:**
|
|
128
|
+
|
|
123
129
|
```bash
|
|
124
130
|
echo "hello world" | agent
|
|
125
131
|
echo "search the web for TypeScript news" | agent
|
|
126
132
|
```
|
|
127
133
|
|
|
128
134
|
**JSON Input with tool calls:**
|
|
135
|
+
|
|
129
136
|
```bash
|
|
130
137
|
echo '{"message":"run command","tools":[{"name":"bash","params":{"command":"ls -la"}}]}' | agent
|
|
131
138
|
```
|
|
132
139
|
|
|
133
140
|
**Using different models:**
|
|
141
|
+
|
|
134
142
|
```bash
|
|
135
143
|
# Default model (free Grok Code Fast 1)
|
|
136
144
|
echo "hi" | agent
|
|
@@ -144,9 +152,30 @@ echo "hi" | agent --model opencode/sonnet # Claude Sonnet 4.5
|
|
|
144
152
|
echo "hi" | agent --model opencode/haiku # Claude Haiku 4.5
|
|
145
153
|
echo "hi" | agent --model opencode/opus # Claude Opus 4.1
|
|
146
154
|
echo "hi" | agent --model opencode/gemini-3-pro # Gemini 3 Pro
|
|
155
|
+
|
|
156
|
+
# Groq models (requires GROQ_API_KEY)
|
|
157
|
+
echo "hi" | agent --model groq/llama-3.3-70b-versatile # Llama 3.3 70B
|
|
158
|
+
echo "hi" | agent --model groq/llama-3.1-8b-instant # Llama 3.1 8B (fast)
|
|
159
|
+
|
|
160
|
+
# Anthropic direct (requires ANTHROPIC_API_KEY)
|
|
161
|
+
echo "hi" | agent --model anthropic/claude-sonnet-4-5 # Claude Sonnet 4.5
|
|
162
|
+
echo "hi" | agent --model anthropic/claude-opus-4-1 # Claude Opus 4.1
|
|
163
|
+
|
|
164
|
+
# Anthropic OAuth (requires Claude Pro/Max subscription)
|
|
165
|
+
agent auth login # Select Anthropic > Claude Pro/Max
|
|
166
|
+
echo "hi" | agent --model anthropic/claude-sonnet-4-5 # Uses OAuth credentials
|
|
167
|
+
|
|
168
|
+
# Use existing Claude Code CLI credentials
|
|
169
|
+
echo "hi" | agent --use-existing-claude-oauth # Reads from ~/.claude/.credentials.json
|
|
170
|
+
|
|
171
|
+
# GitHub Copilot (requires Copilot subscription)
|
|
172
|
+
agent auth login # Select GitHub Copilot
|
|
173
|
+
echo "hi" | agent --model github-copilot/gpt-4o # Uses Copilot
|
|
147
174
|
```
|
|
148
175
|
|
|
149
176
|
See [MODELS.md](MODELS.md) for complete list of available models and pricing.
|
|
177
|
+
See [docs/groq.md](docs/groq.md) for Groq provider documentation.
|
|
178
|
+
See [docs/claude-oauth.md](docs/claude-oauth.md) for Claude OAuth provider documentation.
|
|
150
179
|
|
|
151
180
|
### CLI Options
|
|
152
181
|
|
|
@@ -158,12 +187,21 @@ Options:
|
|
|
158
187
|
Default: opencode/grok-code
|
|
159
188
|
--json-standard JSON output format standard
|
|
160
189
|
Choices: "opencode" (default), "claude" (experimental)
|
|
190
|
+
--use-existing-claude-oauth Use existing Claude OAuth credentials
|
|
191
|
+
from ~/.claude/.credentials.json
|
|
161
192
|
--system-message Full override of the system message
|
|
162
193
|
--system-message-file Full override of the system message from file
|
|
163
194
|
--append-system-message Append to the default system message
|
|
164
195
|
--append-system-message-file Append to the default system message from file
|
|
165
196
|
--help Show help
|
|
166
197
|
--version Show version number
|
|
198
|
+
|
|
199
|
+
Commands:
|
|
200
|
+
auth login Authenticate with a provider (Anthropic, GitHub Copilot, etc.)
|
|
201
|
+
auth logout Remove credentials for a provider
|
|
202
|
+
auth list List configured credentials
|
|
203
|
+
auth status Check authentication status (experimental)
|
|
204
|
+
mcp MCP server commands
|
|
167
205
|
```
|
|
168
206
|
|
|
169
207
|
### JSON Output Standards
|
|
@@ -199,11 +237,13 @@ echo "hi" | agent --json-standard claude
|
|
|
199
237
|
### Input Formats
|
|
200
238
|
|
|
201
239
|
**Plain Text (auto-converted):**
|
|
240
|
+
|
|
202
241
|
```bash
|
|
203
242
|
echo "your message here" | agent
|
|
204
243
|
```
|
|
205
244
|
|
|
206
245
|
**JSON Format:**
|
|
246
|
+
|
|
207
247
|
```json
|
|
208
248
|
{
|
|
209
249
|
"message": "Your message here",
|
|
@@ -221,23 +261,27 @@ echo "your message here" | agent
|
|
|
221
261
|
All 13 tools are **enabled by default** with **no configuration required**. See [TOOLS.md](TOOLS.md) for complete documentation.
|
|
222
262
|
|
|
223
263
|
### File Operations
|
|
264
|
+
|
|
224
265
|
- **`read`** - Read file contents
|
|
225
266
|
- **`write`** - Write files
|
|
226
267
|
- **`edit`** - Edit files with string replacement
|
|
227
268
|
- **`list`** - List directory contents
|
|
228
269
|
|
|
229
270
|
### Search Tools
|
|
271
|
+
|
|
230
272
|
- **`glob`** - File pattern matching (`**/*.js`)
|
|
231
273
|
- **`grep`** - Text search with regex support
|
|
232
274
|
- **`websearch`** ✨ - Web search via Exa API (no config needed!)
|
|
233
275
|
- **`codesearch`** ✨ - Code search via Exa API (no config needed!)
|
|
234
276
|
|
|
235
277
|
### Execution Tools
|
|
278
|
+
|
|
236
279
|
- **`bash`** - Execute shell commands
|
|
237
280
|
- **`batch`** ✨ - Batch multiple tool calls (no config needed!)
|
|
238
281
|
- **`task`** - Launch subagent tasks
|
|
239
282
|
|
|
240
283
|
### Utility Tools
|
|
284
|
+
|
|
241
285
|
- **`todo`** - Task tracking
|
|
242
286
|
- **`webfetch`** - Fetch and process URLs
|
|
243
287
|
|
|
@@ -267,11 +311,13 @@ For detailed testing information including how to run tests manually and trigger
|
|
|
267
311
|
### Development
|
|
268
312
|
|
|
269
313
|
Run the agent in development mode:
|
|
314
|
+
|
|
270
315
|
```bash
|
|
271
316
|
bun run dev
|
|
272
317
|
```
|
|
273
318
|
|
|
274
319
|
Or run directly:
|
|
320
|
+
|
|
275
321
|
```bash
|
|
276
322
|
bun run src/index.js
|
|
277
323
|
```
|
|
@@ -279,6 +325,7 @@ bun run src/index.js
|
|
|
279
325
|
### Testing
|
|
280
326
|
|
|
281
327
|
Simply run:
|
|
328
|
+
|
|
282
329
|
```bash
|
|
283
330
|
bun test
|
|
284
331
|
```
|
|
@@ -298,11 +345,13 @@ Bun automatically discovers and runs all `*.test.js` files in the project.
|
|
|
298
345
|
To publish a new version to npm:
|
|
299
346
|
|
|
300
347
|
1. **Update version** in `package.json`:
|
|
348
|
+
|
|
301
349
|
```bash
|
|
302
350
|
# Update version field manually (e.g., 0.0.3 -> 0.0.4)
|
|
303
351
|
```
|
|
304
352
|
|
|
305
353
|
2. **Commit changes**:
|
|
354
|
+
|
|
306
355
|
```bash
|
|
307
356
|
git add .
|
|
308
357
|
git commit -m "Release v0.0.4"
|
|
@@ -319,18 +368,22 @@ The package publishes source files directly (no build step required). Bun handle
|
|
|
319
368
|
## Key Features
|
|
320
369
|
|
|
321
370
|
### No Configuration Required
|
|
371
|
+
|
|
322
372
|
- **WebSearch/CodeSearch**: Work without `OPENCODE_EXPERIMENTAL_EXA` environment variable
|
|
323
373
|
- **Batch Tool**: Always enabled, no experimental flag needed
|
|
324
374
|
- **All Tools**: No config files, API keys handled automatically
|
|
325
375
|
|
|
326
376
|
### OpenCode 100% Compatible
|
|
377
|
+
|
|
327
378
|
- All tools produce JSON output matching OpenCode's exact format
|
|
328
379
|
- WebSearch and CodeSearch tools are verified 100% compatible
|
|
329
380
|
- Tool event structure matches OpenCode specifications
|
|
330
381
|
- Can be used as drop-in replacement for `opencode run --format json`
|
|
331
382
|
|
|
332
383
|
### Plain Text Support
|
|
384
|
+
|
|
333
385
|
Both plain text and JSON input work:
|
|
386
|
+
|
|
334
387
|
```bash
|
|
335
388
|
# Plain text
|
|
336
389
|
echo "hello" | bun run src/index.js
|
|
@@ -342,12 +395,15 @@ echo '{"message":"hello"}' | bun run src/index.js
|
|
|
342
395
|
Plain text is automatically converted to `{"message":"your text"}` format.
|
|
343
396
|
|
|
344
397
|
### JSON Event Streaming Output
|
|
398
|
+
|
|
345
399
|
JSON output is pretty-printed for easy readability while maintaining OpenCode compatibility:
|
|
400
|
+
|
|
346
401
|
```bash
|
|
347
402
|
echo "hi" | agent
|
|
348
403
|
```
|
|
349
404
|
|
|
350
405
|
Output (pretty-printed JSON events):
|
|
406
|
+
|
|
351
407
|
```json
|
|
352
408
|
{
|
|
353
409
|
"type": "step_start",
|
|
@@ -413,6 +469,7 @@ This repository includes official reference implementations as git submodules to
|
|
|
413
469
|
- **reference-qwen3-coder** - [Qwen3-Coder](https://github.com/QwenLM/Qwen3-Coder) - Official Qwen3 code model from Alibaba Cloud
|
|
414
470
|
|
|
415
471
|
To initialize all submodules:
|
|
472
|
+
|
|
416
473
|
```bash
|
|
417
474
|
git submodule update --init --recursive
|
|
418
475
|
```
|