agent

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const SelfAware = `
Your name is PAI (Personal Agent Inside Terminal);
You're an agent system built upon LLMs, you're developed with Golang;
`

Variables

This section is empty.

Functions

func BuildSystemContext

func BuildSystemContext() string

func DevOps

func DevOps(ctx context.Context, cfg *config.UserConfig, userInput string) error

func GenCMD

func GenCMD(ctx context.Context, cfg *config.UserConfig, userInput string) error

func LoadAgentPrompt added in v0.2.6

func LoadAgentPrompt(name string, customContent config.CustomPrompt) (string, error)

func QA

func QA(ctx context.Context, cfg *config.UserConfig, userInput string) error

func TruncateOutput

func TruncateOutput(s string, max int) string

TruncateOutput truncates a string to max bytes, appending a notice.

Types

type ActionType added in v0.2.6

type ActionType string
const (
	ActionExecute   ActionType = "execute"
	ActionAsk       ActionType = "ask"
	ActionInfo      ActionType = "info"
	ActionDone      ActionType = "done"
	ActionTerminate ActionType = "terminate"
)

ActionType values shared across all agents.

type AgentResponse added in v0.2.6

type AgentResponse struct {
	Action  ActionType      `json:"action"`
	Payload json.RawMessage `json:"payload"`
	Reason  string          `json:"reason"`
}

func ParseAgentResponse added in v0.2.6

func ParseAgentResponse(content string) (*AgentResponse, error)

func (*AgentResponse) GetPayload added in v0.2.6

func (r *AgentResponse) GetPayload() string

GetPayload decodes the JSON-encoded payload string into a plain Go string. Handles escape sequences like \n, \t correctly. Falls back to stripping surrounding quotes on decode failure.

func (*AgentResponse) Validate added in v0.2.6

func (r *AgentResponse) Validate() error

Validate checks the response conforms to the agent schema. Returns a descriptive error so it can be fed back to the AI for correction.

Jump to

Keyboard shortcuts

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