package runnerproto import ( "time" "amadan.net/oficina/equipo/internal/equipo/team" "amadan.net/oficina/equipo/internal/runner/provider" ) type ProcessIdentity struct { PID int `json:"pid"` StartTicks uint64 `json:"start_ticks"` BootID string `json:"boot_id"` } type ProcessOwner struct { LocalOnly bool `json:"local_only"` Attempt team.AttemptID `json:"attempt"` Fence int64 `json:"fence"` Marker string `json:"marker"` AgentID string `json:"agent_id"` Workspace provider.Workspace `json:"workspace"` ExecutorGroups []ProcessIdentity `json:"executor_groups"` } type ProcessInventory struct { Observed []ProcessIdentity `json:"observed"` ExecutorGroups []ProcessIdentity `json:"executor_groups"` Processes []ProcessIdentity `json:"processes"` TerminalIDs []string `json:"terminal_ids"` CoverageKnown bool `json:"coverage_known"` BootID string `json:"boot_id"` CheckedAt time.Time `json:"checked_at"` } type ContainmentProof struct { Unstarted []NamespaceExit `json:"unstarted,omitempty"` Namespaces []NamespaceExit `json:"namespaces,omitempty"` CheckedAt time.Time `json:"checked_at,omitempty"` // Zero identifies a historical proof without a version field. Version int `json:"version,omitempty"` Scope team.Scope `json:"scope"` Handle team.Handle `json:"handle"` Owner ProcessOwner `json:"owner"` Inventory ProcessInventory `json:"inventory"` Observed []ProcessIdentity `json:"observed"` Empty bool `json:"empty"` } type FreezeRequest struct { ExpectedSymptom string `json:"expected_symptom"` DefinitionHash string `json:"definition_hash"` ReproductionHash string `json:"reproduction_hash"` } // NamespaceExit binds an observed init exit to the durable launch identity. type NamespaceExit struct { ID string `json:"id"` AttemptKey string `json:"attempt_key"` BootID string `json:"boot_id"` NamespaceID string `json:"namespace_id"` ManifestHash string `json:"manifest_hash"` HostPID int `json:"host_pid"` StartTicks uint64 `json:"start_ticks"` ExitCode int `json:"exit_code"` Signal int `json:"signal"` ObservedAt time.Time `json:"observed_at"` } type NamespaceContainmentProof struct { Version int `json:"version"` Scope team.Scope `json:"scope"` Handle team.Handle `json:"handle"` Namespaces []NamespaceExit `json:"namespaces"` CheckedAt time.Time `json:"checked_at"` } // NamespaceLaunch is authenticated runner evidence recorded before releasing init. type NamespaceLaunch struct { ID, AttemptKey, OwnerKey, BootID, NamespaceID, ManifestHash, PolicyHash string HostPID int StartTicks uint64 } func (n NamespaceLaunch) Valid(owner string) bool { return n.OwnerKey == owner && n.ID != "" && n.AttemptKey != "" && n.BootID != "" && n.NamespaceID != "" && len(n.ManifestHash) == 64 && len(n.PolicyHash) == 64 && n.HostPID > 0 && n.StartTicks > 0 } func (n NamespaceLaunch) Matches(x NamespaceExit) bool { return n.ID == x.ID && n.AttemptKey == x.AttemptKey && n.BootID == x.BootID && n.NamespaceID == x.NamespaceID && n.ManifestHash == x.ManifestHash && n.HostPID == x.HostPID && n.StartTicks == x.StartTicks && !x.ObservedAt.IsZero() }