capture

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 15 Imported by: 1 module, 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 capture runs a command with its LLM traffic redirected to a local HTTP server and records every request/response exchange as JSONL.

Index

Constants

View Source
const DefaultOutputPath = "/tmp/llm-proxy-capture.jsonl"

DefaultOutputPath is the JSONL destination used when -o/--output is absent.

Variables

This section is empty.

Functions

func Handle

func Handle(args []string) error

Handle parses args and runs the capture. It returns nil when help was shown.

Types

type Config

type Config struct {
	Output         string
	Port           int
	NoRedact       bool
	EnvCommandCode bool
	Target         string
	Args           []string
}

Config is a parsed capture invocation.

type ExitError

type ExitError struct {
	Code int
}

ExitError carries the wrapped command's exit code so the caller can exit with it.

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) ExitCode

func (e *ExitError) ExitCode() int

ExitCode returns the wrapped command's exit code.

type Server

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

Server is the local capture HTTP server.

func Start

func Start(opts ServerOptions) (*Server, error)

Start binds the capture server on loopback and serves until Close.

func (*Server) Close

func (s *Server) Close() error

Close stops the server and closes the log file.

func (*Server) Count

func (s *Server) Count() int

Count returns the number of recorded exchanges.

func (*Server) Port

func (s *Server) Port() int

Port returns the bound loopback port.

func (*Server) Redactions

func (s *Server) Redactions() int

Redactions returns the number of sensitive header values masked in the log.

func (*Server) URL

func (s *Server) URL() string

URL returns the base URL the client should be pointed at.

type ServerOptions

type ServerOptions struct {
	// Port is the listen port; 0 picks a random free port on loopback.
	Port int
	// OutputPath is the JSONL file exchanges are appended to.
	OutputPath string
	// Redact masks sensitive request/response headers in the log.
	Redact bool
}

ServerOptions configures the capture server.

Jump to

Keyboard shortcuts

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