opencode-muse-auth 0.5.0 → 0.5.1
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 +8 -6
- package/dist/index.js +11 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,8 +55,11 @@ token from the login flow is kept in memory only and is never written to disk.
|
|
|
55
55
|
with Muse Code's builtins on the way to `api.meta.ai`, restores them in the response, and
|
|
56
56
|
normalizes parameters Meta rejects (`tool_choice`, reasoning effort, output-token floor,
|
|
57
57
|
encrypted-reasoning include). The adapter's `/v1` origin becomes the per-request base URL; on
|
|
58
|
-
routes that ignore that override the plugin rewrites the assembled request onto the same origin.
|
|
59
|
-
|
|
58
|
+
routes that ignore that override the plugin rewrites the assembled request onto the same origin.
|
|
59
|
+
Routing does not depend on the credential type: an existing `meta` API key and the V2 Muse OAuth
|
|
60
|
+
connection both go through the adapter; the OAuth access token only overrides `Authorization`
|
|
61
|
+
when the V2 sign-in is active. If Meta still refuses the request, the adapter retries once with
|
|
62
|
+
every tool aliased. See [ADAPTER_CONTRACT.md](ADAPTER_CONTRACT.md).
|
|
60
63
|
- V1 storage: the OpenCode auth store is the primary source, and the loader falls back to the
|
|
61
64
|
legacy cache only when the store has no key.
|
|
62
65
|
- V2 storage: the credential lives in the OpenCode integration store, and no local cache is
|
|
@@ -68,10 +71,9 @@ token from the login flow is kept in memory only and is never written to disk.
|
|
|
68
71
|
|
|
69
72
|
## Requirements
|
|
70
73
|
|
|
71
|
-
- opencode
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
but still receive Meta's `client_attestation_denied` 403.
|
|
74
|
+
- opencode 2.2.4 or newer for inference through the adapter (the V2 plugin module shape; 2.2.0
|
|
75
|
+
loads the plugin but does not invoke its setup). On the V1 plugin API the plugin keeps
|
|
76
|
+
authenticating but still receives Meta's `client_attestation_denied` 403.
|
|
75
77
|
- Node.js 22.6 or newer for development; CI runs Node.js 22 and 24.
|
|
76
78
|
- An active Muse Code subscription on the Meta account used at login.
|
|
77
79
|
|
package/dist/index.js
CHANGED
|
@@ -131,23 +131,23 @@ export async function setupV2(ctx, options = {}) {
|
|
|
131
131
|
return credential;
|
|
132
132
|
}
|
|
133
133
|
if (adapter) {
|
|
134
|
-
//
|
|
135
|
-
//
|
|
134
|
+
// Every Meta inference request must reach the adapter: it reshapes the tool
|
|
135
|
+
// declarations the gate inspects, so the credential type does not matter
|
|
136
|
+
// (V1 API key or V2 OAuth). Native provider drivers honor this override.
|
|
136
137
|
const baseUrl = adapter.baseUrl;
|
|
137
138
|
await ctx.session.hook("model.request", async (event) => {
|
|
138
|
-
|
|
139
|
-
event.baseURL = baseUrl;
|
|
139
|
+
event.baseURL = baseUrl;
|
|
140
140
|
}, { providerID: "meta" });
|
|
141
141
|
}
|
|
142
|
-
// Meta's native provider expects a bearer inference key, not the
|
|
143
|
-
//
|
|
144
|
-
// AI SDK routes drop model.request.baseURL
|
|
145
|
-
// also rewrites the assembled request onto the
|
|
142
|
+
// Meta's native provider expects a bearer inference key, not the short-lived
|
|
143
|
+
// OAuth token used to mint it: when the active Muse connection resolves one,
|
|
144
|
+
// put it on the request. AI SDK routes drop model.request.baseURL
|
|
145
|
+
// (opencode#55984), so this hook also rewrites the assembled request onto the
|
|
146
|
+
// adapter origin.
|
|
146
147
|
await ctx.session.hook("http.request", async (event) => {
|
|
147
148
|
const credential = await subscription();
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
event.request.headers.set("Authorization", `Bearer ${credential.access}`);
|
|
149
|
+
if (credential)
|
|
150
|
+
event.request.headers.set("Authorization", `Bearer ${credential.access}`);
|
|
151
151
|
if (adapter)
|
|
152
152
|
event.request = routeThroughAdapter(event.request, adapter.baseUrl);
|
|
153
153
|
}, { providerID: "meta" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-muse-auth",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Unofficial and experimental: Muse Spark in opencode using a Muse Code subscription credential, with a local loopback adapter for Meta's subscription wire format. May conflict with Meta's terms; use at your own risk. See DISCLAIMER.md.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|