callback

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux)

Register mounts the dispatch endpoint at POST /v1/api/callbacks/dispatch.

Jump to

Keyboard shortcuts

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