magpie now hands a request that turned tools off with none declared
(Chat's tool_choice "none", Anthropic's {"type":"none"}, Gemini's
functionCallingConfig NONE) to a Responses plugin as tool_choice "none"
with no tools, so a plugin that adds a server-side tool (x_search, #263)
can tell it from no choice. Grok's backend refuses a tool_choice with no
tools ("A tool_choice was set on the request but no tools were
specified", yetone/magpie#378), which magpie's grokBody used to leave out
for the plugin. rewrite now leaves out any tool_choice with no tools, or
none left after the dropped types, as the built-in's grokBody does.
What was run:
- TMPDIR=<scratch> HOME=<scratch>/home bun test: 2018 pass, 0 fail.
(HOME outside os.tmpdir() trips zcode's isolated-home guard: 19 fail,
2 errors, all that guard; not this change.)
- bun scripts/check.mjs: passes.
- tool-choice.test.mjs against origin/main's index.mjs: 1 pass, 1 fail
(the lone-tool_choice case), green with this change.
Not tried against Grok's live backend.