@q1k-oss/behaviour-tree-workflows 0.0.3 → 0.0.5
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.cjs +694 -51
- package/dist/index.d.cts +244 -1
- package/dist/index.d.ts +244 -1
- package/dist/index.js +688 -51
- package/package.json +22 -9
package/dist/index.d.cts
CHANGED
|
@@ -1330,6 +1330,249 @@ declare class SetVariable extends ActionNode {
|
|
|
1330
1330
|
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1331
1331
|
}
|
|
1332
1332
|
|
|
1333
|
+
/**
|
|
1334
|
+
* MathOp Node
|
|
1335
|
+
*
|
|
1336
|
+
* Safe arithmetic expression evaluation with blackboard variable resolution.
|
|
1337
|
+
* Uses a recursive descent parser — NO eval().
|
|
1338
|
+
*
|
|
1339
|
+
* Supports: +, -, *, /, %, (), unary minus, numeric literals, ${bb.x} references.
|
|
1340
|
+
*
|
|
1341
|
+
* @example YAML
|
|
1342
|
+
* ```yaml
|
|
1343
|
+
* type: MathOp
|
|
1344
|
+
* id: compute-rate
|
|
1345
|
+
* props:
|
|
1346
|
+
* expression: "${bb.orderCount} / (${bb.lookbackMinutes} / 60)"
|
|
1347
|
+
* outputKey: hourlyRate
|
|
1348
|
+
* round: round
|
|
1349
|
+
* precision: 1
|
|
1350
|
+
* ```
|
|
1351
|
+
*/
|
|
1352
|
+
|
|
1353
|
+
interface MathOpConfig extends NodeConfiguration {
|
|
1354
|
+
/** Arithmetic expression with ${bb.x} references */
|
|
1355
|
+
expression: string;
|
|
1356
|
+
/** Blackboard key to store result */
|
|
1357
|
+
outputKey: string;
|
|
1358
|
+
/** Rounding mode: "none" (default) | "round" | "floor" | "ceil" */
|
|
1359
|
+
round?: "none" | "round" | "floor" | "ceil";
|
|
1360
|
+
/** Decimal precision for rounding (e.g., 1 = one decimal place) */
|
|
1361
|
+
precision?: number;
|
|
1362
|
+
}
|
|
1363
|
+
/** Exported for testing */
|
|
1364
|
+
declare function safeEvaluate(expression: string): number;
|
|
1365
|
+
declare class MathOp extends ActionNode {
|
|
1366
|
+
private expression;
|
|
1367
|
+
private outputKey;
|
|
1368
|
+
private round;
|
|
1369
|
+
private precision;
|
|
1370
|
+
constructor(config: MathOpConfig);
|
|
1371
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* ArrayFilter Node
|
|
1376
|
+
*
|
|
1377
|
+
* Declaratively filter arrays by field conditions.
|
|
1378
|
+
* Replaces array.filter() CodeExecution blocks.
|
|
1379
|
+
*
|
|
1380
|
+
* @example YAML
|
|
1381
|
+
* ```yaml
|
|
1382
|
+
* type: ArrayFilter
|
|
1383
|
+
* id: filter-unfulfilled
|
|
1384
|
+
* props:
|
|
1385
|
+
* input: "${bb.customerOrders}"
|
|
1386
|
+
* outputKey: unfulfilledOrders
|
|
1387
|
+
* conditions:
|
|
1388
|
+
* - field: fulfillment_status
|
|
1389
|
+
* operator: in
|
|
1390
|
+
* value: [null, "unfulfilled"]
|
|
1391
|
+
* - field: pending_hours
|
|
1392
|
+
* operator: gt
|
|
1393
|
+
* value: "${bb.thresholdHours}"
|
|
1394
|
+
* logic: and
|
|
1395
|
+
* ```
|
|
1396
|
+
*/
|
|
1397
|
+
|
|
1398
|
+
interface FilterCondition {
|
|
1399
|
+
/** Dot-path field on each item */
|
|
1400
|
+
field: string;
|
|
1401
|
+
/** Comparison operator */
|
|
1402
|
+
operator: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "in" | "nin" | "exists" | "regex" | "between" | "contains";
|
|
1403
|
+
/** Value to compare against (supports variable resolution) */
|
|
1404
|
+
value?: unknown;
|
|
1405
|
+
/** For "between" operator: [min, max] inclusive */
|
|
1406
|
+
range?: [unknown, unknown];
|
|
1407
|
+
}
|
|
1408
|
+
interface ArrayFilterConfig extends NodeConfiguration {
|
|
1409
|
+
/** Source array (supports variable resolution) */
|
|
1410
|
+
input: string;
|
|
1411
|
+
/** Blackboard key to store filtered result */
|
|
1412
|
+
outputKey: string;
|
|
1413
|
+
/** Filter conditions */
|
|
1414
|
+
conditions: FilterCondition[];
|
|
1415
|
+
/** Logic for combining conditions: "and" (default) | "or" */
|
|
1416
|
+
logic?: "and" | "or";
|
|
1417
|
+
}
|
|
1418
|
+
declare class ArrayFilter extends ActionNode {
|
|
1419
|
+
private input;
|
|
1420
|
+
private outputKey;
|
|
1421
|
+
private conditions;
|
|
1422
|
+
private logic;
|
|
1423
|
+
constructor(config: ArrayFilterConfig);
|
|
1424
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
* Aggregate Node
|
|
1429
|
+
*
|
|
1430
|
+
* Compute metrics (count, sum, avg, min, max) over arrays with optional groupBy.
|
|
1431
|
+
* Replaces manual accumulation loops in CodeExecution.
|
|
1432
|
+
*
|
|
1433
|
+
* @example YAML
|
|
1434
|
+
* ```yaml
|
|
1435
|
+
* type: Aggregate
|
|
1436
|
+
* id: order-stats
|
|
1437
|
+
* props:
|
|
1438
|
+
* input: "${bb.windowOrders}"
|
|
1439
|
+
* outputKey: orderStats
|
|
1440
|
+
* operations:
|
|
1441
|
+
* - type: count
|
|
1442
|
+
* as: orderCount
|
|
1443
|
+
* - type: sum
|
|
1444
|
+
* field: total_price
|
|
1445
|
+
* as: totalRevenue
|
|
1446
|
+
* groupBy: financial_status
|
|
1447
|
+
* ```
|
|
1448
|
+
*/
|
|
1449
|
+
|
|
1450
|
+
interface AggregateOperation {
|
|
1451
|
+
/** Aggregation type */
|
|
1452
|
+
type: "count" | "sum" | "avg" | "min" | "max";
|
|
1453
|
+
/** Dot-path field to aggregate (not needed for "count") */
|
|
1454
|
+
field?: string;
|
|
1455
|
+
/** Result key name (defaults to type or type_field) */
|
|
1456
|
+
as?: string;
|
|
1457
|
+
}
|
|
1458
|
+
interface AggregateConfig extends NodeConfiguration {
|
|
1459
|
+
/** Source array (supports variable resolution) */
|
|
1460
|
+
input: string;
|
|
1461
|
+
/** Blackboard key to store result */
|
|
1462
|
+
outputKey: string;
|
|
1463
|
+
/** Aggregation operations */
|
|
1464
|
+
operations: AggregateOperation[];
|
|
1465
|
+
/** Optional field to group by before aggregating */
|
|
1466
|
+
groupBy?: string;
|
|
1467
|
+
}
|
|
1468
|
+
declare class Aggregate extends ActionNode {
|
|
1469
|
+
private input;
|
|
1470
|
+
private outputKey;
|
|
1471
|
+
private operations;
|
|
1472
|
+
private groupBy?;
|
|
1473
|
+
constructor(config: AggregateConfig);
|
|
1474
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* ThresholdCheck Node
|
|
1479
|
+
*
|
|
1480
|
+
* Multi-level threshold classification. Returns FAILURE when breach conditions
|
|
1481
|
+
* are met, enabling behavior tree control flow (Recovery, Selector alternatives).
|
|
1482
|
+
*
|
|
1483
|
+
* @example YAML
|
|
1484
|
+
* ```yaml
|
|
1485
|
+
* type: ThresholdCheck
|
|
1486
|
+
* id: check-stock
|
|
1487
|
+
* props:
|
|
1488
|
+
* value: "${bb.currentVariant.inventory_quantity}"
|
|
1489
|
+
* thresholds:
|
|
1490
|
+
* - operator: lte
|
|
1491
|
+
* value: 0
|
|
1492
|
+
* label: out_of_stock
|
|
1493
|
+
* - operator: lte
|
|
1494
|
+
* value: "${bb.lowStockThreshold}"
|
|
1495
|
+
* label: low_stock
|
|
1496
|
+
* outputKey: stockStatus
|
|
1497
|
+
* failOn: [out_of_stock, low_stock]
|
|
1498
|
+
* ```
|
|
1499
|
+
*/
|
|
1500
|
+
|
|
1501
|
+
interface ThresholdLevel {
|
|
1502
|
+
/** Comparison operator */
|
|
1503
|
+
operator: "lte" | "lt" | "gte" | "gt" | "eq" | "ne" | "between";
|
|
1504
|
+
/** Threshold value (supports variable resolution) */
|
|
1505
|
+
value?: unknown;
|
|
1506
|
+
/** For "between": [min, max] inclusive */
|
|
1507
|
+
range?: [unknown, unknown];
|
|
1508
|
+
/** Label assigned when this threshold matches */
|
|
1509
|
+
label: string;
|
|
1510
|
+
}
|
|
1511
|
+
interface ThresholdCheckConfig extends NodeConfiguration {
|
|
1512
|
+
/** Value to check (supports variable resolution) */
|
|
1513
|
+
value: unknown;
|
|
1514
|
+
/** Threshold levels, evaluated top-to-bottom (first match wins) */
|
|
1515
|
+
thresholds: ThresholdLevel[];
|
|
1516
|
+
/** Blackboard key to store the matched label */
|
|
1517
|
+
outputKey?: string;
|
|
1518
|
+
/** Labels that cause the node to return FAILURE */
|
|
1519
|
+
failOn?: string[];
|
|
1520
|
+
}
|
|
1521
|
+
declare class ThresholdCheck extends ActionNode {
|
|
1522
|
+
private valueRef;
|
|
1523
|
+
private thresholds;
|
|
1524
|
+
private outputKey?;
|
|
1525
|
+
private failOn;
|
|
1526
|
+
constructor(config: ThresholdCheckConfig);
|
|
1527
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* DataTransform Node
|
|
1532
|
+
*
|
|
1533
|
+
* Build objects from blackboard values using declarative field mappings.
|
|
1534
|
+
* Replaces snapshot-construction CodeExecution blocks.
|
|
1535
|
+
*
|
|
1536
|
+
* @example YAML
|
|
1537
|
+
* ```yaml
|
|
1538
|
+
* type: DataTransform
|
|
1539
|
+
* id: build-snapshot
|
|
1540
|
+
* props:
|
|
1541
|
+
* outputKey: snapshotData
|
|
1542
|
+
* wrapInArray: true
|
|
1543
|
+
* mappings:
|
|
1544
|
+
* - target: metricName
|
|
1545
|
+
* value: "order_volume_hourly"
|
|
1546
|
+
* - target: context_json.orderCount
|
|
1547
|
+
* value: "${bb.orderStats.orderCount}"
|
|
1548
|
+
* coerce: number
|
|
1549
|
+
* ```
|
|
1550
|
+
*/
|
|
1551
|
+
|
|
1552
|
+
interface TransformMapping {
|
|
1553
|
+
/** Target field name (dot notation for nesting: "context_json.totalOrders") */
|
|
1554
|
+
target: string;
|
|
1555
|
+
/** Source value: variable reference "${bb.x}" or literal */
|
|
1556
|
+
value: unknown;
|
|
1557
|
+
/** Optional type coercion */
|
|
1558
|
+
coerce?: "string" | "number" | "boolean";
|
|
1559
|
+
}
|
|
1560
|
+
interface DataTransformConfig extends NodeConfiguration {
|
|
1561
|
+
/** Blackboard key to store result */
|
|
1562
|
+
outputKey: string;
|
|
1563
|
+
/** Field mappings */
|
|
1564
|
+
mappings: TransformMapping[];
|
|
1565
|
+
/** Wrap result in array (default: false) */
|
|
1566
|
+
wrapInArray?: boolean;
|
|
1567
|
+
}
|
|
1568
|
+
declare class DataTransform extends ActionNode {
|
|
1569
|
+
private outputKey;
|
|
1570
|
+
private mappings;
|
|
1571
|
+
private wrapInArray;
|
|
1572
|
+
constructor(config: DataTransformConfig);
|
|
1573
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1333
1576
|
/**
|
|
1334
1577
|
* Unified Variable Resolver
|
|
1335
1578
|
*
|
|
@@ -3646,4 +3889,4 @@ type InjectedObservabilitySinks = {
|
|
|
3646
3889
|
*/
|
|
3647
3890
|
declare function createObservabilitySinkHandler(config?: SinkHandlerConfig): InjectedObservabilitySinks;
|
|
3648
3891
|
|
|
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 };
|
|
3892
|
+
export { A2UIComponent, ActionNode, AgentToolDefinition, Aggregate, type AggregateConfig, type AggregateOperation, AlwaysCondition, ArrayFilter, type ArrayFilterConfig, BaseNode, BehaviorTree, BrowserAgent, type BrowserAgentConfig, CheckCondition, ClaudeAgent, type ClaudeAgentConfig, ClaudeAgentMcpServerConfig, ClaudeAgentSubagent, CodeExecution, type CodeExecutionConfig, CompositeNode, ConditionNode, Conditional, ConfigValidationError, ConfigurationError, CounterAction, type DataStore, DataTransform, type DataTransformConfig, DecoratorNode, Delay, type ExecutionProgress, ExecutionTracker, FailureNode, Fallback, type FilterCondition, 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, MathOp, type MathOpConfig, 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, ThresholdCheck, type ThresholdCheckConfig, type ThresholdLevel, type TimelineEntry, Timeout, TokenProvider, ToolExecutor, type ToolExecutorConfig, ToolRouter, type ToolRouterConfig, type TransformMapping, 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, safeEvaluate, safeValidateConfiguration, schemaRegistry, semanticValidator, toYaml, treeDefinitionSchema, validateChildCount, validateChildCountRange, validateCompositeChildren, validateConfiguration, validateDecoratorChildren, validateTreeDefinition, validateYaml, validations, zodErrorToConfigurationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1330,6 +1330,249 @@ declare class SetVariable extends ActionNode {
|
|
|
1330
1330
|
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1331
1331
|
}
|
|
1332
1332
|
|
|
1333
|
+
/**
|
|
1334
|
+
* MathOp Node
|
|
1335
|
+
*
|
|
1336
|
+
* Safe arithmetic expression evaluation with blackboard variable resolution.
|
|
1337
|
+
* Uses a recursive descent parser — NO eval().
|
|
1338
|
+
*
|
|
1339
|
+
* Supports: +, -, *, /, %, (), unary minus, numeric literals, ${bb.x} references.
|
|
1340
|
+
*
|
|
1341
|
+
* @example YAML
|
|
1342
|
+
* ```yaml
|
|
1343
|
+
* type: MathOp
|
|
1344
|
+
* id: compute-rate
|
|
1345
|
+
* props:
|
|
1346
|
+
* expression: "${bb.orderCount} / (${bb.lookbackMinutes} / 60)"
|
|
1347
|
+
* outputKey: hourlyRate
|
|
1348
|
+
* round: round
|
|
1349
|
+
* precision: 1
|
|
1350
|
+
* ```
|
|
1351
|
+
*/
|
|
1352
|
+
|
|
1353
|
+
interface MathOpConfig extends NodeConfiguration {
|
|
1354
|
+
/** Arithmetic expression with ${bb.x} references */
|
|
1355
|
+
expression: string;
|
|
1356
|
+
/** Blackboard key to store result */
|
|
1357
|
+
outputKey: string;
|
|
1358
|
+
/** Rounding mode: "none" (default) | "round" | "floor" | "ceil" */
|
|
1359
|
+
round?: "none" | "round" | "floor" | "ceil";
|
|
1360
|
+
/** Decimal precision for rounding (e.g., 1 = one decimal place) */
|
|
1361
|
+
precision?: number;
|
|
1362
|
+
}
|
|
1363
|
+
/** Exported for testing */
|
|
1364
|
+
declare function safeEvaluate(expression: string): number;
|
|
1365
|
+
declare class MathOp extends ActionNode {
|
|
1366
|
+
private expression;
|
|
1367
|
+
private outputKey;
|
|
1368
|
+
private round;
|
|
1369
|
+
private precision;
|
|
1370
|
+
constructor(config: MathOpConfig);
|
|
1371
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* ArrayFilter Node
|
|
1376
|
+
*
|
|
1377
|
+
* Declaratively filter arrays by field conditions.
|
|
1378
|
+
* Replaces array.filter() CodeExecution blocks.
|
|
1379
|
+
*
|
|
1380
|
+
* @example YAML
|
|
1381
|
+
* ```yaml
|
|
1382
|
+
* type: ArrayFilter
|
|
1383
|
+
* id: filter-unfulfilled
|
|
1384
|
+
* props:
|
|
1385
|
+
* input: "${bb.customerOrders}"
|
|
1386
|
+
* outputKey: unfulfilledOrders
|
|
1387
|
+
* conditions:
|
|
1388
|
+
* - field: fulfillment_status
|
|
1389
|
+
* operator: in
|
|
1390
|
+
* value: [null, "unfulfilled"]
|
|
1391
|
+
* - field: pending_hours
|
|
1392
|
+
* operator: gt
|
|
1393
|
+
* value: "${bb.thresholdHours}"
|
|
1394
|
+
* logic: and
|
|
1395
|
+
* ```
|
|
1396
|
+
*/
|
|
1397
|
+
|
|
1398
|
+
interface FilterCondition {
|
|
1399
|
+
/** Dot-path field on each item */
|
|
1400
|
+
field: string;
|
|
1401
|
+
/** Comparison operator */
|
|
1402
|
+
operator: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "in" | "nin" | "exists" | "regex" | "between" | "contains";
|
|
1403
|
+
/** Value to compare against (supports variable resolution) */
|
|
1404
|
+
value?: unknown;
|
|
1405
|
+
/** For "between" operator: [min, max] inclusive */
|
|
1406
|
+
range?: [unknown, unknown];
|
|
1407
|
+
}
|
|
1408
|
+
interface ArrayFilterConfig extends NodeConfiguration {
|
|
1409
|
+
/** Source array (supports variable resolution) */
|
|
1410
|
+
input: string;
|
|
1411
|
+
/** Blackboard key to store filtered result */
|
|
1412
|
+
outputKey: string;
|
|
1413
|
+
/** Filter conditions */
|
|
1414
|
+
conditions: FilterCondition[];
|
|
1415
|
+
/** Logic for combining conditions: "and" (default) | "or" */
|
|
1416
|
+
logic?: "and" | "or";
|
|
1417
|
+
}
|
|
1418
|
+
declare class ArrayFilter extends ActionNode {
|
|
1419
|
+
private input;
|
|
1420
|
+
private outputKey;
|
|
1421
|
+
private conditions;
|
|
1422
|
+
private logic;
|
|
1423
|
+
constructor(config: ArrayFilterConfig);
|
|
1424
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
* Aggregate Node
|
|
1429
|
+
*
|
|
1430
|
+
* Compute metrics (count, sum, avg, min, max) over arrays with optional groupBy.
|
|
1431
|
+
* Replaces manual accumulation loops in CodeExecution.
|
|
1432
|
+
*
|
|
1433
|
+
* @example YAML
|
|
1434
|
+
* ```yaml
|
|
1435
|
+
* type: Aggregate
|
|
1436
|
+
* id: order-stats
|
|
1437
|
+
* props:
|
|
1438
|
+
* input: "${bb.windowOrders}"
|
|
1439
|
+
* outputKey: orderStats
|
|
1440
|
+
* operations:
|
|
1441
|
+
* - type: count
|
|
1442
|
+
* as: orderCount
|
|
1443
|
+
* - type: sum
|
|
1444
|
+
* field: total_price
|
|
1445
|
+
* as: totalRevenue
|
|
1446
|
+
* groupBy: financial_status
|
|
1447
|
+
* ```
|
|
1448
|
+
*/
|
|
1449
|
+
|
|
1450
|
+
interface AggregateOperation {
|
|
1451
|
+
/** Aggregation type */
|
|
1452
|
+
type: "count" | "sum" | "avg" | "min" | "max";
|
|
1453
|
+
/** Dot-path field to aggregate (not needed for "count") */
|
|
1454
|
+
field?: string;
|
|
1455
|
+
/** Result key name (defaults to type or type_field) */
|
|
1456
|
+
as?: string;
|
|
1457
|
+
}
|
|
1458
|
+
interface AggregateConfig extends NodeConfiguration {
|
|
1459
|
+
/** Source array (supports variable resolution) */
|
|
1460
|
+
input: string;
|
|
1461
|
+
/** Blackboard key to store result */
|
|
1462
|
+
outputKey: string;
|
|
1463
|
+
/** Aggregation operations */
|
|
1464
|
+
operations: AggregateOperation[];
|
|
1465
|
+
/** Optional field to group by before aggregating */
|
|
1466
|
+
groupBy?: string;
|
|
1467
|
+
}
|
|
1468
|
+
declare class Aggregate extends ActionNode {
|
|
1469
|
+
private input;
|
|
1470
|
+
private outputKey;
|
|
1471
|
+
private operations;
|
|
1472
|
+
private groupBy?;
|
|
1473
|
+
constructor(config: AggregateConfig);
|
|
1474
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* ThresholdCheck Node
|
|
1479
|
+
*
|
|
1480
|
+
* Multi-level threshold classification. Returns FAILURE when breach conditions
|
|
1481
|
+
* are met, enabling behavior tree control flow (Recovery, Selector alternatives).
|
|
1482
|
+
*
|
|
1483
|
+
* @example YAML
|
|
1484
|
+
* ```yaml
|
|
1485
|
+
* type: ThresholdCheck
|
|
1486
|
+
* id: check-stock
|
|
1487
|
+
* props:
|
|
1488
|
+
* value: "${bb.currentVariant.inventory_quantity}"
|
|
1489
|
+
* thresholds:
|
|
1490
|
+
* - operator: lte
|
|
1491
|
+
* value: 0
|
|
1492
|
+
* label: out_of_stock
|
|
1493
|
+
* - operator: lte
|
|
1494
|
+
* value: "${bb.lowStockThreshold}"
|
|
1495
|
+
* label: low_stock
|
|
1496
|
+
* outputKey: stockStatus
|
|
1497
|
+
* failOn: [out_of_stock, low_stock]
|
|
1498
|
+
* ```
|
|
1499
|
+
*/
|
|
1500
|
+
|
|
1501
|
+
interface ThresholdLevel {
|
|
1502
|
+
/** Comparison operator */
|
|
1503
|
+
operator: "lte" | "lt" | "gte" | "gt" | "eq" | "ne" | "between";
|
|
1504
|
+
/** Threshold value (supports variable resolution) */
|
|
1505
|
+
value?: unknown;
|
|
1506
|
+
/** For "between": [min, max] inclusive */
|
|
1507
|
+
range?: [unknown, unknown];
|
|
1508
|
+
/** Label assigned when this threshold matches */
|
|
1509
|
+
label: string;
|
|
1510
|
+
}
|
|
1511
|
+
interface ThresholdCheckConfig extends NodeConfiguration {
|
|
1512
|
+
/** Value to check (supports variable resolution) */
|
|
1513
|
+
value: unknown;
|
|
1514
|
+
/** Threshold levels, evaluated top-to-bottom (first match wins) */
|
|
1515
|
+
thresholds: ThresholdLevel[];
|
|
1516
|
+
/** Blackboard key to store the matched label */
|
|
1517
|
+
outputKey?: string;
|
|
1518
|
+
/** Labels that cause the node to return FAILURE */
|
|
1519
|
+
failOn?: string[];
|
|
1520
|
+
}
|
|
1521
|
+
declare class ThresholdCheck extends ActionNode {
|
|
1522
|
+
private valueRef;
|
|
1523
|
+
private thresholds;
|
|
1524
|
+
private outputKey?;
|
|
1525
|
+
private failOn;
|
|
1526
|
+
constructor(config: ThresholdCheckConfig);
|
|
1527
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* DataTransform Node
|
|
1532
|
+
*
|
|
1533
|
+
* Build objects from blackboard values using declarative field mappings.
|
|
1534
|
+
* Replaces snapshot-construction CodeExecution blocks.
|
|
1535
|
+
*
|
|
1536
|
+
* @example YAML
|
|
1537
|
+
* ```yaml
|
|
1538
|
+
* type: DataTransform
|
|
1539
|
+
* id: build-snapshot
|
|
1540
|
+
* props:
|
|
1541
|
+
* outputKey: snapshotData
|
|
1542
|
+
* wrapInArray: true
|
|
1543
|
+
* mappings:
|
|
1544
|
+
* - target: metricName
|
|
1545
|
+
* value: "order_volume_hourly"
|
|
1546
|
+
* - target: context_json.orderCount
|
|
1547
|
+
* value: "${bb.orderStats.orderCount}"
|
|
1548
|
+
* coerce: number
|
|
1549
|
+
* ```
|
|
1550
|
+
*/
|
|
1551
|
+
|
|
1552
|
+
interface TransformMapping {
|
|
1553
|
+
/** Target field name (dot notation for nesting: "context_json.totalOrders") */
|
|
1554
|
+
target: string;
|
|
1555
|
+
/** Source value: variable reference "${bb.x}" or literal */
|
|
1556
|
+
value: unknown;
|
|
1557
|
+
/** Optional type coercion */
|
|
1558
|
+
coerce?: "string" | "number" | "boolean";
|
|
1559
|
+
}
|
|
1560
|
+
interface DataTransformConfig extends NodeConfiguration {
|
|
1561
|
+
/** Blackboard key to store result */
|
|
1562
|
+
outputKey: string;
|
|
1563
|
+
/** Field mappings */
|
|
1564
|
+
mappings: TransformMapping[];
|
|
1565
|
+
/** Wrap result in array (default: false) */
|
|
1566
|
+
wrapInArray?: boolean;
|
|
1567
|
+
}
|
|
1568
|
+
declare class DataTransform extends ActionNode {
|
|
1569
|
+
private outputKey;
|
|
1570
|
+
private mappings;
|
|
1571
|
+
private wrapInArray;
|
|
1572
|
+
constructor(config: DataTransformConfig);
|
|
1573
|
+
protected executeTick(context: TemporalContext): Promise<NodeStatus>;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1333
1576
|
/**
|
|
1334
1577
|
* Unified Variable Resolver
|
|
1335
1578
|
*
|
|
@@ -3646,4 +3889,4 @@ type InjectedObservabilitySinks = {
|
|
|
3646
3889
|
*/
|
|
3647
3890
|
declare function createObservabilitySinkHandler(config?: SinkHandlerConfig): InjectedObservabilitySinks;
|
|
3648
3891
|
|
|
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 };
|
|
3892
|
+
export { A2UIComponent, ActionNode, AgentToolDefinition, Aggregate, type AggregateConfig, type AggregateOperation, AlwaysCondition, ArrayFilter, type ArrayFilterConfig, BaseNode, BehaviorTree, BrowserAgent, type BrowserAgentConfig, CheckCondition, ClaudeAgent, type ClaudeAgentConfig, ClaudeAgentMcpServerConfig, ClaudeAgentSubagent, CodeExecution, type CodeExecutionConfig, CompositeNode, ConditionNode, Conditional, ConfigValidationError, ConfigurationError, CounterAction, type DataStore, DataTransform, type DataTransformConfig, DecoratorNode, Delay, type ExecutionProgress, ExecutionTracker, FailureNode, Fallback, type FilterCondition, 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, MathOp, type MathOpConfig, 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, ThresholdCheck, type ThresholdCheckConfig, type ThresholdLevel, type TimelineEntry, Timeout, TokenProvider, ToolExecutor, type ToolExecutorConfig, ToolRouter, type ToolRouterConfig, type TransformMapping, 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, safeEvaluate, safeValidateConfiguration, schemaRegistry, semanticValidator, toYaml, treeDefinitionSchema, validateChildCount, validateChildCountRange, validateCompositeChildren, validateConfiguration, validateDecoratorChildren, validateTreeDefinition, validateYaml, validations, zodErrorToConfigurationError };
|