opencode-model-router 2.6.0 → 2.6.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/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.6.1] - 2026-10-09
11
+
12
+ ### Fixed
13
+
14
+ - **OpenCode v1 no longer drops `agent.<tier>.permission` and `.tools` for `@medium` and `@heavy`.** The v1 `config`
15
+ hook replaced the user's `opencode.json` entry wholesale for every non-read-only tier except `fast`; it now keeps
16
+ the user's `permission` and `tools` for every non-read-only tier (#97). Output without user entries is unchanged,
17
+ and v2 was already correct.
18
+
10
19
  ## [2.6.0] - 2026-10-09
11
20
 
12
21
  ### Changed
package/README.md CHANGED
@@ -617,6 +617,82 @@ permissions: `readOnly: true` reuses the read-only policy, or give an explicit `
617
617
  Project overrides cannot define `agents`. `opencode.json` wins for the fields it sets when it defines the same
618
618
  name. `subagentTiers` no longer creates agents that do not exist (host built-ins such as `explore` still map). `allowTools` never grants edit, delegation, Code Mode or shell. See
619
619
  [CONFIG_REFERENCE.md](docs/CONFIG_REFERENCE.md#agents--router-defined-subagents-81).
620
+
621
+ #### Focused helpers with an MCP allowlist
622
+
623
+ To give a subagent only the tools for one job, define it in the **global** overrides file,
624
+ `~/.config/opencode/opencode-model-router.overrides.jsonc`. Project overrides cannot define `agents`, on purpose:
625
+ a cloned repository must not be able to register agents with permissions.
626
+
627
+ ```jsonc
628
+ {
629
+ "agents": {
630
+ "browser-tester": {
631
+ "tier": "fast",
632
+ "description": "Tests the app in a real browser with Playwright. Use for UI and end-to-end checks.",
633
+ "readOnly": true,
634
+ "allowTools": ["playwright_*"]
635
+ },
636
+ "docs-checker": {
637
+ "tier": "fast",
638
+ "description": "Looks up library docs and compares versions with Context7.",
639
+ "readOnly": true,
640
+ "allowTools": ["context7_*"]
641
+ },
642
+ "deep-thinker": {
643
+ "tier": "heavy",
644
+ "description": "Thinks through hard problems step by step before answering.",
645
+ "readOnly": true,
646
+ "allowTools": ["sequential-thinking_*"]
647
+ }
648
+ }
649
+ }
650
+ ```
651
+
652
+ - `tier`: a tier of the active preset. The model follows the preset, so it changes with `/preset`.
653
+ - `description`: what the orchestrator reads to pick the helper. Be specific about the task and when to use it.
654
+ - `readOnly: true` or a `permission` block is required: a router agent never inherits the host's allow-all defaults.
655
+ - `allowTools`: extra tools allowed on top of that policy. MCP tools are named `<server>_<tool>`; use the server
656
+ names from your `opencode.json`. A wildcard is allowed only after a literal first character (`playwright_*`, not
657
+ `*_click`). `allowTools` cannot grant edit, shell, `read` or delegation; put those in `permission`.
658
+
659
+ Restart OpenCode after adding agents so they are registered. Reserved names (`fast`, `medium`, `heavy`, every
660
+ tier of the active preset) cannot be used as agent names.
661
+
662
+ #### Restricting the built-in tiers
663
+
664
+ `@medium` and `@heavy` otherwise see every installed tool, including MCP servers meant for a helper. Restrict them
665
+ with host permission rules in `opencode.json`. The router keeps these rules when it registers the tiers.
666
+
667
+ OpenCode 2:
668
+
669
+ ```json
670
+ {
671
+ "agents": {
672
+ "heavy": {
673
+ "permissions": [
674
+ { "action": "playwright_*", "resource": "*", "effect": "deny" }
675
+ ]
676
+ }
677
+ }
678
+ }
679
+ ```
680
+
681
+ OpenCode 1:
682
+
683
+ ```json
684
+ {
685
+ "agent": {
686
+ "heavy": {
687
+ "permission": { "playwright_*": "deny" }
688
+ }
689
+ }
690
+ }
691
+ ```
692
+
693
+ Prefer permission rules over the legacy `"tools": { "playwright_*": false }`, which is deprecated on OpenCode 1
694
+ and absent on OpenCode 2.
695
+
620
696
  ### Read-only call caps
621
697
 
622
698
  Subagents carry a cap on their own read-only tool calls (grep/read/glob/ls) per dispatch. Enforcement is **two-layered**: prompt-level stop rules + runtime banners injected into tool results. Baselines (configurable via `tierCaps` — see below):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-model-router",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "OpenCode plugin that routes tasks to tiered subagents (fast/medium/heavy) based on complexity",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/index.ts CHANGED
@@ -2781,8 +2781,9 @@ const ModelRouterPlugin: Plugin = async (ctx: RouterPluginInput) => {
2781
2781
  && opencodeConfig.mcp.context7.enabled !== false), opencodeConfig.agent[name]?.permission);
2782
2782
  agentDef.permission = permission;
2783
2783
  agentDef.tools = { ...legacyReadOnlyTools(permission), ...opencodeConfig.agent[name]?.tools };
2784
- } else if (name === "fast" || tier.readOnly === false) {
2785
- // Opt-out removes OUR policy, not restrictions the user supplied.
2784
+ } else {
2785
+ // Opt-out removes OUR policy, not restrictions the user supplied; they are kept
2786
+ // for every non-read-only tier, not just fast (#97).
2786
2787
  for (const key of ["permission", "tools"]) {
2787
2788
  if (opencodeConfig.agent[name]?.[key] !== undefined) agentDef[key] = opencodeConfig.agent[name][key];
2788
2789
  }