notify

package
v0.260507.0-rc5 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package notify is the HTTP front end for scenario plugin events. It is intentionally thin: it parses the request, dispatches to the registered scenario plugin (via internal/remote/scenario), and maps the plugin's Outcome into HTTP responses (200 push / 202 + wait URL / 404 unknown).

All business logic — what an event "means", how to render a prompt, how to encode a decision — lives in the plugin (see internal/remote/scenario/builtin/claudecode for the first one).

When no scenario plugin is registered for the URL parameter (or the plugin chose not to handle the event) the handler falls back to a desktop notification through pkg/notify so stock setups without IM bindings still surface hook activity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(engine *gin.Engine, handler *Handler)

RegisterRoutes registers notification hook routes

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler routes /tingly/:scenario/{notify,wait/:id} to the appropriate scenario plugin and the shared interaction registry.

func NewHandler

func NewHandler() *Handler

NewHandler creates a handler with no scenario routing — every event falls back to a desktop notification. Used by stock setups before a scenario registry is wired in.

func NewHandlerWithRouting added in v0.260507.1

func NewHandlerWithRouting(scenarios *scenario.Registry, results *interaction.Registry[interaction.Result], runtime scenario.Runtime) *Handler

NewHandlerWithRouting wires the handler to a scenario registry, the shared interaction.Registry (used by Wait), and a runtime that exposes channels + bindings to plugins.

func (*Handler) Notify

func (h *Handler) Notify(c *gin.Context)

Notify handles POST /tingly/:scenario/notify.

200: scenario plugin handled the event as a push (no reply expected).
202: scenario plugin started an interactive flow; client polls wait_url.
200 + desktop fallback: no plugin (or plugin declined to handle).

func (*Handler) Wait added in v0.260507.1

func (h *Handler) Wait(c *gin.Context)

Wait handles GET /tingly/:scenario/wait/:request_id?timeout=45s. Maps interaction.Result.Status to HTTP shape:

200 answered  — final decision available
200 cancelled — user cancelled
410 timeout   — fallback decision (policy on_timeout)
504 pending   — long-poll timed out without an answer; client retries
404 expired   — id is unknown / evicted

Jump to

Keyboard shortcuts

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