opencode-model-router 1.0.1 → 1.0.2
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/README.md +2 -0
- package/package.json +1 -1
- package/src/index.ts +19 -0
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ The plugin injects a **delegation protocol** into the system prompt that teaches
|
|
|
14
14
|
|
|
15
15
|
The agent automatically delegates via the Task tool when it recognizes the task complexity, or when plan steps are annotated with `[tier:fast]`, `[tier:medium]`, or `[tier:heavy]` tags.
|
|
16
16
|
|
|
17
|
+
This applies both to plan-driven execution and direct ad-hoc requests. For every new user message, the orchestrator performs an intent gate, splits multi-task requests into atomic units, and routes each unit to `@fast`, `@medium`, or `@heavy`.
|
|
18
|
+
|
|
17
19
|
## Installation
|
|
18
20
|
|
|
19
21
|
### Option A: npm package (recommended)
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -112,6 +112,21 @@ function buildDelegationProtocol(cfg: RouterConfig): string {
|
|
|
112
112
|
|
|
113
113
|
const rules = cfg.rules.map((r, i) => `${i + 1}. ${r}`).join("\n");
|
|
114
114
|
|
|
115
|
+
const directRoutingRules = [
|
|
116
|
+
"Run an Intent Gate for every new user message, even without a plan file.",
|
|
117
|
+
"If the message contains multiple asks, split it into atomic tasks before routing.",
|
|
118
|
+
"Route read-only exploration/search tasks to @fast.",
|
|
119
|
+
"Route implementation/edit/test/refactor tasks to @medium.",
|
|
120
|
+
"Route architecture/security/performance/complex debugging tasks to @heavy.",
|
|
121
|
+
"If a request mixes tiers, delegate each subtask to the right tier and then synthesize one final response.",
|
|
122
|
+
"If a task is trivial (single grep/read), execute directly instead of delegating.",
|
|
123
|
+
"When uncertain, default to the configured default tier unless user constraints clearly require another tier.",
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
const directRoutingList = directRoutingRules
|
|
127
|
+
.map((rule, index) => `${index + 1}. ${rule}`)
|
|
128
|
+
.join("\n");
|
|
129
|
+
|
|
115
130
|
return [
|
|
116
131
|
"## Model Delegation Protocol",
|
|
117
132
|
"",
|
|
@@ -128,6 +143,10 @@ function buildDelegationProtocol(cfg: RouterConfig): string {
|
|
|
128
143
|
"### Rules:",
|
|
129
144
|
rules,
|
|
130
145
|
"",
|
|
146
|
+
"### Direct Request Routing (No Plan Required):",
|
|
147
|
+
"These rules also apply to ad-hoc user requests, not only PLAN.md execution.",
|
|
148
|
+
directRoutingList,
|
|
149
|
+
"",
|
|
131
150
|
"### How to delegate:",
|
|
132
151
|
"Use the Task tool with the tier name as `subagent_type`:",
|
|
133
152
|
'- `Task(subagent_type="fast", prompt="Find all files importing AuthContext")`',
|