@q1k-oss/behaviour-tree-workflows 0.0.2 → 0.0.4
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/ai-sdk/index.cjs +296 -0
- package/dist/ai-sdk/index.d.cts +82 -0
- package/dist/ai-sdk/index.d.ts +82 -0
- package/dist/ai-sdk/index.js +269 -0
- package/dist/index.cjs +516 -12
- package/dist/index.d.cts +370 -821
- package/dist/index.d.ts +370 -821
- package/dist/index.js +510 -12
- package/dist/types-BJPlUisg.d.cts +931 -0
- package/dist/types-BJPlUisg.d.ts +931 -0
- package/package.json +48 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,825 +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.cjs';
|
|
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.cjs';
|
|
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 behaviour-tree
|
|
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
|
-
/** Execute LLM chat completion */
|
|
193
|
-
llmChat?: (request: LLMChatRequest) => Promise<LLMChatResult>;
|
|
194
|
-
/** Execute autonomous browser agent via Browserbase + Stagehand */
|
|
195
|
-
browserAgent?: (request: BrowserAgentRequest) => Promise<BrowserAgentResult>;
|
|
196
|
-
/** Execute autonomous Claude agent via Claude Agent SDK */
|
|
197
|
-
claudeAgent?: (request: ClaudeAgentRequest) => Promise<ClaudeAgentResult>;
|
|
198
|
-
/** Execute GitHub operations (create branch, PR, merge, etc.) */
|
|
199
|
-
githubAction?: (request: GitHubActionRequest) => Promise<GitHubActionResult>;
|
|
200
|
-
/** Create a human task (inserts into tasks table, returns taskId) */
|
|
201
|
-
createHumanTask?: (request: CreateHumanTaskRequest) => Promise<CreateHumanTaskResult>;
|
|
202
|
-
/** Wait for a human task to be completed (implemented as Temporal condition in workflow) */
|
|
203
|
-
waitForHumanTask?: (request: WaitForHumanTaskRequest) => Promise<WaitForHumanTaskResult>;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Authentication credentials for a piece
|
|
207
|
-
*/
|
|
208
|
-
type PieceAuth = {
|
|
209
|
-
access_token: string;
|
|
210
|
-
refresh_token?: string;
|
|
211
|
-
} | {
|
|
212
|
-
api_key: string;
|
|
213
|
-
} | Record<string, unknown>;
|
|
214
|
-
interface PieceActivityRequest {
|
|
215
|
-
provider: string;
|
|
216
|
-
action: string;
|
|
217
|
-
inputs: Record<string, unknown>;
|
|
218
|
-
auth: PieceAuth;
|
|
219
|
-
}
|
|
220
|
-
interface PythonScriptRequest {
|
|
221
|
-
/** Python code to execute */
|
|
222
|
-
code: string;
|
|
223
|
-
/** Blackboard snapshot (serializable) */
|
|
224
|
-
blackboard: Record<string, unknown>;
|
|
225
|
-
/** Workflow input (read-only) */
|
|
226
|
-
input?: Record<string, unknown>;
|
|
227
|
-
/** Allowed environment variables */
|
|
228
|
-
env?: Record<string, string>;
|
|
229
|
-
/** Execution timeout in ms */
|
|
230
|
-
timeout?: number;
|
|
231
|
-
}
|
|
232
|
-
interface PythonScriptResult {
|
|
233
|
-
/** Modified blackboard values */
|
|
234
|
-
blackboard: Record<string, unknown>;
|
|
235
|
-
/** Stdout from Python execution */
|
|
236
|
-
stdout?: string;
|
|
237
|
-
/** Stderr from Python execution */
|
|
238
|
-
stderr?: string;
|
|
239
|
-
}
|
|
240
|
-
interface ParseFileRequest {
|
|
241
|
-
/** File path or URL */
|
|
242
|
-
file: string;
|
|
243
|
-
/** File format (auto-detect if not specified) */
|
|
244
|
-
format?: "csv" | "xlsx" | "xls" | "auto";
|
|
245
|
-
/** Sheet name for Excel (default: first sheet) */
|
|
246
|
-
sheetName?: string;
|
|
247
|
-
/** Column mapping { "Original Name": "normalizedName" } */
|
|
248
|
-
columnMapping?: Record<string, string>;
|
|
249
|
-
/** Parse options */
|
|
250
|
-
options?: {
|
|
251
|
-
skipRows?: number;
|
|
252
|
-
trim?: boolean;
|
|
253
|
-
emptyAsNull?: boolean;
|
|
254
|
-
dateColumns?: string[];
|
|
255
|
-
dateFormat?: string;
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
interface ParseFileResult {
|
|
259
|
-
/** Parsed data rows */
|
|
260
|
-
data: Record<string, unknown>[];
|
|
261
|
-
/** Number of rows parsed */
|
|
262
|
-
rowCount: number;
|
|
263
|
-
/** Column names detected */
|
|
264
|
-
columns: string[];
|
|
265
|
-
}
|
|
266
|
-
interface GenerateFileRequest {
|
|
267
|
-
/** Output format */
|
|
268
|
-
format: "csv" | "xlsx" | "json";
|
|
269
|
-
/** Data to write */
|
|
270
|
-
data: Record<string, unknown>[];
|
|
271
|
-
/** Column definitions */
|
|
272
|
-
columns?: Array<{
|
|
273
|
-
header: string;
|
|
274
|
-
key: string;
|
|
275
|
-
width?: number;
|
|
276
|
-
}>;
|
|
277
|
-
/** Output filename */
|
|
278
|
-
filename: string;
|
|
279
|
-
/** Storage type */
|
|
280
|
-
storage: "temp" | "persistent";
|
|
281
|
-
}
|
|
282
|
-
interface GenerateFileResult {
|
|
283
|
-
/** Generated filename */
|
|
284
|
-
filename: string;
|
|
285
|
-
/** MIME type */
|
|
286
|
-
contentType: string;
|
|
287
|
-
/** File size in bytes */
|
|
288
|
-
size: number;
|
|
289
|
-
/** File path or storage key */
|
|
290
|
-
path: string;
|
|
291
|
-
/** Pre-signed download URL (if persistent) */
|
|
292
|
-
url?: string;
|
|
293
|
-
}
|
|
294
|
-
interface HttpRequestActivity {
|
|
295
|
-
url: string;
|
|
296
|
-
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
297
|
-
headers?: Record<string, string>;
|
|
298
|
-
body?: unknown;
|
|
299
|
-
timeout?: number;
|
|
300
|
-
}
|
|
301
|
-
interface HttpResponseActivity {
|
|
302
|
-
status: number;
|
|
303
|
-
headers: Record<string, string>;
|
|
304
|
-
data: unknown;
|
|
305
|
-
}
|
|
306
|
-
interface UploadFileRequest {
|
|
307
|
-
/** Base64-encoded file content */
|
|
308
|
-
fileBytes: string;
|
|
309
|
-
/** Target filename */
|
|
310
|
-
filename: string;
|
|
311
|
-
/** MIME type */
|
|
312
|
-
contentType?: string;
|
|
313
|
-
/** Workflow ID for organizing storage */
|
|
314
|
-
workflowId?: string;
|
|
315
|
-
}
|
|
316
|
-
interface UploadFileResult {
|
|
317
|
-
/** Reference to stored file */
|
|
318
|
-
dataRef: DataRef$1;
|
|
319
|
-
/** Uploaded filename */
|
|
320
|
-
filename: string;
|
|
321
|
-
/** File size in bytes */
|
|
322
|
-
sizeBytes: number;
|
|
323
|
-
}
|
|
324
|
-
interface DownloadFileRequest {
|
|
325
|
-
/** Reference to file in storage */
|
|
326
|
-
dataRef: DataRef$1;
|
|
327
|
-
}
|
|
328
|
-
interface DownloadFileResult {
|
|
329
|
-
/** Base64-encoded file content */
|
|
330
|
-
fileBytes: string;
|
|
331
|
-
/** File size in bytes */
|
|
332
|
-
sizeBytes: number;
|
|
333
|
-
}
|
|
334
|
-
interface DeleteFileRequest {
|
|
335
|
-
/** Reference to file in storage */
|
|
336
|
-
dataRef: DataRef$1;
|
|
337
|
-
}
|
|
338
|
-
interface DeleteFileResult {
|
|
339
|
-
/** Whether deletion was successful */
|
|
340
|
-
deleted: boolean;
|
|
341
|
-
/** Key of deleted file */
|
|
342
|
-
key: string;
|
|
343
|
-
}
|
|
344
|
-
interface FileExistsRequest {
|
|
345
|
-
/** Reference to file in storage */
|
|
346
|
-
dataRef: DataRef$1;
|
|
347
|
-
}
|
|
348
|
-
interface FileExistsResult {
|
|
349
|
-
/** Whether file exists */
|
|
350
|
-
exists: boolean;
|
|
351
|
-
/** Key checked */
|
|
352
|
-
key: string;
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Reference to data stored in a DataStore
|
|
356
|
-
* Import from data-store module for full type, this is a lightweight re-export
|
|
357
|
-
*/
|
|
358
|
-
interface DataRef$1 {
|
|
359
|
-
store: "gcs" | "s3" | "redis" | "memory";
|
|
360
|
-
key: string;
|
|
361
|
-
sizeBytes?: number;
|
|
362
|
-
expiresAt?: number;
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Request for code execution in a sandboxed environment
|
|
366
|
-
*/
|
|
367
|
-
interface CodeExecutionRequest {
|
|
368
|
-
/** Code to execute */
|
|
369
|
-
code: string;
|
|
370
|
-
/** Programming language */
|
|
371
|
-
language: "javascript" | "python";
|
|
372
|
-
/** References to large data stored in DataStore */
|
|
373
|
-
dataRefs?: Record<string, DataRef$1>;
|
|
374
|
-
/** Inline context data (small values) */
|
|
375
|
-
context?: Record<string, unknown>;
|
|
376
|
-
/** Workflow input data (read-only) */
|
|
377
|
-
input?: Record<string, unknown>;
|
|
378
|
-
/** Execution timeout in milliseconds */
|
|
379
|
-
timeout?: number;
|
|
380
|
-
/** Python packages to install before execution */
|
|
381
|
-
packages?: string[];
|
|
382
|
-
/** Associated workflow ID for data storage */
|
|
383
|
-
workflowId?: string;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Result from code execution
|
|
387
|
-
*/
|
|
388
|
-
interface CodeExecutionResult {
|
|
389
|
-
/** Small values returned inline */
|
|
390
|
-
values: Record<string, unknown>;
|
|
391
|
-
/** Large values stored in DataStore (returns refs) */
|
|
392
|
-
dataRefs: Record<string, DataRef$1>;
|
|
393
|
-
/** Console/stdout output from execution */
|
|
394
|
-
logs: string[];
|
|
395
|
-
/** Total execution time in milliseconds */
|
|
396
|
-
executionTimeMs: number;
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Supported LLM providers
|
|
400
|
-
*/
|
|
401
|
-
type LLMProvider = "anthropic" | "openai" | "google" | "ollama";
|
|
402
|
-
/**
|
|
403
|
-
* Message role in conversation
|
|
404
|
-
*/
|
|
405
|
-
type MessageRole = "system" | "user" | "assistant";
|
|
406
|
-
/**
|
|
407
|
-
* Single message in a conversation
|
|
408
|
-
*/
|
|
409
|
-
interface LLMMessage {
|
|
410
|
-
role: MessageRole;
|
|
411
|
-
content: string;
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Request for LLM chat completion
|
|
415
|
-
*/
|
|
416
|
-
interface LLMChatRequest {
|
|
417
|
-
/** LLM provider to use */
|
|
418
|
-
provider: LLMProvider;
|
|
419
|
-
/** Model identifier (e.g., "claude-sonnet-4-20250514", "gpt-4", "gemini-pro") */
|
|
420
|
-
model: string;
|
|
421
|
-
/** Conversation messages */
|
|
422
|
-
messages: LLMMessage[];
|
|
423
|
-
/** Optional system prompt (prepended as system message) */
|
|
424
|
-
systemPrompt?: string;
|
|
425
|
-
/** Sampling temperature (0-2, default: 1) */
|
|
426
|
-
temperature?: number;
|
|
427
|
-
/** Maximum tokens to generate */
|
|
428
|
-
maxTokens?: number;
|
|
429
|
-
/** Response format: "text" or "json" */
|
|
430
|
-
responseFormat?: "text" | "json";
|
|
431
|
-
/** JSON schema for structured output (when responseFormat is "json") */
|
|
432
|
-
jsonSchema?: Record<string, unknown>;
|
|
433
|
-
/** Request timeout in milliseconds */
|
|
434
|
-
timeout?: number;
|
|
435
|
-
/** Ollama-specific: base URL for local instance */
|
|
436
|
-
baseUrl?: string;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Result from LLM chat completion
|
|
440
|
-
*/
|
|
441
|
-
interface LLMChatResult {
|
|
442
|
-
/** Generated response content */
|
|
443
|
-
content: string;
|
|
444
|
-
/** Parsed JSON if responseFormat was "json" */
|
|
445
|
-
parsed?: unknown;
|
|
446
|
-
/** Token usage statistics */
|
|
447
|
-
usage: {
|
|
448
|
-
promptTokens: number;
|
|
449
|
-
completionTokens: number;
|
|
450
|
-
totalTokens: number;
|
|
451
|
-
};
|
|
452
|
-
/** Model used for completion */
|
|
453
|
-
model: string;
|
|
454
|
-
/** Finish reason */
|
|
455
|
-
finishReason: "stop" | "length" | "content_filter" | "tool_calls" | "error";
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Request for autonomous browser agent execution
|
|
459
|
-
*/
|
|
460
|
-
interface BrowserAgentRequest {
|
|
461
|
-
/** Goal/instruction for the agent to achieve */
|
|
462
|
-
goal: string;
|
|
463
|
-
/** Starting URL (optional - agent may navigate) */
|
|
464
|
-
startUrl?: string;
|
|
465
|
-
/** Context ID for persisting cookies/auth/cache (server-side) */
|
|
466
|
-
contextId?: string;
|
|
467
|
-
/** Whether to persist context changes (default: false) */
|
|
468
|
-
persistContext?: boolean;
|
|
469
|
-
/** Timeout for entire agent execution (ms) */
|
|
470
|
-
timeout?: number;
|
|
471
|
-
/** Max steps/actions the agent can take */
|
|
472
|
-
maxSteps?: number;
|
|
473
|
-
/** LLM provider for agent reasoning */
|
|
474
|
-
llmProvider?: LLMProvider;
|
|
475
|
-
/** LLM model for agent reasoning */
|
|
476
|
-
llmModel?: string;
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* Result from browser agent execution
|
|
480
|
-
*/
|
|
481
|
-
interface BrowserAgentResult {
|
|
482
|
-
/** Whether the agent achieved the goal (from Stagehand) */
|
|
483
|
-
success: boolean;
|
|
484
|
-
/** Whether execution completed (false if hit maxSteps limit) */
|
|
485
|
-
completed: boolean;
|
|
486
|
-
/** Human-readable summary of what was accomplished */
|
|
487
|
-
message: string;
|
|
488
|
-
actions: Array<{
|
|
489
|
-
type: string;
|
|
490
|
-
reasoning?: string;
|
|
491
|
-
taskCompleted: boolean;
|
|
492
|
-
pageUrl: string;
|
|
493
|
-
timestamp: number;
|
|
494
|
-
}>;
|
|
495
|
-
usage: {
|
|
496
|
-
inputTokens: number;
|
|
497
|
-
outputTokens: number;
|
|
498
|
-
reasoningTokens: number;
|
|
499
|
-
};
|
|
500
|
-
/** Browserbase session ID */
|
|
501
|
-
sessionId: string;
|
|
502
|
-
/** URL to view session recording */
|
|
503
|
-
debugUrl: string;
|
|
504
|
-
/** Final URL after agent execution */
|
|
505
|
-
finalUrl: string;
|
|
506
|
-
/** Context ID (for use in subsequent calls) */
|
|
507
|
-
contextId?: string;
|
|
508
|
-
executionTimeMs: number;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* MCP server configuration for ClaudeAgent
|
|
512
|
-
*/
|
|
513
|
-
type ClaudeAgentMcpServerConfig = {
|
|
514
|
-
type?: "stdio";
|
|
515
|
-
command: string;
|
|
516
|
-
args?: string[];
|
|
517
|
-
env?: Record<string, string>;
|
|
518
|
-
} | {
|
|
519
|
-
type: "sse";
|
|
520
|
-
url: string;
|
|
521
|
-
headers?: Record<string, string>;
|
|
522
|
-
} | {
|
|
523
|
-
type: "http";
|
|
524
|
-
url: string;
|
|
525
|
-
headers?: Record<string, string>;
|
|
526
|
-
};
|
|
527
|
-
/**
|
|
528
|
-
* Subagent definition for ClaudeAgent
|
|
529
|
-
*/
|
|
530
|
-
interface ClaudeAgentSubagent {
|
|
531
|
-
description: string;
|
|
532
|
-
prompt: string;
|
|
533
|
-
tools?: string[];
|
|
534
|
-
model?: "sonnet" | "opus" | "haiku" | "inherit";
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Request for autonomous Claude agent execution
|
|
538
|
-
*/
|
|
539
|
-
interface ClaudeAgentRequest {
|
|
540
|
-
/** Task prompt for the agent */
|
|
541
|
-
prompt: string;
|
|
542
|
-
/** Model to use (e.g., "claude-sonnet-4-5-20250929") */
|
|
543
|
-
model?: string;
|
|
544
|
-
/** System prompt for agent behavior */
|
|
545
|
-
systemPrompt?: string;
|
|
546
|
-
/** Tools the agent can use (e.g., ["Read", "Write", "Edit", "Bash"]) */
|
|
547
|
-
allowedTools?: string[];
|
|
548
|
-
/** Permission mode: default, acceptEdits, bypassPermissions */
|
|
549
|
-
permissionMode?: "default" | "acceptEdits" | "bypassPermissions";
|
|
550
|
-
/** Maximum conversation turns */
|
|
551
|
-
maxTurns?: number;
|
|
552
|
-
/** Maximum budget in USD */
|
|
553
|
-
maxBudgetUsd?: number;
|
|
554
|
-
/** Working directory for the agent */
|
|
555
|
-
cwd?: string;
|
|
556
|
-
/** MCP server configurations */
|
|
557
|
-
mcpServers?: Record<string, ClaudeAgentMcpServerConfig>;
|
|
558
|
-
/** Subagent definitions */
|
|
559
|
-
agents?: Record<string, ClaudeAgentSubagent>;
|
|
560
|
-
/** Extra context data passed from blackboard */
|
|
561
|
-
context?: Record<string, unknown>;
|
|
562
|
-
}
|
|
563
|
-
/**
|
|
564
|
-
* Result from Claude agent execution
|
|
565
|
-
*/
|
|
566
|
-
interface ClaudeAgentResult {
|
|
567
|
-
/** Final text result from the agent */
|
|
568
|
-
result: string;
|
|
569
|
-
/** Session ID for resuming/continuing */
|
|
570
|
-
sessionId: string;
|
|
571
|
-
/** Whether the agent completed successfully */
|
|
572
|
-
success: boolean;
|
|
573
|
-
/** Number of conversation turns used */
|
|
574
|
-
numTurns: number;
|
|
575
|
-
/** Total cost in USD */
|
|
576
|
-
totalCostUsd: number;
|
|
577
|
-
/** Token usage statistics */
|
|
578
|
-
usage: {
|
|
579
|
-
inputTokens: number;
|
|
580
|
-
outputTokens: number;
|
|
581
|
-
cacheReadTokens: number;
|
|
582
|
-
cacheCreationTokens: number;
|
|
583
|
-
};
|
|
584
|
-
/** Execution duration in milliseconds */
|
|
585
|
-
durationMs: number;
|
|
586
|
-
/** Errors encountered during execution */
|
|
587
|
-
errors?: string[];
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* Supported GitHub operations
|
|
591
|
-
*/
|
|
592
|
-
type GitHubOperation = "createBranch" | "createPullRequest" | "getPullRequest" | "mergePullRequest" | "closePullRequest" | "createReview" | "listIssues" | "addLabels" | "createComment" | "createRelease";
|
|
593
|
-
/**
|
|
594
|
-
* Request for a GitHub operation
|
|
595
|
-
*/
|
|
596
|
-
interface GitHubActionRequest {
|
|
597
|
-
/** The operation to perform */
|
|
598
|
-
operation: GitHubOperation;
|
|
599
|
-
/** Repository in "owner/repo" format */
|
|
600
|
-
repo: string;
|
|
601
|
-
/** Operation-specific parameters */
|
|
602
|
-
params: Record<string, unknown>;
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* Result of a GitHub operation
|
|
606
|
-
*/
|
|
607
|
-
interface GitHubActionResult {
|
|
608
|
-
/** Whether the operation succeeded */
|
|
609
|
-
success: boolean;
|
|
610
|
-
/** Operation-specific response data */
|
|
611
|
-
data: unknown;
|
|
612
|
-
/** The operation that was performed */
|
|
613
|
-
operation: GitHubOperation;
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* A2UI component definition for human task surfaces
|
|
617
|
-
*/
|
|
618
|
-
interface A2UIComponent {
|
|
619
|
-
id: string;
|
|
620
|
-
component: Record<string, unknown>;
|
|
621
|
-
weight?: number;
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Request to create a human task
|
|
625
|
-
*/
|
|
626
|
-
interface CreateHumanTaskRequest {
|
|
627
|
-
/** Btree node ID that created this task */
|
|
628
|
-
nodeId: string;
|
|
629
|
-
/** Tenant ID for multi-tenancy */
|
|
630
|
-
tenantId: string;
|
|
631
|
-
/** Execution/workflow ID */
|
|
632
|
-
executionId: string;
|
|
633
|
-
/** Task title */
|
|
634
|
-
title: string;
|
|
635
|
-
/** Task description */
|
|
636
|
-
description?: string;
|
|
637
|
-
/** Direct assignee email */
|
|
638
|
-
assigneeEmail?: string;
|
|
639
|
-
/** Role-based assignment */
|
|
640
|
-
assigneeRole?: string;
|
|
641
|
-
/** A2UI component definitions (the frozen surface template) */
|
|
642
|
-
a2uiComponents: A2UIComponent[];
|
|
643
|
-
/** Resolved A2UI data model (bindings already evaluated) */
|
|
644
|
-
a2uiDataModel: Record<string, unknown>;
|
|
645
|
-
/** Timeout in milliseconds before task expires */
|
|
646
|
-
timeoutMs?: number;
|
|
647
|
-
/** What to do on timeout: 'expire' | 'approve' | 'reject' */
|
|
648
|
-
onTimeout?: string;
|
|
649
|
-
/** Optional metadata */
|
|
650
|
-
metadata?: Record<string, unknown>;
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* Result from creating a human task
|
|
654
|
-
*/
|
|
655
|
-
interface CreateHumanTaskResult {
|
|
656
|
-
/** Generated task ID (UUID) */
|
|
657
|
-
taskId: string;
|
|
658
|
-
/** URL where the task can be accessed */
|
|
659
|
-
taskUrl: string;
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* Request to wait for a human task to be completed
|
|
663
|
-
*/
|
|
664
|
-
interface WaitForHumanTaskRequest {
|
|
665
|
-
/** Task ID to wait for */
|
|
666
|
-
taskId: string;
|
|
667
|
-
/** Node ID (for signal routing) */
|
|
668
|
-
nodeId: string;
|
|
669
|
-
/** Timeout in milliseconds */
|
|
670
|
-
timeoutMs?: number;
|
|
671
|
-
/** What to do on timeout */
|
|
672
|
-
onTimeout?: string;
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Result from a completed human task
|
|
676
|
-
*/
|
|
677
|
-
interface WaitForHumanTaskResult {
|
|
678
|
-
/** Whether the task was completed (vs timed out) */
|
|
679
|
-
completed: boolean;
|
|
680
|
-
/** Submitted form data from the user */
|
|
681
|
-
submittedData?: Record<string, unknown>;
|
|
682
|
-
/** Decision string (e.g., 'approved', 'rejected') */
|
|
683
|
-
decision?: string;
|
|
684
|
-
/** User ID who completed the task */
|
|
685
|
-
completedBy?: string;
|
|
686
|
-
/** Timestamp when completed */
|
|
687
|
-
completedAt?: string;
|
|
688
|
-
/** Whether the task timed out */
|
|
689
|
-
timedOut?: boolean;
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* Port definition for typed inputs/outputs
|
|
693
|
-
*/
|
|
694
|
-
interface PortDefinition {
|
|
695
|
-
name: string;
|
|
696
|
-
type: "input" | "output" | "inout";
|
|
697
|
-
description?: string;
|
|
698
|
-
defaultValue?: unknown;
|
|
699
|
-
required?: boolean;
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* Base interface for all tree nodes
|
|
703
|
-
*/
|
|
704
|
-
interface TreeNode {
|
|
705
|
-
readonly id: string;
|
|
706
|
-
readonly name: string;
|
|
707
|
-
readonly type: string;
|
|
708
|
-
tick(context: TemporalContext): Promise<NodeStatus>;
|
|
709
|
-
halt(): void;
|
|
710
|
-
reset(): void;
|
|
711
|
-
clone(): TreeNode;
|
|
712
|
-
providedPorts?(): PortDefinition[];
|
|
713
|
-
status(): NodeStatus;
|
|
714
|
-
lastError?: string;
|
|
715
|
-
parent?: TreeNode;
|
|
716
|
-
children?: TreeNode[];
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* Constructor type for node factories
|
|
720
|
-
*/
|
|
721
|
-
type NodeConstructor<T extends TreeNode = TreeNode> = new (config: NodeConfiguration) => T;
|
|
722
|
-
/**
|
|
723
|
-
* Node metadata for registry
|
|
724
|
-
*/
|
|
725
|
-
interface NodeMetadata {
|
|
726
|
-
type: string;
|
|
727
|
-
category: "action" | "condition" | "decorator" | "composite" | "subtree";
|
|
728
|
-
description?: string;
|
|
729
|
-
ports?: PortDefinition[];
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Interface for tree registry (session-scoped)
|
|
733
|
-
* Used by nodes like StepGroup and LocateElement to lookup behavior trees
|
|
734
|
-
*/
|
|
735
|
-
interface ITreeRegistry {
|
|
736
|
-
hasTree(id: string): boolean;
|
|
737
|
-
cloneTree(id: string): {
|
|
738
|
-
getRoot(): TreeNode;
|
|
739
|
-
};
|
|
740
|
-
getAllTreeIds(): string[];
|
|
741
|
-
registerTree(id: string, tree: {
|
|
742
|
-
getRoot(): TreeNode;
|
|
743
|
-
clone(): {
|
|
744
|
-
getRoot(): TreeNode;
|
|
745
|
-
};
|
|
746
|
-
}, sourceFile: string): void;
|
|
747
|
-
getTree(id: string): {
|
|
748
|
-
getRoot(): TreeNode;
|
|
749
|
-
clone(): {
|
|
750
|
-
getRoot(): TreeNode;
|
|
751
|
-
};
|
|
752
|
-
} | undefined;
|
|
753
|
-
getTreeSourceFile(id: string): string | undefined;
|
|
754
|
-
getTreesForFile(filePath: string): Map<string, {
|
|
755
|
-
getRoot(): TreeNode;
|
|
756
|
-
clone(): {
|
|
757
|
-
getRoot(): TreeNode;
|
|
758
|
-
};
|
|
759
|
-
}>;
|
|
760
|
-
}
|
|
761
|
-
/**
|
|
762
|
-
* Interface for scoped blackboard
|
|
763
|
-
*/
|
|
764
|
-
interface IScopedBlackboard {
|
|
765
|
-
get(key: string): unknown;
|
|
766
|
-
set(key: string, value: unknown): void;
|
|
767
|
-
has(key: string): boolean;
|
|
768
|
-
delete(key: string): void;
|
|
769
|
-
clear(): void;
|
|
770
|
-
createScope(name: string): IScopedBlackboard;
|
|
771
|
-
getParentScope(): IScopedBlackboard | null;
|
|
772
|
-
getScopeName(): string;
|
|
773
|
-
getFullScopePath(): string;
|
|
774
|
-
getPort<T>(key: string, defaultValue?: T): T;
|
|
775
|
-
setPort<T>(key: string, value: T): void;
|
|
776
|
-
keys(): string[];
|
|
777
|
-
entries(): [string, unknown][];
|
|
778
|
-
toJSON(): Record<string, unknown>;
|
|
779
|
-
clone(): IScopedBlackboard;
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Arguments passed to a BehaviorTree workflow
|
|
783
|
-
*/
|
|
784
|
-
interface WorkflowArgs {
|
|
785
|
-
/**
|
|
786
|
-
* Input data to initialize the blackboard
|
|
787
|
-
*/
|
|
788
|
-
input?: Record<string, unknown>;
|
|
789
|
-
/**
|
|
790
|
-
* Tree registry for looking up subtrees
|
|
791
|
-
*/
|
|
792
|
-
treeRegistry: ITreeRegistry;
|
|
793
|
-
/**
|
|
794
|
-
* Optional session ID
|
|
795
|
-
*/
|
|
796
|
-
sessionId?: string;
|
|
797
|
-
/**
|
|
798
|
-
* Activity functions for I/O operations (optional)
|
|
799
|
-
* When provided, nodes that support activities will use them instead of inline execution
|
|
800
|
-
* Controlplane creates these via proxyActivities() and passes them here
|
|
801
|
-
*/
|
|
802
|
-
activities?: BtreeActivities;
|
|
803
|
-
/**
|
|
804
|
-
* Token provider for IntegrationAction authentication (optional)
|
|
805
|
-
* Returns OAuth tokens or API keys for third-party services
|
|
806
|
-
*/
|
|
807
|
-
tokenProvider?: TokenProvider;
|
|
808
|
-
}
|
|
809
|
-
/**
|
|
810
|
-
* Result returned from a BehaviorTree workflow
|
|
811
|
-
*/
|
|
812
|
-
interface WorkflowResult {
|
|
813
|
-
/**
|
|
814
|
-
* Final status of the tree
|
|
815
|
-
*/
|
|
816
|
-
status: NodeStatus;
|
|
817
|
-
/**
|
|
818
|
-
* Final blackboard state
|
|
819
|
-
*/
|
|
820
|
-
output: Record<string, unknown>;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
6
|
/**
|
|
824
7
|
* Abstract base class for all tree nodes
|
|
825
8
|
*/
|
|
@@ -1558,6 +741,55 @@ declare class SoftAssert extends DecoratorNode {
|
|
|
1558
741
|
protected onReset(): void;
|
|
1559
742
|
}
|
|
1560
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
|
+
|
|
1561
793
|
/**
|
|
1562
794
|
* Timeout decorator node
|
|
1563
795
|
* Fails if the child doesn't complete within a specified time
|
|
@@ -1792,7 +1024,9 @@ declare class MockAction extends ActionNode {
|
|
|
1792
1024
|
protected onHalt(): void;
|
|
1793
1025
|
}
|
|
1794
1026
|
/**
|
|
1795
|
-
* 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.
|
|
1796
1030
|
*/
|
|
1797
1031
|
declare class CheckCondition extends ConditionNode {
|
|
1798
1032
|
private key;
|
|
@@ -1803,6 +1037,11 @@ declare class CheckCondition extends ConditionNode {
|
|
|
1803
1037
|
operator?: string;
|
|
1804
1038
|
value: unknown;
|
|
1805
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;
|
|
1806
1045
|
executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1807
1046
|
}
|
|
1808
1047
|
/**
|
|
@@ -2043,6 +1282,54 @@ declare class RegexExtract extends ActionNode {
|
|
|
2043
1282
|
executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
2044
1283
|
}
|
|
2045
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
|
+
|
|
2046
1333
|
/**
|
|
2047
1334
|
* Unified Variable Resolver
|
|
2048
1335
|
*
|
|
@@ -3818,6 +3105,268 @@ declare class HumanTask extends ActionNode {
|
|
|
3818
3105
|
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
3819
3106
|
}
|
|
3820
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
|
+
|
|
3821
3370
|
/**
|
|
3822
3371
|
* Observability types for workflow execution tracking
|
|
3823
3372
|
* Used by ExecutionTracker and Analyzer Agent
|
|
@@ -4097,4 +3646,4 @@ type InjectedObservabilitySinks = {
|
|
|
4097
3646
|
*/
|
|
4098
3647
|
declare function createObservabilitySinkHandler(config?: SinkHandlerConfig): InjectedObservabilitySinks;
|
|
4099
3648
|
|
|
4100
|
-
export {
|
|
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 };
|