Repository navigation
feat(plugins): session process plugins stay running and hear the map - #1553
Merged
Merged
Conversation
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.
Summary
Adds session process plugins, as proposed in #1518: a process plugin with
"session": truekeeps one program running between its commands, so it can ask RustGIS for things at any time and hear when the map changes. A view of the map in a window of its own, such as RustPlanetX's 3D globe, can then stay linked to the map without the MCP relay. The relay is for agents the user turns on; a plugin never starts it.The protocol, also in
docs/plugins.md› Session plugins:{"session": {"abi", "plugin", "rustgis", "lang"}}.{"command": request, "id": n}and are answered{"ok"|"error", "id": n}.{"call": {...}, "id": "any"}; the answer carries theidback. They go through the same checks as a command's, within the plugin's permissions. Between commands, an edit is an undo step of its own named after the plugin, andhost.fetchis refused, because it would make the app wait. The program can fetch for itself.{"event": "view", "view": {...}},{"event": "layers"}(added, removed, reordered, renamed, shown or hidden, restyled, transparency, fields, features, web tile layers),{"event": "selection"}and{"event": "project"}(another project opened) when they change.Left out on purpose:
windows-sysas a direct dependency, so it can follow separately. Until then, a Windows program must stop what it starts.rustgis-cliand the Python package answer between-command requests only while a command runs, and send no events.What RustPlanetX needs, from the list on #1518:
host.featuresalready answers GeoJSON in WGS 84, so no temporary file is needed.map.goToXY,select.rows,layer.visibility,layer.transparency,group.add,layer.addDataText) are commands, run withinedit. Two of them need more thanedit:map.setTilesneedsnetworkandlayer.addDataneedsfiles, the same rules as for any plugin.host.layerswith each layer's extent, opacity, group and kind, the web tile layers and the project.This adds to the plugin interface (a manifest key, gated by
minRustgisVersion), so per CONTRIBUTING it waits for a second maintainer's go-ahead before landing.Testing
cargo xtask ci, thewasm32-unknown-unknownbuild ofrustgis-web, andpre-commit run --all-files.session_plugins_keep_one_program_running: the same program answers several commands; requests between commands; events; stop and restart; tools still per run.session_plugins_that_end_or_fail_are_started_again: a quiet exit; a program it left running is stopped (fails without the fix); a crash names its last error; a hang is stopped; update and disable stop it.session_plugins_ask_between_commands_and_hear_the_map(engine): reads leave no undo step; an edit is its own step; permission refusals and thehost.fetchrefusal go back to the program; layers, view and selection events.process_manifests_are_checked:sessiononly for process plugins.UI evidence
No visible UI change.
Related issue
Part of #1518.
Summary by CodeRabbit
host.fetchis unavailable between commands.