@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.
@@ -0,0 +1,2193 @@
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
+ } | 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 };