llmz 0.0.14 → 0.0.15
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/dist/{chunk-KH6JQYQA.js → chunk-2D2DE7CD.js} +2 -2
- package/dist/{chunk-WL7ZIMYD.cjs → chunk-3G3BS5IA.cjs} +31 -6
- package/dist/{chunk-SNDVQU5A.js → chunk-3JYCCI4S.js} +1 -1
- package/dist/{chunk-OKTHMXRT.js → chunk-A7QHWVD7.js} +19 -2
- package/dist/{chunk-IH2WQFO5.js → chunk-EE6NVDID.js} +1 -1
- package/dist/{chunk-4L6D2A6O.cjs → chunk-FZJHYLM2.cjs} +14 -14
- package/dist/{chunk-JGVAZO4X.cjs → chunk-GZPN7RGH.cjs} +2 -2
- package/dist/{chunk-SHJDRZF5.cjs → chunk-PIDLNYIP.cjs} +25 -25
- package/dist/{chunk-2Z5SFF6R.js → chunk-RBRTK37G.js} +83 -4
- package/dist/{chunk-GOJY4GRL.cjs → chunk-TCRRSS44.cjs} +97 -18
- package/dist/{chunk-XAN7HQP5.js → chunk-VPTFUOIK.js} +26 -1
- package/dist/{chunk-276Q6EWP.cjs → chunk-WHNOR4ZU.cjs} +3 -0
- package/dist/{chunk-KG7DT7WD.cjs → chunk-XGJOEQMW.cjs} +30 -13
- package/dist/{chunk-4MNIJGK6.js → chunk-ZORRILUV.js} +3 -0
- package/dist/context.d.ts +200 -4
- package/dist/{dual-modes-T53P72CH.js → dual-modes-7FI4T35O.js} +3 -3
- package/dist/{dual-modes-VLIGPIHX.cjs → dual-modes-OFHV2C3X.cjs} +4 -4
- package/dist/exit-XAYKJ6TR.cjs +8 -0
- package/dist/{exit-7HDRH27N.js → exit-YLO7BY7Z.js} +2 -2
- package/dist/exit.d.ts +36 -2
- package/dist/index.cjs +56 -28
- package/dist/index.d.ts +9 -1
- package/dist/index.js +45 -17
- package/dist/{llmz-MCHRHRTD.js → llmz-67EZPJ4E.js} +7 -7
- package/dist/{llmz-TR4CQK4F.cjs → llmz-WVNKAMCP.cjs} +18 -18
- package/dist/objects.d.ts +36 -1
- package/dist/result.d.ts +379 -6
- package/dist/snapshots.d.ts +12 -1
- package/dist/{tool-NS7EGK7Z.cjs → tool-O4SFRIE4.cjs} +4 -4
- package/dist/{tool-4AJIJ3QB.js → tool-PCOYOCRH.js} +3 -3
- package/dist/tool.d.ts +29 -2
- package/dist/{truncator-IY2MXOMC.js → truncator-BSP6PQPC.js} +2 -2
- package/dist/truncator-W3NXBLYJ.cjs +10 -0
- package/dist/types.d.ts +3 -0
- package/dist/{typings-GDMY6VY2.js → typings-WYHEFCYB.js} +2 -2
- package/dist/{typings-2CPHOFDN.cjs → typings-Y45GMPZT.cjs} +3 -3
- package/dist/utils-L5QAQXV2.cjs +39 -0
- package/dist/{utils-N24IHDFA.js → utils-RQHQ2KOG.js} +1 -1
- package/package.json +1 -1
- package/dist/exit-O2WZUEFS.cjs +0 -8
- package/dist/truncator-DUMWEGQO.cjs +0 -10
- package/dist/utils-A7WNEFTA.cjs +0 -39
package/dist/result.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { Context, Iteration } from './context.js';
|
|
|
2
2
|
import { SnapshotSignal } from './errors.js';
|
|
3
3
|
import { Exit, ExitResult } from './exit.js';
|
|
4
4
|
import { Snapshot } from './snapshots.js';
|
|
5
|
+
import { Serializable } from './types.js';
|
|
6
|
+
type ExecutionStatus = 'success' | 'error' | 'interrupted';
|
|
7
|
+
export declare namespace ExecutionResult {
|
|
8
|
+
type JSON = SuccessExecutionResult.JSON | ErrorExecutionResult.JSON | PartialExecutionResult.JSON;
|
|
9
|
+
}
|
|
5
10
|
/**
|
|
6
11
|
* Base class for all execution results returned by the `execute()` function.
|
|
7
12
|
*
|
|
@@ -98,10 +103,10 @@ import { Snapshot } from './snapshots.js';
|
|
|
98
103
|
* @see {@link ErrorExecutionResult} For failed execution results
|
|
99
104
|
* @see {@link PartialExecutionResult} For interrupted execution results
|
|
100
105
|
*/
|
|
101
|
-
export declare abstract class ExecutionResult {
|
|
102
|
-
readonly status:
|
|
106
|
+
export declare abstract class ExecutionResult implements Serializable<ExecutionResult.JSON> {
|
|
107
|
+
readonly status: ExecutionStatus;
|
|
103
108
|
readonly context: Context;
|
|
104
|
-
protected constructor(status:
|
|
109
|
+
protected constructor(status: ExecutionStatus, context: Context);
|
|
105
110
|
/**
|
|
106
111
|
* Type guard to check if the execution completed successfully.
|
|
107
112
|
*
|
|
@@ -286,6 +291,17 @@ export declare abstract class ExecutionResult {
|
|
|
286
291
|
* ```
|
|
287
292
|
*/
|
|
288
293
|
get iterations(): Iteration[];
|
|
294
|
+
abstract toJSON(): ExecutionResult.JSON;
|
|
295
|
+
}
|
|
296
|
+
export declare namespace SuccessExecutionResult {
|
|
297
|
+
type JSON = {
|
|
298
|
+
status: 'success';
|
|
299
|
+
context: Context.JSON;
|
|
300
|
+
result: {
|
|
301
|
+
exit: Exit.JSON;
|
|
302
|
+
result: unknown;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
289
305
|
}
|
|
290
306
|
/**
|
|
291
307
|
* Result for successful executions that completed with an Exit.
|
|
@@ -333,7 +349,7 @@ export declare abstract class ExecutionResult {
|
|
|
333
349
|
* }
|
|
334
350
|
* ```
|
|
335
351
|
*/
|
|
336
|
-
export declare class SuccessExecutionResult<TOutput = unknown> extends ExecutionResult {
|
|
352
|
+
export declare class SuccessExecutionResult<TOutput = unknown> extends ExecutionResult implements Serializable<SuccessExecutionResult.JSON> {
|
|
337
353
|
readonly result: ExitResult<TOutput>;
|
|
338
354
|
constructor(context: Context, result: ExitResult<TOutput>);
|
|
339
355
|
/**
|
|
@@ -355,6 +371,128 @@ export declare class SuccessExecutionResult<TOutput = unknown> extends Execution
|
|
|
355
371
|
* @returns The final iteration (guaranteed to exist)
|
|
356
372
|
*/
|
|
357
373
|
get iteration(): Iteration;
|
|
374
|
+
/**
|
|
375
|
+
* Serializes the execution result to JSON.
|
|
376
|
+
*
|
|
377
|
+
* This method converts the execution result into a JSON format that includes
|
|
378
|
+
* the execution status, context, and exit information. It is used for serialization
|
|
379
|
+
* and transmission of the execution result.
|
|
380
|
+
*
|
|
381
|
+
* @returns The JSON representation of the execution result.
|
|
382
|
+
*/
|
|
383
|
+
toJSON(): {
|
|
384
|
+
status: "success";
|
|
385
|
+
context: {
|
|
386
|
+
id: string;
|
|
387
|
+
iterations: {
|
|
388
|
+
id: string;
|
|
389
|
+
messages: import("./index.js").LLMzPrompts.Message[];
|
|
390
|
+
code: string | undefined;
|
|
391
|
+
traces: import("./types.js").Traces.Trace[];
|
|
392
|
+
variables: Record<string, any>;
|
|
393
|
+
started_ts: number;
|
|
394
|
+
ended_ts: number | undefined;
|
|
395
|
+
status: import("./context.js").IterationStatus;
|
|
396
|
+
mutations: import("./types.js").ObjectMutation[];
|
|
397
|
+
llm: {
|
|
398
|
+
started_at: number;
|
|
399
|
+
ended_at: number;
|
|
400
|
+
status: "success" | "error";
|
|
401
|
+
cached: boolean;
|
|
402
|
+
tokens: number;
|
|
403
|
+
spend: number;
|
|
404
|
+
output: string;
|
|
405
|
+
model: string;
|
|
406
|
+
} | undefined;
|
|
407
|
+
transcript: import("./transcript.js").Transcript.Message[];
|
|
408
|
+
tools: {
|
|
409
|
+
name: string;
|
|
410
|
+
aliases: string[];
|
|
411
|
+
description: string | undefined;
|
|
412
|
+
metadata: Record<string, unknown>;
|
|
413
|
+
input: import("json-schema").JSONSchema7 | undefined;
|
|
414
|
+
output: import("json-schema").JSONSchema7 | undefined;
|
|
415
|
+
staticInputValues: unknown;
|
|
416
|
+
maxRetries: number;
|
|
417
|
+
}[];
|
|
418
|
+
objects: {
|
|
419
|
+
name: string;
|
|
420
|
+
description: string | undefined;
|
|
421
|
+
properties: import("./objects.js").ObjectProperty[] | undefined;
|
|
422
|
+
tools: {
|
|
423
|
+
name: string;
|
|
424
|
+
aliases: string[];
|
|
425
|
+
description: string | undefined;
|
|
426
|
+
metadata: Record<string, unknown>;
|
|
427
|
+
input: import("json-schema").JSONSchema7 | undefined;
|
|
428
|
+
output: import("json-schema").JSONSchema7 | undefined;
|
|
429
|
+
staticInputValues: unknown;
|
|
430
|
+
maxRetries: number;
|
|
431
|
+
}[];
|
|
432
|
+
metadata: Record<string, unknown> | undefined;
|
|
433
|
+
}[];
|
|
434
|
+
exits: {
|
|
435
|
+
name: string;
|
|
436
|
+
aliases: string[];
|
|
437
|
+
description: string;
|
|
438
|
+
metadata: {
|
|
439
|
+
[x: string]: unknown;
|
|
440
|
+
};
|
|
441
|
+
schema: import("json-schema").JSONSchema7 | undefined;
|
|
442
|
+
}[];
|
|
443
|
+
instructions: string | undefined;
|
|
444
|
+
duration: string;
|
|
445
|
+
error: string | null;
|
|
446
|
+
isChatEnabled: boolean;
|
|
447
|
+
}[];
|
|
448
|
+
iteration: number;
|
|
449
|
+
timeout: number;
|
|
450
|
+
loop: number;
|
|
451
|
+
temperature: number;
|
|
452
|
+
model: "best" | "fast" | `${string}:${string}` | undefined;
|
|
453
|
+
metadata: Record<string, any>;
|
|
454
|
+
snapshot: {
|
|
455
|
+
id: string;
|
|
456
|
+
reason: string | undefined;
|
|
457
|
+
stack: string;
|
|
458
|
+
variables: ({
|
|
459
|
+
name: string;
|
|
460
|
+
type: string;
|
|
461
|
+
bytes: number;
|
|
462
|
+
preview?: string;
|
|
463
|
+
value?: unknown;
|
|
464
|
+
truncated: boolean;
|
|
465
|
+
} & ({
|
|
466
|
+
truncated: true;
|
|
467
|
+
preview: string;
|
|
468
|
+
} | {
|
|
469
|
+
truncated: false;
|
|
470
|
+
value: unknown;
|
|
471
|
+
}))[];
|
|
472
|
+
toolCall: import("./errors.js").ToolCall | undefined;
|
|
473
|
+
status: import("./snapshots.js").SnapshotStatus;
|
|
474
|
+
} | undefined;
|
|
475
|
+
};
|
|
476
|
+
result: {
|
|
477
|
+
exit: {
|
|
478
|
+
name: string;
|
|
479
|
+
aliases: string[];
|
|
480
|
+
description: string;
|
|
481
|
+
metadata: {
|
|
482
|
+
[x: string]: unknown;
|
|
483
|
+
};
|
|
484
|
+
schema: import("json-schema").JSONSchema7 | undefined;
|
|
485
|
+
};
|
|
486
|
+
result: TOutput;
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
export declare namespace ErrorExecutionResult {
|
|
491
|
+
type JSON = {
|
|
492
|
+
status: 'error';
|
|
493
|
+
context: Context.JSON;
|
|
494
|
+
error: unknown;
|
|
495
|
+
};
|
|
358
496
|
}
|
|
359
497
|
/**
|
|
360
498
|
* Result for executions that failed with an unrecoverable error.
|
|
@@ -388,7 +526,7 @@ export declare class SuccessExecutionResult<TOutput = unknown> extends Execution
|
|
|
388
526
|
* }
|
|
389
527
|
* ```
|
|
390
528
|
*/
|
|
391
|
-
export declare class ErrorExecutionResult extends ExecutionResult {
|
|
529
|
+
export declare class ErrorExecutionResult extends ExecutionResult implements Serializable<ErrorExecutionResult.JSON> {
|
|
392
530
|
readonly error: unknown;
|
|
393
531
|
constructor(context: Context, error: unknown);
|
|
394
532
|
/**
|
|
@@ -397,6 +535,113 @@ export declare class ErrorExecutionResult extends ExecutionResult {
|
|
|
397
535
|
* @returns Always null since error executions don't produce output
|
|
398
536
|
*/
|
|
399
537
|
get output(): null;
|
|
538
|
+
toJSON(): {
|
|
539
|
+
status: "error";
|
|
540
|
+
context: {
|
|
541
|
+
id: string;
|
|
542
|
+
iterations: {
|
|
543
|
+
id: string;
|
|
544
|
+
messages: import("./index.js").LLMzPrompts.Message[];
|
|
545
|
+
code: string | undefined;
|
|
546
|
+
traces: import("./types.js").Traces.Trace[];
|
|
547
|
+
variables: Record<string, any>;
|
|
548
|
+
started_ts: number;
|
|
549
|
+
ended_ts: number | undefined;
|
|
550
|
+
status: import("./context.js").IterationStatus;
|
|
551
|
+
mutations: import("./types.js").ObjectMutation[];
|
|
552
|
+
llm: {
|
|
553
|
+
started_at: number;
|
|
554
|
+
ended_at: number;
|
|
555
|
+
status: "success" | "error";
|
|
556
|
+
cached: boolean;
|
|
557
|
+
tokens: number;
|
|
558
|
+
spend: number;
|
|
559
|
+
output: string;
|
|
560
|
+
model: string;
|
|
561
|
+
} | undefined;
|
|
562
|
+
transcript: import("./transcript.js").Transcript.Message[];
|
|
563
|
+
tools: {
|
|
564
|
+
name: string;
|
|
565
|
+
aliases: string[];
|
|
566
|
+
description: string | undefined;
|
|
567
|
+
metadata: Record<string, unknown>;
|
|
568
|
+
input: import("json-schema").JSONSchema7 | undefined;
|
|
569
|
+
output: import("json-schema").JSONSchema7 | undefined;
|
|
570
|
+
staticInputValues: unknown;
|
|
571
|
+
maxRetries: number;
|
|
572
|
+
}[];
|
|
573
|
+
objects: {
|
|
574
|
+
name: string;
|
|
575
|
+
description: string | undefined;
|
|
576
|
+
properties: import("./objects.js").ObjectProperty[] | undefined;
|
|
577
|
+
tools: {
|
|
578
|
+
name: string;
|
|
579
|
+
aliases: string[];
|
|
580
|
+
description: string | undefined;
|
|
581
|
+
metadata: Record<string, unknown>;
|
|
582
|
+
input: import("json-schema").JSONSchema7 | undefined;
|
|
583
|
+
output: import("json-schema").JSONSchema7 | undefined;
|
|
584
|
+
staticInputValues: unknown;
|
|
585
|
+
maxRetries: number;
|
|
586
|
+
}[];
|
|
587
|
+
metadata: Record<string, unknown> | undefined;
|
|
588
|
+
}[];
|
|
589
|
+
exits: {
|
|
590
|
+
name: string;
|
|
591
|
+
aliases: string[];
|
|
592
|
+
description: string;
|
|
593
|
+
metadata: {
|
|
594
|
+
[x: string]: unknown;
|
|
595
|
+
};
|
|
596
|
+
schema: import("json-schema").JSONSchema7 | undefined;
|
|
597
|
+
}[];
|
|
598
|
+
instructions: string | undefined;
|
|
599
|
+
duration: string;
|
|
600
|
+
error: string | null;
|
|
601
|
+
isChatEnabled: boolean;
|
|
602
|
+
}[];
|
|
603
|
+
iteration: number;
|
|
604
|
+
timeout: number;
|
|
605
|
+
loop: number;
|
|
606
|
+
temperature: number;
|
|
607
|
+
model: "best" | "fast" | `${string}:${string}` | undefined;
|
|
608
|
+
metadata: Record<string, any>;
|
|
609
|
+
snapshot: {
|
|
610
|
+
id: string;
|
|
611
|
+
reason: string | undefined;
|
|
612
|
+
stack: string;
|
|
613
|
+
variables: ({
|
|
614
|
+
name: string;
|
|
615
|
+
type: string;
|
|
616
|
+
bytes: number;
|
|
617
|
+
preview?: string;
|
|
618
|
+
value?: unknown;
|
|
619
|
+
truncated: boolean;
|
|
620
|
+
} & ({
|
|
621
|
+
truncated: true;
|
|
622
|
+
preview: string;
|
|
623
|
+
} | {
|
|
624
|
+
truncated: false;
|
|
625
|
+
value: unknown;
|
|
626
|
+
}))[];
|
|
627
|
+
toolCall: import("./errors.js").ToolCall | undefined;
|
|
628
|
+
status: import("./snapshots.js").SnapshotStatus;
|
|
629
|
+
} | undefined;
|
|
630
|
+
};
|
|
631
|
+
error: unknown;
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
export declare namespace PartialExecutionResult {
|
|
635
|
+
type JSON = {
|
|
636
|
+
status: 'interrupted';
|
|
637
|
+
context: Context.JSON;
|
|
638
|
+
snapshot: Snapshot.JSON;
|
|
639
|
+
signal: {
|
|
640
|
+
message: string;
|
|
641
|
+
truncatedCode?: string;
|
|
642
|
+
variables: Record<string, any>;
|
|
643
|
+
};
|
|
644
|
+
};
|
|
400
645
|
}
|
|
401
646
|
/**
|
|
402
647
|
* Result for executions that were interrupted before completion.
|
|
@@ -450,7 +695,7 @@ export declare class ErrorExecutionResult extends ExecutionResult {
|
|
|
450
695
|
* }
|
|
451
696
|
* ```
|
|
452
697
|
*/
|
|
453
|
-
export declare class PartialExecutionResult extends ExecutionResult {
|
|
698
|
+
export declare class PartialExecutionResult extends ExecutionResult implements Serializable<PartialExecutionResult.JSON> {
|
|
454
699
|
readonly signal: SnapshotSignal;
|
|
455
700
|
readonly snapshot: Snapshot;
|
|
456
701
|
constructor(context: Context, signal: SnapshotSignal, snapshot: Snapshot);
|
|
@@ -460,4 +705,132 @@ export declare class PartialExecutionResult extends ExecutionResult {
|
|
|
460
705
|
* @returns Always null since interrupted executions don't produce final output
|
|
461
706
|
*/
|
|
462
707
|
get output(): null;
|
|
708
|
+
/**
|
|
709
|
+
* Serializes the execution result to JSON.
|
|
710
|
+
*
|
|
711
|
+
* @returns The JSON representation of the execution result.
|
|
712
|
+
*/
|
|
713
|
+
toJSON(): {
|
|
714
|
+
status: "interrupted";
|
|
715
|
+
context: {
|
|
716
|
+
id: string;
|
|
717
|
+
iterations: {
|
|
718
|
+
id: string;
|
|
719
|
+
messages: import("./index.js").LLMzPrompts.Message[];
|
|
720
|
+
code: string | undefined;
|
|
721
|
+
traces: import("./types.js").Traces.Trace[];
|
|
722
|
+
variables: Record<string, any>;
|
|
723
|
+
started_ts: number;
|
|
724
|
+
ended_ts: number | undefined;
|
|
725
|
+
status: import("./context.js").IterationStatus;
|
|
726
|
+
mutations: import("./types.js").ObjectMutation[];
|
|
727
|
+
llm: {
|
|
728
|
+
started_at: number;
|
|
729
|
+
ended_at: number;
|
|
730
|
+
status: "success" | "error";
|
|
731
|
+
cached: boolean;
|
|
732
|
+
tokens: number;
|
|
733
|
+
spend: number;
|
|
734
|
+
output: string;
|
|
735
|
+
model: string;
|
|
736
|
+
} | undefined;
|
|
737
|
+
transcript: import("./transcript.js").Transcript.Message[];
|
|
738
|
+
tools: {
|
|
739
|
+
name: string;
|
|
740
|
+
aliases: string[];
|
|
741
|
+
description: string | undefined;
|
|
742
|
+
metadata: Record<string, unknown>;
|
|
743
|
+
input: import("json-schema").JSONSchema7 | undefined;
|
|
744
|
+
output: import("json-schema").JSONSchema7 | undefined;
|
|
745
|
+
staticInputValues: unknown;
|
|
746
|
+
maxRetries: number;
|
|
747
|
+
}[];
|
|
748
|
+
objects: {
|
|
749
|
+
name: string;
|
|
750
|
+
description: string | undefined;
|
|
751
|
+
properties: import("./objects.js").ObjectProperty[] | undefined;
|
|
752
|
+
tools: {
|
|
753
|
+
name: string;
|
|
754
|
+
aliases: string[];
|
|
755
|
+
description: string | undefined;
|
|
756
|
+
metadata: Record<string, unknown>;
|
|
757
|
+
input: import("json-schema").JSONSchema7 | undefined;
|
|
758
|
+
output: import("json-schema").JSONSchema7 | undefined;
|
|
759
|
+
staticInputValues: unknown;
|
|
760
|
+
maxRetries: number;
|
|
761
|
+
}[];
|
|
762
|
+
metadata: Record<string, unknown> | undefined;
|
|
763
|
+
}[];
|
|
764
|
+
exits: {
|
|
765
|
+
name: string;
|
|
766
|
+
aliases: string[];
|
|
767
|
+
description: string;
|
|
768
|
+
metadata: {
|
|
769
|
+
[x: string]: unknown;
|
|
770
|
+
};
|
|
771
|
+
schema: import("json-schema").JSONSchema7 | undefined;
|
|
772
|
+
}[];
|
|
773
|
+
instructions: string | undefined;
|
|
774
|
+
duration: string;
|
|
775
|
+
error: string | null;
|
|
776
|
+
isChatEnabled: boolean;
|
|
777
|
+
}[];
|
|
778
|
+
iteration: number;
|
|
779
|
+
timeout: number;
|
|
780
|
+
loop: number;
|
|
781
|
+
temperature: number;
|
|
782
|
+
model: "best" | "fast" | `${string}:${string}` | undefined;
|
|
783
|
+
metadata: Record<string, any>;
|
|
784
|
+
snapshot: {
|
|
785
|
+
id: string;
|
|
786
|
+
reason: string | undefined;
|
|
787
|
+
stack: string;
|
|
788
|
+
variables: ({
|
|
789
|
+
name: string;
|
|
790
|
+
type: string;
|
|
791
|
+
bytes: number;
|
|
792
|
+
preview?: string;
|
|
793
|
+
value?: unknown;
|
|
794
|
+
truncated: boolean;
|
|
795
|
+
} & ({
|
|
796
|
+
truncated: true;
|
|
797
|
+
preview: string;
|
|
798
|
+
} | {
|
|
799
|
+
truncated: false;
|
|
800
|
+
value: unknown;
|
|
801
|
+
}))[];
|
|
802
|
+
toolCall: import("./errors.js").ToolCall | undefined;
|
|
803
|
+
status: import("./snapshots.js").SnapshotStatus;
|
|
804
|
+
} | undefined;
|
|
805
|
+
};
|
|
806
|
+
snapshot: {
|
|
807
|
+
id: string;
|
|
808
|
+
reason: string | undefined;
|
|
809
|
+
stack: string;
|
|
810
|
+
variables: ({
|
|
811
|
+
name: string;
|
|
812
|
+
type: string;
|
|
813
|
+
bytes: number;
|
|
814
|
+
preview?: string;
|
|
815
|
+
value?: unknown;
|
|
816
|
+
truncated: boolean;
|
|
817
|
+
} & ({
|
|
818
|
+
truncated: true;
|
|
819
|
+
preview: string;
|
|
820
|
+
} | {
|
|
821
|
+
truncated: false;
|
|
822
|
+
value: unknown;
|
|
823
|
+
}))[];
|
|
824
|
+
toolCall: import("./errors.js").ToolCall | undefined;
|
|
825
|
+
status: import("./snapshots.js").SnapshotStatus;
|
|
826
|
+
};
|
|
827
|
+
signal: {
|
|
828
|
+
message: string;
|
|
829
|
+
truncatedCode: string;
|
|
830
|
+
variables: {
|
|
831
|
+
[key: string]: any;
|
|
832
|
+
};
|
|
833
|
+
};
|
|
834
|
+
};
|
|
463
835
|
}
|
|
836
|
+
export {};
|
package/dist/snapshots.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ToolCall, SnapshotSignal } from './errors.js';
|
|
2
|
+
import { Serializable } from './types.js';
|
|
2
3
|
type Variable = {
|
|
3
4
|
name: string;
|
|
4
5
|
type: string;
|
|
@@ -27,6 +28,16 @@ export declare namespace SnapshotStatuses {
|
|
|
27
28
|
error: unknown;
|
|
28
29
|
};
|
|
29
30
|
}
|
|
31
|
+
export declare namespace Snapshot {
|
|
32
|
+
type JSON = {
|
|
33
|
+
id: string;
|
|
34
|
+
reason?: string;
|
|
35
|
+
stack: string;
|
|
36
|
+
variables: Variable[];
|
|
37
|
+
toolCall?: ToolCall;
|
|
38
|
+
status: SnapshotStatus;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
30
41
|
/**
|
|
31
42
|
* Snapshot represents a captured execution state that can be persisted and restored later.
|
|
32
43
|
*
|
|
@@ -100,7 +111,7 @@ export declare namespace SnapshotStatuses {
|
|
|
100
111
|
*
|
|
101
112
|
* @see {@link https://github.com/botpress/botpress/blob/master/packages/llmz/examples/14_worker_snapshot/index.ts} Example usage
|
|
102
113
|
*/
|
|
103
|
-
export declare class Snapshot {
|
|
114
|
+
export declare class Snapshot implements Serializable<Snapshot.JSON> {
|
|
104
115
|
#private;
|
|
105
116
|
readonly id: string;
|
|
106
117
|
readonly reason?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkXGJOEQMWcjs = require('./chunk-XGJOEQMW.cjs');
|
|
4
|
+
require('./chunk-FZJHYLM2.cjs');
|
|
5
5
|
require('./chunk-JDABP4SD.cjs');
|
|
6
6
|
require('./chunk-IKSIOIIP.cjs');
|
|
7
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-WHNOR4ZU.cjs');
|
|
8
8
|
require('./chunk-UQOBUJIQ.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.Tool =
|
|
11
|
+
exports.Tool = _chunkXGJOEQMWcjs.Tool;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Tool
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-A7QHWVD7.js";
|
|
4
|
+
import "./chunk-EE6NVDID.js";
|
|
5
5
|
import "./chunk-JKVVQN2P.js";
|
|
6
6
|
import "./chunk-JQBT7UWN.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-ZORRILUV.js";
|
|
8
8
|
import "./chunk-7WRN4E42.js";
|
|
9
9
|
export {
|
|
10
10
|
Tool
|
package/dist/tool.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeOf } from '@bpinternal/zui';
|
|
2
2
|
import { JSONSchema7 } from 'json-schema';
|
|
3
|
-
import { ZuiType } from './types.js';
|
|
3
|
+
import { Serializable, ZuiType } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Input parameters passed to tool retry functions.
|
|
6
6
|
*
|
|
@@ -48,6 +48,18 @@ type ToolCallContext = {
|
|
|
48
48
|
/** Unique identifier for this specific tool call */
|
|
49
49
|
callId: string;
|
|
50
50
|
};
|
|
51
|
+
export declare namespace Tool {
|
|
52
|
+
type JSON = {
|
|
53
|
+
name: string;
|
|
54
|
+
aliases: string[];
|
|
55
|
+
description?: string;
|
|
56
|
+
metadata: Record<string, unknown>;
|
|
57
|
+
input?: JSONSchema7;
|
|
58
|
+
output?: JSONSchema7;
|
|
59
|
+
staticInputValues?: SmartPartial<TypeOf<ZuiType>>;
|
|
60
|
+
maxRetries: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
51
63
|
/**
|
|
52
64
|
* Tool represents a callable function that agents can use to interact with external systems.
|
|
53
65
|
*
|
|
@@ -189,7 +201,7 @@ type ToolCallContext = {
|
|
|
189
201
|
* - **Type coercion**: Basic type coercion where possible
|
|
190
202
|
*
|
|
191
203
|
*/
|
|
192
|
-
export declare class Tool<I extends ZuiType = ZuiType, O extends ZuiType = ZuiType> {
|
|
204
|
+
export declare class Tool<I extends ZuiType = ZuiType, O extends ZuiType = ZuiType> implements Serializable<Tool.JSON> {
|
|
193
205
|
private _staticInputValues?;
|
|
194
206
|
name: string;
|
|
195
207
|
aliases: string[];
|
|
@@ -493,5 +505,20 @@ export declare class Tool<I extends ZuiType = ZuiType, O extends ZuiType = ZuiTy
|
|
|
493
505
|
* @static
|
|
494
506
|
*/
|
|
495
507
|
static withUniqueNames: (tools: Tool<any, any>[]) => Tool<any, any>[];
|
|
508
|
+
/**
|
|
509
|
+
* Converts the tool to its JSON representation.
|
|
510
|
+
*
|
|
511
|
+
* @returns JSON representation of the Tool instance
|
|
512
|
+
*/
|
|
513
|
+
toJSON(): {
|
|
514
|
+
name: string;
|
|
515
|
+
aliases: string[];
|
|
516
|
+
description: string | undefined;
|
|
517
|
+
metadata: Record<string, unknown>;
|
|
518
|
+
input: JSONSchema7 | undefined;
|
|
519
|
+
output: JSONSchema7 | undefined;
|
|
520
|
+
staticInputValues: unknown;
|
|
521
|
+
maxRetries: number;
|
|
522
|
+
};
|
|
496
523
|
}
|
|
497
524
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkGZPN7RGHcjs = require('./chunk-GZPN7RGH.cjs');
|
|
5
|
+
require('./chunk-WHNOR4ZU.cjs');
|
|
6
|
+
require('./chunk-UQOBUJIQ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.truncateWrappedContent = _chunkGZPN7RGHcjs.truncateWrappedContent; exports.wrapContent = _chunkGZPN7RGHcjs.wrapContent;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTypings
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EE6NVDID.js";
|
|
4
4
|
import "./chunk-JKVVQN2P.js";
|
|
5
5
|
import "./chunk-JQBT7UWN.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-ZORRILUV.js";
|
|
7
7
|
import "./chunk-7WRN4E42.js";
|
|
8
8
|
export {
|
|
9
9
|
getTypings
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkFZJHYLM2cjs = require('./chunk-FZJHYLM2.cjs');
|
|
4
4
|
require('./chunk-JDABP4SD.cjs');
|
|
5
5
|
require('./chunk-IKSIOIIP.cjs');
|
|
6
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-WHNOR4ZU.cjs');
|
|
7
7
|
require('./chunk-UQOBUJIQ.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.getTypings =
|
|
10
|
+
exports.getTypings = _chunkFZJHYLM2cjs.getTypings;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkWHNOR4ZUcjs = require('./chunk-WHNOR4ZU.cjs');
|
|
20
|
+
require('./chunk-UQOBUJIQ.cjs');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
exports.Identifier = _chunkWHNOR4ZUcjs.Identifier; exports.Tokens = _chunkWHNOR4ZUcjs.Tokens; exports.awaitObject = _chunkWHNOR4ZUcjs.awaitObject; exports.convertObjectToZuiLiterals = _chunkWHNOR4ZUcjs.convertObjectToZuiLiterals; exports.escapeString = _chunkWHNOR4ZUcjs.escapeString; exports.getMultilineComment = _chunkWHNOR4ZUcjs.getMultilineComment; exports.getTokenizer = _chunkWHNOR4ZUcjs.getTokenizer; exports.init = _chunkWHNOR4ZUcjs.init; exports.isJsonSchema = _chunkWHNOR4ZUcjs.isJsonSchema; exports.isValidIdentifier = _chunkWHNOR4ZUcjs.isValidIdentifier; exports.isValidMessageName = _chunkWHNOR4ZUcjs.isValidMessageName; exports.isValidSchema = _chunkWHNOR4ZUcjs.isValidSchema; exports.isZuiSchema = _chunkWHNOR4ZUcjs.isZuiSchema; exports.stripInvalidIdentifiers = _chunkWHNOR4ZUcjs.stripInvalidIdentifiers; exports.toPropertyKey = _chunkWHNOR4ZUcjs.toPropertyKey; exports.toValidFunctionName = _chunkWHNOR4ZUcjs.toValidFunctionName; exports.toValidObjectName = _chunkWHNOR4ZUcjs.toValidObjectName;
|