Skip to main content

Migration Guide: Streaming & Betting Integration (March 2026)

Last Updated: March 23, 2026
PRs: #1064 (Performance), #1065 (Betting Feed)

Overview

This guide covers breaking changes and migration steps for the March 2026 streaming and betting integration updates.

Breaking Changes

1. Betting Feed Authentication Required

Change: All internal betting endpoints now require authentication. Impact: Unauthenticated requests to /api/internal/bet-sync/* will receive 401 Unauthorized. Migration:
Client Code:

2. CORS Restrictions on Internal Endpoints

Change: Internal betting endpoints restrict CORS to specific origin. Impact: Cross-origin requests from non-allowed origins will receive CORS errors. Migration:
Server Response:

3. Embedded Client Origin Validation

Change: Embedded clients now validate postMessage origins against explicit allowlist. Impact: HYPERSCAPE_AUTH messages from untrusted origins are rejected. Migration:
Client Code:

4. Streaming Token in URL Hash (Not Query)

Change: Streaming tokens moved from query params to URL hash fragments. Impact: Tokens in query params are deprecated and will be removed in future versions. Migration:
Client Code:

5. Vite 8 Polyfill Changes

Change: Removed vite-plugin-node-polyfills, manual Buffer injection required. Impact: Solana and crypto libraries need manual Buffer global. Migration:
Vite Config:

6. Manual Chunk Splitting Function

Change: Vite 8 (Rolldown) requires manualChunks as function, not object. Impact: Build errors if using object-style manualChunks. Migration:

New Features

Renderer Health Monitoring

Client-Side Globals:
Usage:

Streaming Guardrails

Shared Validation (packages/shared/src/utils/rendering/streamingGuardrails.ts):
Validation Rules:
  • Agents must have valid id, name, hp, maxHp
  • hp must be in range [0, maxHp]
  • Arena positions required for COUNTDOWN and FIGHTING phases
  • Positions must not overlap (different tiles)

DuelBettingBridge

Lifecycle Management:
Configuration:

Testing

Unit Tests

Betting Feed Auth:
Betting Feed Payload:
DuelBettingBridge:
Streaming Guardrails:

Integration Tests

StreamingMode Component:
Renderer Health Derivation:

Manual Testing

1. Start Server:
2. Test Bootstrap Endpoint:
3. Test SSE Feed:
4. Check Renderer Health:

Rollback

If you need to rollback to pre-March 2026 behavior:

1. Disable Betting Feed

2. Revert to Public Polling

3. Disable Embedded Auth Validation

Note: This is NOT recommended for production. Use explicit allowlist.

Support

  • Issues: Report bugs in main Hyperscape repository
  • Documentation: See docs/streaming-betting-integration.md for detailed guide
  • API Reference: See docs/api-betting-feed.md for complete API documentation
  • Hyperbet Integration: See HyperscapeAI/hyperbet#28 for consumer-side implementation