@runtypelabs/cli 2.13.0 → 2.14.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.
Files changed (2) hide show
  1. package/dist/index.js +346 -71
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -131,8 +131,8 @@ var init_credential_store = __esm({
131
131
  });
132
132
 
133
133
  // src/index.ts
134
- import { Command as Command24 } from "commander";
135
- import chalk31 from "chalk";
134
+ import { Command as Command25 } from "commander";
135
+ import chalk32 from "chalk";
136
136
 
137
137
  // src/lib/load-env.ts
138
138
  import { readFileSync } from "fs";
@@ -52940,9 +52940,283 @@ flowVersionsCommand.command("publish <flowId>").description("Publish a version")
52940
52940
  await waitUntilExit();
52941
52941
  });
52942
52942
 
52943
- // src/commands/tail.ts
52943
+ // src/commands/agent-versions.ts
52944
52944
  import { Command as Command21 } from "commander";
52945
52945
  import chalk27 from "chalk";
52946
+ import React19 from "react";
52947
+ import { render as render19 } from "ink";
52948
+ import { useState as useState33, useEffect as useEffect30 } from "react";
52949
+ import { Text as Text35 } from "ink";
52950
+ var agentVersionsCommand = new Command21("agent-versions").description(
52951
+ "Manage agent versions"
52952
+ );
52953
+ agentVersionsCommand.command("list <agentId>").description("List all versions for an agent").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (agentId, options) => {
52954
+ const apiKey = await ensureAuth();
52955
+ if (!apiKey) return;
52956
+ const client = new ApiClient(apiKey);
52957
+ if (!isTTY(options) || options.json) {
52958
+ try {
52959
+ const data = await client.get(`/agent-versions/${agentId}`);
52960
+ if (options.json) {
52961
+ printJson(data);
52962
+ } else {
52963
+ const versions = data.versions ?? [];
52964
+ if (versions.length === 0) {
52965
+ console.log(chalk27.gray("No versions found"));
52966
+ return;
52967
+ }
52968
+ console.log(chalk27.cyan(`Versions for agent ${agentId}:`));
52969
+ for (const v of versions) {
52970
+ const isPublished = v.id === data.publishedVersionId;
52971
+ const liveTag = isPublished ? chalk27.green(" [live]") : "";
52972
+ const versionLabel = v.label || (v.versionNumber !== void 0 ? `v${v.versionNumber}` : v.id);
52973
+ const date5 = v.createdAt ? chalk27.gray(` ${v.createdAt}`) : "";
52974
+ console.log(` ${chalk27.green(v.id)} ${versionLabel}${liveTag}${date5}`);
52975
+ }
52976
+ }
52977
+ } catch (error51) {
52978
+ const message = error51 instanceof Error ? error51.message : "Unknown error";
52979
+ console.error(chalk27.red("Failed to fetch versions"));
52980
+ console.error(chalk27.red(message));
52981
+ process.exit(1);
52982
+ }
52983
+ return;
52984
+ }
52985
+ const App = () => {
52986
+ const [loading, setLoading] = useState33(true);
52987
+ const [items, setItems] = useState33(null);
52988
+ const [publishedId, setPublishedId] = useState33(null);
52989
+ const [error51, setError] = useState33(null);
52990
+ useEffect30(() => {
52991
+ const run = async () => {
52992
+ try {
52993
+ const data = await client.get(`/agent-versions/${agentId}`);
52994
+ setItems(data.versions ?? []);
52995
+ setPublishedId(data.publishedVersionId ?? null);
52996
+ setLoading(false);
52997
+ } catch (err) {
52998
+ setError(err instanceof Error ? err : new Error(String(err)));
52999
+ setLoading(false);
53000
+ }
53001
+ };
53002
+ run();
53003
+ }, []);
53004
+ return React19.createElement(DataList, {
53005
+ title: `Versions for agent ${agentId}`,
53006
+ items,
53007
+ error: error51,
53008
+ loading,
53009
+ emptyMessage: "No versions found",
53010
+ renderCard: (item) => {
53011
+ const v = item;
53012
+ const liveTag = v.id === publishedId ? " [live]" : "";
53013
+ const versionLabel = v.label || (v.versionNumber !== void 0 ? `v${v.versionNumber}` : v.id);
53014
+ return React19.createElement(
53015
+ Text35,
53016
+ null,
53017
+ ` ${v.id} ${versionLabel}${liveTag}${v.createdAt ? ` ${v.createdAt}` : ""}`
53018
+ );
53019
+ }
53020
+ });
53021
+ };
53022
+ const { waitUntilExit } = render19(React19.createElement(App));
53023
+ await waitUntilExit();
53024
+ });
53025
+ agentVersionsCommand.command("get <agentId> <versionId>").description("Get a specific version").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
53026
+ async (agentId, versionId, options) => {
53027
+ const apiKey = await ensureAuth();
53028
+ if (!apiKey) return;
53029
+ const client = new ApiClient(apiKey);
53030
+ if (!isTTY(options) || options.json) {
53031
+ try {
53032
+ const data = await client.get(`/agent-versions/${agentId}/${versionId}`);
53033
+ if (options.json) {
53034
+ printJson(data);
53035
+ } else {
53036
+ printDetail("Agent Version", [
53037
+ { label: "ID", value: data.id },
53038
+ { label: "Agent ID", value: data.agentId },
53039
+ { label: "Version", value: data.versionNumber },
53040
+ { label: "Type", value: data.versionType },
53041
+ { label: "Label", value: data.label ?? void 0 },
53042
+ { label: "Notes", value: data.notes ?? void 0 },
53043
+ { label: "Created", value: data.createdAt }
53044
+ ]);
53045
+ }
53046
+ } catch (error51) {
53047
+ const message = error51 instanceof Error ? error51.message : "Unknown error";
53048
+ console.error(chalk27.red("Failed to fetch version"));
53049
+ console.error(chalk27.red(message));
53050
+ process.exit(1);
53051
+ }
53052
+ return;
53053
+ }
53054
+ const App = () => {
53055
+ const [loading, setLoading] = useState33(true);
53056
+ const [success2, setSuccess] = useState33(null);
53057
+ const [error51, setError] = useState33(null);
53058
+ const [resultNode, setResultNode] = useState33(void 0);
53059
+ useEffect30(() => {
53060
+ const run = async () => {
53061
+ try {
53062
+ const data = await client.get(`/agent-versions/${agentId}/${versionId}`);
53063
+ setResultNode(
53064
+ React19.createElement(EntityCard, {
53065
+ fields: [
53066
+ { label: "ID", value: data.id },
53067
+ { label: "Agent ID", value: data.agentId },
53068
+ { label: "Version", value: data.versionNumber },
53069
+ { label: "Type", value: data.versionType },
53070
+ { label: "Label", value: data.label ?? void 0 },
53071
+ { label: "Notes", value: data.notes ?? void 0 },
53072
+ { label: "Created", value: data.createdAt }
53073
+ ]
53074
+ })
53075
+ );
53076
+ setSuccess(true);
53077
+ setLoading(false);
53078
+ } catch (err) {
53079
+ setError(err instanceof Error ? err : new Error(String(err)));
53080
+ setSuccess(false);
53081
+ setLoading(false);
53082
+ }
53083
+ };
53084
+ run();
53085
+ }, []);
53086
+ return React19.createElement(MutationResult, {
53087
+ loading,
53088
+ loadingLabel: "Fetching version...",
53089
+ success: success2,
53090
+ successMessage: "Agent Version",
53091
+ error: error51,
53092
+ result: resultNode
53093
+ });
53094
+ };
53095
+ const { waitUntilExit } = render19(React19.createElement(App));
53096
+ await waitUntilExit();
53097
+ }
53098
+ );
53099
+ agentVersionsCommand.command("published <agentId>").description("Get the published version for an agent").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (agentId, options) => {
53100
+ const apiKey = await ensureAuth();
53101
+ if (!apiKey) return;
53102
+ const client = new ApiClient(apiKey);
53103
+ if (!isTTY(options) || options.json) {
53104
+ try {
53105
+ const data = await client.get(`/agent-versions/${agentId}/published`);
53106
+ if (options.json) {
53107
+ printJson(data);
53108
+ } else {
53109
+ printDetail("Published Version", [
53110
+ { label: "ID", value: data.id },
53111
+ { label: "Version", value: data.versionNumber },
53112
+ { label: "Label", value: data.label ?? void 0 },
53113
+ { label: "Created", value: data.createdAt }
53114
+ ]);
53115
+ }
53116
+ } catch (error51) {
53117
+ const message = error51 instanceof Error ? error51.message : "Unknown error";
53118
+ console.error(chalk27.red("Failed to fetch published version"));
53119
+ console.error(chalk27.red(message));
53120
+ process.exit(1);
53121
+ }
53122
+ return;
53123
+ }
53124
+ const App = () => {
53125
+ const [loading, setLoading] = useState33(true);
53126
+ const [success2, setSuccess] = useState33(null);
53127
+ const [error51, setError] = useState33(null);
53128
+ const [resultNode, setResultNode] = useState33(void 0);
53129
+ useEffect30(() => {
53130
+ const run = async () => {
53131
+ try {
53132
+ const data = await client.get(`/agent-versions/${agentId}/published`);
53133
+ setResultNode(
53134
+ React19.createElement(EntityCard, {
53135
+ fields: [
53136
+ { label: "ID", value: data.id },
53137
+ { label: "Version", value: data.versionNumber },
53138
+ { label: "Label", value: data.label ?? void 0 },
53139
+ { label: "Created", value: data.createdAt }
53140
+ ]
53141
+ })
53142
+ );
53143
+ setSuccess(true);
53144
+ setLoading(false);
53145
+ } catch (err) {
53146
+ setError(err instanceof Error ? err : new Error(String(err)));
53147
+ setSuccess(false);
53148
+ setLoading(false);
53149
+ }
53150
+ };
53151
+ run();
53152
+ }, []);
53153
+ return React19.createElement(MutationResult, {
53154
+ loading,
53155
+ loadingLabel: "Fetching published version...",
53156
+ success: success2,
53157
+ successMessage: "Published Version",
53158
+ error: error51,
53159
+ result: resultNode
53160
+ });
53161
+ };
53162
+ const { waitUntilExit } = render19(React19.createElement(App));
53163
+ await waitUntilExit();
53164
+ });
53165
+ agentVersionsCommand.command("publish <agentId>").description("Publish a version").requiredOption("-v, --version <versionId>", "Version ID to publish").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
53166
+ async (agentId, options) => {
53167
+ const apiKey = await ensureAuth();
53168
+ if (!apiKey) return;
53169
+ const client = new ApiClient(apiKey);
53170
+ if (!isTTY(options)) {
53171
+ try {
53172
+ await client.post(`/agent-versions/${agentId}/publish`, {
53173
+ versionId: options.version
53174
+ });
53175
+ console.log(chalk27.green("Version published"));
53176
+ } catch (error51) {
53177
+ const message = error51 instanceof Error ? error51.message : "Unknown error";
53178
+ console.error(chalk27.red("Failed to publish version"));
53179
+ console.error(chalk27.red(message));
53180
+ process.exit(1);
53181
+ }
53182
+ return;
53183
+ }
53184
+ const App = () => {
53185
+ const [loading, setLoading] = useState33(true);
53186
+ const [success2, setSuccess] = useState33(null);
53187
+ const [error51, setError] = useState33(null);
53188
+ useEffect30(() => {
53189
+ const run = async () => {
53190
+ try {
53191
+ await client.post(`/agent-versions/${agentId}/publish`, {
53192
+ versionId: options.version
53193
+ });
53194
+ setSuccess(true);
53195
+ setLoading(false);
53196
+ } catch (err) {
53197
+ setError(err instanceof Error ? err : new Error(String(err)));
53198
+ setSuccess(false);
53199
+ setLoading(false);
53200
+ }
53201
+ };
53202
+ run();
53203
+ }, []);
53204
+ return React19.createElement(MutationResult, {
53205
+ loading,
53206
+ loadingLabel: "Publishing version...",
53207
+ success: success2,
53208
+ successMessage: "Version published",
53209
+ error: error51
53210
+ });
53211
+ };
53212
+ const { waitUntilExit } = render19(React19.createElement(App));
53213
+ await waitUntilExit();
53214
+ }
53215
+ );
53216
+
53217
+ // src/commands/tail.ts
53218
+ import { Command as Command22 } from "commander";
53219
+ import chalk28 from "chalk";
52946
53220
  function abbreviateId(id) {
52947
53221
  const underscoreIdx = id.lastIndexOf("_");
52948
53222
  if (underscoreIdx === -1) {
@@ -52961,20 +53235,20 @@ function formatTime(ts) {
52961
53235
  return `${hh}:${mm}:${ss}.${ms}`;
52962
53236
  }
52963
53237
  var LEVEL_COLORS = {
52964
- debug: chalk27.gray,
52965
- info: chalk27.blue,
52966
- warn: chalk27.yellow,
52967
- error: chalk27.red
53238
+ debug: chalk28.gray,
53239
+ info: chalk28.blue,
53240
+ warn: chalk28.yellow,
53241
+ error: chalk28.red
52968
53242
  };
52969
53243
  function levelBadge(level, useColor) {
52970
53244
  const tag = level.toUpperCase().padEnd(5);
52971
53245
  if (!useColor) return `[${tag}]`;
52972
- const colorFn = LEVEL_COLORS[level] || chalk27.white;
53246
+ const colorFn = LEVEL_COLORS[level] || chalk28.white;
52973
53247
  return colorFn(`[${tag}]`);
52974
53248
  }
52975
53249
  function categoryBadge(category, useColor) {
52976
53250
  if (!useColor) return `[${category}]`;
52977
- return chalk27.magenta(`[${category}]`);
53251
+ return chalk28.magenta(`[${category}]`);
52978
53252
  }
52979
53253
  function formatTailData(data) {
52980
53254
  return Object.entries(data).map(([k, v]) => `${k}=${typeof v === "string" ? v : JSON.stringify(v)}`).join(" ");
@@ -52989,14 +53263,14 @@ function formatContextIds(event, useColor) {
52989
53263
  if (event.conversationId) ids.push(`conv=${abbreviateId(event.conversationId)}`);
52990
53264
  if (ids.length === 0) return "";
52991
53265
  const text = ids.join(" ");
52992
- return useColor ? chalk27.gray(` ${text}`) : ` ${text}`;
53266
+ return useColor ? chalk28.gray(` ${text}`) : ` ${text}`;
52993
53267
  }
52994
53268
  function formatEvent(event, useColor) {
52995
- const time3 = useColor ? chalk27.gray(formatTime(event.timestamp)) : formatTime(event.timestamp);
53269
+ const time3 = useColor ? chalk28.gray(formatTime(event.timestamp)) : formatTime(event.timestamp);
52996
53270
  const level = levelBadge(event.level, useColor);
52997
53271
  const cat = categoryBadge(event.category, useColor);
52998
53272
  const ctx = formatContextIds(event, useColor);
52999
- const data = event.tailData && Object.keys(event.tailData).length > 0 ? useColor ? chalk27.gray(` | ${formatTailData(event.tailData)}`) : ` | ${formatTailData(event.tailData)}` : "";
53273
+ const data = event.tailData && Object.keys(event.tailData).length > 0 ? useColor ? chalk28.gray(` | ${formatTailData(event.tailData)}`) : ` | ${formatTailData(event.tailData)}` : "";
53000
53274
  return `${time3} ${level} ${cat} ${event.message}${data}${ctx}`;
53001
53275
  }
53002
53276
  async function consumeSSEStream(reader, options, signal) {
@@ -53035,17 +53309,17 @@ async function consumeSSEStream(reader, options, signal) {
53035
53309
  break;
53036
53310
  case "tail_gap":
53037
53311
  process.stderr.write(
53038
- (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"
53312
+ (useColor ? chalk28.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"
53039
53313
  );
53040
53314
  break;
53041
53315
  case "tail_connected":
53042
53316
  process.stderr.write(
53043
- (useColor ? chalk27.green(`Connected to tail session ${msg.sessionId}`) : `Connected to tail session ${msg.sessionId}`) + "\n"
53317
+ (useColor ? chalk28.green(`Connected to tail session ${msg.sessionId}`) : `Connected to tail session ${msg.sessionId}`) + "\n"
53044
53318
  );
53045
53319
  break;
53046
53320
  case "tail_error":
53047
53321
  process.stderr.write(
53048
- (useColor ? chalk27.red(`[error] ${msg.error}`) : `[error] ${msg.error}`) + "\n"
53322
+ (useColor ? chalk28.red(`[error] ${msg.error}`) : `[error] ${msg.error}`) + "\n"
53049
53323
  );
53050
53324
  break;
53051
53325
  }
@@ -53125,7 +53399,7 @@ async function runTail(options) {
53125
53399
  const useColor = options.color;
53126
53400
  const activeFilters = Object.entries(filters).filter(([, v]) => v !== void 0).map(([k, v]) => `${k}=${v}`);
53127
53401
  process.stderr.write(
53128
- (useColor ? chalk27.gray(`Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`) : `Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`) + "\n"
53402
+ (useColor ? chalk28.gray(`Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`) : `Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`) + "\n"
53129
53403
  );
53130
53404
  const controller = new AbortController();
53131
53405
  let shuttingDown = false;
@@ -53133,7 +53407,7 @@ async function runTail(options) {
53133
53407
  if (shuttingDown) return;
53134
53408
  shuttingDown = true;
53135
53409
  process.stderr.write(
53136
- (useColor ? chalk27.gray("\nDisconnecting...") : "\nDisconnecting...") + "\n"
53410
+ (useColor ? chalk28.gray("\nDisconnecting...") : "\nDisconnecting...") + "\n"
53137
53411
  );
53138
53412
  controller.abort();
53139
53413
  };
@@ -53147,7 +53421,7 @@ async function runTail(options) {
53147
53421
  const result = await connectAndStream(session.sseUrl, apiKey, options, controller.signal);
53148
53422
  if (result === "aborted" || shuttingDown) break;
53149
53423
  process.stderr.write(
53150
- (useColor ? chalk27.yellow("Stream ended, reconnecting...") : "Stream ended, reconnecting...") + "\n"
53424
+ (useColor ? chalk28.yellow("Stream ended, reconnecting...") : "Stream ended, reconnecting...") + "\n"
53151
53425
  );
53152
53426
  } catch (err) {
53153
53427
  if (shuttingDown || controller.signal.aborted) break;
@@ -53155,16 +53429,16 @@ async function runTail(options) {
53155
53429
  const delay = Math.min(BASE_DELAY_MS * Math.pow(2, attempt - 1), MAX_DELAY_MS);
53156
53430
  const message = err instanceof Error ? err.message : String(err);
53157
53431
  process.stderr.write(
53158
- (useColor ? chalk27.red(`Connection error: ${message}`) : `Connection error: ${message}`) + "\n"
53432
+ (useColor ? chalk28.red(`Connection error: ${message}`) : `Connection error: ${message}`) + "\n"
53159
53433
  );
53160
53434
  if (attempt >= MAX_ATTEMPTS) {
53161
53435
  process.stderr.write(
53162
- (useColor ? chalk27.red(`Max reconnect attempts (${MAX_ATTEMPTS}) reached. Exiting.`) : `Max reconnect attempts (${MAX_ATTEMPTS}) reached. Exiting.`) + "\n"
53436
+ (useColor ? chalk28.red(`Max reconnect attempts (${MAX_ATTEMPTS}) reached. Exiting.`) : `Max reconnect attempts (${MAX_ATTEMPTS}) reached. Exiting.`) + "\n"
53163
53437
  );
53164
53438
  process.exit(1);
53165
53439
  }
53166
53440
  process.stderr.write(
53167
- (useColor ? chalk27.gray(`Retrying in ${delay / 1e3}s (attempt ${attempt}/${MAX_ATTEMPTS})...`) : `Retrying in ${delay / 1e3}s (attempt ${attempt}/${MAX_ATTEMPTS})...`) + "\n"
53441
+ (useColor ? chalk28.gray(`Retrying in ${delay / 1e3}s (attempt ${attempt}/${MAX_ATTEMPTS})...`) : `Retrying in ${delay / 1e3}s (attempt ${attempt}/${MAX_ATTEMPTS})...`) + "\n"
53168
53442
  );
53169
53443
  await new Promise((resolve10) => {
53170
53444
  const timer = setTimeout(resolve10, delay);
@@ -53179,16 +53453,16 @@ async function runTail(options) {
53179
53453
  process.removeListener("SIGINT", shutdown);
53180
53454
  process.removeListener("SIGTERM", shutdown);
53181
53455
  }
53182
- 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) => {
53456
+ var tailCommand = new Command22("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) => {
53183
53457
  await runTail(options);
53184
53458
  });
53185
53459
 
53186
53460
  // src/commands/validate-product.ts
53187
- import { Command as Command22, Option } from "commander";
53188
- import chalk28 from "chalk";
53461
+ import { Command as Command23, Option } from "commander";
53462
+ import chalk29 from "chalk";
53189
53463
  import { readFileSync as readFileSync15 } from "fs";
53190
53464
  function createValidateProductCommand() {
53191
- return new Command22("validate-product").description("Validate a product (FPO) or FPO template locally (no API call)").argument(
53465
+ return new Command23("validate-product").description("Validate a product (FPO) or FPO template locally (no API call)").argument(
53192
53466
  "[input]",
53193
53467
  'Path to JSON file, raw JSON string (starts with "{"), or "-" for stdin'
53194
53468
  ).option("--template", "Force FPO template validation").option("--fpo", "Force FPO (non-template) validation").addOption(
@@ -53212,7 +53486,7 @@ var validateProductCommand = createValidateProductCommand();
53212
53486
  async function runValidateAction(input, _options) {
53213
53487
  const options = this.optsWithGlobals();
53214
53488
  if (options.template && options.fpo) {
53215
- console.error(chalk28.red("Error: --template and --fpo are mutually exclusive"));
53489
+ console.error(chalk29.red("Error: --template and --fpo are mutually exclusive"));
53216
53490
  process.exit(1);
53217
53491
  }
53218
53492
  let raw;
@@ -53220,7 +53494,7 @@ async function runValidateAction(input, _options) {
53220
53494
  raw = await readInput(input);
53221
53495
  } catch (err) {
53222
53496
  const message = err instanceof Error ? err.message : String(err);
53223
- console.error(chalk28.red(`Failed to read input: ${message}`));
53497
+ console.error(chalk29.red(`Failed to read input: ${message}`));
53224
53498
  process.exit(1);
53225
53499
  return;
53226
53500
  }
@@ -53229,7 +53503,7 @@ async function runValidateAction(input, _options) {
53229
53503
  parsed = JSON.parse(raw);
53230
53504
  } catch (err) {
53231
53505
  const message = err instanceof Error ? err.message : String(err);
53232
- console.error(chalk28.red(`Invalid JSON: ${message}`));
53506
+ console.error(chalk29.red(`Invalid JSON: ${message}`));
53233
53507
  process.exit(1);
53234
53508
  return;
53235
53509
  }
@@ -53319,16 +53593,16 @@ function runValidation(body, kind) {
53319
53593
  function printHumanResult(kind, result) {
53320
53594
  const label = kind === "template" ? "FPO template" : "FPO";
53321
53595
  const overallValid = !hasAnyErrors(result);
53322
- const headline = overallValid ? chalk28.green(`\u2713 Valid ${label}`) : chalk28.red(`\u2717 Invalid ${label}`);
53596
+ const headline = overallValid ? chalk29.green(`\u2713 Valid ${label}`) : chalk29.red(`\u2717 Invalid ${label}`);
53323
53597
  console.log(headline);
53324
53598
  console.log(
53325
- chalk28.gray(
53599
+ chalk29.gray(
53326
53600
  ` ${result.errors.length} error(s), ${result.warnings.length} warning(s), ${result.recommendations.length} recommendation(s)`
53327
53601
  )
53328
53602
  );
53329
- printIssues("Errors", result.errors, chalk28.red);
53330
- printIssues("Warnings", result.warnings, chalk28.yellow);
53331
- printIssues("Recommendations", result.recommendations, chalk28.blue);
53603
+ printIssues("Errors", result.errors, chalk29.red);
53604
+ printIssues("Warnings", result.warnings, chalk29.yellow);
53605
+ printIssues("Recommendations", result.recommendations, chalk29.blue);
53332
53606
  if (result.kind === "template") {
53333
53607
  const defaults = result.defaultsValidation;
53334
53608
  const structuralErrors = defaults.errors.filter(
@@ -53340,22 +53614,22 @@ function printHumanResult(kind, result) {
53340
53614
  if (structuralErrors.length > 0) {
53341
53615
  console.log();
53342
53616
  console.log(
53343
- chalk28.red(
53617
+ chalk29.red(
53344
53618
  `Defaults validation: template defaults do not produce a valid FPO`
53345
53619
  )
53346
53620
  );
53347
- printIssues("Default-resolution errors", structuralErrors, chalk28.red);
53348
- printIssues("Default-resolution warnings", defaults.warnings, chalk28.yellow);
53621
+ printIssues("Default-resolution errors", structuralErrors, chalk29.red);
53622
+ printIssues("Default-resolution warnings", defaults.warnings, chalk29.yellow);
53349
53623
  }
53350
53624
  if (missingVars.length > 0) {
53351
53625
  console.log();
53352
53626
  console.log(
53353
- chalk28.gray(
53627
+ chalk29.gray(
53354
53628
  `Template variables needing deploy-time values (${missingVars.length}):`
53355
53629
  )
53356
53630
  );
53357
53631
  for (const issue2 of missingVars) {
53358
- console.log(chalk28.gray(` \u2022 ${issue2.path} \u2014 ${issue2.message}`));
53632
+ console.log(chalk29.gray(` \u2022 ${issue2.path} \u2014 ${issue2.message}`));
53359
53633
  }
53360
53634
  }
53361
53635
  }
@@ -53365,17 +53639,17 @@ function printIssues(title, issues, color) {
53365
53639
  console.log();
53366
53640
  console.log(color(`${title}:`));
53367
53641
  for (const issue2 of issues) {
53368
- const pathLabel = issue2.path ? chalk28.gray(` [${issue2.path}]`) : "";
53369
- console.log(` ${color("\u2022")} ${chalk28.bold(issue2.code)}${pathLabel} ${issue2.message}`);
53642
+ const pathLabel = issue2.path ? chalk29.gray(` [${issue2.path}]`) : "";
53643
+ console.log(` ${color("\u2022")} ${chalk29.bold(issue2.code)}${pathLabel} ${issue2.message}`);
53370
53644
  if (issue2.suggestedFix) {
53371
- console.log(` ${chalk28.gray("fix:")} ${issue2.suggestedFix}`);
53645
+ console.log(` ${chalk29.gray("fix:")} ${issue2.suggestedFix}`);
53372
53646
  }
53373
53647
  }
53374
53648
  }
53375
53649
 
53376
53650
  // src/commands/deploy.ts
53377
- import { Command as Command23 } from "commander";
53378
- import chalk29 from "chalk";
53651
+ import { Command as Command24 } from "commander";
53652
+ import chalk30 from "chalk";
53379
53653
  import * as fs14 from "fs";
53380
53654
  import * as path14 from "path";
53381
53655
  function bashSingleQuote(s) {
@@ -53718,7 +53992,7 @@ function collectSecretNames(agentDef) {
53718
53992
  function slugify2(s) {
53719
53993
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
53720
53994
  }
53721
- var deployCommand = new Command23("deploy").description("Export an agent or flow and scaffold a Cloud Run deployment").option("--agent <id>", "Agent ID to export (may be repeated)", (v, acc) => {
53995
+ var deployCommand = new Command24("deploy").description("Export an agent or flow and scaffold a Cloud Run deployment").option("--agent <id>", "Agent ID to export (may be repeated)", (v, acc) => {
53722
53996
  acc.push(v);
53723
53997
  return acc;
53724
53998
  }, []).option("--flow <id>", "Flow ID to export (may be repeated)", (v, acc) => {
@@ -53729,7 +54003,7 @@ var deployCommand = new Command23("deploy").description("Export an agent or flow
53729
54003
  const agentIds = options.agent;
53730
54004
  const flowIds = options.flow;
53731
54005
  if (agentIds.length === 0 && flowIds.length === 0) {
53732
- console.error(chalk29.red("Error: provide at least one --agent <id> or --flow <id>"));
54006
+ console.error(chalk30.red("Error: provide at least one --agent <id> or --flow <id>"));
53733
54007
  process.exit(1);
53734
54008
  }
53735
54009
  const apiKey = await ensureAuth();
@@ -53737,30 +54011,30 @@ var deployCommand = new Command23("deploy").description("Export an agent or flow
53737
54011
  const client = new ApiClient(apiKey);
53738
54012
  const outDir = path14.resolve(options.output);
53739
54013
  const projectName = options.name ?? slugify2(path14.basename(outDir));
53740
- console.log(chalk29.cyan(`
54014
+ console.log(chalk30.cyan(`
53741
54015
  Scaffolding deployment to ${outDir}
53742
54016
  `));
53743
54017
  const agentDefs = [];
53744
54018
  for (const id of agentIds) {
53745
- process.stdout.write(` Exporting agent ${chalk29.green(id)}... `);
54019
+ process.stdout.write(` Exporting agent ${chalk30.green(id)}... `);
53746
54020
  try {
53747
54021
  const def = await client.get(`/agents/${id}/export-runtime`);
53748
54022
  agentDefs.push({ id, name: String(def.name ?? id), def });
53749
- process.stdout.write(chalk29.green("\u2713\n"));
54023
+ process.stdout.write(chalk30.green("\u2713\n"));
53750
54024
  } catch (err) {
53751
54025
  const msg = err instanceof ApiError ? err.message : String(err);
53752
- process.stdout.write(chalk29.red(`\u2717
54026
+ process.stdout.write(chalk30.red(`\u2717
53753
54027
  `));
53754
- console.error(chalk29.red(` Failed to export agent ${id}: ${msg}`));
54028
+ console.error(chalk30.red(` Failed to export agent ${id}: ${msg}`));
53755
54029
  if (err instanceof ApiError && err.statusCode === 404) {
53756
- console.error(chalk29.yellow(" The export-runtime feature may not be enabled on your account or environment."));
53757
- console.error(chalk29.gray(" If you have your own environment, try: RUNTYPE_API_URL={API Base URI} runtype deploy ..."));
54030
+ console.error(chalk30.yellow(" The export-runtime feature may not be enabled on your account or environment."));
54031
+ console.error(chalk30.gray(" If you have your own environment, try: RUNTYPE_API_URL={API Base URI} runtype deploy ..."));
53758
54032
  }
53759
54033
  process.exit(1);
53760
54034
  }
53761
54035
  }
53762
54036
  for (const id of flowIds) {
53763
- process.stdout.write(` Exporting flow ${chalk29.green(id)}... `);
54037
+ process.stdout.write(` Exporting flow ${chalk30.green(id)}... `);
53764
54038
  try {
53765
54039
  const def = await client.get(`/flows/${id}/export-runtime`);
53766
54040
  const wrappedName = String(def.name ?? id);
@@ -53776,15 +54050,15 @@ Scaffolding deployment to ${outDir}
53776
54050
  primaryFlow: def
53777
54051
  }
53778
54052
  });
53779
- process.stdout.write(chalk29.green("\u2713\n"));
54053
+ process.stdout.write(chalk30.green("\u2713\n"));
53780
54054
  } catch (err) {
53781
54055
  const msg = err instanceof ApiError ? err.message : String(err);
53782
- process.stdout.write(chalk29.red(`\u2717
54056
+ process.stdout.write(chalk30.red(`\u2717
53783
54057
  `));
53784
- console.error(chalk29.red(` Failed to export flow ${id}: ${msg}`));
54058
+ console.error(chalk30.red(` Failed to export flow ${id}: ${msg}`));
53785
54059
  if (err instanceof ApiError && err.statusCode === 404) {
53786
- console.error(chalk29.yellow(" The export-runtime feature may not be enabled on your account or environment."));
53787
- console.error(chalk29.gray(" If you have your own environment, try: RUNTYPE_API_URL={API Base URI} runtype deploy ..."));
54060
+ console.error(chalk30.yellow(" The export-runtime feature may not be enabled on your account or environment."));
54061
+ console.error(chalk30.gray(" If you have your own environment, try: RUNTYPE_API_URL={API Base URI} runtype deploy ..."));
53788
54062
  }
53789
54063
  process.exit(1);
53790
54064
  }
@@ -53843,17 +54117,17 @@ Scaffolding deployment to ${outDir}
53843
54117
  )
53844
54118
  );
53845
54119
  console.log("");
53846
- console.log(chalk29.green(`\u2713 Scaffold written to ${outDir}`));
54120
+ console.log(chalk30.green(`\u2713 Scaffold written to ${outDir}`));
53847
54121
  console.log("");
53848
- console.log(chalk29.bold("Next steps:"));
54122
+ console.log(chalk30.bold("Next steps:"));
53849
54123
  console.log(` cd ${options.output}`);
53850
54124
  console.log(" chmod +x setup.sh && ./setup.sh # pack runtime + install deps");
53851
54125
  console.log(" npm run dev # test locally");
53852
54126
  console.log("");
53853
54127
  if (secretNames.length > 0) {
53854
- console.log(chalk29.yellow("Required secrets (set before deploying):"));
54128
+ console.log(chalk30.yellow("Required secrets (set before deploying):"));
53855
54129
  for (const s of secretNames) {
53856
- console.log(` ${chalk29.cyan(s)}`);
54130
+ console.log(` ${chalk30.cyan(s)}`);
53857
54131
  }
53858
54132
  console.log("");
53859
54133
  console.log(" Set via Cloud Run: gcloud run deploy \u2026 --set-secrets KEY=NAME:latest");
@@ -53873,7 +54147,7 @@ Scaffolding deployment to ${outDir}
53873
54147
  init_credential_store();
53874
54148
 
53875
54149
  // src/lib/update-check.ts
53876
- import chalk30 from "chalk";
54150
+ import chalk31 from "chalk";
53877
54151
  import Conf3 from "conf";
53878
54152
  var UPDATE_CHECK_INTERVAL_MS = 12 * 60 * 60 * 1e3;
53879
54153
  var UPDATE_NOTIFY_INTERVAL_MS = 24 * 60 * 60 * 1e3;
@@ -53967,7 +54241,7 @@ function notifyFromCachedCliUpdate(args, options = {}) {
53967
54241
  console.error(message);
53968
54242
  });
53969
54243
  notify(
53970
- `${chalk30.yellow("Update available:")} ${chalk30.red(currentVersion)} ${chalk30.gray("->")} ${chalk30.green(latestVersion)} ${chalk30.gray(`(${getUpgradeCommand()})`)}`
54244
+ `${chalk31.yellow("Update available:")} ${chalk31.red(currentVersion)} ${chalk31.gray("->")} ${chalk31.green(latestVersion)} ${chalk31.gray(`(${getUpgradeCommand()})`)}`
53971
54245
  );
53972
54246
  store.set("lastNotifiedAt", now.toISOString());
53973
54247
  store.set("lastNotifiedVersion", latestVersion);
@@ -54009,7 +54283,7 @@ function maybeNotifyAboutCliUpdate(args, options = {}) {
54009
54283
  // src/index.ts
54010
54284
  loadEnv();
54011
54285
  setCliTitle();
54012
- var program = new Command24();
54286
+ var program = new Command25();
54013
54287
  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");
54014
54288
  program.addCommand(initCommand);
54015
54289
  program.addCommand(loginCommand);
@@ -54031,6 +54305,7 @@ program.addCommand(personaCommand);
54031
54305
  program.addCommand(analyticsCommand);
54032
54306
  program.addCommand(billingCommand);
54033
54307
  program.addCommand(flowVersionsCommand);
54308
+ program.addCommand(agentVersionsCommand);
54034
54309
  program.addCommand(createMarathonCommand());
54035
54310
  program.addCommand(tailCommand);
54036
54311
  program.addCommand(validateProductCommand);
@@ -54048,15 +54323,15 @@ try {
54048
54323
  } catch (error51) {
54049
54324
  const commanderError = error51;
54050
54325
  if (commanderError.code === "commander.missingArgument") {
54051
- console.error(chalk31.red(`Error: ${commanderError.message}`));
54326
+ console.error(chalk32.red(`Error: ${commanderError.message}`));
54052
54327
  process.exit(1);
54053
54328
  } else if (commanderError.code === "commander.unknownOption") {
54054
- console.error(chalk31.red(`Error: ${commanderError.message}`));
54329
+ console.error(chalk32.red(`Error: ${commanderError.message}`));
54055
54330
  process.exit(1);
54056
54331
  } else if (commanderError.code === "commander.help" || commanderError.code === "commander.version") {
54057
54332
  process.exit(0);
54058
54333
  } else {
54059
- console.error(chalk31.red("An unexpected error occurred:"));
54334
+ console.error(chalk32.red("An unexpected error occurred:"));
54060
54335
  console.error(error51);
54061
54336
  process.exit(1);
54062
54337
  }
@@ -54065,12 +54340,12 @@ async function handleNoCommand() {
54065
54340
  const store = new CredentialStore();
54066
54341
  const hasCredentials = await store.hasCredentials();
54067
54342
  if (!hasCredentials) {
54068
- console.log(chalk31.cyan("\nWelcome to Runtype CLI!\n"));
54343
+ console.log(chalk32.cyan("\nWelcome to Runtype CLI!\n"));
54069
54344
  console.log("It looks like this is your first time. Run the setup wizard:");
54070
- console.log(` ${chalk31.green("runtype init")}
54345
+ console.log(` ${chalk32.green("runtype init")}
54071
54346
  `);
54072
54347
  console.log("Or see all available commands:");
54073
- console.log(` ${chalk31.green("runtype --help")}
54348
+ console.log(` ${chalk32.green("runtype --help")}
54074
54349
  `);
54075
54350
  } else {
54076
54351
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/cli",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "Command-line interface for Runtype AI platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",