fascicle 0.16.5 → 0.17.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.
- package/CHANGELOG.md +57 -0
- package/README.md +3 -2
- package/dist/AGENTS.md +69 -18
- package/dist/acp.d.ts +1 -1
- package/dist/acp.js +7 -2
- package/dist/acp.js.map +1 -1
- package/dist/agents.d.ts +1 -1
- package/dist/{engine-B6rIIM4J.js → engine-Bde18P7H.js} +1163 -236
- package/dist/engine-Bde18P7H.js.map +1 -0
- package/dist/index.d.ts +114 -16
- package/dist/index.js +226 -16
- package/dist/index.js.map +1 -1
- package/dist/{invoke-LbzZLZFw.js → invoke-BbJLQcLl.js} +62 -106
- package/dist/invoke-BbJLQcLl.js.map +1 -0
- package/dist/{leading_system-WhW76tRn.js → leading_system-DmNxhvzL.js} +45 -16
- package/dist/leading_system-DmNxhvzL.js.map +1 -0
- package/dist/mcp.d.ts +2 -1
- package/dist/mcp.js +6 -3
- package/dist/mcp.js.map +1 -1
- package/dist/otel.js +48 -3
- package/dist/otel.js.map +1 -1
- package/dist/{search-CpCJYMUm.js → search-DjhdMsJ8.js} +4 -1
- package/dist/search-DjhdMsJ8.js.map +1 -0
- package/dist/search_worker.js +1 -1
- package/dist/testing.d.ts +77 -2
- package/dist/testing.js +202 -19
- package/dist/testing.js.map +1 -1
- package/dist/{types-Sw0oHW-_.d.ts → types-C7pO0jLq.d.ts} +218 -21
- package/dist/viewer-app/assets/index-9eVv6Mar.css +1 -0
- package/dist/viewer-app/assets/index-BkS2ZQu0.js +4 -0
- package/dist/viewer-app/index.html +2 -2
- package/dist/viewer.d.ts +64 -10
- package/dist/viewer.js +265 -64
- package/dist/viewer.js.map +1 -1
- package/package.json +1 -1
- package/dist/engine-B6rIIM4J.js.map +0 -1
- package/dist/invoke-LbzZLZFw.js.map +0 -1
- package/dist/leading_system-WhW76tRn.js.map +0 -1
- package/dist/search-CpCJYMUm.js.map +0 -1
- package/dist/viewer-app/assets/index-Cev83tcH.css +0 -1
- package/dist/viewer-app/assets/index-D8UmFVfR.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.17.1 — 2026-10-26
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **The viewer can read a trajectory without following a link.** A host that checked a run's `trajectory.jsonl` before it started a viewer couldn't keep that check true, because the tail and `/api/trajectory` opened the path again on every read and followed a link there, so a link that was swapped in afterwards, such as one that points at `~/.ssh/id_ed25519`, was read and served to whoever held the viewer's URL. `follow_links: false` on `start_viewer`, `start_tail`, and `create_viewer_handler` opens the trajectory with `O_NOFOLLOW` and checks the handle that it opened rather than the path, so the viewer reads only a regular file with no other name, and a FIFO at the path is refused without waiting for a writer. The tail reports a refusal to `on_io_error` and waits for a file that it can read, as it does for a missing one, and `/api/trajectory` serves the ring, as it does when there's no file. A directory above the file is still followed, so a host keeps checking those itself, and the option throws on a platform that has no `O_NOFOLLOW`. Following links stays the default. See [viewer.md](./docs/viewer.md#security).
|
|
8
|
+
- **The tool loop tells the model which calls `max_tool_calls_per_step` dropped, and a read-only tool doesn't count toward the cap.** Calls past the cap were left out of history with no result, so that no provider saw a call without one, but the model never learned that they hadn't run, and whether it made them again was left to chance. When the loop goes on, one user message after the step's tool results now names each dropped call with its input, clipped to 120 characters, as in `1 call didn't run, because max_tool_calls_per_step allows 1 per turn: write_file({"path":"a.ts"}). Make it again, no more than 1 per turn.` A `Tool` gains `read_only`, and a call to a tool that sets it doesn't count, so a turn can make several reads and still make only one write or command. The first counted call past the cap is dropped, and so is every call after it, so what runs is always the start of what the model asked for. The ACP `read_file`, `list_files`, and `search` tools set it. MCP tools don't, since `readOnlyHint` is a hint from the server that nothing checks. The dropped calls' `ToolCallRecord`s and the `tool_calls_dropped` event are unchanged. See [configuration.md](./docs/configuration.md#local-runtime-tool-reliability).
|
|
9
|
+
- **`truncated_turn_policy: 'continue'` keeps a tool loop going past a turn that reached its output limit before it made a call.** The loop ended on any turn that made no tool call, whatever its finish reason, so a turn that reached `max_tokens` while a thinking model was still reasoning ended the whole session, which made `max_tokens` useless as a per-turn cap. Under `'continue'`, on a call with tools and with a step left, the loop sends back whatever text the turn showed and leaves out its reasoning, which a provider wouldn't take back without the signature that it never got. Then it adds a user message that says the turn was cut off at the limit and asks for the next tool call or the final answer, and asks for another turn, which counts toward `max_steps`. The turn's `StepRecord` says `truncated: true`, and a `turn_truncated` event records its `output_tokens` and the call's `max_tokens`. The option goes on a call, on `defaults`, or on a `model_call` or `model_step` config, any other value throws `engine_config_error`, and `claude_cli` records `option_ignored`. `'stop'` stays the default. Ollama counts a model's thinking against `num_predict`, on its MLX runner as on llama.cpp, so the cap does stop a long reasoning turn there. See [configuration.md](./docs/configuration.md#local-runtime-tool-reliability).
|
|
10
|
+
|
|
11
|
+
## v0.17.0 — 2026-10-24
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **The comparison reads Fascicle on request transparency, and the `prepare_step` example keeps the cache warm.** [comparison.md](./docs/comparison.md#six-axes-that-matter) gains a sixth axis, who builds the array and whether you can see what went, with Fascicle's answer, its one gap at the external depth, and its answers to the four questions that Harness Engineering 101 asks of any framework. The `prepare_step` example in [configuration.md](./docs/configuration.md#reshaping-each-turn-prepare_step) was a sliding window, which misses the prompt cache on every turn once it starts dropping messages. It now cuts long tool results the same way on every turn and spreads the message that it changes, so `is_error` survives. The agent primer gains rules for duplicate tool names and for capture being off by default, and the words that the docs use in one sense each.
|
|
16
|
+
- **The course gains lesson 14, Give the Model Hands.** The course never covered a tool loop, so it ended without teaching what every coding agent is built on. [Lesson 14](./docs/learn/14-give-the-model-hands.md) gives a model tools over a folder of notes, keyless on `make_loop_engine`, and teaches `define_tool`, the tool loop, a failed call that goes back to the model with `is_error`, `max_steps` and the `finish_reason` that a capped call ends with, `needs_approval` with `on_tool_approval`, and a turn read back with `captured_turns`. The course's walk runs it with no key, lesson 13 hands it the course's close, and the course map, the set-up lesson, and the tutor's notes say that it needs 0.17.0.
|
|
17
|
+
- **Lessons 5, 6, and 8 show what a model call sends.** The course never showed the request underneath a `model_step`, so nothing in it said why the solver's explain step gets the question again, and lesson 8 said that a trajectory never holds a model's reply. [Lesson 5](./docs/learn/05-the-model-is-a-step.md#the-model-remembers-nothing) now says that a model remembers nothing from one call to the next, so each `model_step` sends a request of its own. [Lesson 6](./docs/learn/06-going-live.md#what-each-provider-was-sent) shows the bodies that lesson 5's extract call sends to OpenRouter and to Anthropic's native transport, as this release's `capture: 'wire'` recorded them, and [lesson 8](./docs/learn/08-when-things-break.md#what-the-trajectory-doesnt-hold) says what a trajectory holds under `capture` and points at `captured_turns`.
|
|
18
|
+
- **A primer on what a harness does, and a glossary.** No page said that a model API keeps nothing between requests, so the program sends the whole conversation every turn, or what a tool call looks like on the wire, and "harness", "step", and "turn" each meant more than one thing across the docs. [What a Harness Does](./docs/what-a-harness-does.md) walks from one request to the tool loop, what a turn costs, the context window, capture, and the guards on a tool, and ends each section with the Fascicle names that do that job. [concepts.md](./docs/concepts.md#glossary) ends with a glossary that gives each of those words one meaning, and it says plainly that the engine's step (`max_steps`, `step_index`, `prepare_step`, `StepRecord`) is a model turn, not a `Step`.
|
|
19
|
+
- **`fascicle-viewer` opens the turns that a model call captured.** A trajectory recorded under `capture` held each turn's request and reply, and the only way to read them was to fold the deltas by hand. A node whose calls captured turns now wears a small badge under its meta line, such as `3 TURNS`, and clicking it opens a drawer beside the canvas, which refits the flow into the space that's left. The drawer lists the node's turns with each one's step, its tokens, and its cache hit, and lays the selected turn's request (its system prompt, its tool names, and its messages by role) beside the reply that the provider returned, with long content folded and a tool result flagged `is_error` marked by the ember ✕. `COPY TURN` copies the turn as JSON in the `CapturedTurn` shape, ready for `replay_turn`. The canvas reads the turns with its own reader, the way `captured_turns` does, so a turn whose request was dropped stays out until the call's next whole array, and a scrubbed canvas shows only the turns that it has reached. [viewer.md](./docs/viewer.md#turn-inspector) walks through it.
|
|
20
|
+
- **`captured_turns` rebuilds what each turn sent, and `replay_turn` sends one again.** A captured trajectory holds each turn as a delta, which nothing could turn back into the request that the model got. `captured_turns(events)` folds the deltas per `call_span_id` into full arrays, in any order the events arrive, and returns a `CapturedTurn` for each turn with its call's `settings` and `tools`, the whole `messages` array, and the `response` the provider returned. A turn whose request was dropped is left out until the call's next whole array, and a call whose first turn is missing is left out whole. `replay_turn(engine, turn, { edit, provider, model, trajectory })` sends a turn through `engine.generate` with `max_steps: 1`, `cache: 'off'`, `capture: 'off'`, and `system: ''`, and rebuilds each tool with an `execute` that throws, so a tool call comes back listed and unexecuted, and nothing acts on the world twice. Captured provider options go as they were, a raw `cache_control` included, so `edit` is how you drop one. [api-reference.md](./docs/api-reference.md#rebuilding-and-replaying-a-captured-turn) says what a replay does and doesn't send.
|
|
21
|
+
- **`redact_capture` scrubs what `capture` records, and OTel gets only its size.** A captured request carries everything a user typed, and nothing stood between it and the trajectory. `create_engine({ redact_capture })` takes a function that sees each payload first, as a `CapturePayload` (`{ kind, step_index, data }`, with `data` a fresh copy), and returns what to record in its place, or `undefined` to record nothing. It fails closed: a redactor that throws or returns a promise records nothing, and so does a payload that JSON can't hold, and the turn records `capture_redaction_failed` with the payload's kind and its step span. The turn after a request that went unrecorded records its whole array, marked `reshaped`, so the deltas pick up again at once. The `fascicle/otel` trajectory logger leaves `request_sent.request`, `response_received.content`, and `request_wire.body` off its span events and records `fascicle.capture.bytes` in their place, the UTF-8 length of each one's JSON, while the filesystem, HTTP, and stderr loggers write the payloads as they are. [configuration.md](./docs/configuration.md#the-config-shape) says which events the redactor covers.
|
|
22
|
+
- **`capture` records what each turn sent the model and what came back.** "The model ignored my instruction" couldn't be checked against the request the model got, since `request_sent` carried only a step index and `response_received` carried no reply. `capture: 'off' | 'turns' | 'wire'` goes on a call, on `defaults`, or on a `model_call` or `model_step` config, and a call's own value wins. It's off by default, because a request carries everything a user typed. Under `'turns'`, a call's first `request_sent` carries `request: { settings, tools, messages }`, with the call's resolved settings, each tool's input schema as JSON Schema, and every message the turn sent, the system prompt included. Each later turn carries `{ appended }`, the messages it added, or `{ messages, reshaped: true }` when it didn't extend the turn before it, so a captured trajectory grows with the conversation rather than its square. Each `response_received` carries `content`, the parts the provider returned. Every payload is a copy that JSON can hold, taken as the turn goes out, with an image's bytes as base64 beside its `media_type`, and a value that JSON can't hold drops that payload without failing the call. Every `request_sent` now names `span_id`, the turn's step span, and `call_span_id`, the call's `engine.generate` span, whether or not the call captures. `'wire'` records all of that and, on a native transport, the exact body each attempt sends, as `request_wire` with the `url`, the `body`, and the provider and never a header, through a new `TurnRequest.on_wire` that every built-in native adapter calls just before it serializes its body. A custom native adapter should call it too. On the `ai_sdk` transport, whose SDK builds the body, `'wire'` records `option_ignored` and captures as `'turns'`. `claude_cli` records `option_ignored` for any per-call `capture`, and any other value throws `engine_config_error`. [concepts.md](./docs/concepts.md#what-gets-recorded) has the shapes, and [troubleshooting.md](./docs/troubleshooting.md#the-model-ignored-an-instruction) shows how to read them.
|
|
23
|
+
- **A `cache` option asks the provider to cache the prompt.** Every turn of a tool loop sends the whole conversation again, and nothing asked a provider to keep it, so a long Anthropic loop paid the full input price for the same prefix on every turn. `cache: 'off' | '5m' | '1h'` goes on a call, on `defaults`, or on a `model_call` or `model_step` config, and a call's own value wins over the default. What it does depends on the caching that the provider's adapter declares in its new `prompt_cache` field: `'with_tools'` caches for five minutes by default on a call with tools, `'opt_in'` only when asked, and `'automatic'` (OpenAI and Google, which cache on their own) never asks. An explicit `'5m'` or `'1h'` that an adapter can't honor records `option_ignored` with a `reason`, and so does any per-call `cache` on `claude_cli`, since Claude Code caches its own prompts. Any other value throws `engine_config_error`. Anthropic declares `'with_tools'` on both transports. The native one sends a top-level `cache_control`, and the `ai_sdk` one sets `@ai-sdk/anthropic`'s call-level `cacheControl`, which goes out as the same field, through a new optional `translate_cache` hook on `AiSdkProviderAdapter`. A `cache_control` or `cacheControl` of your own under `provider_options.anthropic` still wins, and since the package drops a call-level `cache_control`, the adapter sends that spelling as `cacheControl`. OpenRouter's native transport declares `'opt_in'` and sends the same top-level field when a call asks, which is meant for its Claude models. `make_loop_engine` takes `prompt_cache` to declare one. [providers.md](./docs/providers.md#prompt-caching) has the table.
|
|
24
|
+
- **`fascicle-viewer`'s header shows the run's cache hit ratio.** Once any of a run's model turns read or wrote prompt-cache tokens, the header gains `CACHE 87%` before the cost, the share of the run's input that came back from the cache, so a run that only wrote reads 0%. When the run recorded a `cache_miss`, the count follows it, as in `1 MISS`. The reducer sums `input_tokens`, `cached_input_tokens`, and `cache_write_tokens` from each `response_received`, which it had ignored, and a run that never cached keeps the header it had.
|
|
25
|
+
- **The trajectory says whether the prompt cache is working.** A cache that went cold looked exactly like one that worked, apart from the bill. Each `response_received` now carries `cache_hit_ratio`, the share of the turn's input that came from the cache to three decimals, on any turn with cache traffic, so a turn that only wrote reads 0. A turn that reads nothing right after a turn of the same call that read or wrote some records `cache_miss`, with `previous_cached_tokens` (the previous turn's reads plus writes), this turn's `input_tokens`, and `after_prepare_step`, which says whether `prepare_step` replaced the turn's messages. The rule needs no model's minimum, and it holds across schema-repair turns. The `fascicle/otel` metrics record a new histogram, `fascicle.client.cache.token.usage`, with `fascicle.cache.direction` set to `read` or `write`, and the example Grafana dashboard gains a cache panel. [troubleshooting.md](./docs/troubleshooting.md#a-turn-cost-far-more-than-the-one-before) lists what causes a miss.
|
|
26
|
+
- **A one-hour cache write is priced at twice the input rate.** Anthropic charges 2 times the input price for a write with `ttl: '1h'`, against 1.25 times for a five-minute one, and `UsageTotals` had no way to tell them apart, so a one-hour cache was priced as the cheaper write. `UsageTotals` gains `cache_write_1h_tokens`, the part of `cache_write_tokens` that was written for an hour. The native Anthropic transport reads it from the usage's `cache_creation` split, whole or streamed, and the `ai_sdk` transport from the raw usage in `providerMetadata.anthropic.usage`, which `AiSdkProviderAdapter.normalize_usage` now receives as a second argument, so a turn's `step_finish` chunk and its step record agree. `Pricing` gains `cache_write_1h_per_million`, and without it `compute_cost` charges one-hour writes at twice `input_per_million` (`CACHE_WRITE_1H_MULTIPLIER`), while `decompose_total_cost` weighs them the same way. `response_received` carries the field when it's reported. A provider that reports no split prices every write at the five-minute rate, as before.
|
|
27
|
+
- **`mcp_client` can put a prefix on a server's tool names.** Two MCP servers that advertise a tool under the same name couldn't share a call, and with duplicate names now refused, one of them had to go. `mcp_client(config, { name_prefix: 'gh_' })` prepends the prefix, exactly as you write it, to each tool's name, so the model sees `gh_search`, while the server is still called with `search`. `include` and `default_description` read the server's own name, and so do the fallback description and the errors. Pick a separator that every model you call accepts, since Anthropic's tool names allow no dot.
|
|
28
|
+
- **`assert_prefix_stable` checks that a tool loop only appends.** A provider's prompt cache matches a request by its prefix, so a loop that rewrites the system prompt, the tools, or an earlier message misses the cache on every turn, and nothing failed to say so. `assert_prefix_stable(requests)` reads what `make_loop_engine` recorded and throws a plain `Error` at the first turn that changed what the turn before it sent, naming the call, the step, and the difference, as in `call 1, step 2: message 3 differs from step 1`. It compares messages as JSON text, the way the wire sends them, and tool schemas by reference first and then as JSON Schema. It splits calls wherever `step_index` doesn't increase, so it reads calls that ran one at a time, and a `parallel` flow takes one double per branch. [testing.md](./docs/testing.md#assert_prefix_stable) has the check and a recipe for testing a tool loop keyless.
|
|
29
|
+
- **`make_loop_engine` runs a script under the engine's own tool loop.** The three doubles in `fascicle/testing` stand in for the whole engine, so no tool loop runs under them, and a test of a flow whose model calls use tools couldn't see the tools run, the approvals asked, or the results fed back. `make_loop_engine(turns)` builds a real engine with one provider, `'loop'`, that plays a turn of the script each time the loop asks the model for one, and it returns `{ engine, requests }`, where `requests` holds every request the model was sent, tool results included. A turn is a final-answer string, an array of calls, or an object that sets its text, calls, content parts, finish reason, or usage, or throws. A thrown error goes through the engine's retry as a provider's would, so a retried 503 uses up the next turn. [testing.md](./docs/testing.md#make_loop_engine) has the details, and the ACP tests run on it now.
|
|
30
|
+
- **The run canvas works under a path of its own.** The canvas was built with an absolute base and asked for `/api/trajectory` and `/api/events` by absolute path, so served at `/viewer/<id>/` behind a host's proxy, its scripts, its styles, its fonts, and both API requests all missed. Its assets and its API requests resolve against the page now, so a host can frame the canvas under any path that ends in a slash by proxying that path to a loopback viewer with the prefix stripped. The proxy sends the viewer a loopback `Host`, and [viewer.md](./docs/viewer.md#serving-under-a-path) has the details. Served at `/`, nothing changes.
|
|
31
|
+
- **`create_viewer_handler` mounts the viewer on a server of the host's own.** A host that wanted the canvas under a path of its own had to run a viewer in a second process and proxy to it, even when it could import `fascicle/viewer`. `create_viewer_handler({ broadcaster, trajectory_path, app_dir, ingest, base_path })` returns the handler that `start_server` puts on its socket, as `(req, res) => boolean`, for a host to mount on a `node:http` server or on any framework that hands over the raw request. It takes `base_path` off each request and redirects the bare path to its trailing slash. For a request that it doesn't serve, such as a path outside `base_path`, a route that the API doesn't claim, or a file that the canvas doesn't ship, it returns false and leaves the response alone, so the host answers. It checks no `Host`, which leaves who reaches it to the host's own auth, and `start_server` keeps the loopback check in front of it. [viewer.md](./docs/viewer.md#mounting-the-handler) has an example.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **An Anthropic tool loop caches by default.** A call with tools now sends `cache_control: { type: 'ephemeral' }` on either transport, so its first turn writes the conversation to Anthropic's five-minute cache and every turn after it reads that prefix back at a fraction of the input price. A write costs 1.25 times the input price, which a loop earns back on its second turn, so a call without tools asks for no cache unless it sets one. Set `cache: 'off'` on the call, or in `defaults`, to send requests as they went before. A gateway that routes to Bedrock's legacy integration of Claude refuses the field with a 400, and [troubleshooting.md](./docs/troubleshooting.md#a-400-that-names-cache_control) lists that and the other refusals.
|
|
36
|
+
- **Anthropic blocks that the native transport doesn't read are kept, so the assistant parts gain `opaque`.** The native Anthropic adapter dropped every block type that it didn't know, a server tool's call and result among them, so a web search turn came back without its own state. Every block type other than `text`, `tool_use`, `thinking`, and `redacted_thinking` now becomes `{ type: 'opaque', provider_options: { anthropic: { block } } }` and goes back with the next request as it came, whole or streamed. A text block's citations ride its text part as `provider_options.anthropic.citations` and go back on the block, so a multi-turn web search keeps each citation's `encrypted_index`. Every other transport skips an opaque part. `AssistantContentPart` gains that fourth member, so a `switch` over a message's parts that's meant to be exhaustive needs an `opaque` case.
|
|
37
|
+
- **The `ai_sdk` transport calls `streamText` on every turn, which Bedrock authorizes separately.** `generateText` is gone from the turn path, so `ai_sdk_telemetry`'s spans read `ai.streamText` where they read `ai.generateText`. A schema reply that the SDK would have refused reaches the engine's own repair loop as it is, since `streamText` parses structured output only when it's read. An adapter's `supports('streaming')` now decides only whether a caller may pass `on_chunk`. Two things change on Bedrock. The peer calls ConverseStream, which AWS authorizes as `bedrock:InvokeModelWithResponseStream`, so a role that grants only `bedrock:InvokeModel` fails every turn with a 403 until you add that action, and AWS lists, model by model, which models support tool use while streaming. And a plain Bedrock turn's `provider_reported` no longer carries `{ stopSequence: null }`, because the streamed reply reports a stop sequence only when the model hit one.
|
|
38
|
+
- **Every turn asks for a stream, whether or not you pass `on_chunk`.** A turn streamed only when something consumed its chunks, so the rest waited for a whole body. Every `ai_sdk` turn now calls `streamText`, and a native adapter that supports streaming gets `stream: true` on every turn. The engine stamps each attempt's first chunk, so every such step reports `first_chunk_ms` and `throughput()` reads `'decode'` on it, and it passes chunks on only to a consumer. With no consumer, nothing reached you before a failure, so a turn that fails partway through its stream retries the whole turn, a turn timeout included. A stream that ends before its closing event (`message_stop`, `[DONE]`, Ollama's done frame, or an AI SDK step that finishes as `'other'` with no reason from the provider) counts as a network failure, which surfaces as `provider_error` with `cause_kind: 'network'` once retries run out. With a consumer, the first-chunk boundary holds as before. A streamed request that gets a JSON reply reads it as a whole body. One thing can now fail where it didn't: the strict `openai` dialect requires the usage that `stream_options.include_usage` asks for, so against an OpenAI-compatible server that ignores that option, every turn on the `openai` provider's native transport fails with `response is missing its usage object`. Point such a server at the `lmstudio` provider, whose dialect zeroes missing usage. A custom native adapter that doesn't support streaming keeps whole-body turns.
|
|
39
|
+
- **Two tools under one name throw instead of one replacing the other.** The tool loop and every transport keyed a call's tools by name, so a second tool under a name already taken replaced the first without a word, and the model could never call the one that disappeared. `generate` now throws `engine_config_error` before it sends anything, naming each duplicate with its count, as in `duplicate tool names: search (2), read_file (3)`, and the check runs on `claude_cli` too. Give each tool a name of its own, or pass `name_prefix` to `mcp_client` for one server's tools. In an ACP session, a flow's own tool under a workspace tool's name throws when both sit in one call, so a wrapper has to replace the tool that it wraps.
|
|
40
|
+
- **The native Ollama transport streams what the model thinks.** The daemon sends a thinking model's reasoning as `message.thinking`, frame by frame, before the answer, and the native transport read only `content` and `tool_calls`, so nothing reached `on_chunk` or the trajectory while the model thought, whether `think` was unset or `true`. Each frame's thinking dispatches as a `reasoning` chunk now, ahead of the frame's text, and it still joins no content part, since this wire takes no reasoning back. One consequence follows from the first chunk arriving sooner. When something consumes the chunks, a connection that drops while the model is thinking fails as `stream interrupted` instead of being retried, the way it already did once text had streamed. With no consumer, the turn retries.
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- **A paused Anthropic turn continues instead of ending cut short.** The native transport read `pause_turn`, which a long server-tool turn can stop on, as an ordinary `'stop'`, so the response ended partway through. The turn keeps `finish_reason: 'stop'` and sets `TurnResult.paused` now. The loop sends its assistant message back with nothing after it, which is how Anthropic says to resume, asks for another turn, and records `turn_paused`. The continuation counts toward `max_steps`, a pause on the last allowed step ends with `'max_steps'` and the paused turn's text, and the call's text joins the paused turns' texts with the final one's. `make_loop_engine` takes `paused` on a turn to script one. The `ai_sdk` transport still ends the call at a pause.
|
|
45
|
+
- **A turn longer than five minutes no longer dies at Node's header timeout.** Node's `fetch` gives up on a response whose headers take more than 300 seconds (a probe on 2026-10-22 failed with `UND_ERR_HEADERS_TIMEOUT` at 301 seconds), and a turn that didn't stream sent no headers until its whole body was ready, so a long generation failed however long `turn_timeout_ms` allowed. Every `ai_sdk` and native turn streams now, and a stream sends its headers at once, so the turn runs as long as the model keeps generating. undici still allows 300 seconds of silence between two chunks, which a model that's generating doesn't come near.
|
|
46
|
+
- **A 5xx's `Retry-After` is honored, the way a 429's already was.** The native adapters kept the header on a 5xx, but only a rate limit read it, so a 503 from a server that's shedding load was retried on the engine's own backoff, often before the server asked to be called again. The retry now waits the longer of its computed backoff and the server's value on a 5xx too, and `on_retry` reports the value as `retry_after_ms`.
|
|
47
|
+
- **An undici timeout or socket failure retries as a network failure.** The classifier read a network code only off the error itself and knew none of undici's, so on the `ai_sdk` transport, where the AI SDK wraps a failed fetch in an error that keeps undici's as its `cause`, a turn that hit `UND_ERR_HEADERS_TIMEOUT` failed at once instead of retrying. `UND_ERR_HEADERS_TIMEOUT`, `UND_ERR_BODY_TIMEOUT`, and `UND_ERR_SOCKET` count as network codes now, read off the error or its `cause`, and a connection reset in the `cause` counts the same way.
|
|
48
|
+
- **A tool call that failed goes back to Claude marked as an error.** The loop feeds a failed call back to the model as `{"error": "…"}` text, whether the tool was unknown, its input failed validation, its approval was denied, or it threw, and no transport said that the text was an error, so Claude read it as what the tool returned. The tool message carries `is_error: true` now. The native Anthropic transport sends it as the `tool_result`'s `is_error`, and the `ai_sdk` transport sends an `error-text` output, a denial included, which `@ai-sdk/anthropic` turns into the same field. The content stays `{"error": "…"}` on every transport, so nothing that reads it breaks. The OpenAI-compatible and Ollama formats have no such field, and the Bedrock peer sends the text alone, even for Claude, so a model there reads the error from the content as it did before.
|
|
49
|
+
- **An ACP permission request leaves the kind of a card it didn't draw alone.** The request sent its call's card with `kind: 'other'` for any tool that the session's workspace tools don't cover, such as a check that a flow runs itself and opens as an `execute` card from its own `to_updates`. Zed applies a request's fields to the card that it already drew, so the moment the check asked, its card lost the terminal look and kept the plain one from then on, since nothing sent the kind again. A request names a kind only for a workspace tool now, and for any other tool it sends none, which leaves the card as its opening drew it.
|
|
50
|
+
- **`fascicle-viewer` says how a run ended instead of reading LIVE.** The header's chip showed the event stream's state and nothing else, so once a run's `run_end` arrived the clock froze but the chip kept reading LIVE for as long as the stream stayed open, and a finished trajectory read `● LIVE` from the moment it opened. The chip reads LIVE only while the run is going now. Once `run_end` arrives it reads DONE, FAILED, ABORTED, or SUSPENDED, in the white family like REPLAY, and CONNECTING and OFFLINE still show whenever the stream isn't open.
|
|
51
|
+
- **`throughput()` reads Ollama's own decode rate.** A step's window was `duration_ms - first_chunk_ms` whenever the turn streamed, and on Ollama a turn can finish generating before it dispatches anything. Ollama sends a tool call whole once it's generated, on either transport, and the native transport dispatched nothing while the model thought, so the window covered the last few milliseconds and the rate came out 100 to 1,600 times the daemon's own. Ollama reports the time it spent generating each step's output as `eval_duration` on both transports, and `throughput()` takes that as an Ollama step's window now, so the step measures `'decode'` exactly, streamed or not.
|
|
52
|
+
- **`throughput()` counts a whole tool call's round trip when no decode time was reported.** Other servers send a tool call whole too, such as Ollama's `/v1` under the `openai` provider, which sends a call's arguments in one piece, and a step whose first chunk was that call still measured its last few milliseconds as `'decode'`. The engine notes the first chunk of each attempt now, and when it belonged to a tool call whose input came in one delta or none, the step's `StepTiming` carries `whole_tool_call: true` and `throughput()` counts its whole round trip as `'blended'`. A decode time that Ollama reports still wins, and a call whose input streams in pieces, as Anthropic's and OpenAI's do, still measures `'decode'`.
|
|
53
|
+
|
|
54
|
+
### Internal
|
|
55
|
+
|
|
56
|
+
- **acp-coder caches a Claude session, and a live test checks caching.** acp-coder runs the longest tool loops in the repo, and on OpenRouter, its default provider, caching is opt-in. `CoderConfig` gains `cache`, and `main.ts` sets `'5m'` when the provider is `anthropic` or the model id starts with `anthropic/`, so every step after the first reads the session back from the cache. `src/engine/__tests__/live/live_cache.test.ts`, which runs only under `LIVE_TESTS=1` with a key, runs a three-turn Claude tool loop on both native routes to Claude and asserts a write and then reads with no `cache_miss`, prints the hit ratio and the cost beside `cache: 'off'`, and reports what OpenRouter does with `cache: '5m'` on another vendor's model. [CONTRIBUTING.md](./CONTRIBUTING.md#running-tests) has the command.
|
|
57
|
+
- **The test doubles for the `ai` module and the Bedrock peer can serve streams.** The `ai` mock's `streamText` serves a response that a test queued for `generateText` whenever no stream of its own is queued. It streams the result as the parts it would stream as, carries its metadata and content parts across, and counts the call as the `generateText` call it stands in for, so a test written for a whole-body turn holds once that turn streams. A ConverseStream framer under `src/engine/providers/__tests__/fixtures/` encodes Bedrock's binary event stream, CRCs included, with `node:zlib`, and `bedrock_stream_wire.test.ts` drives the real `@ai-sdk/amazon-bedrock` peer through `on_chunk` with it. The framer has a decoder that fails loud, because the peer's own decoder turns a frame it can't read into an empty turn.
|
|
58
|
+
- **The stub engines validate canned replies with the engine's own schema helpers, and three files that only other tests reached have tests of their own.** `validate_canned` carried a copy of `validate_schema` and `format_schema_issues`, and it calls them now, so a stub's schema error matches a real engine's by construction, and a schema that fails with an empty list of issues reads `unknown schema issue`. An audit of the source files without a test of the same name found most of them tested from a parent directory, but nothing asserted which open span `trajectory_recorder` names as a parent, what a stub's schema error carries, or `bench_suspend_error`'s `name`, and each now has tests that catch every mutant.
|
|
59
|
+
|
|
3
60
|
## v0.16.5 — 2026-10-21
|
|
4
61
|
|
|
5
62
|
### Fixed
|
package/README.md
CHANGED
|
@@ -222,7 +222,8 @@ The canonical worked example is [examples/pr-improve/](./examples/pr-improve/),
|
|
|
222
222
|
|
|
223
223
|
- [docs/blueprint.md](./docs/blueprint.md) — **the agent blueprint**: the standard app architecture (start here when building an app)
|
|
224
224
|
- [docs/getting-started.md](./docs/getting-started.md) — install and run your first flow
|
|
225
|
-
- [docs/learn/](./docs/learn/README.md) is a course in
|
|
225
|
+
- [docs/learn/](./docs/learn/README.md) is a course in fifteen short lessons that starts from a single step and ends with giving the model hands, tools that it calls on its own, with notes written for your coding agent as well
|
|
226
|
+
- [docs/what-a-harness-does.md](./docs/what-a-harness-does.md) explains what the program around a model does, from the request on the wire to the tool loop, the prompt cache, and the guards on its tools
|
|
226
227
|
- [docs/concepts.md](./docs/concepts.md) — step-as-value, trajectories, cancellation
|
|
227
228
|
- [docs/composition.md](./docs/composition.md) — full composition surface: the 23 primitives, run/stream, checkpointing
|
|
228
229
|
- [docs/leaf-arm-spine.md](./docs/leaf-arm-spine.md) — the three-layer shape of a Fascicle flow and how to choose the right primitive at each layer
|
|
@@ -233,7 +234,7 @@ The canonical worked example is [examples/pr-improve/](./examples/pr-improve/),
|
|
|
233
234
|
- [docs/cli.md](./docs/cli.md) — the `claude_cli` subprocess adapter
|
|
234
235
|
- [docs/cookbook.md](./docs/cookbook.md) — retries, fan-out, judges, HITL, tool loops
|
|
235
236
|
- [docs/deliberation-as-composition.md](./docs/deliberation-as-composition.md) — how ensembles, tournaments, consensus, and adversarial loops decompose into the primitives
|
|
236
|
-
- [docs/testing.md](./docs/testing.md) — testing flows with stub, script, and
|
|
237
|
+
- [docs/testing.md](./docs/testing.md) — testing flows with stub, script, capture, and loop engines
|
|
237
238
|
- [docs/regression-testing-model-behavior.md](./docs/regression-testing-model-behavior.md) — regression-testing model behavior with mutation-tested judges and a committed score baseline
|
|
238
239
|
- [docs/human-in-the-loop.md](./docs/human-in-the-loop.md) — suspend/resume approval over HTTP and streaming to a `useChat` UI via `fascicle/ui`
|
|
239
240
|
- [docs/writing-a-harness.md](./docs/writing-a-harness.md) — building a runner around Fascicle
|
package/dist/AGENTS.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
This file is for a coding agent (Claude Code, Codex, Cursor, or another) that's
|
|
4
4
|
working in a project which uses the published `fascicle` package. A person who
|
|
5
5
|
is learning Fascicle will usually import it from their `CLAUDE.md`, as
|
|
6
|
-
[lesson 0](https://github.com/robmclarty/fascicle/blob/v0.
|
|
6
|
+
[lesson 0](https://github.com/robmclarty/fascicle/blob/v0.17.1/docs/learn/00-set-up.md) shows. Every shape, rule, and error message below
|
|
7
7
|
was checked against `fascicle` 0.16.3, and against 0.15.0 where the two differ,
|
|
8
|
-
|
|
8
|
+
except what's marked 0.17.0 and later, which was checked against 0.17.0. A rule
|
|
9
|
+
that a later release changes says what changed.
|
|
9
10
|
|
|
10
11
|
Your training data probably holds little or nothing about Fascicle, so treat
|
|
11
12
|
this file and the installed type declarations as the truth, and don't fill gaps
|
|
@@ -27,9 +28,11 @@ from other agent frameworks.
|
|
|
27
28
|
- **The repository**, when the person has it cloned (often at `../fascicle`),
|
|
28
29
|
holds the docs and the runnable examples. `docs/blueprint.md` is the app
|
|
29
30
|
architecture, and `docs/composition.md` has one line on every composer.
|
|
30
|
-
- **
|
|
31
|
-
|
|
32
|
-
between runs, and from 0.16 on it follows the newest run.
|
|
31
|
+
- **0.16.3 and 0.15.0 differ only in the viewer.** On 0.15 it mishandles a
|
|
32
|
+
trajectory file that holds more than one run, so delete `.trajectory.jsonl`
|
|
33
|
+
between runs, and from 0.16 on it follows the newest run. What's marked 0.17.0
|
|
34
|
+
and later (the tool-loop double, capture, and the duplicate-name check) isn't
|
|
35
|
+
there at all on either of them.
|
|
33
36
|
|
|
34
37
|
## The Model in Four Sentences
|
|
35
38
|
|
|
@@ -40,13 +43,35 @@ step, and a tree of plain objects that you can print before it runs.
|
|
|
40
43
|
An engine (`create_engine`) talks to model providers, and `model_step` or
|
|
41
44
|
`model_call` turns an engine call into a step.
|
|
42
45
|
|
|
46
|
+
## Words with One Meaning
|
|
47
|
+
|
|
48
|
+
The docs use these words in one sense each, and the API's names lean on them
|
|
49
|
+
(`docs/concepts.md` ends with the full glossary):
|
|
50
|
+
|
|
51
|
+
- **Model call.** One `engine.generate`, which a `model_step` or `model_call`
|
|
52
|
+
makes each time it runs.
|
|
53
|
+
- **Model turn.** One request to the provider and the reply that comes back. A
|
|
54
|
+
call with tools takes one per pass of its tool loop. The engine's API calls a
|
|
55
|
+
model turn a step, in `max_steps`, `step_index`, `prepare_step`, and
|
|
56
|
+
`GenerateResult.steps`, and that step is never a `Step`.
|
|
57
|
+
- **Tool loop.** The loop inside a model call that has `tools`. It runs the
|
|
58
|
+
calls that a reply makes, appends the calls and their results, and sends the
|
|
59
|
+
whole conversation again, until a reply makes no call or `max_steps` runs out.
|
|
60
|
+
- **Transcript.** The array of messages that a tool loop keeps across its
|
|
61
|
+
turns. `prepare_step` changes what one turn sends and leaves the transcript
|
|
62
|
+
alone.
|
|
63
|
+
- **Capture.** What the `capture` option records (0.17.0 and later), each model
|
|
64
|
+
turn's request and reply. It has nothing to do with `make_capture_engine`.
|
|
65
|
+
- **Prompt cache.** A provider's short-lived store of a request's prefix, which
|
|
66
|
+
the `cache` option asks for (0.17.0 and later).
|
|
67
|
+
|
|
43
68
|
## Imports
|
|
44
69
|
|
|
45
70
|
| From | What |
|
|
46
71
|
| --- | --- |
|
|
47
|
-
| `fascicle` | `run`, `step`, `sequence`, `parallel`, `branch`, `map`, `pipe`, `chain`, `loop`, `retry`, `fallback`, `timeout`, `compose`, `adversarial`, `ensemble_step`, `consensus`, `checkpoint`, `suspend`, `gate`, `describe`, `model_step`, `model_call`, `create_engine`, `define_tool`, `error_path`, the error classes, and the types (`Step`, `Engine`, `RunContext`, `GenerateOptions`, ...) |
|
|
72
|
+
| `fascicle` | `run`, `step`, `sequence`, `parallel`, `branch`, `map`, `pipe`, `chain`, `loop`, `retry`, `fallback`, `timeout`, `compose`, `adversarial`, `ensemble_step`, `consensus`, `checkpoint`, `suspend`, `gate`, `describe`, `model_step`, `model_call`, `create_engine`, `define_tool`, `error_path`, `captured_turns` and `replay_turn` (0.17.0 and later), the error classes, and the types (`Step`, `Engine`, `RunContext`, `GenerateOptions`, ...) |
|
|
48
73
|
| `fascicle/adapters` | `filesystem_logger`, `http_logger`, `stderr_logger`, `tee_logger`, `noop_logger`, `filesystem_store` |
|
|
49
|
-
| `fascicle/testing` | `make_stub_engine`, `make_script_engine`, `make_capture_engine`, `text_of`, `engine_from_generate` |
|
|
74
|
+
| `fascicle/testing` | `make_stub_engine`, `make_script_engine`, `make_capture_engine`, `make_loop_engine` and `assert_prefix_stable` (0.17.0 and later), `text_of`, `engine_from_generate` |
|
|
50
75
|
| `fascicle/agents` | `define_agent` |
|
|
51
76
|
| `fascicle/viewer` | `start_viewer` |
|
|
52
77
|
|
|
@@ -111,6 +136,12 @@ const extract = model_step({
|
|
|
111
136
|
|
|
112
137
|
model_call({ ...same config }) // the GenerateResult envelope: content, usage, cost, finish_reason
|
|
113
138
|
await engine.dispose() // always, in finally
|
|
139
|
+
|
|
140
|
+
const look_up = define_tool({ name: 'look_up', description: 'when to call it', input_schema: z.object({ key: z.string() }), execute: ({ key }) => find(key) })
|
|
141
|
+
model_step({ engine, model, system, tools: [look_up], max_steps: 6 }) // a tool loop; max_steps (default 10) caps its model turns
|
|
142
|
+
model_step({ ...config, on_tool_approval }) // asked before any tool flagged needs_approval runs
|
|
143
|
+
model_step({ ...config, capture: 'turns' }) // 0.17.0 and later: each turn's request and reply go into the trajectory
|
|
144
|
+
captured_turns(events) // 0.17.0 and later: each captured turn's whole request, rebuilt
|
|
114
145
|
```
|
|
115
146
|
|
|
116
147
|
Five providers need no extra package on `transport: 'native'`. They're
|
|
@@ -192,11 +223,13 @@ messages are the real ones.
|
|
|
192
223
|
17. **`describe(flow)` prints counter ids** like `chain_1`, which also appear in
|
|
193
224
|
`error_path`, and it prints system prompts in full. `describe.diagram` never
|
|
194
225
|
shows counter ids, so it's stable enough to snapshot in a test.
|
|
195
|
-
18. **A trajectory holds no per-call message or reply text
|
|
196
|
-
`flow_structure`, does carry every model step's
|
|
197
|
-
file as sensitive. Beyond that it records spans,
|
|
198
|
-
cost, and how the run ended.
|
|
199
|
-
|
|
226
|
+
18. **A trajectory holds no per-call message or reply text unless the call
|
|
227
|
+
captures.** Its first event, `flow_structure`, does carry every model step's
|
|
228
|
+
system prompt, so treat the file as sensitive. Beyond that it records spans,
|
|
229
|
+
timings, token counts, cost, and how the run ended. Under `capture` (rule
|
|
230
|
+
23) it also holds each model turn's request and reply. Without it, for a
|
|
231
|
+
model's reply, read `raw_text` and `schema_issues` on a
|
|
232
|
+
`schema_validation_error`.
|
|
200
233
|
19. **Through 0.16.3, `adversarial` draws its inner machinery** in a diagram:
|
|
201
234
|
`scope` and `stash` nodes, and internal steps such as `snapshot`. For a
|
|
202
235
|
draft, check, and redraft loop that a person has to read, a `loop` with a
|
|
@@ -208,6 +241,22 @@ messages are the real ones.
|
|
|
208
241
|
21. **The engine retries some network failures itself**, inside a model call.
|
|
209
242
|
`retry` works one level up and reruns the whole step when it fails, a schema
|
|
210
243
|
failure included, while an abort or a suspend passes straight through.
|
|
244
|
+
22. **From 0.17.0, two tools under one name throw.** A call whose `tools` hold
|
|
245
|
+
a name twice fails before any request, with ``engine_config_error: duplicate
|
|
246
|
+
tool names: search (2); give each tool its own name, or pass `name_prefix`
|
|
247
|
+
to mcp_client for one server's tools``. Earlier releases let the later tool
|
|
248
|
+
replace the earlier one without a word. Give each tool its own name, and
|
|
249
|
+
give an MCP server's tools a prefix with `mcp_client(config, { name_prefix: 'gh_' })`.
|
|
250
|
+
23. **From 0.17.0, capture is off until a call asks for it.** Set
|
|
251
|
+
`capture: 'turns'` on a model step, a `generate` call, or the engine's
|
|
252
|
+
`defaults`, and each model turn's request lands on `request_sent` (the first
|
|
253
|
+
turn whole, each later one as what it added) and its reply on
|
|
254
|
+
`response_received`. `'wire'` also records the exact body that each attempt
|
|
255
|
+
sent on a native transport, and on `ai_sdk` it records `option_ignored` and
|
|
256
|
+
captures as `'turns'`. `captured_turns(events)` rebuilds the whole requests,
|
|
257
|
+
and `replay_turn(engine, turn)` sends one again without running a tool. A
|
|
258
|
+
captured trajectory holds everything that the person typed and every tool
|
|
259
|
+
result, so ask before you turn capture on, and keep the file out of git.
|
|
211
260
|
|
|
212
261
|
## Decision Rules
|
|
213
262
|
|
|
@@ -250,6 +299,8 @@ messages are the real ones.
|
|
|
250
299
|
| "pick the best of" | `ensemble_step` |
|
|
251
300
|
| "only if they agree" | `consensus` |
|
|
252
301
|
| "ask me first," "wait for approval" | `suspend` or `gate`, with `run.until_suspended` |
|
|
302
|
+
| "let it look things up," "give it a tool" | `define_tool`, and `tools` with `max_steps` on the `model_step` |
|
|
303
|
+
| "ask me before it runs that tool" | `needs_approval` on the tool, and `on_tool_approval` on the model step |
|
|
253
304
|
| "don't redo the expensive part" | `checkpoint`, with a `checkpoint_store` |
|
|
254
305
|
|
|
255
306
|
## Check Your Own Work
|
|
@@ -345,11 +396,11 @@ describe('the calculator', () => {
|
|
|
345
396
|
|
|
346
397
|
## Where to Look Next
|
|
347
398
|
|
|
348
|
-
- [blueprint.md](https://github.com/robmclarty/fascicle/blob/v0.
|
|
349
|
-
- [leaf-arm-spine.md](https://github.com/robmclarty/fascicle/blob/v0.
|
|
399
|
+
- [blueprint.md](https://github.com/robmclarty/fascicle/blob/v0.17.1/docs/blueprint.md) for the layout of a growing app.
|
|
400
|
+
- [leaf-arm-spine.md](https://github.com/robmclarty/fascicle/blob/v0.17.1/docs/leaf-arm-spine.md) for choosing a primitive at each
|
|
350
401
|
layer.
|
|
351
|
-
- [composition.md](https://github.com/robmclarty/fascicle/blob/v0.
|
|
352
|
-
- [cookbook.md](https://github.com/robmclarty/fascicle/blob/v0.
|
|
402
|
+
- [composition.md](https://github.com/robmclarty/fascicle/blob/v0.17.1/docs/composition.md) for one line on every composer.
|
|
403
|
+
- [cookbook.md](https://github.com/robmclarty/fascicle/blob/v0.17.1/docs/cookbook.md) for worked patterns, including tool loops with
|
|
353
404
|
`define_tool`.
|
|
354
|
-
- [testing.md](https://github.com/robmclarty/fascicle/blob/v0.
|
|
355
|
-
- [troubleshooting.md](https://github.com/robmclarty/fascicle/blob/v0.
|
|
405
|
+
- [testing.md](https://github.com/robmclarty/fascicle/blob/v0.17.1/docs/testing.md) for the stand-in engines.
|
|
406
|
+
- [troubleshooting.md](https://github.com/robmclarty/fascicle/blob/v0.17.1/docs/troubleshooting.md) for errors and their causes.
|
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 {
|
|
2
|
+
import { M as Tool, N as ToolApprovalHandler } from "./types-C7pO0jLq.js";
|
|
3
3
|
import { AgentApp, ClientCapabilities, ContentBlock, SessionUpdate } from "@agentclientprotocol/sdk";
|
|
4
4
|
//#region src/acp/types.d.ts
|
|
5
5
|
/**
|
package/dist/acp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { E as run, k as aborted_error } from "./core-BOFcG3tp.js";
|
|
2
2
|
import { n as is_record, t as as_record } from "./records-1HU7mWXf.js";
|
|
3
3
|
import { t as json_schema_to_standard } from "./json_schema_to_standard-C4F4lXHE.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_writable, r as list_files_tool, s as error_code } from "./search-
|
|
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_writable, r as list_files_tool, s as error_code } from "./search-DjhdMsJ8.js";
|
|
5
5
|
import { t as route_console_to_stderr } from "./console-CdB4pcFO.js";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import { mkdir, open, stat, writeFile } from "node:fs/promises";
|
|
@@ -1267,13 +1267,18 @@ async function change_fields(change, session, input) {
|
|
|
1267
1267
|
* The card a request shows: the one the client already draws for the call
|
|
1268
1268
|
* under `card`, as its tool's presentation describes it, with the change
|
|
1269
1269
|
* for a write or an edit.
|
|
1270
|
+
*
|
|
1271
|
+
* A tool with no presenter names no kind. The client applies a request's
|
|
1272
|
+
* fields to the card it already drew, so a kind sent here would replace the
|
|
1273
|
+
* one the card's own opening gave it, and an absent kind leaves it as it was.
|
|
1270
1274
|
*/
|
|
1271
1275
|
async function permission_card(session, request, card, gate) {
|
|
1272
1276
|
const { tool_name: name, input } = request;
|
|
1277
|
+
const { kind } = opening_fields(session, name, card);
|
|
1273
1278
|
const fields = {
|
|
1274
1279
|
toolCallId: card,
|
|
1275
1280
|
title: name,
|
|
1276
|
-
kind:
|
|
1281
|
+
...kind === void 0 ? {} : { kind },
|
|
1277
1282
|
rawInput: input,
|
|
1278
1283
|
...input_fields(session, name, input)
|
|
1279
1284
|
};
|