blazen 0.1.152 → 0.1.154

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 +5536 -243
  4. package/index.js +366 -0
  5. package/package.json +27 -13
package/index.js CHANGED
@@ -576,75 +576,441 @@ 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.NoopUsageEmitter = nativeBinding.NoopUsageEmitter
724
+ module.exports.JsNoopUsageEmitter = nativeBinding.JsNoopUsageEmitter
725
+ module.exports.OpenAiCompatEmbeddingModel = nativeBinding.OpenAiCompatEmbeddingModel
726
+ module.exports.JsOpenAiCompatEmbeddingModel = nativeBinding.JsOpenAiCompatEmbeddingModel
727
+ module.exports.OpenAiCompatProvider = nativeBinding.OpenAiCompatProvider
728
+ module.exports.JsOpenAiCompatProvider = nativeBinding.JsOpenAiCompatProvider
729
+ module.exports.OpenAiEmbeddingModel = nativeBinding.OpenAiEmbeddingModel
730
+ module.exports.JsOpenAiEmbeddingModel = nativeBinding.JsOpenAiEmbeddingModel
611
731
  module.exports.OpenAiProvider = nativeBinding.OpenAiProvider
612
732
  module.exports.JsOpenAiProvider = nativeBinding.JsOpenAiProvider
733
+ module.exports.OpenRouterProvider = nativeBinding.OpenRouterProvider
734
+ module.exports.JsOpenRouterProvider = nativeBinding.JsOpenRouterProvider
735
+ module.exports.ParallelStage = nativeBinding.ParallelStage
736
+ module.exports.JsParallelStage = nativeBinding.JsParallelStage
737
+ module.exports.ParallelSubWorkflowsStep = nativeBinding.ParallelSubWorkflowsStep
738
+ module.exports.JsParallelSubWorkflowsStep = nativeBinding.JsParallelSubWorkflowsStep
739
+ module.exports.PerplexityProvider = nativeBinding.PerplexityProvider
740
+ module.exports.JsPerplexityProvider = nativeBinding.JsPerplexityProvider
741
+ module.exports.Pipeline = nativeBinding.Pipeline
742
+ module.exports.JsPipeline = nativeBinding.JsPipeline
743
+ module.exports.PipelineBuilder = nativeBinding.PipelineBuilder
744
+ module.exports.JsPipelineBuilder = nativeBinding.JsPipelineBuilder
745
+ module.exports.PipelineEvent = nativeBinding.PipelineEvent
746
+ module.exports.JsPipelineEvent = nativeBinding.JsPipelineEvent
747
+ module.exports.PipelineHandler = nativeBinding.PipelineHandler
748
+ module.exports.JsPipelineHandler = nativeBinding.JsPipelineHandler
749
+ module.exports.PipelineResult = nativeBinding.PipelineResult
750
+ module.exports.JsPipelineResult = nativeBinding.JsPipelineResult
751
+ module.exports.PipelineSnapshot = nativeBinding.PipelineSnapshot
752
+ module.exports.JsPipelineSnapshot = nativeBinding.JsPipelineSnapshot
753
+ module.exports.PiperProvider = nativeBinding.PiperProvider
754
+ module.exports.JsPiperProvider = nativeBinding.JsPiperProvider
755
+ module.exports.ProgressCallback = nativeBinding.ProgressCallback
756
+ module.exports.JsProgressCallback = nativeBinding.JsProgressCallback
757
+ module.exports.PromptFile = nativeBinding.PromptFile
758
+ module.exports.JsPromptFile = nativeBinding.JsPromptFile
613
759
  module.exports.PromptRegistry = nativeBinding.PromptRegistry
614
760
  module.exports.JsPromptRegistry = nativeBinding.JsPromptRegistry
615
761
  module.exports.PromptTemplate = nativeBinding.PromptTemplate
616
762
  module.exports.JsPromptTemplate = nativeBinding.JsPromptTemplate
763
+ module.exports.ReasoningTrace = nativeBinding.ReasoningTrace
764
+ module.exports.JsReasoningTraceClass = nativeBinding.JsReasoningTraceClass
765
+ module.exports.RedbCheckpointStore = nativeBinding.RedbCheckpointStore
766
+ module.exports.JsRedbCheckpointStore = nativeBinding.JsRedbCheckpointStore
767
+ module.exports.RegistryKey = nativeBinding.RegistryKey
768
+ module.exports.JsRegistryKey = nativeBinding.JsRegistryKey
769
+ module.exports.RequestTiming = nativeBinding.RequestTiming
770
+ module.exports.JsRequestTimingClass = nativeBinding.JsRequestTimingClass
771
+ module.exports.RetryCompletionModel = nativeBinding.RetryCompletionModel
772
+ module.exports.JsRetryCompletionModel = nativeBinding.JsRetryCompletionModel
773
+ module.exports.RetryMemoryBackend = nativeBinding.RetryMemoryBackend
774
+ module.exports.JsRetryMemoryBackend = nativeBinding.JsRetryMemoryBackend
775
+ module.exports.RetryMiddleware = nativeBinding.RetryMiddleware
776
+ module.exports.JsRetryMiddleware = nativeBinding.JsRetryMiddleware
617
777
  module.exports.SessionNamespace = nativeBinding.SessionNamespace
618
778
  module.exports.JsSessionNamespace = nativeBinding.JsSessionNamespace
779
+ module.exports.SessionRefRegistry = nativeBinding.SessionRefRegistry
780
+ module.exports.JsSessionRefRegistry = nativeBinding.JsSessionRefRegistry
781
+ module.exports.Stage = nativeBinding.Stage
782
+ module.exports.JsStage = nativeBinding.JsStage
783
+ module.exports.StageResult = nativeBinding.StageResult
784
+ module.exports.JsStageResult = nativeBinding.JsStageResult
785
+ module.exports.StartEvent = nativeBinding.StartEvent
786
+ module.exports.JsStartEventClass = nativeBinding.JsStartEventClass
619
787
  module.exports.StateNamespace = nativeBinding.StateNamespace
620
788
  module.exports.JsStateNamespace = nativeBinding.JsStateNamespace
789
+ module.exports.StateValue = nativeBinding.StateValue
790
+ module.exports.JsStateValue = nativeBinding.JsStateValue
791
+ module.exports.StepDeserializerRegistry = nativeBinding.StepDeserializerRegistry
792
+ module.exports.JsStepDeserializerRegistry = nativeBinding.JsStepDeserializerRegistry
793
+ module.exports.StepOutput = nativeBinding.StepOutput
794
+ module.exports.JsStepOutput = nativeBinding.JsStepOutput
795
+ module.exports.StepRegistration = nativeBinding.StepRegistration
796
+ module.exports.JsStepRegistration = nativeBinding.JsStepRegistration
797
+ module.exports.StopEvent = nativeBinding.StopEvent
798
+ module.exports.JsStopEventClass = nativeBinding.JsStopEventClass
799
+ module.exports.StructuredOutput = nativeBinding.StructuredOutput
800
+ module.exports.JsStructuredOutput = nativeBinding.JsStructuredOutput
801
+ module.exports.SubWorkflowStep = nativeBinding.SubWorkflowStep
802
+ module.exports.JsSubWorkflowStep = nativeBinding.JsSubWorkflowStep
621
803
  module.exports.ThreeDProvider = nativeBinding.ThreeDProvider
622
804
  module.exports.JsThreeDProvider = nativeBinding.JsThreeDProvider
805
+ module.exports.TogetherProvider = nativeBinding.TogetherProvider
806
+ module.exports.JsTogetherProvider = nativeBinding.JsTogetherProvider
807
+ module.exports.TokenCounter = nativeBinding.TokenCounter
808
+ module.exports.JsTokenCounter = nativeBinding.JsTokenCounter
809
+ module.exports.TokenUsage = nativeBinding.TokenUsage
810
+ module.exports.JsTokenUsageClass = nativeBinding.JsTokenUsageClass
811
+ module.exports.Tool = nativeBinding.Tool
812
+ module.exports.JsTool = nativeBinding.JsTool
813
+ module.exports.ToolCall = nativeBinding.ToolCall
814
+ module.exports.JsToolCallClass = nativeBinding.JsToolCallClass
815
+ module.exports.ToolDefinition = nativeBinding.ToolDefinition
816
+ module.exports.JsToolDefinitionClass = nativeBinding.JsToolDefinitionClass
817
+ module.exports.TractEmbedModel = nativeBinding.TractEmbedModel
818
+ module.exports.JsTractEmbedModel = nativeBinding.JsTractEmbedModel
623
819
  module.exports.Transcription = nativeBinding.Transcription
624
820
  module.exports.JsTranscription = nativeBinding.JsTranscription
625
821
  module.exports.TTSProvider = nativeBinding.TTSProvider
626
822
  module.exports.JsTTSProvider = nativeBinding.JsTTSProvider
823
+ module.exports.TypedTool = nativeBinding.TypedTool
824
+ module.exports.JsTypedTool = nativeBinding.JsTypedTool
825
+ module.exports.UsageEmitter = nativeBinding.UsageEmitter
826
+ module.exports.JsUsageEmitter = nativeBinding.JsUsageEmitter
827
+ module.exports.UsageRecordingCompletionModel = nativeBinding.UsageRecordingCompletionModel
828
+ module.exports.JsUsageRecordingCompletionModel = nativeBinding.JsUsageRecordingCompletionModel
829
+ module.exports.UsageRecordingEmbeddingModel = nativeBinding.UsageRecordingEmbeddingModel
830
+ module.exports.JsUsageRecordingEmbeddingModel = nativeBinding.JsUsageRecordingEmbeddingModel
627
831
  module.exports.ValkeyBackend = nativeBinding.ValkeyBackend
628
832
  module.exports.JsValkeyBackend = nativeBinding.JsValkeyBackend
833
+ module.exports.ValkeyCheckpointStore = nativeBinding.ValkeyCheckpointStore
834
+ module.exports.JsValkeyCheckpointStore = nativeBinding.JsValkeyCheckpointStore
629
835
  module.exports.VideoProvider = nativeBinding.VideoProvider
630
836
  module.exports.JsVideoProvider = nativeBinding.JsVideoProvider
631
837
  module.exports.VoiceProvider = nativeBinding.VoiceProvider
632
838
  module.exports.JsVoiceProvider = nativeBinding.JsVoiceProvider
839
+ module.exports.WhisperCppProvider = nativeBinding.WhisperCppProvider
840
+ module.exports.JsWhisperCppProvider = nativeBinding.JsWhisperCppProvider
633
841
  module.exports.Workflow = nativeBinding.Workflow
634
842
  module.exports.JsWorkflow = nativeBinding.JsWorkflow
843
+ module.exports.WorkflowBuilder = nativeBinding.WorkflowBuilder
844
+ module.exports.JsWorkflowBuilder = nativeBinding.JsWorkflowBuilder
845
+ module.exports.WorkflowCheckpoint = nativeBinding.WorkflowCheckpoint
846
+ module.exports.JsWorkflowCheckpoint = nativeBinding.JsWorkflowCheckpoint
635
847
  module.exports.WorkflowHandler = nativeBinding.WorkflowHandler
636
848
  module.exports.JsWorkflowHandler = nativeBinding.JsWorkflowHandler
849
+ module.exports.WorkflowHistory = nativeBinding.WorkflowHistory
850
+ module.exports.JsWorkflowHistory = nativeBinding.JsWorkflowHistory
851
+ module.exports.WorkflowSnapshot = nativeBinding.WorkflowSnapshot
852
+ module.exports.JsWorkflowSnapshot = nativeBinding.JsWorkflowSnapshot
853
+ module.exports.XaiProvider = nativeBinding.XaiProvider
854
+ module.exports.JsXaiProvider = nativeBinding.JsXaiProvider
855
+ module.exports.addUsageToTokenUsage = nativeBinding.addUsageToTokenUsage
856
+ module.exports.ChatRole = nativeBinding.ChatRole
857
+ module.exports.JsChatRole = nativeBinding.JsChatRole
637
858
  module.exports.completeBatch = nativeBinding.completeBatch
859
+ module.exports.completeBatchConfig = nativeBinding.completeBatchConfig
860
+ module.exports.computeAudioCost = nativeBinding.computeAudioCost
861
+ module.exports.computeElidSimilarity = nativeBinding.computeElidSimilarity
862
+ module.exports.computeEmbeddingSimhashSimilarity = nativeBinding.computeEmbeddingSimhashSimilarity
863
+ module.exports.computeImageCost = nativeBinding.computeImageCost
864
+ module.exports.computeTextSimhashSimilarity = nativeBinding.computeTextSimhashSimilarity
865
+ module.exports.computeVideoCost = nativeBinding.computeVideoCost
638
866
  module.exports.countMessageTokens = nativeBinding.countMessageTokens
867
+ module.exports.defaultHttpClientConfig = nativeBinding.defaultHttpClientConfig
868
+ module.exports.envVarForProvider = nativeBinding.envVarForProvider
639
869
  module.exports.estimateTokens = nativeBinding.estimateTokens
870
+ module.exports.extractInlineArtifacts = nativeBinding.extractInlineArtifacts
871
+ module.exports.FINISH_WORKFLOW_TOOL_NAME = nativeBinding.FINISH_WORKFLOW_TOOL_NAME
872
+ module.exports.finishWorkflowTool = nativeBinding.finishWorkflowTool
873
+ module.exports.finishWorkflowToolDef = nativeBinding.finishWorkflowToolDef
874
+ module.exports.formatProviderHttpTail = nativeBinding.formatProviderHttpTail
875
+ module.exports.getContextWindow = nativeBinding.getContextWindow
876
+ module.exports.HistoryEventKindTag = nativeBinding.HistoryEventKindTag
877
+ module.exports.JsHistoryEventKindTag = nativeBinding.JsHistoryEventKindTag
878
+ module.exports.initLangfuse = nativeBinding.initLangfuse
879
+ module.exports.internEventType = nativeBinding.internEventType
880
+ module.exports.JoinStrategy = nativeBinding.JoinStrategy
881
+ module.exports.JsJoinStrategy = nativeBinding.JsJoinStrategy
882
+ module.exports.JsAuthMethod = nativeBinding.JsAuthMethod
640
883
  module.exports.JsCacheStrategy = nativeBinding.JsCacheStrategy
884
+ module.exports.JsDiffusionScheduler = nativeBinding.JsDiffusionScheduler
641
885
  module.exports.JsFalLlmEndpointKind = nativeBinding.JsFalLlmEndpointKind
642
886
  module.exports.JsJobStatus = nativeBinding.JsJobStatus
643
887
  module.exports.JsRole = nativeBinding.JsRole
644
888
  module.exports.JsWhisperModel = nativeBinding.JsWhisperModel
889
+ module.exports.LlamaCppChatRole = nativeBinding.LlamaCppChatRole
890
+ module.exports.JsLlamaCppChatRole = nativeBinding.JsLlamaCppChatRole
891
+ module.exports.loadClientTls = nativeBinding.loadClientTls
892
+ module.exports.loadServerTls = nativeBinding.loadServerTls
645
893
  module.exports.lookupPricing = nativeBinding.lookupPricing
894
+ module.exports.lookupStepBuilder = nativeBinding.lookupStepBuilder
895
+ module.exports.Modality = nativeBinding.Modality
896
+ module.exports.JsModality = nativeBinding.JsModality
897
+ module.exports.newRetryStack = nativeBinding.newRetryStack
898
+ module.exports.newUsageEvent = nativeBinding.newUsageEvent
899
+ module.exports.PauseReason = nativeBinding.PauseReason
900
+ module.exports.JsPauseReason = nativeBinding.JsPauseReason
901
+ module.exports.peerEnvelopeVersion = nativeBinding.peerEnvelopeVersion
902
+ module.exports.peerTokenEnv = nativeBinding.peerTokenEnv
903
+ module.exports.ProgressKind = nativeBinding.ProgressKind
904
+ module.exports.JsProgressKind = nativeBinding.JsProgressKind
905
+ module.exports.providerEnvVars = nativeBinding.providerEnvVars
906
+ module.exports.ProviderId = nativeBinding.ProviderId
907
+ module.exports.JsProviderId = nativeBinding.JsProviderId
908
+ module.exports.RefLifetime = nativeBinding.RefLifetime
909
+ module.exports.JsRefLifetime = nativeBinding.JsRefLifetime
910
+ module.exports.registeredStepIds = nativeBinding.registeredStepIds
911
+ module.exports.registerEventDeserializer = nativeBinding.registerEventDeserializer
912
+ module.exports.registerFromModelInfo = nativeBinding.registerFromModelInfo
646
913
  module.exports.registerPricing = nativeBinding.registerPricing
914
+ module.exports.registerStepBuilder = nativeBinding.registerStepBuilder
915
+ module.exports.resolveApiKey = nativeBinding.resolveApiKey
916
+ module.exports.resolveBeerToken = nativeBinding.resolveBeerToken
917
+ module.exports.resolveRetryStack = nativeBinding.resolveRetryStack
647
918
  module.exports.runAgent = nativeBinding.runAgent
919
+ module.exports.runAgentWithCallback = nativeBinding.runAgentWithCallback
648
920
  module.exports.SessionPausePolicy = nativeBinding.SessionPausePolicy
649
921
  module.exports.JsSessionPausePolicy = nativeBinding.JsSessionPausePolicy
922
+ module.exports.simhashFromHex = nativeBinding.simhashFromHex
923
+ module.exports.simhashToHex = nativeBinding.simhashToHex
924
+ module.exports.StateValueKind = nativeBinding.StateValueKind
925
+ module.exports.JsStateValueKind = nativeBinding.JsStateValueKind
926
+ module.exports.StepOutputKind = nativeBinding.StepOutputKind
927
+ module.exports.JsStepOutputKind = nativeBinding.JsStepOutputKind
928
+ module.exports.TemplateRole = nativeBinding.TemplateRole
929
+ module.exports.JsTemplateRole = nativeBinding.JsTemplateRole
930
+ module.exports.tryDeserializeEvent = nativeBinding.tryDeserializeEvent
931
+ module.exports.typedToolSimple = nativeBinding.typedToolSimple
932
+ module.exports.unlimitedHttpClientConfig = nativeBinding.unlimitedHttpClientConfig
650
933
  module.exports.version = nativeBinding.version
934
+
935
+ // --- post-build: typed-error wrapping ---
936
+ ;(() => {
937
+ const errorClasses = require('./error-classes.js')
938
+ const { enrichError } = errorClasses
939
+
940
+ // Wrap a single function so any thrown error -- sync or async -- is
941
+ // passed through enrichError before reaching the caller.
942
+ const wrap = (fn) => {
943
+ return function blazenWrapped(...args) {
944
+ try {
945
+ const result = fn.apply(this, args)
946
+ if (result && typeof result.then === 'function') {
947
+ return result.then(
948
+ (v) => v,
949
+ (e) => {
950
+ throw enrichError(e)
951
+ },
952
+ )
953
+ }
954
+ return result
955
+ } catch (e) {
956
+ throw enrichError(e)
957
+ }
958
+ }
959
+ }
960
+
961
+ // Patch a class's prototype methods in-place. Skips the constructor
962
+ // and any non-function or non-configurable property.
963
+ const patchPrototype = (Cls) => {
964
+ if (typeof Cls !== 'function') return
965
+ const proto = Cls.prototype
966
+ if (!proto || typeof proto !== 'object') return
967
+ for (const key of Object.getOwnPropertyNames(proto)) {
968
+ if (key === 'constructor') continue
969
+ const desc = Object.getOwnPropertyDescriptor(proto, key)
970
+ if (!desc || !desc.configurable) continue
971
+ if (typeof desc.value !== 'function') continue
972
+ try {
973
+ Object.defineProperty(proto, key, {
974
+ ...desc,
975
+ value: wrap(desc.value),
976
+ })
977
+ } catch {
978
+ // Some napi prototypes are frozen; skip gracefully.
979
+ }
980
+ }
981
+ }
982
+
983
+ // Wrap every top-level export. Distinguish functions (call wrap) from
984
+ // constructors (call patchPrototype). Heuristic: a constructor has a
985
+ // `prototype` object with own properties beyond `constructor`. When
986
+ // in doubt we patch the prototype AND wrap the function -- wrapping a
987
+ // constructor call in try/catch is safe (`new wrappedCtor()` still
988
+ // works because `fn.apply(this, args)` on a constructor called with
989
+ // `new` would normally fail, but napi-rs class constructors are
990
+ // exposed as plain factories that do not require `new`).
991
+ for (const key of Object.keys(module.exports)) {
992
+ const orig = module.exports[key]
993
+ if (typeof orig !== 'function') continue
994
+ // Skip the typed-error classes we are about to install.
995
+ if (Object.prototype.hasOwnProperty.call(errorClasses, key)) continue
996
+ if (orig.prototype && typeof orig.prototype === 'object') {
997
+ patchPrototype(orig)
998
+ }
999
+ // Only wrap "plain" functions (lowercase first letter convention) and
1000
+ // any function whose prototype is empty (i.e. not a class). napi-rs
1001
+ // emits classes with PascalCase names; we leave those callable as-is
1002
+ // so `new ClassName(...)` keeps working but their methods are
1003
+ // already patched above.
1004
+ const isLikelyClass =
1005
+ orig.prototype &&
1006
+ Object.getOwnPropertyNames(orig.prototype).some((p) => p !== 'constructor')
1007
+ if (!isLikelyClass) {
1008
+ module.exports[key] = wrap(orig)
1009
+ }
1010
+ }
1011
+
1012
+ // Re-export the typed error classes + enrichError.
1013
+ for (const [name, value] of Object.entries(errorClasses)) {
1014
+ module.exports[name] = value
1015
+ }
1016
+ })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blazen",
3
- "version": "0.1.152",
3
+ "version": "0.1.154",
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,27 +35,41 @@
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",
42
- "@biomejs/biome": "^2"
43
+ "@biomejs/biome": "^2",
44
+ "ava": "^6.4.1"
43
45
  },
44
46
  "engines": {
45
47
  "node": ">= 18"
46
48
  },
49
+ "ava": {
50
+ "files": [
51
+ "../../tests/node/test_*.mjs"
52
+ ],
53
+ "extensions": [
54
+ "mjs"
55
+ ],
56
+ "timeout": "120s",
57
+ "concurrency": 4,
58
+ "verbose": true
59
+ },
47
60
  "optionalDependencies": {
48
- "@blazen-dev/blazen-linux-x64-gnu": "0.1.152",
49
- "@blazen-dev/blazen-linux-x64-musl": "0.1.152",
50
- "@blazen-dev/blazen-linux-arm64-gnu": "0.1.152",
51
- "@blazen-dev/blazen-linux-arm64-musl": "0.1.152",
52
- "@blazen-dev/blazen-darwin-arm64": "0.1.152",
53
- "@blazen-dev/blazen-win32-x64-msvc": "0.1.152"
61
+ "@blazen-dev/blazen-linux-x64-gnu": "0.1.154",
62
+ "@blazen-dev/blazen-linux-x64-musl": "0.1.154",
63
+ "@blazen-dev/blazen-linux-arm64-gnu": "0.1.154",
64
+ "@blazen-dev/blazen-linux-arm64-musl": "0.1.154",
65
+ "@blazen-dev/blazen-darwin-arm64": "0.1.154",
66
+ "@blazen-dev/blazen-win32-x64-msvc": "0.1.154"
54
67
  },
55
68
  "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",
58
- "test": "node --test ../../tests/node/test_workflow.mjs",
59
- "test:smoke": "node --test ../../tests/node/test_llm_smoke.mjs"
69
+ "build": "napi build --release --platform --features local-all,langfuse --js index.js && node scripts/post-build.mjs",
70
+ "build:debug": "napi build --platform --features local-all,langfuse --js index.js && node scripts/post-build.mjs",
71
+ "test": "ava",
72
+ "test:workflow": "ava ../../tests/node/test_workflow.mjs",
73
+ "test:smoke": "ava ../../tests/node/test_llm_smoke.mjs"
60
74
  }
61
75
  }