@tiny-fish/cli 0.40.1-next.318 → 0.41.1-next.323

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.
@@ -82,9 +82,11 @@ function printPrettyFetch(response) {
82
82
  outLine(` ETag: ${result.etag}`);
83
83
  if (result.last_modified)
84
84
  outLine(` Last-Modified: ${result.last_modified}`);
85
- if (result.highlights && result.highlights.length > 0) {
85
+ // Only markdown results carry highlights on the SDK's result union.
86
+ const highlights = result.format === 'markdown' ? result.highlights : undefined;
87
+ if (highlights && highlights.length > 0) {
86
88
  outLine(' Highlights:');
87
- result.highlights.forEach((snippet, index) => {
89
+ highlights.forEach((snippet, index) => {
88
90
  outLine(` ${index + 1}. ${snippet.text}`);
89
91
  });
90
92
  }
@@ -1,6 +1,5 @@
1
- import { type AgentRunAsyncResponse, type AgentRunResponse, type AgentRunWithStreamingResponse, type BrowserSession, type Run, type RunListParams, type RunListResponse, type SearchQueryParams, type SearchQueryResponse, type WalletResponse } from '@tiny-fish/sdk';
2
- import type { BatchCancelResponse, BatchGetResponse, BatchRunRequest, BatchRunResponse, CancelRunResponse, CliAgentRunParams, CliBrowserSessionCreateParams, CliFetchGetContentsParams, CookieRecord, ProfileCreateResponse, ProfileUploadResponse, RunStepsResponse, VaultConnectRequest, VaultConnectResponse, VaultConnectionsListResponse, VaultDisconnectResponse, VaultItemsListResponse, VaultItemsSyncResponse } from './types.js';
3
- import { z } from 'zod';
1
+ import { type AgentRunAsyncResponse, type AgentRunResponse, type AgentRunWithStreamingResponse, type BrowserSession, type FetchGetContentsParams, type FetchResponse, type Run, type RunListParams, type RunListResponse, type SearchQueryParams, type SearchQueryResponse, type WalletResponse } from '@tiny-fish/sdk';
2
+ import type { BatchCancelResponse, BatchGetResponse, BatchRunRequest, BatchRunResponse, CancelRunResponse, CliAgentRunParams, CliBrowserSessionCreateParams, CookieRecord, ProfileCreateResponse, ProfileUploadResponse, RunStepsResponse, VaultConnectRequest, VaultConnectResponse, VaultConnectionsListResponse, VaultDisconnectResponse, VaultItemsListResponse, VaultItemsSyncResponse } from './types.js';
4
3
  type ConnectMap = Record<string, {
5
4
  attempt_id: string;
6
5
  }> | undefined;
@@ -13,116 +12,7 @@ export declare function listRuns(opts: RunListParams, apiKey: string, timeout?:
13
12
  export declare function getRun(runId: string, apiKey: string): Promise<Run>;
14
13
  export declare function getRunSteps(runId: string, apiKey: string): Promise<RunStepsResponse>;
15
14
  export declare function searchQuery(params: SearchQueryParams, apiKey: string): Promise<SearchQueryResponse>;
16
- declare const cliFetchResponseSchema: z.ZodObject<{
17
- results: z.ZodArray<z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
18
- url: z.ZodString;
19
- final_url: z.ZodNullable<z.ZodString>;
20
- title: z.ZodNullable<z.ZodString>;
21
- description: z.ZodNullable<z.ZodString>;
22
- language: z.ZodNullable<z.ZodString>;
23
- author: z.ZodNullable<z.ZodString>;
24
- published_date: z.ZodNullable<z.ZodString>;
25
- links: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
- image_links: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
- latency_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
28
- not_modified: z.ZodOptional<z.ZodBoolean>;
29
- etag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
- last_modified: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
- format: z.ZodLiteral<"markdown">;
32
- text: z.ZodNullable<z.ZodString>;
33
- }, z.core.$strip>, z.ZodObject<{
34
- url: z.ZodString;
35
- final_url: z.ZodNullable<z.ZodString>;
36
- title: z.ZodNullable<z.ZodString>;
37
- description: z.ZodNullable<z.ZodString>;
38
- language: z.ZodNullable<z.ZodString>;
39
- author: z.ZodNullable<z.ZodString>;
40
- published_date: z.ZodNullable<z.ZodString>;
41
- links: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
- image_links: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
- latency_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
44
- not_modified: z.ZodOptional<z.ZodBoolean>;
45
- etag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
- last_modified: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
- format: z.ZodLiteral<"html">;
48
- text: z.ZodNullable<z.ZodString>;
49
- }, z.core.$strip>, z.ZodObject<{
50
- url: z.ZodString;
51
- final_url: z.ZodNullable<z.ZodString>;
52
- title: z.ZodNullable<z.ZodString>;
53
- description: z.ZodNullable<z.ZodString>;
54
- language: z.ZodNullable<z.ZodString>;
55
- author: z.ZodNullable<z.ZodString>;
56
- published_date: z.ZodNullable<z.ZodString>;
57
- links: z.ZodOptional<z.ZodArray<z.ZodString>>;
58
- image_links: z.ZodOptional<z.ZodArray<z.ZodString>>;
59
- latency_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
60
- not_modified: z.ZodOptional<z.ZodBoolean>;
61
- etag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
- last_modified: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
- format: z.ZodLiteral<"json">;
64
- text: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodType<string | number | boolean | {
65
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
66
- } | (string | number | boolean | {
67
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
68
- } | (string | number | boolean | {
69
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
70
- } | (string | number | boolean | {
71
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
72
- } | (string | number | boolean | {
73
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
74
- } | (string | number | boolean | {
75
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
76
- } | (string | number | boolean | {
77
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null;
78
- } | (string | number | boolean | {
79
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null;
80
- } | (string | number | boolean | {
81
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null;
82
- } | (string | number | boolean | {
83
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null;
84
- } | (string | number | boolean | {
85
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null;
86
- } | (string | number | boolean | {
87
- [key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
88
- } | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null, unknown, z.core.$ZodTypeInternals<string | number | boolean | {
89
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
90
- } | (string | number | boolean | {
91
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
92
- } | (string | number | boolean | {
93
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
94
- } | (string | number | boolean | {
95
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
96
- } | (string | number | boolean | {
97
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
98
- } | (string | number | boolean | {
99
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
100
- } | (string | number | boolean | {
101
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null;
102
- } | (string | number | boolean | {
103
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null;
104
- } | (string | number | boolean | {
105
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null;
106
- } | (string | number | boolean | {
107
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null;
108
- } | (string | number | boolean | {
109
- [key: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null;
110
- } | (string | number | boolean | {
111
- [key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
112
- } | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null, unknown>>>>;
113
- }, z.core.$strip>], "format">, z.ZodObject<{
114
- highlights: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
115
- text: z.ZodString;
116
- rank: z.ZodNumber;
117
- }, z.core.$strip>>>>;
118
- }, z.core.$strip>>>;
119
- errors: z.ZodArray<z.ZodObject<{
120
- url: z.ZodString;
121
- error: z.ZodString;
122
- }, z.core.$strip>>;
123
- }, z.core.$strip>;
124
- export type CliFetchResponse = z.infer<typeof cliFetchResponseSchema>;
125
- export declare function fetchContentGet(params: CliFetchGetContentsParams, apiKey: string): Promise<CliFetchResponse>;
15
+ export declare function fetchContentGet(params: FetchGetContentsParams, apiKey: string): Promise<FetchResponse>;
126
16
  export declare function browserSessionCreate(params: CliBrowserSessionCreateParams, apiKey: string): Promise<BrowserSession>;
127
17
  export declare function cancelRun(runId: string, apiKey: string): Promise<CancelRunResponse>;
128
18
  export declare function getWallet(apiKey: string): Promise<WalletResponse>;
@@ -1,4 +1,4 @@
1
- import { APIStatusError, agentRunAsyncResponseSchema, agentRunResponseSchema, agentRunWithStreamingResponseSchema, fetchErrorSchema, fetchResultSchema, browserSessionSchema, searchQueryResponseSchema, TinyFish, runSchema, runStatusSchema, } from '@tiny-fish/sdk';
1
+ import { APIStatusError, agentRunAsyncResponseSchema, agentRunResponseSchema, agentRunWithStreamingResponseSchema, browserSessionSchema, searchQueryResponseSchema, TinyFish, runSchema, runStatusSchema, } from '@tiny-fish/sdk';
2
2
  import { CONNECT_SOURCE, loadConfig } from './auth.js';
3
3
  import { API_URL_OVERRIDE, CLI_AGENT_IDENTITY, CLI_VERSION } from './constants.js';
4
4
  import { detectHarness, detectHumanInitiated } from './harness.js';
@@ -281,22 +281,8 @@ export function searchQuery(params, apiKey) {
281
281
  return searchQueryResponseSchema.parse(response);
282
282
  });
283
283
  }
284
- const highlightSnippetSchema = z.object({
285
- text: z.string(),
286
- rank: z.number().int().min(1),
287
- });
288
- // Published SDK result schema strips `highlights`; intersect to keep it.
289
- // nullish, not optional: a null must not fail the whole response parse.
290
- const cliFetchResponseSchema = z.object({
291
- results: z.array(z.intersection(fetchResultSchema, z.object({ highlights: z.array(highlightSnippetSchema).nullish() }))),
292
- errors: z.array(fetchErrorSchema),
293
- });
294
284
  export function fetchContentGet(params, apiKey) {
295
- return sdk(apiKey, async (client) => {
296
- // TODO(PROD-4260): use client.fetch.getContents once #4786 lands in an SDK release.
297
- const response = await client.post(client.productUrl('fetch'), { json: params });
298
- return parseWithSchema(cliFetchResponseSchema, response, 'Invalid fetch response');
299
- });
285
+ return sdk(apiKey, async (client) => client.fetch.getContents(params));
300
286
  }
301
287
  export function browserSessionCreate(params, apiKey) {
302
288
  return sdk(apiKey, async (client) => {
@@ -7,7 +7,8 @@ import { HARNESS_PROBE_TIMEOUT_MS } from './constants.js';
7
7
  import { sanitizeLine } from './output.js';
8
8
  // display_hermes_home() abbreviates under $HOME, so the value is not always absolute.
9
9
  const HERMES_HOME_LINE = /^\s*hermes_home:\s*(\S.*?)\s*$/m;
10
- // Cached: `hermes dump` starts Python, and doctor asks repeatedly.
10
+ // Consistency, not speed: doctor's second probe timing out would downgrade
11
+ // hermes-plugin from fail to warn, and doctor --fix skips the repair.
11
12
  let cachedHermesHome;
12
13
  /** Tests share one process; the resolver result must not. */
13
14
  export function resetHermesHomeCache() {
@@ -1,4 +1,4 @@
1
- import type { AgentRunParams, BrowserProfile, FetchGetContentsParams, Run, RunStatus } from '@tiny-fish/sdk';
1
+ import type { AgentRunParams, BrowserProfile, Run, RunStatus } from '@tiny-fish/sdk';
2
2
  export type OutputSchema = Record<string, unknown>;
3
3
  export interface CliAgentRunParams extends AgentRunParams {
4
4
  output_schema?: OutputSchema;
@@ -91,15 +91,6 @@ export interface RunStepsResponse {
91
91
  status: RunStatus;
92
92
  steps: RunStep[];
93
93
  }
94
- export interface CliFetchHighlightsParams {
95
- query: string;
96
- max_snippets?: number;
97
- max_characters?: number;
98
- include_full_page_text?: boolean;
99
- }
100
- export interface CliFetchGetContentsParams extends FetchGetContentsParams {
101
- highlights?: CliFetchHighlightsParams;
102
- }
103
94
  export interface CliBrowserSessionCreateParams {
104
95
  url?: string;
105
96
  browser_profile?: 'lite' | 'stealth';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiny-fish/cli",
3
- "version": "0.40.1-next.318",
3
+ "version": "0.41.1-next.323",
4
4
  "description": "TinyFish CLI — run web automations from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -34,7 +34,7 @@
34
34
  "format:check": "oxfmt --check ."
35
35
  },
36
36
  "dependencies": {
37
- "@tiny-fish/sdk": "^0.5.0",
37
+ "@tiny-fish/sdk": "^0.6.0",
38
38
  "commander": "^12.0.0",
39
39
  "cross-spawn": "^7.0.6",
40
40
  "tldts": "^6.1.86",