@q1k-oss/behaviour-tree-workflows 0.0.5 → 0.0.6
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 +16 -1
- package/dist/index.js +16 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1193,6 +1193,21 @@ var Conditional = class extends CompositeNode {
|
|
|
1193
1193
|
};
|
|
1194
1194
|
|
|
1195
1195
|
// src/composites/for-each.ts
|
|
1196
|
+
function resolveFromBlackboard(blackboard, path2) {
|
|
1197
|
+
const parts = path2.split(".");
|
|
1198
|
+
const firstPart = parts[0];
|
|
1199
|
+
if (!firstPart) return void 0;
|
|
1200
|
+
let value = blackboard.get(firstPart);
|
|
1201
|
+
for (let i = 1; i < parts.length && value != null; i++) {
|
|
1202
|
+
const part = parts[i];
|
|
1203
|
+
if (part && typeof value === "object") {
|
|
1204
|
+
value = value[part];
|
|
1205
|
+
} else {
|
|
1206
|
+
return void 0;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
return value;
|
|
1210
|
+
}
|
|
1196
1211
|
var ForEach = class extends CompositeNode {
|
|
1197
1212
|
collectionKey;
|
|
1198
1213
|
itemKey;
|
|
@@ -1216,7 +1231,7 @@ var ForEach = class extends CompositeNode {
|
|
|
1216
1231
|
"ForEach requires at least one child (body)"
|
|
1217
1232
|
);
|
|
1218
1233
|
}
|
|
1219
|
-
const collection = context.blackboard.get(this.collectionKey);
|
|
1234
|
+
const collection = this.collectionKey.includes(".") ? resolveFromBlackboard(context.blackboard, this.collectionKey) : context.blackboard.get(this.collectionKey);
|
|
1220
1235
|
if (!collection) {
|
|
1221
1236
|
this.log(`Collection '${this.collectionKey}' not found in blackboard`);
|
|
1222
1237
|
this._status = "FAILURE" /* FAILURE */;
|
package/dist/index.js
CHANGED
|
@@ -1045,6 +1045,21 @@ var Conditional = class extends CompositeNode {
|
|
|
1045
1045
|
};
|
|
1046
1046
|
|
|
1047
1047
|
// src/composites/for-each.ts
|
|
1048
|
+
function resolveFromBlackboard(blackboard, path2) {
|
|
1049
|
+
const parts = path2.split(".");
|
|
1050
|
+
const firstPart = parts[0];
|
|
1051
|
+
if (!firstPart) return void 0;
|
|
1052
|
+
let value = blackboard.get(firstPart);
|
|
1053
|
+
for (let i = 1; i < parts.length && value != null; i++) {
|
|
1054
|
+
const part = parts[i];
|
|
1055
|
+
if (part && typeof value === "object") {
|
|
1056
|
+
value = value[part];
|
|
1057
|
+
} else {
|
|
1058
|
+
return void 0;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
return value;
|
|
1062
|
+
}
|
|
1048
1063
|
var ForEach = class extends CompositeNode {
|
|
1049
1064
|
collectionKey;
|
|
1050
1065
|
itemKey;
|
|
@@ -1068,7 +1083,7 @@ var ForEach = class extends CompositeNode {
|
|
|
1068
1083
|
"ForEach requires at least one child (body)"
|
|
1069
1084
|
);
|
|
1070
1085
|
}
|
|
1071
|
-
const collection = context.blackboard.get(this.collectionKey);
|
|
1086
|
+
const collection = this.collectionKey.includes(".") ? resolveFromBlackboard(context.blackboard, this.collectionKey) : context.blackboard.get(this.collectionKey);
|
|
1072
1087
|
if (!collection) {
|
|
1073
1088
|
this.log(`Collection '${this.collectionKey}' not found in blackboard`);
|
|
1074
1089
|
this._status = "FAILURE" /* FAILURE */;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@q1k-oss/behaviour-tree-workflows",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Behavior tree library for TypeScript — 30+ production-ready nodes, YAML workflows, Temporal integration, and built-in observability",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|