blazen 0.1.155 → 0.1.157

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 (3) hide show
  1. package/index.d.ts +469 -1
  2. package/index.js +15 -0
  3. package/package.json +7 -7
package/index.d.ts CHANGED
@@ -901,6 +901,113 @@ export declare class CompletionModel {
901
901
  }
902
902
  export type JsCompletionModel = CompletionModel
903
903
 
904
+ /**
905
+ * Pluggable registry for multimodal content. Wraps
906
+ * [`Arc<dyn blazen_llm::content::ContentStore>`].
907
+ *
908
+ * Construct via the static factories (e.g. `ContentStore.inMemory()`,
909
+ * `ContentStore.custom({ put, resolve, fetchBytes })`) or by extending
910
+ * `ContentStore` and overriding the async methods. Stores are cheap to
911
+ * clone — internally an `Arc` — so passing the same instance across
912
+ * multiple agents / requests is fine.
913
+ */
914
+ export declare class ContentStore {
915
+ /**
916
+ * Base-class constructor. Call from your subclass via `super()`.
917
+ * On its own, the base class is not useful — the default method
918
+ * implementations raise.
919
+ */
920
+ constructor()
921
+ /** Build a default ephemeral in-memory store. */
922
+ static inMemory(): ContentStore
923
+ /**
924
+ * Build a filesystem-backed store rooted at `root`. The directory is
925
+ * created if it doesn't yet exist.
926
+ */
927
+ static localFile(root: string): ContentStore
928
+ /** Build a store backed by the `OpenAI` Files API. */
929
+ static openaiFiles(apiKey: string, baseUrl?: string | undefined | null): ContentStore
930
+ /** Build a store backed by the Anthropic Files API. */
931
+ static anthropicFiles(apiKey: string, baseUrl?: string | undefined | null): ContentStore
932
+ /** Build a store backed by the Gemini Files API. */
933
+ static geminiFiles(apiKey: string, baseUrl?: string | undefined | null): ContentStore
934
+ /** Build a store backed by fal.ai's storage API. */
935
+ static falStorage(apiKey: string, baseUrl?: string | undefined | null): ContentStore
936
+ /**
937
+ * Build a store backed by user-supplied async callbacks.
938
+ *
939
+ * Mirrors the Rust [`CustomContentStore::builder`] API. The
940
+ * `options` object must provide at least `put`, `resolve`, and
941
+ * `fetchBytes`; `fetchStream` and `delete` are optional. All
942
+ * callbacks must be `async` (or return a `Promise`).
943
+ *
944
+ * Argument shapes seen by JS:
945
+ *
946
+ * - `put(body, hint)`: `body` is a JSON-tagged
947
+ * [`ContentBody`] (`{type: "bytes", data: number[]}`,
948
+ * `{type: "url", url: string}`, `{type: "local_path", path: string}`,
949
+ * or `{type: "provider_file", provider: string, id: string}`).
950
+ * `hint` is a [`ContentHint`] dict (all fields optional). Must
951
+ * resolve with a [`ContentHandle`]-shaped object
952
+ * `{id, kind, mimeType?, byteSize?, displayName?}`.
953
+ * - `resolve(handle)`: `handle` is a [`ContentHandle`] dict. Must
954
+ * resolve with a serialized [`MediaSource`] object
955
+ * (e.g. `{type: "url", url: "..."}`).
956
+ * - `fetchBytes(handle)`: must resolve with a `Buffer`,
957
+ * `Uint8Array`, or `number[]` of bytes.
958
+ * - `fetchStream(handle)` (optional): may resolve with either bytes
959
+ * (`Buffer` / `Uint8Array` / `number[]` / base64 string) or an
960
+ * `AsyncIterable<Uint8Array>` for chunk-by-chunk streaming.
961
+ * - `delete(handle)` (optional): must resolve with `undefined`.
962
+ */
963
+ static custom(options: CustomContentStoreOptions): ContentStore
964
+ /**
965
+ * Persist content and return a freshly-issued handle.
966
+ *
967
+ * `body` is either:
968
+ * - a `Buffer` — inline bytes uploaded to the store, or
969
+ * - a `string` — interpreted as a URL when it contains `"://"` (the
970
+ * store records the reference) and as a local filesystem path
971
+ * otherwise (the store reads or copies the file as needed).
972
+ */
973
+ put(body: Buffer | string, options: PutOptions): Promise<JsContentHandle>
974
+ /**
975
+ * Resolve a handle to a wire-renderable [`MediaSource`] (returned as a
976
+ * JS object — the same JSON shape Blazen's request builders accept).
977
+ */
978
+ resolve(handle: JsContentHandle): Promise<any>
979
+ /**
980
+ * Fetch raw bytes for a handle. Tools that need to operate on the
981
+ * actual content (parse a PDF, transcribe audio) call this; most tools
982
+ * reason over the handle and let `resolve` produce the wire form.
983
+ */
984
+ fetchBytes(handle: JsContentHandle): Promise<Buffer>
985
+ /**
986
+ * Stream raw bytes for a handle chunk-by-chunk.
987
+ *
988
+ * Returns a `Promise<AsyncIterable<Uint8Array>>`. Each `next()` call on
989
+ * the iterator pulls one chunk from the underlying [`ByteStream`]; the
990
+ * iterator is automatically `done` once the stream completes. Errors
991
+ * surfaced mid-stream reject the corresponding `next()` promise.
992
+ *
993
+ * Useful for large payloads where holding the entire body in a
994
+ * [`Buffer`] would be wasteful — pipe directly into a file, an HTTP
995
+ * response, or another transform without buffering.
996
+ *
997
+ * Built-in stores that lack a native streaming path fall back to a
998
+ * single-chunk iterator over [`Self::fetch_bytes`].
999
+ */
1000
+ fetchStream(handle: JsContentHandle): Promise<AsyncIterable<Uint8Array>>
1001
+ /** Cheap metadata lookup without materializing the bytes. */
1002
+ metadata(handle: JsContentHandle): Promise<JsContentMetadata>
1003
+ /**
1004
+ * Optional cleanup — remove the handle from the store. Default
1005
+ * implementations on most stores are no-ops.
1006
+ */
1007
+ delete(handle: JsContentHandle): Promise<void>
1008
+ }
1009
+ export type JsContentStore = ContentStore
1010
+
904
1011
  /**
905
1012
  * Shared workflow context accessible by all steps.
906
1013
  *
@@ -2954,6 +3061,48 @@ export declare class ParallelSubWorkflowsStep {
2954
3061
  }
2955
3062
  export type JsParallelSubWorkflowsStep = ParallelSubWorkflowsStep
2956
3063
 
3064
+ /**
3065
+ * Abstract base class for custom peer-client transports.
3066
+ *
3067
+ * Mirrors [`blazen_core::distributed::PeerClient`]. Subclass and
3068
+ * override `invokeSubWorkflow`, `derefSessionRef`, and
3069
+ * `releaseSessionRef` to plug a JS-side transport into Blazen's
3070
+ * distributed-execution surface. The canonical gRPC implementation
3071
+ * lives in `BlazenPeerClient`
3072
+ * ([`crate::peer::JsBlazenPeerClient`]); this base exists for callers
3073
+ * who want to swap in a different transport (HTTP, NATS, an in-process
3074
+ * mock for tests, etc.) without touching the Rust core.
3075
+ *
3076
+ * ```javascript
3077
+ * class MyTransport extends PeerClient {
3078
+ * async invokeSubWorkflow(request) { /* ... *\/ }
3079
+ * async derefSessionRef(refUuid) { /* ... *\/ }
3080
+ * async releaseSessionRef(refUuid) { /* ... *\/ }
3081
+ * }
3082
+ * ```
3083
+ */
3084
+ export declare class PeerClient {
3085
+ /** Create a new peer-client base instance. */
3086
+ constructor()
3087
+ /**
3088
+ * Invoke a sub-workflow on the remote peer. Subclasses **must**
3089
+ * override this method.
3090
+ */
3091
+ invokeSubWorkflow(request: JsRemoteWorkflowRequest): Promise<JsRemoteWorkflowResponse>
3092
+ /**
3093
+ * Dereference a remote session ref by UUID. Returns the raw
3094
+ * payload bytes. Subclasses **must** override this method.
3095
+ */
3096
+ derefSessionRef(refUuid: string): Promise<Buffer>
3097
+ /**
3098
+ * Release (drop) a remote session ref on the origin node.
3099
+ * Returns `true` when the ref was found and dropped, `false` when
3100
+ * it was already gone. Subclasses **must** override this method.
3101
+ */
3102
+ releaseSessionRef(refUuid: string): Promise<boolean>
3103
+ }
3104
+ export type JsPeerClient = PeerClient
3105
+
2957
3106
  /** A Perplexity chat completion provider. */
2958
3107
  export declare class PerplexityProvider {
2959
3108
  /** Create a new Perplexity provider. */
@@ -3996,6 +4145,35 @@ export declare class ThreeDProvider {
3996
4145
  }
3997
4146
  export type JsThreeDProvider = ThreeDProvider
3998
4147
 
4148
+ /**
4149
+ * Exact BPE token counter backed by `tiktoken-rs`.
4150
+ *
4151
+ * Mirrors the per-message overhead rules documented by `OpenAI` for GPT-3.5,
4152
+ * GPT-4, GPT-4.1, and o-series models. Unknown model names return an error.
4153
+ *
4154
+ * ```javascript
4155
+ * const counter = TiktokenCounter.forModel("gpt-4o");
4156
+ * const n = counter.countTokens("Hello, world!");
4157
+ * ```
4158
+ */
4159
+ export declare class TiktokenCounter {
4160
+ /**
4161
+ * Create a counter tuned for the given model name.
4162
+ *
4163
+ * Throws if the model is unknown to `tiktoken-rs`.
4164
+ */
4165
+ static forModel(model: string): TiktokenCounter
4166
+ /** Count tokens in a raw text string. */
4167
+ countTokens(text: string): number
4168
+ /** Count tokens for an array of chat messages, including per-message overhead. */
4169
+ countMessageTokens(messages: Array<ChatMessage>): number
4170
+ /** The model's context window size in tokens. */
4171
+ contextSize(): number
4172
+ /** Tokens remaining after the given prompt, saturating at zero. */
4173
+ remainingTokens(messages: Array<ChatMessage>): number
4174
+ }
4175
+ export type JsTiktokenCounter = TiktokenCounter
4176
+
3999
4177
  /** A Together AI chat completion provider. */
4000
4178
  export declare class TogetherProvider {
4001
4179
  /** Create a new Together provider. */
@@ -5181,6 +5359,12 @@ export interface AgentEvent {
5181
5359
  hadToolCalls?: boolean
5182
5360
  }
5183
5361
 
5362
+ /** Build a JSON Schema declaring a single required audio-handle input. */
5363
+ export declare function audioInput(name: string, description: string): any
5364
+
5365
+ /** Build a JSON Schema declaring a single required CAD-file-handle input. */
5366
+ export declare function cadInput(name: string, description: string): any
5367
+
5184
5368
  /** Configuration passed to any capability provider constructor. */
5185
5369
  export interface CapabilityProviderConfig {
5186
5370
  /** Short identifier for this provider (e.g. `"elevenlabs"`, `"fal"`). */
@@ -5410,6 +5594,45 @@ export declare function computeVideoCost(modelId: string, seconds: number): numb
5410
5594
  */
5411
5595
  export declare function countMessageTokens(messages: Array<ChatMessage>, contextSize?: number | undefined | null): number
5412
5596
 
5597
+ /**
5598
+ * Plain object passed to [`JsContentStore::custom`].
5599
+ *
5600
+ * Each property is the JS-side implementation of one of the trait's
5601
+ * methods. `put`, `resolve`, and `fetchBytes` are required; `fetchStream`
5602
+ * and `delete` are optional.
5603
+ *
5604
+ * All callbacks must be `async` (or return a `Promise`) and accept the
5605
+ * JSON shapes defined by [`ContentBody`] / [`ContentHint`] /
5606
+ * [`ContentHandle`] on the input side; outputs are deserialized into the
5607
+ * matching Rust types. See [`JsHostContentStore`] for the per-method
5608
+ * payload shapes.
5609
+ *
5610
+ * `name` is a short identifier used in error / tracing messages; defaults
5611
+ * to `"custom"`.
5612
+ */
5613
+ export interface CustomContentStoreOptions {
5614
+ /** Required: persist content, return a handle. */
5615
+ put: (body: ContentBody, hint: ContentHint) => Promise<ContentHandle>
5616
+ /** Required: turn a handle into a wire-renderable [`MediaSource`]. */
5617
+ resolve: (handle: ContentHandle) => Promise<MediaSource>
5618
+ /**
5619
+ * Required: fetch raw bytes for a handle (`Buffer` | `Uint8Array` |
5620
+ * `number[]`).
5621
+ */
5622
+ fetchBytes: (handle: ContentHandle) => Promise<Buffer | Uint8Array | number[] | string>
5623
+ /**
5624
+ * Optional: stream raw bytes; absent falls back to `fetchBytes`. May
5625
+ * resolve with bytes (`Buffer` / `Uint8Array` / `number[]` / base64
5626
+ * string) or an `AsyncIterable<Uint8Array>` for true chunk-by-chunk
5627
+ * streaming.
5628
+ */
5629
+ fetchStream?: (handle: ContentHandle) => Promise<Buffer | Uint8Array | number[] | string | AsyncIterable<Uint8Array>>
5630
+ /** Optional: cleanup hook; absent is a no-op. */
5631
+ delete?: (handle: ContentHandle) => Promise<void>
5632
+ /** Optional human-readable identifier for logs (default: `"custom"`). */
5633
+ name?: string
5634
+ }
5635
+
5413
5636
  /** Optional configuration for a [`JsCustomProvider`]. */
5414
5637
  export interface CustomProviderOptions {
5415
5638
  /**
@@ -5520,6 +5743,9 @@ export interface FileContent {
5520
5743
  filename?: string
5521
5744
  }
5522
5745
 
5746
+ /** Build a JSON Schema declaring a single required document/file-handle input. */
5747
+ export declare function fileInput(name: string, description: string): any
5748
+
5523
5749
  /**
5524
5750
  * Canonical name of the built-in `finish_workflow` exit tool. Mirrors
5525
5751
  * [`blazen_llm::FINISH_WORKFLOW_TOOL_NAME`].
@@ -5634,6 +5860,15 @@ export interface HttpClientConfig {
5634
5860
  userAgent?: string
5635
5861
  }
5636
5862
 
5863
+ /**
5864
+ * Build a JSON Schema declaring a single required image-handle input.
5865
+ *
5866
+ * The model fills the property with a content-handle id string; Blazen
5867
+ * resolves it against the active [`super::store::JsContentStore`] before
5868
+ * the tool's handler runs.
5869
+ */
5870
+ export declare function imageInput(name: string, description: string): any
5871
+
5637
5872
  /**
5638
5873
  * Initialize the Langfuse exporter and install it as a layer on the global
5639
5874
  * `tracing` subscriber.
@@ -5647,6 +5882,32 @@ export interface HttpClientConfig {
5647
5882
  */
5648
5883
  export declare function initLangfuse(config: LangfuseConfig): void
5649
5884
 
5885
+ /**
5886
+ * Initialize the OTLP trace exporter and install the global tracing
5887
+ * subscriber.
5888
+ *
5889
+ * Calling this more than once in a single process will fail because the
5890
+ * global subscriber can only be installed once.
5891
+ */
5892
+ export declare function initOtlp(config: OtlpConfig): void
5893
+
5894
+ /**
5895
+ * Initialize the Prometheus metrics exporter and start its HTTP listener
5896
+ * on `0.0.0.0:{port}`.
5897
+ *
5898
+ * After calling this, every workflow / step / LLM span emitted via the
5899
+ * `tracing` infrastructure feeds into counters and histograms exposed at
5900
+ * `http://0.0.0.0:{port}/metrics` for Prometheus to scrape.
5901
+ *
5902
+ * ```javascript
5903
+ * initPrometheus(9100);
5904
+ * ```
5905
+ *
5906
+ * Calling this more than once in a single process will fail because the
5907
+ * global recorder can only be installed once.
5908
+ */
5909
+ export declare function initPrometheus(port: number): void
5910
+
5650
5911
  /**
5651
5912
  * A request for human input emitted by a workflow step.
5652
5913
  *
@@ -5986,6 +6247,59 @@ export interface JsComputeResult {
5986
6247
  metadata: any
5987
6248
  }
5988
6249
 
6250
+ /**
6251
+ * Reference to content stored in a [`super::store::JsContentStore`].
6252
+ *
6253
+ * Mirrors [`blazen_llm::content::ContentHandle`]. Pass instances to a
6254
+ * store's `resolve` / `fetchBytes` / `metadata` / `delete` methods, or
6255
+ * embed the `id` in tool arguments where a content reference is expected.
6256
+ */
6257
+ export interface JsContentHandle {
6258
+ /** Opaque, store-defined identifier. Treat as a black box. */
6259
+ id: string
6260
+ /** What kind of content this handle refers to. */
6261
+ kind: JsContentKind
6262
+ /** MIME type if known. */
6263
+ mimeType?: string
6264
+ /** Byte size if known. `i64` because napi has no `u64`. */
6265
+ byteSize?: number
6266
+ /** Human-readable display name (e.g. original filename). */
6267
+ displayName?: string
6268
+ }
6269
+
6270
+ /**
6271
+ * Taxonomy of multimodal content kinds. Mirrors
6272
+ * [`blazen_llm::content::ContentKind`].
6273
+ *
6274
+ * String values match the JSON / `serde` tag (`"image"`, `"three_d_model"`,
6275
+ * etc.) so they can be round-tripped against any Blazen API that accepts a
6276
+ * kind string.
6277
+ */
6278
+ export declare const enum JsContentKind {
6279
+ Image = 'image',
6280
+ Audio = 'audio',
6281
+ Video = 'video',
6282
+ Document = 'document',
6283
+ ThreeDModel = 'three_d_model',
6284
+ Cad = 'cad',
6285
+ Archive = 'archive',
6286
+ Font = 'font',
6287
+ Code = 'code',
6288
+ Data = 'data',
6289
+ Other = 'other'
6290
+ }
6291
+
6292
+ /**
6293
+ * Cheap metadata summary returned by
6294
+ * [`JsContentStore::metadata`](JsContentStore::metadata).
6295
+ */
6296
+ export interface JsContentMetadata {
6297
+ kind: JsContentKind
6298
+ mimeType?: string
6299
+ byteSize?: number
6300
+ displayName?: string
6301
+ }
6302
+
5989
6303
  /**
5990
6304
  * A single part in a multi-part message.
5991
6305
  *
@@ -6268,11 +6582,38 @@ export interface JsImageResult {
6268
6582
  metadata: any
6269
6583
  }
6270
6584
 
6271
- /** How an image is provided (URL or base64). */
6585
+ /**
6586
+ * How an image / audio / video / file is provided.
6587
+ *
6588
+ * `sourceType` is one of:
6589
+ * - `"url"` — set `url` to a public URL.
6590
+ * - `"base64"` — set `data` to the base64-encoded payload.
6591
+ * - `"file"` — set `url` to a local filesystem path (local backends only).
6592
+ * - `"providerFile"` — set `provider` and `id` to reference an
6593
+ * already-uploaded file in a provider's file API (`OpenAI` Files,
6594
+ * Anthropic Files, Gemini Files, fal.ai storage).
6595
+ * - `"handle"` — set `handleId` (and optionally `handleKind`) to reference
6596
+ * content registered with a `ContentStore`. The store resolves the
6597
+ * handle at request-build time.
6598
+ */
6272
6599
  export interface JsImageSource {
6273
6600
  sourceType: string
6274
6601
  url?: string
6275
6602
  data?: string
6603
+ /**
6604
+ * Provider name for `sourceType: "providerFile"` (e.g. `"openai"`,
6605
+ * `"anthropic"`, `"gemini"`, `"fal"`).
6606
+ */
6607
+ provider?: string
6608
+ /** Provider-issued file id for `sourceType: "providerFile"`. */
6609
+ id?: string
6610
+ /** Content handle id for `sourceType: "handle"`. */
6611
+ handleId?: string
6612
+ /**
6613
+ * Content handle kind for `sourceType: "handle"` (e.g. `"image"`,
6614
+ * `"audio"`, `"three_d_model"`). See `ContentKind` for the full set.
6615
+ */
6616
+ handleKind?: string
6276
6617
  }
6277
6618
 
6278
6619
  export interface JsJobHandle {
@@ -6561,6 +6902,52 @@ export interface JsReleaseResponse {
6561
6902
  released: boolean
6562
6903
  }
6563
6904
 
6905
+ /**
6906
+ * Transport-agnostic request for invoking a sub-workflow on a remote
6907
+ * peer.
6908
+ *
6909
+ * Mirrors [`blazen_core::distributed::RemoteWorkflowRequest`]. Concrete
6910
+ * transports (gRPC, HTTP, NATS, etc.) serialize this into whatever
6911
+ * wire format they require.
6912
+ */
6913
+ export interface JsRemoteWorkflowRequest {
6914
+ /** Symbolic name of the workflow to invoke on the remote peer. */
6915
+ workflowName: string
6916
+ /** Ordered list of step IDs to execute as part of this sub-workflow. */
6917
+ stepIds: Array<string>
6918
+ /** Initial input value passed to the workflow's first step. */
6919
+ input: any
6920
+ /**
6921
+ * Optional timeout in seconds. `None` means "use the server's
6922
+ * default deadline".
6923
+ */
6924
+ timeoutSecs?: number
6925
+ }
6926
+
6927
+ /**
6928
+ * Transport-agnostic response from a remote sub-workflow invocation.
6929
+ *
6930
+ * Mirrors [`blazen_core::distributed::RemoteWorkflowResponse`].
6931
+ */
6932
+ export interface JsRemoteWorkflowResponse {
6933
+ /**
6934
+ * Optional terminal result. `None` when the workflow exited
6935
+ * without producing one.
6936
+ */
6937
+ result?: any
6938
+ /**
6939
+ * Descriptors for any session refs the sub-workflow registered
6940
+ * that the parent should be able to dereference remotely. Keyed
6941
+ * by the registry UUID rendered as a string.
6942
+ */
6943
+ remoteRefs: Record<string, any>
6944
+ /**
6945
+ * Error message if the sub-workflow failed. When `Some`, callers
6946
+ * should ignore `result`.
6947
+ */
6948
+ error?: string
6949
+ }
6950
+
6564
6951
  export interface JsRequestTiming {
6565
6952
  queueMs?: number
6566
6953
  executionMs?: number
@@ -7193,6 +7580,35 @@ export declare function newRetryStack(): RetryStack
7193
7580
  */
7194
7581
  export declare function newUsageEvent(provider: string, model: string, runId: string): UsageEvent
7195
7582
 
7583
+ /**
7584
+ * Configuration for the OTLP exporter.
7585
+ *
7586
+ * ```javascript
7587
+ * initOtlp({
7588
+ * endpoint: "http://localhost:4317",
7589
+ * serviceName: "my-service",
7590
+ * serviceVersion: "1.0.0",
7591
+ * headers: { "x-api-key": "secret" },
7592
+ * });
7593
+ * ```
7594
+ */
7595
+ export interface OtlpConfig {
7596
+ /** The OTLP endpoint URL (e.g. `"http://localhost:4317"`). */
7597
+ endpoint: string
7598
+ /** The service name reported to the backend. */
7599
+ serviceName: string
7600
+ /**
7601
+ * Service version reported to the backend (recorded for forward
7602
+ * compatibility; not yet forwarded by the underlying exporter).
7603
+ */
7604
+ serviceVersion?: string
7605
+ /**
7606
+ * Additional headers to attach to OTLP requests (recorded for forward
7607
+ * compatibility; not yet forwarded by the underlying exporter).
7608
+ */
7609
+ headers?: Record<string, string>
7610
+ }
7611
+
7196
7612
  /**
7197
7613
  * Why a workflow was paused.
7198
7614
  *
@@ -7376,6 +7792,24 @@ export declare const enum ProviderId {
7376
7792
  Fal = 'fal'
7377
7793
  }
7378
7794
 
7795
+ /**
7796
+ * Optional hints attached to a `put` call.
7797
+ *
7798
+ * Mirrors [`blazen_llm::content::ContentHint`] minus its builder API. Every
7799
+ * field is optional; the store may auto-detect from the bytes when a hint is
7800
+ * missing.
7801
+ */
7802
+ export interface PutOptions {
7803
+ /** MIME type, if known. */
7804
+ mimeType?: string
7805
+ /** Caller's preferred classification — overrides any auto-detection. */
7806
+ kind?: JsContentKind
7807
+ /** Human-readable display name (filename, caption). */
7808
+ displayName?: string
7809
+ /** Byte size, if known up-front. `i64` since napi has no `u64`. */
7810
+ byteSize?: number
7811
+ }
7812
+
7379
7813
  /** Options for constructing a [`JsReasoningTraceClass`] from JavaScript. */
7380
7814
  export interface ReasoningTraceOptions {
7381
7815
  /** Plain-text rendering of the reasoning content. */
@@ -7819,6 +8253,9 @@ export declare const enum TemplateRole {
7819
8253
  Assistant = 'Assistant'
7820
8254
  }
7821
8255
 
8256
+ /** Build a JSON Schema declaring a single required 3D-model-handle input. */
8257
+ export declare function threeDInput(name: string, description: string): any
8258
+
7822
8259
  /** Options for constructing a [`JsTokenUsageClass`] from JavaScript. */
7823
8260
  export interface TokenUsageOptions {
7824
8261
  promptTokens: number
@@ -7977,9 +8414,40 @@ export interface UsageEvent {
7977
8414
  /** Returns the version of the blazen library. */
7978
8415
  export declare function version(): string
7979
8416
 
8417
+ /** Build a JSON Schema declaring a single required video-handle input. */
8418
+ export declare function videoInput(name: string, description: string): any
8419
+
7980
8420
  // --- post-build: type aliases mirroring blazen-llm ---
7981
8421
  export type MediaSource = JsImageSource
7982
8422
  export type ImageSource = JsImageSource
8423
+ export type ContentHandle = JsContentHandle
8424
+ export type ContentMetadata = JsContentMetadata
8425
+ export type ContentKind = JsContentKind
8426
+
8427
+ // --- post-build: ContentBody / ContentHint helper types ---
8428
+ /**
8429
+ * JSON-tagged body passed to a custom store's `put` callback.
8430
+ *
8431
+ * Mirrors `blazen_llm::content::ContentBody`. The `stream` variant
8432
+ * carries a live `AsyncIterable<Uint8Array>` so chunks flow lazily
8433
+ * from Rust into JS without staging the whole payload in memory.
8434
+ */
8435
+ export type ContentBody =
8436
+ | { type: 'bytes'; data: Buffer | Uint8Array | number[] }
8437
+ | { type: 'url'; url: string }
8438
+ | { type: 'local_path'; path: string }
8439
+ | { type: 'provider_file'; provider: string; id: string }
8440
+ | { type: 'stream'; stream: AsyncIterable<Uint8Array>; sizeHint: number | null }
8441
+ /**
8442
+ * Optional hints passed alongside a `ContentBody` into `put`.
8443
+ * Mirrors `blazen_llm::content::ContentHint` (every field optional).
8444
+ */
8445
+ export interface ContentHint {
8446
+ mimeType?: string | null
8447
+ kind?: ContentKind | null
8448
+ displayName?: string | null
8449
+ byteSize?: number | null
8450
+ }
7983
8451
 
7984
8452
  // --- post-build: typed error classes ---
7985
8453
  export class BlazenError extends Error {}
package/index.js CHANGED
@@ -622,6 +622,8 @@ module.exports.CohereProvider = nativeBinding.CohereProvider
622
622
  module.exports.JsCohereProvider = nativeBinding.JsCohereProvider
623
623
  module.exports.CompletionModel = nativeBinding.CompletionModel
624
624
  module.exports.JsCompletionModel = nativeBinding.JsCompletionModel
625
+ module.exports.ContentStore = nativeBinding.ContentStore
626
+ module.exports.JsContentStore = nativeBinding.JsContentStore
625
627
  module.exports.Context = nativeBinding.Context
626
628
  module.exports.JsContext = nativeBinding.JsContext
627
629
  module.exports.CustomProvider = nativeBinding.CustomProvider
@@ -736,6 +738,8 @@ module.exports.ParallelStage = nativeBinding.ParallelStage
736
738
  module.exports.JsParallelStage = nativeBinding.JsParallelStage
737
739
  module.exports.ParallelSubWorkflowsStep = nativeBinding.ParallelSubWorkflowsStep
738
740
  module.exports.JsParallelSubWorkflowsStep = nativeBinding.JsParallelSubWorkflowsStep
741
+ module.exports.PeerClient = nativeBinding.PeerClient
742
+ module.exports.JsPeerClient = nativeBinding.JsPeerClient
739
743
  module.exports.PerplexityProvider = nativeBinding.PerplexityProvider
740
744
  module.exports.JsPerplexityProvider = nativeBinding.JsPerplexityProvider
741
745
  module.exports.Pipeline = nativeBinding.Pipeline
@@ -802,6 +806,8 @@ module.exports.SubWorkflowStep = nativeBinding.SubWorkflowStep
802
806
  module.exports.JsSubWorkflowStep = nativeBinding.JsSubWorkflowStep
803
807
  module.exports.ThreeDProvider = nativeBinding.ThreeDProvider
804
808
  module.exports.JsThreeDProvider = nativeBinding.JsThreeDProvider
809
+ module.exports.TiktokenCounter = nativeBinding.TiktokenCounter
810
+ module.exports.JsTiktokenCounter = nativeBinding.JsTiktokenCounter
805
811
  module.exports.TogetherProvider = nativeBinding.TogetherProvider
806
812
  module.exports.JsTogetherProvider = nativeBinding.JsTogetherProvider
807
813
  module.exports.TokenCounter = nativeBinding.TokenCounter
@@ -853,6 +859,8 @@ module.exports.JsWorkflowSnapshot = nativeBinding.JsWorkflowSnapshot
853
859
  module.exports.XaiProvider = nativeBinding.XaiProvider
854
860
  module.exports.JsXaiProvider = nativeBinding.JsXaiProvider
855
861
  module.exports.addUsageToTokenUsage = nativeBinding.addUsageToTokenUsage
862
+ module.exports.audioInput = nativeBinding.audioInput
863
+ module.exports.cadInput = nativeBinding.cadInput
856
864
  module.exports.ChatRole = nativeBinding.ChatRole
857
865
  module.exports.JsChatRole = nativeBinding.JsChatRole
858
866
  module.exports.completeBatch = nativeBinding.completeBatch
@@ -868,6 +876,7 @@ module.exports.defaultHttpClientConfig = nativeBinding.defaultHttpClientConfig
868
876
  module.exports.envVarForProvider = nativeBinding.envVarForProvider
869
877
  module.exports.estimateTokens = nativeBinding.estimateTokens
870
878
  module.exports.extractInlineArtifacts = nativeBinding.extractInlineArtifacts
879
+ module.exports.fileInput = nativeBinding.fileInput
871
880
  module.exports.FINISH_WORKFLOW_TOOL_NAME = nativeBinding.FINISH_WORKFLOW_TOOL_NAME
872
881
  module.exports.finishWorkflowTool = nativeBinding.finishWorkflowTool
873
882
  module.exports.finishWorkflowToolDef = nativeBinding.finishWorkflowToolDef
@@ -875,12 +884,16 @@ module.exports.formatProviderHttpTail = nativeBinding.formatProviderHttpTail
875
884
  module.exports.getContextWindow = nativeBinding.getContextWindow
876
885
  module.exports.HistoryEventKindTag = nativeBinding.HistoryEventKindTag
877
886
  module.exports.JsHistoryEventKindTag = nativeBinding.JsHistoryEventKindTag
887
+ module.exports.imageInput = nativeBinding.imageInput
878
888
  module.exports.initLangfuse = nativeBinding.initLangfuse
889
+ module.exports.initOtlp = nativeBinding.initOtlp
890
+ module.exports.initPrometheus = nativeBinding.initPrometheus
879
891
  module.exports.internEventType = nativeBinding.internEventType
880
892
  module.exports.JoinStrategy = nativeBinding.JoinStrategy
881
893
  module.exports.JsJoinStrategy = nativeBinding.JsJoinStrategy
882
894
  module.exports.JsAuthMethod = nativeBinding.JsAuthMethod
883
895
  module.exports.JsCacheStrategy = nativeBinding.JsCacheStrategy
896
+ module.exports.JsContentKind = nativeBinding.JsContentKind
884
897
  module.exports.JsDiffusionScheduler = nativeBinding.JsDiffusionScheduler
885
898
  module.exports.JsFalLlmEndpointKind = nativeBinding.JsFalLlmEndpointKind
886
899
  module.exports.JsJobStatus = nativeBinding.JsJobStatus
@@ -927,10 +940,12 @@ module.exports.StepOutputKind = nativeBinding.StepOutputKind
927
940
  module.exports.JsStepOutputKind = nativeBinding.JsStepOutputKind
928
941
  module.exports.TemplateRole = nativeBinding.TemplateRole
929
942
  module.exports.JsTemplateRole = nativeBinding.JsTemplateRole
943
+ module.exports.threeDInput = nativeBinding.threeDInput
930
944
  module.exports.tryDeserializeEvent = nativeBinding.tryDeserializeEvent
931
945
  module.exports.typedToolSimple = nativeBinding.typedToolSimple
932
946
  module.exports.unlimitedHttpClientConfig = nativeBinding.unlimitedHttpClientConfig
933
947
  module.exports.version = nativeBinding.version
948
+ module.exports.videoInput = nativeBinding.videoInput
934
949
 
935
950
  // --- post-build: typed-error wrapping ---
936
951
  ;(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blazen",
3
- "version": "0.1.155",
3
+ "version": "0.1.157",
4
4
  "description": "Blazen - Event-driven AI workflow framework for Node.js/TypeScript",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -58,12 +58,12 @@
58
58
  "verbose": true
59
59
  },
60
60
  "optionalDependencies": {
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"
61
+ "@blazen-dev/blazen-linux-x64-gnu": "0.1.157",
62
+ "@blazen-dev/blazen-linux-x64-musl": "0.1.157",
63
+ "@blazen-dev/blazen-linux-arm64-gnu": "0.1.157",
64
+ "@blazen-dev/blazen-linux-arm64-musl": "0.1.157",
65
+ "@blazen-dev/blazen-darwin-arm64": "0.1.157",
66
+ "@blazen-dev/blazen-win32-x64-msvc": "0.1.157"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "napi build --release --platform --features local-all,langfuse --js index.js && node scripts/post-build.mjs",