@steelengine/sdk 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,519 @@
1
+ # SteelEngine TypeScript SDK
2
+
3
+ The official TypeScript/JavaScript SDK for [SteelEngine](https://tryrecall.com), allowing you to execute workflows programmatically from your applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @steelengine/sdk
9
+ # or
10
+ yarn add @steelengine/sdk
11
+ # or
12
+ bun add @steelengine/sdk
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```typescript
18
+ import { SteelEngineClient } from '@steelengine/sdk';
19
+
20
+ // Initialize the client
21
+ const client = new SteelEngineClient({
22
+ apiKey: 'your-api-key-here',
23
+ baseUrl: 'https://tryrecall.com' // optional, defaults to https://tryrecall.com
24
+ });
25
+
26
+ // Execute a workflow
27
+ try {
28
+ const result = await client.executeWorkflow('workflow-id');
29
+ console.log('Workflow executed successfully:', result);
30
+ } catch (error) {
31
+ console.error('Workflow execution failed:', error);
32
+ }
33
+ ```
34
+
35
+ ## API Reference
36
+
37
+ ### SteelEngineClient
38
+
39
+ #### Constructor
40
+
41
+ ```typescript
42
+ new SteelEngineClient(config: SteelEngineConfig)
43
+ ```
44
+
45
+ - `config.apiKey` (string): Your SteelEngine API key
46
+ - `config.baseUrl` (string, optional): Base URL for the SteelEngine API (defaults to `https://tryrecall.com`)
47
+
48
+ #### Methods
49
+
50
+ ##### executeWorkflow(workflowId, input?, options?)
51
+
52
+ Execute a workflow with optional input data.
53
+
54
+ ```typescript
55
+ // With object input (spread at root level of request body)
56
+ const result = await client.executeWorkflow('workflow-id', {
57
+ message: 'Hello, world!'
58
+ });
59
+
60
+ // With primitive input (wrapped as { input: value })
61
+ const result = await client.executeWorkflow('workflow-id', 'NVDA');
62
+
63
+ // With options
64
+ const result = await client.executeWorkflow('workflow-id', { message: 'Hello' }, {
65
+ timeout: 60000
66
+ });
67
+ ```
68
+
69
+ **Parameters:**
70
+ - `workflowId` (string): The ID of the workflow to execute
71
+ - `input` (any, optional): Input data to pass to the workflow. Objects are spread at the root level, primitives/arrays are wrapped in `{ input: value }`. File objects are automatically converted to base64.
72
+ - `options` (ExecutionOptions, optional):
73
+ - `timeout` (number): Timeout in milliseconds (default: 30000)
74
+ - `stream` (boolean): Enable streaming responses
75
+ - `selectedOutputs` (string[]): Block outputs to stream (e.g., `["agent1.content"]`)
76
+ - `async` (boolean): Execute asynchronously and return execution ID
77
+
78
+ **Returns:** `Promise<WorkflowExecutionResult | AsyncExecutionResult>`
79
+
80
+ ##### getWorkflowStatus(workflowId)
81
+
82
+ Get the status of a workflow (deployment status, etc.).
83
+
84
+ ```typescript
85
+ const status = await client.getWorkflowStatus('workflow-id');
86
+ console.log('Is deployed:', status.isDeployed);
87
+ ```
88
+
89
+ **Parameters:**
90
+ - `workflowId` (string): The ID of the workflow
91
+
92
+ **Returns:** `Promise<WorkflowStatus>`
93
+
94
+ ##### validateWorkflow(workflowId)
95
+
96
+ Validate that a workflow is ready for execution.
97
+
98
+ ```typescript
99
+ const isReady = await client.validateWorkflow('workflow-id');
100
+ if (isReady) {
101
+ // Workflow is deployed and ready
102
+ }
103
+ ```
104
+
105
+ **Parameters:**
106
+ - `workflowId` (string): The ID of the workflow
107
+
108
+ **Returns:** `Promise<boolean>`
109
+
110
+ ##### executeWorkflowSync(workflowId, input?, options?)
111
+
112
+ Execute a workflow and poll for completion (useful for long-running workflows).
113
+
114
+ ```typescript
115
+ const result = await client.executeWorkflowSync('workflow-id', { data: 'some input' }, {
116
+ timeout: 60000
117
+ });
118
+ ```
119
+
120
+ **Parameters:**
121
+ - `workflowId` (string): The ID of the workflow to execute
122
+ - `input` (any, optional): Input data to pass to the workflow
123
+ - `options` (ExecutionOptions, optional):
124
+ - `timeout` (number): Timeout for the initial request in milliseconds
125
+
126
+ **Returns:** `Promise<WorkflowExecutionResult>`
127
+
128
+ ##### getJobStatus(taskId)
129
+
130
+ Get the status of an async job.
131
+
132
+ ```typescript
133
+ const status = await client.getJobStatus('task-id-from-async-execution');
134
+ console.log('Job status:', status);
135
+ ```
136
+
137
+ **Parameters:**
138
+ - `taskId` (string): The task ID returned from async execution
139
+
140
+ **Returns:** `Promise<any>`
141
+
142
+ ##### executeWithRetry(workflowId, input?, options?, retryOptions?)
143
+
144
+ Execute a workflow with automatic retry on rate limit errors.
145
+
146
+ ```typescript
147
+ const result = await client.executeWithRetry('workflow-id', { message: 'Hello' }, {
148
+ timeout: 30000
149
+ }, {
150
+ maxRetries: 3,
151
+ initialDelay: 1000,
152
+ maxDelay: 30000,
153
+ backoffMultiplier: 2
154
+ });
155
+ ```
156
+
157
+ **Parameters:**
158
+ - `workflowId` (string): The ID of the workflow to execute
159
+ - `input` (any, optional): Input data to pass to the workflow
160
+ - `options` (ExecutionOptions, optional): Execution options
161
+ - `retryOptions` (RetryOptions, optional):
162
+ - `maxRetries` (number): Maximum retry attempts (default: 3)
163
+ - `initialDelay` (number): Initial delay in ms (default: 1000)
164
+ - `maxDelay` (number): Maximum delay in ms (default: 30000)
165
+ - `backoffMultiplier` (number): Backoff multiplier (default: 2)
166
+
167
+ **Returns:** `Promise<WorkflowExecutionResult | AsyncExecutionResult>`
168
+
169
+ ##### getRateLimitInfo()
170
+
171
+ Get current rate limit information from the last API response.
172
+
173
+ ```typescript
174
+ const rateInfo = client.getRateLimitInfo();
175
+ if (rateInfo) {
176
+ console.log('Remaining requests:', rateInfo.remaining);
177
+ }
178
+ ```
179
+
180
+ **Returns:** `RateLimitInfo | null`
181
+
182
+ ##### getUsageLimits()
183
+
184
+ Get current usage limits and quota information.
185
+
186
+ ```typescript
187
+ const limits = await client.getUsageLimits();
188
+ console.log('Current usage:', limits.usage);
189
+ ```
190
+
191
+ **Returns:** `Promise<UsageLimits>`
192
+
193
+ ##### setApiKey(apiKey)
194
+
195
+ Update the API key.
196
+
197
+ ```typescript
198
+ client.setApiKey('new-api-key');
199
+ ```
200
+
201
+ ##### setBaseUrl(baseUrl)
202
+
203
+ Update the base URL.
204
+
205
+ ```typescript
206
+ client.setBaseUrl('https://my-custom-domain.com');
207
+ ```
208
+
209
+ ## Types
210
+
211
+ ### WorkflowExecutionResult
212
+
213
+ ```typescript
214
+ interface WorkflowExecutionResult {
215
+ success: boolean;
216
+ output?: any;
217
+ error?: string;
218
+ logs?: any[];
219
+ metadata?: {
220
+ duration?: number;
221
+ executionId?: string;
222
+ [key: string]: any;
223
+ };
224
+ traceSpans?: any[];
225
+ totalDuration?: number;
226
+ }
227
+ ```
228
+
229
+ ### WorkflowStatus
230
+
231
+ ```typescript
232
+ interface WorkflowStatus {
233
+ isDeployed: boolean;
234
+ deployedAt?: string;
235
+ needsRedeployment: boolean;
236
+ }
237
+ ```
238
+
239
+ ### SteelEngineError
240
+
241
+ ```typescript
242
+ class SteelEngineError extends Error {
243
+ code?: string;
244
+ status?: number;
245
+ }
246
+ ```
247
+
248
+ ### AsyncExecutionResult
249
+
250
+ ```typescript
251
+ interface AsyncExecutionResult {
252
+ success: boolean;
253
+ taskId: string;
254
+ status: 'queued';
255
+ createdAt: string;
256
+ links: {
257
+ status: string;
258
+ };
259
+ }
260
+ ```
261
+
262
+ ### RateLimitInfo
263
+
264
+ ```typescript
265
+ interface RateLimitInfo {
266
+ limit: number;
267
+ remaining: number;
268
+ reset: number;
269
+ retryAfter?: number;
270
+ }
271
+ ```
272
+
273
+ ### UsageLimits
274
+
275
+ ```typescript
276
+ interface UsageLimits {
277
+ success: boolean;
278
+ rateLimit: {
279
+ sync: {
280
+ isLimited: boolean;
281
+ limit: number;
282
+ remaining: number;
283
+ resetAt: string;
284
+ };
285
+ async: {
286
+ isLimited: boolean;
287
+ limit: number;
288
+ remaining: number;
289
+ resetAt: string;
290
+ };
291
+ authType: string;
292
+ };
293
+ usage: {
294
+ currentPeriodCost: number;
295
+ limit: number;
296
+ plan: string;
297
+ };
298
+ }
299
+ ```
300
+
301
+ ### ExecutionOptions
302
+
303
+ ```typescript
304
+ interface ExecutionOptions {
305
+ timeout?: number;
306
+ stream?: boolean;
307
+ selectedOutputs?: string[];
308
+ async?: boolean;
309
+ }
310
+ ```
311
+
312
+ ### RetryOptions
313
+
314
+ ```typescript
315
+ interface RetryOptions {
316
+ maxRetries?: number;
317
+ initialDelay?: number;
318
+ maxDelay?: number;
319
+ backoffMultiplier?: number;
320
+ }
321
+ ```
322
+
323
+ ## Examples
324
+
325
+ ### Basic Workflow Execution
326
+
327
+ ```typescript
328
+ import { SteelEngineClient } from '@steelengine/sdk';
329
+
330
+ const client = new SteelEngineClient({
331
+ apiKey: process.env.STEELENGINE_API_KEY!
332
+ });
333
+
334
+ async function runWorkflow() {
335
+ try {
336
+ // Check if workflow is ready
337
+ const isReady = await client.validateWorkflow('my-workflow-id');
338
+ if (!isReady) {
339
+ throw new Error('Workflow is not deployed or ready');
340
+ }
341
+
342
+ // Execute the workflow
343
+ const result = await client.executeWorkflow('my-workflow-id', {
344
+ message: 'Process this data',
345
+ userId: '12345'
346
+ });
347
+
348
+ if (result.success) {
349
+ console.log('Output:', result.output);
350
+ console.log('Duration:', result.metadata?.duration);
351
+ } else {
352
+ console.error('Workflow failed:', result.error);
353
+ }
354
+ } catch (error) {
355
+ console.error('Error:', error);
356
+ }
357
+ }
358
+
359
+ runWorkflow();
360
+ ```
361
+
362
+ ### Error Handling
363
+
364
+ ```typescript
365
+ import { SteelEngineClient, SteelEngineError } from '@steelengine/sdk';
366
+
367
+ const client = new SteelEngineClient({
368
+ apiKey: process.env.STEELENGINE_API_KEY!
369
+ });
370
+
371
+ async function executeWithErrorHandling() {
372
+ try {
373
+ const result = await client.executeWorkflow('workflow-id');
374
+ return result;
375
+ } catch (error) {
376
+ if (error instanceof SteelEngineError) {
377
+ switch (error.code) {
378
+ case 'UNAUTHORIZED':
379
+ console.error('Invalid API key');
380
+ break;
381
+ case 'TIMEOUT':
382
+ console.error('Workflow execution timed out');
383
+ break;
384
+ case 'USAGE_LIMIT_EXCEEDED':
385
+ console.error('Usage limit exceeded');
386
+ break;
387
+ case 'INVALID_JSON':
388
+ console.error('Invalid JSON in request body');
389
+ break;
390
+ default:
391
+ console.error('Workflow error:', error.message);
392
+ }
393
+ } else {
394
+ console.error('Unexpected error:', error);
395
+ }
396
+ throw error;
397
+ }
398
+ }
399
+ ```
400
+
401
+ ### Environment Configuration
402
+
403
+ ```typescript
404
+ // Using environment variables
405
+ const client = new SteelEngineClient({
406
+ apiKey: process.env.STEELENGINE_API_KEY!,
407
+ baseUrl: process.env.STEELENGINE_BASE_URL // optional
408
+ });
409
+ ```
410
+
411
+ ### File Upload
412
+
413
+ File objects are automatically detected and converted to base64 format. Include them in your input under the field name matching your workflow's API trigger input format:
414
+
415
+ The SDK converts File objects to this format:
416
+ ```typescript
417
+ {
418
+ type: 'file',
419
+ data: 'data:mime/type;base64,base64data',
420
+ name: 'filename',
421
+ mime: 'mime/type'
422
+ }
423
+ ```
424
+
425
+ Alternatively, you can manually provide files using the URL format:
426
+ ```typescript
427
+ {
428
+ type: 'url',
429
+ data: 'https://example.com/file.pdf',
430
+ name: 'file.pdf',
431
+ mime: 'application/pdf'
432
+ }
433
+ ```
434
+
435
+ ```typescript
436
+ import { SteelEngineClient } from '@steelengine/sdk';
437
+ import fs from 'fs';
438
+
439
+ const client = new SteelEngineClient({
440
+ apiKey: process.env.STEELENGINE_API_KEY!
441
+ });
442
+
443
+ // Node.js: Read file and create File object
444
+ const fileBuffer = fs.readFileSync('./document.pdf');
445
+ const file = new File([fileBuffer], 'document.pdf', { type: 'application/pdf' });
446
+
447
+ // Include files under the field name from your API trigger's input format
448
+ const result = await client.executeWorkflow('workflow-id', {
449
+ documents: [file], // Field name must match your API trigger's file input field
450
+ instructions: 'Process this document'
451
+ });
452
+
453
+ // Browser: From file input
454
+ const handleFileUpload = async (event: Event) => {
455
+ const inputEl = event.target as HTMLInputElement;
456
+ const files = Array.from(inputEl.files || []);
457
+
458
+ const result = await client.executeWorkflow('workflow-id', {
459
+ attachments: files, // Field name must match your API trigger's file input field
460
+ query: 'Analyze these files'
461
+ });
462
+ };
463
+ ```
464
+
465
+ ## Getting Your API Key
466
+
467
+ 1. Log in to your [SteelEngine](https://tryrecall.com) account
468
+ 2. Navigate to your workflow
469
+ 3. Click on "Deploy" to deploy your workflow
470
+ 4. Select or create an API key during the deployment process
471
+ 5. Copy the API key to use in your application
472
+
473
+ ## Development
474
+
475
+ ### Running Tests
476
+
477
+ To run the tests locally:
478
+
479
+ 1. Clone the repository and navigate to the TypeScript SDK directory:
480
+ ```bash
481
+ cd packages/ts-sdk
482
+ ```
483
+
484
+ 2. Install dependencies:
485
+ ```bash
486
+ bun install
487
+ ```
488
+
489
+ 3. Run the tests:
490
+ ```bash
491
+ bun run test
492
+ ```
493
+
494
+ ### Building
495
+
496
+ Build the TypeScript SDK:
497
+
498
+ ```bash
499
+ bun run build
500
+ ```
501
+
502
+ This will compile TypeScript files to JavaScript and generate type declarations in the `dist/` directory.
503
+
504
+ ### Development Mode
505
+
506
+ For development with auto-rebuild:
507
+
508
+ ```bash
509
+ bun run dev
510
+ ```
511
+
512
+ ## Requirements
513
+
514
+ - Node.js 18+
515
+ - TypeScript 5.0+ (for TypeScript projects)
516
+
517
+ ## License
518
+
519
+ Apache-2.0
@@ -0,0 +1,202 @@
1
+ export interface SteelEngineConfig {
2
+ apiKey: string;
3
+ baseUrl?: string;
4
+ }
5
+ export interface WorkflowExecutionResult {
6
+ success: boolean;
7
+ output?: any;
8
+ error?: string;
9
+ logs?: any[];
10
+ metadata?: {
11
+ duration?: number;
12
+ executionId?: string;
13
+ [key: string]: any;
14
+ };
15
+ traceSpans?: any[];
16
+ totalDuration?: number;
17
+ }
18
+ export interface WorkflowStatus {
19
+ isDeployed: boolean;
20
+ deployedAt?: string;
21
+ needsRedeployment: boolean;
22
+ }
23
+ export interface ExecutionOptions {
24
+ timeout?: number;
25
+ stream?: boolean;
26
+ selectedOutputs?: string[];
27
+ async?: boolean;
28
+ /** Execute against the draft (unpublished) state instead of the deployed version */
29
+ useDraftState?: boolean;
30
+ /** Include base64 file content in outputs (default true server-side) */
31
+ includeFileBase64?: boolean;
32
+ /** Cap on per-file base64 payload size in bytes */
33
+ base64MaxBytes?: number;
34
+ /** Stop execution after the given block completes */
35
+ stopAfterBlockId?: string;
36
+ }
37
+ export interface AsyncExecutionResult {
38
+ success: boolean;
39
+ async: true;
40
+ jobId: string;
41
+ executionId: string;
42
+ message: string;
43
+ statusUrl: string;
44
+ }
45
+ export type JobStatusValue = 'queued' | 'processing' | 'completed' | 'failed' | 'cancelled';
46
+ export interface JobStatus {
47
+ jobId: string;
48
+ status: JobStatusValue | string;
49
+ output?: any;
50
+ error?: string;
51
+ startedAt?: string;
52
+ completedAt?: string;
53
+ [key: string]: any;
54
+ }
55
+ export interface CancelExecutionResult {
56
+ success: boolean;
57
+ executionId: string;
58
+ durablyRecorded: boolean;
59
+ locallyAborted: boolean;
60
+ redisAvailable: boolean;
61
+ reason?: string;
62
+ }
63
+ export interface Workspace {
64
+ id: string;
65
+ name: string;
66
+ [key: string]: any;
67
+ }
68
+ export interface WorkspacesList {
69
+ workspaces: Workspace[];
70
+ totalCount: number;
71
+ limit: number;
72
+ offset: number;
73
+ }
74
+ export interface RateLimitInfo {
75
+ limit: number;
76
+ remaining: number;
77
+ reset: number;
78
+ retryAfter?: number;
79
+ }
80
+ export interface RetryOptions {
81
+ maxRetries?: number;
82
+ initialDelay?: number;
83
+ maxDelay?: number;
84
+ backoffMultiplier?: number;
85
+ }
86
+ export interface RateLimitWindow {
87
+ isLimited: boolean;
88
+ requestsPerMinute: number;
89
+ maxBurst: number;
90
+ remaining: number;
91
+ resetAt: string;
92
+ }
93
+ export interface UsageLimits {
94
+ success: boolean;
95
+ rateLimit: {
96
+ sync: RateLimitWindow;
97
+ async: RateLimitWindow;
98
+ authType: string;
99
+ };
100
+ usage: {
101
+ currentPeriodCost: number;
102
+ limit: number;
103
+ plan: string;
104
+ };
105
+ storage: {
106
+ usedBytes: number;
107
+ limitBytes: number;
108
+ percentUsed: number;
109
+ };
110
+ }
111
+ export declare class SteelEngineError extends Error {
112
+ code?: string;
113
+ status?: number;
114
+ constructor(message: string, code?: string, status?: number);
115
+ }
116
+ export declare class SteelEngineClient {
117
+ private apiKey;
118
+ private baseUrl;
119
+ private rateLimitInfo;
120
+ constructor(config: SteelEngineConfig);
121
+ /**
122
+ * Convert File objects in input to API format (base64)
123
+ * Recursively processes nested objects and arrays
124
+ */
125
+ private convertFilesToBase64;
126
+ /**
127
+ * Execute a workflow with optional input data
128
+ * @param workflowId - The ID of the workflow to execute
129
+ * @param input - Input data to pass to the workflow (object, primitive, or array)
130
+ * @param options - Execution options (timeout, stream, async, etc.)
131
+ */
132
+ executeWorkflow(workflowId: string, input?: any, options?: ExecutionOptions): Promise<WorkflowExecutionResult | AsyncExecutionResult>;
133
+ /**
134
+ * Get the status of a workflow (deployment status, etc.)
135
+ */
136
+ getWorkflowStatus(workflowId: string): Promise<WorkflowStatus>;
137
+ /**
138
+ * Execute a workflow synchronously (ensures non-async mode)
139
+ * @param workflowId - The ID of the workflow to execute
140
+ * @param input - Input data to pass to the workflow
141
+ * @param options - Execution options (timeout, stream, etc.)
142
+ */
143
+ executeWorkflowSync(workflowId: string, input?: any, options?: ExecutionOptions): Promise<WorkflowExecutionResult>;
144
+ /**
145
+ * Validate that a workflow is ready for execution
146
+ */
147
+ validateWorkflow(workflowId: string): Promise<boolean>;
148
+ /**
149
+ * Set a new API key
150
+ */
151
+ setApiKey(apiKey: string): void;
152
+ /**
153
+ * Set a new base URL
154
+ */
155
+ setBaseUrl(baseUrl: string): void;
156
+ /**
157
+ * Get the status of an async job
158
+ * @param jobId The job ID returned from async execution (AsyncExecutionResult.jobId)
159
+ */
160
+ getJobStatus(jobId: string): Promise<JobStatus>;
161
+ /**
162
+ * Cancel a running or queued execution
163
+ * @param workflowId - The workflow the execution belongs to
164
+ * @param executionId - The execution to cancel (from metadata.executionId or AsyncExecutionResult.executionId)
165
+ */
166
+ cancelExecution(workflowId: string, executionId: string): Promise<CancelExecutionResult>;
167
+ /**
168
+ * Get a workflow's full definition and deployment metadata
169
+ */
170
+ getWorkflow(workflowId: string): Promise<any>;
171
+ /**
172
+ * List workspaces the API key has access to
173
+ */
174
+ listWorkspaces(): Promise<WorkspacesList>;
175
+ /**
176
+ * Create a workspace (personal API keys only)
177
+ */
178
+ createWorkspace(name: string): Promise<Workspace>;
179
+ /**
180
+ * Execute workflow with automatic retry on rate limit
181
+ * @param workflowId - The ID of the workflow to execute
182
+ * @param input - Input data to pass to the workflow
183
+ * @param options - Execution options (timeout, stream, async, etc.)
184
+ * @param retryOptions - Retry configuration (maxRetries, delays, etc.)
185
+ */
186
+ executeWithRetry(workflowId: string, input?: any, options?: ExecutionOptions, retryOptions?: RetryOptions): Promise<WorkflowExecutionResult | AsyncExecutionResult>;
187
+ /**
188
+ * Get current rate limit information
189
+ */
190
+ getRateLimitInfo(): RateLimitInfo | null;
191
+ /**
192
+ * Update rate limit info from response headers
193
+ * @private
194
+ */
195
+ private updateRateLimitInfo;
196
+ /**
197
+ * Get current usage limits and quota information
198
+ */
199
+ getUsageLimits(): Promise<UsageLimits>;
200
+ }
201
+ export { SteelEngineClient as default };
202
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACZ,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,CAAC,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MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAiCrD;;;;OAIG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAiC9F;;OAEG;IACG,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IA+BnD;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC;IAiC/C;;OAEG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAmCvD;;;;;;OAMG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,GAAG,EACX,OAAO,GAAE,gBAAqB,EAC9B,YAAY,GAAE,YAAiB,GAC9B,OAAO,CAAC,uBAAuB,GAAG,oBAAoB,CAAC;IAyC1D;;OAEG;IACH,gBAAgB,IAAI,aAAa,GAAG,IAAI;IAIxC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAgB3B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;CAgC7C;AAED,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,429 @@
1
+ import fetch from 'node-fetch';
2
+ export class SteelEngineError extends Error {
3
+ constructor(message, code, status) {
4
+ super(message);
5
+ this.name = 'SteelEngineError';
6
+ this.code = code;
7
+ this.status = status;
8
+ }
9
+ }
10
+ /**
11
+ * Remove trailing slashes from a URL
12
+ * Uses string operations instead of regex to prevent ReDoS attacks
13
+ * @param url - The URL to normalize
14
+ * @returns URL without trailing slashes
15
+ */
16
+ function normalizeBaseUrl(url) {
17
+ let normalized = url;
18
+ while (normalized.endsWith('/')) {
19
+ normalized = normalized.slice(0, -1);
20
+ }
21
+ return normalized;
22
+ }
23
+ export class SteelEngineClient {
24
+ constructor(config) {
25
+ this.rateLimitInfo = null;
26
+ this.apiKey = config.apiKey;
27
+ this.baseUrl = normalizeBaseUrl(config.baseUrl || 'https://tryrecall.com');
28
+ }
29
+ /**
30
+ * Convert File objects in input to API format (base64)
31
+ * Recursively processes nested objects and arrays
32
+ */
33
+ async convertFilesToBase64(value, visited = new WeakSet()) {
34
+ if (typeof File !== 'undefined' && value instanceof File) {
35
+ const arrayBuffer = await value.arrayBuffer();
36
+ const buffer = Buffer.from(arrayBuffer);
37
+ const base64 = buffer.toString('base64');
38
+ return {
39
+ type: 'file',
40
+ data: `data:${value.type || 'application/octet-stream'};base64,${base64}`,
41
+ name: value.name,
42
+ mime: value.type || 'application/octet-stream',
43
+ };
44
+ }
45
+ if (Array.isArray(value)) {
46
+ if (visited.has(value)) {
47
+ return '[Circular]';
48
+ }
49
+ visited.add(value);
50
+ const result = await Promise.all(value.map((item) => this.convertFilesToBase64(item, visited)));
51
+ visited.delete(value);
52
+ return result;
53
+ }
54
+ if (value !== null && typeof value === 'object') {
55
+ if (visited.has(value)) {
56
+ return '[Circular]';
57
+ }
58
+ visited.add(value);
59
+ const converted = {};
60
+ for (const [key, val] of Object.entries(value)) {
61
+ converted[key] = await this.convertFilesToBase64(val, visited);
62
+ }
63
+ visited.delete(value);
64
+ return converted;
65
+ }
66
+ return value;
67
+ }
68
+ /**
69
+ * Execute a workflow with optional input data
70
+ * @param workflowId - The ID of the workflow to execute
71
+ * @param input - Input data to pass to the workflow (object, primitive, or array)
72
+ * @param options - Execution options (timeout, stream, async, etc.)
73
+ */
74
+ async executeWorkflow(workflowId, input, options = {}) {
75
+ const url = `${this.baseUrl}/api/workflows/${workflowId}/execute`;
76
+ const { timeout = 30000, stream, selectedOutputs, async, useDraftState, includeFileBase64, base64MaxBytes, stopAfterBlockId, } = options;
77
+ try {
78
+ const timeoutPromise = new Promise((_, reject) => {
79
+ setTimeout(() => reject(new Error('TIMEOUT')), timeout);
80
+ });
81
+ const headers = {
82
+ 'Content-Type': 'application/json',
83
+ 'X-API-Key': this.apiKey,
84
+ };
85
+ if (async) {
86
+ headers['X-Execution-Mode'] = 'async';
87
+ }
88
+ let jsonBody = {};
89
+ if (input !== undefined && input !== null) {
90
+ if (typeof input === 'object' && input !== null && !Array.isArray(input)) {
91
+ jsonBody = { ...input };
92
+ }
93
+ else {
94
+ jsonBody = { input };
95
+ }
96
+ }
97
+ jsonBody = await this.convertFilesToBase64(jsonBody);
98
+ if (stream !== undefined) {
99
+ jsonBody.stream = stream;
100
+ }
101
+ if (selectedOutputs !== undefined) {
102
+ jsonBody.selectedOutputs = selectedOutputs;
103
+ }
104
+ if (useDraftState !== undefined) {
105
+ jsonBody.useDraftState = useDraftState;
106
+ }
107
+ if (includeFileBase64 !== undefined) {
108
+ jsonBody.includeFileBase64 = includeFileBase64;
109
+ }
110
+ if (base64MaxBytes !== undefined) {
111
+ jsonBody.base64MaxBytes = base64MaxBytes;
112
+ }
113
+ if (stopAfterBlockId !== undefined) {
114
+ jsonBody.stopAfterBlockId = stopAfterBlockId;
115
+ }
116
+ const fetchPromise = fetch(url, {
117
+ method: 'POST',
118
+ headers,
119
+ body: JSON.stringify(jsonBody),
120
+ });
121
+ const response = await Promise.race([fetchPromise, timeoutPromise]);
122
+ this.updateRateLimitInfo(response);
123
+ if (response.status === 429) {
124
+ const retryAfter = this.rateLimitInfo?.retryAfter || 1000;
125
+ throw new SteelEngineError(`Rate limit exceeded. Retry after ${retryAfter}ms`, 'RATE_LIMIT_EXCEEDED', 429);
126
+ }
127
+ if (!response.ok) {
128
+ const errorData = (await response.json().catch(() => ({})));
129
+ throw new SteelEngineError(errorData.error || `HTTP ${response.status}: ${response.statusText}`, errorData.code, response.status);
130
+ }
131
+ const result = await response.json();
132
+ return result;
133
+ }
134
+ catch (error) {
135
+ if (error instanceof SteelEngineError) {
136
+ throw error;
137
+ }
138
+ if (error.message === 'TIMEOUT') {
139
+ throw new SteelEngineError(`Workflow execution timed out after ${timeout}ms`, 'TIMEOUT');
140
+ }
141
+ throw new SteelEngineError(error?.message || 'Failed to execute workflow', 'EXECUTION_ERROR');
142
+ }
143
+ }
144
+ /**
145
+ * Get the status of a workflow (deployment status, etc.)
146
+ */
147
+ async getWorkflowStatus(workflowId) {
148
+ const url = `${this.baseUrl}/api/workflows/${workflowId}/status`;
149
+ try {
150
+ const response = await fetch(url, {
151
+ method: 'GET',
152
+ headers: {
153
+ 'X-API-Key': this.apiKey,
154
+ },
155
+ });
156
+ if (!response.ok) {
157
+ const errorData = (await response.json().catch(() => ({})));
158
+ throw new SteelEngineError(errorData.error || `HTTP ${response.status}: ${response.statusText}`, errorData.code, response.status);
159
+ }
160
+ const result = await response.json();
161
+ return result;
162
+ }
163
+ catch (error) {
164
+ if (error instanceof SteelEngineError) {
165
+ throw error;
166
+ }
167
+ throw new SteelEngineError(error?.message || 'Failed to get workflow status', 'STATUS_ERROR');
168
+ }
169
+ }
170
+ /**
171
+ * Execute a workflow synchronously (ensures non-async mode)
172
+ * @param workflowId - The ID of the workflow to execute
173
+ * @param input - Input data to pass to the workflow
174
+ * @param options - Execution options (timeout, stream, etc.)
175
+ */
176
+ async executeWorkflowSync(workflowId, input, options = {}) {
177
+ const syncOptions = { ...options, async: false };
178
+ return this.executeWorkflow(workflowId, input, syncOptions);
179
+ }
180
+ /**
181
+ * Validate that a workflow is ready for execution
182
+ */
183
+ async validateWorkflow(workflowId) {
184
+ try {
185
+ const status = await this.getWorkflowStatus(workflowId);
186
+ return status.isDeployed;
187
+ }
188
+ catch (error) {
189
+ return false;
190
+ }
191
+ }
192
+ /**
193
+ * Set a new API key
194
+ */
195
+ setApiKey(apiKey) {
196
+ this.apiKey = apiKey;
197
+ }
198
+ /**
199
+ * Set a new base URL
200
+ */
201
+ setBaseUrl(baseUrl) {
202
+ this.baseUrl = normalizeBaseUrl(baseUrl);
203
+ }
204
+ /**
205
+ * Get the status of an async job
206
+ * @param jobId The job ID returned from async execution (AsyncExecutionResult.jobId)
207
+ */
208
+ async getJobStatus(jobId) {
209
+ const url = `${this.baseUrl}/api/jobs/${jobId}`;
210
+ try {
211
+ const response = await fetch(url, {
212
+ method: 'GET',
213
+ headers: {
214
+ 'X-API-Key': this.apiKey,
215
+ },
216
+ });
217
+ this.updateRateLimitInfo(response);
218
+ if (!response.ok) {
219
+ const errorData = (await response.json().catch(() => ({})));
220
+ throw new SteelEngineError(errorData.error || `HTTP ${response.status}: ${response.statusText}`, errorData.code, response.status);
221
+ }
222
+ const result = await response.json();
223
+ return result;
224
+ }
225
+ catch (error) {
226
+ if (error instanceof SteelEngineError) {
227
+ throw error;
228
+ }
229
+ throw new SteelEngineError(error?.message || 'Failed to get job status', 'STATUS_ERROR');
230
+ }
231
+ }
232
+ /**
233
+ * Cancel a running or queued execution
234
+ * @param workflowId - The workflow the execution belongs to
235
+ * @param executionId - The execution to cancel (from metadata.executionId or AsyncExecutionResult.executionId)
236
+ */
237
+ async cancelExecution(workflowId, executionId) {
238
+ const url = `${this.baseUrl}/api/workflows/${workflowId}/executions/${executionId}/cancel`;
239
+ try {
240
+ const response = await fetch(url, {
241
+ method: 'POST',
242
+ headers: {
243
+ 'X-API-Key': this.apiKey,
244
+ },
245
+ });
246
+ this.updateRateLimitInfo(response);
247
+ if (!response.ok) {
248
+ const errorData = (await response.json().catch(() => ({})));
249
+ throw new SteelEngineError(errorData.error || `HTTP ${response.status}: ${response.statusText}`, errorData.code, response.status);
250
+ }
251
+ const result = await response.json();
252
+ return result;
253
+ }
254
+ catch (error) {
255
+ if (error instanceof SteelEngineError) {
256
+ throw error;
257
+ }
258
+ throw new SteelEngineError(error?.message || 'Failed to cancel execution', 'CANCEL_ERROR');
259
+ }
260
+ }
261
+ /**
262
+ * Get a workflow's full definition and deployment metadata
263
+ */
264
+ async getWorkflow(workflowId) {
265
+ const url = `${this.baseUrl}/api/workflows/${workflowId}`;
266
+ try {
267
+ const response = await fetch(url, {
268
+ method: 'GET',
269
+ headers: {
270
+ 'X-API-Key': this.apiKey,
271
+ },
272
+ });
273
+ if (!response.ok) {
274
+ const errorData = (await response.json().catch(() => ({})));
275
+ throw new SteelEngineError(errorData.error || `HTTP ${response.status}: ${response.statusText}`, errorData.code, response.status);
276
+ }
277
+ const result = (await response.json());
278
+ return result.data;
279
+ }
280
+ catch (error) {
281
+ if (error instanceof SteelEngineError) {
282
+ throw error;
283
+ }
284
+ throw new SteelEngineError(error?.message || 'Failed to get workflow', 'WORKFLOW_ERROR');
285
+ }
286
+ }
287
+ /**
288
+ * List workspaces the API key has access to
289
+ */
290
+ async listWorkspaces() {
291
+ const url = `${this.baseUrl}/api/v1/workspaces`;
292
+ try {
293
+ const response = await fetch(url, {
294
+ method: 'GET',
295
+ headers: {
296
+ 'X-API-Key': this.apiKey,
297
+ },
298
+ });
299
+ this.updateRateLimitInfo(response);
300
+ if (!response.ok) {
301
+ const errorData = (await response.json().catch(() => ({})));
302
+ throw new SteelEngineError(errorData.error || `HTTP ${response.status}: ${response.statusText}`, errorData.code, response.status);
303
+ }
304
+ const result = (await response.json());
305
+ return result.data;
306
+ }
307
+ catch (error) {
308
+ if (error instanceof SteelEngineError) {
309
+ throw error;
310
+ }
311
+ throw new SteelEngineError(error?.message || 'Failed to list workspaces', 'WORKSPACE_ERROR');
312
+ }
313
+ }
314
+ /**
315
+ * Create a workspace (personal API keys only)
316
+ */
317
+ async createWorkspace(name) {
318
+ const url = `${this.baseUrl}/api/v1/workspaces`;
319
+ try {
320
+ const response = await fetch(url, {
321
+ method: 'POST',
322
+ headers: {
323
+ 'Content-Type': 'application/json',
324
+ 'X-API-Key': this.apiKey,
325
+ },
326
+ body: JSON.stringify({ name }),
327
+ });
328
+ this.updateRateLimitInfo(response);
329
+ if (!response.ok) {
330
+ const errorData = (await response.json().catch(() => ({})));
331
+ throw new SteelEngineError(errorData.error || `HTTP ${response.status}: ${response.statusText}`, errorData.code, response.status);
332
+ }
333
+ const result = (await response.json());
334
+ return result.data.workspace;
335
+ }
336
+ catch (error) {
337
+ if (error instanceof SteelEngineError) {
338
+ throw error;
339
+ }
340
+ throw new SteelEngineError(error?.message || 'Failed to create workspace', 'WORKSPACE_ERROR');
341
+ }
342
+ }
343
+ /**
344
+ * Execute workflow with automatic retry on rate limit
345
+ * @param workflowId - The ID of the workflow to execute
346
+ * @param input - Input data to pass to the workflow
347
+ * @param options - Execution options (timeout, stream, async, etc.)
348
+ * @param retryOptions - Retry configuration (maxRetries, delays, etc.)
349
+ */
350
+ async executeWithRetry(workflowId, input, options = {}, retryOptions = {}) {
351
+ const { maxRetries = 3, initialDelay = 1000, maxDelay = 30000, backoffMultiplier = 2, } = retryOptions;
352
+ let lastError = null;
353
+ let delay = initialDelay;
354
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
355
+ try {
356
+ return await this.executeWorkflow(workflowId, input, options);
357
+ }
358
+ catch (error) {
359
+ if (!(error instanceof SteelEngineError) || error.code !== 'RATE_LIMIT_EXCEEDED') {
360
+ throw error;
361
+ }
362
+ lastError = error;
363
+ if (attempt === maxRetries) {
364
+ break;
365
+ }
366
+ const waitTime = error.status === 429 && this.rateLimitInfo?.retryAfter
367
+ ? this.rateLimitInfo.retryAfter
368
+ : Math.min(delay, maxDelay);
369
+ const jitter = waitTime * (0.75 + Math.random() * 0.5);
370
+ await new Promise((resolve) => setTimeout(resolve, jitter));
371
+ delay *= backoffMultiplier;
372
+ }
373
+ }
374
+ throw lastError || new SteelEngineError('Max retries exceeded', 'MAX_RETRIES_EXCEEDED');
375
+ }
376
+ /**
377
+ * Get current rate limit information
378
+ */
379
+ getRateLimitInfo() {
380
+ return this.rateLimitInfo;
381
+ }
382
+ /**
383
+ * Update rate limit info from response headers
384
+ * @private
385
+ */
386
+ updateRateLimitInfo(response) {
387
+ const limit = response.headers.get('x-ratelimit-limit');
388
+ const remaining = response.headers.get('x-ratelimit-remaining');
389
+ const reset = response.headers.get('x-ratelimit-reset');
390
+ const retryAfter = response.headers.get('retry-after');
391
+ if (limit || remaining || reset) {
392
+ this.rateLimitInfo = {
393
+ limit: limit ? Number.parseInt(limit, 10) : 0,
394
+ remaining: remaining ? Number.parseInt(remaining, 10) : 0,
395
+ reset: reset ? Number.parseInt(reset, 10) : 0,
396
+ retryAfter: retryAfter ? Number.parseInt(retryAfter, 10) * 1000 : undefined,
397
+ };
398
+ }
399
+ }
400
+ /**
401
+ * Get current usage limits and quota information
402
+ */
403
+ async getUsageLimits() {
404
+ const url = `${this.baseUrl}/api/users/me/usage-limits`;
405
+ try {
406
+ const response = await fetch(url, {
407
+ method: 'GET',
408
+ headers: {
409
+ 'X-API-Key': this.apiKey,
410
+ },
411
+ });
412
+ this.updateRateLimitInfo(response);
413
+ if (!response.ok) {
414
+ const errorData = (await response.json().catch(() => ({})));
415
+ throw new SteelEngineError(errorData.error || `HTTP ${response.status}: ${response.statusText}`, errorData.code, response.status);
416
+ }
417
+ const result = await response.json();
418
+ return result;
419
+ }
420
+ catch (error) {
421
+ if (error instanceof SteelEngineError) {
422
+ throw error;
423
+ }
424
+ throw new SteelEngineError(error?.message || 'Failed to get usage limits', 'USAGE_ERROR');
425
+ }
426
+ }
427
+ }
428
+ export { SteelEngineClient as default };
429
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAA;AA8H9B,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAIzC,YAAY,OAAe,EAAE,IAAa,EAAE,MAAe;QACzD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,GAAW;IACnC,IAAI,UAAU,GAAG,GAAG,CAAA;IACpB,OAAO,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,UAAU,GAAG,UAAU,CAAC,KAAK,CAA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b,OAAO,EAAE;oBACP,WAAW,EAAE,IAAI,CAAC,MAAM;iBACzB;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAA;YAElC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAmB,CAAA;gBAC7E,MAAM,IAAI,gBAAgB,CACxB,SAAS,CAAC,KAAK,IAAI,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,EACpE,SAAS,CAAC,IAAI,EACd,QAAQ,CAAC,MAAM,CAChB,CAAA;YACH,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YACpC,OAAO,MAAqB,CAAA;QAC9B,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;gBACtC,MAAM,KAAK,CAAA;YACb,CAAC;YAED,MAAM,IAAI,gBAAgB,CAAC,KAAK,EAAE,OAAO,IAAI,4BAA4B,EAAE,aAAa,CAAC,CAAA;QAC3F,CAAC;IACH,CAAC;CACF;AAED,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,CAAA"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@steelengine/sdk",
3
+ "version": "0.2.0",
4
+ "description": "SteelEngine SDK - Execute workflows programmatically",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "type-check": "tsc --noEmit",
15
+ "lint": "biome check --write --unsafe .",
16
+ "lint:check": "biome check .",
17
+ "format": "biome format --write .",
18
+ "format:check": "biome format .",
19
+ "dev:watch": "tsc --watch",
20
+ "prepublishOnly": "bun run build",
21
+ "test": "vitest run",
22
+ "test:watch": "vitest"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "keywords": [
28
+ "recall",
29
+ "ai",
30
+ "workflow",
31
+ "sdk",
32
+ "api",
33
+ "automation",
34
+ "typescript"
35
+ ],
36
+ "author": "SteelEngine",
37
+ "license": "UNLICENSED",
38
+ "dependencies": {
39
+ "node-fetch": "^3.3.2"
40
+ },
41
+ "devDependencies": {
42
+ "@steelengine/tsconfig": "workspace:*",
43
+ "@types/node": "^20.5.1",
44
+ "@vitest/coverage-v8": "^3.0.8",
45
+ "typescript": "^5.7.3",
46
+ "vitest": "^3.0.8"
47
+ },
48
+ "engines": {
49
+ "node": ">=16"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "https://github.com/tryrecall/recall.git",
57
+ "directory": "packages/ts-sdk"
58
+ },
59
+ "homepage": "https://tryrecall.com",
60
+ "bugs": {
61
+ "url": "https://github.com/tryrecall/recall/issues"
62
+ }
63
+ }