Files
WHOOSH/internal/council/models.go
Claude Code 131868bdca feat: Production readiness improvements for WHOOSH council formation
Major security, observability, and configuration improvements:

## Security Hardening
- Implemented configurable CORS (no more wildcards)
- Added comprehensive auth middleware for admin endpoints
- Enhanced webhook HMAC validation
- Added input validation and rate limiting
- Security headers and CSP policies

## Configuration Management
- Made N8N webhook URL configurable (WHOOSH_N8N_BASE_URL)
- Replaced all hardcoded endpoints with environment variables
- Added feature flags for LLM vs heuristic composition
- Gitea fetch hardening with EAGER_FILTER and FULL_RESCAN options

## API Completeness
- Implemented GetCouncilComposition function
- Added GET /api/v1/councils/{id} endpoint
- Council artifacts API (POST/GET /api/v1/councils/{id}/artifacts)
- /admin/health/details endpoint with component status
- Database lookup for repository URLs (no hardcoded fallbacks)

## Observability & Performance
- Added OpenTelemetry distributed tracing with goal/pulse correlation
- Performance optimization database indexes
- Comprehensive health monitoring
- Enhanced logging and error handling

## Infrastructure
- Production-ready P2P discovery (replaces mock implementation)
- Removed unused Redis configuration
- Enhanced Docker Swarm integration
- Added migration files for performance indexes

## Code Quality
- Comprehensive input validation
- Graceful error handling and failsafe fallbacks
- Backwards compatibility maintained
- Following security best practices

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 20:34:17 +10:00

106 lines
4.3 KiB
Go

package council
import (
"time"
"github.com/google/uuid"
)
// CouncilFormationRequest represents a request to form a project kickoff council
type CouncilFormationRequest struct {
ProjectName string `json:"project_name"`
Repository string `json:"repository"`
ProjectBrief string `json:"project_brief"`
Constraints string `json:"constraints,omitempty"`
TechLimits string `json:"tech_limits,omitempty"`
ComplianceNotes string `json:"compliance_notes,omitempty"`
Targets string `json:"targets,omitempty"`
TaskID uuid.UUID `json:"task_id"`
IssueID int64 `json:"issue_id"`
ExternalURL string `json:"external_url"`
GoalID string `json:"goal_id,omitempty"`
PulseID string `json:"pulse_id,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
// CouncilComposition defines the agents that make up the kickoff council
type CouncilComposition struct {
CouncilID uuid.UUID `json:"council_id"`
ProjectName string `json:"project_name"`
CoreAgents []CouncilAgent `json:"core_agents"`
OptionalAgents []CouncilAgent `json:"optional_agents"`
CreatedAt time.Time `json:"created_at"`
Status string `json:"status"` // forming, active, completed, failed
}
// CouncilAgent represents a single agent in the council
type CouncilAgent struct {
AgentID string `json:"agent_id"`
RoleName string `json:"role_name"`
AgentName string `json:"agent_name"`
Required bool `json:"required"`
Deployed bool `json:"deployed"`
ServiceID string `json:"service_id,omitempty"`
DeployedAt *time.Time `json:"deployed_at,omitempty"`
Status string `json:"status"` // pending, deploying, active, failed
}
// CouncilDeploymentResult represents the result of council agent deployment
type CouncilDeploymentResult struct {
CouncilID uuid.UUID `json:"council_id"`
ProjectName string `json:"project_name"`
DeployedAgents []DeployedCouncilAgent `json:"deployed_agents"`
Status string `json:"status"` // success, partial, failed
Message string `json:"message"`
DeployedAt time.Time `json:"deployed_at"`
Errors []string `json:"errors,omitempty"`
}
// DeployedCouncilAgent represents a successfully deployed council agent
type DeployedCouncilAgent struct {
ServiceID string `json:"service_id"`
ServiceName string `json:"service_name"`
RoleName string `json:"role_name"`
AgentID string `json:"agent_id"`
Image string `json:"image"`
Status string `json:"status"`
DeployedAt time.Time `json:"deployed_at"`
}
// CouncilArtifacts represents the outputs produced by the council
type CouncilArtifacts struct {
CouncilID uuid.UUID `json:"council_id"`
ProjectName string `json:"project_name"`
KickoffManifest map[string]interface{} `json:"kickoff_manifest,omitempty"`
SeminalDR string `json:"seminal_dr,omitempty"`
ScaffoldPlan map[string]interface{} `json:"scaffold_plan,omitempty"`
GateTests string `json:"gate_tests,omitempty"`
CHORUSLinks map[string]string `json:"chorus_links,omitempty"`
ProducedAt time.Time `json:"produced_at"`
Status string `json:"status"` // pending, partial, complete
}
// CoreCouncilRoles defines the required roles for any project kickoff council
var CoreCouncilRoles = []string{
"systems-analyst",
"senior-software-architect",
"tpm",
"security-architect",
"devex-platform-engineer",
"qa-test-engineer",
"sre-observability-lead",
"technical-writer",
}
// OptionalCouncilRoles defines the optional roles that may be included based on project needs
var OptionalCouncilRoles = []string{
"data-ai-architect",
"privacy-data-governance-officer",
"compliance-legal-liaison",
"performance-benchmarking-analyst",
"ui-ux-designer",
"ios-macos-developer",
"engine-programmer",
"integration-architect",
"cost-licensing-steward",
}