agentic-flow 2.0.2 → 2.0.4

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 (324) hide show
  1. package/.claude/agents/test-neural.md +14 -0
  2. package/.claude/settings.json +9 -133
  3. package/README.md +622 -1862
  4. package/dist/.tsbuildinfo +1 -1
  5. package/dist/billing/mcp/tools.js +0 -1
  6. package/dist/billing/mcp/tools.js.map +1 -1
  7. package/dist/cli/commands/hooks.d.ts.map +1 -1
  8. package/dist/cli/commands/hooks.js +4 -79
  9. package/dist/cli/commands/hooks.js.map +1 -1
  10. package/dist/cli-proxy.js +1 -89
  11. package/dist/cli-proxy.js.map +1 -1
  12. package/dist/core/agentdb-fast.js +3 -3
  13. package/dist/core/agentdb-fast.js.map +1 -1
  14. package/dist/core/agentdb-wrapper-enhanced.d.ts.map +1 -1
  15. package/dist/core/agentdb-wrapper-enhanced.js +4 -20
  16. package/dist/core/agentdb-wrapper-enhanced.js.map +1 -1
  17. package/dist/core/agentdb-wrapper.d.ts +2 -3
  18. package/dist/core/agentdb-wrapper.d.ts.map +1 -1
  19. package/dist/core/agentdb-wrapper.js +1 -15
  20. package/dist/core/agentdb-wrapper.js.map +1 -1
  21. package/dist/core/attention-native.d.ts +0 -4
  22. package/dist/core/attention-native.d.ts.map +1 -1
  23. package/dist/core/attention-native.js +2 -14
  24. package/dist/core/attention-native.js.map +1 -1
  25. package/dist/federation/SecurityManager.d.ts +2 -11
  26. package/dist/federation/SecurityManager.d.ts.map +1 -1
  27. package/dist/federation/SecurityManager.js +17 -50
  28. package/dist/federation/SecurityManager.js.map +1 -1
  29. package/dist/federation/integrations/supabase-adapter-debug.js +3 -3
  30. package/dist/federation/integrations/supabase-adapter-debug.js.map +1 -1
  31. package/dist/hooks/swarm-learning-optimizer.js +5 -5
  32. package/dist/hooks/swarm-learning-optimizer.js.map +1 -1
  33. package/dist/intelligence/IntelligenceStore.d.ts +26 -35
  34. package/dist/intelligence/IntelligenceStore.d.ts.map +1 -1
  35. package/dist/intelligence/IntelligenceStore.js +123 -308
  36. package/dist/intelligence/IntelligenceStore.js.map +1 -1
  37. package/dist/intelligence/RuVectorIntelligence.d.ts +1 -26
  38. package/dist/intelligence/RuVectorIntelligence.d.ts.map +1 -1
  39. package/dist/intelligence/RuVectorIntelligence.js +10 -49
  40. package/dist/intelligence/RuVectorIntelligence.js.map +1 -1
  41. package/dist/intelligence/agent-booster-enhanced.d.ts +0 -1
  42. package/dist/intelligence/agent-booster-enhanced.d.ts.map +1 -1
  43. package/dist/intelligence/agent-booster-enhanced.js +3 -24
  44. package/dist/intelligence/agent-booster-enhanced.js.map +1 -1
  45. package/dist/intelligence/index.d.ts +3 -29
  46. package/dist/intelligence/index.d.ts.map +1 -1
  47. package/dist/intelligence/index.js +3 -13
  48. package/dist/intelligence/index.js.map +1 -1
  49. package/dist/mcp/claudeFlowSdkServer.d.ts.map +1 -1
  50. package/dist/mcp/claudeFlowSdkServer.js +3 -9
  51. package/dist/mcp/claudeFlowSdkServer.js.map +1 -1
  52. package/dist/mcp/fastmcp/tools/hooks/intelligence-bridge.js +5 -5
  53. package/dist/mcp/fastmcp/tools/hooks/intelligence-bridge.js.map +1 -1
  54. package/dist/mcp/fastmcp/tools/swarm/init.d.ts.map +1 -1
  55. package/dist/mcp/fastmcp/tools/swarm/init.js +7 -36
  56. package/dist/mcp/fastmcp/tools/swarm/init.js.map +1 -1
  57. package/dist/mcp/fastmcp/tools/swarm/spawn.d.ts.map +1 -1
  58. package/dist/mcp/fastmcp/tools/swarm/spawn.js +8 -47
  59. package/dist/mcp/fastmcp/tools/swarm/spawn.js.map +1 -1
  60. package/dist/mcp/tools/agent-booster-tools.d.ts +1 -1
  61. package/dist/mcp/tools/agent-booster-tools.d.ts.map +1 -1
  62. package/dist/mcp/tools/agent-booster-tools.js +4 -10
  63. package/dist/mcp/tools/agent-booster-tools.js.map +1 -1
  64. package/dist/mcp/tools/sona-tools.d.ts.map +1 -1
  65. package/dist/mcp/tools/sona-tools.js +0 -6
  66. package/dist/mcp/tools/sona-tools.js.map +1 -1
  67. package/dist/optimizations/agent-booster-migration.d.ts.map +1 -1
  68. package/dist/optimizations/agent-booster-migration.js +2 -5
  69. package/dist/optimizations/agent-booster-migration.js.map +1 -1
  70. package/dist/proxy/anthropic-to-openrouter.js.map +1 -1
  71. package/dist/proxy/anthropic-to-requesty.js.map +1 -1
  72. package/dist/proxy/quic-proxy.d.ts +1 -0
  73. package/dist/proxy/quic-proxy.d.ts.map +1 -1
  74. package/dist/proxy/quic-proxy.js +2 -2
  75. package/dist/proxy/quic-proxy.js.map +1 -1
  76. package/dist/reasoningbank/AdvancedMemory.js +1 -1
  77. package/dist/reasoningbank/AdvancedMemory.js.map +1 -1
  78. package/dist/reasoningbank/HybridBackend.d.ts.map +1 -1
  79. package/dist/reasoningbank/HybridBackend.js +5 -2
  80. package/dist/reasoningbank/HybridBackend.js.map +1 -1
  81. package/dist/reasoningbank/backend-selector.d.ts +1 -11
  82. package/dist/reasoningbank/backend-selector.d.ts.map +1 -1
  83. package/dist/reasoningbank/backend-selector.js +5 -45
  84. package/dist/reasoningbank/backend-selector.js.map +1 -1
  85. package/dist/reasoningbank/core/consolidate.d.ts.map +1 -1
  86. package/dist/reasoningbank/core/consolidate.js +45 -113
  87. package/dist/reasoningbank/core/consolidate.js.map +1 -1
  88. package/dist/reasoningbank/index-new.d.ts +6 -1
  89. package/dist/reasoningbank/index-new.d.ts.map +1 -1
  90. package/dist/reasoningbank/index-new.js +6 -1
  91. package/dist/reasoningbank/index-new.js.map +1 -1
  92. package/dist/reasoningbank/index.d.ts +6 -2
  93. package/dist/reasoningbank/index.d.ts.map +1 -1
  94. package/dist/reasoningbank/index.js +6 -2
  95. package/dist/reasoningbank/index.js.map +1 -1
  96. package/dist/reasoningbank/utils/embeddings.d.ts +0 -1
  97. package/dist/reasoningbank/utils/embeddings.d.ts.map +1 -1
  98. package/dist/reasoningbank/utils/embeddings.js +26 -53
  99. package/dist/reasoningbank/utils/embeddings.js.map +1 -1
  100. package/dist/router/index.d.ts +17 -0
  101. package/dist/router/index.d.ts.map +1 -0
  102. package/dist/router/index.js +19 -0
  103. package/dist/router/index.js.map +1 -0
  104. package/dist/router/providers/onnx-local-optimized.d.ts +0 -2
  105. package/dist/router/providers/onnx-local-optimized.d.ts.map +1 -1
  106. package/dist/router/providers/onnx-local-optimized.js +0 -10
  107. package/dist/router/providers/onnx-local-optimized.js.map +1 -1
  108. package/dist/router/providers/onnx-local.d.ts +0 -1
  109. package/dist/router/providers/onnx-local.d.ts.map +1 -1
  110. package/dist/router/providers/onnx-local.js +5 -22
  111. package/dist/router/providers/onnx-local.js.map +1 -1
  112. package/dist/services/embedding-service.js.map +1 -1
  113. package/dist/services/sona-agent-training.d.ts +0 -1
  114. package/dist/services/sona-agent-training.d.ts.map +1 -1
  115. package/dist/services/sona-agent-training.js.map +1 -1
  116. package/dist/services/sona-agentdb-integration.d.ts.map +1 -1
  117. package/dist/services/sona-agentdb-integration.js +6 -9
  118. package/dist/services/sona-agentdb-integration.js.map +1 -1
  119. package/dist/services/sona-service.d.ts.map +1 -1
  120. package/dist/services/sona-service.js +5 -6
  121. package/dist/services/sona-service.js.map +1 -1
  122. package/dist/utils/cli.d.ts +1 -1
  123. package/dist/utils/cli.d.ts.map +1 -1
  124. package/dist/utils/cli.js +0 -21
  125. package/dist/utils/cli.js.map +1 -1
  126. package/package.json +7 -19
  127. package/scripts/postinstall.js +4 -45
  128. package/wasm/reasoningbank/reasoningbank_wasm_bg.js +2 -2
  129. package/wasm/reasoningbank/reasoningbank_wasm_bg.wasm +0 -0
  130. package/.claude/agents/.claude-flow/metrics/agent-metrics.json +0 -1
  131. package/.claude/agents/.claude-flow/metrics/performance.json +0 -87
  132. package/.claude/agents/.claude-flow/metrics/task-metrics.json +0 -10
  133. package/.claude/skills/.claude-flow/metrics/agent-metrics.json +0 -1
  134. package/.claude/skills/.claude-flow/metrics/performance.json +0 -87
  135. package/.claude/skills/.claude-flow/metrics/task-metrics.json +0 -10
  136. package/.claude/skills/agentic-flow-quickstart/skill.md +0 -69
  137. package/.claude/skills/hooks-automation/skill.md +0 -155
  138. package/.claude/skills/memory-patterns/skill.md +0 -110
  139. package/.claude/skills/skill-builder/.claude-flow/metrics/agent-metrics.json +0 -1
  140. package/.claude/skills/skill-builder/.claude-flow/metrics/performance.json +0 -87
  141. package/.claude/skills/skill-builder/.claude-flow/metrics/task-metrics.json +0 -10
  142. package/.claude/skills/sparc-methodology/skill.md +0 -137
  143. package/.claude/skills/swarm-coordination/skill.md +0 -94
  144. package/.claude/skills/worker-benchmarks/skill.md +0 -135
  145. package/.claude/skills/worker-integration/skill.md +0 -154
  146. package/.claude/statusline.mjs +0 -109
  147. package/.claude/statusline.sh +0 -71
  148. package/dist/agentdb/benchmarks/comprehensive-benchmark.js +0 -664
  149. package/dist/agentdb/benchmarks/frontier-benchmark.js +0 -419
  150. package/dist/agentdb/benchmarks/reflexion-benchmark.js +0 -370
  151. package/dist/agentdb/cli/agentdb-cli.js +0 -717
  152. package/dist/agentdb/controllers/CausalMemoryGraph.js +0 -322
  153. package/dist/agentdb/controllers/CausalRecall.js +0 -281
  154. package/dist/agentdb/controllers/EmbeddingService.d.ts +0 -37
  155. package/dist/agentdb/controllers/EmbeddingService.d.ts.map +0 -1
  156. package/dist/agentdb/controllers/EmbeddingService.js +0 -119
  157. package/dist/agentdb/controllers/EmbeddingService.js.map +0 -1
  158. package/dist/agentdb/controllers/ExplainableRecall.js +0 -387
  159. package/dist/agentdb/controllers/NightlyLearner.js +0 -382
  160. package/dist/agentdb/controllers/ReflexionMemory.js +0 -239
  161. package/dist/agentdb/controllers/SkillLibrary.js +0 -276
  162. package/dist/agentdb/controllers/frontier-index.js +0 -9
  163. package/dist/agentdb/controllers/index.js +0 -8
  164. package/dist/agentdb/optimizations/BatchOperations.js +0 -198
  165. package/dist/agentdb/optimizations/QueryOptimizer.js +0 -225
  166. package/dist/agentdb/optimizations/index.js +0 -7
  167. package/dist/agentdb/tests/frontier-features.test.js +0 -665
  168. package/dist/benchmarks/embeddings-benchmark.d.ts +0 -38
  169. package/dist/benchmarks/embeddings-benchmark.d.ts.map +0 -1
  170. package/dist/benchmarks/embeddings-benchmark.js +0 -282
  171. package/dist/benchmarks/embeddings-benchmark.js.map +0 -1
  172. package/dist/cli/commands/embeddings.d.ts +0 -12
  173. package/dist/cli/commands/embeddings.d.ts.map +0 -1
  174. package/dist/cli/commands/embeddings.js +0 -386
  175. package/dist/cli/commands/embeddings.js.map +0 -1
  176. package/dist/cli/commands/init.d.ts +0 -8
  177. package/dist/cli/commands/init.d.ts.map +0 -1
  178. package/dist/cli/commands/init.js +0 -514
  179. package/dist/cli/commands/init.js.map +0 -1
  180. package/dist/cli/commands/workers.d.ts +0 -9
  181. package/dist/cli/commands/workers.d.ts.map +0 -1
  182. package/dist/cli/commands/workers.js +0 -991
  183. package/dist/cli/commands/workers.js.map +0 -1
  184. package/dist/cli/skills-manager.js +0 -1297
  185. package/dist/cli/update-message.js +0 -175
  186. package/dist/embeddings/index.d.ts +0 -17
  187. package/dist/embeddings/index.d.ts.map +0 -1
  188. package/dist/embeddings/index.js +0 -17
  189. package/dist/embeddings/index.js.map +0 -1
  190. package/dist/embeddings/neural-substrate.d.ts +0 -206
  191. package/dist/embeddings/neural-substrate.d.ts.map +0 -1
  192. package/dist/embeddings/neural-substrate.js +0 -629
  193. package/dist/embeddings/neural-substrate.js.map +0 -1
  194. package/dist/embeddings/optimized-embedder.d.ts +0 -103
  195. package/dist/embeddings/optimized-embedder.d.ts.map +0 -1
  196. package/dist/embeddings/optimized-embedder.js +0 -730
  197. package/dist/embeddings/optimized-embedder.js.map +0 -1
  198. package/dist/examples/embedding-geometry.d.ts +0 -105
  199. package/dist/examples/embedding-geometry.d.ts.map +0 -1
  200. package/dist/examples/embedding-geometry.js +0 -528
  201. package/dist/examples/embedding-geometry.js.map +0 -1
  202. package/dist/memory/SharedMemoryPool.d.ts +0 -129
  203. package/dist/memory/SharedMemoryPool.d.ts.map +0 -1
  204. package/dist/memory/SharedMemoryPool.js +0 -243
  205. package/dist/memory/SharedMemoryPool.js.map +0 -1
  206. package/dist/memory/index.d.ts +0 -8
  207. package/dist/memory/index.d.ts.map +0 -1
  208. package/dist/memory/index.js +0 -7
  209. package/dist/memory/index.js.map +0 -1
  210. package/dist/proxy/http3-proxy-old.js +0 -331
  211. package/dist/proxy/proxy/anthropic-to-gemini.js +0 -439
  212. package/dist/proxy/utils/logger.js +0 -59
  213. package/dist/reasoningbank/agentdb-adapter.js +0 -125
  214. package/dist/reasoningbank/core/database.js +0 -250
  215. package/dist/reasoningbank/core/memory-engine.js +0 -335
  216. package/dist/swarm/ipfs-swarm.d.ts +0 -265
  217. package/dist/swarm/ipfs-swarm.d.ts.map +0 -1
  218. package/dist/swarm/ipfs-swarm.js +0 -508
  219. package/dist/swarm/ipfs-swarm.js.map +0 -1
  220. package/dist/swarm/p2p-free-swarm.d.ts +0 -344
  221. package/dist/swarm/p2p-free-swarm.d.ts.map +0 -1
  222. package/dist/swarm/p2p-free-swarm.js +0 -603
  223. package/dist/swarm/p2p-free-swarm.js.map +0 -1
  224. package/dist/swarm/real-p2p-swarm.d.ts +0 -183
  225. package/dist/swarm/real-p2p-swarm.d.ts.map +0 -1
  226. package/dist/swarm/real-p2p-swarm.js +0 -469
  227. package/dist/swarm/real-p2p-swarm.js.map +0 -1
  228. package/dist/utils/adaptive-pool-sizing.js +0 -414
  229. package/dist/utils/agentdbCommands.js +0 -175
  230. package/dist/utils/circular-rate-limiter.js +0 -391
  231. package/dist/utils/dynamic-compression.js +0 -298
  232. package/dist/utils/http2-multiplexing.js +0 -319
  233. package/dist/utils/index.d.ts +0 -6
  234. package/dist/utils/index.d.ts.map +0 -1
  235. package/dist/utils/index.js +0 -6
  236. package/dist/utils/index.js.map +0 -1
  237. package/dist/utils/lazy-auth.js +0 -311
  238. package/dist/utils/model-cache.d.ts +0 -61
  239. package/dist/utils/model-cache.d.ts.map +0 -1
  240. package/dist/utils/model-cache.js +0 -176
  241. package/dist/utils/model-cache.js.map +0 -1
  242. package/dist/utils/server-push.js +0 -251
  243. package/dist/utils/suppress-warnings.d.ts +0 -19
  244. package/dist/utils/suppress-warnings.d.ts.map +0 -1
  245. package/dist/utils/suppress-warnings.js +0 -59
  246. package/dist/utils/suppress-warnings.js.map +0 -1
  247. package/dist/utils/zero-copy-buffer.js +0 -286
  248. package/dist/workers/consolidated-phases.d.ts +0 -40
  249. package/dist/workers/consolidated-phases.d.ts.map +0 -1
  250. package/dist/workers/consolidated-phases.js +0 -497
  251. package/dist/workers/consolidated-phases.js.map +0 -1
  252. package/dist/workers/custom-worker-config.d.ts +0 -133
  253. package/dist/workers/custom-worker-config.d.ts.map +0 -1
  254. package/dist/workers/custom-worker-config.js +0 -215
  255. package/dist/workers/custom-worker-config.js.map +0 -1
  256. package/dist/workers/custom-worker-factory.d.ts +0 -89
  257. package/dist/workers/custom-worker-factory.d.ts.map +0 -1
  258. package/dist/workers/custom-worker-factory.js +0 -404
  259. package/dist/workers/custom-worker-factory.js.map +0 -1
  260. package/dist/workers/dispatch-service.d.ts +0 -123
  261. package/dist/workers/dispatch-service.d.ts.map +0 -1
  262. package/dist/workers/dispatch-service.js +0 -1024
  263. package/dist/workers/dispatch-service.js.map +0 -1
  264. package/dist/workers/hooks-integration.d.ts +0 -79
  265. package/dist/workers/hooks-integration.d.ts.map +0 -1
  266. package/dist/workers/hooks-integration.js +0 -286
  267. package/dist/workers/hooks-integration.js.map +0 -1
  268. package/dist/workers/index.d.ts +0 -42
  269. package/dist/workers/index.d.ts.map +0 -1
  270. package/dist/workers/index.js +0 -52
  271. package/dist/workers/index.js.map +0 -1
  272. package/dist/workers/mcp-tools.d.ts +0 -56
  273. package/dist/workers/mcp-tools.d.ts.map +0 -1
  274. package/dist/workers/mcp-tools.js +0 -359
  275. package/dist/workers/mcp-tools.js.map +0 -1
  276. package/dist/workers/phase-executors.d.ts +0 -22
  277. package/dist/workers/phase-executors.d.ts.map +0 -1
  278. package/dist/workers/phase-executors.js +0 -445
  279. package/dist/workers/phase-executors.js.map +0 -1
  280. package/dist/workers/resource-governor.d.ts +0 -75
  281. package/dist/workers/resource-governor.d.ts.map +0 -1
  282. package/dist/workers/resource-governor.js +0 -187
  283. package/dist/workers/resource-governor.js.map +0 -1
  284. package/dist/workers/ruvector-integration.d.ts +0 -163
  285. package/dist/workers/ruvector-integration.d.ts.map +0 -1
  286. package/dist/workers/ruvector-integration.js +0 -543
  287. package/dist/workers/ruvector-integration.js.map +0 -1
  288. package/dist/workers/ruvector-native-integration.d.ts +0 -91
  289. package/dist/workers/ruvector-native-integration.d.ts.map +0 -1
  290. package/dist/workers/ruvector-native-integration.js +0 -254
  291. package/dist/workers/ruvector-native-integration.js.map +0 -1
  292. package/dist/workers/trigger-detector.d.ts +0 -68
  293. package/dist/workers/trigger-detector.d.ts.map +0 -1
  294. package/dist/workers/trigger-detector.js +0 -281
  295. package/dist/workers/trigger-detector.js.map +0 -1
  296. package/dist/workers/types.d.ts +0 -145
  297. package/dist/workers/types.d.ts.map +0 -1
  298. package/dist/workers/types.js +0 -6
  299. package/dist/workers/types.js.map +0 -1
  300. package/dist/workers/worker-agent-integration.d.ts +0 -140
  301. package/dist/workers/worker-agent-integration.d.ts.map +0 -1
  302. package/dist/workers/worker-agent-integration.js +0 -471
  303. package/dist/workers/worker-agent-integration.js.map +0 -1
  304. package/dist/workers/worker-benchmarks.d.ts +0 -88
  305. package/dist/workers/worker-benchmarks.d.ts.map +0 -1
  306. package/dist/workers/worker-benchmarks.js +0 -452
  307. package/dist/workers/worker-benchmarks.js.map +0 -1
  308. package/dist/workers/worker-registry.d.ts +0 -85
  309. package/dist/workers/worker-registry.d.ts.map +0 -1
  310. package/dist/workers/worker-registry.js +0 -547
  311. package/dist/workers/worker-registry.js.map +0 -1
  312. package/docs/.claude-flow/metrics/agent-metrics.json +0 -1
  313. package/docs/.claude-flow/metrics/performance.json +0 -87
  314. package/docs/.claude-flow/metrics/task-metrics.json +0 -10
  315. package/docs/embeddings/EMBEDDING_GEOMETRY.md +0 -935
  316. /package/.claude/agents/analysis/{analyze-code-quality.md → code-review/analyze-code-quality.md} +0 -0
  317. /package/.claude/agents/architecture/{arch-system-design.md → system-design/arch-system-design.md} +0 -0
  318. /package/.claude/agents/data/{data-ml-model.md → ml/data-ml-model.md} +0 -0
  319. /package/.claude/agents/development/{dev-backend-api.md → backend/dev-backend-api.md} +0 -0
  320. /package/.claude/agents/devops/{ops-cicd-github.md → ci-cd/ops-cicd-github.md} +0 -0
  321. /package/.claude/agents/documentation/{docs-api-openapi.md → api-docs/docs-api-openapi.md} +0 -0
  322. /package/.claude/agents/specialized/{spec-mobile-react-native.md → mobile/spec-mobile-react-native.md} +0 -0
  323. /package/.claude/agents/testing/{tdd-london-swarm.md → unit/tdd-london-swarm.md} +0 -0
  324. /package/.claude/agents/testing/{production-validator.md → validation/production-validator.md} +0 -0
@@ -2,7 +2,6 @@
2
2
  * MCP Tools for Billing System
3
3
  * Expose billing operations as MCP tools for Claude integration
4
4
  */
5
- import { SubscriptionTier, BillingCycle, UsageMetric, CouponType } from '../types.js';
6
5
  export class BillingMCPTools {
7
6
  billing;
8
7
  tools = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/billing/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAStF,MAAM,OAAO,eAAe;IAClB,OAAO,CAAgB;IACvB,KAAK,GAAyB,IAAI,GAAG,EAAE,CAAC;IAEhD,YAAY,OAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAEO,aAAa;QACnB,qBAAqB;QACrB,IAAI,CAAC,OAAO,CAAC;YACX,IAAI,EAAE,6BAA6B;YACnC,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M,UAAU,oBAAoB,CAAC,MAAW,EAAE,OAAsB;IACtE,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAErC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,CAAC,OAAO,CAAC;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * MCP Tools for Billing System\n * Expose billing operations as MCP tools for Claude integration\n */\n\nimport { BillingSystem } from '../index.js';\nimport { SubscriptionTier, BillingCycle, UsageMetric, CouponType } from '../types.js';\n\nexport interface MCPTool {\n name: string;\n description: string;\n inputSchema: any;\n handler: (params: any) => Promise<any>;\n}\n\nexport class BillingMCPTools {\n private billing: BillingSystem;\n private tools: Map<string, MCPTool> = new Map();\n\n constructor(billing: BillingSystem) {\n this.billing = billing;\n this.registerTools();\n }\n\n private registerTools(): void {\n // Subscription tools\n this.addTool({\n name: 'billing_subscription_create',\n description: 'Create a new subscription for a user',\n inputSchema: {\n type: 'object',\n properties: {\n userId: { type: 'string', description: 'User ID' },\n tier: { type: 'string', enum: Object.values(SubscriptionTier) },\n billingCycle: { type: 'string', enum: Object.values(BillingCycle) },\n paymentMethodId: { type: 'string' },\n couponCode: { type: 'string', optional: true }\n },\n required: ['userId', 'tier', 'billingCycle', 'paymentMethodId']\n },\n handler: async (params) => {\n return await this.billing.subscribe(params);\n }\n });\n\n this.addTool({\n name: 'billing_subscription_upgrade',\n description: 'Upgrade a subscription to a higher tier',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' },\n newTier: { type: 'string', enum: Object.values(SubscriptionTier) }\n },\n required: ['subscriptionId', 'newTier']\n },\n handler: async (params) => {\n return await this.billing.upgrade(params.subscriptionId, params.newTier);\n }\n });\n\n this.addTool({\n name: 'billing_subscription_cancel',\n description: 'Cancel a subscription',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' },\n immediate: { type: 'boolean', optional: true, default: false }\n },\n required: ['subscriptionId']\n },\n handler: async (params) => {\n return await this.billing.cancel(params.subscriptionId, params.immediate);\n }\n });\n\n this.addTool({\n name: 'billing_subscription_get',\n description: 'Get subscription details',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' }\n },\n required: ['subscriptionId']\n },\n handler: async (params) => {\n return await this.billing.subscriptions.getSubscription(params.subscriptionId);\n }\n });\n\n // Usage tools\n this.addTool({\n name: 'billing_usage_record',\n description: 'Record usage for a subscription',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' },\n userId: { type: 'string' },\n metric: { type: 'string', enum: Object.values(UsageMetric) },\n amount: { type: 'number' },\n unit: { type: 'string' }\n },\n required: ['subscriptionId', 'userId', 'metric', 'amount', 'unit']\n },\n handler: async (params) => {\n await this.billing.recordUsage(params);\n return { success: true };\n }\n });\n\n this.addTool({\n name: 'billing_usage_summary',\n description: 'Get usage summary for a subscription',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' }\n },\n required: ['subscriptionId']\n },\n handler: async (params) => {\n return await this.billing.getUsageSummary(params.subscriptionId);\n }\n });\n\n this.addTool({\n name: 'billing_quota_check',\n description: 'Check if subscription is within quota',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' },\n metric: { type: 'string', enum: Object.values(UsageMetric) }\n },\n required: ['subscriptionId', 'metric']\n },\n handler: async (params) => {\n const allowed = await this.billing.checkQuota(params.subscriptionId, params.metric);\n return { allowed, metric: params.metric };\n }\n });\n\n // Pricing tools\n this.addTool({\n name: 'billing_pricing_tiers',\n description: 'List all pricing tiers',\n inputSchema: {\n type: 'object',\n properties: {}\n },\n handler: async () => {\n return this.billing.pricing.getAllTiers();\n }\n });\n\n this.addTool({\n name: 'billing_pricing_calculate',\n description: 'Calculate price for a tier and cycle',\n inputSchema: {\n type: 'object',\n properties: {\n tier: { type: 'string', enum: Object.values(SubscriptionTier) },\n cycle: { type: 'string', enum: ['monthly', 'yearly', 'quarterly'] }\n },\n required: ['tier', 'cycle']\n },\n handler: async (params) => {\n const price = this.billing.pricing.calculatePrice(params.tier, params.cycle);\n return { tier: params.tier, cycle: params.cycle, price };\n }\n });\n\n // Coupon tools\n this.addTool({\n name: 'billing_coupon_create',\n description: 'Create a new coupon',\n inputSchema: {\n type: 'object',\n properties: {\n code: { type: 'string' },\n type: { type: 'string', enum: Object.values(CouponType) },\n value: { type: 'number' },\n description: { type: 'string', optional: true },\n maxRedemptions: { type: 'number', optional: true },\n validUntil: { type: 'string', optional: true }\n },\n required: ['code', 'type', 'value']\n },\n handler: async (params) => {\n return await this.billing.coupons.createCoupon(params);\n }\n });\n\n this.addTool({\n name: 'billing_coupon_validate',\n description: 'Validate a coupon code',\n inputSchema: {\n type: 'object',\n properties: {\n code: { type: 'string' },\n tier: { type: 'string', enum: Object.values(SubscriptionTier) },\n amount: { type: 'number' }\n },\n required: ['code', 'tier', 'amount']\n },\n handler: async (params) => {\n return await this.billing.coupons.validateCoupon(params.code, params.tier, params.amount);\n }\n });\n }\n\n private addTool(tool: MCPTool): void {\n this.tools.set(tool.name, tool);\n }\n\n /**\n * Get all tools for MCP registration\n */\n getAllTools(): MCPTool[] {\n return Array.from(this.tools.values());\n }\n\n /**\n * Get tool by name\n */\n getTool(name: string): MCPTool | undefined {\n return this.tools.get(name);\n }\n\n /**\n * Execute a tool\n */\n async executeTool(name: string, params: any): Promise<any> {\n const tool = this.tools.get(name);\n if (!tool) {\n throw new Error(`Tool not found: ${name}`);\n }\n\n return await tool.handler(params);\n }\n}\n\n/**\n * Create MCP tools for a billing system\n */\nexport function createBillingMCPTools(billing: BillingSystem): BillingMCPTools {\n return new BillingMCPTools(billing);\n}\n\n/**\n * Export tools for fastMCP registration\n */\nexport function registerBillingTools(server: any, billing: BillingSystem): void {\n const mcpTools = new BillingMCPTools(billing);\n const tools = mcpTools.getAllTools();\n\n tools.forEach(tool => {\n server.addTool({\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n handler: tool.handler\n });\n });\n}\n"]}
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/billing/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,MAAM,OAAO,eAAe;IAClB,OAAO,CAAgB;IACvB,KAAK,GAAyB,IAAI,GAAG,EAAE,CAAC;IAEhD,YAAY,OAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAEO,aAAa;QACnB,qBAAqB;QACrB,IAAI,CAAC,OAAO,CAAC;YACX,IAAI,EAAE,6BAA6B;YACnC,WAAW,EAAE,sCAAsC;YACnD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE;oBAClD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;oBAC/D,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;oBACnE,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACnC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;iBAC/C;gBACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,CAAC;aAChE;YACD,OAAO,EAAE,KAAK,EAAE,MAAM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CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,IAAY,EAAE,MAAW;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAsB;IAC1D,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAW,EAAE,OAAsB;IACtE,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAErC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,CAAC,OAAO,CAAC;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * MCP Tools for Billing System\n * Expose billing operations as MCP tools for Claude integration\n */\n\nimport { BillingSystem } from '../index.js';\nimport type { SubscriptionTier, BillingCycle, UsageMetric, CouponType } from '../types.js';\n\nexport interface MCPTool {\n name: string;\n description: string;\n inputSchema: any;\n handler: (params: any) => Promise<any>;\n}\n\nexport class BillingMCPTools {\n private billing: BillingSystem;\n private tools: Map<string, MCPTool> = new Map();\n\n constructor(billing: BillingSystem) {\n this.billing = billing;\n this.registerTools();\n }\n\n private registerTools(): void {\n // Subscription tools\n this.addTool({\n name: 'billing_subscription_create',\n description: 'Create a new subscription for a user',\n inputSchema: {\n type: 'object',\n properties: {\n userId: { type: 'string', description: 'User ID' },\n tier: { type: 'string', enum: Object.values(SubscriptionTier) },\n billingCycle: { type: 'string', enum: Object.values(BillingCycle) },\n paymentMethodId: { type: 'string' },\n couponCode: { type: 'string', optional: true }\n },\n required: ['userId', 'tier', 'billingCycle', 'paymentMethodId']\n },\n handler: async (params) => {\n return await this.billing.subscribe(params);\n }\n });\n\n this.addTool({\n name: 'billing_subscription_upgrade',\n description: 'Upgrade a subscription to a higher tier',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' },\n newTier: { type: 'string', enum: Object.values(SubscriptionTier) }\n },\n required: ['subscriptionId', 'newTier']\n },\n handler: async (params) => {\n return await this.billing.upgrade(params.subscriptionId, params.newTier);\n }\n });\n\n this.addTool({\n name: 'billing_subscription_cancel',\n description: 'Cancel a subscription',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' },\n immediate: { type: 'boolean', optional: true, default: false }\n },\n required: ['subscriptionId']\n },\n handler: async (params) => {\n return await this.billing.cancel(params.subscriptionId, params.immediate);\n }\n });\n\n this.addTool({\n name: 'billing_subscription_get',\n description: 'Get subscription details',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' }\n },\n required: ['subscriptionId']\n },\n handler: async (params) => {\n return await this.billing.subscriptions.getSubscription(params.subscriptionId);\n }\n });\n\n // Usage tools\n this.addTool({\n name: 'billing_usage_record',\n description: 'Record usage for a subscription',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' },\n userId: { type: 'string' },\n metric: { type: 'string', enum: Object.values(UsageMetric) },\n amount: { type: 'number' },\n unit: { type: 'string' }\n },\n required: ['subscriptionId', 'userId', 'metric', 'amount', 'unit']\n },\n handler: async (params) => {\n await this.billing.recordUsage(params);\n return { success: true };\n }\n });\n\n this.addTool({\n name: 'billing_usage_summary',\n description: 'Get usage summary for a subscription',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' }\n },\n required: ['subscriptionId']\n },\n handler: async (params) => {\n return await this.billing.getUsageSummary(params.subscriptionId);\n }\n });\n\n this.addTool({\n name: 'billing_quota_check',\n description: 'Check if subscription is within quota',\n inputSchema: {\n type: 'object',\n properties: {\n subscriptionId: { type: 'string' },\n metric: { type: 'string', enum: Object.values(UsageMetric) }\n },\n required: ['subscriptionId', 'metric']\n },\n handler: async (params) => {\n const allowed = await this.billing.checkQuota(params.subscriptionId, params.metric);\n return { allowed, metric: params.metric };\n }\n });\n\n // Pricing tools\n this.addTool({\n name: 'billing_pricing_tiers',\n description: 'List all pricing tiers',\n inputSchema: {\n type: 'object',\n properties: {}\n },\n handler: async () => {\n return this.billing.pricing.getAllTiers();\n }\n });\n\n this.addTool({\n name: 'billing_pricing_calculate',\n description: 'Calculate price for a tier and cycle',\n inputSchema: {\n type: 'object',\n properties: {\n tier: { type: 'string', enum: Object.values(SubscriptionTier) },\n cycle: { type: 'string', enum: ['monthly', 'yearly', 'quarterly'] }\n },\n required: ['tier', 'cycle']\n },\n handler: async (params) => {\n const price = this.billing.pricing.calculatePrice(params.tier, params.cycle);\n return { tier: params.tier, cycle: params.cycle, price };\n }\n });\n\n // Coupon tools\n this.addTool({\n name: 'billing_coupon_create',\n description: 'Create a new coupon',\n inputSchema: {\n type: 'object',\n properties: {\n code: { type: 'string' },\n type: { type: 'string', enum: Object.values(CouponType) },\n value: { type: 'number' },\n description: { type: 'string', optional: true },\n maxRedemptions: { type: 'number', optional: true },\n validUntil: { type: 'string', optional: true }\n },\n required: ['code', 'type', 'value']\n },\n handler: async (params) => {\n return await this.billing.coupons.createCoupon(params);\n }\n });\n\n this.addTool({\n name: 'billing_coupon_validate',\n description: 'Validate a coupon code',\n inputSchema: {\n type: 'object',\n properties: {\n code: { type: 'string' },\n tier: { type: 'string', enum: Object.values(SubscriptionTier) },\n amount: { type: 'number' }\n },\n required: ['code', 'tier', 'amount']\n },\n handler: async (params) => {\n return await this.billing.coupons.validateCoupon(params.code, params.tier, params.amount);\n }\n });\n }\n\n private addTool(tool: MCPTool): void {\n this.tools.set(tool.name, tool);\n }\n\n /**\n * Get all tools for MCP registration\n */\n getAllTools(): MCPTool[] {\n return Array.from(this.tools.values());\n }\n\n /**\n * Get tool by name\n */\n getTool(name: string): MCPTool | undefined {\n return this.tools.get(name);\n }\n\n /**\n * Execute a tool\n */\n async executeTool(name: string, params: any): Promise<any> {\n const tool = this.tools.get(name);\n if (!tool) {\n throw new Error(`Tool not found: ${name}`);\n }\n\n return await tool.handler(params);\n }\n}\n\n/**\n * Create MCP tools for a billing system\n */\nexport function createBillingMCPTools(billing: BillingSystem): BillingMCPTools {\n return new BillingMCPTools(billing);\n}\n\n/**\n * Export tools for fastMCP registration\n */\nexport function registerBillingTools(server: any, billing: BillingSystem): void {\n const mcpTools = new BillingMCPTools(billing);\n const tools = mcpTools.getAllTools();\n\n tools.forEach(tool => {\n server.addTool({\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n handler: tool.handler\n });\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hooks.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoCpC,wBAAgB,kBAAkB,IAAI,OAAO,CA+jC5C;AAED,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hooks.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoCpC,wBAAgB,kBAAkB,IAAI,OAAO,CA0/B5C;AAED,eAAe,kBAAkB,CAAC"}
@@ -36,12 +36,7 @@ const mockContext = {
36
36
  };
37
37
  export function createHooksCommand() {
38
38
  const hooks = new Command('hooks')
39
- .description('Self-learning intelligence hooks for agent routing and optimization')
40
- .addHelpCommand(true) // Enable 'hooks help <subcommand>'
41
- .action(() => {
42
- // Default action when no subcommand provided - show help
43
- hooks.outputHelp();
44
- });
39
+ .description('Self-learning intelligence hooks for agent routing and optimization');
45
40
  // Pre-edit hook
46
41
  hooks
47
42
  .command('pre-edit <filePath>')
@@ -63,7 +58,6 @@ export function createHooksCommand() {
63
58
  }
64
59
  console.log(`ā±ļø Latency: ${result.latencyMs}ms`);
65
60
  }
66
- process.exit(0);
67
61
  }
68
62
  catch (error) {
69
63
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -98,7 +92,6 @@ export function createHooksCommand() {
98
92
  console.log(`šŸ“ˆ Pattern updated: ${result.newPatternValue?.toFixed(2) || 'N/A'}`);
99
93
  console.log(`šŸ“Š Routing accuracy: ${(result.routingAccuracy * 100).toFixed(1)}%`);
100
94
  }
101
- process.exit(0);
102
95
  }
103
96
  catch (error) {
104
97
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -132,7 +125,6 @@ export function createHooksCommand() {
132
125
  result.suggestions.forEach((s) => console.log(` - ${s}`));
133
126
  }
134
127
  }
135
- process.exit(0);
136
128
  }
137
129
  catch (error) {
138
130
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -165,7 +157,6 @@ export function createHooksCommand() {
165
157
  console.log(`šŸ” Error type: ${result.errorType}`);
166
158
  }
167
159
  }
168
- process.exit(0);
169
160
  }
170
161
  catch (error) {
171
162
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -207,7 +198,6 @@ export function createHooksCommand() {
207
198
  }
208
199
  console.log(`\nā±ļø Latency: ${result.latencyMs}ms`);
209
200
  }
210
- process.exit(0);
211
201
  }
212
202
  catch (error) {
213
203
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -236,7 +226,6 @@ export function createHooksCommand() {
236
226
  console.log(` ${r.rank}. ${r.agent} - ${(r.score * 100).toFixed(1)}%`);
237
227
  });
238
228
  }
239
- process.exit(0);
240
229
  }
241
230
  catch (error) {
242
231
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -273,7 +262,6 @@ export function createHooksCommand() {
273
262
  }
274
263
  console.log(` ā±ļø Duration: ${result.durationMs}ms`);
275
264
  }
276
- process.exit(0);
277
265
  }
278
266
  catch (error) {
279
267
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -309,7 +297,6 @@ export function createHooksCommand() {
309
297
  console.log(`\n Agents created:`);
310
298
  result.agents.forEach((a) => console.log(` • ${a}`));
311
299
  }
312
- process.exit(0);
313
300
  }
314
301
  catch (error) {
315
302
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -349,7 +336,6 @@ export function createHooksCommand() {
349
336
  result.health.issues.forEach((i) => console.log(` āš ļø ${i}`));
350
337
  }
351
338
  }
352
- process.exit(0);
353
339
  }
354
340
  catch (error) {
355
341
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -385,7 +371,6 @@ export function createHooksCommand() {
385
371
  console.log(` šŸ› ļø Target stack: ${result.targetStack.join(', ')}`);
386
372
  }
387
373
  }
388
- process.exit(0);
389
374
  }
390
375
  catch (error) {
391
376
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -555,14 +540,12 @@ console.log(lines.join('\\n'));
555
540
  fs.writeFileSync(statuslinePath, statuslineContent);
556
541
  console.log(` šŸ“Š Created: ${statuslinePath}`);
557
542
  }
558
- // Create settings with full capabilities
543
+ // Create settings
559
544
  const settings = {
560
545
  env: {
561
546
  AGENTIC_FLOW_INTELLIGENCE: 'true',
562
547
  AGENTIC_FLOW_LEARNING_RATE: '0.1',
563
- AGENTIC_FLOW_MEMORY_BACKEND: 'agentdb',
564
- AGENTIC_FLOW_WORKERS_ENABLED: 'true',
565
- AGENTIC_FLOW_MAX_WORKERS: '10'
548
+ AGENTIC_FLOW_MEMORY_BACKEND: 'agentdb'
566
549
  },
567
550
  hooks: {
568
551
  PreToolUse: [
@@ -596,17 +579,6 @@ console.log(lines.join('\\n'));
596
579
  ]
597
580
  }
598
581
  ],
599
- PostToolUseFailure: [
600
- {
601
- matcher: 'Edit|Write',
602
- hooks: [
603
- {
604
- type: 'command',
605
- command: 'npx agentic-flow hooks post-edit "$TOOL_INPUT_file_path" --fail --error "$ERROR_MESSAGE"'
606
- }
607
- ]
608
- }
609
- ],
610
582
  SessionStart: [
611
583
  {
612
584
  hooks: [
@@ -615,24 +587,6 @@ console.log(lines.join('\\n'));
615
587
  command: 'npx agentic-flow hooks intelligence stats'
616
588
  }
617
589
  ]
618
- },
619
- {
620
- hooks: [
621
- {
622
- type: 'command',
623
- command: 'npx agentic-flow workers status --active --json 2>/dev/null || true'
624
- }
625
- ]
626
- }
627
- ],
628
- SessionEnd: [
629
- {
630
- hooks: [
631
- {
632
- type: 'command',
633
- command: 'npx agentic-flow workers cleanup --age 24 2>/dev/null || true'
634
- }
635
- ]
636
590
  }
637
591
  ],
638
592
  UserPromptSubmit: [
@@ -644,16 +598,6 @@ console.log(lines.join('\\n'));
644
598
  command: 'npx agentic-flow hooks intelligence stats'
645
599
  }
646
600
  ]
647
- },
648
- {
649
- hooks: [
650
- {
651
- type: 'command',
652
- timeout: 5000,
653
- background: true,
654
- command: 'npx agentic-flow workers dispatch-prompt "$USER_PROMPT" --session "$SESSION_ID" --json 2>/dev/null || true'
655
- }
656
- ]
657
601
  }
658
602
  ]
659
603
  },
@@ -661,10 +605,7 @@ console.log(lines.join('\\n'));
661
605
  allow: [
662
606
  'Bash(npx:*)',
663
607
  'Bash(agentic-flow:*)',
664
- 'Bash(npm run:*)',
665
- 'mcp__agentic-flow',
666
- 'mcp__claude-flow',
667
- 'mcp__ruv-swarm'
608
+ 'mcp__agentic-flow'
668
609
  ]
669
610
  },
670
611
  statusLine: options.statusline !== false ? {
@@ -679,7 +620,6 @@ console.log(lines.join('\\n'));
679
620
  console.log(' 1. Run: npx agentic-flow hooks pretrain');
680
621
  console.log(' 2. Run: npx agentic-flow hooks build-agents');
681
622
  console.log(' 3. Start using Claude Code with intelligent routing!');
682
- process.exit(0);
683
623
  }
684
624
  catch (error) {
685
625
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -724,7 +664,6 @@ console.log(lines.join('\\n'));
724
664
  });
725
665
  }
726
666
  }
727
- process.exit(0);
728
667
  }
729
668
  catch (error) {
730
669
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -751,7 +690,6 @@ console.log(lines.join('\\n'));
751
690
  console.log(`🧠 Features: ${result.features?.join(', ')}`);
752
691
  console.log(`\nšŸ’” Use this ID with trajectory-step and trajectory-end commands`);
753
692
  }
754
- process.exit(0);
755
693
  }
756
694
  catch (error) {
757
695
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -787,7 +725,6 @@ console.log(lines.join('\\n'));
787
725
  console.log(` Reward: ${options.reward}`);
788
726
  console.log(` Trajectory: ${trajectoryId}`);
789
727
  }
790
- process.exit(0);
791
728
  }
792
729
  catch (error) {
793
730
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -818,7 +755,6 @@ console.log(lines.join('\\n'));
818
755
  console.log(` Outcome: ${JSON.stringify(result.learningOutcome)}`);
819
756
  }
820
757
  }
821
- process.exit(0);
822
758
  }
823
759
  catch (error) {
824
760
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -845,7 +781,6 @@ console.log(lines.join('\\n'));
845
781
  console.log(` Score: ${((options.score || 0.9) * 100).toFixed(0)}%`);
846
782
  console.log(` Index: HNSW (150x faster retrieval)`);
847
783
  }
848
- process.exit(0);
849
784
  }
850
785
  catch (error) {
851
786
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -877,7 +812,6 @@ console.log(lines.join('\\n'));
877
812
  });
878
813
  }
879
814
  }
880
- process.exit(0);
881
815
  }
882
816
  catch (error) {
883
817
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -917,7 +851,6 @@ console.log(lines.join('\\n'));
917
851
  console.log(` Patterns: ${result.persistence?.patterns ?? 0}`);
918
852
  console.log(` Operations: ${result.persistence?.operations ?? 0}`);
919
853
  }
920
- process.exit(0);
921
854
  }
922
855
  catch (error) {
923
856
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -943,7 +876,6 @@ console.log(lines.join('\\n'));
943
876
  console.log(` Features: ${result.features?.join(', ')}`);
944
877
  console.log(` Latency: ${result.latencyMs?.toFixed(2)}ms`);
945
878
  }
946
- process.exit(0);
947
879
  }
948
880
  catch (error) {
949
881
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -977,7 +909,6 @@ console.log(lines.join('\\n'));
977
909
  });
978
910
  console.log(`\n ā±ļø Latency: ${result.latencyMs?.toFixed(2)}ms`);
979
911
  }
980
- process.exit(0);
981
912
  }
982
913
  catch (error) {
983
914
  console.error('Error:', error instanceof Error ? error.message : error);
@@ -989,10 +920,4 @@ console.log(lines.join('\\n'));
989
920
  return hooks;
990
921
  }
991
922
  export default createHooksCommand;
992
- // CLI entry point when run directly
993
- const isDirectRun = import.meta.url === `file://${process.argv[1]}`;
994
- if (isDirectRun) {
995
- const hooks = createHooksCommand();
996
- hooks.parse(process.argv);
997
- }
998
923
  //# sourceMappingURL=hooks.js.map