@arcadeai/arcadejs 0.2.2 → 1.0.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +3 -4
  3. package/core.d.ts.map +1 -1
  4. package/core.js +10 -1
  5. package/core.js.map +1 -1
  6. package/core.mjs +10 -1
  7. package/core.mjs.map +1 -1
  8. package/index.d.mts +9 -8
  9. package/index.d.ts +9 -8
  10. package/index.d.ts.map +1 -1
  11. package/index.js +3 -3
  12. package/index.js.map +1 -1
  13. package/index.mjs +4 -4
  14. package/index.mjs.map +1 -1
  15. package/package.json +2 -2
  16. package/resources/auth.d.ts +71 -7
  17. package/resources/auth.d.ts.map +1 -1
  18. package/resources/auth.js +81 -1
  19. package/resources/auth.js.map +1 -1
  20. package/resources/auth.mjs +79 -0
  21. package/resources/auth.mjs.map +1 -1
  22. package/resources/chat/chat.d.ts +4 -1
  23. package/resources/chat/chat.d.ts.map +1 -1
  24. package/resources/chat/chat.js.map +1 -1
  25. package/resources/chat/chat.mjs.map +1 -1
  26. package/resources/chat/completions.d.ts +4 -1
  27. package/resources/chat/completions.d.ts.map +1 -1
  28. package/resources/index.d.ts +1 -1
  29. package/resources/index.d.ts.map +1 -1
  30. package/resources/index.js +3 -2
  31. package/resources/index.js.map +1 -1
  32. package/resources/index.mjs +1 -1
  33. package/resources/index.mjs.map +1 -1
  34. package/resources/shared.d.ts +7 -9
  35. package/resources/shared.d.ts.map +1 -1
  36. package/resources/tools/formatted.d.ts +2 -5
  37. package/resources/tools/formatted.d.ts.map +1 -1
  38. package/resources/tools/formatted.js +6 -6
  39. package/resources/tools/formatted.js.map +1 -1
  40. package/resources/tools/formatted.mjs +6 -6
  41. package/resources/tools/formatted.mjs.map +1 -1
  42. package/resources/tools/index.d.ts +2 -2
  43. package/resources/tools/index.d.ts.map +1 -1
  44. package/resources/tools/index.js +3 -2
  45. package/resources/tools/index.js.map +1 -1
  46. package/resources/tools/index.mjs +1 -1
  47. package/resources/tools/index.mjs.map +1 -1
  48. package/resources/tools/scheduled.d.ts +15 -33
  49. package/resources/tools/scheduled.d.ts.map +1 -1
  50. package/resources/tools/scheduled.js +11 -8
  51. package/resources/tools/scheduled.js.map +1 -1
  52. package/resources/tools/scheduled.mjs +10 -7
  53. package/resources/tools/scheduled.mjs.map +1 -1
  54. package/resources/tools/tools.d.ts +86 -186
  55. package/resources/tools/tools.d.ts.map +1 -1
  56. package/resources/tools/tools.js +10 -7
  57. package/resources/tools/tools.js.map +1 -1
  58. package/resources/tools/tools.mjs +7 -5
  59. package/resources/tools/tools.mjs.map +1 -1
  60. package/src/core.ts +11 -1
  61. package/src/index.ts +15 -18
  62. package/src/resources/auth.ts +125 -6
  63. package/src/resources/chat/chat.ts +5 -1
  64. package/src/resources/chat/completions.ts +5 -1
  65. package/src/resources/index.ts +4 -5
  66. package/src/resources/shared.ts +10 -12
  67. package/src/resources/tools/formatted.ts +12 -8
  68. package/src/resources/tools/index.ts +5 -6
  69. package/src/resources/tools/scheduled.ts +30 -46
  70. package/src/resources/tools/tools.ts +100 -238
  71. package/src/version.ts +1 -1
  72. package/version.d.ts +1 -1
  73. package/version.js +1 -1
  74. package/version.mjs +1 -1
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../../resource';
4
4
  import { isRequestOptions } from '../../core';
5
5
  import * as Core from '../../core';
6
+ import * as ToolsAPI from './tools';
6
7
  import * as Shared from '../shared';
7
8
  import * as FormattedAPI from './formatted';
8
9
  import {
@@ -14,7 +15,7 @@ import {
14
15
  FormattedListResponsesOffsetPage,
15
16
  } from './formatted';
16
17
  import * as ScheduledAPI from './scheduled';
17
- import { Scheduled, ScheduledDetailsResponse, ScheduledListResponse } from './scheduled';
18
+ import { Scheduled, ScheduledGetResponse, ScheduledListParams } from './scheduled';
18
19
  import { OffsetPage, type OffsetPageParams } from '../../pagination';
19
20
 
20
21
  export class Tools extends APIResource {
@@ -28,16 +29,16 @@ export class Tools extends APIResource {
28
29
  list(
29
30
  query?: ToolListParams,
30
31
  options?: Core.RequestOptions,
31
- ): Core.PagePromise<ToolListResponsesOffsetPage, ToolListResponse>;
32
- list(options?: Core.RequestOptions): Core.PagePromise<ToolListResponsesOffsetPage, ToolListResponse>;
32
+ ): Core.PagePromise<ToolDefinitionsOffsetPage, ToolDefinition>;
33
+ list(options?: Core.RequestOptions): Core.PagePromise<ToolDefinitionsOffsetPage, ToolDefinition>;
33
34
  list(
34
35
  query: ToolListParams | Core.RequestOptions = {},
35
36
  options?: Core.RequestOptions,
36
- ): Core.PagePromise<ToolListResponsesOffsetPage, ToolListResponse> {
37
+ ): Core.PagePromise<ToolDefinitionsOffsetPage, ToolDefinition> {
37
38
  if (isRequestOptions(query)) {
38
39
  return this.list({}, query);
39
40
  }
40
- return this._client.getAPIList('/v1/tools/list', ToolListResponsesOffsetPage, { query, ...options });
41
+ return this._client.getAPIList('/v1/tools', ToolDefinitionsOffsetPage, { query, ...options });
41
42
  }
42
43
 
43
44
  /**
@@ -60,22 +61,27 @@ export class Tools extends APIResource {
60
61
  /**
61
62
  * Returns the arcade tool specification for a specific tool
62
63
  */
63
- get(query: ToolGetParams, options?: Core.RequestOptions): Core.APIPromise<ToolGetResponse> {
64
- return this._client.get('/v1/tools/definition', { query, ...options });
64
+ get(name: string, options?: Core.RequestOptions): Core.APIPromise<ToolDefinition> {
65
+ return this._client.get(`/v1/tools/${name}`, options);
65
66
  }
66
67
  }
67
68
 
68
- export class ToolListResponsesOffsetPage extends OffsetPage<ToolListResponse> {}
69
+ export class ToolDefinitionsOffsetPage extends OffsetPage<ToolDefinition> {}
70
+
71
+ export class ToolExecutionsOffsetPage extends OffsetPage<ToolExecution> {}
69
72
 
70
73
  export interface AuthorizeToolRequest {
71
74
  tool_name: string;
72
75
 
73
- user_id: string;
74
-
75
76
  /**
76
77
  * Optional: if not provided, any version is used
77
78
  */
78
79
  tool_version?: string;
80
+
81
+ /**
82
+ * Required only when calling with an API key
83
+ */
84
+ user_id?: string;
79
85
  }
80
86
 
81
87
  export interface ExecuteToolRequest {
@@ -84,13 +90,13 @@ export interface ExecuteToolRequest {
84
90
  /**
85
91
  * JSON input to the tool, if any
86
92
  */
87
- inputs?: unknown;
93
+ input?: Record<string, unknown>;
88
94
 
89
95
  /**
90
96
  * The time at which the tool should be run (optional). If not provided, the tool
91
97
  * is run immediately
92
98
  */
93
- run_at?: ExecuteToolRequest.RunAt;
99
+ run_at?: string;
94
100
 
95
101
  /**
96
102
  * The tool version to use (optional). If not provided, any version is used
@@ -100,30 +106,20 @@ export interface ExecuteToolRequest {
100
106
  user_id?: string;
101
107
  }
102
108
 
103
- export namespace ExecuteToolRequest {
104
- /**
105
- * The time at which the tool should be run (optional). If not provided, the tool
106
- * is run immediately
107
- */
108
- export interface RunAt {
109
- 'time.Time'?: string;
110
- }
111
- }
112
-
113
109
  export interface ExecuteToolResponse {
114
110
  id?: string;
115
111
 
116
112
  duration?: number;
117
113
 
118
- execution_type?: string;
114
+ execution_id?: string;
119
115
 
120
- finished_at?: ExecuteToolResponse.FinishedAt;
116
+ execution_type?: string;
121
117
 
122
- invocation_id?: string;
118
+ finished_at?: string;
123
119
 
124
- output?: ResponseOutput;
120
+ output?: ExecuteToolResponse.Output;
125
121
 
126
- run_at?: ExecuteToolResponse.RunAt;
122
+ run_at?: string;
127
123
 
128
124
  status?: string;
129
125
 
@@ -136,135 +132,55 @@ export interface ExecuteToolResponse {
136
132
  }
137
133
 
138
134
  export namespace ExecuteToolResponse {
139
- export interface FinishedAt {
140
- 'time.Time'?: string;
141
- }
142
-
143
- export interface RunAt {
144
- 'time.Time'?: string;
145
- }
146
- }
147
-
148
- export interface ResponseOutput {
149
- error?: ResponseOutput.Error;
150
-
151
- requires_authorization?: Shared.AuthorizationResponse;
152
-
153
- value?: unknown;
154
- }
155
-
156
- export namespace ResponseOutput {
157
- export interface Error {
158
- message: string;
159
-
160
- additional_prompt_content?: string;
161
-
162
- can_retry?: boolean;
163
-
164
- developer_message?: string;
165
-
166
- retry_after_ms?: number;
167
- }
168
- }
169
-
170
- export interface ToolExecution {
171
- id?: string;
172
-
173
- created_at?: ToolExecution.CreatedAt;
174
-
175
- execution_status?: string;
176
-
177
- execution_type?: string;
178
-
179
- finished_at?: ToolExecution.FinishedAt;
180
-
181
- run_at?: ToolExecution.RunAt;
182
-
183
- started_at?: ToolExecution.StartedAt;
184
-
185
- tool_name?: string;
186
-
187
- toolkit_name?: string;
188
-
189
- toolkit_version?: string;
190
-
191
- updated_at?: ToolExecution.UpdatedAt;
192
-
193
- user_id?: string;
194
- }
195
-
196
- export namespace ToolExecution {
197
- export interface CreatedAt {
198
- 'time.Time'?: string;
199
- }
200
-
201
- export interface FinishedAt {
202
- 'time.Time'?: string;
203
- }
135
+ export interface Output {
136
+ authorization?: Shared.AuthorizationResponse;
204
137
 
205
- export interface RunAt {
206
- 'time.Time'?: string;
207
- }
138
+ error?: Output.Error;
208
139
 
209
- export interface StartedAt {
210
- 'time.Time'?: string;
140
+ value?: unknown;
211
141
  }
212
142
 
213
- export interface UpdatedAt {
214
- 'time.Time'?: string;
215
- }
216
- }
217
-
218
- export interface ToolExecutionAttempt {
219
- id?: string;
220
-
221
- finished_at?: ToolExecutionAttempt.FinishedAt;
222
-
223
- output?: ResponseOutput;
143
+ export namespace Output {
144
+ export interface Error {
145
+ message: string;
224
146
 
225
- started_at?: ToolExecutionAttempt.StartedAt;
147
+ additional_prompt_content?: string;
226
148
 
227
- success?: boolean;
149
+ can_retry?: boolean;
228
150
 
229
- system_error_message?: string;
230
- }
151
+ developer_message?: string;
231
152
 
232
- export namespace ToolExecutionAttempt {
233
- export interface FinishedAt {
234
- 'time.Time'?: string;
235
- }
236
-
237
- export interface StartedAt {
238
- 'time.Time'?: string;
153
+ retry_after_ms?: number;
154
+ }
239
155
  }
240
156
  }
241
157
 
242
- export interface ToolListResponse {
243
- inputs: ToolListResponse.Inputs;
158
+ export interface ToolDefinition {
159
+ input: ToolDefinition.Input;
244
160
 
245
161
  name: string;
246
162
 
247
- toolkit: ToolListResponse.Toolkit;
163
+ toolkit: ToolDefinition.Toolkit;
248
164
 
249
165
  description?: string;
250
166
 
251
167
  fully_qualified_name?: string;
252
168
 
253
- output?: ToolListResponse.Output;
169
+ output?: ToolDefinition.Output;
254
170
 
255
- requirements?: ToolListResponse.Requirements;
171
+ requirements?: ToolDefinition.Requirements;
256
172
  }
257
173
 
258
- export namespace ToolListResponse {
259
- export interface Inputs {
260
- parameters?: Array<Inputs.Parameter>;
174
+ export namespace ToolDefinition {
175
+ export interface Input {
176
+ parameters?: Array<Input.Parameter>;
261
177
  }
262
178
 
263
- export namespace Inputs {
179
+ export namespace Input {
264
180
  export interface Parameter {
265
181
  name: string;
266
182
 
267
- value_schema: Parameter.ValueSchema;
183
+ value_schema: ToolsAPI.ValueSchema;
268
184
 
269
185
  description?: string;
270
186
 
@@ -272,16 +188,6 @@ export namespace ToolListResponse {
272
188
 
273
189
  required?: boolean;
274
190
  }
275
-
276
- export namespace Parameter {
277
- export interface ValueSchema {
278
- val_type: string;
279
-
280
- enum?: Array<string>;
281
-
282
- inner_val_type?: string;
283
- }
284
- }
285
191
  }
286
192
 
287
193
  export interface Toolkit {
@@ -297,17 +203,7 @@ export namespace ToolListResponse {
297
203
 
298
204
  description?: string;
299
205
 
300
- value_schema?: Output.ValueSchema;
301
- }
302
-
303
- export namespace Output {
304
- export interface ValueSchema {
305
- val_type: string;
306
-
307
- enum?: Array<string>;
308
-
309
- inner_val_type?: string;
310
- }
206
+ value_schema?: ToolsAPI.ValueSchema;
311
207
  }
312
208
 
313
209
  export interface Requirements {
@@ -316,6 +212,8 @@ export namespace ToolListResponse {
316
212
 
317
213
  export namespace Requirements {
318
214
  export interface Authorization {
215
+ id?: string;
216
+
319
217
  oauth2?: Authorization.Oauth2;
320
218
 
321
219
  provider_id?: string;
@@ -331,96 +229,76 @@ export namespace ToolListResponse {
331
229
  }
332
230
  }
333
231
 
334
- export interface ToolGetResponse {
335
- inputs: ToolGetResponse.Inputs;
336
-
337
- name: string;
232
+ export interface ToolExecution {
233
+ id?: string;
338
234
 
339
- toolkit: ToolGetResponse.Toolkit;
235
+ created_at?: string;
340
236
 
341
- description?: string;
237
+ execution_status?: string;
342
238
 
343
- fully_qualified_name?: string;
239
+ execution_type?: string;
344
240
 
345
- output?: ToolGetResponse.Output;
241
+ finished_at?: string;
346
242
 
347
- requirements?: ToolGetResponse.Requirements;
348
- }
243
+ run_at?: string;
349
244
 
350
- export namespace ToolGetResponse {
351
- export interface Inputs {
352
- parameters?: Array<Inputs.Parameter>;
353
- }
245
+ started_at?: string;
354
246
 
355
- export namespace Inputs {
356
- export interface Parameter {
357
- name: string;
247
+ tool_name?: string;
358
248
 
359
- value_schema: Parameter.ValueSchema;
249
+ toolkit_name?: string;
360
250
 
361
- description?: string;
251
+ toolkit_version?: string;
362
252
 
363
- inferrable?: boolean;
253
+ updated_at?: string;
364
254
 
365
- required?: boolean;
366
- }
255
+ user_id?: string;
256
+ }
367
257
 
368
- export namespace Parameter {
369
- export interface ValueSchema {
370
- val_type: string;
258
+ export interface ToolExecutionAttempt {
259
+ id?: string;
371
260
 
372
- enum?: Array<string>;
261
+ finished_at?: string;
373
262
 
374
- inner_val_type?: string;
375
- }
376
- }
377
- }
263
+ output?: ToolExecutionAttempt.Output;
378
264
 
379
- export interface Toolkit {
380
- name: string;
265
+ started_at?: string;
381
266
 
382
- description?: string;
267
+ success?: boolean;
383
268
 
384
- version?: string;
385
- }
269
+ system_error_message?: string;
270
+ }
386
271
 
272
+ export namespace ToolExecutionAttempt {
387
273
  export interface Output {
388
- available_modes?: Array<string>;
274
+ authorization?: Shared.AuthorizationResponse;
389
275
 
390
- description?: string;
276
+ error?: Output.Error;
391
277
 
392
- value_schema?: Output.ValueSchema;
278
+ value?: unknown;
393
279
  }
394
280
 
395
281
  export namespace Output {
396
- export interface ValueSchema {
397
- val_type: string;
282
+ export interface Error {
283
+ message: string;
398
284
 
399
- enum?: Array<string>;
285
+ additional_prompt_content?: string;
400
286
 
401
- inner_val_type?: string;
402
- }
403
- }
287
+ can_retry?: boolean;
404
288
 
405
- export interface Requirements {
406
- authorization?: Requirements.Authorization;
407
- }
289
+ developer_message?: string;
408
290
 
409
- export namespace Requirements {
410
- export interface Authorization {
411
- oauth2?: Authorization.Oauth2;
291
+ retry_after_ms?: number;
292
+ }
293
+ }
294
+ }
412
295
 
413
- provider_id?: string;
296
+ export interface ValueSchema {
297
+ val_type: string;
414
298
 
415
- provider_type?: string;
416
- }
299
+ enum?: Array<string>;
417
300
 
418
- export namespace Authorization {
419
- export interface Oauth2 {
420
- scopes?: Array<string>;
421
- }
422
- }
423
- }
301
+ inner_val_type?: string;
424
302
  }
425
303
 
426
304
  export interface ToolListParams extends OffsetPageParams {
@@ -433,12 +311,15 @@ export interface ToolListParams extends OffsetPageParams {
433
311
  export interface ToolAuthorizeParams {
434
312
  tool_name: string;
435
313
 
436
- user_id: string;
437
-
438
314
  /**
439
315
  * Optional: if not provided, any version is used
440
316
  */
441
317
  tool_version?: string;
318
+
319
+ /**
320
+ * Required only when calling with an API key
321
+ */
322
+ user_id?: string;
442
323
  }
443
324
 
444
325
  export interface ToolExecuteParams {
@@ -447,13 +328,13 @@ export interface ToolExecuteParams {
447
328
  /**
448
329
  * JSON input to the tool, if any
449
330
  */
450
- inputs?: unknown;
331
+ input?: Record<string, unknown>;
451
332
 
452
333
  /**
453
334
  * The time at which the tool should be run (optional). If not provided, the tool
454
335
  * is run immediately
455
336
  */
456
- run_at?: ToolExecuteParams.RunAt;
337
+ run_at?: string;
457
338
 
458
339
  /**
459
340
  * The tool version to use (optional). If not provided, any version is used
@@ -463,24 +344,7 @@ export interface ToolExecuteParams {
463
344
  user_id?: string;
464
345
  }
465
346
 
466
- export namespace ToolExecuteParams {
467
- /**
468
- * The time at which the tool should be run (optional). If not provided, the tool
469
- * is run immediately
470
- */
471
- export interface RunAt {
472
- 'time.Time'?: string;
473
- }
474
- }
475
-
476
- export interface ToolGetParams {
477
- /**
478
- * Tool ID
479
- */
480
- toolId: string;
481
- }
482
-
483
- Tools.ToolListResponsesOffsetPage = ToolListResponsesOffsetPage;
347
+ Tools.ToolDefinitionsOffsetPage = ToolDefinitionsOffsetPage;
484
348
  Tools.Scheduled = Scheduled;
485
349
  Tools.Formatted = Formatted;
486
350
  Tools.FormattedListResponsesOffsetPage = FormattedListResponsesOffsetPage;
@@ -490,22 +354,20 @@ export declare namespace Tools {
490
354
  type AuthorizeToolRequest as AuthorizeToolRequest,
491
355
  type ExecuteToolRequest as ExecuteToolRequest,
492
356
  type ExecuteToolResponse as ExecuteToolResponse,
493
- type ResponseOutput as ResponseOutput,
357
+ type ToolDefinition as ToolDefinition,
494
358
  type ToolExecution as ToolExecution,
495
359
  type ToolExecutionAttempt as ToolExecutionAttempt,
496
- type ToolListResponse as ToolListResponse,
497
- type ToolGetResponse as ToolGetResponse,
498
- ToolListResponsesOffsetPage as ToolListResponsesOffsetPage,
360
+ type ValueSchema as ValueSchema,
361
+ ToolDefinitionsOffsetPage as ToolDefinitionsOffsetPage,
499
362
  type ToolListParams as ToolListParams,
500
363
  type ToolAuthorizeParams as ToolAuthorizeParams,
501
364
  type ToolExecuteParams as ToolExecuteParams,
502
- type ToolGetParams as ToolGetParams,
503
365
  };
504
366
 
505
367
  export {
506
368
  Scheduled as Scheduled,
507
- type ScheduledListResponse as ScheduledListResponse,
508
- type ScheduledDetailsResponse as ScheduledDetailsResponse,
369
+ type ScheduledGetResponse as ScheduledGetResponse,
370
+ type ScheduledListParams as ScheduledListParams,
509
371
  };
510
372
 
511
373
  export {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.2'; // x-release-please-version
1
+ export const VERSION = '1.0.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.2";
1
+ export declare const VERSION = "1.0.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.2.2'; // x-release-please-version
4
+ exports.VERSION = '1.0.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.2'; // x-release-please-version
1
+ export const VERSION = '1.0.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map