@stackmemoryai/stackmemory 0.5.57 → 0.5.59
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/bin/codex-smd +6 -0
- package/dist/cli/codex-sm-danger.js +21 -0
- package/dist/cli/codex-sm-danger.js.map +7 -0
- package/dist/cli/commands/handoff.js +33 -3
- package/dist/cli/commands/handoff.js.map +2 -2
- package/dist/cli/commands/search.js +20 -3
- package/dist/cli/commands/search.js.map +2 -2
- package/dist/core/database/sqlite-adapter.js +13 -3
- package/dist/core/database/sqlite-adapter.js.map +2 -2
- package/dist/core/errors/error-utils.js +208 -0
- package/dist/core/errors/error-utils.js.map +7 -0
- package/dist/core/errors/index.js +13 -4
- package/dist/core/errors/index.js.map +2 -2
- package/dist/core/merge/unified-merge-resolver.js +303 -0
- package/dist/core/merge/unified-merge-resolver.js.map +7 -0
- package/dist/core/monitoring/logger.js +61 -9
- package/dist/core/monitoring/logger.js.map +2 -2
- package/dist/core/security/index.js +35 -0
- package/dist/core/security/index.js.map +7 -0
- package/dist/core/security/input-sanitizer.js +321 -0
- package/dist/core/security/input-sanitizer.js.map +7 -0
- package/dist/core/session/enhanced-handoff.js +136 -2
- package/dist/core/session/enhanced-handoff.js.map +3 -3
- package/dist/integrations/linear/client.js +5 -1
- package/dist/integrations/linear/client.js.map +2 -2
- package/dist/integrations/mcp/remote-server.js +27 -36
- package/dist/integrations/mcp/remote-server.js.map +2 -2
- package/dist/integrations/mcp/server.js +44 -29
- package/dist/integrations/mcp/server.js.map +3 -3
- package/dist/scripts/benchmark-performance.js +48 -0
- package/dist/scripts/benchmark-performance.js.map +7 -0
- package/dist/scripts/check-redis.js +42 -0
- package/dist/scripts/check-redis.js.map +7 -0
- package/dist/scripts/initialize.js +116 -0
- package/dist/scripts/initialize.js.map +7 -0
- package/dist/scripts/list-linear-tasks.js +124 -0
- package/dist/scripts/list-linear-tasks.js.map +7 -0
- package/dist/scripts/measure-handoff-impact.js +340 -0
- package/dist/scripts/measure-handoff-impact.js.map +7 -0
- package/dist/scripts/query-chromadb.js +160 -0
- package/dist/scripts/query-chromadb.js.map +7 -0
- package/dist/scripts/show-linear-summary.js +119 -0
- package/dist/scripts/show-linear-summary.js.map +7 -0
- package/dist/scripts/simple-swarm-demo.js +90 -0
- package/dist/scripts/simple-swarm-demo.js.map +7 -0
- package/dist/scripts/status.js +155 -0
- package/dist/scripts/status.js.map +7 -0
- package/dist/scripts/test-chromadb-sync.js +192 -0
- package/dist/scripts/test-chromadb-sync.js.map +7 -0
- package/dist/scripts/test-ralph-iteration-fix.js +86 -0
- package/dist/scripts/test-ralph-iteration-fix.js.map +7 -0
- package/dist/scripts/test-ralph-iterations.js +121 -0
- package/dist/scripts/test-ralph-iterations.js.map +7 -0
- package/dist/scripts/test-redis-storage.js +389 -0
- package/dist/scripts/test-redis-storage.js.map +7 -0
- package/dist/scripts/test-simple-ralph-state-sync.js +115 -0
- package/dist/scripts/test-simple-ralph-state-sync.js.map +7 -0
- package/dist/scripts/test-swarm-fixes.js +125 -0
- package/dist/scripts/test-swarm-fixes.js.map +7 -0
- package/dist/scripts/test-swarm-tui.js +23 -0
- package/dist/scripts/test-swarm-tui.js.map +7 -0
- package/dist/scripts/test-tui-shortcuts.js +52 -0
- package/dist/scripts/test-tui-shortcuts.js.map +7 -0
- package/dist/scripts/validate-tui-shortcuts.js +60 -0
- package/dist/scripts/validate-tui-shortcuts.js.map +7 -0
- package/dist/src/agents/core/agent-task-manager.js +527 -0
- package/dist/src/agents/core/agent-task-manager.js.map +7 -0
- package/dist/src/agents/verifiers/base-verifier.js +133 -0
- package/dist/src/agents/verifiers/base-verifier.js.map +7 -0
- package/dist/src/agents/verifiers/formatter-verifier.js +130 -0
- package/dist/src/agents/verifiers/formatter-verifier.js.map +7 -0
- package/dist/src/agents/verifiers/llm-judge.js +252 -0
- package/dist/src/agents/verifiers/llm-judge.js.map +7 -0
- package/dist/src/cli/auto-detect.js +321 -0
- package/dist/src/cli/auto-detect.js.map +7 -0
- package/dist/src/cli/claude-sm-danger.js +21 -0
- package/dist/src/cli/claude-sm-danger.js.map +7 -0
- package/dist/src/cli/claude-sm.js +1156 -0
- package/dist/src/cli/claude-sm.js.map +7 -0
- package/dist/src/cli/codex-sm-danger.js +21 -0
- package/dist/src/cli/codex-sm-danger.js.map +7 -0
- package/dist/src/cli/codex-sm.js +349 -0
- package/dist/src/cli/codex-sm.js.map +7 -0
- package/dist/src/cli/commands/api.js +232 -0
- package/dist/src/cli/commands/api.js.map +7 -0
- package/dist/src/cli/commands/auto-background.js +180 -0
- package/dist/src/cli/commands/auto-background.js.map +7 -0
- package/dist/src/cli/commands/cleanup-processes.js +68 -0
- package/dist/src/cli/commands/cleanup-processes.js.map +7 -0
- package/dist/src/cli/commands/clear.js +202 -0
- package/dist/src/cli/commands/clear.js.map +7 -0
- package/dist/src/cli/commands/config.js +445 -0
- package/dist/src/cli/commands/config.js.map +7 -0
- package/dist/src/cli/commands/context-rehydrate.js +751 -0
- package/dist/src/cli/commands/context-rehydrate.js.map +7 -0
- package/dist/src/cli/commands/context.js +343 -0
- package/dist/src/cli/commands/context.js.map +7 -0
- package/dist/src/cli/commands/daemon.js +392 -0
- package/dist/src/cli/commands/daemon.js.map +7 -0
- package/dist/src/cli/commands/dashboard.js +210 -0
- package/dist/src/cli/commands/dashboard.js.map +7 -0
- package/dist/src/cli/commands/db.js +147 -0
- package/dist/src/cli/commands/db.js.map +7 -0
- package/dist/src/cli/commands/decision.js +266 -0
- package/dist/src/cli/commands/decision.js.map +7 -0
- package/dist/src/cli/commands/discovery.js +279 -0
- package/dist/src/cli/commands/discovery.js.map +7 -0
- package/dist/src/cli/commands/handoff.js +624 -0
- package/dist/src/cli/commands/handoff.js.map +7 -0
- package/dist/src/cli/commands/hooks.js +298 -0
- package/dist/src/cli/commands/hooks.js.map +7 -0
- package/dist/src/cli/commands/linear.js +529 -0
- package/dist/src/cli/commands/linear.js.map +7 -0
- package/dist/src/cli/commands/log.js +169 -0
- package/dist/src/cli/commands/log.js.map +7 -0
- package/dist/src/cli/commands/login.js +172 -0
- package/dist/src/cli/commands/login.js.map +7 -0
- package/dist/src/cli/commands/migrate.js +240 -0
- package/dist/src/cli/commands/migrate.js.map +7 -0
- package/dist/src/cli/commands/model.js +533 -0
- package/dist/src/cli/commands/model.js.map +7 -0
- package/dist/src/cli/commands/onboard.js +536 -0
- package/dist/src/cli/commands/onboard.js.map +7 -0
- package/dist/src/cli/commands/projects.js +199 -0
- package/dist/src/cli/commands/projects.js.map +7 -0
- package/dist/src/cli/commands/ralph.js +909 -0
- package/dist/src/cli/commands/ralph.js.map +7 -0
- package/dist/src/cli/commands/retrieval.js +248 -0
- package/dist/src/cli/commands/retrieval.js.map +7 -0
- package/dist/src/cli/commands/search.js +173 -0
- package/dist/src/cli/commands/search.js.map +7 -0
- package/dist/src/cli/commands/service.js +749 -0
- package/dist/src/cli/commands/service.js.map +7 -0
- package/dist/src/cli/commands/session.js +200 -0
- package/dist/src/cli/commands/session.js.map +7 -0
- package/dist/src/cli/commands/settings.js +306 -0
- package/dist/src/cli/commands/settings.js.map +7 -0
- package/dist/src/cli/commands/setup.js +701 -0
- package/dist/src/cli/commands/setup.js.map +7 -0
- package/dist/src/cli/commands/shell.js +249 -0
- package/dist/src/cli/commands/shell.js.map +7 -0
- package/dist/src/cli/commands/signup.js +50 -0
- package/dist/src/cli/commands/signup.js.map +7 -0
- package/dist/src/cli/commands/skills.js +470 -0
- package/dist/src/cli/commands/skills.js.map +7 -0
- package/dist/src/cli/commands/sms-notify.js +795 -0
- package/dist/src/cli/commands/sms-notify.js.map +7 -0
- package/dist/src/cli/commands/storage-tier.js +183 -0
- package/dist/src/cli/commands/storage-tier.js.map +7 -0
- package/dist/src/cli/commands/sweep.js +249 -0
- package/dist/src/cli/commands/sweep.js.map +7 -0
- package/dist/src/cli/commands/tasks.js +213 -0
- package/dist/src/cli/commands/tasks.js.map +7 -0
- package/dist/src/cli/commands/worktree.js +319 -0
- package/dist/src/cli/commands/worktree.js.map +7 -0
- package/dist/src/cli/index.js +594 -0
- package/dist/src/cli/index.js.map +7 -0
- package/dist/src/cli/opencode-sm.js +448 -0
- package/dist/src/cli/opencode-sm.js.map +7 -0
- package/dist/src/cli/utils/viewer.js +96 -0
- package/dist/src/cli/utils/viewer.js.map +7 -0
- package/dist/src/core/config/config-manager.js +398 -0
- package/dist/src/core/config/config-manager.js.map +7 -0
- package/dist/src/core/config/feature-flags.js +76 -0
- package/dist/src/core/config/feature-flags.js.map +7 -0
- package/dist/src/core/config/storage-config.js +115 -0
- package/dist/src/core/config/storage-config.js.map +7 -0
- package/dist/src/core/config/types.js +144 -0
- package/dist/src/core/config/types.js.map +7 -0
- package/dist/src/core/context/auto-context.js +80 -0
- package/dist/src/core/context/auto-context.js.map +7 -0
- package/dist/src/core/context/dual-stack-manager.js +870 -0
- package/dist/src/core/context/dual-stack-manager.js.map +7 -0
- package/dist/src/core/context/enhanced-rehydration.js +994 -0
- package/dist/src/core/context/enhanced-rehydration.js.map +7 -0
- package/dist/src/core/context/frame-database.js +479 -0
- package/dist/src/core/context/frame-database.js.map +7 -0
- package/dist/src/core/context/frame-digest.js +250 -0
- package/dist/src/core/context/frame-digest.js.map +7 -0
- package/dist/src/core/context/frame-handoff-manager.js +778 -0
- package/dist/src/core/context/frame-handoff-manager.js.map +7 -0
- package/dist/src/core/context/frame-lifecycle-hooks.js +119 -0
- package/dist/src/core/context/frame-lifecycle-hooks.js.map +7 -0
- package/dist/src/core/context/frame-recovery.js +302 -0
- package/dist/src/core/context/frame-recovery.js.map +7 -0
- package/dist/src/core/context/frame-stack.js +314 -0
- package/dist/src/core/context/frame-stack.js.map +7 -0
- package/dist/src/core/context/frame-types.js +5 -0
- package/dist/src/core/context/frame-types.js.map +7 -0
- package/dist/src/core/context/index.js +25 -0
- package/dist/src/core/context/index.js.map +7 -0
- package/dist/src/core/context/permission-manager.js +185 -0
- package/dist/src/core/context/permission-manager.js.map +7 -0
- package/dist/src/core/context/recursive-context-manager.js +592 -0
- package/dist/src/core/context/recursive-context-manager.js.map +7 -0
- package/dist/src/core/context/refactored-frame-manager.js +754 -0
- package/dist/src/core/context/refactored-frame-manager.js.map +7 -0
- package/dist/src/core/context/shared-context-layer.js +621 -0
- package/dist/src/core/context/shared-context-layer.js.map +7 -0
- package/dist/src/core/context/stack-merge-resolver.js +749 -0
- package/dist/src/core/context/stack-merge-resolver.js.map +7 -0
- package/dist/src/core/context/validation.js +130 -0
- package/dist/src/core/context/validation.js.map +7 -0
- package/dist/src/core/database/batch-operations.js +384 -0
- package/dist/src/core/database/batch-operations.js.map +7 -0
- package/dist/src/core/database/connection-pool.js +330 -0
- package/dist/src/core/database/connection-pool.js.map +7 -0
- package/dist/src/core/database/database-adapter.js +60 -0
- package/dist/src/core/database/database-adapter.js.map +7 -0
- package/dist/src/core/database/migration-manager.js +614 -0
- package/dist/src/core/database/migration-manager.js.map +7 -0
- package/dist/src/core/database/query-cache.js +298 -0
- package/dist/src/core/database/query-cache.js.map +7 -0
- package/dist/src/core/database/query-router.js +430 -0
- package/dist/src/core/database/query-router.js.map +7 -0
- package/dist/src/core/database/sqlite-adapter.js +738 -0
- package/dist/src/core/database/sqlite-adapter.js.map +7 -0
- package/dist/src/core/digest/enhanced-hybrid-digest.js +277 -0
- package/dist/src/core/digest/enhanced-hybrid-digest.js.map +7 -0
- package/dist/src/core/digest/frame-digest-integration.js +176 -0
- package/dist/src/core/digest/frame-digest-integration.js.map +7 -0
- package/dist/src/core/digest/hybrid-digest-generator.js +553 -0
- package/dist/src/core/digest/hybrid-digest-generator.js.map +7 -0
- package/dist/src/core/digest/index.js +9 -0
- package/dist/src/core/digest/index.js.map +7 -0
- package/dist/src/core/digest/types.js +25 -0
- package/dist/src/core/digest/types.js.map +7 -0
- package/dist/src/core/errors/error-utils.js +208 -0
- package/dist/src/core/errors/error-utils.js.map +7 -0
- package/dist/src/core/errors/index.js +521 -0
- package/dist/src/core/errors/index.js.map +7 -0
- package/dist/src/core/errors/recovery.js +269 -0
- package/dist/src/core/errors/recovery.js.map +7 -0
- package/dist/src/core/execution/parallel-executor.js +258 -0
- package/dist/src/core/execution/parallel-executor.js.map +7 -0
- package/dist/src/core/frame/workflow-templates.js +319 -0
- package/dist/src/core/frame/workflow-templates.js.map +7 -0
- package/dist/src/core/merge/conflict-detector.js +431 -0
- package/dist/src/core/merge/conflict-detector.js.map +7 -0
- package/dist/src/core/merge/index.js +9 -0
- package/dist/src/core/merge/index.js.map +7 -0
- package/dist/src/core/merge/resolution-engine.js +558 -0
- package/dist/src/core/merge/resolution-engine.js.map +7 -0
- package/dist/src/core/merge/stack-diff.js +532 -0
- package/dist/src/core/merge/stack-diff.js.map +7 -0
- package/dist/src/core/merge/types.js +5 -0
- package/dist/src/core/merge/types.js.map +7 -0
- package/dist/src/core/merge/unified-merge-resolver.js +303 -0
- package/dist/src/core/merge/unified-merge-resolver.js.map +7 -0
- package/dist/src/core/models/fallback-monitor.js +232 -0
- package/dist/src/core/models/fallback-monitor.js.map +7 -0
- package/dist/src/core/models/model-router.js +340 -0
- package/dist/src/core/models/model-router.js.map +7 -0
- package/dist/src/core/monitoring/error-handler.js +49 -0
- package/dist/src/core/monitoring/error-handler.js.map +7 -0
- package/dist/src/core/monitoring/logger.js +202 -0
- package/dist/src/core/monitoring/logger.js.map +7 -0
- package/dist/src/core/monitoring/metrics.js +172 -0
- package/dist/src/core/monitoring/metrics.js.map +7 -0
- package/dist/src/core/monitoring/progress-tracker.js +189 -0
- package/dist/src/core/monitoring/progress-tracker.js.map +7 -0
- package/dist/src/core/monitoring/session-monitor.js +300 -0
- package/dist/src/core/monitoring/session-monitor.js.map +7 -0
- package/dist/src/core/performance/context-cache.js +273 -0
- package/dist/src/core/performance/context-cache.js.map +7 -0
- package/dist/src/core/performance/index.js +11 -0
- package/dist/src/core/performance/index.js.map +7 -0
- package/dist/src/core/performance/lazy-context-loader.js +327 -0
- package/dist/src/core/performance/lazy-context-loader.js.map +7 -0
- package/dist/src/core/performance/monitor.js +221 -0
- package/dist/src/core/performance/monitor.js.map +7 -0
- package/dist/src/core/performance/optimized-frame-context.js +345 -0
- package/dist/src/core/performance/optimized-frame-context.js.map +7 -0
- package/dist/src/core/performance/performance-benchmark.js +277 -0
- package/dist/src/core/performance/performance-benchmark.js.map +7 -0
- package/dist/src/core/performance/performance-profiler.js +370 -0
- package/dist/src/core/performance/performance-profiler.js.map +7 -0
- package/dist/src/core/performance/streaming-jsonl-parser.js +195 -0
- package/dist/src/core/performance/streaming-jsonl-parser.js.map +7 -0
- package/dist/src/core/persistence/postgres-adapter.js +349 -0
- package/dist/src/core/persistence/postgres-adapter.js.map +7 -0
- package/dist/src/core/projects/project-isolation.js +201 -0
- package/dist/src/core/projects/project-isolation.js.map +7 -0
- package/dist/src/core/projects/project-manager.js +697 -0
- package/dist/src/core/projects/project-manager.js.map +7 -0
- package/dist/src/core/query/query-parser.js +370 -0
- package/dist/src/core/query/query-parser.js.map +7 -0
- package/dist/src/core/query/query-templates.js +321 -0
- package/dist/src/core/query/query-templates.js.map +7 -0
- package/dist/src/core/retrieval/context-retriever.js +479 -0
- package/dist/src/core/retrieval/context-retriever.js.map +7 -0
- package/dist/src/core/retrieval/index.js +8 -0
- package/dist/src/core/retrieval/index.js.map +7 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js +613 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js.map +7 -0
- package/dist/src/core/retrieval/llm-provider.js +151 -0
- package/dist/src/core/retrieval/llm-provider.js.map +7 -0
- package/dist/src/core/retrieval/retrieval-audit.js +236 -0
- package/dist/src/core/retrieval/retrieval-audit.js.map +7 -0
- package/dist/src/core/retrieval/summary-generator.js +589 -0
- package/dist/src/core/retrieval/summary-generator.js.map +7 -0
- package/dist/src/core/retrieval/types.js +21 -0
- package/dist/src/core/retrieval/types.js.map +7 -0
- package/dist/src/core/security/index.js +35 -0
- package/dist/src/core/security/index.js.map +7 -0
- package/dist/src/core/security/input-sanitizer.js +321 -0
- package/dist/src/core/security/input-sanitizer.js.map +7 -0
- package/dist/src/core/session/clear-survival.js +465 -0
- package/dist/src/core/session/clear-survival.js.map +7 -0
- package/dist/src/core/session/enhanced-handoff.js +792 -0
- package/dist/src/core/session/enhanced-handoff.js.map +7 -0
- package/dist/src/core/session/handoff-generator.js +343 -0
- package/dist/src/core/session/handoff-generator.js.map +7 -0
- package/dist/src/core/session/index.js +15 -0
- package/dist/src/core/session/index.js.map +7 -0
- package/dist/src/core/session/session-manager.js +347 -0
- package/dist/src/core/session/session-manager.js.map +7 -0
- package/dist/src/core/skills/index.js +7 -0
- package/dist/src/core/skills/index.js.map +7 -0
- package/dist/src/core/skills/skill-storage.js +764 -0
- package/dist/src/core/skills/skill-storage.js.map +7 -0
- package/dist/src/core/skills/types.js +193 -0
- package/dist/src/core/skills/types.js.map +7 -0
- package/dist/src/core/storage/chromadb-adapter.js +354 -0
- package/dist/src/core/storage/chromadb-adapter.js.map +7 -0
- package/dist/src/core/storage/infinite-storage.js +510 -0
- package/dist/src/core/storage/infinite-storage.js.map +7 -0
- package/dist/src/core/storage/remote-storage.js +489 -0
- package/dist/src/core/storage/remote-storage.js.map +7 -0
- package/dist/src/core/storage/two-tier-storage.js +766 -0
- package/dist/src/core/storage/two-tier-storage.js.map +7 -0
- package/dist/src/core/trace/cli-trace-wrapper.js +132 -0
- package/dist/src/core/trace/cli-trace-wrapper.js.map +7 -0
- package/dist/src/core/trace/db-trace-wrapper.js +247 -0
- package/dist/src/core/trace/db-trace-wrapper.js.map +7 -0
- package/dist/src/core/trace/debug-trace.js +417 -0
- package/dist/src/core/trace/debug-trace.js.map +7 -0
- package/dist/src/core/trace/index.js +109 -0
- package/dist/src/core/trace/index.js.map +7 -0
- package/dist/src/core/trace/linear-api-wrapper.js +178 -0
- package/dist/src/core/trace/linear-api-wrapper.js.map +7 -0
- package/dist/src/core/trace/trace-detector.js +528 -0
- package/dist/src/core/trace/trace-detector.js.map +7 -0
- package/dist/src/core/trace/trace-store.js +345 -0
- package/dist/src/core/trace/trace-store.js.map +7 -0
- package/dist/src/core/trace/types.js +77 -0
- package/dist/src/core/trace/types.js.map +7 -0
- package/dist/src/core/types.js +5 -0
- package/dist/src/core/types.js.map +7 -0
- package/dist/src/core/utils/async-mutex.js +114 -0
- package/dist/src/core/utils/async-mutex.js.map +7 -0
- package/dist/src/core/utils/compression.js +83 -0
- package/dist/src/core/utils/compression.js.map +7 -0
- package/dist/src/core/utils/update-checker.js +218 -0
- package/dist/src/core/utils/update-checker.js.map +7 -0
- package/dist/src/core/worktree/worktree-manager.js +465 -0
- package/dist/src/core/worktree/worktree-manager.js.map +7 -0
- package/dist/src/daemon/daemon-config.js +149 -0
- package/dist/src/daemon/daemon-config.js.map +7 -0
- package/dist/src/daemon/services/context-service.js +122 -0
- package/dist/src/daemon/services/context-service.js.map +7 -0
- package/dist/src/daemon/services/linear-service.js +136 -0
- package/dist/src/daemon/services/linear-service.js.map +7 -0
- package/dist/src/daemon/session-daemon.js +312 -0
- package/dist/src/daemon/session-daemon.js.map +7 -0
- package/dist/src/daemon/unified-daemon.js +276 -0
- package/dist/src/daemon/unified-daemon.js.map +7 -0
- package/dist/src/features/analytics/api/analytics-api.js +287 -0
- package/dist/src/features/analytics/api/analytics-api.js.map +7 -0
- package/dist/src/features/analytics/core/analytics-service.js +282 -0
- package/dist/src/features/analytics/core/analytics-service.js.map +7 -0
- package/dist/src/features/analytics/index.js +18 -0
- package/dist/src/features/analytics/index.js.map +7 -0
- package/dist/src/features/analytics/queries/metrics-queries.js +277 -0
- package/dist/src/features/analytics/queries/metrics-queries.js.map +7 -0
- package/dist/src/features/analytics/types/metrics.js +5 -0
- package/dist/src/features/analytics/types/metrics.js.map +7 -0
- package/dist/src/features/browser/browser-mcp.js +492 -0
- package/dist/src/features/browser/browser-mcp.js.map +7 -0
- package/dist/src/features/sweep/index.js +20 -0
- package/dist/src/features/sweep/index.js.map +7 -0
- package/dist/src/features/sweep/prediction-client.js +155 -0
- package/dist/src/features/sweep/prediction-client.js.map +7 -0
- package/dist/src/features/sweep/prompt-builder.js +85 -0
- package/dist/src/features/sweep/prompt-builder.js.map +7 -0
- package/dist/src/features/sweep/pty-wrapper.js +171 -0
- package/dist/src/features/sweep/pty-wrapper.js.map +7 -0
- package/dist/src/features/sweep/state-watcher.js +87 -0
- package/dist/src/features/sweep/state-watcher.js.map +7 -0
- package/dist/src/features/sweep/status-bar.js +88 -0
- package/dist/src/features/sweep/status-bar.js.map +7 -0
- package/dist/src/features/sweep/sweep-server-manager.js +226 -0
- package/dist/src/features/sweep/sweep-server-manager.js.map +7 -0
- package/dist/src/features/sweep/tab-interceptor.js +38 -0
- package/dist/src/features/sweep/tab-interceptor.js.map +7 -0
- package/dist/src/features/sweep/types.js +18 -0
- package/dist/src/features/sweep/types.js.map +7 -0
- package/dist/src/features/tasks/linear-task-manager.js +487 -0
- package/dist/src/features/tasks/linear-task-manager.js.map +7 -0
- package/dist/src/features/tasks/task-aware-context.js +410 -0
- package/dist/src/features/tasks/task-aware-context.js.map +7 -0
- package/dist/src/features/tui/simple-monitor.js +116 -0
- package/dist/src/features/tui/simple-monitor.js.map +7 -0
- package/dist/src/features/tui/swarm-monitor.js +648 -0
- package/dist/src/features/tui/swarm-monitor.js.map +7 -0
- package/dist/src/features/web/client/stores/task-store.js +26 -0
- package/dist/src/features/web/client/stores/task-store.js.map +7 -0
- package/dist/src/features/web/server/index.js +194 -0
- package/dist/src/features/web/server/index.js.map +7 -0
- package/dist/src/hooks/auto-background.js +151 -0
- package/dist/src/hooks/auto-background.js.map +7 -0
- package/dist/src/hooks/claude-code-whatsapp-hook.js +197 -0
- package/dist/src/hooks/claude-code-whatsapp-hook.js.map +7 -0
- package/dist/src/hooks/config.js +150 -0
- package/dist/src/hooks/config.js.map +7 -0
- package/dist/src/hooks/daemon.js +364 -0
- package/dist/src/hooks/daemon.js.map +7 -0
- package/dist/src/hooks/events.js +58 -0
- package/dist/src/hooks/events.js.map +7 -0
- package/dist/src/hooks/index.js +12 -0
- package/dist/src/hooks/index.js.map +7 -0
- package/dist/src/hooks/linear-task-picker.js +186 -0
- package/dist/src/hooks/linear-task-picker.js.map +7 -0
- package/dist/src/hooks/schemas.js +197 -0
- package/dist/src/hooks/schemas.js.map +7 -0
- package/dist/src/hooks/secure-fs.js +49 -0
- package/dist/src/hooks/secure-fs.js.map +7 -0
- package/dist/src/hooks/security-logger.js +155 -0
- package/dist/src/hooks/security-logger.js.map +7 -0
- package/dist/src/hooks/session-summary.js +222 -0
- package/dist/src/hooks/session-summary.js.map +7 -0
- package/dist/src/hooks/sms-action-runner.js +371 -0
- package/dist/src/hooks/sms-action-runner.js.map +7 -0
- package/dist/src/hooks/sms-notify.js +506 -0
- package/dist/src/hooks/sms-notify.js.map +7 -0
- package/dist/src/hooks/sms-watcher.js +93 -0
- package/dist/src/hooks/sms-watcher.js.map +7 -0
- package/dist/src/hooks/sms-webhook.js +555 -0
- package/dist/src/hooks/sms-webhook.js.map +7 -0
- package/dist/src/hooks/whatsapp-commands.js +479 -0
- package/dist/src/hooks/whatsapp-commands.js.map +7 -0
- package/dist/src/hooks/whatsapp-scheduler.js +317 -0
- package/dist/src/hooks/whatsapp-scheduler.js.map +7 -0
- package/dist/src/hooks/whatsapp-sync.js +409 -0
- package/dist/src/hooks/whatsapp-sync.js.map +7 -0
- package/dist/src/index.js +25 -0
- package/dist/src/index.js.map +7 -0
- package/dist/src/integrations/anthropic/client.js +263 -0
- package/dist/src/integrations/anthropic/client.js.map +7 -0
- package/dist/src/integrations/claude-code/agent-bridge.js +768 -0
- package/dist/src/integrations/claude-code/agent-bridge.js.map +7 -0
- package/dist/src/integrations/claude-code/enhanced-pre-clear-hooks.js +459 -0
- package/dist/src/integrations/claude-code/enhanced-pre-clear-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/lifecycle-hooks.js +254 -0
- package/dist/src/integrations/claude-code/lifecycle-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/post-task-hooks.js +545 -0
- package/dist/src/integrations/claude-code/post-task-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/subagent-client-stub.js +20 -0
- package/dist/src/integrations/claude-code/subagent-client-stub.js.map +7 -0
- package/dist/src/integrations/claude-code/subagent-client.js +511 -0
- package/dist/src/integrations/claude-code/subagent-client.js.map +7 -0
- package/dist/src/integrations/claude-code/task-coordinator.js +360 -0
- package/dist/src/integrations/claude-code/task-coordinator.js.map +7 -0
- package/dist/src/integrations/linear/auth.js +337 -0
- package/dist/src/integrations/linear/auth.js.map +7 -0
- package/dist/src/integrations/linear/auto-sync.js +258 -0
- package/dist/src/integrations/linear/auto-sync.js.map +7 -0
- package/dist/src/integrations/linear/client.js +634 -0
- package/dist/src/integrations/linear/client.js.map +7 -0
- package/dist/src/integrations/linear/config.js +130 -0
- package/dist/src/integrations/linear/config.js.map +7 -0
- package/dist/src/integrations/linear/migration.js +361 -0
- package/dist/src/integrations/linear/migration.js.map +7 -0
- package/dist/src/integrations/linear/oauth-server.js +454 -0
- package/dist/src/integrations/linear/oauth-server.js.map +7 -0
- package/dist/src/integrations/linear/rest-client.js +213 -0
- package/dist/src/integrations/linear/rest-client.js.map +7 -0
- package/dist/src/integrations/linear/sync-manager.js +236 -0
- package/dist/src/integrations/linear/sync-manager.js.map +7 -0
- package/dist/src/integrations/linear/sync-service.js +231 -0
- package/dist/src/integrations/linear/sync-service.js.map +7 -0
- package/dist/src/integrations/linear/sync.js +782 -0
- package/dist/src/integrations/linear/sync.js.map +7 -0
- package/dist/src/integrations/linear/types.js +5 -0
- package/dist/src/integrations/linear/types.js.map +7 -0
- package/dist/src/integrations/linear/unified-sync.js +589 -0
- package/dist/src/integrations/linear/unified-sync.js.map +7 -0
- package/dist/src/integrations/linear/webhook-handler.js +219 -0
- package/dist/src/integrations/linear/webhook-handler.js.map +7 -0
- package/dist/src/integrations/linear/webhook-server.js +218 -0
- package/dist/src/integrations/linear/webhook-server.js.map +7 -0
- package/dist/src/integrations/linear/webhook.js +291 -0
- package/dist/src/integrations/linear/webhook.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/code-execution-handlers.js +266 -0
- package/dist/src/integrations/mcp/handlers/code-execution-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/context-handlers.js +257 -0
- package/dist/src/integrations/mcp/handlers/context-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/discovery-handlers.js +497 -0
- package/dist/src/integrations/mcp/handlers/discovery-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/index.js +166 -0
- package/dist/src/integrations/mcp/handlers/index.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/linear-handlers.js +247 -0
- package/dist/src/integrations/mcp/handlers/linear-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/skill-handlers.js +529 -0
- package/dist/src/integrations/mcp/handlers/skill-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/task-handlers.js +239 -0
- package/dist/src/integrations/mcp/handlers/task-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/trace-handlers.js +308 -0
- package/dist/src/integrations/mcp/handlers/trace-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/index.js +23 -0
- package/dist/src/integrations/mcp/index.js.map +7 -0
- package/dist/src/integrations/mcp/middleware/tool-scoring.js +356 -0
- package/dist/src/integrations/mcp/middleware/tool-scoring.js.map +7 -0
- package/dist/src/integrations/mcp/refactored-server.js +374 -0
- package/dist/src/integrations/mcp/refactored-server.js.map +7 -0
- package/dist/src/integrations/mcp/remote-server.js +682 -0
- package/dist/src/integrations/mcp/remote-server.js.map +7 -0
- package/dist/src/integrations/mcp/schemas.js +147 -0
- package/dist/src/integrations/mcp/schemas.js.map +7 -0
- package/dist/src/integrations/mcp/server.js +1975 -0
- package/dist/src/integrations/mcp/server.js.map +7 -0
- package/dist/src/integrations/mcp/tool-definitions-code.js +125 -0
- package/dist/src/integrations/mcp/tool-definitions-code.js.map +7 -0
- package/dist/src/integrations/mcp/tool-definitions.js +702 -0
- package/dist/src/integrations/mcp/tool-definitions.js.map +7 -0
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js +860 -0
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +7 -0
- package/dist/src/integrations/ralph/context/context-budget-manager.js +301 -0
- package/dist/src/integrations/ralph/context/context-budget-manager.js.map +7 -0
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +360 -0
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js.map +7 -0
- package/dist/src/integrations/ralph/coordination/enhanced-coordination.js +410 -0
- package/dist/src/integrations/ralph/coordination/enhanced-coordination.js.map +7 -0
- package/dist/src/integrations/ralph/index.js +18 -0
- package/dist/src/integrations/ralph/index.js.map +7 -0
- package/dist/src/integrations/ralph/learning/pattern-learner.js +401 -0
- package/dist/src/integrations/ralph/learning/pattern-learner.js.map +7 -0
- package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js +448 -0
- package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js.map +7 -0
- package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js +294 -0
- package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js.map +7 -0
- package/dist/src/integrations/ralph/monitoring/swarm-registry.js +108 -0
- package/dist/src/integrations/ralph/monitoring/swarm-registry.js.map +7 -0
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js +463 -0
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js +400 -0
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js +473 -0
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js +388 -0
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js.map +7 -0
- package/dist/src/integrations/ralph/performance/performance-optimizer.js +358 -0
- package/dist/src/integrations/ralph/performance/performance-optimizer.js.map +7 -0
- package/dist/src/integrations/ralph/recovery/crash-recovery.js +462 -0
- package/dist/src/integrations/ralph/recovery/crash-recovery.js.map +7 -0
- package/dist/src/integrations/ralph/state/state-reconciler.js +404 -0
- package/dist/src/integrations/ralph/state/state-reconciler.js.map +7 -0
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js +428 -0
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js.map +7 -0
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +996 -0
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js.map +7 -0
- package/dist/src/integrations/ralph/types.js +5 -0
- package/dist/src/integrations/ralph/types.js.map +7 -0
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js +585 -0
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js.map +7 -0
- package/dist/src/mcp/stackmemory-mcp-server.js +554 -0
- package/dist/src/mcp/stackmemory-mcp-server.js.map +7 -0
- package/dist/src/middleware/exponential-rate-limiter.js +289 -0
- package/dist/src/middleware/exponential-rate-limiter.js.map +7 -0
- package/dist/src/models/user.model.js +358 -0
- package/dist/src/models/user.model.js.map +7 -0
- package/dist/src/servers/production/auth-middleware.js +528 -0
- package/dist/src/servers/production/auth-middleware.js.map +7 -0
- package/dist/src/services/config-service.js +65 -0
- package/dist/src/services/config-service.js.map +7 -0
- package/dist/src/services/context-service.js +194 -0
- package/dist/src/services/context-service.js.map +7 -0
- package/dist/src/skills/api-discovery.js +354 -0
- package/dist/src/skills/api-discovery.js.map +7 -0
- package/dist/src/skills/api-skill.js +475 -0
- package/dist/src/skills/api-skill.js.map +7 -0
- package/dist/src/skills/claude-skills.js +1061 -0
- package/dist/src/skills/claude-skills.js.map +7 -0
- package/dist/src/skills/dashboard-launcher.js +216 -0
- package/dist/src/skills/dashboard-launcher.js.map +7 -0
- package/dist/src/skills/recursive-agent-orchestrator.js +575 -0
- package/dist/src/skills/recursive-agent-orchestrator.js.map +7 -0
- package/dist/src/skills/repo-ingestion-skill.js +609 -0
- package/dist/src/skills/repo-ingestion-skill.js.map +7 -0
- package/dist/src/skills/unified-rlm-orchestrator.js +404 -0
- package/dist/src/skills/unified-rlm-orchestrator.js.map +7 -0
- package/dist/src/types/task.js +5 -0
- package/dist/src/types/task.js.map +7 -0
- package/dist/src/utils/env.js +50 -0
- package/dist/src/utils/env.js.map +7 -0
- package/dist/src/utils/formatting.js +62 -0
- package/dist/src/utils/formatting.js.map +7 -0
- package/dist/src/utils/process-cleanup.js +136 -0
- package/dist/src/utils/process-cleanup.js.map +7 -0
- package/package.json +4 -3
- package/scripts/create-cleanup-issues.js +302 -0
- package/scripts/demos/browser-test.ts +39 -0
- package/scripts/demos/ralph-integration-demo.ts +244 -0
- package/scripts/demos/trace-demo.ts +214 -0
- package/scripts/demos/trace-detector.demo.ts +171 -0
- package/scripts/demos/trace-test.ts +67 -0
- package/scripts/initialize.ts +16 -7
- package/scripts/install.sh +14 -62
- package/scripts/status.ts +111 -46
- package/scripts/test-claude-config.sh +123 -0
- package/scripts/validate-claude-config.sh +155 -0
|
@@ -0,0 +1,909 @@
|
|
|
1
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
2
|
+
import { dirname as __pathDirname } from 'path';
|
|
3
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
4
|
+
const __dirname = __pathDirname(__filename);
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { logger } from "../../core/monitoring/logger.js";
|
|
7
|
+
import { RalphLoop } from "../../../scripts/ralph-loop-implementation.js";
|
|
8
|
+
import { stackMemoryContextLoader } from "../../integrations/ralph/context/stackmemory-context-loader.js";
|
|
9
|
+
import { patternLearner } from "../../integrations/ralph/learning/pattern-learner.js";
|
|
10
|
+
import { multiLoopOrchestrator } from "../../integrations/ralph/orchestration/multi-loop-orchestrator.js";
|
|
11
|
+
import { swarmCoordinator } from "../../integrations/ralph/swarm/swarm-coordinator.js";
|
|
12
|
+
import { ralphDebugger } from "../../integrations/ralph/visualization/ralph-debugger.js";
|
|
13
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
14
|
+
import { trace } from "../../core/trace/index.js";
|
|
15
|
+
import { SystemError, ErrorCode } from "../../core/errors/index.js";
|
|
16
|
+
function createRalphCommand() {
|
|
17
|
+
const ralph = new Command("ralph").description(
|
|
18
|
+
"Ralph Wiggum Loop integration with StackMemory"
|
|
19
|
+
);
|
|
20
|
+
ralph.command("init").description("Initialize a new Ralph Wiggum loop").argument("<task>", "Task description").option(
|
|
21
|
+
"-c, --criteria <criteria>",
|
|
22
|
+
"Completion criteria (comma separated)"
|
|
23
|
+
).option("--max-iterations <n>", "Maximum iterations", "50").option("--use-context", "Load relevant context from StackMemory").option(
|
|
24
|
+
"--learn-from-similar",
|
|
25
|
+
"Apply patterns from similar completed tasks"
|
|
26
|
+
).action(async (task, options) => {
|
|
27
|
+
return trace.command("ralph-init", { task, ...options }, async () => {
|
|
28
|
+
try {
|
|
29
|
+
console.log("\u{1F3AD} Initializing Ralph Wiggum loop...");
|
|
30
|
+
const loop = new RalphLoop({
|
|
31
|
+
baseDir: ".ralph",
|
|
32
|
+
maxIterations: parseInt(options.maxIterations),
|
|
33
|
+
verbose: true
|
|
34
|
+
});
|
|
35
|
+
const criteria = options.criteria ? options.criteria.split(",").map((c) => `- ${c.trim()}`).join("\n") : "- All tests pass\n- Code works correctly\n- No lint errors";
|
|
36
|
+
let enhancedTask = task;
|
|
37
|
+
if (options.useContext || options.learnFromSimilar) {
|
|
38
|
+
try {
|
|
39
|
+
await stackMemoryContextLoader.initialize();
|
|
40
|
+
const contextResponse = await stackMemoryContextLoader.loadInitialContext({
|
|
41
|
+
task,
|
|
42
|
+
usePatterns: true,
|
|
43
|
+
useSimilarTasks: options.learnFromSimilar,
|
|
44
|
+
maxTokens: 3e3
|
|
45
|
+
});
|
|
46
|
+
if (contextResponse.context) {
|
|
47
|
+
enhancedTask = `${task}
|
|
48
|
+
|
|
49
|
+
${contextResponse.context}`;
|
|
50
|
+
console.log(
|
|
51
|
+
`\u{1F4DA} Loaded context from ${contextResponse.sources.length} sources`
|
|
52
|
+
);
|
|
53
|
+
console.log(
|
|
54
|
+
`\u{1F3AF} Context tokens: ${contextResponse.metadata.totalTokens}`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.log(
|
|
59
|
+
`\u26A0\uFE0F Context loading failed: ${error.message}`
|
|
60
|
+
);
|
|
61
|
+
console.log("Proceeding without context...");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
await loop.initialize(enhancedTask, criteria);
|
|
65
|
+
console.log("\u2705 Ralph loop initialized!");
|
|
66
|
+
console.log(`\u{1F4CB} Task: ${task}`);
|
|
67
|
+
console.log(`\u{1F3AF} Max iterations: ${options.maxIterations}`);
|
|
68
|
+
console.log(`\u{1F4C1} Loop directory: .ralph/`);
|
|
69
|
+
console.log("\nNext steps:");
|
|
70
|
+
console.log(" stackmemory ralph run # Start the loop");
|
|
71
|
+
console.log(" stackmemory ralph status # Check status");
|
|
72
|
+
} catch (error) {
|
|
73
|
+
logger.error("Failed to initialize Ralph loop", error);
|
|
74
|
+
console.error("\u274C Initialization failed:", error.message);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
ralph.command("run").description("Run the Ralph Wiggum loop").option("--verbose", "Verbose output").option("--pause-on-error", "Pause on validation errors").action(async (options) => {
|
|
80
|
+
return trace.command("ralph-run", options, async () => {
|
|
81
|
+
try {
|
|
82
|
+
if (!existsSync(".ralph")) {
|
|
83
|
+
console.error(
|
|
84
|
+
'\u274C No Ralph loop found. Run "stackmemory ralph init" first.'
|
|
85
|
+
);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
console.log("\u{1F3AD} Starting Ralph Wiggum loop...");
|
|
89
|
+
const loop = new RalphLoop({
|
|
90
|
+
baseDir: ".ralph",
|
|
91
|
+
verbose: options.verbose
|
|
92
|
+
});
|
|
93
|
+
await loop.run();
|
|
94
|
+
} catch (error) {
|
|
95
|
+
logger.error("Failed to run Ralph loop", error);
|
|
96
|
+
console.error("\u274C Loop execution failed:", error.message);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
ralph.command("status").description("Show current Ralph loop status").option("--detailed", "Show detailed iteration history").action(async (options) => {
|
|
102
|
+
return trace.command("ralph-status", options, async () => {
|
|
103
|
+
try {
|
|
104
|
+
if (!existsSync(".ralph")) {
|
|
105
|
+
console.log("\u274C No Ralph loop found in current directory");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const task = readFileSync(".ralph/task.md", "utf8");
|
|
109
|
+
const iteration = parseInt(
|
|
110
|
+
readFileSync(".ralph/iteration.txt", "utf8") || "0"
|
|
111
|
+
);
|
|
112
|
+
const isComplete = existsSync(".ralph/work-complete.txt");
|
|
113
|
+
const feedback = existsSync(".ralph/feedback.txt") ? readFileSync(".ralph/feedback.txt", "utf8") : "";
|
|
114
|
+
console.log("\u{1F3AD} Ralph Loop Status:");
|
|
115
|
+
console.log(` Task: ${task.substring(0, 80)}...`);
|
|
116
|
+
console.log(` Iteration: ${iteration}`);
|
|
117
|
+
console.log(
|
|
118
|
+
` Status: ${isComplete ? "\u2705 COMPLETE" : "\u{1F504} IN PROGRESS"}`
|
|
119
|
+
);
|
|
120
|
+
if (feedback) {
|
|
121
|
+
console.log(` Last feedback: ${feedback.substring(0, 100)}...`);
|
|
122
|
+
}
|
|
123
|
+
if (options.detailed && existsSync(".ralph/progress.jsonl")) {
|
|
124
|
+
console.log("\n\u{1F4CA} Iteration History:");
|
|
125
|
+
const progressLines = readFileSync(".ralph/progress.jsonl", "utf8").split("\n").filter(Boolean).map((line) => JSON.parse(line));
|
|
126
|
+
progressLines.forEach((p) => {
|
|
127
|
+
const progress = p;
|
|
128
|
+
const status = progress.validation?.testsPass ? "\u2705" : "\u274C";
|
|
129
|
+
console.log(
|
|
130
|
+
` ${progress.iteration}: ${status} ${progress.changes} changes, ${progress.errors} errors`
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
} catch (error) {
|
|
135
|
+
logger.error("Failed to get Ralph status", error);
|
|
136
|
+
console.error("\u274C Status check failed:", error.message);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
ralph.command("resume").description("Resume a crashed or paused Ralph loop").option("--from-stackmemory", "Restore from StackMemory backup").action(async (options) => {
|
|
141
|
+
return trace.command("ralph-resume", options, async () => {
|
|
142
|
+
try {
|
|
143
|
+
console.log("\u{1F504} Resuming Ralph loop...");
|
|
144
|
+
const loop = new RalphLoop({ baseDir: ".ralph", verbose: true });
|
|
145
|
+
if (options.fromStackmemory) {
|
|
146
|
+
console.log("\u{1F4DA} StackMemory restore feature coming soon...");
|
|
147
|
+
}
|
|
148
|
+
await loop.run();
|
|
149
|
+
} catch (error) {
|
|
150
|
+
logger.error("Failed to resume Ralph loop", error);
|
|
151
|
+
console.error("\u274C Resume failed:", error.message);
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
ralph.command("stop").description("Stop the current Ralph loop").option("--save-progress", "Save current progress to StackMemory").action(async (options) => {
|
|
157
|
+
return trace.command("ralph-stop", options, async () => {
|
|
158
|
+
try {
|
|
159
|
+
if (!existsSync(".ralph")) {
|
|
160
|
+
console.log("\u274C No active Ralph loop found");
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
console.log("\u{1F6D1} Stopping Ralph loop...");
|
|
164
|
+
if (options.saveProgress) {
|
|
165
|
+
console.log("\u{1F4BE} StackMemory progress save feature coming soon...");
|
|
166
|
+
}
|
|
167
|
+
writeFileSync(".ralph/stop-signal.txt", (/* @__PURE__ */ new Date()).toISOString());
|
|
168
|
+
console.log("\u2705 Stop signal sent");
|
|
169
|
+
} catch (error) {
|
|
170
|
+
logger.error("Failed to stop Ralph loop", error);
|
|
171
|
+
console.error("\u274C Stop failed:", error.message);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
ralph.command("clean").description("Clean up Ralph loop artifacts").option("--keep-history", "Keep iteration history").action(async (options) => {
|
|
176
|
+
return trace.command("ralph-clean", options, async () => {
|
|
177
|
+
try {
|
|
178
|
+
if (!options.keepHistory && existsSync(".ralph/history")) {
|
|
179
|
+
const { execSync } = await import("child_process");
|
|
180
|
+
execSync("rm -rf .ralph/history");
|
|
181
|
+
}
|
|
182
|
+
if (existsSync(".ralph/work-complete.txt")) {
|
|
183
|
+
const fs = await import("fs");
|
|
184
|
+
fs.unlinkSync(".ralph/work-complete.txt");
|
|
185
|
+
}
|
|
186
|
+
console.log("\u{1F9F9} Ralph loop artifacts cleaned");
|
|
187
|
+
} catch (error) {
|
|
188
|
+
logger.error("Failed to clean Ralph artifacts", error);
|
|
189
|
+
console.error("\u274C Cleanup failed:", error.message);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
ralph.command("debug").description("Debug Ralph loop state and diagnostics").option("--reconcile", "Force state reconciliation").option("--validate-context", "Validate context budget").action(async (options) => {
|
|
194
|
+
return trace.command("ralph-debug", options, async () => {
|
|
195
|
+
try {
|
|
196
|
+
console.log("\u{1F50D} Ralph Loop Debug Information:");
|
|
197
|
+
if (options.reconcile) {
|
|
198
|
+
console.log("\u{1F527} State reconciliation feature coming soon...");
|
|
199
|
+
}
|
|
200
|
+
if (options.validateContext) {
|
|
201
|
+
console.log("\u{1F4CA} Context validation feature coming soon...");
|
|
202
|
+
}
|
|
203
|
+
if (existsSync(".ralph")) {
|
|
204
|
+
console.log("\n\u{1F4C1} Ralph directory structure:");
|
|
205
|
+
const { execSync } = await import("child_process");
|
|
206
|
+
try {
|
|
207
|
+
const tree = execSync("find .ralph -type f | head -20", {
|
|
208
|
+
encoding: "utf8"
|
|
209
|
+
});
|
|
210
|
+
console.log(tree);
|
|
211
|
+
} catch {
|
|
212
|
+
console.log(" (Unable to show directory tree)");
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
} catch (error) {
|
|
216
|
+
logger.error("Ralph debug failed", error);
|
|
217
|
+
console.error("\u274C Debug failed:", error.message);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
ralph.command("swarm").description("Launch a swarm of specialized agents").argument("<project>", "Project description").option(
|
|
222
|
+
"--agents <agents>",
|
|
223
|
+
"Comma-separated list of agent roles (architect,developer,tester,etc)",
|
|
224
|
+
"developer,tester"
|
|
225
|
+
).option("--max-agents <n>", "Maximum number of agents", "5").action(async (project, options) => {
|
|
226
|
+
return trace.command("ralph-swarm", { project, ...options }, async () => {
|
|
227
|
+
try {
|
|
228
|
+
console.log("\u{1F9BE} Launching Ralph swarm...");
|
|
229
|
+
await swarmCoordinator.initialize();
|
|
230
|
+
const agentRoles = options.agents.split(",").map((r) => r.trim());
|
|
231
|
+
const agentSpecs = agentRoles.map((role) => ({
|
|
232
|
+
role,
|
|
233
|
+
conflictResolution: "defer_to_expertise",
|
|
234
|
+
collaborationPreferences: []
|
|
235
|
+
}));
|
|
236
|
+
const swarmId = await swarmCoordinator.launchSwarm(
|
|
237
|
+
project,
|
|
238
|
+
agentSpecs
|
|
239
|
+
);
|
|
240
|
+
console.log(`\u2705 Swarm launched with ID: ${swarmId}`);
|
|
241
|
+
console.log(`\u{1F465} ${agentSpecs.length} agents working on: ${project}`);
|
|
242
|
+
console.log("\nNext steps:");
|
|
243
|
+
console.log(
|
|
244
|
+
" stackmemory ralph swarm-status <swarmId> # Check progress"
|
|
245
|
+
);
|
|
246
|
+
console.log(
|
|
247
|
+
" stackmemory ralph swarm-stop <swarmId> # Stop swarm"
|
|
248
|
+
);
|
|
249
|
+
} catch (error) {
|
|
250
|
+
logger.error("Swarm launch failed", error);
|
|
251
|
+
console.error("\u274C Swarm launch failed:", error.message);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
ralph.command("swarm-status").description("Check status of all active swarms or a specific swarm").argument("[swarmId]", "Optional specific swarm ID to check").option("--detailed", "Show detailed agent information").action(async (swarmId, options) => {
|
|
256
|
+
return trace.command(
|
|
257
|
+
"ralph-swarm-status",
|
|
258
|
+
{ swarmId, ...options },
|
|
259
|
+
async () => {
|
|
260
|
+
try {
|
|
261
|
+
await swarmCoordinator.initialize();
|
|
262
|
+
if (swarmId) {
|
|
263
|
+
const status = swarmCoordinator.getSwarmStatus(swarmId);
|
|
264
|
+
if (!status) {
|
|
265
|
+
console.log(`\u274C Swarm ${swarmId} not found`);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
console.log(`\u{1F9BE} Swarm Status: ${swarmId}`);
|
|
269
|
+
console.log(` Status: ${status.state}`);
|
|
270
|
+
console.log(` Agents: ${status.activeAgents} active`);
|
|
271
|
+
console.log(
|
|
272
|
+
` Started: ${new Date(status.startTime).toLocaleString()}`
|
|
273
|
+
);
|
|
274
|
+
if (options.detailed && status.agents) {
|
|
275
|
+
console.log("\n\u{1F465} Agent Details:");
|
|
276
|
+
status.agents.forEach((agent) => {
|
|
277
|
+
console.log(
|
|
278
|
+
` - ${agent.role}: ${agent.status} (${agent.task})`
|
|
279
|
+
);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
} else {
|
|
283
|
+
const activeSwarms = swarmCoordinator.getAllActiveSwarms();
|
|
284
|
+
if (activeSwarms.length === 0) {
|
|
285
|
+
console.log("\u{1F4CA} No active swarms");
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
console.log(`\u{1F4CA} Active Swarms: ${activeSwarms.length}`);
|
|
289
|
+
activeSwarms.forEach((swarm) => {
|
|
290
|
+
console.log(`
|
|
291
|
+
\u{1F194} ${swarm.id}`);
|
|
292
|
+
console.log(
|
|
293
|
+
` Description: ${swarm.description?.substring(0, 60)}...`
|
|
294
|
+
);
|
|
295
|
+
console.log(` Agents: ${swarm.agentCount}`);
|
|
296
|
+
console.log(` Status: ${swarm.status}`);
|
|
297
|
+
console.log(
|
|
298
|
+
` Running for: ${Math.round((Date.now() - swarm.startTime) / 1e3)}s`
|
|
299
|
+
);
|
|
300
|
+
});
|
|
301
|
+
console.log("\nCommands:");
|
|
302
|
+
console.log(
|
|
303
|
+
" stackmemory ralph swarm-status <id> # Check specific swarm"
|
|
304
|
+
);
|
|
305
|
+
console.log(
|
|
306
|
+
" stackmemory ralph swarm-killall # Stop all swarms"
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
} catch (error) {
|
|
310
|
+
logger.error("Failed to get swarm status", error);
|
|
311
|
+
console.error("\u274C Status check failed:", error.message);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
});
|
|
316
|
+
ralph.command("oracle-worker").description(
|
|
317
|
+
"Launch Oracle/Worker pattern swarm for cost-effective execution"
|
|
318
|
+
).argument("<project>", "Project description for Oracle planning").option(
|
|
319
|
+
"--oracle <model>",
|
|
320
|
+
"Oracle model (default: claude-3-opus)",
|
|
321
|
+
"claude-3-opus-20240229"
|
|
322
|
+
).option(
|
|
323
|
+
"--workers <models>",
|
|
324
|
+
"Comma-separated worker models",
|
|
325
|
+
"claude-3-haiku-20240307"
|
|
326
|
+
).option("--budget <amount>", "Cost budget in USD", "10.0").option("--max-workers <count>", "Maximum worker agents", "5").option("--hints <hints>", "Comma-separated planning hints").action(async (project, options) => {
|
|
327
|
+
return trace.command(
|
|
328
|
+
"ralph-oracle-worker",
|
|
329
|
+
{ project, ...options },
|
|
330
|
+
async () => {
|
|
331
|
+
try {
|
|
332
|
+
console.log("\u{1F9E0} Launching Oracle/Worker swarm...");
|
|
333
|
+
console.log(`\u{1F4CB} Project: ${project}`);
|
|
334
|
+
console.log(`\u{1F4B0} Budget: $${options.budget}`);
|
|
335
|
+
const { OracleWorkerCoordinator, defaultModelConfigs } = await import("../../../integrations/ralph/patterns/oracle-worker-pattern.js");
|
|
336
|
+
const workerModels = options.workers.split(",").map((model) => {
|
|
337
|
+
const found = defaultModelConfigs.worker.find(
|
|
338
|
+
(w) => w.model.includes(model.trim())
|
|
339
|
+
);
|
|
340
|
+
return found || defaultModelConfigs.worker[0];
|
|
341
|
+
});
|
|
342
|
+
const coordinator = new OracleWorkerCoordinator({
|
|
343
|
+
oracle: defaultModelConfigs.oracle[0],
|
|
344
|
+
workers: workerModels,
|
|
345
|
+
reviewers: defaultModelConfigs.reviewer,
|
|
346
|
+
maxWorkers: parseInt(options.maxWorkers),
|
|
347
|
+
coordinationInterval: 3e4,
|
|
348
|
+
costBudget: parseFloat(options.budget)
|
|
349
|
+
});
|
|
350
|
+
await coordinator.initialize();
|
|
351
|
+
const hints = options.hints ? options.hints.split(",").map((h) => h.trim()) : void 0;
|
|
352
|
+
const swarmId = await coordinator.launchOracleWorkerSwarm(
|
|
353
|
+
project,
|
|
354
|
+
hints
|
|
355
|
+
);
|
|
356
|
+
console.log(`\u2705 Oracle/Worker swarm launched: ${swarmId}`);
|
|
357
|
+
console.log("\n\u{1F4CA} Pattern Benefits:");
|
|
358
|
+
console.log(" \u2022 Oracle handles strategic planning & review");
|
|
359
|
+
console.log(" \u2022 Workers execute parallelizable tasks");
|
|
360
|
+
console.log(" \u2022 Cost-optimized model selection");
|
|
361
|
+
console.log(" \u2022 Scalable multi-agent coordination");
|
|
362
|
+
console.log("\nNext steps:");
|
|
363
|
+
console.log(
|
|
364
|
+
` stackmemory ralph swarm-status ${swarmId} # Check progress`
|
|
365
|
+
);
|
|
366
|
+
console.log(
|
|
367
|
+
` stackmemory ralph swarm-stop ${swarmId} # Stop swarm`
|
|
368
|
+
);
|
|
369
|
+
} catch (error) {
|
|
370
|
+
logger.error("Oracle/Worker swarm failed", error);
|
|
371
|
+
console.error(`\u274C Oracle/Worker failed: ${error.message}`);
|
|
372
|
+
throw error;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
);
|
|
376
|
+
});
|
|
377
|
+
ralph.command("claude-swarm").description("Launch swarm using Claude Code specialized agents").argument("<project>", "Project description for Claude Code agents").option(
|
|
378
|
+
"--oracle <agent>",
|
|
379
|
+
"Oracle agent (default: staff-architect)",
|
|
380
|
+
"staff-architect"
|
|
381
|
+
).option(
|
|
382
|
+
"--workers <agents>",
|
|
383
|
+
"Comma-separated worker agents",
|
|
384
|
+
"general-purpose,code-reviewer"
|
|
385
|
+
).option(
|
|
386
|
+
"--reviewers <agents>",
|
|
387
|
+
"Comma-separated reviewer agents",
|
|
388
|
+
"code-reviewer"
|
|
389
|
+
).option("--budget <amount>", "Cost budget in USD", "10.0").option(
|
|
390
|
+
"--complexity <level>",
|
|
391
|
+
"Project complexity (low|medium|high|very_high)",
|
|
392
|
+
"medium"
|
|
393
|
+
).option("--list-agents", "List available Claude Code agents").action(async (project, options) => {
|
|
394
|
+
return trace.command(
|
|
395
|
+
"ralph-claude-swarm",
|
|
396
|
+
{ project, ...options },
|
|
397
|
+
async () => {
|
|
398
|
+
try {
|
|
399
|
+
const { ClaudeCodeAgentBridge, CLAUDE_CODE_AGENTS } = await import("../../integrations/claude-code/agent-bridge.js");
|
|
400
|
+
if (options.listAgents) {
|
|
401
|
+
console.log("\n\u{1F916} Available Claude Code Agents:\n");
|
|
402
|
+
const oracles = Object.values(CLAUDE_CODE_AGENTS).filter(
|
|
403
|
+
(a) => a.type === "oracle"
|
|
404
|
+
);
|
|
405
|
+
const workers = Object.values(CLAUDE_CODE_AGENTS).filter(
|
|
406
|
+
(a) => a.type === "worker"
|
|
407
|
+
);
|
|
408
|
+
const reviewers = Object.values(CLAUDE_CODE_AGENTS).filter(
|
|
409
|
+
(a) => a.type === "reviewer"
|
|
410
|
+
);
|
|
411
|
+
console.log("\u{1F9E0} ORACLE AGENTS (Strategic Planning):");
|
|
412
|
+
oracles.forEach((agent) => {
|
|
413
|
+
console.log(` ${agent.name}: ${agent.description}`);
|
|
414
|
+
console.log(
|
|
415
|
+
` Capabilities: ${agent.capabilities.slice(0, 3).join(", ")}...`
|
|
416
|
+
);
|
|
417
|
+
});
|
|
418
|
+
console.log("\n\u26A1 WORKER AGENTS (Task Execution):");
|
|
419
|
+
workers.forEach((agent) => {
|
|
420
|
+
console.log(` ${agent.name}: ${agent.description}`);
|
|
421
|
+
console.log(
|
|
422
|
+
` Capabilities: ${agent.capabilities.slice(0, 3).join(", ")}...`
|
|
423
|
+
);
|
|
424
|
+
});
|
|
425
|
+
console.log("\n\u{1F50D} REVIEWER AGENTS (Quality Assurance):");
|
|
426
|
+
reviewers.forEach((agent) => {
|
|
427
|
+
console.log(` ${agent.name}: ${agent.description}`);
|
|
428
|
+
console.log(
|
|
429
|
+
` Capabilities: ${agent.capabilities.slice(0, 3).join(", ")}...`
|
|
430
|
+
);
|
|
431
|
+
});
|
|
432
|
+
console.log("\nUsage Examples:");
|
|
433
|
+
console.log(
|
|
434
|
+
' stackmemory ralph claude-swarm "Build REST API" --oracle staff-architect --workers general-purpose,debugger'
|
|
435
|
+
);
|
|
436
|
+
console.log(
|
|
437
|
+
' stackmemory ralph claude-swarm "Add user auth" --complexity high --workers general-purpose,qa-workflow-validator'
|
|
438
|
+
);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
console.log("\u{1F9E0} Launching Claude Code Agent Swarm...");
|
|
442
|
+
console.log(`\u{1F4CB} Project: ${project}`);
|
|
443
|
+
console.log(`\u{1F3AF} Oracle: ${options.oracle}`);
|
|
444
|
+
console.log(`\u26A1 Workers: ${options.workers}`);
|
|
445
|
+
console.log(`\u{1F50D} Reviewers: ${options.reviewers}`);
|
|
446
|
+
console.log(`\u{1F4B0} Budget: $${options.budget}`);
|
|
447
|
+
console.log(`\u{1F4CA} Complexity: ${options.complexity}`);
|
|
448
|
+
const bridge = new ClaudeCodeAgentBridge();
|
|
449
|
+
await bridge.initialize();
|
|
450
|
+
const workerAgents = options.workers.split(",").map((s) => s.trim());
|
|
451
|
+
const reviewerAgents = options.reviewers.split(",").map((s) => s.trim());
|
|
452
|
+
const swarmId = await bridge.launchClaudeCodeSwarm(project, {
|
|
453
|
+
oracleAgent: options.oracle,
|
|
454
|
+
workerAgents,
|
|
455
|
+
reviewerAgents,
|
|
456
|
+
budget: parseFloat(options.budget),
|
|
457
|
+
complexity: options.complexity
|
|
458
|
+
});
|
|
459
|
+
console.log(`\u2705 Claude Code swarm launched: ${swarmId}`);
|
|
460
|
+
console.log("\n\u{1F4CA} Claude Code Benefits:");
|
|
461
|
+
console.log(" \u2022 Specialized agents with proven capabilities");
|
|
462
|
+
console.log(" \u2022 Seamless integration with Claude Code tools");
|
|
463
|
+
console.log(" \u2022 Optimal agent selection for each task type");
|
|
464
|
+
console.log(" \u2022 Built-in quality assurance and review processes");
|
|
465
|
+
console.log("\nActive Agents:");
|
|
466
|
+
console.log(` \u{1F9E0} Oracle: ${options.oracle} (strategic planning)`);
|
|
467
|
+
workerAgents.forEach((agent) => {
|
|
468
|
+
const agentConfig = CLAUDE_CODE_AGENTS[agent];
|
|
469
|
+
console.log(
|
|
470
|
+
` \u26A1 Worker: ${agent} (${agentConfig?.specializations.join(", ") || "execution"})`
|
|
471
|
+
);
|
|
472
|
+
});
|
|
473
|
+
reviewerAgents.forEach((agent) => {
|
|
474
|
+
const agentConfig = CLAUDE_CODE_AGENTS[agent];
|
|
475
|
+
console.log(
|
|
476
|
+
` \u{1F50D} Reviewer: ${agent} (${agentConfig?.specializations.join(", ") || "review"})`
|
|
477
|
+
);
|
|
478
|
+
});
|
|
479
|
+
console.log("\nNext steps:");
|
|
480
|
+
console.log(
|
|
481
|
+
` stackmemory ralph swarm-status ${swarmId} # Check progress`
|
|
482
|
+
);
|
|
483
|
+
console.log(
|
|
484
|
+
` stackmemory ralph swarm-stop ${swarmId} # Stop swarm`
|
|
485
|
+
);
|
|
486
|
+
console.log(
|
|
487
|
+
" stackmemory ralph claude-swarm --list-agents # See all available agents"
|
|
488
|
+
);
|
|
489
|
+
} catch (error) {
|
|
490
|
+
logger.error("Claude Code swarm failed", error);
|
|
491
|
+
console.error(`\u274C Claude Code swarm failed: ${error.message}`);
|
|
492
|
+
throw error;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
});
|
|
497
|
+
ralph.command("swarm-killall").description("Stop all active swarms and cleanup resources").option("--force", "Force kill without saving state").action(async (options) => {
|
|
498
|
+
return trace.command("ralph-swarm-killall", options, async () => {
|
|
499
|
+
try {
|
|
500
|
+
await swarmCoordinator.initialize();
|
|
501
|
+
const activeSwarms = swarmCoordinator.getAllActiveSwarms();
|
|
502
|
+
if (activeSwarms.length === 0) {
|
|
503
|
+
console.log("\u{1F4CA} No active swarms to stop");
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
console.log(`\u{1F6D1} Stopping ${activeSwarms.length} active swarm(s)...`);
|
|
507
|
+
let stoppedCount = 0;
|
|
508
|
+
let failedCount = 0;
|
|
509
|
+
for (const swarm of activeSwarms) {
|
|
510
|
+
try {
|
|
511
|
+
console.log(` Stopping ${swarm.id}...`);
|
|
512
|
+
if (options.force) {
|
|
513
|
+
await swarmCoordinator.forceStopSwarm(swarm.id);
|
|
514
|
+
} else {
|
|
515
|
+
await swarmCoordinator.stopSwarm(swarm.id);
|
|
516
|
+
}
|
|
517
|
+
stoppedCount++;
|
|
518
|
+
console.log(` \u2705 Stopped ${swarm.id}`);
|
|
519
|
+
} catch (error) {
|
|
520
|
+
failedCount++;
|
|
521
|
+
console.error(
|
|
522
|
+
` \u274C Failed to stop ${swarm.id}: ${error.message}`
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
try {
|
|
527
|
+
const { execSync } = await import("child_process");
|
|
528
|
+
const branches = execSync('git branch | grep "swarm/"', {
|
|
529
|
+
encoding: "utf8"
|
|
530
|
+
}).split("\n").filter(Boolean).map((b) => b.trim());
|
|
531
|
+
if (branches.length > 0) {
|
|
532
|
+
console.log(
|
|
533
|
+
`
|
|
534
|
+
\u{1F500} Cleaning up ${branches.length} swarm branches...`
|
|
535
|
+
);
|
|
536
|
+
for (const branch of branches) {
|
|
537
|
+
try {
|
|
538
|
+
execSync(`git branch -D ${branch}`, { stdio: "ignore" });
|
|
539
|
+
console.log(` Deleted ${branch}`);
|
|
540
|
+
} catch {
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
} catch {
|
|
545
|
+
}
|
|
546
|
+
console.log(`
|
|
547
|
+
\u{1F4CA} Summary:`);
|
|
548
|
+
console.log(` \u2705 Stopped: ${stoppedCount} swarms`);
|
|
549
|
+
if (failedCount > 0) {
|
|
550
|
+
console.log(` \u274C Failed: ${failedCount} swarms`);
|
|
551
|
+
}
|
|
552
|
+
await swarmCoordinator.cleanup();
|
|
553
|
+
console.log("\u{1F9F9} Cleanup completed");
|
|
554
|
+
} catch (error) {
|
|
555
|
+
logger.error("Swarm killall failed", error);
|
|
556
|
+
console.error("\u274C Killall failed:", error.message);
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
ralph.command("orchestrate").description("Orchestrate multiple Ralph loops for complex tasks").argument("<description>", "Complex task description").option("--criteria <criteria>", "Success criteria (comma separated)").option("--max-loops <n>", "Maximum parallel loops", "3").option("--sequential", "Force sequential execution").action(async (description, options) => {
|
|
561
|
+
return trace.command(
|
|
562
|
+
"ralph-orchestrate",
|
|
563
|
+
{ description, ...options },
|
|
564
|
+
async () => {
|
|
565
|
+
try {
|
|
566
|
+
console.log("\u{1F3AD} Orchestrating complex task...");
|
|
567
|
+
await multiLoopOrchestrator.initialize();
|
|
568
|
+
const criteria = options.criteria ? options.criteria.split(",").map((c) => c.trim()) : [
|
|
569
|
+
"Task completed successfully",
|
|
570
|
+
"All components working",
|
|
571
|
+
"Tests pass"
|
|
572
|
+
];
|
|
573
|
+
const result = await multiLoopOrchestrator.orchestrateComplexTask(
|
|
574
|
+
description,
|
|
575
|
+
criteria,
|
|
576
|
+
{
|
|
577
|
+
maxLoops: parseInt(options.maxLoops),
|
|
578
|
+
forceSequential: options.sequential
|
|
579
|
+
}
|
|
580
|
+
);
|
|
581
|
+
console.log("\u2705 Orchestration completed!");
|
|
582
|
+
console.log(
|
|
583
|
+
`\u{1F4CA} Results: ${result.completedLoops.length} successful, ${result.failedLoops.length} failed`
|
|
584
|
+
);
|
|
585
|
+
console.log(
|
|
586
|
+
`\u23F1\uFE0F Total duration: ${Math.round(result.totalDuration / 1e3)}s`
|
|
587
|
+
);
|
|
588
|
+
if (result.insights.length > 0) {
|
|
589
|
+
console.log("\n\u{1F4A1} Insights:");
|
|
590
|
+
result.insights.forEach(
|
|
591
|
+
(insight) => console.log(` \u2022 ${insight}`)
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
} catch (error) {
|
|
595
|
+
logger.error("Orchestration failed", error);
|
|
596
|
+
console.error("\u274C Orchestration failed:", error.message);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
);
|
|
600
|
+
});
|
|
601
|
+
ralph.command("learn").description("Learn patterns from completed loops").option("--task-type <type>", "Learn patterns for specific task type").action(async (options) => {
|
|
602
|
+
return trace.command("ralph-learn", options, async () => {
|
|
603
|
+
try {
|
|
604
|
+
console.log("\u{1F9E0} Learning patterns from completed loops...");
|
|
605
|
+
await patternLearner.initialize();
|
|
606
|
+
const patterns = options.taskType ? await patternLearner.learnForTaskType(options.taskType) : await patternLearner.learnFromCompletedLoops();
|
|
607
|
+
console.log(`\u2705 Learned ${patterns.length} patterns`);
|
|
608
|
+
if (patterns.length > 0) {
|
|
609
|
+
console.log("\n\u{1F4CA} Top patterns:");
|
|
610
|
+
patterns.slice(0, 5).forEach((pattern) => {
|
|
611
|
+
console.log(
|
|
612
|
+
` \u2022 ${pattern.pattern} (${Math.round(pattern.confidence * 100)}% confidence)`
|
|
613
|
+
);
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
} catch (error) {
|
|
617
|
+
logger.error("Pattern learning failed", error);
|
|
618
|
+
console.error(
|
|
619
|
+
"\u274C Pattern learning failed:",
|
|
620
|
+
error.message
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
});
|
|
625
|
+
ralph.command("debug-enhanced").description("Advanced debugging with visualization").option("--loop-id <id>", "Specific loop to debug").option("--generate-report", "Generate comprehensive debug report").option("--timeline", "Generate timeline visualization").action(async (options) => {
|
|
626
|
+
return trace.command("ralph-debug-enhanced", options, async () => {
|
|
627
|
+
try {
|
|
628
|
+
if (!existsSync(".ralph") && !options.loopId) {
|
|
629
|
+
console.log(
|
|
630
|
+
"\u274C No Ralph loop found. Run a loop first or specify --loop-id"
|
|
631
|
+
);
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
console.log("\u{1F50D} Starting enhanced debugging...");
|
|
635
|
+
await ralphDebugger.initialize();
|
|
636
|
+
const loopId = options.loopId || "current";
|
|
637
|
+
await ralphDebugger.startDebugSession(loopId, ".ralph");
|
|
638
|
+
if (options.generateReport) {
|
|
639
|
+
const report = await ralphDebugger.generateDebugReport(loopId);
|
|
640
|
+
console.log(`\u{1F4CB} Debug report generated: ${report.exportPath}`);
|
|
641
|
+
}
|
|
642
|
+
if (options.timeline) {
|
|
643
|
+
const timelinePath = await ralphDebugger.generateLoopTimeline(loopId);
|
|
644
|
+
console.log(`\u{1F4CA} Timeline visualization: ${timelinePath}`);
|
|
645
|
+
}
|
|
646
|
+
console.log("\u{1F50D} Debug analysis complete");
|
|
647
|
+
} catch (error) {
|
|
648
|
+
logger.error("Enhanced debugging failed", error);
|
|
649
|
+
console.error("\u274C Debug failed:", error.message);
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
});
|
|
653
|
+
ralph.command("swarm-test").description("Comprehensive testing and validation for swarm functionality").option("--quick", "Run quick validation tests only").option("--stress", "Run stress tests with multiple parallel swarms").option("--error-injection", "Test error handling with deliberate failures").option("--cleanup-test", "Test cleanup mechanisms").option("--git-test", "Test git workflow integration").option("--report", "Generate detailed test report").action(async (options) => {
|
|
654
|
+
return trace.command("ralph-swarm-test", options, async () => {
|
|
655
|
+
try {
|
|
656
|
+
console.log("\u{1F9EA} Starting swarm testing and validation...");
|
|
657
|
+
await swarmCoordinator.initialize();
|
|
658
|
+
const testResults = [];
|
|
659
|
+
let passedTests = 0;
|
|
660
|
+
let totalTests = 0;
|
|
661
|
+
if (options.quick || !options.stress) {
|
|
662
|
+
console.log("\n\u26A1 Running quick validation tests...");
|
|
663
|
+
totalTests++;
|
|
664
|
+
try {
|
|
665
|
+
await swarmCoordinator.launchSwarm(
|
|
666
|
+
"Test: Basic functionality validation",
|
|
667
|
+
[{ role: "developer" }]
|
|
668
|
+
);
|
|
669
|
+
await swarmCoordinator.forceCleanup();
|
|
670
|
+
console.log(" \u2705 Basic swarm initialization");
|
|
671
|
+
passedTests++;
|
|
672
|
+
testResults.push({
|
|
673
|
+
test: "basic_init",
|
|
674
|
+
status: "passed",
|
|
675
|
+
duration: 0
|
|
676
|
+
});
|
|
677
|
+
} catch (error) {
|
|
678
|
+
console.log(
|
|
679
|
+
" \u274C Basic swarm initialization failed:",
|
|
680
|
+
error.message
|
|
681
|
+
);
|
|
682
|
+
testResults.push({
|
|
683
|
+
test: "basic_init",
|
|
684
|
+
status: "failed",
|
|
685
|
+
error: error.message
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
totalTests++;
|
|
689
|
+
try {
|
|
690
|
+
const usage = swarmCoordinator.getResourceUsage();
|
|
691
|
+
console.log(
|
|
692
|
+
` \u2705 Resource monitoring: ${usage.activeAgents} agents, ${usage.memoryEstimate}MB`
|
|
693
|
+
);
|
|
694
|
+
passedTests++;
|
|
695
|
+
testResults.push({
|
|
696
|
+
test: "resource_monitoring",
|
|
697
|
+
status: "passed",
|
|
698
|
+
data: usage
|
|
699
|
+
});
|
|
700
|
+
} catch (error) {
|
|
701
|
+
console.log(
|
|
702
|
+
" \u274C Resource monitoring failed:",
|
|
703
|
+
error.message
|
|
704
|
+
);
|
|
705
|
+
testResults.push({
|
|
706
|
+
test: "resource_monitoring",
|
|
707
|
+
status: "failed",
|
|
708
|
+
error: error.message
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (options.stress) {
|
|
713
|
+
console.log("\n\u{1F525} Running stress tests...");
|
|
714
|
+
totalTests++;
|
|
715
|
+
try {
|
|
716
|
+
const stressPromises = [];
|
|
717
|
+
for (let i = 0; i < 3; i++) {
|
|
718
|
+
stressPromises.push(
|
|
719
|
+
swarmCoordinator.launchSwarm(`Stress test swarm ${i}`, [
|
|
720
|
+
{ role: "developer" },
|
|
721
|
+
{ role: "tester" }
|
|
722
|
+
])
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
await Promise.all(stressPromises);
|
|
726
|
+
await swarmCoordinator.forceCleanup();
|
|
727
|
+
console.log(" \u2705 Parallel swarm stress test");
|
|
728
|
+
passedTests++;
|
|
729
|
+
testResults.push({ test: "stress_parallel", status: "passed" });
|
|
730
|
+
} catch (error) {
|
|
731
|
+
console.log(" \u274C Stress test failed:", error.message);
|
|
732
|
+
testResults.push({
|
|
733
|
+
test: "stress_parallel",
|
|
734
|
+
status: "failed",
|
|
735
|
+
error: error.message
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
if (options.errorInjection) {
|
|
740
|
+
console.log("\n\u{1F4A5} Testing error handling...");
|
|
741
|
+
totalTests++;
|
|
742
|
+
try {
|
|
743
|
+
try {
|
|
744
|
+
await swarmCoordinator.launchSwarm(
|
|
745
|
+
"Error test: Invalid agents",
|
|
746
|
+
[]
|
|
747
|
+
// Empty agents array
|
|
748
|
+
);
|
|
749
|
+
} catch {
|
|
750
|
+
console.log(" \u2705 Properly handled empty agents array");
|
|
751
|
+
passedTests++;
|
|
752
|
+
testResults.push({ test: "error_handling", status: "passed" });
|
|
753
|
+
}
|
|
754
|
+
} catch (error) {
|
|
755
|
+
console.log(
|
|
756
|
+
" \u274C Error handling test failed:",
|
|
757
|
+
error.message
|
|
758
|
+
);
|
|
759
|
+
testResults.push({
|
|
760
|
+
test: "error_handling",
|
|
761
|
+
status: "failed",
|
|
762
|
+
error: error.message
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
if (options.cleanupTest) {
|
|
767
|
+
console.log("\n\u{1F9F9} Testing cleanup mechanisms...");
|
|
768
|
+
totalTests++;
|
|
769
|
+
try {
|
|
770
|
+
await swarmCoordinator.launchSwarm("Cleanup test swarm", [
|
|
771
|
+
{ role: "developer" }
|
|
772
|
+
]);
|
|
773
|
+
await swarmCoordinator.forceCleanup();
|
|
774
|
+
const usage = swarmCoordinator.getResourceUsage();
|
|
775
|
+
if (usage.activeAgents === 0) {
|
|
776
|
+
console.log(" \u2705 Cleanup mechanism works correctly");
|
|
777
|
+
passedTests++;
|
|
778
|
+
testResults.push({ test: "cleanup", status: "passed" });
|
|
779
|
+
} else {
|
|
780
|
+
throw new SystemError(
|
|
781
|
+
`Cleanup failed: ${usage.activeAgents} agents still active`,
|
|
782
|
+
ErrorCode.RESOURCE_EXHAUSTED,
|
|
783
|
+
{ activeAgents: usage.activeAgents, test: "cleanup" }
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
} catch (error) {
|
|
787
|
+
console.log(
|
|
788
|
+
" \u274C Cleanup test failed:",
|
|
789
|
+
error.message
|
|
790
|
+
);
|
|
791
|
+
testResults.push({
|
|
792
|
+
test: "cleanup",
|
|
793
|
+
status: "failed",
|
|
794
|
+
error: error.message
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
if (options.gitTest) {
|
|
799
|
+
console.log("\n\u{1F500} Testing git workflow integration...");
|
|
800
|
+
totalTests++;
|
|
801
|
+
try {
|
|
802
|
+
const gitStatus = swarmCoordinator["gitWorkflowManager"].getGitStatus();
|
|
803
|
+
console.log(
|
|
804
|
+
` \u2705 Git workflow status: ${gitStatus.enabled ? "enabled" : "disabled"}`
|
|
805
|
+
);
|
|
806
|
+
passedTests++;
|
|
807
|
+
testResults.push({
|
|
808
|
+
test: "git_workflow",
|
|
809
|
+
status: "passed",
|
|
810
|
+
data: gitStatus
|
|
811
|
+
});
|
|
812
|
+
} catch (error) {
|
|
813
|
+
console.log(
|
|
814
|
+
" \u274C Git workflow test failed:",
|
|
815
|
+
error.message
|
|
816
|
+
);
|
|
817
|
+
testResults.push({
|
|
818
|
+
test: "git_workflow",
|
|
819
|
+
status: "failed",
|
|
820
|
+
error: error.message
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
console.log("\n\u{1F4CA} Test Results Summary:");
|
|
825
|
+
console.log(` Total tests: ${totalTests}`);
|
|
826
|
+
console.log(` Passed: ${passedTests} \u2705`);
|
|
827
|
+
console.log(` Failed: ${totalTests - passedTests} \u274C`);
|
|
828
|
+
console.log(
|
|
829
|
+
` Success rate: ${Math.round(passedTests / totalTests * 100)}%`
|
|
830
|
+
);
|
|
831
|
+
if (options.report) {
|
|
832
|
+
const reportPath = ".swarm/test-report.json";
|
|
833
|
+
const fs = await import("fs");
|
|
834
|
+
const reportData = {
|
|
835
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
836
|
+
summary: {
|
|
837
|
+
totalTests,
|
|
838
|
+
passedTests,
|
|
839
|
+
failedTests: totalTests - passedTests,
|
|
840
|
+
successRate: passedTests / totalTests * 100
|
|
841
|
+
},
|
|
842
|
+
testResults,
|
|
843
|
+
systemInfo: {
|
|
844
|
+
nodeVersion: process.version,
|
|
845
|
+
platform: process.platform,
|
|
846
|
+
arch: process.arch
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
fs.writeFileSync(reportPath, JSON.stringify(reportData, null, 2));
|
|
850
|
+
console.log(`\u{1F4CB} Detailed report saved to: ${reportPath}`);
|
|
851
|
+
}
|
|
852
|
+
if (passedTests === totalTests) {
|
|
853
|
+
console.log(
|
|
854
|
+
"\n\u{1F389} All tests passed! Swarm functionality is working correctly."
|
|
855
|
+
);
|
|
856
|
+
} else {
|
|
857
|
+
console.log(
|
|
858
|
+
"\n\u26A0\uFE0F Some tests failed. Check the errors above for details."
|
|
859
|
+
);
|
|
860
|
+
process.exit(1);
|
|
861
|
+
}
|
|
862
|
+
} catch (error) {
|
|
863
|
+
logger.error("Swarm testing failed", error);
|
|
864
|
+
console.error("\u274C Test suite failed:", error.message);
|
|
865
|
+
process.exit(1);
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
});
|
|
869
|
+
ralph.command("tui").description("Launch TUI monitor for active swarms").option("--swarm-id <id>", "Monitor specific swarm ID").option("--simple", "Use simple text mode instead of full TUI").option("--force-tui", "Force full TUI even with compatibility issues").action(async (options) => {
|
|
870
|
+
try {
|
|
871
|
+
const isGhostty = process.env.TERM_PROGRAM === "ghostty" || process.env.TERM?.includes("ghostty");
|
|
872
|
+
const isBasicTerm = process.env.TERM === "dumb" || process.env.TERM === "unknown";
|
|
873
|
+
const hasCompatibilityIssues = isGhostty || isBasicTerm;
|
|
874
|
+
const useSimpleMode = options.simple || hasCompatibilityIssues && !options.forceTui;
|
|
875
|
+
if (useSimpleMode) {
|
|
876
|
+
console.log("\u{1F9BE} Starting Simple Swarm Monitor (Text Mode)");
|
|
877
|
+
if (hasCompatibilityIssues && !options.simple) {
|
|
878
|
+
console.log(
|
|
879
|
+
`\u26A0\uFE0F Detected ${isGhostty ? "Ghostty" : "basic"} terminal - using text mode for compatibility`
|
|
880
|
+
);
|
|
881
|
+
console.log(
|
|
882
|
+
" Use --force-tui to override, or --simple to explicitly use text mode"
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
const { SimpleSwarmMonitor } = await import("../../features/tui/simple-monitor.js");
|
|
886
|
+
const monitor = new SimpleSwarmMonitor();
|
|
887
|
+
monitor.start();
|
|
888
|
+
} else {
|
|
889
|
+
console.log("\u{1F9BE} Starting Full TUI Monitor");
|
|
890
|
+
const { SwarmTUI } = await import("../../features/tui/swarm-monitor.js");
|
|
891
|
+
const tui = new SwarmTUI();
|
|
892
|
+
await tui.initialize(void 0, options.swarmId);
|
|
893
|
+
tui.start();
|
|
894
|
+
}
|
|
895
|
+
} catch (error) {
|
|
896
|
+
logger.error("TUI launch failed", error);
|
|
897
|
+
console.error("\u274C TUI failed:", error.message);
|
|
898
|
+
console.log("\u{1F4A1} Try: stackmemory ralph tui --simple");
|
|
899
|
+
process.exit(1);
|
|
900
|
+
}
|
|
901
|
+
});
|
|
902
|
+
return ralph;
|
|
903
|
+
}
|
|
904
|
+
var ralph_default = createRalphCommand;
|
|
905
|
+
export {
|
|
906
|
+
createRalphCommand,
|
|
907
|
+
ralph_default as default
|
|
908
|
+
};
|
|
909
|
+
//# sourceMappingURL=ralph.js.map
|