blazen 0.1.153 → 0.1.155
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/index.d.ts +749 -14
- package/index.js +30 -0
- package/package.json +23 -10
package/index.d.ts
CHANGED
|
@@ -2612,7 +2612,7 @@ export type JsModelCache = ModelCache
|
|
|
2612
2612
|
*
|
|
2613
2613
|
* ```javascript
|
|
2614
2614
|
* const manager = new ModelManager({ budgetGb: 8.0 });
|
|
2615
|
-
* await manager.register("llama-7b", model,
|
|
2615
|
+
* await manager.register("llama-7b", model, 4_000_000_000n); // BigInt
|
|
2616
2616
|
* await manager.load("llama-7b");
|
|
2617
2617
|
* ```
|
|
2618
2618
|
*/
|
|
@@ -2625,15 +2625,50 @@ export declare class ModelManager {
|
|
|
2625
2625
|
*/
|
|
2626
2626
|
constructor(config: ModelManagerConfig)
|
|
2627
2627
|
/**
|
|
2628
|
-
* Register a model with the manager.
|
|
2628
|
+
* Register a `CompletionModel`-backed local model with the manager.
|
|
2629
2629
|
*
|
|
2630
2630
|
* The model starts in the unloaded state. An optional
|
|
2631
2631
|
* `vramEstimateBytes` overrides the model's self-reported estimate.
|
|
2632
2632
|
*
|
|
2633
2633
|
* Only local in-process providers (mistral.rs, llama.cpp, candle) can be
|
|
2634
|
-
* registered -- remote HTTP providers will throw.
|
|
2634
|
+
* registered -- remote HTTP providers will throw. To register an
|
|
2635
|
+
* arbitrary JS-managed resource (embedding model, tokenizer, custom
|
|
2636
|
+
* runtime, …), use [`Self::register_local_model`] instead.
|
|
2635
2637
|
*/
|
|
2636
|
-
register(id: string, model: JsCompletionModel, vramEstimateBytes?:
|
|
2638
|
+
register(id: string, model: JsCompletionModel, vramEstimateBytes?: bigint | undefined | null): Promise<void>
|
|
2639
|
+
/**
|
|
2640
|
+
* Register an arbitrary JS-managed local model with the manager.
|
|
2641
|
+
*
|
|
2642
|
+
* Unlike [`Self::register`] -- which expects a [`JsCompletionModel`]
|
|
2643
|
+
* backed by an in-process provider -- this entrypoint takes raw
|
|
2644
|
+
* lifecycle callbacks. The manager will invoke `load()` when the model
|
|
2645
|
+
* is brought into VRAM (potentially after evicting an LRU peer) and
|
|
2646
|
+
* `unload()` when it is evicted or explicitly released.
|
|
2647
|
+
*
|
|
2648
|
+
* Both callbacks must return a `Promise<void>` (or be `async`). A
|
|
2649
|
+
* rejection from `load()` aborts the load operation; a rejection from
|
|
2650
|
+
* `unload()` is propagated as a manager error.
|
|
2651
|
+
*
|
|
2652
|
+
* `isLoaded()` is optional: when omitted, the manager's own
|
|
2653
|
+
* loaded-flag bookkeeping is the source of truth.
|
|
2654
|
+
* `vramEstimateBytes` reports the model's footprint so the manager
|
|
2655
|
+
* can enforce the global budget; defaults to `0` when not provided.
|
|
2656
|
+
*
|
|
2657
|
+
* ```javascript
|
|
2658
|
+
* let loaded = false;
|
|
2659
|
+
* await manager.registerLocalModel(
|
|
2660
|
+
* "my-resource",
|
|
2661
|
+
* async () => { /* materialize *\/ loaded = true; },
|
|
2662
|
+
* async () => { /* release *\/ loaded = false; },
|
|
2663
|
+
* async () => loaded,
|
|
2664
|
+
* 2_000_000_000n,
|
|
2665
|
+
* );
|
|
2666
|
+
* ```
|
|
2667
|
+
*
|
|
2668
|
+
* `isLoaded` is `null`-able (pass `null` or `undefined` to omit) and
|
|
2669
|
+
* `vramEstimateBytes` may also be omitted.
|
|
2670
|
+
*/
|
|
2671
|
+
registerLocalModel(id: string, load: LifecycleTsfn, unload: LifecycleTsfn, isLoaded?: IsLoadedTsfn | undefined | null, vramEstimateBytes?: bigint | undefined | null): Promise<void>
|
|
2637
2672
|
/**
|
|
2638
2673
|
* Load a model, evicting LRU models if the budget would be exceeded.
|
|
2639
2674
|
*
|
|
@@ -2657,9 +2692,9 @@ export declare class ModelManager {
|
|
|
2657
2692
|
*/
|
|
2658
2693
|
ensureLoaded(id: string): Promise<void>
|
|
2659
2694
|
/** Total VRAM currently used by loaded models (in bytes). */
|
|
2660
|
-
usedBytes(): Promise<
|
|
2695
|
+
usedBytes(): Promise<bigint>
|
|
2661
2696
|
/** Available VRAM within the budget (in bytes). */
|
|
2662
|
-
availableBytes(): Promise<
|
|
2697
|
+
availableBytes(): Promise<bigint>
|
|
2663
2698
|
/** Status of all registered models. */
|
|
2664
2699
|
status(): Promise<Array<JsModelStatus>>
|
|
2665
2700
|
}
|
|
@@ -2719,6 +2754,21 @@ export declare class MusicProvider {
|
|
|
2719
2754
|
}
|
|
2720
2755
|
export type JsMusicProvider = MusicProvider
|
|
2721
2756
|
|
|
2757
|
+
/**
|
|
2758
|
+
* A no-op emitter that drops every event.
|
|
2759
|
+
*
|
|
2760
|
+
* Useful as a default when no downstream observer is wired up:
|
|
2761
|
+
*
|
|
2762
|
+
* ```javascript
|
|
2763
|
+
* const model = new UsageRecordingCompletionModel(base, new NoopUsageEmitter(), "openai");
|
|
2764
|
+
* ```
|
|
2765
|
+
*/
|
|
2766
|
+
export declare class NoopUsageEmitter {
|
|
2767
|
+
/** Construct a no-op emitter. */
|
|
2768
|
+
constructor()
|
|
2769
|
+
}
|
|
2770
|
+
export type JsNoopUsageEmitter = NoopUsageEmitter
|
|
2771
|
+
|
|
2722
2772
|
/**
|
|
2723
2773
|
* An `OpenAI`-compatible embedding model (Together, Cohere, Fireworks).
|
|
2724
2774
|
*
|
|
@@ -2873,6 +2923,37 @@ export declare class ParallelStage {
|
|
|
2873
2923
|
}
|
|
2874
2924
|
export type JsParallelStage = ParallelStage
|
|
2875
2925
|
|
|
2926
|
+
/**
|
|
2927
|
+
* Fan out into multiple parallel sub-workflow branches.
|
|
2928
|
+
*
|
|
2929
|
+
* Each branch is a `SubWorkflowStep` that runs concurrently. The
|
|
2930
|
+
* `joinStrategy` controls whether the parent waits for all branches
|
|
2931
|
+
* (`JoinStrategy.WaitAll`) or only the first to complete
|
|
2932
|
+
* (`JoinStrategy.FirstCompletes`).
|
|
2933
|
+
*/
|
|
2934
|
+
export declare class ParallelSubWorkflowsStep {
|
|
2935
|
+
/**
|
|
2936
|
+
* Create a parallel sub-workflow fan-out step.
|
|
2937
|
+
*
|
|
2938
|
+
* `branches` is an array of already-constructed `SubWorkflowStep`
|
|
2939
|
+
* instances. The branches' inner workflows are captured by reference
|
|
2940
|
+
* so the parent step keeps a stable view even if the originals are
|
|
2941
|
+
* dropped from JS.
|
|
2942
|
+
*
|
|
2943
|
+
* `joinStrategy` defaults to `JoinStrategy.WaitAll`.
|
|
2944
|
+
*/
|
|
2945
|
+
constructor(name: string, accepts: Array<string>, emits: Array<string>, branches: Array<SubWorkflowStep>, joinStrategy?: JoinStrategy | undefined | null)
|
|
2946
|
+
/** The step name. */
|
|
2947
|
+
get name(): string
|
|
2948
|
+
/** Event type identifiers this step accepts. */
|
|
2949
|
+
get accepts(): Array<string>
|
|
2950
|
+
/** Event type identifiers this step may emit. */
|
|
2951
|
+
get emits(): Array<string>
|
|
2952
|
+
/** The join strategy used to combine branch results. */
|
|
2953
|
+
get joinStrategy(): JoinStrategy
|
|
2954
|
+
}
|
|
2955
|
+
export type JsParallelSubWorkflowsStep = ParallelSubWorkflowsStep
|
|
2956
|
+
|
|
2876
2957
|
/** A Perplexity chat completion provider. */
|
|
2877
2958
|
export declare class PerplexityProvider {
|
|
2878
2959
|
/** Create a new Perplexity provider. */
|
|
@@ -2897,6 +2978,12 @@ export declare class Pipeline {
|
|
|
2897
2978
|
* Consumes the pipeline -- calling start/resume a second time errors.
|
|
2898
2979
|
*/
|
|
2899
2980
|
start(input: any): Promise<PipelineHandler>
|
|
2981
|
+
/**
|
|
2982
|
+
* Inspect the pipeline-level default retry configuration, if any.
|
|
2983
|
+
* Mirrors [`blazen_pipeline::Pipeline::retry_config`] (Wave 2).
|
|
2984
|
+
* Returns `null` after the pipeline has been consumed.
|
|
2985
|
+
*/
|
|
2986
|
+
retryConfig(): JsRetryConfig | null
|
|
2900
2987
|
/**
|
|
2901
2988
|
* Resume the pipeline from a previously captured snapshot.
|
|
2902
2989
|
* Consumes the pipeline.
|
|
@@ -2914,6 +3001,31 @@ export declare class PipelineBuilder {
|
|
|
2914
3001
|
parallel(parallel: JsParallelStage): this
|
|
2915
3002
|
/** Set a per-stage timeout in seconds. Each stage's workflow gets this duration. */
|
|
2916
3003
|
timeoutPerStage(seconds: number): this
|
|
3004
|
+
/**
|
|
3005
|
+
* Set a total wall-clock timeout for the entire pipeline run, in
|
|
3006
|
+
* seconds. When the pipeline does not finish within this duration the
|
|
3007
|
+
* run is cancelled with a `PipelineError::Timeout`. Default is no
|
|
3008
|
+
* total timeout. Mirrors [`blazen_pipeline::PipelineBuilder::total_timeout`].
|
|
3009
|
+
*/
|
|
3010
|
+
totalTimeout(seconds: number): this
|
|
3011
|
+
/** Disable the total-pipeline timeout (default). */
|
|
3012
|
+
noTotalTimeout(): this
|
|
3013
|
+
/**
|
|
3014
|
+
* Set a default retry configuration applied to every LLM call inside
|
|
3015
|
+
* the pipeline. Workflow / step / per-call overrides take precedence.
|
|
3016
|
+
* Mirrors [`blazen_pipeline::PipelineBuilder::retry_config`].
|
|
3017
|
+
*/
|
|
3018
|
+
retryConfig(config: JsRetryConfig): this
|
|
3019
|
+
/**
|
|
3020
|
+
* Disable pipeline-level retries (`maxRetries = 0`). Workflow / step /
|
|
3021
|
+
* per-call overrides still take precedence.
|
|
3022
|
+
*/
|
|
3023
|
+
noRetry(): this
|
|
3024
|
+
/**
|
|
3025
|
+
* Clear any pipeline-level retry config; LLM calls fall through to
|
|
3026
|
+
* workflow / step / provider defaults.
|
|
3027
|
+
*/
|
|
3028
|
+
clearRetryConfig(): this
|
|
2917
3029
|
/**
|
|
2918
3030
|
* Register a persist callback that receives a typed `PipelineSnapshot`
|
|
2919
3031
|
* after each stage completes.
|
|
@@ -2954,6 +3066,13 @@ export declare class PipelineHandler {
|
|
|
2954
3066
|
resumeInPlace(): Promise<void>
|
|
2955
3067
|
/** Capture a snapshot without stopping the pipeline. */
|
|
2956
3068
|
snapshot(): Promise<JsPipelineSnapshot>
|
|
3069
|
+
/**
|
|
3070
|
+
* Best-effort polled view of the pipeline's stage cursor. Mirrors
|
|
3071
|
+
* [`blazen_pipeline::PipelineHandler::progress`].
|
|
3072
|
+
*
|
|
3073
|
+
* Returns `null` after [`Self::result`] has consumed the handler.
|
|
3074
|
+
*/
|
|
3075
|
+
progress(): Promise<JsProgressSnapshot | null>
|
|
2957
3076
|
/** Abort the pipeline. */
|
|
2958
3077
|
abort(): Promise<void>
|
|
2959
3078
|
/**
|
|
@@ -2971,6 +3090,16 @@ export declare class PipelineResult {
|
|
|
2971
3090
|
get finalOutput(): any
|
|
2972
3091
|
get stageResults(): Array<StageResult>
|
|
2973
3092
|
get sharedState(): any
|
|
3093
|
+
/**
|
|
3094
|
+
* Aggregated token usage across the pipeline run. Mirrors
|
|
3095
|
+
* [`blazen_pipeline::PipelineResult::usage_total`] (Wave 3).
|
|
3096
|
+
*/
|
|
3097
|
+
get usageTotal(): JsTokenUsageClass
|
|
3098
|
+
/**
|
|
3099
|
+
* Aggregated cost in USD across the pipeline run. Mirrors
|
|
3100
|
+
* [`blazen_pipeline::PipelineResult::cost_total_usd`] (Wave 3).
|
|
3101
|
+
*/
|
|
3102
|
+
get costTotalUsd(): number
|
|
2974
3103
|
}
|
|
2975
3104
|
export type JsPipelineResult = PipelineResult
|
|
2976
3105
|
|
|
@@ -3337,6 +3466,34 @@ export declare class RetryCompletionModel {
|
|
|
3337
3466
|
}
|
|
3338
3467
|
export type JsRetryCompletionModel = RetryCompletionModel
|
|
3339
3468
|
|
|
3469
|
+
/**
|
|
3470
|
+
* A `MemoryBackend` decorator that retries transient errors with
|
|
3471
|
+
* exponential backoff.
|
|
3472
|
+
*
|
|
3473
|
+
* Mirrors `RetryCompletionModel` for `MemoryBackend`. Use one of the
|
|
3474
|
+
* `wrapInMemory` / `wrapJsonl` / `wrapValkey` factories to wrap the
|
|
3475
|
+
* matching backend.
|
|
3476
|
+
*
|
|
3477
|
+
* ```javascript
|
|
3478
|
+
* const inner = new InMemoryBackend();
|
|
3479
|
+
* const retried = RetryMemoryBackend.wrapInMemory(inner, { maxRetries: 5 });
|
|
3480
|
+
* ```
|
|
3481
|
+
*/
|
|
3482
|
+
export declare class RetryMemoryBackend {
|
|
3483
|
+
/** Wrap an `InMemoryBackend` with retry-on-transient-error behaviour. */
|
|
3484
|
+
static wrapInMemory(backend: InMemoryBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
3485
|
+
/** Wrap a `JsonlBackend` with retry-on-transient-error behaviour. */
|
|
3486
|
+
static wrapJsonl(backend: JsonlBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
3487
|
+
/** Wrap a `ValkeyBackend` with retry-on-transient-error behaviour. */
|
|
3488
|
+
static wrapValkey(backend: ValkeyBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
3489
|
+
/**
|
|
3490
|
+
* Generic factory accepting any of the three concrete backends. Useful
|
|
3491
|
+
* when the caller doesn't statically know which backend is in hand.
|
|
3492
|
+
*/
|
|
3493
|
+
static wrap(backend: AnyBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
3494
|
+
}
|
|
3495
|
+
export type JsRetryMemoryBackend = RetryMemoryBackend
|
|
3496
|
+
|
|
3340
3497
|
/**
|
|
3341
3498
|
* Built-in middleware that wraps the inner model with retry-on-transient-
|
|
3342
3499
|
* error behaviour. Equivalent to constructing a
|
|
@@ -3525,6 +3682,17 @@ export declare class StageResult {
|
|
|
3525
3682
|
get output(): any
|
|
3526
3683
|
get skipped(): boolean
|
|
3527
3684
|
get durationMs(): number
|
|
3685
|
+
/**
|
|
3686
|
+
* Token usage for this stage, if any LLM calls inside the stage
|
|
3687
|
+
* emitted [`UsageEvent`](blazen_events::UsageEvent)s. Mirrors
|
|
3688
|
+
* [`blazen_pipeline::StageResult::usage`] (Wave 3).
|
|
3689
|
+
*/
|
|
3690
|
+
get usage(): JsTokenUsageClass | null
|
|
3691
|
+
/**
|
|
3692
|
+
* Cost in USD for this stage, if known. Mirrors
|
|
3693
|
+
* [`blazen_pipeline::StageResult::cost_usd`] (Wave 3).
|
|
3694
|
+
*/
|
|
3695
|
+
get costUsd(): number | null
|
|
3528
3696
|
}
|
|
3529
3697
|
export type JsStageResult = StageResult
|
|
3530
3698
|
|
|
@@ -3774,6 +3942,41 @@ export declare class StructuredOutput {
|
|
|
3774
3942
|
}
|
|
3775
3943
|
export type JsStructuredOutput = StructuredOutput
|
|
3776
3944
|
|
|
3945
|
+
/**
|
|
3946
|
+
* A workflow step that delegates to another `Workflow`.
|
|
3947
|
+
*
|
|
3948
|
+
* The parent workflow's event loop spawns the child via `Workflow.run()`,
|
|
3949
|
+
* converts the parent event to JSON for the child's input, and wraps the
|
|
3950
|
+
* child's terminal `StopEvent.result` into a `DynamicEvent` named
|
|
3951
|
+
* `"<stepName>::output"` for the parent.
|
|
3952
|
+
*
|
|
3953
|
+
* ```javascript
|
|
3954
|
+
* const child = new Workflow("enrich");
|
|
3955
|
+
* child.addStep("enrich", ["blazen::StartEvent"], async (ev) => ({ type: "blazen::StopEvent", result: { ok: true } }));
|
|
3956
|
+
* const step = new SubWorkflowStep("enrich", ["blazen::StartEvent"], ["enrich::output"], child);
|
|
3957
|
+
* const parent = new Workflow("parent");
|
|
3958
|
+
* parent.addSubworkflowStepObj(step);
|
|
3959
|
+
* ```
|
|
3960
|
+
*/
|
|
3961
|
+
export declare class SubWorkflowStep {
|
|
3962
|
+
/**
|
|
3963
|
+
* Create a sub-workflow step.
|
|
3964
|
+
*
|
|
3965
|
+
* `name` / `accepts` / `emits` describe routing. `inner` is the child
|
|
3966
|
+
* workflow whose event loop is spawned for each parent dispatch. The
|
|
3967
|
+
* inner workflow is cloned (and built) at construction time so this
|
|
3968
|
+
* step instance can be reused across builders.
|
|
3969
|
+
*/
|
|
3970
|
+
constructor(name: string, accepts: Array<string>, emits: Array<string>, inner: JsWorkflow, timeoutSecs?: number | undefined | null, retryConfig?: JsRetryConfig | undefined | null)
|
|
3971
|
+
/** The step name. */
|
|
3972
|
+
get name(): string
|
|
3973
|
+
/** Event type identifiers this step accepts. */
|
|
3974
|
+
get accepts(): Array<string>
|
|
3975
|
+
/** Event type identifiers this step may emit. */
|
|
3976
|
+
get emits(): Array<string>
|
|
3977
|
+
}
|
|
3978
|
+
export type JsSubWorkflowStep = SubWorkflowStep
|
|
3979
|
+
|
|
3777
3980
|
/**
|
|
3778
3981
|
* r" Base class for 3D model generation providers.
|
|
3779
3982
|
* r"
|
|
@@ -4113,9 +4316,93 @@ export declare class TypedTool {
|
|
|
4113
4316
|
get description(): string
|
|
4114
4317
|
/** The JSON Schema parameter definition. */
|
|
4115
4318
|
get parameters(): any
|
|
4319
|
+
/**
|
|
4320
|
+
* Whether this tool is marked as an "exit" tool, signalling the agent
|
|
4321
|
+
* loop to stop after it runs. Mirrors
|
|
4322
|
+
* [`blazen_llm::Tool::is_exit`] (Wave 6).
|
|
4323
|
+
*/
|
|
4324
|
+
get isExit(): boolean
|
|
4325
|
+
/**
|
|
4326
|
+
* Builder-style toggle for the exit-tool marker. Returns a new
|
|
4327
|
+
* [`JsTypedTool`] that shares the same underlying handler but
|
|
4328
|
+
* reports the requested [`Tool::is_exit`] value. Mirrors
|
|
4329
|
+
* [`blazen_llm::TypedTool::exit_tool`] (Wave 6).
|
|
4330
|
+
*
|
|
4331
|
+
* ```typescript
|
|
4332
|
+
* const exit = new TypedTool(
|
|
4333
|
+
* "submit",
|
|
4334
|
+
* "Submit the final answer and exit",
|
|
4335
|
+
* { type: "object", properties: { answer: { type: "string" } }, required: ["answer"] },
|
|
4336
|
+
* async (_n, args) => ({ submitted: args.answer }),
|
|
4337
|
+
* ).exitTool(true);
|
|
4338
|
+
* ```
|
|
4339
|
+
*/
|
|
4340
|
+
exitTool(exit: boolean): TypedTool
|
|
4116
4341
|
}
|
|
4117
4342
|
export type JsTypedTool = TypedTool
|
|
4118
4343
|
|
|
4344
|
+
/**
|
|
4345
|
+
* A sink for emitted [`JsUsageEvent`]s.
|
|
4346
|
+
*
|
|
4347
|
+
* Construct with a JS callback that handles each event. The callback runs
|
|
4348
|
+
* on the libuv main thread, so it can do anything synchronous; a thrown
|
|
4349
|
+
* error is caught and logged, never propagated into the completion call.
|
|
4350
|
+
*
|
|
4351
|
+
* ```javascript
|
|
4352
|
+
* const events: UsageEvent[] = [];
|
|
4353
|
+
* const emitter = new UsageEmitter((event) => { events.push(event); });
|
|
4354
|
+
* const model = new UsageRecordingCompletionModel(base, emitter, "openai");
|
|
4355
|
+
* ```
|
|
4356
|
+
*/
|
|
4357
|
+
export declare class UsageEmitter {
|
|
4358
|
+
/**
|
|
4359
|
+
* Create an emitter from a JS callback. The callback is invoked once
|
|
4360
|
+
* per emitted event.
|
|
4361
|
+
*/
|
|
4362
|
+
constructor(callback: ((arg: UsageEvent) => void))
|
|
4363
|
+
}
|
|
4364
|
+
export type JsUsageEmitter = UsageEmitter
|
|
4365
|
+
|
|
4366
|
+
/**
|
|
4367
|
+
* A `CompletionModel` decorator that emits a `UsageEvent` after each
|
|
4368
|
+
* successful `complete` call. Mirrors
|
|
4369
|
+
* `blazen_llm::usage_recording::UsageRecordingCompletionModel`.
|
|
4370
|
+
*
|
|
4371
|
+
* ```javascript
|
|
4372
|
+
* const base = CompletionModel.openai();
|
|
4373
|
+
* const events = [];
|
|
4374
|
+
* const emitter = new UsageEmitter((e) => events.push(e));
|
|
4375
|
+
* const model = new UsageRecordingCompletionModel(base, emitter, "openai");
|
|
4376
|
+
* const response = await model.complete([ChatMessage.user("hi")]);
|
|
4377
|
+
* ```
|
|
4378
|
+
*/
|
|
4379
|
+
export declare class UsageRecordingCompletionModel {
|
|
4380
|
+
/** Wrap a `CompletionModel` with a usage-recording layer. */
|
|
4381
|
+
constructor(model: CompletionModel, emitter: AnyEmitter, providerLabel: string, runId?: string | undefined | null)
|
|
4382
|
+
/** The underlying provider's model id. */
|
|
4383
|
+
get modelId(): string
|
|
4384
|
+
/**
|
|
4385
|
+
* Convert this decorator into a `CompletionModel` so it can be passed to
|
|
4386
|
+
* APIs that expect the base type (`runAgent`, further decorators, …).
|
|
4387
|
+
*/
|
|
4388
|
+
toCompletionModel(): CompletionModel
|
|
4389
|
+
}
|
|
4390
|
+
export type JsUsageRecordingCompletionModel = UsageRecordingCompletionModel
|
|
4391
|
+
|
|
4392
|
+
/**
|
|
4393
|
+
* An `EmbeddingModel` decorator that emits a `UsageEvent` after each
|
|
4394
|
+
* successful `embed` call.
|
|
4395
|
+
*/
|
|
4396
|
+
export declare class UsageRecordingEmbeddingModel {
|
|
4397
|
+
/** Wrap an `EmbeddingModel` with a usage-recording layer. */
|
|
4398
|
+
constructor(model: EmbeddingModel, emitter: AnyEmitter, providerLabel: string, runId?: string | undefined | null)
|
|
4399
|
+
/** The underlying provider's model id. */
|
|
4400
|
+
get modelId(): string
|
|
4401
|
+
/** Output dimensionality. */
|
|
4402
|
+
get dimensions(): number
|
|
4403
|
+
}
|
|
4404
|
+
export type JsUsageRecordingEmbeddingModel = UsageRecordingEmbeddingModel
|
|
4405
|
+
|
|
4119
4406
|
/**
|
|
4120
4407
|
* A Valkey/Redis-backed backend for the memory store.
|
|
4121
4408
|
*
|
|
@@ -4307,6 +4594,45 @@ export declare class Workflow {
|
|
|
4307
4594
|
* started, step completed, step failed). Defaults to `false`.
|
|
4308
4595
|
*/
|
|
4309
4596
|
setAutoPublishEvents(enabled: boolean): void
|
|
4597
|
+
/**
|
|
4598
|
+
* Register a sub-workflow step that delegates to another `Workflow`.
|
|
4599
|
+
* Mirrors [`blazen_core::WorkflowBuilder::add_subworkflow_step`].
|
|
4600
|
+
*
|
|
4601
|
+
* - `name`: human-readable step name.
|
|
4602
|
+
* - `accepts`: array of event type strings this step handles.
|
|
4603
|
+
* - `emits`: array of event type strings this step may emit (informational).
|
|
4604
|
+
* - `inner`: the child `Workflow` to run.
|
|
4605
|
+
* - `timeoutSecs`: optional wall-clock timeout for the child run.
|
|
4606
|
+
* - `retryConfig`: optional retry policy for the child run.
|
|
4607
|
+
*/
|
|
4608
|
+
addSubworkflowStep(name: string, accepts: Array<string>, emits: Array<string>, inner: Workflow, timeoutSecs?: number | undefined | null, retryConfig?: JsRetryConfig | undefined | null): void
|
|
4609
|
+
/**
|
|
4610
|
+
* Register a parallel sub-workflows fan-out step. Mirrors
|
|
4611
|
+
* [`blazen_core::WorkflowBuilder::add_parallel_subworkflows`].
|
|
4612
|
+
*
|
|
4613
|
+
* `branchSpecs` and `branchWorkflows` are parallel arrays of equal
|
|
4614
|
+
* length: each `(spec, wf)` pair becomes one branch. They're split
|
|
4615
|
+
* into two parameters because napi-rs cannot embed napi-class values
|
|
4616
|
+
* (the `Workflow` instances) inside `#[napi(object)]` shapes.
|
|
4617
|
+
*
|
|
4618
|
+
* `joinStrategy` defaults to `WaitAll`.
|
|
4619
|
+
*/
|
|
4620
|
+
addParallelSubworkflows(name: string, accepts: Array<string>, emits: Array<string>, branchSpecs: Array<SubWorkflowBranchSpec>, branchWorkflows: Array<Workflow>, joinStrategy?: JoinStrategy | undefined | null): void
|
|
4621
|
+
/**
|
|
4622
|
+
* Register a pre-built [`SubWorkflowStep`] wrapper.
|
|
4623
|
+
*
|
|
4624
|
+
* Object-form of [`Self::add_subworkflow_step`]: the same step instance
|
|
4625
|
+
* can be reused across multiple workflows since its inner child
|
|
4626
|
+
* workflow is captured in `Arc` form at construction time.
|
|
4627
|
+
*/
|
|
4628
|
+
addSubworkflowStepObj(step: SubWorkflowStep): void
|
|
4629
|
+
/**
|
|
4630
|
+
* Register a pre-built [`ParallelSubWorkflowsStep`] wrapper.
|
|
4631
|
+
*
|
|
4632
|
+
* Object-form of [`Self::add_parallel_subworkflows`]: lifts the
|
|
4633
|
+
* awkward parallel-arrays signature into a single class instance.
|
|
4634
|
+
*/
|
|
4635
|
+
addParallelSubworkflowsObj(step: ParallelSubWorkflowsStep): void
|
|
4310
4636
|
/**
|
|
4311
4637
|
* Add a step to the workflow.
|
|
4312
4638
|
*
|
|
@@ -4462,6 +4788,31 @@ export declare class WorkflowBuilder {
|
|
|
4462
4788
|
* `SessionPausePolicy.PickleOrError`.
|
|
4463
4789
|
*/
|
|
4464
4790
|
sessionPausePolicy(policy: SessionPausePolicy): this
|
|
4791
|
+
/**
|
|
4792
|
+
* Set a per-step wall-clock timeout in seconds on the most-recently
|
|
4793
|
+
* added step. Mirrors [`blazen_core::WorkflowBuilder::step_timeout`].
|
|
4794
|
+
* Errors if no step has been registered yet.
|
|
4795
|
+
*/
|
|
4796
|
+
stepTimeout(seconds: number): this
|
|
4797
|
+
/** Clear the per-step timeout on the most-recently added step. */
|
|
4798
|
+
noStepTimeout(): this
|
|
4799
|
+
/**
|
|
4800
|
+
* Set a per-step retry config on the most-recently added step.
|
|
4801
|
+
* Mirrors [`blazen_core::WorkflowBuilder::step_retry`].
|
|
4802
|
+
*/
|
|
4803
|
+
stepRetry(config: JsRetryConfig): this
|
|
4804
|
+
/** Disable retries on the most-recently added step (`maxRetries = 0`). */
|
|
4805
|
+
noStepRetry(): this
|
|
4806
|
+
/**
|
|
4807
|
+
* Set a workflow-level default retry config. Step / per-call
|
|
4808
|
+
* overrides take precedence; pipeline / provider defaults take
|
|
4809
|
+
* lower precedence.
|
|
4810
|
+
*/
|
|
4811
|
+
retryConfig(config: JsRetryConfig): this
|
|
4812
|
+
/** Disable workflow-level retries (`maxRetries = 0`). */
|
|
4813
|
+
noRetry(): this
|
|
4814
|
+
/** Clear any workflow-level retry config. */
|
|
4815
|
+
clearRetryConfig(): this
|
|
4465
4816
|
/**
|
|
4466
4817
|
* Enable history collection.
|
|
4467
4818
|
*
|
|
@@ -4611,6 +4962,19 @@ export declare class WorkflowHandler {
|
|
|
4611
4962
|
* they may have built earlier.
|
|
4612
4963
|
*/
|
|
4613
4964
|
respondToInputTyped(event: InputResponseEvent): Promise<void>
|
|
4965
|
+
/**
|
|
4966
|
+
* Aggregated token usage across the workflow run so far.
|
|
4967
|
+
*
|
|
4968
|
+
* Mirrors [`blazen_core::WorkflowHandler::usage_total`]. Returns
|
|
4969
|
+
* `null` after the handler has been consumed by [`Self::result`].
|
|
4970
|
+
*/
|
|
4971
|
+
usageTotal(): Promise<TokenUsage | null>
|
|
4972
|
+
/**
|
|
4973
|
+
* Aggregated cost in USD across the workflow run so far. Mirrors
|
|
4974
|
+
* [`blazen_core::WorkflowHandler::cost_total_usd`]. Returns `null`
|
|
4975
|
+
* after the handler has been consumed by [`Self::result`].
|
|
4976
|
+
*/
|
|
4977
|
+
costTotalUsd(): Promise<number | null>
|
|
4614
4978
|
/** Abort the running workflow. */
|
|
4615
4979
|
abort(): Promise<void>
|
|
4616
4980
|
/**
|
|
@@ -4731,6 +5095,19 @@ export declare class XaiProvider {
|
|
|
4731
5095
|
}
|
|
4732
5096
|
export type JsXaiProvider = XaiProvider
|
|
4733
5097
|
|
|
5098
|
+
/**
|
|
5099
|
+
* Aggregate one [`JsUsageEvent`] into a [`crate::types::JsTokenUsageClass`].
|
|
5100
|
+
* Returns a fresh class instance that adds the seven token counters from the
|
|
5101
|
+
* event into the existing usage. Mirrors the Rust `TokenUsage::add` /
|
|
5102
|
+
* `PipelineState::record_usage` flow at the JS layer.
|
|
5103
|
+
*
|
|
5104
|
+
* # Errors
|
|
5105
|
+
*
|
|
5106
|
+
* Currently never returns an error; the [`Result`] return is reserved for
|
|
5107
|
+
* future validation (e.g. parsing the `runId` UUID).
|
|
5108
|
+
*/
|
|
5109
|
+
export declare function addUsageToTokenUsage(base: JsTokenUsageClass, event: UsageEvent): JsTokenUsageClass
|
|
5110
|
+
|
|
4734
5111
|
/**
|
|
4735
5112
|
* Typed configuration for the agentic tool execution loop.
|
|
4736
5113
|
*
|
|
@@ -4742,8 +5119,23 @@ export type JsXaiProvider = XaiProvider
|
|
|
4742
5119
|
export interface AgentConfig {
|
|
4743
5120
|
/** Maximum number of tool call rounds before forcing a stop. */
|
|
4744
5121
|
maxIterations: number
|
|
4745
|
-
/**
|
|
5122
|
+
/**
|
|
5123
|
+
* Whether to add the legacy implicit "finish" tool the model can call
|
|
5124
|
+
* to exit early.
|
|
5125
|
+
*/
|
|
4746
5126
|
addFinishTool: boolean
|
|
5127
|
+
/**
|
|
5128
|
+
* Suppress automatic registration of the built-in `finish_workflow`
|
|
5129
|
+
* exit tool. Default `false`. Mirrors
|
|
5130
|
+
* [`blazen_llm::AgentConfig::no_finish_tool`] (Wave 6).
|
|
5131
|
+
*/
|
|
5132
|
+
noFinishTool: boolean
|
|
5133
|
+
/**
|
|
5134
|
+
* Override the name of the built-in `finish_workflow` tool. `null`
|
|
5135
|
+
* uses the canonical [`crate::agent::FINISH_WORKFLOW_TOOL_NAME`].
|
|
5136
|
+
* Mirrors [`blazen_llm::AgentConfig::finish_tool_name`] (Wave 6).
|
|
5137
|
+
*/
|
|
5138
|
+
finishToolName?: string
|
|
4747
5139
|
/** Optional system prompt prepended to messages. */
|
|
4748
5140
|
systemPrompt?: string
|
|
4749
5141
|
/** Sampling temperature. */
|
|
@@ -4948,6 +5340,14 @@ export interface CompletionRequest {
|
|
|
4948
5340
|
audioConfig?: any
|
|
4949
5341
|
}
|
|
4950
5342
|
|
|
5343
|
+
/**
|
|
5344
|
+
* Compute the cost in USD for an audio call (TTS / STT) given the model id
|
|
5345
|
+
* and the duration in seconds. Returns `null` when the model has no
|
|
5346
|
+
* `perSecond` pricing entry registered. Mirrors
|
|
5347
|
+
* [`blazen_llm::compute_audio_cost`].
|
|
5348
|
+
*/
|
|
5349
|
+
export declare function computeAudioCost(modelId: string, seconds: number): number | null
|
|
5350
|
+
|
|
4951
5351
|
/**
|
|
4952
5352
|
* Compute ELID-based similarity between two embedding vectors.
|
|
4953
5353
|
*
|
|
@@ -4965,6 +5365,18 @@ export declare function computeElidSimilarity(a: Array<number>, b: Array<number>
|
|
|
4965
5365
|
*/
|
|
4966
5366
|
export declare function computeEmbeddingSimhashSimilarity(a: Array<number>, b: Array<number>): number
|
|
4967
5367
|
|
|
5368
|
+
/**
|
|
5369
|
+
* Compute the cost in USD for an image-generation call given the model id
|
|
5370
|
+
* and the number of images returned. Returns `null` when the model has no
|
|
5371
|
+
* `perImage` pricing entry registered. Mirrors
|
|
5372
|
+
* [`blazen_llm::compute_image_cost`].
|
|
5373
|
+
*
|
|
5374
|
+
* ```javascript
|
|
5375
|
+
* const cost = computeImageCost("dall-e-3", 4);
|
|
5376
|
+
* ```
|
|
5377
|
+
*/
|
|
5378
|
+
export declare function computeImageCost(modelId: string, imageCount: number): number | null
|
|
5379
|
+
|
|
4968
5380
|
/**
|
|
4969
5381
|
* Compute similarity between two text strings using 64-bit `SimHash`.
|
|
4970
5382
|
*
|
|
@@ -4973,6 +5385,14 @@ export declare function computeEmbeddingSimhashSimilarity(a: Array<number>, b: A
|
|
|
4973
5385
|
*/
|
|
4974
5386
|
export declare function computeTextSimhashSimilarity(a: string, b: string): number
|
|
4975
5387
|
|
|
5388
|
+
/**
|
|
5389
|
+
* Compute the cost in USD for a video-generation call given the model id
|
|
5390
|
+
* and the output duration in seconds. Returns `null` when the model has no
|
|
5391
|
+
* `perSecond` pricing entry registered. Mirrors
|
|
5392
|
+
* [`blazen_llm::compute_video_cost`].
|
|
5393
|
+
*/
|
|
5394
|
+
export declare function computeVideoCost(modelId: string, seconds: number): number | null
|
|
5395
|
+
|
|
4976
5396
|
/**
|
|
4977
5397
|
* Estimate the total token count for an array of chat messages.
|
|
4978
5398
|
*
|
|
@@ -4999,6 +5419,9 @@ export interface CustomProviderOptions {
|
|
|
4999
5419
|
providerId?: string
|
|
5000
5420
|
}
|
|
5001
5421
|
|
|
5422
|
+
/** Build a default [`JsHttpClientConfig`] (60s request, 10s connect, no UA). */
|
|
5423
|
+
export declare function defaultHttpClientConfig(): HttpClientConfig
|
|
5424
|
+
|
|
5002
5425
|
/**
|
|
5003
5426
|
* Configuration for subclassed `EmbeddingModel` instances.
|
|
5004
5427
|
*
|
|
@@ -5097,6 +5520,30 @@ export interface FileContent {
|
|
|
5097
5520
|
filename?: string
|
|
5098
5521
|
}
|
|
5099
5522
|
|
|
5523
|
+
/**
|
|
5524
|
+
* Canonical name of the built-in `finish_workflow` exit tool. Mirrors
|
|
5525
|
+
* [`blazen_llm::FINISH_WORKFLOW_TOOL_NAME`].
|
|
5526
|
+
*/
|
|
5527
|
+
export const FINISH_WORKFLOW_TOOL_NAME: string
|
|
5528
|
+
|
|
5529
|
+
/**
|
|
5530
|
+
* Alias of [`finish_workflow_tool_def`] under the canonical Rust name
|
|
5531
|
+
* (`finish_workflow_tool` → `finishWorkflowTool` in JS). Returns a
|
|
5532
|
+
* `JsToolDef` for the built-in exit tool.
|
|
5533
|
+
*
|
|
5534
|
+
* Mirrors `blazen_llm::finish_workflow_tool` and `blazen-py`'s
|
|
5535
|
+
* `finish_workflow_tool()` for cross-binding parity.
|
|
5536
|
+
*/
|
|
5537
|
+
export declare function finishWorkflowTool(): JsToolDef
|
|
5538
|
+
|
|
5539
|
+
/**
|
|
5540
|
+
* Build a fresh JSON-Schema description of the built-in `finish_workflow`
|
|
5541
|
+
* exit tool. The shape mirrors [`blazen_llm::finish_workflow_tool`] —
|
|
5542
|
+
* callers that want to surface the same tool to a JS-side agent loop can
|
|
5543
|
+
* use this object as a [`JsToolDef`] entry.
|
|
5544
|
+
*/
|
|
5545
|
+
export declare function finishWorkflowToolDef(): JsToolDef
|
|
5546
|
+
|
|
5100
5547
|
/**
|
|
5101
5548
|
* Format the tail of a `ProviderHttp` error message, the same way
|
|
5102
5549
|
* `BlazenError::ProviderHttp` does internally.
|
|
@@ -5153,6 +5600,40 @@ export declare const enum HistoryEventKindTag {
|
|
|
5153
5600
|
WorkflowTimedOut = 'WorkflowTimedOut'
|
|
5154
5601
|
}
|
|
5155
5602
|
|
|
5603
|
+
/**
|
|
5604
|
+
* Configuration applied when constructing the default HTTP client.
|
|
5605
|
+
*
|
|
5606
|
+
* Mirrors [`HttpClientConfig`]. All fields are optional in JS — pass
|
|
5607
|
+
* `null` / `undefined` for any field to mean "no timeout / no UA
|
|
5608
|
+
* override".
|
|
5609
|
+
*
|
|
5610
|
+
* ```typescript
|
|
5611
|
+
* const cfg: HttpClientConfig = {
|
|
5612
|
+
* requestTimeoutMs: 30_000,
|
|
5613
|
+
* connectTimeoutMs: 5_000,
|
|
5614
|
+
* userAgent: "my-app/1.0",
|
|
5615
|
+
* };
|
|
5616
|
+
* const unlimited = HttpClientConfig.unlimited();
|
|
5617
|
+
* ```
|
|
5618
|
+
*/
|
|
5619
|
+
export interface HttpClientConfig {
|
|
5620
|
+
/**
|
|
5621
|
+
* Maximum wall-clock duration for a single request, in milliseconds.
|
|
5622
|
+
* `null` / `undefined` means unlimited.
|
|
5623
|
+
*/
|
|
5624
|
+
requestTimeoutMs?: number
|
|
5625
|
+
/**
|
|
5626
|
+
* Maximum duration for the connection-establishment phase, in
|
|
5627
|
+
* milliseconds. `null` / `undefined` means unlimited.
|
|
5628
|
+
*/
|
|
5629
|
+
connectTimeoutMs?: number
|
|
5630
|
+
/**
|
|
5631
|
+
* User-Agent header string. `null` / `undefined` uses the underlying
|
|
5632
|
+
* client's default.
|
|
5633
|
+
*/
|
|
5634
|
+
userAgent?: string
|
|
5635
|
+
}
|
|
5636
|
+
|
|
5156
5637
|
/**
|
|
5157
5638
|
* Initialize the Langfuse exporter and install it as a layer on the global
|
|
5158
5639
|
* `tracing` subscriber.
|
|
@@ -5252,10 +5733,22 @@ export interface JsAgentRunOptions {
|
|
|
5252
5733
|
/** Maximum tokens per completion call. */
|
|
5253
5734
|
maxTokens?: number
|
|
5254
5735
|
/**
|
|
5255
|
-
* Whether to add
|
|
5256
|
-
* signal it has a final answer.
|
|
5736
|
+
* Whether to add the legacy implicit "finish" tool the model can call
|
|
5737
|
+
* to signal it has a final answer.
|
|
5257
5738
|
*/
|
|
5258
5739
|
addFinishTool?: boolean
|
|
5740
|
+
/**
|
|
5741
|
+
* Suppress automatic registration of the built-in `finish_workflow`
|
|
5742
|
+
* exit tool (default `false`, i.e. it is auto-added). Mirrors
|
|
5743
|
+
* [`blazen_llm::AgentConfig::no_finish_tool`] (Wave 6).
|
|
5744
|
+
*/
|
|
5745
|
+
noFinishTool?: boolean
|
|
5746
|
+
/**
|
|
5747
|
+
* Override the name of the built-in `finish_workflow` tool. Defaults
|
|
5748
|
+
* to [`FINISH_WORKFLOW_TOOL_NAME`]. Mirrors
|
|
5749
|
+
* [`blazen_llm::AgentConfig::finish_tool_name`] (Wave 6).
|
|
5750
|
+
*/
|
|
5751
|
+
finishToolName?: string
|
|
5259
5752
|
/**
|
|
5260
5753
|
* Maximum number of tool calls to execute concurrently within a single
|
|
5261
5754
|
* model response. `0` means unlimited (all in parallel). Defaults to 0.
|
|
@@ -5319,6 +5812,8 @@ export interface JsAudioResult {
|
|
|
5319
5812
|
audio: Array<JsGeneratedAudio>
|
|
5320
5813
|
timing: JsRequestTiming
|
|
5321
5814
|
cost?: number
|
|
5815
|
+
usage?: JsTokenUsage
|
|
5816
|
+
audioSeconds?: number
|
|
5322
5817
|
metadata: any
|
|
5323
5818
|
}
|
|
5324
5819
|
|
|
@@ -5768,6 +6263,8 @@ export interface JsImageResult {
|
|
|
5768
6263
|
images: Array<JsGeneratedImage>
|
|
5769
6264
|
timing: JsRequestTiming
|
|
5770
6265
|
cost?: number
|
|
6266
|
+
usage?: JsTokenUsage
|
|
6267
|
+
imageCount?: number
|
|
5771
6268
|
metadata: any
|
|
5772
6269
|
}
|
|
5773
6270
|
|
|
@@ -5922,7 +6419,7 @@ export interface JsModelStatus {
|
|
|
5922
6419
|
/** Whether the model is currently loaded into VRAM. */
|
|
5923
6420
|
loaded: boolean
|
|
5924
6421
|
/** Estimated VRAM footprint in bytes. */
|
|
5925
|
-
vramEstimate:
|
|
6422
|
+
vramEstimate: bigint
|
|
5926
6423
|
}
|
|
5927
6424
|
|
|
5928
6425
|
export interface JsMusicRequest {
|
|
@@ -6239,6 +6736,7 @@ export interface JsThreeDResult {
|
|
|
6239
6736
|
models: Array<JsGenerated3DModel>
|
|
6240
6737
|
timing: JsRequestTiming
|
|
6241
6738
|
cost?: number
|
|
6739
|
+
usage?: JsTokenUsage
|
|
6242
6740
|
metadata: any
|
|
6243
6741
|
}
|
|
6244
6742
|
|
|
@@ -6337,6 +6835,8 @@ export interface JsTranscriptionResult {
|
|
|
6337
6835
|
language?: string
|
|
6338
6836
|
timing: JsRequestTiming
|
|
6339
6837
|
cost?: number
|
|
6838
|
+
usage?: JsTokenUsage
|
|
6839
|
+
audioSeconds?: number
|
|
6340
6840
|
metadata: any
|
|
6341
6841
|
}
|
|
6342
6842
|
|
|
@@ -6376,6 +6876,8 @@ export interface JsVideoResult {
|
|
|
6376
6876
|
videos: Array<JsGeneratedVideo>
|
|
6377
6877
|
timing: JsRequestTiming
|
|
6378
6878
|
cost?: number
|
|
6879
|
+
usage?: JsTokenUsage
|
|
6880
|
+
videoSeconds?: number
|
|
6379
6881
|
metadata: any
|
|
6380
6882
|
}
|
|
6381
6883
|
|
|
@@ -6481,6 +6983,16 @@ export interface JsWorkflowResult {
|
|
|
6481
6983
|
type: string
|
|
6482
6984
|
/** The result data as a JSON object. */
|
|
6483
6985
|
data: any
|
|
6986
|
+
/**
|
|
6987
|
+
* Aggregated token usage across the run, mirroring
|
|
6988
|
+
* [`blazen_core::WorkflowResult::usage_total`].
|
|
6989
|
+
*/
|
|
6990
|
+
usageTotal: JsTokenUsage
|
|
6991
|
+
/**
|
|
6992
|
+
* Aggregated cost in USD across the run, mirroring
|
|
6993
|
+
* [`blazen_core::WorkflowResult::cost_total_usd`].
|
|
6994
|
+
*/
|
|
6995
|
+
costTotalUsd: number
|
|
6484
6996
|
}
|
|
6485
6997
|
|
|
6486
6998
|
/**
|
|
@@ -6585,6 +7097,28 @@ export interface MessageContent {
|
|
|
6585
7097
|
parts?: Array<JsContentPart>
|
|
6586
7098
|
}
|
|
6587
7099
|
|
|
7100
|
+
/**
|
|
7101
|
+
* Discriminant for the kind of provider call a [`JsUsageEvent`] describes.
|
|
7102
|
+
*
|
|
7103
|
+
* Mirrors [`blazen_events::Modality`]. The string-enum representation
|
|
7104
|
+
* matches the `Modality::*` unit variants. Custom modalities (the Rust
|
|
7105
|
+
* `Modality::Custom(String)` variant) are surfaced via the
|
|
7106
|
+
* [`JsUsageEvent::modalityCustom`] string field — when `modalityCustom`
|
|
7107
|
+
* is non-null, callers should treat `modality` as `Custom` regardless of
|
|
7108
|
+
* its value.
|
|
7109
|
+
*/
|
|
7110
|
+
export declare const enum Modality {
|
|
7111
|
+
Llm = 'Llm',
|
|
7112
|
+
Embedding = 'Embedding',
|
|
7113
|
+
ImageGen = 'ImageGen',
|
|
7114
|
+
AudioTts = 'AudioTts',
|
|
7115
|
+
AudioStt = 'AudioStt',
|
|
7116
|
+
Video = 'Video',
|
|
7117
|
+
ThreeD = 'ThreeD',
|
|
7118
|
+
BackgroundRemoval = 'BackgroundRemoval',
|
|
7119
|
+
Custom = 'Custom'
|
|
7120
|
+
}
|
|
7121
|
+
|
|
6588
7122
|
/**
|
|
6589
7123
|
* Capability flags advertised by a model.
|
|
6590
7124
|
*
|
|
@@ -6645,10 +7179,20 @@ export interface ModelInfo {
|
|
|
6645
7179
|
export interface ModelManagerConfig {
|
|
6646
7180
|
/** VRAM budget in gigabytes (e.g. `8.0` for 8 GiB). */
|
|
6647
7181
|
budgetGb?: number
|
|
6648
|
-
/** VRAM budget in bytes. */
|
|
6649
|
-
budgetBytes?:
|
|
7182
|
+
/** VRAM budget in bytes (pass as JS `BigInt` to support values >4 GiB). */
|
|
7183
|
+
budgetBytes?: bigint
|
|
6650
7184
|
}
|
|
6651
7185
|
|
|
7186
|
+
/** Build an empty [`JsRetryStack`] with every scope set to `null`. */
|
|
7187
|
+
export declare function newRetryStack(): RetryStack
|
|
7188
|
+
|
|
7189
|
+
/**
|
|
7190
|
+
* Build a default [`JsUsageEvent`] for the given provider / model, with
|
|
7191
|
+
* every numeric field zeroed and `modality = Llm`. Useful as a starting
|
|
7192
|
+
* point for emitter shims that only know a subset of the fields.
|
|
7193
|
+
*/
|
|
7194
|
+
export declare function newUsageEvent(provider: string, model: string, runId: string): UsageEvent
|
|
7195
|
+
|
|
6652
7196
|
/**
|
|
6653
7197
|
* Why a workflow was paused.
|
|
6654
7198
|
*
|
|
@@ -6679,14 +7223,76 @@ export interface PersistedEvent {
|
|
|
6679
7223
|
*
|
|
6680
7224
|
* Mirrors [`blazen_llm::PricingEntry`]. The existing
|
|
6681
7225
|
* [`crate::types::pricing::JsModelPricing`] is a richer "input" type that
|
|
6682
|
-
* also carries `perImage` / `perSecond`; this shape
|
|
6683
|
-
* per-million token rates the registry actually stores
|
|
7226
|
+
* also carries `perImage` / `perSecond`; this shape covers the
|
|
7227
|
+
* per-million token rates the registry actually stores, plus optional
|
|
7228
|
+
* per-image and per-second rates for multimodal/audio/video models.
|
|
6684
7229
|
*/
|
|
6685
7230
|
export interface PricingEntry {
|
|
6686
7231
|
/** USD per million input (prompt) tokens. */
|
|
6687
7232
|
inputPerMillion: number
|
|
6688
7233
|
/** USD per million output (completion) tokens. */
|
|
6689
7234
|
outputPerMillion: number
|
|
7235
|
+
/** USD per image (for multimodal models). `null` if not applicable. */
|
|
7236
|
+
perImage?: number
|
|
7237
|
+
/** USD per second (for audio/video models). `null` if not applicable. */
|
|
7238
|
+
perSecond?: number
|
|
7239
|
+
}
|
|
7240
|
+
|
|
7241
|
+
/**
|
|
7242
|
+
* Per-stage / per-step progress tick emitted by Pipeline and Workflow
|
|
7243
|
+
* runners. Mirrors [`blazen_events::ProgressEvent`].
|
|
7244
|
+
*
|
|
7245
|
+
* `total` and `percent` are absent (`undefined`) when the step set is
|
|
7246
|
+
* dynamic and the total is not known up front.
|
|
7247
|
+
*/
|
|
7248
|
+
export interface ProgressEvent {
|
|
7249
|
+
/** What this progress event describes. */
|
|
7250
|
+
kind: ProgressKind
|
|
7251
|
+
/** Current step / stage index (1-based). */
|
|
7252
|
+
current: number
|
|
7253
|
+
/** Total number of steps / stages, when known. */
|
|
7254
|
+
total?: number
|
|
7255
|
+
/** Progress as a percentage in `0.0..=100.0`, when computable. */
|
|
7256
|
+
percent?: number
|
|
7257
|
+
/** Human-readable label for this progress tick (typically the step name). */
|
|
7258
|
+
label: string
|
|
7259
|
+
/** UUID of the run this progress belongs to. */
|
|
7260
|
+
runId: string
|
|
7261
|
+
}
|
|
7262
|
+
|
|
7263
|
+
/**
|
|
7264
|
+
* What a [`JsProgressEvent`] describes. Mirrors
|
|
7265
|
+
* [`blazen_events::ProgressKind`].
|
|
7266
|
+
*/
|
|
7267
|
+
export declare const enum ProgressKind {
|
|
7268
|
+
Pipeline = 'Pipeline',
|
|
7269
|
+
Workflow = 'Workflow',
|
|
7270
|
+
SubWorkflow = 'SubWorkflow',
|
|
7271
|
+
Stage = 'Stage'
|
|
7272
|
+
}
|
|
7273
|
+
|
|
7274
|
+
/**
|
|
7275
|
+
* Lightweight, polled view of a running pipeline's progress.
|
|
7276
|
+
*
|
|
7277
|
+
* Mirrors [`ProgressSnapshot`]. Reads are best-effort and may briefly be
|
|
7278
|
+
* one stage behind the actual position because they do not synchronise
|
|
7279
|
+
* with the executor task.
|
|
7280
|
+
*/
|
|
7281
|
+
export interface ProgressSnapshot {
|
|
7282
|
+
/**
|
|
7283
|
+
* 1-based index of the stage currently executing (or just completed).
|
|
7284
|
+
* `0` before the first stage starts.
|
|
7285
|
+
*/
|
|
7286
|
+
currentStageIndex: number
|
|
7287
|
+
/** Total number of stages declared on the pipeline. */
|
|
7288
|
+
totalStages: number
|
|
7289
|
+
/** Progress as a percentage in `0.0..=100.0`. */
|
|
7290
|
+
percent: number
|
|
7291
|
+
/**
|
|
7292
|
+
* Name of the current stage, when available. Always `null` from the
|
|
7293
|
+
* current atomic-index implementation; reserved for future use.
|
|
7294
|
+
*/
|
|
7295
|
+
currentStageName?: string
|
|
6690
7296
|
}
|
|
6691
7297
|
|
|
6692
7298
|
/** Options for creating a `PromptTemplate`. */
|
|
@@ -6915,6 +7521,39 @@ export declare function resolveApiKey(provider: string, explicit?: string | unde
|
|
|
6915
7521
|
*/
|
|
6916
7522
|
export declare function resolveBeerToken(): string | null
|
|
6917
7523
|
|
|
7524
|
+
/**
|
|
7525
|
+
* Resolve the effective [`JsRetryConfig`] for the given stack and an
|
|
7526
|
+
* optional per-call override. Mirrors [`RetryStack::resolve`].
|
|
7527
|
+
*
|
|
7528
|
+
* ```typescript
|
|
7529
|
+
* const effective = resolveRetryStack(
|
|
7530
|
+
* { workflow: { maxRetries: 5 } },
|
|
7531
|
+
* { maxRetries: 9 }, // per-call override wins
|
|
7532
|
+
* );
|
|
7533
|
+
* // effective.maxRetries === 9
|
|
7534
|
+
* ```
|
|
7535
|
+
*/
|
|
7536
|
+
export declare function resolveRetryStack(stack: RetryStack, callOverride?: JsRetryConfig | undefined | null): JsRetryConfig
|
|
7537
|
+
|
|
7538
|
+
/**
|
|
7539
|
+
* Snapshot of every scope's retry configuration. Mirrors
|
|
7540
|
+
* [`RetryStack`].
|
|
7541
|
+
*
|
|
7542
|
+
* All fields are optional; any combination of `null` / `undefined`
|
|
7543
|
+
* scopes is valid and falls through to the next-outer non-`None` scope
|
|
7544
|
+
* when [`resolveRetryStack`] is called.
|
|
7545
|
+
*/
|
|
7546
|
+
export interface RetryStack {
|
|
7547
|
+
/** Provider-level default (lowest priority). */
|
|
7548
|
+
provider?: JsRetryConfig
|
|
7549
|
+
/** Pipeline-level default. */
|
|
7550
|
+
pipeline?: JsRetryConfig
|
|
7551
|
+
/** Workflow-level override. */
|
|
7552
|
+
workflow?: JsRetryConfig
|
|
7553
|
+
/** Step-level override (highest priority before the per-call override). */
|
|
7554
|
+
step?: JsRetryConfig
|
|
7555
|
+
}
|
|
7556
|
+
|
|
6918
7557
|
/**
|
|
6919
7558
|
* Run an agentic tool execution loop.
|
|
6920
7559
|
*
|
|
@@ -7145,6 +7784,26 @@ export interface StructuredResponse {
|
|
|
7145
7784
|
artifacts: Array<JsArtifact>
|
|
7146
7785
|
}
|
|
7147
7786
|
|
|
7787
|
+
/**
|
|
7788
|
+
* Plain-object descriptor for one branch of a parallel fan-out — every
|
|
7789
|
+
* field except `workflowName` is metadata. The actual child `Workflow`
|
|
7790
|
+
* instances are passed alongside the spec array in
|
|
7791
|
+
* [`JsWorkflow::addParallelSubworkflows`] (napi cannot embed napi-class
|
|
7792
|
+
* values inside `#[napi(object)]` shapes).
|
|
7793
|
+
*/
|
|
7794
|
+
export interface SubWorkflowBranchSpec {
|
|
7795
|
+
/** Human-readable name for this branch. */
|
|
7796
|
+
name: string
|
|
7797
|
+
/** Event types this branch's parent step accepts. */
|
|
7798
|
+
accepts: Array<string>
|
|
7799
|
+
/** Event types this branch's parent step may emit (informational). */
|
|
7800
|
+
emits: Array<string>
|
|
7801
|
+
/** Optional wall-clock timeout in seconds for this branch. */
|
|
7802
|
+
timeoutSecs?: number
|
|
7803
|
+
/** Optional retry config for this branch. */
|
|
7804
|
+
retryConfig?: JsRetryConfig
|
|
7805
|
+
}
|
|
7806
|
+
|
|
7148
7807
|
/**
|
|
7149
7808
|
* The role for a prompt template.
|
|
7150
7809
|
*
|
|
@@ -7239,6 +7898,82 @@ export declare function tryDeserializeEvent(name: string, jsonStr: string): Prom
|
|
|
7239
7898
|
*/
|
|
7240
7899
|
export declare function typedToolSimple(name: string, description: string, parameters: any, handler: TypedToolHandlerTsfn): TypedTool
|
|
7241
7900
|
|
|
7901
|
+
/**
|
|
7902
|
+
* Build a [`JsHttpClientConfig`] with no request or connect timeout.
|
|
7903
|
+
* Mirrors [`HttpClientConfig::unlimited`].
|
|
7904
|
+
*/
|
|
7905
|
+
export declare function unlimitedHttpClientConfig(): HttpClientConfig
|
|
7906
|
+
|
|
7907
|
+
/**
|
|
7908
|
+
* Token / cost / latency snapshot for a single provider call, emitted
|
|
7909
|
+
* after each LLM / embedding / image / audio / video / 3D request.
|
|
7910
|
+
*
|
|
7911
|
+
* Pipelines and workflows aggregate these into [`PipelineState.usageTotal`]
|
|
7912
|
+
* and [`PipelineState.costTotalUsd`] when a `UsageEmitter` is wired up.
|
|
7913
|
+
*
|
|
7914
|
+
* ```typescript
|
|
7915
|
+
* import { UsageEvent, Modality } from 'blazen';
|
|
7916
|
+
*
|
|
7917
|
+
* const ev: UsageEvent = {
|
|
7918
|
+
* provider: "openai",
|
|
7919
|
+
* model: "gpt-4o-mini",
|
|
7920
|
+
* modality: Modality.Llm,
|
|
7921
|
+
* promptTokens: 100,
|
|
7922
|
+
* completionTokens: 25,
|
|
7923
|
+
* totalTokens: 125,
|
|
7924
|
+
* reasoningTokens: 0,
|
|
7925
|
+
* cachedInputTokens: 0,
|
|
7926
|
+
* audioInputTokens: 0,
|
|
7927
|
+
* audioOutputTokens: 0,
|
|
7928
|
+
* imageCount: 0,
|
|
7929
|
+
* audioSeconds: 0,
|
|
7930
|
+
* videoSeconds: 0,
|
|
7931
|
+
* latencyMs: 432,
|
|
7932
|
+
* costUsd: 0.000_25,
|
|
7933
|
+
* runId: "...",
|
|
7934
|
+
* };
|
|
7935
|
+
* ```
|
|
7936
|
+
*/
|
|
7937
|
+
export interface UsageEvent {
|
|
7938
|
+
/** The provider that served the call (e.g. `"openai"`, `"anthropic"`). */
|
|
7939
|
+
provider: string
|
|
7940
|
+
/** The model identifier. */
|
|
7941
|
+
model: string
|
|
7942
|
+
/** Discriminant for the kind of call. */
|
|
7943
|
+
modality: Modality
|
|
7944
|
+
/**
|
|
7945
|
+
* Free-form custom-modality label. Populated when [`Self::modality`] is
|
|
7946
|
+
* [`JsModality::Custom`]; ignored otherwise.
|
|
7947
|
+
*/
|
|
7948
|
+
modalityCustom?: string
|
|
7949
|
+
/** Number of prompt / input tokens billed. */
|
|
7950
|
+
promptTokens: number
|
|
7951
|
+
/** Number of completion / output tokens billed. */
|
|
7952
|
+
completionTokens: number
|
|
7953
|
+
/** Total tokens billed (typically `promptTokens + completionTokens`). */
|
|
7954
|
+
totalTokens: number
|
|
7955
|
+
/** Reasoning tokens (e.g. `OpenAI` o-series, Anthropic extended thinking). */
|
|
7956
|
+
reasoningTokens: number
|
|
7957
|
+
/** Tokens served from the provider's prompt cache at a discount. */
|
|
7958
|
+
cachedInputTokens: number
|
|
7959
|
+
/** Audio input tokens (multimodal speech-in models). */
|
|
7960
|
+
audioInputTokens: number
|
|
7961
|
+
/** Audio output tokens (multimodal speech-out models). */
|
|
7962
|
+
audioOutputTokens: number
|
|
7963
|
+
/** Number of images generated or processed. */
|
|
7964
|
+
imageCount: number
|
|
7965
|
+
/** Audio duration in seconds (for STT inputs and TTS outputs). */
|
|
7966
|
+
audioSeconds: number
|
|
7967
|
+
/** Video duration in seconds. */
|
|
7968
|
+
videoSeconds: number
|
|
7969
|
+
/** Cost in USD as reported (or computed) for this call. */
|
|
7970
|
+
costUsd?: number
|
|
7971
|
+
/** Wall-clock latency of the provider call in milliseconds. */
|
|
7972
|
+
latencyMs: number
|
|
7973
|
+
/** UUID of the run / pipeline invocation this usage belongs to. */
|
|
7974
|
+
runId: string
|
|
7975
|
+
}
|
|
7976
|
+
|
|
7242
7977
|
/** Returns the version of the blazen library. */
|
|
7243
7978
|
export declare function version(): string
|
|
7244
7979
|
|
package/index.js
CHANGED
|
@@ -720,6 +720,8 @@ module.exports.ModelRegistry = nativeBinding.ModelRegistry
|
|
|
720
720
|
module.exports.JsModelRegistry = nativeBinding.JsModelRegistry
|
|
721
721
|
module.exports.MusicProvider = nativeBinding.MusicProvider
|
|
722
722
|
module.exports.JsMusicProvider = nativeBinding.JsMusicProvider
|
|
723
|
+
module.exports.NoopUsageEmitter = nativeBinding.NoopUsageEmitter
|
|
724
|
+
module.exports.JsNoopUsageEmitter = nativeBinding.JsNoopUsageEmitter
|
|
723
725
|
module.exports.OpenAiCompatEmbeddingModel = nativeBinding.OpenAiCompatEmbeddingModel
|
|
724
726
|
module.exports.JsOpenAiCompatEmbeddingModel = nativeBinding.JsOpenAiCompatEmbeddingModel
|
|
725
727
|
module.exports.OpenAiCompatProvider = nativeBinding.OpenAiCompatProvider
|
|
@@ -732,6 +734,8 @@ module.exports.OpenRouterProvider = nativeBinding.OpenRouterProvider
|
|
|
732
734
|
module.exports.JsOpenRouterProvider = nativeBinding.JsOpenRouterProvider
|
|
733
735
|
module.exports.ParallelStage = nativeBinding.ParallelStage
|
|
734
736
|
module.exports.JsParallelStage = nativeBinding.JsParallelStage
|
|
737
|
+
module.exports.ParallelSubWorkflowsStep = nativeBinding.ParallelSubWorkflowsStep
|
|
738
|
+
module.exports.JsParallelSubWorkflowsStep = nativeBinding.JsParallelSubWorkflowsStep
|
|
735
739
|
module.exports.PerplexityProvider = nativeBinding.PerplexityProvider
|
|
736
740
|
module.exports.JsPerplexityProvider = nativeBinding.JsPerplexityProvider
|
|
737
741
|
module.exports.Pipeline = nativeBinding.Pipeline
|
|
@@ -766,6 +770,8 @@ module.exports.RequestTiming = nativeBinding.RequestTiming
|
|
|
766
770
|
module.exports.JsRequestTimingClass = nativeBinding.JsRequestTimingClass
|
|
767
771
|
module.exports.RetryCompletionModel = nativeBinding.RetryCompletionModel
|
|
768
772
|
module.exports.JsRetryCompletionModel = nativeBinding.JsRetryCompletionModel
|
|
773
|
+
module.exports.RetryMemoryBackend = nativeBinding.RetryMemoryBackend
|
|
774
|
+
module.exports.JsRetryMemoryBackend = nativeBinding.JsRetryMemoryBackend
|
|
769
775
|
module.exports.RetryMiddleware = nativeBinding.RetryMiddleware
|
|
770
776
|
module.exports.JsRetryMiddleware = nativeBinding.JsRetryMiddleware
|
|
771
777
|
module.exports.SessionNamespace = nativeBinding.SessionNamespace
|
|
@@ -792,6 +798,8 @@ module.exports.StopEvent = nativeBinding.StopEvent
|
|
|
792
798
|
module.exports.JsStopEventClass = nativeBinding.JsStopEventClass
|
|
793
799
|
module.exports.StructuredOutput = nativeBinding.StructuredOutput
|
|
794
800
|
module.exports.JsStructuredOutput = nativeBinding.JsStructuredOutput
|
|
801
|
+
module.exports.SubWorkflowStep = nativeBinding.SubWorkflowStep
|
|
802
|
+
module.exports.JsSubWorkflowStep = nativeBinding.JsSubWorkflowStep
|
|
795
803
|
module.exports.ThreeDProvider = nativeBinding.ThreeDProvider
|
|
796
804
|
module.exports.JsThreeDProvider = nativeBinding.JsThreeDProvider
|
|
797
805
|
module.exports.TogetherProvider = nativeBinding.TogetherProvider
|
|
@@ -814,6 +822,12 @@ module.exports.TTSProvider = nativeBinding.TTSProvider
|
|
|
814
822
|
module.exports.JsTTSProvider = nativeBinding.JsTTSProvider
|
|
815
823
|
module.exports.TypedTool = nativeBinding.TypedTool
|
|
816
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
|
|
817
831
|
module.exports.ValkeyBackend = nativeBinding.ValkeyBackend
|
|
818
832
|
module.exports.JsValkeyBackend = nativeBinding.JsValkeyBackend
|
|
819
833
|
module.exports.ValkeyCheckpointStore = nativeBinding.ValkeyCheckpointStore
|
|
@@ -838,17 +852,25 @@ module.exports.WorkflowSnapshot = nativeBinding.WorkflowSnapshot
|
|
|
838
852
|
module.exports.JsWorkflowSnapshot = nativeBinding.JsWorkflowSnapshot
|
|
839
853
|
module.exports.XaiProvider = nativeBinding.XaiProvider
|
|
840
854
|
module.exports.JsXaiProvider = nativeBinding.JsXaiProvider
|
|
855
|
+
module.exports.addUsageToTokenUsage = nativeBinding.addUsageToTokenUsage
|
|
841
856
|
module.exports.ChatRole = nativeBinding.ChatRole
|
|
842
857
|
module.exports.JsChatRole = nativeBinding.JsChatRole
|
|
843
858
|
module.exports.completeBatch = nativeBinding.completeBatch
|
|
844
859
|
module.exports.completeBatchConfig = nativeBinding.completeBatchConfig
|
|
860
|
+
module.exports.computeAudioCost = nativeBinding.computeAudioCost
|
|
845
861
|
module.exports.computeElidSimilarity = nativeBinding.computeElidSimilarity
|
|
846
862
|
module.exports.computeEmbeddingSimhashSimilarity = nativeBinding.computeEmbeddingSimhashSimilarity
|
|
863
|
+
module.exports.computeImageCost = nativeBinding.computeImageCost
|
|
847
864
|
module.exports.computeTextSimhashSimilarity = nativeBinding.computeTextSimhashSimilarity
|
|
865
|
+
module.exports.computeVideoCost = nativeBinding.computeVideoCost
|
|
848
866
|
module.exports.countMessageTokens = nativeBinding.countMessageTokens
|
|
867
|
+
module.exports.defaultHttpClientConfig = nativeBinding.defaultHttpClientConfig
|
|
849
868
|
module.exports.envVarForProvider = nativeBinding.envVarForProvider
|
|
850
869
|
module.exports.estimateTokens = nativeBinding.estimateTokens
|
|
851
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
|
|
852
874
|
module.exports.formatProviderHttpTail = nativeBinding.formatProviderHttpTail
|
|
853
875
|
module.exports.getContextWindow = nativeBinding.getContextWindow
|
|
854
876
|
module.exports.HistoryEventKindTag = nativeBinding.HistoryEventKindTag
|
|
@@ -870,10 +892,16 @@ module.exports.loadClientTls = nativeBinding.loadClientTls
|
|
|
870
892
|
module.exports.loadServerTls = nativeBinding.loadServerTls
|
|
871
893
|
module.exports.lookupPricing = nativeBinding.lookupPricing
|
|
872
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
|
|
873
899
|
module.exports.PauseReason = nativeBinding.PauseReason
|
|
874
900
|
module.exports.JsPauseReason = nativeBinding.JsPauseReason
|
|
875
901
|
module.exports.peerEnvelopeVersion = nativeBinding.peerEnvelopeVersion
|
|
876
902
|
module.exports.peerTokenEnv = nativeBinding.peerTokenEnv
|
|
903
|
+
module.exports.ProgressKind = nativeBinding.ProgressKind
|
|
904
|
+
module.exports.JsProgressKind = nativeBinding.JsProgressKind
|
|
877
905
|
module.exports.providerEnvVars = nativeBinding.providerEnvVars
|
|
878
906
|
module.exports.ProviderId = nativeBinding.ProviderId
|
|
879
907
|
module.exports.JsProviderId = nativeBinding.JsProviderId
|
|
@@ -886,6 +914,7 @@ module.exports.registerPricing = nativeBinding.registerPricing
|
|
|
886
914
|
module.exports.registerStepBuilder = nativeBinding.registerStepBuilder
|
|
887
915
|
module.exports.resolveApiKey = nativeBinding.resolveApiKey
|
|
888
916
|
module.exports.resolveBeerToken = nativeBinding.resolveBeerToken
|
|
917
|
+
module.exports.resolveRetryStack = nativeBinding.resolveRetryStack
|
|
889
918
|
module.exports.runAgent = nativeBinding.runAgent
|
|
890
919
|
module.exports.runAgentWithCallback = nativeBinding.runAgentWithCallback
|
|
891
920
|
module.exports.SessionPausePolicy = nativeBinding.SessionPausePolicy
|
|
@@ -900,6 +929,7 @@ module.exports.TemplateRole = nativeBinding.TemplateRole
|
|
|
900
929
|
module.exports.JsTemplateRole = nativeBinding.JsTemplateRole
|
|
901
930
|
module.exports.tryDeserializeEvent = nativeBinding.tryDeserializeEvent
|
|
902
931
|
module.exports.typedToolSimple = nativeBinding.typedToolSimple
|
|
932
|
+
module.exports.unlimitedHttpClientConfig = nativeBinding.unlimitedHttpClientConfig
|
|
903
933
|
module.exports.version = nativeBinding.version
|
|
904
934
|
|
|
905
935
|
// --- post-build: typed-error wrapping ---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blazen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.155",
|
|
4
4
|
"description": "Blazen - Event-driven AI workflow framework for Node.js/TypeScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -40,23 +40,36 @@
|
|
|
40
40
|
],
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@napi-rs/cli": "^3.0.0",
|
|
43
|
-
"@biomejs/biome": "^2"
|
|
43
|
+
"@biomejs/biome": "^2",
|
|
44
|
+
"ava": "^6.4.1"
|
|
44
45
|
},
|
|
45
46
|
"engines": {
|
|
46
47
|
"node": ">= 18"
|
|
47
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
|
+
},
|
|
48
60
|
"optionalDependencies": {
|
|
49
|
-
"@blazen-dev/blazen-linux-x64-gnu": "0.1.
|
|
50
|
-
"@blazen-dev/blazen-linux-x64-musl": "0.1.
|
|
51
|
-
"@blazen-dev/blazen-linux-arm64-gnu": "0.1.
|
|
52
|
-
"@blazen-dev/blazen-linux-arm64-musl": "0.1.
|
|
53
|
-
"@blazen-dev/blazen-darwin-arm64": "0.1.
|
|
54
|
-
"@blazen-dev/blazen-win32-x64-msvc": "0.1.
|
|
61
|
+
"@blazen-dev/blazen-linux-x64-gnu": "0.1.155",
|
|
62
|
+
"@blazen-dev/blazen-linux-x64-musl": "0.1.155",
|
|
63
|
+
"@blazen-dev/blazen-linux-arm64-gnu": "0.1.155",
|
|
64
|
+
"@blazen-dev/blazen-linux-arm64-musl": "0.1.155",
|
|
65
|
+
"@blazen-dev/blazen-darwin-arm64": "0.1.155",
|
|
66
|
+
"@blazen-dev/blazen-win32-x64-msvc": "0.1.155"
|
|
55
67
|
},
|
|
56
68
|
"scripts": {
|
|
57
69
|
"build": "napi build --release --platform --features local-all,langfuse --js index.js && node scripts/post-build.mjs",
|
|
58
70
|
"build:debug": "napi build --platform --features local-all,langfuse --js index.js && node scripts/post-build.mjs",
|
|
59
|
-
"test": "
|
|
60
|
-
"test:
|
|
71
|
+
"test": "ava",
|
|
72
|
+
"test:workflow": "ava ../../tests/node/test_workflow.mjs",
|
|
73
|
+
"test:smoke": "ava ../../tests/node/test_llm_smoke.mjs"
|
|
61
74
|
}
|
|
62
75
|
}
|