opencode-model-router 1.1.14 → 1.1.16

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +33 -3
  3. package/tiers.json +13 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-model-router",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
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
@@ -907,6 +907,11 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
907
907
  // intentionally NOT tracked here (per user decision: enforce on subagents only).
908
908
  const subagentCapState = new Map<string, SubagentState>();
909
909
 
910
+ // Bypass mode: when true, the router skips all system prompt injection,
911
+ // subagent tracking, cap enforcement, and narration detection for the
912
+ // current plugin lifetime (i.e., until OpenCode is restarted).
913
+ let bypassed = false;
914
+
910
915
  return {
911
916
  // -----------------------------------------------------------------------
912
917
  // Detect subagent calls via chat.message. When the agent name matches a
@@ -927,6 +932,7 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
927
932
  // is fully populated and await-safe (yield* on the plugin trigger).
928
933
  // -----------------------------------------------------------------------
929
934
  "chat.message": async (input: any, output: any) => {
935
+ if (bypassed) return;
930
936
  // Re-read cfg so /preset switches take effect without restart
931
937
  try {
932
938
  cfg = loadConfig();
@@ -960,6 +966,7 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
960
966
  // treats them as ground truth rather than advisory system noise.
961
967
  // -----------------------------------------------------------------------
962
968
  "tool.execute.after": async (input: any, output: any) => {
969
+ if (bypassed) return;
963
970
  const state = subagentCapState.get(input.sessionID);
964
971
  if (!state) return; // not a tracked subagent session
965
972
  if (!READ_ONLY_TOOLS.has(input.tool)) return;
@@ -990,6 +997,7 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
990
997
  // post-hoc signal.
991
998
  // -----------------------------------------------------------------------
992
999
  "experimental.text.complete": async (input: any, output: any) => {
1000
+ if (bypassed) return;
993
1001
  const text = output?.text;
994
1002
  if (typeof text !== "string" || text.length < 20) return;
995
1003
 
@@ -999,9 +1007,6 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
999
1007
  const quoted = found
1000
1008
  .map((m) => `"${m.slice(0, 60)}${m.length > 60 ? "…" : ""}"`)
1001
1009
  .join(", ");
1002
- console.warn(
1003
- `[model-router] narration detected (session ${input?.sessionID ?? "?"}): ${quoted}`,
1004
- );
1005
1010
  output.text = `${text}\n\n[⚠ narration detected: ${quoted}]`;
1006
1011
  },
1007
1012
 
@@ -1065,6 +1070,11 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
1065
1070
  description:
1066
1071
  "Show or switch routing mode (e.g., /budget, /budget budget, /budget quality)",
1067
1072
  };
1073
+ opencodeConfig.command["bypass"] = {
1074
+ template: "$ARGUMENTS",
1075
+ description:
1076
+ "Toggle model-router bypass (disables delegation protocol for this session)",
1077
+ };
1068
1078
  opencodeConfig.command["annotate-plan"] = {
1069
1079
  template: [
1070
1080
  "Annotate the plan with tier directives for model delegation.",
@@ -1102,6 +1112,7 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
1102
1112
  // just execute a task (especially smaller models like Haiku).
1103
1113
  // -----------------------------------------------------------------------
1104
1114
  "experimental.chat.system.transform": async (_input: any, output: any) => {
1115
+ if (bypassed) return;
1105
1116
  try {
1106
1117
  cfg = loadConfig(); // Returns cache unless invalidated
1107
1118
  } catch {
@@ -1151,6 +1162,25 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
1151
1162
  });
1152
1163
  }
1153
1164
 
1165
+ if (input.command === "bypass") {
1166
+ const arg = (input.arguments ?? "").trim().toLowerCase();
1167
+ if (arg === "on") {
1168
+ bypassed = true;
1169
+ } else if (arg === "off") {
1170
+ bypassed = false;
1171
+ } else {
1172
+ bypassed = !bypassed;
1173
+ }
1174
+ const status = bypassed ? "ON" : "OFF";
1175
+ const desc = bypassed
1176
+ ? "Model-router is **bypassed**. Delegation protocol, cap enforcement, and narration detection are disabled. The model will run without routing rules until you run `/bypass off` or restart OpenCode."
1177
+ : "Model-router is **active**. Delegation protocol and all enforcement rules are in effect.";
1178
+ output.parts.push({
1179
+ type: "text" as const,
1180
+ text: `# Bypass: ${status}\n\n${desc}`,
1181
+ });
1182
+ }
1183
+
1154
1184
  if (input.command === "budget") {
1155
1185
  try {
1156
1186
  cfg = loadConfig();
package/tiers.json CHANGED
@@ -40,10 +40,10 @@
40
40
  ]
41
41
  },
42
42
  "heavy": {
43
- "model": "anthropic/claude-opus-4-7",
43
+ "model": "anthropic/claude-opus-4-6",
44
44
  "variant": "high",
45
45
  "costRatio": 20,
46
- "description": "Opus 4.7 high for architecture, complex debugging, and security",
46
+ "description": "Opus 4.6 high for architecture, complex debugging, and security",
47
47
  "steps": 120,
48
48
  "whenToUse": [
49
49
  "Architecture decisions",
@@ -66,10 +66,10 @@
66
66
  ]
67
67
  },
68
68
  "medium": {
69
- "model": "openai/gpt-5.3-codex",
69
+ "model": "openai/gpt-5.4-fast",
70
70
  "variant": "high",
71
71
  "costRatio": 5,
72
- "description": "GPT-5.3 Codex default settings for implementation and standard coding",
72
+ "description": "GPT-5.4 fast default settings for implementation and standard coding",
73
73
  "steps": 50,
74
74
  "whenToUse": [
75
75
  "Feature implementation",
@@ -79,7 +79,7 @@
79
79
  ]
80
80
  },
81
81
  "heavy": {
82
- "model": "openai/gpt-5.4",
82
+ "model": "openai/gpt-5.5-fast",
83
83
  "variant": "xhigh",
84
84
  "costRatio": 20,
85
85
  "description": "GPT-5.4 xhigh for architecture and complex tasks",
@@ -173,9 +173,9 @@
173
173
  },
174
174
  "hybrid": {
175
175
  "fast": {
176
- "model": "openai/gpt-5.3-codex-spark",
176
+ "model": "firepass/accounts/fireworks/routers/kimi-k2p6-turbo",
177
177
  "costRatio": 1,
178
- "description": "GPT-5.3 Codex Spark for exploration, search, and simple reads",
178
+ "description": "Kimi 2.6 turbo for exploration, search, and simple reads",
179
179
  "steps": 30,
180
180
  "whenToUse": [
181
181
  "Codebase exploration and search",
@@ -185,24 +185,23 @@
185
185
  ]
186
186
  },
187
187
  "medium": {
188
- "model": "anthropic/claude-sonnet-4-6",
189
- "variant": "max",
188
+ "model": "openai/gpt-5.5-fast",
189
+ "variant": "high",
190
190
  "costRatio": 5,
191
- "description": "Claude Sonnet 4.6 max for implementation, refactoring, and tests",
191
+ "description": "GPT-5.5 fast default settings for implementation and standard coding",
192
192
  "steps": 50,
193
193
  "whenToUse": [
194
194
  "Feature implementation",
195
195
  "Refactoring",
196
196
  "Writing tests",
197
- "Code review",
198
197
  "Bug fixes"
199
198
  ]
200
199
  },
201
200
  "heavy": {
202
- "model": "anthropic/claude-opus-4-7",
203
- "variant": "high",
201
+ "model": "anthropic/claude-opus-4-6",
202
+ "variant": "max",
204
203
  "costRatio": 20,
205
- "description": "Claude Opus 4.7 high for architecture, complex debugging, and security",
204
+ "description": "Claude Opus 4.6 max for architecture, complex debugging, and security",
206
205
  "steps": 120,
207
206
  "whenToUse": [
208
207
  "Architecture decisions",