builtin

package
v0.0.0-...-06bc5ed Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuiltinToolDefs

func BuiltinToolDefs() []*model.BuiltinTool

BuiltinToolDefs 返回所有内置工具的数据库记录定义,用于持久化到 cl_agent_builtin_tools 表。

func NewBuiltinTools

func NewBuiltinTools(skillStore *skill.SkillStore) []tool.BaseTool

NewBuiltinTools 返回所有内置运维工具。 共 24 个工具,覆盖网络、日志、进程、磁盘、系统、服务、Shell、文件、容器、监控和 skill 管理。 skillStore 为 nil 时跳过 skill_manage 工具注册。

Types

type ContainerInspectTool

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

ContainerInspectTool 检测 Docker/Podman 容器状态。

func NewContainerInspectTool

func NewContainerInspectTool() *ContainerInspectTool

NewContainerInspectTool 创建 ContainerInspectTool 实例。 自动检测 docker/podman,优先使用 docker。

func (*ContainerInspectTool) Info

func (*ContainerInspectTool) InvokableRun

func (t *ContainerInspectTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type DFTool

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

DFTool 查看文件系统磁盘空间使用情况。

func NewDFTool

func NewDFTool() *DFTool

func (*DFTool) Info

func (t *DFTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*DFTool) InvokableRun

func (t *DFTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type DUTool

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

DUTool 查看目录磁盘占用。

func NewDUTool

func NewDUTool() *DUTool

func (*DUTool) Info

func (t *DUTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*DUTool) InvokableRun

func (t *DUTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type DmesgTool

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

DmesgTool 查看内核环形缓冲区日志。

func NewDmesgTool

func NewDmesgTool() *DmesgTool

func (*DmesgTool) Info

func (t *DmesgTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*DmesgTool) InvokableRun

func (t *DmesgTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type FileScanTool

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

FileScanTool 扫描文件和目录(支持列表、搜索、内容读取)。

func NewFileScanTool

func NewFileScanTool() *FileScanTool

NewFileScanTool 创建 FileScanTool 实例。 如果通过 SetFileServiceAndFS 注入了 FileService,优先使用它; 否则回退到 find/ls 等 shell 命令。

func (*FileScanTool) Info

func (*FileScanTool) InvokableRun

func (t *FileScanTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type FreeTool

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

FreeTool 查看内存和交换空间使用情况。

func NewFreeTool

func NewFreeTool() *FreeTool

func (*FreeTool) Info

func (t *FreeTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*FreeTool) InvokableRun

func (t *FreeTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type IOStatTool

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

IOStatTool 查看磁盘 I/O 统计。

func NewIOStatTool

func NewIOStatTool() *IOStatTool

func (*IOStatTool) Info

func (t *IOStatTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*IOStatTool) InvokableRun

func (t *IOStatTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type JournalctlTool

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

JournalctlTool 查询 systemd 日志。

func NewJournalctlTool

func NewJournalctlTool() *JournalctlTool

func (*JournalctlTool) Info

func (*JournalctlTool) InvokableRun

func (t *JournalctlTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type LsofTool

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

LsofTool 列出打开的文件和网络连接。

func NewLsofTool

func NewLsofTool() *LsofTool

func (*LsofTool) Info

func (t *LsofTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*LsofTool) InvokableRun

func (t *LsofTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type NetstatTool

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

NetstatTool 网络连接、路由表、接口统计。

func NewNetstatTool

func NewNetstatTool() *NetstatTool

func (*NetstatTool) Info

func (*NetstatTool) InvokableRun

func (t *NetstatTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type PSTool

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

PSTool 列出系统进程(按内存排序)。

func NewPSTool

func NewPSTool() *PSTool

func (*PSTool) Info

func (t *PSTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*PSTool) InvokableRun

func (t *PSTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type PgrepTool

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

PgrepTool 按名称查找进程。

func NewPgrepTool

func NewPgrepTool() *PgrepTool

func (*PgrepTool) Info

func (t *PgrepTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*PgrepTool) InvokableRun

func (t *PgrepTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type PrometheusQueryTool

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

PrometheusQueryTool 通过 HTTP API 查询 Prometheus 指标。

func NewPrometheusQueryTool

func NewPrometheusQueryTool() *PrometheusQueryTool

NewPrometheusQueryTool 创建 PrometheusQueryTool 实例。

func (*PrometheusQueryTool) Info

func (*PrometheusQueryTool) InvokableRun

func (t *PrometheusQueryTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type SSTool

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

SSTool 查看套接字统计信息。

func NewSSTool

func NewSSTool() *SSTool

func (*SSTool) Info

func (t *SSTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*SSTool) InvokableRun

func (t *SSTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type ShellExecTool

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

ShellExecTool 执行用户指定的任意 Shell 命令。

func NewShellExecTool

func NewShellExecTool() *ShellExecTool

NewShellExecTool 创建 ShellExecTool 实例。

func (*ShellExecTool) Info

func (*ShellExecTool) InvokableRun

func (t *ShellExecTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type ShellSuggestTool

type ShellSuggestTool struct{}

ShellSuggestTool 返回终端命令建议但不执行,用于安全的命令推荐。

func NewShellSuggestTool

func NewShellSuggestTool() *ShellSuggestTool

NewShellSuggestTool 创建 ShellSuggestTool 实例。

func (*ShellSuggestTool) Info

func (*ShellSuggestTool) InvokableRun

func (t *ShellSuggestTool) InvokableRun(_ context.Context, argsJSON string, _ ...tool.Option) (string, error)

type SystemInspectTool

type SystemInspectTool struct{}

SystemInspectTool 查看当前系统运行时信息(hostname/os/arch/pid)。

func NewSystemInspectTool

func NewSystemInspectTool() *SystemInspectTool

NewSystemInspectTool 创建 SystemInspectTool 实例。

func (*SystemInspectTool) Info

func (*SystemInspectTool) InvokableRun

func (t *SystemInspectTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type SystemctlTool

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

SystemctlTool systemd 服务管理。

func NewSystemctlTool

func NewSystemctlTool() *SystemctlTool

func (*SystemctlTool) Info

func (*SystemctlTool) InvokableRun

func (t *SystemctlTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type TailTool

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

TailTool 追踪日志文件末尾内容。

func NewTailTool

func NewTailTool() *TailTool

func (*TailTool) Info

func (t *TailTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*TailTool) InvokableRun

func (t *TailTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type TopTool

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

TopTool 获取进程资源占用快照(非交互模式)。

func NewTopTool

func NewTopTool() *TopTool

func (*TopTool) Info

func (t *TopTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*TopTool) InvokableRun

func (t *TopTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type UnameTool

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

UnameTool 查看系统信息。

func NewUnameTool

func NewUnameTool() *UnameTool

func (*UnameTool) Info

func (t *UnameTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*UnameTool) InvokableRun

func (t *UnameTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type UptimeTool

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

UptimeTool 查看系统运行时间和负载。

func NewUptimeTool

func NewUptimeTool() *UptimeTool

func (*UptimeTool) Info

func (t *UptimeTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*UptimeTool) InvokableRun

func (t *UptimeTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

type VMStatTool

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

VMStatTool 查看虚拟内存、CPU 和 I/O 统计。

func NewVMStatTool

func NewVMStatTool() *VMStatTool

func (*VMStatTool) Info

func (t *VMStatTool) Info(_ context.Context) (*schema.ToolInfo, error)

func (*VMStatTool) InvokableRun

func (t *VMStatTool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

Jump to

Keyboard shortcuts

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