flybrain/services/bridge/src/predictions.ts
acamilo 660c3cf00d
Some checks failed
ci / node 22 (test + typecheck) (push) Has been cancelled
ci / rust stable (cargo test --workspace --release) (push) Has been cancelled
ci / infra/tests/lint.sh (push) Has been cancelled
ci / playwright apps/stage (allowed to fail) (push) Has been cancelled
flybrain v0.4.0: public tree (history retained privately)
2026-09-21 15:09:46 +00:00

32 lines
1.4 KiB
TypeScript

/**
* Predictions stub (`docs/design/stage-bridge.md` B3, item 5). **Disabled in B1.**
*
* Predictions require Twitch Affiliate status (`docs/stream-mvp-plan.md`: "Polls, Predictions,
* Hype Train still Affiliate-only"), which neither demo channel has yet, and the
* `channel:manage:predictions` scope, which is only asserted when `FEATURE_PREDICTIONS` is on
* (`src/scopes.ts`). There is no real Twitch channel to test this against in B1, so this module
* is intentionally a stub: it exists so `src/index.ts` has a stable seam to wire up later
* ("open on milestone start, resolve on rank change or timeout"), and so the feature flag has
* something concrete to gate.
*
* When this is implemented: open a prediction on milestone start ("will the fly reach X within
* 4 hours?"), resolve it on rank change or timeout, using `channel.prediction.*` EventSub events
* and `createPrediction`/`endPrediction` from `@twurple/api`.
*/
export interface PredictionsManager {
/** No-op in B1. Real implementation opens/resolves predictions on milestone events. */
start(): Promise<void>;
stop(): void;
}
export function createDisabledPredictionsManager(): PredictionsManager {
return {
async start(): Promise<void> {
// Intentionally does nothing: FEATURE_PREDICTIONS is off in B1 (see module docstring).
},
stop(): void {
// Nothing to stop.
},
};
}