@magpie-community/opencode-factory-auth 0.1.29 → 0.1.31

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.
Files changed (2) hide show
  1. package/index.mjs +17 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -13,8 +13,13 @@ const API = "https://api.factory.ai"
13
13
  const API_EU = "https://api.eu.factory.ai"
14
14
  // droid's WorkOS client, production
15
15
  const CLIENT_ID = "client_01HNM792M5G5G1A2THWPXKFMXB"
16
- // the droid release the requests say they are
17
- const VERSION = "0.233.0"
16
+ // the droid release the requests say they are: the current one (droid
17
+ // 0.242.0's X-Client-Version and User-Agent). Its binary reads a
18
+ // server-side min_cli_version, and both reports of every model answered a
19
+ // bare 403 "Forbidden" (0.1.16, 0.1.30) came with this release behind
20
+ // droid's while every other header matched; whether Factory refuses an old
21
+ // release so is not confirmed
22
+ const VERSION = "0.242.0"
18
23
  // how long before an access token lapses it is renewed (droid: a minute)
19
24
  const REFRESH_LEAD = 2 * 60 * 1000
20
25
  // and how long before, magpie renews it ahead of time (auth.refresh): a
@@ -167,7 +172,8 @@ function configModels() {
167
172
  reasoning: m.efforts.length > 0,
168
173
  attachment: m.images,
169
174
  tool_call: true,
170
- temperature: true,
175
+ // OpenAI's reasoning models take no temperature (droidBody)
176
+ temperature: m.upstream !== "openai",
171
177
  modalities: { input: m.images ? ["text", "image"] : ["text"], output: ["text"] },
172
178
  cost: { input: 0, output: 0 },
173
179
  limit: { context: m.context, output: m.output },
@@ -469,11 +475,18 @@ function droidBody(path, body) {
469
475
  if (path.endsWith("/responses")) {
470
476
  const v = m.instructions
471
477
  if (v !== undefined && v !== null && typeof v !== "string") return body // not something droid sends
478
+ // OpenAI's reasoning models turn temperature and top_p away with a 400,
479
+ // and droid sends neither (Nowledge Mem on gpt-6.1-sol, magpie's Discord)
480
+ const sampled = byId.get(m.model)?.upstream === "openai" && ("temperature" in m || "top_p" in m)
481
+ if (sampled) {
482
+ delete m.temperature
483
+ delete m.top_p
484
+ }
472
485
  const opened = promptOpenings(m.input)
473
486
  const ins = promptText(v ?? "")
474
487
  if (!ins.startsWith(DROID_LINE)) m.instructions = ins.trim() === "" ? DROID_LINE : DROID_LINE + "\n" + ins
475
488
  else if (ins !== v || opened) m.instructions = ins
476
- else return body
489
+ else if (!sampled) return body
477
490
  } else if (path.endsWith("/chat/completions")) {
478
491
  if (!Array.isArray(m.messages)) return body
479
492
  const opened = promptOpenings(m.messages, true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-factory-auth",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "Sign in to a Factory (Droid) subscription from OpenCode or magpie",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",