proxymanager

package
v1.7.12 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 23 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 proxymanager owns a standalone provider runtime and a reversible Claude Code settings overlay. Its control API only listens on loopback.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Env     bool            `json:"env,omitempty"`
	Key     string          `json:"key"`
	Before  json.RawMessage `json:"before,omitempty"`
	Applied json.RawMessage `json:"applied"`
}

Changes keep only fields owned by this proxy. Restore compares the current value with Applied so user edits made while the proxy runs are retained.

type Manager

type Manager struct{ Dir string }

func Default

func Default() (*Manager, error)

func (*Manager) Read

func (m *Manager) Read() (*State, error)

func (*Manager) RecoverStale

func (m *Manager) RecoverStale(ctx context.Context) (bool, error)

RecoverStale restores the settings overlay of a proxy that died without cleaning up (kill -9, power loss), so a plain claude stops pointing at a closed port. It never waits: a start or stop in progress owns the command lock and recovers on its own, and a held daemon lock means the proxy is alive. Reports whether it restored anything.

func (*Manager) Run

func (m *Manager) Run(ctx context.Context, p provider.Provider, settingsPath, id string) (runErr error)

Run owns the entire runtime lifetime. The caller cancels ctx for signals; the authenticated local stop endpoint uses the same cleanup path.

func (*Manager) Running

func (m *Manager) Running(ctx context.Context, s *State) bool

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, executable string, p provider.Provider, settingsPath string) (*State, error)

Start serializes starts and provider switches. The child is detached from the launching terminal and reports readiness only after the settings apply.

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context) error

type State

type State struct {
	ID           string          `json:"id"`
	Provider     string          `json:"provider"`
	PID          int             `json:"pid"`
	BaseURL      string          `json:"base_url"`
	ControlURL   string          `json:"control_url"`
	ControlToken string          `json:"control_token"`
	SettingsPath string          `json:"settings_path"`
	StartedAt    time.Time       `json:"started_at"`
	ConfigHash   string          `json:"config_hash"`
	EnvBefore    json.RawMessage `json:"env_before,omitempty"`
	Changes      []Change        `json:"changes"`
}

Jump to

Keyboard shortcuts

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