Documentation
¶
Overview ¶
Package exectool 把"执行一段脚本"声明为 Source:一段配置列几个工具、 各绑一种运行时(python/node/bash/sh),每个成为一个 cap://tool/<源名>/<工具名> 能力,入参只有 script + args。
执行引擎三级解析(见 runner):
tool.sandbox 指定 → 用注册的 Sandbox(docker/远程/WASM) 否则 tool.command → exec 该命令(命令里可包一层沙箱,如 docker/firejail) 否则 → 内置模板(python3 -c / node -e / bash -c / sh -c),宿主直跑
能力默认 Risk=Dangerous(跑代码),不入目录除非 catalog.max_risk: dangerous。 **框架不含任何沙箱实现**——隔离交给部署(容器/VM 里跑,或 command/sandbox 包一层)。非零退出/超时作结果回传,不返 error,让大脑看到报错自行调整。
tools:
- name: exec
type: exec
config:
timeout: 30s
tools:
- {name: python, runtime: python, sandbox: docker, sandbox_config: {...}}
- {name: node, runtime: node}
- {name: bash, runtime: bash, command: ["firejail","--quiet","bash","-c"]}
- {name: sh, runtime: sh}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SourceConfig ¶
type SourceConfig struct {
Timeout string `json:"timeout"` // 命令/模板执行的墙钟兜底(如 30s),空=无
Workdir string `json:"workdir"` // 命令/模板路径的工作目录(skillpack 绑定包目录用);engine 路径由引擎自管
Tools []ToolConfig `json:"tools"`
// 装配层默认沙箱策略(app 级 exec 块注入):工具未显式配 sandbox/command
// 时回落到它;require_sandbox 时禁止回落到内置模板(宿主直跑)。
DefaultSandbox string `json:"default_sandbox"`
DefaultSandboxConf map[string]any `json:"default_sandbox_config"`
RequireSandbox bool `json:"require_sandbox"`
}
SourceConfig 声明一个 exec 源下的一批脚本执行工具。
type ToolConfig ¶
type ToolConfig struct {
Name string `json:"name"`
Runtime string `json:"runtime"` // bash | sh | python | node(决定 $0 占位与默认模板)
Description string `json:"description"` // 给模型看的说明,空=按 runtime 生成
Command []string `json:"command"` // 覆盖内置模板(命令里包沙箱);与 sandbox 互斥
Sandbox string `json:"sandbox"` // 注册的沙箱名;优先于 command/模板
SandboxConf map[string]any `json:"sandbox_config"`
Timeout string `json:"timeout"` // 覆盖源级 timeout
Risk string `json:"risk"` // 默认 dangerous
}
ToolConfig 声明一个脚本执行工具。
Click to show internal directories.
Click to hide internal directories.