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
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Consent domains and versioned receipts — ADR-302.
3
+ *
4
+ * Four+ distinct decisions, never bundled: account, proxy-install,
5
+ * telemetry, cloud-routing, hosted-memory. A receipt is written on both
6
+ * grant AND decline (a decline is a decision, not an absence). A stale
7
+ * policyVersion means the consent must be re-asked before the capability
8
+ * activates — never silently carried forward.
9
+ */
10
+ import { CONSENT_POLICY_VERSION } from './types.js';
11
+ import { readStateJson, writeStateJson } from './state.js';
12
+ const CONSENT_FILE = 'consent.json';
13
+ export const CONSENT_DOMAINS = [
14
+ 'account',
15
+ 'proxy-install',
16
+ 'telemetry',
17
+ 'cloud-routing',
18
+ 'hosted-memory',
19
+ 'sponsored-downtime',
20
+ 'power-saver',
21
+ 'training-data-sharing',
22
+ 'advisor-tips',
23
+ ];
24
+ export function readConsents() {
25
+ return readStateJson(CONSENT_FILE) ?? {};
26
+ }
27
+ export function getConsent(domain) {
28
+ const file = readConsents();
29
+ return (file[domain] ?? { granted: false, policyVersion: CONSENT_POLICY_VERSION, at: null, surface: null });
30
+ }
31
+ /**
32
+ * Effective consent: granted AND at the current policy version. A receipt
33
+ * from an older policy version is treated as not-consented (re-ask, never
34
+ * carry forward).
35
+ */
36
+ export function hasConsent(domain) {
37
+ const r = getConsent(domain);
38
+ return r.granted === true && r.at !== null && r.policyVersion === CONSENT_POLICY_VERSION;
39
+ }
40
+ export function recordConsent(domain, granted, surface, now = new Date()) {
41
+ const file = readConsents();
42
+ const receipt = {
43
+ granted,
44
+ policyVersion: CONSENT_POLICY_VERSION,
45
+ at: now.toISOString(),
46
+ surface,
47
+ };
48
+ file[domain] = receipt;
49
+ writeStateJson(CONSENT_FILE, file);
50
+ return receipt;
51
+ }
52
+ export function revokeConsent(domain, surface) {
53
+ return recordConsent(domain, false, surface);
54
+ }
55
+ //# sourceMappingURL=consent.js.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Credit-error taxonomy and fail-closed classifier — ADR-303.
3
+ *
4
+ * Adapters map machine-readable provider codes into the canonical
5
+ * CreditErrorCode enum. Message text is NEVER parsed. Anything unmapped
6
+ * stays unclassified (confidence 0) and falls through to the ordinary
7
+ * error path. Only COGNITUM_CREDIT_EXHAUSTED — asserted by the Cognitum
8
+ * ledger, the single credit authority — may trigger the funnel surface.
9
+ */
10
+ import { type NormalizedCreditError } from './types.js';
11
+ export interface ProviderErrorLike {
12
+ /** Machine-readable provider error code (e.g. `error.type` / `error.code`). */
13
+ providerCode?: string;
14
+ /** HTTP status, when the transport exposes one. */
15
+ status?: number;
16
+ }
17
+ export declare function classifyCreditError(err: ProviderErrorLike): NormalizedCreditError;
18
+ export interface CreditPromptSession {
19
+ creditPromptShown: boolean;
20
+ }
21
+ /**
22
+ * The ADR-303 gate, fail-closed and frequency-capped: fires only for a
23
+ * confident, non-retryable Cognitum-ledger exhaustion, at most once per
24
+ * session. Everything else falls through to the ordinary error path.
25
+ */
26
+ export declare function shouldShowCreditRecovery(error: NormalizedCreditError, session: CreditPromptSession): boolean;
27
+ /** Full contextual screen (interactive TTY, first occurrence). */
28
+ export declare function renderCreditRecovery(authenticated: boolean): string;
29
+ /** Single-line hint (non-TTY, CI, or repeat occurrences in a session). */
30
+ export declare const CREDIT_RECOVERY_HINT = "Hint: ruflo auth login enables the free local Meta LLM proxy";
31
+ //# sourceMappingURL=credit-errors.d.ts.map
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Credit-error taxonomy and fail-closed classifier — ADR-303.
3
+ *
4
+ * Adapters map machine-readable provider codes into the canonical
5
+ * CreditErrorCode enum. Message text is NEVER parsed. Anything unmapped
6
+ * stays unclassified (confidence 0) and falls through to the ordinary
7
+ * error path. Only COGNITUM_CREDIT_EXHAUSTED — asserted by the Cognitum
8
+ * ledger, the single credit authority — may trigger the funnel surface.
9
+ */
10
+ import { CreditErrorCode } from './types.js';
11
+ /**
12
+ * Provider-code → canonical-code table. Keys are exact machine-readable
13
+ * code strings from provider error payloads (mirrors the ADR-308 server
14
+ * taxonomy 1:1). Versioned by code review; unmapped codes land nowhere.
15
+ */
16
+ const PROVIDER_CODE_TABLE = {
17
+ // Cognitum ledger (the single credit authority — ADR-303)
18
+ cognitum_credit_exhausted: { code: CreditErrorCode.COGNITUM_CREDIT_EXHAUSTED, retryable: false },
19
+ // Upstream provider quota/billing — NOT a Cognitum upsell moment
20
+ insufficient_quota: { code: CreditErrorCode.PROVIDER_QUOTA_EXHAUSTED, retryable: false },
21
+ billing_hard_limit_reached: { code: CreditErrorCode.PROVIDER_QUOTA_EXHAUSTED, retryable: false },
22
+ quota_exceeded: { code: CreditErrorCode.PROVIDER_QUOTA_EXHAUSTED, retryable: false },
23
+ // Retryable rate limits
24
+ rate_limit_exceeded: { code: CreditErrorCode.PROVIDER_RATE_LIMITED, retryable: true },
25
+ rate_limit_error: { code: CreditErrorCode.PROVIDER_RATE_LIMITED, retryable: true },
26
+ overloaded_error: { code: CreditErrorCode.SERVICE_UNAVAILABLE, retryable: true },
27
+ // Auth
28
+ authentication_error: { code: CreditErrorCode.AUTHENTICATION_FAILED, retryable: false },
29
+ invalid_api_key: { code: CreditErrorCode.AUTHENTICATION_FAILED, retryable: false },
30
+ permission_error: { code: CreditErrorCode.AUTHENTICATION_FAILED, retryable: false },
31
+ // Outages
32
+ api_error: { code: CreditErrorCode.SERVICE_UNAVAILABLE, retryable: true },
33
+ service_unavailable: { code: CreditErrorCode.SERVICE_UNAVAILABLE, retryable: true },
34
+ };
35
+ export function classifyCreditError(err) {
36
+ const key = err.providerCode?.trim().toLowerCase();
37
+ if (key && Object.prototype.hasOwnProperty.call(PROVIDER_CODE_TABLE, key)) {
38
+ const mapped = PROVIDER_CODE_TABLE[key];
39
+ return { code: mapped.code, confidence: 1, retryable: mapped.retryable, cause: err };
40
+ }
41
+ // Status-only signals are structural (401/403 → auth; 5xx → outage), but a
42
+ // bare 429 is ambiguous between rate-limit and quota — leave it unmapped.
43
+ if (err.status === 401 || err.status === 403) {
44
+ return { code: CreditErrorCode.AUTHENTICATION_FAILED, confidence: 1, retryable: false, cause: err };
45
+ }
46
+ if (err.status !== undefined && err.status >= 500) {
47
+ return { code: CreditErrorCode.SERVICE_UNAVAILABLE, confidence: 1, retryable: true, cause: err };
48
+ }
49
+ return { code: null, confidence: 0, retryable: false, cause: err };
50
+ }
51
+ /**
52
+ * The ADR-303 gate, fail-closed and frequency-capped: fires only for a
53
+ * confident, non-retryable Cognitum-ledger exhaustion, at most once per
54
+ * session. Everything else falls through to the ordinary error path.
55
+ */
56
+ export function shouldShowCreditRecovery(error, session) {
57
+ return (error.code === CreditErrorCode.COGNITUM_CREDIT_EXHAUSTED &&
58
+ error.confidence === 1 &&
59
+ !error.retryable &&
60
+ !session.creditPromptShown);
61
+ }
62
+ /** Full contextual screen (interactive TTY, first occurrence). */
63
+ export function renderCreditRecovery(authenticated) {
64
+ const lines = [
65
+ 'Daily hosted credits exhausted.',
66
+ '',
67
+ 'Continue immediately by enabling',
68
+ 'your free local Meta LLM Proxy.',
69
+ '',
70
+ 'Benefits',
71
+ ' ✓ Unlimited local requests',
72
+ ' ✓ Automatic model routing',
73
+ ' ✓ Lower latency',
74
+ ' ✓ Privacy preserving',
75
+ ' ✓ Cloud fallback',
76
+ '',
77
+ ];
78
+ if (authenticated) {
79
+ lines.push('Start local proxy?', ' ruflo proxy enable');
80
+ }
81
+ else {
82
+ lines.push('Sign in:', ' ruflo auth login');
83
+ }
84
+ return lines.join('\n');
85
+ }
86
+ /** Single-line hint (non-TTY, CI, or repeat occurrences in a session). */
87
+ export const CREDIT_RECOVERY_HINT = 'Hint: ruflo auth login enables the free local Meta LLM proxy';
88
+ //# sourceMappingURL=credit-errors.js.map
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Credit-exhaustion notifier — writes a marker file so the ADR-303 recovery
3
+ * surface fires on the next appropriate command render, and keeps a short
4
+ * user-visible notification in `~/.ruflo/credit-status.json`.
5
+ *
6
+ * This is NOT the ADR-303 credit-error classifier — that lives in
7
+ * `credit-errors.ts` and reads provider error codes to decide when a
8
+ * credit surface fires *during* a command. This module is the OUT-OF-BAND
9
+ * signal path: the analytics transport detected a credit-exhausted
10
+ * response (HTTP 402 or ADR-303 machine-readable code), and we need to
11
+ * warn the user asynchronously.
12
+ *
13
+ * State is cheap and durable:
14
+ * ~/.ruflo/credit-status.json = { exhausted: bool, since: ISO, cleared: ISO|null }
15
+ *
16
+ * Cleared automatically when the user opens the enrollment / signup
17
+ * surface, or explicitly via `ruflo funnel credit-clear`.
18
+ */
19
+ export declare const CREDIT_STATUS_FILE = "credit-status.json";
20
+ export interface CreditStatus {
21
+ exhausted: boolean;
22
+ since: string | null;
23
+ cleared: string | null;
24
+ }
25
+ /** Read the current credit status. Never throws. */
26
+ export declare function readCreditStatus(): CreditStatus;
27
+ /**
28
+ * Mark credit as exhausted — idempotent. Sets `since` on the first mark,
29
+ * leaves it alone on subsequent marks so the user sees a stable "since"
30
+ * timestamp until they clear it.
31
+ */
32
+ export declare function markCreditExhausted(now?: Date): void;
33
+ /**
34
+ * Clear credit-exhaustion status. Called when the user completes signup or
35
+ * runs `ruflo funnel credit-clear`. `cleared` is stamped so the previous
36
+ * `since` remains inspectable for one recovery cycle.
37
+ */
38
+ export declare function clearCreditStatus(now?: Date): void;
39
+ /**
40
+ * User-facing single-line summary — plain text, no ANSI. Callers style it
41
+ * themselves. Returns null when credit isn't exhausted (no surface).
42
+ */
43
+ export declare function creditExhaustedNotice(now?: Date): string | null;
44
+ //# sourceMappingURL=credit-notifier.d.ts.map
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Credit-exhaustion notifier — writes a marker file so the ADR-303 recovery
3
+ * surface fires on the next appropriate command render, and keeps a short
4
+ * user-visible notification in `~/.ruflo/credit-status.json`.
5
+ *
6
+ * This is NOT the ADR-303 credit-error classifier — that lives in
7
+ * `credit-errors.ts` and reads provider error codes to decide when a
8
+ * credit surface fires *during* a command. This module is the OUT-OF-BAND
9
+ * signal path: the analytics transport detected a credit-exhausted
10
+ * response (HTTP 402 or ADR-303 machine-readable code), and we need to
11
+ * warn the user asynchronously.
12
+ *
13
+ * State is cheap and durable:
14
+ * ~/.ruflo/credit-status.json = { exhausted: bool, since: ISO, cleared: ISO|null }
15
+ *
16
+ * Cleared automatically when the user opens the enrollment / signup
17
+ * surface, or explicitly via `ruflo funnel credit-clear`.
18
+ */
19
+ import { readStateJson, writeStateJson } from './state.js';
20
+ export const CREDIT_STATUS_FILE = 'credit-status.json';
21
+ /** Read the current credit status. Never throws. */
22
+ export function readCreditStatus() {
23
+ const raw = readStateJson(CREDIT_STATUS_FILE);
24
+ return {
25
+ exhausted: raw?.exhausted ?? false,
26
+ since: raw?.since ?? null,
27
+ cleared: raw?.cleared ?? null,
28
+ };
29
+ }
30
+ /**
31
+ * Mark credit as exhausted — idempotent. Sets `since` on the first mark,
32
+ * leaves it alone on subsequent marks so the user sees a stable "since"
33
+ * timestamp until they clear it.
34
+ */
35
+ export function markCreditExhausted(now = new Date()) {
36
+ const current = readCreditStatus();
37
+ if (current.exhausted && current.since)
38
+ return; // already flagged
39
+ writeStateJson(CREDIT_STATUS_FILE, {
40
+ exhausted: true,
41
+ since: current.since ?? now.toISOString(),
42
+ cleared: null,
43
+ });
44
+ }
45
+ /**
46
+ * Clear credit-exhaustion status. Called when the user completes signup or
47
+ * runs `ruflo funnel credit-clear`. `cleared` is stamped so the previous
48
+ * `since` remains inspectable for one recovery cycle.
49
+ */
50
+ export function clearCreditStatus(now = new Date()) {
51
+ const current = readCreditStatus();
52
+ writeStateJson(CREDIT_STATUS_FILE, {
53
+ exhausted: false,
54
+ since: current.since,
55
+ cleared: now.toISOString(),
56
+ });
57
+ }
58
+ /**
59
+ * User-facing single-line summary — plain text, no ANSI. Callers style it
60
+ * themselves. Returns null when credit isn't exhausted (no surface).
61
+ */
62
+ export function creditExhaustedNotice(now = new Date()) {
63
+ const status = readCreditStatus();
64
+ if (!status.exhausted)
65
+ return null;
66
+ const since = status.since ? Date.parse(status.since) : NaN;
67
+ if (Number.isNaN(since)) {
68
+ return 'Cognitum credits exhausted · run: ruflo funnel signup';
69
+ }
70
+ const ageHours = Math.max(0, Math.round((now.getTime() - since) / (60 * 60 * 1000)));
71
+ const when = ageHours < 1 ? 'just now' : ageHours < 24 ? `${ageHours}h ago` : `${Math.round(ageHours / 24)}d ago`;
72
+ return `Cognitum credits exhausted (${when}) · run: ruflo funnel signup`;
73
+ }
74
+ //# sourceMappingURL=credit-notifier.js.map
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Existing-install disclosure gate — ADR-301, amended by ADR-311 to source
3
+ * the disclosure MESSAGE itself from the remote feed rather than hardcoding
4
+ * it in the CLI. Everything about WHETHER/WHEN to show a disclosure stays
5
+ * local (state machine below); everything about WHAT it says comes from
6
+ * the same remote pool as tips/promos, validated through the identical
7
+ * ADR-301 content pipeline (isValidMessage in messages.ts).
8
+ *
9
+ * Invariants (release-blocking, tested):
10
+ * - No promotional content before disclosure.
11
+ * - The manage instruction appears in the disclosure text itself.
12
+ * - Shown once per user (user-level receipt), not once per project.
13
+ * - Declining disables all funnel surfaces (enforced in precedence.ts).
14
+ * - Fail-closed: if the remote feed has never successfully populated a
15
+ * disclosure-class message, there is nothing to show — no local
16
+ * fallback text exists (ADR-311 "zero local promo content").
17
+ *
18
+ * The disclosure text stays on the promo row for a grace window after its
19
+ * first render so a single flash can't count as "the user was told"; only
20
+ * after the window do promotional messages become eligible.
21
+ */
22
+ import type { DisclosureRecord, FunnelMessage } from './types.js';
23
+ /** How long the disclosure text keeps the row before promo becomes eligible. */
24
+ export declare const DISCLOSURE_GRACE_MS: number;
25
+ export declare const DISCLOSURE_ROTATION_SLOT_MS: number;
26
+ /**
27
+ * Deterministic slot-based selection over the remote disclosure pool — no
28
+ * RNG so the choice is reproducible for a given wall-clock instant. Returns
29
+ * null when the pool is empty (cold start before first fetch, or the remote
30
+ * feed is unreachable) — the caller must treat null as "show nothing".
31
+ */
32
+ export declare function selectDisclosureMessage(now?: Date): FunnelMessage | null;
33
+ export declare function getDisclosure(): DisclosureRecord;
34
+ /** Record that the disclosure text was rendered (idempotent). */
35
+ export declare function recordDisclosureShown(now?: Date): DisclosureRecord;
36
+ /** User explicitly declined (e.g. `ruflo funnel disable`). */
37
+ export declare function recordDisclosureDeclined(now?: Date): DisclosureRecord;
38
+ /** Re-enable after a prior decline (explicit user action only). */
39
+ export declare function recordDisclosureReenabled(now?: Date): DisclosureRecord;
40
+ /**
41
+ * Whether promotional/educational messages may render. True only after the
42
+ * disclosure was shown AND its grace window has elapsed. While the window is
43
+ * open the row must carry the disclosure text itself.
44
+ */
45
+ export declare function promoEligible(now?: Date): boolean;
46
+ //# sourceMappingURL=disclosure.d.ts.map
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Existing-install disclosure gate — ADR-301, amended by ADR-311 to source
3
+ * the disclosure MESSAGE itself from the remote feed rather than hardcoding
4
+ * it in the CLI. Everything about WHETHER/WHEN to show a disclosure stays
5
+ * local (state machine below); everything about WHAT it says comes from
6
+ * the same remote pool as tips/promos, validated through the identical
7
+ * ADR-301 content pipeline (isValidMessage in messages.ts).
8
+ *
9
+ * Invariants (release-blocking, tested):
10
+ * - No promotional content before disclosure.
11
+ * - The manage instruction appears in the disclosure text itself.
12
+ * - Shown once per user (user-level receipt), not once per project.
13
+ * - Declining disables all funnel surfaces (enforced in precedence.ts).
14
+ * - Fail-closed: if the remote feed has never successfully populated a
15
+ * disclosure-class message, there is nothing to show — no local
16
+ * fallback text exists (ADR-311 "zero local promo content").
17
+ *
18
+ * The disclosure text stays on the promo row for a grace window after its
19
+ * first render so a single flash can't count as "the user was told"; only
20
+ * after the window do promotional messages become eligible.
21
+ */
22
+ import { readStateJson, writeStateJson } from './state.js';
23
+ import { getRemoteMessages } from './message-transport.js';
24
+ const DISCLOSURE_FILE = 'funnel-disclosure.json';
25
+ /** How long the disclosure text keeps the row before promo becomes eligible. */
26
+ export const DISCLOSURE_GRACE_MS = 24 * 60 * 60 * 1000; // 24h
27
+ // One disclosure variant per 5-minute wall-clock slot. Longer than the
28
+ // 20-second rotation cadence so a user watching the statusline sees the
29
+ // same variant long enough to read it, but short enough that a fresh
30
+ // session gets a different one than the previous one did.
31
+ export const DISCLOSURE_ROTATION_SLOT_MS = 5 * 60 * 1000;
32
+ /** Remote-cached messages tagged class==='disclosure' — the only source. */
33
+ function getDisclosureMessagePool() {
34
+ return getRemoteMessages().filter((m) => m.class === 'disclosure');
35
+ }
36
+ /**
37
+ * Deterministic slot-based selection over the remote disclosure pool — no
38
+ * RNG so the choice is reproducible for a given wall-clock instant. Returns
39
+ * null when the pool is empty (cold start before first fetch, or the remote
40
+ * feed is unreachable) — the caller must treat null as "show nothing".
41
+ */
42
+ export function selectDisclosureMessage(now = new Date()) {
43
+ const pool = getDisclosureMessagePool();
44
+ if (pool.length === 0)
45
+ return null;
46
+ const slot = Math.floor(now.getTime() / DISCLOSURE_ROTATION_SLOT_MS);
47
+ return pool[slot % pool.length];
48
+ }
49
+ export function getDisclosure() {
50
+ const rec = readStateJson(DISCLOSURE_FILE);
51
+ if (rec && isValidState(rec.state))
52
+ return rec;
53
+ return { state: 'never_seen', firstShownAt: null };
54
+ }
55
+ function isValidState(s) {
56
+ return s === 'never_seen' || s === 'disclosed_enabled' || s === 'disclosed_disabled';
57
+ }
58
+ /** Record that the disclosure text was rendered (idempotent). */
59
+ export function recordDisclosureShown(now = new Date()) {
60
+ const current = getDisclosure();
61
+ if (current.state !== 'never_seen')
62
+ return current;
63
+ const rec = { state: 'disclosed_enabled', firstShownAt: now.toISOString() };
64
+ writeStateJson(DISCLOSURE_FILE, rec);
65
+ return rec;
66
+ }
67
+ /** User explicitly declined (e.g. `ruflo funnel disable`). */
68
+ export function recordDisclosureDeclined(now = new Date()) {
69
+ const current = getDisclosure();
70
+ const rec = {
71
+ state: 'disclosed_disabled',
72
+ firstShownAt: current.firstShownAt ?? now.toISOString(),
73
+ };
74
+ writeStateJson(DISCLOSURE_FILE, rec);
75
+ return rec;
76
+ }
77
+ /** Re-enable after a prior decline (explicit user action only). */
78
+ export function recordDisclosureReenabled(now = new Date()) {
79
+ const rec = { state: 'disclosed_enabled', firstShownAt: now.toISOString() };
80
+ writeStateJson(DISCLOSURE_FILE, rec);
81
+ return rec;
82
+ }
83
+ /**
84
+ * Whether promotional/educational messages may render. True only after the
85
+ * disclosure was shown AND its grace window has elapsed. While the window is
86
+ * open the row must carry the disclosure text itself.
87
+ */
88
+ export function promoEligible(now = new Date()) {
89
+ const rec = getDisclosure();
90
+ if (rec.state !== 'disclosed_enabled' || !rec.firstShownAt)
91
+ return false;
92
+ const first = Date.parse(rec.firstShownAt);
93
+ if (Number.isNaN(first))
94
+ return false;
95
+ return now.getTime() - first >= DISCLOSURE_GRACE_MS;
96
+ }
97
+ //# sourceMappingURL=disclosure.js.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Post-initialization capability enrollment — ADR-302.
3
+ *
4
+ * One-time, non-blocking, skippable. Gates, all of which must pass:
5
+ * - interactive TTY (never in CI / piped / automation)
6
+ * - not skipped via --no-signup
7
+ * - funnel enabled under the ADR-305 precedence chain
8
+ * - never shown before (user-level record, not per-project)
9
+ *
10
+ * Accepting authorizes exactly ONE thing: a pointer to `ruflo auth login`.
11
+ * It does not install the proxy, does not enable telemetry, and does not
12
+ * enable cloud routing (separate consent domains — ADR-302). The enrollment
13
+ * outcome never affects init's exit code.
14
+ */
15
+ interface EnrollmentRecord {
16
+ shownAt: string;
17
+ outcome: 'accepted' | 'skipped';
18
+ }
19
+ export declare function getEnrollmentRecord(): EnrollmentRecord | null;
20
+ export declare const ENROLLMENT_SCREEN: string;
21
+ export declare const ENROLLMENT_SKIP_TEXT = "You can enable later:\n ruflo auth login";
22
+ export interface EnrollmentGateContext {
23
+ noSignup: boolean;
24
+ cwd?: string;
25
+ env?: NodeJS.ProcessEnv;
26
+ }
27
+ /** All ADR-302 gates. Pure check — does not write state. */
28
+ export declare function shouldOfferEnrollment(ctx: EnrollmentGateContext): boolean;
29
+ /**
30
+ * Record the user's decision. Both accept and skip are terminal — the
31
+ * prompt never reappears (ADR-302). Accepting records the `account`
32
+ * consent receipt; skipping records the decline.
33
+ */
34
+ export declare function recordEnrollmentOutcome(accepted: boolean, now?: Date): void;
35
+ export {};
36
+ //# sourceMappingURL=enrollment.d.ts.map
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Post-initialization capability enrollment — ADR-302.
3
+ *
4
+ * One-time, non-blocking, skippable. Gates, all of which must pass:
5
+ * - interactive TTY (never in CI / piped / automation)
6
+ * - not skipped via --no-signup
7
+ * - funnel enabled under the ADR-305 precedence chain
8
+ * - never shown before (user-level record, not per-project)
9
+ *
10
+ * Accepting authorizes exactly ONE thing: a pointer to `ruflo auth login`.
11
+ * It does not install the proxy, does not enable telemetry, and does not
12
+ * enable cloud routing (separate consent domains — ADR-302). The enrollment
13
+ * outcome never affects init's exit code.
14
+ */
15
+ import { isCI, isInteractive } from './environment.js';
16
+ import { resolveFunnelEnabled } from './precedence.js';
17
+ import { recordConsent } from './consent.js';
18
+ import { readStateJson, writeStateJson } from './state.js';
19
+ const ENROLLMENT_FILE = 'enrollment.json';
20
+ export function getEnrollmentRecord() {
21
+ return readStateJson(ENROLLMENT_FILE);
22
+ }
23
+ export const ENROLLMENT_SCREEN = [
24
+ '────────────────────────────',
25
+ 'Unlock additional capabilities?',
26
+ '',
27
+ ' ✓ Local Meta LLM Proxy',
28
+ ' ✓ Multi-model routing',
29
+ ' ✓ Hosted memory',
30
+ ' ✓ Enterprise rate limits',
31
+ ' ✓ Premium agents',
32
+ ' ✓ Cloud synchronization',
33
+ '',
34
+ 'Free account: https://cognitum.one',
35
+ ].join('\n');
36
+ export const ENROLLMENT_SKIP_TEXT = 'You can enable later:\n ruflo auth login';
37
+ /** All ADR-302 gates. Pure check — does not write state. */
38
+ export function shouldOfferEnrollment(ctx) {
39
+ const env = ctx.env ?? process.env;
40
+ if (ctx.noSignup)
41
+ return false;
42
+ if (isCI(env))
43
+ return false;
44
+ if (!isInteractive())
45
+ return false;
46
+ if (!resolveFunnelEnabled(ctx.cwd ?? process.cwd(), env).enabled)
47
+ return false;
48
+ if (getEnrollmentRecord() !== null)
49
+ return false; // one-time only
50
+ return true;
51
+ }
52
+ /**
53
+ * Record the user's decision. Both accept and skip are terminal — the
54
+ * prompt never reappears (ADR-302). Accepting records the `account`
55
+ * consent receipt; skipping records the decline.
56
+ */
57
+ export function recordEnrollmentOutcome(accepted, now = new Date()) {
58
+ writeStateJson(ENROLLMENT_FILE, {
59
+ shownAt: now.toISOString(),
60
+ outcome: accepted ? 'accepted' : 'skipped',
61
+ });
62
+ recordConsent('account', accepted, 'post-init', now);
63
+ }
64
+ //# sourceMappingURL=enrollment.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Environment gates for funnel surfaces (ADR-301/302).
3
+ *
4
+ * CI and non-interactive environments never see funnel content; reduced
5
+ * motion / screen readers get static text only (which is all the funnel
6
+ * renders anyway — there is deliberately no animation path in this module).
7
+ */
8
+ export declare function isCI(env?: NodeJS.ProcessEnv): boolean;
9
+ export declare function isInteractive(): boolean;
10
+ /**
11
+ * Statusline invocations are spawned by an interactive host (Claude Code)
12
+ * with piped stdio, so isTTY is false there even though the session is
13
+ * interactive. Surfaces pass their own interactivity signal; this helper is
14
+ * the strict check used by directly-invoked prompts (init enrollment).
15
+ */
16
+ export declare function reducedMotion(env?: NodeJS.ProcessEnv): boolean;
17
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Environment gates for funnel surfaces (ADR-301/302).
3
+ *
4
+ * CI and non-interactive environments never see funnel content; reduced
5
+ * motion / screen readers get static text only (which is all the funnel
6
+ * renders anyway — there is deliberately no animation path in this module).
7
+ */
8
+ const CI_ENV_VARS = [
9
+ 'CI',
10
+ 'GITHUB_ACTIONS',
11
+ 'GITLAB_CI',
12
+ 'CIRCLECI',
13
+ 'TRAVIS',
14
+ 'BUILDKITE',
15
+ 'JENKINS_URL',
16
+ 'TEAMCITY_VERSION',
17
+ 'TF_BUILD', // Azure Pipelines
18
+ ];
19
+ export function isCI(env = process.env) {
20
+ return CI_ENV_VARS.some((v) => {
21
+ const val = env[v];
22
+ return val !== undefined && val !== '' && val !== '0' && val.toLowerCase?.() !== 'false';
23
+ });
24
+ }
25
+ export function isInteractive() {
26
+ return Boolean(process.stdout.isTTY && process.stdin.isTTY);
27
+ }
28
+ /**
29
+ * Statusline invocations are spawned by an interactive host (Claude Code)
30
+ * with piped stdio, so isTTY is false there even though the session is
31
+ * interactive. Surfaces pass their own interactivity signal; this helper is
32
+ * the strict check used by directly-invoked prompts (init enrollment).
33
+ */
34
+ export function reducedMotion(env = process.env) {
35
+ return Boolean(env.NO_COLOR !== undefined ||
36
+ env.RUFLO_REDUCED_MOTION === '1' ||
37
+ env.TERM === 'dumb');
38
+ }
39
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Event transport — batches the local funnel event queue and posts it to the
3
+ * Cognitum analytics Cloud Function (ADR-308 endpoint contract).
4
+ *
5
+ * Design discipline (ADR-308 client failure policy — all normative):
6
+ * 1. Telemetry never blocks the CLI. Every network call is best-effort,
7
+ * capped by a short timeout, and swallows every error path.
8
+ * 2. Events are LOCAL FIRST. The queue in `events.ts` accumulates
9
+ * regardless of API reachability. This transport is the flush layer.
10
+ * 3. Idempotency: every batch carries a UUIDv4 idempotency key so a retry
11
+ * never double-counts (ADR-308 idempotent-batches invariant).
12
+ * 4. Exponential backoff on transient failures. Successful flushes stamp
13
+ * a "last flush" timestamp so we don't hammer the API each render.
14
+ * 5. Consent-gated. Zero network activity when telemetry consent is off.
15
+ * 6. Bounded. Never send more than MAX_BATCH events at once, so a large
16
+ * backlog doesn't blow the endpoint request-size limit.
17
+ * 7. Credit-exhaustion detection. If the endpoint replies 402 (Payment
18
+ * Required) or the body carries the ADR-303
19
+ * `COGNITUM_CREDIT_EXHAUSTED` code, we surface via `credit-notifier.ts`
20
+ * — the same recovery UX ADR-303 already ships.
21
+ */
22
+ /**
23
+ * Default endpoint — the ruflo-funnel-analytics endpoint on the ruv.io
24
+ * domain, mapped via Cloud Run domain mapping to the cognitum-analytics
25
+ * Cloud Function on cognitum-20260110. Overridable by env for staging or
26
+ * self-hosted deploys. The domain choice is deliberate: an rUv-authored
27
+ * OSS project's telemetry endpoint belongs on rUv's own domain, not on
28
+ * cognitum.one — that keeps the CLI attribution honest.
29
+ */
30
+ export declare const DEFAULT_ENDPOINT: string;
31
+ /** Cap per POST — server enforces its own limits too; this is a safety net. */
32
+ export declare const MAX_BATCH = 100;
33
+ /** Min interval between flushes (ms). Rate limits the client from within. */
34
+ export declare const MIN_FLUSH_INTERVAL_MS = 60000;
35
+ /** POST timeout — telemetry must not stall the CLI. */
36
+ export declare const FLUSH_TIMEOUT_MS = 4000;
37
+ /**
38
+ * Best-effort flush of the local event queue to the endpoint. Returns a
39
+ * summary the CLI can log at --verbose; the caller should never fail on it.
40
+ */
41
+ export declare function flushEvents(opts?: {
42
+ endpoint?: string;
43
+ release?: string;
44
+ force?: boolean;
45
+ now?: Date;
46
+ }): Promise<{
47
+ flushed: number;
48
+ skipped: string | null;
49
+ status?: number;
50
+ }>;
51
+ //# sourceMappingURL=event-transport.d.ts.map