UNPKG

cortexweaver

Version:

CortexWeaver is a command-line interface (CLI) tool that orchestrates a swarm of specialized AI agents, powered by Claude Code and Gemini CLI, to assist in software development. It transforms a high-level project plan (plan.md) into a series of coordinate

50 lines 2.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AgentOperations = void 0; const base_1 = require("./base"); const validators_1 = require("./validators"); class AgentOperations extends base_1.CognitiveCanvasBase { async createAgent(agentData) { validators_1.CognitiveCanvasValidators.validateAgentData(agentData); const result = await this.executeQuery('CREATE (a:Agent {id: $id, name: $name, role: $role, capabilities: $capabilities, status: $status, createdAt: $createdAt}) RETURN a', agentData, 'a'); if (!result) { throw new Error('Failed to create agent'); } return result; } async assignAgentToTask(agentId, taskId) { await this.executeQuery('MATCH (a:Agent {id: $agentId}), (t:Task {id: $taskId}) CREATE (t)-[r:ASSIGNED_TO {assignedAt: $assignedAt}]->(a) RETURN r', { agentId, taskId, assignedAt: new Date().toISOString() }); } async getAgentAssignments(agentId) { const result = await this.executeQuery('MATCH (t:Task)-[:ASSIGNED_TO]->(a:Agent {id: $agentId}) RETURN t', { agentId }); if (!result || !result.records) return []; return result.records.map((record) => record.get('t').properties); } async getAgent(id) { return this.executeQuery('MATCH (a:Agent {id: $id}) RETURN a', { id }, 'a'); } async updateAgentStatus(id, status) { const result = await this.executeQuery('MATCH (a:Agent {id: $id}) SET a.status = $status RETURN a', { id, status }, 'a'); if (!result) { throw new Error(`Agent with id ${id} not found`); } return result; } async listAgents() { const result = await this.executeQuery('MATCH (a:Agent) RETURN a ORDER BY a.createdAt'); if (!result || !result.records) return []; return result.records.map((record) => record.get('a').properties); } async deleteAgent(id) { await this.executeQuery('MATCH (a:Agent {id: $id}) DETACH DELETE a', { id }); } // Create snapshot method implementation (required by base class) async createSnapshot() { // This will be implemented in the main class throw new Error('createSnapshot must be implemented in the main CognitiveCanvas class'); } } exports.AgentOperations = AgentOperations; //# sourceMappingURL=agent-operations.js.map