oc-blackbytes 0.4.0 → 0.5.0
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 +3 -3
- package/dist/index.js +18 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,11 +97,11 @@ Create `oc-blackbytes.jsonc` in the OpenCode config directory. For the full conf
|
|
|
97
97
|
| `disabled_tools` | `string[]` | `[]` | Prevents bundled tools from being registered. |
|
|
98
98
|
| `mcp_env_alllowlist` | `string[]` | `[]` | Recognized by the schema for MCP environment filtering workflows. |
|
|
99
99
|
| `hashline_edit` | `boolean` | `true` | Enables the `hashline_edit` tool and `tool.execute.after` hashline post-processing for `read`/`write`. |
|
|
100
|
-
| `model_fallback` | `boolean` | `
|
|
100
|
+
| `model_fallback` | `boolean` | `true` | Enables model fallback resolution: discovers connected providers at init and resolves fallback chains when a preferred model's provider is unavailable. Set to `false` to disable. |
|
|
101
101
|
| `auto_update` | `boolean` | `false` | Recognized by the schema for maintenance workflows. |
|
|
102
102
|
| `websearch.provider` | `"exa" \| "tavily"` | `"exa"` | Selects the built-in `websearch` MCP backend. |
|
|
103
103
|
| `agents` | `Record<string, AgentModelConfig>` | `{}` | Per-agent model configuration overrides. See [Per-agent model configuration](#per-agent-model-configuration). |
|
|
104
|
-
| `fallback_models` | `string \| (string \| FallbackModelObject)[]` | — | Global fallback model chain. When
|
|
104
|
+
| `fallback_models` | `string \| (string \| FallbackModelObject)[]` | — | Global fallback model chain. When an agent's primary model is unavailable, the plugin walks this chain and uses the first model whose provider is connected. |
|
|
105
105
|
| `_migrations` | `string[]` | `[]` | Internal migration bookkeeping. |
|
|
106
106
|
|
|
107
107
|
## Built-in agents
|
|
@@ -150,7 +150,7 @@ Each agent model config supports:
|
|
|
150
150
|
| `model` | `string` | Model identifier (e.g., `"openai/gpt-5.4"`). Drives prompt variant selection and, for subagents, sets the model hint. |
|
|
151
151
|
| `reasoningEffort` | `string` | Override reasoning effort level for OpenAI reasoning models (`"low"`, `"medium"`, `"high"`). |
|
|
152
152
|
| `temperature` | `number` | Override temperature for the agent. |
|
|
153
|
-
| `fallback_models` | `string \| (string \| object)[]` | Per-agent fallback chain — tried before the global `fallback_models` when the primary model's provider is unavailable.
|
|
153
|
+
| `fallback_models` | `string \| (string \| object)[]` | Per-agent fallback chain — tried before the global `fallback_models` when the primary model's provider is unavailable. |
|
|
154
154
|
|
|
155
155
|
When a `model` is specified for a subagent, the factory selects the appropriate prompt variant for that model family (Claude, GPT, or Gemini). The primary agent (`bytes`) uses the model hint for prompt selection only — the actual model is determined by the OpenCode UI selection. For recommended models per agent, see [docs/configuration.md](docs/configuration.md).
|
|
156
156
|
|
package/dist/index.js
CHANGED
|
@@ -2339,14 +2339,19 @@ async function discoverAvailableModels(client) {
|
|
|
2339
2339
|
return new Map;
|
|
2340
2340
|
}
|
|
2341
2341
|
}
|
|
2342
|
-
function
|
|
2342
|
+
function resolveModelRef(modelRef, availableModels) {
|
|
2343
2343
|
if (availableModels.size === 0)
|
|
2344
|
-
return
|
|
2344
|
+
return modelRef;
|
|
2345
2345
|
const slashIdx = modelRef.indexOf("/");
|
|
2346
2346
|
if (slashIdx === -1)
|
|
2347
|
-
return
|
|
2347
|
+
return modelRef;
|
|
2348
2348
|
const providerId = modelRef.substring(0, slashIdx);
|
|
2349
|
-
|
|
2349
|
+
const modelId = modelRef.substring(slashIdx + 1);
|
|
2350
|
+
const providerModels = availableModels.get(providerId);
|
|
2351
|
+
if (!providerModels)
|
|
2352
|
+
return;
|
|
2353
|
+
const matchedModel = prefixMatchModel(modelId, providerModels);
|
|
2354
|
+
return matchedModel ? `${providerId}/${matchedModel}` : undefined;
|
|
2350
2355
|
}
|
|
2351
2356
|
function prefixMatchModel(modelPrefix, providerModels) {
|
|
2352
2357
|
if (providerModels.has(modelPrefix))
|
|
@@ -2387,9 +2392,10 @@ function walkFallbackChain(fallbacks, availableModels) {
|
|
|
2387
2392
|
const chain = typeof fallbacks === "string" ? [fallbacks] : fallbacks;
|
|
2388
2393
|
for (const entry of chain) {
|
|
2389
2394
|
const modelRef = typeof entry === "string" ? entry : entry.model;
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2395
|
+
const resolvedModel = resolveModelRef(modelRef, availableModels);
|
|
2396
|
+
if (resolvedModel) {
|
|
2397
|
+
return typeof entry === "string" ? { model: resolvedModel, fromFallback: true } : {
|
|
2398
|
+
model: resolvedModel,
|
|
2393
2399
|
fromFallback: true,
|
|
2394
2400
|
reasoningEffort: entry.reasoningEffort,
|
|
2395
2401
|
temperature: entry.temperature
|
|
@@ -2429,9 +2435,10 @@ function resolveAgentModel(agentName, agentConfig, globalFallbacks, availableMod
|
|
|
2429
2435
|
}
|
|
2430
2436
|
return { model: "", fromFallback: false };
|
|
2431
2437
|
}
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2438
|
+
const resolvedPrimaryModel = resolveModelRef(primaryModel, availableModels);
|
|
2439
|
+
if (resolvedPrimaryModel) {
|
|
2440
|
+
log(` [model-resolver] ${agentName}: using primary model ${resolvedPrimaryModel}`);
|
|
2441
|
+
return { model: resolvedPrimaryModel, fromFallback: false };
|
|
2435
2442
|
}
|
|
2436
2443
|
log(` [model-resolver] ${agentName}: primary model ${primaryModel} not available, trying fallbacks...`);
|
|
2437
2444
|
const perAgentResolved = walkFallbackChain(agentConfig?.fallback_models, availableModels);
|
|
@@ -31440,7 +31447,7 @@ function loadPluginConfig(_input) {
|
|
|
31440
31447
|
// src/index.ts
|
|
31441
31448
|
var BlackbytesPlugin = async (ctx) => {
|
|
31442
31449
|
const pluginConfig = loadPluginConfig(ctx);
|
|
31443
|
-
const availableModels = pluginConfig.model_fallback ? await discoverAvailableModels(ctx.client) : new Map;
|
|
31450
|
+
const availableModels = pluginConfig.model_fallback !== false ? await discoverAvailableModels(ctx.client) : new Map;
|
|
31444
31451
|
return createOpenCodePlugin({ input: ctx, pluginConfig, availableModels });
|
|
31445
31452
|
};
|
|
31446
31453
|
var src_default = BlackbytesPlugin;
|