claude-flow 3.25.5 → 3.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/.claude/helpers/.helpers-version +1 -1
  2. package/.claude/helpers/helpers.manifest.json +5 -4
  3. package/.claude/helpers/hook-handler.cjs +129 -0
  4. package/.claude/helpers/statusline.cjs +300 -123
  5. package/.claude/proven-config.json +1 -1
  6. package/.claude/security-scans/scan-all-standard.json +321 -0
  7. package/.claude/security-scans/scan-code-deep.json +1209 -0
  8. package/.claude/security-scans/scan-deps-full.json +14 -0
  9. package/package.json +3 -1
  10. package/v3/@claude-flow/cli/catalog-manifest.json +12 -0
  11. package/v3/@claude-flow/cli/dist/src/commands/advisor.d.ts +15 -0
  12. package/v3/@claude-flow/cli/dist/src/commands/advisor.js +94 -0
  13. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +151 -32
  14. package/v3/@claude-flow/cli/dist/src/commands/funnel.d.ts +13 -0
  15. package/v3/@claude-flow/cli/dist/src/commands/funnel.js +103 -0
  16. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +112 -46
  17. package/v3/@claude-flow/cli/dist/src/commands/index.js +10 -0
  18. package/v3/@claude-flow/cli/dist/src/commands/init.js +44 -0
  19. package/v3/@claude-flow/cli/dist/src/commands/proxy.d.ts +21 -0
  20. package/v3/@claude-flow/cli/dist/src/commands/proxy.js +310 -0
  21. package/v3/@claude-flow/cli/dist/src/commands/security.js +29 -0
  22. package/v3/@claude-flow/cli/dist/src/commands/settings.d.ts +19 -0
  23. package/v3/@claude-flow/cli/dist/src/commands/settings.js +180 -0
  24. package/v3/@claude-flow/cli/dist/src/commands/version.d.ts +42 -0
  25. package/v3/@claude-flow/cli/dist/src/commands/version.js +106 -0
  26. package/v3/@claude-flow/cli/dist/src/funnel/advisor-tip.d.ts +58 -0
  27. package/v3/@claude-flow/cli/dist/src/funnel/advisor-tip.js +92 -0
  28. package/v3/@claude-flow/cli/dist/src/funnel/attribution.d.ts +37 -0
  29. package/v3/@claude-flow/cli/dist/src/funnel/attribution.js +101 -0
  30. package/v3/@claude-flow/cli/dist/src/funnel/consent.d.ts +22 -0
  31. package/v3/@claude-flow/cli/dist/src/funnel/consent.js +55 -0
  32. package/v3/@claude-flow/cli/dist/src/funnel/credit-errors.d.ts +31 -0
  33. package/v3/@claude-flow/cli/dist/src/funnel/credit-errors.js +88 -0
  34. package/v3/@claude-flow/cli/dist/src/funnel/credit-notifier.d.ts +44 -0
  35. package/v3/@claude-flow/cli/dist/src/funnel/credit-notifier.js +74 -0
  36. package/v3/@claude-flow/cli/dist/src/funnel/disclosure.d.ts +46 -0
  37. package/v3/@claude-flow/cli/dist/src/funnel/disclosure.js +97 -0
  38. package/v3/@claude-flow/cli/dist/src/funnel/enrollment.d.ts +36 -0
  39. package/v3/@claude-flow/cli/dist/src/funnel/enrollment.js +64 -0
  40. package/v3/@claude-flow/cli/dist/src/funnel/environment.d.ts +17 -0
  41. package/v3/@claude-flow/cli/dist/src/funnel/environment.js +39 -0
  42. package/v3/@claude-flow/cli/dist/src/funnel/event-transport.d.ts +51 -0
  43. package/v3/@claude-flow/cli/dist/src/funnel/event-transport.js +199 -0
  44. package/v3/@claude-flow/cli/dist/src/funnel/events.d.ts +42 -0
  45. package/v3/@claude-flow/cli/dist/src/funnel/events.js +150 -0
  46. package/v3/@claude-flow/cli/dist/src/funnel/index.d.ts +20 -0
  47. package/v3/@claude-flow/cli/dist/src/funnel/index.js +20 -0
  48. package/v3/@claude-flow/cli/dist/src/funnel/insights.d.ts +49 -0
  49. package/v3/@claude-flow/cli/dist/src/funnel/insights.js +120 -0
  50. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.d.ts +15 -0
  51. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.js +68 -0
  52. package/v3/@claude-flow/cli/dist/src/funnel/message-transport.d.ts +51 -0
  53. package/v3/@claude-flow/cli/dist/src/funnel/message-transport.js +149 -0
  54. package/v3/@claude-flow/cli/dist/src/funnel/messages.d.ts +55 -0
  55. package/v3/@claude-flow/cli/dist/src/funnel/messages.js +160 -0
  56. package/v3/@claude-flow/cli/dist/src/funnel/power-saver-notifier.d.ts +44 -0
  57. package/v3/@claude-flow/cli/dist/src/funnel/power-saver-notifier.js +92 -0
  58. package/v3/@claude-flow/cli/dist/src/funnel/precedence.d.ts +16 -0
  59. package/v3/@claude-flow/cli/dist/src/funnel/precedence.js +85 -0
  60. package/v3/@claude-flow/cli/dist/src/funnel/promo.d.ts +41 -0
  61. package/v3/@claude-flow/cli/dist/src/funnel/promo.js +144 -0
  62. package/v3/@claude-flow/cli/dist/src/funnel/rate-limit-notifier.d.ts +55 -0
  63. package/v3/@claude-flow/cli/dist/src/funnel/rate-limit-notifier.js +102 -0
  64. package/v3/@claude-flow/cli/dist/src/funnel/rotation.d.ts +19 -0
  65. package/v3/@claude-flow/cli/dist/src/funnel/rotation.js +70 -0
  66. package/v3/@claude-flow/cli/dist/src/funnel/state.d.ts +13 -0
  67. package/v3/@claude-flow/cli/dist/src/funnel/state.js +52 -0
  68. package/v3/@claude-flow/cli/dist/src/funnel/toggle-cooldown.d.ts +17 -0
  69. package/v3/@claude-flow/cli/dist/src/funnel/toggle-cooldown.js +32 -0
  70. package/v3/@claude-flow/cli/dist/src/funnel/types.d.ts +86 -0
  71. package/v3/@claude-flow/cli/dist/src/funnel/types.js +26 -0
  72. package/v3/@claude-flow/cli/dist/src/init/executor.js +25 -19
  73. package/v3/@claude-flow/cli/dist/src/init/helper-refresh.d.ts +33 -2
  74. package/v3/@claude-flow/cli/dist/src/init/helper-refresh.js +102 -12
  75. package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +52 -0
  76. package/v3/@claude-flow/cli/dist/src/init/mcp-generator.js +11 -6
  77. package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +282 -116
  78. package/v3/@claude-flow/cli/dist/src/services/daemon-autostart.js +28 -5
  79. package/v3/@claude-flow/cli/dist/src/services/fable-harness.d.ts +39 -0
  80. package/v3/@claude-flow/cli/dist/src/services/fable-harness.js +41 -0
  81. package/v3/@claude-flow/cli/package.json +16 -4
  82. package/v3/README.md +493 -0
  83. package/.claude/coordinator/config.json +0 -24
  84. package/.claude/coordinator/state.json +0 -37
  85. package/.claude/coordinator/tick-log/tick-01.json +0 -17
  86. package/.claude/coordinator/tick-log/tick-02.json +0 -17
  87. package/.claude/coordinator/tick-log/tick-03.json +0 -17
  88. package/.claude/coordinator/tick-log/tick-04.json +0 -14
  89. package/.claude/coordinator/tick-log/tick-05.json +0 -16
  90. package/.claude/settings.local.json +0 -11
  91. package/v3/@claude-flow/cli/dist/src/ruvector/lattice-wasm.d.ts +0 -14
  92. package/v3/@claude-flow/cli/dist/src/ruvector/lattice-wasm.js +0 -144
  93. package/v3/@claude-flow/guidance/dist/adversarial.d.ts +0 -284
  94. package/v3/@claude-flow/guidance/dist/adversarial.js +0 -572
  95. package/v3/@claude-flow/guidance/dist/analyzer.d.ts +0 -530
  96. package/v3/@claude-flow/guidance/dist/analyzer.js +0 -2587
  97. package/v3/@claude-flow/guidance/dist/artifacts.d.ts +0 -283
  98. package/v3/@claude-flow/guidance/dist/artifacts.js +0 -356
  99. package/v3/@claude-flow/guidance/dist/authority.d.ts +0 -290
  100. package/v3/@claude-flow/guidance/dist/authority.js +0 -558
  101. package/v3/@claude-flow/guidance/dist/capabilities.d.ts +0 -209
  102. package/v3/@claude-flow/guidance/dist/capabilities.js +0 -485
  103. package/v3/@claude-flow/guidance/dist/coherence.d.ts +0 -233
  104. package/v3/@claude-flow/guidance/dist/coherence.js +0 -372
  105. package/v3/@claude-flow/guidance/dist/compiler.d.ts +0 -87
  106. package/v3/@claude-flow/guidance/dist/compiler.js +0 -410
  107. package/v3/@claude-flow/guidance/dist/conformance-kit.d.ts +0 -225
  108. package/v3/@claude-flow/guidance/dist/conformance-kit.js +0 -629
  109. package/v3/@claude-flow/guidance/dist/continue-gate.d.ts +0 -214
  110. package/v3/@claude-flow/guidance/dist/continue-gate.js +0 -353
  111. package/v3/@claude-flow/guidance/dist/crypto-utils.d.ts +0 -17
  112. package/v3/@claude-flow/guidance/dist/crypto-utils.js +0 -24
  113. package/v3/@claude-flow/guidance/dist/evolution.d.ts +0 -282
  114. package/v3/@claude-flow/guidance/dist/evolution.js +0 -500
  115. package/v3/@claude-flow/guidance/dist/gates.d.ts +0 -79
  116. package/v3/@claude-flow/guidance/dist/gates.js +0 -302
  117. package/v3/@claude-flow/guidance/dist/gateway.d.ts +0 -206
  118. package/v3/@claude-flow/guidance/dist/gateway.js +0 -452
  119. package/v3/@claude-flow/guidance/dist/generators.d.ts +0 -153
  120. package/v3/@claude-flow/guidance/dist/generators.js +0 -682
  121. package/v3/@claude-flow/guidance/dist/headless.d.ts +0 -177
  122. package/v3/@claude-flow/guidance/dist/headless.js +0 -342
  123. package/v3/@claude-flow/guidance/dist/hooks.d.ts +0 -109
  124. package/v3/@claude-flow/guidance/dist/hooks.js +0 -347
  125. package/v3/@claude-flow/guidance/dist/index.d.ts +0 -205
  126. package/v3/@claude-flow/guidance/dist/index.js +0 -321
  127. package/v3/@claude-flow/guidance/dist/ledger.d.ts +0 -162
  128. package/v3/@claude-flow/guidance/dist/ledger.js +0 -375
  129. package/v3/@claude-flow/guidance/dist/manifest-validator.d.ts +0 -289
  130. package/v3/@claude-flow/guidance/dist/manifest-validator.js +0 -838
  131. package/v3/@claude-flow/guidance/dist/memory-gate.d.ts +0 -222
  132. package/v3/@claude-flow/guidance/dist/memory-gate.js +0 -382
  133. package/v3/@claude-flow/guidance/dist/meta-governance.d.ts +0 -265
  134. package/v3/@claude-flow/guidance/dist/meta-governance.js +0 -348
  135. package/v3/@claude-flow/guidance/dist/optimizer.d.ts +0 -104
  136. package/v3/@claude-flow/guidance/dist/optimizer.js +0 -329
  137. package/v3/@claude-flow/guidance/dist/persistence.d.ts +0 -189
  138. package/v3/@claude-flow/guidance/dist/persistence.js +0 -464
  139. package/v3/@claude-flow/guidance/dist/proof.d.ts +0 -185
  140. package/v3/@claude-flow/guidance/dist/proof.js +0 -238
  141. package/v3/@claude-flow/guidance/dist/retriever.d.ts +0 -172
  142. package/v3/@claude-flow/guidance/dist/retriever.js +0 -596
  143. package/v3/@claude-flow/guidance/dist/ruvbot-integration.d.ts +0 -370
  144. package/v3/@claude-flow/guidance/dist/ruvbot-integration.js +0 -738
  145. package/v3/@claude-flow/guidance/dist/temporal.d.ts +0 -426
  146. package/v3/@claude-flow/guidance/dist/temporal.js +0 -658
  147. package/v3/@claude-flow/guidance/dist/trust.d.ts +0 -283
  148. package/v3/@claude-flow/guidance/dist/trust.js +0 -473
  149. package/v3/@claude-flow/guidance/dist/truth-anchors.d.ts +0 -276
  150. package/v3/@claude-flow/guidance/dist/truth-anchors.js +0 -488
  151. package/v3/@claude-flow/guidance/dist/types.d.ts +0 -378
  152. package/v3/@claude-flow/guidance/dist/types.js +0 -10
  153. package/v3/@claude-flow/guidance/dist/uncertainty.d.ts +0 -372
  154. package/v3/@claude-flow/guidance/dist/uncertainty.js +0 -619
  155. package/v3/@claude-flow/guidance/dist/wasm-kernel.d.ts +0 -48
  156. package/v3/@claude-flow/guidance/dist/wasm-kernel.js +0 -158
  157. package/v3/@claude-flow/shared/dist/core/config/defaults.d.ts +0 -41
  158. package/v3/@claude-flow/shared/dist/core/config/defaults.js +0 -186
  159. package/v3/@claude-flow/shared/dist/core/config/index.d.ts +0 -8
  160. package/v3/@claude-flow/shared/dist/core/config/index.js +0 -12
  161. package/v3/@claude-flow/shared/dist/core/config/loader.d.ts +0 -45
  162. package/v3/@claude-flow/shared/dist/core/config/loader.js +0 -238
  163. package/v3/@claude-flow/shared/dist/core/config/schema.d.ts +0 -1728
  164. package/v3/@claude-flow/shared/dist/core/config/schema.js +0 -160
  165. package/v3/@claude-flow/shared/dist/core/config/validator.d.ts +0 -92
  166. package/v3/@claude-flow/shared/dist/core/config/validator.js +0 -147
  167. package/v3/@claude-flow/shared/dist/core/event-bus.d.ts +0 -31
  168. package/v3/@claude-flow/shared/dist/core/event-bus.js +0 -197
  169. package/v3/@claude-flow/shared/dist/core/index.d.ts +0 -15
  170. package/v3/@claude-flow/shared/dist/core/index.js +0 -19
  171. package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.d.ts +0 -200
  172. package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.js +0 -6
  173. package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.d.ts +0 -310
  174. package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.js +0 -7
  175. package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.d.ts +0 -224
  176. package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.js +0 -46
  177. package/v3/@claude-flow/shared/dist/core/interfaces/index.d.ts +0 -10
  178. package/v3/@claude-flow/shared/dist/core/interfaces/index.js +0 -15
  179. package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.d.ts +0 -298
  180. package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.js +0 -7
  181. package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.d.ts +0 -185
  182. package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.js +0 -6
  183. package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.d.ts +0 -35
  184. package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.js +0 -101
  185. package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.d.ts +0 -60
  186. package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.js +0 -166
  187. package/v3/@claude-flow/shared/dist/core/orchestrator/index.d.ts +0 -46
  188. package/v3/@claude-flow/shared/dist/core/orchestrator/index.js +0 -64
  189. package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.d.ts +0 -56
  190. package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.js +0 -195
  191. package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.d.ts +0 -83
  192. package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.js +0 -193
  193. package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.d.ts +0 -49
  194. package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.js +0 -253
  195. package/v3/@claude-flow/shared/dist/events/domain-events.d.ts +0 -282
  196. package/v3/@claude-flow/shared/dist/events/domain-events.js +0 -165
  197. package/v3/@claude-flow/shared/dist/events/event-store.d.ts +0 -126
  198. package/v3/@claude-flow/shared/dist/events/event-store.js +0 -427
  199. package/v3/@claude-flow/shared/dist/events/event-store.test.d.ts +0 -8
  200. package/v3/@claude-flow/shared/dist/events/event-store.test.js +0 -293
  201. package/v3/@claude-flow/shared/dist/events/example-usage.d.ts +0 -10
  202. package/v3/@claude-flow/shared/dist/events/example-usage.js +0 -193
  203. package/v3/@claude-flow/shared/dist/events/index.d.ts +0 -21
  204. package/v3/@claude-flow/shared/dist/events/index.js +0 -22
  205. package/v3/@claude-flow/shared/dist/events/projections.d.ts +0 -177
  206. package/v3/@claude-flow/shared/dist/events/projections.js +0 -421
  207. package/v3/@claude-flow/shared/dist/events/rvf-event-log.d.ts +0 -82
  208. package/v3/@claude-flow/shared/dist/events/rvf-event-log.js +0 -340
  209. package/v3/@claude-flow/shared/dist/events/state-reconstructor.d.ts +0 -101
  210. package/v3/@claude-flow/shared/dist/events/state-reconstructor.js +0 -263
  211. package/v3/@claude-flow/shared/dist/events.d.ts +0 -80
  212. package/v3/@claude-flow/shared/dist/events.js +0 -249
  213. package/v3/@claude-flow/shared/dist/hooks/example-usage.d.ts +0 -42
  214. package/v3/@claude-flow/shared/dist/hooks/example-usage.js +0 -351
  215. package/v3/@claude-flow/shared/dist/hooks/executor.d.ts +0 -100
  216. package/v3/@claude-flow/shared/dist/hooks/executor.js +0 -267
  217. package/v3/@claude-flow/shared/dist/hooks/hooks.test.d.ts +0 -9
  218. package/v3/@claude-flow/shared/dist/hooks/hooks.test.js +0 -322
  219. package/v3/@claude-flow/shared/dist/hooks/index.d.ts +0 -52
  220. package/v3/@claude-flow/shared/dist/hooks/index.js +0 -51
  221. package/v3/@claude-flow/shared/dist/hooks/registry.d.ts +0 -133
  222. package/v3/@claude-flow/shared/dist/hooks/registry.js +0 -277
  223. package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.d.ts +0 -105
  224. package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.js +0 -481
  225. package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.d.ts +0 -144
  226. package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.js +0 -328
  227. package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.d.ts +0 -158
  228. package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.js +0 -450
  229. package/v3/@claude-flow/shared/dist/hooks/safety/index.d.ts +0 -17
  230. package/v3/@claude-flow/shared/dist/hooks/safety/index.js +0 -17
  231. package/v3/@claude-flow/shared/dist/hooks/session-hooks.d.ts +0 -234
  232. package/v3/@claude-flow/shared/dist/hooks/session-hooks.js +0 -334
  233. package/v3/@claude-flow/shared/dist/hooks/task-hooks.d.ts +0 -163
  234. package/v3/@claude-flow/shared/dist/hooks/task-hooks.js +0 -326
  235. package/v3/@claude-flow/shared/dist/hooks/types.d.ts +0 -267
  236. package/v3/@claude-flow/shared/dist/hooks/types.js +0 -62
  237. package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.d.ts +0 -9
  238. package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.js +0 -93
  239. package/v3/@claude-flow/shared/dist/index.d.ts +0 -20
  240. package/v3/@claude-flow/shared/dist/index.js +0 -50
  241. package/v3/@claude-flow/shared/dist/mcp/connection-pool.d.ts +0 -98
  242. package/v3/@claude-flow/shared/dist/mcp/connection-pool.js +0 -364
  243. package/v3/@claude-flow/shared/dist/mcp/index.d.ts +0 -69
  244. package/v3/@claude-flow/shared/dist/mcp/index.js +0 -84
  245. package/v3/@claude-flow/shared/dist/mcp/server.d.ts +0 -166
  246. package/v3/@claude-flow/shared/dist/mcp/server.js +0 -590
  247. package/v3/@claude-flow/shared/dist/mcp/session-manager.d.ts +0 -136
  248. package/v3/@claude-flow/shared/dist/mcp/session-manager.js +0 -335
  249. package/v3/@claude-flow/shared/dist/mcp/tool-registry.d.ts +0 -178
  250. package/v3/@claude-flow/shared/dist/mcp/tool-registry.js +0 -439
  251. package/v3/@claude-flow/shared/dist/mcp/transport/http.d.ts +0 -104
  252. package/v3/@claude-flow/shared/dist/mcp/transport/http.js +0 -476
  253. package/v3/@claude-flow/shared/dist/mcp/transport/index.d.ts +0 -102
  254. package/v3/@claude-flow/shared/dist/mcp/transport/index.js +0 -238
  255. package/v3/@claude-flow/shared/dist/mcp/transport/stdio.d.ts +0 -104
  256. package/v3/@claude-flow/shared/dist/mcp/transport/stdio.js +0 -263
  257. package/v3/@claude-flow/shared/dist/mcp/transport/websocket.d.ts +0 -133
  258. package/v3/@claude-flow/shared/dist/mcp/transport/websocket.js +0 -396
  259. package/v3/@claude-flow/shared/dist/mcp/types.d.ts +0 -436
  260. package/v3/@claude-flow/shared/dist/mcp/types.js +0 -54
  261. package/v3/@claude-flow/shared/dist/plugin-interface.d.ts +0 -544
  262. package/v3/@claude-flow/shared/dist/plugin-interface.js +0 -23
  263. package/v3/@claude-flow/shared/dist/plugin-loader.d.ts +0 -139
  264. package/v3/@claude-flow/shared/dist/plugin-loader.js +0 -434
  265. package/v3/@claude-flow/shared/dist/plugin-registry.d.ts +0 -183
  266. package/v3/@claude-flow/shared/dist/plugin-registry.js +0 -457
  267. package/v3/@claude-flow/shared/dist/plugins/index.d.ts +0 -10
  268. package/v3/@claude-flow/shared/dist/plugins/index.js +0 -10
  269. package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.d.ts +0 -106
  270. package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.js +0 -241
  271. package/v3/@claude-flow/shared/dist/plugins/official/index.d.ts +0 -10
  272. package/v3/@claude-flow/shared/dist/plugins/official/index.js +0 -10
  273. package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.d.ts +0 -121
  274. package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.js +0 -355
  275. package/v3/@claude-flow/shared/dist/plugins/types.d.ts +0 -93
  276. package/v3/@claude-flow/shared/dist/plugins/types.js +0 -9
  277. package/v3/@claude-flow/shared/dist/resilience/bulkhead.d.ts +0 -105
  278. package/v3/@claude-flow/shared/dist/resilience/bulkhead.js +0 -206
  279. package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.d.ts +0 -132
  280. package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.js +0 -233
  281. package/v3/@claude-flow/shared/dist/resilience/index.d.ts +0 -19
  282. package/v3/@claude-flow/shared/dist/resilience/index.js +0 -19
  283. package/v3/@claude-flow/shared/dist/resilience/rate-limiter.d.ts +0 -168
  284. package/v3/@claude-flow/shared/dist/resilience/rate-limiter.js +0 -314
  285. package/v3/@claude-flow/shared/dist/resilience/retry.d.ts +0 -91
  286. package/v3/@claude-flow/shared/dist/resilience/retry.js +0 -159
  287. package/v3/@claude-flow/shared/dist/security/index.d.ts +0 -10
  288. package/v3/@claude-flow/shared/dist/security/index.js +0 -12
  289. package/v3/@claude-flow/shared/dist/security/input-validation.d.ts +0 -73
  290. package/v3/@claude-flow/shared/dist/security/input-validation.js +0 -201
  291. package/v3/@claude-flow/shared/dist/security/secure-random.d.ts +0 -92
  292. package/v3/@claude-flow/shared/dist/security/secure-random.js +0 -142
  293. package/v3/@claude-flow/shared/dist/services/index.d.ts +0 -7
  294. package/v3/@claude-flow/shared/dist/services/index.js +0 -7
  295. package/v3/@claude-flow/shared/dist/services/v3-progress.service.d.ts +0 -124
  296. package/v3/@claude-flow/shared/dist/services/v3-progress.service.js +0 -402
  297. package/v3/@claude-flow/shared/dist/types/agent.types.d.ts +0 -137
  298. package/v3/@claude-flow/shared/dist/types/agent.types.js +0 -6
  299. package/v3/@claude-flow/shared/dist/types/index.d.ts +0 -11
  300. package/v3/@claude-flow/shared/dist/types/index.js +0 -17
  301. package/v3/@claude-flow/shared/dist/types/mcp.types.d.ts +0 -266
  302. package/v3/@claude-flow/shared/dist/types/mcp.types.js +0 -7
  303. package/v3/@claude-flow/shared/dist/types/memory.types.d.ts +0 -236
  304. package/v3/@claude-flow/shared/dist/types/memory.types.js +0 -7
  305. package/v3/@claude-flow/shared/dist/types/swarm.types.d.ts +0 -186
  306. package/v3/@claude-flow/shared/dist/types/swarm.types.js +0 -65
  307. package/v3/@claude-flow/shared/dist/types/task.types.d.ts +0 -178
  308. package/v3/@claude-flow/shared/dist/types/task.types.js +0 -32
  309. package/v3/@claude-flow/shared/dist/types.d.ts +0 -197
  310. package/v3/@claude-flow/shared/dist/types.js +0 -21
  311. package/v3/@claude-flow/shared/dist/utils/secure-logger.d.ts +0 -69
  312. 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,65 @@ 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
+ const cmds = resolveCliBinCandidates()
203
+ .map((bin) => '"' + process.execPath + '" "' + bin + '" hooks statusline --json 2>/dev/null')
204
+ .concat(['npx --prefer-offline @claude-flow/cli hooks statusline --json 2>/dev/null']);
205
+ for (const cmd of cmds) {
206
+ try {
207
+ const raw = execSync(
208
+ cmd,
209
+ { encoding: 'utf-8', timeout: 8000, stdio: ['pipe', 'pipe', 'pipe'], cwd: CWD }
210
+ ).trim();
211
+ // The CLI may emit preamble lines before the JSON — find the first '{'.
212
+ const jsonStart = raw.indexOf('{');
213
+ if (jsonStart === -1) throw new Error('no JSON in CLI output');
214
+ const data = JSON.parse(raw.slice(jsonStart));
215
+ // Overlay every block the CLI JSON omits (adrs/agentdb/tests/hooks/integration)
216
+ // with real local reads, so those segments reflect actual state instead of 0.
217
+ applyLocalOverlays(data);
218
+ overlayMemoPromo(data);
219
+ writeCache(data);
220
+ return data;
221
+ } catch { /* this candidate unavailable, broken, or timed out — try the next */ }
222
+ }
118
223
 
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();
224
+ // Stale-while-revalidate: if we have any cached data, keep serving it so the
225
+ // funnel row doesn't flicker on CLI hiccups. Overlay fresh local reads for
226
+ // the segments the CLI JSON doesn't populate; the promo row survives.
227
+ if (cache.data) {
228
+ applyLocalOverlays(cache.data);
229
+ overlayMemoPromo(cache.data);
230
+ return cache.data;
231
+ }
232
+
233
+ // Last resort: local probes + memo. Users still see the funnel row.
234
+ return overlayMemoPromo(buildLocalFallback());
146
235
  }
147
236
 
148
237
  // Count ADRs from BOTH known directories (fix for ruflo#2195: old code missed
@@ -188,13 +277,24 @@ function getLocalAgentDB() {
188
277
  const memDb = path.join(CWD, '.swarm', 'memory.db');
189
278
  if (fs.existsSync(memDb)) {
190
279
  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
- }
280
+ // Two INDEPENDENT statements -- do NOT combine into one. Coupling the
281
+ // vector count with the vector_indexes row count in a single statement
282
+ // meant that on a DB missing the vector_indexes table (older/agentdb-
283
+ // written DBs), the whole statement failed at PREPARE time (SQLite
284
+ // compiles the full SQL before running), so the valid memory_entries
285
+ // count was discarded too and the statusline showed Vectors 0 despite
286
+ // thousands of real vectors. Split so a missing table can only zero the
287
+ // HNSW flag, never the count. The init self-heal provisions the table so
288
+ // the flag recovers on the next ruflo init / MCP start.
289
+ const countSql = Q + 'SELECT COUNT(*) FROM memory_entries WHERE embedding IS NOT NULL;' + Q;
290
+ const vc = safeExec("sqlite3 'file:" + memDb + "?mode=ro' " + countSql, 1500);
291
+ if (vc) result.vectorCount = parseInt(vc, 10) || 0;
292
+ // HNSW flag: separate statement. If vector_indexes is absent, sqlite3
293
+ // exits non-zero and safeExec returns empty -- hasHnsw stays false (exact
294
+ // original semantics: at least one index-config row present).
295
+ const hnswSql = Q + 'SELECT COUNT(*) FROM vector_indexes;' + Q;
296
+ const hn = safeExec("sqlite3 'file:" + memDb + "?mode=ro' " + hnswSql, 1500);
297
+ if (hn) result.hasHnsw = (parseInt(hn, 10) || 0) > 0;
198
298
  }
199
299
  } catch { /* ignore */ }
200
300
  return result;
@@ -531,7 +631,11 @@ function generateStatusline() {
531
631
  const modelName = getModelFromStdin() || (d.user && d.user.modelName) || 'Claude Code';
532
632
  const ctxInfo = getContextFromStdin();
533
633
  const costInfo = getCostFromStdin();
534
- const pkgVersion = getPkgVersion();
634
+ // Named RUFLO_VERSION (not pkgVersion) so the #1951 regression guard
635
+ // (scripts/audit-fix-invariants.mjs) can pin its presence in the emitted
636
+ // .cjs artifact — without it the header silently reverts to a hard-coded
637
+ // "RuFlo V3.5" for anyone whose install doesn't match the first probe path.
638
+ const RUFLO_VERSION = getPkgVersion();
535
639
 
536
640
  const progress = d.v3Progress || {};
537
641
  const security = d.security || {};
@@ -567,8 +671,14 @@ function generateStatusline() {
567
671
 
568
672
  const lines = [];
569
673
 
570
- // Header
571
- let header = c.bold + c.brightPurple + '▊ RuFlo V' + pkgVersion + ' ' + c.reset;
674
+ // 3-line design (fits Claude Code's visible statusline area — line 4+ gets
675
+ // replaced by the system guidance / input prompt line):
676
+ // Line 1 — Header (RuFlo version · git · model · timing · context · cost)
677
+ // Line 2 — Compressed ops (Swarm · Hooks · 🧠 · 💾 · Health)
678
+ // Line 3 — Promo / disclosure row (funnel surface, ADR-301)
679
+
680
+ // ─── Line 1: header ────────────────────────────────────────────
681
+ let header = c.bold + c.brightPurple + '▊ RuFlo V' + RUFLO_VERSION + ' ' + c.reset;
572
682
  header += (coordinationActive ? c.brightCyan : c.dim) + '● ' + c.brightCyan + git.name + c.reset;
573
683
  if (git.gitBranch) {
574
684
  header += ' ' + c.dim + '│' + c.reset + ' ' + c.brightBlue + '⏇ ' + git.gitBranch + c.reset;
@@ -595,81 +705,148 @@ function generateStatusline() {
595
705
  }
596
706
  lines.push(header);
597
707
 
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);
708
+ // ─── Line 2: compressed ops ────────────────────────────────────
709
+ // Everything actionable in one dense row. Show only what changes what you
710
+ // do next; diagnostic detail moves to `ruflo status --verbose`.
711
+ const agentsColor = activeAgents > 0 ? c.brightGreen : c.dim;
623
712
  const hooksColor = hooksEnabled > 0 ? c.brightGreen : c.dim;
624
713
  const intellColor = intelligencePct >= 80 ? c.brightGreen : intelligencePct >= 40 ? c.brightYellow : c.dim;
714
+ const swarmInd = coordinationActive ? c.brightGreen + '◉' + c.reset + ' ' : c.dim + '○' + c.reset + ' ';
715
+ const cvesClean = totalCves === 0 || cvesFixed === totalCves;
716
+ const healthAllGreen = (secStatus === 'CLEAN' || secStatus === 'NONE') && cvesClean;
717
+ const opsParts = [];
718
+ opsParts.push(c.cyan + 'Swarm ' + swarmInd + agentsColor + activeAgents + c.reset + '/' + c.brightWhite + maxAgents + c.reset);
719
+ if (subAgents > 0) opsParts.push(c.brightPurple + '👥 ' + subAgents + c.reset);
720
+ opsParts.push(c.cyan + 'Hooks ' + hooksColor + hooksEnabled + c.reset + '/' + c.brightWhite + hooksTotal + c.reset);
721
+ opsParts.push(intellColor + '🧠 ' + intelligencePct + '%' + c.reset);
722
+ opsParts.push(c.brightCyan + '💾 ' + memoryMB + 'MB' + c.reset);
723
+ // Health: one glyph when green, terse copy when there's something to act on.
724
+ if (healthAllGreen) {
725
+ opsParts.push(c.brightGreen + '🛡 ✓' + c.reset);
726
+ } else {
727
+ if (secStatus === 'PENDING') opsParts.push(c.brightYellow + '🛡 scan pending' + c.reset);
728
+ else if (secStatus === 'IN_PROGRESS') opsParts.push(c.brightYellow + '🛡 scanning…' + c.reset);
729
+ else if (secStatus === 'STALE') opsParts.push(c.brightYellow + '🛡 scan stale' + c.reset);
730
+ else if (secStatus !== 'NONE' && secStatus !== 'CLEAN') opsParts.push(c.brightRed + '🛡 ' + secStatus.toLowerCase() + c.reset);
731
+ if (totalCves > 0 && cvesFixed < totalCves) {
732
+ const unfixed = totalCves - cvesFixed;
733
+ opsParts.push(c.brightRed + '⚠ ' + unfixed + ' CVE' + (unfixed === 1 ? '' : 's') + c.reset);
734
+ }
735
+ }
736
+ lines.push(opsParts.join(' ' + c.dim + '·' + c.reset + ' '));
737
+
738
+ // ─── Line 3: promo / disclosure / insight ───────────────────────
739
+ // Colored by content kind so it reads as *what it is*, not as noise:
740
+ // disclosure → brightCyan (announcement / capability link)
741
+ // promotional → brightPurple (Cognitum sponsor spot)
742
+ // educational → yellow (a tip)
743
+ // insight → brightRed (environment/task-aware, local, actionable —
744
+ // distinct from remote content on purpose)
745
+ const promoRow = getPromoRow(d);
746
+ if (promoRow) {
747
+ const kind = (d && d.promo && d.promo.kind) || 'disclosure';
748
+ const promoColor = kind === 'promotional' ? c.brightPurple
749
+ : kind === 'educational' ? c.yellow
750
+ : kind === 'insight' ? c.brightRed
751
+ : c.brightCyan;
752
+ lines.push(promoColor + promoRow + c.reset);
753
+ }
754
+
755
+ // Trailing blank line so Claude Code's input prompt gets breathing room
756
+ // instead of butting directly against the last statusline row.
757
+ return lines.join('\n') + '\n';
758
+ }
759
+
760
+ // ─── Funnel promo row (ADR-301) ─────────────────────────────────
761
+ // Allowlist for OSC 8 hyperlink targets. Ships in code (not in payload) so
762
+ // no message can smuggle a link to an unapproved host.
763
+ //
764
+ // The final destination hosts (cognitum.one / agentics.org) AND the
765
+ // click-redirect host are both allowlisted here: promo.ts routes every
766
+ // clickable message through the server-side click-redirect (ADR-311 §7)
767
+ // so promo_open + geo are captured before the 302 to the real target —
768
+ // so the OSC 8 link the renderer emits points at the redirect host, not
769
+ // the final destination directly.
770
+ const PROMO_LINK_HOSTS = new Set([
771
+ 'cognitum.one', 'www.cognitum.one', 'docs.cognitum.one',
772
+ // agentics.org — OSS foundation, distinct sponsor domain. Kept in sync
773
+ // with messages.ts ALLOWED_URL_HOSTS.
774
+ 'agentics.org', 'www.agentics.org',
775
+ // Click-redirect host (funnel.ruv.io once its TLS cert is live; the raw
776
+ // Cloud Run hostname is allowlisted too since event-transport.ts /
777
+ // message-transport.ts / attribution.ts currently point at it as a TEMP
778
+ // fallback while the domain mapping's cert provisions).
779
+ 'funnel.ruv.io',
780
+ 'cognitum-analytics-63rzcdswba-uc.a.run.app',
781
+ ]);
782
+
783
+ // Emit OSC 8 hyperlinks unless the environment is known-broken. tmux mangles
784
+ // raw OSC 8 (see anthropics/claude-code#27047) — opt in via env if wrapped.
785
+ function terminalSupportsHyperlinks() {
786
+ if (process.env.CI || process.env.GITHUB_ACTIONS) return false;
787
+ if (process.env.TERM === 'dumb') return false;
788
+ if (/^(0|false|off|no)$/i.test(String(process.env.RUFLO_STATUSLINE_HYPERLINKS || ''))) return false;
789
+ if (process.env.TMUX && !process.env.RUFLO_STATUSLINE_HYPERLINKS_TMUX) return false;
790
+ return true;
791
+ }
625
792
 
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;
793
+ // Wrap a label in an OSC 8 hyperlink escape sequence. Falls back to the raw
794
+ // label whenever the URL is not an allowlisted https target, when the terminal
795
+ // can't render hyperlinks, or when parsing fails — a broken link must never
796
+ // leave a raw URL or stray escape in the statusline output.
797
+ function safeTerminalLink(label, url) {
798
+ if (!terminalSupportsHyperlinks()) return label;
799
+ if (typeof url !== 'string' || url.length === 0) return label;
800
+ let parsed;
801
+ try { parsed = new URL(url); } catch { return label; }
802
+ if (parsed.protocol !== 'https:') return label;
803
+ if (!PROMO_LINK_HOSTS.has(parsed.hostname)) return label;
804
+ const cleanLabel = String(label).replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, '');
805
+ if (cleanLabel.length === 0) return label;
806
+ const ESC = '\u001b';
807
+ return ESC + ']8;;' + parsed.href + ESC + '\\' + cleanLabel + ESC + ']8;;' + ESC + '\\';
808
+ }
809
+
810
+ function getPromoRow(d) {
811
+ try {
812
+ if (process.env.CI || process.env.GITHUB_ACTIONS) return null;
813
+ if (/^(0|false|off|no)$/i.test(String(process.env.RUFLO_FUNNEL || ''))) return null;
814
+ const promo = d && d.promo;
815
+ if (!promo || typeof promo.text !== 'string') return null;
816
+ // Strip control chars / ANSI / bidi overrides and hard-cap length —
817
+ // promo copy is data and must never emit its own terminal sequences.
818
+ const text = promo.text
819
+ .replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, '')
820
+ .slice(0, 100)
821
+ .trim();
822
+ if (text.length === 0) return null;
823
+ // Split the label from the trailing "· manage: ruflo settings" instruction
824
+ // so each part gets styling that matches what it actually IS:
825
+ // 1. label — OSC 8 hyperlink + underline. A real clickable link.
826
+ // 2. "manage:" — dim. Just a connector word, no action implied.
827
+ // 3. "ruflo settings" — bold/bright, NOT underlined. This is a shell
828
+ // command the user TYPES, not a link they CLICK — a terminal can
829
+ // never safely execute a command from a click (that would let any
830
+ // server-served message run arbitrary commands), so we deliberately
831
+ // avoid the underline/OSC8 cues that imply "clickable". Bold+bright
832
+ // instead signals "this is the important bit — copy/type it".
833
+ // Educational tips have no manage tail and no URL — plain text through.
834
+ const manageIdx = text.indexOf(' · manage: ');
835
+ const label = manageIdx > 0 ? text.slice(0, manageIdx) : text;
836
+ const manageWord = manageIdx > 0 ? ' · manage: ' : '';
837
+ const command = manageIdx > 0 ? text.slice(manageIdx + manageWord.length) : '';
838
+ const UL_ON = '\u001b[4m';
839
+ const UL_OFF = '\u001b[24m';
840
+ const DIM_ON = '\u001b[2m';
841
+ const DIM_OFF = '\u001b[22m';
842
+ const BOLD_ON = '\u001b[1m';
843
+ const BOLD_OFF = '\u001b[22m';
844
+ const linked = promo.url ? UL_ON + safeTerminalLink(label, promo.url) + UL_OFF : label;
845
+ if (!command) return linked;
846
+ return linked + DIM_ON + manageWord + DIM_OFF + BOLD_ON + command + BOLD_OFF;
847
+ } catch (e) {
848
+ return null; // the promo row must never break the statusline
660
849
  }
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
850
  }
674
851
 
675
852
  // 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",