Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatLiveError ¶
FormatLiveError is a small helper for CLI messages (kept for symmetry).
func FormatTree ¶
func FormatTree(nodes []ProcNode, opts TreeFormatOptions) string
FormatTree rebuilds a parent→child forest from node PPIDs and prints each node as connectors + "PID Cmd". Pure: does not call Resolve or Lsof.
Connector rules (matches locked P2 templates for sole-child chains):
- Non-last siblings use branch (├── / +--) and pipe continuation (│ / |).
- Last siblings that still have children also use branch + pipe (so a single intermediate child is drawn with ├──/│, not └──/spaces).
- Last siblings that are leaves use last (└── / `--) and blank continuation.
Types ¶
type Options ¶
type Options struct {
GrokHome string
CodexHome string
MaxDepth int
ListProcs func() []Proc
Lsof func(pid int) []string
// EnrichInfo, when true and Kind is grok with a SessionID, calls
// LookupGrokInfo to fill GrokTitle / GrokModel. Opt-in; default false.
EnrichInfo bool
// LookupGrokInfo is optional. Production CLI may default to
// agent/grok/sessions.Info; tests inject a pure stub.
LookupGrokInfo func(home, sessionID string) (title, model string, err error)
}
Options configures ResolveFromPID. ListProcs and Lsof are injectable for tests; production may wire live process listing and lsof.
type Proc ¶
Proc is one process row in a snapshot.
func ListLiveProcs ¶
func ListLiveProcs() []Proc
ListLiveProcs returns a best-effort process snapshot via `ps`. On failure (ps missing or error), returns nil.
type ProcNode ¶
type ProcNode struct {
PID int
PPID int
Role string // input | agent-run | agent-run-serve | grok | codex | other
Cmd string
}
ProcNode is a classified process in the descendant tree of the input pid.
type Result ¶
type Result struct {
InputPID int
Kind string // grok | codex | none
SessionID string
Source string // open-files | open-files+tree
Confidence string // hard | "" when none
RunnerPID int
RunnerCmd string
Tree []ProcNode
Warnings []string
// GrokTitle / GrokModel are filled only when EnrichInfo is true and
// LookupGrokInfo succeeds for a grok hard hit.
GrokTitle string
GrokModel string
}
Result is the outcome of ResolveFromPID.
type TreeFormatOptions ¶
type TreeFormatOptions struct {
// ASCII, when true, uses +-- / `-- / | instead of box-drawing.
ASCII bool
}
TreeFormatOptions controls FormatTree connector style.