opencode-model-router 2.8.0 → 2.9.1

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 (91) hide show
  1. package/CHANGELOG.md +372 -0
  2. package/README.md +22 -2
  3. package/package.json +5 -1
  4. package/src/commands/output.ts +23 -1
  5. package/src/compat/background.ts +2439 -0
  6. package/src/compat/child-session.ts +6 -0
  7. package/src/compat/turn-state.ts +215 -0
  8. package/src/compat/v2-client.ts +136 -17
  9. package/src/compat/v2-hooks.ts +2656 -114
  10. package/src/compat/v2-observations.ts +328 -0
  11. package/src/executor/capacity.ts +362 -0
  12. package/src/executor/child-guards.ts +40 -0
  13. package/src/executor/command.ts +265 -0
  14. package/src/executor/compile/edges.ts +809 -0
  15. package/src/executor/compile/estimate.ts +158 -0
  16. package/src/executor/compile/footprint.ts +829 -0
  17. package/src/executor/compile/index.ts +1080 -0
  18. package/src/executor/compile/parse.ts +1492 -0
  19. package/src/executor/compile/residue.ts +706 -0
  20. package/src/executor/compile/validate.ts +280 -0
  21. package/src/executor/create.ts +672 -0
  22. package/src/executor/expand.ts +551 -0
  23. package/src/executor/git.ts +1214 -0
  24. package/src/executor/host-preamble.ts +17 -0
  25. package/src/executor/instructions.ts +35 -0
  26. package/src/executor/integrate/bisect.ts +73 -0
  27. package/src/executor/integrate/checks.ts +1086 -0
  28. package/src/executor/integrate/land.ts +177 -0
  29. package/src/executor/integrate/phase-suite.ts +407 -0
  30. package/src/executor/integrate/queue.ts +3083 -0
  31. package/src/executor/integrate/run-resolver.ts +19 -0
  32. package/src/executor/launch.ts +652 -0
  33. package/src/executor/ledger.ts +2208 -0
  34. package/src/executor/observations.ts +212 -0
  35. package/src/executor/paths.ts +159 -0
  36. package/src/executor/platform.ts +39 -0
  37. package/src/executor/process-identity.ts +19 -0
  38. package/src/executor/qa-loop.ts +470 -0
  39. package/src/executor/recovery.ts +403 -0
  40. package/src/executor/runtime.ts +6233 -0
  41. package/src/executor/schedule.ts +246 -0
  42. package/src/executor/slots/env.ts +145 -0
  43. package/src/executor/slots/pool.ts +1564 -0
  44. package/src/executor/slots/provision.ts +853 -0
  45. package/src/executor/tool.ts +534 -0
  46. package/src/executor/types.ts +2064 -0
  47. package/src/executor/unattended.ts +488 -0
  48. package/src/guard/store.ts +3 -1
  49. package/src/index.ts +1498 -288
  50. package/src/router/config.ts +776 -25
  51. package/src/router/git-tools.ts +106 -15
  52. package/src/router/leases.ts +1469 -0
  53. package/src/router/logger.ts +44 -32
  54. package/src/router/protocol.ts +40 -10
  55. package/src/router/role-agents.ts +224 -17
  56. package/src/router/roles-config.ts +10 -1
  57. package/src/router/roles.ts +1 -1
  58. package/src/router/run-tools.ts +56 -4
  59. package/src/router/tool-paths.ts +308 -0
  60. package/src/router/work-roots.ts +86 -0
  61. package/src/routing/advisor/findings.ts +25 -5
  62. package/src/routing/classify/index.ts +7 -1
  63. package/src/routing/classify/rules.ts +11 -0
  64. package/src/routing/commands/stats.ts +2 -2
  65. package/src/routing/outcomes/durations.ts +225 -0
  66. package/src/routing/outcomes/index.ts +59 -2
  67. package/src/routing/outcomes/persist.ts +409 -0
  68. package/src/routing/outcomes/stats.ts +170 -11
  69. package/src/routing/outcomes/timings.ts +836 -0
  70. package/src/routing/outcomes/types.ts +98 -0
  71. package/src/routing/roles/approvals.ts +86 -5
  72. package/src/routing/roles/binding.ts +99 -9
  73. package/src/routing/roles/orphans.ts +68 -0
  74. package/src/routing/roles/policy.ts +21 -3
  75. package/src/routing/roles/work-root.ts +3 -1
  76. package/src/routing/wire/dispatch.ts +86 -12
  77. package/src/routing/wire/hint.ts +56 -8
  78. package/src/v2.ts +94 -49
  79. package/src/verify/branch.ts +8 -2
  80. package/src/verify/canonical-path.ts +35 -0
  81. package/src/verify/deterministic.ts +38 -9
  82. package/src/verify/dispatch.ts +64 -28
  83. package/src/verify/exec.ts +52 -9
  84. package/src/verify/pending.ts +1691 -10
  85. package/src/verify/perimeter.ts +12 -6
  86. package/src/verify/plan-task.ts +729 -0
  87. package/src/verify/reference.ts +216 -3
  88. package/src/verify/tree.ts +30 -13
  89. package/src/verify/types.ts +9 -2
  90. package/src/verify/wiring.ts +290 -31
  91. package/tiers.json +5 -5
@@ -1030,6 +1030,9 @@ export interface PlannedPerimeter extends DispatchPerimeter {
1030
1030
  readonly unadmittedMore?: number;
1031
1031
  }
1032
1032
 
1033
+ /** A-5.1-12: a plan-task verification id, `plan:<orchestratorSessionID>:<planId>/<taskId>#<n>`; group 1 is the orchestrator. */
1034
+ export const PLAN_TASK_PERIMETER_ID = /^plan:([^:/]+):[^/]+\/.+#[1-9][0-9]*$/;
1035
+
1033
1036
  /**
1034
1037
  * The perimeter beyond W of the dispatch `dispatchID` (a native `task` dispatch, `task:<orchestrator>:<callID>`) verified at
1035
1038
  * `cwd`, or undefined when it has none (I9): not a routed role dispatch, or neither a grant location nor another working-set
@@ -1042,14 +1045,17 @@ export function planPerimeter(
1042
1045
  admission: () => PerimeterAdmission,
1043
1046
  io: DependencyIO = defaultDependencyIO,
1044
1047
  ): PlannedPerimeter | undefined {
1045
- if (!dispatchID.startsWith("task:")) return undefined;
1048
+ // A-5.1-12 (Phase 5.1, additive): a plan-task attempt `plan:<orchestrator>:<planId>/<taskId>#<n>` is planned too, with W its
1049
+ // slot (`cwd`, no grant location), the orchestrator's working set and W's link targets.
1050
+ const planTask = PLAN_TASK_PERIMETER_ID.exec(dispatchID);
1051
+ if (!dispatchID.startsWith("task:") && planTask === null) return undefined;
1046
1052
  const rest = dispatchID.slice("task:".length);
1047
1053
  const separator = rest.indexOf(":");
1048
- if (separator <= 0) return undefined;
1049
- const orchestrator = rest.slice(0, separator);
1050
- const routed = routedRoleOf(rest.slice(separator + 1));
1051
- if (routed === undefined || routed.parentSessionID !== orchestrator) return undefined;
1052
- const location = routed.grant?.location;
1054
+ if (planTask === null && separator <= 0) return undefined;
1055
+ const orchestrator = planTask?.[1] ?? rest.slice(0, separator);
1056
+ const routed = planTask === null ? routedRoleOf(rest.slice(separator + 1)) : undefined;
1057
+ if (planTask === null && (routed === undefined || routed.parentSessionID !== orchestrator)) return undefined;
1058
+ const location = routed?.grant?.location;
1053
1059
  const w = location?.worktree ?? cwd;
1054
1060
  const workingSet = workingSetOf(orchestrator);
1055
1061
  const others = workingSet.filter((entry) => !insideOrEqual(w, entry.worktree) && !insideOrEqual(entry.worktree, w));