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

51 lines 2.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PheromoneOperations = void 0; const base_1 = require("./base"); const validators_1 = require("./validators"); class PheromoneOperations extends base_1.CognitiveCanvasBase { async createPheromone(pheromoneData) { validators_1.CognitiveCanvasValidators.validatePheromoneData(pheromoneData); const result = await this.executeQuery('CREATE (ph:Pheromone {id: $id, type: $type, strength: $strength, context: $context, metadata: $metadata, createdAt: $createdAt, expiresAt: $expiresAt}) RETURN ph', pheromoneData, 'ph'); if (!result) { throw new Error('Failed to create pheromone'); } return result; } async linkPheromoneToTask(pheromoneId, taskId) { await this.executeQuery('MATCH (ph:Pheromone {id: $pheromoneId}), (t:Task {id: $taskId}) CREATE (ph)-[r:INFLUENCES]->(t) RETURN r', { pheromoneId, taskId }); } async getPheromonesByType(type) { const result = await this.executeQuery('MATCH (ph:Pheromone {type: $type}) WHERE ph.expiresAt > $now RETURN ph ORDER BY ph.strength DESC', { type, now: new Date().toISOString() }); if (!result || !result.records) return []; return result.records.map((record) => record.get('ph').properties); } async cleanExpiredPheromones() { const result = await this.executeQuery('MATCH (ph:Pheromone) WHERE ph.expiresAt <= $now DETACH DELETE ph', { now: new Date().toISOString() }); return result?.summary?.counters?.updates()?.nodesDeleted || 0; } async updatePheromoneStrength(id, strength) { const result = await this.executeQuery('MATCH (ph:Pheromone {id: $id}) SET ph.strength = $strength RETURN ph', { id, strength }, 'ph'); if (!result) { throw new Error(`Pheromone with id ${id} not found`); } return result; } async getPheromone(id) { return this.executeQuery('MATCH (ph:Pheromone {id: $id}) RETURN ph', { id }, 'ph'); } async listActivePheromones() { const result = await this.executeQuery('MATCH (ph:Pheromone) WHERE ph.expiresAt > $now RETURN ph ORDER BY ph.strength DESC', { now: new Date().toISOString() }); if (!result || !result.records) return []; return result.records.map((record) => record.get('ph').properties); } // 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.PheromoneOperations = PheromoneOperations; //# sourceMappingURL=pheromone-operations.js.map