mobile

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 25 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 mobile implements Sidecar's bounded headless terminal service.

Index

Constants

View Source
const (
	AttachReady       = "ready"
	AttachCandidate   = "candidate"
	AttachUnavailable = "unavailable"
	AttachAmbiguous   = "ambiguous"
	AttachStale       = "stale"
	AttachUnknown     = "unknown"
	AttachUnsupported = "unsupported"
)

Variables

This section is empty.

Functions

func ComposeCatalog

func ComposeCatalog(query mobileproto.CatalogQuery, identity CatalogIdentity, observedAt time.Time, catalogHosts []mobileproto.CatalogHost, sources []CatalogSource, extraFailures []mobileproto.CatalogFailure) (mobileproto.CatalogSnapshot, error)

ComposeCatalog projects already-authorized owner snapshots through the same query, ordering and grouping rules as QueryCatalog. It performs no target resolution. Callers must obtain each snapshot from the current owning mobile service and remap its public host identity before calling it.

func IsCandidateSelector

func IsCandidateSelector(value string) bool

func QueryCatalog

func QueryCatalog(ctx context.Context, provider CatalogProvider, resolver Resolver, query mobileproto.CatalogQuery, identity CatalogIdentity) (mobileproto.CatalogSnapshot, error)

QueryCatalog collects and projects one bounded catalog snapshot. It is the common path for the JSON CLI and stdio protocol.

func WorkspaceCandidates

func WorkspaceCandidates(workspace workspaceinventory.Workspace, ownerHostID string) (string, []mobileproto.CatalogCandidate, error)

WorkspaceCandidates projects the current source-owned pane set into opaque, deterministic selectors. ExpectedTarget remains empty until the owning resolver revalidates the exact pane and terminal incarnation.

Types

type CandidateInspector

type CandidateInspector func(context.Context, string) (tty.HeadlessTargetIdentity, error)

type CatalogIdentity

type CatalogIdentity struct {
	HubID, OwnerHostID, OwnerConfigGeneration string
}

type CatalogInput

type CatalogInput struct {
	ObservedAt time.Time
	Hosts      []mobileproto.CatalogHost
	Projects   []CatalogProject
	// CandidateResolver authorizes selectors against this exact inventory
	// observation. It avoids rebuilding the global catalog for every candidate;
	// target open and every later operation still perform fresh source checks.
	CandidateResolver Resolver
	// Resolver authorizes ordinary managed-shell rows with request-scoped
	// discovery. Target open and every later operation still use the service's
	// fresh resolver. When nil, QueryCatalog uses its resolver argument.
	Resolver Resolver
}

type CatalogProject

type CatalogProject struct {
	Result workspaceinventory.ProjectResult
	Label  string
	Order  int
	Stale  bool
}

type CatalogProvider

type CatalogProvider func(context.Context) (CatalogInput, error)

type CatalogSource

type CatalogSource struct {
	OwnerHostID string
	Snapshot    mobileproto.CatalogSnapshot
}

CatalogSource is one owning service's authoritative, unfiltered project snapshot after the hub has remapped its public identities. Source snapshots use project order so composition retains each owner's configured order.

type Config

type Config struct {
	Input                                     io.Reader
	Output                                    io.Writer
	Resolver                                  Resolver
	Revalidator                               TargetRevalidator
	Catalog                                   CatalogProvider
	HistoryCapturer                           HistoryCapturer
	OwnerConfigGenerationProvider             OwnerConfigGenerationProvider
	HubID, OwnerHostID, OwnerConfigGeneration string
	Manager                                   *tty.ControlManager
}

type HistoryCapturer

type HistoryCapturer func(target string, start, end, maxBytes int) (tty.CaptureRange, error)

type OwnerConfigGenerationProvider

type OwnerConfigGenerationProvider func(context.Context) (string, error)

type ResolveError

type ResolveError struct{ Code, Message string }

func (*ResolveError) Error

func (e *ResolveError) Error() string

type ResolvedTarget

type ResolvedTarget struct {
	WorkspaceID, WorkspaceKind, ProjectRoot, Session, Pane, DisplayName string
	Selector, SourceGeneration, SourceProjectKey, SourceWorkspacePath   string
	ServerPID                                                           int
	SessionID, SessionCreated, DurableSessionCreated                    string
	Width, Height, PaneCount                                            int
}

func ResolveCatalogCandidate

func ResolveCatalogCandidate(ctx context.Context, input CatalogInput, ownerHostID, selector string, inspect CandidateInspector) (ResolvedTarget, error)

ResolveCatalogCandidate re-enumerates the complete current source set and matches one deterministic selector. It never falls back to a residual Workspace PaneID/TmuxName or to another same-named pane.

func RevalidateCatalogCandidate

func RevalidateCatalogCandidate(ctx context.Context, previous ResolvedTarget, ownerHostID string, source CandidateWorkspaceProvider, inspect CandidateInspector) (ResolvedTarget, error)

RevalidateCatalogCandidate checks a bound worktree source before and after exact-pane inspection. The provider is intentionally narrower than a full catalog refresh: it needs only current configured-project membership, one worktree inventory and the current tmux pane list.

type Resolver

type Resolver func(context.Context, string) (ResolvedTarget, error)

type Service

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

func New

func New(config Config) (*Service, error)

func (*Service) Run

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

type TargetRevalidator

type TargetRevalidator func(context.Context, ResolvedTarget) (ResolvedTarget, error)

Jump to

Keyboard shortcuts

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