slash

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeUnknownSlash                   = apperror.CodeSlashUnknownCommand
	CodeUnsupportedWebCommand          = apperror.CodeSlashUnsupportedInWeb
	CodeInvalidSkillSlashSyntax        = apperror.CodeSlashSkillSyntaxInvalid
	CodeRequestedSkillNotFound         = apperror.CodeSlashSkillNotFound
	CodeRequestedSkillAmbiguous        = apperror.CodeSlashSkillAmbiguous
	CodeRequestedSkillDisabled         = apperror.CodeSlashSkillDisabled
	CodeRequestedSkillNotRuntimeUsable = apperror.CodeSlashSkillNotUsable
	CodeTooManyRequestedSkills         = apperror.CodeSlashTooManySkills
	CodeRequestedSkillContextTooLarge  = apperror.CodeSlashSkillContextTooLarge
	CodeSlashAttachmentsUnsupported    = apperror.CodeSlashAttachmentsUnsupported
	CodeUnsupportedSkillSlashContext   = apperror.CodeSlashSkillActivationUnsupported
	CodeUnsupportedLegacyEndpoint      = apperror.CodeSlashRequiresWebSocket
	CodePermissionDenied               = apperror.CodeSlashPermissionDenied
	CodeReservedSkillMetadata          = apperror.CodeSlashReservedMetadata
)

Refusals of a slash request. Each is the catalog code the refusal is answered with, on the Web composer and in IM channels alike.

Variables

This section is empty.

Functions

func IsReservedMetadataKey

func IsReservedMetadataKey(key string) bool

func RejectReservedSkillMetadata

func RejectReservedSkillMetadata(metadata map[string]any) error

func RejectReservedSkillMetadataShallow

func RejectReservedSkillMetadataShallow(metadata map[string]any) error

RejectReservedSkillMetadataShallow rejects reserved keys only at the top level of a metadata map.

func RejectReservedSkillMetadataValue

func RejectReservedSkillMetadataValue(value any) error

RejectReservedSkillMetadataValue rejects reserved skill metadata keys nested anywhere inside a JSON-like metadata value.

Types

type ClassifyInput

type ClassifyInput struct {
	Text               string
	HasAttachments     bool
	Surface            Surface
	IsGroup            bool
	Directed           bool
	BotAliases         []string
	KnownCommand       func(resource string) bool
	WebActionSupported func(resource, action string) bool
}

type Command

type Command struct {
	Resource string
	Action   string
	Raw      string
}

type Decision

type Decision struct {
	Kind        DecisionKind
	Code        apperror.Code
	Directed    bool
	Command     Command
	SkillIntent SkillIntent
	Invocation  *commandsyntax.Invocation
	// AgentCommand is the exact runtime command selector a live-runtime
	// admission check matched for a NormalChat decision. Carried so the
	// session pool can re-validate it against the final runtime at prompt
	// time; empty for every other decision source.
	AgentCommand string
}

func Classify

func Classify(input ClassifyInput) Decision

type DecisionKind

type DecisionKind string
const (
	DecisionNormalChat         DecisionKind = "normal_chat"
	DecisionRejectNoop         DecisionKind = "reject_noop"
	DecisionCommandAction      DecisionKind = "command_action"
	DecisionUnsupportedCommand DecisionKind = "unsupported_command"
	DecisionSkillIntent        DecisionKind = "skill_intent"
	DecisionUnknownSlash       DecisionKind = "unknown_slash"
	DecisionReject             DecisionKind = "reject"
)

type Error

type Error struct {
	Code apperror.Code
}

Error is a slash request refused for Code. Callers in the process match it with errors.As; it unwraps to the catalog error for Code, so every boundary answers it with that code, also when it crosses an RPC.

func NewError

func NewError(code apperror.Code) Error

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap added in v0.22.0

func (e Error) Unwrap() error

type SkillIntent

type SkillIntent struct {
	Names  []string
	Prompt string
}

type Surface

type Surface string
const (
	SurfaceChannel Surface = "channel"
	SurfaceWebWS   Surface = "web_ws"
)

Jump to

Keyboard shortcuts

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