mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
checkpoint: File edit:
🚀 Generated with [Claude Code](https://claude.com/claude-code) 📊 V3 Development Progress Checkpoint Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
This commit is contained in:
1 parent
6d521db8bb
commit
2fd2edf618
1 file changed
+41
-1
@@ -21,12 +21,52 @@ function generateSecureAgentId(): string {
|
||||
return `agent-${timestamp}-${random}`;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Agent Type Validation (Security: Restrict to known agent types)
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Known agent types - validates against allowed agent types to prevent
|
||||
* arbitrary code execution or unexpected behavior from unknown types.
|
||||
*/
|
||||
const ALLOWED_AGENT_TYPES = [
|
||||
// Core Development
|
||||
'coder', 'reviewer', 'tester', 'planner', 'researcher',
|
||||
// Swarm Coordination
|
||||
'hierarchical-coordinator', 'mesh-coordinator', 'adaptive-coordinator',
|
||||
'collective-intelligence-coordinator', 'swarm-memory-manager',
|
||||
// Consensus & Distributed
|
||||
'byzantine-coordinator', 'raft-manager', 'gossip-coordinator',
|
||||
'consensus-builder', 'crdt-synchronizer', 'quorum-manager', 'security-manager',
|
||||
// Performance & Optimization
|
||||
'perf-analyzer', 'performance-benchmarker', 'task-orchestrator',
|
||||
'memory-coordinator', 'smart-agent',
|
||||
// SPARC Methodology
|
||||
'sparc-coord', 'sparc-coder', 'specification', 'pseudocode',
|
||||
'architecture', 'refinement',
|
||||
// Specialized Development
|
||||
'backend-dev', 'frontend-dev', 'mobile-dev', 'ml-developer',
|
||||
'cicd-engineer', 'api-docs', 'system-architect', 'code-analyzer',
|
||||
// V3 Specialized
|
||||
'queen-coordinator', 'security-architect', 'security-auditor',
|
||||
'memory-specialist', 'swarm-specialist', 'integration-architect',
|
||||
'performance-engineer', 'core-architect', 'test-architect', 'project-coordinator',
|
||||
] as const;
|
||||
|
||||
type AgentType = typeof ALLOWED_AGENT_TYPES[number];
|
||||
|
||||
const agentTypeSchema = z.enum(ALLOWED_AGENT_TYPES).or(
|
||||
z.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/,
|
||||
'Agent type must start with a letter and contain only alphanumeric characters, hyphens, and underscores'
|
||||
).max(64, 'Agent type must not exceed 64 characters')
|
||||
);
|
||||
|
||||
// ============================================================================
|
||||
// Input Schemas
|
||||
// ============================================================================
|
||||
|
||||
const spawnAgentSchema = z.object({
|
||||
agentType: z.string().describe('Type of agent to spawn (e.g., coder, reviewer, tester)'),
|
||||
agentType: agentTypeSchema.describe('Type of agent to spawn'),
|
||||
id: z.string().optional().describe('Optional agent ID (auto-generated if not provided)'),
|
||||
config: z.record(z.unknown()).optional().describe('Agent-specific configuration'),
|
||||
priority: z.enum(['low', 'normal', 'high', 'critical']).default('normal'),
|
||||
|
||||
Reference in new issue
Block a user