@dreb/coding-agent 2.46.0 → 2.48.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 (54) hide show
  1. package/README.md +4 -2
  2. package/dist/core/agent-session.d.ts +22 -0
  3. package/dist/core/agent-session.d.ts.map +1 -1
  4. package/dist/core/agent-session.js +109 -20
  5. package/dist/core/agent-session.js.map +1 -1
  6. package/dist/core/extensions/index.d.ts +1 -1
  7. package/dist/core/extensions/index.d.ts.map +1 -1
  8. package/dist/core/extensions/index.js.map +1 -1
  9. package/dist/core/extensions/runner.d.ts +7 -0
  10. package/dist/core/extensions/runner.d.ts.map +1 -1
  11. package/dist/core/extensions/runner.js +10 -0
  12. package/dist/core/extensions/runner.js.map +1 -1
  13. package/dist/core/extensions/types.d.ts +35 -0
  14. package/dist/core/extensions/types.d.ts.map +1 -1
  15. package/dist/core/extensions/types.js.map +1 -1
  16. package/dist/core/k3-context-tier.d.ts +67 -0
  17. package/dist/core/k3-context-tier.d.ts.map +1 -0
  18. package/dist/core/k3-context-tier.js +76 -0
  19. package/dist/core/k3-context-tier.js.map +1 -0
  20. package/dist/core/sdk.d.ts.map +1 -1
  21. package/dist/core/sdk.js +6 -1
  22. package/dist/core/sdk.js.map +1 -1
  23. package/dist/core/session-manager.d.ts.map +1 -1
  24. package/dist/core/session-manager.js +38 -2
  25. package/dist/core/session-manager.js.map +1 -1
  26. package/dist/core/tools/ask-user.d.ts +45 -0
  27. package/dist/core/tools/ask-user.d.ts.map +1 -0
  28. package/dist/core/tools/ask-user.js +210 -0
  29. package/dist/core/tools/ask-user.js.map +1 -0
  30. package/dist/core/tools/index.d.ts +11 -0
  31. package/dist/core/tools/index.d.ts.map +1 -1
  32. package/dist/core/tools/index.js +8 -0
  33. package/dist/core/tools/index.js.map +1 -1
  34. package/dist/modes/interactive/components/ask-user.d.ts +59 -0
  35. package/dist/modes/interactive/components/ask-user.d.ts.map +1 -0
  36. package/dist/modes/interactive/components/ask-user.js +240 -0
  37. package/dist/modes/interactive/components/ask-user.js.map +1 -0
  38. package/dist/modes/interactive/interactive-mode.d.ts +12 -0
  39. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  40. package/dist/modes/interactive/interactive-mode.js +99 -5
  41. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  42. package/dist/modes/rpc/rpc-mode.d.ts +16 -1
  43. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  44. package/dist/modes/rpc/rpc-mode.js +112 -59
  45. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  46. package/dist/modes/rpc/rpc-types.d.ts +24 -0
  47. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  48. package/dist/modes/rpc/rpc-types.js.map +1 -1
  49. package/docs/dashboard.md +1 -1
  50. package/docs/extensions.md +33 -3
  51. package/docs/providers.md +1 -0
  52. package/docs/rpc.md +46 -6
  53. package/docs/session.md +1 -1
  54. package/package.json +1 -1
package/README.md CHANGED
@@ -79,7 +79,7 @@ dreb
79
79
 
80
80
  Or use a custom provider (corporate proxy, Bedrock, etc.) — see [Custom providers & models](#providers--models).
81
81
 
82
- Then just talk to dreb. All 11 built-in tools are enabled by default: `read`, `write`, `edit`, `bash`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, and `wait`. Use `--tools` to restrict to a subset (e.g., `--tools read,grep,find,ls` for read-only). Three additional tools — `search`, `skill`, and `tasks_update` — are always active regardless of `--tools`. `suggest_next` is active by default but excluded when `--tools` is specified. The model uses these to fulfill your requests. Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [packages](#packages).
82
+ Then just talk to dreb. All 12 built-in tools are enabled by default: `read`, `write`, `edit`, `bash`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, `wait`, and `ask_user`. Use `--tools` to restrict to a subset (e.g., `--tools read,grep,find,ls` for read-only). Three additional tools — `search`, `skill`, and `tasks_update` — are always active regardless of `--tools`. `suggest_next` is active by default but excluded when `--tools` is specified. The model uses these to fulfill your requests. Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [packages](#packages).
83
83
 
84
84
  **Also available:** [`@dreb/telegram`](https://www.npmjs.com/package/@dreb/telegram) — run dreb as a Telegram bot with live tool status and visible results for user-facing tools (`npm install -g @dreb/telegram`). [`@dreb/dashboard`](https://www.npmjs.com/package/@dreb/dashboard) — run `dreb dashboard` for a browser UI with fleet overview, full chat steering, inline provider/API failures with partial output preserved, sanitized raster tool images plus sent user uploads retained as bounded transcript previews by default, subagent observability, host file browser, curated appearance themes (per-browser light/dark), and Tailscale/rotating-code pairing (`npm install -g @dreb/dashboard`; see [docs/dashboard.md](docs/dashboard.md)). Tool images cross browser-facing transport as content-addressed references; browser-local Settings offers placeholders, bounded previews, or informed-opt-in originals, with size disclosure and confirmation above 1 MiB. Full-resolution HTML export remains self-contained. Compact SSE snapshots update live fleet cards without repeatedly fetching the cross-project inventory, and session drill-in hydrates state, messages, and background agents through one ordered snapshot request. Terminal provider failures show their reason on fleet cards, while transient failures clear terminal state when automatic retry begins and remain recorded inline on the failed attempt. Its top bar and persistent session header indicators report connecting, connected, retrying, resyncing, disconnected, or auth failed; bounded SSE replay plus an explicit snapshot barrier restores session state, tasks, and image references after a reload, restart, gap, backpressure disconnect, or stalled stream, while authenticated image routes recover bytes separately from authoritative transcripts.
85
85
 
@@ -643,7 +643,9 @@ cat README.md | dreb -p "Summarize this text"
643
643
  | `--tools <list>` | Comma-separated list of tools to enable (default: all) |
644
644
  | `--no-tools` | Disable all built-in tools (extension tools still work) |
645
645
 
646
- Available built-in tools: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, `wait`, `search`
646
+ Available built-in tools: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, `wait`, `search`, `ask_user`
647
+
648
+ `ask_user` pauses the turn and asks you a structured clarifying question — Markdown-formatted question text, optional 2-4 multiple-choice options (single- or multi-select), and a "type your own answer" field — rendered natively in the TUI and the Dashboard, and over RPC. Answering submits the structured result; choosing **Stop agent** or pressing `Esc` aborts the whole current turn rather than continuing without an answer. Options must contain nonblank text. When there are no options the free-text field is always shown, so every question is answerable. An optional `timeoutSeconds` auto-stops the turn after the given number of seconds with a live countdown on every surface; recovered Dashboard sessions retain the original deadline rather than restarting it. Tool abort, timeout, host teardown, and headless/no-UI modes settle cleanly, so the agent never deadlocks waiting on an absent user. UI or response-protocol failures remain distinct from question closure. Concurrent `ask_user` calls are shown strictly one at a time (FIFO). In the TUI: `↑`/`↓` move between options and the free-text field, `Space` toggles a checkbox (multi-select), `Enter` submits, and `Esc` stops the turn. In the Dashboard: native radios/checkboxes plus a text field, an in-card **Stop agent** button that remains accessible on mobile, and `Esc` to stop.
647
649
 
648
650
  Three additional tools are always active but don't appear in `--tools`:
649
651
  - `skill` — invokes [skills](#skills) programmatically
@@ -94,6 +94,13 @@ export type AgentSessionEvent = AgentEvent | SubagentArbitrationEvent | {
94
94
  } | {
95
95
  type: "suggest_next";
96
96
  command: string;
97
+ } | {
98
+ /** The wire model tier auto-upgraded because the session context outgrew the smaller tier (e.g. Kimi K3 256k → 1M). */
99
+ type: "context_window_upgrade";
100
+ provider: string;
101
+ modelId: string;
102
+ fromContextWindow: number;
103
+ toContextWindow: number;
97
104
  };
98
105
  /** Listener function for agent session events */
99
106
  export type AgentSessionEventListener = (event: AgentSessionEvent) => void;
@@ -601,6 +608,21 @@ export declare class AgentSession {
601
608
  */
602
609
  abortBranchSummary(): void;
603
610
  private _checkCompaction;
611
+ /**
612
+ * Apply the K3 auto context tier to a model being set on the agent. The
613
+ * user-facing `k3` model runs on the cheaper `k3-256k` wire model ID until
614
+ * the session context grows past the 256k cutoff; no-op for other models.
615
+ * See k3-context-tier.ts.
616
+ */
617
+ private _applyContextTier;
618
+ /** Remove the last message from agent state when it is an assistant message. */
619
+ private _removeLastAssistantMessage;
620
+ /**
621
+ * Upgrade the K3 auto context tier from 256k to 1M. The Kimi backend
622
+ * upgrades the prompt cache seamlessly, so no context is lost or
623
+ * compacted. Returns true when the upgrade was applied.
624
+ */
625
+ private _tryUpgradeK3ContextTier;
604
626
  private _runAutoCompaction;
605
627
  /**
606
628
  * Toggle auto-compaction setting.