@picoflow/core 1.0.16 → 1.0.18

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.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/clients/http-client.js +1 -1
  3. package/clients/self-client.js +1 -1
  4. package/configs/core-config.d.ts +1 -0
  5. package/configs/core-config.js +1 -1
  6. package/decorators/stop-tool.js +1 -1
  7. package/flow/content-type.js +1 -1
  8. package/flow/end-step.d.ts +1 -1
  9. package/flow/end-step.js +1 -1
  10. package/flow/flow-creator.js +1 -1
  11. package/flow/flow-types.d.ts +108 -48
  12. package/flow/flow-types.js +1 -1
  13. package/flow/flow.d.ts +14 -4
  14. package/flow/flow.js +1 -1
  15. package/flow/llm-runner.d.ts +3 -1
  16. package/flow/llm-runner.js +1 -1
  17. package/flow/logic-runner.d.ts +2 -1
  18. package/flow/logic-runner.js +1 -1
  19. package/flow/logic-step.js +1 -1
  20. package/flow/memory.js +1 -1
  21. package/flow/step.d.ts +26 -7
  22. package/flow/step.js +1 -1
  23. package/index.d.ts +38 -33
  24. package/models/default-models.d.ts +1 -1
  25. package/models/default-models.js +1 -1
  26. package/models/model-registry.d.ts +22 -2
  27. package/models/model-registry.js +1 -1
  28. package/package.json +9 -9
  29. package/prompt/flow-prompt.js +1 -1
  30. package/prompt/prompt-util.js +1 -1
  31. package/services/flow-engine.js +1 -1
  32. package/session/cosmo-session.js +1 -1
  33. package/session/file-session.js +1 -1
  34. package/session/flow-session.js +1 -1
  35. package/session/mongo-session.js +1 -1
  36. package/session/session-adaptor.js +1 -1
  37. package/session/session-logger.js +1 -1
  38. package/session/sqlite-session.js +1 -1
  39. package/utils/constants.js +1 -1
  40. package/utils/environ.js +1 -1
  41. package/utils/errors.js +1 -1
  42. package/utils/license-util.js +1 -1
  43. package/utils/llm-file.d.ts +2 -0
  44. package/utils/llm-file.js +1 -1
  45. package/utils/logic.js +1 -1
  46. package/utils/message-util.d.ts +3 -1
  47. package/utils/message-util.js +1 -1
  48. package/utils/retry.js +1 -1
  49. package/utils/string-util.js +1 -1
  50. package/utils/tool-util.js +1 -1
  51. package/utils/verify-license.js +1 -1
@@ -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.ZodString, "many">;
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?: string[];
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,9 +369,13 @@ declare const FlowSchema: z.ZodObject<{
339
369
  modelParams?: Record<string, any>;
340
370
  }[];
341
371
  context?: {};
342
- sequence?: string[];
372
+ sequence?: {
373
+ level?: number;
374
+ stepName?: string;
375
+ }[];
343
376
  }>;
344
377
  export type FlowType = z.infer<typeof FlowSchema>;
378
+ export declare const RunStatusSchema: z.ZodEnum<["completed", "aborted", "running"]>;
345
379
  declare const _SessionSchema: z.ZodObject<{
346
380
  id: z.ZodString;
347
381
  createdOn: z.ZodDate;
@@ -377,28 +411,28 @@ declare const _SessionSchema: z.ZodObject<{
377
411
  additional_kwargs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
378
412
  }, "strip", z.ZodTypeAny, {
379
413
  content?: string;
414
+ id?: string;
415
+ name?: string;
380
416
  tool_calls?: {
381
417
  id?: string;
382
418
  name?: string;
383
419
  args?: {};
384
420
  }[];
385
421
  type?: "ai" | "human" | "system" | "tool";
386
- id?: string;
387
- name?: string;
388
422
  additional_kwargs?: Record<string, any>;
389
423
  status?: "success" | "error";
390
424
  timestamp?: Date;
391
425
  tool_call_id?: string;
392
426
  }, {
393
427
  content?: string;
428
+ id?: string;
429
+ name?: string;
394
430
  tool_calls?: {
395
431
  id?: string;
396
432
  name?: string;
397
433
  args?: {};
398
434
  }[];
399
435
  type?: "ai" | "human" | "system" | "tool";
400
- id?: string;
401
- name?: string;
402
436
  additional_kwargs?: Record<string, any>;
403
437
  status?: "success" | "error";
404
438
  timestamp?: Date;
@@ -408,14 +442,14 @@ declare const _SessionSchema: z.ZodObject<{
408
442
  nameSpace?: string;
409
443
  history?: {
410
444
  content?: string;
445
+ id?: string;
446
+ name?: string;
411
447
  tool_calls?: {
412
448
  id?: string;
413
449
  name?: string;
414
450
  args?: {};
415
451
  }[];
416
452
  type?: "ai" | "human" | "system" | "tool";
417
- id?: string;
418
- name?: string;
419
453
  additional_kwargs?: Record<string, any>;
420
454
  status?: "success" | "error";
421
455
  timestamp?: Date;
@@ -425,20 +459,21 @@ declare const _SessionSchema: z.ZodObject<{
425
459
  nameSpace?: string;
426
460
  history?: {
427
461
  content?: string;
462
+ id?: string;
463
+ name?: string;
428
464
  tool_calls?: {
429
465
  id?: string;
430
466
  name?: string;
431
467
  args?: {};
432
468
  }[];
433
469
  type?: "ai" | "human" | "system" | "tool";
434
- id?: string;
435
- name?: string;
436
470
  additional_kwargs?: Record<string, any>;
437
471
  status?: "success" | "error";
438
472
  timestamp?: Date;
439
473
  tool_call_id?: string;
440
474
  }[];
441
475
  }>, "many">;
476
+ start: z.ZodNullable<z.ZodString>;
442
477
  steps: z.ZodArray<z.ZodObject<{
443
478
  name: z.ZodString;
444
479
  isActive: z.ZodBoolean;
@@ -462,27 +497,37 @@ declare const _SessionSchema: z.ZodObject<{
462
497
  modelParams?: Record<string, any>;
463
498
  }>, "many">;
464
499
  context: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
465
- sequence: z.ZodArray<z.ZodString, "many">;
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">;
466
510
  }, "strip", z.ZodTypeAny, {
467
511
  name?: string;
468
512
  memory?: {
469
513
  nameSpace?: string;
470
514
  history?: {
471
515
  content?: string;
516
+ id?: string;
517
+ name?: string;
472
518
  tool_calls?: {
473
519
  id?: string;
474
520
  name?: string;
475
521
  args?: {};
476
522
  }[];
477
523
  type?: "ai" | "human" | "system" | "tool";
478
- id?: string;
479
- name?: string;
480
524
  additional_kwargs?: Record<string, any>;
481
525
  status?: "success" | "error";
482
526
  timestamp?: Date;
483
527
  tool_call_id?: string;
484
528
  }[];
485
529
  }[];
530
+ start?: string;
486
531
  steps?: {
487
532
  name?: string;
488
533
  isActive?: boolean;
@@ -492,27 +537,31 @@ declare const _SessionSchema: z.ZodObject<{
492
537
  modelParams?: Record<string, any>;
493
538
  }[];
494
539
  context?: {};
495
- sequence?: string[];
540
+ sequence?: {
541
+ level?: number;
542
+ stepName?: string;
543
+ }[];
496
544
  }, {
497
545
  name?: string;
498
546
  memory?: {
499
547
  nameSpace?: string;
500
548
  history?: {
501
549
  content?: string;
550
+ id?: string;
551
+ name?: string;
502
552
  tool_calls?: {
503
553
  id?: string;
504
554
  name?: string;
505
555
  args?: {};
506
556
  }[];
507
557
  type?: "ai" | "human" | "system" | "tool";
508
- id?: string;
509
- name?: string;
510
558
  additional_kwargs?: Record<string, any>;
511
559
  status?: "success" | "error";
512
560
  timestamp?: Date;
513
561
  tool_call_id?: string;
514
562
  }[];
515
563
  }[];
564
+ start?: string;
516
565
  steps?: {
517
566
  name?: string;
518
567
  isActive?: boolean;
@@ -522,7 +571,10 @@ declare const _SessionSchema: z.ZodObject<{
522
571
  modelParams?: Record<string, any>;
523
572
  }[];
524
573
  context?: {};
525
- sequence?: string[];
574
+ sequence?: {
575
+ level?: number;
576
+ stepName?: string;
577
+ }[];
526
578
  }>, "many">;
527
579
  log: z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "many">;
528
580
  error: z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "many">;
@@ -556,20 +608,21 @@ declare const _SessionSchema: z.ZodObject<{
556
608
  nameSpace?: string;
557
609
  history?: {
558
610
  content?: string;
611
+ id?: string;
612
+ name?: string;
559
613
  tool_calls?: {
560
614
  id?: string;
561
615
  name?: string;
562
616
  args?: {};
563
617
  }[];
564
618
  type?: "ai" | "human" | "system" | "tool";
565
- id?: string;
566
- name?: string;
567
619
  additional_kwargs?: Record<string, any>;
568
620
  status?: "success" | "error";
569
621
  timestamp?: Date;
570
622
  tool_call_id?: string;
571
623
  }[];
572
624
  }[];
625
+ start?: string;
573
626
  steps?: {
574
627
  name?: string;
575
628
  isActive?: boolean;
@@ -579,7 +632,10 @@ declare const _SessionSchema: z.ZodObject<{
579
632
  modelParams?: Record<string, any>;
580
633
  }[];
581
634
  context?: {};
582
- sequence?: string[];
635
+ sequence?: {
636
+ level?: number;
637
+ stepName?: string;
638
+ }[];
583
639
  }[];
584
640
  log?: {}[];
585
641
  warn?: {}[];
@@ -604,20 +660,21 @@ declare const _SessionSchema: z.ZodObject<{
604
660
  nameSpace?: string;
605
661
  history?: {
606
662
  content?: string;
663
+ id?: string;
664
+ name?: string;
607
665
  tool_calls?: {
608
666
  id?: string;
609
667
  name?: string;
610
668
  args?: {};
611
669
  }[];
612
670
  type?: "ai" | "human" | "system" | "tool";
613
- id?: string;
614
- name?: string;
615
671
  additional_kwargs?: Record<string, any>;
616
672
  status?: "success" | "error";
617
673
  timestamp?: Date;
618
674
  tool_call_id?: string;
619
675
  }[];
620
676
  }[];
677
+ start?: string;
621
678
  steps?: {
622
679
  name?: string;
623
680
  isActive?: boolean;
@@ -627,7 +684,10 @@ declare const _SessionSchema: z.ZodObject<{
627
684
  modelParams?: Record<string, any>;
628
685
  }[];
629
686
  context?: {};
630
- sequence?: string[];
687
+ sequence?: {
688
+ level?: number;
689
+ stepName?: string;
690
+ }[];
631
691
  }[];
632
692
  log?: {}[];
633
693
  warn?: {}[];
@@ -1 +1 @@
1
- 'use strict';const a7_0x267f46=a7_0x5193;(function(_0x111e51,_0x1c515c){const _0x414538=a7_0x5193,_0x218be0=_0x111e51();while(!![]){try{const _0xf3e19d=-parseInt(_0x414538(0x1b9))/0x1+-parseInt(_0x414538(0x199))/0x2*(parseInt(_0x414538(0x1b7))/0x3)+parseInt(_0x414538(0x1b0))/0x4*(parseInt(_0x414538(0x1a1))/0x5)+parseInt(_0x414538(0x1ba))/0x6*(parseInt(_0x414538(0x1a8))/0x7)+parseInt(_0x414538(0x1bd))/0x8+parseInt(_0x414538(0x19f))/0x9+-parseInt(_0x414538(0x1bb))/0xa;if(_0xf3e19d===_0x1c515c)break;else _0x218be0['push'](_0x218be0['shift']());}catch(_0x52b5c2){_0x218be0['push'](_0x218be0['shift']());}}}(a7_0x2628,0xcb7b5));function a7_0x5193(_0x54b2c2,_0x80132b){const _0x4fb869=a7_0x2628();return a7_0x5193=function(_0x2458db,_0x3e2b48){_0x2458db=_0x2458db-0x192;let _0x262832=_0x4fb869[_0x2458db];return _0x262832;},a7_0x5193(_0x54b2c2,_0x80132b);}Object[a7_0x267f46(0x198)](exports,a7_0x267f46(0x1a0),{'value':!![]}),exports[a7_0x267f46(0x197)]=exports[a7_0x267f46(0x1b1)]=void 0x0;const zod_1=require(a7_0x267f46(0x19b)),zod_nestjs_1=require(a7_0x267f46(0x192)),content_type_1=require(a7_0x267f46(0x194)),RoleEnum=zod_1['z'][a7_0x267f46(0x1b3)]([a7_0x267f46(0x1b8),a7_0x267f46(0x195),'ai',a7_0x267f46(0x1a6)]),ToolStatusEnum=zod_1['z'][a7_0x267f46(0x1b3)]([a7_0x267f46(0x1a2),a7_0x267f46(0x1a5)]),AIToolMessageSchema=zod_1['z'][a7_0x267f46(0x1b6)]({'name':zod_1['z']['string'](),'args':zod_1['z'][a7_0x267f46(0x1b6)]({}),'id':zod_1['z'][a7_0x267f46(0x1aa)]()}),ChatMessageSchema=zod_1['z'][a7_0x267f46(0x1b6)]({'id':zod_1['z'][a7_0x267f46(0x1aa)](),'type':RoleEnum,'content':zod_1['z'][a7_0x267f46(0x1aa)](),'timestamp':zod_1['z'][a7_0x267f46(0x196)](),'tool_call_id':zod_1['z'][a7_0x267f46(0x1aa)]()[a7_0x267f46(0x1a4)](),'name':zod_1['z'][a7_0x267f46(0x1aa)](),'status':ToolStatusEnum[a7_0x267f46(0x1a4)](),'tool_calls':zod_1['z'][a7_0x267f46(0x1ac)](AIToolMessageSchema)[a7_0x267f46(0x1a4)](),'additional_kwargs':zod_1['z']['record'](zod_1['z']['any']())[a7_0x267f46(0x1a4)]()}),StepSchema=zod_1['z'][a7_0x267f46(0x1b6)]({'name':zod_1['z']['string'](),'isActive':zod_1['z'][a7_0x267f46(0x19a)](),'state':zod_1['z'][a7_0x267f46(0x1b6)]({}),'modelName':zod_1['z'][a7_0x267f46(0x1aa)]()[a7_0x267f46(0x1a4)](),'modelParamsName':zod_1['z'][a7_0x267f46(0x1aa)]()[a7_0x267f46(0x1a4)](),'modelParams':zod_1['z']['record'](zod_1['z'][a7_0x267f46(0x1ad)]())[a7_0x267f46(0x1a4)]()}),MemorySchema=zod_1['z'][a7_0x267f46(0x1b6)]({'nameSpace':zod_1['z'][a7_0x267f46(0x1aa)](),'history':zod_1['z']['array'](ChatMessageSchema)}),FlowSchema=zod_1['z'][a7_0x267f46(0x1b6)]({'name':zod_1['z'][a7_0x267f46(0x1aa)](),'memory':zod_1['z']['array'](MemorySchema),'steps':zod_1['z'][a7_0x267f46(0x1ac)](StepSchema),'context':zod_1['z'][a7_0x267f46(0x1b6)]({}),'sequence':zod_1['z'][a7_0x267f46(0x1ac)](zod_1['z']['string']())}),RunStatusSchema=zod_1['z'][a7_0x267f46(0x1b3)]([a7_0x267f46(0x19c),a7_0x267f46(0x1ae),'running']),_SessionSchema=zod_1['z'][a7_0x267f46(0x1b6)]({'id':zod_1['z'][a7_0x267f46(0x1aa)]()['nonempty'](),'createdOn':zod_1['z'][a7_0x267f46(0x196)](),'saveOn':zod_1['z'][a7_0x267f46(0x196)](),'runStatus':RunStatusSchema,'version':zod_1['z'][a7_0x267f46(0x1ab)](),'expireAfter':zod_1['z'][a7_0x267f46(0x1ab)](),'flows':zod_1['z'][a7_0x267f46(0x1ac)](FlowSchema),'log':zod_1['z'][a7_0x267f46(0x1ac)](zod_1['z'][a7_0x267f46(0x1b6)]({})),'error':zod_1['z'][a7_0x267f46(0x1ac)](zod_1['z'][a7_0x267f46(0x1b6)]({})),'warn':zod_1['z'][a7_0x267f46(0x1ac)](zod_1['z']['object']({})),'debug':zod_1['z'][a7_0x267f46(0x1ac)](zod_1['z'][a7_0x267f46(0x1b6)]({})),'verbose':zod_1['z'][a7_0x267f46(0x1ac)](zod_1['z'][a7_0x267f46(0x1b6)]({})),'tokens':zod_1['z'][a7_0x267f46(0x1b6)]({'inputTokens':zod_1['z']['number'](),'outputTokens':zod_1['z'][a7_0x267f46(0x1ab)](),'totalTokens':zod_1['z'][a7_0x267f46(0x1ab)]()})});var ToolStatus;(function(_0x215ad2){const _0x20873a=a7_0x267f46,_0x1c8bc1={'LqHXk':_0x20873a(0x193),'pPKwp':function(_0x57a5fe,_0x1585d2,_0x6075de){return _0x57a5fe(_0x1585d2,_0x6075de);},'zEfHm':function(_0xb83d2b){return _0xb83d2b();},'LzSxR':'success','STVHH':'error'},_0x5cc97d=(function(){let _0x257960=!![];return function(_0x2ab537,_0x1d9ff2){const _0x3a164a=_0x257960?function(){const _0x2c29bb=a7_0x5193;if(_0x1d9ff2){const _0x2d9f26=_0x1d9ff2[_0x2c29bb(0x1a9)](_0x2ab537,arguments);return _0x1d9ff2=null,_0x2d9f26;}}:function(){};return _0x257960=![],_0x3a164a;};}()),_0x43040e=_0x1c8bc1[_0x20873a(0x1af)](_0x5cc97d,this,function(){const _0x12c03d=_0x20873a;return _0x43040e['toString']()[_0x12c03d(0x19d)](_0x1c8bc1[_0x12c03d(0x1b4)])[_0x12c03d(0x1b2)]()[_0x12c03d(0x1b5)](_0x43040e)[_0x12c03d(0x19d)](_0x1c8bc1[_0x12c03d(0x1b4)]);});_0x1c8bc1[_0x20873a(0x19e)](_0x43040e),_0x215ad2[_0x1c8bc1['LzSxR']]=_0x1c8bc1[_0x20873a(0x1bc)],_0x215ad2[_0x1c8bc1[_0x20873a(0x1a7)]]=_0x1c8bc1[_0x20873a(0x1a7)];}(ToolStatus||(exports[a7_0x267f46(0x1b1)]=ToolStatus={})));const _ToolSchema=zod_1['z']['object']({'name':zod_1['z'][a7_0x267f46(0x1aa)](),'description':zod_1['z']['string'](),'schema':zod_1['z'][a7_0x267f46(0x1b6)]({})}),RunResponseSchema=zod_1['z'][a7_0x267f46(0x1b6)]({'success':zod_1['z'][a7_0x267f46(0x19a)](),'completed':zod_1['z']['boolean'](),'message':zod_1['z'][a7_0x267f46(0x1aa)](),'session':zod_1['z']['string'](),'contentType':zod_1['z'][a7_0x267f46(0x1a3)](content_type_1[a7_0x267f46(0x1be)])});function a7_0x2628(){const _0x1bba11=['619727VVdXxK','382662WlwCso','4630820hvfEgn','LzSxR','7478784bVzALa','HttpContentType','@anatine/zod-nestjs','(((.+)+)+)+$','./content-type','human','date','RunResponseDto','defineProperty','20324XTdpNH','boolean','zod','completed','search','zEfHm','223146gnQoQn','__esModule','165265CpOCFI','success','nativeEnum','optional','error','tool','STVHH','161RXuSSt','apply','string','number','array','any','aborted','pPKwp','60vYDMYY','ToolStatus','toString','enum','LqHXk','constructor','object','297suXAOZ','system'];a7_0x2628=function(){return _0x1bba11;};return a7_0x2628();}class RunResponseDto extends(0x0,zod_nestjs_1['createZodDto'])(RunResponseSchema){}exports[a7_0x267f46(0x197)]=RunResponseDto;
1
+ 'use strict';const a7_0x521d5a=a7_0x1004;(function(_0x3078a5,_0x2168a5){const _0x216f8b=a7_0x1004,_0x55261a=_0x3078a5();while(!![]){try{const _0x43e089=parseInt(_0x216f8b(0x206))/0x1*(-parseInt(_0x216f8b(0x205))/0x2)+-parseInt(_0x216f8b(0x1ff))/0x3*(-parseInt(_0x216f8b(0x218))/0x4)+-parseInt(_0x216f8b(0x203))/0x5*(-parseInt(_0x216f8b(0x1ed))/0x6)+parseInt(_0x216f8b(0x1e3))/0x7*(-parseInt(_0x216f8b(0x1f1))/0x8)+-parseInt(_0x216f8b(0x20b))/0x9*(parseInt(_0x216f8b(0x1ef))/0xa)+parseInt(_0x216f8b(0x212))/0xb+parseInt(_0x216f8b(0x1f5))/0xc*(parseInt(_0x216f8b(0x219))/0xd);if(_0x43e089===_0x2168a5)break;else _0x55261a['push'](_0x55261a['shift']());}catch(_0x29fa5c){_0x55261a['push'](_0x55261a['shift']());}}}(a7_0x4a64,0x43dce));Object['defineProperty'](exports,a7_0x521d5a(0x208),{'value':!![]}),exports[a7_0x521d5a(0x1e7)]=exports['ToolStatus']=exports['RunStatusSchema']=exports[a7_0x521d5a(0x1fd)]=void 0x0;const zod_1=require(a7_0x521d5a(0x1e4)),zod_nestjs_1=require(a7_0x521d5a(0x21d)),content_type_1=require(a7_0x521d5a(0x1f6));function a7_0x1004(_0x28776e,_0x32f1ee){const _0x51b32c=a7_0x4a64();return a7_0x1004=function(_0x207f60,_0x29821a){_0x207f60=_0x207f60-0x1e0;let _0x4a647d=_0x51b32c[_0x207f60];return _0x4a647d;},a7_0x1004(_0x28776e,_0x32f1ee);}var SaveStateType;(function(_0x1d3a39){const _0x110edd=a7_0x521d5a,_0x3e6e18={'uvNVz':_0x110edd(0x1f2),'ECYiJ':_0x110edd(0x1f7)};_0x1d3a39[_0x1d3a39[_0x3e6e18[_0x110edd(0x1e0)]]=0x0]=_0x3e6e18[_0x110edd(0x1e0)],_0x1d3a39[_0x1d3a39[_0x3e6e18['ECYiJ']]=0x1]=_0x3e6e18['ECYiJ'];}(SaveStateType||(exports['SaveStateType']=SaveStateType={})));const RoleEnum=zod_1['z'][a7_0x521d5a(0x1ea)](['system',a7_0x521d5a(0x201),'ai',a7_0x521d5a(0x1fa)]),ToolStatusEnum=zod_1['z'][a7_0x521d5a(0x1ea)]([a7_0x521d5a(0x20c),a7_0x521d5a(0x210)]),AIToolMessageSchema=zod_1['z'][a7_0x521d5a(0x1f8)]({'name':zod_1['z'][a7_0x521d5a(0x1e5)](),'args':zod_1['z']['object']({}),'id':zod_1['z'][a7_0x521d5a(0x1e5)]()}),ChatMessageSchema=zod_1['z']['object']({'id':zod_1['z'][a7_0x521d5a(0x1e5)](),'type':RoleEnum,'content':zod_1['z'][a7_0x521d5a(0x1e5)](),'timestamp':zod_1['z'][a7_0x521d5a(0x20f)](),'tool_call_id':zod_1['z'][a7_0x521d5a(0x1e5)]()['optional'](),'name':zod_1['z'][a7_0x521d5a(0x1e5)](),'status':ToolStatusEnum[a7_0x521d5a(0x211)](),'tool_calls':zod_1['z']['array'](AIToolMessageSchema)['optional'](),'additional_kwargs':zod_1['z'][a7_0x521d5a(0x21b)](zod_1['z'][a7_0x521d5a(0x214)]())[a7_0x521d5a(0x211)]()}),StepSchema=zod_1['z'][a7_0x521d5a(0x1f8)]({'name':zod_1['z'][a7_0x521d5a(0x1e5)](),'isActive':zod_1['z']['boolean'](),'state':zod_1['z'][a7_0x521d5a(0x1f8)]({}),'modelName':zod_1['z'][a7_0x521d5a(0x1e5)]()[a7_0x521d5a(0x211)](),'modelParamsName':zod_1['z']['string']()[a7_0x521d5a(0x211)](),'modelParams':zod_1['z'][a7_0x521d5a(0x21b)](zod_1['z'][a7_0x521d5a(0x214)]())[a7_0x521d5a(0x211)]()}),MemorySchema=zod_1['z'][a7_0x521d5a(0x1f8)]({'nameSpace':zod_1['z'][a7_0x521d5a(0x1e5)](),'history':zod_1['z'][a7_0x521d5a(0x20d)](ChatMessageSchema)}),FlowSequenceItemSchema=zod_1['z'][a7_0x521d5a(0x1f8)]({'level':zod_1['z'][a7_0x521d5a(0x21c)]()[a7_0x521d5a(0x215)]()[a7_0x521d5a(0x1fe)](0x1),'stepName':zod_1['z'][a7_0x521d5a(0x1e5)]()}),FlowSchema=zod_1['z'][a7_0x521d5a(0x1f8)]({'name':zod_1['z']['string'](),'memory':zod_1['z'][a7_0x521d5a(0x20d)](MemorySchema),'start':zod_1['z']['string']()['nullable'](),'steps':zod_1['z'][a7_0x521d5a(0x20d)](StepSchema),'context':zod_1['z'][a7_0x521d5a(0x1f8)]({}),'sequence':zod_1['z'][a7_0x521d5a(0x20d)](FlowSequenceItemSchema)});exports[a7_0x521d5a(0x204)]=zod_1['z']['enum']([a7_0x521d5a(0x217),a7_0x521d5a(0x20a),'running']);const _SessionSchema=zod_1['z'][a7_0x521d5a(0x1f8)]({'id':zod_1['z'][a7_0x521d5a(0x1e5)]()['nonempty'](),'createdOn':zod_1['z'][a7_0x521d5a(0x20f)](),'saveOn':zod_1['z']['date'](),'runStatus':exports[a7_0x521d5a(0x204)],'version':zod_1['z'][a7_0x521d5a(0x21c)](),'expireAfter':zod_1['z'][a7_0x521d5a(0x21c)](),'flows':zod_1['z'][a7_0x521d5a(0x20d)](FlowSchema),'log':zod_1['z'][a7_0x521d5a(0x20d)](zod_1['z'][a7_0x521d5a(0x1f8)]({})),'error':zod_1['z'][a7_0x521d5a(0x20d)](zod_1['z'][a7_0x521d5a(0x1f8)]({})),'warn':zod_1['z'][a7_0x521d5a(0x20d)](zod_1['z'][a7_0x521d5a(0x1f8)]({})),'debug':zod_1['z'][a7_0x521d5a(0x20d)](zod_1['z']['object']({})),'verbose':zod_1['z']['array'](zod_1['z'][a7_0x521d5a(0x1f8)]({})),'tokens':zod_1['z']['object']({'inputTokens':zod_1['z']['number'](),'outputTokens':zod_1['z'][a7_0x521d5a(0x21c)](),'totalTokens':zod_1['z'][a7_0x521d5a(0x21c)]()})});var ToolStatus;(function(_0x57f686){const _0x46bd75=a7_0x521d5a,_0x4791ef={'ZMdkf':function(_0x3391e0,_0x4e8673){return _0x3391e0!==_0x4e8673;},'eJnUc':_0x46bd75(0x1f0),'OXuhB':'(((.+)+)+)+$','FPwKm':_0x46bd75(0x1e2),'tdisY':_0x46bd75(0x216),'CcjnO':function(_0x4106f2){return _0x4106f2();},'PnPEY':_0x46bd75(0x20c),'rUiLB':_0x46bd75(0x210)},_0x1098bf=(function(){const _0x6f7954=_0x46bd75,_0x423f3d={'VBjOx':function(_0x372680,_0x1d869e){const _0x1cf3d2=a7_0x1004;return _0x4791ef[_0x1cf3d2(0x1ee)](_0x372680,_0x1d869e);},'xEmyI':_0x4791ef[_0x6f7954(0x207)]};let _0xb22b3c=!![];return function(_0x1fafd4,_0x5c98b1){const _0x1eca59=_0x6f7954;if(_0x423f3d[_0x1eca59(0x202)](_0x423f3d[_0x1eca59(0x1eb)],_0x423f3d[_0x1eca59(0x1eb)])){if(_0x1c2ad8){const _0x3f167c=_0x5578c1[_0x1eca59(0x1fb)](_0x1c1add,arguments);return _0x55f0f0=null,_0x3f167c;}}else{const _0x34b9ed=_0xb22b3c?function(){const _0x2a1889=_0x1eca59;if(_0x5c98b1){const _0x481b25=_0x5c98b1[_0x2a1889(0x1fb)](_0x1fafd4,arguments);return _0x5c98b1=null,_0x481b25;}}:function(){};return _0xb22b3c=![],_0x34b9ed;}};}()),_0x152ff9=_0x1098bf(this,function(){const _0x2687bf=_0x46bd75;return _0x4791ef[_0x2687bf(0x213)]!==_0x4791ef[_0x2687bf(0x209)]?_0x152ff9[_0x2687bf(0x1f4)]()[_0x2687bf(0x1ec)](_0x4791ef['OXuhB'])['toString']()['constructor'](_0x152ff9)[_0x2687bf(0x1ec)](_0x4791ef['OXuhB']):_0x552bf7['toString']()[_0x2687bf(0x1ec)](_0x2687bf(0x200))['toString']()[_0x2687bf(0x1f9)](_0x5bd74b)['search'](ThGhRg['OXuhB']);});_0x4791ef[_0x46bd75(0x1f3)](_0x152ff9),_0x57f686[_0x4791ef[_0x46bd75(0x21a)]]=_0x46bd75(0x20c),_0x57f686[_0x4791ef[_0x46bd75(0x20e)]]=_0x4791ef[_0x46bd75(0x20e)];}(ToolStatus||(exports[a7_0x521d5a(0x1e9)]=ToolStatus={})));const _ToolSchema=zod_1['z'][a7_0x521d5a(0x1f8)]({'name':zod_1['z'][a7_0x521d5a(0x1e5)](),'description':zod_1['z'][a7_0x521d5a(0x1e5)](),'schema':zod_1['z'][a7_0x521d5a(0x1f8)]({})}),RunResponseSchema=zod_1['z'][a7_0x521d5a(0x1f8)]({'success':zod_1['z']['boolean'](),'completed':zod_1['z'][a7_0x521d5a(0x1e8)](),'message':zod_1['z']['string'](),'session':zod_1['z'][a7_0x521d5a(0x1e5)](),'contentType':zod_1['z'][a7_0x521d5a(0x1fc)](content_type_1[a7_0x521d5a(0x1e6)])});class RunResponseDto extends(0x0,zod_nestjs_1[a7_0x521d5a(0x1e1)])(RunResponseSchema){}exports[a7_0x521d5a(0x1e7)]=RunResponseDto;function a7_0x4a64(){const _0x47df08=['completed','8ybyRey','7925086dHYmiK','PnPEY','record','number','@anatine/zod-nestjs','uvNVz','createZodDto','BtUIu','604107igGYeg','zod','string','HttpContentType','RunResponseDto','boolean','ToolStatus','enum','xEmyI','search','177972pSUMND','ZMdkf','190EuZJse','KYjKq','48DYklDf','transient','CcjnO','toString','12lChqzl','./content-type','persistent','object','constructor','tool','apply','nativeEnum','SaveStateType','min','283767rvEPDn','(((.+)+)+)+$','human','VBjOx','70BhCdiu','RunStatusSchema','86guZpEg','9069fGVmnc','eJnUc','__esModule','tdisY','aborted','88047ZQRGpa','success','array','rUiLB','date','error','optional','1733028UCbdwB','FPwKm','any','int','BqiNl'];a7_0x4a64=function(){return _0x47df08;};return a7_0x4a64();}
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): object;
60
- getStepStateAs<T>(stepClass: ClassType, key?: string): T;
61
- saveStepState(stepClass: ClassType, json: object, isTransient?: boolean): void;
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
  }