[PR #20] [MERGED] feat(external-plugins): add external plugin system for standalone binary plugins #21

Closed
opened 2026-03-02 05:12:34 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/gotempsh/temps/pull/20
Author: @dviejokfs
Created: 2/26/2026
Status: Merged
Merged: 2/27/2026
Merged by: @dviejokfs

Base: mainHead: feat/external-plugins-impl


📝 Commits (3)

  • 41f11c3 feat(plugins): implement external plugin system for dynamic integration
  • 7b31dad feat(external-plugins): add external plugin management system
  • 194b79e docs(changelog): add external plugin system entries

📊 Changes

39 files changed (+2683 additions, -20 deletions)

View changed files

📝 CHANGELOG.md (+7 -0)
📝 Cargo.lock (+71 -0)
📝 Cargo.toml (+3 -0)
_typos.toml (+3 -0)
📝 crates/temps-cli/Cargo.toml (+1 -0)
📝 crates/temps-cli/src/commands/proxy.rs (+2 -1)
📝 crates/temps-cli/src/commands/serve/console.rs (+27 -3)
📝 crates/temps-cli/src/commands/serve/mod.rs (+7 -5)
📝 crates/temps-core/Cargo.toml (+3 -0)
crates/temps-core/src/external_plugin/manifest.rs (+228 -0)
crates/temps-core/src/external_plugin/mod.rs (+16 -0)
📝 crates/temps-core/src/lib.rs (+1 -0)
📝 crates/temps-deployments/src/jobs/deploy_image.rs (+15 -5)
crates/temps-external-plugins/Cargo.toml (+24 -0)
crates/temps-external-plugins/src/handler.rs (+87 -0)
crates/temps-external-plugins/src/lib.rs (+17 -0)
crates/temps-external-plugins/src/manager.rs (+456 -0)
crates/temps-external-plugins/src/plugin.rs (+118 -0)
crates/temps-external-plugins/src/proxy.rs (+155 -0)
crates/temps-external-plugins/src/service.rs (+83 -0)

...and 19 more files

📄 Description

Summary

Implements a complete external plugin architecture for Temps where users can drop a compiled binary into ~/.temps/plugins/ and have it automatically discovered, started, and integrated with both API endpoints and UI navigation.

Closes #19

Changes

New Crates

  • temps-external-plugins — Discovery, lifecycle management, HTTP proxying, and REST API handler following the standard TempsPlugin pattern. Includes service layer, handler with OpenAPI schema, and plugin registration.
  • temps-plugin-sdk — SDK for plugin authors: ExternalPlugin trait, main!() macro, PluginContext (DB access, data dir), TempsAuth extractor, runtime with stdout handshake + hyper-over-Unix-socket serving.

Core Changes

  • temps-core — Added external_plugin::manifest module with shared types (PluginManifest, NavEntry, NavSection, UiManifest, UiRoute, HandshakeMessage) with Serialize/Deserialize/ToSchema derives. Removed unused deps (reqwest, hyper, hyper-util, flate2, tar).
  • temps-cli — Registered ExternalPluginsPlugin as plugin #15 (before initialize_plugins). Added graceful shutdown that stops external plugins on Ctrl+C via service context lookup.

Frontend

  • usePlugins hook — React Query with graceful degradation (returns [] on failure, no retry)
  • PluginsContext — Provider exposing platformNavEntries, settingsNavEntries, projectNavEntries
  • Dynamic nav entries in Sidebar, ProjectDetailSidebar, and CommandPalette
  • Generic PluginPage component at /plugins/:pluginName/*
  • TypeScript types matching Rust manifest, Lucide icon resolver

Example

  • examples/example-plugin/ — "Cron Jobs" plugin demonstrating full CRUD API with the SDK

Architecture

Plugin Binary (temps-plugin-sdk)
    stdout → { manifest } → { ready }
    serves HTTP on Unix socket
        ↕
Temps (temps-external-plugins)
    discovers binaries in ~/.temps/plugins/
    spawns, handshakes, health-checks
    reverse-proxies /api/x/{name}/* → Unix socket
    serves /api/x/plugins (manifest listing)
        ↕
Frontend
    fetches /api/x/plugins
    renders dynamic nav entries + plugin pages

Test Results

  • temps-external-plugins: 7 tests passed (manager, proxy, handler, plugin)
  • temps-core external_plugin: 3 tests passed (manifest builder, serialization, roundtrip)
  • temps-plugin-sdk: 2 tests passed (health handler, user context serialization)
  • Full workspace cargo check --lib: zero errors, zero warnings
  • Frontend bun run build: success

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/gotempsh/temps/pull/20 **Author:** [@dviejokfs](https://github.com/dviejokfs) **Created:** 2/26/2026 **Status:** ✅ Merged **Merged:** 2/27/2026 **Merged by:** [@dviejokfs](https://github.com/dviejokfs) **Base:** `main` ← **Head:** `feat/external-plugins-impl` --- ### 📝 Commits (3) - [`41f11c3`](https://github.com/gotempsh/temps/commit/41f11c303a3843f4d8dfa0b28eba6e3ea7313632) feat(plugins): implement external plugin system for dynamic integration - [`7b31dad`](https://github.com/gotempsh/temps/commit/7b31dadc7afdfe8d82da59770f79bd7747b9270e) feat(external-plugins): add external plugin management system - [`194b79e`](https://github.com/gotempsh/temps/commit/194b79ee756697d755090fe657d35c30be4a5c75) docs(changelog): add external plugin system entries ### 📊 Changes **39 files changed** (+2683 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+7 -0) 📝 `Cargo.lock` (+71 -0) 📝 `Cargo.toml` (+3 -0) ➕ `_typos.toml` (+3 -0) 📝 `crates/temps-cli/Cargo.toml` (+1 -0) 📝 `crates/temps-cli/src/commands/proxy.rs` (+2 -1) 📝 `crates/temps-cli/src/commands/serve/console.rs` (+27 -3) 📝 `crates/temps-cli/src/commands/serve/mod.rs` (+7 -5) 📝 `crates/temps-core/Cargo.toml` (+3 -0) ➕ `crates/temps-core/src/external_plugin/manifest.rs` (+228 -0) ➕ `crates/temps-core/src/external_plugin/mod.rs` (+16 -0) 📝 `crates/temps-core/src/lib.rs` (+1 -0) 📝 `crates/temps-deployments/src/jobs/deploy_image.rs` (+15 -5) ➕ `crates/temps-external-plugins/Cargo.toml` (+24 -0) ➕ `crates/temps-external-plugins/src/handler.rs` (+87 -0) ➕ `crates/temps-external-plugins/src/lib.rs` (+17 -0) ➕ `crates/temps-external-plugins/src/manager.rs` (+456 -0) ➕ `crates/temps-external-plugins/src/plugin.rs` (+118 -0) ➕ `crates/temps-external-plugins/src/proxy.rs` (+155 -0) ➕ `crates/temps-external-plugins/src/service.rs` (+83 -0) _...and 19 more files_ </details> ### 📄 Description ## Summary Implements a complete external plugin architecture for Temps where users can drop a compiled binary into `~/.temps/plugins/` and have it automatically discovered, started, and integrated with both API endpoints and UI navigation. Closes #19 ## Changes ### New Crates - **`temps-external-plugins`** — Discovery, lifecycle management, HTTP proxying, and REST API handler following the standard `TempsPlugin` pattern. Includes service layer, handler with OpenAPI schema, and plugin registration. - **`temps-plugin-sdk`** — SDK for plugin authors: `ExternalPlugin` trait, `main!()` macro, `PluginContext` (DB access, data dir), `TempsAuth` extractor, runtime with stdout handshake + hyper-over-Unix-socket serving. ### Core Changes - **`temps-core`** — Added `external_plugin::manifest` module with shared types (`PluginManifest`, `NavEntry`, `NavSection`, `UiManifest`, `UiRoute`, `HandshakeMessage`) with `Serialize`/`Deserialize`/`ToSchema` derives. Removed unused deps (`reqwest`, `hyper`, `hyper-util`, `flate2`, `tar`). - **`temps-cli`** — Registered `ExternalPluginsPlugin` as plugin #15 (before `initialize_plugins`). Added graceful shutdown that stops external plugins on Ctrl+C via service context lookup. ### Frontend - `usePlugins` hook — React Query with graceful degradation (returns `[]` on failure, no retry) - `PluginsContext` — Provider exposing `platformNavEntries`, `settingsNavEntries`, `projectNavEntries` - Dynamic nav entries in Sidebar, ProjectDetailSidebar, and CommandPalette - Generic `PluginPage` component at `/plugins/:pluginName/*` - TypeScript types matching Rust manifest, Lucide icon resolver ### Example - **`examples/example-plugin/`** — "Cron Jobs" plugin demonstrating full CRUD API with the SDK ## Architecture ``` Plugin Binary (temps-plugin-sdk) stdout → { manifest } → { ready } serves HTTP on Unix socket ↕ Temps (temps-external-plugins) discovers binaries in ~/.temps/plugins/ spawns, handshakes, health-checks reverse-proxies /api/x/{name}/* → Unix socket serves /api/x/plugins (manifest listing) ↕ Frontend fetches /api/x/plugins renders dynamic nav entries + plugin pages ``` ## Test Results - `temps-external-plugins`: 7 tests passed (manager, proxy, handler, plugin) - `temps-core` external_plugin: 3 tests passed (manifest builder, serialization, roundtrip) - `temps-plugin-sdk`: 2 tests passed (health handler, user context serialization) - Full workspace `cargo check --lib`: zero errors, zero warnings - Frontend `bun run build`: success --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 05:12:34 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/temps#21
No description provided.