blazen 0.1.151 → 0.1.153

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 (5) hide show
  1. package/README.md +318 -1
  2. package/error-classes.js +855 -0
  3. package/index.d.ts +4774 -181
  4. package/index.js +336 -0
  5. package/package.json +11 -10
package/index.js CHANGED
@@ -576,75 +576,411 @@ if (!nativeBinding) {
576
576
  }
577
577
 
578
578
  module.exports = nativeBinding
579
+ module.exports.ActiveWorkflowSnapshot = nativeBinding.ActiveWorkflowSnapshot
580
+ module.exports.JsActiveWorkflowSnapshot = nativeBinding.JsActiveWorkflowSnapshot
581
+ module.exports.AgentResult = nativeBinding.AgentResult
582
+ module.exports.JsAgentResult = nativeBinding.JsAgentResult
583
+ module.exports.AnthropicProvider = nativeBinding.AnthropicProvider
584
+ module.exports.JsAnthropicProvider = nativeBinding.JsAnthropicProvider
585
+ module.exports.AzureOpenAiProvider = nativeBinding.AzureOpenAiProvider
586
+ module.exports.JsAzureOpenAiProvider = nativeBinding.JsAzureOpenAiProvider
579
587
  module.exports.BackgroundRemovalProvider = nativeBinding.BackgroundRemovalProvider
580
588
  module.exports.JsBackgroundRemovalProvider = nativeBinding.JsBackgroundRemovalProvider
589
+ module.exports.BatchConfig = nativeBinding.BatchConfig
590
+ module.exports.JsBatchConfig = nativeBinding.JsBatchConfig
591
+ module.exports.BatchResult = nativeBinding.BatchResult
592
+ module.exports.JsBatchResult = nativeBinding.JsBatchResult
593
+ module.exports.BedrockProvider = nativeBinding.BedrockProvider
594
+ module.exports.JsBedrockProvider = nativeBinding.JsBedrockProvider
595
+ module.exports.BlazenPeerClient = nativeBinding.BlazenPeerClient
596
+ module.exports.JsBlazenPeerClient = nativeBinding.JsBlazenPeerClient
597
+ module.exports.BlazenPeerServer = nativeBinding.BlazenPeerServer
598
+ module.exports.JsBlazenPeerServer = nativeBinding.JsBlazenPeerServer
599
+ module.exports.BytesWrapper = nativeBinding.BytesWrapper
600
+ module.exports.JsBytesWrapper = nativeBinding.JsBytesWrapper
601
+ module.exports.CachedCompletionModel = nativeBinding.CachedCompletionModel
602
+ module.exports.JsCachedCompletionModel = nativeBinding.JsCachedCompletionModel
603
+ module.exports.CacheMiddleware = nativeBinding.CacheMiddleware
604
+ module.exports.JsCacheMiddleware = nativeBinding.JsCacheMiddleware
605
+ module.exports.CandleEmbedProvider = nativeBinding.CandleEmbedProvider
606
+ module.exports.JsCandleEmbedProvider = nativeBinding.JsCandleEmbedProvider
607
+ module.exports.CandleInferenceResult = nativeBinding.CandleInferenceResult
608
+ module.exports.JsCandleInferenceResult = nativeBinding.JsCandleInferenceResult
609
+ module.exports.CandleLlmProvider = nativeBinding.CandleLlmProvider
610
+ module.exports.JsCandleLlmProvider = nativeBinding.JsCandleLlmProvider
581
611
  module.exports.ChatMessage = nativeBinding.ChatMessage
582
612
  module.exports.JsChatMessage = nativeBinding.JsChatMessage
613
+ module.exports.ChatMessageInput = nativeBinding.ChatMessageInput
614
+ module.exports.JsChatMessageInput = nativeBinding.JsChatMessageInput
583
615
  module.exports.ChatWindow = nativeBinding.ChatWindow
584
616
  module.exports.JsChatWindow = nativeBinding.JsChatWindow
617
+ module.exports.CheckpointStore = nativeBinding.CheckpointStore
618
+ module.exports.JsCheckpointStore = nativeBinding.JsCheckpointStore
619
+ module.exports.Citation = nativeBinding.Citation
620
+ module.exports.JsCitationClass = nativeBinding.JsCitationClass
621
+ module.exports.CohereProvider = nativeBinding.CohereProvider
622
+ module.exports.JsCohereProvider = nativeBinding.JsCohereProvider
585
623
  module.exports.CompletionModel = nativeBinding.CompletionModel
586
624
  module.exports.JsCompletionModel = nativeBinding.JsCompletionModel
587
625
  module.exports.Context = nativeBinding.Context
588
626
  module.exports.JsContext = nativeBinding.JsContext
589
627
  module.exports.CustomProvider = nativeBinding.CustomProvider
590
628
  module.exports.JsCustomProvider = nativeBinding.JsCustomProvider
629
+ module.exports.DeepSeekProvider = nativeBinding.DeepSeekProvider
630
+ module.exports.JsDeepSeekProvider = nativeBinding.JsDeepSeekProvider
631
+ module.exports.DiffusionProvider = nativeBinding.DiffusionProvider
632
+ module.exports.JsDiffusionProvider = nativeBinding.JsDiffusionProvider
633
+ module.exports.DynamicEvent = nativeBinding.DynamicEvent
634
+ module.exports.JsDynamicEvent = nativeBinding.JsDynamicEvent
591
635
  module.exports.EmbeddingModel = nativeBinding.EmbeddingModel
592
636
  module.exports.JsEmbeddingModel = nativeBinding.JsEmbeddingModel
637
+ module.exports.EmbedProvider = nativeBinding.EmbedProvider
638
+ module.exports.JsEmbedProvider = nativeBinding.JsEmbedProvider
639
+ module.exports.EstimateCounter = nativeBinding.EstimateCounter
640
+ module.exports.JsEstimateCounter = nativeBinding.JsEstimateCounter
593
641
  module.exports.FalEmbeddingModel = nativeBinding.FalEmbeddingModel
594
642
  module.exports.JsFalEmbeddingModel = nativeBinding.JsFalEmbeddingModel
643
+ module.exports.FallbackModel = nativeBinding.FallbackModel
644
+ module.exports.JsFallbackModel = nativeBinding.JsFallbackModel
595
645
  module.exports.FalProvider = nativeBinding.FalProvider
596
646
  module.exports.JsFalProvider = nativeBinding.JsFalProvider
647
+ module.exports.FastEmbedModel = nativeBinding.FastEmbedModel
648
+ module.exports.JsFastEmbedModel = nativeBinding.JsFastEmbedModel
649
+ module.exports.FireworksProvider = nativeBinding.FireworksProvider
650
+ module.exports.JsFireworksProvider = nativeBinding.JsFireworksProvider
651
+ module.exports.GeminiProvider = nativeBinding.GeminiProvider
652
+ module.exports.JsGeminiProvider = nativeBinding.JsGeminiProvider
653
+ module.exports.GroqProvider = nativeBinding.GroqProvider
654
+ module.exports.JsGroqProvider = nativeBinding.JsGroqProvider
655
+ module.exports.HistoryEventKind = nativeBinding.HistoryEventKind
656
+ module.exports.JsHistoryEventKind = nativeBinding.JsHistoryEventKind
657
+ module.exports.HostDispatch = nativeBinding.HostDispatch
658
+ module.exports.JsHostDispatch = nativeBinding.JsHostDispatch
659
+ module.exports.HttpClient = nativeBinding.HttpClient
660
+ module.exports.JsHttpClient = nativeBinding.JsHttpClient
661
+ module.exports.ImageModel = nativeBinding.ImageModel
662
+ module.exports.JsImageModel = nativeBinding.JsImageModel
597
663
  module.exports.ImageProvider = nativeBinding.ImageProvider
598
664
  module.exports.JsImageProvider = nativeBinding.JsImageProvider
665
+ module.exports.InferenceChunk = nativeBinding.InferenceChunk
666
+ module.exports.JsInferenceChunk = nativeBinding.JsInferenceChunk
667
+ module.exports.InferenceChunkStream = nativeBinding.InferenceChunkStream
668
+ module.exports.JsInferenceChunkStream = nativeBinding.JsInferenceChunkStream
669
+ module.exports.InferenceImage = nativeBinding.InferenceImage
670
+ module.exports.JsInferenceImage = nativeBinding.JsInferenceImage
671
+ module.exports.InferenceImageSource = nativeBinding.InferenceImageSource
672
+ module.exports.JsInferenceImageSource = nativeBinding.JsInferenceImageSource
673
+ module.exports.InferenceResult = nativeBinding.InferenceResult
674
+ module.exports.JsInferenceResult = nativeBinding.JsInferenceResult
675
+ module.exports.InferenceToolCall = nativeBinding.InferenceToolCall
676
+ module.exports.JsInferenceToolCall = nativeBinding.JsInferenceToolCall
677
+ module.exports.InferenceUsage = nativeBinding.InferenceUsage
678
+ module.exports.JsInferenceUsage = nativeBinding.JsInferenceUsage
599
679
  module.exports.InMemoryBackend = nativeBinding.InMemoryBackend
600
680
  module.exports.JsInMemoryBackend = nativeBinding.JsInMemoryBackend
681
+ module.exports.JobHandle = nativeBinding.JobHandle
682
+ module.exports.JsJobHandleClass = nativeBinding.JsJobHandleClass
601
683
  module.exports.JsonlBackend = nativeBinding.JsonlBackend
602
684
  module.exports.JsJsonlBackend = nativeBinding.JsJsonlBackend
685
+ module.exports.LangfuseConfig = nativeBinding.LangfuseConfig
686
+ module.exports.JsLangfuseConfig = nativeBinding.JsLangfuseConfig
687
+ module.exports.LlamaCppChatMessageInput = nativeBinding.LlamaCppChatMessageInput
688
+ module.exports.JsLlamaCppChatMessageInput = nativeBinding.JsLlamaCppChatMessageInput
689
+ module.exports.LlamaCppInferenceChunk = nativeBinding.LlamaCppInferenceChunk
690
+ module.exports.JsLlamaCppInferenceChunk = nativeBinding.JsLlamaCppInferenceChunk
691
+ module.exports.LlamaCppInferenceChunkStream = nativeBinding.LlamaCppInferenceChunkStream
692
+ module.exports.JsLlamaCppInferenceChunkStream = nativeBinding.JsLlamaCppInferenceChunkStream
693
+ module.exports.LlamaCppInferenceResult = nativeBinding.LlamaCppInferenceResult
694
+ module.exports.JsLlamaCppInferenceResult = nativeBinding.JsLlamaCppInferenceResult
695
+ module.exports.LlamaCppInferenceUsage = nativeBinding.LlamaCppInferenceUsage
696
+ module.exports.JsLlamaCppInferenceUsage = nativeBinding.JsLlamaCppInferenceUsage
697
+ module.exports.LlamaCppProvider = nativeBinding.LlamaCppProvider
698
+ module.exports.JsLlamaCppProvider = nativeBinding.JsLlamaCppProvider
699
+ module.exports.LocalModel = nativeBinding.LocalModel
700
+ module.exports.JsLocalModel = nativeBinding.JsLocalModel
603
701
  module.exports.Memory = nativeBinding.Memory
604
702
  module.exports.JsMemory = nativeBinding.JsMemory
605
703
  module.exports.MemoryBackend = nativeBinding.MemoryBackend
606
704
  module.exports.JsMemoryBackend = nativeBinding.JsMemoryBackend
705
+ module.exports.MemoryStore = nativeBinding.MemoryStore
706
+ module.exports.JsMemoryStore = nativeBinding.JsMemoryStore
707
+ module.exports.Middleware = nativeBinding.Middleware
708
+ module.exports.JsMiddleware = nativeBinding.JsMiddleware
709
+ module.exports.MiddlewareStack = nativeBinding.MiddlewareStack
710
+ module.exports.JsMiddlewareStack = nativeBinding.JsMiddlewareStack
711
+ module.exports.MistralProvider = nativeBinding.MistralProvider
712
+ module.exports.JsMistralProvider = nativeBinding.JsMistralProvider
713
+ module.exports.MistralRsProvider = nativeBinding.MistralRsProvider
714
+ module.exports.JsMistralRsProvider = nativeBinding.JsMistralRsProvider
715
+ module.exports.ModelCache = nativeBinding.ModelCache
716
+ module.exports.JsModelCache = nativeBinding.JsModelCache
607
717
  module.exports.ModelManager = nativeBinding.ModelManager
608
718
  module.exports.JsModelManager = nativeBinding.JsModelManager
719
+ module.exports.ModelRegistry = nativeBinding.ModelRegistry
720
+ module.exports.JsModelRegistry = nativeBinding.JsModelRegistry
609
721
  module.exports.MusicProvider = nativeBinding.MusicProvider
610
722
  module.exports.JsMusicProvider = nativeBinding.JsMusicProvider
723
+ module.exports.OpenAiCompatEmbeddingModel = nativeBinding.OpenAiCompatEmbeddingModel
724
+ module.exports.JsOpenAiCompatEmbeddingModel = nativeBinding.JsOpenAiCompatEmbeddingModel
725
+ module.exports.OpenAiCompatProvider = nativeBinding.OpenAiCompatProvider
726
+ module.exports.JsOpenAiCompatProvider = nativeBinding.JsOpenAiCompatProvider
727
+ module.exports.OpenAiEmbeddingModel = nativeBinding.OpenAiEmbeddingModel
728
+ module.exports.JsOpenAiEmbeddingModel = nativeBinding.JsOpenAiEmbeddingModel
611
729
  module.exports.OpenAiProvider = nativeBinding.OpenAiProvider
612
730
  module.exports.JsOpenAiProvider = nativeBinding.JsOpenAiProvider
731
+ module.exports.OpenRouterProvider = nativeBinding.OpenRouterProvider
732
+ module.exports.JsOpenRouterProvider = nativeBinding.JsOpenRouterProvider
733
+ module.exports.ParallelStage = nativeBinding.ParallelStage
734
+ module.exports.JsParallelStage = nativeBinding.JsParallelStage
735
+ module.exports.PerplexityProvider = nativeBinding.PerplexityProvider
736
+ module.exports.JsPerplexityProvider = nativeBinding.JsPerplexityProvider
737
+ module.exports.Pipeline = nativeBinding.Pipeline
738
+ module.exports.JsPipeline = nativeBinding.JsPipeline
739
+ module.exports.PipelineBuilder = nativeBinding.PipelineBuilder
740
+ module.exports.JsPipelineBuilder = nativeBinding.JsPipelineBuilder
741
+ module.exports.PipelineEvent = nativeBinding.PipelineEvent
742
+ module.exports.JsPipelineEvent = nativeBinding.JsPipelineEvent
743
+ module.exports.PipelineHandler = nativeBinding.PipelineHandler
744
+ module.exports.JsPipelineHandler = nativeBinding.JsPipelineHandler
745
+ module.exports.PipelineResult = nativeBinding.PipelineResult
746
+ module.exports.JsPipelineResult = nativeBinding.JsPipelineResult
747
+ module.exports.PipelineSnapshot = nativeBinding.PipelineSnapshot
748
+ module.exports.JsPipelineSnapshot = nativeBinding.JsPipelineSnapshot
749
+ module.exports.PiperProvider = nativeBinding.PiperProvider
750
+ module.exports.JsPiperProvider = nativeBinding.JsPiperProvider
751
+ module.exports.ProgressCallback = nativeBinding.ProgressCallback
752
+ module.exports.JsProgressCallback = nativeBinding.JsProgressCallback
753
+ module.exports.PromptFile = nativeBinding.PromptFile
754
+ module.exports.JsPromptFile = nativeBinding.JsPromptFile
613
755
  module.exports.PromptRegistry = nativeBinding.PromptRegistry
614
756
  module.exports.JsPromptRegistry = nativeBinding.JsPromptRegistry
615
757
  module.exports.PromptTemplate = nativeBinding.PromptTemplate
616
758
  module.exports.JsPromptTemplate = nativeBinding.JsPromptTemplate
759
+ module.exports.ReasoningTrace = nativeBinding.ReasoningTrace
760
+ module.exports.JsReasoningTraceClass = nativeBinding.JsReasoningTraceClass
761
+ module.exports.RedbCheckpointStore = nativeBinding.RedbCheckpointStore
762
+ module.exports.JsRedbCheckpointStore = nativeBinding.JsRedbCheckpointStore
763
+ module.exports.RegistryKey = nativeBinding.RegistryKey
764
+ module.exports.JsRegistryKey = nativeBinding.JsRegistryKey
765
+ module.exports.RequestTiming = nativeBinding.RequestTiming
766
+ module.exports.JsRequestTimingClass = nativeBinding.JsRequestTimingClass
767
+ module.exports.RetryCompletionModel = nativeBinding.RetryCompletionModel
768
+ module.exports.JsRetryCompletionModel = nativeBinding.JsRetryCompletionModel
769
+ module.exports.RetryMiddleware = nativeBinding.RetryMiddleware
770
+ module.exports.JsRetryMiddleware = nativeBinding.JsRetryMiddleware
617
771
  module.exports.SessionNamespace = nativeBinding.SessionNamespace
618
772
  module.exports.JsSessionNamespace = nativeBinding.JsSessionNamespace
773
+ module.exports.SessionRefRegistry = nativeBinding.SessionRefRegistry
774
+ module.exports.JsSessionRefRegistry = nativeBinding.JsSessionRefRegistry
775
+ module.exports.Stage = nativeBinding.Stage
776
+ module.exports.JsStage = nativeBinding.JsStage
777
+ module.exports.StageResult = nativeBinding.StageResult
778
+ module.exports.JsStageResult = nativeBinding.JsStageResult
779
+ module.exports.StartEvent = nativeBinding.StartEvent
780
+ module.exports.JsStartEventClass = nativeBinding.JsStartEventClass
619
781
  module.exports.StateNamespace = nativeBinding.StateNamespace
620
782
  module.exports.JsStateNamespace = nativeBinding.JsStateNamespace
783
+ module.exports.StateValue = nativeBinding.StateValue
784
+ module.exports.JsStateValue = nativeBinding.JsStateValue
785
+ module.exports.StepDeserializerRegistry = nativeBinding.StepDeserializerRegistry
786
+ module.exports.JsStepDeserializerRegistry = nativeBinding.JsStepDeserializerRegistry
787
+ module.exports.StepOutput = nativeBinding.StepOutput
788
+ module.exports.JsStepOutput = nativeBinding.JsStepOutput
789
+ module.exports.StepRegistration = nativeBinding.StepRegistration
790
+ module.exports.JsStepRegistration = nativeBinding.JsStepRegistration
791
+ module.exports.StopEvent = nativeBinding.StopEvent
792
+ module.exports.JsStopEventClass = nativeBinding.JsStopEventClass
793
+ module.exports.StructuredOutput = nativeBinding.StructuredOutput
794
+ module.exports.JsStructuredOutput = nativeBinding.JsStructuredOutput
621
795
  module.exports.ThreeDProvider = nativeBinding.ThreeDProvider
622
796
  module.exports.JsThreeDProvider = nativeBinding.JsThreeDProvider
797
+ module.exports.TogetherProvider = nativeBinding.TogetherProvider
798
+ module.exports.JsTogetherProvider = nativeBinding.JsTogetherProvider
799
+ module.exports.TokenCounter = nativeBinding.TokenCounter
800
+ module.exports.JsTokenCounter = nativeBinding.JsTokenCounter
801
+ module.exports.TokenUsage = nativeBinding.TokenUsage
802
+ module.exports.JsTokenUsageClass = nativeBinding.JsTokenUsageClass
803
+ module.exports.Tool = nativeBinding.Tool
804
+ module.exports.JsTool = nativeBinding.JsTool
805
+ module.exports.ToolCall = nativeBinding.ToolCall
806
+ module.exports.JsToolCallClass = nativeBinding.JsToolCallClass
807
+ module.exports.ToolDefinition = nativeBinding.ToolDefinition
808
+ module.exports.JsToolDefinitionClass = nativeBinding.JsToolDefinitionClass
809
+ module.exports.TractEmbedModel = nativeBinding.TractEmbedModel
810
+ module.exports.JsTractEmbedModel = nativeBinding.JsTractEmbedModel
623
811
  module.exports.Transcription = nativeBinding.Transcription
624
812
  module.exports.JsTranscription = nativeBinding.JsTranscription
625
813
  module.exports.TTSProvider = nativeBinding.TTSProvider
626
814
  module.exports.JsTTSProvider = nativeBinding.JsTTSProvider
815
+ module.exports.TypedTool = nativeBinding.TypedTool
816
+ module.exports.JsTypedTool = nativeBinding.JsTypedTool
627
817
  module.exports.ValkeyBackend = nativeBinding.ValkeyBackend
628
818
  module.exports.JsValkeyBackend = nativeBinding.JsValkeyBackend
819
+ module.exports.ValkeyCheckpointStore = nativeBinding.ValkeyCheckpointStore
820
+ module.exports.JsValkeyCheckpointStore = nativeBinding.JsValkeyCheckpointStore
629
821
  module.exports.VideoProvider = nativeBinding.VideoProvider
630
822
  module.exports.JsVideoProvider = nativeBinding.JsVideoProvider
631
823
  module.exports.VoiceProvider = nativeBinding.VoiceProvider
632
824
  module.exports.JsVoiceProvider = nativeBinding.JsVoiceProvider
825
+ module.exports.WhisperCppProvider = nativeBinding.WhisperCppProvider
826
+ module.exports.JsWhisperCppProvider = nativeBinding.JsWhisperCppProvider
633
827
  module.exports.Workflow = nativeBinding.Workflow
634
828
  module.exports.JsWorkflow = nativeBinding.JsWorkflow
829
+ module.exports.WorkflowBuilder = nativeBinding.WorkflowBuilder
830
+ module.exports.JsWorkflowBuilder = nativeBinding.JsWorkflowBuilder
831
+ module.exports.WorkflowCheckpoint = nativeBinding.WorkflowCheckpoint
832
+ module.exports.JsWorkflowCheckpoint = nativeBinding.JsWorkflowCheckpoint
635
833
  module.exports.WorkflowHandler = nativeBinding.WorkflowHandler
636
834
  module.exports.JsWorkflowHandler = nativeBinding.JsWorkflowHandler
835
+ module.exports.WorkflowHistory = nativeBinding.WorkflowHistory
836
+ module.exports.JsWorkflowHistory = nativeBinding.JsWorkflowHistory
837
+ module.exports.WorkflowSnapshot = nativeBinding.WorkflowSnapshot
838
+ module.exports.JsWorkflowSnapshot = nativeBinding.JsWorkflowSnapshot
839
+ module.exports.XaiProvider = nativeBinding.XaiProvider
840
+ module.exports.JsXaiProvider = nativeBinding.JsXaiProvider
841
+ module.exports.ChatRole = nativeBinding.ChatRole
842
+ module.exports.JsChatRole = nativeBinding.JsChatRole
637
843
  module.exports.completeBatch = nativeBinding.completeBatch
844
+ module.exports.completeBatchConfig = nativeBinding.completeBatchConfig
845
+ module.exports.computeElidSimilarity = nativeBinding.computeElidSimilarity
846
+ module.exports.computeEmbeddingSimhashSimilarity = nativeBinding.computeEmbeddingSimhashSimilarity
847
+ module.exports.computeTextSimhashSimilarity = nativeBinding.computeTextSimhashSimilarity
638
848
  module.exports.countMessageTokens = nativeBinding.countMessageTokens
849
+ module.exports.envVarForProvider = nativeBinding.envVarForProvider
639
850
  module.exports.estimateTokens = nativeBinding.estimateTokens
851
+ module.exports.extractInlineArtifacts = nativeBinding.extractInlineArtifacts
852
+ module.exports.formatProviderHttpTail = nativeBinding.formatProviderHttpTail
853
+ module.exports.getContextWindow = nativeBinding.getContextWindow
854
+ module.exports.HistoryEventKindTag = nativeBinding.HistoryEventKindTag
855
+ module.exports.JsHistoryEventKindTag = nativeBinding.JsHistoryEventKindTag
856
+ module.exports.initLangfuse = nativeBinding.initLangfuse
857
+ module.exports.internEventType = nativeBinding.internEventType
858
+ module.exports.JoinStrategy = nativeBinding.JoinStrategy
859
+ module.exports.JsJoinStrategy = nativeBinding.JsJoinStrategy
860
+ module.exports.JsAuthMethod = nativeBinding.JsAuthMethod
640
861
  module.exports.JsCacheStrategy = nativeBinding.JsCacheStrategy
862
+ module.exports.JsDiffusionScheduler = nativeBinding.JsDiffusionScheduler
641
863
  module.exports.JsFalLlmEndpointKind = nativeBinding.JsFalLlmEndpointKind
642
864
  module.exports.JsJobStatus = nativeBinding.JsJobStatus
643
865
  module.exports.JsRole = nativeBinding.JsRole
644
866
  module.exports.JsWhisperModel = nativeBinding.JsWhisperModel
867
+ module.exports.LlamaCppChatRole = nativeBinding.LlamaCppChatRole
868
+ module.exports.JsLlamaCppChatRole = nativeBinding.JsLlamaCppChatRole
869
+ module.exports.loadClientTls = nativeBinding.loadClientTls
870
+ module.exports.loadServerTls = nativeBinding.loadServerTls
645
871
  module.exports.lookupPricing = nativeBinding.lookupPricing
872
+ module.exports.lookupStepBuilder = nativeBinding.lookupStepBuilder
873
+ module.exports.PauseReason = nativeBinding.PauseReason
874
+ module.exports.JsPauseReason = nativeBinding.JsPauseReason
875
+ module.exports.peerEnvelopeVersion = nativeBinding.peerEnvelopeVersion
876
+ module.exports.peerTokenEnv = nativeBinding.peerTokenEnv
877
+ module.exports.providerEnvVars = nativeBinding.providerEnvVars
878
+ module.exports.ProviderId = nativeBinding.ProviderId
879
+ module.exports.JsProviderId = nativeBinding.JsProviderId
880
+ module.exports.RefLifetime = nativeBinding.RefLifetime
881
+ module.exports.JsRefLifetime = nativeBinding.JsRefLifetime
882
+ module.exports.registeredStepIds = nativeBinding.registeredStepIds
883
+ module.exports.registerEventDeserializer = nativeBinding.registerEventDeserializer
884
+ module.exports.registerFromModelInfo = nativeBinding.registerFromModelInfo
646
885
  module.exports.registerPricing = nativeBinding.registerPricing
886
+ module.exports.registerStepBuilder = nativeBinding.registerStepBuilder
887
+ module.exports.resolveApiKey = nativeBinding.resolveApiKey
888
+ module.exports.resolveBeerToken = nativeBinding.resolveBeerToken
647
889
  module.exports.runAgent = nativeBinding.runAgent
890
+ module.exports.runAgentWithCallback = nativeBinding.runAgentWithCallback
648
891
  module.exports.SessionPausePolicy = nativeBinding.SessionPausePolicy
649
892
  module.exports.JsSessionPausePolicy = nativeBinding.JsSessionPausePolicy
893
+ module.exports.simhashFromHex = nativeBinding.simhashFromHex
894
+ module.exports.simhashToHex = nativeBinding.simhashToHex
895
+ module.exports.StateValueKind = nativeBinding.StateValueKind
896
+ module.exports.JsStateValueKind = nativeBinding.JsStateValueKind
897
+ module.exports.StepOutputKind = nativeBinding.StepOutputKind
898
+ module.exports.JsStepOutputKind = nativeBinding.JsStepOutputKind
899
+ module.exports.TemplateRole = nativeBinding.TemplateRole
900
+ module.exports.JsTemplateRole = nativeBinding.JsTemplateRole
901
+ module.exports.tryDeserializeEvent = nativeBinding.tryDeserializeEvent
902
+ module.exports.typedToolSimple = nativeBinding.typedToolSimple
650
903
  module.exports.version = nativeBinding.version
904
+
905
+ // --- post-build: typed-error wrapping ---
906
+ ;(() => {
907
+ const errorClasses = require('./error-classes.js')
908
+ const { enrichError } = errorClasses
909
+
910
+ // Wrap a single function so any thrown error -- sync or async -- is
911
+ // passed through enrichError before reaching the caller.
912
+ const wrap = (fn) => {
913
+ return function blazenWrapped(...args) {
914
+ try {
915
+ const result = fn.apply(this, args)
916
+ if (result && typeof result.then === 'function') {
917
+ return result.then(
918
+ (v) => v,
919
+ (e) => {
920
+ throw enrichError(e)
921
+ },
922
+ )
923
+ }
924
+ return result
925
+ } catch (e) {
926
+ throw enrichError(e)
927
+ }
928
+ }
929
+ }
930
+
931
+ // Patch a class's prototype methods in-place. Skips the constructor
932
+ // and any non-function or non-configurable property.
933
+ const patchPrototype = (Cls) => {
934
+ if (typeof Cls !== 'function') return
935
+ const proto = Cls.prototype
936
+ if (!proto || typeof proto !== 'object') return
937
+ for (const key of Object.getOwnPropertyNames(proto)) {
938
+ if (key === 'constructor') continue
939
+ const desc = Object.getOwnPropertyDescriptor(proto, key)
940
+ if (!desc || !desc.configurable) continue
941
+ if (typeof desc.value !== 'function') continue
942
+ try {
943
+ Object.defineProperty(proto, key, {
944
+ ...desc,
945
+ value: wrap(desc.value),
946
+ })
947
+ } catch {
948
+ // Some napi prototypes are frozen; skip gracefully.
949
+ }
950
+ }
951
+ }
952
+
953
+ // Wrap every top-level export. Distinguish functions (call wrap) from
954
+ // constructors (call patchPrototype). Heuristic: a constructor has a
955
+ // `prototype` object with own properties beyond `constructor`. When
956
+ // in doubt we patch the prototype AND wrap the function -- wrapping a
957
+ // constructor call in try/catch is safe (`new wrappedCtor()` still
958
+ // works because `fn.apply(this, args)` on a constructor called with
959
+ // `new` would normally fail, but napi-rs class constructors are
960
+ // exposed as plain factories that do not require `new`).
961
+ for (const key of Object.keys(module.exports)) {
962
+ const orig = module.exports[key]
963
+ if (typeof orig !== 'function') continue
964
+ // Skip the typed-error classes we are about to install.
965
+ if (Object.prototype.hasOwnProperty.call(errorClasses, key)) continue
966
+ if (orig.prototype && typeof orig.prototype === 'object') {
967
+ patchPrototype(orig)
968
+ }
969
+ // Only wrap "plain" functions (lowercase first letter convention) and
970
+ // any function whose prototype is empty (i.e. not a class). napi-rs
971
+ // emits classes with PascalCase names; we leave those callable as-is
972
+ // so `new ClassName(...)` keeps working but their methods are
973
+ // already patched above.
974
+ const isLikelyClass =
975
+ orig.prototype &&
976
+ Object.getOwnPropertyNames(orig.prototype).some((p) => p !== 'constructor')
977
+ if (!isLikelyClass) {
978
+ module.exports[key] = wrap(orig)
979
+ }
980
+ }
981
+
982
+ // Re-export the typed error classes + enrichError.
983
+ for (const [name, value] of Object.entries(errorClasses)) {
984
+ module.exports[name] = value
985
+ }
986
+ })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blazen",
3
- "version": "0.1.151",
3
+ "version": "0.1.153",
4
4
  "description": "Blazen - Event-driven AI workflow framework for Node.js/TypeScript",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -35,7 +35,8 @@
35
35
  ],
36
36
  "files": [
37
37
  "index.js",
38
- "index.d.ts"
38
+ "index.d.ts",
39
+ "error-classes.js"
39
40
  ],
40
41
  "devDependencies": {
41
42
  "@napi-rs/cli": "^3.0.0",
@@ -45,16 +46,16 @@
45
46
  "node": ">= 18"
46
47
  },
47
48
  "optionalDependencies": {
48
- "@blazen-dev/blazen-linux-x64-gnu": "0.1.151",
49
- "@blazen-dev/blazen-linux-x64-musl": "0.1.151",
50
- "@blazen-dev/blazen-linux-arm64-gnu": "0.1.151",
51
- "@blazen-dev/blazen-linux-arm64-musl": "0.1.151",
52
- "@blazen-dev/blazen-darwin-arm64": "0.1.151",
53
- "@blazen-dev/blazen-win32-x64-msvc": "0.1.151"
49
+ "@blazen-dev/blazen-linux-x64-gnu": "0.1.153",
50
+ "@blazen-dev/blazen-linux-x64-musl": "0.1.153",
51
+ "@blazen-dev/blazen-linux-arm64-gnu": "0.1.153",
52
+ "@blazen-dev/blazen-linux-arm64-musl": "0.1.153",
53
+ "@blazen-dev/blazen-darwin-arm64": "0.1.153",
54
+ "@blazen-dev/blazen-win32-x64-msvc": "0.1.153"
54
55
  },
55
56
  "scripts": {
56
- "build": "napi build --release --platform --features local-all --js index.js",
57
- "build:debug": "napi build --platform --features local-all --js index.js",
57
+ "build": "napi build --release --platform --features local-all,langfuse --js index.js && node scripts/post-build.mjs",
58
+ "build:debug": "napi build --platform --features local-all,langfuse --js index.js && node scripts/post-build.mjs",
58
59
  "test": "node --test ../../tests/node/test_workflow.mjs",
59
60
  "test:smoke": "node --test ../../tests/node/test_llm_smoke.mjs"
60
61
  }