@dreb/coding-agent 2.66.0 → 2.66.1

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.
@@ -36,7 +36,7 @@ By default, `reserveTokens` is 16384 tokens (configurable in `~/.dreb/agent/sett
36
36
 
37
37
  The threshold is checked after a run ends, before a new prompt, and inside a running agent loop before each LLM request. Mid-turn checks run only when context is settled on a user or tool-result message, after all tool calls from the preceding assistant message have matching results. If the threshold is crossed, dreb compacts and replaces the running loop's context before that loop makes its next request; it does not start a second agent run.
38
38
 
39
- If response-length retries are exhausted, dreb distinguishes a genuine output-budget failure from a full-context truncation using recorded usage. Usage at or beyond `contextWindow` enters overflow compact-and-retry recovery; usage below it remains a loud output-budget error.
39
+ When a response reaches its configured output limit, length retries discard the partial response and retry at that same configured limit; they never increase `maxTokens`. After those retries are exhausted, dreb distinguishes a genuine output-budget failure from possible context pressure. It enters one reactive compact-and-retry recovery only when the provider reports context exhaustion, recorded usage reaches `contextWindow`, or the measured request input plus configured output maximum could not fit in the window. Otherwise the turn fails loudly without discarding conversation history. This reactive recovery does not change the proactive threshold above: a large theoretical output maximum alone never triggers early compaction.
40
40
 
41
41
  You can also trigger manually with `/compact [instructions]`, where optional instructions focus the summary.
42
42
 
@@ -524,13 +524,11 @@ dreb.on("stream_retry", async (event, ctx) => {
524
524
 
525
525
  #### length_retry
526
526
 
527
- Fired when a turn ends with `stopReason: "length"` (the model exhausted its output token budget mid-response) and dreb discards the truncated partial before retrying with a larger `maxTokens` budget. If all retries are exhausted (or the budget already sits at the model's ceiling), the turn fails loudly instead with an error message ("Response truncated at token limit after N attempts") rather than returning a silently truncated response.
527
+ Fired when a turn ends with `stopReason: "length"` (the model exhausted its configured output limit mid-response) and dreb discards the truncated partial before retrying at that same configured limit. If all retries are exhausted, the agent loop fails loudly with an error message ("Response truncated at the configured output token limit after N attempts") rather than returning a silently truncated response. The session layer may then perform one compact-and-retry recovery when provider evidence or input-plus-output arithmetic indicates that remaining context, rather than the output limit alone, caused the truncation.
528
528
 
529
529
  ```typescript
530
530
  dreb.on("length_retry", async (event, ctx) => {
531
- // event.attempt, event.maxAttempts
532
- // event.previousMaxTokens - the budget used for the truncated attempt
533
- // event.nextMaxTokens - the escalated budget the retry will request
531
+ // event.attempt, event.maxAttempts, event.maxTokens
534
532
  // event.discardedPartial - partial assistant message discarded before retry (debug/instrumentation only)
535
533
  });
536
534
  ```
package/docs/models.md CHANGED
@@ -200,12 +200,14 @@ Leave `authHeader` unset or `false` for endpoints that expect `x-api-key`.
200
200
  | `reasoning` | No | `false` | Supports extended thinking |
201
201
  | `input` | No | `["text"]` | Input types: `["text"]` or `["text", "image"]` |
202
202
  | `contextWindow` | No | `128000` | Context window size in tokens |
203
- | `maxTokens` | No | `16384` | Maximum output tokens |
203
+ | `maxTokens` | No | `16384` | Ordinary request maximum output tokens, including per-model overrides; explicit bounded internal calls may use less |
204
204
  | `cost` | No | all zeros | `{"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}` (per million tokens) |
205
205
  | `compat` | No | provider `compat` | OpenAI compatibility overrides. Merged with provider-level `compat` when both are set. |
206
206
  | `systemPrompt` | No | — | Replace dreb's built-in prompt whenever this exact custom model is active. Mutually exclusive with `appendSystemPrompt`. |
207
207
  | `appendSystemPrompt` | No | — | Preserve the selected base prompt and append model-specific instructions. Mutually exclusive with `systemPrompt`. |
208
208
 
209
+ `maxTokens` is sent as the ordinary request's output maximum; dreb does not reserve or pre-consume that allowance, and providers charge only for tokens actually generated. Purpose-specific internal calls may pass a smaller explicit limit. The ChatGPT-backed `openai-codex` protocol rejects `max_output_tokens`, so its built-in ceiling remains server-controlled and dreb rejects `maxTokens` overrides for that provider rather than silently ignoring them.
210
+
209
211
  Current behavior:
210
212
  - `/model` and `--list-models` list entries by model `id`.
211
213
  - The configured `name` is used for model matching and detail/status text.
@@ -287,7 +289,7 @@ Use `modelOverrides` to customize specific built-in models without replacing the
287
289
  }
288
290
  ```
289
291
 
290
- `modelOverrides` supports these fields per model: `name`, `reasoning`, `input`, `cost` (partial), `contextWindow`, `maxTokens`, `headers`, `compat`, `systemPrompt`, `appendSystemPrompt`.
292
+ `modelOverrides` supports these fields per model: `name`, `reasoning`, `input`, `cost` (partial), `contextWindow`, `maxTokens`, `headers`, `compat`, `systemPrompt`, `appendSystemPrompt`. The ChatGPT-backed `openai-codex` protocol rejects `max_output_tokens`, so dreb rejects `maxTokens` overrides for that provider rather than silently ignoring them; its built-in model ceiling remains server-controlled.
291
293
 
292
294
  Prompt fields follow the same rules as custom model entries: choose replacement or append,
293
295
  not both; use a non-empty string; and do not also configure prompt behavior for the canonical
package/docs/rpc.md CHANGED
@@ -1770,7 +1770,7 @@ Response:
1770
1770
  | `tool_execution_update` | Tool execution progress (streaming output) |
1771
1771
  | `tool_execution_end` | Tool completes |
1772
1772
  | `stream_retry` | Stream dropped mid-turn; retrying (partial output discarded) |
1773
- | `length_retry` | Response hit the token limit; retrying with a larger budget |
1773
+ | `length_retry` | Response hit the token limit; retrying at the configured output limit |
1774
1774
  | `auto_compaction_start` | Auto-compaction begins |
1775
1775
  | `auto_compaction_end` | Auto-compaction completes |
1776
1776
  | `context_window_upgrade` | Wire model tier auto-upgraded (e.g. Kimi K3 256k → 1M); includes `provider`, `modelId`, `fromContextWindow`, `toContextWindow` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreb/coding-agent",
3
- "version": "2.66.0",
3
+ "version": "2.66.1",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "drebConfig": {