From fbd20ad6e488fb3b9efc1612fdffee6e672976c1 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sun, 14 Jun 2026 02:43:45 +0300 Subject: feat: add plugin v1 system Add manifest-driven plugin actions, event hooks, pane entrypoints, link handlers, and host APIs. Support plugin link, GitHub install, build commands, installed plugin registry, pane movement, runtime context, and plugin docs. --- AGENTS.md | 9 + docs/next/CHANGELOG.md | 10 + .../website/src/content/docs/cli-reference.mdx | 81 +- .../website/src/content/docs/configuration.mdx | 11 + docs/next/website/src/content/docs/index.mdx | 10 + docs/next/website/src/content/docs/marketplace.mdx | 36 + docs/next/website/src/content/docs/plugins.mdx | 189 ++ docs/next/website/src/content/docs/socket-api.mdx | 247 +- src/api/mod.rs | 5 + src/api/schema.rs | 1534 +---------- src/api/schema/agents.rs | 87 + src/api/schema/common.rs | 128 + src/api/schema/events.rs | 474 ++++ src/api/schema/integrations.rs | 38 + src/api/schema/panes.rs | 110 +- src/api/schema/plugins.rs | 343 +++ src/api/schema/response.rs | 248 ++ src/api/schema/server.rs | 19 + src/api/schema/tabs.rs | 42 + src/api/schema/tests.rs | 975 +++++++ src/api/schema/workspaces.rs | 46 + src/api/schema/worktrees.rs | 74 + src/api/server.rs | 17 + src/api/subscriptions.rs | 12 + src/app/actions.rs | 75 +- src/app/agent_resume.rs | 9 +- src/app/agents.rs | 12 +- src/app/api.rs | 166 +- src/app/api/agents.rs | 6 +- src/app/api/env.rs | 61 + src/app/api/layouts.rs | 758 ++++++ src/app/api/panes.rs | 386 ++- src/app/api/plugins/context.rs | 379 +++ src/app/api/plugins/env.rs | 19 + src/app/api/plugins/manifest.rs | 539 ++++ src/app/api/plugins/mod.rs | 2704 ++++++++++++++++++++ src/app/api/plugins/panes.rs | 284 ++ src/app/api/plugins/runtime.rs | 271 ++ src/app/api/tabs.rs | 16 + src/app/api/workspaces.rs | 59 +- src/app/api/worktrees.rs | 114 +- src/app/creation.rs | 13 +- src/app/ids.rs | 20 + src/app/input/mod.rs | 12 +- src/app/input/navigate.rs | 91 +- src/app/mod.rs | 37 +- src/app/state.rs | 22 + src/cli.rs | 75 +- src/cli/agent.rs | 25 +- src/cli/pane.rs | 118 +- src/cli/plugin.rs | 1694 ++++++++++++ src/cli/tab.rs | 21 +- src/cli/workspace.rs | 27 +- src/client/mod.rs | 26 + src/config/keybinds.rs | 3 + src/detect/manifest/tests.rs | 24 +- src/detect/manifest_update.rs | 16 +- src/events.rs | 9 + src/integration/mod.rs | 16 +- src/pane.rs | 80 +- src/persist.rs | 2 + src/persist/plugin_registry.rs | 237 ++ src/persist/restore.rs | 24 +- src/protocol/wire.rs | 19 +- src/server/headless.rs | 67 +- src/server/notifications.rs | 2 +- src/terminal/runtime.rs | 22 +- src/ui/mobile.rs | 2 +- src/ui/sidebar.rs | 2 +- src/workspace.rs | 222 +- src/workspace/tab.rs | 111 +- tests/api_ping.rs | 4 +- tests/cli_wrapper.rs | 972 +++++++ tests/fixtures/plugin-smoke/herdr-plugin.toml | 21 + 74 files changed, 12925 insertions(+), 1714 deletions(-) create mode 100644 docs/next/website/src/content/docs/marketplace.mdx create mode 100644 docs/next/website/src/content/docs/plugins.mdx create mode 100644 src/api/schema/agents.rs create mode 100644 src/api/schema/common.rs create mode 100644 src/api/schema/events.rs create mode 100644 src/api/schema/integrations.rs create mode 100644 src/api/schema/plugins.rs create mode 100644 src/api/schema/response.rs create mode 100644 src/api/schema/server.rs create mode 100644 src/api/schema/tabs.rs create mode 100644 src/api/schema/tests.rs create mode 100644 src/api/schema/workspaces.rs create mode 100644 src/api/schema/worktrees.rs create mode 100644 src/app/api/env.rs create mode 100644 src/app/api/layouts.rs create mode 100644 src/app/api/plugins/context.rs create mode 100644 src/app/api/plugins/env.rs create mode 100644 src/app/api/plugins/manifest.rs create mode 100644 src/app/api/plugins/mod.rs create mode 100644 src/app/api/plugins/panes.rs create mode 100644 src/app/api/plugins/runtime.rs create mode 100644 src/cli/plugin.rs create mode 100644 src/persist/plugin_registry.rs create mode 100644 tests/fixtures/plugin-smoke/herdr-plugin.toml diff --git a/AGENTS.md b/AGENTS.md index f04fbed5..2d81c48e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,6 +49,15 @@ Run `just check` before committing unless Can explicitly accepts narrower valida Unit tests live next to the code (`#[cfg(test)] mod tests`). New `AppState` or `Workspace` behavior should be testable with `AppState::test_new()` and `Workspace::test_new()` without PTYs. +When testing a new Herdr build from inside an existing Herdr session, use +`cargo run -- ...` and clear inherited Herdr socket overrides so the debug +binary talks to the debug `herdr-dev` server instead of the installed stable +server: + +```bash +env -u HERDR_SOCKET_PATH -u HERDR_CLIENT_SOCKET_PATH cargo run -- +``` + ## Agent Detection Updates Agent detection changes should use the manifest hot-reload loop. Can drives the real agent UI into the target state, then you read the pane with `herdr agent read --source detection --format text` and inspect matching with `herdr agent explain --json`. Update the bundled manifest in `src/detect/manifests/.toml`, copy that manifest to the local override path at `~/.config/herdr/agent-detection/.toml`, then run `herdr server reload-agent-manifests`. Can verifies the live pane state, and once the rule is correct, remove the local override so the committed bundled manifest remains the source of truth. diff --git a/docs/next/CHANGELOG.md b/docs/next/CHANGELOG.md index c4271cf6..13e84347 100644 --- a/docs/next/CHANGELOG.md +++ b/docs/next/CHANGELOG.md @@ -3,6 +3,16 @@ ## Unreleased ### Added +- Added local plugin v1 support with `plugin.link/list/unlink/enable/disable`, + manifest-declared actions, event hooks, managed plugin panes, link handlers, + command logs, keybinding integration, and authoring docs under Preview docs. +- Added `herdr plugin install /[/subdir...]`, `plugin uninstall`, + source metadata in `plugin.list`, offline registry fallback, and a + human-readable default `plugin list` with `--json` for scripts. +- Added supporting plugin host APIs for `pane.current`, `pane.process_info`, + `client.window_title.set/clear`, `layout.export/apply`, plugin pane placement, + plugin invocation context/env injection, and plugin pane ownership across + `pane.move`. - Added `pane.move` and `herdr pane move` to relocate a running pane into another tab, a new tab, or a new workspace without restarting its terminal process. (#299) ### Changed diff --git a/docs/next/website/src/content/docs/cli-reference.mdx b/docs/next/website/src/content/docs/cli-reference.mdx index fc6be710..106823b3 100644 --- a/docs/next/website/src/content/docs/cli-reference.mdx +++ b/docs/next/website/src/content/docs/cli-reference.mdx @@ -69,7 +69,7 @@ Use `default` as the session name when you need to stop the default session expl ```bash herdr workspace list -herdr workspace create [--cwd PATH] [--label TEXT] [--focus] [--no-focus] +herdr workspace create [--cwd PATH] [--label TEXT] [--env KEY=VALUE] [--focus] [--no-focus] herdr workspace get herdr workspace focus herdr workspace rename