blazen 0.1.143 → 0.1.151
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 +82 -12
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -54,6 +54,17 @@ export declare class ChatMessage {
|
|
|
54
54
|
get role(): string
|
|
55
55
|
/** The text content of the message, if any. */
|
|
56
56
|
get content(): string | null
|
|
57
|
+
/**
|
|
58
|
+
* The structured tool-result payload, if this message is a tool result
|
|
59
|
+
* produced by a tool returning a non-string value or carrying an
|
|
60
|
+
* `llmOverride`. Plain-string tool results live in `content` instead and
|
|
61
|
+
* this returns `null`.
|
|
62
|
+
*/
|
|
63
|
+
get toolResult(): ToolOutput | null
|
|
64
|
+
/** The tool call ID this message responds to, for `Role::Tool` messages. */
|
|
65
|
+
get toolCallId(): string | null
|
|
66
|
+
/** The tool/function name that produced this result, for `Role::Tool` messages. */
|
|
67
|
+
get name(): string | null
|
|
57
68
|
}
|
|
58
69
|
export type JsChatMessage = ChatMessage
|
|
59
70
|
|
|
@@ -333,10 +344,12 @@ export declare class Context {
|
|
|
333
344
|
/**
|
|
334
345
|
* Retrieve a value previously stored under the given key.
|
|
335
346
|
*
|
|
336
|
-
* Returns
|
|
337
|
-
*
|
|
347
|
+
* Returns the original JS value for JSON data, an array-of-bytes
|
|
348
|
+
* representation for binary data (use `getBytes` for proper
|
|
349
|
+
* `Buffer` round-trip), or `defaultValue` if the key is missing
|
|
350
|
+
* or the stored value is `null`/`Native`.
|
|
338
351
|
*/
|
|
339
|
-
get(key: string): Promise<StateValue | null>
|
|
352
|
+
get(key: string, defaultValue?: StateValue): Promise<StateValue | null>
|
|
340
353
|
/**
|
|
341
354
|
* Emit an event into the internal routing queue.
|
|
342
355
|
*
|
|
@@ -362,10 +375,11 @@ export declare class Context {
|
|
|
362
375
|
/**
|
|
363
376
|
* Retrieve raw binary data previously stored under the given key.
|
|
364
377
|
*
|
|
365
|
-
* Returns `
|
|
366
|
-
* not binary data
|
|
378
|
+
* Returns `defaultValue` if the key does not exist or the stored
|
|
379
|
+
* value is not binary data; if no default is provided, returns
|
|
380
|
+
* `null`.
|
|
367
381
|
*/
|
|
368
|
-
getBytes(key: string): Promise<Buffer | null>
|
|
382
|
+
getBytes(key: string, defaultValue?: Buffer): Promise<Buffer | null>
|
|
369
383
|
/** Get the workflow run ID. */
|
|
370
384
|
runId(): Promise<string>
|
|
371
385
|
/**
|
|
@@ -1187,9 +1201,9 @@ export declare class SessionNamespace {
|
|
|
1187
1201
|
set(key: string, value: unknown): Promise<void>
|
|
1188
1202
|
/**
|
|
1189
1203
|
* Retrieve a value previously stored under the given key. Returns
|
|
1190
|
-
* `
|
|
1204
|
+
* `defaultValue` if the key is missing.
|
|
1191
1205
|
*/
|
|
1192
|
-
get(key: string): Promise<unknown>
|
|
1206
|
+
get(key: string, defaultValue?: unknown): Promise<unknown>
|
|
1193
1207
|
/** Check whether a value exists under the given key. */
|
|
1194
1208
|
has(key: string): Promise<boolean>
|
|
1195
1209
|
/** Remove the value stored under the given key. */
|
|
@@ -1207,12 +1221,18 @@ export type JsSessionNamespace = SessionNamespace
|
|
|
1207
1221
|
export declare class StateNamespace {
|
|
1208
1222
|
/** Store a JSON-serializable value under the given key. */
|
|
1209
1223
|
set(key: string, value: Exclude<StateValue, Buffer>): Promise<void>
|
|
1210
|
-
/**
|
|
1211
|
-
|
|
1224
|
+
/**
|
|
1225
|
+
* Retrieve a value previously stored under the given key.
|
|
1226
|
+
* Returns `defaultValue` if the key is missing.
|
|
1227
|
+
*/
|
|
1228
|
+
get(key: string, defaultValue?: StateValue): Promise<StateValue | null>
|
|
1212
1229
|
/** Store raw binary data under the given key. */
|
|
1213
1230
|
setBytes(key: string, data: Buffer): Promise<void>
|
|
1214
|
-
/**
|
|
1215
|
-
|
|
1231
|
+
/**
|
|
1232
|
+
* Retrieve raw binary data previously stored under the given key.
|
|
1233
|
+
* Returns `defaultValue` if the key is missing.
|
|
1234
|
+
*/
|
|
1235
|
+
getBytes(key: string, defaultValue?: Buffer): Promise<Buffer | null>
|
|
1216
1236
|
}
|
|
1217
1237
|
export type JsStateNamespace = StateNamespace
|
|
1218
1238
|
|
|
@@ -2528,6 +2548,37 @@ export interface JsWorkflowResult {
|
|
|
2528
2548
|
data: any
|
|
2529
2549
|
}
|
|
2530
2550
|
|
|
2551
|
+
/**
|
|
2552
|
+
* Variant-tagged provider-aware override for what the LLM sees.
|
|
2553
|
+
*
|
|
2554
|
+
* `kind` is one of `"text"`, `"json"`, `"parts"`, or `"provider_raw"`.
|
|
2555
|
+
* Other fields are populated based on the variant:
|
|
2556
|
+
* - `text` for `kind: "text"`
|
|
2557
|
+
* - `value` for `kind: "json"` or `kind: "provider_raw"`
|
|
2558
|
+
* - `parts` for `kind: "parts"` (serialized `ContentPart[]`)
|
|
2559
|
+
* - `provider` for `kind: "provider_raw"` — one of `"openai"`,
|
|
2560
|
+
* `"openai_compat"`, `"azure"`, `"anthropic"`, `"gemini"`, `"responses"`,
|
|
2561
|
+
* or `"fal"`.
|
|
2562
|
+
*/
|
|
2563
|
+
export interface LlmPayload {
|
|
2564
|
+
/** Which variant: `"text"`, `"json"`, `"parts"`, or `"provider_raw"`. */
|
|
2565
|
+
kind: string
|
|
2566
|
+
/** Plain text body. Required for `kind: "text"`. */
|
|
2567
|
+
text?: string
|
|
2568
|
+
/**
|
|
2569
|
+
* Structured JSON value. Required for `kind: "json"` and
|
|
2570
|
+
* `kind: "provider_raw"`.
|
|
2571
|
+
*/
|
|
2572
|
+
value?: any
|
|
2573
|
+
/**
|
|
2574
|
+
* Multimodal content parts (serialized `ContentPart[]`).
|
|
2575
|
+
* Required for `kind: "parts"`.
|
|
2576
|
+
*/
|
|
2577
|
+
parts?: any
|
|
2578
|
+
/** Provider id string. Required for `kind: "provider_raw"`. */
|
|
2579
|
+
provider?: string
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2531
2582
|
/**
|
|
2532
2583
|
* Look up pricing for a model by its ID.
|
|
2533
2584
|
*
|
|
@@ -2670,5 +2721,24 @@ export declare const enum SessionPausePolicy {
|
|
|
2670
2721
|
HardError = 'HardError'
|
|
2671
2722
|
}
|
|
2672
2723
|
|
|
2724
|
+
/**
|
|
2725
|
+
* `ToolOutput` carrying both the user-visible `data` and an optional
|
|
2726
|
+
* `llmOverride` controlling what the LLM sees on the next turn.
|
|
2727
|
+
*
|
|
2728
|
+
* Either return one from a JS tool handler:
|
|
2729
|
+
* `return { data: { items: [1,2,3] }, llmOverride: { kind: 'text', text: 'summary' } };`
|
|
2730
|
+
* Or just return a plain value, which will be auto-wrapped with no override.
|
|
2731
|
+
*/
|
|
2732
|
+
export interface ToolOutput {
|
|
2733
|
+
/** The full structured payload the caller sees programmatically. */
|
|
2734
|
+
data: any
|
|
2735
|
+
/**
|
|
2736
|
+
* Optional override for what the LLM sees on the next turn.
|
|
2737
|
+
* `None`/`undefined` means the provider applies its default conversion
|
|
2738
|
+
* from `data`.
|
|
2739
|
+
*/
|
|
2740
|
+
llmOverride?: LlmPayload
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2673
2743
|
/** Returns the version of the blazen library. */
|
|
2674
2744
|
export declare function version(): string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blazen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.151",
|
|
4
4
|
"description": "Blazen - Event-driven AI workflow framework for Node.js/TypeScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"node": ">= 18"
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"@blazen-dev/blazen-linux-x64-gnu": "0.1.
|
|
49
|
-
"@blazen-dev/blazen-linux-x64-musl": "0.1.
|
|
50
|
-
"@blazen-dev/blazen-linux-arm64-gnu": "0.1.
|
|
51
|
-
"@blazen-dev/blazen-linux-arm64-musl": "0.1.
|
|
52
|
-
"@blazen-dev/blazen-darwin-arm64": "0.1.
|
|
53
|
-
"@blazen-dev/blazen-win32-x64-msvc": "0.1.
|
|
48
|
+
"@blazen-dev/blazen-linux-x64-gnu": "0.1.151",
|
|
49
|
+
"@blazen-dev/blazen-linux-x64-musl": "0.1.151",
|
|
50
|
+
"@blazen-dev/blazen-linux-arm64-gnu": "0.1.151",
|
|
51
|
+
"@blazen-dev/blazen-linux-arm64-musl": "0.1.151",
|
|
52
|
+
"@blazen-dev/blazen-darwin-arm64": "0.1.151",
|
|
53
|
+
"@blazen-dev/blazen-win32-x64-msvc": "0.1.151"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "napi build --release --platform --features local-all --js index.js",
|