@runtypelabs/cli 2.6.1 → 2.7.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/dist/index.js CHANGED
@@ -11797,6 +11797,7 @@ var require_generated_model_routing = __commonJS({
11797
11797
  "grok-vision-beta": ["xai"],
11798
11798
  "intellect-3": ["vercel"],
11799
11799
  "kat-coder-pro-v1": ["vercel"],
11800
+ "kat-coder-pro-v2": ["vercel"],
11800
11801
  "kimi-k2": ["vercel"],
11801
11802
  "kimi-k2-0905": ["vercel"],
11802
11803
  "kimi-k2-thinking": ["vercel"],
@@ -11877,6 +11878,7 @@ var require_generated_model_routing = __commonJS({
11877
11878
  "morph-v3-large": ["vercel"],
11878
11879
  "MythoMax-L2-13b": ["togetherai"],
11879
11880
  "nemotron-3-nano-30b-a3b": ["vercel"],
11881
+ "nemotron-3-super-120b-a12b": ["vercel"],
11880
11882
  "nemotron-nano-12b-v2-vl": ["vercel"],
11881
11883
  "nemotron-nano-9b-v2": ["vercel"],
11882
11884
  "NexusRaven-V2-13B": ["togetherai"],
@@ -12323,6 +12325,7 @@ var require_generated_model_routing = __commonJS({
12323
12325
  "morph-v3-large": ["vercel"],
12324
12326
  "mythomax-l2-13b": ["togetherai"],
12325
12327
  "nemotron-3-nano-30b-a3b": ["vercel"],
12328
+ "nemotron-3-super-120b-a12b": ["vercel"],
12326
12329
  "nemotron-nano-12b-v2-vl": ["vercel"],
12327
12330
  "nemotron-nano-9b": ["vercel"],
12328
12331
  "nexusraven-v2-13b": ["togetherai"],
@@ -13533,11 +13536,14 @@ var require_generated_model_routing = __commonJS({
13533
13536
  "vercel": "prime-intellect/intellect-3"
13534
13537
  },
13535
13538
  "kat-coder-pro": {
13536
- "vercel": "kwaipilot/kat-coder-pro-v1"
13539
+ "vercel": "kwaipilot/kat-coder-pro-v2"
13537
13540
  },
13538
13541
  "kat-coder-pro-v1": {
13539
13542
  "vercel": "kwaipilot/kat-coder-pro-v1"
13540
13543
  },
13544
+ "kat-coder-pro-v2": {
13545
+ "vercel": "kwaipilot/kat-coder-pro-v2"
13546
+ },
13541
13547
  "kimi-k2": {
13542
13548
  "vercel": "moonshotai/kimi-k2-thinking"
13543
13549
  },
@@ -13889,6 +13895,9 @@ var require_generated_model_routing = __commonJS({
13889
13895
  "nemotron-3-nano-30b-a3b": {
13890
13896
  "vercel": "nvidia/nemotron-3-nano-30b-a3b"
13891
13897
  },
13898
+ "nemotron-3-super-120b-a12b": {
13899
+ "vercel": "nvidia/nemotron-3-super-120b-a12b"
13900
+ },
13892
13901
  "nemotron-nano-12b-v2-vl": {
13893
13902
  "vercel": "nvidia/nemotron-nano-12b-v2-vl"
13894
13903
  },
@@ -14746,6 +14755,13 @@ var require_provider_routing = __commonJS({
14746
14755
  ],
14747
14756
  fallback: ["google"]
14748
14757
  },
14758
+ // Gemini 3.1 Flash-Lite - Vercel AI Gateway (3.1 generation fast text)
14759
+ "gemini-3-1-flash-lite": {
14760
+ providers: [
14761
+ { provider: "vercel", weight: 100 }
14762
+ ],
14763
+ fallback: []
14764
+ },
14749
14765
  // Gemini 3 Pro Image - Route through Vercel AI Gateway only
14750
14766
  // Note: No Google fallback - this image model is only available via Vercel gateway
14751
14767
  "gemini-3-pro-image": {
@@ -14754,6 +14770,13 @@ var require_provider_routing = __commonJS({
14754
14770
  ],
14755
14771
  fallback: []
14756
14772
  },
14773
+ // Gemini 3.1 Flash Image - Vercel AI Gateway only
14774
+ "gemini-3-1-flash-image": {
14775
+ providers: [
14776
+ { provider: "vercel", weight: 100 }
14777
+ ],
14778
+ fallback: []
14779
+ },
14757
14780
  // Gemini 3 Pro Preview - Deprecated March 9, 2026. Aliased to gemini-3.1-pro in router.
14758
14781
  "gemini-3-pro-preview": {
14759
14782
  providers: [
@@ -14887,7 +14910,9 @@ var require_provider_routing = __commonJS({
14887
14910
  "gemini-2.5-flash": "Gemini 2.5 Flash",
14888
14911
  "gemini-2.5-flash-image": "Gemini 2.5 Flash Image",
14889
14912
  "gemini-3-flash": "Gemini 3 Flash",
14913
+ "gemini-3-1-flash-lite": "Gemini 3.1 Flash-Lite",
14890
14914
  "gemini-3-pro-image": "Gemini 3 Pro Image",
14915
+ "gemini-3-1-flash-image": "Gemini 3.1 Flash Image",
14891
14916
  "gemini-3-pro-preview": "Gemini 3 Pro Preview",
14892
14917
  "gemini-3.1-pro": "Gemini 3.1 Pro",
14893
14918
  "grok-4": "Grok 4",
@@ -15376,8 +15401,8 @@ var require_provider_routing = __commonJS({
15376
15401
  });
15377
15402
 
15378
15403
  // src/index.ts
15379
- import { Command as Command21 } from "commander";
15380
- import chalk28 from "chalk";
15404
+ import { Command as Command22 } from "commander";
15405
+ import chalk29 from "chalk";
15381
15406
  import { config as loadEnv } from "dotenv";
15382
15407
 
15383
15408
  // src/commands/auth.ts
@@ -22262,7 +22287,7 @@ var DEFAULT_MODELS = [
22262
22287
  // Google
22263
22288
  { label: "Gemini 3.1 Pro", value: "gemini-3.1-pro", group: "Google" },
22264
22289
  { label: "Gemini 3 Pro Image", value: "gemini-3-pro-image", group: "Google" },
22265
- { label: "Gemini 3 Flash", value: "gemini-3-flash", group: "Google" },
22290
+ { label: "Gemini 3.1 Flash-Lite", value: "gemini-3-1-flash-lite", group: "Google" },
22266
22291
  { label: "Gemini 2.5 Pro", value: "gemini-2.5-pro", group: "Google" },
22267
22292
  { label: "Gemini 2.5 Flash", value: "gemini-2.5-flash", group: "Google" },
22268
22293
  { label: "Gemini 2.5 Flash Image", value: "gemini-2.5-flash-image", group: "Google" },
@@ -32833,11 +32858,254 @@ flowVersionsCommand.command("publish <flowId>").description("Publish a version")
32833
32858
  await waitUntilExit();
32834
32859
  });
32835
32860
 
32861
+ // src/commands/tail.ts
32862
+ import { Command as Command21 } from "commander";
32863
+ import chalk27 from "chalk";
32864
+ function abbreviateId(id) {
32865
+ const underscoreIdx = id.lastIndexOf("_");
32866
+ if (underscoreIdx === -1) {
32867
+ return id.length > 8 ? `${id.slice(0, 8)}...` : id;
32868
+ }
32869
+ const prefix = id.slice(0, underscoreIdx);
32870
+ const suffix = id.slice(underscoreIdx + 1);
32871
+ return `${prefix}_${suffix.slice(0, 4)}...`;
32872
+ }
32873
+ function formatTime(ts) {
32874
+ const d = new Date(ts);
32875
+ const hh = String(d.getHours()).padStart(2, "0");
32876
+ const mm = String(d.getMinutes()).padStart(2, "0");
32877
+ const ss = String(d.getSeconds()).padStart(2, "0");
32878
+ const ms = String(d.getMilliseconds()).padStart(3, "0");
32879
+ return `${hh}:${mm}:${ss}.${ms}`;
32880
+ }
32881
+ var LEVEL_COLORS = {
32882
+ debug: chalk27.gray,
32883
+ info: chalk27.blue,
32884
+ warn: chalk27.yellow,
32885
+ error: chalk27.red
32886
+ };
32887
+ function levelBadge(level, useColor) {
32888
+ const tag = level.toUpperCase().padEnd(5);
32889
+ if (!useColor) return `[${tag}]`;
32890
+ const colorFn = LEVEL_COLORS[level] || chalk27.white;
32891
+ return colorFn(`[${tag}]`);
32892
+ }
32893
+ function categoryBadge(category, useColor) {
32894
+ if (!useColor) return `[${category}]`;
32895
+ return chalk27.magenta(`[${category}]`);
32896
+ }
32897
+ function formatTailData(data) {
32898
+ return Object.entries(data).map(([k, v]) => `${k}=${typeof v === "string" ? v : JSON.stringify(v)}`).join(" ");
32899
+ }
32900
+ function formatContextIds(event, useColor) {
32901
+ const ids = [];
32902
+ if (event.executionId) ids.push(`exec=${abbreviateId(event.executionId)}`);
32903
+ if (event.flowId) ids.push(`flow=${abbreviateId(event.flowId)}`);
32904
+ if (event.agentId) ids.push(`agent=${abbreviateId(event.agentId)}`);
32905
+ if (event.surfaceId) ids.push(`surface=${abbreviateId(event.surfaceId)}`);
32906
+ if (event.requestId) ids.push(`req=${abbreviateId(event.requestId)}`);
32907
+ if (event.conversationId) ids.push(`conv=${abbreviateId(event.conversationId)}`);
32908
+ if (ids.length === 0) return "";
32909
+ const text = ids.join(" ");
32910
+ return useColor ? chalk27.gray(` ${text}`) : ` ${text}`;
32911
+ }
32912
+ function formatEvent(event, useColor) {
32913
+ const time = useColor ? chalk27.gray(formatTime(event.timestamp)) : formatTime(event.timestamp);
32914
+ const level = levelBadge(event.level, useColor);
32915
+ const cat = categoryBadge(event.category, useColor);
32916
+ const ctx = formatContextIds(event, useColor);
32917
+ const data = event.tailData && Object.keys(event.tailData).length > 0 ? useColor ? chalk27.gray(` | ${formatTailData(event.tailData)}`) : ` | ${formatTailData(event.tailData)}` : "";
32918
+ return `${time} ${level} ${cat} ${event.message}${data}${ctx}`;
32919
+ }
32920
+ async function consumeSSEStream(reader, options, signal) {
32921
+ const decoder = new TextDecoder();
32922
+ let buffer = "";
32923
+ const useColor = options.color;
32924
+ while (!signal.aborted) {
32925
+ const { done, value } = await reader.read();
32926
+ if (done) return "eof";
32927
+ buffer += decoder.decode(value, { stream: true });
32928
+ let boundary;
32929
+ while ((boundary = buffer.indexOf("\n\n")) !== -1) {
32930
+ const chunk = buffer.slice(0, boundary);
32931
+ buffer = buffer.slice(boundary + 2);
32932
+ const dataLines = [];
32933
+ for (const line of chunk.split("\n")) {
32934
+ if (line.startsWith("data: ")) {
32935
+ dataLines.push(line.slice(6));
32936
+ }
32937
+ }
32938
+ if (dataLines.length === 0) continue;
32939
+ const raw = dataLines.join("\n");
32940
+ let msg;
32941
+ try {
32942
+ msg = JSON.parse(raw);
32943
+ } catch {
32944
+ continue;
32945
+ }
32946
+ switch (msg.type) {
32947
+ case "tail_event":
32948
+ if (options.json) {
32949
+ process.stdout.write(JSON.stringify(msg.event) + "\n");
32950
+ } else {
32951
+ process.stdout.write(formatEvent(msg.event, useColor) + "\n");
32952
+ }
32953
+ break;
32954
+ case "tail_gap":
32955
+ process.stderr.write(
32956
+ (useColor ? chalk27.yellow(`[warn] Dropped ${msg.droppedCount} event(s) between ${msg.fromTimestamp} and ${msg.toTimestamp}`) : `[warn] Dropped ${msg.droppedCount} event(s) between ${msg.fromTimestamp} and ${msg.toTimestamp}`) + "\n"
32957
+ );
32958
+ break;
32959
+ case "tail_connected":
32960
+ process.stderr.write(
32961
+ (useColor ? chalk27.green(`Connected to tail session ${msg.sessionId}`) : `Connected to tail session ${msg.sessionId}`) + "\n"
32962
+ );
32963
+ break;
32964
+ case "tail_error":
32965
+ process.stderr.write(
32966
+ (useColor ? chalk27.red(`[error] ${msg.error}`) : `[error] ${msg.error}`) + "\n"
32967
+ );
32968
+ break;
32969
+ }
32970
+ }
32971
+ }
32972
+ return "aborted";
32973
+ }
32974
+ async function createSession(apiUrl, apiKey, filters) {
32975
+ const filter = {};
32976
+ const arrayFields = {
32977
+ flowId: "flowIds",
32978
+ agentId: "agentIds",
32979
+ surfaceId: "surfaceIds",
32980
+ executionId: "executionIds",
32981
+ level: "levels",
32982
+ category: "categories"
32983
+ };
32984
+ for (const [k, v] of Object.entries(filters)) {
32985
+ if (v !== void 0 && arrayFields[k]) {
32986
+ filter[arrayFields[k]] = [v];
32987
+ }
32988
+ }
32989
+ const body = Object.keys(filter).length > 0 ? { filter } : {};
32990
+ const res = await fetch(`${apiUrl}/v1/tail/sessions`, {
32991
+ method: "POST",
32992
+ headers: {
32993
+ Authorization: `Bearer ${apiKey}`,
32994
+ "Content-Type": "application/json",
32995
+ "User-Agent": `Runtype-CLI/${getCliVersion()}`
32996
+ },
32997
+ body: JSON.stringify(body)
32998
+ });
32999
+ if (!res.ok) {
33000
+ const text = await res.text().catch(() => "");
33001
+ throw new Error(`Failed to create tail session: ${res.status} ${res.statusText}${text ? ` \u2014 ${text}` : ""}`);
33002
+ }
33003
+ return await res.json();
33004
+ }
33005
+ async function connectAndStream(sseUrl, apiKey, options, signal) {
33006
+ const res = await fetch(sseUrl, {
33007
+ headers: {
33008
+ Authorization: `Bearer ${apiKey}`,
33009
+ Accept: "text/event-stream",
33010
+ "User-Agent": `Runtype-CLI/${getCliVersion()}`
33011
+ },
33012
+ signal
33013
+ });
33014
+ if (!res.ok) {
33015
+ const text = await res.text().catch(() => "");
33016
+ throw new Error(`SSE connection failed: ${res.status} ${res.statusText}${text ? ` \u2014 ${text}` : ""}`);
33017
+ }
33018
+ if (!res.body) {
33019
+ throw new Error("SSE response has no body");
33020
+ }
33021
+ const reader = res.body.getReader();
33022
+ try {
33023
+ return await consumeSSEStream(reader, options, signal);
33024
+ } finally {
33025
+ reader.releaseLock();
33026
+ }
33027
+ }
33028
+ var BASE_DELAY_MS = 1e3;
33029
+ var MAX_DELAY_MS = 3e4;
33030
+ var MAX_ATTEMPTS = 10;
33031
+ async function runTail(options) {
33032
+ const apiKey = await ensureAuth();
33033
+ if (!apiKey) return;
33034
+ const apiUrl = getApiUrl();
33035
+ const filters = {
33036
+ flowId: options.flow,
33037
+ agentId: options.agent,
33038
+ surfaceId: options.surface,
33039
+ executionId: options.execution,
33040
+ level: options.level,
33041
+ category: options.category
33042
+ };
33043
+ const useColor = options.color;
33044
+ const activeFilters = Object.entries(filters).filter(([, v]) => v !== void 0).map(([k, v]) => `${k}=${v}`);
33045
+ process.stderr.write(
33046
+ (useColor ? chalk27.gray(`Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`) : `Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`) + "\n"
33047
+ );
33048
+ const controller = new AbortController();
33049
+ let shuttingDown = false;
33050
+ const shutdown = () => {
33051
+ if (shuttingDown) return;
33052
+ shuttingDown = true;
33053
+ process.stderr.write(
33054
+ (useColor ? chalk27.gray("\nDisconnecting...") : "\nDisconnecting...") + "\n"
33055
+ );
33056
+ controller.abort();
33057
+ };
33058
+ process.on("SIGINT", shutdown);
33059
+ process.on("SIGTERM", shutdown);
33060
+ let attempt = 0;
33061
+ while (!shuttingDown && attempt < MAX_ATTEMPTS) {
33062
+ try {
33063
+ const session = await createSession(apiUrl, apiKey, filters);
33064
+ attempt = 0;
33065
+ const result = await connectAndStream(session.sseUrl, apiKey, options, controller.signal);
33066
+ if (result === "aborted" || shuttingDown) break;
33067
+ process.stderr.write(
33068
+ (useColor ? chalk27.yellow("Stream ended, reconnecting...") : "Stream ended, reconnecting...") + "\n"
33069
+ );
33070
+ } catch (err) {
33071
+ if (shuttingDown || controller.signal.aborted) break;
33072
+ attempt++;
33073
+ const delay = Math.min(BASE_DELAY_MS * Math.pow(2, attempt - 1), MAX_DELAY_MS);
33074
+ const message = err instanceof Error ? err.message : String(err);
33075
+ process.stderr.write(
33076
+ (useColor ? chalk27.red(`Connection error: ${message}`) : `Connection error: ${message}`) + "\n"
33077
+ );
33078
+ if (attempt >= MAX_ATTEMPTS) {
33079
+ process.stderr.write(
33080
+ (useColor ? chalk27.red(`Max reconnect attempts (${MAX_ATTEMPTS}) reached. Exiting.`) : `Max reconnect attempts (${MAX_ATTEMPTS}) reached. Exiting.`) + "\n"
33081
+ );
33082
+ process.exit(1);
33083
+ }
33084
+ process.stderr.write(
33085
+ (useColor ? chalk27.gray(`Retrying in ${delay / 1e3}s (attempt ${attempt}/${MAX_ATTEMPTS})...`) : `Retrying in ${delay / 1e3}s (attempt ${attempt}/${MAX_ATTEMPTS})...`) + "\n"
33086
+ );
33087
+ await new Promise((resolve8) => {
33088
+ const timer = setTimeout(resolve8, delay);
33089
+ const onAbort = () => {
33090
+ clearTimeout(timer);
33091
+ resolve8();
33092
+ };
33093
+ controller.signal.addEventListener("abort", onAbort, { once: true });
33094
+ });
33095
+ }
33096
+ }
33097
+ process.removeListener("SIGINT", shutdown);
33098
+ process.removeListener("SIGTERM", shutdown);
33099
+ }
33100
+ var tailCommand = new Command21("tail").description("Stream live execution logs from the Runtype API").option("--flow <id>", "Filter by flow ID").option("--agent <id>", "Filter by agent ID").option("--surface <id>", "Filter by surface ID").option("--execution <id>", "Filter by execution ID").option("--level <level>", "Filter by level (debug/info/warn/error)").option("--category <category>", "Filter by category (execution/agent/tool/model/system/error)").option("--json", "Output raw JSON (one object per line)").option("--no-color", "Disable color output").action(async (options) => {
33101
+ await runTail(options);
33102
+ });
33103
+
32836
33104
  // src/index.ts
32837
33105
  init_credential_store();
32838
33106
 
32839
33107
  // src/lib/update-check.ts
32840
- import chalk27 from "chalk";
33108
+ import chalk28 from "chalk";
32841
33109
  import Conf3 from "conf";
32842
33110
  var UPDATE_CHECK_INTERVAL_MS = 12 * 60 * 60 * 1e3;
32843
33111
  var UPDATE_NOTIFY_INTERVAL_MS = 24 * 60 * 60 * 1e3;
@@ -32931,7 +33199,7 @@ function notifyFromCachedCliUpdate(args, options = {}) {
32931
33199
  console.error(message);
32932
33200
  });
32933
33201
  notify(
32934
- `${chalk27.yellow("Update available:")} ${chalk27.red(currentVersion)} ${chalk27.gray("->")} ${chalk27.green(latestVersion)} ${chalk27.gray(`(${getUpgradeCommand()})`)}`
33202
+ `${chalk28.yellow("Update available:")} ${chalk28.red(currentVersion)} ${chalk28.gray("->")} ${chalk28.green(latestVersion)} ${chalk28.gray(`(${getUpgradeCommand()})`)}`
32935
33203
  );
32936
33204
  store.set("lastNotifiedAt", now.toISOString());
32937
33205
  store.set("lastNotifiedVersion", latestVersion);
@@ -32973,7 +33241,7 @@ function maybeNotifyAboutCliUpdate(args, options = {}) {
32973
33241
  // src/index.ts
32974
33242
  loadEnv();
32975
33243
  setCliTitle();
32976
- var program = new Command21();
33244
+ var program = new Command22();
32977
33245
  program.name("runtype").description("CLI for Runtype AI Platform").version(getCliVersion()).option("-v, --verbose", "Enable verbose output").option("--api-url <url>", "Override API URL").option("--json", "Output in JSON format");
32978
33246
  program.addCommand(initCommand);
32979
33247
  program.addCommand(loginCommand);
@@ -32996,6 +33264,7 @@ program.addCommand(analyticsCommand);
32996
33264
  program.addCommand(billingCommand);
32997
33265
  program.addCommand(flowVersionsCommand);
32998
33266
  program.addCommand(createMarathonCommand());
33267
+ program.addCommand(tailCommand);
32999
33268
  program.exitOverride();
33000
33269
  try {
33001
33270
  const userArgs = process.argv.slice(2);
@@ -33009,15 +33278,15 @@ try {
33009
33278
  } catch (error) {
33010
33279
  const commanderError = error;
33011
33280
  if (commanderError.code === "commander.missingArgument") {
33012
- console.error(chalk28.red(`Error: ${commanderError.message}`));
33281
+ console.error(chalk29.red(`Error: ${commanderError.message}`));
33013
33282
  process.exit(1);
33014
33283
  } else if (commanderError.code === "commander.unknownOption") {
33015
- console.error(chalk28.red(`Error: ${commanderError.message}`));
33284
+ console.error(chalk29.red(`Error: ${commanderError.message}`));
33016
33285
  process.exit(1);
33017
33286
  } else if (commanderError.code === "commander.help" || commanderError.code === "commander.version") {
33018
33287
  process.exit(0);
33019
33288
  } else {
33020
- console.error(chalk28.red("An unexpected error occurred:"));
33289
+ console.error(chalk29.red("An unexpected error occurred:"));
33021
33290
  console.error(error);
33022
33291
  process.exit(1);
33023
33292
  }
@@ -33026,12 +33295,12 @@ async function handleNoCommand() {
33026
33295
  const store = new CredentialStore();
33027
33296
  const hasCredentials = await store.hasCredentials();
33028
33297
  if (!hasCredentials) {
33029
- console.log(chalk28.cyan("\nWelcome to Runtype CLI!\n"));
33298
+ console.log(chalk29.cyan("\nWelcome to Runtype CLI!\n"));
33030
33299
  console.log("It looks like this is your first time. Run the setup wizard:");
33031
- console.log(` ${chalk28.green("runtype init")}
33300
+ console.log(` ${chalk29.green("runtype init")}
33032
33301
  `);
33033
33302
  console.log("Or see all available commands:");
33034
- console.log(` ${chalk28.green("runtype --help")}
33303
+ console.log(` ${chalk29.green("runtype --help")}
33035
33304
  `);
33036
33305
  } else {
33037
33306
  try {