claude-flow-novice 1.6.1 → 1.6.3
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/.claude/agents/cfn-loop/product-owner.md +54 -4
- package/.claude/commands/cfn-claude-sync.md +303 -0
- package/.claude/commands/cfn-loop-epic.md +290 -0
- package/.claude/commands/cfn-loop-single.md +168 -0
- package/.claude/commands/cfn-loop-sprints.md +384 -0
- package/.claude/commands/cfn-loop.md +180 -0
- package/.claude/commands/metrics-summary.md +58 -0
- package/.claude/commands/parse-epic.md +357 -0
- package/.claude/settings.json +5 -4
- package/.claude/settings.local.json +9 -2
- package/.claude-flow-novice/.claude/agents/cfn-loop/product-owner.md +792 -0
- package/.claude-flow-novice/dist/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/api/auth-service.js +84 -38
- package/.claude-flow-novice/dist/src/api/auth-service.js.map +1 -1
- package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
- package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
- package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
- package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
- package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js +719 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js +363 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/index.js +97 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js +384 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js +612 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js +282 -0
- package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
- package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
- package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
- package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
- package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
- package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/web/api/apm-routes.js +355 -0
- package/.claude-flow-novice/dist/src/web/api/apm-routes.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
- package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js +425 -0
- package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/security/security-middleware.js +379 -0
- package/.claude-flow-novice/dist/src/web/security/security-middleware.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js +441 -0
- package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js +255 -1
- package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js.map +1 -1
- package/.claude-flow-novice/metrics.db +0 -0
- package/.claude-flow-novice/metrics.db-shm +0 -0
- package/.claude-flow-novice/metrics.db-wal +0 -0
- package/AGENT_PERFORMANCE_GUIDELINES.md +88 -0
- package/CLAUDE.md +60 -3
- package/MEMORY_LEAK_ROOT_CAUSE.md +149 -0
- package/README.md +27 -0
- package/config/hooks/post-edit-pipeline.js +36 -2
- package/examples/metrics-counter-demo.ts +106 -0
- package/examples/persistent-metrics-demo.ts +83 -0
- package/examples/phase-5-multi-level-control.ts +282 -0
- package/examples/session-pool-optimizer-example.ts +311 -0
- package/package.json +18 -4
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/monitor-loop.sh +65 -0
- package/scripts/monitor-memory.sh +47 -0
- package/scripts/monitor.py +43 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/test-provider-routing.cjs +228 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-zai-10k.cjs +81 -0
- package/scripts/test-zai-api.cjs +191 -0
- package/scripts/test-zai-diagnostic.cjs +151 -0
- package/scripts/test-zai-final.cjs +128 -0
- package/scripts/test-zai-with-env.cjs +85 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
- package/src/observability/metrics-counter.ts +347 -0
- package/src/observability/metrics-storage.ts +356 -0
- package/src/observability/telemetry.ts +658 -0
- package/src/slash-commands/cfn-claude-sync.js +533 -0
- package/src/slash-commands/index.js +5 -0
- package/src/slash-commands/metrics-summary-class.js +74 -0
- package/src/slash-commands/metrics-summary.js +335 -0
- package/src/slash-commands/register-all-commands.js +12 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* APM API Routes
|
|
3
|
+
* REST API endpoints for APM integration, health checks, and metrics
|
|
4
|
+
*/ import { Router } from 'express';
|
|
5
|
+
import { createAPMIntegration } from '../../monitoring/apm/apm-integration.js';
|
|
6
|
+
const router = Router();
|
|
7
|
+
// Initialize APM integration with environment configuration
|
|
8
|
+
const apmIntegration = createAPMIntegration({
|
|
9
|
+
dataDog: {
|
|
10
|
+
enabled: process.env.DATADOG_ENABLED === 'true',
|
|
11
|
+
apiKey: process.env.DATADOG_API_KEY,
|
|
12
|
+
site: process.env.DATADOG_SITE || 'datadoghq.com',
|
|
13
|
+
serviceName: process.env.DATADOG_SERVICE_NAME || 'claude-flow-novice',
|
|
14
|
+
env: process.env.NODE_ENV || 'production',
|
|
15
|
+
version: process.env.npm_package_version || '1.6.2'
|
|
16
|
+
},
|
|
17
|
+
newRelic: {
|
|
18
|
+
enabled: process.env.NEWRELIC_ENABLED === 'true',
|
|
19
|
+
licenseKey: process.env.NEWRELIC_LICENSE_KEY,
|
|
20
|
+
appName: process.env.NEWRELIC_APP_NAME || 'Claude Flow Novice',
|
|
21
|
+
accountId: process.env.NEWRELIC_ACCOUNT_ID
|
|
22
|
+
},
|
|
23
|
+
distributedTracing: {
|
|
24
|
+
enabled: process.env.DISTRIBUTED_TRACING_ENABLED !== 'false',
|
|
25
|
+
samplingRate: parseFloat(process.env.TRACE_SAMPLING_RATE || '1.0')
|
|
26
|
+
},
|
|
27
|
+
performanceOptimization: {
|
|
28
|
+
enabled: process.env.PERFORMANCE_OPTIMIZATION_ENABLED !== 'false',
|
|
29
|
+
monitoringInterval: parseInt(process.env.PERFORMANCE_MONITORING_INTERVAL || '5000')
|
|
30
|
+
},
|
|
31
|
+
customMetrics: {
|
|
32
|
+
enabled: process.env.CUSTOM_METRICS_ENABLED !== 'false',
|
|
33
|
+
interval: parseInt(process.env.CUSTOM_METRICS_INTERVAL || '10000')
|
|
34
|
+
},
|
|
35
|
+
alerting: {
|
|
36
|
+
enabled: process.env.APM_ALERTING_ENABLED === 'true',
|
|
37
|
+
webhookUrl: process.env.APM_WEBHOOK_URL,
|
|
38
|
+
slackChannel: process.env.APM_SLACK_CHANNEL,
|
|
39
|
+
emailRecipients: process.env.APM_EMAIL_RECIPIENTS?.split(',').filter(Boolean)
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
// Health check endpoint
|
|
43
|
+
router.get('/health', async (req, res)=>{
|
|
44
|
+
try {
|
|
45
|
+
const health = await apmIntegration.getHealthStatus();
|
|
46
|
+
const statusCode = health.overall === 'healthy' ? 200 : health.overall === 'degraded' ? 200 : 503;
|
|
47
|
+
res.status(statusCode).json(health);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('Health check failed:', error);
|
|
50
|
+
res.status(500).json({
|
|
51
|
+
error: 'Health check failed',
|
|
52
|
+
message: error.message
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
// Performance metrics endpoint
|
|
57
|
+
router.get('/metrics', async (req, res)=>{
|
|
58
|
+
try {
|
|
59
|
+
const timeRange = req.query.timeRange || '1h';
|
|
60
|
+
const analytics = apmIntegration.getPerformanceAnalytics();
|
|
61
|
+
res.json({
|
|
62
|
+
timeRange,
|
|
63
|
+
timestamp: new Date().toISOString(),
|
|
64
|
+
...analytics
|
|
65
|
+
});
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error('Failed to fetch metrics:', error);
|
|
68
|
+
res.status(500).json({
|
|
69
|
+
error: 'Failed to fetch metrics',
|
|
70
|
+
message: error.message
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// Custom metrics recording endpoint
|
|
75
|
+
router.post('/metrics/custom', async (req, res)=>{
|
|
76
|
+
try {
|
|
77
|
+
const { metricName, value, tags, type } = req.body;
|
|
78
|
+
if (!metricName || value === undefined) {
|
|
79
|
+
return res.status(400).json({
|
|
80
|
+
error: 'Missing required fields: metricName, value'
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
apmIntegration.recordBusinessMetric(metricName, value, tags, type);
|
|
84
|
+
res.json({
|
|
85
|
+
success: true,
|
|
86
|
+
message: 'Custom metric recorded successfully',
|
|
87
|
+
metricName,
|
|
88
|
+
value,
|
|
89
|
+
tags,
|
|
90
|
+
type: type || 'gauge'
|
|
91
|
+
});
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error('Failed to record custom metric:', error);
|
|
94
|
+
res.status(500).json({
|
|
95
|
+
error: 'Failed to record custom metric',
|
|
96
|
+
message: error.message
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
// Agent lifecycle tracing endpoint
|
|
101
|
+
router.post('/trace/agent', async (req, res)=>{
|
|
102
|
+
try {
|
|
103
|
+
const { agentType, lifecycleEvent, agentId, metadata } = req.body;
|
|
104
|
+
if (!agentType || !lifecycleEvent) {
|
|
105
|
+
return res.status(400).json({
|
|
106
|
+
error: 'Missing required fields: agentType, lifecycleEvent'
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
apmIntegration.traceAgentLifecycle(agentType, lifecycleEvent, agentId, metadata);
|
|
110
|
+
res.json({
|
|
111
|
+
success: true,
|
|
112
|
+
message: 'Agent lifecycle trace recorded successfully',
|
|
113
|
+
agentType,
|
|
114
|
+
lifecycleEvent,
|
|
115
|
+
agentId,
|
|
116
|
+
metadata
|
|
117
|
+
});
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error('Failed to trace agent lifecycle:', error);
|
|
120
|
+
res.status(500).json({
|
|
121
|
+
error: 'Failed to trace agent lifecycle',
|
|
122
|
+
message: error.message
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
// Swarm activity tracing endpoint
|
|
127
|
+
router.post('/trace/swarm', async (req, res)=>{
|
|
128
|
+
try {
|
|
129
|
+
const { swarmId, activity, topology, agentCount, metadata } = req.body;
|
|
130
|
+
if (!swarmId || !activity || !topology) {
|
|
131
|
+
return res.status(400).json({
|
|
132
|
+
error: 'Missing required fields: swarmId, activity, topology'
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
apmIntegration.traceSwarmActivity(swarmId, activity, topology, agentCount, metadata);
|
|
136
|
+
res.json({
|
|
137
|
+
success: true,
|
|
138
|
+
message: 'Swarm activity trace recorded successfully',
|
|
139
|
+
swarmId,
|
|
140
|
+
activity,
|
|
141
|
+
topology,
|
|
142
|
+
agentCount,
|
|
143
|
+
metadata
|
|
144
|
+
});
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.error('Failed to trace swarm activity:', error);
|
|
147
|
+
res.status(500).json({
|
|
148
|
+
error: 'Failed to trace swarm activity',
|
|
149
|
+
message: error.message
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
// WebSocket performance endpoint
|
|
154
|
+
router.post('/trace/websocket', async (req, res)=>{
|
|
155
|
+
try {
|
|
156
|
+
const { operation, socketId, duration, success, metadata } = req.body;
|
|
157
|
+
if (!operation || !socketId) {
|
|
158
|
+
return res.status(400).json({
|
|
159
|
+
error: 'Missing required fields: operation, socketId'
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
apmIntegration.optimizeWebSocketPerformance(operation, socketId, duration, success, metadata);
|
|
163
|
+
res.json({
|
|
164
|
+
success: true,
|
|
165
|
+
message: 'WebSocket performance trace recorded successfully',
|
|
166
|
+
operation,
|
|
167
|
+
socketId,
|
|
168
|
+
duration,
|
|
169
|
+
success,
|
|
170
|
+
metadata
|
|
171
|
+
});
|
|
172
|
+
} catch (error) {
|
|
173
|
+
console.error('Failed to trace WebSocket performance:', error);
|
|
174
|
+
res.status(500).json({
|
|
175
|
+
error: 'Failed to trace WebSocket performance',
|
|
176
|
+
message: error.message
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
// Database performance monitoring endpoint
|
|
181
|
+
router.post('/trace/database', async (req, res)=>{
|
|
182
|
+
try {
|
|
183
|
+
const { operation, query, duration, success, metadata } = req.body;
|
|
184
|
+
if (!operation) {
|
|
185
|
+
return res.status(400).json({
|
|
186
|
+
error: 'Missing required field: operation'
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
apmIntegration.monitorDatabasePerformance(operation, query, duration, success, metadata);
|
|
190
|
+
res.json({
|
|
191
|
+
success: true,
|
|
192
|
+
message: 'Database performance trace recorded successfully',
|
|
193
|
+
operation,
|
|
194
|
+
query,
|
|
195
|
+
duration,
|
|
196
|
+
success,
|
|
197
|
+
metadata
|
|
198
|
+
});
|
|
199
|
+
} catch (error) {
|
|
200
|
+
console.error('Failed to monitor database performance:', error);
|
|
201
|
+
res.status(500).json({
|
|
202
|
+
error: 'Failed to monitor database performance',
|
|
203
|
+
message: error.message
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
// Integration test endpoint
|
|
208
|
+
router.post('/test/integration', async (req, res)=>{
|
|
209
|
+
try {
|
|
210
|
+
const results = await apmIntegration.runIntegrationTest();
|
|
211
|
+
res.json({
|
|
212
|
+
success: true,
|
|
213
|
+
results
|
|
214
|
+
});
|
|
215
|
+
} catch (error) {
|
|
216
|
+
console.error('Integration test failed:', error);
|
|
217
|
+
res.status(500).json({
|
|
218
|
+
error: 'Integration test failed',
|
|
219
|
+
message: error.message
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
// Disaster recovery test endpoint
|
|
224
|
+
router.post('/test/disaster-recovery', async (req, res)=>{
|
|
225
|
+
try {
|
|
226
|
+
const results = await apmIntegration.runDisasterRecoveryTest();
|
|
227
|
+
res.json({
|
|
228
|
+
success: true,
|
|
229
|
+
results
|
|
230
|
+
});
|
|
231
|
+
} catch (error) {
|
|
232
|
+
console.error('Disaster recovery test failed:', error);
|
|
233
|
+
res.status(500).json({
|
|
234
|
+
error: 'Disaster recovery test failed',
|
|
235
|
+
message: error.message
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
// Configuration endpoint
|
|
240
|
+
router.get('/config', (req, res)=>{
|
|
241
|
+
try {
|
|
242
|
+
const collectors = apmIntegration.getCollectors();
|
|
243
|
+
res.json({
|
|
244
|
+
dataDog: !!collectors.dataDog,
|
|
245
|
+
newRelic: !!collectors.newRelic,
|
|
246
|
+
distributedTracing: !!collectors.distributedTracer,
|
|
247
|
+
performanceOptimizer: !!collectors.performanceOptimizer,
|
|
248
|
+
timestamp: new Date().toISOString()
|
|
249
|
+
});
|
|
250
|
+
} catch (error) {
|
|
251
|
+
console.error('Failed to get APM config:', error);
|
|
252
|
+
res.status(500).json({
|
|
253
|
+
error: 'Failed to get APM configuration',
|
|
254
|
+
message: error.message
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
// Recommendations endpoint
|
|
259
|
+
router.get('/recommendations', (req, res)=>{
|
|
260
|
+
try {
|
|
261
|
+
const analytics = apmIntegration.getPerformanceAnalytics();
|
|
262
|
+
res.json({
|
|
263
|
+
recommendations: analytics.recommendations,
|
|
264
|
+
timestamp: new Date().toISOString()
|
|
265
|
+
});
|
|
266
|
+
} catch (error) {
|
|
267
|
+
console.error('Failed to get recommendations:', error);
|
|
268
|
+
res.status(500).json({
|
|
269
|
+
error: 'Failed to get recommendations',
|
|
270
|
+
message: error.message
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
// Slow queries endpoint
|
|
275
|
+
router.get('/slow-queries', (req, res)=>{
|
|
276
|
+
try {
|
|
277
|
+
const collectors = apmIntegration.getCollectors();
|
|
278
|
+
if (!collectors.performanceOptimizer) {
|
|
279
|
+
return res.status(503).json({
|
|
280
|
+
error: 'Performance optimizer not available'
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const slowQueries = collectors.performanceOptimizer.getSlowQueries();
|
|
284
|
+
res.json({
|
|
285
|
+
slowQueries,
|
|
286
|
+
count: slowQueries.length,
|
|
287
|
+
timestamp: new Date().toISOString()
|
|
288
|
+
});
|
|
289
|
+
} catch (error) {
|
|
290
|
+
console.error('Failed to get slow queries:', error);
|
|
291
|
+
res.status(500).json({
|
|
292
|
+
error: 'Failed to get slow queries',
|
|
293
|
+
message: error.message
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
// Cache performance endpoint
|
|
298
|
+
router.get('/cache-performance', (req, res)=>{
|
|
299
|
+
try {
|
|
300
|
+
const collectors = apmIntegration.getCollectors();
|
|
301
|
+
if (!collectors.performanceOptimizer) {
|
|
302
|
+
return res.status(503).json({
|
|
303
|
+
error: 'Performance optimizer not available'
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
const cacheHitRates = collectors.performanceOptimizer.getCacheHitRates();
|
|
307
|
+
res.json({
|
|
308
|
+
cacheHitRates: Object.fromEntries(cacheHitRates),
|
|
309
|
+
timestamp: new Date().toISOString()
|
|
310
|
+
});
|
|
311
|
+
} catch (error) {
|
|
312
|
+
console.error('Failed to get cache performance:', error);
|
|
313
|
+
res.status(500).json({
|
|
314
|
+
error: 'Failed to get cache performance',
|
|
315
|
+
message: error.message
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
// Middleware to add APM tracing to all requests
|
|
320
|
+
router.use((req, res, next)=>{
|
|
321
|
+
const startTime = Date.now();
|
|
322
|
+
// Extract trace context from headers
|
|
323
|
+
const traceContext = {
|
|
324
|
+
traceId: req.headers['x-trace-id'],
|
|
325
|
+
spanId: req.headers['x-span-id'],
|
|
326
|
+
parentSpanId: req.headers['x-parent-span-id']
|
|
327
|
+
};
|
|
328
|
+
// Record the request
|
|
329
|
+
res.on('finish', ()=>{
|
|
330
|
+
const duration = Date.now() - startTime;
|
|
331
|
+
const success = res.statusCode < 400;
|
|
332
|
+
// Record API call metrics
|
|
333
|
+
if (traceContext.traceId) {
|
|
334
|
+
// This is part of an existing trace
|
|
335
|
+
apmIntegration.monitorDatabasePerformance('api_request', undefined, duration, success, {
|
|
336
|
+
method: req.method,
|
|
337
|
+
route: req.route?.path || req.path,
|
|
338
|
+
statusCode: res.statusCode.toString(),
|
|
339
|
+
userAgent: req.headers['user-agent']
|
|
340
|
+
});
|
|
341
|
+
} else {
|
|
342
|
+
// Create a new trace for this request
|
|
343
|
+
apmIntegration.traceAgentLifecycle('api-gateway', 'execute', undefined, {
|
|
344
|
+
method: req.method,
|
|
345
|
+
route: req.route?.path || req.path,
|
|
346
|
+
statusCode: res.statusCode.toString(),
|
|
347
|
+
duration: duration.toString()
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
next();
|
|
352
|
+
});
|
|
353
|
+
export default router;
|
|
354
|
+
|
|
355
|
+
//# sourceMappingURL=apm-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/web/api/apm-routes.ts"],"names":["Router","createAPMIntegration","router","apmIntegration","dataDog","enabled","process","env","DATADOG_ENABLED","apiKey","DATADOG_API_KEY","site","DATADOG_SITE","serviceName","DATADOG_SERVICE_NAME","NODE_ENV","version","npm_package_version","newRelic","NEWRELIC_ENABLED","licenseKey","NEWRELIC_LICENSE_KEY","appName","NEWRELIC_APP_NAME","accountId","NEWRELIC_ACCOUNT_ID","distributedTracing","DISTRIBUTED_TRACING_ENABLED","samplingRate","parseFloat","TRACE_SAMPLING_RATE","performanceOptimization","PERFORMANCE_OPTIMIZATION_ENABLED","monitoringInterval","parseInt","PERFORMANCE_MONITORING_INTERVAL","customMetrics","CUSTOM_METRICS_ENABLED","interval","CUSTOM_METRICS_INTERVAL","alerting","APM_ALERTING_ENABLED","webhookUrl","APM_WEBHOOK_URL","slackChannel","APM_SLACK_CHANNEL","emailRecipients","APM_EMAIL_RECIPIENTS","split","filter","Boolean","get","req","res","health","getHealthStatus","statusCode","overall","status","json","error","console","message","timeRange","query","analytics","getPerformanceAnalytics","timestamp","Date","toISOString","post","metricName","value","tags","type","body","undefined","recordBusinessMetric","success","agentType","lifecycleEvent","agentId","metadata","traceAgentLifecycle","swarmId","activity","topology","agentCount","traceSwarmActivity","operation","socketId","duration","optimizeWebSocketPerformance","monitorDatabasePerformance","results","runIntegrationTest","runDisasterRecoveryTest","collectors","getCollectors","distributedTracer","performanceOptimizer","recommendations","slowQueries","getSlowQueries","count","length","cacheHitRates","getCacheHitRates","Object","fromEntries","use","next","startTime","now","traceContext","traceId","headers","spanId","parentSpanId","on","method","route","path","toString","userAgent"],"mappings":"AAAA;;;CAGC,GAED,SAASA,MAAM,QAAQ,UAAU;AACjC,SAAyBC,oBAAoB,QAAQ,0CAA0C;AAE/F,MAAMC,SAASF;AAEf,4DAA4D;AAC5D,MAAMG,iBAAiBF,qBAAqB;IAC1CG,SAAS;QACPC,SAASC,QAAQC,GAAG,CAACC,eAAe,KAAK;QACzCC,QAAQH,QAAQC,GAAG,CAACG,eAAe;QACnCC,MAAML,QAAQC,GAAG,CAACK,YAAY,IAAI;QAClCC,aAAaP,QAAQC,GAAG,CAACO,oBAAoB,IAAI;QACjDP,KAAKD,QAAQC,GAAG,CAACQ,QAAQ,IAAI;QAC7BC,SAASV,QAAQC,GAAG,CAACU,mBAAmB,IAAI;IAC9C;IACAC,UAAU;QACRb,SAASC,QAAQC,GAAG,CAACY,gBAAgB,KAAK;QAC1CC,YAAYd,QAAQC,GAAG,CAACc,oBAAoB;QAC5CC,SAAShB,QAAQC,GAAG,CAACgB,iBAAiB,IAAI;QAC1CC,WAAWlB,QAAQC,GAAG,CAACkB,mBAAmB;IAC5C;IACAC,oBAAoB;QAClBrB,SAASC,QAAQC,GAAG,CAACoB,2BAA2B,KAAK;QACrDC,cAAcC,WAAWvB,Q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,WAAWvB,KAAK6C,GAAG,KAAKD;QAC9B,MAAMlC,UAAUzB,IAAIG,UAAU,GAAG;QAEjC,0BAA0B;QAC1B,IAAI0D,aAAaC,OAAO,EAAE;YACxB,oCAAoC;YACpChH,eAAe0F,0BAA0B,CAAC,eAAejB,WAAWe,UAAUb,SAAS;gBACrF0C,QAAQpE,IAAIoE,MAAM;gBAClBC,OAAOrE,IAAIqE,KAAK,EAAEC,QAAQtE,IAAIsE,IAAI;gBAClClE,YAAYH,IAAIG,UAAU,CAACmE,QAAQ;gBACnCC,WAAWxE,IAAIgE,OAAO,CAAC,aAAa;YACtC;QACF,OAAO;YACL,sCAAsC;YACtCjH,eAAegF,mBAAmB,CAAC,eAAe,WAAWP,WAAW;gBACtE4C,QAAQpE,IAAIoE,MAAM;gBAClBC,OAAOrE,IAAIqE,KAAK,EAAEC,QAAQtE,IAAIsE,IAAI;gBAClClE,YAAYH,IAAIG,UAAU,CAACmE,QAAQ;gBACnChC,UAAUA,SAASgC,QAAQ;YAC7B;QACF;IACF;IAEAZ;AACF;AAEA,eAAe7G,OAAO"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Server Configuration
|
|
3
|
+
*
|
|
4
|
+
* Configuration settings for the transparency API server
|
|
5
|
+
* including security, CORS, rate limiting, and other options.
|
|
6
|
+
*
|
|
7
|
+
* @module web/api/config/api-config
|
|
8
|
+
*/ /**
|
|
9
|
+
* Create default API configuration
|
|
10
|
+
*/ export function createApiConfig() {
|
|
11
|
+
const env = process.env.NODE_ENV || 'development';
|
|
12
|
+
return {
|
|
13
|
+
port: parseInt(process.env.API_PORT || '3001', 10),
|
|
14
|
+
host: process.env.API_HOST || 'localhost',
|
|
15
|
+
environment: env,
|
|
16
|
+
// CORS configuration
|
|
17
|
+
corsOrigins: env === 'production' ? process.env.CORS_ORIGINS?.split(',') || [
|
|
18
|
+
'https://localhost:3000'
|
|
19
|
+
] : [
|
|
20
|
+
'http://localhost:3000',
|
|
21
|
+
'http://localhost:3001',
|
|
22
|
+
'http://127.0.0.1:3000'
|
|
23
|
+
],
|
|
24
|
+
// Rate limiting
|
|
25
|
+
rateLimitWindowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS || '900000', 10),
|
|
26
|
+
rateLimitMax: parseInt(process.env.RATE_LIMIT_MAX || '100', 10),
|
|
27
|
+
// Security
|
|
28
|
+
sessionSecret: process.env.SESSION_SECRET || 'change-me-in-production',
|
|
29
|
+
jwtSecret: process.env.JWT_SECRET || 'change-me-in-production',
|
|
30
|
+
jwtExpiration: process.env.JWT_EXPIRATION || '24h',
|
|
31
|
+
apiKey: process.env.API_KEY || 'change-me-in-production',
|
|
32
|
+
// Logging
|
|
33
|
+
logLevel: process.env.LOG_LEVEL || 'info',
|
|
34
|
+
// Performance
|
|
35
|
+
cacheTtl: parseInt(process.env.CACHE_TTL || '5000', 10),
|
|
36
|
+
enableCompression: process.env.ENABLE_COMPRESSION !== 'false',
|
|
37
|
+
// HTTPS
|
|
38
|
+
enableHttps: process.env.ENABLE_HTTPS === 'true',
|
|
39
|
+
sslCertPath: process.env.SSL_CERT_PATH,
|
|
40
|
+
sslKeyPath: process.env.SSL_KEY_PATH,
|
|
41
|
+
// Metrics
|
|
42
|
+
enableMetrics: process.env.ENABLE_METRICS !== 'false',
|
|
43
|
+
metricsIntervalMs: parseInt(process.env.METRICS_INTERVAL_MS || '60000', 10),
|
|
44
|
+
// Request handling
|
|
45
|
+
maxRequestBodySize: process.env.MAX_REQUEST_BODY_SIZE || '10mb',
|
|
46
|
+
requestTimeoutMs: parseInt(process.env.REQUEST_TIMEOUT_MS || '30000', 10),
|
|
47
|
+
// WebSocket
|
|
48
|
+
websocketPingTimeoutMs: parseInt(process.env.WS_PING_TIMEOUT_MS || '60000', 10),
|
|
49
|
+
websocketPingIntervalMs: parseInt(process.env.WS_PING_INTERVAL_MS || '25000', 10),
|
|
50
|
+
maxWebSocketConnections: parseInt(process.env.MAX_WS_CONNECTIONS || '100', 10),
|
|
51
|
+
// Features
|
|
52
|
+
enableRequestLogging: process.env.ENABLE_REQUEST_LOGGING !== 'false',
|
|
53
|
+
enableDetailedErrors: env === 'development',
|
|
54
|
+
// API info
|
|
55
|
+
apiVersion: process.env.API_VERSION || '1.0.0',
|
|
56
|
+
serverName: process.env.SERVER_NAME || 'Transparency API Server'
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Validate API configuration
|
|
61
|
+
*/ export function validateApiConfig(config) {
|
|
62
|
+
const errors = [];
|
|
63
|
+
if (config.port < 1 || config.port > 65535) {
|
|
64
|
+
errors.push('Port must be between 1 and 65535');
|
|
65
|
+
}
|
|
66
|
+
if (config.rateLimitWindowMs < 1000) {
|
|
67
|
+
errors.push('Rate limit window must be at least 1000ms');
|
|
68
|
+
}
|
|
69
|
+
if (config.rateLimitMax < 1) {
|
|
70
|
+
errors.push('Rate limit max must be at least 1');
|
|
71
|
+
}
|
|
72
|
+
if (config.cacheTtl < 0) {
|
|
73
|
+
errors.push('Cache TTL cannot be negative');
|
|
74
|
+
}
|
|
75
|
+
if (config.requestTimeoutMs < 1000) {
|
|
76
|
+
errors.push('Request timeout must be at least 1000ms');
|
|
77
|
+
}
|
|
78
|
+
if (config.websocketPingTimeoutMs < 5000) {
|
|
79
|
+
errors.push('WebSocket ping timeout must be at least 5000ms');
|
|
80
|
+
}
|
|
81
|
+
if (config.websocketPingIntervalMs < 1000) {
|
|
82
|
+
errors.push('WebSocket ping interval must be at least 1000ms');
|
|
83
|
+
}
|
|
84
|
+
if (config.maxWebSocketConnections < 1) {
|
|
85
|
+
errors.push('Max WebSocket connections must be at least 1');
|
|
86
|
+
}
|
|
87
|
+
if (config.enableHttps && (!config.sslCertPath || !config.sslKeyPath)) {
|
|
88
|
+
errors.push('SSL certificate and key paths are required when HTTPS is enabled');
|
|
89
|
+
}
|
|
90
|
+
// In production, check for proper security settings
|
|
91
|
+
if (config.environment === 'production') {
|
|
92
|
+
const insecureDefaults = [
|
|
93
|
+
config.sessionSecret === 'change-me-in-production',
|
|
94
|
+
config.jwtSecret === 'change-me-in-production',
|
|
95
|
+
config.apiKey === 'change-me-in-production'
|
|
96
|
+
];
|
|
97
|
+
if (insecureDefaults.some(Boolean)) {
|
|
98
|
+
errors.push('Production environment requires secure secrets and API keys');
|
|
99
|
+
}
|
|
100
|
+
if (config.corsOrigins.includes('*') || config.corsOrigins.includes('http://localhost:*')) {
|
|
101
|
+
errors.push('Production environment should not use wildcard or localhost CORS origins');
|
|
102
|
+
}
|
|
103
|
+
if (config.enableDetailedErrors) {
|
|
104
|
+
errors.push('Detailed errors should be disabled in production');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return errors;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Create CORS options from configuration
|
|
111
|
+
*/ export function createCorsOptions(config) {
|
|
112
|
+
return {
|
|
113
|
+
origin: (origin, callback)=>{
|
|
114
|
+
// Allow requests with no origin (like mobile apps or curl requests)
|
|
115
|
+
if (!origin) return callback(null, true);
|
|
116
|
+
if (config.corsOrigins.includes('*') || config.corsOrigins.includes(origin) || config.corsOrigins.some((allowed)=>{
|
|
117
|
+
// Support wildcard patterns like http://localhost:*
|
|
118
|
+
if (allowed.includes('*')) {
|
|
119
|
+
const pattern = allowed.replace('*', '.*');
|
|
120
|
+
const regex = new RegExp(`^${pattern}$`);
|
|
121
|
+
return regex.test(origin);
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
})) {
|
|
125
|
+
callback(null, true);
|
|
126
|
+
} else {
|
|
127
|
+
callback(new Error('Not allowed by CORS'), false);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
methods: [
|
|
131
|
+
'GET',
|
|
132
|
+
'POST',
|
|
133
|
+
'PUT',
|
|
134
|
+
'DELETE',
|
|
135
|
+
'PATCH',
|
|
136
|
+
'OPTIONS'
|
|
137
|
+
],
|
|
138
|
+
allowedHeaders: [
|
|
139
|
+
'Content-Type',
|
|
140
|
+
'Authorization',
|
|
141
|
+
'X-Requested-With',
|
|
142
|
+
'X-API-Key'
|
|
143
|
+
],
|
|
144
|
+
credentials: true,
|
|
145
|
+
preflightContinue: false,
|
|
146
|
+
optionsSuccessStatus: 204
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get environment-specific configuration overrides
|
|
151
|
+
*/ export function getEnvironmentOverrides(env) {
|
|
152
|
+
switch(env){
|
|
153
|
+
case 'production':
|
|
154
|
+
return {
|
|
155
|
+
logLevel: 'warn',
|
|
156
|
+
enableDetailedErrors: false,
|
|
157
|
+
enableRequestLogging: false,
|
|
158
|
+
cacheTtl: 30000,
|
|
159
|
+
rateLimitMax: 1000,
|
|
160
|
+
requestTimeoutMs: 60000
|
|
161
|
+
};
|
|
162
|
+
case 'test':
|
|
163
|
+
return {
|
|
164
|
+
port: 0,
|
|
165
|
+
host: '127.0.0.1',
|
|
166
|
+
logLevel: 'error',
|
|
167
|
+
enableRequestLogging: false,
|
|
168
|
+
enableMetrics: false,
|
|
169
|
+
cacheTtl: 100,
|
|
170
|
+
rateLimitMax: 1000,
|
|
171
|
+
maxWebSocketConnections: 10
|
|
172
|
+
};
|
|
173
|
+
case 'development':
|
|
174
|
+
default:
|
|
175
|
+
return {
|
|
176
|
+
logLevel: 'debug',
|
|
177
|
+
enableDetailedErrors: true,
|
|
178
|
+
enableRequestLogging: true,
|
|
179
|
+
enableMetrics: true,
|
|
180
|
+
cacheTtl: 5000,
|
|
181
|
+
rateLimitMax: 1000
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
//# sourceMappingURL=api-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/web/api/config/api-config.ts"],"names":["createApiConfig","env","process","NODE_ENV","port","parseInt","API_PORT","host","API_HOST","environment","corsOrigins","CORS_ORIGINS","split","rateLimitWindowMs","RATE_LIMIT_WINDOW_MS","rateLimitMax","RATE_LIMIT_MAX","sessionSecret","SESSION_SECRET","jwtSecret","JWT_SECRET","jwtExpiration","JWT_EXPIRATION","apiKey","API_KEY","logLevel","LOG_LEVEL","cacheTtl","CACHE_TTL","enableCompression","ENABLE_COMPRESSION","enableHttps","ENABLE_HTTPS","sslCertPath","SSL_CERT_PATH","sslKeyPath","SSL_KEY_PATH","enableMetrics","ENABLE_METRICS","metricsIntervalMs","METRICS_INTERVAL_MS","maxRequestBodySize","MAX_REQUEST_BODY_SIZE","requestTimeoutMs","REQUEST_TIMEOUT_MS","websocketPingTimeoutMs","WS_PING_TIMEOUT_MS","websocketPingIntervalMs","WS_PING_INTERVAL_MS","maxWebSocketConnections","MAX_WS_CONNECTIONS","enableRequestLogging","ENABLE_REQUEST_LOGGING","enableDetailedErrors","apiVersion","API_VERSION","serverName","SERVER_NAME","validateApiConfig","config","errors","push","insecureDefaults","some","Boolean","includes","createCorsOptions","origin","callback","allowed","pattern","replace","regex","RegExp","test","Error","methods","allowedHeaders","credentials","preflightContinue","optionsSuccessStatus","getEnvironmentOverrides"],"mappings":"AAAA;;;;;;;CAOC,GA0FD;;CAEC,GACD,OAAO,SAASA;IACd,MAAMC,MAAMC,QAAQD,GAAG,CAACE,QAAQ,IAAI;IAEpC,OAAO;QACLC,MAAMC,SAASH,QAAQD,GAAG,CAACK,QAAQ,IAAI,QAAQ;QAC/CC,MAAML,QAAQD,GAAG,CAACO,QAAQ,IAAI;QAC9BC,aAAaR;QAEb,qBAAqB;QACrBS,aAAaT,QAAQ,eAChBC,QAAQD,GAAG,CAACU,YAAY,EAAEC,MAAM,QAAQ;YAAC;SAAyB,GACnE;YAAC;YAAyB;YAAyB;SAAwB;QAE/E,gBAAgB;QAChBC,mBAAmBR,SAASH,QAAQD,GAAG,CAACa,oBAAoB,IAAI,UAAU;QAC1EC,cAAcV,SAASH,QAAQD,GAAG,CAACe,cAAc,IAAI,OAAO;QAE5D,WAAW;QACXC,eAAef,QAAQ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