Repository navigation
[Plugins|SDK] Add the plugin SDK - #2073
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
surfsense_plugin_sdkinplugins/core/sdk/, with no dependencies.python -m surfsense_plugin_sdk.run <plugin-dir> <action> --inputs <file> --data <dir>loads a plugin and calls its@actionfunction with the user's inputs. An optional input left empty arrives asNone, and an undeclared or unmarked action, a missingmain.py, or one action marked twice is refused by name.secret()anddata(), SurfSense withdocument.add/list/update(typed results, provenance stamped, the app's own messages on refusal), and the internet withhttp.get/post/request: declared hosts only, every redirect checked, credentials dropped across hosts, one log line per request..pthfile runs. Calls to the app skip the user's proxy; calls to sources use it.AnyexceptResponse.json(). 37 tests run real plugin folders in their own process against stub servers; the contract tests against the real backend come with the harness.check-sdkjob to the plugin checks, the SDK's commands toAGENTS.md, and a docstring to every function in both packages.Follows #2070
High-level PR Summary
This PR introduces the plugin SDK (
surfsense_plugin_sdk) that enables SurfSense plugins to run within the app. The SDK provides a typed interface for plugins to access their context (secrets, data folders), communicate with SurfSense's API (document operations), and make HTTP requests to declared hosts. The protocol between the app and plugins uses a command-line interface where each plugin action runs in its own process. The PR also updates the manifest schema to renameentriestoactions, implements workspace-aware plugin runs, and establishes strict type-checking requirements across all plugin code.⏱️ Estimated Review Time: 30-90 minutes
💡 Review Order Suggestion
docs/proposals/plugins/01-protocol.mddocs/proposals/plugins/02-extending.mddocs/proposals/plugins/03-lifecycle.mddocs/proposals/plugins/README.mdplugins/core/manifest/surfsense_plugin_manifest/manifest.pyplugins/core/manifest/surfsense_plugin_manifest/__init__.pyplugins/core/sdk/pyproject.tomlplugins/core/sdk/surfsense_plugin_sdk/__init__.pyplugins/core/sdk/surfsense_plugin_sdk/action.pyplugins/core/sdk/surfsense_plugin_sdk/secret.pyplugins/core/sdk/surfsense_plugin_sdk/data.pyplugins/core/sdk/surfsense_plugin_sdk/run/plugin_manifest.pyplugins/core/sdk/surfsense_plugin_sdk/run/current_run.pyplugins/core/sdk/surfsense_plugin_sdk/run/load_plugin.pyplugins/core/sdk/surfsense_plugin_sdk/run/call_action.pyplugins/core/sdk/surfsense_plugin_sdk/run/__main__.pyplugins/core/sdk/surfsense_plugin_sdk/http/declared_hosts.pyplugins/core/sdk/surfsense_plugin_sdk/http/headers.pyplugins/core/sdk/surfsense_plugin_sdk/http/response.pyplugins/core/sdk/surfsense_plugin_sdk/http/redirects.pyplugins/core/sdk/surfsense_plugin_sdk/http/sending.pyplugins/core/sdk/surfsense_plugin_sdk/http/__init__.pyplugins/core/sdk/surfsense_plugin_sdk/app/context.pyplugins/core/sdk/surfsense_plugin_sdk/app/client.pyplugins/core/sdk/surfsense_plugin_sdk/app/document.pyplugins/core/sdk/tests/conftest.pyplugins/core/sdk/tests/unit/test_run_command.pyplugins/core/sdk/tests/unit/test_secret.pyplugins/core/sdk/tests/unit/test_data.pyplugins/core/sdk/tests/unit/test_http.pyplugins/core/sdk/tests/unit/test_document.pyplugins/core/sdk/tests/unit/test_public_surface.pydocs/proposals/plugins/app/01-api.mddocs/proposals/plugins/app/02-screen.mddocs/proposals/plugins/python/01-interpreter.mddocs/proposals/plugins/runtime/01-process.mddocs/proposals/plugins/sdk/01-library-and-harness.mddocs/proposals/plugins/release/02-pull-request-checks.md.github/workflows/plugins-pull-request-checks.ymlAGENTS.md