@zhijiewang/openharness 0.2.0 → 0.2.1
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 +1 -1
- package/README.md +203 -160
- package/dist/Tool.d.ts +1 -1
- package/dist/Tool.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/query.d.ts +1 -1
- package/dist/query.js +1 -1
- package/dist/services/StreamingToolExecutor.d.ts +2 -2
- package/dist/services/StreamingToolExecutor.js +2 -2
- package/dist/types/message.d.ts +1 -1
- package/dist/types/message.js +1 -1
- package/dist/types/permissions.d.ts +2 -2
- package/dist/types/permissions.js +2 -2
- package/dist/utils/theme.d.ts +1 -1
- package/dist/utils/theme.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,7 @@ Initial alpha release. TypeScript rewrite.
|
|
|
6
6
|
|
|
7
7
|
### Features
|
|
8
8
|
- Single TypeScript process with React+Ink terminal UI
|
|
9
|
-
- Agent loop with async generator streaming
|
|
9
|
+
- Agent loop with async generator streaming
|
|
10
10
|
- 5 LLM providers: Ollama, OpenAI, Anthropic, OpenRouter, OpenAI-compatible
|
|
11
11
|
- 7 tools: Read, Edit, Write, Bash, Glob, Grep, WebFetch (all with Zod schemas)
|
|
12
12
|
- Permission gate with ask/trust/deny modes and risk-based tool approval
|
package/README.md
CHANGED
|
@@ -1,160 +1,203 @@
|
|
|
1
|
-
# OpenHarness
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
___
|
|
5
|
-
/ \
|
|
6
|
-
( ) ___ ___ ___ _ _ _ _ _ ___ _ _ ___ ___ ___
|
|
7
|
-
`~w~` / _ \| _ \| __| \| | || | /_\ | _ \ \| | __/ __/ __|
|
|
8
|
-
(( )) | (_) | _/| _|| .` | __ |/ _ \| / .` | _|\__ \__ \
|
|
9
|
-
))(( \___/|_| |___|_|\_|_||_/_/ \_\_|_\_|\_|___|___/___/
|
|
10
|
-
(( ))
|
|
11
|
-
`--`
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-

|
|
18
|
-

|
|
19
|
-

|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
oh
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
oh
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
| Read | low | Read files with line ranges |
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
1
|
+
# OpenHarness
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
___
|
|
5
|
+
/ \
|
|
6
|
+
( ) ___ ___ ___ _ _ _ _ _ ___ _ _ ___ ___ ___
|
|
7
|
+
`~w~` / _ \| _ \| __| \| | || | /_\ | _ \ \| | __/ __/ __|
|
|
8
|
+
(( )) | (_) | _/| _|| .` | __ |/ _ \| / .` | _|\__ \__ \
|
|
9
|
+
))(( \___/|_| |___|_|\_|_||_/_/ \_\_|_\_|\_|___|___/___/
|
|
10
|
+
(( ))
|
|
11
|
+
`--`
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
AI coding agent in your terminal. Works with any LLM -- free local models or cloud APIs.
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+

|
|
18
|
+

|
|
19
|
+

|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<video src="https://github.com/user-attachments/assets/ed19a2cc-14d3-4db3-aa5b-3dc07c444498" controls width="100%"></video>
|
|
25
|
+
|
|
26
|
+
*OpenHarness reading files, running commands, and editing code — powered by a local Ollama model.*
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g @zhijiewang/openharness
|
|
34
|
+
oh
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
That's it. OpenHarness auto-detects Ollama and starts chatting. No API key needed.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
oh # auto-detect local model
|
|
41
|
+
oh --model ollama/qwen2.5:7b # specific model
|
|
42
|
+
oh --model gpt-4o # cloud model (needs OPENAI_API_KEY)
|
|
43
|
+
oh --trust # auto-approve all tool calls
|
|
44
|
+
oh run "fix the tests" --json # headless mode for CI/CD
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Why OpenHarness?
|
|
48
|
+
|
|
49
|
+
Most AI coding agents are locked to one provider or cost $20+/month. OpenHarness works with any LLM -- run it free with Ollama on your own machine, or connect to any cloud API. Every AI edit is git-committed and reversible with `/undo`.
|
|
50
|
+
|
|
51
|
+
| | OpenHarness | Claude Code | Aider | OpenCode |
|
|
52
|
+
|---|---|---|---|---|
|
|
53
|
+
| Any LLM | Yes (Ollama, OpenAI, Anthropic, OpenRouter, any OpenAI-compatible) | Anthropic only | Yes | Yes |
|
|
54
|
+
| Free local models | Ollama native | No | Yes | Yes |
|
|
55
|
+
| Tools | 17 with permission gates | 40+ | File-focused | 20+ |
|
|
56
|
+
| Git integration | Auto-commit + /undo | Yes | Deep git | Basic |
|
|
57
|
+
| Slash commands | 16 built-in | 80+ | Some | Some |
|
|
58
|
+
| Headless/CI mode | `oh run --json` | Yes | Yes | Yes |
|
|
59
|
+
| Terminal UI | React + Ink | React + Ink | Basic | BubbleTea |
|
|
60
|
+
| Language | TypeScript | TypeScript | Python | Go |
|
|
61
|
+
| License | MIT | Proprietary | Apache 2.0 | MIT |
|
|
62
|
+
| Price | Free (BYOK) | $20+/month | Free (BYOK) | Free (BYOK) |
|
|
63
|
+
|
|
64
|
+
## Tools (17)
|
|
65
|
+
|
|
66
|
+
| Tool | Risk | Description |
|
|
67
|
+
|------|------|-------------|
|
|
68
|
+
| Bash | high | Execute shell commands with timeout |
|
|
69
|
+
| Read | low | Read files with line ranges |
|
|
70
|
+
| Write | medium | Create or overwrite files |
|
|
71
|
+
| Edit | medium | Search-and-replace edits |
|
|
72
|
+
| Glob | low | Find files by pattern |
|
|
73
|
+
| Grep | low | Regex content search |
|
|
74
|
+
| WebFetch | medium | Fetch URL content (SSRF-protected) |
|
|
75
|
+
| WebSearch | medium | Search the web |
|
|
76
|
+
| TaskCreate | low | Create structured tasks |
|
|
77
|
+
| TaskUpdate | low | Update task status |
|
|
78
|
+
| TaskList | low | List all tasks |
|
|
79
|
+
| AskUser | low | Ask user a question with options |
|
|
80
|
+
| Skill | low | Invoke a skill from .oh/skills/ |
|
|
81
|
+
| Agent | medium | Spawn a sub-agent for delegation |
|
|
82
|
+
| EnterPlanMode | low | Enter structured planning mode |
|
|
83
|
+
| ExitPlanMode | low | Exit planning mode |
|
|
84
|
+
| NotebookEdit | medium | Edit Jupyter notebooks |
|
|
85
|
+
|
|
86
|
+
Low-risk read-only tools auto-approve. Medium and high risk tools require confirmation in `ask` mode. Use `--trust` to skip all prompts.
|
|
87
|
+
|
|
88
|
+
## Slash Commands (16)
|
|
89
|
+
|
|
90
|
+
Type these during a chat session:
|
|
91
|
+
|
|
92
|
+
| Command | Description |
|
|
93
|
+
|---------|-------------|
|
|
94
|
+
| `/help` | Show all available commands |
|
|
95
|
+
| `/clear` | Clear conversation history |
|
|
96
|
+
| `/cost` | Show session cost and token usage |
|
|
97
|
+
| `/status` | Show model, mode, git branch, session info |
|
|
98
|
+
| `/diff` | Show uncommitted git changes |
|
|
99
|
+
| `/undo` | Undo last AI commit |
|
|
100
|
+
| `/commit [msg]` | Create a git commit |
|
|
101
|
+
| `/log` | Show recent git commits |
|
|
102
|
+
| `/files` | List files in context |
|
|
103
|
+
| `/model <name>` | Switch model mid-session |
|
|
104
|
+
| `/compact` | Compress conversation to free context |
|
|
105
|
+
| `/export` | Export conversation to markdown |
|
|
106
|
+
| `/plan` | Enter plan mode |
|
|
107
|
+
| `/review` | Review recent code changes |
|
|
108
|
+
| `/config` | Show configuration |
|
|
109
|
+
| `/memory` | View memories |
|
|
110
|
+
|
|
111
|
+
## Git Integration
|
|
112
|
+
|
|
113
|
+
OpenHarness auto-commits AI edits in git repos:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
oh: Edit src/app.ts # auto-committed with "oh:" prefix
|
|
117
|
+
oh: Write tests/app.test.ts
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- Every AI file change is committed automatically
|
|
121
|
+
- `/undo` reverts the last AI commit (only OH commits, never yours)
|
|
122
|
+
- `/diff` shows what changed
|
|
123
|
+
- Your dirty files are safe — committed separately before AI edits
|
|
124
|
+
|
|
125
|
+
## Headless Mode
|
|
126
|
+
|
|
127
|
+
Run a single prompt without interactive UI — perfect for CI/CD:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
oh run "fix the failing tests" --model ollama/llama3 --trust
|
|
131
|
+
oh run "add error handling to api.ts" --json # JSON output
|
|
132
|
+
oh run "explain this codebase" --model gpt-4o
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Exit code 0 on success, 1 on failure.
|
|
136
|
+
|
|
137
|
+
## Providers
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Local (free, no API key needed)
|
|
141
|
+
oh --model ollama/llama3
|
|
142
|
+
oh --model ollama/qwen2.5:7b-instruct
|
|
143
|
+
|
|
144
|
+
# Cloud
|
|
145
|
+
OPENAI_API_KEY=sk-... oh --model gpt-4o
|
|
146
|
+
ANTHROPIC_API_KEY=sk-ant-... oh --model claude-sonnet-4-6
|
|
147
|
+
OPENROUTER_API_KEY=sk-or-... oh --model openrouter/deepseek-chat
|
|
148
|
+
|
|
149
|
+
# Any OpenAI-compatible endpoint
|
|
150
|
+
oh --model deepseek/deepseek-chat
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Project Rules
|
|
154
|
+
|
|
155
|
+
Create `.oh/RULES.md` in any repo (or run `oh init`):
|
|
156
|
+
|
|
157
|
+
```markdown
|
|
158
|
+
- Always run tests after changes
|
|
159
|
+
- Use strict TypeScript
|
|
160
|
+
- Never commit to main directly
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Rules load automatically into every session.
|
|
164
|
+
|
|
165
|
+
## Install
|
|
166
|
+
|
|
167
|
+
Requires **Node.js 18+**.
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# From npm
|
|
171
|
+
npm install -g @zhijiewang/openharness
|
|
172
|
+
|
|
173
|
+
# From source
|
|
174
|
+
git clone https://github.com/zhijiewong/openharness.git
|
|
175
|
+
cd openharness
|
|
176
|
+
npm install && npm install -g .
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npm install
|
|
183
|
+
npx tsx src/main.tsx # run in dev mode
|
|
184
|
+
npx tsc --noEmit # type check
|
|
185
|
+
npm test # run tests
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Adding a tool
|
|
189
|
+
|
|
190
|
+
Create `src/tools/YourTool/index.ts` implementing the `Tool` interface with a Zod input schema, register it in `src/tools.ts`.
|
|
191
|
+
|
|
192
|
+
### Adding a provider
|
|
193
|
+
|
|
194
|
+
Create `src/providers/yourprovider.ts` implementing the `Provider` interface, add a case in `src/providers/index.ts`.
|
|
195
|
+
|
|
196
|
+
## Contributing
|
|
197
|
+
|
|
198
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT
|
|
203
|
+
|
package/dist/Tool.d.ts
CHANGED
package/dist/Tool.js
CHANGED
package/dist/main.js
CHANGED
|
@@ -12,7 +12,7 @@ const VERSION = "0.1.0";
|
|
|
12
12
|
const program = new Command();
|
|
13
13
|
program
|
|
14
14
|
.name("openharness")
|
|
15
|
-
.description("Open-source terminal coding agent.
|
|
15
|
+
.description("Open-source terminal coding agent. Works with any LLM.")
|
|
16
16
|
.version(VERSION);
|
|
17
17
|
// ── Headless run command ──
|
|
18
18
|
const DEFAULT_SYSTEM_PROMPT = `You are OpenHarness, an AI coding assistant running in the user's terminal.
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":";;AAYA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,GAAG,MAAM,qBAAqB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpD,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":";;AAYA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,GAAG,MAAM,qBAAqB,CAA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,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,UAAU,CAAC;IAClD,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC1C,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/query.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent loop — the core LLM-to-Tool orchestration cycle.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Core agent loop architecture:
|
|
5
5
|
* - while(true) state machine with explicit transitions
|
|
6
6
|
* - Error recovery with ordered fallbacks and circuit breaker
|
|
7
7
|
* - Context window management with message compression
|
package/dist/query.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent loop — the core LLM-to-Tool orchestration cycle.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Core agent loop architecture:
|
|
5
5
|
* - while(true) state machine with explicit transitions
|
|
6
6
|
* - Error recovery with ordered fallbacks and circuit breaker
|
|
7
7
|
* - Context window management with message compression
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tool execution during LLM streaming —
|
|
3
|
-
*
|
|
2
|
+
* Tool execution during LLM streaming — concurrent tool execution
|
|
3
|
+
* with permission checks and queue management.
|
|
4
4
|
*/
|
|
5
5
|
import type { ToolCall } from "../types/message.js";
|
|
6
6
|
import type { ToolResult, ToolContext, Tools } from "../Tool.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tool execution during LLM streaming —
|
|
3
|
-
*
|
|
2
|
+
* Tool execution during LLM streaming — concurrent tool execution
|
|
3
|
+
* with permission checks and queue management.
|
|
4
4
|
*/
|
|
5
5
|
import { findToolByName } from "../Tool.js";
|
|
6
6
|
import { checkPermission } from "../types/permissions.js";
|
package/dist/types/message.d.ts
CHANGED
package/dist/types/message.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Permission types —
|
|
2
|
+
* Permission types — tool permission context and risk-based gating.
|
|
3
3
|
*/
|
|
4
4
|
export type PermissionMode = "ask" | "trust" | "deny";
|
|
5
5
|
export type RiskLevel = "low" | "medium" | "high";
|
|
@@ -12,7 +12,7 @@ export type AskUserFn = (toolName: string, description: string) => Promise<boole
|
|
|
12
12
|
/**
|
|
13
13
|
* Permission gate — decides if a tool call should be allowed.
|
|
14
14
|
*
|
|
15
|
-
* Decision matrix
|
|
15
|
+
* Decision matrix:
|
|
16
16
|
* - LOW risk + read-only: always allow
|
|
17
17
|
* - trust mode: always allow
|
|
18
18
|
* - deny mode: only allow LOW read-only
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Permission types —
|
|
2
|
+
* Permission types — tool permission context and risk-based gating.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Permission gate — decides if a tool call should be allowed.
|
|
6
6
|
*
|
|
7
|
-
* Decision matrix
|
|
7
|
+
* Decision matrix:
|
|
8
8
|
* - LOW risk + read-only: always allow
|
|
9
9
|
* - trust mode: always allow
|
|
10
10
|
* - deny mode: only allow LOW read-only
|
package/dist/utils/theme.d.ts
CHANGED
package/dist/utils/theme.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhijiewang/openharness",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Open-source terminal coding agent.
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Open-source terminal coding agent. Works with any LLM.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"openharness": "./dist/main.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"cli",
|
|
45
45
|
"coding-agent",
|
|
46
46
|
"terminal",
|
|
47
|
-
"
|
|
47
|
+
"coding-assistant",
|
|
48
48
|
"ollama",
|
|
49
49
|
"openai",
|
|
50
50
|
"anthropic"
|