@tiny-fish/cli 0.1.4 → 0.1.5-next.47
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 +74 -0
- package/dist/commands/browser.d.ts +2 -0
- package/dist/commands/browser.js +41 -0
- package/dist/commands/fetch.d.ts +2 -0
- package/dist/commands/fetch.js +66 -0
- package/dist/commands/run.js +47 -1
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.js +50 -0
- package/dist/index.js +6 -0
- package/dist/lib/client.d.ts +8 -5
- package/dist/lib/client.js +28 -1
- package/dist/lib/types.d.ts +5 -1
- package/package.json +12 -2
package/README.md
CHANGED
|
@@ -41,6 +41,36 @@ tinyfish agent run "Find the pricing page" --url https://example.com --sync
|
|
|
41
41
|
|
|
42
42
|
# Submit and return immediately (don't wait)
|
|
43
43
|
tinyfish agent run "Find the pricing page" --url https://example.com --async
|
|
44
|
+
|
|
45
|
+
# Request structured output with an inline JSON Schema
|
|
46
|
+
tinyfish agent run "Extract the product price" \
|
|
47
|
+
--url https://example.com/product \
|
|
48
|
+
--sync \
|
|
49
|
+
--output-schema "{\"type\":\"object\",\"properties\":{\"price\":{\"type\":\"string\"}},\"required\":[\"price\"]}"
|
|
50
|
+
|
|
51
|
+
# Or load the schema from a file
|
|
52
|
+
tinyfish agent run "Extract the product price" \
|
|
53
|
+
--url https://example.com/product \
|
|
54
|
+
--sync \
|
|
55
|
+
--output-schema-file ./schemas/product-price.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Structured output
|
|
59
|
+
|
|
60
|
+
Use `--output-schema <json>` for short inline schemas and `--output-schema-file <path>` for schemas you want to reuse, review, or keep in source control.
|
|
61
|
+
Both flags work with the default streaming mode, `--sync`, and `--async`.
|
|
62
|
+
|
|
63
|
+
Example schema file:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"price": { "type": "string" },
|
|
70
|
+
"currency": { "type": "string" }
|
|
71
|
+
},
|
|
72
|
+
"required": ["price", "currency"]
|
|
73
|
+
}
|
|
44
74
|
```
|
|
45
75
|
|
|
46
76
|
### Manage runs
|
|
@@ -59,12 +89,56 @@ tinyfish agent run get <run_id> --pretty
|
|
|
59
89
|
tinyfish agent run cancel <run_id> --pretty
|
|
60
90
|
```
|
|
61
91
|
|
|
92
|
+
### Search
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Query TinyFish Search
|
|
96
|
+
tinyfish search query "agentql pricing"
|
|
97
|
+
|
|
98
|
+
# Add location and language hints
|
|
99
|
+
tinyfish search query "agentql pricing" --location US --language en
|
|
100
|
+
|
|
101
|
+
# Human-readable output
|
|
102
|
+
tinyfish search query "agentql pricing" --pretty
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Fetch
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Fetch extracted content from one or more URLs
|
|
109
|
+
tinyfish fetch content get https://agentql.com
|
|
110
|
+
|
|
111
|
+
# Choose the output format
|
|
112
|
+
tinyfish fetch content get https://agentql.com --format markdown
|
|
113
|
+
|
|
114
|
+
# Include links and image links
|
|
115
|
+
tinyfish fetch content get https://agentql.com --links --image-links
|
|
116
|
+
|
|
117
|
+
# Human-readable output
|
|
118
|
+
tinyfish fetch content get https://agentql.com --pretty
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Browser
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Create a remote browser session
|
|
125
|
+
tinyfish browser session create
|
|
126
|
+
|
|
127
|
+
# Open a URL when the session starts
|
|
128
|
+
tinyfish browser session create --url https://agentql.com
|
|
129
|
+
|
|
130
|
+
# Human-readable output
|
|
131
|
+
tinyfish browser session create --pretty
|
|
132
|
+
```
|
|
133
|
+
|
|
62
134
|
### Output format
|
|
63
135
|
|
|
64
136
|
By default all commands output newline-delimited JSON to stdout — pipe-friendly for agents and scripts. Add `--pretty` for human-readable output.
|
|
65
137
|
|
|
66
138
|
Errors are JSON to stderr with exit code 1. Ctrl+C during a streaming run cancels it automatically.
|
|
67
139
|
|
|
140
|
+
`--output-schema` and `--output-schema-file` are mutually exclusive. Both inputs must parse to a top-level JSON object. The CLI only validates that outer shape locally; the API performs full schema validation and may return errors such as `INVALID_INPUT` or feature-flag access failures.
|
|
141
|
+
|
|
68
142
|
### Debug
|
|
69
143
|
|
|
70
144
|
```bash
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getApiKey } from "../lib/auth.js";
|
|
2
|
+
import { browserSessionCreate } from "../lib/client.js";
|
|
3
|
+
import { handleApiError, out, outLine } from "../lib/output.js";
|
|
4
|
+
function printPrettyBrowserSession(session) {
|
|
5
|
+
outLine("Browser session created");
|
|
6
|
+
outLine(`Session ID: ${session.session_id}`);
|
|
7
|
+
outLine(`CDP URL: ${session.cdp_url}`);
|
|
8
|
+
outLine(`Base URL: ${session.base_url}`);
|
|
9
|
+
}
|
|
10
|
+
export function registerBrowser(program) {
|
|
11
|
+
const browserCmd = program
|
|
12
|
+
.command("browser")
|
|
13
|
+
.description("Browser commands")
|
|
14
|
+
.enablePositionalOptions();
|
|
15
|
+
const sessionCmd = browserCmd
|
|
16
|
+
.command("session")
|
|
17
|
+
.description("Manage browser sessions")
|
|
18
|
+
.enablePositionalOptions();
|
|
19
|
+
sessionCmd
|
|
20
|
+
.command("create")
|
|
21
|
+
.description("Create a remote browser session")
|
|
22
|
+
.option("--url <value>", "Open a URL after session creation")
|
|
23
|
+
.option("--pretty", "Human-readable output")
|
|
24
|
+
.action(async (opts) => {
|
|
25
|
+
const apiKey = getApiKey();
|
|
26
|
+
try {
|
|
27
|
+
const response = await browserSessionCreate({
|
|
28
|
+
...(opts.url !== undefined ? { url: opts.url } : {}),
|
|
29
|
+
}, apiKey);
|
|
30
|
+
if (opts.pretty) {
|
|
31
|
+
printPrettyBrowserSession(response);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
out(response);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
handleApiError(error);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getApiKey } from "../lib/auth.js";
|
|
2
|
+
import { fetchContentGet } from "../lib/client.js";
|
|
3
|
+
import { handleApiError, out, outLine } from "../lib/output.js";
|
|
4
|
+
function printPrettyFetch(response) {
|
|
5
|
+
outLine(`Results: ${response.results.length}`);
|
|
6
|
+
outLine(`Errors: ${response.errors.length}`);
|
|
7
|
+
outLine("");
|
|
8
|
+
if (response.results.length > 0) {
|
|
9
|
+
outLine("Successful fetches:");
|
|
10
|
+
for (const result of response.results) {
|
|
11
|
+
outLine(`- ${result.url}`);
|
|
12
|
+
outLine(` Format: ${result.format}`);
|
|
13
|
+
if (result.title)
|
|
14
|
+
outLine(` Title: ${result.title}`);
|
|
15
|
+
if (result.final_url && result.final_url !== result.url)
|
|
16
|
+
outLine(` Final URL: ${result.final_url}`);
|
|
17
|
+
outLine("");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (response.errors.length > 0) {
|
|
21
|
+
outLine("Errors:");
|
|
22
|
+
for (const error of response.errors) {
|
|
23
|
+
outLine(`- ${error.url}`);
|
|
24
|
+
outLine(` ${error.error}`);
|
|
25
|
+
outLine("");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function registerFetch(program) {
|
|
30
|
+
const fetchCmd = program
|
|
31
|
+
.command("fetch")
|
|
32
|
+
.description("Fetch commands")
|
|
33
|
+
.enablePositionalOptions();
|
|
34
|
+
const contentCmd = fetchCmd
|
|
35
|
+
.command("content")
|
|
36
|
+
.description("Content extraction commands")
|
|
37
|
+
.enablePositionalOptions();
|
|
38
|
+
contentCmd
|
|
39
|
+
.command("get")
|
|
40
|
+
.description("Fetch clean content from one or more URLs")
|
|
41
|
+
.argument("<urls...>", "One or more URLs to fetch")
|
|
42
|
+
.option("--format <format>", "Output format: markdown, html, or json")
|
|
43
|
+
.option("--links", "Include extracted links")
|
|
44
|
+
.option("--image-links", "Include extracted image links")
|
|
45
|
+
.option("--pretty", "Human-readable output")
|
|
46
|
+
.action(async (urls, opts) => {
|
|
47
|
+
const apiKey = getApiKey();
|
|
48
|
+
try {
|
|
49
|
+
const response = await fetchContentGet({
|
|
50
|
+
urls,
|
|
51
|
+
...(opts.format !== undefined ? { format: opts.format } : {}),
|
|
52
|
+
...(opts.links !== undefined ? { links: opts.links } : {}),
|
|
53
|
+
...(opts.imageLinks !== undefined ? { image_links: opts.imageLinks } : {}),
|
|
54
|
+
}, apiKey);
|
|
55
|
+
if (opts.pretty) {
|
|
56
|
+
printPrettyFetch(response);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
out(response);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
handleApiError(error);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
package/dist/commands/run.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { EventType, RunStatus } from "@tiny-fish/sdk";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { z } from "zod";
|
|
2
4
|
import { getApiKey } from "../lib/auth.js";
|
|
3
5
|
import { cancelRun, runAsync, runStream, runSync } from "../lib/client.js";
|
|
4
6
|
import { err, errLine, handleApiError, out, outLine } from "../lib/output.js";
|
|
5
7
|
import { BASE_URL } from "../lib/constants.js";
|
|
8
|
+
const outputSchemaFieldSchema = z.object({}).catchall(z.unknown());
|
|
6
9
|
function extractErrorMessage(error) {
|
|
7
10
|
if (typeof error === "string")
|
|
8
11
|
return error;
|
|
@@ -29,6 +32,42 @@ function checkRunResult(result, expectComplete = true) {
|
|
|
29
32
|
process.exit(1);
|
|
30
33
|
}
|
|
31
34
|
}
|
|
35
|
+
function parseOutputSchema(rawOutputSchema, sourceLabel) {
|
|
36
|
+
let parsed;
|
|
37
|
+
try {
|
|
38
|
+
parsed = JSON.parse(rawOutputSchema);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
err({ error: `Invalid ${sourceLabel} JSON. Provide a valid JSON object.` });
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
const result = outputSchemaFieldSchema.safeParse(parsed);
|
|
45
|
+
if (!result.success) {
|
|
46
|
+
err({ error: `${sourceLabel} must be a JSON object` });
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
return result.data;
|
|
50
|
+
}
|
|
51
|
+
async function loadOutputSchema(opts) {
|
|
52
|
+
if (opts.outputSchema !== undefined && opts.outputSchemaFile !== undefined) {
|
|
53
|
+
err({ error: "--output-schema and --output-schema-file are mutually exclusive" });
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
if (opts.outputSchema !== undefined) {
|
|
57
|
+
return parseOutputSchema(opts.outputSchema, "--output-schema");
|
|
58
|
+
}
|
|
59
|
+
if (opts.outputSchemaFile === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
let fileContents;
|
|
62
|
+
try {
|
|
63
|
+
fileContents = await readFile(opts.outputSchemaFile, "utf8");
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
err({ error: `Unable to read --output-schema-file "${opts.outputSchemaFile}"` });
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
return parseOutputSchema(fileContents, "--output-schema-file");
|
|
70
|
+
}
|
|
32
71
|
export function registerRun(agentCmd) {
|
|
33
72
|
const runCmd = agentCmd
|
|
34
73
|
.command("run")
|
|
@@ -36,6 +75,8 @@ export function registerRun(agentCmd) {
|
|
|
36
75
|
.option("--url <url>", "Target URL for the automation")
|
|
37
76
|
.option("--sync", "Wait for result without streaming steps")
|
|
38
77
|
.option("--async", "Submit without waiting for result")
|
|
78
|
+
.option("--output-schema <json>", "Inline JSON Schema object for structured output")
|
|
79
|
+
.option("--output-schema-file <path>", "Path to a JSON file containing the output schema")
|
|
39
80
|
.option("--pretty", "Human-readable output")
|
|
40
81
|
.argument("[goal]", "Goal to automate")
|
|
41
82
|
.action(async (goal, opts) => {
|
|
@@ -72,8 +113,13 @@ export function registerRun(agentCmd) {
|
|
|
72
113
|
err({ error: 'Goal cannot be empty' });
|
|
73
114
|
process.exit(1);
|
|
74
115
|
}
|
|
116
|
+
const outputSchema = await loadOutputSchema(opts);
|
|
75
117
|
const apiKey = getApiKey();
|
|
76
|
-
const req = {
|
|
118
|
+
const req = {
|
|
119
|
+
goal,
|
|
120
|
+
url: normalizedUrl,
|
|
121
|
+
...(outputSchema !== undefined ? { output_schema: outputSchema } : {}),
|
|
122
|
+
};
|
|
77
123
|
if (opts.async) {
|
|
78
124
|
let result;
|
|
79
125
|
try {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getApiKey } from "../lib/auth.js";
|
|
2
|
+
import { searchQuery } from "../lib/client.js";
|
|
3
|
+
import { handleApiError, out, outLine } from "../lib/output.js";
|
|
4
|
+
function printPrettySearch(response) {
|
|
5
|
+
outLine(`Query: ${response.query}`);
|
|
6
|
+
outLine(`Total results: ${response.total_results}`);
|
|
7
|
+
outLine("");
|
|
8
|
+
if (response.results.length === 0) {
|
|
9
|
+
outLine("No results.");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
for (const result of response.results) {
|
|
13
|
+
outLine(`${result.position}. ${result.title}`);
|
|
14
|
+
outLine(` ${result.url}`);
|
|
15
|
+
outLine(` ${result.snippet}`);
|
|
16
|
+
outLine("");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function registerSearch(program) {
|
|
20
|
+
const searchCmd = program
|
|
21
|
+
.command("search")
|
|
22
|
+
.description("Search commands")
|
|
23
|
+
.enablePositionalOptions();
|
|
24
|
+
searchCmd
|
|
25
|
+
.command("query")
|
|
26
|
+
.description("Query TinyFish Search")
|
|
27
|
+
.argument("<query>", "Search query")
|
|
28
|
+
.option("--location <value>", "Search location hint")
|
|
29
|
+
.option("--language <value>", "Search language hint")
|
|
30
|
+
.option("--pretty", "Human-readable output")
|
|
31
|
+
.action(async (query, opts) => {
|
|
32
|
+
const apiKey = getApiKey();
|
|
33
|
+
try {
|
|
34
|
+
const response = await searchQuery({
|
|
35
|
+
query,
|
|
36
|
+
...(opts.location !== undefined ? { location: opts.location } : {}),
|
|
37
|
+
...(opts.language !== undefined ? { language: opts.language } : {}),
|
|
38
|
+
}, apiKey);
|
|
39
|
+
if (opts.pretty) {
|
|
40
|
+
printPrettySearch(response);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
out(response);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
handleApiError(error);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,11 @@ import { createRequire } from "module";
|
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import { registerAuth } from "./commands/auth.js";
|
|
5
5
|
import { registerBatch } from "./commands/batch.js";
|
|
6
|
+
import { registerFetch } from "./commands/fetch.js";
|
|
7
|
+
import { registerBrowser } from "./commands/browser.js";
|
|
6
8
|
import { registerRun } from "./commands/run.js";
|
|
7
9
|
import { registerRuns } from "./commands/runs.js";
|
|
10
|
+
import { registerSearch } from "./commands/search.js";
|
|
8
11
|
const { version } = createRequire(import.meta.url)("../package.json");
|
|
9
12
|
const program = new Command();
|
|
10
13
|
program
|
|
@@ -21,6 +24,7 @@ program
|
|
|
21
24
|
}
|
|
22
25
|
});
|
|
23
26
|
registerAuth(program);
|
|
27
|
+
registerBrowser(program);
|
|
24
28
|
const agentCmd = program
|
|
25
29
|
.command("agent")
|
|
26
30
|
.description("Agent automation commands")
|
|
@@ -28,6 +32,8 @@ const agentCmd = program
|
|
|
28
32
|
const runCmd = registerRun(agentCmd);
|
|
29
33
|
registerRuns(runCmd);
|
|
30
34
|
registerBatch(agentCmd);
|
|
35
|
+
registerSearch(program);
|
|
36
|
+
registerFetch(program);
|
|
31
37
|
// Await parseAsync so async command handlers complete before the process exits
|
|
32
38
|
program.parseAsync(process.argv).catch((e) => {
|
|
33
39
|
process.stderr.write(JSON.stringify({ error: e instanceof Error ? e.message : String(e) }) + "\n");
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { type AgentRunAsyncResponse, type
|
|
2
|
-
import type { BatchCancelResponse, BatchGetResponse, BatchRunRequest, BatchRunResponse, CancelRunResponse } from "./types.js";
|
|
3
|
-
export declare function runSync(req:
|
|
4
|
-
export declare function runAsync(req:
|
|
5
|
-
export declare function runStream(req:
|
|
1
|
+
import { type AgentRunAsyncResponse, type AgentRunResponse, type AgentRunWithStreamingResponse, type FetchGetContentsParams, type FetchResponse, type BrowserSession, type BrowserSessionCreateParams, type Run, type RunListParams, type RunListResponse, type SearchQueryParams, type SearchQueryResponse } from "@tiny-fish/sdk";
|
|
2
|
+
import type { BatchCancelResponse, BatchGetResponse, BatchRunRequest, BatchRunResponse, CancelRunResponse, CliAgentRunParams } from "./types.js";
|
|
3
|
+
export declare function runSync(req: CliAgentRunParams, apiKey: string): Promise<AgentRunResponse>;
|
|
4
|
+
export declare function runAsync(req: CliAgentRunParams, apiKey: string): Promise<AgentRunAsyncResponse>;
|
|
5
|
+
export declare function runStream(req: CliAgentRunParams, apiKey: string, signal?: AbortSignal): AsyncGenerator<AgentRunWithStreamingResponse>;
|
|
6
6
|
export declare function listRuns(opts: RunListParams, apiKey: string): Promise<RunListResponse>;
|
|
7
7
|
export declare function getRun(runId: string, apiKey: string): Promise<Run>;
|
|
8
|
+
export declare function searchQuery(params: SearchQueryParams, apiKey: string): Promise<SearchQueryResponse>;
|
|
9
|
+
export declare function fetchContentGet(params: FetchGetContentsParams, apiKey: string): Promise<FetchResponse>;
|
|
10
|
+
export declare function browserSessionCreate(params: BrowserSessionCreateParams, apiKey: string): Promise<BrowserSession>;
|
|
8
11
|
export declare function cancelRun(runId: string, apiKey: string): Promise<CancelRunResponse>;
|
|
9
12
|
export declare function submitBatch(req: BatchRunRequest, apiKey: string): Promise<BatchRunResponse>;
|
|
10
13
|
export declare function getBatchRuns(runIds: string[], apiKey: string): Promise<BatchGetResponse>;
|
package/dist/lib/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIStatusError, TinyFish, runSchema, } from "@tiny-fish/sdk";
|
|
1
|
+
import { APIStatusError, fetchResponseSchema, browserSessionSchema, searchQueryResponseSchema, TinyFish, runSchema, } from "@tiny-fish/sdk";
|
|
2
2
|
import { BASE_URL } from "./constants.js";
|
|
3
3
|
import { ApiError } from "./output.js";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -115,6 +115,33 @@ export async function getRun(runId, apiKey) {
|
|
|
115
115
|
rethrowSdkError(error);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
+
export async function searchQuery(params, apiKey) {
|
|
119
|
+
try {
|
|
120
|
+
const response = await createSdkClient(apiKey).search.query(params);
|
|
121
|
+
return searchQueryResponseSchema.parse(response);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
rethrowSdkError(error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export async function fetchContentGet(params, apiKey) {
|
|
128
|
+
try {
|
|
129
|
+
const response = await createSdkClient(apiKey).fetch.getContents(params);
|
|
130
|
+
return fetchResponseSchema.parse(response);
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
rethrowSdkError(error);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
export async function browserSessionCreate(params, apiKey) {
|
|
137
|
+
try {
|
|
138
|
+
const response = await createSdkClient(apiKey).browser.sessions.create(params);
|
|
139
|
+
return browserSessionSchema.parse(response);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
rethrowSdkError(error);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
118
145
|
export async function cancelRun(runId, apiKey) {
|
|
119
146
|
try {
|
|
120
147
|
const response = await createSdkClient(apiKey).post(`/v1/runs/${encodeURIComponent(runId)}/cancel`, { json: {} });
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type { Run, RunStatus } from "@tiny-fish/sdk";
|
|
1
|
+
import type { AgentRunParams, Run, RunStatus } from "@tiny-fish/sdk";
|
|
2
|
+
export type OutputSchema = Record<string, unknown>;
|
|
3
|
+
export interface CliAgentRunParams extends AgentRunParams {
|
|
4
|
+
output_schema?: OutputSchema;
|
|
5
|
+
}
|
|
2
6
|
export interface CancelRunResponse {
|
|
3
7
|
run_id: string;
|
|
4
8
|
status: RunStatus | string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiny-fish/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5-next.47",
|
|
4
4
|
"description": "TinyFish CLI — run web automations from your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,16 @@
|
|
|
16
16
|
"test": "vitest --run",
|
|
17
17
|
"test:file": "vitest --run",
|
|
18
18
|
"test:watch": "vitest",
|
|
19
|
-
"test:integration": "vitest --run --config vitest.integration.config.ts",
|
|
19
|
+
"test:integration:auth": "vitest --run --config vitest.integration.config.ts tests/auth.integration.test.ts",
|
|
20
|
+
"test:integration:api:fetch": "vitest --run --passWithNoTests --config vitest.integration.config.ts tests/api.integration.test.ts --testNamePattern \"fetch content get|skips real API coverage when TINYFISH_API_KEY is not set\"",
|
|
21
|
+
"test:integration:api:browser": "vitest --run --passWithNoTests --config vitest.integration.config.ts tests/api.integration.test.ts --testNamePattern \"browser session create|skips real API coverage when TINYFISH_API_KEY is not set\"",
|
|
22
|
+
"test:integration:api:search": "vitest --run --passWithNoTests --config vitest.integration.config.ts tests/api.integration.test.ts --testNamePattern \"search query|skips real API coverage when TINYFISH_API_KEY is not set\"",
|
|
23
|
+
"test:integration:api:sync": "vitest --run --passWithNoTests --config vitest.integration.config.ts tests/api.integration.test.ts --testNamePattern \"agent run --sync|skips real API coverage when TINYFISH_API_KEY is not set\"",
|
|
24
|
+
"test:integration:api:stream": "vitest --run --passWithNoTests --config vitest.integration.config.ts tests/api.integration.test.ts --testNamePattern \"agent run streaming exits cleanly after COMPLETE|skips real API coverage when TINYFISH_API_KEY is not set\"",
|
|
25
|
+
"test:integration:api:async": "vitest --run --passWithNoTests --config vitest.integration.config.ts tests/api.integration.test.ts --testNamePattern \"agent run --async returns a run id that can be fetched and listed|skips real API coverage when TINYFISH_API_KEY is not set\"",
|
|
26
|
+
"test:integration:api:cancel": "vitest --run --passWithNoTests --config vitest.integration.config.ts tests/api.integration.test.ts --testNamePattern \"agent run cancel cancels an in-flight run|skips real API coverage when TINYFISH_API_KEY is not set\"",
|
|
27
|
+
"test:integration:api:batch": "vitest --run --passWithNoTests --config vitest.integration.config.ts tests/api.integration.test.ts --testNamePattern \"batch commands work end-to-end against the real API|skips real API coverage when TINYFISH_API_KEY is not set\"",
|
|
28
|
+
"test:integration": "npm run test:integration:auth && npm run test:integration:api:fetch && npm run test:integration:api:browser && npm run test:integration:api:search && npm run test:integration:api:sync && npm run test:integration:api:stream && npm run test:integration:api:async && npm run test:integration:api:cancel && npm run test:integration:api:batch",
|
|
20
29
|
"lint": "eslint src tests",
|
|
21
30
|
"format": "prettier --write src tests",
|
|
22
31
|
"type-check": "tsc --noEmit --project tsconfig.all.json",
|
|
@@ -39,6 +48,7 @@
|
|
|
39
48
|
"vitest": "^3.0.0"
|
|
40
49
|
},
|
|
41
50
|
"overrides": {
|
|
51
|
+
"vite": "7.3.2",
|
|
42
52
|
"brace-expansion": "5.0.5"
|
|
43
53
|
},
|
|
44
54
|
"engines": {
|