@picoflow/core 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/clients/http-client.js +1 -1
- package/clients/self-client.js +1 -1
- package/configs/core-config.d.ts +1 -0
- package/configs/core-config.js +1 -1
- package/decorators/stop-tool.js +1 -1
- package/flow/content-type.js +1 -1
- package/flow/end-step.d.ts +1 -1
- package/flow/end-step.js +1 -1
- package/flow/flow-creator.js +1 -1
- package/flow/flow-types.d.ts +107 -48
- package/flow/flow-types.js +1 -1
- package/flow/flow.d.ts +14 -4
- package/flow/flow.js +1 -1
- package/flow/llm-runner.d.ts +3 -1
- package/flow/llm-runner.js +1 -1
- package/flow/logic-runner.d.ts +2 -1
- package/flow/logic-runner.js +1 -1
- package/flow/logic-step.js +1 -1
- package/flow/memory.js +1 -1
- package/flow/step.d.ts +19 -8
- package/flow/step.js +1 -1
- package/index.d.ts +38 -33
- package/index.js +5 -2
- package/models/default-models.d.ts +1 -1
- package/models/default-models.js +1 -1
- package/models/model-registry.d.ts +22 -2
- package/models/model-registry.js +1 -1
- package/package.json +15 -13
- package/prompt/flow-prompt.js +1 -1
- package/prompt/prompt-util.js +1 -1
- package/services/flow-engine.js +1 -1
- package/session/cosmo-session.js +1 -1
- package/session/file-session.js +1 -1
- package/session/flow-session.js +1 -1
- package/session/mongo-session.js +1 -1
- package/session/session-adaptor.js +1 -1
- package/session/session-logger.js +1 -1
- package/session/sqlite-session.js +1 -1
- package/utils/constants.js +1 -1
- package/utils/environ.js +1 -1
- package/utils/errors.js +1 -1
- package/utils/license-util.js +1 -1
- package/utils/llm-file.d.ts +2 -0
- package/utils/llm-file.js +1 -1
- package/utils/logic.js +1 -1
- package/utils/message-util.d.ts +3 -1
- package/utils/message-util.js +1 -1
- package/utils/retry.js +1 -1
- package/utils/string-util.js +1 -1
- package/utils/tool-util.js +1 -1
- package/utils/verify-license.js +1 -1
package/flow/flow-types.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpContentType } from './content-type';
|
|
3
3
|
import { Step } from './step';
|
|
4
4
|
import { MessageTypes } from '../utils/message-util';
|
|
5
|
+
export declare enum SaveStateType {
|
|
6
|
+
transient = 0,
|
|
7
|
+
persistent = 1
|
|
8
|
+
}
|
|
5
9
|
declare const ChatMessageSchema: z.ZodObject<{
|
|
6
10
|
id: z.ZodString;
|
|
7
11
|
type: z.ZodEnum<["system", "human", "ai", "tool"]>;
|
|
@@ -26,28 +30,28 @@ declare const ChatMessageSchema: z.ZodObject<{
|
|
|
26
30
|
additional_kwargs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
27
31
|
}, "strip", z.ZodTypeAny, {
|
|
28
32
|
content?: string;
|
|
33
|
+
id?: string;
|
|
34
|
+
name?: string;
|
|
29
35
|
tool_calls?: {
|
|
30
36
|
id?: string;
|
|
31
37
|
name?: string;
|
|
32
38
|
args?: {};
|
|
33
39
|
}[];
|
|
34
40
|
type?: "ai" | "human" | "system" | "tool";
|
|
35
|
-
id?: string;
|
|
36
|
-
name?: string;
|
|
37
41
|
additional_kwargs?: Record<string, any>;
|
|
38
42
|
status?: "success" | "error";
|
|
39
43
|
timestamp?: Date;
|
|
40
44
|
tool_call_id?: string;
|
|
41
45
|
}, {
|
|
42
46
|
content?: string;
|
|
47
|
+
id?: string;
|
|
48
|
+
name?: string;
|
|
43
49
|
tool_calls?: {
|
|
44
50
|
id?: string;
|
|
45
51
|
name?: string;
|
|
46
52
|
args?: {};
|
|
47
53
|
}[];
|
|
48
54
|
type?: "ai" | "human" | "system" | "tool";
|
|
49
|
-
id?: string;
|
|
50
|
-
name?: string;
|
|
51
55
|
additional_kwargs?: Record<string, any>;
|
|
52
56
|
status?: "success" | "error";
|
|
53
57
|
timestamp?: Date;
|
|
@@ -103,28 +107,28 @@ declare const MemorySchema: z.ZodObject<{
|
|
|
103
107
|
additional_kwargs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
104
108
|
}, "strip", z.ZodTypeAny, {
|
|
105
109
|
content?: string;
|
|
110
|
+
id?: string;
|
|
111
|
+
name?: string;
|
|
106
112
|
tool_calls?: {
|
|
107
113
|
id?: string;
|
|
108
114
|
name?: string;
|
|
109
115
|
args?: {};
|
|
110
116
|
}[];
|
|
111
117
|
type?: "ai" | "human" | "system" | "tool";
|
|
112
|
-
id?: string;
|
|
113
|
-
name?: string;
|
|
114
118
|
additional_kwargs?: Record<string, any>;
|
|
115
119
|
status?: "success" | "error";
|
|
116
120
|
timestamp?: Date;
|
|
117
121
|
tool_call_id?: string;
|
|
118
122
|
}, {
|
|
119
123
|
content?: string;
|
|
124
|
+
id?: string;
|
|
125
|
+
name?: string;
|
|
120
126
|
tool_calls?: {
|
|
121
127
|
id?: string;
|
|
122
128
|
name?: string;
|
|
123
129
|
args?: {};
|
|
124
130
|
}[];
|
|
125
131
|
type?: "ai" | "human" | "system" | "tool";
|
|
126
|
-
id?: string;
|
|
127
|
-
name?: string;
|
|
128
132
|
additional_kwargs?: Record<string, any>;
|
|
129
133
|
status?: "success" | "error";
|
|
130
134
|
timestamp?: Date;
|
|
@@ -134,14 +138,14 @@ declare const MemorySchema: z.ZodObject<{
|
|
|
134
138
|
nameSpace?: string;
|
|
135
139
|
history?: {
|
|
136
140
|
content?: string;
|
|
141
|
+
id?: string;
|
|
142
|
+
name?: string;
|
|
137
143
|
tool_calls?: {
|
|
138
144
|
id?: string;
|
|
139
145
|
name?: string;
|
|
140
146
|
args?: {};
|
|
141
147
|
}[];
|
|
142
148
|
type?: "ai" | "human" | "system" | "tool";
|
|
143
|
-
id?: string;
|
|
144
|
-
name?: string;
|
|
145
149
|
additional_kwargs?: Record<string, any>;
|
|
146
150
|
status?: "success" | "error";
|
|
147
151
|
timestamp?: Date;
|
|
@@ -151,14 +155,14 @@ declare const MemorySchema: z.ZodObject<{
|
|
|
151
155
|
nameSpace?: string;
|
|
152
156
|
history?: {
|
|
153
157
|
content?: string;
|
|
158
|
+
id?: string;
|
|
159
|
+
name?: string;
|
|
154
160
|
tool_calls?: {
|
|
155
161
|
id?: string;
|
|
156
162
|
name?: string;
|
|
157
163
|
args?: {};
|
|
158
164
|
}[];
|
|
159
165
|
type?: "ai" | "human" | "system" | "tool";
|
|
160
|
-
id?: string;
|
|
161
|
-
name?: string;
|
|
162
166
|
additional_kwargs?: Record<string, any>;
|
|
163
167
|
status?: "success" | "error";
|
|
164
168
|
timestamp?: Date;
|
|
@@ -166,6 +170,17 @@ declare const MemorySchema: z.ZodObject<{
|
|
|
166
170
|
}[];
|
|
167
171
|
}>;
|
|
168
172
|
export type MemoryType = z.infer<typeof MemorySchema>;
|
|
173
|
+
declare const FlowSequenceItemSchema: z.ZodObject<{
|
|
174
|
+
level: z.ZodNumber;
|
|
175
|
+
stepName: z.ZodString;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
level?: number;
|
|
178
|
+
stepName?: string;
|
|
179
|
+
}, {
|
|
180
|
+
level?: number;
|
|
181
|
+
stepName?: string;
|
|
182
|
+
}>;
|
|
183
|
+
export type FlowSequenceItemType = z.infer<typeof FlowSequenceItemSchema>;
|
|
169
184
|
declare const FlowSchema: z.ZodObject<{
|
|
170
185
|
name: z.ZodString;
|
|
171
186
|
memory: z.ZodArray<z.ZodObject<{
|
|
@@ -194,28 +209,28 @@ declare const FlowSchema: z.ZodObject<{
|
|
|
194
209
|
additional_kwargs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
195
210
|
}, "strip", z.ZodTypeAny, {
|
|
196
211
|
content?: string;
|
|
212
|
+
id?: string;
|
|
213
|
+
name?: string;
|
|
197
214
|
tool_calls?: {
|
|
198
215
|
id?: string;
|
|
199
216
|
name?: string;
|
|
200
217
|
args?: {};
|
|
201
218
|
}[];
|
|
202
219
|
type?: "ai" | "human" | "system" | "tool";
|
|
203
|
-
id?: string;
|
|
204
|
-
name?: string;
|
|
205
220
|
additional_kwargs?: Record<string, any>;
|
|
206
221
|
status?: "success" | "error";
|
|
207
222
|
timestamp?: Date;
|
|
208
223
|
tool_call_id?: string;
|
|
209
224
|
}, {
|
|
210
225
|
content?: string;
|
|
226
|
+
id?: string;
|
|
227
|
+
name?: string;
|
|
211
228
|
tool_calls?: {
|
|
212
229
|
id?: string;
|
|
213
230
|
name?: string;
|
|
214
231
|
args?: {};
|
|
215
232
|
}[];
|
|
216
233
|
type?: "ai" | "human" | "system" | "tool";
|
|
217
|
-
id?: string;
|
|
218
|
-
name?: string;
|
|
219
234
|
additional_kwargs?: Record<string, any>;
|
|
220
235
|
status?: "success" | "error";
|
|
221
236
|
timestamp?: Date;
|
|
@@ -225,14 +240,14 @@ declare const FlowSchema: z.ZodObject<{
|
|
|
225
240
|
nameSpace?: string;
|
|
226
241
|
history?: {
|
|
227
242
|
content?: string;
|
|
243
|
+
id?: string;
|
|
244
|
+
name?: string;
|
|
228
245
|
tool_calls?: {
|
|
229
246
|
id?: string;
|
|
230
247
|
name?: string;
|
|
231
248
|
args?: {};
|
|
232
249
|
}[];
|
|
233
250
|
type?: "ai" | "human" | "system" | "tool";
|
|
234
|
-
id?: string;
|
|
235
|
-
name?: string;
|
|
236
251
|
additional_kwargs?: Record<string, any>;
|
|
237
252
|
status?: "success" | "error";
|
|
238
253
|
timestamp?: Date;
|
|
@@ -242,20 +257,21 @@ declare const FlowSchema: z.ZodObject<{
|
|
|
242
257
|
nameSpace?: string;
|
|
243
258
|
history?: {
|
|
244
259
|
content?: string;
|
|
260
|
+
id?: string;
|
|
261
|
+
name?: string;
|
|
245
262
|
tool_calls?: {
|
|
246
263
|
id?: string;
|
|
247
264
|
name?: string;
|
|
248
265
|
args?: {};
|
|
249
266
|
}[];
|
|
250
267
|
type?: "ai" | "human" | "system" | "tool";
|
|
251
|
-
id?: string;
|
|
252
|
-
name?: string;
|
|
253
268
|
additional_kwargs?: Record<string, any>;
|
|
254
269
|
status?: "success" | "error";
|
|
255
270
|
timestamp?: Date;
|
|
256
271
|
tool_call_id?: string;
|
|
257
272
|
}[];
|
|
258
273
|
}>, "many">;
|
|
274
|
+
start: z.ZodNullable<z.ZodString>;
|
|
259
275
|
steps: z.ZodArray<z.ZodObject<{
|
|
260
276
|
name: z.ZodString;
|
|
261
277
|
isActive: z.ZodBoolean;
|
|
@@ -279,27 +295,37 @@ declare const FlowSchema: z.ZodObject<{
|
|
|
279
295
|
modelParams?: Record<string, any>;
|
|
280
296
|
}>, "many">;
|
|
281
297
|
context: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
282
|
-
sequence: z.ZodArray<z.
|
|
298
|
+
sequence: z.ZodArray<z.ZodObject<{
|
|
299
|
+
level: z.ZodNumber;
|
|
300
|
+
stepName: z.ZodString;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
level?: number;
|
|
303
|
+
stepName?: string;
|
|
304
|
+
}, {
|
|
305
|
+
level?: number;
|
|
306
|
+
stepName?: string;
|
|
307
|
+
}>, "many">;
|
|
283
308
|
}, "strip", z.ZodTypeAny, {
|
|
284
309
|
name?: string;
|
|
285
310
|
memory?: {
|
|
286
311
|
nameSpace?: string;
|
|
287
312
|
history?: {
|
|
288
313
|
content?: string;
|
|
314
|
+
id?: string;
|
|
315
|
+
name?: string;
|
|
289
316
|
tool_calls?: {
|
|
290
317
|
id?: string;
|
|
291
318
|
name?: string;
|
|
292
319
|
args?: {};
|
|
293
320
|
}[];
|
|
294
321
|
type?: "ai" | "human" | "system" | "tool";
|
|
295
|
-
id?: string;
|
|
296
|
-
name?: string;
|
|
297
322
|
additional_kwargs?: Record<string, any>;
|
|
298
323
|
status?: "success" | "error";
|
|
299
324
|
timestamp?: Date;
|
|
300
325
|
tool_call_id?: string;
|
|
301
326
|
}[];
|
|
302
327
|
}[];
|
|
328
|
+
start?: string;
|
|
303
329
|
steps?: {
|
|
304
330
|
name?: string;
|
|
305
331
|
isActive?: boolean;
|
|
@@ -309,27 +335,31 @@ declare const FlowSchema: z.ZodObject<{
|
|
|
309
335
|
modelParams?: Record<string, any>;
|
|
310
336
|
}[];
|
|
311
337
|
context?: {};
|
|
312
|
-
sequence?:
|
|
338
|
+
sequence?: {
|
|
339
|
+
level?: number;
|
|
340
|
+
stepName?: string;
|
|
341
|
+
}[];
|
|
313
342
|
}, {
|
|
314
343
|
name?: string;
|
|
315
344
|
memory?: {
|
|
316
345
|
nameSpace?: string;
|
|
317
346
|
history?: {
|
|
318
347
|
content?: string;
|
|
348
|
+
id?: string;
|
|
349
|
+
name?: string;
|
|
319
350
|
tool_calls?: {
|
|
320
351
|
id?: string;
|
|
321
352
|
name?: string;
|
|
322
353
|
args?: {};
|
|
323
354
|
}[];
|
|
324
355
|
type?: "ai" | "human" | "system" | "tool";
|
|
325
|
-
id?: string;
|
|
326
|
-
name?: string;
|
|
327
356
|
additional_kwargs?: Record<string, any>;
|
|
328
357
|
status?: "success" | "error";
|
|
329
358
|
timestamp?: Date;
|
|
330
359
|
tool_call_id?: string;
|
|
331
360
|
}[];
|
|
332
361
|
}[];
|
|
362
|
+
start?: string;
|
|
333
363
|
steps?: {
|
|
334
364
|
name?: string;
|
|
335
365
|
isActive?: boolean;
|
|
@@ -339,7 +369,10 @@ declare const FlowSchema: z.ZodObject<{
|
|
|
339
369
|
modelParams?: Record<string, any>;
|
|
340
370
|
}[];
|
|
341
371
|
context?: {};
|
|
342
|
-
sequence?:
|
|
372
|
+
sequence?: {
|
|
373
|
+
level?: number;
|
|
374
|
+
stepName?: string;
|
|
375
|
+
}[];
|
|
343
376
|
}>;
|
|
344
377
|
export type FlowType = z.infer<typeof FlowSchema>;
|
|
345
378
|
export declare const RunStatusSchema: z.ZodEnum<["completed", "aborted", "running"]>;
|
|
@@ -378,28 +411,28 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
378
411
|
additional_kwargs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
379
412
|
}, "strip", z.ZodTypeAny, {
|
|
380
413
|
content?: string;
|
|
414
|
+
id?: string;
|
|
415
|
+
name?: string;
|
|
381
416
|
tool_calls?: {
|
|
382
417
|
id?: string;
|
|
383
418
|
name?: string;
|
|
384
419
|
args?: {};
|
|
385
420
|
}[];
|
|
386
421
|
type?: "ai" | "human" | "system" | "tool";
|
|
387
|
-
id?: string;
|
|
388
|
-
name?: string;
|
|
389
422
|
additional_kwargs?: Record<string, any>;
|
|
390
423
|
status?: "success" | "error";
|
|
391
424
|
timestamp?: Date;
|
|
392
425
|
tool_call_id?: string;
|
|
393
426
|
}, {
|
|
394
427
|
content?: string;
|
|
428
|
+
id?: string;
|
|
429
|
+
name?: string;
|
|
395
430
|
tool_calls?: {
|
|
396
431
|
id?: string;
|
|
397
432
|
name?: string;
|
|
398
433
|
args?: {};
|
|
399
434
|
}[];
|
|
400
435
|
type?: "ai" | "human" | "system" | "tool";
|
|
401
|
-
id?: string;
|
|
402
|
-
name?: string;
|
|
403
436
|
additional_kwargs?: Record<string, any>;
|
|
404
437
|
status?: "success" | "error";
|
|
405
438
|
timestamp?: Date;
|
|
@@ -409,14 +442,14 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
409
442
|
nameSpace?: string;
|
|
410
443
|
history?: {
|
|
411
444
|
content?: string;
|
|
445
|
+
id?: string;
|
|
446
|
+
name?: string;
|
|
412
447
|
tool_calls?: {
|
|
413
448
|
id?: string;
|
|
414
449
|
name?: string;
|
|
415
450
|
args?: {};
|
|
416
451
|
}[];
|
|
417
452
|
type?: "ai" | "human" | "system" | "tool";
|
|
418
|
-
id?: string;
|
|
419
|
-
name?: string;
|
|
420
453
|
additional_kwargs?: Record<string, any>;
|
|
421
454
|
status?: "success" | "error";
|
|
422
455
|
timestamp?: Date;
|
|
@@ -426,20 +459,21 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
426
459
|
nameSpace?: string;
|
|
427
460
|
history?: {
|
|
428
461
|
content?: string;
|
|
462
|
+
id?: string;
|
|
463
|
+
name?: string;
|
|
429
464
|
tool_calls?: {
|
|
430
465
|
id?: string;
|
|
431
466
|
name?: string;
|
|
432
467
|
args?: {};
|
|
433
468
|
}[];
|
|
434
469
|
type?: "ai" | "human" | "system" | "tool";
|
|
435
|
-
id?: string;
|
|
436
|
-
name?: string;
|
|
437
470
|
additional_kwargs?: Record<string, any>;
|
|
438
471
|
status?: "success" | "error";
|
|
439
472
|
timestamp?: Date;
|
|
440
473
|
tool_call_id?: string;
|
|
441
474
|
}[];
|
|
442
475
|
}>, "many">;
|
|
476
|
+
start: z.ZodNullable<z.ZodString>;
|
|
443
477
|
steps: z.ZodArray<z.ZodObject<{
|
|
444
478
|
name: z.ZodString;
|
|
445
479
|
isActive: z.ZodBoolean;
|
|
@@ -463,27 +497,37 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
463
497
|
modelParams?: Record<string, any>;
|
|
464
498
|
}>, "many">;
|
|
465
499
|
context: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
466
|
-
sequence: z.ZodArray<z.
|
|
500
|
+
sequence: z.ZodArray<z.ZodObject<{
|
|
501
|
+
level: z.ZodNumber;
|
|
502
|
+
stepName: z.ZodString;
|
|
503
|
+
}, "strip", z.ZodTypeAny, {
|
|
504
|
+
level?: number;
|
|
505
|
+
stepName?: string;
|
|
506
|
+
}, {
|
|
507
|
+
level?: number;
|
|
508
|
+
stepName?: string;
|
|
509
|
+
}>, "many">;
|
|
467
510
|
}, "strip", z.ZodTypeAny, {
|
|
468
511
|
name?: string;
|
|
469
512
|
memory?: {
|
|
470
513
|
nameSpace?: string;
|
|
471
514
|
history?: {
|
|
472
515
|
content?: string;
|
|
516
|
+
id?: string;
|
|
517
|
+
name?: string;
|
|
473
518
|
tool_calls?: {
|
|
474
519
|
id?: string;
|
|
475
520
|
name?: string;
|
|
476
521
|
args?: {};
|
|
477
522
|
}[];
|
|
478
523
|
type?: "ai" | "human" | "system" | "tool";
|
|
479
|
-
id?: string;
|
|
480
|
-
name?: string;
|
|
481
524
|
additional_kwargs?: Record<string, any>;
|
|
482
525
|
status?: "success" | "error";
|
|
483
526
|
timestamp?: Date;
|
|
484
527
|
tool_call_id?: string;
|
|
485
528
|
}[];
|
|
486
529
|
}[];
|
|
530
|
+
start?: string;
|
|
487
531
|
steps?: {
|
|
488
532
|
name?: string;
|
|
489
533
|
isActive?: boolean;
|
|
@@ -493,27 +537,31 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
493
537
|
modelParams?: Record<string, any>;
|
|
494
538
|
}[];
|
|
495
539
|
context?: {};
|
|
496
|
-
sequence?:
|
|
540
|
+
sequence?: {
|
|
541
|
+
level?: number;
|
|
542
|
+
stepName?: string;
|
|
543
|
+
}[];
|
|
497
544
|
}, {
|
|
498
545
|
name?: string;
|
|
499
546
|
memory?: {
|
|
500
547
|
nameSpace?: string;
|
|
501
548
|
history?: {
|
|
502
549
|
content?: string;
|
|
550
|
+
id?: string;
|
|
551
|
+
name?: string;
|
|
503
552
|
tool_calls?: {
|
|
504
553
|
id?: string;
|
|
505
554
|
name?: string;
|
|
506
555
|
args?: {};
|
|
507
556
|
}[];
|
|
508
557
|
type?: "ai" | "human" | "system" | "tool";
|
|
509
|
-
id?: string;
|
|
510
|
-
name?: string;
|
|
511
558
|
additional_kwargs?: Record<string, any>;
|
|
512
559
|
status?: "success" | "error";
|
|
513
560
|
timestamp?: Date;
|
|
514
561
|
tool_call_id?: string;
|
|
515
562
|
}[];
|
|
516
563
|
}[];
|
|
564
|
+
start?: string;
|
|
517
565
|
steps?: {
|
|
518
566
|
name?: string;
|
|
519
567
|
isActive?: boolean;
|
|
@@ -523,7 +571,10 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
523
571
|
modelParams?: Record<string, any>;
|
|
524
572
|
}[];
|
|
525
573
|
context?: {};
|
|
526
|
-
sequence?:
|
|
574
|
+
sequence?: {
|
|
575
|
+
level?: number;
|
|
576
|
+
stepName?: string;
|
|
577
|
+
}[];
|
|
527
578
|
}>, "many">;
|
|
528
579
|
log: z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "many">;
|
|
529
580
|
error: z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "many">;
|
|
@@ -557,20 +608,21 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
557
608
|
nameSpace?: string;
|
|
558
609
|
history?: {
|
|
559
610
|
content?: string;
|
|
611
|
+
id?: string;
|
|
612
|
+
name?: string;
|
|
560
613
|
tool_calls?: {
|
|
561
614
|
id?: string;
|
|
562
615
|
name?: string;
|
|
563
616
|
args?: {};
|
|
564
617
|
}[];
|
|
565
618
|
type?: "ai" | "human" | "system" | "tool";
|
|
566
|
-
id?: string;
|
|
567
|
-
name?: string;
|
|
568
619
|
additional_kwargs?: Record<string, any>;
|
|
569
620
|
status?: "success" | "error";
|
|
570
621
|
timestamp?: Date;
|
|
571
622
|
tool_call_id?: string;
|
|
572
623
|
}[];
|
|
573
624
|
}[];
|
|
625
|
+
start?: string;
|
|
574
626
|
steps?: {
|
|
575
627
|
name?: string;
|
|
576
628
|
isActive?: boolean;
|
|
@@ -580,7 +632,10 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
580
632
|
modelParams?: Record<string, any>;
|
|
581
633
|
}[];
|
|
582
634
|
context?: {};
|
|
583
|
-
sequence?:
|
|
635
|
+
sequence?: {
|
|
636
|
+
level?: number;
|
|
637
|
+
stepName?: string;
|
|
638
|
+
}[];
|
|
584
639
|
}[];
|
|
585
640
|
log?: {}[];
|
|
586
641
|
warn?: {}[];
|
|
@@ -605,20 +660,21 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
605
660
|
nameSpace?: string;
|
|
606
661
|
history?: {
|
|
607
662
|
content?: string;
|
|
663
|
+
id?: string;
|
|
664
|
+
name?: string;
|
|
608
665
|
tool_calls?: {
|
|
609
666
|
id?: string;
|
|
610
667
|
name?: string;
|
|
611
668
|
args?: {};
|
|
612
669
|
}[];
|
|
613
670
|
type?: "ai" | "human" | "system" | "tool";
|
|
614
|
-
id?: string;
|
|
615
|
-
name?: string;
|
|
616
671
|
additional_kwargs?: Record<string, any>;
|
|
617
672
|
status?: "success" | "error";
|
|
618
673
|
timestamp?: Date;
|
|
619
674
|
tool_call_id?: string;
|
|
620
675
|
}[];
|
|
621
676
|
}[];
|
|
677
|
+
start?: string;
|
|
622
678
|
steps?: {
|
|
623
679
|
name?: string;
|
|
624
680
|
isActive?: boolean;
|
|
@@ -628,7 +684,10 @@ declare const _SessionSchema: z.ZodObject<{
|
|
|
628
684
|
modelParams?: Record<string, any>;
|
|
629
685
|
}[];
|
|
630
686
|
context?: {};
|
|
631
|
-
sequence?:
|
|
687
|
+
sequence?: {
|
|
688
|
+
level?: number;
|
|
689
|
+
stepName?: string;
|
|
690
|
+
}[];
|
|
632
691
|
}[];
|
|
633
692
|
log?: {}[];
|
|
634
693
|
warn?: {}[];
|
package/flow/flow-types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a7_0x5d6769=a7_0x208a;(function(_0x2bacb3,_0x86d490){const _0x5d7916=a7_0x208a,_0x5642f4=_0x2bacb3();while(!![]){try{const _0x1146fb=-parseInt(_0x5d7916(0x182))/0x1*(-parseInt(_0x5d7916(0x186))/0x2)+parseInt(_0x5d7916(0x180))/0x3*(parseInt(_0x5d7916(0x148))/0x4)+-parseInt(_0x5d7916(0x149))/0x5*(parseInt(_0x5d7916(0x170))/0x6)+parseInt(_0x5d7916(0x146))/0x7+parseInt(_0x5d7916(0x161))/0x8*(-parseInt(_0x5d7916(0x16b))/0x9)+-parseInt(_0x5d7916(0x15b))/0xa+-parseInt(_0x5d7916(0x14e))/0xb;if(_0x1146fb===_0x86d490)break;else _0x5642f4['push'](_0x5642f4['shift']());}catch(_0x535c33){_0x5642f4['push'](_0x5642f4['shift']());}}}(a7_0x59e2,0x315f3));function a7_0x208a(_0x2e5ac4,_0x46ef21){const _0x5d9620=a7_0x59e2();return a7_0x208a=function(_0x1c995c,_0x2534c6){_0x1c995c=_0x1c995c-0x144;let _0x59e24e=_0x5d9620[_0x1c995c];return _0x59e24e;},a7_0x208a(_0x2e5ac4,_0x46ef21);}Object[a7_0x5d6769(0x173)](exports,'__esModule',{'value':!![]}),exports[a7_0x5d6769(0x159)]=exports[a7_0x5d6769(0x15a)]=exports[a7_0x5d6769(0x171)]=exports['SaveStateType']=void 0x0;const zod_1=require(a7_0x5d6769(0x178)),zod_nestjs_1=require(a7_0x5d6769(0x14f)),content_type_1=require('./content-type');function a7_0x59e2(){const _0x36dcda=['running','36ZTcbAZ','KNisa','boolean','ypfKK','search','234WyCeYQ','RunStatusSchema','oSigy','defineProperty','int','array','jYOxm','human','zod','AhDRh','HvmfU','apply','NvinA','DLQCO','any','dEARs','1133178RpdLfH','constructor','991bOdjey','PWZgd','IvSaB','toString','526WYDPMh','enum','nativeEnum','adKcQ','2665572VYFuPb','record','4HInvYX','5905VtdMKy','completed','min','persistent','BaYhC','5469090uMPInS','@anatine/zod-nestjs','RehiU','SaveStateType','optional','ncfWi','(((.+)+)+)+$','aQXZk','error','system','string','RunResponseDto','ToolStatus','2305390pVJAEY','object','date','success','tool','number','86280NWHbvs','Xtvwi','FkFzq','uAmCE','frJSv','nullable','transient','AQzBH','EmLOy'];a7_0x59e2=function(){return _0x36dcda;};return a7_0x59e2();}var SaveStateType;(function(_0x5b30b6){const _0x5c0314=a7_0x5d6769,_0x59fab0={'jYOxm':_0x5c0314(0x167),'IvSaB':_0x5c0314(0x14c)};_0x5b30b6[_0x5b30b6[_0x59fab0['jYOxm']]=0x0]=_0x59fab0[_0x5c0314(0x176)],_0x5b30b6[_0x5b30b6[_0x59fab0[_0x5c0314(0x184)]]=0x1]=_0x59fab0['IvSaB'];}(SaveStateType||(exports[a7_0x5d6769(0x151)]=SaveStateType={})));const RoleEnum=zod_1['z'][a7_0x5d6769(0x187)]([a7_0x5d6769(0x157),a7_0x5d6769(0x177),'ai',a7_0x5d6769(0x15f)]),ToolStatusEnum=zod_1['z'][a7_0x5d6769(0x187)]([a7_0x5d6769(0x15e),a7_0x5d6769(0x156)]),AIToolMessageSchema=zod_1['z'][a7_0x5d6769(0x15c)]({'name':zod_1['z'][a7_0x5d6769(0x158)](),'args':zod_1['z'][a7_0x5d6769(0x15c)]({}),'id':zod_1['z'][a7_0x5d6769(0x158)]()}),ChatMessageSchema=zod_1['z']['object']({'id':zod_1['z'][a7_0x5d6769(0x158)](),'type':RoleEnum,'content':zod_1['z']['string'](),'timestamp':zod_1['z'][a7_0x5d6769(0x15d)](),'tool_call_id':zod_1['z'][a7_0x5d6769(0x158)]()[a7_0x5d6769(0x152)](),'name':zod_1['z'][a7_0x5d6769(0x158)](),'status':ToolStatusEnum[a7_0x5d6769(0x152)](),'tool_calls':zod_1['z'][a7_0x5d6769(0x175)](AIToolMessageSchema)[a7_0x5d6769(0x152)](),'additional_kwargs':zod_1['z'][a7_0x5d6769(0x147)](zod_1['z'][a7_0x5d6769(0x17e)]())['optional']()}),StepSchema=zod_1['z'][a7_0x5d6769(0x15c)]({'name':zod_1['z'][a7_0x5d6769(0x158)](),'isActive':zod_1['z'][a7_0x5d6769(0x16d)](),'state':zod_1['z']['object']({}),'modelName':zod_1['z'][a7_0x5d6769(0x158)]()[a7_0x5d6769(0x152)](),'modelParamsName':zod_1['z']['string']()[a7_0x5d6769(0x152)](),'modelParams':zod_1['z'][a7_0x5d6769(0x147)](zod_1['z'][a7_0x5d6769(0x17e)]())[a7_0x5d6769(0x152)]()}),MemorySchema=zod_1['z'][a7_0x5d6769(0x15c)]({'nameSpace':zod_1['z'][a7_0x5d6769(0x158)](),'history':zod_1['z'][a7_0x5d6769(0x175)](ChatMessageSchema)}),FlowSequenceItemSchema=zod_1['z'][a7_0x5d6769(0x15c)]({'level':zod_1['z'][a7_0x5d6769(0x160)]()[a7_0x5d6769(0x174)]()[a7_0x5d6769(0x14b)](0x1),'stepName':zod_1['z']['string']()}),FlowSchema=zod_1['z'][a7_0x5d6769(0x15c)]({'name':zod_1['z'][a7_0x5d6769(0x158)](),'memory':zod_1['z'][a7_0x5d6769(0x175)](MemorySchema),'start':zod_1['z'][a7_0x5d6769(0x158)]()[a7_0x5d6769(0x166)](),'steps':zod_1['z'][a7_0x5d6769(0x175)](StepSchema),'context':zod_1['z']['object']({}),'sequence':zod_1['z'][a7_0x5d6769(0x175)](FlowSequenceItemSchema)});exports[a7_0x5d6769(0x171)]=zod_1['z'][a7_0x5d6769(0x187)]([a7_0x5d6769(0x14a),'aborted',a7_0x5d6769(0x16a)]);const _SessionSchema=zod_1['z'][a7_0x5d6769(0x15c)]({'id':zod_1['z'][a7_0x5d6769(0x158)]()['nonempty'](),'createdOn':zod_1['z']['date'](),'saveOn':zod_1['z'][a7_0x5d6769(0x15d)](),'runStatus':exports['RunStatusSchema'],'version':zod_1['z'][a7_0x5d6769(0x160)](),'expireAfter':zod_1['z'][a7_0x5d6769(0x160)](),'flows':zod_1['z'][a7_0x5d6769(0x175)](FlowSchema),'log':zod_1['z'][a7_0x5d6769(0x175)](zod_1['z'][a7_0x5d6769(0x15c)]({})),'error':zod_1['z'][a7_0x5d6769(0x175)](zod_1['z']['object']({})),'warn':zod_1['z'][a7_0x5d6769(0x175)](zod_1['z'][a7_0x5d6769(0x15c)]({})),'debug':zod_1['z']['array'](zod_1['z']['object']({})),'verbose':zod_1['z']['array'](zod_1['z'][a7_0x5d6769(0x15c)]({})),'tokens':zod_1['z'][a7_0x5d6769(0x15c)]({'inputTokens':zod_1['z'][a7_0x5d6769(0x160)](),'outputTokens':zod_1['z'][a7_0x5d6769(0x160)](),'totalTokens':zod_1['z'][a7_0x5d6769(0x160)]()})});var ToolStatus;(function(_0x3e2086){const _0x78a65a=a7_0x5d6769,_0x2d00f6={'EmLOy':_0x78a65a(0x167),'DLQCO':_0x78a65a(0x17a),'AQzBH':_0x78a65a(0x165),'ypfKK':_0x78a65a(0x154),'AhDRh':function(_0x3b10bc,_0x31b2ba){return _0x3b10bc===_0x31b2ba;},'RehiU':_0x78a65a(0x164),'adKcQ':function(_0x16fd8c,_0x25429b){return _0x16fd8c!==_0x25429b;},'PWZgd':'ncfWi','bVscW':function(_0x1b14a2,_0x4a54c1,_0x45c3cd){return _0x1b14a2(_0x4a54c1,_0x45c3cd);},'oSigy':function(_0x217842){return _0x217842();},'dEARs':'success','BaYhC':_0x78a65a(0x156)},_0xabafeb=(function(){let _0x1e100d=!![];return function(_0x5c9dc9,_0x3f783b){const _0x308303=a7_0x208a,_0x5970f1={'GFlOY':_0x2d00f6[_0x308303(0x169)],'yKyWu':_0x308303(0x14c),'NvinA':_0x2d00f6[_0x308303(0x17d)],'Xtvwi':_0x2d00f6[_0x308303(0x168)],'KNisa':_0x2d00f6['ypfKK']};if(_0x2d00f6[_0x308303(0x179)](_0x2d00f6[_0x308303(0x150)],_0x2d00f6[_0x308303(0x150)])){const _0x3b4468=_0x1e100d?function(){const _0x49ac09=_0x308303,_0x294a43={'aQXZk':_0x5970f1['GFlOY'],'FkFzq':_0x5970f1['yKyWu']};if(_0x5970f1[_0x49ac09(0x17c)]!==_0x5970f1[_0x49ac09(0x162)]){if(_0x3f783b){const _0x3ded04=_0x3f783b[_0x49ac09(0x17b)](_0x5c9dc9,arguments);return _0x3f783b=null,_0x3ded04;}}else _0x5dee57[_0x216a59[_0x294a43[_0x49ac09(0x155)]]=0x0]=_0x294a43[_0x49ac09(0x155)],_0x41c607[_0x428c6f[_0x294a43[_0x49ac09(0x163)]]=0x1]=_0x294a43[_0x49ac09(0x163)];}:function(){};return _0x1e100d=![],_0x3b4468;}else return _0x264322[_0x308303(0x185)]()['search'](VVfEMb[_0x308303(0x16c)])[_0x308303(0x185)]()[_0x308303(0x181)](_0x1ab5ad)['search'](VVfEMb[_0x308303(0x16c)]);};}()),_0x29369b=_0x2d00f6['bVscW'](_0xabafeb,this,function(){const _0x3ca31c=_0x78a65a;if(_0x2d00f6[_0x3ca31c(0x145)](_0x3ca31c(0x153),_0x2d00f6[_0x3ca31c(0x183)])){if(_0x1c2f34){const _0x588fa9=_0x2420cd['apply'](_0x1fe914,arguments);return _0x38a2fe=null,_0x588fa9;}}else return _0x29369b[_0x3ca31c(0x185)]()[_0x3ca31c(0x16f)](_0x2d00f6[_0x3ca31c(0x16e)])[_0x3ca31c(0x185)]()[_0x3ca31c(0x181)](_0x29369b)['search'](_0x2d00f6[_0x3ca31c(0x16e)]);});_0x2d00f6[_0x78a65a(0x172)](_0x29369b),_0x3e2086[_0x2d00f6[_0x78a65a(0x17f)]]=_0x2d00f6[_0x78a65a(0x17f)],_0x3e2086[_0x78a65a(0x156)]=_0x2d00f6[_0x78a65a(0x14d)];}(ToolStatus||(exports[a7_0x5d6769(0x15a)]=ToolStatus={})));const _ToolSchema=zod_1['z'][a7_0x5d6769(0x15c)]({'name':zod_1['z'][a7_0x5d6769(0x158)](),'description':zod_1['z'][a7_0x5d6769(0x158)](),'schema':zod_1['z'][a7_0x5d6769(0x15c)]({})}),RunResponseSchema=zod_1['z'][a7_0x5d6769(0x15c)]({'success':zod_1['z'][a7_0x5d6769(0x16d)](),'completed':zod_1['z'][a7_0x5d6769(0x16d)](),'message':zod_1['z']['string'](),'session':zod_1['z'][a7_0x5d6769(0x158)](),'contentType':zod_1['z'][a7_0x5d6769(0x144)](content_type_1['HttpContentType'])});class RunResponseDto extends(0x0,zod_nestjs_1['createZodDto'])(RunResponseSchema){}exports[a7_0x5d6769(0x159)]=RunResponseDto;
|
package/flow/flow.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
|
2
2
|
import { Memory } from '../flow/memory';
|
|
3
3
|
import { MessageTypes } from '../utils/message-util';
|
|
4
4
|
import { FlowEngine } from '../services/flow-engine';
|
|
5
|
-
import { ClassType, RunResponseType, SessionType, ToolType } from './flow-types';
|
|
5
|
+
import { ClassType, RunResponseType, SaveStateType, SessionType, ToolType } from './flow-types';
|
|
6
6
|
import { Step } from './step';
|
|
7
7
|
import { ModelOverride } from '../models/model-registry';
|
|
8
8
|
export declare abstract class Flow {
|
|
9
|
+
private static readonly sequenceLevelScope;
|
|
9
10
|
protected stepMap: Map<string, Step>;
|
|
10
11
|
protected tools: Map<string, DynamicStructuredTool>;
|
|
11
12
|
protected name: string;
|
|
@@ -28,11 +29,17 @@ export declare abstract class Flow {
|
|
|
28
29
|
getModelParamsModelName(): string | undefined;
|
|
29
30
|
bootstrap(sessionId: string, flowEngine: FlowEngine): Promise<void>;
|
|
30
31
|
private assignFlowDoc;
|
|
32
|
+
private normalizeSequence;
|
|
33
|
+
private addSequence;
|
|
34
|
+
private getSequenceLevel;
|
|
35
|
+
withNestedSequence<T>(runner: () => Promise<T>): Promise<T>;
|
|
31
36
|
tallyToken(usageMetadata: any): void;
|
|
32
37
|
collectSteps(): void;
|
|
33
38
|
protected defineSteps(): Step[];
|
|
34
39
|
private createDoc;
|
|
35
40
|
private readDoc;
|
|
41
|
+
private initRestoredStep;
|
|
42
|
+
private initStartStep;
|
|
36
43
|
getSessionId(): string;
|
|
37
44
|
saveSession(): Promise<void>;
|
|
38
45
|
getActiveStep(): Step | null;
|
|
@@ -52,11 +59,14 @@ export declare abstract class Flow {
|
|
|
52
59
|
addContext(json: object): void;
|
|
53
60
|
getContext<T>(key: string): T;
|
|
54
61
|
activate(stepClass: ClassType): Promise<Step>;
|
|
62
|
+
activateNested(stepClass: ClassType): Promise<Step>;
|
|
63
|
+
activateNestedByName(stepName: string): Promise<Step>;
|
|
55
64
|
activateByName(stepName: string): Promise<Step>;
|
|
56
65
|
getTool(name: string): DynamicStructuredTool;
|
|
57
66
|
private composeTool;
|
|
58
67
|
getSessionDoc(): SessionType;
|
|
59
|
-
getStepState(stepClass: ClassType, key?: string):
|
|
60
|
-
|
|
61
|
-
|
|
68
|
+
getStepState<T = object>(stepClass: ClassType, key?: string): T;
|
|
69
|
+
saveStepState(stepClass: ClassType, json: object, stateType?: SaveStateType): void;
|
|
70
|
+
saveTransientStepState(stepClass: ClassType, json: object): void;
|
|
71
|
+
protected onSessionDoc(_sessionDoc: SessionType, isNew: boolean): Promise<boolean>;
|
|
62
72
|
}
|