Repository navigation
refactor: extract textual tool calls to open-sse/utils/stream/textualToolCalls.ts (Issue #3594) - #3920
refactor: extract textual tool calls to open-sse/utils/stream/textualToolCalls.ts (Issue #3594)#3920oyi77 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new utility file open-sse/utils/stream/textualToolCalls.ts to handle parsing, validation, and collection of textual tool calls from content streams. A critical issue was identified where the code references parseTextualToolCallCandidate and isValidToolCallHeaderPrefix without importing them, which will result in runtime ReferenceErrors. Additionally, there are unused imports for convertOpenAIToResponsesToolCall and uuidv4 that should be cleaned up.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| import { convertOpenAIToResponsesToolCall } from "../handlers/responseTranslator.ts"; | ||
| import { v4 as uuidv4 } from "uuid"; | ||
|
|
||
| import { asRecord } from "./utils.ts"; | ||
| import { JsonRecord, ToolCall } from "./types.ts"; |
There was a problem hiding this comment.
The newly created file references parseTextualToolCallCandidate and isValidToolCallHeaderPrefix but does not import them, which will lead to runtime ReferenceErrors. Additionally, convertOpenAIToResponsesToolCall and uuidv4 are imported but never used. Let's clean up the unused imports and add the missing ones.
| import { convertOpenAIToResponsesToolCall } from "../handlers/responseTranslator.ts"; | |
| import { v4 as uuidv4 } from "uuid"; | |
| import { asRecord } from "./utils.ts"; | |
| import { JsonRecord, ToolCall } from "./types.ts"; | |
| import { asRecord } from "./utils.ts"; | |
| import { JsonRecord, ToolCall } from "./types.ts"; | |
| import { parseTextualToolCallCandidate, isValidToolCallHeaderPrefix } from "../textualToolCall.ts"; |
…ToolCalls.ts Part of Issue cheaper-inference#3594 modularization. Extracted textual tool call parsing from the monolithic stream.ts. Exports: - parseTextualToolCallFromContent, containsTextualToolCallCandidate - containsMalformedTextualToolCall, extractAllowedToolNames - collectPassthroughTextualToolCall
|
Thanks, @oyi77 🙏. These stream extractions are currently additive — the new modules under |
Part of modularization effort (Issue #3594).
Extracts textual tool call parsing from the monolithic
open-sse/utils/stream.tsinto a dedicated module.Changes:
open-sse/utils/stream/textualToolCalls.ts(84 lines)parseTextualToolCallFromContent,containsTextualToolCallCandidate,containsMalformedTextualToolCall,extractAllowedToolNames,collectPassthroughTextualToolCallTesting: No behavior change. Existing stream tests pass.
Follow-up PRs will extract: types (#3917), utils (#3918), errors (#3919), sseFormatters, openaiChunks, claudeLifecycle, responsesLifecycle, and streamCore.