@tiny-fish/cli 0.46.2-next.369 → 0.47.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/README.md CHANGED
@@ -318,6 +318,20 @@ tinyfish browser session create --url https://agentql.com
318
318
  tinyfish browser session create --pretty
319
319
  ```
320
320
 
321
+ By default the session uses the TinyFish residential proxy in the US, with one exit IP per session. To change that:
322
+
323
+ ```bash
324
+ # Exit from another country (ISO 3166-1 alpha-2)
325
+ tinyfish browser session create --proxy-country DE
326
+
327
+ # Route through your own HTTP(S) proxy (password from env, never a flag)
328
+ TINYFISH_PROXY_PASSWORD=<password> \
329
+ tinyfish browser session create --proxy-url http://proxy.example.com:8080 --proxy-username <user>
330
+
331
+ # Connect directly, without a proxy
332
+ tinyfish browser session create --no-proxy
333
+ ```
334
+
321
335
  ### Vault
322
336
 
323
337
  Connect a credential provider (1Password / Bitwarden), then have runs consume those credentials.
@@ -11,6 +11,37 @@ function parseBrowserProfile(value) {
11
11
  err({ error: `Invalid --browser-profile "${value}". Must be one of: lite, stealth` });
12
12
  process.exit(1);
13
13
  }
14
+ function exitWithError(message) {
15
+ err({ error: message });
16
+ process.exit(1);
17
+ }
18
+ // The proxy password comes from the environment so it stays out of shell history.
19
+ function buildProxyConfig(opts) {
20
+ if (opts.proxy === false) {
21
+ if (opts.proxyCountry || opts.proxyUrl || opts.proxyUsername) {
22
+ exitWithError('--no-proxy cannot be combined with other --proxy-* flags');
23
+ }
24
+ return { enabled: false };
25
+ }
26
+ if (opts.proxyCountry && opts.proxyUrl) {
27
+ exitWithError('--proxy-country cannot be combined with --proxy-url');
28
+ }
29
+ if (opts.proxyUsername && !opts.proxyUrl) {
30
+ exitWithError('--proxy-username requires --proxy-url');
31
+ }
32
+ if (opts.proxyCountry)
33
+ return { country_code: opts.proxyCountry.toUpperCase() };
34
+ if (opts.proxyUrl) {
35
+ const password = process.env.TINYFISH_PROXY_PASSWORD;
36
+ return {
37
+ type: 'custom',
38
+ url: opts.proxyUrl,
39
+ ...(opts.proxyUsername ? { username: opts.proxyUsername } : {}),
40
+ ...(password ? { password } : {}),
41
+ };
42
+ }
43
+ return undefined;
44
+ }
14
45
  function printPrettyBrowserSession(session) {
15
46
  outLine('Browser session created');
16
47
  outLine(`Session ID: ${session.session_id}`);
@@ -31,14 +62,20 @@ export function registerBrowser(program) {
31
62
  .description('Create a remote browser session')
32
63
  .option('--url <value>', 'Open a URL after session creation')
33
64
  .option('--browser-profile <profile>', 'Browser profile for execution (lite|stealth)')
65
+ .option('--proxy-country <code>', 'Exit country for the TinyFish proxy (ISO 3166-1 alpha-2, default US)')
66
+ .option('--proxy-url <url>', 'Route through your own HTTP(S) proxy (password via TINYFISH_PROXY_PASSWORD)')
67
+ .option('--proxy-username <user>', 'Username for --proxy-url')
68
+ .option('--no-proxy', 'Connect directly, without a proxy')
34
69
  .option('--pretty', 'Human-readable output')
35
70
  .action(async (opts) => {
36
71
  const apiKey = getApiKey();
37
72
  const browserProfile = parseBrowserProfile(opts.browserProfile);
73
+ const proxyConfig = buildProxyConfig(opts);
38
74
  try {
39
75
  const response = await browserSessionCreate({
40
76
  ...(opts.url !== undefined ? { url: opts.url } : {}),
41
77
  ...(browserProfile !== undefined ? { browser_profile: browserProfile } : {}),
78
+ ...(proxyConfig !== undefined ? { proxy_config: proxyConfig } : {}),
42
79
  }, apiKey);
43
80
  if (opts.pretty) {
44
81
  printPrettyBrowserSession(response);
@@ -91,9 +91,18 @@ export interface RunStepsResponse {
91
91
  status: RunStatus;
92
92
  steps: RunStep[];
93
93
  }
94
+ export interface CliBrowserProxyConfig {
95
+ enabled?: boolean;
96
+ type?: 'tinyfish' | 'custom';
97
+ country_code?: string;
98
+ url?: string;
99
+ username?: string;
100
+ password?: string;
101
+ }
94
102
  export interface CliBrowserSessionCreateParams {
95
103
  url?: string;
96
104
  browser_profile?: 'lite' | 'stealth';
105
+ proxy_config?: CliBrowserProxyConfig;
97
106
  }
98
107
  export interface CancelRunResponse {
99
108
  run_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiny-fish/cli",
3
- "version": "0.46.2-next.369",
3
+ "version": "0.47.0",
4
4
  "description": "TinyFish CLI — run web automations from your terminal",
5
5
  "type": "module",
6
6
  "bin": {