sysutil

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 14 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

Index

Constants

View Source
const LiveFeedHoldSeconds = 120

LiveFeedHoldSeconds is the post-run sandbox-keepalive window we ask the server to honour when LiveFeed is on. Long enough to absorb network + agent-stream latency between server-side run completion and the moment the client opens /browserfeed; short enough that abandoned sandboxes don't cost much. Server caps this via QMAX_LIVE_FEED_HOLD_MAX_SECONDS (default 600) so a misconfigured client can't pin sandboxes forever.

Variables

This section is empty.

Functions

func CaptureError

func CaptureError(err error, context map[string]interface{})

CaptureError reports a non-fatal error to Bugsink.

func CaptureMessage

func CaptureMessage(msg string)

CaptureMessage reports an informational message to Bugsink.

func DrainExecIDFromChild

func DrainExecIDFromChild() string

DrainExecIDFromChild reads and removes the execution ID the subprocess wrote. Returns "" when the file is missing or unreadable.

func DrainLiveURLFromChild

func DrainLiveURLFromChild() string

DrainLiveURLFromChild reads any URL the subprocess wrote to the side channel since the last drain, then deletes the file so a stale URL from a previous turn can't auto-launch on the next one. Returns "" when the file is missing, empty, or unreadable.

func EnvEnabled

func EnvEnabled(key string) bool

EnvEnabled returns true when an env var is set to a recognized affirmative.

func ExecIDFilePath

func ExecIDFilePath() string

ExecIDFilePath returns the per-process path for the execution-ID file.

func FlushErrorReporting

func FlushErrorReporting()

FlushErrorReporting flushes pending events before exit.

func InitErrorReporting

func InitErrorReporting(version string)

InitErrorReporting sets up Sentry-compatible error reporting when explicitly enabled via QMAX_CODE_TELEMETRY=1 and QMAX_CODE_TELEMETRY_DSN. Public builds must not report anything unless the user opts in. version is reported as the Sentry release tag.

func LiveURLFilePath

func LiveURLFilePath() string

LiveURLFilePath returns the path to the per-process side-channel file, computing it once per process. Empty string means we couldn't resolve a home directory — caller should treat that as "feature unavailable" rather than failing.

func MaskURL

func MaskURL(rawURL string) string

MaskURL replaces the password component of a URL's user-info with **** for safe display. Returns the input unchanged if it doesn't parse or has no credentials. Use this for URLs shown in pickers, status lines, or logs; for redaction of sensitive output going off-process, use internal/security.RedactSensitive instead.

func PersistExecIDForParent

func PersistExecIDForParent(execID string)

PersistExecIDForParent writes the execution ID to the side channel so the parent can poll for the live_browser_url without blocking the MCP tool call. No-op when QMAX_EXEC_ID_FILE is not set.

func PersistLiveURLForParent

func PersistLiveURLForParent(url string)

PersistLiveURLForParent writes `url` into the side-channel file the parent watches. No-op when the env var isn't set (i.e. we're running in-process mode, where captureLiveURL already wrote to sctx directly). Best-effort: errors are swallowed because failing here would corrupt otherwise-valid tool output.

func PidAlive

func PidAlive(pid int) bool

PidAlive reports whether a process with the given PID is running. Uses signal 0: no signal is sent but the kernel validates the PID.

func RecoverPanic

func RecoverPanic()

RecoverPanic catches panics and reports them to Bugsink before re-panicking.

func ResetExecIDFileForTest

func ResetExecIDFileForTest()

ResetExecIDFileForTest is the execID equivalent of ResetLiveURLFileForTest.

func ResetLiveURLFileForTest

func ResetLiveURLFileForTest()

ResetLiveURLFileForTest resets the cached singleton path so a test can run LiveURLFilePath() against a fresh sync.Once. Test-only helper exported here because callers live in another package.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger provides structured JSON logging to a file.

func NewLogger

func NewLogger(sessionID string) *Logger

NewLogger creates a logger that writes to ~/.qmax-code/logs/session-{id}.log

func (*Logger) Close

func (l *Logger) Close()

Close closes the log file.

func (*Logger) Error

func (l *Logger) Error(component, msg string, fields ...map[string]interface{})

Error logs an error-level message.

func (*Logger) Info

func (l *Logger) Info(component, msg string, fields ...map[string]interface{})

Info logs an info-level message.

func (*Logger) Log

func (l *Logger) Log(level, component, msg string, fields map[string]interface{})

Log writes a structured log entry.

func (*Logger) TraceID

func (l *Logger) TraceID() string

TraceID returns the current trace ID for this session.

Jump to

Keyboard shortcuts

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