machine

package
v0.16.399 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 8 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 machine answers what the runtime reads from the machine itself: processes, the Claude Code session files, a tab's working folder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChildPIDs

func ChildPIDs(parent int) []int

ChildPIDs are a process's children in pid order, listed per thread (see proc.ChildPIDs).

func ClaudeDir

func ClaudeDir(home string) string

ClaudeDir is where Claude Code keeps its state for this account.

func ProcessArgs

func ProcessArgs(pid int) (string, bool)

ProcessArgs is a process's command line as ps prints it (arguments joined by spaces); false when it cannot be read.

func ProcessCwd

func ProcessCwd(pid int) string

ProcessCwd is a process's working folder, or "" when it cannot be read.

func SessionCwd

func SessionCwd(t *tmux.Tmux, session string) (cwd string, lastCommand *string)

SessionCwd is a tab session's working folder (its shell's, else tmux's idea of the pane) and the command running in it, or nil.

func SessionDir

func SessionDir(t *tmux.Tmux, session string) string

SessionDir is a tab session's working folder: its shell's, else tmux's idea of the pane; "" when neither is known.

Types

type DirCheck

type DirCheck struct {
	Valid         bool    `json:"valid"`
	Error         *string `json:"error,omitempty"`
	SuggestedName *string `json:"suggestedName,omitempty"` // "" for the root folder
}

DirCheck is the answer to "can this folder be a workspace".

func DirMissing

func DirMissing() DirCheck

DirMissing is the answer for a path that cannot be looked at.

func ValidateDirectory

func ValidateDirectory(dir string) DirCheck

ValidateDirectory checks that dir exists and is a folder, and names a workspace after it.

type Peer

type Peer struct {
	Name      string   `json:"name"`
	PID       int64    `json:"pid"`
	SessionID *string  `json:"sessionId"`
	TabID     *string  `json:"tabId"`
	Status    *string  `json:"status"`
	UpdatedAt *float64 `json:"updatedAt"`
}

Peer is a live Claude Code session on this machine, under the name agents message each other by.

func Peers

func Peers(home string) []Peer

Peers lists sessions/<pid>.json of every live Claude Code session, in name order.

Jump to

Keyboard shortcuts

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