@link-assistant/agent 0.7.0 → 0.8.2
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/README.md +157 -155
- package/package.json +8 -8
- package/src/cli/continuous-mode.js +188 -18
- package/src/cli/event-handler.js +99 -0
- package/src/config/config.ts +51 -0
- package/src/index.js +82 -157
- package/src/mcp/index.ts +125 -0
- package/src/session/message-v2.ts +30 -1
- package/src/session/processor.ts +21 -2
- package/src/session/prompt.ts +23 -1
- package/src/session/retry.ts +18 -0
- package/EXAMPLES.md +0 -462
- package/LICENSE +0 -24
- package/MODELS.md +0 -143
- package/TOOLS.md +0 -154
package/MODELS.md
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# Models
|
|
2
|
-
|
|
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`.
|
|
15
|
-
|
|
16
|
-
## Available Models
|
|
17
|
-
|
|
18
|
-
All models are accessed using the format `<provider>/<model-id>`. Use the `--model` option to specify which model to use:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
echo "hi" | agent --model opencode/grok-code
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## OpenCode Zen Pricing
|
|
25
|
-
|
|
26
|
-
Below are the prices per 1M tokens for OpenCode Zen models. Models are sorted by output price (lowest first) for best pricing visibility.
|
|
27
|
-
|
|
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 | - |
|
|
34
|
-
| **Paid Models (sorted by output price)** |
|
|
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 |
|
|
51
|
-
|
|
52
|
-
## Default Model
|
|
53
|
-
|
|
54
|
-
The default model is **Grok Code Fast 1** (`opencode/grok-code`), which is completely free. This model provides excellent performance for coding tasks with no cost.
|
|
55
|
-
|
|
56
|
-
## Usage Examples
|
|
57
|
-
|
|
58
|
-
### Using the Default Model (Free)
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# Uses opencode/grok-code by default
|
|
62
|
-
echo "hello" | agent
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Using Other Free Models
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
# Big Pickle (free)
|
|
69
|
-
echo "hello" | agent --model opencode/big-pickle
|
|
70
|
-
|
|
71
|
-
# GPT 5 Nano (free)
|
|
72
|
-
echo "hello" | agent --model opencode/gpt-5-nano
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Using Paid Models
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
# Claude Sonnet 4.5 (best quality)
|
|
79
|
-
echo "hello" | agent --model opencode/sonnet
|
|
80
|
-
|
|
81
|
-
# Claude Haiku 4.5 (fast and affordable)
|
|
82
|
-
echo "hello" | agent --model opencode/haiku
|
|
83
|
-
|
|
84
|
-
# Claude Opus 4.1 (most capable)
|
|
85
|
-
echo "hello" | agent --model opencode/opus
|
|
86
|
-
|
|
87
|
-
# Gemini 3 Pro
|
|
88
|
-
echo "hello" | agent --model opencode/gemini-3-pro
|
|
89
|
-
|
|
90
|
-
# GPT 5.1
|
|
91
|
-
echo "hello" | agent --model opencode/gpt-5-1
|
|
92
|
-
|
|
93
|
-
# Qwen3 Coder (specialized for coding)
|
|
94
|
-
echo "hello" | agent --model opencode/qwen3-coder-480b
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## More Information
|
|
98
|
-
|
|
99
|
-
For complete details about OpenCode Zen subscription and pricing, visit the [OpenCode Zen Documentation](https://opencode.ai/docs/zen/).
|
|
100
|
-
|
|
101
|
-
## Notes
|
|
102
|
-
|
|
103
|
-
- All prices are per 1 million tokens
|
|
104
|
-
- Cache pricing applies when using prompt caching features
|
|
105
|
-
- Token context limits vary by model
|
|
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/TOOLS.md
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# Supported Tools
|
|
2
|
-
|
|
3
|
-
This document lists all tools supported by `@link-assistant/agent`. All tools are enabled by default and produce OpenCode-compatible JSON output.
|
|
4
|
-
|
|
5
|
-
> ⚠️ **Bun-only** - This package requires [Bun](https://bun.sh) and does NOT support Node.js or Deno.
|
|
6
|
-
|
|
7
|
-
## File Operations
|
|
8
|
-
|
|
9
|
-
### read
|
|
10
|
-
|
|
11
|
-
Reads file contents from the filesystem.
|
|
12
|
-
|
|
13
|
-
**Status:** ✅ Fully supported and tested
|
|
14
|
-
**Test:** [tests/read.tools.test.js](tests/read.tools.test.js)
|
|
15
|
-
|
|
16
|
-
### write
|
|
17
|
-
|
|
18
|
-
Writes content to files in the filesystem.
|
|
19
|
-
|
|
20
|
-
**Status:** ✅ Fully supported and tested
|
|
21
|
-
**Test:** [tests/write.tools.test.js](tests/write.tools.test.js)
|
|
22
|
-
|
|
23
|
-
### edit
|
|
24
|
-
|
|
25
|
-
Performs exact string replacements in files.
|
|
26
|
-
|
|
27
|
-
**Status:** ✅ Fully supported and tested
|
|
28
|
-
**Test:** [tests/edit.tools.test.js](tests/edit.tools.test.js)
|
|
29
|
-
|
|
30
|
-
### list (ls)
|
|
31
|
-
|
|
32
|
-
Lists files and directories.
|
|
33
|
-
|
|
34
|
-
**Status:** ✅ Fully supported and tested
|
|
35
|
-
**Test:** [tests/list.tools.test.js](tests/list.tools.test.js)
|
|
36
|
-
|
|
37
|
-
## Search Tools
|
|
38
|
-
|
|
39
|
-
### glob
|
|
40
|
-
|
|
41
|
-
Fast file pattern matching tool that works with any codebase size. Supports glob patterns like `**/*.js` or `src/**/*.ts`.
|
|
42
|
-
|
|
43
|
-
**Status:** ✅ Fully supported and tested
|
|
44
|
-
**Test:** [tests/glob.tools.test.js](tests/glob.tools.test.js)
|
|
45
|
-
|
|
46
|
-
### grep
|
|
47
|
-
|
|
48
|
-
Powerful search tool built on ripgrep. Supports full regex syntax and can filter by file type or glob pattern.
|
|
49
|
-
|
|
50
|
-
**Status:** ✅ Fully supported and tested
|
|
51
|
-
**Test:** [tests/grep.tools.test.js](tests/grep.tools.test.js)
|
|
52
|
-
|
|
53
|
-
### websearch
|
|
54
|
-
|
|
55
|
-
Searches the web using Exa API for current information. Always enabled, no environment variables required.
|
|
56
|
-
|
|
57
|
-
**Status:** ✅ Fully supported and tested
|
|
58
|
-
**Test:** [tests/websearch.tools.test.js](tests/websearch.tools.test.js)
|
|
59
|
-
**OpenCode Compatibility:** ✅ 100% compatible
|
|
60
|
-
|
|
61
|
-
### codesearch
|
|
62
|
-
|
|
63
|
-
Searches code repositories and documentation using Exa API. Always enabled.
|
|
64
|
-
|
|
65
|
-
**Status:** ✅ Fully supported and tested
|
|
66
|
-
**Test:** [tests/codesearch.tools.test.js](tests/codesearch.tools.test.js)
|
|
67
|
-
**OpenCode Compatibility:** ✅ 100% compatible
|
|
68
|
-
|
|
69
|
-
## Execution Tools
|
|
70
|
-
|
|
71
|
-
### bash
|
|
72
|
-
|
|
73
|
-
Executes bash commands in a persistent shell session with optional timeout.
|
|
74
|
-
|
|
75
|
-
**Status:** ✅ Fully supported and tested
|
|
76
|
-
**Test:** [tests/bash.tools.test.js](tests/bash.tools.test.js)
|
|
77
|
-
|
|
78
|
-
### batch
|
|
79
|
-
|
|
80
|
-
Batches multiple tool calls together for optimal performance. Executes multiple tools in a single operation. Always enabled.
|
|
81
|
-
|
|
82
|
-
**Status:** ✅ Fully supported and tested
|
|
83
|
-
**Test:** [tests/batch.tools.test.js](tests/batch.tools.test.js)
|
|
84
|
-
|
|
85
|
-
### task
|
|
86
|
-
|
|
87
|
-
Launches specialized agents to handle complex, multi-step tasks autonomously.
|
|
88
|
-
|
|
89
|
-
**Status:** ✅ Fully supported and tested
|
|
90
|
-
**Test:** [tests/task.tools.test.js](tests/task.tools.test.js)
|
|
91
|
-
|
|
92
|
-
## Utility Tools
|
|
93
|
-
|
|
94
|
-
### todo (todowrite/todoread)
|
|
95
|
-
|
|
96
|
-
Reads and writes TODO items for task tracking during execution.
|
|
97
|
-
|
|
98
|
-
**Status:** ✅ Fully supported and tested
|
|
99
|
-
**Test:** [tests/todo.tools.test.js](tests/todo.tools.test.js)
|
|
100
|
-
|
|
101
|
-
### webfetch
|
|
102
|
-
|
|
103
|
-
Fetches content from a specified URL and processes it using an AI model.
|
|
104
|
-
|
|
105
|
-
**Status:** ✅ Fully supported and tested
|
|
106
|
-
**Test:** [tests/webfetch.tools.test.js](tests/webfetch.tools.test.js)
|
|
107
|
-
|
|
108
|
-
## Testing
|
|
109
|
-
|
|
110
|
-
### Run All Tool Tests
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
bun test tests/*.tools.test.js
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Run Specific Tool Test
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
bun test tests/bash.tools.test.js
|
|
120
|
-
bun test tests/websearch.tools.test.js
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Test Coverage
|
|
124
|
-
|
|
125
|
-
Each tool test verifies:
|
|
126
|
-
|
|
127
|
-
- ✅ Correct JSON output structure
|
|
128
|
-
- ✅ OpenCode compatibility (where applicable)
|
|
129
|
-
- ✅ Proper input/output handling
|
|
130
|
-
- ✅ Error handling
|
|
131
|
-
|
|
132
|
-
## Key Features
|
|
133
|
-
|
|
134
|
-
### No Configuration Required
|
|
135
|
-
|
|
136
|
-
- All tools work without environment variables or configuration files
|
|
137
|
-
- WebSearch and CodeSearch work without `OPENCODE_EXPERIMENTAL_EXA`
|
|
138
|
-
- Batch tool is always enabled, no experimental flag needed
|
|
139
|
-
|
|
140
|
-
### OpenCode Compatible
|
|
141
|
-
|
|
142
|
-
- All tools produce JSON output compatible with OpenCode's format
|
|
143
|
-
- WebSearch and CodeSearch tools are 100% compatible with OpenCode output
|
|
144
|
-
- Tool event structure matches OpenCode specifications
|
|
145
|
-
|
|
146
|
-
### Plain Text Input Support
|
|
147
|
-
|
|
148
|
-
`@link-assistant/agent` also accepts plain text input (not just JSON):
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
echo "hello world" | agent
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Plain text is automatically converted to a message request.
|