@tabstack/sdk 2.3.0 → 2.4.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 +41 -0
- package/README.md +2 -2
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/core/streaming.d.mts +1 -1
- package/core/streaming.d.mts.map +1 -1
- package/core/streaming.d.ts +1 -1
- package/core/streaming.d.ts.map +1 -1
- package/core/streaming.js +3 -2
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +3 -2
- 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 +2 -2
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +2 -2
- package/internal/parse.mjs.map +1 -1
- package/internal/request-options.d.mts +1 -0
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +1 -0
- package/internal/request-options.d.ts.map +1 -1
- package/internal/request-options.js.map +1 -1
- package/internal/request-options.mjs.map +1 -1
- package/internal/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agent.d.mts +46 -1
- package/resources/agent.d.mts.map +1 -1
- package/resources/agent.d.ts +46 -1
- package/resources/agent.d.ts.map +1 -1
- package/resources/agent.js +27 -0
- package/resources/agent.js.map +1 -1
- package/resources/agent.mjs +27 -0
- package/resources/agent.mjs.map +1 -1
- package/resources/generate.d.mts +1 -1
- package/resources/generate.d.ts +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.map +1 -1
- package/src/client.ts +4 -0
- package/src/core/streaming.ts +3 -1
- package/src/internal/parse.ts +12 -2
- package/src/internal/request-options.ts +1 -0
- package/src/internal/utils/env.ts +2 -2
- package/src/resources/agent.ts +63 -0
- package/src/resources/generate.ts +1 -1
- package/src/resources/index.ts +2 -0
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-options.mjs","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"AAAA,sFAAsF;
|
|
1
|
+
{"version":3,"file":"request-options.mjs","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAsFtF,MAAM,CAAC,MAAM,eAAe,GAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;IACnE,OAAO;QACL,WAAW,EAAE;YACX,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC,CAAC"}
|
package/internal/utils/env.js
CHANGED
|
@@ -11,10 +11,10 @@ exports.readEnv = void 0;
|
|
|
11
11
|
*/
|
|
12
12
|
const readEnv = (env) => {
|
|
13
13
|
if (typeof globalThis.process !== 'undefined') {
|
|
14
|
-
return globalThis.process.env?.[env]?.trim()
|
|
14
|
+
return globalThis.process.env?.[env]?.trim() || undefined;
|
|
15
15
|
}
|
|
16
16
|
if (typeof globalThis.Deno !== 'undefined') {
|
|
17
|
-
return globalThis.Deno.env?.get?.(env)?.trim();
|
|
17
|
+
return globalThis.Deno.env?.get?.(env)?.trim() || undefined;
|
|
18
18
|
}
|
|
19
19
|
return undefined;
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/internal/utils/env.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF;;;;;;GAMG;AACI,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IACrE,CAAC;IACD,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACpD,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/internal/utils/env.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF;;;;;;GAMG;AACI,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IACrE,CAAC;IACD,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACpD,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IACvE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AARW,QAAA,OAAO,WAQlB"}
|
package/internal/utils/env.mjs
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export const readEnv = (env) => {
|
|
10
10
|
if (typeof globalThis.process !== 'undefined') {
|
|
11
|
-
return globalThis.process.env?.[env]?.trim()
|
|
11
|
+
return globalThis.process.env?.[env]?.trim() || undefined;
|
|
12
12
|
}
|
|
13
13
|
if (typeof globalThis.Deno !== 'undefined') {
|
|
14
|
-
return globalThis.Deno.env?.get?.(env)?.trim();
|
|
14
|
+
return globalThis.Deno.env?.get?.(env)?.trim() || undefined;
|
|
15
15
|
}
|
|
16
16
|
return undefined;
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.mjs","sourceRoot":"","sources":["../../src/internal/utils/env.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IACrE,CAAC;IACD,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACpD,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"env.mjs","sourceRoot":"","sources":["../../src/internal/utils/env.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IACrE,CAAC;IACD,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACpD,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IACvE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
package/package.json
CHANGED
package/resources/agent.d.mts
CHANGED
|
@@ -36,6 +36,28 @@ export declare class Agent extends APIResource {
|
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
38
|
automate(body: AgentAutomateParams, options?: RequestOptions): APIPromise<Stream<AutomateEvent>>;
|
|
39
|
+
/**
|
|
40
|
+
* Submit a response to an interactive form data request from an in-progress
|
|
41
|
+
* automation task. When the AI agent encounters a form requiring user data, it
|
|
42
|
+
* emits an `interactive:form_data:request` or `interactive:form_data:error` SSE
|
|
43
|
+
* event containing a `requestId`. Use this endpoint to provide the requested data
|
|
44
|
+
* or cancel the request.
|
|
45
|
+
*
|
|
46
|
+
* **Lifecycle:**
|
|
47
|
+
*
|
|
48
|
+
* - Input requests expire after 2 minutes by default
|
|
49
|
+
* - Expired or already-answered requests return `410 Gone`
|
|
50
|
+
* - Successful submissions return `202 Accepted` (fire-and-forget from caller's
|
|
51
|
+
* perspective)
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const response = await client.agent.automateInput(
|
|
56
|
+
* 'requestID',
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
automateInput(requestID: string, body: AgentAutomateInputParams, options?: RequestOptions): APIPromise<AgentAutomateInputResponse>;
|
|
39
61
|
/**
|
|
40
62
|
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
41
63
|
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
@@ -88,6 +110,9 @@ export interface ResearchEvent {
|
|
|
88
110
|
*/
|
|
89
111
|
event?: 'phase' | 'progress' | 'complete' | 'error';
|
|
90
112
|
}
|
|
113
|
+
export interface AgentAutomateInputResponse {
|
|
114
|
+
status?: string;
|
|
115
|
+
}
|
|
91
116
|
export interface AgentAutomateParams {
|
|
92
117
|
/**
|
|
93
118
|
* The task description in natural language
|
|
@@ -105,6 +130,10 @@ export interface AgentAutomateParams {
|
|
|
105
130
|
* Safety constraints for execution
|
|
106
131
|
*/
|
|
107
132
|
guardrails?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Enable interactive mode to allow human-in-the-loop input during task execution
|
|
135
|
+
*/
|
|
136
|
+
interactive?: boolean;
|
|
108
137
|
/**
|
|
109
138
|
* Maximum task iterations
|
|
110
139
|
*/
|
|
@@ -130,6 +159,22 @@ export declare namespace AgentAutomateParams {
|
|
|
130
159
|
country?: string;
|
|
131
160
|
}
|
|
132
161
|
}
|
|
162
|
+
export interface AgentAutomateInputParams {
|
|
163
|
+
/**
|
|
164
|
+
* Set to true to cancel/decline the request
|
|
165
|
+
*/
|
|
166
|
+
cancelled?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Field values as array of {ref, value} pairs (required when not cancelled)
|
|
169
|
+
*/
|
|
170
|
+
fields?: Array<AgentAutomateInputParams.Field>;
|
|
171
|
+
}
|
|
172
|
+
export declare namespace AgentAutomateInputParams {
|
|
173
|
+
interface Field {
|
|
174
|
+
ref?: string;
|
|
175
|
+
value?: string;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
133
178
|
export interface AgentResearchParams {
|
|
134
179
|
/**
|
|
135
180
|
* The research query or question to answer
|
|
@@ -149,6 +194,6 @@ export interface AgentResearchParams {
|
|
|
149
194
|
nocache?: boolean;
|
|
150
195
|
}
|
|
151
196
|
export declare namespace Agent {
|
|
152
|
-
export { type AutomateEvent as AutomateEvent, type ResearchEvent as ResearchEvent, type AgentAutomateParams as AgentAutomateParams, type AgentResearchParams as AgentResearchParams, };
|
|
197
|
+
export { type AutomateEvent as AutomateEvent, type ResearchEvent as ResearchEvent, type AgentAutomateInputResponse as AgentAutomateInputResponse, type AgentAutomateParams as AgentAutomateParams, type AgentAutomateInputParams as AgentAutomateInputParams, type AgentResearchParams as AgentResearchParams, };
|
|
153
198
|
}
|
|
154
199
|
//# sourceMappingURL=agent.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.mts","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OAEV,EAAE,cAAc,EAAE;
|
|
1
|
+
{"version":3,"file":"agent.d.mts","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OAEV,EAAE,cAAc,EAAE;AAGzB,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAUhG;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,aAAa,CACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,wBAAwB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,0BAA0B,CAAC;IAIzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;CASjG;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;CACrD;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC;IAE3C;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,yBAAiB,mBAAmB,CAAC;IACnC;;OAEG;IACH,UAAiB,SAAS;QACxB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;CACF;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;CAChD;AAED,yBAAiB,wBAAwB,CAAC;IACxC,UAAiB,KAAK;QACpB,GAAG,CAAC,EAAE,MAAM,CAAC;QAEb,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/agent.d.ts
CHANGED
|
@@ -36,6 +36,28 @@ export declare class Agent extends APIResource {
|
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
38
|
automate(body: AgentAutomateParams, options?: RequestOptions): APIPromise<Stream<AutomateEvent>>;
|
|
39
|
+
/**
|
|
40
|
+
* Submit a response to an interactive form data request from an in-progress
|
|
41
|
+
* automation task. When the AI agent encounters a form requiring user data, it
|
|
42
|
+
* emits an `interactive:form_data:request` or `interactive:form_data:error` SSE
|
|
43
|
+
* event containing a `requestId`. Use this endpoint to provide the requested data
|
|
44
|
+
* or cancel the request.
|
|
45
|
+
*
|
|
46
|
+
* **Lifecycle:**
|
|
47
|
+
*
|
|
48
|
+
* - Input requests expire after 2 minutes by default
|
|
49
|
+
* - Expired or already-answered requests return `410 Gone`
|
|
50
|
+
* - Successful submissions return `202 Accepted` (fire-and-forget from caller's
|
|
51
|
+
* perspective)
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const response = await client.agent.automateInput(
|
|
56
|
+
* 'requestID',
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
automateInput(requestID: string, body: AgentAutomateInputParams, options?: RequestOptions): APIPromise<AgentAutomateInputResponse>;
|
|
39
61
|
/**
|
|
40
62
|
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
41
63
|
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
@@ -88,6 +110,9 @@ export interface ResearchEvent {
|
|
|
88
110
|
*/
|
|
89
111
|
event?: 'phase' | 'progress' | 'complete' | 'error';
|
|
90
112
|
}
|
|
113
|
+
export interface AgentAutomateInputResponse {
|
|
114
|
+
status?: string;
|
|
115
|
+
}
|
|
91
116
|
export interface AgentAutomateParams {
|
|
92
117
|
/**
|
|
93
118
|
* The task description in natural language
|
|
@@ -105,6 +130,10 @@ export interface AgentAutomateParams {
|
|
|
105
130
|
* Safety constraints for execution
|
|
106
131
|
*/
|
|
107
132
|
guardrails?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Enable interactive mode to allow human-in-the-loop input during task execution
|
|
135
|
+
*/
|
|
136
|
+
interactive?: boolean;
|
|
108
137
|
/**
|
|
109
138
|
* Maximum task iterations
|
|
110
139
|
*/
|
|
@@ -130,6 +159,22 @@ export declare namespace AgentAutomateParams {
|
|
|
130
159
|
country?: string;
|
|
131
160
|
}
|
|
132
161
|
}
|
|
162
|
+
export interface AgentAutomateInputParams {
|
|
163
|
+
/**
|
|
164
|
+
* Set to true to cancel/decline the request
|
|
165
|
+
*/
|
|
166
|
+
cancelled?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Field values as array of {ref, value} pairs (required when not cancelled)
|
|
169
|
+
*/
|
|
170
|
+
fields?: Array<AgentAutomateInputParams.Field>;
|
|
171
|
+
}
|
|
172
|
+
export declare namespace AgentAutomateInputParams {
|
|
173
|
+
interface Field {
|
|
174
|
+
ref?: string;
|
|
175
|
+
value?: string;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
133
178
|
export interface AgentResearchParams {
|
|
134
179
|
/**
|
|
135
180
|
* The research query or question to answer
|
|
@@ -149,6 +194,6 @@ export interface AgentResearchParams {
|
|
|
149
194
|
nocache?: boolean;
|
|
150
195
|
}
|
|
151
196
|
export declare namespace Agent {
|
|
152
|
-
export { type AutomateEvent as AutomateEvent, type ResearchEvent as ResearchEvent, type AgentAutomateParams as AgentAutomateParams, type AgentResearchParams as AgentResearchParams, };
|
|
197
|
+
export { type AutomateEvent as AutomateEvent, type ResearchEvent as ResearchEvent, type AgentAutomateInputResponse as AgentAutomateInputResponse, type AgentAutomateParams as AgentAutomateParams, type AgentAutomateInputParams as AgentAutomateInputParams, type AgentResearchParams as AgentResearchParams, };
|
|
153
198
|
}
|
|
154
199
|
//# sourceMappingURL=agent.d.ts.map
|
package/resources/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OAEV,EAAE,cAAc,EAAE;
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OAEV,EAAE,cAAc,EAAE;AAGzB,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAUhG;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,aAAa,CACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,wBAAwB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,0BAA0B,CAAC;IAIzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;CASjG;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;CACrD;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC;IAE3C;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,yBAAiB,mBAAmB,CAAC;IACnC;;OAEG;IACH,UAAiB,SAAS;QACxB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;CACF;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;CAChD;AAED,yBAAiB,wBAAwB,CAAC;IACxC,UAAiB,KAAK;QACpB,GAAG,CAAC,EAAE,MAAM,CAAC;QAEb,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/agent.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Agent = void 0;
|
|
5
5
|
const resource_1 = require("../core/resource.js");
|
|
6
6
|
const headers_1 = require("../internal/headers.js");
|
|
7
|
+
const path_1 = require("../internal/utils/path.js");
|
|
7
8
|
class Agent extends resource_1.APIResource {
|
|
8
9
|
/**
|
|
9
10
|
* Execute AI-powered browser automation tasks using natural language with optional
|
|
@@ -43,8 +44,33 @@ class Agent extends resource_1.APIResource {
|
|
|
43
44
|
...options,
|
|
44
45
|
headers: (0, headers_1.buildHeaders)([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
45
46
|
stream: true,
|
|
47
|
+
__synthesizeEventData: true,
|
|
46
48
|
});
|
|
47
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Submit a response to an interactive form data request from an in-progress
|
|
52
|
+
* automation task. When the AI agent encounters a form requiring user data, it
|
|
53
|
+
* emits an `interactive:form_data:request` or `interactive:form_data:error` SSE
|
|
54
|
+
* event containing a `requestId`. Use this endpoint to provide the requested data
|
|
55
|
+
* or cancel the request.
|
|
56
|
+
*
|
|
57
|
+
* **Lifecycle:**
|
|
58
|
+
*
|
|
59
|
+
* - Input requests expire after 2 minutes by default
|
|
60
|
+
* - Expired or already-answered requests return `410 Gone`
|
|
61
|
+
* - Successful submissions return `202 Accepted` (fire-and-forget from caller's
|
|
62
|
+
* perspective)
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const response = await client.agent.automateInput(
|
|
67
|
+
* 'requestID',
|
|
68
|
+
* );
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
automateInput(requestID, body, options) {
|
|
72
|
+
return this._client.post((0, path_1.path) `/automate/${requestID}/input`, { body, ...options });
|
|
73
|
+
}
|
|
48
74
|
/**
|
|
49
75
|
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
50
76
|
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
@@ -81,6 +107,7 @@ class Agent extends resource_1.APIResource {
|
|
|
81
107
|
...options,
|
|
82
108
|
headers: (0, headers_1.buildHeaders)([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
83
109
|
stream: true,
|
|
110
|
+
__synthesizeEventData: true,
|
|
84
111
|
});
|
|
85
112
|
}
|
|
86
113
|
}
|
package/resources/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;YACZ,qBAAqB,EAAE,IAAI;SAC5B,CAAsC,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,aAAa,CACX,SAAiB,EACjB,IAA8B,EAC9B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,SAAS,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;YACZ,qBAAqB,EAAE,IAAI;SAC5B,CAAsC,CAAC;IAC1C,CAAC;CACF;AA/GD,sBA+GC"}
|
package/resources/agent.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { APIResource } from "../core/resource.mjs";
|
|
3
3
|
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
|
+
import { path } from "../internal/utils/path.mjs";
|
|
4
5
|
export class Agent extends APIResource {
|
|
5
6
|
/**
|
|
6
7
|
* Execute AI-powered browser automation tasks using natural language with optional
|
|
@@ -40,8 +41,33 @@ export class Agent extends APIResource {
|
|
|
40
41
|
...options,
|
|
41
42
|
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
42
43
|
stream: true,
|
|
44
|
+
__synthesizeEventData: true,
|
|
43
45
|
});
|
|
44
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Submit a response to an interactive form data request from an in-progress
|
|
49
|
+
* automation task. When the AI agent encounters a form requiring user data, it
|
|
50
|
+
* emits an `interactive:form_data:request` or `interactive:form_data:error` SSE
|
|
51
|
+
* event containing a `requestId`. Use this endpoint to provide the requested data
|
|
52
|
+
* or cancel the request.
|
|
53
|
+
*
|
|
54
|
+
* **Lifecycle:**
|
|
55
|
+
*
|
|
56
|
+
* - Input requests expire after 2 minutes by default
|
|
57
|
+
* - Expired or already-answered requests return `410 Gone`
|
|
58
|
+
* - Successful submissions return `202 Accepted` (fire-and-forget from caller's
|
|
59
|
+
* perspective)
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const response = await client.agent.automateInput(
|
|
64
|
+
* 'requestID',
|
|
65
|
+
* );
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
automateInput(requestID, body, options) {
|
|
69
|
+
return this._client.post(path `/automate/${requestID}/input`, { body, ...options });
|
|
70
|
+
}
|
|
45
71
|
/**
|
|
46
72
|
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
47
73
|
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
@@ -78,6 +104,7 @@ export class Agent extends APIResource {
|
|
|
78
104
|
...options,
|
|
79
105
|
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
80
106
|
stream: true,
|
|
107
|
+
__synthesizeEventData: true,
|
|
81
108
|
});
|
|
82
109
|
}
|
|
83
110
|
}
|
package/resources/agent.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.mjs","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"agent.mjs","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;YACZ,qBAAqB,EAAE,IAAI;SAC5B,CAAsC,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,aAAa,CACX,SAAiB,EACjB,IAA8B,EAC9B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,SAAS,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;YACZ,qBAAqB,EAAE,IAAI;SAC5B,CAAsC,CAAC;IAC1C,CAAC;CACF"}
|
package/resources/generate.d.mts
CHANGED
|
@@ -41,7 +41,7 @@ export type GenerateJsonResponse = {
|
|
|
41
41
|
};
|
|
42
42
|
export interface GenerateJsonParams {
|
|
43
43
|
/**
|
|
44
|
-
* Instructions describing how to transform the data
|
|
44
|
+
* Instructions describing how to transform the data. Maximum 20,000 characters.
|
|
45
45
|
*/
|
|
46
46
|
instructions: string;
|
|
47
47
|
/**
|
package/resources/generate.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export type GenerateJsonResponse = {
|
|
|
41
41
|
};
|
|
42
42
|
export interface GenerateJsonParams {
|
|
43
43
|
/**
|
|
44
|
-
* Instructions describing how to transform the data
|
|
44
|
+
* Instructions describing how to transform the data. Maximum 20,000 characters.
|
|
45
45
|
*/
|
|
46
46
|
instructions: string;
|
|
47
47
|
/**
|
package/resources/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Agent, type AutomateEvent, type ResearchEvent, type AgentAutomateParams, type AgentResearchParams, } from "./agent.mjs";
|
|
1
|
+
export { Agent, type AutomateEvent, type ResearchEvent, type AgentAutomateInputResponse, type AgentAutomateParams, type AgentAutomateInputParams, type AgentResearchParams, } from "./agent.mjs";
|
|
2
2
|
export { Extract, type ExtractJsonResponse, type ExtractMarkdownResponse, type ExtractJsonParams, type ExtractMarkdownParams, } from "./extract.mjs";
|
|
3
3
|
export { Generate, type GenerateJsonResponse, type GenerateJsonParams } from "./generate.mjs";
|
|
4
4
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB;OACM,EACL,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B;OACM,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,GACzB;OACM,EACL,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B;OACM,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE"}
|
package/resources/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Agent, type AutomateEvent, type ResearchEvent, type AgentAutomateParams, type AgentResearchParams, } from "./agent.js";
|
|
1
|
+
export { Agent, type AutomateEvent, type ResearchEvent, type AgentAutomateInputResponse, type AgentAutomateParams, type AgentAutomateInputParams, type AgentResearchParams, } from "./agent.js";
|
|
2
2
|
export { Extract, type ExtractJsonResponse, type ExtractMarkdownResponse, type ExtractJsonParams, type ExtractMarkdownParams, } from "./extract.js";
|
|
3
3
|
export { Generate, type GenerateJsonResponse, type GenerateJsonParams } from "./generate.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/resources/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB;OACM,EACL,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B;OACM,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,GACzB;OACM,EACL,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B;OACM,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE"}
|
package/resources/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAQiB;AAPf,8FAAA,KAAK,OAAA;AAQP,wCAMmB;AALjB,kGAAA,OAAO,OAAA;AAMT,0CAA0F;AAAjF,oGAAA,QAAQ,OAAA"}
|
package/resources/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,KAAK,GAON;OACM,EACL,OAAO,GAKR;OACM,EAAE,QAAQ,EAAsD"}
|
package/src/client.ts
CHANGED
|
@@ -19,6 +19,8 @@ import * as API from './resources/index';
|
|
|
19
19
|
import { APIPromise } from './core/api-promise';
|
|
20
20
|
import {
|
|
21
21
|
Agent,
|
|
22
|
+
AgentAutomateInputParams,
|
|
23
|
+
AgentAutomateInputResponse,
|
|
22
24
|
AgentAutomateParams,
|
|
23
25
|
AgentResearchParams,
|
|
24
26
|
AutomateEvent,
|
|
@@ -748,7 +750,9 @@ export declare namespace Tabstack {
|
|
|
748
750
|
Agent as Agent,
|
|
749
751
|
type AutomateEvent as AutomateEvent,
|
|
750
752
|
type ResearchEvent as ResearchEvent,
|
|
753
|
+
type AgentAutomateInputResponse as AgentAutomateInputResponse,
|
|
751
754
|
type AgentAutomateParams as AgentAutomateParams,
|
|
755
|
+
type AgentAutomateInputParams as AgentAutomateInputParams,
|
|
752
756
|
type AgentResearchParams as AgentResearchParams,
|
|
753
757
|
};
|
|
754
758
|
|
package/src/core/streaming.ts
CHANGED
|
@@ -33,6 +33,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
|
|
|
33
33
|
response: Response,
|
|
34
34
|
controller: AbortController,
|
|
35
35
|
client?: Tabstack,
|
|
36
|
+
synthesizeEventData?: boolean,
|
|
36
37
|
): Stream<Item> {
|
|
37
38
|
let consumed = false;
|
|
38
39
|
const logger = client ? loggerFor(client) : console;
|
|
@@ -46,7 +47,8 @@ export class Stream<Item> implements AsyncIterable<Item> {
|
|
|
46
47
|
try {
|
|
47
48
|
for await (const sse of _iterSSEMessages(response, controller)) {
|
|
48
49
|
try {
|
|
49
|
-
|
|
50
|
+
const data = JSON.parse(sse.data);
|
|
51
|
+
yield (synthesizeEventData ? { event: sse.event, data } : data) as Item;
|
|
50
52
|
} catch (e) {
|
|
51
53
|
logger.error(`Could not parse message into JSON:`, sse.data);
|
|
52
54
|
logger.error(`From chunk:`, sse.raw);
|
package/src/internal/parse.ts
CHANGED
|
@@ -24,10 +24,20 @@ export async function defaultParseResponse<T>(client: Tabstack, props: APIRespon
|
|
|
24
24
|
// that if you set `stream: true` the response type must also be `Stream<T>`
|
|
25
25
|
|
|
26
26
|
if (props.options.__streamClass) {
|
|
27
|
-
return props.options.__streamClass.fromSSEResponse(
|
|
27
|
+
return props.options.__streamClass.fromSSEResponse(
|
|
28
|
+
response,
|
|
29
|
+
props.controller,
|
|
30
|
+
client,
|
|
31
|
+
props.options.__synthesizeEventData,
|
|
32
|
+
) as any;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
return Stream.fromSSEResponse(
|
|
35
|
+
return Stream.fromSSEResponse(
|
|
36
|
+
response,
|
|
37
|
+
props.controller,
|
|
38
|
+
client,
|
|
39
|
+
props.options.__synthesizeEventData,
|
|
40
|
+
) as any;
|
|
31
41
|
}
|
|
32
42
|
|
|
33
43
|
// fetch refuses to read the body when the status code is 204.
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export const readEnv = (env: string): string | undefined => {
|
|
11
11
|
if (typeof (globalThis as any).process !== 'undefined') {
|
|
12
|
-
return (globalThis as any).process.env?.[env]?.trim()
|
|
12
|
+
return (globalThis as any).process.env?.[env]?.trim() || undefined;
|
|
13
13
|
}
|
|
14
14
|
if (typeof (globalThis as any).Deno !== 'undefined') {
|
|
15
|
-
return (globalThis as any).Deno.env?.get?.(env)?.trim();
|
|
15
|
+
return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
|
|
16
16
|
}
|
|
17
17
|
return undefined;
|
|
18
18
|
};
|
package/src/resources/agent.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { APIPromise } from '../core/api-promise';
|
|
|
5
5
|
import { Stream } from '../core/streaming';
|
|
6
6
|
import { buildHeaders } from '../internal/headers';
|
|
7
7
|
import { RequestOptions } from '../internal/request-options';
|
|
8
|
+
import { path } from '../internal/utils/path';
|
|
8
9
|
|
|
9
10
|
export class Agent extends APIResource {
|
|
10
11
|
/**
|
|
@@ -45,9 +46,39 @@ export class Agent extends APIResource {
|
|
|
45
46
|
...options,
|
|
46
47
|
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
47
48
|
stream: true,
|
|
49
|
+
__synthesizeEventData: true,
|
|
48
50
|
}) as APIPromise<Stream<AutomateEvent>>;
|
|
49
51
|
}
|
|
50
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Submit a response to an interactive form data request from an in-progress
|
|
55
|
+
* automation task. When the AI agent encounters a form requiring user data, it
|
|
56
|
+
* emits an `interactive:form_data:request` or `interactive:form_data:error` SSE
|
|
57
|
+
* event containing a `requestId`. Use this endpoint to provide the requested data
|
|
58
|
+
* or cancel the request.
|
|
59
|
+
*
|
|
60
|
+
* **Lifecycle:**
|
|
61
|
+
*
|
|
62
|
+
* - Input requests expire after 2 minutes by default
|
|
63
|
+
* - Expired or already-answered requests return `410 Gone`
|
|
64
|
+
* - Successful submissions return `202 Accepted` (fire-and-forget from caller's
|
|
65
|
+
* perspective)
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const response = await client.agent.automateInput(
|
|
70
|
+
* 'requestID',
|
|
71
|
+
* );
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
automateInput(
|
|
75
|
+
requestID: string,
|
|
76
|
+
body: AgentAutomateInputParams,
|
|
77
|
+
options?: RequestOptions,
|
|
78
|
+
): APIPromise<AgentAutomateInputResponse> {
|
|
79
|
+
return this._client.post(path`/automate/${requestID}/input`, { body, ...options });
|
|
80
|
+
}
|
|
81
|
+
|
|
51
82
|
/**
|
|
52
83
|
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
53
84
|
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
@@ -84,6 +115,7 @@ export class Agent extends APIResource {
|
|
|
84
115
|
...options,
|
|
85
116
|
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
86
117
|
stream: true,
|
|
118
|
+
__synthesizeEventData: true,
|
|
87
119
|
}) as APIPromise<Stream<ResearchEvent>>;
|
|
88
120
|
}
|
|
89
121
|
}
|
|
@@ -112,6 +144,10 @@ export interface ResearchEvent {
|
|
|
112
144
|
event?: 'phase' | 'progress' | 'complete' | 'error';
|
|
113
145
|
}
|
|
114
146
|
|
|
147
|
+
export interface AgentAutomateInputResponse {
|
|
148
|
+
status?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
115
151
|
export interface AgentAutomateParams {
|
|
116
152
|
/**
|
|
117
153
|
* The task description in natural language
|
|
@@ -133,6 +169,11 @@ export interface AgentAutomateParams {
|
|
|
133
169
|
*/
|
|
134
170
|
guardrails?: string;
|
|
135
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Enable interactive mode to allow human-in-the-loop input during task execution
|
|
174
|
+
*/
|
|
175
|
+
interactive?: boolean;
|
|
176
|
+
|
|
136
177
|
/**
|
|
137
178
|
* Maximum task iterations
|
|
138
179
|
*/
|
|
@@ -162,6 +203,26 @@ export namespace AgentAutomateParams {
|
|
|
162
203
|
}
|
|
163
204
|
}
|
|
164
205
|
|
|
206
|
+
export interface AgentAutomateInputParams {
|
|
207
|
+
/**
|
|
208
|
+
* Set to true to cancel/decline the request
|
|
209
|
+
*/
|
|
210
|
+
cancelled?: boolean;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Field values as array of {ref, value} pairs (required when not cancelled)
|
|
214
|
+
*/
|
|
215
|
+
fields?: Array<AgentAutomateInputParams.Field>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export namespace AgentAutomateInputParams {
|
|
219
|
+
export interface Field {
|
|
220
|
+
ref?: string;
|
|
221
|
+
|
|
222
|
+
value?: string;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
165
226
|
export interface AgentResearchParams {
|
|
166
227
|
/**
|
|
167
228
|
* The research query or question to answer
|
|
@@ -188,7 +249,9 @@ export declare namespace Agent {
|
|
|
188
249
|
export {
|
|
189
250
|
type AutomateEvent as AutomateEvent,
|
|
190
251
|
type ResearchEvent as ResearchEvent,
|
|
252
|
+
type AgentAutomateInputResponse as AgentAutomateInputResponse,
|
|
191
253
|
type AgentAutomateParams as AgentAutomateParams,
|
|
254
|
+
type AgentAutomateInputParams as AgentAutomateInputParams,
|
|
192
255
|
type AgentResearchParams as AgentResearchParams,
|
|
193
256
|
};
|
|
194
257
|
}
|
|
@@ -46,7 +46,7 @@ export type GenerateJsonResponse = { [key: string]: unknown };
|
|
|
46
46
|
|
|
47
47
|
export interface GenerateJsonParams {
|
|
48
48
|
/**
|
|
49
|
-
* Instructions describing how to transform the data
|
|
49
|
+
* Instructions describing how to transform the data. Maximum 20,000 characters.
|
|
50
50
|
*/
|
|
51
51
|
instructions: string;
|
|
52
52
|
|
package/src/resources/index.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '2.
|
|
1
|
+
export const VERSION = '2.4.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.4.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.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|