@coool/opencode-adaptive 0.0.0-stage → 1.0.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.
Files changed (440) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -2
  3. package/dist/adapters/codex-capacity/index.d.ts +5 -0
  4. package/dist/adapters/codex-capacity/index.d.ts.map +1 -0
  5. package/dist/adapters/codex-capacity/index.js +5 -0
  6. package/dist/adapters/codex-capacity/index.js.map +1 -0
  7. package/dist/adapters/codex-capacity/parse.d.ts +28 -0
  8. package/dist/adapters/codex-capacity/parse.d.ts.map +1 -0
  9. package/dist/adapters/codex-capacity/parse.js +130 -0
  10. package/dist/adapters/codex-capacity/parse.js.map +1 -0
  11. package/dist/adapters/codex-capacity/reading.d.ts +10 -0
  12. package/dist/adapters/codex-capacity/reading.d.ts.map +1 -0
  13. package/dist/adapters/codex-capacity/reading.js +45 -0
  14. package/dist/adapters/codex-capacity/reading.js.map +1 -0
  15. package/dist/adapters/codex-capacity/sensor.d.ts +24 -0
  16. package/dist/adapters/codex-capacity/sensor.d.ts.map +1 -0
  17. package/dist/adapters/codex-capacity/sensor.js +30 -0
  18. package/dist/adapters/codex-capacity/sensor.js.map +1 -0
  19. package/dist/adapters/codex-capacity/types.d.ts +35 -0
  20. package/dist/adapters/codex-capacity/types.d.ts.map +1 -0
  21. package/dist/adapters/codex-capacity/types.js +4 -0
  22. package/dist/adapters/codex-capacity/types.js.map +1 -0
  23. package/dist/adapters/opencode/escalation-tool.d.ts +52 -0
  24. package/dist/adapters/opencode/escalation-tool.d.ts.map +1 -0
  25. package/dist/adapters/opencode/escalation-tool.js +59 -0
  26. package/dist/adapters/opencode/escalation-tool.js.map +1 -0
  27. package/dist/adapters/opencode/events.d.ts +24 -0
  28. package/dist/adapters/opencode/events.d.ts.map +1 -0
  29. package/dist/adapters/opencode/events.js +68 -0
  30. package/dist/adapters/opencode/events.js.map +1 -0
  31. package/dist/adapters/opencode/hooks.d.ts +35 -0
  32. package/dist/adapters/opencode/hooks.d.ts.map +1 -0
  33. package/dist/adapters/opencode/hooks.js +12 -0
  34. package/dist/adapters/opencode/hooks.js.map +1 -0
  35. package/dist/adapters/opencode/index.d.ts +17 -0
  36. package/dist/adapters/opencode/index.d.ts.map +1 -0
  37. package/dist/adapters/opencode/index.js +9 -0
  38. package/dist/adapters/opencode/index.js.map +1 -0
  39. package/dist/adapters/opencode/inventory.d.ts +31 -0
  40. package/dist/adapters/opencode/inventory.d.ts.map +1 -0
  41. package/dist/adapters/opencode/inventory.js +53 -0
  42. package/dist/adapters/opencode/inventory.js.map +1 -0
  43. package/dist/adapters/opencode/report.d.ts +92 -0
  44. package/dist/adapters/opencode/report.d.ts.map +1 -0
  45. package/dist/adapters/opencode/report.js +145 -0
  46. package/dist/adapters/opencode/report.js.map +1 -0
  47. package/dist/adapters/opencode/session-ops.d.ts +40 -0
  48. package/dist/adapters/opencode/session-ops.d.ts.map +1 -0
  49. package/dist/adapters/opencode/session-ops.js +32 -0
  50. package/dist/adapters/opencode/session-ops.js.map +1 -0
  51. package/dist/adapters/opencode/storage.d.ts +16 -0
  52. package/dist/adapters/opencode/storage.d.ts.map +1 -0
  53. package/dist/adapters/opencode/storage.js +8 -0
  54. package/dist/adapters/opencode/storage.js.map +1 -0
  55. package/dist/adapters/opencode/tier-tool.d.ts +38 -0
  56. package/dist/adapters/opencode/tier-tool.d.ts.map +1 -0
  57. package/dist/adapters/opencode/tier-tool.js +72 -0
  58. package/dist/adapters/opencode/tier-tool.js.map +1 -0
  59. package/dist/adapters/opencode/types.d.ts +102 -0
  60. package/dist/adapters/opencode/types.d.ts.map +1 -0
  61. package/dist/adapters/opencode/types.js +2 -0
  62. package/dist/adapters/opencode/types.js.map +1 -0
  63. package/dist/core/compatibility/gate.d.ts +10 -0
  64. package/dist/core/compatibility/gate.d.ts.map +1 -0
  65. package/dist/core/compatibility/gate.js +55 -0
  66. package/dist/core/compatibility/gate.js.map +1 -0
  67. package/dist/core/compatibility/index.d.ts +3 -0
  68. package/dist/core/compatibility/index.d.ts.map +1 -0
  69. package/dist/core/compatibility/index.js +3 -0
  70. package/dist/core/compatibility/index.js.map +1 -0
  71. package/dist/core/compatibility/types.d.ts +54 -0
  72. package/dist/core/compatibility/types.d.ts.map +1 -0
  73. package/dist/core/compatibility/types.js +27 -0
  74. package/dist/core/compatibility/types.js.map +1 -0
  75. package/dist/core/scheduler/admit.d.ts +7 -0
  76. package/dist/core/scheduler/admit.d.ts.map +1 -0
  77. package/dist/core/scheduler/admit.js +153 -0
  78. package/dist/core/scheduler/admit.js.map +1 -0
  79. package/dist/core/scheduler/escalate.d.ts +7 -0
  80. package/dist/core/scheduler/escalate.d.ts.map +1 -0
  81. package/dist/core/scheduler/escalate.js +56 -0
  82. package/dist/core/scheduler/escalate.js.map +1 -0
  83. package/dist/core/scheduler/index.d.ts +5 -0
  84. package/dist/core/scheduler/index.d.ts.map +1 -0
  85. package/dist/core/scheduler/index.js +5 -0
  86. package/dist/core/scheduler/index.js.map +1 -0
  87. package/dist/core/scheduler/mode.d.ts +9 -0
  88. package/dist/core/scheduler/mode.d.ts.map +1 -0
  89. package/dist/core/scheduler/mode.js +10 -0
  90. package/dist/core/scheduler/mode.js.map +1 -0
  91. package/dist/core/scheduler/types.d.ts +143 -0
  92. package/dist/core/scheduler/types.d.ts.map +1 -0
  93. package/dist/core/scheduler/types.js +74 -0
  94. package/dist/core/scheduler/types.js.map +1 -0
  95. package/dist/core/tier-policy/index.d.ts +4 -0
  96. package/dist/core/tier-policy/index.d.ts.map +1 -0
  97. package/dist/core/tier-policy/index.js +4 -0
  98. package/dist/core/tier-policy/index.js.map +1 -0
  99. package/dist/core/tier-policy/resolve.d.ts +19 -0
  100. package/dist/core/tier-policy/resolve.d.ts.map +1 -0
  101. package/dist/core/tier-policy/resolve.js +52 -0
  102. package/dist/core/tier-policy/resolve.js.map +1 -0
  103. package/dist/core/tier-policy/tier-list.d.ts +11 -0
  104. package/dist/core/tier-policy/tier-list.d.ts.map +1 -0
  105. package/dist/core/tier-policy/tier-list.js +23 -0
  106. package/dist/core/tier-policy/tier-list.js.map +1 -0
  107. package/dist/core/tier-policy/types.d.ts +85 -0
  108. package/dist/core/tier-policy/types.d.ts.map +1 -0
  109. package/dist/core/tier-policy/types.js +45 -0
  110. package/dist/core/tier-policy/types.js.map +1 -0
  111. package/dist/core/work-unit/index.d.ts +4 -0
  112. package/dist/core/work-unit/index.d.ts.map +1 -0
  113. package/dist/core/work-unit/index.js +4 -0
  114. package/dist/core/work-unit/index.js.map +1 -0
  115. package/dist/core/work-unit/interruption.d.ts +8 -0
  116. package/dist/core/work-unit/interruption.d.ts.map +1 -0
  117. package/dist/core/work-unit/interruption.js +12 -0
  118. package/dist/core/work-unit/interruption.js.map +1 -0
  119. package/dist/core/work-unit/tracker.d.ts +46 -0
  120. package/dist/core/work-unit/tracker.d.ts.map +1 -0
  121. package/dist/core/work-unit/tracker.js +136 -0
  122. package/dist/core/work-unit/tracker.js.map +1 -0
  123. package/dist/core/work-unit/types.d.ts +146 -0
  124. package/dist/core/work-unit/types.d.ts.map +1 -0
  125. package/dist/core/work-unit/types.js +23 -0
  126. package/dist/core/work-unit/types.js.map +1 -0
  127. package/dist/execution/continuation/execute.d.ts +19 -0
  128. package/dist/execution/continuation/execute.d.ts.map +1 -0
  129. package/dist/execution/continuation/execute.js +31 -0
  130. package/dist/execution/continuation/execute.js.map +1 -0
  131. package/dist/execution/continuation/index.d.ts +6 -0
  132. package/dist/execution/continuation/index.d.ts.map +1 -0
  133. package/dist/execution/continuation/index.js +5 -0
  134. package/dist/execution/continuation/index.js.map +1 -0
  135. package/dist/execution/continuation/ledger.d.ts +20 -0
  136. package/dist/execution/continuation/ledger.d.ts.map +1 -0
  137. package/dist/execution/continuation/ledger.js +31 -0
  138. package/dist/execution/continuation/ledger.js.map +1 -0
  139. package/dist/execution/continuation/plan.d.ts +13 -0
  140. package/dist/execution/continuation/plan.d.ts.map +1 -0
  141. package/dist/execution/continuation/plan.js +20 -0
  142. package/dist/execution/continuation/plan.js.map +1 -0
  143. package/dist/execution/continuation/prompts.d.ts +8 -0
  144. package/dist/execution/continuation/prompts.d.ts.map +1 -0
  145. package/dist/execution/continuation/prompts.js +8 -0
  146. package/dist/execution/continuation/prompts.js.map +1 -0
  147. package/dist/execution/continuation/types.d.ts +70 -0
  148. package/dist/execution/continuation/types.d.ts.map +1 -0
  149. package/dist/execution/continuation/types.js +15 -0
  150. package/dist/execution/continuation/types.js.map +1 -0
  151. package/dist/execution/escalation/index.d.ts +2 -0
  152. package/dist/execution/escalation/index.d.ts.map +1 -0
  153. package/dist/execution/escalation/index.js +2 -0
  154. package/dist/execution/escalation/index.js.map +1 -0
  155. package/dist/execution/escalation/types.d.ts +31 -0
  156. package/dist/execution/escalation/types.d.ts.map +1 -0
  157. package/dist/execution/escalation/types.js +49 -0
  158. package/dist/execution/escalation/types.js.map +1 -0
  159. package/dist/execution/index.d.ts +5 -0
  160. package/dist/execution/index.d.ts.map +1 -0
  161. package/dist/execution/index.js +5 -0
  162. package/dist/execution/index.js.map +1 -0
  163. package/dist/execution/parking/index.d.ts +3 -0
  164. package/dist/execution/parking/index.d.ts.map +1 -0
  165. package/dist/execution/parking/index.js +2 -0
  166. package/dist/execution/parking/index.js.map +1 -0
  167. package/dist/execution/parking/plan.d.ts +40 -0
  168. package/dist/execution/parking/plan.d.ts.map +1 -0
  169. package/dist/execution/parking/plan.js +34 -0
  170. package/dist/execution/parking/plan.js.map +1 -0
  171. package/dist/execution/recovery/gate.d.ts +20 -0
  172. package/dist/execution/recovery/gate.d.ts.map +1 -0
  173. package/dist/execution/recovery/gate.js +23 -0
  174. package/dist/execution/recovery/gate.js.map +1 -0
  175. package/dist/execution/recovery/index.d.ts +3 -0
  176. package/dist/execution/recovery/index.d.ts.map +1 -0
  177. package/dist/execution/recovery/index.js +2 -0
  178. package/dist/execution/recovery/index.js.map +1 -0
  179. package/dist/execution/retry/decide.d.ts +30 -0
  180. package/dist/execution/retry/decide.d.ts.map +1 -0
  181. package/dist/execution/retry/decide.js +76 -0
  182. package/dist/execution/retry/decide.js.map +1 -0
  183. package/dist/execution/retry/index.d.ts +3 -0
  184. package/dist/execution/retry/index.d.ts.map +1 -0
  185. package/dist/execution/retry/index.js +3 -0
  186. package/dist/execution/retry/index.js.map +1 -0
  187. package/dist/execution/retry/types.d.ts +66 -0
  188. package/dist/execution/retry/types.d.ts.map +1 -0
  189. package/dist/execution/retry/types.js +9 -0
  190. package/dist/execution/retry/types.js.map +1 -0
  191. package/dist/gui-experimental.cjs +1 -0
  192. package/dist/gui.d.ts +17 -0
  193. package/dist/gui.d.ts.map +1 -0
  194. package/dist/gui.js +70 -0
  195. package/dist/gui.js.map +1 -0
  196. package/dist/health/capacity/index.d.ts +4 -0
  197. package/dist/health/capacity/index.d.ts.map +1 -0
  198. package/dist/health/capacity/index.js +4 -0
  199. package/dist/health/capacity/index.js.map +1 -0
  200. package/dist/health/capacity/merge.d.ts +58 -0
  201. package/dist/health/capacity/merge.d.ts.map +1 -0
  202. package/dist/health/capacity/merge.js +154 -0
  203. package/dist/health/capacity/merge.js.map +1 -0
  204. package/dist/health/capacity/registry.d.ts +41 -0
  205. package/dist/health/capacity/registry.d.ts.map +1 -0
  206. package/dist/health/capacity/registry.js +106 -0
  207. package/dist/health/capacity/registry.js.map +1 -0
  208. package/dist/health/capacity/types.d.ts +74 -0
  209. package/dist/health/capacity/types.d.ts.map +1 -0
  210. package/dist/health/capacity/types.js +6 -0
  211. package/dist/health/capacity/types.js.map +1 -0
  212. package/dist/health/circuit-breaker/breaker.d.ts +84 -0
  213. package/dist/health/circuit-breaker/breaker.d.ts.map +1 -0
  214. package/dist/health/circuit-breaker/breaker.js +132 -0
  215. package/dist/health/circuit-breaker/breaker.js.map +1 -0
  216. package/dist/health/circuit-breaker/index.d.ts +3 -0
  217. package/dist/health/circuit-breaker/index.d.ts.map +1 -0
  218. package/dist/health/circuit-breaker/index.js +3 -0
  219. package/dist/health/circuit-breaker/index.js.map +1 -0
  220. package/dist/health/circuit-breaker/types.d.ts +53 -0
  221. package/dist/health/circuit-breaker/types.d.ts.map +1 -0
  222. package/dist/health/circuit-breaker/types.js +13 -0
  223. package/dist/health/circuit-breaker/types.js.map +1 -0
  224. package/dist/health/classifier/classify.d.ts +9 -0
  225. package/dist/health/classifier/classify.d.ts.map +1 -0
  226. package/dist/health/classifier/classify.js +245 -0
  227. package/dist/health/classifier/classify.js.map +1 -0
  228. package/dist/health/classifier/index.d.ts +3 -0
  229. package/dist/health/classifier/index.d.ts.map +1 -0
  230. package/dist/health/classifier/index.js +3 -0
  231. package/dist/health/classifier/index.js.map +1 -0
  232. package/dist/health/classifier/types.d.ts +72 -0
  233. package/dist/health/classifier/types.d.ts.map +1 -0
  234. package/dist/health/classifier/types.js +27 -0
  235. package/dist/health/classifier/types.js.map +1 -0
  236. package/dist/health/index.d.ts +5 -0
  237. package/dist/health/index.d.ts.map +1 -0
  238. package/dist/health/index.js +5 -0
  239. package/dist/health/index.js.map +1 -0
  240. package/dist/health/resource-health/index.d.ts +5 -0
  241. package/dist/health/resource-health/index.d.ts.map +1 -0
  242. package/dist/health/resource-health/index.js +5 -0
  243. package/dist/health/resource-health/index.js.map +1 -0
  244. package/dist/health/resource-health/key.d.ts +19 -0
  245. package/dist/health/resource-health/key.d.ts.map +1 -0
  246. package/dist/health/resource-health/key.js +54 -0
  247. package/dist/health/resource-health/key.js.map +1 -0
  248. package/dist/health/resource-health/registry.d.ts +41 -0
  249. package/dist/health/resource-health/registry.d.ts.map +1 -0
  250. package/dist/health/resource-health/registry.js +258 -0
  251. package/dist/health/resource-health/registry.js.map +1 -0
  252. package/dist/health/resource-health/transitions.d.ts +11 -0
  253. package/dist/health/resource-health/transitions.d.ts.map +1 -0
  254. package/dist/health/resource-health/transitions.js +165 -0
  255. package/dist/health/resource-health/transitions.js.map +1 -0
  256. package/dist/health/resource-health/types.d.ts +116 -0
  257. package/dist/health/resource-health/types.d.ts.map +1 -0
  258. package/dist/health/resource-health/types.js +43 -0
  259. package/dist/health/resource-health/types.js.map +1 -0
  260. package/dist/index.d.ts +17 -0
  261. package/dist/index.d.ts.map +1 -0
  262. package/dist/index.js +80 -0
  263. package/dist/index.js.map +1 -0
  264. package/dist/plugin-id.d.ts +3 -0
  265. package/dist/plugin-id.d.ts.map +1 -0
  266. package/dist/plugin-id.js +3 -0
  267. package/dist/plugin-id.js.map +1 -0
  268. package/dist/rpc/definition.d.ts +100 -0
  269. package/dist/rpc/definition.d.ts.map +1 -0
  270. package/dist/rpc/definition.js +104 -0
  271. package/dist/rpc/definition.js.map +1 -0
  272. package/dist/rpc/handlers.d.ts +65 -0
  273. package/dist/rpc/handlers.d.ts.map +1 -0
  274. package/dist/rpc/handlers.js +111 -0
  275. package/dist/rpc/handlers.js.map +1 -0
  276. package/dist/rpc/status.d.ts +43 -0
  277. package/dist/rpc/status.d.ts.map +1 -0
  278. package/dist/rpc/status.js +45 -0
  279. package/dist/rpc/status.js.map +1 -0
  280. package/dist/rpc.d.ts +11 -0
  281. package/dist/rpc.d.ts.map +1 -0
  282. package/dist/rpc.js +8 -0
  283. package/dist/rpc.js.map +1 -0
  284. package/dist/state/capacity/index.d.ts +4 -0
  285. package/dist/state/capacity/index.d.ts.map +1 -0
  286. package/dist/state/capacity/index.js +4 -0
  287. package/dist/state/capacity/index.js.map +1 -0
  288. package/dist/state/capacity/parse.d.ts +3 -0
  289. package/dist/state/capacity/parse.d.ts.map +1 -0
  290. package/dist/state/capacity/parse.js +110 -0
  291. package/dist/state/capacity/parse.js.map +1 -0
  292. package/dist/state/capacity/store.d.ts +19 -0
  293. package/dist/state/capacity/store.d.ts.map +1 -0
  294. package/dist/state/capacity/store.js +64 -0
  295. package/dist/state/capacity/store.js.map +1 -0
  296. package/dist/state/capacity/types.d.ts +38 -0
  297. package/dist/state/capacity/types.d.ts.map +1 -0
  298. package/dist/state/capacity/types.js +11 -0
  299. package/dist/state/capacity/types.js.map +1 -0
  300. package/dist/state/health/index.d.ts +5 -0
  301. package/dist/state/health/index.d.ts.map +1 -0
  302. package/dist/state/health/index.js +4 -0
  303. package/dist/state/health/index.js.map +1 -0
  304. package/dist/state/health/parse.d.ts +3 -0
  305. package/dist/state/health/parse.d.ts.map +1 -0
  306. package/dist/state/health/parse.js +121 -0
  307. package/dist/state/health/parse.js.map +1 -0
  308. package/dist/state/health/store.d.ts +18 -0
  309. package/dist/state/health/store.d.ts.map +1 -0
  310. package/dist/state/health/store.js +55 -0
  311. package/dist/state/health/store.js.map +1 -0
  312. package/dist/state/health/types.d.ts +24 -0
  313. package/dist/state/health/types.d.ts.map +1 -0
  314. package/dist/state/health/types.js +5 -0
  315. package/dist/state/health/types.js.map +1 -0
  316. package/dist/state/parked-work/index.d.ts +5 -0
  317. package/dist/state/parked-work/index.d.ts.map +1 -0
  318. package/dist/state/parked-work/index.js +4 -0
  319. package/dist/state/parked-work/index.js.map +1 -0
  320. package/dist/state/parked-work/parse.d.ts +7 -0
  321. package/dist/state/parked-work/parse.d.ts.map +1 -0
  322. package/dist/state/parked-work/parse.js +83 -0
  323. package/dist/state/parked-work/parse.js.map +1 -0
  324. package/dist/state/parked-work/store.d.ts +18 -0
  325. package/dist/state/parked-work/store.d.ts.map +1 -0
  326. package/dist/state/parked-work/store.js +81 -0
  327. package/dist/state/parked-work/store.js.map +1 -0
  328. package/dist/state/parked-work/types.d.ts +42 -0
  329. package/dist/state/parked-work/types.d.ts.map +1 -0
  330. package/dist/state/parked-work/types.js +7 -0
  331. package/dist/state/parked-work/types.js.map +1 -0
  332. package/dist/state/receipts/bound.d.ts +15 -0
  333. package/dist/state/receipts/bound.d.ts.map +1 -0
  334. package/dist/state/receipts/bound.js +77 -0
  335. package/dist/state/receipts/bound.js.map +1 -0
  336. package/dist/state/receipts/index.d.ts +7 -0
  337. package/dist/state/receipts/index.d.ts.map +1 -0
  338. package/dist/state/receipts/index.js +5 -0
  339. package/dist/state/receipts/index.js.map +1 -0
  340. package/dist/state/receipts/parse.d.ts +7 -0
  341. package/dist/state/receipts/parse.d.ts.map +1 -0
  342. package/dist/state/receipts/parse.js +226 -0
  343. package/dist/state/receipts/parse.js.map +1 -0
  344. package/dist/state/receipts/store.d.ts +35 -0
  345. package/dist/state/receipts/store.d.ts.map +1 -0
  346. package/dist/state/receipts/store.js +128 -0
  347. package/dist/state/receipts/store.js.map +1 -0
  348. package/dist/state/receipts/types.d.ts +62 -0
  349. package/dist/state/receipts/types.d.ts.map +1 -0
  350. package/dist/state/receipts/types.js +12 -0
  351. package/dist/state/receipts/types.js.map +1 -0
  352. package/dist/state/session-modes/index.d.ts +5 -0
  353. package/dist/state/session-modes/index.d.ts.map +1 -0
  354. package/dist/state/session-modes/index.js +4 -0
  355. package/dist/state/session-modes/index.js.map +1 -0
  356. package/dist/state/session-modes/parse.d.ts +9 -0
  357. package/dist/state/session-modes/parse.d.ts.map +1 -0
  358. package/dist/state/session-modes/parse.js +62 -0
  359. package/dist/state/session-modes/parse.js.map +1 -0
  360. package/dist/state/session-modes/store.d.ts +21 -0
  361. package/dist/state/session-modes/store.d.ts.map +1 -0
  362. package/dist/state/session-modes/store.js +73 -0
  363. package/dist/state/session-modes/store.js.map +1 -0
  364. package/dist/state/session-modes/types.d.ts +42 -0
  365. package/dist/state/session-modes/types.d.ts.map +1 -0
  366. package/dist/state/session-modes/types.js +7 -0
  367. package/dist/state/session-modes/types.js.map +1 -0
  368. package/dist/state/settings/index.d.ts +5 -0
  369. package/dist/state/settings/index.d.ts.map +1 -0
  370. package/dist/state/settings/index.js +4 -0
  371. package/dist/state/settings/index.js.map +1 -0
  372. package/dist/state/settings/parse.d.ts +34 -0
  373. package/dist/state/settings/parse.d.ts.map +1 -0
  374. package/dist/state/settings/parse.js +261 -0
  375. package/dist/state/settings/parse.js.map +1 -0
  376. package/dist/state/settings/store.d.ts +22 -0
  377. package/dist/state/settings/store.d.ts.map +1 -0
  378. package/dist/state/settings/store.js +57 -0
  379. package/dist/state/settings/store.js.map +1 -0
  380. package/dist/state/settings/types.d.ts +63 -0
  381. package/dist/state/settings/types.d.ts.map +1 -0
  382. package/dist/state/settings/types.js +12 -0
  383. package/dist/state/settings/types.js.map +1 -0
  384. package/dist/supervisor/index.d.ts +5 -0
  385. package/dist/supervisor/index.d.ts.map +1 -0
  386. package/dist/supervisor/index.js +4 -0
  387. package/dist/supervisor/index.js.map +1 -0
  388. package/dist/supervisor/log.d.ts +11 -0
  389. package/dist/supervisor/log.d.ts.map +1 -0
  390. package/dist/supervisor/log.js +14 -0
  391. package/dist/supervisor/log.js.map +1 -0
  392. package/dist/supervisor/supervisor.d.ts +69 -0
  393. package/dist/supervisor/supervisor.d.ts.map +1 -0
  394. package/dist/supervisor/supervisor.js +1343 -0
  395. package/dist/supervisor/supervisor.js.map +1 -0
  396. package/dist/supervisor/types.d.ts +50 -0
  397. package/dist/supervisor/types.d.ts.map +1 -0
  398. package/dist/supervisor/types.js +3 -0
  399. package/dist/supervisor/types.js.map +1 -0
  400. package/dist/supervisor/view.d.ts +4 -0
  401. package/dist/supervisor/view.d.ts.map +1 -0
  402. package/dist/supervisor/view.js +4 -0
  403. package/dist/supervisor/view.js.map +1 -0
  404. package/dist/tui.d.ts +16 -0
  405. package/dist/tui.d.ts.map +1 -0
  406. package/dist/tui.js +252 -0
  407. package/dist/tui.js.map +1 -0
  408. package/dist/ui/gui/api.d.ts +18 -0
  409. package/dist/ui/gui/api.d.ts.map +1 -0
  410. package/dist/ui/gui/api.js +21 -0
  411. package/dist/ui/gui/api.js.map +1 -0
  412. package/dist/ui/gui/view.d.ts +27 -0
  413. package/dist/ui/gui/view.d.ts.map +1 -0
  414. package/dist/ui/gui/view.js +49 -0
  415. package/dist/ui/gui/view.js.map +1 -0
  416. package/dist/ui/tui/controller.d.ts +98 -0
  417. package/dist/ui/tui/controller.d.ts.map +1 -0
  418. package/dist/ui/tui/controller.js +399 -0
  419. package/dist/ui/tui/controller.js.map +1 -0
  420. package/dist/ui/tui/menu.d.ts +56 -0
  421. package/dist/ui/tui/menu.d.ts.map +1 -0
  422. package/dist/ui/tui/menu.js +176 -0
  423. package/dist/ui/tui/menu.js.map +1 -0
  424. package/dist/ui/tui/options.d.ts +20 -0
  425. package/dist/ui/tui/options.d.ts.map +1 -0
  426. package/dist/ui/tui/options.js +17 -0
  427. package/dist/ui/tui/options.js.map +1 -0
  428. package/dist/ui/tui/receipts.d.ts +22 -0
  429. package/dist/ui/tui/receipts.d.ts.map +1 -0
  430. package/dist/ui/tui/receipts.js +109 -0
  431. package/dist/ui/tui/receipts.js.map +1 -0
  432. package/dist/ui/tui/status.d.ts +23 -0
  433. package/dist/ui/tui/status.d.ts.map +1 -0
  434. package/dist/ui/tui/status.js +90 -0
  435. package/dist/ui/tui/status.js.map +1 -0
  436. package/dist/ui/tui/tiers.d.ts +52 -0
  437. package/dist/ui/tui/tiers.d.ts.map +1 -0
  438. package/dist/ui/tui/tiers.js +108 -0
  439. package/dist/ui/tui/tiers.js.map +1 -0
  440. package/package.json +85 -4
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Storage seam binding (ADP-030/ADP-031). The supervisor's state stores depend
3
+ * on a minimal `{ read, write }` seam; this module binds that seam to the
4
+ * host's `ctx.storage` under the fixed `coool.adaptive/...` keys. Values are
5
+ * JSON-serializable state payloads (settings/receipts/parked work).
6
+ */
7
+ import type { StorageDomain } from "@opencode/plugin/promise/storage";
8
+ /** The storage surface the seam actually uses (structural — fixture-friendly). */
9
+ export type StorageSource = Pick<StorageDomain, "get" | "set">;
10
+ export interface JsonSeam {
11
+ read(): Promise<unknown>;
12
+ write(value: unknown): Promise<void>;
13
+ }
14
+ /** Bind a storage key to the supervisor seam shape. */
15
+ export declare function storageSeam(key: string, storage: StorageSource): JsonSeam;
16
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/adapters/opencode/storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAErE,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,KAAK,CAAC,CAAA;AAE9D,MAAM,WAAW,QAAQ;IACvB,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IACxB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACrC;AAED,uDAAuD;AACvD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,QAAQ,CAKzE"}
@@ -0,0 +1,8 @@
1
+ /** Bind a storage key to the supervisor seam shape. */
2
+ export function storageSeam(key, storage) {
3
+ return {
4
+ read: () => storage.get(key),
5
+ write: (value) => storage.set(key, value),
6
+ };
7
+ }
8
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/adapters/opencode/storage.ts"],"names":[],"mappings":"AAgBA,uDAAuD;AACvD,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,OAAsB;IAC7D,OAAO;QACL,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;QAC5B,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAA0C,CAAC;KAC/E,CAAA;AACH,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { TierName } from "../../core/tier-policy/types.js";
2
+ /** Records the agent's tier declaration; false = not accepted. */
3
+ export type TierRequestRecorder = (sessionID: string, tier: TierName) => boolean;
4
+ /**
5
+ * The agent-declared tier tool: a typed sibling of adaptive_escalate. The
6
+ * agent declares the tier of the task it is starting ("this task is quick")
7
+ * and the declaration steers the session's next admissions until cleared —
8
+ * one tier per task, not per unit. Plain JSON Schema: the host converts it,
9
+ * and a Standard Schema vendor is silently dropped on 2.2.5.
10
+ */
11
+ export declare function tierTool(record: TierRequestRecorder): {
12
+ name: string;
13
+ description: string;
14
+ input: {
15
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
16
+ readonly type: "object";
17
+ readonly properties: {
18
+ readonly tier: {
19
+ readonly description: "The tier the current task needs.";
20
+ readonly enum: readonly ["quick", "standard", "advanced"];
21
+ };
22
+ };
23
+ readonly required: readonly ["tier"];
24
+ readonly additionalProperties: false;
25
+ };
26
+ options: {
27
+ readonly codemode: false;
28
+ };
29
+ execute: (input: unknown, context: {
30
+ sessionID: string;
31
+ }) => Promise<{
32
+ content: {
33
+ type: "text";
34
+ text: string;
35
+ }[];
36
+ }>;
37
+ };
38
+ //# sourceMappingURL=tier-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tier-tool.d.ts","sourceRoot":"","sources":["../../../src/adapters/opencode/tier-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAE/D,kEAAkE;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAA;AAEhF;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;qBAwBvC,OAAO,WACL;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,KAC7B,OAAO,CAAC;QAAE,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;EAiC5D"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The agent-declared tier tool: a typed sibling of adaptive_escalate. The
3
+ * agent declares the tier of the task it is starting ("this task is quick")
4
+ * and the declaration steers the session's next admissions until cleared —
5
+ * one tier per task, not per unit. Plain JSON Schema: the host converts it,
6
+ * and a Standard Schema vendor is silently dropped on 2.2.5.
7
+ */
8
+ export function tierTool(record) {
9
+ return {
10
+ name: "adaptive_tier",
11
+ description: "Declare the capability tier of the task you are starting: quick " +
12
+ "(routine edits, mechanical steps), standard (the default), or " +
13
+ "advanced (multi-step design, broad refactors, hard debugging). " +
14
+ "The declaration stays in force for this session until you declare " +
15
+ "a different tier. Only declare when the task's tier differs from " +
16
+ "the default; never use this to work around unavailability.",
17
+ input: {
18
+ $schema: "https://json-schema.org/draft/2020-12/schema",
19
+ type: "object",
20
+ properties: {
21
+ tier: {
22
+ description: "The tier the current task needs.",
23
+ enum: ["quick", "standard", "advanced"],
24
+ },
25
+ },
26
+ required: ["tier"],
27
+ additionalProperties: false,
28
+ },
29
+ options: { codemode: false },
30
+ execute: (input, context) => {
31
+ const tier = readTier(input);
32
+ if (tier === null) {
33
+ return Promise.resolve({
34
+ content: [
35
+ {
36
+ type: "text",
37
+ text: "adaptive_tier rejected: tier must be quick, standard, or advanced.",
38
+ },
39
+ ],
40
+ });
41
+ }
42
+ const accepted = record(context.sessionID, tier);
43
+ if (!accepted) {
44
+ return Promise.resolve({
45
+ content: [
46
+ {
47
+ type: "text",
48
+ text: "adaptive_tier rejected: the tier request was not accepted.",
49
+ },
50
+ ],
51
+ });
52
+ }
53
+ return Promise.resolve({
54
+ content: [
55
+ {
56
+ type: "text",
57
+ text: `Tier request recorded: ${tier}. It steers this session's next admissions until cleared.`,
58
+ },
59
+ ],
60
+ });
61
+ },
62
+ };
63
+ }
64
+ function readTier(input) {
65
+ if (typeof input !== "object" || input === null)
66
+ return null;
67
+ const tier = input.tier;
68
+ if (tier !== "quick" && tier !== "standard" && tier !== "advanced")
69
+ return null;
70
+ return tier;
71
+ }
72
+ //# sourceMappingURL=tier-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tier-tool.js","sourceRoot":"","sources":["../../../src/adapters/opencode/tier-tool.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,MAA2B;IAClD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AAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAC5D,MAAM,IAAI,GAAI,KAA4B,CAAC,IAAI,CAAA;IAC/C,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAA;IAC/E,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Adapter report types (ADP-025..ADP-031). The OpenCode adapter's only job is
3
+ * to observe host events and hooks and forward them as plain reports; every
4
+ * policy decision lives in the supervisor wiring. Report shapes mirror the
5
+ * verified `@opencode/plugin@2.2.5` surfaces structurally, so the adapter
6
+ * stays testable against typed fixtures without importing host internals
7
+ * beyond types.
8
+ */
9
+ import type { ModelRef } from "../../core/work-unit/types.js";
10
+ import type { RequestKind } from "../../core/tier-policy/types.js";
11
+ /**
12
+ * Structural mirror of the wire `Session.StructuredError` (also the classifier
13
+ * evidence source). Declared locally because `SessionError.Error` is not
14
+ * re-exported by `@opencode/plugin` — the host payloads are assignable to
15
+ * this shape.
16
+ */
17
+ export interface AdapterStructuredError {
18
+ readonly type: string;
19
+ readonly message: string;
20
+ readonly status?: number | undefined;
21
+ readonly response?: {
22
+ readonly body: string;
23
+ } | undefined;
24
+ readonly retryAfterMs?: number | undefined;
25
+ }
26
+ /** Work-unit lifecycle reports forwarded from `session.execution.*` events. */
27
+ export type ExecutionReport = {
28
+ kind: "execution-started";
29
+ sessionID: string;
30
+ at: number;
31
+ } | {
32
+ kind: "execution-succeeded";
33
+ sessionID: string;
34
+ at: number;
35
+ } | {
36
+ kind: "execution-failed";
37
+ sessionID: string;
38
+ at: number;
39
+ error: AdapterStructuredError;
40
+ } | {
41
+ kind: "execution-interrupted";
42
+ sessionID: string;
43
+ at: number;
44
+ reason: string;
45
+ } | {
46
+ kind: "model-selected";
47
+ sessionID: string;
48
+ at: number;
49
+ model: ModelRef;
50
+ };
51
+ /**
52
+ * Model request reports from the `context` hook (the agent loop, always
53
+ * `primary`) and the `model.request` hook (which carries the request kind for
54
+ * auxiliary requests — ADP-027).
55
+ */
56
+ export interface ModelRequestReport {
57
+ kind: "model-request";
58
+ sessionID: string;
59
+ model: ModelRef;
60
+ requestKind: RequestKind;
61
+ /** The agent the request runs under (ADP-002 role-hint routing evidence). */
62
+ agent?: string;
63
+ }
64
+ /**
65
+ * HTTP response evidence from the `http.response` hook. The response body is
66
+ * cloned exactly once and only a bounded excerpt is kept — the original body
67
+ * stays untouched for the host. WebSocket-backed providers bypass this hook
68
+ * entirely (verified limitation), so this evidence is never load-bearing.
69
+ */
70
+ export interface HttpResponseReport {
71
+ kind: "http-response";
72
+ sessionID: string;
73
+ status: number;
74
+ /** Raw `Retry-After` header value; the supervisor parses it, not the adapter. */
75
+ retryAfterHeader?: string | undefined;
76
+ bodyExcerpt?: string | undefined;
77
+ /**
78
+ * Captured quota-telemetry headers selected by the wiring-supplied capture
79
+ * predicate (an allowlist — no other header ever leaves the response, so
80
+ * credentials and cookies cannot leak). Bounded in count and value length.
81
+ */
82
+ capturedHeaders?: Readonly<Record<string, string>> | undefined;
83
+ }
84
+ /** Idle-boundary report from the `experimental.idle` hook (safe boundary). */
85
+ export interface IdleReport {
86
+ kind: "idle";
87
+ sessionID: string;
88
+ }
89
+ /**
90
+ * User-prompt report from the `session.hook("prompt")` hook. The hook is
91
+ * awaited BEFORE the turn's model resolution, so admission performed here
92
+ * lands on the very turn that triggered it — the event pump's
93
+ * execution-started report is asynchronous and races the turn (empirically
94
+ * verified on opencode 2.2.5).
95
+ */
96
+ export interface PromptReport {
97
+ kind: "prompt";
98
+ sessionID: string;
99
+ }
100
+ /** Everything the adapter forwards to the supervisor. */
101
+ export type EventReport = ExecutionReport | ModelRequestReport | HttpResponseReport | IdleReport | PromptReport;
102
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {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A;AAE9E;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,QAAQ,CAAA;IACf,WAAW,EAAE,WAAW,CAAA;IACxB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC;;;;OAIG;IACH,eAAe,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAA;CAC/D;AAED,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,yDAAyD;AACzD,MAAM,MAAM,WAAW,GACrB,eAAe,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,UAAU,GAAG,YAAY,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/opencode/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { CandidateModel, Demand, Verdict } from "./types.js";
2
+ /**
3
+ * Run every check and accumulate reasons in fixed order. A candidate is
4
+ * compatible only when no reason applies; unknown candidate metadata never
5
+ * satisfies a stated requirement.
6
+ */
7
+ export declare function checkCompatibility(candidate: CandidateModel, demand: Demand): Verdict;
8
+ /** Order-preserving convenience filter for the scheduler. */
9
+ export declare function filterCompatible<T extends CandidateModel>(candidates: readonly T[], demand: Demand): T[];
10
+ //# sourceMappingURL=gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../../src/core/compatibility/gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAyB,OAAO,EAAE,MAAM,YAAY,CAAA;AAiBxF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAyCrF;AAED,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,cAAc,EACvD,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,MAAM,EAAE,MAAM,GACb,CAAC,EAAE,CAEL"}
@@ -0,0 +1,55 @@
1
+ /** A finite, non-negative token count is assessable; anything else is unknown demand. */
2
+ function assessableTokens(value) {
3
+ return value !== undefined && Number.isFinite(value) && value >= 0;
4
+ }
5
+ function supportsModalities(supported, demanded) {
6
+ if (supported === undefined) {
7
+ return false;
8
+ }
9
+ return demanded.every((modality) => supported.includes(modality));
10
+ }
11
+ /**
12
+ * Run every check and accumulate reasons in fixed order. A candidate is
13
+ * compatible only when no reason applies; unknown candidate metadata never
14
+ * satisfies a stated requirement.
15
+ */
16
+ export function checkCompatibility(candidate, demand) {
17
+ const reasons = [];
18
+ if (candidate.providerEnabled !== true) {
19
+ reasons.push("provider-unavailable");
20
+ }
21
+ if (candidate.enabled !== true) {
22
+ reasons.push("model-unavailable");
23
+ }
24
+ if (candidate.variant !== undefined && candidate.variantAvailable !== true) {
25
+ reasons.push("variant-unavailable");
26
+ }
27
+ if (demand.tools === true && candidate.capabilities?.tools !== true) {
28
+ reasons.push("tool-use-unsupported");
29
+ }
30
+ if (demand.input !== undefined &&
31
+ demand.input.length > 0 &&
32
+ !supportsModalities(candidate.capabilities?.input, demand.input)) {
33
+ reasons.push("input-modality-unsupported");
34
+ }
35
+ if (demand.output !== undefined &&
36
+ demand.output.length > 0 &&
37
+ !supportsModalities(candidate.capabilities?.output, demand.output)) {
38
+ reasons.push("output-modality-unsupported");
39
+ }
40
+ if (assessableTokens(demand.contextTokens)) {
41
+ const contextLimit = candidate.limit?.context;
42
+ if (!assessableTokens(contextLimit)) {
43
+ reasons.push("context-capacity-unknown");
44
+ }
45
+ else if (contextLimit < demand.contextTokens) {
46
+ reasons.push("context-capacity-insufficient");
47
+ }
48
+ }
49
+ return { compatible: reasons.length === 0, reasons };
50
+ }
51
+ /** Order-preserving convenience filter for the scheduler. */
52
+ export function filterCompatible(candidates, demand) {
53
+ return candidates.filter((candidate) => checkCompatibility(candidate, demand).compatible);
54
+ }
55
+ //# sourceMappingURL=gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.js","sourceRoot":"","sources":["../../../src/core/compatibility/gate.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,SAAS,gBAAgB,CAAC,KAAyB;IACjD,OAAO,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;AACpE,CAAC;AAED,SAAS,kBAAkB,CACzB,SAAwC,EACxC,QAA2B;IAE3B,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAyB,EAAE,MAAc;IAC1E,MAAM,OAAO,GAA4B,EAAE,CAAA;IAE3C,IAAI,SAAS,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;QACvC,OAAO,CAAC,I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AI,YAAY,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;AACtD,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,gBAAgB,CAC9B,UAAwB,EACxB,MAAc;IAEd,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;AAC3F,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./types.js";
2
+ export * from "./gate.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/compatibility/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from "./types.js";
2
+ export * from "./gate.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/compatibility/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Compatibility gate (ADP-017): filters candidates on context capacity,
3
+ * tool use, modalities, and model/variant/provider availability BEFORE
4
+ * health/preference ranking. Pure — adapters map OpenCode `Model.Info` /
5
+ * `Provider.Info` into `CandidateModel`, this module never touches
6
+ * `@opencode/plugin` types.
7
+ *
8
+ * Conservative rule: metadata the gate needs but cannot see is treated as
9
+ * NOT satisfying the requirement (e.g. unknown `enabled`, unknown tool
10
+ * support, unknown context limit). Only demand-side quantities that are
11
+ * themselves unknown are skipped — there is nothing to check against.
12
+ */
13
+ /** What the executing work needs from a resource. All demand fields are optional. */
14
+ export interface Demand {
15
+ /** The unit needs tool use. `undefined`/`false` imposes no tool requirement. */
16
+ readonly tools?: boolean | undefined;
17
+ /** Input modalities the unit carries (e.g. `"text"`, `"image"`). */
18
+ readonly input?: readonly string[] | undefined;
19
+ /** Output modalities the unit must produce. */
20
+ readonly output?: readonly string[] | undefined;
21
+ /** Known or estimated context need in tokens; `undefined` skips the capacity check. */
22
+ readonly contextTokens?: number | undefined;
23
+ }
24
+ /** Adapter-normalized view of one candidate resource. */
25
+ export interface CandidateModel {
26
+ readonly providerID: string;
27
+ readonly modelID: string;
28
+ readonly variant?: string | undefined;
29
+ /** Model is enabled in the host inventory. Unknown ⇒ conservative reject. */
30
+ readonly enabled?: boolean | undefined;
31
+ /** Provider is available in the host inventory. Unknown ⇒ conservative reject. */
32
+ readonly providerEnabled?: boolean | undefined;
33
+ /** The requested variant exists for this model. Unknown ⇒ conservative reject. */
34
+ readonly variantAvailable?: boolean | undefined;
35
+ readonly capabilities?: {
36
+ readonly tools?: boolean | undefined;
37
+ readonly input?: readonly string[] | undefined;
38
+ readonly output?: readonly string[] | undefined;
39
+ } | undefined;
40
+ readonly limit?: {
41
+ readonly context?: number | undefined;
42
+ } | undefined;
43
+ }
44
+ /**
45
+ * Why a candidate failed the gate, in the fixed order the checks run:
46
+ * availability → tools → input modalities → output modalities → context.
47
+ */
48
+ export declare const INCOMPATIBILITY_REASONS: readonly ["provider-unavailable", "model-unavailable", "variant-unavailable", "tool-use-unsupported", "input-modality-unsupported", "output-modality-unsupported", "context-capacity-insufficient", "context-capacity-unknown"];
49
+ export type IncompatibilityReason = (typeof INCOMPATIBILITY_REASONS)[number];
50
+ export interface Verdict {
51
+ readonly compatible: boolean;
52
+ readonly reasons: readonly IncompatibilityReason[];
53
+ }
54
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/compatibility/types.ts"],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AED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,iOASE,CAAA;AAEtC,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5E,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAA;CACnD"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Compatibility gate (ADP-017): filters candidates on context capacity,
3
+ * tool use, modalities, and model/variant/provider availability BEFORE
4
+ * health/preference ranking. Pure — adapters map OpenCode `Model.Info` /
5
+ * `Provider.Info` into `CandidateModel`, this module never touches
6
+ * `@opencode/plugin` types.
7
+ *
8
+ * Conservative rule: metadata the gate needs but cannot see is treated as
9
+ * NOT satisfying the requirement (e.g. unknown `enabled`, unknown tool
10
+ * support, unknown context limit). Only demand-side quantities that are
11
+ * themselves unknown are skipped — there is nothing to check against.
12
+ */
13
+ /**
14
+ * Why a candidate failed the gate, in the fixed order the checks run:
15
+ * availability → tools → input modalities → output modalities → context.
16
+ */
17
+ export const INCOMPATIBILITY_REASONS = [
18
+ "provider-unavailable",
19
+ "model-unavailable",
20
+ "variant-unavailable",
21
+ "tool-use-unsupported",
22
+ "input-modality-unsupported",
23
+ "output-modality-unsupported",
24
+ "context-capacity-insufficient",
25
+ "context-capacity-unknown",
26
+ ];
27
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/compatibility/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmCH;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,sBAAsB;IACtB,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;IACtB,4BAA4B;IAC5B,6BAA6B;IAC7B,+BAA+B;IAC/B,0BAA0B;CACU,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { AdmissionDecision, SchedulerInput } from "./types.js";
2
+ /**
3
+ * Decide the model for a fresh work unit. Total and deterministic: the same
4
+ * input always yields the same decision, and the function has no effects.
5
+ */
6
+ export declare function admit(input: SchedulerInput): AdmissionDecision;
7
+ //# sourceMappingURL=admit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admit.d.ts","sourceRoot":"","sources":["../../../src/core/scheduler/admit.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,iBAAiB,EAGjB,cAAc,EAGf,MAAM,YAAY,CAAA;AAkKnB;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,iBAAiB,CAS9D"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Admission routing (ADP-013/016/022): pick the model for a fresh work unit,
3
+ * or decide to defer (OpenCode's choice stands) or park (wait for recovery).
4
+ *
5
+ * Selection order, after the compatibility gate (ADP-017) filters candidates:
6
+ * ready → probe → draining. Rationale: a half-open breaker candidate is one
7
+ * single-flight admission away from verified recovery; a draining resource is
8
+ * being retired, so depending on it is the last resort. Breaker single-flight
9
+ * is enforced by the resource-health registry, not here.
10
+ */
11
+ import { checkCompatibility } from "../compatibility/gate.js";
12
+ import { sameModelRef } from "../work-unit/types.js";
13
+ import { MAX_EVIDENCE_SKIPPED, schedulerHealthKey } from "./types.js";
14
+ function refOfCandidate(candidate) {
15
+ return {
16
+ providerID: candidate.providerID,
17
+ id: candidate.modelID,
18
+ variant: candidate.variant,
19
+ };
20
+ }
21
+ function lookup(inventory, ref) {
22
+ return inventory.find((candidate) => sameModelRef(refOfCandidate(candidate), ref));
23
+ }
24
+ function classify(assessment, signals) {
25
+ if (signals?.exhausted === true) {
26
+ return { kind: "skip", why: "capacity-exhausted" };
27
+ }
28
+ if (assessment === undefined) {
29
+ return signals?.draining === true ? { kind: "draining" } : { kind: "ready" };
30
+ }
31
+ if (assessment.kind === "probe") {
32
+ return { kind: "probe", probeId: assessment.ticket.id };
33
+ }
34
+ if (assessment.kind === "available") {
35
+ return signals?.draining === true ? { kind: "draining" } : { kind: "ready" };
36
+ }
37
+ return assessment.reason === "draining"
38
+ ? { kind: "draining" }
39
+ : { kind: "skip", why: assessment.reason };
40
+ }
41
+ function apply(model, tier, reason, skipped, probeId) {
42
+ return {
43
+ kind: "apply",
44
+ model,
45
+ ...(tier === undefined ? {} : { tier }),
46
+ reason,
47
+ evidence: {
48
+ skipped: skipped.slice(0, MAX_EVIDENCE_SKIPPED),
49
+ ...(probeId === undefined ? {} : { probeId }),
50
+ },
51
+ };
52
+ }
53
+ function admitPin(input, pin) {
54
+ const entry = lookup(input.inventory, pin);
55
+ if (entry === undefined) {
56
+ return { kind: "defer", reason: "pin-unverifiable" };
57
+ }
58
+ const verdict = checkCompatibility(entry, input.demand);
59
+ if (!verdict.compatible) {
60
+ return { kind: "defer", reason: "pin-incompatible", detail: verdict.reasons.join(",") };
61
+ }
62
+ const key = schedulerHealthKey(pin);
63
+ const bucket = classify(input.health[key], input.capacity[key]);
64
+ if (bucket.kind === "skip") {
65
+ return { kind: "park", reason: "pin-blocked", detail: bucket.why };
66
+ }
67
+ // Manual intent wins (GOAL): a pinned model is applied even while draining;
68
+ // a probe admission is recorded for observability but never overrides intent.
69
+ return apply(pin, undefined, "pin", [], bucket.kind === "probe" ? bucket.probeId : undefined);
70
+ }
71
+ function admitTier(input, tier) {
72
+ if (input.tierCandidates.length === 0) {
73
+ // The tier was reported configured but has an empty list — a configuration
74
+ // discrepancy; park rather than invent resources (ADP-005).
75
+ return { kind: "park", reason: "no-candidates" };
76
+ }
77
+ const seen = [];
78
+ let gateSkipped = 0;
79
+ const skipWhys = [];
80
+ let readyRef;
81
+ for (const ref of input.tierCandidates) {
82
+ const entry = lookup(input.inventory, ref);
83
+ if (entry === undefined) {
84
+ seen.push({ ref, bucket: { kind: "skip", why: "not-in-inventory" } });
85
+ skipWhys.push("not-in-inventory");
86
+ gateSkipped += 1;
87
+ continue;
88
+ }
89
+ const verdict = checkCompatibility(entry, input.demand);
90
+ if (!verdict.compatible) {
91
+ // The gate reports incompatible only when at least one reason exists; the
92
+ // non-null assertion is the only way to express that invariant locally.
93
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
94
+ const why = verdict.reasons[0];
95
+ seen.push({ ref, bucket: { kind: "skip", why } });
96
+ skipWhys.push(why);
97
+ gateSkipped += 1;
98
+ continue;
99
+ }
100
+ const key = schedulerHealthKey(ref);
101
+ const bucket = classify(input.health[key], input.capacity[key]);
102
+ if (bucket.kind === "ready") {
103
+ // First ready candidate wins; later candidates are irrelevant, so the
104
+ // scan stops and the evidence stays an honest prefix of the user order.
105
+ readyRef = ref;
106
+ break;
107
+ }
108
+ seen.push({ ref, bucket });
109
+ if (bucket.kind === "skip") {
110
+ skipWhys.push(bucket.why);
111
+ }
112
+ }
113
+ const first = input.tierCandidates[0];
114
+ const evidenceBefore = (until) => seen.slice(0, until).map((e) => {
115
+ if (e.bucket.kind === "skip")
116
+ return { ref: e.ref, why: e.bucket.why };
117
+ return { ref: e.ref, why: e.bucket.kind === "draining" ? "draining" : "probe-in-flight" };
118
+ });
119
+ if (readyRef !== undefined) {
120
+ return apply(readyRef, tier, first !== undefined && sameModelRef(readyRef, first) ? "preferred" : "fallback", evidenceBefore(seen.length), undefined);
121
+ }
122
+ const probeIndex = seen.findIndex((e) => e.bucket.kind === "probe");
123
+ const probeEntry = probeIndex >= 0 ? seen[probeIndex] : undefined;
124
+ if (probeEntry?.bucket.kind === "probe") {
125
+ return apply(probeEntry.ref, tier, "probe", evidenceBefore(probeIndex), probeEntry.bucket.probeId);
126
+ }
127
+ const drainIndex = seen.findIndex((e) => e.bucket.kind === "draining");
128
+ const drainEntry = drainIndex >= 0 ? seen[drainIndex] : undefined;
129
+ if (drainEntry !== undefined) {
130
+ return apply(drainEntry.ref, tier, "draining", evidenceBefore(drainIndex), undefined);
131
+ }
132
+ const summary = skipWhys.slice(0, 3).join(",");
133
+ return {
134
+ kind: "park",
135
+ reason: gateSkipped === skipWhys.length ? "no-compatible-resource" : "all-blocked",
136
+ detail: summary,
137
+ };
138
+ }
139
+ /**
140
+ * Decide the model for a fresh work unit. Total and deterministic: the same
141
+ * input always yields the same decision, and the function has no effects.
142
+ */
143
+ export function admit(input) {
144
+ const routing = input.routing;
145
+ if (routing.kind === "defer") {
146
+ return { kind: "defer", reason: "routing-defer", detail: routing.reason };
147
+ }
148
+ if (routing.kind === "pin") {
149
+ return admitPin(input, routing.model);
150
+ }
151
+ return admitTier(input, routing.tier);
152
+ }
153
+ //# sourceMappingURL=admit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admit.js","sourceRoot":"","sources":["../../../src/core/scheduler/admit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAG7D,OAAO,EAAE,YAAY,EAAiB,MAAM,uBAAuB,CAAA;AAWnE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AASrE,SAAS,cAAc,CAAC,SAAyB;IAC/C,OAAO;QACL,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,EAAE,EAAE,SAAS,CAAC,OAAO;QACrB,OAAO,EAAE,SAAS,CAAC,OAAO;KAC3B,CAAA;AACH,CAAC;AAED,SAAS,MAAM,CAAC,SAAoC,EAAE,GAAa;IACjE,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AACpF,CAAC;AAED,SAAS,QAAQ,CACf,UAAkC,EAClC,OAAoC;IAEpC,IAAI,OAAO,EAAE,SAAS,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,EAAE,CAAA;IACpD,CAAC;IACD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC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