@su-record/vibe 3.0.0 → 3.1.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 (341) hide show
  1. package/hooks/scripts/__tests__/.vibe/command-log.txt +3 -78
  2. package/hooks/scripts/__tests__/.vibe/memories/memories.db +0 -0
  3. package/hooks/scripts/__tests__/.vibe/memories/memories.db-shm +0 -0
  4. package/hooks/scripts/__tests__/.vibe/memories/memories.db-wal +0 -0
  5. package/hooks/scripts/__tests__/clone-behaviors.test.js +64 -0
  6. package/hooks/scripts/__tests__/clone-merge-responsive.test.js +106 -0
  7. package/hooks/scripts/clone-extract.js +242 -28
  8. package/hooks/scripts/clone-merge-responsive.js +184 -0
  9. package/hooks/scripts/clone-spec.js +33 -8
  10. package/hooks/scripts/clone-validate.js +15 -9
  11. package/package.json +5 -2
  12. package/skills/clone/SKILL.md +132 -55
  13. package/skills/vibe.clone/SKILL.md +39 -19
  14. package/dist/cli/llm/gemini-commands.d.ts +0 -25
  15. package/dist/cli/llm/gemini-commands.d.ts.map +0 -1
  16. package/dist/cli/llm/gemini-commands.js +0 -143
  17. package/dist/cli/llm/gemini-commands.js.map +0 -1
  18. package/dist/cli/postinstall/codex-agents.d.ts +0 -24
  19. package/dist/cli/postinstall/codex-agents.d.ts.map +0 -1
  20. package/dist/cli/postinstall/codex-agents.js +0 -114
  21. package/dist/cli/postinstall/codex-agents.js.map +0 -1
  22. package/dist/cli/postinstall/codex-instruction.d.ts +0 -10
  23. package/dist/cli/postinstall/codex-instruction.d.ts.map +0 -1
  24. package/dist/cli/postinstall/codex-instruction.js +0 -56
  25. package/dist/cli/postinstall/codex-instruction.js.map +0 -1
  26. package/dist/cli/postinstall/gemini-agents.d.ts +0 -12
  27. package/dist/cli/postinstall/gemini-agents.d.ts.map +0 -1
  28. package/dist/cli/postinstall/gemini-agents.js +0 -80
  29. package/dist/cli/postinstall/gemini-agents.js.map +0 -1
  30. package/dist/cli/postinstall/gemini-instruction.d.ts +0 -10
  31. package/dist/cli/postinstall/gemini-instruction.d.ts.map +0 -1
  32. package/dist/cli/postinstall/gemini-instruction.js +0 -59
  33. package/dist/cli/postinstall/gemini-instruction.js.map +0 -1
  34. package/dist/infra/lib/ContextCompressor.d.ts +0 -104
  35. package/dist/infra/lib/ContextCompressor.d.ts.map +0 -1
  36. package/dist/infra/lib/ContextCompressor.js +0 -297
  37. package/dist/infra/lib/ContextCompressor.js.map +0 -1
  38. package/dist/infra/lib/ContextCompressor.test.d.ts +0 -2
  39. package/dist/infra/lib/ContextCompressor.test.d.ts.map +0 -1
  40. package/dist/infra/lib/ContextCompressor.test.js +0 -25
  41. package/dist/infra/lib/ContextCompressor.test.js.map +0 -1
  42. package/dist/infra/lib/ProgressTracker.d.ts +0 -73
  43. package/dist/infra/lib/ProgressTracker.d.ts.map +0 -1
  44. package/dist/infra/lib/ProgressTracker.js +0 -267
  45. package/dist/infra/lib/ProgressTracker.js.map +0 -1
  46. package/dist/infra/lib/TokenBudgetTracker.d.ts +0 -68
  47. package/dist/infra/lib/TokenBudgetTracker.d.ts.map +0 -1
  48. package/dist/infra/lib/TokenBudgetTracker.js +0 -191
  49. package/dist/infra/lib/TokenBudgetTracker.js.map +0 -1
  50. package/dist/infra/lib/autonomy/AuditStore.d.ts +0 -63
  51. package/dist/infra/lib/autonomy/AuditStore.d.ts.map +0 -1
  52. package/dist/infra/lib/autonomy/AuditStore.js +0 -185
  53. package/dist/infra/lib/autonomy/AuditStore.js.map +0 -1
  54. package/dist/infra/lib/autonomy/AutonomyConfig.d.ts +0 -84
  55. package/dist/infra/lib/autonomy/AutonomyConfig.d.ts.map +0 -1
  56. package/dist/infra/lib/autonomy/AutonomyConfig.js +0 -49
  57. package/dist/infra/lib/autonomy/AutonomyConfig.js.map +0 -1
  58. package/dist/infra/lib/autonomy/AutonomyOrchestrator.d.ts +0 -78
  59. package/dist/infra/lib/autonomy/AutonomyOrchestrator.d.ts.map +0 -1
  60. package/dist/infra/lib/autonomy/AutonomyOrchestrator.js +0 -246
  61. package/dist/infra/lib/autonomy/AutonomyOrchestrator.js.map +0 -1
  62. package/dist/infra/lib/autonomy/BackgroundMonitor.d.ts +0 -36
  63. package/dist/infra/lib/autonomy/BackgroundMonitor.d.ts.map +0 -1
  64. package/dist/infra/lib/autonomy/BackgroundMonitor.js +0 -138
  65. package/dist/infra/lib/autonomy/BackgroundMonitor.js.map +0 -1
  66. package/dist/infra/lib/autonomy/CollaborationProtocol.d.ts +0 -56
  67. package/dist/infra/lib/autonomy/CollaborationProtocol.d.ts.map +0 -1
  68. package/dist/infra/lib/autonomy/CollaborationProtocol.js +0 -122
  69. package/dist/infra/lib/autonomy/CollaborationProtocol.js.map +0 -1
  70. package/dist/infra/lib/autonomy/ConfirmationManager.d.ts +0 -42
  71. package/dist/infra/lib/autonomy/ConfirmationManager.d.ts.map +0 -1
  72. package/dist/infra/lib/autonomy/ConfirmationManager.js +0 -200
  73. package/dist/infra/lib/autonomy/ConfirmationManager.js.map +0 -1
  74. package/dist/infra/lib/autonomy/ConfirmationStore.d.ts +0 -55
  75. package/dist/infra/lib/autonomy/ConfirmationStore.d.ts.map +0 -1
  76. package/dist/infra/lib/autonomy/ConfirmationStore.js +0 -130
  77. package/dist/infra/lib/autonomy/ConfirmationStore.js.map +0 -1
  78. package/dist/infra/lib/autonomy/EventBus.d.ts +0 -20
  79. package/dist/infra/lib/autonomy/EventBus.d.ts.map +0 -1
  80. package/dist/infra/lib/autonomy/EventBus.js +0 -119
  81. package/dist/infra/lib/autonomy/EventBus.js.map +0 -1
  82. package/dist/infra/lib/autonomy/EventOutbox.d.ts +0 -32
  83. package/dist/infra/lib/autonomy/EventOutbox.d.ts.map +0 -1
  84. package/dist/infra/lib/autonomy/EventOutbox.js +0 -152
  85. package/dist/infra/lib/autonomy/EventOutbox.js.map +0 -1
  86. package/dist/infra/lib/autonomy/NotificationDispatcher.d.ts +0 -24
  87. package/dist/infra/lib/autonomy/NotificationDispatcher.d.ts.map +0 -1
  88. package/dist/infra/lib/autonomy/NotificationDispatcher.js +0 -112
  89. package/dist/infra/lib/autonomy/NotificationDispatcher.js.map +0 -1
  90. package/dist/infra/lib/autonomy/PolicyEngine.d.ts +0 -76
  91. package/dist/infra/lib/autonomy/PolicyEngine.d.ts.map +0 -1
  92. package/dist/infra/lib/autonomy/PolicyEngine.js +0 -208
  93. package/dist/infra/lib/autonomy/PolicyEngine.js.map +0 -1
  94. package/dist/infra/lib/autonomy/ProactiveAnalyzer.d.ts +0 -61
  95. package/dist/infra/lib/autonomy/ProactiveAnalyzer.d.ts.map +0 -1
  96. package/dist/infra/lib/autonomy/ProactiveAnalyzer.js +0 -236
  97. package/dist/infra/lib/autonomy/ProactiveAnalyzer.js.map +0 -1
  98. package/dist/infra/lib/autonomy/RiskClassifier.d.ts +0 -35
  99. package/dist/infra/lib/autonomy/RiskClassifier.d.ts.map +0 -1
  100. package/dist/infra/lib/autonomy/RiskClassifier.js +0 -147
  101. package/dist/infra/lib/autonomy/RiskClassifier.js.map +0 -1
  102. package/dist/infra/lib/autonomy/SecuritySentinel.d.ts +0 -51
  103. package/dist/infra/lib/autonomy/SecuritySentinel.d.ts.map +0 -1
  104. package/dist/infra/lib/autonomy/SecuritySentinel.js +0 -162
  105. package/dist/infra/lib/autonomy/SecuritySentinel.js.map +0 -1
  106. package/dist/infra/lib/autonomy/SuggestionStore.d.ts +0 -54
  107. package/dist/infra/lib/autonomy/SuggestionStore.d.ts.map +0 -1
  108. package/dist/infra/lib/autonomy/SuggestionStore.js +0 -144
  109. package/dist/infra/lib/autonomy/SuggestionStore.js.map +0 -1
  110. package/dist/infra/lib/autonomy/TaskDecomposer.d.ts +0 -38
  111. package/dist/infra/lib/autonomy/TaskDecomposer.d.ts.map +0 -1
  112. package/dist/infra/lib/autonomy/TaskDecomposer.js +0 -175
  113. package/dist/infra/lib/autonomy/TaskDecomposer.js.map +0 -1
  114. package/dist/infra/lib/autonomy/__tests__/audit-store.test.d.ts +0 -2
  115. package/dist/infra/lib/autonomy/__tests__/audit-store.test.d.ts.map +0 -1
  116. package/dist/infra/lib/autonomy/__tests__/audit-store.test.js +0 -198
  117. package/dist/infra/lib/autonomy/__tests__/audit-store.test.js.map +0 -1
  118. package/dist/infra/lib/autonomy/__tests__/event-bus.test.d.ts +0 -2
  119. package/dist/infra/lib/autonomy/__tests__/event-bus.test.d.ts.map +0 -1
  120. package/dist/infra/lib/autonomy/__tests__/event-bus.test.js +0 -225
  121. package/dist/infra/lib/autonomy/__tests__/event-bus.test.js.map +0 -1
  122. package/dist/infra/lib/autonomy/__tests__/event-core.test.d.ts +0 -2
  123. package/dist/infra/lib/autonomy/__tests__/event-core.test.d.ts.map +0 -1
  124. package/dist/infra/lib/autonomy/__tests__/event-core.test.js +0 -194
  125. package/dist/infra/lib/autonomy/__tests__/event-core.test.js.map +0 -1
  126. package/dist/infra/lib/autonomy/__tests__/governance.test.d.ts +0 -2
  127. package/dist/infra/lib/autonomy/__tests__/governance.test.d.ts.map +0 -1
  128. package/dist/infra/lib/autonomy/__tests__/governance.test.js +0 -540
  129. package/dist/infra/lib/autonomy/__tests__/governance.test.js.map +0 -1
  130. package/dist/infra/lib/autonomy/__tests__/integration.test.d.ts +0 -2
  131. package/dist/infra/lib/autonomy/__tests__/integration.test.d.ts.map +0 -1
  132. package/dist/infra/lib/autonomy/__tests__/integration.test.js +0 -480
  133. package/dist/infra/lib/autonomy/__tests__/integration.test.js.map +0 -1
  134. package/dist/infra/lib/autonomy/__tests__/proactive.test.d.ts +0 -2
  135. package/dist/infra/lib/autonomy/__tests__/proactive.test.d.ts.map +0 -1
  136. package/dist/infra/lib/autonomy/__tests__/proactive.test.js +0 -410
  137. package/dist/infra/lib/autonomy/__tests__/proactive.test.js.map +0 -1
  138. package/dist/infra/lib/autonomy/__tests__/sentinel.test.d.ts +0 -2
  139. package/dist/infra/lib/autonomy/__tests__/sentinel.test.d.ts.map +0 -1
  140. package/dist/infra/lib/autonomy/__tests__/sentinel.test.js +0 -486
  141. package/dist/infra/lib/autonomy/__tests__/sentinel.test.js.map +0 -1
  142. package/dist/infra/lib/autonomy/index.d.ts +0 -18
  143. package/dist/infra/lib/autonomy/index.d.ts.map +0 -1
  144. package/dist/infra/lib/autonomy/index.js +0 -22
  145. package/dist/infra/lib/autonomy/index.js.map +0 -1
  146. package/dist/infra/lib/autonomy/schemas.d.ts +0 -317
  147. package/dist/infra/lib/autonomy/schemas.d.ts.map +0 -1
  148. package/dist/infra/lib/autonomy/schemas.js +0 -90
  149. package/dist/infra/lib/autonomy/schemas.js.map +0 -1
  150. package/dist/infra/lib/claude/index.d.ts +0 -5
  151. package/dist/infra/lib/claude/index.d.ts.map +0 -1
  152. package/dist/infra/lib/claude/index.js +0 -5
  153. package/dist/infra/lib/claude/index.js.map +0 -1
  154. package/dist/infra/lib/claude/storage.d.ts +0 -12
  155. package/dist/infra/lib/claude/storage.d.ts.map +0 -1
  156. package/dist/infra/lib/claude/storage.js +0 -54
  157. package/dist/infra/lib/claude/storage.js.map +0 -1
  158. package/dist/infra/lib/gemini/auth.d.ts +0 -18
  159. package/dist/infra/lib/gemini/auth.d.ts.map +0 -1
  160. package/dist/infra/lib/gemini/auth.js +0 -32
  161. package/dist/infra/lib/gemini/auth.js.map +0 -1
  162. package/dist/infra/lib/gemini/capabilities.d.ts +0 -28
  163. package/dist/infra/lib/gemini/capabilities.d.ts.map +0 -1
  164. package/dist/infra/lib/gemini/capabilities.js +0 -178
  165. package/dist/infra/lib/gemini/capabilities.js.map +0 -1
  166. package/dist/infra/lib/gemini/chat.d.ts +0 -35
  167. package/dist/infra/lib/gemini/chat.d.ts.map +0 -1
  168. package/dist/infra/lib/gemini/chat.js +0 -161
  169. package/dist/infra/lib/gemini/chat.js.map +0 -1
  170. package/dist/infra/lib/gemini/completion.d.ts +0 -12
  171. package/dist/infra/lib/gemini/completion.d.ts.map +0 -1
  172. package/dist/infra/lib/gemini/completion.js +0 -13
  173. package/dist/infra/lib/gemini/completion.js.map +0 -1
  174. package/dist/infra/lib/gemini/constants.d.ts +0 -8
  175. package/dist/infra/lib/gemini/constants.d.ts.map +0 -1
  176. package/dist/infra/lib/gemini/constants.js +0 -11
  177. package/dist/infra/lib/gemini/constants.js.map +0 -1
  178. package/dist/infra/lib/gemini/index.d.ts +0 -13
  179. package/dist/infra/lib/gemini/index.d.ts.map +0 -1
  180. package/dist/infra/lib/gemini/index.js +0 -12
  181. package/dist/infra/lib/gemini/index.js.map +0 -1
  182. package/dist/infra/lib/gemini/models.d.ts +0 -11
  183. package/dist/infra/lib/gemini/models.d.ts.map +0 -1
  184. package/dist/infra/lib/gemini/models.js +0 -38
  185. package/dist/infra/lib/gemini/models.js.map +0 -1
  186. package/dist/infra/lib/gemini/orchestration.d.ts +0 -33
  187. package/dist/infra/lib/gemini/orchestration.d.ts.map +0 -1
  188. package/dist/infra/lib/gemini/orchestration.js +0 -62
  189. package/dist/infra/lib/gemini/orchestration.js.map +0 -1
  190. package/dist/infra/lib/gemini/types.d.ts +0 -115
  191. package/dist/infra/lib/gemini/types.d.ts.map +0 -1
  192. package/dist/infra/lib/gemini/types.js +0 -5
  193. package/dist/infra/lib/gemini/types.js.map +0 -1
  194. package/dist/infra/orchestrator/AgentAnnouncer.d.ts +0 -64
  195. package/dist/infra/orchestrator/AgentAnnouncer.d.ts.map +0 -1
  196. package/dist/infra/orchestrator/AgentAnnouncer.js +0 -127
  197. package/dist/infra/orchestrator/AgentAnnouncer.js.map +0 -1
  198. package/dist/infra/orchestrator/AgentAnnouncer.test.d.ts +0 -5
  199. package/dist/infra/orchestrator/AgentAnnouncer.test.d.ts.map +0 -1
  200. package/dist/infra/orchestrator/AgentAnnouncer.test.js +0 -119
  201. package/dist/infra/orchestrator/AgentAnnouncer.test.js.map +0 -1
  202. package/dist/infra/orchestrator/AgentExecutor.d.ts +0 -22
  203. package/dist/infra/orchestrator/AgentExecutor.d.ts.map +0 -1
  204. package/dist/infra/orchestrator/AgentExecutor.js +0 -272
  205. package/dist/infra/orchestrator/AgentExecutor.js.map +0 -1
  206. package/dist/infra/orchestrator/AgentManager.d.ts +0 -72
  207. package/dist/infra/orchestrator/AgentManager.d.ts.map +0 -1
  208. package/dist/infra/orchestrator/AgentManager.js +0 -183
  209. package/dist/infra/orchestrator/AgentManager.js.map +0 -1
  210. package/dist/infra/orchestrator/AgentManifestCache.d.ts +0 -54
  211. package/dist/infra/orchestrator/AgentManifestCache.d.ts.map +0 -1
  212. package/dist/infra/orchestrator/AgentManifestCache.js +0 -191
  213. package/dist/infra/orchestrator/AgentManifestCache.js.map +0 -1
  214. package/dist/infra/orchestrator/AgentRegistry.d.ts +0 -76
  215. package/dist/infra/orchestrator/AgentRegistry.d.ts.map +0 -1
  216. package/dist/infra/orchestrator/AgentRegistry.js +0 -217
  217. package/dist/infra/orchestrator/AgentRegistry.js.map +0 -1
  218. package/dist/infra/orchestrator/AgentRegistry.test.d.ts +0 -5
  219. package/dist/infra/orchestrator/AgentRegistry.test.d.ts.map +0 -1
  220. package/dist/infra/orchestrator/AgentRegistry.test.js +0 -122
  221. package/dist/infra/orchestrator/AgentRegistry.test.js.map +0 -1
  222. package/dist/infra/orchestrator/BackgroundManager.d.ts +0 -128
  223. package/dist/infra/orchestrator/BackgroundManager.d.ts.map +0 -1
  224. package/dist/infra/orchestrator/BackgroundManager.js +0 -620
  225. package/dist/infra/orchestrator/BackgroundManager.js.map +0 -1
  226. package/dist/infra/orchestrator/BackgroundManager.test.d.ts +0 -6
  227. package/dist/infra/orchestrator/BackgroundManager.test.d.ts.map +0 -1
  228. package/dist/infra/orchestrator/BackgroundManager.test.js +0 -162
  229. package/dist/infra/orchestrator/BackgroundManager.test.js.map +0 -1
  230. package/dist/infra/orchestrator/CheckpointManager.d.ts +0 -54
  231. package/dist/infra/orchestrator/CheckpointManager.d.ts.map +0 -1
  232. package/dist/infra/orchestrator/CheckpointManager.js +0 -121
  233. package/dist/infra/orchestrator/CheckpointManager.js.map +0 -1
  234. package/dist/infra/orchestrator/CodexAgentRuntime.d.ts +0 -12
  235. package/dist/infra/orchestrator/CodexAgentRuntime.d.ts.map +0 -1
  236. package/dist/infra/orchestrator/CodexAgentRuntime.js +0 -94
  237. package/dist/infra/orchestrator/CodexAgentRuntime.js.map +0 -1
  238. package/dist/infra/orchestrator/CodexAgentRuntime.test.d.ts +0 -2
  239. package/dist/infra/orchestrator/CodexAgentRuntime.test.d.ts.map +0 -1
  240. package/dist/infra/orchestrator/CodexAgentRuntime.test.js +0 -37
  241. package/dist/infra/orchestrator/CodexAgentRuntime.test.js.map +0 -1
  242. package/dist/infra/orchestrator/LLMCluster.d.ts +0 -82
  243. package/dist/infra/orchestrator/LLMCluster.d.ts.map +0 -1
  244. package/dist/infra/orchestrator/LLMCluster.js +0 -146
  245. package/dist/infra/orchestrator/LLMCluster.js.map +0 -1
  246. package/dist/infra/orchestrator/MultiLlmResearch.d.ts +0 -31
  247. package/dist/infra/orchestrator/MultiLlmResearch.d.ts.map +0 -1
  248. package/dist/infra/orchestrator/MultiLlmResearch.js +0 -160
  249. package/dist/infra/orchestrator/MultiLlmResearch.js.map +0 -1
  250. package/dist/infra/orchestrator/PhasePipeline.d.ts +0 -122
  251. package/dist/infra/orchestrator/PhasePipeline.d.ts.map +0 -1
  252. package/dist/infra/orchestrator/PhasePipeline.js +0 -385
  253. package/dist/infra/orchestrator/PhasePipeline.js.map +0 -1
  254. package/dist/infra/orchestrator/PhaseResultStore.d.ts +0 -39
  255. package/dist/infra/orchestrator/PhaseResultStore.d.ts.map +0 -1
  256. package/dist/infra/orchestrator/PhaseResultStore.js +0 -151
  257. package/dist/infra/orchestrator/PhaseResultStore.js.map +0 -1
  258. package/dist/infra/orchestrator/SessionStore.d.ts +0 -40
  259. package/dist/infra/orchestrator/SessionStore.d.ts.map +0 -1
  260. package/dist/infra/orchestrator/SessionStore.js +0 -116
  261. package/dist/infra/orchestrator/SessionStore.js.map +0 -1
  262. package/dist/infra/orchestrator/SmartRouter.d.ts +0 -90
  263. package/dist/infra/orchestrator/SmartRouter.d.ts.map +0 -1
  264. package/dist/infra/orchestrator/SmartRouter.js +0 -277
  265. package/dist/infra/orchestrator/SmartRouter.js.map +0 -1
  266. package/dist/infra/orchestrator/SmartRouter.test.d.ts +0 -5
  267. package/dist/infra/orchestrator/SmartRouter.test.d.ts.map +0 -1
  268. package/dist/infra/orchestrator/SmartRouter.test.js +0 -484
  269. package/dist/infra/orchestrator/SmartRouter.test.js.map +0 -1
  270. package/dist/infra/orchestrator/SwarmOrchestrator.d.ts +0 -143
  271. package/dist/infra/orchestrator/SwarmOrchestrator.d.ts.map +0 -1
  272. package/dist/infra/orchestrator/SwarmOrchestrator.js +0 -378
  273. package/dist/infra/orchestrator/SwarmOrchestrator.js.map +0 -1
  274. package/dist/infra/orchestrator/SwarmOrchestrator.test.d.ts +0 -5
  275. package/dist/infra/orchestrator/SwarmOrchestrator.test.d.ts.map +0 -1
  276. package/dist/infra/orchestrator/SwarmOrchestrator.test.js +0 -95
  277. package/dist/infra/orchestrator/SwarmOrchestrator.test.js.map +0 -1
  278. package/dist/infra/orchestrator/agentDiscovery.d.ts +0 -26
  279. package/dist/infra/orchestrator/agentDiscovery.d.ts.map +0 -1
  280. package/dist/infra/orchestrator/agentDiscovery.js +0 -175
  281. package/dist/infra/orchestrator/agentDiscovery.js.map +0 -1
  282. package/dist/infra/orchestrator/backgroundAgent.d.ts +0 -9
  283. package/dist/infra/orchestrator/backgroundAgent.d.ts.map +0 -1
  284. package/dist/infra/orchestrator/backgroundAgent.js +0 -10
  285. package/dist/infra/orchestrator/backgroundAgent.js.map +0 -1
  286. package/dist/infra/orchestrator/index.d.ts +0 -207
  287. package/dist/infra/orchestrator/index.d.ts.map +0 -1
  288. package/dist/infra/orchestrator/index.js +0 -362
  289. package/dist/infra/orchestrator/index.js.map +0 -1
  290. package/dist/infra/orchestrator/orchestrator.d.ts +0 -60
  291. package/dist/infra/orchestrator/orchestrator.d.ts.map +0 -1
  292. package/dist/infra/orchestrator/orchestrator.js +0 -214
  293. package/dist/infra/orchestrator/orchestrator.js.map +0 -1
  294. package/dist/infra/orchestrator/parallelResearch.d.ts +0 -27
  295. package/dist/infra/orchestrator/parallelResearch.d.ts.map +0 -1
  296. package/dist/infra/orchestrator/parallelResearch.js +0 -285
  297. package/dist/infra/orchestrator/parallelResearch.js.map +0 -1
  298. package/dist/infra/orchestrator/types.d.ts +0 -205
  299. package/dist/infra/orchestrator/types.d.ts.map +0 -1
  300. package/dist/infra/orchestrator/types.js +0 -87
  301. package/dist/infra/orchestrator/types.js.map +0 -1
  302. package/dist/infra/orchestrator/types.test.d.ts +0 -2
  303. package/dist/infra/orchestrator/types.test.d.ts.map +0 -1
  304. package/dist/infra/orchestrator/types.test.js +0 -57
  305. package/dist/infra/orchestrator/types.test.js.map +0 -1
  306. package/dist/tools/semantic/analyzeDependencyGraph.d.ts +0 -12
  307. package/dist/tools/semantic/analyzeDependencyGraph.d.ts.map +0 -1
  308. package/dist/tools/semantic/analyzeDependencyGraph.js +0 -359
  309. package/dist/tools/semantic/analyzeDependencyGraph.js.map +0 -1
  310. package/dist/tools/semantic/astGrep.d.ts +0 -25
  311. package/dist/tools/semantic/astGrep.d.ts.map +0 -1
  312. package/dist/tools/semantic/astGrep.js +0 -324
  313. package/dist/tools/semantic/astGrep.js.map +0 -1
  314. package/dist/tools/semantic/astGrep.test.d.ts +0 -2
  315. package/dist/tools/semantic/astGrep.test.d.ts.map +0 -1
  316. package/dist/tools/semantic/astGrep.test.js +0 -74
  317. package/dist/tools/semantic/astGrep.test.js.map +0 -1
  318. package/dist/tools/semantic/findReferences.d.ts +0 -9
  319. package/dist/tools/semantic/findReferences.d.ts.map +0 -1
  320. package/dist/tools/semantic/findReferences.js +0 -200
  321. package/dist/tools/semantic/findReferences.js.map +0 -1
  322. package/dist/tools/semantic/findSymbol.d.ts +0 -8
  323. package/dist/tools/semantic/findSymbol.d.ts.map +0 -1
  324. package/dist/tools/semantic/findSymbol.js +0 -204
  325. package/dist/tools/semantic/findSymbol.js.map +0 -1
  326. package/dist/tools/semantic/index.d.ts +0 -9
  327. package/dist/tools/semantic/index.d.ts.map +0 -1
  328. package/dist/tools/semantic/index.js +0 -11
  329. package/dist/tools/semantic/index.js.map +0 -1
  330. package/dist/tools/semantic/lsp.d.ts +0 -68
  331. package/dist/tools/semantic/lsp.d.ts.map +0 -1
  332. package/dist/tools/semantic/lsp.js +0 -561
  333. package/dist/tools/semantic/lsp.js.map +0 -1
  334. package/dist/tools/spec/e2eTestGenerator.d.ts +0 -61
  335. package/dist/tools/spec/e2eTestGenerator.d.ts.map +0 -1
  336. package/dist/tools/spec/e2eTestGenerator.js +0 -255
  337. package/dist/tools/spec/e2eTestGenerator.js.map +0 -1
  338. package/dist/tools/spec/specVersioning.d.ts +0 -76
  339. package/dist/tools/spec/specVersioning.d.ts.map +0 -1
  340. package/dist/tools/spec/specVersioning.js +0 -236
  341. package/dist/tools/spec/specVersioning.js.map +0 -1
@@ -1,185 +0,0 @@
1
- import { uuidv7 } from 'uuidv7';
2
- const DEFAULT_PAGE_SIZE = 50;
3
- const MAX_PAGE_SIZE = 200;
4
- const SENSITIVE_PATTERNS = [
5
- [/\b(sk-[a-zA-Z0-9]{20,})\b/g, '[REDACTED:API_KEY]'],
6
- [/\b(key-[a-zA-Z0-9]{20,})\b/g, '[REDACTED:API_KEY]'],
7
- [/Bearer\s+[a-zA-Z0-9._\-]+/gi, 'Bearer [REDACTED]'],
8
- [/("?password"?\s*[:=]\s*)"[^"]*"/gi, '$1"[REDACTED]"'],
9
- [/("?secret"?\s*[:=]\s*)"[^"]*"/gi, '$1"[REDACTED]"'],
10
- [/("?token"?\s*[:=]\s*)"[^"]*"/gi, '$1"[REDACTED]"'],
11
- ];
12
- export class AuditStore {
13
- db;
14
- insertStmt;
15
- fts5Available = false;
16
- constructor(storage) {
17
- this.db = storage.getDatabase();
18
- this.initTables();
19
- this.insertStmt = this.db.prepare(`
20
- INSERT INTO audit_events
21
- (id, correlationId, causationId, eventType, agentId, actionType, riskLevel, payload, outcome, createdAt)
22
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
23
- `);
24
- }
25
- initTables() {
26
- this.db.exec(`
27
- CREATE TABLE IF NOT EXISTS audit_events (
28
- id TEXT PRIMARY KEY,
29
- correlationId TEXT NOT NULL,
30
- causationId TEXT,
31
- eventType TEXT NOT NULL,
32
- agentId TEXT,
33
- actionType TEXT,
34
- riskLevel TEXT,
35
- payload TEXT NOT NULL,
36
- outcome TEXT CHECK(outcome IS NULL OR outcome IN ('allowed', 'blocked', 'pending', 'expired')),
37
- createdAt TEXT NOT NULL
38
- );
39
- CREATE INDEX IF NOT EXISTS idx_audit_agent_time ON audit_events(agentId, createdAt);
40
- CREATE INDEX IF NOT EXISTS idx_audit_type_time ON audit_events(eventType, createdAt);
41
- CREATE INDEX IF NOT EXISTS idx_audit_correlation ON audit_events(correlationId);
42
- `);
43
- try {
44
- this.db.exec(`
45
- CREATE VIRTUAL TABLE IF NOT EXISTS audit_events_fts USING fts5(
46
- eventType, agentId, payload,
47
- content='audit_events', content_rowid='rowid'
48
- );
49
- `);
50
- this.db.exec(`
51
- CREATE TRIGGER IF NOT EXISTS audit_events_fts_ai AFTER INSERT ON audit_events BEGIN
52
- INSERT INTO audit_events_fts(rowid, eventType, agentId, payload)
53
- VALUES (new.rowid, new.eventType, new.agentId, new.payload);
54
- END;
55
- `);
56
- this.fts5Available = true;
57
- }
58
- catch {
59
- this.fts5Available = false;
60
- }
61
- this.db.exec(`
62
- CREATE TRIGGER IF NOT EXISTS prevent_audit_update
63
- BEFORE UPDATE ON audit_events
64
- BEGIN SELECT RAISE(ABORT, 'Audit logs are immutable'); END;
65
- CREATE TRIGGER IF NOT EXISTS prevent_audit_delete
66
- BEFORE DELETE ON audit_events
67
- BEGIN SELECT RAISE(ABORT, 'Audit logs are immutable'); END;
68
- `);
69
- }
70
- static redactSensitive(payload) {
71
- let redacted = payload;
72
- for (const [pattern, replacement] of SENSITIVE_PATTERNS) {
73
- redacted = redacted.replace(new RegExp(pattern.source, pattern.flags), replacement);
74
- }
75
- return redacted;
76
- }
77
- record(event) {
78
- const id = uuidv7();
79
- const payloadStr = AuditStore.redactSensitive(JSON.stringify(event.payload));
80
- this.insertStmt.run(id, event.correlationId, event.causationId ?? null, event.eventType, event.agentId ?? null, event.actionType ?? null, event.riskLevel ?? null, payloadStr, event.outcome ?? null, new Date().toISOString());
81
- return id;
82
- }
83
- recordBatch(events) {
84
- const ids = [];
85
- const batchInsert = this.db.transaction(() => {
86
- for (const event of events) {
87
- ids.push(this.record(event));
88
- }
89
- });
90
- batchInsert();
91
- return ids;
92
- }
93
- query(filters) {
94
- const conditions = [];
95
- const params = [];
96
- if (filters.agentId) {
97
- conditions.push('agentId = ?');
98
- params.push(filters.agentId);
99
- }
100
- if (filters.eventType) {
101
- conditions.push('eventType = ?');
102
- params.push(filters.eventType);
103
- }
104
- if (filters.riskLevel) {
105
- conditions.push('riskLevel = ?');
106
- params.push(filters.riskLevel);
107
- }
108
- if (filters.outcome) {
109
- conditions.push('outcome = ?');
110
- params.push(filters.outcome);
111
- }
112
- if (filters.startDate) {
113
- conditions.push('createdAt >= ?');
114
- params.push(filters.startDate);
115
- }
116
- if (filters.endDate) {
117
- conditions.push('createdAt <= ?');
118
- params.push(filters.endDate);
119
- }
120
- const where = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
121
- const limit = Math.min(filters.limit || DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE);
122
- const offset = filters.offset || 0;
123
- const sql = `SELECT * FROM audit_events ${where} ORDER BY createdAt DESC LIMIT ? OFFSET ?`;
124
- params.push(limit, offset);
125
- return this.db.prepare(sql).all(...params);
126
- }
127
- getByCorrelation(correlationId) {
128
- return this.db
129
- .prepare('SELECT * FROM audit_events WHERE correlationId = ? ORDER BY createdAt ASC')
130
- .all(correlationId);
131
- }
132
- getStats(dateRange) {
133
- const dateCondition = dateRange ? 'WHERE createdAt >= ? AND createdAt <= ?' : '';
134
- const dateParams = dateRange ? [dateRange.startDate, dateRange.endDate] : [];
135
- const total = this.db
136
- .prepare(`SELECT COUNT(*) as count FROM audit_events ${dateCondition}`)
137
- .get(...dateParams).count;
138
- const byType = this.db
139
- .prepare(`SELECT eventType, COUNT(*) as count FROM audit_events ${dateCondition} GROUP BY eventType`)
140
- .all(...dateParams);
141
- const riskCondition = dateRange
142
- ? 'WHERE createdAt >= ? AND createdAt <= ? AND riskLevel IS NOT NULL'
143
- : 'WHERE riskLevel IS NOT NULL';
144
- const byRisk = this.db
145
- .prepare(`SELECT riskLevel, COUNT(*) as count FROM audit_events ${riskCondition} GROUP BY riskLevel`)
146
- .all(...dateParams);
147
- const blockedCondition = dateRange
148
- ? `WHERE createdAt >= ? AND createdAt <= ? AND outcome = 'blocked'`
149
- : `WHERE outcome = 'blocked'`;
150
- const blocked = this.db
151
- .prepare(`SELECT COUNT(*) as count FROM audit_events ${blockedCondition}`)
152
- .get(...dateParams).count;
153
- return {
154
- totalEvents: total,
155
- byEventType: Object.fromEntries(byType.map((r) => [r.eventType, r.count])),
156
- byRiskLevel: Object.fromEntries(byRisk.map((r) => [r.riskLevel, r.count])),
157
- blockedCount: blocked,
158
- blockedRate: total > 0 ? blocked / total : 0,
159
- };
160
- }
161
- search(query, limit) {
162
- if (!this.fts5Available)
163
- return [];
164
- const sanitized = query
165
- .replace(/[*"()\-]/g, ' ')
166
- .replace(/\b(AND|OR|NOT)\b/gi, ' ')
167
- .trim();
168
- if (!sanitized)
169
- return [];
170
- const pageSize = Math.min(limit || DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE);
171
- try {
172
- return this.db
173
- .prepare(`SELECT a.* FROM audit_events a
174
- JOIN audit_events_fts f ON a.rowid = f.rowid
175
- WHERE audit_events_fts MATCH ?
176
- ORDER BY rank
177
- LIMIT ?`)
178
- .all(sanitized, pageSize);
179
- }
180
- catch {
181
- return [];
182
- }
183
- }
184
- }
185
- //# sourceMappingURL=AuditStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":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;;;;mBAIS,CACV;iBACA,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAoB,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
@@ -1,84 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const NotificationChannelEnum: z.ZodEnum<{
3
- telegram: "telegram";
4
- slack: "slack";
5
- web: "web";
6
- }>;
7
- export declare const SentinelConfigSchema: z.ZodObject<{
8
- enabled: z.ZodDefault<z.ZodBoolean>;
9
- notificationChannels: z.ZodDefault<z.ZodArray<z.ZodEnum<{
10
- telegram: "telegram";
11
- slack: "slack";
12
- web: "web";
13
- }>>>;
14
- confirmationTimeout: z.ZodDefault<z.ZodNumber>;
15
- rules: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
16
- }, z.core.$strip>;
17
- export declare const ProactiveConfigSchema: z.ZodObject<{
18
- enabled: z.ZodDefault<z.ZodBoolean>;
19
- modules: z.ZodDefault<z.ZodArray<z.ZodEnum<{
20
- quality: "quality";
21
- performance: "performance";
22
- security: "security";
23
- dependency: "dependency";
24
- }>>>;
25
- }, z.core.$strip>;
26
- export declare const AutonomyModeEnum: z.ZodEnum<{
27
- auto: "auto";
28
- suggest: "suggest";
29
- disabled: "disabled";
30
- }>;
31
- export declare const AutonomyConfigSchema: z.ZodObject<{
32
- mode: z.ZodDefault<z.ZodEnum<{
33
- auto: "auto";
34
- suggest: "suggest";
35
- disabled: "disabled";
36
- }>>;
37
- proactive: z.ZodDefault<z.ZodObject<{
38
- enabled: z.ZodDefault<z.ZodBoolean>;
39
- modules: z.ZodDefault<z.ZodArray<z.ZodEnum<{
40
- quality: "quality";
41
- performance: "performance";
42
- security: "security";
43
- dependency: "dependency";
44
- }>>>;
45
- }, z.core.$strip>>;
46
- maxConcurrentSteps: z.ZodDefault<z.ZodNumber>;
47
- maxStepTimeout: z.ZodDefault<z.ZodNumber>;
48
- }, z.core.$strip>;
49
- export declare const FullConfigSchema: z.ZodObject<{
50
- sentinel: z.ZodDefault<z.ZodObject<{
51
- enabled: z.ZodDefault<z.ZodBoolean>;
52
- notificationChannels: z.ZodDefault<z.ZodArray<z.ZodEnum<{
53
- telegram: "telegram";
54
- slack: "slack";
55
- web: "web";
56
- }>>>;
57
- confirmationTimeout: z.ZodDefault<z.ZodNumber>;
58
- rules: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
59
- }, z.core.$strip>>;
60
- autonomy: z.ZodDefault<z.ZodObject<{
61
- mode: z.ZodDefault<z.ZodEnum<{
62
- auto: "auto";
63
- suggest: "suggest";
64
- disabled: "disabled";
65
- }>>;
66
- proactive: z.ZodDefault<z.ZodObject<{
67
- enabled: z.ZodDefault<z.ZodBoolean>;
68
- modules: z.ZodDefault<z.ZodArray<z.ZodEnum<{
69
- quality: "quality";
70
- performance: "performance";
71
- security: "security";
72
- dependency: "dependency";
73
- }>>>;
74
- }, z.core.$strip>>;
75
- maxConcurrentSteps: z.ZodDefault<z.ZodNumber>;
76
- maxStepTimeout: z.ZodDefault<z.ZodNumber>;
77
- }, z.core.$strip>>;
78
- }, z.core.$strip>;
79
- export type SentinelConfig = z.infer<typeof SentinelConfigSchema>;
80
- export type AutonomyConfig = z.infer<typeof AutonomyConfigSchema>;
81
- export type FullConfig = z.infer<typeof FullConfigSchema>;
82
- export declare function loadConfig(rawConfig: unknown): FullConfig;
83
- export declare function getDefaultConfig(): FullConfig;
84
- //# sourceMappingURL=AutonomyConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutonomyConfig.d.ts","sourceRoot":"","sources":["../../../../src/infra/lib/autonomy/AutonomyConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,uBAAuB;;;;EAAuC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;iBAKhC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;EAA0C,CAAC;AAExE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG3B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAM1D,wBAAgB,UAAU,CAAC,SAAS,EAAE,OAAO,GAAG,UAAU,CAczD;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAE7C"}
@@ -1,49 +0,0 @@
1
- import { z } from 'zod';
2
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
3
- // Config Schemas
4
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5
- export const NotificationChannelEnum = z.enum(['telegram', 'slack', 'web']);
6
- export const SentinelConfigSchema = z.object({
7
- enabled: z.boolean().default(true),
8
- notificationChannels: z.array(NotificationChannelEnum).default(['telegram', 'slack', 'web']),
9
- confirmationTimeout: z.number().min(60).max(3600).default(300),
10
- rules: z.array(z.record(z.string(), z.unknown())).default([]),
11
- });
12
- export const ProactiveConfigSchema = z.object({
13
- enabled: z.boolean().default(true),
14
- modules: z
15
- .array(z.enum(['security', 'performance', 'quality', 'dependency']))
16
- .default(['security', 'performance', 'quality', 'dependency']),
17
- });
18
- export const AutonomyModeEnum = z.enum(['suggest', 'auto', 'disabled']);
19
- export const AutonomyConfigSchema = z.object({
20
- mode: AutonomyModeEnum.default('suggest'),
21
- proactive: ProactiveConfigSchema.default(() => ProactiveConfigSchema.parse({})),
22
- maxConcurrentSteps: z.number().min(1).max(5).default(3),
23
- maxStepTimeout: z.number().min(60).max(3600).default(600),
24
- });
25
- export const FullConfigSchema = z.object({
26
- sentinel: SentinelConfigSchema.default(() => SentinelConfigSchema.parse({})),
27
- autonomy: AutonomyConfigSchema.default(() => AutonomyConfigSchema.parse({})),
28
- });
29
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
30
- // Config Loader
31
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
32
- export function loadConfig(rawConfig) {
33
- try {
34
- return FullConfigSchema.parse(rawConfig ?? {});
35
- }
36
- catch (err) {
37
- if (err instanceof z.ZodError) {
38
- for (const issue of err.issues) {
39
- process.stderr.write(`[AutonomyConfig] Invalid config at '${issue.path.join('.')}': ${issue.message} — using default\n`);
40
- }
41
- }
42
- // Return defaults on validation failure
43
- return FullConfigSchema.parse({});
44
- }
45
- }
46
- export function getDefaultConfig() {
47
- return FullConfigSchema.parse({});
48
- }
49
- //# sourceMappingURL=AutonomyConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutonomyConfig.js","sourceRoot":"","sources":["../../../../src/infra/lib/autonomy/AutonomyConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yDAAyD;AACzD,iBAAiB;AACjB,yDAAyD;AAEzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAE5E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAClC,oBAAoB,EAAE,CAAC,CAAC,KAA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type { SecuritySentinel } from './SecuritySentinel.js';
4
- import type { ConfirmationManager } from './ConfirmationManager.js';
5
- import { TaskDecomposer } from './TaskDecomposer.js';
6
- import type { DecomposedTask, TaskStep, StepStatus } from './TaskDecomposer.js';
7
- import { CollaborationProtocol } from './CollaborationProtocol.js';
8
- import type { AgentAssignment } from './CollaborationProtocol.js';
9
- export type AutonomyMode = 'suggest' | 'auto' | 'disabled';
10
- export interface StepResult {
11
- stepId: string;
12
- status: StepStatus;
13
- agentName: string;
14
- output?: string;
15
- error?: string;
16
- startedAt: string;
17
- completedAt: string;
18
- durationMs: number;
19
- }
20
- export interface ExecutionResult {
21
- taskId: string;
22
- mode: AutonomyMode;
23
- status: 'completed' | 'partial' | 'failed' | 'pending_confirmation' | 'suggested';
24
- stepResults: StepResult[];
25
- totalDurationMs: number;
26
- startedAt: string;
27
- completedAt: string;
28
- }
29
- export interface TaskProgress {
30
- taskId: string;
31
- totalSteps: number;
32
- completedSteps: number;
33
- currentStep: string | null;
34
- percentComplete: number;
35
- status: 'pending' | 'running' | 'completed' | 'failed';
36
- }
37
- export type StepExecutor = (step: TaskStep, assignment: AgentAssignment) => Promise<{
38
- success: boolean;
39
- output?: string;
40
- error?: string;
41
- }>;
42
- export interface OrchestratorDeps {
43
- eventBus: EventBus;
44
- auditStore: AuditStore;
45
- sentinel: SecuritySentinel;
46
- confirmationManager?: ConfirmationManager;
47
- stepExecutor?: StepExecutor;
48
- maxConcurrentSteps?: number;
49
- maxStepTimeoutS?: number;
50
- }
51
- export declare class AutonomyOrchestrator {
52
- private readonly decomposer;
53
- private readonly protocol;
54
- private readonly eventBus;
55
- private readonly auditStore;
56
- private readonly sentinel;
57
- private readonly confirmationManager?;
58
- private readonly stepExecutor?;
59
- private readonly maxConcurrent;
60
- private readonly maxStepTimeoutS;
61
- private readonly progress;
62
- constructor(deps: OrchestratorDeps);
63
- decomposePrompt(prompt: string): DecomposedTask;
64
- execute(task: DecomposedTask, mode: AutonomyMode): Promise<ExecutionResult>;
65
- getProgress(taskId: string): TaskProgress | undefined;
66
- getDecomposer(): TaskDecomposer;
67
- getProtocol(): CollaborationProtocol;
68
- private executeStep;
69
- private buildSuggestResult;
70
- private buildStepResult;
71
- private emitStepEvent;
72
- private stepTypeToActionType;
73
- private executeWithTimeout;
74
- private initProgress;
75
- private updateProgress;
76
- private finalizeProgress;
77
- }
78
- //# sourceMappingURL=AutonomyOrchestrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutonomyOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/infra/lib/autonomy/AutonomyOrchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAclE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe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AAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAe;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmC;gBAEhD,IAAI,EAAE,gBAAgB;IAYlC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc;IAIzC,OAAO,CACX,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,eAAe,CAAC;IAgD3B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIrD,aAAa,IAAI,cAAc;IAI/B,WAAW,IAAI,qBAAqB;YAItB,WAAW;IA2FzB,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,eAAe;IA4BvB,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,oBAAoB;YASd,kBAAkB;IAchC,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,gBAAgB;CASzB"}
@@ -1,246 +0,0 @@
1
- import { TaskDecomposer } from './TaskDecomposer.js';
2
- import { CollaborationProtocol } from './CollaborationProtocol.js';
3
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4
- // Constants
5
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6
- const DEFAULT_MAX_CONCURRENT = 3;
7
- const DEFAULT_STEP_TIMEOUT_S = 600;
8
- const TASK_TIMEOUT_S = 3600;
9
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
10
- // AutonomyOrchestrator
11
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
12
- export class AutonomyOrchestrator {
13
- decomposer;
14
- protocol;
15
- eventBus;
16
- auditStore;
17
- sentinel;
18
- confirmationManager;
19
- stepExecutor;
20
- maxConcurrent;
21
- maxStepTimeoutS;
22
- progress = new Map();
23
- constructor(deps) {
24
- this.decomposer = new TaskDecomposer();
25
- this.protocol = new CollaborationProtocol();
26
- this.eventBus = deps.eventBus;
27
- this.auditStore = deps.auditStore;
28
- this.sentinel = deps.sentinel;
29
- this.confirmationManager = deps.confirmationManager;
30
- this.stepExecutor = deps.stepExecutor;
31
- this.maxConcurrent = deps.maxConcurrentSteps ?? DEFAULT_MAX_CONCURRENT;
32
- this.maxStepTimeoutS = deps.maxStepTimeoutS ?? DEFAULT_STEP_TIMEOUT_S;
33
- }
34
- decomposePrompt(prompt) {
35
- return this.decomposer.decompose(prompt);
36
- }
37
- async execute(task, mode) {
38
- const startedAt = new Date().toISOString();
39
- const startMs = Date.now();
40
- this.initProgress(task);
41
- if (mode === 'suggest' || mode === 'disabled') {
42
- return this.buildSuggestResult(task, mode, startedAt, startMs);
43
- }
44
- const stepResults = [];
45
- const taskTimeout = setTimeout(() => {
46
- // Mark in-progress steps as failed on task timeout
47
- }, TASK_TIMEOUT_S * 1000);
48
- try {
49
- for (const step of task.steps) {
50
- const result = await this.executeStep(task, step);
51
- stepResults.push(result);
52
- if (result.status === 'failed') {
53
- this.updateProgress(task.id, step, 'failed');
54
- break;
55
- }
56
- this.updateProgress(task.id, step, 'completed');
57
- }
58
- }
59
- finally {
60
- clearTimeout(taskTimeout);
61
- }
62
- const completedAt = new Date().toISOString();
63
- const totalDurationMs = Date.now() - startMs;
64
- const allCompleted = stepResults.every((r) => r.status === 'completed');
65
- const hasFailed = stepResults.some((r) => r.status === 'failed');
66
- this.finalizeProgress(task.id, hasFailed ? 'failed' : 'completed');
67
- return {
68
- taskId: task.id,
69
- mode,
70
- status: allCompleted ? 'completed' : hasFailed ? 'failed' : 'partial',
71
- stepResults,
72
- totalDurationMs,
73
- startedAt,
74
- completedAt,
75
- };
76
- }
77
- getProgress(taskId) {
78
- return this.progress.get(taskId);
79
- }
80
- getDecomposer() {
81
- return this.decomposer;
82
- }
83
- getProtocol() {
84
- return this.protocol;
85
- }
86
- async executeStep(task, step) {
87
- const assignment = this.protocol.assignAgent(step);
88
- const stepStartMs = Date.now();
89
- const stepStartedAt = new Date().toISOString();
90
- this.updateProgress(task.id, step, 'in_progress');
91
- // Emit step start event
92
- this.emitStepEvent(task, step, assignment, 'started');
93
- // Risk check via sentinel
94
- const actionForSentinel = {
95
- agentId: assignment.agentName,
96
- actionType: this.stepTypeToActionType(step.type),
97
- target: task.originalPrompt.slice(0, 200),
98
- params: {},
99
- };
100
- const riskResult = this.sentinel.intercept(actionForSentinel);
101
- // If HIGH risk in auto mode, request confirmation
102
- if (!riskResult.allowed && riskResult.policyDecision.requiredAction === 'confirm') {
103
- if (this.confirmationManager) {
104
- const riskAssessment = {
105
- riskLevel: riskResult.riskLevel,
106
- score: 80,
107
- factors: riskResult.policyDecision.matchedPolicies,
108
- reasoning: riskResult.policyDecision.reason,
109
- };
110
- const confirmation = await this.confirmationManager.requestConfirmation(actionForSentinel, riskAssessment);
111
- if (confirmation.status !== 'approved') {
112
- return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'failed', undefined, `Step blocked: ${confirmation.status}`);
113
- }
114
- }
115
- else {
116
- return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'failed', undefined, 'HIGH risk step requires confirmation but no ConfirmationManager configured');
117
- }
118
- }
119
- // If blocked outright, fail
120
- if (!riskResult.allowed && riskResult.policyDecision.requiredAction === 'block') {
121
- return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'failed', undefined, `Step blocked by policy: ${riskResult.policyDecision.reason}`);
122
- }
123
- // Execute the step
124
- if (this.stepExecutor) {
125
- try {
126
- const execResult = await this.executeWithTimeout(this.stepExecutor(step, assignment), this.maxStepTimeoutS * 1000);
127
- if (!execResult.success && this.protocol.canRetry(step.id)) {
128
- this.protocol.recordRetry(step.id);
129
- const retryResult = await this.executeWithTimeout(this.stepExecutor(step, assignment), this.maxStepTimeoutS * 1000);
130
- return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, retryResult.success ? 'completed' : 'failed', retryResult.output, retryResult.error);
131
- }
132
- return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, execResult.success ? 'completed' : 'failed', execResult.output, execResult.error);
133
- }
134
- catch (err) {
135
- return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'failed', undefined, err instanceof Error ? err.message : String(err));
136
- }
137
- }
138
- // No executor: mark as completed (dry-run)
139
- return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'completed', 'dry-run');
140
- }
141
- buildSuggestResult(task, mode, startedAt, startMs) {
142
- const completedAt = new Date().toISOString();
143
- return {
144
- taskId: task.id,
145
- mode,
146
- status: 'suggested',
147
- stepResults: task.steps.map((step) => ({
148
- stepId: step.id,
149
- status: 'pending',
150
- agentName: this.protocol.assignAgent(step).agentName,
151
- startedAt,
152
- completedAt,
153
- durationMs: 0,
154
- })),
155
- totalDurationMs: Date.now() - startMs,
156
- startedAt,
157
- completedAt,
158
- };
159
- }
160
- buildStepResult(step, assignment, startedAt, startMs, status, output, error) {
161
- const completedAt = new Date().toISOString();
162
- this.emitStepEvent({ id: step.id }, step, assignment, status === 'completed' ? 'completed' : 'failed');
163
- return {
164
- stepId: step.id,
165
- status,
166
- agentName: assignment.agentName,
167
- output,
168
- error,
169
- startedAt,
170
- completedAt,
171
- durationMs: Date.now() - startMs,
172
- };
173
- }
174
- emitStepEvent(task, step, assignment, status) {
175
- try {
176
- this.eventBus.emit('action_executed', {
177
- eventType: 'step_execution',
178
- sourceAgentId: assignment.agentName,
179
- payload: {
180
- taskId: task.id,
181
- stepId: step.id,
182
- stepType: step.type,
183
- status,
184
- agentName: assignment.agentName,
185
- },
186
- });
187
- }
188
- catch {
189
- // Non-critical
190
- }
191
- }
192
- stepTypeToActionType(type) {
193
- switch (type) {
194
- case 'implement': return 'file_write';
195
- case 'test': return 'bash_exec';
196
- case 'deploy': return 'bash_exec';
197
- default: return 'skill_generate';
198
- }
199
- }
200
- async executeWithTimeout(promise, timeoutMs) {
201
- return new Promise((resolve, reject) => {
202
- const timer = setTimeout(() => {
203
- reject(new Error(`Step execution timed out after ${timeoutMs / 1000}s`));
204
- }, timeoutMs);
205
- promise
206
- .then((result) => { clearTimeout(timer); resolve(result); })
207
- .catch((err) => { clearTimeout(timer); reject(err); });
208
- });
209
- }
210
- initProgress(task) {
211
- this.progress.set(task.id, {
212
- taskId: task.id,
213
- totalSteps: task.steps.length,
214
- completedSteps: 0,
215
- currentStep: null,
216
- percentComplete: 0,
217
- status: 'running',
218
- });
219
- }
220
- updateProgress(taskId, step, status) {
221
- const p = this.progress.get(taskId);
222
- if (!p)
223
- return;
224
- if (status === 'in_progress') {
225
- p.currentStep = step.id;
226
- }
227
- else if (status === 'completed') {
228
- p.completedSteps++;
229
- p.percentComplete = Math.round((p.completedSteps / p.totalSteps) * 100);
230
- }
231
- else if (status === 'failed') {
232
- p.status = 'failed';
233
- }
234
- }
235
- finalizeProgress(taskId, status) {
236
- const p = this.progress.get(taskId);
237
- if (!p)
238
- return;
239
- p.status = status;
240
- p.currentStep = null;
241
- if (status === 'completed') {
242
- p.percentComplete = 100;
243
- }
244
- }
245
- }
246
- //# sourceMappingURL=AutonomyOrchestrator.js.map