bernard-agent 0.8.0 → 0.9.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 +80 -44
- package/dist/agent.d.ts +14 -3
- package/dist/agent.js +228 -38
- package/dist/agent.js.map +1 -1
- package/dist/builtin-specialists/correction-agent.json +32 -0
- package/dist/builtin-specialists/file-wrapper.json +43 -0
- package/dist/builtin-specialists/shell-wrapper.json +50 -0
- package/dist/builtin-specialists/specialist-creator.json +32 -0
- package/dist/builtin-specialists/web-wrapper.json +38 -0
- package/dist/candidate-bootstrap.d.ts +18 -0
- package/dist/candidate-bootstrap.js +61 -0
- package/dist/candidate-bootstrap.js.map +1 -0
- package/dist/config.d.ts +132 -10
- package/dist/config.js +234 -47
- package/dist/config.js.map +1 -1
- package/dist/context.js +23 -6
- package/dist/context.js.map +1 -1
- package/dist/correction-candidates.d.ts +54 -0
- package/dist/correction-candidates.js +138 -0
- package/dist/correction-candidates.js.map +1 -0
- package/dist/correction.d.ts +67 -0
- package/dist/correction.js +138 -0
- package/dist/correction.js.map +1 -0
- package/dist/critic.js +2 -1
- package/dist/critic.js.map +1 -1
- package/dist/cron/notes-store.d.ts +41 -0
- package/dist/cron/notes-store.js +134 -0
- package/dist/cron/notes-store.js.map +1 -0
- package/dist/cron/runner.js +25 -3
- package/dist/cron/runner.js.map +1 -1
- package/dist/cron/scoped-notes-tools.d.ts +24 -0
- package/dist/cron/scoped-notes-tools.js +50 -0
- package/dist/cron/scoped-notes-tools.js.map +1 -0
- package/dist/custom-providers.d.ts +80 -0
- package/dist/custom-providers.js +238 -0
- package/dist/custom-providers.js.map +1 -0
- package/dist/fs-utils.d.ts +2 -0
- package/dist/fs-utils.js +44 -0
- package/dist/fs-utils.js.map +1 -0
- package/dist/history.js +3 -1
- package/dist/history.js.map +1 -1
- package/dist/image.d.ts +59 -0
- package/dist/image.js +228 -0
- package/dist/image.js.map +1 -0
- package/dist/index.js +72 -4
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/mcp.js.map +1 -1
- package/dist/memory.d.ts +13 -0
- package/dist/memory.js +45 -4
- package/dist/memory.js.map +1 -1
- package/dist/menu.d.ts +97 -0
- package/dist/menu.js +338 -0
- package/dist/menu.js.map +1 -0
- package/dist/os-info.d.ts +22 -0
- package/dist/os-info.js +111 -0
- package/dist/os-info.js.map +1 -0
- package/dist/output.d.ts +35 -1
- package/dist/output.js +256 -45
- package/dist/output.js.map +1 -1
- package/dist/pac.d.ts +14 -2
- package/dist/pac.js +5 -5
- package/dist/pac.js.map +1 -1
- package/dist/paths.d.ts +5 -0
- package/dist/paths.js +6 -1
- package/dist/paths.js.map +1 -1
- package/dist/plan-store.d.ts +47 -0
- package/dist/plan-store.js +94 -0
- package/dist/plan-store.js.map +1 -0
- package/dist/prompt-rewriter.d.ts +29 -0
- package/dist/prompt-rewriter.js +155 -0
- package/dist/prompt-rewriter.js.map +1 -0
- package/dist/providers/index.d.ts +56 -4
- package/dist/providers/index.js +86 -5
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/profiles.d.ts +37 -0
- package/dist/providers/profiles.js +110 -0
- package/dist/providers/profiles.js.map +1 -0
- package/dist/providers/types.d.ts +11 -2
- package/dist/providers/types.js +3 -0
- package/dist/providers/types.js.map +1 -1
- package/dist/rag-query.js +15 -1
- package/dist/rag-query.js.map +1 -1
- package/dist/react.d.ts +38 -0
- package/dist/react.js +116 -0
- package/dist/react.js.map +1 -0
- package/dist/reasoning-log.d.ts +30 -0
- package/dist/reasoning-log.js +102 -0
- package/dist/reasoning-log.js.map +1 -0
- package/dist/reference-resolver.d.ts +47 -0
- package/dist/reference-resolver.js +316 -0
- package/dist/reference-resolver.js.map +1 -0
- package/dist/reference-tool-lookup.d.ts +37 -0
- package/dist/reference-tool-lookup.js +318 -0
- package/dist/reference-tool-lookup.js.map +1 -0
- package/dist/repl.js +1053 -346
- package/dist/repl.js.map +1 -1
- package/dist/setup.js +2 -1
- package/dist/setup.js.map +1 -1
- package/dist/specialist-detector.js +2 -1
- package/dist/specialist-detector.js.map +1 -1
- package/dist/specialists.d.ts +74 -3
- package/dist/specialists.js +152 -20
- package/dist/specialists.js.map +1 -1
- package/dist/structured-output.d.ts +58 -0
- package/dist/structured-output.js +138 -0
- package/dist/structured-output.js.map +1 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +18 -12
- package/dist/theme.js.map +1 -1
- package/dist/tool-call-repair.d.ts +29 -0
- package/dist/tool-call-repair.js +99 -0
- package/dist/tool-call-repair.js.map +1 -0
- package/dist/tool-profiles.d.ts +70 -0
- package/dist/tool-profiles.js +385 -0
- package/dist/tool-profiles.js.map +1 -0
- package/dist/tools/activity-summary.d.ts +15 -0
- package/dist/tools/activity-summary.js +44 -0
- package/dist/tools/activity-summary.js.map +1 -0
- package/dist/tools/ask-user.d.ts +49 -0
- package/dist/tools/ask-user.js +52 -0
- package/dist/tools/ask-user.js.map +1 -0
- package/dist/tools/augment.d.ts +17 -0
- package/dist/tools/augment.js +102 -0
- package/dist/tools/augment.js.map +1 -0
- package/dist/tools/cron-logs.js +7 -0
- package/dist/tools/cron-logs.js.map +1 -1
- package/dist/tools/cron-notes.d.ts +52 -0
- package/dist/tools/cron-notes.js +105 -0
- package/dist/tools/cron-notes.js.map +1 -0
- package/dist/tools/datetime.d.ts +7 -0
- package/dist/tools/datetime.js +29 -3
- package/dist/tools/datetime.js.map +1 -1
- package/dist/tools/evaluate.d.ts +20 -0
- package/dist/tools/evaluate.js +29 -0
- package/dist/tools/evaluate.js.map +1 -0
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/mcp.d.ts +3 -3
- package/dist/tools/plan.d.ts +81 -0
- package/dist/tools/plan.js +108 -0
- package/dist/tools/plan.js.map +1 -0
- package/dist/tools/result-cap.d.ts +24 -0
- package/dist/tools/result-cap.js +44 -0
- package/dist/tools/result-cap.js.map +1 -0
- package/dist/tools/routine.d.ts +3 -3
- package/dist/tools/shell.d.ts +14 -1
- package/dist/tools/shell.js +86 -4
- package/dist/tools/shell.js.map +1 -1
- package/dist/tools/specialist-run.d.ts +5 -3
- package/dist/tools/specialist-run.js +115 -24
- package/dist/tools/specialist-run.js.map +1 -1
- package/dist/tools/specialist.d.ts +83 -3
- package/dist/tools/specialist.js +83 -3
- package/dist/tools/specialist.js.map +1 -1
- package/dist/tools/subagent.js +32 -14
- package/dist/tools/subagent.js.map +1 -1
- package/dist/tools/task.d.ts +19 -16
- package/dist/tools/task.js +69 -40
- package/dist/tools/task.js.map +1 -1
- package/dist/tools/think.d.ts +18 -0
- package/dist/tools/think.js +25 -0
- package/dist/tools/think.js.map +1 -0
- package/dist/tools/tool-wrapper-run.d.ts +121 -0
- package/dist/tools/tool-wrapper-run.js +382 -0
- package/dist/tools/tool-wrapper-run.js.map +1 -0
- package/dist/tools/types.d.ts +28 -2
- package/dist/tools/web-search.d.ts +31 -0
- package/dist/tools/web-search.js +172 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/wrap-with-specialist.d.ts +55 -0
- package/dist/tools/wrap-with-specialist.js +137 -0
- package/dist/tools/wrap-with-specialist.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Bernard
|
|
2
2
|
|
|
3
|
-
A local CLI AI agent that executes terminal commands, manages scheduled tasks, remembers context across sessions, and connects to external tool servers — all through natural language. Supports multiple LLM providers (Anthropic, OpenAI, xAI) via the Vercel AI SDK.
|
|
3
|
+
A local CLI AI agent that executes terminal commands, manages scheduled tasks, remembers context across sessions, and connects to external tool servers — all through natural language. Supports multiple LLM providers (Anthropic, OpenAI, xAI) via the Vercel AI SDK, plus user-registered **custom providers** that point those SDKs at any compatible endpoint (Ollama, LM Studio, OpenRouter, internal proxies, …).
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
@@ -125,6 +125,28 @@ Check which providers have keys configured:
|
|
|
125
125
|
bernard providers
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
### Custom Providers
|
|
129
|
+
|
|
130
|
+
If you run your own LLM (Ollama, LM Studio, vLLM, ...) or use an OpenAI/Anthropic/xAI-compatible aggregator (OpenRouter, Together, Fireworks, internal proxies), register it as a **custom provider**. You pick a name, pick which of the three installed SDKs to wrap, supply a base URL, and Bernard treats that name like any other provider.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# CLI
|
|
134
|
+
bernard add-provider ollama \
|
|
135
|
+
--sdk openai \
|
|
136
|
+
--base-url http://localhost:11434/v1 \
|
|
137
|
+
--model llama3.2 \
|
|
138
|
+
--key ollama # any non-empty token; some local servers ignore the value
|
|
139
|
+
bernard add-key ollama <token> # if you skipped --key above
|
|
140
|
+
bernard providers # lists built-ins and custom side-by-side
|
|
141
|
+
bernard remove-provider ollama # removes the entry and its stored key
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
You can also add one interactively from the REPL: type `/provider`, scroll to **+ Add custom provider…**, and the wizard walks you through SDK, name, base URL, default model, and key. Once added, `/provider` switches to it like any built-in. In `/model`, the menu shows a remembered list of model names plus a `+ Type a new model name…` entry that adds whatever you type for next time.
|
|
145
|
+
|
|
146
|
+
When the active provider is custom, the welcome banner prints an extra `Endpoint:` line so it's clear the session isn't hitting the SDK's default URL.
|
|
147
|
+
|
|
148
|
+
Reserved names: `anthropic`, `openai`, `xai` (these are the built-ins). Custom-provider keys are stored in `keys.json` and are **not** read from environment variables.
|
|
149
|
+
|
|
128
150
|
### Environment Variables
|
|
129
151
|
|
|
130
152
|
Bernard loads `.env` from the current directory first, then falls back to `~/.bernard/.env`.
|
|
@@ -198,14 +220,17 @@ bernard --alert <id> # Open with cron alert context
|
|
|
198
220
|
### CLI Management Commands
|
|
199
221
|
|
|
200
222
|
```bash
|
|
201
|
-
bernard add-key <provider> <key>
|
|
202
|
-
bernard remove-key <provider>
|
|
203
|
-
bernard providers
|
|
204
|
-
bernard
|
|
205
|
-
|
|
206
|
-
bernard
|
|
207
|
-
bernard
|
|
208
|
-
bernard
|
|
223
|
+
bernard add-key <provider> <key> # Store an API key securely
|
|
224
|
+
bernard remove-key <provider> # Remove a stored API key
|
|
225
|
+
bernard providers # List providers (built-in + custom) and key status
|
|
226
|
+
bernard add-provider <name> --sdk <openai|anthropic|xai> \
|
|
227
|
+
--base-url <url> --model <model> [--key <key>] # Register a custom provider
|
|
228
|
+
bernard remove-provider <name> # Remove a custom provider and its key
|
|
229
|
+
bernard list-options # Show configurable options
|
|
230
|
+
bernard reset-option <option> # Reset one option to default
|
|
231
|
+
bernard reset-options # Reset all options (with confirmation)
|
|
232
|
+
bernard mcp-list # List configured MCP servers
|
|
233
|
+
bernard remove-mcp <key> # Remove an MCP server
|
|
209
234
|
|
|
210
235
|
# Cron management
|
|
211
236
|
bernard cron-list # List all cron jobs with status
|
|
@@ -229,30 +254,28 @@ Features:
|
|
|
229
254
|
|
|
230
255
|
### REPL Slash Commands
|
|
231
256
|
|
|
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
|
-
| `/
|
|
252
|
-
| `/
|
|
253
|
-
| `/
|
|
254
|
-
| `/debug` | Print a diagnostic report for troubleshooting (no secrets leaked) |
|
|
255
|
-
| `/exit` | Quit Bernard (also: `exit`, `quit`) |
|
|
257
|
+
| Command | Description |
|
|
258
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
259
|
+
| `/help` | Show available commands |
|
|
260
|
+
| `/clear` | Clear conversation history and scratch notes |
|
|
261
|
+
| `/compact` | Compress conversation history in-place |
|
|
262
|
+
| `/task` | Run an isolated task (no history, structured output) |
|
|
263
|
+
| `/memory` | List all persistent memories |
|
|
264
|
+
| `/scratch` | List session scratch notes |
|
|
265
|
+
| `/mcp` | List connected MCP servers and their tools |
|
|
266
|
+
| `/cron` | Show cron jobs and daemon status |
|
|
267
|
+
| `/rag` | Show RAG memory stats and recent facts |
|
|
268
|
+
| `/provider` | Switch LLM provider interactively |
|
|
269
|
+
| `/model` | Switch model for the current provider |
|
|
270
|
+
| `/theme` | Switch color theme |
|
|
271
|
+
| `/routines` | List saved routines |
|
|
272
|
+
| `/create-routine` | Create a routine with guided AI assistance |
|
|
273
|
+
| `/create-task` | Create a task routine (`task-` prefixed) with guided AI assistance |
|
|
274
|
+
| `/specialists` | List saved specialists |
|
|
275
|
+
| `/candidates` | Review auto-detected specialist suggestions _(v0.6.0+)_ |
|
|
276
|
+
| `/agent-options` | Toggle agent behaviors (critic mode, coordinator/ReAct, prompt rewriter, tool details, auto-create specialists) |
|
|
277
|
+
| `/options` | View and modify runtime options (max-tokens, max-steps, shell-timeout, token-window); also includes debug report |
|
|
278
|
+
| `/exit` | Quit Bernard (also: `exit`, `quit`) |
|
|
256
279
|
|
|
257
280
|
Type `/{routine-id}` or `/{specialist-id}` to invoke a saved routine or specialist directly (e.g., `/deploy-staging`).
|
|
258
281
|
|
|
@@ -276,7 +299,7 @@ bernard> what git branch am I on?
|
|
|
276
299
|
You're on the main branch.
|
|
277
300
|
```
|
|
278
301
|
|
|
279
|
-
**Dangerous command protection:** Bernard detects risky patterns (`rm -rf`, `sudo`, `mkfs`, `dd`, `chmod 777`, `reboot`, `kill -9`, etc.) and asks for your confirmation before executing.
|
|
302
|
+
**Dangerous command protection:** Bernard detects risky patterns (`rm -rf`, `sudo`, `mkfs`, `dd`, `chmod 777`, `reboot`, `kill -9`, etc.) and asks for your confirmation via an arrow-key menu before executing. `rm` calls scoped to Bernard's own scratch-script directory (`<os-tmpdir>/bernard-*`, e.g. `/tmp/bernard-*` on Linux — an internal constant, not configurable) and free of shell metacharacters skip the prompt, since that's just Bernard cleaning up after itself.
|
|
280
303
|
|
|
281
304
|
**Timeout:** Commands time out after 30 seconds by default (configurable via `shell-timeout` option).
|
|
282
305
|
|
|
@@ -338,6 +361,23 @@ bernard> I need to migrate 5 database tables — track progress in scratch
|
|
|
338
361
|
|
|
339
362
|
Actions: `list`, `read`, `write`, `delete`. Scratch notes are also injected into the system prompt, so Bernard always knows the current session state.
|
|
340
363
|
|
|
364
|
+
### Asking the User
|
|
365
|
+
|
|
366
|
+
When Bernard is missing information only you can provide — intent, preferences, a missing argument — it calls `ask_user` to pause the turn and prompt you directly, instead of writing the question as prose (which would leave the turn idle).
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
bernard> file an issue about the menu bug
|
|
370
|
+
▶ ask_user: 3 questions
|
|
371
|
+
[1 ✓ ▸2◂ 3] Which labels apply?
|
|
372
|
+
▸ bug
|
|
373
|
+
ui
|
|
374
|
+
Other (type a custom answer)
|
|
375
|
+
|
|
376
|
+
Filed issue #214 with title, body, and the labels you picked.
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
A single call can batch up to 10 related questions (title + body + labels, say), each with free-form input or a fixed choice list plus an optional "Other" escape hatch. Hit Esc mid-batch and whatever you already answered is returned to the agent. In non-interactive sessions the tool reports `unavailable` so the agent can pick a sensible default.
|
|
380
|
+
|
|
341
381
|
### Date and Time
|
|
342
382
|
|
|
343
383
|
Returns the current date, time, and timezone. Bernard calls this automatically when needed.
|
|
@@ -492,10 +532,7 @@ Use `/candidates` to see pending suggestions with their name, description, confi
|
|
|
492
532
|
**Auto-creation** — You can enable automatic specialist creation for high-confidence candidates:
|
|
493
533
|
|
|
494
534
|
```bash
|
|
495
|
-
/agent-options auto-create on
|
|
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
|
|
535
|
+
/agent-options # Interactive menu to configure auto-create on/off and threshold
|
|
499
536
|
```
|
|
500
537
|
|
|
501
538
|
Or via environment variables: `BERNARD_AUTO_CREATE_SPECIALISTS=true` and `BERNARD_AUTO_CREATE_THRESHOLD=0.85`.
|
|
@@ -509,9 +546,7 @@ Storage: one JSON file per candidate in `~/.local/share/bernard/specialist-candi
|
|
|
509
546
|
Critic mode adds planning, proactive scratch/memory usage, and post-response verification. Toggle it during a session:
|
|
510
547
|
|
|
511
548
|
```bash
|
|
512
|
-
/
|
|
513
|
-
/critic off # Disable critic mode
|
|
514
|
-
/critic # Show current status
|
|
549
|
+
/agent-options # Interactive menu; toggle "Critic mode"
|
|
515
550
|
```
|
|
516
551
|
|
|
517
552
|
When enabled:
|
|
@@ -724,7 +759,7 @@ Summarization and domain-specific fact extraction run in parallel. Scratch notes
|
|
|
724
759
|
|
|
725
760
|
**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
761
|
|
|
727
|
-
When critic mode is enabled (`/
|
|
762
|
+
When critic mode is enabled (toggle via `/agent-options`), Bernard writes plans to scratch before complex tasks and verifies outcomes after tool use. See [Critic Mode](#critic-mode).
|
|
728
763
|
|
|
729
764
|
### RAG Memory
|
|
730
765
|
|
|
@@ -835,7 +870,7 @@ Logs are written to `.logs/YYYY-MM-DD.log` in JSON format, covering agent proces
|
|
|
835
870
|
|
|
836
871
|
### Diagnostic Report
|
|
837
872
|
|
|
838
|
-
Use `/
|
|
873
|
+
Use `/options` in the REPL and select "Debug report" 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
874
|
|
|
840
875
|
### Adding a New Provider
|
|
841
876
|
|
|
@@ -858,6 +893,7 @@ src/
|
|
|
858
893
|
├── config.ts # Config loading and validation
|
|
859
894
|
├── critic.ts # Critic agent for response verification
|
|
860
895
|
├── output.ts # Terminal formatting (Chalk)
|
|
896
|
+
├── menu.ts # Reusable numbered-list selection UI
|
|
861
897
|
├── theme.ts # Color theme definitions and switching
|
|
862
898
|
├── memory.ts # MemoryStore (persistent + scratch)
|
|
863
899
|
├── context.ts # Context compression + domain fact extraction
|
|
@@ -929,7 +965,7 @@ Found a bug? Please [open an issue](https://github.com/phillt/bernard/issues/new
|
|
|
929
965
|
|
|
930
966
|
- Steps to reproduce the problem
|
|
931
967
|
- Expected vs. actual behavior
|
|
932
|
-
- Your environment — run `/
|
|
968
|
+
- Your environment — run `/options` and select "Debug report" in the REPL, then paste the output
|
|
933
969
|
- Any relevant logs (run with `BERNARD_DEBUG=1` for verbose output)
|
|
934
970
|
|
|
935
971
|
## Third-Party Licenses
|
package/dist/agent.d.ts
CHANGED
|
@@ -7,7 +7,11 @@ import type { RAGStore, RAGSearchResult } from './rag.js';
|
|
|
7
7
|
import { RoutineStore, type RoutineSummary } from './routines.js';
|
|
8
8
|
import { SpecialistStore, type SpecialistSummary } from './specialists.js';
|
|
9
9
|
import type { CandidateStoreReader } from './specialist-candidates.js';
|
|
10
|
+
import { CorrectionCandidateStore } from './correction-candidates.js';
|
|
10
11
|
import { type SpecialistMatch } from './specialist-matcher.js';
|
|
12
|
+
import { type ImageAttachment } from './image.js';
|
|
13
|
+
import { type ResolvedEntry } from './reference-resolver.js';
|
|
14
|
+
export { REACT_COORDINATOR_PROMPT, shouldEnforcePlan, REACT_MAX_STEPS_CEILING, computeEffectiveMaxSteps, REACT_ENFORCEMENT_MAX_RETRIES, REACT_AUTO_CANCEL_NOTE, buildEnforcementFeedback, } from './react.js';
|
|
11
15
|
/**
|
|
12
16
|
* Assembles the full system prompt including base instructions, memory context, and MCP status.
|
|
13
17
|
* @internal Exported for testing only.
|
|
@@ -19,7 +23,7 @@ import { type SpecialistMatch } from './specialist-matcher.js';
|
|
|
19
23
|
* @param specialistSummaries - Specialist summaries to list in the prompt
|
|
20
24
|
* @param specialistMatches - Pre-computed specialist match results for the current input
|
|
21
25
|
*/
|
|
22
|
-
export declare function buildSystemPrompt(config: BernardConfig, memoryStore: MemoryStore, mcpServerNames?: string[], ragResults?: RAGSearchResult[], routineSummaries?: RoutineSummary[], specialistSummaries?: SpecialistSummary[], specialistMatches?: SpecialistMatch[]): string;
|
|
26
|
+
export declare function buildSystemPrompt(config: BernardConfig, memoryStore: MemoryStore, mcpServerNames?: string[], ragResults?: RAGSearchResult[], routineSummaries?: RoutineSummary[], specialistSummaries?: SpecialistSummary[], specialistMatches?: SpecialistMatch[], resolvedReferences?: ResolvedEntry[]): string;
|
|
23
27
|
export interface CompactResult {
|
|
24
28
|
compacted: boolean;
|
|
25
29
|
tokensBefore: number;
|
|
@@ -49,11 +53,18 @@ export declare class Agent {
|
|
|
49
53
|
private routineStore;
|
|
50
54
|
private specialistStore;
|
|
51
55
|
private candidateStore?;
|
|
56
|
+
private correctionStore;
|
|
57
|
+
private toolProfileStore;
|
|
52
58
|
private stepLimitHitCount;
|
|
53
59
|
private lastStepLimitHit;
|
|
54
|
-
|
|
60
|
+
private planStore;
|
|
61
|
+
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, correctionStore?: CorrectionCandidateStore);
|
|
55
62
|
/** Returns the current conversation message history. */
|
|
56
63
|
getHistory(): CoreMessage[];
|
|
64
|
+
/** Returns the store that queues tool-wrapper correction candidates for this session. */
|
|
65
|
+
getCorrectionStore(): CorrectionCandidateStore;
|
|
66
|
+
/** Returns the specialist store used by this agent. */
|
|
67
|
+
getSpecialistStore(): SpecialistStore;
|
|
57
68
|
/** Returns the RAG search results from the most recent `processInput` call. */
|
|
58
69
|
getLastRAGResults(): RAGSearchResult[];
|
|
59
70
|
/** Cancels the in-flight LLM request, if any. Safe to call when no request is active. */
|
|
@@ -75,7 +86,7 @@ export declare class Agent {
|
|
|
75
86
|
* @param userInput - The raw text from the user's REPL input
|
|
76
87
|
* @throws Error wrapping the underlying API error if generation fails for non-abort, non-overflow reasons
|
|
77
88
|
*/
|
|
78
|
-
processInput(userInput: string): Promise<void>;
|
|
89
|
+
processInput(userInput: string, images?: ImageAttachment[], resolvedReferences?: ResolvedEntry[]): Promise<void>;
|
|
79
90
|
/** Compresses conversation history in-place, returning token usage stats. */
|
|
80
91
|
compactHistory(): Promise<CompactResult>;
|
|
81
92
|
/** Resets conversation history, scratch notes, and RAG tracking state for a fresh session. */
|