fascicle 0.14.0 → 0.15.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/CHANGELOG.md +36 -0
- package/dist/acp.d.ts +8 -1
- package/dist/acp.js +62 -29
- package/dist/acp.js.map +1 -1
- package/dist/agents.d.ts +1 -1
- package/dist/{engine-BDWB2jdn.js → engine-ha9xmgwE.js} +520 -454
- package/dist/engine-ha9xmgwE.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{invoke-tjTjZLHj.js → invoke-px31fffH.js} +96 -25
- package/dist/invoke-px31fffH.js.map +1 -0
- package/dist/{json_schema_to_standard-r21kW2LI.js → json_schema_to_standard-BTWD0J6p.js} +3 -21
- package/dist/json_schema_to_standard-BTWD0J6p.js.map +1 -0
- package/dist/{leading_system-BQe_405V.js → leading_system-DfJLqpGi.js} +256 -2
- package/dist/leading_system-DfJLqpGi.js.map +1 -0
- package/dist/mcp.d.ts +4 -4
- package/dist/mcp.js +4 -3
- package/dist/mcp.js.map +1 -1
- package/dist/records-1HU7mWXf.js +22 -0
- package/dist/records-1HU7mWXf.js.map +1 -0
- package/dist/{search-CqH5hmuF.js → search-CA_OqFeW.js} +22 -6
- package/dist/{search-CqH5hmuF.js.map → search-CA_OqFeW.js.map} +1 -1
- package/dist/search_worker.js +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/{types-C_Rmcgck.d.ts → types-De-TVQxS.d.ts} +43 -4
- package/package.json +1 -1
- package/dist/engine-BDWB2jdn.js.map +0 -1
- package/dist/invoke-tjTjZLHj.js.map +0 -1
- package/dist/json_schema_to_standard-r21kW2LI.js.map +0 -1
- package/dist/leading_system-BQe_405V.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.15.0 — 2026-10-17
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **OpenRouter's reasoning shows on `transport: 'native'`.** The openrouter dialect reads the `reasoning_details` that OpenRouter sends, streamed or not. Each entry's text reaches `on_chunk` as `reasoning` chunks, so Zed's thought block and `fascicle/ui` show what the model reasoned, and each entry becomes a reasoning part that carries the entry itself. Before this, the dialect counted reasoning tokens and showed nothing.
|
|
8
|
+
- **A tool loop sends each model its own reasoning back, on both transports.** `AssistantContentPart` gains a `reasoning` kind, and every kind takes `provider_options`, the data that its provider wants back (a thinking block's signature, an OpenRouter reasoning entry, Gemini's thought signature on a tool call), keyed by provider name. `TurnResult.content` holds a turn's parts in the order that the provider sent them, and the loop builds the next assistant message from it. `openrouter` native sends its entries back as `reasoning_details`, `anthropic` native sends each `thinking` and `redacted_thinking` block back as it came, and the `ai_sdk` transport gives every part's `providerMetadata` back as its `providerOptions`. Each provider gets back only the reasoning keyed with its own name, so a `fallback` never hands one vendor's signature to another. Until now every transport dropped a turn's reasoning between steps, so a Claude loop lost its thinking without a word and a Gemini 3 loop could be refused. `ProviderOptions`, the shape that every part's `provider_options` takes, is a named export now, and `docs/providers.md` gains a Reasoning in a Tool Loop section.
|
|
9
|
+
- **OpenRouter's reported charge becomes the step's cost.** On `transport: 'native'`, the openrouter dialect reads the cost that OpenRouter reports on every response into `TurnResult.reported_cost_usd`, and the loop records it as the step's cost, split across input, output, and cache tokens by their weight, with the `cost` event's `source` set to `'provider_reported'`. A BYOK request counts the provider's charge (`cost_details.upstream_inference_cost`) as well as OpenRouter's fee. `GenerateResult.cost`, `cost` events, and every budget built on them now work on OpenRouter, where each step used to emit `pricing_missing` and record no cost. A reported charge wins over a pricing row, and `provider_reported.openrouter` keeps `cost`, `is_byok`, and `cost_details` as OpenRouter sent them.
|
|
10
|
+
- **A custom `ai_sdk` adapter can hand effort to the SDK and keep its reasoning.** `EffortTranslation` gains `reasoning`, a level for the AI SDK's own `reasoning` option, and `AiSdkProviderAdapter` gains `metadata_key`, the key that its package writes `providerMetadata` under, which defaults to `name`. A custom adapter over `@ai-sdk/anthropic` that runs under a name of its own sets `metadata_key: 'anthropic'`, or its reasoning stays behind.
|
|
11
|
+
- **`examples/acp-coder` takes `--effort <level>`.** It's unset by default, because Claude Sonnet 5.5 decides on its own when to think and OpenRouter returns a summary of it, so Zed already shows a thought block. `--effort high` asks for more thinking, more often. An unknown level stops the agent at startup with a message that lists the levels it takes.
|
|
12
|
+
- **`workspace_tools` takes `search_timeout_ms`.** Every search had the same 30 seconds to finish, and a repository that's too large to search in that time can now have longer. The budget is still what turns a pattern stuck backtracking into a tool error that the model can act on, and 30 seconds stays the default.
|
|
13
|
+
- **A read, a listing, and a search show their results on their cards.** `read_file`, `list_files`, and `search` cards used to close with `rawOutput` alone, so Zed showed the call's title and nothing under it. Each card now closes with the text that the model read, in a code block whose fence outruns any backtick run in it, the way Claude Agent shows a read. A listing or a search goes in a code block as well, where Claude Agent shows plain text, because a matching line can hold markdown that Zed would render. `rawOutput` stays for the hosts that read it, and a failed call keeps its error text.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **`anthropic` native sends effort as adaptive thinking.** Effort `low` through `max` becomes `thinking: { type: 'adaptive', display: 'summarized' }` and `output_config: { effort }`, with the level as it is, in place of a thinking budget, and effort `none` sends neither. The `max_tokens` default keeps its numbers, and sampling parameters still apply only with effort `none`. A model older than Claude 4.6 refuses adaptive thinking, so effort on those models stops working on native. Set `effort: 'none'` and pass a budget as `provider_options.anthropic.thinking`, or use the `ai_sdk` transport, whose peer still sends those models a budget.
|
|
18
|
+
- **Effort on the `ai_sdk` transport goes through the AI SDK's own `reasoning` option.** `anthropic`, `bedrock`, `google`, and `openai` hand the level to `generateText` and `streamText` and build none of it into their provider options, so each provider package maps it per model from a table that it keeps, and Fascicle's budget tables and its OpenAI clamp are gone. That changes what some levels send. Claude 4.6 and later get adaptive thinking with an effort on `anthropic` and `bedrock`, Gemini 3 gets a `thinkingLevel` and Gemini 2.5 a budget that the peer works out, and OpenAI gets `xhigh` and `max` as they are, where they used to clamp to `high`. The Anthropic and Bedrock peers, and Google's for Gemini 3, have no mapping for `max`, so a call at `max` runs at the model's default effort, with an SDK warning that Fascicle doesn't surface. `openrouter` still sends `reasoning: { effort }`, and a caller's `provider_options` still merge over the translation.
|
|
19
|
+
- **`openrouter` native sends effort as `reasoning: { effort }`.** It used to send the flat `reasoning_effort`, clamped to `high`, and now sends the nested object that the `ai_sdk` transport sends, with every level passed through. An override in `provider_options.openrouter.reasoning_effort` should move to `reasoning`, which replaces the derived object whole. `openai` and `lmstudio` native still send the flat field.
|
|
20
|
+
- **`AssistantContentPart` has a third kind.** Code that treats an assistant message's parts as text or else a tool call, in a custom native adapter or a `prepare_step` hook, now sends a `reasoning` part down its tool-call branch. TypeScript catches most of it, since a reasoning part has no `id`. Give `reasoning` a branch of its own that drops the part unless it carries your own provider's key. An assistant turn that carries reasoning or provider data also reaches history as an array of parts even when it called no tools, where it used to be a string.
|
|
21
|
+
- **OpenAI on `ai_sdk` sends references to its stored responses in a tool loop.** The loop now gives the Responses API's item ids back, so while `store` is on, `@ai-sdk/openai` sends each earlier part as a reference to the stored response instead of its content, which is what keeps OpenAI's reasoning across a loop. An organization whose responses aren't stored sets `provider_options.openai.store: false`, and the peer sends the content and the encrypted reasoning itself.
|
|
22
|
+
- **`list_files` returns at most 1,000 paths a call.** Past that, it returns the first 1,000 in sorted order and a note with the total, in the form that `read_file` and `search` already use, so the model knows to narrow its pattern or path. A listing of a very large repository used to come back whole, however much of the context it took. The tool's description states the cap.
|
|
23
|
+
- **`write_file` and `edit_file` refuse a file over a megabyte.** Both read the whole file that they change, to show the change as a diff, and a diff carries that text twice, with the card's closing update carrying it a third time. A file over 1,000,000 bytes is now refused from its size before it's opened, with a message that points the model at `run_command`, and the permission prompt shows the refusal in place of the diff. A file at the limit works as before.
|
|
24
|
+
- **`fascicle/mcp` exports `ServeFlowConfig` in place of `ServeFlowOptions`.** Fascicle names the type of a required argument `*Config` and an optional one `*Options`, and `serve_flow`'s argument is required, so the type and the parameter are both `config` now. The old name goes without an alias, since the surface is pre-1.0, so code that imports `ServeFlowOptions` imports `ServeFlowConfig` instead.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- **A turn's history keeps reply text apart across a tool card.** The text before a tool call and the text after it were recorded with nothing between them, so the next turn's history read "...tool calls.All tests pass". The second run now starts on a blank line. What the client is sent is unchanged, since Zed already shows the two runs as separate messages.
|
|
29
|
+
- **`examples/pr-improve`'s `edit_file` writes a replacement as the model gave it.** When `find` matched once, the tool replaced it with `String.prototype.replace`, which reads `$&`, `$$`, and their kin in the replacement as patterns even when the search is a plain string. A shell snippet or a regular expression that the model wrote into a file was changed on its way in. A single match now splits and joins the way `replace_all` already did, and the way `fascicle/acp`'s `edit_file` does.
|
|
30
|
+
- **`anthropic` native finishes a turn that OpenRouter streams.** OpenRouter's Anthropic-compatible Messages endpoint ends every stream the way a chat-completions stream ends, with a `data: [DONE]` line after `message_stop`. The adapter read that line as an event that wasn't JSON and failed a turn that had already arrived in full. It now skips the line, and any other data that isn't JSON still fails the turn.
|
|
31
|
+
- **Effort works on current Claude models, on every transport.** Every Claude model from 4.7 on refuses `thinking: { type: 'enabled', budget_tokens }` with a 400, and that's what `anthropic` native, `anthropic` on `ai_sdk`, and `bedrock` all sent for any effort but `none`. Each one now sends adaptive thinking with an effort, as the Changed entries above describe.
|
|
32
|
+
- **A failure that a compatible server reports mid-stream says what went wrong.** OpenRouter reports an error that happens after a stream started as a frame with a top-level `error`, under the HTTP 200 that the stream began with. The core ignored that frame, so the turn failed as a truncated stream or a missing usage object, and OpenRouter's message was lost. It now throws a `provider_error` that carries the server's message, with the error's code as `status` when the code is a number, on every dialect. Before any chunk has streamed, a 429 or a 5xx retries the way the same HTTP status does, and after one, the turn fails as a stream interruption that names the message.
|
|
33
|
+
|
|
34
|
+
### Internal
|
|
35
|
+
|
|
36
|
+
- A live reasoning check, `src/engine/__tests__/live/live_reasoning.test.ts`, runs a three-step tool loop on OpenRouter, and on Claude through OpenRouter's Messages endpoint, and asserts that each request carries the last turn's reasoning back and that each OpenRouter run's cost matches the charges it reported. It's opt-in (`LIVE_TESTS=1` and `OPENROUTER_API_KEY`), so `pnpm check` skips it.
|
|
37
|
+
- The live smoke gains Claude Sonnet 5.5 on `anthropic` native and on `ai_sdk`, both through OpenRouter, and each of its cases names its provider beside the model id. CONTRIBUTING.md names the key for both.
|
|
38
|
+
|
|
3
39
|
## v0.14.0 — 2026-10-16
|
|
4
40
|
|
|
5
41
|
### Added
|
package/dist/acp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as Step, h as TrajectoryLogger, m as TrajectoryEvent } from "./types-CPqLZOEr.js";
|
|
2
|
-
import { D as
|
|
2
|
+
import { D as Tool, O as ToolApprovalHandler } from "./types-De-TVQxS.js";
|
|
3
3
|
import { AgentApp, ClientCapabilities, ContentBlock, SessionUpdate } from "@agentclientprotocol/sdk";
|
|
4
4
|
//#region src/acp/types.d.ts
|
|
5
5
|
/**
|
|
@@ -115,6 +115,13 @@ type WorkspaceToolsOptions = {
|
|
|
115
115
|
readonly read_limit_lines?: number | undefined;
|
|
116
116
|
/** Names `list_files` and `search` skip wherever they appear in a path; default: `['.git', 'node_modules']`. */
|
|
117
117
|
readonly ignore?: ReadonlyArray<string> | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* How long one `search` may run, its worker's start included, before it's
|
|
120
|
+
* stopped; default: 30_000. The budget is what turns a pattern stuck
|
|
121
|
+
* backtracking into an error the model can act on, and a large repository
|
|
122
|
+
* may need longer to read.
|
|
123
|
+
*/
|
|
124
|
+
readonly search_timeout_ms?: number | undefined;
|
|
118
125
|
/**
|
|
119
126
|
* How long one `run_command` call may run before its process group is
|
|
120
127
|
* killed, unless the call sets its own `timeout_ms`; default: 120_000.
|
package/dist/acp.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { E as run, k as aborted_error } from "./core-CDrz0NM1.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { t as as_record } from "./records-1HU7mWXf.js";
|
|
3
|
+
import { t as json_schema_to_standard } from "./json_schema_to_standard-BTWD0J6p.js";
|
|
4
|
+
import { a as read_file_tool, c as resolve_roots, i as is_binary, l as shown_path, n as search_tool, o as contain, r as list_files_tool, s as error_code } from "./search-CA_OqFeW.js";
|
|
4
5
|
import { randomUUID } from "node:crypto";
|
|
5
6
|
import { mkdir, open, stat, writeFile } from "node:fs/promises";
|
|
6
7
|
import { dirname, resolve } from "node:path";
|
|
@@ -158,8 +159,9 @@ function take_preview(session, tool_call_id) {
|
|
|
158
159
|
* call (`Read src/a.ts (1 - 40)`, `grep "todo" src`, the command line) with
|
|
159
160
|
* its paths relative to `cwd`, and the places it touches as locations, whose
|
|
160
161
|
* lines count from 1 as Claude Agent's do. A write's or an edit's card shows
|
|
161
|
-
* its diff once the call lands,
|
|
162
|
-
*
|
|
162
|
+
* its diff once the call lands, a read's, a listing's, or a search's shows
|
|
163
|
+
* the text the model read in a code block, and a command's shows what it
|
|
164
|
+
* printed: in a terminal when the client advertises Zed's terminal extension
|
|
163
165
|
* (`_meta.terminal_output`), and as a `console` code block otherwise.
|
|
164
166
|
*
|
|
165
167
|
* It's keyed by tool name, since nothing ACP-specific may reach the engine's
|
|
@@ -251,15 +253,18 @@ function describe_command({ command }) {
|
|
|
251
253
|
const PRESENTERS = /* @__PURE__ */ new Map([
|
|
252
254
|
["read_file", {
|
|
253
255
|
kind: "read",
|
|
254
|
-
describe: describe_read
|
|
256
|
+
describe: describe_read,
|
|
257
|
+
shows: "text"
|
|
255
258
|
}],
|
|
256
259
|
["list_files", {
|
|
257
260
|
kind: "search",
|
|
258
|
-
describe: describe_find
|
|
261
|
+
describe: describe_find,
|
|
262
|
+
shows: "text"
|
|
259
263
|
}],
|
|
260
264
|
["search", {
|
|
261
265
|
kind: "search",
|
|
262
|
-
describe: describe_grep
|
|
266
|
+
describe: describe_grep,
|
|
267
|
+
shows: "text"
|
|
263
268
|
}],
|
|
264
269
|
["write_file", {
|
|
265
270
|
kind: "edit",
|
|
@@ -349,22 +354,35 @@ function close_change(closing, preview) {
|
|
|
349
354
|
};
|
|
350
355
|
}
|
|
351
356
|
/**
|
|
352
|
-
* Text in a `
|
|
353
|
-
* backticks that opens one of its lines, so nothing the
|
|
354
|
-
*
|
|
357
|
+
* Text in a code block under the `info` string, its fence longer than any
|
|
358
|
+
* run of backticks that opens one of its lines, so nothing in the text can
|
|
359
|
+
* close the block early.
|
|
355
360
|
*/
|
|
356
|
-
function
|
|
361
|
+
function code_block(text, info) {
|
|
357
362
|
const longest = Math.max(2, ...Array.from(text.matchAll(/^`+/gm), ([run]) => run.length));
|
|
358
363
|
const fence = "`".repeat(longest + 1);
|
|
359
364
|
return {
|
|
360
365
|
type: "content",
|
|
361
366
|
content: {
|
|
362
367
|
type: "text",
|
|
363
|
-
text: `${fence}
|
|
368
|
+
text: `${fence}${info}\n${text}\n${fence}`
|
|
364
369
|
}
|
|
365
370
|
};
|
|
366
371
|
}
|
|
367
372
|
/**
|
|
373
|
+
* Close a read's, a listing's, or a search's card with the text the model
|
|
374
|
+
* read. A listing or a search result goes in a code block too, since a
|
|
375
|
+
* matching line can hold markdown that the client would otherwise render.
|
|
376
|
+
* A failed call keeps its error text.
|
|
377
|
+
*/
|
|
378
|
+
function close_text(closing, chunk) {
|
|
379
|
+
if (chunk.error !== void 0) return closing;
|
|
380
|
+
return {
|
|
381
|
+
...closing,
|
|
382
|
+
content: [code_block(String(chunk.output), "")]
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
368
386
|
* How a command's terminal ends: what it printed and how it exited, or, for
|
|
369
387
|
* a call that failed or left nothing behind, the error text and no exit
|
|
370
388
|
* code.
|
|
@@ -389,7 +407,7 @@ function close_command(session, card, chunk, closing, preview) {
|
|
|
389
407
|
if (chunk.error !== void 0) return [closing];
|
|
390
408
|
return [{
|
|
391
409
|
...closing,
|
|
392
|
-
content: [
|
|
410
|
+
content: [code_block(String(chunk.output), "console")]
|
|
393
411
|
}];
|
|
394
412
|
}
|
|
395
413
|
const { output, exit_code, signal } = ran(chunk, preview);
|
|
@@ -412,13 +430,15 @@ function close_command(session, card, chunk, closing, preview) {
|
|
|
412
430
|
}
|
|
413
431
|
/**
|
|
414
432
|
* The updates that close a tool call's card, starting from the plain
|
|
415
|
-
* `closing` update. A
|
|
416
|
-
*
|
|
417
|
-
*
|
|
433
|
+
* `closing` update. A read, a listing, or a search leaves no preview, so its
|
|
434
|
+
* card takes nothing from the session's store. A successful call of a tool
|
|
435
|
+
* that leaves a preview takes it from the store whatever the card then does
|
|
436
|
+
* with it, which keeps each raw id's queue in step with its results.
|
|
418
437
|
*/
|
|
419
438
|
function closing_updates(session, name, card, chunk, closing) {
|
|
420
439
|
const shows = PRESENTERS.get(name)?.shows;
|
|
421
440
|
if (session === void 0 || shows === void 0) return [closing];
|
|
441
|
+
if (shows === "text") return [close_text(closing, chunk)];
|
|
422
442
|
const preview = chunk.error === void 0 ? take_preview(session, chunk.id) : void 0;
|
|
423
443
|
if (shows === "change") return [close_change(closing, preview)];
|
|
424
444
|
return close_command(session, card, chunk, closing, preview);
|
|
@@ -439,6 +459,12 @@ function closing_updates(session, name, card, chunk, closing) {
|
|
|
439
459
|
* `src/new/thing.ts` doesn't need a command to make `src/new` first.
|
|
440
460
|
*/
|
|
441
461
|
/**
|
|
462
|
+
* The largest file a change reads, in bytes. A change is shown as a diff,
|
|
463
|
+
* which carries the file's whole text twice, as its text before and after,
|
|
464
|
+
* and the closing card update carries it again.
|
|
465
|
+
*/
|
|
466
|
+
const CHANGE_LIMIT_BYTES = 1e6;
|
|
467
|
+
/**
|
|
442
468
|
* Read the call's path and content out of its input.
|
|
443
469
|
*/
|
|
444
470
|
function write_request(input) {
|
|
@@ -455,8 +481,9 @@ function write_request(input) {
|
|
|
455
481
|
* shown as a diff of text, and rewriting a file in another encoding would
|
|
456
482
|
* change bytes outside the edit. A file with other hard links is refused too:
|
|
457
483
|
* a write changes the file under every name it has, and real paths can't say
|
|
458
|
-
* where the other names lie.
|
|
459
|
-
* `
|
|
484
|
+
* where the other names lie. A file over CHANGE_LIMIT_BYTES is refused from
|
|
485
|
+
* its size, before it's opened. `shown` is the path as the model gave it,
|
|
486
|
+
* and `tool` names the tool asking, for the refusals.
|
|
460
487
|
*/
|
|
461
488
|
async function current_text(real, shown, tool) {
|
|
462
489
|
const info = await stat(real).catch((err) => {
|
|
@@ -467,6 +494,7 @@ async function current_text(real, shown, tool) {
|
|
|
467
494
|
if (info.isDirectory()) throw new Error(`${shown} is a directory; ${tool} changes a file, so name one inside it`);
|
|
468
495
|
if (!info.isFile()) throw new Error(`${shown} isn't a regular file, so ${tool} can't change it`);
|
|
469
496
|
if (info.nlink > 1) throw new Error(`${shown} is one of ${info.nlink} hard links to the same file, and the rest may lie outside the workspace, so ${tool} won't change it`);
|
|
497
|
+
if (info.size > CHANGE_LIMIT_BYTES) throw new Error(`${shown} is ${info.size} bytes, over the ${CHANGE_LIMIT_BYTES} that write_file and edit_file read to show a change as a diff; change it with run_command instead`);
|
|
470
498
|
const handle = await open(real);
|
|
471
499
|
try {
|
|
472
500
|
if (await is_binary(handle)) throw new Error(`${shown} is a binary file (it has a NUL byte in its first 8 KB), so ${tool} won't change it`);
|
|
@@ -1149,12 +1177,18 @@ function agent_message(text) {
|
|
|
1149
1177
|
/**
|
|
1150
1178
|
* Count a message update the client was sent toward the turn's reply. Only
|
|
1151
1179
|
* text joins the reply's text, but any message counts as a reply, so a flow
|
|
1152
|
-
* that sent an image doesn't get a `to_text` message after it.
|
|
1180
|
+
* that sent an image doesn't get a `to_text` message after it. A tool card
|
|
1181
|
+
* that opened after some reply text splits the reply in two on the client,
|
|
1182
|
+
* so the recorded text starts the next run on a blank line instead of
|
|
1183
|
+
* running the two together.
|
|
1153
1184
|
*/
|
|
1154
1185
|
function note_reply(reply, update) {
|
|
1186
|
+
if (update.sessionUpdate === "tool_call" && reply.text !== "") reply.card_since_text = true;
|
|
1155
1187
|
if (update.sessionUpdate !== "agent_message_chunk") return;
|
|
1156
1188
|
reply.sent = true;
|
|
1157
|
-
if (update.content.type
|
|
1189
|
+
if (update.content.type !== "text" || update.content.text === "") return;
|
|
1190
|
+
reply.text += reply.card_since_text ? `\n\n${update.content.text}` : update.content.text;
|
|
1191
|
+
reply.card_since_text = false;
|
|
1158
1192
|
}
|
|
1159
1193
|
/**
|
|
1160
1194
|
* Append a turn to the session's history: the user's text, then the reply
|
|
@@ -1233,7 +1267,8 @@ async function run_turn(config, record, prompt, cancelled, send) {
|
|
|
1233
1267
|
};
|
|
1234
1268
|
const reply = {
|
|
1235
1269
|
sent: false,
|
|
1236
|
-
text: ""
|
|
1270
|
+
text: "",
|
|
1271
|
+
card_since_text: false
|
|
1237
1272
|
};
|
|
1238
1273
|
const send_update = async (update) => {
|
|
1239
1274
|
await send(update);
|
|
@@ -1835,14 +1870,12 @@ function run_command_tool(session, settings) {
|
|
|
1835
1870
|
//#region src/acp/workspace_tools.ts
|
|
1836
1871
|
/** The most lines one `read_file` call returns unless the options say otherwise. */
|
|
1837
1872
|
const READ_LIMIT_LINES = 2e3;
|
|
1873
|
+
/** The most paths one `list_files` call returns, so a very large repository's listing can't fill the context. */
|
|
1874
|
+
const LIST_LIMIT = 1e3;
|
|
1838
1875
|
/** The names `list_files` and `search` skip unless the options say otherwise. */
|
|
1839
1876
|
const IGNORE = [".git", "node_modules"];
|
|
1840
|
-
/**
|
|
1841
|
-
|
|
1842
|
-
* stopped. Long enough to read a large repository, and short enough that a
|
|
1843
|
-
* pattern stuck backtracking comes back as an error the model can act on.
|
|
1844
|
-
*/
|
|
1845
|
-
const SEARCH_BUDGET_MS = 3e4;
|
|
1877
|
+
/** How long one `search` may run unless the options say otherwise. */
|
|
1878
|
+
const SEARCH_TIMEOUT_MS = 3e4;
|
|
1846
1879
|
/** How long one `run_command` call may run unless the options or the call say otherwise. */
|
|
1847
1880
|
const COMMAND_TIMEOUT_MS = 12e4;
|
|
1848
1881
|
/** The most output one `run_command` call returns unless the options say otherwise. */
|
|
@@ -1869,8 +1902,8 @@ function workspace_tools(session, options = {}) {
|
|
|
1869
1902
|
const ignore = options.ignore ?? IGNORE;
|
|
1870
1903
|
return [
|
|
1871
1904
|
read_file_tool(session, options.read_limit_lines ?? READ_LIMIT_LINES),
|
|
1872
|
-
list_files_tool(session, ignore),
|
|
1873
|
-
search_tool(session, ignore,
|
|
1905
|
+
list_files_tool(session, ignore, LIST_LIMIT),
|
|
1906
|
+
search_tool(session, ignore, options.search_timeout_ms ?? SEARCH_TIMEOUT_MS),
|
|
1874
1907
|
gated(write_file_tool(session), session, "edit"),
|
|
1875
1908
|
gated(edit_file_tool(session), session, "edit"),
|
|
1876
1909
|
gated(run_command_tool(session, {
|