@ornncompute/cli 1.0.176 → 1.0.178

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornncompute/cli",
3
- "version": "1.0.176",
3
+ "version": "1.0.178",
4
4
  "description": "Command-line interface for Ornn compute access workflows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -306,19 +306,6 @@ function setBillingPaymentMethod(request, input, idempotencyKey) {
306
306
  headers: { "Idempotency-Key": idempotencyKey }
307
307
  });
308
308
  }
309
- function getInferenceWallet(request, organizationId, signal) {
310
- return request(`/commerce/billing/inference/${encodeURIComponent(organizationId)}`, {
311
- method: "GET",
312
- signal
313
- });
314
- }
315
- function activateInferenceWallet(request, organizationId, input, idempotencyKey) {
316
- return request(`/commerce/billing/inference/${encodeURIComponent(organizationId)}/activate`, {
317
- method: "POST",
318
- body: input,
319
- headers: { "Idempotency-Key": idempotencyKey }
320
- });
321
- }
322
309
  function getStorageAgreement(request, signal) {
323
310
  return request("/commerce/billing/storage-agreements", {
324
311
  method: "GET",
@@ -1065,7 +1052,6 @@ function updateGTMDealDiligence(request, dealId, input) {
1065
1052
  });
1066
1053
  }
1067
1054
  export {
1068
- activateInferenceWallet,
1069
1055
  activateReservation,
1070
1056
  addCapacityTerms,
1071
1057
  addReservationNodes,
@@ -1144,7 +1130,6 @@ export {
1144
1130
  getGTMDealDiligence,
1145
1131
  getGTMPersonalWorkspace,
1146
1132
  getGTMTicket,
1147
- getInferenceWallet,
1148
1133
  getMarketOutlook,
1149
1134
  getReservation,
1150
1135
  getReservationHour,
@@ -3449,8 +3449,61 @@ var accessActivateCapability = defineCapability({
3449
3449
  });
3450
3450
  var accessVerbCapabilities = [accessShowCapability, accessActivateCapability];
3451
3451
 
3452
+ // ../../packages/api-client/dist/ledger/index.js
3453
+ function queryString2(input) {
3454
+ const query3 = new URLSearchParams();
3455
+ for (const [key, value] of Object.entries(input)) {
3456
+ if (value === void 0)
3457
+ continue;
3458
+ for (const item of Array.isArray(value) ? value : [value])
3459
+ query3.append(key, String(item));
3460
+ }
3461
+ return query3.size ? `?${query3}` : "";
3462
+ }
3463
+ function listAccounts(request, input = {}, signal) {
3464
+ return request(`/v1/ledger/accounts${queryString2(input)}`, {
3465
+ method: "GET",
3466
+ signal
3467
+ });
3468
+ }
3469
+
3452
3470
  // ../../packages/capabilities/dist/capabilities/credits.js
3453
3471
  import { z as z17 } from "zod";
3472
+
3473
+ // ../../packages/capabilities/dist/credit-balance.js
3474
+ function availableCreditCents(accounts, currency = "usd") {
3475
+ const sum = accounts.filter((row) => row.account.account_role === "ORNN_CREDIT" && row.account.currency === currency).reduce((total, row) => total + Number(row.balance_cents), 0);
3476
+ return Math.max(0, -sum);
3477
+ }
3478
+
3479
+ // ../../packages/capabilities/dist/capabilities/credits.js
3480
+ var creditBalanceCapability = defineCapability({
3481
+ id: "credits.balance",
3482
+ domain: "billing",
3483
+ roles: ["admin"],
3484
+ description: "Read an organization's available Ornn credits in USD cents. Resolve the exact organization with organization_list first; ask if ambiguous. Read-only, no confirmation required. This is not the grant history or card balance.",
3485
+ mutation: "read",
3486
+ mcp: false,
3487
+ slack: {
3488
+ parameters: {
3489
+ type: "object",
3490
+ properties: { organizationId: { type: "string", format: "uuid" } },
3491
+ required: ["organizationId"]
3492
+ }
3493
+ },
3494
+ input: z17.object({ organizationId: z17.uuid() }),
3495
+ execute: async (ctx, input) => {
3496
+ if (ctx.role !== "admin")
3497
+ throw new Error("Admin role required.");
3498
+ const { organizationId } = z17.object({ organizationId: z17.uuid() }).parse(input);
3499
+ const { accounts } = await listAccounts(ctx.fetch, { organization_id: organizationId });
3500
+ return {
3501
+ organizationId,
3502
+ currency: "usd",
3503
+ availableCreditCents: availableCreditCents(accounts)
3504
+ };
3505
+ }
3506
+ });
3454
3507
  var creditGrantInput = z17.object({
3455
3508
  organizationId: z17.uuid().describe("Customer organization UUID. Resolve names or emails with organization_list; ask which organization if matches are ambiguous."),
3456
3509
  adjustmentId: z17.uuid().describe("The credit-adjustment API's required grant UUID. Keep the same UUID when confirming this grant."),