fix: optimize agent compiler and complete handler cleanup

- Add deployment-aware handler generation (filters web-only/ide-only commands)
- Remove unused run-workflow handler type (ghost handler cleanup)
- Implement missing validate-workflow and data handler generation
- Update schema validation to support exactly 6 active handler types
- Clean up activation templates and web bundler logic
- Prevent generation of unused handler instructions for better performance
- All 62 tests pass with backward compatibility maintained
This commit is contained in:
Brian Madison
2025-11-23 21:28:50 -06:00
parent cd98a7f5bb
commit 3740a554f0
15 changed files with 56 additions and 59 deletions

View File

@@ -748,10 +748,9 @@ class WebBundler {
}
}
// Extract workflow references - both 'workflow' and 'run-workflow' attributes
// Extract workflow references from agent files
const workflowPatterns = [
/workflow="([^"]+)"/g, // Menu items with workflow attribute
/run-workflow="([^"]+)"/g, // Commands with run-workflow attribute
/validate-workflow="([^"]+)"/g, // Validation workflow references
];
@@ -789,16 +788,6 @@ class WebBundler {
// Match: <item cmd="..." workflow="workflowPath">...</item>
const itemWorkflowPattern = new RegExp(`\\s*<item\\s+[^>]*workflow="[^"]*${escapedPath}"[^>]*>.*?</item>\\s*`, 'gs');
modifiedXml = modifiedXml.replace(itemWorkflowPattern, '');
// Pattern 2: Remove <item> tags with run-workflow attribute
// Match: <item cmd="..." run-workflow="workflowPath">...</item>
const itemRunWorkflowPattern = new RegExp(`\\s*<item\\s+[^>]*run-workflow="[^"]*${escapedPath}"[^>]*>.*?</item>\\s*`, 'gs');
modifiedXml = modifiedXml.replace(itemRunWorkflowPattern, '');
// Pattern 3: Remove <c> tags with run-workflow attribute (legacy)
// Match: <c cmd="..." run-workflow="workflowPath">...</c>
const cPattern = new RegExp(`\\s*<c\\s+[^>]*run-workflow="[^"]*${escapedPath}"[^>]*>.*?</c>\\s*`, 'gs');
modifiedXml = modifiedXml.replace(cPattern, '');
}
return modifiedXml;