@agentica/core 0.16.4 → 0.16.7-fix-for-wrtn

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/lib/index.d.ts CHANGED
@@ -31,6 +31,8 @@ export * from "./json/IAgenticaHistoryJson";
31
31
  export * from "./json/IAgenticaOperationJson";
32
32
  export * from "./json/IAgenticaOperationSelectionJson";
33
33
  export * from "./json/IAgenticaTokenUsageJson";
34
+ export * from "./json/IMicroAgenticaEventJson";
35
+ export * from "./json/IMicroAgenticaHistoryJson";
34
36
  export * from "./MicroAgentica";
35
37
  export * as orchestrate from "./orchestrate";
36
38
  export * from "./structures/IAgenticaConfig";
package/lib/index.js CHANGED
@@ -70,6 +70,8 @@ __exportStar(require("./json/IAgenticaHistoryJson"), exports);
70
70
  __exportStar(require("./json/IAgenticaOperationJson"), exports);
71
71
  __exportStar(require("./json/IAgenticaOperationSelectionJson"), exports);
72
72
  __exportStar(require("./json/IAgenticaTokenUsageJson"), exports);
73
+ __exportStar(require("./json/IMicroAgenticaEventJson"), exports);
74
+ __exportStar(require("./json/IMicroAgenticaHistoryJson"), exports);
73
75
  __exportStar(require("./MicroAgentica"), exports);
74
76
  exports.orchestrate = __importStar(require("./orchestrate"));
75
77
  __exportStar(require("./structures/IAgenticaConfig"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,4DAA0C;AAE1C,8DAA4C;AAE5C,wEAAsD;AACtD,uEAAqD;AACrD,+DAA6C;AAC7C,6DAA2C;AAC3C,+DAA6C;AAE7C,iEAA+C;AAC/C,yDAAuC;AACvC,+DAA6C;AAC7C,gEAA8C;AAC9C,gEAA8C;AAC9C,iEAA+C;AAC/C,+DAA6C;AAC7C,6DAA2C;AAC3C,iEAA+C;AAC/C,8DAA4C;AAC5C,qDAAqC;AACrC,wEAAsD;AAEtD,0EAAwD;AACxD,oEAAkD;AAClD,sEAAoD;AACpD,qEAAmD;AACnD,8DAA4C;AAC5C,oEAAkD;AAClD,kEAAgD;AAEhD,mEAAiD;AAEjD,4DAA0C;AAC1C,8DAA4C;AAC5C,gEAA8C;AAC9C,yEAAuD;AACvD,iEAA+C;AAC/C,kDAAgC;AAChC,6DAA6C;AAE7C,+DAA6C;AAC7C,mEAAiD;AACjD,iEAA+C;AAC/C,8DAA4C;AAC5C,qEAAmD;AACnD,+DAA6C;AAC7C,oEAAkD;AAClD,mEAAiD;AAEjD;;GAEG;AACH,iDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,4DAA0C;AAE1C,8DAA4C;AAE5C,wEAAsD;AACtD,uEAAqD;AACrD,+DAA6C;AAC7C,6DAA2C;AAC3C,+DAA6C;AAE7C,iEAA+C;AAC/C,yDAAuC;AACvC,+DAA6C;AAC7C,gEAA8C;AAC9C,gEAA8C;AAC9C,iEAA+C;AAC/C,+DAA6C;AAC7C,6DAA2C;AAC3C,iEAA+C;AAC/C,8DAA4C;AAC5C,qDAAqC;AACrC,wEAAsD;AAEtD,0EAAwD;AACxD,oEAAkD;AAClD,sEAAoD;AACpD,qEAAmD;AACnD,8DAA4C;AAC5C,oEAAkD;AAClD,kEAAgD;AAEhD,mEAAiD;AAEjD,4DAA0C;AAC1C,8DAA4C;AAC5C,gEAA8C;AAC9C,yEAAuD;AACvD,iEAA+C;AAC/C,iEAA+C;AAC/C,mEAAiD;AACjD,kDAAgC;AAChC,6DAA6C;AAE7C,+DAA6C;AAC7C,mEAAiD;AACjD,iEAA+C;AAC/C,8DAA4C;AAC5C,qEAAmD;AACnD,+DAA6C;AAC7C,oEAAkD;AAClD,mEAAiD;AAEjD;;GAEG;AACH,iDAAiC"}
package/lib/index.mjs CHANGED
@@ -4,10 +4,10 @@ import { v4 } from "uuid";
4
4
 
5
5
  import { HttpLlm, ChatGptTypeChecker, LlmTypeCheckerV3_1, OpenApi } from "@samchon/openapi";
6
6
 
7
- import * as __typia_transform__assertGuard from "typia/lib/internal/_assertGuard.js";
8
-
9
7
  import * as __typia_transform__validateReport from "typia/lib/internal/_validateReport.js";
10
8
 
9
+ import * as __typia_transform__assertGuard from "typia/lib/internal/_assertGuard.js";
10
+
11
11
  import * as __typia_transform__accessExpressionAsString from "typia/lib/internal/_accessExpressionAsString.js";
12
12
 
13
13
  class AgenticaTokenUsage {
@@ -614,407 +614,8 @@ const ChatGptTokenUsageAggregator = {
614
614
 
615
615
  function transformCompletionChunk(source) {
616
616
  const str = source instanceof Uint8Array ? ByteArrayUtil.toUtf8(source) : source;
617
- return (() => {
618
- const _io0 = input => "string" === typeof input.id && (Array.isArray(input.choices) && input.choices.every((elem => "object" === typeof elem && null !== elem && _io1(elem)))) && "number" === typeof input.created && "string" === typeof input.model && "chat.completion.chunk" === input.object && (null === input.service_tier || undefined === input.service_tier || "scale" === input.service_tier || "default" === input.service_tier) && (undefined === input.system_fingerprint || "string" === typeof input.system_fingerprint) && (null === input.usage || undefined === input.usage || "object" === typeof input.usage && null !== input.usage && _io9(input.usage));
619
- const _io1 = input => "object" === typeof input.delta && null !== input.delta && false === Array.isArray(input.delta) && _io2(input.delta) && (null === input.finish_reason || "function_call" === input.finish_reason || "stop" === input.finish_reason || "length" === input.finish_reason || "tool_calls" === input.finish_reason || "content_filter" === input.finish_reason) && "number" === typeof input.index && (null === input.logprobs || undefined === input.logprobs || "object" === typeof input.logprobs && null !== input.logprobs && _io6(input.logprobs));
620
- const _io2 = input => (null === input.content || undefined === input.content || "string" === typeof input.content) && (undefined === input.function_call || "object" === typeof input.function_call && null !== input.function_call && false === Array.isArray(input.function_call) && _io3(input.function_call)) && (null === input.refusal || undefined === input.refusal || "string" === typeof input.refusal) && (undefined === input.role || "assistant" === input.role || "user" === input.role || "developer" === input.role || "system" === input.role || "tool" === input.role) && (undefined === input.tool_calls || Array.isArray(input.tool_calls) && input.tool_calls.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
621
- const _io3 = input => (undefined === input.arguments || "string" === typeof input.arguments) && (undefined === input.name || "string" === typeof input.name);
622
- const _io4 = input => "number" === typeof input.index && (undefined === input.id || "string" === typeof input.id) && (undefined === input["function"] || "object" === typeof input["function"] && null !== input["function"] && false === Array.isArray(input["function"]) && _io5(input["function"])) && (undefined === input.type || "function" === input.type);
623
- const _io5 = input => (undefined === input.arguments || "string" === typeof input.arguments) && (undefined === input.name || "string" === typeof input.name);
624
- const _io6 = input => (null === input.content || Array.isArray(input.content) && input.content.every((elem => "object" === typeof elem && null !== elem && _io7(elem)))) && (null === input.refusal || Array.isArray(input.refusal) && input.refusal.every((elem => "object" === typeof elem && null !== elem && _io7(elem))));
625
- const _io7 = input => "string" === typeof input.token && (null === input.bytes || Array.isArray(input.bytes) && input.bytes.every((elem => "number" === typeof elem))) && "number" === typeof input.logprob && (Array.isArray(input.top_logprobs) && input.top_logprobs.every((elem => "object" === typeof elem && null !== elem && _io8(elem))));
626
- const _io8 = input => "string" === typeof input.token && (null === input.bytes || Array.isArray(input.bytes) && input.bytes.every((elem => "number" === typeof elem))) && "number" === typeof input.logprob;
627
- const _io9 = input => "number" === typeof input.completion_tokens && "number" === typeof input.prompt_tokens && "number" === typeof input.total_tokens && (undefined === input.completion_tokens_details || "object" === typeof input.completion_tokens_details && null !== input.completion_tokens_details && false === Array.isArray(input.completion_tokens_details) && _io10(input.completion_tokens_details)) && (undefined === input.prompt_tokens_details || "object" === typeof input.prompt_tokens_details && null !== input.prompt_tokens_details && false === Array.isArray(input.prompt_tokens_details) && _io11(input.prompt_tokens_details));
628
- const _io10 = input => (undefined === input.accepted_prediction_tokens || "number" === typeof input.accepted_prediction_tokens) && (undefined === input.audio_tokens || "number" === typeof input.audio_tokens) && (undefined === input.reasoning_tokens || "number" === typeof input.reasoning_tokens) && (undefined === input.rejected_prediction_tokens || "number" === typeof input.rejected_prediction_tokens);
629
- const _io11 = input => (undefined === input.audio_tokens || "number" === typeof input.audio_tokens) && (undefined === input.cached_tokens || "number" === typeof input.cached_tokens);
630
- const _ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id || __typia_transform__assertGuard._assertGuard(_exceptionable, {
631
- method: "json.assertParse",
632
- path: _path + ".id",
633
- expected: "string",
634
- value: input.id
635
- }, _errorFactory)) && ((Array.isArray(input.choices) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
636
- method: "json.assertParse",
637
- path: _path + ".choices",
638
- expected: "Array<ChatCompletionChunk.Choice>",
639
- value: input.choices
640
- }, _errorFactory)) && input.choices.every(((elem, _index8) => ("object" === typeof elem && null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
641
- method: "json.assertParse",
642
- path: _path + ".choices[" + _index8 + "]",
643
- expected: "ChatCompletionChunk.Choice",
644
- value: elem
645
- }, _errorFactory)) && _ao1(elem, _path + ".choices[" + _index8 + "]", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
646
- method: "json.assertParse",
647
- path: _path + ".choices[" + _index8 + "]",
648
- expected: "ChatCompletionChunk.Choice",
649
- value: elem
650
- }, _errorFactory))) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
651
- method: "json.assertParse",
652
- path: _path + ".choices",
653
- expected: "Array<ChatCompletionChunk.Choice>",
654
- value: input.choices
655
- }, _errorFactory)) && ("number" === typeof input.created || __typia_transform__assertGuard._assertGuard(_exceptionable, {
656
- method: "json.assertParse",
657
- path: _path + ".created",
658
- expected: "number",
659
- value: input.created
660
- }, _errorFactory)) && ("string" === typeof input.model || __typia_transform__assertGuard._assertGuard(_exceptionable, {
661
- method: "json.assertParse",
662
- path: _path + ".model",
663
- expected: "string",
664
- value: input.model
665
- }, _errorFactory)) && ("chat.completion.chunk" === input.object || __typia_transform__assertGuard._assertGuard(_exceptionable, {
666
- method: "json.assertParse",
667
- path: _path + ".object",
668
- expected: '"chat.completion.chunk"',
669
- value: input.object
670
- }, _errorFactory)) && (null === input.service_tier || undefined === input.service_tier || "scale" === input.service_tier || "default" === input.service_tier || __typia_transform__assertGuard._assertGuard(_exceptionable, {
671
- method: "json.assertParse",
672
- path: _path + ".service_tier",
673
- expected: '("default" | "scale" | null | undefined)',
674
- value: input.service_tier
675
- }, _errorFactory)) && (undefined === input.system_fingerprint || "string" === typeof input.system_fingerprint || __typia_transform__assertGuard._assertGuard(_exceptionable, {
676
- method: "json.assertParse",
677
- path: _path + ".system_fingerprint",
678
- expected: "(string | undefined)",
679
- value: input.system_fingerprint
680
- }, _errorFactory)) && (null === input.usage || undefined === input.usage || ("object" === typeof input.usage && null !== input.usage || __typia_transform__assertGuard._assertGuard(_exceptionable, {
681
- method: "json.assertParse",
682
- path: _path + ".usage",
683
- expected: "(CompletionUsage | null | undefined)",
684
- value: input.usage
685
- }, _errorFactory)) && _ao9(input.usage, _path + ".usage", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
686
- method: "json.assertParse",
687
- path: _path + ".usage",
688
- expected: "(CompletionUsage | null | undefined)",
689
- value: input.usage
690
- }, _errorFactory));
691
- const _ao1 = (input, _path, _exceptionable = true) => (("object" === typeof input.delta && null !== input.delta && false === Array.isArray(input.delta) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
692
- method: "json.assertParse",
693
- path: _path + ".delta",
694
- expected: "ChatCompletionChunk.Choice.Delta",
695
- value: input.delta
696
- }, _errorFactory)) && _ao2(input.delta, _path + ".delta", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
697
- method: "json.assertParse",
698
- path: _path + ".delta",
699
- expected: "ChatCompletionChunk.Choice.Delta",
700
- value: input.delta
701
- }, _errorFactory)) && (null === input.finish_reason || "function_call" === input.finish_reason || "stop" === input.finish_reason || "length" === input.finish_reason || "tool_calls" === input.finish_reason || "content_filter" === input.finish_reason || __typia_transform__assertGuard._assertGuard(_exceptionable, {
702
- method: "json.assertParse",
703
- path: _path + ".finish_reason",
704
- expected: '("content_filter" | "function_call" | "length" | "stop" | "tool_calls" | null)',
705
- value: input.finish_reason
706
- }, _errorFactory)) && ("number" === typeof input.index || __typia_transform__assertGuard._assertGuard(_exceptionable, {
707
- method: "json.assertParse",
708
- path: _path + ".index",
709
- expected: "number",
710
- value: input.index
711
- }, _errorFactory)) && (null === input.logprobs || undefined === input.logprobs || ("object" === typeof input.logprobs && null !== input.logprobs || __typia_transform__assertGuard._assertGuard(_exceptionable, {
712
- method: "json.assertParse",
713
- path: _path + ".logprobs",
714
- expected: "(ChatCompletionChunk.Choice.Logprobs | null | undefined)",
715
- value: input.logprobs
716
- }, _errorFactory)) && _ao6(input.logprobs, _path + ".logprobs", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
717
- method: "json.assertParse",
718
- path: _path + ".logprobs",
719
- expected: "(ChatCompletionChunk.Choice.Logprobs | null | undefined)",
720
- value: input.logprobs
721
- }, _errorFactory));
722
- const _ao2 = (input, _path, _exceptionable = true) => (null === input.content || undefined === input.content || "string" === typeof input.content || __typia_transform__assertGuard._assertGuard(_exceptionable, {
723
- method: "json.assertParse",
724
- path: _path + ".content",
725
- expected: "(null | string | undefined)",
726
- value: input.content
727
- }, _errorFactory)) && (undefined === input.function_call || ("object" === typeof input.function_call && null !== input.function_call && false === Array.isArray(input.function_call) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
728
- method: "json.assertParse",
729
- path: _path + ".function_call",
730
- expected: "(ChatCompletionChunk.Choice.Delta.FunctionCall | undefined)",
731
- value: input.function_call
732
- }, _errorFactory)) && _ao3(input.function_call, _path + ".function_call", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
733
- method: "json.assertParse",
734
- path: _path + ".function_call",
735
- expected: "(ChatCompletionChunk.Choice.Delta.FunctionCall | undefined)",
736
- value: input.function_call
737
- }, _errorFactory)) && (null === input.refusal || undefined === input.refusal || "string" === typeof input.refusal || __typia_transform__assertGuard._assertGuard(_exceptionable, {
738
- method: "json.assertParse",
739
- path: _path + ".refusal",
740
- expected: "(null | string | undefined)",
741
- value: input.refusal
742
- }, _errorFactory)) && (undefined === input.role || "assistant" === input.role || "user" === input.role || "developer" === input.role || "system" === input.role || "tool" === input.role || __typia_transform__assertGuard._assertGuard(_exceptionable, {
743
- method: "json.assertParse",
744
- path: _path + ".role",
745
- expected: '("assistant" | "developer" | "system" | "tool" | "user" | undefined)',
746
- value: input.role
747
- }, _errorFactory)) && (undefined === input.tool_calls || (Array.isArray(input.tool_calls) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
748
- method: "json.assertParse",
749
- path: _path + ".tool_calls",
750
- expected: "(Array<ChatCompletionChunk.Choice.Delta.ToolCall> | undefined)",
751
- value: input.tool_calls
752
- }, _errorFactory)) && input.tool_calls.every(((elem, _index9) => ("object" === typeof elem && null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
753
- method: "json.assertParse",
754
- path: _path + ".tool_calls[" + _index9 + "]",
755
- expected: "ChatCompletionChunk.Choice.Delta.ToolCall",
756
- value: elem
757
- }, _errorFactory)) && _ao4(elem, _path + ".tool_calls[" + _index9 + "]", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
758
- method: "json.assertParse",
759
- path: _path + ".tool_calls[" + _index9 + "]",
760
- expected: "ChatCompletionChunk.Choice.Delta.ToolCall",
761
- value: elem
762
- }, _errorFactory))) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
763
- method: "json.assertParse",
764
- path: _path + ".tool_calls",
765
- expected: "(Array<ChatCompletionChunk.Choice.Delta.ToolCall> | undefined)",
766
- value: input.tool_calls
767
- }, _errorFactory));
768
- const _ao3 = (input, _path, _exceptionable = true) => (undefined === input.arguments || "string" === typeof input.arguments || __typia_transform__assertGuard._assertGuard(_exceptionable, {
769
- method: "json.assertParse",
770
- path: _path + ".arguments",
771
- expected: "(string | undefined)",
772
- value: input.arguments
773
- }, _errorFactory)) && (undefined === input.name || "string" === typeof input.name || __typia_transform__assertGuard._assertGuard(_exceptionable, {
774
- method: "json.assertParse",
775
- path: _path + ".name",
776
- expected: "(string | undefined)",
777
- value: input.name
778
- }, _errorFactory));
779
- const _ao4 = (input, _path, _exceptionable = true) => ("number" === typeof input.index || __typia_transform__assertGuard._assertGuard(_exceptionable, {
780
- method: "json.assertParse",
781
- path: _path + ".index",
782
- expected: "number",
783
- value: input.index
784
- }, _errorFactory)) && (undefined === input.id || "string" === typeof input.id || __typia_transform__assertGuard._assertGuard(_exceptionable, {
785
- method: "json.assertParse",
786
- path: _path + ".id",
787
- expected: "(string | undefined)",
788
- value: input.id
789
- }, _errorFactory)) && (undefined === input["function"] || ("object" === typeof input["function"] && null !== input["function"] && false === Array.isArray(input["function"]) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
790
- method: "json.assertParse",
791
- path: _path + '["function"]',
792
- expected: "(ChatCompletionChunk.Choice.Delta.ToolCall.Function | undefined)",
793
- value: input["function"]
794
- }, _errorFactory)) && _ao5(input["function"], _path + '["function"]', _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
795
- method: "json.assertParse",
796
- path: _path + '["function"]',
797
- expected: "(ChatCompletionChunk.Choice.Delta.ToolCall.Function | undefined)",
798
- value: input["function"]
799
- }, _errorFactory)) && (undefined === input.type || "function" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
800
- method: "json.assertParse",
801
- path: _path + ".type",
802
- expected: '("function" | undefined)',
803
- value: input.type
804
- }, _errorFactory));
805
- const _ao5 = (input, _path, _exceptionable = true) => (undefined === input.arguments || "string" === typeof input.arguments || __typia_transform__assertGuard._assertGuard(_exceptionable, {
806
- method: "json.assertParse",
807
- path: _path + ".arguments",
808
- expected: "(string | undefined)",
809
- value: input.arguments
810
- }, _errorFactory)) && (undefined === input.name || "string" === typeof input.name || __typia_transform__assertGuard._assertGuard(_exceptionable, {
811
- method: "json.assertParse",
812
- path: _path + ".name",
813
- expected: "(string | undefined)",
814
- value: input.name
815
- }, _errorFactory));
816
- const _ao6 = (input, _path, _exceptionable = true) => (null === input.content || (Array.isArray(input.content) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
817
- method: "json.assertParse",
818
- path: _path + ".content",
819
- expected: "(Array<ChatCompletionTokenLogprob> | null)",
820
- value: input.content
821
- }, _errorFactory)) && input.content.every(((elem, _index10) => ("object" === typeof elem && null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
822
- method: "json.assertParse",
823
- path: _path + ".content[" + _index10 + "]",
824
- expected: "ChatCompletionTokenLogprob",
825
- value: elem
826
- }, _errorFactory)) && _ao7(elem, _path + ".content[" + _index10 + "]", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
827
- method: "json.assertParse",
828
- path: _path + ".content[" + _index10 + "]",
829
- expected: "ChatCompletionTokenLogprob",
830
- value: elem
831
- }, _errorFactory))) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
832
- method: "json.assertParse",
833
- path: _path + ".content",
834
- expected: "(Array<ChatCompletionTokenLogprob> | null)",
835
- value: input.content
836
- }, _errorFactory)) && (null === input.refusal || (Array.isArray(input.refusal) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
837
- method: "json.assertParse",
838
- path: _path + ".refusal",
839
- expected: "(Array<ChatCompletionTokenLogprob> | null)",
840
- value: input.refusal
841
- }, _errorFactory)) && input.refusal.every(((elem, _index11) => ("object" === typeof elem && null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
842
- method: "json.assertParse",
843
- path: _path + ".refusal[" + _index11 + "]",
844
- expected: "ChatCompletionTokenLogprob",
845
- value: elem
846
- }, _errorFactory)) && _ao7(elem, _path + ".refusal[" + _index11 + "]", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
847
- method: "json.assertParse",
848
- path: _path + ".refusal[" + _index11 + "]",
849
- expected: "ChatCompletionTokenLogprob",
850
- value: elem
851
- }, _errorFactory))) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
852
- method: "json.assertParse",
853
- path: _path + ".refusal",
854
- expected: "(Array<ChatCompletionTokenLogprob> | null)",
855
- value: input.refusal
856
- }, _errorFactory));
857
- const _ao7 = (input, _path, _exceptionable = true) => ("string" === typeof input.token || __typia_transform__assertGuard._assertGuard(_exceptionable, {
858
- method: "json.assertParse",
859
- path: _path + ".token",
860
- expected: "string",
861
- value: input.token
862
- }, _errorFactory)) && (null === input.bytes || (Array.isArray(input.bytes) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
863
- method: "json.assertParse",
864
- path: _path + ".bytes",
865
- expected: "(Array<number> | null)",
866
- value: input.bytes
867
- }, _errorFactory)) && input.bytes.every(((elem, _index12) => "number" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
868
- method: "json.assertParse",
869
- path: _path + ".bytes[" + _index12 + "]",
870
- expected: "number",
871
- value: elem
872
- }, _errorFactory))) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
873
- method: "json.assertParse",
874
- path: _path + ".bytes",
875
- expected: "(Array<number> | null)",
876
- value: input.bytes
877
- }, _errorFactory)) && ("number" === typeof input.logprob || __typia_transform__assertGuard._assertGuard(_exceptionable, {
878
- method: "json.assertParse",
879
- path: _path + ".logprob",
880
- expected: "number",
881
- value: input.logprob
882
- }, _errorFactory)) && ((Array.isArray(input.top_logprobs) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
883
- method: "json.assertParse",
884
- path: _path + ".top_logprobs",
885
- expected: "Array<ChatCompletionTokenLogprob.TopLogprob>",
886
- value: input.top_logprobs
887
- }, _errorFactory)) && input.top_logprobs.every(((elem, _index13) => ("object" === typeof elem && null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
888
- method: "json.assertParse",
889
- path: _path + ".top_logprobs[" + _index13 + "]",
890
- expected: "ChatCompletionTokenLogprob.TopLogprob",
891
- value: elem
892
- }, _errorFactory)) && _ao8(elem, _path + ".top_logprobs[" + _index13 + "]", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
893
- method: "json.assertParse",
894
- path: _path + ".top_logprobs[" + _index13 + "]",
895
- expected: "ChatCompletionTokenLogprob.TopLogprob",
896
- value: elem
897
- }, _errorFactory))) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
898
- method: "json.assertParse",
899
- path: _path + ".top_logprobs",
900
- expected: "Array<ChatCompletionTokenLogprob.TopLogprob>",
901
- value: input.top_logprobs
902
- }, _errorFactory));
903
- const _ao8 = (input, _path, _exceptionable = true) => ("string" === typeof input.token || __typia_transform__assertGuard._assertGuard(_exceptionable, {
904
- method: "json.assertParse",
905
- path: _path + ".token",
906
- expected: "string",
907
- value: input.token
908
- }, _errorFactory)) && (null === input.bytes || (Array.isArray(input.bytes) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
909
- method: "json.assertParse",
910
- path: _path + ".bytes",
911
- expected: "(Array<number> | null)",
912
- value: input.bytes
913
- }, _errorFactory)) && input.bytes.every(((elem, _index14) => "number" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
914
- method: "json.assertParse",
915
- path: _path + ".bytes[" + _index14 + "]",
916
- expected: "number",
917
- value: elem
918
- }, _errorFactory))) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
919
- method: "json.assertParse",
920
- path: _path + ".bytes",
921
- expected: "(Array<number> | null)",
922
- value: input.bytes
923
- }, _errorFactory)) && ("number" === typeof input.logprob || __typia_transform__assertGuard._assertGuard(_exceptionable, {
924
- method: "json.assertParse",
925
- path: _path + ".logprob",
926
- expected: "number",
927
- value: input.logprob
928
- }, _errorFactory));
929
- const _ao9 = (input, _path, _exceptionable = true) => ("number" === typeof input.completion_tokens || __typia_transform__assertGuard._assertGuard(_exceptionable, {
930
- method: "json.assertParse",
931
- path: _path + ".completion_tokens",
932
- expected: "number",
933
- value: input.completion_tokens
934
- }, _errorFactory)) && ("number" === typeof input.prompt_tokens || __typia_transform__assertGuard._assertGuard(_exceptionable, {
935
- method: "json.assertParse",
936
- path: _path + ".prompt_tokens",
937
- expected: "number",
938
- value: input.prompt_tokens
939
- }, _errorFactory)) && ("number" === typeof input.total_tokens || __typia_transform__assertGuard._assertGuard(_exceptionable, {
940
- method: "json.assertParse",
941
- path: _path + ".total_tokens",
942
- expected: "number",
943
- value: input.total_tokens
944
- }, _errorFactory)) && (undefined === input.completion_tokens_details || ("object" === typeof input.completion_tokens_details && null !== input.completion_tokens_details && false === Array.isArray(input.completion_tokens_details) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
945
- method: "json.assertParse",
946
- path: _path + ".completion_tokens_details",
947
- expected: "(CompletionUsage.CompletionTokensDetails | undefined)",
948
- value: input.completion_tokens_details
949
- }, _errorFactory)) && _ao10(input.completion_tokens_details, _path + ".completion_tokens_details", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
950
- method: "json.assertParse",
951
- path: _path + ".completion_tokens_details",
952
- expected: "(CompletionUsage.CompletionTokensDetails | undefined)",
953
- value: input.completion_tokens_details
954
- }, _errorFactory)) && (undefined === input.prompt_tokens_details || ("object" === typeof input.prompt_tokens_details && null !== input.prompt_tokens_details && false === Array.isArray(input.prompt_tokens_details) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
955
- method: "json.assertParse",
956
- path: _path + ".prompt_tokens_details",
957
- expected: "(CompletionUsage.PromptTokensDetails | undefined)",
958
- value: input.prompt_tokens_details
959
- }, _errorFactory)) && _ao11(input.prompt_tokens_details, _path + ".prompt_tokens_details", _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
960
- method: "json.assertParse",
961
- path: _path + ".prompt_tokens_details",
962
- expected: "(CompletionUsage.PromptTokensDetails | undefined)",
963
- value: input.prompt_tokens_details
964
- }, _errorFactory));
965
- const _ao10 = (input, _path, _exceptionable = true) => (undefined === input.accepted_prediction_tokens || "number" === typeof input.accepted_prediction_tokens || __typia_transform__assertGuard._assertGuard(_exceptionable, {
966
- method: "json.assertParse",
967
- path: _path + ".accepted_prediction_tokens",
968
- expected: "(number | undefined)",
969
- value: input.accepted_prediction_tokens
970
- }, _errorFactory)) && (undefined === input.audio_tokens || "number" === typeof input.audio_tokens || __typia_transform__assertGuard._assertGuard(_exceptionable, {
971
- method: "json.assertParse",
972
- path: _path + ".audio_tokens",
973
- expected: "(number | undefined)",
974
- value: input.audio_tokens
975
- }, _errorFactory)) && (undefined === input.reasoning_tokens || "number" === typeof input.reasoning_tokens || __typia_transform__assertGuard._assertGuard(_exceptionable, {
976
- method: "json.assertParse",
977
- path: _path + ".reasoning_tokens",
978
- expected: "(number | undefined)",
979
- value: input.reasoning_tokens
980
- }, _errorFactory)) && (undefined === input.rejected_prediction_tokens || "number" === typeof input.rejected_prediction_tokens || __typia_transform__assertGuard._assertGuard(_exceptionable, {
981
- method: "json.assertParse",
982
- path: _path + ".rejected_prediction_tokens",
983
- expected: "(number | undefined)",
984
- value: input.rejected_prediction_tokens
985
- }, _errorFactory));
986
- const _ao11 = (input, _path, _exceptionable = true) => (undefined === input.audio_tokens || "number" === typeof input.audio_tokens || __typia_transform__assertGuard._assertGuard(_exceptionable, {
987
- method: "json.assertParse",
988
- path: _path + ".audio_tokens",
989
- expected: "(number | undefined)",
990
- value: input.audio_tokens
991
- }, _errorFactory)) && (undefined === input.cached_tokens || "number" === typeof input.cached_tokens || __typia_transform__assertGuard._assertGuard(_exceptionable, {
992
- method: "json.assertParse",
993
- path: _path + ".cached_tokens",
994
- expected: "(number | undefined)",
995
- value: input.cached_tokens
996
- }, _errorFactory));
997
- const __is = input => "object" === typeof input && null !== input && _io0(input);
998
- let _errorFactory;
999
- const __assert = (input, errorFactory) => {
1000
- if (false === __is(input)) {
1001
- _errorFactory = errorFactory;
1002
- ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || __typia_transform__assertGuard._assertGuard(true, {
1003
- method: "json.assertParse",
1004
- path: _path + "",
1005
- expected: "ChatCompletionChunk & { usage: CompletionUsage | null | undefined; }",
1006
- value: input
1007
- }, _errorFactory)) && _ao0(input, _path + "", true) || __typia_transform__assertGuard._assertGuard(true, {
1008
- method: "json.assertParse",
1009
- path: _path + "",
1010
- expected: "ChatCompletionChunk & { usage: CompletionUsage | null | undefined; }",
1011
- value: input
1012
- }, _errorFactory))(input, "$input", true);
1013
- }
1014
- return input;
1015
- };
1016
- return (input, errorFactory) => __assert(JSON.parse(input), errorFactory);
1017
- })()(str);
617
+ const result = JSON.parse(str);
618
+ return result;
1018
619
  }
1019
620
 
1020
621
  function accumulate(origin, chunk) {
@@ -1202,19 +803,19 @@ const StreamUtil = {
1202
803
  transform: transform$1
1203
804
  };
1204
805
 
1205
- async function cancelFunction(ctx, reference) {
806
+ function cancelFunction(ctx, reference) {
1206
807
  const index = ctx.stack.findIndex((item => item.operation.name === reference.name));
1207
808
  if (index === -1) {
1208
809
  return null;
1209
810
  }
1210
811
  const item = ctx.stack[index];
1211
812
  ctx.stack.splice(index, 1);
1212
- await ctx.dispatch(createCancelEvent({
813
+ ctx.dispatch(createCancelEvent({
1213
814
  selection: createOperationSelection({
1214
815
  operation: item.operation,
1215
816
  reason: reference.reason
1216
817
  })
1217
- }));
818
+ })).catch((() => {}));
1218
819
  return item;
1219
820
  }
1220
821
 
@@ -1278,24 +879,19 @@ async function call(ctx, operations) {
1278
879
  value: execute.value
1279
880
  })).catch((() => {}));
1280
881
  if (isAgenticaContext(ctx)) {
1281
- await cancelFunction(ctx, {
882
+ cancelFunction(ctx, {
1282
883
  name: call.operation.name,
1283
884
  reason: "completed"
1284
885
  });
1285
- ctx.dispatch(createCancelEvent({
1286
- selection: createOperationSelection({
886
+ return [ execute, createCancelHistory({
887
+ id: call.id,
888
+ selections: [ createOperationSelection({
1287
889
  operation: call.operation,
1288
890
  reason: "complete"
1289
- })
1290
- })).catch((() => {}));
891
+ }) ]
892
+ }) ];
1291
893
  }
1292
- return [ execute, createCancelHistory({
1293
- id: call.id,
1294
- selections: [ createOperationSelection({
1295
- operation: call.operation,
1296
- reason: "complete"
1297
- }) ]
1298
- }) ];
894
+ return [ execute ];
1299
895
  }));
1300
896
  }
1301
897
  }
@@ -1605,6 +1201,7 @@ const CONTAINER$1 = {
1605
1201
  };
1606
1202
 
1607
1203
  async function cancel(ctx) {
1204
+ console.error("orchestrate.cancel");
1608
1205
  if (ctx.operations.divided === undefined) {
1609
1206
  return step$1(ctx, ctx.operations.array, 0);
1610
1207
  }
@@ -1629,7 +1226,7 @@ async function cancel(ctx) {
1629
1226
  for (const e of events) {
1630
1227
  if (e.type === "select") {
1631
1228
  collection.selections.push(e.selection);
1632
- await cancelFunction(ctx, {
1229
+ cancelFunction(ctx, {
1633
1230
  name: e.selection.operation.name,
1634
1231
  reason: e.selection.reason
1635
1232
  });
@@ -1794,7 +1391,7 @@ async function step$1(ctx, operations, retry, failures) {
1794
1391
  selections: []
1795
1392
  });
1796
1393
  for (const reference of input.functions) {
1797
- const operation = await cancelFunction(ctx, reference);
1394
+ const operation = cancelFunction(ctx, reference);
1798
1395
  if (operation !== null) {
1799
1396
  collection.selections.push(operation);
1800
1397
  }
@@ -4105,12 +3702,6 @@ function execute(executor) {
4105
3702
  const prompts = await (executor?.call ?? call)(ctx, ctx.stack.map((s => s.operation)));
4106
3703
  histories.push(...prompts);
4107
3704
  const executes = prompts.filter((prompt => prompt.type === "execute"));
4108
- for (const e of executes) {
4109
- await cancelFunction(ctx, {
4110
- reason: "completed",
4111
- name: e.operation.name
4112
- });
4113
- }
4114
3705
  histories.push(...await (executor?.describe ?? describe)(ctx, executes));
4115
3706
  if (executes.length === 0 || ctx.stack.length === 0) {
4116
3707
  break;