@tiny-fish/cli 0.9.1-next.122 → 0.9.1-next.124

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.
@@ -1,5 +1,5 @@
1
1
  import { APIStatusError, agentRunAsyncResponseSchema, agentRunResponseSchema, agentRunWithStreamingResponseSchema, fetchResponseSchema, browserSessionSchema, searchQueryResponseSchema, TinyFish, runSchema, runStatusSchema, } from "@tiny-fish/sdk";
2
- import { BASE_URL, CLI_VERSION } from "./constants.js";
2
+ import { API_URL_OVERRIDE, CLI_VERSION } from "./constants.js";
3
3
  import { detectHarness, detectHumanInitiated } from "./harness.js";
4
4
  import { ApiError } from "./output.js";
5
5
  import { z } from "zod";
@@ -13,7 +13,10 @@ class TinyFishCliClient extends TinyFish {
13
13
  };
14
14
  // Forwarded explicitly: the pinned published SDK may predate TF_CLIENT_* support.
15
15
  // Non-printable chars make fetch throw; 128 is the server cap (client_name varchar(128)).
16
- const sanitize = (value) => (value ?? "").replace(/[^\x20-\x7E]/g, "").trim().slice(0, 128);
16
+ const sanitize = (value) => (value ?? "")
17
+ .replace(/[^\x20-\x7E]/g, "")
18
+ .trim()
19
+ .slice(0, 128);
17
20
  // An explicit TF_CLIENT_NAME always wins over auto-detection, preserving the
18
21
  // env-var forwarding contract added in PR #3781; otherwise fingerprint the
19
22
  // calling harness so cli usage can be split by client (PF-3168).
@@ -55,7 +58,7 @@ class TinyFishCliClient extends TinyFish {
55
58
  function createSdkClient(apiKey, timeout) {
56
59
  return new TinyFishCliClient({
57
60
  apiKey,
58
- baseURL: BASE_URL,
61
+ ...(API_URL_OVERRIDE !== undefined ? { baseURL: API_URL_OVERRIDE } : {}),
59
62
  maxRetries: 0,
60
63
  ...(timeout !== undefined ? { timeout } : {}),
61
64
  });
@@ -1,5 +1,6 @@
1
1
  export declare const CLI_VERSION: string;
2
2
  export declare const BASE_URL: string;
3
+ export declare const API_URL_OVERRIDE: string | undefined;
3
4
  /** URL where users can create and manage API keys */
4
5
  export declare function getDashboardUrl(source?: string): string;
5
6
  export declare const DASHBOARD_URL: string;
@@ -3,7 +3,7 @@ const _require = createRequire(import.meta.url);
3
3
  const _pkg = _require("../../package.json");
4
4
  export const CLI_VERSION = _pkg.version;
5
5
  /** Base URL for the TinyFish API. Override with TINYFISH_API_URL for staging/self-hosted. */
6
- const apiUrlOverride = process.env["TINYFISH_API_URL"]?.trim();
6
+ const apiUrlOverride = process.env["TINYFISH_API_URL"]?.trim() || undefined;
7
7
  if (apiUrlOverride) {
8
8
  let parsed;
9
9
  try {
@@ -19,7 +19,10 @@ if (apiUrlOverride) {
19
19
  process.exit(1);
20
20
  }
21
21
  }
22
- export const BASE_URL = apiUrlOverride || "https://agent.tinyfish.ai";
22
+ export const BASE_URL = apiUrlOverride ?? "https://agent.tinyfish.ai";
23
+ // Left undefined, the SDK sends Search and Fetch to their own hosts, which are the ones
24
+ // behind the API gateway.
25
+ export const API_URL_OVERRIDE = apiUrlOverride;
23
26
  const DEFAULT_DASHBOARD_SOURCE = "cli";
24
27
  const DASHBOARD_SOURCE_PATTERN = /^[a-z0-9][a-z0-9_-]{0,63}$/;
25
28
  function normalizeDashboardSource(source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiny-fish/cli",
3
- "version": "0.9.1-next.122",
3
+ "version": "0.9.1-next.124",
4
4
  "description": "TinyFish CLI — run web automations from your terminal",
5
5
  "type": "module",
6
6
  "bin": {