@q1k-oss/behaviour-tree-workflows 0.0.1 → 0.0.3

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/dist/index.d.ts CHANGED
@@ -1,520 +1,8 @@
1
+ import { T as TreeNode, N as NodeStatus, a as NodeConfiguration, b as NodeEventEmitter, c as TemporalContext, P as PortDefinition, W as WorkflowArgs, d as WorkflowResult, I as IScopedBlackboard, e as NodeConstructor, f as NodeMetadata, g as TokenProvider, h as PieceActivityRequest, i as ParseFileRequest, L as LLMProvider, M as MessageRole, C as ClaudeAgentMcpServerConfig, j as ClaudeAgentSubagent, G as GitHubOperation, A as A2UIComponent, k as AgentToolDefinition } from './types-BJPlUisg.js';
2
+ export { a6 as AgentContentBlock, a9 as AgentLoopTurnRequest, aa as AgentLoopTurnResult, a7 as AgentMessage, a8 as AgentToolCall, Y as BrowserAgentRequest, Z as BrowserAgentResult, B as BtreeActivities, _ as ClaudeAgentRequest, $ as ClaudeAgentResult, t as CodeExecutionRequest, u as CodeExecutionResult, a2 as CreateHumanTaskRequest, a3 as CreateHumanTaskResult, D as DataRef, K as DeleteFileRequest, O as DeleteFileResult, F as DownloadFileRequest, J as DownloadFileResult, ab as ExecuteAgentToolRequest, ac as ExecuteAgentToolResult, Q as FileExistsRequest, R as FileExistsResult, q as GenerateFileRequest, r as GenerateFileResult, ad as GenericSignalPayload, a0 as GitHubActionRequest, a1 as GitHubActionResult, H as HttpRequestActivity, s as HttpResponseActivity, l as ITreeRegistry, V as LLMChatRequest, X as LLMChatResult, S as LLMMessage, w as LogEventData, x as NodeEvent, y as NodeEventCallback, v as NodeEventType, p as ParseFileResult, m as PieceAuth, n as PythonScriptRequest, o as PythonScriptResult, z as TickContext, U as UploadFileRequest, E as UploadFileResult, a4 as WaitForHumanTaskRequest, a5 as WaitForHumanTaskResult, ae as WaitForSignalRequest, af as WaitForSignalResult } from './types-BJPlUisg.js';
1
3
  import { z } from 'zod';
2
4
  import { Sinks } from '@temporalio/workflow';
3
5
 
4
- /**
5
- * Event system for observing behavior tree execution
6
- * Enables external systems (debuggers, monitors, agents) to track execution in real-time
7
- */
8
- /**
9
- * Types of events emitted by nodes during execution
10
- */
11
- declare enum NodeEventType {
12
- TICK_START = "tick_start",
13
- TICK_END = "tick_end",
14
- STATUS_CHANGE = "status_change",
15
- ERROR = "error",
16
- HALT = "halt",
17
- RESET = "reset",
18
- LOG = "log"
19
- }
20
- /**
21
- * Data for LOG events emitted by LogMessage nodes
22
- */
23
- interface LogEventData {
24
- level: "info" | "warn" | "error" | "debug";
25
- message: string;
26
- }
27
- /**
28
- * Event emitted by a node during execution
29
- */
30
- interface NodeEvent<TData> {
31
- type: NodeEventType;
32
- nodeId: string;
33
- nodeName: string;
34
- nodeType: string;
35
- timestamp: number;
36
- /** Tree path (e.g., "/0/1/2") - set by tree execution */
37
- nodePath?: string;
38
- data?: TData;
39
- }
40
- /**
41
- * Callback function for node events
42
- */
43
- type NodeEventCallback<TData> = (event: NodeEvent<TData>) => void;
44
- /**
45
- * Event emitter for behavior tree nodes
46
- * Supports subscribing to specific event types and emitting events
47
- */
48
- declare class NodeEventEmitter {
49
- private listeners;
50
- private allListeners;
51
- /**
52
- * Subscribe to a specific event type
53
- * @param type - The event type to listen for
54
- * @param callback - Function to call when event occurs
55
- */
56
- on<TData>(type: NodeEventType, callback: NodeEventCallback<TData>): void;
57
- /**
58
- * Subscribe to all event types
59
- * @param callback - Function to call for any event
60
- */
61
- onAll<TData>(callback: NodeEventCallback<TData>): void;
62
- /**
63
- * Unsubscribe from a specific event type
64
- * @param type - The event type to stop listening for
65
- * @param callback - The callback to remove
66
- */
67
- off<TData>(type: NodeEventType, callback: NodeEventCallback<TData>): void;
68
- /**
69
- * Unsubscribe from all events
70
- * @param callback - The callback to remove
71
- */
72
- offAll<TData>(callback: NodeEventCallback<TData>): void;
73
- /**
74
- * Emit an event to all registered listeners
75
- * Errors in callbacks are caught and logged to prevent breaking execution
76
- * @param event - The event to emit
77
- */
78
- emit<TData>(event: NodeEvent<TData>): void;
79
- /**
80
- * Remove all listeners
81
- */
82
- clear(): void;
83
- /**
84
- * Get count of listeners for a specific type
85
- * @param type - The event type to check
86
- * @returns Number of listeners
87
- */
88
- listenerCount(type: NodeEventType): number;
89
- /**
90
- * Get count of "all events" listeners
91
- * @returns Number of listeners
92
- */
93
- allListenerCount(): number;
94
- /**
95
- * Check if there are any listeners
96
- * @returns True if any listeners are registered
97
- */
98
- hasListeners(): boolean;
99
- }
100
-
101
- /**
102
- * Core types for the Behavior Tree implementation
103
- * Inspired by BehaviorTree.CPP
104
- */
105
- /**
106
- * Status of a node after tick execution
107
- */
108
- declare enum NodeStatus {
109
- SUCCESS = "SUCCESS",
110
- FAILURE = "FAILURE",
111
- RUNNING = "RUNNING",
112
- IDLE = "IDLE"
113
- }
114
- /**
115
- * Base configuration for all nodes
116
- */
117
- interface NodeConfiguration {
118
- id: string;
119
- name?: string;
120
- [key: string]: unknown;
121
- }
122
- /**
123
- * Context passed during tick execution
124
- */
125
- interface TickContext {
126
- blackboard: IScopedBlackboard;
127
- treeRegistry: ITreeRegistry;
128
- signal?: AbortSignal;
129
- deltaTime?: number;
130
- timestamp: number;
131
- testData?: Map<string, unknown>;
132
- /**
133
- * Immutable workflow input parameters
134
- * Accessible via ${input.key} syntax in variable resolution
135
- * These are passed when the workflow starts and should not be modified
136
- */
137
- input?: Readonly<Record<string, unknown>>;
138
- sessionId?: string;
139
- eventEmitter?: NodeEventEmitter;
140
- }
141
- /**
142
- * Token provider function type for OAuth/API key authentication
143
- */
144
- type TokenProvider = (context: TemporalContext, provider: string, connectionId?: string) => Promise<PieceAuth>;
145
- /**
146
- * Extended context for Temporal workflow execution
147
- * Replaces EffectTickContext for Temporal-native execution
148
- */
149
- interface TemporalContext extends TickContext {
150
- workflowInfo?: {
151
- workflowId: string;
152
- runId: string;
153
- namespace: string;
154
- };
155
- /**
156
- * Activity functions for I/O operations
157
- * When provided, I/O nodes use these instead of inline execution
158
- * Controlplane creates these via proxyActivities() and passes to context
159
- */
160
- activities?: BtreeActivities;
161
- /**
162
- * Token provider for IntegrationAction authentication
163
- * Returns OAuth tokens or API keys for third-party services
164
- */
165
- tokenProvider?: TokenProvider;
166
- }
167
- /**
168
- * Activity capabilities that can be provided to btree
169
- * Controlplane creates these via proxyActivities() and passes to context
170
- */
171
- interface BtreeActivities {
172
- /** Execute an Active Pieces action (Google Sheets, Slack, etc.) */
173
- executePieceAction: (request: PieceActivityRequest) => Promise<unknown>;
174
- /** Execute Python code via cross-language activity */
175
- executePythonScript?: (request: PythonScriptRequest) => Promise<PythonScriptResult>;
176
- /** Parse CSV/Excel file into structured data */
177
- parseFile?: (request: ParseFileRequest) => Promise<ParseFileResult>;
178
- /** Generate CSV/Excel file from data */
179
- generateFile?: (request: GenerateFileRequest) => Promise<GenerateFileResult>;
180
- /** Make HTTP request (for nodes that don't use Active Pieces) */
181
- fetchUrl?: (request: HttpRequestActivity) => Promise<HttpResponseActivity>;
182
- /** Execute code in sandbox (Microsandbox) - supports JavaScript and Python */
183
- executeCode?: (request: CodeExecutionRequest) => Promise<CodeExecutionResult>;
184
- /** Upload file to storage, returns DataRef */
185
- uploadFile?: (request: UploadFileRequest) => Promise<UploadFileResult>;
186
- /** Download file from storage */
187
- downloadFile?: (request: DownloadFileRequest) => Promise<DownloadFileResult>;
188
- /** Delete file from storage */
189
- deleteFile?: (request: DeleteFileRequest) => Promise<DeleteFileResult>;
190
- /** Check if file exists in storage */
191
- fileExists?: (request: FileExistsRequest) => Promise<FileExistsResult>;
192
- }
193
- /**
194
- * Authentication credentials for a piece
195
- */
196
- type PieceAuth = {
197
- access_token: string;
198
- refresh_token?: string;
199
- } | {
200
- api_key: string;
201
- } | Record<string, unknown>;
202
- interface PieceActivityRequest {
203
- provider: string;
204
- action: string;
205
- inputs: Record<string, unknown>;
206
- auth: PieceAuth;
207
- }
208
- interface PythonScriptRequest {
209
- /** Python code to execute */
210
- code: string;
211
- /** Blackboard snapshot (serializable) */
212
- blackboard: Record<string, unknown>;
213
- /** Workflow input (read-only) */
214
- input?: Record<string, unknown>;
215
- /** Allowed environment variables */
216
- env?: Record<string, string>;
217
- /** Execution timeout in ms */
218
- timeout?: number;
219
- }
220
- interface PythonScriptResult {
221
- /** Modified blackboard values */
222
- blackboard: Record<string, unknown>;
223
- /** Stdout from Python execution */
224
- stdout?: string;
225
- /** Stderr from Python execution */
226
- stderr?: string;
227
- }
228
- interface ParseFileRequest {
229
- /** File path or URL */
230
- file: string;
231
- /** File format (auto-detect if not specified) */
232
- format?: "csv" | "xlsx" | "xls" | "auto";
233
- /** Sheet name for Excel (default: first sheet) */
234
- sheetName?: string;
235
- /** Column mapping { "Original Name": "normalizedName" } */
236
- columnMapping?: Record<string, string>;
237
- /** Parse options */
238
- options?: {
239
- skipRows?: number;
240
- trim?: boolean;
241
- emptyAsNull?: boolean;
242
- dateColumns?: string[];
243
- dateFormat?: string;
244
- };
245
- }
246
- interface ParseFileResult {
247
- /** Parsed data rows */
248
- data: Record<string, unknown>[];
249
- /** Number of rows parsed */
250
- rowCount: number;
251
- /** Column names detected */
252
- columns: string[];
253
- }
254
- interface GenerateFileRequest {
255
- /** Output format */
256
- format: "csv" | "xlsx" | "json";
257
- /** Data to write */
258
- data: Record<string, unknown>[];
259
- /** Column definitions */
260
- columns?: Array<{
261
- header: string;
262
- key: string;
263
- width?: number;
264
- }>;
265
- /** Output filename */
266
- filename: string;
267
- /** Storage type */
268
- storage: "temp" | "persistent";
269
- }
270
- interface GenerateFileResult {
271
- /** Generated filename */
272
- filename: string;
273
- /** MIME type */
274
- contentType: string;
275
- /** File size in bytes */
276
- size: number;
277
- /** File path or storage key */
278
- path: string;
279
- /** Pre-signed download URL (if persistent) */
280
- url?: string;
281
- }
282
- interface HttpRequestActivity {
283
- url: string;
284
- method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
285
- headers?: Record<string, string>;
286
- body?: unknown;
287
- timeout?: number;
288
- }
289
- interface HttpResponseActivity {
290
- status: number;
291
- headers: Record<string, string>;
292
- data: unknown;
293
- }
294
- interface UploadFileRequest {
295
- /** Base64-encoded file content */
296
- fileBytes: string;
297
- /** Target filename */
298
- filename: string;
299
- /** MIME type */
300
- contentType?: string;
301
- /** Workflow ID for organizing storage */
302
- workflowId?: string;
303
- }
304
- interface UploadFileResult {
305
- /** Reference to stored file */
306
- dataRef: DataRef$1;
307
- /** Uploaded filename */
308
- filename: string;
309
- /** File size in bytes */
310
- sizeBytes: number;
311
- }
312
- interface DownloadFileRequest {
313
- /** Reference to file in storage */
314
- dataRef: DataRef$1;
315
- }
316
- interface DownloadFileResult {
317
- /** Base64-encoded file content */
318
- fileBytes: string;
319
- /** File size in bytes */
320
- sizeBytes: number;
321
- }
322
- interface DeleteFileRequest {
323
- /** Reference to file in storage */
324
- dataRef: DataRef$1;
325
- }
326
- interface DeleteFileResult {
327
- /** Whether deletion was successful */
328
- deleted: boolean;
329
- /** Key of deleted file */
330
- key: string;
331
- }
332
- interface FileExistsRequest {
333
- /** Reference to file in storage */
334
- dataRef: DataRef$1;
335
- }
336
- interface FileExistsResult {
337
- /** Whether file exists */
338
- exists: boolean;
339
- /** Key checked */
340
- key: string;
341
- }
342
- /**
343
- * Reference to data stored in a DataStore
344
- * Import from data-store module for full type, this is a lightweight re-export
345
- */
346
- interface DataRef$1 {
347
- store: "gcs" | "s3" | "redis" | "memory";
348
- key: string;
349
- sizeBytes?: number;
350
- expiresAt?: number;
351
- }
352
- /**
353
- * Request for code execution in a sandboxed environment
354
- */
355
- interface CodeExecutionRequest {
356
- /** Code to execute */
357
- code: string;
358
- /** Programming language */
359
- language: "javascript" | "python";
360
- /** References to large data stored in DataStore */
361
- dataRefs?: Record<string, DataRef$1>;
362
- /** Inline context data (small values) */
363
- context?: Record<string, unknown>;
364
- /** Workflow input data (read-only) */
365
- input?: Record<string, unknown>;
366
- /** Execution timeout in milliseconds */
367
- timeout?: number;
368
- /** Python packages to install before execution */
369
- packages?: string[];
370
- /** Associated workflow ID for data storage */
371
- workflowId?: string;
372
- }
373
- /**
374
- * Result from code execution
375
- */
376
- interface CodeExecutionResult {
377
- /** Small values returned inline */
378
- values: Record<string, unknown>;
379
- /** Large values stored in DataStore (returns refs) */
380
- dataRefs: Record<string, DataRef$1>;
381
- /** Console/stdout output from execution */
382
- logs: string[];
383
- /** Total execution time in milliseconds */
384
- executionTimeMs: number;
385
- }
386
- /**
387
- * Port definition for typed inputs/outputs
388
- */
389
- interface PortDefinition {
390
- name: string;
391
- type: "input" | "output" | "inout";
392
- description?: string;
393
- defaultValue?: unknown;
394
- required?: boolean;
395
- }
396
- /**
397
- * Base interface for all tree nodes
398
- */
399
- interface TreeNode {
400
- readonly id: string;
401
- readonly name: string;
402
- readonly type: string;
403
- tick(context: TemporalContext): Promise<NodeStatus>;
404
- halt(): void;
405
- reset(): void;
406
- clone(): TreeNode;
407
- providedPorts?(): PortDefinition[];
408
- status(): NodeStatus;
409
- lastError?: string;
410
- parent?: TreeNode;
411
- children?: TreeNode[];
412
- }
413
- /**
414
- * Constructor type for node factories
415
- */
416
- type NodeConstructor<T extends TreeNode = TreeNode> = new (config: NodeConfiguration) => T;
417
- /**
418
- * Node metadata for registry
419
- */
420
- interface NodeMetadata {
421
- type: string;
422
- category: "action" | "condition" | "decorator" | "composite" | "subtree";
423
- description?: string;
424
- ports?: PortDefinition[];
425
- }
426
- /**
427
- * Interface for tree registry (session-scoped)
428
- * Used by nodes like StepGroup and LocateElement to lookup behavior trees
429
- */
430
- interface ITreeRegistry {
431
- hasTree(id: string): boolean;
432
- cloneTree(id: string): {
433
- getRoot(): TreeNode;
434
- };
435
- getAllTreeIds(): string[];
436
- registerTree(id: string, tree: {
437
- getRoot(): TreeNode;
438
- clone(): {
439
- getRoot(): TreeNode;
440
- };
441
- }, sourceFile: string): void;
442
- getTree(id: string): {
443
- getRoot(): TreeNode;
444
- clone(): {
445
- getRoot(): TreeNode;
446
- };
447
- } | undefined;
448
- getTreeSourceFile(id: string): string | undefined;
449
- getTreesForFile(filePath: string): Map<string, {
450
- getRoot(): TreeNode;
451
- clone(): {
452
- getRoot(): TreeNode;
453
- };
454
- }>;
455
- }
456
- /**
457
- * Interface for scoped blackboard
458
- */
459
- interface IScopedBlackboard {
460
- get(key: string): unknown;
461
- set(key: string, value: unknown): void;
462
- has(key: string): boolean;
463
- delete(key: string): void;
464
- clear(): void;
465
- createScope(name: string): IScopedBlackboard;
466
- getParentScope(): IScopedBlackboard | null;
467
- getScopeName(): string;
468
- getFullScopePath(): string;
469
- getPort<T>(key: string, defaultValue?: T): T;
470
- setPort<T>(key: string, value: T): void;
471
- keys(): string[];
472
- entries(): [string, unknown][];
473
- toJSON(): Record<string, unknown>;
474
- clone(): IScopedBlackboard;
475
- }
476
- /**
477
- * Arguments passed to a BehaviorTree workflow
478
- */
479
- interface WorkflowArgs {
480
- /**
481
- * Input data to initialize the blackboard
482
- */
483
- input?: Record<string, unknown>;
484
- /**
485
- * Tree registry for looking up subtrees
486
- */
487
- treeRegistry: ITreeRegistry;
488
- /**
489
- * Optional session ID
490
- */
491
- sessionId?: string;
492
- /**
493
- * Activity functions for I/O operations (optional)
494
- * When provided, nodes that support activities will use them instead of inline execution
495
- * Controlplane creates these via proxyActivities() and passes them here
496
- */
497
- activities?: BtreeActivities;
498
- /**
499
- * Token provider for IntegrationAction authentication (optional)
500
- * Returns OAuth tokens or API keys for third-party services
501
- */
502
- tokenProvider?: TokenProvider;
503
- }
504
- /**
505
- * Result returned from a BehaviorTree workflow
506
- */
507
- interface WorkflowResult {
508
- /**
509
- * Final status of the tree
510
- */
511
- status: NodeStatus;
512
- /**
513
- * Final blackboard state
514
- */
515
- output: Record<string, unknown>;
516
- }
517
-
518
6
  /**
519
7
  * Abstract base class for all tree nodes
520
8
  */
@@ -738,9 +226,9 @@ declare class BehaviorTree {
738
226
  *
739
227
  * @example
740
228
  * ```typescript
741
- * import { BehaviorTree } from '@wayfarer-ai/btree';
742
- * import { Sequence } from '@wayfarer-ai/btree';
743
- * import { PrintAction } from '@wayfarer-ai/btree';
229
+ * import { BehaviorTree } from '@q1k-oss/behaviour-tree-workflows';
230
+ * import { Sequence } from '@q1k-oss/behaviour-tree-workflows';
231
+ * import { PrintAction } from '@q1k-oss/behaviour-tree-workflows';
744
232
  *
745
233
  * const root = new Sequence({ id: 'root' });
746
234
  * root.addChild(new PrintAction({ id: 'step1', message: 'Hello' }));
@@ -1253,6 +741,55 @@ declare class SoftAssert extends DecoratorNode {
1253
741
  protected onReset(): void;
1254
742
  }
1255
743
 
744
+ /**
745
+ * StreamingSink Decorator
746
+ *
747
+ * Injects a streaming channel ID into the blackboard for child LLM calls.
748
+ * LLMToolCall reads `__streamChannelId` and passes it to the activity,
749
+ * enabling token-level streaming to a WebSocket or SSE channel.
750
+ *
751
+ * The decorator saves and restores the previous value, making it safe
752
+ * to nest (inner StreamingSink overrides, then restores outer channel).
753
+ */
754
+
755
+ /**
756
+ * Configuration for StreamingSink decorator
757
+ */
758
+ interface StreamingSinkConfig extends NodeConfiguration {
759
+ /** Explicit channel ID */
760
+ channelId?: string;
761
+ /** OR: blackboard key to read channel ID from */
762
+ channelKey?: string;
763
+ }
764
+ /**
765
+ * StreamingSink Decorator
766
+ *
767
+ * Sets `__streamChannelId` on the blackboard before ticking the child,
768
+ * then restores the previous value after.
769
+ *
770
+ * @example YAML
771
+ * ```yaml
772
+ * type: StreamingSink
773
+ * id: stream-to-client
774
+ * props:
775
+ * channelId: "ws-session-abc"
776
+ * children:
777
+ * - type: LLMToolCall
778
+ * id: call-llm
779
+ * props:
780
+ * provider: anthropic
781
+ * model: claude-sonnet-4-20250514
782
+ * messagesKey: msgs
783
+ * outputKey: response
784
+ * ```
785
+ */
786
+ declare class StreamingSink extends DecoratorNode {
787
+ private channelId?;
788
+ private channelKey?;
789
+ constructor(config: StreamingSinkConfig);
790
+ executeTick(context: TemporalContext): Promise<NodeStatus>;
791
+ }
792
+
1256
793
  /**
1257
794
  * Timeout decorator node
1258
795
  * Fails if the child doesn't complete within a specified time
@@ -1421,7 +958,7 @@ declare class Registry {
1421
958
  *
1422
959
  * @example
1423
960
  * ```typescript
1424
- * import { Registry, registerStandardNodes } from '@wayfarer-ai/btree';
961
+ * import { Registry, registerStandardNodes } from '@q1k-oss/behaviour-tree-workflows';
1425
962
  *
1426
963
  * const registry = new Registry();
1427
964
  * registerStandardNodes(registry);
@@ -1487,7 +1024,9 @@ declare class MockAction extends ActionNode {
1487
1024
  protected onHalt(): void;
1488
1025
  }
1489
1026
  /**
1490
- * Condition that checks if a blackboard value meets a criteria
1027
+ * Condition that checks if a blackboard value meets a criteria.
1028
+ * Supports dotted path keys (e.g., "llmResponse.stopReason") to access
1029
+ * nested properties of blackboard values.
1491
1030
  */
1492
1031
  declare class CheckCondition extends ConditionNode {
1493
1032
  private key;
@@ -1498,6 +1037,11 @@ declare class CheckCondition extends ConditionNode {
1498
1037
  operator?: string;
1499
1038
  value: unknown;
1500
1039
  });
1040
+ /**
1041
+ * Resolve a potentially dotted key from the blackboard.
1042
+ * Tries exact key first (backward compatible), then dotted path traversal.
1043
+ */
1044
+ private resolveBlackboardValue;
1501
1045
  executeTick(context: TemporalContext): Promise<NodeStatus>;
1502
1046
  }
1503
1047
  /**
@@ -1738,6 +1282,54 @@ declare class RegexExtract extends ActionNode {
1738
1282
  executeTick(context: TemporalContext): Promise<NodeStatus>;
1739
1283
  }
1740
1284
 
1285
+ /**
1286
+ * SetVariable Node
1287
+ *
1288
+ * Simple utility node that sets a blackboard key to a value.
1289
+ * Supports variable resolution in both key and value.
1290
+ * Primary use case: controlling While loop conditions in agent loops.
1291
+ */
1292
+
1293
+ /**
1294
+ * Configuration for SetVariable node
1295
+ */
1296
+ interface SetVariableConfig extends NodeConfiguration {
1297
+ /** Blackboard key to set (supports ${bb.x} / ${input.x} resolution) */
1298
+ key: string;
1299
+ /** Value to set (supports variable resolution) */
1300
+ value: unknown;
1301
+ }
1302
+ /**
1303
+ * SetVariable Node
1304
+ *
1305
+ * Sets a blackboard key to a resolved value. Used for loop control,
1306
+ * intermediate state management, and data transformation.
1307
+ *
1308
+ * @example YAML - Loop control
1309
+ * ```yaml
1310
+ * type: SetVariable
1311
+ * id: init-loop
1312
+ * props:
1313
+ * key: agentLooping
1314
+ * value: true
1315
+ * ```
1316
+ *
1317
+ * @example YAML - Dynamic value
1318
+ * ```yaml
1319
+ * type: SetVariable
1320
+ * id: copy-result
1321
+ * props:
1322
+ * key: finalAnswer
1323
+ * value: "${bb.llmResponse.content}"
1324
+ * ```
1325
+ */
1326
+ declare class SetVariable extends ActionNode {
1327
+ private key;
1328
+ private value;
1329
+ constructor(config: SetVariableConfig);
1330
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
1331
+ }
1332
+
1741
1333
  /**
1742
1334
  * Unified Variable Resolver
1743
1335
  *
@@ -2426,7 +2018,7 @@ declare const schemaRegistry: SchemaRegistry;
2426
2018
 
2427
2019
  /**
2428
2020
  * Template Loader
2429
- * Load YAML template files from a directory and register them in the btree Registry.
2021
+ * Load YAML template files from a directory and register them in the behaviour-tree Registry.
2430
2022
  * Templates can then be referenced by SubTree nodes using their template ID.
2431
2023
  */
2432
2024
 
@@ -2596,7 +2188,7 @@ declare const envTokenProvider: TokenProvider;
2596
2188
  * Dynamically executes Active Pieces actions
2597
2189
  *
2598
2190
  * Active Pieces is an open-source automation platform with 440+ connectors.
2599
- * This module wraps their npm packages for use in btree workflows.
2191
+ * This module wraps their npm packages for use in behaviour-tree workflows.
2600
2192
  *
2601
2193
  * @see https://activepieces.com/docs
2602
2194
  */
@@ -3038,6 +2630,743 @@ declare class CodeExecution extends ActionNode {
3038
2630
  protected executeTick(context: TemporalContext): Promise<NodeStatus>;
3039
2631
  }
3040
2632
 
2633
+ /**
2634
+ * LLMChat Node
2635
+ *
2636
+ * Executes LLM chat completion via a Temporal activity.
2637
+ * This node requires the `llmChat` activity to be configured in the context -
2638
+ * it does not support standalone/inline execution because LLM API calls require
2639
+ * capabilities outside the workflow sandbox.
2640
+ *
2641
+ * Features:
2642
+ * - Multi-provider support (Anthropic, OpenAI, Google, Ollama)
2643
+ * - Variable resolution in messages and system prompt
2644
+ * - JSON response format with schema validation
2645
+ * - Token usage tracking
2646
+ * - Result stored in blackboard
2647
+ */
2648
+
2649
+ /**
2650
+ * Configuration for LLMChat node
2651
+ */
2652
+ interface LLMChatConfig extends NodeConfiguration {
2653
+ /** LLM provider: anthropic, openai, google, ollama */
2654
+ provider: LLMProvider;
2655
+ /** Model identifier (supports ${bb.model} resolution) */
2656
+ model: string;
2657
+ /** Conversation messages (supports variable resolution in content) */
2658
+ messages: Array<{
2659
+ role: MessageRole;
2660
+ content: string;
2661
+ }>;
2662
+ /** Optional system prompt (supports variable resolution) */
2663
+ systemPrompt?: string;
2664
+ /** Sampling temperature (0-2) */
2665
+ temperature?: number;
2666
+ /** Maximum tokens to generate */
2667
+ maxTokens?: number;
2668
+ /** Response format */
2669
+ responseFormat?: "text" | "json";
2670
+ /** JSON schema for structured output */
2671
+ jsonSchema?: Record<string, unknown>;
2672
+ /** Request timeout in milliseconds */
2673
+ timeout?: number;
2674
+ /** Ollama base URL for local instance */
2675
+ baseUrl?: string;
2676
+ /** Output key on blackboard for response */
2677
+ outputKey: string;
2678
+ }
2679
+ /**
2680
+ * LLMChat Node
2681
+ *
2682
+ * Executes LLM chat completion via a Temporal activity and stores the response in blackboard.
2683
+ * Requires the `llmChat` activity to be configured.
2684
+ *
2685
+ * @example YAML - Basic Usage
2686
+ * ```yaml
2687
+ * type: LLMChat
2688
+ * id: summarize
2689
+ * props:
2690
+ * provider: anthropic
2691
+ * model: claude-sonnet-4-20250514
2692
+ * systemPrompt: "You are a helpful assistant."
2693
+ * messages:
2694
+ * - role: user
2695
+ * content: "Summarize: ${bb.documentText}"
2696
+ * temperature: 0.7
2697
+ * maxTokens: 1000
2698
+ * outputKey: summary
2699
+ * ```
2700
+ *
2701
+ * @example YAML - JSON Response
2702
+ * ```yaml
2703
+ * type: LLMChat
2704
+ * id: extract-entities
2705
+ * props:
2706
+ * provider: openai
2707
+ * model: gpt-4
2708
+ * messages:
2709
+ * - role: user
2710
+ * content: "Extract entities from: ${bb.text}"
2711
+ * responseFormat: json
2712
+ * jsonSchema:
2713
+ * type: object
2714
+ * properties:
2715
+ * people: { type: array, items: { type: string } }
2716
+ * organizations: { type: array, items: { type: string } }
2717
+ * outputKey: entities
2718
+ * ```
2719
+ */
2720
+ declare class LLMChat extends ActionNode {
2721
+ private provider;
2722
+ private model;
2723
+ private messages;
2724
+ private systemPrompt?;
2725
+ private temperature?;
2726
+ private maxTokens?;
2727
+ private responseFormat;
2728
+ private jsonSchema?;
2729
+ private timeout?;
2730
+ private baseUrl?;
2731
+ private outputKey;
2732
+ constructor(config: LLMChatConfig);
2733
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
2734
+ }
2735
+
2736
+ /**
2737
+ * BrowserAgent Node
2738
+ *
2739
+ * Executes autonomous browser agent via Browserbase + Stagehand.
2740
+ * This node requires the `browserAgent` activity to be configured in the context -
2741
+ * it does not support standalone/inline execution because browser automation requires
2742
+ * capabilities outside the workflow sandbox.
2743
+ *
2744
+ * Features:
2745
+ * - Goal-directed autonomous web navigation
2746
+ * - Browserbase Contexts for session persistence (cookies, auth, cache)
2747
+ * - Session recording via Browserbase for debugging/audit
2748
+ * - Variable resolution in goal and startUrl
2749
+ * - Result stored in blackboard with debugUrl for session replay
2750
+ */
2751
+
2752
+ /**
2753
+ * Configuration for BrowserAgent node
2754
+ */
2755
+ interface BrowserAgentConfig extends NodeConfiguration {
2756
+ /** Goal for the agent to achieve (supports variable resolution) */
2757
+ goal: string;
2758
+ /** Starting URL (optional, supports variable resolution) */
2759
+ startUrl?: string;
2760
+ /** Blackboard key to store/retrieve contextId */
2761
+ contextKey?: string;
2762
+ /** Whether to persist context changes (cookies, auth, cache) */
2763
+ persistContext?: boolean;
2764
+ /** Timeout for entire agent execution (ms) */
2765
+ timeout?: number;
2766
+ /** Max steps/actions the agent can take */
2767
+ maxSteps?: number;
2768
+ /** LLM provider for Stagehand agent */
2769
+ llmProvider?: LLMProvider;
2770
+ /** LLM model for Stagehand agent */
2771
+ llmModel?: string;
2772
+ /** Output key on blackboard for result */
2773
+ outputKey: string;
2774
+ }
2775
+ /**
2776
+ * BrowserAgent Node
2777
+ *
2778
+ * Executes autonomous browser agent via Browserbase + Stagehand and stores the result in blackboard.
2779
+ * Requires the `browserAgent` activity to be configured.
2780
+ *
2781
+ * @example YAML - Basic Usage
2782
+ * ```yaml
2783
+ * type: BrowserAgent
2784
+ * id: search
2785
+ * props:
2786
+ * goal: "Search for weather in NYC and extract the temperature"
2787
+ * startUrl: "https://google.com"
2788
+ * timeout: 60000
2789
+ * maxSteps: 15
2790
+ * outputKey: searchResult
2791
+ * ```
2792
+ *
2793
+ * @example YAML - Multi-Step with Context Persistence
2794
+ * ```yaml
2795
+ * type: Sequence
2796
+ * id: authenticated-scrape
2797
+ * children:
2798
+ * - type: BrowserAgent
2799
+ * id: login
2800
+ * props:
2801
+ * goal: "Login with username ${input.user} and password ${input.pass}"
2802
+ * startUrl: "${input.loginUrl}"
2803
+ * contextKey: browserContext
2804
+ * persistContext: true
2805
+ * outputKey: loginResult
2806
+ *
2807
+ * - type: BrowserAgent
2808
+ * id: scrape
2809
+ * props:
2810
+ * goal: "Navigate to dashboard and extract all data as JSON"
2811
+ * contextKey: browserContext
2812
+ * outputKey: scrapeResult
2813
+ * ```
2814
+ */
2815
+ declare class BrowserAgent extends ActionNode {
2816
+ private goal;
2817
+ private startUrl?;
2818
+ private contextKey?;
2819
+ private persistContext;
2820
+ private timeout?;
2821
+ private maxSteps?;
2822
+ private llmProvider?;
2823
+ private llmModel?;
2824
+ private outputKey;
2825
+ constructor(config: BrowserAgentConfig);
2826
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
2827
+ }
2828
+
2829
+ /**
2830
+ * ClaudeAgent Node
2831
+ *
2832
+ * Executes an autonomous Claude agent via a Temporal activity.
2833
+ * This node requires the `claudeAgent` activity to be configured in the context -
2834
+ * it does not support standalone/inline execution because agent execution requires
2835
+ * capabilities outside the workflow sandbox.
2836
+ *
2837
+ * Features:
2838
+ * - Goal-driven autonomous coding agent (powered by Claude Agent SDK)
2839
+ * - Configurable tools, permissions, and cost limits
2840
+ * - MCP server integration for external tools
2841
+ * - Subagent support for delegating specialized tasks
2842
+ * - Variable resolution in prompt, systemPrompt, model, and cwd
2843
+ * - Session ID returned for resuming/continuing agent conversations
2844
+ * - Result stored in blackboard
2845
+ */
2846
+
2847
+ /**
2848
+ * Configuration for ClaudeAgent node
2849
+ */
2850
+ interface ClaudeAgentConfig extends NodeConfiguration {
2851
+ /** Task prompt for the agent (supports variable resolution) */
2852
+ prompt: string;
2853
+ /** Model to use, e.g. "claude-sonnet-4-5-20250929" (supports variable resolution) */
2854
+ model?: string;
2855
+ /** System prompt for agent behavior (supports variable resolution) */
2856
+ systemPrompt?: string;
2857
+ /** Tools the agent can use (e.g., ["Read", "Write", "Edit", "Bash"]) */
2858
+ allowedTools?: string[];
2859
+ /** Permission mode: default, acceptEdits, bypassPermissions */
2860
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions";
2861
+ /** Maximum conversation turns */
2862
+ maxTurns?: number;
2863
+ /** Maximum budget in USD */
2864
+ maxBudgetUsd?: number;
2865
+ /** Working directory for the agent (supports variable resolution) */
2866
+ cwd?: string;
2867
+ /** MCP server configurations */
2868
+ mcpServers?: Record<string, ClaudeAgentMcpServerConfig>;
2869
+ /** Subagent definitions */
2870
+ agents?: Record<string, ClaudeAgentSubagent>;
2871
+ /** Output key on blackboard for result */
2872
+ outputKey: string;
2873
+ }
2874
+ /**
2875
+ * ClaudeAgent Node
2876
+ *
2877
+ * Executes an autonomous Claude agent via the Claude Agent SDK and stores
2878
+ * the result in blackboard. Requires the `claudeAgent` activity to be configured.
2879
+ *
2880
+ * @example YAML - Basic coding task
2881
+ * ```yaml
2882
+ * type: ClaudeAgent
2883
+ * id: implement-feature
2884
+ * props:
2885
+ * prompt: "Add unit tests for the auth module"
2886
+ * allowedTools: [Read, Write, Edit, Bash, Glob, Grep]
2887
+ * permissionMode: acceptEdits
2888
+ * outputKey: agentResult
2889
+ * ```
2890
+ *
2891
+ * @example YAML - Dev workflow with PR creation
2892
+ * ```yaml
2893
+ * type: ClaudeAgent
2894
+ * id: dev-task
2895
+ * props:
2896
+ * prompt: "${bb.taskDescription}"
2897
+ * systemPrompt: |
2898
+ * You are working on @q1k-oss/behaviour-tree-workflows.
2899
+ * Read CLAUDE.md for project conventions.
2900
+ * Create a branch, implement changes, commit, push, and create a PR.
2901
+ * allowedTools: [Read, Write, Edit, Bash, Glob, Grep]
2902
+ * permissionMode: acceptEdits
2903
+ * maxTurns: 100
2904
+ * maxBudgetUsd: 10.0
2905
+ * outputKey: agentResult
2906
+ * ```
2907
+ */
2908
+ declare class ClaudeAgent extends ActionNode {
2909
+ private prompt;
2910
+ private model?;
2911
+ private systemPrompt?;
2912
+ private allowedTools?;
2913
+ private permissionMode;
2914
+ private maxTurns;
2915
+ private maxBudgetUsd?;
2916
+ private agentCwd?;
2917
+ private mcpServers?;
2918
+ private agents?;
2919
+ private outputKey;
2920
+ constructor(config: ClaudeAgentConfig);
2921
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
2922
+ }
2923
+
2924
+ /**
2925
+ * GitHubAction Node
2926
+ *
2927
+ * Executes deterministic GitHub operations via a Temporal activity.
2928
+ * This node requires the `githubAction` activity to be configured in the context -
2929
+ * it does not support standalone/inline execution because GitHub API access requires
2930
+ * capabilities outside the workflow sandbox.
2931
+ *
2932
+ * Features:
2933
+ * - 10 supported operations (branches, PRs, reviews, issues, releases)
2934
+ * - Variable resolution in repo and params
2935
+ * - Auth handled at activity layer — no tokens in YAML
2936
+ * - Result stored in blackboard
2937
+ *
2938
+ * @example YAML - Create a PR
2939
+ * ```yaml
2940
+ * type: GitHubAction
2941
+ * id: create-pr
2942
+ * props:
2943
+ * operation: createPullRequest
2944
+ * repo: "${input.repo}"
2945
+ * params:
2946
+ * title: "feat: new feature"
2947
+ * body: "Description"
2948
+ * head: "feat/branch"
2949
+ * base: "main"
2950
+ * outputKey: prResult
2951
+ * ```
2952
+ */
2953
+
2954
+ /**
2955
+ * Configuration for GitHubAction node
2956
+ */
2957
+ interface GitHubActionConfig extends NodeConfiguration {
2958
+ /** The GitHub operation to perform */
2959
+ operation: GitHubOperation;
2960
+ /** Repository in "owner/repo" format (supports variable resolution) */
2961
+ repo: string;
2962
+ /** Operation-specific parameters (string values support variable resolution) */
2963
+ params?: Record<string, unknown>;
2964
+ /** Output key on blackboard for result */
2965
+ outputKey: string;
2966
+ }
2967
+ /**
2968
+ * GitHubAction Node
2969
+ *
2970
+ * Executes deterministic GitHub operations (branches, PRs, reviews, issues,
2971
+ * releases) via an activity and stores the result in blackboard.
2972
+ */
2973
+ declare class GitHubAction extends ActionNode {
2974
+ private operation;
2975
+ private repo;
2976
+ private params;
2977
+ private outputKey;
2978
+ constructor(config: GitHubActionConfig);
2979
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
2980
+ }
2981
+
2982
+ /**
2983
+ * HumanTask Node
2984
+ *
2985
+ * Pauses workflow execution to present an A2UI surface to a human user
2986
+ * and waits for their response. This node requires the `createHumanTask`
2987
+ * and `waitForHumanTask` activities to be configured in the context.
2988
+ *
2989
+ * Features:
2990
+ * - A2UI component-based UI definition (frozen at design time)
2991
+ * - Data bindings from workflow context (blackboard/input) to A2UI data model
2992
+ * - Variable resolution in title, description, and assignee
2993
+ * - Configurable timeout with onTimeout behavior
2994
+ * - Response data stored in blackboard
2995
+ *
2996
+ * The actual waiting is handled by the Temporal workflow layer using
2997
+ * condition() + signals, not by blocking the activity.
2998
+ */
2999
+
3000
+ /**
3001
+ * Configuration for HumanTask node
3002
+ */
3003
+ interface HumanTaskConfig extends NodeConfiguration {
3004
+ /** Task title (supports ${bb.x} / ${input.x} resolution) */
3005
+ title: string;
3006
+ /** Task description (supports variable resolution) */
3007
+ description?: string;
3008
+ /** Assignee email (supports variable resolution) */
3009
+ assignee?: string;
3010
+ /** Role-based assignment */
3011
+ assigneeRole?: string;
3012
+ /** A2UI surface definition */
3013
+ a2ui: {
3014
+ /** Component tree definitions */
3015
+ components: A2UIComponent[];
3016
+ /** Maps A2UI JSON Pointer paths to btree expressions */
3017
+ dataBindings?: Record<string, string>;
3018
+ };
3019
+ /** Timeout in milliseconds (default: 24h) */
3020
+ timeoutMs?: number;
3021
+ /** Behavior on timeout: 'expire' | 'approve' | 'reject' */
3022
+ onTimeout?: string;
3023
+ /** Blackboard key prefix for response data (default: node id) */
3024
+ outputKey?: string;
3025
+ }
3026
+ /**
3027
+ * HumanTask Node
3028
+ *
3029
+ * Creates a human task with an A2UI surface and waits for the user to respond.
3030
+ *
3031
+ * @example YAML
3032
+ * ```yaml
3033
+ * type: HumanTask
3034
+ * id: expense-approval
3035
+ * props:
3036
+ * title: "Expense Approval"
3037
+ * description: "Review expense request from ${input.employeeName}"
3038
+ * assignee: "${input.managerEmail}"
3039
+ * a2ui:
3040
+ * components:
3041
+ * - id: root
3042
+ * component:
3043
+ * Column:
3044
+ * children:
3045
+ * explicitList: [header, amount-field, actions]
3046
+ * - id: header
3047
+ * component:
3048
+ * Text:
3049
+ * text: { path: '/title' }
3050
+ * - id: amount-field
3051
+ * component:
3052
+ * TextField:
3053
+ * text: { path: '/form/amount' }
3054
+ * label: { literalString: 'Amount ($)' }
3055
+ * - id: actions
3056
+ * component:
3057
+ * Row:
3058
+ * children:
3059
+ * explicitList: [approve-btn, reject-btn]
3060
+ * - id: approve-btn
3061
+ * component:
3062
+ * Button:
3063
+ * child: approve-text
3064
+ * primary: true
3065
+ * action:
3066
+ * name: submit
3067
+ * context:
3068
+ * - key: decision
3069
+ * value: { literalString: approved }
3070
+ * - id: approve-text
3071
+ * component:
3072
+ * Text:
3073
+ * text: { literalString: Approve }
3074
+ * - id: reject-btn
3075
+ * component:
3076
+ * Button:
3077
+ * child: reject-text
3078
+ * action:
3079
+ * name: submit
3080
+ * context:
3081
+ * - key: decision
3082
+ * value: { literalString: rejected }
3083
+ * - id: reject-text
3084
+ * component:
3085
+ * Text:
3086
+ * text: { literalString: Reject }
3087
+ * dataBindings:
3088
+ * /title: "Expense Request from ${input.employeeName}"
3089
+ * /form/amount: "${input.requestedAmount}"
3090
+ * timeoutMs: 86400000
3091
+ * onTimeout: expire
3092
+ * outputKey: approval
3093
+ * ```
3094
+ */
3095
+ declare class HumanTask extends ActionNode {
3096
+ private title;
3097
+ private description?;
3098
+ private assignee?;
3099
+ private assigneeRole?;
3100
+ private a2ui;
3101
+ private timeoutMs;
3102
+ private onTimeout;
3103
+ private outputKey?;
3104
+ constructor(config: HumanTaskConfig);
3105
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
3106
+ }
3107
+
3108
+ /**
3109
+ * LLMToolCall Node
3110
+ *
3111
+ * Calls an LLM with tool support and manages the conversation message list.
3112
+ * This is the core node for the decomposed agent loop pattern.
3113
+ *
3114
+ * Unlike LLMChat (single-turn, text-only), LLMToolCall:
3115
+ * - Supports structured content blocks (text, tool_use, tool_result)
3116
+ * - Manages a persistent conversation on the blackboard
3117
+ * - Returns tool calls in the output for ToolExecutor to process
3118
+ * - Always returns SUCCESS (the calling tree decides what to do based on stopReason)
3119
+ */
3120
+
3121
+ /**
3122
+ * Configuration for LLMToolCall node
3123
+ */
3124
+ interface LLMToolCallConfig extends NodeConfiguration {
3125
+ /** LLM provider: anthropic, openai, google, ollama */
3126
+ provider: LLMProvider;
3127
+ /** Model identifier (supports ${bb.x} resolution) */
3128
+ model: string;
3129
+ /** Optional system prompt (supports variable resolution) */
3130
+ systemPrompt?: string;
3131
+ /** Blackboard key for AgentMessage[] conversation history */
3132
+ messagesKey: string;
3133
+ /** Blackboard key for a new user message to append before calling LLM */
3134
+ userMessageKey?: string;
3135
+ /** Blackboard key for AgentToolDefinition[] (dynamic tools) */
3136
+ toolsKey?: string;
3137
+ /** Static tool definitions (used if toolsKey is not set) */
3138
+ tools?: AgentToolDefinition[];
3139
+ /** Sampling temperature (0-2) */
3140
+ temperature?: number;
3141
+ /** Maximum tokens to generate */
3142
+ maxTokens?: number;
3143
+ /** Output key on blackboard for response */
3144
+ outputKey: string;
3145
+ }
3146
+ /**
3147
+ * LLMToolCall Node
3148
+ *
3149
+ * Calls an LLM with tool definitions, manages conversation state,
3150
+ * and writes the response (including any tool calls) to the blackboard.
3151
+ *
3152
+ * @example YAML
3153
+ * ```yaml
3154
+ * type: LLMToolCall
3155
+ * id: call-llm
3156
+ * props:
3157
+ * provider: anthropic
3158
+ * model: claude-sonnet-4-20250514
3159
+ * systemPrompt: "You are a helpful assistant."
3160
+ * messagesKey: conversationMessages
3161
+ * userMessageKey: userMessage
3162
+ * tools:
3163
+ * - name: get_weather
3164
+ * description: "Get weather for a city"
3165
+ * inputSchema:
3166
+ * type: object
3167
+ * properties:
3168
+ * city: { type: string }
3169
+ * required: [city]
3170
+ * outputKey: llmResponse
3171
+ * ```
3172
+ */
3173
+ declare class LLMToolCall extends ActionNode {
3174
+ private provider;
3175
+ private model;
3176
+ private systemPrompt?;
3177
+ private messagesKey;
3178
+ private userMessageKey?;
3179
+ private toolsKey?;
3180
+ private tools?;
3181
+ private temperature?;
3182
+ private maxTokens?;
3183
+ private outputKey;
3184
+ constructor(config: LLMToolCallConfig);
3185
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
3186
+ }
3187
+
3188
+ /**
3189
+ * ToolExecutor Node
3190
+ *
3191
+ * Executes tool calls from an LLM response and appends results
3192
+ * back to the conversation as tool_result content blocks.
3193
+ *
3194
+ * Works in tandem with LLMToolCall: LLMToolCall produces tool calls,
3195
+ * ToolExecutor runs them and feeds results back to the conversation
3196
+ * so the next LLMToolCall iteration can see them.
3197
+ */
3198
+
3199
+ /**
3200
+ * Configuration for ToolExecutor node
3201
+ */
3202
+ interface ToolExecutorConfig extends NodeConfiguration {
3203
+ /** Blackboard key for LLMToolCall output (has .toolCalls) */
3204
+ responseKey: string;
3205
+ /** Blackboard key for AgentMessage[] (appends tool_results) */
3206
+ messagesKey: string;
3207
+ /** Optional: where to write tool results array */
3208
+ outputKey?: string;
3209
+ }
3210
+ /**
3211
+ * ToolExecutor Node
3212
+ *
3213
+ * Executes tool calls from the LLM response and appends tool_result
3214
+ * messages to the conversation for the next LLM turn.
3215
+ *
3216
+ * @example YAML
3217
+ * ```yaml
3218
+ * type: ToolExecutor
3219
+ * id: exec-tools
3220
+ * props:
3221
+ * responseKey: llmResponse
3222
+ * messagesKey: conversationMessages
3223
+ * ```
3224
+ */
3225
+ declare class ToolExecutor extends ActionNode {
3226
+ private responseKey;
3227
+ private messagesKey;
3228
+ private outputKey?;
3229
+ constructor(config: ToolExecutorConfig);
3230
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
3231
+ }
3232
+
3233
+ /**
3234
+ * WaitForSignal Node
3235
+ *
3236
+ * Pauses workflow execution until an external Temporal signal arrives.
3237
+ * Uses the same pattern as HumanTask: the actual waiting is done via
3238
+ * Temporal's condition() in the workflow layer, exposed as a pseudo-activity.
3239
+ *
3240
+ * Use cases:
3241
+ * - Multi-turn conversational agents waiting for user messages
3242
+ * - External event triggers (webhooks, API callbacks)
3243
+ * - Inter-workflow coordination
3244
+ */
3245
+
3246
+ /**
3247
+ * Configuration for WaitForSignal node
3248
+ */
3249
+ interface WaitForSignalConfig extends NodeConfiguration {
3250
+ /** Signal name to wait for (e.g., "user_message") */
3251
+ signalName: string;
3252
+ /** Optional discriminator key (supports ${input.x} resolution) */
3253
+ signalKey?: string;
3254
+ /** Timeout in milliseconds (default: 24h) */
3255
+ timeoutMs?: number;
3256
+ /** Blackboard key for received signal data */
3257
+ outputKey: string;
3258
+ }
3259
+ /**
3260
+ * WaitForSignal Node
3261
+ *
3262
+ * Waits for a generic Temporal signal and stores the payload in the blackboard.
3263
+ *
3264
+ * @example YAML - Wait for user message
3265
+ * ```yaml
3266
+ * type: WaitForSignal
3267
+ * id: wait-msg
3268
+ * props:
3269
+ * signalName: user_message
3270
+ * signalKey: "${input.sessionId}"
3271
+ * timeoutMs: 300000
3272
+ * outputKey: userInput
3273
+ * ```
3274
+ *
3275
+ * Signal via CLI:
3276
+ * ```bash
3277
+ * temporal workflow signal --workflow-id <id> --name genericSignal \
3278
+ * --input '{"signalName":"user_message","signalKey":"session-1","data":{"content":"Hello!"}}'
3279
+ * ```
3280
+ */
3281
+ declare class WaitForSignal extends ActionNode {
3282
+ private signalName;
3283
+ private signalKey?;
3284
+ private timeoutMs;
3285
+ private outputKey;
3286
+ constructor(config: WaitForSignalConfig);
3287
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
3288
+ }
3289
+
3290
+ /**
3291
+ * ToolRouter Node
3292
+ *
3293
+ * Dynamically selects which tools to expose to the LLM based on
3294
+ * intent matching or explicit rules. Writes the selected tool
3295
+ * definitions to a blackboard key that LLMToolCall reads via toolsKey.
3296
+ *
3297
+ * Use cases:
3298
+ * - Limit tools based on current agent phase (research vs action)
3299
+ * - Select tools based on user intent classification
3300
+ * - Reduce token usage by only sending relevant tools
3301
+ */
3302
+
3303
+ /**
3304
+ * Rule for matching intent to tool sets
3305
+ */
3306
+ interface ToolRouterRule {
3307
+ /** Regex pattern to match against intent */
3308
+ pattern: string;
3309
+ /** Tool set names to include when pattern matches */
3310
+ toolSets: string[];
3311
+ }
3312
+ /**
3313
+ * Configuration for ToolRouter node
3314
+ */
3315
+ interface ToolRouterConfig extends NodeConfiguration {
3316
+ /** Blackboard key for intent string to match against rules */
3317
+ intentKey: string;
3318
+ /** Named groups of tool definitions */
3319
+ toolSets: Record<string, AgentToolDefinition[]>;
3320
+ /** Tool set names that are always included */
3321
+ defaultTools?: string[];
3322
+ /** Rules: regex patterns mapped to tool set names */
3323
+ rules?: ToolRouterRule[];
3324
+ /** Blackboard key to write selected tools */
3325
+ outputKey: string;
3326
+ }
3327
+ /**
3328
+ * ToolRouter Node
3329
+ *
3330
+ * Selects tools based on intent matching and writes them to the blackboard.
3331
+ *
3332
+ * @example YAML
3333
+ * ```yaml
3334
+ * type: ToolRouter
3335
+ * id: select-tools
3336
+ * props:
3337
+ * intentKey: userIntent
3338
+ * toolSets:
3339
+ * weather:
3340
+ * - name: get_weather
3341
+ * description: "Get weather for a city"
3342
+ * inputSchema: { type: object, properties: { city: { type: string } } }
3343
+ * math:
3344
+ * - name: calculate
3345
+ * description: "Evaluate a math expression"
3346
+ * inputSchema: { type: object, properties: { expression: { type: string } } }
3347
+ * time:
3348
+ * - name: get_time
3349
+ * description: "Get current time"
3350
+ * inputSchema: { type: object, properties: { timezone: { type: string } } }
3351
+ * defaultTools: [time]
3352
+ * rules:
3353
+ * - pattern: "weather|forecast|temperature"
3354
+ * toolSets: [weather]
3355
+ * - pattern: "calc|math|compute"
3356
+ * toolSets: [math]
3357
+ * outputKey: selectedTools
3358
+ * ```
3359
+ */
3360
+ declare class ToolRouter extends ActionNode {
3361
+ private intentKey;
3362
+ private toolSets;
3363
+ private defaultTools;
3364
+ private rules;
3365
+ private outputKey;
3366
+ constructor(config: ToolRouterConfig);
3367
+ protected executeTick(context: TemporalContext): Promise<NodeStatus>;
3368
+ }
3369
+
3041
3370
  /**
3042
3371
  * Observability types for workflow execution tracking
3043
3372
  * Used by ExecutionTracker and Analyzer Agent
@@ -3241,7 +3570,7 @@ declare class ExecutionTracker {
3241
3570
  * Usage in workflow:
3242
3571
  * ```typescript
3243
3572
  * import { proxySinks } from '@temporalio/workflow';
3244
- * import type { ObservabilitySinks } from '@wayfarer-ai/btree-workflows';
3573
+ * import type { ObservabilitySinks } from '@q1k-oss/behaviour-tree-workflows';
3245
3574
  *
3246
3575
  * const { events } = proxySinks<ObservabilitySinks>();
3247
3576
  * events.push(nodeEvent); // Fire-and-forget
@@ -3301,7 +3630,7 @@ type InjectedObservabilitySinks = {
3301
3630
  *
3302
3631
  * Usage in worker:
3303
3632
  * ```typescript
3304
- * import { createObservabilitySinkHandler } from '@wayfarer-ai/btree-workflows';
3633
+ * import { createObservabilitySinkHandler } from '@q1k-oss/behaviour-tree-workflows';
3305
3634
  *
3306
3635
  * const sinks = createObservabilitySinkHandler({
3307
3636
  * onEvent: (workflowId, runId, event) => {
@@ -3317,4 +3646,4 @@ type InjectedObservabilitySinks = {
3317
3646
  */
3318
3647
  declare function createObservabilitySinkHandler(config?: SinkHandlerConfig): InjectedObservabilitySinks;
3319
3648
 
3320
- export { ActionNode, AlwaysCondition, BaseNode, BehaviorTree, type BtreeActivities, CheckCondition, CodeExecution, type CodeExecutionConfig, type CodeExecutionRequest, type CodeExecutionResult, CompositeNode, ConditionNode, Conditional, ConfigValidationError, ConfigurationError, CounterAction, type DataRef$1 as DataRef, type DataStore, DecoratorNode, Delay, type DeleteFileRequest, type DeleteFileResult, type DownloadFileRequest, type DownloadFileResult, type ExecutionProgress, ExecutionTracker, FailureNode, Fallback, type FileExistsRequest, type FileExistsResult, ForEach, ForceFailure, ForceSuccess, GenerateFile, type GenerateFileConfig, type GenerateFileRequest, type GenerateFileResult, HttpRequest, type HttpRequestActivity, type HttpRequestConfig, type HttpResponseActivity, type IScopedBlackboard, type ITreeRegistry, type InferSchema, type InjectedObservabilitySinks, IntegrationAction, type IntegrationActionConfig, type IntegrationContext, Invert, KeepRunningUntilFailure, type LoadOptions, type LogEventData, LogMessage, type LogMessageConfig, MemoryDataStore, MemorySequence, MockAction, type NodeConfiguration, type NodeConstructor, type NodeEvent, type NodeEventCallback, NodeEventEmitter, NodeEventType, type NodeMetadata, type NodeState, NodeStatus, type ObservabilitySinks, type ObservableNodeEvent, Parallel, type ParallelStrategy, ParseFile, type ParseFileConfig, type ParseFileRequest, type ParseFileResult, type ParsedPath, type PieceActivityRequest as PieceActionRequest, type PieceActivityRequest, type PieceAuth, type PortDefinition, Precondition, PrintAction, type PutOptions, PythonScript, type PythonScriptConfig, type PythonScriptRequest, type PythonScriptResult, ReactiveSequence, Recovery, RegexExtract, type RegexExtractConfig, Registry, Repeat, type ResolveOptions, ResumePoint, type ResumePointConfig, RunOnce, RunningNode, SchemaRegistry, ScopedBlackboard, Selector, SemanticValidationError, Sequence, SequenceWithMemory, type SinkHandlerConfig, SoftAssert, StructureValidationError, type StructuredError, SubTree, SuccessNode, type TemplateLoaderOptions, type TemporalContext, type TickContext, type TimelineEntry, Timeout, type TokenProvider, type TreeDefinition, type TreeNode, type UploadFileRequest, type UploadFileResult, type ValidatedNodeConfiguration, ValidationError, ValidationErrors, type ValidationOptions, type ValidationResult, type VariableContext, WaitAction, While, type WorkflowArgs, type WorkflowResult, YamlSyntaxError, clearPieceCache, createNodeSchema, createObservabilitySinkHandler, envTokenProvider, executePieceAction, extractVariables, getTemplateIds, hasTemplate, hasVariables, isDataRef, isPieceInstalled, listPieceActions, loadTemplate, loadTemplatesFromDirectory, loadTreeFromFile, loadTreeFromYaml, nodeConfigurationSchema, parseYaml, registerStandardNodes, resolveString, resolveValue, safeValidateConfiguration, schemaRegistry, semanticValidator, toYaml, treeDefinitionSchema, validateChildCount, validateChildCountRange, validateCompositeChildren, validateConfiguration, validateDecoratorChildren, validateTreeDefinition, validateYaml, validations, zodErrorToConfigurationError };
3649
+ export { A2UIComponent, ActionNode, AgentToolDefinition, AlwaysCondition, BaseNode, BehaviorTree, BrowserAgent, type BrowserAgentConfig, CheckCondition, ClaudeAgent, type ClaudeAgentConfig, ClaudeAgentMcpServerConfig, ClaudeAgentSubagent, CodeExecution, type CodeExecutionConfig, CompositeNode, ConditionNode, Conditional, ConfigValidationError, ConfigurationError, CounterAction, type DataStore, DecoratorNode, Delay, type ExecutionProgress, ExecutionTracker, FailureNode, Fallback, ForEach, ForceFailure, ForceSuccess, GenerateFile, type GenerateFileConfig, GitHubAction, type GitHubActionConfig, GitHubOperation, HttpRequest, type HttpRequestConfig, HumanTask, type HumanTaskConfig, IScopedBlackboard, type InferSchema, type InjectedObservabilitySinks, IntegrationAction, type IntegrationActionConfig, type IntegrationContext, Invert, KeepRunningUntilFailure, LLMChat, type LLMChatConfig, LLMProvider, LLMToolCall, type LLMToolCallConfig, type LoadOptions, LogMessage, type LogMessageConfig, MemoryDataStore, MemorySequence, MessageRole, MockAction, NodeConfiguration, NodeConstructor, NodeEventEmitter, NodeMetadata, type NodeState, NodeStatus, type ObservabilitySinks, type ObservableNodeEvent, Parallel, type ParallelStrategy, ParseFile, type ParseFileConfig, ParseFileRequest, type ParsedPath, PieceActivityRequest as PieceActionRequest, PieceActivityRequest, PortDefinition, Precondition, PrintAction, type PutOptions, PythonScript, type PythonScriptConfig, ReactiveSequence, Recovery, RegexExtract, type RegexExtractConfig, Registry, Repeat, type ResolveOptions, ResumePoint, type ResumePointConfig, RunOnce, RunningNode, SchemaRegistry, ScopedBlackboard, Selector, SemanticValidationError, Sequence, SequenceWithMemory, SetVariable, type SetVariableConfig, type SinkHandlerConfig, SoftAssert, StreamingSink, StructureValidationError, type StructuredError, SubTree, SuccessNode, type TemplateLoaderOptions, TemporalContext, type TimelineEntry, Timeout, TokenProvider, ToolExecutor, type ToolExecutorConfig, ToolRouter, type ToolRouterConfig, type TreeDefinition, TreeNode, type ValidatedNodeConfiguration, ValidationError, ValidationErrors, type ValidationOptions, type ValidationResult, type VariableContext, WaitAction, WaitForSignal, type WaitForSignalConfig, While, WorkflowArgs, WorkflowResult, YamlSyntaxError, clearPieceCache, createNodeSchema, createObservabilitySinkHandler, envTokenProvider, executePieceAction, extractVariables, getTemplateIds, hasTemplate, hasVariables, isDataRef, isPieceInstalled, listPieceActions, loadTemplate, loadTemplatesFromDirectory, loadTreeFromFile, loadTreeFromYaml, nodeConfigurationSchema, parseYaml, registerStandardNodes, resolveString, resolveValue, safeValidateConfiguration, schemaRegistry, semanticValidator, toYaml, treeDefinitionSchema, validateChildCount, validateChildCountRange, validateCompositeChildren, validateConfiguration, validateDecoratorChildren, validateTreeDefinition, validateYaml, validations, zodErrorToConfigurationError };