opencode-model-router 2.0.0 → 2.2.0

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/src/v2.ts CHANGED
@@ -17,6 +17,7 @@ export default {
17
17
  worktree: ctx.location.project.directory,
18
18
  client: runtime.client,
19
19
  routerChildRunner: runtime.childRunner,
20
+ routerHost: "v2" as const,
20
21
  };
21
22
  const hooks = await ModelRouterPlugin(input as unknown as PluginInput);
22
23
  return registerV2Hooks(ctx, hooks, runtime);
@@ -914,7 +914,7 @@ export interface VerificationWiring {
914
914
  * the changed files are "unavailable" and the reference is the untracked default. `deadline`
915
915
  * bounds every testsPass step (T3); without it each testsPass check owns one of gateBudgetMs.
916
916
  */
917
- buildGateDeps(parentSessionID?: string, inFlight?: Set<string>, prepared?: PreparedVerification, deadline?: Deadline): GateDeps;
917
+ buildGateDeps(parentSessionID?: string, inFlight?: Set<string>, prepared?: PreparedVerification, deadline?: Deadline, forceLowPriority?: boolean, creatorSessionID?: string | null): GateDeps;
918
918
  /**
919
919
  * 2.2.3: the idle-TTL sweep's hook into the plugin's one S5 batch coordinator (batch.ts B11):
920
920
  * evicts windows with no live member and batches whose seam hung past BATCH_STALE_GRACE_MS.
@@ -969,6 +969,8 @@ export function createVerificationWiring(deps: {
969
969
  getConfig: () => RouterConfig;
970
970
  /** Default: console.warn, no debug output. */
971
971
  logger?: WiringLogger;
972
+ /** Record each grader's creator before its first prompt, independently of its backend parent. */
973
+ onChildSessionCreated?: (sid: string, creatorSid: string | null) => void;
972
974
  /** Test seams of the S5 batch coordinator (clock, timers, platform, maximum window size). */
973
975
  batch?: Omit<BatchCoordinatorOptions, "logger">;
974
976
  /** Test seams of the pending registry (clock, random source). */
@@ -1197,10 +1199,19 @@ export function createVerificationWiring(deps: {
1197
1199
  }
1198
1200
  };
1199
1201
 
1202
+ const notifyChildCreated = (sid: string, creatorSid: string | null): void => {
1203
+ try {
1204
+ deps.onChildSessionCreated?.(sid, creatorSid);
1205
+ } catch (error) {
1206
+ logger.warn("[verify] child-session hook failed", { error: errorText(error) });
1207
+ }
1208
+ };
1209
+
1200
1210
  const dispatchGrader = async (
1201
1211
  req: GraderRequest,
1202
1212
  parentSessionID?: string,
1203
1213
  inFlight?: Set<string>,
1214
+ creatorSessionID: string | null = parentSessionID ?? null,
1204
1215
  ): Promise<{ sessionID: string; text: string }> => {
1205
1216
  if (deps.childRunner) {
1206
1217
  const cfg = getConfig();
@@ -1218,6 +1229,7 @@ export function createVerificationWiring(deps: {
1218
1229
  sid = sessionID;
1219
1230
  graderSessions.add(sessionID);
1220
1231
  inFlight?.add(sessionID);
1232
+ notifyChildCreated(sessionID, creatorSessionID);
1221
1233
  },
1222
1234
  }), graderTimeoutMs(req.tier, cfg.enforcement?.verify?.graderTimeoutMs), "grader prompt");
1223
1235
  } finally {
@@ -1242,6 +1254,7 @@ export function createVerificationWiring(deps: {
1242
1254
  if (!sid) return { sessionID: "", text: "" };
1243
1255
  graderSessions.add(sid);
1244
1256
  inFlight?.add(sid);
1257
+ notifyChildCreated(sid, creatorSessionID);
1245
1258
  try {
1246
1259
  const cfg = getConfig();
1247
1260
  const model = tierModel(cfg, req.tier) ?? undefined;
@@ -1315,6 +1328,7 @@ export function createVerificationWiring(deps: {
1315
1328
  prepared?: PreparedVerification,
1316
1329
  deadline?: Deadline,
1317
1330
  forceLowPriority = false,
1331
+ creatorSessionID: string | null = parentSessionID ?? null,
1318
1332
  ): GateDeps => {
1319
1333
  const cfg = getConfig();
1320
1334
  const resolved = resolveVerifyBudget(cfg);
@@ -1393,7 +1407,7 @@ export function createVerificationWiring(deps: {
1393
1407
  },
1394
1408
  checker: {
1395
1409
  dispatchGrader: (req: GraderRequest) =>
1396
- dispatchGrader(req, parentSessionID, inFlight),
1410
+ dispatchGrader(req, parentSessionID, inFlight, creatorSessionID),
1397
1411
  ladder: ["fast", "medium", "heavy"],
1398
1412
  minGraderTier: cfg.enforcement?.verify?.minGraderTier ?? null,
1399
1413
  },
package/tiers.json CHANGED
@@ -288,6 +288,49 @@
288
288
  ]
289
289
  }
290
290
  },
291
+ "hybrid-2": {
292
+ "fast": {
293
+ "model": "openai/gpt-6-luna-fast",
294
+ "variant": "medium",
295
+ "costRatio": 1,
296
+ "description": "GPT 6 Luna (medium) for exploration, search, and simple reads",
297
+ "steps": 30,
298
+ "whenToUse": [
299
+ "Codebase exploration and search",
300
+ "Simple file reads and listing",
301
+ "Grep/glob operations",
302
+ "Quick lookups and research"
303
+ ]
304
+ },
305
+ "medium": {
306
+ "model": "anthropic/claude-sonnet-5-5",
307
+ "variant": "xhigh",
308
+ "effort": "xhigh",
309
+ "costRatio": 5,
310
+ "description": "Claude Sonnet (xhigh) for implementation and standard coding",
311
+ "steps": 50,
312
+ "whenToUse": [
313
+ "Feature implementation",
314
+ "Refactoring",
315
+ "Writing tests",
316
+ "Bug fixes"
317
+ ]
318
+ },
319
+ "heavy": {
320
+ "model": "anthropic/claude-opus-5-5",
321
+ "variant": "xhigh",
322
+ "effort": "xhigh",
323
+ "costRatio": 20,
324
+ "description": "Claude Opus 5.5 xhigh for architecture, complex debugging, and security",
325
+ "steps": 120,
326
+ "whenToUse": [
327
+ "Architecture decisions",
328
+ "Complex debugging (after 2+ failures)",
329
+ "Security review",
330
+ "Performance optimization"
331
+ ]
332
+ }
333
+ },
291
334
  "fable-effort": {
292
335
  "fast": {
293
336
  "model": "anthropic/claude-fable-5-1",