Skip to content

Commit 0bb36b6

Browse files
committed
fix(anthropic): drop unused sawContent stream flag
EOF completion already keys off stop_reason; remove dead tracking.
1 parent c294df5 commit 0bb36b6

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

‎src/adapters/anthropic.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,6 @@ export function createAnthropicAdapter(provider: OcxProviderConfig, cacheRetenti
764764
let pendingUsage: Record<string, number> | undefined;
765765
let pendingStopReason: string | undefined;
766766
let emittedDone = false;
767-
let sawContent = false;
768767

769768
const emitDone = function* (): Generator<AdapterEvent> {
770769
if (emittedDone) return;
@@ -805,7 +804,6 @@ export function createAnthropicAdapter(provider: OcxProviderConfig, cacheRetenti
805804
if (block.type === "tool_use") {
806805
currentToolCallId = block.id ?? synthesizeToolUseId();
807806
currentToolCallName = toolNames.fromWire(block.name ?? "");
808-
sawContent = true;
809807
yield { type: "tool_call_start", id: currentToolCallId, name: currentToolCallName };
810808
}
811809
if (block.type === "redacted_thinking" && typeof block.data === "string") {
@@ -818,24 +816,19 @@ export function createAnthropicAdapter(provider: OcxProviderConfig, cacheRetenti
818816
const delta = data.delta as Record<string, unknown> | undefined;
819817
if (!delta) break;
820818
if (delta.type === "text_delta" && typeof delta.text === "string") {
821-
sawContent = true;
822819
yield { type: "text_delta", text: delta.text };
823820
} else if (delta.type === "thinking_delta" && typeof delta.thinking === "string") {
824-
sawContent = true;
825821
yield { type: "thinking_delta", thinking: delta.thinking };
826822
} else if (delta.type === "reasoning_delta" && typeof delta.reasoning === "string") {
827823
// Some Anthropic-compatible reasoning models use `reasoning` names for the
828824
// otherwise equivalent thinking block. Preserve it as raw reasoning and keep
829825
// later text blocks independent.
830-
sawContent = true;
831826
yield { type: "thinking_delta", thinking: delta.reasoning };
832827
} else if (delta.type === "signature_delta" && typeof delta.signature === "string" && (currentBlockType === "thinking" || currentBlockType === "reasoning")) {
833828
// Arrives once, just before the thinking block's content_block_stop; block-scoped
834829
// so a stray signature on a non-thinking block can never be captured.
835-
sawContent = true;
836830
yield { type: "thinking_signature", signature: delta.signature };
837831
} else if (delta.type === "input_json_delta" && typeof delta.partial_json === "string" && currentBlockType === "tool_use") {
838-
sawContent = true;
839832
yield { type: "tool_call_delta", arguments: delta.partial_json };
840833
}
841834
break;

0 commit comments

Comments
 (0)