@claude-flow/cli 3.32.3 → 3.32.5
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.
- package/.claude/helpers/helpers.manifest.json +2 -2
- package/catalog-manifest.json +2 -2
- package/dist/src/agenticow/speculative-exploration.d.ts +148 -0
- package/dist/src/agenticow/speculative-exploration.js +218 -0
- package/dist/src/appliance/gguf-engine.d.ts +91 -0
- package/dist/src/appliance/gguf-engine.js +425 -0
- package/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
- package/dist/src/appliance/ruvllm-bridge.js +292 -0
- package/dist/src/appliance/rvfa-builder.d.ts +44 -0
- package/dist/src/appliance/rvfa-builder.js +329 -0
- package/dist/src/appliance/rvfa-distribution.d.ts +97 -0
- package/dist/src/appliance/rvfa-distribution.js +370 -0
- package/dist/src/appliance/rvfa-format.d.ts +111 -0
- package/dist/src/appliance/rvfa-format.js +393 -0
- package/dist/src/appliance/rvfa-runner.d.ts +69 -0
- package/dist/src/appliance/rvfa-runner.js +237 -0
- package/dist/src/appliance/rvfa-signing.d.ts +123 -0
- package/dist/src/appliance/rvfa-signing.js +347 -0
- package/dist/src/auth/client.d.ts +89 -0
- package/dist/src/auth/client.js +242 -0
- package/dist/src/auth/constants.d.ts +7 -0
- package/dist/src/auth/constants.js +7 -0
- package/dist/src/auth/scopes.d.ts +14 -0
- package/dist/src/auth/scopes.js +21 -0
- package/dist/src/auth/security-bridge.d.ts +36 -0
- package/dist/src/auth/security-bridge.js +42 -0
- package/dist/src/auth/session.d.ts +20 -0
- package/dist/src/auth/session.js +32 -0
- package/dist/src/auth/state.d.ts +19 -0
- package/dist/src/auth/state.js +53 -0
- package/dist/src/auth/types.d.ts +27 -0
- package/dist/src/auth/types.js +11 -0
- package/dist/src/autopilot-state.d.ts +77 -0
- package/dist/src/autopilot-state.js +271 -0
- package/dist/src/benchmarks/gaia-agent-planning.smoke.d.ts +18 -0
- package/dist/src/benchmarks/gaia-agent-planning.smoke.js +253 -0
- package/dist/src/benchmarks/gaia-agent.d.ts +198 -0
- package/dist/src/benchmarks/gaia-agent.js +651 -0
- package/dist/src/benchmarks/gaia-causal-memory.d.ts +133 -0
- package/dist/src/benchmarks/gaia-causal-memory.js +281 -0
- package/dist/src/benchmarks/gaia-causal-memory.smoke.d.ts +22 -0
- package/dist/src/benchmarks/gaia-causal-memory.smoke.js +300 -0
- package/dist/src/benchmarks/gaia-convergence.d.ts +138 -0
- package/dist/src/benchmarks/gaia-convergence.js +260 -0
- package/dist/src/benchmarks/gaia-convergence.smoke.d.ts +19 -0
- package/dist/src/benchmarks/gaia-convergence.smoke.js +246 -0
- package/dist/src/benchmarks/gaia-critic.d.ts +123 -0
- package/dist/src/benchmarks/gaia-critic.js +312 -0
- package/dist/src/benchmarks/gaia-critic.smoke.d.ts +21 -0
- package/dist/src/benchmarks/gaia-critic.smoke.js +327 -0
- package/dist/src/benchmarks/gaia-decomposer.d.ts +125 -0
- package/dist/src/benchmarks/gaia-decomposer.js +350 -0
- package/dist/src/benchmarks/gaia-decomposer.smoke.d.ts +21 -0
- package/dist/src/benchmarks/gaia-decomposer.smoke.js +228 -0
- package/dist/src/benchmarks/gaia-e2e-smoke.d.ts +27 -0
- package/dist/src/benchmarks/gaia-e2e-smoke.js +136 -0
- package/dist/src/benchmarks/gaia-extract.smoke.d.ts +45 -0
- package/dist/src/benchmarks/gaia-extract.smoke.js +242 -0
- package/dist/src/benchmarks/gaia-hardness/features.d.ts +46 -0
- package/dist/src/benchmarks/gaia-hardness/features.js +170 -0
- package/dist/src/benchmarks/gaia-hardness/predictor.d.ts +105 -0
- package/dist/src/benchmarks/gaia-hardness/predictor.js +260 -0
- package/dist/src/benchmarks/gaia-hardness/predictor.smoke.d.ts +20 -0
- package/dist/src/benchmarks/gaia-hardness/predictor.smoke.js +235 -0
- package/dist/src/benchmarks/gaia-hardness/train-data-loader.d.ts +51 -0
- package/dist/src/benchmarks/gaia-hardness/train-data-loader.js +179 -0
- package/dist/src/benchmarks/gaia-judge.d.ts +88 -0
- package/dist/src/benchmarks/gaia-judge.js +437 -0
- package/dist/src/benchmarks/gaia-loader.d.ts +87 -0
- package/dist/src/benchmarks/gaia-loader.js +326 -0
- package/dist/src/benchmarks/gaia-tools/file_read.d.ts +35 -0
- package/dist/src/benchmarks/gaia-tools/file_read.js +403 -0
- package/dist/src/benchmarks/gaia-tools/grounded_query.d.ts +126 -0
- package/dist/src/benchmarks/gaia-tools/grounded_query.js +225 -0
- package/dist/src/benchmarks/gaia-tools/index.d.ts +32 -0
- package/dist/src/benchmarks/gaia-tools/index.js +36 -0
- package/dist/src/benchmarks/gaia-tools/types.d.ts +62 -0
- package/dist/src/benchmarks/gaia-tools/types.js +12 -0
- package/dist/src/benchmarks/gaia-tools/web_search.d.ts +30 -0
- package/dist/src/benchmarks/gaia-tools/web_search.js +210 -0
- package/dist/src/benchmarks/gaia-voting.d.ts +88 -0
- package/dist/src/benchmarks/gaia-voting.js +297 -0
- package/dist/src/benchmarks/gaia-voting.smoke.d.ts +20 -0
- package/dist/src/benchmarks/gaia-voting.smoke.js +332 -0
- package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/dist/src/benchmarks/pretrain/index.js +404 -0
- package/dist/src/business-pods/bbs-budget-tracker.d.ts +139 -0
- package/dist/src/business-pods/bbs-budget-tracker.js +358 -0
- package/dist/src/business-pods/domain-affinity-policy.d.ts +47 -0
- package/dist/src/business-pods/domain-affinity-policy.js +65 -0
- package/dist/src/business-pods/pod-schema.d.ts +96 -0
- package/dist/src/business-pods/pod-schema.js +225 -0
- package/dist/src/commands/advisor.d.ts +15 -0
- package/dist/src/commands/advisor.js +94 -0
- package/dist/src/commands/agent-wasm.d.ts +14 -0
- package/dist/src/commands/agent-wasm.js +333 -0
- package/dist/src/commands/agent.d.ts +8 -0
- package/dist/src/commands/agent.js +927 -0
- package/dist/src/commands/analyze.d.ts +19 -0
- package/dist/src/commands/analyze.js +2047 -0
- package/dist/src/commands/announcements.d.ts +17 -0
- package/dist/src/commands/announcements.js +0 -0
- package/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/dist/src/commands/appliance-advanced.js +215 -0
- package/dist/src/commands/appliance.d.ts +8 -0
- package/dist/src/commands/appliance.js +404 -0
- package/dist/src/commands/auth.d.ts +15 -0
- package/dist/src/commands/auth.js +244 -0
- package/dist/src/commands/autopilot.d.ts +15 -0
- package/dist/src/commands/autopilot.js +407 -0
- package/dist/src/commands/benchmark.d.ts +10 -0
- package/dist/src/commands/benchmark.js +460 -0
- package/dist/src/commands/claims.d.ts +10 -0
- package/dist/src/commands/claims.js +620 -0
- package/dist/src/commands/cleanup.d.ts +13 -0
- package/dist/src/commands/cleanup.js +250 -0
- package/dist/src/commands/completions.d.ts +10 -0
- package/dist/src/commands/completions.js +539 -0
- package/dist/src/commands/config.d.ts +8 -0
- package/dist/src/commands/config.js +428 -0
- package/dist/src/commands/daemon.d.ts +59 -0
- package/dist/src/commands/daemon.js +1733 -0
- package/dist/src/commands/deployment.d.ts +10 -0
- package/dist/src/commands/deployment.js +672 -0
- package/dist/src/commands/doctor.d.ts +10 -0
- package/dist/src/commands/doctor.js +1902 -0
- package/dist/src/commands/eject.d.ts +33 -0
- package/dist/src/commands/eject.js +195 -0
- package/dist/src/commands/embeddings.d.ts +18 -0
- package/dist/src/commands/embeddings.js +1623 -0
- package/dist/src/commands/funnel.d.ts +18 -0
- package/dist/src/commands/funnel.js +302 -0
- package/dist/src/commands/gaia-bench.d.ts +40 -0
- package/dist/src/commands/gaia-bench.js +597 -0
- package/dist/src/commands/guidance.d.ts +8 -0
- package/dist/src/commands/guidance.js +556 -0
- package/dist/src/commands/hive-mind.d.ts +11 -0
- package/dist/src/commands/hive-mind.js +1319 -0
- package/dist/src/commands/hooks.d.ts +8 -0
- package/dist/src/commands/hooks.js +4606 -0
- package/dist/src/commands/index.d.ts +118 -0
- package/dist/src/commands/index.js +366 -0
- package/dist/src/commands/init.d.ts +13 -0
- package/dist/src/commands/init.js +1297 -0
- package/dist/src/commands/issues.d.ts +21 -0
- package/dist/src/commands/issues.js +567 -0
- package/dist/src/commands/mcp.d.ts +11 -0
- package/dist/src/commands/mcp.js +732 -0
- package/dist/src/commands/memory-backup.d.ts +11 -0
- package/dist/src/commands/memory-backup.js +46 -0
- package/dist/src/commands/memory-distill.d.ts +27 -0
- package/dist/src/commands/memory-distill.js +374 -0
- package/dist/src/commands/memory.d.ts +8 -0
- package/dist/src/commands/memory.js +1596 -0
- package/dist/src/commands/metaharness.d.ts +39 -0
- package/dist/src/commands/metaharness.js +215 -0
- package/dist/src/commands/migrate.d.ts +8 -0
- package/dist/src/commands/migrate.js +742 -0
- package/dist/src/commands/neural.d.ts +10 -0
- package/dist/src/commands/neural.js +4331 -0
- package/dist/src/commands/performance.d.ts +10 -0
- package/dist/src/commands/performance.js +583 -0
- package/dist/src/commands/plugins.d.ts +11 -0
- package/dist/src/commands/plugins.js +826 -0
- package/dist/src/commands/process.d.ts +10 -0
- package/dist/src/commands/process.js +694 -0
- package/dist/src/commands/progress.d.ts +11 -0
- package/dist/src/commands/progress.js +259 -0
- package/dist/src/commands/providers.d.ts +10 -0
- package/dist/src/commands/providers.js +502 -0
- package/dist/src/commands/proxy-lifecycle.d.ts +20 -0
- package/dist/src/commands/proxy-lifecycle.js +277 -0
- package/dist/src/commands/proxy.d.ts +21 -0
- package/dist/src/commands/proxy.js +403 -0
- package/dist/src/commands/route.d.ts +16 -0
- package/dist/src/commands/route.js +822 -0
- package/dist/src/commands/ruvector/backup.d.ts +11 -0
- package/dist/src/commands/ruvector/backup.js +747 -0
- package/dist/src/commands/ruvector/benchmark.d.ts +11 -0
- package/dist/src/commands/ruvector/benchmark.js +490 -0
- package/dist/src/commands/ruvector/import.d.ts +18 -0
- package/dist/src/commands/ruvector/import.js +373 -0
- package/dist/src/commands/ruvector/index.d.ts +29 -0
- package/dist/src/commands/ruvector/index.js +129 -0
- package/dist/src/commands/ruvector/init.d.ts +11 -0
- package/dist/src/commands/ruvector/init.js +467 -0
- package/dist/src/commands/ruvector/migrate.d.ts +11 -0
- package/dist/src/commands/ruvector/migrate.js +498 -0
- package/dist/src/commands/ruvector/optimize.d.ts +11 -0
- package/dist/src/commands/ruvector/optimize.js +505 -0
- package/dist/src/commands/ruvector/pg-utils.d.ts +14 -0
- package/dist/src/commands/ruvector/pg-utils.js +41 -0
- package/dist/src/commands/ruvector/setup.d.ts +18 -0
- package/dist/src/commands/ruvector/setup.js +765 -0
- package/dist/src/commands/ruvector/status.d.ts +11 -0
- package/dist/src/commands/ruvector/status.js +479 -0
- package/dist/src/commands/security.d.ts +10 -0
- package/dist/src/commands/security.js +1012 -0
- package/dist/src/commands/session.d.ts +8 -0
- package/dist/src/commands/session.js +757 -0
- package/dist/src/commands/settings.d.ts +19 -0
- package/dist/src/commands/settings.js +180 -0
- package/dist/src/commands/spinner.d.ts +16 -0
- package/dist/src/commands/spinner.js +329 -0
- package/dist/src/commands/start.d.ts +8 -0
- package/dist/src/commands/start.js +418 -0
- package/dist/src/commands/status.d.ts +8 -0
- package/dist/src/commands/status.js +608 -0
- package/dist/src/commands/swarm.d.ts +8 -0
- package/dist/src/commands/swarm.js +891 -0
- package/dist/src/commands/task.d.ts +8 -0
- package/dist/src/commands/task.js +675 -0
- package/dist/src/commands/transfer-store.d.ts +13 -0
- package/dist/src/commands/transfer-store.js +428 -0
- package/dist/src/commands/update.d.ts +8 -0
- package/dist/src/commands/update.js +276 -0
- package/dist/src/commands/verify.d.ts +19 -0
- package/dist/src/commands/verify.js +261 -0
- package/dist/src/commands/version.d.ts +42 -0
- package/dist/src/commands/version.js +106 -0
- package/dist/src/commands/workflow.d.ts +8 -0
- package/dist/src/commands/workflow.js +617 -0
- package/dist/src/config/harness-feedback-applier.d.ts +50 -0
- package/dist/src/config/harness-feedback-applier.js +122 -0
- package/dist/src/config/proven-config-refresh.d.ts +39 -0
- package/dist/src/config/proven-config-refresh.js +154 -0
- package/dist/src/config/proven-config-rvfa.d.ts +23 -0
- package/dist/src/config/proven-config-rvfa.js +73 -0
- package/dist/src/config/proven-config.d.ts +86 -0
- package/dist/src/config/proven-config.js +176 -0
- package/dist/src/config-adapter.d.ts +15 -0
- package/dist/src/config-adapter.js +186 -0
- package/dist/src/encryption/vault.d.ts +94 -0
- package/dist/src/encryption/vault.js +172 -0
- package/dist/src/fs-secure.d.ts +86 -0
- package/dist/src/fs-secure.js +133 -0
- package/dist/src/funnel/advisor-tip.d.ts +58 -0
- package/dist/src/funnel/advisor-tip.js +92 -0
- package/dist/src/funnel/attribution.d.ts +37 -0
- package/dist/src/funnel/attribution.js +101 -0
- package/dist/src/funnel/consent.d.ts +22 -0
- package/dist/src/funnel/consent.js +58 -0
- package/dist/src/funnel/credit-errors.d.ts +31 -0
- package/dist/src/funnel/credit-errors.js +88 -0
- package/dist/src/funnel/credit-notifier.d.ts +44 -0
- package/dist/src/funnel/credit-notifier.js +74 -0
- package/dist/src/funnel/disclosure.d.ts +47 -0
- package/dist/src/funnel/disclosure.js +109 -0
- package/dist/src/funnel/enrollment.d.ts +36 -0
- package/dist/src/funnel/enrollment.js +64 -0
- package/dist/src/funnel/environment.d.ts +17 -0
- package/dist/src/funnel/environment.js +39 -0
- package/dist/src/funnel/event-transport.d.ts +51 -0
- package/dist/src/funnel/event-transport.js +199 -0
- package/dist/src/funnel/events.d.ts +42 -0
- package/dist/src/funnel/events.js +150 -0
- package/dist/src/funnel/index.d.ts +21 -0
- package/dist/src/funnel/index.js +21 -0
- package/dist/src/funnel/insights.d.ts +50 -0
- package/dist/src/funnel/insights.js +120 -0
- package/dist/src/funnel/local-signals.d.ts +20 -0
- package/dist/src/funnel/local-signals.js +77 -0
- package/dist/src/funnel/message-transport.d.ts +51 -0
- package/dist/src/funnel/message-transport.js +149 -0
- package/dist/src/funnel/messages.d.ts +55 -0
- package/dist/src/funnel/messages.js +160 -0
- package/dist/src/funnel/payout.d.ts +40 -0
- package/dist/src/funnel/payout.js +60 -0
- package/dist/src/funnel/power-saver-notifier.d.ts +44 -0
- package/dist/src/funnel/power-saver-notifier.js +92 -0
- package/dist/src/funnel/precedence.d.ts +16 -0
- package/dist/src/funnel/precedence.js +85 -0
- package/dist/src/funnel/promo.d.ts +41 -0
- package/dist/src/funnel/promo.js +144 -0
- package/dist/src/funnel/rate-limit-notifier.d.ts +55 -0
- package/dist/src/funnel/rate-limit-notifier.js +102 -0
- package/dist/src/funnel/rotation.d.ts +19 -0
- package/dist/src/funnel/rotation.js +70 -0
- package/dist/src/funnel/state.d.ts +13 -0
- package/dist/src/funnel/state.js +52 -0
- package/dist/src/funnel/toggle-cooldown.d.ts +17 -0
- package/dist/src/funnel/toggle-cooldown.js +32 -0
- package/dist/src/funnel/types.d.ts +98 -0
- package/dist/src/funnel/types.js +26 -0
- package/dist/src/index.d.ts +81 -0
- package/dist/src/index.js +609 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/dist/src/init/claudemd-generator.d.ts +16 -0
- package/dist/src/init/claudemd-generator.js +368 -0
- package/dist/src/init/executor.d.ts +41 -0
- package/dist/src/init/executor.js +2142 -0
- package/dist/src/init/helper-refresh.d.ts +79 -0
- package/dist/src/init/helper-refresh.js +347 -0
- package/dist/src/init/helper-signing.d.ts +37 -0
- package/dist/src/init/helper-signing.js +67 -0
- package/dist/src/init/helpers-generator.d.ts +87 -0
- package/dist/src/init/helpers-generator.js +1456 -0
- package/dist/src/init/index.d.ts +13 -0
- package/dist/src/init/index.js +15 -0
- package/dist/src/init/mcp-generator.d.ts +26 -0
- package/dist/src/init/mcp-generator.js +126 -0
- package/dist/src/init/memory-package-resolver.d.ts +53 -0
- package/dist/src/init/memory-package-resolver.js +118 -0
- package/dist/src/init/settings-generator.d.ts +14 -0
- package/dist/src/init/settings-generator.js +462 -0
- package/dist/src/init/statusline-generator.d.ts +28 -0
- package/dist/src/init/statusline-generator.js +177 -0
- package/dist/src/init/types.d.ts +331 -0
- package/dist/src/init/types.js +276 -0
- package/dist/src/log-filters.d.ts +46 -0
- package/dist/src/log-filters.js +107 -0
- package/dist/src/mcp-client.d.ts +92 -0
- package/dist/src/mcp-client.js +397 -0
- package/dist/src/mcp-server.d.ts +163 -0
- package/dist/src/mcp-server.js +751 -0
- package/dist/src/mcp-tools/agent-execute-core.d.ts +115 -0
- package/dist/src/mcp-tools/agent-execute-core.js +587 -0
- package/dist/src/mcp-tools/agent-tools.d.ts +9 -0
- package/dist/src/mcp-tools/agent-tools.js +837 -0
- package/dist/src/mcp-tools/agentbbs-tools.d.ts +28 -0
- package/dist/src/mcp-tools/agentbbs-tools.js +394 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts +35 -0
- package/dist/src/mcp-tools/agentdb-tools.js +1473 -0
- package/dist/src/mcp-tools/agenticow-loader.d.ts +59 -0
- package/dist/src/mcp-tools/agenticow-loader.js +105 -0
- package/dist/src/mcp-tools/agenticow-speculate-tools.d.ts +24 -0
- package/dist/src/mcp-tools/agenticow-speculate-tools.js +209 -0
- package/dist/src/mcp-tools/agenticow-tools.d.ts +36 -0
- package/dist/src/mcp-tools/agenticow-tools.js +360 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/dist/src/mcp-tools/analyze-tools.js +346 -0
- package/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/dist/src/mcp-tools/auto-install.js +131 -0
- package/dist/src/mcp-tools/autopilot-tools.d.ts +12 -0
- package/dist/src/mcp-tools/autopilot-tools.js +231 -0
- package/dist/src/mcp-tools/browser-intent-tools.d.ts +162 -0
- package/dist/src/mcp-tools/browser-intent-tools.js +548 -0
- package/dist/src/mcp-tools/browser-session-tools.d.ts +27 -0
- package/dist/src/mcp-tools/browser-session-tools.js +398 -0
- package/dist/src/mcp-tools/browser-tools.d.ts +21 -0
- package/dist/src/mcp-tools/browser-tools.js +760 -0
- package/dist/src/mcp-tools/business-pod-tools.d.ts +20 -0
- package/dist/src/mcp-tools/business-pod-tools.js +169 -0
- package/dist/src/mcp-tools/claims-tools.d.ts +12 -0
- package/dist/src/mcp-tools/claims-tools.js +863 -0
- package/dist/src/mcp-tools/config-tools.d.ts +8 -0
- package/dist/src/mcp-tools/config-tools.js +411 -0
- package/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
- package/dist/src/mcp-tools/coordination-tools.js +729 -0
- package/dist/src/mcp-tools/daa-tools.d.ts +13 -0
- package/dist/src/mcp-tools/daa-tools.js +534 -0
- package/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
- package/dist/src/mcp-tools/embeddings-tools.js +904 -0
- package/dist/src/mcp-tools/github-tools.d.ts +9 -0
- package/dist/src/mcp-tools/github-tools.js +659 -0
- package/dist/src/mcp-tools/guidance-tools.d.ts +15 -0
- package/dist/src/mcp-tools/guidance-tools.js +639 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +953 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts +65 -0
- package/dist/src/mcp-tools/hooks-tools.js +4836 -0
- package/dist/src/mcp-tools/http-fetch-tools.d.ts +55 -0
- package/dist/src/mcp-tools/http-fetch-tools.js +329 -0
- package/dist/src/mcp-tools/index.d.ts +34 -0
- package/dist/src/mcp-tools/index.js +40 -0
- package/dist/src/mcp-tools/managed-agent-tools.d.ts +22 -0
- package/dist/src/mcp-tools/managed-agent-tools.js +357 -0
- package/dist/src/mcp-tools/memory-tools.d.ts +14 -0
- package/dist/src/mcp-tools/memory-tools.js +1330 -0
- package/dist/src/mcp-tools/metaharness-tools.d.ts +51 -0
- package/dist/src/mcp-tools/metaharness-tools.js +684 -0
- package/dist/src/mcp-tools/neural-tools.d.ts +54 -0
- package/dist/src/mcp-tools/neural-tools.js +1168 -0
- package/dist/src/mcp-tools/performance-tools.d.ts +16 -0
- package/dist/src/mcp-tools/performance-tools.js +675 -0
- package/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/dist/src/mcp-tools/progress-tools.js +348 -0
- package/dist/src/mcp-tools/request-tracker.d.ts +17 -0
- package/dist/src/mcp-tools/request-tracker.js +27 -0
- package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/dist/src/mcp-tools/ruvllm-tools.js +355 -0
- package/dist/src/mcp-tools/security-tools.d.ts +18 -0
- package/dist/src/mcp-tools/security-tools.js +556 -0
- package/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/dist/src/mcp-tools/session-tools.js +517 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts +37 -0
- package/dist/src/mcp-tools/swarm-tools.js +390 -0
- package/dist/src/mcp-tools/system-tools.d.ts +13 -0
- package/dist/src/mcp-tools/system-tools.js +688 -0
- package/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/dist/src/mcp-tools/task-tools.js +487 -0
- package/dist/src/mcp-tools/terminal-tools.d.ts +8 -0
- package/dist/src/mcp-tools/terminal-tools.js +306 -0
- package/dist/src/mcp-tools/testgen-tools.d.ts +26 -0
- package/dist/src/mcp-tools/testgen-tools.js +168 -0
- package/dist/src/mcp-tools/tool-loop-guardrail.d.ts +31 -0
- package/dist/src/mcp-tools/tool-loop-guardrail.js +71 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/dist/src/mcp-tools/transfer-tools.js +447 -0
- package/dist/src/mcp-tools/types.d.ts +8 -0
- package/dist/src/mcp-tools/types.js +8 -0
- package/dist/src/mcp-tools/validate-input.d.ts +9 -0
- package/dist/src/mcp-tools/validate-input.js +9 -0
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts +13 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +840 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.js +884 -0
- package/dist/src/memory/bge-embedder.d.ts +25 -0
- package/dist/src/memory/bge-embedder.js +121 -0
- package/dist/src/memory/cross-encoder-rerank.d.ts +33 -0
- package/dist/src/memory/cross-encoder-rerank.js +123 -0
- package/dist/src/memory/embedding-policy.d.ts +21 -0
- package/dist/src/memory/embedding-policy.js +30 -0
- package/dist/src/memory/embedding-quantization.d.ts +62 -0
- package/dist/src/memory/embedding-quantization.js +156 -0
- package/dist/src/memory/ewc-consolidation.d.ts +305 -0
- package/dist/src/memory/ewc-consolidation.js +611 -0
- package/dist/src/memory/graph-edge-writer.d.ts +95 -0
- package/dist/src/memory/graph-edge-writer.js +217 -0
- package/dist/src/memory/hybrid-retrieval.d.ts +77 -0
- package/dist/src/memory/hybrid-retrieval.js +192 -0
- package/dist/src/memory/intelligence.d.ts +405 -0
- package/dist/src/memory/intelligence.js +1316 -0
- package/dist/src/memory/lucene-bm25.d.ts +19 -0
- package/dist/src/memory/lucene-bm25.js +308 -0
- package/dist/src/memory/memory-bridge.d.ts +537 -0
- package/dist/src/memory/memory-bridge.js +2460 -0
- package/dist/src/memory/memory-initializer.d.ts +556 -0
- package/dist/src/memory/memory-initializer.js +3021 -0
- package/dist/src/memory/neural-package-bridge.d.ts +48 -0
- package/dist/src/memory/neural-package-bridge.js +87 -0
- package/dist/src/memory/rabitq-index.d.ts +60 -0
- package/dist/src/memory/rabitq-index.js +242 -0
- package/dist/src/memory/sona-optimizer.d.ts +267 -0
- package/dist/src/memory/sona-optimizer.js +779 -0
- package/dist/src/memory/structured-distill.d.ts +48 -0
- package/dist/src/memory/structured-distill.js +125 -0
- package/dist/src/output.d.ts +9 -0
- package/dist/src/output.js +9 -0
- package/dist/src/parser.d.ts +89 -0
- package/dist/src/parser.js +516 -0
- package/dist/src/plugins/manager.d.ts +133 -0
- package/dist/src/plugins/manager.js +415 -0
- package/dist/src/plugins/store/discovery.d.ts +99 -0
- package/dist/src/plugins/store/discovery.js +1224 -0
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.js +141 -0
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.js +230 -0
- package/dist/src/plugins/store/types.d.ts +279 -0
- package/dist/src/plugins/store/types.js +7 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/dist/src/plugins/tests/standalone-test.js +188 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/dist/src/production/circuit-breaker.d.ts +101 -0
- package/dist/src/production/circuit-breaker.js +241 -0
- package/dist/src/production/error-handler.d.ts +92 -0
- package/dist/src/production/error-handler.js +299 -0
- package/dist/src/production/index.d.ts +23 -0
- package/dist/src/production/index.js +18 -0
- package/dist/src/production/monitoring.d.ts +161 -0
- package/dist/src/production/monitoring.js +356 -0
- package/dist/src/production/rate-limiter.d.ts +80 -0
- package/dist/src/production/rate-limiter.js +201 -0
- package/dist/src/production/retry.d.ts +48 -0
- package/dist/src/production/retry.js +179 -0
- package/dist/src/prompt.d.ts +44 -0
- package/dist/src/prompt.js +501 -0
- package/dist/src/proxy/install.d.ts +29 -0
- package/dist/src/proxy/install.js +135 -0
- package/dist/src/proxy/lifecycle.d.ts +61 -0
- package/dist/src/proxy/lifecycle.js +249 -0
- package/dist/src/proxy/paths.d.ts +34 -0
- package/dist/src/proxy/paths.js +70 -0
- package/dist/src/proxy/release.d.ts +47 -0
- package/dist/src/proxy/release.js +138 -0
- package/dist/src/proxy/token-bridge.d.ts +5 -0
- package/dist/src/proxy/token-bridge.js +61 -0
- package/dist/src/proxy/verify.d.ts +44 -0
- package/dist/src/proxy/verify.js +68 -0
- package/dist/src/runtime/headless.d.ts +60 -0
- package/dist/src/runtime/headless.js +284 -0
- package/dist/src/runtime/parent-death-watchdog.d.ts +42 -0
- package/dist/src/runtime/parent-death-watchdog.js +70 -0
- package/dist/src/ruvector/agent-wasm.d.ts +228 -0
- package/dist/src/ruvector/agent-wasm.js +463 -0
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.js +277 -0
- package/dist/src/ruvector/codemods/engine.d.ts +45 -0
- package/dist/src/ruvector/codemods/engine.js +291 -0
- package/dist/src/ruvector/codemods/scope-analysis.d.ts +29 -0
- package/dist/src/ruvector/codemods/scope-analysis.js +162 -0
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.js +531 -0
- package/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/dist/src/ruvector/coverage-tools.js +157 -0
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.js +699 -0
- package/dist/src/ruvector/diskann-backend.d.ts +78 -0
- package/dist/src/ruvector/diskann-backend.js +310 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts +172 -0
- package/dist/src/ruvector/enhanced-model-router.js +577 -0
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.js +929 -0
- package/dist/src/ruvector/graph-backend.d.ts +79 -0
- package/dist/src/ruvector/graph-backend.js +220 -0
- package/dist/src/ruvector/index.d.ts +38 -0
- package/dist/src/ruvector/index.js +86 -0
- package/dist/src/ruvector/lora-adapter.d.ts +292 -0
- package/dist/src/ruvector/lora-adapter.js +710 -0
- package/dist/src/ruvector/model-prices.d.ts +50 -0
- package/dist/src/ruvector/model-prices.js +72 -0
- package/dist/src/ruvector/model-router.d.ts +408 -0
- package/dist/src/ruvector/model-router.js +1162 -0
- package/dist/src/ruvector/neural-router.d.ts +182 -0
- package/dist/src/ruvector/neural-router.js +825 -0
- package/dist/src/ruvector/output-verifier.d.ts +83 -0
- package/dist/src/ruvector/output-verifier.js +277 -0
- package/dist/src/ruvector/q-learning-router.d.ts +227 -0
- package/dist/src/ruvector/q-learning-router.js +721 -0
- package/dist/src/ruvector/router-calibrator.d.ts +65 -0
- package/dist/src/ruvector/router-calibrator.js +120 -0
- package/dist/src/ruvector/router-parallel-recorder.d.ts +127 -0
- package/dist/src/ruvector/router-parallel-recorder.js +183 -0
- package/dist/src/ruvector/router-trajectory.d.ts +194 -0
- package/dist/src/ruvector/router-trajectory.js +281 -0
- package/dist/src/ruvector/run-transcript-recorder.d.ts +154 -0
- package/dist/src/ruvector/run-transcript-recorder.js +209 -0
- package/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/dist/src/ruvector/ruvllm-wasm.js +379 -0
- package/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/dist/src/ruvector/semantic-router.js +178 -0
- package/dist/src/ruvector/task-embedder.d.ts +56 -0
- package/dist/src/ruvector/task-embedder.js +237 -0
- package/dist/src/ruvector/trajectory-tree.d.ts +113 -0
- package/dist/src/ruvector/trajectory-tree.js +237 -0
- package/dist/src/ruvector/vector-db.d.ts +73 -0
- package/dist/src/ruvector/vector-db.js +301 -0
- package/dist/src/ruvector/wasm-embedder.d.ts +13 -0
- package/dist/src/ruvector/wasm-embedder.js +143 -0
- package/dist/src/security/builtin-aidefence.d.ts +34 -0
- package/dist/src/security/builtin-aidefence.js +86 -0
- package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/dist/src/services/agentic-flow-bridge.js +95 -0
- package/dist/src/services/ai-job-dedup.d.ts +61 -0
- package/dist/src/services/ai-job-dedup.js +136 -0
- package/dist/src/services/checkpoint-gate.d.ts +140 -0
- package/dist/src/services/checkpoint-gate.js +223 -0
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.js +818 -0
- package/dist/src/services/config-file-manager.d.ts +37 -0
- package/dist/src/services/config-file-manager.js +224 -0
- package/dist/src/services/container-worker-pool.d.ts +204 -0
- package/dist/src/services/container-worker-pool.js +589 -0
- package/dist/src/services/daemon-autostart.d.ts +17 -0
- package/dist/src/services/daemon-autostart.js +102 -0
- package/dist/src/services/distill-oracle.d.ts +190 -0
- package/dist/src/services/distill-oracle.js +349 -0
- package/dist/src/services/distill-tuning.d.ts +111 -0
- package/dist/src/services/distill-tuning.js +510 -0
- package/dist/src/services/evolve-proof.d.ts +253 -0
- package/dist/src/services/evolve-proof.js +343 -0
- package/dist/src/services/fable-harness.d.ts +208 -0
- package/dist/src/services/fable-harness.js +388 -0
- package/dist/src/services/git-workspace-identity.d.ts +42 -0
- package/dist/src/services/git-workspace-identity.js +99 -0
- package/dist/src/services/global-ai-budget.d.ts +135 -0
- package/dist/src/services/global-ai-budget.js +415 -0
- package/dist/src/services/harness-benchmark.d.ts +68 -0
- package/dist/src/services/harness-benchmark.js +94 -0
- package/dist/src/services/harness-canary.d.ts +60 -0
- package/dist/src/services/harness-canary.js +69 -0
- package/dist/src/services/harness-corpus-harvester.d.ts +51 -0
- package/dist/src/services/harness-corpus-harvester.js +74 -0
- package/dist/src/services/harness-flywheel-generations.d.ts +115 -0
- package/dist/src/services/harness-flywheel-generations.js +360 -0
- package/dist/src/services/harness-flywheel-runtime.d.ts +25 -0
- package/dist/src/services/harness-flywheel-runtime.js +92 -0
- package/dist/src/services/harness-flywheel.d.ts +48 -0
- package/dist/src/services/harness-flywheel.js +207 -0
- package/dist/src/services/harness-frozen-eval.d.ts +22 -0
- package/dist/src/services/harness-frozen-eval.js +66 -0
- package/dist/src/services/harness-hosts.d.ts +40 -0
- package/dist/src/services/harness-hosts.js +88 -0
- package/dist/src/services/harness-improvement-ledger.d.ts +63 -0
- package/dist/src/services/harness-improvement-ledger.js +101 -0
- package/dist/src/services/harness-loop.d.ts +53 -0
- package/dist/src/services/harness-loop.js +85 -0
- package/dist/src/services/harness-qualification.d.ts +66 -0
- package/dist/src/services/harness-qualification.js +143 -0
- package/dist/src/services/harness-replay.d.ts +37 -0
- package/dist/src/services/harness-replay.js +92 -0
- package/dist/src/services/harness-verify.d.ts +33 -0
- package/dist/src/services/harness-verify.js +26 -0
- package/dist/src/services/harness-worker.d.ts +23 -0
- package/dist/src/services/harness-worker.js +66 -0
- package/dist/src/services/headless-worker-executor.d.ts +358 -0
- package/dist/src/services/headless-worker-executor.js +1269 -0
- package/dist/src/services/index.d.ts +13 -0
- package/dist/src/services/index.js +11 -0
- package/dist/src/services/memory-backup.d.ts +53 -0
- package/dist/src/services/memory-backup.js +198 -0
- package/dist/src/services/memory-distillation.d.ts +41 -0
- package/dist/src/services/memory-distillation.js +277 -0
- package/dist/src/services/native-training.d.ts +68 -0
- package/dist/src/services/native-training.js +141 -0
- package/dist/src/services/registry-api.d.ts +58 -0
- package/dist/src/services/registry-api.js +146 -0
- package/dist/src/services/repo-supervisor.d.ts +70 -0
- package/dist/src/services/repo-supervisor.js +228 -0
- package/dist/src/services/ruvector-training.d.ts +222 -0
- package/dist/src/services/ruvector-training.js +693 -0
- package/dist/src/services/swarm-memory-branches.d.ts +135 -0
- package/dist/src/services/swarm-memory-branches.js +213 -0
- package/dist/src/services/weight-eft.d.ts +305 -0
- package/dist/src/services/weight-eft.js +296 -0
- package/dist/src/services/worker-daemon.d.ts +439 -0
- package/dist/src/services/worker-daemon.js +1865 -0
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.js +513 -0
- package/dist/src/services/workspace-lease.d.ts +55 -0
- package/dist/src/services/workspace-lease.js +191 -0
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.js +200 -0
- package/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/dist/src/transfer/anonymization/index.js +175 -0
- package/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/dist/src/transfer/deploy-seraphine.js +205 -0
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.js +113 -0
- package/dist/src/transfer/index.d.ts +12 -0
- package/dist/src/transfer/index.js +31 -0
- package/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/dist/src/transfer/ipfs/client.js +307 -0
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.js +413 -0
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.js +373 -0
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.js +183 -0
- package/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/dist/src/transfer/storage/gcs.js +272 -0
- package/dist/src/transfer/storage/index.d.ts +6 -0
- package/dist/src/transfer/storage/index.js +6 -0
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.js +382 -0
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.js +334 -0
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.js +153 -0
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.js +294 -0
- package/dist/src/transfer/store/registry.d.ts +58 -0
- package/dist/src/transfer/store/registry.js +285 -0
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.js +232 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/dist/src/transfer/store/types.d.ts +193 -0
- package/dist/src/transfer/store/types.js +6 -0
- package/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/dist/src/transfer/test-seraphine.js +105 -0
- package/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/dist/src/transfer/tests/test-store.js +214 -0
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.js +6 -0
- package/dist/src/types.d.ts +13 -0
- package/dist/src/types.js +13 -0
- package/dist/src/update/checker.d.ts +34 -0
- package/dist/src/update/checker.js +191 -0
- package/dist/src/update/executor.d.ts +33 -0
- package/dist/src/update/executor.js +217 -0
- package/dist/src/update/index.d.ts +33 -0
- package/dist/src/update/index.js +64 -0
- package/dist/src/update/rate-limiter.d.ts +20 -0
- package/dist/src/update/rate-limiter.js +96 -0
- package/dist/src/update/validator.d.ts +17 -0
- package/dist/src/update/validator.js +123 -0
- package/package.json +1 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Promo-row orchestrator — the single entry point the statusline hook calls
|
|
3
|
+
* (ADR-301). Applies, in order:
|
|
4
|
+
*
|
|
5
|
+
* 1. Control precedence (env / enterprise / user / project / remote) —
|
|
6
|
+
* any disable → nothing renders, ever.
|
|
7
|
+
* 2. Environment gates — CI never sees funnel content.
|
|
8
|
+
* 3. Disclosure gate — an upgraded install shows the disclosure text
|
|
9
|
+
* (with the disable instruction) before any message; promotional
|
|
10
|
+
* content only after the grace window.
|
|
11
|
+
* 4. ADR-313 sponsored-downtime override — preempts everything below
|
|
12
|
+
* while rate-limited (unconditional, not slot-based).
|
|
13
|
+
* 5. Local insight ticker (insights.ts) — a reserved 1-in-5 slot shows an
|
|
14
|
+
* environment/task-aware suggestion (CVEs, uncommitted changes,
|
|
15
|
+
* power-saver state) when one exists; otherwise falls through.
|
|
16
|
+
* 6. Rotation — 4:1 educational:promotional, 30-min promo repeat cap.
|
|
17
|
+
*
|
|
18
|
+
* Output is plain text (no ANSI — the renderer applies its own fixed
|
|
19
|
+
* style), ≤ 80 columns, already sanitized by the message pipeline.
|
|
20
|
+
*/
|
|
21
|
+
import { resolveFunnelEnabled } from './precedence.js';
|
|
22
|
+
import { isCI } from './environment.js';
|
|
23
|
+
import { getDisclosure, promoEligible, recordDisclosureShown, selectDisclosureMessage, } from './disclosure.js';
|
|
24
|
+
import { clickTrackedUrl } from './attribution.js';
|
|
25
|
+
import { selectMessage, ROTATION_SLOT_MS } from './rotation.js';
|
|
26
|
+
import { recordFunnelEvent } from './events.js';
|
|
27
|
+
import { getInstalledCliVersion } from '../init/helper-refresh.js';
|
|
28
|
+
import { hasConsent } from './consent.js';
|
|
29
|
+
import { readRateLimitStatus } from './rate-limit-notifier.js';
|
|
30
|
+
import { selectLocalInsight } from './insights.js';
|
|
31
|
+
/**
|
|
32
|
+
* ADR-313 priority override: when the user has manually flagged a Claude
|
|
33
|
+
* usage limit (ADR-312 Phase 0), preempt normal rotation with a dedicated
|
|
34
|
+
* CTA — same precedent as ADR-303's credit-exhaustion recovery surface.
|
|
35
|
+
* Two states depending on whether sponsored-downtime consent is granted:
|
|
36
|
+
* - not yet enabled: an actionable CTA to enable it
|
|
37
|
+
* - already enabled: a quiet status line confirming it's active
|
|
38
|
+
* Both message strings use the exact " · manage: " anchor the renderer
|
|
39
|
+
* already splits on (statusline-generator.ts getPromoRow) — no renderer
|
|
40
|
+
* change needed; the command portion renders bold, never as a fake link.
|
|
41
|
+
* Returns null when the rate-limit flag isn't set (no override).
|
|
42
|
+
*/
|
|
43
|
+
function getSponsoredDowntimeOverride(now) {
|
|
44
|
+
const status = readRateLimitStatus(now);
|
|
45
|
+
if (!status.limited)
|
|
46
|
+
return null;
|
|
47
|
+
if (hasConsent('sponsored-downtime')) {
|
|
48
|
+
return {
|
|
49
|
+
text: '⚡ Running on sponsored Cognitum capacity · manage: ruflo proxy sponsor-disable',
|
|
50
|
+
kind: 'promotional',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
text: '⚡ Free Cognitum capacity while you wait · manage: ruflo proxy sponsor-enable',
|
|
55
|
+
kind: 'promotional',
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** 1 in 5 slots, a different phase than rotation.ts's promo slot (slot%5==4)
|
|
59
|
+
* so the two never collide — reserved for a local insight IF one exists;
|
|
60
|
+
* otherwise falls through to the normal remote rotation untouched. This is
|
|
61
|
+
* the "ticker" cadence: insights appear periodically, never permanently
|
|
62
|
+
* take over the row, and never appear at all when nothing is actionable. */
|
|
63
|
+
const INSIGHT_SLOT_MODULO = 5;
|
|
64
|
+
const INSIGHT_SLOT_PHASE = 2;
|
|
65
|
+
function isInsightSlot(now) {
|
|
66
|
+
const slot = Math.floor(now.getTime() / ROTATION_SLOT_MS);
|
|
67
|
+
return slot % INSIGHT_SLOT_MODULO === INSIGHT_SLOT_PHASE;
|
|
68
|
+
}
|
|
69
|
+
export function getFunnelPromo(ctx) {
|
|
70
|
+
const env = ctx.env ?? process.env;
|
|
71
|
+
const now = ctx.now ?? new Date();
|
|
72
|
+
if (!ctx.interactive)
|
|
73
|
+
return null;
|
|
74
|
+
if (isCI(env))
|
|
75
|
+
return null;
|
|
76
|
+
const decision = resolveFunnelEnabled(ctx.cwd ?? process.cwd(), env);
|
|
77
|
+
if (!decision.enabled)
|
|
78
|
+
return null;
|
|
79
|
+
const release = getInstalledCliVersion();
|
|
80
|
+
// Disclosure gate: never a message before the disclosure has been shown
|
|
81
|
+
// and its grace window has passed. The disclosure MESSAGE itself is now
|
|
82
|
+
// remote-sourced (ADR-311) — selectDisclosureMessage() returns null when
|
|
83
|
+
// the remote pool hasn't populated yet (cold start / outage), and per the
|
|
84
|
+
// "zero local promo content" design, null means show nothing this cycle.
|
|
85
|
+
const disclosure = getDisclosure();
|
|
86
|
+
if (disclosure.state === 'never_seen') {
|
|
87
|
+
const msg = selectDisclosureMessage(now);
|
|
88
|
+
if (!msg)
|
|
89
|
+
return null; // fail-closed: no remote disclosure cached yet
|
|
90
|
+
recordDisclosureShown(now);
|
|
91
|
+
recordFunnelEvent('disclosure_shown', 'statusline', release, { now, messageId: msg.id });
|
|
92
|
+
const url = msg.url ? clickTrackedUrl(msg.id, msg.url, {
|
|
93
|
+
medium: 'statusline', campaign: 'disclosure', content: msg.id, now,
|
|
94
|
+
}) : undefined;
|
|
95
|
+
return { text: msg.text, kind: 'disclosure', url };
|
|
96
|
+
}
|
|
97
|
+
if (!promoEligible(now)) {
|
|
98
|
+
if (disclosure.state === 'disclosed_enabled') {
|
|
99
|
+
const msg = selectDisclosureMessage(now);
|
|
100
|
+
if (!msg)
|
|
101
|
+
return null; // fail-closed
|
|
102
|
+
const url = msg.url ? clickTrackedUrl(msg.id, msg.url, {
|
|
103
|
+
medium: 'statusline', campaign: 'disclosure', content: msg.id, now,
|
|
104
|
+
}) : undefined;
|
|
105
|
+
return { text: msg.text, kind: 'disclosure', url };
|
|
106
|
+
}
|
|
107
|
+
return null; // disclosed_disabled is caught by precedence, but stay fail-closed
|
|
108
|
+
}
|
|
109
|
+
// ADR-313 priority override: a self-reported usage-limit flag preempts
|
|
110
|
+
// normal rotation, exactly the way ADR-303's credit-exhaustion recovery
|
|
111
|
+
// is designed to preempt it. Only reachable here — i.e. only after the
|
|
112
|
+
// disclosure invariant (ADR-301 "no promotional content before
|
|
113
|
+
// disclosure") has already been satisfied above.
|
|
114
|
+
const override = getSponsoredDowntimeOverride(now);
|
|
115
|
+
if (override)
|
|
116
|
+
return override;
|
|
117
|
+
// Local insight ticker: on its reserved 1-in-5 slot, show the highest-
|
|
118
|
+
// priority environment/task insight if one exists — CVEs pending,
|
|
119
|
+
// uncommitted changes, power-saver active, etc. (insights.ts). No
|
|
120
|
+
// insight this render (or no context passed) → fall straight through to
|
|
121
|
+
// the untouched remote rotation below, same as any other slot.
|
|
122
|
+
if (ctx.localInsights && isInsightSlot(now)) {
|
|
123
|
+
const insight = selectLocalInsight(ctx.localInsights);
|
|
124
|
+
if (insight)
|
|
125
|
+
return { text: insight.text, kind: 'insight' };
|
|
126
|
+
}
|
|
127
|
+
const msg = selectMessage(now, release);
|
|
128
|
+
if (!msg)
|
|
129
|
+
return null;
|
|
130
|
+
// Any message carrying a URL (educational tips included) routes through
|
|
131
|
+
// the server click-redirect so `promo_open` + coarse geo are captured
|
|
132
|
+
// before 302ing to the real target — click counting is uniform across
|
|
133
|
+
// the whole rotation, not just the promotional slot. If the click
|
|
134
|
+
// endpoint chain rejects the URL for any reason, fall back to the
|
|
135
|
+
// UTM-decorated direct link so the click still lands where it should.
|
|
136
|
+
let url;
|
|
137
|
+
if (msg.url) {
|
|
138
|
+
url = clickTrackedUrl(msg.id, msg.url, {
|
|
139
|
+
medium: 'statusline', campaign: msg.class, content: msg.id, now,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return { text: msg.text, kind: msg.class, url };
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=promo.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate-limit notifier — ADR-312 Phase 0 out-of-band signal path.
|
|
3
|
+
*
|
|
4
|
+
* Structural mirror of credit-notifier.ts. This is NOT automatic detection
|
|
5
|
+
* — ADR-312 established that Claude Code does not currently expose any way
|
|
6
|
+
* to detect its own usage-limit state from outside its process (verified
|
|
7
|
+
* against the actual installed CLI source, not assumed). This module is the
|
|
8
|
+
* MANUAL, self-reported alternative: the user tells ruflo they've hit a
|
|
9
|
+
* limit, ruflo remembers it, and the funnel promo row can react.
|
|
10
|
+
*
|
|
11
|
+
* State is cheap and durable:
|
|
12
|
+
* ~/.ruflo/rate-limit-status.json = { limited: bool, since: ISO, cleared: ISO|null }
|
|
13
|
+
*
|
|
14
|
+
* A TTL (default 6h) auto-expires a forgotten flag so a stale manual mark
|
|
15
|
+
* doesn't linger indefinitely if the user forgets to clear it — Claude
|
|
16
|
+
* usage limits reset on hours-to-days cadences (five_hour / seven_day per
|
|
17
|
+
* ADR-312's grounded research), so 6h is a reasonable "the user probably
|
|
18
|
+
* forgot to clear this" bound without requiring per-type precision we
|
|
19
|
+
* don't have.
|
|
20
|
+
*/
|
|
21
|
+
export declare const RATE_LIMIT_STATUS_FILE = "rate-limit-status.json";
|
|
22
|
+
/** Auto-expire a forgotten manual flag after 6h (see module doc). */
|
|
23
|
+
export declare const RATE_LIMIT_TTL_MS: number;
|
|
24
|
+
export interface RateLimitStatus {
|
|
25
|
+
limited: boolean;
|
|
26
|
+
since: string | null;
|
|
27
|
+
cleared: string | null;
|
|
28
|
+
/** ADR-314 §D1 — last time `limited` actually changed value; gates the toggle cooldown. */
|
|
29
|
+
lastToggleAt: string | null;
|
|
30
|
+
}
|
|
31
|
+
/** Read the current rate-limit status. Never throws. Applies the TTL. */
|
|
32
|
+
export declare function readRateLimitStatus(now?: Date): RateLimitStatus;
|
|
33
|
+
/**
|
|
34
|
+
* Mark as rate-limited — idempotent. Sets `since` on the first mark, leaves
|
|
35
|
+
* it alone on subsequent marks so the user sees a stable "since" timestamp
|
|
36
|
+
* until they clear it or the TTL expires. Refuses to flip false→true inside
|
|
37
|
+
* the ADR-314 §D1 cooldown window (returns false; a no-op re-mark of an
|
|
38
|
+
* already-true flag is unaffected — that's not a state change).
|
|
39
|
+
*/
|
|
40
|
+
export declare function markRateLimited(now?: Date): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Clear rate-limited status. Called via `ruflo settings notices
|
|
43
|
+
* rate-limited --clear`, automatically by the TTL, or once a real Phase 1/2
|
|
44
|
+
* signal (ADR-312) confirms the limit has reset. Refuses to flip true→false
|
|
45
|
+
* inside the cooldown window (returns false); clearing an already-clear
|
|
46
|
+
* flag is always allowed (not a state change, and TTL auto-clear must never
|
|
47
|
+
* be blocked by a cooldown it didn't itself trigger).
|
|
48
|
+
*/
|
|
49
|
+
export declare function clearRateLimitStatus(now?: Date): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* User-facing single-line summary — plain text, no ANSI. Callers style it
|
|
52
|
+
* themselves. Returns null when not rate-limited (no surface).
|
|
53
|
+
*/
|
|
54
|
+
export declare function rateLimitNotice(now?: Date): string | null;
|
|
55
|
+
//# sourceMappingURL=rate-limit-notifier.d.ts.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate-limit notifier — ADR-312 Phase 0 out-of-band signal path.
|
|
3
|
+
*
|
|
4
|
+
* Structural mirror of credit-notifier.ts. This is NOT automatic detection
|
|
5
|
+
* — ADR-312 established that Claude Code does not currently expose any way
|
|
6
|
+
* to detect its own usage-limit state from outside its process (verified
|
|
7
|
+
* against the actual installed CLI source, not assumed). This module is the
|
|
8
|
+
* MANUAL, self-reported alternative: the user tells ruflo they've hit a
|
|
9
|
+
* limit, ruflo remembers it, and the funnel promo row can react.
|
|
10
|
+
*
|
|
11
|
+
* State is cheap and durable:
|
|
12
|
+
* ~/.ruflo/rate-limit-status.json = { limited: bool, since: ISO, cleared: ISO|null }
|
|
13
|
+
*
|
|
14
|
+
* A TTL (default 6h) auto-expires a forgotten flag so a stale manual mark
|
|
15
|
+
* doesn't linger indefinitely if the user forgets to clear it — Claude
|
|
16
|
+
* usage limits reset on hours-to-days cadences (five_hour / seven_day per
|
|
17
|
+
* ADR-312's grounded research), so 6h is a reasonable "the user probably
|
|
18
|
+
* forgot to clear this" bound without requiring per-type precision we
|
|
19
|
+
* don't have.
|
|
20
|
+
*/
|
|
21
|
+
import { readStateJson, writeStateJson } from './state.js';
|
|
22
|
+
import { cooldownActive } from './toggle-cooldown.js';
|
|
23
|
+
export const RATE_LIMIT_STATUS_FILE = 'rate-limit-status.json';
|
|
24
|
+
/** Auto-expire a forgotten manual flag after 6h (see module doc). */
|
|
25
|
+
export const RATE_LIMIT_TTL_MS = 6 * 60 * 60 * 1000;
|
|
26
|
+
/** Read the current rate-limit status. Never throws. Applies the TTL. */
|
|
27
|
+
export function readRateLimitStatus(now = new Date()) {
|
|
28
|
+
const raw = readStateJson(RATE_LIMIT_STATUS_FILE);
|
|
29
|
+
const status = {
|
|
30
|
+
limited: raw?.limited ?? false,
|
|
31
|
+
since: raw?.since ?? null,
|
|
32
|
+
cleared: raw?.cleared ?? null,
|
|
33
|
+
lastToggleAt: raw?.lastToggleAt ?? null,
|
|
34
|
+
};
|
|
35
|
+
if (status.limited && status.since) {
|
|
36
|
+
const since = Date.parse(status.since);
|
|
37
|
+
if (!Number.isNaN(since) && now.getTime() - since >= RATE_LIMIT_TTL_MS) {
|
|
38
|
+
return { limited: false, since: status.since, cleared: now.toISOString(), lastToggleAt: status.lastToggleAt };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return status;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Mark as rate-limited — idempotent. Sets `since` on the first mark, leaves
|
|
45
|
+
* it alone on subsequent marks so the user sees a stable "since" timestamp
|
|
46
|
+
* until they clear it or the TTL expires. Refuses to flip false→true inside
|
|
47
|
+
* the ADR-314 §D1 cooldown window (returns false; a no-op re-mark of an
|
|
48
|
+
* already-true flag is unaffected — that's not a state change).
|
|
49
|
+
*/
|
|
50
|
+
export function markRateLimited(now = new Date()) {
|
|
51
|
+
const current = readRateLimitStatus(now);
|
|
52
|
+
if (current.limited && current.since)
|
|
53
|
+
return true; // already flagged, not a change
|
|
54
|
+
if (cooldownActive(current.lastToggleAt, now))
|
|
55
|
+
return false;
|
|
56
|
+
writeStateJson(RATE_LIMIT_STATUS_FILE, {
|
|
57
|
+
limited: true,
|
|
58
|
+
since: current.since ?? now.toISOString(),
|
|
59
|
+
cleared: null,
|
|
60
|
+
lastToggleAt: now.toISOString(),
|
|
61
|
+
});
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Clear rate-limited status. Called via `ruflo settings notices
|
|
66
|
+
* rate-limited --clear`, automatically by the TTL, or once a real Phase 1/2
|
|
67
|
+
* signal (ADR-312) confirms the limit has reset. Refuses to flip true→false
|
|
68
|
+
* inside the cooldown window (returns false); clearing an already-clear
|
|
69
|
+
* flag is always allowed (not a state change, and TTL auto-clear must never
|
|
70
|
+
* be blocked by a cooldown it didn't itself trigger).
|
|
71
|
+
*/
|
|
72
|
+
export function clearRateLimitStatus(now = new Date()) {
|
|
73
|
+
const current = readRateLimitStatus(now);
|
|
74
|
+
if (!current.limited)
|
|
75
|
+
return true; // already clear, not a change
|
|
76
|
+
if (cooldownActive(current.lastToggleAt, now))
|
|
77
|
+
return false;
|
|
78
|
+
writeStateJson(RATE_LIMIT_STATUS_FILE, {
|
|
79
|
+
limited: false,
|
|
80
|
+
since: current.since,
|
|
81
|
+
cleared: now.toISOString(),
|
|
82
|
+
lastToggleAt: now.toISOString(),
|
|
83
|
+
});
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* User-facing single-line summary — plain text, no ANSI. Callers style it
|
|
88
|
+
* themselves. Returns null when not rate-limited (no surface).
|
|
89
|
+
*/
|
|
90
|
+
export function rateLimitNotice(now = new Date()) {
|
|
91
|
+
const status = readRateLimitStatus(now);
|
|
92
|
+
if (!status.limited)
|
|
93
|
+
return null;
|
|
94
|
+
const since = status.since ? Date.parse(status.since) : NaN;
|
|
95
|
+
if (Number.isNaN(since)) {
|
|
96
|
+
return 'Claude usage limit flagged · run: ruflo proxy sponsor-enable';
|
|
97
|
+
}
|
|
98
|
+
const ageMin = Math.max(0, Math.round((now.getTime() - since) / (60 * 1000)));
|
|
99
|
+
const when = ageMin < 1 ? 'just now' : ageMin < 60 ? `${ageMin}m ago` : `${Math.round(ageMin / 60)}h ago`;
|
|
100
|
+
return `Claude usage limit flagged (${when}) · run: ruflo proxy sponsor-enable`;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=rate-limit-notifier.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rotation scheduler — ADR-301 content ratio, enforced structurally.
|
|
3
|
+
*
|
|
4
|
+
* - Educational: at least 4 of every 5 rotation slots.
|
|
5
|
+
* - Promotional: at most 1 of every 5 slots (slot % 5 === 4), and only
|
|
6
|
+
* when no promotion has shown in the last 30 minutes.
|
|
7
|
+
* - Deterministic: selection is a pure function of (time slot, registry,
|
|
8
|
+
* last-promo state) — no Math.random, so renders are reproducible and
|
|
9
|
+
* the statusline cache can't skew the ratio.
|
|
10
|
+
*/
|
|
11
|
+
import type { FunnelMessage } from './types.js';
|
|
12
|
+
/** One rotation slot — ADR-301 allows 15–30s; 20s sits inside the band. */
|
|
13
|
+
export declare const ROTATION_SLOT_MS = 20000;
|
|
14
|
+
/** The same promotion appears at most once every 30 minutes (ADR-301). */
|
|
15
|
+
export declare const PROMO_REPEAT_CAP_MS: number;
|
|
16
|
+
/** 1 promotional slot per 5 (ADR-301: ≤ 1 in 5 rotations). */
|
|
17
|
+
export declare const PROMO_SLOT_MODULO = 5;
|
|
18
|
+
export declare function selectMessage(now?: Date, release?: string): FunnelMessage | null;
|
|
19
|
+
//# sourceMappingURL=rotation.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rotation scheduler — ADR-301 content ratio, enforced structurally.
|
|
3
|
+
*
|
|
4
|
+
* - Educational: at least 4 of every 5 rotation slots.
|
|
5
|
+
* - Promotional: at most 1 of every 5 slots (slot % 5 === 4), and only
|
|
6
|
+
* when no promotion has shown in the last 30 minutes.
|
|
7
|
+
* - Deterministic: selection is a pure function of (time slot, registry,
|
|
8
|
+
* last-promo state) — no Math.random, so renders are reproducible and
|
|
9
|
+
* the statusline cache can't skew the ratio.
|
|
10
|
+
*/
|
|
11
|
+
import { MESSAGES, eligibleMessagesFromPools } from './messages.js';
|
|
12
|
+
import { getRemoteMessages, refreshRemoteMessages } from './message-transport.js';
|
|
13
|
+
import { readStateJson, writeStateJson } from './state.js';
|
|
14
|
+
import { recordFunnelEvent } from './events.js';
|
|
15
|
+
const ROTATION_FILE = 'funnel-rotation.json';
|
|
16
|
+
/** One rotation slot — ADR-301 allows 15–30s; 20s sits inside the band. */
|
|
17
|
+
export const ROTATION_SLOT_MS = 20_000;
|
|
18
|
+
/** The same promotion appears at most once every 30 minutes (ADR-301). */
|
|
19
|
+
export const PROMO_REPEAT_CAP_MS = 30 * 60 * 1000;
|
|
20
|
+
/** 1 promotional slot per 5 (ADR-301: ≤ 1 in 5 rotations). */
|
|
21
|
+
export const PROMO_SLOT_MODULO = 5;
|
|
22
|
+
export function selectMessage(now = new Date(), release = 'unknown') {
|
|
23
|
+
// Kick a background refresh — never awaited, never blocks render. The
|
|
24
|
+
// remote pool becomes visible on subsequent selects once cached.
|
|
25
|
+
void refreshRemoteMessages();
|
|
26
|
+
// Merge: remote pool authoritative, in-code pool fallback (by id).
|
|
27
|
+
const pool = eligibleMessagesFromPools(MESSAGES, getRemoteMessages(), now);
|
|
28
|
+
const educational = pool.filter((m) => m.class === 'educational');
|
|
29
|
+
const promotional = pool.filter((m) => m.class === 'promotional');
|
|
30
|
+
if (educational.length === 0 && promotional.length === 0)
|
|
31
|
+
return null;
|
|
32
|
+
const slot = Math.floor(now.getTime() / ROTATION_SLOT_MS);
|
|
33
|
+
const promoSlot = slot % PROMO_SLOT_MODULO === PROMO_SLOT_MODULO - 1;
|
|
34
|
+
let selected = null;
|
|
35
|
+
if (promoSlot && promotional.length > 0 && promoCapClear(now)) {
|
|
36
|
+
selected = promotional[Math.floor(slot / PROMO_SLOT_MODULO) % promotional.length];
|
|
37
|
+
recordPromoShown(selected, now);
|
|
38
|
+
}
|
|
39
|
+
else if (educational.length > 0) {
|
|
40
|
+
selected = educational[slot % educational.length];
|
|
41
|
+
}
|
|
42
|
+
// Fire an impression event for whichever message was selected. Consent-gated
|
|
43
|
+
// (recordFunnelEvent no-ops without telemetry consent). Idempotency across
|
|
44
|
+
// renders in the same slot is handled by the same-slot deduplication in
|
|
45
|
+
// the events transport — we don't try to dedupe here because the slot
|
|
46
|
+
// math already returns the same id for the same slot, giving downstream
|
|
47
|
+
// aggregation a per-slot boolean.
|
|
48
|
+
if (selected) {
|
|
49
|
+
recordFunnelEvent('promo_impression', 'statusline', release, {
|
|
50
|
+
now, messageId: selected.id,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return selected;
|
|
54
|
+
}
|
|
55
|
+
function promoCapClear(now) {
|
|
56
|
+
const state = readStateJson(ROTATION_FILE);
|
|
57
|
+
if (!state?.lastPromoAt)
|
|
58
|
+
return true;
|
|
59
|
+
const last = Date.parse(state.lastPromoAt);
|
|
60
|
+
if (Number.isNaN(last))
|
|
61
|
+
return true;
|
|
62
|
+
return now.getTime() - last >= PROMO_REPEAT_CAP_MS;
|
|
63
|
+
}
|
|
64
|
+
function recordPromoShown(msg, now) {
|
|
65
|
+
writeStateJson(ROTATION_FILE, {
|
|
66
|
+
lastPromoAt: now.toISOString(),
|
|
67
|
+
lastPromoId: msg.id,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=rotation.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Funnel state storage — user-level JSON files under ~/.ruflo (ADR-302/305).
|
|
3
|
+
*
|
|
4
|
+
* User-level (not project-level) so dismissals, consent, and disclosure
|
|
5
|
+
* persist across projects. Files are written 0600 and never committed.
|
|
6
|
+
* RUFLO_STATE_DIR overrides the directory (tests, unusual $HOME setups).
|
|
7
|
+
*/
|
|
8
|
+
export declare function funnelStateDir(): string;
|
|
9
|
+
export declare function statePath(name: string): string;
|
|
10
|
+
export declare function readStateJson<T>(name: string): T | null;
|
|
11
|
+
export declare function writeStateJson(name: string, value: unknown): boolean;
|
|
12
|
+
export declare function deleteStateFile(name: string): void;
|
|
13
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Funnel state storage — user-level JSON files under ~/.ruflo (ADR-302/305).
|
|
3
|
+
*
|
|
4
|
+
* User-level (not project-level) so dismissals, consent, and disclosure
|
|
5
|
+
* persist across projects. Files are written 0600 and never committed.
|
|
6
|
+
* RUFLO_STATE_DIR overrides the directory (tests, unusual $HOME setups).
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as os from 'os';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
export function funnelStateDir() {
|
|
12
|
+
const override = process.env.RUFLO_STATE_DIR;
|
|
13
|
+
if (override && override.trim())
|
|
14
|
+
return override;
|
|
15
|
+
return path.join(os.homedir(), '.ruflo');
|
|
16
|
+
}
|
|
17
|
+
export function statePath(name) {
|
|
18
|
+
return path.join(funnelStateDir(), name);
|
|
19
|
+
}
|
|
20
|
+
export function readStateJson(name) {
|
|
21
|
+
try {
|
|
22
|
+
const raw = fs.readFileSync(statePath(name), 'utf-8');
|
|
23
|
+
return JSON.parse(raw);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function writeStateJson(name, value) {
|
|
30
|
+
try {
|
|
31
|
+
const dir = funnelStateDir();
|
|
32
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
33
|
+
const target = statePath(name);
|
|
34
|
+
// Write-then-rename so a crash never leaves a truncated state file.
|
|
35
|
+
const tmp = `${target}.tmp`;
|
|
36
|
+
fs.writeFileSync(tmp, JSON.stringify(value, null, 2), { encoding: 'utf-8', mode: 0o600 });
|
|
37
|
+
fs.renameSync(tmp, target);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function deleteStateFile(name) {
|
|
45
|
+
try {
|
|
46
|
+
fs.unlinkSync(statePath(name));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// already absent — fine
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared toggle cooldown — ADR-314 §D1.
|
|
3
|
+
*
|
|
4
|
+
* Self-reported flags (rate-limited, quota-low) have zero server-side
|
|
5
|
+
* verification (ADR-312's Phase 0 constraint carries over unchanged). A
|
|
6
|
+
* cooldown on how often the flag can actually CHANGE state is cheap,
|
|
7
|
+
* purely client-side friction against casual "always on" gaming or a
|
|
8
|
+
* scripted flip-flop loop — it does not stop a determined abuser (that
|
|
9
|
+
* needs the per-identity server-side quota ADR-314 flags as the real fix),
|
|
10
|
+
* but it raises the bar above "one line in a shell script."
|
|
11
|
+
*/
|
|
12
|
+
export declare const TOGGLE_COOLDOWN_MS: number;
|
|
13
|
+
/** True when `lastToggleAt` is within the cooldown window of `now`. */
|
|
14
|
+
export declare function cooldownActive(lastToggleAt: string | null, now: Date): boolean;
|
|
15
|
+
/** Minutes remaining in the cooldown window — for user-facing messages. */
|
|
16
|
+
export declare function cooldownRemainingMin(lastToggleAt: string | null, now: Date): number;
|
|
17
|
+
//# sourceMappingURL=toggle-cooldown.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared toggle cooldown — ADR-314 §D1.
|
|
3
|
+
*
|
|
4
|
+
* Self-reported flags (rate-limited, quota-low) have zero server-side
|
|
5
|
+
* verification (ADR-312's Phase 0 constraint carries over unchanged). A
|
|
6
|
+
* cooldown on how often the flag can actually CHANGE state is cheap,
|
|
7
|
+
* purely client-side friction against casual "always on" gaming or a
|
|
8
|
+
* scripted flip-flop loop — it does not stop a determined abuser (that
|
|
9
|
+
* needs the per-identity server-side quota ADR-314 flags as the real fix),
|
|
10
|
+
* but it raises the bar above "one line in a shell script."
|
|
11
|
+
*/
|
|
12
|
+
export const TOGGLE_COOLDOWN_MS = 10 * 60 * 1000;
|
|
13
|
+
/** True when `lastToggleAt` is within the cooldown window of `now`. */
|
|
14
|
+
export function cooldownActive(lastToggleAt, now) {
|
|
15
|
+
if (!lastToggleAt)
|
|
16
|
+
return false;
|
|
17
|
+
const t = Date.parse(lastToggleAt);
|
|
18
|
+
if (Number.isNaN(t))
|
|
19
|
+
return false;
|
|
20
|
+
return now.getTime() - t < TOGGLE_COOLDOWN_MS;
|
|
21
|
+
}
|
|
22
|
+
/** Minutes remaining in the cooldown window — for user-facing messages. */
|
|
23
|
+
export function cooldownRemainingMin(lastToggleAt, now) {
|
|
24
|
+
if (!lastToggleAt)
|
|
25
|
+
return 0;
|
|
26
|
+
const t = Date.parse(lastToggleAt);
|
|
27
|
+
if (Number.isNaN(t))
|
|
28
|
+
return 0;
|
|
29
|
+
const remainingMs = TOGGLE_COOLDOWN_MS - (now.getTime() - t);
|
|
30
|
+
return Math.max(0, Math.ceil(remainingMs / (60 * 1000)));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=toggle-cooldown.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Funnel type definitions — ADR-301..310.
|
|
3
|
+
*
|
|
4
|
+
* The funnel is the ruflo → Cognitum lifecycle system: promotional status
|
|
5
|
+
* surface (ADR-301), post-init enrollment (ADR-302), credit-exhaustion
|
|
6
|
+
* recovery (ADR-303), governed by consent receipts (ADR-302), control
|
|
7
|
+
* precedence (ADR-305), and the governance/privacy rules of ADR-309.
|
|
8
|
+
*
|
|
9
|
+
* Everything in this module is local-only: no code path here performs
|
|
10
|
+
* network I/O. Events are queued locally and only when telemetry consent
|
|
11
|
+
* is granted (ADR-308 failure policy: telemetry never blocks the CLI).
|
|
12
|
+
*/
|
|
13
|
+
export type FunnelDisclosureState = 'never_seen' | 'disclosed_enabled' | 'disclosed_disabled';
|
|
14
|
+
export interface DisclosureRecord {
|
|
15
|
+
state: FunnelDisclosureState;
|
|
16
|
+
/** ISO timestamp of the first render of the disclosure text. */
|
|
17
|
+
firstShownAt: string | null;
|
|
18
|
+
}
|
|
19
|
+
export type FunnelMessageClass = 'educational' | 'promotional' | 'disclosure';
|
|
20
|
+
export interface FunnelMessage {
|
|
21
|
+
id: string;
|
|
22
|
+
schemaVersion: 1;
|
|
23
|
+
text: string;
|
|
24
|
+
/** Optional link; must pass the in-code host allowlist or the message is dropped. */
|
|
25
|
+
url?: string;
|
|
26
|
+
class: FunnelMessageClass;
|
|
27
|
+
/** ISO timestamp; expired messages leave the rotation immediately. */
|
|
28
|
+
expiresAt?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface PromoRow {
|
|
31
|
+
text: string;
|
|
32
|
+
kind: 'disclosure' | FunnelMessageClass | 'insight';
|
|
33
|
+
url?: string;
|
|
34
|
+
}
|
|
35
|
+
export type ConsentDomain = 'account' | 'proxy-install' | 'telemetry' | 'cloud-routing' | 'hosted-memory' | 'sponsored-downtime' | 'power-saver' | 'training-data-sharing' | 'advisor-tips' | 'rev-share-payout' | 'spinner-verbs' | 'company-announcements';
|
|
36
|
+
export interface ConsentReceipt {
|
|
37
|
+
granted: boolean;
|
|
38
|
+
policyVersion: number;
|
|
39
|
+
/** ISO timestamp of the decision; null = never asked. */
|
|
40
|
+
at: string | null;
|
|
41
|
+
surface: string | null;
|
|
42
|
+
}
|
|
43
|
+
export type ConsentFile = Partial<Record<ConsentDomain, ConsentReceipt>>;
|
|
44
|
+
/** Bump when the meaning of a consent domain changes materially (ADR-302). */
|
|
45
|
+
export declare const CONSENT_POLICY_VERSION = 1;
|
|
46
|
+
export type PayoutEnrollmentPolicyVersion = 1;
|
|
47
|
+
/**
|
|
48
|
+
* Local mirror of enrollment state issued by the funnel.ruv.io backend.
|
|
49
|
+
* The `enrollment_token` is opaque — the client never introspects it.
|
|
50
|
+
*/
|
|
51
|
+
export interface PayoutEnrollment {
|
|
52
|
+
enrollment_token: string;
|
|
53
|
+
enrolled_at: string;
|
|
54
|
+
payout_account_last4: string;
|
|
55
|
+
kyc_status: 'verified' | 'pending' | 'failed';
|
|
56
|
+
policy_version: PayoutEnrollmentPolicyVersion;
|
|
57
|
+
}
|
|
58
|
+
export type FunnelDecisionSource = 'env' | 'enterprise-policy' | 'user-config' | 'project-config' | 'package-default' | 'remote-policy' | 'disclosure-declined';
|
|
59
|
+
export interface FunnelEnabledDecision {
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
decidedBy: FunnelDecisionSource;
|
|
62
|
+
}
|
|
63
|
+
export declare enum CreditErrorCode {
|
|
64
|
+
/** Cognitum ledger says balance is spent — the ONLY funnel trigger. */
|
|
65
|
+
COGNITUM_CREDIT_EXHAUSTED = "COGNITUM_CREDIT_EXHAUSTED",
|
|
66
|
+
/** Upstream provider's own quota, not Cognitum credits. */
|
|
67
|
+
PROVIDER_QUOTA_EXHAUSTED = "PROVIDER_QUOTA_EXHAUSTED",
|
|
68
|
+
PROVIDER_RATE_LIMITED = "PROVIDER_RATE_LIMITED",
|
|
69
|
+
AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED",
|
|
70
|
+
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE"
|
|
71
|
+
}
|
|
72
|
+
export interface NormalizedCreditError {
|
|
73
|
+
code: CreditErrorCode | null;
|
|
74
|
+
/** 1 only when an explicit machine-readable provider code mapped; else 0. */
|
|
75
|
+
confidence: 0 | 1;
|
|
76
|
+
retryable: boolean;
|
|
77
|
+
/** Original provider error, preserved verbatim for --verbose paths. */
|
|
78
|
+
cause?: unknown;
|
|
79
|
+
}
|
|
80
|
+
export type FunnelEventName = 'disclosure_shown' | 'funnel_disabled' | 'signup_opened' | 'account_created' | 'proxy_activated' | 'promo_impression' | 'promo_open' | 'sponsor_mode_enabled' | 'sponsor_mode_disabled' | 'sponsor_capacity_exhausted' | 'power_saver_enabled' | 'power_saver_disabled' | 'toggle_cooldown_blocked' | 'training_share_enabled' | 'training_share_disabled' | 'advisor_tip_enabled' | 'advisor_tip_disabled';
|
|
81
|
+
export type FunnelSurface = 'statusline' | 'init' | 'credit_exhaustion';
|
|
82
|
+
export interface FunnelEvent {
|
|
83
|
+
schemaVersion: 1;
|
|
84
|
+
event: FunnelEventName;
|
|
85
|
+
surface: FunnelSurface;
|
|
86
|
+
release: string;
|
|
87
|
+
region?: string;
|
|
88
|
+
pseudonymousId?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Message id for promo_impression / promo_open — lets the analyst
|
|
91
|
+
* attribute clicks + impressions to a specific rotation entry without
|
|
92
|
+
* carrying prompt/URL/PII data.
|
|
93
|
+
*/
|
|
94
|
+
messageId?: string;
|
|
95
|
+
/** Daily bucket ("2026-07-10") — full timestamps are never recorded. */
|
|
96
|
+
timestampBucket: string;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Funnel type definitions — ADR-301..310.
|
|
3
|
+
*
|
|
4
|
+
* The funnel is the ruflo → Cognitum lifecycle system: promotional status
|
|
5
|
+
* surface (ADR-301), post-init enrollment (ADR-302), credit-exhaustion
|
|
6
|
+
* recovery (ADR-303), governed by consent receipts (ADR-302), control
|
|
7
|
+
* precedence (ADR-305), and the governance/privacy rules of ADR-309.
|
|
8
|
+
*
|
|
9
|
+
* Everything in this module is local-only: no code path here performs
|
|
10
|
+
* network I/O. Events are queued locally and only when telemetry consent
|
|
11
|
+
* is granted (ADR-308 failure policy: telemetry never blocks the CLI).
|
|
12
|
+
*/
|
|
13
|
+
/** Bump when the meaning of a consent domain changes materially (ADR-302). */
|
|
14
|
+
export const CONSENT_POLICY_VERSION = 1;
|
|
15
|
+
// ─── ADR-303: credit error taxonomy ─────────────────────────────────────────
|
|
16
|
+
export var CreditErrorCode;
|
|
17
|
+
(function (CreditErrorCode) {
|
|
18
|
+
/** Cognitum ledger says balance is spent — the ONLY funnel trigger. */
|
|
19
|
+
CreditErrorCode["COGNITUM_CREDIT_EXHAUSTED"] = "COGNITUM_CREDIT_EXHAUSTED";
|
|
20
|
+
/** Upstream provider's own quota, not Cognitum credits. */
|
|
21
|
+
CreditErrorCode["PROVIDER_QUOTA_EXHAUSTED"] = "PROVIDER_QUOTA_EXHAUSTED";
|
|
22
|
+
CreditErrorCode["PROVIDER_RATE_LIMITED"] = "PROVIDER_RATE_LIMITED";
|
|
23
|
+
CreditErrorCode["AUTHENTICATION_FAILED"] = "AUTHENTICATION_FAILED";
|
|
24
|
+
CreditErrorCode["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
|
|
25
|
+
})(CreditErrorCode || (CreditErrorCode = {}));
|
|
26
|
+
//# sourceMappingURL=types.js.map
|