claude-flow 3.25.6 → 3.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/.claude/helpers/hook-handler.cjs +129 -0
  2. package/.claude/helpers/intelligence.cjs +10 -0
  3. package/.claude/helpers/statusline.cjs +310 -123
  4. package/.claude/proven-config.json +1 -1
  5. package/.claude/security-scans/scan-all-standard.json +321 -0
  6. package/.claude/security-scans/scan-code-deep.json +1209 -0
  7. package/.claude/security-scans/scan-deps-full.json +14 -0
  8. package/package.json +3 -1
  9. package/v3/@claude-flow/cli/catalog-manifest.json +12 -0
  10. package/v3/@claude-flow/cli/dist/src/commands/advisor.d.ts +15 -0
  11. package/v3/@claude-flow/cli/dist/src/commands/advisor.js +94 -0
  12. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +77 -3
  13. package/v3/@claude-flow/cli/dist/src/commands/funnel.d.ts +13 -0
  14. package/v3/@claude-flow/cli/dist/src/commands/funnel.js +103 -0
  15. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +112 -46
  16. package/v3/@claude-flow/cli/dist/src/commands/index.js +10 -0
  17. package/v3/@claude-flow/cli/dist/src/commands/init.js +44 -0
  18. package/v3/@claude-flow/cli/dist/src/commands/proxy.d.ts +21 -0
  19. package/v3/@claude-flow/cli/dist/src/commands/proxy.js +310 -0
  20. package/v3/@claude-flow/cli/dist/src/commands/security.js +29 -0
  21. package/v3/@claude-flow/cli/dist/src/commands/settings.d.ts +19 -0
  22. package/v3/@claude-flow/cli/dist/src/commands/settings.js +180 -0
  23. package/v3/@claude-flow/cli/dist/src/commands/version.d.ts +42 -0
  24. package/v3/@claude-flow/cli/dist/src/commands/version.js +106 -0
  25. package/v3/@claude-flow/cli/dist/src/funnel/advisor-tip.d.ts +58 -0
  26. package/v3/@claude-flow/cli/dist/src/funnel/advisor-tip.js +92 -0
  27. package/v3/@claude-flow/cli/dist/src/funnel/attribution.d.ts +37 -0
  28. package/v3/@claude-flow/cli/dist/src/funnel/attribution.js +101 -0
  29. package/v3/@claude-flow/cli/dist/src/funnel/consent.d.ts +22 -0
  30. package/v3/@claude-flow/cli/dist/src/funnel/consent.js +55 -0
  31. package/v3/@claude-flow/cli/dist/src/funnel/credit-errors.d.ts +31 -0
  32. package/v3/@claude-flow/cli/dist/src/funnel/credit-errors.js +88 -0
  33. package/v3/@claude-flow/cli/dist/src/funnel/credit-notifier.d.ts +44 -0
  34. package/v3/@claude-flow/cli/dist/src/funnel/credit-notifier.js +74 -0
  35. package/v3/@claude-flow/cli/dist/src/funnel/disclosure.d.ts +46 -0
  36. package/v3/@claude-flow/cli/dist/src/funnel/disclosure.js +97 -0
  37. package/v3/@claude-flow/cli/dist/src/funnel/enrollment.d.ts +36 -0
  38. package/v3/@claude-flow/cli/dist/src/funnel/enrollment.js +64 -0
  39. package/v3/@claude-flow/cli/dist/src/funnel/environment.d.ts +17 -0
  40. package/v3/@claude-flow/cli/dist/src/funnel/environment.js +39 -0
  41. package/v3/@claude-flow/cli/dist/src/funnel/event-transport.d.ts +51 -0
  42. package/v3/@claude-flow/cli/dist/src/funnel/event-transport.js +199 -0
  43. package/v3/@claude-flow/cli/dist/src/funnel/events.d.ts +42 -0
  44. package/v3/@claude-flow/cli/dist/src/funnel/events.js +150 -0
  45. package/v3/@claude-flow/cli/dist/src/funnel/index.d.ts +20 -0
  46. package/v3/@claude-flow/cli/dist/src/funnel/index.js +20 -0
  47. package/v3/@claude-flow/cli/dist/src/funnel/insights.d.ts +49 -0
  48. package/v3/@claude-flow/cli/dist/src/funnel/insights.js +120 -0
  49. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.d.ts +15 -0
  50. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.js +68 -0
  51. package/v3/@claude-flow/cli/dist/src/funnel/message-transport.d.ts +51 -0
  52. package/v3/@claude-flow/cli/dist/src/funnel/message-transport.js +149 -0
  53. package/v3/@claude-flow/cli/dist/src/funnel/messages.d.ts +55 -0
  54. package/v3/@claude-flow/cli/dist/src/funnel/messages.js +160 -0
  55. package/v3/@claude-flow/cli/dist/src/funnel/power-saver-notifier.d.ts +44 -0
  56. package/v3/@claude-flow/cli/dist/src/funnel/power-saver-notifier.js +92 -0
  57. package/v3/@claude-flow/cli/dist/src/funnel/precedence.d.ts +16 -0
  58. package/v3/@claude-flow/cli/dist/src/funnel/precedence.js +85 -0
  59. package/v3/@claude-flow/cli/dist/src/funnel/promo.d.ts +41 -0
  60. package/v3/@claude-flow/cli/dist/src/funnel/promo.js +144 -0
  61. package/v3/@claude-flow/cli/dist/src/funnel/rate-limit-notifier.d.ts +55 -0
  62. package/v3/@claude-flow/cli/dist/src/funnel/rate-limit-notifier.js +102 -0
  63. package/v3/@claude-flow/cli/dist/src/funnel/rotation.d.ts +19 -0
  64. package/v3/@claude-flow/cli/dist/src/funnel/rotation.js +70 -0
  65. package/v3/@claude-flow/cli/dist/src/funnel/state.d.ts +13 -0
  66. package/v3/@claude-flow/cli/dist/src/funnel/state.js +52 -0
  67. package/v3/@claude-flow/cli/dist/src/funnel/toggle-cooldown.d.ts +17 -0
  68. package/v3/@claude-flow/cli/dist/src/funnel/toggle-cooldown.js +32 -0
  69. package/v3/@claude-flow/cli/dist/src/funnel/types.d.ts +86 -0
  70. package/v3/@claude-flow/cli/dist/src/funnel/types.js +26 -0
  71. package/v3/@claude-flow/cli/dist/src/init/executor.js +9 -3
  72. package/v3/@claude-flow/cli/dist/src/init/helper-refresh.d.ts +33 -2
  73. package/v3/@claude-flow/cli/dist/src/init/helper-refresh.js +102 -12
  74. package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +52 -0
  75. package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +292 -116
  76. package/v3/@claude-flow/cli/dist/src/services/daemon-autostart.js +28 -5
  77. package/v3/@claude-flow/cli/dist/src/services/fable-harness.d.ts +39 -0
  78. package/v3/@claude-flow/cli/dist/src/services/fable-harness.js +41 -0
  79. package/v3/@claude-flow/cli/package.json +13 -4
  80. package/.claude/coordinator/config.json +0 -24
  81. package/.claude/coordinator/state.json +0 -37
  82. package/.claude/coordinator/tick-log/tick-01.json +0 -17
  83. package/.claude/coordinator/tick-log/tick-02.json +0 -17
  84. package/.claude/coordinator/tick-log/tick-03.json +0 -17
  85. package/.claude/coordinator/tick-log/tick-04.json +0 -14
  86. package/.claude/coordinator/tick-log/tick-05.json +0 -16
  87. package/.claude/settings.local.json +0 -11
  88. package/v3/@claude-flow/cli/dist/src/ruvector/lattice-wasm.d.ts +0 -14
  89. package/v3/@claude-flow/cli/dist/src/ruvector/lattice-wasm.js +0 -144
  90. package/v3/@claude-flow/guidance/dist/adversarial.d.ts +0 -284
  91. package/v3/@claude-flow/guidance/dist/adversarial.js +0 -572
  92. package/v3/@claude-flow/guidance/dist/analyzer.d.ts +0 -530
  93. package/v3/@claude-flow/guidance/dist/analyzer.js +0 -2587
  94. package/v3/@claude-flow/guidance/dist/artifacts.d.ts +0 -283
  95. package/v3/@claude-flow/guidance/dist/artifacts.js +0 -356
  96. package/v3/@claude-flow/guidance/dist/authority.d.ts +0 -290
  97. package/v3/@claude-flow/guidance/dist/authority.js +0 -558
  98. package/v3/@claude-flow/guidance/dist/capabilities.d.ts +0 -209
  99. package/v3/@claude-flow/guidance/dist/capabilities.js +0 -485
  100. package/v3/@claude-flow/guidance/dist/coherence.d.ts +0 -233
  101. package/v3/@claude-flow/guidance/dist/coherence.js +0 -372
  102. package/v3/@claude-flow/guidance/dist/compiler.d.ts +0 -87
  103. package/v3/@claude-flow/guidance/dist/compiler.js +0 -410
  104. package/v3/@claude-flow/guidance/dist/conformance-kit.d.ts +0 -225
  105. package/v3/@claude-flow/guidance/dist/conformance-kit.js +0 -629
  106. package/v3/@claude-flow/guidance/dist/continue-gate.d.ts +0 -214
  107. package/v3/@claude-flow/guidance/dist/continue-gate.js +0 -353
  108. package/v3/@claude-flow/guidance/dist/crypto-utils.d.ts +0 -17
  109. package/v3/@claude-flow/guidance/dist/crypto-utils.js +0 -24
  110. package/v3/@claude-flow/guidance/dist/evolution.d.ts +0 -282
  111. package/v3/@claude-flow/guidance/dist/evolution.js +0 -500
  112. package/v3/@claude-flow/guidance/dist/gates.d.ts +0 -79
  113. package/v3/@claude-flow/guidance/dist/gates.js +0 -302
  114. package/v3/@claude-flow/guidance/dist/gateway.d.ts +0 -206
  115. package/v3/@claude-flow/guidance/dist/gateway.js +0 -452
  116. package/v3/@claude-flow/guidance/dist/generators.d.ts +0 -153
  117. package/v3/@claude-flow/guidance/dist/generators.js +0 -682
  118. package/v3/@claude-flow/guidance/dist/headless.d.ts +0 -177
  119. package/v3/@claude-flow/guidance/dist/headless.js +0 -342
  120. package/v3/@claude-flow/guidance/dist/hooks.d.ts +0 -109
  121. package/v3/@claude-flow/guidance/dist/hooks.js +0 -347
  122. package/v3/@claude-flow/guidance/dist/index.d.ts +0 -205
  123. package/v3/@claude-flow/guidance/dist/index.js +0 -321
  124. package/v3/@claude-flow/guidance/dist/ledger.d.ts +0 -162
  125. package/v3/@claude-flow/guidance/dist/ledger.js +0 -375
  126. package/v3/@claude-flow/guidance/dist/manifest-validator.d.ts +0 -289
  127. package/v3/@claude-flow/guidance/dist/manifest-validator.js +0 -838
  128. package/v3/@claude-flow/guidance/dist/memory-gate.d.ts +0 -222
  129. package/v3/@claude-flow/guidance/dist/memory-gate.js +0 -382
  130. package/v3/@claude-flow/guidance/dist/meta-governance.d.ts +0 -265
  131. package/v3/@claude-flow/guidance/dist/meta-governance.js +0 -348
  132. package/v3/@claude-flow/guidance/dist/optimizer.d.ts +0 -104
  133. package/v3/@claude-flow/guidance/dist/optimizer.js +0 -329
  134. package/v3/@claude-flow/guidance/dist/persistence.d.ts +0 -189
  135. package/v3/@claude-flow/guidance/dist/persistence.js +0 -464
  136. package/v3/@claude-flow/guidance/dist/proof.d.ts +0 -185
  137. package/v3/@claude-flow/guidance/dist/proof.js +0 -238
  138. package/v3/@claude-flow/guidance/dist/retriever.d.ts +0 -172
  139. package/v3/@claude-flow/guidance/dist/retriever.js +0 -596
  140. package/v3/@claude-flow/guidance/dist/ruvbot-integration.d.ts +0 -370
  141. package/v3/@claude-flow/guidance/dist/ruvbot-integration.js +0 -738
  142. package/v3/@claude-flow/guidance/dist/temporal.d.ts +0 -426
  143. package/v3/@claude-flow/guidance/dist/temporal.js +0 -658
  144. package/v3/@claude-flow/guidance/dist/trust.d.ts +0 -283
  145. package/v3/@claude-flow/guidance/dist/trust.js +0 -473
  146. package/v3/@claude-flow/guidance/dist/truth-anchors.d.ts +0 -276
  147. package/v3/@claude-flow/guidance/dist/truth-anchors.js +0 -488
  148. package/v3/@claude-flow/guidance/dist/types.d.ts +0 -378
  149. package/v3/@claude-flow/guidance/dist/types.js +0 -10
  150. package/v3/@claude-flow/guidance/dist/uncertainty.d.ts +0 -372
  151. package/v3/@claude-flow/guidance/dist/uncertainty.js +0 -619
  152. package/v3/@claude-flow/guidance/dist/wasm-kernel.d.ts +0 -48
  153. package/v3/@claude-flow/guidance/dist/wasm-kernel.js +0 -158
  154. package/v3/@claude-flow/shared/dist/core/config/defaults.d.ts +0 -41
  155. package/v3/@claude-flow/shared/dist/core/config/defaults.js +0 -186
  156. package/v3/@claude-flow/shared/dist/core/config/index.d.ts +0 -8
  157. package/v3/@claude-flow/shared/dist/core/config/index.js +0 -12
  158. package/v3/@claude-flow/shared/dist/core/config/loader.d.ts +0 -45
  159. package/v3/@claude-flow/shared/dist/core/config/loader.js +0 -238
  160. package/v3/@claude-flow/shared/dist/core/config/schema.d.ts +0 -1728
  161. package/v3/@claude-flow/shared/dist/core/config/schema.js +0 -160
  162. package/v3/@claude-flow/shared/dist/core/config/validator.d.ts +0 -92
  163. package/v3/@claude-flow/shared/dist/core/config/validator.js +0 -147
  164. package/v3/@claude-flow/shared/dist/core/event-bus.d.ts +0 -31
  165. package/v3/@claude-flow/shared/dist/core/event-bus.js +0 -197
  166. package/v3/@claude-flow/shared/dist/core/index.d.ts +0 -15
  167. package/v3/@claude-flow/shared/dist/core/index.js +0 -19
  168. package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.d.ts +0 -200
  169. package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.js +0 -6
  170. package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.d.ts +0 -310
  171. package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.js +0 -7
  172. package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.d.ts +0 -224
  173. package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.js +0 -46
  174. package/v3/@claude-flow/shared/dist/core/interfaces/index.d.ts +0 -10
  175. package/v3/@claude-flow/shared/dist/core/interfaces/index.js +0 -15
  176. package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.d.ts +0 -298
  177. package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.js +0 -7
  178. package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.d.ts +0 -185
  179. package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.js +0 -6
  180. package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.d.ts +0 -35
  181. package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.js +0 -101
  182. package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.d.ts +0 -60
  183. package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.js +0 -166
  184. package/v3/@claude-flow/shared/dist/core/orchestrator/index.d.ts +0 -46
  185. package/v3/@claude-flow/shared/dist/core/orchestrator/index.js +0 -64
  186. package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.d.ts +0 -56
  187. package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.js +0 -195
  188. package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.d.ts +0 -83
  189. package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.js +0 -193
  190. package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.d.ts +0 -49
  191. package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.js +0 -253
  192. package/v3/@claude-flow/shared/dist/events/domain-events.d.ts +0 -282
  193. package/v3/@claude-flow/shared/dist/events/domain-events.js +0 -165
  194. package/v3/@claude-flow/shared/dist/events/event-store.d.ts +0 -126
  195. package/v3/@claude-flow/shared/dist/events/event-store.js +0 -427
  196. package/v3/@claude-flow/shared/dist/events/event-store.test.d.ts +0 -8
  197. package/v3/@claude-flow/shared/dist/events/event-store.test.js +0 -293
  198. package/v3/@claude-flow/shared/dist/events/example-usage.d.ts +0 -10
  199. package/v3/@claude-flow/shared/dist/events/example-usage.js +0 -193
  200. package/v3/@claude-flow/shared/dist/events/index.d.ts +0 -21
  201. package/v3/@claude-flow/shared/dist/events/index.js +0 -22
  202. package/v3/@claude-flow/shared/dist/events/projections.d.ts +0 -177
  203. package/v3/@claude-flow/shared/dist/events/projections.js +0 -421
  204. package/v3/@claude-flow/shared/dist/events/rvf-event-log.d.ts +0 -82
  205. package/v3/@claude-flow/shared/dist/events/rvf-event-log.js +0 -340
  206. package/v3/@claude-flow/shared/dist/events/state-reconstructor.d.ts +0 -101
  207. package/v3/@claude-flow/shared/dist/events/state-reconstructor.js +0 -263
  208. package/v3/@claude-flow/shared/dist/events.d.ts +0 -80
  209. package/v3/@claude-flow/shared/dist/events.js +0 -249
  210. package/v3/@claude-flow/shared/dist/hooks/example-usage.d.ts +0 -42
  211. package/v3/@claude-flow/shared/dist/hooks/example-usage.js +0 -351
  212. package/v3/@claude-flow/shared/dist/hooks/executor.d.ts +0 -100
  213. package/v3/@claude-flow/shared/dist/hooks/executor.js +0 -267
  214. package/v3/@claude-flow/shared/dist/hooks/hooks.test.d.ts +0 -9
  215. package/v3/@claude-flow/shared/dist/hooks/hooks.test.js +0 -322
  216. package/v3/@claude-flow/shared/dist/hooks/index.d.ts +0 -52
  217. package/v3/@claude-flow/shared/dist/hooks/index.js +0 -51
  218. package/v3/@claude-flow/shared/dist/hooks/registry.d.ts +0 -133
  219. package/v3/@claude-flow/shared/dist/hooks/registry.js +0 -277
  220. package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.d.ts +0 -105
  221. package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.js +0 -481
  222. package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.d.ts +0 -144
  223. package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.js +0 -328
  224. package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.d.ts +0 -158
  225. package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.js +0 -450
  226. package/v3/@claude-flow/shared/dist/hooks/safety/index.d.ts +0 -17
  227. package/v3/@claude-flow/shared/dist/hooks/safety/index.js +0 -17
  228. package/v3/@claude-flow/shared/dist/hooks/session-hooks.d.ts +0 -234
  229. package/v3/@claude-flow/shared/dist/hooks/session-hooks.js +0 -334
  230. package/v3/@claude-flow/shared/dist/hooks/task-hooks.d.ts +0 -163
  231. package/v3/@claude-flow/shared/dist/hooks/task-hooks.js +0 -326
  232. package/v3/@claude-flow/shared/dist/hooks/types.d.ts +0 -267
  233. package/v3/@claude-flow/shared/dist/hooks/types.js +0 -62
  234. package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.d.ts +0 -9
  235. package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.js +0 -93
  236. package/v3/@claude-flow/shared/dist/index.d.ts +0 -20
  237. package/v3/@claude-flow/shared/dist/index.js +0 -50
  238. package/v3/@claude-flow/shared/dist/mcp/connection-pool.d.ts +0 -98
  239. package/v3/@claude-flow/shared/dist/mcp/connection-pool.js +0 -364
  240. package/v3/@claude-flow/shared/dist/mcp/index.d.ts +0 -69
  241. package/v3/@claude-flow/shared/dist/mcp/index.js +0 -84
  242. package/v3/@claude-flow/shared/dist/mcp/server.d.ts +0 -166
  243. package/v3/@claude-flow/shared/dist/mcp/server.js +0 -590
  244. package/v3/@claude-flow/shared/dist/mcp/session-manager.d.ts +0 -136
  245. package/v3/@claude-flow/shared/dist/mcp/session-manager.js +0 -335
  246. package/v3/@claude-flow/shared/dist/mcp/tool-registry.d.ts +0 -178
  247. package/v3/@claude-flow/shared/dist/mcp/tool-registry.js +0 -439
  248. package/v3/@claude-flow/shared/dist/mcp/transport/http.d.ts +0 -104
  249. package/v3/@claude-flow/shared/dist/mcp/transport/http.js +0 -476
  250. package/v3/@claude-flow/shared/dist/mcp/transport/index.d.ts +0 -102
  251. package/v3/@claude-flow/shared/dist/mcp/transport/index.js +0 -238
  252. package/v3/@claude-flow/shared/dist/mcp/transport/stdio.d.ts +0 -104
  253. package/v3/@claude-flow/shared/dist/mcp/transport/stdio.js +0 -263
  254. package/v3/@claude-flow/shared/dist/mcp/transport/websocket.d.ts +0 -133
  255. package/v3/@claude-flow/shared/dist/mcp/transport/websocket.js +0 -396
  256. package/v3/@claude-flow/shared/dist/mcp/types.d.ts +0 -436
  257. package/v3/@claude-flow/shared/dist/mcp/types.js +0 -54
  258. package/v3/@claude-flow/shared/dist/plugin-interface.d.ts +0 -544
  259. package/v3/@claude-flow/shared/dist/plugin-interface.js +0 -23
  260. package/v3/@claude-flow/shared/dist/plugin-loader.d.ts +0 -139
  261. package/v3/@claude-flow/shared/dist/plugin-loader.js +0 -434
  262. package/v3/@claude-flow/shared/dist/plugin-registry.d.ts +0 -183
  263. package/v3/@claude-flow/shared/dist/plugin-registry.js +0 -457
  264. package/v3/@claude-flow/shared/dist/plugins/index.d.ts +0 -10
  265. package/v3/@claude-flow/shared/dist/plugins/index.js +0 -10
  266. package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.d.ts +0 -106
  267. package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.js +0 -241
  268. package/v3/@claude-flow/shared/dist/plugins/official/index.d.ts +0 -10
  269. package/v3/@claude-flow/shared/dist/plugins/official/index.js +0 -10
  270. package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.d.ts +0 -121
  271. package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.js +0 -355
  272. package/v3/@claude-flow/shared/dist/plugins/types.d.ts +0 -93
  273. package/v3/@claude-flow/shared/dist/plugins/types.js +0 -9
  274. package/v3/@claude-flow/shared/dist/resilience/bulkhead.d.ts +0 -105
  275. package/v3/@claude-flow/shared/dist/resilience/bulkhead.js +0 -206
  276. package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.d.ts +0 -132
  277. package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.js +0 -233
  278. package/v3/@claude-flow/shared/dist/resilience/index.d.ts +0 -19
  279. package/v3/@claude-flow/shared/dist/resilience/index.js +0 -19
  280. package/v3/@claude-flow/shared/dist/resilience/rate-limiter.d.ts +0 -168
  281. package/v3/@claude-flow/shared/dist/resilience/rate-limiter.js +0 -314
  282. package/v3/@claude-flow/shared/dist/resilience/retry.d.ts +0 -91
  283. package/v3/@claude-flow/shared/dist/resilience/retry.js +0 -159
  284. package/v3/@claude-flow/shared/dist/security/index.d.ts +0 -10
  285. package/v3/@claude-flow/shared/dist/security/index.js +0 -12
  286. package/v3/@claude-flow/shared/dist/security/input-validation.d.ts +0 -73
  287. package/v3/@claude-flow/shared/dist/security/input-validation.js +0 -201
  288. package/v3/@claude-flow/shared/dist/security/secure-random.d.ts +0 -92
  289. package/v3/@claude-flow/shared/dist/security/secure-random.js +0 -142
  290. package/v3/@claude-flow/shared/dist/services/index.d.ts +0 -7
  291. package/v3/@claude-flow/shared/dist/services/index.js +0 -7
  292. package/v3/@claude-flow/shared/dist/services/v3-progress.service.d.ts +0 -124
  293. package/v3/@claude-flow/shared/dist/services/v3-progress.service.js +0 -402
  294. package/v3/@claude-flow/shared/dist/types/agent.types.d.ts +0 -137
  295. package/v3/@claude-flow/shared/dist/types/agent.types.js +0 -6
  296. package/v3/@claude-flow/shared/dist/types/index.d.ts +0 -11
  297. package/v3/@claude-flow/shared/dist/types/index.js +0 -17
  298. package/v3/@claude-flow/shared/dist/types/mcp.types.d.ts +0 -266
  299. package/v3/@claude-flow/shared/dist/types/mcp.types.js +0 -7
  300. package/v3/@claude-flow/shared/dist/types/memory.types.d.ts +0 -236
  301. package/v3/@claude-flow/shared/dist/types/memory.types.js +0 -7
  302. package/v3/@claude-flow/shared/dist/types/swarm.types.d.ts +0 -186
  303. package/v3/@claude-flow/shared/dist/types/swarm.types.js +0 -65
  304. package/v3/@claude-flow/shared/dist/types/task.types.d.ts +0 -178
  305. package/v3/@claude-flow/shared/dist/types/task.types.js +0 -32
  306. package/v3/@claude-flow/shared/dist/types.d.ts +0 -197
  307. package/v3/@claude-flow/shared/dist/types.js +0 -21
  308. package/v3/@claude-flow/shared/dist/utils/secure-logger.d.ts +0 -69
  309. package/v3/@claude-flow/shared/dist/utils/secure-logger.js +0 -208
@@ -49,6 +49,28 @@ const CWD = process.cwd();
49
49
  const CACHE_FILE = path.join(os.tmpdir(), 'ruflo-statusline-cache-' + require('crypto').createHash('md5').update(CWD).digest('hex').slice(0, 8) + '.json');
50
50
  const CACHE_TTL_MS = 60000;
51
51
 
52
+ // The promo/insight row is designed to rotate on a 20s cadence (funnel/
53
+ // rotation.ts's ROTATION_SLOT_MS / funnel/promo.ts's insight-slot check —
54
+ // duplicated here as a bare number since this generated script has no
55
+ // runtime import of the funnel module; keep in sync if that constant ever
56
+ // changes). The rotation slot is only ever (re)computed SERVER-SIDE inside
57
+ // the CLI subprocess this file shells out to — so a general 60s data cache
58
+ // (correct and necessary for #2337) silently made that 20s design
59
+ // unreachable: cache.fresh stayed true across 2-3 whole rotation slots,
60
+ // so the row visibly "didn't rotate" (user report). Fix: track promo
61
+ // freshness on its OWN, tighter clock — when it lags behind the current
62
+ // slot, fall through to a real CLI call even though the REST of the
63
+ // cached data (security/swarm/system) is still within CACHE_TTL_MS. This
64
+ // does not touch or regress #2337's fix; it only adds a narrower check.
65
+ const PROMO_ROTATION_SLOT_MS = 20000;
66
+
67
+ // Persistent last-known-good promo record. Lives outside the /tmp cache so it
68
+ // survives a full cache wipe / cache write race / CLI failure combo. Written
69
+ // every time we successfully render a promo; read as a last resort so the row
70
+ // never blinks out mid-session (was: 'promo shows then hides' bug report).
71
+ const PROMO_MEMO_FILE = path.join(os.homedir(), '.ruflo', 'statusline-promo.json');
72
+ const PROMO_MEMO_TTL_MS = 6 * 60 * 60 * 1000; // 6h — long enough to bridge any hiccup, short enough that a real disable takes effect fast.
73
+
52
74
  // #2337: resolve an already-installed @claude-flow/cli (or ruflo) bin so we
53
75
  // can invoke it directly via `node`. The previous version called
54
76
  // `npx --yes @claude-flow/cli@latest` on every uncached render, which forces
@@ -56,18 +78,30 @@ const CACHE_TTL_MS = 60000;
56
78
  // multiple concurrent Claude Code sessions this storms the host (reporter
57
79
  // saw load average 40-65 on a 12-core box).
58
80
  //
59
- // Returns the absolute path to bin/cli.js or null. Mirrors getPkgVersion()'s
60
- // path probing (project, monorepo, plugin marketplace, global node_modules
61
- // including custom-prefix layouts like ~/.npm-global).
62
- function resolveCliBin() {
81
+ // Returns EVERY existing bin/cli.js candidate, in preference order (project,
82
+ // monorepo, plugin marketplace, global node_modules including custom-prefix
83
+ // layouts like ~/.npm-global) — mirrors getPkgVersion()'s own path probing.
84
+ //
85
+ // Returns a list, not a single winner: `fs.existsSync` only proves a file is
86
+ // present, not that it actually runs. A marketplace/npx-cached install can
87
+ // exist on disk but be broken (observed in practice: a stale marketplace
88
+ // checkout whose dist/ imports a workspace package, '@claude-flow/cli-core',
89
+ // that isn't bundled there — every invocation throws ERR_MODULE_NOT_FOUND).
90
+ // Picking the first EXISTING path and never falling through meant a single
91
+ // broken install silently killed the promo row for the entire session (the
92
+ // CLI call always failed, so the memo could never refresh and eventually
93
+ // expired). getStatuslineData() now walks this whole list and tries the next
94
+ // candidate on failure, so one broken install can't permanently wedge it.
95
+ function resolveCliBinCandidates() {
96
+ const candidates = [];
63
97
  try {
64
98
  const home = os.homedir();
65
- const candidates = [
99
+ candidates.push(
66
100
  path.join(home, '.claude', 'plugins', 'marketplaces', 'ruflo', 'bin', 'cli.js'),
67
101
  path.join(CWD, 'node_modules', '@claude-flow', 'cli', 'bin', 'cli.js'),
68
102
  path.join(CWD, 'node_modules', 'ruflo', 'bin', 'cli.js'),
69
103
  path.join(CWD, 'v3', '@claude-flow', 'cli', 'bin', 'cli.js'),
70
- ];
104
+ );
71
105
  try {
72
106
  const binDir = path.dirname(process.execPath);
73
107
  const globalModuleDirs = [path.join(binDir, '..', 'lib', 'node_modules'), path.join(binDir, 'node_modules')];
@@ -81,27 +115,54 @@ function resolveCliBin() {
81
115
  );
82
116
  }
83
117
  } catch { /* ignore */ }
84
- for (const p of candidates) {
85
- if (fs.existsSync(p)) return p;
86
- }
87
118
  } catch { /* ignore */ }
88
- return null;
119
+ return candidates.filter((p) => { try { return fs.existsSync(p); } catch { return false; } });
89
120
  }
90
121
 
122
+ // Return { fresh, promoFresh, data }. 'fresh' is true only if within the TTL
123
+ // — but data is returned regardless (stale-while-revalidate). This lets us
124
+ // serve last known state (specifically the promo row) when the CLI is
125
+ // slow/unavailable, so users don't see the funnel row flicker in and out on
126
+ // cache expiry. 'promoFresh' is a SEPARATE, tighter check on the same clock
127
+ // as PROMO_ROTATION_SLOT_MS — see that constant's comment for why the promo
128
+ // row needs its own freshness bound distinct from the general 60s TTL.
91
129
  function readCache() {
92
130
  try {
93
131
  if (fs.existsSync(CACHE_FILE)) {
94
132
  const raw = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf-8'));
95
- if (raw && raw._ts && (Date.now() - raw._ts) < CACHE_TTL_MS) {
96
- return raw.data;
133
+ if (raw && raw._ts && raw.data) {
134
+ const age = Date.now() - raw._ts;
135
+ return { fresh: age < CACHE_TTL_MS, promoFresh: age < PROMO_ROTATION_SLOT_MS, data: raw.data };
97
136
  }
98
137
  }
99
138
  } catch { /* ignore */ }
100
- return null;
139
+ return { fresh: false, promoFresh: false, data: null };
101
140
  }
102
141
 
103
142
  function writeCache(data) {
104
143
  try { fs.writeFileSync(CACHE_FILE, JSON.stringify({ _ts: Date.now(), data }), 'utf-8'); } catch { /* ignore */ }
144
+ // Also memoize any promo we saw so the row can survive future CLI hiccups.
145
+ try {
146
+ if (data && data.promo && typeof data.promo === 'object') {
147
+ fs.mkdirSync(path.dirname(PROMO_MEMO_FILE), { recursive: true, mode: 0o700 });
148
+ fs.writeFileSync(PROMO_MEMO_FILE, JSON.stringify({ _ts: Date.now(), promo: data.promo }), { encoding: 'utf-8', mode: 0o600 });
149
+ }
150
+ } catch { /* ignore */ }
151
+ }
152
+
153
+ // Last resort: read a memoized promo (up to 6h old). Used when no cache and
154
+ // no CLI response is available — the row still renders, so users don't see
155
+ // the disclosure blink out. Returns null when the memo is absent, expired,
156
+ // or malformed. Never throws.
157
+ function readPromoMemo() {
158
+ try {
159
+ if (!fs.existsSync(PROMO_MEMO_FILE)) return null;
160
+ const raw = JSON.parse(fs.readFileSync(PROMO_MEMO_FILE, 'utf-8'));
161
+ if (raw && raw._ts && (Date.now() - raw._ts) < PROMO_MEMO_TTL_MS && raw.promo) {
162
+ return raw.promo;
163
+ }
164
+ } catch { /* ignore */ }
165
+ return null;
105
166
  }
106
167
 
107
168
  /**
@@ -112,37 +173,75 @@ function writeCache(data) {
112
173
  * (missed the .swarm/memory.db → AgentDB path), computed dddProgress wrong,
113
174
  * and only counted ADRs in v3/implementation/adrs/ (missed v3/docs/adr/).
114
175
  */
176
+ // Overlay the memoized promo onto any data object that's missing one. This is
177
+ // the safety net that keeps the funnel row rendered when an OLDER cached CLI
178
+ // version is picked up by npx — that older CLI succeeds but omits promo, so
179
+ // the JSON round-trips clean but without our row. We patch it back here.
180
+ function overlayMemoPromo(data) {
181
+ if (data && !data.promo) {
182
+ const memoPromo = readPromoMemo();
183
+ if (memoPromo) data.promo = memoPromo;
184
+ }
185
+ return data;
186
+ }
187
+
115
188
  function getStatuslineData() {
116
- const cached = readCache();
117
- if (cached) return cached;
189
+ const cache = readCache();
190
+ // Both clocks must be satisfied to skip the CLI call entirely: the general
191
+ // 60s TTL (#2337 — don't re-spawn the CLI on every rapid re-render) AND the
192
+ // tighter promo-rotation clock (this fix — don't let a still-fresh 60s
193
+ // cache silently freeze the promo/insight row across multiple 20s slots).
194
+ if (cache.fresh && cache.promoFresh) return overlayMemoPromo(cache.data);
195
+
196
+ // #2337: prefer an already-installed CLI bin via direct `node` invocation —
197
+ // no npx, no registry round-trip, no @latest re-resolve per render. Try
198
+ // every candidate that actually EXISTS (not just the first) before falling
199
+ // back to `npx --prefer-offline @claude-flow/cli` (no @latest); an existing
200
+ // but broken install (e.g. a stale marketplace checkout missing a bundled
201
+ // workspace dep) must not block trying the next one.
202
+ //
203
+ // No `2>/dev/null` here (deliberately) — the execSync call below already
204
+ // sets stdio: ['pipe','pipe','pipe'], which captures/discards stderr at the
205
+ // Node level regardless of shell. The redirect was redundant on POSIX and
206
+ // actively broke every candidate on Windows: cmd.exe (execSync's default
207
+ // shell there) doesn't understand /dev/null, so the CLI delegation always
208
+ // failed, silently degrading every render to buildLocalFallback() — 0%
209
+ // intelligence and an empty promo row (the memo cache that keeps the row
210
+ // populated across CLI hiccups is only ever written from a SUCCESSFUL
211
+ // delegation, so it could never get seeded on Windows either).
212
+ const cmds = resolveCliBinCandidates()
213
+ .map((bin) => '"' + process.execPath + '" "' + bin + '" hooks statusline --json')
214
+ .concat(['npx --prefer-offline @claude-flow/cli hooks statusline --json']);
215
+ for (const cmd of cmds) {
216
+ try {
217
+ const raw = execSync(
218
+ cmd,
219
+ { encoding: 'utf-8', timeout: 8000, stdio: ['pipe', 'pipe', 'pipe'], cwd: CWD }
220
+ ).trim();
221
+ // The CLI may emit preamble lines before the JSON — find the first '{'.
222
+ const jsonStart = raw.indexOf('{');
223
+ if (jsonStart === -1) throw new Error('no JSON in CLI output');
224
+ const data = JSON.parse(raw.slice(jsonStart));
225
+ // Overlay every block the CLI JSON omits (adrs/agentdb/tests/hooks/integration)
226
+ // with real local reads, so those segments reflect actual state instead of 0.
227
+ applyLocalOverlays(data);
228
+ overlayMemoPromo(data);
229
+ writeCache(data);
230
+ return data;
231
+ } catch { /* this candidate unavailable, broken, or timed out — try the next */ }
232
+ }
118
233
 
119
- try {
120
- // #2337: prefer an already-installed CLI bin via direct `node` invocation
121
- // — no npx, no registry round-trip, no @latest re-resolve per render.
122
- // Fall back to `npx --prefer-offline @claude-flow/cli` (no @latest) only
123
- // when nothing is installed locally, so a cold environment still works.
124
- const cliBin = resolveCliBin();
125
- const cmd = cliBin
126
- ? '"' + process.execPath + '" "' + cliBin + '" hooks statusline --json 2>/dev/null'
127
- : 'npx --prefer-offline @claude-flow/cli hooks statusline --json 2>/dev/null';
128
- const raw = execSync(
129
- cmd,
130
- { encoding: 'utf-8', timeout: 8000, stdio: ['pipe', 'pipe', 'pipe'], cwd: CWD }
131
- ).trim();
132
- // The CLI may emit preamble lines before the JSON — find the first '{'.
133
- const jsonStart = raw.indexOf('{');
134
- if (jsonStart === -1) throw new Error('no JSON in CLI output');
135
- const data = JSON.parse(raw.slice(jsonStart));
136
- // Overlay every block the CLI JSON omits (adrs/agentdb/tests/hooks/integration)
137
- // with real local reads, so those segments reflect actual state instead of 0.
138
- applyLocalOverlays(data);
139
- writeCache(data);
140
- return data;
141
- } catch { /* CLI unavailable or timed out */ }
142
-
143
- // Fallback: use local file probes only (will be less accurate, but non-zero
144
- // when CLI is available and accurate when it's not).
145
- return buildLocalFallback();
234
+ // Stale-while-revalidate: if we have any cached data, keep serving it so the
235
+ // funnel row doesn't flicker on CLI hiccups. Overlay fresh local reads for
236
+ // the segments the CLI JSON doesn't populate; the promo row survives.
237
+ if (cache.data) {
238
+ applyLocalOverlays(cache.data);
239
+ overlayMemoPromo(cache.data);
240
+ return cache.data;
241
+ }
242
+
243
+ // Last resort: local probes + memo. Users still see the funnel row.
244
+ return overlayMemoPromo(buildLocalFallback());
146
245
  }
147
246
 
148
247
  // Count ADRs from BOTH known directories (fix for ruflo#2195: old code missed
@@ -188,13 +287,24 @@ function getLocalAgentDB() {
188
287
  const memDb = path.join(CWD, '.swarm', 'memory.db');
189
288
  if (fs.existsSync(memDb)) {
190
289
  const Q = String.fromCharCode(34);
191
- const sql = Q + 'SELECT (SELECT COUNT(*) FROM memory_entries WHERE embedding IS NOT NULL)||' + "'|'" + '||(SELECT COUNT(*) FROM vector_indexes);' + Q;
192
- const out = safeExec("sqlite3 'file:" + memDb + "?mode=ro' " + sql, 1500);
193
- if (out && out.indexOf('|') !== -1) {
194
- const parts = out.split('|');
195
- result.vectorCount = parseInt(parts[0], 10) || 0;
196
- result.hasHnsw = (parseInt(parts[1], 10) || 0) > 0;
197
- }
290
+ // Two INDEPENDENT statements -- do NOT combine into one. Coupling the
291
+ // vector count with the vector_indexes row count in a single statement
292
+ // meant that on a DB missing the vector_indexes table (older/agentdb-
293
+ // written DBs), the whole statement failed at PREPARE time (SQLite
294
+ // compiles the full SQL before running), so the valid memory_entries
295
+ // count was discarded too and the statusline showed Vectors 0 despite
296
+ // thousands of real vectors. Split so a missing table can only zero the
297
+ // HNSW flag, never the count. The init self-heal provisions the table so
298
+ // the flag recovers on the next ruflo init / MCP start.
299
+ const countSql = Q + 'SELECT COUNT(*) FROM memory_entries WHERE embedding IS NOT NULL;' + Q;
300
+ const vc = safeExec("sqlite3 'file:" + memDb + "?mode=ro' " + countSql, 1500);
301
+ if (vc) result.vectorCount = parseInt(vc, 10) || 0;
302
+ // HNSW flag: separate statement. If vector_indexes is absent, sqlite3
303
+ // exits non-zero and safeExec returns empty -- hasHnsw stays false (exact
304
+ // original semantics: at least one index-config row present).
305
+ const hnswSql = Q + 'SELECT COUNT(*) FROM vector_indexes;' + Q;
306
+ const hn = safeExec("sqlite3 'file:" + memDb + "?mode=ro' " + hnswSql, 1500);
307
+ if (hn) result.hasHnsw = (parseInt(hn, 10) || 0) > 0;
198
308
  }
199
309
  } catch { /* ignore */ }
200
310
  return result;
@@ -531,7 +641,11 @@ function generateStatusline() {
531
641
  const modelName = getModelFromStdin() || (d.user && d.user.modelName) || 'Claude Code';
532
642
  const ctxInfo = getContextFromStdin();
533
643
  const costInfo = getCostFromStdin();
534
- const pkgVersion = getPkgVersion();
644
+ // Named RUFLO_VERSION (not pkgVersion) so the #1951 regression guard
645
+ // (scripts/audit-fix-invariants.mjs) can pin its presence in the emitted
646
+ // .cjs artifact — without it the header silently reverts to a hard-coded
647
+ // "RuFlo V3.5" for anyone whose install doesn't match the first probe path.
648
+ const RUFLO_VERSION = getPkgVersion();
535
649
 
536
650
  const progress = d.v3Progress || {};
537
651
  const security = d.security || {};
@@ -567,8 +681,14 @@ function generateStatusline() {
567
681
 
568
682
  const lines = [];
569
683
 
570
- // Header
571
- let header = c.bold + c.brightPurple + '▊ RuFlo V' + pkgVersion + ' ' + c.reset;
684
+ // 3-line design (fits Claude Code's visible statusline area — line 4+ gets
685
+ // replaced by the system guidance / input prompt line):
686
+ // Line 1 — Header (RuFlo version · git · model · timing · context · cost)
687
+ // Line 2 — Compressed ops (Swarm · Hooks · 🧠 · 💾 · Health)
688
+ // Line 3 — Promo / disclosure row (funnel surface, ADR-301)
689
+
690
+ // ─── Line 1: header ────────────────────────────────────────────
691
+ let header = c.bold + c.brightPurple + '▊ RuFlo V' + RUFLO_VERSION + ' ' + c.reset;
572
692
  header += (coordinationActive ? c.brightCyan : c.dim) + '● ' + c.brightCyan + git.name + c.reset;
573
693
  if (git.gitBranch) {
574
694
  header += ' ' + c.dim + '│' + c.reset + ' ' + c.brightBlue + '⏇ ' + git.gitBranch + c.reset;
@@ -595,81 +715,148 @@ function generateStatusline() {
595
715
  }
596
716
  lines.push(header);
597
717
 
598
- // Separator
599
- lines.push(c.dim + '─'.repeat(53) + c.reset);
600
-
601
- // Line 1: DDD Domains
602
- const domainsColor = domainsCompleted >= 3 ? c.brightGreen : domainsCompleted > 0 ? c.yellow : c.red;
603
- let perfIndicator;
604
- if (hasHnsw && vectorCount > 0) {
605
- const speedup = vectorCount > 10000 ? '12500x' : vectorCount > 1000 ? '150x' : '10x';
606
- perfIndicator = c.brightGreen + '⚡ HNSW ' + speedup + c.reset;
607
- } else if (patternsLearned > 0) {
608
- const pk = patternsLearned >= 1000 ? (patternsLearned / 1000).toFixed(1) + 'k' : String(patternsLearned);
609
- perfIndicator = c.brightYellow + '📚 ' + pk + ' patterns' + c.reset;
610
- } else {
611
- perfIndicator = c.dim + '⚡ target: 150x-12500x' + c.reset;
612
- }
613
- lines.push(
614
- c.brightCyan + '🏗️ DDD Domains' + c.reset + ' ' + progressBar(domainsCompleted, totalDomains) + ' ' +
615
- domainsColor + domainsCompleted + c.reset + '/' + c.brightWhite + totalDomains + c.reset + ' ' + perfIndicator
616
- );
617
-
618
- // Line 2: Swarm + Hooks + CVE + Memory + Intelligence
619
- const swarmInd = coordinationActive ? c.brightGreen + '◉' + c.reset : c.dim + '○' + c.reset;
620
- const agentsColor = activeAgents > 0 ? c.brightGreen : c.red;
621
- const secIcon = secStatus === 'CLEAN' ? '🟢' : (secStatus === 'IN_PROGRESS' || secStatus === 'STALE') ? '🟡' : (secStatus === 'NONE' ? '⚪' : '🔴');
622
- const secColor = secStatus === 'CLEAN' ? c.brightGreen : (secStatus === 'IN_PROGRESS' || secStatus === 'STALE') ? c.brightYellow : (secStatus === 'NONE' ? c.dim : c.brightRed);
718
+ // ─── Line 2: compressed ops ────────────────────────────────────
719
+ // Everything actionable in one dense row. Show only what changes what you
720
+ // do next; diagnostic detail moves to `ruflo status --verbose`.
721
+ const agentsColor = activeAgents > 0 ? c.brightGreen : c.dim;
623
722
  const hooksColor = hooksEnabled > 0 ? c.brightGreen : c.dim;
624
723
  const intellColor = intelligencePct >= 80 ? c.brightGreen : intelligencePct >= 40 ? c.brightYellow : c.dim;
724
+ const swarmInd = coordinationActive ? c.brightGreen + '◉' + c.reset + ' ' : c.dim + '○' + c.reset + ' ';
725
+ const cvesClean = totalCves === 0 || cvesFixed === totalCves;
726
+ const healthAllGreen = (secStatus === 'CLEAN' || secStatus === 'NONE') && cvesClean;
727
+ const opsParts = [];
728
+ opsParts.push(c.cyan + 'Swarm ' + swarmInd + agentsColor + activeAgents + c.reset + '/' + c.brightWhite + maxAgents + c.reset);
729
+ if (subAgents > 0) opsParts.push(c.brightPurple + '👥 ' + subAgents + c.reset);
730
+ opsParts.push(c.cyan + 'Hooks ' + hooksColor + hooksEnabled + c.reset + '/' + c.brightWhite + hooksTotal + c.reset);
731
+ opsParts.push(intellColor + '🧠 ' + intelligencePct + '%' + c.reset);
732
+ opsParts.push(c.brightCyan + '💾 ' + memoryMB + 'MB' + c.reset);
733
+ // Health: one glyph when green, terse copy when there's something to act on.
734
+ if (healthAllGreen) {
735
+ opsParts.push(c.brightGreen + '🛡 ✓' + c.reset);
736
+ } else {
737
+ if (secStatus === 'PENDING') opsParts.push(c.brightYellow + '🛡 scan pending' + c.reset);
738
+ else if (secStatus === 'IN_PROGRESS') opsParts.push(c.brightYellow + '🛡 scanning…' + c.reset);
739
+ else if (secStatus === 'STALE') opsParts.push(c.brightYellow + '🛡 scan stale' + c.reset);
740
+ else if (secStatus !== 'NONE' && secStatus !== 'CLEAN') opsParts.push(c.brightRed + '🛡 ' + secStatus.toLowerCase() + c.reset);
741
+ if (totalCves > 0 && cvesFixed < totalCves) {
742
+ const unfixed = totalCves - cvesFixed;
743
+ opsParts.push(c.brightRed + '⚠ ' + unfixed + ' CVE' + (unfixed === 1 ? '' : 's') + c.reset);
744
+ }
745
+ }
746
+ lines.push(opsParts.join(' ' + c.dim + '·' + c.reset + ' '));
747
+
748
+ // ─── Line 3: promo / disclosure / insight ───────────────────────
749
+ // Colored by content kind so it reads as *what it is*, not as noise:
750
+ // disclosure → brightCyan (announcement / capability link)
751
+ // promotional → brightPurple (Cognitum sponsor spot)
752
+ // educational → yellow (a tip)
753
+ // insight → brightRed (environment/task-aware, local, actionable —
754
+ // distinct from remote content on purpose)
755
+ const promoRow = getPromoRow(d);
756
+ if (promoRow) {
757
+ const kind = (d && d.promo && d.promo.kind) || 'disclosure';
758
+ const promoColor = kind === 'promotional' ? c.brightPurple
759
+ : kind === 'educational' ? c.yellow
760
+ : kind === 'insight' ? c.brightRed
761
+ : c.brightCyan;
762
+ lines.push(promoColor + promoRow + c.reset);
763
+ }
764
+
765
+ // Trailing blank line so Claude Code's input prompt gets breathing room
766
+ // instead of butting directly against the last statusline row.
767
+ return lines.join('\n') + '\n';
768
+ }
769
+
770
+ // ─── Funnel promo row (ADR-301) ─────────────────────────────────
771
+ // Allowlist for OSC 8 hyperlink targets. Ships in code (not in payload) so
772
+ // no message can smuggle a link to an unapproved host.
773
+ //
774
+ // The final destination hosts (cognitum.one / agentics.org) AND the
775
+ // click-redirect host are both allowlisted here: promo.ts routes every
776
+ // clickable message through the server-side click-redirect (ADR-311 §7)
777
+ // so promo_open + geo are captured before the 302 to the real target —
778
+ // so the OSC 8 link the renderer emits points at the redirect host, not
779
+ // the final destination directly.
780
+ const PROMO_LINK_HOSTS = new Set([
781
+ 'cognitum.one', 'www.cognitum.one', 'docs.cognitum.one',
782
+ // agentics.org — OSS foundation, distinct sponsor domain. Kept in sync
783
+ // with messages.ts ALLOWED_URL_HOSTS.
784
+ 'agentics.org', 'www.agentics.org',
785
+ // Click-redirect host (funnel.ruv.io once its TLS cert is live; the raw
786
+ // Cloud Run hostname is allowlisted too since event-transport.ts /
787
+ // message-transport.ts / attribution.ts currently point at it as a TEMP
788
+ // fallback while the domain mapping's cert provisions).
789
+ 'funnel.ruv.io',
790
+ 'cognitum-analytics-63rzcdswba-uc.a.run.app',
791
+ ]);
792
+
793
+ // Emit OSC 8 hyperlinks unless the environment is known-broken. tmux mangles
794
+ // raw OSC 8 (see anthropics/claude-code#27047) — opt in via env if wrapped.
795
+ function terminalSupportsHyperlinks() {
796
+ if (process.env.CI || process.env.GITHUB_ACTIONS) return false;
797
+ if (process.env.TERM === 'dumb') return false;
798
+ if (/^(0|false|off|no)$/i.test(String(process.env.RUFLO_STATUSLINE_HYPERLINKS || ''))) return false;
799
+ if (process.env.TMUX && !process.env.RUFLO_STATUSLINE_HYPERLINKS_TMUX) return false;
800
+ return true;
801
+ }
625
802
 
626
- lines.push(
627
- c.brightYellow + '🤖 Swarm' + c.reset + ' ' + swarmInd + ' [' + agentsColor + String(activeAgents).padStart(2) + c.reset + '/' + c.brightWhite + maxAgents + c.reset + '] ' +
628
- c.brightPurple + '👥 ' + subAgents + c.reset + ' ' +
629
- c.brightBlue + '🪝 ' + hooksColor + hooksEnabled + c.reset + '/' + c.brightWhite + hooksTotal + c.reset + ' ' +
630
- secIcon + ' ' + secColor + 'CVE ' + cvesFixed + c.reset + '/' + c.brightWhite + totalCves + c.reset + ' ' +
631
- c.brightCyan + '💾 ' + memoryMB + 'MB' + c.reset + ' ' +
632
- intellColor + '🧠 ' + String(intelligencePct).padStart(3) + '%' + c.reset
633
- );
634
-
635
- // Line 3: Architecture
636
- const dddColor = dddProgress >= 50 ? c.brightGreen : dddProgress > 0 ? c.yellow : c.red;
637
- const adrColor = adrCount > 0 ? (adrImpl === adrCount ? c.brightGreen : c.yellow) : c.dim;
638
- const adrDisplay = adrColor + '●' + adrImpl + '/' + adrCount + c.reset;
639
-
640
- lines.push(
641
- c.brightPurple + '🔧 Architecture' + c.reset + ' ' +
642
- c.cyan + 'ADRs' + c.reset + ' ' + adrDisplay + ' ' + c.dim + '│' + c.reset + ' ' +
643
- c.cyan + 'DDD' + c.reset + ' ' + dddColor + '●' + String(dddProgress).padStart(3) + '%' + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
644
- c.cyan + 'Security' + c.reset + ' ' + secColor + '●' + secStatus + c.reset
645
- );
646
-
647
- // Line 4: AgentDB, Tests, Integration
648
- const hnswInd = hasHnsw ? c.brightGreen + '⚡' + c.reset : '';
649
- const sizeDisp = dbSizeKB >= 1024 ? (dbSizeKB / 1024).toFixed(1) + 'MB' : dbSizeKB + 'KB';
650
- const vectorColor = vectorCount > 0 ? c.brightGreen : c.dim;
651
- const testColor = testFiles > 0 ? c.brightGreen : c.dim;
652
-
653
- // MCP / DB integration from data
654
- const integration = d.integration || {};
655
- const mcpServers = (integration.mcpServers) || {};
656
- let integStr = '';
657
- if (mcpServers.total > 0) {
658
- const mcpCol = mcpServers.enabled === mcpServers.total ? c.brightGreen : mcpServers.enabled > 0 ? c.brightYellow : c.red;
659
- integStr += c.cyan + 'MCP' + c.reset + ' ' + mcpCol + '●' + mcpServers.enabled + '/' + mcpServers.total + c.reset;
803
+ // Wrap a label in an OSC 8 hyperlink escape sequence. Falls back to the raw
804
+ // label whenever the URL is not an allowlisted https target, when the terminal
805
+ // can't render hyperlinks, or when parsing fails — a broken link must never
806
+ // leave a raw URL or stray escape in the statusline output.
807
+ function safeTerminalLink(label, url) {
808
+ if (!terminalSupportsHyperlinks()) return label;
809
+ if (typeof url !== 'string' || url.length === 0) return label;
810
+ let parsed;
811
+ try { parsed = new URL(url); } catch { return label; }
812
+ if (parsed.protocol !== 'https:') return label;
813
+ if (!PROMO_LINK_HOSTS.has(parsed.hostname)) return label;
814
+ const cleanLabel = String(label).replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, '');
815
+ if (cleanLabel.length === 0) return label;
816
+ const ESC = '\u001b';
817
+ return ESC + ']8;;' + parsed.href + ESC + '\\' + cleanLabel + ESC + ']8;;' + ESC + '\\';
818
+ }
819
+
820
+ function getPromoRow(d) {
821
+ try {
822
+ if (process.env.CI || process.env.GITHUB_ACTIONS) return null;
823
+ if (/^(0|false|off|no)$/i.test(String(process.env.RUFLO_FUNNEL || ''))) return null;
824
+ const promo = d && d.promo;
825
+ if (!promo || typeof promo.text !== 'string') return null;
826
+ // Strip control chars / ANSI / bidi overrides and hard-cap length —
827
+ // promo copy is data and must never emit its own terminal sequences.
828
+ const text = promo.text
829
+ .replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, '')
830
+ .slice(0, 100)
831
+ .trim();
832
+ if (text.length === 0) return null;
833
+ // Split the label from the trailing "· manage: ruflo settings" instruction
834
+ // so each part gets styling that matches what it actually IS:
835
+ // 1. label — OSC 8 hyperlink + underline. A real clickable link.
836
+ // 2. "manage:" — dim. Just a connector word, no action implied.
837
+ // 3. "ruflo settings" — bold/bright, NOT underlined. This is a shell
838
+ // command the user TYPES, not a link they CLICK — a terminal can
839
+ // never safely execute a command from a click (that would let any
840
+ // server-served message run arbitrary commands), so we deliberately
841
+ // avoid the underline/OSC8 cues that imply "clickable". Bold+bright
842
+ // instead signals "this is the important bit — copy/type it".
843
+ // Educational tips have no manage tail and no URL — plain text through.
844
+ const manageIdx = text.indexOf(' · manage: ');
845
+ const label = manageIdx > 0 ? text.slice(0, manageIdx) : text;
846
+ const manageWord = manageIdx > 0 ? ' · manage: ' : '';
847
+ const command = manageIdx > 0 ? text.slice(manageIdx + manageWord.length) : '';
848
+ const UL_ON = '\u001b[4m';
849
+ const UL_OFF = '\u001b[24m';
850
+ const DIM_ON = '\u001b[2m';
851
+ const DIM_OFF = '\u001b[22m';
852
+ const BOLD_ON = '\u001b[1m';
853
+ const BOLD_OFF = '\u001b[22m';
854
+ const linked = promo.url ? UL_ON + safeTerminalLink(label, promo.url) + UL_OFF : label;
855
+ if (!command) return linked;
856
+ return linked + DIM_ON + manageWord + DIM_OFF + BOLD_ON + command + BOLD_OFF;
857
+ } catch (e) {
858
+ return null; // the promo row must never break the statusline
660
859
  }
661
- if (integration.hasDatabase) integStr += (integStr ? ' ' : '') + c.brightGreen + '◆' + c.reset + 'DB';
662
- if (!integStr) integStr = c.dim + '● none' + c.reset;
663
-
664
- lines.push(
665
- c.brightCyan + '📊 AgentDB' + c.reset + ' ' +
666
- c.cyan + 'Vectors' + c.reset + ' ' + vectorColor + '●' + vectorCount + hnswInd + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
667
- c.cyan + 'Size' + c.reset + ' ' + c.brightWhite + sizeDisp + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
668
- c.cyan + 'Tests' + c.reset + ' ' + testColor + '●' + testFiles + c.reset + ' ' + c.dim + '(~' + testCases + ' cases)' + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
669
- integStr
670
- );
671
-
672
- return lines.join('\n');
673
860
  }
674
861
 
675
862
  // JSON output — delegates to CLI for accuracy; caller can use --json flag
@@ -1,5 +1,5 @@
1
1
  {
2
- "adoptedAt": 1783265769778,
2
+ "adoptedAt": 1783689629580,
3
3
  "championId": "sha256:6141a8ea990c5063b77e090ae8f37f9c539d8aa8f58dcceb30f3a82f97e57319",
4
4
  "manifest": {
5
5
  "schema": "ruflo.proven-config/v1",