Documentation
¶
Overview ¶
Package callback provides an HTTP handler that dispatches foreground submit events (forge custom_callback) to workspace-declared tool invocations. Mount it at POST /v1/api/callbacks/dispatch via Handler.Register (see sdk.WithCallbackDispatchHandler).
Authentication: the handler itself does not enforce auth. When mounted inside sdk.NewHandler, the outer svcauth.Protect middleware issues HTTP 401 for any /v1/ path when auth is configured and the caller is unauthenticated. The dispatch handler therefore only ever executes with either (a) auth disabled, or (b) an authenticated request — and the auth context flows into svc.Dispatch → tool invocation through r.Context() automatically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDispatchHandler ¶
func NewDispatchHandler(svc *callbacksvc.Service) http.Handler
NewDispatchHandler returns an http.Handler that accepts a JSON DispatchInput body and returns a JSON DispatchOutput. svc may be nil; requests then return 503.
When auth is configured on the outer mux, unauthenticated requests are rejected with 401 BEFORE this handler runs (see svcauth.Protect). The handler therefore focuses only on request validation + dispatch + response encoding.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler mounts the callback dispatch endpoint on an HTTP mux.
func NewHandler ¶
func NewHandler(svc *callbacksvc.Service) *Handler
NewHandler builds a Handler around a dispatch service. svc may be nil; Register still mounts the route, but requests return 503 so callers degrade gracefully when no callback service is configured for the workspace.