Repository navigation
fix(script-engine): make the documented plugin globals real - #127
Merged
Merged
Conversation
…ia JS prelude Wrap the raw _x host functions so the plugin guide's ui.panel.register, ui.notify, ui.statusbar.*, ui.clipboard.copy, ui.addCommand, ssh.sessions, ssh.inject and storage.* work; wrappers throw Permission denied when the guarded bridge did not register the function. Add onNotify host callback. Correct the guide and CLAUDE.md: no JS ssh.exec or sftp global.
Merged
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.
The plugin authoring guide documented
ui.*,ssh.*andstorage.*globals that the script engine never defined. A plugin written from the guide failed at load withReferenceError: 'ui' is not defined, which is also what silently broke the old bundled Snippets JS plugin.Prelude: a JS prelude now runs before every plugin. It defines the documented globals as thin JSON wrappers over the raw
_xhost functions:ui.notify,ui.statusbar.*,ui.panel.register(withonMessage),ui.clipboard.copy,ui.addCommandssh.sessions,ssh.injectstorage.get/set/deleteThe wrappers can't bypass
PermissionGuard. A function whose permission wasn't granted throwsPermission denied: <perm> not granted. Plugins that use the raw_xAPI keep working.ui.notify: it reached nothing before, becauseUiBridgewas given no callback. It now goes to the plugin console.Guide corrections:
sftpglobal; plugins use the panel messages instead.ssh.execis not exposed, because the raw call is a stub.Tests:
plugin_api_prelude_test.dart: 6 of its 7 tests failed before the change withReferenceError; all 7 pass now.https://claude.ai/code/session_01YGAGXFNiYwvqiuiRKg25y2