sync: note claude tool adapter
This commit is contained in:
parent
ee9c1715ae
commit
c7491406d1
@ -10,7 +10,21 @@
|
||||
|
||||
## Session Status
|
||||
|
||||
### Latest Verified State — 2026-05-12 22:55 Europe/Berlin
|
||||
### Latest Verified State — 2026-05-12 23:08 Europe/Berlin
|
||||
|
||||
- Companion tool-use adapter added and verified:
|
||||
- Anthropic `tools` are summarized into a strict tool-use adapter instruction for the text backend.
|
||||
- OpenAI-style `tool_calls` or compact JSON tool decisions are converted back to Anthropic `tool_use` content blocks.
|
||||
- Forced `tool_choice: {type:"tool"}` now returns a valid `tool_use` block even if the text backend returns an empty response.
|
||||
- Streaming tool use emits `content_block_start`, `input_json_delta`, `content_block_stop`, `message_delta`, and `message_stop`.
|
||||
- Synthetic proof:
|
||||
- Non-stream request with `read_file` returned `content[0].type=tool_use`, `name=read_file`, `input.path=/tmp/hello.txt`.
|
||||
- Streaming request returned valid Anthropic SSE tool-use events with `partial_json={"path":"/tmp/stream.txt"}`.
|
||||
- Claude Code text path still works through Companion/Gateway after the tool adapter; latest CLI smoke reached Gateway and dashboard logged `claude-code-companion`.
|
||||
- Remaining quality boundary:
|
||||
- Erik `/opt/claude-bridge/server.js` is text-only (`claude --print --output-format text`), so native model-driven Anthropic tool parity is still not the same as the hosted Anthropic API.
|
||||
- The adapter now supports tool block transport and forced tool calls, but auto tool selection depends on the text backend following the tool JSON instruction.
|
||||
- Short exact-answer prompts may still be answered creatively by the subscription bridge; this is provider behavior, not Companion protocol failure.
|
||||
|
||||
- Claude Code full CLI smoke now reaches the local Gateway Companion and public Gateway reliably:
|
||||
- Local Companion: `127.0.0.1:11435`.
|
||||
|
||||
34
sync/history/2026-05-12-claude-tool-adapter.md
Normal file
34
sync/history/2026-05-12-claude-tool-adapter.md
Normal file
@ -0,0 +1,34 @@
|
||||
# 2026-05-12 — Claude Tool Adapter
|
||||
|
||||
## Summary
|
||||
|
||||
The local Gateway Companion now has a bounded Anthropic tool-use adapter for Claude Code traffic.
|
||||
|
||||
## What Changed
|
||||
|
||||
- Anthropic request `tools` are rendered into a strict instruction for the text backend.
|
||||
- OpenAI-style tool calls and compact JSON tool decisions are converted into Anthropic `tool_use` blocks.
|
||||
- Forced `tool_choice: {type:"tool"}` returns a valid `tool_use` block even when the text backend returns an empty response.
|
||||
- Streaming tool use emits Anthropic-compatible SSE:
|
||||
- `message_start`
|
||||
- `content_block_start`
|
||||
- `content_block_delta` with `input_json_delta`
|
||||
- `content_block_stop`
|
||||
- `message_delta`
|
||||
- `message_stop`
|
||||
|
||||
## Verification
|
||||
|
||||
- Non-stream synthetic request:
|
||||
- Tool: `read_file`
|
||||
- Result: `content[0].type=tool_use`
|
||||
- Input: `{"path":"/tmp/hello.txt"}`
|
||||
- Streaming synthetic request:
|
||||
- Tool: `read_file`
|
||||
- Result: `input_json_delta`
|
||||
- Input: `{"path":"/tmp/stream.txt"}`
|
||||
- Claude Code CLI smoke after the change still reached the Gateway and produced dashboard rows for `claude-code-companion`.
|
||||
|
||||
## Boundary
|
||||
|
||||
The Erik `claude-bridge` remains text-only and calls `claude --print --output-format text`. Native hosted Anthropic tool-use parity is not complete. The adapter now transports and synthesizes tool blocks for forced tool calls, but autonomous tool selection still depends on the text backend following the JSON tool instruction.
|
||||
Loading…
x
Reference in New Issue
Block a user