dev: oh my Claude
Docker Image CI / build-and-push-image (push) Waiting to run
Maintain Release Merge PR / update-release-pr (push) Waiting to run
release-please / release-please (push) Waiting to run
test / test (18.x) (push) Waiting to run
test / test (20.x) (push) Waiting to run
test / test (22.x) (push) Waiting to run

Sometimes tool use requests are streamed as JSON, but sometimes they're
streamed as an empty string (causing the JSON parser to error). Had they
not streamed anything we actually would've responded correctly, but
what they stream implies "this empty string is the JSON input" which is
incorrect. Oh well.
This commit is contained in:
KernelDeimos
2025-01-27 21:32:50 -05:00
parent 3f99d975c0
commit 97f86e564f
@@ -209,6 +209,13 @@ class ClaudeService extends BaseService {
on_event: (event) => {
if ( event.type === 'content_block_stop' ) {
state = STATES.ready;
// Yeah... claude will send an empty string instead of
// an empty object when there's no input. So we have to
// check for that. Good job, Anthropic.
if ( buffer === '' ) {
buffer = '{}';
}
const str = JSON.stringify({
tool_use: {
...content_block,