@genobank/biofs 3.21.0 → 3.22.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 (41) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/commands/imaging/package.d.ts +64 -0
  3. package/dist/commands/imaging/package.d.ts.map +1 -0
  4. package/dist/commands/imaging/package.js +235 -0
  5. package/dist/commands/imaging/package.js.map +1 -0
  6. package/dist/commands/inventory-delegate/index.d.ts +28 -0
  7. package/dist/commands/inventory-delegate/index.d.ts.map +1 -0
  8. package/dist/commands/inventory-delegate/index.js +171 -0
  9. package/dist/commands/inventory-delegate/index.js.map +1 -0
  10. package/dist/commands/inventory-list/index.d.ts +33 -0
  11. package/dist/commands/inventory-list/index.d.ts.map +1 -0
  12. package/dist/commands/inventory-list/index.js +74 -0
  13. package/dist/commands/inventory-list/index.js.map +1 -0
  14. package/dist/commands/inventory-register/index.d.ts +8 -0
  15. package/dist/commands/inventory-register/index.d.ts.map +1 -0
  16. package/dist/commands/inventory-register/index.js +57 -0
  17. package/dist/commands/inventory-register/index.js.map +1 -0
  18. package/dist/commands/job-view/index.d.ts +15 -0
  19. package/dist/commands/job-view/index.d.ts.map +1 -0
  20. package/dist/commands/job-view/index.js +88 -0
  21. package/dist/commands/job-view/index.js.map +1 -0
  22. package/dist/commands/neoantigen-pipeline/index.d.ts +35 -1
  23. package/dist/commands/neoantigen-pipeline/index.d.ts.map +1 -1
  24. package/dist/commands/neoantigen-pipeline/index.js +107 -1
  25. package/dist/commands/neoantigen-pipeline/index.js.map +1 -1
  26. package/dist/commands/parabricks/index.d.ts +83 -0
  27. package/dist/commands/parabricks/index.d.ts.map +1 -0
  28. package/dist/commands/parabricks/index.js +340 -0
  29. package/dist/commands/parabricks/index.js.map +1 -0
  30. package/dist/commands/parabricks/registry.json +15100 -0
  31. package/dist/commands/whoami.d.ts +1 -0
  32. package/dist/commands/whoami.d.ts.map +1 -1
  33. package/dist/commands/whoami.js +20 -0
  34. package/dist/commands/whoami.js.map +1 -1
  35. package/dist/index.js +169 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/lib/utils/node_roles.d.ts +16 -0
  38. package/dist/lib/utils/node_roles.d.ts.map +1 -0
  39. package/dist/lib/utils/node_roles.js +34 -0
  40. package/dist/lib/utils/node_roles.js.map +1 -0
  41. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # v3.20.2 — wallet-keyed cache, fuse default host, samples verb, no hardcoded HLA/cassette paths
2
2
 
3
+ ## 3.21.1 (2026-11-14) biofs imaging package
4
+
5
+ New verbs `biofs imaging package <registerJobId> [--organs a,b] [--no-floors] [--wait] [--json]` and `biofs imaging package-status <packageJobId> [--wait]`. They build the organ package of a finished imaging register job on the GPU executor through biofs-node (`POST /agent/submit_organ_package`, `GET /agent/organ_package_status`): per organ and timepoint the native volume, the organ cut out of the CT with its mask, a per-slice table, surface meshes (GLB) in three placements (native, rigid spine frame, and the deformable frame where the register gate allows it) and the volume change from the native volumes, with the scan-edge rule. With floors (the default) each change carries the measured repeatability floor and whether the change is larger than it. The package is decision support for a radiologist, never a diagnosis. The result is registered as an `imaging-organ-package` biocid derived from the register job, only after the package passed its own verify. Status requires the owner signature.
6
+
3
7
  ## 3.21.0 (2026-11-13) neoantigen verbs, Synapse pull, TESLA gate test
4
8
 
5
9
  New verbs, all client side with biocid-only inputs and dispatched through biofs-node: `neoantigen-evidence`, `neoantigen-hla`, `neoantigen-design`, `neoantigen-fusion`, `neoantigen-indel` (each with `submit` and `status`, `--executor auto|worker|local`), `register-derived gcs|read`, `onramp-https`, `somatic-mutect submit --tumor-biocid/--normal-biocid --interval-file`; and two new ones: `synapse-pull submit|status` (third-party controlled-access data from Synapse onto a worker, with an access basis, lineage and no token in the request; `--list-only` for sizes, MD5 and annotations without downloading) and `tesla-gate submit|status` (the registered test of the evidence gate; the code hash, protocol hash and ledger record are required). Status shows the on-chain anchoring state of a finished job.
@@ -0,0 +1,64 @@
1
+ /**
2
+ * biofs imaging package | package-status
3
+ *
4
+ * Builds the organ package of a finished imaging-register job on the GPU executor, through biofs-node.
5
+ * For every organ and timepoint the package holds the native volume, the organ cut out of the CT with its
6
+ * mask, a per-slice table, surface meshes (GLB) in three placements (native, rigid spine frame, and the
7
+ * deformable frame where the register gate allows it) and the volume change between timepoints from the
8
+ * native volumes. With floors (the default) each change carries the measured repeatability floor and a flag
9
+ * saying whether the change is larger than it. The package is decision support for a radiologist, never a
10
+ * diagnosis, and it never calls a change clinically relevant.
11
+ *
12
+ * The result is registered as biocid://genobank/<wallet>/imaging-organ-package/<job>, derived from the register job.
13
+ *
14
+ * Flow:
15
+ * POST /api_biofs_node/submit_organ_package {wallet, signature, register_job_id, floors, organs?}
16
+ * GET /api_biofs_node/organ_package_status?package_job_id=... (owner signature in a header)
17
+ */
18
+ export interface ImagingPackageOptions {
19
+ organs?: string;
20
+ floors?: boolean;
21
+ wait?: boolean;
22
+ quiet?: boolean;
23
+ json?: boolean;
24
+ }
25
+ export interface ImagingPackageStatusOptions {
26
+ wait?: boolean;
27
+ quiet?: boolean;
28
+ json?: boolean;
29
+ }
30
+ export declare const REGISTER_ID_RE: RegExp;
31
+ export declare const PACKAGE_ID_RE: RegExp;
32
+ interface PackageResult {
33
+ schema?: string;
34
+ output_gcs?: string;
35
+ files?: number;
36
+ bytes?: number;
37
+ verify?: {
38
+ ok?: boolean;
39
+ };
40
+ floors_sha256?: string | null;
41
+ organs_built?: number;
42
+ built_at?: string;
43
+ error?: string;
44
+ }
45
+ export interface PackageRow {
46
+ package_job_id: string;
47
+ status: string;
48
+ register_job_id?: string;
49
+ organs?: string | string[];
50
+ floors?: boolean;
51
+ gate_verdict?: string | null;
52
+ error?: string;
53
+ output_biocid?: string;
54
+ registry_error?: string;
55
+ result?: PackageResult;
56
+ }
57
+ /** "liver, spleen" to ["liver", "spleen"]; empty entries dropped. */
58
+ export declare function parseOrgans(v: string | undefined): string[] | undefined;
59
+ export declare function printPackageRow(row: PackageRow): void;
60
+ export declare function waitForPackage(jobId: string, signature: string, quiet?: boolean): Promise<PackageRow | null>;
61
+ export declare function imagingPackageCommand(registerJobId: string, options?: ImagingPackageOptions): Promise<string | null>;
62
+ export declare function imagingPackageStatusCommand(jobId: string, options?: ImagingPackageStatusOptions): Promise<PackageRow | null>;
63
+ export {};
64
+ //# sourceMappingURL=package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../../src/commands/imaging/package.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAKD,eAAO,MAAM,cAAc,QAA6B,CAAC;AACzD,eAAO,MAAM,aAAa,QAA4B,CAAC;AAEvD,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAChG,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzF;AACD,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC/G,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,aAAa,CAAC;CACvH;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CAGvE;AAMD,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAarD;AAaD,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAqClH;AAED,wBAAsB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA8C9H;AAED,wBAAsB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,2BAAgC,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAoBtI"}
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ /**
3
+ * biofs imaging package | package-status
4
+ *
5
+ * Builds the organ package of a finished imaging-register job on the GPU executor, through biofs-node.
6
+ * For every organ and timepoint the package holds the native volume, the organ cut out of the CT with its
7
+ * mask, a per-slice table, surface meshes (GLB) in three placements (native, rigid spine frame, and the
8
+ * deformable frame where the register gate allows it) and the volume change between timepoints from the
9
+ * native volumes. With floors (the default) each change carries the measured repeatability floor and a flag
10
+ * saying whether the change is larger than it. The package is decision support for a radiologist, never a
11
+ * diagnosis, and it never calls a change clinically relevant.
12
+ *
13
+ * The result is registered as biocid://genobank/<wallet>/imaging-organ-package/<job>, derived from the register job.
14
+ *
15
+ * Flow:
16
+ * POST /api_biofs_node/submit_organ_package {wallet, signature, register_job_id, floors, organs?}
17
+ * GET /api_biofs_node/organ_package_status?package_job_id=... (owner signature in a header)
18
+ */
19
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20
+ return (mod && mod.__esModule) ? mod : { "default": mod };
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.PACKAGE_ID_RE = exports.REGISTER_ID_RE = void 0;
24
+ exports.parseOrgans = parseOrgans;
25
+ exports.printPackageRow = printPackageRow;
26
+ exports.waitForPackage = waitForPackage;
27
+ exports.imagingPackageCommand = imagingPackageCommand;
28
+ exports.imagingPackageStatusCommand = imagingPackageStatusCommand;
29
+ const chalk_1 = __importDefault(require("chalk"));
30
+ const ora_1 = __importDefault(require("ora"));
31
+ const axios_1 = __importDefault(require("axios"));
32
+ const credentials_1 = require("../../lib/auth/credentials");
33
+ const logger_1 = require("../../lib/utils/logger");
34
+ const BIOFS_NODE_BASE = process.env.BIOFS_NODE_URL
35
+ || `${process.env.GENOBANK_API_URL || 'https://genobank.app'}/api_biofs_node`;
36
+ exports.REGISTER_ID_RE = /^register-[0-9a-f-]{36}$/;
37
+ exports.PACKAGE_ID_RE = /^package-[0-9a-f-]{36}$/;
38
+ /** "liver, spleen" to ["liver", "spleen"]; empty entries dropped. */
39
+ function parseOrgans(v) {
40
+ if (v === undefined)
41
+ return undefined;
42
+ return v.split(',').map((s) => s.trim()).filter(Boolean);
43
+ }
44
+ function megabytes(b) {
45
+ return typeof b === 'number' ? `${(b / 1e6).toFixed(1)} MB` : '-';
46
+ }
47
+ function printPackageRow(row) {
48
+ console.log(chalk_1.default.bold(`package job ${row.package_job_id}: ${row.status}`));
49
+ const org = Array.isArray(row.organs) ? `${row.organs.length} named organs` : 'default organ list';
50
+ console.log(` register job ${row.register_job_id || '-'} gate ${row.gate_verdict || '-'} floors ${row.floors === false ? 'off' : 'on'} requested: ${org}`);
51
+ const r = row.result;
52
+ if (row.status === 'error') {
53
+ console.log(chalk_1.default.red(` error: ${row.error || r?.error || 'unknown'}`));
54
+ return;
55
+ }
56
+ if (!r)
57
+ return;
58
+ const built = typeof r.organs_built === 'number' ? `${r.organs_built} organs` : org;
59
+ const ok = r.verify?.ok === true;
60
+ console.log(` ${built}, ${r.files ?? '-'} files, ${megabytes(r.bytes)}, verify ${ok ? chalk_1.default.green('OK') : chalk_1.default.red('FAILED')}`
61
+ + (r.floors_sha256 ? `, floors ${r.floors_sha256.slice(0, 16)}` : ''));
62
+ if (row.output_biocid)
63
+ console.log(chalk_1.default.gray(` biocid: ${row.output_biocid}`));
64
+ if (row.registry_error)
65
+ console.log(chalk_1.default.yellow(` biocid registration: ${row.registry_error}`));
66
+ }
67
+ async function fetchStatus(jobId, signature) {
68
+ const resp = await axios_1.default.get(`${BIOFS_NODE_BASE}/organ_package_status`, {
69
+ params: { package_job_id: jobId },
70
+ headers: { 'x-biofs-signature': signature },
71
+ timeout: 30000, validateStatus: (s) => s < 500,
72
+ });
73
+ return { status: resp.status, data: resp.data };
74
+ }
75
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
76
+ async function waitForPackage(jobId, signature, quiet) {
77
+ const spin = quiet ? null : (0, ora_1.default)(`waiting for package job ${jobId} on the GPU executor ...`).start();
78
+ // A wrong id or a job of another wallet fails at once. After the job has answered once, a dropped connection or an
79
+ // error reply is retried for about 10 minutes (30 tries, 20 s apart) before the wait gives up.
80
+ const first = await fetchStatus(jobId, signature);
81
+ if (first.status >= 400) {
82
+ spin?.fail(`organ_package_status ${first.status}: ${first.data?.error || 'unknown'}`);
83
+ return null;
84
+ }
85
+ if (first.data.status === 'done' || first.data.status === 'error') {
86
+ if (first.data.status === 'done')
87
+ spin?.succeed('package job done');
88
+ else
89
+ spin?.fail(`package job error: ${first.data.error || first.data.result?.error || 'unknown'}`);
90
+ return first.data;
91
+ }
92
+ const deadline = Date.now() + 3 * 60 * 60000; // 3 h ceiling
93
+ let failures = 0;
94
+ while (Date.now() < deadline) {
95
+ await sleep(20000);
96
+ let status = 0;
97
+ let data = {};
98
+ let problem = '';
99
+ try {
100
+ ({ status, data } = await fetchStatus(jobId, signature));
101
+ if (status >= 400)
102
+ problem = `organ_package_status ${status}: ${data?.error || 'unknown'}`;
103
+ }
104
+ catch (e) {
105
+ problem = `organ_package_status unreachable: ${e?.message || e}`;
106
+ }
107
+ if (problem) {
108
+ if (++failures >= 30) {
109
+ spin?.fail(problem);
110
+ return null;
111
+ }
112
+ if (spin)
113
+ spin.text = `package job ${jobId}: ${problem}, retrying`;
114
+ continue;
115
+ }
116
+ failures = 0;
117
+ if (data.status === 'done' || data.status === 'error') {
118
+ if (data.status === 'done')
119
+ spin?.succeed('package job done');
120
+ else
121
+ spin?.fail(`package job error: ${data.error || data.result?.error || 'unknown'}`);
122
+ return data;
123
+ }
124
+ if (spin)
125
+ spin.text = `package job ${jobId}: ${data.status}`;
126
+ }
127
+ spin?.warn('wait timeout; the job may still be running. Check with: biofs imaging package-status ' + jobId);
128
+ return null;
129
+ }
130
+ async function imagingPackageCommand(registerJobId, options = {}) {
131
+ const quiet = !!(options.quiet || options.json);
132
+ const fail = (msg) => {
133
+ if (!quiet)
134
+ console.error(chalk_1.default.red(msg));
135
+ else
136
+ logger_1.Logger.error(msg);
137
+ process.exitCode = 1;
138
+ return null;
139
+ };
140
+ if (!exports.REGISTER_ID_RE.test(String(registerJobId || '')))
141
+ return fail('give the id of a finished register job: register-<uuid>');
142
+ const organs = parseOrgans(options.organs);
143
+ if (organs !== undefined && organs.length === 0)
144
+ return fail('--organs needs at least one organ name, comma separated (for example liver,spleen)');
145
+ const spinner = quiet ? null : (0, ora_1.default)('biofs imaging package → biofs-node').start();
146
+ try {
147
+ const credentials = await (0, credentials_1.getCredentials)();
148
+ if (!credentials) {
149
+ spinner?.fail('Not authenticated. Run: biofs login');
150
+ process.exitCode = 1;
151
+ return null;
152
+ }
153
+ const body = {
154
+ wallet: credentials.wallet_address,
155
+ signature: credentials.user_signature,
156
+ register_job_id: registerJobId,
157
+ floors: options.floors !== false,
158
+ };
159
+ if (organs !== undefined)
160
+ body.organs = organs;
161
+ const resp = await axios_1.default.post(`${BIOFS_NODE_BASE}/submit_organ_package`, body, { timeout: 120000, validateStatus: (s) => s < 500 });
162
+ if (resp.status >= 400) {
163
+ spinner?.fail(`submit_organ_package ${resp.status}: ${resp.data?.error || 'unknown'}`);
164
+ if (options.json)
165
+ console.log(JSON.stringify(resp.data, null, 2));
166
+ process.exitCode = 1;
167
+ return null;
168
+ }
169
+ const sub = resp.data;
170
+ spinner?.succeed(`package_job_id=${sub.package_job_id} (register ${sub.register_job_id}, gate ${sub.gate_verdict ?? '-'}, floors ${sub.floors === false ? 'off' : 'on'})`);
171
+ if (!options.wait) {
172
+ if (options.json)
173
+ console.log(JSON.stringify(sub, null, 2));
174
+ else if (!options.quiet)
175
+ console.log(chalk_1.default.cyan(` follow with: biofs imaging package-status ${sub.package_job_id} --wait`));
176
+ return sub.package_job_id;
177
+ }
178
+ const row = await waitForPackage(sub.package_job_id, credentials.user_signature, quiet);
179
+ if (row) {
180
+ if (options.json)
181
+ console.log(JSON.stringify(row, null, 2));
182
+ else if (!options.quiet)
183
+ printPackageRow(row);
184
+ }
185
+ return sub.package_job_id;
186
+ }
187
+ catch (err) {
188
+ const msg = err?.response?.data?.error || err?.message || String(err);
189
+ spinner?.fail(`imaging package failed: ${msg}`);
190
+ logger_1.Logger.error(`imaging package failed: ${msg}`);
191
+ process.exitCode = 1;
192
+ return null;
193
+ }
194
+ }
195
+ async function imagingPackageStatusCommand(jobId, options = {}) {
196
+ try {
197
+ if (!exports.PACKAGE_ID_RE.test(String(jobId || ''))) {
198
+ console.error(chalk_1.default.red('give a package job id: package-<uuid>'));
199
+ process.exitCode = 1;
200
+ return null;
201
+ }
202
+ const credentials = await (0, credentials_1.getCredentials)();
203
+ if (!credentials) {
204
+ console.error('Not authenticated. Run: biofs login');
205
+ process.exitCode = 1;
206
+ return null;
207
+ }
208
+ let row;
209
+ if (options.wait)
210
+ row = await waitForPackage(jobId, credentials.user_signature, options.quiet || options.json);
211
+ else {
212
+ const { status, data } = await fetchStatus(jobId, credentials.user_signature);
213
+ if (status >= 400) {
214
+ console.error(chalk_1.default.red(`organ_package_status ${status}: ${data?.error || 'unknown'}`));
215
+ process.exitCode = 1;
216
+ return null;
217
+ }
218
+ row = data;
219
+ }
220
+ if (row) {
221
+ if (options.json)
222
+ console.log(JSON.stringify(row, null, 2));
223
+ else if (!options.quiet)
224
+ printPackageRow(row);
225
+ }
226
+ return row;
227
+ }
228
+ catch (err) {
229
+ const msg = err?.response?.data?.error || err?.message || String(err);
230
+ logger_1.Logger.error(`imaging package-status failed: ${msg}`);
231
+ process.exitCode = 1;
232
+ return null;
233
+ }
234
+ }
235
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/commands/imaging/package.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;AAsCH,kCAGC;AAMD,0CAaC;AAaD,wCAqCC;AAED,sDA8CC;AAED,kEAoBC;AAlLD,kDAA0B;AAC1B,8CAAsB;AACtB,kDAA0B;AAC1B,4DAA4D;AAC5D,mDAAgD;AAgBhD,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc;OAC7C,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,sBAAsB,iBAAiB,CAAC;AAEnE,QAAA,cAAc,GAAG,0BAA0B,CAAC;AAC5C,QAAA,aAAa,GAAG,yBAAyB,CAAC;AAWvD,qEAAqE;AACrE,SAAgB,WAAW,CAAC,CAAqB;IAC/C,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACtC,OAA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,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;iBAAM,IAAI,CAAC,OAAO,CAAC,KAAK;gBAAE,eAAe,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;QACxH,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,MAAM,GAAG,GAAG,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,IAAI,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;QACtE,eAAM,CAAC,KAAK,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ export interface DelegateOptions {
2
+ from: string;
3
+ to: string;
4
+ attest: string;
5
+ operator?: string[];
6
+ signature?: string;
7
+ nonce?: string;
8
+ expires?: string;
9
+ expiresHours?: string;
10
+ yes?: boolean;
11
+ json?: boolean;
12
+ }
13
+ export interface DelegationFields {
14
+ from: string;
15
+ to: string;
16
+ operators: string[];
17
+ biocids: string[];
18
+ attestation: string;
19
+ nonce: string;
20
+ expires: string;
21
+ }
22
+ export declare const biocidsDigest: (biocids: string[]) => string;
23
+ export declare const attestationDigest: (text: string) => string;
24
+ export declare function buildMessage(f: DelegationFields): string;
25
+ export declare function buildFields(biocids: string[], o: DelegateOptions, callerWallet: string, nowMs: number): DelegationFields;
26
+ export declare function buildDelegateBody(f: DelegationFields, signature: string, yes: boolean): Record<string, unknown>;
27
+ export declare function inventoryDelegateCommand(biocids: string[], options: DelegateOptions): Promise<void>;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/inventory-delegate/index.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,eAAe;IAC9B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";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.attestationDigest = exports.biocidsDigest = void 0;
40
+ exports.buildMessage = buildMessage;
41
+ exports.buildFields = buildFields;
42
+ exports.buildDelegateBody = buildDelegateBody;
43
+ exports.inventoryDelegateCommand = inventoryDelegateCommand;
44
+ /**
45
+ * biofs inventory-delegate <biocids...> --from <owner wallet> --to <new owner wallet> --attest "<basis>" [--operator <wallet...>] [--signature 0x..] [--nonce n --expires iso] [--yes]
46
+ *
47
+ * OWNERSHIP DELEGATION by signature. The current owner (a MetaMask wallet) signs one personal_sign message that hands the named biofiles to a new owner wallet while naming the operator
48
+ * wallet(s) that keep the right to run bioinformatics pipelines on them and deliver the results into the new owner's tree. Two steps, one verb:
49
+ * 1. without --signature: prints the exact message (and saves it) plus the nonce and expiry; nothing is sent.
50
+ * 2. with --signature (the MetaMask personal_sign result), --nonce and --expires from step 1: biofs-node (POST /agent/inventory_delegate) rebuilds the same message, recovers the signer,
51
+ * and moves a row only when its present owner is that signer. Dry run unless --yes. Ownerless rows are refused, never given an owner. Previous values are kept (claim_prev).
52
+ * A thin client: the message builder below must stay byte-identical to the node's src/lib/inventory_delegate.js (test vectors in both repos).
53
+ */
54
+ const axios_1 = __importDefault(require("axios"));
55
+ const chalk_1 = __importDefault(require("chalk"));
56
+ const crypto_1 = require("crypto");
57
+ const fs = __importStar(require("fs"));
58
+ const os = __importStar(require("os"));
59
+ const path = __importStar(require("path"));
60
+ const credentials_1 = require("../../lib/auth/credentials");
61
+ const node_roles_1 = require("../../lib/utils/node_roles");
62
+ const BIOFS_NODE_BASE = process.env.BIOFS_NODE_URL
63
+ || `${process.env.GENOBANK_API_URL || 'https://genobank.app'}/api_biofs_node`;
64
+ const BIOCID_RE = /^biocid:\/\/[A-Za-z0-9_-]+\/0x[0-9a-fA-F]{40}\/[A-Za-z0-9_-]+\/\S+$/;
65
+ const WALLET_RE = /^0x[0-9a-fA-F]{40}$/;
66
+ const sha256 = (s) => (0, crypto_1.createHash)('sha256').update(s, 'utf8').digest('hex');
67
+ const lc = (s) => String(s || '').toLowerCase();
68
+ const biocidsDigest = (biocids) => sha256([...biocids].sort().join('\n'));
69
+ exports.biocidsDigest = biocidsDigest;
70
+ const attestationDigest = (text) => sha256(String(text || '').replace(/\s+/g, ' ').trim());
71
+ exports.attestationDigest = attestationDigest;
72
+ function buildMessage(f) {
73
+ const ops = [...new Set(f.operators.map(lc))].sort().join(', ');
74
+ return [
75
+ 'GenoBank.io ownership delegation v1',
76
+ 'Action: hand ownership of the listed biofiles to the new owner; the named operators keep the right to run pipelines on them and deliver results to the new owner',
77
+ `From owner: ${lc(f.from)}`,
78
+ `To owner: ${lc(f.to)}`,
79
+ `Operators retained: ${ops}`,
80
+ `Files: ${f.biocids.length}`,
81
+ `Files digest (sha256 of the sorted biocids, one per line): ${(0, exports.biocidsDigest)(f.biocids)}`,
82
+ `Attestation digest (sha256): ${(0, exports.attestationDigest)(f.attestation)}`,
83
+ `Nonce: ${f.nonce}`,
84
+ `Expires: ${f.expires}`,
85
+ ].join('\n');
86
+ }
87
+ function buildFields(biocids, o, callerWallet, nowMs) {
88
+ if (!biocids.length)
89
+ throw new Error('give at least one biocid');
90
+ if (biocids.length > 50)
91
+ throw new Error('at most 50 biocids per delegation');
92
+ if (new Set(biocids).size !== biocids.length)
93
+ throw new Error('duplicate biocids');
94
+ for (const b of biocids)
95
+ if (!BIOCID_RE.test(b))
96
+ throw new Error(`not a biocid (a gs:// path, URL or file name is never accepted): ${b}`);
97
+ if (!WALLET_RE.test(o.from || ''))
98
+ throw new Error('--from must be the current owner\'s wallet (0x plus 40 hex)');
99
+ if (!WALLET_RE.test(o.to || ''))
100
+ throw new Error('--to must be the new owner\'s wallet (0x plus 40 hex)');
101
+ if (lc(o.from) === lc(o.to))
102
+ throw new Error('--from and --to are the same wallet');
103
+ const attestation = String(o.attest || '').replace(/\s+/g, ' ').trim();
104
+ if (attestation.length < 20 || attestation.length > 600)
105
+ throw new Error('--attest needs 20 to 600 characters: the basis on which the owner hands these files over');
106
+ const operators = (o.operator && o.operator.length ? o.operator : [o.from, callerWallet]).filter(Boolean);
107
+ for (const w of operators)
108
+ if (!WALLET_RE.test(w))
109
+ throw new Error(`--operator is not a wallet: ${w}`);
110
+ const nonce = o.nonce || (0, crypto_1.randomBytes)(16).toString('hex');
111
+ if (!/^[0-9a-f]{32}$/.test(nonce))
112
+ throw new Error('--nonce must be 32 lowercase hex characters');
113
+ let expires = o.expires;
114
+ if (!expires) {
115
+ const h = o.expiresHours === undefined ? 24 : parseFloat(o.expiresHours);
116
+ if (!Number.isFinite(h) || h <= 0 || h > 168)
117
+ throw new Error('--expires-hours must be between 0 and 168 (7 days)');
118
+ expires = new Date(nowMs + Math.round(h * 3600 * 1000)).toISOString();
119
+ }
120
+ return { from: o.from, to: o.to, operators, biocids, attestation, nonce, expires };
121
+ }
122
+ function buildDelegateBody(f, signature, yes) {
123
+ if (!/^0x[0-9a-fA-F]{130}$/.test(signature))
124
+ throw new Error('--signature must be the personal_sign result (0x plus 130 hex characters)');
125
+ return { biocids: f.biocids, from: f.from, to: f.to, operators: f.operators, attestation: f.attestation, nonce: f.nonce, expires: f.expires, signature, dry_run: !yes };
126
+ }
127
+ async function inventoryDelegateCommand(biocids, options) {
128
+ const credentials = await (0, credentials_1.getCredentials)();
129
+ if (!credentials)
130
+ throw new Error('Not authenticated. Run "biofs login" first.');
131
+ if (options.signature && !(options.nonce && options.expires))
132
+ throw new Error('with --signature give the --nonce and --expires printed by the first step (they are part of what was signed)');
133
+ const f = buildFields(biocids, options, credentials.wallet_address, Date.now());
134
+ const message = buildMessage(f);
135
+ if (!options.signature) {
136
+ const dir = path.join(os.homedir(), '.biofs', 'delegations');
137
+ fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
138
+ const file = path.join(dir, `${f.nonce}.txt`);
139
+ fs.writeFileSync(file, message + '\n', { mode: 0o600 });
140
+ console.log(chalk_1.default.bold('Step 1 of 2. Nothing was sent. Sign this exact message with personal_sign in the wallet of the current owner (MetaMask):'));
141
+ console.log('');
142
+ console.log(message);
143
+ console.log('');
144
+ console.log(chalk_1.default.gray(`Saved to ${file}. It is valid until ${f.expires}; the nonce can be used once.`));
145
+ console.log(chalk_1.default.bold('Step 2: send it (dry run first, then add --yes):'));
146
+ console.log(` biofs inventory-delegate ${biocids.join(' ')} --from ${f.from} --to ${f.to} --operator ${f.operators.join(' ')} --attest "${f.attestation}" --nonce ${f.nonce} --expires ${f.expires} --signature <0x...>`);
147
+ return;
148
+ }
149
+ const body = buildDelegateBody(f, options.signature, !!options.yes);
150
+ const headers = { 'X-Biofs-Wallet': credentials.wallet_address, 'X-Biofs-Signature': credentials.user_signature };
151
+ const r = await axios_1.default.post(`${BIOFS_NODE_BASE}/inventory_delegate`, body, { headers, timeout: 60000, validateStatus: (s) => s < 500 });
152
+ if (r.status >= 400)
153
+ throw new Error((0, node_roles_1.nodeErrorMessage)(r.status, r.data?.error));
154
+ if (options.json) {
155
+ console.log(JSON.stringify(r.data, null, 2));
156
+ return;
157
+ }
158
+ const d = r.data;
159
+ console.log(chalk_1.default.bold(d.dry_run ? 'Dry run: nothing was written. Add --yes to delegate.' : 'Delegated.'));
160
+ for (const x of d.delegated || [])
161
+ console.log(chalk_1.default.green(` ${d.dry_run ? 'would delegate' : 'delegated'} ${x.biocid} ${x.previous_owner} -> ${x.new_owner}${x.registry_row ? ' (registry row too)' : ''}`));
162
+ for (const x of d.exists || [])
163
+ console.log(chalk_1.default.gray(` already owned by the new owner ${x}`));
164
+ for (const x of d.errors || [])
165
+ console.log(chalk_1.default.red(` refused ${x.biocid}: ${x.reason}`));
166
+ if (d.refused_all)
167
+ console.log(chalk_1.default.red(' Nothing was written: one refused file stops the whole delegation.'));
168
+ if ((d.errors || []).length)
169
+ process.exitCode = 1;
170
+ }
171
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/inventory-delegate/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,oCAcC;AAED,kCAqBC;AAED,8CAGC;AAED,4DAkCC;AA5HD;;;;;;;;;GASG;AACH,kDAA0B;AAC1B,kDAA0B;AAC1B,mCAAiD;AACjD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,4DAA4D;AAC5D,2DAA8D;AAE9D,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc;OAC7C,GAAG,OAAO,CAAC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AAc,OAAO,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAClN,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE;QAAE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,qCAAqC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClG,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE;QAAE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9F,IAAI,CAAC,CAAC,WAAW;QAAE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC,CAAC;IACjH,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,33 @@
1
+ export interface InventoryListOptions {
2
+ serial?: string[];
3
+ lab?: string;
4
+ type?: string[];
5
+ limit?: string;
6
+ json?: boolean;
7
+ }
8
+ export interface InventoryRow {
9
+ biocid: string | null;
10
+ sample_serial: string | null;
11
+ filetype: string | null;
12
+ owner_wallet: string | null;
13
+ originlab: string | null;
14
+ bucket: string | null;
15
+ object: string | null;
16
+ size: number | null;
17
+ hierarchy_role: string | null;
18
+ orphan_status: string | null;
19
+ }
20
+ export declare function buildInventoryListBody(options: InventoryListOptions): Record<string, unknown>;
21
+ /** One line per distinct file (serial, type, object name); the number of copies and the distinct buckets are kept. */
22
+ export declare function groupRows(rows: InventoryRow[]): Array<{
23
+ serial: string;
24
+ type: string;
25
+ name: string;
26
+ size: number | null;
27
+ owner: string | null;
28
+ copies: number;
29
+ buckets: string[];
30
+ biocids: string[];
31
+ }>;
32
+ export declare function inventoryListCommand(options: InventoryListOptions): Promise<void>;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/inventory-list/index.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACpI,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAChI;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAW7F;AAED,sHAAsH;AACtH,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EA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