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 +1 -1
- package/src/index.ts +24 -4
- package/tiers.json +4 -4
package/package.json
CHANGED
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.
|
|
590
|
-
//
|
|
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.
|
|
593
|
-
|
|
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.
|
|
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-
|
|
36
|
-
"variant": "
|
|
35
|
+
"model": "anthropic/claude-opus-4-7",
|
|
36
|
+
"variant": "high",
|
|
37
37
|
"costRatio": 20,
|
|
38
|
-
"description": "Opus 4.
|
|
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": [
|