@runtypelabs/sdk 0.1.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/README.md +398 -0
- package/dist/batch-builder.d.ts +106 -0
- package/dist/batch-builder.d.ts.map +1 -0
- package/dist/batch-builder.js +124 -0
- package/dist/batch-builder.js.map +1 -0
- package/dist/batches-namespace.d.ts +132 -0
- package/dist/batches-namespace.d.ts.map +1 -0
- package/dist/batches-namespace.js +128 -0
- package/dist/batches-namespace.js.map +1 -0
- package/dist/client.d.ts +121 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +485 -0
- package/dist/client.js.map +1 -0
- package/dist/endpoints.d.ts +560 -0
- package/dist/endpoints.d.ts.map +1 -0
- package/dist/endpoints.js +725 -0
- package/dist/endpoints.js.map +1 -0
- package/dist/eval-builder.d.ts +216 -0
- package/dist/eval-builder.d.ts.map +1 -0
- package/dist/eval-builder.js +225 -0
- package/dist/eval-builder.js.map +1 -0
- package/dist/evals-namespace.d.ts +205 -0
- package/dist/evals-namespace.d.ts.map +1 -0
- package/dist/evals-namespace.js +208 -0
- package/dist/evals-namespace.js.map +1 -0
- package/dist/flow-builder.d.ts +620 -0
- package/dist/flow-builder.d.ts.map +1 -0
- package/dist/flow-builder.js +565 -0
- package/dist/flow-builder.js.map +1 -0
- package/dist/flow-result.d.ts +117 -0
- package/dist/flow-result.d.ts.map +1 -0
- package/dist/flow-result.js +175 -0
- package/dist/flow-result.js.map +1 -0
- package/dist/flows-namespace.d.ts +430 -0
- package/dist/flows-namespace.d.ts.map +1 -0
- package/dist/flows-namespace.js +679 -0
- package/dist/flows-namespace.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts-namespace.d.ts +236 -0
- package/dist/prompts-namespace.d.ts.map +1 -0
- package/dist/prompts-namespace.js +222 -0
- package/dist/prompts-namespace.js.map +1 -0
- package/dist/runtype.d.ts +232 -0
- package/dist/runtype.d.ts.map +1 -0
- package/dist/runtype.js +367 -0
- package/dist/runtype.js.map +1 -0
- package/dist/stream-utils.d.ts +58 -0
- package/dist/stream-utils.d.ts.map +1 -0
- package/dist/stream-utils.js +348 -0
- package/dist/stream-utils.js.map +1 -0
- package/dist/transform.d.ts +21 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/transform.js +170 -0
- package/dist/transform.js.map +1 -0
- package/dist/types.d.ts +626 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API endpoint handlers with automatic camelCase/snake_case transformation
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EvalEndpoint = exports.ToolsEndpoint = exports.ContextTemplatesEndpoint = exports.FlowStepsEndpoint = exports.AnalyticsEndpoint = exports.UsersEndpoint = exports.ChatEndpoint = exports.DispatchEndpoint = exports.ModelConfigsEndpoint = exports.ApiKeysEndpoint = exports.RecordsEndpoint = exports.PromptsEndpoint = exports.FlowsEndpoint = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Flows endpoint handlers
|
|
9
|
+
*/
|
|
10
|
+
class FlowsEndpoint {
|
|
11
|
+
constructor(client) {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* List all flows for the authenticated user
|
|
16
|
+
*/
|
|
17
|
+
async list(params) {
|
|
18
|
+
return this.client.get('/flows', params);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a specific flow by ID
|
|
22
|
+
*/
|
|
23
|
+
async get(id) {
|
|
24
|
+
const response = await this.client.get(`/flows/${id}`);
|
|
25
|
+
return response;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create a new flow
|
|
29
|
+
*/
|
|
30
|
+
async create(data) {
|
|
31
|
+
return this.client.post('/flows', data);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Update an existing flow
|
|
35
|
+
*/
|
|
36
|
+
async update(id, data) {
|
|
37
|
+
return this.client.put(`/flows/${id}`, data);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Delete a flow
|
|
41
|
+
*/
|
|
42
|
+
async delete(id) {
|
|
43
|
+
return this.client.delete(`/flows/${id}`);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Run a flow on all records of a specific type
|
|
47
|
+
*/
|
|
48
|
+
async runOnRecordType(id, recordType) {
|
|
49
|
+
return this.client.post(`/flows/${id}/run-on-record-type`, {
|
|
50
|
+
recordType
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Publish flow (promote draft to published)
|
|
55
|
+
*/
|
|
56
|
+
async publish(id) {
|
|
57
|
+
return this.client.post(`/flows/${id}/publish`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.FlowsEndpoint = FlowsEndpoint;
|
|
61
|
+
/**
|
|
62
|
+
* Prompts endpoint handlers
|
|
63
|
+
*/
|
|
64
|
+
class PromptsEndpoint {
|
|
65
|
+
constructor(client) {
|
|
66
|
+
this.client = client;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* List all prompts for the authenticated user
|
|
70
|
+
*/
|
|
71
|
+
async list(params) {
|
|
72
|
+
return this.client.get('/prompts', params);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get a specific prompt by ID
|
|
76
|
+
*/
|
|
77
|
+
async get(id) {
|
|
78
|
+
return this.client.get(`/prompts/${id}`);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create a new prompt
|
|
82
|
+
*/
|
|
83
|
+
async create(data) {
|
|
84
|
+
return this.client.post('/prompts', data);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Update an existing prompt
|
|
88
|
+
*/
|
|
89
|
+
async update(id, data) {
|
|
90
|
+
return this.client.put(`/prompts/${id}`, data);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Delete a prompt
|
|
94
|
+
*/
|
|
95
|
+
async delete(id) {
|
|
96
|
+
return this.client.delete(`/prompts/${id}`);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Run a prompt on a specific record
|
|
100
|
+
*/
|
|
101
|
+
async runOnRecord(id, recordId) {
|
|
102
|
+
return this.client.post(`/prompts/${id}/run-on-record`, { recordId });
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get flows using this prompt
|
|
106
|
+
*/
|
|
107
|
+
async getFlows(id) {
|
|
108
|
+
return this.client.get(`/prompts/${id}/flows`);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Update flow attachments for a prompt
|
|
112
|
+
*/
|
|
113
|
+
async updateFlows(id, flowIds) {
|
|
114
|
+
return this.client.put(`/prompts/${id}/flows`, { flowIds });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.PromptsEndpoint = PromptsEndpoint;
|
|
118
|
+
/**
|
|
119
|
+
* Records endpoint handlers
|
|
120
|
+
*/
|
|
121
|
+
class RecordsEndpoint {
|
|
122
|
+
constructor(client) {
|
|
123
|
+
this.client = client;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* List all records for the authenticated user
|
|
127
|
+
*/
|
|
128
|
+
async list(params) {
|
|
129
|
+
return this.client.get('/records', params);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get a specific record by ID
|
|
133
|
+
*/
|
|
134
|
+
async get(id) {
|
|
135
|
+
return this.client.get(`/records/${id}`);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Create a new record
|
|
139
|
+
*/
|
|
140
|
+
async create(data) {
|
|
141
|
+
return this.client.post('/records', data);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Update an existing record
|
|
145
|
+
*/
|
|
146
|
+
async update(id, data) {
|
|
147
|
+
return this.client.put(`/records/${id}`, data);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Delete a record
|
|
151
|
+
*/
|
|
152
|
+
async delete(id) {
|
|
153
|
+
return this.client.delete(`/records/${id}`);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Bulk delete multiple records
|
|
157
|
+
*/
|
|
158
|
+
async bulkDelete(ids) {
|
|
159
|
+
return this.client.post('/records/bulk-delete', { ids });
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Bulk edit multiple records
|
|
163
|
+
*/
|
|
164
|
+
async bulkEdit(data) {
|
|
165
|
+
return this.client.post('/records/bulk-edit', data);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get results for a record
|
|
169
|
+
*/
|
|
170
|
+
async getResults(id, params) {
|
|
171
|
+
return this.client.get(`/records/${id}/results`, params);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Delete a specific result for a record
|
|
175
|
+
*/
|
|
176
|
+
async deleteResult(id, resultId) {
|
|
177
|
+
return this.client.delete(`/records/${id}/results`, { resultId });
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Upload CSV file to create multiple records
|
|
181
|
+
*/
|
|
182
|
+
async uploadCsv(file, params) {
|
|
183
|
+
const formData = new FormData();
|
|
184
|
+
formData.append('file', file);
|
|
185
|
+
if (params?.typeColumn) {
|
|
186
|
+
formData.append('typeColumn', params.typeColumn);
|
|
187
|
+
}
|
|
188
|
+
if (params?.nameColumn) {
|
|
189
|
+
formData.append('nameColumn', params.nameColumn);
|
|
190
|
+
}
|
|
191
|
+
return this.client.postFormData('/records/upload-csv', formData);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get record types (distinct values)
|
|
195
|
+
*/
|
|
196
|
+
async getTypes() {
|
|
197
|
+
return this.client.get('/records?distinct=types');
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Get example record by type and/or name
|
|
201
|
+
*/
|
|
202
|
+
async getExample(params) {
|
|
203
|
+
return this.client.get('/records', {
|
|
204
|
+
...params,
|
|
205
|
+
includeFields: true,
|
|
206
|
+
limit: 1
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.RecordsEndpoint = RecordsEndpoint;
|
|
211
|
+
/**
|
|
212
|
+
* API Keys endpoint handlers
|
|
213
|
+
*/
|
|
214
|
+
class ApiKeysEndpoint {
|
|
215
|
+
constructor(client) {
|
|
216
|
+
this.client = client;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* List all API keys for the authenticated user
|
|
220
|
+
*/
|
|
221
|
+
async list() {
|
|
222
|
+
const response = await this.client.get('/api-keys');
|
|
223
|
+
return response.apiKeys;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get a specific API key by ID
|
|
227
|
+
*/
|
|
228
|
+
async get(id) {
|
|
229
|
+
return this.client.get(`/api-keys/${id}`);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Create a new API key
|
|
233
|
+
*/
|
|
234
|
+
async create(data) {
|
|
235
|
+
return this.client.post('/api-keys', data);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Update an existing API key
|
|
239
|
+
*/
|
|
240
|
+
async update(id, data) {
|
|
241
|
+
return this.client.put(`/api-keys/${id}`, data);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Delete an API key
|
|
245
|
+
*/
|
|
246
|
+
async delete(id) {
|
|
247
|
+
return this.client.delete(`/api-keys/${id}`);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Regenerate an API key
|
|
251
|
+
*/
|
|
252
|
+
async regenerate(id) {
|
|
253
|
+
return this.client.post(`/api-keys/${id}/regenerate`);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Get API key analytics
|
|
257
|
+
*/
|
|
258
|
+
async getAnalytics(id) {
|
|
259
|
+
return this.client.get(`/api-keys/${id}/analytics`);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Get usage logs for an API key
|
|
263
|
+
*/
|
|
264
|
+
async getUsage(id, params) {
|
|
265
|
+
return this.client.get(`/api-keys/${id}/usage`, params);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Get API key analytics (all keys or specific key)
|
|
269
|
+
*/
|
|
270
|
+
async getAnalyticsEnhanced(apiKeyId, params) {
|
|
271
|
+
const endpoint = apiKeyId === 'all'
|
|
272
|
+
? '/api-keys/analytics'
|
|
273
|
+
: `/api-keys/${apiKeyId}/analytics`;
|
|
274
|
+
return this.client.get(endpoint, params);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get API key usage logs (all keys or specific key)
|
|
278
|
+
*/
|
|
279
|
+
async getLogs(apiKeyId, params) {
|
|
280
|
+
const endpoint = apiKeyId === 'all'
|
|
281
|
+
? '/api-keys/logs'
|
|
282
|
+
: `/api-keys/${apiKeyId}/logs`;
|
|
283
|
+
return this.client.get(endpoint, params);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Get API key permission options
|
|
287
|
+
*/
|
|
288
|
+
async getPermissionOptions() {
|
|
289
|
+
return this.client.get('/api-keys/options');
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Get API key security logs
|
|
293
|
+
*/
|
|
294
|
+
async getSecurityLogs(id) {
|
|
295
|
+
return this.client.get(`/api-keys/${id}/security-logs`);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Update API key security settings
|
|
299
|
+
*/
|
|
300
|
+
async updateSecurity(id, data) {
|
|
301
|
+
return this.client.put(`/api-keys/${id}/security`, data);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Clear suspicious activity for API key
|
|
305
|
+
*/
|
|
306
|
+
async clearSuspiciousActivity(id) {
|
|
307
|
+
return this.client.post(`/api-keys/${id}/clear-suspicious`);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
exports.ApiKeysEndpoint = ApiKeysEndpoint;
|
|
311
|
+
/**
|
|
312
|
+
* Model Configurations endpoint handlers
|
|
313
|
+
*/
|
|
314
|
+
class ModelConfigsEndpoint {
|
|
315
|
+
constructor(client) {
|
|
316
|
+
this.client = client;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Get available models catalog
|
|
320
|
+
*/
|
|
321
|
+
async getAvailable() {
|
|
322
|
+
const response = await this.client.get('/model-configs/available');
|
|
323
|
+
// Handle both wrapped and direct array responses
|
|
324
|
+
return Array.isArray(response) ? response : response.data || [];
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Get search-capable models (all available, regardless of user configuration)
|
|
328
|
+
*/
|
|
329
|
+
async getSearchCapable() {
|
|
330
|
+
const response = await this.client.get('/model-configs/search-capable');
|
|
331
|
+
return response.data || [];
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Get configured search-capable models (only user's configured and enabled models)
|
|
335
|
+
*/
|
|
336
|
+
async getSearchConfigured() {
|
|
337
|
+
const response = await this.client.get('/model-configs/search-configured');
|
|
338
|
+
return response.data || [];
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* List user's model configurations
|
|
342
|
+
*/
|
|
343
|
+
async list() {
|
|
344
|
+
const response = await this.client.get('/model-configs');
|
|
345
|
+
// Handle both wrapped and direct array responses
|
|
346
|
+
return Array.isArray(response) ? response : response.data || [];
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Create a new model configuration
|
|
350
|
+
*/
|
|
351
|
+
async create(data) {
|
|
352
|
+
return this.client.post('/model-configs', data);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Update an existing model configuration
|
|
356
|
+
*/
|
|
357
|
+
async update(id, data) {
|
|
358
|
+
return this.client.put(`/model-configs/${id}`, data);
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Delete a model configuration
|
|
362
|
+
*/
|
|
363
|
+
async delete(id) {
|
|
364
|
+
return this.client.delete(`/model-configs/${id}`);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Enable/disable a model configuration
|
|
368
|
+
*/
|
|
369
|
+
async updateStatus(id, isEnabled) {
|
|
370
|
+
return this.client.patch(`/model-configs/${id}/status`, { isEnabled });
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Set a model configuration as default
|
|
374
|
+
*/
|
|
375
|
+
async setDefault(id) {
|
|
376
|
+
return this.client.patch(`/model-configs/${id}/default`);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Get usage statistics
|
|
380
|
+
*/
|
|
381
|
+
async getUsage() {
|
|
382
|
+
return this.client.get('/model-configs/usage');
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
exports.ModelConfigsEndpoint = ModelConfigsEndpoint;
|
|
386
|
+
/**
|
|
387
|
+
* Dispatch endpoint handler for atomic record/flow creation and execution
|
|
388
|
+
*/
|
|
389
|
+
class DispatchEndpoint {
|
|
390
|
+
constructor(client) {
|
|
391
|
+
this.client = client;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Dispatch: create and/or execute flows on records atomically
|
|
395
|
+
*/
|
|
396
|
+
async execute(data) {
|
|
397
|
+
return this.client.post('/dispatch', data);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Dispatch with streaming response
|
|
401
|
+
*/
|
|
402
|
+
async executeStream(data) {
|
|
403
|
+
return this.client.requestStream('/dispatch', {
|
|
404
|
+
method: 'POST',
|
|
405
|
+
body: JSON.stringify(data)
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Resume paused flow execution
|
|
410
|
+
* API expects snake_case field names
|
|
411
|
+
*
|
|
412
|
+
* @param data.execution_id - The execution ID to resume
|
|
413
|
+
* @param data.tool_outputs - Tool outputs to inject into the flow
|
|
414
|
+
* @param data.stream_response - Whether to stream the response
|
|
415
|
+
* @param data.messages - Optional messages to override the original dispatch messages
|
|
416
|
+
*/
|
|
417
|
+
async resume(data) {
|
|
418
|
+
if (data.stream_response) {
|
|
419
|
+
return this.client.requestStream('/dispatch/resume', {
|
|
420
|
+
method: 'POST',
|
|
421
|
+
body: JSON.stringify(data)
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return this.client.post('/dispatch/resume', data);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
exports.DispatchEndpoint = DispatchEndpoint;
|
|
428
|
+
/**
|
|
429
|
+
* Chat endpoint handler
|
|
430
|
+
*/
|
|
431
|
+
class ChatEndpoint {
|
|
432
|
+
constructor(client) {
|
|
433
|
+
this.client = client;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Send a chat message
|
|
437
|
+
*/
|
|
438
|
+
async send(message) {
|
|
439
|
+
return this.client.post('/chat', { message });
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Send a chat message with streaming response
|
|
443
|
+
*/
|
|
444
|
+
async sendStream(message, options) {
|
|
445
|
+
return this.client.requestStream('/chat', {
|
|
446
|
+
method: 'POST',
|
|
447
|
+
body: JSON.stringify({ message, ...options })
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
exports.ChatEndpoint = ChatEndpoint;
|
|
452
|
+
/**
|
|
453
|
+
* Users endpoint handlers
|
|
454
|
+
*/
|
|
455
|
+
class UsersEndpoint {
|
|
456
|
+
constructor(client) {
|
|
457
|
+
this.client = client;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Get current user profile
|
|
461
|
+
*/
|
|
462
|
+
async getProfile() {
|
|
463
|
+
return this.client.get('/users/profile');
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Update user profile
|
|
467
|
+
*/
|
|
468
|
+
async updateProfile(data) {
|
|
469
|
+
return this.client.put('/users/profile', data);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
exports.UsersEndpoint = UsersEndpoint;
|
|
473
|
+
/**
|
|
474
|
+
* Analytics endpoint handlers
|
|
475
|
+
*/
|
|
476
|
+
class AnalyticsEndpoint {
|
|
477
|
+
constructor(client) {
|
|
478
|
+
this.client = client;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Get analytics stats
|
|
482
|
+
*/
|
|
483
|
+
async getStats(params) {
|
|
484
|
+
return this.client.get('/analytics/stats', params);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Get analytics executions
|
|
488
|
+
*/
|
|
489
|
+
async getExecutions(params) {
|
|
490
|
+
return this.client.get('/analytics/record-results', params);
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Get all record results (same as executions)
|
|
494
|
+
*/
|
|
495
|
+
async getAllRecordResults(params) {
|
|
496
|
+
return this.client.get('/analytics/record-results', params);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Get model usage analytics
|
|
500
|
+
*/
|
|
501
|
+
async getModelUsage(params) {
|
|
502
|
+
return this.client.get('/model-usage', params);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
exports.AnalyticsEndpoint = AnalyticsEndpoint;
|
|
506
|
+
/**
|
|
507
|
+
* Flow Steps endpoint handlers
|
|
508
|
+
*/
|
|
509
|
+
class FlowStepsEndpoint {
|
|
510
|
+
constructor(client) {
|
|
511
|
+
this.client = client;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Get flow steps for a flow
|
|
515
|
+
*/
|
|
516
|
+
async getByFlow(flowId) {
|
|
517
|
+
return this.client.get(`/flow-steps/flow/${flowId}`);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Get a specific flow step
|
|
521
|
+
*/
|
|
522
|
+
async get(id) {
|
|
523
|
+
return this.client.get(`/flow-steps/${id}`);
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Create a flow step
|
|
527
|
+
*/
|
|
528
|
+
async create(data) {
|
|
529
|
+
return this.client.post('/flow-steps', data);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Update a flow step
|
|
533
|
+
*/
|
|
534
|
+
async update(id, data) {
|
|
535
|
+
return this.client.put(`/flow-steps/${id}`, data);
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Delete a flow step
|
|
539
|
+
*/
|
|
540
|
+
async delete(id) {
|
|
541
|
+
return this.client.delete(`/flow-steps/${id}`);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Reorder flow steps
|
|
545
|
+
*/
|
|
546
|
+
async reorder(flowId, stepOrders) {
|
|
547
|
+
return this.client.post('/flow-steps/reorder', {
|
|
548
|
+
flowId,
|
|
549
|
+
stepOrders
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
exports.FlowStepsEndpoint = FlowStepsEndpoint;
|
|
554
|
+
/**
|
|
555
|
+
* Context Templates endpoint handlers
|
|
556
|
+
*/
|
|
557
|
+
class ContextTemplatesEndpoint {
|
|
558
|
+
constructor(client) {
|
|
559
|
+
this.client = client;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* List context templates
|
|
563
|
+
*/
|
|
564
|
+
async list(params) {
|
|
565
|
+
return this.client.get('/context-templates', params);
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Get a specific context template
|
|
569
|
+
*/
|
|
570
|
+
async get(id) {
|
|
571
|
+
return this.client.get(`/context-templates/${id}`);
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Create a context template
|
|
575
|
+
*/
|
|
576
|
+
async create(data) {
|
|
577
|
+
return this.client.post('/context-templates', data);
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Update a context template
|
|
581
|
+
*/
|
|
582
|
+
async update(id, data) {
|
|
583
|
+
return this.client.put(`/context-templates/${id}`, data);
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Delete a context template
|
|
587
|
+
*/
|
|
588
|
+
async delete(id) {
|
|
589
|
+
return this.client.delete(`/context-templates/${id}`);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
exports.ContextTemplatesEndpoint = ContextTemplatesEndpoint;
|
|
593
|
+
/**
|
|
594
|
+
* Tools endpoint handlers
|
|
595
|
+
*/
|
|
596
|
+
class ToolsEndpoint {
|
|
597
|
+
constructor(client) {
|
|
598
|
+
this.client = client;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* List all tools for the authenticated user
|
|
602
|
+
*/
|
|
603
|
+
async list(params) {
|
|
604
|
+
return this.client.get('/tools', params);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Get a specific tool by ID
|
|
608
|
+
*/
|
|
609
|
+
async get(id) {
|
|
610
|
+
return this.client.get(`/tools/${id}`);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Create a new tool
|
|
614
|
+
*/
|
|
615
|
+
async create(data) {
|
|
616
|
+
return this.client.post('/tools', data);
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Update an existing tool
|
|
620
|
+
*/
|
|
621
|
+
async update(id, data) {
|
|
622
|
+
return this.client.put(`/tools/${id}`, data);
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Delete a tool
|
|
626
|
+
*/
|
|
627
|
+
async delete(id) {
|
|
628
|
+
return this.client.delete(`/tools/${id}`);
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Execute a tool
|
|
632
|
+
*/
|
|
633
|
+
async execute(id, data) {
|
|
634
|
+
return this.client.post(`/tools/${id}/execute`, data);
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Execute a tool with streaming response
|
|
638
|
+
*/
|
|
639
|
+
async executeStream(id, data) {
|
|
640
|
+
return this.client.requestStream(`/tools/${id}/execute`, {
|
|
641
|
+
method: 'POST',
|
|
642
|
+
body: JSON.stringify(data)
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Test a tool (same as execute but for testing purposes)
|
|
647
|
+
*/
|
|
648
|
+
async test(id, data) {
|
|
649
|
+
return this.client.post(`/tools/${id}/test`, data);
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Get tool executions for a specific tool
|
|
653
|
+
*/
|
|
654
|
+
async getExecutions(toolId, params) {
|
|
655
|
+
return this.client.get(`/tools/${toolId}/executions`, params);
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Get AI SDK compatible tool schemas
|
|
659
|
+
*/
|
|
660
|
+
async getSchemas(params) {
|
|
661
|
+
return this.client.get('/tools/schema', params);
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Get available tools for prompts
|
|
665
|
+
*/
|
|
666
|
+
async getAvailable() {
|
|
667
|
+
const response = await this.client.get('/tools', {
|
|
668
|
+
isActive: true,
|
|
669
|
+
limit: 200,
|
|
670
|
+
});
|
|
671
|
+
const payload = response;
|
|
672
|
+
if (Array.isArray(payload?.data)) {
|
|
673
|
+
return payload.data;
|
|
674
|
+
}
|
|
675
|
+
if (Array.isArray(payload)) {
|
|
676
|
+
return payload;
|
|
677
|
+
}
|
|
678
|
+
return [];
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Convert a flow to a tool
|
|
682
|
+
*/
|
|
683
|
+
async convertFromFlow(flowId, data) {
|
|
684
|
+
return this.client.post(`/flows/${flowId}/convert-to-tool`, data);
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Get all built-in tools
|
|
688
|
+
*/
|
|
689
|
+
async getBuiltInTools() {
|
|
690
|
+
return this.client.get('/tools/builtin');
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Get built-in tools compatible with a specific model and provider
|
|
694
|
+
*/
|
|
695
|
+
async getCompatibleBuiltInTools(model, provider) {
|
|
696
|
+
return this.client.get('/tools/builtin/compatible', { model, provider });
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Get parameter schema for a specific built-in tool
|
|
700
|
+
*/
|
|
701
|
+
async getBuiltInToolSchema(toolId) {
|
|
702
|
+
return this.client.get(`/tools/builtin/${toolId}/schema`);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
exports.ToolsEndpoint = ToolsEndpoint;
|
|
706
|
+
/**
|
|
707
|
+
* Eval endpoint handlers
|
|
708
|
+
*/
|
|
709
|
+
class EvalEndpoint {
|
|
710
|
+
constructor(client) {
|
|
711
|
+
this.client = client;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Run virtual eval with streaming response
|
|
715
|
+
* Executes multiple eval configs simultaneously and streams results via multiplexed SSE
|
|
716
|
+
*/
|
|
717
|
+
async runVirtualEval(data) {
|
|
718
|
+
return this.client.requestStream('/eval/stream', {
|
|
719
|
+
method: 'POST',
|
|
720
|
+
body: JSON.stringify(data)
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
exports.EvalEndpoint = EvalEndpoint;
|
|
725
|
+
//# sourceMappingURL=endpoints.js.map
|