blazen 0.1.119 → 0.1.121

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 (4) hide show
  1. package/README.md +35 -0
  2. package/index.d.ts +131 -244
  3. package/index.js +57 -55
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -342,6 +342,8 @@ console.log(result.data); // { answer: 42 }
342
342
 
343
343
  **Important:** `handler.result()` and `handler.pause()` each consume the handler. You can only call one of them, and only once.
344
344
 
345
+ > **Note:** Values stored via `ctx.session.set(...)` are **excluded** from snapshots. The workflow's `session_pause_policy` (default `pickle_or_error`; other policies: `warn_drop`, `hard_error`) governs what happens to session entries at pause time -- see the Rust docs for policy details. For anything that must survive pause/resume, use `ctx.state.set(...)` (or the legacy `ctx.set(...)` shortcut).
346
+
345
347
  ### Human-in-the-Loop
346
348
 
347
349
  Pause/resume is the foundation for human-in-the-loop workflows. Pause after a step to wait for human review, then resume when approved:
@@ -419,6 +421,35 @@ await ctx.setBytes("image-pixels", pixels);
419
421
  const restored = await ctx.getBytes("image-pixels");
420
422
  ```
421
423
 
424
+ ### State vs Session namespaces
425
+
426
+ The `Context` class exposes two explicit namespaces alongside the legacy smart-routing shortcuts (`ctx.set` / `ctx.get` / `ctx.setBytes` / `ctx.getBytes`):
427
+
428
+ - **`ctx.state`** -- persistable values. Routes through the same dispatch as `ctx.set` (bytes / JSON / pickle). Survives `pause()` / `resume()` and checkpoint stores.
429
+ - **`ctx.session`** -- in-process-only values. **Excluded from snapshots.** Use this for request IDs, rate-limit counters, ephemeral caches, and anything that should not survive pause/resume.
430
+
431
+ ```typescript
432
+ wf.addStep("step", ["blazen::StartEvent"], async (event, ctx) => {
433
+ // Persistable state
434
+ await ctx.state.set("counter", 5);
435
+ const count = await ctx.state.get("counter");
436
+
437
+ // Bytes also work on the state namespace
438
+ await ctx.state.setBytes("blob", Buffer.from([1, 2, 3]));
439
+ const blob = await ctx.state.getBytes("blob");
440
+
441
+ // In-process-only state
442
+ await ctx.session.set("reqId", "abc123");
443
+ const hasReq = await ctx.session.has("reqId");
444
+ const reqId = await ctx.session.get("reqId");
445
+ await ctx.session.remove("reqId");
446
+
447
+ return { type: "blazen::StopEvent", result: { count, hasReq } };
448
+ });
449
+ ```
450
+
451
+ **Important -- JS object identity is NOT preserved on Node.** Session values are routed through `serde_json::Value` because napi-rs's `Reference<T>` is `!Send` (its `Drop` must run on the v8 main thread). `await ctx.session.get("k")` returns a plain object equal to the one you passed in, not the same object. Session is still functionally distinct from state -- session values are excluded from snapshots, state values are not -- but for true identity preservation of live JS objects across steps you must use the Python or WASM bindings.
452
+
422
453
  ---
423
454
 
424
455
  ## Timeout
@@ -472,6 +503,10 @@ import type {
472
503
  | `Context.sendEvent(event)` | Route an event to matching steps (async) |
473
504
  | `Context.writeEventToStream(event)` | Publish to external stream consumers (async) |
474
505
  | `Context.runId()` | Get the workflow run ID (async) |
506
+ | `Context.state` | `StateNamespace` getter -- persistable values (survives pause/resume) |
507
+ | `Context.session` | `SessionNamespace` getter -- in-process-only values (excluded from snapshots) |
508
+ | `StateNamespace.set / get / setBytes / getBytes` | Async persistable storage routed through the same dispatch as `ctx.set` |
509
+ | `SessionNamespace.set / get / has / remove` | Async in-process-only storage; values are routed through `serde_json::Value` (no JS identity preservation) |
475
510
  | `CompletionModel` | Unified LLM client with 15 provider factory methods |
476
511
  | `CompletionModel.complete(messages)` | Chat completion with typed `ChatMessage[]` input, returns `CompletionResponse` (async) |
477
512
  | `CompletionModel.completeWithOptions(messages, opts)` | Chat completion with `CompletionOptions` (async) |
package/index.d.ts CHANGED
@@ -52,13 +52,13 @@ export type JsChatMessage = ChatMessage
52
52
  */
53
53
  export declare class CompletionModel {
54
54
  /** Create an `OpenAI` completion model. */
55
- static openai(apiKey: string, model?: string | undefined | null): CompletionModel
55
+ static openai(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
56
56
  /** Create an Anthropic completion model. */
57
- static anthropic(apiKey: string, model?: string | undefined | null): CompletionModel
57
+ static anthropic(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
58
58
  /** Create a Google Gemini completion model. */
59
- static gemini(apiKey: string, model?: string | undefined | null): CompletionModel
59
+ static gemini(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
60
60
  /** Create an Azure `OpenAI` completion model. */
61
- static azure(apiKey: string, resourceName: string, deploymentName: string): CompletionModel
61
+ static azure(apiKey: string, options: JsAzureOptions): CompletionModel
62
62
  /**
63
63
  * Create a fal.ai completion model.
64
64
  *
@@ -68,25 +68,25 @@ export declare class CompletionModel {
68
68
  */
69
69
  static fal(apiKey: string, options?: JsFalOptions | undefined | null): CompletionModel
70
70
  /** Create an `OpenRouter` completion model. */
71
- static openrouter(apiKey: string, model?: string | undefined | null): CompletionModel
71
+ static openrouter(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
72
72
  /** Create a Groq completion model. */
73
- static groq(apiKey: string, model?: string | undefined | null): CompletionModel
73
+ static groq(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
74
74
  /** Create a Together AI completion model. */
75
- static together(apiKey: string, model?: string | undefined | null): CompletionModel
75
+ static together(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
76
76
  /** Create a Mistral AI completion model. */
77
- static mistral(apiKey: string, model?: string | undefined | null): CompletionModel
77
+ static mistral(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
78
78
  /** Create a `DeepSeek` completion model. */
79
- static deepseek(apiKey: string, model?: string | undefined | null): CompletionModel
79
+ static deepseek(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
80
80
  /** Create a Fireworks AI completion model. */
81
- static fireworks(apiKey: string, model?: string | undefined | null): CompletionModel
81
+ static fireworks(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
82
82
  /** Create a Perplexity completion model. */
83
- static perplexity(apiKey: string, model?: string | undefined | null): CompletionModel
83
+ static perplexity(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
84
84
  /** Create an xAI (Grok) completion model. */
85
- static xai(apiKey: string, model?: string | undefined | null): CompletionModel
85
+ static xai(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
86
86
  /** Create a Cohere completion model. */
87
- static cohere(apiKey: string, model?: string | undefined | null): CompletionModel
87
+ static cohere(apiKey: string, options?: JsProviderOptions | undefined | null): CompletionModel
88
88
  /** Create an AWS Bedrock completion model. */
89
- static bedrock(apiKey: string, region: string, model?: string | undefined | null): CompletionModel
89
+ static bedrock(apiKey: string, options: JsBedrockOptions): CompletionModel
90
90
  /** Get the model ID. */
91
91
  get modelId(): string
92
92
  /**
@@ -221,6 +221,26 @@ export declare class Context {
221
221
  getBytes(key: string): Promise<Buffer | null>
222
222
  /** Get the workflow run ID. */
223
223
  runId(): Promise<string>
224
+ /**
225
+ * Persistable workflow state. Survives `pause()` / `resume()`,
226
+ * checkpoints, and durable storage.
227
+ *
228
+ * ```javascript
229
+ * await ctx.state.set("counter", 5);
230
+ * const count = await ctx.state.get("counter");
231
+ * ```
232
+ */
233
+ get state(): JsStateNamespace
234
+ /**
235
+ * In-process-only values. Excluded from snapshots — use this for
236
+ * things that should not survive `pause()` / `resume()`.
237
+ *
238
+ * ```javascript
239
+ * await ctx.session.set("reqId", 42);
240
+ * const n = await ctx.session.get("reqId");
241
+ * ```
242
+ */
243
+ get session(): JsSessionNamespace
224
244
  }
225
245
  export type JsContext = Context
226
246
 
@@ -503,6 +523,58 @@ export declare class Memory {
503
523
  }
504
524
  export type JsMemory = Memory
505
525
 
526
+ /**
527
+ * Namespace for in-process-only workflow values.
528
+ *
529
+ * Values stored via `session.set` are kept in the
530
+ * `ContextInner.objects` side-channel and are **excluded** from
531
+ * snapshots. Use this for state that should not survive a
532
+ * `pause()` / `resume()` round-trip (request IDs, rate-limit
533
+ * counters, ephemeral caches, …).
534
+ *
535
+ * For `session.set` values, identity preservation of JS class
536
+ * instances through this namespace is **not** supported on the Node
537
+ * bindings (see the module-level note on napi-rs threading). Values
538
+ * are serialised via `serde_json::Value`, so you will get a plain
539
+ * object back on `session.get`.
540
+ */
541
+ export declare class SessionNamespace {
542
+ /**
543
+ * Store a JSON-serializable value under the given key. The value
544
+ * is excluded from snapshots.
545
+ */
546
+ set(key: string, value: unknown): Promise<void>
547
+ /**
548
+ * Retrieve a value previously stored under the given key. Returns
549
+ * `null` if the key does not exist.
550
+ */
551
+ get(key: string): Promise<unknown>
552
+ /** Check whether a value exists under the given key. */
553
+ has(key: string): Promise<boolean>
554
+ /** Remove the value stored under the given key. */
555
+ remove(key: string): Promise<void>
556
+ }
557
+ export type JsSessionNamespace = SessionNamespace
558
+
559
+ /**
560
+ * Namespace for persistable workflow state.
561
+ *
562
+ * Values stored via `state.set` / `state.setBytes` go into the
563
+ * underlying `ContextInner.state` map and survive snapshots,
564
+ * `pause()` / `resume()`, and checkpoint stores.
565
+ */
566
+ export declare class StateNamespace {
567
+ /** Store a JSON-serializable value under the given key. */
568
+ set(key: string, value: Exclude<StateValue, Buffer>): Promise<void>
569
+ /** Retrieve a value previously stored under the given key. */
570
+ get(key: string): Promise<StateValue | null>
571
+ /** Store raw binary data under the given key. */
572
+ setBytes(key: string, data: Buffer): Promise<void>
573
+ /** Retrieve raw binary data previously stored under the given key. */
574
+ getBytes(key: string): Promise<Buffer | null>
575
+ }
576
+ export type JsStateNamespace = StateNamespace
577
+
506
578
  /**
507
579
  * A Valkey/Redis-backed backend for the memory store.
508
580
  *
@@ -711,29 +783,6 @@ export declare function countMessageTokens(messages: Array<ChatMessage>, context
711
783
  */
712
784
  export declare function estimateTokens(text: string, contextSize?: number | undefined | null): number
713
785
 
714
- /**
715
- * The fal.ai LLM endpoint family.
716
- *
717
- * Selects which fal LLM URL/body schema to use. Defaults to `OpenAiChat`
718
- * (the OpenAI-compatible chat-completions surface on fal).
719
- */
720
- export declare const enum FalLlmEndpoint {
721
- /** OpenAI-compatible chat-completions endpoint (default). */
722
- OpenAiChat = 'openai_chat',
723
- /** OpenAI-compatible Responses endpoint. */
724
- OpenAiResponses = 'openai_responses',
725
- /** OpenAI-compatible embeddings endpoint. */
726
- OpenAiEmbeddings = 'openai_embeddings',
727
- /** `OpenRouter` proxy via fal. */
728
- OpenRouter = 'openrouter',
729
- /** `OpenRouter` proxy via fal (enterprise/SOC2 tier). */
730
- OpenRouterEnterprise = 'openrouter_enterprise',
731
- /** fal-ai/any-llm proxy. */
732
- AnyLlm = 'any_llm',
733
- /** fal-ai/any-llm proxy (enterprise/SOC2 tier). */
734
- AnyLlmEnterprise = 'any_llm_enterprise'
735
- }
736
-
737
786
  /** An entry to add to the memory store (used by `addMany`). */
738
787
  export interface JsAddEntry {
739
788
  /** Unique identifier. If empty, one will be generated. */
@@ -828,18 +877,33 @@ export interface JsAudioContent {
828
877
  durationSeconds?: number
829
878
  }
830
879
 
831
- /** Result of an audio generation or TTS operation. */
832
880
  export interface JsAudioResult {
833
- /** The generated audio clips. */
834
881
  audio: Array<JsGeneratedAudio>
835
- /** Request timing breakdown. */
836
- timing?: JsComputeTiming
837
- /** Cost in USD, if reported by the provider. */
882
+ timing: JsRequestTiming
838
883
  cost?: number
839
- /** Arbitrary provider-specific metadata. */
840
884
  metadata: any
841
885
  }
842
886
 
887
+ export interface JsAzureOptions {
888
+ model?: string
889
+ baseUrl?: string
890
+ resourceName: string
891
+ deploymentName: string
892
+ apiVersion?: string
893
+ }
894
+
895
+ export interface JsBackgroundRemovalRequest {
896
+ imageUrl: string
897
+ model?: string
898
+ parameters?: any
899
+ }
900
+
901
+ export interface JsBedrockOptions {
902
+ model?: string
903
+ baseUrl?: string
904
+ region: string
905
+ }
906
+
843
907
  /** Configuration for the `withCache` decorator. */
844
908
  export interface JsCacheConfig {
845
909
  /** How long a cached response remains valid, in seconds. */
@@ -900,40 +964,20 @@ export interface JsCompletionResponse {
900
964
  metadata: any
901
965
  }
902
966
 
903
- /** Input for a generic compute job. */
904
967
  export interface JsComputeRequest {
905
- /** The model/endpoint to run (e.g., "fal-ai/flux/dev"). */
906
968
  model: string
907
- /** Input parameters as JSON (model-specific). */
908
969
  input: any
909
- /** Optional webhook URL for async completion notification. */
910
970
  webhook?: string
911
971
  }
912
972
 
913
- /** Result of a completed compute job. */
914
973
  export interface JsComputeResult {
915
- /** The job handle that produced this result, if available. */
916
974
  job?: JsJobHandle
917
- /** Output data (model-specific JSON). */
918
975
  output: any
919
- /** Request timing breakdown. */
920
- timing?: JsComputeTiming
921
- /** Cost in USD, if reported by the provider. */
976
+ timing: JsRequestTiming
922
977
  cost?: number
923
- /** Raw provider-specific metadata. */
924
978
  metadata: any
925
979
  }
926
980
 
927
- /** Timing breakdown for a compute request. */
928
- export interface JsComputeTiming {
929
- /** Time spent waiting in queue, in milliseconds. */
930
- queueMs?: number
931
- /** Time spent executing, in milliseconds. */
932
- executionMs?: number
933
- /** Total wall-clock time, in milliseconds. */
934
- totalMs?: number
935
- }
936
-
937
981
  /**
938
982
  * A single part in a multi-part message.
939
983
  *
@@ -964,29 +1008,19 @@ export interface JsEmbeddingResponse {
964
1008
  metadata: any
965
1009
  }
966
1010
 
967
- /**
968
- * Configuration options for [`JsFalProvider`].
969
- *
970
- * ```typescript
971
- * const fal = FalProvider.create("fal-key-...", {
972
- * model: "anthropic/claude-sonnet-4.5",
973
- * endpoint: "openai_chat",
974
- * enterprise: false,
975
- * autoRouteModality: true,
976
- * });
977
- * ```
978
- */
1011
+ export declare const enum JsFalLlmEndpointKind {
1012
+ OpenAiChat = 'open_ai_chat',
1013
+ OpenAiResponses = 'open_ai_responses',
1014
+ OpenAiEmbeddings = 'open_ai_embeddings',
1015
+ OpenRouter = 'open_router',
1016
+ AnyLlm = 'any_llm'
1017
+ }
1018
+
979
1019
  export interface JsFalOptions {
980
- /** Underlying LLM model name (e.g. `"anthropic/claude-sonnet-4.5"`). */
981
1020
  model?: string
982
- /** The fal endpoint family to target. Defaults to `OpenAiChat`. */
983
- endpoint?: FalLlmEndpoint
984
- /** Promote the endpoint to its enterprise / SOC2-eligible variant. */
1021
+ baseUrl?: string
1022
+ endpoint?: JsFalLlmEndpointKind
985
1023
  enterprise?: boolean
986
- /**
987
- * Auto-route the request to the matching vision/audio/video variant
988
- * when the message content contains media. Defaults to `true`.
989
- */
990
1024
  autoRouteModality?: boolean
991
1025
  }
992
1026
 
@@ -1014,53 +1048,32 @@ export interface JsFinishReason {
1014
1048
  value: string
1015
1049
  }
1016
1050
 
1017
- /** A single generated 3D model with optional mesh metadata. */
1018
1051
  export interface JsGenerated3DModel {
1019
- /** The 3D model media output. */
1020
1052
  media: JsMediaOutput
1021
- /** Total vertex count, if known. */
1022
1053
  vertexCount?: number
1023
- /** Total face/triangle count, if known. */
1024
1054
  faceCount?: number
1025
- /** Whether the model includes texture data. */
1026
1055
  hasTextures: boolean
1027
- /** Whether the model includes animation data. */
1028
1056
  hasAnimations: boolean
1029
1057
  }
1030
1058
 
1031
- /** A single generated audio clip with optional metadata. */
1032
1059
  export interface JsGeneratedAudio {
1033
- /** The audio media output. */
1034
1060
  media: JsMediaOutput
1035
- /** Duration in seconds, if known. */
1036
1061
  durationSeconds?: number
1037
- /** Sample rate in Hz, if known. */
1038
1062
  sampleRate?: number
1039
- /** Number of audio channels, if known. */
1040
1063
  channels?: number
1041
1064
  }
1042
1065
 
1043
- /** A single generated image with optional dimension metadata. */
1044
1066
  export interface JsGeneratedImage {
1045
- /** The image media output. */
1046
1067
  media: JsMediaOutput
1047
- /** Image width in pixels, if known. */
1048
1068
  width?: number
1049
- /** Image height in pixels, if known. */
1050
1069
  height?: number
1051
1070
  }
1052
1071
 
1053
- /** A single generated video with optional metadata. */
1054
1072
  export interface JsGeneratedVideo {
1055
- /** The video media output. */
1056
1073
  media: JsMediaOutput
1057
- /** Video width in pixels, if known. */
1058
1074
  width?: number
1059
- /** Video height in pixels, if known. */
1060
1075
  height?: number
1061
- /** Duration in seconds, if known. */
1062
1076
  durationSeconds?: number
1063
- /** Frames per second, if known. */
1064
1077
  fps?: number
1065
1078
  }
1066
1079
 
@@ -1070,33 +1083,20 @@ export interface JsImageContent {
1070
1083
  mediaType?: string
1071
1084
  }
1072
1085
 
1073
- /** Request to generate images from a text prompt. */
1074
1086
  export interface JsImageRequest {
1075
- /** The text prompt describing the desired image. */
1076
1087
  prompt: string
1077
- /** Negative prompt (things to avoid in the image). */
1078
1088
  negativePrompt?: string
1079
- /** Desired image width in pixels. */
1080
1089
  width?: number
1081
- /** Desired image height in pixels. */
1082
1090
  height?: number
1083
- /** Number of images to generate. */
1084
1091
  numImages?: number
1085
- /** Model override (provider-specific model identifier). */
1086
1092
  model?: string
1087
- /** Additional provider-specific parameters. */
1088
1093
  parameters?: any
1089
1094
  }
1090
1095
 
1091
- /** Result of an image generation or upscale operation. */
1092
1096
  export interface JsImageResult {
1093
- /** The generated or upscaled images. */
1094
1097
  images: Array<JsGeneratedImage>
1095
- /** Request timing breakdown. */
1096
- timing?: JsComputeTiming
1097
- /** Cost in USD, if reported by the provider. */
1098
+ timing: JsRequestTiming
1098
1099
  cost?: number
1099
- /** Arbitrary provider-specific metadata. */
1100
1100
  metadata: any
1101
1101
  }
1102
1102
 
@@ -1107,15 +1107,10 @@ export interface JsImageSource {
1107
1107
  data?: string
1108
1108
  }
1109
1109
 
1110
- /** A handle to a submitted compute job. */
1111
1110
  export interface JsJobHandle {
1112
- /** Provider-assigned job/request identifier. */
1113
1111
  id: string
1114
- /** Provider name (e.g., "fal", "replicate", "runpod"). */
1115
1112
  provider: string
1116
- /** The model/endpoint that was invoked. */
1117
1113
  model: string
1118
- /** When the job was submitted (ISO 8601). */
1119
1114
  submittedAt: string
1120
1115
  }
1121
1116
 
@@ -1133,54 +1128,15 @@ export declare const enum JsJobStatus {
1133
1128
  Cancelled = 'cancelled'
1134
1129
  }
1135
1130
 
1136
- /** A single piece of generated media content. */
1137
1131
  export interface JsMediaOutput {
1138
- /** URL where the media can be downloaded. */
1139
1132
  url?: string
1140
- /** Base64-encoded media data. */
1141
1133
  base64?: string
1142
- /** Raw text content for text-based formats (SVG, OBJ, GLTF JSON). */
1143
1134
  rawContent?: string
1144
- /** The MIME type of the media (e.g. "image/png", "video/mp4"). */
1145
1135
  mediaType: string
1146
- /** File size in bytes, if known. */
1147
1136
  fileSize?: number
1148
- /** Arbitrary provider-specific metadata. */
1149
1137
  metadata: any
1150
1138
  }
1151
1139
 
1152
- /** Map of friendly format names to their MIME type strings. */
1153
- export interface JsMediaTypeMap {
1154
- png: string
1155
- jpeg: string
1156
- webp: string
1157
- gif: string
1158
- svg: string
1159
- bmp: string
1160
- tiff: string
1161
- avif: string
1162
- ico: string
1163
- mp4: string
1164
- webm: string
1165
- mov: string
1166
- avi: string
1167
- mkv: string
1168
- mp3: string
1169
- wav: string
1170
- ogg: string
1171
- flac: string
1172
- aac: string
1173
- m4A: string
1174
- glb: string
1175
- gltf: string
1176
- obj: string
1177
- fbx: string
1178
- usdz: string
1179
- stl: string
1180
- ply: string
1181
- pdf: string
1182
- }
1183
-
1184
1140
  /** A stored entry retrieved from the memory store. */
1185
1141
  export interface JsMemoryEntry {
1186
1142
  /** The entry id. */
@@ -1203,18 +1159,18 @@ export interface JsMemoryResult {
1203
1159
  metadata: any
1204
1160
  }
1205
1161
 
1206
- /** Request to generate music or sound effects. */
1207
1162
  export interface JsMusicRequest {
1208
- /** Text prompt describing the desired audio. */
1209
1163
  prompt: string
1210
- /** Desired duration in seconds. */
1211
1164
  durationSeconds?: number
1212
- /** Model override. */
1213
1165
  model?: string
1214
- /** Additional provider-specific parameters. */
1215
1166
  parameters?: any
1216
1167
  }
1217
1168
 
1169
+ export interface JsProviderOptions {
1170
+ model?: string
1171
+ baseUrl?: string
1172
+ }
1173
+
1218
1174
  /**
1219
1175
  * Chain-of-thought / extended-thinking trace from a model that exposes one.
1220
1176
  *
@@ -1235,7 +1191,6 @@ export interface JsReasoningTrace {
1235
1191
  effort?: string
1236
1192
  }
1237
1193
 
1238
- /** Timing metadata for a completion request. */
1239
1194
  export interface JsRequestTiming {
1240
1195
  queueMs?: number
1241
1196
  executionMs?: number
@@ -1278,21 +1233,13 @@ export declare const enum JsRole {
1278
1233
  Tool = 'tool'
1279
1234
  }
1280
1235
 
1281
- /** Request to generate speech from text (TTS). */
1282
1236
  export interface JsSpeechRequest {
1283
- /** The text to synthesize into speech. */
1284
1237
  text: string
1285
- /** Voice identifier (provider-specific). */
1286
1238
  voice?: string
1287
- /** URL to a reference voice sample for voice cloning. */
1288
1239
  voiceUrl?: string
1289
- /** Language code (e.g. "en", "fr", "ja"). */
1290
1240
  language?: string
1291
- /** Speech speed multiplier (1.0 = normal). */
1292
1241
  speed?: number
1293
- /** Model override. */
1294
1242
  model?: string
1295
- /** Additional provider-specific parameters. */
1296
1243
  parameters?: any
1297
1244
  }
1298
1245
 
@@ -1332,40 +1279,31 @@ export interface JsStreamChunk {
1332
1279
  artifacts: Array<JsArtifact>
1333
1280
  }
1334
1281
 
1335
- /** Request to generate a 3D model. */
1336
1282
  export interface JsThreeDRequest {
1337
- /** Text prompt describing the desired 3D model. */
1338
1283
  prompt?: string
1339
- /** Source image URL for image-to-3D generation. */
1340
1284
  imageUrl?: string
1341
- /** Desired output format (e.g. "glb", "obj", "usdz"). */
1342
1285
  format?: string
1343
- /** Model override. */
1344
1286
  model?: string
1345
- /** Additional provider-specific parameters. */
1346
1287
  parameters?: any
1347
1288
  }
1348
1289
 
1349
- /** Result of a 3D model generation operation. */
1350
1290
  export interface JsThreeDResult {
1351
- /** The generated 3D models. */
1352
1291
  models: Array<JsGenerated3DModel>
1353
- /** Request timing breakdown. */
1354
- timing?: JsComputeTiming
1355
- /** Cost in USD, if reported by the provider. */
1292
+ timing: JsRequestTiming
1356
1293
  cost?: number
1357
- /** Arbitrary provider-specific metadata. */
1358
1294
  metadata: any
1359
1295
  }
1360
1296
 
1361
- /** Token usage statistics for a completion request. */
1362
1297
  export interface JsTokenUsage {
1363
1298
  promptTokens: number
1364
1299
  completionTokens: number
1365
1300
  totalTokens: number
1301
+ reasoningTokens?: number
1302
+ cachedInputTokens?: number
1303
+ audioInputTokens?: number
1304
+ audioOutputTokens?: number
1366
1305
  }
1367
1306
 
1368
- /** A tool invocation requested by the model. */
1369
1307
  export interface JsToolCall {
1370
1308
  id: string
1371
1309
  name: string
@@ -1382,64 +1320,40 @@ export interface JsToolDef {
1382
1320
  parameters: any
1383
1321
  }
1384
1322
 
1385
- /** Describes a tool that the model may invoke during a conversation. */
1386
1323
  export interface JsToolDefinition {
1387
1324
  name: string
1388
1325
  description: string
1389
1326
  parameters: any
1390
1327
  }
1391
1328
 
1392
- /** Request to transcribe audio to text. */
1393
1329
  export interface JsTranscriptionRequest {
1394
- /** URL of the audio file to transcribe. */
1395
1330
  audioUrl: string
1396
- /** Language hint (e.g. "en", "fr"). */
1397
1331
  language?: string
1398
- /** Whether to perform speaker diarization. */
1399
1332
  diarize?: boolean
1400
- /** Model override. */
1401
1333
  model?: string
1402
- /** Additional provider-specific parameters. */
1403
1334
  parameters?: any
1404
1335
  }
1405
1336
 
1406
- /** Result of a transcription operation. */
1407
1337
  export interface JsTranscriptionResult {
1408
- /** The full transcribed text. */
1409
1338
  text: string
1410
- /** Time-aligned segments, if available. */
1411
1339
  segments: Array<JsTranscriptionSegment>
1412
- /** Detected or specified language code (e.g. "en", "fr"). */
1413
1340
  language?: string
1414
- /** Request timing breakdown. */
1415
- timing?: JsComputeTiming
1416
- /** Cost in USD, if reported by the provider. */
1341
+ timing: JsRequestTiming
1417
1342
  cost?: number
1418
- /** Arbitrary provider-specific metadata. */
1419
1343
  metadata: any
1420
1344
  }
1421
1345
 
1422
- /** A single segment within a transcription. */
1423
1346
  export interface JsTranscriptionSegment {
1424
- /** The transcribed text for this segment. */
1425
1347
  text: string
1426
- /** Start time in seconds. */
1427
1348
  start: number
1428
- /** End time in seconds. */
1429
1349
  end: number
1430
- /** Speaker label, if diarization was enabled. */
1431
1350
  speaker?: string
1432
1351
  }
1433
1352
 
1434
- /** Request to upscale an image. */
1435
1353
  export interface JsUpscaleRequest {
1436
- /** URL of the image to upscale. */
1437
1354
  imageUrl: string
1438
- /** Scale factor (e.g., 2.0 for 2x, 4.0 for 4x). */
1439
1355
  scale: number
1440
- /** Model override. */
1441
1356
  model?: string
1442
- /** Additional provider-specific parameters. */
1443
1357
  parameters?: any
1444
1358
  }
1445
1359
 
@@ -1450,35 +1364,21 @@ export interface JsVideoContent {
1450
1364
  durationSeconds?: number
1451
1365
  }
1452
1366
 
1453
- /** Request to generate a video. */
1454
1367
  export interface JsVideoRequest {
1455
- /** Text prompt describing the desired video. */
1456
1368
  prompt: string
1457
- /** Source image URL for image-to-video generation. */
1458
1369
  imageUrl?: string
1459
- /** Desired duration in seconds. */
1460
1370
  durationSeconds?: number
1461
- /** Negative prompt (things to avoid). */
1462
1371
  negativePrompt?: string
1463
- /** Desired video width in pixels. */
1464
1372
  width?: number
1465
- /** Desired video height in pixels. */
1466
1373
  height?: number
1467
- /** Model override. */
1468
1374
  model?: string
1469
- /** Additional provider-specific parameters. */
1470
1375
  parameters?: any
1471
1376
  }
1472
1377
 
1473
- /** Result of a video generation operation. */
1474
1378
  export interface JsVideoResult {
1475
- /** The generated videos. */
1476
1379
  videos: Array<JsGeneratedVideo>
1477
- /** Request timing breakdown. */
1478
- timing?: JsComputeTiming
1479
- /** Cost in USD, if reported by the provider. */
1380
+ timing: JsRequestTiming
1480
1381
  cost?: number
1481
- /** Arbitrary provider-specific metadata. */
1482
1382
  metadata: any
1483
1383
  }
1484
1384
 
@@ -1490,19 +1390,6 @@ export interface JsWorkflowResult {
1490
1390
  data: any
1491
1391
  }
1492
1392
 
1493
- /**
1494
- * Returns an object mapping friendly names to MIME type strings.
1495
- *
1496
- * ```typescript
1497
- * import { mediaTypes } from 'blazen';
1498
- *
1499
- * const types = mediaTypes();
1500
- * console.log(types.png); // "image/png"
1501
- * console.log(types.mp4); // "video/mp4"
1502
- * ```
1503
- */
1504
- export declare function mediaTypes(): JsMediaTypeMap
1505
-
1506
1393
  /**
1507
1394
  * Run an agentic tool execution loop.
1508
1395
  *
package/index.js CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('blazen-android-arm64')
79
79
  const bindingPackageVersion = require('blazen-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('blazen-android-arm-eabi')
95
95
  const bindingPackageVersion = require('blazen-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('blazen-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('blazen-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('blazen-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('blazen-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('blazen-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('blazen-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('blazen-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('blazen-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('blazen-darwin-universal')
184
184
  const bindingPackageVersion = require('blazen-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('blazen-darwin-x64')
200
200
  const bindingPackageVersion = require('blazen-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('blazen-darwin-arm64')
216
216
  const bindingPackageVersion = require('blazen-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('blazen-freebsd-x64')
236
236
  const bindingPackageVersion = require('blazen-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('blazen-freebsd-arm64')
252
252
  const bindingPackageVersion = require('blazen-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('blazen-linux-x64-musl')
273
273
  const bindingPackageVersion = require('blazen-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('blazen-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('blazen-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('blazen-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('blazen-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('blazen-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('blazen-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('blazen-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('blazen-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('blazen-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('blazen-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('blazen-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('blazen-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('blazen-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('blazen-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('blazen-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('blazen-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('blazen-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('blazen-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('blazen-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('blazen-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('blazen-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('blazen-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('blazen-openharmony-arm64')
478
478
  const bindingPackageVersion = require('blazen-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('blazen-openharmony-x64')
494
494
  const bindingPackageVersion = require('blazen-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('blazen-openharmony-arm')
510
510
  const bindingPackageVersion = require('blazen-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '0.1.119' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 0.1.119 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '0.1.121' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 0.1.121 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -594,6 +594,10 @@ module.exports.JsonlBackend = nativeBinding.JsonlBackend
594
594
  module.exports.JsJsonlBackend = nativeBinding.JsJsonlBackend
595
595
  module.exports.Memory = nativeBinding.Memory
596
596
  module.exports.JsMemory = nativeBinding.JsMemory
597
+ module.exports.SessionNamespace = nativeBinding.SessionNamespace
598
+ module.exports.JsSessionNamespace = nativeBinding.JsSessionNamespace
599
+ module.exports.StateNamespace = nativeBinding.StateNamespace
600
+ module.exports.JsStateNamespace = nativeBinding.JsStateNamespace
597
601
  module.exports.ValkeyBackend = nativeBinding.ValkeyBackend
598
602
  module.exports.JsValkeyBackend = nativeBinding.JsValkeyBackend
599
603
  module.exports.Workflow = nativeBinding.Workflow
@@ -602,10 +606,8 @@ module.exports.WorkflowHandler = nativeBinding.WorkflowHandler
602
606
  module.exports.JsWorkflowHandler = nativeBinding.JsWorkflowHandler
603
607
  module.exports.countMessageTokens = nativeBinding.countMessageTokens
604
608
  module.exports.estimateTokens = nativeBinding.estimateTokens
605
- module.exports.FalLlmEndpoint = nativeBinding.FalLlmEndpoint
606
- module.exports.JsFalLlmEndpoint = nativeBinding.JsFalLlmEndpoint
609
+ module.exports.JsFalLlmEndpointKind = nativeBinding.JsFalLlmEndpointKind
607
610
  module.exports.JsJobStatus = nativeBinding.JsJobStatus
608
611
  module.exports.JsRole = nativeBinding.JsRole
609
- module.exports.mediaTypes = nativeBinding.mediaTypes
610
612
  module.exports.runAgent = nativeBinding.runAgent
611
613
  module.exports.version = nativeBinding.version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blazen",
3
- "version": "0.1.119",
3
+ "version": "0.1.121",
4
4
  "description": "Blazen - Event-driven AI workflow framework for Node.js/TypeScript",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",