clinkx 0.2.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (574) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE +10 -0
  3. package/README.md +113 -18
  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/citation-check.d.ts +40 -0
  12. package/clinkx-workflows/dist/citation-check.js +348 -0
  13. package/clinkx-workflows/dist/citation-check.js.map +1 -0
  14. package/clinkx-workflows/dist/clink-client.d.ts +2 -1
  15. package/clinkx-workflows/dist/clink-client.js +17 -4
  16. package/clinkx-workflows/dist/clink-client.js.map +1 -1
  17. package/clinkx-workflows/dist/config.d.ts +145 -16
  18. package/clinkx-workflows/dist/config.js +384 -26
  19. package/clinkx-workflows/dist/config.js.map +1 -1
  20. package/clinkx-workflows/dist/contained-file.d.ts +172 -0
  21. package/clinkx-workflows/dist/contained-file.js +483 -0
  22. package/clinkx-workflows/dist/contained-file.js.map +1 -0
  23. package/clinkx-workflows/dist/context-builder-lifecycle-contract.d.ts +416 -0
  24. package/clinkx-workflows/dist/context-builder-lifecycle-contract.js +328 -0
  25. package/clinkx-workflows/dist/context-builder-lifecycle-contract.js.map +1 -0
  26. package/clinkx-workflows/dist/context-builder-lifecycle-router.d.ts +24 -0
  27. package/clinkx-workflows/dist/context-builder-lifecycle-router.js +39 -0
  28. package/clinkx-workflows/dist/context-builder-lifecycle-router.js.map +1 -0
  29. package/clinkx-workflows/dist/context-cache-key.d.ts +53 -0
  30. package/clinkx-workflows/dist/context-cache-key.js +91 -0
  31. package/clinkx-workflows/dist/context-cache-key.js.map +1 -0
  32. package/clinkx-workflows/dist/context-mode-resolver.d.ts +27 -0
  33. package/clinkx-workflows/dist/context-mode-resolver.js +126 -0
  34. package/clinkx-workflows/dist/context-mode-resolver.js.map +1 -0
  35. package/clinkx-workflows/dist/context-preflight.d.ts +184 -0
  36. package/clinkx-workflows/dist/context-preflight.js +91 -0
  37. package/clinkx-workflows/dist/context-preflight.js.map +1 -0
  38. package/clinkx-workflows/dist/council-expander.d.ts +1 -1
  39. package/clinkx-workflows/dist/council-expander.js +2 -1
  40. package/clinkx-workflows/dist/council-expander.js.map +1 -1
  41. package/clinkx-workflows/dist/dashboard/activity-contract.d.ts +165 -0
  42. package/clinkx-workflows/dist/dashboard/activity-contract.js +105 -0
  43. package/clinkx-workflows/dist/dashboard/activity-contract.js.map +1 -0
  44. package/clinkx-workflows/dist/dashboard/activity-lease.d.ts +25 -0
  45. package/clinkx-workflows/dist/dashboard/activity-lease.js +34 -0
  46. package/clinkx-workflows/dist/dashboard/activity-lease.js.map +1 -0
  47. package/clinkx-workflows/dist/dashboard/activity-reader.d.ts +86 -0
  48. package/clinkx-workflows/dist/dashboard/activity-reader.js +480 -0
  49. package/clinkx-workflows/dist/dashboard/activity-reader.js.map +1 -0
  50. package/clinkx-workflows/dist/dashboard/api-routes.d.ts +36 -0
  51. package/clinkx-workflows/dist/dashboard/api-routes.js +1047 -0
  52. package/clinkx-workflows/dist/dashboard/api-routes.js.map +1 -0
  53. package/clinkx-workflows/dist/dashboard/artifact-index.d.ts +37 -0
  54. package/clinkx-workflows/dist/dashboard/artifact-index.js +145 -0
  55. package/clinkx-workflows/dist/dashboard/artifact-index.js.map +1 -0
  56. package/clinkx-workflows/dist/dashboard/auth/challenge-store.d.ts +31 -0
  57. package/clinkx-workflows/dist/dashboard/auth/challenge-store.js +65 -0
  58. package/clinkx-workflows/dist/dashboard/auth/challenge-store.js.map +1 -0
  59. package/clinkx-workflows/dist/dashboard/auth/controller.d.ts +26 -0
  60. package/clinkx-workflows/dist/dashboard/auth/controller.js +596 -0
  61. package/clinkx-workflows/dist/dashboard/auth/controller.js.map +1 -0
  62. package/clinkx-workflows/dist/dashboard/auth/credential-store.d.ts +60 -0
  63. package/clinkx-workflows/dist/dashboard/auth/credential-store.js +776 -0
  64. package/clinkx-workflows/dist/dashboard/auth/credential-store.js.map +1 -0
  65. package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.d.ts +9 -0
  66. package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js +44 -0
  67. package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js.map +1 -0
  68. package/clinkx-workflows/dist/dashboard/auth/session-store.d.ts +17 -0
  69. package/clinkx-workflows/dist/dashboard/auth/session-store.js +77 -0
  70. package/clinkx-workflows/dist/dashboard/auth/session-store.js.map +1 -0
  71. package/clinkx-workflows/dist/dashboard/auth/webauthn-service.d.ts +25 -0
  72. package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js +71 -0
  73. package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js.map +1 -0
  74. package/clinkx-workflows/dist/dashboard/context-run-liveness.d.ts +37 -0
  75. package/clinkx-workflows/dist/dashboard/context-run-liveness.js +49 -0
  76. package/clinkx-workflows/dist/dashboard/context-run-liveness.js.map +1 -0
  77. package/clinkx-workflows/dist/dashboard/context-run-reader.d.ts +222 -0
  78. package/clinkx-workflows/dist/dashboard/context-run-reader.js +1178 -0
  79. package/clinkx-workflows/dist/dashboard/context-run-reader.js.map +1 -0
  80. package/clinkx-workflows/dist/dashboard/contracts.d.ts +8936 -0
  81. package/clinkx-workflows/dist/dashboard/contracts.js +1157 -0
  82. package/clinkx-workflows/dist/dashboard/contracts.js.map +1 -0
  83. package/clinkx-workflows/dist/dashboard/generation.d.ts +14 -0
  84. package/clinkx-workflows/dist/dashboard/generation.js +41 -0
  85. package/clinkx-workflows/dist/dashboard/generation.js.map +1 -0
  86. package/clinkx-workflows/dist/dashboard/index.d.ts +28 -0
  87. package/clinkx-workflows/dist/dashboard/index.js +16 -0
  88. package/clinkx-workflows/dist/dashboard/index.js.map +1 -0
  89. package/clinkx-workflows/dist/dashboard/lazy-content.d.ts +101 -0
  90. package/clinkx-workflows/dist/dashboard/lazy-content.js +748 -0
  91. package/clinkx-workflows/dist/dashboard/lazy-content.js.map +1 -0
  92. package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +303 -0
  93. package/clinkx-workflows/dist/dashboard/progress-report-contract.js +221 -0
  94. package/clinkx-workflows/dist/dashboard/progress-report-contract.js.map +1 -0
  95. package/clinkx-workflows/dist/dashboard/progress-report-reader.d.ts +50 -0
  96. package/clinkx-workflows/dist/dashboard/progress-report-reader.js +581 -0
  97. package/clinkx-workflows/dist/dashboard/progress-report-reader.js.map +1 -0
  98. package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.d.ts +89 -0
  99. package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js +71 -0
  100. package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js.map +1 -0
  101. package/clinkx-workflows/dist/dashboard/progress-report-status-store.d.ts +28 -0
  102. package/clinkx-workflows/dist/dashboard/progress-report-status-store.js +110 -0
  103. package/clinkx-workflows/dist/dashboard/progress-report-status-store.js.map +1 -0
  104. package/clinkx-workflows/dist/dashboard/read-model.d.ts +86 -0
  105. package/clinkx-workflows/dist/dashboard/read-model.js +440 -0
  106. package/clinkx-workflows/dist/dashboard/read-model.js.map +1 -0
  107. package/clinkx-workflows/dist/dashboard/request-admission.d.ts +31 -0
  108. package/clinkx-workflows/dist/dashboard/request-admission.js +126 -0
  109. package/clinkx-workflows/dist/dashboard/request-admission.js.map +1 -0
  110. package/clinkx-workflows/dist/dashboard/scanner.d.ts +75 -0
  111. package/clinkx-workflows/dist/dashboard/scanner.js +1110 -0
  112. package/clinkx-workflows/dist/dashboard/scanner.js.map +1 -0
  113. package/clinkx-workflows/dist/dashboard/server-factory.d.ts +50 -0
  114. package/clinkx-workflows/dist/dashboard/server-factory.js +431 -0
  115. package/clinkx-workflows/dist/dashboard/server-factory.js.map +1 -0
  116. package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +2611 -0
  117. package/clinkx-workflows/dist/dashboard/session-log-contract.js +480 -0
  118. package/clinkx-workflows/dist/dashboard/session-log-contract.js.map +1 -0
  119. package/clinkx-workflows/dist/dashboard/session-log-identity.d.ts +21 -0
  120. package/clinkx-workflows/dist/dashboard/session-log-identity.js +101 -0
  121. package/clinkx-workflows/dist/dashboard/session-log-identity.js.map +1 -0
  122. package/clinkx-workflows/dist/dashboard/session-log-journal.d.ts +43 -0
  123. package/clinkx-workflows/dist/dashboard/session-log-journal.js +522 -0
  124. package/clinkx-workflows/dist/dashboard/session-log-journal.js.map +1 -0
  125. package/clinkx-workflows/dist/dashboard/session-log-reader.d.ts +61 -0
  126. package/clinkx-workflows/dist/dashboard/session-log-reader.js +378 -0
  127. package/clinkx-workflows/dist/dashboard/session-log-reader.js.map +1 -0
  128. package/clinkx-workflows/dist/dashboard/session-log-redaction.d.ts +6 -0
  129. package/clinkx-workflows/dist/dashboard/session-log-redaction.js +367 -0
  130. package/clinkx-workflows/dist/dashboard/session-log-redaction.js.map +1 -0
  131. package/clinkx-workflows/dist/dashboard/session-log-retention.d.ts +23 -0
  132. package/clinkx-workflows/dist/dashboard/session-log-retention.js +212 -0
  133. package/clinkx-workflows/dist/dashboard/session-log-retention.js.map +1 -0
  134. package/clinkx-workflows/dist/dashboard/static-responses.d.ts +10 -0
  135. package/clinkx-workflows/dist/dashboard/static-responses.js +94 -0
  136. package/clinkx-workflows/dist/dashboard/static-responses.js.map +1 -0
  137. package/clinkx-workflows/dist/dashboard/worker-lock-observer.d.ts +28 -0
  138. package/clinkx-workflows/dist/dashboard/worker-lock-observer.js +241 -0
  139. package/clinkx-workflows/dist/dashboard/worker-lock-observer.js.map +1 -0
  140. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  141. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  142. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  143. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  144. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
  145. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
  146. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
  147. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
  148. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
  149. package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
  150. package/clinkx-workflows/dist/dashboard-ui/assets/index-DOkMXTfB.js +25 -0
  151. package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  152. package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  153. package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  154. package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  155. package/clinkx-workflows/dist/dashboard-ui/assets/style-ChJsn0KD.css +1 -0
  156. package/clinkx-workflows/dist/dashboard-ui/contracts/council-plan-review-input-v1.json +158 -0
  157. package/clinkx-workflows/dist/dashboard-ui/index.html +15 -0
  158. package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Mono-OFL.txt +93 -0
  159. package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Sans-OFL.txt +93 -0
  160. package/clinkx-workflows/dist/dashboard-ui/licenses/JetBrains-Mono-OFL.txt +93 -0
  161. package/clinkx-workflows/dist/dashboard-ui/licenses/NOTICE.md +32 -0
  162. package/clinkx-workflows/dist/dashboard-ui/theme-init.js +8 -0
  163. package/clinkx-workflows/dist/definition-normalizer.d.ts +19 -0
  164. package/clinkx-workflows/dist/definition-normalizer.js.map +1 -1
  165. package/clinkx-workflows/dist/delegate-validate.d.ts +78 -0
  166. package/clinkx-workflows/dist/delegate-validate.js +97 -0
  167. package/clinkx-workflows/dist/delegate-validate.js.map +1 -0
  168. package/clinkx-workflows/dist/engine.d.ts +141 -0
  169. package/clinkx-workflows/dist/engine.js +882 -28
  170. package/clinkx-workflows/dist/engine.js.map +1 -1
  171. package/clinkx-workflows/dist/errors.d.ts +2 -0
  172. package/clinkx-workflows/dist/errors.js.map +1 -1
  173. package/clinkx-workflows/dist/fingerprint.d.ts +1 -1
  174. package/clinkx-workflows/dist/fingerprint.js +1 -1
  175. package/clinkx-workflows/dist/index.d.ts +19 -0
  176. package/clinkx-workflows/dist/index.js +15 -0
  177. package/clinkx-workflows/dist/index.js.map +1 -1
  178. package/clinkx-workflows/dist/loader.d.ts +9 -3
  179. package/clinkx-workflows/dist/loader.js +92 -21
  180. package/clinkx-workflows/dist/loader.js.map +1 -1
  181. package/clinkx-workflows/dist/plan-review/admission.d.ts +160 -0
  182. package/clinkx-workflows/dist/plan-review/admission.js +290 -0
  183. package/clinkx-workflows/dist/plan-review/admission.js.map +1 -0
  184. package/clinkx-workflows/dist/plan-review/context-policy.d.ts +55 -0
  185. package/clinkx-workflows/dist/plan-review/context-policy.js +146 -0
  186. package/clinkx-workflows/dist/plan-review/context-policy.js.map +1 -0
  187. package/clinkx-workflows/dist/plan-review/contract.d.ts +763 -0
  188. package/clinkx-workflows/dist/plan-review/contract.js +289 -0
  189. package/clinkx-workflows/dist/plan-review/contract.js.map +1 -0
  190. package/clinkx-workflows/dist/plan-review/digest.d.ts +68 -0
  191. package/clinkx-workflows/dist/plan-review/digest.js +241 -0
  192. package/clinkx-workflows/dist/plan-review/digest.js.map +1 -0
  193. package/clinkx-workflows/dist/plan-review/discovery.d.ts +45 -0
  194. package/clinkx-workflows/dist/plan-review/discovery.js +36 -0
  195. package/clinkx-workflows/dist/plan-review/discovery.js.map +1 -0
  196. package/clinkx-workflows/dist/plan-review/execution-contract.d.ts +298 -0
  197. package/clinkx-workflows/dist/plan-review/execution-contract.js +194 -0
  198. package/clinkx-workflows/dist/plan-review/execution-contract.js.map +1 -0
  199. package/clinkx-workflows/dist/plan-review/expander.d.ts +48 -0
  200. package/clinkx-workflows/dist/plan-review/expander.js +243 -0
  201. package/clinkx-workflows/dist/plan-review/expander.js.map +1 -0
  202. package/clinkx-workflows/dist/plan-review/projector.d.ts +126 -0
  203. package/clinkx-workflows/dist/plan-review/projector.js +437 -0
  204. package/clinkx-workflows/dist/plan-review/projector.js.map +1 -0
  205. package/clinkx-workflows/dist/plan-review/publication.d.ts +95 -0
  206. package/clinkx-workflows/dist/plan-review/publication.js +182 -0
  207. package/clinkx-workflows/dist/plan-review/publication.js.map +1 -0
  208. package/clinkx-workflows/dist/plan-review/ranking-reducer.d.ts +34 -0
  209. package/clinkx-workflows/dist/plan-review/ranking-reducer.js +139 -0
  210. package/clinkx-workflows/dist/plan-review/ranking-reducer.js.map +1 -0
  211. package/clinkx-workflows/dist/plan-review/resume.d.ts +38 -0
  212. package/clinkx-workflows/dist/plan-review/resume.js +122 -0
  213. package/clinkx-workflows/dist/plan-review/resume.js.map +1 -0
  214. package/clinkx-workflows/dist/plan-review/rubric.d.ts +7 -0
  215. package/clinkx-workflows/dist/plan-review/rubric.js +24 -0
  216. package/clinkx-workflows/dist/plan-review/rubric.js.map +1 -0
  217. package/clinkx-workflows/dist/plan-review/run-state.d.ts +398 -0
  218. package/clinkx-workflows/dist/plan-review/run-state.js +183 -0
  219. package/clinkx-workflows/dist/plan-review/run-state.js.map +1 -0
  220. package/clinkx-workflows/dist/plan-review/runtime-policy.d.ts +74 -0
  221. package/clinkx-workflows/dist/plan-review/runtime-policy.js +186 -0
  222. package/clinkx-workflows/dist/plan-review/runtime-policy.js.map +1 -0
  223. package/clinkx-workflows/dist/plan-review/snapshot.d.ts +81 -0
  224. package/clinkx-workflows/dist/plan-review/snapshot.js +170 -0
  225. package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -0
  226. package/clinkx-workflows/dist/plan-review/stage-error.d.ts +19 -0
  227. package/clinkx-workflows/dist/plan-review/stage-error.js +20 -0
  228. package/clinkx-workflows/dist/plan-review/stage-error.js.map +1 -0
  229. package/clinkx-workflows/dist/post-processors/index.d.ts +20 -0
  230. package/clinkx-workflows/dist/post-processors/index.js +21 -0
  231. package/clinkx-workflows/dist/post-processors/index.js.map +1 -0
  232. package/clinkx-workflows/dist/prompt-budget.d.ts +7 -0
  233. package/clinkx-workflows/dist/prompt-budget.js +7 -1
  234. package/clinkx-workflows/dist/prompt-budget.js.map +1 -1
  235. package/clinkx-workflows/dist/reducers/index.js +2 -0
  236. package/clinkx-workflows/dist/reducers/index.js.map +1 -1
  237. package/clinkx-workflows/dist/run-lock-heartbeat.d.ts +2 -0
  238. package/clinkx-workflows/dist/run-lock-heartbeat.js +3 -0
  239. package/clinkx-workflows/dist/run-lock-heartbeat.js.map +1 -0
  240. package/clinkx-workflows/dist/run-summary/cards/council-plan-review.d.ts +34 -0
  241. package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js +74 -0
  242. package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js.map +1 -0
  243. package/clinkx-workflows/dist/run-summary/cards/index.js +5 -0
  244. package/clinkx-workflows/dist/run-summary/cards/index.js.map +1 -1
  245. package/clinkx-workflows/dist/run-summary.d.ts +13 -0
  246. package/clinkx-workflows/dist/run-summary.js +29 -1
  247. package/clinkx-workflows/dist/run-summary.js.map +1 -1
  248. package/clinkx-workflows/dist/schema.d.ts +76 -21
  249. package/clinkx-workflows/dist/schema.js +10 -1
  250. package/clinkx-workflows/dist/schema.js.map +1 -1
  251. package/clinkx-workflows/dist/seed-terms.d.ts +30 -0
  252. package/clinkx-workflows/dist/seed-terms.js +176 -0
  253. package/clinkx-workflows/dist/seed-terms.js.map +1 -0
  254. package/clinkx-workflows/dist/server.d.ts +5 -2
  255. package/clinkx-workflows/dist/server.js +82 -52
  256. package/clinkx-workflows/dist/server.js.map +1 -1
  257. package/clinkx-workflows/dist/shutdown.d.ts +18 -20
  258. package/clinkx-workflows/dist/shutdown.js +43 -61
  259. package/clinkx-workflows/dist/shutdown.js.map +1 -1
  260. package/clinkx-workflows/dist/state-schema.d.ts +38 -0
  261. package/clinkx-workflows/dist/state.d.ts +170 -3
  262. package/clinkx-workflows/dist/state.js +1275 -28
  263. package/clinkx-workflows/dist/state.js.map +1 -1
  264. package/clinkx-workflows/dist/transport.d.ts +15 -0
  265. package/clinkx-workflows/dist/transport.js +19 -10
  266. package/clinkx-workflows/dist/transport.js.map +1 -1
  267. package/clinkx-workflows/dist/types.d.ts +14 -2
  268. package/clinkx-workflows/dist/validators/council.d.ts +318 -85
  269. package/clinkx-workflows/dist/validators/council.js +52 -13
  270. package/clinkx-workflows/dist/validators/council.js.map +1 -1
  271. package/clinkx-workflows/dist/validators/index.d.ts +1 -0
  272. package/clinkx-workflows/dist/validators/index.js +3 -0
  273. package/clinkx-workflows/dist/validators/index.js.map +1 -1
  274. package/clinkx-workflows/dist/validators/plan-review.d.ts +398 -0
  275. package/clinkx-workflows/dist/validators/plan-review.js +316 -0
  276. package/clinkx-workflows/dist/validators/plan-review.js.map +1 -0
  277. package/clinkx-workflows/dist/workflow-receipt.js +188 -4
  278. package/clinkx-workflows/dist/workflow-receipt.js.map +1 -1
  279. package/clinkx-workflows/dist/workflow-tools.d.ts +48 -3
  280. package/clinkx-workflows/dist/workflow-tools.js +1402 -59
  281. package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
  282. package/clinkx-workflows/dist/workspace-signature.d.ts +16 -0
  283. package/clinkx-workflows/dist/workspace-signature.js +388 -0
  284. package/clinkx-workflows/dist/workspace-signature.js.map +1 -0
  285. package/clinkx-workflows/templates/council/answer-specialist.txt +2 -1
  286. package/clinkx-workflows/templates/council/code-review-chairman.txt +13 -0
  287. package/clinkx-workflows/templates/council/code-review-cross-reviewer.txt +4 -1
  288. package/clinkx-workflows/templates/council/code-review-reviewer.txt +19 -3
  289. package/clinkx-workflows/templates/council/debug-debugger.txt +2 -1
  290. package/clinkx-workflows/templates/council/discover-analyst.txt +2 -1
  291. package/clinkx-workflows/templates/council/member.txt +2 -1
  292. package/clinkx-workflows/templates/council/plan-review-chairman.txt +68 -0
  293. package/clinkx-workflows/templates/council/plan-review-cross-reviewer.txt +51 -0
  294. package/clinkx-workflows/templates/council/plan-review-reviewer.txt +60 -0
  295. package/clinkx-workflows/templates/plan-review/chairman.txt +48 -0
  296. package/clinkx-workflows/templates/plan-review/cross-review.txt +52 -0
  297. package/clinkx-workflows/templates/plan-review/ranking.txt +16 -0
  298. package/clinkx-workflows/templates/plan-review/reviewer.txt +57 -0
  299. package/clinkx-workflows/workflows/council-answer.yaml +97 -8
  300. package/clinkx-workflows/workflows/council-code-review.yaml +103 -8
  301. package/clinkx-workflows/workflows/council-debug.yaml +97 -8
  302. package/clinkx-workflows/workflows/council-default.yaml +97 -8
  303. package/clinkx-workflows/workflows/council-discover.yaml +97 -8
  304. package/clinkx-workflows/workflows/council-plan-review.yaml +250 -0
  305. package/clinkx-workflows/workflows/plan-review-receipts.yaml +230 -0
  306. package/conf/adapters/agy.json +49 -0
  307. package/conf/adapters/claude.json +5 -0
  308. package/conf/adapters/codex-app-server.json +44 -0
  309. package/conf/adapters/codex.json +7 -2
  310. package/conf/adapters/glm.json +5 -0
  311. package/conf/adapters/grok.json +60 -0
  312. package/conf/adapters/hapi/agy.json +52 -0
  313. package/conf/adapters/hapi/claude.json +5 -0
  314. package/conf/adapters/hapi/codex.json +7 -2
  315. package/conf/adapters/hapi/glm.json +5 -0
  316. package/conf/prompts/json-codereviewer.txt +1 -0
  317. package/conf/prompts/json.txt +1 -0
  318. package/dist/activity-journal.d.ts +42 -0
  319. package/dist/activity-journal.js +381 -0
  320. package/dist/activity-journal.js.map +1 -0
  321. package/dist/allowed-roots.d.ts +53 -0
  322. package/dist/allowed-roots.js +216 -0
  323. package/dist/allowed-roots.js.map +1 -0
  324. package/dist/codex/activity-session-log.d.ts +14 -0
  325. package/dist/codex/activity-session-log.js +206 -0
  326. package/dist/codex/activity-session-log.js.map +1 -0
  327. package/dist/codex/agent-tools.d.ts +23 -0
  328. package/dist/codex/agent-tools.js +1270 -0
  329. package/dist/codex/agent-tools.js.map +1 -0
  330. package/dist/codex/app-server-client.d.ts +76 -0
  331. package/dist/codex/app-server-client.js +582 -0
  332. package/dist/codex/app-server-client.js.map +1 -0
  333. package/dist/codex/app-server-registry.d.ts +389 -0
  334. package/dist/codex/app-server-registry.js +1407 -0
  335. package/dist/codex/app-server-registry.js.map +1 -0
  336. package/dist/codex/client-types.d.ts +109 -0
  337. package/dist/codex/client-types.js +2 -0
  338. package/dist/codex/client-types.js.map +1 -0
  339. package/dist/codex/protocol.d.ts +5375 -0
  340. package/dist/codex/protocol.js +614 -0
  341. package/dist/codex/protocol.js.map +1 -0
  342. package/dist/codex/session.d.ts +263 -0
  343. package/dist/codex/session.js +466 -0
  344. package/dist/codex/session.js.map +1 -0
  345. package/dist/config.d.ts +185 -19
  346. package/dist/config.js +82 -16
  347. package/dist/config.js.map +1 -1
  348. package/dist/context-builder/anchors.d.ts +12 -0
  349. package/dist/context-builder/anchors.js +22 -0
  350. package/dist/context-builder/anchors.js.map +1 -0
  351. package/dist/context-builder/bundle.d.ts +109 -0
  352. package/dist/context-builder/bundle.js +1498 -0
  353. package/dist/context-builder/bundle.js.map +1 -0
  354. package/dist/context-builder/codemap.d.ts +22 -0
  355. package/dist/context-builder/codemap.js +675 -0
  356. package/dist/context-builder/codemap.js.map +1 -0
  357. package/dist/context-builder/config.d.ts +61 -0
  358. package/dist/context-builder/config.js +216 -0
  359. package/dist/context-builder/config.js.map +1 -0
  360. package/dist/context-builder/context-run-catalog.d.ts +17 -0
  361. package/dist/context-builder/context-run-catalog.js +99 -0
  362. package/dist/context-builder/context-run-catalog.js.map +1 -0
  363. package/dist/context-builder/delegate-packet.d.ts +219 -0
  364. package/dist/context-builder/delegate-packet.js +1190 -0
  365. package/dist/context-builder/delegate-packet.js.map +1 -0
  366. package/dist/context-builder/delegate-reconstruction.d.ts +13 -0
  367. package/dist/context-builder/delegate-reconstruction.js +220 -0
  368. package/dist/context-builder/delegate-reconstruction.js.map +1 -0
  369. package/dist/context-builder/delegate-validation.d.ts +27 -0
  370. package/dist/context-builder/delegate-validation.js +479 -0
  371. package/dist/context-builder/delegate-validation.js.map +1 -0
  372. package/dist/context-builder/delegate.d.ts +26 -0
  373. package/dist/context-builder/delegate.js +134 -0
  374. package/dist/context-builder/delegate.js.map +1 -0
  375. package/dist/context-builder/diagnostics.d.ts +36 -0
  376. package/dist/context-builder/diagnostics.js +107 -0
  377. package/dist/context-builder/diagnostics.js.map +1 -0
  378. package/dist/context-builder/discovery.d.ts +146 -0
  379. package/dist/context-builder/discovery.js +2129 -0
  380. package/dist/context-builder/discovery.js.map +1 -0
  381. package/dist/context-builder/globs.d.ts +14 -0
  382. package/dist/context-builder/globs.js +175 -0
  383. package/dist/context-builder/globs.js.map +1 -0
  384. package/dist/context-builder/handler.d.ts +41 -0
  385. package/dist/context-builder/handler.js +2590 -0
  386. package/dist/context-builder/handler.js.map +1 -0
  387. package/dist/context-builder/lifecycle-contract.d.ts +424 -0
  388. package/dist/context-builder/lifecycle-contract.js +523 -0
  389. package/dist/context-builder/lifecycle-contract.js.map +1 -0
  390. package/dist/context-builder/lifecycle-journal.d.ts +62 -0
  391. package/dist/context-builder/lifecycle-journal.js +88 -0
  392. package/dist/context-builder/lifecycle-journal.js.map +1 -0
  393. package/dist/context-builder/lifecycle-observer.d.ts +102 -0
  394. package/dist/context-builder/lifecycle-observer.js +258 -0
  395. package/dist/context-builder/lifecycle-observer.js.map +1 -0
  396. package/dist/context-builder/lifecycle-reconcile.d.ts +32 -0
  397. package/dist/context-builder/lifecycle-reconcile.js +191 -0
  398. package/dist/context-builder/lifecycle-reconcile.js.map +1 -0
  399. package/dist/context-builder/lifecycle-recovery.d.ts +2 -0
  400. package/dist/context-builder/lifecycle-recovery.js +14 -0
  401. package/dist/context-builder/lifecycle-recovery.js.map +1 -0
  402. package/dist/context-builder/path-signals.d.ts +7 -0
  403. package/dist/context-builder/path-signals.js +70 -0
  404. package/dist/context-builder/path-signals.js.map +1 -0
  405. package/dist/context-builder/paths.d.ts +30 -0
  406. package/dist/context-builder/paths.js +153 -0
  407. package/dist/context-builder/paths.js.map +1 -0
  408. package/dist/context-builder/progress.d.ts +17 -0
  409. package/dist/context-builder/progress.js +93 -0
  410. package/dist/context-builder/progress.js.map +1 -0
  411. package/dist/context-builder/receipt.d.ts +91 -0
  412. package/dist/context-builder/receipt.js +180 -0
  413. package/dist/context-builder/receipt.js.map +1 -0
  414. package/dist/context-builder/refine-handler.d.ts +14 -0
  415. package/dist/context-builder/refine-handler.js +790 -0
  416. package/dist/context-builder/refine-handler.js.map +1 -0
  417. package/dist/context-builder/review-coverage.d.ts +84 -0
  418. package/dist/context-builder/review-coverage.js +437 -0
  419. package/dist/context-builder/review-coverage.js.map +1 -0
  420. package/dist/context-builder/run-id.d.ts +7 -0
  421. package/dist/context-builder/run-id.js +31 -0
  422. package/dist/context-builder/run-id.js.map +1 -0
  423. package/dist/context-builder/schema.d.ts +669 -0
  424. package/dist/context-builder/schema.js +399 -0
  425. package/dist/context-builder/schema.js.map +1 -0
  426. package/dist/context-builder/secrets.d.ts +41 -0
  427. package/dist/context-builder/secrets.js +1651 -0
  428. package/dist/context-builder/secrets.js.map +1 -0
  429. package/dist/context-builder/selection.d.ts +56 -0
  430. package/dist/context-builder/selection.js +1111 -0
  431. package/dist/context-builder/selection.js.map +1 -0
  432. package/dist/context-builder/session-log-identity.d.ts +1 -0
  433. package/dist/context-builder/session-log-identity.js +66 -0
  434. package/dist/context-builder/session-log-identity.js.map +1 -0
  435. package/dist/context-builder/slice-range-math.d.ts +16 -0
  436. package/dist/context-builder/slice-range-math.js +137 -0
  437. package/dist/context-builder/slice-range-math.js.map +1 -0
  438. package/dist/context-builder/status.d.ts +66 -0
  439. package/dist/context-builder/status.js +160 -0
  440. package/dist/context-builder/status.js.map +1 -0
  441. package/dist/context-builder/storage.d.ts +118 -0
  442. package/dist/context-builder/storage.js +1003 -0
  443. package/dist/context-builder/storage.js.map +1 -0
  444. package/dist/context-builder/token-estimate.d.ts +19 -0
  445. package/dist/context-builder/token-estimate.js +90 -0
  446. package/dist/context-builder/token-estimate.js.map +1 -0
  447. package/dist/context-builder/versions.d.ts +29 -0
  448. package/dist/context-builder/versions.js +30 -0
  449. package/dist/context-builder/versions.js.map +1 -0
  450. package/dist/context-builder/workflow-runner.d.ts +69 -0
  451. package/dist/context-builder/workflow-runner.js +1051 -0
  452. package/dist/context-builder/workflow-runner.js.map +1 -0
  453. package/dist/context-builder/write-watchdog.d.ts +14 -0
  454. package/dist/context-builder/write-watchdog.js +38 -0
  455. package/dist/context-builder/write-watchdog.js.map +1 -0
  456. package/dist/dashboard-adapter-catalog.d.ts +9 -0
  457. package/dist/dashboard-adapter-catalog.js +46 -0
  458. package/dist/dashboard-adapter-catalog.js.map +1 -0
  459. package/dist/dashboard-cli.d.ts +79 -0
  460. package/dist/dashboard-cli.js +585 -0
  461. package/dist/dashboard-cli.js.map +1 -0
  462. package/dist/dashboard-companion/client.d.ts +36 -0
  463. package/dist/dashboard-companion/client.js +210 -0
  464. package/dist/dashboard-companion/client.js.map +1 -0
  465. package/dist/dashboard-companion/config.d.ts +8 -0
  466. package/dist/dashboard-companion/config.js +52 -0
  467. package/dist/dashboard-companion/config.js.map +1 -0
  468. package/dist/dashboard-companion/http-proxy.d.ts +10 -0
  469. package/dist/dashboard-companion/http-proxy.js +234 -0
  470. package/dist/dashboard-companion/http-proxy.js.map +1 -0
  471. package/dist/dashboard-companion/protocol.d.ts +80 -0
  472. package/dist/dashboard-companion/protocol.js +455 -0
  473. package/dist/dashboard-companion/protocol.js.map +1 -0
  474. package/dist/dashboard-companion/standalone-assets.d.ts +12 -0
  475. package/dist/dashboard-companion/standalone-assets.js +72 -0
  476. package/dist/dashboard-companion/standalone-assets.js.map +1 -0
  477. package/dist/dashboard-companion/standalone-entry.d.ts +1 -0
  478. package/dist/dashboard-companion/standalone-entry.js +17 -0
  479. package/dist/dashboard-companion/standalone-entry.js.map +1 -0
  480. package/dist/dashboard-gateway/config.d.ts +9 -0
  481. package/dist/dashboard-gateway/config.js +44 -0
  482. package/dist/dashboard-gateway/config.js.map +1 -0
  483. package/dist/dashboard-gateway/index.d.ts +11 -0
  484. package/dist/dashboard-gateway/index.js +755 -0
  485. package/dist/dashboard-gateway/index.js.map +1 -0
  486. package/dist/dashboard-gateway/main.d.ts +1 -0
  487. package/dist/dashboard-gateway/main.js +25 -0
  488. package/dist/dashboard-gateway/main.js.map +1 -0
  489. package/dist/dashboard-pairing-token.d.ts +1 -0
  490. package/dist/dashboard-pairing-token.js +5 -0
  491. package/dist/dashboard-pairing-token.js.map +1 -0
  492. package/dist/elaris/client.d.ts +73 -0
  493. package/dist/elaris/client.js +825 -0
  494. package/dist/elaris/client.js.map +1 -0
  495. package/dist/elaris/config.d.ts +18 -0
  496. package/dist/elaris/config.js +75 -0
  497. package/dist/elaris/config.js.map +1 -0
  498. package/dist/elaris/errors.d.ts +41 -0
  499. package/dist/elaris/errors.js +205 -0
  500. package/dist/elaris/errors.js.map +1 -0
  501. package/dist/elaris/github-repo.d.ts +18 -0
  502. package/dist/elaris/github-repo.js +89 -0
  503. package/dist/elaris/github-repo.js.map +1 -0
  504. package/dist/elaris/index.d.ts +10 -0
  505. package/dist/elaris/index.js +11 -0
  506. package/dist/elaris/index.js.map +1 -0
  507. package/dist/elaris/redact.d.ts +89 -0
  508. package/dist/elaris/redact.js +423 -0
  509. package/dist/elaris/redact.js.map +1 -0
  510. package/dist/elaris/run-id.d.ts +5 -0
  511. package/dist/elaris/run-id.js +20 -0
  512. package/dist/elaris/run-id.js.map +1 -0
  513. package/dist/elaris/status.d.ts +45 -0
  514. package/dist/elaris/status.js +122 -0
  515. package/dist/elaris/status.js.map +1 -0
  516. package/dist/elaris/tool-schemas.d.ts +314 -0
  517. package/dist/elaris/tool-schemas.js +208 -0
  518. package/dist/elaris/tool-schemas.js.map +1 -0
  519. package/dist/elaris/tools.d.ts +73 -0
  520. package/dist/elaris/tools.js +1065 -0
  521. package/dist/elaris/tools.js.map +1 -0
  522. package/dist/elaris/types.d.ts +1541 -0
  523. package/dist/elaris/types.js +252 -0
  524. package/dist/elaris/types.js.map +1 -0
  525. package/dist/errors.d.ts +16 -0
  526. package/dist/errors.js +19 -0
  527. package/dist/errors.js.map +1 -1
  528. package/dist/handler.d.ts +4 -0
  529. package/dist/handler.js +10 -1
  530. package/dist/handler.js.map +1 -1
  531. package/dist/index.d.ts +2 -1
  532. package/dist/index.js +13 -3
  533. package/dist/index.js.map +1 -1
  534. package/dist/local-clink-backend.d.ts +3 -0
  535. package/dist/local-clink-backend.js +4 -0
  536. package/dist/local-clink-backend.js.map +1 -1
  537. package/dist/package-info.d.ts +2 -0
  538. package/dist/package-info.js +18 -0
  539. package/dist/package-info.js.map +1 -0
  540. package/dist/parsers/codex-jsonl.js +48 -3
  541. package/dist/parsers/codex-jsonl.js.map +1 -1
  542. package/dist/parsers/extract.d.ts +10 -1
  543. package/dist/parsers/extract.js +11 -3
  544. package/dist/parsers/extract.js.map +1 -1
  545. package/dist/paths.d.ts +8 -0
  546. package/dist/paths.js +31 -43
  547. package/dist/paths.js.map +1 -1
  548. package/dist/pipeline.d.ts +51 -3
  549. package/dist/pipeline.js +264 -47
  550. package/dist/pipeline.js.map +1 -1
  551. package/dist/run-dir.d.ts +24 -0
  552. package/dist/run-dir.js +201 -2
  553. package/dist/run-dir.js.map +1 -1
  554. package/dist/runner.d.ts +13 -0
  555. package/dist/runner.js +184 -15
  556. package/dist/runner.js.map +1 -1
  557. package/dist/safety.d.ts +4 -4
  558. package/dist/safety.js +4 -4
  559. package/dist/schema.d.ts +7 -7
  560. package/dist/server.d.ts +2 -0
  561. package/dist/server.js +396 -24
  562. package/dist/server.js.map +1 -1
  563. package/dist/session-log-stream.d.ts +18 -0
  564. package/dist/session-log-stream.js +319 -0
  565. package/dist/session-log-stream.js.map +1 -0
  566. package/package.json +47 -5
  567. package/conf/adapters/gemini.json +0 -44
  568. package/conf/adapters/hapi/gemini.json +0 -47
  569. package/dist/artifacts.d.ts +0 -9
  570. package/dist/artifacts.js +0 -24
  571. package/dist/artifacts.js.map +0 -1
  572. package/dist/parsers/gemini-json.d.ts +0 -2
  573. package/dist/parsers/gemini-json.js +0 -72
  574. package/dist/parsers/gemini-json.js.map +0 -1
@@ -0,0 +1,675 @@
1
+ export function buildFileCodemap(relPath, content) {
2
+ const language = languageForPath(relPath);
3
+ if (language === "unknown") {
4
+ return { path: relPath, language, symbols: [] };
5
+ }
6
+ // Coordinates are relative to the content passed here. Callers that pass
7
+ // selected slices remap these lines back to source coordinates via
8
+ // remapCodemapToSourceCoordinates (bundle.ts does this using each file's
9
+ // selection ranges).
10
+ const lines = content.split(/\r?\n/);
11
+ return {
12
+ path: relPath,
13
+ language,
14
+ symbols: language === "py"
15
+ ? scanPython(lines)
16
+ : scanBraceLanguage(lines, language),
17
+ };
18
+ }
19
+ // Remaps a codemap's content-relative symbol lines back to source-file
20
+ // coordinates. The rendered content at 1-based line i corresponds to source
21
+ // line = expand(ranges)[i-1], where expand flattens each range's
22
+ // start_line..end_line in order. Out-of-bounds indices clamp to the last valid
23
+ // source line. Empty ranges leave the map unchanged. Pure: input is not mutated.
24
+ export function remapCodemapToSourceCoordinates(map, ranges) {
25
+ if (ranges.length === 0) {
26
+ return map;
27
+ }
28
+ const sourceLines = [];
29
+ for (const range of ranges) {
30
+ for (let line = range.start_line; line <= range.end_line; line += 1) {
31
+ sourceLines.push(line);
32
+ }
33
+ }
34
+ if (sourceLines.length === 0) {
35
+ return map;
36
+ }
37
+ const lastSourceLine = sourceLines[sourceLines.length - 1];
38
+ const toSource = (renderedLine) => {
39
+ const index = renderedLine - 1;
40
+ if (index < 0) {
41
+ return sourceLines[0];
42
+ }
43
+ return sourceLines[index] ?? lastSourceLine;
44
+ };
45
+ return {
46
+ ...map,
47
+ symbols: map.symbols.map((symbol) => ({
48
+ ...symbol,
49
+ start_line: toSource(symbol.start_line),
50
+ end_line: toSource(symbol.end_line),
51
+ })),
52
+ };
53
+ }
54
+ export function renderCodemapJsonl(maps) {
55
+ if (maps.length === 0) {
56
+ return "";
57
+ }
58
+ return `${maps.map((map) => JSON.stringify(map)).join("\n")}\n`;
59
+ }
60
+ function languageForPath(path) {
61
+ const lowerPath = path.toLowerCase();
62
+ if (/\.(ts|tsx|mts|cts)$/.test(lowerPath)) {
63
+ return "ts";
64
+ }
65
+ if (/\.(js|jsx|mjs|cjs)$/.test(lowerPath)) {
66
+ return "js";
67
+ }
68
+ if (lowerPath.endsWith(".py")) {
69
+ return "py";
70
+ }
71
+ if (lowerPath.endsWith(".rs")) {
72
+ return "rust";
73
+ }
74
+ return "unknown";
75
+ }
76
+ function scanBraceLanguage(lines, language) {
77
+ const symbols = [];
78
+ let previousSignificant = "";
79
+ const topLevelDepths = language === "rust" ? [] : braceDepthBeforeLines(lines);
80
+ lines.forEach((line, index) => {
81
+ const lineNumber = index + 1;
82
+ const trimmed = line.trim();
83
+ if (trimmed.length === 0) {
84
+ return;
85
+ }
86
+ if (language === "rust") {
87
+ const rustSymbol = rustSymbolForLine(trimmed, previousSignificant);
88
+ if (rustSymbol != null) {
89
+ const endLine = endLineForBraces(lines, index);
90
+ symbols.push({
91
+ kind: rustSymbol.kind,
92
+ name: rustSymbol.name,
93
+ start_line: lineNumber,
94
+ end_line: endLine,
95
+ scanner: "regex",
96
+ confidence: "low",
97
+ });
98
+ }
99
+ }
100
+ else {
101
+ for (const symbol of tsJsSymbolsForLine(trimmed)) {
102
+ const topLevelSignature = topLevelDepths[index] === 0
103
+ ? TopLevelScanner.signatureFor(lines, index, symbol)
104
+ : undefined;
105
+ const blockStartIndex = topLevelSignature?.bodyStartLineOffset == null
106
+ ? index
107
+ : index + topLevelSignature.bodyStartLineOffset;
108
+ const endLine = symbol.kind === "import" || symbol.kind === "export"
109
+ ? lineNumber
110
+ : endLineForBraces(lines, blockStartIndex);
111
+ const scanner = topLevelSignature == null
112
+ ? "regex"
113
+ : "toplevel";
114
+ const confidence = topLevelSignature == null
115
+ ? "low"
116
+ : "high";
117
+ symbols.push({
118
+ kind: symbol.kind,
119
+ name: symbol.name,
120
+ start_line: lineNumber,
121
+ end_line: endLine,
122
+ scanner,
123
+ confidence,
124
+ ...(topLevelSignature?.signature != null
125
+ ? { signature: topLevelSignature.signature }
126
+ : {}),
127
+ ...(topLevelSignature?.exported === true || symbol.exported === true
128
+ ? { exported: true }
129
+ : {}),
130
+ ...(symbol.container != null ? { container: symbol.container } : {}),
131
+ });
132
+ }
133
+ }
134
+ previousSignificant = trimmed;
135
+ });
136
+ return symbols;
137
+ }
138
+ function tsJsSymbolsForLine(line) {
139
+ const symbols = [];
140
+ const importMatch = line.match(/^import(?:\s+type)?(?:\s+[\s\S]*?\s+from)?\s+["']([^"']+)["'];?$/);
141
+ if (importMatch?.[1] != null) {
142
+ symbols.push({ kind: "import", name: importMatch[1] });
143
+ return symbols;
144
+ }
145
+ const namedExportMatch = line.match(/^export\s*\{([^}]+)\}/);
146
+ if (namedExportMatch?.[1] != null) {
147
+ for (const name of splitExportNames(namedExportMatch[1])) {
148
+ symbols.push({ kind: "export", name });
149
+ }
150
+ return symbols;
151
+ }
152
+ const requireMatch = line.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*require\(["'][^"']+["']\)/);
153
+ if (requireMatch?.[1] != null) {
154
+ symbols.push({ kind: "import", name: requireMatch[1] });
155
+ return symbols;
156
+ }
157
+ const testMatch = line.match(/^(?:describe|it|test)\s*\(\s*["'`]([^"'`]+)["'`]/);
158
+ if (testMatch?.[1] != null) {
159
+ symbols.push({ kind: "test", name: testMatch[1] });
160
+ return symbols;
161
+ }
162
+ const functionMatch = line.match(/^(?:export\s+(?:default\s+)?)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)/);
163
+ if (functionMatch?.[1] != null) {
164
+ symbols.push({
165
+ kind: "function",
166
+ name: functionMatch[1],
167
+ ...(isExportedTsJsLine(line) ? { exported: true } : {}),
168
+ });
169
+ return symbols;
170
+ }
171
+ // Recognizes arrow-function value declarations, including TS forms with a
172
+ // return-type annotation between the param list and `=>` (e.g.
173
+ // `const f = (x: T): R => …`, `async (x): Promise<void> =>`, and the simple
174
+ // generic `<T>(x: T): T =>`). The optional return-type segment deliberately
175
+ // EXCLUDES `=` from its char class so it stops before `=>` and never swallows
176
+ // the arrow; an exotic function-type return (e.g. `(): () => void =>`) stays
177
+ // best-effort. It still requires a trailing `=>`, so plain assignments
178
+ // (`const X = 5`) and call expressions (`const c = make()`) do not match here
179
+ // and fall through to exportValueMatch / callExpressionFunctionMatch.
180
+ const arrowFunctionMatch = line.match(/^(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:<[^>]*>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*(?::\s*[A-Za-z_$0-9.<>,\[\]{}|&'"\s()]+?\s*)?=>/);
181
+ if (arrowFunctionMatch?.[1] != null) {
182
+ symbols.push({
183
+ kind: "function",
184
+ name: arrowFunctionMatch[1],
185
+ ...(isExportedTsJsLine(line) ? { exported: true } : {}),
186
+ });
187
+ return symbols;
188
+ }
189
+ const callExpressionFunctionMatch = line.match(/^(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:[A-Za-z_$][\w$]*\.)?[A-Za-z_$][\w$]*\s*\(/);
190
+ if (callExpressionFunctionMatch?.[1] != null) {
191
+ symbols.push({
192
+ kind: "function",
193
+ name: callExpressionFunctionMatch[1],
194
+ ...(isExportedTsJsLine(line) ? { exported: true } : {}),
195
+ });
196
+ return symbols;
197
+ }
198
+ const classMatch = line.match(/^(?:export\s+(?:default\s+)?)?class\s+([A-Za-z_$][\w$]*)/);
199
+ if (classMatch?.[1] != null) {
200
+ symbols.push({
201
+ kind: "class",
202
+ name: classMatch[1],
203
+ ...(isExportedTsJsLine(line) ? { exported: true } : {}),
204
+ });
205
+ return symbols;
206
+ }
207
+ const interfaceMatch = line.match(/^(?:export\s+)?interface\s+([A-Za-z_$][\w$]*)/);
208
+ if (interfaceMatch?.[1] != null) {
209
+ symbols.push({
210
+ kind: "interface",
211
+ name: interfaceMatch[1],
212
+ ...(isExportedTsJsLine(line) ? { exported: true } : {}),
213
+ });
214
+ return symbols;
215
+ }
216
+ const typeMatch = line.match(/^(?:export\s+)?type\s+([A-Za-z_$][\w$]*)/);
217
+ if (typeMatch?.[1] != null) {
218
+ symbols.push({
219
+ kind: "type",
220
+ name: typeMatch[1],
221
+ ...(isExportedTsJsLine(line) ? { exported: true } : {}),
222
+ });
223
+ return symbols;
224
+ }
225
+ const exportValueMatch = line.match(/^export\s+(?:default\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)/);
226
+ if (exportValueMatch?.[1] != null) {
227
+ symbols.push({ kind: "export", name: exportValueMatch[1] });
228
+ return symbols;
229
+ }
230
+ const defaultExportMatch = line.match(/^export\s+default\s+([A-Za-z_$][\w$]*)/);
231
+ if (defaultExportMatch?.[1] != null) {
232
+ symbols.push({ kind: "export", name: defaultExportMatch[1] });
233
+ }
234
+ return symbols;
235
+ }
236
+ function rustSymbolForLine(line, previousSignificant) {
237
+ const pubUseMatch = line.match(/^pub\s+use\s+([^;]+);/);
238
+ if (pubUseMatch?.[1] != null) {
239
+ return { kind: "export", name: pubUseMatch[1].trim() };
240
+ }
241
+ const useMatch = line.match(/^use\s+([^;]+);/);
242
+ if (useMatch?.[1] != null) {
243
+ return { kind: "import", name: useMatch[1].trim() };
244
+ }
245
+ const functionMatch = line.match(/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?fn\s+([A-Za-z_]\w*)/);
246
+ if (functionMatch?.[1] != null) {
247
+ return {
248
+ kind: previousSignificant === "#[test]" ? "test" : "function",
249
+ name: functionMatch[1],
250
+ };
251
+ }
252
+ const typeMatch = line.match(/^(?:pub(?:\([^)]*\))?\s+)?(?:struct|enum|type)\s+([A-Za-z_]\w*)/);
253
+ if (typeMatch?.[1] != null) {
254
+ return { kind: "type", name: typeMatch[1] };
255
+ }
256
+ const traitMatch = line.match(/^(?:pub(?:\([^)]*\))?\s+)?trait\s+([A-Za-z_]\w*)/);
257
+ if (traitMatch?.[1] != null) {
258
+ return { kind: "interface", name: traitMatch[1] };
259
+ }
260
+ return undefined;
261
+ }
262
+ function scanPython(lines) {
263
+ const symbols = [];
264
+ lines.forEach((line, index) => {
265
+ const lineNumber = index + 1;
266
+ const trimmed = line.trim();
267
+ if (trimmed.length === 0) {
268
+ return;
269
+ }
270
+ const importMatch = trimmed.match(/^from\s+([\w.]+)\s+import\s+(.+)$/)
271
+ ?? trimmed.match(/^import\s+(.+)$/);
272
+ if (importMatch != null) {
273
+ const moduleName = importMatch[1] ?? "";
274
+ const importedName = importMatch[2];
275
+ symbols.push({
276
+ kind: "import",
277
+ name: importedName == null
278
+ ? moduleName.trim()
279
+ : `${moduleName.trim()}:${importedName.trim()}`,
280
+ start_line: lineNumber,
281
+ end_line: lineNumber,
282
+ scanner: "regex",
283
+ confidence: "low",
284
+ });
285
+ return;
286
+ }
287
+ const classMatch = trimmed.match(/^class\s+([A-Za-z_]\w*)/);
288
+ if (classMatch?.[1] != null) {
289
+ symbols.push({
290
+ kind: "class",
291
+ name: classMatch[1],
292
+ start_line: lineNumber,
293
+ end_line: endLineForIndentedBlock(lines, index),
294
+ scanner: "regex",
295
+ confidence: "low",
296
+ });
297
+ return;
298
+ }
299
+ const functionMatch = trimmed.match(/^(?:async\s+)?def\s+([A-Za-z_]\w*)/);
300
+ if (functionMatch?.[1] != null) {
301
+ symbols.push({
302
+ kind: functionMatch[1].startsWith("test_") ? "test" : "function",
303
+ name: functionMatch[1],
304
+ start_line: lineNumber,
305
+ end_line: endLineForIndentedBlock(lines, index),
306
+ scanner: "regex",
307
+ confidence: "low",
308
+ });
309
+ }
310
+ });
311
+ return symbols;
312
+ }
313
+ function isExportedTsJsLine(line) {
314
+ return /^export\b/.test(line);
315
+ }
316
+ class TopLevelScanner {
317
+ static signatureFor(lines, startIndex, symbol) {
318
+ if (symbol.kind !== "function") {
319
+ return undefined;
320
+ }
321
+ const text = declarationWindow(lines, startIndex);
322
+ return parseFunctionDeclaration(text, symbol.name)
323
+ ?? parseArrowDeclaration(text, symbol.name);
324
+ }
325
+ }
326
+ function declarationWindow(lines, startIndex) {
327
+ const maxLines = 80;
328
+ const maxChars = 12_000;
329
+ return lines
330
+ .slice(startIndex, Math.min(lines.length, startIndex + maxLines))
331
+ .join("\n")
332
+ .slice(0, maxChars);
333
+ }
334
+ function parseFunctionDeclaration(text, name) {
335
+ const match = new RegExp(`\\bfunction\\s+${escapeRegExp(name)}\\b`).exec(text);
336
+ if (match == null) {
337
+ return undefined;
338
+ }
339
+ let cursor = match.index + match[0].length;
340
+ const generic = readOptionalBalanced(text, cursor, "<", ">");
341
+ if (generic != null) {
342
+ cursor = generic.end + 1;
343
+ }
344
+ cursor = skipWhitespace(text, cursor);
345
+ if (text[cursor] !== "(") {
346
+ return undefined;
347
+ }
348
+ const parameters = readBalanced(text, cursor, "(", ")");
349
+ if (parameters == null) {
350
+ return undefined;
351
+ }
352
+ cursor = skipWhitespace(text, parameters.end + 1);
353
+ const returnType = text[cursor] === ":"
354
+ ? readReturnType(text, cursor, ["{", ";"])
355
+ : undefined;
356
+ const bodyStartIndex = findBodyStartIndex(text, returnType == null ? cursor : cursor + returnType.length);
357
+ const signature = normalizeSignatureText(`${name}${generic?.text ?? ""}${parameters.text}${returnType ?? ""}`);
358
+ return signature.length === 0
359
+ ? undefined
360
+ : {
361
+ signature,
362
+ ...(bodyStartIndex != null
363
+ ? { bodyStartLineOffset: lineOffsetForIndex(text, bodyStartIndex) }
364
+ : {}),
365
+ ...(isExportedTsJsLine(text.trimStart()) ? { exported: true } : {}),
366
+ };
367
+ }
368
+ function parseArrowDeclaration(text, name) {
369
+ const match = new RegExp(`^(?:export\\s+)?(?:const|let|var)\\s+${escapeRegExp(name)}\\b`).exec(text.trimStart());
370
+ if (match == null) {
371
+ return undefined;
372
+ }
373
+ const leadingTrimmed = text.trimStart();
374
+ const equalsIndex = leadingTrimmed.indexOf("=", match[0].length);
375
+ if (equalsIndex < 0) {
376
+ return undefined;
377
+ }
378
+ let cursor = skipWhitespace(leadingTrimmed, equalsIndex + 1);
379
+ if (leadingTrimmed.startsWith("async", cursor)) {
380
+ cursor = skipWhitespace(leadingTrimmed, cursor + "async".length);
381
+ }
382
+ const generic = readOptionalBalanced(leadingTrimmed, cursor, "<", ">");
383
+ if (generic != null) {
384
+ cursor = skipWhitespace(leadingTrimmed, generic.end + 1);
385
+ }
386
+ let parameters;
387
+ if (leadingTrimmed[cursor] === "(") {
388
+ const balancedParameters = readBalanced(leadingTrimmed, cursor, "(", ")");
389
+ if (balancedParameters == null) {
390
+ return undefined;
391
+ }
392
+ parameters = balancedParameters.text;
393
+ cursor = skipWhitespace(leadingTrimmed, balancedParameters.end + 1);
394
+ }
395
+ else {
396
+ const parameterMatch = /^[A-Za-z_$][\w$]*/.exec(leadingTrimmed.slice(cursor));
397
+ if (parameterMatch?.[0] == null) {
398
+ return undefined;
399
+ }
400
+ parameters = `(${parameterMatch[0]})`;
401
+ cursor = skipWhitespace(leadingTrimmed, cursor + parameterMatch[0].length);
402
+ }
403
+ const returnType = leadingTrimmed[cursor] === ":"
404
+ ? readReturnType(leadingTrimmed, cursor, ["=>"])
405
+ : undefined;
406
+ const arrowIndex = findTopLevelToken(leadingTrimmed, returnType == null ? cursor : cursor + returnType.length, "=>");
407
+ if (arrowIndex == null) {
408
+ return undefined;
409
+ }
410
+ const bodyStartIndex = findBodyStartIndex(leadingTrimmed, arrowIndex + 2);
411
+ const signature = normalizeSignatureText(`${name}${generic?.text ?? ""}${parameters}${returnType ?? ""}`);
412
+ return signature.length === 0
413
+ ? undefined
414
+ : {
415
+ signature,
416
+ ...(bodyStartIndex != null
417
+ ? { bodyStartLineOffset: lineOffsetForIndex(leadingTrimmed, bodyStartIndex) }
418
+ : {}),
419
+ ...(isExportedTsJsLine(leadingTrimmed) ? { exported: true } : {}),
420
+ };
421
+ }
422
+ function readOptionalBalanced(text, cursor, open, close) {
423
+ const start = skipWhitespace(text, cursor);
424
+ if (text[start] !== open) {
425
+ return undefined;
426
+ }
427
+ return readBalanced(text, start, open, close);
428
+ }
429
+ function readBalanced(text, start, open, close) {
430
+ const depths = { paren: 0, square: 0, brace: 0, angle: 0 };
431
+ const openKey = bracketKey(open);
432
+ const closeKey = bracketKey(close);
433
+ depths[openKey] = 1;
434
+ let quote;
435
+ for (let index = start + 1; index < text.length; index += 1) {
436
+ const char = text[index];
437
+ const previous = text[index - 1];
438
+ if (char == null) {
439
+ return undefined;
440
+ }
441
+ if (quote != null) {
442
+ if (char === quote && previous !== "\\") {
443
+ quote = undefined;
444
+ }
445
+ continue;
446
+ }
447
+ if (char === "\"" || char === "'" || char === "`") {
448
+ quote = char;
449
+ continue;
450
+ }
451
+ updateDepths(depths, char, previous);
452
+ if (char === close && depths[closeKey] === 0) {
453
+ return { text: text.slice(start, index + 1), end: index };
454
+ }
455
+ }
456
+ return undefined;
457
+ }
458
+ function readReturnType(text, colonIndex, terminators) {
459
+ const depths = { paren: 0, square: 0, brace: 0, angle: 0 };
460
+ let quote;
461
+ for (let index = colonIndex + 1; index < text.length; index += 1) {
462
+ const char = text[index];
463
+ const previous = text[index - 1];
464
+ if (char == null) {
465
+ break;
466
+ }
467
+ if (quote != null) {
468
+ if (char === quote && previous !== "\\") {
469
+ quote = undefined;
470
+ }
471
+ continue;
472
+ }
473
+ if (char === "\"" || char === "'" || char === "`") {
474
+ quote = char;
475
+ continue;
476
+ }
477
+ if (allDepthsZero(depths) && matchesTerminator(text, index, terminators)) {
478
+ if (char !== "{" || isReturnTypeObjectStart(text, colonIndex, index)) {
479
+ updateDepths(depths, char, previous);
480
+ continue;
481
+ }
482
+ return text.slice(colonIndex, index).trimEnd();
483
+ }
484
+ updateDepths(depths, char, previous);
485
+ }
486
+ const raw = text.slice(colonIndex).trimEnd();
487
+ return raw.length === 0 ? undefined : raw;
488
+ }
489
+ function findTopLevelToken(text, start, token) {
490
+ const depths = { paren: 0, square: 0, brace: 0, angle: 0 };
491
+ let quote;
492
+ for (let index = start; index < text.length; index += 1) {
493
+ const char = text[index];
494
+ const previous = text[index - 1];
495
+ if (char == null) {
496
+ return undefined;
497
+ }
498
+ if (quote != null) {
499
+ if (char === quote && previous !== "\\") {
500
+ quote = undefined;
501
+ }
502
+ continue;
503
+ }
504
+ if (char === "\"" || char === "'" || char === "`") {
505
+ quote = char;
506
+ continue;
507
+ }
508
+ if (allDepthsZero(depths) && text.startsWith(token, index)) {
509
+ return index;
510
+ }
511
+ updateDepths(depths, char, previous);
512
+ }
513
+ return undefined;
514
+ }
515
+ function updateDepths(depths, char, previous) {
516
+ if (char === "(") {
517
+ depths.paren += 1;
518
+ }
519
+ else if (char === ")") {
520
+ depths.paren = Math.max(0, depths.paren - 1);
521
+ }
522
+ else if (char === "[") {
523
+ depths.square += 1;
524
+ }
525
+ else if (char === "]") {
526
+ depths.square = Math.max(0, depths.square - 1);
527
+ }
528
+ else if (char === "{") {
529
+ depths.brace += 1;
530
+ }
531
+ else if (char === "}") {
532
+ depths.brace = Math.max(0, depths.brace - 1);
533
+ }
534
+ else if (char === "<") {
535
+ depths.angle += 1;
536
+ }
537
+ else if (char === ">" && previous !== "=") {
538
+ depths.angle = Math.max(0, depths.angle - 1);
539
+ }
540
+ }
541
+ function bracketKey(bracket) {
542
+ return bracket === "<" || bracket === ">" ? "angle" : "paren";
543
+ }
544
+ function allDepthsZero(depths) {
545
+ return depths.paren === 0
546
+ && depths.square === 0
547
+ && depths.brace === 0
548
+ && depths.angle === 0;
549
+ }
550
+ function matchesTerminator(text, index, terminators) {
551
+ return terminators.some((terminator) => text.startsWith(terminator, index));
552
+ }
553
+ function isReturnTypeObjectStart(text, colonIndex, braceIndex) {
554
+ const rawType = text.slice(colonIndex + 1, braceIndex).trim();
555
+ if (rawType.length === 0) {
556
+ return true;
557
+ }
558
+ const previous = previousNonWhitespace(text, braceIndex - 1);
559
+ return previous != null && ":|&=,<([".includes(previous);
560
+ }
561
+ function previousNonWhitespace(text, start) {
562
+ for (let index = start; index >= 0; index -= 1) {
563
+ const char = text[index];
564
+ if (char != null && !/\s/.test(char)) {
565
+ return char;
566
+ }
567
+ }
568
+ return undefined;
569
+ }
570
+ function findBodyStartIndex(text, start) {
571
+ const cursor = skipWhitespace(text, start);
572
+ return text[cursor] === "{" ? cursor : undefined;
573
+ }
574
+ function lineOffsetForIndex(text, targetIndex) {
575
+ let lineOffset = 0;
576
+ for (let index = 0; index < targetIndex; index += 1) {
577
+ if (text[index] === "\n") {
578
+ lineOffset += 1;
579
+ }
580
+ }
581
+ return lineOffset;
582
+ }
583
+ function skipWhitespace(text, start) {
584
+ let cursor = start;
585
+ while (cursor < text.length && /\s/.test(text[cursor] ?? "")) {
586
+ cursor += 1;
587
+ }
588
+ return cursor;
589
+ }
590
+ function normalizeSignatureText(text) {
591
+ return text
592
+ .replace(/\s+/g, " ")
593
+ .replace(/<\s+/g, "<")
594
+ .replace(/\s+>/g, ">")
595
+ .replace(/,\s*\)/g, ")")
596
+ .replace(/\(\s+/g, "(")
597
+ .replace(/\s+\)/g, ")")
598
+ .trim();
599
+ }
600
+ function escapeRegExp(value) {
601
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
602
+ }
603
+ function braceDepthBeforeLines(lines) {
604
+ const depths = [];
605
+ let depth = 0;
606
+ for (const line of lines) {
607
+ depths.push(depth);
608
+ const stripped = stripQuotedText(line);
609
+ for (const char of stripped) {
610
+ if (char === "{") {
611
+ depth += 1;
612
+ }
613
+ else if (char === "}") {
614
+ depth = Math.max(0, depth - 1);
615
+ }
616
+ }
617
+ }
618
+ return depths;
619
+ }
620
+ function splitExportNames(names) {
621
+ return names
622
+ .split(",")
623
+ .map((name) => name.trim())
624
+ .filter((name) => name.length > 0)
625
+ .map((name) => {
626
+ const aliasMatch = name.match(/\s+as\s+([A-Za-z_$][\w$]*)$/);
627
+ return aliasMatch?.[1] ?? name;
628
+ });
629
+ }
630
+ function endLineForBraces(lines, startIndex) {
631
+ let depth = 0;
632
+ let sawBrace = false;
633
+ for (let index = startIndex; index < lines.length; index += 1) {
634
+ const line = stripQuotedText(lines[index] ?? "");
635
+ for (const char of line) {
636
+ if (char === "{") {
637
+ depth += 1;
638
+ sawBrace = true;
639
+ }
640
+ else if (char === "}") {
641
+ depth -= 1;
642
+ }
643
+ }
644
+ if (sawBrace && depth <= 0) {
645
+ return index + 1;
646
+ }
647
+ }
648
+ return startIndex + 1;
649
+ }
650
+ function endLineForIndentedBlock(lines, startIndex) {
651
+ const startIndent = indentationOf(lines[startIndex] ?? "");
652
+ let lastLine = startIndex + 1;
653
+ for (let index = startIndex + 1; index < lines.length; index += 1) {
654
+ const line = lines[index] ?? "";
655
+ const trimmed = line.trim();
656
+ if (trimmed.length === 0 || trimmed.startsWith("#")) {
657
+ continue;
658
+ }
659
+ if (indentationOf(line) <= startIndent) {
660
+ break;
661
+ }
662
+ lastLine = index + 1;
663
+ }
664
+ return lastLine;
665
+ }
666
+ function indentationOf(line) {
667
+ const match = line.match(/^\s*/);
668
+ return match?.[0].length ?? 0;
669
+ }
670
+ function stripQuotedText(line) {
671
+ return line
672
+ .replace(/(["'`])(?:\\.|(?!\1).)*\1/g, "")
673
+ .replace(/\/\/.*$/, "");
674
+ }
675
+ //# sourceMappingURL=codemap.js.map