@taskyon/tyclient 0.4.5 → 0.5.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.
@@ -1,1027 +1,233 @@
1
- import z from 'zod';
2
- import { z } from 'zod';
1
+ import * as json_schema from 'json-schema';
2
+ import { JSONSchema7 } from 'json-schema';
3
+ import { JSONSchema, FromSchema } from 'json-schema-to-ts';
4
+ import z, { z as z$1 } from 'zod';
5
+ import { PartialDeep } from 'type-fest';
6
+ import { PGliteWorker } from '@electric-sql/pglite/worker';
7
+ import { LiveNamespace } from '@electric-sql/pglite/live';
3
8
 
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
9
  /**
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;
10
+ * Functional Reactive Programming (FRP) Bus
11
+ * A simple implementation of an FRP bus using streams and operators.
12
+ * This is a basic implementation and can be extended with more operators as needed.
13
+ */
14
+ type Observer<T> = (value: T) => void | Promise<void>;
15
+ type Unsubscribe = () => void;
16
+ interface Stream<T> {
17
+ (observer: Observer<T>): Unsubscribe;
18
+ unsubscribeAll(this: void): void;
19
+ filter(this: void, predicate: (value: T) => boolean): Stream<T>;
20
+ narrow<U extends T>(this: void, predicate: (value: T) => value is U): Stream<U>;
21
+ map<V>(this: void, fn: (value: T) => V): Stream<V>;
22
+ wait(this: void, opts: {
23
+ timeoutMs?: number;
24
+ signal?: AbortSignal;
25
+ }): Promise<T>;
734
26
  }
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
27
+ type frpBus<T> = {
28
+ stream: Stream<T>;
29
+ emit: <U extends T>(value: U) => void;
777
30
  };
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';
31
+ type Port<Tx, Rx = Tx> = {
32
+ send: frpBus<Tx>['emit'];
33
+ receive: frpBus<Rx>['stream'];
34
+ connect: <Tx, Rx extends oTx, oTx, oRx extends Tx>(this: Port<Tx, Rx>, other: Port<oTx, oRx>) => Unsubscribe;
893
35
  };
894
36
 
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];
37
+ type Expand<T> = T extends infer U ? {
38
+ [K in keyof U]: U[K];
39
+ } : never;
40
+ type WithRequired<T, K extends keyof T> = Omit<T, K> & {
41
+ [P in K]-?: Exclude<T[P], undefined>;
913
42
  };
914
43
  /**
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
- };
44
+ * Type representing a thunk: a function that takes no arguments and returns T.
45
+ */
46
+ type Thunk<T> = () => T;
961
47
 
962
- type SizeProps = {
963
- width: number;
964
- height: number;
48
+ declare const TaskNode: z.ZodObject<{
49
+ role: z.ZodEnum<{
50
+ function: "function";
51
+ system: "system";
52
+ user: "user";
53
+ assistant: "assistant";
54
+ }>;
55
+ name: z.ZodOptional<z.ZodString>;
56
+ content: z.ZodUnion<readonly [z.ZodObject<{
57
+ type: z.ZodLiteral<"message">;
58
+ data: z.ZodString;
59
+ ann: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
60
+ type: z.ZodLiteral<"url_citation">;
61
+ url_citation: z.ZodOptional<z.ZodObject<{
62
+ end_index: z.ZodOptional<z.ZodNumber>;
63
+ start_index: z.ZodOptional<z.ZodNumber>;
64
+ title: z.ZodOptional<z.ZodString>;
65
+ url: z.ZodOptional<z.ZodString>;
66
+ content: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strip>>;
68
+ }, z.core.$strip>, z.ZodObject<{
69
+ type: z.ZodLiteral<"file">;
70
+ content: z.ZodOptional<z.ZodArray<z.ZodObject<{
71
+ text: z.ZodString;
72
+ type: z.ZodString;
73
+ }, z.core.$strip>>>;
74
+ }, z.core.$strip>]>>>;
75
+ }, z.core.$strict>, z.ZodObject<{
76
+ type: z.ZodLiteral<"toolresult">;
77
+ data: z.ZodUnknown;
78
+ }, z.core.$strict>, z.ZodObject<{
79
+ type: z.ZodLiteral<"tooldefinition">;
80
+ data: z.ZodObject<{
81
+ description: z.ZodString;
82
+ longDescription: z.ZodOptional<z.ZodString>;
83
+ name: z.ZodString;
84
+ renderOptions: z.ZodOptional<z.ZodObject<{
85
+ hideChat: z.ZodOptional<z.ZodBoolean>;
86
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
87
+ }, z.core.$strip>>;
88
+ parameters: z.ZodReadonly<z.ZodType<json_schema.JSONSchema7, unknown, z.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
89
+ code: z.ZodOptional<z.ZodString>;
90
+ }, z.core.$strip>;
91
+ }, z.core.$strict>, z.ZodObject<{
92
+ type: z.ZodLiteral<"error">;
93
+ data: z.ZodUnknown;
94
+ }, z.core.$strict>, z.ZodObject<{
95
+ type: z.ZodLiteral<"structured">;
96
+ data: z.ZodUnknown;
97
+ }, z.core.$strict>, z.ZodObject<{
98
+ type: z.ZodLiteral<"functioncall">;
99
+ data: z.ZodObject<{
100
+ name: z.ZodString;
101
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>, z.ZodNull, z.ZodUndefined]>>;
102
+ }, z.core.$strip>;
103
+ }, z.core.$strict>, z.ZodObject<{
104
+ type: z.ZodLiteral<"files">;
105
+ data: z.ZodArray<z.ZodString>;
106
+ }, z.core.$strict>, z.ZodObject<{
107
+ type: z.ZodLiteral<"return">;
108
+ data: z.ZodString;
109
+ }, z.core.$strict>]>;
110
+ label: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
+ parentID: z.ZodOptional<z.ZodString>;
112
+ priorID: z.ZodOptional<z.ZodString>;
113
+ id: z.ZodString;
114
+ authorId: z.ZodOptional<z.ZodString>;
115
+ created_at: z.ZodOptional<z.ZodNumber>;
116
+ acl: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
+ sig: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strip>;
119
+ type TaskNode = z.infer<typeof TaskNode>;
120
+ declare const partialTaskDraft: z.ZodObject<{
121
+ role: z.ZodNonOptional<z.ZodOptional<z.ZodEnum<{
122
+ function: "function";
123
+ system: "system";
124
+ user: "user";
125
+ assistant: "assistant";
126
+ }>>>;
127
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
128
+ content: z.ZodNonOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
129
+ type: z.ZodLiteral<"message">;
130
+ data: z.ZodString;
131
+ ann: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
132
+ type: z.ZodLiteral<"url_citation">;
133
+ url_citation: z.ZodOptional<z.ZodObject<{
134
+ end_index: z.ZodOptional<z.ZodNumber>;
135
+ start_index: z.ZodOptional<z.ZodNumber>;
136
+ title: z.ZodOptional<z.ZodString>;
137
+ url: z.ZodOptional<z.ZodString>;
138
+ content: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$strip>>;
140
+ }, z.core.$strip>, z.ZodObject<{
141
+ type: z.ZodLiteral<"file">;
142
+ content: z.ZodOptional<z.ZodArray<z.ZodObject<{
143
+ text: z.ZodString;
144
+ type: z.ZodString;
145
+ }, z.core.$strip>>>;
146
+ }, z.core.$strip>]>>>;
147
+ }, z.core.$strict>, z.ZodObject<{
148
+ type: z.ZodLiteral<"toolresult">;
149
+ data: z.ZodUnknown;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ type: z.ZodLiteral<"tooldefinition">;
152
+ data: z.ZodObject<{
153
+ description: z.ZodString;
154
+ longDescription: z.ZodOptional<z.ZodString>;
155
+ name: z.ZodString;
156
+ renderOptions: z.ZodOptional<z.ZodObject<{
157
+ hideChat: z.ZodOptional<z.ZodBoolean>;
158
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
159
+ }, z.core.$strip>>;
160
+ parameters: z.ZodReadonly<z.ZodType<json_schema.JSONSchema7, unknown, z.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
161
+ code: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strip>;
163
+ }, z.core.$strict>, z.ZodObject<{
164
+ type: z.ZodLiteral<"error">;
165
+ data: z.ZodUnknown;
166
+ }, z.core.$strict>, z.ZodObject<{
167
+ type: z.ZodLiteral<"structured">;
168
+ data: z.ZodUnknown;
169
+ }, z.core.$strict>, z.ZodObject<{
170
+ type: z.ZodLiteral<"functioncall">;
171
+ data: z.ZodObject<{
172
+ name: z.ZodString;
173
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>, z.ZodNull, z.ZodUndefined]>>;
174
+ }, z.core.$strip>;
175
+ }, z.core.$strict>, z.ZodObject<{
176
+ type: z.ZodLiteral<"files">;
177
+ data: z.ZodArray<z.ZodString>;
178
+ }, z.core.$strict>, z.ZodObject<{
179
+ type: z.ZodLiteral<"return">;
180
+ data: z.ZodString;
181
+ }, z.core.$strict>]>>>;
182
+ label: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
183
+ parentID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
184
+ priorID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
185
+ id: z.ZodOptional<z.ZodString>;
186
+ authorId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
187
+ created_at: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
188
+ acl: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
189
+ sig: z.ZodOptional<z.ZodOptional<z.ZodString>>;
190
+ }, z.core.$strip>;
191
+ type partialTaskDraft = z.infer<typeof partialTaskDraft>;
192
+ type TaskNodeType<K extends TaskNode['content']['type']> = TaskNode extends {
193
+ content: infer C;
194
+ } ? C extends {
195
+ type: K;
196
+ } ? Expand<Omit<TaskNode, 'content'> & {
197
+ content: C;
198
+ }> : never : never;
199
+ type FileMapping = {
200
+ id: string;
201
+ name?: string;
202
+ size?: number;
203
+ opfs?: string;
204
+ openAIFileId?: string;
205
+ type: string;
206
+ data?: string;
965
207
  };
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;
208
+ interface TaskTreeNode {
209
+ task: TaskNode;
210
+ children: TaskTreeNode[][];
983
211
  }
984
212
 
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
- ```
213
+ declare const FunctionCall: z.ZodObject<{
214
+ name: z.ZodString;
215
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>, z.ZodNull, z.ZodUndefined]>>;
216
+ }, z.core.$strip>;
217
+ type FunctionCall = z.infer<typeof FunctionCall>;
218
+ declare const ToolBase: z.ZodObject<{
219
+ description: z.ZodString;
220
+ longDescription: z.ZodOptional<z.ZodString>;
221
+ name: z.ZodString;
222
+ renderOptions: z.ZodOptional<z.ZodObject<{
223
+ hideChat: z.ZodOptional<z.ZodBoolean>;
224
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
225
+ }, z.core.$strip>>;
226
+ parameters: z.ZodReadonly<z.ZodType<json_schema.JSONSchema7, unknown, z.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
227
+ code: z.ZodOptional<z.ZodString>;
228
+ }, z.core.$strip>;
229
+ type ToolBase = z.infer<typeof ToolBase>;
1002
230
 
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
231
  /**
1026
232
  * Represents the context passed to tools within the Taskyon system.
1027
233
  *
@@ -1039,15 +245,1949 @@ export type taskResult = z.infer<typeof taskResult>;
1039
245
  * @property stopSignal - An AbortSignal that can be used to detect if the tool should stop execution.
1040
246
  * @property toolId - The unique identifier for the tool instance.
1041
247
  */
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;
248
+ type toolContext = {
249
+ taskChain: TaskNode[];
250
+ getSecret: (name: string, askNew: boolean | string, saveNew?: boolean) => Promise<string | null>;
251
+ setSecret: (name: string, value: string) => Promise<void>;
252
+ stopSignal: AbortSignal;
253
+ toolId: string;
254
+ messagePort?: MessagePort;
1049
255
  };
1050
- type InternalTool$1 = z.infer<typeof InternalTool>;
1051
- type NoInfer$1<T> = T extends infer U ? U : never;
256
+ declare const InternalTool: z.ZodObject<{
257
+ description: z.ZodString;
258
+ longDescription: z.ZodOptional<z.ZodString>;
259
+ name: z.ZodString;
260
+ renderOptions: z.ZodOptional<z.ZodObject<{
261
+ hideChat: z.ZodOptional<z.ZodBoolean>;
262
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
263
+ }, z.core.$strip>>;
264
+ parameters: z.ZodReadonly<z.ZodType<json_schema.JSONSchema7, unknown, z.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
265
+ code: z.ZodOptional<z.ZodString>;
266
+ function: z.ZodOptional<z.ZodCustom<(params: any, context: toolContext) => unknown, (params: any, context: toolContext) => unknown>>;
267
+ }, z.core.$strip>;
268
+ type InternalTool = z.infer<typeof InternalTool>;
269
+ type ClientTool = WithRequired<InternalTool, 'function'>;
270
+ declare function createTool<T, SCHEMA extends Readonly<JSONSchema>, PARAMS = FromSchema<SCHEMA>>(tool: T & {
271
+ parameters: SCHEMA;
272
+ function?: (params: PARAMS, context: toolContext) => unknown;
273
+ } & Omit<InternalTool, 'function' | 'parameters'>): T;
274
+ declare function toolCall<T extends FunctionCall['arguments']>(f: {
275
+ arguments: T;
276
+ } & FunctionCall): partialTaskDraft & {
277
+ content: {
278
+ type: 'functioncall';
279
+ data: FunctionCall;
280
+ };
281
+ };
282
+ declare const taskResult: z.ZodObject<{
283
+ taskResultMarker: z.ZodDefault<z.ZodLiteral<"*TY_TASKRESULT*">>;
284
+ taskChainList: z.ZodArray<z.ZodArray<z.ZodObject<{
285
+ role: z.ZodNonOptional<z.ZodOptional<z.ZodEnum<{
286
+ function: "function";
287
+ system: "system";
288
+ user: "user";
289
+ assistant: "assistant";
290
+ }>>>;
291
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
292
+ content: z.ZodNonOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
293
+ type: z.ZodLiteral<"message">;
294
+ data: z.ZodString;
295
+ ann: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
296
+ type: z.ZodLiteral<"url_citation">;
297
+ url_citation: z.ZodOptional<z.ZodObject<{
298
+ end_index: z.ZodOptional<z.ZodNumber>;
299
+ start_index: z.ZodOptional<z.ZodNumber>;
300
+ title: z.ZodOptional<z.ZodString>;
301
+ url: z.ZodOptional<z.ZodString>;
302
+ content: z.ZodOptional<z.ZodString>;
303
+ }, z.core.$strip>>;
304
+ }, z.core.$strip>, z.ZodObject<{
305
+ type: z.ZodLiteral<"file">;
306
+ content: z.ZodOptional<z.ZodArray<z.ZodObject<{
307
+ text: z.ZodString;
308
+ type: z.ZodString;
309
+ }, z.core.$strip>>>;
310
+ }, z.core.$strip>]>>>;
311
+ }, z.core.$strict>, z.ZodObject<{
312
+ type: z.ZodLiteral<"toolresult">;
313
+ data: z.ZodUnknown;
314
+ }, z.core.$strict>, z.ZodObject<{
315
+ type: z.ZodLiteral<"tooldefinition">;
316
+ data: z.ZodObject<{
317
+ description: z.ZodString;
318
+ longDescription: z.ZodOptional<z.ZodString>;
319
+ name: z.ZodString;
320
+ renderOptions: z.ZodOptional<z.ZodObject<{
321
+ hideChat: z.ZodOptional<z.ZodBoolean>;
322
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
323
+ }, z.core.$strip>>;
324
+ parameters: z.ZodReadonly<z.ZodType<json_schema.JSONSchema7, unknown, z.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
325
+ code: z.ZodOptional<z.ZodString>;
326
+ }, z.core.$strip>;
327
+ }, z.core.$strict>, z.ZodObject<{
328
+ type: z.ZodLiteral<"error">;
329
+ data: z.ZodUnknown;
330
+ }, z.core.$strict>, z.ZodObject<{
331
+ type: z.ZodLiteral<"structured">;
332
+ data: z.ZodUnknown;
333
+ }, z.core.$strict>, z.ZodObject<{
334
+ type: z.ZodLiteral<"functioncall">;
335
+ data: z.ZodObject<{
336
+ name: z.ZodString;
337
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>, z.ZodNull, z.ZodUndefined]>>;
338
+ }, z.core.$strip>;
339
+ }, z.core.$strict>, z.ZodObject<{
340
+ type: z.ZodLiteral<"files">;
341
+ data: z.ZodArray<z.ZodString>;
342
+ }, z.core.$strict>, z.ZodObject<{
343
+ type: z.ZodLiteral<"return">;
344
+ data: z.ZodString;
345
+ }, z.core.$strict>]>>>;
346
+ label: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
347
+ parentID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
348
+ priorID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
349
+ id: z.ZodOptional<z.ZodString>;
350
+ authorId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
351
+ created_at: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
352
+ acl: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
353
+ sig: z.ZodOptional<z.ZodOptional<z.ZodString>>;
354
+ }, z.core.$strip>>>;
355
+ }, z.core.$strip>;
356
+ type taskResult = z.infer<typeof taskResult>;
357
+ declare function makeTaskResult(tasks: partialTaskDraft | partialTaskDraft[] | partialTaskDraft[][]): taskResult;
1052
358
 
1053
- export {};
359
+ type TyPGDB = PGliteWorker & {
360
+ live: LiveNamespace;
361
+ } & {
362
+ name?: string;
363
+ };
364
+
365
+ declare function useTyTaskManager(taskyonDb: TyPGDB, vectorizerModel?: string): Promise<{
366
+ getTaskIdChain: (taskId: string, maxFollow?: number, untilTaskID?: string | undefined, onlyFirstChild?: boolean) => Promise<string[]>;
367
+ getTaskChain: (taskId: string) => Promise<TaskNode[]>;
368
+ convertTaskIDs: (taskIds: string[]) => Promise<{
369
+ role: "function" | "system" | "user" | "assistant";
370
+ content: {
371
+ type: "message";
372
+ data: string;
373
+ ann?: ({
374
+ type: "url_citation";
375
+ url_citation?: {
376
+ end_index?: number | undefined;
377
+ start_index?: number | undefined;
378
+ title?: string | undefined;
379
+ url?: string | undefined;
380
+ content?: string | undefined;
381
+ } | undefined;
382
+ } | {
383
+ type: "file";
384
+ content?: {
385
+ text: string;
386
+ type: string;
387
+ }[] | undefined;
388
+ })[] | undefined;
389
+ } | {
390
+ type: "toolresult";
391
+ data: unknown;
392
+ } | {
393
+ type: "tooldefinition";
394
+ data: {
395
+ description: string;
396
+ name: string;
397
+ parameters: Readonly<json_schema.JSONSchema7>;
398
+ longDescription?: string | undefined;
399
+ renderOptions?: {
400
+ hideChat?: boolean | undefined;
401
+ hideLlm?: boolean | undefined;
402
+ } | undefined;
403
+ code?: string | undefined;
404
+ };
405
+ } | {
406
+ type: "error";
407
+ data: unknown;
408
+ } | {
409
+ type: "structured";
410
+ data: unknown;
411
+ } | {
412
+ type: "functioncall";
413
+ data: {
414
+ name: string;
415
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
416
+ };
417
+ } | {
418
+ type: "files";
419
+ data: string[];
420
+ } | {
421
+ type: "return";
422
+ data: string;
423
+ };
424
+ id: string;
425
+ name?: string | undefined;
426
+ label?: string[] | undefined;
427
+ parentID?: string | undefined;
428
+ priorID?: string | undefined;
429
+ authorId?: string | undefined;
430
+ created_at?: number | undefined;
431
+ acl?: string[] | undefined;
432
+ sig?: string | undefined;
433
+ }[]>;
434
+ buildSiblingChain: (taskId: string, maxDepth: number) => Promise<TaskTreeNode[]>;
435
+ buildTaskTreeNode: (taskId: string, maxDepth: number) => Promise<TaskTreeNode>;
436
+ addPartialTask2Tree: (task: partialTaskDraft) => Promise<{
437
+ role: "function" | "system" | "user" | "assistant";
438
+ content: {
439
+ type: "message";
440
+ data: string;
441
+ ann?: ({
442
+ type: "url_citation";
443
+ url_citation?: {
444
+ end_index?: number | undefined;
445
+ start_index?: number | undefined;
446
+ title?: string | undefined;
447
+ url?: string | undefined;
448
+ content?: string | undefined;
449
+ } | undefined;
450
+ } | {
451
+ type: "file";
452
+ content?: {
453
+ text: string;
454
+ type: string;
455
+ }[] | undefined;
456
+ })[] | undefined;
457
+ } | {
458
+ type: "toolresult";
459
+ data: unknown;
460
+ } | {
461
+ type: "tooldefinition";
462
+ data: {
463
+ description: string;
464
+ name: string;
465
+ parameters: Readonly<json_schema.JSONSchema7>;
466
+ longDescription?: string | undefined;
467
+ renderOptions?: {
468
+ hideChat?: boolean | undefined;
469
+ hideLlm?: boolean | undefined;
470
+ } | undefined;
471
+ code?: string | undefined;
472
+ };
473
+ } | {
474
+ type: "error";
475
+ data: unknown;
476
+ } | {
477
+ type: "structured";
478
+ data: unknown;
479
+ } | {
480
+ type: "functioncall";
481
+ data: {
482
+ name: string;
483
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
484
+ };
485
+ } | {
486
+ type: "files";
487
+ data: string[];
488
+ } | {
489
+ type: "return";
490
+ data: string;
491
+ };
492
+ id: string;
493
+ name?: string | undefined;
494
+ label?: string[] | undefined;
495
+ parentID?: string | undefined;
496
+ priorID?: string | undefined;
497
+ authorId?: string | undefined;
498
+ created_at?: number | undefined;
499
+ acl?: string[] | undefined;
500
+ sig?: string | undefined;
501
+ }>;
502
+ addTaskChain: (taskList: partialTaskDraft[], priorID?: string | undefined, parentID?: string | undefined) => Promise<{
503
+ role: "function" | "system" | "user" | "assistant";
504
+ content: {
505
+ type: "message";
506
+ data: string;
507
+ ann?: ({
508
+ type: "url_citation";
509
+ url_citation?: {
510
+ end_index?: number | undefined;
511
+ start_index?: number | undefined;
512
+ title?: string | undefined;
513
+ url?: string | undefined;
514
+ content?: string | undefined;
515
+ } | undefined;
516
+ } | {
517
+ type: "file";
518
+ content?: {
519
+ text: string;
520
+ type: string;
521
+ }[] | undefined;
522
+ })[] | undefined;
523
+ } | {
524
+ type: "toolresult";
525
+ data: unknown;
526
+ } | {
527
+ type: "tooldefinition";
528
+ data: {
529
+ description: string;
530
+ name: string;
531
+ parameters: Readonly<json_schema.JSONSchema7>;
532
+ longDescription?: string | undefined;
533
+ renderOptions?: {
534
+ hideChat?: boolean | undefined;
535
+ hideLlm?: boolean | undefined;
536
+ } | undefined;
537
+ code?: string | undefined;
538
+ };
539
+ } | {
540
+ type: "error";
541
+ data: unknown;
542
+ } | {
543
+ type: "structured";
544
+ data: unknown;
545
+ } | {
546
+ type: "functioncall";
547
+ data: {
548
+ name: string;
549
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
550
+ };
551
+ } | {
552
+ type: "files";
553
+ data: string[];
554
+ } | {
555
+ type: "return";
556
+ data: string;
557
+ };
558
+ id: string;
559
+ name?: string | undefined;
560
+ label?: string[] | undefined;
561
+ parentID?: string | undefined;
562
+ priorID?: string | undefined;
563
+ authorId?: string | undefined;
564
+ created_at?: number | undefined;
565
+ acl?: string[] | undefined;
566
+ sig?: string | undefined;
567
+ }[]>;
568
+ addMdTaskChain: (markdown?: string) => Promise<string | undefined>;
569
+ getMeta: (id: string | number) => Promise<{
570
+ threadMessage?: any;
571
+ promptTokens?: number | undefined;
572
+ resultTokens?: number | undefined;
573
+ taskTokens?: number | undefined;
574
+ name?: string | undefined;
575
+ summary?: string | undefined;
576
+ estimatedTokens?: {
577
+ resultTokens?: number | undefined;
578
+ taskCosts?: number | undefined;
579
+ functionTokens?: number | undefined;
580
+ promptTokens?: number | undefined;
581
+ singlePromptTokens?: number | undefined;
582
+ } | undefined;
583
+ toolStreamArgsContent?: Record<string, string> | undefined;
584
+ streamContent?: string | undefined;
585
+ taskCosts?: number | undefined;
586
+ rawOutput?: unknown;
587
+ error?: unknown;
588
+ taskPrompt?: Record<string, unknown> | undefined;
589
+ } | null>;
590
+ metaLiveRead: (id: string | number) => Stream<{
591
+ id: string | number;
592
+ data: {
593
+ threadMessage?: any;
594
+ promptTokens?: number | undefined;
595
+ resultTokens?: number | undefined;
596
+ taskTokens?: number | undefined;
597
+ name?: string | undefined;
598
+ summary?: string | undefined;
599
+ estimatedTokens?: {
600
+ resultTokens?: number | undefined;
601
+ taskCosts?: number | undefined;
602
+ functionTokens?: number | undefined;
603
+ promptTokens?: number | undefined;
604
+ singlePromptTokens?: number | undefined;
605
+ } | undefined;
606
+ toolStreamArgsContent?: Record<string, string> | undefined;
607
+ streamContent?: string | undefined;
608
+ taskCosts?: number | undefined;
609
+ rawOutput?: unknown;
610
+ error?: unknown;
611
+ taskPrompt?: Record<string, unknown> | undefined;
612
+ } | null;
613
+ }>;
614
+ metaUpsert: (id: string | number, data: {
615
+ threadMessage?: any;
616
+ promptTokens?: number | undefined;
617
+ resultTokens?: number | undefined;
618
+ taskTokens?: number | undefined;
619
+ name?: string | undefined;
620
+ summary?: string | undefined;
621
+ estimatedTokens?: {
622
+ resultTokens?: number | undefined;
623
+ taskCosts?: number | undefined;
624
+ functionTokens?: number | undefined;
625
+ promptTokens?: number | undefined;
626
+ singlePromptTokens?: number | undefined;
627
+ } | undefined;
628
+ toolStreamArgsContent?: Record<string, string> | undefined;
629
+ streamContent?: string | undefined;
630
+ taskCosts?: number | undefined;
631
+ rawOutput?: unknown;
632
+ error?: unknown;
633
+ taskPrompt?: Record<string, unknown> | undefined;
634
+ }, strategy?: "shallow_merge" | "replace" | "deepmerge" | "native_shallow") => Promise<{
635
+ threadMessage?: any;
636
+ promptTokens?: number | undefined;
637
+ resultTokens?: number | undefined;
638
+ taskTokens?: number | undefined;
639
+ name?: string | undefined;
640
+ summary?: string | undefined;
641
+ estimatedTokens?: {
642
+ resultTokens?: number | undefined;
643
+ taskCosts?: number | undefined;
644
+ functionTokens?: number | undefined;
645
+ promptTokens?: number | undefined;
646
+ singlePromptTokens?: number | undefined;
647
+ } | undefined;
648
+ toolStreamArgsContent?: Record<string, string> | undefined;
649
+ streamContent?: string | undefined;
650
+ taskCosts?: number | undefined;
651
+ rawOutput?: unknown;
652
+ error?: unknown;
653
+ taskPrompt?: Record<string, unknown> | undefined;
654
+ }>;
655
+ addFiles: (newFiles: File[], storage: "memory" | "opfs") => Promise<string[]>;
656
+ searchFiles: (where: {
657
+ id?: string;
658
+ name?: string;
659
+ size?: number;
660
+ opfs?: string;
661
+ openAIFileId?: string;
662
+ type?: string;
663
+ data?: string;
664
+ }, opts?: {
665
+ allowedIDs?: (string | number)[];
666
+ limit?: number;
667
+ offset?: number;
668
+ orderBy?: {
669
+ kind: "id";
670
+ } | {
671
+ kind: "dataKey";
672
+ key: "name" | "type" | "id" | "data" | "size" | "opfs" | "openAIFileId";
673
+ };
674
+ orderDir?: "asc" | "desc";
675
+ } | undefined) => Promise<Record<string, FileMapping>>;
676
+ getFileMappingByUuid: (uuid: string) => Promise<FileMapping | null>;
677
+ getUploadedFile: (id: string) => Promise<File | undefined>;
678
+ getFileByName: (name: string) => Promise<File>;
679
+ addDefaultTools: (defaultTools: InternalTool[]) => void;
680
+ getToolDefinition: (name: string) => Promise<{
681
+ def?: TaskNodeType<"tooldefinition"> | undefined;
682
+ tool?: InternalTool;
683
+ }>;
684
+ getTask: (id: string | number) => Promise<{
685
+ role: "function" | "system" | "user" | "assistant";
686
+ content: {
687
+ type: "message";
688
+ data: string;
689
+ ann?: ({
690
+ type: "url_citation";
691
+ url_citation?: {
692
+ end_index?: number | undefined;
693
+ start_index?: number | undefined;
694
+ title?: string | undefined;
695
+ url?: string | undefined;
696
+ content?: string | undefined;
697
+ } | undefined;
698
+ } | {
699
+ type: "file";
700
+ content?: {
701
+ text: string;
702
+ type: string;
703
+ }[] | undefined;
704
+ })[] | undefined;
705
+ } | {
706
+ type: "toolresult";
707
+ data: unknown;
708
+ } | {
709
+ type: "tooldefinition";
710
+ data: {
711
+ description: string;
712
+ name: string;
713
+ parameters: Readonly<json_schema.JSONSchema7>;
714
+ longDescription?: string | undefined;
715
+ renderOptions?: {
716
+ hideChat?: boolean | undefined;
717
+ hideLlm?: boolean | undefined;
718
+ } | undefined;
719
+ code?: string | undefined;
720
+ };
721
+ } | {
722
+ type: "error";
723
+ data: unknown;
724
+ } | {
725
+ type: "structured";
726
+ data: unknown;
727
+ } | {
728
+ type: "functioncall";
729
+ data: {
730
+ name: string;
731
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
732
+ };
733
+ } | {
734
+ type: "files";
735
+ data: string[];
736
+ } | {
737
+ type: "return";
738
+ data: string;
739
+ };
740
+ id: string;
741
+ name?: string | undefined;
742
+ label?: string[] | undefined;
743
+ parentID?: string | undefined;
744
+ priorID?: string | undefined;
745
+ authorId?: string | undefined;
746
+ created_at?: number | undefined;
747
+ acl?: string[] | undefined;
748
+ sig?: string | undefined;
749
+ } | null>;
750
+ deleteTask: (id: string | number) => Promise<void>;
751
+ searchTasks: (where: PartialDeep<TaskNode>) => Promise<Record<string, TaskNode>>;
752
+ taskStream: Stream<{
753
+ id: string | number;
754
+ data: {
755
+ role: "function" | "system" | "user" | "assistant";
756
+ content: {
757
+ type: "message";
758
+ data: string;
759
+ ann?: ({
760
+ type: "url_citation";
761
+ url_citation?: {
762
+ end_index?: number | undefined;
763
+ start_index?: number | undefined;
764
+ title?: string | undefined;
765
+ url?: string | undefined;
766
+ content?: string | undefined;
767
+ } | undefined;
768
+ } | {
769
+ type: "file";
770
+ content?: {
771
+ text: string;
772
+ type: string;
773
+ }[] | undefined;
774
+ })[] | undefined;
775
+ } | {
776
+ type: "toolresult";
777
+ data: unknown;
778
+ } | {
779
+ type: "tooldefinition";
780
+ data: {
781
+ description: string;
782
+ name: string;
783
+ parameters: Readonly<json_schema.JSONSchema7>;
784
+ longDescription?: string | undefined;
785
+ renderOptions?: {
786
+ hideChat?: boolean | undefined;
787
+ hideLlm?: boolean | undefined;
788
+ } | undefined;
789
+ code?: string | undefined;
790
+ };
791
+ } | {
792
+ type: "error";
793
+ data: unknown;
794
+ } | {
795
+ type: "structured";
796
+ data: unknown;
797
+ } | {
798
+ type: "functioncall";
799
+ data: {
800
+ name: string;
801
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
802
+ };
803
+ } | {
804
+ type: "files";
805
+ data: string[];
806
+ } | {
807
+ type: "return";
808
+ data: string;
809
+ };
810
+ id: string;
811
+ name?: string | undefined;
812
+ label?: string[] | undefined;
813
+ parentID?: string | undefined;
814
+ priorID?: string | undefined;
815
+ authorId?: string | undefined;
816
+ created_at?: number | undefined;
817
+ acl?: string[] | undefined;
818
+ sig?: string | undefined;
819
+ } | null;
820
+ }>;
821
+ updateToolDefinitions: <T extends boolean>(removeFunctionProperty?: T) => Promise<T extends true ? Record<string, ToolBase> : Record<string, ToolBase | InternalTool>>;
822
+ getJsonTaskBackup: () => Promise<string>;
823
+ addTaskBackup: (jsonObjString: string) => Promise<void>;
824
+ deleteAllTasks: () => Promise<void>;
825
+ deleteTaskThread: (leafId: string) => Promise<void>;
826
+ countTasks: () => Promise<number>;
827
+ syncVectorIndexWithTasks: (progressCallback: (done: number, total: number) => void) => Promise<void>;
828
+ resetTaskVectors: () => Promise<void>;
829
+ countVecs: () => Promise<number>;
830
+ filteredVectorSearch: (searchTerm: string, k?: number, taskTemplate?: PartialDeep<TaskNode>) => Promise<{
831
+ taskId: string;
832
+ distance: number;
833
+ }[]>;
834
+ findSiblingLeafTasks: (taskId: string) => Promise<string[]>;
835
+ searchNextSibling: (key: string) => Promise<Set<string>>;
836
+ searchAllDirectChildren: (key: string) => Promise<Set<string>>;
837
+ searchAllChildren: (key: string) => Promise<Set<string>>;
838
+ searchSimilarTasks: (task: Partial<TaskNode>, k?: number) => Promise<{
839
+ taskId: string;
840
+ distance: number;
841
+ }[]>;
842
+ filterSearch: (k?: number, taskTemplate?: PartialDeep<TaskNode>) => Promise<{
843
+ taskId: string;
844
+ distance: 0;
845
+ }[]>;
846
+ loadYamlConversation: (input: File | string) => Promise<string | undefined>;
847
+ }>;
848
+ type TyTaskManager = Awaited<ReturnType<typeof useTyTaskManager>>;
849
+
850
+ type ChatCompletionChunk = {
851
+ id: string;
852
+ object: 'chat.completion.chunk';
853
+ created: number;
854
+ model: string;
855
+ system_fingerprint?: string;
856
+ provider?: string;
857
+ choices: Array<{
858
+ index: number;
859
+ delta: {
860
+ role?: 'system' | 'user' | 'assistant' | 'tool' | 'developer';
861
+ content?: string | null;
862
+ refusal?: string | null;
863
+ tool_calls?: Array<{
864
+ index: number;
865
+ id?: string;
866
+ type?: 'function';
867
+ function?: {
868
+ name?: string;
869
+ arguments?: string;
870
+ };
871
+ }>;
872
+ reasoning?: string;
873
+ reasoning_details?: Array<{
874
+ type: string;
875
+ text: string;
876
+ format?: string;
877
+ index?: number;
878
+ }>;
879
+ annotations?: Array<{
880
+ type: 'url_citation';
881
+ url_citation: {
882
+ end_index?: number;
883
+ start_index?: number;
884
+ title: string;
885
+ url: string;
886
+ content: string;
887
+ };
888
+ }>;
889
+ };
890
+ finish_reason?: 'stop' | 'length' | 'content_filter' | 'tool_calls' | 'function_call' | null;
891
+ native_finish_reason?: string | null;
892
+ logprobs?: unknown;
893
+ }>;
894
+ };
895
+
896
+ declare const llmSettings: z.ZodObject<{
897
+ userId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
898
+ allowWebSearch: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
899
+ secretPublicKey: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
900
+ selectedTaskId: z.ZodOptional<z.ZodString>;
901
+ enableOpenAiTools: z.ZodDefault<z.ZodBoolean>;
902
+ selectedApi: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
903
+ llmApis: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
904
+ name: z.ZodString;
905
+ baseURL: z.ZodString;
906
+ defaultModel: z.ZodString;
907
+ selectedModel: z.ZodOptional<z.ZodString>;
908
+ models: z.ZodOptional<z.ZodObject<{
909
+ instruction: z.ZodOptional<z.ZodString>;
910
+ chat: z.ZodOptional<z.ZodString>;
911
+ free: z.ZodOptional<z.ZodString>;
912
+ }, z.core.$strip>>;
913
+ streamSupport: z.ZodBoolean;
914
+ defaultHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
915
+ routes: z.ZodObject<{
916
+ chatCompletion: z.ZodString;
917
+ models: z.ZodString;
918
+ }, z.core.$strip>;
919
+ }, z.core.$strip>>>;
920
+ siteUrl: z.ZodDefault<z.ZodString>;
921
+ summaryModel: z.ZodDefault<z.ZodString>;
922
+ vectorizationModel: z.ZodDefault<z.ZodString>;
923
+ maxAutonomousTasks: z.ZodDefault<z.ZodNumber>;
924
+ entryNode: z.ZodOptional<z.ZodObject<{
925
+ role: z.ZodNonOptional<z.ZodOptional<z.ZodEnum<{
926
+ function: "function";
927
+ system: "system";
928
+ user: "user";
929
+ assistant: "assistant";
930
+ }>>>;
931
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
932
+ content: z.ZodNonOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
933
+ type: z.ZodLiteral<"message">;
934
+ data: z.ZodString;
935
+ ann: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
936
+ type: z.ZodLiteral<"url_citation">;
937
+ url_citation: z.ZodOptional<z.ZodObject<{
938
+ end_index: z.ZodOptional<z.ZodNumber>;
939
+ start_index: z.ZodOptional<z.ZodNumber>;
940
+ title: z.ZodOptional<z.ZodString>;
941
+ url: z.ZodOptional<z.ZodString>;
942
+ content: z.ZodOptional<z.ZodString>;
943
+ }, z.core.$strip>>;
944
+ }, z.core.$strip>, z.ZodObject<{
945
+ type: z.ZodLiteral<"file">;
946
+ content: z.ZodOptional<z.ZodArray<z.ZodObject<{
947
+ text: z.ZodString;
948
+ type: z.ZodString;
949
+ }, z.core.$strip>>>;
950
+ }, z.core.$strip>]>>>;
951
+ }, z.core.$strict>, z.ZodObject<{
952
+ type: z.ZodLiteral<"toolresult">;
953
+ data: z.ZodUnknown;
954
+ }, z.core.$strict>, z.ZodObject<{
955
+ type: z.ZodLiteral<"tooldefinition">;
956
+ data: z.ZodObject<{
957
+ description: z.ZodString;
958
+ longDescription: z.ZodOptional<z.ZodString>;
959
+ name: z.ZodString;
960
+ renderOptions: z.ZodOptional<z.ZodObject<{
961
+ hideChat: z.ZodOptional<z.ZodBoolean>;
962
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
963
+ }, z.core.$strip>>;
964
+ parameters: z.ZodReadonly<z.ZodType<json_schema.JSONSchema7, unknown, z.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
965
+ code: z.ZodOptional<z.ZodString>;
966
+ }, z.core.$strip>;
967
+ }, z.core.$strict>, z.ZodObject<{
968
+ type: z.ZodLiteral<"error">;
969
+ data: z.ZodUnknown;
970
+ }, z.core.$strict>, z.ZodObject<{
971
+ type: z.ZodLiteral<"structured">;
972
+ data: z.ZodUnknown;
973
+ }, z.core.$strict>, z.ZodObject<{
974
+ type: z.ZodLiteral<"functioncall">;
975
+ data: z.ZodObject<{
976
+ name: z.ZodString;
977
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>, z.ZodNull, z.ZodUndefined]>>;
978
+ }, z.core.$strip>;
979
+ }, z.core.$strict>, z.ZodObject<{
980
+ type: z.ZodLiteral<"files">;
981
+ data: z.ZodArray<z.ZodString>;
982
+ }, z.core.$strict>, z.ZodObject<{
983
+ type: z.ZodLiteral<"return">;
984
+ data: z.ZodString;
985
+ }, z.core.$strict>]>>>;
986
+ label: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
987
+ parentID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
988
+ priorID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
989
+ id: z.ZodOptional<z.ZodString>;
990
+ authorId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
991
+ created_at: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
992
+ acl: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
993
+ sig: z.ZodOptional<z.ZodOptional<z.ZodString>>;
994
+ }, z.core.$strip>>;
995
+ enableToolChooser: z.ZodDefault<z.ZodBoolean>;
996
+ useBasePrompt: z.ZodDefault<z.ZodBoolean>;
997
+ tryUsingVisionModels: z.ZodDefault<z.ZodBoolean>;
998
+ taskChatTemplates: z.ZodObject<{
999
+ basePrompt: z.ZodString;
1000
+ instruction: z.ZodString;
1001
+ toolResult: z.ZodString;
1002
+ task: z.ZodString;
1003
+ evaluate: z.ZodString;
1004
+ schemaReminder: z.ZodString;
1005
+ tools: z.ZodString;
1006
+ }, z.core.$strip>;
1007
+ }, z.core.$strip>;
1008
+ type llmSettings = z.infer<typeof llmSettings>;
1009
+
1010
+ declare function createChatCompletionTool(llmSettings: Thunk<llmSettings>, taskManager: TyTaskManager): Promise<{
1011
+ chatCompletion: {
1012
+ description: string;
1013
+ longDescription: string;
1014
+ name: string;
1015
+ renderOptions: {
1016
+ hideChat: true;
1017
+ hideLlm: true;
1018
+ };
1019
+ parameters: {
1020
+ readonly type: "object";
1021
+ readonly additionalProperties: false;
1022
+ readonly properties: {
1023
+ readonly model: {
1024
+ readonly type: "string";
1025
+ readonly description: "The name of the model to use for the completion. Optional, will choose default model if not provided";
1026
+ };
1027
+ readonly goal: {
1028
+ readonly enum: ["SimpleCompletion", "AnalyzeError", "ChooseTool", "AnalyzeToolResult", "WebSearch"];
1029
+ readonly description: "Optional Parameter to define the goal of the chat completion. If not set, the goal is dynamically inferred from the input.";
1030
+ };
1031
+ readonly llmTools: {
1032
+ readonly type: "boolean";
1033
+ readonly description: "Optional Parameter. If set to true, we will use a openai compatible tool api. If undefined, it will be treated as false.";
1034
+ };
1035
+ readonly allowedTools: {
1036
+ readonly type: "array";
1037
+ readonly description: "Optional Parameter. We can specify which tools are allowed to be called by the LLM";
1038
+ readonly items: {
1039
+ readonly type: "string";
1040
+ };
1041
+ };
1042
+ readonly prompts: {
1043
+ readonly type: "array";
1044
+ readonly description: "Optional Parameter. We can add a custom prompt to the chatCompletion which doesn't get recorded as a task and therefore disappears during message thread conversion.";
1045
+ readonly items: {
1046
+ readonly type: "string";
1047
+ };
1048
+ };
1049
+ readonly schema: {
1050
+ readonly type: "object";
1051
+ readonly description: "A json schema object which we can use to generate a specific response and parse it.";
1052
+ readonly additionalProperties: true;
1053
+ };
1054
+ };
1055
+ };
1056
+ function: ({ model, goal, llmTools, allowedTools, prompts, schema }: {
1057
+ model?: string;
1058
+ schema?: {
1059
+ [x: string]: unknown;
1060
+ };
1061
+ goal?: "SimpleCompletion" | "AnalyzeError" | "ChooseTool" | "AnalyzeToolResult" | "WebSearch";
1062
+ llmTools?: boolean;
1063
+ allowedTools?: string[];
1064
+ prompts?: string[];
1065
+ }, context: toolContext) => Promise<{
1066
+ taskResultMarker: "*TY_TASKRESULT*";
1067
+ taskChainList: {
1068
+ role: "function" | "system" | "user" | "assistant";
1069
+ content: {
1070
+ type: "message";
1071
+ data: string;
1072
+ ann?: ({
1073
+ type: "url_citation";
1074
+ url_citation?: {
1075
+ end_index?: number | undefined;
1076
+ start_index?: number | undefined;
1077
+ title?: string | undefined;
1078
+ url?: string | undefined;
1079
+ content?: string | undefined;
1080
+ } | undefined;
1081
+ } | {
1082
+ type: "file";
1083
+ content?: {
1084
+ text: string;
1085
+ type: string;
1086
+ }[] | undefined;
1087
+ })[] | undefined;
1088
+ } | {
1089
+ type: "toolresult";
1090
+ data: unknown;
1091
+ } | {
1092
+ type: "tooldefinition";
1093
+ data: {
1094
+ description: string;
1095
+ name: string;
1096
+ parameters: Readonly<JSONSchema7>;
1097
+ longDescription?: string | undefined;
1098
+ renderOptions?: {
1099
+ hideChat?: boolean | undefined;
1100
+ hideLlm?: boolean | undefined;
1101
+ } | undefined;
1102
+ code?: string | undefined;
1103
+ };
1104
+ } | {
1105
+ type: "error";
1106
+ data: unknown;
1107
+ } | {
1108
+ type: "structured";
1109
+ data: unknown;
1110
+ } | {
1111
+ type: "functioncall";
1112
+ data: {
1113
+ name: string;
1114
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
1115
+ };
1116
+ } | {
1117
+ type: "files";
1118
+ data: string[];
1119
+ } | {
1120
+ type: "return";
1121
+ data: string;
1122
+ };
1123
+ name?: string | undefined;
1124
+ label?: string[] | undefined;
1125
+ parentID?: string | undefined;
1126
+ priorID?: string | undefined;
1127
+ id?: string | undefined;
1128
+ authorId?: string | undefined;
1129
+ created_at?: number | undefined;
1130
+ acl?: string[] | undefined;
1131
+ sig?: string | undefined;
1132
+ }[][];
1133
+ }>;
1134
+ };
1135
+ stream: Stream<{
1136
+ taskId: string;
1137
+ chunk: ChatCompletionChunk | undefined;
1138
+ }>;
1139
+ }>;
1140
+ type chatCompletionParams = FromSchema<Awaited<ReturnType<typeof createChatCompletionTool>>['chatCompletion']['parameters']>;
1141
+
1142
+ declare const TaskyonMessage: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
1143
+ type: z$1.ZodLiteral<"addTasks">;
1144
+ data: z$1.ZodType<Uint8Array<ArrayBuffer>>;
1145
+ info: z$1.ZodString;
1146
+ ids: z$1.ZodArray<z$1.ZodString>;
1147
+ }, z$1.core.$strip>, z$1.ZodObject<{
1148
+ type: z$1.ZodLiteral<"requestTask">;
1149
+ id: z$1.ZodString;
1150
+ }, z$1.core.$strip>, z$1.ZodObject<{
1151
+ type: z$1.ZodLiteral<"taskCreated">;
1152
+ task: z$1.ZodOptional<z$1.ZodObject<{
1153
+ role: z$1.ZodEnum<{
1154
+ function: "function";
1155
+ system: "system";
1156
+ user: "user";
1157
+ assistant: "assistant";
1158
+ }>;
1159
+ name: z$1.ZodOptional<z$1.ZodString>;
1160
+ content: z$1.ZodUnion<readonly [z$1.ZodObject<{
1161
+ type: z$1.ZodLiteral<"message">;
1162
+ data: z$1.ZodString;
1163
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1164
+ type: z$1.ZodLiteral<"url_citation">;
1165
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1166
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1167
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1168
+ title: z$1.ZodOptional<z$1.ZodString>;
1169
+ url: z$1.ZodOptional<z$1.ZodString>;
1170
+ content: z$1.ZodOptional<z$1.ZodString>;
1171
+ }, z$1.core.$strip>>;
1172
+ }, z$1.core.$strip>, z$1.ZodObject<{
1173
+ type: z$1.ZodLiteral<"file">;
1174
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1175
+ text: z$1.ZodString;
1176
+ type: z$1.ZodString;
1177
+ }, z$1.core.$strip>>>;
1178
+ }, z$1.core.$strip>]>>>;
1179
+ }, z$1.core.$strict>, z$1.ZodObject<{
1180
+ type: z$1.ZodLiteral<"toolresult">;
1181
+ data: z$1.ZodUnknown;
1182
+ }, z$1.core.$strict>, z$1.ZodObject<{
1183
+ type: z$1.ZodLiteral<"tooldefinition">;
1184
+ data: z$1.ZodObject<{
1185
+ description: z$1.ZodString;
1186
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1187
+ name: z$1.ZodString;
1188
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1189
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1190
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1191
+ }, z$1.core.$strip>>;
1192
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1193
+ code: z$1.ZodOptional<z$1.ZodString>;
1194
+ }, z$1.core.$strip>;
1195
+ }, z$1.core.$strict>, z$1.ZodObject<{
1196
+ type: z$1.ZodLiteral<"error">;
1197
+ data: z$1.ZodUnknown;
1198
+ }, z$1.core.$strict>, z$1.ZodObject<{
1199
+ type: z$1.ZodLiteral<"structured">;
1200
+ data: z$1.ZodUnknown;
1201
+ }, z$1.core.$strict>, z$1.ZodObject<{
1202
+ type: z$1.ZodLiteral<"functioncall">;
1203
+ data: z$1.ZodObject<{
1204
+ name: z$1.ZodString;
1205
+ arguments: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>;
1206
+ }, z$1.core.$strip>;
1207
+ }, z$1.core.$strict>, z$1.ZodObject<{
1208
+ type: z$1.ZodLiteral<"files">;
1209
+ data: z$1.ZodArray<z$1.ZodString>;
1210
+ }, z$1.core.$strict>, z$1.ZodObject<{
1211
+ type: z$1.ZodLiteral<"return">;
1212
+ data: z$1.ZodString;
1213
+ }, z$1.core.$strict>]>;
1214
+ label: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1215
+ parentID: z$1.ZodOptional<z$1.ZodString>;
1216
+ priorID: z$1.ZodOptional<z$1.ZodString>;
1217
+ id: z$1.ZodString;
1218
+ authorId: z$1.ZodOptional<z$1.ZodString>;
1219
+ created_at: z$1.ZodOptional<z$1.ZodNumber>;
1220
+ acl: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1221
+ sig: z$1.ZodOptional<z$1.ZodString>;
1222
+ }, z$1.core.$strip>>;
1223
+ ids: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1224
+ info: z$1.ZodOptional<z$1.ZodString>;
1225
+ }, z$1.core.$strip>, z$1.ZodObject<{
1226
+ type: z$1.ZodLiteral<"status">;
1227
+ data: z$1.ZodObject<{
1228
+ type: z$1.ZodLiteral<"newtool">;
1229
+ id: z$1.ZodString;
1230
+ }, z$1.core.$strip>;
1231
+ origin: z$1.ZodOptional<z$1.ZodString>;
1232
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1233
+ }, z$1.core.$strip>, z$1.ZodObject<{
1234
+ functionName: z$1.ZodString;
1235
+ type: z$1.ZodLiteral<"functionCall">;
1236
+ arguments: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>>;
1237
+ origin: z$1.ZodOptional<z$1.ZodString>;
1238
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1239
+ }, z$1.core.$strip>, z$1.ZodObject<{
1240
+ functionName: z$1.ZodString;
1241
+ type: z$1.ZodLiteral<"functionResponse">;
1242
+ response: z$1.ZodOptional<z$1.ZodUnknown>;
1243
+ error: z$1.ZodOptional<z$1.ZodUnknown>;
1244
+ origin: z$1.ZodOptional<z$1.ZodString>;
1245
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1246
+ }, z$1.core.$strip>, z$1.ZodObject<{
1247
+ type: z$1.ZodLiteral<"task">;
1248
+ task: z$1.ZodObject<{
1249
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1250
+ function: "function";
1251
+ system: "system";
1252
+ user: "user";
1253
+ assistant: "assistant";
1254
+ }>>>;
1255
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1256
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1257
+ type: z$1.ZodLiteral<"message">;
1258
+ data: z$1.ZodString;
1259
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1260
+ type: z$1.ZodLiteral<"url_citation">;
1261
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1262
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1263
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1264
+ title: z$1.ZodOptional<z$1.ZodString>;
1265
+ url: z$1.ZodOptional<z$1.ZodString>;
1266
+ content: z$1.ZodOptional<z$1.ZodString>;
1267
+ }, z$1.core.$strip>>;
1268
+ }, z$1.core.$strip>, z$1.ZodObject<{
1269
+ type: z$1.ZodLiteral<"file">;
1270
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1271
+ text: z$1.ZodString;
1272
+ type: z$1.ZodString;
1273
+ }, z$1.core.$strip>>>;
1274
+ }, z$1.core.$strip>]>>>;
1275
+ }, z$1.core.$strict>, z$1.ZodObject<{
1276
+ type: z$1.ZodLiteral<"toolresult">;
1277
+ data: z$1.ZodUnknown;
1278
+ }, z$1.core.$strict>, z$1.ZodObject<{
1279
+ type: z$1.ZodLiteral<"tooldefinition">;
1280
+ data: z$1.ZodObject<{
1281
+ description: z$1.ZodString;
1282
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1283
+ name: z$1.ZodString;
1284
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1285
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1286
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1287
+ }, z$1.core.$strip>>;
1288
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1289
+ code: z$1.ZodOptional<z$1.ZodString>;
1290
+ }, z$1.core.$strip>;
1291
+ }, z$1.core.$strict>, z$1.ZodObject<{
1292
+ type: z$1.ZodLiteral<"error">;
1293
+ data: z$1.ZodUnknown;
1294
+ }, z$1.core.$strict>, z$1.ZodObject<{
1295
+ type: z$1.ZodLiteral<"structured">;
1296
+ data: z$1.ZodUnknown;
1297
+ }, z$1.core.$strict>, z$1.ZodObject<{
1298
+ type: z$1.ZodLiteral<"functioncall">;
1299
+ data: z$1.ZodObject<{
1300
+ name: z$1.ZodString;
1301
+ arguments: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>;
1302
+ }, z$1.core.$strip>;
1303
+ }, z$1.core.$strict>, z$1.ZodObject<{
1304
+ type: z$1.ZodLiteral<"files">;
1305
+ data: z$1.ZodArray<z$1.ZodString>;
1306
+ }, z$1.core.$strict>, z$1.ZodObject<{
1307
+ type: z$1.ZodLiteral<"return">;
1308
+ data: z$1.ZodString;
1309
+ }, z$1.core.$strict>]>>>;
1310
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1311
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1312
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1313
+ id: z$1.ZodOptional<z$1.ZodString>;
1314
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1315
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
1316
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1317
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1318
+ }, z$1.core.$strip>;
1319
+ execute: z$1.ZodDefault<z$1.ZodBoolean>;
1320
+ show: z$1.ZodDefault<z$1.ZodBoolean>;
1321
+ origin: z$1.ZodOptional<z$1.ZodString>;
1322
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1323
+ }, z$1.core.$strip>, z$1.ZodObject<{
1324
+ type: z$1.ZodLiteral<"tasks">;
1325
+ execute: z$1.ZodDefault<z$1.ZodBoolean>;
1326
+ tasks: z$1.ZodArray<z$1.ZodObject<{
1327
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1328
+ function: "function";
1329
+ system: "system";
1330
+ user: "user";
1331
+ assistant: "assistant";
1332
+ }>>>;
1333
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1334
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1335
+ type: z$1.ZodLiteral<"message">;
1336
+ data: z$1.ZodString;
1337
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1338
+ type: z$1.ZodLiteral<"url_citation">;
1339
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1340
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1341
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1342
+ title: z$1.ZodOptional<z$1.ZodString>;
1343
+ url: z$1.ZodOptional<z$1.ZodString>;
1344
+ content: z$1.ZodOptional<z$1.ZodString>;
1345
+ }, z$1.core.$strip>>;
1346
+ }, z$1.core.$strip>, z$1.ZodObject<{
1347
+ type: z$1.ZodLiteral<"file">;
1348
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1349
+ text: z$1.ZodString;
1350
+ type: z$1.ZodString;
1351
+ }, z$1.core.$strip>>>;
1352
+ }, z$1.core.$strip>]>>>;
1353
+ }, z$1.core.$strict>, z$1.ZodObject<{
1354
+ type: z$1.ZodLiteral<"toolresult">;
1355
+ data: z$1.ZodUnknown;
1356
+ }, z$1.core.$strict>, z$1.ZodObject<{
1357
+ type: z$1.ZodLiteral<"tooldefinition">;
1358
+ data: z$1.ZodObject<{
1359
+ description: z$1.ZodString;
1360
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1361
+ name: z$1.ZodString;
1362
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1363
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1364
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1365
+ }, z$1.core.$strip>>;
1366
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1367
+ code: z$1.ZodOptional<z$1.ZodString>;
1368
+ }, z$1.core.$strip>;
1369
+ }, z$1.core.$strict>, z$1.ZodObject<{
1370
+ type: z$1.ZodLiteral<"error">;
1371
+ data: z$1.ZodUnknown;
1372
+ }, z$1.core.$strict>, z$1.ZodObject<{
1373
+ type: z$1.ZodLiteral<"structured">;
1374
+ data: z$1.ZodUnknown;
1375
+ }, z$1.core.$strict>, z$1.ZodObject<{
1376
+ type: z$1.ZodLiteral<"functioncall">;
1377
+ data: z$1.ZodObject<{
1378
+ name: z$1.ZodString;
1379
+ arguments: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>;
1380
+ }, z$1.core.$strip>;
1381
+ }, z$1.core.$strict>, z$1.ZodObject<{
1382
+ type: z$1.ZodLiteral<"files">;
1383
+ data: z$1.ZodArray<z$1.ZodString>;
1384
+ }, z$1.core.$strict>, z$1.ZodObject<{
1385
+ type: z$1.ZodLiteral<"return">;
1386
+ data: z$1.ZodString;
1387
+ }, z$1.core.$strict>]>>>;
1388
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1389
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1390
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1391
+ id: z$1.ZodOptional<z$1.ZodString>;
1392
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1393
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
1394
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1395
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1396
+ }, z$1.core.$strip>>;
1397
+ show: z$1.ZodDefault<z$1.ZodBoolean>;
1398
+ origin: z$1.ZodOptional<z$1.ZodString>;
1399
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1400
+ }, z$1.core.$strip>, z$1.ZodObject<{
1401
+ description: z$1.ZodString;
1402
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1403
+ name: z$1.ZodString;
1404
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1405
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1406
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1407
+ }, z$1.core.$strip>>;
1408
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1409
+ code: z$1.ZodOptional<z$1.ZodString>;
1410
+ type: z$1.ZodLiteral<"functionDescription">;
1411
+ origin: z$1.ZodOptional<z$1.ZodString>;
1412
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1413
+ }, z$1.core.$strip>, z$1.ZodObject<{
1414
+ type: z$1.ZodLiteral<"taskyonReady">;
1415
+ origin: z$1.ZodOptional<z$1.ZodString>;
1416
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1417
+ }, z$1.core.$strip>, z$1.ZodObject<{
1418
+ type: z$1.ZodLiteral<"file">;
1419
+ id: z$1.ZodString;
1420
+ name: z$1.ZodString;
1421
+ mime: z$1.ZodString;
1422
+ size: z$1.ZodNumber;
1423
+ store: z$1.ZodOptional<z$1.ZodEnum<{
1424
+ memory: "memory";
1425
+ opfs: "opfs";
1426
+ }>>;
1427
+ file: z$1.ZodFile;
1428
+ origin: z$1.ZodOptional<z$1.ZodString>;
1429
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1430
+ }, z$1.core.$strip>]>;
1431
+ type TaskyonMessage = z$1.infer<typeof TaskyonMessage>;
1432
+
1433
+ type processTasksOpts = {
1434
+ timeoutMs?: number;
1435
+ signal?: AbortSignal;
1436
+ quitCondition?: (t: TaskNode) => boolean;
1437
+ };
1438
+ declare const createChatCompletionTask: (args: chatCompletionParams) => {
1439
+ role: "function" | "system" | "user" | "assistant";
1440
+ content: {
1441
+ type: "message";
1442
+ data: string;
1443
+ ann?: ({
1444
+ type: "url_citation";
1445
+ url_citation?: {
1446
+ end_index?: number | undefined;
1447
+ start_index?: number | undefined;
1448
+ title?: string | undefined;
1449
+ url?: string | undefined;
1450
+ content?: string | undefined;
1451
+ } | undefined;
1452
+ } | {
1453
+ type: "file";
1454
+ content?: {
1455
+ text: string;
1456
+ type: string;
1457
+ }[] | undefined;
1458
+ })[] | undefined;
1459
+ } | {
1460
+ type: "toolresult";
1461
+ data: unknown;
1462
+ } | {
1463
+ type: "tooldefinition";
1464
+ data: {
1465
+ description: string;
1466
+ name: string;
1467
+ parameters: Readonly<json_schema.JSONSchema7>;
1468
+ longDescription?: string | undefined;
1469
+ renderOptions?: {
1470
+ hideChat?: boolean | undefined;
1471
+ hideLlm?: boolean | undefined;
1472
+ } | undefined;
1473
+ code?: string | undefined;
1474
+ };
1475
+ } | {
1476
+ type: "error";
1477
+ data: unknown;
1478
+ } | {
1479
+ type: "structured";
1480
+ data: unknown;
1481
+ } | {
1482
+ type: "functioncall";
1483
+ data: {
1484
+ name: string;
1485
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
1486
+ };
1487
+ } | {
1488
+ type: "files";
1489
+ data: string[];
1490
+ } | {
1491
+ type: "return";
1492
+ data: string;
1493
+ };
1494
+ name?: string | undefined;
1495
+ label?: string[] | undefined;
1496
+ parentID?: string | undefined;
1497
+ priorID?: string | undefined;
1498
+ id?: string | undefined;
1499
+ authorId?: string | undefined;
1500
+ created_at?: number | undefined;
1501
+ acl?: string[] | undefined;
1502
+ sig?: string | undefined;
1503
+ } & {
1504
+ content: {
1505
+ type: "functioncall";
1506
+ data: FunctionCall;
1507
+ };
1508
+ };
1509
+ declare const processTasks: <T extends {
1510
+ type: string;
1511
+ }>(tyPort: Port<T | TaskyonMessage>) => (taskList: partialTaskDraft[][], opts: processTasksOpts) => Promise<{
1512
+ role: "function" | "system" | "user" | "assistant";
1513
+ content: {
1514
+ type: "message";
1515
+ data: string;
1516
+ ann?: ({
1517
+ type: "url_citation";
1518
+ url_citation?: {
1519
+ end_index?: number | undefined;
1520
+ start_index?: number | undefined;
1521
+ title?: string | undefined;
1522
+ url?: string | undefined;
1523
+ content?: string | undefined;
1524
+ } | undefined;
1525
+ } | {
1526
+ type: "file";
1527
+ content?: {
1528
+ text: string;
1529
+ type: string;
1530
+ }[] | undefined;
1531
+ })[] | undefined;
1532
+ } | {
1533
+ type: "toolresult";
1534
+ data: unknown;
1535
+ } | {
1536
+ type: "tooldefinition";
1537
+ data: {
1538
+ description: string;
1539
+ name: string;
1540
+ parameters: Readonly<json_schema.JSONSchema7>;
1541
+ longDescription?: string | undefined;
1542
+ renderOptions?: {
1543
+ hideChat?: boolean | undefined;
1544
+ hideLlm?: boolean | undefined;
1545
+ } | undefined;
1546
+ code?: string | undefined;
1547
+ };
1548
+ } | {
1549
+ type: "error";
1550
+ data: unknown;
1551
+ } | {
1552
+ type: "structured";
1553
+ data: unknown;
1554
+ } | {
1555
+ type: "functioncall";
1556
+ data: {
1557
+ name: string;
1558
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
1559
+ };
1560
+ } | {
1561
+ type: "files";
1562
+ data: string[];
1563
+ } | {
1564
+ type: "return";
1565
+ data: string;
1566
+ };
1567
+ id: string;
1568
+ name?: string | undefined;
1569
+ label?: string[] | undefined;
1570
+ parentID?: string | undefined;
1571
+ priorID?: string | undefined;
1572
+ authorId?: string | undefined;
1573
+ created_at?: number | undefined;
1574
+ acl?: string[] | undefined;
1575
+ sig?: string | undefined;
1576
+ } & {
1577
+ id: string;
1578
+ }>;
1579
+
1580
+ declare const TyProfile: z$1.ZodObject<{
1581
+ version: z$1.ZodLiteral<21>;
1582
+ appConfiguration: z$1.ZodObject<{
1583
+ darkTheme: z$1.ZodUnion<readonly [z$1.ZodLiteral<"auto">, z$1.ZodBoolean]>;
1584
+ appConfigurationUrl: z$1.ZodDefault<z$1.ZodString>;
1585
+ gdriveConfigurationFile: z$1.ZodDefault<z$1.ZodString>;
1586
+ enableGdriveSync: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
1587
+ expertMode: z$1.ZodDefault<z$1.ZodBoolean>;
1588
+ showCosts: z$1.ZodDefault<z$1.ZodBoolean>;
1589
+ gdriveDir: z$1.ZodDefault<z$1.ZodString>;
1590
+ showLogo: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
1591
+ welcomeMsg: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
1592
+ chatSuggestions: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1593
+ url: z$1.ZodString;
1594
+ label: z$1.ZodString;
1595
+ }, z$1.core.$strip>, z$1.ZodObject<{
1596
+ md: z$1.ZodString;
1597
+ label: z$1.ZodString;
1598
+ }, z$1.core.$strip>]>>>>;
1599
+ useEnterToSend: z$1.ZodDefault<z$1.ZodEnum<{
1600
+ shift: "shift";
1601
+ auto: "auto";
1602
+ on: "on";
1603
+ off: "off";
1604
+ }>>;
1605
+ guiMode: z$1.ZodDefault<z$1.ZodEnum<{
1606
+ default: "default";
1607
+ auto: "auto";
1608
+ iframe: "iframe";
1609
+ minChat: "minChat";
1610
+ }>>;
1611
+ primaryColor: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
1612
+ secondaryColor: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
1613
+ }, z$1.core.$strip>;
1614
+ llmSettings: z$1.ZodObject<{
1615
+ userId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
1616
+ allowWebSearch: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
1617
+ secretPublicKey: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
1618
+ selectedTaskId: z$1.ZodOptional<z$1.ZodString>;
1619
+ enableOpenAiTools: z$1.ZodDefault<z$1.ZodBoolean>;
1620
+ selectedApi: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
1621
+ llmApis: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
1622
+ name: z$1.ZodString;
1623
+ baseURL: z$1.ZodString;
1624
+ defaultModel: z$1.ZodString;
1625
+ selectedModel: z$1.ZodOptional<z$1.ZodString>;
1626
+ models: z$1.ZodOptional<z$1.ZodObject<{
1627
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1628
+ chat: z$1.ZodOptional<z$1.ZodString>;
1629
+ free: z$1.ZodOptional<z$1.ZodString>;
1630
+ }, z$1.core.$strip>>;
1631
+ streamSupport: z$1.ZodBoolean;
1632
+ defaultHeaders: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1633
+ routes: z$1.ZodObject<{
1634
+ chatCompletion: z$1.ZodString;
1635
+ models: z$1.ZodString;
1636
+ }, z$1.core.$strip>;
1637
+ }, z$1.core.$strip>>>;
1638
+ siteUrl: z$1.ZodDefault<z$1.ZodString>;
1639
+ summaryModel: z$1.ZodDefault<z$1.ZodString>;
1640
+ vectorizationModel: z$1.ZodDefault<z$1.ZodString>;
1641
+ maxAutonomousTasks: z$1.ZodDefault<z$1.ZodNumber>;
1642
+ entryNode: z$1.ZodOptional<z$1.ZodObject<{
1643
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1644
+ function: "function";
1645
+ system: "system";
1646
+ user: "user";
1647
+ assistant: "assistant";
1648
+ }>>>;
1649
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1650
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1651
+ type: z$1.ZodLiteral<"message">;
1652
+ data: z$1.ZodString;
1653
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1654
+ type: z$1.ZodLiteral<"url_citation">;
1655
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1656
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1657
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1658
+ title: z$1.ZodOptional<z$1.ZodString>;
1659
+ url: z$1.ZodOptional<z$1.ZodString>;
1660
+ content: z$1.ZodOptional<z$1.ZodString>;
1661
+ }, z$1.core.$strip>>;
1662
+ }, z$1.core.$strip>, z$1.ZodObject<{
1663
+ type: z$1.ZodLiteral<"file">;
1664
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1665
+ text: z$1.ZodString;
1666
+ type: z$1.ZodString;
1667
+ }, z$1.core.$strip>>>;
1668
+ }, z$1.core.$strip>]>>>;
1669
+ }, z$1.core.$strict>, z$1.ZodObject<{
1670
+ type: z$1.ZodLiteral<"toolresult">;
1671
+ data: z$1.ZodUnknown;
1672
+ }, z$1.core.$strict>, z$1.ZodObject<{
1673
+ type: z$1.ZodLiteral<"tooldefinition">;
1674
+ data: z$1.ZodObject<{
1675
+ description: z$1.ZodString;
1676
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1677
+ name: z$1.ZodString;
1678
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1679
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1680
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1681
+ }, z$1.core.$strip>>;
1682
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1683
+ code: z$1.ZodOptional<z$1.ZodString>;
1684
+ }, z$1.core.$strip>;
1685
+ }, z$1.core.$strict>, z$1.ZodObject<{
1686
+ type: z$1.ZodLiteral<"error">;
1687
+ data: z$1.ZodUnknown;
1688
+ }, z$1.core.$strict>, z$1.ZodObject<{
1689
+ type: z$1.ZodLiteral<"structured">;
1690
+ data: z$1.ZodUnknown;
1691
+ }, z$1.core.$strict>, z$1.ZodObject<{
1692
+ type: z$1.ZodLiteral<"functioncall">;
1693
+ data: z$1.ZodObject<{
1694
+ name: z$1.ZodString;
1695
+ arguments: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>;
1696
+ }, z$1.core.$strip>;
1697
+ }, z$1.core.$strict>, z$1.ZodObject<{
1698
+ type: z$1.ZodLiteral<"files">;
1699
+ data: z$1.ZodArray<z$1.ZodString>;
1700
+ }, z$1.core.$strict>, z$1.ZodObject<{
1701
+ type: z$1.ZodLiteral<"return">;
1702
+ data: z$1.ZodString;
1703
+ }, z$1.core.$strict>]>>>;
1704
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1705
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1706
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1707
+ id: z$1.ZodOptional<z$1.ZodString>;
1708
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1709
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
1710
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1711
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1712
+ }, z$1.core.$strip>>;
1713
+ enableToolChooser: z$1.ZodDefault<z$1.ZodBoolean>;
1714
+ useBasePrompt: z$1.ZodDefault<z$1.ZodBoolean>;
1715
+ tryUsingVisionModels: z$1.ZodDefault<z$1.ZodBoolean>;
1716
+ taskChatTemplates: z$1.ZodObject<{
1717
+ basePrompt: z$1.ZodString;
1718
+ instruction: z$1.ZodString;
1719
+ toolResult: z$1.ZodString;
1720
+ task: z$1.ZodString;
1721
+ evaluate: z$1.ZodString;
1722
+ schemaReminder: z$1.ZodString;
1723
+ tools: z$1.ZodString;
1724
+ }, z$1.core.$strip>;
1725
+ }, z$1.core.$strip>;
1726
+ toolchainConfig: z$1.ZodObject<{
1727
+ tools: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodJSONSchema>>;
1728
+ }, z$1.core.$strip>;
1729
+ signatureOrKey: z$1.ZodOptional<z$1.ZodString>;
1730
+ }, z$1.core.$strip>;
1731
+ type TyProfile = z$1.infer<typeof TyProfile>;
1732
+
1733
+ type partialTyConfiguration = PartialDeep<TyProfile>;
1734
+ declare const TaskyonGuiMessage: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
1735
+ type: z$1.ZodLiteral<"addTasks">;
1736
+ data: z$1.ZodType<Uint8Array<ArrayBuffer>>;
1737
+ info: z$1.ZodString;
1738
+ ids: z$1.ZodArray<z$1.ZodString>;
1739
+ }, z$1.core.$strip>, z$1.ZodObject<{
1740
+ type: z$1.ZodLiteral<"requestTask">;
1741
+ id: z$1.ZodString;
1742
+ }, z$1.core.$strip>, z$1.ZodObject<{
1743
+ type: z$1.ZodLiteral<"taskCreated">;
1744
+ task: z$1.ZodOptional<z$1.ZodObject<{
1745
+ role: z$1.ZodEnum<{
1746
+ function: "function";
1747
+ system: "system";
1748
+ user: "user";
1749
+ assistant: "assistant";
1750
+ }>;
1751
+ name: z$1.ZodOptional<z$1.ZodString>;
1752
+ content: z$1.ZodUnion<readonly [z$1.ZodObject<{
1753
+ type: z$1.ZodLiteral<"message">;
1754
+ data: z$1.ZodString;
1755
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1756
+ type: z$1.ZodLiteral<"url_citation">;
1757
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1758
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1759
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1760
+ title: z$1.ZodOptional<z$1.ZodString>;
1761
+ url: z$1.ZodOptional<z$1.ZodString>;
1762
+ content: z$1.ZodOptional<z$1.ZodString>;
1763
+ }, z$1.core.$strip>>;
1764
+ }, z$1.core.$strip>, z$1.ZodObject<{
1765
+ type: z$1.ZodLiteral<"file">;
1766
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1767
+ text: z$1.ZodString;
1768
+ type: z$1.ZodString;
1769
+ }, z$1.core.$strip>>>;
1770
+ }, z$1.core.$strip>]>>>;
1771
+ }, z$1.core.$strict>, z$1.ZodObject<{
1772
+ type: z$1.ZodLiteral<"toolresult">;
1773
+ data: z$1.ZodUnknown;
1774
+ }, z$1.core.$strict>, z$1.ZodObject<{
1775
+ type: z$1.ZodLiteral<"tooldefinition">;
1776
+ data: z$1.ZodObject<{
1777
+ description: z$1.ZodString;
1778
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1779
+ name: z$1.ZodString;
1780
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1781
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1782
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1783
+ }, z$1.core.$strip>>;
1784
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1785
+ code: z$1.ZodOptional<z$1.ZodString>;
1786
+ }, z$1.core.$strip>;
1787
+ }, z$1.core.$strict>, z$1.ZodObject<{
1788
+ type: z$1.ZodLiteral<"error">;
1789
+ data: z$1.ZodUnknown;
1790
+ }, z$1.core.$strict>, z$1.ZodObject<{
1791
+ type: z$1.ZodLiteral<"structured">;
1792
+ data: z$1.ZodUnknown;
1793
+ }, z$1.core.$strict>, z$1.ZodObject<{
1794
+ type: z$1.ZodLiteral<"functioncall">;
1795
+ data: z$1.ZodObject<{
1796
+ name: z$1.ZodString;
1797
+ arguments: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>;
1798
+ }, z$1.core.$strip>;
1799
+ }, z$1.core.$strict>, z$1.ZodObject<{
1800
+ type: z$1.ZodLiteral<"files">;
1801
+ data: z$1.ZodArray<z$1.ZodString>;
1802
+ }, z$1.core.$strict>, z$1.ZodObject<{
1803
+ type: z$1.ZodLiteral<"return">;
1804
+ data: z$1.ZodString;
1805
+ }, z$1.core.$strict>]>;
1806
+ label: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1807
+ parentID: z$1.ZodOptional<z$1.ZodString>;
1808
+ priorID: z$1.ZodOptional<z$1.ZodString>;
1809
+ id: z$1.ZodString;
1810
+ authorId: z$1.ZodOptional<z$1.ZodString>;
1811
+ created_at: z$1.ZodOptional<z$1.ZodNumber>;
1812
+ acl: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1813
+ sig: z$1.ZodOptional<z$1.ZodString>;
1814
+ }, z$1.core.$strip>>;
1815
+ ids: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1816
+ info: z$1.ZodOptional<z$1.ZodString>;
1817
+ }, z$1.core.$strip>, z$1.ZodObject<{
1818
+ type: z$1.ZodLiteral<"status">;
1819
+ data: z$1.ZodObject<{
1820
+ type: z$1.ZodLiteral<"newtool">;
1821
+ id: z$1.ZodString;
1822
+ }, z$1.core.$strip>;
1823
+ origin: z$1.ZodOptional<z$1.ZodString>;
1824
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1825
+ }, z$1.core.$strip>, z$1.ZodObject<{
1826
+ functionName: z$1.ZodString;
1827
+ type: z$1.ZodLiteral<"functionCall">;
1828
+ arguments: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>>;
1829
+ origin: z$1.ZodOptional<z$1.ZodString>;
1830
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1831
+ }, z$1.core.$strip>, z$1.ZodObject<{
1832
+ functionName: z$1.ZodString;
1833
+ type: z$1.ZodLiteral<"functionResponse">;
1834
+ response: z$1.ZodOptional<z$1.ZodUnknown>;
1835
+ error: z$1.ZodOptional<z$1.ZodUnknown>;
1836
+ origin: z$1.ZodOptional<z$1.ZodString>;
1837
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1838
+ }, z$1.core.$strip>, z$1.ZodObject<{
1839
+ type: z$1.ZodLiteral<"task">;
1840
+ task: z$1.ZodObject<{
1841
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1842
+ function: "function";
1843
+ system: "system";
1844
+ user: "user";
1845
+ assistant: "assistant";
1846
+ }>>>;
1847
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1848
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1849
+ type: z$1.ZodLiteral<"message">;
1850
+ data: z$1.ZodString;
1851
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1852
+ type: z$1.ZodLiteral<"url_citation">;
1853
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1854
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1855
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1856
+ title: z$1.ZodOptional<z$1.ZodString>;
1857
+ url: z$1.ZodOptional<z$1.ZodString>;
1858
+ content: z$1.ZodOptional<z$1.ZodString>;
1859
+ }, z$1.core.$strip>>;
1860
+ }, z$1.core.$strip>, z$1.ZodObject<{
1861
+ type: z$1.ZodLiteral<"file">;
1862
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1863
+ text: z$1.ZodString;
1864
+ type: z$1.ZodString;
1865
+ }, z$1.core.$strip>>>;
1866
+ }, z$1.core.$strip>]>>>;
1867
+ }, z$1.core.$strict>, z$1.ZodObject<{
1868
+ type: z$1.ZodLiteral<"toolresult">;
1869
+ data: z$1.ZodUnknown;
1870
+ }, z$1.core.$strict>, z$1.ZodObject<{
1871
+ type: z$1.ZodLiteral<"tooldefinition">;
1872
+ data: z$1.ZodObject<{
1873
+ description: z$1.ZodString;
1874
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1875
+ name: z$1.ZodString;
1876
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1877
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1878
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1879
+ }, z$1.core.$strip>>;
1880
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1881
+ code: z$1.ZodOptional<z$1.ZodString>;
1882
+ }, z$1.core.$strip>;
1883
+ }, z$1.core.$strict>, z$1.ZodObject<{
1884
+ type: z$1.ZodLiteral<"error">;
1885
+ data: z$1.ZodUnknown;
1886
+ }, z$1.core.$strict>, z$1.ZodObject<{
1887
+ type: z$1.ZodLiteral<"structured">;
1888
+ data: z$1.ZodUnknown;
1889
+ }, z$1.core.$strict>, z$1.ZodObject<{
1890
+ type: z$1.ZodLiteral<"functioncall">;
1891
+ data: z$1.ZodObject<{
1892
+ name: z$1.ZodString;
1893
+ arguments: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>;
1894
+ }, z$1.core.$strip>;
1895
+ }, z$1.core.$strict>, z$1.ZodObject<{
1896
+ type: z$1.ZodLiteral<"files">;
1897
+ data: z$1.ZodArray<z$1.ZodString>;
1898
+ }, z$1.core.$strict>, z$1.ZodObject<{
1899
+ type: z$1.ZodLiteral<"return">;
1900
+ data: z$1.ZodString;
1901
+ }, z$1.core.$strict>]>>>;
1902
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1903
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1904
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1905
+ id: z$1.ZodOptional<z$1.ZodString>;
1906
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1907
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
1908
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1909
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1910
+ }, z$1.core.$strip>;
1911
+ execute: z$1.ZodDefault<z$1.ZodBoolean>;
1912
+ show: z$1.ZodDefault<z$1.ZodBoolean>;
1913
+ origin: z$1.ZodOptional<z$1.ZodString>;
1914
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1915
+ }, z$1.core.$strip>, z$1.ZodObject<{
1916
+ type: z$1.ZodLiteral<"tasks">;
1917
+ execute: z$1.ZodDefault<z$1.ZodBoolean>;
1918
+ tasks: z$1.ZodArray<z$1.ZodObject<{
1919
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1920
+ function: "function";
1921
+ system: "system";
1922
+ user: "user";
1923
+ assistant: "assistant";
1924
+ }>>>;
1925
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1926
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1927
+ type: z$1.ZodLiteral<"message">;
1928
+ data: z$1.ZodString;
1929
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1930
+ type: z$1.ZodLiteral<"url_citation">;
1931
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1932
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1933
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1934
+ title: z$1.ZodOptional<z$1.ZodString>;
1935
+ url: z$1.ZodOptional<z$1.ZodString>;
1936
+ content: z$1.ZodOptional<z$1.ZodString>;
1937
+ }, z$1.core.$strip>>;
1938
+ }, z$1.core.$strip>, z$1.ZodObject<{
1939
+ type: z$1.ZodLiteral<"file">;
1940
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1941
+ text: z$1.ZodString;
1942
+ type: z$1.ZodString;
1943
+ }, z$1.core.$strip>>>;
1944
+ }, z$1.core.$strip>]>>>;
1945
+ }, z$1.core.$strict>, z$1.ZodObject<{
1946
+ type: z$1.ZodLiteral<"toolresult">;
1947
+ data: z$1.ZodUnknown;
1948
+ }, z$1.core.$strict>, z$1.ZodObject<{
1949
+ type: z$1.ZodLiteral<"tooldefinition">;
1950
+ data: z$1.ZodObject<{
1951
+ description: z$1.ZodString;
1952
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1953
+ name: z$1.ZodString;
1954
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1955
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1956
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1957
+ }, z$1.core.$strip>>;
1958
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1959
+ code: z$1.ZodOptional<z$1.ZodString>;
1960
+ }, z$1.core.$strip>;
1961
+ }, z$1.core.$strict>, z$1.ZodObject<{
1962
+ type: z$1.ZodLiteral<"error">;
1963
+ data: z$1.ZodUnknown;
1964
+ }, z$1.core.$strict>, z$1.ZodObject<{
1965
+ type: z$1.ZodLiteral<"structured">;
1966
+ data: z$1.ZodUnknown;
1967
+ }, z$1.core.$strict>, z$1.ZodObject<{
1968
+ type: z$1.ZodLiteral<"functioncall">;
1969
+ data: z$1.ZodObject<{
1970
+ name: z$1.ZodString;
1971
+ arguments: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>;
1972
+ }, z$1.core.$strip>;
1973
+ }, z$1.core.$strict>, z$1.ZodObject<{
1974
+ type: z$1.ZodLiteral<"files">;
1975
+ data: z$1.ZodArray<z$1.ZodString>;
1976
+ }, z$1.core.$strict>, z$1.ZodObject<{
1977
+ type: z$1.ZodLiteral<"return">;
1978
+ data: z$1.ZodString;
1979
+ }, z$1.core.$strict>]>>>;
1980
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1981
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1982
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1983
+ id: z$1.ZodOptional<z$1.ZodString>;
1984
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1985
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
1986
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1987
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1988
+ }, z$1.core.$strip>>;
1989
+ show: z$1.ZodDefault<z$1.ZodBoolean>;
1990
+ origin: z$1.ZodOptional<z$1.ZodString>;
1991
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1992
+ }, z$1.core.$strip>, z$1.ZodObject<{
1993
+ description: z$1.ZodString;
1994
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1995
+ name: z$1.ZodString;
1996
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1997
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1998
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1999
+ }, z$1.core.$strip>>;
2000
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
2001
+ code: z$1.ZodOptional<z$1.ZodString>;
2002
+ type: z$1.ZodLiteral<"functionDescription">;
2003
+ origin: z$1.ZodOptional<z$1.ZodString>;
2004
+ peerId: z$1.ZodOptional<z$1.ZodString>;
2005
+ }, z$1.core.$strip>, z$1.ZodObject<{
2006
+ type: z$1.ZodLiteral<"taskyonReady">;
2007
+ origin: z$1.ZodOptional<z$1.ZodString>;
2008
+ peerId: z$1.ZodOptional<z$1.ZodString>;
2009
+ }, z$1.core.$strip>, z$1.ZodObject<{
2010
+ type: z$1.ZodLiteral<"file">;
2011
+ id: z$1.ZodString;
2012
+ name: z$1.ZodString;
2013
+ mime: z$1.ZodString;
2014
+ size: z$1.ZodNumber;
2015
+ store: z$1.ZodOptional<z$1.ZodEnum<{
2016
+ memory: "memory";
2017
+ opfs: "opfs";
2018
+ }>>;
2019
+ file: z$1.ZodFile;
2020
+ origin: z$1.ZodOptional<z$1.ZodString>;
2021
+ peerId: z$1.ZodOptional<z$1.ZodString>;
2022
+ }, z$1.core.$strip>, z$1.ZodObject<{
2023
+ type: z$1.ZodLiteral<"configurationMessage">;
2024
+ persist: z$1.ZodOptional<z$1.ZodBoolean>;
2025
+ conf: z$1.ZodUnion<readonly [z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodObject<{
2026
+ version: z$1.ZodLiteral<21>;
2027
+ appConfiguration: z$1.ZodObject<{
2028
+ darkTheme: z$1.ZodUnion<readonly [z$1.ZodLiteral<"auto">, z$1.ZodBoolean]>;
2029
+ appConfigurationUrl: z$1.ZodDefault<z$1.ZodString>;
2030
+ gdriveConfigurationFile: z$1.ZodDefault<z$1.ZodString>;
2031
+ enableGdriveSync: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
2032
+ expertMode: z$1.ZodDefault<z$1.ZodBoolean>;
2033
+ showCosts: z$1.ZodDefault<z$1.ZodBoolean>;
2034
+ gdriveDir: z$1.ZodDefault<z$1.ZodString>;
2035
+ showLogo: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
2036
+ welcomeMsg: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
2037
+ chatSuggestions: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
2038
+ url: z$1.ZodString;
2039
+ label: z$1.ZodString;
2040
+ }, z$1.core.$strip>, z$1.ZodObject<{
2041
+ md: z$1.ZodString;
2042
+ label: z$1.ZodString;
2043
+ }, z$1.core.$strip>]>>>>;
2044
+ useEnterToSend: z$1.ZodDefault<z$1.ZodEnum<{
2045
+ shift: "shift";
2046
+ auto: "auto";
2047
+ on: "on";
2048
+ off: "off";
2049
+ }>>;
2050
+ guiMode: z$1.ZodDefault<z$1.ZodEnum<{
2051
+ default: "default";
2052
+ auto: "auto";
2053
+ iframe: "iframe";
2054
+ minChat: "minChat";
2055
+ }>>;
2056
+ primaryColor: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
2057
+ secondaryColor: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
2058
+ }, z$1.core.$strip>;
2059
+ llmSettings: z$1.ZodObject<{
2060
+ userId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
2061
+ allowWebSearch: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
2062
+ secretPublicKey: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
2063
+ selectedTaskId: z$1.ZodOptional<z$1.ZodString>;
2064
+ enableOpenAiTools: z$1.ZodDefault<z$1.ZodBoolean>;
2065
+ selectedApi: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
2066
+ llmApis: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
2067
+ name: z$1.ZodString;
2068
+ baseURL: z$1.ZodString;
2069
+ defaultModel: z$1.ZodString;
2070
+ selectedModel: z$1.ZodOptional<z$1.ZodString>;
2071
+ models: z$1.ZodOptional<z$1.ZodObject<{
2072
+ instruction: z$1.ZodOptional<z$1.ZodString>;
2073
+ chat: z$1.ZodOptional<z$1.ZodString>;
2074
+ free: z$1.ZodOptional<z$1.ZodString>;
2075
+ }, z$1.core.$strip>>;
2076
+ streamSupport: z$1.ZodBoolean;
2077
+ defaultHeaders: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
2078
+ routes: z$1.ZodObject<{
2079
+ chatCompletion: z$1.ZodString;
2080
+ models: z$1.ZodString;
2081
+ }, z$1.core.$strip>;
2082
+ }, z$1.core.$strip>>>;
2083
+ siteUrl: z$1.ZodDefault<z$1.ZodString>;
2084
+ summaryModel: z$1.ZodDefault<z$1.ZodString>;
2085
+ vectorizationModel: z$1.ZodDefault<z$1.ZodString>;
2086
+ maxAutonomousTasks: z$1.ZodDefault<z$1.ZodNumber>;
2087
+ entryNode: z$1.ZodOptional<z$1.ZodObject<{
2088
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
2089
+ function: "function";
2090
+ system: "system";
2091
+ user: "user";
2092
+ assistant: "assistant";
2093
+ }>>>;
2094
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2095
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
2096
+ type: z$1.ZodLiteral<"message">;
2097
+ data: z$1.ZodString;
2098
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
2099
+ type: z$1.ZodLiteral<"url_citation">;
2100
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
2101
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
2102
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
2103
+ title: z$1.ZodOptional<z$1.ZodString>;
2104
+ url: z$1.ZodOptional<z$1.ZodString>;
2105
+ content: z$1.ZodOptional<z$1.ZodString>;
2106
+ }, z$1.core.$strip>>;
2107
+ }, z$1.core.$strip>, z$1.ZodObject<{
2108
+ type: z$1.ZodLiteral<"file">;
2109
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2110
+ text: z$1.ZodString;
2111
+ type: z$1.ZodString;
2112
+ }, z$1.core.$strip>>>;
2113
+ }, z$1.core.$strip>]>>>;
2114
+ }, z$1.core.$strict>, z$1.ZodObject<{
2115
+ type: z$1.ZodLiteral<"toolresult">;
2116
+ data: z$1.ZodUnknown;
2117
+ }, z$1.core.$strict>, z$1.ZodObject<{
2118
+ type: z$1.ZodLiteral<"tooldefinition">;
2119
+ data: z$1.ZodObject<{
2120
+ description: z$1.ZodString;
2121
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
2122
+ name: z$1.ZodString;
2123
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
2124
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
2125
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
2126
+ }, z$1.core.$strip>>;
2127
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
2128
+ code: z$1.ZodOptional<z$1.ZodString>;
2129
+ }, z$1.core.$strip>;
2130
+ }, z$1.core.$strict>, z$1.ZodObject<{
2131
+ type: z$1.ZodLiteral<"error">;
2132
+ data: z$1.ZodUnknown;
2133
+ }, z$1.core.$strict>, z$1.ZodObject<{
2134
+ type: z$1.ZodLiteral<"structured">;
2135
+ data: z$1.ZodUnknown;
2136
+ }, z$1.core.$strict>, z$1.ZodObject<{
2137
+ type: z$1.ZodLiteral<"functioncall">;
2138
+ data: z$1.ZodObject<{
2139
+ name: z$1.ZodString;
2140
+ arguments: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodArray<z$1.ZodUnknown>, z$1.ZodNull, z$1.ZodUndefined]>>;
2141
+ }, z$1.core.$strip>;
2142
+ }, z$1.core.$strict>, z$1.ZodObject<{
2143
+ type: z$1.ZodLiteral<"files">;
2144
+ data: z$1.ZodArray<z$1.ZodString>;
2145
+ }, z$1.core.$strict>, z$1.ZodObject<{
2146
+ type: z$1.ZodLiteral<"return">;
2147
+ data: z$1.ZodString;
2148
+ }, z$1.core.$strict>]>>>;
2149
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
2150
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2151
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2152
+ id: z$1.ZodOptional<z$1.ZodString>;
2153
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2154
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
2155
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
2156
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2157
+ }, z$1.core.$strip>>;
2158
+ enableToolChooser: z$1.ZodDefault<z$1.ZodBoolean>;
2159
+ useBasePrompt: z$1.ZodDefault<z$1.ZodBoolean>;
2160
+ tryUsingVisionModels: z$1.ZodDefault<z$1.ZodBoolean>;
2161
+ taskChatTemplates: z$1.ZodObject<{
2162
+ basePrompt: z$1.ZodString;
2163
+ instruction: z$1.ZodString;
2164
+ toolResult: z$1.ZodString;
2165
+ task: z$1.ZodString;
2166
+ evaluate: z$1.ZodString;
2167
+ schemaReminder: z$1.ZodString;
2168
+ tools: z$1.ZodString;
2169
+ }, z$1.core.$strip>;
2170
+ }, z$1.core.$strip>;
2171
+ toolchainConfig: z$1.ZodObject<{
2172
+ tools: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodJSONSchema>>;
2173
+ }, z$1.core.$strip>;
2174
+ signatureOrKey: z$1.ZodOptional<z$1.ZodString>;
2175
+ }, z$1.core.$strip>]>;
2176
+ origin: z$1.ZodOptional<z$1.ZodString>;
2177
+ peerId: z$1.ZodOptional<z$1.ZodString>;
2178
+ }, z$1.core.$strip>]>;
2179
+ type TaskyonGuiMessage = z$1.infer<typeof TaskyonGuiMessage>;
2180
+
2181
+ interface TyClient {
2182
+ processTasks: ReturnType<typeof processTasks>;
2183
+ port: Port<TaskyonGuiMessage, TaskyonGuiMessage>;
2184
+ sendFile: (file: File) => Promise<string>;
2185
+ }
2186
+ declare function initializeTaskyon(options: {
2187
+ name?: string;
2188
+ persist?: boolean;
2189
+ tools: ClientTool[];
2190
+ configuration: partialTyConfiguration;
2191
+ }): Promise<TyClient>;
2192
+
2193
+ export { type ClientTool, TaskyonGuiMessage, TaskyonMessage, type TyClient, createChatCompletionTask, createTool, initializeTaskyon, makeTaskResult, partialTaskDraft, type partialTyConfiguration, processTasks, toolCall };