@taskyon/tyclient 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1053 @@
1
+ import z from 'zod';
2
+ import { z } from 'zod';
3
+
4
+ declare const FunctionCall: z.ZodObject<{
5
+ name: z.ZodString;
6
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [
7
+ z.ZodString,
8
+ z.ZodNumber,
9
+ z.ZodBoolean,
10
+ z.ZodRecord<z.ZodString, z.ZodUnknown>,
11
+ z.ZodArray<z.ZodUnknown>,
12
+ z.ZodNull,
13
+ z.ZodUndefined
14
+ ]>>;
15
+ }, z.core.$strip>;
16
+ declare const InternalTool: z.ZodObject<{
17
+ description: z.ZodString;
18
+ longDescription: z.ZodOptional<z.ZodString>;
19
+ name: z.ZodString;
20
+ renderOptions: z.ZodOptional<z.ZodObject<{
21
+ hideChat: z.ZodOptional<z.ZodBoolean>;
22
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
23
+ }, z.core.$strip>>;
24
+ parameters: z.ZodReadonly<z.ZodType<import("json-schema").JSONSchema7, unknown, z.core.$ZodTypeInternals<import("json-schema").JSONSchema7, unknown>>>;
25
+ code: z.ZodOptional<z.ZodString>;
26
+ function: z.ZodOptional<z.ZodCustom<(params: any, context: toolContext) => unknown, (params: any, context: toolContext) => unknown>>;
27
+ }, z.core.$strip>;
28
+ declare const TaskNode: z.ZodObject<{
29
+ role: z.ZodEnum<{
30
+ function: "function";
31
+ system: "system";
32
+ user: "user";
33
+ assistant: "assistant";
34
+ }>;
35
+ name: z.ZodOptional<z.ZodString>;
36
+ content: z.ZodUnion<readonly [
37
+ z.ZodObject<{
38
+ type: z.ZodLiteral<"message">;
39
+ data: z.ZodString;
40
+ }, z.core.$strict>,
41
+ z.ZodObject<{
42
+ type: z.ZodLiteral<"toolresult">;
43
+ data: z.ZodUnknown;
44
+ }, z.core.$strict>,
45
+ z.ZodObject<{
46
+ type: z.ZodLiteral<"tooldefinition">;
47
+ data: z.ZodObject<{
48
+ description: z.ZodString;
49
+ longDescription: z.ZodOptional<z.ZodString>;
50
+ name: z.ZodString;
51
+ renderOptions: z.ZodOptional<z.ZodObject<{
52
+ hideChat: z.ZodOptional<z.ZodBoolean>;
53
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
54
+ }, z.core.$strip>>;
55
+ parameters: z.ZodReadonly<z.ZodType<import("json-schema").JSONSchema7, unknown, z.core.$ZodTypeInternals<import("json-schema").JSONSchema7, unknown>>>;
56
+ code: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strip>;
58
+ }, z.core.$strict>,
59
+ z.ZodObject<{
60
+ type: z.ZodLiteral<"error">;
61
+ data: z.ZodUnknown;
62
+ }, z.core.$strict>,
63
+ z.ZodObject<{
64
+ type: z.ZodLiteral<"structured">;
65
+ data: z.ZodUnknown;
66
+ }, z.core.$strict>,
67
+ z.ZodObject<{
68
+ type: z.ZodLiteral<"functioncall">;
69
+ data: z.ZodObject<{
70
+ name: z.ZodString;
71
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [
72
+ z.ZodString,
73
+ z.ZodNumber,
74
+ z.ZodBoolean,
75
+ z.ZodRecord<z.ZodString, z.ZodUnknown>,
76
+ z.ZodArray<z.ZodUnknown>,
77
+ z.ZodNull,
78
+ z.ZodUndefined
79
+ ]>>;
80
+ }, z.core.$strip>;
81
+ }, z.core.$strict>,
82
+ z.ZodObject<{
83
+ type: z.ZodLiteral<"files">;
84
+ data: z.ZodArray<z.ZodString>;
85
+ }, z.core.$strict>,
86
+ z.ZodObject<{
87
+ type: z.ZodLiteral<"return">;
88
+ data: z.ZodString;
89
+ }, z.core.$strict>
90
+ ]>;
91
+ label: z.ZodOptional<z.ZodArray<z.ZodString>>;
92
+ parentID: z.ZodOptional<z.ZodString>;
93
+ priorID: z.ZodOptional<z.ZodString>;
94
+ id: z.ZodString;
95
+ authorId: z.ZodOptional<z.ZodString>;
96
+ created_at: z.ZodOptional<z.ZodNumber>;
97
+ acl: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ sig: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$strip>;
100
+ declare const TyProfile: z.ZodObject<{
101
+ version: z.ZodLiteral<19>;
102
+ appConfiguration: z.ZodObject<{
103
+ darkTheme: z.ZodUnion<readonly [
104
+ z.ZodLiteral<"auto">,
105
+ z.ZodBoolean
106
+ ]>;
107
+ appConfigurationUrl: z.ZodDefault<z.ZodString>;
108
+ gdriveConfigurationFile: z.ZodDefault<z.ZodString>;
109
+ enableGdriveSync: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
110
+ expertMode: z.ZodDefault<z.ZodBoolean>;
111
+ showCosts: z.ZodDefault<z.ZodBoolean>;
112
+ gdriveDir: z.ZodDefault<z.ZodString>;
113
+ showLogo: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
114
+ welcomeMsg: z.ZodOptional<z.ZodDefault<z.ZodString>>;
115
+ chatSuggestions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [
116
+ z.ZodObject<{
117
+ url: z.ZodString;
118
+ label: z.ZodString;
119
+ }, z.core.$strip>,
120
+ z.ZodObject<{
121
+ md: z.ZodString;
122
+ label: z.ZodString;
123
+ }, z.core.$strip>
124
+ ]>>>>;
125
+ useEnterToSend: z.ZodDefault<z.ZodBoolean>;
126
+ guiMode: z.ZodDefault<z.ZodEnum<{
127
+ default: "default";
128
+ auto: "auto";
129
+ iframe: "iframe";
130
+ minChat: "minChat";
131
+ }>>;
132
+ primaryColor: z.ZodOptional<z.ZodDefault<z.ZodString>>;
133
+ secondaryColor: z.ZodOptional<z.ZodDefault<z.ZodString>>;
134
+ }, z.core.$strip>;
135
+ llmSettings: z.ZodObject<{
136
+ userId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
137
+ secretPublicKey: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
138
+ selectedTaskId: z.ZodOptional<z.ZodString>;
139
+ enableOpenAiTools: z.ZodDefault<z.ZodBoolean>;
140
+ selectedApi: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
141
+ llmApis: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
142
+ name: z.ZodString;
143
+ baseURL: z.ZodString;
144
+ defaultModel: z.ZodString;
145
+ selectedModel: z.ZodOptional<z.ZodString>;
146
+ models: z.ZodOptional<z.ZodObject<{
147
+ instruction: z.ZodOptional<z.ZodString>;
148
+ chat: z.ZodOptional<z.ZodString>;
149
+ free: z.ZodOptional<z.ZodString>;
150
+ }, z.core.$strip>>;
151
+ streamSupport: z.ZodBoolean;
152
+ defaultHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
153
+ routes: z.ZodObject<{
154
+ chatCompletion: z.ZodString;
155
+ models: z.ZodString;
156
+ }, z.core.$strip>;
157
+ }, z.core.$strip>>>;
158
+ siteUrl: z.ZodDefault<z.ZodString>;
159
+ summaryModel: z.ZodDefault<z.ZodString>;
160
+ vectorizationModel: z.ZodDefault<z.ZodString>;
161
+ maxAutonomousTasks: z.ZodDefault<z.ZodNumber>;
162
+ entryNode: z.ZodOptional<z.ZodObject<{
163
+ role: z.ZodNonOptional<z.ZodOptional<z.ZodEnum<{
164
+ function: "function";
165
+ system: "system";
166
+ user: "user";
167
+ assistant: "assistant";
168
+ }>>>;
169
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
170
+ content: z.ZodNonOptional<z.ZodOptional<z.ZodUnion<readonly [
171
+ z.ZodObject<{
172
+ type: z.ZodLiteral<"message">;
173
+ data: z.ZodString;
174
+ }, z.core.$strict>,
175
+ z.ZodObject<{
176
+ type: z.ZodLiteral<"toolresult">;
177
+ data: z.ZodUnknown;
178
+ }, z.core.$strict>,
179
+ z.ZodObject<{
180
+ type: z.ZodLiteral<"tooldefinition">;
181
+ data: z.ZodObject<{
182
+ description: z.ZodString;
183
+ longDescription: z.ZodOptional<z.ZodString>;
184
+ name: z.ZodString;
185
+ renderOptions: z.ZodOptional<z.ZodObject<{
186
+ hideChat: z.ZodOptional<z.ZodBoolean>;
187
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
188
+ }, z.core.$strip>>;
189
+ parameters: z.ZodReadonly<z.ZodType<import("json-schema").JSONSchema7, unknown, z.core.$ZodTypeInternals<import("json-schema").JSONSchema7, unknown>>>;
190
+ code: z.ZodOptional<z.ZodString>;
191
+ }, z.core.$strip>;
192
+ }, z.core.$strict>,
193
+ z.ZodObject<{
194
+ type: z.ZodLiteral<"error">;
195
+ data: z.ZodUnknown;
196
+ }, z.core.$strict>,
197
+ z.ZodObject<{
198
+ type: z.ZodLiteral<"structured">;
199
+ data: z.ZodUnknown;
200
+ }, z.core.$strict>,
201
+ z.ZodObject<{
202
+ type: z.ZodLiteral<"functioncall">;
203
+ data: z.ZodObject<{
204
+ name: z.ZodString;
205
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [
206
+ z.ZodString,
207
+ z.ZodNumber,
208
+ z.ZodBoolean,
209
+ z.ZodRecord<z.ZodString, z.ZodUnknown>,
210
+ z.ZodArray<z.ZodUnknown>,
211
+ z.ZodNull,
212
+ z.ZodUndefined
213
+ ]>>;
214
+ }, z.core.$strip>;
215
+ }, z.core.$strict>,
216
+ z.ZodObject<{
217
+ type: z.ZodLiteral<"files">;
218
+ data: z.ZodArray<z.ZodString>;
219
+ }, z.core.$strict>,
220
+ z.ZodObject<{
221
+ type: z.ZodLiteral<"return">;
222
+ data: z.ZodString;
223
+ }, z.core.$strict>
224
+ ]>>>;
225
+ label: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
226
+ parentID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
227
+ priorID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
228
+ id: z.ZodOptional<z.ZodString>;
229
+ authorId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
230
+ created_at: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
231
+ acl: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
232
+ sig: z.ZodOptional<z.ZodOptional<z.ZodString>>;
233
+ }, z.core.$strip>>;
234
+ enableToolChooser: z.ZodDefault<z.ZodBoolean>;
235
+ useBasePrompt: z.ZodDefault<z.ZodBoolean>;
236
+ tryUsingVisionModels: z.ZodDefault<z.ZodBoolean>;
237
+ taskChatTemplates: z.ZodObject<{
238
+ basePrompt: z.ZodString;
239
+ instruction: z.ZodString;
240
+ toolResult: z.ZodString;
241
+ task: z.ZodString;
242
+ evaluate: z.ZodString;
243
+ schemaReminder: z.ZodString;
244
+ tools: z.ZodString;
245
+ }, z.core.$strip>;
246
+ }, z.core.$strip>;
247
+ toolchainConfig: z.ZodObject<{
248
+ tools: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
249
+ }, z.core.$strip>;
250
+ signatureOrKey: z.ZodOptional<z.ZodString>;
251
+ }, z.core.$strip>;
252
+ declare const partialTaskDraft: z.ZodObject<{
253
+ role: z.ZodNonOptional<z.ZodOptional<z.ZodEnum<{
254
+ function: "function";
255
+ system: "system";
256
+ user: "user";
257
+ assistant: "assistant";
258
+ }>>>;
259
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
260
+ content: z.ZodNonOptional<z.ZodOptional<z.ZodUnion<readonly [
261
+ z.ZodObject<{
262
+ type: z.ZodLiteral<"message">;
263
+ data: z.ZodString;
264
+ }, z.core.$strict>,
265
+ z.ZodObject<{
266
+ type: z.ZodLiteral<"toolresult">;
267
+ data: z.ZodUnknown;
268
+ }, z.core.$strict>,
269
+ z.ZodObject<{
270
+ type: z.ZodLiteral<"tooldefinition">;
271
+ data: z.ZodObject<{
272
+ description: z.ZodString;
273
+ longDescription: z.ZodOptional<z.ZodString>;
274
+ name: z.ZodString;
275
+ renderOptions: z.ZodOptional<z.ZodObject<{
276
+ hideChat: z.ZodOptional<z.ZodBoolean>;
277
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
278
+ }, z.core.$strip>>;
279
+ parameters: z.ZodReadonly<z.ZodType<import("json-schema").JSONSchema7, unknown, z.core.$ZodTypeInternals<import("json-schema").JSONSchema7, unknown>>>;
280
+ code: z.ZodOptional<z.ZodString>;
281
+ }, z.core.$strip>;
282
+ }, z.core.$strict>,
283
+ z.ZodObject<{
284
+ type: z.ZodLiteral<"error">;
285
+ data: z.ZodUnknown;
286
+ }, z.core.$strict>,
287
+ z.ZodObject<{
288
+ type: z.ZodLiteral<"structured">;
289
+ data: z.ZodUnknown;
290
+ }, z.core.$strict>,
291
+ z.ZodObject<{
292
+ type: z.ZodLiteral<"functioncall">;
293
+ data: z.ZodObject<{
294
+ name: z.ZodString;
295
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [
296
+ z.ZodString,
297
+ z.ZodNumber,
298
+ z.ZodBoolean,
299
+ z.ZodRecord<z.ZodString, z.ZodUnknown>,
300
+ z.ZodArray<z.ZodUnknown>,
301
+ z.ZodNull,
302
+ z.ZodUndefined
303
+ ]>>;
304
+ }, z.core.$strip>;
305
+ }, z.core.$strict>,
306
+ z.ZodObject<{
307
+ type: z.ZodLiteral<"files">;
308
+ data: z.ZodArray<z.ZodString>;
309
+ }, z.core.$strict>,
310
+ z.ZodObject<{
311
+ type: z.ZodLiteral<"return">;
312
+ data: z.ZodString;
313
+ }, z.core.$strict>
314
+ ]>>>;
315
+ label: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
316
+ parentID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
317
+ priorID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
318
+ id: z.ZodOptional<z.ZodString>;
319
+ authorId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
320
+ created_at: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
321
+ acl: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
322
+ sig: z.ZodOptional<z.ZodOptional<z.ZodString>>;
323
+ }, z.core.$strip>;
324
+ declare const taskResult: z.ZodObject<{
325
+ taskResultMarker: z.ZodDefault<z.ZodLiteral<"*TY_TASKRESULT*">>;
326
+ taskChainList: z.ZodArray<z.ZodArray<z.ZodObject<{
327
+ role: z.ZodNonOptional<z.ZodOptional<z.ZodEnum<{
328
+ function: "function";
329
+ system: "system";
330
+ user: "user";
331
+ assistant: "assistant";
332
+ }>>>;
333
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
334
+ content: z.ZodNonOptional<z.ZodOptional<z.ZodUnion<readonly [
335
+ z.ZodObject<{
336
+ type: z.ZodLiteral<"message">;
337
+ data: z.ZodString;
338
+ }, z.core.$strict>,
339
+ z.ZodObject<{
340
+ type: z.ZodLiteral<"toolresult">;
341
+ data: z.ZodUnknown;
342
+ }, z.core.$strict>,
343
+ z.ZodObject<{
344
+ type: z.ZodLiteral<"tooldefinition">;
345
+ data: z.ZodObject<{
346
+ description: z.ZodString;
347
+ longDescription: z.ZodOptional<z.ZodString>;
348
+ name: z.ZodString;
349
+ renderOptions: z.ZodOptional<z.ZodObject<{
350
+ hideChat: z.ZodOptional<z.ZodBoolean>;
351
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
352
+ }, z.core.$strip>>;
353
+ parameters: z.ZodReadonly<z.ZodType<import("json-schema").JSONSchema7, unknown, z.core.$ZodTypeInternals<import("json-schema").JSONSchema7, unknown>>>;
354
+ code: z.ZodOptional<z.ZodString>;
355
+ }, z.core.$strip>;
356
+ }, z.core.$strict>,
357
+ z.ZodObject<{
358
+ type: z.ZodLiteral<"error">;
359
+ data: z.ZodUnknown;
360
+ }, z.core.$strict>,
361
+ z.ZodObject<{
362
+ type: z.ZodLiteral<"structured">;
363
+ data: z.ZodUnknown;
364
+ }, z.core.$strict>,
365
+ z.ZodObject<{
366
+ type: z.ZodLiteral<"functioncall">;
367
+ data: z.ZodObject<{
368
+ name: z.ZodString;
369
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [
370
+ z.ZodString,
371
+ z.ZodNumber,
372
+ z.ZodBoolean,
373
+ z.ZodRecord<z.ZodString, z.ZodUnknown>,
374
+ z.ZodArray<z.ZodUnknown>,
375
+ z.ZodNull,
376
+ z.ZodUndefined
377
+ ]>>;
378
+ }, z.core.$strip>;
379
+ }, z.core.$strict>,
380
+ z.ZodObject<{
381
+ type: z.ZodLiteral<"files">;
382
+ data: z.ZodArray<z.ZodString>;
383
+ }, z.core.$strict>,
384
+ z.ZodObject<{
385
+ type: z.ZodLiteral<"return">;
386
+ data: z.ZodString;
387
+ }, z.core.$strict>
388
+ ]>>>;
389
+ label: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
390
+ parentID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
391
+ priorID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
392
+ id: z.ZodOptional<z.ZodString>;
393
+ authorId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
394
+ created_at: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
395
+ acl: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
396
+ sig: z.ZodOptional<z.ZodOptional<z.ZodString>>;
397
+ }, z.core.$strip>>>;
398
+ }, z.core.$strip>;
399
+ export declare function createTool<T, SCHEMA extends Readonly<JSONSchema>, PARAMS = FromSchema<SCHEMA>>(tool: T & {
400
+ parameters: SCHEMA;
401
+ function?: (params: PARAMS, context: toolContext) => unknown;
402
+ } & Omit<InternalTool$1, "function" | "parameters">): T;
403
+ export declare function initializeTaskyon(tools: ClientTool[], configuration: partialTyConfiguration, persist?: boolean): Promise<void>;
404
+ export declare function makeTaskResult(tasks: partialTaskDraft | partialTaskDraft[] | partialTaskDraft[][]): taskResult;
405
+ export declare function toolCall(f: FunctionCall): partialTaskDraft & {
406
+ content: {
407
+ type: "functioncall";
408
+ data: FunctionCall;
409
+ };
410
+ };
411
+ /**
412
+ Merges user specified options with default options.
413
+
414
+ @example
415
+ ```
416
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
417
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
418
+ type SpecifiedOptions = {leavesOnly: true};
419
+
420
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
421
+ //=> {maxRecursionDepth: 10; leavesOnly: true}
422
+ ```
423
+
424
+ @example
425
+ ```
426
+ // Complains if default values are not provided for optional options
427
+
428
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
429
+ type DefaultPathsOptions = {maxRecursionDepth: 10};
430
+ type SpecifiedOptions = {};
431
+
432
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
433
+ // ~~~~~~~~~~~~~~~~~~~
434
+ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
435
+ ```
436
+
437
+ @example
438
+ ```
439
+ // Complains if an option's default type does not conform to the expected type
440
+
441
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
442
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
443
+ type SpecifiedOptions = {};
444
+
445
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
446
+ // ~~~~~~~~~~~~~~~~~~~
447
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
448
+ ```
449
+
450
+ @example
451
+ ```
452
+ // Complains if an option's specified type does not conform to the expected type
453
+
454
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
455
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
456
+ type SpecifiedOptions = {leavesOnly: 'yes'};
457
+
458
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
459
+ // ~~~~~~~~~~~~~~~~
460
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
461
+ ```
462
+ */
463
+ export type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = IfAny<SpecifiedOptions, Defaults, IfNever<SpecifiedOptions, Defaults, Simplify<Merge<Defaults, {
464
+ [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key];
465
+ }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
466
+ >>;
467
+ /**
468
+ Matches any primitive, `void`, `Date`, or `RegExp` value.
469
+ */
470
+ export type BuiltIns = Primitive | void | Date | RegExp;
471
+ export type ClientTool = WithRequired<InternalTool$1, "function">;
472
+ export type DefaultPartialDeepOptions = {
473
+ recurseIntoArrays: false;
474
+ allowUndefinedInNonTupleArrays: true;
475
+ };
476
+ export type FunctionCall = z.infer<typeof FunctionCall>;
477
+ /**
478
+ An if-else-like type that resolves depending on whether the given type is `any`.
479
+
480
+ @see {@link IsAny}
481
+
482
+ @example
483
+ ```
484
+ import type {IfAny} from 'type-fest';
485
+
486
+ type ShouldBeTrue = IfAny<any>;
487
+ //=> true
488
+
489
+ type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
490
+ //=> 'bar'
491
+ ```
492
+
493
+ @category Type Guard
494
+ @category Utilities
495
+ */
496
+ export type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
497
+ /**
498
+ An if-else-like type that resolves depending on whether the given type is `never`.
499
+
500
+ @see {@link IsNever}
501
+
502
+ @example
503
+ ```
504
+ import type {IfNever} from 'type-fest';
505
+
506
+ type ShouldBeTrue = IfNever<never>;
507
+ //=> true
508
+
509
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
510
+ //=> 'bar'
511
+ ```
512
+
513
+ @category Type Guard
514
+ @category Utilities
515
+ */
516
+ export type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
517
+ /**
518
+ Returns a boolean for whether the given type is `any`.
519
+
520
+ @link https://stackoverflow.com/a/49928360/1490091
521
+
522
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
523
+
524
+ @example
525
+ ```
526
+ import type {IsAny} from 'type-fest';
527
+
528
+ const typedObject = {a: 1, b: 2} as const;
529
+ const anyObject: any = {a: 1, b: 2};
530
+
531
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
532
+ return obj[key];
533
+ }
534
+
535
+ const typedA = get(typedObject, 'a');
536
+ //=> 1
537
+
538
+ const anyA = get(anyObject, 'a');
539
+ //=> any
540
+ ```
541
+
542
+ @category Type Guard
543
+ @category Utilities
544
+ */
545
+ export type IsAny<T> = 0 extends 1 & NoInfer$1<T> ? true : false;
546
+ /**
547
+ Returns a boolean for whether the given type is `never`.
548
+
549
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
550
+ @link https://stackoverflow.com/a/53984913/10292952
551
+ @link https://www.zhenghao.io/posts/ts-never
552
+
553
+ Useful in type utilities, such as checking if something does not occur.
554
+
555
+ @example
556
+ ```
557
+ import type {IsNever, And} from 'type-fest';
558
+
559
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
560
+ type AreStringsEqual<A extends string, B extends string> =
561
+ And<
562
+ IsNever<Exclude<A, B>> extends true ? true : false,
563
+ IsNever<Exclude<B, A>> extends true ? true : false
564
+ >;
565
+
566
+ type EndIfEqual<I extends string, O extends string> =
567
+ AreStringsEqual<I, O> extends true
568
+ ? never
569
+ : void;
570
+
571
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
572
+ if (input === output) {
573
+ process.exit(0);
574
+ }
575
+ }
576
+
577
+ endIfEqual('abc', 'abc');
578
+ //=> never
579
+
580
+ endIfEqual('abc', '123');
581
+ //=> void
582
+ ```
583
+
584
+ @category Type Guard
585
+ @category Utilities
586
+ */
587
+ export type IsNever<T> = [
588
+ T
589
+ ] extends [
590
+ never
591
+ ] ? true : false;
592
+ /**
593
+ Merge two types into a new type. Keys of the second type overrides keys of the first type.
594
+
595
+ @example
596
+ ```
597
+ import type {Merge} from 'type-fest';
598
+
599
+ interface Foo {
600
+ [x: string]: unknown;
601
+ [x: number]: unknown;
602
+ foo: string;
603
+ bar: symbol;
604
+ }
605
+
606
+ type Bar = {
607
+ [x: number]: number;
608
+ [x: symbol]: unknown;
609
+ bar: Date;
610
+ baz: boolean;
611
+ };
612
+
613
+ export type FooBar = Merge<Foo, Bar>;
614
+ // => {
615
+ // [x: string]: unknown;
616
+ // [x: number]: number;
617
+ // [x: symbol]: unknown;
618
+ // foo: string;
619
+ // bar: Date;
620
+ // baz: boolean;
621
+ // }
622
+ ```
623
+
624
+ @category Object
625
+ */
626
+ export type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
627
+ /**
628
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
629
+
630
+ This is the counterpart of `PickIndexSignature`.
631
+
632
+ Use-cases:
633
+ - Remove overly permissive signatures from third-party types.
634
+
635
+ This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
636
+
637
+ It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
638
+
639
+ (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
640
+
641
+ ```
642
+ const indexed: Record<string, unknown> = {}; // Allowed
643
+
644
+ const keyed: Record<'foo', unknown> = {}; // Error
645
+ // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
646
+ ```
647
+
648
+ Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
649
+
650
+ ```
651
+ type Indexed = {} extends Record<string, unknown>
652
+ ? '✅ `{}` is assignable to `Record<string, unknown>`'
653
+ : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
654
+ // => '✅ `{}` is assignable to `Record<string, unknown>`'
655
+
656
+ type Keyed = {} extends Record<'foo' | 'bar', unknown>
657
+ ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
658
+ : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
659
+ // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
660
+ ```
661
+
662
+ Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
663
+
664
+ ```
665
+ import type {OmitIndexSignature} from 'type-fest';
666
+
667
+ type OmitIndexSignature<ObjectType> = {
668
+ [KeyType in keyof ObjectType // Map each key of `ObjectType`...
669
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
670
+ };
671
+ ```
672
+
673
+ ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
674
+
675
+ ```
676
+ import type {OmitIndexSignature} from 'type-fest';
677
+
678
+ type OmitIndexSignature<ObjectType> = {
679
+ [KeyType in keyof ObjectType
680
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
681
+ as {} extends Record<KeyType, unknown>
682
+ ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
683
+ : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
684
+ ]: ObjectType[KeyType];
685
+ };
686
+ ```
687
+
688
+ If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
689
+
690
+ @example
691
+ ```
692
+ import type {OmitIndexSignature} from 'type-fest';
693
+
694
+ interface Example {
695
+ // These index signatures will be removed.
696
+ [x: string]: any
697
+ [x: number]: any
698
+ [x: symbol]: any
699
+ [x: `head-${string}`]: string
700
+ [x: `${string}-tail`]: string
701
+ [x: `head-${string}-tail`]: string
702
+ [x: `${bigint}`]: string
703
+ [x: `embedded-${number}`]: string
704
+
705
+ // These explicitly defined keys will remain.
706
+ foo: 'bar';
707
+ qux?: 'baz';
708
+ }
709
+
710
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
711
+ // => { foo: 'bar'; qux?: 'baz' | undefined; }
712
+ ```
713
+
714
+ @see PickIndexSignature
715
+ @category Object
716
+ */
717
+ export type OmitIndexSignature<ObjectType> = {
718
+ [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType];
719
+ };
720
+ /**
721
+ Extract all optional keys from the given type.
722
+
723
+ This is useful when you want to create a new type that contains different type values for the optional keys only.
724
+
725
+ @example
726
+ ```
727
+ import type {OptionalKeysOf, Except} from 'type-fest';
728
+
729
+ interface User {
730
+ name: string;
731
+ surname: string;
732
+
733
+ luckyNumber?: number;
734
+ }
735
+
736
+ const REMOVE_FIELD = Symbol('remove field symbol');
737
+ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
738
+ [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
739
+ };
740
+
741
+ const update1: UpdateOperation<User> = {
742
+ name: 'Alice'
743
+ };
744
+
745
+ const update2: UpdateOperation<User> = {
746
+ name: 'Bob',
747
+ luckyNumber: REMOVE_FIELD
748
+ };
749
+ ```
750
+
751
+ @category Utilities
752
+ */
753
+ export type OptionalKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
754
+ ? (keyof {
755
+ [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never;
756
+ }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
757
+ : never; // Should never happen
758
+ /**
759
+ Create a type from another type with all keys and nested keys set to optional.
760
+
761
+ Use-cases:
762
+ - Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
763
+ - Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
764
+
765
+ @example
766
+ ```
767
+ import type {PartialDeep} from 'type-fest';
768
+
769
+ const settings: Settings = {
770
+ textEditor: {
771
+ fontSize: 14,
772
+ fontColor: '#000000',
773
+ fontWeight: 400
774
+ },
775
+ autocomplete: false,
776
+ autosave: true
777
+ };
778
+
779
+ const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
780
+ return {...settings, ...savedSettings};
781
+ }
782
+
783
+ settings = applySavedSettings({textEditor: {fontWeight: 500}});
784
+ ```
785
+
786
+ By default, this does not affect elements in array and tuple types. You can change this by passing `{recurseIntoArrays: true}` as the second type argument:
787
+
788
+ ```
789
+ import type {PartialDeep} from 'type-fest';
790
+
791
+ type Settings = {
792
+ languages: string[];
793
+ }
794
+
795
+ const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
796
+ languages: [undefined]
797
+ };
798
+ ```
799
+
800
+ @see {@link PartialDeepOptions}
801
+
802
+ @category Object
803
+ @category Array
804
+ @category Set
805
+ @category Map
806
+ */
807
+ export type PartialDeep<T, Options extends PartialDeepOptions = {}> = _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
808
+ /**
809
+ @see {@link PartialDeep}
810
+ */
811
+ export type PartialDeepOptions = {
812
+ /**
813
+ Whether to affect the individual elements of arrays and tuples.
814
+
815
+ @default false
816
+ */
817
+ readonly recurseIntoArrays?: boolean;
818
+ /**
819
+ Allows `undefined` values in non-tuple arrays.
820
+
821
+ - When set to `true`, elements of non-tuple arrays can be `undefined`.
822
+ - When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
823
+
824
+ @default true
825
+
826
+ @example
827
+ You can prevent `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}` as the second type argument:
828
+
829
+ ```
830
+ import type {PartialDeep} from 'type-fest';
831
+
832
+ type Settings = {
833
+ languages: string[];
834
+ };
835
+
836
+ declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}>;
837
+
838
+ partialSettings.languages = [undefined]; // Error
839
+ partialSettings.languages = []; // Ok
840
+ ```
841
+ */
842
+ readonly allowUndefinedInNonTupleArrays?: boolean;
843
+ };
844
+ /**
845
+ Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
846
+ */
847
+ export type PartialMapDeep<KeyType, ValueType, Options extends Required<PartialDeepOptions>> = {} & Map<_PartialDeep<KeyType, Options>, _PartialDeep<ValueType, Options>>;
848
+ /**
849
+ Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
850
+ */
851
+ export type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = (ObjectType extends (...arguments_: any) => unknown ? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType> : {}) & ({
852
+ [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>;
853
+ });
854
+ /**
855
+ Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
856
+ */
857
+ export type PartialReadonlyMapDeep<KeyType, ValueType, Options extends Required<PartialDeepOptions>> = {} & ReadonlyMap<_PartialDeep<KeyType, Options>, _PartialDeep<ValueType, Options>>;
858
+ /**
859
+ Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
860
+ */
861
+ export type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {} & ReadonlySet<_PartialDeep<T, Options>>;
862
+ /**
863
+ Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
864
+ */
865
+ export type PartialSetDeep<T, Options extends Required<PartialDeepOptions>> = {} & Set<_PartialDeep<T, Options>>;
866
+ /**
867
+ Pick only index signatures from the given object type, leaving out all explicitly defined properties.
868
+
869
+ This is the counterpart of `OmitIndexSignature`.
870
+
871
+ @example
872
+ ```
873
+ import type {PickIndexSignature} from 'type-fest';
874
+
875
+ declare const symbolKey: unique symbol;
876
+
877
+ type Example = {
878
+ // These index signatures will remain.
879
+ [x: string]: unknown;
880
+ [x: number]: unknown;
881
+ [x: symbol]: unknown;
882
+ [x: `head-${string}`]: string;
883
+ [x: `${string}-tail`]: string;
884
+ [x: `head-${string}-tail`]: string;
885
+ [x: `${bigint}`]: string;
886
+ [x: `embedded-${number}`]: string;
887
+
888
+ // These explicitly defined keys will be removed.
889
+ ['kebab-case-key']: string;
890
+ [symbolKey]: string;
891
+ foo: 'bar';
892
+ qux?: 'baz';
893
+ };
894
+
895
+ type ExampleIndexSignature = PickIndexSignature<Example>;
896
+ // {
897
+ // [x: string]: unknown;
898
+ // [x: number]: unknown;
899
+ // [x: symbol]: unknown;
900
+ // [x: `head-${string}`]: string;
901
+ // [x: `${string}-tail`]: string;
902
+ // [x: `head-${string}-tail`]: string;
903
+ // [x: `${bigint}`]: string;
904
+ // [x: `embedded-${number}`]: string;
905
+ // }
906
+ ```
907
+
908
+ @see OmitIndexSignature
909
+ @category Object
910
+ */
911
+ export type PickIndexSignature<ObjectType> = {
912
+ [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType];
913
+ };
914
+ /**
915
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
916
+
917
+ @category Type
918
+ */
919
+ export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
920
+ /**
921
+ Extract all required keys from the given type.
922
+
923
+ This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
924
+
925
+ @example
926
+ ```
927
+ import type {RequiredKeysOf} from 'type-fest';
928
+
929
+ declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
930
+
931
+ interface User {
932
+ name: string;
933
+ surname: string;
934
+
935
+ luckyNumber?: number;
936
+ }
937
+
938
+ const validator1 = createValidation<User>('name', value => value.length < 25);
939
+ const validator2 = createValidation<User>('surname', value => value.length < 25);
940
+ ```
941
+
942
+ @category Utilities
943
+ */
944
+ export type RequiredKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
945
+ ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never; // Should never happen
946
+ // Merges two objects without worrying about index signatures.
947
+ export type SimpleMerge<Destination, Source> = {
948
+ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
949
+ } & Source;
950
+ /**
951
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
952
+
953
+ @example
954
+ ```
955
+ import type {Simplify} from 'type-fest';
956
+
957
+ type PositionProps = {
958
+ top: number;
959
+ left: number;
960
+ };
961
+
962
+ type SizeProps = {
963
+ width: number;
964
+ height: number;
965
+ };
966
+
967
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
968
+ type Props = Simplify<PositionProps & SizeProps>;
969
+ ```
970
+
971
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
972
+
973
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
974
+
975
+ @example
976
+ ```
977
+ import type {Simplify} from 'type-fest';
978
+
979
+ interface SomeInterface {
980
+ foo: number;
981
+ bar?: string;
982
+ baz: number | undefined;
983
+ }
984
+
985
+ type SomeType = {
986
+ foo: number;
987
+ bar?: string;
988
+ baz: number | undefined;
989
+ };
990
+
991
+ const literal = {foo: 123, bar: 'hello', baz: 456};
992
+ const someType: SomeType = literal;
993
+ const someInterface: SomeInterface = literal;
994
+
995
+ function fn(object: Record<string, unknown>): void {}
996
+
997
+ fn(literal); // Good: literal object type is sealed
998
+ fn(someType); // Good: type is sealed
999
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
1000
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
1001
+ ```
1002
+
1003
+ @link https://github.com/microsoft/TypeScript/issues/15300
1004
+ @see SimplifyDeep
1005
+ @category Object
1006
+ */
1007
+ export type Simplify<T> = {
1008
+ [KeyType in keyof T]: T[KeyType];
1009
+ } & {};
1010
+ export type TaskNode = z.infer<typeof TaskNode>;
1011
+ export type TyProfile = z.infer<typeof TyProfile>;
1012
+ export type WithRequired<T, K extends keyof T> = Omit<T, K> & {
1013
+ [P in K]-?: Exclude<T[P], undefined>;
1014
+ };
1015
+ export type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : IsNever<keyof T> extends true // For functions with no properties
1016
+ ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
1017
+ ? Options["recurseIntoArrays"] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
1018
+ ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
1019
+ ? ReadonlyArray<_PartialDeep<Options["allowUndefinedInNonTupleArrays"] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep<Options["allowUndefinedInNonTupleArrays"] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep<T, Options> // Tuples behave properly
1020
+ : T // If they don't opt into array testing, just use the original type
1021
+ : PartialObjectDeep<T, Options> : unknown;
1022
+ export type partialTaskDraft = z.infer<typeof partialTaskDraft>;
1023
+ export type partialTyConfiguration = PartialDeep<TyProfile>;
1024
+ export type taskResult = z.infer<typeof taskResult>;
1025
+ /**
1026
+ * Represents the context passed to tools within the Taskyon system.
1027
+ *
1028
+ * @property taskChain - The sequence of TaskNode objects representing the current chain of tasks.
1029
+ * @property getSecret - Retrieves a secret value by name. If `askNew` is `true`, prompts for a new secret if it doesn't exist.
1030
+ * If `askNew` is a string, uses the string as a custom message or hint when prompting for the secret.
1031
+ * @param name - The name of the secret to retrieve.
1032
+ * @param askNew - If `true`, prompts for a new secret if not found. If a string, uses it as a hint or message when prompting.
1033
+ * @returns A promise resolving to the secret value, or `undefined` if not found.
1034
+ *
1035
+ * @property setSecret - Stores a secret value by name.
1036
+ * @param name - The name of the secret to store.
1037
+ * @param value - The secret value to store.
1038
+ * @returns A promise that resolves when the secret is stored.
1039
+ * @property stopSignal - An AbortSignal that can be used to detect if the tool should stop execution.
1040
+ * @property toolId - The unique identifier for the tool instance.
1041
+ */
1042
+ export type toolContext = {
1043
+ taskChain: TaskNode[];
1044
+ getSecret: (name: string, askNew: boolean | string, saveNew?: boolean) => Promise<string | null>;
1045
+ setSecret: (name: string, value: string) => Promise<void>;
1046
+ stopSignal: AbortSignal;
1047
+ toolId: string;
1048
+ messagePort?: MessagePort;
1049
+ };
1050
+ type InternalTool$1 = z.infer<typeof InternalTool>;
1051
+ type NoInfer$1<T> = T extends infer U ? U : never;
1052
+
1053
+ export {};