snow-flow 2.5.0 → 2.6.1

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/cli.js CHANGED
@@ -904,88 +904,15 @@ TodoWrite([
904
904
  ]);
905
905
  \`\`\`
906
906
 
907
- ### 4. Spawn Specialized Agents
908
- Based on the task _analysis, spawn the following agents using the Task tool:
907
+ ### 4. Intelligent Agent Spawning with Dependency-Based Batching
909
908
 
910
- **Primary Agent**: ${taskAnalysis.primaryAgent}
911
- \`\`\`javascript
912
- // Spawn primary agent
913
- Task("${taskAnalysis.primaryAgent}", \`
914
- You are the primary ${taskAnalysis.primaryAgent} agent for this swarm.
915
-
916
- Objective: ${objective}
917
- Session: ${sessionId}
918
- Task Type: ${taskAnalysis.taskType}
919
-
920
- Instructions:
921
- 1. FIRST: Read ALL shared context from memory:
922
- - mcp__snow-flow__memory_usage({key: "swarm_session_${sessionId}", namespace: "swarm_${sessionId}"})
923
- - mcp__snow-flow__memory_usage({key: "existing_artifacts_${sessionId}", namespace: "swarm_${sessionId}"})
924
- - mcp__snow-flow__memory_usage({key: "update_set_${sessionId}", namespace: "swarm_${sessionId}"})
925
- - mcp__snow-flow__memory_usage({key: "table_schemas_${sessionId}", namespace: "swarm_${sessionId}"})
926
-
927
- 2. 🔍 CRITICAL: Use discovered table schemas:
928
- - The table_schemas contain actual field names, types, and relationships
929
- - ALWAYS use the exact field names from the schema (e.g., 'short_description' not 'description')
930
- - Check key_fields for primary keys and references
931
- - If you need a table that wasn't discovered, use snow_table_schema_discovery first
932
-
933
- 3. Check existing_artifacts to avoid duplication - reuse or extend existing ones
934
- 4. ALL deployments MUST use the Update Set stored in memory
935
- 5. Begin implementing the core ${taskAnalysis.taskType} requirements
936
- 6. Store all work progress with: mcp__snow-flow__memory_usage({key: "agent_${taskAnalysis.primaryAgent}_progress", value: "...", namespace: "agents_${sessionId}"})
937
- 7. Update TodoWrite items as you complete tasks
938
- 8. Read other agents' progress from namespace "agents_${sessionId}"
939
-
940
- 🔐 AUTHENTICATION: Already validated by Queen. Use MCP tools directly.
941
- 📦 UPDATE SET: Use the one from memory - DO NOT create a new one!
942
- 📊 TABLES: Use exact field names from discovered schemas!
943
- \`);
944
- \`\`\`
909
+ **CRITICAL: Spawn agents in SMART BATCHES based on dependencies!**
945
910
 
946
- **Supporting Agents**:
947
- ${taskAnalysis.supportingAgents.map((agent, index) => `
948
- Agent ${index + 2}: ${agent}
949
- \`\`\`javascript
950
- // Spawn ${agent}
951
- Task("${agent}", \`
952
- You are a supporting ${agent} agent in this swarm.
953
-
954
- Role: ${agent}
955
- Session: ${sessionId}
956
- Primary Agent: ${taskAnalysis.primaryAgent}
957
-
958
- Instructions:
959
- 1. FIRST: Read ALL shared context from memory (same as primary agent):
960
- - mcp__snow-flow__memory_usage({key: "swarm_session_${sessionId}", namespace: "swarm_${sessionId}"})
961
- - mcp__snow-flow__memory_usage({key: "existing_artifacts_${sessionId}", namespace: "swarm_${sessionId}"})
962
- - mcp__snow-flow__memory_usage({key: "update_set_${sessionId}", namespace: "swarm_${sessionId}"})
963
- - mcp__snow-flow__memory_usage({key: "table_schemas_${sessionId}", namespace: "swarm_${sessionId}"})
964
-
965
- 2. 🔍 CRITICAL: Use discovered table schemas:
966
- - The table_schemas contain actual field names, types, and relationships
967
- - ALWAYS use the exact field names from the schema (e.g., 'short_description' not 'description')
968
- - Check key_fields for primary keys and references
969
- - If you need a table that wasn't discovered, use snow_table_schema_discovery first
970
-
971
- 3. Monitor primary agent's progress: mcp__snow-flow__memory_search({pattern: "agent_${taskAnalysis.primaryAgent}_*", namespace: "agents_${sessionId}"})
972
- 4. Wait for primary agent to establish base structure before major changes
973
- 5. Enhance/support with your ${agent} expertise
974
- 6. Store your progress: mcp__snow-flow__memory_usage({key: "agent_${agent}_progress", value: "...", namespace: "agents_${sessionId}"})
975
- 7. Update relevant TodoWrite items
976
-
977
- 🔐 AUTHENTICATION: Already validated by Queen. Use MCP tools directly.
978
- 📦 UPDATE SET: Use the one from memory - DO NOT create a new one!
979
- 📊 TABLES: Use exact field names from discovered schemas!
980
-
981
- 🔐 AUTHENTICATION REQUIREMENTS:
982
- - ALWAYS use MCP tools first - inherit auth status from primary agent
983
- - If auth fails, contribute to the PLANNING documentation
984
- - Store all plans in Memory for future deployment
985
- \`);
986
- \`\`\``).join('\n')}
987
-
988
- ### 4. Memory Coordination Pattern
911
+ Based on the task analysis, we need to spawn ${taskAnalysis.estimatedAgentCount} agents.
912
+
913
+ ${getAgentSpawnStrategy(taskAnalysis)}
914
+
915
+ ### 5. Memory Coordination Pattern
989
916
  All agents MUST use this memory coordination pattern:
990
917
 
991
918
  \`\`\`javascript
@@ -1879,6 +1806,183 @@ function extractName(objective, type) {
1879
1806
  }
1880
1807
  return `Generated ${type}`;
1881
1808
  }
1809
+ /**
1810
+ * Generate intelligent agent spawning strategy based on task dependencies
1811
+ * Creates execution batches for sequential and parallel execution
1812
+ */
1813
+ function getAgentSpawnStrategy(taskAnalysis) {
1814
+ const { primaryAgent, supportingAgents, taskType, serviceNowArtifacts } = taskAnalysis;
1815
+ // Define agent dependencies - which agents must run before others
1816
+ const agentDependencies = {
1817
+ // Architecture/Design agents must run first
1818
+ 'architect': [],
1819
+ 'app-architect': [],
1820
+ // Script/Code agents depend on architecture
1821
+ 'script-writer': ['architect', 'app-architect'],
1822
+ 'coder': ['architect', 'app-architect'],
1823
+ // UI agents can run after architecture, parallel with backend
1824
+ 'widget-creator': ['architect', 'app-architect'],
1825
+ 'css-specialist': ['widget-creator'],
1826
+ 'frontend-specialist': ['widget-creator'],
1827
+ 'backend-specialist': ['architect', 'app-architect'],
1828
+ // Flow agents depend on architecture
1829
+ 'flow-builder': ['architect', 'app-architect'],
1830
+ 'trigger-specialist': ['flow-builder'],
1831
+ 'action-specialist': ['flow-builder'],
1832
+ 'approval-specialist': ['flow-builder'],
1833
+ // Integration agents can run in parallel with others
1834
+ 'integration-specialist': ['architect'],
1835
+ 'api-specialist': ['architect'],
1836
+ // Testing/Security agents run last
1837
+ 'tester': ['script-writer', 'widget-creator', 'flow-builder', 'frontend-specialist', 'backend-specialist'],
1838
+ 'security-specialist': ['script-writer', 'api-specialist'],
1839
+ 'performance-specialist': ['frontend-specialist', 'backend-specialist'],
1840
+ // Error handling depends on main implementation
1841
+ 'error-handler': ['flow-builder', 'script-writer'],
1842
+ // Documentation can run in parallel
1843
+ 'documentation-specialist': [],
1844
+ // Specialized agents
1845
+ 'ml-developer': ['architect', 'script-writer'],
1846
+ 'database-expert': ['architect'],
1847
+ 'analyst': ['architect']
1848
+ };
1849
+ // Create dependency graph
1850
+ const allAgents = [primaryAgent, ...supportingAgents];
1851
+ const agentBatches = [];
1852
+ const processedAgents = new Set();
1853
+ // Helper to check if all dependencies are met
1854
+ const canExecute = (agent) => {
1855
+ const deps = agentDependencies[agent] || [];
1856
+ return deps.every(dep => processedAgents.has(dep));
1857
+ };
1858
+ // Create batches based on dependencies
1859
+ while (processedAgents.size < allAgents.length) {
1860
+ const currentBatch = [];
1861
+ for (const agent of allAgents) {
1862
+ if (!processedAgents.has(agent) && canExecute(agent)) {
1863
+ currentBatch.push(agent);
1864
+ }
1865
+ }
1866
+ if (currentBatch.length === 0) {
1867
+ // Circular dependency or missing dependency - add remaining agents
1868
+ for (const agent of allAgents) {
1869
+ if (!processedAgents.has(agent)) {
1870
+ currentBatch.push(agent);
1871
+ }
1872
+ }
1873
+ }
1874
+ if (currentBatch.length > 0) {
1875
+ agentBatches.push(currentBatch);
1876
+ currentBatch.forEach(agent => processedAgents.add(agent));
1877
+ }
1878
+ }
1879
+ // Generate the strategy prompt
1880
+ let strategy = `
1881
+ **🧠 Intelligent Dependency-Based Agent Execution Plan:**
1882
+
1883
+ `;
1884
+ // Show execution batches
1885
+ agentBatches.forEach((batch, index) => {
1886
+ const isParallel = batch.length > 1;
1887
+ const executionType = isParallel ? '⚡ PARALLEL EXECUTION' : '📦 SEQUENTIAL STEP';
1888
+ strategy += `**Batch ${index + 1} - ${executionType}:**\n`;
1889
+ if (isParallel) {
1890
+ strategy += `\`\`\`javascript
1891
+ // 🚀 Execute these ${batch.length} agents IN PARALLEL (single message, multiple Tasks)
1892
+ `;
1893
+ batch.forEach(agent => {
1894
+ const agentPrompt = getAgentPromptForBatch(agent, taskType);
1895
+ strategy += `Task("${agent}", \`${agentPrompt}\`);
1896
+ `;
1897
+ });
1898
+ strategy += `\`\`\`\n\n`;
1899
+ }
1900
+ else {
1901
+ strategy += `\`\`\`javascript
1902
+ // 📦 Execute this agent FIRST before proceeding
1903
+ `;
1904
+ const agent = batch[0];
1905
+ const agentPrompt = getAgentPromptForBatch(agent, taskType);
1906
+ strategy += `Task("${agent}", \`${agentPrompt}\`);
1907
+ `;
1908
+ strategy += `\`\`\`\n\n`;
1909
+ }
1910
+ // Add wait/coordination note if not the last batch
1911
+ if (index < agentBatches.length - 1) {
1912
+ strategy += `**⏸️ WAIT for Batch ${index + 1} completion before proceeding to Batch ${index + 2}**\n\n`;
1913
+ }
1914
+ });
1915
+ // Add execution summary
1916
+ const totalBatches = agentBatches.length;
1917
+ const parallelBatches = agentBatches.filter(b => b.length > 1).length;
1918
+ const maxParallelAgents = Math.max(...agentBatches.map(b => b.length));
1919
+ strategy += `
1920
+ **📊 Execution Summary:**
1921
+ - Total Execution Batches: ${totalBatches}
1922
+ - Parallel Batches: ${parallelBatches}
1923
+ - Sequential Steps: ${totalBatches - parallelBatches}
1924
+ - Max Parallel Agents: ${maxParallelAgents}
1925
+ - Estimated Time Reduction: ${Math.round((1 - (totalBatches / allAgents.length)) * 100)}%
1926
+
1927
+ **🔄 Dependency Flow:**
1928
+ `;
1929
+ // Show visual dependency flow
1930
+ agentBatches.forEach((batch, index) => {
1931
+ if (index === 0) {
1932
+ strategy += `START → `;
1933
+ }
1934
+ if (batch.length === 1) {
1935
+ strategy += `[${batch[0]}]`;
1936
+ }
1937
+ else {
1938
+ strategy += `[${batch.join(' | ')}]`;
1939
+ }
1940
+ if (index < agentBatches.length - 1) {
1941
+ strategy += ` → `;
1942
+ }
1943
+ else {
1944
+ strategy += ` → COMPLETE`;
1945
+ }
1946
+ });
1947
+ strategy += `\n`;
1948
+ return strategy;
1949
+ }
1950
+ /**
1951
+ * Generate agent-specific prompts for batch execution
1952
+ */
1953
+ function getAgentPromptForBatch(agentType, taskType) {
1954
+ const basePrompts = {
1955
+ 'architect': 'You are the architect agent. Design the system architecture and data models. Store your design in Memory for other agents.',
1956
+ 'app-architect': 'You are the application architect. Design the overall application structure and component interfaces.',
1957
+ 'script-writer': 'You are the script writer. Implement business logic and scripts based on the architecture. Check Memory for design specs.',
1958
+ 'widget-creator': 'You are the widget creator. Build the HTML structure for Service Portal widgets. Store widget specs in Memory.',
1959
+ 'css-specialist': 'You are the CSS specialist. Create responsive styles for the widgets. Read widget structure from Memory.',
1960
+ 'frontend-specialist': 'You are the frontend specialist. Implement client-side JavaScript. Coordinate with backend via Memory.',
1961
+ 'backend-specialist': 'You are the backend specialist. Implement server-side logic. Coordinate with frontend via Memory.',
1962
+ 'flow-builder': 'You are the flow builder. Create the main flow structure. Store flow design in Memory for specialists.',
1963
+ 'trigger-specialist': 'You are the trigger specialist. Configure flow triggers based on the flow design in Memory.',
1964
+ 'action-specialist': 'You are the action specialist. Implement flow actions based on the flow design in Memory.',
1965
+ 'approval-specialist': 'You are the approval specialist. Set up approval processes in the flow.',
1966
+ 'integration-specialist': 'You are the integration specialist. Handle external system integrations and APIs.',
1967
+ 'api-specialist': 'You are the API specialist. Design and implement REST/SOAP endpoints.',
1968
+ 'tester': 'You are the tester. Test all components created by other agents. Read their outputs from Memory.',
1969
+ 'security-specialist': 'You are the security specialist. Implement security best practices and access controls.',
1970
+ 'performance-specialist': 'You are the performance specialist. Optimize code and queries for performance.',
1971
+ 'error-handler': 'You are the error handler. Implement comprehensive error handling and logging.',
1972
+ 'documentation-specialist': 'You are the documentation specialist. Create comprehensive documentation.',
1973
+ 'ml-developer': 'You are the ML developer. Implement machine learning features using ServiceNow ML tools.',
1974
+ 'database-expert': 'You are the database expert. Design and optimize database schemas and queries.',
1975
+ 'analyst': 'You are the analyst. Analyze requirements and provide insights for implementation.'
1976
+ };
1977
+ const prompt = basePrompts[agentType] || `You are the ${agentType} agent. Perform your specialized tasks.`;
1978
+ return `${prompt}
1979
+ MANDATORY:
1980
+ 1. Run npx snow-flow hooks pre-task --description "${taskType} - ${agentType}"
1981
+ 2. Store ALL decisions in Memory with key "agent_${agentType}_decisions"
1982
+ 3. Check Memory for work from agents you depend on
1983
+ 4. After EVERY file operation, run npx snow-flow hooks post-edit
1984
+ 5. When complete, run npx snow-flow hooks post-task --task-id "${agentType}"`;
1985
+ }
1882
1986
  // Swarm status command - monitor running swarms
1883
1987
  program
1884
1988
  .command('swarm-status [sessionId]')
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Dynamic Agent Discovery Methods
3
+ * To be integrated into snow-flow-mcp.ts
4
+ */
5
+ export declare const agentDiscoveryMethods: {
6
+ handleAgentDiscover(args: any): Promise<{
7
+ content: {
8
+ type: string;
9
+ text: string;
10
+ }[];
11
+ }>;
12
+ getBaseAgentTypes(): string[];
13
+ generateAgentName(type: string): string;
14
+ discoverAgentForCapability(capability: string): any;
15
+ createAgentBatches(agents: any[], dependencies: {
16
+ [key: string]: string[];
17
+ }): string[][];
18
+ findCriticalPath(batches: string[][]): string[];
19
+ storeAgentDiscovery(taskAnalysis: any, agents: any[]): void;
20
+ };
21
+ //# sourceMappingURL=agent-discovery-methods.d.ts.map
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ /**
3
+ * Dynamic Agent Discovery Methods
4
+ * To be integrated into snow-flow-mcp.ts
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.agentDiscoveryMethods = void 0;
8
+ exports.agentDiscoveryMethods = {
9
+ async handleAgentDiscover(args) {
10
+ const { task_analysis, required_capabilities = [], context = {} } = args;
11
+ const { max_agents = 8, include_new_types = true, learn_from_history = true } = context;
12
+ // Start with base agent knowledge
13
+ const baseAgents = this.getBaseAgentTypes();
14
+ // Analyze task requirements to discover needed agent types
15
+ const discoveredAgents = [];
16
+ const agentDependencies = {};
17
+ // Always include architecture agents for complex tasks
18
+ if (task_analysis.complexity !== 'simple') {
19
+ discoveredAgents.push({
20
+ type: 'system-architect',
21
+ name: 'System Architecture Specialist',
22
+ capabilities: ['design', 'architecture', 'data-modeling', 'system-planning'],
23
+ dependencies: [],
24
+ reasoning: 'Complex tasks require architectural planning',
25
+ });
26
+ }
27
+ // Discover agents based on ServiceNow artifacts
28
+ const artifactAgentMap = {
29
+ widget: [
30
+ { type: 'widget-architect', capabilities: ['widget-design', 'ui-patterns'], dependencies: ['system-architect'] },
31
+ { type: 'html-specialist', capabilities: ['html5', 'accessibility', 'semantic-markup'], dependencies: ['widget-architect'] },
32
+ { type: 'css-artist', capabilities: ['css3', 'animations', 'responsive-design'], dependencies: ['widget-architect'] },
33
+ { type: 'javascript-wizard', capabilities: ['es6+', 'async-patterns', 'dom-manipulation'], dependencies: ['widget-architect'] },
34
+ { type: 'angular-specialist', capabilities: ['angular.js', 'directives', 'data-binding'], dependencies: ['widget-architect'] },
35
+ ],
36
+ flow: [
37
+ { type: 'flow-architect', capabilities: ['flow-design', 'process-optimization'], dependencies: ['system-architect'] },
38
+ { type: 'trigger-engineer', capabilities: ['event-triggers', 'conditions', 'scheduling'], dependencies: ['flow-architect'] },
39
+ { type: 'action-developer', capabilities: ['flow-actions', 'integrations', 'data-transformation'], dependencies: ['flow-architect'] },
40
+ { type: 'decision-specialist', capabilities: ['decision-tables', 'branching-logic'], dependencies: ['flow-architect'] },
41
+ ],
42
+ script: [
43
+ { type: 'glide-expert', capabilities: ['glide-api', 'server-scripting', 'performance'], dependencies: ['system-architect'] },
44
+ { type: 'business-logic-developer', capabilities: ['business-rules', 'calculations', 'validations'], dependencies: [] },
45
+ ],
46
+ integration: [
47
+ { type: 'rest-api-architect', capabilities: ['rest-design', 'openapi', 'versioning'], dependencies: ['system-architect'] },
48
+ { type: 'soap-specialist', capabilities: ['soap', 'wsdl', 'xml-processing'], dependencies: ['system-architect'] },
49
+ { type: 'transform-expert', capabilities: ['data-mapping', 'etl', 'field-transformations'], dependencies: [] },
50
+ ],
51
+ report: [
52
+ { type: 'data-analyst', capabilities: ['sql', 'aggregations', 'kpi-design'], dependencies: [] },
53
+ { type: 'visualization-expert', capabilities: ['charts', 'd3.js', 'dashboards'], dependencies: ['data-analyst'] },
54
+ ],
55
+ };
56
+ // Discover specialized agents based on artifacts
57
+ for (const artifact of task_analysis.service_now_artifacts || []) {
58
+ const specialists = artifactAgentMap[artifact] || [];
59
+ for (const specialist of specialists) {
60
+ if (!discoveredAgents.some(a => a.type === specialist.type)) {
61
+ discoveredAgents.push({
62
+ ...specialist,
63
+ name: this.generateAgentName(specialist.type),
64
+ reasoning: `Required for ${artifact} development`,
65
+ });
66
+ agentDependencies[specialist.type] = specialist.dependencies;
67
+ }
68
+ }
69
+ }
70
+ // Discover agents based on required capabilities
71
+ for (const capability of required_capabilities) {
72
+ const agent = this.discoverAgentForCapability(capability);
73
+ if (agent && !discoveredAgents.some(a => a.type === agent.type)) {
74
+ discoveredAgents.push(agent);
75
+ agentDependencies[agent.type] = agent.dependencies;
76
+ }
77
+ }
78
+ // Add quality assurance agents
79
+ if (task_analysis.complexity !== 'simple') {
80
+ discoveredAgents.push({
81
+ type: 'quality-guardian',
82
+ name: 'Quality Assurance Guardian',
83
+ capabilities: ['testing', 'validation', 'test-automation', 'coverage-analysis'],
84
+ dependencies: discoveredAgents.filter(a => a.capabilities.some(c => c.includes('develop') || c.includes('script'))).map(a => a.type),
85
+ reasoning: 'Ensure quality of all deliverables',
86
+ });
87
+ discoveredAgents.push({
88
+ type: 'performance-optimizer',
89
+ name: 'Performance Optimization Specialist',
90
+ capabilities: ['performance-testing', 'query-optimization', 'caching', 'load-testing'],
91
+ dependencies: discoveredAgents.filter(a => a.capabilities.some(c => c.includes('script') || c.includes('api'))).map(a => a.type),
92
+ reasoning: 'Optimize performance of solutions',
93
+ });
94
+ }
95
+ // Create execution batches based on dependencies
96
+ const batches = this.createAgentBatches(discoveredAgents, agentDependencies);
97
+ // Learn from this discovery for future use
98
+ if (learn_from_history) {
99
+ this.storeAgentDiscovery(task_analysis, discoveredAgents);
100
+ }
101
+ return {
102
+ content: [
103
+ {
104
+ type: 'text',
105
+ text: JSON.stringify({
106
+ task_summary: {
107
+ type: task_analysis.task_type,
108
+ complexity: task_analysis.complexity,
109
+ artifacts: task_analysis.service_now_artifacts,
110
+ },
111
+ discovered_agents: discoveredAgents.map(agent => ({
112
+ type: agent.type,
113
+ name: agent.name,
114
+ capabilities: agent.capabilities,
115
+ dependencies: agent.dependencies || [],
116
+ reasoning: agent.reasoning,
117
+ })),
118
+ agent_count: discoveredAgents.length,
119
+ execution_batches: batches,
120
+ new_agent_types: include_new_types ? discoveredAgents.filter(a => !baseAgents.includes(a.type)).map(a => a.type) : [],
121
+ optimization: {
122
+ sequential_time: discoveredAgents.length,
123
+ batched_time: batches.length,
124
+ time_reduction: `${Math.round((1 - batches.length / discoveredAgents.length) * 100)}%`,
125
+ },
126
+ recommendations: {
127
+ primary_coordinator: batches[0]?.[0] || 'system-architect',
128
+ parallel_opportunities: batches.filter(b => b.length > 1).length,
129
+ critical_path: this.findCriticalPath(batches),
130
+ },
131
+ metadata: {
132
+ discovery_version: '1.0',
133
+ timestamp: new Date().toISOString(),
134
+ ai_powered: true,
135
+ learned_patterns: learn_from_history,
136
+ },
137
+ }, null, 2),
138
+ },
139
+ ],
140
+ };
141
+ },
142
+ getBaseAgentTypes() {
143
+ return [
144
+ 'architect', 'app-architect', 'script-writer', 'widget-creator',
145
+ 'flow-builder', 'tester', 'integration-specialist', 'database-expert',
146
+ ];
147
+ },
148
+ generateAgentName(type) {
149
+ const words = type.split('-');
150
+ return words.map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ');
151
+ },
152
+ discoverAgentForCapability(capability) {
153
+ const capabilityAgentMap = {
154
+ 'ml': { type: 'ml-specialist', name: 'Machine Learning Specialist', capabilities: ['tensorflow', 'neural-networks', 'predictions'], dependencies: ['system-architect'] },
155
+ 'security': { type: 'security-guardian', name: 'Security Guardian', capabilities: ['acls', 'encryption', 'vulnerability-scanning'], dependencies: [] },
156
+ 'mobile': { type: 'mobile-developer', name: 'Mobile App Developer', capabilities: ['react-native', 'ios', 'android', 'offline-sync'], dependencies: ['system-architect'] },
157
+ 'blockchain': { type: 'blockchain-architect', name: 'Blockchain Integration Specialist', capabilities: ['smart-contracts', 'distributed-ledger'], dependencies: ['system-architect'] },
158
+ 'iot': { type: 'iot-specialist', name: 'IoT Integration Specialist', capabilities: ['mqtt', 'sensor-data', 'edge-computing'], dependencies: ['integration-specialist'] },
159
+ 'chatbot': { type: 'conversational-ai-expert', name: 'Conversational AI Expert', capabilities: ['nlp', 'dialog-flow', 'intent-recognition'], dependencies: ['system-architect'] },
160
+ 'analytics': { type: 'analytics-wizard', name: 'Analytics and BI Wizard', capabilities: ['data-warehousing', 'etl', 'visualization'], dependencies: ['data-analyst'] },
161
+ 'compliance': { type: 'compliance-officer', name: 'Compliance and Governance Officer', capabilities: ['gdpr', 'sox', 'hipaa', 'audit-trails'], dependencies: [] },
162
+ 'devops': { type: 'devops-engineer', name: 'DevOps Engineer', capabilities: ['ci-cd', 'containerization', 'infrastructure-as-code'], dependencies: ['system-architect'] },
163
+ 'accessibility': { type: 'accessibility-champion', name: 'Accessibility Champion', capabilities: ['wcag', 'aria', 'screen-reader-optimization'], dependencies: ['widget-architect'] },
164
+ };
165
+ for (const [key, agent] of Object.entries(capabilityAgentMap)) {
166
+ if (capability.includes(key)) {
167
+ return { ...agent, reasoning: `Capability '${capability}' requires specialized expertise` };
168
+ }
169
+ }
170
+ return null;
171
+ },
172
+ createAgentBatches(agents, dependencies) {
173
+ const batches = [];
174
+ const processed = new Set();
175
+ const canExecute = (agent) => {
176
+ const deps = dependencies[agent.type] || [];
177
+ return deps.every(dep => processed.has(dep));
178
+ };
179
+ while (processed.size < agents.length) {
180
+ const currentBatch = [];
181
+ for (const agent of agents) {
182
+ if (!processed.has(agent.type) && canExecute(agent)) {
183
+ currentBatch.push(agent.type);
184
+ }
185
+ }
186
+ if (currentBatch.length === 0) {
187
+ // Handle circular dependencies or missing deps
188
+ for (const agent of agents) {
189
+ if (!processed.has(agent.type)) {
190
+ currentBatch.push(agent.type);
191
+ }
192
+ }
193
+ }
194
+ if (currentBatch.length > 0) {
195
+ batches.push(currentBatch);
196
+ currentBatch.forEach(type => processed.add(type));
197
+ }
198
+ }
199
+ return batches;
200
+ },
201
+ findCriticalPath(batches) {
202
+ // Find the longest dependency chain
203
+ const path = [];
204
+ for (const batch of batches) {
205
+ if (batch.length === 1) {
206
+ path.push(batch[0]);
207
+ }
208
+ }
209
+ return path;
210
+ },
211
+ storeAgentDiscovery(taskAnalysis, agents) {
212
+ // Store in memory for future learning
213
+ const key = `agent_discovery_${taskAnalysis.task_type}`;
214
+ const discovery = {
215
+ task_type: taskAnalysis.task_type,
216
+ discovered_agents: agents,
217
+ timestamp: new Date().toISOString(),
218
+ };
219
+ // In real implementation, this would persist to database
220
+ // this.memory.set(key, discovery);
221
+ },
222
+ };
223
+ //# sourceMappingURL=agent-discovery-methods.js.map