@eigenpal/sdk 0.0.0-placeholder

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.
@@ -0,0 +1,608 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export type ClientOptions = {
4
+ baseUrl: 'https://app.eigenpal.com' | (string & {});
5
+ };
6
+
7
+ export type RunWorkflowBody = {
8
+ /**
9
+ * Workflow inputs keyed by input name
10
+ */
11
+ input?: {
12
+ [key: string]: unknown;
13
+ };
14
+ /**
15
+ * Per-step output overrides for replay
16
+ */
17
+ overrides?: {
18
+ steps?: {
19
+ [key: string]: {
20
+ [key: string]: unknown;
21
+ };
22
+ };
23
+ } | null;
24
+ /**
25
+ * Caller surface (defaults to "api")
26
+ */
27
+ trigger?: 'api' | 'cli';
28
+ };
29
+
30
+ export type CancelExecutionResponse = {
31
+ executionId: string;
32
+ /**
33
+ * Outcome. `cancelled` (transitioned), `cancellation-requested` (worker will observe), or `already-terminal` (no-op).
34
+ */
35
+ status: 'cancelled' | 'cancellation-requested' | 'already-terminal';
36
+ /**
37
+ * Status at the moment of the cancel request
38
+ */
39
+ wasStatus: ExecutionStatus;
40
+ };
41
+
42
+ export type ExecutionStatus =
43
+ | 'created'
44
+ | 'pending'
45
+ | 'running'
46
+ | 'waiting'
47
+ | 'finalizing'
48
+ | 'completed'
49
+ | 'failed'
50
+ | 'cancelled'
51
+ | 'rejected';
52
+
53
+ export type ApiErrorEnvelope = {
54
+ issues: Array<ApiErrorIssue>;
55
+ /**
56
+ * Request id echoed via the x-request-id header
57
+ */
58
+ requestId: string;
59
+ /**
60
+ * Suggested fix for known error patterns
61
+ */
62
+ hint?: string;
63
+ /**
64
+ * Link to relevant docs
65
+ */
66
+ docsUrl?: string;
67
+ };
68
+
69
+ export type ApiErrorIssue = {
70
+ /**
71
+ * JSON path of the offending field, or "<root>"
72
+ */
73
+ field: string;
74
+ /**
75
+ * Human-readable error message
76
+ */
77
+ message: string;
78
+ /**
79
+ * Machine-readable error code (e.g. invalid_value, not_found)
80
+ */
81
+ code: string;
82
+ /**
83
+ * Issue severity
84
+ */
85
+ severity: 'error' | 'warning';
86
+ };
87
+
88
+ export type ExecutionStatusResponse = {
89
+ executionId: string;
90
+ status: ExecutionStatus;
91
+ /**
92
+ * ISO-8601 creation timestamp
93
+ */
94
+ createdAt: string;
95
+ /**
96
+ * ISO-8601 completion timestamp; only set in terminal states
97
+ */
98
+ completedAt?: string | null;
99
+ /**
100
+ * Workflow output (status=completed)
101
+ */
102
+ result?: unknown | null;
103
+ /**
104
+ * Error message (status=failed)
105
+ */
106
+ error?: string | null;
107
+ };
108
+
109
+ export type ExecutionSummary = {
110
+ id: string;
111
+ tenantId: string;
112
+ workflowId: string;
113
+ versionId?: string | null;
114
+ status: ExecutionStatus;
115
+ triggerType?: string;
116
+ triggerInput?: unknown | null;
117
+ result?: unknown | null;
118
+ error?: string | null;
119
+ createdAt: string;
120
+ completedAt?: string | null;
121
+ /**
122
+ * Owning workflow (null when the workflow has been deleted)
123
+ */
124
+ workflow?: {
125
+ id: string;
126
+ name: string;
127
+ } | null;
128
+ [key: string]: unknown;
129
+ };
130
+
131
+ export type ListExecutionsResponse = {
132
+ data: Array<ExecutionSummary>;
133
+ total: number;
134
+ limit: number;
135
+ offset: number;
136
+ };
137
+
138
+ export type WorkflowSummary = {
139
+ id: string;
140
+ tenantId: string;
141
+ isBlock?: boolean;
142
+ createdAt: string;
143
+ updatedAt?: string;
144
+ currentVersion?: {
145
+ id?: string;
146
+ version?: string | null;
147
+ yamlContent?: string;
148
+ definition?: unknown;
149
+ message?: string | null;
150
+ createdAt?: string;
151
+ [key: string]: unknown;
152
+ } | null;
153
+ [key: string]: unknown;
154
+ };
155
+
156
+ export type RunWorkflowResponse = {
157
+ /**
158
+ * Newly created execution id (e.g. exec_xyz)
159
+ */
160
+ executionId: string;
161
+ /**
162
+ * Final execution status. Only set when the run completed within `wait_for_completion`.
163
+ */
164
+ status?: ExecutionStatus;
165
+ /**
166
+ * Workflow output (status=completed)
167
+ */
168
+ result?: unknown;
169
+ /**
170
+ * Error message (status=failed)
171
+ */
172
+ error?: string;
173
+ };
174
+
175
+ export type ListVersionsResponse = {
176
+ data: Array<WorkflowVersion>;
177
+ total: number;
178
+ limit: number;
179
+ offset: number;
180
+ };
181
+
182
+ export type WorkflowVersion = {
183
+ id: string;
184
+ workflowId: string;
185
+ version?: string | null;
186
+ yamlContent?: string;
187
+ definition?: unknown;
188
+ message?: string | null;
189
+ createdAt?: string;
190
+ isCurrentVersion?: boolean;
191
+ [key: string]: unknown;
192
+ };
193
+
194
+ export type ListWorkflowsResponse = {
195
+ data: Array<WorkflowSummary>;
196
+ total: number;
197
+ limit: number;
198
+ offset: number;
199
+ };
200
+
201
+ export type ExecutionsCancelData = {
202
+ body?: never;
203
+ path: {
204
+ /**
205
+ * Execution id to cancel
206
+ */
207
+ executionId: string;
208
+ };
209
+ query?: never;
210
+ url: '/v1/executions/{executionId}/cancel';
211
+ };
212
+
213
+ export type ExecutionsCancelErrors = {
214
+ /**
215
+ * Validation error. Request shape did not match the spec.
216
+ */
217
+ 400: ApiErrorEnvelope;
218
+ /**
219
+ * Missing or invalid API key
220
+ */
221
+ 401: ApiErrorEnvelope;
222
+ /**
223
+ * API key lacks required scope
224
+ */
225
+ 403: ApiErrorEnvelope;
226
+ /**
227
+ * Resource not found
228
+ */
229
+ 404: ApiErrorEnvelope;
230
+ /**
231
+ * Rate limit exceeded
232
+ */
233
+ 429: ApiErrorEnvelope;
234
+ /**
235
+ * Internal server error
236
+ */
237
+ 500: ApiErrorEnvelope;
238
+ };
239
+
240
+ export type ExecutionsCancelError = ExecutionsCancelErrors[keyof ExecutionsCancelErrors];
241
+
242
+ export type ExecutionsCancelResponses = {
243
+ /**
244
+ * Cancellation outcome
245
+ */
246
+ 200: CancelExecutionResponse;
247
+ };
248
+
249
+ export type ExecutionsCancelResponse = ExecutionsCancelResponses[keyof ExecutionsCancelResponses];
250
+
251
+ export type ExecutionsGetData = {
252
+ body?: never;
253
+ path: {
254
+ /**
255
+ * Execution id (e.g. exec_xyz)
256
+ */
257
+ executionId: string;
258
+ };
259
+ query?: {
260
+ /**
261
+ * When "true", returns the full per-step execution payload instead of the summary
262
+ */
263
+ includeSteps?: 'true' | 'false';
264
+ };
265
+ url: '/v1/executions/{executionId}';
266
+ };
267
+
268
+ export type ExecutionsGetErrors = {
269
+ /**
270
+ * Validation error. Request shape did not match the spec.
271
+ */
272
+ 400: ApiErrorEnvelope;
273
+ /**
274
+ * Missing or invalid API key
275
+ */
276
+ 401: ApiErrorEnvelope;
277
+ /**
278
+ * API key lacks required scope
279
+ */
280
+ 403: ApiErrorEnvelope;
281
+ /**
282
+ * Resource not found
283
+ */
284
+ 404: ApiErrorEnvelope;
285
+ /**
286
+ * Rate limit exceeded
287
+ */
288
+ 429: ApiErrorEnvelope;
289
+ /**
290
+ * Internal server error
291
+ */
292
+ 500: ApiErrorEnvelope;
293
+ };
294
+
295
+ export type ExecutionsGetError = ExecutionsGetErrors[keyof ExecutionsGetErrors];
296
+
297
+ export type ExecutionsGetResponses = {
298
+ /**
299
+ * Execution status (or full per-step payload when includeSteps=true)
300
+ */
301
+ 200: ExecutionStatusResponse | ExecutionSummary;
302
+ };
303
+
304
+ export type ExecutionsGetResponse = ExecutionsGetResponses[keyof ExecutionsGetResponses];
305
+
306
+ export type ExecutionsListData = {
307
+ body?: never;
308
+ path?: never;
309
+ query?: {
310
+ /**
311
+ * Comma-separated list of workflow ids to filter by
312
+ */
313
+ workflowId?: string;
314
+ /**
315
+ * Comma-separated list of execution statuses to filter by
316
+ */
317
+ status?: string;
318
+ /**
319
+ * ISO-8601 timestamp or relative expression (e.g. "now()-7d") for the lower bound on `createdAt`
320
+ */
321
+ fromDate?: string;
322
+ /**
323
+ * Upper bound on `createdAt`
324
+ */
325
+ toDate?: string;
326
+ /**
327
+ * Filter to executions launched from a specific eval example
328
+ */
329
+ exampleId?: string;
330
+ limit?: number;
331
+ offset?: number;
332
+ };
333
+ url: '/v1/executions';
334
+ };
335
+
336
+ export type ExecutionsListErrors = {
337
+ /**
338
+ * Validation error. Request shape did not match the spec.
339
+ */
340
+ 400: ApiErrorEnvelope;
341
+ /**
342
+ * Missing or invalid API key
343
+ */
344
+ 401: ApiErrorEnvelope;
345
+ /**
346
+ * API key lacks required scope
347
+ */
348
+ 403: ApiErrorEnvelope;
349
+ /**
350
+ * Resource not found
351
+ */
352
+ 404: ApiErrorEnvelope;
353
+ /**
354
+ * Rate limit exceeded
355
+ */
356
+ 429: ApiErrorEnvelope;
357
+ /**
358
+ * Internal server error
359
+ */
360
+ 500: ApiErrorEnvelope;
361
+ };
362
+
363
+ export type ExecutionsListError = ExecutionsListErrors[keyof ExecutionsListErrors];
364
+
365
+ export type ExecutionsListResponses = {
366
+ /**
367
+ * Paginated list of executions
368
+ */
369
+ 200: ListExecutionsResponse;
370
+ };
371
+
372
+ export type ExecutionsListResponse = ExecutionsListResponses[keyof ExecutionsListResponses];
373
+
374
+ export type WorkflowsGetData = {
375
+ body?: never;
376
+ path: {
377
+ /**
378
+ * Workflow id (e.g. wf_abc123)
379
+ */
380
+ id: string;
381
+ };
382
+ query?: never;
383
+ url: '/v1/workflows/{id}';
384
+ };
385
+
386
+ export type WorkflowsGetErrors = {
387
+ /**
388
+ * Validation error. Request shape did not match the spec.
389
+ */
390
+ 400: ApiErrorEnvelope;
391
+ /**
392
+ * Missing or invalid API key
393
+ */
394
+ 401: ApiErrorEnvelope;
395
+ /**
396
+ * API key lacks required scope
397
+ */
398
+ 403: ApiErrorEnvelope;
399
+ /**
400
+ * Resource not found
401
+ */
402
+ 404: ApiErrorEnvelope;
403
+ /**
404
+ * Rate limit exceeded
405
+ */
406
+ 429: ApiErrorEnvelope;
407
+ /**
408
+ * Internal server error
409
+ */
410
+ 500: ApiErrorEnvelope;
411
+ };
412
+
413
+ export type WorkflowsGetError = WorkflowsGetErrors[keyof WorkflowsGetErrors];
414
+
415
+ export type WorkflowsGetResponses = {
416
+ /**
417
+ * Workflow with current version
418
+ */
419
+ 200: WorkflowSummary;
420
+ };
421
+
422
+ export type WorkflowsGetResponse = WorkflowsGetResponses[keyof WorkflowsGetResponses];
423
+
424
+ export type WorkflowsRunData = {
425
+ body: RunWorkflowBody;
426
+ path: {
427
+ /**
428
+ * Workflow id (e.g. `wf_abc123`) or slug (e.g. `extract-invoice`, the workflow `name`).
429
+ */
430
+ id: string;
431
+ };
432
+ query?: {
433
+ /**
434
+ * Version id, or "latest" (default)
435
+ */
436
+ version?: string;
437
+ /**
438
+ * Seconds to hold the connection waiting for completion (max 60). Omit for async.
439
+ */
440
+ wait_for_completion?: number;
441
+ };
442
+ url: '/v1/workflows/{id}/run';
443
+ };
444
+
445
+ export type WorkflowsRunErrors = {
446
+ /**
447
+ * Validation error. Request shape did not match the spec.
448
+ */
449
+ 400: ApiErrorEnvelope;
450
+ /**
451
+ * Missing or invalid API key
452
+ */
453
+ 401: ApiErrorEnvelope;
454
+ /**
455
+ * API key lacks required scope
456
+ */
457
+ 403: ApiErrorEnvelope;
458
+ /**
459
+ * Resource not found
460
+ */
461
+ 404: ApiErrorEnvelope;
462
+ /**
463
+ * Rate limit exceeded
464
+ */
465
+ 429: ApiErrorEnvelope;
466
+ /**
467
+ * Internal server error
468
+ */
469
+ 500: ApiErrorEnvelope;
470
+ };
471
+
472
+ export type WorkflowsRunError = WorkflowsRunErrors[keyof WorkflowsRunErrors];
473
+
474
+ export type WorkflowsRunResponses = {
475
+ /**
476
+ * Execution accepted. Body always includes `executionId`. When `wait_for_completion` is set and the run completes within the window, `status`/`result`/`error` are also returned; otherwise poll `/v1/executions/{executionId}` for status.
477
+ */
478
+ 201: RunWorkflowResponse;
479
+ };
480
+
481
+ export type WorkflowsRunResponse = WorkflowsRunResponses[keyof WorkflowsRunResponses];
482
+
483
+ export type WorkflowsVersionsListData = {
484
+ body?: never;
485
+ path: {
486
+ /**
487
+ * Workflow id
488
+ */
489
+ id: string;
490
+ };
491
+ query?: {
492
+ /**
493
+ * Page size (max 100, default 50)
494
+ */
495
+ limit?: number;
496
+ /**
497
+ * Page offset
498
+ */
499
+ offset?: number;
500
+ };
501
+ url: '/v1/workflows/{id}/versions';
502
+ };
503
+
504
+ export type WorkflowsVersionsListErrors = {
505
+ /**
506
+ * Validation error. Request shape did not match the spec.
507
+ */
508
+ 400: ApiErrorEnvelope;
509
+ /**
510
+ * Missing or invalid API key
511
+ */
512
+ 401: ApiErrorEnvelope;
513
+ /**
514
+ * API key lacks required scope
515
+ */
516
+ 403: ApiErrorEnvelope;
517
+ /**
518
+ * Resource not found
519
+ */
520
+ 404: ApiErrorEnvelope;
521
+ /**
522
+ * Rate limit exceeded
523
+ */
524
+ 429: ApiErrorEnvelope;
525
+ /**
526
+ * Internal server error
527
+ */
528
+ 500: ApiErrorEnvelope;
529
+ };
530
+
531
+ export type WorkflowsVersionsListError =
532
+ WorkflowsVersionsListErrors[keyof WorkflowsVersionsListErrors];
533
+
534
+ export type WorkflowsVersionsListResponses = {
535
+ /**
536
+ * Paginated list of workflow versions
537
+ */
538
+ 200: ListVersionsResponse;
539
+ };
540
+
541
+ export type WorkflowsVersionsListResponse =
542
+ WorkflowsVersionsListResponses[keyof WorkflowsVersionsListResponses];
543
+
544
+ export type WorkflowsListData = {
545
+ body?: never;
546
+ path?: never;
547
+ query?: {
548
+ /**
549
+ * Substring match against workflow name
550
+ */
551
+ search?: string;
552
+ /**
553
+ * Exact-match lookup by workflow name (slug)
554
+ */
555
+ name?: string;
556
+ /**
557
+ * Filter by workflow kind
558
+ */
559
+ kind?: 'workflow' | 'block';
560
+ /**
561
+ * Page size (max 100, default 50)
562
+ */
563
+ limit?: number;
564
+ /**
565
+ * Page offset
566
+ */
567
+ offset?: number;
568
+ };
569
+ url: '/v1/workflows';
570
+ };
571
+
572
+ export type WorkflowsListErrors = {
573
+ /**
574
+ * Validation error. Request shape did not match the spec.
575
+ */
576
+ 400: ApiErrorEnvelope;
577
+ /**
578
+ * Missing or invalid API key
579
+ */
580
+ 401: ApiErrorEnvelope;
581
+ /**
582
+ * API key lacks required scope
583
+ */
584
+ 403: ApiErrorEnvelope;
585
+ /**
586
+ * Resource not found
587
+ */
588
+ 404: ApiErrorEnvelope;
589
+ /**
590
+ * Rate limit exceeded
591
+ */
592
+ 429: ApiErrorEnvelope;
593
+ /**
594
+ * Internal server error
595
+ */
596
+ 500: ApiErrorEnvelope;
597
+ };
598
+
599
+ export type WorkflowsListError = WorkflowsListErrors[keyof WorkflowsListErrors];
600
+
601
+ export type WorkflowsListResponses = {
602
+ /**
603
+ * Paginated list of workflows
604
+ */
605
+ 200: ListWorkflowsResponse;
606
+ };
607
+
608
+ export type WorkflowsListResponse = WorkflowsListResponses[keyof WorkflowsListResponses];
package/src/index.ts ADDED
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Official TypeScript SDK for the Eigenpal API.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { Eigenpal } from '@eigenpal/sdk';
7
+ *
8
+ * const client = new Eigenpal({ apiKey: process.env.EIGENPAL_API_KEY! });
9
+ *
10
+ * // Async — enqueue and poll later.
11
+ * const { executionId } = await client.workflows.run('wf_abc', { input: { ... } });
12
+ *
13
+ * // Sync (server holds the connection up to 60s).
14
+ * const result = await client.workflows.run('wf_abc', { input: { ... } }, {
15
+ * waitForCompletion: 60,
16
+ * });
17
+ *
18
+ * // Client-side poll (up to 5min by default).
19
+ * const final = await client.executions.runAndWait('wf_abc', { input: { ... } });
20
+ * ```
21
+ */
22
+ export { Eigenpal, type EigenpalOptions } from './client';
23
+
24
+ export {
25
+ EigenpalAuthError,
26
+ EigenpalError,
27
+ EigenpalForbiddenError,
28
+ EigenpalNotFoundError,
29
+ EigenpalRateLimitError,
30
+ EigenpalServerError,
31
+ EigenpalTimeoutError,
32
+ EigenpalValidationError,
33
+ } from './errors';
34
+
35
+ export type { FileDescriptor, FileInput } from './lib/files';
36
+ export type {
37
+ ListVersionsOptions,
38
+ ListWorkflowsOptions,
39
+ RunWorkflowOptions,
40
+ WorkflowInput,
41
+ } from './resources/workflows';
42
+ // Note: FileReference (by fileId) is intentionally NOT exported. From the
43
+ // SDK perspective you always upload a file; fileId is an internal wire id
44
+ // the server creates after upload — not something users construct.
45
+
46
+ export type { ListExecutionsOptions, RunAndWaitOptions } from './resources/executions';
47
+
48
+ // Re-export the canonical generated types so users can type their own
49
+ // callbacks and helpers without reaching into `./generated`.
50
+ export type {
51
+ ApiErrorEnvelope,
52
+ ApiErrorIssue,
53
+ CancelExecutionResponse,
54
+ ExecutionStatus,
55
+ ExecutionStatusResponse,
56
+ ExecutionSummary,
57
+ ListExecutionsResponse,
58
+ ListVersionsResponse,
59
+ ListWorkflowsResponse,
60
+ RunWorkflowBody,
61
+ RunWorkflowResponse,
62
+ WorkflowSummary,
63
+ WorkflowVersion,
64
+ } from './generated/types.gen';