blueprint-extractor-mcp 7.0.4 → 7.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.
|
@@ -137,22 +137,31 @@ function validateTransitionTargets(payload, warnings) {
|
|
|
137
137
|
function validateBindingPropertyPaths(payload, warnings) {
|
|
138
138
|
if (!payload)
|
|
139
139
|
return;
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
warnings.push(`Binding [${i}]: targetPath requires at least one segment`);
|
|
140
|
+
const validateArray = (bindings, label) => {
|
|
141
|
+
for (const [i, binding] of bindings.entries()) {
|
|
142
|
+
const b = binding;
|
|
143
|
+
// Skip validation for string paths — they'll be parsed by normalizeBindingPaths
|
|
144
|
+
if (typeof b.sourcePath === 'string' || typeof b.targetPath === 'string')
|
|
145
|
+
continue;
|
|
146
|
+
const sourcePath = b.sourcePath;
|
|
147
|
+
const targetPath = b.targetPath;
|
|
148
|
+
if (!sourcePath?.segments?.length) {
|
|
149
|
+
warnings.push(`${label}[${i}]: sourcePath requires at least one segment`);
|
|
150
|
+
}
|
|
151
|
+
if (!targetPath?.segments?.length) {
|
|
152
|
+
warnings.push(`${label}[${i}]: targetPath requires at least one segment`);
|
|
153
|
+
}
|
|
155
154
|
}
|
|
155
|
+
};
|
|
156
|
+
// Check nested format: bindings.propertyBindings
|
|
157
|
+
const bindingsObj = (payload.bindings ?? payload.stateTree?.bindings);
|
|
158
|
+
if (bindingsObj?.propertyBindings && Array.isArray(bindingsObj.propertyBindings)) {
|
|
159
|
+
validateArray(bindingsObj.propertyBindings, 'Binding');
|
|
160
|
+
}
|
|
161
|
+
// Check flat format: propertyBindings at payload level
|
|
162
|
+
const flatBindings = (payload.propertyBindings ?? payload.stateTree?.propertyBindings);
|
|
163
|
+
if (Array.isArray(flatBindings)) {
|
|
164
|
+
validateArray(flatBindings, 'Binding');
|
|
156
165
|
}
|
|
157
166
|
}
|
|
158
167
|
/**
|
|
@@ -189,21 +198,34 @@ function normalizeBindingPaths(payload) {
|
|
|
189
198
|
result.structId = structId;
|
|
190
199
|
return result;
|
|
191
200
|
};
|
|
192
|
-
// Process
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
if (!bindingsObj?.propertyBindings || !Array.isArray(bindingsObj.propertyBindings))
|
|
196
|
-
return;
|
|
197
|
-
for (const binding of bindingsObj.propertyBindings) {
|
|
201
|
+
// Process a propertyBindings array in place
|
|
202
|
+
const processBindingArray = (bindings) => {
|
|
203
|
+
for (const binding of bindings) {
|
|
198
204
|
const b = binding;
|
|
199
205
|
b.sourcePath = convert(b.sourcePath);
|
|
200
206
|
b.targetPath = convert(b.targetPath);
|
|
201
207
|
}
|
|
202
208
|
};
|
|
203
|
-
|
|
209
|
+
// Process nested bindings at payload level (bindings.propertyBindings)
|
|
210
|
+
const processNestedBindings = (obj) => {
|
|
211
|
+
const bindingsObj = obj.bindings;
|
|
212
|
+
if (bindingsObj?.propertyBindings && Array.isArray(bindingsObj.propertyBindings)) {
|
|
213
|
+
processBindingArray(bindingsObj.propertyBindings);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
// Process flat propertyBindings at payload level (used by set_bindings, add_binding,
|
|
217
|
+
// and patch_state flat format)
|
|
218
|
+
const processFlatBindings = (obj) => {
|
|
219
|
+
if (Array.isArray(obj.propertyBindings)) {
|
|
220
|
+
processBindingArray(obj.propertyBindings);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
processNestedBindings(payload);
|
|
224
|
+
processFlatBindings(payload);
|
|
204
225
|
// Also check inside stateTree envelope
|
|
205
226
|
if (payload.stateTree && typeof payload.stateTree === 'object') {
|
|
206
|
-
|
|
227
|
+
processNestedBindings(payload.stateTree);
|
|
228
|
+
processFlatBindings(payload.stateTree);
|
|
207
229
|
}
|
|
208
230
|
}
|
|
209
231
|
export function registerSchemaAndAiAuthoringTools({ server, callSubsystemJson, jsonObjectSchema, userDefinedStructMutationOperationSchema, userDefinedStructFieldSchema, userDefinedEnumMutationOperationSchema, userDefinedEnumEntrySchema, blackboardMutationOperationSchema, blackboardKeySchema, behaviorTreeMutationOperationSchema, behaviorTreeNodeSelectorSchema, stateTreeMutationOperationSchema, stateTreeStateSelectorSchema, stateTreeEditorNodeSelectorSchema, stateTreeTransitionSelectorSchema, stateTreeBindingsObjectSchema, }) {
|