feat(sandbox): accept PromptInputPart[] messages in prompt dispatch#187
Merged
Conversation
streamSandboxPrompt, runSandboxPrompt, and driveSandboxTurn take string | PromptInputPart[]; array messages fold conversation history into the leading text part via mergeHistoryIntoParts (throws when no text part is present). String messages keep the flattenHistory transcript unchanged. PromptInputPart is derived from the sandbox SDK's streamPrompt signature and re-exported for consumers.
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.
Substrate for gtm-agent#578 (native multimodal prompt dispatch): consumers can now dispatch structured
PromptInputPart[]— text plusimage/fileparts — through the sandbox prompt seam instead of being forced through the flattened-string path.streamSandboxPrompt,runSandboxPrompt, anddriveSandboxTurnacceptmessage: string | PromptInputPart[]. String messages take the exactflattenHistorypath as before (byte-identical, pinned by the existing seam tests); array messages route through the newmergeHistoryIntoParts.mergeHistoryIntoParts(parts, history?)folds the conversation transcript into the firsttextpart (${transcript}\n\nUser: ${text}— same format asflattenHistory, both now built by one shared transcript helper so they can't drift). Non-text parts pass through untouched, order preserved. No text part → throws: a parts array with nothing to anchor history onto is a caller bug, not something to paper over.PromptInputPartis re-exported for consumers. The sandbox SDK does not name-export this type from any public entry point (verified on 0.9.7 and 0.10.5), so it is derived structurally fromSandboxInstance['streamPrompt']'s parameter — it stays in lockstep with whatever the SDK actually accepts instead of being a hand-copied union that can drift.@tangle-network/sandboxdevDep aligned^0.9.7 → ^0.10.5to match what consumers (gtm-agent) resolve, so the widened signatures typecheck against the same SDK surface downstream.Tests: new seam coverage for array forwarding + history folding into
parts[0],mergeHistoryIntoPartspassthrough/order/throw cases; existing string-path tests unchanged and green (121 passed; the 3writeProfileFilesToBox/ensureWorkspaceSandboxtimeout flakes fail identically on a clean tree).tsc --noEmitclean; tsup build + dist.d.tsverified to carry the new exports.Consumer: gtm-agent PR tangle-network/gtm-agent#588 (draft) builds against this branch via local link and needs the release + a dep bump once this merges.