@tiny-fish/cli 0.1.4-next.39 → 0.1.4
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 +0 -13
- package/dist/index.js +0 -2
- package/dist/lib/client.d.ts +1 -2
- package/dist/lib/client.js +1 -10
- package/package.json +1 -1
- package/dist/commands/search.d.ts +0 -2
- package/dist/commands/search.js +0 -50
package/README.md
CHANGED
|
@@ -59,19 +59,6 @@ tinyfish agent run get <run_id> --pretty
|
|
|
59
59
|
tinyfish agent run cancel <run_id> --pretty
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
### Search
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
# Query TinyFish Search
|
|
66
|
-
tinyfish search query "agentql pricing"
|
|
67
|
-
|
|
68
|
-
# Add location and language hints
|
|
69
|
-
tinyfish search query "agentql pricing" --location US --language en
|
|
70
|
-
|
|
71
|
-
# Human-readable output
|
|
72
|
-
tinyfish search query "agentql pricing" --pretty
|
|
73
|
-
```
|
|
74
|
-
|
|
75
62
|
### Output format
|
|
76
63
|
|
|
77
64
|
By default all commands output newline-delimited JSON to stdout — pipe-friendly for agents and scripts. Add `--pretty` for human-readable output.
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { registerAuth } from "./commands/auth.js";
|
|
|
5
5
|
import { registerBatch } from "./commands/batch.js";
|
|
6
6
|
import { registerRun } from "./commands/run.js";
|
|
7
7
|
import { registerRuns } from "./commands/runs.js";
|
|
8
|
-
import { registerSearch } from "./commands/search.js";
|
|
9
8
|
const { version } = createRequire(import.meta.url)("../package.json");
|
|
10
9
|
const program = new Command();
|
|
11
10
|
program
|
|
@@ -29,7 +28,6 @@ const agentCmd = program
|
|
|
29
28
|
const runCmd = registerRun(agentCmd);
|
|
30
29
|
registerRuns(runCmd);
|
|
31
30
|
registerBatch(agentCmd);
|
|
32
|
-
registerSearch(program);
|
|
33
31
|
// Await parseAsync so async command handlers complete before the process exits
|
|
34
32
|
program.parseAsync(process.argv).catch((e) => {
|
|
35
33
|
process.stderr.write(JSON.stringify({ error: e instanceof Error ? e.message : String(e) }) + "\n");
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type AgentRunAsyncResponse, type AgentRunParams, type AgentRunResponse, type AgentRunWithStreamingResponse, type Run, type RunListParams, type RunListResponse
|
|
1
|
+
import { type AgentRunAsyncResponse, type AgentRunParams, type AgentRunResponse, type AgentRunWithStreamingResponse, type Run, type RunListParams, type RunListResponse } from "@tiny-fish/sdk";
|
|
2
2
|
import type { BatchCancelResponse, BatchGetResponse, BatchRunRequest, BatchRunResponse, CancelRunResponse } from "./types.js";
|
|
3
3
|
export declare function runSync(req: AgentRunParams, apiKey: string): Promise<AgentRunResponse>;
|
|
4
4
|
export declare function runAsync(req: AgentRunParams, apiKey: string): Promise<AgentRunAsyncResponse>;
|
|
5
5
|
export declare function runStream(req: AgentRunParams, 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
8
|
export declare function cancelRun(runId: string, apiKey: string): Promise<CancelRunResponse>;
|
|
10
9
|
export declare function submitBatch(req: BatchRunRequest, apiKey: string): Promise<BatchRunResponse>;
|
|
11
10
|
export declare function getBatchRuns(runIds: string[], apiKey: string): Promise<BatchGetResponse>;
|
package/dist/lib/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIStatusError,
|
|
1
|
+
import { APIStatusError, 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,15 +115,6 @@ 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
118
|
export async function cancelRun(runId, apiKey) {
|
|
128
119
|
try {
|
|
129
120
|
const response = await createSdkClient(apiKey).post(`/v1/runs/${encodeURIComponent(runId)}/cancel`, { json: {} });
|
package/package.json
CHANGED
package/dist/commands/search.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
}
|