@genobank/biofs 3.1.0 → 3.18.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 (499) hide show
  1. package/CHANGELOG.md +663 -462
  2. package/dist/abi/USDC.json +33 -0
  3. package/dist/abi/sequentia/BioAgentRegistry.json +20 -0
  4. package/dist/abi/sequentia/BioCIDRegistry.json +139 -0
  5. package/dist/abi/sequentia/BioPIL.json +130 -0
  6. package/dist/abi/sequentia/ConsentManager.json +620 -0
  7. package/dist/abi/sequentia/OpenCravatJobs.json +988 -0
  8. package/dist/abi/sequentia/PaymentRouter.json +638 -0
  9. package/dist/commands/agent/list-sequentia.d.ts +17 -0
  10. package/dist/commands/agent/list-sequentia.d.ts.map +1 -0
  11. package/dist/commands/agent/list-sequentia.js +87 -0
  12. package/dist/commands/agent/list-sequentia.js.map +1 -0
  13. package/dist/commands/agent/register-sequentia.d.ts +33 -0
  14. package/dist/commands/agent/register-sequentia.d.ts.map +1 -0
  15. package/dist/commands/agent/register-sequentia.js +145 -0
  16. package/dist/commands/agent/register-sequentia.js.map +1 -0
  17. package/dist/commands/align-shard/exec.d.ts +45 -0
  18. package/dist/commands/align-shard/exec.d.ts.map +1 -0
  19. package/dist/commands/align-shard/exec.js +549 -0
  20. package/dist/commands/align-shard/exec.js.map +1 -0
  21. package/dist/commands/align-shard/submit.d.ts +37 -0
  22. package/dist/commands/align-shard/submit.d.ts.map +1 -0
  23. package/dist/commands/align-shard/submit.js +117 -0
  24. package/dist/commands/align-shard/submit.js.map +1 -0
  25. package/dist/commands/ancestry/ingest.d.ts +34 -0
  26. package/dist/commands/ancestry/ingest.d.ts.map +1 -0
  27. package/dist/commands/ancestry/ingest.js +175 -0
  28. package/dist/commands/ancestry/ingest.js.map +1 -0
  29. package/dist/commands/ancestry/share.d.ts +33 -0
  30. package/dist/commands/ancestry/share.d.ts.map +1 -0
  31. package/dist/commands/ancestry/share.js +154 -0
  32. package/dist/commands/ancestry/share.js.map +1 -0
  33. package/dist/commands/ancestry/somos.d.ts +34 -0
  34. package/dist/commands/ancestry/somos.d.ts.map +1 -0
  35. package/dist/commands/ancestry/somos.js +151 -0
  36. package/dist/commands/ancestry/somos.js.map +1 -0
  37. package/dist/commands/ancestry/status.d.ts +14 -0
  38. package/dist/commands/ancestry/status.d.ts.map +1 -0
  39. package/dist/commands/ancestry/status.js +74 -0
  40. package/dist/commands/ancestry/status.js.map +1 -0
  41. package/dist/commands/annotate/status.d.ts +11 -4
  42. package/dist/commands/annotate/status.d.ts.map +1 -1
  43. package/dist/commands/annotate/status.js +66 -99
  44. package/dist/commands/annotate/status.js.map +1 -1
  45. package/dist/commands/annotate/submit.d.ts +15 -5
  46. package/dist/commands/annotate/submit.d.ts.map +1 -1
  47. package/dist/commands/annotate/submit.js +86 -266
  48. package/dist/commands/annotate/submit.js.map +1 -1
  49. package/dist/commands/benchmark.d.ts +50 -0
  50. package/dist/commands/benchmark.d.ts.map +1 -0
  51. package/dist/commands/benchmark.js +608 -0
  52. package/dist/commands/benchmark.js.map +1 -0
  53. package/dist/commands/biofiles.d.ts +1 -0
  54. package/dist/commands/biofiles.d.ts.map +1 -1
  55. package/dist/commands/biofiles.js +19 -6
  56. package/dist/commands/biofiles.js.map +1 -1
  57. package/dist/commands/biowallet/bind.d.ts +12 -0
  58. package/dist/commands/biowallet/bind.d.ts.map +1 -0
  59. package/dist/commands/biowallet/bind.js +85 -0
  60. package/dist/commands/biowallet/bind.js.map +1 -0
  61. package/dist/commands/biowallet/create.d.ts +40 -0
  62. package/dist/commands/biowallet/create.d.ts.map +1 -0
  63. package/dist/commands/biowallet/create.js +191 -0
  64. package/dist/commands/biowallet/create.js.map +1 -0
  65. package/dist/commands/biowallet/family.d.ts +48 -0
  66. package/dist/commands/biowallet/family.d.ts.map +1 -0
  67. package/dist/commands/biowallet/family.js +310 -0
  68. package/dist/commands/biowallet/family.js.map +1 -0
  69. package/dist/commands/biowallet/list.d.ts +15 -0
  70. package/dist/commands/biowallet/list.d.ts.map +1 -0
  71. package/dist/commands/biowallet/list.js +81 -0
  72. package/dist/commands/biowallet/list.js.map +1 -0
  73. package/dist/commands/bode.d.ts +34 -0
  74. package/dist/commands/bode.d.ts.map +1 -0
  75. package/dist/commands/bode.js +257 -0
  76. package/dist/commands/bode.js.map +1 -0
  77. package/dist/commands/claim.d.ts +32 -0
  78. package/dist/commands/claim.d.ts.map +1 -0
  79. package/dist/commands/claim.js +138 -0
  80. package/dist/commands/claim.js.map +1 -0
  81. package/dist/commands/clinical.d.ts +49 -0
  82. package/dist/commands/clinical.d.ts.map +1 -0
  83. package/dist/commands/clinical.js +273 -0
  84. package/dist/commands/clinical.js.map +1 -0
  85. package/dist/commands/cohort-acmg.d.ts +42 -0
  86. package/dist/commands/cohort-acmg.d.ts.map +1 -0
  87. package/dist/commands/cohort-acmg.js +319 -0
  88. package/dist/commands/cohort-acmg.js.map +1 -0
  89. package/dist/commands/cohort-fourier-score.d.ts +57 -0
  90. package/dist/commands/cohort-fourier-score.d.ts.map +1 -0
  91. package/dist/commands/cohort-fourier-score.js +390 -0
  92. package/dist/commands/cohort-fourier-score.js.map +1 -0
  93. package/dist/commands/cohort-pipeline.d.ts +49 -0
  94. package/dist/commands/cohort-pipeline.d.ts.map +1 -0
  95. package/dist/commands/cohort-pipeline.js +308 -0
  96. package/dist/commands/cohort-pipeline.js.map +1 -0
  97. package/dist/commands/cohort-train.d.ts +45 -0
  98. package/dist/commands/cohort-train.d.ts.map +1 -0
  99. package/dist/commands/cohort-train.js +308 -0
  100. package/dist/commands/cohort-train.js.map +1 -0
  101. package/dist/commands/comethyl/exec.d.ts +40 -0
  102. package/dist/commands/comethyl/exec.d.ts.map +1 -0
  103. package/dist/commands/comethyl/exec.js +493 -0
  104. package/dist/commands/comethyl/exec.js.map +1 -0
  105. package/dist/commands/comethyl/submit.d.ts +35 -0
  106. package/dist/commands/comethyl/submit.d.ts.map +1 -0
  107. package/dist/commands/comethyl/submit.js +98 -0
  108. package/dist/commands/comethyl/submit.js.map +1 -0
  109. package/dist/commands/consent.d.ts +10 -0
  110. package/dist/commands/consent.d.ts.map +1 -0
  111. package/dist/commands/consent.js +114 -0
  112. package/dist/commands/consent.js.map +1 -0
  113. package/dist/commands/dipcall/exec.d.ts +25 -0
  114. package/dist/commands/dipcall/exec.d.ts.map +1 -0
  115. package/dist/commands/dipcall/exec.js +207 -0
  116. package/dist/commands/dipcall/exec.js.map +1 -0
  117. package/dist/commands/dipcall/submit.d.ts +22 -0
  118. package/dist/commands/dipcall/submit.d.ts.map +1 -0
  119. package/dist/commands/dipcall/submit.js +81 -0
  120. package/dist/commands/dipcall/submit.js.map +1 -0
  121. package/dist/commands/download-with-consent.d.ts +1 -0
  122. package/dist/commands/download-with-consent.d.ts.map +1 -1
  123. package/dist/commands/download-with-consent.js +32 -0
  124. package/dist/commands/download-with-consent.js.map +1 -1
  125. package/dist/commands/download.d.ts +2 -0
  126. package/dist/commands/download.d.ts.map +1 -1
  127. package/dist/commands/download.js +31 -0
  128. package/dist/commands/download.js.map +1 -1
  129. package/dist/commands/duet.d.ts +39 -0
  130. package/dist/commands/duet.d.ts.map +1 -0
  131. package/dist/commands/duet.js +323 -0
  132. package/dist/commands/duet.js.map +1 -0
  133. package/dist/commands/erase.d.ts +29 -0
  134. package/dist/commands/erase.d.ts.map +1 -0
  135. package/dist/commands/erase.js +136 -0
  136. package/dist/commands/erase.js.map +1 -0
  137. package/dist/commands/family-status.d.ts +3 -0
  138. package/dist/commands/family-status.d.ts.map +1 -1
  139. package/dist/commands/family-status.js +279 -166
  140. package/dist/commands/family-status.js.map +1 -1
  141. package/dist/commands/fingerprint.d.ts +2 -0
  142. package/dist/commands/fingerprint.d.ts.map +1 -1
  143. package/dist/commands/fingerprint.js +4 -0
  144. package/dist/commands/fingerprint.js.map +1 -1
  145. package/dist/commands/fluency/index.d.ts +7 -0
  146. package/dist/commands/fluency/index.d.ts.map +1 -0
  147. package/dist/commands/fluency/index.js +122 -0
  148. package/dist/commands/fluency/index.js.map +1 -0
  149. package/dist/commands/fourier-score.d.ts +36 -0
  150. package/dist/commands/fourier-score.d.ts.map +1 -0
  151. package/dist/commands/fourier-score.js +713 -0
  152. package/dist/commands/fourier-score.js.map +1 -0
  153. package/dist/commands/fuse.d.ts.map +1 -1
  154. package/dist/commands/fuse.js +29 -7
  155. package/dist/commands/fuse.js.map +1 -1
  156. package/dist/commands/hifi-align/exec.d.ts +23 -0
  157. package/dist/commands/hifi-align/exec.d.ts.map +1 -0
  158. package/dist/commands/hifi-align/exec.js +224 -0
  159. package/dist/commands/hifi-align/exec.js.map +1 -0
  160. package/dist/commands/hifi-align/submit.d.ts +22 -0
  161. package/dist/commands/hifi-align/submit.d.ts.map +1 -0
  162. package/dist/commands/hifi-align/submit.js +82 -0
  163. package/dist/commands/hifi-align/submit.js.map +1 -0
  164. package/dist/commands/hifi-deepvariant/exec.d.ts +29 -0
  165. package/dist/commands/hifi-deepvariant/exec.d.ts.map +1 -0
  166. package/dist/commands/hifi-deepvariant/exec.js +280 -0
  167. package/dist/commands/hifi-deepvariant/exec.js.map +1 -0
  168. package/dist/commands/hifi-deepvariant/submit.d.ts +23 -0
  169. package/dist/commands/hifi-deepvariant/submit.d.ts.map +1 -0
  170. package/dist/commands/hifi-deepvariant/submit.js +80 -0
  171. package/dist/commands/hifi-deepvariant/submit.js.map +1 -0
  172. package/dist/commands/hifi-methyl/exec.d.ts +25 -0
  173. package/dist/commands/hifi-methyl/exec.d.ts.map +1 -0
  174. package/dist/commands/hifi-methyl/exec.js +243 -0
  175. package/dist/commands/hifi-methyl/exec.js.map +1 -0
  176. package/dist/commands/hifi-methyl/submit.d.ts +22 -0
  177. package/dist/commands/hifi-methyl/submit.d.ts.map +1 -0
  178. package/dist/commands/hifi-methyl/submit.js +78 -0
  179. package/dist/commands/hifi-methyl/submit.js.map +1 -0
  180. package/dist/commands/htsget.d.ts +6 -0
  181. package/dist/commands/htsget.d.ts.map +1 -1
  182. package/dist/commands/htsget.js +31 -6
  183. package/dist/commands/htsget.js.map +1 -1
  184. package/dist/commands/imaging/attribute.d.ts +19 -0
  185. package/dist/commands/imaging/attribute.d.ts.map +1 -0
  186. package/dist/commands/imaging/attribute.js +102 -0
  187. package/dist/commands/imaging/attribute.js.map +1 -0
  188. package/dist/commands/imaging/characterize.d.ts +20 -0
  189. package/dist/commands/imaging/characterize.d.ts.map +1 -0
  190. package/dist/commands/imaging/characterize.js +105 -0
  191. package/dist/commands/imaging/characterize.js.map +1 -0
  192. package/dist/commands/imaging/compare.d.ts +33 -0
  193. package/dist/commands/imaging/compare.d.ts.map +1 -0
  194. package/dist/commands/imaging/compare.js +129 -0
  195. package/dist/commands/imaging/compare.js.map +1 -0
  196. package/dist/commands/imaging/enrich.d.ts +28 -0
  197. package/dist/commands/imaging/enrich.d.ts.map +1 -0
  198. package/dist/commands/imaging/enrich.js +130 -0
  199. package/dist/commands/imaging/enrich.js.map +1 -0
  200. package/dist/commands/imaging/findings.d.ts +21 -0
  201. package/dist/commands/imaging/findings.d.ts.map +1 -0
  202. package/dist/commands/imaging/findings.js +134 -0
  203. package/dist/commands/imaging/findings.js.map +1 -0
  204. package/dist/commands/imaging/lesions.d.ts +21 -0
  205. package/dist/commands/imaging/lesions.d.ts.map +1 -0
  206. package/dist/commands/imaging/lesions.js +131 -0
  207. package/dist/commands/imaging/lesions.js.map +1 -0
  208. package/dist/commands/imaging/submit.d.ts +32 -0
  209. package/dist/commands/imaging/submit.d.ts.map +1 -0
  210. package/dist/commands/imaging/submit.js +118 -0
  211. package/dist/commands/imaging/submit.js.map +1 -0
  212. package/dist/commands/imaging/trajectory.d.ts +23 -0
  213. package/dist/commands/imaging/trajectory.d.ts.map +1 -0
  214. package/dist/commands/imaging/trajectory.js +134 -0
  215. package/dist/commands/imaging/trajectory.js.map +1 -0
  216. package/dist/commands/imaging/twin.d.ts +32 -0
  217. package/dist/commands/imaging/twin.d.ts.map +1 -0
  218. package/dist/commands/imaging/twin.js +168 -0
  219. package/dist/commands/imaging/twin.js.map +1 -0
  220. package/dist/commands/ingest-rna-tpm.d.ts +33 -0
  221. package/dist/commands/ingest-rna-tpm.d.ts.map +1 -0
  222. package/dist/commands/ingest-rna-tpm.js +104 -0
  223. package/dist/commands/ingest-rna-tpm.js.map +1 -0
  224. package/dist/commands/interpret/status.d.ts +14 -0
  225. package/dist/commands/interpret/status.d.ts.map +1 -0
  226. package/dist/commands/interpret/status.js +83 -0
  227. package/dist/commands/interpret/status.js.map +1 -0
  228. package/dist/commands/interpret/submit.d.ts +22 -0
  229. package/dist/commands/interpret/submit.d.ts.map +1 -0
  230. package/dist/commands/interpret/submit.js +103 -0
  231. package/dist/commands/interpret/submit.js.map +1 -0
  232. package/dist/commands/inventory/cohort.d.ts +29 -0
  233. package/dist/commands/inventory/cohort.d.ts.map +1 -0
  234. package/dist/commands/inventory/cohort.js +136 -0
  235. package/dist/commands/inventory/cohort.js.map +1 -0
  236. package/dist/commands/inventory-register-sqlite.d.ts +36 -0
  237. package/dist/commands/inventory-register-sqlite.d.ts.map +1 -0
  238. package/dist/commands/inventory-register-sqlite.js +178 -0
  239. package/dist/commands/inventory-register-sqlite.js.map +1 -0
  240. package/dist/commands/job/recall.d.ts +6 -0
  241. package/dist/commands/job/recall.d.ts.map +1 -0
  242. package/dist/commands/job/recall.js +59 -0
  243. package/dist/commands/job/recall.js.map +1 -0
  244. package/dist/commands/job/reconcile.d.ts +19 -0
  245. package/dist/commands/job/reconcile.d.ts.map +1 -0
  246. package/dist/commands/job/reconcile.js +67 -0
  247. package/dist/commands/job/reconcile.js.map +1 -0
  248. package/dist/commands/lab/refreshCoverage.d.ts +53 -0
  249. package/dist/commands/lab/refreshCoverage.d.ts.map +1 -0
  250. package/dist/commands/lab/refreshCoverage.js +244 -0
  251. package/dist/commands/lab/refreshCoverage.js.map +1 -0
  252. package/dist/commands/liftover/exec.d.ts +27 -0
  253. package/dist/commands/liftover/exec.d.ts.map +1 -0
  254. package/dist/commands/liftover/exec.js +258 -0
  255. package/dist/commands/liftover/exec.js.map +1 -0
  256. package/dist/commands/liftover/submit.d.ts +22 -0
  257. package/dist/commands/liftover/submit.d.ts.map +1 -0
  258. package/dist/commands/liftover/submit.js +79 -0
  259. package/dist/commands/liftover/submit.js.map +1 -0
  260. package/dist/commands/lineage.d.ts +6 -0
  261. package/dist/commands/lineage.d.ts.map +1 -0
  262. package/dist/commands/lineage.js +126 -0
  263. package/dist/commands/lineage.js.map +1 -0
  264. package/dist/commands/methyl/exec.d.ts +47 -0
  265. package/dist/commands/methyl/exec.d.ts.map +1 -0
  266. package/dist/commands/methyl/exec.js +565 -0
  267. package/dist/commands/methyl/exec.js.map +1 -0
  268. package/dist/commands/methyl/submit.d.ts +25 -0
  269. package/dist/commands/methyl/submit.d.ts.map +1 -0
  270. package/dist/commands/methyl/submit.js +98 -0
  271. package/dist/commands/methyl/submit.js.map +1 -0
  272. package/dist/commands/mount.d.ts +17 -2
  273. package/dist/commands/mount.d.ts.map +1 -1
  274. package/dist/commands/mount.js +158 -6
  275. package/dist/commands/mount.js.map +1 -1
  276. package/dist/commands/myvariant.d.ts +60 -0
  277. package/dist/commands/myvariant.d.ts.map +1 -0
  278. package/dist/commands/myvariant.js +433 -0
  279. package/dist/commands/myvariant.js.map +1 -0
  280. package/dist/commands/ont-variants/exec.d.ts +24 -0
  281. package/dist/commands/ont-variants/exec.d.ts.map +1 -0
  282. package/dist/commands/ont-variants/exec.js +230 -0
  283. package/dist/commands/ont-variants/exec.js.map +1 -0
  284. package/dist/commands/ont-variants/submit.d.ts +22 -0
  285. package/dist/commands/ont-variants/submit.d.ts.map +1 -0
  286. package/dist/commands/ont-variants/submit.js +78 -0
  287. package/dist/commands/ont-variants/submit.js.map +1 -0
  288. package/dist/commands/pbsv/exec.d.ts +24 -0
  289. package/dist/commands/pbsv/exec.d.ts.map +1 -0
  290. package/dist/commands/pbsv/exec.js +231 -0
  291. package/dist/commands/pbsv/exec.js.map +1 -0
  292. package/dist/commands/pbsv/submit.d.ts +22 -0
  293. package/dist/commands/pbsv/submit.d.ts.map +1 -0
  294. package/dist/commands/pbsv/submit.js +78 -0
  295. package/dist/commands/pbsv/submit.js.map +1 -0
  296. package/dist/commands/phase/exec.d.ts +26 -0
  297. package/dist/commands/phase/exec.d.ts.map +1 -0
  298. package/dist/commands/phase/exec.js +246 -0
  299. package/dist/commands/phase/exec.js.map +1 -0
  300. package/dist/commands/phase/submit.d.ts +24 -0
  301. package/dist/commands/phase/submit.d.ts.map +1 -0
  302. package/dist/commands/phase/submit.js +83 -0
  303. package/dist/commands/phase/submit.js.map +1 -0
  304. package/dist/commands/pipe.d.ts +4 -2
  305. package/dist/commands/pipe.d.ts.map +1 -1
  306. package/dist/commands/pipe.js +55 -50
  307. package/dist/commands/pipe.js.map +1 -1
  308. package/dist/commands/pipeline/runWes.d.ts +28 -0
  309. package/dist/commands/pipeline/runWes.d.ts.map +1 -0
  310. package/dist/commands/pipeline/runWes.js +276 -0
  311. package/dist/commands/pipeline/runWes.js.map +1 -0
  312. package/dist/commands/profile.d.ts +8 -0
  313. package/dist/commands/profile.d.ts.map +1 -0
  314. package/dist/commands/profile.js +193 -0
  315. package/dist/commands/profile.js.map +1 -0
  316. package/dist/commands/psm-consensus.d.ts +72 -0
  317. package/dist/commands/psm-consensus.d.ts.map +1 -0
  318. package/dist/commands/psm-consensus.js +338 -0
  319. package/dist/commands/psm-consensus.js.map +1 -0
  320. package/dist/commands/qc/exec.d.ts +32 -0
  321. package/dist/commands/qc/exec.d.ts.map +1 -0
  322. package/dist/commands/qc/exec.js +350 -0
  323. package/dist/commands/qc/exec.js.map +1 -0
  324. package/dist/commands/qc/submit.d.ts +23 -0
  325. package/dist/commands/qc/submit.d.ts.map +1 -0
  326. package/dist/commands/qc/submit.js +88 -0
  327. package/dist/commands/qc/submit.js.map +1 -0
  328. package/dist/commands/query.d.ts +37 -0
  329. package/dist/commands/query.d.ts.map +1 -0
  330. package/dist/commands/query.js +170 -0
  331. package/dist/commands/query.js.map +1 -0
  332. package/dist/commands/repeat-genotype/exec.d.ts +26 -0
  333. package/dist/commands/repeat-genotype/exec.d.ts.map +1 -0
  334. package/dist/commands/repeat-genotype/exec.js +245 -0
  335. package/dist/commands/repeat-genotype/exec.js.map +1 -0
  336. package/dist/commands/repeat-genotype/submit.d.ts +23 -0
  337. package/dist/commands/repeat-genotype/submit.d.ts.map +1 -0
  338. package/dist/commands/repeat-genotype/submit.js +82 -0
  339. package/dist/commands/repeat-genotype/submit.js.map +1 -0
  340. package/dist/commands/researcher/passport.d.ts +15 -0
  341. package/dist/commands/researcher/passport.d.ts.map +1 -0
  342. package/dist/commands/researcher/passport.js +98 -0
  343. package/dist/commands/researcher/passport.js.map +1 -0
  344. package/dist/commands/researcher/register.d.ts +18 -0
  345. package/dist/commands/researcher/register.d.ts.map +1 -0
  346. package/dist/commands/researcher/register.js +277 -0
  347. package/dist/commands/researcher/register.js.map +1 -0
  348. package/dist/commands/researcher/status.d.ts +6 -0
  349. package/dist/commands/researcher/status.d.ts.map +1 -0
  350. package/dist/commands/researcher/status.js +111 -0
  351. package/dist/commands/researcher/status.js.map +1 -0
  352. package/dist/commands/room.d.ts +31 -0
  353. package/dist/commands/room.d.ts.map +1 -0
  354. package/dist/commands/room.js +486 -0
  355. package/dist/commands/room.js.map +1 -0
  356. package/dist/commands/route/anchor.d.ts +42 -0
  357. package/dist/commands/route/anchor.d.ts.map +1 -0
  358. package/dist/commands/route/anchor.js +213 -0
  359. package/dist/commands/route/anchor.js.map +1 -0
  360. package/dist/commands/route/index.d.ts +27 -0
  361. package/dist/commands/route/index.d.ts.map +1 -0
  362. package/dist/commands/route/index.js +82 -0
  363. package/dist/commands/route/index.js.map +1 -0
  364. package/dist/commands/rrm-consensus.d.ts +74 -0
  365. package/dist/commands/rrm-consensus.d.ts.map +1 -0
  366. package/dist/commands/rrm-consensus.js +334 -0
  367. package/dist/commands/rrm-consensus.js.map +1 -0
  368. package/dist/commands/rrm-distribution.d.ts +34 -0
  369. package/dist/commands/rrm-distribution.d.ts.map +1 -0
  370. package/dist/commands/rrm-distribution.js +743 -0
  371. package/dist/commands/rrm-distribution.js.map +1 -0
  372. package/dist/commands/rrm-train.d.ts +33 -0
  373. package/dist/commands/rrm-train.d.ts.map +1 -0
  374. package/dist/commands/rrm-train.js +549 -0
  375. package/dist/commands/rrm-train.js.map +1 -0
  376. package/dist/commands/samples.d.ts +25 -0
  377. package/dist/commands/samples.d.ts.map +1 -0
  378. package/dist/commands/samples.js +184 -0
  379. package/dist/commands/samples.js.map +1 -0
  380. package/dist/commands/score-protein.d.ts +13 -0
  381. package/dist/commands/score-protein.d.ts.map +1 -0
  382. package/dist/commands/score-protein.js +360 -0
  383. package/dist/commands/score-protein.js.map +1 -0
  384. package/dist/commands/stream.d.ts +7 -0
  385. package/dist/commands/stream.d.ts.map +1 -1
  386. package/dist/commands/stream.js +26 -41
  387. package/dist/commands/stream.js.map +1 -1
  388. package/dist/commands/sv-call/exec.d.ts +23 -0
  389. package/dist/commands/sv-call/exec.d.ts.map +1 -0
  390. package/dist/commands/sv-call/exec.js +233 -0
  391. package/dist/commands/sv-call/exec.js.map +1 -0
  392. package/dist/commands/sv-call/submit.d.ts +21 -0
  393. package/dist/commands/sv-call/submit.d.ts.map +1 -0
  394. package/dist/commands/sv-call/submit.js +77 -0
  395. package/dist/commands/sv-call/submit.js.map +1 -0
  396. package/dist/commands/tele.d.ts +42 -0
  397. package/dist/commands/tele.d.ts.map +1 -0
  398. package/dist/commands/tele.js +559 -0
  399. package/dist/commands/tele.js.map +1 -0
  400. package/dist/commands/tokenize-spectrum.d.ts +58 -0
  401. package/dist/commands/tokenize-spectrum.d.ts.map +1 -0
  402. package/dist/commands/tokenize-spectrum.js +297 -0
  403. package/dist/commands/tokenize-spectrum.js.map +1 -0
  404. package/dist/commands/umount.d.ts.map +1 -1
  405. package/dist/commands/umount.js +42 -1
  406. package/dist/commands/umount.js.map +1 -1
  407. package/dist/commands/variants.d.ts +42 -0
  408. package/dist/commands/variants.d.ts.map +1 -0
  409. package/dist/commands/variants.js +237 -0
  410. package/dist/commands/variants.js.map +1 -0
  411. package/dist/commands/verkko/exec.d.ts +27 -0
  412. package/dist/commands/verkko/exec.d.ts.map +1 -0
  413. package/dist/commands/verkko/exec.js +223 -0
  414. package/dist/commands/verkko/exec.js.map +1 -0
  415. package/dist/commands/verkko/submit.d.ts +24 -0
  416. package/dist/commands/verkko/submit.d.ts.map +1 -0
  417. package/dist/commands/verkko/submit.js +96 -0
  418. package/dist/commands/verkko/submit.js.map +1 -0
  419. package/dist/commands/wavelet-consensus.d.ts +69 -0
  420. package/dist/commands/wavelet-consensus.d.ts.map +1 -0
  421. package/dist/commands/wavelet-consensus.js +338 -0
  422. package/dist/commands/wavelet-consensus.js.map +1 -0
  423. package/dist/commands/workspace.d.ts +59 -0
  424. package/dist/commands/workspace.d.ts.map +1 -0
  425. package/dist/commands/workspace.js +419 -0
  426. package/dist/commands/workspace.js.map +1 -0
  427. package/dist/commands/x402/index.d.ts +8 -0
  428. package/dist/commands/x402/index.d.ts.map +1 -1
  429. package/dist/commands/x402/index.js +100 -2
  430. package/dist/commands/x402/index.js.map +1 -1
  431. package/dist/commands/x402/pipeline-cancer-twin.d.ts +119 -0
  432. package/dist/commands/x402/pipeline-cancer-twin.d.ts.map +1 -0
  433. package/dist/commands/x402/pipeline-cancer-twin.js +326 -0
  434. package/dist/commands/x402/pipeline-cancer-twin.js.map +1 -0
  435. package/dist/commands/x402/submit.d.ts +72 -0
  436. package/dist/commands/x402/submit.d.ts.map +1 -0
  437. package/dist/commands/x402/submit.js +227 -0
  438. package/dist/commands/x402/submit.js.map +1 -0
  439. package/dist/commands/x402/verify-payment.d.ts +24 -0
  440. package/dist/commands/x402/verify-payment.d.ts.map +1 -0
  441. package/dist/commands/x402/verify-payment.js +113 -0
  442. package/dist/commands/x402/verify-payment.js.map +1 -0
  443. package/dist/index.js +2804 -196
  444. package/dist/index.js.map +1 -1
  445. package/dist/lib/api/client.d.ts +1 -0
  446. package/dist/lib/api/client.d.ts.map +1 -1
  447. package/dist/lib/api/client.js +22 -0
  448. package/dist/lib/api/client.js.map +1 -1
  449. package/dist/lib/api/fuse-client.d.ts +281 -0
  450. package/dist/lib/api/fuse-client.d.ts.map +1 -1
  451. package/dist/lib/api/fuse-client.js +428 -0
  452. package/dist/lib/api/fuse-client.js.map +1 -1
  453. package/dist/lib/biofiles/resolver.d.ts +1 -1
  454. package/dist/lib/biofiles/resolver.d.ts.map +1 -1
  455. package/dist/lib/biofiles/resolver.js +173 -138
  456. package/dist/lib/biofiles/resolver.js.map +1 -1
  457. package/dist/lib/config/constants.d.ts +1 -0
  458. package/dist/lib/config/constants.d.ts.map +1 -1
  459. package/dist/lib/config/constants.js +1 -0
  460. package/dist/lib/config/constants.js.map +1 -1
  461. package/dist/lib/config/paths.d.ts +6 -6
  462. package/dist/lib/config/paths.d.ts.map +1 -1
  463. package/dist/lib/config/paths.js +56 -17
  464. package/dist/lib/config/paths.js.map +1 -1
  465. package/dist/lib/gene-map.d.ts +24 -0
  466. package/dist/lib/gene-map.d.ts.map +1 -0
  467. package/dist/lib/gene-map.js +114 -0
  468. package/dist/lib/gene-map.js.map +1 -0
  469. package/dist/lib/htsget/client.d.ts +28 -5
  470. package/dist/lib/htsget/client.d.ts.map +1 -1
  471. package/dist/lib/htsget/client.js +96 -18
  472. package/dist/lib/htsget/client.js.map +1 -1
  473. package/dist/lib/sequentia/BioAgentRegistry.d.ts +98 -0
  474. package/dist/lib/sequentia/BioAgentRegistry.d.ts.map +1 -0
  475. package/dist/lib/sequentia/BioAgentRegistry.js +209 -0
  476. package/dist/lib/sequentia/BioAgentRegistry.js.map +1 -0
  477. package/dist/lib/tele/core.d.ts +71 -0
  478. package/dist/lib/tele/core.d.ts.map +1 -0
  479. package/dist/lib/tele/core.js +387 -0
  480. package/dist/lib/tele/core.js.map +1 -0
  481. package/dist/lib/x402/cancer-twin-agents.d.ts +65 -0
  482. package/dist/lib/x402/cancer-twin-agents.d.ts.map +1 -0
  483. package/dist/lib/x402/cancer-twin-agents.js +114 -0
  484. package/dist/lib/x402/cancer-twin-agents.js.map +1 -0
  485. package/dist/lib/x402/sequentia-pay.d.ts +51 -0
  486. package/dist/lib/x402/sequentia-pay.d.ts.map +1 -0
  487. package/dist/lib/x402/sequentia-pay.js +186 -0
  488. package/dist/lib/x402/sequentia-pay.js.map +1 -0
  489. package/dist/types/biofiles.d.ts +1 -1
  490. package/dist/types/biofiles.d.ts.map +1 -1
  491. package/dist/utils/errorReporter.d.ts +1 -0
  492. package/dist/utils/errorReporter.d.ts.map +1 -1
  493. package/dist/utils/errorReporter.js +39 -1
  494. package/dist/utils/errorReporter.js.map +1 -1
  495. package/dist/version.d.ts +2 -0
  496. package/dist/version.d.ts.map +1 -0
  497. package/dist/version.js +20 -0
  498. package/dist/version.js.map +1 -0
  499. package/package.json +5 -4
package/dist/index.js CHANGED
@@ -5,6 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const commander_1 = require("commander");
8
+ // FLUENCY_LINEAGE_VERBS_20260730
9
+ const fluency_1 = require("./commands/fluency");
10
+ // CONSENT_VERBS_20260730
11
+ const consent_1 = require("./commands/consent");
12
+ const lineage_1 = require("./commands/lineage");
13
+ // BIODATA_ROOM_20260801: dual profiles + researcher biodata room
14
+ const profile_1 = require("./commands/profile");
15
+ const room_1 = require("./commands/room");
16
+ const version_1 = require("./version");
8
17
  const chalk_1 = __importDefault(require("chalk"));
9
18
  const login_1 = require("./commands/login");
10
19
  const logout_1 = require("./commands/logout");
@@ -44,11 +53,14 @@ const results_1 = require("./commands/job/results");
44
53
  const list_3 = require("./commands/job/list");
45
54
  const pipelines_1 = require("./commands/job/pipelines");
46
55
  // v2.7.0: htsget + smart streaming + aliases
56
+ // v3.18.0: TeleBioinformatics (`biofs tele`) + region stream
47
57
  const stream_1 = require("./commands/stream");
48
58
  const pipe_1 = require("./commands/pipe");
49
59
  const alias_1 = require("./commands/alias");
50
60
  const htsget_1 = require("./commands/htsget");
61
+ const tele_1 = require("./commands/tele");
51
62
  const submit_clara_1 = require("./commands/job/submit-clara");
63
+ const recall_1 = require("./commands/job/recall");
52
64
  const create_2 = require("./commands/context/create");
53
65
  const publish_1 = require("./commands/context/publish");
54
66
  const verify_1 = require("./commands/context/verify");
@@ -68,21 +80,107 @@ const report_1 = require("./commands/report");
68
80
  const admin_1 = require("./commands/admin");
69
81
  const fuse_1 = require("./commands/fuse");
70
82
  const submit_1 = require("./commands/annotate/submit");
83
+ const submit_2 = require("./commands/imaging/submit");
84
+ const twin_1 = require("./commands/imaging/twin");
85
+ const attribute_1 = require("./commands/imaging/attribute");
86
+ const trajectory_1 = require("./commands/imaging/trajectory");
87
+ const lesions_1 = require("./commands/imaging/lesions");
88
+ const findings_1 = require("./commands/imaging/findings");
89
+ const characterize_1 = require("./commands/imaging/characterize");
90
+ const enrich_1 = require("./commands/imaging/enrich");
91
+ const compare_1 = require("./commands/imaging/compare");
92
+ const submit_3 = require("./commands/methyl/submit");
93
+ const exec_1 = require("./commands/methyl/exec");
94
+ const submit_4 = require("./commands/align-shard/submit");
95
+ const exec_2 = require("./commands/align-shard/exec");
96
+ const submit_5 = require("./commands/comethyl/submit");
97
+ const exec_3 = require("./commands/comethyl/exec");
98
+ const submit_6 = require("./commands/sv-call/submit");
99
+ const exec_4 = require("./commands/sv-call/exec");
100
+ const submit_7 = require("./commands/qc/submit");
101
+ const exec_5 = require("./commands/qc/exec");
102
+ const submit_8 = require("./commands/verkko/submit");
103
+ const exec_6 = require("./commands/verkko/exec");
104
+ const submit_9 = require("./commands/ont-variants/submit");
105
+ const exec_7 = require("./commands/ont-variants/exec");
106
+ const submit_10 = require("./commands/hifi-align/submit");
107
+ const exec_8 = require("./commands/hifi-align/exec");
108
+ const submit_11 = require("./commands/pbsv/submit");
109
+ const exec_9 = require("./commands/pbsv/exec");
110
+ const submit_12 = require("./commands/repeat-genotype/submit");
111
+ const exec_10 = require("./commands/repeat-genotype/exec");
112
+ const submit_13 = require("./commands/phase/submit");
113
+ const exec_11 = require("./commands/phase/exec");
114
+ const submit_14 = require("./commands/hifi-deepvariant/submit");
115
+ const exec_12 = require("./commands/hifi-deepvariant/exec");
116
+ const submit_15 = require("./commands/liftover/submit");
117
+ const exec_13 = require("./commands/liftover/exec");
118
+ const submit_16 = require("./commands/dipcall/submit");
119
+ const exec_14 = require("./commands/dipcall/exec");
120
+ const submit_17 = require("./commands/hifi-methyl/submit");
121
+ const exec_15 = require("./commands/hifi-methyl/exec");
122
+ const workspace_1 = require("./commands/workspace");
123
+ const duet_1 = require("./commands/duet");
124
+ const benchmark_1 = require("./commands/benchmark");
125
+ const runWes_1 = require("./commands/pipeline/runWes");
126
+ const route_1 = require("./commands/route");
127
+ const anchor_1 = require("./commands/route/anchor");
71
128
  const status_6 = require("./commands/annotate/status");
129
+ const x402_1 = require("./commands/x402");
130
+ const submit_18 = require("./commands/interpret/submit");
131
+ const status_7 = require("./commands/interpret/status");
132
+ const somos_1 = require("./commands/ancestry/somos");
133
+ const status_8 = require("./commands/ancestry/status");
134
+ const ingest_1 = require("./commands/ancestry/ingest");
135
+ const share_2 = require("./commands/ancestry/share");
136
+ const register_sequentia_1 = require("./commands/agent/register-sequentia");
137
+ const list_sequentia_1 = require("./commands/agent/list-sequentia");
72
138
  const balance_1 = require("./commands/payment/balance");
73
139
  const pricing_1 = require("./commands/payment/pricing");
74
140
  const setup_2 = require("./commands/payment/setup");
75
141
  const faucet_1 = require("./commands/payment/faucet");
76
142
  const history_1 = require("./commands/payment/history");
77
143
  const resolve_1 = require("./commands/resolve");
144
+ const variants_1 = require("./commands/variants");
145
+ const query_1 = require("./commands/query");
146
+ const erase_1 = require("./commands/erase");
147
+ const fourier_score_1 = require("./commands/fourier-score");
148
+ const rrm_consensus_1 = require("./commands/rrm-consensus");
149
+ const psm_consensus_1 = require("./commands/psm-consensus");
150
+ const bode_1 = require("./commands/bode");
151
+ const wavelet_consensus_1 = require("./commands/wavelet-consensus");
152
+ const tokenize_spectrum_1 = require("./commands/tokenize-spectrum");
153
+ const inventory_register_sqlite_1 = require("./commands/inventory-register-sqlite");
154
+ const ingest_rna_tpm_1 = require("./commands/ingest-rna-tpm");
155
+ const score_protein_1 = require("./commands/score-protein");
156
+ const rrm_distribution_1 = require("./commands/rrm-distribution");
157
+ const rrm_train_1 = require("./commands/rrm-train");
158
+ const cohort_train_1 = require("./commands/cohort-train");
159
+ const myvariant_1 = require("./commands/myvariant");
160
+ const cohort_acmg_1 = require("./commands/cohort-acmg");
161
+ const clinical_1 = require("./commands/clinical");
162
+ const cohort_fourier_score_1 = require("./commands/cohort-fourier-score");
163
+ const create_3 = require("./commands/biowallet/create");
164
+ const list_6 = require("./commands/biowallet/list");
165
+ const bind_1 = require("./commands/biowallet/bind");
166
+ const refreshCoverage_1 = require("./commands/lab/refreshCoverage");
167
+ const family_1 = require("./commands/biowallet/family");
78
168
  const match_1 = require("./commands/match");
79
169
  const ticket_1 = require("./commands/ticket");
80
170
  const scan_1 = require("./commands/scan");
81
171
  const inventory_1 = require("./commands/inventory");
172
+ const cohort_1 = require("./commands/inventory/cohort");
173
+ const reconcile_1 = require("./commands/job/reconcile");
174
+ const cohort_pipeline_1 = require("./commands/cohort-pipeline");
82
175
  const dedup_1 = require("./commands/dedup");
176
+ const claim_1 = require("./commands/claim");
83
177
  const fingerprint_1 = require("./commands/fingerprint");
84
- const logger_1 = require("./lib/utils/logger");
178
+ const register_2 = require("./commands/researcher/register");
179
+ const status_9 = require("./commands/researcher/status");
180
+ const passport_1 = require("./commands/researcher/passport");
85
181
  const errorReporter_1 = require("./utils/errorReporter");
182
+ const logger_1 = require("./lib/utils/logger");
183
+ const errorReporter_2 = require("./utils/errorReporter");
86
184
  const credentials_1 = require("./lib/auth/credentials");
87
185
  const program = new commander_1.Command();
88
186
  // Global catch-all so uncaught errors in ANY command still reach telemetry.
@@ -92,24 +190,24 @@ async function reportAndExit(command, err, code) {
92
190
  try {
93
191
  const creds = await credentials_1.CredentialsManager.getInstance().loadCredentials().catch(() => null);
94
192
  const error = err instanceof Error ? err : new Error(String(err));
95
- await errorReporter_1.ErrorReporter.report(command, error, creds?.wallet_address, { argv: process.argv.slice(2) });
193
+ await errorReporter_2.ErrorReporter.report(command, error, creds?.wallet_address, { argv: (0, errorReporter_1.redactArgv)(process.argv.slice(2)) });
96
194
  }
97
195
  catch { /* telemetry failure must never block exit */ }
98
196
  process.exit(code);
99
197
  }
100
198
  process.on('uncaughtException', (err) => {
101
199
  logger_1.Logger.error(`Uncaught: ${err?.message || err}`);
102
- reportAndExit(process.argv.slice(2).join(' ') || 'unknown', err, 1);
200
+ reportAndExit((0, errorReporter_1.redactArgv)(process.argv.slice(2)).join(' ') || 'unknown', err, 1);
103
201
  });
104
202
  process.on('unhandledRejection', (reason) => {
105
203
  logger_1.Logger.error(`UnhandledRejection: ${reason?.message || reason}`);
106
- reportAndExit(process.argv.slice(2).join(' ') || 'unknown', reason, 1);
204
+ reportAndExit((0, errorReporter_1.redactArgv)(process.argv.slice(2)).join(' ') || 'unknown', reason, 1);
107
205
  });
108
206
  // Set up the CLI
109
207
  program
110
208
  .name('biofs')
111
209
  .description('BioFS by GenoBank.io - BioNFT-Gated S3 CLI for genomic data')
112
- .version('3.0.1')
210
+ .version(version_1.BIOFS_VERSION)
113
211
  .option('--debug', 'Enable debug output')
114
212
  .hook('preAction', (thisCommand) => {
115
213
  // Set global debug flag if --debug is passed
@@ -182,6 +280,8 @@ program
182
280
  });
183
281
  // Admin command group - Admin operations on Sequentia Network
184
282
  program.addCommand((0, admin_1.createAdminCommand)());
283
+ // x402 command group - Sequentia micropayments + agentic Cancer Digital Twin pipeline
284
+ program.addCommand((0, x402_1.createX402Command)());
185
285
  // BioFiles command - Comprehensive discovery across all GenoBank data sources
186
286
  program
187
287
  .command('biofiles')
@@ -189,7 +289,8 @@ program
189
289
  .alias('ls')
190
290
  .description('Discover all your BioFiles from GenoBank ecosystem (Story Protocol, Avalanche, S3, BioIP)')
191
291
  .option('--filter <type>', 'Filter by file type (vcf, fastq, bam, pdf, etc.)')
192
- .option('--source <source>', 'Filter by source (story, avalanche, s3, biofs)')
292
+ .option('--source <source>', 'Filter by source (story, avalanche, s3, biofs, biorouter)')
293
+ .option('--wallet <address>', "Admin: list another wallet's files (e.g. a custodian's). Bypasses cache.")
193
294
  .option('--json', 'Output as JSON')
194
295
  .option('--update', 'Force refresh from blockchain and S3')
195
296
  .option('--verbose', 'Show debug information')
@@ -212,6 +313,7 @@ program
212
313
  .option('--stream', 'Stream large files (>100MB)')
213
314
  .option('--quiet', 'No progress bar')
214
315
  .option('--skip-consent', 'Skip GDPR consent (for automation)')
316
+ .option('--gs-uri <uri>', 'Bypass BioFiles discovery and fetch directly from gs:// URI (for owner-only file inspection)')
215
317
  .action(async (biocidOrFilename, destination, options) => {
216
318
  try {
217
319
  await (0, download_with_consent_1.downloadCommandWithConsent)(biocidOrFilename, destination, options);
@@ -242,17 +344,30 @@ program
242
344
  });
243
345
  // Mount command (mount all granted BioFiles with GDPR consent)
244
346
  program
245
- .command('mount <mount_point>')
246
- .description('Mount BioFiles as filesystem (NFS or copy method)')
247
- .option('--method <type>', 'Mount method: nfs (true filesystem) or copy (download files)', 'copy')
248
- .option('--biocid <biocid>', 'Mount specific BioCID (biocid://OWNER/bioip/IP_ID)')
249
- .option('--port <number>', 'NFS server port (default: 2049)', parseInt)
347
+ .command('mount <target> [mount_point]')
348
+ .description('Mount a biosample as a consent-gated read-only filesystem')
349
+ .addHelpText('after', `
350
+ Examples:
351
+ biofs mount DNA_TN25-336147.vcf /mnt/study mount one biosample (FUSE)
352
+ biofs mount TN25-336147 /mnt/study the bare serial also resolves
353
+ biofs mount ./my-files legacy: copy granted files here
354
+
355
+ Every read is re-authorized server-side against the BioNFT consent grant on
356
+ Sequentia. If the owner revokes, reads on the already-mounted filesystem begin
357
+ failing with Permission denied, without unmounting.`)
358
+ .option('--method <type>', 'fuse (consent-gated filesystem, default), copy, or nfs (legacy)', 'fuse')
359
+ .option('--biocid <biocid>', 'Mount specific BioCID (copy method)')
360
+ .option('--port <number>', 'NFS server port (legacy nfs method)', parseInt)
361
+ .option('--api-url <url>', 'Gateway base URL (default: https://genobank.app)')
362
+ .option('--consent-ttl <seconds>', 'Seconds before the driver re-verifies consent', parseInt)
363
+ .option('--allow-other', 'Let other local users read the mount (needs user_allow_other)')
364
+ .option('--foreground', 'Run in the foreground and stream driver logs')
250
365
  .option('--read-only', 'Mount as read-only')
251
366
  .option('--quiet', 'Suppress output')
252
367
  .option('--skip-consent', 'Skip GDPR consent (for automation)')
253
- .action(async (mountPoint, options) => {
368
+ .action(async (target, mountPoint, options) => {
254
369
  try {
255
- await (0, mount_1.mountCommand)(mountPoint, options);
370
+ await (0, mount_1.mountCommand)(target, mountPoint, options);
256
371
  }
257
372
  catch (error) {
258
373
  logger_1.Logger.error(`Mount failed: ${error}`);
@@ -374,10 +489,15 @@ program
374
489
  // stream - htsget stream to stdout (pipes into any bioinformatics tool)
375
490
  program
376
491
  .command('stream <id>')
377
- .description('Stream a BioNFT-gated VCF/BAM to stdout via htsget (pipe into bcftools/samtools/pysam)')
492
+ .description('Stream a BioNFT-gated VCF/BAM/CRAM/FASTQ to stdout via htsget (pipe into bcftools/samtools/pysam/seqkit)')
378
493
  .option('--kind <variants|reads>', 'force datatype (default: auto-detect from filename)')
379
494
  .option('--htsget-url <url>', 'override htsget endpoint (default: https://htsget.genobank.app)')
380
495
  .option('--annotated', 'stream the OpenCRAVAT-annotated VCF sibling (Phase D) instead of raw')
496
+ .option('--region <chr:start-end>', 'genomic region (forwarded to htsget; client tools may also filter)')
497
+ .option('--referenceName <chr>', 'htsget referenceName (alias of region chrom)')
498
+ .option('--start <n>', 'htsget start (0-based if set with --referenceName)')
499
+ .option('--end <n>', 'htsget end')
500
+ .option('--raw', 'treat as raw byte stream (still via htsget inventory)')
381
501
  .option('-q, --quiet', 'suppress info messages')
382
502
  .action(async (id, options) => {
383
503
  try {
@@ -388,18 +508,20 @@ program
388
508
  process.exit(6);
389
509
  }
390
510
  });
391
- // pipe - auto-pipe htsget stream into bcftools/samtools view
511
+ // pipe - auto-pipe htsget stream into bcftools/samtools/seqkit
392
512
  // (distinct from the existing `view` command, which prints file content)
393
513
  program
394
514
  .command('pipe <id>')
395
- .description('Pipe a BioIP stream into bcftools view (VCF) or samtools view (BAM) automatically')
396
- .option('--tool <bcftools|samtools>', 'force tool (default: auto-detect from filename)')
515
+ .description('Pipe a BioIP stream into bcftools view (VCF), samtools view (BAM), or seqkit stats (FASTQ)')
516
+ .option('--tool <bcftools|samtools|seqkit>', 'force tool (default: auto-detect from filename)')
397
517
  .option('--htsget-url <url>', 'override htsget endpoint')
518
+ .option('--region <chr:start-end>', 'genomic region forwarded to htsget')
519
+ .option('--annotated', 'prefer OpenCRAVAT-annotated VCF sibling')
398
520
  .option('-q, --quiet', 'suppress info messages')
399
521
  .allowUnknownOption(true)
400
522
  .action(async (id, options, cmd) => {
401
523
  try {
402
- // Everything after `--` is passed through to bcftools/samtools view
524
+ // Everything after `--` is passed through to the tool
403
525
  const extra = cmd.args.slice(cmd.args.indexOf(id) + 1);
404
526
  await (0, pipe_1.pipeCommand)(id, { ...options, extra });
405
527
  }
@@ -408,6 +530,253 @@ program
408
530
  process.exit(6);
409
531
  }
410
532
  });
533
+ // ========================================================================
534
+ // v3.18.0 — TeleBioinformatics (`biofs tele`)
535
+ // Consent-gated htsget → local tools (Tier A) + IGV/Jupyter (Tier B).
536
+ // Heavy calling/annotation remains Tier C (annotate / job / skills).
537
+ // ========================================================================
538
+ const teleCmd = program
539
+ .command('tele')
540
+ .description('TeleBioinformatics: consent-gated streams into local tools (stats, IGV, jupyter, …)');
541
+ function teleCommon(cmd) {
542
+ return cmd
543
+ .option('--kind <variants|reads>', 'force htsget datatype')
544
+ .option('--htsget-url <url>', 'override htsget endpoint')
545
+ .option('--region <chr:start-end>', 'genomic region')
546
+ .option('--annotated', 'OpenCRAVAT-annotated VCF sibling when available')
547
+ .option('-q, --quiet', 'suppress progress on stderr')
548
+ .option('--json', 'JSON output where supported');
549
+ }
550
+ teleCommon(teleCmd
551
+ .command('tools')
552
+ .description('Catalog of TeleBioinformatics tools and tiers (A stream / B fuse / C server)')).action(async (options) => {
553
+ try {
554
+ await (0, tele_1.teleToolsCommand)(options);
555
+ }
556
+ catch (e) {
557
+ logger_1.Logger.error(e?.message || e);
558
+ process.exit(6);
559
+ }
560
+ });
561
+ teleCommon(teleCmd
562
+ .command('stats <id>')
563
+ .description('bcftools stats | samtools stats | seqkit stats (auto by filetype)')).action(async (id, options) => {
564
+ try {
565
+ await (0, tele_1.teleStatsCommand)(id, options);
566
+ }
567
+ catch (e) {
568
+ logger_1.Logger.error(e?.message || e);
569
+ process.exit(6);
570
+ }
571
+ });
572
+ teleCommon(teleCmd
573
+ .command('header <id>')
574
+ .description('VCF/BAM header only (bcftools view -h | samtools view -H)')).action(async (id, options) => {
575
+ try {
576
+ await (0, tele_1.teleHeaderCommand)(id, options);
577
+ }
578
+ catch (e) {
579
+ logger_1.Logger.error(e?.message || e);
580
+ process.exit(6);
581
+ }
582
+ });
583
+ teleCommon(teleCmd
584
+ .command('flagstat <id>')
585
+ .description('samtools flagstat on a streamed BAM/CRAM')).action(async (id, options) => {
586
+ try {
587
+ await (0, tele_1.teleFlagstatCommand)(id, options);
588
+ }
589
+ catch (e) {
590
+ logger_1.Logger.error(e?.message || e);
591
+ process.exit(6);
592
+ }
593
+ });
594
+ teleCommon(teleCmd
595
+ .command('count <id>')
596
+ .description('Count variants (bcftools) or reads (samtools view -c)')).action(async (id, options) => {
597
+ try {
598
+ await (0, tele_1.teleCountCommand)(id, options);
599
+ }
600
+ catch (e) {
601
+ logger_1.Logger.error(e?.message || e);
602
+ process.exit(6);
603
+ }
604
+ });
605
+ teleCommon(teleCmd
606
+ .command('region <id> <region>')
607
+ .description('Stream a genomic region (chr:start-end) via htsget + tool filter')).action(async (id, region, options) => {
608
+ try {
609
+ await (0, tele_1.teleRegionCommand)(id, region, options);
610
+ }
611
+ catch (e) {
612
+ logger_1.Logger.error(e?.message || e);
613
+ process.exit(6);
614
+ }
615
+ });
616
+ teleCommon(teleCmd
617
+ .command('query <id>')
618
+ .description('bcftools query (pass -f after --)')
619
+ .option('--format <fmt>', 'bcftools -f format string')
620
+ .allowUnknownOption(true)).action(async (id, options, cmd) => {
621
+ try {
622
+ const extra = cmd.args.slice(cmd.args.indexOf(id) + 1);
623
+ await (0, tele_1.teleQueryCommand)(id, extra, options);
624
+ }
625
+ catch (e) {
626
+ logger_1.Logger.error(e?.message || e);
627
+ process.exit(6);
628
+ }
629
+ });
630
+ teleCommon(teleCmd
631
+ .command('filter <id>')
632
+ .description('bcftools view with -i/-e filters')
633
+ .option('--include <expr>', 'bcftools -i expression')
634
+ .option('--exclude <expr>', 'bcftools -e expression')
635
+ .allowUnknownOption(true)).action(async (id, options, cmd) => {
636
+ try {
637
+ const extra = cmd.args.slice(cmd.args.indexOf(id) + 1);
638
+ await (0, tele_1.teleFilterCommand)(id, extra, options);
639
+ }
640
+ catch (e) {
641
+ logger_1.Logger.error(e?.message || e);
642
+ process.exit(6);
643
+ }
644
+ });
645
+ teleCommon(teleCmd
646
+ .command('view <id>')
647
+ .description('Generic bcftools/samtools view (args after --)')
648
+ .allowUnknownOption(true)).action(async (id, options, cmd) => {
649
+ try {
650
+ const extra = cmd.args.slice(cmd.args.indexOf(id) + 1);
651
+ await (0, tele_1.teleViewCommand)(id, extra, options);
652
+ }
653
+ catch (e) {
654
+ logger_1.Logger.error(e?.message || e);
655
+ process.exit(6);
656
+ }
657
+ });
658
+ teleCommon(teleCmd
659
+ .command('seqkit <id>')
660
+ .description('seqkit stats on streamed FASTQ/FASTA')).action(async (id, options) => {
661
+ try {
662
+ await (0, tele_1.teleSeqkitCommand)(id, options);
663
+ }
664
+ catch (e) {
665
+ logger_1.Logger.error(e?.message || e);
666
+ process.exit(6);
667
+ }
668
+ });
669
+ teleCommon(teleCmd
670
+ .command('seqtk <id>')
671
+ .description('seqtk on streamed FASTQ (args after --)')
672
+ .allowUnknownOption(true)).action(async (id, options, cmd) => {
673
+ try {
674
+ const extra = cmd.args.slice(cmd.args.indexOf(id) + 1);
675
+ await (0, tele_1.teleSeqtkCommand)(id, extra, options);
676
+ }
677
+ catch (e) {
678
+ logger_1.Logger.error(e?.message || e);
679
+ process.exit(6);
680
+ }
681
+ });
682
+ teleCommon(teleCmd
683
+ .command('bedtools <id>')
684
+ .description('bedtools on stream (e.g. -- intersect -b genes.bed)')
685
+ .allowUnknownOption(true)).action(async (id, options, cmd) => {
686
+ try {
687
+ const extra = cmd.args.slice(cmd.args.indexOf(id) + 1);
688
+ await (0, tele_1.teleBedtoolsCommand)(id, extra, options);
689
+ }
690
+ catch (e) {
691
+ logger_1.Logger.error(e?.message || e);
692
+ process.exit(6);
693
+ }
694
+ });
695
+ teleCommon(teleCmd
696
+ .command('vt <id>')
697
+ .description('vt on VCF stream (e.g. -- normalize -r ref.fa)')
698
+ .allowUnknownOption(true)).action(async (id, options, cmd) => {
699
+ try {
700
+ const extra = cmd.args.slice(cmd.args.indexOf(id) + 1);
701
+ await (0, tele_1.teleVtCommand)(id, extra, options);
702
+ }
703
+ catch (e) {
704
+ logger_1.Logger.error(e?.message || e);
705
+ process.exit(6);
706
+ }
707
+ });
708
+ teleCommon(teleCmd
709
+ .command('mosdepth <id>')
710
+ .description('mosdepth coverage (materializes temp BAM; prefer fuse for large WGS)')
711
+ .option('--out <prefix>', 'output prefix')).action(async (id, options) => {
712
+ try {
713
+ await (0, tele_1.teleMosdepthCommand)(id, options);
714
+ }
715
+ catch (e) {
716
+ logger_1.Logger.error(e?.message || e);
717
+ process.exit(6);
718
+ }
719
+ });
720
+ teleCommon(teleCmd
721
+ .command('igv <id>')
722
+ .description('Write IGV desktop batch + IGV.js HTML session for the stream URL')
723
+ .option('--web', 'also open IGV.js HTML')
724
+ .option('--open', 'open the HTML session in the default browser')
725
+ .option('--out <path>', 'output HTML path')).action(async (id, options) => {
726
+ try {
727
+ await (0, tele_1.teleIgvCommand)(id, options);
728
+ }
729
+ catch (e) {
730
+ logger_1.Logger.error(e?.message || e);
731
+ process.exit(6);
732
+ }
733
+ });
734
+ teleCommon(teleCmd
735
+ .command('jupyter <id>')
736
+ .description('Emit a Jupyter/Python cell that streams via biofs into pysam or line parser')
737
+ .option('--out <file>', 'write cell to file')).action(async (id, options) => {
738
+ try {
739
+ await (0, tele_1.teleJupyterCommand)(id, options);
740
+ }
741
+ catch (e) {
742
+ logger_1.Logger.error(e?.message || e);
743
+ process.exit(6);
744
+ }
745
+ });
746
+ teleCommon(teleCmd
747
+ .command('pysam <id>')
748
+ .description('Alias of tele jupyter (pysam-oriented snippet)')
749
+ .option('--out <file>', 'write snippet to file')).action(async (id, options) => {
750
+ try {
751
+ await (0, tele_1.telePysamCommand)(id, options);
752
+ }
753
+ catch (e) {
754
+ logger_1.Logger.error(e?.message || e);
755
+ process.exit(6);
756
+ }
757
+ });
758
+ teleCommon(teleCmd
759
+ .command('stream <id>')
760
+ .description('Same as biofs stream (raw htsget bytes to stdout)')).action(async (id, options) => {
761
+ try {
762
+ await (0, tele_1.teleStreamCommand)(id, options);
763
+ }
764
+ catch (e) {
765
+ logger_1.Logger.error(e?.message || e);
766
+ process.exit(6);
767
+ }
768
+ });
769
+ teleCommon(teleCmd
770
+ .command('ticket <id>')
771
+ .description('Show htsget ticket JSON for an id (TeleBioinformatics debug)')).action(async (id, options) => {
772
+ try {
773
+ await (0, tele_1.teleTicketCommand)(id, options);
774
+ }
775
+ catch (e) {
776
+ logger_1.Logger.error(e?.message || e);
777
+ process.exit(6);
778
+ }
779
+ });
411
780
  // alias - manage local shortcuts for ip_ids / BioCIDs
412
781
  program
413
782
  .command('alias [name] [target]')
@@ -444,13 +813,19 @@ htsgetCmd
444
813
  htsgetCmd
445
814
  .command('ticket <kind> <id>')
446
815
  .description('Fetch a raw htsget ticket for debugging (kind = variants | reads)')
447
- .action(async (kind, id) => {
816
+ .option('--region <chr:start-end>', 'genomic region (htsget referenceName/start/end)')
817
+ .option('--referenceName <chr>', 'htsget referenceName')
818
+ .option('--start <n>', 'htsget start')
819
+ .option('--end <n>', 'htsget end')
820
+ .option('--annotated', 'request annotated VCF sibling')
821
+ .option('--htsget-url <url>', 'override htsget endpoint')
822
+ .action(async (kind, id, options) => {
448
823
  try {
449
824
  if (kind !== 'variants' && kind !== 'reads') {
450
825
  logger_1.Logger.error(`kind must be 'variants' or 'reads' (got '${kind}')`);
451
826
  process.exit(2);
452
827
  }
453
- await (0, htsget_1.htsgetTicketCommand)(kind, id);
828
+ await (0, htsget_1.htsgetTicketCommand)(kind, id, options);
454
829
  }
455
830
  catch (error) {
456
831
  logger_1.Logger.error(`ticket failed: ${error?.message || error}`);
@@ -544,10 +919,13 @@ linkCmd
544
919
  program
545
920
  .command('family-status')
546
921
  .alias('family')
547
- .description('Show family genomic pipeline status (BioNFT → ClaraJobNFT → etc.)')
922
+ .description('Show family genomic pipeline status (BioNFT → ClaraJobNFT → bioroutes.inventory)')
548
923
  .argument('<biosample_serials...>', 'Biosample serial numbers')
549
924
  .option('--json', 'Output as JSON')
550
925
  .option('--verbose', 'Show detailed information')
926
+ .option('--no-inventory', 'Skip the bioroutes.inventory enrichment (chain-only mode)')
927
+ .option('--bionft-address <addr>', 'Override BioNFT contract (for legacy deployments)')
928
+ .option('--clara-address <addr>', 'Override ClaraJobNFT contract')
551
929
  .action(async (biosampleSerials, options) => {
552
930
  try {
553
931
  await (0, family_status_1.familyStatusCommand)(biosampleSerials, options);
@@ -558,7 +936,7 @@ program
558
936
  }
559
937
  });
560
938
  // Inventory command - Fast read-only summary of bioroutes.inventory (no GCS walk)
561
- program
939
+ const inventoryCmd = program
562
940
  .command('inventory')
563
941
  .alias('inv')
564
942
  .description('Show what is currently registered in bioroutes.inventory (admin/lab-custodian)')
@@ -574,6 +952,26 @@ program
574
952
  process.exit(1);
575
953
  }
576
954
  });
955
+ // inventory cohort sub-command: extract filtered cohort of biosample serials
956
+ inventoryCmd
957
+ .command('cohort')
958
+ .description('Extract a filtered cohort of biosample serials from bioroutes.inventory (the canonical "what should I process next?" query)')
959
+ .requiredOption('--originlab <name>', 'Lab name (e.g. augenomics, neochromosome, somos, tecbase, genobank)')
960
+ .option('--has <csv>', 'CSV of filetypes the serial MUST have (e.g. fastq)')
961
+ .option('--missing <csv>', 'CSV of filetypes the serial MUST NOT have (e.g. vcf,gvcf)')
962
+ .option('--paired', 'For FASTQ, require both R1 and R2 to exist')
963
+ .option('--limit <N>', 'Cap on returned serials')
964
+ .option('--output <file>', 'Write serials one-per-line to file (suitable for `biofs cohort-pipeline --serials`)')
965
+ .option('--json', 'Output full JSON response')
966
+ .action(async (options) => {
967
+ try {
968
+ await (0, cohort_1.inventoryCohortCommand)(options);
969
+ }
970
+ catch (error) {
971
+ logger_1.Logger.error(`inventory cohort failed: ${error}`);
972
+ process.exit(1);
973
+ }
974
+ });
577
975
  // Fingerprint command - Submit async fingerprint jobs (background worker uses gcsfuse)
578
976
  program
579
977
  .command('fingerprint')
@@ -582,6 +980,8 @@ program
582
980
  .option('--serial <id>', 'Single sample serial')
583
981
  .option('--serials <csv>', 'Comma-separated sample serials')
584
982
  .option('--filetypes <csv>', 'Filter to filetype list (e.g. vcf,gvcf)')
983
+ .option('--bucket <name>', 'Scope to a single GCS bucket')
984
+ .option('--prefix <path>', 'Scope to an object-name prefix (use with --bucket)')
585
985
  .option('--include-superseded', 'Also fingerprint SUPERSEDED rows')
586
986
  .option('--limit <n>', 'Max rows to process per job', '50')
587
987
  .option('--dry-run', 'Show eligible rows without submitting')
@@ -615,6 +1015,25 @@ program
615
1015
  process.exit(1);
616
1016
  }
617
1017
  });
1018
+ // Claim command - Reassign mis-owned inventory rows (lab/legacy custodian) to the patient owner
1019
+ program
1020
+ .command('claim')
1021
+ .description('Reassign inventory rows under your biorouter path from a lab/legacy custodian to you (admin)')
1022
+ .option('--owner <wallet>', 'Patient EIP-55 wallet to claim files TO (default: your wallet)')
1023
+ .option('--from <csv>', 'Custodian/legacy wallets to claim FROM (default: known legacy+custodian)')
1024
+ .option('--exclude <csv>', 'object_name substrings to skip (e.g. /dtc-genotype/,41221040804049)')
1025
+ .option('--apply', 'Actually reassign ownership (default is dry-run)')
1026
+ .option('--json', 'Output as JSON')
1027
+ .option('--verbose', 'Show debug information')
1028
+ .action(async (options) => {
1029
+ try {
1030
+ await (0, claim_1.claimCommand)(options);
1031
+ }
1032
+ catch (error) {
1033
+ logger_1.Logger.error(`Claim failed: ${error}`);
1034
+ process.exit(1);
1035
+ }
1036
+ });
618
1037
  // Scan command - Walk GCS bucket(s) and register objects in bioroutes.inventory
619
1038
  // Default scope: full canonical bucket fleet. Lab origin inferred per-file.
620
1039
  program
@@ -645,8 +1064,9 @@ annotateCmd
645
1064
  .command('submit <biosample_serial>')
646
1065
  .description('Submit VCF to OpenCRAVAT for annotation with all 146 annotators')
647
1066
  .option('--vcf-path <path>', 'Manual VCF path override')
1067
+ .option('--vcf-uri <uri>', 'GCS or S3 URI for a freshly-minted VCF (skips discovery; used by biofs pipeline)')
648
1068
  .option('--annotators <list>', 'Custom annotators (comma-separated), defaults to all 146')
649
- .option('--package <package>', 'Analysis package (rare_coding, hereditary_cancer, splicing, drug_interaction, pathogenic)', 'rare_coding')
1069
+ .option('--package <package>', 'Analysis package (rare_coding, hereditary_cancer, splicing, drug_interaction, pathogenic, wes_default, wgs_default)', 'rare_coding')
650
1070
  .option('--phenotype <text>', 'Clinical phenotype description for AI analysis')
651
1071
  .option('--assembly <genome>', 'Reference genome (hg38, hg19)', 'hg38')
652
1072
  .option('--wait', 'Wait for job to complete')
@@ -676,6 +1096,358 @@ annotateCmd
676
1096
  process.exit(1);
677
1097
  }
678
1098
  });
1099
+ // Imaging commands — pull UCSF eUnity DICOM studies into the patient vault via
1100
+ // the biofs protocol (DICOM is biodata → biofs job dispatched through biofs-node).
1101
+ const imagingCmd = program
1102
+ .command('imaging')
1103
+ .description('DICOM medical-imaging acquisition: pull hospital studies (UCSF eUnity) into the patient vault via biofs-node');
1104
+ imagingCmd
1105
+ .command('pull', { isDefault: true })
1106
+ .description('Pull a UCSF eUnity DICOM study into the vault (resolve --eunity-url + --cookie + --study-uid with the web3-chrome MCP)')
1107
+ .requiredOption('--eunity-url <url>', 'eUnity downloadDicomStudy URL (resolved browser-side by the MCP)')
1108
+ .requiredOption('--cookie <header>', 'eUnity /e JSESSIONID Cookie header (resolved browser-side by the MCP)')
1109
+ .option('--study-uid <uid>', 'DICOM StudyInstanceUID (enables vault dedupe)')
1110
+ .option('--source <src>', 'Provenance label', 'eunity-mychart')
1111
+ .option('--force', 'Re-pull even if the study is already in the vault (idempotent overwrite)')
1112
+ .option('--wait', 'Wait for the server-side ingest to finish')
1113
+ .option('--quiet', 'Suppress progress output')
1114
+ .option('--json', 'Output as JSON')
1115
+ .action(async (options) => {
1116
+ try {
1117
+ await (0, submit_2.imagingPullCommand)(options);
1118
+ }
1119
+ catch (error) {
1120
+ logger_1.Logger.error(`imaging pull failed: ${error}`);
1121
+ process.exit(1);
1122
+ }
1123
+ });
1124
+ // imaging twin — the "3D Organ TimeMachine": longitudinal CT change map (register
1125
+ // two timepoints, segment organs, per-organ/voxel deltas + Jacobian + meshes) as a
1126
+ // biofs GPU job. Inputs are biocid-addressed (biofs-node resolves via biorouter).
1127
+ imagingCmd
1128
+ .command('twin')
1129
+ .description('3D Organ TimeMachine: longitudinal CT change map across N timepoints of an anatomy (GPU job via biofs-node)')
1130
+ .option('--baseline <ref>', 'baseline biocid (biocid://…/dicom/<studyUID>) or studyUID (2-timepoint mode)')
1131
+ .option('--followup <ref>', 'follow-up biocid or studyUID (2-timepoint mode)')
1132
+ .option('--timepoints <spec>', 'N-timepoint mode: JSON [{label,study,series}] (ordered, first=reference) or "label:study:series,..." — supersedes --baseline/--followup')
1133
+ .option('--anatomy <name>', 'anatomy to register (abdomen | chest)', 'abdomen')
1134
+ .option('--registration <mode>', 'deformable (SyNRA + Jacobian, default) or rigid (strict 6-DOF, spot-faithful organ meshes)', 'deformable')
1135
+ .option('--baseline-series <uid>', 'override the baseline primary CT series UID')
1136
+ .option('--followup-series <uid>', 'override the follow-up primary CT series UID')
1137
+ .option('--wait', 'Wait for the GPU pipeline to finish')
1138
+ .option('--quiet', 'Suppress progress output')
1139
+ .option('--json', 'Output as JSON')
1140
+ .action(async (options) => {
1141
+ try {
1142
+ await (0, twin_1.imagingTwinCommand)(options);
1143
+ }
1144
+ catch (error) {
1145
+ logger_1.Logger.error(`imaging twin failed: ${error}`);
1146
+ process.exit(1);
1147
+ }
1148
+ });
1149
+ // imaging attribute — organ-attribution cross-join: segment a compare job's reference
1150
+ // CT and label each focal change by the organ it sits in (feeds the radiology MCP).
1151
+ imagingCmd
1152
+ .command('attribute')
1153
+ .description('Label each focal change in a compare job with its anatomic organ (GPU segmentation via biofs-node)')
1154
+ .requiredOption('--compare <compare_job_id>', 'the compare_job_id from `biofs imaging compare`')
1155
+ .option('--wait', 'Wait for the GPU job to finish')
1156
+ .option('--quiet', 'Suppress progress output')
1157
+ .option('--json', 'Output as JSON')
1158
+ .action(async (options) => {
1159
+ try {
1160
+ await (0, attribute_1.imagingAttributeCommand)(options);
1161
+ }
1162
+ catch (error) {
1163
+ logger_1.Logger.error(`imaging attribute failed: ${error}`);
1164
+ process.exit(1);
1165
+ }
1166
+ });
1167
+ // imaging trajectory — 3-timepoint per-voxel persistence classifier (persistent
1168
+ // progression/regression vs transient motion). CPU via biofs-node; drop-in compare artifact.
1169
+ imagingCmd
1170
+ .command('trajectory')
1171
+ .description('3-timepoint per-voxel trajectory classifier: persistent change vs transient motion (CPU via biofs-node)')
1172
+ .requiredOption('--timepoints <spec>', 'oldest→newest: JSON [{label,study,series}] or "label:study[:series],..." (>=3; series auto-resolved if omitted)')
1173
+ .option('--anatomy <name>', 'anatomy (chest | abdomen)', 'chest')
1174
+ .option('--thr-hu <hu>', 'override the per-interval significance threshold (default adaptive max(55, 3·det_sigma))')
1175
+ .option('--wait', 'Wait for the classifier to finish')
1176
+ .option('--quiet', 'Suppress progress output')
1177
+ .option('--json', 'Output as JSON')
1178
+ .action(async (options) => {
1179
+ try {
1180
+ await (0, trajectory_1.imagingTrajectoryCommand)(options);
1181
+ }
1182
+ catch (error) {
1183
+ logger_1.Logger.error(`imaging trajectory failed: ${error}`);
1184
+ process.exit(1);
1185
+ }
1186
+ });
1187
+ // imaging lesions — per-lesion volumetric tracking: independent VISTA-3D lesion seg per
1188
+ // timepoint, cross-timepoint linking, RECIST 1.1 response (CR/PR/SD/PD, flagged candidate)
1189
+ // + volume doubling time + iso-attenuating catch. GPU via biofs-node; drop-in artifact.
1190
+ imagingCmd
1191
+ .command('lesions')
1192
+ .description('Per-lesion volumetric tracking: VISTA-3D per timepoint -> RECIST response + doubling time (GPU via biofs-node)')
1193
+ .requiredOption('--timepoints <spec>', 'oldest→newest: JSON [{label,study,series}] or "label:study[:series],..." (>=2; series auto-resolved if omitted)')
1194
+ .option('--anatomy <name>', 'anatomy (chest | abdomen)', 'chest')
1195
+ .option('--treatment <ctx>', 'treatment context (naive | post_chemo | post_radiation | post_immunotherapy | post_surgery | unknown); non-naive forces human review', 'unknown')
1196
+ .option('--wait', 'Wait for the GPU pipeline to finish')
1197
+ .option('--quiet', 'Suppress progress output')
1198
+ .option('--json', 'Output as JSON')
1199
+ .action(async (options) => {
1200
+ try {
1201
+ await (0, lesions_1.imagingLesionsCommand)(options);
1202
+ }
1203
+ catch (error) {
1204
+ logger_1.Logger.error(`imaging lesions failed: ${error}`);
1205
+ process.exit(1);
1206
+ }
1207
+ });
1208
+ // imaging findings — longitudinal CT pathogenic-findings read (no volumes): pairwise
1209
+ // baseline-forward rigid lock -> VISTA-3D auto-detect -> LesionLocator track -> RECIST
1210
+ // 1.1 on long-axis diameters. GPU via biofs-node. Decision-support, not a diagnosis.
1211
+ imagingCmd
1212
+ .command('findings')
1213
+ .description('Longitudinal pathogenic-findings read: rigid pairwise lock -> VISTA-3D detect -> LesionLocator track -> RECIST 1.1 (no volumes; GPU via biofs-node)')
1214
+ .requiredOption('--timepoints <spec>', 'oldest→newest: JSON [{label,study,series}] or "label:study[:series],..." (>=2; series auto-resolved if omitted)')
1215
+ .option('--treatment <ctx>', 'treatment context (naive | post_chemo | post_radiation | post_immunotherapy | post_surgery | unknown); lowers RECIST confidence if not naive', 'unknown')
1216
+ .option('--wait', 'Wait for the GPU pipeline to finish')
1217
+ .option('--quiet', 'Suppress progress output')
1218
+ .option('--json', 'Output as JSON')
1219
+ .action(async (options) => {
1220
+ try {
1221
+ await (0, findings_1.imagingFindingsCommand)(options);
1222
+ }
1223
+ catch (error) {
1224
+ logger_1.Logger.error(`imaging findings failed: ${error}`);
1225
+ process.exit(1);
1226
+ }
1227
+ });
1228
+ // imaging characterize — Tier 2: study each tracked candidate from a findings job with
1229
+ // the Tier-2 method stack (PyRadiomics, CT-FM, Merlin, PASTA, MedGemma 1.5) -> per-candidate
1230
+ // side-by-side + agreement. GPU via biofs-node. Decision-support, not a diagnosis.
1231
+ imagingCmd
1232
+ .command('characterize')
1233
+ .description('Tier 2: study a findings job\'s candidates with the method stack -> per-candidate comparison (GPU via biofs-node)')
1234
+ .requiredOption('--job <findings_job_id>', 'the findings_job_id from `biofs imaging findings`')
1235
+ .option('--methods <csv>', 'methods to run (pyradiomics,ctfm,merlin,pasta,medgemma)', 'pyradiomics,ctfm,merlin,pasta,medgemma')
1236
+ .option('--alpha <n>', 'conformal risk level (when the trained second-reader is available)', '0.1')
1237
+ .option('--wait', 'Wait for the methods to finish')
1238
+ .option('--quiet', 'Suppress progress output')
1239
+ .option('--json', 'Output as JSON')
1240
+ .action(async (options) => {
1241
+ try {
1242
+ await (0, characterize_1.imagingCharacterizeCommand)(options);
1243
+ }
1244
+ catch (error) {
1245
+ logger_1.Logger.error(`imaging characterize failed: ${error}`);
1246
+ process.exit(1);
1247
+ }
1248
+ });
1249
+ // imaging enrich — Phase 3 foundation-model enrichment of a finished twin:
1250
+ // merlin (whole-scan change score) | vista3d (resection-bed seg) | medgemma
1251
+ // (draft impression). Each runs its own GPU container and writes a sidecar.
1252
+ imagingCmd
1253
+ .command('enrich')
1254
+ .description('Enrich a finished imaging-twin with a foundation model (merlin | vista3d | medgemma) via biofs-node GPU')
1255
+ .requiredOption('--job <twin_job_id>', 'the twin_job_id from `biofs imaging twin`')
1256
+ .requiredOption('--model <name>', 'merlin (change score) | vista3d (resection-bed seg) | medgemma (draft impression)')
1257
+ .option('--hf-token <token>', 'HuggingFace token for MedGemma (gated); transient, executor-only')
1258
+ .option('--wait', 'Wait for the GPU job to finish')
1259
+ .option('--quiet', 'Suppress progress output')
1260
+ .option('--json', 'Output as JSON')
1261
+ .action(async (options) => {
1262
+ try {
1263
+ await (0, enrich_1.imagingEnrichCommand)(options);
1264
+ }
1265
+ catch (error) {
1266
+ logger_1.Logger.error(`imaging enrich failed: ${error}`);
1267
+ process.exit(1);
1268
+ }
1269
+ });
1270
+ // imaging compare — the "Image Time Machine": rigid slice-by-slice comparator of two
1271
+ // CT timepoints (A=follow-up, B=baseline aligned into A, signed diff) for the 2D
1272
+ // blink/crossfade/diff viewer. CPU job via biofs-node. --region (+ --zlo/--zhi)
1273
+ // focuses the rigid alignment on one z-band (e.g. the pelvis), still spot-safe.
1274
+ imagingCmd
1275
+ .command('compare')
1276
+ .description('Image Time Machine: rigid slice-by-slice comparator of two CT timepoints (CPU job via biofs-node)')
1277
+ .requiredOption('--baseline <studyUID>', 'baseline (earlier) study UID')
1278
+ .requiredOption('--baseline-series <uid>', 'baseline primary CT series UID')
1279
+ .requiredOption('--followup <studyUID>', 'follow-up (later) study UID = the reference grid')
1280
+ .requiredOption('--followup-series <uid>', 'follow-up primary CT series UID')
1281
+ .option('--baseline-label <label>', 'short label for the baseline (e.g. jan9)')
1282
+ .option('--followup-label <label>', 'short label for the follow-up (e.g. mar3)')
1283
+ .option('--anatomy <name>', 'anatomy (abdomen | chest)', 'abdomen')
1284
+ .option('--region <label>', 'focus the rigid alignment on a z-band (needs --zlo/--zhi), e.g. pelvis')
1285
+ .option('--zlo <frac>', 'region z-fraction lower bound [0..1]')
1286
+ .option('--zhi <frac>', 'region z-fraction upper bound [0..1]')
1287
+ .option('--wait', 'Wait for the comparator to finish')
1288
+ .option('--quiet', 'Suppress progress output')
1289
+ .option('--json', 'Output as JSON')
1290
+ .action(async (options) => {
1291
+ try {
1292
+ await (0, compare_1.imagingCompareCommand)(options);
1293
+ }
1294
+ catch (error) {
1295
+ logger_1.Logger.error(`imaging compare failed: ${error}`);
1296
+ process.exit(1);
1297
+ }
1298
+ });
1299
+ // Workspace commands — the shared intra-LLM case workspace (append-only,
1300
+ // hash-chained log that Claude Code + Grok Build co-edit via biofs-node).
1301
+ const workspaceCmd = program
1302
+ .command('workspace')
1303
+ .alias('ws')
1304
+ .description('Shared intra-LLM case workspace: append-only, hash-chained, reproducible record');
1305
+ workspaceCmd
1306
+ .command('open <case_id>')
1307
+ .description('Open or create a case workspace; print header + turns')
1308
+ .option('--title <title>', 'Case title (on create)')
1309
+ .option('--biocid <biocid...>', 'Biocid(s) under discussion (on create)')
1310
+ .option('--node <url>', 'biofs-node base override (BIOFS_NODE_URL)')
1311
+ .option('--json', 'Output as JSON')
1312
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceOpenCommand)(caseId, options); });
1313
+ workspaceCmd
1314
+ .command('read <case_id>')
1315
+ .description('Read turns with seq > since_seq (how each agent sees new turns)')
1316
+ .option('--since-seq <n>', 'Only turns after this seq', '0')
1317
+ .option('--limit <n>', 'Max turns', '500')
1318
+ .option('--node <url>', 'biofs-node base override')
1319
+ .option('--json', 'Output as JSON')
1320
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceReadCommand)(caseId, options); });
1321
+ workspaceCmd
1322
+ .command('append <case_id>')
1323
+ .description('Append one turn (append-only). Default agent_id "operator"; use --as')
1324
+ .option('--as <agent_id>', 'Author id (e.g. operator, claude-code, grok-build)', 'operator')
1325
+ .option('--role <role>', 'Turn role', 'message')
1326
+ .option('--content <text>', 'Turn content')
1327
+ .option('--ref <biocid:hash:kind...>', 'Data refs, each biocid:content_hash:kind')
1328
+ .option('--node <url>', 'biofs-node base override')
1329
+ .option('--json', 'Output as JSON')
1330
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceAppendCommand)(caseId, options); });
1331
+ workspaceCmd
1332
+ .command('case <case_id>')
1333
+ .description('Update the shared case header with optimistic CAS (needs --expected-version)')
1334
+ .option('--title <title>', 'New title')
1335
+ .option('--status <status>', 'New status')
1336
+ .option('--active-editor <agent_id>', 'Advisory active editor')
1337
+ .option('--biocid <biocid...>', 'Replace biocids')
1338
+ .option('--expected-version <n>', 'Expected current _version', '0')
1339
+ .option('--node <url>', 'biofs-node base override')
1340
+ .option('--json', 'Output as JSON')
1341
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceCaseCommand)(caseId, options); });
1342
+ workspaceCmd
1343
+ .command('lease <resource>')
1344
+ .description('Advisory turn-taking lease (claim by default; --release to release)')
1345
+ .option('--holder <agent_id>', 'Lease holder', 'operator')
1346
+ .option('--ttl <seconds>', 'Lease TTL seconds', '60')
1347
+ .option('--release', 'Release instead of claim')
1348
+ .option('--node <url>', 'biofs-node base override')
1349
+ .option('--json', 'Output as JSON')
1350
+ .action(async (resource, options) => { await (0, workspace_1.workspaceLeaseCommand)(resource, options); });
1351
+ workspaceCmd
1352
+ .command('replay <case_id>')
1353
+ .description('Print the ordered log and verify the hash chain (the audit record)')
1354
+ .option('--node <url>', 'biofs-node base override')
1355
+ .option('--json', 'Output as JSON')
1356
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceReplayCommand)(caseId, options); });
1357
+ workspaceCmd
1358
+ .command('anchor <case_id>')
1359
+ .description('Record a turn-log segment digest for on-chain anchoring (stage B)')
1360
+ .option('--up-to-seq <n>', 'Anchor up to this seq (default: all)')
1361
+ .option('--node <url>', 'biofs-node base override')
1362
+ .option('--json', 'Output as JSON')
1363
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceAnchorCommand)(caseId, options); });
1364
+ workspaceCmd
1365
+ .command('classify <case_id>')
1366
+ .description('Record a structured ACMG-style classification claim (for consensus)')
1367
+ .requiredOption('--subject <s>', 'What is classified (HGVS, gene:variant, or biocid)')
1368
+ .requiredOption('--classification <c>', 'Verdict (Pathogenic|Likely pathogenic|VUS|Likely benign|Benign)')
1369
+ .option('--criteria <list>', 'ACMG criteria, comma-separated (e.g. PVS1,PM2)')
1370
+ .option('--strength <s>', 'Combined-strength note')
1371
+ .option('--confidence <n>', 'Confidence 0-1')
1372
+ .option('--rationale <text>', 'Justification (turn content)')
1373
+ .option('--as <agent_id>', 'Author id', 'operator')
1374
+ .option('--ref <biocid:hash:kind...>', 'Data refs')
1375
+ .option('--node <url>', 'biofs-node base override')
1376
+ .option('--json', 'Output as JSON')
1377
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceClassifyCommand)(caseId, options); });
1378
+ workspaceCmd
1379
+ .command('consensus <case_id>')
1380
+ .description('Compute cross-agent consensus from classification claims (agreement, disagreements)')
1381
+ .option('--node <url>', 'biofs-node base override')
1382
+ .option('--json', 'Output as JSON')
1383
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceConsensusCommand)(caseId, options); });
1384
+ workspaceCmd
1385
+ .command('export <case_id>')
1386
+ .description('Export the chain-verified turn log as portable JSON (for the verifier / archival)')
1387
+ .option('--out <file>', 'Write to file (default: stdout)')
1388
+ .option('--node <url>', 'biofs-node base override')
1389
+ .option('--quiet', 'Suppress status line')
1390
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceExportCommand)(caseId, options); });
1391
+ workspaceCmd
1392
+ .command('verify <file>')
1393
+ .description('Independently verify an exported turn log offline (zero-trust reproducibility check)')
1394
+ .option('--offline', 'Verify the hash chain locally without contacting any server (default behavior)')
1395
+ .option('--json', 'Output as JSON')
1396
+ .action(async (file, options) => { await (0, workspace_1.workspaceVerifyCommand)(file, options); });
1397
+ // Duet — conductor that drives Claude Code + Grok Build headless on subscriptions.
1398
+ program
1399
+ .command('duet <case_id>')
1400
+ .description('Orchestrate Claude Code + Grok Build (subscription CLIs, headless) on one case')
1401
+ .option('--task <text>', 'The shared goal/question for the two models')
1402
+ .option('--biocid <biocid>', 'The biocid (annotated VCF / data) under discussion')
1403
+ .option('--rounds <n>', 'Number of rounds', '3')
1404
+ .option('--mode <mode>', 'alternate | parallel | consensus', 'alternate')
1405
+ .option('--models <csv>', 'Models in order (claude,grok,gemini)', 'claude,grok')
1406
+ .option('--node <url>', 'biofs-node base override (BIOFS_NODE_URL)')
1407
+ .option('--biorouter <url>', 'biorouter base for the biofs MCP')
1408
+ .option('--mcp-dist <path>', 'Path to mcp-bio-context dist/index.js')
1409
+ .option('--claude-bin <bin>', 'Claude Code binary', 'claude')
1410
+ .option('--grok-bin <bin>', 'Grok Build binary', 'grok')
1411
+ .option('--gemini-bin <bin>', 'Gemini CLI binary', 'gemini')
1412
+ .option('--gemini-model <model>', 'Gemini model id', 'gemini-3-flash-preview')
1413
+ .option('--mock', 'Do not spawn the CLIs; simulate each turn (test the loop)')
1414
+ .option('--referee <model>', 'After rounds, this model adjudicates disagreements into a final call')
1415
+ .option('--timeout <seconds>', 'Per-CLI-invocation timeout (grok startup is slow)', '300')
1416
+ .option('--dry-run', 'Preflight checks only, then exit')
1417
+ .option('--json', 'Output as JSON')
1418
+ .action(async (caseId, options) => { await (0, duet_1.duetCommand)(caseId, options); });
1419
+ // Benchmark — the ACMG evaluation harness (single vs same-model vs cross-vendor).
1420
+ program
1421
+ .command('benchmark <dataset>')
1422
+ .description('Run the ACMG benchmark: single-model vs same-model debate vs cross-vendor debate, scored vs truth')
1423
+ .option('--arms <csv>', 'Arms to run', 'single,same-model,cross-vendor')
1424
+ .option('--models <csv>', 'Model panel', 'claude,grok,gemini')
1425
+ .option('--rounds <n>', 'Debate rounds for debate arms', '2')
1426
+ .option('--same-model <model>', 'Model used for the same-model-debate arm')
1427
+ .option('--mock', 'Deterministic mock (validate the harness without spawning CLIs)')
1428
+ .option('--mock-error <pct>', 'Per-model error rate in mock mode', '22')
1429
+ .option('--limit <n>', 'Only the first N variants')
1430
+ .option('--out <dir>', 'Results output directory')
1431
+ .option('--node <url>', 'biofs-node base override (BIOFS_NODE_URL)')
1432
+ .option('--biorouter <url>', 'biorouter base for the biofs MCP')
1433
+ .option('--mcp-dist <path>', 'Path to mcp-bio-context dist/index.js')
1434
+ .option('--gemini-model <model>', 'Gemini model id', 'gemini-3-flash-preview')
1435
+ .option('--timeout <seconds>', 'Per-CLI-invocation timeout', '300')
1436
+ .option('--json', 'Output summary as JSON')
1437
+ .action(async (dataset, options) => { await (0, benchmark_1.benchmarkCommand)(dataset, options); });
1438
+ // benchmark-prepare — build the publication dataset from a ClinVar export.
1439
+ program
1440
+ .command('benchmark-prepare <clinvar_variant_summary>')
1441
+ .description('Build a stratified benchmark dataset from a ClinVar variant_summary.txt[.gz] export')
1442
+ .option('--out <file>', 'Output JSONL path', 'bench/clinvar.jsonl')
1443
+ .option('--min-stars <n>', 'Minimum ClinVar review stars (2 = multiple submitters, no conflicts)', '2')
1444
+ .option('--per-tier <n>', 'Max variants sampled per ACMG tier', '100')
1445
+ .option('--max <n>', 'Hard cap on total variants')
1446
+ .option('--tiers <csv>', 'Restrict to tiers (e.g. P,LP,VUS,LB,B)')
1447
+ .option('--genes <csv>', 'Restrict to genes')
1448
+ .option('--assembly <asm>', 'Genome assembly to keep', 'GRCh38')
1449
+ .option('--json', 'Output summary as JSON')
1450
+ .action(async (file, options) => { await (0, benchmark_1.benchmarkPrepareCommand)(file, options); });
679
1451
  // Payment commands (x402 Protocol - Avalanche C-Chain)
680
1452
  const paymentCmd = program
681
1453
  .command('payment')
@@ -820,46 +1592,218 @@ agentCmd
820
1592
  process.exit(1);
821
1593
  }
822
1594
  });
823
- // Access control commands (v1.2.0)
824
- const accessCmd = program
825
- .command('access')
826
- .description('Manage BioNFT access control and permissions');
827
- // access request
828
- accessCmd
829
- .command('request <biocid_or_ip_id>')
830
- .description('Request access to a BioNFT asset')
831
- .option('--message <string>', 'Optional message to asset owner')
832
- .action(async (biocidOrIpId, options) => {
1595
+ // agent register-sequentia - Register ERC-8004 agents on Sequentia BioAgentRegistry
1596
+ agentCmd
1597
+ .command('register-sequentia')
1598
+ .description('Register Cancer Digital Twin agents on the Sequentia BioAgentRegistry (ERC-8004)')
1599
+ .option('--all', 'Register all three canonical agents (clara, opencravat, genoclaw)')
1600
+ .option('--agent <name>', 'Register a single canonical agent: clara | opencravat | genoclaw')
1601
+ .option('--name <name>', 'Ad-hoc agent name (requires --uri)')
1602
+ .option('--uri <url>', 'Ad-hoc agent registration file (agentURI)')
1603
+ .option('--formats <list>', 'Ad-hoc supported formats (comma-separated)', 'vcf')
1604
+ .option('--private-key <key>', 'Ad-hoc agent private key (defaults to derived)')
1605
+ .option('--no-x402', 'Register with x402 disabled')
1606
+ .option('--dry-run', 'Plan the registration without broadcasting (no key/gas needed)')
1607
+ .option('--json', 'Emit JSON')
1608
+ .action(async (options) => {
833
1609
  try {
834
- await (0, request_1.accessRequestCommand)(biocidOrIpId, options);
1610
+ await (0, register_sequentia_1.agentRegisterSequentiaCommand)(options);
835
1611
  }
836
1612
  catch (error) {
837
- logger_1.Logger.error(`Access request failed: ${error}`);
1613
+ logger_1.Logger.error(`Sequentia agent registration failed: ${error}`);
838
1614
  process.exit(1);
839
1615
  }
840
1616
  });
841
- // access grant
842
- accessCmd
843
- .command('grant <biocid_or_ip_id> <wallet_address>')
844
- .description('Grant access to a wallet address (owner only)')
845
- .option('--expires-in <duration>', 'Access expiry duration (e.g., 30d, 90d)')
846
- .action(async (biocidOrIpId, walletAddress, options) => {
1617
+ // agent list-sequentia - Query on-chain ERC-8004 agent status
1618
+ agentCmd
1619
+ .command('list-sequentia')
1620
+ .description('Query on-chain ERC-8004 status of the Cancer Twin agents (or any wallet/agentId)')
1621
+ .option('--wallet <address>', 'Look up an arbitrary agent wallet')
1622
+ .option('--agent-id <id>', 'Look up an arbitrary agentId')
1623
+ .option('--json', 'Emit JSON')
1624
+ .action(async (options) => {
847
1625
  try {
848
- await (0, grant_1.accessGrantCommand)(biocidOrIpId, walletAddress, options);
1626
+ await (0, list_sequentia_1.agentListSequentiaCommand)(options);
849
1627
  }
850
1628
  catch (error) {
851
- logger_1.Logger.error(`Access grant failed: ${error}`);
1629
+ logger_1.Logger.error(`Sequentia agent list failed: ${error}`);
852
1630
  process.exit(1);
853
1631
  }
854
1632
  });
855
- // access revoke
856
- accessCmd
857
- .command('revoke <biocid_or_ip_id> <wallet_address>')
858
- .description('Revoke access from a wallet address (owner only)')
859
- .option('--yes', 'Skip confirmation prompt')
860
- .action(async (biocidOrIpId, walletAddress, options) => {
1633
+ // Interpret command group - Agent 3: GenoClaw clinical interpreter (SQLite + context → report)
1634
+ const interpretCmd = program
1635
+ .command('interpret')
1636
+ .description('GenoClaw clinical interpreter — Cancer Digital Twin report from annotated context');
1637
+ interpretCmd
1638
+ .command('submit <biosample_serial>')
1639
+ .description('Submit annotated context to the GenoClaw interpreter agent (produces a Cancer Digital Twin report)')
1640
+ .option('--package <pkg>', 'Interpretation package: cancer_twin | rare_disease | pharmgx', 'cancer_twin')
1641
+ .option('--sqlite-biocid <biocid>', 'Explicit annotated-sqlite BioCID override')
1642
+ .option('--context-biocids <list>', 'Extra context BioCIDs (comma-separated)')
1643
+ .option('--wait', 'Wait for the interpretation to complete')
1644
+ .option('--quiet', 'Suppress progress output')
1645
+ .option('--json', 'Emit JSON')
1646
+ .action(async (biosampleSerial, options) => {
861
1647
  try {
862
- await (0, revoke_3.accessRevokeCommand)(biocidOrIpId, walletAddress, options);
1648
+ await (0, submit_18.interpretSubmitCommand)(biosampleSerial, options);
1649
+ }
1650
+ catch (error) {
1651
+ logger_1.Logger.error(`Interpretation submission failed: ${error}`);
1652
+ process.exit(1);
1653
+ }
1654
+ });
1655
+ interpretCmd
1656
+ .command('status <interpret_job_id>')
1657
+ .description('Check GenoClaw interpretation job status')
1658
+ .option('--watch', 'Watch mode (poll until done)')
1659
+ .option('--wait', 'Block until the job completes')
1660
+ .option('--max-wait-min <minutes>', 'Max minutes to wait', '30')
1661
+ .option('--json', 'Emit JSON')
1662
+ .action(async (jobId, options) => {
1663
+ try {
1664
+ await (0, status_7.interpretStatusCommand)(jobId, options);
1665
+ }
1666
+ catch (error) {
1667
+ logger_1.Logger.error(`Interpretation status check failed: ${error}`);
1668
+ process.exit(1);
1669
+ }
1670
+ });
1671
+ // Ancestry command group - SOMOS 24-population admixture (privacy-preserving)
1672
+ const ancestryCmd = program
1673
+ .command('ancestry')
1674
+ .description('SOMOS 24-population ancestry — supervised-ADMIXTURE projection, optionally encrypted (genome never decrypted)');
1675
+ ancestryCmd
1676
+ .command('ingest <file>')
1677
+ .description('Ingest a DTC genotype into the SOMOS vault and register it, yielding a biosample serial')
1678
+ .option('--biowallet <address>', 'Data owner (custodial biowallet). Defaults to your own wallet.')
1679
+ .option('--wait', 'Wait for registration to complete and print the serial')
1680
+ .option('--quiet', 'Suppress progress output')
1681
+ .option('--json', 'Emit JSON')
1682
+ .action(async (file, options) => {
1683
+ try {
1684
+ await (0, ingest_1.ancestryIngestCommand)(file, options);
1685
+ }
1686
+ catch (error) {
1687
+ logger_1.Logger.error(`Ancestry ingest failed: ${error}`);
1688
+ process.exit(1);
1689
+ }
1690
+ });
1691
+ ancestryCmd
1692
+ .command('somos <biosample_serial>')
1693
+ .description('Compute SOMOS admixture for a genotype in the vault (default: exact projection; --encrypted: blind CKKS)')
1694
+ .option('--encrypted', 'Tier-1 BlindDot: CKKS-encrypt the genome; server projects blind (raw genome never decrypted)')
1695
+ .option('--fully-blind', 'Tier-2 (optional): also hide the 24-pop result from the server (bootstrapping backend)')
1696
+ .option('--biowallet <address>', 'Data owner: file the result under this wallet, not the operator\'s')
1697
+ .option('--wait', 'Wait for the computation to complete')
1698
+ .option('--quiet', 'Suppress progress output')
1699
+ .option('--json', 'Emit JSON')
1700
+ .action(async (biosampleSerial, options) => {
1701
+ try {
1702
+ await (0, somos_1.ancestrySomosCommand)(biosampleSerial, options);
1703
+ }
1704
+ catch (error) {
1705
+ logger_1.Logger.error(`Ancestry submission failed: ${error}`);
1706
+ process.exit(1);
1707
+ }
1708
+ });
1709
+ ancestryCmd
1710
+ .command('share <biosample_serial>')
1711
+ .description('Mint a BioCID-gated, revocable, expiring report link (no storage URL is ever created)')
1712
+ .option('--days <n>', 'Days until the link expires (max 30)', '7')
1713
+ .option('--quiet', 'Suppress progress output')
1714
+ .option('--json', 'Emit JSON')
1715
+ .action(async (serial, options) => {
1716
+ try {
1717
+ await (0, share_2.ancestryShareCommand)(serial, options);
1718
+ }
1719
+ catch (error) {
1720
+ logger_1.Logger.error(`Ancestry share failed: ${error}`);
1721
+ process.exit(1);
1722
+ }
1723
+ });
1724
+ ancestryCmd
1725
+ .command('shares')
1726
+ .description('List BioCID-gated report shares you created or own')
1727
+ .option('--serial <biosample_serial>', 'Filter by biosample serial')
1728
+ .option('--json', 'Emit JSON')
1729
+ .action(async (options) => {
1730
+ try {
1731
+ await (0, share_2.ancestrySharesCommand)(options);
1732
+ }
1733
+ catch (error) {
1734
+ logger_1.Logger.error(`Ancestry shares failed: ${error}`);
1735
+ process.exit(1);
1736
+ }
1737
+ });
1738
+ ancestryCmd
1739
+ .command('revoke <share_id>')
1740
+ .description('Revoke a report share immediately (the link dies on the next view)')
1741
+ .option('--json', 'Emit JSON')
1742
+ .action(async (shareId, options) => {
1743
+ try {
1744
+ await (0, share_2.ancestryRevokeCommand)(shareId, options);
1745
+ }
1746
+ catch (error) {
1747
+ logger_1.Logger.error(`Ancestry revoke failed: ${error}`);
1748
+ process.exit(1);
1749
+ }
1750
+ });
1751
+ ancestryCmd
1752
+ .command('status <ancestry_job_id>')
1753
+ .description('Check a SOMOS ancestry job status / fetch the 24-population result')
1754
+ .option('--watch', 'Watch mode (poll until done)')
1755
+ .option('--wait', 'Block until the job completes')
1756
+ .option('--max-wait-min <minutes>', 'Max minutes to wait', '40')
1757
+ .option('--json', 'Emit JSON')
1758
+ .action(async (jobId, options) => {
1759
+ try {
1760
+ await (0, status_8.ancestryStatusCommand)(jobId, options);
1761
+ }
1762
+ catch (error) {
1763
+ logger_1.Logger.error(`Ancestry status check failed: ${error}`);
1764
+ process.exit(1);
1765
+ }
1766
+ });
1767
+ // Access control commands (v1.2.0)
1768
+ const accessCmd = program
1769
+ .command('access')
1770
+ .description('Manage BioNFT access control and permissions');
1771
+ // access request
1772
+ accessCmd
1773
+ .command('request <biocid_or_ip_id>')
1774
+ .description('Request access to a BioNFT asset')
1775
+ .option('--message <string>', 'Optional message to asset owner')
1776
+ .action(async (biocidOrIpId, options) => {
1777
+ try {
1778
+ await (0, request_1.accessRequestCommand)(biocidOrIpId, options);
1779
+ }
1780
+ catch (error) {
1781
+ logger_1.Logger.error(`Access request failed: ${error}`);
1782
+ process.exit(1);
1783
+ }
1784
+ });
1785
+ // access grant
1786
+ accessCmd
1787
+ .command('grant <biocid_or_ip_id> <wallet_address>')
1788
+ .description('Grant access to a wallet address (owner only)')
1789
+ .option('--expires-in <duration>', 'Access expiry duration (e.g., 30d, 90d)')
1790
+ .action(async (biocidOrIpId, walletAddress, options) => {
1791
+ try {
1792
+ await (0, grant_1.accessGrantCommand)(biocidOrIpId, walletAddress, options);
1793
+ }
1794
+ catch (error) {
1795
+ logger_1.Logger.error(`Access grant failed: ${error}`);
1796
+ process.exit(1);
1797
+ }
1798
+ });
1799
+ // access revoke
1800
+ accessCmd
1801
+ .command('revoke <biocid_or_ip_id> <wallet_address>')
1802
+ .description('Revoke access from a wallet address (owner only)')
1803
+ .option('--yes', 'Skip confirmation prompt')
1804
+ .action(async (biocidOrIpId, walletAddress, options) => {
1805
+ try {
1806
+ await (0, revoke_3.accessRevokeCommand)(biocidOrIpId, walletAddress, options);
863
1807
  }
864
1808
  catch (error) {
865
1809
  logger_1.Logger.error(`Access revocation failed: ${error}`);
@@ -1176,243 +2120,1561 @@ contextCmd
1176
2120
  }
1177
2121
  });
1178
2122
  // Job management commands (BioOS)
1179
- const jobCmd = program
1180
- .command('job')
1181
- .description('Manage research jobs (BioOS)');
1182
- // job create
1183
- jobCmd
1184
- .command('create <prompt> <file>')
1185
- .description('Create a research job from natural language prompt')
1186
- .option('--pipeline <template>', 'Use predefined pipeline template')
2123
+ // Methyl command group — Oxford Nanopore 5mCG/5hmCG methylation pipeline
2124
+ const methylCmd = program
2125
+ .command('methyl')
2126
+ .description('Oxford Nanopore 5mCG/5hmCG methylation: submit (client) + exec (VM runner)');
2127
+ // methyl submit (DEFAULT) — `biofs methyl <serial>` and `biofs methyl submit <serial>`
2128
+ methylCmd
2129
+ .command('submit <serial>', { isDefault: true })
2130
+ .description('Submit an ONT methylation job to biofs-node (modkit 5mCG/5hmCG bedMethyl)')
2131
+ .requiredOption('--bams <csv>', 'CSV of gs:// ONT Dorado BAM URIs (carry MM/ML tags)')
2132
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2133
+ .option('--parent-ip-id <id>', 'Parent BioIP / IP asset id')
1187
2134
  .option('--json', 'Output as JSON')
1188
- .action(async (prompt, fileRef, options) => {
2135
+ .action(async (serial, options) => {
1189
2136
  try {
1190
- await (0, create_1.jobCreateCommand)(prompt, fileRef, options);
2137
+ await (0, submit_3.methylSubmitCommand)(serial, options);
1191
2138
  }
1192
2139
  catch (error) {
1193
- logger_1.Logger.error(`Job creation failed: ${error}`);
2140
+ logger_1.Logger.error(`Methyl submit failed: ${error}`);
1194
2141
  process.exit(1);
1195
2142
  }
1196
2143
  });
1197
- // job status
1198
- jobCmd
1199
- .command('status <job_id>')
1200
- .description('Check job execution status')
1201
- .option('--json', 'Output as JSON')
1202
- .option('--watch', 'Watch mode (refresh every 5 seconds)')
1203
- .action(async (jobId, options) => {
2144
+ // methyl exec — the VM-side executor (biofs-node spawns: biofs methyl exec --flags)
2145
+ methylCmd
2146
+ .command('exec')
2147
+ .description('VM-side executor: minimap2 align + samtools merge + modkit pileup, stream bedMethyl to GCS')
2148
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2149
+ .requiredOption('--bams <csv>', 'CSV of gs:// ONT BAM URIs')
2150
+ .option('--ref <build>', 'Reference build', 'auto')
2151
+ .option('--job-id <id>', 'Job id (for OUT/LOG GCS pathing)')
2152
+ .option('--batch-id <id>', 'Batch id')
2153
+ .option('--creator <wallet>', 'Creator wallet (lowercased for LOG_GCS path)')
2154
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2155
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2156
+ .action(async (options) => {
1204
2157
  try {
1205
- await (0, status_4.jobStatusCommand)(jobId, options);
2158
+ await (0, exec_1.methylExecCommand)(options);
1206
2159
  }
1207
2160
  catch (error) {
1208
- logger_1.Logger.error(`Status check failed: ${error}`);
2161
+ logger_1.Logger.error(`Methyl exec failed: ${error}`);
1209
2162
  process.exit(1);
1210
2163
  }
1211
2164
  });
1212
- // job results
1213
- jobCmd
1214
- .command('results <job_id>')
1215
- .description('Get job results with download URLs')
2165
+ // Align-shard command group — sharded ONT long-read alignment (dorado, MM/ML-native)
2166
+ const alignShardCmd = program
2167
+ .command('align-shard')
2168
+ .description('Sharded ONT long-read alignment (dorado aligner, MM/ML preserved): submit (client) + exec (VM runner)');
2169
+ // align-shard submit (DEFAULT) — `biofs align-shard <serial>` and `biofs align-shard submit <serial>`
2170
+ alignShardCmd
2171
+ .command('submit <serial>', { isDefault: true })
2172
+ .description('Submit a sharded ONT alignment job to biofs-node (dorado aligner, persists merged aligned modBAM)')
2173
+ .requiredOption('--bams <csv>', 'CSV of gs:// ONT Dorado modBAM URIs (carry MM/ML tags)')
2174
+ .option('--shards <n>', 'Concurrent aligner workers (default: auto from nproc)')
2175
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2176
+ .option('--modkit', 'Also produce the 5mCG/5hmCG bedMethyl pileup (with QC gates)')
2177
+ .option('--parent-ip-id <id>', 'Parent BioIP / IP asset id')
1216
2178
  .option('--json', 'Output as JSON')
1217
- .option('--step <number>', 'Download specific step only', parseInt)
1218
- .action(async (jobId, options) => {
2179
+ .action(async (serial, options) => {
1219
2180
  try {
1220
- await (0, results_1.jobResultsCommand)(jobId, options);
2181
+ await (0, submit_4.alignShardSubmitCommand)(serial, options);
1221
2182
  }
1222
2183
  catch (error) {
1223
- logger_1.Logger.error(`Failed to get results: ${error}`);
2184
+ logger_1.Logger.error(`Align-shard submit failed: ${error}`);
1224
2185
  process.exit(1);
1225
2186
  }
1226
2187
  });
1227
- // job list
1228
- jobCmd
1229
- .command('list')
1230
- .description('List all your research jobs')
1231
- .option('--json', 'Output as JSON')
1232
- .option('--status <status>', 'Filter by status (pending, running, completed, failed)')
1233
- .option('--limit <number>', 'Limit number of results', parseInt)
2188
+ // align-shard exec — the VM-side executor (biofs-node spawns: biofs align-shard exec --flags)
2189
+ alignShardCmd
2190
+ .command('exec')
2191
+ .description('VM-side executor: W concurrent dorado aligner workers + merge, persist aligned modBAM to GCS')
2192
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2193
+ .requiredOption('--bams <csv>', 'CSV of gs:// ONT modBAM URIs')
2194
+ .option('--ref <build>', 'Reference build', 'auto')
2195
+ .option('--workers <n>', 'Concurrent aligner workers (default: auto from nproc)')
2196
+ .option('--modkit', 'Also run modkit pileup (5mCG/5hmCG bedMethyl) with QC gates')
2197
+ .option('--job-id <id>', 'Job id (for OUT/LOG GCS pathing)')
2198
+ .option('--batch-id <id>', 'Batch id')
2199
+ .option('--creator <wallet>', 'Creator wallet (lowercased for LOG_GCS path)')
2200
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2201
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
1234
2202
  .action(async (options) => {
1235
2203
  try {
1236
- await (0, list_3.jobListCommand)(options);
2204
+ await (0, exec_2.alignShardExecCommand)(options);
1237
2205
  }
1238
2206
  catch (error) {
1239
- logger_1.Logger.error(`Failed to list jobs: ${error}`);
2207
+ logger_1.Logger.error(`Align-shard exec failed: ${error}`);
1240
2208
  process.exit(1);
1241
2209
  }
1242
2210
  });
1243
- // job pipelines
1244
- jobCmd
1245
- .command('pipelines')
1246
- .alias('templates')
1247
- .description('List available pipeline templates')
2211
+ // Comethyl command group — single-molecule co-methylation analysis (gated, pre-registered)
2212
+ const comethylCmd = program
2213
+ .command('comethyl')
2214
+ .description('Single-molecule co-methylation analysis (imprinting floor, lambda, nulls): submit (client) + exec (VM runner)');
2215
+ comethylCmd
2216
+ .command('submit <serial>', { isDefault: true })
2217
+ .description('Submit a comethyl analysis job to biofs-node (gate=floor: imprinting/ASM allele-split)')
2218
+ .requiredOption('--modbam <gs>', 'gs:// merged aligned ONT modBAM (MM/ML), the comethyl input')
2219
+ .requiredOption('--hifi-vcf <gs>', 'gs:// HiFi het-SNP VCF (phased on the VM if unphased)')
2220
+ .requiredOption('--hifi-bam <csv>', 'CSV of gs:// HiFi BAM URIs (for whatshap phase)')
2221
+ .option('--gate <g>', 'floor | lambda | null-a', 'floor')
2222
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
1248
2223
  .option('--json', 'Output as JSON')
2224
+ .action(async (serial, options) => {
2225
+ try {
2226
+ await (0, submit_5.comethylSubmitCommand)(serial, options);
2227
+ }
2228
+ catch (error) {
2229
+ logger_1.Logger.error(`Comethyl submit failed: ${error}`);
2230
+ process.exit(1);
2231
+ }
2232
+ });
2233
+ comethylCmd
2234
+ .command('exec')
2235
+ .description('VM-side executor: phase ONT reads by HiFi het SNPs + per-haplotype modkit at imprinted DMRs')
2236
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2237
+ .requiredOption('--modbam <gs>', 'gs:// merged ONT modBAM')
2238
+ .requiredOption('--hifi-vcf <gs>', 'gs:// HiFi het-SNP VCF')
2239
+ .requiredOption('--hifi-bams <csv>', 'CSV of gs:// HiFi BAM URIs')
2240
+ .option('--gate <g>', 'floor', 'floor')
2241
+ .option('--ref <build>', 'Reference build', 'auto')
2242
+ .option('--job-id <id>', 'Job id')
2243
+ .option('--batch-id <id>', 'Batch id')
2244
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2245
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2246
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
1249
2247
  .action(async (options) => {
1250
2248
  try {
1251
- await (0, pipelines_1.pipelinesCommand)(options);
2249
+ await (0, exec_3.comethylExecCommand)(options);
1252
2250
  }
1253
2251
  catch (error) {
1254
- logger_1.Logger.error(`Failed to list pipelines: ${error}`);
2252
+ logger_1.Logger.error(`Comethyl exec failed: ${error}`);
1255
2253
  process.exit(1);
1256
2254
  }
1257
2255
  });
1258
- // job submit-clara - Submit Clara Parabricks FASTQ→VCF job
1259
- jobCmd
1260
- .command('submit-clara <biosample_id> [fastq_r1] [fastq_r2]')
1261
- .description('Submit Clara Parabricks GPU variant calling job (FASTQ → VCF)\nAuto-discovers FASTQ files from consent if not specified')
1262
- .option('--job-id <id>', 'Custom job ID (default: auto-generated UUID)')
1263
- .option('--reference <genome>', 'Reference genome (default: hg38)')
1264
- .option('--capture-kit <kit>', 'Capture kit name (default: agilent_v8)')
1265
- .option('--sequencing-type <type>', 'Sequencing type: WES or WGS (default: WES)')
1266
- .option('--interval-file <path>', 'BED file path for targeted sequencing')
2256
+ // SV-call command group — ONT structural-variant calling (Sniffles2)
2257
+ const svCallCmd = program
2258
+ .command('sv-call')
2259
+ .description('ONT structural-variant calling (Sniffles2): submit (client) + exec (VM runner)');
2260
+ svCallCmd
2261
+ .command('submit <serial>', { isDefault: true })
2262
+ .description('Submit an ONT SV-calling job to biofs-node (Sniffles2 over the aligned modBAM)')
2263
+ .requiredOption('--modbam <gs>', 'gs:// merged aligned ONT modBAM (the SV-calling input)')
2264
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
1267
2265
  .option('--json', 'Output as JSON')
1268
- .action(async (biosampleId, fastqR1, fastqR2, options) => {
2266
+ .action(async (serial, options) => {
1269
2267
  try {
1270
- await (0, submit_clara_1.submitClaraCommand)(biosampleId, fastqR1, fastqR2, options);
2268
+ await (0, submit_6.svCallSubmitCommand)(serial, options);
1271
2269
  }
1272
2270
  catch (error) {
1273
- logger_1.Logger.error(`Clara job submission failed: ${error}`);
2271
+ logger_1.Logger.error(`sv-call submit failed: ${error}`);
1274
2272
  process.exit(1);
1275
2273
  }
1276
2274
  });
1277
- // Agent Health - Check processing agent readiness
1278
- program
1279
- .command('agent-health')
1280
- .alias('health')
1281
- .description('Check if GPU processing agent is ready to receive jobs')
1282
- .option('--json', 'Output as JSON')
1283
- .option('--verbose', 'Show detailed server information')
2275
+ svCallCmd
2276
+ .command('exec')
2277
+ .description('VM-side executor: Sniffles2 over the gcsfuse-mounted modBAM, persist SV VCF to GCS')
2278
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2279
+ .requiredOption('--modbam <gs>', 'gs:// merged ONT modBAM')
2280
+ .option('--ref <build>', 'Reference build', 'auto')
2281
+ .option('--job-id <id>', 'Job id')
2282
+ .option('--batch-id <id>', 'Batch id')
2283
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2284
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2285
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
1284
2286
  .action(async (options) => {
1285
2287
  try {
1286
- await (0, health_1.agentHealthCommand)(options);
2288
+ await (0, exec_4.svCallExecCommand)(options);
1287
2289
  }
1288
2290
  catch (error) {
1289
- logger_1.Logger.error(`Health check failed: ${error}`);
2291
+ logger_1.Logger.error(`sv-call exec failed: ${error}`);
1290
2292
  process.exit(1);
1291
2293
  }
1292
2294
  });
1293
- // Lab Registry - List approved research labs
1294
- program
1295
- .command('labnfts')
1296
- .alias('labs')
1297
- .description('List approved research labs authorized to receive BioNFT-licensed data')
1298
- .option('--filter <specialization>', 'Filter by lab specialization (e.g., cancer, rare-disease)')
1299
- .option('--location <location>', 'Filter by location')
2295
+ // QC command group — long-read read-quality + coverage (verkko-readiness)
2296
+ const qcCmd = program
2297
+ .command('qc')
2298
+ .description('Long-read QC (read quality + coverage, verkko-readiness): submit (client) + exec (VM runner)');
2299
+ qcCmd
2300
+ .command('submit <serial>', { isDefault: true })
2301
+ .description('Submit a long-read QC job to biofs-node (cramino + seqkit + HiFi rq-tag QV over gcsfuse-RO)')
2302
+ .requiredOption('--inputs <gs>', 'CSV of gs:// inputs (BAM/CRAM and/or FASTA/FASTQ.gz)')
2303
+ .option('--genome-size <bp>', 'Haploid genome size for coverage', '3100000000')
1300
2304
  .option('--json', 'Output as JSON')
1301
- .option('--verbose', 'Show detailed lab information')
1302
- .action(async (options) => {
2305
+ .action(async (serial, options) => {
1303
2306
  try {
1304
- await (0, list_5.labNFTsCommand)(options);
2307
+ await (0, submit_7.qcSubmitCommand)(serial, options);
1305
2308
  }
1306
2309
  catch (error) {
1307
- logger_1.Logger.error(`Failed to fetch labs: ${error}`);
2310
+ logger_1.Logger.error(`qc submit failed: ${error}`);
1308
2311
  process.exit(1);
1309
2312
  }
1310
2313
  });
1311
- // Share - GDPR-compliant sharing with dual NFT minting
1312
- program
1313
- .command('share <biocid_or_filename>')
1314
- .description('Share biofile with approved lab (auto-detects existing tokenization)')
1315
- .requiredOption('--lab <wallet_address>', 'Lab wallet address (use "biofs labnfts" to list approved labs)')
1316
- .option('--license <type>', 'License type: non-commercial (default), commercial, commercial-remix', 'non-commercial')
1317
- .option('--verbose', 'Show detailed progress')
1318
- .option('--debug', 'Show debug information')
1319
- .action(async (biocidOrFilename, options) => {
2314
+ qcCmd
2315
+ .command('exec')
2316
+ .description('VM-side executor: cramino/seqkit/rq over gcsfuse-mounted inputs, persist QC manifest to GCS')
2317
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2318
+ .requiredOption('--inputs <gs>', 'CSV of gs:// inputs (BAM/CRAM and/or FASTA/FASTQ.gz)')
2319
+ .option('--genome-size <bp>', 'Haploid genome size for coverage', '3100000000')
2320
+ .option('--job-id <id>', 'Job id')
2321
+ .option('--batch-id <id>', 'Batch id')
2322
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2323
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2324
+ .action(async (options) => {
1320
2325
  try {
1321
- await (0, share_1.shareCommand)(biocidOrFilename, options);
2326
+ await (0, exec_5.qcExecCommand)(options);
1322
2327
  }
1323
2328
  catch (error) {
1324
- logger_1.Logger.error(`Share failed: ${error}`);
2329
+ logger_1.Logger.error(`qc exec failed: ${error}`);
1325
2330
  process.exit(1);
1326
2331
  }
1327
2332
  });
1328
- // Shares - View permission graph (who has access to what)
1329
- program
1330
- .command('shares')
1331
- .description('View BioNFT permission graph (files shared with you and by you)')
2333
+ // Verkko command group — telomere-to-telomere assembly (verkko 2.3.2), biocid-gated
2334
+ const verkkoCmd = program
2335
+ .command('verkko')
2336
+ .description('Verkko T2T assembly (HiFi + ONT-ultralong): submit (client, biocids) + exec (VM runner)');
2337
+ verkkoCmd
2338
+ .command('submit <serial>', { isDefault: true })
2339
+ .description('Submit a verkko T2T assembly job to biofs-node (inputs are biorouter biocids, NOT gs://)')
2340
+ .requiredOption('--hifi <biocids>', 'CSV of biocid:// HiFi reads (from biorouter)')
2341
+ .requiredOption('--nano <biocids>', 'CSV of biocid:// ONT reads (from biorouter)')
2342
+ .option('--hifi-prop <p>', 'Downsample HiFi to this proportion of reads', '1.0')
2343
+ .option('--ont-minlen <bp>', 'Keep ONT reads >= this length (ultralong)', '100000')
2344
+ .option('--local-memory <gb>', 'verkko --local-memory (GB)', '320')
2345
+ .option('--local-cpus <n>', 'verkko --local-cpus', '80')
1332
2346
  .option('--json', 'Output as JSON')
1333
- .option('--graphql', 'Show GraphQL schema and sample queries')
1334
- .option('--verbose', 'Show detailed information')
2347
+ .action(async (serial, options) => {
2348
+ try {
2349
+ await (0, submit_8.verkkoSubmitCommand)(serial, options);
2350
+ }
2351
+ catch (error) {
2352
+ logger_1.Logger.error(`verkko submit failed: ${error}`);
2353
+ process.exit(1);
2354
+ }
2355
+ });
2356
+ verkkoCmd
2357
+ .command('exec')
2358
+ .description('VM-side executor: verkko 2.3.2 over front-resolved gated gs:// inputs, persist assembly to GCS')
2359
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2360
+ .requiredOption('--hifi <gs>', 'CSV of resolved gs:// HiFi reads (gated by biofs-node)')
2361
+ .requiredOption('--nano <gs>', 'CSV of resolved gs:// ONT reads (gated by biofs-node)')
2362
+ .option('--hifi-prop <p>', 'Downsample HiFi proportion', '1.0')
2363
+ .option('--ont-minlen <bp>', 'ONT min length', '100000')
2364
+ .option('--local-memory <gb>', 'verkko --local-memory (GB)', '320')
2365
+ .option('--local-cpus <n>', 'verkko --local-cpus', '80')
2366
+ .option('--ref <build>', 'ignored (appended by the generic biofs-node spawner)')
2367
+ .option('--job-id <id>', 'Job id')
2368
+ .option('--batch-id <id>', 'Batch id')
2369
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2370
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2371
+ .option('--ref-bucket <name>', 'ignored (appended by the generic biofs-node spawner)')
1335
2372
  .action(async (options) => {
1336
2373
  try {
1337
- await (0, shares_1.sharesCommand)(options);
2374
+ await (0, exec_6.verkkoExecCommand)(options);
1338
2375
  }
1339
2376
  catch (error) {
1340
- logger_1.Logger.error(`Failed to build permission graph: ${error}`);
2377
+ logger_1.Logger.error(`verkko exec failed: ${error}`);
1341
2378
  process.exit(1);
1342
2379
  }
1343
2380
  });
1344
- // Verify - DNA fingerprint verification
1345
- program
1346
- .command('verify <biocid_or_filename> <local_file>')
1347
- .description('Verify file integrity using DNA fingerprint (Bloom filter)')
1348
- .option('--verbose', 'Show detailed information')
2381
+ // ONT-variants command group — ONT small-variant calling (Clair3)
2382
+ const ontVariantsCmd = program
2383
+ .command('ont-variants')
2384
+ .description('ONT small-variant calling (Clair3, R10.4.1 sup): submit (client) + exec (VM runner)');
2385
+ ontVariantsCmd
2386
+ .command('submit <serial>', { isDefault: true })
2387
+ .description('Submit an ONT SNV/indel job to biofs-node (Clair3 over the aligned modBAM)')
2388
+ .requiredOption('--modbam <gs>', 'gs:// merged aligned ONT modBAM (the SNV/indel-calling input)')
2389
+ .option('--model <name>', 'Clair3 model name (default: auto-pick R10.4.1 sup from the image)')
2390
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
1349
2391
  .option('--json', 'Output as JSON')
1350
- .action(async (biocidOrFilename, localFile, options) => {
2392
+ .action(async (serial, options) => {
1351
2393
  try {
1352
- await (0, verify_2.verifyCommand)(biocidOrFilename, localFile, options);
2394
+ await (0, submit_9.ontVariantsSubmitCommand)(serial, options);
1353
2395
  }
1354
2396
  catch (error) {
1355
- logger_1.Logger.error(`Verification failed: ${error}`);
2397
+ logger_1.Logger.error(`ont-variants submit failed: ${error}`);
1356
2398
  process.exit(1);
1357
2399
  }
1358
2400
  });
1359
- // Resolve - BioRoutes on-chain route resolution (Phase G.2)
1360
- program
1361
- .command('resolve <biocid_or_fingerprint>')
1362
- .description('Resolve a biocid or fingerprint to its storage route via BioRoutes on-chain (Sequentia)')
1363
- .option('--by-fingerprint', 'Treat the argument as a contentHash fingerprint instead of a biocid')
1364
- .option('--verify', 'Verify that the resolved URI is accessible and fingerprint matches')
1365
- .option('--dispute', 'If --verify detects mismatch, submit RouteDisputed tx on-chain')
1366
- .option('--json', 'Output as JSON')
1367
- .option('--verbose', 'Show debug information')
1368
- .action(async (identifier, options) => {
2401
+ ontVariantsCmd
2402
+ .command('exec')
2403
+ .description('VM-side executor: Clair3 (ONT) over the gcsfuse-mounted modBAM, persist SNV/indel VCF to GCS')
2404
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2405
+ .requiredOption('--modbam <gs>', 'gs:// merged ONT modBAM')
2406
+ .option('--model <name>', 'Clair3 model name (auto-picked if empty)')
2407
+ .option('--ref <build>', 'Reference build', 'auto')
2408
+ .option('--job-id <id>', 'Job id')
2409
+ .option('--batch-id <id>', 'Batch id')
2410
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2411
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2412
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2413
+ .action(async (options) => {
1369
2414
  try {
1370
- await (0, resolve_1.resolveCommand)(identifier, options);
2415
+ await (0, exec_7.ontVariantsExecCommand)(options);
1371
2416
  }
1372
2417
  catch (error) {
1373
- logger_1.Logger.error(`Resolve failed: ${error}`);
2418
+ logger_1.Logger.error(`ont-variants exec failed: ${error}`);
1374
2419
  process.exit(1);
1375
2420
  }
1376
2421
  });
1377
- // Match - 3-stage privacy-preserving SNP match (ICISSP 2024 Figure 1)
1378
- program
1379
- .command('match')
1380
- .description('Match SNPs against an owner corpus via Bloom/accumulator (Matcher → Ticket → Resolver)')
1381
- .requiredOption('--owner <wallet>', 'Owner wallet address to match against')
1382
- .option('--snps <list>', 'Comma-separated SNPs in rsid:chrom:pos:genotype format')
1383
- .option('--snp-file <path>', 'File with one SNP per line (rsid:chrom:pos:genotype)')
2422
+ // hifi-deepvariant command group — HiFi small-variant calling (Parabricks DeepVariant, GPU)
2423
+ const hifiDvCmd = program
2424
+ .command('hifi-deepvariant')
2425
+ .description('HiFi small-variant calling (Parabricks DeepVariant --mode pacbio, GPU): submit (client) + exec (GPU runner)');
2426
+ hifiDvCmd
2427
+ .command('submit <serial>', { isDefault: true })
2428
+ .description('Submit a HiFi DeepVariant job to biofs-node (pbrun deepvariant over the aligned HiFi BAM)')
2429
+ .requiredOption('--bam <gs>', 'gs:// CHM13-aligned HiFi BAM (output of hifi-align --ref CHM13)')
2430
+ .option('--ref <build>', 'Reference: CHM13 | GRCh38 | auto', 'auto')
2431
+ .option('--gvcf', 'Also emit a gVCF (second pbrun pass)')
1384
2432
  .option('--json', 'Output as JSON')
1385
- .option('--verbose', 'Show debug information')
2433
+ .action(async (serial, options) => {
2434
+ try {
2435
+ await (0, submit_14.hifiDeepvariantSubmitCommand)(serial, options);
2436
+ }
2437
+ catch (error) {
2438
+ logger_1.Logger.error(`hifi-deepvariant submit failed: ${error}`);
2439
+ process.exit(1);
2440
+ }
2441
+ });
2442
+ hifiDvCmd
2443
+ .command('exec')
2444
+ .description('GPU-side executor: pbrun deepvariant (--mode pacbio) over the gcsfuse-mounted HiFi BAM, persist VCF to GCS')
2445
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2446
+ .requiredOption('--bam <gs>', 'gs:// CHM13-aligned HiFi BAM')
2447
+ .option('--ref <build>', 'Reference build', 'auto')
2448
+ .option('--gvcf', 'Also emit a gVCF')
2449
+ .option('--job-id <id>', 'Job id')
2450
+ .option('--batch-id <id>', 'Batch id')
2451
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2452
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2453
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
1386
2454
  .action(async (options) => {
1387
2455
  try {
1388
- await (0, match_1.matchCommand)(options);
2456
+ await (0, exec_12.hifiDeepvariantExecCommand)(options);
1389
2457
  }
1390
2458
  catch (error) {
1391
- logger_1.Logger.error(`Match failed: ${error}`);
2459
+ logger_1.Logger.error(`hifi-deepvariant exec failed: ${error}`);
1392
2460
  process.exit(1);
1393
2461
  }
1394
2462
  });
1395
- // Ticket - Privacy ticket management (ICISSP 2024 §6)
1396
- program
1397
- .command('ticket')
1398
- .description('List or revoke privacy tickets (BioNFTCredentials-bound access tokens)')
1399
- .option('--list', 'List active tickets (default)')
1400
- .option('--revoke <ticketId>', 'Revoke a ticket by ID (burns BioNFTCredentials token)')
2463
+ // liftover command group — cross-reference VCF liftover (CrossMap, CHM13 -> GRCh38)
2464
+ const liftoverCmd = program
2465
+ .command('liftover')
2466
+ .description('Cross-reference VCF liftover (CrossMap, CHM13 -> GRCh38): submit (client) + exec (VM runner)');
2467
+ liftoverCmd
2468
+ .command('submit <serial>', { isDefault: true })
2469
+ .description('Submit a liftover job to biofs-node (CrossMap a CHM13 VCF to GRCh38 for ClinVar annotation)')
2470
+ .requiredOption('--vcf <gs>', 'gs:// CHM13-coordinate VCF to lift')
2471
+ .option('--to <build>', 'Target assembly', 'GRCh38')
1401
2472
  .option('--json', 'Output as JSON')
1402
- .option('--verbose', 'Show debug information')
1403
- .action(async (options) => {
2473
+ .action(async (serial, options) => {
1404
2474
  try {
1405
- await (0, ticket_1.ticketCommand)(options);
2475
+ await (0, submit_15.liftoverSubmitCommand)(serial, options);
1406
2476
  }
1407
2477
  catch (error) {
1408
- logger_1.Logger.error(`Ticket command failed: ${error}`);
2478
+ logger_1.Logger.error(`liftover submit failed: ${error}`);
1409
2479
  process.exit(1);
1410
2480
  }
1411
2481
  });
1412
- // Dissect - GDPR Data Minimization: Extract phenotype-specific SNPs
1413
- // NOW USES SEQUENTIA PROTOCOL BY DEFAULT (solves 0xd4d910b4 Story Protocol error!)
1414
- program
1415
- .command('dissect <phenotype_query> <source_file>')
2482
+ liftoverCmd
2483
+ .command('exec')
2484
+ .description('VM-side executor: CrossMap CHM13->GRCh38 over the gcsfuse-mounted VCF, persist lifted VCF + reject to GCS')
2485
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2486
+ .requiredOption('--vcf <gs>', 'gs:// CHM13-coordinate VCF')
2487
+ .option('--to <build>', 'Target assembly', 'GRCh38')
2488
+ .option('--ref-from <build>', 'Source assembly', 'CHM13')
2489
+ .option('--ref <build>', 'Reference build (accepted+ignored; liftover uses --to + chain)', 'auto')
2490
+ .option('--tool <engine>', 'Liftover engine: crossmap (default) | gatk (swap-aware, recovers ref-discordant)', 'crossmap')
2491
+ .option('--job-id <id>', 'Job id')
2492
+ .option('--batch-id <id>', 'Batch id')
2493
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2494
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2495
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2496
+ .action(async (options) => {
2497
+ try {
2498
+ await (0, exec_13.liftoverExecCommand)(options);
2499
+ }
2500
+ catch (error) {
2501
+ logger_1.Logger.error(`liftover exec failed: ${error}`);
2502
+ process.exit(1);
2503
+ }
2504
+ });
2505
+ // Dipcall command group — assembly-based variant calling (dipcall) for Study 2
2506
+ const dipcallCmd = program.command('dipcall').description('Assembly-based variant calling (dipcall, phased diploid assembly -> reference): submit (client) + exec (VM runner)');
2507
+ dipcallCmd.command('submit <serial>', { isDefault: true })
2508
+ .description('Submit an assembly-based dipcall job to biofs-node (two haplotype FASTAs -> dip VCF + confident BED)')
2509
+ .requiredOption('--hap1 <gs>', 'gs:// haplotype-1 assembly FASTA')
2510
+ .requiredOption('--hap2 <gs>', 'gs:// haplotype-2 assembly FASTA')
2511
+ .option('--ref <build>', 'Reference: CHM13 | GRCh38 | auto', 'auto')
2512
+ .option('--json', 'Output as JSON')
2513
+ .action(async (serial, options) => {
2514
+ try {
2515
+ await (0, submit_16.dipcallSubmitCommand)(serial, options);
2516
+ }
2517
+ catch (error) {
2518
+ logger_1.Logger.error(`dipcall submit failed: ${error}`);
2519
+ process.exit(1);
2520
+ }
2521
+ });
2522
+ dipcallCmd.command('exec')
2523
+ .description('VM-side executor: dipcall over the staged diploid assembly + reference, persist dip VCF + confident BED to GCS')
2524
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2525
+ .requiredOption('--hap1 <gs>', 'gs:// haplotype-1 assembly FASTA')
2526
+ .requiredOption('--hap2 <gs>', 'gs:// haplotype-2 assembly FASTA')
2527
+ .option('--ref <build>', 'Reference build', 'auto')
2528
+ .option('--job-id <id>', 'Job id')
2529
+ .option('--batch-id <id>', 'Batch id')
2530
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2531
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2532
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2533
+ .action(async (options) => {
2534
+ try {
2535
+ await (0, exec_14.dipcallExecCommand)(options);
2536
+ }
2537
+ catch (error) {
2538
+ logger_1.Logger.error(`dipcall exec failed: ${error}`);
2539
+ process.exit(1);
2540
+ }
2541
+ });
2542
+ // HiFi-align command group — PacBio HiFi read alignment (pbmm2, MM/ML preserved) — the keystone
2543
+ const hifiAlignCmd = program
2544
+ .command('hifi-align')
2545
+ .description('PacBio HiFi read alignment (pbmm2 HIFI, 5mC tags preserved): submit (client) + exec (VM runner)');
2546
+ hifiAlignCmd
2547
+ .command('submit <serial>', { isDefault: true })
2548
+ .description('Submit a HiFi alignment job to biofs-node (pbmm2 per-cell + merge, persist aligned BAM)')
2549
+ .requiredOption('--bams <csv>', 'CSV of gs:// unaligned HiFi BAM URIs (carry MM/ML 5mC tags)')
2550
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2551
+ .option('--json', 'Output as JSON')
2552
+ .action(async (serial, options) => {
2553
+ try {
2554
+ await (0, submit_10.hifiAlignSubmitCommand)(serial, options);
2555
+ }
2556
+ catch (error) {
2557
+ logger_1.Logger.error(`hifi-align submit failed: ${error}`);
2558
+ process.exit(1);
2559
+ }
2560
+ });
2561
+ hifiAlignCmd
2562
+ .command('exec')
2563
+ .description('VM-side executor: pbmm2 align each HiFi cell (HIFI preset) + merge, persist aligned BAM to GCS')
2564
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2565
+ .requiredOption('--bams <csv>', 'CSV of gs:// unaligned HiFi BAM URIs')
2566
+ .option('--ref <build>', 'Reference build', 'auto')
2567
+ .option('--job-id <id>', 'Job id')
2568
+ .option('--batch-id <id>', 'Batch id')
2569
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2570
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2571
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2572
+ .action(async (options) => {
2573
+ try {
2574
+ await (0, exec_8.hifiAlignExecCommand)(options);
2575
+ }
2576
+ catch (error) {
2577
+ logger_1.Logger.error(`hifi-align exec failed: ${error}`);
2578
+ process.exit(1);
2579
+ }
2580
+ });
2581
+ // ---- downstream verbs the hifi-align keystone unblocks (M3/M4/M5/M9) ----
2582
+ // pbsv — HiFi read-based structural variants
2583
+ const pbsvCmd = program.command('pbsv').description('HiFi read-based structural-variant calling (pbsv): submit (client) + exec (VM runner)');
2584
+ pbsvCmd.command('submit <serial>', { isDefault: true })
2585
+ .description('Submit a HiFi pbsv SV-calling job to biofs-node (pbsv over the aligned HiFi BAM)')
2586
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM (the pbsv-calling input)')
2587
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2588
+ .option('--json', 'Output as JSON')
2589
+ .action(async (serial, options) => {
2590
+ try {
2591
+ await (0, submit_11.pbsvSubmitCommand)(serial, options);
2592
+ }
2593
+ catch (error) {
2594
+ logger_1.Logger.error(`pbsv submit failed: ${error}`);
2595
+ process.exit(1);
2596
+ }
2597
+ });
2598
+ pbsvCmd.command('exec')
2599
+ .description('VM-side executor: pbsv discover+call over the gcsfuse-mounted HiFi BAM, persist SV VCF to GCS')
2600
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2601
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2602
+ .option('--ref <build>', 'Reference build', 'auto')
2603
+ .option('--job-id <id>', 'Job id').option('--batch-id <id>', 'Batch id')
2604
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2605
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2606
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2607
+ .action(async (options) => {
2608
+ try {
2609
+ await (0, exec_9.pbsvExecCommand)(options);
2610
+ }
2611
+ catch (error) {
2612
+ logger_1.Logger.error(`pbsv exec failed: ${error}`);
2613
+ process.exit(1);
2614
+ }
2615
+ });
2616
+ // repeat-genotype — tandem-repeat / repeat-expansion genotyping (TRGT)
2617
+ const repeatCmd = program.command('repeat-genotype').description('Tandem-repeat / repeat-expansion genotyping (TRGT): submit (client) + exec (VM runner)');
2618
+ repeatCmd.command('submit <serial>', { isDefault: true })
2619
+ .description('Submit a TRGT repeat-genotyping job to biofs-node (aligned HiFi BAM + repeat catalog)')
2620
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM (the genotyping input)')
2621
+ .requiredOption('--catalog <gs>', 'gs:// repeat catalog BED (repeat definitions)')
2622
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2623
+ .option('--json', 'Output as JSON')
2624
+ .action(async (serial, options) => {
2625
+ try {
2626
+ await (0, submit_12.repeatGenotypeSubmitCommand)(serial, options);
2627
+ }
2628
+ catch (error) {
2629
+ logger_1.Logger.error(`repeat-genotype submit failed: ${error}`);
2630
+ process.exit(1);
2631
+ }
2632
+ });
2633
+ repeatCmd.command('exec')
2634
+ .description('VM-side executor: TRGT genotype over the gcsfuse-mounted HiFi BAM + catalog, persist repeat VCF')
2635
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2636
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2637
+ .requiredOption('--catalog <gs>', 'gs:// repeat catalog BED')
2638
+ .option('--ref <build>', 'Reference build', 'auto')
2639
+ .option('--job-id <id>', 'Job id').option('--batch-id <id>', 'Batch id')
2640
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2641
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2642
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2643
+ .action(async (options) => {
2644
+ try {
2645
+ await (0, exec_10.repeatGenotypeExecCommand)(options);
2646
+ }
2647
+ catch (error) {
2648
+ logger_1.Logger.error(`repeat-genotype exec failed: ${error}`);
2649
+ process.exit(1);
2650
+ }
2651
+ });
2652
+ // phase — genome-wide read-backed phasing (HiPhase)
2653
+ const phaseCmd = program.command('phase').description('Genome-wide read-backed phasing (HiPhase): submit (client) + exec (VM runner)');
2654
+ phaseCmd.command('submit <serial>', { isDefault: true })
2655
+ .description('Submit a HiPhase phasing job to biofs-node (aligned HiFi BAM + small-variant VCF)')
2656
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2657
+ .requiredOption('--vcf <gs>', 'gs:// small-variant VCF to phase')
2658
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2659
+ .option('--json', 'Output as JSON')
2660
+ .action(async (serial, options) => {
2661
+ try {
2662
+ await (0, submit_13.phaseSubmitCommand)(serial, options);
2663
+ }
2664
+ catch (error) {
2665
+ logger_1.Logger.error(`phase submit failed: ${error}`);
2666
+ process.exit(1);
2667
+ }
2668
+ });
2669
+ phaseCmd.command('exec')
2670
+ .description('VM-side executor: HiPhase over the gcsfuse-mounted HiFi BAM + VCF, persist phased VCF + haplotagged BAM')
2671
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2672
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2673
+ .requiredOption('--vcf <gs>', 'gs:// small-variant VCF')
2674
+ .option('--ref <build>', 'Reference build', 'auto')
2675
+ .option('--job-id <id>', 'Job id').option('--batch-id <id>', 'Batch id')
2676
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2677
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2678
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2679
+ .action(async (options) => {
2680
+ try {
2681
+ await (0, exec_11.phaseExecCommand)(options);
2682
+ }
2683
+ catch (error) {
2684
+ logger_1.Logger.error(`phase exec failed: ${error}`);
2685
+ process.exit(1);
2686
+ }
2687
+ });
2688
+ // hifi-methyl — orthogonal HiFi 5mC methylome (pb-CpG-tools)
2689
+ const hifiMethylCmd = program.command('hifi-methyl').description('Orthogonal HiFi 5mC methylome (pb-CpG-tools): submit (client) + exec (VM runner)');
2690
+ hifiMethylCmd.command('submit <serial>', { isDefault: true })
2691
+ .description('Submit a pb-CpG-tools HiFi methylome job to biofs-node (aligned HiFi BAM with MM/ML tags)')
2692
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM carrying MM/ML 5mC tags')
2693
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2694
+ .option('--json', 'Output as JSON')
2695
+ .action(async (serial, options) => {
2696
+ try {
2697
+ await (0, submit_17.hifiMethylSubmitCommand)(serial, options);
2698
+ }
2699
+ catch (error) {
2700
+ logger_1.Logger.error(`hifi-methyl submit failed: ${error}`);
2701
+ process.exit(1);
2702
+ }
2703
+ });
2704
+ hifiMethylCmd.command('exec')
2705
+ .description('VM-side executor: pb-CpG-tools over the gcsfuse-mounted HiFi BAM, persist 5mCG bedMethyl')
2706
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2707
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2708
+ .option('--ref <build>', 'Reference build', 'auto')
2709
+ .option('--job-id <id>', 'Job id').option('--batch-id <id>', 'Batch id')
2710
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2711
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2712
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2713
+ .action(async (options) => {
2714
+ try {
2715
+ await (0, exec_15.hifiMethylExecCommand)(options);
2716
+ }
2717
+ catch (error) {
2718
+ logger_1.Logger.error(`hifi-methyl exec failed: ${error}`);
2719
+ process.exit(1);
2720
+ }
2721
+ });
2722
+ const jobCmd = program
2723
+ .command('job')
2724
+ .description('Manage research jobs (BioOS)');
2725
+ // job create
2726
+ jobCmd
2727
+ .command('create <prompt> <file>')
2728
+ .description('Create a research job from natural language prompt')
2729
+ .option('--pipeline <template>', 'Use predefined pipeline template')
2730
+ .option('--json', 'Output as JSON')
2731
+ .action(async (prompt, fileRef, options) => {
2732
+ try {
2733
+ await (0, create_1.jobCreateCommand)(prompt, fileRef, options);
2734
+ }
2735
+ catch (error) {
2736
+ logger_1.Logger.error(`Job creation failed: ${error}`);
2737
+ process.exit(1);
2738
+ }
2739
+ });
2740
+ // job status
2741
+ jobCmd
2742
+ .command('status <job_id>')
2743
+ .description('Check job execution status')
2744
+ .option('--json', 'Output as JSON')
2745
+ .option('--watch', 'Watch mode (refresh every 5 seconds)')
2746
+ .action(async (jobId, options) => {
2747
+ try {
2748
+ await (0, status_4.jobStatusCommand)(jobId, options);
2749
+ }
2750
+ catch (error) {
2751
+ logger_1.Logger.error(`Status check failed: ${error}`);
2752
+ process.exit(1);
2753
+ }
2754
+ });
2755
+ // job results
2756
+ jobCmd
2757
+ .command('results <job_id>')
2758
+ .description('Get job results with download URLs')
2759
+ .option('--json', 'Output as JSON')
2760
+ .option('--step <number>', 'Download specific step only', parseInt)
2761
+ .action(async (jobId, options) => {
2762
+ try {
2763
+ await (0, results_1.jobResultsCommand)(jobId, options);
2764
+ }
2765
+ catch (error) {
2766
+ logger_1.Logger.error(`Failed to get results: ${error}`);
2767
+ process.exit(1);
2768
+ }
2769
+ });
2770
+ // job list
2771
+ jobCmd
2772
+ .command('list')
2773
+ .description('List all your research jobs')
2774
+ .option('--json', 'Output as JSON')
2775
+ .option('--status <status>', 'Filter by status (pending, running, completed, failed)')
2776
+ .option('--limit <number>', 'Limit number of results', parseInt)
2777
+ .action(async (options) => {
2778
+ try {
2779
+ await (0, list_3.jobListCommand)(options);
2780
+ }
2781
+ catch (error) {
2782
+ logger_1.Logger.error(`Failed to list jobs: ${error}`);
2783
+ process.exit(1);
2784
+ }
2785
+ });
2786
+ // job pipelines
2787
+ jobCmd
2788
+ .command('pipelines')
2789
+ .alias('templates')
2790
+ .description('List available pipeline templates')
2791
+ .option('--json', 'Output as JSON')
2792
+ .action(async (options) => {
2793
+ try {
2794
+ await (0, pipelines_1.pipelinesCommand)(options);
2795
+ }
2796
+ catch (error) {
2797
+ logger_1.Logger.error(`Failed to list pipelines: ${error}`);
2798
+ process.exit(1);
2799
+ }
2800
+ });
2801
+ // job submit-clara - Submit Clara Parabricks FASTQ→VCF job
2802
+ jobCmd
2803
+ .command('submit-clara <biosample_id> [fastq_r1] [fastq_r2]')
2804
+ .description('Submit Clara Parabricks GPU variant calling job (FASTQ → VCF)\nAuto-discovers FASTQ files from consent if not specified')
2805
+ .option('--job-id <id>', 'Custom job ID (default: auto-generated UUID)')
2806
+ .option('--reference <genome>', 'Reference genome (default: hg38)')
2807
+ .option('--capture-kit <kit>', 'Capture kit name (default: agilent_v8)')
2808
+ .option('--sequencing-type <type>', 'Sequencing type: WES or WGS (default: WES)')
2809
+ .option('--interval-file <path>', 'BED file path for targeted sequencing')
2810
+ .option('--json', 'Output as JSON')
2811
+ .action(async (biosampleId, fastqR1, fastqR2, options) => {
2812
+ try {
2813
+ await (0, submit_clara_1.submitClaraCommand)(biosampleId, fastqR1, fastqR2, options);
2814
+ }
2815
+ catch (error) {
2816
+ logger_1.Logger.error(`Clara job submission failed: ${error}`);
2817
+ process.exit(1);
2818
+ }
2819
+ });
2820
+ // job recall - Naive DeepVariant from pre-aligned BAM (no kit restriction)
2821
+ jobCmd
2822
+ .command('recall <sample_id>')
2823
+ .description('Run naive (no-kit) DeepVariant from a BAM already on the GPU VM')
2824
+ .requiredOption('--bam <vm_path>', 'BAM path on GPU VM (host path, e.g. /home/ubuntu/data/output/A014/A014.bam)')
2825
+ .option('--json', 'Output as JSON')
2826
+ .action(async (sampleId, options) => {
2827
+ try {
2828
+ await (0, recall_1.recallCommand)(sampleId, options);
2829
+ }
2830
+ catch (error) {
2831
+ logger_1.Logger.error(`Recall failed: ${error}`);
2832
+ process.exit(1);
2833
+ }
2834
+ });
2835
+ // job reconcile - Mark stale clara_jobs (processing/queued) as failed
2836
+ jobCmd
2837
+ .command('reconcile')
2838
+ .description('Mark stale clara_jobs (processing/queued past N hours) as failed — admin only. Required cleanup after GPU spot preemption before launching a fresh cohort-pipeline.')
2839
+ .option('--older-than <hours>', 'Threshold in hours (default 12)', '12')
2840
+ .option('--statuses <csv>', 'Comma-separated statuses to reconcile (default processing,queued)', 'processing,queued')
2841
+ .option('--json', 'Output as JSON')
2842
+ .action(async (options) => {
2843
+ try {
2844
+ await (0, reconcile_1.jobReconcileCommand)(options);
2845
+ }
2846
+ catch (error) {
2847
+ logger_1.Logger.error(`job reconcile failed: ${error}`);
2848
+ process.exit(1);
2849
+ }
2850
+ });
2851
+ // Agent Health - Check processing agent readiness
2852
+ program
2853
+ .command('agent-health')
2854
+ .alias('health')
2855
+ .description('Check if GPU processing agent is ready to receive jobs')
2856
+ .option('--json', 'Output as JSON')
2857
+ .option('--verbose', 'Show detailed server information')
2858
+ .action(async (options) => {
2859
+ try {
2860
+ await (0, health_1.agentHealthCommand)(options);
2861
+ }
2862
+ catch (error) {
2863
+ logger_1.Logger.error(`Health check failed: ${error}`);
2864
+ process.exit(1);
2865
+ }
2866
+ });
2867
+ // Researcher registration and identity (multi-provider social + MetaMask)
2868
+ const researcherCmd = program
2869
+ .command('researcher')
2870
+ .description('Researcher identity — register via ORCID, Google, LinkedIn, Twitter, Apple, or MetaMask');
2871
+ researcherCmd
2872
+ .command('register')
2873
+ .description('Register as a researcher (opens browser for social or MetaMask sign-in)')
2874
+ .option('--port <number>', 'Callback server port', parseInt)
2875
+ .option('--no-browser', "Don't auto-open browser (headless mode)")
2876
+ .option('--timeout <seconds>', 'Auth timeout in seconds', parseInt)
2877
+ .option('--provider <provider>', 'Force a specific provider (orcid, google, linkedin, twitter, apple, metamask)')
2878
+ .action(async (options) => {
2879
+ try {
2880
+ await (0, register_2.researcherRegisterCommand)(options);
2881
+ }
2882
+ catch (error) {
2883
+ logger_1.Logger.error(`Researcher registration failed: ${error}`);
2884
+ process.exit(1);
2885
+ }
2886
+ });
2887
+ researcherCmd
2888
+ .command('status')
2889
+ .description('Show your researcher profile and credentials')
2890
+ .option('--json', 'Output as JSON')
2891
+ .option('--refresh', 'Refresh profile from server')
2892
+ .action(async (options) => {
2893
+ try {
2894
+ await (0, status_9.researcherStatusCommand)(options);
2895
+ }
2896
+ catch (error) {
2897
+ logger_1.Logger.error(`Researcher status failed: ${error}`);
2898
+ process.exit(1);
2899
+ }
2900
+ });
2901
+ researcherCmd
2902
+ .command('passport')
2903
+ .description('Publish or show known-identity passport (shown on Biodata Room admit / Telegram)')
2904
+ .option('--publish', 'Publish/update passport on biofs-node (default if no --show)')
2905
+ .option('--show', 'Show passport for a wallet')
2906
+ .option('--name <name>', 'Display name')
2907
+ .option('--provider <provider>', 'orcid|linkedin|twitter|google|metamask|…')
2908
+ .option('--orcid <id>', 'ORCID iD')
2909
+ .option('--linkedin <url>', 'LinkedIn profile URL')
2910
+ .option('--twitter <handle>', 'X / Twitter handle')
2911
+ .option('--institution <name>', 'Institution')
2912
+ .option('--ga4gh <level>', 'NONE|BASIC|LITE|FULL', 'BASIC')
2913
+ .option('--wallet <addr>', 'Wallet for --show')
2914
+ .option('--json', 'JSON output')
2915
+ .option('--quiet', 'Quiet')
2916
+ .action(async (options) => {
2917
+ try {
2918
+ if (options.show || options.wallet) {
2919
+ await (0, passport_1.researcherPassportShowCommand)(options);
2920
+ }
2921
+ else {
2922
+ await (0, passport_1.researcherPassportPublishCommand)(options);
2923
+ }
2924
+ }
2925
+ catch (error) {
2926
+ logger_1.Logger.error(`Passport failed: ${error}`);
2927
+ process.exit(1);
2928
+ }
2929
+ });
2930
+ // Lab Registry - List approved research labs
2931
+ program
2932
+ .command('labnfts')
2933
+ .alias('labs')
2934
+ .description('List approved research labs authorized to receive BioNFT-licensed data')
2935
+ .option('--filter <specialization>', 'Filter by lab specialization (e.g., cancer, rare-disease)')
2936
+ .option('--location <location>', 'Filter by location')
2937
+ .option('--json', 'Output as JSON')
2938
+ .option('--verbose', 'Show detailed lab information')
2939
+ .action(async (options) => {
2940
+ try {
2941
+ await (0, list_5.labNFTsCommand)(options);
2942
+ }
2943
+ catch (error) {
2944
+ logger_1.Logger.error(`Failed to fetch labs: ${error}`);
2945
+ process.exit(1);
2946
+ }
2947
+ });
2948
+ // Lab — single-lab operations (refresh-coverage, future: backfill, audit)
2949
+ // Distinct from the read-only `labnfts` (plural) registry-listing command above.
2950
+ const labCmd = program
2951
+ .command('lab')
2952
+ .description('Single-lab operations (refresh-coverage, audit, backfill)');
2953
+ labCmd
2954
+ .command('refresh-coverage')
2955
+ .description('Stream higher-coverage FASTQ replacements from a lab S3 origin into the GCS mirror, supersede stale inventory rows, optionally invalidate downstream pipeline outputs')
2956
+ .requiredOption('--lab <name>', 'Lab name (e.g. augenomics, tecbase)')
2957
+ .requiredOption('--source <s3_uri>', 'S3 source prefix (e.g. s3://genobank/Demux/20240412_ExomeGB_ExtraReadsCombined)')
2958
+ .option('--aws-profile <profile>', 'AWS profile name for the source bucket (server-side)', 'augenomics')
2959
+ .option('--serials <csv>', 'Comma-separated biosample serials to upgrade (with or without lab FR prefix)')
2960
+ .option('--serials-file <path>', 'Newline-separated serials file (alternative to --serials)')
2961
+ .option('--invalidate-downstream', 'Mark prior BAM/VCF/sqlite as SUPERSEDED so the pipeline re-runs with the deeper FASTQs')
2962
+ .option('--re-run-pipeline', 'After refresh, queue `biofs pipeline run-wes` for each upgraded serial')
2963
+ .option('--dry-run', 'Print plan + byte deltas, do not stream')
2964
+ .option('--wait', 'Poll until job terminal (done|failed); 90-min ceiling')
2965
+ .option('--quiet', 'Suppress progress output')
2966
+ .option('--json', 'JSON output')
2967
+ .action(async (options) => {
2968
+ try {
2969
+ await (0, refreshCoverage_1.labRefreshCoverageCommand)(options);
2970
+ }
2971
+ catch (error) {
2972
+ logger_1.Logger.error(`refresh-coverage failed: ${error}`);
2973
+ process.exit(1);
2974
+ }
2975
+ });
2976
+ labCmd
2977
+ .command('refresh-coverage-status <job_id>')
2978
+ .description('Show progress of a refresh-coverage job')
2979
+ .option('--json', 'JSON output')
2980
+ .action(async (jobId, options) => {
2981
+ try {
2982
+ await (0, refreshCoverage_1.labRefreshCoverageStatusCommand)(jobId, options);
2983
+ }
2984
+ catch (error) {
2985
+ logger_1.Logger.error(`status failed: ${error}`);
2986
+ process.exit(1);
2987
+ }
2988
+ });
2989
+ // Share - GDPR-compliant sharing with dual NFT minting
2990
+ program
2991
+ .command('share <biocid_or_filename>')
2992
+ .description('Share biofile with approved lab (auto-detects existing tokenization)')
2993
+ .requiredOption('--lab <wallet_address>', 'Lab wallet address (use "biofs labnfts" to list approved labs)')
2994
+ .option('--license <type>', 'License type: non-commercial (default), commercial, commercial-remix', 'non-commercial')
2995
+ .option('--verbose', 'Show detailed progress')
2996
+ .option('--debug', 'Show debug information')
2997
+ .action(async (biocidOrFilename, options) => {
2998
+ try {
2999
+ await (0, share_1.shareCommand)(biocidOrFilename, options);
3000
+ }
3001
+ catch (error) {
3002
+ logger_1.Logger.error(`Share failed: ${error}`);
3003
+ process.exit(1);
3004
+ }
3005
+ });
3006
+ // Shares - View permission graph (who has access to what)
3007
+ program
3008
+ .command('shares')
3009
+ .description('View BioNFT permission graph (files shared with you and by you)')
3010
+ .option('--json', 'Output as JSON')
3011
+ .option('--graphql', 'Show GraphQL schema and sample queries')
3012
+ .option('--verbose', 'Show detailed information')
3013
+ .action(async (options) => {
3014
+ try {
3015
+ await (0, shares_1.sharesCommand)(options);
3016
+ }
3017
+ catch (error) {
3018
+ logger_1.Logger.error(`Failed to build permission graph: ${error}`);
3019
+ process.exit(1);
3020
+ }
3021
+ });
3022
+ // Verify - DNA fingerprint verification
3023
+ program
3024
+ .command('verify <biocid_or_filename> <local_file>')
3025
+ .description('Verify file integrity using DNA fingerprint (Bloom filter)')
3026
+ .option('--verbose', 'Show detailed information')
3027
+ .option('--json', 'Output as JSON')
3028
+ .action(async (biocidOrFilename, localFile, options) => {
3029
+ try {
3030
+ await (0, verify_2.verifyCommand)(biocidOrFilename, localFile, options);
3031
+ }
3032
+ catch (error) {
3033
+ logger_1.Logger.error(`Verification failed: ${error}`);
3034
+ process.exit(1);
3035
+ }
3036
+ });
3037
+ // RRM-consensus — pre-compute Cosic characteristic frequency f_c from a
3038
+ // gene's functional family for downstream f_c-based variant scoring.
3039
+ program
3040
+ .command('rrm-consensus <gene>')
3041
+ .description('Compute Cosic-RRM characteristic frequency f_c via cross-spectrum of a gene\'s functional family')
3042
+ .option('--source <family|orthologs>', 'Sequence source: Pfam family (default) or same-name orthologs', 'family')
3043
+ .option('--taxonomy <id>', 'NCBI taxonomy id (default 7742 = Vertebrata)', '7742')
3044
+ .option('--no-reviewed', 'Include TrEMBL entries (default: Swiss-Prot reviewed only)')
3045
+ .option('--max <N>', 'Max sequences to pull (default 100)', '100')
3046
+ .option('--uniprot <acc>', 'Override UniProt accession (for novel genes)')
3047
+ .option('--pfam <id>', 'Override Pfam family (for novel genes)')
3048
+ .option('--refresh', 'Re-fetch and recompute even if cached')
3049
+ .option('--plot <path>', 'Render consensus spectrum to PNG with f_c annotated')
3050
+ .option('--quiet', 'Suppress progress output')
3051
+ .action(async (gene, options) => {
3052
+ try {
3053
+ await (0, rrm_consensus_1.rrmConsensusCommand)(gene, options);
3054
+ }
3055
+ catch (error) {
3056
+ logger_1.Logger.error(`RRM consensus failed: ${error}`);
3057
+ process.exit(1);
3058
+ }
3059
+ });
3060
+ // PSM-consensus — Piezoelectric Signal Model: same cross-spectrum maths as
3061
+ // rrm-consensus, but with side-chain dipole moment (Debye) replacing EIIP.
3062
+ // Tests the hypothesis that the piezoelectric encoding picks up
3063
+ // electromechanical resonances that the electron-donor EIIP table misses,
3064
+ // especially in ion channels, transporters, and force sensors.
3065
+ program
3066
+ .command('psm-consensus <gene>')
3067
+ .description('Piezoelectric Signal Model: characteristic frequency f_c via side-chain-dipole cross-spectrum')
3068
+ .option('--source <family|orthologs>', 'Sequence source: Pfam family (default) or same-name orthologs', 'family')
3069
+ .option('--taxonomy <id>', 'NCBI taxonomy id (default 7742 = Vertebrata)', '7742')
3070
+ .option('--no-reviewed', 'Include TrEMBL entries (default: Swiss-Prot reviewed only)')
3071
+ .option('--max <N>', 'Max sequences to pull (default 100)', '100')
3072
+ .option('--uniprot <acc>', 'Override UniProt accession (for novel genes)')
3073
+ .option('--pfam <id>', 'Override Pfam family (for novel genes)')
3074
+ .option('--refresh', 'Re-fetch and recompute even if cached')
3075
+ .option('--plot <path>', 'Render PSM spectrum to PNG with f_c annotated')
3076
+ .option('--quiet', 'Suppress progress output')
3077
+ .action(async (gene, options) => {
3078
+ try {
3079
+ await (0, psm_consensus_1.psmConsensusCommand)(gene, options);
3080
+ }
3081
+ catch (error) {
3082
+ logger_1.Logger.error(`PSM consensus failed: ${error}`);
3083
+ process.exit(1);
3084
+ }
3085
+ });
3086
+ // Wavelet-consensus — 2-D (position by scale) Morlet CWT consensus map for a
3087
+ // gene's functional family. Spatial-spectral generalization of rrm-consensus.
3088
+ // Addresses the v1 paper auditor's third upgrade point: localize variants at
3089
+ // position and scale jointly rather than at a single fixed window size.
3090
+ program
3091
+ .command('wavelet-consensus <gene>')
3092
+ .description('Morlet continuous wavelet transform consensus map (position by scale) for a gene family')
3093
+ .option('--source <family|orthologs>', 'Sequence source (default orthologs)', 'orthologs')
3094
+ .option('--taxonomy <id>', 'NCBI taxonomy id', '7742')
3095
+ .option('--no-reviewed', 'Include TrEMBL (default Swiss-Prot only)')
3096
+ .option('--max <N>', 'Max sequences', '100')
3097
+ .option('--uniprot <acc>', 'Override UniProt accession')
3098
+ .option('--pfam <id>', 'Override Pfam family')
3099
+ .option('--encoding <eiip|piezo>', 'Per-residue index (default eiip)', 'eiip')
3100
+ .option('--scales <list>', 'Comma scales in aa (default 2,3,4,6,8,12,16,24,32,48,64,96)')
3101
+ .option('--refresh', 'Re-fetch + recompute')
3102
+ .option('--quiet', 'Suppress progress')
3103
+ .action(async (gene, options) => {
3104
+ try {
3105
+ await (0, wavelet_consensus_1.waveletConsensusCommand)(gene, options);
3106
+ }
3107
+ catch (error) {
3108
+ logger_1.Logger.error(`wavelet-consensus failed: ${error?.message || error}`);
3109
+ process.exit(1);
3110
+ }
3111
+ });
3112
+ // Score-protein — the Super-SCDS Phase A.2 canonical scoring verb. For one
3113
+ // UniProt accession, fetch FASTA, load cached RRM/PSM consensuses, compute
3114
+ // the SCDS family per missense variant, upsert into MongoDB collections
3115
+ // scds_consensuses + scds_variants via /api_scds/upsert_protein on prod.
3116
+ program
3117
+ .command('score-protein <uniprot>')
3118
+ .description('Super-SCDS Phase A.2: score one UniProt protein and upsert into scds_consensuses + scds_variants')
3119
+ .option('--gene-symbol <symbol>', 'Gene symbol (e.g., BRCA1) used as a fallback consensus-cache key')
3120
+ .option('--source <family|orthologs|trembl>', 'Family source for consensus (default: family)', 'family')
3121
+ .option('--taxonomy <id>', 'NCBI taxonomy id (default 7742 = Vertebrata)', '7742')
3122
+ .option('--pfam <id>', 'Override Pfam family')
3123
+ .option('--api-base <url>', 'GenoBank API base (default https://genobank.app)')
3124
+ .option('--dry-run', 'Compute and emit the payload, do not POST')
3125
+ .option('--skip-mongo-upsert', 'Compute the full payload but skip the API call (alias for --dry-run + no stdout)')
3126
+ .option('--output <path>', 'Write the payload to a JSON file')
3127
+ .option('--quiet', 'Suppress progress')
3128
+ .action(async (uniprot, options) => {
3129
+ try {
3130
+ await (0, score_protein_1.scoreProteinCommand)(uniprot, options);
3131
+ }
3132
+ catch (error) {
3133
+ logger_1.Logger.error(`score-protein failed: ${error?.message || error}`);
3134
+ process.exit(1);
3135
+ }
3136
+ });
3137
+ // Inventory subcommand: register-sqlite (closes v2 audit gap §5 item 2).
3138
+ program
3139
+ .command('inventory-register-sqlite <sqlite-path>')
3140
+ .description('Register an externally-produced OpenCRAVAT annotation sqlite into bioroutes.inventory (v3.8.0 endpoint)')
3141
+ .requiredOption('--sample-serial <serial>', 'Biosample serial identifier (14-digit or lab-case-id form)')
3142
+ .option('--owner-wallet <addr>', 'Override owner biowallet (default: from `biofs login`)')
3143
+ .option('--case-id <id>', 'Optional lab case identifier (e.g., TN25-336147)')
3144
+ .option('--gcs-uri <uri>', 'Optional GCS URI if the sqlite is also stored in GCS')
3145
+ .option('--originlab <name>', 'Source lab name (e.g., caris, augenomics, genobank)', 'genobank')
3146
+ .option('--api-base <url>', 'GenoBank API base (default https://genobank.app)')
3147
+ .option('--dry-run', 'Compute and print the registration payload without calling the API')
3148
+ .option('--output <path>', 'Write the registration payload to a JSON file')
3149
+ .option('--quiet', 'Suppress progress')
3150
+ .action(async (sqlitePath, options) => {
3151
+ try {
3152
+ await (0, inventory_register_sqlite_1.inventoryRegisterSqliteCommand)(sqlitePath, options);
3153
+ }
3154
+ catch (error) {
3155
+ logger_1.Logger.error(`inventory-register-sqlite failed: ${error?.message || error}`);
3156
+ process.exit(1);
3157
+ }
3158
+ });
3159
+ // Ingest rna-tpm — canonical wrapper for RNA TPM CSV ingestion (closes v2 audit
3160
+ // gap §5 item 4).
3161
+ program
3162
+ .command('ingest-rna-tpm <case-id>')
3163
+ .description('Ingest a gene-level RNA TPM CSV into the caris_rna_tpm MongoDB collection (v3.8.0 endpoint)')
3164
+ .option('--biocid <id>', 'BioRouter biocid pointing to the RNA TPM CSV')
3165
+ .option('--gcs-path <uri>', 'GCS URI of the RNA TPM CSV (if biocid is not yet registered)')
3166
+ .option('--owner-wallet <addr>', 'Override owner biowallet (default: from `biofs login`)')
3167
+ .option('--source-lab <name>', 'Source lab (e.g., caris, augenomics)', 'unknown')
3168
+ .option('--data-category <type>', 'Data category tag (default rna)', 'rna')
3169
+ .option('--expected-columns <list>', 'CSV column names', 'Gene,TPM,NumReads')
3170
+ .option('--no-drop-zero-tpm', 'Keep zero-TPM rows (default drops them)')
3171
+ .option('--api-base <url>', 'GenoBank API base (default https://genobank.app)')
3172
+ .option('--dry-run', 'Compute and print the ingest payload without calling the API')
3173
+ .option('--quiet', 'Suppress progress')
3174
+ .action(async (caseId, options) => {
3175
+ try {
3176
+ await (0, ingest_rna_tpm_1.ingestRnaTpmCommand)(caseId, options);
3177
+ }
3178
+ catch (error) {
3179
+ logger_1.Logger.error(`ingest-rna-tpm failed: ${error?.message || error}`);
3180
+ process.exit(1);
3181
+ }
3182
+ });
3183
+ // Tokenize-spectrum — emit LLM-friendly POS_NNNN__FREQ_F.FF__E_BINxx__P_BINxx
3184
+ // tokens from a cached wavelet consensus (v3.8.0 roadmap item P2). Designed
3185
+ // for autonomous-agent consumption on Claude / GPT / Llama. Reversibility via
3186
+ // regex r"POS_(\d+)" on any flagged token.
3187
+ program
3188
+ .command('tokenize-spectrum <gene>')
3189
+ .description('Emit LLM-friendly discrete spectral tokens for a gene with optional variant context')
3190
+ .option('--variant <hgvs>', 'Center the position window on this HGVS variant (e.g. p.Gly12Asp)')
3191
+ .option('--position-window <N>', 'Residues on each side of the variant', '10')
3192
+ .option('--encoding <eiip|piezo>', 'Primary encoding to load (both are included if cached)', 'eiip')
3193
+ .option('--vocab-bins <list>', 'Comma dB cutoffs for the BIN00-BIN06 vocabulary', '0,3,6,10,15,20')
3194
+ .option('--scale-binning <mode>', 'top5 (default), all, or characteristic', 'top5')
3195
+ .option('--format <type>', 'tokens (default plain string) or json', 'tokens')
3196
+ .option('--output <path>', 'Write to file instead of stdout')
3197
+ .option('--quiet', 'Suppress progress')
3198
+ .action(async (gene, options) => {
3199
+ try {
3200
+ await (0, tokenize_spectrum_1.tokenizeSpectrumCommand)(gene, options);
3201
+ }
3202
+ catch (error) {
3203
+ logger_1.Logger.error(`tokenize-spectrum failed: ${error?.message || error}`);
3204
+ process.exit(1);
3205
+ }
3206
+ });
3207
+ // Bode — render log-log |H(jω)| transfer function plots from cached rrm-consensus
3208
+ // and psm-consensus spectra. Single-gene mode (bode <gene>) or panel mode
3209
+ // (bode --panel <list>) for paper figures.
3210
+ program
3211
+ .command('bode [gene]')
3212
+ .description('Log-log Bode plot of protein-family transfer function |H(jω)| from rrm-consensus / psm-consensus caches')
3213
+ .option('--panel <list>', 'Comma gene symbols for multi-gene panel grid')
3214
+ .option('--output <path>', 'Output file path (default ~/.biofs/cache/bode/<gene-or-hash>.png)')
3215
+ .option('--pdf', 'Emit PDF instead of PNG')
3216
+ .option('--rna-tpm <case_id>', 'Pull Caris RNA TPM for the case_id and annotate each gene')
3217
+ .option('--api-base <url>', 'GenoBank API base for RNA TPM lookups (default https://genobank.app)')
3218
+ .option('--no-rrm', 'Suppress RRM (EIIP) curve')
3219
+ .option('--no-psm', 'Suppress PSM (piezo) curve')
3220
+ .option('--cols <N>', 'Panel grid column count (default 3)')
3221
+ .option('--quiet', 'Suppress progress (still prints output path)')
3222
+ .action(async (gene, options) => {
3223
+ try {
3224
+ await (0, bode_1.bodeCommand)(gene, options);
3225
+ }
3226
+ catch (error) {
3227
+ logger_1.Logger.error(`bode failed: ${error?.message || error}`);
3228
+ process.exit(1);
3229
+ }
3230
+ });
3231
+ // Biowallet — mint and manage de-novo EIP-55 custodial biowallets for patients
3232
+ const biowalletCmd = program
3233
+ .command('biowallet')
3234
+ .description('Mint and manage de-novo EIP-55 custodial biowallets that patients can later claim');
3235
+ biowalletCmd
3236
+ .command('create')
3237
+ .description('Mint a fresh EIP-55 biowallet (random keypair, BIP-39 mnemonic, encrypted keystore)')
3238
+ .option('--bind-biosample <serials>', 'Comma-separated biosample serials to bind to the new biowallet')
3239
+ .option('--label <text>', 'Human-readable label (stored locally only, not on-chain)')
3240
+ .option('--password <pw>', 'Keystore password; if omitted, a random one is generated and printed once')
3241
+ .option('--out-dir <path>', 'Alternative output directory (default ~/.biofs/biowallets/)')
3242
+ .option('--no-mnemonic-file', "Don't persist the mnemonic to disk (operator must transcribe at creation)")
3243
+ .option('--json', 'Output as JSON (DANGER: includes secrets)')
3244
+ .option('--quiet', 'Suppress progress output')
3245
+ .action(async (options) => {
3246
+ try {
3247
+ await (0, create_3.biowalletCreateCommand)(options);
3248
+ }
3249
+ catch (error) {
3250
+ logger_1.Logger.error(`Biowallet create failed: ${error}`);
3251
+ process.exit(1);
3252
+ }
3253
+ });
3254
+ biowalletCmd
3255
+ .command('list')
3256
+ .description('List all local biowallets and their bound biosamples')
3257
+ .option('--operator <wallet>', 'Filter by operator wallet address')
3258
+ .option('--status <s>', 'Filter by status (operator-custodial | patient-claimed)')
3259
+ .option('--biosample <serial>', 'Filter to wallets bound to a specific biosample')
3260
+ .option('--short', 'Print addresses only, one per line')
3261
+ .option('--json', 'Output as JSON')
3262
+ .action(async (options) => {
3263
+ try {
3264
+ await (0, list_6.biowalletListCommand)(options);
3265
+ }
3266
+ catch (error) {
3267
+ logger_1.Logger.error(`Biowallet list failed: ${error}`);
3268
+ process.exit(1);
3269
+ }
3270
+ });
3271
+ biowalletCmd
3272
+ .command('bind <address> <biosample>')
3273
+ .description('Bind an existing local biowallet to a biosample serial')
3274
+ .option('--json', 'Output as JSON')
3275
+ .option('--quiet', 'Suppress progress output')
3276
+ .action(async (address, biosample, options) => {
3277
+ try {
3278
+ await (0, bind_1.biowalletBindCommand)(address, biosample, options);
3279
+ }
3280
+ catch (error) {
3281
+ logger_1.Logger.error(`Biowallet bind failed: ${error}`);
3282
+ process.exit(1);
3283
+ }
3284
+ });
3285
+ // Family vault — BIP-32 HD wallet, one mnemonic deriving N child biowallets
3286
+ const familyCmd = biowalletCmd
3287
+ .command('family')
3288
+ .description('Family Vault: one BIP-32 master mnemonic deriving N child biowallets (m/44\'/60\'/0\'/0/index)');
3289
+ familyCmd
3290
+ .command('create')
3291
+ .description('Create a new family vault with optional initial members')
3292
+ .option('--label <text>', 'Human-readable label for the family')
3293
+ .option('--password <pw>', 'Keystore password (random if omitted)')
3294
+ .option('--members <list>', 'Comma-separated initial members in "role:biosample[:label]" format (e.g. mother:56102007614179,father:56102007614180,child:56102007614196,child:56102007614194)')
3295
+ .option('--no-mnemonic-file', "Don't persist the master mnemonic to disk")
3296
+ .option('--json', 'Output as JSON (DANGER: includes master mnemonic)')
3297
+ .option('--quiet', 'Suppress progress output')
3298
+ .action(async (options) => {
3299
+ try {
3300
+ await (0, family_1.familyCreateCommand)(options);
3301
+ }
3302
+ catch (error) {
3303
+ logger_1.Logger.error(`Family create failed: ${error}`);
3304
+ process.exit(1);
3305
+ }
3306
+ });
3307
+ familyCmd
3308
+ .command('derive <family_id> <index>')
3309
+ .description('Derive an additional member at a specific index in an existing family vault')
3310
+ .option('--role <text>', 'Role label (mother, father, child_1, etc.)')
3311
+ .option('--bind-biosample <serials>', 'Comma-separated biosample serials to bind')
3312
+ .option('--label <text>', 'Human-readable label')
3313
+ .option('--json', 'Output as JSON')
3314
+ .option('--quiet', 'Suppress progress output')
3315
+ .action(async (familyId, index, options) => {
3316
+ try {
3317
+ await (0, family_1.familyDeriveCommand)(familyId, index, options);
3318
+ }
3319
+ catch (error) {
3320
+ logger_1.Logger.error(`Family derive failed: ${error}`);
3321
+ process.exit(1);
3322
+ }
3323
+ });
3324
+ familyCmd
3325
+ .command('list [family_id]')
3326
+ .description('List family vaults (and members if a family_id is given)')
3327
+ .option('--json', 'Output as JSON')
3328
+ .action(async (familyId, options) => {
3329
+ try {
3330
+ await (0, family_1.familyListCommand)(familyId, options);
3331
+ }
3332
+ catch (error) {
3333
+ logger_1.Logger.error(`Family list failed: ${error}`);
3334
+ process.exit(1);
3335
+ }
3336
+ });
3337
+ // RRM-distribution — pull ClinVar classified missense for a gene and rank
3338
+ // patient variants against the empirical distribution.
3339
+ program
3340
+ .command('rrm-distribution <gene>')
3341
+ .description('Pull ClinVar classified missense for a gene and compute Cosic-RRM features for each, with optional patient-variant highlight and optional gnomAD pseudo-benign synthesis')
3342
+ .option('--highlight <variants>', 'Comma-separated HGVS protein changes to mark on the distribution (e.g. ITGA2B:p.Val779Ala,ITGA2B:p.Leu225Arg)')
3343
+ .option('--retmax <N>', 'Max ClinVar IDs to pull (default 10000; ClinVar VUS / Conflicting are excluded server-side)', '10000')
3344
+ .option('--gnomad-benigns <N>', 'Synthesize N pseudo-benign control variants from gnomAD common missense (e.g. 40 for rare-disease genes whose ClinVar B+LB is empty)')
3345
+ .option('--gnomad-min-af <af>', 'gnomAD AF threshold for pseudo-benign eligibility (default 0.01)', '0.01')
3346
+ .option('--plot <path>', 'Render 4-panel distribution figure to PNG')
3347
+ .option('--refresh', 'Re-fetch and recompute even if cached')
3348
+ .option('--quiet', 'Suppress progress output')
3349
+ .action(async (gene, options) => {
3350
+ try {
3351
+ await (0, rrm_distribution_1.rrmDistributionCommand)(gene, options);
3352
+ }
3353
+ catch (error) {
3354
+ logger_1.Logger.error(`RRM distribution failed: ${error}`);
3355
+ process.exit(1);
3356
+ }
3357
+ });
3358
+ // Clinical — phenotype-driven multi-exome ACMG classifier for a single proband
3359
+ // (n-of-1 or joint-N exomes from the same individual). Complements `cohort-acmg`
3360
+ // which is batch-mode across many probands but only emits ClinVar P/LP.
3361
+ program
3362
+ .command('clinical <biosample_serial>')
3363
+ .description('Phenotype-driven, multi-exome ACMG/AMP 2015 + ClinGen-SVI 2024 classifier. Provide a primary biosample serial, optional --serials list (joint-N exomes), and phenotype context (--phenotype words OR --hpo codes; --photo optional). Returns P/LP/VUS/LB/B with per-variant evidence stacks. Server-side, NFT-gated, no genomic bytes on laptop.')
3364
+ .option('--serials <list>', 'Comma-separated additional biosample serials for joint analysis (all assumed same individual)')
3365
+ .option('--hpo <codes>', 'Comma-separated HPO codes, e.g. HP:0000924,HP:0002659')
3366
+ .option('--phenotype <text>', 'Free-text phenotype description (mapped to HPO via local HPOA annotations)')
3367
+ .option('--photo <path>', 'Patient photo for Face2Gene-style syndrome prediction (graceful fallback if server lacks API key)')
3368
+ .option('--panel <name>', 'Gene panel name: skeletal_dysplasia (default), or none for HPO-only', 'skeletal_dysplasia')
3369
+ .option('--max-af <af>', 'gnomAD AF ceiling (default 0.01)', '0.01')
3370
+ .option('--output <dir>', 'Output directory (default ./clinical_reports/)')
3371
+ .option('--case-label <label>', 'Privacy-safe label for the case (no proper names per CLAUDE.md). Default proband-<wallet-prefix>.')
3372
+ .option('--format <fmt>', 'json | html | both (default both)', 'both')
3373
+ .option('--quiet', 'Suppress progress output')
3374
+ .option('--debug', 'Print full server response on error')
3375
+ .action(async (biosample, options) => {
3376
+ try {
3377
+ await (0, clinical_1.clinicalCommand)(biosample, options);
3378
+ }
3379
+ catch (error) {
3380
+ logger_1.Logger.error(`clinical failed: ${error}`);
3381
+ process.exit(1);
3382
+ }
3383
+ });
3384
+ // Cohort-pipeline — batch FASTQ→VCF→sqlite→fhir.variant→Digital-Twin via
3385
+ // the canonical biofs-cli + biofs-node + BioRouter + Sequentia protocol.
3386
+ // Each per-serial run is `biofs pipeline run-wes <serial>`; this verb just
3387
+ // fans them out with concurrency control + auto-mints custodial biowallets.
3388
+ program
3389
+ .command('cohort-pipeline')
3390
+ .description('Batch end-to-end pipeline (FASTQ → Clara → CRAVAT → Vault → Digital Twin) across a cohort of biosample serials. Internally fans out `biofs pipeline run-wes <serial>`; auto-mints custodial biowallets for unbound serials via `biofs biowallet create --bind-biosample`. Resume-aware (skips serials already PHASE_RANGE_DONE in bioroutes.pipeline_runs).')
3391
+ .requiredOption('--serials <file>', 'File with one biosample serial per line. Use `biofs inventory cohort` to generate.')
3392
+ .option('--concurrency <N>', 'Number of parallel per-serial pipelines (default 1; max 2 for 2× A100 GPU)', '1')
3393
+ .option('--limit <N>', 'Process at most N serials (0 = all)', '0')
3394
+ .option('--output <dir>', 'Output directory for per-serial result JSONs + cohort summary (default ./cohort_pipeline_runs/<timestamp>/)')
3395
+ .option('--no-skip-existing', 'Re-run serials even if they already have a PHASE_RANGE_DONE pipeline_run')
3396
+ .option('--no-auto-mint-wallets', 'Skip the biowallet pre-mint step (assumes wallets already bound)')
3397
+ .option('--mode <WES|WGS>', 'Override auto-detection of WES vs WGS for the whole cohort')
3398
+ .option('--phase <range>', 'Run a subset of phases per serial (e.g. "1-4", "5-10", "all")')
3399
+ .option('--exclude <csv>', 'Comma-separated serials to skip (e.g. operator\'s own genome, already-ingested samples)')
3400
+ .option('--stop-on-failure <mode>', 'When to halt cohort: "first" (default), "never", or integer N for N consecutive failures', 'first')
3401
+ .option('--dry-run', 'Print what would happen but don\'t execute side-effecting phases')
3402
+ .option('--quiet', 'Suppress per-serial progress')
3403
+ .option('--json', 'Emit machine-readable JSON summary')
3404
+ .action(async (options) => {
3405
+ try {
3406
+ await (0, cohort_pipeline_1.cohortPipelineCommand)(options);
3407
+ }
3408
+ catch (error) {
3409
+ logger_1.Logger.error(`cohort-pipeline failed: ${error}`);
3410
+ process.exit(1);
3411
+ }
3412
+ });
3413
+ // Cohort-acmg — batch ACMG/SVI-compliant processor for an n-of-many cohort
3414
+ program
3415
+ .command('cohort-acmg')
3416
+ .description('Batch process a cohort of biosample serials: mint biowallets (idempotent), extract ClinVar P+LP, apply ACMG-SVI evidence stacks per Section 2.7 of the biofs-rrm paper. Output keyed on biowallet (operator-private serial mapping preserved).')
3417
+ .option('--serials <file>', 'File with one biosample serial per line (required)')
3418
+ .option('--output <dir>', 'Output directory for per-biowallet JSON reports (default ./cohort_acmg_reports/)')
3419
+ .option('--limit <N>', 'Process at most N serials (0 = all)', '0')
3420
+ .option('--skip-existing', 'Skip serials whose per-biowallet report already exists')
3421
+ .option('--quiet', 'Suppress per-proband progress spinners')
3422
+ .action(async (options) => {
3423
+ try {
3424
+ await (0, cohort_acmg_1.cohortAcmgCommand)(options);
3425
+ }
3426
+ catch (error) {
3427
+ logger_1.Logger.error(`cohort-acmg failed: ${error}`);
3428
+ process.exit(1);
3429
+ }
3430
+ });
3431
+ // Cohort-fourier-score — per-patient × per-variant Cosic-RRM spectral scoring,
3432
+ // the missing rung between single-variant `biofs fourier-score` and the
3433
+ // per-gene ClinVar `biofs cohort-train`. Section 14.4 of the biofs-rrm paper
3434
+ // proposes this verb explicitly. Server-side, NFT-gated, gcsfuse-mounted.
3435
+ program
3436
+ .command('cohort-fourier-score')
3437
+ .description('Cohort-scale Cosic-RRM (EIIP + DFT) spectral scoring: for each biosample serial, extract rare missense variants, compute the five Cosic metrics (windowed Σ|ΔF|, windowed ΔE%, full-spectrum L1, f_c ratio, weighted aggregate ΔE%) against the cached family characteristic frequency, return per-biowallet score matrices. Server-side, NFT-gated, zero genomic bytes on laptop.')
3438
+ .option('--serials <file>', 'File with one biosample serial per line (mutually exclusive with --from-acmg)')
3439
+ .option('--from-acmg <path>', 'Recover serials from a prior `biofs cohort-acmg` cohort_summary.json via the operator-private biowallet index (recommended path)')
3440
+ .option('--output <dir>', 'Output directory for per-biowallet JSON reports (default ./cohort_fourier_reports/)')
3441
+ .option('--limit <N>', 'Process at most N serials (0 = all)', '0')
3442
+ .option('--max-af <af>', 'gnomAD AF ceiling for rare-missense filter (default 0.01)', '0.01')
3443
+ .option('--am-threshold <s>', 'AlphaMissense threshold for the --include-high-am rule (default 0.5)', '0.5')
3444
+ .option('--include-vus', 'Also score ClinVar VUS variants (otherwise ClinVar P/LP only)')
3445
+ .option('--include-high-am', 'Also score variants with AlphaMissense ≥ --am-threshold even if absent from ClinVar')
3446
+ .option('--window <N>', 'Window size (residues) for the centered Σ|ΔF| (default 31)')
3447
+ .option('--window-tm <N>', 'Window size for variants in transmembrane regions (default 51)')
3448
+ .option('--skip-existing', 'Skip serials whose per-biowallet report already exists')
3449
+ .option('--quiet', 'Suppress per-proband progress spinners')
3450
+ .action(async (options) => {
3451
+ try {
3452
+ await (0, cohort_fourier_score_1.cohortFourierScoreCommand)(options);
3453
+ }
3454
+ catch (error) {
3455
+ logger_1.Logger.error(`cohort-fourier-score failed: ${error}`);
3456
+ process.exit(1);
3457
+ }
3458
+ });
3459
+ // MyVariant — standalone interface to MyVariant.info v1 API
3460
+ program
3461
+ .command('myvariant [id_or_query]')
3462
+ .description('Query MyVariant.info v1: single variant, batch from file, gene-wide, or raw /query expression')
3463
+ .option('--batch <file>', 'Batch lookup from a file with one ID (HGVS or rsID) per line')
3464
+ .option('--gene <symbol>', 'Fetch variants in a gene via /query (uses dbnsfp/clinvar/snpeff gene_name)')
3465
+ .option('--query', 'Treat the positional argument as a raw /query expression')
3466
+ .option('--fields <list>', 'Comma-separated MyVariant.info field paths (overrides presets)')
3467
+ .option('--predictors', 'Shortcut for AM/REVEL/PrimateAI/EVE/ESM1b/CADD/MetaRNN/BayesDel/ClinPred')
3468
+ .option('--clinical', 'Shortcut for ClinVar/COSMIC/gnomAD/1000G/ExAC/EMV')
3469
+ .option('--basic', 'Shortcut for dbSNP rsID/HGVS/VCF/SnpEff annotations')
3470
+ .option('--all', 'Predictors + clinical + basic')
3471
+ .option('--assembly <hg19|hg38>', 'Assembly for HGVS-coordinate queries (informational)', 'hg38')
3472
+ .option('--limit <N>', 'Max records for /gene or /query mode (default 500 gene, 200 query)')
3473
+ .option('--json', 'Output raw JSON')
3474
+ .option('--csv', 'Output as CSV')
3475
+ .option('--tsv', 'Output as TSV')
3476
+ .option('--out-file <path>', 'Write output to file instead of stdout')
3477
+ .option('--quiet', 'Suppress progress spinner')
3478
+ .action(async (idArg, options) => {
3479
+ try {
3480
+ await (0, myvariant_1.myvariantCommand)(idArg, options);
3481
+ }
3482
+ catch (error) {
3483
+ logger_1.Logger.error(`MyVariant query failed: ${error}`);
3484
+ process.exit(1);
3485
+ }
3486
+ });
3487
+ // Cohort-train — apply the rrm-consensus + rrm-distribution + rrm-train pipeline
3488
+ // across a cohort of disease genes to characterize Cosic-RRM's applicability domain
3489
+ program
3490
+ .command('cohort-train')
3491
+ .description('Multi-gene benchmark: run rrm-consensus + rrm-distribution + rrm-train across a cohort and report per-gene AUC deltas')
3492
+ .option('--genes <list>', 'Comma-separated gene symbols')
3493
+ .option('--gene-file <path>', 'File with one gene symbol per line (lines starting with # are comments)')
3494
+ .option('--min-train <N>', 'Skip genes with fewer than N labeled training variants (default 8)', '8')
3495
+ .option('--ortholog-source <s>', 'rrm-consensus --source value (default "orthologs")', 'orthologs')
3496
+ .option('--refresh-consensus', 'Re-fetch UniProt orthologs and recompute consensus even if cached')
3497
+ .option('--refresh-distribution', 'Re-fetch ClinVar variants and recompute distribution even if cached')
3498
+ .option('--gnomad-benigns <N>', 'Synthesize N pseudo-benign control variants per gene from gnomAD common missense (unlocks AUC benchmarking on rare-disease genes whose ClinVar B+LB is empty)')
3499
+ .option('--gnomad-min-af <af>', 'gnomAD AF threshold for pseudo-benign eligibility (default 0.01)', '0.01')
3500
+ .option('--output <path>', 'JSON manifest output path (default ~/.biofs/cache/rrm/cohort_<hash>.json)')
3501
+ .option('--plot <path>', 'Render 3-panel cohort benchmark figure to PNG')
3502
+ .option('--quiet', 'Suppress per-gene progress output')
3503
+ .action(async (options) => {
3504
+ try {
3505
+ await (0, cohort_train_1.cohortTrainCommand)(options);
3506
+ }
3507
+ catch (error) {
3508
+ logger_1.Logger.error(`Cohort training failed: ${error}`);
3509
+ process.exit(1);
3510
+ }
3511
+ });
3512
+ // RRM-train — XGBoost ensemble combining Cosic-RRM with deep-learning predictors
3513
+ program
3514
+ .command('rrm-train <gene>')
3515
+ .description('Train XGBoost ensemble combining Cosic-RRM features with AlphaMissense/REVEL/PrimateAI for variant pathogenicity prediction')
3516
+ .option('--predict <variants>', 'Comma-separated HGVS protein changes to predict (e.g. ITGA2B:p.Val779Ala,ITGA2B:p.Leu225Arg)')
3517
+ .option('--folds <N>', 'Stratified CV folds (default 5)', '5')
3518
+ .option('--plot <path>', 'Render ROC curves + feature importance to PNG')
3519
+ .option('--refresh', 'Re-fetch MyVariant.info scores even if cached')
3520
+ .option('--include-predictions', 'Persist per-variant CV predictions for downstream stacking analysis')
3521
+ .option('--quiet', 'Suppress progress output')
3522
+ .action(async (gene, options) => {
3523
+ try {
3524
+ await (0, rrm_train_1.rrmTrainCommand)(gene, options);
3525
+ }
3526
+ catch (error) {
3527
+ logger_1.Logger.error(`RRM training failed: ${error}`);
3528
+ process.exit(1);
3529
+ }
3530
+ });
3531
+ // Fourier-score — Cosic RRM EIIP+DFT biophysical scoring of missense variants
3532
+ program
3533
+ .command('fourier-score <variants>')
3534
+ .description('Cosic-RRM EIIP+DFT biophysical scoring of missense variants (returns Σ|ΔF|, max|ΔF| as biophysical complement to REVEL/AlphaMissense)')
3535
+ .option('--window <N>', 'Window size for non-TM residues (default: 31, must be odd)')
3536
+ .option('--window-tm <N>', 'Window size for TM-residue variants (default: 51, must be odd)')
3537
+ .option('--uniprot <accession>', 'Override UniProt accession (for single variant or unknown gene)')
3538
+ .option('--format <type>', 'Output format: table | tsv | json (default: table)', 'table')
3539
+ .option('--output <path>', 'Write output to file instead of stdout')
3540
+ .option('--plot <path>', 'Render |ΔF| windowed spectrum to PNG (one panel per variant)')
3541
+ .option('--consensus-fc', 'Also score full-protein DFT at family characteristic frequency f_c (requires `biofs rrm-consensus <gene>` first)')
3542
+ .option('--plot-full <path>', 'Render full-protein |X(k)| spectrum to PNG with f_c annotated (requires --consensus-fc)')
3543
+ .option('--quiet', 'Suppress progress output')
3544
+ .action(async (variants, options) => {
3545
+ try {
3546
+ await (0, fourier_score_1.fourierScoreCommand)(variants, options);
3547
+ }
3548
+ catch (error) {
3549
+ logger_1.Logger.error(`Fourier scoring failed: ${error}`);
3550
+ process.exit(1);
3551
+ }
3552
+ });
3553
+ // Query — the consented query surface over QUERYABLE biodata (Phase-1 flagship).
3554
+ // Run a read-only SELECT server-side against an NFT-gated OpenCRAVAT sqlite,
3555
+ // addressed by biocid or biosample. Opaque biodata (FASTQ/BAM) is NOT queryable
3556
+ // and is served by `biofs mount`/`stream` instead.
3557
+ program
3558
+ .command('erase [biosample]')
3559
+ .description('GDPR Art.17 erasure — destroy a biosample\'s bytes, registry rows and derived copies (DRY RUN by default)')
3560
+ .option('--execute', 'Actually perform the erasure (irreversible; prompts for confirmation)')
3561
+ .option('--resume <erasure_id>', 'Resume an interrupted erasure saga')
3562
+ .option('--yes', 'Skip the interactive confirmation prompt (use with care)')
3563
+ .option('--json', 'JSON output for the dry-run plan')
3564
+ .action(async (biosample, options) => {
3565
+ try {
3566
+ await (0, erase_1.eraseCommand)(biosample, options);
3567
+ }
3568
+ catch (error) {
3569
+ logger_1.Logger.error(`Erase failed: ${error}`);
3570
+ process.exit(1);
3571
+ }
3572
+ });
3573
+ program
3574
+ .command('query <target> [sql]')
3575
+ .description('Consent-gated read-only SQL over a queryable-biodata sqlite (biocid or biosample); the sqlite never leaves prod, only rows transit')
3576
+ .option('--schema', 'List the tables in the annotated sqlite instead of running a query')
3577
+ .option('--format <type>', 'Output format: table | tsv | csv | json (default: table)', 'table')
3578
+ .option('--output <path>', 'Write output to a file instead of stdout')
3579
+ .option('--row-cap <n>', 'Cap rows returned by the server (default 10000, max 100000)')
3580
+ .option('--timeout-ms <n>', 'Server-side query time budget in ms (default 30000)')
3581
+ .option('--job-id <timestamp>', 'Pick a specific OC job timestamp when multiple sqlites exist')
3582
+ .option('--async', 'Run as a background job (submit-then-poll) for heavy full-table scans that exceed the 60s sync limit')
3583
+ .option('--quiet', 'Suppress progress output')
3584
+ .action(async (target, sql, options) => {
3585
+ try {
3586
+ await (0, query_1.queryCommand)(target, sql, options);
3587
+ }
3588
+ catch (error) {
3589
+ logger_1.Logger.error(`Query failed: ${error}`);
3590
+ process.exit(1);
3591
+ }
3592
+ });
3593
+ // Variants — query annotated variants from the latest OpenCRAVAT sqlite
3594
+ program
3595
+ .command('variants <biosample_serial>')
3596
+ .description('Query annotated variants from the latest OpenCRAVAT sqlite for a biosample (gene/region/SO/AF/ClinVar filters)')
3597
+ .option('--gene <symbols>', 'Comma-separated HUGO gene symbols (e.g. ITGA2B,ITGB3)')
3598
+ .option('--region <chr:start-end>', 'Genomic region (e.g. chr17:44372210-44511666)')
3599
+ .option('--so <terms>', 'Sequence-ontology terms or "all" (default: missense+LoF+canonical splice)')
3600
+ .option('--max-af <number>', 'Population AF cap across gnomAD3/4 + AllOfUs (default: 0.01)')
3601
+ .option('--clinvar <class>', 'ClinVar significance filter: patho|likely|vus|benign|all (default: all)')
3602
+ .option('--columns <names>', 'Comma-separated annotator columns to display (default panel)')
3603
+ .option('--format <type>', 'Output format: table | tsv | json (default: table)', 'table')
3604
+ .option('--output <path>', 'Write output to file instead of stdout')
3605
+ .option('--refresh', 'No-op (kept for back-compat; variants now runs server-side, no local cache)')
3606
+ .option('--sqlite-uri <gsuri>', 'Deprecated: no longer supported (server-side runs against bioroutes inventory only)')
3607
+ .option('--job-id <timestamp>', 'Pick a specific OC job timestamp (e.g. 260411-053533) when multiple sqlites exist')
3608
+ .option('--with-acmg', 'Attach ACMG-SVI evidence stack per Section 2.7 to each row (single-tool PP3 + PVS1 + PM2)')
3609
+ .option('--limit <n>', 'Cap rows returned by the server (handy for fast probes of a large sqlite)')
3610
+ .option('--quiet', 'Suppress progress output')
3611
+ .option('--debug', 'Show server resolution debug info')
3612
+ .action(async (biosampleSerial, options) => {
3613
+ try {
3614
+ await (0, variants_1.variantsCommand)(biosampleSerial, options);
3615
+ }
3616
+ catch (error) {
3617
+ logger_1.Logger.error(`Variant query failed: ${error}`);
3618
+ process.exit(1);
3619
+ }
3620
+ });
3621
+ // Resolve - BioRoutes on-chain route resolution (Phase G.2)
3622
+ program
3623
+ .command('resolve <biocid_or_fingerprint>')
3624
+ .description('Resolve a biocid or fingerprint to its storage route via BioRoutes on-chain (Sequentia)')
3625
+ .option('--by-fingerprint', 'Treat the argument as a contentHash fingerprint instead of a biocid')
3626
+ .option('--verify', 'Verify that the resolved URI is accessible and fingerprint matches')
3627
+ .option('--dispute', 'If --verify detects mismatch, submit RouteDisputed tx on-chain')
3628
+ .option('--json', 'Output as JSON')
3629
+ .option('--verbose', 'Show debug information')
3630
+ .action(async (identifier, options) => {
3631
+ try {
3632
+ await (0, resolve_1.resolveCommand)(identifier, options);
3633
+ }
3634
+ catch (error) {
3635
+ logger_1.Logger.error(`Resolve failed: ${error}`);
3636
+ process.exit(1);
3637
+ }
3638
+ });
3639
+ // Match - 3-stage privacy-preserving SNP match (ICISSP 2024 Figure 1)
3640
+ program
3641
+ .command('match')
3642
+ .description('Match SNPs against an owner corpus via Bloom/accumulator (Matcher → Ticket → Resolver)')
3643
+ .requiredOption('--owner <wallet>', 'Owner wallet address to match against')
3644
+ .option('--snps <list>', 'Comma-separated SNPs in rsid:chrom:pos:genotype format')
3645
+ .option('--snp-file <path>', 'File with one SNP per line (rsid:chrom:pos:genotype)')
3646
+ .option('--json', 'Output as JSON')
3647
+ .option('--verbose', 'Show debug information')
3648
+ .action(async (options) => {
3649
+ try {
3650
+ await (0, match_1.matchCommand)(options);
3651
+ }
3652
+ catch (error) {
3653
+ logger_1.Logger.error(`Match failed: ${error}`);
3654
+ process.exit(1);
3655
+ }
3656
+ });
3657
+ // Ticket - Privacy ticket management (ICISSP 2024 §6)
3658
+ program
3659
+ .command('ticket')
3660
+ .description('List or revoke privacy tickets (BioNFTCredentials-bound access tokens)')
3661
+ .option('--list', 'List active tickets (default)')
3662
+ .option('--revoke <ticketId>', 'Revoke a ticket by ID (burns BioNFTCredentials token)')
3663
+ .option('--json', 'Output as JSON')
3664
+ .option('--verbose', 'Show debug information')
3665
+ .action(async (options) => {
3666
+ try {
3667
+ await (0, ticket_1.ticketCommand)(options);
3668
+ }
3669
+ catch (error) {
3670
+ logger_1.Logger.error(`Ticket command failed: ${error}`);
3671
+ process.exit(1);
3672
+ }
3673
+ });
3674
+ // Dissect - GDPR Data Minimization: Extract phenotype-specific SNPs
3675
+ // NOW USES SEQUENTIA PROTOCOL BY DEFAULT (solves 0xd4d910b4 Story Protocol error!)
3676
+ program
3677
+ .command('dissect <phenotype_query> <source_file>')
1416
3678
  .description('Extract phenotype-specific SNP subset with AI-powered discovery')
1417
3679
  .option('--share <wallet>', 'Share derivative subset with wallet address')
1418
3680
  .option('--license <type>', 'License type (non-commercial|commercial|commercial-remix)', 'non-commercial')
@@ -1456,6 +3718,67 @@ program
1456
3718
  process.exit(1);
1457
3719
  }
1458
3720
  });
3721
+ // Pipeline command group — end-to-end FASTQ → Digital Twin orchestration
3722
+ const pipelineCmd = program
3723
+ .command('pipeline')
3724
+ .description('End-to-end agentic pipeline (FASTQ → Clara → CRAVAT → Vault → Digital Twin)');
3725
+ pipelineCmd
3726
+ .command('run-wes <biosample_serial>')
3727
+ .description('Run the full WES/WGS pipeline on a biosample, producing a Digital Twin URL')
3728
+ .option('--mode <WES|WGS>', 'Override auto-detection (WES or WGS)')
3729
+ .option('--bed <path>', 'Override interval BED path (forces WES)')
3730
+ .option('--phase <range>', 'Run a subset of phases (e.g. "1-4", "5-10", or "all")')
3731
+ .option('--run-id <id>', 'Resume an existing pipeline run by id')
3732
+ .option('--watch', 'Stream Parabricks pipeline log live')
3733
+ .option('--dry-run', 'Print what would happen but don\'t execute side-effecting phases')
3734
+ .option('--skip-twin', 'Skip phase 9 (Digital Twin HTML render)')
3735
+ .option('--remote', 'Force SSH-to-prod execution even if local orchestrator exists')
3736
+ .option('--mongo-uri <uri>', 'MongoDB connection string (default: localhost:27017 on the executor)')
3737
+ .option('--json', 'Emit raw JSON-line events instead of pretty output')
3738
+ .action(async (biosampleSerial, options) => {
3739
+ try {
3740
+ const rc = await (0, runWes_1.pipelineRunWesCommand)(biosampleSerial, options);
3741
+ process.exit(rc);
3742
+ }
3743
+ catch (error) {
3744
+ logger_1.Logger.error(`pipeline run-wes failed: ${error}`);
3745
+ process.exit(1);
3746
+ }
3747
+ });
3748
+ // BioRouter route resolver — diagnose and heal gcsfuse mounts on compute nodes
3749
+ const routeCmd = program
3750
+ .command('route')
3751
+ .description('BioRouter route resolver — lint & heal gcsfuse mounts for biosamples');
3752
+ routeCmd
3753
+ .command('check <biosample_serial...>')
3754
+ .description('Resolve every route for the given biosample(s) and report mount status')
3755
+ .option('--json', 'Emit raw JSON output instead of pretty table')
3756
+ .action(async (serials, options) => {
3757
+ await (0, route_1.routeCheckCommand)(serials, options);
3758
+ });
3759
+ routeCmd
3760
+ .command('heal <biosample_serial...>')
3761
+ .description('Mount every bucket required by the biosamples on a compute node')
3762
+ .option('--node <user@host>', 'Target node (default: parabricks-gpu-spot@10.128.0.7)')
3763
+ .option('--json', 'Emit raw JSON output')
3764
+ .action(async (serials, options) => {
3765
+ await (0, route_1.routeHealCommand)(serials, options);
3766
+ });
3767
+ routeCmd
3768
+ .command('anchor')
3769
+ .description('Instantiate pending bioroutes.inventory rows on Sequentia (BioRoutes registerRoute). Default scope: John.')
3770
+ .option('--wallet <address>', 'Owner wallet to anchor (default: John 0x88110B7e…). Admin only for other wallets.')
3771
+ .option('--serial <serial>', 'Biosample serial / fingerprint scope')
3772
+ .option('--all', 'Anchor every pending row across all wallets (admin)')
3773
+ .option('--writes <csv>', 'On-chain writes: route[,bioasset]', 'route')
3774
+ .option('--filetypes <csv>', 'Limit to these filetypes (e.g. vcf,bam)')
3775
+ .option('--batch <n>', 'Rows registered per request (1-100)', '25')
3776
+ .option('--limit <n>', 'Cap total rows this run (0 = no cap)')
3777
+ .option('--dry-run', 'Preview eligible rows; no chain writes')
3778
+ .option('--json', 'Emit raw JSON output')
3779
+ .action(async (options) => {
3780
+ await (0, anchor_1.routeAnchorCommand)(options);
3781
+ });
1459
3782
  // Help command
1460
3783
  program
1461
3784
  .command('help [command]')
@@ -1474,11 +3797,289 @@ program
1474
3797
  program.outputHelp();
1475
3798
  }
1476
3799
  });
3800
+ // BIODATA_ROOM_20260801: dual-role profiles (patient vault vs known researcher)
3801
+ const profileCmd = program
3802
+ .command('profile')
3803
+ .description('Manage dual BioFS profiles (patient vs researcher credential roots)');
3804
+ profileCmd
3805
+ .command('list')
3806
+ .description('List local profiles under ~/.biofs/profiles/*')
3807
+ .option('--json', 'JSON output')
3808
+ .action(async (o) => {
3809
+ try {
3810
+ await (0, profile_1.profileListCommand)(o);
3811
+ }
3812
+ catch (e) {
3813
+ logger_1.Logger.error(String(e));
3814
+ process.exit(1);
3815
+ }
3816
+ });
3817
+ profileCmd
3818
+ .command('use <name>')
3819
+ .description('Prepare a named profile; print export BIOFS_PROFILE=... (--print for shell eval)')
3820
+ .option('--print', 'Print shell exports only (for eval "$(biofs profile use researcher --print)")')
3821
+ .option('--json', 'JSON output')
3822
+ .action(async (name, o) => {
3823
+ try {
3824
+ await (0, profile_1.profileUseCommand)(name, o);
3825
+ }
3826
+ catch (e) {
3827
+ logger_1.Logger.error(String(e));
3828
+ process.exit(1);
3829
+ }
3830
+ });
3831
+ profileCmd
3832
+ .command('status')
3833
+ .description('Show active profile, config dir, and wallet')
3834
+ .option('--json', 'JSON output')
3835
+ .action(async (o) => {
3836
+ try {
3837
+ await (0, profile_1.profileStatusCommand)(o);
3838
+ }
3839
+ catch (e) {
3840
+ logger_1.Logger.error(String(e));
3841
+ process.exit(1);
3842
+ }
3843
+ });
3844
+ // BIODATA_ROOM_20260801: investor-style biodata room for researcher deep dives
3845
+ const roomCmd = program
3846
+ .command('room')
3847
+ .description('Researcher Biodata Room: create, request, admit, enter, scoped files (via biofs-node)');
3848
+ roomCmd
3849
+ .command('create')
3850
+ .description('Owner: create a room over one or more biocid:// assets')
3851
+ .requiredOption('--biocids <list>', 'Comma/space-separated biocid:// list')
3852
+ .option('--purpose <text>', 'Research purpose shown to the owner', 'research deep dive')
3853
+ .option('--skills <list>', 'Allowed verbs (comma-separated)')
3854
+ .option('--days <n>', 'TTL days after admit (1-30)', '7')
3855
+ .option('--researcher <wallet>', 'Optional pre-assign researcher wallet')
3856
+ .option('--json', 'JSON output')
3857
+ .option('--quiet', 'Quiet mode')
3858
+ .action(async (o) => {
3859
+ try {
3860
+ await (0, room_1.roomCreateCommand)(o);
3861
+ }
3862
+ catch (e) {
3863
+ logger_1.Logger.error(String(e));
3864
+ process.exit(1);
3865
+ }
3866
+ });
3867
+ roomCmd
3868
+ .command('request <room_id>')
3869
+ .description('Researcher: request admission to a room')
3870
+ .option('--purpose <text>', 'Purpose of the deep dive')
3871
+ .option('--message <text>', 'Message to the data owner')
3872
+ .option('--skills <list>', 'Requested skills')
3873
+ .option('--json', 'JSON output')
3874
+ .option('--quiet', 'Quiet mode')
3875
+ .action(async (roomId, o) => {
3876
+ try {
3877
+ await (0, room_1.roomRequestCommand)(roomId, o);
3878
+ }
3879
+ catch (e) {
3880
+ logger_1.Logger.error(String(e));
3881
+ process.exit(1);
3882
+ }
3883
+ });
3884
+ roomCmd
3885
+ .command('status <room_id>')
3886
+ .description('Show room status (members see full card)')
3887
+ .option('--json', 'JSON output')
3888
+ .action(async (roomId, o) => {
3889
+ try {
3890
+ await (0, room_1.roomStatusCommand)(roomId, o);
3891
+ }
3892
+ catch (e) {
3893
+ logger_1.Logger.error(String(e));
3894
+ process.exit(1);
3895
+ }
3896
+ });
3897
+ roomCmd
3898
+ .command('admit <room_id>')
3899
+ .description('Owner (patient): admit the researcher and open the room')
3900
+ .option('--json', 'JSON output')
3901
+ .option('--quiet', 'Quiet mode')
3902
+ .action(async (roomId, o) => {
3903
+ try {
3904
+ await (0, room_1.roomAdmitCommand)(roomId, o);
3905
+ }
3906
+ catch (e) {
3907
+ logger_1.Logger.error(String(e));
3908
+ process.exit(1);
3909
+ }
3910
+ });
3911
+ roomCmd
3912
+ .command('revoke <room_id>')
3913
+ .description('Owner or researcher: revoke/leave the room')
3914
+ .option('--json', 'JSON output')
3915
+ .option('--quiet', 'Quiet mode')
3916
+ .action(async (roomId, o) => {
3917
+ try {
3918
+ await (0, room_1.roomRevokeCommand)(roomId, o);
3919
+ }
3920
+ catch (e) {
3921
+ logger_1.Logger.error(String(e));
3922
+ process.exit(1);
3923
+ }
3924
+ });
3925
+ roomCmd
3926
+ .command('list')
3927
+ .description('List rooms for the active profile wallet')
3928
+ .option('--json', 'JSON output')
3929
+ .action(async (o) => {
3930
+ try {
3931
+ await (0, room_1.roomListCommand)(o);
3932
+ }
3933
+ catch (e) {
3934
+ logger_1.Logger.error(String(e));
3935
+ process.exit(1);
3936
+ }
3937
+ });
3938
+ roomCmd
3939
+ .command('enter <room_id>')
3940
+ .description('Enter an OPEN room (sets local active_room.json session)')
3941
+ .option('--json', 'JSON output')
3942
+ .option('--quiet', 'Quiet mode')
3943
+ .action(async (roomId, o) => {
3944
+ try {
3945
+ await (0, room_1.roomEnterCommand)(roomId, o);
3946
+ }
3947
+ catch (e) {
3948
+ logger_1.Logger.error(String(e));
3949
+ process.exit(1);
3950
+ }
3951
+ });
3952
+ roomCmd
3953
+ .command('leave')
3954
+ .description('Clear the local active room session')
3955
+ .option('--json', 'JSON output')
3956
+ .action(async (o) => {
3957
+ try {
3958
+ await (0, room_1.roomLeaveCommand)(o);
3959
+ }
3960
+ catch (e) {
3961
+ logger_1.Logger.error(String(e));
3962
+ process.exit(1);
3963
+ }
3964
+ });
3965
+ roomCmd
3966
+ .command('files [room_id]')
3967
+ .description('List biocids in a room (defaults to active room). No gs:// paths returned.')
3968
+ .option('--json', 'JSON output')
3969
+ .action(async (roomId, o) => {
3970
+ try {
3971
+ await (0, room_1.roomFilesCommand)(roomId, o);
3972
+ }
3973
+ catch (e) {
3974
+ logger_1.Logger.error(String(e));
3975
+ process.exit(1);
3976
+ }
3977
+ });
3978
+ roomCmd
3979
+ .command('signing-url <room_id>')
3980
+ .description('Get patient web + Telegram signing links for a room')
3981
+ .option('--json', 'JSON output')
3982
+ .action(async (roomId, o) => {
3983
+ try {
3984
+ await (0, room_1.roomSigningUrlCommand)(roomId, o);
3985
+ }
3986
+ catch (e) {
3987
+ logger_1.Logger.error(String(e));
3988
+ process.exit(1);
3989
+ }
3990
+ });
3991
+ // CONSENT_VERBS_20260730: subject-signed consent for an AI-agent session. Two steps because the
3992
+ // node cannot sign for the data owner, which is the property that stops consent being
3993
+ // minted ABOUT a person instead of BY them.
3994
+ const consentCmd = program
3995
+ .command('consent')
3996
+ .description('Grant or inspect consent for an AI-agent session (dispatched through biofs-node)');
3997
+ consentCmd
3998
+ .command('payload')
3999
+ .description('Build the consent terms the data owner must sign for one MCP session')
4000
+ .requiredOption('--session <id>', 'MCP session id (Mcp-Session-Id)')
4001
+ .requiredOption('--biocid <biocid>', 'The biocid:// the grant covers')
4002
+ .option('--days <n>', 'Validity in days (1-30)', '1')
4003
+ .option('--json', 'Emit JSON')
4004
+ .option('--quiet', 'Suppress progress')
4005
+ .action(async (o) => {
4006
+ try {
4007
+ await (0, consent_1.consentPayloadCommand)(o.session, o.biocid, o);
4008
+ }
4009
+ catch (e) {
4010
+ logger_1.Logger.error(`consent payload failed: ${e}`);
4011
+ process.exit(1);
4012
+ }
4013
+ });
4014
+ consentCmd
4015
+ .command('submit')
4016
+ .description('Relay a data-owner-signed consent grant on-chain (the node pays the gas)')
4017
+ .requiredOption('--session <id>', 'MCP session id')
4018
+ .requiredOption('--message <json>', 'The signed grant message, inline JSON or a path')
4019
+ .requiredOption('--signature <sig>', 'EIP-712 signature by the data owner')
4020
+ .option('--json', 'Emit JSON')
4021
+ .option('--quiet', 'Suppress progress')
4022
+ .action(async (o) => {
4023
+ try {
4024
+ await (0, consent_1.consentSubmitCommand)(o.session, o.message, o.signature, o);
4025
+ }
4026
+ catch (e) {
4027
+ logger_1.Logger.error(`consent submit failed: ${e}`);
4028
+ process.exit(1);
4029
+ }
4030
+ });
4031
+ // FLUENCY_LINEAGE_VERBS_20260730: make a genomics store AI-conversable, and report the metamorphosis.
4032
+ // Registered with the other groups, BEFORE the welcome banner and program.parse().
4033
+ const fluencyCmd = program
4034
+ .command('fluency')
4035
+ .description('Make a genomics store AI-conversable: precompute per-contig coverage + per-gene rollups (dispatched through biofs-node)');
4036
+ fluencyCmd
4037
+ .command('build <biocid>')
4038
+ .description('Build (or adopt) the fluency artifact. Idempotent; the derivative is registered to the data owner with parent lineage')
4039
+ .option('--json', 'Emit JSON')
4040
+ .option('--quiet', 'Suppress progress')
4041
+ .action(async (biocid, options) => {
4042
+ try {
4043
+ await (0, fluency_1.fluencyBuildCommand)(biocid, options);
4044
+ }
4045
+ catch (error) {
4046
+ logger_1.Logger.error(`fluency build failed: ${error}`);
4047
+ process.exit(1);
4048
+ }
4049
+ });
4050
+ fluencyCmd
4051
+ .command('state <biocid>')
4052
+ .description('Report whether a store is fluent (fresh / building / absent) and what it covers')
4053
+ .option('--json', 'Emit JSON')
4054
+ .option('--quiet', 'Suppress progress')
4055
+ .action(async (biocid, options) => {
4056
+ try {
4057
+ await (0, fluency_1.fluencyStateCommand)(biocid, options);
4058
+ }
4059
+ catch (error) {
4060
+ logger_1.Logger.error(`fluency state failed: ${error}`);
4061
+ process.exit(1);
4062
+ }
4063
+ });
4064
+ program
4065
+ .command('lineage <biocid>')
4066
+ .description('Report the biodata metamorphosis: what this was derived from, what came from it, who owns each piece, and what erases with what')
4067
+ .option('--json', 'Emit JSON')
4068
+ .option('--quiet', 'Suppress progress')
4069
+ .action(async (biocid, options) => {
4070
+ try {
4071
+ await (0, lineage_1.lineageCommand)(biocid, options);
4072
+ }
4073
+ catch (error) {
4074
+ logger_1.Logger.error(`lineage failed: ${error}`);
4075
+ process.exit(1);
4076
+ }
4077
+ });
1477
4078
  // Show welcome message if no command
1478
4079
  if (process.argv.length === 2) {
1479
4080
  console.log(chalk_1.default.cyan('\n╔═════════════════════════════════════════════╗'));
1480
- console.log(chalk_1.default.cyan('║ BioFS CLI v2.4.0 ║'));
1481
- console.log(chalk_1.default.cyan('║ BioNFT-Gated S3 + x402 Pay + Kite AI ║'));
4081
+ console.log(chalk_1.default.cyan('║ BioFS CLI v3.2.0 ║'));
4082
+ console.log(chalk_1.default.cyan('║ BioNFT-Gated Genomics + Researcher ID ║'));
1482
4083
  console.log(chalk_1.default.cyan('╚═════════════════════════════════════════════╝\n'));
1483
4084
  console.log('Available commands:');
1484
4085
  console.log(` ${chalk_1.default.green('login')} - Authenticate with Web3 wallet`);
@@ -1489,9 +4090,14 @@ if (process.argv.length === 2) {
1489
4090
  console.log(` ${chalk_1.default.green('biofiles')} - List your BioFiles (all sources)`);
1490
4091
  console.log(` ${chalk_1.default.green('download')} - Download files (GDPR consent)`);
1491
4092
  console.log(` ${chalk_1.default.green('mount')} - Mount all files (GDPR consent)`);
4093
+ console.log(` ${chalk_1.default.green('profile')} - Dual profiles (patient vs researcher credentials)`);
4094
+ console.log(` ${chalk_1.default.green('room')} - Researcher Biodata Room (admit + scoped deep dive)`);
4095
+ console.log(` ${chalk_1.default.green('fluency')} - Make a store AI-conversable (coverage + per-gene rollups)`);
4096
+ console.log(` ${chalk_1.default.green('lineage')} - Biodata metamorphosis: parents, derivatives, owners`);
1492
4097
  console.log(` ${chalk_1.default.green('mount-remote')} - Mount biosample on agent`);
1493
4098
  console.log(` ${chalk_1.default.green('upload')} - Upload files`);
1494
4099
  console.log(` ${chalk_1.default.green('tokenize')} - Tokenize genomic data as BioNFT`);
4100
+ console.log(` ${chalk_1.default.green('researcher')} - Register & manage researcher identity`);
1495
4101
  console.log(` ${chalk_1.default.green('labnfts')} - List approved research labs`);
1496
4102
  console.log(` ${chalk_1.default.green('share')} - Share with lab (dual NFT)`);
1497
4103
  console.log(` ${chalk_1.default.green('shares')} - View permission graph`);
@@ -1518,6 +4124,9 @@ if (process.argv.length === 2) {
1518
4124
  console.log(` ${chalk_1.default.cyan('payment setup')} - Configure payment wallet`);
1519
4125
  console.log(` ${chalk_1.default.cyan('payment faucet')} - Get testnet tokens`);
1520
4126
  console.log(` ${chalk_1.default.cyan('payment history')} - View transaction history\n`);
4127
+ console.log('Researcher subcommands:');
4128
+ console.log(` ${chalk_1.default.cyan('researcher register')} - Register via ORCID, Google, LinkedIn, MetaMask, etc.`);
4129
+ console.log(` ${chalk_1.default.cyan('researcher status')} - View your researcher profile\n`);
1521
4130
  console.log('Kite AI Agent subcommands:');
1522
4131
  console.log(` ${chalk_1.default.cyan('agent register')} --all - Register BioFS agents on Kite`);
1523
4132
  console.log(` ${chalk_1.default.cyan('agent list')} - List registered agents`);
@@ -1541,11 +4150,10 @@ else {
1541
4150
  // Parse command line arguments
1542
4151
  program.parse(process.argv);
1543
4152
  }
1544
- // Handle uncaught errors
1545
- process.on('unhandledRejection', (error) => {
1546
- logger_1.Logger.error(`Unexpected error: ${error}`);
1547
- process.exit(1);
1548
- });
4153
+ // Note: the authoritative unhandledRejection/uncaughtException handlers are
4154
+ // registered once near the top of this file (they route through reportAndExit
4155
+ // for a crash report). A second unhandledRejection listener here would also fire
4156
+ // and could process.exit(1) before that async report is sent, so it was removed.
1549
4157
  process.on('SIGINT', () => {
1550
4158
  console.log('\n\nInterrupted. Goodbye!');
1551
4159
  process.exit(0);