blazen 0.1.156 → 0.1.158
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 +578 -25
- package/index.js +38 -1
- package/package.json +15 -9
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
|
+
/** Build a store backed by the `OpenAI` Files API. */
|
|
924
|
+
static openaiFiles(apiKey: string, baseUrl?: string | undefined | null): ContentStore
|
|
925
|
+
/** Build a store backed by the Anthropic Files API. */
|
|
926
|
+
static anthropicFiles(apiKey: string, baseUrl?: string | undefined | null): ContentStore
|
|
927
|
+
/** Build a store backed by the Gemini Files API. */
|
|
928
|
+
static geminiFiles(apiKey: string, baseUrl?: string | undefined | null): ContentStore
|
|
929
|
+
/** Build a store backed by fal.ai's storage API. */
|
|
930
|
+
static falStorage(apiKey: string, baseUrl?: string | undefined | null): ContentStore
|
|
931
|
+
/**
|
|
932
|
+
* Build a store backed by user-supplied async callbacks.
|
|
933
|
+
*
|
|
934
|
+
* Mirrors the Rust [`CustomContentStore::builder`] API. The
|
|
935
|
+
* `options` object must provide at least `put`, `resolve`, and
|
|
936
|
+
* `fetchBytes`; `fetchStream` and `delete` are optional. All
|
|
937
|
+
* callbacks must be `async` (or return a `Promise`).
|
|
938
|
+
*
|
|
939
|
+
* Argument shapes seen by JS:
|
|
940
|
+
*
|
|
941
|
+
* - `put(body, hint)`: `body` is a JSON-tagged
|
|
942
|
+
* [`ContentBody`] (`{type: "bytes", data: number[]}`,
|
|
943
|
+
* `{type: "url", url: string}`, `{type: "local_path", path: string}`,
|
|
944
|
+
* or `{type: "provider_file", provider: string, id: string}`).
|
|
945
|
+
* `hint` is a [`ContentHint`] dict (all fields optional). Must
|
|
946
|
+
* resolve with a [`ContentHandle`]-shaped object
|
|
947
|
+
* `{id, kind, mimeType?, byteSize?, displayName?}`.
|
|
948
|
+
* - `resolve(handle)`: `handle` is a [`ContentHandle`] dict. Must
|
|
949
|
+
* resolve with a serialized [`MediaSource`] object
|
|
950
|
+
* (e.g. `{type: "url", url: "..."}`).
|
|
951
|
+
* - `fetchBytes(handle)`: must resolve with a `Buffer`,
|
|
952
|
+
* `Uint8Array`, or `number[]` of bytes.
|
|
953
|
+
* - `fetchStream(handle)` (optional): may resolve with either bytes
|
|
954
|
+
* (`Buffer` / `Uint8Array` / `number[]` / base64 string) or an
|
|
955
|
+
* `AsyncIterable<Uint8Array>` for chunk-by-chunk streaming.
|
|
956
|
+
* - `delete(handle)` (optional): must resolve with `undefined`.
|
|
957
|
+
*/
|
|
958
|
+
static custom(options: CustomContentStoreOptions): ContentStore
|
|
959
|
+
/**
|
|
960
|
+
* Persist content and return a freshly-issued handle.
|
|
961
|
+
*
|
|
962
|
+
* `body` is either:
|
|
963
|
+
* - a `Buffer` — inline bytes uploaded to the store, or
|
|
964
|
+
* - a `string` — interpreted as a URL when it contains `"://"` (the
|
|
965
|
+
* store records the reference) and as a local filesystem path
|
|
966
|
+
* otherwise (the store reads or copies the file as needed).
|
|
967
|
+
*/
|
|
968
|
+
put(body: Buffer | string, options: PutOptions): Promise<JsContentHandle>
|
|
969
|
+
/**
|
|
970
|
+
* Resolve a handle to a wire-renderable [`MediaSource`] (returned as a
|
|
971
|
+
* JS object — the same JSON shape Blazen's request builders accept).
|
|
972
|
+
*/
|
|
973
|
+
resolve(handle: JsContentHandle): Promise<any>
|
|
974
|
+
/**
|
|
975
|
+
* Fetch raw bytes for a handle. Tools that need to operate on the
|
|
976
|
+
* actual content (parse a PDF, transcribe audio) call this; most tools
|
|
977
|
+
* reason over the handle and let `resolve` produce the wire form.
|
|
978
|
+
*/
|
|
979
|
+
fetchBytes(handle: JsContentHandle): Promise<Buffer>
|
|
980
|
+
/**
|
|
981
|
+
* Stream raw bytes for a handle chunk-by-chunk.
|
|
982
|
+
*
|
|
983
|
+
* Returns a `Promise<AsyncIterable<Uint8Array>>`. Each `next()` call on
|
|
984
|
+
* the iterator pulls one chunk from the underlying [`ByteStream`]; the
|
|
985
|
+
* iterator is automatically `done` once the stream completes. Errors
|
|
986
|
+
* surfaced mid-stream reject the corresponding `next()` promise.
|
|
987
|
+
*
|
|
988
|
+
* Useful for large payloads where holding the entire body in a
|
|
989
|
+
* [`Buffer`] would be wasteful — pipe directly into a file, an HTTP
|
|
990
|
+
* response, or another transform without buffering.
|
|
991
|
+
*
|
|
992
|
+
* Built-in stores that lack a native streaming path fall back to a
|
|
993
|
+
* single-chunk iterator over [`Self::fetch_bytes`].
|
|
994
|
+
*/
|
|
995
|
+
fetchStream(handle: JsContentHandle): Promise<AsyncIterable<Uint8Array>>
|
|
996
|
+
/** Cheap metadata lookup without materializing the bytes. */
|
|
997
|
+
metadata(handle: JsContentHandle): Promise<JsContentMetadata>
|
|
998
|
+
/**
|
|
999
|
+
* Optional cleanup — remove the handle from the store. Default
|
|
1000
|
+
* implementations on most stores are no-ops.
|
|
1001
|
+
*/
|
|
1002
|
+
delete(handle: JsContentHandle): Promise<void>
|
|
1003
|
+
/**
|
|
1004
|
+
* Build a filesystem-backed store rooted at `root`. The directory is
|
|
1005
|
+
* created if it doesn't yet exist.
|
|
1006
|
+
*/
|
|
1007
|
+
static localFile(root: string): ContentStore
|
|
1008
|
+
}
|
|
1009
|
+
export type JsContentStore = ContentStore
|
|
1010
|
+
|
|
904
1011
|
/**
|
|
905
1012
|
* Shared workflow context accessible by all steps.
|
|
906
1013
|
*
|
|
@@ -1752,6 +1859,54 @@ export declare class HttpClient {
|
|
|
1752
1859
|
}
|
|
1753
1860
|
export type JsHttpClient = HttpClient
|
|
1754
1861
|
|
|
1862
|
+
/**
|
|
1863
|
+
* HTTP/JSON peer client. Mirrors
|
|
1864
|
+
* [`crate::peer::client::JsBlazenPeerClient`]'s method surface but speaks
|
|
1865
|
+
* pure HTTP/JSON to a peer (or peer-shim) at `baseUrl`. Available on every
|
|
1866
|
+
* target — including `wasm32-wasip1*` where the gRPC client doesn't
|
|
1867
|
+
* compile.
|
|
1868
|
+
*
|
|
1869
|
+
* ```typescript
|
|
1870
|
+
* const client = HttpPeerClient.newHttp("https://peer.example.com", "node-a");
|
|
1871
|
+
* const resp = await client.invokeSubWorkflow({
|
|
1872
|
+
* workflowName: "summarize",
|
|
1873
|
+
* stepIds: ["fetch", "summarize"],
|
|
1874
|
+
* input: { url: "https://example.com" },
|
|
1875
|
+
* timeoutSecs: 60,
|
|
1876
|
+
* });
|
|
1877
|
+
* ```
|
|
1878
|
+
*/
|
|
1879
|
+
export declare class HttpPeerClient {
|
|
1880
|
+
/**
|
|
1881
|
+
* Build a new HTTP/JSON peer client.
|
|
1882
|
+
*
|
|
1883
|
+
* `baseUrl` is the peer's HTTP root (e.g.
|
|
1884
|
+
* `https://peer.example.com`); a trailing slash is tolerated and
|
|
1885
|
+
* trimmed before each request. `nodeId` identifies this caller in
|
|
1886
|
+
* trace logs and is sent to the peer as the
|
|
1887
|
+
* `X-Blazen-Peer-Node-Id` header.
|
|
1888
|
+
*
|
|
1889
|
+
* On wasi the underlying HTTP client comes from a
|
|
1890
|
+
* [`blazen_llm::http_napi_wasi::LazyHttpClient`] proxy that defers
|
|
1891
|
+
* to whatever the host registered via `setDefaultHttpClient`. On
|
|
1892
|
+
* native a stock [`blazen_llm::ReqwestHttpClient`] is used.
|
|
1893
|
+
*/
|
|
1894
|
+
static newHttp(baseUrl: string, nodeId: string): HttpPeerClient
|
|
1895
|
+
/** Invoke a sub-workflow on the connected peer. */
|
|
1896
|
+
invokeSubWorkflow(request: JsSubWorkflowRequest): Promise<JsSubWorkflowResponse>
|
|
1897
|
+
/**
|
|
1898
|
+
* Dereference a remote session ref. Returns the raw bytes of the
|
|
1899
|
+
* underlying value and the envelope version of the response.
|
|
1900
|
+
*/
|
|
1901
|
+
derefSessionRef(request: JsDerefRequest): Promise<JsDerefResponse>
|
|
1902
|
+
/**
|
|
1903
|
+
* Release (drop) a remote session ref. Returns whether the ref was
|
|
1904
|
+
* found and released on the origin node.
|
|
1905
|
+
*/
|
|
1906
|
+
releaseSessionRef(request: JsReleaseRequest): Promise<JsReleaseResponse>
|
|
1907
|
+
}
|
|
1908
|
+
export type JsHttpPeerClient = HttpPeerClient
|
|
1909
|
+
|
|
1755
1910
|
/**
|
|
1756
1911
|
* Base class for custom image-generation providers.
|
|
1757
1912
|
*
|
|
@@ -2236,20 +2391,12 @@ export declare class Memory {
|
|
|
2236
2391
|
* @param backend - An `InMemoryBackend` instance.
|
|
2237
2392
|
*/
|
|
2238
2393
|
constructor(embedder: EmbeddingModel, backend: InMemoryBackend)
|
|
2239
|
-
/** Create a memory store with an embedding model and a `JsonlBackend`. */
|
|
2240
|
-
static withJsonl(embedder: EmbeddingModel, backend: JsonlBackend): Memory
|
|
2241
|
-
/** Create a memory store with an embedding model and a `ValkeyBackend`. */
|
|
2242
|
-
static withValkey(embedder: EmbeddingModel, backend: ValkeyBackend): Memory
|
|
2243
2394
|
/**
|
|
2244
2395
|
* Create a memory store in local-only mode (no embedding model) with an `InMemoryBackend`.
|
|
2245
2396
|
*
|
|
2246
2397
|
* Only `searchLocal()` is available; `search()` will throw.
|
|
2247
2398
|
*/
|
|
2248
2399
|
static local(backend: InMemoryBackend): Memory
|
|
2249
|
-
/** Create a memory store in local-only mode with a `JsonlBackend`. */
|
|
2250
|
-
static localJsonl(backend: JsonlBackend): Memory
|
|
2251
|
-
/** Create a memory store in local-only mode with a `ValkeyBackend`. */
|
|
2252
|
-
static localValkey(backend: ValkeyBackend): Memory
|
|
2253
2400
|
/**
|
|
2254
2401
|
* Add a text entry to the memory store.
|
|
2255
2402
|
*
|
|
@@ -2305,6 +2452,18 @@ export declare class Memory {
|
|
|
2305
2452
|
delete(id: string): Promise<boolean>
|
|
2306
2453
|
/** Return the number of entries in the store. */
|
|
2307
2454
|
count(): Promise<number>
|
|
2455
|
+
/** Create a memory store with an embedding model and a `JsonlBackend`. */
|
|
2456
|
+
static withJsonl(embedder: EmbeddingModel, backend: JsonlBackend): Memory
|
|
2457
|
+
/** Create a memory store with an embedding model and a `ValkeyBackend`. */
|
|
2458
|
+
static withValkey(embedder: EmbeddingModel, backend: ValkeyBackend): Memory
|
|
2459
|
+
/** Create a memory store in local-only mode with a `JsonlBackend`. */
|
|
2460
|
+
static localJsonl(backend: JsonlBackend): Memory
|
|
2461
|
+
/** Create a memory store in local-only mode with a `ValkeyBackend`. */
|
|
2462
|
+
static localValkey(backend: ValkeyBackend): Memory
|
|
2463
|
+
/** Create a memory store with an embedding model and an `UpstashBackend`. */
|
|
2464
|
+
static withUpstash(embedder: EmbeddingModel, backend: UpstashBackend): Memory
|
|
2465
|
+
/** Create a memory store in local-only mode with an `UpstashBackend`. */
|
|
2466
|
+
static localUpstash(backend: UpstashBackend): Memory
|
|
2308
2467
|
}
|
|
2309
2468
|
export type JsMemory = Memory
|
|
2310
2469
|
|
|
@@ -2954,6 +3113,48 @@ export declare class ParallelSubWorkflowsStep {
|
|
|
2954
3113
|
}
|
|
2955
3114
|
export type JsParallelSubWorkflowsStep = ParallelSubWorkflowsStep
|
|
2956
3115
|
|
|
3116
|
+
/**
|
|
3117
|
+
* Abstract base class for custom peer-client transports.
|
|
3118
|
+
*
|
|
3119
|
+
* Mirrors [`blazen_core::distributed::PeerClient`]. Subclass and
|
|
3120
|
+
* override `invokeSubWorkflow`, `derefSessionRef`, and
|
|
3121
|
+
* `releaseSessionRef` to plug a JS-side transport into Blazen's
|
|
3122
|
+
* distributed-execution surface. The canonical gRPC implementation
|
|
3123
|
+
* lives in `BlazenPeerClient`
|
|
3124
|
+
* ([`crate::peer::JsBlazenPeerClient`]); this base exists for callers
|
|
3125
|
+
* who want to swap in a different transport (HTTP, NATS, an in-process
|
|
3126
|
+
* mock for tests, etc.) without touching the Rust core.
|
|
3127
|
+
*
|
|
3128
|
+
* ```javascript
|
|
3129
|
+
* class MyTransport extends PeerClient {
|
|
3130
|
+
* async invokeSubWorkflow(request) { /* ... *\/ }
|
|
3131
|
+
* async derefSessionRef(refUuid) { /* ... *\/ }
|
|
3132
|
+
* async releaseSessionRef(refUuid) { /* ... *\/ }
|
|
3133
|
+
* }
|
|
3134
|
+
* ```
|
|
3135
|
+
*/
|
|
3136
|
+
export declare class PeerClient {
|
|
3137
|
+
/** Create a new peer-client base instance. */
|
|
3138
|
+
constructor()
|
|
3139
|
+
/**
|
|
3140
|
+
* Invoke a sub-workflow on the remote peer. Subclasses **must**
|
|
3141
|
+
* override this method.
|
|
3142
|
+
*/
|
|
3143
|
+
invokeSubWorkflow(request: JsRemoteWorkflowRequest): Promise<JsRemoteWorkflowResponse>
|
|
3144
|
+
/**
|
|
3145
|
+
* Dereference a remote session ref by UUID. Returns the raw
|
|
3146
|
+
* payload bytes. Subclasses **must** override this method.
|
|
3147
|
+
*/
|
|
3148
|
+
derefSessionRef(refUuid: string): Promise<Buffer>
|
|
3149
|
+
/**
|
|
3150
|
+
* Release (drop) a remote session ref on the origin node.
|
|
3151
|
+
* Returns `true` when the ref was found and dropped, `false` when
|
|
3152
|
+
* it was already gone. Subclasses **must** override this method.
|
|
3153
|
+
*/
|
|
3154
|
+
releaseSessionRef(refUuid: string): Promise<boolean>
|
|
3155
|
+
}
|
|
3156
|
+
export type JsPeerClient = PeerClient
|
|
3157
|
+
|
|
2957
3158
|
/** A Perplexity chat completion provider. */
|
|
2958
3159
|
export declare class PerplexityProvider {
|
|
2959
3160
|
/** Create a new Perplexity provider. */
|
|
@@ -3486,8 +3687,10 @@ export declare class RetryMemoryBackend {
|
|
|
3486
3687
|
static wrapJsonl(backend: JsonlBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
3487
3688
|
/** Wrap a `ValkeyBackend` with retry-on-transient-error behaviour. */
|
|
3488
3689
|
static wrapValkey(backend: ValkeyBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
3690
|
+
/** Wrap an `UpstashBackend` with retry-on-transient-error behaviour. */
|
|
3691
|
+
static wrapUpstash(backend: UpstashBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
3489
3692
|
/**
|
|
3490
|
-
* Generic factory accepting any of the
|
|
3693
|
+
* Generic factory accepting any of the four concrete backends. Useful
|
|
3491
3694
|
* when the caller doesn't statically know which backend is in hand.
|
|
3492
3695
|
*/
|
|
3493
3696
|
static wrap(backend: AnyBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
@@ -3996,6 +4199,35 @@ export declare class ThreeDProvider {
|
|
|
3996
4199
|
}
|
|
3997
4200
|
export type JsThreeDProvider = ThreeDProvider
|
|
3998
4201
|
|
|
4202
|
+
/**
|
|
4203
|
+
* Exact BPE token counter backed by `tiktoken-rs`.
|
|
4204
|
+
*
|
|
4205
|
+
* Mirrors the per-message overhead rules documented by `OpenAI` for GPT-3.5,
|
|
4206
|
+
* GPT-4, GPT-4.1, and o-series models. Unknown model names return an error.
|
|
4207
|
+
*
|
|
4208
|
+
* ```javascript
|
|
4209
|
+
* const counter = TiktokenCounter.forModel("gpt-4o");
|
|
4210
|
+
* const n = counter.countTokens("Hello, world!");
|
|
4211
|
+
* ```
|
|
4212
|
+
*/
|
|
4213
|
+
export declare class TiktokenCounter {
|
|
4214
|
+
/**
|
|
4215
|
+
* Create a counter tuned for the given model name.
|
|
4216
|
+
*
|
|
4217
|
+
* Throws if the model is unknown to `tiktoken-rs`.
|
|
4218
|
+
*/
|
|
4219
|
+
static forModel(model: string): TiktokenCounter
|
|
4220
|
+
/** Count tokens in a raw text string. */
|
|
4221
|
+
countTokens(text: string): number
|
|
4222
|
+
/** Count tokens for an array of chat messages, including per-message overhead. */
|
|
4223
|
+
countMessageTokens(messages: Array<ChatMessage>): number
|
|
4224
|
+
/** The model's context window size in tokens. */
|
|
4225
|
+
contextSize(): number
|
|
4226
|
+
/** Tokens remaining after the given prompt, saturating at zero. */
|
|
4227
|
+
remainingTokens(messages: Array<ChatMessage>): number
|
|
4228
|
+
}
|
|
4229
|
+
export type JsTiktokenCounter = TiktokenCounter
|
|
4230
|
+
|
|
3999
4231
|
/** A Together AI chat completion provider. */
|
|
4000
4232
|
export declare class TogetherProvider {
|
|
4001
4233
|
/** Create a new Together provider. */
|
|
@@ -4341,6 +4573,37 @@ export declare class TypedTool {
|
|
|
4341
4573
|
}
|
|
4342
4574
|
export type JsTypedTool = TypedTool
|
|
4343
4575
|
|
|
4576
|
+
/**
|
|
4577
|
+
* An Upstash Redis REST-backed backend for the memory store.
|
|
4578
|
+
*
|
|
4579
|
+
* Wasi-compatible alternative to [`JsValkeyBackend`] for Cloudflare Workers,
|
|
4580
|
+
* Deno, and other wasi hosts that cannot use raw TCP. Talks to Upstash's
|
|
4581
|
+
* REST API over the host-registered HTTP client (set via
|
|
4582
|
+
* `setDefaultHttpClient`).
|
|
4583
|
+
*
|
|
4584
|
+
* ```javascript
|
|
4585
|
+
* const backend = UpstashBackend.create("https://us1-merry-cat-32242.upstash.io", "AYAg...");
|
|
4586
|
+
* const memory = Memory.withUpstash(embedder, backend);
|
|
4587
|
+
* ```
|
|
4588
|
+
*/
|
|
4589
|
+
export declare class UpstashBackend {
|
|
4590
|
+
/**
|
|
4591
|
+
* Create an Upstash REST backend.
|
|
4592
|
+
*
|
|
4593
|
+
* `restUrl` is the Upstash REST endpoint (e.g.
|
|
4594
|
+
* `https://us1-merry-cat-32242.upstash.io`). `restToken` is the REST
|
|
4595
|
+
* token, sent as a `Bearer` token on every request. The HTTP client is
|
|
4596
|
+
* resolved via `setDefaultHttpClient` — call that before issuing any
|
|
4597
|
+
* memory operations.
|
|
4598
|
+
*
|
|
4599
|
+
* `prefix` overrides the default key prefix (`blazen:memory:`). Pass
|
|
4600
|
+
* `null`/`undefined` for the default. Useful when running multiple
|
|
4601
|
+
* logical stores against the same Upstash database.
|
|
4602
|
+
*/
|
|
4603
|
+
static create(restUrl: string, restToken: string, prefix?: string | undefined | null): UpstashBackend
|
|
4604
|
+
}
|
|
4605
|
+
export type JsUpstashBackend = UpstashBackend
|
|
4606
|
+
|
|
4344
4607
|
/**
|
|
4345
4608
|
* A sink for emitted [`JsUsageEvent`]s.
|
|
4346
4609
|
*
|
|
@@ -4827,21 +5090,6 @@ export declare class WorkflowBuilder {
|
|
|
4827
5090
|
* `crates/blazen-node/Cargo.toml`.
|
|
4828
5091
|
*/
|
|
4829
5092
|
withHistory(): this
|
|
4830
|
-
/**
|
|
4831
|
-
* Attach a checkpoint store to the workflow.
|
|
4832
|
-
*
|
|
4833
|
-
* Mirrors [`blazen_core::WorkflowBuilder::checkpoint_store`]. The
|
|
4834
|
-
* underlying call is gated on the `persist` feature of
|
|
4835
|
-
* `blazen-core`, which is **not** currently enabled in the Node
|
|
4836
|
-
* binding's compilation. The flag is recorded on the builder for
|
|
4837
|
-
* forward compatibility but does not yet flow into the core
|
|
4838
|
-
* engine — pass a [`JsCheckpointStore`] (typically a concrete
|
|
4839
|
-
* subclass like `RedbCheckpointStore` or `ValkeyCheckpointStore`)
|
|
4840
|
-
* so the JS API is stable; the binding will start forwarding the
|
|
4841
|
-
* store once the `blazen-core/persist` feature is enabled in
|
|
4842
|
-
* `crates/blazen-node/Cargo.toml`.
|
|
4843
|
-
*/
|
|
4844
|
-
checkpointStore(store: CheckpointStore): this
|
|
4845
5093
|
/**
|
|
4846
5094
|
* Enable or disable automatic checkpointing after each step
|
|
4847
5095
|
* completes. Same forward-compatibility caveat as
|
|
@@ -4861,6 +5109,21 @@ export declare class WorkflowBuilder {
|
|
|
4861
5109
|
* are enabled in the Node binding's `Cargo.toml`.
|
|
4862
5110
|
*/
|
|
4863
5111
|
build(): Workflow
|
|
5112
|
+
/**
|
|
5113
|
+
* Attach a checkpoint store to the workflow.
|
|
5114
|
+
*
|
|
5115
|
+
* Mirrors [`blazen_core::WorkflowBuilder::checkpoint_store`]. The
|
|
5116
|
+
* underlying call is gated on the `persist` feature of
|
|
5117
|
+
* `blazen-core`, which is **not** currently enabled in the Node
|
|
5118
|
+
* binding's compilation. The flag is recorded on the builder for
|
|
5119
|
+
* forward compatibility but does not yet flow into the core
|
|
5120
|
+
* engine — pass a [`JsCheckpointStore`] (typically a concrete
|
|
5121
|
+
* subclass like `RedbCheckpointStore` or `ValkeyCheckpointStore`)
|
|
5122
|
+
* so the JS API is stable; the binding will start forwarding the
|
|
5123
|
+
* store once the `blazen-core/persist` feature is enabled in
|
|
5124
|
+
* `crates/blazen-node/Cargo.toml`.
|
|
5125
|
+
*/
|
|
5126
|
+
checkpointStore(store: CheckpointStore): this
|
|
4864
5127
|
}
|
|
4865
5128
|
export type JsWorkflowBuilder = WorkflowBuilder
|
|
4866
5129
|
|
|
@@ -5181,6 +5444,12 @@ export interface AgentEvent {
|
|
|
5181
5444
|
hadToolCalls?: boolean
|
|
5182
5445
|
}
|
|
5183
5446
|
|
|
5447
|
+
/** Build a JSON Schema declaring a single required audio-handle input. */
|
|
5448
|
+
export declare function audioInput(name: string, description: string): any
|
|
5449
|
+
|
|
5450
|
+
/** Build a JSON Schema declaring a single required CAD-file-handle input. */
|
|
5451
|
+
export declare function cadInput(name: string, description: string): any
|
|
5452
|
+
|
|
5184
5453
|
/** Configuration passed to any capability provider constructor. */
|
|
5185
5454
|
export interface CapabilityProviderConfig {
|
|
5186
5455
|
/** Short identifier for this provider (e.g. `"elevenlabs"`, `"fal"`). */
|
|
@@ -5410,6 +5679,45 @@ export declare function computeVideoCost(modelId: string, seconds: number): numb
|
|
|
5410
5679
|
*/
|
|
5411
5680
|
export declare function countMessageTokens(messages: Array<ChatMessage>, contextSize?: number | undefined | null): number
|
|
5412
5681
|
|
|
5682
|
+
/**
|
|
5683
|
+
* Plain object passed to [`JsContentStore::custom`].
|
|
5684
|
+
*
|
|
5685
|
+
* Each property is the JS-side implementation of one of the trait's
|
|
5686
|
+
* methods. `put`, `resolve`, and `fetchBytes` are required; `fetchStream`
|
|
5687
|
+
* and `delete` are optional.
|
|
5688
|
+
*
|
|
5689
|
+
* All callbacks must be `async` (or return a `Promise`) and accept the
|
|
5690
|
+
* JSON shapes defined by [`ContentBody`] / [`ContentHint`] /
|
|
5691
|
+
* [`ContentHandle`] on the input side; outputs are deserialized into the
|
|
5692
|
+
* matching Rust types. See [`JsHostContentStore`] for the per-method
|
|
5693
|
+
* payload shapes.
|
|
5694
|
+
*
|
|
5695
|
+
* `name` is a short identifier used in error / tracing messages; defaults
|
|
5696
|
+
* to `"custom"`.
|
|
5697
|
+
*/
|
|
5698
|
+
export interface CustomContentStoreOptions {
|
|
5699
|
+
/** Required: persist content, return a handle. */
|
|
5700
|
+
put: (body: ContentBody, hint: ContentHint) => Promise<ContentHandle>
|
|
5701
|
+
/** Required: turn a handle into a wire-renderable [`MediaSource`]. */
|
|
5702
|
+
resolve: (handle: ContentHandle) => Promise<MediaSource>
|
|
5703
|
+
/**
|
|
5704
|
+
* Required: fetch raw bytes for a handle (`Buffer` | `Uint8Array` |
|
|
5705
|
+
* `number[]`).
|
|
5706
|
+
*/
|
|
5707
|
+
fetchBytes: (handle: ContentHandle) => Promise<Buffer | Uint8Array | number[] | string>
|
|
5708
|
+
/**
|
|
5709
|
+
* Optional: stream raw bytes; absent falls back to `fetchBytes`. May
|
|
5710
|
+
* resolve with bytes (`Buffer` / `Uint8Array` / `number[]` / base64
|
|
5711
|
+
* string) or an `AsyncIterable<Uint8Array>` for true chunk-by-chunk
|
|
5712
|
+
* streaming.
|
|
5713
|
+
*/
|
|
5714
|
+
fetchStream?: (handle: ContentHandle) => Promise<Buffer | Uint8Array | number[] | string | AsyncIterable<Uint8Array>>
|
|
5715
|
+
/** Optional: cleanup hook; absent is a no-op. */
|
|
5716
|
+
delete?: (handle: ContentHandle) => Promise<void>
|
|
5717
|
+
/** Optional human-readable identifier for logs (default: `"custom"`). */
|
|
5718
|
+
name?: string
|
|
5719
|
+
}
|
|
5720
|
+
|
|
5413
5721
|
/** Optional configuration for a [`JsCustomProvider`]. */
|
|
5414
5722
|
export interface CustomProviderOptions {
|
|
5415
5723
|
/**
|
|
@@ -5520,6 +5828,9 @@ export interface FileContent {
|
|
|
5520
5828
|
filename?: string
|
|
5521
5829
|
}
|
|
5522
5830
|
|
|
5831
|
+
/** Build a JSON Schema declaring a single required document/file-handle input. */
|
|
5832
|
+
export declare function fileInput(name: string, description: string): any
|
|
5833
|
+
|
|
5523
5834
|
/**
|
|
5524
5835
|
* Canonical name of the built-in `finish_workflow` exit tool. Mirrors
|
|
5525
5836
|
* [`blazen_llm::FINISH_WORKFLOW_TOOL_NAME`].
|
|
@@ -5634,6 +5945,15 @@ export interface HttpClientConfig {
|
|
|
5634
5945
|
userAgent?: string
|
|
5635
5946
|
}
|
|
5636
5947
|
|
|
5948
|
+
/**
|
|
5949
|
+
* Build a JSON Schema declaring a single required image-handle input.
|
|
5950
|
+
*
|
|
5951
|
+
* The model fills the property with a content-handle id string; Blazen
|
|
5952
|
+
* resolves it against the active [`super::store::JsContentStore`] before
|
|
5953
|
+
* the tool's handler runs.
|
|
5954
|
+
*/
|
|
5955
|
+
export declare function imageInput(name: string, description: string): any
|
|
5956
|
+
|
|
5637
5957
|
/**
|
|
5638
5958
|
* Initialize the Langfuse exporter and install it as a layer on the global
|
|
5639
5959
|
* `tracing` subscriber.
|
|
@@ -5647,6 +5967,32 @@ export interface HttpClientConfig {
|
|
|
5647
5967
|
*/
|
|
5648
5968
|
export declare function initLangfuse(config: LangfuseConfig): void
|
|
5649
5969
|
|
|
5970
|
+
/**
|
|
5971
|
+
* Initialize the OTLP trace exporter and install the global tracing
|
|
5972
|
+
* subscriber.
|
|
5973
|
+
*
|
|
5974
|
+
* Calling this more than once in a single process will fail because the
|
|
5975
|
+
* global subscriber can only be installed once.
|
|
5976
|
+
*/
|
|
5977
|
+
export declare function initOtlp(config: OtlpConfig): void
|
|
5978
|
+
|
|
5979
|
+
/**
|
|
5980
|
+
* Initialize the Prometheus metrics exporter and start its HTTP listener
|
|
5981
|
+
* on `0.0.0.0:{port}`.
|
|
5982
|
+
*
|
|
5983
|
+
* After calling this, every workflow / step / LLM span emitted via the
|
|
5984
|
+
* `tracing` infrastructure feeds into counters and histograms exposed at
|
|
5985
|
+
* `http://0.0.0.0:{port}/metrics` for Prometheus to scrape.
|
|
5986
|
+
*
|
|
5987
|
+
* ```javascript
|
|
5988
|
+
* initPrometheus(9100);
|
|
5989
|
+
* ```
|
|
5990
|
+
*
|
|
5991
|
+
* Calling this more than once in a single process will fail because the
|
|
5992
|
+
* global recorder can only be installed once.
|
|
5993
|
+
*/
|
|
5994
|
+
export declare function initPrometheus(port: number): void
|
|
5995
|
+
|
|
5650
5996
|
/**
|
|
5651
5997
|
* A request for human input emitted by a workflow step.
|
|
5652
5998
|
*
|
|
@@ -5986,6 +6332,59 @@ export interface JsComputeResult {
|
|
|
5986
6332
|
metadata: any
|
|
5987
6333
|
}
|
|
5988
6334
|
|
|
6335
|
+
/**
|
|
6336
|
+
* Reference to content stored in a [`super::store::JsContentStore`].
|
|
6337
|
+
*
|
|
6338
|
+
* Mirrors [`blazen_llm::content::ContentHandle`]. Pass instances to a
|
|
6339
|
+
* store's `resolve` / `fetchBytes` / `metadata` / `delete` methods, or
|
|
6340
|
+
* embed the `id` in tool arguments where a content reference is expected.
|
|
6341
|
+
*/
|
|
6342
|
+
export interface JsContentHandle {
|
|
6343
|
+
/** Opaque, store-defined identifier. Treat as a black box. */
|
|
6344
|
+
id: string
|
|
6345
|
+
/** What kind of content this handle refers to. */
|
|
6346
|
+
kind: JsContentKind
|
|
6347
|
+
/** MIME type if known. */
|
|
6348
|
+
mimeType?: string
|
|
6349
|
+
/** Byte size if known. `i64` because napi has no `u64`. */
|
|
6350
|
+
byteSize?: number
|
|
6351
|
+
/** Human-readable display name (e.g. original filename). */
|
|
6352
|
+
displayName?: string
|
|
6353
|
+
}
|
|
6354
|
+
|
|
6355
|
+
/**
|
|
6356
|
+
* Taxonomy of multimodal content kinds. Mirrors
|
|
6357
|
+
* [`blazen_llm::content::ContentKind`].
|
|
6358
|
+
*
|
|
6359
|
+
* String values match the JSON / `serde` tag (`"image"`, `"three_d_model"`,
|
|
6360
|
+
* etc.) so they can be round-tripped against any Blazen API that accepts a
|
|
6361
|
+
* kind string.
|
|
6362
|
+
*/
|
|
6363
|
+
export declare const enum JsContentKind {
|
|
6364
|
+
Image = 'image',
|
|
6365
|
+
Audio = 'audio',
|
|
6366
|
+
Video = 'video',
|
|
6367
|
+
Document = 'document',
|
|
6368
|
+
ThreeDModel = 'three_d_model',
|
|
6369
|
+
Cad = 'cad',
|
|
6370
|
+
Archive = 'archive',
|
|
6371
|
+
Font = 'font',
|
|
6372
|
+
Code = 'code',
|
|
6373
|
+
Data = 'data',
|
|
6374
|
+
Other = 'other'
|
|
6375
|
+
}
|
|
6376
|
+
|
|
6377
|
+
/**
|
|
6378
|
+
* Cheap metadata summary returned by
|
|
6379
|
+
* [`JsContentStore::metadata`](JsContentStore::metadata).
|
|
6380
|
+
*/
|
|
6381
|
+
export interface JsContentMetadata {
|
|
6382
|
+
kind: JsContentKind
|
|
6383
|
+
mimeType?: string
|
|
6384
|
+
byteSize?: number
|
|
6385
|
+
displayName?: string
|
|
6386
|
+
}
|
|
6387
|
+
|
|
5989
6388
|
/**
|
|
5990
6389
|
* A single part in a multi-part message.
|
|
5991
6390
|
*
|
|
@@ -6268,11 +6667,38 @@ export interface JsImageResult {
|
|
|
6268
6667
|
metadata: any
|
|
6269
6668
|
}
|
|
6270
6669
|
|
|
6271
|
-
/**
|
|
6670
|
+
/**
|
|
6671
|
+
* How an image / audio / video / file is provided.
|
|
6672
|
+
*
|
|
6673
|
+
* `sourceType` is one of:
|
|
6674
|
+
* - `"url"` — set `url` to a public URL.
|
|
6675
|
+
* - `"base64"` — set `data` to the base64-encoded payload.
|
|
6676
|
+
* - `"file"` — set `url` to a local filesystem path (local backends only).
|
|
6677
|
+
* - `"providerFile"` — set `provider` and `id` to reference an
|
|
6678
|
+
* already-uploaded file in a provider's file API (`OpenAI` Files,
|
|
6679
|
+
* Anthropic Files, Gemini Files, fal.ai storage).
|
|
6680
|
+
* - `"handle"` — set `handleId` (and optionally `handleKind`) to reference
|
|
6681
|
+
* content registered with a `ContentStore`. The store resolves the
|
|
6682
|
+
* handle at request-build time.
|
|
6683
|
+
*/
|
|
6272
6684
|
export interface JsImageSource {
|
|
6273
6685
|
sourceType: string
|
|
6274
6686
|
url?: string
|
|
6275
6687
|
data?: string
|
|
6688
|
+
/**
|
|
6689
|
+
* Provider name for `sourceType: "providerFile"` (e.g. `"openai"`,
|
|
6690
|
+
* `"anthropic"`, `"gemini"`, `"fal"`).
|
|
6691
|
+
*/
|
|
6692
|
+
provider?: string
|
|
6693
|
+
/** Provider-issued file id for `sourceType: "providerFile"`. */
|
|
6694
|
+
id?: string
|
|
6695
|
+
/** Content handle id for `sourceType: "handle"`. */
|
|
6696
|
+
handleId?: string
|
|
6697
|
+
/**
|
|
6698
|
+
* Content handle kind for `sourceType: "handle"` (e.g. `"image"`,
|
|
6699
|
+
* `"audio"`, `"three_d_model"`). See `ContentKind` for the full set.
|
|
6700
|
+
*/
|
|
6701
|
+
handleKind?: string
|
|
6276
6702
|
}
|
|
6277
6703
|
|
|
6278
6704
|
export interface JsJobHandle {
|
|
@@ -6561,6 +6987,52 @@ export interface JsReleaseResponse {
|
|
|
6561
6987
|
released: boolean
|
|
6562
6988
|
}
|
|
6563
6989
|
|
|
6990
|
+
/**
|
|
6991
|
+
* Transport-agnostic request for invoking a sub-workflow on a remote
|
|
6992
|
+
* peer.
|
|
6993
|
+
*
|
|
6994
|
+
* Mirrors [`blazen_core::distributed::RemoteWorkflowRequest`]. Concrete
|
|
6995
|
+
* transports (gRPC, HTTP, NATS, etc.) serialize this into whatever
|
|
6996
|
+
* wire format they require.
|
|
6997
|
+
*/
|
|
6998
|
+
export interface JsRemoteWorkflowRequest {
|
|
6999
|
+
/** Symbolic name of the workflow to invoke on the remote peer. */
|
|
7000
|
+
workflowName: string
|
|
7001
|
+
/** Ordered list of step IDs to execute as part of this sub-workflow. */
|
|
7002
|
+
stepIds: Array<string>
|
|
7003
|
+
/** Initial input value passed to the workflow's first step. */
|
|
7004
|
+
input: any
|
|
7005
|
+
/**
|
|
7006
|
+
* Optional timeout in seconds. `None` means "use the server's
|
|
7007
|
+
* default deadline".
|
|
7008
|
+
*/
|
|
7009
|
+
timeoutSecs?: number
|
|
7010
|
+
}
|
|
7011
|
+
|
|
7012
|
+
/**
|
|
7013
|
+
* Transport-agnostic response from a remote sub-workflow invocation.
|
|
7014
|
+
*
|
|
7015
|
+
* Mirrors [`blazen_core::distributed::RemoteWorkflowResponse`].
|
|
7016
|
+
*/
|
|
7017
|
+
export interface JsRemoteWorkflowResponse {
|
|
7018
|
+
/**
|
|
7019
|
+
* Optional terminal result. `None` when the workflow exited
|
|
7020
|
+
* without producing one.
|
|
7021
|
+
*/
|
|
7022
|
+
result?: any
|
|
7023
|
+
/**
|
|
7024
|
+
* Descriptors for any session refs the sub-workflow registered
|
|
7025
|
+
* that the parent should be able to dereference remotely. Keyed
|
|
7026
|
+
* by the registry UUID rendered as a string.
|
|
7027
|
+
*/
|
|
7028
|
+
remoteRefs: Record<string, any>
|
|
7029
|
+
/**
|
|
7030
|
+
* Error message if the sub-workflow failed. When `Some`, callers
|
|
7031
|
+
* should ignore `result`.
|
|
7032
|
+
*/
|
|
7033
|
+
error?: string
|
|
7034
|
+
}
|
|
7035
|
+
|
|
6564
7036
|
export interface JsRequestTiming {
|
|
6565
7037
|
queueMs?: number
|
|
6566
7038
|
executionMs?: number
|
|
@@ -7193,6 +7665,35 @@ export declare function newRetryStack(): RetryStack
|
|
|
7193
7665
|
*/
|
|
7194
7666
|
export declare function newUsageEvent(provider: string, model: string, runId: string): UsageEvent
|
|
7195
7667
|
|
|
7668
|
+
/**
|
|
7669
|
+
* Configuration for the OTLP exporter.
|
|
7670
|
+
*
|
|
7671
|
+
* ```javascript
|
|
7672
|
+
* initOtlp({
|
|
7673
|
+
* endpoint: "http://localhost:4317",
|
|
7674
|
+
* serviceName: "my-service",
|
|
7675
|
+
* serviceVersion: "1.0.0",
|
|
7676
|
+
* headers: { "x-api-key": "secret" },
|
|
7677
|
+
* });
|
|
7678
|
+
* ```
|
|
7679
|
+
*/
|
|
7680
|
+
export interface OtlpConfig {
|
|
7681
|
+
/** The OTLP endpoint URL (e.g. `"http://localhost:4317"`). */
|
|
7682
|
+
endpoint: string
|
|
7683
|
+
/** The service name reported to the backend. */
|
|
7684
|
+
serviceName: string
|
|
7685
|
+
/**
|
|
7686
|
+
* Service version reported to the backend (recorded for forward
|
|
7687
|
+
* compatibility; not yet forwarded by the underlying exporter).
|
|
7688
|
+
*/
|
|
7689
|
+
serviceVersion?: string
|
|
7690
|
+
/**
|
|
7691
|
+
* Additional headers to attach to OTLP requests (recorded for forward
|
|
7692
|
+
* compatibility; not yet forwarded by the underlying exporter).
|
|
7693
|
+
*/
|
|
7694
|
+
headers?: Record<string, string>
|
|
7695
|
+
}
|
|
7696
|
+
|
|
7196
7697
|
/**
|
|
7197
7698
|
* Why a workflow was paused.
|
|
7198
7699
|
*
|
|
@@ -7376,6 +7877,24 @@ export declare const enum ProviderId {
|
|
|
7376
7877
|
Fal = 'fal'
|
|
7377
7878
|
}
|
|
7378
7879
|
|
|
7880
|
+
/**
|
|
7881
|
+
* Optional hints attached to a `put` call.
|
|
7882
|
+
*
|
|
7883
|
+
* Mirrors [`blazen_llm::content::ContentHint`] minus its builder API. Every
|
|
7884
|
+
* field is optional; the store may auto-detect from the bytes when a hint is
|
|
7885
|
+
* missing.
|
|
7886
|
+
*/
|
|
7887
|
+
export interface PutOptions {
|
|
7888
|
+
/** MIME type, if known. */
|
|
7889
|
+
mimeType?: string
|
|
7890
|
+
/** Caller's preferred classification — overrides any auto-detection. */
|
|
7891
|
+
kind?: JsContentKind
|
|
7892
|
+
/** Human-readable display name (filename, caption). */
|
|
7893
|
+
displayName?: string
|
|
7894
|
+
/** Byte size, if known up-front. `i64` since napi has no `u64`. */
|
|
7895
|
+
byteSize?: number
|
|
7896
|
+
}
|
|
7897
|
+
|
|
7379
7898
|
/** Options for constructing a [`JsReasoningTraceClass`] from JavaScript. */
|
|
7380
7899
|
export interface ReasoningTraceOptions {
|
|
7381
7900
|
/** Plain-text rendering of the reasoning content. */
|
|
@@ -7819,6 +8338,9 @@ export declare const enum TemplateRole {
|
|
|
7819
8338
|
Assistant = 'Assistant'
|
|
7820
8339
|
}
|
|
7821
8340
|
|
|
8341
|
+
/** Build a JSON Schema declaring a single required 3D-model-handle input. */
|
|
8342
|
+
export declare function threeDInput(name: string, description: string): any
|
|
8343
|
+
|
|
7822
8344
|
/** Options for constructing a [`JsTokenUsageClass`] from JavaScript. */
|
|
7823
8345
|
export interface TokenUsageOptions {
|
|
7824
8346
|
promptTokens: number
|
|
@@ -7977,9 +8499,40 @@ export interface UsageEvent {
|
|
|
7977
8499
|
/** Returns the version of the blazen library. */
|
|
7978
8500
|
export declare function version(): string
|
|
7979
8501
|
|
|
8502
|
+
/** Build a JSON Schema declaring a single required video-handle input. */
|
|
8503
|
+
export declare function videoInput(name: string, description: string): any
|
|
8504
|
+
|
|
7980
8505
|
// --- post-build: type aliases mirroring blazen-llm ---
|
|
7981
8506
|
export type MediaSource = JsImageSource
|
|
7982
8507
|
export type ImageSource = JsImageSource
|
|
8508
|
+
export type ContentHandle = JsContentHandle
|
|
8509
|
+
export type ContentMetadata = JsContentMetadata
|
|
8510
|
+
export type ContentKind = JsContentKind
|
|
8511
|
+
|
|
8512
|
+
// --- post-build: ContentBody / ContentHint helper types ---
|
|
8513
|
+
/**
|
|
8514
|
+
* JSON-tagged body passed to a custom store's `put` callback.
|
|
8515
|
+
*
|
|
8516
|
+
* Mirrors `blazen_llm::content::ContentBody`. The `stream` variant
|
|
8517
|
+
* carries a live `AsyncIterable<Uint8Array>` so chunks flow lazily
|
|
8518
|
+
* from Rust into JS without staging the whole payload in memory.
|
|
8519
|
+
*/
|
|
8520
|
+
export type ContentBody =
|
|
8521
|
+
| { type: 'bytes'; data: Buffer | Uint8Array | number[] }
|
|
8522
|
+
| { type: 'url'; url: string }
|
|
8523
|
+
| { type: 'local_path'; path: string }
|
|
8524
|
+
| { type: 'provider_file'; provider: string; id: string }
|
|
8525
|
+
| { type: 'stream'; stream: AsyncIterable<Uint8Array>; sizeHint: number | null }
|
|
8526
|
+
/**
|
|
8527
|
+
* Optional hints passed alongside a `ContentBody` into `put`.
|
|
8528
|
+
* Mirrors `blazen_llm::content::ContentHint` (every field optional).
|
|
8529
|
+
*/
|
|
8530
|
+
export interface ContentHint {
|
|
8531
|
+
mimeType?: string | null
|
|
8532
|
+
kind?: ContentKind | null
|
|
8533
|
+
displayName?: string | null
|
|
8534
|
+
byteSize?: number | null
|
|
8535
|
+
}
|
|
7983
8536
|
|
|
7984
8537
|
// --- post-build: typed error classes ---
|
|
7985
8538
|
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
|
|
@@ -658,6 +660,8 @@ module.exports.HostDispatch = nativeBinding.HostDispatch
|
|
|
658
660
|
module.exports.JsHostDispatch = nativeBinding.JsHostDispatch
|
|
659
661
|
module.exports.HttpClient = nativeBinding.HttpClient
|
|
660
662
|
module.exports.JsHttpClient = nativeBinding.JsHttpClient
|
|
663
|
+
module.exports.HttpPeerClient = nativeBinding.HttpPeerClient
|
|
664
|
+
module.exports.JsHttpPeerClient = nativeBinding.JsHttpPeerClient
|
|
661
665
|
module.exports.ImageModel = nativeBinding.ImageModel
|
|
662
666
|
module.exports.JsImageModel = nativeBinding.JsImageModel
|
|
663
667
|
module.exports.ImageProvider = nativeBinding.ImageProvider
|
|
@@ -736,6 +740,8 @@ module.exports.ParallelStage = nativeBinding.ParallelStage
|
|
|
736
740
|
module.exports.JsParallelStage = nativeBinding.JsParallelStage
|
|
737
741
|
module.exports.ParallelSubWorkflowsStep = nativeBinding.ParallelSubWorkflowsStep
|
|
738
742
|
module.exports.JsParallelSubWorkflowsStep = nativeBinding.JsParallelSubWorkflowsStep
|
|
743
|
+
module.exports.PeerClient = nativeBinding.PeerClient
|
|
744
|
+
module.exports.JsPeerClient = nativeBinding.JsPeerClient
|
|
739
745
|
module.exports.PerplexityProvider = nativeBinding.PerplexityProvider
|
|
740
746
|
module.exports.JsPerplexityProvider = nativeBinding.JsPerplexityProvider
|
|
741
747
|
module.exports.Pipeline = nativeBinding.Pipeline
|
|
@@ -802,6 +808,8 @@ module.exports.SubWorkflowStep = nativeBinding.SubWorkflowStep
|
|
|
802
808
|
module.exports.JsSubWorkflowStep = nativeBinding.JsSubWorkflowStep
|
|
803
809
|
module.exports.ThreeDProvider = nativeBinding.ThreeDProvider
|
|
804
810
|
module.exports.JsThreeDProvider = nativeBinding.JsThreeDProvider
|
|
811
|
+
module.exports.TiktokenCounter = nativeBinding.TiktokenCounter
|
|
812
|
+
module.exports.JsTiktokenCounter = nativeBinding.JsTiktokenCounter
|
|
805
813
|
module.exports.TogetherProvider = nativeBinding.TogetherProvider
|
|
806
814
|
module.exports.JsTogetherProvider = nativeBinding.JsTogetherProvider
|
|
807
815
|
module.exports.TokenCounter = nativeBinding.TokenCounter
|
|
@@ -822,6 +830,8 @@ module.exports.TTSProvider = nativeBinding.TTSProvider
|
|
|
822
830
|
module.exports.JsTTSProvider = nativeBinding.JsTTSProvider
|
|
823
831
|
module.exports.TypedTool = nativeBinding.TypedTool
|
|
824
832
|
module.exports.JsTypedTool = nativeBinding.JsTypedTool
|
|
833
|
+
module.exports.UpstashBackend = nativeBinding.UpstashBackend
|
|
834
|
+
module.exports.JsUpstashBackend = nativeBinding.JsUpstashBackend
|
|
825
835
|
module.exports.UsageEmitter = nativeBinding.UsageEmitter
|
|
826
836
|
module.exports.JsUsageEmitter = nativeBinding.JsUsageEmitter
|
|
827
837
|
module.exports.UsageRecordingCompletionModel = nativeBinding.UsageRecordingCompletionModel
|
|
@@ -853,6 +863,8 @@ module.exports.JsWorkflowSnapshot = nativeBinding.JsWorkflowSnapshot
|
|
|
853
863
|
module.exports.XaiProvider = nativeBinding.XaiProvider
|
|
854
864
|
module.exports.JsXaiProvider = nativeBinding.JsXaiProvider
|
|
855
865
|
module.exports.addUsageToTokenUsage = nativeBinding.addUsageToTokenUsage
|
|
866
|
+
module.exports.audioInput = nativeBinding.audioInput
|
|
867
|
+
module.exports.cadInput = nativeBinding.cadInput
|
|
856
868
|
module.exports.ChatRole = nativeBinding.ChatRole
|
|
857
869
|
module.exports.JsChatRole = nativeBinding.JsChatRole
|
|
858
870
|
module.exports.completeBatch = nativeBinding.completeBatch
|
|
@@ -868,6 +880,7 @@ module.exports.defaultHttpClientConfig = nativeBinding.defaultHttpClientConfig
|
|
|
868
880
|
module.exports.envVarForProvider = nativeBinding.envVarForProvider
|
|
869
881
|
module.exports.estimateTokens = nativeBinding.estimateTokens
|
|
870
882
|
module.exports.extractInlineArtifacts = nativeBinding.extractInlineArtifacts
|
|
883
|
+
module.exports.fileInput = nativeBinding.fileInput
|
|
871
884
|
module.exports.FINISH_WORKFLOW_TOOL_NAME = nativeBinding.FINISH_WORKFLOW_TOOL_NAME
|
|
872
885
|
module.exports.finishWorkflowTool = nativeBinding.finishWorkflowTool
|
|
873
886
|
module.exports.finishWorkflowToolDef = nativeBinding.finishWorkflowToolDef
|
|
@@ -875,12 +888,16 @@ module.exports.formatProviderHttpTail = nativeBinding.formatProviderHttpTail
|
|
|
875
888
|
module.exports.getContextWindow = nativeBinding.getContextWindow
|
|
876
889
|
module.exports.HistoryEventKindTag = nativeBinding.HistoryEventKindTag
|
|
877
890
|
module.exports.JsHistoryEventKindTag = nativeBinding.JsHistoryEventKindTag
|
|
891
|
+
module.exports.imageInput = nativeBinding.imageInput
|
|
878
892
|
module.exports.initLangfuse = nativeBinding.initLangfuse
|
|
893
|
+
module.exports.initOtlp = nativeBinding.initOtlp
|
|
894
|
+
module.exports.initPrometheus = nativeBinding.initPrometheus
|
|
879
895
|
module.exports.internEventType = nativeBinding.internEventType
|
|
880
896
|
module.exports.JoinStrategy = nativeBinding.JoinStrategy
|
|
881
897
|
module.exports.JsJoinStrategy = nativeBinding.JsJoinStrategy
|
|
882
898
|
module.exports.JsAuthMethod = nativeBinding.JsAuthMethod
|
|
883
899
|
module.exports.JsCacheStrategy = nativeBinding.JsCacheStrategy
|
|
900
|
+
module.exports.JsContentKind = nativeBinding.JsContentKind
|
|
884
901
|
module.exports.JsDiffusionScheduler = nativeBinding.JsDiffusionScheduler
|
|
885
902
|
module.exports.JsFalLlmEndpointKind = nativeBinding.JsFalLlmEndpointKind
|
|
886
903
|
module.exports.JsJobStatus = nativeBinding.JsJobStatus
|
|
@@ -927,10 +944,12 @@ module.exports.StepOutputKind = nativeBinding.StepOutputKind
|
|
|
927
944
|
module.exports.JsStepOutputKind = nativeBinding.JsStepOutputKind
|
|
928
945
|
module.exports.TemplateRole = nativeBinding.TemplateRole
|
|
929
946
|
module.exports.JsTemplateRole = nativeBinding.JsTemplateRole
|
|
947
|
+
module.exports.threeDInput = nativeBinding.threeDInput
|
|
930
948
|
module.exports.tryDeserializeEvent = nativeBinding.tryDeserializeEvent
|
|
931
949
|
module.exports.typedToolSimple = nativeBinding.typedToolSimple
|
|
932
950
|
module.exports.unlimitedHttpClientConfig = nativeBinding.unlimitedHttpClientConfig
|
|
933
951
|
module.exports.version = nativeBinding.version
|
|
952
|
+
module.exports.videoInput = nativeBinding.videoInput
|
|
934
953
|
|
|
935
954
|
// --- post-build: typed-error wrapping ---
|
|
936
955
|
;(() => {
|
|
@@ -1001,9 +1020,27 @@ module.exports.version = nativeBinding.version
|
|
|
1001
1020
|
// emits classes with PascalCase names; we leave those callable as-is
|
|
1002
1021
|
// so `new ClassName(...)` keeps working but their methods are
|
|
1003
1022
|
// already patched above.
|
|
1004
|
-
|
|
1023
|
+
//
|
|
1024
|
+
// Detect "class-ness" via either prototype methods OR own static
|
|
1025
|
+
// properties beyond the built-in function metadata fields. Without the
|
|
1026
|
+
// static-property check, a class whose only public surface is a static
|
|
1027
|
+
// factory (e.g. `UpstashBackend.create`) would slip through and get
|
|
1028
|
+
// replaced with a `wrap()`-returned function that loses the static
|
|
1029
|
+
// method.
|
|
1030
|
+
const FUNCTION_BUILTIN_PROPS = new Set([
|
|
1031
|
+
'length',
|
|
1032
|
+
'name',
|
|
1033
|
+
'arguments',
|
|
1034
|
+
'caller',
|
|
1035
|
+
'prototype',
|
|
1036
|
+
])
|
|
1037
|
+
const ownStaticPropNames = Object.getOwnPropertyNames(orig).filter(
|
|
1038
|
+
(p) => !FUNCTION_BUILTIN_PROPS.has(p),
|
|
1039
|
+
)
|
|
1040
|
+
const hasPrototypeMethods =
|
|
1005
1041
|
orig.prototype &&
|
|
1006
1042
|
Object.getOwnPropertyNames(orig.prototype).some((p) => p !== 'constructor')
|
|
1043
|
+
const isLikelyClass = hasPrototypeMethods || ownStaticPropNames.length > 0
|
|
1007
1044
|
if (!isLikelyClass) {
|
|
1008
1045
|
module.exports[key] = wrap(orig)
|
|
1009
1046
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blazen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.158",
|
|
4
4
|
"description": "Blazen - Event-driven AI workflow framework for Node.js/TypeScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"aarch64-unknown-linux-gnu",
|
|
14
14
|
"aarch64-unknown-linux-musl",
|
|
15
15
|
"aarch64-apple-darwin",
|
|
16
|
-
"x86_64-pc-windows-msvc"
|
|
16
|
+
"x86_64-pc-windows-msvc",
|
|
17
|
+
"wasm32-wasi"
|
|
17
18
|
]
|
|
18
19
|
},
|
|
19
20
|
"publishConfig": {
|
|
@@ -39,8 +40,12 @@
|
|
|
39
40
|
"error-classes.js"
|
|
40
41
|
],
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@napi-rs/cli": "^3.0.0",
|
|
43
43
|
"@biomejs/biome": "^2",
|
|
44
|
+
"@emnapi/core": "^1.10.0",
|
|
45
|
+
"@emnapi/runtime": "^1.10.0",
|
|
46
|
+
"@napi-rs/cli": "^3.0.0",
|
|
47
|
+
"@napi-rs/wasm-runtime": "^1.1.4",
|
|
48
|
+
"@tybys/wasm-util": "^0.10.2",
|
|
44
49
|
"ava": "^6.4.1"
|
|
45
50
|
},
|
|
46
51
|
"engines": {
|
|
@@ -58,12 +63,13 @@
|
|
|
58
63
|
"verbose": true
|
|
59
64
|
},
|
|
60
65
|
"optionalDependencies": {
|
|
61
|
-
"@blazen-dev/blazen-linux-x64-gnu": "0.1.
|
|
62
|
-
"@blazen-dev/blazen-linux-x64-musl": "0.1.
|
|
63
|
-
"@blazen-dev/blazen-linux-arm64-gnu": "0.1.
|
|
64
|
-
"@blazen-dev/blazen-linux-arm64-musl": "0.1.
|
|
65
|
-
"@blazen-dev/blazen-darwin-arm64": "0.1.
|
|
66
|
-
"@blazen-dev/blazen-win32-x64-msvc": "0.1.
|
|
66
|
+
"@blazen-dev/blazen-linux-x64-gnu": "0.1.158",
|
|
67
|
+
"@blazen-dev/blazen-linux-x64-musl": "0.1.158",
|
|
68
|
+
"@blazen-dev/blazen-linux-arm64-gnu": "0.1.158",
|
|
69
|
+
"@blazen-dev/blazen-linux-arm64-musl": "0.1.158",
|
|
70
|
+
"@blazen-dev/blazen-darwin-arm64": "0.1.158",
|
|
71
|
+
"@blazen-dev/blazen-win32-x64-msvc": "0.1.158",
|
|
72
|
+
"@blazen-dev/blazen-wasm32-wasi": "0.1.158"
|
|
67
73
|
},
|
|
68
74
|
"scripts": {
|
|
69
75
|
"build": "napi build --release --platform --features local-all,langfuse --js index.js && node scripts/post-build.mjs",
|