@tiny-fish/sdk 0.0.1

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.
Files changed (62) hide show
  1. package/README.md +5 -0
  2. package/dist/_utils/client.d.ts +40 -0
  3. package/dist/_utils/client.d.ts.map +1 -0
  4. package/dist/_utils/client.js +168 -0
  5. package/dist/_utils/client.js.map +1 -0
  6. package/dist/_utils/errors.d.ts +109 -0
  7. package/dist/_utils/errors.d.ts.map +1 -0
  8. package/dist/_utils/errors.js +123 -0
  9. package/dist/_utils/errors.js.map +1 -0
  10. package/dist/_utils/index.d.ts +15 -0
  11. package/dist/_utils/index.d.ts.map +1 -0
  12. package/dist/_utils/index.js +14 -0
  13. package/dist/_utils/index.js.map +1 -0
  14. package/dist/_utils/resource.d.ts +6 -0
  15. package/dist/_utils/resource.d.ts.map +1 -0
  16. package/dist/_utils/resource.js +7 -0
  17. package/dist/_utils/resource.js.map +1 -0
  18. package/dist/_utils/sse.d.ts +15 -0
  19. package/dist/_utils/sse.d.ts.map +1 -0
  20. package/dist/_utils/sse.js +62 -0
  21. package/dist/_utils/sse.js.map +1 -0
  22. package/dist/agent/index.d.ts +47 -0
  23. package/dist/agent/index.d.ts.map +1 -0
  24. package/dist/agent/index.js +168 -0
  25. package/dist/agent/index.js.map +1 -0
  26. package/dist/agent/types.d.ts +163 -0
  27. package/dist/agent/types.d.ts.map +1 -0
  28. package/dist/agent/types.js +61 -0
  29. package/dist/agent/types.js.map +1 -0
  30. package/dist/client.d.ts +13 -0
  31. package/dist/client.d.ts.map +1 -0
  32. package/dist/client.js +16 -0
  33. package/dist/client.js.map +1 -0
  34. package/dist/index.d.ts +13 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +15 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/runs/index.d.ts +25 -0
  39. package/dist/runs/index.d.ts.map +1 -0
  40. package/dist/runs/index.js +47 -0
  41. package/dist/runs/index.js.map +1 -0
  42. package/dist/runs/types.d.ts +75 -0
  43. package/dist/runs/types.d.ts.map +1 -0
  44. package/dist/runs/types.js +10 -0
  45. package/dist/runs/types.js.map +1 -0
  46. package/dist/version.d.ts +2 -0
  47. package/dist/version.d.ts.map +1 -0
  48. package/dist/version.js +3 -0
  49. package/dist/version.js.map +1 -0
  50. package/package.json +43 -0
  51. package/src/_utils/client.ts +219 -0
  52. package/src/_utils/errors.ts +153 -0
  53. package/src/_utils/index.ts +31 -0
  54. package/src/_utils/resource.ts +9 -0
  55. package/src/_utils/sse.ts +72 -0
  56. package/src/agent/index.ts +210 -0
  57. package/src/agent/types.ts +190 -0
  58. package/src/client.ts +19 -0
  59. package/src/index.ts +64 -0
  60. package/src/runs/index.ts +47 -0
  61. package/src/runs/types.ts +81 -0
  62. package/src/version.ts +2 -0
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Browser automation resource.
3
+ */
4
+
5
+ import { APIResource } from "../_utils/resource.js";
6
+ import { parseSSEStream } from "../_utils/sse.js";
7
+ import type {
8
+ AgentRunAsyncResponse,
9
+ AgentRunParams,
10
+ AgentRunResponse,
11
+ AgentRunWithStreamingResponse,
12
+ BrowserProfile,
13
+ CompleteEvent,
14
+ HeartbeatEvent,
15
+ ProgressEvent,
16
+ ProxyConfig,
17
+ RunError,
18
+ RunStatus,
19
+ StartedEvent,
20
+ StreamOptions,
21
+ StreamingUrlEvent,
22
+ } from "./types.js";
23
+
24
+ /** JSON body sent to automation endpoints. */
25
+ interface AgentRunBody {
26
+ goal: string;
27
+ url: string;
28
+ browser_profile?: BrowserProfile;
29
+ proxy_config?: ProxyConfig;
30
+ }
31
+
32
+ /**
33
+ * Build the JSON request body from typed params.
34
+ * Optional fields are omitted rather than sent as undefined/null.
35
+ */
36
+ function buildRunBody(params: AgentRunParams): AgentRunBody {
37
+ const body: AgentRunBody = { goal: params.goal, url: params.url };
38
+ if (params.browser_profile !== undefined) body.browser_profile = params.browser_profile;
39
+ if (params.proxy_config !== undefined) body.proxy_config = params.proxy_config;
40
+ return body;
41
+ }
42
+
43
+ /** Async-iterable wrapper around an SSE event stream, this is what we return when they call the stream endpoint */
44
+ export class AgentStream {
45
+ private _generator: AsyncGenerator<AgentRunWithStreamingResponse>;
46
+
47
+ constructor(generator: AsyncGenerator<AgentRunWithStreamingResponse>) {
48
+ this._generator = generator;
49
+ }
50
+
51
+ [Symbol.asyncIterator](): AsyncGenerator<AgentRunWithStreamingResponse> {
52
+ return this._generator;
53
+ }
54
+
55
+ /** Abort the underlying stream. */
56
+ async close(): Promise<void> {
57
+ await this._generator.return(undefined);
58
+ }
59
+ }
60
+
61
+ /** Validate raw SSE data into a typed event. Returns null for malformed or unknown events. */
62
+ function validateEvent(data: Record<string, unknown>): AgentRunWithStreamingResponse | null {
63
+ const type = data["type"];
64
+ if (typeof type !== "string") return null;
65
+
66
+ switch (type) {
67
+ case "STARTED": {
68
+ if (typeof data["runId"] !== "string" || typeof data["timestamp"] !== "string") return null;
69
+ return { type: "STARTED", runId: data["runId"], timestamp: data["timestamp"] };
70
+ }
71
+ case "STREAMING_URL": {
72
+ if (
73
+ typeof data["runId"] !== "string" ||
74
+ typeof data["streamingUrl"] !== "string" ||
75
+ typeof data["timestamp"] !== "string"
76
+ )
77
+ return null;
78
+ return {
79
+ type: "STREAMING_URL",
80
+ runId: data["runId"],
81
+ streamingUrl: data["streamingUrl"],
82
+ timestamp: data["timestamp"],
83
+ };
84
+ }
85
+ case "PROGRESS": {
86
+ if (
87
+ typeof data["runId"] !== "string" ||
88
+ typeof data["purpose"] !== "string" ||
89
+ typeof data["timestamp"] !== "string"
90
+ )
91
+ return null;
92
+ return {
93
+ type: "PROGRESS",
94
+ runId: data["runId"],
95
+ purpose: data["purpose"],
96
+ timestamp: data["timestamp"],
97
+ };
98
+ }
99
+ case "HEARTBEAT": {
100
+ if (typeof data["timestamp"] !== "string") return null;
101
+ return { type: "HEARTBEAT", timestamp: data["timestamp"] };
102
+ }
103
+ case "COMPLETE": {
104
+ if (
105
+ typeof data["runId"] !== "string" ||
106
+ typeof data["status"] !== "string" ||
107
+ typeof data["timestamp"] !== "string"
108
+ )
109
+ return null;
110
+ return {
111
+ type: "COMPLETE",
112
+ runId: data["runId"],
113
+ status: data["status"] as RunStatus,
114
+ timestamp: data["timestamp"],
115
+ resultJson: (data["resultJson"] as Record<string, unknown> | null) ?? null,
116
+ error: (data["error"] as RunError | null) ?? null,
117
+ };
118
+ }
119
+ default:
120
+ return null;
121
+ }
122
+ }
123
+
124
+ /** Validate raw event data, fire the matching callback, and return the typed event. */
125
+ function dispatchEvent(
126
+ data: Record<string, unknown>,
127
+ options: StreamOptions,
128
+ ): AgentRunWithStreamingResponse | null {
129
+ const event = validateEvent(data);
130
+ if (!event) return null;
131
+
132
+ switch (event.type) {
133
+ case "STARTED":
134
+ options.onStarted?.(event);
135
+ break;
136
+ case "STREAMING_URL":
137
+ options.onStreamingUrl?.(event);
138
+ break;
139
+ case "PROGRESS":
140
+ options.onProgress?.(event);
141
+ break;
142
+ case "HEARTBEAT":
143
+ options.onHeartbeat?.(event);
144
+ break;
145
+ case "COMPLETE":
146
+ options.onComplete?.(event);
147
+ break;
148
+ }
149
+
150
+ return event;
151
+ }
152
+
153
+ /** Browser automation methods. */
154
+ export class AgentResource extends APIResource {
155
+ /**
156
+ * Run a browser automation.
157
+ *
158
+ * Returns a promise that resolves with the completed agent run output.
159
+ */
160
+ async run(params: AgentRunParams): Promise<AgentRunResponse> {
161
+ return this._client.post<AgentRunResponse>("/v1/automation/run", {
162
+ json: buildRunBody(params),
163
+ });
164
+ }
165
+
166
+ /**
167
+ * Queue a browser automation and return immediately.
168
+ *
169
+ * Does not wait for the run to complete — returns a `run_id` straight away.
170
+ * Use `client.runs.get(run_id)` to poll for the result.
171
+ */
172
+ async queue(params: AgentRunParams): Promise<AgentRunAsyncResponse> {
173
+ return this._client.post<AgentRunAsyncResponse>("/v1/automation/run-async", {
174
+ json: buildRunBody(params),
175
+ });
176
+ }
177
+
178
+ /**
179
+ * Stream live events from a browser automation run.
180
+ *
181
+ * Returns an `AgentStream` that yields typed SSE events in real time:
182
+ * STARTED → STREAMING_URL → PROGRESS (repeated) → COMPLETE.
183
+ *
184
+ * Use the `on*` callbacks for a reactive style, or iterate over
185
+ * the stream for a sequential style:
186
+ *
187
+ * ```ts
188
+ * const stream = await client.agent.stream({ goal: "...", url: "..." });
189
+ * for await (const event of stream) {
190
+ * if (event.type === "PROGRESS") console.log(event.purpose);
191
+ * }
192
+ * ```
193
+ */
194
+ async stream(params: AgentRunParams, options: StreamOptions = {}): Promise<AgentStream> {
195
+ const raw = await this._client.postStream("/v1/automation/run-sse", {
196
+ json: buildRunBody(params),
197
+ });
198
+
199
+ async function* generate(): AsyncGenerator<AgentRunWithStreamingResponse> {
200
+ for await (const data of parseSSEStream(raw)) {
201
+ const event = dispatchEvent(data, options);
202
+ if (event) {
203
+ yield event;
204
+ }
205
+ }
206
+ }
207
+
208
+ return new AgentStream(generate());
209
+ }
210
+ }
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Agent automation request/response types.
3
+ */
4
+
5
+ // -- Input types --
6
+
7
+ /** Browser profile for execution. */
8
+ export enum BrowserProfile {
9
+ LITE = "lite",
10
+ STEALTH = "stealth",
11
+ }
12
+
13
+ /** ISO 3166-1 alpha-2 country code for proxy location. */
14
+ export enum ProxyCountryCode {
15
+ US = "US",
16
+ GB = "GB",
17
+ CA = "CA",
18
+ DE = "DE",
19
+ FR = "FR",
20
+ JP = "JP",
21
+ AU = "AU",
22
+ }
23
+
24
+ /** Proxy configuration for browser automation. */
25
+ export interface ProxyConfig {
26
+ /** Enable proxy for this automation run. */
27
+ enabled: boolean;
28
+ /** ISO 3166-1 alpha-2 country code for proxy location. */
29
+ country_code?: ProxyCountryCode;
30
+ }
31
+
32
+ /** Parameters for a synchronous agent run. */
33
+ export interface AgentRunParams {
34
+ /** Natural language description of what to do on the page. */
35
+ goal: string;
36
+ /** The URL to open the browser on. */
37
+ url: string;
38
+ /** `"lite"` (default) or `"stealth"` (anti-detection). */
39
+ browser_profile?: BrowserProfile;
40
+ /** Optional proxy settings. */
41
+ proxy_config?: ProxyConfig;
42
+ }
43
+
44
+ // -- Response types (shared with runs later) --
45
+
46
+ /**
47
+ * Status of an automation run.
48
+ *
49
+ * Use these constants instead of raw strings when filtering or branching
50
+ * on run status — your IDE will autocomplete the options and typos become
51
+ * type errors.
52
+ */
53
+ export enum RunStatus {
54
+ PENDING = "PENDING",
55
+ RUNNING = "RUNNING",
56
+ COMPLETED = "COMPLETED",
57
+ FAILED = "FAILED",
58
+ CANCELLED = "CANCELLED",
59
+ }
60
+
61
+ /**
62
+ * Error category indicating the source of failure.
63
+ *
64
+ * - `SYSTEM_FAILURE` — TinyFish infrastructure issue, safe to retry.
65
+ * - `AGENT_FAILURE` — Problem with the run itself, fix the input.
66
+ * - `UNKNOWN` — Unclassified, treat as retryable.
67
+ */
68
+ export enum ErrorCategory {
69
+ SYSTEM_FAILURE = "SYSTEM_FAILURE",
70
+ AGENT_FAILURE = "AGENT_FAILURE",
71
+ UNKNOWN = "UNKNOWN",
72
+ }
73
+
74
+ /** Error details for failed runs. */
75
+ export interface RunError {
76
+ /** Error message describing why the run failed. */
77
+ message: string;
78
+ /** Error category indicating the source of failure. */
79
+ category: ErrorCategory;
80
+ /** Suggested retry delay in whole seconds (integer). */
81
+ retry_after: number | null;
82
+ /** URL to troubleshooting docs. */
83
+ help_url?: string;
84
+ /** Human-readable guidance. */
85
+ help_message?: string;
86
+ }
87
+
88
+ /**
89
+ * Response from synchronous automation execution.
90
+ *
91
+ * Check `status` to determine success/failure:
92
+ * - On success: `result` is populated, `error` is `null`.
93
+ * - On failure: `result` is `null`, `error` contains the message.
94
+ */
95
+ export interface AgentRunResponse {
96
+ /** Final status of the automation run. */
97
+ status: RunStatus;
98
+ /** Unique identifier for the automation run. */
99
+ run_id: string | null;
100
+ /** Structured JSON result extracted from the automation. `null` if the run failed. */
101
+ result: Record<string, unknown> | null;
102
+ /** Error details. `null` if the run succeeded. */
103
+ error: RunError | null;
104
+ /** Number of steps taken during the automation. */
105
+ num_of_steps: number;
106
+ /** ISO 8601 timestamp when the run started. */
107
+ started_at: string | null;
108
+ /** ISO 8601 timestamp when the run finished. */
109
+ finished_at: string | null;
110
+ }
111
+
112
+ /**
113
+ * Response from asynchronous automation execution.
114
+ *
115
+ * Returns `run_id` immediately without waiting for completion.
116
+ * Use `client.runs.get(run_id)` to check status later.
117
+ */
118
+ export interface AgentRunAsyncResponse {
119
+ /** Unique identifier for the created automation run. */
120
+ run_id: string | null;
121
+ /** Error details. `null` if successful. */
122
+ error: RunError | null;
123
+ }
124
+
125
+ // -- SSE streaming event types --
126
+
127
+ /** SSE event type discriminator. */
128
+ export enum EventType {
129
+ STARTED = "STARTED",
130
+ STREAMING_URL = "STREAMING_URL",
131
+ PROGRESS = "PROGRESS",
132
+ HEARTBEAT = "HEARTBEAT",
133
+ COMPLETE = "COMPLETE",
134
+ }
135
+
136
+ /** SSE event indicating the automation run has started. */
137
+ export interface StartedEvent {
138
+ type: "STARTED";
139
+ runId: string;
140
+ timestamp: string;
141
+ }
142
+
143
+ /** SSE event providing the live browser streaming URL. */
144
+ export interface StreamingUrlEvent {
145
+ type: "STREAMING_URL";
146
+ runId: string;
147
+ streamingUrl: string;
148
+ timestamp: string;
149
+ }
150
+
151
+ /** SSE event indicating automation progress/activity. */
152
+ export interface ProgressEvent {
153
+ type: "PROGRESS";
154
+ runId: string;
155
+ purpose: string;
156
+ timestamp: string;
157
+ }
158
+
159
+ /** SSE event for connection keepalive. */
160
+ export interface HeartbeatEvent {
161
+ type: "HEARTBEAT";
162
+ timestamp: string;
163
+ }
164
+
165
+ /** SSE event indicating the automation run has completed. */
166
+ export interface CompleteEvent {
167
+ type: "COMPLETE";
168
+ runId: string;
169
+ status: RunStatus;
170
+ timestamp: string;
171
+ resultJson: Record<string, unknown> | null;
172
+ error: RunError | null;
173
+ }
174
+
175
+ /** Union type for all possible SSE streaming events. */
176
+ export type AgentRunWithStreamingResponse =
177
+ | StartedEvent
178
+ | StreamingUrlEvent
179
+ | ProgressEvent
180
+ | HeartbeatEvent
181
+ | CompleteEvent;
182
+
183
+ /** Optional callbacks for stream events. */
184
+ export interface StreamOptions {
185
+ onStarted?: (event: StartedEvent) => void;
186
+ onStreamingUrl?: (event: StreamingUrlEvent) => void;
187
+ onProgress?: (event: ProgressEvent) => void;
188
+ onHeartbeat?: (event: HeartbeatEvent) => void;
189
+ onComplete?: (event: CompleteEvent) => void;
190
+ }
package/src/client.ts ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * TinyFish TypeScript SDK client.
3
+ */
4
+
5
+ import { BaseClient } from "./_utils/client.js";
6
+ import type { ClientOptions } from "./_utils/client.js";
7
+ import { AgentResource } from "./agent/index.js";
8
+ import { RunsResource } from "./runs/index.js";
9
+
10
+ export class TinyFish extends BaseClient {
11
+ readonly agent: AgentResource;
12
+ readonly runs: RunsResource;
13
+
14
+ constructor(options?: ClientOptions) {
15
+ super(options);
16
+ this.agent = new AgentResource(this);
17
+ this.runs = new RunsResource(this);
18
+ }
19
+ }
package/src/index.ts ADDED
@@ -0,0 +1,64 @@
1
+ /**
2
+ * TinyFish TypeScript SDK — State-of-the-art web agents in an API.
3
+ */
4
+
5
+ export { VERSION } from "./version.js";
6
+ export type { ClientOptions } from "./_utils/client.js";
7
+
8
+ // Client
9
+ export { TinyFish } from "./client.js";
10
+
11
+ // Resources
12
+ export { AgentStream } from "./agent/index.js";
13
+
14
+ // Agent types
15
+ export {
16
+ BrowserProfile,
17
+ ProxyCountryCode,
18
+ RunStatus,
19
+ ErrorCategory,
20
+ EventType,
21
+ } from "./agent/types.js";
22
+ export type {
23
+ ProxyConfig,
24
+ AgentRunParams,
25
+ AgentRunResponse,
26
+ AgentRunAsyncResponse,
27
+ RunError,
28
+ StartedEvent,
29
+ StreamingUrlEvent,
30
+ ProgressEvent,
31
+ HeartbeatEvent,
32
+ CompleteEvent,
33
+ AgentRunWithStreamingResponse,
34
+ StreamOptions,
35
+ } from "./agent/types.js";
36
+
37
+ // Runs types
38
+ export { SortDirection } from "./runs/types.js";
39
+ export type {
40
+ BrowserConfig,
41
+ Run,
42
+ PaginationInfo,
43
+ RunListResponse,
44
+ RunListParams,
45
+ } from "./runs/types.js";
46
+
47
+ // Error hierarchy
48
+ export {
49
+ SDKError,
50
+ SSEParseError,
51
+ APIError,
52
+ APIConnectionError,
53
+ APITimeoutError,
54
+ APIStatusError,
55
+ BadRequestError,
56
+ AuthenticationError,
57
+ PermissionDeniedError,
58
+ NotFoundError,
59
+ RequestTimeoutError,
60
+ ConflictError,
61
+ UnprocessableEntityError,
62
+ RateLimitError,
63
+ InternalServerError,
64
+ } from "./_utils/errors.js";
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Runs resource for retrieving and listing automation runs.
3
+ */
4
+
5
+ import { APIResource } from "../_utils/resource.js";
6
+ import type { Run, RunListParams, RunListResponse } from "./types.js";
7
+
8
+ /** Retrieve and list automation runs. */
9
+ export class RunsResource extends APIResource {
10
+ /**
11
+ * Retrieve a single run by its ID.
12
+ *
13
+ * Returns a promise that resolves with the full run details
14
+ * including status, result, error, and browser configuration.
15
+ *
16
+ * @param runId - The run ID returned by `agent.queue()` or any run response.
17
+ */
18
+ async get(runId: string): Promise<Run> {
19
+ if (typeof runId !== "string" || !runId.trim()) {
20
+ throw new Error("run_id must be a non-empty string");
21
+ }
22
+ return this._client.get<Run>(`/v1/runs/${encodeURIComponent(runId)}`);
23
+ }
24
+
25
+ /**
26
+ * List automation runs, with optional filtering and pagination.
27
+ *
28
+ * Returns a promise that resolves with a paginated list of runs
29
+ * and pagination info (total count, next cursor).
30
+ */
31
+ async list(params: RunListParams = {}): Promise<RunListResponse> {
32
+ const queryParams: Record<string, string | number | boolean> = {};
33
+ if (params.cursor !== undefined) queryParams["cursor"] = params.cursor;
34
+ if (params.limit !== undefined) queryParams["limit"] = params.limit;
35
+ if (params.status !== undefined) queryParams["status"] = params.status;
36
+ if (params.goal !== undefined) queryParams["goal"] = params.goal;
37
+ if (params.created_after !== undefined) queryParams["created_after"] = params.created_after;
38
+ if (params.created_before !== undefined) queryParams["created_before"] = params.created_before;
39
+ if (params.sort_direction !== undefined) queryParams["sort_direction"] = params.sort_direction;
40
+
41
+ const hasParams = Object.keys(queryParams).length > 0;
42
+ return this._client.get<RunListResponse>(
43
+ "/v1/runs",
44
+ hasParams ? { params: queryParams } : undefined,
45
+ );
46
+ }
47
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Runs management request/response types.
3
+ */
4
+
5
+ import type { RunError, RunStatus } from "../agent/types.js";
6
+
7
+ /** Sort order for list queries. */
8
+ export enum SortDirection {
9
+ ASC = "asc",
10
+ DESC = "desc",
11
+ }
12
+
13
+ /** Browser configuration used for a run. */
14
+ export interface BrowserConfig {
15
+ /** Whether proxy was enabled. */
16
+ proxy_enabled: boolean | null;
17
+ /** Country code for proxy. */
18
+ proxy_country_code: string | null;
19
+ }
20
+
21
+ /** A single automation run with full details. */
22
+ export interface Run {
23
+ /** Unique identifier for the run. */
24
+ run_id: string;
25
+ /** Current status of the run. */
26
+ status: RunStatus;
27
+ /** Natural language goal for this automation run. */
28
+ goal: string;
29
+ /** ISO 8601 timestamp when run was created. */
30
+ created_at: string;
31
+ /** ISO 8601 timestamp when run started executing. */
32
+ started_at: string | null;
33
+ /** ISO 8601 timestamp when run finished executing. */
34
+ finished_at: string | null;
35
+ /** Number of steps taken during the automation. */
36
+ num_of_steps: number;
37
+ /** Extracted data from the automation run. `null` if not completed or failed. */
38
+ result: Record<string, unknown> | null;
39
+ /** Error details. `null` if the run succeeded or is still running. */
40
+ error: RunError | null;
41
+ /** URL to watch live browser session (available while running). */
42
+ streaming_url: string | null;
43
+ /** Browser configuration used for the run. */
44
+ browser_config: BrowserConfig | null;
45
+ }
46
+
47
+ /** Pagination metadata for list responses. */
48
+ export interface PaginationInfo {
49
+ /** Total number of runs matching the current filters. */
50
+ total: number;
51
+ /** Whether there are more results after this page. */
52
+ has_more: boolean;
53
+ /** Cursor for fetching next page. `null` if no more results. */
54
+ next_cursor: string | null;
55
+ }
56
+
57
+ /** Paginated list of automation runs. */
58
+ export interface RunListResponse {
59
+ /** Array of runs. */
60
+ data: Run[];
61
+ /** Pagination information. */
62
+ pagination: PaginationInfo;
63
+ }
64
+
65
+ /** Parameters for listing runs. */
66
+ export interface RunListParams {
67
+ /** Pagination cursor from a previous response's `next_cursor` field. */
68
+ cursor?: string;
69
+ /** Maximum number of runs to return. */
70
+ limit?: number;
71
+ /** Filter by run status. */
72
+ status?: RunStatus;
73
+ /** Filter by goal text. */
74
+ goal?: string;
75
+ /** Filter runs created after this ISO timestamp. */
76
+ created_after?: string;
77
+ /** Filter runs created before this ISO timestamp. */
78
+ created_before?: string;
79
+ /** Sort order — `"asc"` or `"desc"`. */
80
+ sort_direction?: SortDirection;
81
+ }
package/src/version.ts ADDED
@@ -0,0 +1,2 @@
1
+ // Auto-generated by scripts/generate-version.ts — do not edit manually.
2
+ export const VERSION = "0.0.1";