mdruntime

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvailableRuntimeNames added in v0.11.0

func AvailableRuntimeNames() []string

AvailableRuntimeNames returns installed container runtime names in preference order.

func InstancesFromMD

func InstancesFromMD(ctx context.Context, mdContainers []*md.Container) []runtime.Instance

InstancesFromMD converts md container handles to runtime-neutral instances.

func New

func New(ctx context.Context, log *slog.Logger, tailscaleAPIKey, githubToken, runtimeName string) (*md.Client, error)

New creates an md.Client for the md runtime adapter. runtimeName selects the container runtime ("docker" or "podman"); empty means auto-detect.

Types

type Backend

type Backend struct {
	Provider   genai.Provider      // nil if LLM not configured
	HarnessEnv map[string][]string // per-harness KEY=VALUE env vars from config
	// contains filtered or unexported fields
}

Backend adapts *md.Client to runtime.System.

func NewBackend

func NewBackend(log *slog.Logger, client *md.Client) *Backend

NewBackend creates a Backend wrapping the given md client.

func (*Backend) CompactRepositoryStatus added in v0.13.0

func (b *Backend) CompactRepositoryStatus(ctx context.Context, id runtime.ID, repoIdx int) (runtime.RepositoryStatus, error)

CompactRepositoryStatus returns branch, divergence, working-tree counts, any in-progress operation, and the branch-diff numstat for one repository in a single container probe, without the per-commit log walk.

func (*Backend) Connect

Connect implements runtime.Lifecycle.

func (*Backend) Diff

func (b *Backend) Diff(ctx context.Context, id runtime.ID, repoIdx int, args ...string) (string, error)

Diff implements runtime.Repository.

func (*Backend) DiskUsage added in v0.12.0

func (b *Backend) DiskUsage(ctx context.Context, ids []runtime.ID) (map[runtime.ID]int64, error)

DiskUsage returns writable-layer sizes for the requested runtime instances.

func (*Backend) Fetch

Fetch implements runtime.Repository.

func (*Backend) FileDiff added in v0.12.0

func (b *Backend) FileDiff(ctx context.Context, id runtime.ID, repoIdx int, commit, path, originalPath string) (string, error)

FileDiff implements runtime.Repository.

func (*Backend) FileSize added in v0.14.0

func (b *Backend) FileSize(ctx context.Context, id runtime.ID, path string) (int64, error)

FileSize implements runtime.Files. Metadata is probed only for range requests.

func (*Backend) Fork

Fork implements runtime.Lifecycle.

func (*Backend) Inspect added in v0.11.0

func (b *Backend) Inspect(ctx context.Context, id runtime.ID) (*runtime.InstanceInspect, error)

Inspect returns observed runtime configuration for a runtime instance.

func (*Backend) Launch

func (b *Backend) Launch(ctx context.Context, repos []runtime.Repo, opts *runtime.StartOptions) (runtime.ID, error)

Launch implements runtime.Lifecycle.

func (*Backend) List added in v0.11.0

func (b *Backend) List(ctx context.Context) ([]runtime.Instance, error)

List returns known runtime instances.

func (*Backend) Metadata added in v0.11.0

func (b *Backend) Metadata(ctx context.Context, id runtime.ID, key runtime.MetadataKey) (string, error)

Metadata reads a single runtime instance metadata value, returning "" when unset.

func (*Backend) Name added in v0.11.0

func (b *Backend) Name() runtime.Name

Name returns the runtime backend name.

func (*Backend) Processes

func (b *Backend) Processes(ctx context.Context, id runtime.ID) ([]runtime.ProcessInfo, error)

Processes returns the process list inside the runtime instance.

func (*Backend) Purge

func (b *Backend) Purge(ctx context.Context, id runtime.ID) error

Purge implements runtime.Lifecycle.

func (*Backend) ReadDir added in v0.15.0

func (b *Backend) ReadDir(ctx context.Context, id runtime.ID, path string) ([]runtime.DirEntry, bool, error)

ReadDir implements runtime.Files with one find report per call. The report is read through a limit so a huge directory cannot exhaust server memory.

func (*Backend) ReadFile added in v0.14.0

func (b *Backend) ReadFile(ctx context.Context, id runtime.ID, path string, offset, length int64) iter.Seq2[[]byte, error]

ReadFile implements runtime.Files with one reusable 64 KiB buffer. Relative paths are resolved by the task service before reaching this boundary.

func (*Backend) RefreshRefs added in v0.14.1

func (b *Backend) RefreshRefs(ctx context.Context, id runtime.ID) error

RefreshRefs implements runtime.Repository.

func (*Backend) RepositoryStatus added in v0.12.0

func (b *Backend) RepositoryStatus(ctx context.Context, id runtime.ID, repoIdx int) (runtime.RepositoryStatus, error)

RepositoryStatus implements runtime.Repository.

func (*Backend) Revive

func (b *Backend) Revive(ctx context.Context, id runtime.ID) error

Revive implements runtime.Lifecycle.

func (*Backend) Signal

func (b *Backend) Signal(ctx context.Context, id runtime.ID, pid int, sig string) error

Signal sends a signal to a process inside the runtime instance.

func (*Backend) Stop

func (b *Backend) Stop(ctx context.Context, id runtime.ID) error

Stop implements runtime.Lifecycle.

func (*Backend) SudoPassword added in v0.11.0

func (b *Backend) SudoPassword(ctx context.Context, id runtime.ID) (string, error)

SudoPassword fetches the sudo password for a runtime instance over SSH.

func (*Backend) TurnSnapshot added in v0.14.0

func (b *Backend) TurnSnapshot(ctx context.Context, id runtime.ID, previous []runtime.FetchedBranch) ([]runtime.TurnRepository, error)

TurnSnapshot fetches each repository once, then reads its branch and turn statistics together. Fetch failures abort durability; measurement failures keep the fetched tips but mark that repository's live summary unavailable.

func (*Backend) VNCPort

func (b *Backend) VNCPort(ctx context.Context, id runtime.ID) int

VNCPort implements runtime.Lifecycle.

func (*Backend) WatchEvents added in v0.11.0

func (b *Backend) WatchEvents(ctx context.Context, filter runtime.EventFilter) (iter.Seq2[runtime.Event, error], error)

WatchEvents streams lifecycle events for instances matching filter.

func (*Backend) WatchStats added in v0.11.0

func (b *Backend) WatchStats(ctx context.Context, ids []runtime.ID) (iter.Seq2[runtime.StatsSample, error], error)

WatchStats streams resource stats for the named runtime instances.

type SlogWriter

type SlogWriter struct {
	Context context.Context
	Logger  *slog.Logger
	// Phase labels the log entries (e.g. "launch", "warmup").
	Phase string
	// contains filtered or unexported fields
}

SlogWriter is an io.Writer that logs each complete line via slog.Repository. Use it instead of io.Discard so md output is captured in structured logs.

func (*SlogWriter) Write

func (w *SlogWriter) Write(p []byte) (int, error)

Write logs complete non-empty lines from p and buffers incomplete tails.

Jump to

Keyboard shortcuts

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