fix(cli): pass required payment url to SmallestAIEnvironment; type-guard ws - #85
Merged
Merged
Conversation
…ard ws - cli/lib/client.py: SmallestAIEnvironment now requires a payment url. The custom SMALLEST_BASE_URL branch omitted it, so make_client raised TypeError at runtime whenever SMALLEST_BASE_URL was set (dev-rig / self-host). Pass payment=base. - waves/stream_tts.py: self.ws is Optional[WebSocketApp]; capture a non-None local after connect (and assert after is_connected checks) so send/close are type-safe. Clears the mypy union-attr errors in these hand-maintained files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes in hand-maintained files (both surfaced as mypy noise; one is a real runtime bug)
1.
make_clientruntime bug (real)SmallestAIEnvironment.__init__requirespayment(*, atoms, waves, waves_ws, payment). TheSMALLEST_BASE_URLbranch incli/lib/client.pybuilt the env without it, somake_clientraisedTypeErrorat runtime whenever a user pointed the CLI at a custom endpoint (dev rig / self-host). Now passespayment=base.2.
stream_tts.pytype-safetyself.wsisOptional[WebSocketApp].send()/close()were called on it directly, tripping mypyunion-attr. Capture a non-None local after_connect()(andassertafter theis_connectedguards) so the calls are type-safe. No behavior change —_connect()already raises unless the socket opened.Clears the pre-existing mypy
union-attr/call-argerrors in these two files. mypy-clean (--follow-imports=silent).🤖 Generated with Claude Code