Documentation
¶
Index ¶
- Constants
- func BuildSystemContext() string
- func DevOps(ctx context.Context, cfg *config.UserConfig, userInput string) error
- func GenCMD(ctx context.Context, cfg *config.UserConfig, userInput string) error
- func LoadAgentPrompt(name string, customContent config.CustomPrompt) (string, error)
- func QA(ctx context.Context, cfg *config.UserConfig, userInput string) error
- func TruncateOutput(s string, max int) string
- type ActionType
- type AgentResponse
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 LoadAgentPrompt ¶ added in v0.2.6
func LoadAgentPrompt(name string, customContent config.CustomPrompt) (string, error)
func TruncateOutput ¶
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.
Click to show internal directories.
Click to hide internal directories.