Documentation
¶
Overview ¶
Package mobile implements Sidecar's bounded headless terminal service.
Index ¶
- Constants
- func ComposeCatalog(query mobileproto.CatalogQuery, identity CatalogIdentity, observedAt time.Time, ...) (mobileproto.CatalogSnapshot, error)
- func IsCandidateSelector(value string) bool
- func QueryCatalog(ctx context.Context, provider CatalogProvider, resolver Resolver, ...) (mobileproto.CatalogSnapshot, error)
- func WorkspaceCandidates(workspace workspaceinventory.Workspace, ownerHostID string) (string, []mobileproto.CatalogCandidate, error)
- type CandidateInspector
- type CandidateWorkspaceProvider
- type CatalogIdentity
- type CatalogInput
- type CatalogProject
- type CatalogProvider
- type CatalogSource
- type Config
- type HistoryCapturer
- type OwnerConfigGenerationProvider
- type ResolveError
- type ResolvedTarget
- type Resolver
- type Service
- type TargetRevalidator
Constants ¶
const ( AttachReady = "ready" AttachCandidate = "candidate" 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 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 CandidateWorkspaceProvider ¶
type CandidateWorkspaceProvider func(context.Context, ResolvedTarget) (workspaceinventory.Workspace, 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 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 TargetRevalidator ¶
type TargetRevalidator func(context.Context, ResolvedTarget) (ResolvedTarget, error)