9 "github.com/charmbracelet/crush/internal/shell"
13 JobKillToolName = "job_kill"
17var jobKillDescription []byte
19type JobKillParams struct {
20 ShellID string `json:"shell_id" description:"The ID of the background shell to terminate"`
23type JobKillResponseMetadata struct {
24 ShellID string `json:"shell_id"`
25 Command string `json:"command"`
26 Description string `json:"description"`
29func NewJobKillTool() fantasy.AgentTool {
30 return fantasy.NewAgentTool(
32 string(jobKillDescription),
33 func(ctx context.Context, params JobKillParams, call fantasy.ToolCall) (fantasy.ToolResponse, error) {
34 if params.ShellID == "" {
35 return fantasy.NewTextErrorResponse("missing shell_id"), nil
38 bgManager := shell.GetBackgroundShellManager()
40 bgShell, ok := bgManager.Get(params.ShellID)
42 return fantasy.NewTextErrorResponse(fmt.Sprintf("background shell not found: %s", params.ShellID)), nil
45 metadata := JobKillResponseMetadata{
46 ShellID: params.ShellID,
47 Command: bgShell.Command,
48 Description: bgShell.Description,
51 err := bgManager.Kill(params.ShellID)
53 return fantasy.NewTextErrorResponse(err.Error()), nil
56 result := fmt.Sprintf("Background shell %s terminated successfully", params.ShellID)
57 return fantasy.WithResponseMetadata(fantasy.NewTextResponse(result), metadata), nil
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list