Documentation
¶
Overview ¶
Package system projects CTX machine inventory, shell, and browser observations onto the public generic graph API. It owns the ext.system vocabulary; the base graph package remains product-neutral.
Index ¶
- Constants
- Variables
- func RecordDesktop(ctx context.Context, driver DesktopDriver, options media.RecordingOptions) (media.Recording, error)
- func SafeOrigin(raw string) (scheme, host string, ok bool)
- func SendDesktopInput(ctx context.Context, driver DesktopDriver, input SurfaceInput, ...) error
- func SendWindowInput(ctx context.Context, target WindowInfo, input SurfaceInput, ...) error
- type AccessibilityElement
- type AccessibilityOptions
- type AccessibilitySnapshot
- type AdapterObservation
- type AliasObservation
- type ApplicationInfo
- type CaptureOptions
- type CollectionStatus
- type ContainerInfo
- type ContextCandidate
- type ContextObservation
- type DesktopDriver
- type DesktopEndpoint
- type DesktopInfo
- type DisplayInfo
- type FilesystemInfo
- type FilesystemRequirement
- type FilesystemSpace
- type Graph
- func (g *Graph) Close() error
- func (g *Graph) ObserveHost(ctx context.Context, inventory HostInventory) error
- func (g *Graph) ObserveInventory(ctx context.Context, adapters []AdapterObservation, aliases []AliasObservation) error
- func (g *Graph) ObserveProcesses(ctx context.Context, observation ProcessSnapshot) error
- func (g *Graph) ObserveShell(ctx context.Context, cwd, profile string, selections map[string]string) error
- func (g *Graph) ObserveWeb(ctx context.Context, provider, profile, scheme, host string) error
- func (g *Graph) PrepareHost(ctx context.Context, requirements OperationRequirements, ...) (PreparedHost, error)
- func (g *Graph) ReadHost(ctx context.Context) (HostSnapshot, error)
- func (g *Graph) ResolveHost(ctx context.Context, requirements OperationRequirements) (HostCandidates, error)
- func (g *Graph) ResolveInventory(ctx context.Context, runtimeName string) (Inventory, error)
- func (g *Graph) ScanHost(ctx context.Context) (HostInventory, error)
- func (g *Graph) ScanProcesses(ctx context.Context, options ProcessOptions) (ProcessSnapshot, error)
- type HostCandidates
- type HostInventory
- type HostRequirementError
- type HostSnapshot
- type InputOptions
- type Inventory
- type OperationRequirements
- type PermissionInfo
- type PermissionSnapshot
- type PreparedHost
- type ProcessInfo
- type ProcessOptions
- type ProcessResource
- type ProcessSnapshot
- type ProcessUsage
- type RecordingInfo
- type RelationObservation
- type ResourceInfo
- type ResourceObservation
- type ShellInfo
- type ShellRequirement
- type SurfaceBounds
- type SurfaceCapture
- type SurfaceInput
- type SurfaceInputKind
- type SurfaceOptions
- type SurfacePoint
- type SurfaceSnapshot
- type WebviewInfo
- type WebviewRequirement
- type WebviewValidator
- type WindowInfo
Constants ¶
const ( DesktopNative = "desktop.native" DesktopX11 = "desktop.x11" DesktopWayland = "desktop.wayland" DesktopContainer = "desktop.container" DesktopRecording = "desktop.recording" )
const ( // ContainerDetected, ContainerNone, and ContainerUnsupported are the only // container states. Unsupported means the platform exposes no safe local // signal, not that the process is outside a container. ContainerDetected = "detected" ContainerNone = "none" ContainerUnsupported = "unsupported" )
const Namespace = "ext.system"
Variables ¶
var ( // requested operation in the current session. ErrSurfaceUnavailable = errors.New("surface operation unavailable") // ErrSurfacePermission means the operating system has not granted the // calling process permission for the requested operation. ErrSurfacePermission = errors.New("surface operation permission is not granted") // ErrSurfaceStale means the observed process generation or window no longer // names the same native surface. ErrSurfaceStale = errors.New("surface reference is stale") // ErrSurfaceNotFocused means input could not be safely directed to the // selected surface without affecting another application. ErrSurfaceNotFocused = errors.New("surface is not focused") )
ErrDesktopUnavailable means a selected desktop mechanism cannot perform the requested operation in the current session.
var ErrInvalidRecording = errors.New("invalid recording options")
ErrInvalidRecording reports malformed recording options.
Functions ¶
func RecordDesktop ¶ added in v0.2.0
func RecordDesktop(ctx context.Context, driver DesktopDriver, options media.RecordingOptions) (media.Recording, error)
RecordDesktop starts a bounded recording through the selected driver.
func SafeOrigin ¶
SafeOrigin parses a navigation URL and returns only scheme and host.
func SendDesktopInput ¶ added in v0.2.0
func SendDesktopInput(ctx context.Context, driver DesktopDriver, input SurfaceInput, options InputOptions) error
SendDesktopInput sends one bounded operation through the selected driver. Drivers that only implement keyboard input must refuse pointer operations explicitly instead of emulating them.
func SendWindowInput ¶ added in v0.2.0
func SendWindowInput(ctx context.Context, target WindowInfo, input SurfaceInput, options InputOptions) error
SendWindowInput sends one bounded operation to a revalidated local window. It does not choose or activate the window, hold input across calls, implement an approval policy, or expose a remote protocol.
Types ¶
type AccessibilityElement ¶ added in v0.2.0
type AccessibilityElement struct {
ID string `json:"id"`
ParentID string `json:"parent_id,omitempty"`
PID int `json:"pid"`
ProcessStartID string `json:"process_start_id"`
Role string `json:"role"`
Identifier string `json:"identifier,omitempty"`
Label string `json:"label,omitempty"`
Value string `json:"value,omitempty"`
Bounds *SurfaceBounds `json:"bounds,omitempty"`
Actions []string `json:"actions,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Focused *bool `json:"focused,omitempty"`
}
AccessibilityElement is a caller-visible node in the focused application's native accessibility tree. ID and ParentID are opaque snapshot identities; they are not native handles and cannot be used to invoke actions.
type AccessibilityOptions ¶ added in v0.2.0
type AccessibilityOptions struct {
MaxElements int
MaxDepth int
Timeout time.Duration
IncludeText bool
}
AccessibilityOptions bounds traversal. Text is omitted by default because labels and values may contain document or form contents. Zero bounds select 1024 elements, depth 16, and a five-second deadline.
type AccessibilitySnapshot ¶ added in v0.2.0
type AccessibilitySnapshot struct {
Platform string `json:"platform"`
ObservedAt time.Time `json:"observed_at"`
Status CollectionStatus `json:"status"`
Elements []AccessibilityElement `json:"elements"`
}
AccessibilitySnapshot is a bounded, read-only observation of the focused local application's UI tree. It never contains native handles or an action endpoint. Status distinguishes an empty tree from denied or unsupported native observation.
func DiscoverAccessibility ¶ added in v0.2.0
func DiscoverAccessibility(ctx context.Context, options AccessibilityOptions) (AccessibilitySnapshot, error)
DiscoverAccessibility observes the focused local application's native UI structure. It does not request permission, mutate attributes, invoke actions, synthesize input, capture pixels, or communicate with another process over a transport.
type AdapterObservation ¶
type AdapterObservation struct {
Name, Runtime, Selector string
DiscoveryStatus string
Surfaces, Capabilities, Supports []string
Trusted, ListSupported, ObserveSupported, Listed bool
Contexts []ContextObservation
Resources []ResourceObservation
Relations []RelationObservation
}
AdapterObservation describes an installed adapter and any contexts it listed. Listed means its discovery operation completed; it does not prove each configured remote endpoint is running or authorize its use.
type AliasObservation ¶
AliasObservation is a local user declaration that names one adapter context.
type ApplicationInfo ¶
ApplicationInfo identifies an application through OS packaging conventions. It does not assign product capabilities or infer an engine from a name.
type CaptureOptions ¶ added in v0.2.0
CaptureOptions bounds native allocation and encoded output. Zero values select 16,777,216 pixels, 16 MiB, and a five-second deadline.
type CollectionStatus ¶
type CollectionStatus struct {
State string `json:"state"`
Detail string `json:"detail,omitempty"`
ObservedAt *time.Time `json:"observed_at,omitempty"`
}
CollectionStatus distinguishes an empty observation from inaccessible data. State is complete, partial, permission-denied, unsupported, exited, or unavailable. Detail is a diagnostic, never process arguments or environment contents.
type ContainerInfo ¶ added in v0.2.0
type ContainerInfo struct {
Detected bool `json:"detected"`
State string `json:"state"`
Evidence []string `json:"evidence"`
}
ContainerInfo reports whether this process runs inside a container and which local markers support that conclusion. Evidence is a sorted list of stable names, not file contents or environment values.
type ContextCandidate ¶
type ContextCandidate struct {
Adapter string `json:"adapter"`
Runtime string `json:"runtime"`
Selection string `json:"selection"`
SelectionDigest string `json:"selection_digest"`
SelectionRedacted bool `json:"selection_redacted,omitempty"`
Capabilities []string `json:"capabilities"`
Supports []string `json:"supports,omitempty"`
ObservedAt time.Time `json:"observed_at"`
}
ContextCandidate is a graph observation, not authorization to run an adapter. Callers must still check trust and validate the native selection.
type ContextObservation ¶
type ContextObservation struct {
Selection string `json:"selection"`
Capabilities []string `json:"capabilities,omitempty"`
Supports []string `json:"supports,omitempty"`
Attributes map[string]any `json:"attributes,omitempty"`
}
ContextObservation is a native adapter selection with optional narrower capabilities and resource support, plus ordinary non-secret metadata.
type DesktopDriver ¶ added in v0.2.0
type DesktopDriver interface {
Name() string
Capture(context.Context, CaptureOptions) (SurfaceCapture, error)
Input(context.Context, SurfaceInput, InputOptions) error
Record(context.Context, media.RecordingOptions) (media.Recording, error)
}
DesktopDriver is a caller-selected native desktop mechanism, such as the X11 or Wayland tool adapters. Operations are desktop-scoped because those tools cannot address an observed window; window-scoped capture and input remain in CaptureWindow and SendWindowInput.
It is an interface rather than a registry: the shared library never selects a driver by name or falls back to another one.
type DesktopEndpoint ¶ added in v0.2.0
type DesktopEndpoint struct {
Available bool `json:"available"`
Reason string `json:"reason,omitempty"`
}
DesktopEndpoint is evidence that a local desktop display endpoint is visible to this process. It never contains a socket path, credential, or remote host.
type DesktopInfo ¶ added in v0.2.0
type DesktopInfo struct {
Platform string `json:"platform"`
Interactive bool `json:"interactive"`
Containerized bool `json:"containerized"`
Capabilities []string `json:"capabilities,omitempty"`
X11 DesktopEndpoint `json:"x11"`
Wayland DesktopEndpoint `json:"wayland"`
Recording RecordingInfo `json:"recording"`
Reason string `json:"reason,omitempty"`
ObservedAt time.Time `json:"observed_at"`
}
DesktopInfo is a point-in-time observation of the native desktop visible to the current process. It does not describe a remote display or authorize use.
func DiscoverDesktop ¶ added in v0.2.0
func DiscoverDesktop(ctx context.Context) (DesktopInfo, error)
DiscoverDesktop observes only the local native desktop and its recording prerequisites. It performs no network access and launches no process.
type DisplayInfo ¶ added in v0.2.0
type DisplayInfo struct {
ID string `json:"id"`
Bounds SurfaceBounds `json:"bounds"`
Scale float64 `json:"scale,omitempty"`
Primary bool `json:"primary"`
}
DisplayInfo describes a display visible to the current process. ID is an opaque observation identity, not a native handle.
type FilesystemInfo ¶
type FilesystemInfo struct {
MountPoint string `json:"mount_point"`
Source string `json:"source"`
Type string `json:"type"`
ReadOnly bool `json:"read_only"`
Space *FilesystemSpace `json:"space,omitempty"`
Label string `json:"label,omitempty"`
DriveKind string `json:"drive_kind,omitempty"`
DetailError string `json:"detail_error,omitempty"`
}
FilesystemInfo describes a mounted filesystem visible to this process. Space is nil when the OS cannot provide it. This is not a list of unmounted disks or a filesystem-driver catalog. Source never includes URL credentials.
func DiscoverFilesystems ¶
func DiscoverFilesystems(ctx context.Context) ([]FilesystemInfo, error)
DiscoverFilesystems reads the native mount inventory and available space. It observes the caller's mount namespace and permissions, including when CTX itself runs inside a container. It does not traverse filesystem contents.
type FilesystemRequirement ¶
type FilesystemRequirement struct {
Select string `json:"select,omitempty"` // Mount point.
Path string `json:"path,omitempty"` // Existing file/directory or a future output path.
Types []string `json:"types,omitempty"`
Writable bool `json:"writable,omitempty"`
MinimumAvailableBytes uint64 `json:"minimum_available_bytes,omitempty"`
}
type FilesystemSpace ¶
type FilesystemSpace struct {
TotalBytes uint64 `json:"total_bytes"`
FreeBytes uint64 `json:"free_bytes"`
AvailableBytes uint64 `json:"available_bytes"`
}
FilesystemSpace is a point-in-time capacity observation, in bytes. Available space is what the calling user can allocate; it can differ from free space. On Windows, total space is also limited by any quota on the calling user.
type Graph ¶
func New ¶
New registers the CTX system vocabulary on any graph.Store. Other services may keep their own namespaces in the same store.
func (*Graph) ObserveHost ¶
func (g *Graph) ObserveHost(ctx context.Context, inventory HostInventory) error
ObserveHost reconciles host-owned records and their machine relationships. Adapter inventory, shell sessions, and other namespaces are preserved.
func (*Graph) ObserveInventory ¶
func (g *Graph) ObserveInventory(ctx context.Context, adapters []AdapterObservation, aliases []AliasObservation) error
ObserveInventory replaces CTX's adapter inventory projection while leaving shell and web observations intact. It records only ordinary metadata and redacts context names that resemble paths, URLs, or opaque values.
func (*Graph) ObserveProcesses ¶
func (g *Graph) ObserveProcesses(ctx context.Context, observation ProcessSnapshot) error
ObserveProcesses projects generic OS evidence. Complete enumeration removes missing process instances. Partial inventories retain unseen instances. A targeted observation only replaces that PID and its inspected resource kinds. Resource nodes retain their own timestamps across later identity-only scans.
func (*Graph) ObserveShell ¶
func (g *Graph) ObserveShell(ctx context.Context, cwd, profile string, selections map[string]string) error
ObserveShell records the current shell session and its active directory. It never reads arbitrary environment values or shell history.
func (*Graph) ObserveWeb ¶
ObserveWeb records the current web origin after ctx open succeeds. URL paths, queries, fragments, and credentials are intentionally not persisted.
func (*Graph) PrepareHost ¶
func (g *Graph) PrepareHost(ctx context.Context, requirements OperationRequirements, validateWebview WebviewValidator) (PreparedHost, error)
PrepareHost discovers current candidates, selects one for each requirement, and performs live checks. Ambiguous choices require an explicit selection. Webview preparation requires a validator from the consuming backend.
func (*Graph) ReadHost ¶
func (g *Graph) ReadHost(ctx context.Context) (HostSnapshot, error)
ReadHost reads host observations without refreshing or probing the OS.
func (*Graph) ResolveHost ¶
func (g *Graph) ResolveHost(ctx context.Context, requirements OperationRequirements) (HostCandidates, error)
ResolveHost refreshes stale requested categories and returns matching candidates. Webview candidates are installation evidence, not usable backends.
func (*Graph) ResolveInventory ¶
ResolveInventory reads the CTX projection from the public graph. A blank runtime returns every context. Redacted selections remain in the graph for inspection but cannot be used as executable candidates.
func (*Graph) ScanHost ¶
func (g *Graph) ScanHost(ctx context.Context) (HostInventory, error)
ScanHost refreshes all host inventories in the graph and returns the facts.
func (*Graph) ScanProcesses ¶
func (g *Graph) ScanProcesses(ctx context.Context, options ProcessOptions) (ProcessSnapshot, error)
ScanProcesses discovers and reconciles the caller-visible process inventory.
type HostCandidates ¶
type HostCandidates struct {
Operation string `json:"operation"`
Shells []ShellInfo `json:"shells,omitempty"`
Filesystems []FilesystemInfo `json:"filesystems,omitempty"`
Webviews []WebviewInfo `json:"webviews,omitempty"`
ObservedAt map[string]time.Time `json:"observed_at"`
}
type HostInventory ¶
type HostInventory struct {
Shells []ShellInfo `json:"shells"`
Filesystems []FilesystemInfo `json:"filesystems"`
Webviews []WebviewInfo `json:"webviews"`
Desktop *DesktopInfo `json:"desktop,omitempty"`
Surfaces *SurfaceSnapshot `json:"surfaces,omitempty"`
Accessibility *AccessibilitySnapshot `json:"accessibility,omitempty"`
Permissions *PermissionSnapshot `json:"permissions,omitempty"`
Resources *ResourceInfo `json:"resources,omitempty"`
// contains filtered or unexported fields
}
HostInventory is discovered directly by the graph library, independently of adapters. Nil slices and pointers in ObserveHost preserve the corresponding inventory; non-nil empty slices remove previously observed entries of that kind.
func DiscoverHost ¶
func DiscoverHost(ctx context.Context) (HostInventory, error)
DiscoverHost returns local host inventory without opening a graph store.
type HostRequirementError ¶
HostRequirementError identifies a failed operation requirement. Cause, when present, preserves OS, context, and backend errors for errors.Is/errors.As.
func (*HostRequirementError) Error ¶
func (err *HostRequirementError) Error() string
func (*HostRequirementError) Unwrap ¶
func (err *HostRequirementError) Unwrap() error
type HostSnapshot ¶
type HostSnapshot struct {
HostInventory
ObservedAt map[string]time.Time `json:"observed_at"`
// contains filtered or unexported fields
}
HostSnapshot is the typed graph view with separate freshness per category.
type InputOptions ¶ added in v0.2.0
InputOptions bounds one atomic native input operation. Zero values select a 4096-rune text ceiling and a five-second deadline.
type Inventory ¶
type Inventory struct {
ObservedAt time.Time `json:"observed_at"`
Contexts []ContextCandidate `json:"contexts"`
}
Inventory is the latest reconciled adapter view. ObservedAt is refreshed on every scan, even when the set of contexts is unchanged.
type OperationRequirements ¶
type OperationRequirements struct {
Operation string `json:"operation"`
Shell *ShellRequirement `json:"shell,omitempty"`
Filesystem *FilesystemRequirement `json:"filesystem,omitempty"`
Webview *WebviewRequirement `json:"webview,omitempty"`
MaxAge time.Duration `json:"-"`
}
OperationRequirements describes host resources needed by a caller. Non-nil requirements are conjunctive. Select pins a resource: failure never causes a different resource to be substituted. MaxAge defaults to five seconds; a negative value forces discovery. No adapter or backend is chosen by name.
type PermissionInfo ¶ added in v0.2.0
type PermissionInfo struct {
State string `json:"state"`
Scope string `json:"scope,omitempty"`
Detail string `json:"detail,omitempty"`
}
PermissionInfo reports a native capability's current state without asking for access. State is ready, denied, not-determined, not-required, unsupported, or unavailable. Scope names the OS permission when one exists.
type PermissionSnapshot ¶ added in v0.2.0
type PermissionSnapshot struct {
Platform string `json:"platform"`
ObservedAt time.Time `json:"observed_at"`
Accessibility PermissionInfo `json:"accessibility"`
ScreenRecording PermissionInfo `json:"screen_recording"`
}
PermissionSnapshot contains local OS permission state relevant to desktop observation. Discovery never opens settings or displays a native prompt.
func DiscoverPermissions ¶ added in v0.2.0
func DiscoverPermissions(ctx context.Context) (PermissionSnapshot, error)
DiscoverPermissions reads current local permission state without requesting access or changing OS settings.
type PreparedHost ¶
type PreparedHost struct {
Operation string `json:"operation"`
Shell *ShellInfo `json:"shell,omitempty"`
Filesystem *FilesystemInfo `json:"filesystem,omitempty"`
Webview *WebviewInfo `json:"webview,omitempty"`
ValidatedAt time.Time `json:"validated_at"`
}
PreparedHost contains one validated resource per requirement. This does not authorize execution, reserve capacity, or eliminate races with OS changes.
type ProcessInfo ¶
type ProcessInfo struct {
PID int `json:"pid"`
ParentPID int `json:"parent_pid"`
Name string `json:"name"`
StartID string `json:"start_id,omitempty"`
Executable string `json:"executable,omitempty"`
Owner string `json:"owner,omitempty"`
Application *ApplicationInfo `json:"application,omitempty"`
Usage *ProcessUsage `json:"usage,omitempty"`
Coverage map[string]CollectionStatus `json:"coverage"`
Resources []ProcessResource `json:"resources,omitempty"`
// contains filtered or unexported fields
}
ProcessInfo identifies a process instance using PID and an OS start identity. StartID is opaque and platform-specific. Empty StartID means identity could not be established; such entries are returned but never projected as stable nodes.
type ProcessOptions ¶
ProcessOptions bounds returned records and collection time. Zero values select 4096 processes, 1024 resources per category, and a ten-second deadline. Detailed resource inspection is opt-in through InspectProcess.
type ProcessResource ¶
type ProcessResource struct {
Kind string `json:"kind"`
Path string `json:"path,omitempty"`
Descriptor string `json:"descriptor,omitempty"`
Protocol string `json:"protocol,omitempty"`
LocalAddress string `json:"local_address,omitempty"`
RemoteAddress string `json:"remote_address,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
State string `json:"state,omitempty"`
}
ProcessResource is OS evidence. A socket does not imply an automation API. Endpoint preserves an OS-rendered address when its roles cannot be established. Descriptors are process-local observations, not reusable handles.
type ProcessSnapshot ¶
type ProcessSnapshot struct {
HostID string `json:"host_id"`
Scope string `json:"scope"`
ObservedAt time.Time `json:"observed_at"`
Enumeration CollectionStatus `json:"enumeration"`
Processes []ProcessInfo `json:"processes"`
}
ProcessSnapshot is a non-atomic, point-in-time OS observation. Scope is all or process; only complete all-process enumeration permits removing absent PIDs. HostID includes the boot/namespace identity so records cannot cross reboots.
func DiscoverProcesses ¶
func DiscoverProcesses(ctx context.Context, options ProcessOptions) (ProcessSnapshot, error)
DiscoverProcesses collects identities without scanning every process's files. Processes hidden by the OS are outside this caller-visible inventory.
func InspectProcess ¶
func InspectProcess(ctx context.Context, pid int, options ProcessOptions) (ProcessSnapshot, error)
InspectProcess inspects one process and checks its identity again afterwards. Resources collected during exit or PID reuse are discarded, never reassigned.
type ProcessUsage ¶
type RecordingInfo ¶ added in v0.2.0
type RecordingInfo struct {
Status string `json:"status"`
EncoderAvailable bool `json:"encoder_available"`
CaptureAvailable bool `json:"capture_available"`
Permission string `json:"permission"`
Formats []string `json:"formats,omitempty"`
Message string `json:"message,omitempty"`
CheckedAt time.Time `json:"checked_at"`
}
RecordingInfo describes local recording prerequisites. Permission is an identifier for the embedding application to interpret; discovery never opens settings, requests permission, or starts a capture.
type RelationObservation ¶
type RelationObservation struct{ From, To, Kind string }
RelationObservation connects two resources reported by the same adapter.
type ResourceInfo ¶ added in v0.2.0
type ResourceInfo struct {
OS string `json:"os"`
Architecture string `json:"architecture"`
ObservedAt time.Time `json:"observed_at"`
LogicalCPUs int `json:"logical_cpus"`
CPUCapacity float64 `json:"cpu_capacity"`
CPUStatus CollectionStatus `json:"cpu_status"`
MemoryBytes uint64 `json:"memory_bytes"`
MemoryCapacityBytes uint64 `json:"memory_capacity_bytes"`
MemoryStatus CollectionStatus `json:"memory_status"`
Container ContainerInfo `json:"container"`
Uptime *time.Duration `json:"uptime,omitempty"`
BootTime *time.Time `json:"boot_time,omitempty"`
UptimeStatus CollectionStatus `json:"uptime_status"`
}
ResourceInfo is a point-in-time observation of the local machine's computing resources. Container-adjusted values never guess: a field whose native source is unavailable carries a non-complete status instead of the host value.
It is local host state only. Network shape stays in res/system/network and is never duplicated here.
func DiscoverResources ¶ added in v0.2.0
func DiscoverResources(ctx context.Context) (ResourceInfo, error)
DiscoverResources observes the local machine's CPU, memory, container state, and uptime. It reads local files and system counters only: no command is launched, no network is contacted, and no identity or protocol is attached.
type ResourceObservation ¶
ResourceObservation identifies a resource in one observed context. ID is adapter-local; the graph stores a digest rather than the raw identifier.
type ShellInfo ¶
type ShellInfo struct {
Name string `json:"name"`
Path string `json:"path"`
ResolvedPath string `json:"resolved_path"`
ConfiguredDefault bool `json:"configured_default"`
Sources []string `json:"sources"`
}
ShellInfo describes an executable available to this host user. Discovery checks paths and permissions without launching the executable. The configured default is an environment declaration, not proof of the current process.
func DiscoverShells ¶
DiscoverShells finds registered shells, standard shell executable names on PATH, platform shell locations, and a configured SHELL/ComSpec executable. Registered and configured paths can identify shells with arbitrary names.
type ShellRequirement ¶
type SurfaceBounds ¶ added in v0.2.0
type SurfaceBounds struct {
X int `json:"x"`
Y int `json:"y"`
Width int `json:"width"`
Height int `json:"height"`
}
SurfaceBounds is a rectangle in the snapshot's coordinate space. Width and height are always positive. Coordinates may be negative on multi-display desktops.
type SurfaceCapture ¶ added in v0.2.0
type SurfaceCapture struct {
Format string `json:"format"`
Width int `json:"width"`
Height int `json:"height"`
Data []byte `json:"data"`
CapturedAt time.Time `json:"captured_at"`
}
SurfaceCapture is an encoded image captured from one observed window. Data contains the image bytes directly; transport encodings belong to callers.
func CaptureDesktop ¶ added in v0.2.0
func CaptureDesktop(ctx context.Context, driver DesktopDriver, options CaptureOptions) (SurfaceCapture, error)
CaptureDesktop captures the caller's desktop through an explicitly selected driver. Bounds and result validation are the same as CaptureWindow.
func CaptureWindow ¶ added in v0.2.0
func CaptureWindow(ctx context.Context, target WindowInfo, options CaptureOptions) (SurfaceCapture, error)
CaptureWindow captures a currently observed window after revalidating its opaque ID and process generation. It never prompts for permission, selects a target, persists the image, or applies caller policy.
type SurfaceInput ¶ added in v0.2.0
type SurfaceInput struct {
Kind SurfaceInputKind `json:"kind"`
Point SurfacePoint `json:"point,omitempty"`
End SurfacePoint `json:"end,omitempty"`
Button string `json:"button,omitempty"`
DeltaX int `json:"delta_x,omitempty"`
DeltaY int `json:"delta_y,omitempty"`
Text string `json:"text,omitempty"`
Key string `json:"key,omitempty"`
Modifiers []string `json:"modifiers,omitempty"`
}
SurfaceInput describes one atomic operation. Point is used by pointer operations, End by drag, DeltaX/DeltaY by scroll, Text by keyboard-text, and Key/Modifiers by keyboard-key.
type SurfaceInputKind ¶ added in v0.2.0
type SurfaceInputKind string
SurfaceInputKind identifies one bounded, atomic native input operation.
const ( SurfaceInputMove SurfaceInputKind = "pointer-move" SurfaceInputClick SurfaceInputKind = "pointer-click" SurfaceInputDrag SurfaceInputKind = "pointer-drag" SurfaceInputScroll SurfaceInputKind = "pointer-scroll" SurfaceInputText SurfaceInputKind = "keyboard-text" SurfaceInputKey SurfaceInputKind = "keyboard-key" )
type SurfaceOptions ¶ added in v0.2.0
SurfaceOptions bounds returned metadata and collection time. Zero values select 64 displays, 4096 windows, and a five-second deadline.
type SurfacePoint ¶ added in v0.2.0
SurfacePoint uses window-local coordinates in the current window bounds.
type SurfaceSnapshot ¶ added in v0.2.0
type SurfaceSnapshot struct {
Platform string `json:"platform"`
CoordinateSpace string `json:"coordinate_space"`
ObservedAt time.Time `json:"observed_at"`
Displays []DisplayInfo `json:"displays"`
Windows []WindowInfo `json:"windows"`
DisplayStatus CollectionStatus `json:"display_status"`
WindowStatus CollectionStatus `json:"window_status"`
}
SurfaceSnapshot is a bounded, non-atomic observation of local displays and windows. Separate statuses distinguish an empty desktop from unavailable or truncated native data.
func DiscoverSurfaces ¶ added in v0.2.0
func DiscoverSurfaces(ctx context.Context, options SurfaceOptions) (SurfaceSnapshot, error)
DiscoverSurfaces observes local display geometry and caller-visible windows. It does not request permission, capture pixels, read window titles, expose native handles, synthesize input, or contact a remote service.
type WebviewInfo ¶
type WebviewInfo struct {
Name string `json:"name"`
Engine string `json:"engine"`
API string `json:"api"`
Version string `json:"version,omitempty"`
ABIVersion string `json:"abi_version,omitempty"`
Architecture string `json:"architecture,omitempty"`
Location string `json:"location"`
ResolvedPath string `json:"resolved_path,omitempty"`
Scope string `json:"scope"`
Source string `json:"source"`
DetailError string `json:"detail_error,omitempty"`
}
WebviewInfo describes evidence of a shared web rendering runtime. Discovery does not load the runtime or establish that a particular app can use it. Location is a framework/library path or a Windows registry location. Version is the runtime version; ABIVersion is a library API/ABI generation, not the underlying WebKit or Chromium version.
func DiscoverWebviews ¶
func DiscoverWebviews(ctx context.Context) ([]WebviewInfo, error)
DiscoverWebviews inventories host webview runtimes without launching a browser, reading app profiles, or depending on installed CTX adapters.
type WebviewRequirement ¶
type WebviewRequirement struct {
Select string `json:"select,omitempty"` // Discovery location.
Engine string `json:"engine,omitempty"`
API string `json:"api,omitempty"`
ABIVersion string `json:"abi_version,omitempty"`
Version string `json:"version,omitempty"` // Exact runtime version, when known.
Architecture string `json:"architecture,omitempty"`
}
type WebviewValidator ¶
type WebviewValidator func(context.Context, WebviewInfo) error
WebviewValidator belongs to the embedding backend. It must establish that this backend can use the selected runtime, including its ABI and dependencies.
type WindowInfo ¶ added in v0.2.0
type WindowInfo struct {
ID string `json:"id"`
PID int `json:"pid"`
ProcessStartID string `json:"process_start_id"`
Bounds SurfaceBounds `json:"bounds"`
OnScreen bool `json:"on_screen"`
}
WindowInfo describes an on-screen top-level window. It intentionally omits titles, application names, native handles, pixels, and input endpoints. ProcessStartID binds PID to a process generation when the OS exposes one.
Source Files
¶
- accessibility.go
- accessibility_other.go
- desktop.go
- desktop_driver.go
- host.go
- host_filesystems_linux.go
- host_shells_unix.go
- host_webviews.go
- host_webviews_linux.go
- inventory.go
- permission.go
- process.go
- process_graph.go
- process_linux.go
- requirements.go
- requirements_linux.go
- requirements_unix.go
- resolve.go
- resources.go
- resources_linux.go
- surface.go
- surface_control.go
- surface_control_other.go
- surface_linux_cgo.go
- system.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package audio defines bounded, transport-free audio device observation and caller-selected capture or playback.
|
Package audio defines bounded, transport-free audio device observation and caller-selected capture or playback. |
|
Package clipboard defines bounded, transport-free access to a native system clipboard.
|
Package clipboard defines bounded, transport-free access to a native system clipboard. |
|
credential
|
|
|
adapterkit
Package adapterkit implements the portable process framing for credential store adapters.
|
Package adapterkit implements the portable process framing for credential store adapters. |
|
client
Package client reads credentials through CTX's installed adapter protocol.
|
Package client reads credentials through CTX's installed adapter protocol. |
|
examples
|
|
|
consumer-shaped
command
This consumer-owned example uses consumer-shaped names to demonstrate that CTX accepts arbitrary namespaces and leaves semantic validation to the consumer.
|
This consumer-owned example uses consumer-shaped names to demonstrate that CTX accepts arbitrary namespaces and leaves semantic validation to the consumer. |
|
Package graph provides a generic, namespaced, directed graph store.
|
Package graph provides a generic, namespaced, directed graph store. |
|
Package media provides bounded, transport-free media primitives shared by local system capture and playback implementations.
|
Package media provides bounded, transport-free media primitives shared by local system capture and playback implementations. |
|
Package network observes the local network stack.
|
Package network observes the local network stack. |
|
Package service defines portable per-user OS service definitions and their registration lifecycle.
|
Package service defines portable per-user OS service definitions and their registration lifecycle. |
|
network/linux/guest
module
|
|
|
Package share defines the bounded, transport-free model that mobile share and keyboard extensions use to hand text, links, and attachment references to their containing application.
|
Package share defines the bounded, transport-free model that mobile share and keyboard extensions use to hand text, links, and attachment references to their containing application. |
|
Package supervisor runs generic local component processes and projects their observed lifecycle into a graph.
|
Package supervisor runs generic local component processes and projects their observed lifecycle into a graph. |
|
Package volume provides bounded snapshot and restore mechanics for a caller-selected local volume or directory.
|
Package volume provides bounded snapshot and restore mechanics for a caller-selected local volume or directory. |