@arcadeai/arcadejs 0.2.2 → 1.0.0-rc.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.
- package/CHANGELOG.md +36 -0
- package/README.md +2 -3
- package/core.d.ts.map +1 -1
- package/core.js +10 -1
- package/core.js.map +1 -1
- package/core.mjs +10 -1
- package/core.mjs.map +1 -1
- package/index.d.mts +9 -8
- package/index.d.ts +9 -8
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/auth.d.ts +73 -9
- package/resources/auth.d.ts.map +1 -1
- package/resources/auth.js +81 -1
- package/resources/auth.js.map +1 -1
- package/resources/auth.mjs +79 -0
- package/resources/auth.mjs.map +1 -1
- package/resources/chat/chat.d.ts +5 -2
- package/resources/chat/chat.d.ts.map +1 -1
- package/resources/chat/chat.js.map +1 -1
- package/resources/chat/chat.mjs.map +1 -1
- package/resources/chat/completions.d.ts +4 -1
- package/resources/chat/completions.d.ts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +2 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/shared.d.ts +8 -10
- package/resources/shared.d.ts.map +1 -1
- package/resources/tools/formatted.d.ts +2 -5
- package/resources/tools/formatted.d.ts.map +1 -1
- package/resources/tools/formatted.js +6 -6
- package/resources/tools/formatted.js.map +1 -1
- package/resources/tools/formatted.mjs +6 -6
- package/resources/tools/formatted.mjs.map +1 -1
- package/resources/tools/index.d.ts +2 -2
- package/resources/tools/index.d.ts.map +1 -1
- package/resources/tools/index.js +2 -1
- package/resources/tools/index.js.map +1 -1
- package/resources/tools/index.mjs +1 -1
- package/resources/tools/index.mjs.map +1 -1
- package/resources/tools/scheduled.d.ts +15 -33
- package/resources/tools/scheduled.d.ts.map +1 -1
- package/resources/tools/scheduled.js +11 -8
- package/resources/tools/scheduled.js.map +1 -1
- package/resources/tools/scheduled.mjs +10 -7
- package/resources/tools/scheduled.mjs.map +1 -1
- package/resources/tools/tools.d.ts +75 -126
- package/resources/tools/tools.d.ts.map +1 -1
- package/resources/tools/tools.js +7 -4
- package/resources/tools/tools.js.map +1 -1
- package/resources/tools/tools.mjs +5 -3
- package/resources/tools/tools.mjs.map +1 -1
- package/src/core.ts +11 -1
- package/src/index.ts +9 -10
- package/src/resources/auth.ts +127 -8
- package/src/resources/chat/chat.ts +6 -2
- package/src/resources/chat/completions.ts +5 -1
- package/src/resources/index.ts +2 -2
- package/src/resources/shared.ts +10 -12
- package/src/resources/tools/formatted.ts +12 -8
- package/src/resources/tools/index.ts +3 -3
- package/src/resources/tools/scheduled.ts +30 -46
- package/src/resources/tools/tools.ts +93 -156
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/resources/tools/tools.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAC7C,wCAA8C;
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/resources/tools/tools.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAC7C,wCAA8C;AAI9C,6DAA4C;AAC5C,8CAOqB;AACrB,6DAA4C;AAC5C,8CAAmF;AACnF,oDAAqE;AAErE,MAAa,KAAM,SAAQ,sBAAW;IAAtC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7E,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA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
|
|
18
18
|
}
|
|
19
|
-
return this._client.getAPIList('/v1/tools
|
|
19
|
+
return this._client.getAPIList('/v1/tools', ToolListResponsesOffsetPage, { query, ...options });
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Authorizes a user for a specific tool by name
|
|
@@ -33,12 +33,14 @@ export class Tools extends APIResource {
|
|
|
33
33
|
/**
|
|
34
34
|
* Returns the arcade tool specification for a specific tool
|
|
35
35
|
*/
|
|
36
|
-
get(
|
|
37
|
-
return this._client.get(
|
|
36
|
+
get(name, options) {
|
|
37
|
+
return this._client.get(`/v1/tools/${name}`, options);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
export class ToolListResponsesOffsetPage extends OffsetPage {
|
|
41
41
|
}
|
|
42
|
+
export class ToolExecutionsOffsetPage extends OffsetPage {
|
|
43
|
+
}
|
|
42
44
|
Tools.ToolListResponsesOffsetPage = ToolListResponsesOffsetPage;
|
|
43
45
|
Tools.Scheduled = Scheduled;
|
|
44
46
|
Tools.Formatted = Formatted;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.mjs","sourceRoot":"","sources":["../../src/resources/tools/tools.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;
|
|
1
|
+
{"version":3,"file":"tools.mjs","sourceRoot":"","sources":["../../src/resources/tools/tools.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAIpB,KAAK,YAAY;OACjB,EACL,SAAS,EAKT,gCAAgC,GACjC;OACM,KAAK,YAAY;OACjB,EAAE,SAAS,EAA6C;OACxD,EAAE,UAAU,EAAyB;AAE5C,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7E,cAAS,GAA2B,IAAI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timeout = setTimeout(() => controller.abort(), ms);
|
|
524
524
|
|
|
525
|
+
const fetchOptions = {
|
|
526
|
+
signal: controller.signal as any,
|
|
527
|
+
...options,
|
|
528
|
+
};
|
|
529
|
+
if (fetchOptions.method) {
|
|
530
|
+
// Custom methods like 'patch' need to be uppercased
|
|
531
|
+
// See https://github.com/nodejs/undici/issues/2294
|
|
532
|
+
fetchOptions.method = fetchOptions.method.toUpperCase();
|
|
533
|
+
}
|
|
534
|
+
|
|
525
535
|
return (
|
|
526
536
|
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
|
|
527
|
-
this.fetch.call(undefined, url,
|
|
537
|
+
this.fetch.call(undefined, url, fetchOptions).finally(() => {
|
|
528
538
|
clearTimeout(timeout);
|
|
529
539
|
})
|
|
530
540
|
);
|
package/src/index.ts
CHANGED
|
@@ -14,17 +14,16 @@ import {
|
|
|
14
14
|
AuthorizeToolRequest,
|
|
15
15
|
ExecuteToolRequest,
|
|
16
16
|
ExecuteToolResponse,
|
|
17
|
-
ResponseOutput,
|
|
18
17
|
ToolAuthorizeParams,
|
|
19
18
|
ToolExecuteParams,
|
|
20
19
|
ToolExecution,
|
|
21
20
|
ToolExecutionAttempt,
|
|
22
|
-
ToolGetParams,
|
|
23
21
|
ToolGetResponse,
|
|
24
22
|
ToolListParams,
|
|
25
23
|
ToolListResponse,
|
|
26
24
|
ToolListResponsesOffsetPage,
|
|
27
25
|
Tools,
|
|
26
|
+
ValueSchema,
|
|
28
27
|
} from './resources/tools/tools';
|
|
29
28
|
|
|
30
29
|
export interface ClientOptions {
|
|
@@ -47,7 +46,7 @@ export interface ClientOptions {
|
|
|
47
46
|
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
48
47
|
* much longer than this timeout before the promise succeeds or fails.
|
|
49
48
|
*/
|
|
50
|
-
timeout?: number;
|
|
49
|
+
timeout?: number | undefined;
|
|
51
50
|
|
|
52
51
|
/**
|
|
53
52
|
* An HTTP agent used to manage HTTP(S) connections.
|
|
@@ -55,7 +54,7 @@ export interface ClientOptions {
|
|
|
55
54
|
* If not provided, an agent will be constructed by default in the Node.js environment,
|
|
56
55
|
* otherwise no agent is used.
|
|
57
56
|
*/
|
|
58
|
-
httpAgent?: Agent;
|
|
57
|
+
httpAgent?: Agent | undefined;
|
|
59
58
|
|
|
60
59
|
/**
|
|
61
60
|
* Specify a custom `fetch` function implementation.
|
|
@@ -71,7 +70,7 @@ export interface ClientOptions {
|
|
|
71
70
|
*
|
|
72
71
|
* @default 2
|
|
73
72
|
*/
|
|
74
|
-
maxRetries?: number;
|
|
73
|
+
maxRetries?: number | undefined;
|
|
75
74
|
|
|
76
75
|
/**
|
|
77
76
|
* Default headers to include with every request to the API.
|
|
@@ -79,7 +78,7 @@ export interface ClientOptions {
|
|
|
79
78
|
* These can be removed in individual requests by explicitly setting the
|
|
80
79
|
* header to `undefined` or `null` in request options.
|
|
81
80
|
*/
|
|
82
|
-
defaultHeaders?: Core.Headers;
|
|
81
|
+
defaultHeaders?: Core.Headers | undefined;
|
|
83
82
|
|
|
84
83
|
/**
|
|
85
84
|
* Default query parameters to include with every request to the API.
|
|
@@ -87,7 +86,7 @@ export interface ClientOptions {
|
|
|
87
86
|
* These can be removed in individual requests by explicitly setting the
|
|
88
87
|
* param to `undefined` in request options.
|
|
89
88
|
*/
|
|
90
|
-
defaultQuery?: Core.DefaultQuery;
|
|
89
|
+
defaultQuery?: Core.DefaultQuery | undefined;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
/**
|
|
@@ -216,19 +215,19 @@ export declare namespace Arcade {
|
|
|
216
215
|
type AuthorizeToolRequest as AuthorizeToolRequest,
|
|
217
216
|
type ExecuteToolRequest as ExecuteToolRequest,
|
|
218
217
|
type ExecuteToolResponse as ExecuteToolResponse,
|
|
219
|
-
type ResponseOutput as ResponseOutput,
|
|
220
218
|
type ToolExecution as ToolExecution,
|
|
221
219
|
type ToolExecutionAttempt as ToolExecutionAttempt,
|
|
220
|
+
type ValueSchema as ValueSchema,
|
|
222
221
|
type ToolListResponse as ToolListResponse,
|
|
223
222
|
type ToolGetResponse as ToolGetResponse,
|
|
224
223
|
ToolListResponsesOffsetPage as ToolListResponsesOffsetPage,
|
|
225
224
|
type ToolListParams as ToolListParams,
|
|
226
225
|
type ToolAuthorizeParams as ToolAuthorizeParams,
|
|
227
226
|
type ToolExecuteParams as ToolExecuteParams,
|
|
228
|
-
type ToolGetParams as ToolGetParams,
|
|
229
227
|
};
|
|
230
228
|
|
|
231
|
-
export type
|
|
229
|
+
export type AuthAuthorizationContext = API.AuthAuthorizationContext;
|
|
230
|
+
export type AuthAuthorizationResponse = API.AuthAuthorizationResponse;
|
|
232
231
|
export type Error = API.Error;
|
|
233
232
|
}
|
|
234
233
|
|
package/src/resources/auth.ts
CHANGED
|
@@ -1,17 +1,64 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../resource';
|
|
4
|
-
import * as Core from '../core';
|
|
5
4
|
import * as Shared from './shared';
|
|
5
|
+
import * as Core from '../core';
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_LONGPOLL_WAIT_TIME = 45;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Error thrown when authorization-related operations fail
|
|
11
|
+
*/
|
|
12
|
+
export class AuthorizationError extends Error {
|
|
13
|
+
constructor(message: string) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'AuthorizationError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
6
18
|
|
|
7
19
|
export class Auth extends APIResource {
|
|
20
|
+
/**
|
|
21
|
+
* Starts the authorization process for a given provider and scopes.
|
|
22
|
+
* @param userId - The user ID for which authorization is being requested
|
|
23
|
+
* @param provider - The authorization provider (e.g., 'github', 'google', 'linkedin', 'microsoft', 'slack', 'spotify', 'x', 'zoom')
|
|
24
|
+
* @param options - Optional parameters
|
|
25
|
+
* @param options.providerType - The type of authorization provider. Defaults to 'oauth2'
|
|
26
|
+
* @param options.scopes - A list of scopes required for authorization, if any. Defaults to []
|
|
27
|
+
* @returns The authorization response
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* ```ts
|
|
31
|
+
* const authResponse = await client.auth.start("user@example.com", "github");
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
start(
|
|
35
|
+
userId: string,
|
|
36
|
+
provider: string,
|
|
37
|
+
options: AuthStartOptions = {},
|
|
38
|
+
): Core.APIPromise<Shared.AuthAuthorizationResponse> {
|
|
39
|
+
const { providerType = 'oauth2', scopes = [] } = options;
|
|
40
|
+
|
|
41
|
+
const authRequirement: AuthAuthorizeParams.AuthRequirement = {
|
|
42
|
+
provider_id: provider,
|
|
43
|
+
provider_type: providerType,
|
|
44
|
+
oauth2: {
|
|
45
|
+
scopes,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return this.authorize({
|
|
50
|
+
auth_requirement: authRequirement,
|
|
51
|
+
user_id: userId,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
8
55
|
/**
|
|
9
56
|
* Starts the authorization process for given authorization requirements
|
|
10
57
|
*/
|
|
11
58
|
authorize(
|
|
12
59
|
body: AuthAuthorizeParams,
|
|
13
60
|
options?: Core.RequestOptions,
|
|
14
|
-
): Core.APIPromise<Shared.
|
|
61
|
+
): Core.APIPromise<Shared.AuthAuthorizationResponse> {
|
|
15
62
|
return this._client.post('/v1/auth/authorize', { body, ...options });
|
|
16
63
|
}
|
|
17
64
|
|
|
@@ -23,9 +70,55 @@ export class Auth extends APIResource {
|
|
|
23
70
|
status(
|
|
24
71
|
query: AuthStatusParams,
|
|
25
72
|
options?: Core.RequestOptions,
|
|
26
|
-
): Core.APIPromise<Shared.
|
|
73
|
+
): Core.APIPromise<Shared.AuthAuthorizationResponse> {
|
|
27
74
|
return this._client.get('/v1/auth/status', { query, ...options });
|
|
28
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Waits for the authorization process to complete.
|
|
79
|
+
* @param authResponseOrId - The authorization response or ID to wait for completion
|
|
80
|
+
* @returns The completed authorization response
|
|
81
|
+
* @throws {AuthorizationError} When the authorization ID is missing or invalid
|
|
82
|
+
*
|
|
83
|
+
* Example:
|
|
84
|
+
* ```ts
|
|
85
|
+
* const authResponse = await client.auth.start("user@example.com", "github");
|
|
86
|
+
* try {
|
|
87
|
+
* const completedAuth = await client.auth.waitForCompletion(authResponse);
|
|
88
|
+
* console.log('Authorization completed:', completedAuth);
|
|
89
|
+
* } catch (error) {
|
|
90
|
+
* if (error instanceof AuthorizationError) {
|
|
91
|
+
* console.error('Authorization failed:', error.message);
|
|
92
|
+
* }
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
async waitForCompletion(
|
|
97
|
+
authResponseOrId: Shared.AuthAuthorizationResponse | string,
|
|
98
|
+
): Promise<Shared.AuthAuthorizationResponse> {
|
|
99
|
+
let authId: string;
|
|
100
|
+
let authResponse: Shared.AuthAuthorizationResponse;
|
|
101
|
+
|
|
102
|
+
if (typeof authResponseOrId === 'string') {
|
|
103
|
+
authId = authResponseOrId;
|
|
104
|
+
authResponse = { status: 'pending' } as Shared.AuthAuthorizationResponse;
|
|
105
|
+
} else {
|
|
106
|
+
if (!authResponseOrId.id) {
|
|
107
|
+
throw new AuthorizationError('Authorization ID is required');
|
|
108
|
+
}
|
|
109
|
+
authId = authResponseOrId.id;
|
|
110
|
+
authResponse = authResponseOrId;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
while (authResponse.status !== 'completed') {
|
|
114
|
+
authResponse = await this.status({
|
|
115
|
+
id: authId,
|
|
116
|
+
wait: DEFAULT_LONGPOLL_WAIT_TIME,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return authResponse;
|
|
121
|
+
}
|
|
29
122
|
}
|
|
30
123
|
|
|
31
124
|
export interface AuthRequest {
|
|
@@ -36,8 +129,16 @@ export interface AuthRequest {
|
|
|
36
129
|
|
|
37
130
|
export namespace AuthRequest {
|
|
38
131
|
export interface AuthRequirement {
|
|
132
|
+
/**
|
|
133
|
+
* one of ID or ProviderID must be set
|
|
134
|
+
*/
|
|
135
|
+
id?: string;
|
|
136
|
+
|
|
39
137
|
oauth2?: AuthRequirement.Oauth2;
|
|
40
138
|
|
|
139
|
+
/**
|
|
140
|
+
* one of ID or ProviderID must be set
|
|
141
|
+
*/
|
|
41
142
|
provider_id?: string;
|
|
42
143
|
|
|
43
144
|
provider_type?: string;
|
|
@@ -58,8 +159,16 @@ export interface AuthAuthorizeParams {
|
|
|
58
159
|
|
|
59
160
|
export namespace AuthAuthorizeParams {
|
|
60
161
|
export interface AuthRequirement {
|
|
162
|
+
/**
|
|
163
|
+
* one of ID or ProviderID must be set
|
|
164
|
+
*/
|
|
165
|
+
id?: string;
|
|
166
|
+
|
|
61
167
|
oauth2?: AuthRequirement.Oauth2;
|
|
62
168
|
|
|
169
|
+
/**
|
|
170
|
+
* one of ID or ProviderID must be set
|
|
171
|
+
*/
|
|
63
172
|
provider_id?: string;
|
|
64
173
|
|
|
65
174
|
provider_type?: string;
|
|
@@ -76,17 +185,26 @@ export interface AuthStatusParams {
|
|
|
76
185
|
/**
|
|
77
186
|
* Authorization ID
|
|
78
187
|
*/
|
|
79
|
-
|
|
188
|
+
id: string;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Timeout in seconds (max 59)
|
|
192
|
+
*/
|
|
193
|
+
wait?: number;
|
|
194
|
+
}
|
|
80
195
|
|
|
196
|
+
export interface AuthStartOptions {
|
|
81
197
|
/**
|
|
82
|
-
*
|
|
198
|
+
* The type of authorization provider
|
|
199
|
+
* @default 'oauth2'
|
|
83
200
|
*/
|
|
84
|
-
|
|
201
|
+
providerType?: string;
|
|
85
202
|
|
|
86
203
|
/**
|
|
87
|
-
*
|
|
204
|
+
* A list of scopes required for authorization
|
|
205
|
+
* @default []
|
|
88
206
|
*/
|
|
89
|
-
|
|
207
|
+
scopes?: string[];
|
|
90
208
|
}
|
|
91
209
|
|
|
92
210
|
export declare namespace Auth {
|
|
@@ -94,5 +212,6 @@ export declare namespace Auth {
|
|
|
94
212
|
type AuthRequest as AuthRequest,
|
|
95
213
|
type AuthAuthorizeParams as AuthAuthorizeParams,
|
|
96
214
|
type AuthStatusParams as AuthStatusParams,
|
|
215
|
+
type AuthStartOptions as AuthStartOptions,
|
|
97
216
|
};
|
|
98
217
|
}
|
|
@@ -88,7 +88,7 @@ export interface ChatRequest {
|
|
|
88
88
|
|
|
89
89
|
presence_penalty?: number;
|
|
90
90
|
|
|
91
|
-
response_format?:
|
|
91
|
+
response_format?: ChatRequest.ResponseFormat;
|
|
92
92
|
|
|
93
93
|
seed?: number;
|
|
94
94
|
|
|
@@ -123,6 +123,10 @@ export interface ChatRequest {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
export namespace ChatRequest {
|
|
126
|
+
export interface ResponseFormat {
|
|
127
|
+
type?: 'json_object' | 'text';
|
|
128
|
+
}
|
|
129
|
+
|
|
126
130
|
/**
|
|
127
131
|
* Options for streaming response. Only set this when you set stream: true.
|
|
128
132
|
*/
|
|
@@ -162,7 +166,7 @@ export interface Choice {
|
|
|
162
166
|
|
|
163
167
|
message?: ChatMessage;
|
|
164
168
|
|
|
165
|
-
tool_authorizations?: Array<Shared.
|
|
169
|
+
tool_authorizations?: Array<Shared.AuthAuthorizationResponse>;
|
|
166
170
|
|
|
167
171
|
tool_messages?: Array<ChatMessage>;
|
|
168
172
|
}
|
|
@@ -47,7 +47,7 @@ export interface CompletionCreateParams {
|
|
|
47
47
|
|
|
48
48
|
presence_penalty?: number;
|
|
49
49
|
|
|
50
|
-
response_format?:
|
|
50
|
+
response_format?: CompletionCreateParams.ResponseFormat;
|
|
51
51
|
|
|
52
52
|
seed?: number;
|
|
53
53
|
|
|
@@ -82,6 +82,10 @@ export interface CompletionCreateParams {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export namespace CompletionCreateParams {
|
|
85
|
+
export interface ResponseFormat {
|
|
86
|
+
type?: 'json_object' | 'text';
|
|
87
|
+
}
|
|
88
|
+
|
|
85
89
|
/**
|
|
86
90
|
* Options for streaming response. Only set this when you set stream: true.
|
|
87
91
|
*/
|
package/src/resources/index.ts
CHANGED
|
@@ -12,18 +12,18 @@ export {
|
|
|
12
12
|
} from './chat/chat';
|
|
13
13
|
export { Health, type HealthSchema } from './health';
|
|
14
14
|
export {
|
|
15
|
+
ToolExecutionsOffsetPage,
|
|
15
16
|
ToolListResponsesOffsetPage,
|
|
16
17
|
Tools,
|
|
17
18
|
type AuthorizeToolRequest,
|
|
18
19
|
type ExecuteToolRequest,
|
|
19
20
|
type ExecuteToolResponse,
|
|
20
|
-
type ResponseOutput,
|
|
21
21
|
type ToolExecution,
|
|
22
22
|
type ToolExecutionAttempt,
|
|
23
|
+
type ValueSchema,
|
|
23
24
|
type ToolListResponse,
|
|
24
25
|
type ToolGetResponse,
|
|
25
26
|
type ToolListParams,
|
|
26
27
|
type ToolAuthorizeParams,
|
|
27
28
|
type ToolExecuteParams,
|
|
28
|
-
type ToolGetParams,
|
|
29
29
|
} from './tools/tools';
|
package/src/resources/shared.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export interface
|
|
4
|
-
|
|
3
|
+
export interface AuthAuthorizationContext {
|
|
4
|
+
token?: string;
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
user_info?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface AuthAuthorizationResponse {
|
|
10
|
+
id?: string;
|
|
7
11
|
|
|
8
|
-
context?:
|
|
12
|
+
context?: AuthAuthorizationContext;
|
|
9
13
|
|
|
10
14
|
provider_id?: string;
|
|
11
15
|
|
|
@@ -13,15 +17,9 @@ export interface AuthorizationResponse {
|
|
|
13
17
|
|
|
14
18
|
status?: 'pending' | 'completed' | 'failed';
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export namespace AuthorizationResponse {
|
|
20
|
-
export interface Context {
|
|
21
|
-
token?: string;
|
|
20
|
+
url?: string;
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
}
|
|
22
|
+
user_id?: string;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
export interface Error {
|
|
@@ -24,7 +24,7 @@ export class Formatted extends APIResource {
|
|
|
24
24
|
if (isRequestOptions(query)) {
|
|
25
25
|
return this.list({}, query);
|
|
26
26
|
}
|
|
27
|
-
return this._client.getAPIList('/v1/
|
|
27
|
+
return this._client.getAPIList('/v1/formatted_tools', FormattedListResponsesOffsetPage, {
|
|
28
28
|
query,
|
|
29
29
|
...options,
|
|
30
30
|
});
|
|
@@ -33,8 +33,17 @@ export class Formatted extends APIResource {
|
|
|
33
33
|
/**
|
|
34
34
|
* Returns the formatted tool specification for a specific tool, given a provider
|
|
35
35
|
*/
|
|
36
|
-
get(
|
|
37
|
-
|
|
36
|
+
get(name: string, query?: FormattedGetParams, options?: Core.RequestOptions): Core.APIPromise<unknown>;
|
|
37
|
+
get(name: string, options?: Core.RequestOptions): Core.APIPromise<unknown>;
|
|
38
|
+
get(
|
|
39
|
+
name: string,
|
|
40
|
+
query: FormattedGetParams | Core.RequestOptions = {},
|
|
41
|
+
options?: Core.RequestOptions,
|
|
42
|
+
): Core.APIPromise<unknown> {
|
|
43
|
+
if (isRequestOptions(query)) {
|
|
44
|
+
return this.get(name, {}, query);
|
|
45
|
+
}
|
|
46
|
+
return this._client.get(`/v1/formatted_tools/${name}`, { query, ...options });
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
|
|
@@ -57,11 +66,6 @@ export interface FormattedListParams extends OffsetPageParams {
|
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
export interface FormattedGetParams {
|
|
60
|
-
/**
|
|
61
|
-
* Tool ID
|
|
62
|
-
*/
|
|
63
|
-
toolId: string;
|
|
64
|
-
|
|
65
69
|
/**
|
|
66
70
|
* Provider format
|
|
67
71
|
*/
|
|
@@ -8,20 +8,20 @@ export {
|
|
|
8
8
|
type FormattedListParams,
|
|
9
9
|
type FormattedGetParams,
|
|
10
10
|
} from './formatted';
|
|
11
|
-
export { Scheduled, type
|
|
11
|
+
export { Scheduled, type ScheduledGetResponse, type ScheduledListParams } from './scheduled';
|
|
12
12
|
export {
|
|
13
|
+
ToolExecutionsOffsetPage,
|
|
13
14
|
ToolListResponsesOffsetPage,
|
|
14
15
|
Tools,
|
|
15
16
|
type AuthorizeToolRequest,
|
|
16
17
|
type ExecuteToolRequest,
|
|
17
18
|
type ExecuteToolResponse,
|
|
18
|
-
type ResponseOutput,
|
|
19
19
|
type ToolExecution,
|
|
20
20
|
type ToolExecutionAttempt,
|
|
21
|
+
type ValueSchema,
|
|
21
22
|
type ToolListResponse,
|
|
22
23
|
type ToolGetResponse,
|
|
23
24
|
type ToolListParams,
|
|
24
25
|
type ToolAuthorizeParams,
|
|
25
26
|
type ToolExecuteParams,
|
|
26
|
-
type ToolGetParams,
|
|
27
27
|
} from './tools';
|
|
@@ -1,55 +1,57 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
|
+
import { isRequestOptions } from '../../core';
|
|
4
5
|
import * as Core from '../../core';
|
|
5
6
|
import * as ToolsAPI from './tools';
|
|
7
|
+
import { ToolExecutionsOffsetPage } from './tools';
|
|
8
|
+
import { type OffsetPageParams } from '../../pagination';
|
|
6
9
|
|
|
7
10
|
export class Scheduled extends APIResource {
|
|
8
11
|
/**
|
|
9
12
|
* Returns a page of scheduled tool executions
|
|
10
13
|
*/
|
|
11
|
-
list(
|
|
12
|
-
|
|
14
|
+
list(
|
|
15
|
+
query?: ScheduledListParams,
|
|
16
|
+
options?: Core.RequestOptions,
|
|
17
|
+
): Core.PagePromise<ToolExecutionsOffsetPage, ToolsAPI.ToolExecution>;
|
|
18
|
+
list(options?: Core.RequestOptions): Core.PagePromise<ToolExecutionsOffsetPage, ToolsAPI.ToolExecution>;
|
|
19
|
+
list(
|
|
20
|
+
query: ScheduledListParams | Core.RequestOptions = {},
|
|
21
|
+
options?: Core.RequestOptions,
|
|
22
|
+
): Core.PagePromise<ToolExecutionsOffsetPage, ToolsAPI.ToolExecution> {
|
|
23
|
+
if (isRequestOptions(query)) {
|
|
24
|
+
return this.list({}, query);
|
|
25
|
+
}
|
|
26
|
+
return this._client.getAPIList('/v1/scheduled_tools', ToolExecutionsOffsetPage, { query, ...options });
|
|
13
27
|
}
|
|
14
28
|
|
|
15
29
|
/**
|
|
16
30
|
* Returns the details for a specific scheduled tool execution
|
|
17
31
|
*/
|
|
18
|
-
|
|
19
|
-
return this._client.get(`/v1/
|
|
32
|
+
get(id: string, options?: Core.RequestOptions): Core.APIPromise<ScheduledGetResponse> {
|
|
33
|
+
return this._client.get(`/v1/scheduled_tools/${id}`, options);
|
|
20
34
|
}
|
|
21
35
|
}
|
|
22
36
|
|
|
23
|
-
export interface
|
|
24
|
-
items?: Array<ToolsAPI.ToolExecution>;
|
|
25
|
-
|
|
26
|
-
limit?: number;
|
|
27
|
-
|
|
28
|
-
offset?: number;
|
|
29
|
-
|
|
30
|
-
page_count?: number;
|
|
31
|
-
|
|
32
|
-
total_count?: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ScheduledDetailsResponse {
|
|
37
|
+
export interface ScheduledGetResponse {
|
|
36
38
|
id?: string;
|
|
37
39
|
|
|
38
40
|
attempts?: Array<ToolsAPI.ToolExecutionAttempt>;
|
|
39
41
|
|
|
40
|
-
created_at?:
|
|
42
|
+
created_at?: string;
|
|
41
43
|
|
|
42
44
|
execution_status?: string;
|
|
43
45
|
|
|
44
46
|
execution_type?: string;
|
|
45
47
|
|
|
46
|
-
finished_at?:
|
|
48
|
+
finished_at?: string;
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
input?: Record<string, unknown>;
|
|
49
51
|
|
|
50
|
-
run_at?:
|
|
52
|
+
run_at?: string;
|
|
51
53
|
|
|
52
|
-
started_at?:
|
|
54
|
+
started_at?: string;
|
|
53
55
|
|
|
54
56
|
tool_name?: string;
|
|
55
57
|
|
|
@@ -57,36 +59,18 @@ export interface ScheduledDetailsResponse {
|
|
|
57
59
|
|
|
58
60
|
toolkit_version?: string;
|
|
59
61
|
|
|
60
|
-
updated_at?:
|
|
62
|
+
updated_at?: string;
|
|
61
63
|
|
|
62
64
|
user_id?: string;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
export
|
|
66
|
-
export interface CreatedAt {
|
|
67
|
-
'time.Time'?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface FinishedAt {
|
|
71
|
-
'time.Time'?: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface RunAt {
|
|
75
|
-
'time.Time'?: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface StartedAt {
|
|
79
|
-
'time.Time'?: string;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface UpdatedAt {
|
|
83
|
-
'time.Time'?: string;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
67
|
+
export interface ScheduledListParams extends OffsetPageParams {}
|
|
86
68
|
|
|
87
69
|
export declare namespace Scheduled {
|
|
88
70
|
export {
|
|
89
|
-
type
|
|
90
|
-
type
|
|
71
|
+
type ScheduledGetResponse as ScheduledGetResponse,
|
|
72
|
+
type ScheduledListParams as ScheduledListParams,
|
|
91
73
|
};
|
|
92
74
|
}
|
|
75
|
+
|
|
76
|
+
export { ToolExecutionsOffsetPage };
|