oh-my-claude-sisyphus 3.3.8 → 3.4.0

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.
Files changed (298) hide show
  1. package/README.md +3 -3
  2. package/agents/explore-high.md +195 -0
  3. package/agents/qa-tester-high.md +141 -0
  4. package/agents/templates/README.md +110 -0
  5. package/agents/templates/base-agent.md +54 -0
  6. package/agents/templates/tier-instructions.md +94 -0
  7. package/commands/ecomode.md +60 -0
  8. package/commands/help.md +1 -1
  9. package/commands/mcp-setup.md +7 -6
  10. package/commands/ralplan.md +8 -1
  11. package/commands/ultrapilot.md +158 -0
  12. package/commands/ultrawork.md +1 -0
  13. package/dist/__tests__/delegation-enforcer-integration.test.d.ts +6 -0
  14. package/dist/__tests__/delegation-enforcer-integration.test.d.ts.map +1 -0
  15. package/dist/__tests__/delegation-enforcer-integration.test.js +136 -0
  16. package/dist/__tests__/delegation-enforcer-integration.test.js.map +1 -0
  17. package/dist/__tests__/delegation-enforcer.test.d.ts +5 -0
  18. package/dist/__tests__/delegation-enforcer.test.d.ts.map +1 -0
  19. package/dist/__tests__/delegation-enforcer.test.js +208 -0
  20. package/dist/__tests__/delegation-enforcer.test.js.map +1 -0
  21. package/dist/__tests__/hooks.test.js +2 -2
  22. package/dist/__tests__/hooks.test.js.map +1 -1
  23. package/dist/__tests__/installer.test.js +4 -6
  24. package/dist/__tests__/installer.test.js.map +1 -1
  25. package/dist/__tests__/ralph-prd.test.js +1 -1
  26. package/dist/__tests__/ralph-prd.test.js.map +1 -1
  27. package/dist/__tests__/ralph-progress.test.js +1 -1
  28. package/dist/__tests__/ralph-progress.test.js.map +1 -1
  29. package/dist/__tests__/skills.test.js +31 -24
  30. package/dist/__tests__/skills.test.js.map +1 -1
  31. package/dist/agents/analyst.d.ts.map +1 -1
  32. package/dist/agents/analyst.js +1 -0
  33. package/dist/agents/analyst.js.map +1 -1
  34. package/dist/agents/architect.d.ts.map +1 -1
  35. package/dist/agents/architect.js +1 -0
  36. package/dist/agents/architect.js.map +1 -1
  37. package/dist/agents/critic.d.ts.map +1 -1
  38. package/dist/agents/critic.js +1 -0
  39. package/dist/agents/critic.js.map +1 -1
  40. package/dist/agents/definitions.d.ts +5 -1
  41. package/dist/agents/definitions.d.ts.map +1 -1
  42. package/dist/agents/definitions.js +53 -155
  43. package/dist/agents/definitions.js.map +1 -1
  44. package/dist/agents/designer.d.ts.map +1 -1
  45. package/dist/agents/designer.js +1 -0
  46. package/dist/agents/designer.js.map +1 -1
  47. package/dist/agents/executor.d.ts.map +1 -1
  48. package/dist/agents/executor.js +1 -0
  49. package/dist/agents/executor.js.map +1 -1
  50. package/dist/agents/explore.d.ts.map +1 -1
  51. package/dist/agents/explore.js +1 -0
  52. package/dist/agents/explore.js.map +1 -1
  53. package/dist/agents/planner.d.ts.map +1 -1
  54. package/dist/agents/planner.js +1 -0
  55. package/dist/agents/planner.js.map +1 -1
  56. package/dist/agents/qa-tester.d.ts.map +1 -1
  57. package/dist/agents/qa-tester.js +1 -0
  58. package/dist/agents/qa-tester.js.map +1 -1
  59. package/dist/agents/researcher.d.ts.map +1 -1
  60. package/dist/agents/researcher.js +1 -0
  61. package/dist/agents/researcher.js.map +1 -1
  62. package/dist/agents/scientist.d.ts.map +1 -1
  63. package/dist/agents/scientist.js +1 -0
  64. package/dist/agents/scientist.js.map +1 -1
  65. package/dist/agents/types.d.ts +2 -0
  66. package/dist/agents/types.d.ts.map +1 -1
  67. package/dist/agents/types.js.map +1 -1
  68. package/dist/agents/vision.d.ts.map +1 -1
  69. package/dist/agents/vision.js +1 -0
  70. package/dist/agents/vision.js.map +1 -1
  71. package/dist/agents/writer.d.ts.map +1 -1
  72. package/dist/agents/writer.js +1 -0
  73. package/dist/agents/writer.js.map +1 -1
  74. package/dist/cli/index.js +0 -3
  75. package/dist/cli/index.js.map +1 -1
  76. package/dist/config/loader.d.ts.map +1 -1
  77. package/dist/config/loader.js +1 -6
  78. package/dist/config/loader.js.map +1 -1
  79. package/dist/features/delegation-enforcer.d.ts +71 -0
  80. package/dist/features/delegation-enforcer.d.ts.map +1 -0
  81. package/dist/features/delegation-enforcer.js +128 -0
  82. package/dist/features/delegation-enforcer.js.map +1 -0
  83. package/dist/features/index.d.ts +3 -0
  84. package/dist/features/index.d.ts.map +1 -1
  85. package/dist/features/index.js +18 -0
  86. package/dist/features/index.js.map +1 -1
  87. package/dist/features/state-manager/index.d.ts +100 -0
  88. package/dist/features/state-manager/index.d.ts.map +1 -0
  89. package/dist/features/state-manager/index.js +407 -0
  90. package/dist/features/state-manager/index.js.map +1 -0
  91. package/dist/features/state-manager/types.d.ts +147 -0
  92. package/dist/features/state-manager/types.d.ts.map +1 -0
  93. package/dist/features/state-manager/types.js +30 -0
  94. package/dist/features/state-manager/types.js.map +1 -0
  95. package/dist/features/task-decomposer/index.d.ts +33 -0
  96. package/dist/features/task-decomposer/index.d.ts.map +1 -0
  97. package/dist/features/task-decomposer/index.js +698 -0
  98. package/dist/features/task-decomposer/index.js.map +1 -0
  99. package/dist/features/task-decomposer/types.d.ts +133 -0
  100. package/dist/features/task-decomposer/types.d.ts.map +1 -0
  101. package/dist/features/task-decomposer/types.js +8 -0
  102. package/dist/features/task-decomposer/types.js.map +1 -0
  103. package/dist/features/verification/example.d.ts +49 -0
  104. package/dist/features/verification/example.d.ts.map +1 -0
  105. package/dist/features/verification/example.js +235 -0
  106. package/dist/features/verification/example.js.map +1 -0
  107. package/dist/features/verification/index.d.ts +97 -0
  108. package/dist/features/verification/index.d.ts.map +1 -0
  109. package/dist/features/verification/index.js +439 -0
  110. package/dist/features/verification/index.js.map +1 -0
  111. package/dist/features/verification/types.d.ts +142 -0
  112. package/dist/features/verification/types.d.ts.map +1 -0
  113. package/dist/features/verification/types.js +7 -0
  114. package/dist/features/verification/types.js.map +1 -0
  115. package/dist/hooks/agent-usage-reminder/constants.d.ts.map +1 -1
  116. package/dist/hooks/agent-usage-reminder/constants.js +0 -1
  117. package/dist/hooks/agent-usage-reminder/constants.js.map +1 -1
  118. package/dist/hooks/autopilot/__tests__/cancel.test.js +4 -4
  119. package/dist/hooks/autopilot/__tests__/cancel.test.js.map +1 -1
  120. package/dist/hooks/autopilot/__tests__/summary.test.js +1 -1
  121. package/dist/hooks/autopilot/__tests__/summary.test.js.map +1 -1
  122. package/dist/hooks/autopilot/__tests__/transition.test.js +1 -2
  123. package/dist/hooks/autopilot/__tests__/transition.test.js.map +1 -1
  124. package/dist/hooks/autopilot/cancel.js +2 -2
  125. package/dist/hooks/autopilot/cancel.js.map +1 -1
  126. package/dist/hooks/autopilot/enforcement.d.ts +16 -2
  127. package/dist/hooks/autopilot/enforcement.d.ts.map +1 -1
  128. package/dist/hooks/autopilot/enforcement.js +78 -4
  129. package/dist/hooks/autopilot/enforcement.js.map +1 -1
  130. package/dist/hooks/autopilot/index.d.ts +3 -6
  131. package/dist/hooks/autopilot/index.d.ts.map +1 -1
  132. package/dist/hooks/autopilot/index.js +6 -12
  133. package/dist/hooks/autopilot/index.js.map +1 -1
  134. package/dist/hooks/autopilot/state.d.ts +36 -2
  135. package/dist/hooks/autopilot/state.d.ts.map +1 -1
  136. package/dist/hooks/autopilot/state.js +216 -2
  137. package/dist/hooks/autopilot/state.js.map +1 -1
  138. package/dist/hooks/autopilot/validation.d.ts +23 -2
  139. package/dist/hooks/autopilot/validation.d.ts.map +1 -1
  140. package/dist/hooks/autopilot/validation.js +158 -1
  141. package/dist/hooks/autopilot/validation.js.map +1 -1
  142. package/dist/hooks/bridge.js +3 -3
  143. package/dist/hooks/bridge.js.map +1 -1
  144. package/dist/hooks/index.d.ts +5 -9
  145. package/dist/hooks/index.d.ts.map +1 -1
  146. package/dist/hooks/index.js +31 -21
  147. package/dist/hooks/index.js.map +1 -1
  148. package/dist/hooks/learner/promotion.js +1 -1
  149. package/dist/hooks/learner/promotion.js.map +1 -1
  150. package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
  151. package/dist/hooks/persistent-mode/index.js +2 -3
  152. package/dist/hooks/persistent-mode/index.js.map +1 -1
  153. package/dist/hooks/ralph/index.d.ts +11 -0
  154. package/dist/hooks/ralph/index.d.ts.map +1 -0
  155. package/dist/hooks/ralph/index.js +53 -0
  156. package/dist/hooks/ralph/index.js.map +1 -0
  157. package/dist/hooks/ralph/loop.d.ts +116 -0
  158. package/dist/hooks/ralph/loop.d.ts.map +1 -0
  159. package/dist/hooks/ralph/loop.js +322 -0
  160. package/dist/hooks/ralph/loop.js.map +1 -0
  161. package/dist/hooks/ralph/prd.d.ts +130 -0
  162. package/dist/hooks/ralph/prd.d.ts.map +1 -0
  163. package/dist/hooks/ralph/prd.js +310 -0
  164. package/dist/hooks/ralph/prd.js.map +1 -0
  165. package/dist/hooks/ralph/progress.d.ts +102 -0
  166. package/dist/hooks/ralph/progress.d.ts.map +1 -0
  167. package/dist/hooks/ralph/progress.js +408 -0
  168. package/dist/hooks/ralph/progress.js.map +1 -0
  169. package/dist/hooks/ralph/verifier.d.ts +72 -0
  170. package/dist/hooks/ralph/verifier.d.ts.map +1 -0
  171. package/dist/hooks/ralph/verifier.js +223 -0
  172. package/dist/hooks/ralph/verifier.js.map +1 -0
  173. package/dist/hooks/recovery/constants.d.ts +114 -0
  174. package/dist/hooks/recovery/constants.d.ts.map +1 -0
  175. package/dist/hooks/recovery/constants.js +227 -0
  176. package/dist/hooks/recovery/constants.js.map +1 -0
  177. package/dist/hooks/recovery/context-window.d.ts +24 -0
  178. package/dist/hooks/recovery/context-window.d.ts.map +1 -0
  179. package/dist/hooks/recovery/context-window.js +321 -0
  180. package/dist/hooks/recovery/context-window.js.map +1 -0
  181. package/dist/hooks/recovery/edit-error.d.ts +24 -0
  182. package/dist/hooks/recovery/edit-error.d.ts.map +1 -0
  183. package/dist/hooks/recovery/edit-error.js +56 -0
  184. package/dist/hooks/recovery/edit-error.js.map +1 -0
  185. package/dist/hooks/recovery/index.d.ts +102 -0
  186. package/dist/hooks/recovery/index.d.ts.map +1 -0
  187. package/dist/hooks/recovery/index.js +166 -0
  188. package/dist/hooks/recovery/index.js.map +1 -0
  189. package/dist/hooks/recovery/session-recovery.d.ts +24 -0
  190. package/dist/hooks/recovery/session-recovery.d.ts.map +1 -0
  191. package/dist/hooks/recovery/session-recovery.js +281 -0
  192. package/dist/hooks/recovery/session-recovery.js.map +1 -0
  193. package/dist/hooks/recovery/storage.d.ts +75 -0
  194. package/dist/hooks/recovery/storage.d.ts.map +1 -0
  195. package/dist/hooks/recovery/storage.js +382 -0
  196. package/dist/hooks/recovery/storage.js.map +1 -0
  197. package/dist/hooks/recovery/types.d.ts +196 -0
  198. package/dist/hooks/recovery/types.d.ts.map +1 -0
  199. package/dist/hooks/recovery/types.js +32 -0
  200. package/dist/hooks/recovery/types.js.map +1 -0
  201. package/dist/hooks/ultrapilot/index.d.ts +90 -0
  202. package/dist/hooks/ultrapilot/index.d.ts.map +1 -0
  203. package/dist/hooks/ultrapilot/index.js +310 -0
  204. package/dist/hooks/ultrapilot/index.js.map +1 -0
  205. package/dist/hooks/ultrapilot/state.d.ts +72 -0
  206. package/dist/hooks/ultrapilot/state.d.ts.map +1 -0
  207. package/dist/hooks/ultrapilot/state.js +258 -0
  208. package/dist/hooks/ultrapilot/state.js.map +1 -0
  209. package/dist/hooks/ultrapilot/types.d.ts +113 -0
  210. package/dist/hooks/ultrapilot/types.d.ts.map +1 -0
  211. package/dist/hooks/ultrapilot/types.js +36 -0
  212. package/dist/hooks/ultrapilot/types.js.map +1 -0
  213. package/dist/hooks/ultraqa/index.d.ts +94 -0
  214. package/dist/hooks/ultraqa/index.d.ts.map +1 -0
  215. package/dist/hooks/ultraqa/index.js +216 -0
  216. package/dist/hooks/ultraqa/index.js.map +1 -0
  217. package/dist/hooks/ultrawork/index.d.ts +62 -0
  218. package/dist/hooks/ultrawork/index.d.ts.map +1 -0
  219. package/dist/hooks/ultrawork/index.js +208 -0
  220. package/dist/hooks/ultrawork/index.js.map +1 -0
  221. package/dist/hud/elements/index.d.ts +1 -1
  222. package/dist/hud/elements/index.d.ts.map +1 -1
  223. package/dist/hud/elements/index.js +1 -1
  224. package/dist/hud/elements/index.js.map +1 -1
  225. package/dist/hud/elements/limits.d.ts +6 -0
  226. package/dist/hud/elements/limits.d.ts.map +1 -1
  227. package/dist/hud/elements/limits.js +31 -0
  228. package/dist/hud/elements/limits.js.map +1 -1
  229. package/dist/hud/render.d.ts.map +1 -1
  230. package/dist/hud/render.js +8 -4
  231. package/dist/hud/render.js.map +1 -1
  232. package/dist/hud/types.d.ts +1 -0
  233. package/dist/hud/types.d.ts.map +1 -1
  234. package/dist/hud/types.js +6 -0
  235. package/dist/hud/types.js.map +1 -1
  236. package/dist/hud/usage-api.d.ts.map +1 -1
  237. package/dist/hud/usage-api.js +5 -3
  238. package/dist/hud/usage-api.js.map +1 -1
  239. package/dist/index.d.ts.map +1 -1
  240. package/dist/index.js +1 -2
  241. package/dist/index.js.map +1 -1
  242. package/dist/installer/index.d.ts +1 -1
  243. package/dist/installer/index.js +1 -1
  244. package/dist/mcp/index.d.ts +1 -1
  245. package/dist/mcp/index.d.ts.map +1 -1
  246. package/dist/mcp/index.js +1 -1
  247. package/dist/mcp/index.js.map +1 -1
  248. package/dist/mcp/servers.d.ts +2 -18
  249. package/dist/mcp/servers.d.ts.map +1 -1
  250. package/dist/mcp/servers.js +4 -36
  251. package/dist/mcp/servers.js.map +1 -1
  252. package/dist/shared/types.d.ts +1 -3
  253. package/dist/shared/types.d.ts.map +1 -1
  254. package/docs/CLAUDE.md +170 -44
  255. package/docs/DELEGATION-ENFORCER.md +282 -0
  256. package/docs/FULL-README.md +1 -1
  257. package/docs/LOCAL_PLUGIN_INSTALL.md +1 -1
  258. package/docs/MIGRATION.md +298 -104
  259. package/package.json +2 -2
  260. package/scripts/test-mutual-exclusion.ts +1 -1
  261. package/skills/analyze/SKILL.md +0 -1
  262. package/skills/autopilot/SKILL.md +0 -1
  263. package/skills/cancel/SKILL.md +580 -0
  264. package/skills/cancel-autopilot/SKILL.md +0 -1
  265. package/skills/cancel-ecomode/SKILL.md +41 -0
  266. package/skills/cancel-ralph/SKILL.md +0 -1
  267. package/skills/cancel-ultraqa/SKILL.md +0 -1
  268. package/skills/cancel-ultrawork/SKILL.md +0 -1
  269. package/skills/deepinit/SKILL.md +0 -1
  270. package/skills/deepsearch/SKILL.md +0 -1
  271. package/skills/doctor/SKILL.md +0 -1
  272. package/skills/ecomode/SKILL.md +128 -0
  273. package/skills/frontend-ui-ux/SKILL.md +0 -1
  274. package/skills/git-master/SKILL.md +0 -1
  275. package/skills/help/SKILL.md +1 -2
  276. package/skills/hud/SKILL.md +0 -1
  277. package/skills/learner/SKILL.md +0 -1
  278. package/skills/mcp-setup/SKILL.md +8 -7
  279. package/skills/note/SKILL.md +0 -1
  280. package/skills/omc-default/SKILL.md +0 -1
  281. package/skills/omc-default-global/SKILL.md +0 -1
  282. package/skills/omc-setup/SKILL.md +212 -10
  283. package/skills/orchestrate/SKILL.md +0 -1
  284. package/skills/pipeline/SKILL.md +417 -0
  285. package/skills/plan/SKILL.md +138 -21
  286. package/skills/planner/SKILL.md +0 -1
  287. package/skills/ralph/SKILL.md +65 -1
  288. package/skills/ralph-init/SKILL.md +0 -1
  289. package/skills/ralplan/SKILL.md +0 -1
  290. package/skills/release/SKILL.md +0 -1
  291. package/skills/research/SKILL.md +0 -1
  292. package/skills/review/SKILL.md +0 -1
  293. package/skills/swarm/SKILL.md +349 -0
  294. package/skills/tdd/SKILL.md +0 -1
  295. package/skills/ultrapilot/SKILL.md +563 -0
  296. package/skills/ultraqa/SKILL.md +0 -1
  297. package/skills/ultrawork/SKILL.md +0 -1
  298. package/docs/MIGRATION-v3.md +0 -186
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Ultrapilot Coordinator
3
+ *
4
+ * Manages parallel worker spawning and coordination for ultrapilot mode.
5
+ * Decomposes tasks, spawns workers (max 5), tracks progress, and integrates results
6
+ * while managing file ownership to avoid conflicts.
7
+ */
8
+ import type { UltrapilotConfig, UltrapilotState, WorkerState, IntegrationResult } from './types.js';
9
+ /**
10
+ * Start ultrapilot coordinator
11
+ *
12
+ * Entry point for ultrapilot - decomposes task and spawns parallel workers.
13
+ *
14
+ * @param cwd - Current working directory
15
+ * @param task - Task description to parallelize
16
+ * @param config - Configuration options
17
+ * @returns Initialized ultrapilot state
18
+ */
19
+ export declare function startUltrapilot(cwd: string, task: string, config?: Partial<UltrapilotConfig>): Promise<UltrapilotState>;
20
+ /**
21
+ * Decompose a task into parallelizable subtasks
22
+ *
23
+ * Uses heuristics to identify independent work units that can be executed in parallel.
24
+ *
25
+ * @param task - Task description
26
+ * @param config - Configuration options
27
+ * @returns Array of subtask descriptions
28
+ */
29
+ export declare function decomposeTask(task: string, config: Required<UltrapilotConfig>): Promise<string[]>;
30
+ /**
31
+ * Spawn parallel workers for subtasks
32
+ *
33
+ * Creates Task agents for each subtask with non-overlapping file ownership.
34
+ *
35
+ * @param cwd - Current working directory
36
+ * @param subtasks - Array of subtask descriptions
37
+ * @param config - Configuration options
38
+ * @returns Array of spawned worker states
39
+ */
40
+ export declare function spawnWorkers(cwd: string, subtasks: string[], config?: Partial<UltrapilotConfig>): Promise<WorkerState[]>;
41
+ /**
42
+ * Track progress of running workers
43
+ *
44
+ * Polls TaskOutput to check worker status and updates state accordingly.
45
+ *
46
+ * @param cwd - Current working directory
47
+ * @returns Object with completed, running, and failed worker counts
48
+ */
49
+ export declare function trackProgress(cwd: string): Promise<{
50
+ completed: number;
51
+ running: number;
52
+ failed: number;
53
+ total: number;
54
+ }>;
55
+ /**
56
+ * Integrate results from completed workers
57
+ *
58
+ * Merges outputs, detects conflicts, and produces final integration result.
59
+ *
60
+ * @param cwd - Current working directory
61
+ * @returns Integration result with files, conflicts, and summary
62
+ */
63
+ export declare function integrateResults(cwd: string): Promise<IntegrationResult>;
64
+ /**
65
+ * Handle shared files that multiple workers might need to access
66
+ *
67
+ * Coordinator maintains exclusive ownership of shared files (package.json, etc.)
68
+ * and provides a mechanism for workers to request changes.
69
+ *
70
+ * @param cwd - Current working directory
71
+ * @param files - List of files to mark as shared
72
+ * @returns Updated ownership state
73
+ */
74
+ export declare function handleSharedFiles(cwd: string, files: string[]): Promise<boolean>;
75
+ /**
76
+ * Check if a file is owned by a specific worker
77
+ */
78
+ export declare function isFileOwnedByWorker(cwd: string, workerId: string, filePath: string): boolean;
79
+ /**
80
+ * Check if a file is shared (owned by coordinator)
81
+ */
82
+ export declare function isSharedFile(cwd: string, filePath: string): boolean;
83
+ /**
84
+ * Assign file ownership to a worker
85
+ */
86
+ export declare function assignFileToWorker(cwd: string, workerId: string, filePath: string): boolean;
87
+ export type { UltrapilotConfig, UltrapilotState, WorkerState, IntegrationResult, FileOwnership } from './types.js';
88
+ export { DEFAULT_CONFIG } from './types.js';
89
+ export { readUltrapilotState, writeUltrapilotState, initUltrapilot, addWorker, updateWorkerState, completeWorker, failWorker, completeUltrapilot, getCompletedWorkers, getRunningWorkers, getFailedWorkers, recordConflict } from './state.js';
90
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AAiBpB;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GACjC,OAAO,CAAC,eAAe,CAAC,CAU1B;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GACjC,OAAO,CAAC,MAAM,EAAE,CAAC,CAgCnB;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAA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Y,CAAC"}
@@ -0,0 +1,310 @@
1
+ /**
2
+ * Ultrapilot Coordinator
3
+ *
4
+ * Manages parallel worker spawning and coordination for ultrapilot mode.
5
+ * Decomposes tasks, spawns workers (max 5), tracks progress, and integrates results
6
+ * while managing file ownership to avoid conflicts.
7
+ */
8
+ import { DEFAULT_CONFIG } from './types.js';
9
+ import { readUltrapilotState, writeUltrapilotState, initUltrapilot, addWorker, getCompletedWorkers, getRunningWorkers, getFailedWorkers, recordConflict } from './state.js';
10
+ /**
11
+ * Start ultrapilot coordinator
12
+ *
13
+ * Entry point for ultrapilot - decomposes task and spawns parallel workers.
14
+ *
15
+ * @param cwd - Current working directory
16
+ * @param task - Task description to parallelize
17
+ * @param config - Configuration options
18
+ * @returns Initialized ultrapilot state
19
+ */
20
+ export async function startUltrapilot(cwd, task, config) {
21
+ const mergedConfig = { ...DEFAULT_CONFIG, ...config };
22
+ // Decompose task into parallelizable subtasks
23
+ const subtasks = await decomposeTask(task, mergedConfig);
24
+ // Initialize state
25
+ const state = initUltrapilot(cwd, task, subtasks, undefined, mergedConfig);
26
+ return state;
27
+ }
28
+ /**
29
+ * Decompose a task into parallelizable subtasks
30
+ *
31
+ * Uses heuristics to identify independent work units that can be executed in parallel.
32
+ *
33
+ * @param task - Task description
34
+ * @param config - Configuration options
35
+ * @returns Array of subtask descriptions
36
+ */
37
+ export async function decomposeTask(task, config) {
38
+ // For now, implement basic heuristics for task decomposition
39
+ // In future, this could use an AI agent to analyze the task
40
+ const subtasks = [];
41
+ // Look for explicit lists (numbered or bulleted)
42
+ const listItemPattern = /^[\s]*(?:\d+\.|[-*+])\s+(.+)$/gm;
43
+ const matches = task.matchAll(listItemPattern);
44
+ for (const match of matches) {
45
+ if (match[1]) {
46
+ subtasks.push(match[1].trim());
47
+ }
48
+ }
49
+ // If no explicit list found, look for sentences separated by periods or newlines
50
+ if (subtasks.length === 0) {
51
+ const sentences = task
52
+ .split(/[.;\n]+/)
53
+ .map((s) => s.trim())
54
+ .filter((s) => s.length > 10); // Filter out very short fragments
55
+ subtasks.push(...sentences);
56
+ }
57
+ // If still no subtasks, treat entire task as single unit
58
+ if (subtasks.length === 0) {
59
+ subtasks.push(task);
60
+ }
61
+ // Limit to maxWorkers
62
+ return subtasks.slice(0, config.maxWorkers);
63
+ }
64
+ /**
65
+ * Spawn parallel workers for subtasks
66
+ *
67
+ * Creates Task agents for each subtask with non-overlapping file ownership.
68
+ *
69
+ * @param cwd - Current working directory
70
+ * @param subtasks - Array of subtask descriptions
71
+ * @param config - Configuration options
72
+ * @returns Array of spawned worker states
73
+ */
74
+ export async function spawnWorkers(cwd, subtasks, config) {
75
+ const state = readUltrapilotState(cwd);
76
+ if (!state) {
77
+ throw new Error('Ultrapilot not initialized');
78
+ }
79
+ const mergedConfig = { ...DEFAULT_CONFIG, ...config };
80
+ const workers = [];
81
+ for (let i = 0; i < subtasks.length; i++) {
82
+ const workerId = `worker-${i + 1}`;
83
+ const worker = {
84
+ id: workerId,
85
+ index: i,
86
+ task: subtasks[i],
87
+ ownedFiles: [], // Will be assigned during execution
88
+ status: 'pending',
89
+ startedAt: new Date().toISOString(),
90
+ filesCreated: [],
91
+ filesModified: []
92
+ };
93
+ workers.push(worker);
94
+ addWorker(cwd, worker);
95
+ }
96
+ return workers;
97
+ }
98
+ /**
99
+ * Track progress of running workers
100
+ *
101
+ * Polls TaskOutput to check worker status and updates state accordingly.
102
+ *
103
+ * @param cwd - Current working directory
104
+ * @returns Object with completed, running, and failed worker counts
105
+ */
106
+ export async function trackProgress(cwd) {
107
+ const state = readUltrapilotState(cwd);
108
+ if (!state) {
109
+ return { completed: 0, running: 0, failed: 0, total: 0 };
110
+ }
111
+ const completed = getCompletedWorkers(cwd);
112
+ const running = getRunningWorkers(cwd);
113
+ const failed = getFailedWorkers(cwd);
114
+ return {
115
+ completed: completed.length,
116
+ running: running.length,
117
+ failed: failed.length,
118
+ total: state.workers.length
119
+ };
120
+ }
121
+ /**
122
+ * Integrate results from completed workers
123
+ *
124
+ * Merges outputs, detects conflicts, and produces final integration result.
125
+ *
126
+ * @param cwd - Current working directory
127
+ * @returns Integration result with files, conflicts, and summary
128
+ */
129
+ export async function integrateResults(cwd) {
130
+ const state = readUltrapilotState(cwd);
131
+ if (!state) {
132
+ return {
133
+ success: false,
134
+ filesCreated: [],
135
+ filesModified: [],
136
+ conflicts: [],
137
+ errors: ['Ultrapilot not initialized'],
138
+ summary: 'Integration failed: no state found'
139
+ };
140
+ }
141
+ const completed = getCompletedWorkers(cwd);
142
+ const failed = getFailedWorkers(cwd);
143
+ const filesCreated = new Set();
144
+ const filesModified = new Set();
145
+ const errors = [];
146
+ // Collect files from completed workers
147
+ for (const worker of completed) {
148
+ worker.filesCreated.forEach((f) => filesCreated.add(f));
149
+ worker.filesModified.forEach((f) => filesModified.add(f));
150
+ }
151
+ // Collect errors from failed workers
152
+ for (const worker of failed) {
153
+ if (worker.error) {
154
+ errors.push(`Worker ${worker.id}: ${worker.error}`);
155
+ }
156
+ }
157
+ // Check for conflicts (files modified by multiple workers)
158
+ const conflicts = detectFileConflicts(state);
159
+ const success = errors.length === 0 && conflicts.length === 0;
160
+ const summary = generateIntegrationSummary(state, completed, failed, conflicts);
161
+ return {
162
+ success,
163
+ filesCreated: Array.from(filesCreated),
164
+ filesModified: Array.from(filesModified),
165
+ conflicts,
166
+ errors,
167
+ summary
168
+ };
169
+ }
170
+ /**
171
+ * Detect conflicts where multiple workers modified the same file
172
+ */
173
+ function detectFileConflicts(state) {
174
+ const fileToWorkers = new Map();
175
+ // Build map of files to workers that modified them
176
+ for (const worker of state.workers) {
177
+ if (worker.status !== 'complete')
178
+ continue;
179
+ for (const file of worker.filesModified) {
180
+ if (!fileToWorkers.has(file)) {
181
+ fileToWorkers.set(file, []);
182
+ }
183
+ fileToWorkers.get(file).push(worker.id);
184
+ }
185
+ }
186
+ // Find files with multiple workers
187
+ const conflicts = [];
188
+ for (const [file, workers] of fileToWorkers.entries()) {
189
+ if (workers.length > 1) {
190
+ conflicts.push(file);
191
+ }
192
+ }
193
+ return conflicts;
194
+ }
195
+ /**
196
+ * Generate integration summary
197
+ */
198
+ function generateIntegrationSummary(state, completed, failed, conflicts) {
199
+ const lines = [];
200
+ lines.push(`Ultrapilot Integration Summary`);
201
+ lines.push(`==============================`);
202
+ lines.push(`Original Task: ${state.originalTask}`);
203
+ lines.push(``);
204
+ lines.push(`Workers: ${state.workers.length} total`);
205
+ lines.push(` - Completed: ${completed.length}`);
206
+ lines.push(` - Failed: ${failed.length}`);
207
+ lines.push(``);
208
+ if (completed.length > 0) {
209
+ lines.push(`Completed Workers:`);
210
+ for (const worker of completed) {
211
+ lines.push(` - ${worker.id}: ${worker.task}`);
212
+ if (worker.filesCreated.length > 0) {
213
+ lines.push(` Created: ${worker.filesCreated.join(', ')}`);
214
+ }
215
+ if (worker.filesModified.length > 0) {
216
+ lines.push(` Modified: ${worker.filesModified.join(', ')}`);
217
+ }
218
+ }
219
+ lines.push(``);
220
+ }
221
+ if (failed.length > 0) {
222
+ lines.push(`Failed Workers:`);
223
+ for (const worker of failed) {
224
+ lines.push(` - ${worker.id}: ${worker.task}`);
225
+ lines.push(` Error: ${worker.error || 'Unknown error'}`);
226
+ }
227
+ lines.push(``);
228
+ }
229
+ if (conflicts.length > 0) {
230
+ lines.push(`Conflicts Detected:`);
231
+ for (const file of conflicts) {
232
+ lines.push(` - ${file}`);
233
+ }
234
+ lines.push(``);
235
+ lines.push(`Manual resolution required for conflicting files.`);
236
+ }
237
+ return lines.join('\n');
238
+ }
239
+ /**
240
+ * Handle shared files that multiple workers might need to access
241
+ *
242
+ * Coordinator maintains exclusive ownership of shared files (package.json, etc.)
243
+ * and provides a mechanism for workers to request changes.
244
+ *
245
+ * @param cwd - Current working directory
246
+ * @param files - List of files to mark as shared
247
+ * @returns Updated ownership state
248
+ */
249
+ export async function handleSharedFiles(cwd, files) {
250
+ const state = readUltrapilotState(cwd);
251
+ if (!state)
252
+ return false;
253
+ // Add files to coordinator ownership
254
+ for (const file of files) {
255
+ if (!state.ownership.coordinator.includes(file)) {
256
+ state.ownership.coordinator.push(file);
257
+ }
258
+ }
259
+ return writeUltrapilotState(cwd, state);
260
+ }
261
+ /**
262
+ * Check if a file is owned by a specific worker
263
+ */
264
+ export function isFileOwnedByWorker(cwd, workerId, filePath) {
265
+ const state = readUltrapilotState(cwd);
266
+ if (!state)
267
+ return false;
268
+ const ownedFiles = state.ownership.workers[workerId];
269
+ if (!ownedFiles)
270
+ return false;
271
+ return ownedFiles.includes(filePath);
272
+ }
273
+ /**
274
+ * Check if a file is shared (owned by coordinator)
275
+ */
276
+ export function isSharedFile(cwd, filePath) {
277
+ const state = readUltrapilotState(cwd);
278
+ if (!state)
279
+ return false;
280
+ return state.ownership.coordinator.includes(filePath);
281
+ }
282
+ /**
283
+ * Assign file ownership to a worker
284
+ */
285
+ export function assignFileToWorker(cwd, workerId, filePath) {
286
+ const state = readUltrapilotState(cwd);
287
+ if (!state)
288
+ return false;
289
+ // Check if file is already owned by another worker or coordinator
290
+ if (isSharedFile(cwd, filePath)) {
291
+ return false; // Cannot reassign shared files
292
+ }
293
+ for (const [id, files] of Object.entries(state.ownership.workers)) {
294
+ if (id !== workerId && files.includes(filePath)) {
295
+ recordConflict(cwd, filePath);
296
+ return false; // Already owned by another worker
297
+ }
298
+ }
299
+ // Assign to worker
300
+ if (!state.ownership.workers[workerId]) {
301
+ state.ownership.workers[workerId] = [];
302
+ }
303
+ if (!state.ownership.workers[workerId].includes(filePath)) {
304
+ state.ownership.workers[workerId].push(filePath);
305
+ }
306
+ return writeUltrapilotState(cwd, state);
307
+ }
308
+ export { DEFAULT_CONFIG } from './types.js';
309
+ export { readUltrapilotState, writeUltrapilotState, initUltrapilot, addWorker, updateWorkerState, completeWorker, failWorker, completeUltrapilot, getCompletedWorkers, getRunningWorkers, getFailedWorkers, recordConflict } from './state.js';
310
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/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;IACzC,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1D,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AAWD,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"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Ultrapilot State Management
3
+ *
4
+ * Persistent state for ultrapilot workflow - tracks parallel workers,
5
+ * file ownership, and progress.
6
+ */
7
+ import type { UltrapilotState, UltrapilotConfig, WorkerState, FileOwnership } from './types.js';
8
+ /**
9
+ * Read ultrapilot state from disk
10
+ */
11
+ export declare function readUltrapilotState(directory: string): UltrapilotState | null;
12
+ /**
13
+ * Write ultrapilot state to disk
14
+ */
15
+ export declare function writeUltrapilotState(directory: string, state: UltrapilotState): boolean;
16
+ /**
17
+ * Clear ultrapilot state
18
+ */
19
+ export declare function clearUltrapilotState(directory: string): boolean;
20
+ /**
21
+ * Check if ultrapilot is active
22
+ */
23
+ export declare function isUltrapilotActive(directory: string): boolean;
24
+ /**
25
+ * Initialize a new ultrapilot session
26
+ */
27
+ export declare function initUltrapilot(directory: string, task: string, subtasks: string[], sessionId?: string, config?: Partial<UltrapilotConfig>): UltrapilotState;
28
+ /**
29
+ * Update worker state
30
+ */
31
+ export declare function updateWorkerState(directory: string, workerId: string, updates: Partial<WorkerState>): boolean;
32
+ /**
33
+ * Add a new worker
34
+ */
35
+ export declare function addWorker(directory: string, worker: WorkerState): boolean;
36
+ /**
37
+ * Mark worker as complete
38
+ */
39
+ export declare function completeWorker(directory: string, workerId: string, filesCreated: string[], filesModified: string[]): boolean;
40
+ /**
41
+ * Mark worker as failed
42
+ */
43
+ export declare function failWorker(directory: string, workerId: string, error: string): boolean;
44
+ /**
45
+ * Complete ultrapilot session
46
+ */
47
+ export declare function completeUltrapilot(directory: string): boolean;
48
+ /**
49
+ * Read file ownership mapping
50
+ */
51
+ export declare function readFileOwnership(directory: string): FileOwnership | null;
52
+ /**
53
+ * Write file ownership mapping
54
+ */
55
+ export declare function writeFileOwnership(directory: string, ownership: FileOwnership): boolean;
56
+ /**
57
+ * Record a file conflict
58
+ */
59
+ export declare function recordConflict(directory: string, filePath: string): boolean;
60
+ /**
61
+ * Get all completed workers
62
+ */
63
+ export declare function getCompletedWorkers(directory: string): WorkerState[];
64
+ /**
65
+ * Get all running workers
66
+ */
67
+ export declare function getRunningWorkers(directory: string): WorkerState[];
68
+ /**
69
+ * Get all failed workers
70
+ */
71
+ export declare function getFailedWorkers(directory: string): WorkerState[];
72
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/hooks/ultrapilot/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAgChG;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAa7E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CASvF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAe/D;AAED;;GAEG;AACH,wBAAgB,kB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