@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.
Files changed (117) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  3. package/.github/pull_request_template.md +24 -0
  4. package/CODE_OF_CONDUCT.md +43 -0
  5. package/README.md +160 -156
  6. package/SECURITY.md +21 -0
  7. package/dist/commands/index.d.ts +37 -0
  8. package/dist/commands/index.d.ts.map +1 -0
  9. package/dist/commands/index.js +189 -0
  10. package/dist/commands/index.js.map +1 -0
  11. package/dist/components/App.d.ts.map +1 -1
  12. package/dist/components/App.js +3 -2
  13. package/dist/components/App.js.map +1 -1
  14. package/dist/components/ErrorBoundary.d.ts +17 -0
  15. package/dist/components/ErrorBoundary.d.ts.map +1 -0
  16. package/dist/components/ErrorBoundary.js +19 -0
  17. package/dist/components/ErrorBoundary.js.map +1 -0
  18. package/dist/components/Markdown.d.ts.map +1 -1
  19. package/dist/components/Markdown.js +70 -18
  20. package/dist/components/Markdown.js.map +1 -1
  21. package/dist/components/Messages.d.ts.map +1 -1
  22. package/dist/components/Messages.js +10 -4
  23. package/dist/components/Messages.js.map +1 -1
  24. package/dist/components/PermissionPrompt.d.ts.map +1 -1
  25. package/dist/components/PermissionPrompt.js +25 -7
  26. package/dist/components/PermissionPrompt.js.map +1 -1
  27. package/dist/components/REPL.d.ts.map +1 -1
  28. package/dist/components/REPL.js +60 -6
  29. package/dist/components/REPL.js.map +1 -1
  30. package/dist/components/Spinner.d.ts +3 -2
  31. package/dist/components/Spinner.d.ts.map +1 -1
  32. package/dist/components/Spinner.js +22 -4
  33. package/dist/components/Spinner.js.map +1 -1
  34. package/dist/components/TextInput.d.ts.map +1 -1
  35. package/dist/components/TextInput.js +4 -1
  36. package/dist/components/TextInput.js.map +1 -1
  37. package/dist/git/index.d.ts +47 -0
  38. package/dist/git/index.d.ts.map +1 -0
  39. package/dist/git/index.js +151 -0
  40. package/dist/git/index.js.map +1 -0
  41. package/dist/harness/session.d.ts.map +1 -1
  42. package/dist/harness/session.js +2 -1
  43. package/dist/harness/session.js.map +1 -1
  44. package/dist/main.js +88 -2
  45. package/dist/main.js.map +1 -1
  46. package/dist/providers/openai.js +11 -1
  47. package/dist/providers/openai.js.map +1 -1
  48. package/dist/providers/openrouter.js +11 -1
  49. package/dist/providers/openrouter.js.map +1 -1
  50. package/dist/query.d.ts +15 -11
  51. package/dist/query.d.ts.map +1 -1
  52. package/dist/query.js +196 -80
  53. package/dist/query.js.map +1 -1
  54. package/dist/services/StreamingToolExecutor.d.ts +25 -0
  55. package/dist/services/StreamingToolExecutor.d.ts.map +1 -0
  56. package/dist/services/StreamingToolExecutor.js +107 -0
  57. package/dist/services/StreamingToolExecutor.js.map +1 -0
  58. package/dist/tools/AgentTool/index.d.ts +15 -0
  59. package/dist/tools/AgentTool/index.d.ts.map +1 -0
  60. package/dist/tools/AgentTool/index.js +30 -0
  61. package/dist/tools/AgentTool/index.js.map +1 -0
  62. package/dist/tools/AskUserTool/index.d.ts +15 -0
  63. package/dist/tools/AskUserTool/index.d.ts.map +1 -0
  64. package/dist/tools/AskUserTool/index.js +30 -0
  65. package/dist/tools/AskUserTool/index.js.map +1 -0
  66. package/dist/tools/EnterPlanModeTool/index.d.ts +6 -0
  67. package/dist/tools/EnterPlanModeTool/index.d.ts.map +1 -0
  68. package/dist/tools/EnterPlanModeTool/index.js +37 -0
  69. package/dist/tools/EnterPlanModeTool/index.js.map +1 -0
  70. package/dist/tools/ExitPlanModeTool/index.d.ts +6 -0
  71. package/dist/tools/ExitPlanModeTool/index.d.ts.map +1 -0
  72. package/dist/tools/ExitPlanModeTool/index.js +21 -0
  73. package/dist/tools/ExitPlanModeTool/index.js.map +1 -0
  74. package/dist/tools/NotebookEditTool/index.d.ts +18 -0
  75. package/dist/tools/NotebookEditTool/index.d.ts.map +1 -0
  76. package/dist/tools/NotebookEditTool/index.js +61 -0
  77. package/dist/tools/NotebookEditTool/index.js.map +1 -0
  78. package/dist/tools/SkillTool/index.d.ts +15 -0
  79. package/dist/tools/SkillTool/index.d.ts.map +1 -0
  80. package/dist/tools/SkillTool/index.js +49 -0
  81. package/dist/tools/SkillTool/index.js.map +1 -0
  82. package/dist/tools/TaskCreateTool/index.d.ts +15 -0
  83. package/dist/tools/TaskCreateTool/index.d.ts.map +1 -0
  84. package/dist/tools/TaskCreateTool/index.js +54 -0
  85. package/dist/tools/TaskCreateTool/index.js.map +1 -0
  86. package/dist/tools/TaskListTool/index.d.ts +6 -0
  87. package/dist/tools/TaskListTool/index.d.ts.map +1 -0
  88. package/dist/tools/TaskListTool/index.js +40 -0
  89. package/dist/tools/TaskListTool/index.js.map +1 -0
  90. package/dist/tools/TaskUpdateTool/index.d.ts +18 -0
  91. package/dist/tools/TaskUpdateTool/index.d.ts.map +1 -0
  92. package/dist/tools/TaskUpdateTool/index.js +50 -0
  93. package/dist/tools/TaskUpdateTool/index.js.map +1 -0
  94. package/dist/tools/WebSearchTool/index.d.ts +15 -0
  95. package/dist/tools/WebSearchTool/index.d.ts.map +1 -0
  96. package/dist/tools/WebSearchTool/index.js +76 -0
  97. package/dist/tools/WebSearchTool/index.js.map +1 -0
  98. package/dist/tools/web-fetch.test.d.ts +2 -0
  99. package/dist/tools/web-fetch.test.d.ts.map +1 -0
  100. package/dist/tools/web-fetch.test.js +27 -0
  101. package/dist/tools/web-fetch.test.js.map +1 -0
  102. package/dist/tools.d.ts.map +1 -1
  103. package/dist/tools.js +27 -0
  104. package/dist/tools.js.map +1 -1
  105. package/dist/utils/retry.d.ts +10 -0
  106. package/dist/utils/retry.d.ts.map +1 -0
  107. package/dist/utils/retry.js +23 -0
  108. package/dist/utils/retry.js.map +1 -0
  109. package/dist/utils/theme.d.ts +27 -0
  110. package/dist/utils/theme.d.ts.map +1 -0
  111. package/dist/utils/theme.js +45 -0
  112. package/dist/utils/theme.js.map +1 -0
  113. package/dist/utils/tokens.d.ts +18 -0
  114. package/dist/utils/tokens.d.ts.map +1 -0
  115. package/dist/utils/tokens.js +57 -0
  116. package/dist/utils/tokens.js.map +1 -0
  117. 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
- ![Status: Alpha](https://img.shields.io/badge/status-alpha-orange)
17
- ![Node.js 18+](https://img.shields.io/badge/node-18%2B-green)
18
- ![TypeScript](https://img.shields.io/badge/typescript-strict-blue)
19
- ![License: MIT](https://img.shields.io/badge/license-MIT-green)
20
-
21
- ---
22
-
23
- ## Quick Start
24
-
25
- ```bash
26
- npm install -g @zhijiewang/openharness
27
- oh
28
- ```
29
-
30
- That's it. Just type `oh` to start chatting with your local Ollama model.
31
-
32
- ```bash
33
- oh # auto-detect Ollama, start chatting
34
- oh --model ollama/qwen2.5:7b # specific model
35
- oh --model gpt-4o # use OpenAI (needs OPENAI_API_KEY)
36
- oh --trust # auto-approve all tool calls
37
- ```
38
-
39
- <!-- ![Demo](assets/demo.gif) -->
40
-
41
- ## Install
42
-
43
- Requires **Node.js 18+**.
44
-
45
- ```bash
46
- # From npm
47
- npm install -g @zhijiewang/openharness
48
-
49
- # From source
50
- git clone https://github.com/zhijiewong/openharness.git
51
- cd openharness
52
- npm install
53
- npm install -g .
54
- oh
55
- ```
56
-
57
- ## Why OpenHarness?
58
-
59
- 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).
60
-
61
- ## Tools
62
-
63
- | Tool | Risk | Description |
64
- |------|------|-------------|
65
- | Read | low | Read files with line ranges |
66
- | Edit | medium | Search-and-replace edits |
67
- | Write | medium | Create or overwrite files |
68
- | Bash | high | Shell commands with timeout |
69
- | Glob | low | Find files by pattern |
70
- | Grep | low | Regex content search |
71
- | WebFetch | medium | Fetch URL content |
72
-
73
- Low-risk tools auto-approve. Medium and high risk require confirmation in `ask` mode.
74
-
75
- ## Commands
76
-
77
- ```bash
78
- oh # start chatting (default command)
79
- oh --model MODEL # use a specific model
80
- oh --trust # auto-approve all tools
81
- oh --deny # block all non-read tools
82
- oh --resume ID # resume a saved session
83
- oh models # list models and pricing
84
- oh tools # list tools and risk levels
85
- oh init # set up .oh/ for current project
86
- oh sessions # list saved sessions
87
- oh rules # show project rules
88
- oh --version # show version
89
- ```
90
-
91
- ## Providers
92
-
93
- ```bash
94
- # Local (free, no API key)
95
- oh --model ollama/llama3
96
- oh --model ollama/qwen2.5:7b-instruct
97
-
98
- # Cloud (set API key as env var)
99
- OPENAI_API_KEY=sk-... oh --model gpt-4o
100
- ANTHROPIC_API_KEY=sk-ant-... oh --model claude-sonnet-4-6
101
- OPENROUTER_API_KEY=sk-or-... oh --model openrouter/deepseek-chat
102
- ```
103
-
104
- ## Project Rules
105
-
106
- Create `.oh/RULES.md` in any repo (or run `oh init`):
107
-
108
- ```markdown
109
- - Always run tests after changes
110
- - Use strict TypeScript
111
- - Never commit to main directly
112
- ```
113
-
114
- Rules load automatically into every session.
115
-
116
- ## Tech Stack
117
-
118
- | | OpenHarness | Claude Code |
119
- |---|---|---|
120
- | Language | TypeScript (strict) | TypeScript (strict) |
121
- | Runtime | Node.js 18+ | Bun |
122
- | Terminal UI | React + Ink | React + custom Ink fork |
123
- | Tool schemas | Zod | Zod |
124
- | Agent loop | async generators | async generators |
125
- | Providers | Any (5 built-in) | Anthropic only |
126
- | License | MIT | Proprietary |
127
-
128
- ## Development
129
-
130
- ```bash
131
- git clone https://github.com/zhijiewong/openharness.git
132
- cd openharness
133
- npm install
134
- npx tsx src/main.tsx # run in dev mode
135
- npx tsc --noEmit # type check
136
- ```
137
-
138
- ### Adding a provider
139
-
140
- Create `src/providers/yourprovider.ts` implementing the `Provider` interface, add a case in `src/providers/index.ts`.
141
-
142
- ### Adding a tool
143
-
144
- Create `src/tools/YourTool/index.ts` implementing the `Tool` interface with a Zod input schema, register it in `src/tools.ts`.
145
-
146
- ## Contributing
147
-
148
- See [CONTRIBUTING.md](CONTRIBUTING.md).
149
-
150
- ## License
151
-
152
- MIT
153
-
154
- ---
155
-
156
- This project is not affiliated with Anthropic.
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
+ ![Status: Alpha](https://img.shields.io/badge/status-alpha-orange)
17
+ ![Node.js 18+](https://img.shields.io/badge/node-18%2B-green)
18
+ ![TypeScript](https://img.shields.io/badge/typescript-strict-blue)
19
+ ![License: MIT](https://img.shields.io/badge/license-MIT-green)
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
+ <!-- ![Demo](assets/demo.gif) -->
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"}