omics-os 0.0.1 → 1.3.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.
- package/LICENSE +664 -0
- package/README.md +384 -4
- package/package.json +34 -12
- package/packages/cli/dist/index.js +154 -0
- package/packages/cloud-client/dist/agents.d.ts +20 -0
- package/packages/cloud-client/dist/agents.js +69 -0
- package/packages/cloud-client/dist/apiClient.d.ts +44 -0
- package/packages/cloud-client/dist/apiClient.js +368 -0
- package/packages/cloud-client/dist/auth.d.ts +76 -0
- package/packages/cloud-client/dist/auth.js +462 -0
- package/packages/cloud-client/dist/biovault/approval.d.ts +40 -0
- package/packages/cloud-client/dist/biovault/approval.js +38 -0
- package/packages/cloud-client/dist/biovault/assurance.d.ts +10 -0
- package/packages/cloud-client/dist/biovault/assurance.js +14 -0
- package/packages/cloud-client/dist/biovault/client.d.ts +76 -0
- package/packages/cloud-client/dist/biovault/client.js +212 -0
- package/packages/cloud-client/dist/biovault/compat.d.ts +29 -0
- package/packages/cloud-client/dist/biovault/compat.js +90 -0
- package/packages/cloud-client/dist/biovault/entries.d.ts +143 -0
- package/packages/cloud-client/dist/biovault/entries.js +359 -0
- package/packages/cloud-client/dist/biovault/errors.d.ts +18 -0
- package/packages/cloud-client/dist/biovault/errors.js +90 -0
- package/packages/cloud-client/dist/biovault/fields.d.ts +7 -0
- package/packages/cloud-client/dist/biovault/fields.js +42 -0
- package/packages/cloud-client/dist/biovault/identity.d.ts +10 -0
- package/packages/cloud-client/dist/biovault/identity.js +43 -0
- package/packages/cloud-client/dist/biovault/index.d.ts +15 -0
- package/packages/cloud-client/dist/biovault/index.js +16 -0
- package/packages/cloud-client/dist/biovault/instructionMatch.d.ts +32 -0
- package/packages/cloud-client/dist/biovault/instructionMatch.js +118 -0
- package/packages/cloud-client/dist/biovault/pending.d.ts +41 -0
- package/packages/cloud-client/dist/biovault/pending.js +208 -0
- package/packages/cloud-client/dist/biovault/preCommit.d.ts +10 -0
- package/packages/cloud-client/dist/biovault/preCommit.js +10 -0
- package/packages/cloud-client/dist/biovault/provenance.d.ts +45 -0
- package/packages/cloud-client/dist/biovault/provenance.js +55 -0
- package/packages/cloud-client/dist/biovault/vendor/packageDeliveryV1.generated.d.ts +3981 -0
- package/packages/cloud-client/dist/biovault/vendor/packageDeliveryV1.generated.js +3632 -0
- package/packages/cloud-client/dist/biovault/vendor/runV1.generated.d.ts +2326 -0
- package/packages/cloud-client/dist/biovault/vendor/runV1.generated.js +491 -0
- package/packages/cloud-client/dist/biovault/wireShape.d.ts +25 -0
- package/packages/cloud-client/dist/biovault/wireShape.js +88 -0
- package/packages/cloud-client/dist/bootstrap.d.ts +4 -0
- package/packages/cloud-client/dist/bootstrap.js +19 -0
- package/packages/cloud-client/dist/config.d.ts +44 -0
- package/packages/cloud-client/dist/config.js +309 -0
- package/packages/cloud-client/dist/credentials.d.ts +96 -0
- package/packages/cloud-client/dist/credentials.js +395 -0
- package/packages/cloud-client/dist/editor.d.ts +77 -0
- package/packages/cloud-client/dist/editor.js +278 -0
- package/packages/cloud-client/dist/errors.d.ts +27 -0
- package/packages/cloud-client/dist/errors.js +102 -0
- package/packages/cloud-client/dist/exports.d.ts +19 -0
- package/packages/cloud-client/dist/exports.js +85 -0
- package/packages/cloud-client/dist/featureFlags.d.ts +10 -0
- package/packages/cloud-client/dist/featureFlags.js +36 -0
- package/packages/cloud-client/dist/files.d.ts +35 -0
- package/packages/cloud-client/dist/files.js +109 -0
- package/packages/cloud-client/dist/index.d.ts +29 -0
- package/packages/cloud-client/dist/index.js +22 -0
- package/packages/cloud-client/dist/multipartUpload.d.ts +99 -0
- package/packages/cloud-client/dist/multipartUpload.js +624 -0
- package/packages/cloud-client/dist/projects.d.ts +42 -0
- package/packages/cloud-client/dist/projects.js +119 -0
- package/packages/cloud-client/dist/resources.d.ts +8 -0
- package/packages/cloud-client/dist/resources.js +26 -0
- package/packages/cloud-client/dist/sessions.d.ts +67 -0
- package/packages/cloud-client/dist/sessions.js +187 -0
- package/packages/cloud-client/dist/templates.d.ts +4 -0
- package/packages/cloud-client/dist/templates.js +12 -0
- package/packages/cloud-client/dist/types.d.ts +431 -0
- package/packages/cloud-client/dist/types.js +94 -0
- package/packages/cloud-client/dist/uploads.d.ts +93 -0
- package/packages/cloud-client/dist/uploads.js +61 -0
- package/packages/cloud-client/dist/vault.d.ts +20 -0
- package/packages/cloud-client/dist/vault.js +43 -0
- package/packages/cloud-client/dist/vectorSearch.d.ts +3 -0
- package/packages/cloud-client/dist/vectorSearch.js +12 -0
- package/packages/tui/dist/lobster.mjs +273 -0
- package/skills/omics-os-cloud/SKILL.md +24 -0
- package/skills/omics-os-lobster/SKILL.md +24 -0
- package/bin/omics-os.js +0 -5
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
/** Shared types for the Omics-OS Cloud API SDK. */
|
|
2
|
+
export type AuthType = "bearer" | "api-key" | "none";
|
|
3
|
+
export type TokenSource = "env" | "cli" | "stored" | "none";
|
|
4
|
+
export interface AppConfig {
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
streamApiUrl: string;
|
|
7
|
+
sessionId?: string;
|
|
8
|
+
projectId?: string;
|
|
9
|
+
token?: string;
|
|
10
|
+
authType: AuthType;
|
|
11
|
+
tokenSource: TokenSource;
|
|
12
|
+
isCloud: boolean;
|
|
13
|
+
isResume: boolean;
|
|
14
|
+
/** Named credential profile this config is bound to (undefined = active profile). */
|
|
15
|
+
profile?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface StoredCredentials {
|
|
18
|
+
auth_mode?: "oauth" | "api_key" | string;
|
|
19
|
+
credential_type?: "omics_cli" | string;
|
|
20
|
+
credential_id?: string;
|
|
21
|
+
cli_token?: string;
|
|
22
|
+
api_key?: string;
|
|
23
|
+
refresh_token?: string;
|
|
24
|
+
token_expiry?: string;
|
|
25
|
+
refresh_expiry?: string;
|
|
26
|
+
endpoint?: string;
|
|
27
|
+
user_id?: string;
|
|
28
|
+
email?: string;
|
|
29
|
+
org_id?: string;
|
|
30
|
+
tier?: string;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}
|
|
33
|
+
export interface Session {
|
|
34
|
+
session_id: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
project_id?: string | null;
|
|
37
|
+
org_project_id?: string | null;
|
|
38
|
+
status?: string;
|
|
39
|
+
created_at: string;
|
|
40
|
+
last_activity?: string;
|
|
41
|
+
message_count?: number;
|
|
42
|
+
client_source?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface SessionCreateRequest {
|
|
45
|
+
name?: string;
|
|
46
|
+
client_source?: string;
|
|
47
|
+
project_id?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface SessionCreateResponse {
|
|
50
|
+
session_id?: string;
|
|
51
|
+
id?: string;
|
|
52
|
+
session?: {
|
|
53
|
+
session_id?: string;
|
|
54
|
+
};
|
|
55
|
+
/** Project files the server did not copy into a new project session (create response only). */
|
|
56
|
+
seed_warnings?: unknown;
|
|
57
|
+
}
|
|
58
|
+
/** A project file the agent cannot read in this session; `reason` is the server's, passed through. */
|
|
59
|
+
export interface SeedWarning {
|
|
60
|
+
relative_path: string;
|
|
61
|
+
size_bytes: number | null;
|
|
62
|
+
reason: string;
|
|
63
|
+
}
|
|
64
|
+
export interface Message {
|
|
65
|
+
message_id: string;
|
|
66
|
+
session_id: string;
|
|
67
|
+
role: "user" | "assistant" | "system";
|
|
68
|
+
content: string;
|
|
69
|
+
created_at: string;
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
|
+
}
|
|
72
|
+
/** One package in an agent store listing (AgentPackageSummary). */
|
|
73
|
+
export interface AgentSummary {
|
|
74
|
+
package_name: string;
|
|
75
|
+
version: string;
|
|
76
|
+
display_name: string;
|
|
77
|
+
description: string;
|
|
78
|
+
author: string;
|
|
79
|
+
categories: string[];
|
|
80
|
+
downloads?: number;
|
|
81
|
+
status?: string;
|
|
82
|
+
created_at?: string;
|
|
83
|
+
}
|
|
84
|
+
/** One agent store package version (AgentPackage). */
|
|
85
|
+
export interface AgentDetail extends AgentSummary {
|
|
86
|
+
agent_names?: string[];
|
|
87
|
+
tools?: string[];
|
|
88
|
+
primary_category?: string | null;
|
|
89
|
+
dependencies?: string[];
|
|
90
|
+
visibility?: string;
|
|
91
|
+
validated?: boolean;
|
|
92
|
+
updated_at?: string;
|
|
93
|
+
}
|
|
94
|
+
/** GET /agents/store (AgentBrowseResponse). */
|
|
95
|
+
export interface AgentsListResponse {
|
|
96
|
+
packages: AgentSummary[];
|
|
97
|
+
total: number;
|
|
98
|
+
next_token?: string | null;
|
|
99
|
+
}
|
|
100
|
+
export interface FeatureFlags {
|
|
101
|
+
projects_datasets: boolean;
|
|
102
|
+
session_state_read: boolean;
|
|
103
|
+
session_state_write: boolean;
|
|
104
|
+
message_ddb_primary: boolean;
|
|
105
|
+
curated_agent_store: boolean;
|
|
106
|
+
playground: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface PromptTemplate {
|
|
109
|
+
id: string;
|
|
110
|
+
title: string;
|
|
111
|
+
template: string;
|
|
112
|
+
category: string;
|
|
113
|
+
placeholders: string[];
|
|
114
|
+
}
|
|
115
|
+
export interface Resource {
|
|
116
|
+
kind: string;
|
|
117
|
+
id: string;
|
|
118
|
+
label: string;
|
|
119
|
+
description?: string;
|
|
120
|
+
source?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface RuntimeInfo {
|
|
123
|
+
provider?: string;
|
|
124
|
+
model?: string;
|
|
125
|
+
mode?: "local" | "cloud" | string;
|
|
126
|
+
}
|
|
127
|
+
export interface BootstrapData {
|
|
128
|
+
flags: FeatureFlags;
|
|
129
|
+
resources: Resource[];
|
|
130
|
+
templates: PromptTemplate[];
|
|
131
|
+
runtime?: RuntimeInfo;
|
|
132
|
+
}
|
|
133
|
+
/** A Cloud project, as GET /projects and GET /projects/{id} return it. */
|
|
134
|
+
export interface Project {
|
|
135
|
+
project_id: string;
|
|
136
|
+
user_id: string;
|
|
137
|
+
workspace_id?: string | null;
|
|
138
|
+
org_id?: string | null;
|
|
139
|
+
name: string;
|
|
140
|
+
description?: string | null;
|
|
141
|
+
metadata?: {
|
|
142
|
+
domain?: string | null;
|
|
143
|
+
organism?: string | null;
|
|
144
|
+
tags?: string[];
|
|
145
|
+
};
|
|
146
|
+
status?: "active" | "archived" | "deleted";
|
|
147
|
+
created_at: string;
|
|
148
|
+
updated_at: string;
|
|
149
|
+
}
|
|
150
|
+
/** A file registered on a dataset. `key` is a storage key; never show it. */
|
|
151
|
+
export interface DatasetFile {
|
|
152
|
+
key?: string;
|
|
153
|
+
name: string;
|
|
154
|
+
size: number;
|
|
155
|
+
type?: string | null;
|
|
156
|
+
created_at?: string;
|
|
157
|
+
}
|
|
158
|
+
/** A dataset in a project, as GET /projects/{id}/datasets returns it. */
|
|
159
|
+
export interface Dataset {
|
|
160
|
+
dataset_id: string;
|
|
161
|
+
project_id: string;
|
|
162
|
+
name: string;
|
|
163
|
+
description?: string | null;
|
|
164
|
+
files?: DatasetFile[];
|
|
165
|
+
status?: string;
|
|
166
|
+
created_at?: string;
|
|
167
|
+
updated_at?: string;
|
|
168
|
+
}
|
|
169
|
+
export interface ApiRequestOptions {
|
|
170
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
171
|
+
body?: unknown;
|
|
172
|
+
timeoutMs?: number;
|
|
173
|
+
signal?: AbortSignal;
|
|
174
|
+
headers?: Record<string, string>;
|
|
175
|
+
retry?: "safe" | "none";
|
|
176
|
+
/** Longest Retry-After kept on an error other than 429 (default 30 s). */
|
|
177
|
+
maxRetryAfterMs?: number;
|
|
178
|
+
}
|
|
179
|
+
export interface FileInfo {
|
|
180
|
+
name: string;
|
|
181
|
+
path: string;
|
|
182
|
+
size_bytes: number;
|
|
183
|
+
created_at: string;
|
|
184
|
+
modified_at: string;
|
|
185
|
+
file_type: string;
|
|
186
|
+
}
|
|
187
|
+
export interface FileListResponse {
|
|
188
|
+
success: boolean;
|
|
189
|
+
message: string;
|
|
190
|
+
files: FileInfo[];
|
|
191
|
+
total: number;
|
|
192
|
+
total_size_bytes: number;
|
|
193
|
+
}
|
|
194
|
+
export interface FileUploadResponse {
|
|
195
|
+
success: boolean;
|
|
196
|
+
message: string;
|
|
197
|
+
file_path: string;
|
|
198
|
+
file_size: number;
|
|
199
|
+
dataset?: unknown;
|
|
200
|
+
}
|
|
201
|
+
export interface WorkspaceFileMetadata {
|
|
202
|
+
name: string;
|
|
203
|
+
path: string;
|
|
204
|
+
size_bytes: number;
|
|
205
|
+
created_at: string;
|
|
206
|
+
modified_at: string;
|
|
207
|
+
file_type: string;
|
|
208
|
+
file_format?: string;
|
|
209
|
+
is_data_file?: boolean;
|
|
210
|
+
}
|
|
211
|
+
export type ExportType = "report" | "pipeline" | "slidedeck";
|
|
212
|
+
export interface ExportRequest {
|
|
213
|
+
export_type?: ExportType;
|
|
214
|
+
format?: "pdf" | "pptx";
|
|
215
|
+
}
|
|
216
|
+
export interface ExportJobResponse {
|
|
217
|
+
job_id: string;
|
|
218
|
+
status: "pending" | "generating" | "complete" | "failed";
|
|
219
|
+
result?: ExportResult;
|
|
220
|
+
error?: string;
|
|
221
|
+
}
|
|
222
|
+
export interface ExportResult {
|
|
223
|
+
success: boolean;
|
|
224
|
+
title: string;
|
|
225
|
+
export_name: string;
|
|
226
|
+
files: Record<string, string>;
|
|
227
|
+
message?: string;
|
|
228
|
+
}
|
|
229
|
+
export interface VaultSearchResult {
|
|
230
|
+
success: boolean;
|
|
231
|
+
hit: boolean;
|
|
232
|
+
evidence_id?: string;
|
|
233
|
+
message: string;
|
|
234
|
+
}
|
|
235
|
+
export interface VaultEvidence {
|
|
236
|
+
evidence_id: string;
|
|
237
|
+
genes: string[];
|
|
238
|
+
disease: string;
|
|
239
|
+
control: string;
|
|
240
|
+
methods_paragraph?: string;
|
|
241
|
+
plot_s3_keys: string[];
|
|
242
|
+
provenance_s3_key?: string;
|
|
243
|
+
created_at?: string;
|
|
244
|
+
}
|
|
245
|
+
export interface VaultEvidenceResponse {
|
|
246
|
+
success: boolean;
|
|
247
|
+
message: string;
|
|
248
|
+
evidence: VaultEvidence;
|
|
249
|
+
plot_urls: string[];
|
|
250
|
+
}
|
|
251
|
+
export interface VaultJobCreate {
|
|
252
|
+
genes: string[];
|
|
253
|
+
disease: string;
|
|
254
|
+
control: string;
|
|
255
|
+
}
|
|
256
|
+
export interface VaultJob {
|
|
257
|
+
job_id: string;
|
|
258
|
+
user_id: string;
|
|
259
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
260
|
+
genes: string[];
|
|
261
|
+
disease: string;
|
|
262
|
+
control: string;
|
|
263
|
+
org_id?: string;
|
|
264
|
+
evidence_id?: string;
|
|
265
|
+
error_message?: string;
|
|
266
|
+
created_at?: string;
|
|
267
|
+
}
|
|
268
|
+
export interface VaultJobResponse {
|
|
269
|
+
success: boolean;
|
|
270
|
+
message: string;
|
|
271
|
+
job: VaultJob;
|
|
272
|
+
}
|
|
273
|
+
export interface VaultJobListResponse {
|
|
274
|
+
success: boolean;
|
|
275
|
+
message: string;
|
|
276
|
+
jobs: VaultJob[];
|
|
277
|
+
total: number;
|
|
278
|
+
}
|
|
279
|
+
export interface VaultExportRequest {
|
|
280
|
+
evidence_id: string;
|
|
281
|
+
formats: string[];
|
|
282
|
+
}
|
|
283
|
+
export interface VaultExportResponse {
|
|
284
|
+
success: boolean;
|
|
285
|
+
message: string;
|
|
286
|
+
evidence_id: string;
|
|
287
|
+
exports: Record<string, string | null>;
|
|
288
|
+
}
|
|
289
|
+
export type VectorCollection = "mondo" | "uberon" | "cell_ontology" | "disease" | "tissue" | "cell_type";
|
|
290
|
+
export interface VectorSearchRequest {
|
|
291
|
+
query: string;
|
|
292
|
+
top_k?: number;
|
|
293
|
+
collections?: VectorCollection[];
|
|
294
|
+
}
|
|
295
|
+
export interface VectorSearchMatch {
|
|
296
|
+
term: string;
|
|
297
|
+
ontology_id: string;
|
|
298
|
+
score: number;
|
|
299
|
+
}
|
|
300
|
+
export interface VectorSearchResponse {
|
|
301
|
+
query: string;
|
|
302
|
+
results: Record<string, VectorSearchMatch[]>;
|
|
303
|
+
top_k: number;
|
|
304
|
+
backend: string;
|
|
305
|
+
embedding_provider: string;
|
|
306
|
+
}
|
|
307
|
+
export interface EditorGenerateResponse {
|
|
308
|
+
job_id: string;
|
|
309
|
+
status: string;
|
|
310
|
+
}
|
|
311
|
+
export interface EditorGenerateResult {
|
|
312
|
+
tex_path: string;
|
|
313
|
+
figures: string[];
|
|
314
|
+
context_path: string;
|
|
315
|
+
manifest_path: string;
|
|
316
|
+
session_id: string;
|
|
317
|
+
export_name: string;
|
|
318
|
+
}
|
|
319
|
+
export interface EditorGenerateJobResponse {
|
|
320
|
+
job_id: string;
|
|
321
|
+
status: "pending" | "generating" | "complete" | "failed";
|
|
322
|
+
result?: EditorGenerateResult;
|
|
323
|
+
error?: string;
|
|
324
|
+
}
|
|
325
|
+
export interface EditorFileInfo {
|
|
326
|
+
name: string;
|
|
327
|
+
path: string;
|
|
328
|
+
size: number;
|
|
329
|
+
last_modified: string;
|
|
330
|
+
content_type: string;
|
|
331
|
+
zone: string;
|
|
332
|
+
writable: boolean;
|
|
333
|
+
}
|
|
334
|
+
export interface EditorFileListResponse {
|
|
335
|
+
files: EditorFileInfo[];
|
|
336
|
+
total: number;
|
|
337
|
+
}
|
|
338
|
+
export interface EditorMetaResponse {
|
|
339
|
+
exists: boolean;
|
|
340
|
+
generated_at?: string;
|
|
341
|
+
file_count?: number;
|
|
342
|
+
generation_version?: number;
|
|
343
|
+
new_messages?: number;
|
|
344
|
+
new_plots?: number;
|
|
345
|
+
}
|
|
346
|
+
export interface MeOrganizationResponse {
|
|
347
|
+
org_id: string;
|
|
348
|
+
name: string;
|
|
349
|
+
subdomain: string;
|
|
350
|
+
subdomain_status: string;
|
|
351
|
+
tier: string;
|
|
352
|
+
role: string;
|
|
353
|
+
}
|
|
354
|
+
export interface ApiErrorMetadata {
|
|
355
|
+
retryable?: boolean | null;
|
|
356
|
+
requestId?: string | null;
|
|
357
|
+
}
|
|
358
|
+
export interface ApiErrorResponse extends ApiErrorMetadata {
|
|
359
|
+
status: number;
|
|
360
|
+
statusText: string;
|
|
361
|
+
detail?: string;
|
|
362
|
+
body?: Record<string, unknown>;
|
|
363
|
+
code?: string;
|
|
364
|
+
retryAfterMs?: number;
|
|
365
|
+
types?: {
|
|
366
|
+
error?: string;
|
|
367
|
+
subcode?: string;
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
type AuthErrorMetadata = ApiErrorMetadata & Omit<Partial<ApiErrorResponse>, "status" | "statusText">;
|
|
371
|
+
export declare class ApiError extends Error {
|
|
372
|
+
readonly path: string;
|
|
373
|
+
readonly status: number;
|
|
374
|
+
readonly statusText: string;
|
|
375
|
+
readonly detail?: string | undefined;
|
|
376
|
+
readonly body?: Record<string, unknown> | undefined;
|
|
377
|
+
/** Machine-readable error code from the body, e.g. `export_not_ready`. */
|
|
378
|
+
readonly code?: string | undefined;
|
|
379
|
+
/** Server-requested wait before retrying (from Retry-After), when sent. */
|
|
380
|
+
readonly retryAfterMs?: number | undefined;
|
|
381
|
+
/** Top-level error type (e.g. `worker_command_failed`) and its sub-code. */
|
|
382
|
+
readonly types: {
|
|
383
|
+
error?: string;
|
|
384
|
+
subcode?: string;
|
|
385
|
+
};
|
|
386
|
+
readonly retryable: boolean | null;
|
|
387
|
+
readonly requestId: string | null;
|
|
388
|
+
kind?: string;
|
|
389
|
+
publicMessage?: string;
|
|
390
|
+
exitCode?: number;
|
|
391
|
+
constructor(path: string, status: number, statusText: string, detail?: string | undefined, body?: Record<string, unknown> | undefined,
|
|
392
|
+
/** Machine-readable error code from the body, e.g. `export_not_ready`. */
|
|
393
|
+
code?: string | undefined,
|
|
394
|
+
/** Server-requested wait before retrying (from Retry-After), when sent. */
|
|
395
|
+
retryAfterMs?: number | undefined,
|
|
396
|
+
/** Top-level error type (e.g. `worker_command_failed`) and its sub-code. */
|
|
397
|
+
types?: {
|
|
398
|
+
error?: string;
|
|
399
|
+
subcode?: string;
|
|
400
|
+
}, meta?: ApiErrorMetadata);
|
|
401
|
+
}
|
|
402
|
+
/** The one line for "no valid login": no stored credential, or the server rejected it. */
|
|
403
|
+
export declare const NOT_LOGGED_IN_MESSAGE = "Not logged in. Run: omics-os login";
|
|
404
|
+
export declare class AuthError extends ApiError {
|
|
405
|
+
constructor(path: string, message?: string, meta?: AuthErrorMetadata);
|
|
406
|
+
}
|
|
407
|
+
/** A stored credential that was not stored for this origin; raised before any request is sent. */
|
|
408
|
+
export declare class StoredCredentialOriginError extends AuthError {
|
|
409
|
+
constructor(url: string, message: string);
|
|
410
|
+
}
|
|
411
|
+
export declare class TenantAccessDeniedError extends ApiError {
|
|
412
|
+
readonly tenant: string;
|
|
413
|
+
constructor(path: string, tenant: string, meta?: AuthErrorMetadata);
|
|
414
|
+
}
|
|
415
|
+
export declare class RateLimitError extends ApiError {
|
|
416
|
+
constructor(path: string, retryAfterMs?: number, detail?: string, body?: Record<string, unknown>, code?: string, types?: {
|
|
417
|
+
error?: string;
|
|
418
|
+
subcode?: string;
|
|
419
|
+
}, meta?: ApiErrorMetadata);
|
|
420
|
+
}
|
|
421
|
+
export declare class UnreadableResponseError extends ApiError {
|
|
422
|
+
constructor(path: string, status: number, statusText?: string, cause?: unknown);
|
|
423
|
+
}
|
|
424
|
+
export declare class UnknownOutcomeError extends ApiError {
|
|
425
|
+
constructor(path: string, response?: ApiErrorResponse, cause?: unknown);
|
|
426
|
+
}
|
|
427
|
+
export declare class NetworkError extends Error {
|
|
428
|
+
readonly path: string;
|
|
429
|
+
constructor(path: string, cause?: Error);
|
|
430
|
+
}
|
|
431
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** Shared types for the Omics-OS Cloud API SDK. */
|
|
2
|
+
export class ApiError extends Error {
|
|
3
|
+
path;
|
|
4
|
+
status;
|
|
5
|
+
statusText;
|
|
6
|
+
detail;
|
|
7
|
+
body;
|
|
8
|
+
code;
|
|
9
|
+
retryAfterMs;
|
|
10
|
+
types;
|
|
11
|
+
retryable;
|
|
12
|
+
requestId;
|
|
13
|
+
// Classification is local SDK/CLI metadata, never copied from response bodies.
|
|
14
|
+
kind;
|
|
15
|
+
publicMessage;
|
|
16
|
+
exitCode;
|
|
17
|
+
constructor(path, status, statusText, detail, body,
|
|
18
|
+
/** Machine-readable error code from the body, e.g. `export_not_ready`. */
|
|
19
|
+
code,
|
|
20
|
+
/** Server-requested wait before retrying (from Retry-After), when sent. */
|
|
21
|
+
retryAfterMs,
|
|
22
|
+
/** Top-level error type (e.g. `worker_command_failed`) and its sub-code. */
|
|
23
|
+
types = {}, meta) {
|
|
24
|
+
const msg = `API ${path}: ${status} ${statusText}`;
|
|
25
|
+
super(detail ? `${msg} — ${detail}` : msg);
|
|
26
|
+
this.path = path;
|
|
27
|
+
this.status = status;
|
|
28
|
+
this.statusText = statusText;
|
|
29
|
+
this.detail = detail;
|
|
30
|
+
this.body = body;
|
|
31
|
+
this.code = code;
|
|
32
|
+
this.retryAfterMs = retryAfterMs;
|
|
33
|
+
this.types = types;
|
|
34
|
+
this.name = "ApiError";
|
|
35
|
+
this.retryable = meta?.retryable ?? null;
|
|
36
|
+
this.requestId = meta?.requestId ?? null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** The one line for "no valid login": no stored credential, or the server rejected it. */
|
|
40
|
+
export const NOT_LOGGED_IN_MESSAGE = "Not logged in. Run: omics-os login";
|
|
41
|
+
export class AuthError extends ApiError {
|
|
42
|
+
constructor(path, message, meta) {
|
|
43
|
+
super(path, 401, "Unauthorized", meta?.detail, meta?.body, meta?.code, meta?.retryAfterMs, meta?.types, meta);
|
|
44
|
+
this.name = "AuthError";
|
|
45
|
+
this.message = message ?? NOT_LOGGED_IN_MESSAGE;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** A stored credential that was not stored for this origin; raised before any request is sent. */
|
|
49
|
+
export class StoredCredentialOriginError extends AuthError {
|
|
50
|
+
constructor(url, message) {
|
|
51
|
+
super(url, message);
|
|
52
|
+
this.name = "StoredCredentialOriginError";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export class TenantAccessDeniedError extends ApiError {
|
|
56
|
+
tenant;
|
|
57
|
+
constructor(path, tenant, meta) {
|
|
58
|
+
super(path, 403, "Forbidden", meta?.detail, meta?.body, meta?.code, meta?.retryAfterMs, meta?.types, meta);
|
|
59
|
+
this.tenant = tenant;
|
|
60
|
+
this.name = "TenantAccessDeniedError";
|
|
61
|
+
this.message = `Access denied to tenant '${tenant}'. You may no longer be a member. Run 'omics-os profiles remove ${tenant}' to clean up.`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export class RateLimitError extends ApiError {
|
|
65
|
+
constructor(path, retryAfterMs, detail, body, code, types = {}, meta) {
|
|
66
|
+
super(path, 429, "Too Many Requests", detail, body, code, retryAfterMs, types, meta);
|
|
67
|
+
this.name = "RateLimitError";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export class UnreadableResponseError extends ApiError {
|
|
71
|
+
constructor(path, status, statusText = "", cause) {
|
|
72
|
+
super(path, status, statusText);
|
|
73
|
+
this.name = "UnreadableResponseError";
|
|
74
|
+
this.message = "The server sent a response the CLI could not read.";
|
|
75
|
+
this.cause = cause;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export class UnknownOutcomeError extends ApiError {
|
|
79
|
+
constructor(path, response, cause) {
|
|
80
|
+
super(path, response?.status ?? 0, response?.statusText ?? "", response?.detail, response?.body, response?.code, response?.retryAfterMs, response?.types, response);
|
|
81
|
+
this.name = "UnknownOutcomeError";
|
|
82
|
+
this.message = "The request was sent but its outcome is unknown. Check before retrying.";
|
|
83
|
+
this.cause = cause;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export class NetworkError extends Error {
|
|
87
|
+
path;
|
|
88
|
+
constructor(path, cause) {
|
|
89
|
+
super(`Network error on ${path}: ${cause?.message ?? "connection failed"}`);
|
|
90
|
+
this.path = path;
|
|
91
|
+
this.name = "NetworkError";
|
|
92
|
+
this.cause = cause;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resumable project uploads (C1–C4b): the control calls. File bytes never pass
|
|
3
|
+
* through these; they go to presigned part URLs (see multipartUpload.ts). A
|
|
4
|
+
* completed upload is the project's file at its path, one current version per path.
|
|
5
|
+
*/
|
|
6
|
+
import type { AppConfig } from "./types.js";
|
|
7
|
+
/** `completing`: an earlier Complete is running or its answer was lost; a repeated Complete settles it. */
|
|
8
|
+
export type UploadState = "completed" | "open" | "completing" | "new";
|
|
9
|
+
export interface UploadStartRequest {
|
|
10
|
+
project_id: string;
|
|
11
|
+
/** POSIX path relative to the folder or file the user named; never absolute. */
|
|
12
|
+
relative_path: string;
|
|
13
|
+
size_bytes: number;
|
|
14
|
+
fingerprint: string;
|
|
15
|
+
client_sha256?: null;
|
|
16
|
+
/** Overwrite the project's file at this path (its old version is kept as noncurrent); also completes an open upload over it. */
|
|
17
|
+
replace?: boolean;
|
|
18
|
+
/** The file's modification time (whole ms); the server stores it with a new upload. */
|
|
19
|
+
mtime_ms?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface UploadStartResponse {
|
|
22
|
+
state: UploadState;
|
|
23
|
+
/** "fingerprint" when `completed` was matched on path, size and fingerprint, not on a hash checked by the server. */
|
|
24
|
+
match?: string;
|
|
25
|
+
upload_id: string | null;
|
|
26
|
+
/** On `completed`: the project path and its current version. */
|
|
27
|
+
relative_path?: string;
|
|
28
|
+
version_id?: string | null;
|
|
29
|
+
part_size_bytes: number;
|
|
30
|
+
part_count: number;
|
|
31
|
+
expires_at: string;
|
|
32
|
+
/** On `open`: the mtime_ms stored when the upload started (absent on servers without it). */
|
|
33
|
+
mtime_ms?: number | null;
|
|
34
|
+
}
|
|
35
|
+
export interface SignedPart {
|
|
36
|
+
part_number: number;
|
|
37
|
+
url: string;
|
|
38
|
+
expires_at: string;
|
|
39
|
+
/** Exactly the headers the PUT must carry (Content-Length is added by the sender). */
|
|
40
|
+
headers: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
export interface UploadedPart {
|
|
43
|
+
part_number: number;
|
|
44
|
+
size_bytes: number;
|
|
45
|
+
etag: string;
|
|
46
|
+
/** Base64 SHA-256 of the part, as S3 stored it. */
|
|
47
|
+
checksum_sha256: string;
|
|
48
|
+
}
|
|
49
|
+
export interface UploadStatus {
|
|
50
|
+
status: "open" | "completing" | "completed" | "aborted";
|
|
51
|
+
expires_at: string;
|
|
52
|
+
part_size_bytes: number;
|
|
53
|
+
part_count: number;
|
|
54
|
+
parts: UploadedPart[];
|
|
55
|
+
}
|
|
56
|
+
export interface UploadCompleteResponse {
|
|
57
|
+
relative_path: string;
|
|
58
|
+
size_bytes: number;
|
|
59
|
+
/** The project file's version this upload created. */
|
|
60
|
+
version_id: string;
|
|
61
|
+
/** Echoed by servers that record it. */
|
|
62
|
+
resume_trust?: ResumeTrust;
|
|
63
|
+
}
|
|
64
|
+
/** Most parts one sign call may ask for. */
|
|
65
|
+
export declare const MAX_SIGN_BATCH = 100;
|
|
66
|
+
/** C1: find the open or completed upload for this file, or create one. Idempotent on the server, so retried. */
|
|
67
|
+
export declare function startUpload(config: AppConfig, request: UploadStartRequest, signal?: AbortSignal): Promise<UploadStartResponse>;
|
|
68
|
+
/** C2: presigned PUT URLs for these parts, each bound to the part's SHA-256 (base64). */
|
|
69
|
+
export declare function signUploadParts(config: AppConfig, uploadId: string, parts: Array<{
|
|
70
|
+
part_number: number;
|
|
71
|
+
checksum_sha256: string;
|
|
72
|
+
}>, signal?: AbortSignal): Promise<SignedPart[]>;
|
|
73
|
+
/** C3: the upload's state and the parts S3 already holds. */
|
|
74
|
+
export declare function getUpload(config: AppConfig, uploadId: string, signal?: AbortSignal): Promise<UploadStatus>;
|
|
75
|
+
/**
|
|
76
|
+
* How the parts already on the server were accepted on resume: "none" (nothing reused), "rehash"
|
|
77
|
+
* (read again and compared), or trusted on the match ("fingerprint+mtime", or "fingerprint" when
|
|
78
|
+
* the server stored no mtime). Sent with C4 so the input records what was and was not re-read.
|
|
79
|
+
*/
|
|
80
|
+
export type ResumeTrust = "none" | "rehash" | "fingerprint+mtime" | "fingerprint";
|
|
81
|
+
/** C4: the server completes from its own part list. Not resent automatically: an unknown outcome is re-read with getUpload; a repeat answers the stored outcome. */
|
|
82
|
+
export declare function completeUpload(config: AppConfig, uploadId: string, signal?: AbortSignal, resumeTrust?: ResumeTrust): Promise<UploadCompleteResponse>;
|
|
83
|
+
/** C4b: abort an open upload. A completed upload answers 409 `upload_completed`; nothing is deleted. */
|
|
84
|
+
export declare function abortUpload(config: AppConfig, uploadId: string, signal?: AbortSignal): Promise<void>;
|
|
85
|
+
/** Typed refusals the upload routes send (`code` in the error body). */
|
|
86
|
+
export type UploadErrorCode = "uploads_disabled" | "policy" | "upload_too_large" | "upload_not_found" | "upload_expired" | "part_out_of_range" | "checksum_mismatch" | "size_mismatch" | "parts_missing" | "upload_completed" | "file_exists" | "upload_in_progress" | "quota_exceeded" | "not_current" | "complete_conflict" | "complete_in_progress";
|
|
87
|
+
/** The contract's code for this error, or undefined for anything else. */
|
|
88
|
+
export declare function uploadErrorCode(error: unknown): UploadErrorCode | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Uploads are off for this caller: the flag is off (404 `uploads_disabled`), the organisation is not
|
|
91
|
+
* enrolled (403 `policy`), or the server predates the routes (404 on start, no code).
|
|
92
|
+
*/
|
|
93
|
+
export declare function uploadsUnavailable(error: unknown): boolean;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resumable project uploads (C1–C4b): the control calls. File bytes never pass
|
|
3
|
+
* through these; they go to presigned part URLs (see multipartUpload.ts). A
|
|
4
|
+
* completed upload is the project's file at its path, one current version per path.
|
|
5
|
+
*/
|
|
6
|
+
import { ApiError } from "./types.js";
|
|
7
|
+
import { apiFetch } from "./apiClient.js";
|
|
8
|
+
/** Most parts one sign call may ask for. */
|
|
9
|
+
export const MAX_SIGN_BATCH = 100;
|
|
10
|
+
const uploadPath = (uploadId) => `/uploads/${encodeURIComponent(uploadId)}`;
|
|
11
|
+
/** C1: find the open or completed upload for this file, or create one. Idempotent on the server, so retried. */
|
|
12
|
+
export function startUpload(config, request, signal) {
|
|
13
|
+
return apiFetch(config, "/uploads", { method: "POST", body: request, retry: "safe", signal });
|
|
14
|
+
}
|
|
15
|
+
/** C2: presigned PUT URLs for these parts, each bound to the part's SHA-256 (base64). */
|
|
16
|
+
export async function signUploadParts(config, uploadId, parts, signal) {
|
|
17
|
+
if (parts.length > MAX_SIGN_BATCH)
|
|
18
|
+
throw new RangeError(`at most ${MAX_SIGN_BATCH} parts per sign call`);
|
|
19
|
+
const data = await apiFetch(config, `${uploadPath(uploadId)}/parts/sign`, {
|
|
20
|
+
method: "POST", body: { parts }, retry: "safe", signal,
|
|
21
|
+
});
|
|
22
|
+
return data.parts ?? [];
|
|
23
|
+
}
|
|
24
|
+
/** C3: the upload's state and the parts S3 already holds. */
|
|
25
|
+
export function getUpload(config, uploadId, signal) {
|
|
26
|
+
return apiFetch(config, uploadPath(uploadId), { signal });
|
|
27
|
+
}
|
|
28
|
+
/** C4: the server completes from its own part list. Not resent automatically: an unknown outcome is re-read with getUpload; a repeat answers the stored outcome. */
|
|
29
|
+
export function completeUpload(config, uploadId, signal, resumeTrust) {
|
|
30
|
+
return apiFetch(config, `${uploadPath(uploadId)}/complete`, {
|
|
31
|
+
// complete_in_progress asks to come back in up to a minute (Retry-After); a 429 keeps the usual cap.
|
|
32
|
+
method: "POST", body: resumeTrust ? { resume_trust: resumeTrust } : {}, signal, maxRetryAfterMs: 60_000,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** C4b: abort an open upload. A completed upload answers 409 `upload_completed`; nothing is deleted. */
|
|
36
|
+
export async function abortUpload(config, uploadId, signal) {
|
|
37
|
+
await apiFetch(config, uploadPath(uploadId), { method: "DELETE", signal });
|
|
38
|
+
}
|
|
39
|
+
const UPLOAD_CODES = new Set([
|
|
40
|
+
"uploads_disabled", "policy", "upload_too_large", "upload_not_found", "upload_expired",
|
|
41
|
+
"part_out_of_range", "checksum_mismatch", "size_mismatch", "parts_missing", "upload_completed",
|
|
42
|
+
"file_exists", "upload_in_progress", "quota_exceeded", "not_current", "complete_conflict", "complete_in_progress",
|
|
43
|
+
]);
|
|
44
|
+
/** The contract's code for this error, or undefined for anything else. */
|
|
45
|
+
export function uploadErrorCode(error) {
|
|
46
|
+
if (!(error instanceof ApiError) || !error.code)
|
|
47
|
+
return undefined;
|
|
48
|
+
return UPLOAD_CODES.has(error.code) ? error.code : undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Uploads are off for this caller: the flag is off (404 `uploads_disabled`), the organisation is not
|
|
52
|
+
* enrolled (403 `policy`), or the server predates the routes (404 on start, no code).
|
|
53
|
+
*/
|
|
54
|
+
export function uploadsUnavailable(error) {
|
|
55
|
+
if (!(error instanceof ApiError))
|
|
56
|
+
return false;
|
|
57
|
+
const code = uploadErrorCode(error);
|
|
58
|
+
if (code === "uploads_disabled" || code === "policy")
|
|
59
|
+
return true;
|
|
60
|
+
return error.status === 404 && !error.code && error.path === "/uploads";
|
|
61
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** BioVault — evidence search, job management, export. */
|
|
2
|
+
import type { AppConfig, VaultSearchResult, VaultEvidenceResponse, VaultJobCreate, VaultJobResponse, VaultJobListResponse, VaultExportRequest, VaultExportResponse } from "./types.js";
|
|
3
|
+
/** Search the evidence cache for a pre-computed result (unauthenticated). */
|
|
4
|
+
export declare function vaultSearch(config: AppConfig, params: {
|
|
5
|
+
genes: string[];
|
|
6
|
+
disease: string;
|
|
7
|
+
control: string;
|
|
8
|
+
}): Promise<VaultSearchResult>;
|
|
9
|
+
/** Get an evidence card by ID with presigned plot URLs (unauthenticated). */
|
|
10
|
+
export declare function getEvidence(config: AppConfig, evidenceId: string): Promise<VaultEvidenceResponse>;
|
|
11
|
+
/** Create a custom vault job (authenticated, tier-gated). */
|
|
12
|
+
export declare function vaultAsk(config: AppConfig, job: VaultJobCreate): Promise<VaultJobResponse>;
|
|
13
|
+
/** Get vault job status (authenticated, ownership-checked). */
|
|
14
|
+
export declare function getJobStatus(config: AppConfig, jobId: string): Promise<VaultJobResponse>;
|
|
15
|
+
/** List the current user's vault jobs (authenticated). */
|
|
16
|
+
export declare function listVaultJobs(config: AppConfig): Promise<VaultJobListResponse>;
|
|
17
|
+
/** Cancel a running vault job (authenticated, ownership-checked). */
|
|
18
|
+
export declare function cancelVaultJob(config: AppConfig, jobId: string): Promise<VaultJobResponse>;
|
|
19
|
+
/** Export evidence artifacts (authenticated, paid tier only). */
|
|
20
|
+
export declare function vaultExport(config: AppConfig, request: VaultExportRequest): Promise<VaultExportResponse>;
|