opencode-muse-code 0.1.0 → 0.1.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 +127 -35
- package/index.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,22 +1,46 @@
|
|
|
1
1
|
# opencode-muse-code
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/opencode-muse-code)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
Use a **Muse Code** (Meta) subscription in [OpenCode](https://opencode.ai).
|
|
4
7
|
|
|
5
8
|
The plugin reads the login the [`muse`](https://api.meta.ai/muse-launcher.sh) CLI
|
|
6
9
|
already stored on your machine, registers a `muse-code` provider that talks to
|
|
7
|
-
`https://api.meta.ai/v1`, and
|
|
8
|
-
|
|
9
|
-
subscription
|
|
10
|
+
`https://api.meta.ai/v1`, and discovers the available Muse models on startup and
|
|
11
|
+
every 30 minutes. Model requests are metered by Meta against your Muse Code
|
|
12
|
+
subscription — OpenCode needs no API key in its own configuration.
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
OpenCode ──▶ https://api.meta.ai/v1 ──▶ Muse Code subscription
|
|
16
|
+
▲
|
|
17
|
+
minted API key from the muse CLI login
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Zero configuration once the `muse` CLI is signed in.
|
|
23
|
+
- Live model discovery with real context/output limits, tool support, input
|
|
24
|
+
types, and reasoning-effort variants.
|
|
25
|
+
- Reads credentials from the macOS keychain (or `~/.config/muse/auth.json`),
|
|
26
|
+
with `META_API_KEY` / `MUSE_API_KEY` and an explicit `key` option as
|
|
27
|
+
fallbacks.
|
|
28
|
+
- Never writes credentials to OpenCode configuration or the repository.
|
|
10
29
|
|
|
11
30
|
## Requirements
|
|
12
31
|
|
|
13
|
-
- OpenCode V2
|
|
14
|
-
- The `muse` CLI installed and signed in
|
|
15
|
-
|
|
32
|
+
- OpenCode V2 (tested on 2.0.8).
|
|
33
|
+
- The `muse` CLI installed and signed in — run `muse` once if you have not.
|
|
34
|
+
- An active Muse Code subscription. Check with the `muse` CLI or the
|
|
35
|
+
[Muse Code page](https://accountscenter.meta.com/muse_code/).
|
|
16
36
|
|
|
17
37
|
## Install
|
|
18
38
|
|
|
19
|
-
|
|
39
|
+
```sh
|
|
40
|
+
opencode plugin add opencode-muse-code
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Or add it to the `plugins` list in `opencode.jsonc` yourself:
|
|
20
44
|
|
|
21
45
|
```jsonc
|
|
22
46
|
{
|
|
@@ -24,10 +48,22 @@ Add the package to the `plugins` list in `opencode.jsonc`:
|
|
|
24
48
|
}
|
|
25
49
|
```
|
|
26
50
|
|
|
27
|
-
|
|
28
|
-
|
|
51
|
+
Pin a version if you prefer:
|
|
52
|
+
|
|
53
|
+
```jsonc
|
|
54
|
+
{
|
|
55
|
+
"plugins": ["opencode-muse-code@0.1.1"]
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Restart the service after changing configuration:
|
|
29
60
|
|
|
30
|
-
|
|
61
|
+
```sh
|
|
62
|
+
opencode service restart
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
<details>
|
|
66
|
+
<summary>Install from source instead</summary>
|
|
31
67
|
|
|
32
68
|
```sh
|
|
33
69
|
git clone https://github.com/swalker326/opencode-muse-code.git
|
|
@@ -39,19 +75,39 @@ git clone https://github.com/swalker326/opencode-muse-code.git
|
|
|
39
75
|
}
|
|
40
76
|
```
|
|
41
77
|
|
|
42
|
-
|
|
78
|
+
Or copy the folder to `~/.config/opencode/plugins/muse-code/`, where plugin
|
|
79
|
+
directories load automatically.
|
|
80
|
+
</details>
|
|
43
81
|
|
|
44
82
|
## Use
|
|
45
83
|
|
|
46
|
-
|
|
84
|
+
Pick a model with `/models` in the TUI, or run one directly:
|
|
47
85
|
|
|
48
86
|
```sh
|
|
49
|
-
opencode run --model muse-code/muse-spark-1.3 "
|
|
87
|
+
opencode run --model muse-code/muse-spark-1.3 "Summarize this repository"
|
|
50
88
|
```
|
|
51
89
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
90
|
+
### Models
|
|
91
|
+
|
|
92
|
+
Models are discovered from Meta's catalog, so the list follows your account.
|
|
93
|
+
Current models include:
|
|
94
|
+
|
|
95
|
+
| Model | Notes |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `muse-spark-1.3` | Newest general model |
|
|
98
|
+
| `muse-spark-1.3-contributor` | Same model; content may be used for product improvement |
|
|
99
|
+
| `muse-spark-1.2` / `muse-spark-1.2-contributor` | Previous generation |
|
|
100
|
+
|
|
101
|
+
### Reasoning effort
|
|
102
|
+
|
|
103
|
+
Append a variant to choose a reasoning effort:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
opencode run --model muse-code/muse-spark-1.3#max "Plan this migration"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Variants: `minimal`, `low`, `medium`, `high`, `xhigh`, `max`. The default comes
|
|
110
|
+
from the model metadata returned by Meta.
|
|
55
111
|
|
|
56
112
|
## How it works
|
|
57
113
|
|
|
@@ -61,24 +117,22 @@ Variant suffixes pick a reasoning effort, for example
|
|
|
61
117
|
2. **Get an API key.** It uses the stored API key, or mints one from the OAuth
|
|
62
118
|
token by calling `POST https://api.meta.ai/muse-code/key`. Minting is
|
|
63
119
|
idempotent: the same account always gets the same key back.
|
|
64
|
-
3. **Discover models.** It reads
|
|
65
|
-
|
|
66
|
-
and their real limits, input types, and reasoning-effort variants.
|
|
120
|
+
3. **Discover models.** It reads `GET https://api.meta.ai/muse-code/models`,
|
|
121
|
+
keeping tool-capable text models.
|
|
67
122
|
4. **Register the provider.** OpenCode receives a provider definition with ID
|
|
68
|
-
`muse-code`,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
field.
|
|
123
|
+
`muse-code`, the OpenAI-compatible runtime, endpoint
|
|
124
|
+
`https://api.meta.ai/v1`, the minted key, and one model entry per Muse
|
|
125
|
+
model. Variants map to the `reasoning_effort` request field.
|
|
72
126
|
5. **Stay fresh.** Every 30 minutes it re-reads the login, re-fetches the
|
|
73
127
|
catalog, and reloads the provider. On unload it stops the timer and removes
|
|
74
128
|
its registration.
|
|
75
129
|
|
|
76
|
-
|
|
77
|
-
|
|
130
|
+
If the credential lookup or the first catalog fetch fails, the plugin still
|
|
131
|
+
lists a fallback model and logs a warning; the next refresh repairs it.
|
|
78
132
|
|
|
79
133
|
## Options
|
|
80
134
|
|
|
81
|
-
Pass a key
|
|
135
|
+
Pass a key explicitly instead of reading the CLI login:
|
|
82
136
|
|
|
83
137
|
```jsonc
|
|
84
138
|
{
|
|
@@ -86,14 +140,52 @@ Pass a key directly instead of reading the login:
|
|
|
86
140
|
}
|
|
87
141
|
```
|
|
88
142
|
|
|
89
|
-
|
|
143
|
+
| Option | Type | Description |
|
|
144
|
+
| --- | --- | --- |
|
|
145
|
+
| `key` | string | Muse API key. Wins over every other credential source. |
|
|
146
|
+
|
|
147
|
+
| Environment variable | Description |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| `META_API_KEY` | Muse API key (the variable the muse CLI itself understands) |
|
|
150
|
+
| `MUSE_API_KEY` | Alias, checked second |
|
|
90
151
|
|
|
91
152
|
## Troubleshooting
|
|
92
153
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
154
|
+
| Symptom | Fix |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| `Unauthorized` | Run `muse` and sign in again, then `opencode service restart`. Make sure no stale stored account is shadowing the plugin. |
|
|
157
|
+
| Models missing | The first refresh failed; check network access to `api.meta.ai` and restart the service. A fallback model list is registered meanwhile. |
|
|
158
|
+
| Models missing on Linux | Muse CLI credential storage differs by platform. Set `META_API_KEY` or use the `key` option. |
|
|
159
|
+
| Keychain prompt on macOS | Approve the request once; OpenCode reads the same keychain item the muse CLI created. |
|
|
160
|
+
|
|
161
|
+
## Security and privacy
|
|
162
|
+
|
|
163
|
+
- Credentials are read from the operating system credential store at runtime;
|
|
164
|
+
they are never written to OpenCode config files, repositories, or logs.
|
|
165
|
+
- The plugin talks only to `https://api.meta.ai` — the same endpoint the muse
|
|
166
|
+
CLI uses.
|
|
167
|
+
- No telemetry is collected by the plugin.
|
|
168
|
+
|
|
169
|
+
## Compatibility
|
|
170
|
+
|
|
171
|
+
| Platform | Credential source |
|
|
172
|
+
| --- | --- |
|
|
173
|
+
| macOS | Login keychain (`ai.meta.dev.credentials`) |
|
|
174
|
+
| Linux | `~/.config/muse/auth.json`, `META_API_KEY`, or the `key` option |
|
|
175
|
+
| Windows | `META_API_KEY` or the `key` option |
|
|
176
|
+
|
|
177
|
+
## Disclaimer
|
|
178
|
+
|
|
179
|
+
This is an unofficial community plugin. It is not affiliated with, endorsed by,
|
|
180
|
+
or supported by Meta or the OpenCode team. Muse Code and Muse Spark are
|
|
181
|
+
trademarks of Meta. Use at your own risk and follow the terms of your Muse Code
|
|
182
|
+
subscription.
|
|
183
|
+
|
|
184
|
+
## Contributing
|
|
185
|
+
|
|
186
|
+
Issues and pull requests are welcome at
|
|
187
|
+
[swalker326/opencode-muse-code](https://github.com/swalker326/opencode-muse-code).
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
[MIT](./LICENSE)
|
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { readFile } from "node:fs/promises"
|
|
|
3
3
|
import os from "node:os"
|
|
4
4
|
import path from "node:path"
|
|
5
5
|
|
|
6
|
-
import { Model, Plugin, Provider } from "@opencode
|
|
6
|
+
import { Model, Plugin, Provider } from "@opencode/plugin"
|
|
7
7
|
|
|
8
8
|
const PROVIDER_ID = "muse-code"
|
|
9
9
|
const PROVIDER_NAME = "Muse Code Sub Plugin"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "opencode-muse-code",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "Use a Muse Code (Meta) subscription in OpenCode",
|
|
6
6
|
"author": "Shane Walker",
|
|
7
7
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"muse-code",
|
|
30
30
|
"meta"
|
|
31
31
|
],
|
|
32
|
-
"
|
|
33
|
-
"@opencode
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@opencode/plugin": "^2.0.8"
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|