Documentation
¶
Index ¶
- func CheckExistingDaemon(workingDir string) (int, error)
- func CleanupDaemon(workingDir string)
- func ForkIntoBackground(cfgFile, workingDir, sessionID string, extraArgs ...string) (int, error)
- func FormatPID(pid int) string
- func LogFilePath(workingDir string) (string, error)
- func PIDFilePath(workingDir string) (string, error)
- func PlatformDisplayName(platform string) string
- func RemovePIDFile(path string) error
- func Tr(lang Lang, key string, args ...any) string
- func WritePIDFile(path string, pid int, sessionID, workingDir string) error
- type DaemonInfo
- type FollowSink
- type Lang
- type TerminalFollowDisplay
- func (d *TerminalFollowDisplay) Close()
- func (d *TerminalFollowDisplay) OnError(err error)
- func (d *TerminalFollowDisplay) OnPairingChallenge(platform, channelID, code string, kind string)
- func (d *TerminalFollowDisplay) OnPairingResolved()
- func (d *TerminalFollowDisplay) OnRoundDone()
- func (d *TerminalFollowDisplay) OnStreamText(text string)
- func (d *TerminalFollowDisplay) OnToolResult(toolName, rawArgs, result string, isError bool)
- func (d *TerminalFollowDisplay) OnToolStatus(toolName, rawArgs string)
- func (d *TerminalFollowDisplay) OnUserMessage(text string)
- type ToolFormatter
- type ToolPresenter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckExistingDaemon ¶
CheckExistingDaemon checks if a daemon is already running for the given working directory. Returns the PID if a running daemon is found, or 0 if none.
func CleanupDaemon ¶
func CleanupDaemon(workingDir string)
CleanupDaemon removes the PID file for the given working directory.
func ForkIntoBackground ¶
ForkIntoBackground re-execs the current binary as a background daemon. The child process argv[0] is set to "ggcode[dirname]". stdout/stderr are redirected to a log file. Returns the child PID; the caller (parent) should os.Exit(0).
func LogFilePath ¶
LogFilePath returns the log file path for a given working directory.
func PIDFilePath ¶
PIDFilePath returns the PID file path for a given working directory.
func PlatformDisplayName ¶ added in v1.1.45
PlatformDisplayName returns a human-readable name for an IM platform string.
Types ¶
type DaemonInfo ¶
type DaemonInfo struct {
PID int `json:"pid"`
SessionID string `json:"session_id"`
WorkingDir string `json:"working_dir"`
StartedAt time.Time `json:"started_at"`
}
DaemonInfo holds metadata about a running daemon process.
func ReadPIDFile ¶
func ReadPIDFile(path string) (*DaemonInfo, error)
ReadPIDFile reads daemon info from a PID file.
type FollowSink ¶
type FollowSink interface {
// OnUserMessage displays a user message.
OnUserMessage(text string)
// OnToolStatus is called when a tool starts (used only for internal tracking, not display).
OnToolStatus(toolName, rawArgs string)
// OnToolResult displays the result of a tool call.
OnToolResult(toolName, rawArgs, result string, isError bool)
// OnStreamText accumulates streaming text (not displayed until OnRoundDone).
OnStreamText(text string)
// OnRoundDone displays the accumulated assistant text and a separator.
OnRoundDone()
// OnError displays an error message.
OnError(err error)
// OnPairingChallenge displays an IM pairing code when a channel requests binding.
OnPairingChallenge(platform, channelID, code string, kind string)
// OnPairingResolved clears a previously displayed pairing challenge.
OnPairingResolved()
// Close cleans up the display.
Close()
}
FollowSink receives agent events for terminal follow-mode display.
type Lang ¶
type Lang string
Lang represents the display language for follow output.
func ResolveLang ¶
ResolveLang returns a Lang from a raw config language string.
type TerminalFollowDisplay ¶
type TerminalFollowDisplay struct {
// contains filtered or unexported fields
}
TerminalFollowDisplay renders agent activity to the terminal using ANSI codes.
func NewTerminalFollowDisplay ¶
func NewTerminalFollowDisplay(out *os.File, lang Lang, workDir string, presenter ToolPresenter) *TerminalFollowDisplay
NewTerminalFollowDisplay creates a new follow display writing to the given file.
func (*TerminalFollowDisplay) OnError ¶
func (d *TerminalFollowDisplay) OnError(err error)
OnError displays an error message.
func (*TerminalFollowDisplay) OnPairingChallenge ¶ added in v1.1.45
func (d *TerminalFollowDisplay) OnPairingChallenge(platform, channelID, code string, kind string)
OnPairingChallenge displays an IM pairing code when a channel requests binding.
func (*TerminalFollowDisplay) OnPairingResolved ¶ added in v1.1.45
func (d *TerminalFollowDisplay) OnPairingResolved()
OnPairingResolved clears a previously displayed pairing challenge.
func (*TerminalFollowDisplay) OnRoundDone ¶
func (d *TerminalFollowDisplay) OnRoundDone()
OnRoundDone displays the accumulated assistant text rendered as markdown.
func (*TerminalFollowDisplay) OnStreamText ¶
func (d *TerminalFollowDisplay) OnStreamText(text string)
OnStreamText accumulates text for the current round.
func (*TerminalFollowDisplay) OnToolResult ¶
func (d *TerminalFollowDisplay) OnToolResult(toolName, rawArgs, result string, isError bool)
OnToolResult displays the tool call result using the same label system as TUI.
func (*TerminalFollowDisplay) OnToolStatus ¶
func (d *TerminalFollowDisplay) OnToolStatus(toolName, rawArgs string)
OnToolStatus is a no-op — we only display final results via OnToolResult.
func (*TerminalFollowDisplay) OnUserMessage ¶
func (d *TerminalFollowDisplay) OnUserMessage(text string)
OnUserMessage displays a user message.
type ToolFormatter ¶
ToolFormatter is a function that formats tool activity for display. It takes a tool name and raw JSON args, and returns a human-readable status string.
type ToolPresenter ¶ added in v1.1.45
type ToolPresenter interface {
Present(toolName, rawArgs string) (displayName, detail, activity string)
}
ToolPresenter returns a display presentation for a tool call. Used by daemon follow to get the same labels as TUI.