Documentation
¶
Overview ¶
Package handlerhttp serves a managed script's handlers on the portal (#2441, #2434, #2435): what starts the script (its endpoints, schedules and webhook sources), each added, changed, turned on and off and deleted by its id, and Admin > Handlers, every handler of every script. Every route carries its request out through internal/platform/scripthandler, the service the manage_script handler commands carry theirs out through, so the rules are the same on both surfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionHandlerList ¶
type ConnectionHandlerList struct {
// Connection is the name the connection's calls carry, the one a handler
// added from its page names (#2649): an MCP connection's connection_name
// when the path names the instance it is stored under.
Connection string `json:"connection" example:"mcptest"`
Data []map[string]any `json:"data"`
}
ConnectionHandlerList is every tool-call handler on a connection.
type Deps ¶
type Deps struct {
Handlers *scripthandler.Service
Scripts interface {
GetByID(ctx context.Context, id string) (*script.Script, error)
}
// Owned resolves the script in the path for its owner or an
// administrator, writing any refusal itself.
Owned func(w http.ResponseWriter, r *http.Request) (scriptID, actor string, ok bool)
// Caller is the request's caller, ok false when it carries none.
Caller func(r *http.Request) (c scripthandler.Caller, ok bool)
// Tester answers the test panel (#2436); nil answers that the
// deployment cannot test calls.
Tester Tester
}
Deps is what the routes need.
type FailureList ¶
type FailureList struct {
Data []callhandler.Failure `json:"data"`
}
FailureList is a tool-call handler's newest failures.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves the routes.
type HandlerList ¶
type HandlerList struct {
Data []scripthandler.Handler `json:"data"`
Total int `json:"total" example:"3"`
}
HandlerList is one page of handlers.
type OrderRequest ¶
type OrderRequest struct {
IDs []string `json:"ids"`
}
OrderRequest is the order a connection's transforms run in.
type ScriptHandlers ¶
type ScriptHandlers struct {
// Handlers are the script's handlers, each as its kind describes it,
// with its id, kind and type (the kind, or form).
Handlers []map[string]any `json:"handlers"`
// Add is each kind as adding one offers it to the caller.
Add []scripthandler.Offer `json:"add"`
// Endpoint is what adding an endpoint offers: where its page would
// answer and, for a form, the connections its submissions could be
// stored on.
Endpoint map[string]any `json:"endpoint,omitempty"`
// Sources are the webhook sources the caller may run the script for.
Sources []string `json:"sources"`
// MaxPerKind is how many handlers of one kind a script may hold.
MaxPerKind int `json:"max_per_kind" example:"20"`
}
ScriptHandlers is a script's handlers and what adding one offers.
type SetRequest ¶
type SetRequest struct {
// Kind is endpoint, schedule or webhook; a change reads it from the
// handler and may leave it out.
Kind string `json:"kind,omitempty" example:"schedule"`
epcmd.Input
// TimeoutSeconds is how long one request to an endpoint may run.
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
// Cron, Timezone and Args are a schedule's.
Cron string `json:"cron,omitempty" example:"0 7 * * 1-5"`
Timezone string `json:"timezone,omitempty" example:"America/Los_Angeles"`
Args map[string]any `json:"args,omitempty"`
// EventSource is a webhook handler's source.
EventSource string `json:"event_source,omitempty" example:"form-contact"`
// The tool-call kinds' settings (policy, transform, watch; #2436): each
// left out keeps its value on a change. Connection is the connection
// setting endpoints share.
Operations *[]string `json:"operations,omitempty"`
Personas *[]string `json:"personas,omitempty"`
Users *[]string `json:"users,omitempty"`
// Everyone applies a new handler to every caller, which an empty
// personas and users list no longer means on its own (#2650).
Everyone *bool `json:"everyone,omitempty"`
Conditions *[]callhandler.Condition `json:"conditions,omitempty"`
TimeoutMS *int `json:"timeout_ms,omitempty" example:"2000"`
OnFailure *string `json:"on_failure,omitempty" example:"hold"`
ItemsPath *string `json:"items_path,omitempty" example:"subscribers"`
Writes *map[string]bool `json:"writes,omitempty"`
Protected *[]string `json:"protected,omitempty"`
Order *int `json:"order,omitempty"`
// Approve approves the script's latest version for handlers as the
// administrator setting the handler.
Approve bool `json:"approve,omitempty"`
}
SetRequest is a handler added or changed: its kind, and that kind's settings, named as manage_script names them.
type TestRequest ¶
type TestRequest struct {
Tool string `json:"tool" example:"api_invoke_endpoint"`
Arguments map[string]any `json:"arguments,omitempty"`
AsUser string `json:"as_user,omitempty" example:"jo@example.com"`
AsPersona string `json:"as_persona,omitempty" example:"marketing"`
At string `json:"at,omitempty" example:"2026-11-13T15:40:00Z"`
Result any `json:"result,omitempty"`
}
TestRequest is a call the test panel asks about.
type Tester ¶
type Tester interface {
Test(ctx context.Context, req callhandler.TestRequest) (map[string]any, error)
}
Tester answers the test panel (callrun.Evaluator).