@ornncompute/cli 1.0.242 → 1.0.244

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 CHANGED
@@ -55,6 +55,16 @@ use `api-keys/<sha256-of-key>.json` under the config directory, isolated from
55
55
  `auth.json` and other keys. Key management (including `ornn registry login`)
56
56
  still requires a user session. See the [customer guide](../../docs-site/api-keys.mdx).
57
57
 
58
+ ## Inference
59
+
60
+ `ornn inference` covers models, completions, request history/usage, recorded
61
+ charges, and provider model management through the shared capability catalog.
62
+ `ornn admin inference` exposes staff model, request, and charge operations after
63
+ the standard staff preflight. Both use native gateway routes and existing auth.
64
+
65
+ See the [Inference guide](https://docs.ornn.com/inference#cli-and-mcp) for customer
66
+ examples and [staff reference](../../docs/cli.md#inference) for administration.
67
+
58
68
  ## Command map
59
69
 
60
70
  The three primary customer journeys are:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornncompute/cli",
3
- "version": "1.0.242",
3
+ "version": "1.0.244",
4
4
  "description": "Command-line interface for Ornn compute access workflows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,3 +1,4 @@
1
+ import { parseSemanticArguments } from "./interaction-runtime.mjs";
1
2
  import { adminCommandHandler } from "./admin-command-handlers.mjs";
2
3
  import { shellSingleQuote } from "./identity-file.mjs";
3
4
 
@@ -175,6 +176,9 @@ function booleanOption(value, name) {
175
176
  }
176
177
 
177
178
  function parseAdminInput(capability, argv) {
179
+ if (capability.cli.vnext.arguments === "semantic") {
180
+ return { input: parseSemanticArguments(argv) };
181
+ }
178
182
  const command = vnextCommand(capability).join(" ");
179
183
  const help = capability.cli.vnext;
180
184
  const usage = `Usage: ${help.human}`;
@@ -345,6 +349,7 @@ function collectionKey(capability) {
345
349
 
346
350
  function isSensitiveAdminField(key) {
347
351
  const normalized = key.replaceAll(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
352
+ if (normalized === "api_key_id" || normalized === "credential_configured") return false;
348
353
  return (
349
354
  normalized === "authorization" ||
350
355
  normalized === "session" ||
@@ -97,6 +97,7 @@ export async function cliRequest({
97
97
  fetchImpl = fetch,
98
98
  method = "GET",
99
99
  raw = false,
100
+ returnResponse = false,
100
101
  session,
101
102
  signal,
102
103
  timeoutMs,
@@ -160,6 +161,8 @@ export async function cliRequest({
160
161
  );
161
162
  }
162
163
 
164
+ if (returnResponse && response.ok) return response;
165
+
163
166
  if (raw) {
164
167
  const text = await response.text();
165
168
  if (!response.ok) {
@@ -1,6 +1,7 @@
1
1
  import { getCliSession } from "../vendor/api-client/authorization.js";
2
2
  import { isCustomerSensitiveField } from "../vendor/capabilities/cli.js";
3
3
  import { readFileSync } from "node:fs";
4
+ import { once } from "node:events";
4
5
 
5
6
  import {
6
7
  CliApiError,
@@ -769,6 +770,8 @@ const DIRECT_GATEWAY_PREFIXES = [
769
770
  "/gifts",
770
771
  "/internal/v1",
771
772
  "/v1/markets",
773
+ "/v1/staff/inference",
774
+ "/v1/ledger/inference-charges",
772
775
  "/v1/orchestrator/supplier-connection-configs",
773
776
  "/v1/orchestrator/supplier-gateways",
774
777
  ];
@@ -799,7 +802,13 @@ function adminFetch(io, path, init = {}) {
799
802
  : operatorRequest(request);
800
803
  }
801
804
 
802
- async function customerCapabilityFetch(io, path, init = {}, sessionSnapshot) {
805
+ async function customerCapabilityFetch(
806
+ io,
807
+ path,
808
+ init = {},
809
+ sessionSnapshot,
810
+ returnResponse = false
811
+ ) {
803
812
  const authRequired = path !== "/v1/cli/status";
804
813
  const session = sessionSnapshot?.current;
805
814
  const method = init.method ?? "GET";
@@ -820,6 +829,7 @@ async function customerCapabilityFetch(io, path, init = {}, sessionSnapshot) {
820
829
  }
821
830
  return cliRequest({
822
831
  authRequired,
832
+ returnResponse,
823
833
  endpoint: path,
824
834
  env: io.env,
825
835
  fetchImpl: io.fetchImpl,
@@ -827,7 +837,7 @@ async function customerCapabilityFetch(io, path, init = {}, sessionSnapshot) {
827
837
  method,
828
838
  ...(authRequired && session ? { session } : {}),
829
839
  ...(init.body !== undefined ? { body: init.body } : {}),
830
- ...(init.signal !== undefined ? { signal: init.signal } : {}),
840
+ signal: init.signal ?? io.signal,
831
841
  });
832
842
  }
833
843
 
@@ -943,6 +953,8 @@ async function executeCapability(
943
953
  installerBaseUrl,
944
954
  webBaseUrl: resolveAuthBaseUrl({ env: io.env }),
945
955
  role,
956
+ fetchResponse: (path, init = {}) =>
957
+ customerCapabilityFetch(io, path, init, authSnapshot, true),
946
958
  fetch: async (path, init = {}) => {
947
959
  if (executionRuntime?.transport) return executionRuntime.transport(path, init);
948
960
  if (audience === "admin") {
@@ -981,7 +993,8 @@ async function executeCapability(
981
993
  } finally {
982
994
  interaction?.close();
983
995
  }
984
- if (audience === "customer") {
996
+ if (data instanceof Response) return data;
997
+ if (audience === "customer" && capability.domain !== "inference") {
985
998
  assertCustomerResultSafe(data, listingSession);
986
999
  }
987
1000
  if (audience === "admin" || sessionCommand || isInteractionExecution(data)) return data;
@@ -1288,6 +1301,15 @@ export async function runCatalogCli(argv, io, { version }) {
1288
1301
  stdout,
1289
1302
  },
1290
1303
  });
1304
+ if (execution instanceof Response) {
1305
+ const output = io.rawStdout ?? stdout;
1306
+ if (execution.body) {
1307
+ for await (const chunk of execution.body) {
1308
+ if (output.write(Buffer.from(chunk)) === false) await once(output, "drain");
1309
+ }
1310
+ }
1311
+ return { exitCode: CLI_EXIT_STATUS.success, suppressUpdateNotification: true };
1312
+ }
1291
1313
  if (customerRawPrint) {
1292
1314
  return {
1293
1315
  exitCode: execution.exitCode ?? CLI_EXIT_STATUS.success,
package/src/cli.mjs CHANGED
@@ -138,6 +138,7 @@ export async function run(argv = [], io = {}) {
138
138
  io.openBrowser ?? ((url) => openBrowser(url, { spawnImpl: io.spawnProcess ?? spawn })),
139
139
  stderr,
140
140
  stdout,
141
+ rawStdout,
141
142
  };
142
143
  const result = await runCatalogCli(global.argv, runtimeIo, { version: VERSION });
143
144
  if (global.argv[0] !== "update" && !result.suppressUpdateNotification) {