bernard-agent 0.6.2 → 0.8.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/README.md +118 -52
- package/dist/agent.d.ts +7 -4
- package/dist/agent.js +120 -137
- package/dist/agent.js.map +1 -1
- package/dist/config.d.ts +19 -1
- package/dist/config.js +85 -13
- package/dist/config.js.map +1 -1
- package/dist/critic.d.ts +32 -0
- package/dist/critic.js +118 -0
- package/dist/critic.js.map +1 -0
- package/dist/cron/runner.js +54 -34
- package/dist/cron/runner.js.map +1 -1
- package/dist/output.d.ts +6 -4
- package/dist/output.js +31 -10
- package/dist/output.js.map +1 -1
- package/dist/overlap-checker.d.ts +61 -0
- package/dist/overlap-checker.js +106 -0
- package/dist/overlap-checker.js.map +1 -0
- package/dist/pac.d.ts +37 -0
- package/dist/pac.js +69 -0
- package/dist/pac.js.map +1 -0
- package/dist/rag-query.js +2 -1
- package/dist/rag-query.js.map +1 -1
- package/dist/rag-worker.js +4 -3
- package/dist/rag-worker.js.map +1 -1
- package/dist/repl.js +281 -92
- package/dist/repl.js.map +1 -1
- package/dist/specialist-candidates.d.ts +13 -0
- package/dist/specialist-candidates.js.map +1 -1
- package/dist/specialist-detector.d.ts +20 -5
- package/dist/specialist-detector.js +72 -9
- package/dist/specialist-detector.js.map +1 -1
- package/dist/specialist-matcher.d.ts +5 -0
- package/dist/specialist-matcher.js +1 -0
- package/dist/specialist-matcher.js.map +1 -1
- package/dist/specialists.d.ts +7 -3
- package/dist/specialists.js +28 -3
- package/dist/specialists.js.map +1 -1
- package/dist/tools/datetime.d.ts +6 -0
- package/dist/tools/datetime.js +38 -1
- package/dist/tools/datetime.js.map +1 -1
- package/dist/tools/file.d.ts +154 -0
- package/dist/tools/file.js +396 -0
- package/dist/tools/file.js.map +1 -0
- package/dist/tools/index.d.ts +3 -1
- package/dist/tools/index.js +5 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/mcp-url.js +1 -1
- package/dist/tools/mcp-url.js.map +1 -1
- package/dist/tools/shell.js +1 -1
- package/dist/tools/shell.js.map +1 -1
- package/dist/tools/specialist-run.d.ts +9 -1
- package/dist/tools/specialist-run.js +60 -14
- package/dist/tools/specialist-run.js.map +1 -1
- package/dist/tools/specialist.d.ts +10 -1
- package/dist/tools/specialist.js +57 -6
- package/dist/tools/specialist.js.map +1 -1
- package/dist/tools/subagent.d.ts +9 -1
- package/dist/tools/subagent.js +57 -14
- package/dist/tools/subagent.js.map +1 -1
- package/dist/tools/task.d.ts +52 -13
- package/dist/tools/task.js +96 -30
- package/dist/tools/task.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ A local CLI AI agent that executes terminal commands, manages scheduled tasks, r
|
|
|
19
19
|
- [Tools](#tools)
|
|
20
20
|
- [Shell Execution](#shell-execution)
|
|
21
21
|
- [Web Reading](#web-reading)
|
|
22
|
+
- [File Editing](#file-editing)
|
|
22
23
|
- [Memory (Persistent)](#memory-persistent)
|
|
23
24
|
- [Scratch Notes (Session)](#scratch-notes-session)
|
|
24
25
|
- [Date and Time](#date-and-time)
|
|
@@ -128,19 +129,22 @@ bernard providers
|
|
|
128
129
|
|
|
129
130
|
Bernard loads `.env` from the current directory first, then falls back to `~/.bernard/.env`.
|
|
130
131
|
|
|
131
|
-
| Variable
|
|
132
|
-
|
|
|
133
|
-
| `BERNARD_PROVIDER`
|
|
134
|
-
| `BERNARD_MODEL`
|
|
135
|
-
| `BERNARD_MAX_TOKENS`
|
|
136
|
-
| `BERNARD_SHELL_TIMEOUT`
|
|
137
|
-
| `BERNARD_TOKEN_WINDOW`
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
143
|
-
| `
|
|
132
|
+
| Variable | Description | Default |
|
|
133
|
+
| --------------------------------- | -------------------------------------------------------- | ------------------------- |
|
|
134
|
+
| `BERNARD_PROVIDER` | LLM provider (`anthropic`, `openai`, `xai`) | `anthropic` |
|
|
135
|
+
| `BERNARD_MODEL` | Model name | Provider-specific default |
|
|
136
|
+
| `BERNARD_MAX_TOKENS` | Max response tokens | `4096` |
|
|
137
|
+
| `BERNARD_SHELL_TIMEOUT` | Shell command timeout (ms) | `30000` |
|
|
138
|
+
| `BERNARD_TOKEN_WINDOW` | Context window size for compression (0 = auto-detect) | `0` |
|
|
139
|
+
| `BERNARD_MAX_STEPS` | Max agent loop iterations per request | `25` |
|
|
140
|
+
| `BERNARD_RAG_ENABLED` | Enable the RAG memory system | `true` |
|
|
141
|
+
| `BERNARD_CRITIC_MODE` | Enable critic mode for response verification | `false` |
|
|
142
|
+
| `BERNARD_AUTO_CREATE_SPECIALISTS` | Auto-create specialists above confidence threshold | `false` |
|
|
143
|
+
| `BERNARD_AUTO_CREATE_THRESHOLD` | Confidence threshold for auto-creating specialists (0-1) | `0.8` |
|
|
144
|
+
| `BERNARD_DEBUG` | Enable debug logging | unset |
|
|
145
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key | — |
|
|
146
|
+
| `OPENAI_API_KEY` | OpenAI API key | — |
|
|
147
|
+
| `XAI_API_KEY` | xAI API key | — |
|
|
144
148
|
|
|
145
149
|
### Providers and Models
|
|
146
150
|
|
|
@@ -156,11 +160,12 @@ You can switch providers and models at any time during a session with `/provider
|
|
|
156
160
|
|
|
157
161
|
Options can be changed during a session with `/options` or persisted to `~/.bernard/preferences.json`:
|
|
158
162
|
|
|
159
|
-
| Option | Default | Description
|
|
160
|
-
| --------------- | ------- |
|
|
161
|
-
| `max-tokens` | `4096` | Maximum tokens per AI response
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
163
|
+
| Option | Default | Description |
|
|
164
|
+
| --------------- | ------- | ------------------------------------------------------------ |
|
|
165
|
+
| `max-tokens` | `4096` | Maximum tokens per AI response |
|
|
166
|
+
| `max-steps` | `25` | Maximum agent loop iterations per request (tool call chains) |
|
|
167
|
+
| `shell-timeout` | `30000` | Shell command timeout in milliseconds |
|
|
168
|
+
| `token-window` | `0` | Context window size for compression (0 = auto-detect) |
|
|
164
169
|
|
|
165
170
|
From the CLI:
|
|
166
171
|
|
|
@@ -224,28 +229,30 @@ Features:
|
|
|
224
229
|
|
|
225
230
|
### REPL Slash Commands
|
|
226
231
|
|
|
227
|
-
| Command | Description
|
|
228
|
-
| ----------------- |
|
|
229
|
-
| `/help` | Show available commands
|
|
230
|
-
| `/clear` | Clear conversation history and scratch notes
|
|
231
|
-
| `/compact` | Compress conversation history in-place
|
|
232
|
-
| `/task` | Run an isolated task (no history, structured output)
|
|
233
|
-
| `/memory` | List all persistent memories
|
|
234
|
-
| `/scratch` | List session scratch notes
|
|
235
|
-
| `/mcp` | List connected MCP servers and their tools
|
|
236
|
-
| `/cron` | Show cron jobs and daemon status
|
|
237
|
-
| `/rag` | Show RAG memory stats and recent facts
|
|
238
|
-
| `/provider` | Switch LLM provider interactively
|
|
239
|
-
| `/model` | Switch model for the current provider
|
|
240
|
-
| `/theme` | Switch color theme
|
|
241
|
-
| `/routines` | List saved routines
|
|
242
|
-
| `/create-routine` | Create a routine with guided AI assistance
|
|
243
|
-
| `/create-task` | Create a task routine (`task-` prefixed) with guided AI assistance
|
|
244
|
-
| `/specialists` | List saved specialists
|
|
245
|
-
| `/candidates` | Review auto-detected specialist suggestions _(v0.6.0+)_
|
|
246
|
-
| `/critic` | Toggle critic mode for response verification (on/off)
|
|
247
|
-
| `/options`
|
|
248
|
-
| `/
|
|
232
|
+
| Command | Description |
|
|
233
|
+
| ----------------- | ------------------------------------------------------------------------------------ |
|
|
234
|
+
| `/help` | Show available commands |
|
|
235
|
+
| `/clear` | Clear conversation history and scratch notes |
|
|
236
|
+
| `/compact` | Compress conversation history in-place |
|
|
237
|
+
| `/task` | Run an isolated task (no history, structured output) |
|
|
238
|
+
| `/memory` | List all persistent memories |
|
|
239
|
+
| `/scratch` | List session scratch notes |
|
|
240
|
+
| `/mcp` | List connected MCP servers and their tools |
|
|
241
|
+
| `/cron` | Show cron jobs and daemon status |
|
|
242
|
+
| `/rag` | Show RAG memory stats and recent facts |
|
|
243
|
+
| `/provider` | Switch LLM provider interactively |
|
|
244
|
+
| `/model` | Switch model for the current provider |
|
|
245
|
+
| `/theme` | Switch color theme |
|
|
246
|
+
| `/routines` | List saved routines |
|
|
247
|
+
| `/create-routine` | Create a routine with guided AI assistance |
|
|
248
|
+
| `/create-task` | Create a task routine (`task-` prefixed) with guided AI assistance |
|
|
249
|
+
| `/specialists` | List saved specialists |
|
|
250
|
+
| `/candidates` | Review auto-detected specialist suggestions _(v0.6.0+)_ |
|
|
251
|
+
| `/critic` | Toggle critic mode for response verification (on/off) |
|
|
252
|
+
| `/agent-options` | Configure auto-creation for specialist agents |
|
|
253
|
+
| `/options` | View and modify runtime options (max-tokens, max-steps, shell-timeout, token-window) |
|
|
254
|
+
| `/debug` | Print a diagnostic report for troubleshooting (no secrets leaked) |
|
|
255
|
+
| `/exit` | Quit Bernard (also: `exit`, `quit`) |
|
|
249
256
|
|
|
250
257
|
Type `/{routine-id}` or `/{specialist-id}` to invoke a saved routine or specialist directly (e.g., `/deploy-staging`).
|
|
251
258
|
|
|
@@ -289,6 +296,22 @@ Here's a summary of the API docs: ...
|
|
|
289
296
|
|
|
290
297
|
Supports an optional CSS selector to target specific content (e.g., `article`, `main`, `.post-body`). Strips scripts, styles, navigation, footers, and other non-content elements.
|
|
291
298
|
|
|
299
|
+
### File Editing
|
|
300
|
+
|
|
301
|
+
Read and edit files with precision using `file_read_lines` and `file_edit_lines` — no need to shell out to `sed` or `awk`.
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
bernard> show me lines 10-20 of src/config.ts
|
|
305
|
+
▶ file_read_lines: src/config.ts (lines 10–20)
|
|
306
|
+
...
|
|
307
|
+
|
|
308
|
+
bernard> replace line 15 with "const timeout = 5000;"
|
|
309
|
+
▶ file_edit_lines: src/config.ts [replace line 15]
|
|
310
|
+
Done — 1 edit applied.
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
`file_edit_lines` supports replace, insert, delete, and append operations. All edits in a single call are atomic — they all succeed or all fail. Binary files are detected and rejected. Files up to 50 MB are supported, with pagination for large reads.
|
|
314
|
+
|
|
292
315
|
### Memory (Persistent)
|
|
293
316
|
|
|
294
317
|
Long-term memory that persists across sessions. Stored as markdown files in `~/.bernard/memory/`.
|
|
@@ -344,7 +367,7 @@ bernard> check the disk usage on /, look up the weather in Austin, and count lin
|
|
|
344
367
|
...
|
|
345
368
|
```
|
|
346
369
|
|
|
347
|
-
Up to 4 concurrent sub-agents. Each gets
|
|
370
|
+
Up to 4 concurrent sub-agents. Each gets 50% of the main agent's step budget (e.g. 13 steps when `max-steps` is 25). Color-coded output in the terminal. Sub-agents accept per-invocation provider/model overrides to use a different LLM than the main session.
|
|
348
371
|
|
|
349
372
|
### Tasks _(v0.6.0+)_
|
|
350
373
|
|
|
@@ -361,8 +384,10 @@ Found 23 .ts files
|
|
|
361
384
|
|
|
362
385
|
Key differences from sub-agents:
|
|
363
386
|
|
|
364
|
-
- **
|
|
387
|
+
- **Single-step budget** (`maxSteps: 2` — one tool-use round + structured result) — tasks are meant to be quick and deterministic
|
|
365
388
|
- **Structured JSON output** — always returns `{status: "success"|"error", output: string, details?: string}`
|
|
389
|
+
- **Saved tasks** — create task routines with `/create-task`, then invoke them by ID via `/task-{id}` or programmatically with the `taskId` parameter
|
|
390
|
+
- **Auto-context injection** — working directory, available tools, memory, and RAG context are included automatically
|
|
366
391
|
- **No conversation history** — completely isolated from the current session
|
|
367
392
|
- **Available as both a tool and a command** — the agent can call `task` during routines for chaining, or users can run `/task` directly from the REPL
|
|
368
393
|
- **Shared concurrency pool** — tasks and sub-agents share the same 4-slot limit
|
|
@@ -428,7 +453,7 @@ bernard> /code-reviewer review the changes in src/agent.ts
|
|
|
428
453
|
└─ spec:1 done
|
|
429
454
|
```
|
|
430
455
|
|
|
431
|
-
Each specialist run gets its own `generateText` loop with a 10-step budget, using the specialist's system prompt and guidelines as its persona. Specialists share the concurrency pool with sub-agents and tasks (4 slots max).
|
|
456
|
+
Each specialist run gets its own `generateText` loop with a 10-step budget, using the specialist's system prompt and guidelines as its persona. Specialists can have per-specialist model overrides — set a default provider/model at creation time, and it will be used every time that specialist runs. Specialists share the concurrency pool with sub-agents and tasks (4 slots max).
|
|
432
457
|
|
|
433
458
|
Manage specialists:
|
|
434
459
|
|
|
@@ -462,6 +487,19 @@ When candidates are detected, you'll see a notification at the start of your nex
|
|
|
462
487
|
|
|
463
488
|
Use `/candidates` to see pending suggestions with their name, description, confidence score, and reasoning. You can then accept or reject candidates conversationally (e.g., "accept the code-review candidate"), and Bernard will create the specialist for you.
|
|
464
489
|
|
|
490
|
+
**Overlap detection** — Before suggesting a new specialist, Bernard computes a token-based similarity score against all existing specialists and pending candidates. If the overlap exceeds 60%, the candidate is suppressed. When a candidate partially overlaps with an existing specialist, Bernard may suggest enhancing the existing specialist instead.
|
|
491
|
+
|
|
492
|
+
**Auto-creation** — You can enable automatic specialist creation for high-confidence candidates:
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
/agent-options auto-create on # Enable auto-creation
|
|
496
|
+
/agent-options auto-create off # Disable auto-creation
|
|
497
|
+
/agent-options threshold 0.85 # Set confidence threshold (0-1)
|
|
498
|
+
/agent-options # Show current settings
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Or via environment variables: `BERNARD_AUTO_CREATE_SPECIALISTS=true` and `BERNARD_AUTO_CREATE_THRESHOLD=0.85`.
|
|
502
|
+
|
|
465
503
|
Candidates are auto-dismissed after 30 days if not reviewed. Up to 10 pending candidates are stored at a time.
|
|
466
504
|
|
|
467
505
|
Storage: one JSON file per candidate in `~/.local/share/bernard/specialist-candidates/`.
|
|
@@ -484,6 +522,12 @@ When enabled:
|
|
|
484
522
|
|
|
485
523
|
The critic checks that claimed actions match actual tool calls and flags any discrepancies. It adds one extra LLM call after tool-using responses. Simple knowledge answers are not verified.
|
|
486
524
|
|
|
525
|
+
**PAC System (Plan-Act-Critic)** — When critic mode is enabled, sub-agents and specialists also get critic verification via a reusable PAC loop. The PAC loop runs the critic after each sub-agent/specialist execution, and if the critic finds issues, it retries the task with feedback (up to 2 retries). This applies to:
|
|
526
|
+
|
|
527
|
+
- Sub-agents (`agent` tool)
|
|
528
|
+
- Specialist runs (`specialist_run` tool)
|
|
529
|
+
- Cron job executions (daemon mode)
|
|
530
|
+
|
|
487
531
|
Default: off. Recommended for high-stakes work (deployments, git operations, multi-file edits).
|
|
488
532
|
|
|
489
533
|
---
|
|
@@ -678,6 +722,8 @@ Bernard automatically compresses conversation history when it approaches 75% of
|
|
|
678
722
|
|
|
679
723
|
Summarization and domain-specific fact extraction run in parallel. Scratch notes survive compression, so multi-step task progress is never lost.
|
|
680
724
|
|
|
725
|
+
**Auto-continue on truncation:** If a response hits the `max-tokens` limit and is cut off, Bernard automatically continues where it left off (up to 3 continuations). After completing, it shows a recommended `max-tokens` value based on actual usage. If the response is still incomplete after 3 continuations, a warning is shown with instructions to increase the limit via `/options max-tokens <value>`.
|
|
726
|
+
|
|
681
727
|
When critic mode is enabled (`/critic on`), Bernard writes plans to scratch before complex tasks and verifies outcomes after tool use. See [Critic Mode](#critic-mode).
|
|
682
728
|
|
|
683
729
|
### RAG Memory
|
|
@@ -722,17 +768,17 @@ Storage: `~/.bernard/conversation-history.json`
|
|
|
722
768
|
|
|
723
769
|
## File Structure
|
|
724
770
|
|
|
725
|
-
Bernard
|
|
771
|
+
Bernard follows the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir/latest/), splitting files across four standard directories:
|
|
726
772
|
|
|
727
773
|
```
|
|
728
|
-
~/.bernard/
|
|
729
|
-
├── keys.json # API keys (mode 0600)
|
|
774
|
+
~/.config/bernard/ # Config (XDG_CONFIG_HOME)
|
|
730
775
|
├── preferences.json # Provider, model, options
|
|
776
|
+
├── keys.json # API keys (mode 0600)
|
|
731
777
|
├── .env # Fallback environment config
|
|
732
|
-
|
|
733
|
-
|
|
778
|
+
└── mcp.json # MCP server configuration
|
|
779
|
+
|
|
780
|
+
~/.local/share/bernard/ # Data (XDG_DATA_HOME)
|
|
734
781
|
├── memory/ # Persistent memories (*.md)
|
|
735
|
-
├── models/ # Embedding model cache (fastembed)
|
|
736
782
|
├── routines/ # Saved routines (*.json)
|
|
737
783
|
├── specialists/ # Saved specialist profiles (*.json)
|
|
738
784
|
├── specialist-candidates/ # Auto-detected specialist suggestions (*.json)
|
|
@@ -740,12 +786,22 @@ Bernard stores all data in `~/.bernard/`:
|
|
|
740
786
|
│ └── memories.json # RAG fact embeddings
|
|
741
787
|
└── cron/
|
|
742
788
|
├── jobs.json # Scheduled jobs
|
|
743
|
-
├── daemon.pid # Daemon process ID
|
|
744
|
-
├── daemon.log # Daemon output (rotates at 1MB)
|
|
745
789
|
├── logs/ # Per-job execution logs
|
|
746
790
|
└── alerts/ # Cron alert files
|
|
791
|
+
|
|
792
|
+
~/.cache/bernard/ # Cache (XDG_CACHE_HOME)
|
|
793
|
+
├── models/ # Embedding model cache (fastembed)
|
|
794
|
+
└── update-check.json # Update check state
|
|
795
|
+
|
|
796
|
+
~/.local/state/bernard/ # State (XDG_STATE_HOME)
|
|
797
|
+
├── conversation-history.json # Last session (for --resume)
|
|
798
|
+
├── logs/ # Debug log files (*.jsonl)
|
|
799
|
+
├── cron-daemon.pid # Daemon process ID
|
|
800
|
+
└── cron-daemon.log # Daemon output (rotates at 1MB)
|
|
747
801
|
```
|
|
748
802
|
|
|
803
|
+
Override all directories with a single flat path: `BERNARD_HOME=/path`. On first run, files are auto-migrated from legacy `~/.bernard/` to XDG locations.
|
|
804
|
+
|
|
749
805
|
---
|
|
750
806
|
|
|
751
807
|
## Development
|
|
@@ -777,6 +833,10 @@ BERNARD_DEBUG=1 bernard
|
|
|
777
833
|
|
|
778
834
|
Logs are written to `.logs/YYYY-MM-DD.log` in JSON format, covering agent processing, RAG operations, context compression, tool execution, and MCP operations.
|
|
779
835
|
|
|
836
|
+
### Diagnostic Report
|
|
837
|
+
|
|
838
|
+
Use `/debug` in the REPL to print a diagnostic report useful for troubleshooting. The report includes runtime info (Bernard version, Node.js version, OS), LLM configuration, API key status (configured/not set — keys are never shown), MCP server status, RAG/memory/cron state, conversation stats, active settings, and file paths. No secrets are included in the output.
|
|
839
|
+
|
|
780
840
|
### Adding a New Provider
|
|
781
841
|
|
|
782
842
|
1. Install the AI SDK provider package (e.g., `npm install @ai-sdk/google`)
|
|
@@ -796,6 +856,7 @@ src/
|
|
|
796
856
|
├── repl.ts # Interactive REPL loop
|
|
797
857
|
├── agent.ts # Agent class (generateText loop)
|
|
798
858
|
├── config.ts # Config loading and validation
|
|
859
|
+
├── critic.ts # Critic agent for response verification
|
|
799
860
|
├── output.ts # Terminal formatting (Chalk)
|
|
800
861
|
├── theme.ts # Color theme definitions and switching
|
|
801
862
|
├── memory.ts # MemoryStore (persistent + scratch)
|
|
@@ -807,7 +868,11 @@ src/
|
|
|
807
868
|
├── specialists.ts # SpecialistStore (reusable expert profiles)
|
|
808
869
|
├── specialist-candidates.ts # CandidateStore (auto-detected suggestions)
|
|
809
870
|
├── specialist-detector.ts # LLM-based specialist pattern detection
|
|
871
|
+
├── specialist-matcher.ts # Keyword scorer for specialist auto-dispatch
|
|
810
872
|
├── mcp.ts # MCP server manager
|
|
873
|
+
├── overlap-checker.ts # Token-based Jaccard overlap for specialist dedup
|
|
874
|
+
├── pac.ts # Plan-Act-Critic loop wrapper
|
|
875
|
+
├── paths.ts # Centralized XDG file path resolution
|
|
811
876
|
├── rag-worker.ts # Background RAG fact extraction + candidate detection
|
|
812
877
|
├── setup.ts # First-time setup wizard
|
|
813
878
|
├── history.ts # Conversation save/load
|
|
@@ -827,6 +892,7 @@ src/
|
|
|
827
892
|
│ ├── cron-logs.ts # Cron execution logs
|
|
828
893
|
│ ├── mcp.ts # MCP config (stdio)
|
|
829
894
|
│ ├── mcp-url.ts # MCP config (URL-based)
|
|
895
|
+
│ ├── file.ts # File reading and line-based editing
|
|
830
896
|
│ ├── routine.ts # Routine management tool
|
|
831
897
|
│ ├── specialist.ts # Specialist management tool
|
|
832
898
|
│ ├── specialist-run.ts # Specialist execution (sub-agent with custom persona)
|
|
@@ -863,7 +929,7 @@ Found a bug? Please [open an issue](https://github.com/phillt/bernard/issues/new
|
|
|
863
929
|
|
|
864
930
|
- Steps to reproduce the problem
|
|
865
931
|
- Expected vs. actual behavior
|
|
866
|
-
- Your environment
|
|
932
|
+
- Your environment — run `/debug` in the REPL and paste the output
|
|
867
933
|
- Any relevant logs (run with `BERNARD_DEBUG=1` for verbose output)
|
|
868
934
|
|
|
869
935
|
## Third-Party Licenses
|
package/dist/agent.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export declare class Agent {
|
|
|
49
49
|
private routineStore;
|
|
50
50
|
private specialistStore;
|
|
51
51
|
private candidateStore?;
|
|
52
|
+
private stepLimitHitCount;
|
|
53
|
+
private lastStepLimitHit;
|
|
52
54
|
constructor(config: BernardConfig, toolOptions: ToolOptions, memoryStore: MemoryStore, mcpTools?: Record<string, any>, mcpServerNames?: string[], alertContext?: string, initialHistory?: CoreMessage[], ragStore?: RAGStore, routineStore?: RoutineStore, specialistStore?: SpecialistStore, candidateStore?: CandidateStoreReader);
|
|
53
55
|
/** Returns the current conversation message history. */
|
|
54
56
|
getHistory(): CoreMessage[];
|
|
@@ -56,6 +58,11 @@ export declare class Agent {
|
|
|
56
58
|
getLastRAGResults(): RAGSearchResult[];
|
|
57
59
|
/** Cancels the in-flight LLM request, if any. Safe to call when no request is active. */
|
|
58
60
|
abort(): void;
|
|
61
|
+
/** Returns step limit hit info from last processInput, or null if limit wasn't hit. */
|
|
62
|
+
getStepLimitHit(): {
|
|
63
|
+
currentLimit: number;
|
|
64
|
+
hitCount: number;
|
|
65
|
+
} | null;
|
|
59
66
|
/** Attaches a spinner stats object that will be updated with token usage during generation. */
|
|
60
67
|
setSpinnerStats(stats: SpinnerStats): void;
|
|
61
68
|
/** Updates the alert context injected into the system prompt (e.g., specialist candidates). */
|
|
@@ -69,10 +76,6 @@ export declare class Agent {
|
|
|
69
76
|
* @throws Error wrapping the underlying API error if generation fails for non-abort, non-overflow reasons
|
|
70
77
|
*/
|
|
71
78
|
processInput(userInput: string): Promise<void>;
|
|
72
|
-
/** Extracts a structured log of tool calls from generateText step results. */
|
|
73
|
-
private extractToolCallLog;
|
|
74
|
-
/** Runs the critic agent to verify the main agent's response against actual tool calls. */
|
|
75
|
-
private runCritic;
|
|
76
79
|
/** Compresses conversation history in-place, returning token usage stats. */
|
|
77
80
|
compactHistory(): Promise<CompactResult>;
|
|
78
81
|
/** Resets conversation history, scratch notes, and RAG tracking state for a fresh session. */
|