@dreb/coding-agent 2.34.1 → 2.34.3
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 +2 -0
- package/dist/core/buddy/buddy-controller.d.ts +35 -1
- package/dist/core/buddy/buddy-controller.d.ts.map +1 -1
- package/dist/core/buddy/buddy-controller.js +65 -4
- package/dist/core/buddy/buddy-controller.js.map +1 -1
- package/dist/core/buddy/buddy-manager.d.ts +6 -0
- package/dist/core/buddy/buddy-manager.d.ts.map +1 -1
- package/dist/core/buddy/buddy-manager.js +25 -2
- package/dist/core/buddy/buddy-manager.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +18 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/buddy.md +9 -1
- package/docs/tui.md +7 -7
- package/package.json +1 -1
package/docs/buddy.md
CHANGED
|
@@ -33,7 +33,7 @@ The buddy won't react until a model is configured. The choice is persisted acros
|
|
|
33
33
|
| `/buddy pet` | Pet your buddy |
|
|
34
34
|
| `/buddy reroll` | Reroll for a new buddy (new species, name, personality) |
|
|
35
35
|
| `/buddy stats` | Show buddy stats panel |
|
|
36
|
-
| `/buddy off` | Hide the buddy (persists across sessions
|
|
36
|
+
| `/buddy off` | Hide the buddy (persists across sessions, and syncs to any other dreb instance running concurrently — see [Persistence & multiple instances](#persistence--multiple-instances)) |
|
|
37
37
|
|
|
38
38
|
## How It Works
|
|
39
39
|
|
|
@@ -42,6 +42,14 @@ The buddy won't react until a model is configured. The choice is persisted acros
|
|
|
42
42
|
- **Reactions** are generated by the local Ollama model — short, in-character quips based on what just happened
|
|
43
43
|
- **Activity indicator** shows "thinking..." in the buddy panel while waiting for Ollama to respond
|
|
44
44
|
|
|
45
|
+
## Persistence & multiple instances
|
|
46
|
+
|
|
47
|
+
The buddy's state — including whether it's hidden via `/buddy off` — lives in a shared file at `~/.dreb/agent/buddy.json`. All dreb instances on the machine (multiple TUIs, and the Telegram bridge) read and write the same file.
|
|
48
|
+
|
|
49
|
+
Because the state is shared, `/buddy off` (and bringing the buddy back with `/buddy`) **converges across every concurrently-running instance**: each instance re-checks the persisted flag at turn boundaries (when you send a message and when the agent finishes responding), so a buddy you hide in one terminal disappears from the others within one interaction — no restart required. Deleting `~/.dreb/agent/buddy.json` removes the buddy entirely on the next interaction everywhere.
|
|
50
|
+
|
|
51
|
+
> Note: convergence happens on the next interaction in each instance, not instantly while an instance sits completely idle.
|
|
52
|
+
|
|
45
53
|
## Troubleshooting
|
|
46
54
|
|
|
47
55
|
### Buddy never reacts / always shows fallback message
|
package/docs/tui.md
CHANGED
|
@@ -21,12 +21,12 @@ interface Component {
|
|
|
21
21
|
|
|
22
22
|
| Method | Description |
|
|
23
23
|
|--------|-------------|
|
|
24
|
-
| `render(width)` | Return array of strings
|
|
24
|
+
| `render(width)` | Return array of strings, one logical line per entry. Entries **must not contain raw `\n` or `\r`**; split multi-line content into separate entries. Each unmarked line **must not exceed `width`**. |
|
|
25
25
|
| `handleInput?(data)` | Receive keyboard input when component has focus. |
|
|
26
26
|
| `wantsKeyRelease?` | If true, component receives key release events (Kitty protocol). Default: false. |
|
|
27
27
|
| `invalidate()` | Clear cached render state. Called on theme changes. |
|
|
28
28
|
|
|
29
|
-
The TUI appends a full SGR reset and OSC 8 reset at the end of each rendered line. Styles do not carry across lines. If you emit multi-line text with styling, reapply styles per line or use `wrapTextWithAnsi()` so styles are preserved for each wrapped line.
|
|
29
|
+
The TUI appends a full SGR reset and OSC 8 reset at the end of each rendered line. Styles do not carry across lines. If you emit multi-line text with styling, split it into separate render entries and reapply styles per line, or use `wrapTextWithAnsi()` so styles are preserved for each wrapped line.
|
|
30
30
|
|
|
31
31
|
## Focusable Interface (IME Support)
|
|
32
32
|
|
|
@@ -287,21 +287,21 @@ handleInput(data: string) {
|
|
|
287
287
|
|
|
288
288
|
## Line Width
|
|
289
289
|
|
|
290
|
-
**Critical:** Each
|
|
290
|
+
**Critical:** Each entry from `render()` must represent one logical line and must not contain raw `\n` or `\r`. Split multi-line content before returning it. Unmarked lines must not exceed the `width` parameter.
|
|
291
291
|
|
|
292
292
|
```typescript
|
|
293
|
-
import { visibleWidth, truncateToWidth } from "@dreb/tui";
|
|
293
|
+
import { visibleWidth, truncateToWidth, wrapTextWithAnsi } from "@dreb/tui";
|
|
294
294
|
|
|
295
295
|
render(width: number): string[] {
|
|
296
|
-
//
|
|
297
|
-
return
|
|
296
|
+
// Split styled multi-line content into separate render entries.
|
|
297
|
+
return wrapTextWithAnsi(this.text.replace(/\r\n?/g, "\n"), width);
|
|
298
298
|
}
|
|
299
299
|
```
|
|
300
300
|
|
|
301
301
|
Utilities:
|
|
302
302
|
- `visibleWidth(str)` - Get display width (ignores ANSI codes)
|
|
303
303
|
- `truncateToWidth(str, width, ellipsis?)` - Truncate with optional ellipsis
|
|
304
|
-
- `wrapTextWithAnsi(str, width)` - Word wrap preserving ANSI codes
|
|
304
|
+
- `wrapTextWithAnsi(str, width)` - Word wrap preserving ANSI codes and splitting on raw line breaks
|
|
305
305
|
|
|
306
306
|
## Creating Custom Components
|
|
307
307
|
|