@meistrari/tela-sdk-js 2.5.0 → 2.6.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/dist/index.cjs +951 -253
- package/dist/index.d.cts +1280 -364
- package/dist/index.d.mts +1280 -364
- package/dist/index.d.ts +1280 -364
- package/dist/index.mjs +1022 -327
- package/package.json +1 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _zod__default, { ZodError, z } from 'zod';
|
|
1
|
+
import z, { z as z$1 } from 'zod';
|
|
3
2
|
import Emittery from 'emittery';
|
|
3
|
+
import { JSONSchema } from 'zod/v4/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Base HTTP client with retry logic, request/response transformation, and streaming support.
|
|
@@ -146,6 +146,15 @@ declare class ExecutionFailedError extends TelaError {
|
|
|
146
146
|
readonly rawOutput: Record<string, any>;
|
|
147
147
|
constructor(rawOutput: Record<string, any>);
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Thrown when a workstation task fails on the server.
|
|
151
|
+
*
|
|
152
|
+
* @category Errors
|
|
153
|
+
*/
|
|
154
|
+
declare class TaskFailedError extends TelaError {
|
|
155
|
+
readonly rawTask: Record<string, any>;
|
|
156
|
+
constructor(rawTask: Record<string, any>, message?: string, cause?: Error);
|
|
157
|
+
}
|
|
149
158
|
/**
|
|
150
159
|
* Thrown when batch execution fails on the server.
|
|
151
160
|
*
|
|
@@ -257,7 +266,7 @@ type TelaFileOptions = BaseTelaFileOptions | TelaFileOptionsWithMimeType;
|
|
|
257
266
|
* which can be a URL string, Uint8Array, ReadableStream, ReadStream, Blob, or File.
|
|
258
267
|
*/
|
|
259
268
|
type TelaFileInput = string | Uint8Array | ReadableStream | Blob | File;
|
|
260
|
-
declare function TelaFileSchema():
|
|
269
|
+
declare function TelaFileSchema(): z.ZodCustom<TelaFile, TelaFile>;
|
|
261
270
|
/**
|
|
262
271
|
* Represents a file with support for various types including URLs, binary data, streams, and Blobs.
|
|
263
272
|
*
|
|
@@ -394,6 +403,487 @@ declare class TelaFile {
|
|
|
394
403
|
*/
|
|
395
404
|
private isValidVaultReference;
|
|
396
405
|
}
|
|
406
|
+
declare function isTelaFile(obj: unknown): obj is TelaFile;
|
|
407
|
+
declare function isTelaFileArray(obj: unknown): obj is TelaFile[];
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Represents a variable that can be used in a canvas template.
|
|
411
|
+
*/
|
|
412
|
+
type CanvasVariable = {
|
|
413
|
+
/**
|
|
414
|
+
* The name of the variable.
|
|
415
|
+
*/
|
|
416
|
+
name: string;
|
|
417
|
+
/**
|
|
418
|
+
* The type of the variable (e.g., 'string', 'number', 'file').
|
|
419
|
+
*/
|
|
420
|
+
type: string;
|
|
421
|
+
/**
|
|
422
|
+
* Whether this variable is required for canvas execution.
|
|
423
|
+
*/
|
|
424
|
+
required: boolean;
|
|
425
|
+
/**
|
|
426
|
+
* Description of the variable's purpose.
|
|
427
|
+
*/
|
|
428
|
+
description: string;
|
|
429
|
+
/**
|
|
430
|
+
* Processing options for the variable.
|
|
431
|
+
*/
|
|
432
|
+
processingOptions: {
|
|
433
|
+
/**
|
|
434
|
+
* Whether multimodal content (images, files) is allowed.
|
|
435
|
+
*/
|
|
436
|
+
allowMultimodal: boolean;
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Represents a specific version of a canvas/prompt from the Tela API.
|
|
442
|
+
*/
|
|
443
|
+
type PromptVersion = {
|
|
444
|
+
/**
|
|
445
|
+
* Unique identifier for this prompt version.
|
|
446
|
+
*/
|
|
447
|
+
id: string;
|
|
448
|
+
/**
|
|
449
|
+
* The raw content of the prompt.
|
|
450
|
+
*/
|
|
451
|
+
content: string;
|
|
452
|
+
/**
|
|
453
|
+
* The markdown-formatted content of the prompt.
|
|
454
|
+
*/
|
|
455
|
+
markdownContent: any;
|
|
456
|
+
/**
|
|
457
|
+
* The ID of the parent prompt.
|
|
458
|
+
*/
|
|
459
|
+
promptId: string;
|
|
460
|
+
/**
|
|
461
|
+
* Variables available in this prompt version.
|
|
462
|
+
*/
|
|
463
|
+
variables: Array<CanvasVariable>;
|
|
464
|
+
/**
|
|
465
|
+
* The title/name of the prompt.
|
|
466
|
+
*/
|
|
467
|
+
title: string;
|
|
468
|
+
/**
|
|
469
|
+
* Configuration settings for this prompt version.
|
|
470
|
+
*/
|
|
471
|
+
configuration: {
|
|
472
|
+
/**
|
|
473
|
+
* The AI model to use (e.g., 'gpt-4', 'claude-3').
|
|
474
|
+
*/
|
|
475
|
+
model: string;
|
|
476
|
+
/**
|
|
477
|
+
* The type of prompt ('chat' or 'completion').
|
|
478
|
+
*/
|
|
479
|
+
type: string;
|
|
480
|
+
/**
|
|
481
|
+
* Temperature setting for response randomness (0-1).
|
|
482
|
+
*/
|
|
483
|
+
temperature: number;
|
|
484
|
+
/**
|
|
485
|
+
* Structured output configuration.
|
|
486
|
+
*/
|
|
487
|
+
structuredOutput: {
|
|
488
|
+
/**
|
|
489
|
+
* JSON schema for validating structured output.
|
|
490
|
+
*/
|
|
491
|
+
schema: JSONSchema.JSONSchema;
|
|
492
|
+
/**
|
|
493
|
+
* Whether structured output is enabled.
|
|
494
|
+
*/
|
|
495
|
+
enabled: boolean;
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* Whether this version is promoted to production.
|
|
500
|
+
*/
|
|
501
|
+
promoted: boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Whether this is a draft version.
|
|
504
|
+
*/
|
|
505
|
+
draft: boolean;
|
|
506
|
+
/**
|
|
507
|
+
* ID of the workspace this prompt belongs to.
|
|
508
|
+
*/
|
|
509
|
+
workspaceId: string;
|
|
510
|
+
/**
|
|
511
|
+
* Workflow specification if this is a workflow-based prompt.
|
|
512
|
+
*/
|
|
513
|
+
workflowSpec: any;
|
|
514
|
+
/**
|
|
515
|
+
* Graph representation of the workflow.
|
|
516
|
+
*/
|
|
517
|
+
graph: any;
|
|
518
|
+
/**
|
|
519
|
+
* Whether this prompt is a workflow.
|
|
520
|
+
*/
|
|
521
|
+
isWorkflow: boolean;
|
|
522
|
+
/**
|
|
523
|
+
* User ID who created this version.
|
|
524
|
+
*/
|
|
525
|
+
createdBy: string;
|
|
526
|
+
/**
|
|
527
|
+
* User ID who last updated this version.
|
|
528
|
+
*/
|
|
529
|
+
updatedBy: string;
|
|
530
|
+
/**
|
|
531
|
+
* User ID who deleted this version, if applicable.
|
|
532
|
+
*/
|
|
533
|
+
deletedBy: any;
|
|
534
|
+
/**
|
|
535
|
+
* ISO timestamp when this version was created.
|
|
536
|
+
*/
|
|
537
|
+
createdAt: string;
|
|
538
|
+
/**
|
|
539
|
+
* ISO timestamp when this version was last updated.
|
|
540
|
+
*/
|
|
541
|
+
updatedAt: string;
|
|
542
|
+
/**
|
|
543
|
+
* ISO timestamp when this version was deleted, if applicable.
|
|
544
|
+
*/
|
|
545
|
+
deletedAt: any;
|
|
546
|
+
/**
|
|
547
|
+
* Messages in the conversation for this prompt version.
|
|
548
|
+
*/
|
|
549
|
+
messages: Array<{
|
|
550
|
+
/**
|
|
551
|
+
* Unique message identifier.
|
|
552
|
+
*/
|
|
553
|
+
id: string;
|
|
554
|
+
/**
|
|
555
|
+
* The raw content of the message.
|
|
556
|
+
*/
|
|
557
|
+
content: string;
|
|
558
|
+
/**
|
|
559
|
+
* The markdown-formatted content of the message.
|
|
560
|
+
*/
|
|
561
|
+
markdownContent: string;
|
|
562
|
+
/**
|
|
563
|
+
* Role of the message sender (e.g., 'user', 'assistant').
|
|
564
|
+
*/
|
|
565
|
+
role: string;
|
|
566
|
+
/**
|
|
567
|
+
* ID of the prompt version this message belongs to.
|
|
568
|
+
*/
|
|
569
|
+
promptVersionId: string;
|
|
570
|
+
/**
|
|
571
|
+
* Order index of this message in the conversation.
|
|
572
|
+
*/
|
|
573
|
+
index: number;
|
|
574
|
+
/**
|
|
575
|
+
* User ID who created this message.
|
|
576
|
+
*/
|
|
577
|
+
createdBy: string;
|
|
578
|
+
/**
|
|
579
|
+
* User ID who last updated this message.
|
|
580
|
+
*/
|
|
581
|
+
updatedBy: string;
|
|
582
|
+
/**
|
|
583
|
+
* ISO timestamp when this message was created.
|
|
584
|
+
*/
|
|
585
|
+
createdAt: string;
|
|
586
|
+
/**
|
|
587
|
+
* ISO timestamp when this message was last updated.
|
|
588
|
+
*/
|
|
589
|
+
updatedAt: string;
|
|
590
|
+
/**
|
|
591
|
+
* ISO timestamp when this message was deleted, if applicable.
|
|
592
|
+
*/
|
|
593
|
+
deletedAt: any;
|
|
594
|
+
}>;
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Schema validation and matching utilities.
|
|
599
|
+
*
|
|
600
|
+
* This module provides utilities for validating and comparing client-side
|
|
601
|
+
* schemas with server-side schemas, detecting mismatches and type differences.
|
|
602
|
+
*
|
|
603
|
+
* @module Utilities
|
|
604
|
+
*/
|
|
605
|
+
|
|
606
|
+
declare const zod: {
|
|
607
|
+
file: typeof TelaFileSchema;
|
|
608
|
+
core: typeof z$1.core;
|
|
609
|
+
globalRegistry: z$1.core.$ZodRegistry<z$1.core.GlobalMeta, z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
610
|
+
registry: typeof z$1.core.registry;
|
|
611
|
+
config: typeof z$1.core.config;
|
|
612
|
+
$output: typeof z$1.core.$output;
|
|
613
|
+
$input: typeof z$1.core.$input;
|
|
614
|
+
$brand: typeof z$1.core.$brand;
|
|
615
|
+
clone: typeof z$1.core.util.clone;
|
|
616
|
+
regexes: typeof z$1.core.regexes;
|
|
617
|
+
treeifyError: typeof z$1.core.treeifyError;
|
|
618
|
+
prettifyError: typeof z$1.core.prettifyError;
|
|
619
|
+
formatError: typeof z$1.core.formatError;
|
|
620
|
+
flattenError: typeof z$1.core.flattenError;
|
|
621
|
+
toJSONSchema: typeof z$1.core.toJSONSchema;
|
|
622
|
+
TimePrecision: {
|
|
623
|
+
readonly Any: null;
|
|
624
|
+
readonly Minute: -1;
|
|
625
|
+
readonly Second: 0;
|
|
626
|
+
readonly Millisecond: 3;
|
|
627
|
+
readonly Microsecond: 6;
|
|
628
|
+
};
|
|
629
|
+
util: typeof z$1.core.util;
|
|
630
|
+
NEVER: never;
|
|
631
|
+
locales: typeof z$1.core.locales;
|
|
632
|
+
ZodISODateTime: z$1.core.$constructor<z$1.ZodISODateTime, z$1.core.$ZodISODateTimeDef>;
|
|
633
|
+
ZodISODate: z$1.core.$constructor<z$1.ZodISODate, z$1.core.$ZodStringFormatDef<"date">>;
|
|
634
|
+
ZodISOTime: z$1.core.$constructor<z$1.ZodISOTime, z$1.core.$ZodISOTimeDef>;
|
|
635
|
+
ZodISODuration: z$1.core.$constructor<z$1.ZodISODuration, z$1.core.$ZodStringFormatDef<"duration">>;
|
|
636
|
+
iso: typeof z$1.iso;
|
|
637
|
+
coerce: typeof z$1.coerce;
|
|
638
|
+
string(params?: string | z$1.core.$ZodStringParams): z$1.ZodString;
|
|
639
|
+
string<T extends string>(params?: string | z$1.core.$ZodStringParams): z$1.core.$ZodType<T, T>;
|
|
640
|
+
email(params?: string | z$1.core.$ZodEmailParams): z$1.ZodEmail;
|
|
641
|
+
guid(params?: string | z$1.core.$ZodGUIDParams): z$1.ZodGUID;
|
|
642
|
+
uuid(params?: string | z$1.core.$ZodUUIDParams): z$1.ZodUUID;
|
|
643
|
+
uuidv4(params?: string | z$1.core.$ZodUUIDv4Params): z$1.ZodUUID;
|
|
644
|
+
uuidv6(params?: string | z$1.core.$ZodUUIDv6Params): z$1.ZodUUID;
|
|
645
|
+
uuidv7(params?: string | z$1.core.$ZodUUIDv7Params): z$1.ZodUUID;
|
|
646
|
+
url(params?: string | z$1.core.$ZodURLParams): z$1.ZodURL;
|
|
647
|
+
httpUrl(params?: string | Omit<z$1.core.$ZodURLParams, "protocol" | "hostname">): z$1.ZodURL;
|
|
648
|
+
emoji(params?: string | z$1.core.$ZodEmojiParams): z$1.ZodEmoji;
|
|
649
|
+
nanoid(params?: string | z$1.core.$ZodNanoIDParams): z$1.ZodNanoID;
|
|
650
|
+
cuid(params?: string | z$1.core.$ZodCUIDParams): z$1.ZodCUID;
|
|
651
|
+
cuid2(params?: string | z$1.core.$ZodCUID2Params): z$1.ZodCUID2;
|
|
652
|
+
ulid(params?: string | z$1.core.$ZodULIDParams): z$1.ZodULID;
|
|
653
|
+
xid(params?: string | z$1.core.$ZodXIDParams): z$1.ZodXID;
|
|
654
|
+
ksuid(params?: string | z$1.core.$ZodKSUIDParams): z$1.ZodKSUID;
|
|
655
|
+
ipv4(params?: string | z$1.core.$ZodIPv4Params): z$1.ZodIPv4;
|
|
656
|
+
ipv6(params?: string | z$1.core.$ZodIPv6Params): z$1.ZodIPv6;
|
|
657
|
+
cidrv4(params?: string | z$1.core.$ZodCIDRv4Params): z$1.ZodCIDRv4;
|
|
658
|
+
cidrv6(params?: string | z$1.core.$ZodCIDRv6Params): z$1.ZodCIDRv6;
|
|
659
|
+
base64(params?: string | z$1.core.$ZodBase64Params): z$1.ZodBase64;
|
|
660
|
+
base64url(params?: string | z$1.core.$ZodBase64URLParams): z$1.ZodBase64URL;
|
|
661
|
+
e164(params?: string | z$1.core.$ZodE164Params): z$1.ZodE164;
|
|
662
|
+
jwt(params?: string | z$1.core.$ZodJWTParams): z$1.ZodJWT;
|
|
663
|
+
stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => z$1.core.util.MaybeAsync<unknown>) | RegExp, _params?: string | z$1.core.$ZodStringFormatParams): z$1.ZodCustomStringFormat<Format>;
|
|
664
|
+
hostname(_params?: string | z$1.core.$ZodStringFormatParams): z$1.ZodCustomStringFormat<"hostname">;
|
|
665
|
+
hex(_params?: string | z$1.core.$ZodStringFormatParams): z$1.ZodCustomStringFormat<"hex">;
|
|
666
|
+
hash<Alg extends z$1.core.util.HashAlgorithm, Enc extends z$1.core.util.HashEncoding = "hex">(alg: Alg, params?: {
|
|
667
|
+
enc?: Enc;
|
|
668
|
+
} & z$1.core.$ZodStringFormatParams): z$1.ZodCustomStringFormat<`${Alg}_${Enc}`>;
|
|
669
|
+
number(params?: string | z$1.core.$ZodNumberParams): z$1.ZodNumber;
|
|
670
|
+
int(params?: string | z$1.core.$ZodCheckNumberFormatParams): z$1.ZodInt;
|
|
671
|
+
float32(params?: string | z$1.core.$ZodCheckNumberFormatParams): z$1.ZodFloat32;
|
|
672
|
+
float64(params?: string | z$1.core.$ZodCheckNumberFormatParams): z$1.ZodFloat64;
|
|
673
|
+
int32(params?: string | z$1.core.$ZodCheckNumberFormatParams): z$1.ZodInt32;
|
|
674
|
+
uint32(params?: string | z$1.core.$ZodCheckNumberFormatParams): z$1.ZodUInt32;
|
|
675
|
+
boolean(params?: string | z$1.core.$ZodBooleanParams): z$1.ZodBoolean;
|
|
676
|
+
bigint(params?: string | z$1.core.$ZodBigIntParams): z$1.ZodBigInt;
|
|
677
|
+
int64(params?: string | z$1.core.$ZodBigIntFormatParams): z$1.ZodBigIntFormat;
|
|
678
|
+
uint64(params?: string | z$1.core.$ZodBigIntFormatParams): z$1.ZodBigIntFormat;
|
|
679
|
+
symbol(params?: string | z$1.core.$ZodSymbolParams): z$1.ZodSymbol;
|
|
680
|
+
any(): z$1.ZodAny;
|
|
681
|
+
unknown(): z$1.ZodUnknown;
|
|
682
|
+
never(params?: string | z$1.core.$ZodNeverParams): z$1.ZodNever;
|
|
683
|
+
date(params?: string | z$1.core.$ZodDateParams): z$1.ZodDate;
|
|
684
|
+
array<T extends z$1.core.SomeType>(element: T, params?: string | z$1.core.$ZodArrayParams): z$1.ZodArray<T>;
|
|
685
|
+
keyof<T extends z$1.ZodObject>(schema: T): z$1.ZodEnum<z$1.core.util.KeysEnum<T["_zod"]["output"]>>;
|
|
686
|
+
object<T extends z$1.core.$ZodLooseShape = Partial<Record<never, z$1.core.SomeType>>>(shape?: T, params?: string | z$1.core.$ZodObjectParams): z$1.ZodObject<z$1.core.util.Writeable<T>, z$1.core.$strip>;
|
|
687
|
+
strictObject<T extends z$1.core.$ZodLooseShape>(shape: T, params?: string | z$1.core.$ZodObjectParams): z$1.ZodObject<T, z$1.core.$strict>;
|
|
688
|
+
looseObject<T extends z$1.core.$ZodLooseShape>(shape: T, params?: string | z$1.core.$ZodObjectParams): z$1.ZodObject<T, z$1.core.$loose>;
|
|
689
|
+
union<const T extends readonly z$1.core.SomeType[]>(options: T, params?: string | z$1.core.$ZodUnionParams): z$1.ZodUnion<T>;
|
|
690
|
+
discriminatedUnion<Types extends readonly [z$1.core.$ZodTypeDiscriminable, ...z$1.core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | z$1.core.$ZodDiscriminatedUnionParams): z$1.ZodDiscriminatedUnion<Types, Disc>;
|
|
691
|
+
intersection<T extends z$1.core.SomeType, U extends z$1.core.SomeType>(left: T, right: U): z$1.ZodIntersection<T, U>;
|
|
692
|
+
tuple<T extends readonly [z$1.core.SomeType, ...z$1.core.SomeType[]]>(items: T, params?: string | z$1.core.$ZodTupleParams): z$1.ZodTuple<T, null>;
|
|
693
|
+
tuple<T extends readonly [z$1.core.SomeType, ...z$1.core.SomeType[]], Rest extends z$1.core.SomeType>(items: T, rest: Rest, params?: string | z$1.core.$ZodTupleParams): z$1.ZodTuple<T, Rest>;
|
|
694
|
+
tuple(items: [], params?: string | z$1.core.$ZodTupleParams): z$1.ZodTuple<[], null>;
|
|
695
|
+
record<Key extends z$1.core.$ZodRecordKey, Value extends z$1.core.SomeType>(keyType: Key, valueType: Value, params?: string | z$1.core.$ZodRecordParams): z$1.ZodRecord<Key, Value>;
|
|
696
|
+
partialRecord<Key extends z$1.core.$ZodRecordKey, Value extends z$1.core.SomeType>(keyType: Key, valueType: Value, params?: string | z$1.core.$ZodRecordParams): z$1.ZodRecord<Key & z$1.core.$partial, Value>;
|
|
697
|
+
map<Key extends z$1.core.SomeType, Value extends z$1.core.SomeType>(keyType: Key, valueType: Value, params?: string | z$1.core.$ZodMapParams): z$1.ZodMap<Key, Value>;
|
|
698
|
+
set<Value extends z$1.core.SomeType>(valueType: Value, params?: string | z$1.core.$ZodSetParams): z$1.ZodSet<Value>;
|
|
699
|
+
nativeEnum<T extends z$1.core.util.EnumLike>(entries: T, params?: string | z$1.core.$ZodEnumParams): z$1.ZodEnum<T>;
|
|
700
|
+
literal<const T extends ReadonlyArray<z$1.core.util.Literal>>(value: T, params?: string | z$1.core.$ZodLiteralParams): z$1.ZodLiteral<T[number]>;
|
|
701
|
+
literal<const T extends z$1.core.util.Literal>(value: T, params?: string | z$1.core.$ZodLiteralParams): z$1.ZodLiteral<T>;
|
|
702
|
+
transform<I = unknown, O = I>(fn: (input: I, ctx: z$1.core.ParsePayload) => O): z$1.ZodTransform<Awaited<O>, I>;
|
|
703
|
+
optional<T extends z$1.core.SomeType>(innerType: T): z$1.ZodOptional<T>;
|
|
704
|
+
nullable<T extends z$1.core.SomeType>(innerType: T): z$1.ZodNullable<T>;
|
|
705
|
+
nullish<T extends z$1.core.SomeType>(innerType: T): z$1.ZodOptional<z$1.ZodNullable<T>>;
|
|
706
|
+
_default<T extends z$1.core.SomeType>(innerType: T, defaultValue: z$1.core.util.NoUndefined<z$1.core.output<T>> | (() => z$1.core.util.NoUndefined<z$1.core.output<T>>)): z$1.ZodDefault<T>;
|
|
707
|
+
prefault<T extends z$1.core.SomeType>(innerType: T, defaultValue: z$1.core.input<T> | (() => z$1.core.input<T>)): z$1.ZodPrefault<T>;
|
|
708
|
+
nonoptional<T extends z$1.core.SomeType>(innerType: T, params?: string | z$1.core.$ZodNonOptionalParams): z$1.ZodNonOptional<T>;
|
|
709
|
+
success<T extends z$1.core.SomeType>(innerType: T): z$1.ZodSuccess<T>;
|
|
710
|
+
nan(params?: string | z$1.core.$ZodNaNParams): z$1.ZodNaN;
|
|
711
|
+
pipe<const A extends z$1.core.SomeType, B extends z$1.core.$ZodType<unknown, z$1.core.output<A>> = z$1.core.$ZodType<unknown, z$1.core.output<A>, z$1.core.$ZodTypeInternals<unknown, z$1.core.output<A>>>>(in_: A, out: B | z$1.core.$ZodType<unknown, z$1.core.output<A>>): z$1.ZodPipe<A, B>;
|
|
712
|
+
codec<const A extends z$1.core.SomeType, B extends z$1.core.SomeType = z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>>(in_: A, out: B, params: {
|
|
713
|
+
decode: (value: z$1.core.output<A>, payload: z$1.core.ParsePayload<z$1.core.output<A>>) => z$1.core.util.MaybeAsync<z$1.core.input<B>>;
|
|
714
|
+
encode: (value: z$1.core.input<B>, payload: z$1.core.ParsePayload<z$1.core.input<B>>) => z$1.core.util.MaybeAsync<z$1.core.output<A>>;
|
|
715
|
+
}): z$1.ZodCodec<A, B>;
|
|
716
|
+
readonly<T extends z$1.core.SomeType>(innerType: T): z$1.ZodReadonly<T>;
|
|
717
|
+
templateLiteral<const Parts extends z$1.core.$ZodTemplateLiteralPart[]>(parts: Parts, params?: string | z$1.core.$ZodTemplateLiteralParams): z$1.ZodTemplateLiteral<z$1.core.$PartsToTemplateLiteral<Parts>>;
|
|
718
|
+
lazy<T extends z$1.core.SomeType>(getter: () => T): z$1.ZodLazy<T>;
|
|
719
|
+
promise<T extends z$1.core.SomeType>(innerType: T): z$1.ZodPromise<T>;
|
|
720
|
+
_function(): z$1.ZodFunction;
|
|
721
|
+
_function<const In extends ReadonlyArray<z$1.core.$ZodType>>(params: {
|
|
722
|
+
input: In;
|
|
723
|
+
}): z$1.ZodFunction<z$1.ZodTuple<In, null>, z$1.core.$ZodFunctionOut>;
|
|
724
|
+
_function<const In extends ReadonlyArray<z$1.core.$ZodType>, const Out extends z$1.core.$ZodFunctionOut = z$1.core.$ZodFunctionOut>(params: {
|
|
725
|
+
input: In;
|
|
726
|
+
output: Out;
|
|
727
|
+
}): z$1.ZodFunction<z$1.ZodTuple<In, null>, Out>;
|
|
728
|
+
_function<const In extends z$1.core.$ZodFunctionIn = z$1.core.$ZodFunctionArgs>(params: {
|
|
729
|
+
input: In;
|
|
730
|
+
}): z$1.ZodFunction<In, z$1.core.$ZodFunctionOut>;
|
|
731
|
+
_function<const Out extends z$1.core.$ZodFunctionOut = z$1.core.$ZodFunctionOut>(params: {
|
|
732
|
+
output: Out;
|
|
733
|
+
}): z$1.ZodFunction<z$1.core.$ZodFunctionIn, Out>;
|
|
734
|
+
_function<In extends z$1.core.$ZodFunctionIn = z$1.core.$ZodFunctionArgs, Out extends z$1.core.$ZodType = z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>>(params?: {
|
|
735
|
+
input: In;
|
|
736
|
+
output: Out;
|
|
737
|
+
}): z$1.ZodFunction<In, Out>;
|
|
738
|
+
check<O = unknown>(fn: z$1.core.CheckFn<O>): z$1.core.$ZodCheck<O>;
|
|
739
|
+
custom<O>(fn?: (data: unknown) => unknown, _params?: string | z$1.core.$ZodCustomParams | undefined): z$1.ZodCustom<O, O>;
|
|
740
|
+
refine<T>(fn: (arg: NoInfer<T>) => z$1.core.util.MaybeAsync<unknown>, _params?: string | z$1.core.$ZodCustomParams): z$1.core.$ZodCheck<T>;
|
|
741
|
+
superRefine<T>(fn: (arg: T, payload: z$1.core.$RefinementCtx<T>) => void | Promise<void>): z$1.core.$ZodCheck<T>;
|
|
742
|
+
json(params?: string | z$1.core.$ZodCustomParams): z$1.ZodJSONSchema;
|
|
743
|
+
preprocess<A, U extends z$1.core.SomeType, B = unknown>(fn: (arg: B, ctx: z$1.core.$RefinementCtx) => A, schema: U): z$1.ZodPipe<z$1.ZodTransform<A, B>, U>;
|
|
744
|
+
ZodType: z$1.core.$constructor<z$1.ZodType>;
|
|
745
|
+
_ZodString: z$1.core.$constructor<z$1._ZodString>;
|
|
746
|
+
ZodString: z$1.core.$constructor<z$1.ZodString>;
|
|
747
|
+
ZodStringFormat: z$1.core.$constructor<z$1.ZodStringFormat>;
|
|
748
|
+
ZodEmail: z$1.core.$constructor<z$1.ZodEmail>;
|
|
749
|
+
ZodGUID: z$1.core.$constructor<z$1.ZodGUID>;
|
|
750
|
+
ZodUUID: z$1.core.$constructor<z$1.ZodUUID>;
|
|
751
|
+
ZodURL: z$1.core.$constructor<z$1.ZodURL>;
|
|
752
|
+
ZodEmoji: z$1.core.$constructor<z$1.ZodEmoji>;
|
|
753
|
+
ZodNanoID: z$1.core.$constructor<z$1.ZodNanoID>;
|
|
754
|
+
ZodCUID: z$1.core.$constructor<z$1.ZodCUID>;
|
|
755
|
+
ZodCUID2: z$1.core.$constructor<z$1.ZodCUID2>;
|
|
756
|
+
ZodULID: z$1.core.$constructor<z$1.ZodULID>;
|
|
757
|
+
ZodXID: z$1.core.$constructor<z$1.ZodXID>;
|
|
758
|
+
ZodKSUID: z$1.core.$constructor<z$1.ZodKSUID>;
|
|
759
|
+
ZodIPv4: z$1.core.$constructor<z$1.ZodIPv4>;
|
|
760
|
+
ZodIPv6: z$1.core.$constructor<z$1.ZodIPv6>;
|
|
761
|
+
ZodCIDRv4: z$1.core.$constructor<z$1.ZodCIDRv4>;
|
|
762
|
+
ZodCIDRv6: z$1.core.$constructor<z$1.ZodCIDRv6>;
|
|
763
|
+
ZodBase64: z$1.core.$constructor<z$1.ZodBase64>;
|
|
764
|
+
ZodBase64URL: z$1.core.$constructor<z$1.ZodBase64URL>;
|
|
765
|
+
ZodE164: z$1.core.$constructor<z$1.ZodE164>;
|
|
766
|
+
ZodJWT: z$1.core.$constructor<z$1.ZodJWT>;
|
|
767
|
+
ZodCustomStringFormat: z$1.core.$constructor<z$1.ZodCustomStringFormat>;
|
|
768
|
+
ZodNumber: z$1.core.$constructor<z$1.ZodNumber>;
|
|
769
|
+
ZodNumberFormat: z$1.core.$constructor<z$1.ZodNumberFormat>;
|
|
770
|
+
ZodBoolean: z$1.core.$constructor<z$1.ZodBoolean>;
|
|
771
|
+
ZodBigInt: z$1.core.$constructor<z$1.ZodBigInt>;
|
|
772
|
+
ZodBigIntFormat: z$1.core.$constructor<z$1.ZodBigIntFormat>;
|
|
773
|
+
ZodSymbol: z$1.core.$constructor<z$1.ZodSymbol>;
|
|
774
|
+
ZodUndefined: z$1.core.$constructor<z$1.ZodUndefined>;
|
|
775
|
+
undefined: typeof z$1.undefined;
|
|
776
|
+
ZodNull: z$1.core.$constructor<z$1.ZodNull>;
|
|
777
|
+
null: typeof z$1.null;
|
|
778
|
+
ZodAny: z$1.core.$constructor<z$1.ZodAny>;
|
|
779
|
+
ZodUnknown: z$1.core.$constructor<z$1.ZodUnknown>;
|
|
780
|
+
ZodNever: z$1.core.$constructor<z$1.ZodNever>;
|
|
781
|
+
ZodVoid: z$1.core.$constructor<z$1.ZodVoid>;
|
|
782
|
+
void: typeof z$1.void;
|
|
783
|
+
ZodDate: z$1.core.$constructor<z$1.ZodDate>;
|
|
784
|
+
ZodArray: z$1.core.$constructor<z$1.ZodArray>;
|
|
785
|
+
ZodObject: z$1.core.$constructor<z$1.ZodObject>;
|
|
786
|
+
ZodUnion: z$1.core.$constructor<z$1.ZodUnion>;
|
|
787
|
+
ZodDiscriminatedUnion: z$1.core.$constructor<z$1.ZodDiscriminatedUnion>;
|
|
788
|
+
ZodIntersection: z$1.core.$constructor<z$1.ZodIntersection>;
|
|
789
|
+
ZodTuple: z$1.core.$constructor<z$1.ZodTuple>;
|
|
790
|
+
ZodRecord: z$1.core.$constructor<z$1.ZodRecord>;
|
|
791
|
+
ZodMap: z$1.core.$constructor<z$1.ZodMap>;
|
|
792
|
+
ZodSet: z$1.core.$constructor<z$1.ZodSet>;
|
|
793
|
+
ZodEnum: z$1.core.$constructor<z$1.ZodEnum>;
|
|
794
|
+
enum: typeof z$1.enum;
|
|
795
|
+
ZodLiteral: z$1.core.$constructor<z$1.ZodLiteral>;
|
|
796
|
+
ZodFile: z$1.core.$constructor<z$1.ZodFile>;
|
|
797
|
+
ZodTransform: z$1.core.$constructor<z$1.ZodTransform>;
|
|
798
|
+
ZodOptional: z$1.core.$constructor<z$1.ZodOptional>;
|
|
799
|
+
ZodNullable: z$1.core.$constructor<z$1.ZodNullable>;
|
|
800
|
+
ZodDefault: z$1.core.$constructor<z$1.ZodDefault>;
|
|
801
|
+
ZodPrefault: z$1.core.$constructor<z$1.ZodPrefault>;
|
|
802
|
+
ZodNonOptional: z$1.core.$constructor<z$1.ZodNonOptional>;
|
|
803
|
+
ZodSuccess: z$1.core.$constructor<z$1.ZodSuccess>;
|
|
804
|
+
ZodCatch: z$1.core.$constructor<z$1.ZodCatch>;
|
|
805
|
+
catch: typeof z$1.catch;
|
|
806
|
+
ZodNaN: z$1.core.$constructor<z$1.ZodNaN>;
|
|
807
|
+
ZodPipe: z$1.core.$constructor<z$1.ZodPipe>;
|
|
808
|
+
ZodCodec: z$1.core.$constructor<z$1.ZodCodec>;
|
|
809
|
+
ZodReadonly: z$1.core.$constructor<z$1.ZodReadonly>;
|
|
810
|
+
ZodTemplateLiteral: z$1.core.$constructor<z$1.ZodTemplateLiteral>;
|
|
811
|
+
ZodLazy: z$1.core.$constructor<z$1.ZodLazy>;
|
|
812
|
+
ZodPromise: z$1.core.$constructor<z$1.ZodPromise>;
|
|
813
|
+
ZodFunction: z$1.core.$constructor<z$1.ZodFunction>;
|
|
814
|
+
function: typeof z$1._function;
|
|
815
|
+
ZodCustom: z$1.core.$constructor<z$1.ZodCustom>;
|
|
816
|
+
instanceof: typeof z$1.instanceof;
|
|
817
|
+
stringbool: (_params?: string | z$1.core.$ZodStringBoolParams) => z$1.ZodCodec<z$1.ZodString, z$1.ZodBoolean>;
|
|
818
|
+
lt: typeof z$1.core._lt;
|
|
819
|
+
lte: typeof z$1.core._lte;
|
|
820
|
+
gt: typeof z$1.core._gt;
|
|
821
|
+
gte: typeof z$1.core._gte;
|
|
822
|
+
positive: typeof z$1.core._positive;
|
|
823
|
+
negative: typeof z$1.core._negative;
|
|
824
|
+
nonpositive: typeof z$1.core._nonpositive;
|
|
825
|
+
nonnegative: typeof z$1.core._nonnegative;
|
|
826
|
+
multipleOf: typeof z$1.core._multipleOf;
|
|
827
|
+
maxSize: typeof z$1.core._maxSize;
|
|
828
|
+
minSize: typeof z$1.core._minSize;
|
|
829
|
+
size: typeof z$1.core._size;
|
|
830
|
+
maxLength: typeof z$1.core._maxLength;
|
|
831
|
+
minLength: typeof z$1.core._minLength;
|
|
832
|
+
length: typeof z$1.core._length;
|
|
833
|
+
regex: typeof z$1.core._regex;
|
|
834
|
+
lowercase: typeof z$1.core._lowercase;
|
|
835
|
+
uppercase: typeof z$1.core._uppercase;
|
|
836
|
+
includes: typeof z$1.core._includes;
|
|
837
|
+
startsWith: typeof z$1.core._startsWith;
|
|
838
|
+
endsWith: typeof z$1.core._endsWith;
|
|
839
|
+
property: typeof z$1.core._property;
|
|
840
|
+
mime: typeof z$1.core._mime;
|
|
841
|
+
overwrite: typeof z$1.core._overwrite;
|
|
842
|
+
normalize: typeof z$1.core._normalize;
|
|
843
|
+
trim: typeof z$1.core._trim;
|
|
844
|
+
toLowerCase: typeof z$1.core._toLowerCase;
|
|
845
|
+
toUpperCase: typeof z$1.core._toUpperCase;
|
|
846
|
+
ZodError: z$1.core.$constructor<z$1.ZodError>;
|
|
847
|
+
ZodRealError: z$1.core.$constructor<z$1.ZodError>;
|
|
848
|
+
parse: <T extends z$1.core.$ZodType>(schema: T, value: unknown, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>, _params?: {
|
|
849
|
+
callee?: z$1.core.util.AnyFunc;
|
|
850
|
+
Err?: z$1.core.$ZodErrorClass;
|
|
851
|
+
}) => z$1.core.output<T>;
|
|
852
|
+
parseAsync: <T extends z$1.core.$ZodType>(schema: T, value: unknown, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>, _params?: {
|
|
853
|
+
callee?: z$1.core.util.AnyFunc;
|
|
854
|
+
Err?: z$1.core.$ZodErrorClass;
|
|
855
|
+
}) => Promise<z$1.core.output<T>>;
|
|
856
|
+
safeParse: <T extends z$1.core.$ZodType>(schema: T, value: unknown, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => z$1.ZodSafeParseResult<z$1.core.output<T>>;
|
|
857
|
+
safeParseAsync: <T extends z$1.core.$ZodType>(schema: T, value: unknown, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => Promise<z$1.ZodSafeParseResult<z$1.core.output<T>>>;
|
|
858
|
+
encode: <T extends z$1.core.$ZodType>(schema: T, value: z$1.core.output<T>, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => z$1.core.input<T>;
|
|
859
|
+
decode: <T extends z$1.core.$ZodType>(schema: T, value: z$1.core.input<T>, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => z$1.core.output<T>;
|
|
860
|
+
encodeAsync: <T extends z$1.core.$ZodType>(schema: T, value: z$1.core.output<T>, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => Promise<z$1.core.input<T>>;
|
|
861
|
+
decodeAsync: <T extends z$1.core.$ZodType>(schema: T, value: z$1.core.input<T>, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => Promise<z$1.core.output<T>>;
|
|
862
|
+
safeEncode: <T extends z$1.core.$ZodType>(schema: T, value: z$1.core.output<T>, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => z$1.ZodSafeParseResult<z$1.core.input<T>>;
|
|
863
|
+
safeDecode: <T extends z$1.core.$ZodType>(schema: T, value: z$1.core.input<T>, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => z$1.ZodSafeParseResult<z$1.core.output<T>>;
|
|
864
|
+
safeEncodeAsync: <T extends z$1.core.$ZodType>(schema: T, value: z$1.core.output<T>, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => Promise<z$1.ZodSafeParseResult<z$1.core.input<T>>>;
|
|
865
|
+
safeDecodeAsync: <T extends z$1.core.$ZodType>(schema: T, value: z$1.core.input<T>, _ctx?: z$1.core.ParseContext<z$1.core.$ZodIssue>) => Promise<z$1.ZodSafeParseResult<z$1.core.output<T>>>;
|
|
866
|
+
setErrorMap(map: z$1.core.$ZodErrorMap): void;
|
|
867
|
+
getErrorMap(): z$1.core.$ZodErrorMap<z$1.core.$ZodIssue> | undefined;
|
|
868
|
+
ZodIssueCode: {
|
|
869
|
+
readonly invalid_type: "invalid_type";
|
|
870
|
+
readonly too_big: "too_big";
|
|
871
|
+
readonly too_small: "too_small";
|
|
872
|
+
readonly invalid_format: "invalid_format";
|
|
873
|
+
readonly not_multiple_of: "not_multiple_of";
|
|
874
|
+
readonly unrecognized_keys: "unrecognized_keys";
|
|
875
|
+
readonly invalid_union: "invalid_union";
|
|
876
|
+
readonly invalid_key: "invalid_key";
|
|
877
|
+
readonly invalid_element: "invalid_element";
|
|
878
|
+
readonly invalid_value: "invalid_value";
|
|
879
|
+
readonly custom: "custom";
|
|
880
|
+
};
|
|
881
|
+
ZodFirstPartyTypeKind: typeof z$1.ZodFirstPartyTypeKind;
|
|
882
|
+
};
|
|
883
|
+
type SchemaBuilder = typeof zod;
|
|
884
|
+
type SchemaFunction<T> = (schema: SchemaBuilder) => T;
|
|
885
|
+
type Output<T> = T extends z$1.ZodType ? z$1.infer<T> : T;
|
|
886
|
+
type ZodTypeOrRecord = z$1.ZodType | Record<string, unknown>;
|
|
397
887
|
|
|
398
888
|
interface BaseExecutionParams {
|
|
399
889
|
/**
|
|
@@ -484,6 +974,76 @@ type WithRequestId<T> = T & {
|
|
|
484
974
|
requestId?: string;
|
|
485
975
|
};
|
|
486
976
|
|
|
977
|
+
declare const TaskStatus: z$1.ZodEnum<{
|
|
978
|
+
created: "created";
|
|
979
|
+
failed: "failed";
|
|
980
|
+
running: "running";
|
|
981
|
+
validating: "validating";
|
|
982
|
+
completed: "completed";
|
|
983
|
+
cancelled: "cancelled";
|
|
984
|
+
}>;
|
|
985
|
+
type TaskStatus = z$1.infer<typeof TaskStatus>;
|
|
986
|
+
declare const TaskDefinition: z$1.ZodObject<{
|
|
987
|
+
id: z$1.ZodString;
|
|
988
|
+
reference: z$1.ZodNumber;
|
|
989
|
+
name: z$1.ZodString;
|
|
990
|
+
status: z$1.ZodEnum<{
|
|
991
|
+
created: "created";
|
|
992
|
+
failed: "failed";
|
|
993
|
+
running: "running";
|
|
994
|
+
validating: "validating";
|
|
995
|
+
completed: "completed";
|
|
996
|
+
cancelled: "cancelled";
|
|
997
|
+
}>;
|
|
998
|
+
rawInput: z$1.ZodObject<{
|
|
999
|
+
async: z$1.ZodBoolean;
|
|
1000
|
+
stream: z$1.ZodBoolean;
|
|
1001
|
+
variables: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1002
|
+
applicationId: z$1.ZodString;
|
|
1003
|
+
}, z$1.core.$strip>;
|
|
1004
|
+
inputContent: z$1.ZodAny;
|
|
1005
|
+
outputContent: z$1.ZodObject<{
|
|
1006
|
+
role: z$1.ZodLiteral<"assistant">;
|
|
1007
|
+
content: z$1.ZodUnknown;
|
|
1008
|
+
toolCalls: z$1.ZodArray<z$1.ZodAny>;
|
|
1009
|
+
functionCall: z$1.ZodAny;
|
|
1010
|
+
}, z$1.core.$strip>;
|
|
1011
|
+
originalOutputContent: z$1.ZodObject<{
|
|
1012
|
+
role: z$1.ZodLiteral<"assistant">;
|
|
1013
|
+
content: z$1.ZodUnknown;
|
|
1014
|
+
toolCalls: z$1.ZodArray<z$1.ZodAny>;
|
|
1015
|
+
functionCall: z$1.ZodAny;
|
|
1016
|
+
}, z$1.core.$strip>;
|
|
1017
|
+
createdBy: z$1.ZodString;
|
|
1018
|
+
approvedBy: z$1.ZodAny;
|
|
1019
|
+
approvedAt: z$1.ZodAny;
|
|
1020
|
+
completionRunId: z$1.ZodString;
|
|
1021
|
+
workflowRunId: z$1.ZodAny;
|
|
1022
|
+
promptVersionId: z$1.ZodString;
|
|
1023
|
+
promptApplicationId: z$1.ZodString;
|
|
1024
|
+
workspaceId: z$1.ZodString;
|
|
1025
|
+
metadata: z$1.ZodAny;
|
|
1026
|
+
tags: z$1.ZodArray<z$1.ZodString>;
|
|
1027
|
+
createdAt: z$1.ZodString;
|
|
1028
|
+
updatedAt: z$1.ZodString;
|
|
1029
|
+
deletedAt: z$1.ZodAny;
|
|
1030
|
+
requestId: z$1.ZodString;
|
|
1031
|
+
}, z$1.core.$strip>;
|
|
1032
|
+
type TaskDefinition<TOutput = unknown> = Omit<z$1.infer<typeof TaskDefinition>, 'outputContent' | 'originalOutputContent'> & {
|
|
1033
|
+
outputContent: {
|
|
1034
|
+
role: 'assistant';
|
|
1035
|
+
content: TOutput;
|
|
1036
|
+
toolCalls: Array<any>;
|
|
1037
|
+
functionCall: any;
|
|
1038
|
+
};
|
|
1039
|
+
originalOutputContent: {
|
|
1040
|
+
role: 'assistant';
|
|
1041
|
+
content: TOutput;
|
|
1042
|
+
toolCalls: Array<any>;
|
|
1043
|
+
functionCall: any;
|
|
1044
|
+
};
|
|
1045
|
+
};
|
|
1046
|
+
|
|
487
1047
|
/**
|
|
488
1048
|
* Canvas execution module for managing canvas execution lifecycle and modes.
|
|
489
1049
|
*
|
|
@@ -579,19 +1139,13 @@ type AsyncCompletionCreateResult = {
|
|
|
579
1139
|
inputContent: {
|
|
580
1140
|
files: Array<any>;
|
|
581
1141
|
messages: Array<any>;
|
|
582
|
-
variables:
|
|
583
|
-
body: string;
|
|
584
|
-
title: string;
|
|
585
|
-
};
|
|
1142
|
+
variables: Record<string, unknown>;
|
|
586
1143
|
};
|
|
587
1144
|
outputContent: null;
|
|
588
1145
|
rawInput: {
|
|
589
1146
|
async: boolean;
|
|
590
1147
|
canvas_id: string;
|
|
591
|
-
variables:
|
|
592
|
-
body: string;
|
|
593
|
-
title: string;
|
|
594
|
-
};
|
|
1148
|
+
variables: Record<string, unknown>;
|
|
595
1149
|
};
|
|
596
1150
|
rawOutput: any;
|
|
597
1151
|
compatibilityDate: string;
|
|
@@ -638,35 +1192,6 @@ type AsyncCompletionCreateResult = {
|
|
|
638
1192
|
updatedAt: string;
|
|
639
1193
|
deletedAt: any;
|
|
640
1194
|
};
|
|
641
|
-
type TaskCreationResult = {
|
|
642
|
-
id: string;
|
|
643
|
-
reference: number;
|
|
644
|
-
name: string;
|
|
645
|
-
status: ExecutionStatus;
|
|
646
|
-
rawInput: {
|
|
647
|
-
async: boolean;
|
|
648
|
-
stream: boolean;
|
|
649
|
-
variables: Record<string, unknown>;
|
|
650
|
-
applicationId: string;
|
|
651
|
-
};
|
|
652
|
-
inputContent: any;
|
|
653
|
-
outputContent: any;
|
|
654
|
-
originalOutputContent: any;
|
|
655
|
-
createdBy: string;
|
|
656
|
-
approvedBy: any;
|
|
657
|
-
approvedAt: any;
|
|
658
|
-
completionRunId: string;
|
|
659
|
-
workflowRunId: any;
|
|
660
|
-
promptVersionId: string;
|
|
661
|
-
promptApplicationId: string;
|
|
662
|
-
workspaceId: string;
|
|
663
|
-
metadata: any;
|
|
664
|
-
tags: Array<string>;
|
|
665
|
-
createdAt: string;
|
|
666
|
-
updatedAt: string;
|
|
667
|
-
deletedAt: any;
|
|
668
|
-
requestId: string;
|
|
669
|
-
};
|
|
670
1195
|
/**
|
|
671
1196
|
* Raw API response type. Represents the unprocessed response from the Tela API.
|
|
672
1197
|
* This type will be refined in future versions with proper typing.
|
|
@@ -805,7 +1330,7 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
805
1330
|
* @param outputSchema - Zod schema or object schema for validating/parsing output.
|
|
806
1331
|
* @param client - HTTP client instance for making API requests.
|
|
807
1332
|
*/
|
|
808
|
-
constructor(variables: TInput, params: TParams | undefined, outputSchema:
|
|
1333
|
+
constructor(variables: TInput, params: TParams | undefined, outputSchema: z.ZodType | Record<string, unknown>, client: BaseClient, isTask?: boolean);
|
|
809
1334
|
/**
|
|
810
1335
|
* Fetches an existing asynchronous execution by its ID.
|
|
811
1336
|
*
|
|
@@ -834,7 +1359,7 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
834
1359
|
* console.log(execution.status) // 'running' or 'succeeded' or 'failed'
|
|
835
1360
|
* ```
|
|
836
1361
|
*/
|
|
837
|
-
static fetch<TOutput = unknown>(id: string, outputSchema:
|
|
1362
|
+
static fetch<TOutput = unknown>(id: string, outputSchema: z.ZodType | Record<string, unknown>, client: BaseClient, options?: {
|
|
838
1363
|
pollingInterval?: string | number;
|
|
839
1364
|
pollingTimeout?: string | number;
|
|
840
1365
|
isTask?: boolean;
|
|
@@ -959,7 +1484,7 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
959
1484
|
*
|
|
960
1485
|
* @returns The task creation result or undefined.
|
|
961
1486
|
*/
|
|
962
|
-
get task():
|
|
1487
|
+
get task(): TaskDefinition | undefined;
|
|
963
1488
|
/**
|
|
964
1489
|
* Gets the raw API response without any processing or validation.
|
|
965
1490
|
* Automatically starts execution and waits for completion (including polling for async executions).
|
|
@@ -986,7 +1511,58 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
986
1511
|
*/
|
|
987
1512
|
start(): Promise<CanvasExecutionResult<TParams, TOutput> | AsyncGenerator<Partial<TOutput>, any, any> | (AsyncCompletionCreateResult & {
|
|
988
1513
|
requestId?: string;
|
|
989
|
-
}) | (
|
|
1514
|
+
}) | (Omit<{
|
|
1515
|
+
id: string;
|
|
1516
|
+
reference: number;
|
|
1517
|
+
name: string;
|
|
1518
|
+
status: "created" | "failed" | "running" | "validating" | "completed" | "cancelled";
|
|
1519
|
+
rawInput: {
|
|
1520
|
+
async: boolean;
|
|
1521
|
+
stream: boolean;
|
|
1522
|
+
variables: Record<string, unknown>;
|
|
1523
|
+
applicationId: string;
|
|
1524
|
+
};
|
|
1525
|
+
inputContent: any;
|
|
1526
|
+
outputContent: {
|
|
1527
|
+
role: "assistant";
|
|
1528
|
+
content: unknown;
|
|
1529
|
+
toolCalls: any[];
|
|
1530
|
+
functionCall: any;
|
|
1531
|
+
};
|
|
1532
|
+
originalOutputContent: {
|
|
1533
|
+
role: "assistant";
|
|
1534
|
+
content: unknown;
|
|
1535
|
+
toolCalls: any[];
|
|
1536
|
+
functionCall: any;
|
|
1537
|
+
};
|
|
1538
|
+
createdBy: string;
|
|
1539
|
+
approvedBy: any;
|
|
1540
|
+
approvedAt: any;
|
|
1541
|
+
completionRunId: string;
|
|
1542
|
+
workflowRunId: any;
|
|
1543
|
+
promptVersionId: string;
|
|
1544
|
+
promptApplicationId: string;
|
|
1545
|
+
workspaceId: string;
|
|
1546
|
+
metadata: any;
|
|
1547
|
+
tags: string[];
|
|
1548
|
+
createdAt: string;
|
|
1549
|
+
updatedAt: string;
|
|
1550
|
+
deletedAt: any;
|
|
1551
|
+
requestId: string;
|
|
1552
|
+
}, "outputContent" | "originalOutputContent"> & {
|
|
1553
|
+
outputContent: {
|
|
1554
|
+
role: "assistant";
|
|
1555
|
+
content: unknown;
|
|
1556
|
+
toolCalls: Array<any>;
|
|
1557
|
+
functionCall: any;
|
|
1558
|
+
};
|
|
1559
|
+
originalOutputContent: {
|
|
1560
|
+
role: "assistant";
|
|
1561
|
+
content: unknown;
|
|
1562
|
+
toolCalls: Array<any>;
|
|
1563
|
+
functionCall: any;
|
|
1564
|
+
};
|
|
1565
|
+
} & {
|
|
990
1566
|
requestId?: string;
|
|
991
1567
|
})>;
|
|
992
1568
|
/**
|
|
@@ -2035,36 +2611,6 @@ declare class Batch<TInput, TOutput> {
|
|
|
2035
2611
|
* @module Resources
|
|
2036
2612
|
*/
|
|
2037
2613
|
|
|
2038
|
-
/**
|
|
2039
|
-
* Represents a variable that can be used in a canvas template.
|
|
2040
|
-
*/
|
|
2041
|
-
type CanvasVariable = {
|
|
2042
|
-
/**
|
|
2043
|
-
* The name of the variable.
|
|
2044
|
-
*/
|
|
2045
|
-
name: string;
|
|
2046
|
-
/**
|
|
2047
|
-
* The type of the variable (e.g., 'string', 'number', 'file').
|
|
2048
|
-
*/
|
|
2049
|
-
type: string;
|
|
2050
|
-
/**
|
|
2051
|
-
* Whether this variable is required for canvas execution.
|
|
2052
|
-
*/
|
|
2053
|
-
required: boolean;
|
|
2054
|
-
/**
|
|
2055
|
-
* Description of the variable's purpose.
|
|
2056
|
-
*/
|
|
2057
|
-
description: string;
|
|
2058
|
-
/**
|
|
2059
|
-
* Processing options for the variable.
|
|
2060
|
-
*/
|
|
2061
|
-
processingOptions: {
|
|
2062
|
-
/**
|
|
2063
|
-
* Whether multimodal content (images, files) is allowed.
|
|
2064
|
-
*/
|
|
2065
|
-
allowMultimodal: boolean;
|
|
2066
|
-
};
|
|
2067
|
-
};
|
|
2068
2614
|
interface CanvasOptions<TInput, TOutput> {
|
|
2069
2615
|
/**
|
|
2070
2616
|
* Id of the canvas that will be used to create the completion.
|
|
@@ -2111,291 +2657,6 @@ type CanvasGetOptions<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrR
|
|
|
2111
2657
|
*/
|
|
2112
2658
|
skipSchemaValidation?: boolean;
|
|
2113
2659
|
};
|
|
2114
|
-
declare const zod: {
|
|
2115
|
-
file: typeof TelaFileSchema;
|
|
2116
|
-
z: typeof _zod.z;
|
|
2117
|
-
default: typeof _zod.z;
|
|
2118
|
-
core: typeof _zod.core;
|
|
2119
|
-
globalRegistry: _zod.core.$ZodRegistry<_zod.core.GlobalMeta, _zod.core.$ZodType<unknown, unknown, _zod.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2120
|
-
registry: typeof _zod.core.registry;
|
|
2121
|
-
config: typeof _zod.core.config;
|
|
2122
|
-
$output: typeof _zod.core.$output;
|
|
2123
|
-
$input: typeof _zod.core.$input;
|
|
2124
|
-
$brand: typeof _zod.core.$brand;
|
|
2125
|
-
clone: typeof _zod.core.util.clone;
|
|
2126
|
-
regexes: typeof _zod.core.regexes;
|
|
2127
|
-
treeifyError: typeof _zod.core.treeifyError;
|
|
2128
|
-
prettifyError: typeof _zod.core.prettifyError;
|
|
2129
|
-
formatError: typeof _zod.core.formatError;
|
|
2130
|
-
flattenError: typeof _zod.core.flattenError;
|
|
2131
|
-
toJSONSchema: typeof _zod.core.toJSONSchema;
|
|
2132
|
-
TimePrecision: {
|
|
2133
|
-
readonly Any: null;
|
|
2134
|
-
readonly Minute: -1;
|
|
2135
|
-
readonly Second: 0;
|
|
2136
|
-
readonly Millisecond: 3;
|
|
2137
|
-
readonly Microsecond: 6;
|
|
2138
|
-
};
|
|
2139
|
-
util: typeof _zod.core.util;
|
|
2140
|
-
NEVER: never;
|
|
2141
|
-
locales: typeof _zod.core.locales;
|
|
2142
|
-
ZodISODateTime: _zod.core.$constructor<_zod.ZodISODateTime, _zod.core.$ZodISODateTimeDef>;
|
|
2143
|
-
ZodISODate: _zod.core.$constructor<_zod.ZodISODate, _zod.core.$ZodStringFormatDef<"date">>;
|
|
2144
|
-
ZodISOTime: _zod.core.$constructor<_zod.ZodISOTime, _zod.core.$ZodISOTimeDef>;
|
|
2145
|
-
ZodISODuration: _zod.core.$constructor<_zod.ZodISODuration, _zod.core.$ZodStringFormatDef<"duration">>;
|
|
2146
|
-
iso: typeof _zod.iso;
|
|
2147
|
-
coerce: typeof _zod.coerce;
|
|
2148
|
-
string(params?: string | _zod.core.$ZodStringParams): _zod.ZodString;
|
|
2149
|
-
string<T extends string>(params?: string | _zod.core.$ZodStringParams): _zod.core.$ZodType<T, T>;
|
|
2150
|
-
email(params?: string | _zod.core.$ZodEmailParams): _zod.ZodEmail;
|
|
2151
|
-
guid(params?: string | _zod.core.$ZodGUIDParams): _zod.ZodGUID;
|
|
2152
|
-
uuid(params?: string | _zod.core.$ZodUUIDParams): _zod.ZodUUID;
|
|
2153
|
-
uuidv4(params?: string | _zod.core.$ZodUUIDv4Params): _zod.ZodUUID;
|
|
2154
|
-
uuidv6(params?: string | _zod.core.$ZodUUIDv6Params): _zod.ZodUUID;
|
|
2155
|
-
uuidv7(params?: string | _zod.core.$ZodUUIDv7Params): _zod.ZodUUID;
|
|
2156
|
-
url(params?: string | _zod.core.$ZodURLParams): _zod.ZodURL;
|
|
2157
|
-
httpUrl(params?: string | Omit<_zod.core.$ZodURLParams, "protocol" | "hostname">): _zod.ZodURL;
|
|
2158
|
-
emoji(params?: string | _zod.core.$ZodEmojiParams): _zod.ZodEmoji;
|
|
2159
|
-
nanoid(params?: string | _zod.core.$ZodNanoIDParams): _zod.ZodNanoID;
|
|
2160
|
-
cuid(params?: string | _zod.core.$ZodCUIDParams): _zod.ZodCUID;
|
|
2161
|
-
cuid2(params?: string | _zod.core.$ZodCUID2Params): _zod.ZodCUID2;
|
|
2162
|
-
ulid(params?: string | _zod.core.$ZodULIDParams): _zod.ZodULID;
|
|
2163
|
-
xid(params?: string | _zod.core.$ZodXIDParams): _zod.ZodXID;
|
|
2164
|
-
ksuid(params?: string | _zod.core.$ZodKSUIDParams): _zod.ZodKSUID;
|
|
2165
|
-
ipv4(params?: string | _zod.core.$ZodIPv4Params): _zod.ZodIPv4;
|
|
2166
|
-
ipv6(params?: string | _zod.core.$ZodIPv6Params): _zod.ZodIPv6;
|
|
2167
|
-
cidrv4(params?: string | _zod.core.$ZodCIDRv4Params): _zod.ZodCIDRv4;
|
|
2168
|
-
cidrv6(params?: string | _zod.core.$ZodCIDRv6Params): _zod.ZodCIDRv6;
|
|
2169
|
-
base64(params?: string | _zod.core.$ZodBase64Params): _zod.ZodBase64;
|
|
2170
|
-
base64url(params?: string | _zod.core.$ZodBase64URLParams): _zod.ZodBase64URL;
|
|
2171
|
-
e164(params?: string | _zod.core.$ZodE164Params): _zod.ZodE164;
|
|
2172
|
-
jwt(params?: string | _zod.core.$ZodJWTParams): _zod.ZodJWT;
|
|
2173
|
-
stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => _zod.core.util.MaybeAsync<unknown>) | RegExp, _params?: string | _zod.core.$ZodStringFormatParams): _zod.ZodCustomStringFormat<Format>;
|
|
2174
|
-
hostname(_params?: string | _zod.core.$ZodStringFormatParams): _zod.ZodCustomStringFormat<"hostname">;
|
|
2175
|
-
hex(_params?: string | _zod.core.$ZodStringFormatParams): _zod.ZodCustomStringFormat<"hex">;
|
|
2176
|
-
hash<Alg extends _zod.core.util.HashAlgorithm, Enc extends _zod.core.util.HashEncoding = "hex">(alg: Alg, params?: {
|
|
2177
|
-
enc?: Enc;
|
|
2178
|
-
} & _zod.core.$ZodStringFormatParams): _zod.ZodCustomStringFormat<`${Alg}_${Enc}`>;
|
|
2179
|
-
number(params?: string | _zod.core.$ZodNumberParams): _zod.ZodNumber;
|
|
2180
|
-
int(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodInt;
|
|
2181
|
-
float32(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodFloat32;
|
|
2182
|
-
float64(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodFloat64;
|
|
2183
|
-
int32(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodInt32;
|
|
2184
|
-
uint32(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodUInt32;
|
|
2185
|
-
boolean(params?: string | _zod.core.$ZodBooleanParams): _zod.ZodBoolean;
|
|
2186
|
-
bigint(params?: string | _zod.core.$ZodBigIntParams): _zod.ZodBigInt;
|
|
2187
|
-
int64(params?: string | _zod.core.$ZodBigIntFormatParams): _zod.ZodBigIntFormat;
|
|
2188
|
-
uint64(params?: string | _zod.core.$ZodBigIntFormatParams): _zod.ZodBigIntFormat;
|
|
2189
|
-
symbol(params?: string | _zod.core.$ZodSymbolParams): _zod.ZodSymbol;
|
|
2190
|
-
any(): _zod.ZodAny;
|
|
2191
|
-
unknown(): _zod.ZodUnknown;
|
|
2192
|
-
never(params?: string | _zod.core.$ZodNeverParams): _zod.ZodNever;
|
|
2193
|
-
date(params?: string | _zod.core.$ZodDateParams): _zod.ZodDate;
|
|
2194
|
-
array<T extends _zod.core.SomeType>(element: T, params?: string | _zod.core.$ZodArrayParams): _zod.ZodArray<T>;
|
|
2195
|
-
keyof<T extends _zod.ZodObject>(schema: T): _zod.ZodEnum<_zod.core.util.KeysEnum<T["_zod"]["output"]>>;
|
|
2196
|
-
object<T extends _zod.core.$ZodLooseShape = Partial<Record<never, _zod.core.SomeType>>>(shape?: T, params?: string | _zod.core.$ZodObjectParams): _zod.ZodObject<_zod.core.util.Writeable<T>, _zod.core.$strip>;
|
|
2197
|
-
strictObject<T extends _zod.core.$ZodLooseShape>(shape: T, params?: string | _zod.core.$ZodObjectParams): _zod.ZodObject<T, _zod.core.$strict>;
|
|
2198
|
-
looseObject<T extends _zod.core.$ZodLooseShape>(shape: T, params?: string | _zod.core.$ZodObjectParams): _zod.ZodObject<T, _zod.core.$loose>;
|
|
2199
|
-
union<const T extends readonly _zod.core.SomeType[]>(options: T, params?: string | _zod.core.$ZodUnionParams): _zod.ZodUnion<T>;
|
|
2200
|
-
discriminatedUnion<Types extends readonly [_zod.core.$ZodTypeDiscriminable, ..._zod.core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | _zod.core.$ZodDiscriminatedUnionParams): _zod.ZodDiscriminatedUnion<Types, Disc>;
|
|
2201
|
-
intersection<T extends _zod.core.SomeType, U extends _zod.core.SomeType>(left: T, right: U): _zod.ZodIntersection<T, U>;
|
|
2202
|
-
tuple<T extends readonly [_zod.core.SomeType, ..._zod.core.SomeType[]]>(items: T, params?: string | _zod.core.$ZodTupleParams): _zod.ZodTuple<T, null>;
|
|
2203
|
-
tuple<T extends readonly [_zod.core.SomeType, ..._zod.core.SomeType[]], Rest extends _zod.core.SomeType>(items: T, rest: Rest, params?: string | _zod.core.$ZodTupleParams): _zod.ZodTuple<T, Rest>;
|
|
2204
|
-
tuple(items: [], params?: string | _zod.core.$ZodTupleParams): _zod.ZodTuple<[], null>;
|
|
2205
|
-
record<Key extends _zod.core.$ZodRecordKey, Value extends _zod.core.SomeType>(keyType: Key, valueType: Value, params?: string | _zod.core.$ZodRecordParams): _zod.ZodRecord<Key, Value>;
|
|
2206
|
-
partialRecord<Key extends _zod.core.$ZodRecordKey, Value extends _zod.core.SomeType>(keyType: Key, valueType: Value, params?: string | _zod.core.$ZodRecordParams): _zod.ZodRecord<Key & _zod.core.$partial, Value>;
|
|
2207
|
-
map<Key extends _zod.core.SomeType, Value extends _zod.core.SomeType>(keyType: Key, valueType: Value, params?: string | _zod.core.$ZodMapParams): _zod.ZodMap<Key, Value>;
|
|
2208
|
-
set<Value extends _zod.core.SomeType>(valueType: Value, params?: string | _zod.core.$ZodSetParams): _zod.ZodSet<Value>;
|
|
2209
|
-
nativeEnum<T extends _zod.core.util.EnumLike>(entries: T, params?: string | _zod.core.$ZodEnumParams): _zod.ZodEnum<T>;
|
|
2210
|
-
literal<const T extends ReadonlyArray<_zod.core.util.Literal>>(value: T, params?: string | _zod.core.$ZodLiteralParams): _zod.ZodLiteral<T[number]>;
|
|
2211
|
-
literal<const T extends _zod.core.util.Literal>(value: T, params?: string | _zod.core.$ZodLiteralParams): _zod.ZodLiteral<T>;
|
|
2212
|
-
transform<I = unknown, O = I>(fn: (input: I, ctx: _zod.core.ParsePayload) => O): _zod.ZodTransform<Awaited<O>, I>;
|
|
2213
|
-
optional<T extends _zod.core.SomeType>(innerType: T): _zod.ZodOptional<T>;
|
|
2214
|
-
nullable<T extends _zod.core.SomeType>(innerType: T): _zod.ZodNullable<T>;
|
|
2215
|
-
nullish<T extends _zod.core.SomeType>(innerType: T): _zod.ZodOptional<_zod.ZodNullable<T>>;
|
|
2216
|
-
_default<T extends _zod.core.SomeType>(innerType: T, defaultValue: _zod.core.util.NoUndefined<_zod.core.output<T>> | (() => _zod.core.util.NoUndefined<_zod.core.output<T>>)): _zod.ZodDefault<T>;
|
|
2217
|
-
prefault<T extends _zod.core.SomeType>(innerType: T, defaultValue: _zod.core.input<T> | (() => _zod.core.input<T>)): _zod.ZodPrefault<T>;
|
|
2218
|
-
nonoptional<T extends _zod.core.SomeType>(innerType: T, params?: string | _zod.core.$ZodNonOptionalParams): _zod.ZodNonOptional<T>;
|
|
2219
|
-
success<T extends _zod.core.SomeType>(innerType: T): _zod.ZodSuccess<T>;
|
|
2220
|
-
nan(params?: string | _zod.core.$ZodNaNParams): _zod.ZodNaN;
|
|
2221
|
-
pipe<const A extends _zod.core.SomeType, B extends _zod.core.$ZodType<unknown, _zod.core.output<A>> = _zod.core.$ZodType<unknown, _zod.core.output<A>, _zod.core.$ZodTypeInternals<unknown, _zod.core.output<A>>>>(in_: A, out: B | _zod.core.$ZodType<unknown, _zod.core.output<A>>): _zod.ZodPipe<A, B>;
|
|
2222
|
-
codec<const A extends _zod.core.SomeType, B extends _zod.core.SomeType = _zod.core.$ZodType<unknown, unknown, _zod.core.$ZodTypeInternals<unknown, unknown>>>(in_: A, out: B, params: {
|
|
2223
|
-
decode: (value: _zod.core.output<A>, payload: _zod.core.ParsePayload<_zod.core.output<A>>) => _zod.core.util.MaybeAsync<_zod.core.input<B>>;
|
|
2224
|
-
encode: (value: _zod.core.input<B>, payload: _zod.core.ParsePayload<_zod.core.input<B>>) => _zod.core.util.MaybeAsync<_zod.core.output<A>>;
|
|
2225
|
-
}): _zod.ZodCodec<A, B>;
|
|
2226
|
-
readonly<T extends _zod.core.SomeType>(innerType: T): _zod.ZodReadonly<T>;
|
|
2227
|
-
templateLiteral<const Parts extends _zod.core.$ZodTemplateLiteralPart[]>(parts: Parts, params?: string | _zod.core.$ZodTemplateLiteralParams): _zod.ZodTemplateLiteral<_zod.core.$PartsToTemplateLiteral<Parts>>;
|
|
2228
|
-
lazy<T extends _zod.core.SomeType>(getter: () => T): _zod.ZodLazy<T>;
|
|
2229
|
-
promise<T extends _zod.core.SomeType>(innerType: T): _zod.ZodPromise<T>;
|
|
2230
|
-
_function(): _zod.ZodFunction;
|
|
2231
|
-
_function<const In extends ReadonlyArray<_zod.core.$ZodType>>(params: {
|
|
2232
|
-
input: In;
|
|
2233
|
-
}): _zod.ZodFunction<_zod.ZodTuple<In, null>, _zod.core.$ZodFunctionOut>;
|
|
2234
|
-
_function<const In extends ReadonlyArray<_zod.core.$ZodType>, const Out extends _zod.core.$ZodFunctionOut = _zod.core.$ZodFunctionOut>(params: {
|
|
2235
|
-
input: In;
|
|
2236
|
-
output: Out;
|
|
2237
|
-
}): _zod.ZodFunction<_zod.ZodTuple<In, null>, Out>;
|
|
2238
|
-
_function<const In extends _zod.core.$ZodFunctionIn = _zod.core.$ZodFunctionArgs>(params: {
|
|
2239
|
-
input: In;
|
|
2240
|
-
}): _zod.ZodFunction<In, _zod.core.$ZodFunctionOut>;
|
|
2241
|
-
_function<const Out extends _zod.core.$ZodFunctionOut = _zod.core.$ZodFunctionOut>(params: {
|
|
2242
|
-
output: Out;
|
|
2243
|
-
}): _zod.ZodFunction<_zod.core.$ZodFunctionIn, Out>;
|
|
2244
|
-
_function<In extends _zod.core.$ZodFunctionIn = _zod.core.$ZodFunctionArgs, Out extends _zod.core.$ZodType = _zod.core.$ZodType<unknown, unknown, _zod.core.$ZodTypeInternals<unknown, unknown>>>(params?: {
|
|
2245
|
-
input: In;
|
|
2246
|
-
output: Out;
|
|
2247
|
-
}): _zod.ZodFunction<In, Out>;
|
|
2248
|
-
check<O = unknown>(fn: _zod.core.CheckFn<O>): _zod.core.$ZodCheck<O>;
|
|
2249
|
-
custom<O>(fn?: (data: unknown) => unknown, _params?: string | _zod.core.$ZodCustomParams | undefined): _zod.ZodCustom<O, O>;
|
|
2250
|
-
refine<T>(fn: (arg: NoInfer<T>) => _zod.core.util.MaybeAsync<unknown>, _params?: string | _zod.core.$ZodCustomParams): _zod.core.$ZodCheck<T>;
|
|
2251
|
-
superRefine<T>(fn: (arg: T, payload: _zod.core.$RefinementCtx<T>) => void | Promise<void>): _zod.core.$ZodCheck<T>;
|
|
2252
|
-
json(params?: string | _zod.core.$ZodCustomParams): _zod.ZodJSONSchema;
|
|
2253
|
-
preprocess<A, U extends _zod.core.SomeType, B = unknown>(fn: (arg: B, ctx: _zod.core.$RefinementCtx) => A, schema: U): _zod.ZodPipe<_zod.ZodTransform<A, B>, U>;
|
|
2254
|
-
ZodType: _zod.core.$constructor<_zod.ZodType>;
|
|
2255
|
-
_ZodString: _zod.core.$constructor<_zod._ZodString>;
|
|
2256
|
-
ZodString: _zod.core.$constructor<_zod.ZodString>;
|
|
2257
|
-
ZodStringFormat: _zod.core.$constructor<_zod.ZodStringFormat>;
|
|
2258
|
-
ZodEmail: _zod.core.$constructor<_zod.ZodEmail>;
|
|
2259
|
-
ZodGUID: _zod.core.$constructor<_zod.ZodGUID>;
|
|
2260
|
-
ZodUUID: _zod.core.$constructor<_zod.ZodUUID>;
|
|
2261
|
-
ZodURL: _zod.core.$constructor<_zod.ZodURL>;
|
|
2262
|
-
ZodEmoji: _zod.core.$constructor<_zod.ZodEmoji>;
|
|
2263
|
-
ZodNanoID: _zod.core.$constructor<_zod.ZodNanoID>;
|
|
2264
|
-
ZodCUID: _zod.core.$constructor<_zod.ZodCUID>;
|
|
2265
|
-
ZodCUID2: _zod.core.$constructor<_zod.ZodCUID2>;
|
|
2266
|
-
ZodULID: _zod.core.$constructor<_zod.ZodULID>;
|
|
2267
|
-
ZodXID: _zod.core.$constructor<_zod.ZodXID>;
|
|
2268
|
-
ZodKSUID: _zod.core.$constructor<_zod.ZodKSUID>;
|
|
2269
|
-
ZodIPv4: _zod.core.$constructor<_zod.ZodIPv4>;
|
|
2270
|
-
ZodIPv6: _zod.core.$constructor<_zod.ZodIPv6>;
|
|
2271
|
-
ZodCIDRv4: _zod.core.$constructor<_zod.ZodCIDRv4>;
|
|
2272
|
-
ZodCIDRv6: _zod.core.$constructor<_zod.ZodCIDRv6>;
|
|
2273
|
-
ZodBase64: _zod.core.$constructor<_zod.ZodBase64>;
|
|
2274
|
-
ZodBase64URL: _zod.core.$constructor<_zod.ZodBase64URL>;
|
|
2275
|
-
ZodE164: _zod.core.$constructor<_zod.ZodE164>;
|
|
2276
|
-
ZodJWT: _zod.core.$constructor<_zod.ZodJWT>;
|
|
2277
|
-
ZodCustomStringFormat: _zod.core.$constructor<_zod.ZodCustomStringFormat>;
|
|
2278
|
-
ZodNumber: _zod.core.$constructor<_zod.ZodNumber>;
|
|
2279
|
-
ZodNumberFormat: _zod.core.$constructor<_zod.ZodNumberFormat>;
|
|
2280
|
-
ZodBoolean: _zod.core.$constructor<_zod.ZodBoolean>;
|
|
2281
|
-
ZodBigInt: _zod.core.$constructor<_zod.ZodBigInt>;
|
|
2282
|
-
ZodBigIntFormat: _zod.core.$constructor<_zod.ZodBigIntFormat>;
|
|
2283
|
-
ZodSymbol: _zod.core.$constructor<_zod.ZodSymbol>;
|
|
2284
|
-
ZodUndefined: _zod.core.$constructor<_zod.ZodUndefined>;
|
|
2285
|
-
undefined: typeof _zod.undefined;
|
|
2286
|
-
ZodNull: _zod.core.$constructor<_zod.ZodNull>;
|
|
2287
|
-
null: typeof _zod.null;
|
|
2288
|
-
ZodAny: _zod.core.$constructor<_zod.ZodAny>;
|
|
2289
|
-
ZodUnknown: _zod.core.$constructor<_zod.ZodUnknown>;
|
|
2290
|
-
ZodNever: _zod.core.$constructor<_zod.ZodNever>;
|
|
2291
|
-
ZodVoid: _zod.core.$constructor<_zod.ZodVoid>;
|
|
2292
|
-
void: typeof _zod.void;
|
|
2293
|
-
ZodDate: _zod.core.$constructor<_zod.ZodDate>;
|
|
2294
|
-
ZodArray: _zod.core.$constructor<_zod.ZodArray>;
|
|
2295
|
-
ZodObject: _zod.core.$constructor<_zod.ZodObject>;
|
|
2296
|
-
ZodUnion: _zod.core.$constructor<_zod.ZodUnion>;
|
|
2297
|
-
ZodDiscriminatedUnion: _zod.core.$constructor<_zod.ZodDiscriminatedUnion>;
|
|
2298
|
-
ZodIntersection: _zod.core.$constructor<_zod.ZodIntersection>;
|
|
2299
|
-
ZodTuple: _zod.core.$constructor<_zod.ZodTuple>;
|
|
2300
|
-
ZodRecord: _zod.core.$constructor<_zod.ZodRecord>;
|
|
2301
|
-
ZodMap: _zod.core.$constructor<_zod.ZodMap>;
|
|
2302
|
-
ZodSet: _zod.core.$constructor<_zod.ZodSet>;
|
|
2303
|
-
ZodEnum: _zod.core.$constructor<_zod.ZodEnum>;
|
|
2304
|
-
enum: typeof _zod.enum;
|
|
2305
|
-
ZodLiteral: _zod.core.$constructor<_zod.ZodLiteral>;
|
|
2306
|
-
ZodFile: _zod.core.$constructor<_zod.ZodFile>;
|
|
2307
|
-
ZodTransform: _zod.core.$constructor<_zod.ZodTransform>;
|
|
2308
|
-
ZodOptional: _zod.core.$constructor<_zod.ZodOptional>;
|
|
2309
|
-
ZodNullable: _zod.core.$constructor<_zod.ZodNullable>;
|
|
2310
|
-
ZodDefault: _zod.core.$constructor<_zod.ZodDefault>;
|
|
2311
|
-
ZodPrefault: _zod.core.$constructor<_zod.ZodPrefault>;
|
|
2312
|
-
ZodNonOptional: _zod.core.$constructor<_zod.ZodNonOptional>;
|
|
2313
|
-
ZodSuccess: _zod.core.$constructor<_zod.ZodSuccess>;
|
|
2314
|
-
ZodCatch: _zod.core.$constructor<_zod.ZodCatch>;
|
|
2315
|
-
catch: typeof _zod.catch;
|
|
2316
|
-
ZodNaN: _zod.core.$constructor<_zod.ZodNaN>;
|
|
2317
|
-
ZodPipe: _zod.core.$constructor<_zod.ZodPipe>;
|
|
2318
|
-
ZodCodec: _zod.core.$constructor<_zod.ZodCodec>;
|
|
2319
|
-
ZodReadonly: _zod.core.$constructor<_zod.ZodReadonly>;
|
|
2320
|
-
ZodTemplateLiteral: _zod.core.$constructor<_zod.ZodTemplateLiteral>;
|
|
2321
|
-
ZodLazy: _zod.core.$constructor<_zod.ZodLazy>;
|
|
2322
|
-
ZodPromise: _zod.core.$constructor<_zod.ZodPromise>;
|
|
2323
|
-
ZodFunction: _zod.core.$constructor<_zod.ZodFunction>;
|
|
2324
|
-
function: typeof _zod._function;
|
|
2325
|
-
ZodCustom: _zod.core.$constructor<_zod.ZodCustom>;
|
|
2326
|
-
instanceof: typeof _zod.instanceof;
|
|
2327
|
-
stringbool: (_params?: string | _zod.core.$ZodStringBoolParams) => _zod.ZodCodec<_zod.ZodString, _zod.ZodBoolean>;
|
|
2328
|
-
lt: typeof _zod.core._lt;
|
|
2329
|
-
lte: typeof _zod.core._lte;
|
|
2330
|
-
gt: typeof _zod.core._gt;
|
|
2331
|
-
gte: typeof _zod.core._gte;
|
|
2332
|
-
positive: typeof _zod.core._positive;
|
|
2333
|
-
negative: typeof _zod.core._negative;
|
|
2334
|
-
nonpositive: typeof _zod.core._nonpositive;
|
|
2335
|
-
nonnegative: typeof _zod.core._nonnegative;
|
|
2336
|
-
multipleOf: typeof _zod.core._multipleOf;
|
|
2337
|
-
maxSize: typeof _zod.core._maxSize;
|
|
2338
|
-
minSize: typeof _zod.core._minSize;
|
|
2339
|
-
size: typeof _zod.core._size;
|
|
2340
|
-
maxLength: typeof _zod.core._maxLength;
|
|
2341
|
-
minLength: typeof _zod.core._minLength;
|
|
2342
|
-
length: typeof _zod.core._length;
|
|
2343
|
-
regex: typeof _zod.core._regex;
|
|
2344
|
-
lowercase: typeof _zod.core._lowercase;
|
|
2345
|
-
uppercase: typeof _zod.core._uppercase;
|
|
2346
|
-
includes: typeof _zod.core._includes;
|
|
2347
|
-
startsWith: typeof _zod.core._startsWith;
|
|
2348
|
-
endsWith: typeof _zod.core._endsWith;
|
|
2349
|
-
property: typeof _zod.core._property;
|
|
2350
|
-
mime: typeof _zod.core._mime;
|
|
2351
|
-
overwrite: typeof _zod.core._overwrite;
|
|
2352
|
-
normalize: typeof _zod.core._normalize;
|
|
2353
|
-
trim: typeof _zod.core._trim;
|
|
2354
|
-
toLowerCase: typeof _zod.core._toLowerCase;
|
|
2355
|
-
toUpperCase: typeof _zod.core._toUpperCase;
|
|
2356
|
-
ZodError: _zod.core.$constructor<ZodError>;
|
|
2357
|
-
ZodRealError: _zod.core.$constructor<ZodError>;
|
|
2358
|
-
parse: <T extends _zod.core.$ZodType>(schema: T, value: unknown, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>, _params?: {
|
|
2359
|
-
callee?: _zod.core.util.AnyFunc;
|
|
2360
|
-
Err?: _zod.core.$ZodErrorClass;
|
|
2361
|
-
}) => _zod.core.output<T>;
|
|
2362
|
-
parseAsync: <T extends _zod.core.$ZodType>(schema: T, value: unknown, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>, _params?: {
|
|
2363
|
-
callee?: _zod.core.util.AnyFunc;
|
|
2364
|
-
Err?: _zod.core.$ZodErrorClass;
|
|
2365
|
-
}) => Promise<_zod.core.output<T>>;
|
|
2366
|
-
safeParse: <T extends _zod.core.$ZodType>(schema: T, value: unknown, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.ZodSafeParseResult<_zod.core.output<T>>;
|
|
2367
|
-
safeParseAsync: <T extends _zod.core.$ZodType>(schema: T, value: unknown, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.ZodSafeParseResult<_zod.core.output<T>>>;
|
|
2368
|
-
encode: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.output<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.core.input<T>;
|
|
2369
|
-
decode: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.input<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.core.output<T>;
|
|
2370
|
-
encodeAsync: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.output<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.core.input<T>>;
|
|
2371
|
-
decodeAsync: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.input<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.core.output<T>>;
|
|
2372
|
-
safeEncode: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.output<T>, _ctx? /**
|
|
2373
|
-
* The ID of the parent prompt.
|
|
2374
|
-
*/: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.ZodSafeParseResult<_zod.core.input<T>>;
|
|
2375
|
-
safeDecode: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.input<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.ZodSafeParseResult<_zod.core.output<T>>;
|
|
2376
|
-
safeEncodeAsync: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.output<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.ZodSafeParseResult<_zod.core.input<T>>>;
|
|
2377
|
-
safeDecodeAsync: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.input<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.ZodSafeParseResult<_zod.core.output<T>>>;
|
|
2378
|
-
setErrorMap(map: _zod.core.$ZodErrorMap): void;
|
|
2379
|
-
getErrorMap(): _zod.core.$ZodErrorMap<_zod.core.$ZodIssue> | undefined;
|
|
2380
|
-
ZodIssueCode: {
|
|
2381
|
-
readonly invalid_type: "invalid_type";
|
|
2382
|
-
readonly too_big: "too_big";
|
|
2383
|
-
readonly too_small: "too_small";
|
|
2384
|
-
readonly invalid_format: "invalid_format";
|
|
2385
|
-
readonly not_multiple_of: "not_multiple_of";
|
|
2386
|
-
readonly unrecognized_keys: "unrecognized_keys";
|
|
2387
|
-
readonly invalid_union: "invalid_union";
|
|
2388
|
-
readonly invalid_key: "invalid_key";
|
|
2389
|
-
readonly invalid_element: "invalid_element";
|
|
2390
|
-
readonly invalid_value: "invalid_value";
|
|
2391
|
-
readonly custom: "custom";
|
|
2392
|
-
};
|
|
2393
|
-
ZodFirstPartyTypeKind: typeof _zod.ZodFirstPartyTypeKind;
|
|
2394
|
-
};
|
|
2395
|
-
type SchemaBuilder = typeof zod;
|
|
2396
|
-
type SchemaFunction<T> = (schema: SchemaBuilder) => T;
|
|
2397
|
-
type Output<T> = T extends z.ZodType ? z.infer<T> : T;
|
|
2398
|
-
type ZodTypeOrRecord = z.ZodType | Record<string, unknown>;
|
|
2399
2660
|
type CanvasExecutionPromiseLike<TParams extends ExecutionParams = SyncExecutionParams, TInput = unknown, TOutput = unknown> = PromiseLike<CanvasExecution<TParams, TInput, TOutput>> & {
|
|
2400
2661
|
result: Promise<CanvasExecutionResult<TParams, TOutput>>;
|
|
2401
2662
|
};
|
|
@@ -2532,9 +2793,9 @@ declare class Canvas<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRe
|
|
|
2532
2793
|
* ).result;
|
|
2533
2794
|
* ```
|
|
2534
2795
|
*/
|
|
2535
|
-
execute(variables: z.input<TInput>, params?: SyncExecutionParams): CanvasExecutionPromiseLike<SyncExecutionParams, Output<TInput>, Output<TOutput>>;
|
|
2536
|
-
execute(variables: z.input<TInput>, params?: AsyncExecutionParams): CanvasExecutionPromiseLike<AsyncExecutionParams, Output<TInput>, Output<TOutput>>;
|
|
2537
|
-
execute(variables: z.input<TInput>, params?: StreamExecutionParams): CanvasExecutionPromiseLike<StreamExecutionParams, Output<TInput>, Output<TOutput>>;
|
|
2796
|
+
execute(variables: z$1.input<TInput>, params?: SyncExecutionParams): CanvasExecutionPromiseLike<SyncExecutionParams, Output<TInput>, Output<TOutput>>;
|
|
2797
|
+
execute(variables: z$1.input<TInput>, params?: AsyncExecutionParams): CanvasExecutionPromiseLike<AsyncExecutionParams, Output<TInput>, Output<TOutput>>;
|
|
2798
|
+
execute(variables: z$1.input<TInput>, params?: StreamExecutionParams): CanvasExecutionPromiseLike<StreamExecutionParams, Output<TInput>, Output<TOutput>>;
|
|
2538
2799
|
/**
|
|
2539
2800
|
* Fetches an existing async execution by its ID.
|
|
2540
2801
|
*
|
|
@@ -2599,6 +2860,654 @@ declare class Canvas<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRe
|
|
|
2599
2860
|
createBatch(params?: BatchParams): Batch<Output<TInput>, Output<TOutput>>;
|
|
2600
2861
|
}
|
|
2601
2862
|
|
|
2863
|
+
/**
|
|
2864
|
+
* Parameters for creating a task.
|
|
2865
|
+
*
|
|
2866
|
+
* @category Workstation
|
|
2867
|
+
*/
|
|
2868
|
+
type TaskParams = {
|
|
2869
|
+
label?: string;
|
|
2870
|
+
tags?: string[];
|
|
2871
|
+
};
|
|
2872
|
+
/**
|
|
2873
|
+
* A promise-like object that resolves to a Task instance and provides direct access to the result.
|
|
2874
|
+
*
|
|
2875
|
+
* @template TInput - The input variables type
|
|
2876
|
+
* @template TOutput - The output result type
|
|
2877
|
+
*
|
|
2878
|
+
* @category Workstation
|
|
2879
|
+
*/
|
|
2880
|
+
type TaskPromiseLike<TInput = unknown, TOutput = unknown> = PromiseLike<Task<TInput, TOutput>> & {
|
|
2881
|
+
result: Promise<TOutput>;
|
|
2882
|
+
};
|
|
2883
|
+
/**
|
|
2884
|
+
* Event types emitted by Task during its lifecycle.
|
|
2885
|
+
*
|
|
2886
|
+
* @template TOutput - The output type.
|
|
2887
|
+
*
|
|
2888
|
+
* @property poll - Emitted during polling with current status and output. Includes `requestId` from the polling request.
|
|
2889
|
+
* @property success - Emitted when task completes successfully with the final result.
|
|
2890
|
+
* @property error - Emitted when task fails with the error object.
|
|
2891
|
+
* @property statusChange - Emitted when task status transitions to a new state.
|
|
2892
|
+
*
|
|
2893
|
+
* @category Workstation
|
|
2894
|
+
*/
|
|
2895
|
+
type TaskEvents<TOutput = unknown> = {
|
|
2896
|
+
poll: WithRequestId<TaskDefinition<TOutput>>;
|
|
2897
|
+
success: TOutput;
|
|
2898
|
+
error: TaskFailedError;
|
|
2899
|
+
statusChange: TaskStatus;
|
|
2900
|
+
};
|
|
2901
|
+
/**
|
|
2902
|
+
* Represents a workstation task with event-driven status tracking and result polling.
|
|
2903
|
+
*
|
|
2904
|
+
* Tasks are always asynchronous and require polling to retrieve results. The Task class
|
|
2905
|
+
* provides an event system for monitoring task lifecycle and automatic output validation.
|
|
2906
|
+
*
|
|
2907
|
+
* ## Status Tracking
|
|
2908
|
+
*
|
|
2909
|
+
* Task status can be accessed via the `status` property and tracks the lifecycle:
|
|
2910
|
+
* - `created` → `running` → `completed` or `failed`
|
|
2911
|
+
*
|
|
2912
|
+
* Status is set to `failed` when:
|
|
2913
|
+
* - API request fails
|
|
2914
|
+
* - Validation fails
|
|
2915
|
+
* - Polling reports failure status
|
|
2916
|
+
*
|
|
2917
|
+
* Status is set to `completed` only after:
|
|
2918
|
+
* - API request succeeds AND
|
|
2919
|
+
* - Output validation passes (if schema provided)
|
|
2920
|
+
*
|
|
2921
|
+
* @category Workstation
|
|
2922
|
+
*
|
|
2923
|
+
* @typeParam TInput - The input variables type
|
|
2924
|
+
* @typeParam TOutput - The output result type
|
|
2925
|
+
*
|
|
2926
|
+
* @fires poll - Emitted during polling with current status and output. Includes `requestId` from the polling request.
|
|
2927
|
+
* @fires success - Emitted when task completes successfully with the final result. Includes `requestId` from the final request.
|
|
2928
|
+
* @fires error - Emitted when task fails (only if error listeners are registered, otherwise throws)
|
|
2929
|
+
* @fires statusChange - Emitted when task status transitions to a new state
|
|
2930
|
+
*
|
|
2931
|
+
* @example
|
|
2932
|
+
* ```typescript
|
|
2933
|
+
* const task = await workstation.createTask({ query: 'test' })
|
|
2934
|
+
*
|
|
2935
|
+
* // Track status changes
|
|
2936
|
+
* task.on('statusChange', (status) => {
|
|
2937
|
+
* console.log(`Status: ${status}`) // created → running → completed
|
|
2938
|
+
* })
|
|
2939
|
+
*
|
|
2940
|
+
* // Monitor polling progress
|
|
2941
|
+
* task.on('poll', (pollResult) => {
|
|
2942
|
+
* console.log('Polling...', pollResult.requestId)
|
|
2943
|
+
* })
|
|
2944
|
+
*
|
|
2945
|
+
* // Handle success
|
|
2946
|
+
* task.on('success', (result) => {
|
|
2947
|
+
* console.log('Result:', result)
|
|
2948
|
+
* })
|
|
2949
|
+
*
|
|
2950
|
+
* // Handle errors
|
|
2951
|
+
* task.on('error', (error) => {
|
|
2952
|
+
* console.error('Failed:', error)
|
|
2953
|
+
* })
|
|
2954
|
+
*
|
|
2955
|
+
* // Start polling without waiting
|
|
2956
|
+
* task.poll()
|
|
2957
|
+
* ```
|
|
2958
|
+
*/
|
|
2959
|
+
declare class Task<TInput = unknown, TOutput = unknown> extends Emittery<TaskEvents<TOutput>> {
|
|
2960
|
+
private readonly _variables;
|
|
2961
|
+
private readonly _task;
|
|
2962
|
+
private readonly _abortController;
|
|
2963
|
+
private readonly _client;
|
|
2964
|
+
private readonly _outputSchema;
|
|
2965
|
+
private readonly _skipResultValidation;
|
|
2966
|
+
private _resultPromise;
|
|
2967
|
+
private _status;
|
|
2968
|
+
private _requestId;
|
|
2969
|
+
constructor(client: BaseClient, variables: TInput, task: TaskDefinition, requestId?: string, outputSchema?: z.ZodType | Record<string, unknown>, skipResultValidation?: boolean);
|
|
2970
|
+
/**
|
|
2971
|
+
* Gets the unique task ID assigned by the server.
|
|
2972
|
+
*
|
|
2973
|
+
* @returns The task ID.
|
|
2974
|
+
*/
|
|
2975
|
+
get id(): string;
|
|
2976
|
+
/**
|
|
2977
|
+
* Gets the request ID from the `x-request-id` header of the task creation request.
|
|
2978
|
+
*
|
|
2979
|
+
* This is the request ID from the initial POST /task request that created the task.
|
|
2980
|
+
* Each API request has its own unique request ID.
|
|
2981
|
+
*
|
|
2982
|
+
* For polling operations, different request IDs are available:
|
|
2983
|
+
* - `task.requestId` - ID from the task creation request
|
|
2984
|
+
* - `pollResult.requestId` - ID from each polling request (in poll events)
|
|
2985
|
+
* - `result.requestId` - ID from the final successful polling request (in success events)
|
|
2986
|
+
*
|
|
2987
|
+
* @returns A promise that resolves to the request ID from the task creation request.
|
|
2988
|
+
*
|
|
2989
|
+
* @example
|
|
2990
|
+
* ```typescript
|
|
2991
|
+
* const task = await workstation.createTask({ query: 'test' })
|
|
2992
|
+
* const requestId = await task.requestId
|
|
2993
|
+
* console.log('Request ID:', requestId)
|
|
2994
|
+
* ```
|
|
2995
|
+
*/
|
|
2996
|
+
get requestId(): string | undefined;
|
|
2997
|
+
/**
|
|
2998
|
+
* Gets the latest known status of the task.
|
|
2999
|
+
*
|
|
3000
|
+
* Status values and transitions:
|
|
3001
|
+
* - `created` → `running` → `completed` or `failed`
|
|
3002
|
+
*
|
|
3003
|
+
* **Important:** Status is set to `completed` only after successful validation.
|
|
3004
|
+
* If validation fails, status will be `failed` even if the API request succeeded.
|
|
3005
|
+
*
|
|
3006
|
+
* Use the `statusChange` event to track status transitions in real-time.
|
|
3007
|
+
*
|
|
3008
|
+
* @returns The current status of the task.
|
|
3009
|
+
*
|
|
3010
|
+
* @example
|
|
3011
|
+
* ```typescript
|
|
3012
|
+
* const task = await workstation.createTask({ query: 'test' })
|
|
3013
|
+
* console.log(task.status) // 'created'
|
|
3014
|
+
*
|
|
3015
|
+
* await task.result
|
|
3016
|
+
* console.log(task.status) // 'completed' or 'failed'
|
|
3017
|
+
* ```
|
|
3018
|
+
*/
|
|
3019
|
+
get status(): TaskStatus;
|
|
3020
|
+
/**
|
|
3021
|
+
* Sets the status of the task and emits statusChange event.
|
|
3022
|
+
*
|
|
3023
|
+
* @param status - The new status of the task.
|
|
3024
|
+
* @private
|
|
3025
|
+
*/
|
|
3026
|
+
private set status(value);
|
|
3027
|
+
/**
|
|
3028
|
+
* Gets the input variables provided to this task.
|
|
3029
|
+
*
|
|
3030
|
+
* @returns The variables object.
|
|
3031
|
+
*/
|
|
3032
|
+
get variables(): TInput;
|
|
3033
|
+
/**
|
|
3034
|
+
* Gets the task label (alias for name).
|
|
3035
|
+
*
|
|
3036
|
+
* @returns The task name.
|
|
3037
|
+
*/
|
|
3038
|
+
get label(): string;
|
|
3039
|
+
/**
|
|
3040
|
+
* Gets the task name.
|
|
3041
|
+
*
|
|
3042
|
+
* @returns The task name.
|
|
3043
|
+
*/
|
|
3044
|
+
get name(): string;
|
|
3045
|
+
/**
|
|
3046
|
+
* Gets the task tags.
|
|
3047
|
+
*
|
|
3048
|
+
* @returns The task tags.
|
|
3049
|
+
*/
|
|
3050
|
+
get tags(): string[];
|
|
3051
|
+
/**
|
|
3052
|
+
* Gets the raw task definition from the server.
|
|
3053
|
+
*
|
|
3054
|
+
* @returns The raw task definition.
|
|
3055
|
+
*/
|
|
3056
|
+
get rawTask(): TaskDefinition;
|
|
3057
|
+
/**
|
|
3058
|
+
* Starts polling for the task result without waiting for the promise to resolve.
|
|
3059
|
+
* This allows users to track task progress via events rather than awaiting a promise.
|
|
3060
|
+
*
|
|
3061
|
+
* The following events will be emitted during polling:
|
|
3062
|
+
* - `statusChange`: Emitted when the task status changes (e.g., 'created' → 'running' → 'completed')
|
|
3063
|
+
* - `poll`: Emitted on each polling attempt with the server response
|
|
3064
|
+
* - `success`: Emitted when the task completes successfully with the final result
|
|
3065
|
+
* - `error`: Emitted if the task fails
|
|
3066
|
+
*
|
|
3067
|
+
* **Important:** Events are only emitted while polling is active. You must call `poll()` or
|
|
3068
|
+
* await `task.result` to start polling. Simply setting up event listeners without starting
|
|
3069
|
+
* polling will not trigger any events.
|
|
3070
|
+
*
|
|
3071
|
+
* @example
|
|
3072
|
+
* ```typescript
|
|
3073
|
+
* const task = await workstation.createTask({ query: 'test' })
|
|
3074
|
+
*
|
|
3075
|
+
* // Set up event listeners
|
|
3076
|
+
* task.on('statusChange', (status) => {
|
|
3077
|
+
* console.log('Status:', status)
|
|
3078
|
+
* })
|
|
3079
|
+
*
|
|
3080
|
+
* task.on('success', (result) => {
|
|
3081
|
+
* console.log('Completed:', result)
|
|
3082
|
+
* })
|
|
3083
|
+
*
|
|
3084
|
+
* task.on('error', (error) => {
|
|
3085
|
+
* console.error('Failed:', error)
|
|
3086
|
+
* })
|
|
3087
|
+
*
|
|
3088
|
+
* // Start polling without waiting
|
|
3089
|
+
* task.poll()
|
|
3090
|
+
* ```
|
|
3091
|
+
*/
|
|
3092
|
+
poll(): void;
|
|
3093
|
+
/**
|
|
3094
|
+
* Gets the task result. Automatically starts polling if not already started.
|
|
3095
|
+
*
|
|
3096
|
+
* @returns A promise that resolves to the validated task output.
|
|
3097
|
+
*
|
|
3098
|
+
* @example
|
|
3099
|
+
* ```typescript
|
|
3100
|
+
* const task = await workstation.createTask({ query: 'test' })
|
|
3101
|
+
* const result = await task.result
|
|
3102
|
+
* console.log(result)
|
|
3103
|
+
* ```
|
|
3104
|
+
*/
|
|
3105
|
+
get result(): Promise<TOutput>;
|
|
3106
|
+
/**
|
|
3107
|
+
* Starts the polling process to retrieve task results.
|
|
3108
|
+
* Emits events during the polling lifecycle and validates output before resolving.
|
|
3109
|
+
*
|
|
3110
|
+
* @returns A promise that resolves to the validated task output.
|
|
3111
|
+
* @private
|
|
3112
|
+
*/
|
|
3113
|
+
private startPolling;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
/**
|
|
3117
|
+
* Internal configuration options for creating a Workstation instance.
|
|
3118
|
+
*
|
|
3119
|
+
* @internal
|
|
3120
|
+
*/
|
|
3121
|
+
type WorkstationOptions<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRecord> = {
|
|
3122
|
+
client: BaseClient;
|
|
3123
|
+
applicationId: string;
|
|
3124
|
+
promptVersion: PromptVersion;
|
|
3125
|
+
input?: SchemaFunction<TInput>;
|
|
3126
|
+
output?: SchemaFunction<TOutput>;
|
|
3127
|
+
};
|
|
3128
|
+
/**
|
|
3129
|
+
* Zod schema for task list filtering options.
|
|
3130
|
+
*
|
|
3131
|
+
* Filters tasks by various criteria including ID, name, status, and timestamps.
|
|
3132
|
+
* Date ranges can be specified using `since` and `until` fields.
|
|
3133
|
+
*/
|
|
3134
|
+
declare const TaskListFilters: z.ZodPipe<z.ZodObject<{
|
|
3135
|
+
id: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
3136
|
+
name: z.ZodOptional<z.ZodString>;
|
|
3137
|
+
status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
3138
|
+
created: "created";
|
|
3139
|
+
failed: "failed";
|
|
3140
|
+
running: "running";
|
|
3141
|
+
validating: "validating";
|
|
3142
|
+
completed: "completed";
|
|
3143
|
+
cancelled: "cancelled";
|
|
3144
|
+
}>>>;
|
|
3145
|
+
approvedAt: z.ZodOptional<z.ZodObject<{
|
|
3146
|
+
since: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodDate, z.ZodTransform<string, Date>>, z.ZodISODateTime]>>;
|
|
3147
|
+
until: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodDate, z.ZodTransform<string, Date>>, z.ZodISODateTime]>>;
|
|
3148
|
+
}, z.core.$strip>>;
|
|
3149
|
+
createdAt: z.ZodOptional<z.ZodObject<{
|
|
3150
|
+
since: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodDate, z.ZodTransform<string, Date>>, z.ZodISODateTime]>>;
|
|
3151
|
+
until: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodDate, z.ZodTransform<string, Date>>, z.ZodISODateTime]>>;
|
|
3152
|
+
}, z.core.$strip>>;
|
|
3153
|
+
updatedAt: z.ZodOptional<z.ZodObject<{
|
|
3154
|
+
since: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodDate, z.ZodTransform<string, Date>>, z.ZodISODateTime]>>;
|
|
3155
|
+
until: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodDate, z.ZodTransform<string, Date>>, z.ZodISODateTime]>>;
|
|
3156
|
+
}, z.core.$strip>>;
|
|
3157
|
+
approvedBy: z.ZodOptional<z.ZodString>;
|
|
3158
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
3159
|
+
completionRunId: z.ZodOptional<z.ZodUUID>;
|
|
3160
|
+
promptVersionId: z.ZodOptional<z.ZodUUID>;
|
|
3161
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
3162
|
+
id?: string[] | undefined;
|
|
3163
|
+
status?: ("created" | "failed" | "running" | "validating" | "completed" | "cancelled")[] | undefined;
|
|
3164
|
+
approvedBy?: string | undefined;
|
|
3165
|
+
createdBy?: string | undefined;
|
|
3166
|
+
completionRunId?: string | undefined;
|
|
3167
|
+
promptVersionId?: string | undefined;
|
|
3168
|
+
updatedAtSince?: string | undefined;
|
|
3169
|
+
updatedAtUntil?: string | undefined;
|
|
3170
|
+
createdAtSince?: string | undefined;
|
|
3171
|
+
createdAtUntil?: string | undefined;
|
|
3172
|
+
approvedAtSince?: string | undefined;
|
|
3173
|
+
approvedAtUntil?: string | undefined;
|
|
3174
|
+
taskName: string | undefined;
|
|
3175
|
+
}, {
|
|
3176
|
+
[x: string]: unknown;
|
|
3177
|
+
id?: string[] | undefined;
|
|
3178
|
+
name?: string | undefined;
|
|
3179
|
+
status?: ("created" | "failed" | "running" | "validating" | "completed" | "cancelled")[] | undefined;
|
|
3180
|
+
approvedAt?: {
|
|
3181
|
+
since?: string | undefined;
|
|
3182
|
+
until?: string | undefined;
|
|
3183
|
+
} | undefined;
|
|
3184
|
+
createdAt?: {
|
|
3185
|
+
since?: string | undefined;
|
|
3186
|
+
until?: string | undefined;
|
|
3187
|
+
} | undefined;
|
|
3188
|
+
updatedAt?: {
|
|
3189
|
+
since?: string | undefined;
|
|
3190
|
+
until?: string | undefined;
|
|
3191
|
+
} | undefined;
|
|
3192
|
+
approvedBy?: string | undefined;
|
|
3193
|
+
createdBy?: string | undefined;
|
|
3194
|
+
completionRunId?: string | undefined;
|
|
3195
|
+
promptVersionId?: string | undefined;
|
|
3196
|
+
}>>;
|
|
3197
|
+
/**
|
|
3198
|
+
* Type definition for task list filters (input form).
|
|
3199
|
+
*
|
|
3200
|
+
* @see {@link TaskListFilters} for the Zod schema
|
|
3201
|
+
*/
|
|
3202
|
+
type TaskListFilters = z.input<typeof TaskListFilters>;
|
|
3203
|
+
/**
|
|
3204
|
+
* Zod schema for task list pagination and sorting options.
|
|
3205
|
+
*
|
|
3206
|
+
* Controls the number of results, offset, and sort order.
|
|
3207
|
+
*/
|
|
3208
|
+
declare const TaskListOptions: z.ZodPipe<z.ZodObject<{
|
|
3209
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
3210
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
3211
|
+
order: z.ZodOptional<z.ZodObject<{
|
|
3212
|
+
by: z.ZodEnum<{
|
|
3213
|
+
name: "name";
|
|
3214
|
+
status: "status";
|
|
3215
|
+
reference: "reference";
|
|
3216
|
+
approvedAt: "approvedAt";
|
|
3217
|
+
createdAt: "createdAt";
|
|
3218
|
+
updatedAt: "updatedAt";
|
|
3219
|
+
}>;
|
|
3220
|
+
direction: z.ZodEnum<{
|
|
3221
|
+
asc: "asc";
|
|
3222
|
+
desc: "desc";
|
|
3223
|
+
}>;
|
|
3224
|
+
}, z.core.$strip>>;
|
|
3225
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
3226
|
+
limit?: number | undefined;
|
|
3227
|
+
offset?: number | undefined;
|
|
3228
|
+
orderBy: "name" | "status" | "reference" | "approvedAt" | "createdAt" | "updatedAt" | undefined;
|
|
3229
|
+
orderDirection: "asc" | "desc" | undefined;
|
|
3230
|
+
}, {
|
|
3231
|
+
[x: string]: unknown;
|
|
3232
|
+
limit?: number | undefined;
|
|
3233
|
+
offset?: number | undefined;
|
|
3234
|
+
order?: {
|
|
3235
|
+
by: "name" | "status" | "reference" | "approvedAt" | "createdAt" | "updatedAt";
|
|
3236
|
+
direction: "asc" | "desc";
|
|
3237
|
+
} | undefined;
|
|
3238
|
+
}>>;
|
|
3239
|
+
/**
|
|
3240
|
+
* Type definition for task list options (input form).
|
|
3241
|
+
*
|
|
3242
|
+
* @see {@link TaskListOptions} for the Zod schema
|
|
3243
|
+
*/
|
|
3244
|
+
type TaskListOptions = z.input<typeof TaskListOptions>;
|
|
3245
|
+
/**
|
|
3246
|
+
* Metadata returned with task list queries, including pagination information.
|
|
3247
|
+
*/
|
|
3248
|
+
type TaskListMeta = {
|
|
3249
|
+
/** Total number of tasks matching the filter criteria */
|
|
3250
|
+
totalCount: number;
|
|
3251
|
+
/** Maximum number of tasks returned per page */
|
|
3252
|
+
limit: number;
|
|
3253
|
+
/** Starting position in the result set */
|
|
3254
|
+
offset: number;
|
|
3255
|
+
/** Current page number (1-indexed) */
|
|
3256
|
+
currentPage: number;
|
|
3257
|
+
/** Total number of pages available */
|
|
3258
|
+
totalPages: number;
|
|
3259
|
+
/** The reference number of the last task in the current page */
|
|
3260
|
+
lastReference: number;
|
|
3261
|
+
/** Navigation links for pagination */
|
|
3262
|
+
links: Links;
|
|
3263
|
+
};
|
|
3264
|
+
/**
|
|
3265
|
+
* Parameters included in pagination links.
|
|
3266
|
+
*/
|
|
3267
|
+
type LinkParams = {
|
|
3268
|
+
/** The workstation application ID */
|
|
3269
|
+
promptApplicationId: string;
|
|
3270
|
+
/** Number of items per page */
|
|
3271
|
+
limit: number;
|
|
3272
|
+
/** Starting offset for the page */
|
|
3273
|
+
offset: number;
|
|
3274
|
+
};
|
|
3275
|
+
/**
|
|
3276
|
+
* Navigation links for paginated task lists.
|
|
3277
|
+
*/
|
|
3278
|
+
type Links = {
|
|
3279
|
+
/** Parameters for the first page */
|
|
3280
|
+
first: LinkParams;
|
|
3281
|
+
/** Parameters for the last page */
|
|
3282
|
+
last: LinkParams;
|
|
3283
|
+
/** Parameters for the next page, or null if on last page */
|
|
3284
|
+
next: LinkParams | null;
|
|
3285
|
+
/** Parameters for the previous page, or null if on first page */
|
|
3286
|
+
previous: LinkParams | null;
|
|
3287
|
+
};
|
|
3288
|
+
/**
|
|
3289
|
+
* Options for retrieving a workstation instance.
|
|
3290
|
+
*/
|
|
3291
|
+
type WorkstationGetOptions<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRecord> = Omit<WorkstationOptions<TInput, TOutput>, 'client' | 'promptVersion'> & {
|
|
3292
|
+
/** Whether to skip schema validation against the server configuration. Defaults to false. */
|
|
3293
|
+
skipSchemaValidation?: boolean;
|
|
3294
|
+
};
|
|
3295
|
+
/**
|
|
3296
|
+
* Represents a workstation (prompt application) in the Tela platform.
|
|
3297
|
+
*
|
|
3298
|
+
* A Workstation enables creating and managing tasks (async workflow executions)
|
|
3299
|
+
* with input/output schema validation using Zod.
|
|
3300
|
+
*
|
|
3301
|
+
* @template TInput - Zod schema type for task input variables
|
|
3302
|
+
* @template TOutput - Zod schema type for task output results
|
|
3303
|
+
*
|
|
3304
|
+
* @example
|
|
3305
|
+
* ```typescript
|
|
3306
|
+
* // Get a workstation with schemas
|
|
3307
|
+
* const workstation = await tela.workstation.get({
|
|
3308
|
+
* applicationId: 'app-id',
|
|
3309
|
+
* input: schema => schema.object({
|
|
3310
|
+
* query: schema.string(),
|
|
3311
|
+
* }),
|
|
3312
|
+
* output: schema => schema.object({
|
|
3313
|
+
* result: schema.string(),
|
|
3314
|
+
* }),
|
|
3315
|
+
* })
|
|
3316
|
+
*
|
|
3317
|
+
* // Create a task
|
|
3318
|
+
* const task = await workstation.createTask({ query: 'test' })
|
|
3319
|
+
*
|
|
3320
|
+
* // Get the result
|
|
3321
|
+
* const result = await task.result
|
|
3322
|
+
* ```
|
|
3323
|
+
*/
|
|
3324
|
+
declare class Workstation<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRecord> {
|
|
3325
|
+
private readonly _id;
|
|
3326
|
+
private readonly _promptVersion;
|
|
3327
|
+
private readonly _client;
|
|
3328
|
+
private readonly _input;
|
|
3329
|
+
private readonly _output;
|
|
3330
|
+
/**
|
|
3331
|
+
* Creates a new Workstation instance.
|
|
3332
|
+
*
|
|
3333
|
+
* Use {@link Workstation.get} instead.
|
|
3334
|
+
* @internal
|
|
3335
|
+
*/
|
|
3336
|
+
constructor({ client, applicationId, promptVersion, input, output }: WorkstationOptions<TInput, TOutput>);
|
|
3337
|
+
/**
|
|
3338
|
+
* The unique identifier for this workstation (application ID).
|
|
3339
|
+
*/
|
|
3340
|
+
get id(): string;
|
|
3341
|
+
/**
|
|
3342
|
+
* The prompt version configuration for this workstation.
|
|
3343
|
+
*/
|
|
3344
|
+
get promptVersion(): PromptVersion;
|
|
3345
|
+
/**
|
|
3346
|
+
* Retrieves a workstation by application ID and optionally validates schemas.
|
|
3347
|
+
*
|
|
3348
|
+
* This is the recommended way to create a Workstation instance.
|
|
3349
|
+
*
|
|
3350
|
+
* @param options - Configuration options
|
|
3351
|
+
* @param options.client - The BaseClient instance for API communication
|
|
3352
|
+
* @param options.applicationId - The unique ID of the workstation
|
|
3353
|
+
* @param options.input - Optional input schema function
|
|
3354
|
+
* @param options.output - Optional output schema function
|
|
3355
|
+
* @param options.skipSchemaValidation - Whether to skip schema validation (defaults to false)
|
|
3356
|
+
* @returns A promise that resolves to a Workstation instance
|
|
3357
|
+
*
|
|
3358
|
+
* @throws {Error} If schema validation fails (when schemas are provided and skipSchemaValidation is false)
|
|
3359
|
+
*
|
|
3360
|
+
* @example
|
|
3361
|
+
* ```typescript
|
|
3362
|
+
* const workstation = await Workstation.get({
|
|
3363
|
+
* client,
|
|
3364
|
+
* applicationId: 'app-123',
|
|
3365
|
+
* input: schema => schema.object({
|
|
3366
|
+
* query: schema.string(),
|
|
3367
|
+
* }),
|
|
3368
|
+
* output: schema => schema.object({
|
|
3369
|
+
* answer: schema.string(),
|
|
3370
|
+
* }),
|
|
3371
|
+
* })
|
|
3372
|
+
* ```
|
|
3373
|
+
*/
|
|
3374
|
+
static get<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRecord>(options: WorkstationGetOptions<TInput, TOutput> & {
|
|
3375
|
+
client: BaseClient;
|
|
3376
|
+
}): Promise<Workstation<TInput, TOutput>>;
|
|
3377
|
+
/**
|
|
3378
|
+
* Creates a new task for this workstation and returns a promise-like object.
|
|
3379
|
+
*
|
|
3380
|
+
* The returned object can be awaited directly to get the Task instance, or you can
|
|
3381
|
+
* access `.result` to get the final task output directly.
|
|
3382
|
+
*
|
|
3383
|
+
* @param variables - Input variables for the task (must match the input schema)
|
|
3384
|
+
* @param params - Optional task parameters (label, tags, skipResultValidation)
|
|
3385
|
+
* @returns A promise-like object that resolves to the Task instance
|
|
3386
|
+
*
|
|
3387
|
+
* @example
|
|
3388
|
+
* ```typescript
|
|
3389
|
+
* // Get the task instance
|
|
3390
|
+
* const task = await workstation.createTask({ query: 'test' })
|
|
3391
|
+
*
|
|
3392
|
+
* // Or get the result directly
|
|
3393
|
+
* const result = await workstation.createTask({ query: 'test' }).result
|
|
3394
|
+
* ```
|
|
3395
|
+
*/
|
|
3396
|
+
createTask(variables: z.input<TInput>, params?: TaskParams & {
|
|
3397
|
+
skipResultValidation?: boolean;
|
|
3398
|
+
}): TaskPromiseLike<TInput, TOutput>;
|
|
3399
|
+
/**
|
|
3400
|
+
* Retrieves an existing task by its ID.
|
|
3401
|
+
*
|
|
3402
|
+
* This is useful for resuming monitoring of a task that was created earlier.
|
|
3403
|
+
*
|
|
3404
|
+
* @param id - The task ID to retrieve
|
|
3405
|
+
* @param options - Optional configuration
|
|
3406
|
+
* @param options.skipResultValidation - Whether to skip output validation
|
|
3407
|
+
* @returns A promise that resolves to the Task instance
|
|
3408
|
+
*
|
|
3409
|
+
* @example
|
|
3410
|
+
* ```typescript
|
|
3411
|
+
* const task = await workstation.getTask('task-id')
|
|
3412
|
+
*
|
|
3413
|
+
* // Set up event listeners
|
|
3414
|
+
* task.on('statusChange', (status) => console.log('Status:', status))
|
|
3415
|
+
* task.on('success', (result) => console.log('Result:', result))
|
|
3416
|
+
*
|
|
3417
|
+
* // Start polling
|
|
3418
|
+
* task.poll()
|
|
3419
|
+
* ```
|
|
3420
|
+
*/
|
|
3421
|
+
getTask(id: string, options?: {
|
|
3422
|
+
skipResultValidation?: boolean;
|
|
3423
|
+
}): Promise<Task<TInput, TOutput>>;
|
|
3424
|
+
/**
|
|
3425
|
+
* Validates and parses input variables using the workstation input schema.
|
|
3426
|
+
*
|
|
3427
|
+
* @param variables - Raw input variables to validate.
|
|
3428
|
+
* @returns Parsed and validated variables.
|
|
3429
|
+
* @throws {ZodError} If validation fails when a Zod schema is configured.
|
|
3430
|
+
*/
|
|
3431
|
+
private parseVariables;
|
|
3432
|
+
/**
|
|
3433
|
+
* Processes variables and uploads any TelaFile instances to the server.
|
|
3434
|
+
* Replaces TelaFile objects with their uploaded URLs while preserving other values.
|
|
3435
|
+
*
|
|
3436
|
+
* @returns A promise resolving to the processed variables object.
|
|
3437
|
+
*/
|
|
3438
|
+
private resolveVariables;
|
|
3439
|
+
/**
|
|
3440
|
+
* Lists tasks for this workstation with optional filtering and pagination.
|
|
3441
|
+
*
|
|
3442
|
+
* Returns a page of tasks matching the specified filters, along with metadata
|
|
3443
|
+
* for pagination.
|
|
3444
|
+
*
|
|
3445
|
+
* @param params - Query parameters
|
|
3446
|
+
* @param params.filters - Optional filters to apply (ID, name, status, dates, etc.)
|
|
3447
|
+
* @param params.options - Optional pagination and sorting options
|
|
3448
|
+
* @param params.rawQuery - Raw query object (internal use, overrides filters/options)
|
|
3449
|
+
* @returns A promise that resolves to an object containing tasks and pagination metadata
|
|
3450
|
+
*
|
|
3451
|
+
* @example
|
|
3452
|
+
* ```typescript
|
|
3453
|
+
* // Get first 10 completed tasks
|
|
3454
|
+
* const { tasks, meta } = await workstation.listTasks({
|
|
3455
|
+
* filters: { status: ['completed'] },
|
|
3456
|
+
* options: { limit: 10, offset: 0 },
|
|
3457
|
+
* })
|
|
3458
|
+
*
|
|
3459
|
+
* // Sort by creation date
|
|
3460
|
+
* const { tasks, meta } = await workstation.listTasks({
|
|
3461
|
+
* options: {
|
|
3462
|
+
* order: { by: 'createdAt', direction: 'desc' },
|
|
3463
|
+
* limit: 20,
|
|
3464
|
+
* },
|
|
3465
|
+
* })
|
|
3466
|
+
* ```
|
|
3467
|
+
*/
|
|
3468
|
+
listTasks({ filters, options, rawQuery }: {
|
|
3469
|
+
filters?: TaskListFilters;
|
|
3470
|
+
options?: TaskListOptions;
|
|
3471
|
+
rawQuery?: Record<string, any>;
|
|
3472
|
+
}): Promise<{
|
|
3473
|
+
tasks: Task<TInput, TOutput>[];
|
|
3474
|
+
meta: TaskListMeta;
|
|
3475
|
+
}>;
|
|
3476
|
+
/**
|
|
3477
|
+
* Asynchronously iterates through all tasks matching the specified filters.
|
|
3478
|
+
*
|
|
3479
|
+
* This generator automatically handles pagination, fetching additional pages
|
|
3480
|
+
* as needed. Each iteration yields a task and the current page metadata.
|
|
3481
|
+
*
|
|
3482
|
+
* @param params - Query parameters
|
|
3483
|
+
* @param params.filters - Optional filters to apply (ID, name, status, dates, etc.)
|
|
3484
|
+
* @param params.options - Optional initial pagination and sorting options
|
|
3485
|
+
* @yields A tuple of [task, metadata] for each task
|
|
3486
|
+
*
|
|
3487
|
+
* @example
|
|
3488
|
+
* ```typescript
|
|
3489
|
+
* // Iterate through all pending tasks
|
|
3490
|
+
* for await (const [task, meta] of workstation.iterateTasks({
|
|
3491
|
+
* filters: { status: ['pending'] },
|
|
3492
|
+
* })) {
|
|
3493
|
+
* console.log(`Task ${task.id}: ${task.status}`)
|
|
3494
|
+
* console.log(`Page ${meta.currentPage} of ${meta.totalPages}`)
|
|
3495
|
+
* }
|
|
3496
|
+
*
|
|
3497
|
+
* // Process tasks in batches
|
|
3498
|
+
* for await (const [task, meta] of workstation.iterateTasks({
|
|
3499
|
+
* options: { limit: 50 },
|
|
3500
|
+
* })) {
|
|
3501
|
+
* await processTask(task)
|
|
3502
|
+
* }
|
|
3503
|
+
* ```
|
|
3504
|
+
*/
|
|
3505
|
+
iterateTasks({ filters, options }: {
|
|
3506
|
+
filters?: TaskListFilters;
|
|
3507
|
+
options?: TaskListOptions;
|
|
3508
|
+
}): AsyncGenerator<readonly [Task<TInput, TOutput>, TaskListMeta], void, unknown>;
|
|
3509
|
+
}
|
|
3510
|
+
|
|
2602
3511
|
/**
|
|
2603
3512
|
* Tela SDK main entry point and client initialization.
|
|
2604
3513
|
*
|
|
@@ -2695,7 +3604,10 @@ declare class TelaSDK extends BaseClient {
|
|
|
2695
3604
|
* ```
|
|
2696
3605
|
*/
|
|
2697
3606
|
canvas: {
|
|
2698
|
-
get: <TInput extends z.ZodType | Record<string, unknown> = Record<string, unknown>, TOutput extends z.ZodType | Record<string, unknown> = Record<string, unknown>>(options: CanvasGetOptions<TInput, TOutput>) => Promise<Canvas<TInput, TOutput>>;
|
|
3607
|
+
get: <TInput extends z$1.ZodType | Record<string, unknown> = Record<string, unknown>, TOutput extends z$1.ZodType | Record<string, unknown> = Record<string, unknown>>(options: CanvasGetOptions<TInput, TOutput>) => Promise<Canvas<TInput, TOutput>>;
|
|
3608
|
+
};
|
|
3609
|
+
workstation: {
|
|
3610
|
+
get: <TInput extends z$1.ZodType | Record<string, unknown> = Record<string, unknown>, TOutput extends z$1.ZodType | Record<string, unknown> = Record<string, unknown>>(options: WorkstationGetOptions<TInput, TOutput>) => Promise<Workstation<TInput, TOutput>>;
|
|
2699
3611
|
};
|
|
2700
3612
|
static TelaSDK: typeof TelaSDK;
|
|
2701
3613
|
static DEFAULT_TIMEOUT: number;
|
|
@@ -2733,6 +3645,10 @@ declare class TelaSDK extends BaseClient {
|
|
|
2733
3645
|
static MissingApiKeyOrJWTError: typeof MissingApiKeyOrJWTError;
|
|
2734
3646
|
/** Thrown when both an API key and a JWT are provided. */
|
|
2735
3647
|
static ConflictApiKeyAndJWTError: typeof ConflictApiKeyAndJWTError;
|
|
3648
|
+
/** Thrown when a canvas execution fails on the server. */
|
|
3649
|
+
static ExecutionFailedError: typeof ExecutionFailedError;
|
|
3650
|
+
/** Thrown when a workstation task fails on the server. */
|
|
3651
|
+
static TaskFailedError: typeof TaskFailedError;
|
|
2736
3652
|
}
|
|
2737
3653
|
/**
|
|
2738
3654
|
* Creates a new instance of the TelaSDK.
|
|
@@ -2742,4 +3658,4 @@ declare class TelaSDK extends BaseClient {
|
|
|
2742
3658
|
*/
|
|
2743
3659
|
declare function createTelaClient(opts: TelaSDKOptions): TelaSDK;
|
|
2744
3660
|
|
|
2745
|
-
export { APIError, AuthenticationError, AuthorizationError, BadRequestError, BaseClient, type BaseClientOptions, type BaseTelaFileOptions, BatchExecutionFailedError, ConflictApiKeyAndJWTError, ConflictError, ConnectionError, ConnectionTimeout, EmptyFileError, ExecutionFailedError, ExecutionNotStartedError, FileUploadError, type HTTPMethods, InternalServerError, InvalidExecutionModeError, InvalidFileURL, MissingApiKeyOrJWTError, NotFoundError, RateLimitError, type RequestOptions, type SchemaBuilder, TelaError, TelaFile, type TelaFileInput, type TelaFileOptions, type TelaFileOptionsWithMimeType, TelaFileSchema, TelaSDK, type TelaSDKOptions, UnprocessableEntityError, UserAbortError, createTelaClient, toError };
|
|
3661
|
+
export { APIError, AuthenticationError, AuthorizationError, BadRequestError, BaseClient, type BaseClientOptions, type BaseTelaFileOptions, BatchExecutionFailedError, ConflictApiKeyAndJWTError, ConflictError, ConnectionError, ConnectionTimeout, EmptyFileError, ExecutionFailedError, ExecutionNotStartedError, FileUploadError, type HTTPMethods, InternalServerError, InvalidExecutionModeError, InvalidFileURL, MissingApiKeyOrJWTError, NotFoundError, RateLimitError, type RequestOptions, type SchemaBuilder, TaskFailedError, TelaError, TelaFile, type TelaFileInput, type TelaFileOptions, type TelaFileOptionsWithMimeType, TelaFileSchema, TelaSDK, type TelaSDKOptions, UnprocessableEntityError, UserAbortError, createTelaClient, isTelaFile, isTelaFileArray, toError };
|