@dreb/coding-agent 2.16.0 → 2.18.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 (43) hide show
  1. package/README.md +7 -4
  2. package/dist/cli/args.d.ts.map +1 -1
  3. package/dist/cli/args.js +2 -1
  4. package/dist/cli/args.js.map +1 -1
  5. package/dist/core/agent-session.d.ts +3 -0
  6. package/dist/core/agent-session.d.ts.map +1 -1
  7. package/dist/core/agent-session.js +12 -0
  8. package/dist/core/agent-session.js.map +1 -1
  9. package/dist/core/sdk.d.ts +1 -1
  10. package/dist/core/sdk.d.ts.map +1 -1
  11. package/dist/core/sdk.js +2 -1
  12. package/dist/core/sdk.js.map +1 -1
  13. package/dist/core/system-prompt.d.ts.map +1 -1
  14. package/dist/core/system-prompt.js +1 -0
  15. package/dist/core/system-prompt.js.map +1 -1
  16. package/dist/core/tools/index.d.ts +11 -1
  17. package/dist/core/tools/index.d.ts.map +1 -1
  18. package/dist/core/tools/index.js +17 -2
  19. package/dist/core/tools/index.js.map +1 -1
  20. package/dist/core/tools/subagent.d.ts +6 -0
  21. package/dist/core/tools/subagent.d.ts.map +1 -1
  22. package/dist/core/tools/subagent.js +28 -3
  23. package/dist/core/tools/subagent.js.map +1 -1
  24. package/dist/core/tools/suggest-next.d.ts +19 -0
  25. package/dist/core/tools/suggest-next.d.ts.map +1 -0
  26. package/dist/core/tools/suggest-next.js +72 -0
  27. package/dist/core/tools/suggest-next.js.map +1 -0
  28. package/dist/core/tools/tmp-read.d.ts.map +1 -1
  29. package/dist/core/tools/tmp-read.js +14 -1
  30. package/dist/core/tools/tmp-read.js.map +1 -1
  31. package/dist/core/tools/wait.d.ts +40 -0
  32. package/dist/core/tools/wait.d.ts.map +1 -0
  33. package/dist/core/tools/wait.js +87 -0
  34. package/dist/core/tools/wait.js.map +1 -0
  35. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  36. package/dist/modes/interactive/interactive-mode.js +13 -0
  37. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  38. package/docs/extensions.md +2 -2
  39. package/docs/json.md +2 -1
  40. package/docs/rpc.md +30 -0
  41. package/docs/session.md +24 -0
  42. package/docs/tui.md +8 -0
  43. package/package.json +1 -1
@@ -569,7 +569,7 @@ In the default parallel tool execution mode, sibling tool calls from the same as
569
569
  import { isToolCallEventType } from "@dreb/coding-agent";
570
570
 
571
571
  dreb.on("tool_call", async (event, ctx) => {
572
- // event.toolName - "bash", "read", "write", "edit", "grep", "find", "ls", "web_search", "web_fetch", "subagent", "search", "skill", "tasks_update", or custom tool names
572
+ // event.toolName - "bash", "read", "write", "edit", "grep", "find", "ls", "web_search", "web_fetch", "subagent", "wait", "search", "skill", "tasks_update", "suggest_next", or custom tool names
573
573
  // event.toolCallId
574
574
  // event.input - tool parameters
575
575
 
@@ -1474,7 +1474,7 @@ async execute(toolCallId, params) {
1474
1474
 
1475
1475
  ### Overriding Built-in Tools
1476
1476
 
1477
- Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, `search`) by registering a tool with the same name. Interactive mode displays a warning when this happens. The factory-only tools (`skill`, `tasks_update`) can also be overridden.
1477
+ Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, `wait`, `search`) by registering a tool with the same name. Interactive mode displays a warning when this happens. The factory-only tools (`skill`, `tasks_update`, `suggest_next`) can also be overridden.
1478
1478
 
1479
1479
  ```bash
1480
1480
  # Extension's read tool replaces built-in read
package/docs/json.md CHANGED
@@ -19,7 +19,8 @@ type AgentSessionEvent =
19
19
  | { type: "auto_retry_end"; success: boolean; attempt: number; finalError?: string }
20
20
  | { type: "background_agent_start"; agentId: string; agentType: string; taskSummary: string }
21
21
  | { type: "background_agent_end"; agentId: string; agentType: string; success: boolean }
22
- | { type: "tasks_update"; tasks: readonly SessionTask[] };
22
+ | { type: "tasks_update"; tasks: readonly SessionTask[] }
23
+ | { type: "suggest_next"; command: string };
23
24
 
24
25
  // SessionTask shape:
25
26
  interface SessionTask {
package/docs/rpc.md CHANGED
@@ -535,6 +535,36 @@ Response:
535
535
 
536
536
  `contextUsage` is omitted when no model or context window is available. `contextUsage.tokens` and `contextUsage.percent` are `null` immediately after compaction until a fresh post-compaction assistant response provides valid usage data.
537
537
 
538
+ #### get_performance_stats
539
+
540
+ Get rolling performance statistics (tokens-per-second) for all models with recorded data.
541
+
542
+ ```json
543
+ {"type": "get_performance_stats"}
544
+ ```
545
+
546
+ Response:
547
+ ```json
548
+ {
549
+ "type": "response",
550
+ "command": "get_performance_stats",
551
+ "success": true,
552
+ "data": {
553
+ "models": [
554
+ {
555
+ "provider": "anthropic",
556
+ "modelId": "claude-sonnet-4",
557
+ "median": 31,
558
+ "mean": 32,
559
+ "count": 100
560
+ }
561
+ ]
562
+ }
563
+ }
564
+ ```
565
+
566
+ `models` contains per-model rolling averages computed from the agent's performance log. Each entry includes the median TPS, mean TPS, and number of recorded turns for that model. Returns an empty `models` array when no performance data has been recorded.
567
+
538
568
  #### export_html
539
569
 
540
570
  Export session to an HTML file.
package/docs/session.md CHANGED
@@ -416,3 +416,27 @@ Key methods for working with sessions programmatically.
416
416
  - `getSessionId()` - Session UUID
417
417
  - `getSessionFile()` - Session file path (undefined for in-memory)
418
418
  - `isPersisted()` - Whether session is saved to disk
419
+
420
+ ---
421
+
422
+ ## Performance Log
423
+
424
+ Assistant response performance is recorded to a JSONL file for rolling TPS statistics:
425
+
426
+ ```
427
+ ~/.dreb/agent/performance.jsonl
428
+ ```
429
+
430
+ Each line is a JSON object with the following fields:
431
+
432
+ | Field | Type | Description |
433
+ |-------|------|-------------|
434
+ | `timestamp` | ISO string | When the response completed |
435
+ | `sessionId` | string | Session that produced the response |
436
+ | `provider` | string | Model provider (e.g. `anthropic`) |
437
+ | `modelId` | string | Model identifier (e.g. `claude-sonnet-4`) |
438
+ | `outputTokens` | number | Output tokens from the response |
439
+ | `durationMs` | number | Response duration in milliseconds |
440
+ | `tps` | number | Computed tokens per second (`outputTokens * 1000 / durationMs`) |
441
+
442
+ Entries are written atomically with file locking for safe concurrent access. The log is pruned daily, removing entries older than 30 days. Responses with `stopReason` of `error` or `aborted`, zero output tokens, or durations under 10ms are not recorded.
package/docs/tui.md CHANGED
@@ -765,6 +765,14 @@ ctx.ui.setWidget("my-widget", undefined);
765
765
 
766
766
  **Examples:** [plan-mode.ts](../examples/extensions/plan-mode.ts)
767
767
 
768
+ ### Built-in Footer
769
+
770
+ The default footer shows three lines (when space allows):
771
+
772
+ 1. **Path** — Current working directory (with `~` for home), git branch in parentheses, and session name if set. Dimmed.
773
+ 2. **Stats** — Cumulative token usage (↑input ↓output Rread Wwrite), cost (with daily total when cross-session), and context-window percentage (colored red above 90%, yellow above 70%). When a model is selected and enough turns have been recorded, a rolling TPS suffix appears: `~31 tok/s [100] · 10% ↑ median [10000]`. The recent median (last 10 turns) is compared against the long-term baseline (last 10,000 turns). Dimmed.
774
+ 3. **Extension statuses** — Alphabetical list of persistent status texts set by extensions via `ctx.ui.setStatus()`.
775
+
768
776
  ### Pattern 6: Custom Footer
769
777
 
770
778
  Replace the footer. `footerData` exposes data not otherwise accessible to extensions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreb/coding-agent",
3
- "version": "2.16.0",
3
+ "version": "2.18.0",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "drebConfig": {