opencode-model-router 1.1.8 → 1.1.9

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +8 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-model-router",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
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
@@ -580,21 +580,19 @@ const ModelRouterPlugin: Plugin = async (_ctx: PluginInput) => {
580
580
  let cfg = loadConfig();
581
581
  const activeTiers = getActiveTiers(cfg);
582
582
 
583
- // Track child (subagent) sessions so we can skip delegation protocol
584
- // injection for them. Child sessions have a parentID primary sessions don't.
583
+ // Track subagent sessions so we can skip delegation protocol injection.
584
+ // Populated by chat.params (which has the agent name) before system.transform fires.
585
585
  const subagentSessionIDs = new Set<string>();
586
586
 
587
587
  return {
588
588
  // -----------------------------------------------------------------------
589
- // Track subagent sessions via session lifecycle events
589
+ // Detect subagent calls via chat.params (has agent field).
590
+ // When the agent name matches a registered tier, record the sessionID.
590
591
  // -----------------------------------------------------------------------
591
- event: async (input: { event: any }) => {
592
- const evt = input.event;
593
- if (evt.type === "session.created" && evt.properties?.info?.parentID) {
594
- subagentSessionIDs.add(evt.properties.info.id);
595
- }
596
- if (evt.type === "session.deleted") {
597
- subagentSessionIDs.delete(evt.properties?.info?.id);
592
+ "chat.params": async (input: any, _output: any) => {
593
+ const tierNames = Object.keys(activeTiers);
594
+ if (input.agent && tierNames.includes(input.agent)) {
595
+ subagentSessionIDs.add(input.sessionID);
598
596
  }
599
597
  },
600
598