@zhijiewang/openharness 0.1.1 → 0.2.0
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/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- package/.github/pull_request_template.md +24 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/README.md +160 -156
- package/SECURITY.md +21 -0
- package/dist/commands/index.d.ts +37 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +189 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/components/App.d.ts.map +1 -1
- package/dist/components/App.js +3 -2
- package/dist/components/App.js.map +1 -1
- package/dist/components/ErrorBoundary.d.ts +17 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/ErrorBoundary.js +19 -0
- package/dist/components/ErrorBoundary.js.map +1 -0
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +70 -18
- package/dist/components/Markdown.js.map +1 -1
- package/dist/components/Messages.d.ts.map +1 -1
- package/dist/components/Messages.js +10 -4
- package/dist/components/Messages.js.map +1 -1
- package/dist/components/PermissionPrompt.d.ts.map +1 -1
- package/dist/components/PermissionPrompt.js +25 -7
- package/dist/components/PermissionPrompt.js.map +1 -1
- package/dist/components/REPL.d.ts.map +1 -1
- package/dist/components/REPL.js +60 -6
- package/dist/components/REPL.js.map +1 -1
- package/dist/components/Spinner.d.ts +3 -2
- package/dist/components/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner.js +22 -4
- package/dist/components/Spinner.js.map +1 -1
- package/dist/components/TextInput.d.ts.map +1 -1
- package/dist/components/TextInput.js +4 -1
- package/dist/components/TextInput.js.map +1 -1
- package/dist/git/index.d.ts +47 -0
- package/dist/git/index.d.ts.map +1 -0
- package/dist/git/index.js +151 -0
- package/dist/git/index.js.map +1 -0
- package/dist/harness/session.d.ts.map +1 -1
- package/dist/harness/session.js +2 -1
- package/dist/harness/session.js.map +1 -1
- package/dist/main.js +88 -2
- package/dist/main.js.map +1 -1
- package/dist/providers/openai.js +11 -1
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openrouter.js +11 -1
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/query.d.ts +15 -11
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +196 -80
- package/dist/query.js.map +1 -1
- package/dist/services/StreamingToolExecutor.d.ts +25 -0
- package/dist/services/StreamingToolExecutor.d.ts.map +1 -0
- package/dist/services/StreamingToolExecutor.js +107 -0
- package/dist/services/StreamingToolExecutor.js.map +1 -0
- package/dist/tools/AgentTool/index.d.ts +15 -0
- package/dist/tools/AgentTool/index.d.ts.map +1 -0
- package/dist/tools/AgentTool/index.js +30 -0
- package/dist/tools/AgentTool/index.js.map +1 -0
- package/dist/tools/AskUserTool/index.d.ts +15 -0
- package/dist/tools/AskUserTool/index.d.ts.map +1 -0
- package/dist/tools/AskUserTool/index.js +30 -0
- package/dist/tools/AskUserTool/index.js.map +1 -0
- package/dist/tools/EnterPlanModeTool/index.d.ts +6 -0
- package/dist/tools/EnterPlanModeTool/index.d.ts.map +1 -0
- package/dist/tools/EnterPlanModeTool/index.js +37 -0
- package/dist/tools/EnterPlanModeTool/index.js.map +1 -0
- package/dist/tools/ExitPlanModeTool/index.d.ts +6 -0
- package/dist/tools/ExitPlanModeTool/index.d.ts.map +1 -0
- package/dist/tools/ExitPlanModeTool/index.js +21 -0
- package/dist/tools/ExitPlanModeTool/index.js.map +1 -0
- package/dist/tools/NotebookEditTool/index.d.ts +18 -0
- package/dist/tools/NotebookEditTool/index.d.ts.map +1 -0
- package/dist/tools/NotebookEditTool/index.js +61 -0
- package/dist/tools/NotebookEditTool/index.js.map +1 -0
- package/dist/tools/SkillTool/index.d.ts +15 -0
- package/dist/tools/SkillTool/index.d.ts.map +1 -0
- package/dist/tools/SkillTool/index.js +49 -0
- package/dist/tools/SkillTool/index.js.map +1 -0
- package/dist/tools/TaskCreateTool/index.d.ts +15 -0
- package/dist/tools/TaskCreateTool/index.d.ts.map +1 -0
- package/dist/tools/TaskCreateTool/index.js +54 -0
- package/dist/tools/TaskCreateTool/index.js.map +1 -0
- package/dist/tools/TaskListTool/index.d.ts +6 -0
- package/dist/tools/TaskListTool/index.d.ts.map +1 -0
- package/dist/tools/TaskListTool/index.js +40 -0
- package/dist/tools/TaskListTool/index.js.map +1 -0
- package/dist/tools/TaskUpdateTool/index.d.ts +18 -0
- package/dist/tools/TaskUpdateTool/index.d.ts.map +1 -0
- package/dist/tools/TaskUpdateTool/index.js +50 -0
- package/dist/tools/TaskUpdateTool/index.js.map +1 -0
- package/dist/tools/WebSearchTool/index.d.ts +15 -0
- package/dist/tools/WebSearchTool/index.d.ts.map +1 -0
- package/dist/tools/WebSearchTool/index.js +76 -0
- package/dist/tools/WebSearchTool/index.js.map +1 -0
- package/dist/tools/web-fetch.test.d.ts +2 -0
- package/dist/tools/web-fetch.test.d.ts.map +1 -0
- package/dist/tools/web-fetch.test.js +27 -0
- package/dist/tools/web-fetch.test.js.map +1 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +27 -0
- package/dist/tools.js.map +1 -1
- package/dist/utils/retry.d.ts +10 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +23 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/theme.d.ts +27 -0
- package/dist/utils/theme.d.ts.map +1 -0
- package/dist/utils/theme.js +45 -0
- package/dist/utils/theme.js.map +1 -0
- package/dist/utils/tokens.d.ts +18 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +57 -0
- package/dist/utils/tokens.js.map +1 -0
- package/package.json +61 -57
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Report a bug in OpenHarness
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Describe the bug**
|
|
8
|
+
A clear description of what the bug is.
|
|
9
|
+
|
|
10
|
+
**To reproduce**
|
|
11
|
+
Steps to reproduce the behavior:
|
|
12
|
+
1. Run `oh ...`
|
|
13
|
+
2. See error
|
|
14
|
+
|
|
15
|
+
**Expected behavior**
|
|
16
|
+
What you expected to happen.
|
|
17
|
+
|
|
18
|
+
**Environment**
|
|
19
|
+
- OS:
|
|
20
|
+
- Node version:
|
|
21
|
+
- OpenHarness version:
|
|
22
|
+
- LLM provider:
|
|
23
|
+
|
|
24
|
+
**Logs / error output**
|
|
25
|
+
```
|
|
26
|
+
paste any relevant output here
|
|
27
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for OpenHarness
|
|
4
|
+
labels: enhancement
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Problem / motivation**
|
|
8
|
+
What problem does this solve, or what use case does it enable?
|
|
9
|
+
|
|
10
|
+
**Proposed solution**
|
|
11
|
+
Describe the feature you'd like.
|
|
12
|
+
|
|
13
|
+
**Alternatives considered**
|
|
14
|
+
Any other approaches you've thought about?
|
|
15
|
+
|
|
16
|
+
**Additional context**
|
|
17
|
+
Screenshots, examples, or links if relevant.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- What does this PR do? -->
|
|
4
|
+
|
|
5
|
+
## Related issue
|
|
6
|
+
|
|
7
|
+
Closes #
|
|
8
|
+
|
|
9
|
+
## Type of change
|
|
10
|
+
|
|
11
|
+
- [ ] Bug fix
|
|
12
|
+
- [ ] New feature
|
|
13
|
+
- [ ] Breaking change
|
|
14
|
+
- [ ] Documentation
|
|
15
|
+
|
|
16
|
+
## Testing
|
|
17
|
+
|
|
18
|
+
<!-- How did you test this? -->
|
|
19
|
+
|
|
20
|
+
## Checklist
|
|
21
|
+
|
|
22
|
+
- [ ] Code builds without errors (`npm run build`)
|
|
23
|
+
- [ ] Types pass (`npm run typecheck`)
|
|
24
|
+
- [ ] Tests pass (`npm test`)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment:
|
|
12
|
+
|
|
13
|
+
- Demonstrating empathy and kindness toward other people
|
|
14
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
- Giving and gracefully accepting constructive feedback
|
|
16
|
+
- Accepting responsibility and apologizing to those affected by our mistakes
|
|
17
|
+
- Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior:
|
|
20
|
+
|
|
21
|
+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
+
- Public or private harassment
|
|
24
|
+
- Publishing others' private information without explicit permission
|
|
25
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
+
|
|
27
|
+
## Enforcement Responsibilities
|
|
28
|
+
|
|
29
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
## Scope
|
|
32
|
+
|
|
33
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.
|
|
34
|
+
|
|
35
|
+
## Enforcement
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at the repository's issue tracker or by contacting the maintainer directly via GitHub.
|
|
38
|
+
|
|
39
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
+
|
|
41
|
+
## Attribution
|
|
42
|
+
|
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
package/README.md
CHANGED
|
@@ -1,156 +1,160 @@
|
|
|
1
|
-
# OpenHarness
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
___
|
|
5
|
-
/ \
|
|
6
|
-
( ) ___ ___ ___ _ _ _ _ _ ___ _ _ ___ ___ ___
|
|
7
|
-
`~w~` / _ \| _ \| __| \| | || | /_\ | _ \ \| | __/ __/ __|
|
|
8
|
-
(( )) | (_) | _/| _|| .` | __ |/ _ \| / .` | _|\__ \__ \
|
|
9
|
-
))(( \___/|_| |___|_|\_|_||_/_/ \_\_|_\_|\_|___|___/___/
|
|
10
|
-
(( ))
|
|
11
|
-
`--`
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Open-source terminal coding agent. Build your own Claude Code with any LLM.
|
|
15
|
-
|
|
16
|
-

|
|
17
|
-

|
|
18
|
-

|
|
19
|
-

|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
oh
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
##
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
|
68
|
-
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
oh
|
|
83
|
-
oh
|
|
84
|
-
oh
|
|
85
|
-
oh
|
|
86
|
-
oh
|
|
87
|
-
oh
|
|
88
|
-
oh
|
|
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
|
-
### Adding a
|
|
143
|
-
|
|
144
|
-
Create `src/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
##
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
1
|
+
# OpenHarness
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
___
|
|
5
|
+
/ \
|
|
6
|
+
( ) ___ ___ ___ _ _ _ _ _ ___ _ _ ___ ___ ___
|
|
7
|
+
`~w~` / _ \| _ \| __| \| | || | /_\ | _ \ \| | __/ __/ __|
|
|
8
|
+
(( )) | (_) | _/| _|| .` | __ |/ _ \| / .` | _|\__ \__ \
|
|
9
|
+
))(( \___/|_| |___|_|\_|_||_/_/ \_\_|_\_|\_|___|___/___/
|
|
10
|
+
(( ))
|
|
11
|
+
`--`
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Open-source terminal coding agent. Build your own Claude Code with any LLM.
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+

|
|
18
|
+

|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<video src="https://github.com/user-attachments/assets/ed19a2cc-14d3-4db3-aa5b-3dc07c444498" controls width="100%"></video>
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g @zhijiewang/openharness
|
|
31
|
+
oh
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
That's it. Just type `oh` to start chatting with your local Ollama model.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
oh # auto-detect Ollama, start chatting
|
|
38
|
+
oh --model ollama/qwen2.5:7b # specific model
|
|
39
|
+
oh --model gpt-4o # use OpenAI (needs OPENAI_API_KEY)
|
|
40
|
+
oh --trust # auto-approve all tool calls
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<!--  -->
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
Requires **Node.js 18+**.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# From npm
|
|
51
|
+
npm install -g @zhijiewang/openharness
|
|
52
|
+
|
|
53
|
+
# From source
|
|
54
|
+
git clone https://github.com/zhijiewong/openharness.git
|
|
55
|
+
cd openharness
|
|
56
|
+
npm install
|
|
57
|
+
npm install -g .
|
|
58
|
+
oh
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Why OpenHarness?
|
|
62
|
+
|
|
63
|
+
Claude Code is powerful but locked to Anthropic. OpenHarness gives you the same architecture -- React+Ink terminal UI, async generator agent loop, Zod tool schemas, permission gates -- but works with **any LLM**. Local models via Ollama (free, offline, private), or cloud APIs (OpenAI, Anthropic, OpenRouter, DeepSeek, Groq, and any OpenAI-compatible endpoint).
|
|
64
|
+
|
|
65
|
+
## Tools
|
|
66
|
+
|
|
67
|
+
| Tool | Risk | Description |
|
|
68
|
+
|------|------|-------------|
|
|
69
|
+
| Read | low | Read files with line ranges |
|
|
70
|
+
| Edit | medium | Search-and-replace edits |
|
|
71
|
+
| Write | medium | Create or overwrite files |
|
|
72
|
+
| Bash | high | Shell commands with timeout |
|
|
73
|
+
| Glob | low | Find files by pattern |
|
|
74
|
+
| Grep | low | Regex content search |
|
|
75
|
+
| WebFetch | medium | Fetch URL content |
|
|
76
|
+
|
|
77
|
+
Low-risk tools auto-approve. Medium and high risk require confirmation in `ask` mode.
|
|
78
|
+
|
|
79
|
+
## Commands
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
oh # start chatting (default command)
|
|
83
|
+
oh --model MODEL # use a specific model
|
|
84
|
+
oh --trust # auto-approve all tools
|
|
85
|
+
oh --deny # block all non-read tools
|
|
86
|
+
oh --resume ID # resume a saved session
|
|
87
|
+
oh models # list models and pricing
|
|
88
|
+
oh tools # list tools and risk levels
|
|
89
|
+
oh init # set up .oh/ for current project
|
|
90
|
+
oh sessions # list saved sessions
|
|
91
|
+
oh rules # show project rules
|
|
92
|
+
oh --version # show version
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Providers
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Local (free, no API key)
|
|
99
|
+
oh --model ollama/llama3
|
|
100
|
+
oh --model ollama/qwen2.5:7b-instruct
|
|
101
|
+
|
|
102
|
+
# Cloud (set API key as env var)
|
|
103
|
+
OPENAI_API_KEY=sk-... oh --model gpt-4o
|
|
104
|
+
ANTHROPIC_API_KEY=sk-ant-... oh --model claude-sonnet-4-6
|
|
105
|
+
OPENROUTER_API_KEY=sk-or-... oh --model openrouter/deepseek-chat
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Project Rules
|
|
109
|
+
|
|
110
|
+
Create `.oh/RULES.md` in any repo (or run `oh init`):
|
|
111
|
+
|
|
112
|
+
```markdown
|
|
113
|
+
- Always run tests after changes
|
|
114
|
+
- Use strict TypeScript
|
|
115
|
+
- Never commit to main directly
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Rules load automatically into every session.
|
|
119
|
+
|
|
120
|
+
## Tech Stack
|
|
121
|
+
|
|
122
|
+
| | OpenHarness | Claude Code |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| Language | TypeScript (strict) | TypeScript (strict) |
|
|
125
|
+
| Runtime | Node.js 18+ | Bun |
|
|
126
|
+
| Terminal UI | React + Ink | React + custom Ink fork |
|
|
127
|
+
| Tool schemas | Zod | Zod |
|
|
128
|
+
| Agent loop | async generators | async generators |
|
|
129
|
+
| Providers | Any (5 built-in) | Anthropic only |
|
|
130
|
+
| License | MIT | Proprietary |
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
git clone https://github.com/zhijiewong/openharness.git
|
|
136
|
+
cd openharness
|
|
137
|
+
npm install
|
|
138
|
+
npx tsx src/main.tsx # run in dev mode
|
|
139
|
+
npx tsc --noEmit # type check
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Adding a provider
|
|
143
|
+
|
|
144
|
+
Create `src/providers/yourprovider.ts` implementing the `Provider` interface, add a case in `src/providers/index.ts`.
|
|
145
|
+
|
|
146
|
+
### Adding a tool
|
|
147
|
+
|
|
148
|
+
Create `src/tools/YourTool/index.ts` implementing the `Tool` interface with a Zod input schema, register it in `src/tools.ts`.
|
|
149
|
+
|
|
150
|
+
## Contributing
|
|
151
|
+
|
|
152
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
This project is not affiliated with Anthropic.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
|---------|-----------|
|
|
7
|
+
| 0.1.x | ✅ |
|
|
8
|
+
|
|
9
|
+
## Reporting a Vulnerability
|
|
10
|
+
|
|
11
|
+
Please **do not** report security vulnerabilities via public GitHub issues.
|
|
12
|
+
|
|
13
|
+
Instead, open a [GitHub Security Advisory](https://github.com/zhijiewong/openharness/security/advisories/new) or contact the maintainer directly via the profile on GitHub.
|
|
14
|
+
|
|
15
|
+
Please include:
|
|
16
|
+
- Description of the vulnerability
|
|
17
|
+
- Steps to reproduce
|
|
18
|
+
- Potential impact
|
|
19
|
+
- Suggested fix (if any)
|
|
20
|
+
|
|
21
|
+
You can expect a response within 48 hours. If confirmed, a patch will be prioritized and released as soon as possible.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash command system — /help, /clear, /diff, /undo, /cost, etc.
|
|
3
|
+
*
|
|
4
|
+
* Commands are processed in the REPL before being sent to the LLM.
|
|
5
|
+
* If input starts with /, it's treated as a command.
|
|
6
|
+
*/
|
|
7
|
+
import type { Message } from "../types/message.js";
|
|
8
|
+
export type CommandResult = {
|
|
9
|
+
/** Text output to display */
|
|
10
|
+
output: string;
|
|
11
|
+
/** If true, don't send to LLM */
|
|
12
|
+
handled: boolean;
|
|
13
|
+
/** If set, clear messages */
|
|
14
|
+
clearMessages?: boolean;
|
|
15
|
+
/** If set, update model */
|
|
16
|
+
newModel?: string;
|
|
17
|
+
/** If set, replace messages with compacted version */
|
|
18
|
+
compactedMessages?: Message[];
|
|
19
|
+
};
|
|
20
|
+
export type CommandContext = {
|
|
21
|
+
messages: Message[];
|
|
22
|
+
model: string;
|
|
23
|
+
permissionMode: string;
|
|
24
|
+
totalCost: number;
|
|
25
|
+
totalInputTokens: number;
|
|
26
|
+
totalOutputTokens: number;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Check if input is a slash command. If so, execute it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function processSlashCommand(input: string, context: CommandContext): CommandResult | null;
|
|
33
|
+
/**
|
|
34
|
+
* Get all registered command names (for autocomplete/display).
|
|
35
|
+
*/
|
|
36
|
+
export declare function getCommandNames(): string[];
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG;IAC1B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,6BAA6B;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,OAAO,EAAE,CAAC;CAC/B,CAAC;AAIF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA4KF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,aAAa,GAAG,IAAI,CAiBhG;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAE1C"}
|