Reference Implementation
Production Python reference. The same code paths run inside Bluewave’s tenants. MIT.
These files are sanitised public mirrors of the in-repo modules — domain-specific labels (PT-BR copy, internal logger names, branded fallback voice) are translated to English so the implementation reads as a neutral reference, not a Bluewave-only artefact.
ssl_parser.py
Parser for the SSL grammar (v5). Tokenises a .ssl file into typed blocks, validates against the spec rules in docs/, raises typed SSLError on violation. Pure Python, no third-party deps.
ssl_runtime.py
The system-prompt builder. Takes (agent_ssl_name, tenant_id, principal) and returns a fully-composed system prompt by:
- Resolving the tenant-override SSL → neutral fallback → legacy fallback chain
- Loading the tenant runtime context (
onboarding.json,knowledge_base.md) - Sanitising tenant-supplied fields against prompt injection (path traversal + control chars +
@blocknameimpersonation all neutralised) - Composing into the final compiled prompt
This is the canonical entry point. Most consumers only call build_agent_prompt() from this module.
ssl_linter.py
Static analysis for .ssl files. Catches missing required blocks, undefined references, voice-attractor distribution out of range, scope rules referencing undeclared resources, etc. Run before deploying any new SSL to production.
ssl_registry.py
The discovery layer. Walks tenants/<uuid>/agents/*.ssl plus the shared neutral directory, returns a typed registry of available agents per tenant with their resolution path. Used at boot to validate the SSL fleet is well-formed before any traffic hits the runtime.
migrate_v4_to_v5.py
One-shot migration script for SSL files written against the v4 grammar. Converts indentation-based blocks to v5 brace syntax, lifts @extends declarations, normalises voice attractor scales. Idempotent — runs cleanly on already-v5 files (no-op).