@genobank/biofs 3.20.6 → 3.20.8
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.
- package/CHANGELOG.md +8 -0
- package/dist/commands/erase-trial.d.ts +21 -0
- package/dist/commands/erase-trial.d.ts.map +1 -0
- package/dist/commands/erase-trial.js +340 -0
- package/dist/commands/erase-trial.js.map +1 -0
- package/dist/commands/imaging/register.d.ts +87 -0
- package/dist/commands/imaging/register.d.ts.map +1 -0
- package/dist/commands/imaging/register.js +240 -0
- package/dist/commands/imaging/register.js.map +1 -0
- package/dist/index.js +69 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# v3.20.2 — wallet-keyed cache, fuse default host, samples verb, no hardcoded HLA/cassette paths
|
|
2
2
|
|
|
3
|
+
## 3.20.8 (2026-10-26) biofs erase-trial
|
|
4
|
+
|
|
5
|
+
New verb `biofs erase-trial` measures the deployed consent and erasure paths on a SYNTHETIC biosample (a generated VCF with no real genotypes, a serial prefix no laboratory issues), never on anyone's biology. `run` builds the serial, grants it, reads it, erases it through the same endpoint `biofs erase` calls, and records what remains (live object, every generation, soft-deleted copies, registry rows, grants, `checkPermission`). `grantee` grants the serial to a throwaway wallet generated for the run (its key is never stored), reads as the grantee, presents the same signature again, revokes, and reads again as the grantee, the owner and a never-granted control wallet, so what revocation blocks while the data remain available is measured; it erases nothing. `inspect <serial>`, `cleanup <serial>` and `read <serial>` report, remove what an erasure left behind for a trial serial, and record one gated read. Reports are written to `~/.biofs/erase-trial/<serial>.json`. Needs biofs-node with `POST /agent/erase_trial`.
|
|
6
|
+
|
|
7
|
+
## 3.20.7 (2026-10-23) biofs imaging register
|
|
8
|
+
|
|
9
|
+
New verbs `biofs imaging register --tp <label>=<study> ... [--reference <label>] [--anatomy chest|abdomen] [--protocol-mode auto|same|cross] [--series <label>=<series>] [--wait] [--json]` and `biofs imaging register-status <job> [--wait]`. They register N CT timepoints into one reference frame on the GPU executor through biofs-node (`POST /agent/submit_imaging_register`, `GET /agent/imaging_register_status`), coarse to fine: a rigid fit to the vertebrae that TotalSegmentator segmented consistently in both scans plus the sternum, rigid refinement on the vertebral column, then a piecewise deformable stage (ANTs SyN) in which the lungs, the viscera that move with the diaphragm (heart, inferior vena cava, liver, spleen, kidneys, pancreas; stomach and bowel follow without driving it) and the rest of the body are registered separately, so organs can slide against the rib cage as they do with breathing. Every stage is measured: surface distance of the whole bony spine (all vertebra labels merged, so a level-labeling difference between scans cannot bias it), of each lung, of the liver and of the spleen, per-structure Dice, centroid error of the consistently segmented vertebrae, Jacobian folding per region, bone rigidity, and A->B->C against A->C with three or more timepoints. The verdict (PASS, PASS_WITH_WARNINGS or FAIL) is computed against thresholds written into the result; a chest study is judged hard on the lungs and the spine, an abdominal study on the liver, the spleen and the spine. The executor container is `containers/imaging-register` (Dockerfile, `register.py`, unit and smoke tests). biofs-node checks that each study belongs to the signer and picks each series by comparability with the reference, recording why; cross-protocol pairs are registered for geometry and flagged as not comparable voxel to voxel. The result is registered as an `imaging-register` biocid whose parents are the source DICOM biocids. Status requires the owner signature.
|
|
10
|
+
|
|
3
11
|
## 3.20.6 (2026-10-23) biofs carbonx
|
|
4
12
|
|
|
5
13
|
New verb `biofs carbonx` screens one biofile the signer owns for variant pathogenicity with Carbon-X (HuggingFaceBio/Carbon-X, a 14.8B DNA and text language model served by vLLM on a GenoBank.io GPU VM). `biofs carbonx score <biocid> [--window 4096] [--max-plp] [--max-vus] [--max-conflicting] [--max-blb] [--plan-only] [--wait]` calls biofs-node `POST /agent/carbonx_score` for a germline VCF (GRCh38 or GRCh37) or a SOMOS/23andMe genotype file; the node resolves the biocid, refuses it unless the signer owns it, keeps the alternate-allele calls that match a pinned ClinVar release exactly, asks Carbon-X about each one without the gene name or the ClinVar label, measures the answers against those labels and ranks the uncertain calls. `biofs carbonx status <job>` reports progress and metrics; `biofs carbonx report <job> [--format json] [--out file]` reads the registered report through the owner-only `derived_read`. Research output, not a clinical test. Needs biofs-node with the carbonx endpoints.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface EraseTrialOptions {
|
|
2
|
+
json?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function eraseTrialRunCommand(options: EraseTrialOptions): Promise<void>;
|
|
5
|
+
export declare function eraseTrialNodeCommand(action: 'inspect' | 'cleanup', serial: string, options: EraseTrialOptions): Promise<void>;
|
|
6
|
+
/** `biofs erase-trial read <serial>`: one gated read of the trial object as the signer, so the
|
|
7
|
+
* gate's decision after an erasure is recorded (403 = refused by the gate; 500 carrying a
|
|
8
|
+
* storage not-found = admitted by the gate, bytes gone). Appended to the serial's report. */
|
|
9
|
+
export declare function eraseTrialReadCommand(serial: string, options: EraseTrialOptions): Promise<void>;
|
|
10
|
+
/** `biofs erase-trial grantee`: what revocation blocks while the data remain available.
|
|
11
|
+
*
|
|
12
|
+
* Builds a synthetic biosample, grants it to the signer (the owner), then to a throwaway
|
|
13
|
+
* grantee wallet generated for this run (its key is never written anywhere), and records:
|
|
14
|
+
* the grantee's read admitted, the SAME captured signature presented again admitted (the
|
|
15
|
+
* fixed message has no nonce), the owner's read, a never-granted control wallet refused,
|
|
16
|
+
* then revokes the grantee and records the grantee's read (expect 403 from the gate while
|
|
17
|
+
* the live object still exists), the replayed signature, the control, the owner's read
|
|
18
|
+
* (expect admitted: the owner path does not depend on the grant), checkPermission for the
|
|
19
|
+
* grantee on both path shapes, and the object and grant state. Nothing is erased. */
|
|
20
|
+
export declare function eraseTrialGranteeCommand(options: EraseTrialOptions): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=erase-trial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erase-trial.d.ts","sourceRoot":"","sources":["../../src/commands/erase-trial.ts"],"names":[],"mappings":"AAiCA,MAAM,WAAW,iBAAiB;IAAG,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE;AAwCrD,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwEpF;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBpI;AAED;;8FAE8F;AAC9F,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBrG;AAED;;;;;;;;;sFASsF;AACtF,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqFxF"}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
"use strict";
|
|
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.eraseTrialRunCommand = eraseTrialRunCommand;
|
|
40
|
+
exports.eraseTrialNodeCommand = eraseTrialNodeCommand;
|
|
41
|
+
exports.eraseTrialReadCommand = eraseTrialReadCommand;
|
|
42
|
+
exports.eraseTrialGranteeCommand = eraseTrialGranteeCommand;
|
|
43
|
+
/**
|
|
44
|
+
* biofs erase-trial run|inspect|cleanup
|
|
45
|
+
*
|
|
46
|
+
* CLIENT verb. Exercises GDPR Article 17 erasure end to end on a SYNTHETIC biosample, so the
|
|
47
|
+
* deployed `biofs erase` path can be measured without touching anyone's biology.
|
|
48
|
+
*
|
|
49
|
+
* biofs erase-trial run # build a synthetic serial, grant, read, erase, re-check
|
|
50
|
+
* biofs erase-trial inspect <serial> # what still exists for a trial serial
|
|
51
|
+
* biofs erase-trial cleanup <serial> # remove what erase left behind (synthetic rows only)
|
|
52
|
+
*
|
|
53
|
+
* `run` drives only production code paths: biofs-node builds the synthetic object and its
|
|
54
|
+
* registry rows (POST /agent/erase_trial), the operator submits the grant through
|
|
55
|
+
* /api_biofs_fuse/tokenize_biosample, reads go through the gated /api_biofs_fuse/stream, the
|
|
56
|
+
* grant is checked on Sequentia with checkPermission, and erasure runs through the same
|
|
57
|
+
* /api_biofs_fuse/erase that `biofs erase` calls. Every observation is written to a JSON report.
|
|
58
|
+
*/
|
|
59
|
+
const fs = __importStar(require("fs"));
|
|
60
|
+
const os = __importStar(require("os"));
|
|
61
|
+
const path = __importStar(require("path"));
|
|
62
|
+
const axios_1 = __importDefault(require("axios"));
|
|
63
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
64
|
+
const ethers_1 = require("ethers");
|
|
65
|
+
const credentials_1 = require("../lib/auth/credentials");
|
|
66
|
+
const fuse_client_1 = require("../lib/api/fuse-client");
|
|
67
|
+
const constants_1 = require("../lib/config/constants");
|
|
68
|
+
const logger_1 = require("../lib/utils/logger");
|
|
69
|
+
const BIOFS_NODE_BASE = process.env.BIOFS_NODE_URL
|
|
70
|
+
|| `${process.env.GENOBANK_API_URL || 'https://genobank.app'}/api_biofs_node`;
|
|
71
|
+
const FUSE = `${constants_1.API_CONFIG.base}${constants_1.API_CONFIG.fuse}`;
|
|
72
|
+
const RPC = process.env.SEQUENTIA_TRIAL_RPC || 'https://sequentias-test.genobank.io';
|
|
73
|
+
const REPORT_DIR = path.join(os.homedir(), '.biofs', 'erase-trial');
|
|
74
|
+
async function node(action, serial, wallet, sig) {
|
|
75
|
+
const r = await axios_1.default.post(`${BIOFS_NODE_BASE}/erase_trial`, { action, serial }, {
|
|
76
|
+
headers: { 'Content-Type': 'application/json', 'X-Biofs-Wallet': wallet, 'X-Biofs-Signature': sig },
|
|
77
|
+
timeout: 180000, validateStatus: (s) => s < 600,
|
|
78
|
+
});
|
|
79
|
+
if (r.status >= 400)
|
|
80
|
+
throw new Error(`erase_trial ${action}: ${r.status} ${r.data?.error || ''}`);
|
|
81
|
+
return r.data;
|
|
82
|
+
}
|
|
83
|
+
async function streamRead(serial, filename, wallet, sig, offset, length) {
|
|
84
|
+
const r = await axios_1.default.get(`${FUSE}/stream`, {
|
|
85
|
+
params: { biosample: serial, filename, wallet, signature: sig, offset, length },
|
|
86
|
+
responseType: 'arraybuffer', timeout: 60000, validateStatus: () => true,
|
|
87
|
+
});
|
|
88
|
+
const buf = Buffer.from(r.data);
|
|
89
|
+
const text = buf.toString('utf8');
|
|
90
|
+
return { status: r.status, bytes: buf.length, head: text.slice(0, 60).replace(/\n/g, '\\n') };
|
|
91
|
+
}
|
|
92
|
+
async function checkPermission(contract, agent, p) {
|
|
93
|
+
const provider = new ethers_1.ethers.JsonRpcProvider(RPC);
|
|
94
|
+
const c = new ethers_1.ethers.Contract(contract, ['function checkPermission(address,string) view returns (bool)'], provider);
|
|
95
|
+
return Boolean(await c.checkPermission(agent, p));
|
|
96
|
+
}
|
|
97
|
+
async function txTarget(hash) {
|
|
98
|
+
const provider = new ethers_1.ethers.JsonRpcProvider(RPC);
|
|
99
|
+
const rc = await provider.getTransactionReceipt(hash);
|
|
100
|
+
return rc ? { to: rc.to, block: rc.blockNumber, gasUsed: rc.gasUsed.toString(), status: rc.status } : null;
|
|
101
|
+
}
|
|
102
|
+
function save(serial, report) {
|
|
103
|
+
fs.mkdirSync(REPORT_DIR, { recursive: true, mode: 0o700 });
|
|
104
|
+
const f = path.join(REPORT_DIR, `${serial}.json`);
|
|
105
|
+
fs.writeFileSync(f, JSON.stringify(report, null, 2));
|
|
106
|
+
return f;
|
|
107
|
+
}
|
|
108
|
+
async function eraseTrialRunCommand(options) {
|
|
109
|
+
const step = (s) => { if (!options.json)
|
|
110
|
+
console.log(chalk_1.default.cyan(`• ${s}`)); };
|
|
111
|
+
try {
|
|
112
|
+
const cred = await (0, credentials_1.getCredentials)();
|
|
113
|
+
if (!cred)
|
|
114
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
115
|
+
const wallet = cred.wallet_address;
|
|
116
|
+
const sig = cred.user_signature;
|
|
117
|
+
const fuse = new fuse_client_1.FuseAPIClient();
|
|
118
|
+
const report = { started_at: new Date().toISOString(), wallet_role: 'owner (signer)', steps: {} };
|
|
119
|
+
step('setup: synthetic serial, two object generations, registry rows');
|
|
120
|
+
const setup = await node('setup', undefined, wallet, sig);
|
|
121
|
+
const serial = setup.serial;
|
|
122
|
+
const filename = setup.filename;
|
|
123
|
+
report.serial = serial;
|
|
124
|
+
report.steps.setup = setup;
|
|
125
|
+
step('grant: operator submits grantPermission through tokenize_biosample');
|
|
126
|
+
const tk = await axios_1.default.get(`${FUSE}/tokenize_biosample`, {
|
|
127
|
+
params: { biosample: serial, wallet, signature: sig }, timeout: 120000, validateStatus: () => true,
|
|
128
|
+
});
|
|
129
|
+
report.steps.grant = { status: tk.status, tx_hash: tk.data?.tx_hash, block_number: tk.data?.block_number, error: tk.data?.error };
|
|
130
|
+
if (tk.status >= 400 || !tk.data?.tx_hash)
|
|
131
|
+
throw new Error(`grant failed: ${tk.status} ${tk.data?.error || ''}`);
|
|
132
|
+
const txHash = String(tk.data.tx_hash).startsWith('0x') ? String(tk.data.tx_hash) : `0x${tk.data.tx_hash}`;
|
|
133
|
+
const tgt = await txTarget(txHash);
|
|
134
|
+
report.steps.grant.receipt = tgt;
|
|
135
|
+
const grantPath = `biowallet/${serial}/*`; // the exact pattern the grant records; checkPermission does not expand wildcards
|
|
136
|
+
step('before erase: gated read, on-chain permission, registry state');
|
|
137
|
+
report.steps.before = {
|
|
138
|
+
read_first_chunk: await streamRead(serial, filename, wallet, sig, 0, 200),
|
|
139
|
+
checkPermission: tgt?.to ? await checkPermission(tgt.to, wallet, grantPath) : null,
|
|
140
|
+
state: await node('inspect', serial, wallet, sig),
|
|
141
|
+
};
|
|
142
|
+
step('erase: dry run');
|
|
143
|
+
report.steps.dry_run = await fuse.erase({ biosample: serial, dryRun: true }, wallet, sig);
|
|
144
|
+
step('erase: execute');
|
|
145
|
+
const ex = await fuse.erase({ biosample: serial, dryRun: false, confirm: `ERASE-${serial}` }, wallet, sig);
|
|
146
|
+
report.steps.execute = { status: ex.status, result: ex.result, erasure_id: ex.erasure_id || ex.certificate?.erasure_id, retained_until: ex.retained_until, certificate: ex.certificate, error: ex.error };
|
|
147
|
+
step('after erase: second chunk of the open read, on-chain permission, registry state');
|
|
148
|
+
report.steps.after = {
|
|
149
|
+
read_second_chunk: await streamRead(serial, filename, wallet, sig, 200, 200),
|
|
150
|
+
read_from_start: await streamRead(serial, filename, wallet, sig, 0, 200),
|
|
151
|
+
checkPermission: tgt?.to ? await checkPermission(tgt.to, wallet, grantPath) : null,
|
|
152
|
+
state: await node('inspect', serial, wallet, sig),
|
|
153
|
+
};
|
|
154
|
+
step('re-run: resume the completed erasure, then request a fresh erasure');
|
|
155
|
+
const eid = report.steps.execute.erasure_id;
|
|
156
|
+
const tryErase = async (opts) => { try {
|
|
157
|
+
return await fuse.erase(opts, wallet, sig);
|
|
158
|
+
}
|
|
159
|
+
catch (e) {
|
|
160
|
+
return { refused: e.message };
|
|
161
|
+
} };
|
|
162
|
+
report.steps.rerun = {
|
|
163
|
+
resume: eid ? await tryErase({ erasureId: eid, dryRun: false }) : null,
|
|
164
|
+
fresh_request: await tryErase({ biosample: serial, dryRun: true }),
|
|
165
|
+
};
|
|
166
|
+
report.finished_at = new Date().toISOString();
|
|
167
|
+
const f = save(serial, report);
|
|
168
|
+
if (options.json) {
|
|
169
|
+
console.log(JSON.stringify(report, null, 2));
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const a = report.steps.after;
|
|
173
|
+
const b = report.steps.before;
|
|
174
|
+
console.log(chalk_1.default.bold(`\nErase trial ${serial}`));
|
|
175
|
+
console.log(` read before ${b.read_first_chunk.status} (${b.read_first_chunk.bytes} bytes)`);
|
|
176
|
+
console.log(` erase ${report.steps.execute.status}`);
|
|
177
|
+
console.log(` read after (chunk 2) ${a.read_second_chunk.status}`);
|
|
178
|
+
console.log(` live object ${a.state.gcs.live_exists}`);
|
|
179
|
+
console.log(` object generations ${a.state.gcs.generations.length}`);
|
|
180
|
+
console.log(` soft-deleted copies ${Array.isArray(a.state.gcs.soft_deleted) ? a.state.gcs.soft_deleted.length : a.state.gcs.soft_deleted}`);
|
|
181
|
+
console.log(` checkPermission before=${b.checkPermission} after=${a.checkPermission}`);
|
|
182
|
+
console.log(chalk_1.default.gray(`\n report ${f}`));
|
|
183
|
+
}
|
|
184
|
+
catch (e) {
|
|
185
|
+
logger_1.Logger.error(`erase-trial failed: ${e.message}`);
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async function eraseTrialNodeCommand(action, serial, options) {
|
|
190
|
+
try {
|
|
191
|
+
const cred = await (0, credentials_1.getCredentials)();
|
|
192
|
+
if (!cred)
|
|
193
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
194
|
+
const r = await node(action, serial, cred.wallet_address, cred.user_signature);
|
|
195
|
+
if (action === 'cleanup') {
|
|
196
|
+
const f = path.join(REPORT_DIR, `${serial}.json`);
|
|
197
|
+
if (fs.existsSync(f)) {
|
|
198
|
+
const rep = JSON.parse(fs.readFileSync(f, 'utf8'));
|
|
199
|
+
rep.steps.cleanup = r;
|
|
200
|
+
save(serial, rep);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
console.log(JSON.stringify(r, null, 2));
|
|
204
|
+
}
|
|
205
|
+
catch (e) {
|
|
206
|
+
logger_1.Logger.error(`erase-trial ${action} failed: ${e.message}`);
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/** `biofs erase-trial read <serial>`: one gated read of the trial object as the signer, so the
|
|
211
|
+
* gate's decision after an erasure is recorded (403 = refused by the gate; 500 carrying a
|
|
212
|
+
* storage not-found = admitted by the gate, bytes gone). Appended to the serial's report. */
|
|
213
|
+
async function eraseTrialReadCommand(serial, options) {
|
|
214
|
+
try {
|
|
215
|
+
const cred = await (0, credentials_1.getCredentials)();
|
|
216
|
+
if (!cred)
|
|
217
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
218
|
+
const filename = `synthetic_erase_trial_${serial}.vcf`;
|
|
219
|
+
const r = { at: new Date().toISOString(), serial, filename,
|
|
220
|
+
read_from_start: await streamRead(serial, filename, cred.wallet_address, cred.user_signature, 0, 200) };
|
|
221
|
+
const f = path.join(REPORT_DIR, `${serial}.json`);
|
|
222
|
+
if (fs.existsSync(f)) {
|
|
223
|
+
const rep = JSON.parse(fs.readFileSync(f, 'utf8'));
|
|
224
|
+
rep.steps.reads = rep.steps.reads || [];
|
|
225
|
+
rep.steps.reads.push(r);
|
|
226
|
+
save(serial, rep);
|
|
227
|
+
}
|
|
228
|
+
console.log(JSON.stringify(r, null, 2));
|
|
229
|
+
}
|
|
230
|
+
catch (e) {
|
|
231
|
+
logger_1.Logger.error(`erase-trial read failed: ${e.message}`);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/** `biofs erase-trial grantee`: what revocation blocks while the data remain available.
|
|
236
|
+
*
|
|
237
|
+
* Builds a synthetic biosample, grants it to the signer (the owner), then to a throwaway
|
|
238
|
+
* grantee wallet generated for this run (its key is never written anywhere), and records:
|
|
239
|
+
* the grantee's read admitted, the SAME captured signature presented again admitted (the
|
|
240
|
+
* fixed message has no nonce), the owner's read, a never-granted control wallet refused,
|
|
241
|
+
* then revokes the grantee and records the grantee's read (expect 403 from the gate while
|
|
242
|
+
* the live object still exists), the replayed signature, the control, the owner's read
|
|
243
|
+
* (expect admitted: the owner path does not depend on the grant), checkPermission for the
|
|
244
|
+
* grantee on both path shapes, and the object and grant state. Nothing is erased. */
|
|
245
|
+
async function eraseTrialGranteeCommand(options) {
|
|
246
|
+
const step = (s) => { if (!options.json)
|
|
247
|
+
console.log(chalk_1.default.cyan(`• ${s}`)); };
|
|
248
|
+
const MSG = 'I want to proceed';
|
|
249
|
+
try {
|
|
250
|
+
const cred = await (0, credentials_1.getCredentials)();
|
|
251
|
+
if (!cred)
|
|
252
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
253
|
+
const wallet = cred.wallet_address;
|
|
254
|
+
const sig = cred.user_signature;
|
|
255
|
+
const grantee = ethers_1.ethers.Wallet.createRandom();
|
|
256
|
+
const control = ethers_1.ethers.Wallet.createRandom();
|
|
257
|
+
const gSig = await grantee.signMessage(MSG);
|
|
258
|
+
const cSig = await control.signMessage(MSG);
|
|
259
|
+
const report = {
|
|
260
|
+
started_at: new Date().toISOString(), mode: 'grantee',
|
|
261
|
+
wallet_role: 'owner (signer); grantee and control are throwaway wallets, keys discarded',
|
|
262
|
+
grantee_wallet: grantee.address, control_wallet: control.address, steps: {},
|
|
263
|
+
};
|
|
264
|
+
const get = async (p, params) => axios_1.default.get(`${FUSE}/${p}`, { params, timeout: 120000, validateStatus: () => true });
|
|
265
|
+
const state = async () => {
|
|
266
|
+
const s = await node('inspect', report.serial, wallet, sig);
|
|
267
|
+
return { live_exists: s.gcs?.live_exists, generations: s.gcs?.generations?.length, grants: s.grants };
|
|
268
|
+
};
|
|
269
|
+
step('setup: synthetic serial, two object generations, registry rows');
|
|
270
|
+
const setup = await node('setup', undefined, wallet, sig);
|
|
271
|
+
const serial = setup.serial;
|
|
272
|
+
const filename = setup.filename;
|
|
273
|
+
report.serial = serial;
|
|
274
|
+
report.steps.setup = setup;
|
|
275
|
+
step('owner grant: operator submits grantPermission through tokenize_biosample');
|
|
276
|
+
const tk = await get('tokenize_biosample', { biosample: serial, wallet, signature: sig });
|
|
277
|
+
report.steps.owner_grant = { status: tk.status, tx_hash: tk.data?.tx_hash, block_number: tk.data?.block_number, error: tk.data?.error };
|
|
278
|
+
if (tk.status >= 400 || !tk.data?.tx_hash)
|
|
279
|
+
throw new Error(`owner grant failed: ${tk.status} ${tk.data?.error || ''}`);
|
|
280
|
+
const ownerTx = String(tk.data.tx_hash).startsWith('0x') ? String(tk.data.tx_hash) : `0x${tk.data.tx_hash}`;
|
|
281
|
+
const tgt = await txTarget(ownerTx);
|
|
282
|
+
const contract = tgt?.to;
|
|
283
|
+
step('grantee grant: owner-signed grant_access to the throwaway wallet');
|
|
284
|
+
const ga = await get('grant_access', {
|
|
285
|
+
biosample: serial, owner_wallet: wallet, owner_signature: sig,
|
|
286
|
+
agent_wallet: grantee.address, operations: JSON.stringify(['read']), expires_days: 1,
|
|
287
|
+
});
|
|
288
|
+
report.steps.grantee_grant = { status: ga.status, success: ga.data?.success, tx_hash: ga.data?.tx_hash, block_number: ga.data?.block_number, access_record: ga.data?.access_record, error: ga.data?.error };
|
|
289
|
+
if (ga.status >= 400 || !ga.data?.success)
|
|
290
|
+
throw new Error(`grantee grant failed: ${ga.status} ${ga.data?.error || ''}`);
|
|
291
|
+
const patterns = [`biowallet/${serial}/${filename}`, `biowallet/${serial}/*`];
|
|
292
|
+
const perm = async () => {
|
|
293
|
+
const o = {};
|
|
294
|
+
for (const p of patterns)
|
|
295
|
+
o[p] = contract ? await checkPermission(contract, grantee.address, p) : null;
|
|
296
|
+
return o;
|
|
297
|
+
};
|
|
298
|
+
step('before revocation: grantee read, same signature again, owner read, control, permission, state');
|
|
299
|
+
report.steps.before = {
|
|
300
|
+
grantee_read: await streamRead(serial, filename, grantee.address, gSig, 0, 200),
|
|
301
|
+
grantee_read_same_signature_again: await streamRead(serial, filename, grantee.address, gSig, 200, 200),
|
|
302
|
+
owner_read: await streamRead(serial, filename, wallet, sig, 0, 200),
|
|
303
|
+
control_read: await streamRead(serial, filename, control.address, cSig, 0, 200),
|
|
304
|
+
checkPermission_grantee: await perm(),
|
|
305
|
+
state: await state(),
|
|
306
|
+
};
|
|
307
|
+
step('revoke: owner-signed revoke_access for the grantee');
|
|
308
|
+
const rv = await get('revoke_access', { biosample: serial, owner_wallet: wallet, owner_signature: sig, agent_wallet: grantee.address });
|
|
309
|
+
report.steps.revoke = { status: rv.status, data: rv.data };
|
|
310
|
+
const revokeAt = Date.now();
|
|
311
|
+
step('after revocation: grantee read, replayed signature, owner read, control, permission, state');
|
|
312
|
+
report.steps.after = {
|
|
313
|
+
seconds_after_revoke_request: Math.round((Date.now() - revokeAt) / 1000),
|
|
314
|
+
grantee_read: await streamRead(serial, filename, grantee.address, gSig, 0, 200),
|
|
315
|
+
grantee_read_same_signature_again: await streamRead(serial, filename, grantee.address, gSig, 200, 200),
|
|
316
|
+
owner_read: await streamRead(serial, filename, wallet, sig, 0, 200),
|
|
317
|
+
control_read: await streamRead(serial, filename, control.address, cSig, 0, 200),
|
|
318
|
+
checkPermission_grantee: await perm(),
|
|
319
|
+
state: await state(),
|
|
320
|
+
};
|
|
321
|
+
report.finished_at = new Date().toISOString();
|
|
322
|
+
const f = save(serial, report);
|
|
323
|
+
if (options.json) {
|
|
324
|
+
console.log(JSON.stringify(report, null, 2));
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const b = report.steps.before;
|
|
328
|
+
const a = report.steps.after;
|
|
329
|
+
console.log(chalk_1.default.bold(`\nGrantee trial ${serial}`));
|
|
330
|
+
console.log(` before: grantee ${b.grantee_read.status}, replay ${b.grantee_read_same_signature_again.status}, owner ${b.owner_read.status}, control ${b.control_read.status}`);
|
|
331
|
+
console.log(` after: grantee ${a.grantee_read.status}, replay ${a.grantee_read_same_signature_again.status}, owner ${a.owner_read.status}, control ${a.control_read.status}`);
|
|
332
|
+
console.log(` live object ${a.state.live_exists}, grants ${JSON.stringify(a.state.grants)}`);
|
|
333
|
+
console.log(chalk_1.default.gray(`\n report ${f}`));
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
logger_1.Logger.error(`erase-trial grantee failed: ${e.message}`);
|
|
337
|
+
process.exit(1);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=erase-trial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erase-trial.js","sourceRoot":"","sources":["../../src/commands/erase-trial.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,oDAwEC;AAED,sDAiBC;AAKD,sDAiBC;AAYD,4DAqFC;AA3RD;;;;;;;;;;;;;;;GAeG;AACH,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,kDAA0B;AA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iC,CAAC,MAAM,WAAW,CAAC,CAAC,UAAU,CAAC,MAAM,aAAa,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QAChL,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,WAAW,YAAY,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC9F,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,eAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* biofs imaging register | register-status
|
|
3
|
+
*
|
|
4
|
+
* Staged 3D registration of N CT timepoints into one reference frame, with a quality
|
|
5
|
+
* gate, dispatched through biofs-node to the GPU executor. For every non-reference
|
|
6
|
+
* timepoint the executor aligns coarse to fine: a rigid fit to the vertebrae segmented
|
|
7
|
+
* consistently in both scans, rigid refinement on the vertebral column, then a piecewise
|
|
8
|
+
* deformable stage in which the lungs, the viscera that move with the diaphragm (heart and
|
|
9
|
+
* abdominal organs) and the rest of the body are registered separately, so organs can slide
|
|
10
|
+
* against the rib cage. Each stage is
|
|
11
|
+
* measured: surface distance of the whole spine, of each lung, of the liver and of the
|
|
12
|
+
* spleen, per-structure Dice from TotalSegmentator masks,
|
|
13
|
+
* vertebral landmark error, Jacobian folding, bone rigidity, and, with three or more
|
|
14
|
+
* timepoints, agreement of A->B->C with A->C. The gate verdict (PASS, PASS_WITH_WARNINGS,
|
|
15
|
+
* FAIL) is computed against thresholds written into the result, so a later lesion or
|
|
16
|
+
* organ comparison knows how far the alignment can be trusted.
|
|
17
|
+
*
|
|
18
|
+
* biofs-node checks that every study belongs to the signer and picks each series by
|
|
19
|
+
* comparability with the reference (axial, original, soft-tissue kernel, closest
|
|
20
|
+
* thickness, same kernel family), recording why. Pass --series to override.
|
|
21
|
+
*
|
|
22
|
+
* Flow:
|
|
23
|
+
* POST /api_biofs_node/submit_imaging_register {signature, timepoints, reference, anatomy, protocol_mode}
|
|
24
|
+
* GET /api_biofs_node/imaging_register_status?register_job_id=... (owner signature in a header)
|
|
25
|
+
*/
|
|
26
|
+
export interface ImagingRegisterOptions {
|
|
27
|
+
tp?: string[];
|
|
28
|
+
series?: string[];
|
|
29
|
+
reference?: string;
|
|
30
|
+
anatomy?: string;
|
|
31
|
+
protocolMode?: string;
|
|
32
|
+
wait?: boolean;
|
|
33
|
+
quiet?: boolean;
|
|
34
|
+
json?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface ImagingRegisterStatusOptions {
|
|
37
|
+
wait?: boolean;
|
|
38
|
+
quiet?: boolean;
|
|
39
|
+
json?: boolean;
|
|
40
|
+
}
|
|
41
|
+
interface RegisterPair {
|
|
42
|
+
pair: string;
|
|
43
|
+
verdict: string;
|
|
44
|
+
hard_failures?: string[];
|
|
45
|
+
warnings?: string[];
|
|
46
|
+
deformable?: Record<string, number | null>;
|
|
47
|
+
}
|
|
48
|
+
interface RegisterResult {
|
|
49
|
+
status?: string;
|
|
50
|
+
schema?: string;
|
|
51
|
+
output_gcs?: string;
|
|
52
|
+
reference?: string;
|
|
53
|
+
protocol_mode?: string;
|
|
54
|
+
gate?: {
|
|
55
|
+
verdict: string;
|
|
56
|
+
by_pair?: Record<string, string>;
|
|
57
|
+
note?: string;
|
|
58
|
+
};
|
|
59
|
+
pairs?: RegisterPair[];
|
|
60
|
+
transitivity?: number | null;
|
|
61
|
+
elapsed_sec?: number;
|
|
62
|
+
error?: string;
|
|
63
|
+
}
|
|
64
|
+
interface RegisterRow {
|
|
65
|
+
register_job_id: string;
|
|
66
|
+
status: string;
|
|
67
|
+
reference?: string;
|
|
68
|
+
error?: string;
|
|
69
|
+
output_biocid?: string;
|
|
70
|
+
timepoints?: {
|
|
71
|
+
label: string;
|
|
72
|
+
study: string;
|
|
73
|
+
study_date?: string;
|
|
74
|
+
series: string;
|
|
75
|
+
selection?: {
|
|
76
|
+
description?: string;
|
|
77
|
+
kernel?: string;
|
|
78
|
+
thickness_mm?: number;
|
|
79
|
+
rationale?: string[];
|
|
80
|
+
};
|
|
81
|
+
}[];
|
|
82
|
+
result?: RegisterResult;
|
|
83
|
+
}
|
|
84
|
+
export declare function imagingRegisterCommand(options?: ImagingRegisterOptions): Promise<string | null>;
|
|
85
|
+
export declare function imagingRegisterStatusCommand(jobId: string, options?: ImagingRegisterStatusOptions): Promise<RegisterRow | null>;
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/imaging/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAQH,MAAM,WAAW,sBAAsB;IACrC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAMD,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;I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