@r-33/opencode 0.0.0-stage → 0.4.7-rc.20

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 CHANGED
@@ -1,3 +1,114 @@
1
- # Temporary Holding Version
1
+ # @r-33/opencode
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Route 33 plugin for OpenCode: sign in with your browser, assign the budget for
4
+ usage, and use the route_33 models — no API keys to paste, ever.
5
+
6
+ ## Install
7
+
8
+ **OpenCode v2 (recommended):**
9
+
10
+ ```sh
11
+ opencode plugin add @r-33/opencode
12
+ ```
13
+
14
+ Installs globally — one `plugins` entry in the config's `opencode.json`
15
+ loads every part (the server and TUI parts are auto-discovered from the
16
+ package exports; no `tui.json` exists on v2).
17
+
18
+ **OpenCode v1:**
19
+
20
+ ```sh
21
+ opencode plugin @r-33/opencode # project scope (default)
22
+ opencode plugin @r-33/opencode --global # global scope
23
+ ```
24
+
25
+ Installs at the nearest definition and registers the plugin twice: the
26
+ server part in `opencode.json` and the TUI part in `tui.json` — both files
27
+ are load-bearing on v1, which is why the installer writes both.
28
+
29
+ Either way, restart OpenCode afterwards — plugins load at startup. Prefer
30
+ config? Declare the plugin directly in `opencode.json(c)`:
31
+
32
+ ```jsonc
33
+ { "plugin": ["@r-33/opencode"] }
34
+ ```
35
+
36
+ ## First run
37
+
38
+ With `ROUTE33_API_KEY` unset, a fresh install starts silent: nothing opens
39
+ until you connect — run `/connect`, type `route33`, and press `o` on the
40
+ sign-in dialog to open the link in your browser (or `c` to copy it). Once
41
+ the connect completes, the wizard takes over automatically:
42
+
43
+ 1. Run `/connect` and choose Route 33 — press `o` to open the sign-in
44
+ link and finish the browser sign-in.
45
+ 2. The budget picker follows in OpenCode — one of your Route 33 projects,
46
+ or your personal key.
47
+ 3. The route_33 models appear. Pick one and prompt away.
48
+
49
+ A folder that is signed in but never attributed auto-runs the budget
50
+ picker at launch — the prompt stays locked behind a setup mode until a
51
+ budget is assigned, with Enter resuming setup; route_33 model requests
52
+ from unattributed folders are refused server-side with the same guidance
53
+ where the lock is unavailable. A browser is required for every sign-in;
54
+ restarts afterwards sign in silently.
55
+
56
+ ## Commands
57
+
58
+ | Command | Effect |
59
+ | -------------- | ------------------------------------------------------------------- |
60
+ | `/r33` | Open the Route 33 menu |
61
+ | `/r33 inspect` | Show the assigned budget, the active key, and its rotation state |
62
+ | `/r33 rotate` | Rotate the key immediately |
63
+ | `/r33 reset` | Clear the assigned budget — the wizard runs again on the next start |
64
+ | `/r33 logout` | Sign out of Route 33 |
65
+
66
+ A browser is required for every sign-in; restarts afterwards sign in silently.
67
+
68
+ ## Keys
69
+
70
+ One key per workspace: each project folder uses its own Route 33 key, and
71
+ every request carries the key of its own workspace — connecting another
72
+ folder never changes who this one bills for. Keys are short-lived and rotate
73
+ automatically; nothing secret is ever written to your project, logs, or
74
+ terminal.
75
+
76
+ ## Direct key mode
77
+
78
+ Set `ROUTE33_API_KEY` to a gateway key and the wizard is bypassed entirely —
79
+ no sign-in, no attribution pick, no browser, no per-workspace keys. This is
80
+ the right choice for autonomous, headless, or remote sessions where no human
81
+ is present or the machine has no browser. Key rotation is your responsibility.
82
+
83
+ ```sh
84
+ export ROUTE33_API_KEY=r33_sk_...
85
+ ```
86
+
87
+ ## Auto-connect
88
+
89
+ Connecting is always explicit — run `/connect` yourself. What auto-starts
90
+ at OpenCode launch is the attribution wizard for folders that are signed
91
+ in but have no budget assigned yet. Suppress that with
92
+ `ROUTE33_AUTOCONNECT=0` and assign a budget manually instead — `/r33` or
93
+ `/connect`. On remote or headless machines, use `ROUTE33_API_KEY` instead
94
+ of the wizard.
95
+
96
+ ## Troubleshooting
97
+
98
+ | Symptom | What to do |
99
+ | --------------------------------------------- | -------------------------------------------------------------------------------- |
100
+ | No route_33 models after start | `/connect` → Route 33 — the silent sign-in expired; sign in once and they return |
101
+ | "This Route 33 build has no OAuth client id" | Update the plugin to a released build, or set `ROUTE33_CLIENT_ID` and restart |
102
+ | "needs a Git worktree" | Open a Git repository (or `git init`) in the folder, then connect again |
103
+ | Sign-in link never appears / SSH-only machine | Sign-in needs a browser on the same machine — there is no device-flow fallback |
104
+
105
+ ## Configuration
106
+
107
+ | Variable | Purpose | Default |
108
+ | --------------------- | -------------------------------------------- | -------------------------------- |
109
+ | `ROUTE33_API_KEY` | Pre-shared gateway key (bypasses the wizard) | not set (wizard mode) |
110
+ | `ROUTE33_AUTOCONNECT` | Opt out of the auto-start wizard | `1` (auto-start enabled) |
111
+ | `ROUTE33_CLIENT_ID` | OAuth client identifier | included in released builds |
112
+ | `ROUTE33_AUTH_ISSUER` | OAuth issuer | `https://auth.route33.ai` |
113
+ | `ROUTE33_API_BASE` | Management API base | `https://mapi.route33.ai/api/v1` |
114
+ | `ROUTE33_BASE_URL` | Gateway models base | `https://api.route33.ai/v1` |