Skip to content

Commit d42c4df

Browse files
committed
feat: Muse Spark in opencode via Muse Code subscription device login
0 parents  commit d42c4df

11 files changed

Lines changed: 1315 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build-test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: "24"
15+
- run: npm install
16+
- run: npm run build
17+
- run: npm test

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
dist/
3+
*.tsbuildinfo

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 TheStreamCode
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎NOTICE‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Flow parameters compatible with the published behavior of oh-my-pi
2+
(https://github.com/can1357/oh-my-pi), MIT-licensed (c) 2025 Mario Zechner,
3+
(c) 2025-2026 Can Bölük, (c) 2026 Stencil Labs, Inc. No oh-my-pi code is
4+
vendored here; the device-code exchange is an independent implementation.
5+
No oh-my-pi branding appears in the user experience.

‎README.md‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# opencode-muse-auth
2+
3+
Use Meta **Muse Spark** in [opencode](https://opencode.ai) billed to your
4+
**Muse Code monthly subscription** — no pay-as-you-go API key, no third-party CLI.
5+
6+
## Install
7+
8+
```jsonc
9+
// opencode.json
10+
{
11+
"$schema": "https://opencode.ai/config.json",
12+
"plugin": ["opencode-muse-auth"]
13+
}
14+
```
15+
16+
Then run `/connect` in opencode, pick the `meta` provider and the
17+
*Muse Code subscription* method: it shows a Meta device page URL and a code.
18+
Enter the code in your browser (your own Meta account) and the login
19+
completes by itself.
20+
21+
## Requirements
22+
23+
- opencode with plugin support
24+
- A Meta account with an active Muse Code subscription
25+
26+
## How it works
27+
28+
The plugin registers an `auth` hook for the built-in `meta` provider
29+
(Routes through the Responses API, `meta.txt` system prompt applies
30+
automatically to `muse-*` model ids):
31+
32+
- **Login** — Meta device-code exchange (RFC 8628) inside `/connect`, then
33+
mints the stable account-bound inference key via the Model API. The key is
34+
cached locally (`~/.config/opencode/muse-code-sub.json`, owner-only
35+
permissions where supported) and never printed.
36+
- **Runtime** — an auth `loader` injects the cached key on every startup.
37+
The mint endpoint is aggressively rate-limited, so the plugin never
38+
re-mints on its own; re-run `/connect` only if access is revoked (401).
39+
40+
Flow parameters are compatible with the published behavior of oh-my-pi (MIT);
41+
see [NOTICE](NOTICE).
42+
43+
## Development
44+
45+
```sh
46+
npm install
47+
npm run build
48+
npm test
49+
```
50+
51+
## License
52+
53+
MIT — see [LICENSE](LICENSE).

0 commit comments

Comments
 (0)