@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,267 +0,0 @@
1
- /**
2
- * ProgressTracker - Structured progress tracking for long-running features
3
- * Inspired by Anthropic's "Effective Harnesses for Long-Running Agents"
4
- */
5
- import fs from 'fs';
6
- import path from 'path';
7
- const DEFAULT_PROGRESS = {
8
- feature: '',
9
- spec: '',
10
- status: 'pending',
11
- currentPhase: 0,
12
- totalPhases: 0,
13
- phases: [],
14
- completedTasks: [],
15
- pendingTasks: [],
16
- blockers: [],
17
- lastUpdated: new Date().toISOString(),
18
- startedAt: new Date().toISOString(),
19
- sessionCount: 0,
20
- };
21
- /**
22
- * Get progress file path for a project
23
- */
24
- export function getProgressPath(projectRoot) {
25
- return path.join(projectRoot, '.claude', 'vibe', 'progress.json');
26
- }
27
- /**
28
- * Load progress state from file
29
- */
30
- export function loadProgress(projectRoot) {
31
- const progressPath = getProgressPath(projectRoot);
32
- try {
33
- if (fs.existsSync(progressPath)) {
34
- const content = fs.readFileSync(progressPath, 'utf-8');
35
- return JSON.parse(content);
36
- }
37
- }
38
- catch {
39
- // Ignore parse errors
40
- }
41
- return null;
42
- }
43
- /**
44
- * Save progress state to file
45
- */
46
- export function saveProgress(projectRoot, progress) {
47
- const progressPath = getProgressPath(projectRoot);
48
- const coreDir = path.dirname(progressPath);
49
- if (!fs.existsSync(coreDir)) {
50
- fs.mkdirSync(coreDir, { recursive: true });
51
- }
52
- progress.lastUpdated = new Date().toISOString();
53
- fs.writeFileSync(progressPath, JSON.stringify(progress, null, 2));
54
- }
55
- /**
56
- * Initialize progress for a new feature
57
- */
58
- export function initProgress(projectRoot, feature, spec, phases) {
59
- const progress = {
60
- ...DEFAULT_PROGRESS,
61
- feature,
62
- spec,
63
- status: 'in_progress',
64
- currentPhase: 1,
65
- totalPhases: phases.length,
66
- phases: phases.map((name, idx) => ({
67
- id: idx + 1,
68
- name,
69
- status: idx === 0 ? 'in_progress' : 'pending',
70
- startedAt: idx === 0 ? new Date().toISOString() : undefined,
71
- })),
72
- pendingTasks: phases.slice(1),
73
- startedAt: new Date().toISOString(),
74
- sessionCount: 1,
75
- };
76
- saveProgress(projectRoot, progress);
77
- return progress;
78
- }
79
- /**
80
- * Update phase progress
81
- */
82
- export function updatePhase(projectRoot, phaseNumber, status, blockers) {
83
- const progress = loadProgress(projectRoot);
84
- if (!progress)
85
- return null;
86
- const phase = progress.phases.find(p => p.id === phaseNumber);
87
- if (phase) {
88
- phase.status = status;
89
- if (status === 'in_progress') {
90
- phase.startedAt = new Date().toISOString();
91
- progress.currentPhase = phaseNumber;
92
- }
93
- else if (status === 'completed') {
94
- phase.completedAt = new Date().toISOString();
95
- progress.completedTasks.push(phase.name);
96
- progress.pendingTasks = progress.pendingTasks.filter(t => t !== phase.name);
97
- // Auto-advance to next phase
98
- const nextPhase = progress.phases.find(p => p.id === phaseNumber + 1);
99
- if (nextPhase) {
100
- nextPhase.status = 'in_progress';
101
- nextPhase.startedAt = new Date().toISOString();
102
- progress.currentPhase = nextPhase.id;
103
- }
104
- else {
105
- // All phases completed
106
- progress.status = 'completed';
107
- }
108
- }
109
- else if (status === 'blocked') {
110
- phase.blockers = blockers;
111
- progress.blockers = blockers || [];
112
- progress.status = 'blocked';
113
- }
114
- }
115
- saveProgress(projectRoot, progress);
116
- return progress;
117
- }
118
- /**
119
- * Add a task to completed list
120
- */
121
- export function completeTask(projectRoot, task) {
122
- const progress = loadProgress(projectRoot);
123
- if (!progress)
124
- return null;
125
- if (!progress.completedTasks.includes(task)) {
126
- progress.completedTasks.push(task);
127
- }
128
- progress.pendingTasks = progress.pendingTasks.filter(t => t !== task);
129
- saveProgress(projectRoot, progress);
130
- return progress;
131
- }
132
- /**
133
- * Record last git commit
134
- */
135
- export function recordCommit(projectRoot, commitHash) {
136
- const progress = loadProgress(projectRoot);
137
- if (!progress)
138
- return null;
139
- progress.lastCommit = commitHash;
140
- saveProgress(projectRoot, progress);
141
- return progress;
142
- }
143
- /**
144
- * Increment session count (called on session restore)
145
- */
146
- export function incrementSession(projectRoot) {
147
- const progress = loadProgress(projectRoot);
148
- if (!progress)
149
- return null;
150
- progress.sessionCount++;
151
- saveProgress(projectRoot, progress);
152
- return progress;
153
- }
154
- /**
155
- * Format progress for display
156
- */
157
- export function formatProgress(progress) {
158
- const lines = [];
159
- const statusIcon = {
160
- pending: '⏳',
161
- in_progress: '🔨',
162
- blocked: '🚫',
163
- completed: '✅',
164
- }[progress.status];
165
- lines.push(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
166
- lines.push(`${statusIcon} Feature: ${progress.feature}`);
167
- lines.push(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
168
- lines.push(`Status: ${progress.status.toUpperCase()}`);
169
- lines.push(`Phase: ${progress.currentPhase}/${progress.totalPhases}`);
170
- lines.push(`Sessions: ${progress.sessionCount}`);
171
- lines.push(``);
172
- lines.push(`Phases:`);
173
- for (const phase of progress.phases) {
174
- const icon = {
175
- pending: '○',
176
- in_progress: '●',
177
- completed: '✓',
178
- blocked: '✗',
179
- }[phase.status];
180
- lines.push(` ${icon} ${phase.id}. ${phase.name}`);
181
- }
182
- if (progress.completedTasks.length > 0) {
183
- lines.push(``);
184
- lines.push(`Completed: ${progress.completedTasks.length} tasks`);
185
- }
186
- if (progress.blockers.length > 0) {
187
- lines.push(``);
188
- lines.push(`⚠️ Blockers:`);
189
- for (const blocker of progress.blockers) {
190
- lines.push(` - ${blocker}`);
191
- }
192
- }
193
- if (progress.lastCommit) {
194
- lines.push(``);
195
- lines.push(`Last commit: ${progress.lastCommit}`);
196
- }
197
- lines.push(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
198
- return lines.join('\n');
199
- }
200
- /**
201
- * Get progress summary for session startup
202
- */
203
- export function getProgressSummary(projectRoot) {
204
- const progress = loadProgress(projectRoot);
205
- if (!progress || progress.status === 'completed')
206
- return null;
207
- const currentPhase = progress.phases.find(p => p.id === progress.currentPhase);
208
- const phaseName = currentPhase?.name || 'Unknown';
209
- return `📋 Active feature: "${progress.feature}" - Phase ${progress.currentPhase}/${progress.totalPhases} (${phaseName})`;
210
- }
211
- /**
212
- * Write plain text progress file (claude-progress.txt)
213
- * Claude가 context compaction 후에도 읽을 수 있는 human-readable 진행 파일
214
- */
215
- export function writeProgressText(projectRoot) {
216
- const progress = loadProgress(projectRoot);
217
- if (!progress)
218
- return;
219
- const progressTextPath = path.join(projectRoot, '.claude', 'vibe', 'claude-progress.txt');
220
- const lines = [];
221
- lines.push(`# Progress: ${progress.feature}`);
222
- lines.push(`Updated: ${new Date().toISOString()}`);
223
- lines.push(`Status: ${progress.status.toUpperCase()}`);
224
- lines.push(`Session: ${progress.sessionCount}`);
225
- lines.push('');
226
- lines.push('## Phases');
227
- for (const phase of progress.phases) {
228
- const icon = { pending: '[ ]', in_progress: '[>]', completed: '[x]', blocked: '[!]' }[phase.status];
229
- lines.push(`${icon} Phase ${phase.id}: ${phase.name}`);
230
- if (phase.blockers?.length) {
231
- for (const b of phase.blockers) {
232
- lines.push(` BLOCKED: ${b}`);
233
- }
234
- }
235
- }
236
- if (progress.completedTasks.length > 0) {
237
- lines.push('');
238
- lines.push('## Completed');
239
- for (const task of progress.completedTasks) {
240
- lines.push(`- ${task}`);
241
- }
242
- }
243
- if (progress.pendingTasks.length > 0) {
244
- lines.push('');
245
- lines.push('## Remaining');
246
- for (const task of progress.pendingTasks) {
247
- lines.push(`- ${task}`);
248
- }
249
- }
250
- if (progress.blockers.length > 0) {
251
- lines.push('');
252
- lines.push('## Blockers');
253
- for (const blocker of progress.blockers) {
254
- lines.push(`- ${blocker}`);
255
- }
256
- }
257
- if (progress.lastCommit) {
258
- lines.push('');
259
- lines.push(`## Last Commit: ${progress.lastCommit}`);
260
- }
261
- const coreDir = path.dirname(progressTextPath);
262
- if (!fs.existsSync(coreDir)) {
263
- fs.mkdirSync(coreDir, { recursive: true });
264
- }
265
- fs.writeFileSync(progressTextPath, lines.join('\n') + '\n');
266
- }
267
- //# sourceMappingURL=ProgressTracker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProgressTracker.js","sourceRoot":"","sources":["../../../src/infra/lib/ProgressTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AA2BxB,MAAM,gBAAgB,GAAkB;IACtC,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,MAAM,EAAE,EAAE;IACV,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;IACrC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;IACnC,YAAY,EAAE,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,OAAO,IAAI,CAAC,IAAI,CAAC,WAA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TokenBudgetTracker - In-memory per-session token budget tracker
3
- * Singleton per project (same pattern as MemoryManager)
4
- * Provides predictive overflow prevention with threshold-based warnings
5
- */
6
- export type TokenSource = 'session_rag' | 'memory' | 'agent' | 'compression' | 'tool_call' | 'user_prompt' | 'system';
7
- export type ThresholdLevel = 'none' | 'soft' | 'medium' | 'hard' | 'critical';
8
- export interface BudgetSnapshot {
9
- totalBudget: number;
10
- consumed: number;
11
- remaining: number;
12
- usagePercent: number;
13
- level: ThresholdLevel;
14
- bySource: Record<TokenSource, number>;
15
- crossings: ThresholdCrossing[];
16
- }
17
- export interface ActionEstimate {
18
- action: string;
19
- estimatedTokens: number;
20
- wouldCrossThreshold: boolean;
21
- resultingLevel: ThresholdLevel;
22
- resultingPercent: number;
23
- }
24
- interface ThresholdCrossing {
25
- level: ThresholdLevel;
26
- crossedAt: number;
27
- timestamp: string;
28
- }
29
- export type ThresholdCallback = (level: ThresholdLevel, snapshot: BudgetSnapshot) => void | Promise<void>;
30
- export declare class TokenBudgetTracker {
31
- private static instances;
32
- private static defaultInstance;
33
- private totalBudget;
34
- private consumed;
35
- private bySource;
36
- private crossings;
37
- private lastLevel;
38
- private thresholdCallbacks;
39
- private circuitBreakerFailures;
40
- private static readonly MAX_CIRCUIT_FAILURES;
41
- private constructor();
42
- static getInstance(projectPath?: string, totalBudget?: number): TokenBudgetTracker;
43
- trackConsumption(source: TokenSource, tokens: number): ThresholdLevel;
44
- /**
45
- * 특정 threshold 도달 시 자동 실행할 콜백 등록.
46
- * 예: medium(75%) → 자동 압축, hard(85%) → 경고, critical(95%) → 중단
47
- */
48
- onThreshold(level: ThresholdLevel, callback: ThresholdCallback): void;
49
- /** 회로 차단기: 연속 실패 시 콜백 실행 중단 */
50
- isCircuitOpen(): boolean;
51
- resetCircuitBreaker(): void;
52
- private fireCallbacks;
53
- syncToPercent(percent: number): void;
54
- getRemainingBudget(): number;
55
- getUsagePercent(): number;
56
- estimateAfterAction(action: string, estimatedTokens: number): ActionEstimate;
57
- shouldThrottle(): boolean;
58
- getCurrentLevel(): ThresholdLevel;
59
- getSnapshot(): BudgetSnapshot;
60
- static estimateTokens(text: string): number;
61
- reset(): void;
62
- static resetInstance(): void;
63
- private createEmptySourceMap;
64
- private levelForPercent;
65
- private levelIndex;
66
- }
67
- export {};
68
- //# sourceMappingURL=TokenBudgetTracker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TokenBudgetTracker.d.ts","sourceRoot":"","sources":["../../../src/infra/lib/TokenBudgetTracker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,MAAM,WAAW,GACnB,aAAa,GACb,QAAQ,GACR,OAAO,GACP,aAAa,GACb,WAAW,GACX,aAAa,GACb,QAAQ,CAAC;AAEb,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAE9E,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACtC,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,cAAc,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAsBD,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,KAAK,IAA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;IAQvB,OAAO,CAAC,UAAU;CAGnB"}
@@ -1,191 +0,0 @@
1
- /**
2
- * TokenBudgetTracker - In-memory per-session token budget tracker
3
- * Singleton per project (same pattern as MemoryManager)
4
- * Provides predictive overflow prevention with threshold-based warnings
5
- */
6
- import { TOKENS } from './constants.js';
7
- // ============================================================================
8
- // Constants
9
- // ============================================================================
10
- const THRESHOLD_PERCENTS = {
11
- none: 0,
12
- soft: 65,
13
- medium: 75,
14
- hard: 85,
15
- critical: 95,
16
- };
17
- const ORDERED_LEVELS = [
18
- 'none', 'soft', 'medium', 'hard', 'critical',
19
- ];
20
- export class TokenBudgetTracker {
21
- static instances = new Map();
22
- static defaultInstance = null;
23
- totalBudget;
24
- consumed;
25
- bySource;
26
- crossings;
27
- lastLevel;
28
- thresholdCallbacks;
29
- circuitBreakerFailures;
30
- static MAX_CIRCUIT_FAILURES = 3;
31
- constructor(totalBudget) {
32
- this.totalBudget = totalBudget;
33
- this.consumed = 0;
34
- this.bySource = this.createEmptySourceMap();
35
- this.crossings = [];
36
- this.lastLevel = 'none';
37
- this.thresholdCallbacks = new Map();
38
- this.circuitBreakerFailures = 0;
39
- }
40
- static getInstance(projectPath, totalBudget = TOKENS.DEFAULT_BUDGET) {
41
- if (projectPath) {
42
- const existing = TokenBudgetTracker.instances.get(projectPath);
43
- if (existing)
44
- return existing;
45
- const inst = new TokenBudgetTracker(totalBudget);
46
- TokenBudgetTracker.instances.set(projectPath, inst);
47
- return inst;
48
- }
49
- if (!TokenBudgetTracker.defaultInstance) {
50
- TokenBudgetTracker.defaultInstance = new TokenBudgetTracker(totalBudget);
51
- }
52
- return TokenBudgetTracker.defaultInstance;
53
- }
54
- trackConsumption(source, tokens) {
55
- this.consumed += tokens;
56
- this.bySource[source] += tokens;
57
- const newLevel = this.getCurrentLevel();
58
- if (this.levelIndex(newLevel) > this.levelIndex(this.lastLevel)) {
59
- this.crossings.push({
60
- level: newLevel,
61
- crossedAt: this.consumed,
62
- timestamp: new Date().toISOString(),
63
- });
64
- // 자동 콜백 실행 (회로 차단기 적용)
65
- this.fireCallbacks(newLevel);
66
- }
67
- this.lastLevel = newLevel;
68
- return newLevel;
69
- }
70
- /**
71
- * 특정 threshold 도달 시 자동 실행할 콜백 등록.
72
- * 예: medium(75%) → 자동 압축, hard(85%) → 경고, critical(95%) → 중단
73
- */
74
- onThreshold(level, callback) {
75
- const cbs = this.thresholdCallbacks.get(level) || [];
76
- cbs.push(callback);
77
- this.thresholdCallbacks.set(level, cbs);
78
- }
79
- /** 회로 차단기: 연속 실패 시 콜백 실행 중단 */
80
- isCircuitOpen() {
81
- return this.circuitBreakerFailures >= TokenBudgetTracker.MAX_CIRCUIT_FAILURES;
82
- }
83
- resetCircuitBreaker() {
84
- this.circuitBreakerFailures = 0;
85
- }
86
- fireCallbacks(level) {
87
- if (this.isCircuitOpen())
88
- return;
89
- const callbacks = this.thresholdCallbacks.get(level);
90
- if (!callbacks?.length)
91
- return;
92
- const snapshot = this.getSnapshot();
93
- for (const cb of callbacks) {
94
- try {
95
- const result = cb(level, snapshot);
96
- if (result instanceof Promise) {
97
- result.catch(() => { this.circuitBreakerFailures++; });
98
- }
99
- this.circuitBreakerFailures = 0; // 성공 시 리셋
100
- }
101
- catch {
102
- this.circuitBreakerFailures++;
103
- }
104
- }
105
- }
106
- syncToPercent(percent) {
107
- this.consumed = Math.round(this.totalBudget * (percent / 100));
108
- this.lastLevel = this.getCurrentLevel();
109
- }
110
- getRemainingBudget() {
111
- return Math.max(0, this.totalBudget - this.consumed);
112
- }
113
- getUsagePercent() {
114
- if (this.totalBudget === 0)
115
- return 100;
116
- return Math.min(100, (this.consumed / this.totalBudget) * 100);
117
- }
118
- estimateAfterAction(action, estimatedTokens) {
119
- const projectedConsumed = this.consumed + estimatedTokens;
120
- const projectedPercent = Math.min(100, (projectedConsumed / this.totalBudget) * 100);
121
- const projectedLevel = this.levelForPercent(projectedPercent);
122
- const wouldCross = this.levelIndex(projectedLevel) > this.levelIndex(this.lastLevel);
123
- return {
124
- action,
125
- estimatedTokens,
126
- wouldCrossThreshold: wouldCross,
127
- resultingLevel: projectedLevel,
128
- resultingPercent: Math.round(projectedPercent * 100) / 100,
129
- };
130
- }
131
- shouldThrottle() {
132
- return this.getUsagePercent() >= THRESHOLD_PERCENTS.medium;
133
- }
134
- getCurrentLevel() {
135
- return this.levelForPercent(this.getUsagePercent());
136
- }
137
- getSnapshot() {
138
- return {
139
- totalBudget: this.totalBudget,
140
- consumed: this.consumed,
141
- remaining: this.getRemainingBudget(),
142
- usagePercent: Math.round(this.getUsagePercent() * 100) / 100,
143
- level: this.getCurrentLevel(),
144
- bySource: { ...this.bySource },
145
- crossings: [...this.crossings],
146
- };
147
- }
148
- static estimateTokens(text) {
149
- return Math.ceil(text.length * TOKENS.PER_CHAR_ESTIMATE);
150
- }
151
- reset() {
152
- this.consumed = 0;
153
- this.bySource = this.createEmptySourceMap();
154
- this.crossings = [];
155
- this.lastLevel = 'none';
156
- this.circuitBreakerFailures = 0;
157
- }
158
- static resetInstance() {
159
- TokenBudgetTracker.instances.clear();
160
- TokenBudgetTracker.defaultInstance = null;
161
- }
162
- // ========================================================================
163
- // Private helpers
164
- // ========================================================================
165
- createEmptySourceMap() {
166
- return {
167
- session_rag: 0,
168
- memory: 0,
169
- agent: 0,
170
- compression: 0,
171
- tool_call: 0,
172
- user_prompt: 0,
173
- system: 0,
174
- };
175
- }
176
- levelForPercent(percent) {
177
- if (percent >= THRESHOLD_PERCENTS.critical)
178
- return 'critical';
179
- if (percent >= THRESHOLD_PERCENTS.hard)
180
- return 'hard';
181
- if (percent >= THRESHOLD_PERCENTS.medium)
182
- return 'medium';
183
- if (percent >= THRESHOLD_PERCENTS.soft)
184
- return 'soft';
185
- return 'none';
186
- }
187
- levelIndex(level) {
188
- return ORDERED_LEVELS.indexOf(level);
189
- }
190
- }
191
- //# sourceMappingURL=TokenBudgetTracker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TokenBudgetTracker.js","sourceRoot":"","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OAAO,UAAU,CAAC;QAC9D,IAAI,OAAO,IAAI,kBAAkB,CAAC,IAAI;YAAE,OAAO,MAAM,CAAC;QACtD,IAAI,OAAO,IAAI,kBAAkB,CAAC,MAAM;YAAE,OAAO,QAAQ,CAAC;QAC1D,IAAI,OAAO,IAAI,kBAAkB,CAAC,IAAI;YAAE,OAAO,MAAM,CAAC;QACtD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,UAAU,CAAC,KAAqB;QACtC,OAAO,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC"}
@@ -1,63 +0,0 @@
1
- import type Database from 'better-sqlite3';
2
- import type { RiskLevel, OutcomeType } from './schemas.js';
3
- export interface AuditEventRow {
4
- id: string;
5
- correlationId: string;
6
- causationId: string | null;
7
- eventType: string;
8
- agentId: string | null;
9
- actionType: string | null;
10
- riskLevel: string | null;
11
- payload: string;
12
- outcome: string | null;
13
- createdAt: string;
14
- }
15
- export interface AuditQueryFilters {
16
- agentId?: string;
17
- eventType?: string;
18
- riskLevel?: RiskLevel;
19
- outcome?: OutcomeType;
20
- startDate?: string;
21
- endDate?: string;
22
- limit?: number;
23
- offset?: number;
24
- }
25
- export interface AuditStats {
26
- totalEvents: number;
27
- byEventType: Record<string, number>;
28
- byRiskLevel: Record<string, number>;
29
- blockedCount: number;
30
- blockedRate: number;
31
- }
32
- export interface AuditRecordInput {
33
- correlationId: string;
34
- causationId?: string;
35
- eventType: string;
36
- agentId?: string;
37
- actionType?: string;
38
- riskLevel?: string;
39
- payload: Record<string, unknown>;
40
- outcome?: string;
41
- }
42
- interface StorageProvider {
43
- getDatabase(): Database.Database;
44
- }
45
- export declare class AuditStore {
46
- private readonly db;
47
- private readonly insertStmt;
48
- private fts5Available;
49
- constructor(storage: StorageProvider);
50
- private initTables;
51
- static redactSensitive(payload: string): string;
52
- record(event: AuditRecordInput): string;
53
- recordBatch(events: AuditRecordInput[]): string[];
54
- query(filters: AuditQueryFilters): AuditEventRow[];
55
- getByCorrelation(correlationId: string): AuditEventRow[];
56
- getStats(dateRange?: {
57
- startDate: string;
58
- endDate: string;
59
- }): AuditStats;
60
- search(query: string, limit?: number): AuditEventRow[];
61
- }
62
- export {};
63
- //# sourceMappingURL=AuditStore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuditStore.d.ts","sourceRoot":"","sources":["../../../../src/infra/lib/autonomy/AuditStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAc3D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,MA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