softcmd

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const BASH = "bash"

A unique name for bash (the shell)

View Source
const GOLANG = "go"

A unique name for bash (the shell)

View Source
const PYTHON = "python"

A unique name for bash (the shell)

View Source
const RETURN = "return"

A unique name for return command

Variables

This section is empty.

Functions

func CodeBlock

func CodeBlock(tool string, str string) (string, error)

Types

type Arg

type Arg struct {
	Name  string `json:"-"`
	Type  string `json:"type"`
	About string `json:"description"`
}

type Cmd

type Cmd struct {
	// [Required] A unique name for the command, used as a reference by LLMs (e.g., "bash").
	Cmd string

	// [Required] A description of the command and its purpose.
	// Used to define the command registry for LLMs.
	About string

	// [Required] Concise instructions on the command's syntax.
	// For example: "bash <command>".
	Syntax string

	// The actual command execution function, which can be defined statically or
	// dynamically upon registration.
	Run func(*chatter.Reply) (float64, CmdOut, error)
}

A Command defines an external tool or utility available to the agent for task-solving. To ensure usability, each command must include a usage definition and description.

func Bash

func Bash(os, dir string) Cmd

Create new bash command, defining the os variant and working dir

func Golang

func Golang(gopath string) Cmd

Create new Golang command, defining goroot

func Python

func Python(dir string) Cmd

Create new python command, defining working dir

func Return

func Return() Cmd

Creates new return command, instructing LLM return results

func (Cmd) IsValid

func (cmd Cmd) IsValid() bool

type CmdOne

type CmdOne struct{}

The cmd (command) reasoner set the goal for agent to execute a single command. It returns right after the command return results.

func NewReasonerCmd

func NewReasonerCmd() *CmdOne

Creates new command reasoner.

func (*CmdOne) Deduct

func (task *CmdOne) Deduct(state StateCmd) (thinker.Phase, chatter.Message, error)

func (*CmdOne) Purge

func (task *CmdOne) Purge()

type CmdOut

type CmdOut struct {
	// A unique name of the command, used to getnerate output.
	Cmd string

	// Output of the command.
	Output string
}

Container for command results.

type CmdSeq

type CmdSeq struct{}

The sequence of cmd (commands) reasoner set the goal for agent to execute a sequence of commands. The reason returns only after LLM uses return command.

func NewReasonerCmdSeq

func NewReasonerCmdSeq() *CmdSeq

func (*CmdSeq) Deduct

func (task *CmdSeq) Deduct(state StateCmd) (thinker.Phase, chatter.Message, error)

func (*CmdSeq) Purge

func (task *CmdSeq) Purge()

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

The command registry, used by the application to define available tools and commands for workflows. It automates the advertisement of registered commands and their usage rules.

func NewRegistry

func NewRegistry() *Registry

Creates new command registry.

func (*Registry) Decode

func (r *Registry) Decode(reply *chatter.Reply) (float64, CmdOut, error)

Transform LLM response into the command invokation, returns the result of command.

func (*Registry) Harden

func (r *Registry) Harden(prompt *chatter.Prompt)

Injects requirments for LLM about available tooling

func (*Registry) Register

func (r *Registry) Register(cmd Cmd) error

Register new command

type StateCmd

type StateCmd = thinker.State[CmdOut]

State of Command reasoner

Jump to

Keyboard shortcuts

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