@runtypelabs/cli 0.2.5 → 0.2.6

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
@@ -2137,7 +2137,9 @@ var talkCommand = new import_commander6.Command("talk").description("Start an in
2137
2137
  console.log(import_chalk10.default.gray("\nAssistant> ") + import_chalk10.default.gray("Thinking..."));
2138
2138
  try {
2139
2139
  const payload = session.buildDispatchPayload(trimmed);
2140
- const response = await fetch(`${apiUrl}/dispatch`, {
2140
+ const version = getApiVersion();
2141
+ const dispatchUrl = `${apiUrl.replace(/\/$/, "")}/${version}/dispatch`;
2142
+ const response = await fetch(dispatchUrl, {
2141
2143
  method: "POST",
2142
2144
  headers: {
2143
2145
  Authorization: `Bearer ${apiKey}`,
@@ -2159,7 +2161,16 @@ var talkCommand = new import_commander6.Command("talk").description("Start an in
2159
2161
  } catch (error) {
2160
2162
  process.stdout.write("\x1B[1A\x1B[2K");
2161
2163
  const message = error instanceof Error ? error.message : "Unknown error";
2162
- console.error(import_chalk10.default.red(`Error: ${message}`));
2164
+ const cause = error instanceof Error && error.cause instanceof Error ? error.cause.message : error instanceof Error && typeof error.cause === "string" ? error.cause : null;
2165
+ console.error(import_chalk10.default.red(`Error: ${message}${cause ? ` (${cause})` : ""}`));
2166
+ if (message === "fetch failed") {
2167
+ const apiUrl2 = getApiUrl();
2168
+ console.error(
2169
+ import_chalk10.default.gray(
2170
+ `Tip: Request to ${apiUrl2} failed. If using a local API, set RUNTYPE_API_URL (e.g. http://localhost:8787) and run \`pnpm dev:api\` or \`pnpm dev:bun\`.`
2171
+ )
2172
+ );
2173
+ }
2163
2174
  rl.prompt();
2164
2175
  }
2165
2176
  });