shells

package
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package shells finds the processes the hosted agents started: the shells Claude Code runs commands in, and the servers they leave listening. Each agent runs under a small sh whose command line names it (see Wrap), and the process tree under it tells which agent a shell belongs to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEtime

func ParseEtime(s string) (time.Duration, error)

ParseEtime parses ps's elapsed time, [[dd-]hh:]mm:ss.

func Stop

func Stop(ctx context.Context, pid int) error

Stop ends a shell and everything it started: SIGTERM to the tree, children first, then SIGKILL to whatever is left after a grace period.

func Tail

func Tail(path string, max int64) (string, error)

Tail returns the last max bytes of path, starting at a line.

func Wrap

func Wrap(handle string, argv []string) []string

Wrap returns argv run under a sh that stays in the process tree with the agent's handle on its command line, so Scan can tell whose shells are whose. Stdio and signals pass through; the sh exits with the agent.

Types

type Shell

type Shell struct {
	PID     int
	Agent   string // the agent's handle
	Command string // what the agent asked to run
	Kind    string // "shell", or "server" for a process listening on a port
	Cwd     string
	Started time.Time
	Ports   []int  // TCP ports the shell or its children listen on
	Out     string // the file its output goes to, if it is a file
	Procs   int    // processes in its tree, itself included
}

Shell is a command an agent runs.

func Scan

func Scan(ctx context.Context, root int) ([]Shell, error)

Scan lists the shells of the agents that are children of root (see Wrap).

Jump to

Keyboard shortcuts

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