@ornncompute/cli 1.0.121 → 1.0.122
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/package.json +1 -1
- package/src/external-bucket-commands.mjs +25 -46
- package/src/mount-commands.mjs +3 -9
- package/src/storage-commands.mjs +54 -95
- package/vendor/api-client/commerce.js +109 -0
- package/vendor/api-client/orchestrator.js +207 -1
- package/vendor/capabilities/cli.js +108 -58
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import * as storageApi from "../vendor/api-client/orchestrator.js";
|
|
1
2
|
import * as gatewayApi from "../vendor/api-client/gateway.js";
|
|
2
3
|
import { createHash } from "node:crypto";
|
|
3
4
|
import { readFile } from "node:fs/promises";
|
|
4
5
|
|
|
5
|
-
import { CliApiError
|
|
6
|
+
import { CliApiError } from "./api-client.mjs";
|
|
6
7
|
import { isRecoverableWaitFailure } from "./interaction-runtime.mjs";
|
|
7
8
|
import {
|
|
8
9
|
codeOf,
|
|
@@ -18,7 +19,6 @@ import {
|
|
|
18
19
|
|
|
19
20
|
const IMPORT_POLL_INTERVAL_MS = 10_000;
|
|
20
21
|
const DEFAULT_IMPORT_TIMEOUT_MS = 30 * 60 * 1_000;
|
|
21
|
-
const STORAGE_PREFIX = "/nodes/storage-drives";
|
|
22
22
|
const PROVIDERS = new Set(["gcs", "s3", "r2"]);
|
|
23
23
|
|
|
24
24
|
function usage(message, field, code = "usage_error") {
|
|
@@ -438,27 +438,6 @@ function requireMutationPreflight(input, runtime) {
|
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
const SAFE_EXTERNAL_ERRORS = {
|
|
442
|
-
external_bucket_required: "The external bucket record is incomplete.",
|
|
443
|
-
external_endpoint_url_invalid: "The Cloudflare R2 endpoint is invalid.",
|
|
444
|
-
external_endpoint_url_required: "Cloudflare R2 requires an account endpoint.",
|
|
445
|
-
external_s3_credentials_required: "Current S3-compatible credentials are required.",
|
|
446
|
-
storage_drive_attached_elsewhere:
|
|
447
|
-
"This working volume is already attached to a different reservation.",
|
|
448
|
-
storage_drive_attached_to_reservation:
|
|
449
|
-
"Detach the working volume from every reservation before disconnecting the source.",
|
|
450
|
-
storage_location_unavailable:
|
|
451
|
-
"No managed destination is available for this reservation. The source bucket was not changed.",
|
|
452
|
-
storage_regional_bucket_unconfigured:
|
|
453
|
-
"Managed destination storage is temporarily unavailable. The source bucket was not changed.",
|
|
454
|
-
storage_reservation_node_offline:
|
|
455
|
-
"A reservation machine is offline, so the import destination was not changed.",
|
|
456
|
-
storage_source_client_unavailable: "The external bucket client is temporarily unavailable.",
|
|
457
|
-
storage_source_list_failed: "Ornn could not read the external bucket.",
|
|
458
|
-
storage_source_not_verified: "Verify this external bucket before importing it.",
|
|
459
|
-
storage_source_verification_unsupported: "This external bucket kind cannot be verified.",
|
|
460
|
-
};
|
|
461
|
-
|
|
462
441
|
function safeExternalError(error, fallback, { action, forcePartial = false } = {}) {
|
|
463
442
|
if (error instanceof StorageCommandError) return error;
|
|
464
443
|
if (error instanceof CliApiError && (error.status === 401 || error.status === 403)) {
|
|
@@ -476,8 +455,7 @@ function safeExternalError(error, fallback, { action, forcePartial = false } = {
|
|
|
476
455
|
const unavailable = error?.status === undefined || error?.status >= 500;
|
|
477
456
|
const ownerMessage = detailOf(error)?.message;
|
|
478
457
|
return new StorageCommandError(
|
|
479
|
-
|
|
480
|
-
(typeof ownerMessage === "string" && ownerMessage.trim() ? ownerMessage : fallback),
|
|
458
|
+
typeof ownerMessage === "string" && ownerMessage.trim() ? ownerMessage : fallback,
|
|
481
459
|
{
|
|
482
460
|
action,
|
|
483
461
|
code: code ?? (unavailable ? "service_unavailable" : "external_bucket_operation_failed"),
|
|
@@ -560,8 +538,9 @@ async function connectBucket(input, runtime) {
|
|
|
560
538
|
|
|
561
539
|
let created;
|
|
562
540
|
try {
|
|
563
|
-
created = await
|
|
564
|
-
|
|
541
|
+
created = await storageApi.createDrive(
|
|
542
|
+
runtime.fetch,
|
|
543
|
+
{
|
|
565
544
|
name: intent.name,
|
|
566
545
|
provider: "ornn_volume",
|
|
567
546
|
source_provider: intent.kind === "gcs" ? "external_gcs" : "s3",
|
|
@@ -575,9 +554,8 @@ async function connectBucket(input, runtime) {
|
|
|
575
554
|
...(intent.accessKeyId ? { external_access_key_id: intent.accessKeyId } : {}),
|
|
576
555
|
...(intent.secretAccessKey ? { external_secret_access_key: intent.secretAccessKey } : {}),
|
|
577
556
|
},
|
|
578
|
-
headers: idempotencyHeaders(input)
|
|
579
|
-
|
|
580
|
-
});
|
|
557
|
+
{ headers: idempotencyHeaders(input) }
|
|
558
|
+
);
|
|
581
559
|
} catch (error) {
|
|
582
560
|
throw safeExternalError(error, "The external bucket could not be connected safely.");
|
|
583
561
|
}
|
|
@@ -609,12 +587,11 @@ async function verifyBucket(input, runtime) {
|
|
|
609
587
|
const id = safeIdentifier(source.id);
|
|
610
588
|
let verified;
|
|
611
589
|
try {
|
|
612
|
-
verified = await
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}
|
|
590
|
+
verified = await storageApi.updateDrive(
|
|
591
|
+
runtime.fetch,
|
|
592
|
+
id,
|
|
593
|
+
{ verify_source: true },
|
|
594
|
+
{ headers: idempotencyHeaders(input) }
|
|
618
595
|
);
|
|
619
596
|
} catch (error) {
|
|
620
597
|
throw safeExternalError(error, "External bucket verification could not be completed safely.");
|
|
@@ -668,16 +645,16 @@ async function updateCredentials(input, runtime) {
|
|
|
668
645
|
const id = safeIdentifier(source.id);
|
|
669
646
|
let updated;
|
|
670
647
|
try {
|
|
671
|
-
updated = await
|
|
672
|
-
|
|
648
|
+
updated = await storageApi.updateDrive(
|
|
649
|
+
runtime.fetch,
|
|
650
|
+
id,
|
|
673
651
|
{
|
|
674
|
-
|
|
652
|
+
source_credentials: {
|
|
675
653
|
external_access_key_id: accessKeyId,
|
|
676
654
|
external_secret_access_key: secret,
|
|
677
655
|
},
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
}
|
|
656
|
+
},
|
|
657
|
+
{ headers: idempotencyHeaders(input) }
|
|
681
658
|
);
|
|
682
659
|
} catch (error) {
|
|
683
660
|
throw safeExternalError(error, "External bucket credentials could not be updated safely.");
|
|
@@ -715,10 +692,12 @@ async function disconnectBucket(input, runtime) {
|
|
|
715
692
|
);
|
|
716
693
|
}
|
|
717
694
|
try {
|
|
718
|
-
await
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
695
|
+
await storageApi.deleteDrive(
|
|
696
|
+
runtime.fetch,
|
|
697
|
+
safe.id,
|
|
698
|
+
{},
|
|
699
|
+
{ headers: idempotencyHeaders(input) }
|
|
700
|
+
);
|
|
722
701
|
} catch (error) {
|
|
723
702
|
throw safeExternalError(error, "The external bucket could not be disconnected safely.");
|
|
724
703
|
}
|
package/src/mount-commands.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as storageApi from "../vendor/api-client/orchestrator.js";
|
|
1
2
|
import * as gatewayApi from "../vendor/api-client/gateway.js";
|
|
2
3
|
import { CliApiError } from "./api-client.mjs";
|
|
3
4
|
import { isRecoverableWaitFailure } from "./interaction-runtime.mjs";
|
|
@@ -314,12 +315,7 @@ async function reservationMachineCount(runtime, reservationId, signal) {
|
|
|
314
315
|
if (cache.has(reservationId)) return cache.get(reservationId);
|
|
315
316
|
let count = 0;
|
|
316
317
|
try {
|
|
317
|
-
const rows = candidateRows(
|
|
318
|
-
await runtime.fetch("/v1/orchestrator/storage-targets", {
|
|
319
|
-
method: "GET",
|
|
320
|
-
...(signal ? { signal } : {}),
|
|
321
|
-
})
|
|
322
|
-
);
|
|
318
|
+
const rows = candidateRows(await storageApi.listStorageTargets(runtime.fetch, signal));
|
|
323
319
|
const row = rows.find(
|
|
324
320
|
(candidate) =>
|
|
325
321
|
candidate.id === reservationId || candidate.reservation_ids.includes(reservationId)
|
|
@@ -560,9 +556,7 @@ async function candidates(input, runtime) {
|
|
|
560
556
|
"ornn volume-mounts candidates [--limit <1-500>] [--cursor <cursor>]",
|
|
561
557
|
runtime.interaction
|
|
562
558
|
);
|
|
563
|
-
const rows = candidateRows(
|
|
564
|
-
await runtime.fetch("/v1/orchestrator/storage-targets", { method: "GET" })
|
|
565
|
-
);
|
|
559
|
+
const rows = candidateRows(await storageApi.listStorageTargets(runtime.fetch));
|
|
566
560
|
const offset = cursorOffset(input.cursor, runtime.interaction);
|
|
567
561
|
const limit = pageLimit(input.limit, runtime.interaction);
|
|
568
562
|
if (offset > rows.length) {
|
package/src/storage-commands.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as storageApi from "../vendor/api-client/orchestrator.js";
|
|
1
2
|
import { createHash } from "node:crypto";
|
|
2
3
|
import { createReadStream } from "node:fs";
|
|
3
4
|
import { stat } from "node:fs/promises";
|
|
@@ -6,7 +7,6 @@ import { Readable } from "node:stream";
|
|
|
6
7
|
|
|
7
8
|
import {
|
|
8
9
|
CliApiError,
|
|
9
|
-
computeEndpoint,
|
|
10
10
|
loadRequiredSession,
|
|
11
11
|
raiseForFailedResponse,
|
|
12
12
|
resolveApiBaseUrl,
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
|
|
21
21
|
const DEFAULT_PAGE_LIMIT = 50;
|
|
22
22
|
const MAX_PAGE_LIMIT = 500;
|
|
23
|
-
const STORAGE_PREFIX = "/nodes/storage-drives";
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* Narrow CLI adapter expected by executeStorageCommand:
|
|
@@ -143,13 +142,6 @@ function normalizeRemotePath(value, { allowEmpty = false, field = "path" } = {})
|
|
|
143
142
|
return segments.join("/");
|
|
144
143
|
}
|
|
145
144
|
|
|
146
|
-
function encodedRemotePath(path) {
|
|
147
|
-
return path
|
|
148
|
-
.split("/")
|
|
149
|
-
.map((segment) => encodeURIComponent(segment))
|
|
150
|
-
.join("/");
|
|
151
|
-
}
|
|
152
|
-
|
|
153
145
|
function isManagedVolume(drive) {
|
|
154
146
|
const provider = String(drive?.provider ?? "").toLocaleLowerCase("en-US");
|
|
155
147
|
const sourceProvider = String(
|
|
@@ -255,19 +247,6 @@ export function codeOf(error) {
|
|
|
255
247
|
return nested && /^[a-z][a-z0-9_]*$/.test(nested) ? nested : null;
|
|
256
248
|
}
|
|
257
249
|
|
|
258
|
-
const SAFE_ERROR_MESSAGES = {
|
|
259
|
-
storage_content_busy: "The volume content is still changing. Inspect the volume and try again.",
|
|
260
|
-
storage_drive_attached_to_reservation:
|
|
261
|
-
"This volume still has a reservation relationship. Detach every volume mount before deleting it.",
|
|
262
|
-
storage_drive_mounted: "This volume is mounted. Detach it before changing its files.",
|
|
263
|
-
storage_drive_not_found: "The requested volume was not found.",
|
|
264
|
-
storage_file_not_found: "The requested volume file was not found.",
|
|
265
|
-
storage_folder_not_found: "The requested volume folder was not found.",
|
|
266
|
-
storage_object_file_api_unsupported: "This volume does not support nested file operations.",
|
|
267
|
-
storage_pending_uploads:
|
|
268
|
-
"This volume has an upload still being finalized. Inspect it and try again.",
|
|
269
|
-
};
|
|
270
|
-
|
|
271
250
|
function safeStorageError(error, fallback, { action } = {}) {
|
|
272
251
|
if (error instanceof StorageCommandError) return error;
|
|
273
252
|
if (error instanceof AtomicOutputExistsError) {
|
|
@@ -285,8 +264,7 @@ function safeStorageError(error, fallback, { action } = {}) {
|
|
|
285
264
|
const unavailable = code === "service_unavailable";
|
|
286
265
|
const ownerMessage = detailOf(error)?.message;
|
|
287
266
|
return new StorageCommandError(
|
|
288
|
-
|
|
289
|
-
(typeof ownerMessage === "string" && ownerMessage.trim() ? ownerMessage : fallback),
|
|
267
|
+
typeof ownerMessage === "string" && ownerMessage.trim() ? ownerMessage : fallback,
|
|
290
268
|
{
|
|
291
269
|
action,
|
|
292
270
|
code,
|
|
@@ -313,11 +291,11 @@ export async function fetchDrivePage(runtime, { limit = 25, cursor, scope = "all
|
|
|
313
291
|
if (!Number.isInteger(Number(limit)) || Number(limit) < 1 || Number(limit) > 100) {
|
|
314
292
|
usage("--limit must be an integer from 1 through 100.", "limit");
|
|
315
293
|
}
|
|
316
|
-
const params = new URLSearchParams({ limit: String(limit), scope });
|
|
317
|
-
if (cursor) params.set("cursor", cursor);
|
|
318
294
|
try {
|
|
319
|
-
const payload = await runtime.fetch
|
|
320
|
-
|
|
295
|
+
const payload = await storageApi.listDrives(runtime.fetch, {
|
|
296
|
+
limit: Number(limit),
|
|
297
|
+
scope,
|
|
298
|
+
...(cursor ? { cursor } : {}),
|
|
321
299
|
});
|
|
322
300
|
return { drives: volumeRows(payload), next_cursor: payload?.next_cursor ?? null };
|
|
323
301
|
} catch (error) {
|
|
@@ -367,10 +345,7 @@ function resolveFromRows(rows, reference, { source = false } = {}) {
|
|
|
367
345
|
|
|
368
346
|
export async function resolveVolume(runtime, reference) {
|
|
369
347
|
if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(reference)) {
|
|
370
|
-
const drive = await runtime.fetch
|
|
371
|
-
computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(reference)}`),
|
|
372
|
-
{ method: "GET" }
|
|
373
|
-
);
|
|
348
|
+
const drive = await storageApi.getDrive(runtime.fetch, reference);
|
|
374
349
|
return resolveFromRows([drive], reference);
|
|
375
350
|
}
|
|
376
351
|
return resolveFromRows(await fetchDrives(runtime), reference);
|
|
@@ -418,10 +393,8 @@ async function createVolume(input, runtime) {
|
|
|
418
393
|
|
|
419
394
|
const body = { name, source_drive_id: source ? String(source.id) : null };
|
|
420
395
|
try {
|
|
421
|
-
const created = await runtime.fetch
|
|
422
|
-
body,
|
|
396
|
+
const created = await storageApi.createDrive(runtime.fetch, body, {
|
|
423
397
|
headers: idempotencyHeaders(input),
|
|
424
|
-
method: "POST",
|
|
425
398
|
});
|
|
426
399
|
return runtime.interaction.result({
|
|
427
400
|
data: { effective_input: effective, replayed: false, volume: safeVolume(created) },
|
|
@@ -477,10 +450,7 @@ async function showVolume(input, runtime, { refresh = false } = {}) {
|
|
|
477
450
|
return runtime.interaction.result({ data: { volume: safeVolume(drive) } });
|
|
478
451
|
}
|
|
479
452
|
try {
|
|
480
|
-
const refreshed = await runtime.fetch(
|
|
481
|
-
computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/refresh`),
|
|
482
|
-
{ method: "POST" }
|
|
483
|
-
);
|
|
453
|
+
const refreshed = await storageApi.getDrive(runtime.fetch, String(drive.id), { refresh: true });
|
|
484
454
|
return runtime.interaction.result({
|
|
485
455
|
data: { volume: safeVolume(refreshed) },
|
|
486
456
|
outcome: { class: "ready", phase: "refreshed" },
|
|
@@ -495,10 +465,7 @@ async function clearVolume(input, runtime) {
|
|
|
495
465
|
const [reference] = positionals(input, 1, "Usage: ornn volumes clear <volume>");
|
|
496
466
|
const drive = await resolveVolume(runtime, reference);
|
|
497
467
|
try {
|
|
498
|
-
const payload = await runtime.fetch(
|
|
499
|
-
computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/contents`),
|
|
500
|
-
{ method: "DELETE" }
|
|
501
|
-
);
|
|
468
|
+
const payload = await storageApi.clearDriveContents(runtime.fetch, String(drive.id));
|
|
502
469
|
return runtime.interaction.result({
|
|
503
470
|
data: {
|
|
504
471
|
cleared: true,
|
|
@@ -533,12 +500,11 @@ async function deleteVolume(input, runtime) {
|
|
|
533
500
|
requireMachineMutationKey(input, runtime);
|
|
534
501
|
const drive = await resolveVolume(runtime, reference);
|
|
535
502
|
try {
|
|
536
|
-
await
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
503
|
+
await storageApi.deleteDrive(
|
|
504
|
+
runtime.fetch,
|
|
505
|
+
String(drive.id),
|
|
506
|
+
{},
|
|
507
|
+
{ headers: idempotencyHeaders(input) }
|
|
542
508
|
);
|
|
543
509
|
return runtime.interaction.result({
|
|
544
510
|
data: { deleted: true, volume: safeVolume(drive) },
|
|
@@ -590,17 +556,13 @@ async function fetchFileRows(runtime, drive, prefix) {
|
|
|
590
556
|
const entries = [];
|
|
591
557
|
let cursor = 0;
|
|
592
558
|
while (cursor !== null) {
|
|
593
|
-
const query = new URLSearchParams({ recursive: "true" });
|
|
594
|
-
if (folder) query.set("path", folder);
|
|
595
|
-
if (cursor) query.set("cursor", String(cursor));
|
|
596
559
|
let page;
|
|
597
560
|
try {
|
|
598
|
-
page = await runtime.fetch(
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
),
|
|
602
|
-
|
|
603
|
-
);
|
|
561
|
+
page = await storageApi.listDriveContents(runtime.fetch, String(drive.id), {
|
|
562
|
+
recursive: true,
|
|
563
|
+
...(folder ? { path: folder } : {}),
|
|
564
|
+
...(cursor ? { cursor } : {}),
|
|
565
|
+
});
|
|
604
566
|
} catch (error) {
|
|
605
567
|
throw safeStorageError(error, "Volume files could not be listed safely.");
|
|
606
568
|
}
|
|
@@ -719,12 +681,7 @@ async function putSignedUpload({
|
|
|
719
681
|
|
|
720
682
|
async function cancelUpload(runtime, driveId, uploadId) {
|
|
721
683
|
try {
|
|
722
|
-
await runtime.fetch
|
|
723
|
-
computeEndpoint(
|
|
724
|
-
`${STORAGE_PREFIX}/${encodeURIComponent(driveId)}/file-uploads/${encodeURIComponent(uploadId)}`
|
|
725
|
-
),
|
|
726
|
-
{ method: "DELETE" }
|
|
727
|
-
);
|
|
684
|
+
await storageApi.cancelDriveUpload(runtime.fetch, driveId, uploadId);
|
|
728
685
|
} catch {
|
|
729
686
|
// Preserve the transfer error. Finalizing sessions are owner-reconciled.
|
|
730
687
|
}
|
|
@@ -762,13 +719,11 @@ async function uploadFile(input, runtime) {
|
|
|
762
719
|
const sha256 = requestHash.digest("hex");
|
|
763
720
|
let session;
|
|
764
721
|
try {
|
|
765
|
-
session = await
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
method: "POST",
|
|
771
|
-
}
|
|
722
|
+
session = await storageApi.startDriveUpload(
|
|
723
|
+
runtime.fetch,
|
|
724
|
+
String(drive.id),
|
|
725
|
+
{ content_type: contentType, path: remotePath, size_bytes: fileInfo.size, sha256 },
|
|
726
|
+
{ headers: idempotencyHeaders(input) }
|
|
772
727
|
);
|
|
773
728
|
} catch (error) {
|
|
774
729
|
throw safeStorageError(error, "The upload could not be staged safely.");
|
|
@@ -803,24 +758,25 @@ async function uploadFile(input, runtime) {
|
|
|
803
758
|
sizeBytes: fileInfo.size,
|
|
804
759
|
uploadUrl: session.upload_url,
|
|
805
760
|
});
|
|
806
|
-
const completionPath = computeEndpoint(
|
|
807
|
-
`${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/file-uploads/${encodeURIComponent(uploadId)}/complete`
|
|
808
|
-
);
|
|
809
761
|
let completed;
|
|
810
762
|
try {
|
|
811
|
-
completed = await
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
763
|
+
completed = await storageApi.completeDriveUpload(
|
|
764
|
+
runtime.fetch,
|
|
765
|
+
String(drive.id),
|
|
766
|
+
uploadId,
|
|
767
|
+
{ uploaded_generation: uploaded.generation },
|
|
768
|
+
{ headers: idempotencyHeaders(input) }
|
|
769
|
+
);
|
|
816
770
|
} catch (error) {
|
|
817
771
|
if (!(error instanceof CliApiError) || (error.status !== undefined && error.status < 500))
|
|
818
772
|
throw error;
|
|
819
|
-
completed = await
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
773
|
+
completed = await storageApi.completeDriveUpload(
|
|
774
|
+
runtime.fetch,
|
|
775
|
+
String(drive.id),
|
|
776
|
+
uploadId,
|
|
777
|
+
{ uploaded_generation: uploaded.generation },
|
|
778
|
+
{ headers: idempotencyHeaders(input) }
|
|
779
|
+
);
|
|
824
780
|
}
|
|
825
781
|
const file = safeFile(completed?.file ?? { path: remotePath, size_bytes: fileInfo.size });
|
|
826
782
|
return runtime.interaction.result({
|
|
@@ -888,16 +844,19 @@ async function downloadFile(input, runtime) {
|
|
|
888
844
|
const drive = await resolveVolume(runtime, reference);
|
|
889
845
|
const session = await loadRequiredSession({ env: runtime.env });
|
|
890
846
|
const baseUrl = resolveApiBaseUrl({ env: runtime.env, session });
|
|
891
|
-
const endpoint =
|
|
892
|
-
`${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/files/${encodedRemotePath(remotePath)}`
|
|
893
|
-
);
|
|
847
|
+
const endpoint = storageApi.driveFilePath(String(drive.id), remotePath);
|
|
894
848
|
const url = new URL(endpoint, `${baseUrl}/`);
|
|
895
849
|
let response;
|
|
896
850
|
try {
|
|
897
|
-
response = await
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
851
|
+
response = await storageApi.downloadDriveFile(
|
|
852
|
+
(path, init) =>
|
|
853
|
+
runtime.fetchImpl(new URL(path, `${baseUrl}/`), {
|
|
854
|
+
...init,
|
|
855
|
+
headers: userCredentialHeaders(session),
|
|
856
|
+
}),
|
|
857
|
+
String(drive.id),
|
|
858
|
+
remotePath
|
|
859
|
+
);
|
|
901
860
|
} catch {
|
|
902
861
|
throw new StorageCommandError("The volume file could not be downloaded safely.", {
|
|
903
862
|
code: "service_unavailable",
|
|
@@ -950,11 +909,11 @@ async function deleteContent(command, input, runtime) {
|
|
|
950
909
|
);
|
|
951
910
|
const remotePath = normalizeRemotePath(rawRemotePath);
|
|
952
911
|
const drive = await resolveVolume(runtime, reference);
|
|
953
|
-
|
|
954
|
-
`${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/${kind}s/${encodedRemotePath(remotePath)}`
|
|
955
|
-
);
|
|
912
|
+
|
|
956
913
|
try {
|
|
957
|
-
const payload = await
|
|
914
|
+
const payload = await (
|
|
915
|
+
kind === "file" ? storageApi.deleteDriveFile : storageApi.deleteDriveFolder
|
|
916
|
+
)(runtime.fetch, String(drive.id), remotePath);
|
|
958
917
|
return runtime.interaction.result({
|
|
959
918
|
data: {
|
|
960
919
|
deleted: true,
|
|
@@ -370,6 +370,97 @@ function deleteComputeDealAddOn(request, id2, addOnId, body) {
|
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
// ../../packages/api-client/dist/commerce/compute-contracts.js
|
|
374
|
+
var contracts = "/internal/v1/gtm/compute-contracts";
|
|
375
|
+
var contractPath = (id2) => `${contracts}/${encodeURIComponent(id2)}`;
|
|
376
|
+
var documents = (id2) => `${contractPath(id2)}/documents`;
|
|
377
|
+
var lines = (id2) => `${contractPath(id2)}/lines`;
|
|
378
|
+
var delayPenalties = (id2) => `${contractPath(id2)}/delay-penalties`;
|
|
379
|
+
function listComputeContracts(request, input = {}, signal) {
|
|
380
|
+
return request(contracts + queryString(input), { method: "GET", signal });
|
|
381
|
+
}
|
|
382
|
+
async function listAllComputeContracts(request, filter = {}, signal) {
|
|
383
|
+
const contracts2 = [];
|
|
384
|
+
const seen = /* @__PURE__ */ new Set();
|
|
385
|
+
let after;
|
|
386
|
+
for (; ; ) {
|
|
387
|
+
const page = await listComputeContracts(request, { ...filter, after }, signal);
|
|
388
|
+
contracts2.push(...page.contracts);
|
|
389
|
+
if (!page.nextCursor)
|
|
390
|
+
return { ...page, contracts: contracts2 };
|
|
391
|
+
if (seen.has(page.nextCursor))
|
|
392
|
+
throw new Error("Compute contracts returned an incomplete list.");
|
|
393
|
+
seen.add(page.nextCursor);
|
|
394
|
+
after = page.nextCursor;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
function getComputeContract(request, id2, signal) {
|
|
398
|
+
return request(contractPath(id2), { method: "GET", signal });
|
|
399
|
+
}
|
|
400
|
+
function createComputeContract(request, body) {
|
|
401
|
+
return request(contracts, { method: "POST", body });
|
|
402
|
+
}
|
|
403
|
+
function updateComputeContract(request, id2, body) {
|
|
404
|
+
return request(contractPath(id2), { method: "PUT", body });
|
|
405
|
+
}
|
|
406
|
+
function deleteComputeContract(request, id2, body) {
|
|
407
|
+
return request(contractPath(id2), { method: "DELETE", body });
|
|
408
|
+
}
|
|
409
|
+
function listComputeContractDocuments(request, id2, signal) {
|
|
410
|
+
return request(documents(id2), { method: "GET", signal });
|
|
411
|
+
}
|
|
412
|
+
function createComputeContractDocument(request, id2, body) {
|
|
413
|
+
return request(documents(id2), { method: "POST", body });
|
|
414
|
+
}
|
|
415
|
+
function updateComputeContractDocument(request, id2, documentId, body) {
|
|
416
|
+
return request(`${documents(id2)}/${encodeURIComponent(documentId)}`, {
|
|
417
|
+
method: "PUT",
|
|
418
|
+
body
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function deleteComputeContractDocument(request, id2, documentId, body) {
|
|
422
|
+
return request(`${documents(id2)}/${encodeURIComponent(documentId)}`, {
|
|
423
|
+
method: "DELETE",
|
|
424
|
+
body
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
function listComputeContractLines(request, id2, signal) {
|
|
428
|
+
return request(lines(id2), { method: "GET", signal });
|
|
429
|
+
}
|
|
430
|
+
function createComputeContractLine(request, id2, body) {
|
|
431
|
+
return request(lines(id2), { method: "POST", body });
|
|
432
|
+
}
|
|
433
|
+
function updateComputeContractLine(request, id2, lineId, body) {
|
|
434
|
+
return request(`${lines(id2)}/${encodeURIComponent(lineId)}`, {
|
|
435
|
+
method: "PUT",
|
|
436
|
+
body
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
function deleteComputeContractLine(request, id2, lineId, body) {
|
|
440
|
+
return request(`${lines(id2)}/${encodeURIComponent(lineId)}`, {
|
|
441
|
+
method: "DELETE",
|
|
442
|
+
body
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
function listComputeContractDelayPenalties(request, id2, signal) {
|
|
446
|
+
return request(delayPenalties(id2), { method: "GET", signal });
|
|
447
|
+
}
|
|
448
|
+
function createComputeContractDelayPenalty(request, id2, body) {
|
|
449
|
+
return request(delayPenalties(id2), { method: "POST", body });
|
|
450
|
+
}
|
|
451
|
+
function updateComputeContractDelayPenalty(request, id2, penaltyId, body) {
|
|
452
|
+
return request(`${delayPenalties(id2)}/${encodeURIComponent(penaltyId)}`, {
|
|
453
|
+
method: "PUT",
|
|
454
|
+
body
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
function deleteComputeContractDelayPenalty(request, id2, penaltyId, body) {
|
|
458
|
+
return request(`${delayPenalties(id2)}/${encodeURIComponent(penaltyId)}`, {
|
|
459
|
+
method: "DELETE",
|
|
460
|
+
body
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
|
|
373
464
|
// ../../packages/api-client/dist/commerce/contract-extractions.js
|
|
374
465
|
var extractions = "/internal/v1/gtm/contract-extractions";
|
|
375
466
|
var extractionPath = (id2) => `${extractions}/${encodeURIComponent(id2)}`;
|
|
@@ -746,6 +837,10 @@ export {
|
|
|
746
837
|
completeReservation,
|
|
747
838
|
createBillingSetupIntent,
|
|
748
839
|
createCapacityListing,
|
|
840
|
+
createComputeContract,
|
|
841
|
+
createComputeContractDelayPenalty,
|
|
842
|
+
createComputeContractDocument,
|
|
843
|
+
createComputeContractLine,
|
|
749
844
|
createComputeDeal,
|
|
750
845
|
createComputeDealAddOn,
|
|
751
846
|
createContractExtraction,
|
|
@@ -763,6 +858,10 @@ export {
|
|
|
763
858
|
createSupplierIntakeLink,
|
|
764
859
|
createSupplierPaymentAccount,
|
|
765
860
|
deleteCapacityTerms,
|
|
861
|
+
deleteComputeContract,
|
|
862
|
+
deleteComputeContractDelayPenalty,
|
|
863
|
+
deleteComputeContractDocument,
|
|
864
|
+
deleteComputeContractLine,
|
|
766
865
|
deleteComputeDeal,
|
|
767
866
|
deleteComputeDealAddOn,
|
|
768
867
|
deleteContractExtraction,
|
|
@@ -782,6 +881,7 @@ export {
|
|
|
782
881
|
getCapacityListingImage,
|
|
783
882
|
getCapacityListingSpecPdf,
|
|
784
883
|
getCommerceOrganization,
|
|
884
|
+
getComputeContract,
|
|
785
885
|
getContractExtraction,
|
|
786
886
|
getContractFile,
|
|
787
887
|
getControlplaneLicense,
|
|
@@ -803,6 +903,7 @@ export {
|
|
|
803
903
|
getSupplierPaymentAccount,
|
|
804
904
|
listAdminInvoices,
|
|
805
905
|
listAllCapacityListings,
|
|
906
|
+
listAllComputeContracts,
|
|
806
907
|
listAllComputeDeals,
|
|
807
908
|
listAllContractExtractions,
|
|
808
909
|
listAllContractFiles,
|
|
@@ -814,8 +915,12 @@ export {
|
|
|
814
915
|
listCapacityNodes,
|
|
815
916
|
listCapacityTerms,
|
|
816
917
|
listCapacityTermsBatch,
|
|
918
|
+
listComputeContractDelayPenalties,
|
|
919
|
+
listComputeContractDocuments,
|
|
817
920
|
listComputeContractLineCapacity,
|
|
818
921
|
listComputeContractLineMatches,
|
|
922
|
+
listComputeContractLines,
|
|
923
|
+
listComputeContracts,
|
|
819
924
|
listComputeDealAddOns,
|
|
820
925
|
listComputeDeals,
|
|
821
926
|
listContractExtractions,
|
|
@@ -852,6 +957,10 @@ export {
|
|
|
852
957
|
setReservationDisk,
|
|
853
958
|
stopReservation,
|
|
854
959
|
transferReservation,
|
|
960
|
+
updateComputeContract,
|
|
961
|
+
updateComputeContractDelayPenalty,
|
|
962
|
+
updateComputeContractDocument,
|
|
963
|
+
updateComputeContractLine,
|
|
855
964
|
updateComputeDeal,
|
|
856
965
|
updateComputeDealAddOn,
|
|
857
966
|
updateContractExtractionField,
|
|
@@ -150,35 +150,241 @@ function closeShellSession(fetcher, id) {
|
|
|
150
150
|
function shellSessionAttachPath(id) {
|
|
151
151
|
return `${sessionsPath}/${encodeURIComponent(id)}/attach`;
|
|
152
152
|
}
|
|
153
|
+
|
|
154
|
+
// ../../packages/api-client/dist/orchestrator/drives.js
|
|
155
|
+
function queryPath(path, query) {
|
|
156
|
+
const params = new URLSearchParams();
|
|
157
|
+
for (const [key, value] of Object.entries(query)) {
|
|
158
|
+
if (value !== void 0 && value !== null)
|
|
159
|
+
params.set(key, String(value));
|
|
160
|
+
}
|
|
161
|
+
return `${path}${params.size ? `?${params}` : ""}`;
|
|
162
|
+
}
|
|
163
|
+
function listDrives(request, query = {}, signal) {
|
|
164
|
+
return request(queryPath("/v1/orchestrator/drives", query), {
|
|
165
|
+
method: "GET",
|
|
166
|
+
...signal ? { signal } : {}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function getDrive(request, id, query = {}, options = {}) {
|
|
170
|
+
return request(queryPath(`/v1/orchestrator/drives/${encodeURIComponent(id)}`, query), {
|
|
171
|
+
method: "GET",
|
|
172
|
+
...options
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function createDrive(request, body, options = {}) {
|
|
176
|
+
return request("/v1/orchestrator/drives", {
|
|
177
|
+
method: "POST",
|
|
178
|
+
body,
|
|
179
|
+
...options
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function updateDrive(request, id, body, options = {}) {
|
|
183
|
+
return request(`/v1/orchestrator/drives/${encodeURIComponent(id)}`, {
|
|
184
|
+
method: "PATCH",
|
|
185
|
+
body,
|
|
186
|
+
...options
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function deleteDrive(request, id, query = {}, options = {}) {
|
|
190
|
+
return request(queryPath(`/v1/orchestrator/drives/${encodeURIComponent(id)}`, query), {
|
|
191
|
+
method: "DELETE",
|
|
192
|
+
...options
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function listStorageTargets(request, signal) {
|
|
196
|
+
return request("/v1/orchestrator/storage-targets", {
|
|
197
|
+
method: "GET",
|
|
198
|
+
...signal ? { signal } : {}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// ../../packages/api-client/dist/orchestrator/drive-files.js
|
|
203
|
+
function drivePath(id) {
|
|
204
|
+
return `/v1/orchestrator/drives/${encodeURIComponent(id)}`;
|
|
205
|
+
}
|
|
206
|
+
function filePath(path) {
|
|
207
|
+
return path.replace(/\\/g, "/").split("/").filter(Boolean).map(encodeURIComponent).join("/");
|
|
208
|
+
}
|
|
209
|
+
function driveFilePath(id, path) {
|
|
210
|
+
return `${drivePath(id)}/files/${filePath(path)}`;
|
|
211
|
+
}
|
|
212
|
+
function driveArchivePath(id) {
|
|
213
|
+
return `${drivePath(id)}/archive`;
|
|
214
|
+
}
|
|
215
|
+
function driveFolderArchivePath(id, path) {
|
|
216
|
+
return `${drivePath(id)}/folders/${filePath(path)}/archive`;
|
|
217
|
+
}
|
|
218
|
+
function downloadDriveFile(fetch, id, path, signal) {
|
|
219
|
+
return fetch(driveFilePath(id, path), { method: "GET", ...signal ? { signal } : {} });
|
|
220
|
+
}
|
|
221
|
+
function listDriveContents(request, id, query = {}, signal) {
|
|
222
|
+
const params = new URLSearchParams();
|
|
223
|
+
for (const [key, value] of Object.entries(query)) {
|
|
224
|
+
if (value !== void 0)
|
|
225
|
+
params.set(key, String(value));
|
|
226
|
+
}
|
|
227
|
+
return request(`${drivePath(id)}/contents${params.size ? `?${params}` : ""}`, {
|
|
228
|
+
method: "GET",
|
|
229
|
+
...signal ? { signal } : {}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function deleteDriveFile(request, id, path) {
|
|
233
|
+
return request(driveFilePath(id, path), { method: "DELETE" });
|
|
234
|
+
}
|
|
235
|
+
function deleteDriveFolder(request, id, path) {
|
|
236
|
+
return request(`${drivePath(id)}/folders/${filePath(path)}`, { method: "DELETE" });
|
|
237
|
+
}
|
|
238
|
+
function clearDriveContents(request, id) {
|
|
239
|
+
return request(`${drivePath(id)}/contents`, { method: "DELETE" });
|
|
240
|
+
}
|
|
241
|
+
function startDriveUpload(request, id, body, options = {}) {
|
|
242
|
+
return request(`${drivePath(id)}/uploads`, { method: "POST", body, ...options });
|
|
243
|
+
}
|
|
244
|
+
function completeDriveUpload(request, id, uploadId, body, options = {}) {
|
|
245
|
+
return request(`${drivePath(id)}/uploads/${encodeURIComponent(uploadId)}`, {
|
|
246
|
+
method: "POST",
|
|
247
|
+
body,
|
|
248
|
+
...options
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function cancelDriveUpload(request, id, uploadId, signal) {
|
|
252
|
+
return request(`${drivePath(id)}/uploads/${encodeURIComponent(uploadId)}`, {
|
|
253
|
+
method: "DELETE",
|
|
254
|
+
...signal ? { signal } : {}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function keepDriveUploadsAlive(request, id) {
|
|
258
|
+
return request(`${drivePath(id)}/uploads`, { method: "PATCH" });
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// ../../packages/api-client/dist/orchestrator/storage-types.js
|
|
262
|
+
var storageEventsPath = "/v1/orchestrator/storage/ws";
|
|
263
|
+
|
|
264
|
+
// ../../packages/api-client/dist/orchestrator/storage-usage.js
|
|
265
|
+
function queryPath2(path, query) {
|
|
266
|
+
const params = new URLSearchParams();
|
|
267
|
+
for (const [key, value] of Object.entries(query)) {
|
|
268
|
+
if (value !== void 0)
|
|
269
|
+
params.set(key, String(value));
|
|
270
|
+
}
|
|
271
|
+
return `${path}${params.size ? `?${params}` : ""}`;
|
|
272
|
+
}
|
|
273
|
+
function listStorageInventory(request, query = {}, signal) {
|
|
274
|
+
return request(queryPath2("/v1/staff/storage/volumes", query), {
|
|
275
|
+
method: "GET",
|
|
276
|
+
...signal ? { signal } : {}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
function getStorageUsage(request, driveId, query, signal) {
|
|
280
|
+
return request(queryPath2(`/v1/staff/storage/volumes/${encodeURIComponent(driveId)}/usage`, query), {
|
|
281
|
+
method: "GET",
|
|
282
|
+
...signal ? { signal } : {}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function getOrganizationStorageUsage(request, organizationId, query, signal) {
|
|
286
|
+
return request(queryPath2(`/v1/staff/storage/organizations/${encodeURIComponent(organizationId)}/usage`, query), {
|
|
287
|
+
method: "GET",
|
|
288
|
+
...signal ? { signal } : {}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// ../../packages/api-client/dist/orchestrator/github.js
|
|
293
|
+
var connections = "/v1/orchestrator/github/connections";
|
|
294
|
+
function listGitHubConnections(request) {
|
|
295
|
+
return request(connections, { method: "GET" });
|
|
296
|
+
}
|
|
297
|
+
function startGitHubConnection(request, query = {}) {
|
|
298
|
+
const params = new URLSearchParams();
|
|
299
|
+
if (query.page !== void 0)
|
|
300
|
+
params.set("page", query.page);
|
|
301
|
+
return request(`${connections}${params.size ? `?${params}` : ""}`, {
|
|
302
|
+
method: "POST"
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function completeGitHubConnection(request, body) {
|
|
306
|
+
return request(`${connections}/complete`, { method: "POST", body });
|
|
307
|
+
}
|
|
308
|
+
function deleteGitHubConnection(request, id) {
|
|
309
|
+
return request(`${connections}/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
310
|
+
}
|
|
311
|
+
function listGitHubRepositories(request, connectionId) {
|
|
312
|
+
return request(`${connections}/${encodeURIComponent(connectionId)}/repositories`, {
|
|
313
|
+
method: "GET"
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function listGitHubBranches(request, connectionId, repositoryId, query) {
|
|
317
|
+
const params = new URLSearchParams({ full_name: query.full_name, page: String(query.page) });
|
|
318
|
+
return request(`${connections}/${encodeURIComponent(connectionId)}/repositories/${repositoryId}/branches?${params}`, { method: "GET" });
|
|
319
|
+
}
|
|
320
|
+
function pullGitHubRepository(request, driveId, body) {
|
|
321
|
+
return request(`/v1/orchestrator/drives/${encodeURIComponent(driveId)}/github`, {
|
|
322
|
+
method: "POST",
|
|
323
|
+
body
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
function syncGitHubRepository(request, driveId, folder) {
|
|
327
|
+
return request(`/v1/orchestrator/drives/${encodeURIComponent(driveId)}/github/${encodeURIComponent(folder)}/sync`, { method: "POST" });
|
|
328
|
+
}
|
|
153
329
|
export {
|
|
330
|
+
cancelDriveUpload,
|
|
331
|
+
clearDriveContents,
|
|
154
332
|
closeShellSession,
|
|
155
333
|
completeDiskUpload,
|
|
334
|
+
completeDriveUpload,
|
|
335
|
+
completeGitHubConnection,
|
|
156
336
|
completeImageUpload,
|
|
157
337
|
createDisk,
|
|
338
|
+
createDrive,
|
|
158
339
|
createShellSession,
|
|
159
340
|
deleteDisk,
|
|
341
|
+
deleteDrive,
|
|
342
|
+
deleteDriveFile,
|
|
343
|
+
deleteDriveFolder,
|
|
344
|
+
deleteGitHubConnection,
|
|
160
345
|
deleteImage,
|
|
161
346
|
deleteRegistryTag,
|
|
162
347
|
disksSocketPath,
|
|
348
|
+
downloadDriveFile,
|
|
349
|
+
driveArchivePath,
|
|
350
|
+
driveFilePath,
|
|
351
|
+
driveFolderArchivePath,
|
|
163
352
|
geolocate,
|
|
164
353
|
getContainerRegistry,
|
|
165
354
|
getCurrentShellSession,
|
|
355
|
+
getDrive,
|
|
166
356
|
getHardwareCatalog,
|
|
357
|
+
getOrganizationStorageUsage,
|
|
167
358
|
getRegistryUsage,
|
|
168
359
|
getSoftwareCatalog,
|
|
360
|
+
getStorageUsage,
|
|
169
361
|
hardwareCatalogPath,
|
|
170
362
|
importDisk,
|
|
363
|
+
keepDriveUploadsAlive,
|
|
171
364
|
listCatalogImages,
|
|
172
365
|
listDisks,
|
|
366
|
+
listDriveContents,
|
|
367
|
+
listDrives,
|
|
368
|
+
listGitHubBranches,
|
|
369
|
+
listGitHubConnections,
|
|
370
|
+
listGitHubRepositories,
|
|
173
371
|
listLocalityRegions,
|
|
174
372
|
listRegistryCaches,
|
|
175
373
|
listRegistryRepositories,
|
|
176
374
|
listRegistryTags,
|
|
375
|
+
listStorageInventory,
|
|
376
|
+
listStorageTargets,
|
|
177
377
|
localityGeolocatePath,
|
|
178
378
|
postDiskObject,
|
|
179
379
|
postImageObject,
|
|
380
|
+
pullGitHubRepository,
|
|
180
381
|
shellSessionAttachPath,
|
|
181
382
|
startDiskUpload,
|
|
383
|
+
startDriveUpload,
|
|
384
|
+
startGitHubConnection,
|
|
182
385
|
startImageUpload,
|
|
183
|
-
|
|
386
|
+
storageEventsPath,
|
|
387
|
+
syncGitHubRepository,
|
|
388
|
+
updateDisk,
|
|
389
|
+
updateDrive
|
|
184
390
|
};
|
|
@@ -1368,6 +1368,73 @@ function deleteRegistryTag(request, repository, tag) {
|
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
|
+
// ../../packages/api-client/dist/orchestrator/drives.js
|
|
1372
|
+
function queryPath3(path, query3) {
|
|
1373
|
+
const params = new URLSearchParams();
|
|
1374
|
+
for (const [key, value] of Object.entries(query3)) {
|
|
1375
|
+
if (value !== void 0 && value !== null)
|
|
1376
|
+
params.set(key, String(value));
|
|
1377
|
+
}
|
|
1378
|
+
return `${path}${params.size ? `?${params}` : ""}`;
|
|
1379
|
+
}
|
|
1380
|
+
function listDrives(request, query3 = {}, signal) {
|
|
1381
|
+
return request(queryPath3("/v1/orchestrator/drives", query3), {
|
|
1382
|
+
method: "GET",
|
|
1383
|
+
...signal ? { signal } : {}
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
function getDrive(request, id, query3 = {}, options = {}) {
|
|
1387
|
+
return request(queryPath3(`/v1/orchestrator/drives/${encodeURIComponent(id)}`, query3), {
|
|
1388
|
+
method: "GET",
|
|
1389
|
+
...options
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
function createDrive(request, body2, options = {}) {
|
|
1393
|
+
return request("/v1/orchestrator/drives", {
|
|
1394
|
+
method: "POST",
|
|
1395
|
+
body: body2,
|
|
1396
|
+
...options
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
function updateDrive(request, id, body2, options = {}) {
|
|
1400
|
+
return request(`/v1/orchestrator/drives/${encodeURIComponent(id)}`, {
|
|
1401
|
+
method: "PATCH",
|
|
1402
|
+
body: body2,
|
|
1403
|
+
...options
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
function deleteDrive(request, id, query3 = {}, options = {}) {
|
|
1407
|
+
return request(queryPath3(`/v1/orchestrator/drives/${encodeURIComponent(id)}`, query3), {
|
|
1408
|
+
method: "DELETE",
|
|
1409
|
+
...options
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
function listStorageTargets(request, signal) {
|
|
1413
|
+
return request("/v1/orchestrator/storage-targets", {
|
|
1414
|
+
method: "GET",
|
|
1415
|
+
...signal ? { signal } : {}
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
// ../../packages/api-client/dist/orchestrator/drive-files.js
|
|
1420
|
+
function drivePath(id) {
|
|
1421
|
+
return `/v1/orchestrator/drives/${encodeURIComponent(id)}`;
|
|
1422
|
+
}
|
|
1423
|
+
function listDriveContents(request, id, query3 = {}, signal) {
|
|
1424
|
+
const params = new URLSearchParams();
|
|
1425
|
+
for (const [key, value] of Object.entries(query3)) {
|
|
1426
|
+
if (value !== void 0)
|
|
1427
|
+
params.set(key, String(value));
|
|
1428
|
+
}
|
|
1429
|
+
return request(`${drivePath(id)}/contents${params.size ? `?${params}` : ""}`, {
|
|
1430
|
+
method: "GET",
|
|
1431
|
+
...signal ? { signal } : {}
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
function clearDriveContents(request, id) {
|
|
1435
|
+
return request(`${drivePath(id)}/contents`, { method: "DELETE" });
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1371
1438
|
// ../../packages/capabilities/dist/capabilities/staff-shared.js
|
|
1372
1439
|
function statusOf(error) {
|
|
1373
1440
|
if (error && typeof error === "object" && "status" in error) {
|
|
@@ -7508,13 +7575,6 @@ var volumeCapabilities = [
|
|
|
7508
7575
|
})
|
|
7509
7576
|
];
|
|
7510
7577
|
var DRIVES_ROUTE = "/v1/orchestrator/drives";
|
|
7511
|
-
function drivePath(driveId) {
|
|
7512
|
-
return `${DRIVES_ROUTE}/${encodeURIComponent(driveId)}`;
|
|
7513
|
-
}
|
|
7514
|
-
var STORAGE_DRIVES_ROUTE = "/v1/workflows/compute/nodes/storage-drives";
|
|
7515
|
-
function storageDrivePath(driveId, action) {
|
|
7516
|
-
return `${STORAGE_DRIVES_ROUTE}/${encodeURIComponent(driveId)}/${action}`;
|
|
7517
|
-
}
|
|
7518
7578
|
var reservationInput = z30.object({ reservationId: z30.string() });
|
|
7519
7579
|
var reservationWrite = reservationInput.extend({ confirm: z30.boolean().optional() });
|
|
7520
7580
|
var driveInput = z30.object({ driveId: z30.string() });
|
|
@@ -7593,7 +7653,7 @@ var storageVerbCapabilities = [
|
|
|
7593
7653
|
http: { method: "GET", path: "/v1/orchestrator/storage-targets" },
|
|
7594
7654
|
input: z30.object({}),
|
|
7595
7655
|
slack: false,
|
|
7596
|
-
execute: (ctx) => ctx.fetch
|
|
7656
|
+
execute: (ctx) => listStorageTargets(ctx.fetch)
|
|
7597
7657
|
}),
|
|
7598
7658
|
defineCapability({
|
|
7599
7659
|
id: "volume.list",
|
|
@@ -7608,12 +7668,10 @@ var storageVerbCapabilities = [
|
|
|
7608
7668
|
}),
|
|
7609
7669
|
mcp: { name: "storage_volumes_list" },
|
|
7610
7670
|
slack: false,
|
|
7611
|
-
execute: (ctx, input) => {
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
return ctx.fetch(`${DRIVES_ROUTE}?${query3}`, { method: "GET" });
|
|
7616
|
-
}
|
|
7671
|
+
execute: (ctx, input) => listDrives(ctx.fetch, {
|
|
7672
|
+
limit: input.limit ?? 25,
|
|
7673
|
+
...input.cursor ? { cursor: input.cursor } : {}
|
|
7674
|
+
})
|
|
7617
7675
|
}),
|
|
7618
7676
|
defineCapability({
|
|
7619
7677
|
id: "volume.show",
|
|
@@ -7625,7 +7683,7 @@ var storageVerbCapabilities = [
|
|
|
7625
7683
|
input: driveInput,
|
|
7626
7684
|
mcp: { name: "storage_volumes_show" },
|
|
7627
7685
|
slack: false,
|
|
7628
|
-
execute: (ctx, input) => ctx.fetch
|
|
7686
|
+
execute: (ctx, input) => getDrive(ctx.fetch, input.driveId)
|
|
7629
7687
|
}),
|
|
7630
7688
|
defineCapability({
|
|
7631
7689
|
id: "volume.create",
|
|
@@ -7641,9 +7699,9 @@ var storageVerbCapabilities = [
|
|
|
7641
7699
|
}),
|
|
7642
7700
|
mcp: { name: "storage_volumes_create" },
|
|
7643
7701
|
slack: false,
|
|
7644
|
-
execute: (ctx, input) => ctx.fetch
|
|
7645
|
-
|
|
7646
|
-
|
|
7702
|
+
execute: (ctx, input) => createDrive(ctx.fetch, {
|
|
7703
|
+
name: input.name,
|
|
7704
|
+
source_drive_id: input.sourceDriveId ?? null
|
|
7647
7705
|
})
|
|
7648
7706
|
}),
|
|
7649
7707
|
defineCapability({
|
|
@@ -7652,11 +7710,11 @@ var storageVerbCapabilities = [
|
|
|
7652
7710
|
roles: ["user"],
|
|
7653
7711
|
description: "Refresh a storage volume's (drive's) reported usage/state.",
|
|
7654
7712
|
mutation: "preview-confirm",
|
|
7655
|
-
http: { method: "
|
|
7713
|
+
http: { method: "GET", path: `${DRIVES_ROUTE}/{driveId}` },
|
|
7656
7714
|
input: driveWrite,
|
|
7657
7715
|
mcp: { name: "storage_volumes_refresh" },
|
|
7658
7716
|
slack: false,
|
|
7659
|
-
execute: (ctx, input) => ctx.fetch
|
|
7717
|
+
execute: (ctx, input) => getDrive(ctx.fetch, input.driveId, { refresh: true })
|
|
7660
7718
|
}),
|
|
7661
7719
|
defineCapability({
|
|
7662
7720
|
id: "volume.clear",
|
|
@@ -7670,7 +7728,7 @@ var storageVerbCapabilities = [
|
|
|
7670
7728
|
slack: false,
|
|
7671
7729
|
// The route answers 204, so report which volume was cleared.
|
|
7672
7730
|
execute: async (ctx, input) => {
|
|
7673
|
-
await ctx.fetch
|
|
7731
|
+
await clearDriveContents(ctx.fetch, input.driveId);
|
|
7674
7732
|
return { cleared: true, drive_id: input.driveId };
|
|
7675
7733
|
}
|
|
7676
7734
|
}),
|
|
@@ -7685,7 +7743,7 @@ var storageVerbCapabilities = [
|
|
|
7685
7743
|
mcp: { name: "storage_volumes_delete" },
|
|
7686
7744
|
slack: false,
|
|
7687
7745
|
execute: async (ctx, input) => {
|
|
7688
|
-
await ctx.fetch
|
|
7746
|
+
await deleteDrive(ctx.fetch, input.driveId);
|
|
7689
7747
|
return { deleted: true, drive_id: input.driveId };
|
|
7690
7748
|
}
|
|
7691
7749
|
}),
|
|
@@ -7701,22 +7759,19 @@ var storageVerbCapabilities = [
|
|
|
7701
7759
|
slack: false,
|
|
7702
7760
|
execute: (ctx, input) => {
|
|
7703
7761
|
const endpoint = input.endpointUrl ?? (input.provider === "r2" && input.accountId ? `https://${input.accountId}.r2.cloudflarestorage.com` : void 0);
|
|
7704
|
-
return ctx.fetch
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
...input.accessKeyId ? { external_access_key_id: input.accessKeyId } : {},
|
|
7718
|
-
...input.secretAccessKey ? { external_secret_access_key: input.secretAccessKey } : {}
|
|
7719
|
-
}
|
|
7762
|
+
return createDrive(ctx.fetch, {
|
|
7763
|
+
name: input.name ?? input.bucket,
|
|
7764
|
+
provider: "ornn_volume",
|
|
7765
|
+
source_provider: input.provider === "gcs" ? "external_gcs" : "s3",
|
|
7766
|
+
external_bucket: input.bucket,
|
|
7767
|
+
external_prefix: input.prefix ?? null,
|
|
7768
|
+
external_region: input.region ?? (input.provider === "r2" ? "auto" : null),
|
|
7769
|
+
external_read_only: input.readOnly !== false,
|
|
7770
|
+
...input.provider === "r2" ? { external_s3_provider: "cloudflare_r2" } : {},
|
|
7771
|
+
...input.provider === "s3" ? { external_s3_provider: "aws_s3" } : {},
|
|
7772
|
+
...endpoint ? { external_endpoint_url: endpoint } : {},
|
|
7773
|
+
...input.accessKeyId ? { external_access_key_id: input.accessKeyId } : {},
|
|
7774
|
+
...input.secretAccessKey ? { external_secret_access_key: input.secretAccessKey } : {}
|
|
7720
7775
|
});
|
|
7721
7776
|
}
|
|
7722
7777
|
}),
|
|
@@ -7726,11 +7781,11 @@ var storageVerbCapabilities = [
|
|
|
7726
7781
|
roles: ["user"],
|
|
7727
7782
|
description: "Verify a connected S3-compatible bucket's source credentials/connectivity.",
|
|
7728
7783
|
mutation: "preview-confirm",
|
|
7729
|
-
http: { method: "
|
|
7784
|
+
http: { method: "PATCH", path: `${DRIVES_ROUTE}/{driveId}` },
|
|
7730
7785
|
input: driveWrite,
|
|
7731
7786
|
mcp: { name: "storage_buckets_verify" },
|
|
7732
7787
|
slack: false,
|
|
7733
|
-
execute: (ctx, input) => ctx.fetch
|
|
7788
|
+
execute: (ctx, input) => updateDrive(ctx.fetch, input.driveId, { verify_source: true })
|
|
7734
7789
|
}),
|
|
7735
7790
|
defineCapability({
|
|
7736
7791
|
id: "bucket.update_credentials",
|
|
@@ -7738,13 +7793,12 @@ var storageVerbCapabilities = [
|
|
|
7738
7793
|
roles: ["user"],
|
|
7739
7794
|
description: "Update a connected S3-compatible bucket's access key credentials.",
|
|
7740
7795
|
mutation: "preview-confirm",
|
|
7741
|
-
http: { method: "PATCH", path: `${
|
|
7796
|
+
http: { method: "PATCH", path: `${DRIVES_ROUTE}/{driveId}` },
|
|
7742
7797
|
input: driveWrite.extend({ accessKeyId: z30.string(), secretAccessKey: z30.string() }),
|
|
7743
7798
|
mcp: { name: "storage_buckets_update_credentials" },
|
|
7744
7799
|
slack: false,
|
|
7745
|
-
execute: (ctx, input) => ctx.fetch
|
|
7746
|
-
|
|
7747
|
-
body: {
|
|
7800
|
+
execute: (ctx, input) => updateDrive(ctx.fetch, input.driveId, {
|
|
7801
|
+
source_credentials: {
|
|
7748
7802
|
external_access_key_id: input.accessKeyId,
|
|
7749
7803
|
external_secret_access_key: input.secretAccessKey
|
|
7750
7804
|
}
|
|
@@ -7765,12 +7819,11 @@ var storageCompositionCapabilities = [
|
|
|
7765
7819
|
}),
|
|
7766
7820
|
mcp: false,
|
|
7767
7821
|
slack: false,
|
|
7768
|
-
execute: (ctx, input) => {
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
}
|
|
7822
|
+
execute: (ctx, input) => listDrives(ctx.fetch, {
|
|
7823
|
+
limit: input.limit ?? 25,
|
|
7824
|
+
scope: "external",
|
|
7825
|
+
...input.cursor ? { cursor: input.cursor } : {}
|
|
7826
|
+
})
|
|
7774
7827
|
}),
|
|
7775
7828
|
defineCapability({
|
|
7776
7829
|
id: "volume.contents",
|
|
@@ -7786,14 +7839,11 @@ var storageCompositionCapabilities = [
|
|
|
7786
7839
|
}),
|
|
7787
7840
|
mcp: false,
|
|
7788
7841
|
slack: false,
|
|
7789
|
-
execute: (ctx, input) => {
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
query3.set("cursor", String(input.cursor));
|
|
7795
|
-
return ctx.fetch(`${drivePath(input.driveId)}/contents?${query3}`, { method: "GET" });
|
|
7796
|
-
}
|
|
7842
|
+
execute: (ctx, input) => listDriveContents(ctx.fetch, input.driveId, {
|
|
7843
|
+
recursive: true,
|
|
7844
|
+
...input.path ? { path: input.path } : {},
|
|
7845
|
+
...input.cursor ? { cursor: input.cursor } : {}
|
|
7846
|
+
})
|
|
7797
7847
|
})
|
|
7798
7848
|
];
|
|
7799
7849
|
|