@genobank/biofs 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +556 -201
  3. package/dist/commands/annotate/submit.d.ts.map +1 -1
  4. package/dist/commands/annotate/submit.js +32 -31
  5. package/dist/commands/annotate/submit.js.map +1 -1
  6. package/dist/commands/bionft/revoke.d.ts +6 -0
  7. package/dist/commands/bionft/revoke.d.ts.map +1 -0
  8. package/dist/commands/bionft/revoke.js +74 -0
  9. package/dist/commands/bionft/revoke.js.map +1 -0
  10. package/dist/commands/bionft/status.d.ts +2 -0
  11. package/dist/commands/bionft/status.d.ts.map +1 -0
  12. package/dist/commands/bionft/status.js +45 -0
  13. package/dist/commands/bionft/status.js.map +1 -0
  14. package/dist/commands/bionft/view.d.ts +5 -0
  15. package/dist/commands/bionft/view.d.ts.map +1 -0
  16. package/dist/commands/bionft/view.js +127 -0
  17. package/dist/commands/bionft/view.js.map +1 -0
  18. package/dist/commands/cred/issue.d.ts +12 -0
  19. package/dist/commands/cred/issue.d.ts.map +1 -0
  20. package/dist/commands/cred/issue.js +95 -0
  21. package/dist/commands/cred/issue.js.map +1 -0
  22. package/dist/commands/cred/lib.d.ts +23 -0
  23. package/dist/commands/cred/lib.d.ts.map +1 -0
  24. package/dist/commands/cred/lib.js +95 -0
  25. package/dist/commands/cred/lib.js.map +1 -0
  26. package/dist/commands/cred/list.d.ts +7 -0
  27. package/dist/commands/cred/list.d.ts.map +1 -0
  28. package/dist/commands/cred/list.js +65 -0
  29. package/dist/commands/cred/list.js.map +1 -0
  30. package/dist/commands/cred/revoke.d.ts +6 -0
  31. package/dist/commands/cred/revoke.d.ts.map +1 -0
  32. package/dist/commands/cred/revoke.js +60 -0
  33. package/dist/commands/cred/revoke.js.map +1 -0
  34. package/dist/commands/cred/status.d.ts +5 -0
  35. package/dist/commands/cred/status.d.ts.map +1 -0
  36. package/dist/commands/cred/status.js +41 -0
  37. package/dist/commands/cred/status.js.map +1 -0
  38. package/dist/commands/dedup.d.ts +29 -0
  39. package/dist/commands/dedup.d.ts.map +1 -0
  40. package/dist/commands/dedup.js +153 -0
  41. package/dist/commands/dedup.js.map +1 -0
  42. package/dist/commands/download.d.ts +1 -0
  43. package/dist/commands/download.d.ts.map +1 -1
  44. package/dist/commands/download.js +61 -1
  45. package/dist/commands/download.js.map +1 -1
  46. package/dist/commands/fingerprint.d.ts +31 -0
  47. package/dist/commands/fingerprint.d.ts.map +1 -0
  48. package/dist/commands/fingerprint.js +222 -0
  49. package/dist/commands/fingerprint.js.map +1 -0
  50. package/dist/commands/inventory.d.ts +21 -0
  51. package/dist/commands/inventory.d.ts.map +1 -0
  52. package/dist/commands/inventory.js +133 -0
  53. package/dist/commands/inventory.js.map +1 -0
  54. package/dist/commands/login.d.ts.map +1 -1
  55. package/dist/commands/login.js +15 -0
  56. package/dist/commands/login.js.map +1 -1
  57. package/dist/commands/match.d.ts +9 -0
  58. package/dist/commands/match.d.ts.map +1 -0
  59. package/dist/commands/match.js +193 -0
  60. package/dist/commands/match.js.map +1 -0
  61. package/dist/commands/resolve.d.ts +9 -0
  62. package/dist/commands/resolve.d.ts.map +1 -0
  63. package/dist/commands/resolve.js +229 -0
  64. package/dist/commands/resolve.js.map +1 -0
  65. package/dist/commands/scan.d.ts +33 -0
  66. package/dist/commands/scan.d.ts.map +1 -0
  67. package/dist/commands/scan.js +175 -0
  68. package/dist/commands/scan.js.map +1 -0
  69. package/dist/commands/ticket.d.ts +8 -0
  70. package/dist/commands/ticket.d.ts.map +1 -0
  71. package/dist/commands/ticket.js +143 -0
  72. package/dist/commands/ticket.js.map +1 -0
  73. package/dist/commands/upload-fastq.d.ts +10 -0
  74. package/dist/commands/upload-fastq.d.ts.map +1 -0
  75. package/dist/commands/upload-fastq.js +60 -0
  76. package/dist/commands/upload-fastq.js.map +1 -0
  77. package/dist/commands/vault/mount.d.ts +8 -0
  78. package/dist/commands/vault/mount.d.ts.map +1 -0
  79. package/dist/commands/vault/mount.js +136 -0
  80. package/dist/commands/vault/mount.js.map +1 -0
  81. package/dist/commands/vault/setup.d.ts +6 -0
  82. package/dist/commands/vault/setup.d.ts.map +1 -0
  83. package/dist/commands/vault/setup.js +160 -0
  84. package/dist/commands/vault/setup.js.map +1 -0
  85. package/dist/commands/vault/status.d.ts +4 -0
  86. package/dist/commands/vault/status.d.ts.map +1 -0
  87. package/dist/commands/vault/status.js +97 -0
  88. package/dist/commands/vault/status.js.map +1 -0
  89. package/dist/commands/vault/unmount.d.ts +6 -0
  90. package/dist/commands/vault/unmount.d.ts.map +1 -0
  91. package/dist/commands/vault/unmount.js +90 -0
  92. package/dist/commands/vault/unmount.js.map +1 -0
  93. package/dist/index.js +399 -90
  94. package/dist/index.js.map +1 -1
  95. package/dist/lib/auth/server.d.ts.map +1 -1
  96. package/dist/lib/auth/server.js +21 -2
  97. package/dist/lib/auth/server.js.map +1 -1
  98. package/dist/lib/biofiles/biocid.d.ts +11 -1
  99. package/dist/lib/biofiles/biocid.d.ts.map +1 -1
  100. package/dist/lib/biofiles/biocid.js +16 -2
  101. package/dist/lib/biofiles/biocid.js.map +1 -1
  102. package/dist/lib/biofiles/resolver.d.ts.map +1 -1
  103. package/dist/lib/biofiles/resolver.js +77 -2
  104. package/dist/lib/biofiles/resolver.js.map +1 -1
  105. package/dist/lib/bionft/BioAssetVault.abi.json +1104 -0
  106. package/dist/lib/bionft/BioNFTCredentials.abi.json +1235 -0
  107. package/dist/lib/bionft/client.d.ts +45 -0
  108. package/dist/lib/bionft/client.d.ts.map +1 -0
  109. package/dist/lib/bionft/client.js +219 -0
  110. package/dist/lib/bionft/client.js.map +1 -0
  111. package/dist/lib/bioroutes/client.d.ts +75 -0
  112. package/dist/lib/bioroutes/client.d.ts.map +1 -0
  113. package/dist/lib/bioroutes/client.js +358 -0
  114. package/dist/lib/bioroutes/client.js.map +1 -0
  115. package/dist/lib/config/constants.d.ts +4 -0
  116. package/dist/lib/config/constants.d.ts.map +1 -1
  117. package/dist/lib/config/constants.js +9 -4
  118. package/dist/lib/config/constants.js.map +1 -1
  119. package/dist/lib/sequentia/BioCIDRegistry.js +1 -1
  120. package/dist/lib/sequentia/BioCIDRegistry.js.map +1 -1
  121. package/dist/lib/sequentia/index.js +1 -1
  122. package/dist/lib/sequentia/index.js.map +1 -1
  123. package/dist/utils/errorReporter.d.ts +6 -0
  124. package/dist/utils/errorReporter.d.ts.map +1 -1
  125. package/dist/utils/errorReporter.js +53 -0
  126. package/dist/utils/errorReporter.js.map +1 -1
  127. package/package.json +5 -5
  128. package/dist/commands/access-sequentia.d.ts +0 -35
  129. package/dist/commands/access-sequentia.d.ts.map +0 -1
  130. package/dist/commands/access-sequentia.js +0 -256
  131. package/dist/commands/access-sequentia.js.map +0 -1
  132. package/dist/commands/ancestry/compare.d.ts +0 -9
  133. package/dist/commands/ancestry/compare.d.ts.map +0 -1
  134. package/dist/commands/ancestry/compare.js +0 -139
  135. package/dist/commands/ancestry/compare.js.map +0 -1
  136. package/dist/commands/ancestry/results.d.ts +0 -13
  137. package/dist/commands/ancestry/results.d.ts.map +0 -1
  138. package/dist/commands/ancestry/results.js +0 -123
  139. package/dist/commands/ancestry/results.js.map +0 -1
  140. package/dist/commands/ancestry/run.d.ts +0 -18
  141. package/dist/commands/ancestry/run.d.ts.map +0 -1
  142. package/dist/commands/ancestry/run.js +0 -171
  143. package/dist/commands/ancestry/run.js.map +0 -1
  144. package/dist/commands/ancestry/status.d.ts +0 -8
  145. package/dist/commands/ancestry/status.d.ts.map +0 -1
  146. package/dist/commands/ancestry/status.js +0 -59
  147. package/dist/commands/ancestry/status.js.map +0 -1
  148. package/dist/commands/biofiles-sequentia.d.ts +0 -21
  149. package/dist/commands/biofiles-sequentia.d.ts.map +0 -1
  150. package/dist/commands/biofiles-sequentia.js +0 -238
  151. package/dist/commands/biofiles-sequentia.js.map +0 -1
  152. package/dist/commands/download-sequentia.d.ts +0 -19
  153. package/dist/commands/download-sequentia.d.ts.map +0 -1
  154. package/dist/commands/download-sequentia.js +0 -159
  155. package/dist/commands/download-sequentia.js.map +0 -1
  156. package/dist/commands/researcher/register.d.ts +0 -24
  157. package/dist/commands/researcher/register.d.ts.map +0 -1
  158. package/dist/commands/researcher/register.js +0 -192
  159. package/dist/commands/researcher/register.js.map +0 -1
  160. package/dist/commands/researcher/status.d.ts +0 -24
  161. package/dist/commands/researcher/status.d.ts.map +0 -1
  162. package/dist/commands/researcher/status.js +0 -235
  163. package/dist/commands/researcher/status.js.map +0 -1
  164. package/dist/commands/researcher/verify.d.ts +0 -24
  165. package/dist/commands/researcher/verify.d.ts.map +0 -1
  166. package/dist/commands/researcher/verify.js +0 -167
  167. package/dist/commands/researcher/verify.js.map +0 -1
  168. package/dist/commands/share-sequentia.d.ts +0 -21
  169. package/dist/commands/share-sequentia.d.ts.map +0 -1
  170. package/dist/commands/share-sequentia.js +0 -161
  171. package/dist/commands/share-sequentia.js.map +0 -1
  172. package/dist/commands/tokenize-sequentia.d.ts +0 -21
  173. package/dist/commands/tokenize-sequentia.d.ts.map +0 -1
  174. package/dist/commands/tokenize-sequentia.js +0 -191
  175. package/dist/commands/tokenize-sequentia.js.map +0 -1
  176. package/dist/commands/verify-sequentia.d.ts +0 -18
  177. package/dist/commands/verify-sequentia.d.ts.map +0 -1
  178. package/dist/commands/verify-sequentia.js +0 -150
  179. package/dist/commands/verify-sequentia.js.map +0 -1
  180. package/dist/lib/ancestry/somos-client.d.ts +0 -64
  181. package/dist/lib/ancestry/somos-client.d.ts.map +0 -1
  182. package/dist/lib/ancestry/somos-client.js +0 -121
  183. package/dist/lib/ancestry/somos-client.js.map +0 -1
package/dist/index.js CHANGED
@@ -20,16 +20,28 @@ const tokenize_fastqs_1 = require("./commands/tokenize-fastqs");
20
20
  const tokenize_biosample_1 = require("./commands/tokenize-biosample");
21
21
  const link_clara_1 = require("./commands/link-clara");
22
22
  const family_status_1 = require("./commands/family-status");
23
+ const issue_1 = require("./commands/cred/issue");
24
+ const view_1 = require("./commands/bionft/view");
25
+ const revoke_1 = require("./commands/bionft/revoke");
26
+ const status_1 = require("./commands/bionft/status");
27
+ const setup_1 = require("./commands/vault/setup");
28
+ const mount_2 = require("./commands/vault/mount");
29
+ const status_2 = require("./commands/vault/status");
30
+ const unmount_1 = require("./commands/vault/unmount");
31
+ const status_3 = require("./commands/cred/status");
32
+ const list_1 = require("./commands/cred/list");
33
+ const revoke_2 = require("./commands/cred/revoke");
34
+ const upload_fastq_1 = require("./commands/upload-fastq");
23
35
  const request_1 = require("./commands/access/request");
24
36
  const grant_1 = require("./commands/access/grant");
25
- const revoke_1 = require("./commands/access/revoke");
26
- const list_1 = require("./commands/access/list");
37
+ const revoke_3 = require("./commands/access/revoke");
38
+ const list_2 = require("./commands/access/list");
27
39
  const check_1 = require("./commands/access/check");
28
40
  const revoke_consent_1 = require("./commands/access/revoke-consent");
29
41
  const create_1 = require("./commands/job/create");
30
- const status_1 = require("./commands/job/status");
42
+ const status_4 = require("./commands/job/status");
31
43
  const results_1 = require("./commands/job/results");
32
- const list_2 = require("./commands/job/list");
44
+ const list_3 = require("./commands/job/list");
33
45
  const pipelines_1 = require("./commands/job/pipelines");
34
46
  // v2.7.0: htsget + smart streaming + aliases
35
47
  const stream_1 = require("./commands/stream");
@@ -40,39 +52,64 @@ const submit_clara_1 = require("./commands/job/submit-clara");
40
52
  const create_2 = require("./commands/context/create");
41
53
  const publish_1 = require("./commands/context/publish");
42
54
  const verify_1 = require("./commands/context/verify");
43
- const revoke_2 = require("./commands/context/revoke");
44
- const run_1 = require("./commands/ancestry/run");
45
- const status_2 = require("./commands/ancestry/status");
46
- const results_2 = require("./commands/ancestry/results");
47
- const compare_1 = require("./commands/ancestry/compare");
55
+ const revoke_4 = require("./commands/context/revoke");
48
56
  const health_1 = require("./commands/agent/health");
49
57
  const register_1 = require("./commands/agent/register");
50
- const list_3 = require("./commands/agent/list");
51
- const status_3 = require("./commands/agent/status");
52
- const list_4 = require("./commands/labs/list");
58
+ const list_4 = require("./commands/agent/list");
59
+ const status_5 = require("./commands/agent/status");
60
+ const list_5 = require("./commands/labs/list");
53
61
  const share_1 = require("./commands/share");
54
62
  const shares_1 = require("./commands/shares");
55
63
  const verify_2 = require("./commands/verify");
56
64
  const dissect_1 = require("./commands/dissect");
57
65
  const dissect_sequentia_1 = require("./commands/dissect-sequentia");
58
- const view_1 = require("./commands/view");
66
+ const view_2 = require("./commands/view");
59
67
  const report_1 = require("./commands/report");
60
68
  const admin_1 = require("./commands/admin");
61
69
  const fuse_1 = require("./commands/fuse");
62
70
  const submit_1 = require("./commands/annotate/submit");
63
- const status_4 = require("./commands/annotate/status");
71
+ const status_6 = require("./commands/annotate/status");
64
72
  const balance_1 = require("./commands/payment/balance");
65
73
  const pricing_1 = require("./commands/payment/pricing");
66
- const setup_1 = require("./commands/payment/setup");
74
+ const setup_2 = require("./commands/payment/setup");
67
75
  const faucet_1 = require("./commands/payment/faucet");
68
76
  const history_1 = require("./commands/payment/history");
77
+ const resolve_1 = require("./commands/resolve");
78
+ const match_1 = require("./commands/match");
79
+ const ticket_1 = require("./commands/ticket");
80
+ const scan_1 = require("./commands/scan");
81
+ const inventory_1 = require("./commands/inventory");
82
+ const dedup_1 = require("./commands/dedup");
83
+ const fingerprint_1 = require("./commands/fingerprint");
69
84
  const logger_1 = require("./lib/utils/logger");
85
+ const errorReporter_1 = require("./utils/errorReporter");
86
+ const credentials_1 = require("./lib/auth/credentials");
70
87
  const program = new commander_1.Command();
88
+ // Global catch-all so uncaught errors in ANY command still reach telemetry.
89
+ // Individual commands continue to call ErrorReporter.report directly (e.g.
90
+ // mount/umount) for richer context — this is the safety net for the rest.
91
+ async function reportAndExit(command, err, code) {
92
+ try {
93
+ const creds = await credentials_1.CredentialsManager.getInstance().loadCredentials().catch(() => null);
94
+ 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) });
96
+ }
97
+ catch { /* telemetry failure must never block exit */ }
98
+ process.exit(code);
99
+ }
100
+ process.on('uncaughtException', (err) => {
101
+ logger_1.Logger.error(`Uncaught: ${err?.message || err}`);
102
+ reportAndExit(process.argv.slice(2).join(' ') || 'unknown', err, 1);
103
+ });
104
+ process.on('unhandledRejection', (reason) => {
105
+ logger_1.Logger.error(`UnhandledRejection: ${reason?.message || reason}`);
106
+ reportAndExit(process.argv.slice(2).join(' ') || 'unknown', reason, 1);
107
+ });
71
108
  // Set up the CLI
72
109
  program
73
110
  .name('biofs')
74
- .description('BioFS by GenoBank.io - BioNFT-Gated GCS CLI for genomic data + ancestry + BioContext manifests')
75
- .version('3.0.0')
111
+ .description('BioFS by GenoBank.io - BioNFT-Gated S3 CLI for genomic data')
112
+ .version('3.0.1')
76
113
  .option('--debug', 'Enable debug output')
77
114
  .hook('preAction', (thisCommand) => {
78
115
  // Set global debug flag if --debug is passed
@@ -340,6 +377,7 @@ program
340
377
  .description('Stream a BioNFT-gated VCF/BAM to stdout via htsget (pipe into bcftools/samtools/pysam)')
341
378
  .option('--kind <variants|reads>', 'force datatype (default: auto-detect from filename)')
342
379
  .option('--htsget-url <url>', 'override htsget endpoint (default: https://htsget.genobank.app)')
380
+ .option('--annotated', 'stream the OpenCRAVAT-annotated VCF sibling (Phase D) instead of raw')
343
381
  .option('-q, --quiet', 'suppress info messages')
344
382
  .action(async (id, options) => {
345
383
  try {
@@ -519,10 +557,89 @@ program
519
557
  process.exit(1);
520
558
  }
521
559
  });
560
+ // Inventory command - Fast read-only summary of bioroutes.inventory (no GCS walk)
561
+ program
562
+ .command('inventory')
563
+ .alias('inv')
564
+ .description('Show what is currently registered in bioroutes.inventory (admin/lab-custodian)')
565
+ .option('--json', 'Output as JSON')
566
+ .option('--buckets', 'List all buckets, not just top 15')
567
+ .option('--verbose', 'Show debug information')
568
+ .action(async (options) => {
569
+ try {
570
+ await (0, inventory_1.inventoryCommand)(options);
571
+ }
572
+ catch (error) {
573
+ logger_1.Logger.error(`Inventory failed: ${error}`);
574
+ process.exit(1);
575
+ }
576
+ });
577
+ // Fingerprint command - Submit async fingerprint jobs (background worker uses gcsfuse)
578
+ program
579
+ .command('fingerprint')
580
+ .description('Compute real contentHashes for inventory rows via background worker (admin/lab-custodian)')
581
+ .option('--biocid <id>', 'Single biocid to fingerprint')
582
+ .option('--serial <id>', 'Single sample serial')
583
+ .option('--serials <csv>', 'Comma-separated sample serials')
584
+ .option('--filetypes <csv>', 'Filter to filetype list (e.g. vcf,gvcf)')
585
+ .option('--include-superseded', 'Also fingerprint SUPERSEDED rows')
586
+ .option('--limit <n>', 'Max rows to process per job', '50')
587
+ .option('--dry-run', 'Show eligible rows without submitting')
588
+ .option('--json', 'Output as JSON')
589
+ .action(async (options) => {
590
+ try {
591
+ await (0, fingerprint_1.fingerprintCommand)(options);
592
+ }
593
+ catch (error) {
594
+ logger_1.Logger.error(`Fingerprint failed: ${error}`);
595
+ process.exit(1);
596
+ }
597
+ });
598
+ // Dedup command - Pick canonical biocid per (sample, filetype, basename)
599
+ program
600
+ .command('dedup')
601
+ .description('Collapse duplicate biocid registrations to one canonical row (admin/lab-custodian)')
602
+ .option('--serial <id>', 'Single sample serial')
603
+ .option('--serials <csv>', 'Comma-separated sample serials')
604
+ .option('--lab <name>', 'Limit to one originlab')
605
+ .option('--bucket <name>', 'Limit to one bucket')
606
+ .option('--apply', 'Actually mark superseded (default is dry-run)')
607
+ .option('--json', 'Output as JSON')
608
+ .option('--verbose', 'Show debug information')
609
+ .action(async (options) => {
610
+ try {
611
+ await (0, dedup_1.dedupCommand)(options);
612
+ }
613
+ catch (error) {
614
+ logger_1.Logger.error(`Dedup failed: ${error}`);
615
+ process.exit(1);
616
+ }
617
+ });
618
+ // Scan command - Walk GCS bucket(s) and register objects in bioroutes.inventory
619
+ // Default scope: full canonical bucket fleet. Lab origin inferred per-file.
620
+ program
621
+ .command('scan')
622
+ .description('Scan GCS into bioroutes.inventory (per-file lab inference; admin/lab-custodian only)')
623
+ .option('--bucket <name>', 'Single bucket (e.g. genobank-parabricks-output)')
624
+ .option('--buckets <csv>', 'Comma-separated bucket list')
625
+ .option('--prefix <path>', 'Object prefix (requires single --bucket)')
626
+ .option('--filter-lab <name>', 'Register only files whose inferred lab matches')
627
+ .option('--dry-run', 'Preview without writing to MongoDB')
628
+ .option('--json', 'Output as JSON')
629
+ .option('--verbose', 'Show debug information')
630
+ .action(async (options) => {
631
+ try {
632
+ await (0, scan_1.scanCommand)(options);
633
+ }
634
+ catch (error) {
635
+ logger_1.Logger.error(`Scan failed: ${error}`);
636
+ process.exit(1);
637
+ }
638
+ });
522
639
  // Annotate command group - OpenCRAVAT VCF annotation
523
640
  const annotateCmd = program
524
641
  .command('annotate')
525
- .description('Annotate VCF files with OpenCRAVAT (146 annotators)');
642
+ .description('Annotate VCF files with OpenCRAVAT (curated panels or all 146 annotators)');
526
643
  // annotate submit - Submit VCF for annotation
527
644
  annotateCmd
528
645
  .command('submit <biosample_serial>')
@@ -552,7 +669,7 @@ annotateCmd
552
669
  .option('--json', 'Output as JSON')
553
670
  .action(async (jobId, options) => {
554
671
  try {
555
- await (0, status_4.annotateStatusCommand)(jobId, options);
672
+ await (0, status_6.annotateStatusCommand)(jobId, options);
556
673
  }
557
674
  catch (error) {
558
675
  logger_1.Logger.error(`Status check failed: ${error}`);
@@ -604,7 +721,7 @@ paymentCmd
604
721
  .option('--json', 'Output as JSON')
605
722
  .action(async (options) => {
606
723
  try {
607
- await (0, setup_1.paymentSetupCommand)(options);
724
+ await (0, setup_2.paymentSetupCommand)(options);
608
725
  }
609
726
  catch (error) {
610
727
  logger_1.Logger.error(`Setup failed: ${error}`);
@@ -679,7 +796,7 @@ agentCmd
679
796
  .option('--json', 'Output as JSON')
680
797
  .action(async (options) => {
681
798
  try {
682
- await (0, list_3.agentListCommand)(options);
799
+ await (0, list_4.agentListCommand)(options);
683
800
  }
684
801
  catch (error) {
685
802
  logger_1.Logger.error(`Agent list failed: ${error}`);
@@ -696,7 +813,7 @@ agentCmd
696
813
  .option('--json', 'Output as JSON')
697
814
  .action(async (options) => {
698
815
  try {
699
- await (0, status_3.agentStatusCommand)(options);
816
+ await (0, status_5.agentStatusCommand)(options);
700
817
  }
701
818
  catch (error) {
702
819
  logger_1.Logger.error(`Agent status check failed: ${error}`);
@@ -742,7 +859,7 @@ accessCmd
742
859
  .option('--yes', 'Skip confirmation prompt')
743
860
  .action(async (biocidOrIpId, walletAddress, options) => {
744
861
  try {
745
- await (0, revoke_1.accessRevokeCommand)(biocidOrIpId, walletAddress, options);
862
+ await (0, revoke_3.accessRevokeCommand)(biocidOrIpId, walletAddress, options);
746
863
  }
747
864
  catch (error) {
748
865
  logger_1.Logger.error(`Access revocation failed: ${error}`);
@@ -758,7 +875,7 @@ accessCmd
758
875
  .option('--json', 'Output as JSON')
759
876
  .action(async (biocidOrIpId, options) => {
760
877
  try {
761
- await (0, list_1.accessListCommand)(biocidOrIpId, options);
878
+ await (0, list_2.accessListCommand)(biocidOrIpId, options);
762
879
  }
763
880
  catch (error) {
764
881
  logger_1.Logger.error(`List failed: ${error}`);
@@ -793,6 +910,203 @@ accessCmd
793
910
  process.exit(1);
794
911
  }
795
912
  });
913
+ // ~/genobank/vault commands (v2.9.0 · biovault Phase B)
914
+ // Portable vault: scaffolds ~/genobank/vault/ with a per-BioNFT subdirectory
915
+ // per owned token, then `biofs vault mount` downloads the annotated VCFs via
916
+ // htsget. Works on macOS + Linux without macFUSE kernel signing.
917
+ const vaultCmd = program
918
+ .command('vault')
919
+ .description('Local ~/genobank/vault — your owned BioNFTs as a real directory tree');
920
+ vaultCmd
921
+ .command('setup')
922
+ .description('Scan Sequentia for BioNFTs owned by your wallet and scaffold ~/genobank/vault/')
923
+ .option('--path <dir>', 'override vault path (default: ~/genobank/vault)')
924
+ .option('--force', 're-scaffold even if directory already exists')
925
+ .action(async (options) => {
926
+ try {
927
+ await (0, setup_1.vaultSetupCommand)(options);
928
+ }
929
+ catch (error) {
930
+ logger_1.Logger.error(`vault setup failed: ${error}`);
931
+ process.exit(1);
932
+ }
933
+ });
934
+ vaultCmd
935
+ .command('mount')
936
+ .description('Download BioNFT-gated data (raw + annotated VCFs) into the vault')
937
+ .option('--path <dir>', 'override vault path (default: ~/genobank/vault)')
938
+ .option('--refresh', 'force re-download of existing files')
939
+ .option('--skip-annotated', 'download only raw VCFs, skip OpenCRAVAT annotations')
940
+ .option('--categories <csv>', 'comma-separated BioNFT categories to mount', 'DATA_FILE_CHILD')
941
+ .action(async (options) => {
942
+ try {
943
+ await (0, mount_2.vaultMountCommand)(options);
944
+ }
945
+ catch (error) {
946
+ logger_1.Logger.error(`vault mount failed: ${error}`);
947
+ process.exit(1);
948
+ }
949
+ });
950
+ vaultCmd
951
+ .command('status')
952
+ .description('Show vault state: wallet, BioNFT inventory, per-token file sizes')
953
+ .option('--path <dir>', 'override vault path')
954
+ .action(async (options) => {
955
+ try {
956
+ await (0, status_2.vaultStatusCommand)(options);
957
+ }
958
+ catch (error) {
959
+ logger_1.Logger.error(`vault status failed: ${error}`);
960
+ process.exit(1);
961
+ }
962
+ });
963
+ vaultCmd
964
+ .command('unmount')
965
+ .description('Remove local cache. Manifest preserved unless --purge.')
966
+ .option('--path <dir>', 'override vault path')
967
+ .option('--purge', 'delete the whole vault dir (manifest + all files)')
968
+ .option('--force', 'skip confirmation prompt')
969
+ .action(async (options) => {
970
+ try {
971
+ await (0, unmount_1.vaultUnmountCommand)(options);
972
+ }
973
+ catch (error) {
974
+ logger_1.Logger.error(`vault unmount failed: ${error}`);
975
+ process.exit(1);
976
+ }
977
+ });
978
+ // BioNFT on-chain commands (v2.9.0 · biovault Phase F)
979
+ // Read/revoke any BioNFT (BIOSAMPLE_PARENT, DATA_FILE_CHILD, RENT_AGREEMENT,
980
+ // INGEST_TICKET) directly from Sequentia. No REST hop — ethers talks to the
981
+ // deployed contracts. This replaces `biofs cred revoke` for on-chain credentials
982
+ // and fixes the CherryPy DELETE-body bug we hit in Phase A.7.
983
+ const bionftCmd = program
984
+ .command('bionft')
985
+ .description('View and revoke BioNFTs directly on Sequentia (biovault Phase F)');
986
+ bionftCmd
987
+ .command('view <tokenId>')
988
+ .description('Show on-chain state + metadata for any BioNFT tokenId')
989
+ .option('--json', 'Output as JSON')
990
+ .action(async (tokenId, options) => {
991
+ try {
992
+ await (0, view_1.bionftViewCommand)(tokenId, options);
993
+ }
994
+ catch (error) {
995
+ logger_1.Logger.error(`bionft view failed: ${error}`);
996
+ process.exit(1);
997
+ }
998
+ });
999
+ bionftCmd
1000
+ .command('status <tokenId>')
1001
+ .description('One-line on-chain status of a BioNFT')
1002
+ .action(async (tokenId) => {
1003
+ try {
1004
+ await (0, status_1.bionftStatusCommand)(tokenId);
1005
+ }
1006
+ catch (error) {
1007
+ logger_1.Logger.error(`bionft status failed: ${error}`);
1008
+ process.exit(1);
1009
+ }
1010
+ });
1011
+ bionftCmd
1012
+ .command('revoke <tokenId>')
1013
+ .description('Patient-signed on-chain revoke. RENT_AGREEMENT or INGEST_TICKET only. Requires GENOBANK_OWNER_PRIVATE_KEY.')
1014
+ .option('--reason <text>', 'Why you are revoking', 'user_cli')
1015
+ .option('--force', 'Skip confirmation prompt')
1016
+ .action(async (tokenId, options) => {
1017
+ try {
1018
+ await (0, revoke_1.bionftRevokeCommand)(tokenId, options);
1019
+ }
1020
+ catch (error) {
1021
+ logger_1.Logger.error(`bionft revoke failed: ${error}`);
1022
+ process.exit(1);
1023
+ }
1024
+ });
1025
+ // Scoped write-only credential commands (v2.8.0 · biovault Phase A)
1026
+ const credCmd = program
1027
+ .command('cred')
1028
+ .description('Scoped write-only FASTQ/BAM/VCF upload credentials (biovault)');
1029
+ credCmd
1030
+ .command('issue')
1031
+ .description('Issue a single-use write credential for a biosample (requires BIOFS_LAB_PRIVATE_KEY)')
1032
+ .requiredOption('--biosample <serial>', 'Biosample serial (e.g. 55052008714049)')
1033
+ .requiredOption('--kind <kind>', 'FASTQ | FASTQ_R1 | FASTQ_R2 | BAM | VCF | GVCF', 'FASTQ_R1')
1034
+ .option('--lab-id <id>', 'Laboratory ID (or $GENOBANK_LABORATORY_ID)', (v) => parseInt(v, 10))
1035
+ .option('--source-file <path>', 'Compute size + sha256 from this file (required unless --size/--sha256 given)')
1036
+ .option('--size <bytes>', 'Estimated upload size in bytes', (v) => parseInt(v, 10))
1037
+ .option('--sha256 <hex>', 'Claimed SHA256 hash (64 hex chars)')
1038
+ .option('--filename <name>', 'Logical filename to record server-side')
1039
+ .option('--json', 'Output as JSON')
1040
+ .action(async (options) => {
1041
+ try {
1042
+ await (0, issue_1.credIssueCommand)(options);
1043
+ }
1044
+ catch (error) {
1045
+ logger_1.Logger.error(`cred issue failed: ${error}`);
1046
+ process.exit(1);
1047
+ }
1048
+ });
1049
+ credCmd
1050
+ .command('status <cred_id>')
1051
+ .description('Show the current state of a credential')
1052
+ .option('--json', 'Output as JSON')
1053
+ .action(async (credId, options) => {
1054
+ try {
1055
+ await (0, status_3.credStatusCommand)(credId, options);
1056
+ }
1057
+ catch (error) {
1058
+ logger_1.Logger.error(`cred status failed: ${error}`);
1059
+ process.exit(1);
1060
+ }
1061
+ });
1062
+ credCmd
1063
+ .command('list')
1064
+ .description('List credentials for a biosample')
1065
+ .option('--biosample <serial>', 'Biosample serial')
1066
+ .option('--status <status>', 'Filter by status (issued|consumed|quarantined|burned)')
1067
+ .option('--json', 'Output as JSON')
1068
+ .action(async (options) => {
1069
+ try {
1070
+ await (0, list_1.credListCommand)(options);
1071
+ }
1072
+ catch (error) {
1073
+ logger_1.Logger.error(`cred list failed: ${error}`);
1074
+ process.exit(1);
1075
+ }
1076
+ });
1077
+ credCmd
1078
+ .command('revoke <cred_id>')
1079
+ .description('Owner-signed burn of an unused credential (requires GENOBANK_OWNER_PRIVATE_KEY)')
1080
+ .option('--reason <text>', 'Why you are burning this credential', 'user_cli')
1081
+ .option('--force', 'Skip confirmation prompt')
1082
+ .action(async (credId, options) => {
1083
+ try {
1084
+ await (0, revoke_2.credRevokeCommand)(credId, options);
1085
+ }
1086
+ catch (error) {
1087
+ logger_1.Logger.error(`cred revoke failed: ${error}`);
1088
+ process.exit(1);
1089
+ }
1090
+ });
1091
+ // upload-fastq: thin wrapper around the Python genobank-upload CLI (resumable + resume buffer)
1092
+ program
1093
+ .command('upload-fastq <file>')
1094
+ .description('Upload a FASTQ/BAM/VCF via scoped credential + GCS resumable (wraps genobank-upload)')
1095
+ .requiredOption('--biosample <serial>', 'Biosample serial')
1096
+ .option('--kind <kind>', 'FASTQ | FASTQ_R1 | FASTQ_R2 | BAM | VCF | GVCF', 'FASTQ_R1')
1097
+ .option('--lab-id <id>', 'Laboratory ID (or $GENOBANK_LABORATORY_ID)', (v) => parseInt(v, 10))
1098
+ .option('--api-base <url>', 'Override API base URL')
1099
+ .option('--quiet', 'Suppress progress output')
1100
+ .option('--json', 'Output as JSON on completion')
1101
+ .action(async (file, options) => {
1102
+ try {
1103
+ await (0, upload_fastq_1.uploadFastqCommand)(file, options);
1104
+ }
1105
+ catch (error) {
1106
+ logger_1.Logger.error(`upload-fastq failed: ${error}`);
1107
+ process.exit(1);
1108
+ }
1109
+ });
796
1110
  // BioContext manifest commands (v2.6.0)
797
1111
  const contextCmd = program
798
1112
  .command('context')
@@ -854,74 +1168,13 @@ contextCmd
854
1168
  .option('--reason <string>', 'Revocation reason')
855
1169
  .action(async (key, options) => {
856
1170
  try {
857
- await (0, revoke_2.contextRevokeCommand)(key, options);
1171
+ await (0, revoke_4.contextRevokeCommand)(key, options);
858
1172
  }
859
1173
  catch (error) {
860
1174
  logger_1.Logger.error(`context revoke failed: ${error}`);
861
1175
  process.exit(1);
862
1176
  }
863
1177
  });
864
- // Somos Ancestry commands (v3.0.0 — K=24 ADMIXTURE supervised on Sequentia GCS)
865
- const ancestryCmd = program
866
- .command('ancestry')
867
- .description('Run Somos K=24 ancestry pipeline (PLINK + ADMIXTURE supervised, 781 refs, 24 pops)');
868
- ancestryCmd
869
- .command('run <dtc_file>')
870
- .description('Upload a DTC genotype file and trigger ancestry analysis')
871
- .option('--user-id <id>', 'User identifier (defaults to wallet from biofs login)')
872
- .option('--wait', 'Poll until done, then print results')
873
- .option('--poll-seconds <n>', 'Polling interval (default 30)', '30')
874
- .option('--callback-url <url>', 'Webhook to POST results to when complete')
875
- .option('--json', 'Emit JSON when --wait finishes')
876
- .action(async (dtcFile, opts) => {
877
- try {
878
- await (0, run_1.ancestryRunCommand)(dtcFile, opts);
879
- }
880
- catch (e) {
881
- logger_1.Logger.error(`ancestry run failed: ${e}`);
882
- process.exit(1);
883
- }
884
- });
885
- ancestryCmd
886
- .command('status <task_id>')
887
- .description('Check pipeline status for a task')
888
- .option('--json', 'Output as JSON')
889
- .action(async (taskId, opts) => {
890
- try {
891
- await (0, status_2.ancestryStatusCommand)(taskId, opts);
892
- }
893
- catch (e) {
894
- logger_1.Logger.error(`ancestry status failed: ${e}`);
895
- process.exit(1);
896
- }
897
- });
898
- ancestryCmd
899
- .command('results <task_id>')
900
- .description('Fetch and pretty-print ancestry results (24 populations + 5-region rollup)')
901
- .option('--download <dir>', 'Download all artifacts (CSV, JSON, summary) to <dir>')
902
- .option('--summary', 'Only print the 5-region rollup')
903
- .option('--json', 'Output as JSON')
904
- .action(async (taskId, opts) => {
905
- try {
906
- await (0, results_2.ancestryResultsCommand)(taskId, opts);
907
- }
908
- catch (e) {
909
- logger_1.Logger.error(`ancestry results failed: ${e}`);
910
- process.exit(1);
911
- }
912
- });
913
- ancestryCmd
914
- .command('compare <task_id> <reference_csv>')
915
- .description('Compare this task\'s result against a baseline CSV (e.g. LANGEBIO K=36 regrouped)')
916
- .action(async (taskId, referenceCsv) => {
917
- try {
918
- await (0, compare_1.ancestryCompareCommand)(taskId, referenceCsv);
919
- }
920
- catch (e) {
921
- logger_1.Logger.error(`ancestry compare failed: ${e}`);
922
- process.exit(1);
923
- }
924
- });
925
1178
  // Job management commands (BioOS)
926
1179
  const jobCmd = program
927
1180
  .command('job')
@@ -949,7 +1202,7 @@ jobCmd
949
1202
  .option('--watch', 'Watch mode (refresh every 5 seconds)')
950
1203
  .action(async (jobId, options) => {
951
1204
  try {
952
- await (0, status_1.jobStatusCommand)(jobId, options);
1205
+ await (0, status_4.jobStatusCommand)(jobId, options);
953
1206
  }
954
1207
  catch (error) {
955
1208
  logger_1.Logger.error(`Status check failed: ${error}`);
@@ -980,7 +1233,7 @@ jobCmd
980
1233
  .option('--limit <number>', 'Limit number of results', parseInt)
981
1234
  .action(async (options) => {
982
1235
  try {
983
- await (0, list_2.jobListCommand)(options);
1236
+ await (0, list_3.jobListCommand)(options);
984
1237
  }
985
1238
  catch (error) {
986
1239
  logger_1.Logger.error(`Failed to list jobs: ${error}`);
@@ -1048,7 +1301,7 @@ program
1048
1301
  .option('--verbose', 'Show detailed lab information')
1049
1302
  .action(async (options) => {
1050
1303
  try {
1051
- await (0, list_4.labNFTsCommand)(options);
1304
+ await (0, list_5.labNFTsCommand)(options);
1052
1305
  }
1053
1306
  catch (error) {
1054
1307
  logger_1.Logger.error(`Failed to fetch labs: ${error}`);
@@ -1103,6 +1356,59 @@ program
1103
1356
  process.exit(1);
1104
1357
  }
1105
1358
  });
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) => {
1369
+ try {
1370
+ await (0, resolve_1.resolveCommand)(identifier, options);
1371
+ }
1372
+ catch (error) {
1373
+ logger_1.Logger.error(`Resolve failed: ${error}`);
1374
+ process.exit(1);
1375
+ }
1376
+ });
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)')
1384
+ .option('--json', 'Output as JSON')
1385
+ .option('--verbose', 'Show debug information')
1386
+ .action(async (options) => {
1387
+ try {
1388
+ await (0, match_1.matchCommand)(options);
1389
+ }
1390
+ catch (error) {
1391
+ logger_1.Logger.error(`Match failed: ${error}`);
1392
+ process.exit(1);
1393
+ }
1394
+ });
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)')
1401
+ .option('--json', 'Output as JSON')
1402
+ .option('--verbose', 'Show debug information')
1403
+ .action(async (options) => {
1404
+ try {
1405
+ await (0, ticket_1.ticketCommand)(options);
1406
+ }
1407
+ catch (error) {
1408
+ logger_1.Logger.error(`Ticket command failed: ${error}`);
1409
+ process.exit(1);
1410
+ }
1411
+ });
1106
1412
  // Dissect - GDPR Data Minimization: Extract phenotype-specific SNPs
1107
1413
  // NOW USES SEQUENTIA PROTOCOL BY DEFAULT (solves 0xd4d910b4 Story Protocol error!)
1108
1414
  program
@@ -1143,7 +1449,7 @@ program
1143
1449
  .option('--debug', 'Show debug information')
1144
1450
  .action(async (biocidOrFilename, options) => {
1145
1451
  try {
1146
- await (0, view_1.viewCommand)(biocidOrFilename, options);
1452
+ await (0, view_2.viewCommand)(biocidOrFilename, options);
1147
1453
  }
1148
1454
  catch (error) {
1149
1455
  logger_1.Logger.error(`View failed: ${error}`);
@@ -1190,6 +1496,9 @@ if (process.argv.length === 2) {
1190
1496
  console.log(` ${chalk_1.default.green('share')} - Share with lab (dual NFT)`);
1191
1497
  console.log(` ${chalk_1.default.green('shares')} - View permission graph`);
1192
1498
  console.log(` ${chalk_1.default.green('verify')} - Verify file integrity (Bloom filter)`);
1499
+ console.log(` ${chalk_1.default.green('resolve')} - Resolve biocid via BioRoutes (on-chain)`);
1500
+ console.log(` ${chalk_1.default.green('match')} - Privacy-preserving SNP match (3-stage)`);
1501
+ console.log(` ${chalk_1.default.green('ticket')} - Manage privacy tickets`);
1193
1502
  console.log(` ${chalk_1.default.green('dissect')} - Extract phenotype SNPs (GDPR)`);
1194
1503
  console.log(` ${chalk_1.default.green('access')} - Manage BioNFT access control`);
1195
1504
  console.log(` ${chalk_1.default.green('job')} - Manage research jobs (BioOS)`);