@ornncompute/cli 1.0.432 → 1.0.434
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/README.md +6 -2
- package/package.json +1 -1
- package/src/catalog-shell.mjs +27 -1
- package/vendor/capabilities/cli.js +51 -21
package/README.md
CHANGED
|
@@ -160,8 +160,12 @@ relisted (secondary) listing term with Markets `POST /v1/markets/bookings`
|
|
|
160
160
|
(`{legs: [...]}`), at the term price `terms` shows; the window is at least an
|
|
161
161
|
hour and ends no later than the listing, and it becomes a reservation when the
|
|
162
162
|
window starts. `market` and `offers` call Markets (`/v1/markets`):
|
|
163
|
-
buy `--nodes` at market
|
|
164
|
-
|
|
163
|
+
buy `--nodes` at market by default, or add
|
|
164
|
+
`--price-per-gpu-hour-micro-usd <micro-USD>` to place a limit bid that fills at
|
|
165
|
+
or below that maximum, including fees. `--fill-behavior partial|all` applies
|
|
166
|
+
only to limit bids; `partial` (the default) fills as available and rests the
|
|
167
|
+
remainder, while `all` waits for the full node count. Omit the price cap to
|
|
168
|
+
keep the existing market behavior. End a fill with
|
|
165
169
|
`market end` (Commerce `DELETE /commerce/reservations/{id}`), post an offer
|
|
166
170
|
on a whole primary listing for one of its terms (`--listing-term-id`, optional
|
|
167
171
|
`--duration-seconds` of at least an hour that ends no later than the listing;
|
package/package.json
CHANGED
package/src/catalog-shell.mjs
CHANGED
|
@@ -747,8 +747,34 @@ function assertCustomerResultSafe(value, listingSession) {
|
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
+
const GLOBAL_INTERACTION_OPTION_KEYS = new Set([
|
|
751
|
+
"guided",
|
|
752
|
+
"wait",
|
|
753
|
+
"noWait",
|
|
754
|
+
"timeout",
|
|
755
|
+
"noBrowser",
|
|
756
|
+
"overwrite",
|
|
757
|
+
]);
|
|
758
|
+
|
|
750
759
|
function parseCapabilityInput(capability, rawInput) {
|
|
751
|
-
const
|
|
760
|
+
const schema = capability.cli?.input ?? capability.input;
|
|
761
|
+
let parsed = schema.safeParse(rawInput);
|
|
762
|
+
if (!parsed.success) {
|
|
763
|
+
const unrecognized = parsed.error.issues.filter((issue) => issue.code === "unrecognized_keys");
|
|
764
|
+
if (
|
|
765
|
+
unrecognized.length > 0 &&
|
|
766
|
+
unrecognized.every(
|
|
767
|
+
(issue) =>
|
|
768
|
+
issue.path.length === 0 &&
|
|
769
|
+
issue.keys.every((key) => GLOBAL_INTERACTION_OPTION_KEYS.has(key))
|
|
770
|
+
)
|
|
771
|
+
) {
|
|
772
|
+
const globalKeys = new Set(unrecognized.flatMap((issue) => issue.keys));
|
|
773
|
+
parsed = schema.safeParse(
|
|
774
|
+
Object.fromEntries(Object.entries(rawInput).filter(([key]) => !globalKeys.has(key)))
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
752
778
|
if (parsed.success) return parsed.data;
|
|
753
779
|
const issue = parsed.error.issues[0];
|
|
754
780
|
if (issue?.path?.[0] === "$positionals") {
|
|
@@ -3486,6 +3486,53 @@ var marketBidInput = z13.object({
|
|
|
3486
3486
|
idempotencyKey: z13.string().min(1).max(200).optional(),
|
|
3487
3487
|
confirm: z13.boolean().optional()
|
|
3488
3488
|
});
|
|
3489
|
+
var limitPriceMicroUsd = z13.preprocess((value) => typeof value === "boolean" || typeof value === "string" && !/^[0-9]+$/.test(value) ? Number.NaN : value, microUsd).refine(Number.isSafeInteger, "The maximum price must be a safe integer.");
|
|
3490
|
+
var marketBidCliInput = marketBidInput.extend({
|
|
3491
|
+
pricePerGpuHourMicroUsd: limitPriceMicroUsd.optional().describe("Maximum micro-USD per GPU-hour, or per vCPU-hour on the cpu book (1000000 is $1.00)."),
|
|
3492
|
+
fillBehavior: z13.enum(["partial", "all"]).optional().describe("Only with a limit price; defaults to partial.")
|
|
3493
|
+
}).strict().superRefine((input, context) => {
|
|
3494
|
+
if (input.fillBehavior !== void 0 && input.pricePerGpuHourMicroUsd === void 0) {
|
|
3495
|
+
context.addIssue({
|
|
3496
|
+
code: "custom",
|
|
3497
|
+
path: ["fillBehavior"],
|
|
3498
|
+
message: "Fill behavior requires a limit price."
|
|
3499
|
+
});
|
|
3500
|
+
}
|
|
3501
|
+
});
|
|
3502
|
+
async function executeMarketBid(ctx, parsed) {
|
|
3503
|
+
const priceCap = parsed.pricePerGpuHourMicroUsd;
|
|
3504
|
+
const body2 = {
|
|
3505
|
+
gpuSlug: parsed.gpuSlug,
|
|
3506
|
+
...parsed.region ? { region: parsed.region } : {},
|
|
3507
|
+
nodes: parsed.nodes,
|
|
3508
|
+
orderType: priceCap === void 0 ? "market" : "limit",
|
|
3509
|
+
...priceCap === void 0 ? {} : { pricePerGpuHourMicroUsd: priceCap },
|
|
3510
|
+
...parsed.fillBehavior !== void 0 ? { fillBehavior: parsed.fillBehavior } : {},
|
|
3511
|
+
...parsed.diskId ? { diskId: parsed.diskId } : {}
|
|
3512
|
+
};
|
|
3513
|
+
const hardware = ctx.cli?.interaction ? await loadHardwareCatalog(ctx.fetch).catch(() => null) : null;
|
|
3514
|
+
const priceTerm = priceCap === void 0 ? { label: "Order", value: "Market: the cheapest nodes for sale now" } : {
|
|
3515
|
+
label: "Maximum price",
|
|
3516
|
+
value: `${priceCap.toLocaleString("en-US")} micro-USD per ${parsed.gpuSlug === "cpu" ? "vCPU" : "GPU"}-hour, fees included`
|
|
3517
|
+
};
|
|
3518
|
+
const fillTerms = priceCap === void 0 ? [] : [
|
|
3519
|
+
{
|
|
3520
|
+
label: "Fill behavior",
|
|
3521
|
+
value: parsed.fillBehavior === "all" ? "Wait for the full node count" : `Fill as available${parsed.fillBehavior === void 0 ? " (default)" : ""}; unmatched nodes rest at this price`
|
|
3522
|
+
}
|
|
3523
|
+
];
|
|
3524
|
+
const terms = [
|
|
3525
|
+
{ label: "Hardware", value: gpuDisplay(hardware?.terms ?? [], parsed.gpuSlug) },
|
|
3526
|
+
{ label: "Location", value: parsed.region ?? "Any location" },
|
|
3527
|
+
{ label: "Nodes", value: String(parsed.nodes) },
|
|
3528
|
+
priceTerm,
|
|
3529
|
+
...fillTerms
|
|
3530
|
+
];
|
|
3531
|
+
const gate = await consent(ctx, "market.bid", "Place bid", terms, body2);
|
|
3532
|
+
if (gate)
|
|
3533
|
+
return gate;
|
|
3534
|
+
return placeBid(ctx.fetch, body2, resolveIdempotencyKey(ctx, parsed.idempotencyKey));
|
|
3535
|
+
}
|
|
3489
3536
|
var marketBidCapability = defineCapability({
|
|
3490
3537
|
id: "market.bid",
|
|
3491
3538
|
domain: "markets",
|
|
@@ -3495,28 +3542,11 @@ var marketBidCapability = defineCapability({
|
|
|
3495
3542
|
input: marketBidInput,
|
|
3496
3543
|
cli: {
|
|
3497
3544
|
command: ["market", "bid"],
|
|
3498
|
-
|
|
3545
|
+
input: marketBidCliInput,
|
|
3546
|
+
execute: async (ctx, input) => executeMarketBid(ctx, marketBidCliInput.parse(input)),
|
|
3547
|
+
vnext: help2("Buy whole nodes at market or with a price-capped limit bid.", "ornn market bid --gpu-slug <slug> --nodes <n> [--region <slug>] [--price-per-gpu-hour-micro-usd <micro-USD>] [--fill-behavior partial|all] [--disk-id <id>]", "ornn market bid --gpu-slug nvidia_h100_sxm --nodes 2 --price-per-gpu-hour-micro-usd 2500000 --format json", ["market quote", "market orders", "market fills", "market cancel"], 35, ["catalog GPU slug"])
|
|
3499
3548
|
},
|
|
3500
|
-
execute: async (ctx, input) =>
|
|
3501
|
-
const parsed = marketBidInput.parse(input);
|
|
3502
|
-
const body2 = {
|
|
3503
|
-
gpuSlug: parsed.gpuSlug,
|
|
3504
|
-
...parsed.region ? { region: parsed.region } : {},
|
|
3505
|
-
nodes: parsed.nodes,
|
|
3506
|
-
orderType: "market",
|
|
3507
|
-
...parsed.diskId ? { diskId: parsed.diskId } : {}
|
|
3508
|
-
};
|
|
3509
|
-
const hardware = ctx.cli?.interaction ? await loadHardwareCatalog(ctx.fetch).catch(() => null) : null;
|
|
3510
|
-
const gate = await consent(ctx, "market.bid", "Place bid", [
|
|
3511
|
-
{ label: "Hardware", value: gpuDisplay(hardware?.terms ?? [], parsed.gpuSlug) },
|
|
3512
|
-
{ label: "Location", value: parsed.region ?? "Any location" },
|
|
3513
|
-
{ label: "Nodes", value: String(parsed.nodes) },
|
|
3514
|
-
{ label: "Order", value: "Market: the cheapest nodes for sale now" }
|
|
3515
|
-
], body2);
|
|
3516
|
-
if (gate)
|
|
3517
|
-
return gate;
|
|
3518
|
-
return placeBid(ctx.fetch, body2, resolveIdempotencyKey(ctx, parsed.idempotencyKey));
|
|
3519
|
-
}
|
|
3549
|
+
execute: async (ctx, input) => executeMarketBid(ctx, marketBidInput.parse(input))
|
|
3520
3550
|
});
|
|
3521
3551
|
var marketOrdersInput = z13.object({ $positionals: positionals });
|
|
3522
3552
|
var marketOrdersCapability = defineCapability({
|