@magpie-community/opencode-opendesign-auth 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/index.mjs +44 -7
- package/models.mjs +12 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,9 +81,12 @@ The script keeps the names and measured levels already there — the catalog
|
|
|
81
81
|
carries neither — and reads nothing else: no secret is written to the file or
|
|
82
82
|
printed.
|
|
83
83
|
|
|
84
|
-
Requests go to
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
Requests go to `https://amr-link.open-design.ai/v1`, each model on the API
|
|
85
|
+
amr-link answers its thinking on (measured, plugins#141): chat completions
|
|
86
|
+
(`@ai-sdk/openai-compatible`) for most, the Responses API (`@ai-sdk/openai`)
|
|
87
|
+
for `claude-haiku-5.5` and `deepseek-v4-pro`, and Anthropic's messages
|
|
88
|
+
(`@ai-sdk/anthropic`) for `glm-5.3-flash`. Every model reasons at `low`,
|
|
89
|
+
`high` and `max`.
|
|
87
90
|
|
|
88
91
|
## Where the sign-in is kept
|
|
89
92
|
|
package/index.mjs
CHANGED
|
@@ -21,7 +21,28 @@ import { MODELS } from "./models.mjs"
|
|
|
21
21
|
const ID = "opendesign"
|
|
22
22
|
const CONTROL = "https://amr-api.open-design.ai"
|
|
23
23
|
const LINK = "https://amr-link.open-design.ai/v1"
|
|
24
|
-
|
|
24
|
+
// WHICH API each model is asked on: magpie reads the protocol off the AI SDK
|
|
25
|
+
// package a model declares (its api.npm) — "@ai-sdk/openai" is the Responses
|
|
26
|
+
// API, "@ai-sdk/anthropic" Anthropic's messages, the compatible package chat
|
|
27
|
+
// completions. amr-link answers thinking on a different one per model
|
|
28
|
+
// (sryimnoob123's measurements, plugins#141: a streaming request to each model
|
|
29
|
+
// on each of the three): chat completions carries the thinking of ten of the
|
|
30
|
+
// eleven; deepseek-v4-pro and claude-haiku-5.5 think longer on Responses, and
|
|
31
|
+
// glm-5.3-flash only thinks on Anthropic's messages among the two others.
|
|
32
|
+
const WIRE = {
|
|
33
|
+
chat: "@ai-sdk/openai-compatible",
|
|
34
|
+
responses: "@ai-sdk/openai",
|
|
35
|
+
anthropic: "@ai-sdk/anthropic",
|
|
36
|
+
}
|
|
37
|
+
const MODEL_WIRE = {
|
|
38
|
+
"claude-haiku-5.5": "responses",
|
|
39
|
+
"deepseek-v4-pro": "responses",
|
|
40
|
+
"glm-5.3-flash": "anthropic",
|
|
41
|
+
}
|
|
42
|
+
const wireOf = (id) => WIRE[MODEL_WIRE[id]] ?? WIRE.chat
|
|
43
|
+
// the provider's own default: a model this plugin doesn't name is asked on
|
|
44
|
+
// chat completions, where ten of the eleven thought
|
|
45
|
+
const NPM = WIRE.chat
|
|
25
46
|
const SOURCE = "opencode-opendesign-auth/" + pkg.version // as the manifest has it
|
|
26
47
|
const CLI_VERSION = "0.1.4" // what the sign-in says it is, as the CLI does
|
|
27
48
|
const TIMEOUT = 20_000
|
|
@@ -100,10 +121,16 @@ async function api(base, path, { key, body, method = "GET", signal } = {}) {
|
|
|
100
121
|
|
|
101
122
|
// startDevice opens a device authorization: a code, the page that approves
|
|
102
123
|
// it, and the secret the approval is polled with.
|
|
103
|
-
|
|
124
|
+
// host is this computer's name, as `vela login` sends it (os.Hostname());
|
|
125
|
+
// when it can't be read the CLI stops with "resolve hostname", and so does
|
|
126
|
+
// this, rather than send a name of its own.
|
|
127
|
+
async function startDevice({ signal, host = hostname } = {}) {
|
|
128
|
+
let name = ""
|
|
129
|
+
try { name = String(host() ?? "").trim() } catch {}
|
|
130
|
+
if (!name) throw new Error("Open Design sign-in: this computer's name couldn't be read, and the sign-in sends it")
|
|
104
131
|
const r = await api(CONTROL, "/api/v1/cli/device-authorizations", {
|
|
105
132
|
method: "POST",
|
|
106
|
-
body: { cliVersion: CLI_VERSION, host:
|
|
133
|
+
body: { cliVersion: CLI_VERSION, host: name, profile: "prod" },
|
|
107
134
|
signal,
|
|
108
135
|
})
|
|
109
136
|
const d = r.body
|
|
@@ -261,6 +288,9 @@ function modelOf(id, m) {
|
|
|
261
288
|
tool_call: true,
|
|
262
289
|
reasoning: thinking,
|
|
263
290
|
...(levels.length && { variants: Object.fromEntries(levels.map((e) => [e, { reasoningEffort: e }])) }),
|
|
291
|
+
// the API magpie asks this model on (WIRE above), per model
|
|
292
|
+
api: { npm: wireOf(id) },
|
|
293
|
+
provider: { npm: wireOf(id) },
|
|
264
294
|
...(rate && { rate }),
|
|
265
295
|
limit: {
|
|
266
296
|
context: Number.isFinite(context) && context > 0 ? context : 200_000,
|
|
@@ -284,7 +314,7 @@ function servedOf(id, m) {
|
|
|
284
314
|
return {
|
|
285
315
|
id,
|
|
286
316
|
name: c.name,
|
|
287
|
-
api: { id, url: LINK, npm:
|
|
317
|
+
api: { id, url: LINK, npm: wireOf(id) },
|
|
288
318
|
status: "active",
|
|
289
319
|
headers: {},
|
|
290
320
|
options: {},
|
|
@@ -400,12 +430,19 @@ export const OpenDesignAuthPlugin = async () => {
|
|
|
400
430
|
config: async (cfg) => {
|
|
401
431
|
cfg.provider ??= {}
|
|
402
432
|
const was = cfg.provider[ID] ?? {}
|
|
433
|
+
// the wire is this plugin's to declare, never a kept copy's: magpie
|
|
434
|
+
// hands back what the hook last wrote, and a model kept from 0.1.5
|
|
435
|
+
// would otherwise stay on the Responses API it chose for every model
|
|
436
|
+
const models = { ...seed(), ...(was.models ?? {}) }
|
|
437
|
+
for (const [id, m] of Object.entries(models)) {
|
|
438
|
+
models[id] = { ...m, api: { ...(m.api ?? {}), npm: wireOf(id) }, provider: { ...(m.provider ?? {}), npm: wireOf(id) } }
|
|
439
|
+
}
|
|
403
440
|
cfg.provider[ID] = {
|
|
404
441
|
name: "Open Design",
|
|
405
|
-
npm: NPM,
|
|
406
442
|
api: LINK,
|
|
407
443
|
...was,
|
|
408
|
-
|
|
444
|
+
npm: NPM,
|
|
445
|
+
models,
|
|
409
446
|
}
|
|
410
447
|
},
|
|
411
448
|
// the plan decides which models an account gets, so the list is read
|
|
@@ -468,4 +505,4 @@ export const OpenDesignAuthPlugin = async () => {
|
|
|
468
505
|
|
|
469
506
|
// _internal is what the tests read through; magpie calls every exported
|
|
470
507
|
// function as a plugin, so only the plugin itself is exported bare.
|
|
471
|
-
export const _internal = { authOf, allowances, controlKeyOf, credits, modelsOf, money, runtimeKeyOf, said, thePlan, usedPercent, waitForDevice, windowName, when, workspaceOf }
|
|
508
|
+
export const _internal = { authOf, allowances, controlKeyOf, credits, modelsOf, money, runtimeKeyOf, said, startDevice, thePlan, usedPercent, waitForDevice, windowName, when, workspaceOf }
|
package/models.mjs
CHANGED
|
@@ -8,18 +8,19 @@
|
|
|
8
8
|
// the non-text modalities it takes; cost and capability: the vendor's own
|
|
9
9
|
// words, which the plugin turns into magpie's rate and thinking flags;
|
|
10
10
|
// efforts: the reasoning levels amr-link was seen to take and think at,
|
|
11
|
-
// measured, not read (#137
|
|
11
|
+
// measured, not read (#137; max too, plugins#141: the vendor names low, high
|
|
12
|
+
// and max when asked for one it doesn't take), so a refresh keeps them.
|
|
12
13
|
|
|
13
14
|
export const MODELS = {
|
|
14
|
-
"claude-haiku-5.5": { name: "Claude Haiku 5.5", context: 1000000, output: 132000, input: ["image", "file"], cost: "low", capability: "standard", efforts: ["low", "high"] },
|
|
15
|
-
"deepseek-v4-flash": { name: "DeepSeek V4 Flash", context: 1048000, output: 232000, cost: "medium", capability: "standard", efforts: ["low", "high"] },
|
|
16
|
-
"deepseek-v4-flash-vision-exp": { name: "DeepSeek V4 Flash Vision (exp)", context: 1048000, output: 232000, input: ["image"], cost: "medium", capability: "standard", efforts: ["low", "high"] },
|
|
17
|
-
"deepseek-v4-pro": { name: "DeepSeek V4 Pro", context: 1048000, output: 232000, cost: "high", capability: "advanced", efforts: ["low", "high"] },
|
|
18
|
-
"deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced", efforts: ["low", "high"] },
|
|
19
|
-
"glm-5.3-flash": { name: "GLM 5.3 Flash", context: 1048000, output: 232000, input: ["image", "video"], cost: "low", capability: "advanced", efforts: ["low", "high"] },
|
|
20
|
-
"glm-5.3-flashx": { name: "GLM 5.3 FlashX", context: 1000000, output: 232000, input: ["image", "file", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
|
|
15
|
+
"claude-haiku-5.5": { name: "Claude Haiku 5.5", context: 1000000, output: 132000, input: ["image", "file"], cost: "low", capability: "standard", efforts: ["low", "high", "max"] },
|
|
16
|
+
"deepseek-v4-flash": { name: "DeepSeek V4 Flash", context: 1048000, output: 232000, cost: "medium", capability: "standard", efforts: ["low", "high", "max"] },
|
|
17
|
+
"deepseek-v4-flash-vision-exp": { name: "DeepSeek V4 Flash Vision (exp)", context: 1048000, output: 232000, input: ["image"], cost: "medium", capability: "standard", efforts: ["low", "high", "max"] },
|
|
18
|
+
"deepseek-v4-pro": { name: "DeepSeek V4 Pro", context: 1048000, output: 232000, cost: "high", capability: "advanced", efforts: ["low", "high", "max"] },
|
|
19
|
+
"deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced", efforts: ["low", "high", "max"] },
|
|
20
|
+
"glm-5.3-flash": { name: "GLM 5.3 Flash", context: 1048000, output: 232000, input: ["image", "video"], cost: "low", capability: "advanced", efforts: ["low", "high", "max"] },
|
|
21
|
+
"glm-5.3-flashx": { name: "GLM 5.3 FlashX", context: 1000000, output: 232000, input: ["image", "file", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high", "max"] },
|
|
21
22
|
"gpt-6-luna": { name: "GPT-6 Luna", context: 1050000, output: 304000, input: ["image", "file"], cost: "low", capability: "standard", efforts: [] },
|
|
22
|
-
"kimi-k2.7-code": { name: "Kimi K2.7 Code", context: 262000, output: 262000, input: ["image"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
|
|
23
|
-
"mimo-v2.6-flash": { name: "MiMo V2.6 Flash", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "low", capability: "standard", efforts: ["low", "high"] },
|
|
24
|
-
"mimo-v2.6-pro": { name: "MiMo V2.6 Pro", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
|
|
23
|
+
"kimi-k2.7-code": { name: "Kimi K2.7 Code", context: 262000, output: 262000, input: ["image"], cost: "medium", capability: "advanced", efforts: ["low", "high", "max"] },
|
|
24
|
+
"mimo-v2.6-flash": { name: "MiMo V2.6 Flash", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "low", capability: "standard", efforts: ["low", "high", "max"] },
|
|
25
|
+
"mimo-v2.6-pro": { name: "MiMo V2.6 Pro", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high", "max"] },
|
|
25
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magpie-community/opencode-opendesign-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Open Design Cloud (Design Plan) in OpenCode and magpie: the account's device sign-in, its models, and the plan's 5-hour and 7-day allowance",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|