Documentation
¶
Overview ¶
Package observation defines shared ledger observations and host-selection contracts.
Package observation owns the ledger's wire records. These records contain no OS mechanisms.
Index ¶
- Constants
- func SafeOrigin(raw string) (scheme, host string, ok bool)
- type AccessibilityElement
- type AccessibilitySnapshot
- type AdapterObservation
- type AliasObservation
- type ApplicationInfo
- type CollectionStatus
- type ContainerInfo
- type ContextCandidate
- type ContextObservation
- type ContextProgram
- type DesktopEndpoint
- type DesktopInfo
- type DisplayInfo
- type FilesystemInfo
- type FilesystemRequirement
- type FilesystemSpace
- type HostCandidates
- type HostInventory
- type HostRequirementError
- type HostSnapshot
- type InstallerObservation
- type Inventory
- type OperationRequirements
- type PermissionInfo
- type PermissionSnapshot
- type PowerInfo
- type PreparedHost
- type ProcessInfo
- type ProcessOptions
- type ProcessResource
- type ProcessSnapshot
- type ProcessUsage
- type ProgramCandidate
- type RecordingInfo
- type RelationObservation
- type ResourceInfo
- type ResourceObservation
- type ShellInfo
- type ShellRequirement
- type StorageInfo
- type SurfaceBounds
- type SurfaceSnapshot
- type WebviewInfo
- type WebviewRequirement
- type WebviewValidator
- type WindowInfo
Constants ¶
const Namespace = "ext.system"
Variables ¶
This section is empty.
Functions ¶
func SafeOrigin ¶
SafeOrigin parses a navigation URL and returns only scheme and
Types ¶
type AccessibilityElement ¶
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"`
}
type AccessibilitySnapshot ¶
type AccessibilitySnapshot struct {
Platform string `json:"platform"`
ObservedAt time.Time `json:"observed_at"`
Status CollectionStatus `json:"status"`
Elements []AccessibilityElement `json:"elements"`
}
type AdapterObservation ¶
type AdapterObservation struct {
Name, Runtime, Selector string
DiscoveryStatus string
Surfaces, Capabilities, Supports []string
Engine, Role []string
Trusted, ListSupported, ObserveSupported, Listed bool
Contexts []ContextObservation
// Programs are the executables the consumer found for the commands this adapter
// declares. They are machine facts: the graph holds one vertex per file, however
// many adapters were given it.
Programs []ProgramCandidate
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 ¶
type CollectionStatus ¶
type ContainerInfo ¶
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"`
Engine []string `json:"engine,omitempty"`
Role []string `json:"role,omitempty"`
Program *ContextProgram `json:"program,omitempty"`
// Default marks the adapter the user prefers for the kind a resolve asked for.
// It filters nothing; a caller that wants one adapter asks for a pick.
Default bool `json:"default,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 ContextProgram ¶
type ContextProgram struct {
Path string `json:"path"`
RealPath string `json:"realpath"`
Version string `json:"version,omitempty"`
OnPath bool `json:"on_path,omitempty"`
Installers []string `json:"installers,omitempty"`
// Suggested names installers the adapter that runs the file guessed from its
// location. It is not a fact; see "installers".
Suggested []string `json:"suggested_installers,omitempty"`
}
ContextProgram is the executable a context runs, as observed. Installers names the installer adapters that reported the file; it is empty when the file was found on PATH alone. The file may have been replaced since the scan.
type DesktopEndpoint ¶
type DesktopInfo ¶
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"`
}
type DisplayInfo ¶
type DisplayInfo struct {
ID string `json:"id"`
Bounds SurfaceBounds `json:"bounds"`
Scale float64 `json:"scale,omitempty"`
Primary bool `json:"primary"`
}
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"`
}
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 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"`
ShellSearchPath *string `json:"-"`
}
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.
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"`
Environment map[string]string `json:"-"`
}
HostSnapshot is the typed graph view with separate freshness per category.
type InstallerObservation ¶
type InstallerObservation struct {
Name, Source string
}
InstallerObservation declares an installer that is not an adapter, such as one the user described in their own configuration. Installers that are adapters (role "installer") need no entry here.
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 ¶
type PermissionSnapshot ¶
type PermissionSnapshot struct {
Platform string `json:"platform"`
ObservedAt time.Time `json:"observed_at"`
Accessibility PermissionInfo `json:"accessibility"`
ScreenRecording PermissionInfo `json:"screen_recording"`
}
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"`
}
type ProcessOptions ¶
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"`
}
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"`
}
type ProcessUsage ¶
type ProgramCandidate ¶
type ProgramCandidate struct {
Name string `json:"name"`
Path string `json:"path"`
RealPath string `json:"realpath"`
Version string `json:"version,omitempty"`
Source string `json:"source"`
OnPath bool `json:"on_path,omitempty"`
Installers []string `json:"installers,omitempty"`
Attributes map[string]any `json:"attributes,omitempty"`
}
type RecordingInfo ¶
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"`
}
type RelationObservation ¶
type RelationObservation struct{ From, To, Kind string }
RelationObservation connects two resources reported by the same adapter.
type ResourceInfo ¶
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"`
Storage []StorageInfo `json:"storage,omitempty"`
Power *PowerInfo `json:"power,omitempty"`
Container ContainerInfo `json:"container"`
UptimeSeconds *float64 `json:"uptime_seconds,omitempty"`
BootTime *time.Time `json:"boot_time,omitempty"`
UptimeStatus CollectionStatus `json:"uptime_status"`
}
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 ShellRequirement ¶
type StorageInfo ¶
type SurfaceBounds ¶
type SurfaceSnapshot ¶
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"`
}
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"`
}
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 ¶
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"`
}