@taskyon/tyclient 0.4.6 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2213 @@
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';
8
+
9
+ /**
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>;
26
+ }
27
+ type frpBus<T> = {
28
+ stream: Stream<T>;
29
+ emit: <U extends T>(value: U) => void;
30
+ };
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;
35
+ };
36
+
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>;
42
+ };
43
+ /**
44
+ * Type representing a thunk: a function that takes no arguments and returns T.
45
+ */
46
+ type Thunk<T> = () => T;
47
+
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;
207
+ };
208
+ interface TaskTreeNode {
209
+ task: TaskNode;
210
+ children: TaskTreeNode[][];
211
+ }
212
+
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>;
230
+
231
+ /**
232
+ * Represents the context passed to tools within the Taskyon system.
233
+ *
234
+ * @property taskChain - The sequence of TaskNode objects representing the current chain of tasks.
235
+ * @property getSecret - Retrieves a secret value by name. If `askNew` is `true`, prompts for a new secret if it doesn't exist.
236
+ * If `askNew` is a string, uses the string as a custom message or hint when prompting for the secret.
237
+ * @param name - The name of the secret to retrieve.
238
+ * @param askNew - If `true`, prompts for a new secret if not found. If a string, uses it as a hint or message when prompting.
239
+ * @returns A promise resolving to the secret value, or `undefined` if not found.
240
+ *
241
+ * @property setSecret - Stores a secret value by name.
242
+ * @param name - The name of the secret to store.
243
+ * @param value - The secret value to store.
244
+ * @returns A promise that resolves when the secret is stored.
245
+ * @property stopSignal - An AbortSignal that can be used to detect if the tool should stop execution.
246
+ * @property toolId - The unique identifier for the tool instance.
247
+ */
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;
255
+ };
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;
358
+
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
+ tools?: unknown[] | undefined;
590
+ } | null>;
591
+ metaLiveRead: (id: string | number) => Stream<{
592
+ id: string | number;
593
+ data: {
594
+ threadMessage?: any;
595
+ promptTokens?: number | undefined;
596
+ resultTokens?: number | undefined;
597
+ taskTokens?: number | undefined;
598
+ name?: string | undefined;
599
+ summary?: string | undefined;
600
+ estimatedTokens?: {
601
+ resultTokens?: number | undefined;
602
+ taskCosts?: number | undefined;
603
+ functionTokens?: number | undefined;
604
+ promptTokens?: number | undefined;
605
+ singlePromptTokens?: number | undefined;
606
+ } | undefined;
607
+ toolStreamArgsContent?: Record<string, string> | undefined;
608
+ streamContent?: string | undefined;
609
+ taskCosts?: number | undefined;
610
+ rawOutput?: unknown;
611
+ error?: unknown;
612
+ taskPrompt?: Record<string, unknown> | undefined;
613
+ tools?: unknown[] | undefined;
614
+ } | null;
615
+ }>;
616
+ metaUpsert: (id: string | number, data: {
617
+ threadMessage?: any;
618
+ promptTokens?: number | undefined;
619
+ resultTokens?: number | undefined;
620
+ taskTokens?: number | undefined;
621
+ name?: string | undefined;
622
+ summary?: string | undefined;
623
+ estimatedTokens?: {
624
+ resultTokens?: number | undefined;
625
+ taskCosts?: number | undefined;
626
+ functionTokens?: number | undefined;
627
+ promptTokens?: number | undefined;
628
+ singlePromptTokens?: number | undefined;
629
+ } | undefined;
630
+ toolStreamArgsContent?: Record<string, string> | undefined;
631
+ streamContent?: string | undefined;
632
+ taskCosts?: number | undefined;
633
+ rawOutput?: unknown;
634
+ error?: unknown;
635
+ taskPrompt?: Record<string, unknown> | undefined;
636
+ tools?: unknown[] | undefined;
637
+ }, strategy?: "shallow_merge" | "replace" | "deepmerge" | "native_shallow") => Promise<{
638
+ threadMessage?: any;
639
+ promptTokens?: number | undefined;
640
+ resultTokens?: number | undefined;
641
+ taskTokens?: number | undefined;
642
+ name?: string | undefined;
643
+ summary?: string | undefined;
644
+ estimatedTokens?: {
645
+ resultTokens?: number | undefined;
646
+ taskCosts?: number | undefined;
647
+ functionTokens?: number | undefined;
648
+ promptTokens?: number | undefined;
649
+ singlePromptTokens?: number | undefined;
650
+ } | undefined;
651
+ toolStreamArgsContent?: Record<string, string> | undefined;
652
+ streamContent?: string | undefined;
653
+ taskCosts?: number | undefined;
654
+ rawOutput?: unknown;
655
+ error?: unknown;
656
+ taskPrompt?: Record<string, unknown> | undefined;
657
+ tools?: unknown[] | undefined;
658
+ }>;
659
+ addFiles: (newFiles: File[], storage: "memory" | "opfs") => Promise<string[]>;
660
+ searchFiles: (where: {
661
+ id?: string;
662
+ name?: string;
663
+ size?: number;
664
+ opfs?: string;
665
+ openAIFileId?: string;
666
+ type?: string;
667
+ data?: string;
668
+ }, opts?: {
669
+ allowedIDs?: (string | number)[];
670
+ limit?: number;
671
+ offset?: number;
672
+ orderBy?: {
673
+ kind: "id";
674
+ } | {
675
+ kind: "dataKey";
676
+ key: "name" | "type" | "id" | "data" | "size" | "opfs" | "openAIFileId";
677
+ };
678
+ orderDir?: "asc" | "desc";
679
+ } | undefined) => Promise<Record<string, FileMapping>>;
680
+ getFileMappingByUuid: (uuid: string) => Promise<FileMapping | null>;
681
+ getUploadedFile: (id: string) => Promise<File | undefined>;
682
+ getFileByName: (name: string) => Promise<File>;
683
+ addDefaultTools: (defaultTools: InternalTool[]) => void;
684
+ getToolDefinition: (name: string) => Promise<{
685
+ def?: TaskNodeType<"tooldefinition"> | undefined;
686
+ tool?: InternalTool;
687
+ }>;
688
+ getTask: (id: string | number) => Promise<{
689
+ role: "function" | "system" | "user" | "assistant";
690
+ content: {
691
+ type: "message";
692
+ data: string;
693
+ ann?: ({
694
+ type: "url_citation";
695
+ url_citation?: {
696
+ end_index?: number | undefined;
697
+ start_index?: number | undefined;
698
+ title?: string | undefined;
699
+ url?: string | undefined;
700
+ content?: string | undefined;
701
+ } | undefined;
702
+ } | {
703
+ type: "file";
704
+ content?: {
705
+ text: string;
706
+ type: string;
707
+ }[] | undefined;
708
+ })[] | undefined;
709
+ } | {
710
+ type: "toolresult";
711
+ data: unknown;
712
+ } | {
713
+ type: "tooldefinition";
714
+ data: {
715
+ description: string;
716
+ name: string;
717
+ parameters: Readonly<json_schema.JSONSchema7>;
718
+ longDescription?: string | undefined;
719
+ renderOptions?: {
720
+ hideChat?: boolean | undefined;
721
+ hideLlm?: boolean | undefined;
722
+ } | undefined;
723
+ code?: string | undefined;
724
+ };
725
+ } | {
726
+ type: "error";
727
+ data: unknown;
728
+ } | {
729
+ type: "structured";
730
+ data: unknown;
731
+ } | {
732
+ type: "functioncall";
733
+ data: {
734
+ name: string;
735
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
736
+ };
737
+ } | {
738
+ type: "files";
739
+ data: string[];
740
+ } | {
741
+ type: "return";
742
+ data: string;
743
+ };
744
+ id: string;
745
+ name?: string | undefined;
746
+ label?: string[] | undefined;
747
+ parentID?: string | undefined;
748
+ priorID?: string | undefined;
749
+ authorId?: string | undefined;
750
+ created_at?: number | undefined;
751
+ acl?: string[] | undefined;
752
+ sig?: string | undefined;
753
+ } | null>;
754
+ deleteTask: (id: string | number) => Promise<void>;
755
+ searchTasks: (where: PartialDeep<TaskNode>) => Promise<Record<string, TaskNode>>;
756
+ taskStream: Stream<{
757
+ id: string | number;
758
+ data: {
759
+ role: "function" | "system" | "user" | "assistant";
760
+ content: {
761
+ type: "message";
762
+ data: string;
763
+ ann?: ({
764
+ type: "url_citation";
765
+ url_citation?: {
766
+ end_index?: number | undefined;
767
+ start_index?: number | undefined;
768
+ title?: string | undefined;
769
+ url?: string | undefined;
770
+ content?: string | undefined;
771
+ } | undefined;
772
+ } | {
773
+ type: "file";
774
+ content?: {
775
+ text: string;
776
+ type: string;
777
+ }[] | undefined;
778
+ })[] | undefined;
779
+ } | {
780
+ type: "toolresult";
781
+ data: unknown;
782
+ } | {
783
+ type: "tooldefinition";
784
+ data: {
785
+ description: string;
786
+ name: string;
787
+ parameters: Readonly<json_schema.JSONSchema7>;
788
+ longDescription?: string | undefined;
789
+ renderOptions?: {
790
+ hideChat?: boolean | undefined;
791
+ hideLlm?: boolean | undefined;
792
+ } | undefined;
793
+ code?: string | undefined;
794
+ };
795
+ } | {
796
+ type: "error";
797
+ data: unknown;
798
+ } | {
799
+ type: "structured";
800
+ data: unknown;
801
+ } | {
802
+ type: "functioncall";
803
+ data: {
804
+ name: string;
805
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
806
+ };
807
+ } | {
808
+ type: "files";
809
+ data: string[];
810
+ } | {
811
+ type: "return";
812
+ data: string;
813
+ };
814
+ id: string;
815
+ name?: string | undefined;
816
+ label?: string[] | undefined;
817
+ parentID?: string | undefined;
818
+ priorID?: string | undefined;
819
+ authorId?: string | undefined;
820
+ created_at?: number | undefined;
821
+ acl?: string[] | undefined;
822
+ sig?: string | undefined;
823
+ } | null;
824
+ }>;
825
+ updateToolDefinitions: <T extends boolean>(removeFunctionProperty?: T) => Promise<T extends true ? Record<string, ToolBase> : Record<string, ToolBase | InternalTool>>;
826
+ getJsonTaskBackup: () => Promise<string>;
827
+ addTaskBackup: (jsonObjString: string) => Promise<void>;
828
+ deleteAllTasks: () => Promise<void>;
829
+ deleteTaskThread: (leafId: string) => Promise<void>;
830
+ countTasks: () => Promise<number>;
831
+ syncVectorIndexWithTasks: (progressCallback: (done: number, total: number) => void) => Promise<void>;
832
+ resetTaskVectors: () => Promise<void>;
833
+ countVecs: () => Promise<number>;
834
+ filteredVectorSearch: (searchTerm: string, k?: number, taskTemplate?: PartialDeep<TaskNode>) => Promise<{
835
+ taskId: string;
836
+ distance: number;
837
+ }[]>;
838
+ findSiblingLeafTasks: (taskId: string) => Promise<string[]>;
839
+ searchNextSibling: (key: string) => Promise<Set<string>>;
840
+ searchAllDirectChildren: (key: string) => Promise<Set<string>>;
841
+ searchAllChildren: (key: string) => Promise<Set<string>>;
842
+ searchSimilarTasks: (task: Partial<TaskNode>, k?: number) => Promise<{
843
+ taskId: string;
844
+ distance: number;
845
+ }[]>;
846
+ filterSearch: (k?: number, taskTemplate?: PartialDeep<TaskNode>) => Promise<{
847
+ taskId: string;
848
+ distance: 0;
849
+ }[]>;
850
+ loadYamlConversation: (input: File | string) => Promise<string | undefined>;
851
+ }>;
852
+ type TyTaskManager = Awaited<ReturnType<typeof useTyTaskManager>>;
853
+
854
+ type ChatCompletionChunk = {
855
+ id: string;
856
+ object: 'chat.completion.chunk';
857
+ created: number;
858
+ model: string;
859
+ system_fingerprint?: string;
860
+ provider?: string;
861
+ choices: Array<{
862
+ index: number;
863
+ delta: {
864
+ role?: 'system' | 'user' | 'assistant' | 'tool' | 'developer';
865
+ content?: string | null;
866
+ refusal?: string | null;
867
+ tool_calls?: Array<{
868
+ index: number;
869
+ id?: string;
870
+ type?: 'function';
871
+ function?: {
872
+ name?: string;
873
+ arguments?: string;
874
+ };
875
+ }>;
876
+ reasoning?: string;
877
+ reasoning_details?: Array<{
878
+ type: string;
879
+ text: string;
880
+ format?: string;
881
+ index?: number;
882
+ }>;
883
+ annotations?: Array<{
884
+ type: 'url_citation';
885
+ url_citation: {
886
+ end_index?: number;
887
+ start_index?: number;
888
+ title: string;
889
+ url: string;
890
+ content: string;
891
+ };
892
+ }>;
893
+ };
894
+ finish_reason?: 'stop' | 'length' | 'content_filter' | 'tool_calls' | 'function_call' | null;
895
+ native_finish_reason?: string | null;
896
+ logprobs?: unknown;
897
+ }>;
898
+ };
899
+
900
+ declare const llmSettings: z.ZodObject<{
901
+ userId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
902
+ allowWebSearch: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
903
+ secretPublicKey: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
904
+ selectedTaskId: z.ZodOptional<z.ZodString>;
905
+ enableOpenAiTools: z.ZodDefault<z.ZodBoolean>;
906
+ selectedApi: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
907
+ llmApis: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
908
+ name: z.ZodString;
909
+ baseURL: z.ZodString;
910
+ defaultModel: z.ZodString;
911
+ selectedModel: z.ZodOptional<z.ZodString>;
912
+ models: z.ZodOptional<z.ZodObject<{
913
+ instruction: z.ZodOptional<z.ZodString>;
914
+ chat: z.ZodOptional<z.ZodString>;
915
+ free: z.ZodOptional<z.ZodString>;
916
+ }, z.core.$strip>>;
917
+ streamSupport: z.ZodBoolean;
918
+ defaultHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
919
+ routes: z.ZodObject<{
920
+ chatCompletion: z.ZodString;
921
+ models: z.ZodString;
922
+ }, z.core.$strip>;
923
+ }, z.core.$strip>>>;
924
+ siteUrl: z.ZodDefault<z.ZodString>;
925
+ summaryModel: z.ZodDefault<z.ZodString>;
926
+ vectorizationModel: z.ZodDefault<z.ZodString>;
927
+ maxAutonomousTasks: z.ZodDefault<z.ZodNumber>;
928
+ entryNode: z.ZodOptional<z.ZodObject<{
929
+ role: z.ZodNonOptional<z.ZodOptional<z.ZodEnum<{
930
+ function: "function";
931
+ system: "system";
932
+ user: "user";
933
+ assistant: "assistant";
934
+ }>>>;
935
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
936
+ content: z.ZodNonOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
937
+ type: z.ZodLiteral<"message">;
938
+ data: z.ZodString;
939
+ ann: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
940
+ type: z.ZodLiteral<"url_citation">;
941
+ url_citation: z.ZodOptional<z.ZodObject<{
942
+ end_index: z.ZodOptional<z.ZodNumber>;
943
+ start_index: z.ZodOptional<z.ZodNumber>;
944
+ title: z.ZodOptional<z.ZodString>;
945
+ url: z.ZodOptional<z.ZodString>;
946
+ content: z.ZodOptional<z.ZodString>;
947
+ }, z.core.$strip>>;
948
+ }, z.core.$strip>, z.ZodObject<{
949
+ type: z.ZodLiteral<"file">;
950
+ content: z.ZodOptional<z.ZodArray<z.ZodObject<{
951
+ text: z.ZodString;
952
+ type: z.ZodString;
953
+ }, z.core.$strip>>>;
954
+ }, z.core.$strip>]>>>;
955
+ }, z.core.$strict>, z.ZodObject<{
956
+ type: z.ZodLiteral<"toolresult">;
957
+ data: z.ZodUnknown;
958
+ }, z.core.$strict>, z.ZodObject<{
959
+ type: z.ZodLiteral<"tooldefinition">;
960
+ data: z.ZodObject<{
961
+ description: z.ZodString;
962
+ longDescription: z.ZodOptional<z.ZodString>;
963
+ name: z.ZodString;
964
+ renderOptions: z.ZodOptional<z.ZodObject<{
965
+ hideChat: z.ZodOptional<z.ZodBoolean>;
966
+ hideLlm: z.ZodOptional<z.ZodBoolean>;
967
+ }, z.core.$strip>>;
968
+ parameters: z.ZodReadonly<z.ZodType<json_schema.JSONSchema7, unknown, z.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
969
+ code: z.ZodOptional<z.ZodString>;
970
+ }, z.core.$strip>;
971
+ }, z.core.$strict>, z.ZodObject<{
972
+ type: z.ZodLiteral<"error">;
973
+ data: z.ZodUnknown;
974
+ }, z.core.$strict>, z.ZodObject<{
975
+ type: z.ZodLiteral<"structured">;
976
+ data: z.ZodUnknown;
977
+ }, z.core.$strict>, z.ZodObject<{
978
+ type: z.ZodLiteral<"functioncall">;
979
+ data: z.ZodObject<{
980
+ name: z.ZodString;
981
+ 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]>>;
982
+ }, z.core.$strip>;
983
+ }, z.core.$strict>, z.ZodObject<{
984
+ type: z.ZodLiteral<"files">;
985
+ data: z.ZodArray<z.ZodString>;
986
+ }, z.core.$strict>, z.ZodObject<{
987
+ type: z.ZodLiteral<"return">;
988
+ data: z.ZodString;
989
+ }, z.core.$strict>]>>>;
990
+ label: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
991
+ parentID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
992
+ priorID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
993
+ id: z.ZodOptional<z.ZodString>;
994
+ authorId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
995
+ created_at: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
996
+ acl: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
997
+ sig: z.ZodOptional<z.ZodOptional<z.ZodString>>;
998
+ }, z.core.$strip>>;
999
+ enableToolChooser: z.ZodDefault<z.ZodBoolean>;
1000
+ useBasePrompt: z.ZodDefault<z.ZodBoolean>;
1001
+ tryUsingVisionModels: z.ZodDefault<z.ZodBoolean>;
1002
+ taskChatTemplates: z.ZodObject<{
1003
+ basePrompt: z.ZodString;
1004
+ instruction: z.ZodString;
1005
+ toolResult: z.ZodString;
1006
+ task: z.ZodString;
1007
+ evaluate: z.ZodString;
1008
+ schemaReminder: z.ZodString;
1009
+ tools: z.ZodString;
1010
+ }, z.core.$strip>;
1011
+ }, z.core.$strip>;
1012
+ type llmSettings = z.infer<typeof llmSettings>;
1013
+
1014
+ declare function createChatCompletionTool(llmSettings: Thunk<llmSettings>, taskManager: TyTaskManager): Promise<{
1015
+ chatCompletion: {
1016
+ description: string;
1017
+ longDescription: string;
1018
+ name: string;
1019
+ renderOptions: {
1020
+ hideChat: true;
1021
+ hideLlm: true;
1022
+ };
1023
+ parameters: {
1024
+ readonly type: "object";
1025
+ readonly additionalProperties: false;
1026
+ readonly properties: {
1027
+ readonly model: {
1028
+ readonly type: "string";
1029
+ readonly description: "The name of the model to use for the completion. Optional, will choose default model if not provided";
1030
+ };
1031
+ readonly goal: {
1032
+ readonly enum: ["SimpleCompletion", "AnalyzeError", "ChooseTool", "AnalyzeToolResult", "WebSearch"];
1033
+ readonly description: "Optional Parameter to define the goal of the chat completion. If not set, the goal is dynamically inferred from the input.";
1034
+ };
1035
+ readonly llmTools: {
1036
+ readonly type: "boolean";
1037
+ readonly description: "Optional Parameter. If set to true, we will use a openai compatible tool api. If undefined, it will be treated as false.";
1038
+ };
1039
+ readonly allowedTools: {
1040
+ readonly type: "array";
1041
+ readonly description: "Optional Parameter. We can specify which tools are allowed to be called by the LLM";
1042
+ readonly items: {
1043
+ readonly type: "string";
1044
+ };
1045
+ };
1046
+ readonly prompts: {
1047
+ readonly type: "array";
1048
+ 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.";
1049
+ readonly items: {
1050
+ readonly type: "string";
1051
+ };
1052
+ };
1053
+ readonly schema: {
1054
+ readonly type: "object";
1055
+ readonly description: "A json schema object which we can use to generate a specific response and parse it.";
1056
+ readonly additionalProperties: true;
1057
+ };
1058
+ readonly reasoning_effort: {
1059
+ readonly enum: ["low", "high", "medium"];
1060
+ readonly description: "How many reasoning tokens should models with reasonin capability use?";
1061
+ };
1062
+ readonly verbosity: {
1063
+ readonly type: "string";
1064
+ readonly enum: ["low", "high", "medium"];
1065
+ readonly description: "how verbose should the reponse be?";
1066
+ };
1067
+ readonly use_multimodal: {
1068
+ readonly type: "boolean";
1069
+ readonly description: "Allow models to use their vision/audio document undestanding capabilities if their are any files in the prompt.";
1070
+ };
1071
+ };
1072
+ };
1073
+ function: (opts: {
1074
+ model?: string;
1075
+ schema?: {
1076
+ [x: string]: unknown;
1077
+ };
1078
+ verbosity?: "high" | "medium" | "low";
1079
+ goal?: "SimpleCompletion" | "AnalyzeError" | "ChooseTool" | "AnalyzeToolResult" | "WebSearch";
1080
+ llmTools?: boolean;
1081
+ allowedTools?: string[];
1082
+ prompts?: string[];
1083
+ reasoning_effort?: "high" | "medium" | "low";
1084
+ use_multimodal?: boolean;
1085
+ }, context: toolContext) => Promise<{
1086
+ taskResultMarker: "*TY_TASKRESULT*";
1087
+ taskChainList: {
1088
+ role: "function" | "system" | "user" | "assistant";
1089
+ content: {
1090
+ type: "message";
1091
+ data: string;
1092
+ ann?: ({
1093
+ type: "url_citation";
1094
+ url_citation?: {
1095
+ end_index?: number | undefined;
1096
+ start_index?: number | undefined;
1097
+ title?: string | undefined;
1098
+ url?: string | undefined;
1099
+ content?: string | undefined;
1100
+ } | undefined;
1101
+ } | {
1102
+ type: "file";
1103
+ content?: {
1104
+ text: string;
1105
+ type: string;
1106
+ }[] | undefined;
1107
+ })[] | undefined;
1108
+ } | {
1109
+ type: "toolresult";
1110
+ data: unknown;
1111
+ } | {
1112
+ type: "tooldefinition";
1113
+ data: {
1114
+ description: string;
1115
+ name: string;
1116
+ parameters: Readonly<JSONSchema7>;
1117
+ longDescription?: string | undefined;
1118
+ renderOptions?: {
1119
+ hideChat?: boolean | undefined;
1120
+ hideLlm?: boolean | undefined;
1121
+ } | undefined;
1122
+ code?: string | undefined;
1123
+ };
1124
+ } | {
1125
+ type: "error";
1126
+ data: unknown;
1127
+ } | {
1128
+ type: "structured";
1129
+ data: unknown;
1130
+ } | {
1131
+ type: "functioncall";
1132
+ data: {
1133
+ name: string;
1134
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
1135
+ };
1136
+ } | {
1137
+ type: "files";
1138
+ data: string[];
1139
+ } | {
1140
+ type: "return";
1141
+ data: string;
1142
+ };
1143
+ name?: string | undefined;
1144
+ label?: string[] | undefined;
1145
+ parentID?: string | undefined;
1146
+ priorID?: string | undefined;
1147
+ id?: string | undefined;
1148
+ authorId?: string | undefined;
1149
+ created_at?: number | undefined;
1150
+ acl?: string[] | undefined;
1151
+ sig?: string | undefined;
1152
+ }[][];
1153
+ }>;
1154
+ };
1155
+ stream: Stream<{
1156
+ taskId: string;
1157
+ chunk: ChatCompletionChunk | undefined;
1158
+ }>;
1159
+ }>;
1160
+ type chatCompletionParams = FromSchema<Awaited<ReturnType<typeof createChatCompletionTool>>['chatCompletion']['parameters']>;
1161
+
1162
+ declare const TaskyonMessage: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
1163
+ type: z$1.ZodLiteral<"addTasks">;
1164
+ data: z$1.ZodType<Uint8Array<ArrayBuffer>>;
1165
+ info: z$1.ZodString;
1166
+ ids: z$1.ZodArray<z$1.ZodString>;
1167
+ }, z$1.core.$strip>, z$1.ZodObject<{
1168
+ type: z$1.ZodLiteral<"requestTask">;
1169
+ id: z$1.ZodString;
1170
+ }, z$1.core.$strip>, z$1.ZodObject<{
1171
+ type: z$1.ZodLiteral<"taskCreated">;
1172
+ task: z$1.ZodOptional<z$1.ZodObject<{
1173
+ role: z$1.ZodEnum<{
1174
+ function: "function";
1175
+ system: "system";
1176
+ user: "user";
1177
+ assistant: "assistant";
1178
+ }>;
1179
+ name: z$1.ZodOptional<z$1.ZodString>;
1180
+ content: z$1.ZodUnion<readonly [z$1.ZodObject<{
1181
+ type: z$1.ZodLiteral<"message">;
1182
+ data: z$1.ZodString;
1183
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1184
+ type: z$1.ZodLiteral<"url_citation">;
1185
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1186
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1187
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1188
+ title: z$1.ZodOptional<z$1.ZodString>;
1189
+ url: z$1.ZodOptional<z$1.ZodString>;
1190
+ content: z$1.ZodOptional<z$1.ZodString>;
1191
+ }, z$1.core.$strip>>;
1192
+ }, z$1.core.$strip>, z$1.ZodObject<{
1193
+ type: z$1.ZodLiteral<"file">;
1194
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1195
+ text: z$1.ZodString;
1196
+ type: z$1.ZodString;
1197
+ }, z$1.core.$strip>>>;
1198
+ }, z$1.core.$strip>]>>>;
1199
+ }, z$1.core.$strict>, z$1.ZodObject<{
1200
+ type: z$1.ZodLiteral<"toolresult">;
1201
+ data: z$1.ZodUnknown;
1202
+ }, z$1.core.$strict>, z$1.ZodObject<{
1203
+ type: z$1.ZodLiteral<"tooldefinition">;
1204
+ data: z$1.ZodObject<{
1205
+ description: z$1.ZodString;
1206
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1207
+ name: z$1.ZodString;
1208
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1209
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1210
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1211
+ }, z$1.core.$strip>>;
1212
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1213
+ code: z$1.ZodOptional<z$1.ZodString>;
1214
+ }, z$1.core.$strip>;
1215
+ }, z$1.core.$strict>, z$1.ZodObject<{
1216
+ type: z$1.ZodLiteral<"error">;
1217
+ data: z$1.ZodUnknown;
1218
+ }, z$1.core.$strict>, z$1.ZodObject<{
1219
+ type: z$1.ZodLiteral<"structured">;
1220
+ data: z$1.ZodUnknown;
1221
+ }, z$1.core.$strict>, z$1.ZodObject<{
1222
+ type: z$1.ZodLiteral<"functioncall">;
1223
+ data: z$1.ZodObject<{
1224
+ name: z$1.ZodString;
1225
+ 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]>>;
1226
+ }, z$1.core.$strip>;
1227
+ }, z$1.core.$strict>, z$1.ZodObject<{
1228
+ type: z$1.ZodLiteral<"files">;
1229
+ data: z$1.ZodArray<z$1.ZodString>;
1230
+ }, z$1.core.$strict>, z$1.ZodObject<{
1231
+ type: z$1.ZodLiteral<"return">;
1232
+ data: z$1.ZodString;
1233
+ }, z$1.core.$strict>]>;
1234
+ label: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1235
+ parentID: z$1.ZodOptional<z$1.ZodString>;
1236
+ priorID: z$1.ZodOptional<z$1.ZodString>;
1237
+ id: z$1.ZodString;
1238
+ authorId: z$1.ZodOptional<z$1.ZodString>;
1239
+ created_at: z$1.ZodOptional<z$1.ZodNumber>;
1240
+ acl: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1241
+ sig: z$1.ZodOptional<z$1.ZodString>;
1242
+ }, z$1.core.$strip>>;
1243
+ ids: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1244
+ info: z$1.ZodOptional<z$1.ZodString>;
1245
+ }, z$1.core.$strip>, z$1.ZodObject<{
1246
+ type: z$1.ZodLiteral<"status">;
1247
+ data: z$1.ZodObject<{
1248
+ type: z$1.ZodLiteral<"newtool">;
1249
+ id: z$1.ZodString;
1250
+ }, z$1.core.$strip>;
1251
+ origin: z$1.ZodOptional<z$1.ZodString>;
1252
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1253
+ }, z$1.core.$strip>, z$1.ZodObject<{
1254
+ functionName: z$1.ZodString;
1255
+ type: z$1.ZodLiteral<"functionCall">;
1256
+ 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]>>>;
1257
+ origin: z$1.ZodOptional<z$1.ZodString>;
1258
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1259
+ }, z$1.core.$strip>, z$1.ZodObject<{
1260
+ functionName: z$1.ZodString;
1261
+ type: z$1.ZodLiteral<"functionResponse">;
1262
+ response: z$1.ZodOptional<z$1.ZodUnknown>;
1263
+ error: z$1.ZodOptional<z$1.ZodUnknown>;
1264
+ origin: z$1.ZodOptional<z$1.ZodString>;
1265
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1266
+ }, z$1.core.$strip>, z$1.ZodObject<{
1267
+ type: z$1.ZodLiteral<"task">;
1268
+ task: z$1.ZodObject<{
1269
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1270
+ function: "function";
1271
+ system: "system";
1272
+ user: "user";
1273
+ assistant: "assistant";
1274
+ }>>>;
1275
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1276
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1277
+ type: z$1.ZodLiteral<"message">;
1278
+ data: z$1.ZodString;
1279
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1280
+ type: z$1.ZodLiteral<"url_citation">;
1281
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1282
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1283
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1284
+ title: z$1.ZodOptional<z$1.ZodString>;
1285
+ url: z$1.ZodOptional<z$1.ZodString>;
1286
+ content: z$1.ZodOptional<z$1.ZodString>;
1287
+ }, z$1.core.$strip>>;
1288
+ }, z$1.core.$strip>, z$1.ZodObject<{
1289
+ type: z$1.ZodLiteral<"file">;
1290
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1291
+ text: z$1.ZodString;
1292
+ type: z$1.ZodString;
1293
+ }, z$1.core.$strip>>>;
1294
+ }, z$1.core.$strip>]>>>;
1295
+ }, z$1.core.$strict>, z$1.ZodObject<{
1296
+ type: z$1.ZodLiteral<"toolresult">;
1297
+ data: z$1.ZodUnknown;
1298
+ }, z$1.core.$strict>, z$1.ZodObject<{
1299
+ type: z$1.ZodLiteral<"tooldefinition">;
1300
+ data: z$1.ZodObject<{
1301
+ description: z$1.ZodString;
1302
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1303
+ name: z$1.ZodString;
1304
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1305
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1306
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1307
+ }, z$1.core.$strip>>;
1308
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1309
+ code: z$1.ZodOptional<z$1.ZodString>;
1310
+ }, z$1.core.$strip>;
1311
+ }, z$1.core.$strict>, z$1.ZodObject<{
1312
+ type: z$1.ZodLiteral<"error">;
1313
+ data: z$1.ZodUnknown;
1314
+ }, z$1.core.$strict>, z$1.ZodObject<{
1315
+ type: z$1.ZodLiteral<"structured">;
1316
+ data: z$1.ZodUnknown;
1317
+ }, z$1.core.$strict>, z$1.ZodObject<{
1318
+ type: z$1.ZodLiteral<"functioncall">;
1319
+ data: z$1.ZodObject<{
1320
+ name: z$1.ZodString;
1321
+ 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]>>;
1322
+ }, z$1.core.$strip>;
1323
+ }, z$1.core.$strict>, z$1.ZodObject<{
1324
+ type: z$1.ZodLiteral<"files">;
1325
+ data: z$1.ZodArray<z$1.ZodString>;
1326
+ }, z$1.core.$strict>, z$1.ZodObject<{
1327
+ type: z$1.ZodLiteral<"return">;
1328
+ data: z$1.ZodString;
1329
+ }, z$1.core.$strict>]>>>;
1330
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1331
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1332
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1333
+ id: z$1.ZodOptional<z$1.ZodString>;
1334
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1335
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
1336
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1337
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1338
+ }, z$1.core.$strip>;
1339
+ execute: z$1.ZodDefault<z$1.ZodBoolean>;
1340
+ show: z$1.ZodDefault<z$1.ZodBoolean>;
1341
+ origin: z$1.ZodOptional<z$1.ZodString>;
1342
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1343
+ }, z$1.core.$strip>, z$1.ZodObject<{
1344
+ type: z$1.ZodLiteral<"tasks">;
1345
+ execute: z$1.ZodDefault<z$1.ZodBoolean>;
1346
+ tasks: z$1.ZodArray<z$1.ZodObject<{
1347
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1348
+ function: "function";
1349
+ system: "system";
1350
+ user: "user";
1351
+ assistant: "assistant";
1352
+ }>>>;
1353
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1354
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1355
+ type: z$1.ZodLiteral<"message">;
1356
+ data: z$1.ZodString;
1357
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1358
+ type: z$1.ZodLiteral<"url_citation">;
1359
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1360
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1361
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1362
+ title: z$1.ZodOptional<z$1.ZodString>;
1363
+ url: z$1.ZodOptional<z$1.ZodString>;
1364
+ content: z$1.ZodOptional<z$1.ZodString>;
1365
+ }, z$1.core.$strip>>;
1366
+ }, z$1.core.$strip>, z$1.ZodObject<{
1367
+ type: z$1.ZodLiteral<"file">;
1368
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1369
+ text: z$1.ZodString;
1370
+ type: z$1.ZodString;
1371
+ }, z$1.core.$strip>>>;
1372
+ }, z$1.core.$strip>]>>>;
1373
+ }, z$1.core.$strict>, z$1.ZodObject<{
1374
+ type: z$1.ZodLiteral<"toolresult">;
1375
+ data: z$1.ZodUnknown;
1376
+ }, z$1.core.$strict>, z$1.ZodObject<{
1377
+ type: z$1.ZodLiteral<"tooldefinition">;
1378
+ data: z$1.ZodObject<{
1379
+ description: z$1.ZodString;
1380
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1381
+ name: z$1.ZodString;
1382
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1383
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1384
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1385
+ }, z$1.core.$strip>>;
1386
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1387
+ code: z$1.ZodOptional<z$1.ZodString>;
1388
+ }, z$1.core.$strip>;
1389
+ }, z$1.core.$strict>, z$1.ZodObject<{
1390
+ type: z$1.ZodLiteral<"error">;
1391
+ data: z$1.ZodUnknown;
1392
+ }, z$1.core.$strict>, z$1.ZodObject<{
1393
+ type: z$1.ZodLiteral<"structured">;
1394
+ data: z$1.ZodUnknown;
1395
+ }, z$1.core.$strict>, z$1.ZodObject<{
1396
+ type: z$1.ZodLiteral<"functioncall">;
1397
+ data: z$1.ZodObject<{
1398
+ name: z$1.ZodString;
1399
+ 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]>>;
1400
+ }, z$1.core.$strip>;
1401
+ }, z$1.core.$strict>, z$1.ZodObject<{
1402
+ type: z$1.ZodLiteral<"files">;
1403
+ data: z$1.ZodArray<z$1.ZodString>;
1404
+ }, z$1.core.$strict>, z$1.ZodObject<{
1405
+ type: z$1.ZodLiteral<"return">;
1406
+ data: z$1.ZodString;
1407
+ }, z$1.core.$strict>]>>>;
1408
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1409
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1410
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1411
+ id: z$1.ZodOptional<z$1.ZodString>;
1412
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1413
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
1414
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1415
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1416
+ }, z$1.core.$strip>>;
1417
+ show: z$1.ZodDefault<z$1.ZodBoolean>;
1418
+ origin: z$1.ZodOptional<z$1.ZodString>;
1419
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1420
+ }, z$1.core.$strip>, z$1.ZodObject<{
1421
+ description: z$1.ZodString;
1422
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1423
+ name: z$1.ZodString;
1424
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1425
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1426
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1427
+ }, z$1.core.$strip>>;
1428
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1429
+ code: z$1.ZodOptional<z$1.ZodString>;
1430
+ type: z$1.ZodLiteral<"functionDescription">;
1431
+ origin: z$1.ZodOptional<z$1.ZodString>;
1432
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1433
+ }, z$1.core.$strip>, z$1.ZodObject<{
1434
+ type: z$1.ZodLiteral<"taskyonReady">;
1435
+ origin: z$1.ZodOptional<z$1.ZodString>;
1436
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1437
+ }, z$1.core.$strip>, z$1.ZodObject<{
1438
+ type: z$1.ZodLiteral<"file">;
1439
+ id: z$1.ZodString;
1440
+ name: z$1.ZodString;
1441
+ mime: z$1.ZodString;
1442
+ size: z$1.ZodNumber;
1443
+ store: z$1.ZodOptional<z$1.ZodEnum<{
1444
+ memory: "memory";
1445
+ opfs: "opfs";
1446
+ }>>;
1447
+ file: z$1.ZodFile;
1448
+ origin: z$1.ZodOptional<z$1.ZodString>;
1449
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1450
+ }, z$1.core.$strip>]>;
1451
+ type TaskyonMessage = z$1.infer<typeof TaskyonMessage>;
1452
+
1453
+ type processTasksOpts = {
1454
+ timeoutMs?: number;
1455
+ signal?: AbortSignal;
1456
+ quitCondition?: (t: TaskNode) => boolean;
1457
+ };
1458
+ declare const createChatCompletionTask: (args: chatCompletionParams) => {
1459
+ role: "function" | "system" | "user" | "assistant";
1460
+ content: {
1461
+ type: "message";
1462
+ data: string;
1463
+ ann?: ({
1464
+ type: "url_citation";
1465
+ url_citation?: {
1466
+ end_index?: number | undefined;
1467
+ start_index?: number | undefined;
1468
+ title?: string | undefined;
1469
+ url?: string | undefined;
1470
+ content?: string | undefined;
1471
+ } | undefined;
1472
+ } | {
1473
+ type: "file";
1474
+ content?: {
1475
+ text: string;
1476
+ type: string;
1477
+ }[] | undefined;
1478
+ })[] | undefined;
1479
+ } | {
1480
+ type: "toolresult";
1481
+ data: unknown;
1482
+ } | {
1483
+ type: "tooldefinition";
1484
+ data: {
1485
+ description: string;
1486
+ name: string;
1487
+ parameters: Readonly<json_schema.JSONSchema7>;
1488
+ longDescription?: string | undefined;
1489
+ renderOptions?: {
1490
+ hideChat?: boolean | undefined;
1491
+ hideLlm?: boolean | undefined;
1492
+ } | undefined;
1493
+ code?: string | undefined;
1494
+ };
1495
+ } | {
1496
+ type: "error";
1497
+ data: unknown;
1498
+ } | {
1499
+ type: "structured";
1500
+ data: unknown;
1501
+ } | {
1502
+ type: "functioncall";
1503
+ data: {
1504
+ name: string;
1505
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
1506
+ };
1507
+ } | {
1508
+ type: "files";
1509
+ data: string[];
1510
+ } | {
1511
+ type: "return";
1512
+ data: string;
1513
+ };
1514
+ name?: string | undefined;
1515
+ label?: string[] | undefined;
1516
+ parentID?: string | undefined;
1517
+ priorID?: string | undefined;
1518
+ id?: string | undefined;
1519
+ authorId?: string | undefined;
1520
+ created_at?: number | undefined;
1521
+ acl?: string[] | undefined;
1522
+ sig?: string | undefined;
1523
+ } & {
1524
+ content: {
1525
+ type: "functioncall";
1526
+ data: FunctionCall;
1527
+ };
1528
+ };
1529
+ declare const processTasks: <T extends {
1530
+ type: string;
1531
+ }>(tyPort: Port<T | TaskyonMessage>) => (taskList: partialTaskDraft[][], opts: processTasksOpts) => Promise<{
1532
+ role: "function" | "system" | "user" | "assistant";
1533
+ content: {
1534
+ type: "message";
1535
+ data: string;
1536
+ ann?: ({
1537
+ type: "url_citation";
1538
+ url_citation?: {
1539
+ end_index?: number | undefined;
1540
+ start_index?: number | undefined;
1541
+ title?: string | undefined;
1542
+ url?: string | undefined;
1543
+ content?: string | undefined;
1544
+ } | undefined;
1545
+ } | {
1546
+ type: "file";
1547
+ content?: {
1548
+ text: string;
1549
+ type: string;
1550
+ }[] | undefined;
1551
+ })[] | undefined;
1552
+ } | {
1553
+ type: "toolresult";
1554
+ data: unknown;
1555
+ } | {
1556
+ type: "tooldefinition";
1557
+ data: {
1558
+ description: string;
1559
+ name: string;
1560
+ parameters: Readonly<json_schema.JSONSchema7>;
1561
+ longDescription?: string | undefined;
1562
+ renderOptions?: {
1563
+ hideChat?: boolean | undefined;
1564
+ hideLlm?: boolean | undefined;
1565
+ } | undefined;
1566
+ code?: string | undefined;
1567
+ };
1568
+ } | {
1569
+ type: "error";
1570
+ data: unknown;
1571
+ } | {
1572
+ type: "structured";
1573
+ data: unknown;
1574
+ } | {
1575
+ type: "functioncall";
1576
+ data: {
1577
+ name: string;
1578
+ arguments: Record<string, string | number | boolean | Record<string, unknown> | unknown[] | null | undefined>;
1579
+ };
1580
+ } | {
1581
+ type: "files";
1582
+ data: string[];
1583
+ } | {
1584
+ type: "return";
1585
+ data: string;
1586
+ };
1587
+ id: string;
1588
+ name?: string | undefined;
1589
+ label?: string[] | undefined;
1590
+ parentID?: string | undefined;
1591
+ priorID?: string | undefined;
1592
+ authorId?: string | undefined;
1593
+ created_at?: number | undefined;
1594
+ acl?: string[] | undefined;
1595
+ sig?: string | undefined;
1596
+ } & {
1597
+ id: string;
1598
+ }>;
1599
+
1600
+ declare const TyProfile: z$1.ZodObject<{
1601
+ version: z$1.ZodLiteral<21>;
1602
+ appConfiguration: z$1.ZodObject<{
1603
+ darkTheme: z$1.ZodUnion<readonly [z$1.ZodLiteral<"auto">, z$1.ZodBoolean]>;
1604
+ appConfigurationUrl: z$1.ZodDefault<z$1.ZodString>;
1605
+ gdriveConfigurationFile: z$1.ZodDefault<z$1.ZodString>;
1606
+ enableGdriveSync: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
1607
+ expertMode: z$1.ZodDefault<z$1.ZodBoolean>;
1608
+ showCosts: z$1.ZodDefault<z$1.ZodBoolean>;
1609
+ gdriveDir: z$1.ZodDefault<z$1.ZodString>;
1610
+ showLogo: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
1611
+ welcomeMsg: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
1612
+ chatSuggestions: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1613
+ url: z$1.ZodString;
1614
+ label: z$1.ZodString;
1615
+ }, z$1.core.$strip>, z$1.ZodObject<{
1616
+ md: z$1.ZodString;
1617
+ label: z$1.ZodString;
1618
+ }, z$1.core.$strip>]>>>>;
1619
+ useEnterToSend: z$1.ZodDefault<z$1.ZodEnum<{
1620
+ shift: "shift";
1621
+ auto: "auto";
1622
+ on: "on";
1623
+ off: "off";
1624
+ }>>;
1625
+ guiMode: z$1.ZodDefault<z$1.ZodEnum<{
1626
+ default: "default";
1627
+ auto: "auto";
1628
+ iframe: "iframe";
1629
+ minChat: "minChat";
1630
+ }>>;
1631
+ primaryColor: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
1632
+ secondaryColor: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
1633
+ }, z$1.core.$strip>;
1634
+ llmSettings: z$1.ZodObject<{
1635
+ userId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
1636
+ allowWebSearch: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
1637
+ secretPublicKey: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
1638
+ selectedTaskId: z$1.ZodOptional<z$1.ZodString>;
1639
+ enableOpenAiTools: z$1.ZodDefault<z$1.ZodBoolean>;
1640
+ selectedApi: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
1641
+ llmApis: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
1642
+ name: z$1.ZodString;
1643
+ baseURL: z$1.ZodString;
1644
+ defaultModel: z$1.ZodString;
1645
+ selectedModel: z$1.ZodOptional<z$1.ZodString>;
1646
+ models: z$1.ZodOptional<z$1.ZodObject<{
1647
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1648
+ chat: z$1.ZodOptional<z$1.ZodString>;
1649
+ free: z$1.ZodOptional<z$1.ZodString>;
1650
+ }, z$1.core.$strip>>;
1651
+ streamSupport: z$1.ZodBoolean;
1652
+ defaultHeaders: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1653
+ routes: z$1.ZodObject<{
1654
+ chatCompletion: z$1.ZodString;
1655
+ models: z$1.ZodString;
1656
+ }, z$1.core.$strip>;
1657
+ }, z$1.core.$strip>>>;
1658
+ siteUrl: z$1.ZodDefault<z$1.ZodString>;
1659
+ summaryModel: z$1.ZodDefault<z$1.ZodString>;
1660
+ vectorizationModel: z$1.ZodDefault<z$1.ZodString>;
1661
+ maxAutonomousTasks: z$1.ZodDefault<z$1.ZodNumber>;
1662
+ entryNode: z$1.ZodOptional<z$1.ZodObject<{
1663
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1664
+ function: "function";
1665
+ system: "system";
1666
+ user: "user";
1667
+ assistant: "assistant";
1668
+ }>>>;
1669
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1670
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1671
+ type: z$1.ZodLiteral<"message">;
1672
+ data: z$1.ZodString;
1673
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1674
+ type: z$1.ZodLiteral<"url_citation">;
1675
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1676
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1677
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1678
+ title: z$1.ZodOptional<z$1.ZodString>;
1679
+ url: z$1.ZodOptional<z$1.ZodString>;
1680
+ content: z$1.ZodOptional<z$1.ZodString>;
1681
+ }, z$1.core.$strip>>;
1682
+ }, z$1.core.$strip>, z$1.ZodObject<{
1683
+ type: z$1.ZodLiteral<"file">;
1684
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1685
+ text: z$1.ZodString;
1686
+ type: z$1.ZodString;
1687
+ }, z$1.core.$strip>>>;
1688
+ }, z$1.core.$strip>]>>>;
1689
+ }, z$1.core.$strict>, z$1.ZodObject<{
1690
+ type: z$1.ZodLiteral<"toolresult">;
1691
+ data: z$1.ZodUnknown;
1692
+ }, z$1.core.$strict>, z$1.ZodObject<{
1693
+ type: z$1.ZodLiteral<"tooldefinition">;
1694
+ data: z$1.ZodObject<{
1695
+ description: z$1.ZodString;
1696
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1697
+ name: z$1.ZodString;
1698
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1699
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1700
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1701
+ }, z$1.core.$strip>>;
1702
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1703
+ code: z$1.ZodOptional<z$1.ZodString>;
1704
+ }, z$1.core.$strip>;
1705
+ }, z$1.core.$strict>, z$1.ZodObject<{
1706
+ type: z$1.ZodLiteral<"error">;
1707
+ data: z$1.ZodUnknown;
1708
+ }, z$1.core.$strict>, z$1.ZodObject<{
1709
+ type: z$1.ZodLiteral<"structured">;
1710
+ data: z$1.ZodUnknown;
1711
+ }, z$1.core.$strict>, z$1.ZodObject<{
1712
+ type: z$1.ZodLiteral<"functioncall">;
1713
+ data: z$1.ZodObject<{
1714
+ name: z$1.ZodString;
1715
+ 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]>>;
1716
+ }, z$1.core.$strip>;
1717
+ }, z$1.core.$strict>, z$1.ZodObject<{
1718
+ type: z$1.ZodLiteral<"files">;
1719
+ data: z$1.ZodArray<z$1.ZodString>;
1720
+ }, z$1.core.$strict>, z$1.ZodObject<{
1721
+ type: z$1.ZodLiteral<"return">;
1722
+ data: z$1.ZodString;
1723
+ }, z$1.core.$strict>]>>>;
1724
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1725
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1726
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1727
+ id: z$1.ZodOptional<z$1.ZodString>;
1728
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1729
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
1730
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1731
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1732
+ }, z$1.core.$strip>>;
1733
+ enableToolChooser: z$1.ZodDefault<z$1.ZodBoolean>;
1734
+ useBasePrompt: z$1.ZodDefault<z$1.ZodBoolean>;
1735
+ tryUsingVisionModels: z$1.ZodDefault<z$1.ZodBoolean>;
1736
+ taskChatTemplates: z$1.ZodObject<{
1737
+ basePrompt: z$1.ZodString;
1738
+ instruction: z$1.ZodString;
1739
+ toolResult: z$1.ZodString;
1740
+ task: z$1.ZodString;
1741
+ evaluate: z$1.ZodString;
1742
+ schemaReminder: z$1.ZodString;
1743
+ tools: z$1.ZodString;
1744
+ }, z$1.core.$strip>;
1745
+ }, z$1.core.$strip>;
1746
+ toolchainConfig: z$1.ZodObject<{
1747
+ tools: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodJSONSchema>>;
1748
+ }, z$1.core.$strip>;
1749
+ signatureOrKey: z$1.ZodOptional<z$1.ZodString>;
1750
+ }, z$1.core.$strip>;
1751
+ type TyProfile = z$1.infer<typeof TyProfile>;
1752
+
1753
+ type partialTyConfiguration = PartialDeep<TyProfile>;
1754
+ declare const TaskyonGuiMessage: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
1755
+ type: z$1.ZodLiteral<"addTasks">;
1756
+ data: z$1.ZodType<Uint8Array<ArrayBuffer>>;
1757
+ info: z$1.ZodString;
1758
+ ids: z$1.ZodArray<z$1.ZodString>;
1759
+ }, z$1.core.$strip>, z$1.ZodObject<{
1760
+ type: z$1.ZodLiteral<"requestTask">;
1761
+ id: z$1.ZodString;
1762
+ }, z$1.core.$strip>, z$1.ZodObject<{
1763
+ type: z$1.ZodLiteral<"taskCreated">;
1764
+ task: z$1.ZodOptional<z$1.ZodObject<{
1765
+ role: z$1.ZodEnum<{
1766
+ function: "function";
1767
+ system: "system";
1768
+ user: "user";
1769
+ assistant: "assistant";
1770
+ }>;
1771
+ name: z$1.ZodOptional<z$1.ZodString>;
1772
+ content: z$1.ZodUnion<readonly [z$1.ZodObject<{
1773
+ type: z$1.ZodLiteral<"message">;
1774
+ data: z$1.ZodString;
1775
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1776
+ type: z$1.ZodLiteral<"url_citation">;
1777
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1778
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1779
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1780
+ title: z$1.ZodOptional<z$1.ZodString>;
1781
+ url: z$1.ZodOptional<z$1.ZodString>;
1782
+ content: z$1.ZodOptional<z$1.ZodString>;
1783
+ }, z$1.core.$strip>>;
1784
+ }, z$1.core.$strip>, z$1.ZodObject<{
1785
+ type: z$1.ZodLiteral<"file">;
1786
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1787
+ text: z$1.ZodString;
1788
+ type: z$1.ZodString;
1789
+ }, z$1.core.$strip>>>;
1790
+ }, z$1.core.$strip>]>>>;
1791
+ }, z$1.core.$strict>, z$1.ZodObject<{
1792
+ type: z$1.ZodLiteral<"toolresult">;
1793
+ data: z$1.ZodUnknown;
1794
+ }, z$1.core.$strict>, z$1.ZodObject<{
1795
+ type: z$1.ZodLiteral<"tooldefinition">;
1796
+ data: z$1.ZodObject<{
1797
+ description: z$1.ZodString;
1798
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1799
+ name: z$1.ZodString;
1800
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1801
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1802
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1803
+ }, z$1.core.$strip>>;
1804
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1805
+ code: z$1.ZodOptional<z$1.ZodString>;
1806
+ }, z$1.core.$strip>;
1807
+ }, z$1.core.$strict>, z$1.ZodObject<{
1808
+ type: z$1.ZodLiteral<"error">;
1809
+ data: z$1.ZodUnknown;
1810
+ }, z$1.core.$strict>, z$1.ZodObject<{
1811
+ type: z$1.ZodLiteral<"structured">;
1812
+ data: z$1.ZodUnknown;
1813
+ }, z$1.core.$strict>, z$1.ZodObject<{
1814
+ type: z$1.ZodLiteral<"functioncall">;
1815
+ data: z$1.ZodObject<{
1816
+ name: z$1.ZodString;
1817
+ 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]>>;
1818
+ }, z$1.core.$strip>;
1819
+ }, z$1.core.$strict>, z$1.ZodObject<{
1820
+ type: z$1.ZodLiteral<"files">;
1821
+ data: z$1.ZodArray<z$1.ZodString>;
1822
+ }, z$1.core.$strict>, z$1.ZodObject<{
1823
+ type: z$1.ZodLiteral<"return">;
1824
+ data: z$1.ZodString;
1825
+ }, z$1.core.$strict>]>;
1826
+ label: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1827
+ parentID: z$1.ZodOptional<z$1.ZodString>;
1828
+ priorID: z$1.ZodOptional<z$1.ZodString>;
1829
+ id: z$1.ZodString;
1830
+ authorId: z$1.ZodOptional<z$1.ZodString>;
1831
+ created_at: z$1.ZodOptional<z$1.ZodNumber>;
1832
+ acl: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1833
+ sig: z$1.ZodOptional<z$1.ZodString>;
1834
+ }, z$1.core.$strip>>;
1835
+ ids: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1836
+ info: z$1.ZodOptional<z$1.ZodString>;
1837
+ }, z$1.core.$strip>, z$1.ZodObject<{
1838
+ type: z$1.ZodLiteral<"status">;
1839
+ data: z$1.ZodObject<{
1840
+ type: z$1.ZodLiteral<"newtool">;
1841
+ id: z$1.ZodString;
1842
+ }, z$1.core.$strip>;
1843
+ origin: z$1.ZodOptional<z$1.ZodString>;
1844
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1845
+ }, z$1.core.$strip>, z$1.ZodObject<{
1846
+ functionName: z$1.ZodString;
1847
+ type: z$1.ZodLiteral<"functionCall">;
1848
+ 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]>>>;
1849
+ origin: z$1.ZodOptional<z$1.ZodString>;
1850
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1851
+ }, z$1.core.$strip>, z$1.ZodObject<{
1852
+ functionName: z$1.ZodString;
1853
+ type: z$1.ZodLiteral<"functionResponse">;
1854
+ response: z$1.ZodOptional<z$1.ZodUnknown>;
1855
+ error: z$1.ZodOptional<z$1.ZodUnknown>;
1856
+ origin: z$1.ZodOptional<z$1.ZodString>;
1857
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1858
+ }, z$1.core.$strip>, z$1.ZodObject<{
1859
+ type: z$1.ZodLiteral<"task">;
1860
+ task: z$1.ZodObject<{
1861
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1862
+ function: "function";
1863
+ system: "system";
1864
+ user: "user";
1865
+ assistant: "assistant";
1866
+ }>>>;
1867
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1868
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1869
+ type: z$1.ZodLiteral<"message">;
1870
+ data: z$1.ZodString;
1871
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1872
+ type: z$1.ZodLiteral<"url_citation">;
1873
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1874
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1875
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1876
+ title: z$1.ZodOptional<z$1.ZodString>;
1877
+ url: z$1.ZodOptional<z$1.ZodString>;
1878
+ content: z$1.ZodOptional<z$1.ZodString>;
1879
+ }, z$1.core.$strip>>;
1880
+ }, z$1.core.$strip>, z$1.ZodObject<{
1881
+ type: z$1.ZodLiteral<"file">;
1882
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1883
+ text: z$1.ZodString;
1884
+ type: z$1.ZodString;
1885
+ }, z$1.core.$strip>>>;
1886
+ }, z$1.core.$strip>]>>>;
1887
+ }, z$1.core.$strict>, z$1.ZodObject<{
1888
+ type: z$1.ZodLiteral<"toolresult">;
1889
+ data: z$1.ZodUnknown;
1890
+ }, z$1.core.$strict>, z$1.ZodObject<{
1891
+ type: z$1.ZodLiteral<"tooldefinition">;
1892
+ data: z$1.ZodObject<{
1893
+ description: z$1.ZodString;
1894
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1895
+ name: z$1.ZodString;
1896
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1897
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1898
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1899
+ }, z$1.core.$strip>>;
1900
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1901
+ code: z$1.ZodOptional<z$1.ZodString>;
1902
+ }, z$1.core.$strip>;
1903
+ }, z$1.core.$strict>, z$1.ZodObject<{
1904
+ type: z$1.ZodLiteral<"error">;
1905
+ data: z$1.ZodUnknown;
1906
+ }, z$1.core.$strict>, z$1.ZodObject<{
1907
+ type: z$1.ZodLiteral<"structured">;
1908
+ data: z$1.ZodUnknown;
1909
+ }, z$1.core.$strict>, z$1.ZodObject<{
1910
+ type: z$1.ZodLiteral<"functioncall">;
1911
+ data: z$1.ZodObject<{
1912
+ name: z$1.ZodString;
1913
+ 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]>>;
1914
+ }, z$1.core.$strip>;
1915
+ }, z$1.core.$strict>, z$1.ZodObject<{
1916
+ type: z$1.ZodLiteral<"files">;
1917
+ data: z$1.ZodArray<z$1.ZodString>;
1918
+ }, z$1.core.$strict>, z$1.ZodObject<{
1919
+ type: z$1.ZodLiteral<"return">;
1920
+ data: z$1.ZodString;
1921
+ }, z$1.core.$strict>]>>>;
1922
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1923
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1924
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1925
+ id: z$1.ZodOptional<z$1.ZodString>;
1926
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1927
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
1928
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
1929
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1930
+ }, z$1.core.$strip>;
1931
+ execute: z$1.ZodDefault<z$1.ZodBoolean>;
1932
+ show: z$1.ZodDefault<z$1.ZodBoolean>;
1933
+ origin: z$1.ZodOptional<z$1.ZodString>;
1934
+ peerId: z$1.ZodOptional<z$1.ZodString>;
1935
+ }, z$1.core.$strip>, z$1.ZodObject<{
1936
+ type: z$1.ZodLiteral<"tasks">;
1937
+ execute: z$1.ZodDefault<z$1.ZodBoolean>;
1938
+ tasks: z$1.ZodArray<z$1.ZodObject<{
1939
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
1940
+ function: "function";
1941
+ system: "system";
1942
+ user: "user";
1943
+ assistant: "assistant";
1944
+ }>>>;
1945
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1946
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
1947
+ type: z$1.ZodLiteral<"message">;
1948
+ data: z$1.ZodString;
1949
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
1950
+ type: z$1.ZodLiteral<"url_citation">;
1951
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
1952
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
1953
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
1954
+ title: z$1.ZodOptional<z$1.ZodString>;
1955
+ url: z$1.ZodOptional<z$1.ZodString>;
1956
+ content: z$1.ZodOptional<z$1.ZodString>;
1957
+ }, z$1.core.$strip>>;
1958
+ }, z$1.core.$strip>, z$1.ZodObject<{
1959
+ type: z$1.ZodLiteral<"file">;
1960
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1961
+ text: z$1.ZodString;
1962
+ type: z$1.ZodString;
1963
+ }, z$1.core.$strip>>>;
1964
+ }, z$1.core.$strip>]>>>;
1965
+ }, z$1.core.$strict>, z$1.ZodObject<{
1966
+ type: z$1.ZodLiteral<"toolresult">;
1967
+ data: z$1.ZodUnknown;
1968
+ }, z$1.core.$strict>, z$1.ZodObject<{
1969
+ type: z$1.ZodLiteral<"tooldefinition">;
1970
+ data: z$1.ZodObject<{
1971
+ description: z$1.ZodString;
1972
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
1973
+ name: z$1.ZodString;
1974
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
1975
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
1976
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
1977
+ }, z$1.core.$strip>>;
1978
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
1979
+ code: z$1.ZodOptional<z$1.ZodString>;
1980
+ }, z$1.core.$strip>;
1981
+ }, z$1.core.$strict>, z$1.ZodObject<{
1982
+ type: z$1.ZodLiteral<"error">;
1983
+ data: z$1.ZodUnknown;
1984
+ }, z$1.core.$strict>, z$1.ZodObject<{
1985
+ type: z$1.ZodLiteral<"structured">;
1986
+ data: z$1.ZodUnknown;
1987
+ }, z$1.core.$strict>, z$1.ZodObject<{
1988
+ type: z$1.ZodLiteral<"functioncall">;
1989
+ data: z$1.ZodObject<{
1990
+ name: z$1.ZodString;
1991
+ 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]>>;
1992
+ }, z$1.core.$strip>;
1993
+ }, z$1.core.$strict>, z$1.ZodObject<{
1994
+ type: z$1.ZodLiteral<"files">;
1995
+ data: z$1.ZodArray<z$1.ZodString>;
1996
+ }, z$1.core.$strict>, z$1.ZodObject<{
1997
+ type: z$1.ZodLiteral<"return">;
1998
+ data: z$1.ZodString;
1999
+ }, z$1.core.$strict>]>>>;
2000
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
2001
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2002
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2003
+ id: z$1.ZodOptional<z$1.ZodString>;
2004
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2005
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
2006
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
2007
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2008
+ }, z$1.core.$strip>>;
2009
+ show: z$1.ZodDefault<z$1.ZodBoolean>;
2010
+ origin: z$1.ZodOptional<z$1.ZodString>;
2011
+ peerId: z$1.ZodOptional<z$1.ZodString>;
2012
+ }, z$1.core.$strip>, z$1.ZodObject<{
2013
+ description: z$1.ZodString;
2014
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
2015
+ name: z$1.ZodString;
2016
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
2017
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
2018
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
2019
+ }, z$1.core.$strip>>;
2020
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
2021
+ code: z$1.ZodOptional<z$1.ZodString>;
2022
+ type: z$1.ZodLiteral<"functionDescription">;
2023
+ origin: z$1.ZodOptional<z$1.ZodString>;
2024
+ peerId: z$1.ZodOptional<z$1.ZodString>;
2025
+ }, z$1.core.$strip>, z$1.ZodObject<{
2026
+ type: z$1.ZodLiteral<"taskyonReady">;
2027
+ origin: z$1.ZodOptional<z$1.ZodString>;
2028
+ peerId: z$1.ZodOptional<z$1.ZodString>;
2029
+ }, z$1.core.$strip>, z$1.ZodObject<{
2030
+ type: z$1.ZodLiteral<"file">;
2031
+ id: z$1.ZodString;
2032
+ name: z$1.ZodString;
2033
+ mime: z$1.ZodString;
2034
+ size: z$1.ZodNumber;
2035
+ store: z$1.ZodOptional<z$1.ZodEnum<{
2036
+ memory: "memory";
2037
+ opfs: "opfs";
2038
+ }>>;
2039
+ file: z$1.ZodFile;
2040
+ origin: z$1.ZodOptional<z$1.ZodString>;
2041
+ peerId: z$1.ZodOptional<z$1.ZodString>;
2042
+ }, z$1.core.$strip>, z$1.ZodObject<{
2043
+ type: z$1.ZodLiteral<"configurationMessage">;
2044
+ persist: z$1.ZodOptional<z$1.ZodBoolean>;
2045
+ conf: z$1.ZodUnion<readonly [z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodObject<{
2046
+ version: z$1.ZodLiteral<21>;
2047
+ appConfiguration: z$1.ZodObject<{
2048
+ darkTheme: z$1.ZodUnion<readonly [z$1.ZodLiteral<"auto">, z$1.ZodBoolean]>;
2049
+ appConfigurationUrl: z$1.ZodDefault<z$1.ZodString>;
2050
+ gdriveConfigurationFile: z$1.ZodDefault<z$1.ZodString>;
2051
+ enableGdriveSync: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
2052
+ expertMode: z$1.ZodDefault<z$1.ZodBoolean>;
2053
+ showCosts: z$1.ZodDefault<z$1.ZodBoolean>;
2054
+ gdriveDir: z$1.ZodDefault<z$1.ZodString>;
2055
+ showLogo: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
2056
+ welcomeMsg: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
2057
+ chatSuggestions: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
2058
+ url: z$1.ZodString;
2059
+ label: z$1.ZodString;
2060
+ }, z$1.core.$strip>, z$1.ZodObject<{
2061
+ md: z$1.ZodString;
2062
+ label: z$1.ZodString;
2063
+ }, z$1.core.$strip>]>>>>;
2064
+ useEnterToSend: z$1.ZodDefault<z$1.ZodEnum<{
2065
+ shift: "shift";
2066
+ auto: "auto";
2067
+ on: "on";
2068
+ off: "off";
2069
+ }>>;
2070
+ guiMode: z$1.ZodDefault<z$1.ZodEnum<{
2071
+ default: "default";
2072
+ auto: "auto";
2073
+ iframe: "iframe";
2074
+ minChat: "minChat";
2075
+ }>>;
2076
+ primaryColor: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
2077
+ secondaryColor: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
2078
+ }, z$1.core.$strip>;
2079
+ llmSettings: z$1.ZodObject<{
2080
+ userId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
2081
+ allowWebSearch: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
2082
+ secretPublicKey: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
2083
+ selectedTaskId: z$1.ZodOptional<z$1.ZodString>;
2084
+ enableOpenAiTools: z$1.ZodDefault<z$1.ZodBoolean>;
2085
+ selectedApi: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>>;
2086
+ llmApis: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
2087
+ name: z$1.ZodString;
2088
+ baseURL: z$1.ZodString;
2089
+ defaultModel: z$1.ZodString;
2090
+ selectedModel: z$1.ZodOptional<z$1.ZodString>;
2091
+ models: z$1.ZodOptional<z$1.ZodObject<{
2092
+ instruction: z$1.ZodOptional<z$1.ZodString>;
2093
+ chat: z$1.ZodOptional<z$1.ZodString>;
2094
+ free: z$1.ZodOptional<z$1.ZodString>;
2095
+ }, z$1.core.$strip>>;
2096
+ streamSupport: z$1.ZodBoolean;
2097
+ defaultHeaders: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
2098
+ routes: z$1.ZodObject<{
2099
+ chatCompletion: z$1.ZodString;
2100
+ models: z$1.ZodString;
2101
+ }, z$1.core.$strip>;
2102
+ }, z$1.core.$strip>>>;
2103
+ siteUrl: z$1.ZodDefault<z$1.ZodString>;
2104
+ summaryModel: z$1.ZodDefault<z$1.ZodString>;
2105
+ vectorizationModel: z$1.ZodDefault<z$1.ZodString>;
2106
+ maxAutonomousTasks: z$1.ZodDefault<z$1.ZodNumber>;
2107
+ entryNode: z$1.ZodOptional<z$1.ZodObject<{
2108
+ role: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodEnum<{
2109
+ function: "function";
2110
+ system: "system";
2111
+ user: "user";
2112
+ assistant: "assistant";
2113
+ }>>>;
2114
+ name: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2115
+ content: z$1.ZodNonOptional<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodObject<{
2116
+ type: z$1.ZodLiteral<"message">;
2117
+ data: z$1.ZodString;
2118
+ ann: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
2119
+ type: z$1.ZodLiteral<"url_citation">;
2120
+ url_citation: z$1.ZodOptional<z$1.ZodObject<{
2121
+ end_index: z$1.ZodOptional<z$1.ZodNumber>;
2122
+ start_index: z$1.ZodOptional<z$1.ZodNumber>;
2123
+ title: z$1.ZodOptional<z$1.ZodString>;
2124
+ url: z$1.ZodOptional<z$1.ZodString>;
2125
+ content: z$1.ZodOptional<z$1.ZodString>;
2126
+ }, z$1.core.$strip>>;
2127
+ }, z$1.core.$strip>, z$1.ZodObject<{
2128
+ type: z$1.ZodLiteral<"file">;
2129
+ content: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2130
+ text: z$1.ZodString;
2131
+ type: z$1.ZodString;
2132
+ }, z$1.core.$strip>>>;
2133
+ }, z$1.core.$strip>]>>>;
2134
+ }, z$1.core.$strict>, z$1.ZodObject<{
2135
+ type: z$1.ZodLiteral<"toolresult">;
2136
+ data: z$1.ZodUnknown;
2137
+ }, z$1.core.$strict>, z$1.ZodObject<{
2138
+ type: z$1.ZodLiteral<"tooldefinition">;
2139
+ data: z$1.ZodObject<{
2140
+ description: z$1.ZodString;
2141
+ longDescription: z$1.ZodOptional<z$1.ZodString>;
2142
+ name: z$1.ZodString;
2143
+ renderOptions: z$1.ZodOptional<z$1.ZodObject<{
2144
+ hideChat: z$1.ZodOptional<z$1.ZodBoolean>;
2145
+ hideLlm: z$1.ZodOptional<z$1.ZodBoolean>;
2146
+ }, z$1.core.$strip>>;
2147
+ parameters: z$1.ZodReadonly<z$1.ZodType<json_schema.JSONSchema7, unknown, z$1.core.$ZodTypeInternals<json_schema.JSONSchema7, unknown>>>;
2148
+ code: z$1.ZodOptional<z$1.ZodString>;
2149
+ }, z$1.core.$strip>;
2150
+ }, z$1.core.$strict>, z$1.ZodObject<{
2151
+ type: z$1.ZodLiteral<"error">;
2152
+ data: z$1.ZodUnknown;
2153
+ }, z$1.core.$strict>, z$1.ZodObject<{
2154
+ type: z$1.ZodLiteral<"structured">;
2155
+ data: z$1.ZodUnknown;
2156
+ }, z$1.core.$strict>, z$1.ZodObject<{
2157
+ type: z$1.ZodLiteral<"functioncall">;
2158
+ data: z$1.ZodObject<{
2159
+ name: z$1.ZodString;
2160
+ 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]>>;
2161
+ }, z$1.core.$strip>;
2162
+ }, z$1.core.$strict>, z$1.ZodObject<{
2163
+ type: z$1.ZodLiteral<"files">;
2164
+ data: z$1.ZodArray<z$1.ZodString>;
2165
+ }, z$1.core.$strict>, z$1.ZodObject<{
2166
+ type: z$1.ZodLiteral<"return">;
2167
+ data: z$1.ZodString;
2168
+ }, z$1.core.$strict>]>>>;
2169
+ label: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
2170
+ parentID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2171
+ priorID: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2172
+ id: z$1.ZodOptional<z$1.ZodString>;
2173
+ authorId: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2174
+ created_at: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodNumber>>;
2175
+ acl: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>>;
2176
+ sig: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2177
+ }, z$1.core.$strip>>;
2178
+ enableToolChooser: z$1.ZodDefault<z$1.ZodBoolean>;
2179
+ useBasePrompt: z$1.ZodDefault<z$1.ZodBoolean>;
2180
+ tryUsingVisionModels: z$1.ZodDefault<z$1.ZodBoolean>;
2181
+ taskChatTemplates: z$1.ZodObject<{
2182
+ basePrompt: z$1.ZodString;
2183
+ instruction: z$1.ZodString;
2184
+ toolResult: z$1.ZodString;
2185
+ task: z$1.ZodString;
2186
+ evaluate: z$1.ZodString;
2187
+ schemaReminder: z$1.ZodString;
2188
+ tools: z$1.ZodString;
2189
+ }, z$1.core.$strip>;
2190
+ }, z$1.core.$strip>;
2191
+ toolchainConfig: z$1.ZodObject<{
2192
+ tools: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodJSONSchema>>;
2193
+ }, z$1.core.$strip>;
2194
+ signatureOrKey: z$1.ZodOptional<z$1.ZodString>;
2195
+ }, z$1.core.$strip>]>;
2196
+ origin: z$1.ZodOptional<z$1.ZodString>;
2197
+ peerId: z$1.ZodOptional<z$1.ZodString>;
2198
+ }, z$1.core.$strip>]>;
2199
+ type TaskyonGuiMessage = z$1.infer<typeof TaskyonGuiMessage>;
2200
+
2201
+ interface TyClient {
2202
+ processTasks: ReturnType<typeof processTasks>;
2203
+ port: Port<TaskyonGuiMessage, TaskyonGuiMessage>;
2204
+ sendFile: (file: File) => Promise<string>;
2205
+ }
2206
+ declare function initializeTaskyon(options: {
2207
+ name?: string;
2208
+ persist?: boolean;
2209
+ tools: ClientTool[];
2210
+ configuration: partialTyConfiguration;
2211
+ }): Promise<TyClient>;
2212
+
2213
+ export { type ClientTool, TaskyonGuiMessage, TaskyonMessage, type TyClient, createChatCompletionTask, createTool, initializeTaskyon, makeTaskResult, partialTaskDraft, type partialTyConfiguration, processTasks, toolCall };