@tabstack/sdk 2.0.0 → 2.2.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/CHANGELOG.md +55 -0
- package/README.md +2 -2
- package/client.d.mts +3 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -2
- package/client.d.ts.map +1 -1
- package/client.js +8 -2
- package/client.js.map +1 -1
- package/client.mjs +9 -3
- package/client.mjs.map +1 -1
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agent.d.mts +83 -3
- package/resources/agent.d.mts.map +1 -1
- package/resources/agent.d.ts +83 -3
- package/resources/agent.d.ts.map +1 -1
- package/resources/agent.js +45 -2
- package/resources/agent.js.map +1 -1
- package/resources/agent.mjs +45 -2
- package/resources/agent.mjs.map +1 -1
- package/resources/extract.d.mts +90 -1
- package/resources/extract.d.mts.map +1 -1
- package/resources/extract.d.ts +90 -1
- package/resources/extract.d.ts.map +1 -1
- package/resources/extract.js +25 -1
- package/resources/extract.js.map +1 -1
- package/resources/extract.mjs +25 -1
- package/resources/extract.mjs.map +1 -1
- package/resources/generate.d.mts +35 -1
- package/resources/generate.d.mts.map +1 -1
- package/resources/generate.d.ts +35 -1
- package/resources/generate.d.ts.map +1 -1
- package/resources/generate.js +19 -1
- package/resources/generate.js.map +1 -1
- package/resources/generate.mjs +19 -1
- package/resources/generate.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/src/client.ts +19 -4
- package/src/core/streaming.ts +2 -2
- package/src/internal/parse.ts +6 -0
- package/src/resources/agent.ts +104 -3
- package/src/resources/extract.ts +102 -1
- package/src/resources/generate.ts +37 -1
- package/src/resources/index.ts +7 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/resources/agent.ts
CHANGED
|
@@ -8,14 +8,19 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
8
8
|
|
|
9
9
|
export class Agent extends APIResource {
|
|
10
10
|
/**
|
|
11
|
-
* Execute AI-powered browser automation tasks using natural language
|
|
12
|
-
* endpoint **always streams** responses using Server-Sent
|
|
11
|
+
* Execute AI-powered browser automation tasks using natural language with optional
|
|
12
|
+
* geotargeting. This endpoint **always streams** responses using Server-Sent
|
|
13
|
+
* Events (SSE).
|
|
13
14
|
*
|
|
14
15
|
* **Streaming Response:**
|
|
15
16
|
*
|
|
16
17
|
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
17
18
|
* - Real-time progress updates and results as they're generated
|
|
18
19
|
*
|
|
20
|
+
* **Geotargeting:**
|
|
21
|
+
*
|
|
22
|
+
* - Optionally specify a country code for geotargeted browsing
|
|
23
|
+
*
|
|
19
24
|
* **Use Cases:**
|
|
20
25
|
*
|
|
21
26
|
* - Web scraping and data extraction
|
|
@@ -42,6 +47,45 @@ export class Agent extends APIResource {
|
|
|
42
47
|
stream: true,
|
|
43
48
|
}) as APIPromise<Stream<AutomateEvent>>;
|
|
44
49
|
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
53
|
+
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
54
|
+
* using Server-Sent Events (SSE).
|
|
55
|
+
*
|
|
56
|
+
* **Streaming Response:**
|
|
57
|
+
*
|
|
58
|
+
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
59
|
+
* - Real-time progress updates as research progresses through phases
|
|
60
|
+
*
|
|
61
|
+
* **Research Modes:**
|
|
62
|
+
*
|
|
63
|
+
* - `fast` - Quick answers with minimal web searches
|
|
64
|
+
* - `balanced` - Standard research with multiple iterations (default)
|
|
65
|
+
*
|
|
66
|
+
* **Use Cases:**
|
|
67
|
+
*
|
|
68
|
+
* - Answering complex questions with cited sources
|
|
69
|
+
* - Synthesizing information from multiple web sources
|
|
70
|
+
* - Research reports on specific topics
|
|
71
|
+
* - Fact-checking and verification tasks
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const researchEvent = await client.agent.research({
|
|
76
|
+
* query:
|
|
77
|
+
* 'What are the latest developments in quantum computing?',
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
research(body: AgentResearchParams, options?: RequestOptions): APIPromise<Stream<ResearchEvent>> {
|
|
82
|
+
return this._client.post('/research', {
|
|
83
|
+
body,
|
|
84
|
+
...options,
|
|
85
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
86
|
+
stream: true,
|
|
87
|
+
}) as APIPromise<Stream<ResearchEvent>>;
|
|
88
|
+
}
|
|
45
89
|
}
|
|
46
90
|
|
|
47
91
|
export interface AutomateEvent {
|
|
@@ -56,6 +100,18 @@ export interface AutomateEvent {
|
|
|
56
100
|
event?: string;
|
|
57
101
|
}
|
|
58
102
|
|
|
103
|
+
export interface ResearchEvent {
|
|
104
|
+
/**
|
|
105
|
+
* Event payload data
|
|
106
|
+
*/
|
|
107
|
+
data?: unknown;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The event type: phase, progress, complete, or error
|
|
111
|
+
*/
|
|
112
|
+
event?: 'phase' | 'progress' | 'complete' | 'error';
|
|
113
|
+
}
|
|
114
|
+
|
|
59
115
|
export interface AgentAutomateParams {
|
|
60
116
|
/**
|
|
61
117
|
* The task description in natural language
|
|
@@ -67,6 +123,11 @@ export interface AgentAutomateParams {
|
|
|
67
123
|
*/
|
|
68
124
|
data?: unknown;
|
|
69
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Optional geotargeting parameters for proxy requests
|
|
128
|
+
*/
|
|
129
|
+
geo_target?: AgentAutomateParams.GeoTarget;
|
|
130
|
+
|
|
70
131
|
/**
|
|
71
132
|
* Safety constraints for execution
|
|
72
133
|
*/
|
|
@@ -88,6 +149,46 @@ export interface AgentAutomateParams {
|
|
|
88
149
|
url?: string;
|
|
89
150
|
}
|
|
90
151
|
|
|
152
|
+
export namespace AgentAutomateParams {
|
|
153
|
+
/**
|
|
154
|
+
* Optional geotargeting parameters for proxy requests
|
|
155
|
+
*/
|
|
156
|
+
export interface GeoTarget {
|
|
157
|
+
/**
|
|
158
|
+
* Country code using ISO 3166-1 alpha-2 standard (2 letters, e.g., "US", "GB",
|
|
159
|
+
* "JP"). See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
160
|
+
*/
|
|
161
|
+
country?: string;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface AgentResearchParams {
|
|
166
|
+
/**
|
|
167
|
+
* The research query or question to answer
|
|
168
|
+
*/
|
|
169
|
+
query: string;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Timeout in seconds for fetching web pages
|
|
173
|
+
*/
|
|
174
|
+
fetch_timeout?: number;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Research mode: fast (quick answers), balanced (standard research, default)
|
|
178
|
+
*/
|
|
179
|
+
mode?: 'fast' | 'balanced';
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Skip cache and force fresh research
|
|
183
|
+
*/
|
|
184
|
+
nocache?: boolean;
|
|
185
|
+
}
|
|
186
|
+
|
|
91
187
|
export declare namespace Agent {
|
|
92
|
-
export {
|
|
188
|
+
export {
|
|
189
|
+
type AutomateEvent as AutomateEvent,
|
|
190
|
+
type ResearchEvent as ResearchEvent,
|
|
191
|
+
type AgentAutomateParams as AgentAutomateParams,
|
|
192
|
+
type AgentResearchParams as AgentResearchParams,
|
|
193
|
+
};
|
|
93
194
|
}
|
package/src/resources/extract.ts
CHANGED
|
@@ -11,7 +11,31 @@ export class Extract extends APIResource {
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
|
13
13
|
* const response = await client.extract.json({
|
|
14
|
-
* json_schema: {
|
|
14
|
+
* json_schema: {
|
|
15
|
+
* properties: {
|
|
16
|
+
* stories: {
|
|
17
|
+
* items: {
|
|
18
|
+
* properties: {
|
|
19
|
+
* author: {
|
|
20
|
+
* description: 'Author username',
|
|
21
|
+
* type: 'string',
|
|
22
|
+
* },
|
|
23
|
+
* points: {
|
|
24
|
+
* description: 'Story points',
|
|
25
|
+
* type: 'number',
|
|
26
|
+
* },
|
|
27
|
+
* title: {
|
|
28
|
+
* description: 'Story title',
|
|
29
|
+
* type: 'string',
|
|
30
|
+
* },
|
|
31
|
+
* },
|
|
32
|
+
* type: 'object',
|
|
33
|
+
* },
|
|
34
|
+
* type: 'array',
|
|
35
|
+
* },
|
|
36
|
+
* },
|
|
37
|
+
* type: 'object',
|
|
38
|
+
* },
|
|
15
39
|
* url: 'https://news.ycombinator.com',
|
|
16
40
|
* });
|
|
17
41
|
* ```
|
|
@@ -65,6 +89,16 @@ export namespace ExtractMarkdownResponse {
|
|
|
65
89
|
*/
|
|
66
90
|
author?: string;
|
|
67
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Document creation date (ISO 8601)
|
|
94
|
+
*/
|
|
95
|
+
created_at?: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Creator application (e.g., "Microsoft Word")
|
|
99
|
+
*/
|
|
100
|
+
creator?: string;
|
|
101
|
+
|
|
68
102
|
/**
|
|
69
103
|
* Page description from Open Graph or HTML
|
|
70
104
|
*/
|
|
@@ -75,6 +109,31 @@ export namespace ExtractMarkdownResponse {
|
|
|
75
109
|
*/
|
|
76
110
|
image?: string;
|
|
77
111
|
|
|
112
|
+
/**
|
|
113
|
+
* PDF keywords as array
|
|
114
|
+
*/
|
|
115
|
+
keywords?: Array<string>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Document modification date (ISO 8601)
|
|
119
|
+
*/
|
|
120
|
+
modified_at?: string;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Number of pages (PDF documents)
|
|
124
|
+
*/
|
|
125
|
+
page_count?: number;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* PDF version (e.g., "1.5")
|
|
129
|
+
*/
|
|
130
|
+
pdf_version?: string;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* PDF producer software (e.g., "Adobe PDF Library")
|
|
134
|
+
*/
|
|
135
|
+
producer?: string;
|
|
136
|
+
|
|
78
137
|
/**
|
|
79
138
|
* Publisher information from Open Graph
|
|
80
139
|
*/
|
|
@@ -85,6 +144,12 @@ export namespace ExtractMarkdownResponse {
|
|
|
85
144
|
*/
|
|
86
145
|
site_name?: string;
|
|
87
146
|
|
|
147
|
+
/**
|
|
148
|
+
* PDF-specific metadata fields (populated for PDF documents) PDF subject or
|
|
149
|
+
* summary
|
|
150
|
+
*/
|
|
151
|
+
subject?: string;
|
|
152
|
+
|
|
88
153
|
/**
|
|
89
154
|
* Page title from Open Graph or HTML
|
|
90
155
|
*/
|
|
@@ -113,18 +178,41 @@ export interface ExtractJsonParams {
|
|
|
113
178
|
*/
|
|
114
179
|
url: string;
|
|
115
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Optional geotargeting parameters for proxy requests
|
|
183
|
+
*/
|
|
184
|
+
geo_target?: ExtractJsonParams.GeoTarget;
|
|
185
|
+
|
|
116
186
|
/**
|
|
117
187
|
* Bypass cache and force fresh data retrieval
|
|
118
188
|
*/
|
|
119
189
|
nocache?: boolean;
|
|
120
190
|
}
|
|
121
191
|
|
|
192
|
+
export namespace ExtractJsonParams {
|
|
193
|
+
/**
|
|
194
|
+
* Optional geotargeting parameters for proxy requests
|
|
195
|
+
*/
|
|
196
|
+
export interface GeoTarget {
|
|
197
|
+
/**
|
|
198
|
+
* Country code using ISO 3166-1 alpha-2 standard (2 letters, e.g., "US", "GB",
|
|
199
|
+
* "JP"). See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
200
|
+
*/
|
|
201
|
+
country?: string;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
122
205
|
export interface ExtractMarkdownParams {
|
|
123
206
|
/**
|
|
124
207
|
* URL to fetch and convert to markdown
|
|
125
208
|
*/
|
|
126
209
|
url: string;
|
|
127
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Optional geotargeting parameters for proxy requests
|
|
213
|
+
*/
|
|
214
|
+
geo_target?: ExtractMarkdownParams.GeoTarget;
|
|
215
|
+
|
|
128
216
|
/**
|
|
129
217
|
* Include extracted metadata (Open Graph and HTML metadata) as a separate field in
|
|
130
218
|
* the response
|
|
@@ -137,6 +225,19 @@ export interface ExtractMarkdownParams {
|
|
|
137
225
|
nocache?: boolean;
|
|
138
226
|
}
|
|
139
227
|
|
|
228
|
+
export namespace ExtractMarkdownParams {
|
|
229
|
+
/**
|
|
230
|
+
* Optional geotargeting parameters for proxy requests
|
|
231
|
+
*/
|
|
232
|
+
export interface GeoTarget {
|
|
233
|
+
/**
|
|
234
|
+
* Country code using ISO 3166-1 alpha-2 standard (2 letters, e.g., "US", "GB",
|
|
235
|
+
* "JP"). See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
236
|
+
*/
|
|
237
|
+
country?: string;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
140
241
|
export declare namespace Extract {
|
|
141
242
|
export {
|
|
142
243
|
type ExtractJsonResponse as ExtractJsonResponse,
|
|
@@ -14,7 +14,25 @@ export class Generate extends APIResource {
|
|
|
14
14
|
* const response = await client.generate.json({
|
|
15
15
|
* instructions:
|
|
16
16
|
* "For each story, categorize it (tech/business/science/other) and write a one-sentence summary explaining what it's about in simple terms.",
|
|
17
|
-
* json_schema: {
|
|
17
|
+
* json_schema: {
|
|
18
|
+
* properties: {
|
|
19
|
+
* summaries: {
|
|
20
|
+
* items: {
|
|
21
|
+
* properties: {
|
|
22
|
+
* category: {
|
|
23
|
+
* description: 'Story category (tech/business/science/etc)',
|
|
24
|
+
* type: 'string',
|
|
25
|
+
* },
|
|
26
|
+
* summary: { description: 'One-sentence summary of the story', type: 'string' },
|
|
27
|
+
* title: { description: 'Story title', type: 'string' },
|
|
28
|
+
* },
|
|
29
|
+
* type: 'object',
|
|
30
|
+
* },
|
|
31
|
+
* type: 'array',
|
|
32
|
+
* },
|
|
33
|
+
* },
|
|
34
|
+
* type: 'object',
|
|
35
|
+
* },
|
|
18
36
|
* url: 'https://news.ycombinator.com',
|
|
19
37
|
* });
|
|
20
38
|
* ```
|
|
@@ -42,12 +60,30 @@ export interface GenerateJsonParams {
|
|
|
42
60
|
*/
|
|
43
61
|
url: string;
|
|
44
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Optional geotargeting parameters for proxy requests
|
|
65
|
+
*/
|
|
66
|
+
geo_target?: GenerateJsonParams.GeoTarget;
|
|
67
|
+
|
|
45
68
|
/**
|
|
46
69
|
* Bypass cache and force fresh data retrieval
|
|
47
70
|
*/
|
|
48
71
|
nocache?: boolean;
|
|
49
72
|
}
|
|
50
73
|
|
|
74
|
+
export namespace GenerateJsonParams {
|
|
75
|
+
/**
|
|
76
|
+
* Optional geotargeting parameters for proxy requests
|
|
77
|
+
*/
|
|
78
|
+
export interface GeoTarget {
|
|
79
|
+
/**
|
|
80
|
+
* Country code using ISO 3166-1 alpha-2 standard (2 letters, e.g., "US", "GB",
|
|
81
|
+
* "JP"). See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
82
|
+
*/
|
|
83
|
+
country?: string;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
51
87
|
export declare namespace Generate {
|
|
52
88
|
export { type GenerateJsonResponse as GenerateJsonResponse, type GenerateJsonParams as GenerateJsonParams };
|
|
53
89
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
Agent,
|
|
5
|
+
type AutomateEvent,
|
|
6
|
+
type ResearchEvent,
|
|
7
|
+
type AgentAutomateParams,
|
|
8
|
+
type AgentResearchParams,
|
|
9
|
+
} from './agent';
|
|
4
10
|
export {
|
|
5
11
|
Extract,
|
|
6
12
|
type ExtractJsonResponse,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '2.
|
|
1
|
+
export const VERSION = '2.2.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.
|
|
1
|
+
export declare const VERSION = "2.2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.
|
|
1
|
+
export declare const VERSION = "2.2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.
|
|
1
|
+
export const VERSION = '2.2.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|