@kolisachint/hoocode-agent 0.2.0 → 0.2.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/CHANGELOG.md +5 -1
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +11 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +1 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +1 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +24 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +20 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +4 -4
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +2 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +5 -5
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +3 -3
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +1 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/extensions/core/hoo-core.d.ts +16 -4
- package/dist/extensions/core/hoo-core.d.ts.map +1 -1
- package/dist/extensions/core/hoo-core.js +123 -24
- package/dist/extensions/core/hoo-core.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +4 -3
- package/dist/init.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +21 -1
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -1
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts +2 -2
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +2 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +12 -9
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/docs/compaction.md +9 -9
- package/docs/custom-provider.md +4 -4
- package/docs/development.md +6 -6
- package/docs/extensions.md +21 -21
- package/docs/index.md +9 -9
- package/docs/json.md +3 -3
- package/docs/keybindings.md +5 -5
- package/docs/models.md +6 -6
- package/docs/packages.md +37 -37
- package/docs/prompt-templates.md +4 -4
- package/docs/providers.md +12 -44
- package/docs/quickstart.md +28 -28
- package/docs/rpc.md +10 -10
- package/docs/sdk.md +13 -13
- package/docs/session-format.md +7 -7
- package/docs/sessions.md +11 -11
- package/docs/settings.md +14 -14
- package/docs/shell-aliases.md +2 -2
- package/docs/skills.md +10 -10
- package/docs/terminal-setup.md +7 -7
- package/docs/termux.md +6 -6
- package/docs/themes.md +9 -9
- package/docs/tmux.md +3 -3
- package/docs/tui.md +3 -3
- package/docs/usage.md +47 -47
- package/docs/windows.md +2 -2
- package/examples/README.md +1 -1
- package/examples/extensions/README.md +5 -5
- package/examples/extensions/claude-rules.ts +1 -1
- package/examples/extensions/commands.ts +1 -1
- package/examples/extensions/custom-header.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/doom-overlay/README.md +3 -3
- package/examples/extensions/pirate.ts +1 -1
- package/examples/extensions/preset.ts +4 -4
- package/examples/extensions/prompt-customizer.ts +1 -1
- package/examples/extensions/sandbox/index.ts +3 -3
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/README.md +13 -13
- package/examples/extensions/subagent/agents.ts +1 -1
- package/examples/extensions/subagent/index.ts +1 -1
- package/examples/extensions/tools.ts +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/06-extensions.ts +1 -1
- package/examples/sdk/08-prompt-templates.ts +1 -1
- package/examples/sdk/README.md +2 -2
- package/package.json +1 -1
package/docs/compaction.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Compaction & Branch Summarization
|
|
2
2
|
|
|
3
|
-
LLMs have limited context windows. When conversations grow too long,
|
|
3
|
+
LLMs have limited context windows. When conversations grow too long, hoocode uses compaction to summarize older content while preserving recent work. This page covers both auto-compaction and branch summarization.
|
|
4
4
|
|
|
5
5
|
**Source files** ([pi-mono](https://github.com/kolisachint/hoocode)):
|
|
6
6
|
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/kolisachint/hoocode/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
|
|
@@ -13,7 +13,7 @@ For TypeScript definitions in your project, inspect `node_modules/@kolisachint/h
|
|
|
13
13
|
|
|
14
14
|
## Overview
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
HooCode has two summarization mechanisms:
|
|
17
17
|
|
|
18
18
|
| Mechanism | Trigger | Purpose |
|
|
19
19
|
|-----------|---------|---------|
|
|
@@ -32,13 +32,13 @@ Auto-compaction triggers when:
|
|
|
32
32
|
contextTokens > contextWindow - reserveTokens
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
By default, `reserveTokens` is 16384 tokens (configurable in `~/.
|
|
35
|
+
By default, `reserveTokens` is 16384 tokens (configurable in `~/.hoocode/agent/settings.json` or `<project-dir>/.hoocode/settings.json`). This leaves room for the LLM's response.
|
|
36
36
|
|
|
37
37
|
You can also trigger manually with `/compact [instructions]`, where optional instructions focus the summary.
|
|
38
38
|
|
|
39
39
|
### How It Works
|
|
40
40
|
|
|
41
|
-
1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.
|
|
41
|
+
1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.hoocode/agent/settings.json` or `<project-dir>/.hoocode/settings.json`) is reached
|
|
42
42
|
2. **Extract messages**: Collect messages from the previous kept boundary (or session start) up to the cut point
|
|
43
43
|
3. **Generate summary**: Call LLM to summarize with structured format, passing the previous summary as iterative context when present
|
|
44
44
|
4. **Append entry**: Save `CompactionEntry` with summary and `firstKeptEntryId`
|
|
@@ -76,7 +76,7 @@ What the LLM sees:
|
|
|
76
76
|
prompt from cmp messages from firstKeptEntryId
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well.
|
|
79
|
+
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well. HooCode also recalculates `tokensBefore` from the rebuilt session context before writing the new `CompactionEntry`, so the token count reflects the actual pre-compaction context being replaced.
|
|
80
80
|
|
|
81
81
|
### Split Turns
|
|
82
82
|
|
|
@@ -102,7 +102,7 @@ Split turn (one huge turn exceeds budget):
|
|
|
102
102
|
turnPrefixMessages = [usr, ass, tool, ass, tool, tool]
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
For split turns,
|
|
105
|
+
For split turns, hoocode generates two summaries and merges them:
|
|
106
106
|
1. **History summary**: Previous context (if any)
|
|
107
107
|
2. **Turn prefix summary**: The early part of the split turn
|
|
108
108
|
|
|
@@ -148,7 +148,7 @@ See [`prepareCompaction()`](https://github.com/kolisachint/hoocode/blob/main/pac
|
|
|
148
148
|
|
|
149
149
|
### When It Triggers
|
|
150
150
|
|
|
151
|
-
When you use `/tree` to navigate to a different branch,
|
|
151
|
+
When you use `/tree` to navigate to a different branch, hoocode offers to summarize the work you're leaving. This injects context from the left branch into the new branch.
|
|
152
152
|
|
|
153
153
|
### How It Works
|
|
154
154
|
|
|
@@ -177,7 +177,7 @@ After navigation with summary:
|
|
|
177
177
|
|
|
178
178
|
### Cumulative File Tracking
|
|
179
179
|
|
|
180
|
-
Both compaction and branch summarization track files cumulatively. When generating a summary,
|
|
180
|
+
Both compaction and branch summarization track files cumulatively. When generating a summary, hoocode extracts file operations from:
|
|
181
181
|
- Tool calls in the messages being summarized
|
|
182
182
|
- Previous compaction or branch summary `details` (if any)
|
|
183
183
|
|
|
@@ -373,7 +373,7 @@ See `SessionBeforeTreeEvent` and `TreePreparation` in the types file.
|
|
|
373
373
|
|
|
374
374
|
## Settings
|
|
375
375
|
|
|
376
|
-
Configure compaction in `~/.
|
|
376
|
+
Configure compaction in `~/.hoocode/agent/settings.json` or `<project-dir>/.hoocode/settings.json`:
|
|
377
377
|
|
|
378
378
|
```json
|
|
379
379
|
{
|
package/docs/custom-provider.md
CHANGED
|
@@ -59,7 +59,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
The extension factory can also be `async`. For dynamic model discovery, fetch and register models in the factory instead of `session_start`.
|
|
62
|
+
The extension factory can also be `async`. For dynamic model discovery, fetch and register models in the factory instead of `session_start`. hoocode waits for the factory before startup continues, so the provider is available during interactive startup and to `hoocode --list-models`.
|
|
63
63
|
|
|
64
64
|
## Override Existing Provider
|
|
65
65
|
|
|
@@ -208,7 +208,7 @@ models: [{
|
|
|
208
208
|
id: "custom-model",
|
|
209
209
|
// ...
|
|
210
210
|
reasoning: true,
|
|
211
|
-
thinkingLevelMap: { // map
|
|
211
|
+
thinkingLevelMap: { // map hoocode levels to provider values; null hides unsupported levels
|
|
212
212
|
minimal: null,
|
|
213
213
|
low: null,
|
|
214
214
|
medium: null,
|
|
@@ -330,7 +330,7 @@ interface OAuthLoginCallbacks {
|
|
|
330
330
|
|
|
331
331
|
### OAuthCredentials
|
|
332
332
|
|
|
333
|
-
Credentials are persisted in `~/.
|
|
333
|
+
Credentials are persisted in `~/.hoocode/agent/auth.json`:
|
|
334
334
|
|
|
335
335
|
```typescript
|
|
336
336
|
interface OAuthCredentials {
|
|
@@ -602,7 +602,7 @@ interface ProviderModelConfig {
|
|
|
602
602
|
/** Whether the model supports extended thinking. */
|
|
603
603
|
reasoning: boolean;
|
|
604
604
|
|
|
605
|
-
/** Maps
|
|
605
|
+
/** Maps hoocode thinking levels to provider/model-specific values; null marks a level unsupported. */
|
|
606
606
|
thinkingLevelMap?: Partial<Record<"off" | "minimal" | "low" | "medium" | "high" | "xhigh", string | null>>;
|
|
607
607
|
|
|
608
608
|
/** Supported input types. */
|
package/docs/development.md
CHANGED
|
@@ -6,7 +6,7 @@ See [AGENTS.md](../../../AGENTS.md) for additional guidelines.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
git clone https://github.com/kolisachint/hoocode
|
|
9
|
-
cd
|
|
9
|
+
cd hoocode
|
|
10
10
|
npm install
|
|
11
11
|
npm run build
|
|
12
12
|
```
|
|
@@ -14,10 +14,10 @@ npm run build
|
|
|
14
14
|
Run from source:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
/path/to/
|
|
17
|
+
/path/to/hoocode/hoocode-test.sh
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
The script can be run from any directory.
|
|
20
|
+
The script can be run from any directory. HooCode keeps the caller's current working directory.
|
|
21
21
|
|
|
22
22
|
## Forking / Rebranding
|
|
23
23
|
|
|
@@ -26,8 +26,8 @@ Configure via `package.json`:
|
|
|
26
26
|
```json
|
|
27
27
|
{
|
|
28
28
|
"piConfig": {
|
|
29
|
-
"name": "
|
|
30
|
-
"configDir": ".
|
|
29
|
+
"name": "hoocode",
|
|
30
|
+
"configDir": ".hoocode"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
```
|
|
@@ -48,7 +48,7 @@ Never use `__dirname` directly for package assets.
|
|
|
48
48
|
|
|
49
49
|
## Debug Command
|
|
50
50
|
|
|
51
|
-
`/debug` (hidden) writes to `~/.
|
|
51
|
+
`/debug` (hidden) writes to `~/.hoocode/agent/hoocode-debug.log`:
|
|
52
52
|
- Rendered TUI lines with ANSI codes
|
|
53
53
|
- Last messages sent to the LLM
|
|
54
54
|
|
package/docs/extensions.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
>
|
|
1
|
+
> hoocode can create extensions. Ask it to build one for your use case.
|
|
2
2
|
|
|
3
3
|
# Extensions
|
|
4
4
|
|
|
5
|
-
Extensions are TypeScript modules that extend
|
|
5
|
+
Extensions are TypeScript modules that extend hoocode's behavior. They can subscribe to lifecycle events, register custom tools callable by the LLM, add commands, and more.
|
|
6
6
|
|
|
7
|
-
> **Placement for /reload:** Put extensions in `~/.
|
|
7
|
+
> **Placement for /reload:** Put extensions in `~/.hoocode/agent/extensions/` (global) or `.hoocode/extensions/` (project-local) for auto-discovery. Use `hoocode -e ./path.ts` only for quick tests. Extensions in auto-discovered locations can be hot-reloaded with `/reload`.
|
|
8
8
|
|
|
9
9
|
**Key capabilities:**
|
|
10
10
|
- **Custom tools** - Register tools the LLM can call via `pi.registerTool()`
|
|
@@ -102,7 +102,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
102
102
|
Test with `--extension` (or `-e`) flag:
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
|
-
|
|
105
|
+
hoocode -e ./my-extension.ts
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
## Extension Locations
|
|
@@ -133,7 +133,7 @@ Additional paths via `settings.json`:
|
|
|
133
133
|
}
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
To share extensions via npm or git as
|
|
136
|
+
To share extensions via npm or git as hoocode packages, see [packages.md](packages.md).
|
|
137
137
|
|
|
138
138
|
## Available Imports
|
|
139
139
|
|
|
@@ -146,7 +146,7 @@ To share extensions via npm or git as pi packages, see [packages.md](packages.md
|
|
|
146
146
|
|
|
147
147
|
npm dependencies work too. Add a `package.json` next to your extension (or in a parent directory), run `npm install`, and imports from `node_modules/` are resolved automatically.
|
|
148
148
|
|
|
149
|
-
For distributed
|
|
149
|
+
For distributed hoocode packages installed with `hoocode install` (npm or git), runtime deps must be in `dependencies`. Package installation uses production installs (`npm install --omit=dev`) by default, so `devDependencies` are not available at runtime; when `npmCommand` is configured, git packages use plain `install` for compatibility with wrappers.
|
|
150
150
|
|
|
151
151
|
Node.js built-ins (`node:fs`, `node:path`, etc.) are also available.
|
|
152
152
|
|
|
@@ -214,7 +214,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
214
214
|
}
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
This pattern makes the fetched models available during normal startup and to `
|
|
217
|
+
This pattern makes the fetched models available during normal startup and to `hoocode --list-models`.
|
|
218
218
|
|
|
219
219
|
### Extension Styles
|
|
220
220
|
|
|
@@ -268,7 +268,7 @@ Run `npm install` in the extension directory, then imports from `node_modules/`
|
|
|
268
268
|
### Lifecycle Overview
|
|
269
269
|
|
|
270
270
|
```
|
|
271
|
-
|
|
271
|
+
hoocode starts
|
|
272
272
|
│
|
|
273
273
|
├─► session_start { reason: "startup" }
|
|
274
274
|
└─► resources_discover { reason: "startup" }
|
|
@@ -385,7 +385,7 @@ pi.on("session_before_switch", async (event, ctx) => {
|
|
|
385
385
|
});
|
|
386
386
|
```
|
|
387
387
|
|
|
388
|
-
After a successful switch or new-session action,
|
|
388
|
+
After a successful switch or new-session action, hoocode emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "new" | "resume"` and `previousSessionFile`.
|
|
389
389
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
390
390
|
|
|
391
391
|
#### session_before_fork
|
|
@@ -402,7 +402,7 @@ pi.on("session_before_fork", async (event, ctx) => {
|
|
|
402
402
|
});
|
|
403
403
|
```
|
|
404
404
|
|
|
405
|
-
After a successful fork or clone,
|
|
405
|
+
After a successful fork or clone, hoocode emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "fork"` and `previousSessionFile`.
|
|
406
406
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
407
407
|
|
|
408
408
|
#### session_before_compact / session_compact
|
|
@@ -675,7 +675,7 @@ Use this to update extension UI when `pi.setThinkingLevel()`, model changes, or
|
|
|
675
675
|
|
|
676
676
|
Fired after `tool_execution_start`, before the tool executes. **Can block.** Use `isToolCallEventType` to narrow and get typed inputs.
|
|
677
677
|
|
|
678
|
-
Before `tool_call` runs,
|
|
678
|
+
Before `tool_call` runs, hoocode waits for previously emitted Agent events to finish draining through `AgentSession`. This means `ctx.sessionManager` is up to date through the current assistant tool-calling message.
|
|
679
679
|
|
|
680
680
|
In the default parallel tool execution mode, sibling tool calls from the same assistant message are preflighted sequentially, then executed concurrently. `tool_call` is not guaranteed to see sibling tool results from that same assistant message in `ctx.sessionManager`.
|
|
681
681
|
|
|
@@ -786,7 +786,7 @@ pi.on("user_bash", (event, ctx) => {
|
|
|
786
786
|
// Option 1: Provide custom operations (e.g., SSH)
|
|
787
787
|
return { operations: remoteBashOps };
|
|
788
788
|
|
|
789
|
-
// Option 2: Wrap
|
|
789
|
+
// Option 2: Wrap hoocode's built-in local bash backend
|
|
790
790
|
const local = createLocalBashOperations();
|
|
791
791
|
return {
|
|
792
792
|
operations: {
|
|
@@ -891,7 +891,7 @@ Use this for abort-aware nested work started by extension handlers, for example:
|
|
|
891
891
|
- file or process helpers that accept `AbortSignal`
|
|
892
892
|
|
|
893
893
|
`ctx.signal` is typically defined during active turn events such as `tool_call`, `tool_result`, `message_update`, and `turn_end`.
|
|
894
|
-
It is usually `undefined` in idle or non-turn contexts such as session events, extension commands, and shortcuts fired while
|
|
894
|
+
It is usually `undefined` in idle or non-turn contexts such as session events, extension commands, and shortcuts fired while hoocode is idle.
|
|
895
895
|
|
|
896
896
|
```typescript
|
|
897
897
|
pi.on("tool_result", async (event, ctx) => {
|
|
@@ -912,7 +912,7 @@ Control flow helpers.
|
|
|
912
912
|
|
|
913
913
|
### ctx.shutdown()
|
|
914
914
|
|
|
915
|
-
Request a graceful shutdown of
|
|
915
|
+
Request a graceful shutdown of hoocode.
|
|
916
916
|
|
|
917
917
|
- **Interactive mode:** Deferred until the agent becomes idle (after processing all queued steering and follow-up messages).
|
|
918
918
|
- **RPC mode:** Deferred until the next idle state (after completing the current command response, when waiting for the next command).
|
|
@@ -1373,7 +1373,7 @@ Labels persist in the session and survive restarts. Use them to mark important p
|
|
|
1373
1373
|
|
|
1374
1374
|
Register a command.
|
|
1375
1375
|
|
|
1376
|
-
If multiple extensions register the same command name,
|
|
1376
|
+
If multiple extensions register the same command name, hoocode keeps them all and assigns numeric invocation suffixes in load order, for example `/review:1` and `/review:2`.
|
|
1377
1377
|
|
|
1378
1378
|
```typescript
|
|
1379
1379
|
pi.registerCommand("stats", {
|
|
@@ -1544,7 +1544,7 @@ Register or override a model provider dynamically. Useful for proxies, custom en
|
|
|
1544
1544
|
|
|
1545
1545
|
Calls made during the extension factory function are queued and applied once the runner initialises. Calls made after that — for example from a command handler following a user setup flow — take effect immediately without requiring a `/reload`.
|
|
1546
1546
|
|
|
1547
|
-
If you need to discover models from a remote endpoint, prefer an async extension factory over deferring the fetch to `session_start`.
|
|
1547
|
+
If you need to discover models from a remote endpoint, prefer an async extension factory over deferring the fetch to `session_start`. hoocode waits for the factory before startup continues, so the registered models are available immediately, including to `hoocode --list-models`.
|
|
1548
1548
|
|
|
1549
1549
|
```typescript
|
|
1550
1550
|
// Register a new provider with custom models
|
|
@@ -1774,7 +1774,7 @@ async execute(toolCallId, params) {
|
|
|
1774
1774
|
|
|
1775
1775
|
**Important:** Use `StringEnum` from `@kolisachint/hoocode-ai` for string enums. `Type.Union`/`Type.Literal` doesn't work with Google's API.
|
|
1776
1776
|
|
|
1777
|
-
**Argument preparation:** `prepareArguments(args)` is optional. If defined, it runs before schema validation and before `execute()`. Use it to mimic an older accepted input shape when
|
|
1777
|
+
**Argument preparation:** `prepareArguments(args)` is optional. If defined, it runs before schema validation and before `execute()`. Use it to mimic an older accepted input shape when hoocode resumes an older session whose stored tool call arguments no longer match the current schema. Return the object you want validated against `parameters`. Keep the public schema strict. Do not add deprecated compatibility fields to `parameters` just to keep old resumed sessions working.
|
|
1778
1778
|
|
|
1779
1779
|
Example: an older session may contain an `edit` tool call with top-level `oldText` and `newText`, while the current schema only accepts `edits: [{ oldText, newText }]`.
|
|
1780
1780
|
|
|
@@ -1827,13 +1827,13 @@ Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`,
|
|
|
1827
1827
|
|
|
1828
1828
|
```bash
|
|
1829
1829
|
# Extension's read tool replaces built-in read
|
|
1830
|
-
|
|
1830
|
+
hoocode -e ./tool-override.ts
|
|
1831
1831
|
```
|
|
1832
1832
|
|
|
1833
1833
|
Alternatively, use `--no-builtin-tools` to start without any built-in tools while keeping extension tools enabled:
|
|
1834
1834
|
```bash
|
|
1835
1835
|
# No built-in tools, only extension tools
|
|
1836
|
-
|
|
1836
|
+
hoocode --no-builtin-tools -e ./my-extension.ts
|
|
1837
1837
|
```
|
|
1838
1838
|
|
|
1839
1839
|
See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.ts) for a complete example that overrides `read` with logging and access control.
|
|
@@ -1884,7 +1884,7 @@ pi.registerTool({
|
|
|
1884
1884
|
|
|
1885
1885
|
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
|
1886
1886
|
|
|
1887
|
-
For `user_bash`, extensions can reuse
|
|
1887
|
+
For `user_bash`, extensions can reuse hoocode's local shell backend via `createLocalBashOperations()` instead of reimplementing local process spawning, shell resolution, and process-tree termination.
|
|
1888
1888
|
|
|
1889
1889
|
The bash tool also supports a spawn hook to adjust the command, cwd, or env before execution:
|
|
1890
1890
|
|
|
@@ -2223,7 +2223,7 @@ ctx.ui.setFooter((tui, theme) => ({
|
|
|
2223
2223
|
ctx.ui.setFooter(undefined); // Restore built-in footer
|
|
2224
2224
|
|
|
2225
2225
|
// Terminal title
|
|
2226
|
-
ctx.ui.setTitle("
|
|
2226
|
+
ctx.ui.setTitle("hoocode - my-project");
|
|
2227
2227
|
|
|
2228
2228
|
// Editor text
|
|
2229
2229
|
ctx.ui.setEditorText("Prefill text");
|
package/docs/index.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# HooCode Documentation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
HooCode is a minimal terminal coding harness. It is designed to stay small at the core while being extended through TypeScript extensions, skills, prompt templates, themes, and hoocode packages.
|
|
4
4
|
|
|
5
5
|
## Quick start
|
|
6
6
|
|
|
7
|
-
On linux or mac you can install
|
|
7
|
+
On linux or mac you can install HooCode with curl:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
curl -fsSL https://
|
|
10
|
+
curl -fsSL https://hoocode.dev/install.sh | sh
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Or alternatively with npm:
|
|
@@ -19,17 +19,17 @@ npm install -g @kolisachint/hoocode-agent
|
|
|
19
19
|
Then run it in a project directory:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
|
|
22
|
+
hoocode
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Authenticate with `/login` for subscription providers, or set an API key such as `ANTHROPIC_API_KEY` before starting
|
|
25
|
+
Authenticate with `/login` for subscription providers, or set an API key such as `ANTHROPIC_API_KEY` before starting hoocode.
|
|
26
26
|
|
|
27
27
|
For the full first-run flow, see [Quickstart](quickstart.md).
|
|
28
28
|
|
|
29
29
|
## Start here
|
|
30
30
|
|
|
31
31
|
- [Quickstart](quickstart.md) - install, authenticate, and run a first session.
|
|
32
|
-
- [Using
|
|
32
|
+
- [Using HooCode](usage.md) - interactive mode, slash commands, context files, and CLI reference.
|
|
33
33
|
- [Providers](providers.md) - subscription and API-key setup for built-in providers.
|
|
34
34
|
- [Settings](settings.md) - global and project settings.
|
|
35
35
|
- [Keybindings](keybindings.md) - default shortcuts and custom keybindings.
|
|
@@ -42,13 +42,13 @@ For the full first-run flow, see [Quickstart](quickstart.md).
|
|
|
42
42
|
- [Skills](skills.md) - Agent Skills for reusable on-demand capabilities.
|
|
43
43
|
- [Prompt templates](prompt-templates.md) - reusable prompts that expand from slash commands.
|
|
44
44
|
- [Themes](themes.md) - built-in and custom terminal themes.
|
|
45
|
-
- [
|
|
45
|
+
- [HooCode packages](packages.md) - bundle and share extensions, skills, prompts, and themes.
|
|
46
46
|
- [Custom models](models.md) - add model entries for supported provider APIs.
|
|
47
47
|
- [Custom providers](custom-provider.md) - implement custom APIs and OAuth flows.
|
|
48
48
|
|
|
49
49
|
## Programmatic usage
|
|
50
50
|
|
|
51
|
-
- [SDK](sdk.md) - embed
|
|
51
|
+
- [SDK](sdk.md) - embed hoocode in Node.js applications.
|
|
52
52
|
- [RPC mode](rpc.md) - integrate over stdin/stdout JSONL.
|
|
53
53
|
- [JSON event stream mode](json.md) - print mode with structured events.
|
|
54
54
|
- [TUI components](tui.md) - build custom terminal UI for extensions.
|
package/docs/json.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# JSON Event Stream Mode
|
|
2
2
|
|
|
3
3
|
```bash
|
|
4
|
-
|
|
4
|
+
hoocode --mode json "Your prompt"
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
Outputs all session events as JSON lines to stdout. Useful for integrating
|
|
7
|
+
Outputs all session events as JSON lines to stdout. Useful for integrating hoocode into other tools or custom UIs.
|
|
8
8
|
|
|
9
9
|
## Event Types
|
|
10
10
|
|
|
@@ -78,5 +78,5 @@ Followed by events as they occur:
|
|
|
78
78
|
## Example
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
|
|
81
|
+
hoocode --mode json "List files" 2>/dev/null | jq -c 'select(.type == "message_end")'
|
|
82
82
|
```
|
package/docs/keybindings.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Keybindings
|
|
2
2
|
|
|
3
|
-
All keyboard shortcuts can be customized via `~/.
|
|
3
|
+
All keyboard shortcuts can be customized via `~/.hoocode/agent/keybindings.json`. Each action can be bound to one or more keys.
|
|
4
4
|
|
|
5
|
-
The config file uses the same namespaced keybinding ids that
|
|
5
|
+
The config file uses the same namespaced keybinding ids that hoocode uses internally and that extension authors use in `keyHint()` and injected `keybindings` managers.
|
|
6
6
|
|
|
7
7
|
Older configs using pre-namespaced ids such as `cursorUp` or `expandTools` are migrated automatically to the namespaced ids on startup.
|
|
8
8
|
|
|
9
|
-
After editing `keybindings.json`, run `/reload` in
|
|
9
|
+
After editing `keybindings.json`, run `/reload` in hoocode to apply the changes without restarting the session.
|
|
10
10
|
|
|
11
11
|
## Key Format
|
|
12
12
|
|
|
@@ -153,7 +153,7 @@ Used inside the scoped models selector (opened via `/scoped-models`).
|
|
|
153
153
|
|
|
154
154
|
## Custom Configuration
|
|
155
155
|
|
|
156
|
-
Create `~/.
|
|
156
|
+
Create `~/.hoocode/agent/keybindings.json`:
|
|
157
157
|
|
|
158
158
|
```json
|
|
159
159
|
{
|
|
@@ -165,7 +165,7 @@ Create `~/.pi/agent/keybindings.json`:
|
|
|
165
165
|
|
|
166
166
|
Each action can have a single key or an array of keys. User config overrides defaults.
|
|
167
167
|
|
|
168
|
-
On native Windows, `app.suspend` has no default binding because Windows terminals do not support Unix job control. If you bind it manually,
|
|
168
|
+
On native Windows, `app.suspend` has no default binding because Windows terminals do not support Unix job control. If you bind it manually, hoocode shows a status message instead of suspending. In WSL, the normal Linux `ctrl+z`/`fg` behavior still applies.
|
|
169
169
|
|
|
170
170
|
### Emacs Example
|
|
171
171
|
|
package/docs/models.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Custom Models
|
|
2
2
|
|
|
3
|
-
Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.
|
|
3
|
+
Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.hoocode/agent/models.json`.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
@@ -36,7 +36,7 @@ For local models (Ollama, LM Studio, vLLM), only `id` is required per model:
|
|
|
36
36
|
|
|
37
37
|
The `apiKey` is required but Ollama ignores it, so any value works.
|
|
38
38
|
|
|
39
|
-
Some OpenAI-compatible servers do not understand the `developer` role used for reasoning-capable models. For those providers, set `compat.supportsDeveloperRole` to `false` so
|
|
39
|
+
Some OpenAI-compatible servers do not understand the `developer` role used for reasoning-capable models. For those providers, set `compat.supportsDeveloperRole` to `false` so hoocode sends the system prompt as a `system` message instead. If the server also does not support `reasoning_effort`, set `compat.supportsReasoningEffort` to `false` too.
|
|
40
40
|
|
|
41
41
|
You can set `compat` at the provider level to apply to all models, or at the model level to override a specific model. This commonly applies to Ollama, vLLM, SGLang, and similar OpenAI-compatible servers.
|
|
42
42
|
|
|
@@ -159,7 +159,7 @@ The `apiKey` and `headers` fields support three formats:
|
|
|
159
159
|
"apiKey": "sk-..."
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
For `models.json`, shell commands are resolved at request time.
|
|
162
|
+
For `models.json`, shell commands are resolved at request time. hoocode intentionally does not apply built-in TTL, stale reuse, or recovery logic for arbitrary commands. Different commands need different caching and failure strategies, and hoocode cannot infer the right one.
|
|
163
163
|
|
|
164
164
|
If your command is slow, expensive, rate-limited, or should keep using a previous value on transient failures, wrap it in your own script or command that implements the caching or TTL behavior you want.
|
|
165
165
|
|
|
@@ -192,7 +192,7 @@ If your command is slow, expensive, rate-limited, or should keep using a previou
|
|
|
192
192
|
| `name` | No | `id` | Human-readable model label. Used for matching (`--model` patterns) and shown in model details/status text. |
|
|
193
193
|
| `api` | No | provider's `api` | Override provider's API for this model |
|
|
194
194
|
| `reasoning` | No | `false` | Supports extended thinking |
|
|
195
|
-
| `thinkingLevelMap` | No | omitted | Maps
|
|
195
|
+
| `thinkingLevelMap` | No | omitted | Maps hoocode thinking levels to provider values and marks unsupported levels (see below) |
|
|
196
196
|
| `input` | No | `["text"]` | Input types: `["text"]` or `["text", "image"]` |
|
|
197
197
|
| `contextWindow` | No | `128000` | Context window size in tokens |
|
|
198
198
|
| `maxTokens` | No | `16384` | Maximum output tokens |
|
|
@@ -205,7 +205,7 @@ Current behavior:
|
|
|
205
205
|
|
|
206
206
|
### Thinking Level Map
|
|
207
207
|
|
|
208
|
-
Use `thinkingLevelMap` on a model to describe model-specific thinking controls. Keys are
|
|
208
|
+
Use `thinkingLevelMap` on a model to describe model-specific thinking controls. Keys are hoocode thinking levels: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`.
|
|
209
209
|
|
|
210
210
|
Values are tristate:
|
|
211
211
|
|
|
@@ -317,7 +317,7 @@ Behavior notes:
|
|
|
317
317
|
|
|
318
318
|
For providers or proxies using `api: "anthropic-messages"`, use `compat.supportsEagerToolInputStreaming` to control Anthropic fine-grained tool streaming compatibility.
|
|
319
319
|
|
|
320
|
-
By default
|
|
320
|
+
By default hoocode sends per-tool `eager_input_streaming: true`. If a proxy or Anthropic-compatible backend rejects that field, set `supportsEagerToolInputStreaming` to `false`. HooCode will omit `tools[].eager_input_streaming` and send the legacy `fine-grained-tool-streaming-2025-05-14` beta header for tool-enabled requests instead.
|
|
321
321
|
|
|
322
322
|
```json
|
|
323
323
|
{
|