@route_33/opencode 0.4.2 → 0.4.3
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 +2 -0
- package/dist/index.js +5 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,8 @@ This plugin never writes your `opencode.json` or `opencode.jsonc`: opencode has
|
|
|
30
30
|
|
|
31
31
|
Run `opencode auth login` and choose `route_33`, or set the `ROUTE33_API_KEY` environment variable. Without a key, the TUI wizard offers to save one: per-project inside a git workspace, global otherwise. A globally stored key applies only outside git workspaces — inside a workspace, keys resolve from the environment, the workspace config, or `.opencode/route33.key` (per-project keys are the metering boundary). Skipping the project-key wizard snoozes it for 7 days — "Skip" for that workspace only, "Skip for all workspaces" everywhere (both live in opencode's TUI kv store; remove `project-key-prompt.dismissed-at*` from `~/.local/state/opencode/kv.json` to re-arm sooner). `ROUTE33_BASE_URL` overrides the default gateway URL; `ROUTE33_TUI_PROMPT=0` disables the wizard.
|
|
32
32
|
|
|
33
|
+
Your key is never written into the resolved provider configuration: authentication is attached per request at fetch time, so `opencode debug config` output contains no credential material.
|
|
34
|
+
|
|
33
35
|
## Model catalog
|
|
34
36
|
|
|
35
37
|
The catalog is discovered dynamically. The plugin calls `GET {baseURL}/models` with your resolved API key, caches the response on disk, and injects only the models that key can see. The refresh ladder is:
|
package/dist/index.js
CHANGED
|
@@ -289,16 +289,12 @@ function buildOpenAiChatCompatFetch(fetchImpl) {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
// src/config/build-options.ts
|
|
292
|
-
function buildOptions(baseURL,
|
|
292
|
+
function buildOptions(baseURL, resolveKeyNow = () => void 0) {
|
|
293
293
|
const options = { baseURL };
|
|
294
294
|
options.fetch = buildLiveAuthFetch(
|
|
295
295
|
resolveKeyNow,
|
|
296
296
|
buildOpenAiChatCompatFetch()
|
|
297
297
|
);
|
|
298
|
-
if (apiKey !== void 0) {
|
|
299
|
-
options.apiKey = apiKey;
|
|
300
|
-
options.headers = { Authorization: `Bearer ${apiKey}` };
|
|
301
|
-
}
|
|
302
298
|
return options;
|
|
303
299
|
}
|
|
304
300
|
|
|
@@ -350,7 +346,7 @@ function vendorOf(slug) {
|
|
|
350
346
|
return slug.slice(0, slug.indexOf("/"));
|
|
351
347
|
}
|
|
352
348
|
function buildProviderBlocks(enriched, options) {
|
|
353
|
-
const {
|
|
349
|
+
const { baseURL } = options;
|
|
354
350
|
const resolveKeyNow = options.resolveKeyNow ?? (() => void 0);
|
|
355
351
|
const route33Models = {};
|
|
356
352
|
for (const slug of Object.keys(enriched).sort()) {
|
|
@@ -369,7 +365,7 @@ function buildProviderBlocks(enriched, options) {
|
|
|
369
365
|
route_33: {
|
|
370
366
|
npm: "@ai-sdk/openai-compatible",
|
|
371
367
|
name: PROVIDER_DISPLAY_NAME,
|
|
372
|
-
options: buildOptions(baseURL,
|
|
368
|
+
options: buildOptions(baseURL, resolveKeyNow),
|
|
373
369
|
models: route33Models
|
|
374
370
|
}
|
|
375
371
|
};
|
|
@@ -1457,11 +1453,10 @@ function createConfigHook(options = {}) {
|
|
|
1457
1453
|
const modelsDev = await loadModelsDev(modelsDevOptions);
|
|
1458
1454
|
const enriched = enrichCatalog(catalog, modelsDev, env);
|
|
1459
1455
|
const blocks = buildProviderBlocks(enriched, {
|
|
1460
|
-
apiKey: key,
|
|
1461
1456
|
baseURL,
|
|
1462
1457
|
// Per-request resolution for the live-auth fetch: a prompt-entered
|
|
1463
|
-
// key applies to the very next request, no restart. The
|
|
1464
|
-
//
|
|
1458
|
+
// key applies to the very next request, no restart. The block never
|
|
1459
|
+
// carries the key itself, so config dumps stay credential-free.
|
|
1465
1460
|
resolveKeyNow: () => resolveKey(void 0, env, cwd)
|
|
1466
1461
|
});
|
|
1467
1462
|
mergeConfig(cfg, blocks);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@route_33/opencode",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"description": "opencode provider plugin for the route33.ai AI gateway — key-scoped model discovery, cost/limit enrichment, auth, and the key-setup wizard.",
|