handlercmd

package
v1.161.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package handlercmd is the part of manage_script's input and schema the handler commands read (#2441, #2434, #2436): the commands and the ones they replaced, the kind and handler they name, a tool-call handler's settings, and handler_test, which asks every tool-call handler on a connection what it would make of a call without making it.

Index

Constants

View Source
const (
	Set     = "handler_set"
	List    = "handler_list"
	Get     = "handler_get"
	Enable  = "handler_enable"
	Disable = "handler_disable"
	Delete  = "handler_delete"
	// Test asks what every tool-call handler on a connection would make of
	// a call, without sending it (#2436).
	Test = "handler_test"
)

The handler commands (#2441, #2434): what starts a script.

Variables

Commands is every handler command, in the order the schema lists them, with form_preview, which opens an endpoint form's preview.

View Source
var Removed = map[string]string{
	"endpoint_set":     "handler_set with kind=endpoint",
	"endpoint_list":    "handler_list with kind=endpoint",
	"endpoint_enable":  "handler_enable with the handler's id",
	"endpoint_disable": "handler_disable with the handler's id",
	"schedule_set":     "handler_set with kind=schedule",
	"schedule_list":    "handler_list with kind=schedule",
	"schedule_enable":  "handler_enable with the handler's id",
	"schedule_disable": "handler_disable with the handler's id",
}

Removed are the commands the handler commands replaced, with what replaces each: a call to one is refused naming it, and none is an alias.

Functions

func Properties

func Properties() map[string]any

Properties is the schema fragment for Target and CallSettings.

func RunTest

func RunTest(ctx context.Context, admin bool, t Tester, connection string, s CallSettings) (out map[string]any, refusal string)

RunTest answers handler_test for a caller (an administrator's only): what every handler on connection makes of the call s names, or the refusal.

func Withheld

func Withheld(out map[string]any) map[string]any

Withheld is a watch's run as its owner, who is not an administrator, lists it: that it ran and how, never what it was given or wrote (#2635).

Types

type CallSettings

type CallSettings struct {
	Operations *[]string                `json:"operations,omitempty"`
	Personas   *[]string                `json:"personas,omitempty"`
	Users      *[]string                `json:"users,omitempty"`
	Conditions *[]callhandler.Condition `json:"conditions,omitempty"`
	TimeoutMS  *int                     `json:"timeout_ms,omitempty"`
	OnFailure  *string                  `json:"on_failure,omitempty"`
	ItemsPath  *string                  `json:"items_path,omitempty"`
	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"`

	// The call handler_test reads: the tool, its arguments as the caller
	// would send them, who calls (a person or a persona), when, and for a
	// transform a result to change.
	Tool      string         `json:"tool,omitempty"`
	Arguments map[string]any `json:"arguments,omitempty"`
	AsUser    string         `json:"as_user,omitempty"`
	AsPersona string         `json:"as_persona,omitempty"`
	At        string         `json:"at,omitempty"`
	Result    any            `json:"result,omitempty"`
}

CallSettings is a tool-call handler's settings (#2436, #2634, #2635) and the call handler_test reads. Each setting is a pointer, so handler_set naming a handler changes only what it sends; a handler's connection is the connection setting endpoints share.

func (CallSettings) Patch

func (s CallSettings) Patch(connection string) callhandler.Patch

Patch is the settings s sends, as a change to a handler on connection (the connection setting endpoints share; "" leaves it).

type Target

type Target struct {
	// Kind is the kind of handler handler_set adds or changes, and the kind
	// handler_list narrows to.
	Kind string `json:"kind,omitempty"`
	// Handler is the id of the handler handler_get, handler_enable,
	// handler_disable and handler_delete act on, and the one handler_set
	// changes.
	Handler string `json:"handler,omitempty"`
}

Target is the part of manage_script's input the handler commands read beside each kind's settings.

type Tester

type Tester interface {
	Test(ctx context.Context, req callhandler.TestRequest) (map[string]any, error)
}

Tester is what handler_test asks: every handler on a connection's outcome for a call, without calling the upstream (callrun.Evaluator).

Jump to

Keyboard shortcuts

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