An option on the grok provider, "Native X search" (auth.options key
x_search, off by default), read through magpie.option on each fetch.
When on, a Responses request whose tool_choice is auto, or absent with
tools declared, is offered Grok's native {"type":"x_search"}. none,
required, a named tool, allowed_tools and an x_search choice add nothing;
an x_search already declared keeps its filters and isn't duplicated; a
request with neither tools nor a tool_choice is left alone.
Reviewed at 99e602006 (vectorisvector). Run at that head:
- HOME and TMPDIR in a scratch dir, bun test: 2040 pass, 0 fail;
bun scripts/check.mjs: ok; PR CI run 39532960081 green (attempt 1 was
only awaiting approval)
- broken by hand, each red: on by default 4 fail, option ignored 2, every
path 1, tool_choice ignored 5, duplicate x_search 1, inject after
tools filtered 1, both no-tools guards removed 1, non-array tools 1,
wrong provider id 1, no injection 10
- magpie gateway at ba319a758 with this plugin loaded (BASE pointed at a
fake upstream), option off/on/off: Chat, Anthropic and Gemini (whole and
streamed) with a function get x_search; their tools-off "none" and
Chat/Anthropic required, named and no-tools requests don't; Responses
auto (whole and streamed) gets it, none doesn't, an existing x_search
is kept once; no upstream body names magpie; an x_search_call item in
the reply doesn't reach Chat/Anthropic/Gemini clients
- one gap on magpie's side: an allowed_tools choice is dropped by the
gateway before the plugin can read it, so it gets x_search; filed as
yetone/magpie#3153
Not tried: a real Grok account.
17 lines
536 B
JSON
17 lines
536 B
JSON
{
|
|
"name": "@magpie-community/opencode-grok-auth",
|
|
"version": "0.2.0",
|
|
"description": "OpenCode provider plugin: Grok (SuperGrok / X Premium+) through the Grok Build CLI's sign-in",
|
|
"type": "module",
|
|
"main": "./index.mjs",
|
|
"exports": "./index.mjs",
|
|
"files": ["index.mjs", "README.md"],
|
|
"keywords": ["opencode", "opencode-plugin", "grok", "xai", "supergrok"],
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/magpie-community/plugins.git",
|
|
"directory": "packages/grok"
|
|
}
|
|
}
|