Repository navigation
E.4: ToolInputStart dynamic as ToolKind (core normalized, provider layer tri-state) (phase 1E; on #28) - #31
Open
cunninghamcard-bit wants to merge 1 commit into
Conversation
Shared ToolKind { Static, Dynamic }. Provider-layer StreamPart keeps the V4
tri-state (Option<ToolKind>, stream-part.ts:58); core TextStreamPart always
writes the boolean (stream-language-model-call.ts:809), absent = Static.
into_text_stream_part maps absent to Static. serde(with) modules keep the
wire; #[ts(optional, as = "Option<bool>")] keeps StreamPart.ts /
TextStreamPart.ts unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1E unit E.4 (PHASES 1E, A7 §D25). Stacked on #28 (
exp/e3-toolresult-enum@ 0f4aa9e), and the PR base is that branch. Commit a498558.Change
aimux-core/src/tool.rs: new sharedpub enum ToolKind { Static, Dynamic }, re-exported, withis_dynamic()andfrom_dynamic(). Two crate-private serde modules handle the wire boolean:tool_kind_boolalways writes the boolean, and treats an absent field orfalseasStatic.tool_kind_optionkeeps all three states (absent / false / true).aimux-core/src/stream_part.rs:StreamPart::ToolInputStart.dynamic: Option<ToolKind>: keeps the three states. This is V4 provider output, and AI SDKlanguage-model-v4-stream-part.ts:58passes it through.TextStreamPart::ToolInputStart.dynamic: ToolKind: always writes the boolean, and absent equalsfalse(AI SDK corestream-language-model-call.ts:809writesdynamic: chunk.dynamic ?? tool?.type === 'dynamic').into_text_stream_partmaps absent toStatic. Core has no tool set at this point, so the SDK'stool?.type === 'dynamic'fallback is not modelled.provider_executedis unchanged (Option<bool>, passed through).#[ts(optional, as = "Option<bool>")], soStreamPart.tsandTextStreamPart.tshave zero diff.gen_ts_types.py --checkpasses andbindings/has no diff.anthropic/stream.rs:1385(dynamic.map(ToolKind::from_dynamic)). All other sites writedynamic: Noneand are unchanged.Why StreamPart is not normalized
A7's D25 table lists "StreamPart/TextStreamPart → always write". However:
StreamPartis the provider-layer (V4) stream type, and A7's own row for V4 DTOs saysdynamicis passed through.StreamPartwould add"dynamic":falseto every provider stream part, which would breakopenai_upstream_e2e_test::responses_web_search_streamand the other upstream ports.So this PR normalizes only the core
TextStreamPartand keeps the three states on the provider-layerStreamPart. That is the same layer split as E.3. Please confirm, and A7's D25 row should be reworded to nameTextStreamPartonly.Samples / tests
fixtures/v4/enum-state/normalized/stream_tool_input_start.jsonlis now the identity, because the provider layer passes values through.gen_samples.pywas updated. The 4 rows that changed are the absent/false rows that E.0 had normalized.stream_tool_input_start.jsonlstill matches the 8455db9 baseline byte for byte.text_stream_tool_input_start_samples_match_baselinebecametext_stream_tool_input_start_samples_match_normalized: samples serialize tonormalized/(D25), and the normalized lines are a fixed point.baseline_equals_samplesno longer lists it.tool_input_start_kind:falsegive the same JSON;None);into_text_stream_partmapstruetoToolKind::Dynamic.responses_web_search_streampasses unchanged.fixtures/v4/enum-state/(the two files above).untaggedorflattenadded.Results (local linux x64)
Python was not run (no venv). The final clippy fix, which made the serde modules
pub(crate), was made after the full test run; it only changes visibility, and clippy passes on it.