clinkx 0.3.0 → 1.1.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 (669) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/LICENSE +10 -0
  3. package/README.md +154 -26
  4. package/clinkx-workflows/dist/allowed-roots.d.ts +1 -0
  5. package/clinkx-workflows/dist/allowed-roots.js +5 -0
  6. package/clinkx-workflows/dist/allowed-roots.js.map +1 -0
  7. package/clinkx-workflows/dist/artifacts.d.ts +20 -1
  8. package/clinkx-workflows/dist/artifacts.js +38 -9
  9. package/clinkx-workflows/dist/artifacts.js.map +1 -1
  10. package/clinkx-workflows/dist/backend.d.ts +4 -0
  11. package/clinkx-workflows/dist/chairman-knobs.d.ts +24 -0
  12. package/clinkx-workflows/dist/chairman-knobs.js +27 -0
  13. package/clinkx-workflows/dist/chairman-knobs.js.map +1 -0
  14. package/clinkx-workflows/dist/citation-check.d.ts +40 -0
  15. package/clinkx-workflows/dist/citation-check.js +348 -0
  16. package/clinkx-workflows/dist/citation-check.js.map +1 -0
  17. package/clinkx-workflows/dist/clink-client.d.ts +12 -1
  18. package/clinkx-workflows/dist/clink-client.js +56 -5
  19. package/clinkx-workflows/dist/clink-client.js.map +1 -1
  20. package/clinkx-workflows/dist/config.d.ts +173 -16
  21. package/clinkx-workflows/dist/config.js +417 -26
  22. package/clinkx-workflows/dist/config.js.map +1 -1
  23. package/clinkx-workflows/dist/contained-file.d.ts +172 -0
  24. package/clinkx-workflows/dist/contained-file.js +483 -0
  25. package/clinkx-workflows/dist/contained-file.js.map +1 -0
  26. package/clinkx-workflows/dist/context-builder-lifecycle-contract.d.ts +416 -0
  27. package/clinkx-workflows/dist/context-builder-lifecycle-contract.js +328 -0
  28. package/clinkx-workflows/dist/context-builder-lifecycle-contract.js.map +1 -0
  29. package/clinkx-workflows/dist/context-builder-lifecycle-router.d.ts +24 -0
  30. package/clinkx-workflows/dist/context-builder-lifecycle-router.js +39 -0
  31. package/clinkx-workflows/dist/context-builder-lifecycle-router.js.map +1 -0
  32. package/clinkx-workflows/dist/context-cache-key.d.ts +53 -0
  33. package/clinkx-workflows/dist/context-cache-key.js +91 -0
  34. package/clinkx-workflows/dist/context-cache-key.js.map +1 -0
  35. package/clinkx-workflows/dist/context-mode-resolver.d.ts +27 -0
  36. package/clinkx-workflows/dist/context-mode-resolver.js +126 -0
  37. package/clinkx-workflows/dist/context-mode-resolver.js.map +1 -0
  38. package/clinkx-workflows/dist/context-preflight.d.ts +189 -0
  39. package/clinkx-workflows/dist/context-preflight.js +91 -0
  40. package/clinkx-workflows/dist/context-preflight.js.map +1 -0
  41. package/clinkx-workflows/dist/council-execution-policy.d.ts +68 -0
  42. package/clinkx-workflows/dist/council-execution-policy.js +110 -0
  43. package/clinkx-workflows/dist/council-execution-policy.js.map +1 -0
  44. package/clinkx-workflows/dist/council-expander.d.ts +10 -9
  45. package/clinkx-workflows/dist/council-expander.js +20 -10
  46. package/clinkx-workflows/dist/council-expander.js.map +1 -1
  47. package/clinkx-workflows/dist/dashboard/activity-contract.d.ts +5718 -0
  48. package/clinkx-workflows/dist/dashboard/activity-contract.js +157 -0
  49. package/clinkx-workflows/dist/dashboard/activity-contract.js.map +1 -0
  50. package/clinkx-workflows/dist/dashboard/activity-lease.d.ts +25 -0
  51. package/clinkx-workflows/dist/dashboard/activity-lease.js +34 -0
  52. package/clinkx-workflows/dist/dashboard/activity-lease.js.map +1 -0
  53. package/clinkx-workflows/dist/dashboard/activity-reader.d.ts +90 -0
  54. package/clinkx-workflows/dist/dashboard/activity-reader.js +493 -0
  55. package/clinkx-workflows/dist/dashboard/activity-reader.js.map +1 -0
  56. package/clinkx-workflows/dist/dashboard/api-routes.d.ts +40 -0
  57. package/clinkx-workflows/dist/dashboard/api-routes.js +1155 -0
  58. package/clinkx-workflows/dist/dashboard/api-routes.js.map +1 -0
  59. package/clinkx-workflows/dist/dashboard/artifact-index.d.ts +37 -0
  60. package/clinkx-workflows/dist/dashboard/artifact-index.js +145 -0
  61. package/clinkx-workflows/dist/dashboard/artifact-index.js.map +1 -0
  62. package/clinkx-workflows/dist/dashboard/auth/challenge-store.d.ts +31 -0
  63. package/clinkx-workflows/dist/dashboard/auth/challenge-store.js +65 -0
  64. package/clinkx-workflows/dist/dashboard/auth/challenge-store.js.map +1 -0
  65. package/clinkx-workflows/dist/dashboard/auth/controller.d.ts +26 -0
  66. package/clinkx-workflows/dist/dashboard/auth/controller.js +596 -0
  67. package/clinkx-workflows/dist/dashboard/auth/controller.js.map +1 -0
  68. package/clinkx-workflows/dist/dashboard/auth/credential-store.d.ts +60 -0
  69. package/clinkx-workflows/dist/dashboard/auth/credential-store.js +776 -0
  70. package/clinkx-workflows/dist/dashboard/auth/credential-store.js.map +1 -0
  71. package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.d.ts +9 -0
  72. package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js +44 -0
  73. package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js.map +1 -0
  74. package/clinkx-workflows/dist/dashboard/auth/session-store.d.ts +17 -0
  75. package/clinkx-workflows/dist/dashboard/auth/session-store.js +77 -0
  76. package/clinkx-workflows/dist/dashboard/auth/session-store.js.map +1 -0
  77. package/clinkx-workflows/dist/dashboard/auth/webauthn-service.d.ts +25 -0
  78. package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js +71 -0
  79. package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js.map +1 -0
  80. package/clinkx-workflows/dist/dashboard/context-builder-invocation-contract.d.ts +3865 -0
  81. package/clinkx-workflows/dist/dashboard/context-builder-invocation-contract.js +69 -0
  82. package/clinkx-workflows/dist/dashboard/context-builder-invocation-contract.js.map +1 -0
  83. package/clinkx-workflows/dist/dashboard/context-run-liveness.d.ts +37 -0
  84. package/clinkx-workflows/dist/dashboard/context-run-liveness.js +49 -0
  85. package/clinkx-workflows/dist/dashboard/context-run-liveness.js.map +1 -0
  86. package/clinkx-workflows/dist/dashboard/context-run-reader.d.ts +256 -0
  87. package/clinkx-workflows/dist/dashboard/context-run-reader.js +1301 -0
  88. package/clinkx-workflows/dist/dashboard/context-run-reader.js.map +1 -0
  89. package/clinkx-workflows/dist/dashboard/contracts.d.ts +28483 -0
  90. package/clinkx-workflows/dist/dashboard/contracts.js +1284 -0
  91. package/clinkx-workflows/dist/dashboard/contracts.js.map +1 -0
  92. package/clinkx-workflows/dist/dashboard/generation.d.ts +14 -0
  93. package/clinkx-workflows/dist/dashboard/generation.js +41 -0
  94. package/clinkx-workflows/dist/dashboard/generation.js.map +1 -0
  95. package/clinkx-workflows/dist/dashboard/index.d.ts +32 -0
  96. package/clinkx-workflows/dist/dashboard/index.js +20 -0
  97. package/clinkx-workflows/dist/dashboard/index.js.map +1 -0
  98. package/clinkx-workflows/dist/dashboard/invocation-contract.d.ts +786 -0
  99. package/clinkx-workflows/dist/dashboard/invocation-contract.js +201 -0
  100. package/clinkx-workflows/dist/dashboard/invocation-contract.js.map +1 -0
  101. package/clinkx-workflows/dist/dashboard/lazy-content.d.ts +114 -0
  102. package/clinkx-workflows/dist/dashboard/lazy-content.js +799 -0
  103. package/clinkx-workflows/dist/dashboard/lazy-content.js.map +1 -0
  104. package/clinkx-workflows/dist/dashboard/native-transcript/contract.d.ts +90 -0
  105. package/clinkx-workflows/dist/dashboard/native-transcript/contract.js +31 -0
  106. package/clinkx-workflows/dist/dashboard/native-transcript/contract.js.map +1 -0
  107. package/clinkx-workflows/dist/dashboard/native-transcript/projection.d.ts +12 -0
  108. package/clinkx-workflows/dist/dashboard/native-transcript/projection.js +286 -0
  109. package/clinkx-workflows/dist/dashboard/native-transcript/projection.js.map +1 -0
  110. package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +446 -0
  111. package/clinkx-workflows/dist/dashboard/progress-report-contract.js +221 -0
  112. package/clinkx-workflows/dist/dashboard/progress-report-contract.js.map +1 -0
  113. package/clinkx-workflows/dist/dashboard/progress-report-reader.d.ts +50 -0
  114. package/clinkx-workflows/dist/dashboard/progress-report-reader.js +529 -0
  115. package/clinkx-workflows/dist/dashboard/progress-report-reader.js.map +1 -0
  116. package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.d.ts +89 -0
  117. package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js +71 -0
  118. package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js.map +1 -0
  119. package/clinkx-workflows/dist/dashboard/progress-report-status-store.d.ts +29 -0
  120. package/clinkx-workflows/dist/dashboard/progress-report-status-store.js +111 -0
  121. package/clinkx-workflows/dist/dashboard/progress-report-status-store.js.map +1 -0
  122. package/clinkx-workflows/dist/dashboard/prompt-builder-library-contract.d.ts +194 -0
  123. package/clinkx-workflows/dist/dashboard/prompt-builder-library-contract.js +89 -0
  124. package/clinkx-workflows/dist/dashboard/prompt-builder-library-contract.js.map +1 -0
  125. package/clinkx-workflows/dist/dashboard/prompt-builder-library-store.d.ts +26 -0
  126. package/clinkx-workflows/dist/dashboard/prompt-builder-library-store.js +102 -0
  127. package/clinkx-workflows/dist/dashboard/prompt-builder-library-store.js.map +1 -0
  128. package/clinkx-workflows/dist/dashboard/read-model.d.ts +86 -0
  129. package/clinkx-workflows/dist/dashboard/read-model.js +440 -0
  130. package/clinkx-workflows/dist/dashboard/read-model.js.map +1 -0
  131. package/clinkx-workflows/dist/dashboard/request-admission.d.ts +31 -0
  132. package/clinkx-workflows/dist/dashboard/request-admission.js +130 -0
  133. package/clinkx-workflows/dist/dashboard/request-admission.js.map +1 -0
  134. package/clinkx-workflows/dist/dashboard/scanner.d.ts +78 -0
  135. package/clinkx-workflows/dist/dashboard/scanner.js +1154 -0
  136. package/clinkx-workflows/dist/dashboard/scanner.js.map +1 -0
  137. package/clinkx-workflows/dist/dashboard/server-factory.d.ts +63 -0
  138. package/clinkx-workflows/dist/dashboard/server-factory.js +483 -0
  139. package/clinkx-workflows/dist/dashboard/server-factory.js.map +1 -0
  140. package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +2778 -0
  141. package/clinkx-workflows/dist/dashboard/session-log-contract.js +506 -0
  142. package/clinkx-workflows/dist/dashboard/session-log-contract.js.map +1 -0
  143. package/clinkx-workflows/dist/dashboard/session-log-identity.d.ts +21 -0
  144. package/clinkx-workflows/dist/dashboard/session-log-identity.js +101 -0
  145. package/clinkx-workflows/dist/dashboard/session-log-identity.js.map +1 -0
  146. package/clinkx-workflows/dist/dashboard/session-log-journal.d.ts +43 -0
  147. package/clinkx-workflows/dist/dashboard/session-log-journal.js +529 -0
  148. package/clinkx-workflows/dist/dashboard/session-log-journal.js.map +1 -0
  149. package/clinkx-workflows/dist/dashboard/session-log-reader.d.ts +61 -0
  150. package/clinkx-workflows/dist/dashboard/session-log-reader.js +378 -0
  151. package/clinkx-workflows/dist/dashboard/session-log-reader.js.map +1 -0
  152. package/clinkx-workflows/dist/dashboard/session-log-redaction.d.ts +14 -0
  153. package/clinkx-workflows/dist/dashboard/session-log-redaction.js +1101 -0
  154. package/clinkx-workflows/dist/dashboard/session-log-redaction.js.map +1 -0
  155. package/clinkx-workflows/dist/dashboard/session-log-retention.d.ts +23 -0
  156. package/clinkx-workflows/dist/dashboard/session-log-retention.js +212 -0
  157. package/clinkx-workflows/dist/dashboard/session-log-retention.js.map +1 -0
  158. package/clinkx-workflows/dist/dashboard/static-responses.d.ts +10 -0
  159. package/clinkx-workflows/dist/dashboard/static-responses.js +94 -0
  160. package/clinkx-workflows/dist/dashboard/static-responses.js.map +1 -0
  161. package/clinkx-workflows/dist/dashboard/worker-lock-observer.d.ts +28 -0
  162. package/clinkx-workflows/dist/dashboard/worker-lock-observer.js +241 -0
  163. package/clinkx-workflows/dist/dashboard/worker-lock-observer.js.map +1 -0
  164. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  165. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  166. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  167. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  168. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
  169. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
  170. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
  171. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
  172. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
  173. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
  174. package/clinkx-workflows/dist/dashboard-ui/assets/index-JPHQVtn9.js +106 -0
  175. package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  176. package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  177. package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  178. package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  179. package/clinkx-workflows/dist/dashboard-ui/assets/style-DOMHk-j6.css +1 -0
  180. package/clinkx-workflows/dist/dashboard-ui/contracts/council-plan-review-input-v1.json +158 -0
  181. package/clinkx-workflows/dist/dashboard-ui/index.html +15 -0
  182. package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Mono-OFL.txt +93 -0
  183. package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Sans-OFL.txt +93 -0
  184. package/clinkx-workflows/dist/dashboard-ui/licenses/JetBrains-Mono-OFL.txt +93 -0
  185. package/clinkx-workflows/dist/dashboard-ui/licenses/NOTICE.md +32 -0
  186. package/clinkx-workflows/dist/dashboard-ui/theme-init.js +8 -0
  187. package/clinkx-workflows/dist/definition-normalizer.d.ts +19 -0
  188. package/clinkx-workflows/dist/definition-normalizer.js.map +1 -1
  189. package/clinkx-workflows/dist/delegate-finalizer-policy.d.ts +26 -0
  190. package/clinkx-workflows/dist/delegate-finalizer-policy.js +72 -0
  191. package/clinkx-workflows/dist/delegate-finalizer-policy.js.map +1 -0
  192. package/clinkx-workflows/dist/delegate-signature.d.ts +14 -0
  193. package/clinkx-workflows/dist/delegate-signature.js +14 -0
  194. package/clinkx-workflows/dist/delegate-signature.js.map +1 -0
  195. package/clinkx-workflows/dist/delegate-validate.d.ts +108 -0
  196. package/clinkx-workflows/dist/delegate-validate.js +148 -0
  197. package/clinkx-workflows/dist/delegate-validate.js.map +1 -0
  198. package/clinkx-workflows/dist/engine.d.ts +251 -0
  199. package/clinkx-workflows/dist/engine.js +1342 -92
  200. package/clinkx-workflows/dist/engine.js.map +1 -1
  201. package/clinkx-workflows/dist/errors.d.ts +24 -2
  202. package/clinkx-workflows/dist/errors.js +30 -2
  203. package/clinkx-workflows/dist/errors.js.map +1 -1
  204. package/clinkx-workflows/dist/fidelity.d.ts +47 -1
  205. package/clinkx-workflows/dist/fidelity.js +54 -1
  206. package/clinkx-workflows/dist/fidelity.js.map +1 -1
  207. package/clinkx-workflows/dist/fingerprint.d.ts +25 -7
  208. package/clinkx-workflows/dist/fingerprint.js +33 -10
  209. package/clinkx-workflows/dist/fingerprint.js.map +1 -1
  210. package/clinkx-workflows/dist/index.d.ts +19 -0
  211. package/clinkx-workflows/dist/index.js +68 -1
  212. package/clinkx-workflows/dist/index.js.map +1 -1
  213. package/clinkx-workflows/dist/loader.d.ts +9 -3
  214. package/clinkx-workflows/dist/loader.js +92 -21
  215. package/clinkx-workflows/dist/loader.js.map +1 -1
  216. package/clinkx-workflows/dist/logger.d.ts +1 -1
  217. package/clinkx-workflows/dist/logger.js +17 -3
  218. package/clinkx-workflows/dist/logger.js.map +1 -1
  219. package/clinkx-workflows/dist/monotonic-clock.d.ts +19 -0
  220. package/clinkx-workflows/dist/monotonic-clock.js +22 -0
  221. package/clinkx-workflows/dist/monotonic-clock.js.map +1 -0
  222. package/clinkx-workflows/dist/plan-review/admission.d.ts +160 -0
  223. package/clinkx-workflows/dist/plan-review/admission.js +290 -0
  224. package/clinkx-workflows/dist/plan-review/admission.js.map +1 -0
  225. package/clinkx-workflows/dist/plan-review/context-policy.d.ts +55 -0
  226. package/clinkx-workflows/dist/plan-review/context-policy.js +146 -0
  227. package/clinkx-workflows/dist/plan-review/context-policy.js.map +1 -0
  228. package/clinkx-workflows/dist/plan-review/contract.d.ts +763 -0
  229. package/clinkx-workflows/dist/plan-review/contract.js +289 -0
  230. package/clinkx-workflows/dist/plan-review/contract.js.map +1 -0
  231. package/clinkx-workflows/dist/plan-review/digest.d.ts +68 -0
  232. package/clinkx-workflows/dist/plan-review/digest.js +241 -0
  233. package/clinkx-workflows/dist/plan-review/digest.js.map +1 -0
  234. package/clinkx-workflows/dist/plan-review/discovery.d.ts +45 -0
  235. package/clinkx-workflows/dist/plan-review/discovery.js +36 -0
  236. package/clinkx-workflows/dist/plan-review/discovery.js.map +1 -0
  237. package/clinkx-workflows/dist/plan-review/execution-contract.d.ts +298 -0
  238. package/clinkx-workflows/dist/plan-review/execution-contract.js +194 -0
  239. package/clinkx-workflows/dist/plan-review/execution-contract.js.map +1 -0
  240. package/clinkx-workflows/dist/plan-review/expander.d.ts +48 -0
  241. package/clinkx-workflows/dist/plan-review/expander.js +243 -0
  242. package/clinkx-workflows/dist/plan-review/expander.js.map +1 -0
  243. package/clinkx-workflows/dist/plan-review/projector.d.ts +126 -0
  244. package/clinkx-workflows/dist/plan-review/projector.js +437 -0
  245. package/clinkx-workflows/dist/plan-review/projector.js.map +1 -0
  246. package/clinkx-workflows/dist/plan-review/publication.d.ts +95 -0
  247. package/clinkx-workflows/dist/plan-review/publication.js +182 -0
  248. package/clinkx-workflows/dist/plan-review/publication.js.map +1 -0
  249. package/clinkx-workflows/dist/plan-review/ranking-reducer.d.ts +34 -0
  250. package/clinkx-workflows/dist/plan-review/ranking-reducer.js +139 -0
  251. package/clinkx-workflows/dist/plan-review/ranking-reducer.js.map +1 -0
  252. package/clinkx-workflows/dist/plan-review/resume.d.ts +38 -0
  253. package/clinkx-workflows/dist/plan-review/resume.js +122 -0
  254. package/clinkx-workflows/dist/plan-review/resume.js.map +1 -0
  255. package/clinkx-workflows/dist/plan-review/rubric.d.ts +7 -0
  256. package/clinkx-workflows/dist/plan-review/rubric.js +24 -0
  257. package/clinkx-workflows/dist/plan-review/rubric.js.map +1 -0
  258. package/clinkx-workflows/dist/plan-review/run-state.d.ts +398 -0
  259. package/clinkx-workflows/dist/plan-review/run-state.js +183 -0
  260. package/clinkx-workflows/dist/plan-review/run-state.js.map +1 -0
  261. package/clinkx-workflows/dist/plan-review/runtime-policy.d.ts +74 -0
  262. package/clinkx-workflows/dist/plan-review/runtime-policy.js +186 -0
  263. package/clinkx-workflows/dist/plan-review/runtime-policy.js.map +1 -0
  264. package/clinkx-workflows/dist/plan-review/snapshot.d.ts +81 -0
  265. package/clinkx-workflows/dist/plan-review/snapshot.js +170 -0
  266. package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -0
  267. package/clinkx-workflows/dist/plan-review/stage-error.d.ts +19 -0
  268. package/clinkx-workflows/dist/plan-review/stage-error.js +20 -0
  269. package/clinkx-workflows/dist/plan-review/stage-error.js.map +1 -0
  270. package/clinkx-workflows/dist/post-processors/index.d.ts +20 -0
  271. package/clinkx-workflows/dist/post-processors/index.js +21 -0
  272. package/clinkx-workflows/dist/post-processors/index.js.map +1 -0
  273. package/clinkx-workflows/dist/prompt-budget.d.ts +7 -0
  274. package/clinkx-workflows/dist/prompt-budget.js +7 -1
  275. package/clinkx-workflows/dist/prompt-budget.js.map +1 -1
  276. package/clinkx-workflows/dist/reducers/index.js +2 -0
  277. package/clinkx-workflows/dist/reducers/index.js.map +1 -1
  278. package/clinkx-workflows/dist/roster-contract.d.ts +889 -0
  279. package/clinkx-workflows/dist/roster-contract.js +180 -0
  280. package/clinkx-workflows/dist/roster-contract.js.map +1 -0
  281. package/clinkx-workflows/dist/rosters.d.ts +14 -0
  282. package/clinkx-workflows/dist/rosters.js +169 -0
  283. package/clinkx-workflows/dist/rosters.js.map +1 -0
  284. package/clinkx-workflows/dist/run-health.d.ts +7 -0
  285. package/clinkx-workflows/dist/run-health.js +25 -0
  286. package/clinkx-workflows/dist/run-health.js.map +1 -0
  287. package/clinkx-workflows/dist/run-lock-heartbeat.d.ts +2 -0
  288. package/clinkx-workflows/dist/run-lock-heartbeat.js +3 -0
  289. package/clinkx-workflows/dist/run-lock-heartbeat.js.map +1 -0
  290. package/clinkx-workflows/dist/run-summary/cards/council-plan-review.d.ts +34 -0
  291. package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js +74 -0
  292. package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js.map +1 -0
  293. package/clinkx-workflows/dist/run-summary/cards/index.js +5 -0
  294. package/clinkx-workflows/dist/run-summary/cards/index.js.map +1 -1
  295. package/clinkx-workflows/dist/run-summary.d.ts +13 -0
  296. package/clinkx-workflows/dist/run-summary.js +29 -1
  297. package/clinkx-workflows/dist/run-summary.js.map +1 -1
  298. package/clinkx-workflows/dist/schema.d.ts +140 -21
  299. package/clinkx-workflows/dist/schema.js +34 -1
  300. package/clinkx-workflows/dist/schema.js.map +1 -1
  301. package/clinkx-workflows/dist/seed-terms.d.ts +30 -0
  302. package/clinkx-workflows/dist/seed-terms.js +176 -0
  303. package/clinkx-workflows/dist/seed-terms.js.map +1 -0
  304. package/clinkx-workflows/dist/server.d.ts +5 -2
  305. package/clinkx-workflows/dist/server.js +84 -52
  306. package/clinkx-workflows/dist/server.js.map +1 -1
  307. package/clinkx-workflows/dist/shutdown.d.ts +29 -18
  308. package/clinkx-workflows/dist/shutdown.js +90 -64
  309. package/clinkx-workflows/dist/shutdown.js.map +1 -1
  310. package/clinkx-workflows/dist/state-schema.d.ts +61 -0
  311. package/clinkx-workflows/dist/state.d.ts +175 -3
  312. package/clinkx-workflows/dist/state.js +1398 -44
  313. package/clinkx-workflows/dist/state.js.map +1 -1
  314. package/clinkx-workflows/dist/stdio-watchdog.d.ts +52 -0
  315. package/clinkx-workflows/dist/stdio-watchdog.js +212 -0
  316. package/clinkx-workflows/dist/stdio-watchdog.js.map +1 -0
  317. package/clinkx-workflows/dist/transport.d.ts +15 -0
  318. package/clinkx-workflows/dist/transport.js +19 -10
  319. package/clinkx-workflows/dist/transport.js.map +1 -1
  320. package/clinkx-workflows/dist/types.d.ts +20 -2
  321. package/clinkx-workflows/dist/validators/council.d.ts +334 -101
  322. package/clinkx-workflows/dist/validators/council.js +52 -13
  323. package/clinkx-workflows/dist/validators/council.js.map +1 -1
  324. package/clinkx-workflows/dist/validators/index.d.ts +1 -0
  325. package/clinkx-workflows/dist/validators/index.js +3 -0
  326. package/clinkx-workflows/dist/validators/index.js.map +1 -1
  327. package/clinkx-workflows/dist/validators/plan-review.d.ts +398 -0
  328. package/clinkx-workflows/dist/validators/plan-review.js +316 -0
  329. package/clinkx-workflows/dist/validators/plan-review.js.map +1 -0
  330. package/clinkx-workflows/dist/workflow-receipt.js +188 -4
  331. package/clinkx-workflows/dist/workflow-receipt.js.map +1 -1
  332. package/clinkx-workflows/dist/workflow-tools.d.ts +118 -3
  333. package/clinkx-workflows/dist/workflow-tools.js +2110 -175
  334. package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
  335. package/clinkx-workflows/dist/workspace-signature.d.ts +16 -0
  336. package/clinkx-workflows/dist/workspace-signature.js +388 -0
  337. package/clinkx-workflows/dist/workspace-signature.js.map +1 -0
  338. package/clinkx-workflows/templates/council/answer-chairman.txt +3 -0
  339. package/clinkx-workflows/templates/council/answer-cross-reviewer.txt +3 -0
  340. package/clinkx-workflows/templates/council/answer-specialist.txt +5 -1
  341. package/clinkx-workflows/templates/council/chairman.txt +3 -0
  342. package/clinkx-workflows/templates/council/code-review-chairman.txt +16 -0
  343. package/clinkx-workflows/templates/council/code-review-cross-reviewer.txt +7 -1
  344. package/clinkx-workflows/templates/council/code-review-reviewer.txt +22 -3
  345. package/clinkx-workflows/templates/council/debug-chairman.txt +3 -0
  346. package/clinkx-workflows/templates/council/debug-cross-reviewer.txt +3 -0
  347. package/clinkx-workflows/templates/council/debug-debugger.txt +5 -1
  348. package/clinkx-workflows/templates/council/discover-analyst.txt +5 -1
  349. package/clinkx-workflows/templates/council/discover-chairman.txt +3 -0
  350. package/clinkx-workflows/templates/council/discover-cross-reviewer.txt +3 -0
  351. package/clinkx-workflows/templates/council/member.txt +5 -1
  352. package/clinkx-workflows/templates/council/plan-review-chairman.txt +71 -0
  353. package/clinkx-workflows/templates/council/plan-review-cross-reviewer.txt +54 -0
  354. package/clinkx-workflows/templates/council/plan-review-reviewer.txt +63 -0
  355. package/clinkx-workflows/templates/council/reviewer.txt +3 -0
  356. package/clinkx-workflows/templates/plan-review/chairman.txt +48 -0
  357. package/clinkx-workflows/templates/plan-review/cross-review.txt +52 -0
  358. package/clinkx-workflows/templates/plan-review/ranking.txt +16 -0
  359. package/clinkx-workflows/templates/plan-review/reviewer.txt +57 -0
  360. package/clinkx-workflows/workflows/council-answer.yaml +100 -8
  361. package/clinkx-workflows/workflows/council-code-review.yaml +106 -8
  362. package/clinkx-workflows/workflows/council-debug.yaml +100 -8
  363. package/clinkx-workflows/workflows/council-default.yaml +104 -8
  364. package/clinkx-workflows/workflows/council-discover.yaml +100 -8
  365. package/clinkx-workflows/workflows/council-plan-review.yaml +253 -0
  366. package/clinkx-workflows/workflows/plan-review-receipts.yaml +230 -0
  367. package/conf/adapters/agy.json +56 -0
  368. package/conf/adapters/claude.json +12 -0
  369. package/conf/adapters/codex-app-server.json +44 -0
  370. package/conf/adapters/codex.json +14 -2
  371. package/conf/adapters/glm.json +24 -3
  372. package/conf/adapters/grok.json +67 -0
  373. package/conf/adapters/hapi/agy.json +59 -0
  374. package/conf/adapters/hapi/claude.json +12 -0
  375. package/conf/adapters/hapi/codex.json +14 -2
  376. package/conf/adapters/hapi/glm.json +25 -4
  377. package/conf/rosters/default-council.json +21 -0
  378. package/dist/activity-journal.d.ts +56 -0
  379. package/dist/activity-journal.js +706 -0
  380. package/dist/activity-journal.js.map +1 -0
  381. package/dist/allowed-roots.d.ts +41 -0
  382. package/dist/allowed-roots.js +125 -3
  383. package/dist/allowed-roots.js.map +1 -1
  384. package/dist/codex/activity-session-log.d.ts +14 -0
  385. package/dist/codex/activity-session-log.js +206 -0
  386. package/dist/codex/activity-session-log.js.map +1 -0
  387. package/dist/codex/agent-tools.d.ts +23 -0
  388. package/dist/codex/agent-tools.js +1306 -0
  389. package/dist/codex/agent-tools.js.map +1 -0
  390. package/dist/codex/app-server-client.d.ts +79 -0
  391. package/dist/codex/app-server-client.js +593 -0
  392. package/dist/codex/app-server-client.js.map +1 -0
  393. package/dist/codex/app-server-registry.d.ts +407 -0
  394. package/dist/codex/app-server-registry.js +1493 -0
  395. package/dist/codex/app-server-registry.js.map +1 -0
  396. package/dist/codex/client-types.d.ts +115 -0
  397. package/dist/codex/client-types.js +2 -0
  398. package/dist/codex/client-types.js.map +1 -0
  399. package/dist/codex/protocol.d.ts +5375 -0
  400. package/dist/codex/protocol.js +614 -0
  401. package/dist/codex/protocol.js.map +1 -0
  402. package/dist/codex/session.d.ts +263 -0
  403. package/dist/codex/session.js +466 -0
  404. package/dist/codex/session.js.map +1 -0
  405. package/dist/config.d.ts +386 -23
  406. package/dist/config.js +184 -15
  407. package/dist/config.js.map +1 -1
  408. package/dist/context-builder/anchors.d.ts +1 -0
  409. package/dist/context-builder/anchors.js +3 -0
  410. package/dist/context-builder/anchors.js.map +1 -1
  411. package/dist/context-builder/bundle.d.ts +48 -2
  412. package/dist/context-builder/bundle.js +388 -2417
  413. package/dist/context-builder/bundle.js.map +1 -1
  414. package/dist/context-builder/codemap.d.ts +5 -0
  415. package/dist/context-builder/codemap.js +387 -13
  416. package/dist/context-builder/codemap.js.map +1 -1
  417. package/dist/context-builder/config.d.ts +1 -0
  418. package/dist/context-builder/config.js +12 -0
  419. package/dist/context-builder/config.js.map +1 -1
  420. package/dist/context-builder/context-run-catalog.d.ts +17 -0
  421. package/dist/context-builder/context-run-catalog.js +99 -0
  422. package/dist/context-builder/context-run-catalog.js.map +1 -0
  423. package/dist/context-builder/delegate-finalizer-effective.d.ts +33 -0
  424. package/dist/context-builder/delegate-finalizer-effective.js +82 -0
  425. package/dist/context-builder/delegate-finalizer-effective.js.map +1 -0
  426. package/dist/context-builder/delegate-packet.d.ts +55 -0
  427. package/dist/context-builder/delegate-packet.js +430 -74
  428. package/dist/context-builder/delegate-packet.js.map +1 -1
  429. package/dist/context-builder/delegate-reconstruction.d.ts +29 -0
  430. package/dist/context-builder/delegate-reconstruction.js +110 -41
  431. package/dist/context-builder/delegate-reconstruction.js.map +1 -1
  432. package/dist/context-builder/delegate-validation.d.ts +41 -1
  433. package/dist/context-builder/delegate-validation.js +237 -48
  434. package/dist/context-builder/delegate-validation.js.map +1 -1
  435. package/dist/context-builder/delegate.d.ts +11 -0
  436. package/dist/context-builder/delegate.js +210 -58
  437. package/dist/context-builder/delegate.js.map +1 -1
  438. package/dist/context-builder/diagnostics.d.ts +11 -2
  439. package/dist/context-builder/diagnostics.js +39 -6
  440. package/dist/context-builder/diagnostics.js.map +1 -1
  441. package/dist/context-builder/discovery-progress.d.ts +25 -0
  442. package/dist/context-builder/discovery-progress.js +64 -0
  443. package/dist/context-builder/discovery-progress.js.map +1 -0
  444. package/dist/context-builder/discovery-watchdog.d.ts +15 -0
  445. package/dist/context-builder/discovery-watchdog.js +39 -0
  446. package/dist/context-builder/discovery-watchdog.js.map +1 -0
  447. package/dist/context-builder/discovery.d.ts +36 -1
  448. package/dist/context-builder/discovery.js +584 -172
  449. package/dist/context-builder/discovery.js.map +1 -1
  450. package/dist/context-builder/external-gaps.d.ts +73 -0
  451. package/dist/context-builder/external-gaps.js +248 -0
  452. package/dist/context-builder/external-gaps.js.map +1 -0
  453. package/dist/context-builder/globs.d.ts +1 -0
  454. package/dist/context-builder/globs.js +25 -10
  455. package/dist/context-builder/globs.js.map +1 -1
  456. package/dist/context-builder/handler.d.ts +67 -2
  457. package/dist/context-builder/handler.js +1810 -2440
  458. package/dist/context-builder/handler.js.map +1 -1
  459. package/dist/context-builder/invocation-sidecar.d.ts +41 -0
  460. package/dist/context-builder/invocation-sidecar.js +189 -0
  461. package/dist/context-builder/invocation-sidecar.js.map +1 -0
  462. package/dist/context-builder/lifecycle-contract.d.ts +424 -0
  463. package/dist/context-builder/lifecycle-contract.js +523 -0
  464. package/dist/context-builder/lifecycle-contract.js.map +1 -0
  465. package/dist/context-builder/lifecycle-journal.d.ts +62 -0
  466. package/dist/context-builder/lifecycle-journal.js +88 -0
  467. package/dist/context-builder/lifecycle-journal.js.map +1 -0
  468. package/dist/context-builder/lifecycle-observer.d.ts +102 -0
  469. package/dist/context-builder/lifecycle-observer.js +258 -0
  470. package/dist/context-builder/lifecycle-observer.js.map +1 -0
  471. package/dist/context-builder/lifecycle-reconcile.d.ts +32 -0
  472. package/dist/context-builder/lifecycle-reconcile.js +191 -0
  473. package/dist/context-builder/lifecycle-reconcile.js.map +1 -0
  474. package/dist/context-builder/lifecycle-recovery.d.ts +2 -0
  475. package/dist/context-builder/lifecycle-recovery.js +14 -0
  476. package/dist/context-builder/lifecycle-recovery.js.map +1 -0
  477. package/dist/context-builder/mutation-lock.d.ts +32 -0
  478. package/dist/context-builder/mutation-lock.js +321 -0
  479. package/dist/context-builder/mutation-lock.js.map +1 -0
  480. package/dist/context-builder/path-signals.js +9 -5
  481. package/dist/context-builder/path-signals.js.map +1 -1
  482. package/dist/context-builder/progress.d.ts +3 -1
  483. package/dist/context-builder/progress.js +23 -0
  484. package/dist/context-builder/progress.js.map +1 -1
  485. package/dist/context-builder/receipt.d.ts +6 -4
  486. package/dist/context-builder/receipt.js +12 -1
  487. package/dist/context-builder/receipt.js.map +1 -1
  488. package/dist/context-builder/refine-handler.d.ts +14 -0
  489. package/dist/context-builder/refine-handler.js +790 -0
  490. package/dist/context-builder/refine-handler.js.map +1 -0
  491. package/dist/context-builder/review-coverage.d.ts +116 -0
  492. package/dist/context-builder/review-coverage.js +544 -0
  493. package/dist/context-builder/review-coverage.js.map +1 -0
  494. package/dist/context-builder/schema.d.ts +315 -2
  495. package/dist/context-builder/schema.js +133 -7
  496. package/dist/context-builder/schema.js.map +1 -1
  497. package/dist/context-builder/secrets.d.ts +59 -0
  498. package/dist/context-builder/secrets.js +2255 -44
  499. package/dist/context-builder/secrets.js.map +1 -1
  500. package/dist/context-builder/selection.d.ts +7 -3
  501. package/dist/context-builder/selection.js +200 -738
  502. package/dist/context-builder/selection.js.map +1 -1
  503. package/dist/context-builder/session-log-identity.d.ts +1 -0
  504. package/dist/context-builder/session-log-identity.js +66 -0
  505. package/dist/context-builder/session-log-identity.js.map +1 -0
  506. package/dist/context-builder/slice-range-math.d.ts +16 -0
  507. package/dist/context-builder/slice-range-math.js +137 -0
  508. package/dist/context-builder/slice-range-math.js.map +1 -0
  509. package/dist/context-builder/status.d.ts +23 -2
  510. package/dist/context-builder/status.js +60 -4
  511. package/dist/context-builder/status.js.map +1 -1
  512. package/dist/context-builder/storage.d.ts +59 -2
  513. package/dist/context-builder/storage.js +500 -168
  514. package/dist/context-builder/storage.js.map +1 -1
  515. package/dist/context-builder/token-estimate.d.ts +13 -2
  516. package/dist/context-builder/token-estimate.js +77 -4
  517. package/dist/context-builder/token-estimate.js.map +1 -1
  518. package/dist/context-builder/versions.d.ts +44 -0
  519. package/dist/context-builder/versions.js +45 -0
  520. package/dist/context-builder/versions.js.map +1 -0
  521. package/dist/context-builder/workflow-runner.d.ts +75 -0
  522. package/dist/context-builder/workflow-runner.js +1241 -0
  523. package/dist/context-builder/workflow-runner.js.map +1 -0
  524. package/dist/context-builder/write-watchdog.d.ts +14 -0
  525. package/dist/context-builder/write-watchdog.js +38 -0
  526. package/dist/context-builder/write-watchdog.js.map +1 -0
  527. package/dist/dashboard-adapter-catalog.d.ts +9 -0
  528. package/dist/dashboard-adapter-catalog.js +53 -0
  529. package/dist/dashboard-adapter-catalog.js.map +1 -0
  530. package/dist/dashboard-cli.d.ts +81 -0
  531. package/dist/dashboard-cli.js +623 -0
  532. package/dist/dashboard-cli.js.map +1 -0
  533. package/dist/dashboard-companion/client.d.ts +37 -0
  534. package/dist/dashboard-companion/client.js +229 -0
  535. package/dist/dashboard-companion/client.js.map +1 -0
  536. package/dist/dashboard-companion/config.d.ts +8 -0
  537. package/dist/dashboard-companion/config.js +52 -0
  538. package/dist/dashboard-companion/config.js.map +1 -0
  539. package/dist/dashboard-companion/http-proxy.d.ts +10 -0
  540. package/dist/dashboard-companion/http-proxy.js +234 -0
  541. package/dist/dashboard-companion/http-proxy.js.map +1 -0
  542. package/dist/dashboard-companion/protocol.d.ts +80 -0
  543. package/dist/dashboard-companion/protocol.js +458 -0
  544. package/dist/dashboard-companion/protocol.js.map +1 -0
  545. package/dist/dashboard-companion/standalone-assets.d.ts +12 -0
  546. package/dist/dashboard-companion/standalone-assets.js +72 -0
  547. package/dist/dashboard-companion/standalone-assets.js.map +1 -0
  548. package/dist/dashboard-companion/standalone-entry.d.ts +1 -0
  549. package/dist/dashboard-companion/standalone-entry.js +17 -0
  550. package/dist/dashboard-companion/standalone-entry.js.map +1 -0
  551. package/dist/dashboard-gateway/config.d.ts +9 -0
  552. package/dist/dashboard-gateway/config.js +44 -0
  553. package/dist/dashboard-gateway/config.js.map +1 -0
  554. package/dist/dashboard-gateway/index.d.ts +12 -0
  555. package/dist/dashboard-gateway/index.js +786 -0
  556. package/dist/dashboard-gateway/index.js.map +1 -0
  557. package/dist/dashboard-gateway/main.d.ts +1 -0
  558. package/dist/dashboard-gateway/main.js +25 -0
  559. package/dist/dashboard-gateway/main.js.map +1 -0
  560. package/dist/dashboard-pairing-token.d.ts +1 -0
  561. package/dist/dashboard-pairing-token.js +5 -0
  562. package/dist/dashboard-pairing-token.js.map +1 -0
  563. package/dist/elaris/client.d.ts +73 -0
  564. package/dist/elaris/client.js +825 -0
  565. package/dist/elaris/client.js.map +1 -0
  566. package/dist/elaris/config.d.ts +18 -0
  567. package/dist/elaris/config.js +75 -0
  568. package/dist/elaris/config.js.map +1 -0
  569. package/dist/elaris/errors.d.ts +41 -0
  570. package/dist/elaris/errors.js +205 -0
  571. package/dist/elaris/errors.js.map +1 -0
  572. package/dist/elaris/github-repo.d.ts +18 -0
  573. package/dist/elaris/github-repo.js +89 -0
  574. package/dist/elaris/github-repo.js.map +1 -0
  575. package/dist/elaris/index.d.ts +10 -0
  576. package/dist/elaris/index.js +11 -0
  577. package/dist/elaris/index.js.map +1 -0
  578. package/dist/elaris/redact.d.ts +89 -0
  579. package/dist/elaris/redact.js +423 -0
  580. package/dist/elaris/redact.js.map +1 -0
  581. package/dist/elaris/run-id.d.ts +5 -0
  582. package/dist/elaris/run-id.js +20 -0
  583. package/dist/elaris/run-id.js.map +1 -0
  584. package/dist/elaris/status.d.ts +45 -0
  585. package/dist/elaris/status.js +122 -0
  586. package/dist/elaris/status.js.map +1 -0
  587. package/dist/elaris/tool-schemas.d.ts +314 -0
  588. package/dist/elaris/tool-schemas.js +208 -0
  589. package/dist/elaris/tool-schemas.js.map +1 -0
  590. package/dist/elaris/tools.d.ts +73 -0
  591. package/dist/elaris/tools.js +1065 -0
  592. package/dist/elaris/tools.js.map +1 -0
  593. package/dist/elaris/types.d.ts +1541 -0
  594. package/dist/elaris/types.js +252 -0
  595. package/dist/elaris/types.js.map +1 -0
  596. package/dist/errors.d.ts +16 -0
  597. package/dist/errors.js +19 -0
  598. package/dist/errors.js.map +1 -1
  599. package/dist/handler.d.ts +4 -0
  600. package/dist/handler.js +15 -2
  601. package/dist/handler.js.map +1 -1
  602. package/dist/index.d.ts +20 -2
  603. package/dist/index.js +154 -6
  604. package/dist/index.js.map +1 -1
  605. package/dist/local-clink-backend.d.ts +3 -0
  606. package/dist/local-clink-backend.js +4 -0
  607. package/dist/local-clink-backend.js.map +1 -1
  608. package/dist/logger.d.ts +1 -1
  609. package/dist/logger.js +18 -3
  610. package/dist/logger.js.map +1 -1
  611. package/dist/package-info.d.ts +2 -0
  612. package/dist/package-info.js +18 -0
  613. package/dist/package-info.js.map +1 -0
  614. package/dist/parsers/agy-stream-json.d.ts +14 -0
  615. package/dist/parsers/agy-stream-json.js +172 -0
  616. package/dist/parsers/agy-stream-json.js.map +1 -0
  617. package/dist/parsers/codex-jsonl.js +48 -3
  618. package/dist/parsers/codex-jsonl.js.map +1 -1
  619. package/dist/parsers/extract.d.ts +10 -1
  620. package/dist/parsers/extract.js +16 -4
  621. package/dist/parsers/extract.js.map +1 -1
  622. package/dist/parsers/observed-invocation.d.ts +20 -0
  623. package/dist/parsers/observed-invocation.js +42 -0
  624. package/dist/parsers/observed-invocation.js.map +1 -0
  625. package/dist/pipeline.d.ts +17 -0
  626. package/dist/pipeline.js +181 -10
  627. package/dist/pipeline.js.map +1 -1
  628. package/dist/progress-report/lock.d.ts +74 -0
  629. package/dist/progress-report/lock.js +343 -0
  630. package/dist/progress-report/lock.js.map +1 -0
  631. package/dist/progress-report/schema.d.ts +808 -0
  632. package/dist/progress-report/schema.js +119 -0
  633. package/dist/progress-report/schema.js.map +1 -0
  634. package/dist/progress-report/store.d.ts +66 -0
  635. package/dist/progress-report/store.js +766 -0
  636. package/dist/progress-report/store.js.map +1 -0
  637. package/dist/progress-report/tools.d.ts +20 -0
  638. package/dist/progress-report/tools.js +141 -0
  639. package/dist/progress-report/tools.js.map +1 -0
  640. package/dist/prompt-mode.d.ts +1 -1
  641. package/dist/prompt-mode.js +7 -2
  642. package/dist/prompt-mode.js.map +1 -1
  643. package/dist/run-dir.d.ts +24 -0
  644. package/dist/run-dir.js +201 -2
  645. package/dist/run-dir.js.map +1 -1
  646. package/dist/runner.d.ts +20 -0
  647. package/dist/runner.js +192 -16
  648. package/dist/runner.js.map +1 -1
  649. package/dist/safety.d.ts +54 -4
  650. package/dist/safety.js +186 -5
  651. package/dist/safety.js.map +1 -1
  652. package/dist/schema.d.ts +15 -7
  653. package/dist/schema.js +20 -0
  654. package/dist/schema.js.map +1 -1
  655. package/dist/server.d.ts +7 -1
  656. package/dist/server.js +451 -23
  657. package/dist/server.js.map +1 -1
  658. package/dist/session-log-stream.d.ts +18 -0
  659. package/dist/session-log-stream.js +566 -0
  660. package/dist/session-log-stream.js.map +1 -0
  661. package/dist/stdio-activity.d.ts +28 -0
  662. package/dist/stdio-activity.js +72 -0
  663. package/dist/stdio-activity.js.map +1 -0
  664. package/package.json +47 -5
  665. package/conf/adapters/gemini.json +0 -44
  666. package/conf/adapters/hapi/gemini.json +0 -47
  667. package/dist/parsers/gemini-json.d.ts +0 -2
  668. package/dist/parsers/gemini-json.js +0 -72
  669. package/dist/parsers/gemini-json.js.map +0 -1
@@ -3,7 +3,18 @@ import { buildFileCodemap } from "./codemap.js";
3
3
  import { directoryDistance, genericPathKind, isTestPath, normalizedPathStem, } from "./path-signals.js";
4
4
  import { estimateContextBuilderTokensFromUtf8Bytes } from "./token-estimate.js";
5
5
  export function selectContextBuilderFinalContext(input) {
6
- const pending = buildPendingSelections(input.slices, input.search, input.task ?? "", input.budget);
6
+ const rankedPending = buildPendingSelections(input.slices, input.search, input.task ?? "", input.budget);
7
+ const obligationRanges = input.coverage_policy?.id === "review_deep_v1"
8
+ ? buildObligationRangeIndex(input.review_obligations)
9
+ : new Map();
10
+ const pending = reserveRequiredCoverageCandidates({
11
+ pending: rankedPending,
12
+ budget: input.budget,
13
+ policy: input.coverage_policy,
14
+ evidenceClassesByCandidate: input.evidence_classes_by_candidate,
15
+ obligations: input.review_obligations,
16
+ obligationRanges,
17
+ });
7
18
  const selected = [];
8
19
  const omissions = [];
9
20
  const summaryFiles = [];
@@ -12,16 +23,6 @@ export function selectContextBuilderFinalContext(input) {
12
23
  for (const item of pending) {
13
24
  const root_index = item.root_index;
14
25
  const paths = [item.path];
15
- if (shouldOmitTaskSpecificNoise(item)) {
16
- omissions.push({
17
- root_index,
18
- reason: "noisy_file",
19
- message: "Selected context omitted low-value task-specific noise",
20
- paths,
21
- });
22
- summaryFiles.push(selectionSummaryFile(item, "omitted", "noisy_file"));
23
- continue;
24
- }
25
26
  if (selected.length >= input.budget.max_files) {
26
27
  omissions.push({
27
28
  root_index,
@@ -32,10 +33,7 @@ export function selectContextBuilderFinalContext(input) {
32
33
  summaryFiles.push(selectionSummaryFile(item, "omitted", "max_files"));
33
34
  continue;
34
35
  }
35
- const selectedItem = budgetedSelectionForItem(item, input.budget, {
36
- totalBytes,
37
- totalTokens,
38
- });
36
+ const selectedItem = budgetedSelectionForItem(item, input.budget, { totalBytes, totalTokens }, obligationRanges.get(contextReviewCandidateId(item)));
39
37
  if (selectedItem.kind === "omitted") {
40
38
  omissions.push({
41
39
  root_index,
@@ -54,6 +52,9 @@ export function selectContextBuilderFinalContext(input) {
54
52
  bytes: selectedItem.file.bytes,
55
53
  estimated_tokens: selectedItem.file.estimated_tokens,
56
54
  source: selectedItem.file.source,
55
+ ...(selectedItem.file.disposition == null
56
+ ? {}
57
+ : { disposition: selectedItem.file.disposition }),
57
58
  });
58
59
  summaryFiles.push(selectionSummaryFile(selectedItem.file, selectedItem.tier, selectedItem.reason));
59
60
  totalBytes += selectedItem.file.bytes;
@@ -77,9 +78,134 @@ export function selectContextBuilderFinalContext(input) {
77
78
  },
78
79
  };
79
80
  }
80
- function budgetedSelectionForItem(item, budget, totals) {
81
+ function reserveRequiredCoverageCandidates(input) {
82
+ const policy = input.policy;
83
+ if (policy?.id == null ||
84
+ policy.required_when_available.length === 0) {
85
+ return input.pending;
86
+ }
87
+ const reserved = [];
88
+ const reservedKeys = new Set();
89
+ const pendingByCandidateId = new Map();
90
+ for (const item of input.pending) {
91
+ const candidateId = contextReviewCandidateId(item);
92
+ if (!pendingByCandidateId.has(candidateId)) {
93
+ pendingByCandidateId.set(candidateId, item);
94
+ }
95
+ }
96
+ let totalBytes = 0;
97
+ let totalTokens = 0;
98
+ const reserveCandidate = (candidateIds) => {
99
+ if (reserved.length >= input.budget.max_files) {
100
+ return false;
101
+ }
102
+ for (const candidateId of candidateIds) {
103
+ const item = pendingByCandidateId.get(candidateId);
104
+ if (item == null) {
105
+ continue;
106
+ }
107
+ const key = pendingCandidateKey(item);
108
+ if (reservedKeys.has(key)) {
109
+ return true;
110
+ }
111
+ const budgeted = budgetedSelectionForItem(item, input.budget, { totalBytes, totalTokens }, input.obligationRanges.get(candidateId));
112
+ if (budgeted.kind === "omitted") {
113
+ continue;
114
+ }
115
+ reserved.push(item);
116
+ reservedKeys.add(key);
117
+ totalBytes += budgeted.file.bytes;
118
+ totalTokens += budgeted.file.estimated_tokens;
119
+ return true;
120
+ }
121
+ return false;
122
+ };
123
+ if (input.obligations != null) {
124
+ for (const target of input.obligations.targets) {
125
+ reserveCandidate([target.candidate_id]);
126
+ if (target.regression_links.length > 0) {
127
+ reserveCandidate(target.regression_links.map((link) => link.candidate_id));
128
+ }
129
+ }
130
+ }
131
+ else if (input.evidenceClassesByCandidate != null) {
132
+ const evidenceClassesByCandidate = input.evidenceClassesByCandidate;
133
+ for (const evidenceClass of policy.required_when_available) {
134
+ if (reserved.some((item) => evidenceClassesForPending(item, evidenceClassesByCandidate).includes(evidenceClass))) {
135
+ continue;
136
+ }
137
+ if (reserved.length >= input.budget.max_files) {
138
+ break;
139
+ }
140
+ for (const item of input.pending) {
141
+ const key = pendingCandidateKey(item);
142
+ if (reservedKeys.has(key) ||
143
+ !evidenceClassesForPending(item, evidenceClassesByCandidate).includes(evidenceClass)) {
144
+ continue;
145
+ }
146
+ const budgeted = budgetedSelectionForItem(item, input.budget, {
147
+ totalBytes,
148
+ totalTokens,
149
+ });
150
+ if (budgeted.kind === "omitted") {
151
+ continue;
152
+ }
153
+ reserved.push(item);
154
+ reservedKeys.add(key);
155
+ totalBytes += budgeted.file.bytes;
156
+ totalTokens += budgeted.file.estimated_tokens;
157
+ break;
158
+ }
159
+ }
160
+ }
161
+ if (reserved.length === 0) {
162
+ return input.pending;
163
+ }
164
+ return [
165
+ ...reserved,
166
+ ...input.pending.filter((item) => !reservedKeys.has(pendingCandidateKey(item))),
167
+ ];
168
+ }
169
+ function evidenceClassesForPending(item, byCandidate) {
170
+ return byCandidate.get(pendingCandidateKey(item)) ?? [];
171
+ }
172
+ function pendingCandidateKey(item) {
173
+ return `${item.root_index}\u0000${item.path}`;
174
+ }
175
+ function contextReviewCandidateId(item) {
176
+ return `c:${String(item.root_index)}:${item.path}`;
177
+ }
178
+ function buildObligationRangeIndex(obligations) {
179
+ const ranges = new Map();
180
+ for (const target of obligations?.targets ?? []) {
181
+ appendObligationRanges(ranges, target.candidate_id, target.ranges);
182
+ for (const link of target.regression_links) {
183
+ appendObligationRanges(ranges, link.candidate_id, link.ranges);
184
+ }
185
+ }
186
+ return ranges;
187
+ }
188
+ function appendObligationRanges(index, candidateId, ranges) {
189
+ index.set(candidateId, mergeLineRanges([...(index.get(candidateId) ?? []), ...ranges]));
190
+ }
191
+ function budgetedSelectionForItem(item, budget, totals, preferredRanges) {
81
192
  const full = selectedFileFromPending(item);
82
- if (!item.force_full_focus && shouldPreferSignatureSlicesForLargeFocus(item, full, budget)) {
193
+ const obligationSelection = preferredRanges == null
194
+ ? null
195
+ : budgetFittingSelectionForRanges(item, preferredRanges, budget, totals);
196
+ if (obligationSelection != null) {
197
+ return {
198
+ kind: "selected",
199
+ file: obligationSelection,
200
+ tier: obligationSelection.bytes === full.bytes
201
+ ? "full_file"
202
+ : "signature_slices",
203
+ ...(obligationSelection.bytes === full.bytes
204
+ ? {}
205
+ : { reason: "review_coverage_obligation" }),
206
+ };
207
+ }
208
+ if (shouldPreferSignatureSlicesForLargeFocus(item, full, budget)) {
83
209
  const degraded = compactLargeFocusSelection(item) ?? signatureSliceSelection(item);
84
210
  if (degraded != null &&
85
211
  degraded.bytes < full.bytes &&
@@ -99,8 +225,7 @@ function budgetedSelectionForItem(item, budget, totals) {
99
225
  tier: "full_file",
100
226
  };
101
227
  }
102
- const hasTaskCriticalWindows = taskCriticalCompactWindows(item.path, item.task_tokens).length > 0;
103
- const degraded = item.source === "focus" && (!item.has_search_evidence || hasTaskCriticalWindows)
228
+ const degraded = item.source === "focus" && !item.has_search_evidence
104
229
  ? compactLargeFocusSelection(item) ?? signatureSliceSelection(item)
105
230
  : signatureSliceSelection(item);
106
231
  if (degraded != null && fitsBudget(degraded, budget, totals)) {
@@ -118,6 +243,49 @@ function budgetedSelectionForItem(item, budget, totals) {
118
243
  message: budgetOmissionMessage(reason),
119
244
  };
120
245
  }
246
+ function budgetFittingSelectionForRanges(item, requestedRanges, budget, totals) {
247
+ let best = null;
248
+ const admitted = [];
249
+ for (const range of [...requestedRanges].sort((left, right) => left.start_line - right.start_line || left.end_line - right.end_line)) {
250
+ const candidate = selectionForRanges(item, [...admitted, range]);
251
+ if (candidate == null || !fitsBudget(candidate, budget, totals)) {
252
+ continue;
253
+ }
254
+ admitted.push(range);
255
+ best = candidate;
256
+ }
257
+ return best;
258
+ }
259
+ function selectionForRanges(item, requestedRanges) {
260
+ const renderedLineNumbers = renderedContentLineNumbers(item.ranges);
261
+ const lines = splitTextLines(item.content);
262
+ const linesByOriginalLine = linesByOriginalLineNumber(lines, renderedLineNumbers);
263
+ const selectedLines = new Set();
264
+ for (const requested of requestedRanges) {
265
+ for (let line = requested.start_line; line <= requested.end_line; line++) {
266
+ if (linesByOriginalLine.has(line)) {
267
+ selectedLines.add(line);
268
+ }
269
+ }
270
+ }
271
+ if (selectedLines.size === 0) {
272
+ return null;
273
+ }
274
+ const ranges = mergeLineRanges([...selectedLines].map((line) => ({ start_line: line, end_line: line })));
275
+ const content = ranges
276
+ .flatMap((range) => linesForOriginalRange(range, linesByOriginalLine))
277
+ .join("\n");
278
+ const bytes = Buffer.byteLength(content, "utf8");
279
+ return {
280
+ root_index: item.root_index,
281
+ path: item.path,
282
+ ranges,
283
+ content,
284
+ bytes,
285
+ estimated_tokens: estimateContextBuilderTokensFromUtf8Bytes(bytes),
286
+ source: item.source,
287
+ };
288
+ }
121
289
  const LARGE_FOCUS_OUTLINE_HEAD_LINES = 80;
122
290
  const LARGE_FOCUS_OUTLINE_SYMBOL_LINES = 12;
123
291
  const LARGE_FOCUS_RELEVANT_SYMBOL_LINES = 96;
@@ -136,19 +304,15 @@ function compactLargeFocusSelection(item) {
136
304
  if (codemap.symbols.length === 0) {
137
305
  return null;
138
306
  }
139
- const taskCriticalWindows = taskCriticalCompactWindows(item.path, item.task_tokens);
140
- const maxLines = Math.max(taskCriticalCompactMaxLines(item.path, item.task_tokens), isTestPath(item.path)
307
+ const maxLines = isTestPath(item.path)
141
308
  ? LARGE_TEST_OUTLINE_MAX_LINES
142
- : LARGE_FOCUS_OUTLINE_MAX_LINES);
309
+ : LARGE_FOCUS_OUTLINE_MAX_LINES;
143
310
  const selectedLineNumbers = new Set();
144
311
  const lines = splitTextLines(item.content);
145
312
  const relevanceTokens = combinedRelevanceTokens(item);
146
313
  const relevantWindows = relevanceTokens.size > 0
147
314
  ? relevantSymbolWindows(codemap.symbols, lines, relevanceTokens)
148
315
  : [];
149
- for (const window of taskCriticalWindows) {
150
- addRenderedContentLineWindow(selectedLineNumbers, renderedLineNumbers, window.start_line, window.end_line, maxLines);
151
- }
152
316
  addRenderedContentLineWindow(selectedLineNumbers, renderedLineNumbers, 1, LARGE_FOCUS_OUTLINE_HEAD_LINES, maxLines);
153
317
  for (const window of relevantWindows) {
154
318
  if (selectedLineNumbers.size >= maxLines) {
@@ -193,137 +357,6 @@ function compactLargeFocusSelection(item) {
193
357
  source: item.source,
194
358
  };
195
359
  }
196
- function taskCriticalCompactWindows(path, taskTokens) {
197
- const normalized = path.toLowerCase();
198
- if (isRuntimeSettingsDiscoveryTask(taskTokens)) {
199
- if (normalized.endsWith("/components/chat/message-input/input.tsx")) {
200
- return [
201
- { start_line: 430, end_line: 650 },
202
- { start_line: 880, end_line: 1060 },
203
- ];
204
- }
205
- if (normalized.endsWith("/api/endpoints/chat.py")) {
206
- return [
207
- { start_line: 360, end_line: 460 },
208
- { start_line: 529, end_line: 560 },
209
- { start_line: 945, end_line: 980 },
210
- { start_line: 1299, end_line: 1383 },
211
- ];
212
- }
213
- if (normalized.endsWith("/tasks/chat_processor.py")) {
214
- return [{ start_line: 1, end_line: 197 }];
215
- }
216
- if (normalized.endsWith("/tests/services/test_pending_initial_prompt_service.py")) {
217
- return [
218
- { start_line: 107, end_line: 132 },
219
- { start_line: 137, end_line: 198 },
220
- { start_line: 977, end_line: 1018 },
221
- { start_line: 1086, end_line: 1128 },
222
- { start_line: 1150, end_line: 1225 },
223
- ];
224
- }
225
- if (normalized.endsWith("/tests/test_queue.py")) {
226
- return [
227
- { start_line: 66, end_line: 113 },
228
- { start_line: 117, end_line: 226 },
229
- { start_line: 252, end_line: 321 },
230
- { start_line: 350, end_line: 391 },
231
- ];
232
- }
233
- if (normalized.endsWith("/tests/test_chat.py")) {
234
- return [
235
- { start_line: 320, end_line: 416 },
236
- { start_line: 728, end_line: 758 },
237
- ];
238
- }
239
- if (normalized.endsWith("/services/streamservice.ts")) {
240
- return [{ start_line: 1, end_line: 260 }];
241
- }
242
- if (normalized.endsWith("/components/chat/thinking-mode-selector/thinkingmodeselector.tsx") ||
243
- normalized.endsWith("/components/chat/message-input/thinkingmodeselector.tsx")) {
244
- return [{ start_line: 16, end_line: 83 }];
245
- }
246
- if (normalized.endsWith("/components/chat/permission-mode-selector/permissionmodeselector.tsx")) {
247
- return [{ start_line: 1, end_line: 120 }];
248
- }
249
- if (normalized.endsWith("/components/chat/model-selector/modelselector.tsx")) {
250
- return [{ start_line: 1, end_line: 160 }];
251
- }
252
- if (normalized.endsWith("/hooks/queries/usemodelqueries.ts")) {
253
- return [{ start_line: 1, end_line: 160 }];
254
- }
255
- if (normalized.endsWith("/utils/modelprovider.ts")) {
256
- return [{ start_line: 1, end_line: 160 }];
257
- }
258
- if (normalized.endsWith("/services/queue.py")) {
259
- return [{ start_line: 1, end_line: 220 }];
260
- }
261
- if (normalized.endsWith("/models/schemas/effort.py") ||
262
- normalized.endsWith("/models/schemas/permission_mode.py")) {
263
- return [{ start_line: 1, end_line: 160 }];
264
- }
265
- if (normalized.endsWith("/services/runtime/resolver.py")) {
266
- return [{ start_line: 16, end_line: 45 }];
267
- }
268
- if (normalized.endsWith("/services/model_provider_auth.py")) {
269
- return [{ start_line: 42, end_line: 95 }];
270
- }
271
- if (normalized.endsWith("/services/claude_agent.py")) {
272
- return [
273
- { start_line: 56, end_line: 75 },
274
- { start_line: 829, end_line: 872 },
275
- ];
276
- }
277
- if (normalized.endsWith("/api/endpoints/ai_models.py") ||
278
- normalized.endsWith("/models/db_models/ai_model.py")) {
279
- return [{ start_line: 1, end_line: 120 }];
280
- }
281
- }
282
- if (isCodexRuntimeReviewTask(taskTokens)) {
283
- if (normalized.endsWith("/components/chat/message-input/input.tsx")) {
284
- return [
285
- { start_line: 1, end_line: 260 },
286
- { start_line: 430, end_line: 650 },
287
- { start_line: 880, end_line: 1060 },
288
- ];
289
- }
290
- if (normalized.endsWith("/components/chat/message-input/thinkingmodeselector.tsx") ||
291
- normalized.endsWith("/models/db_models/ai_model.py") ||
292
- normalized.endsWith("/api/endpoints/ai_models.py")) {
293
- return [{ start_line: 1, end_line: 260 }];
294
- }
295
- }
296
- if (isDevtoolsTraceDebugTask(taskTokens)) {
297
- if (normalized.endsWith("/components/right-panel/rightpaneldevtools.tsx")) {
298
- return [
299
- { start_line: 1, end_line: 160 },
300
- { start_line: 520, end_line: 760 },
301
- { start_line: 840, end_line: 980 },
302
- ];
303
- }
304
- if (normalized.endsWith("/components/chat/chat-window/chat.tsx")) {
305
- return [{ start_line: 430, end_line: 760 }];
306
- }
307
- }
308
- return [];
309
- }
310
- function taskCriticalCompactMaxLines(path, taskTokens) {
311
- const normalized = path.toLowerCase();
312
- if ((isRuntimeSettingsDiscoveryTask(taskTokens) ||
313
- isCodexRuntimeReviewTask(taskTokens)) &&
314
- normalized.endsWith("/components/chat/message-input/input.tsx")) {
315
- return 640;
316
- }
317
- if (isDevtoolsTraceDebugTask(taskTokens) &&
318
- normalized.endsWith("/components/right-panel/rightpaneldevtools.tsx")) {
319
- return 640;
320
- }
321
- if (isDevtoolsTraceDebugTask(taskTokens) &&
322
- normalized.endsWith("/components/chat/chat-window/chat.tsx")) {
323
- return 420;
324
- }
325
- return 0;
326
- }
327
360
  function combinedRelevanceTokens(item) {
328
361
  if (item.task_tokens.size === 0 && item.search_term_tokens.size === 0) {
329
362
  return new Set();
@@ -544,16 +577,13 @@ function buildPendingSelections(slices, search, task, budget) {
544
577
  const hasSearchEvidence = records.some((slice) => slice.source === "search");
545
578
  const focusRecords = records.filter((slice) => slice.source === "focus");
546
579
  const searchRecords = records.filter((slice) => slice.source === "search");
547
- const protectedFocus = focusRecords.length > 0 && isProtectedPrimaryFocusPath(first.path, task);
548
- const forceFullFocus = shouldForceFullFocusEvidence(focusRecords, task, budget);
549
- const rawEvidenceRecords = forceFullFocus ||
550
- (focusRecords.length > 0 &&
551
- shouldPreferFullFocusEvidence(focusRecords, budget))
580
+ const rawEvidenceRecords = (focusRecords.length > 0 &&
581
+ shouldPreferFullFocusEvidence(focusRecords, budget))
552
582
  ? focusRecords
553
583
  : hasSearchEvidence
554
584
  ? searchRecords
555
585
  : records;
556
- const evidenceRecords = mergeTaskCriticalFocusRecords(rawEvidenceRecords, focusRecords, first.path, taskTokens);
586
+ const evidenceRecords = rawEvidenceRecords;
557
587
  if (evidenceRecords.length === 0) {
558
588
  continue;
559
589
  }
@@ -584,63 +614,14 @@ function buildPendingSelections(slices, search, task, budget) {
584
614
  search_hit_density_rank: searchHitDensityRank(searchHitCounts.get(`${first.root_index}\u0000${first.path}`) ?? 0),
585
615
  name_overlap_rank: nameOverlapRank(first.path, taskTokens),
586
616
  adjacency_rank: adjacencyRanks.get(`${first.root_index}\u0000${first.path}`) ?? 0,
587
- central_focus_rank: protectedFocus ? -1 : 0,
588
- task_closure_rank: taskClosureRank(first.path, bytes, task),
589
617
  small_closure_rank: smallClosureRank(first.path, bytes, contentTokens, taskTokens, searchTermTokens),
590
618
  has_search_evidence: hasSearchEvidence,
591
- force_full_focus: forceFullFocus,
592
619
  task_tokens: taskTokens,
593
620
  search_term_tokens: searchTermTokens,
594
621
  });
595
622
  }
596
623
  return pending.sort(comparePendingSelections);
597
624
  }
598
- function mergeTaskCriticalFocusRecords(rawEvidenceRecords, focusRecords, path, taskTokens) {
599
- if (focusRecords.length === 0) {
600
- return [...rawEvidenceRecords];
601
- }
602
- const criticalRecords = taskCriticalFocusRecords(path, taskTokens, focusRecords);
603
- if (criticalRecords.length === 0) {
604
- return [...rawEvidenceRecords];
605
- }
606
- const seen = new Set();
607
- const merged = [];
608
- for (const record of [...rawEvidenceRecords, ...criticalRecords]) {
609
- const key = `${record.root_index}\u0000${record.path}\u0000${record.start_line}\u0000${record.end_line}\u0000${record.source}`;
610
- if (seen.has(key)) {
611
- continue;
612
- }
613
- seen.add(key);
614
- merged.push(record);
615
- }
616
- return merged;
617
- }
618
- function taskCriticalFocusRecords(path, taskTokens, focusRecords) {
619
- const windows = taskCriticalCompactWindows(path, taskTokens);
620
- if (windows.length === 0) {
621
- return [];
622
- }
623
- const criticalRecords = [];
624
- for (const focusRecord of focusRecords) {
625
- const lines = splitTextLines(focusRecord.content);
626
- for (const window of windows) {
627
- const startLine = Math.max(focusRecord.start_line, window.start_line);
628
- const endLine = Math.min(focusRecord.end_line, window.end_line);
629
- if (endLine < startLine) {
630
- continue;
631
- }
632
- const startIndex = startLine - focusRecord.start_line;
633
- const endIndex = endLine - focusRecord.start_line;
634
- criticalRecords.push({
635
- ...focusRecord,
636
- start_line: startLine,
637
- end_line: endLine,
638
- content: lines.slice(startIndex, endIndex + 1).join("\n"),
639
- });
640
- }
641
- }
642
- return criticalRecords;
643
- }
644
625
  function shouldPreferFullFocusEvidence(records, budget) {
645
626
  const first = records[0];
646
627
  if (first == null) {
@@ -650,19 +631,6 @@ function shouldPreferFullFocusEvidence(records, budget) {
650
631
  return (bytes <= budget.max_bytes_per_file &&
651
632
  estimatedTokens <= focusWholeFileTokenTarget(first.path, budget));
652
633
  }
653
- function shouldForceFullFocusEvidence(records, task, budget) {
654
- if (records.length === 0 || !isPrimaryFocusIntentTask(task)) {
655
- return false;
656
- }
657
- const first = records[0];
658
- if (first == null || !isProtectedPrimaryFocusPath(first.path, task)) {
659
- return false;
660
- }
661
- const { bytes, estimatedTokens } = fullEvidenceStats(records);
662
- const wholeFileTarget = protectedFocusWholeFileTokenTarget(first.path, budget);
663
- return (bytes <= budget.max_bytes_per_file &&
664
- estimatedTokens <= wholeFileTarget);
665
- }
666
634
  function fullEvidenceStats(records) {
667
635
  const sorted = [...records].sort(compareSlices);
668
636
  const ranges = mergeLineRanges(sorted);
@@ -673,66 +641,11 @@ function fullEvidenceStats(records) {
673
641
  estimatedTokens: estimateContextBuilderTokensFromUtf8Bytes(bytes),
674
642
  };
675
643
  }
676
- function isPrimaryFocusIntentTask(task) {
677
- return /\b(review|debug|debugging|diagnose|diagnosis|diagnostic|discover|discovery)\b/i.test(task);
678
- }
679
- function isProtectedPrimaryFocusPath(path, task) {
680
- const normalizedTask = task.toLowerCase();
681
- const normalizedPath = path.toLowerCase();
682
- const basename = normalizedPath.split("/").at(-1) ?? normalizedPath;
683
- if (/\b(discover|discovery)\b/.test(normalizedTask)) {
684
- return (/\/api\/endpoints\/chat\.py$/.test(normalizedPath) ||
685
- /\/services\/chat\.py$/.test(normalizedPath) ||
686
- /\/services\/queue\.py$/.test(normalizedPath) ||
687
- /\/services\/streaming\/orchestrator\.py$/.test(normalizedPath) ||
688
- /\/services\/runtime\/codex\.py$/.test(normalizedPath) ||
689
- /\/tasks\/chat_processor\.py$/.test(normalizedPath) ||
690
- /\/tests\/test_chat\.py$/.test(normalizedPath) ||
691
- /\/services\/queueservice\.ts$/.test(normalizedPath) ||
692
- /\/store\/messagequeuestore\.ts$/.test(normalizedPath) ||
693
- /\/store\/__tests__\/messagequeuestore\.test\.ts$/.test(normalizedPath) ||
694
- /\/components\/chat\/chat-window\/chat\.tsx$/.test(normalizedPath) ||
695
- /\/components\/chat\/message-input\/input\.tsx$/.test(normalizedPath) ||
696
- /\/pages\/chatpage\.tsx$/.test(normalizedPath) ||
697
- (basename === "chat.py" &&
698
- normalizedPath.includes("/models/schemas/")) ||
699
- (basename === "chat.py" &&
700
- normalizedPath.includes("/models/db_models/")));
701
- }
702
- if (/\breview\b/.test(normalizedTask)) {
703
- return (normalizedPath.includes("/services/runtime/") ||
704
- normalizedPath.includes("/services/streaming/orchestrator.") ||
705
- normalizedPath.includes("/tests/services/runtime/") ||
706
- normalizedPath.endsWith("/test_runtime_session_service.py"));
707
- }
708
- if (/\b(debug|debugging|diagnose|diagnosis|diagnostic)\b/.test(normalizedTask)) {
709
- return (basename === "rightpaneldevtools.tsx" ||
710
- basename === "rightpanel.tsx" ||
711
- basename === "devtools-helpers.ts" ||
712
- normalizedPath.endsWith("/components/chat/chat-window/chat.tsx") ||
713
- normalizedPath.includes("/right-panel/__tests__/") ||
714
- normalizedPath.endsWith("/test_devtools_trace_archive.py"));
715
- }
716
- return false;
717
- }
718
644
  function focusWholeFileTokenTarget(path, budget) {
719
645
  return isTestPath(path)
720
646
  ? Math.min(8_000, Math.floor(budget.target_estimated_tokens * 0.12))
721
647
  : Math.min(12_000, Math.floor(budget.target_estimated_tokens * 0.18));
722
648
  }
723
- function protectedFocusWholeFileTokenTarget(path, budget) {
724
- const normalized = path.toLowerCase();
725
- if (normalized.endsWith("/rightpaneldevtools.tsx")) {
726
- return Math.min(28_000, Math.floor(budget.target_estimated_tokens * 0.38));
727
- }
728
- if (normalized.endsWith("/components/chat/chat-window/chat.tsx")) {
729
- return Math.min(18_000, Math.floor(budget.target_estimated_tokens * 0.26));
730
- }
731
- if (normalized.includes("/services/runtime/")) {
732
- return Math.min(18_000, Math.floor(budget.target_estimated_tokens * 0.2));
733
- }
734
- return focusWholeFileTokenTarget(path, budget);
735
- }
736
649
  function taskSupportRank(path, normalizedTask, hasContentSupport) {
737
650
  if (normalizedTask.length === 0) {
738
651
  return 0;
@@ -784,10 +697,10 @@ function taskSupportRank(path, normalizedTask, hasContentSupport) {
784
697
  }
785
698
  function isGenericEndpointPath(path) {
786
699
  // The endpoint/route/api intent boost targets implementation endpoint files.
787
- // A test path that merely lives under an api/ directory (e.g.
788
- // backend/tests/api/...) must NOT inherit this implementation-intent boost,
789
- // or it would outrank genuine implementation evidence once task_support_rank
790
- // leads the comparator. The separate test-safety rule covers test paths.
700
+ // A test path that merely lives under an api/ directory must NOT inherit this
701
+ // implementation-intent boost, or it would outrank genuine implementation
702
+ // evidence once task_support_rank leads the comparator. The separate
703
+ // test-safety rule covers test paths.
791
704
  if (isTestPath(path)) {
792
705
  return false;
793
706
  }
@@ -839,157 +752,6 @@ function nameOverlapRank(path, taskTokens) {
839
752
  return -score;
840
753
  }
841
754
  const SMALL_CLOSURE_MAX_BYTES = 24_000;
842
- function taskClosureRank(path, bytes, task) {
843
- if (bytes > SMALL_CLOSURE_MAX_BYTES) {
844
- return 0;
845
- }
846
- return contextBuilderTaskClosureAnchorRank(path, task);
847
- }
848
- export function isContextBuilderTaskClosureAnchor(path, task) {
849
- return contextBuilderTaskClosureAnchorRank(path, task) < 0;
850
- }
851
- export function contextBuilderTaskClosureAnchorRank(path, task) {
852
- const normalizedTask = task.toLowerCase();
853
- if (normalizedTask.length === 0) {
854
- return 0;
855
- }
856
- const taskTokens = new Set(tokenizeGenericWords(normalizedTask));
857
- const normalizedPath = path.toLowerCase();
858
- for (const rule of TASK_CLOSURE_ANCHOR_RULES) {
859
- if (!rule.intent.test(normalizedTask)) {
860
- continue;
861
- }
862
- if (!rule.tokens.some((token) => taskTokens.has(token))) {
863
- continue;
864
- }
865
- if (rule.paths.some((pattern) => pattern.test(normalizedPath))) {
866
- return rule.rank;
867
- }
868
- }
869
- return 0;
870
- }
871
- const TASK_CLOSURE_ANCHOR_RULES = [
872
- {
873
- intent: /\b(discover|discovery)\b.*\b(provider-specific|provider\s+semantics|providers?|claude|agent|symmetry)\b|\b(provider-specific|provider\s+semantics|providers?|claude|agent|symmetry)\b.*\b(discover|discovery)\b/,
874
- tokens: ["provider", "runtime", "claude", "agent", "symmetry"],
875
- paths: [/\/claude_agent\.py$/, /\/runtime\/base\.py$/],
876
- rank: -30,
877
- },
878
- {
879
- intent: /\b(discover|discovery)\b/,
880
- tokens: ["queue", "migration", "runtime", "schema", "setting", "selector", "model", "provider"],
881
- paths: [
882
- /\/api\/endpoints\/chat\.py$/,
883
- /\/services\/chat\.py$/,
884
- /\/services\/queue\.py$/,
885
- /\/hooks\/queries\/usemodelqueries\.ts$/,
886
- /\/utils\/modelprovider\.ts$/,
887
- /\/components\/chat\/model-selector\/modelselector\.tsx$/,
888
- /\/components\/chat\/model-selector\/modelselector\.test\.tsx$/,
889
- /\/tasks\/chat_processor\.py$/,
890
- /\/services\/streaming\/orchestrator\.py$/,
891
- /\/services\/runtime\/codex\.py$/,
892
- /\/models\/schemas\/effort\.py$/,
893
- /\/models\/schemas\/chat\.py$/,
894
- /\/tests\/test_chat\.py$/,
895
- /\/tests\/services\/test_pending_initial_prompt_service\.py$/,
896
- /\/services\/queueservice\.ts$/,
897
- /\/store\/messagequeuestore\.ts$/,
898
- /\/store\/__tests__\/messagequeuestore\.test\.ts$/,
899
- /\/hooks\/usemessageactions\.ts$/,
900
- /\/hooks\/usechatstreaming\.ts$/,
901
- /\/hooks\/usechatruntimesettings\.ts$/,
902
- /\/components\/chat\/chat-window\/chat\.tsx$/,
903
- /\/components\/chat\/message-input\/input\.tsx$/,
904
- /\/components\/chat\/message-input\/inputsettingspopover\.tsx$/,
905
- /\/pages\/chatpage\.tsx$/,
906
- /\/landingpage\.tsx$/,
907
- /\/models\/db_models\/chat\.py$/,
908
- /\/[^/]*(permission|thinking).*selector[^/]*\.(ts|tsx)$/,
909
- /\/tests?\/.*queue.*\.(py|ts|tsx)$/,
910
- /\/tests\/test_chat\.py$/,
911
- /\/tests?\/.*runtime.*\.(py|ts|tsx)$/,
912
- ],
913
- rank: -24,
914
- },
915
- {
916
- intent: /\b(review|code review)\b/,
917
- tokens: ["codex", "approval", "permission", "session", "runtime"],
918
- paths: [
919
- /\/api\/endpoints\/permissions\.py$/,
920
- /\/services\/runtime\/codex\.py$/,
921
- /\/services\/runtime\/codex_approval\.py$/,
922
- /\/services\/runtime\/codex_stream_processor\.py$/,
923
- /\/services\/runtime_session_service\.py$/,
924
- /\/services\/permission_manager\.py$/,
925
- /\/services\/chat\.py$/,
926
- /\/api\/endpoints\/chat\.py$/,
927
- /\/models\/db_models\/runtime_session\.py$/,
928
- /\/models\/db_models\/ai_model\.py$/,
929
- /\/services\/chatservice\.ts$/,
930
- /\/types\/chat\.types\.ts$/,
931
- /\/models\/schemas\/permissions\.py$/,
932
- /\/core\/config\.py$/,
933
- /\/constants\.py$/,
934
- /\/hooks\/usepermissionrequest\.ts$/,
935
- /\/tests\/test_permissions\.py$/,
936
- /\/tests\/services\/runtime\/test_codex_runtime\.py$/,
937
- /\/tests\/services\/runtime\/test_codex_approval_bridge\.py$/,
938
- /\/tests\/services\/runtime\/test_codex_stream_processor\.py$/,
939
- /\/tests\/services\/test_runtime_session_service\.py$/,
940
- /\/tests?\/.*codex.*approval.*\.(py|ts|tsx)$/,
941
- /(^|\/)docs?\/.*(codex|approval|permission|session|runtime).*\.md$/,
942
- ],
943
- rank: -24,
944
- },
945
- {
946
- intent: /\breview\b/,
947
- tokens: ["auth", "upload", "approval", "approve", "access", "request"],
948
- paths: [
949
- /\/[^/]*(auth|credential)[^/]*upload[^/]*\.(ts|tsx)$/,
950
- /\/[^/]*upload[^/]*(auth|credential)[^/]*\.(ts|tsx)$/,
951
- /\/[^/]*(approval|approve|accessrequest|requestaccess)[^/]*\.(ts|tsx)$/,
952
- /\/__tests__\/.*(auth|upload|approval|approve|access|request).*\.test\.(ts|tsx)$/,
953
- ],
954
- rank: -24,
955
- },
956
- {
957
- intent: /\b(debug|debugging|diagnose|diagnosis|diagnostic)\b/,
958
- tokens: [
959
- "right",
960
- "panel",
961
- "devtool",
962
- "trace",
963
- "archive",
964
- "api",
965
- "chat",
966
- "cache",
967
- "key",
968
- "query",
969
- "tool",
970
- "message",
971
- ],
972
- paths: [
973
- /\/rightpanel\.tsx$/,
974
- /\/devtools?.*\.test\.(ts|tsx)$/,
975
- /\/.*trace.*archive.*\.test\.(ts|tsx|py)$/,
976
- /\/tests?\/.*trace.*archive.*\.(py|ts|tsx)$/,
977
- /\/api\/endpoints\/devtools\.py$/,
978
- /\/services\/session_trace_archive\.py$/,
979
- /\/models\/db_models\/session_trace_archive\.py$/,
980
- /\/services\/codex_trace\.py$/,
981
- /\/api\.types\.ts$/,
982
- /\/chatservice\.ts$/,
983
- /\/querykeys\.ts$/,
984
- /\/messagecacheorder\.ts$/,
985
- /\/messagerenderer\.tsx$/,
986
- /\/toolexpandcontext\.ts$/,
987
- /\/chat\.types\.ts$/,
988
- /\/devtools\.types\.ts$/,
989
- ],
990
- rank: -24,
991
- },
992
- ];
993
755
  function smallClosureRank(path, bytes, contentTokens, taskTokens, searchTermTokens) {
994
756
  if (bytes > SMALL_CLOSURE_MAX_BYTES || !isSmallClosurePath(path)) {
995
757
  return 0;
@@ -1016,12 +778,6 @@ function isSmallClosurePath(path) {
1016
778
  normalized.includes("/models/schemas/") ||
1017
779
  normalized.includes("/constants.") ||
1018
780
  normalized.includes("/config.") ||
1019
- normalized.includes("/session_trace_archive.") ||
1020
- normalized.includes("/querykeys.") ||
1021
- normalized.includes("/rightpanel.") ||
1022
- normalized.includes("/messagerenderer.") ||
1023
- normalized.includes("/toolcard.") ||
1024
- normalized.includes("/toolexpandcontext.") ||
1025
781
  basename.endsWith(".types.ts") ||
1026
782
  basename.endsWith(".types.tsx") ||
1027
783
  basename === "types.ts" ||
@@ -1030,10 +786,7 @@ function isSmallClosurePath(path) {
1030
786
  basename === "constants.ts" ||
1031
787
  basename === "constants.py" ||
1032
788
  basename === "config.ts" ||
1033
- basename === "config.py" ||
1034
- basename === "querykeys.ts" ||
1035
- basename === "permission_mode.py" ||
1036
- basename === "effort.py");
789
+ basename === "config.py");
1037
790
  }
1038
791
  // Tokenize the (bounded) content of a pending selection into the distinct
1039
792
  // generic words it contains. Computed once per pending item and reused by both
@@ -1227,10 +980,7 @@ function renderMergedRange(range, records) {
1227
980
  return lines.join("\n");
1228
981
  }
1229
982
  function comparePendingSelections(left, right) {
1230
- const baseComparison = left.central_focus_rank - right.central_focus_rank ||
1231
- crossSourceFocusedSafetyTestRank(left, right) ||
1232
- taskSpecificPathPriorityRank(left.path, left.source, left.bytes, left.task_tokens) -
1233
- taskSpecificPathPriorityRank(right.path, right.source, right.bytes, right.task_tokens) ||
983
+ const baseComparison = crossSourceFocusedSafetyTestRank(left, right) ||
1234
984
  relevanceRank(left) - relevanceRank(right) ||
1235
985
  sourceRank(left.source) - sourceRank(right.source);
1236
986
  if (baseComparison !== 0) {
@@ -1239,9 +989,6 @@ function comparePendingSelections(left, right) {
1239
989
  if (left.source === "focus" && right.source === "focus") {
1240
990
  return (strongImplementationPathSearchRank(left) -
1241
991
  strongImplementationPathSearchRank(right) ||
1242
- taskSpecificPathPriorityRank(left.path, left.source, left.bytes, left.task_tokens) -
1243
- taskSpecificPathPriorityRank(right.path, right.source, right.bytes, right.task_tokens) ||
1244
- left.task_closure_rank - right.task_closure_rank ||
1245
992
  left.task_support_rank - right.task_support_rank ||
1246
993
  focusedSafetyTestRank(left) - focusedSafetyTestRank(right) ||
1247
994
  // Explicit task intent (task_support_rank) wins first; then a file whose
@@ -1263,9 +1010,6 @@ function comparePendingSelections(left, right) {
1263
1010
  }
1264
1011
  return (strongImplementationPathSearchRank(left) -
1265
1012
  strongImplementationPathSearchRank(right) ||
1266
- taskSpecificPathPriorityRank(left.path, left.source, left.bytes, left.task_tokens) -
1267
- taskSpecificPathPriorityRank(right.path, right.source, right.bytes, right.task_tokens) ||
1268
- left.task_closure_rank - right.task_closure_rank ||
1269
1013
  left.task_support_rank - right.task_support_rank ||
1270
1014
  // Explicit task intent (task_support_rank) wins first; then a file whose
1271
1015
  // actual CONTENT matches the task outranks the generic structural
@@ -1287,288 +1031,6 @@ function comparePendingSelections(left, right) {
1287
1031
  function strongImplementationPathSearchRank(item) {
1288
1032
  return isImplementationPath(item.path) && item.path_search_term_rank <= -20 ? -1 : 0;
1289
1033
  }
1290
- function taskSpecificPathPriorityRank(path, source, bytes, taskTokens) {
1291
- return Math.min(runtimeSettingsDiscoveryPathPriorityRank(path, taskTokens), codexRuntimeReviewPathPriorityRank(path, bytes, taskTokens), devtoolsTraceDebugPathPriorityRank(path, source, bytes, taskTokens));
1292
- }
1293
- function shouldOmitTaskSpecificNoise(item) {
1294
- return (taskSpecificPathPriorityRank(item.path, item.source, item.bytes, item.task_tokens) >= 12);
1295
- }
1296
- function runtimeSettingsDiscoveryPathPriorityRank(path, taskTokens) {
1297
- if (!isRuntimeSettingsDiscoveryTask(taskTokens)) {
1298
- return 0;
1299
- }
1300
- const normalized = path.toLowerCase();
1301
- const basename = normalized.split("/").at(-1) ?? normalized;
1302
- if (normalized.endsWith("/hooks/usechatruntimesettings.ts")) {
1303
- return -80;
1304
- }
1305
- if (normalized.endsWith("/components/chat/message-input/composerruntimecontrols.tsx")) {
1306
- return -78;
1307
- }
1308
- if (normalized.endsWith("/components/chat/message-input/input.tsx")) {
1309
- return -77;
1310
- }
1311
- if (normalized.endsWith("/pages/chatpage.tsx")) {
1312
- return -76;
1313
- }
1314
- if (normalized.endsWith("/services/chatservice.ts") ||
1315
- normalized.endsWith("/api/endpoints/chat.py") ||
1316
- normalized.endsWith("/services/chat.py")) {
1317
- return normalized.endsWith("/api/endpoints/chat.py") ? -82 : -72;
1318
- }
1319
- if (normalized.endsWith("/api/endpoints/ai_models.py") ||
1320
- normalized.endsWith("/models/db_models/ai_model.py") ||
1321
- normalized.endsWith("/services/runtime/resolver.py") ||
1322
- normalized.endsWith("/services/model_provider_auth.py") ||
1323
- normalized.endsWith("/services/claude_agent.py") ||
1324
- normalized.endsWith("/tests/test_ai_models_codex_gate.py") ||
1325
- normalized.endsWith("/components/chat/model-selector/modelselector.tsx") ||
1326
- normalized.endsWith("/components/chat/model-selector/modelselector.test.tsx") ||
1327
- normalized.endsWith("/hooks/queries/usemodelqueries.ts") ||
1328
- normalized.endsWith("/utils/modelprovider.ts") ||
1329
- normalized.endsWith("/utils/__tests__/modelprovider.test.ts")) {
1330
- return normalized.endsWith("/api/endpoints/ai_models.py") ||
1331
- normalized.endsWith("/components/chat/model-selector/modelselector.tsx")
1332
- ? -81
1333
- : -70;
1334
- }
1335
- if (normalized.endsWith("/store/messagequeuestore.ts") ||
1336
- normalized.endsWith("/store/__tests__/messagequeuestore.test.ts") ||
1337
- normalized.endsWith("/services/queueservice.ts") ||
1338
- normalized.endsWith("/services/streamservice.ts") ||
1339
- normalized.endsWith("/tests/services/test_queue.py") ||
1340
- normalized.endsWith("/tests/test_queue.py") ||
1341
- normalized.endsWith("/tests/services/test_pending_initial_prompt_service.py")) {
1342
- return normalized.endsWith("/tests/services/test_pending_initial_prompt_service.py") ||
1343
- normalized.endsWith("/tests/test_queue.py")
1344
- ? -74
1345
- : -68;
1346
- }
1347
- if (normalized.endsWith("/services/runtime/codex.py") ||
1348
- normalized.endsWith("/services/runtime/claude.py") ||
1349
- normalized.endsWith("/services/runtime/codex_approval.py") ||
1350
- normalized.endsWith("/services/runtime/codex_stream_processor.py") ||
1351
- normalized.endsWith("/services/streaming/orchestrator.py") ||
1352
- normalized.endsWith("/tasks/chat_processor.py") ||
1353
- normalized.endsWith("/services/runtime_session_service.py")) {
1354
- return normalized.endsWith("/tasks/chat_processor.py") ? -73 : -64;
1355
- }
1356
- if (normalized.endsWith("/hooks/__tests__/usechatruntimesettings.test.ts") ||
1357
- normalized.endsWith("/pages/landingpage.test.tsx") ||
1358
- normalized.endsWith("/tests/test_chat.py") ||
1359
- normalized.endsWith("/tests/services/runtime/test_codex_runtime.py") ||
1360
- normalized.endsWith("/tests/test_codex_runtime_data_migration.py") ||
1361
- normalized.endsWith("/tests/test_codex_effort_translation.py") ||
1362
- normalized.endsWith("/tests/test_effort_level.py") ||
1363
- normalized.endsWith("/tests/test_permission_mode.py") ||
1364
- normalized.endsWith("/tests/services/test_claude_agent.py")) {
1365
- return -60;
1366
- }
1367
- if (basename === "effort.py" ||
1368
- basename === "permission_mode.py" ||
1369
- basename === "chat.types.ts" ||
1370
- basename === "queue.types.ts" ||
1371
- normalized.endsWith("/models/schemas/chat.py") ||
1372
- normalized.endsWith("/models/db_models/chat.py") ||
1373
- normalized.endsWith("/models/db_models/runtime_session.py") ||
1374
- basename.includes("permissionmodeselector") ||
1375
- basename.includes("thinkingmodeselector")) {
1376
- return basename === "effort.py" || basename === "permission_mode.py" ? -64 : -56;
1377
- }
1378
- if (normalized.endsWith("/pages/landingpage.tsx") ||
1379
- normalized.endsWith("/tasks/chat_processor.py")) {
1380
- return 18;
1381
- }
1382
- if (normalized.endsWith("/components/chat/chat-window/chat.tsx")) {
1383
- return 14;
1384
- }
1385
- if (normalized.endsWith("/hooks/usechatstreaming.ts")) {
1386
- return -12;
1387
- }
1388
- return 0;
1389
- }
1390
- function codexRuntimeReviewPathPriorityRank(path, bytes, taskTokens) {
1391
- if (!isCodexRuntimeReviewTask(taskTokens)) {
1392
- return 0;
1393
- }
1394
- const normalized = path.toLowerCase();
1395
- if (normalized.endsWith("/services/runtime/resolver.py")) {
1396
- return -92;
1397
- }
1398
- if (normalized.endsWith("/services/runtime/codex.py")) {
1399
- return -90;
1400
- }
1401
- if (normalized.endsWith("/services/runtime/codex_approval.py")) {
1402
- return -88;
1403
- }
1404
- if (normalized.endsWith("/services/runtime/codex_stream_processor.py")) {
1405
- return -86;
1406
- }
1407
- if (normalized.endsWith("/services/runtime_session_service.py")) {
1408
- return -84;
1409
- }
1410
- if (normalized.endsWith("/models/db_models/runtime_session.py")) {
1411
- return -82;
1412
- }
1413
- if (normalized.endsWith("/tests/services/runtime/test_codex_runtime.py")) {
1414
- return -80;
1415
- }
1416
- if (normalized.endsWith("/tests/services/runtime/test_codex_approval_bridge.py")) {
1417
- return -78;
1418
- }
1419
- if (normalized.endsWith("/tests/services/runtime/test_codex_stream_processor.py")) {
1420
- return -76;
1421
- }
1422
- if (normalized.endsWith("/tests/services/test_runtime_session_service.py")) {
1423
- return -74;
1424
- }
1425
- if (codexReviewWantsModelGate(taskTokens) &&
1426
- (normalized.endsWith("/models/db_models/ai_model.py") ||
1427
- normalized.endsWith("/api/endpoints/ai_models.py") ||
1428
- normalized.endsWith("/services/model_provider_auth.py") ||
1429
- normalized.endsWith("/tests/test_ai_models_codex_gate.py"))) {
1430
- return -72;
1431
- }
1432
- if (codexReviewWantsFrontendGate(taskTokens) &&
1433
- (normalized.endsWith("/components/chat/message-input/thinkingmodeselector.tsx") ||
1434
- normalized.endsWith("/components/chat/thinking-mode-selector/thinkingmodeselector.tsx") ||
1435
- normalized.endsWith("/components/chat/permission-mode-selector/permissionmodeselector.tsx"))) {
1436
- return -71;
1437
- }
1438
- if (codexReviewWantsFrontendGate(taskTokens) &&
1439
- normalized.endsWith("/components/chat/message-input/input.tsx")) {
1440
- return -83;
1441
- }
1442
- if (codexReviewWantsFrontendGate(taskTokens) &&
1443
- normalized.endsWith("/components/ui/fileuploaddialog.codex.test.tsx")) {
1444
- return -81;
1445
- }
1446
- if (codexReviewWantsFrontendGate(taskTokens) &&
1447
- (normalized.endsWith("/components/ui/fileuploaddialog.tsx") ||
1448
- normalized.endsWith("/hooks/usemessageactions.ts") ||
1449
- normalized.endsWith("/services/chatservice.ts"))) {
1450
- return -68;
1451
- }
1452
- if (normalized.endsWith("/api/endpoints/permissions.py") ||
1453
- normalized.endsWith("/services/permission_manager.py") ||
1454
- normalized.endsWith("/hooks/usepermissionrequest.ts") ||
1455
- normalized.endsWith("/tests/test_permissions.py") ||
1456
- normalized.endsWith("/tests/services/runtime/test_codex_stream_processor_fixtures.py")) {
1457
- return -58;
1458
- }
1459
- if (bytes > SMALL_CLOSURE_MAX_BYTES &&
1460
- (normalized.includes("/sandbox/") ||
1461
- normalized.includes("sandbox") ||
1462
- normalized.includes("providerauth") ||
1463
- normalized.includes("provider_auth") ||
1464
- normalized.includes("model_provider_auth"))) {
1465
- return 16;
1466
- }
1467
- return 0;
1468
- }
1469
- function devtoolsTraceDebugPathPriorityRank(path, source, bytes, taskTokens) {
1470
- if (!isDevtoolsTraceDebugTask(taskTokens)) {
1471
- return 0;
1472
- }
1473
- const normalized = path.toLowerCase();
1474
- const focusBonus = source === "focus" ? -2 : 0;
1475
- if (normalized.endsWith("/components/right-panel/rightpaneldevtools.tsx")) {
1476
- return -90 + focusBonus;
1477
- }
1478
- if (normalized.endsWith("/components/right-panel/__tests__/right-panel-devtools.test.tsx") ||
1479
- normalized.endsWith("/components/chat/__tests__/chat.autoscroll.test.tsx") ||
1480
- normalized.endsWith("/store/devtoolsnavstore.ts") ||
1481
- normalized.endsWith("/store/__tests__/devtoolsnavstore.test.ts")) {
1482
- return -86 + focusBonus;
1483
- }
1484
- if (normalized.endsWith("/components/chat/chat-window/chat.tsx") ||
1485
- normalized.endsWith("/components/chat/message-bubble/messagerenderer.tsx") ||
1486
- normalized.endsWith("/components/chat/tools/common/toolcard.tsx")) {
1487
- return -82 + focusBonus;
1488
- }
1489
- if (normalized.endsWith("/hooks/usemessagecache.ts") ||
1490
- normalized.endsWith("/utils/messagecacheorder.ts") ||
1491
- normalized.endsWith("/hooks/queries/querykeys.ts") ||
1492
- normalized.endsWith("/hooks/queries/usedevtoolsqueries.ts") ||
1493
- normalized.endsWith("/components/chat/tools/common/toolexpandcontext.ts") ||
1494
- normalized.endsWith("/components/chat/tools/common/__tests__/toolexpand.test.tsx")) {
1495
- return -78 + focusBonus;
1496
- }
1497
- if (normalized.endsWith("/components/right-panel/devtools-helpers.ts") ||
1498
- normalized.endsWith("/components/right-panel/__tests__/devtools-helpers.test.ts") ||
1499
- normalized.endsWith("/services/devtoolsservice.ts")) {
1500
- return -66 + focusBonus;
1501
- }
1502
- if (normalized.endsWith("/api/endpoints/devtools.py") ||
1503
- normalized.endsWith("/services/session_trace_archive.py") ||
1504
- normalized.endsWith("/services/codex_trace.py") ||
1505
- normalized.endsWith("/models/db_models/session_trace_archive.py") ||
1506
- normalized.endsWith("/models/schemas/devtools.py") ||
1507
- normalized.endsWith("/types/devtools.types.ts")) {
1508
- if (devtoolsDebugIsFrontendRowTask(taskTokens)) {
1509
- return -12;
1510
- }
1511
- return -36;
1512
- }
1513
- if (normalized.endsWith("/components/right-panel/rightpanel.tsx") ||
1514
- normalized.endsWith("/components/chat/message-bubble/message.tsx")) {
1515
- return -20;
1516
- }
1517
- if ((isTestPath(normalized) || normalized.includes("/__mocks__/")) &&
1518
- normalized.includes("virtualizer")) {
1519
- return -74 + focusBonus;
1520
- }
1521
- if (bytes > SMALL_CLOSURE_MAX_BYTES) {
1522
- return 12;
1523
- }
1524
- return 0;
1525
- }
1526
- function devtoolsDebugIsFrontendRowTask(taskTokens) {
1527
- return (taskTokens.has("row") ||
1528
- taskTokens.has("search") ||
1529
- taskTokens.has("filter") ||
1530
- taskTokens.has("filtered") ||
1531
- taskTokens.has("virtualizer") ||
1532
- taskTokens.has("visible") ||
1533
- taskTokens.has("click") ||
1534
- taskTokens.has("click-through"));
1535
- }
1536
- function isRuntimeSettingsDiscoveryTask(taskTokens) {
1537
- return taskTokens.has("discovery") && taskTokens.has("runtime");
1538
- }
1539
- function isCodexRuntimeReviewTask(taskTokens) {
1540
- return (taskTokens.has("review") &&
1541
- taskTokens.has("codex") &&
1542
- (taskTokens.has("runtime") ||
1543
- taskTokens.has("approval") ||
1544
- taskTokens.has("session") ||
1545
- taskTokens.has("stream") ||
1546
- taskTokens.has("permission")));
1547
- }
1548
- function codexReviewWantsModelGate(taskTokens) {
1549
- return (taskTokens.has("model") ||
1550
- taskTokens.has("provider") ||
1551
- taskTokens.has("capability") ||
1552
- taskTokens.has("check"));
1553
- }
1554
- function codexReviewWantsFrontendGate(taskTokens) {
1555
- return (taskTokens.has("frontend") ||
1556
- taskTokens.has("consumer") ||
1557
- taskTokens.has("file") ||
1558
- taskTokens.has("upload") ||
1559
- taskTokens.has("gating") ||
1560
- taskTokens.has("attachment") ||
1561
- codexReviewWantsModelGate(taskTokens));
1562
- }
1563
- function isDevtoolsTraceDebugTask(taskTokens) {
1564
- return ((taskTokens.has("debug") ||
1565
- taskTokens.has("debugging") ||
1566
- taskTokens.has("diagnose") ||
1567
- taskTokens.has("diagnosis") ||
1568
- taskTokens.has("diagnostic")) &&
1569
- (taskTokens.has("devtool") || (taskTokens.has("dev") && taskTokens.has("tool"))) &&
1570
- taskTokens.has("trace"));
1571
- }
1572
1034
  function crossSourceFocusedSafetyTestRank(left, right) {
1573
1035
  if (left.source === right.source) {
1574
1036
  return 0;
@@ -1600,8 +1062,8 @@ function isImplementationPath(path) {
1600
1062
  return false;
1601
1063
  }
1602
1064
  return (path.startsWith("src/") ||
1603
- path.startsWith("frontend/src/") ||
1604
- path.startsWith("backend/app/"));
1065
+ path.includes("/src/") ||
1066
+ path.includes("/app/"));
1605
1067
  }
1606
1068
  function isProjectDocPath(path) {
1607
1069
  return (path.startsWith("docs/") ||