client

package
v0.5.30-beta Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Package client implements the workspace-bound side of the runner protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigLoader

type ConfigLoader func(profile string) (llmtypes.Config, error)

ConfigLoader loads runner-owned configuration for an optional conversation profile.

type DirectWorkspaceInstanceProvider

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

DirectWorkspaceInstanceProvider creates per-run handles backed by the runner's registered workspace. It provides lifecycle symmetry for future providers but no filesystem, process, network, or port isolation.

func NewDirectWorkspaceInstanceProvider

func NewDirectWorkspaceInstanceProvider(workspace string) (*DirectWorkspaceInstanceProvider, error)

NewDirectWorkspaceInstanceProvider creates the initial non-isolating execution-instance provider.

func (*DirectWorkspaceInstanceProvider) Create

Create returns a fresh lifecycle handle to the same direct workspace.

type EnvironmentFactory

type EnvironmentFactory func(workingDirectory string, runtime *extensions.Runtime) agentenv.Environment

EnvironmentFactory creates one agent environment inside a provisioned execution instance.

type ExecutionInstance

type ExecutionInstance interface {
	WorkingDirectory() string
	Close(ctx context.Context) error
}

ExecutionInstance is the concrete filesystem/process/network backing for one runner environment. The direct-workspace implementation is not isolated; future providers can provision ephemeral backing.

type ExecutionInstanceProvider

type ExecutionInstanceProvider interface {
	Create(ctx context.Context, spec ExecutionInstanceSpec) (ExecutionInstance, error)
}

ExecutionInstanceProvider creates the backing used before runner configuration, extensions, and tools are discovered.

type ExecutionInstanceSpec

type ExecutionInstanceSpec struct {
	RunID          string
	ConversationID string
	Probe          bool
}

ExecutionInstanceSpec identifies one run or idle manifest probe that needs runner-side resources.

type Peer

type Peer interface {
	Call(ctx context.Context, method string, params any, result any) error
	Notify(ctx context.Context, method string, params any) error
	NotifyUpdate(method string, params any) error
}

Peer is the symmetric runner connection used for updates and reverse UI calls.

type Runner

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

Runner maintains one workspace lock, stable identity, and reconnecting control connection.

func NewRunner

func NewRunner(ctx context.Context, config RunnerConfig) (*Runner, error)

NewRunner validates configuration and acquires no external resources.

func (*Runner) AcquireWorkspaceLock

func (r *Runner) AcquireWorkspaceLock() error

AcquireWorkspaceLock claims this host workspace before it is registered.

func (*Runner) Close

func (r *Runner) Close() error

Close releases runner-owned local resources. It must not race with Run.

func (*Runner) Commands

func (r *Runner) Commands(ctx context.Context, environmentProfile string) ([]slashcommands.Command, error)

Commands discovers workspace and extension slash commands for an optional environment profile.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

Run acquires the workspace lock and keeps the runner connected until cancellation.

type RunnerConfig

type RunnerConfig struct {
	Server               string
	AuthToken            string
	Workspace            string
	DisplayName          string
	ServiceOptions       ServiceOptions
	Store                *localstate.Store
	ReconnectMin         time.Duration
	ReconnectMax         time.Duration
	ManifestInterval     time.Duration
	ManifestProbeTimeout time.Duration
	OnRegistered         func(protocol.RegisterResult)
	OnRetry              func(error, time.Duration)
}

RunnerConfig configures one long-running workspace-bound runner process.

type RuntimeProvider

type RuntimeProvider interface {
	RuntimeWithConfigAndCallContext(ctx context.Context, cwd, variant string, config extensions.Config, callContext extensions.ExtensionCallContext) (*extensions.Runtime, error)
}

RuntimeProvider supplies the persistent extension runtime for the bound workspace.

type Service

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

Service handles control-plane requests for one workspace-bound runner process.

func NewService

func NewService(parent context.Context, workspace string, options ServiceOptions) (*Service, error)

NewService creates a runner-side request handler bound to one canonical workspace.

func (*Service) AbortActiveRun

func (s *Service) AbortActiveRun(ctx context.Context) error

AbortActiveRun releases all local run resources after a connection loss.

func (*Service) Attach

func (s *Service) Attach(peer Peer)

Attach installs the current symmetric connection used by runner-originated calls.

func (*Service) CleanupExtensionUI

func (s *Service) CleanupExtensionUI(extensions.UIExtensionOwner)

CleanupExtensionUI is best-effort; the control plane also closes run-scoped UI when the run ends.

func (*Service) Close

func (s *Service) Close() error

Close releases an active environment and any runtime manager owned by the service.

func (*Service) Confirm

func (*Service) HandleNotification

func (s *Service) HandleNotification(ctx context.Context, method string, params json.RawMessage)

HandleNotification implements protocol.NotificationHandler for client UI events.

func (*Service) HandleRequest

func (s *Service) HandleRequest(ctx context.Context, method string, params json.RawMessage) (any, *protocol.RPCError)

HandleRequest implements protocol.RequestHandler for control-plane requests.

func (*Service) HeartbeatSnapshot

func (s *Service) HeartbeatSnapshot() (protocol.RunnerState, string, string)

HeartbeatSnapshot returns the legacy singular-run heartbeat shape.

func (*Service) HeartbeatSnapshotRuns

func (s *Service) HeartbeatSnapshotRuns() (protocol.RunnerState, []string, string)

HeartbeatSnapshotRuns returns current application health and all active run IDs.

func (*Service) Input

func (*Service) Notify

func (*Service) ProbeManifest

func (s *Service) ProbeManifest(ctx context.Context, environmentProfile string) (runnerpayload.Manifest, error)

ProbeManifest snapshots runner resources for command and capability discovery without reserving a control-plane run.

func (*Service) ProbeManifestDigest

func (s *Service) ProbeManifestDigest(ctx context.Context) (string, error)

ProbeManifestDigest snapshots idle runner resources without reserving a control-plane run.

func (*Service) Select

func (*Service) SetRegistration

func (s *Service) SetRegistration(result protocol.RegisterResult) error

SetRegistration applies the stable ID and generation returned by runner.register.

type ServiceOptions

type ServiceOptions struct {
	RuntimeProvider           RuntimeProvider
	ConfigLoader              ConfigLoader
	EnvironmentFactory        EnvironmentFactory
	ExecutionInstanceProvider ExecutionInstanceProvider
	CleanupTimeout            time.Duration
	// SnapshotWaitTimeout optionally bounds admission to the serialized snapshot
	// pipeline. Zero lets the caller's context own the deadline.
	SnapshotWaitTimeout time.Duration
}

ServiceOptions configures the runner-side request service.

Jump to

Keyboard shortcuts

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