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
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Shared chairman invocation-knob resolution.
3
+ *
4
+ * Provider change (caller chairman is set AND differs from the static
5
+ * cli_name) drops inherited model/effort; only explicit chairman knobs apply.
6
+ * Same provider keeps unspecified static pins and overlays supplied knobs.
7
+ */
8
+ export interface ChairmanCallPins {
9
+ readonly cli_name: string;
10
+ readonly model?: string | undefined;
11
+ readonly effort?: string | undefined;
12
+ }
13
+ export interface ResolveEffectiveChairmanCallInput {
14
+ readonly staticCall: ChairmanCallPins;
15
+ readonly chairmanCliName: string | undefined;
16
+ readonly chairmanModel: string | undefined;
17
+ readonly chairmanEffort: string | undefined;
18
+ }
19
+ export interface EffectiveChairmanCall {
20
+ readonly cli_name: string;
21
+ readonly model?: string;
22
+ readonly effort?: string;
23
+ }
24
+ export declare function resolveEffectiveChairmanCall(input: ResolveEffectiveChairmanCallInput): EffectiveChairmanCall;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Shared chairman invocation-knob resolution.
3
+ *
4
+ * Provider change (caller chairman is set AND differs from the static
5
+ * cli_name) drops inherited model/effort; only explicit chairman knobs apply.
6
+ * Same provider keeps unspecified static pins and overlays supplied knobs.
7
+ */
8
+ export function resolveEffectiveChairmanCall(input) {
9
+ const { staticCall, chairmanCliName, chairmanModel, chairmanEffort } = input;
10
+ const providerChanged = chairmanCliName != null && chairmanCliName !== staticCall.cli_name;
11
+ const model = chairmanModel !== undefined
12
+ ? chairmanModel
13
+ : providerChanged
14
+ ? undefined
15
+ : staticCall.model;
16
+ const effort = chairmanEffort !== undefined
17
+ ? chairmanEffort
18
+ : providerChanged
19
+ ? undefined
20
+ : staticCall.effort;
21
+ return {
22
+ cli_name: chairmanCliName ?? staticCall.cli_name,
23
+ ...(model !== undefined ? { model } : {}),
24
+ ...(effort !== undefined ? { effort } : {}),
25
+ };
26
+ }
27
+ //# sourceMappingURL=chairman-knobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chairman-knobs.js","sourceRoot":"","sources":["../src/chairman-knobs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,MAAM,UAAU,4BAA4B,CAC1C,KAAwC;IAExC,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAC7E,MAAM,eAAe,GACnB,eAAe,IAAI,IAAI,IAAI,eAAe,KAAK,UAAU,CAAC,QAAQ,CAAC;IACrE,MAAM,KAAK,GAAG,aAAa,KAAK,SAAS;QACvC,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,eAAe;YACf,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;IACvB,MAAM,MAAM,GAAG,cAAc,KAAK,SAAS;QACzC,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,eAAe;YACf,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;IAExB,OAAO;QACL,QAAQ,EAAE,eAAe,IAAI,UAAU,CAAC,QAAQ;QAChD,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Citation check post-processor.
3
+ *
4
+ * Deterministically filters citation "evidence" in code-review schema outputs
5
+ * down to files that actually exist in the review's allowlist (the union of
6
+ * diff-touched files, caller-provided context_files, and curated
7
+ * context_bundle_files). Unverifiable evidence is dropped; findings are never
8
+ * deleted — when a finding's only support was unverifiable its confidence is
9
+ * capped so it cannot masquerade as high-confidence.
10
+ *
11
+ * Pure and side-effect free: operates on a deep clone of the input.
12
+ */
13
+ /** Context handed to {@link citationCheck} by the post-processor registry. */
14
+ export interface CitationCheckContext {
15
+ readonly allowlist: Set<string>;
16
+ readonly schemaId: string;
17
+ }
18
+ /**
19
+ * Add a path and its basename to the allowlist so matching is lenient
20
+ * (a citation may reference either the repo-relative path or the bare file).
21
+ */
22
+ export declare function addPathWithBasename(set: Set<string>, p: string): void;
23
+ /**
24
+ * Parse a unified diff string into an allowlist of touched files (full path
25
+ * plus basename for each). Recognizes `diff --git a/x b/x`, `+++ b/x`, and
26
+ * `--- a/x` header lines. `/dev/null` sentinels are excluded.
27
+ */
28
+ export declare function buildAllowlistFromDiff(diff: string): Set<string>;
29
+ /**
30
+ * Filter unverifiable citations from a code-review schema artifact.
31
+ *
32
+ * Only acts when `ctx.schemaId` identifies a code-review schema (id includes
33
+ * `"code_review"`); otherwise the input is returned unchanged. Both the
34
+ * reviewer and cross-reviewer shapes are handled defensively — missing/optional
35
+ * fields are tolerated, and the input is deep-cloned before mutation.
36
+ */
37
+ export declare function citationCheck(validated: unknown, ctx: {
38
+ allowlist: Set<string>;
39
+ schemaId: string;
40
+ }): unknown;
@@ -0,0 +1,348 @@
1
+ /**
2
+ * Citation check post-processor.
3
+ *
4
+ * Deterministically filters citation "evidence" in code-review schema outputs
5
+ * down to files that actually exist in the review's allowlist (the union of
6
+ * diff-touched files, caller-provided context_files, and curated
7
+ * context_bundle_files). Unverifiable evidence is dropped; findings are never
8
+ * deleted — when a finding's only support was unverifiable its confidence is
9
+ * capped so it cannot masquerade as high-confidence.
10
+ *
11
+ * Pure and side-effect free: operates on a deep clone of the input.
12
+ */
13
+ import { basename } from "node:path";
14
+ /** Confidence ceiling applied to findings/refs whose citations don't verify. */
15
+ const UNVERIFIED_CONFIDENCE_CAP = 50;
16
+ // ---------------------------------------------------------------------------
17
+ // Allowlist construction
18
+ // ---------------------------------------------------------------------------
19
+ /**
20
+ * Add a path and its basename to the allowlist so matching is lenient
21
+ * (a citation may reference either the repo-relative path or the bare file).
22
+ */
23
+ export function addPathWithBasename(set, p) {
24
+ if (typeof p !== "string" || p.length === 0) {
25
+ return;
26
+ }
27
+ set.add(p);
28
+ set.add(basename(p));
29
+ }
30
+ /** Strip a unified-diff `a/` or `b/` path prefix. */
31
+ function stripDiffPrefix(token) {
32
+ if (token.startsWith("a/") || token.startsWith("b/")) {
33
+ return token.slice(2);
34
+ }
35
+ return token;
36
+ }
37
+ /**
38
+ * Parse a unified diff string into an allowlist of touched files (full path
39
+ * plus basename for each). Recognizes `diff --git a/x b/x`, `+++ b/x`, and
40
+ * `--- a/x` header lines. `/dev/null` sentinels are excluded.
41
+ */
42
+ export function buildAllowlistFromDiff(diff) {
43
+ const set = new Set();
44
+ if (typeof diff !== "string" || diff.length === 0) {
45
+ return set;
46
+ }
47
+ for (const line of diff.split(/\r?\n/)) {
48
+ if (line.startsWith("diff --git ")) {
49
+ const rest = line.slice("diff --git ".length).trim();
50
+ for (const token of rest.split(/\s+/)) {
51
+ addPathWithBasename(set, stripDiffPrefix(token));
52
+ }
53
+ }
54
+ else if (line.startsWith("+++ ") || line.startsWith("--- ")) {
55
+ addPathWithBasename(set, stripDiffPrefix(line.slice(4).trim()));
56
+ }
57
+ }
58
+ set.delete("/dev/null");
59
+ set.delete("null");
60
+ return set;
61
+ }
62
+ // ---------------------------------------------------------------------------
63
+ // Matching helpers
64
+ // ---------------------------------------------------------------------------
65
+ function isRecord(value) {
66
+ return typeof value === "object" && value !== null && !Array.isArray(value);
67
+ }
68
+ /** Extract the file portion of a `path` or `path:line` location string. */
69
+ function fileFromLocation(location) {
70
+ if (typeof location !== "string" || location.length === 0) {
71
+ return undefined;
72
+ }
73
+ const colon = location.indexOf(":");
74
+ const file = colon === -1 ? location : location.slice(0, colon);
75
+ return file.length > 0 ? file : undefined;
76
+ }
77
+ /**
78
+ * True when `shorter` is a separator-aware path-suffix of `longer` (or equal):
79
+ * `src/foo.ts` is a suffix of `/abs/src/foo.ts` (the latter ends with `/` +
80
+ * the former). Handles both `/` and `\` separators. Used to recognize that the
81
+ * relative and absolute forms of the SAME file are not two distinct files.
82
+ */
83
+ function isPathSuffix(longer, shorter) {
84
+ if (longer === shorter) {
85
+ return true;
86
+ }
87
+ if (longer.length <= shorter.length || !longer.endsWith(shorter)) {
88
+ return false;
89
+ }
90
+ const boundary = longer[longer.length - shorter.length - 1];
91
+ return boundary === "/" || boundary === "\\";
92
+ }
93
+ /**
94
+ * Count, per basename, how many DISTINCT FILE IDENTITIES in the allowlist share
95
+ * that basename.
96
+ *
97
+ * The allowlist is a flat Set mixing full repo-relative paths AND bare
98
+ * basenames (see {@link addPathWithBasename}). To decide whether a basename
99
+ * match is *unambiguous* we only consider path-bearing entries — i.e. entries
100
+ * that contain a path separator. (A bare-basename entry carries no directory
101
+ * information, so it cannot disambiguate one directory from another.)
102
+ *
103
+ * Crucially, the engine's `resolvePathListLenient` adds BOTH the raw-relative
104
+ * and the resolved-absolute form of each context file, so one real file yields
105
+ * two string-distinct entries (`src/foo.ts` and `/abs/.../src/foo.ts`) that
106
+ * share a basename. Counting those as 2 would wrongly mark a legitimate
107
+ * bare-basename citation as ambiguous. So within each basename group we collapse
108
+ * entries where one path is a separator-aware suffix of another (the same file
109
+ * in two forms) and count only the resulting distinct identities. Two genuinely
110
+ * different files (`src/a/foo.ts`, `src/b/foo.ts`) are not suffixes of each
111
+ * other, so they remain count 2 — correctly ambiguous.
112
+ *
113
+ * When a basename maps to two-or-more distinct identities it is ambiguous, so a
114
+ * basename-only citation is rejected; mapping to 0 or 1 is unambiguous and
115
+ * accepted (see {@link isAllowedFile}).
116
+ *
117
+ * Note: this is advisory defense-in-depth against fabricated LLM citations,
118
+ * not a security boundary.
119
+ */
120
+ function buildBasenameMultiplicity(allowlist) {
121
+ // Bucket path-bearing entries by basename first, deduping exact strings.
122
+ const groups = new Map();
123
+ const seenPaths = new Set();
124
+ for (const entry of allowlist) {
125
+ // Only path-bearing entries (those with a separator) disambiguate.
126
+ if (!entry.includes("/") && !entry.includes("\\")) {
127
+ continue;
128
+ }
129
+ if (seenPaths.has(entry)) {
130
+ continue;
131
+ }
132
+ seenPaths.add(entry);
133
+ const base = basename(entry);
134
+ const group = groups.get(base);
135
+ if (group === undefined) {
136
+ groups.set(base, [entry]);
137
+ }
138
+ else {
139
+ group.push(entry);
140
+ }
141
+ }
142
+ // Within each (tiny) group, collapse suffix-duplicates of the same file to a
143
+ // single identity. O(group^2); groups are small.
144
+ const counts = new Map();
145
+ for (const [base, paths] of groups) {
146
+ let identities = 0;
147
+ for (let i = 0; i < paths.length; i++) {
148
+ const candidate = paths[i];
149
+ let collapsed = false;
150
+ for (let j = 0; j < paths.length; j++) {
151
+ if (i === j) {
152
+ continue;
153
+ }
154
+ const other = paths[j];
155
+ // `candidate` collapses into `other` when `candidate` is a suffix of the
156
+ // strictly longer `other` (so each same-file pair is counted exactly
157
+ // once, via its longest/absolute form).
158
+ if (other.length > candidate.length && isPathSuffix(other, candidate)) {
159
+ collapsed = true;
160
+ break;
161
+ }
162
+ }
163
+ if (!collapsed) {
164
+ identities++;
165
+ }
166
+ }
167
+ counts.set(base, identities);
168
+ }
169
+ return counts;
170
+ }
171
+ /**
172
+ * A file citation is verified when:
173
+ * - it carries a directory component and exactly matches a full-path allowlist
174
+ * entry; OR
175
+ * - it is a bare basename present in the allowlist whose basename is
176
+ * unambiguous (fewer than two distinct full paths share it).
177
+ *
178
+ * The basename fallback is deliberately conservative: common filenames
179
+ * (index.ts, schema.ts, handler.ts) collide across directories, so a
180
+ * directory-qualified citation that does not match a full path is NOT downgraded
181
+ * to a basename match — this stops a fabricated `src/unrelated/schema.ts` from
182
+ * riding on an unrelated `schema.ts` already in the allowlist. Advisory
183
+ * defense-in-depth, not a security boundary.
184
+ */
185
+ function isAllowedFile(file, allowlist, basenameMultiplicity) {
186
+ const base = basename(file);
187
+ // Citation carries a directory component: require an exact full-path match.
188
+ // Do NOT fall back to a basename match — a citation that was specific about a
189
+ // directory that isn't allowed (e.g. a fabricated `src/unrelated/schema.ts`)
190
+ // must not ride on an allowed `src/other/schema.ts`. Note we cannot rely on
191
+ // `allowlist.has(file)` alone for the bare case because the allowlist also
192
+ // stores bare basenames (see addPathWithBasename), so a bare-basename
193
+ // citation would always "match" without the multiplicity gate below.
194
+ if (file !== base) {
195
+ return allowlist.has(file);
196
+ }
197
+ // Bare-basename citation: accept only when that basename is present AND
198
+ // unambiguous. Ambiguity means TWO OR MORE distinct full paths share the
199
+ // basename — only then could the bare citation point at the wrong file.
200
+ // Multiplicity 0 (the entry exists only as a bare basename / a root-level
201
+ // file with no directory variants) or 1 is unambiguous and accepted; >=2 is
202
+ // rejected.
203
+ if (!allowlist.has(base)) {
204
+ return false;
205
+ }
206
+ return (basenameMultiplicity.get(base) ?? 0) < 2;
207
+ }
208
+ /**
209
+ * Cap a finding/ref's confidence to {@link UNVERIFIED_CONFIDENCE_CAP} because
210
+ * its citation did not verify. Confidence is OPTIONAL in the schema, so:
211
+ * - if it is already a number, lower it to the cap (never raised);
212
+ * - if it is absent / non-numeric, SET it to the cap so every unverifiable
213
+ * finding carries an explicit low-confidence signal.
214
+ * Mutates the (deep-cloned) record in place; never deletes the finding/ref.
215
+ */
216
+ function capUnverifiedConfidence(record) {
217
+ const existing = record["confidence"];
218
+ const numeric = typeof existing === "number" ? existing : undefined;
219
+ record["confidence"] = Math.min(numeric ?? UNVERIFIED_CONFIDENCE_CAP, UNVERIFIED_CONFIDENCE_CAP);
220
+ }
221
+ /** An evidence entry is verifiable iff its `.location` file is in the allowlist. */
222
+ function isAllowedEvidence(entry, allowlist, basenameMultiplicity) {
223
+ const file = fileFromLocation(isRecord(entry) ? entry["location"] : undefined);
224
+ if (file === undefined) {
225
+ return false;
226
+ }
227
+ return isAllowedFile(file, allowlist, basenameMultiplicity);
228
+ }
229
+ // ---------------------------------------------------------------------------
230
+ // Schema walks
231
+ // ---------------------------------------------------------------------------
232
+ /**
233
+ * Reviewer schema: validate `<key>[].file` and filter `<key>[].evidence[]`
234
+ * against the allowlist. Confidence is capped/set to {@link UNVERIFIED_CONFIDENCE_CAP}
235
+ * when EITHER the finding's top-level `file` is set but not allowed (a fabricated
236
+ * primary file — mirrors {@link processRefs} semantics), OR the finding had
237
+ * evidence that was entirely filtered out. Because confidence is OPTIONAL, an
238
+ * unverified finding that OMITS confidence gets it SET to the cap so it can't
239
+ * masquerade as unscored/high-confidence (see {@link capUnverifiedConfidence}).
240
+ * Never remove the finding itself.
241
+ */
242
+ function processReviewerFindings(root, key, allowlist, basenameMultiplicity) {
243
+ const findings = root[key];
244
+ if (!Array.isArray(findings)) {
245
+ return;
246
+ }
247
+ for (const finding of findings) {
248
+ if (!isRecord(finding)) {
249
+ continue;
250
+ }
251
+ // Top-level `file` validation (mirrors processRefs). A fabricated primary
252
+ // file caps confidence even when the finding carries no evidence, or carries
253
+ // valid evidence pointing at a *different* allowed file.
254
+ const file = finding["file"];
255
+ const fileUnverified = typeof file === "string" &&
256
+ file.length > 0 &&
257
+ !isAllowedFile(file, allowlist, basenameMultiplicity);
258
+ let evidenceUnverified = false;
259
+ const evidence = finding["evidence"];
260
+ if (Array.isArray(evidence)) {
261
+ const hadEvidence = evidence.length > 0;
262
+ const kept = evidence.filter((entry) => isAllowedEvidence(entry, allowlist, basenameMultiplicity));
263
+ finding["evidence"] = kept;
264
+ evidenceUnverified = hadEvidence && kept.length === 0;
265
+ }
266
+ if (fileUnverified || evidenceUnverified) {
267
+ capUnverifiedConfidence(finding);
268
+ }
269
+ }
270
+ }
271
+ /**
272
+ * Cross-reviewer refs: drop invalid evidence; cap/set confidence to the cap when
273
+ * EITHER the ref's `.file` is set but not in the allowlist (a fabricated primary
274
+ * file), OR the ref HAD evidence that was entirely filtered out (mirrors
275
+ * {@link processReviewerFindings} semantics — `file`, `evidence`, and
276
+ * `confidence` are all OPTIONAL in the cross-review ref schema, so a ref with no
277
+ * `file`, fabricated evidence, and no `confidence` must still be downgraded). An
278
+ * omitted confidence value is SET to the cap so it cannot masquerade as
279
+ * unscored/high-confidence. Refs are never dropped.
280
+ */
281
+ function processRefs(refs, allowlist, basenameMultiplicity) {
282
+ if (!Array.isArray(refs)) {
283
+ return;
284
+ }
285
+ for (const ref of refs) {
286
+ if (!isRecord(ref)) {
287
+ continue;
288
+ }
289
+ let evidenceUnverified = false;
290
+ const evidence = ref["evidence"];
291
+ if (Array.isArray(evidence)) {
292
+ const hadEvidence = evidence.length > 0;
293
+ const kept = evidence.filter((entry) => isAllowedEvidence(entry, allowlist, basenameMultiplicity));
294
+ ref["evidence"] = kept;
295
+ evidenceUnverified = hadEvidence && kept.length === 0;
296
+ }
297
+ const file = ref["file"];
298
+ const fileUnverified = typeof file === "string" &&
299
+ file.length > 0 &&
300
+ !isAllowedFile(file, allowlist, basenameMultiplicity);
301
+ if (fileUnverified || evidenceUnverified) {
302
+ capUnverifiedConfidence(ref);
303
+ }
304
+ }
305
+ }
306
+ function processCrossReviewer(root, allowlist, basenameMultiplicity) {
307
+ const feedback = root["per_review_feedback"];
308
+ if (!Array.isArray(feedback)) {
309
+ return;
310
+ }
311
+ for (const fb of feedback) {
312
+ if (!isRecord(fb)) {
313
+ continue;
314
+ }
315
+ processRefs(fb["missed_issue_refs"], allowlist, basenameMultiplicity);
316
+ processRefs(fb["false_positive_refs"], allowlist, basenameMultiplicity);
317
+ }
318
+ }
319
+ // ---------------------------------------------------------------------------
320
+ // Entry point
321
+ // ---------------------------------------------------------------------------
322
+ /**
323
+ * Filter unverifiable citations from a code-review schema artifact.
324
+ *
325
+ * Only acts when `ctx.schemaId` identifies a code-review schema (id includes
326
+ * `"code_review"`); otherwise the input is returned unchanged. Both the
327
+ * reviewer and cross-reviewer shapes are handled defensively — missing/optional
328
+ * fields are tolerated, and the input is deep-cloned before mutation.
329
+ */
330
+ export function citationCheck(validated, ctx) {
331
+ if (!ctx.schemaId.includes("code_review")) {
332
+ return validated;
333
+ }
334
+ const clone = structuredClone(validated);
335
+ if (!isRecord(clone)) {
336
+ return clone;
337
+ }
338
+ // Precompute basename → full-path multiplicity once per call so the matching
339
+ // helpers can reject ambiguous basename-only citations (Fix #4).
340
+ const basenameMultiplicity = buildBasenameMultiplicity(ctx.allowlist);
341
+ // Reviewer schema locations.
342
+ processReviewerFindings(clone, "blocking_issues", ctx.allowlist, basenameMultiplicity);
343
+ processReviewerFindings(clone, "structural_findings", ctx.allowlist, basenameMultiplicity);
344
+ // Cross-reviewer schema locations.
345
+ processCrossReviewer(clone, ctx.allowlist, basenameMultiplicity);
346
+ return clone;
347
+ }
348
+ //# sourceMappingURL=citation-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"citation-check.js","sourceRoot":"","sources":["../src/citation-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAQrC,gFAAgF;AAChF,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAErC,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAgB,EAAE,CAAS;IAC7D,IAAI,OAAO,CAAC,KAAK,QA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AAC,CAAC;QACtE,WAAW,CAAC,EAAE,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,SAAkB,EAClB,GAAiD;IAEjD,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6EAA6E;IAC7E,iEAAiE;IACjE,MAAM,oBAAoB,GAAG,yBAAyB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEtE,6BAA6B;IAC7B,uBAAuB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IACvF,uBAAuB,CAAC,KAAK,EAAE,qBAAqB,EAAE,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAC3F,mCAAmC;IACnC,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAEjE,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -13,6 +13,8 @@
13
13
  * - Only output_text is stored/threaded/hashed
14
14
  */
15
15
  import type { ClinkBackend, ToolCallResult } from "./backend.js";
16
+ import type { SessionLogOwnerV1 } from "./dashboard/session-log-contract.js";
17
+ import { type ObservedInvocationV1 } from "./dashboard/invocation-contract.js";
16
18
  /** Parsed result from a clink call. */
17
19
  export interface ClinkCallResult {
18
20
  /** Primary output text (for storage/threading/hashing). */
@@ -48,4 +50,13 @@ export declare function parseCallResult(result: ToolCallResult): ClinkCallResult
48
50
  export declare function callClink(session: ClinkBackend, input: Record<string, unknown>, signal?: AbortSignal, context?: {
49
51
  stageId: string;
50
52
  callId: string;
51
- }, timeoutMs?: number): Promise<ClinkCallResult>;
53
+ }, timeoutMs?: number, sessionLogOwner?: SessionLogOwnerV1): Promise<ClinkCallResult>;
54
+ /**
55
+ * Extract a runtime-observed invocation record from a child `_debug` block.
56
+ *
57
+ * Best-effort telemetry: returns undefined when the block is absent, the
58
+ * `observed_invocation` key is missing, or the payload does not satisfy
59
+ * ObservedInvocationV1Schema. Never throws — malformed observed telemetry
60
+ * must not affect call success/failure handling.
61
+ */
62
+ export declare function extractObservedInvocation(debug: Record<string, unknown> | null): ObservedInvocationV1 | undefined;
@@ -15,6 +15,8 @@
15
15
  import { InvalidCallError, CallExecutionError } from "./errors.js";
16
16
  import { logger } from "./logger.js";
17
17
  import { basename } from "node:path";
18
+ import { ErrorCode } from "@modelcontextprotocol/sdk/types.js";
19
+ import { ObservedInvocationV1Schema, } from "./dashboard/invocation-contract.js";
18
20
  /**
19
21
  * Build the tool arguments for a child clink call.
20
22
  *
@@ -24,12 +26,16 @@ import { basename } from "node:path";
24
26
  export function buildCallArgs(input) {
25
27
  // Clone to avoid mutating caller's input
26
28
  const args = { ...input };
29
+ delete args["sessionLogOwner"];
30
+ delete args["session_log_owner"];
27
31
  // Always enable debug for internal calls
28
32
  args["debug"] = true;
29
33
  // Strip host _meta.progressToken (1-11a: progress isolation)
30
34
  if (args["_meta"] != null && typeof args["_meta"] === "object") {
31
35
  const meta = { ...args["_meta"] };
32
36
  delete meta["progressToken"];
37
+ delete meta["sessionLogOwner"];
38
+ delete meta["session_log_owner"];
33
39
  // Only keep _meta if it still has keys
34
40
  if (Object.keys(meta).length > 0) {
35
41
  args["_meta"] = meta;
@@ -96,16 +102,17 @@ function sanitizeDebugMetadataForLog(debug) {
96
102
  * @throws InvalidCallError on child -32602
97
103
  * @throws CallExecutionError on child isError: true
98
104
  */
99
- export async function callClink(session, input, signal, context, timeoutMs) {
105
+ export async function callClink(session, input, signal, context, timeoutMs, sessionLogOwner) {
100
106
  const args = buildCallArgs(input);
101
107
  const stageId = context?.stageId ?? "unknown";
102
108
  const callId = context?.callId ?? "unknown";
103
109
  let result;
104
110
  try {
105
- result = await session.callTool(args, signal != null || timeoutMs != null
111
+ result = await session.callTool(args, signal != null || timeoutMs != null || sessionLogOwner != null
106
112
  ? {
107
113
  ...(signal != null ? { signal } : {}),
108
114
  ...(timeoutMs != null ? { timeoutMs } : {}),
115
+ ...(sessionLogOwner != null ? { sessionLogOwner } : {}),
109
116
  }
110
117
  : undefined);
111
118
  }
@@ -114,6 +121,12 @@ export async function callClink(session, input, signal, context, timeoutMs) {
114
121
  if (isMcpInvalidParams(err)) {
115
122
  throw new InvalidCallError(`Child rejected call as invalid: ${err instanceof Error ? err.message : String(err)}`, stageId, callId);
116
123
  }
124
+ // The MCP SDK emits this structured code when its RequestOptions.timeout
125
+ // expires. Preserve it as an internal wall-timeout discriminant so the
126
+ // engine can apply council policy without relying on error text.
127
+ if (isMcpRequestTimeout(err)) {
128
+ throw new CallExecutionError(`Child clink request timed out: ${err instanceof Error ? err.message : String(err)}`, stageId, callId, thrownFailureClass(err), undefined, "wall");
129
+ }
117
130
  throw err;
118
131
  }
119
132
  // Map child isError: true to CallExecutionError
@@ -121,11 +134,20 @@ export async function callClink(session, input, signal, context, timeoutMs) {
121
134
  const parsed = parseCallResult(result);
122
135
  const failureClass = classifyFailure(parsed.debugMetadata);
123
136
  const childDebugMetadata = extractChildFailureMetadata(parsed.debugMetadata);
137
+ const terminationReasonValue = parsed.debugMetadata?.["termination_reason"];
138
+ const terminationReason = terminationReasonValue === "wall" || terminationReasonValue === "idle"
139
+ ? terminationReasonValue
140
+ : undefined;
124
141
  // Fallback: if pipeline missed the panic class (e.g. wrapper formatting
125
142
  // differences), detect the codex-local crash signature in output text.
143
+ // Structured metadata takes precedence: when the child's _debug already
144
+ // carries a codex_panic_class, trust that classification and skip
145
+ // prose re-synthesis (kept only for old children without structured _debug).
126
146
  let effectiveFailureClass = failureClass;
127
147
  let effectiveChildDebugMetadata = childDebugMetadata;
128
- if (failureClass === "permanent" && parsed.outputText != null) {
148
+ if (failureClass === "permanent" &&
149
+ parsed.outputText != null &&
150
+ childDebugMetadata?.codex_panic_class == null) {
129
151
  const codexLocalMatch = parsed.outputText.match(/\[codex-local\]:?\s*Local Codex process failed(?::\s*Process exited with code:\s*(\d+))?/);
130
152
  if (codexLocalMatch != null) {
131
153
  const exitCode = codexLocalMatch[1] != null ? Number(codexLocalMatch[1]) : null;
@@ -150,10 +172,24 @@ export async function callClink(session, input, signal, context, timeoutMs) {
150
172
  effective_failure_class: effectiveFailureClass,
151
173
  debug: sanitizeDebugMetadataForLog(parsed.debugMetadata),
152
174
  }, "child clink call returned isError");
153
- throw new CallExecutionError(parsed.outputText || "Child clink call failed", stageId, callId, effectiveFailureClass, effectiveChildDebugMetadata);
175
+ throw new CallExecutionError(parsed.outputText || "Child clink call failed", stageId, callId, effectiveFailureClass, effectiveChildDebugMetadata, terminationReason);
154
176
  }
155
177
  return parseCallResult(result);
156
178
  }
179
+ /**
180
+ * Extract a runtime-observed invocation record from a child `_debug` block.
181
+ *
182
+ * Best-effort telemetry: returns undefined when the block is absent, the
183
+ * `observed_invocation` key is missing, or the payload does not satisfy
184
+ * ObservedInvocationV1Schema. Never throws — malformed observed telemetry
185
+ * must not affect call success/failure handling.
186
+ */
187
+ export function extractObservedInvocation(debug) {
188
+ if (debug == null)
189
+ return undefined;
190
+ const parsed = ObservedInvocationV1Schema.safeParse(debug["observed_invocation"]);
191
+ return parsed.success ? parsed.data : undefined;
192
+ }
157
193
  /**
158
194
  * Panic classes confirmed as transient (retryable). Only classes with strong
159
195
  * evidence of being transport-layer failures belong here. `codex_local_crash`
@@ -222,11 +258,14 @@ function extractChildFailureMetadata(debug) {
222
258
  adapter_config_path: typeof debug["adapter_config_path"] === "string" ? debug["adapter_config_path"] : undefined,
223
259
  exit_code: typeof debug["exit_code"] === "number" || debug["exit_code"] === null ? debug["exit_code"] : undefined,
224
260
  codex_panic_class: typeof debug["codex_panic_class"] === "string" ? debug["codex_panic_class"] : undefined,
261
+ semantic_failure_reason: typeof debug["semantic_failure_reason"] === "string" ? debug["semantic_failure_reason"] : undefined,
262
+ secondary_failure_reason: typeof debug["secondary_failure_reason"] === "string" ? debug["secondary_failure_reason"] : undefined,
225
263
  };
226
264
  // Only return if at least one field is present
227
265
  const hasContent = meta.rejection_reason != null || meta.parse_status != null ||
228
266
  meta.parse_source != null || meta.adapter_config_path != null || meta.exit_code !== undefined ||
229
- meta.codex_panic_class != null;
267
+ meta.codex_panic_class != null || meta.semantic_failure_reason != null ||
268
+ meta.secondary_failure_reason != null;
230
269
  return hasContent ? meta : undefined;
231
270
  }
232
271
  /**
@@ -238,4 +277,16 @@ function isMcpInvalidParams(err) {
238
277
  const code = err["code"];
239
278
  return code === -32602;
240
279
  }
280
+ function isMcpRequestTimeout(err) {
281
+ if (err == null || typeof err !== "object")
282
+ return false;
283
+ const code = err["code"];
284
+ return code === ErrorCode.RequestTimeout;
285
+ }
286
+ function thrownFailureClass(err) {
287
+ if (err == null || typeof err !== "object")
288
+ return "permanent";
289
+ const failureClass = err["failureClass"];
290
+ return failureClass === "transient" ? "transient" : "permanent";
291
+ }
241
292
  //# sourceMappingURL=clink-client.js.map