cline 0.1.14: the own-routing test runs with the pin on; the pin is turned on by plugin option, not magpie's tick
Follow-up to #819 (0.1.13).
Changed:
- index.test.mjs: "the user's own provider or providerOptions on a
ClinePass DeepSeek request is left as they set it" and "a client's own
providerOptions refused by Cline is passed through" now run with
`{ pinUpstream: true }`. Without the pin on they passed whether or not
fetch kept the client's own routing field.
- README and the 403 hint: the pin is turned on and off by the plugin's
pinUpstream option (`magpie plugin options
@magpie-community/opencode-cline-auth '{"pinUpstream": false}'`, or the
OpenCode plugin/provider.cline options). magpie's Upstream tick is
magpie's own setting; it never set this option, and magpie no longer
writes providerOptions for it (yetone/magpie#5442).
- 0.1.14. A client-sent providerOptions is handled as in 0.1.13.
Run on mote, HOME=$(mktemp -d), Bun 1.4.2, at this tree on 39f59971:
- bun test packages/cline: 92 pass, 0 fail.
- bun test (repo): 6569 pass, 20 skip, 0 fail.
- bun scripts/check.mjs cline: ok (registry.json, cline).
- Broken by hand: fetch's `ownsRouting(chat) ? null :` removed, both
own-routing tests red (2), green with it back.
Not tried: a live Cline request (no Cline key here).
This commit is contained in:
@@ -105,10 +105,14 @@ downgrade. If Cline restores `providerOptions` routing, the same option works
|
||||
again without a plugin change. A request with `provider` or
|
||||
`providerOptions` of its own — magpie's extra body, say — goes as sent.
|
||||
|
||||
The option is off by default. Turn it on:
|
||||
The option is off by default. Turn it on (or back off, with `false`):
|
||||
|
||||
- in magpie: the provider's editor › Upstream › tick "DeepSeek and GLM
|
||||
models only from their makers' own APIs";
|
||||
- in magpie: `magpie plugin options @magpie-community/opencode-cline-auth
|
||||
'{"pinUpstream": true}'`, which keeps it in magpie's plugins.json. The
|
||||
provider editor's Upstream tick ("DeepSeek and GLM models only from their
|
||||
makers' own APIs") is magpie's own setting and never sets this option;
|
||||
since Cline refuses `providerOptions`, magpie no longer writes that field
|
||||
for the tick either;
|
||||
- in OpenCode: `"provider": {"cline": {"options": {"pinUpstream": true}}}` in
|
||||
`opencode.json`, or the plugin's own options:
|
||||
`"plugin": [["@magpie-community/opencode-cline-auth", {"pinUpstream": true}]]`.
|
||||
|
||||
@@ -803,7 +803,7 @@ const MAKERS = [
|
||||
]
|
||||
|
||||
// pinned is where a DeepSeek or GLM model of Cline's is pinned when the
|
||||
// pinUpstream option is on (magpie's built-in ClinePass has the same tick):
|
||||
// pinUpstream option is on (magpie's Upstream tick is its own, not this option):
|
||||
// { upstream, openRouter }, DeepSeek's own API for DeepSeek's, Z.ai's for
|
||||
// GLM, openRouter true for a model Cline sends through OpenRouter. Cline's
|
||||
// routers otherwise pick among the providers serving the model, and some
|
||||
@@ -1156,7 +1156,7 @@ export const ClinePlugin = async ({ client } = {}, options = {}) => {
|
||||
errorResponse({
|
||||
status: 403,
|
||||
message:
|
||||
'Cline refused the providerOptions pin (HTTP 403: client-supplied "providerOptions" model routing is not supported). Turn off pinUpstream (the Upstream tick) and let Cline route the model itself; glm-5.3-flash still works, but Cline ignores its top-level provider field, so it is not actually pinned.',
|
||||
`Cline refused the providerOptions pin (HTTP 403: client-supplied "providerOptions" model routing is not supported). Turn off the plugin's pinUpstream option (in magpie: magpie plugin options @magpie-community/opencode-cline-auth '{"pinUpstream": false}'; in OpenCode: the plugin's or provider.cline's options) and let Cline route the model itself; glm-5.3-flash still works, but Cline ignores its top-level provider field, so it is not actually pinned.`,
|
||||
}),
|
||||
renewed(cred),
|
||||
)
|
||||
|
||||
@@ -1287,7 +1287,9 @@ test("the models hook's catalog says which ClinePass DeepSeek model the pin asks
|
||||
|
||||
test("the user's own provider or providerOptions on a ClinePass DeepSeek request is left as they set it, and never retried without it", async () => {
|
||||
const { client: c } = client()
|
||||
const hooks = await ClinePlugin({ client: c })
|
||||
// pinUpstream on, so the plugin has a pin of its own the user's field
|
||||
// must win over (with no pin by default, nothing would be guarded)
|
||||
const hooks = await ClinePlugin({ client: c }, { pinUpstream: true })
|
||||
const own = [
|
||||
// hy125245's extra body, word for word
|
||||
{ model: "cline-pass/deepseek-v4.1-flash-1017", messages: [], providerOptions: { gateway: { only: ["deepseek"], has: ["vision", "implicit-caching"] } } },
|
||||
@@ -1311,7 +1313,8 @@ test("the user's own provider or providerOptions on a ClinePass DeepSeek request
|
||||
|
||||
test("a client's own providerOptions refused by Cline is passed through, not blamed on pinUpstream", async () => {
|
||||
const { client: c } = client()
|
||||
const hooks = await ClinePlugin({ client: c })
|
||||
// pinUpstream on: the client's field is still theirs, and the refusal theirs
|
||||
const hooks = await ClinePlugin({ client: c }, { pinUpstream: true })
|
||||
const own = { model: "cline-pass/deepseek-v4.1-flash", messages: [], providerOptions: { gateway: { only: ["deepseek"] } } }
|
||||
serve([
|
||||
[chatUrl, () => Response.json({ error: { message: 'Error 403: client-supplied "providerOptions" model routing is not supported' } }, { status: 403 })],
|
||||
@@ -1336,7 +1339,9 @@ test("a pinUpstream DeepSeek request Cline refuses says how to turn the pin off,
|
||||
expect(res.status).toBe(403)
|
||||
const body = await res.json()
|
||||
expect(body.error.type).toBe("cline_error")
|
||||
expect(body.error.message).toContain("Turn off pinUpstream")
|
||||
expect(body.error.message).toContain("Turn off the plugin's pinUpstream option")
|
||||
// magpie's Upstream tick never sets this option, so the hint names the option, not the tick
|
||||
expect(body.error.message).not.toMatch(/tick/i)
|
||||
expect(body.error.message).toContain("glm-5.3-flash")
|
||||
expect(body.error.message).toContain("not actually pinned")
|
||||
expect(calls.length).toBe(1)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-cline-auth",
|
||||
"version": "0.1.13",
|
||||
"version": "0.1.14",
|
||||
"description": "Cline (cline.bot) on your own account — usage billing, ClinePass and the free models — in OpenCode and magpie",
|
||||
"type": "module",
|
||||
"main": "./opencode.mjs",
|
||||
|
||||
Reference in New Issue
Block a user