Repository navigation
Hooks are methods of Plugin subclasses - #25
Merged
Merged
Conversation
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.
A hook file now defines one or more
Pluginsubclasses, and the five hooks are its methods. Each hook has a default that passes its input on, so a plugin overrides only the ones it needs.Breaking change
Module-level
on_*functions are no longer hooks. There is no adapter and no warning: a file that only has them loads and does nothing. Existing hook files need porting to aPluginsubclass.What changed
kikupackage: a hook file importsPluginandwrite_logfromkiku, a small package shipped in the same distribution askiku_sidecar.kiku_sidecarstays the server's internals.load_pluginsreplacesload_hooks. It makes one instance of everyPluginsubclass a file defines, in definition order, with files in filename order. Imported classes are skipped, and a class bound to two names is made once.fire,fire_done,hook_messageandreporttake the flat list of plugins. TheHooksdict type andPOINTSare gone, andfireaccepts only the three text hook names.docs/hooks.mdand the hook files inexamples/are ported, with@overrideon each hook. Each recipe's plugin class has a one-line docstring, and the hooks inexamples/keep theirs. State moves fromglobaltoself.examples/.translate_ja_es.py: a model reply that is not the expected JSON leaves the text as it was instead of failing the dictation.What did not change
errors.txtsuch ason_cleaned in voice.py:3.hooks/folder name and location, so the Swift app and install scripts are untouched.Review notes
translate_ja_es.py, there.splitafter the parse still raises when the language the model names is not in the text word for word. That predates this PR.Testing
From
sidecar/:ruff check,ruff format --checkandpyrightare clean, andpytestpasses 111 tests. A built wheel contains bothkiku/andkiku_sidecar/.