oh-my-claude-sisyphus 3.5.8 → 3.6.1
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/agents/executor-high.md +2 -0
- package/agents/executor-low.md +2 -0
- package/agents/executor.md +2 -0
- package/agents/templates/base-agent.md +9 -0
- package/commands/cancel.md +8 -8
- package/commands/omc-setup.md +3 -3
- package/commands/release.md +1 -1
- package/commands/swarm.md +350 -148
- package/dist/__tests__/analytics/transcript-scanner.test.js +69 -27
- package/dist/__tests__/analytics/transcript-scanner.test.js.map +1 -1
- package/dist/__tests__/hooks.test.js +10 -9
- package/dist/__tests__/hooks.test.js.map +1 -1
- package/dist/__tests__/installer.test.js +2 -1
- package/dist/__tests__/installer.test.js.map +1 -1
- package/dist/agents/preamble.d.ts +14 -0
- package/dist/agents/preamble.d.ts.map +1 -0
- package/dist/agents/preamble.js +26 -0
- package/dist/agents/preamble.js.map +1 -0
- package/dist/analytics/session-manager.d.ts +24 -0
- package/dist/analytics/session-manager.d.ts.map +1 -1
- package/dist/analytics/session-manager.js +98 -9
- package/dist/analytics/session-manager.js.map +1 -1
- package/dist/analytics/transcript-scanner.d.ts +9 -8
- package/dist/analytics/transcript-scanner.d.ts.map +1 -1
- package/dist/analytics/transcript-scanner.js +146 -16
- package/dist/analytics/transcript-scanner.js.map +1 -1
- package/dist/cli/analytics.js +0 -0
- package/dist/cli/index.js +0 -0
- package/dist/hooks/autopilot/__tests__/cancel.test.js +14 -4
- package/dist/hooks/autopilot/__tests__/cancel.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/state.test.js +1 -0
- package/dist/hooks/autopilot/__tests__/state.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/summary.test.js +38 -3
- package/dist/hooks/autopilot/__tests__/summary.test.js.map +1 -1
- package/dist/hooks/autopilot/state.d.ts +1 -1
- package/dist/hooks/autopilot/state.d.ts.map +1 -1
- package/dist/hooks/autopilot/state.js +15 -8
- package/dist/hooks/autopilot/state.js.map +1 -1
- package/dist/hooks/empty-message-sanitizer/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/empty-message-sanitizer/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/empty-message-sanitizer/__tests__/index.test.js +416 -0
- package/dist/hooks/empty-message-sanitizer/__tests__/index.test.js.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/keyword-detector/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/keyword-detector/__tests__/index.test.js +427 -0
- package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -0
- package/dist/hooks/mode-registry/index.d.ts +135 -0
- package/dist/hooks/mode-registry/index.d.ts.map +1 -0
- package/dist/hooks/mode-registry/index.js +445 -0
- package/dist/hooks/mode-registry/index.js.map +1 -0
- package/dist/hooks/mode-registry/types.d.ts +31 -0
- package/dist/hooks/mode-registry/types.d.ts.map +1 -0
- package/dist/hooks/mode-registry/types.js +7 -0
- package/dist/hooks/mode-registry/types.js.map +1 -0
- package/dist/hooks/ralph/loop.js +6 -6
- package/dist/hooks/ralph/loop.js.map +1 -1
- package/dist/hooks/swarm/__tests__/claiming.test.d.ts +2 -0
- package/dist/hooks/swarm/__tests__/claiming.test.d.ts.map +1 -0
- package/dist/hooks/swarm/__tests__/claiming.test.js +170 -0
- package/dist/hooks/swarm/__tests__/claiming.test.js.map +1 -0
- package/dist/hooks/swarm/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/swarm/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/swarm/__tests__/index.test.js +157 -0
- package/dist/hooks/swarm/__tests__/index.test.js.map +1 -0
- package/dist/hooks/swarm/__tests__/mode-registry.test.d.ts +2 -0
- package/dist/hooks/swarm/__tests__/mode-registry.test.d.ts.map +1 -0
- package/dist/hooks/swarm/__tests__/mode-registry.test.js +177 -0
- package/dist/hooks/swarm/__tests__/mode-registry.test.js.map +1 -0
- package/dist/hooks/swarm/claiming.d.ts +101 -0
- package/dist/hooks/swarm/claiming.d.ts.map +1 -0
- package/dist/hooks/swarm/claiming.js +460 -0
- package/dist/hooks/swarm/claiming.js.map +1 -0
- package/dist/hooks/swarm/index.d.ts +221 -0
- package/dist/hooks/swarm/index.d.ts.map +1 -0
- package/dist/hooks/swarm/index.js +413 -0
- package/dist/hooks/swarm/index.js.map +1 -0
- package/dist/hooks/swarm/state.d.ts +94 -0
- package/dist/hooks/swarm/state.d.ts.map +1 -0
- package/dist/hooks/swarm/state.js +530 -0
- package/dist/hooks/swarm/state.js.map +1 -0
- package/dist/hooks/swarm/types.d.ts +116 -0
- package/dist/hooks/swarm/types.d.ts.map +1 -0
- package/dist/hooks/swarm/types.js +22 -0
- package/dist/hooks/swarm/types.js.map +1 -0
- package/dist/hooks/think-mode/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/think-mode/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/think-mode/__tests__/index.test.js +556 -0
- package/dist/hooks/think-mode/__tests__/index.test.js.map +1 -0
- package/dist/hooks/ultrapilot/decomposer.d.ts +141 -0
- package/dist/hooks/ultrapilot/decomposer.d.ts.map +1 -0
- package/dist/hooks/ultrapilot/decomposer.js +377 -0
- package/dist/hooks/ultrapilot/decomposer.js.map +1 -0
- package/dist/hooks/ultrapilot/index.d.ts +31 -0
- package/dist/hooks/ultrapilot/index.d.ts.map +1 -1
- package/dist/hooks/ultrapilot/index.js +43 -2
- package/dist/hooks/ultrapilot/index.js.map +1 -1
- package/dist/hooks/ultrapilot/state.d.ts +1 -1
- package/dist/hooks/ultrapilot/state.d.ts.map +1 -1
- package/dist/hooks/ultrapilot/state.js +7 -0
- package/dist/hooks/ultrapilot/state.js.map +1 -1
- package/dist/hooks/ultraqa/index.js +5 -5
- package/dist/hooks/ultraqa/index.js.map +1 -1
- package/dist/hooks/ultrawork/index.js +3 -3
- package/dist/hooks/ultrawork/index.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +8 -0
- package/dist/installer/index.js.map +1 -1
- package/package.json +3 -1
- package/skills/autopilot/SKILL.md +18 -0
- package/skills/cancel/SKILL.md +166 -141
- package/skills/ecomode/SKILL.md +14 -0
- package/skills/omc-setup/SKILL.md +27 -3
- package/skills/pipeline/SKILL.md +13 -0
- package/skills/ralph/SKILL.md +22 -1
- package/skills/release/SKILL.md +1 -1
- package/skills/swarm/SKILL.md +521 -197
- package/skills/ultrapilot/SKILL.md +82 -13
- package/skills/ultraqa/SKILL.md +13 -0
- package/skills/ultrawork/SKILL.md +14 -0
- package/dist/__tests__/analytics/analytics-summary.test.d.ts +0 -2
- package/dist/__tests__/analytics/analytics-summary.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/analytics-summary.test.js +0 -267
- package/dist/__tests__/analytics/analytics-summary.test.js.map +0 -1
- package/dist/__tests__/analytics/cost-estimator.test.d.ts +0 -2
- package/dist/__tests__/analytics/cost-estimator.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/cost-estimator.test.js +0 -212
- package/dist/__tests__/analytics/cost-estimator.test.js.map +0 -1
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts +0 -7
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts.map +0 -1
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js +0 -374
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js.map +0 -1
- package/dist/__tests__/hud/auto-tracking.integration.test.d.ts +0 -2
- package/dist/__tests__/hud/auto-tracking.integration.test.d.ts.map +0 -1
- package/dist/__tests__/hud/auto-tracking.integration.test.js +0 -12
- package/dist/__tests__/hud/auto-tracking.integration.test.js.map +0 -1
- package/dist/__tests__/learned-skills/config.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/config.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/config.test.js +0 -37
- package/dist/__tests__/learned-skills/config.test.js.map +0 -1
- package/dist/__tests__/learned-skills/detector.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/detector.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/detector.test.js +0 -99
- package/dist/__tests__/learned-skills/detector.test.js.map +0 -1
- package/dist/__tests__/learned-skills/finder.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/finder.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/finder.test.js +0 -59
- package/dist/__tests__/learned-skills/finder.test.js.map +0 -1
- package/dist/__tests__/learned-skills/loader.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/loader.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/loader.test.js +0 -69
- package/dist/__tests__/learned-skills/loader.test.js.map +0 -1
- package/dist/__tests__/learned-skills/parser.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/parser.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/parser.test.js +0 -81
- package/dist/__tests__/learned-skills/parser.test.js.map +0 -1
- package/dist/__tests__/learned-skills/validator.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/validator.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/validator.test.js +0 -85
- package/dist/__tests__/learned-skills/validator.test.js.map +0 -1
- package/dist/agents/document-writer.d.ts +0 -11
- package/dist/agents/document-writer.d.ts.map +0 -1
- package/dist/agents/document-writer.js +0 -209
- package/dist/agents/document-writer.js.map +0 -1
- package/dist/agents/frontend-engineer.d.ts +0 -11
- package/dist/agents/frontend-engineer.d.ts.map +0 -1
- package/dist/agents/frontend-engineer.js +0 -115
- package/dist/agents/frontend-engineer.js.map +0 -1
- package/dist/agents/librarian.d.ts +0 -12
- package/dist/agents/librarian.d.ts.map +0 -1
- package/dist/agents/librarian.js +0 -103
- package/dist/agents/librarian.js.map +0 -1
- package/dist/agents/metis.d.ts +0 -12
- package/dist/agents/metis.d.ts.map +0 -1
- package/dist/agents/metis.js +0 -117
- package/dist/agents/metis.js.map +0 -1
- package/dist/agents/momus.d.ts +0 -12
- package/dist/agents/momus.d.ts.map +0 -1
- package/dist/agents/momus.js +0 -128
- package/dist/agents/momus.js.map +0 -1
- package/dist/agents/multimodal-looker.d.ts +0 -11
- package/dist/agents/multimodal-looker.d.ts.map +0 -1
- package/dist/agents/multimodal-looker.js +0 -70
- package/dist/agents/multimodal-looker.js.map +0 -1
- package/dist/agents/oracle.d.ts +0 -13
- package/dist/agents/oracle.d.ts.map +0 -1
- package/dist/agents/oracle.js +0 -191
- package/dist/agents/oracle.js.map +0 -1
- package/dist/agents/orchestrator-sisyphus.d.ts +0 -11
- package/dist/agents/orchestrator-sisyphus.d.ts.map +0 -1
- package/dist/agents/orchestrator-sisyphus.js +0 -115
- package/dist/agents/orchestrator-sisyphus.js.map +0 -1
- package/dist/agents/prometheus.d.ts +0 -12
- package/dist/agents/prometheus.d.ts.map +0 -1
- package/dist/agents/prometheus.js +0 -195
- package/dist/agents/prometheus.js.map +0 -1
- package/dist/agents/sisyphus-junior.d.ts +0 -12
- package/dist/agents/sisyphus-junior.d.ts.map +0 -1
- package/dist/agents/sisyphus-junior.js +0 -93
- package/dist/agents/sisyphus-junior.js.map +0 -1
- package/dist/cli/components/CostDashboard.d.ts +0 -15
- package/dist/cli/components/CostDashboard.d.ts.map +0 -1
- package/dist/cli/components/CostDashboard.js +0 -15
- package/dist/cli/components/CostDashboard.js.map +0 -1
- package/dist/cli/components/LiveStats.d.ts +0 -16
- package/dist/cli/components/LiveStats.d.ts.map +0 -1
- package/dist/cli/components/LiveStats.js +0 -16
- package/dist/cli/components/LiveStats.js.map +0 -1
- package/dist/cli/components/SessionBrowser.d.ts +0 -14
- package/dist/cli/components/SessionBrowser.d.ts.map +0 -1
- package/dist/cli/components/SessionBrowser.js +0 -14
- package/dist/cli/components/SessionBrowser.js.map +0 -1
- package/dist/cli/tui.d.ts +0 -21
- package/dist/cli/tui.d.ts.map +0 -1
- package/dist/cli/tui.js +0 -21
- package/dist/cli/tui.js.map +0 -1
- package/dist/hooks/autopilot/signals.d.ts +0 -20
- package/dist/hooks/autopilot/signals.d.ts.map +0 -1
- package/dist/hooks/autopilot/signals.js +0 -75
- package/dist/hooks/autopilot/signals.js.map +0 -1
- package/dist/hooks/autopilot/summary.d.ts +0 -27
- package/dist/hooks/autopilot/summary.d.ts.map +0 -1
- package/dist/hooks/autopilot/summary.js +0 -160
- package/dist/hooks/autopilot/summary.js.map +0 -1
- package/dist/hooks/autopilot/transition.d.ts +0 -39
- package/dist/hooks/autopilot/transition.d.ts.map +0 -1
- package/dist/hooks/autopilot/transition.js +0 -216
- package/dist/hooks/autopilot/transition.js.map +0 -1
- package/dist/hooks/context-window-limit-recovery/constants.d.ts +0 -28
- package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +0 -1
- package/dist/hooks/context-window-limit-recovery/constants.js +0 -85
- package/dist/hooks/context-window-limit-recovery/constants.js.map +0 -1
- package/dist/hooks/context-window-limit-recovery/index.d.ts +0 -62
- package/dist/hooks/context-window-limit-recovery/index.d.ts.map +0 -1
- package/dist/hooks/context-window-limit-recovery/index.js +0 -201
- package/dist/hooks/context-window-limit-recovery/index.js.map +0 -1
- package/dist/hooks/context-window-limit-recovery/parser.d.ts +0 -31
- package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +0 -1
- package/dist/hooks/context-window-limit-recovery/parser.js +0 -241
- package/dist/hooks/context-window-limit-recovery/parser.js.map +0 -1
- package/dist/hooks/context-window-limit-recovery/types.d.ts +0 -84
- package/dist/hooks/context-window-limit-recovery/types.d.ts.map +0 -1
- package/dist/hooks/context-window-limit-recovery/types.js +0 -34
- package/dist/hooks/context-window-limit-recovery/types.js.map +0 -1
- package/dist/hooks/edit-error-recovery/index.d.ts +0 -62
- package/dist/hooks/edit-error-recovery/index.d.ts.map +0 -1
- package/dist/hooks/edit-error-recovery/index.js +0 -89
- package/dist/hooks/edit-error-recovery/index.js.map +0 -1
- package/dist/hooks/learned-skills/config.d.ts +0 -53
- package/dist/hooks/learned-skills/config.d.ts.map +0 -1
- package/dist/hooks/learned-skills/config.js +0 -103
- package/dist/hooks/learned-skills/config.js.map +0 -1
- package/dist/hooks/learned-skills/constants.d.ts +0 -24
- package/dist/hooks/learned-skills/constants.d.ts.map +0 -1
- package/dist/hooks/learned-skills/constants.js +0 -26
- package/dist/hooks/learned-skills/constants.js.map +0 -1
- package/dist/hooks/learned-skills/detection-hook.d.ts +0 -39
- package/dist/hooks/learned-skills/detection-hook.d.ts.map +0 -1
- package/dist/hooks/learned-skills/detection-hook.js +0 -83
- package/dist/hooks/learned-skills/detection-hook.js.map +0 -1
- package/dist/hooks/learned-skills/detector.d.ts +0 -30
- package/dist/hooks/learned-skills/detector.d.ts.map +0 -1
- package/dist/hooks/learned-skills/detector.js +0 -150
- package/dist/hooks/learned-skills/detector.js.map +0 -1
- package/dist/hooks/learned-skills/finder.d.ts +0 -21
- package/dist/hooks/learned-skills/finder.d.ts.map +0 -1
- package/dist/hooks/learned-skills/finder.js +0 -117
- package/dist/hooks/learned-skills/finder.js.map +0 -1
- package/dist/hooks/learned-skills/index.d.ts +0 -62
- package/dist/hooks/learned-skills/index.d.ts.map +0 -1
- package/dist/hooks/learned-skills/index.js +0 -137
- package/dist/hooks/learned-skills/index.js.map +0 -1
- package/dist/hooks/learned-skills/loader.d.ts +0 -20
- package/dist/hooks/learned-skills/loader.d.ts.map +0 -1
- package/dist/hooks/learned-skills/loader.js +0 -107
- package/dist/hooks/learned-skills/loader.js.map +0 -1
- package/dist/hooks/learned-skills/parser.d.ts +0 -21
- package/dist/hooks/learned-skills/parser.d.ts.map +0 -1
- package/dist/hooks/learned-skills/parser.js +0 -190
- package/dist/hooks/learned-skills/parser.js.map +0 -1
- package/dist/hooks/learned-skills/promotion.d.ts +0 -29
- package/dist/hooks/learned-skills/promotion.d.ts.map +0 -1
- package/dist/hooks/learned-skills/promotion.js +0 -87
- package/dist/hooks/learned-skills/promotion.js.map +0 -1
- package/dist/hooks/learned-skills/types.d.ts +0 -109
- package/dist/hooks/learned-skills/types.d.ts.map +0 -1
- package/dist/hooks/learned-skills/types.js +0 -8
- package/dist/hooks/learned-skills/types.js.map +0 -1
- package/dist/hooks/learned-skills/validator.d.ts +0 -15
- package/dist/hooks/learned-skills/validator.d.ts.map +0 -1
- package/dist/hooks/learned-skills/validator.js +0 -87
- package/dist/hooks/learned-skills/validator.js.map +0 -1
- package/dist/hooks/learned-skills/writer.d.ts +0 -27
- package/dist/hooks/learned-skills/writer.d.ts.map +0 -1
- package/dist/hooks/learned-skills/writer.js +0 -126
- package/dist/hooks/learned-skills/writer.js.map +0 -1
- package/dist/hooks/mnemosyne/config.d.ts +0 -53
- package/dist/hooks/mnemosyne/config.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/config.js +0 -103
- package/dist/hooks/mnemosyne/config.js.map +0 -1
- package/dist/hooks/mnemosyne/constants.d.ts +0 -24
- package/dist/hooks/mnemosyne/constants.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/constants.js +0 -26
- package/dist/hooks/mnemosyne/constants.js.map +0 -1
- package/dist/hooks/mnemosyne/detection-hook.d.ts +0 -39
- package/dist/hooks/mnemosyne/detection-hook.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/detection-hook.js +0 -83
- package/dist/hooks/mnemosyne/detection-hook.js.map +0 -1
- package/dist/hooks/mnemosyne/detector.d.ts +0 -30
- package/dist/hooks/mnemosyne/detector.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/detector.js +0 -150
- package/dist/hooks/mnemosyne/detector.js.map +0 -1
- package/dist/hooks/mnemosyne/finder.d.ts +0 -21
- package/dist/hooks/mnemosyne/finder.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/finder.js +0 -117
- package/dist/hooks/mnemosyne/finder.js.map +0 -1
- package/dist/hooks/mnemosyne/index.d.ts +0 -62
- package/dist/hooks/mnemosyne/index.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/index.js +0 -137
- package/dist/hooks/mnemosyne/index.js.map +0 -1
- package/dist/hooks/mnemosyne/loader.d.ts +0 -20
- package/dist/hooks/mnemosyne/loader.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/loader.js +0 -113
- package/dist/hooks/mnemosyne/loader.js.map +0 -1
- package/dist/hooks/mnemosyne/parser.d.ts +0 -21
- package/dist/hooks/mnemosyne/parser.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/parser.js +0 -190
- package/dist/hooks/mnemosyne/parser.js.map +0 -1
- package/dist/hooks/mnemosyne/promotion.d.ts +0 -29
- package/dist/hooks/mnemosyne/promotion.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/promotion.js +0 -87
- package/dist/hooks/mnemosyne/promotion.js.map +0 -1
- package/dist/hooks/mnemosyne/types.d.ts +0 -109
- package/dist/hooks/mnemosyne/types.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/types.js +0 -8
- package/dist/hooks/mnemosyne/types.js.map +0 -1
- package/dist/hooks/mnemosyne/validator.d.ts +0 -15
- package/dist/hooks/mnemosyne/validator.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/validator.js +0 -87
- package/dist/hooks/mnemosyne/validator.js.map +0 -1
- package/dist/hooks/mnemosyne/writer.d.ts +0 -27
- package/dist/hooks/mnemosyne/writer.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/writer.js +0 -126
- package/dist/hooks/mnemosyne/writer.js.map +0 -1
- package/dist/hooks/ralph-loop/index.d.ts +0 -116
- package/dist/hooks/ralph-loop/index.d.ts.map +0 -1
- package/dist/hooks/ralph-loop/index.js +0 -322
- package/dist/hooks/ralph-loop/index.js.map +0 -1
- package/dist/hooks/ralph-prd/index.d.ts +0 -130
- package/dist/hooks/ralph-prd/index.d.ts.map +0 -1
- package/dist/hooks/ralph-prd/index.js +0 -310
- package/dist/hooks/ralph-prd/index.js.map +0 -1
- package/dist/hooks/ralph-progress/index.d.ts +0 -102
- package/dist/hooks/ralph-progress/index.d.ts.map +0 -1
- package/dist/hooks/ralph-progress/index.js +0 -408
- package/dist/hooks/ralph-progress/index.js.map +0 -1
- package/dist/hooks/ralph-verifier/index.d.ts +0 -72
- package/dist/hooks/ralph-verifier/index.d.ts.map +0 -1
- package/dist/hooks/ralph-verifier/index.js +0 -223
- package/dist/hooks/ralph-verifier/index.js.map +0 -1
- package/dist/hooks/session-recovery/constants.d.ts +0 -56
- package/dist/hooks/session-recovery/constants.d.ts.map +0 -1
- package/dist/hooks/session-recovery/constants.js +0 -78
- package/dist/hooks/session-recovery/constants.js.map +0 -1
- package/dist/hooks/session-recovery/index.d.ts +0 -53
- package/dist/hooks/session-recovery/index.d.ts.map +0 -1
- package/dist/hooks/session-recovery/index.js +0 -321
- package/dist/hooks/session-recovery/index.js.map +0 -1
- package/dist/hooks/session-recovery/storage.d.ts +0 -76
- package/dist/hooks/session-recovery/storage.d.ts.map +0 -1
- package/dist/hooks/session-recovery/storage.js +0 -383
- package/dist/hooks/session-recovery/storage.js.map +0 -1
- package/dist/hooks/session-recovery/types.d.ts +0 -145
- package/dist/hooks/session-recovery/types.d.ts.map +0 -1
- package/dist/hooks/session-recovery/types.js +0 -8
- package/dist/hooks/session-recovery/types.js.map +0 -1
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts +0 -23
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +0 -1
- package/dist/hooks/sisyphus-orchestrator/constants.js +0 -142
- package/dist/hooks/sisyphus-orchestrator/constants.js.map +0 -1
- package/dist/hooks/sisyphus-orchestrator/index.d.ts +0 -113
- package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +0 -1
- package/dist/hooks/sisyphus-orchestrator/index.js +0 -309
- package/dist/hooks/sisyphus-orchestrator/index.js.map +0 -1
- package/dist/hooks/ultraqa-loop/index.d.ts +0 -94
- package/dist/hooks/ultraqa-loop/index.d.ts.map +0 -1
- package/dist/hooks/ultraqa-loop/index.js +0 -216
- package/dist/hooks/ultraqa-loop/index.js.map +0 -1
- package/dist/hooks/ultrawork-state/index.d.ts +0 -62
- package/dist/hooks/ultrawork-state/index.d.ts.map +0 -1
- package/dist/hooks/ultrawork-state/index.js +0 -208
- package/dist/hooks/ultrawork-state/index.js.map +0 -1
- package/dist/hud/sisyphus-state.d.ts +0 -31
- package/dist/hud/sisyphus-state.d.ts.map +0 -1
- package/dist/hud/sisyphus-state.js +0 -163
- package/dist/hud/sisyphus-state.js.map +0 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI-Powered Task Decomposition for Ultrapilot
|
|
3
|
+
*
|
|
4
|
+
* This module provides intelligent task decomposition using an Architect agent
|
|
5
|
+
* to analyze tasks and break them into parallel-safe subtasks with proper
|
|
6
|
+
* file ownership and dependency tracking.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Agent type for task execution, determines model complexity
|
|
10
|
+
*/
|
|
11
|
+
export type AgentType = 'executor-low' | 'executor' | 'executor-high';
|
|
12
|
+
/**
|
|
13
|
+
* Model tier for agent execution
|
|
14
|
+
*/
|
|
15
|
+
export type ModelTier = 'haiku' | 'sonnet' | 'opus';
|
|
16
|
+
/**
|
|
17
|
+
* A decomposed subtask with file ownership and dependencies
|
|
18
|
+
*/
|
|
19
|
+
export interface DecomposedTask {
|
|
20
|
+
/** Unique identifier for this subtask */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Clear description of what to implement */
|
|
23
|
+
description: string;
|
|
24
|
+
/** Files this task will touch (can include globs) */
|
|
25
|
+
files: string[];
|
|
26
|
+
/** Task IDs this subtask depends on (must complete first) */
|
|
27
|
+
blockedBy: string[];
|
|
28
|
+
/** Agent type based on task complexity */
|
|
29
|
+
agentType: AgentType;
|
|
30
|
+
/** Model tier for execution */
|
|
31
|
+
model: ModelTier;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Result of task decomposition
|
|
35
|
+
*/
|
|
36
|
+
export interface DecompositionResult {
|
|
37
|
+
/** Array of parallelizable subtasks */
|
|
38
|
+
subtasks: DecomposedTask[];
|
|
39
|
+
/** Files that need sequential handling (config, lock files) */
|
|
40
|
+
sharedFiles: string[];
|
|
41
|
+
/** Groups of task IDs that can run in parallel (dependency-ordered) */
|
|
42
|
+
parallelGroups: string[][];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for decomposition prompt generation
|
|
46
|
+
*/
|
|
47
|
+
export interface DecompositionOptions {
|
|
48
|
+
/** Maximum number of subtasks to generate */
|
|
49
|
+
maxSubtasks?: number;
|
|
50
|
+
/** Preferred model tier for workers */
|
|
51
|
+
preferredModel?: ModelTier;
|
|
52
|
+
/** Additional context about project structure */
|
|
53
|
+
projectContext?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Default shared file patterns that should be handled by coordinator
|
|
57
|
+
*/
|
|
58
|
+
export declare const DEFAULT_SHARED_FILE_PATTERNS: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Generate a prompt for the Architect agent to decompose a task
|
|
61
|
+
*
|
|
62
|
+
* This prompt instructs the Architect to analyze the task and codebase context,
|
|
63
|
+
* then produce a structured JSON decomposition with file ownership and dependencies.
|
|
64
|
+
*
|
|
65
|
+
* @param task - The task description to decompose
|
|
66
|
+
* @param codebaseContext - Context about the codebase structure, files, and patterns
|
|
67
|
+
* @param options - Optional configuration for decomposition
|
|
68
|
+
* @returns Formatted prompt string for the Architect agent
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const prompt = generateDecompositionPrompt(
|
|
73
|
+
* "Build a full-stack todo app with React and Express",
|
|
74
|
+
* "Project has src/client and src/server directories..."
|
|
75
|
+
* );
|
|
76
|
+
* // Use with Architect agent via Task tool
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function generateDecompositionPrompt(task: string, codebaseContext: string, options?: DecompositionOptions): string;
|
|
80
|
+
/**
|
|
81
|
+
* Parse the Architect's response into a structured DecompositionResult
|
|
82
|
+
*
|
|
83
|
+
* Handles various response formats including:
|
|
84
|
+
* - Raw JSON
|
|
85
|
+
* - JSON wrapped in markdown code fences
|
|
86
|
+
* - JSON with surrounding explanation text
|
|
87
|
+
*
|
|
88
|
+
* @param response - Raw response string from the Architect agent
|
|
89
|
+
* @returns Parsed and validated DecompositionResult
|
|
90
|
+
* @throws Error if response cannot be parsed or is invalid
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const result = parseDecompositionResult(architectResponse);
|
|
95
|
+
* console.log(result.subtasks.length); // Number of parallel tasks
|
|
96
|
+
* console.log(result.parallelGroups); // Execution order
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare function parseDecompositionResult(response: string): DecompositionResult;
|
|
100
|
+
/**
|
|
101
|
+
* Generate parallel groups from subtask dependencies
|
|
102
|
+
*
|
|
103
|
+
* Creates an ordered array of task ID groups where each group can run
|
|
104
|
+
* in parallel, and later groups depend on earlier ones completing.
|
|
105
|
+
*
|
|
106
|
+
* @param subtasks - Array of decomposed subtasks with blockedBy fields
|
|
107
|
+
* @returns Array of parallel groups (each group is array of task IDs)
|
|
108
|
+
*/
|
|
109
|
+
export declare function generateParallelGroups(subtasks: DecomposedTask[]): string[][];
|
|
110
|
+
/**
|
|
111
|
+
* Validate that file ownership doesn't overlap between subtasks
|
|
112
|
+
*
|
|
113
|
+
* @param subtasks - Array of decomposed subtasks
|
|
114
|
+
* @returns Object with isValid flag and any conflicts found
|
|
115
|
+
*/
|
|
116
|
+
export declare function validateFileOwnership(subtasks: DecomposedTask[]): {
|
|
117
|
+
isValid: boolean;
|
|
118
|
+
conflicts: Array<{
|
|
119
|
+
file: string;
|
|
120
|
+
owners: string[];
|
|
121
|
+
}>;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Merge shared files from subtasks into the sharedFiles list
|
|
125
|
+
*
|
|
126
|
+
* Identifies files that match shared file patterns and removes them
|
|
127
|
+
* from subtask ownership, adding them to sharedFiles instead.
|
|
128
|
+
*
|
|
129
|
+
* @param result - DecompositionResult to process
|
|
130
|
+
* @param patterns - Array of glob patterns for shared files
|
|
131
|
+
* @returns Updated DecompositionResult with shared files extracted
|
|
132
|
+
*/
|
|
133
|
+
export declare function extractSharedFiles(result: DecompositionResult, patterns?: string[]): DecompositionResult;
|
|
134
|
+
/**
|
|
135
|
+
* Convert DecompositionResult to simple string array for legacy compatibility
|
|
136
|
+
*
|
|
137
|
+
* @param result - Full decomposition result
|
|
138
|
+
* @returns Array of task description strings
|
|
139
|
+
*/
|
|
140
|
+
export declare function toSimpleSubtasks(result: DecompositionResult): string[];
|
|
141
|
+
//# sourceMappingURL=decomposer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decomposer.d.ts","sourceRoot":"","sources":["../../../src/hooks/ultrapilot/decomposer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,UAAU,GAAG,eAAe,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6DAA6D;IAC7D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,0CAA0C;IAC1C,SAAS,EAAE,SAAS,CAAC;IACrB,+BAA+B;IAC/B,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,+DAA+D;IAC/D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,uEAAuE;IACvE,cAAc,EAAE,MAAM,EAAE,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,UA0BxC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,EACvB,OAAO,GAAE,oBAAyB,GACjC,MAAM,CA8GR;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAmF9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,EAAE,CAmC7E;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CACtD,CAuBA;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,GAAE,MAAM,EAAiC,GAChD,mBAAmB,CAoCrB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAEtE"}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI-Powered Task Decomposition for Ultrapilot
|
|
3
|
+
*
|
|
4
|
+
* This module provides intelligent task decomposition using an Architect agent
|
|
5
|
+
* to analyze tasks and break them into parallel-safe subtasks with proper
|
|
6
|
+
* file ownership and dependency tracking.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Default shared file patterns that should be handled by coordinator
|
|
10
|
+
*/
|
|
11
|
+
export const DEFAULT_SHARED_FILE_PATTERNS = [
|
|
12
|
+
'package.json',
|
|
13
|
+
'package-lock.json',
|
|
14
|
+
'yarn.lock',
|
|
15
|
+
'pnpm-lock.yaml',
|
|
16
|
+
'tsconfig.json',
|
|
17
|
+
'tsconfig.*.json',
|
|
18
|
+
'jest.config.js',
|
|
19
|
+
'jest.config.ts',
|
|
20
|
+
'vitest.config.ts',
|
|
21
|
+
'.eslintrc.*',
|
|
22
|
+
'.prettierrc.*',
|
|
23
|
+
'.gitignore',
|
|
24
|
+
'README.md',
|
|
25
|
+
'Makefile',
|
|
26
|
+
'go.mod',
|
|
27
|
+
'go.sum',
|
|
28
|
+
'Cargo.toml',
|
|
29
|
+
'Cargo.lock',
|
|
30
|
+
'pyproject.toml',
|
|
31
|
+
'requirements.txt',
|
|
32
|
+
'setup.py',
|
|
33
|
+
'Dockerfile',
|
|
34
|
+
'docker-compose.yml',
|
|
35
|
+
'.github/**',
|
|
36
|
+
'.gitlab-ci.yml'
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Generate a prompt for the Architect agent to decompose a task
|
|
40
|
+
*
|
|
41
|
+
* This prompt instructs the Architect to analyze the task and codebase context,
|
|
42
|
+
* then produce a structured JSON decomposition with file ownership and dependencies.
|
|
43
|
+
*
|
|
44
|
+
* @param task - The task description to decompose
|
|
45
|
+
* @param codebaseContext - Context about the codebase structure, files, and patterns
|
|
46
|
+
* @param options - Optional configuration for decomposition
|
|
47
|
+
* @returns Formatted prompt string for the Architect agent
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const prompt = generateDecompositionPrompt(
|
|
52
|
+
* "Build a full-stack todo app with React and Express",
|
|
53
|
+
* "Project has src/client and src/server directories..."
|
|
54
|
+
* );
|
|
55
|
+
* // Use with Architect agent via Task tool
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export function generateDecompositionPrompt(task, codebaseContext, options = {}) {
|
|
59
|
+
const { maxSubtasks = 5, preferredModel = 'sonnet', projectContext = '' } = options;
|
|
60
|
+
const additionalContext = projectContext ? `\nPROJECT NOTES:\n${projectContext}\n` : '';
|
|
61
|
+
return `Analyze this task and decompose it into parallel-safe subtasks for concurrent execution.
|
|
62
|
+
|
|
63
|
+
TASK: ${task}
|
|
64
|
+
|
|
65
|
+
CODEBASE CONTEXT:
|
|
66
|
+
${codebaseContext}
|
|
67
|
+
${additionalContext}
|
|
68
|
+
OUTPUT REQUIREMENTS:
|
|
69
|
+
Return a valid JSON object matching this exact schema:
|
|
70
|
+
|
|
71
|
+
{
|
|
72
|
+
"subtasks": [
|
|
73
|
+
{
|
|
74
|
+
"id": "1",
|
|
75
|
+
"description": "Clear, actionable description of what to implement",
|
|
76
|
+
"files": ["src/path/to/file.ts", "src/path/to/other.ts"],
|
|
77
|
+
"blockedBy": [],
|
|
78
|
+
"agentType": "executor",
|
|
79
|
+
"model": "sonnet"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"sharedFiles": ["package.json", "tsconfig.json"],
|
|
83
|
+
"parallelGroups": [["1", "2"], ["3"]]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
DECOMPOSITION RULES:
|
|
87
|
+
|
|
88
|
+
1. FILE OWNERSHIP:
|
|
89
|
+
- Each subtask should have exclusive ownership of its files
|
|
90
|
+
- NO file should appear in multiple subtasks' files arrays
|
|
91
|
+
- Use specific file paths, not directories (unless truly needed)
|
|
92
|
+
- Mark config/lock files as sharedFiles (handled by coordinator)
|
|
93
|
+
|
|
94
|
+
2. DEPENDENCIES (blockedBy):
|
|
95
|
+
- Only add blockedBy if subtask TRULY requires another to complete first
|
|
96
|
+
- Prefer parallel execution - maximize independent subtasks
|
|
97
|
+
- Common dependencies: type definitions, shared utilities, API contracts
|
|
98
|
+
|
|
99
|
+
3. PARALLEL GROUPS:
|
|
100
|
+
- Group subtasks that can run simultaneously
|
|
101
|
+
- First group has no dependencies
|
|
102
|
+
- Later groups depend on earlier ones completing
|
|
103
|
+
- Example: [["1", "2", "3"], ["4", "5"]] means 1,2,3 run first, then 4,5
|
|
104
|
+
|
|
105
|
+
4. AGENT/MODEL SELECTION:
|
|
106
|
+
- executor-low/haiku: Simple changes, single file, straightforward logic
|
|
107
|
+
- executor/sonnet: Standard implementation, moderate complexity (DEFAULT)
|
|
108
|
+
- executor-high/opus: Complex refactoring, architectural changes, multi-file coordination
|
|
109
|
+
|
|
110
|
+
5. SUBTASK GUIDELINES:
|
|
111
|
+
- Maximum ${maxSubtasks} subtasks
|
|
112
|
+
- Preferred model tier: ${preferredModel}
|
|
113
|
+
- Each subtask should be completable in 2-10 minutes
|
|
114
|
+
- Subtask description should be actionable and specific
|
|
115
|
+
- Include all files the subtask will CREATE or MODIFY
|
|
116
|
+
|
|
117
|
+
6. SHARED FILES (coordinator handles):
|
|
118
|
+
- package.json, lock files
|
|
119
|
+
- tsconfig.json, config files
|
|
120
|
+
- Root README.md
|
|
121
|
+
- Docker/CI configuration
|
|
122
|
+
- Any file multiple subtasks would need to modify
|
|
123
|
+
|
|
124
|
+
EXAMPLE OUTPUT:
|
|
125
|
+
|
|
126
|
+
{
|
|
127
|
+
"subtasks": [
|
|
128
|
+
{
|
|
129
|
+
"id": "1",
|
|
130
|
+
"description": "Create Express API routes for todo CRUD operations",
|
|
131
|
+
"files": ["src/server/routes/todos.ts", "src/server/controllers/todoController.ts"],
|
|
132
|
+
"blockedBy": [],
|
|
133
|
+
"agentType": "executor",
|
|
134
|
+
"model": "sonnet"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"id": "2",
|
|
138
|
+
"description": "Create React components for todo list UI",
|
|
139
|
+
"files": ["src/client/components/TodoList.tsx", "src/client/components/TodoItem.tsx"],
|
|
140
|
+
"blockedBy": [],
|
|
141
|
+
"agentType": "executor",
|
|
142
|
+
"model": "sonnet"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "3",
|
|
146
|
+
"description": "Create database schema and migrations for todos",
|
|
147
|
+
"files": ["src/db/migrations/001_create_todos.ts", "src/db/models/Todo.ts"],
|
|
148
|
+
"blockedBy": [],
|
|
149
|
+
"agentType": "executor-low",
|
|
150
|
+
"model": "haiku"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": "4",
|
|
154
|
+
"description": "Wire up API client in frontend to connect to backend",
|
|
155
|
+
"files": ["src/client/api/todoApi.ts", "src/client/hooks/useTodos.ts"],
|
|
156
|
+
"blockedBy": ["1", "2"],
|
|
157
|
+
"agentType": "executor",
|
|
158
|
+
"model": "sonnet"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"sharedFiles": ["package.json", "tsconfig.json", "src/types/todo.ts"],
|
|
162
|
+
"parallelGroups": [["1", "2", "3"], ["4"]]
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
Return ONLY the JSON object, no markdown code fences or additional text.`;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Parse the Architect's response into a structured DecompositionResult
|
|
169
|
+
*
|
|
170
|
+
* Handles various response formats including:
|
|
171
|
+
* - Raw JSON
|
|
172
|
+
* - JSON wrapped in markdown code fences
|
|
173
|
+
* - JSON with surrounding explanation text
|
|
174
|
+
*
|
|
175
|
+
* @param response - Raw response string from the Architect agent
|
|
176
|
+
* @returns Parsed and validated DecompositionResult
|
|
177
|
+
* @throws Error if response cannot be parsed or is invalid
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* const result = parseDecompositionResult(architectResponse);
|
|
182
|
+
* console.log(result.subtasks.length); // Number of parallel tasks
|
|
183
|
+
* console.log(result.parallelGroups); // Execution order
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
export function parseDecompositionResult(response) {
|
|
187
|
+
// Try to extract JSON from response (may be wrapped in markdown or have surrounding text)
|
|
188
|
+
let jsonStr;
|
|
189
|
+
// First, try to find JSON in markdown code fences
|
|
190
|
+
const fencedMatch = response.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
191
|
+
if (fencedMatch && fencedMatch[1]) {
|
|
192
|
+
jsonStr = fencedMatch[1].trim();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
// Try to find raw JSON object
|
|
196
|
+
const jsonMatch = response.match(/\{[\s\S]*\}/);
|
|
197
|
+
if (!jsonMatch) {
|
|
198
|
+
throw new Error('Could not parse decomposition result: no JSON object found in response');
|
|
199
|
+
}
|
|
200
|
+
jsonStr = jsonMatch[0];
|
|
201
|
+
}
|
|
202
|
+
let parsed;
|
|
203
|
+
try {
|
|
204
|
+
parsed = JSON.parse(jsonStr);
|
|
205
|
+
}
|
|
206
|
+
catch (e) {
|
|
207
|
+
throw new Error(`Could not parse decomposition result: invalid JSON - ${e instanceof Error ? e.message : 'unknown error'}`);
|
|
208
|
+
}
|
|
209
|
+
// Validate structure
|
|
210
|
+
if (!parsed || typeof parsed !== 'object') {
|
|
211
|
+
throw new Error('Could not parse decomposition result: response is not an object');
|
|
212
|
+
}
|
|
213
|
+
const result = parsed;
|
|
214
|
+
// Validate required fields
|
|
215
|
+
if (!Array.isArray(result.subtasks)) {
|
|
216
|
+
throw new Error('Could not parse decomposition result: missing or invalid subtasks array');
|
|
217
|
+
}
|
|
218
|
+
// Validate each subtask
|
|
219
|
+
for (const subtask of result.subtasks) {
|
|
220
|
+
if (!subtask || typeof subtask !== 'object') {
|
|
221
|
+
throw new Error('Could not parse decomposition result: invalid subtask object');
|
|
222
|
+
}
|
|
223
|
+
const st = subtask;
|
|
224
|
+
if (typeof st.id !== 'string' || !st.id) {
|
|
225
|
+
throw new Error('Could not parse decomposition result: subtask missing id');
|
|
226
|
+
}
|
|
227
|
+
if (typeof st.description !== 'string' || !st.description) {
|
|
228
|
+
throw new Error('Could not parse decomposition result: subtask missing description');
|
|
229
|
+
}
|
|
230
|
+
if (!Array.isArray(st.files)) {
|
|
231
|
+
throw new Error(`Could not parse decomposition result: subtask ${st.id} missing files array`);
|
|
232
|
+
}
|
|
233
|
+
if (!Array.isArray(st.blockedBy)) {
|
|
234
|
+
// Default to empty array if not provided
|
|
235
|
+
st.blockedBy = [];
|
|
236
|
+
}
|
|
237
|
+
// Validate and default agentType
|
|
238
|
+
const validAgentTypes = ['executor-low', 'executor', 'executor-high'];
|
|
239
|
+
if (!st.agentType || !validAgentTypes.includes(st.agentType)) {
|
|
240
|
+
st.agentType = 'executor';
|
|
241
|
+
}
|
|
242
|
+
// Validate and default model
|
|
243
|
+
const validModels = ['haiku', 'sonnet', 'opus'];
|
|
244
|
+
if (!st.model || !validModels.includes(st.model)) {
|
|
245
|
+
st.model = 'sonnet';
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
// Validate/default sharedFiles
|
|
249
|
+
if (!Array.isArray(result.sharedFiles)) {
|
|
250
|
+
result.sharedFiles = [];
|
|
251
|
+
}
|
|
252
|
+
// Validate/default parallelGroups
|
|
253
|
+
if (!Array.isArray(result.parallelGroups)) {
|
|
254
|
+
// Generate default parallel groups based on blockedBy
|
|
255
|
+
result.parallelGroups = generateParallelGroups(result.subtasks);
|
|
256
|
+
}
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Generate parallel groups from subtask dependencies
|
|
261
|
+
*
|
|
262
|
+
* Creates an ordered array of task ID groups where each group can run
|
|
263
|
+
* in parallel, and later groups depend on earlier ones completing.
|
|
264
|
+
*
|
|
265
|
+
* @param subtasks - Array of decomposed subtasks with blockedBy fields
|
|
266
|
+
* @returns Array of parallel groups (each group is array of task IDs)
|
|
267
|
+
*/
|
|
268
|
+
export function generateParallelGroups(subtasks) {
|
|
269
|
+
const groups = [];
|
|
270
|
+
const completed = new Set();
|
|
271
|
+
const remaining = new Set(subtasks.map((t) => t.id));
|
|
272
|
+
while (remaining.size > 0) {
|
|
273
|
+
const currentGroup = [];
|
|
274
|
+
for (const subtask of subtasks) {
|
|
275
|
+
if (!remaining.has(subtask.id))
|
|
276
|
+
continue;
|
|
277
|
+
// Check if all dependencies are completed
|
|
278
|
+
const depsCompleted = subtask.blockedBy.every((dep) => completed.has(dep));
|
|
279
|
+
if (depsCompleted) {
|
|
280
|
+
currentGroup.push(subtask.id);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (currentGroup.length === 0) {
|
|
284
|
+
// Circular dependency detected - add remaining tasks to break cycle
|
|
285
|
+
const remainingIds = Array.from(remaining);
|
|
286
|
+
groups.push(remainingIds);
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
// Mark current group as completed
|
|
290
|
+
for (const id of currentGroup) {
|
|
291
|
+
completed.add(id);
|
|
292
|
+
remaining.delete(id);
|
|
293
|
+
}
|
|
294
|
+
groups.push(currentGroup);
|
|
295
|
+
}
|
|
296
|
+
return groups;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Validate that file ownership doesn't overlap between subtasks
|
|
300
|
+
*
|
|
301
|
+
* @param subtasks - Array of decomposed subtasks
|
|
302
|
+
* @returns Object with isValid flag and any conflicts found
|
|
303
|
+
*/
|
|
304
|
+
export function validateFileOwnership(subtasks) {
|
|
305
|
+
const fileToOwners = new Map();
|
|
306
|
+
for (const subtask of subtasks) {
|
|
307
|
+
for (const file of subtask.files) {
|
|
308
|
+
if (!fileToOwners.has(file)) {
|
|
309
|
+
fileToOwners.set(file, []);
|
|
310
|
+
}
|
|
311
|
+
fileToOwners.get(file).push(subtask.id);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const conflicts = [];
|
|
315
|
+
for (const [file, owners] of fileToOwners.entries()) {
|
|
316
|
+
if (owners.length > 1) {
|
|
317
|
+
conflicts.push({ file, owners });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
isValid: conflicts.length === 0,
|
|
322
|
+
conflicts
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Merge shared files from subtasks into the sharedFiles list
|
|
327
|
+
*
|
|
328
|
+
* Identifies files that match shared file patterns and removes them
|
|
329
|
+
* from subtask ownership, adding them to sharedFiles instead.
|
|
330
|
+
*
|
|
331
|
+
* @param result - DecompositionResult to process
|
|
332
|
+
* @param patterns - Array of glob patterns for shared files
|
|
333
|
+
* @returns Updated DecompositionResult with shared files extracted
|
|
334
|
+
*/
|
|
335
|
+
export function extractSharedFiles(result, patterns = DEFAULT_SHARED_FILE_PATTERNS) {
|
|
336
|
+
const sharedSet = new Set(result.sharedFiles);
|
|
337
|
+
// Simple pattern matching (exact match or basic glob)
|
|
338
|
+
const isSharedFile = (file) => {
|
|
339
|
+
const fileName = file.split('/').pop() || file;
|
|
340
|
+
return patterns.some((pattern) => {
|
|
341
|
+
if (pattern.includes('*')) {
|
|
342
|
+
// Basic glob: convert to regex
|
|
343
|
+
const regex = new RegExp('^' + pattern.replace(/\./g, '\\.').replace(/\*/g, '.*') + '$');
|
|
344
|
+
return regex.test(file) || regex.test(fileName);
|
|
345
|
+
}
|
|
346
|
+
return file === pattern || fileName === pattern;
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
// Process each subtask
|
|
350
|
+
const updatedSubtasks = result.subtasks.map((subtask) => {
|
|
351
|
+
const ownedFiles = [];
|
|
352
|
+
for (const file of subtask.files) {
|
|
353
|
+
if (isSharedFile(file)) {
|
|
354
|
+
sharedSet.add(file);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
ownedFiles.push(file);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return { ...subtask, files: ownedFiles };
|
|
361
|
+
});
|
|
362
|
+
return {
|
|
363
|
+
subtasks: updatedSubtasks,
|
|
364
|
+
sharedFiles: Array.from(sharedSet),
|
|
365
|
+
parallelGroups: result.parallelGroups
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Convert DecompositionResult to simple string array for legacy compatibility
|
|
370
|
+
*
|
|
371
|
+
* @param result - Full decomposition result
|
|
372
|
+
* @returns Array of task description strings
|
|
373
|
+
*/
|
|
374
|
+
export function toSimpleSubtasks(result) {
|
|
375
|
+
return result.subtasks.map((t) => t.description);
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=decomposer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decomposer.js","sourceRoot":"","sources":["../../../src/hooks/ultrapilot/decomposer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsDH;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,cAAc;IACd,mBAAmB;IACnB,WAAW;IACX,gBAAgB;IAChB,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,aAAa;IACb,eAAe;IACf,YAAY;IACZ,WAAW;IACX,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,kBAAkB;IAClB,UAAU;IACV,YAAY;IACZ,oBAAoB;IACpB,YAAY;IACZ,gBAAgB;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,2BAA2B,CACzC,IAAY,EACZ,eAAuB,EACvB,UAAgC,EAAE;IAElC,MAAM,EAAE,WAAW,GAAG,CAAC,EAAE,cAAc,GAAG,QAAQ,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAEpF,MAAM,iBAAiB,GAAG,cAAc,CAAC,CAAC,CAAC,qBAAqB,cAAc,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAExF,OAAO;;QAED,IAAI;;;EAGV,eAAe;EACf,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4CJ,WAAW;6BACG,cAA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AAO,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvB,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QACD,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,EAAE,eAAe;QACzB,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAClC,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA2B;IAC1D,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* while managing file ownership to avoid conflicts.
|
|
7
7
|
*/
|
|
8
8
|
import type { UltrapilotConfig, UltrapilotState, WorkerState, IntegrationResult } from './types.js';
|
|
9
|
+
export { generateDecompositionPrompt, parseDecompositionResult, generateParallelGroups, validateFileOwnership, extractSharedFiles, toSimpleSubtasks, DEFAULT_SHARED_FILE_PATTERNS } from './decomposer.js';
|
|
10
|
+
export type { DecomposedTask, DecompositionResult, DecompositionOptions, AgentType, ModelTier } from './decomposer.js';
|
|
9
11
|
/**
|
|
10
12
|
* Start ultrapilot coordinator
|
|
11
13
|
*
|
|
@@ -21,6 +23,35 @@ export declare function startUltrapilot(cwd: string, task: string, config?: Part
|
|
|
21
23
|
* Decompose a task into parallelizable subtasks
|
|
22
24
|
*
|
|
23
25
|
* Uses heuristics to identify independent work units that can be executed in parallel.
|
|
26
|
+
* For more intelligent decomposition with file ownership and dependencies, use the
|
|
27
|
+
* AI-powered decomposition functions:
|
|
28
|
+
*
|
|
29
|
+
* @example AI-powered decomposition (recommended for complex tasks):
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import {
|
|
32
|
+
* generateDecompositionPrompt,
|
|
33
|
+
* parseDecompositionResult,
|
|
34
|
+
* toSimpleSubtasks
|
|
35
|
+
* } from './decomposer.js';
|
|
36
|
+
*
|
|
37
|
+
* // Generate prompt for Architect agent
|
|
38
|
+
* const prompt = generateDecompositionPrompt(task, codebaseContext);
|
|
39
|
+
*
|
|
40
|
+
* // Call Architect agent (via Task tool in orchestrator)
|
|
41
|
+
* const response = await Task({
|
|
42
|
+
* subagent_type: 'oh-my-claudecode:architect',
|
|
43
|
+
* model: 'opus',
|
|
44
|
+
* prompt
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // Parse structured result with file ownership
|
|
48
|
+
* const result = parseDecompositionResult(response);
|
|
49
|
+
*
|
|
50
|
+
* // Use result.subtasks for full DecomposedTask objects with:
|
|
51
|
+
* // - id, description, files, blockedBy, agentType, model
|
|
52
|
+
* // Or convert to simple strings for legacy compatibility:
|
|
53
|
+
* const subtasks = toSimpleSubtasks(result);
|
|
54
|
+
* ```
|
|
24
55
|
*
|
|
25
56
|
* @param task - Task description
|
|
26
57
|
* @param config - Configuration options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/ultrapilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,iBAAiB,EAClB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/ultrapilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,iBAAiB,EAClB,MAAM,YAAY,CAAC;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,CAAC,CAYlB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAQT;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKnE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CA0BT;AAGD,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACf,MAAM,YAAY,CAAC"}
|
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { DEFAULT_CONFIG } from './types.js';
|
|
9
9
|
import { readUltrapilotState, writeUltrapilotState, initUltrapilot, addWorker, getCompletedWorkers, getRunningWorkers, getFailedWorkers, recordConflict } from './state.js';
|
|
10
|
+
// AI-powered decomposition utilities
|
|
11
|
+
// TODO: Use these with the Architect agent for intelligent task decomposition
|
|
12
|
+
// Example integration:
|
|
13
|
+
// const prompt = generateDecompositionPrompt(task, codebaseContext);
|
|
14
|
+
// const response = await Task({ subagent_type: 'architect', prompt });
|
|
15
|
+
// const result = parseDecompositionResult(response);
|
|
16
|
+
// const subtasks = toSimpleSubtasks(result);
|
|
17
|
+
export { generateDecompositionPrompt, parseDecompositionResult, generateParallelGroups, validateFileOwnership, extractSharedFiles, toSimpleSubtasks, DEFAULT_SHARED_FILE_PATTERNS } from './decomposer.js';
|
|
10
18
|
/**
|
|
11
19
|
* Start ultrapilot coordinator
|
|
12
20
|
*
|
|
@@ -23,20 +31,53 @@ export async function startUltrapilot(cwd, task, config) {
|
|
|
23
31
|
const subtasks = await decomposeTask(task, mergedConfig);
|
|
24
32
|
// Initialize state
|
|
25
33
|
const state = initUltrapilot(cwd, task, subtasks, undefined, mergedConfig);
|
|
34
|
+
if (!state) {
|
|
35
|
+
throw new Error('Failed to initialize ultrapilot: another mode is active');
|
|
36
|
+
}
|
|
26
37
|
return state;
|
|
27
38
|
}
|
|
28
39
|
/**
|
|
29
40
|
* Decompose a task into parallelizable subtasks
|
|
30
41
|
*
|
|
31
42
|
* Uses heuristics to identify independent work units that can be executed in parallel.
|
|
43
|
+
* For more intelligent decomposition with file ownership and dependencies, use the
|
|
44
|
+
* AI-powered decomposition functions:
|
|
45
|
+
*
|
|
46
|
+
* @example AI-powered decomposition (recommended for complex tasks):
|
|
47
|
+
* ```typescript
|
|
48
|
+
* import {
|
|
49
|
+
* generateDecompositionPrompt,
|
|
50
|
+
* parseDecompositionResult,
|
|
51
|
+
* toSimpleSubtasks
|
|
52
|
+
* } from './decomposer.js';
|
|
53
|
+
*
|
|
54
|
+
* // Generate prompt for Architect agent
|
|
55
|
+
* const prompt = generateDecompositionPrompt(task, codebaseContext);
|
|
56
|
+
*
|
|
57
|
+
* // Call Architect agent (via Task tool in orchestrator)
|
|
58
|
+
* const response = await Task({
|
|
59
|
+
* subagent_type: 'oh-my-claudecode:architect',
|
|
60
|
+
* model: 'opus',
|
|
61
|
+
* prompt
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* // Parse structured result with file ownership
|
|
65
|
+
* const result = parseDecompositionResult(response);
|
|
66
|
+
*
|
|
67
|
+
* // Use result.subtasks for full DecomposedTask objects with:
|
|
68
|
+
* // - id, description, files, blockedBy, agentType, model
|
|
69
|
+
* // Or convert to simple strings for legacy compatibility:
|
|
70
|
+
* const subtasks = toSimpleSubtasks(result);
|
|
71
|
+
* ```
|
|
32
72
|
*
|
|
33
73
|
* @param task - Task description
|
|
34
74
|
* @param config - Configuration options
|
|
35
75
|
* @returns Array of subtask descriptions
|
|
36
76
|
*/
|
|
37
77
|
export async function decomposeTask(task, config) {
|
|
38
|
-
//
|
|
39
|
-
//
|
|
78
|
+
// Heuristic-based decomposition for simple cases
|
|
79
|
+
// For complex tasks, use generateDecompositionPrompt() with Architect agent
|
|
80
|
+
// to get structured DecompositionResult with file ownership and dependencies
|
|
40
81
|
const subtasks = [];
|
|
41
82
|
// Look for explicit lists (numbered or bulleted)
|
|
42
83
|
const listItemPattern = /^[\s]*(?:\d+\.|[-*+])\s+(.+)$/gm;
|