fabro/lib/components/fabro-agent/src
Bryan Helmkamp 1e284c625e
Simplify bounded tool output capture
Apply cleanups from a reuse/simplification/efficiency review of the
bounded-tool-output changes:

- Share one MAX_RUN_EVENT_BODY_BYTES constant in fabro-types; the server
  body limit, the agent's serialized-output reservation, and the event
  headroom test all derive from it.
- Rework truncation.rs around one split_head_tail helper: drop the
  hand-rolled ceil_char_boundary (std's is stable), the duplicate
  truncate_plain_output splitter and its dead Tail arm, and the
  head_bytes field with its sentinel values.
- Return Cow from preview_tool_output and take retain_tool_output's
  input by value, so untruncated output crosses the pipeline without
  full copies. Measure serialized JSON size with a counting writer
  instead of materializing the payload.
- Reuse fabro-llm's byte-token estimate (now public) instead of a third
  copy of the 4-bytes-per-token heuristic.
- Take retain_tool_result's ToolResult by value and mutate content in
  place; extract the triplicated error retain-emit-truncate block into
  finish_error_result.
- Share the shell retain-and-record sequence between the native and
  kimi shell tools as retain_shell_output.
- Move OutputCaptureBuffer::into_parts to reuse the head allocation,
  skip the buffer round-trip in replay_exec_result when output fits,
  and replace daytona's byte-iterator suffix matching with contiguous
  slice comparisons behind one retained_slices accessor.
- Make SessionBoundEmitter's fields private.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TK3QTWQHiXhRbFwTr57LzX
2026-08-24 13:56:16 -04:00
..
profiles Simplify bounded tool output capture 2026-08-24 13:56:16 -04:00
agent_profile.rs fix(agent): harden compaction reasoning budgets 2026-07-24 21:58:23 -04:00
apply_patch.lark refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
apply_patch.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
cli.rs refactor(search): select backend from available credentials 2026-08-21 20:09:52 -04:00
compaction.rs refactor(model): rename Kimi provider to Moonshot 2026-07-31 09:00:52 -04:00
config.rs refactor(search): select backend from available credentials 2026-08-21 20:09:52 -04:00
context_window.rs fix(agent): harden Kimi profile tool contracts 2026-07-24 22:05:48 -04:00
docker_sandbox.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
error.rs fix(agent): harden compaction failure handling 2026-07-24 20:57:57 -04:00
event.rs Simplify bounded tool output capture 2026-08-24 13:56:16 -04:00
file_tracker.rs fix(agent): harden Kimi profile tool contracts 2026-07-24 22:05:48 -04:00
history.rs refactor(agent): simplify task reminder staging and test fixtures 2026-08-04 14:20:32 -04:00
lib.rs Bound agent tool output capture 2026-08-24 12:34:43 -04:00
local_sandbox.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
loop_detection.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
mcp_integration.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
memory.rs feat(agent): add Claude 5 profile 2026-07-25 13:15:57 -04:00
native_tool.rs refactor(agent): give Claude 5 subagent tools fabro canonical names 2026-07-26 07:57:42 -04:00
question_tools.rs refactor(agent): share one normalizer between the question tools 2026-07-26 08:04:24 -04:00
sandbox.rs Bound agent tool output capture 2026-08-24 12:34:43 -04:00
session.rs refactor(agent): simplify task reminder staging and test fixtures 2026-08-04 14:20:32 -04:00
skills.rs feat(agent): add Claude 5 profile 2026-07-25 13:15:57 -04:00
subagent.rs docs: record why a resumed turn's send cannot hang an agent 2026-08-01 10:17:10 -04:00
task_reminder.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
test_support.rs refactor(agent): simplify task reminder staging and test fixtures 2026-08-04 14:20:32 -04:00
todo_runtime.rs fix(agent): correct background-agent notification delivery 2026-07-25 15:15:39 -04:00
todo_tools.rs feat(agent): add Claude 5 profile 2026-07-25 13:15:57 -04:00
tool_execution.rs Simplify bounded tool output capture 2026-08-24 13:56:16 -04:00
tool_permissions.rs refactor(agent): model built-in tools as an enum with per-profile vocabularies 2026-07-24 20:04:11 -04:00
tool_registry.rs Record tool output byte counts 2026-08-24 12:46:27 -04:00
tools.rs Simplify bounded tool output capture 2026-08-24 13:56:16 -04:00
truncation.rs Simplify bounded tool output capture 2026-08-24 13:56:16 -04:00
types.rs Record tool output byte counts 2026-08-24 12:46:27 -04:00
web_search.rs refactor(search): select backend from available credentials 2026-08-21 20:09:52 -04:00