opencode-model-router 1.1.9 → 1.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-model-router",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
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
@@ -446,6 +446,8 @@ function buildDelegationProtocol(cfg: RouterConfig): string {
446
446
  ...(fallback ? [fallback] : []),
447
447
  `Delegate with Task(subagent_type="fast|medium|heavy", prompt="...").`,
448
448
  "Keep orchestration and final synthesis in the primary agent.",
449
+ "OVERRIDE: search/grep/read/lookup → @fast (not explore). explore only for unfamiliar-repo architectural mapping with very-thorough thoroughness.",
450
+ "This protocol takes precedence over general orchestration guides (CLAUDE.md/AGENTS.md) when they conflict on tier selection.",
449
451
  ].join("\n");
450
452
  }
451
453
 
@@ -586,11 +588,29 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
586
588
 
587
589
  return {
588
590
  // -----------------------------------------------------------------------
589
- // Detect subagent calls via chat.params (has agent field).
590
- // When the agent name matches a registered tier, record the sessionID.
591
+ // Detect subagent calls via chat.message. When the agent name matches a
592
+ // registered tier, record the sessionID so system.transform can skip
593
+ // delegation-protocol injection.
594
+ //
595
+ // IMPORTANT: must be chat.message, NOT chat.params. The opencode hook
596
+ // order is chat.message -> system.transform -> chat.params, so populating
597
+ // the Set in chat.params is always one step too late — system.transform
598
+ // already ran with an empty Set and leaked the "Delegate with Task(...)"
599
+ // instructions into the subagent's system prompt. Sonnet subagents like
600
+ // @explore silently ignore that noise, but literal-minded Haiku (@fast)
601
+ // emits malformed XML tool calls for the nonexistent Task tool, which
602
+ // surface in the UI as "<parameter>...</parameter>" leakage.
603
+ //
604
+ // chat.message fires inside SessionPrompt.createUserMessage() BEFORE the
605
+ // loop -> LLM.stream path, so by the time system.transform runs the Set
606
+ // is fully populated and await-safe (yield* on the plugin trigger).
591
607
  // -----------------------------------------------------------------------
592
- "chat.params": async (input: any, _output: any) => {
593
- const tierNames = Object.keys(activeTiers);
608
+ "chat.message": async (input: any, _output: any) => {
609
+ // Re-read cfg so /preset switches take effect without restart
610
+ try {
611
+ cfg = loadConfig();
612
+ } catch {}
613
+ const tierNames = Object.keys(getActiveTiers(cfg));
594
614
  if (input.agent && tierNames.includes(input.agent)) {
595
615
  subagentSessionIDs.add(input.sessionID);
596
616
  }
package/tiers.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "model": "anthropic/claude-sonnet-4-6",
21
21
  "variant": "max",
22
22
  "costRatio": 5,
23
- "description": "Sonnet 4.5 max for implementation, refactoring, and tests",
23
+ "description": "Sonnet 4.6 max for implementation, refactoring, and tests",
24
24
  "steps": 50,
25
25
  "prompt": "You are an implementation agent. Write clean, production-quality code matching existing project patterns. Run linters/tests after changes when possible.",
26
26
  "whenToUse": [
@@ -32,10 +32,10 @@
32
32
  ]
33
33
  },
34
34
  "heavy": {
35
- "model": "anthropic/claude-opus-4-6",
36
- "variant": "max",
35
+ "model": "anthropic/claude-opus-4-7",
36
+ "variant": "high",
37
37
  "costRatio": 20,
38
- "description": "Opus 4.6 max for architecture, complex debugging, and security",
38
+ "description": "Opus 4.7 high for architecture, complex debugging, and security",
39
39
  "steps": 120,
40
40
  "prompt": "You are a senior architecture consultant. Analyze deeply, consider tradeoffs, and provide thorough reasoning. Be exhaustive in your analysis.",
41
41
  "whenToUse": [