toolplugin

package
v1.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package toolplugin is the plugin side of tool plugins: ServeTool turns an ordinary tool.Module (the same Register func a built-in tool uses) into a binary that serves HTTP on the unix socket the host names, while the host reverse-proxies /tools/{key}/* to it and wraps page fragments in wick's layout.

It lives apart from pkg/plugin so connector binaries, which import pkg/plugin, do not link pkg/tool and its templ render stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(mod tool.Module, cfg map[string]string) http.Handler

Handler returns the plugin's HTTP handler for mod without serving it — for tests and local harnesses. cfg seeds the config store.

func Host added in v1.16.0

func Host(ctx context.Context) (host.Host, error)

Host returns wick's Host API for this tool plugin (see wickplugin.Host). Pass the request context so user-level calls run for the person behind the request; host.ErrHostAPIUnavailable means an older wick.

func Manifest

func Manifest(mod tool.Module, opts ...Option) wickplugin.ToolModule

Manifest returns the tool half of mod's manifest (routes are registered to discover the webhooks).

func ServeTool

func ServeTool(mod tool.Module, opts ...Option)

ServeTool is the entire main() of a tool plugin binary. With --dump-manifest it prints the kind=tool manifest and exits; otherwise it serves HTTP on $WICK_PLUGIN_SOCKET plus the Tool control service until the host kills it.

func TokenUserFromHeaders added in v1.16.0

func TokenUserFromHeaders(r *http.Request) (tool.User, bool)

TokenUserFromHeaders reads who a webhook request authenticated as, as the host verified and injected it: the owner of a wick PAT, a user behind wick's SSO JWT, or wick itself (ID tool.SystemUserID). User.Source says which; a host too old to send the source header only injected PAT owners, so an absent source reads as tool.TokenSourcePAT. ok is false when the request carried no credential the host could verify.

func UserFromHeaders

func UserFromHeaders(r *http.Request) (tool.User, bool)

UserFromHeaders reads the signed-in user the host injected. ok is false when the request carries no session (webhooks, public tools).

Types

type Option

type Option func(*wickplugin.ToolModule)

Option tunes a tool plugin's manifest.

func KeepWarm

func KeepWarm() Option

KeepWarm marks the tool to stay running instead of being idle-killed. Use it for tools whose webhook must answer within a few seconds.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL