blazen 0.1.157 → 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 +114 -29
- package/index.js +23 -1
- package/package.json +15 -9
package/index.d.ts
CHANGED
|
@@ -920,11 +920,6 @@ export declare class ContentStore {
|
|
|
920
920
|
constructor()
|
|
921
921
|
/** Build a default ephemeral in-memory store. */
|
|
922
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
923
|
/** Build a store backed by the `OpenAI` Files API. */
|
|
929
924
|
static openaiFiles(apiKey: string, baseUrl?: string | undefined | null): ContentStore
|
|
930
925
|
/** Build a store backed by the Anthropic Files API. */
|
|
@@ -1005,6 +1000,11 @@ export declare class ContentStore {
|
|
|
1005
1000
|
* implementations on most stores are no-ops.
|
|
1006
1001
|
*/
|
|
1007
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
1008
|
}
|
|
1009
1009
|
export type JsContentStore = ContentStore
|
|
1010
1010
|
|
|
@@ -1859,6 +1859,54 @@ export declare class HttpClient {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
export type JsHttpClient = HttpClient
|
|
1861
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
|
+
|
|
1862
1910
|
/**
|
|
1863
1911
|
* Base class for custom image-generation providers.
|
|
1864
1912
|
*
|
|
@@ -2343,20 +2391,12 @@ export declare class Memory {
|
|
|
2343
2391
|
* @param backend - An `InMemoryBackend` instance.
|
|
2344
2392
|
*/
|
|
2345
2393
|
constructor(embedder: EmbeddingModel, backend: InMemoryBackend)
|
|
2346
|
-
/** Create a memory store with an embedding model and a `JsonlBackend`. */
|
|
2347
|
-
static withJsonl(embedder: EmbeddingModel, backend: JsonlBackend): Memory
|
|
2348
|
-
/** Create a memory store with an embedding model and a `ValkeyBackend`. */
|
|
2349
|
-
static withValkey(embedder: EmbeddingModel, backend: ValkeyBackend): Memory
|
|
2350
2394
|
/**
|
|
2351
2395
|
* Create a memory store in local-only mode (no embedding model) with an `InMemoryBackend`.
|
|
2352
2396
|
*
|
|
2353
2397
|
* Only `searchLocal()` is available; `search()` will throw.
|
|
2354
2398
|
*/
|
|
2355
2399
|
static local(backend: InMemoryBackend): Memory
|
|
2356
|
-
/** Create a memory store in local-only mode with a `JsonlBackend`. */
|
|
2357
|
-
static localJsonl(backend: JsonlBackend): Memory
|
|
2358
|
-
/** Create a memory store in local-only mode with a `ValkeyBackend`. */
|
|
2359
|
-
static localValkey(backend: ValkeyBackend): Memory
|
|
2360
2400
|
/**
|
|
2361
2401
|
* Add a text entry to the memory store.
|
|
2362
2402
|
*
|
|
@@ -2412,6 +2452,18 @@ export declare class Memory {
|
|
|
2412
2452
|
delete(id: string): Promise<boolean>
|
|
2413
2453
|
/** Return the number of entries in the store. */
|
|
2414
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
|
|
2415
2467
|
}
|
|
2416
2468
|
export type JsMemory = Memory
|
|
2417
2469
|
|
|
@@ -3635,8 +3687,10 @@ export declare class RetryMemoryBackend {
|
|
|
3635
3687
|
static wrapJsonl(backend: JsonlBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
3636
3688
|
/** Wrap a `ValkeyBackend` with retry-on-transient-error behaviour. */
|
|
3637
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
|
|
3638
3692
|
/**
|
|
3639
|
-
* Generic factory accepting any of the
|
|
3693
|
+
* Generic factory accepting any of the four concrete backends. Useful
|
|
3640
3694
|
* when the caller doesn't statically know which backend is in hand.
|
|
3641
3695
|
*/
|
|
3642
3696
|
static wrap(backend: AnyBackend, config?: JsRetryConfig | undefined | null): RetryMemoryBackend
|
|
@@ -4519,6 +4573,37 @@ export declare class TypedTool {
|
|
|
4519
4573
|
}
|
|
4520
4574
|
export type JsTypedTool = TypedTool
|
|
4521
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
|
+
|
|
4522
4607
|
/**
|
|
4523
4608
|
* A sink for emitted [`JsUsageEvent`]s.
|
|
4524
4609
|
*
|
|
@@ -5005,21 +5090,6 @@ export declare class WorkflowBuilder {
|
|
|
5005
5090
|
* `crates/blazen-node/Cargo.toml`.
|
|
5006
5091
|
*/
|
|
5007
5092
|
withHistory(): this
|
|
5008
|
-
/**
|
|
5009
|
-
* Attach a checkpoint store to the workflow.
|
|
5010
|
-
*
|
|
5011
|
-
* Mirrors [`blazen_core::WorkflowBuilder::checkpoint_store`]. The
|
|
5012
|
-
* underlying call is gated on the `persist` feature of
|
|
5013
|
-
* `blazen-core`, which is **not** currently enabled in the Node
|
|
5014
|
-
* binding's compilation. The flag is recorded on the builder for
|
|
5015
|
-
* forward compatibility but does not yet flow into the core
|
|
5016
|
-
* engine — pass a [`JsCheckpointStore`] (typically a concrete
|
|
5017
|
-
* subclass like `RedbCheckpointStore` or `ValkeyCheckpointStore`)
|
|
5018
|
-
* so the JS API is stable; the binding will start forwarding the
|
|
5019
|
-
* store once the `blazen-core/persist` feature is enabled in
|
|
5020
|
-
* `crates/blazen-node/Cargo.toml`.
|
|
5021
|
-
*/
|
|
5022
|
-
checkpointStore(store: CheckpointStore): this
|
|
5023
5093
|
/**
|
|
5024
5094
|
* Enable or disable automatic checkpointing after each step
|
|
5025
5095
|
* completes. Same forward-compatibility caveat as
|
|
@@ -5039,6 +5109,21 @@ export declare class WorkflowBuilder {
|
|
|
5039
5109
|
* are enabled in the Node binding's `Cargo.toml`.
|
|
5040
5110
|
*/
|
|
5041
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
|
|
5042
5127
|
}
|
|
5043
5128
|
export type JsWorkflowBuilder = WorkflowBuilder
|
|
5044
5129
|
|
package/index.js
CHANGED
|
@@ -660,6 +660,8 @@ module.exports.HostDispatch = nativeBinding.HostDispatch
|
|
|
660
660
|
module.exports.JsHostDispatch = nativeBinding.JsHostDispatch
|
|
661
661
|
module.exports.HttpClient = nativeBinding.HttpClient
|
|
662
662
|
module.exports.JsHttpClient = nativeBinding.JsHttpClient
|
|
663
|
+
module.exports.HttpPeerClient = nativeBinding.HttpPeerClient
|
|
664
|
+
module.exports.JsHttpPeerClient = nativeBinding.JsHttpPeerClient
|
|
663
665
|
module.exports.ImageModel = nativeBinding.ImageModel
|
|
664
666
|
module.exports.JsImageModel = nativeBinding.JsImageModel
|
|
665
667
|
module.exports.ImageProvider = nativeBinding.ImageProvider
|
|
@@ -828,6 +830,8 @@ module.exports.TTSProvider = nativeBinding.TTSProvider
|
|
|
828
830
|
module.exports.JsTTSProvider = nativeBinding.JsTTSProvider
|
|
829
831
|
module.exports.TypedTool = nativeBinding.TypedTool
|
|
830
832
|
module.exports.JsTypedTool = nativeBinding.JsTypedTool
|
|
833
|
+
module.exports.UpstashBackend = nativeBinding.UpstashBackend
|
|
834
|
+
module.exports.JsUpstashBackend = nativeBinding.JsUpstashBackend
|
|
831
835
|
module.exports.UsageEmitter = nativeBinding.UsageEmitter
|
|
832
836
|
module.exports.JsUsageEmitter = nativeBinding.JsUsageEmitter
|
|
833
837
|
module.exports.UsageRecordingCompletionModel = nativeBinding.UsageRecordingCompletionModel
|
|
@@ -1016,9 +1020,27 @@ module.exports.videoInput = nativeBinding.videoInput
|
|
|
1016
1020
|
// emits classes with PascalCase names; we leave those callable as-is
|
|
1017
1021
|
// so `new ClassName(...)` keeps working but their methods are
|
|
1018
1022
|
// already patched above.
|
|
1019
|
-
|
|
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 =
|
|
1020
1041
|
orig.prototype &&
|
|
1021
1042
|
Object.getOwnPropertyNames(orig.prototype).some((p) => p !== 'constructor')
|
|
1043
|
+
const isLikelyClass = hasPrototypeMethods || ownStaticPropNames.length > 0
|
|
1022
1044
|
if (!isLikelyClass) {
|
|
1023
1045
|
module.exports[key] = wrap(orig)
|
|
1024
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",
|