Files
August 557511d73f openai-decisions: OpenAI Decisions as a System One provider (#762)
New package @magpie-community/opencode-openai-decisions-auth (provider
openai-decisions, model gpt-6-luna) by genglintong: answers magpie's
System One (base /systemone through its fetch) with OpenAI's
POST /v1/decisions, converting choice/score/noul to choice/score/predicate
and back with probabilities, confidence and usage. Sign-in is a plain
OpenAI API key from the host's getAuth, read again per request.

The six points of the 11-05 review, checked at 613fc413a:
1. credentials.mjs, the saved-key reader and the keyless method are gone;
   no read of providers.json, APPDATA or ~/.config/magpie anywhere.
2. A per-question {"type":"refusal"} is left out of answers; the others
   and usage are kept (all refused gives answers {}). magpie's own
   Decisions translation reads a missing answer as a refusal too.
3. Omitted, null or blank instructions get a non-empty default.
4. Registry entry on one line; merges cleanly with origin/main 9204c079.
5. Renamed; package.json magpie.icon and registry icon are an SVG data URI.
6. No test writes to disk; comments in English; the only repo link left is
   this one (NOTICE, for the opencode2.mjs bridge, byte-identical to
   scripts/opencode2.mjs at main).

Run at 613fc413a and at its merge with origin/main 9204c079, off the Mac:
- WSL magpie-desktop, fresh HOME: bun test packages/openai-decisions 23
  pass 0 fail; bun scripts/check.mjs 56/56 (merged tree 57/57);
  node 22.23.4 --test test/*.test.mjs 23/23 on the merged tree; full
  bun test of the merged tree: 8111 pass, 19 skip, 0 fail.
- Windows xiaomi-gpu, fresh HOME and USERPROFILE, Bun 1.4.2: 23 pass 0
  fail, check.mjs 56/56.
- Broken by hand, each red then restored: refusal thrown again (3 red),
  blank instructions passed through (1 red), key captured at load instead
  of per request (1 red), redirect:"error" dropped (1 red), URL check
  dropped (1 red).
- Tests reach no network (fetch injected or globalThis.fetch stubbed).
  npm pack --dry-run lists the 10 files; every runtime import is in files.

Not tried: a real OpenAI Decisions call (no credentials used), Windows or
Linux in a real magpie.
2026-11-11 14:27:27 +08:00

3.7 KiB

Verification

Maintainer-requested revision — 2026-11-11

The revision addresses the six requests in the maintainer's review.

  • Authentication uses only the host's selected-account getAuth callback. The saved-key reader, keyless method and disk credential fixtures are removed.
  • Per-question refusals are omitted, while ordinary answers and usage are retained. Duplicate, missing and unrequested answers still fail validation.
  • Omitted, null and blank System One instructions receive a non-empty default.
  • The package is @magpie-community/opencode-openai-decisions-auth, with an inline SVG data icon, a single-line registry entry and English code comments.
  • README, registry summaries, changelog and notice reflect the API-key-only behavior. Third-party provider repository references are removed.

Regression evidence

The revised tests first ran against the previous implementation: 16 passed, 7 failed. Failures included blank upstream instructions, per-question refusals turning a successful response into HTTP 502, the extra keyless sign-in, and the old package metadata. They then passed after the fix: 23 passed, 0 failed on Node and Bun.

The package tests are offline. Credentials and responses are synthetic and in-memory; no test creates a credential file or a .data/ directory. They cover all three question types, partial/all refusals, missing or invalid ordinary answers, structured evidence, defaults, account changes, sign-out, errors, cancellation and loader compatibility.

Current-main integration

The full suite at cdbfa0b rebased onto f8a52a2 completed with 8,073 passed, 9 skipped, 0 failed on Bun 1.4.4. The test HOME was an isolated directory under macOS's native temporary root, outside the Git checkout. Skipped optional/live/platform checks remain unverified.

The whole-community loader checker passed all 56 checks. Magpie's sandbox harness listed this provider with one model and no sign-in or vendor request. The package contains ten files and excludes the removed credential reader; credential/private-data scans, local Markdown links and the JSON request example passed.

The final metadata/documentation follow-up embeds an SVG data icon and places the registry entry beside the API-key providers. Focused tests and the loader checker are rerun after those changes; runtime modules remain identical to the full-suite run. Live OpenCode decision workflows and Windows/Linux execution have not been verified.

Earlier local gateway checks — 2026-11-05

The earlier revision used Magpie 0.1.3039, Node 26.3.0 and Bun 1.4.4.

Request model Result Actual model
typesafe/jev-latest HTTP 200; choice/noul/score answers present jev-1.14.0
openai-decisions/gpt-6-luna HTTP 200; choice/noul/score answers present gpt-6-luna
group/decisions HTTP 200; all three answers present jev-1.14.0, first in group order

A temporary chat group used classifier=openai-decisions/gpt-6-luna and effort=auto. Magpie recorded a real kind=routing, HTTP 200 classifier call before its downstream openai/gpt-5.6-luna chat returned OK. The temporary group was removed.

Those calls predate removal of the saved-key method and are historical protocol and gateway evidence. They do not establish a live standard-key sign-in check for the current revision. Live upstream quota failures and safety refusals were not forced; their status and per-question handling are verified with fixtures. Images and box decisions are outside the adapter's declared capabilities. Confidence values retain their vendor's original calibration.