activity

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0 Imports: 11 Imported by: 1 module, 4 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 activity reports process-owned tasks, observations, and messages to the host.

Index

Constants

View Source
const Version uint32 = 1

Variables

View Source
var ErrUnavailable = errors.New("activity reporter is unavailable")

Functions

func RegisterServer

func RegisterServer(reg grpc.ServiceRegistrar, reporter Reporter)

func ValidateRequest

func ValidateRequest(operation string, request any) error

ValidateRequest validates data shape; the host still checks ownership and transitions.

Types

type Alert

type Alert struct {
	Key            string `json:"key"`
	State          string `json:"state"`
	Occurrences    uint64 `json:"occurrences"`
	AcknowledgedAt string `json:"acknowledgedAt,omitempty"`
	SnoozedUntil   string `json:"snoozedUntil,omitempty"`
}

type AlertRequest

type AlertRequest struct {
	Spec
	Key        string `json:"key"`
	ObservedAt string `json:"observedAt"`
}

type BeginTaskRequest

type BeginTaskRequest = Spec

type Binding

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

Binding owns exactly one callback connection for the plugin process lifetime. It does not use delegated host connection grants or caller-supplied identity.

func (*Binding) BeginTask

func (b *Binding) BeginTask(ctx context.Context, v Spec) (Record, error)

func (*Binding) Bind

func (b *Binding) Bind(conn *grpc.ClientConn) error

func (*Binding) Close

func (b *Binding) Close() error

func (*Binding) FinishTask

func (b *Binding) FinishTask(ctx context.Context, v FinishTaskRequest) (Record, error)

func (*Binding) PublishMessage

func (b *Binding) PublishMessage(ctx context.Context, v Spec) (Record, error)

func (*Binding) ReportTask

func (b *Binding) ReportTask(ctx context.Context, v ReportTaskRequest) (Record, error)

func (*Binding) ResolveAlert

func (b *Binding) ResolveAlert(ctx context.Context, v ResolveAlertRequest) (Record, error)

func (*Binding) UpsertAlert

func (b *Binding) UpsertAlert(ctx context.Context, v AlertRequest) (Record, error)

type Change

type Change struct {
	Revision   uint64   `json:"revision"`
	Record     *Record  `json:"record,omitempty"`
	RemovedIDs []string `json:"removedIds,omitempty"`
}

type FinishTaskRequest

type FinishTaskRequest struct {
	ID           string        `json:"id"`
	State        string        `json:"state"`
	Presentation *Presentation `json:"presentation,omitempty"`
}

type Presentation

type Presentation = resourcev2.ActivityPresentation

type Record

type Record struct {
	ID           string       `json:"id"`
	Revision     uint64       `json:"revision"`
	Source       Source       `json:"source"`
	Kind         string       `json:"kind"`
	Severity     string       `json:"severity"`
	CreatedAt    string       `json:"createdAt"`
	UpdatedAt    string       `json:"updatedAt"`
	ObservedAt   string       `json:"observedAt,omitempty"`
	ParentID     string       `json:"parentId,omitempty"`
	Presentation Presentation `json:"presentation"`
	Task         *Task        `json:"task,omitempty"`
	Alert        *Alert       `json:"alert,omitempty"`
	Visibility   Visibility   `json:"visibility"`
}

type ReportTaskRequest

type ReportTaskRequest struct {
	ID           string       `json:"id"`
	Presentation Presentation `json:"presentation"`
	State        string       `json:"state,omitempty"`
	ObservedAt   string       `json:"observedAt,omitempty"`
}

type Reporter

type Reporter interface {
	BeginTask(context.Context, Spec) (Record, error)
	ReportTask(context.Context, ReportTaskRequest) (Record, error)
	FinishTask(context.Context, FinishTaskRequest) (Record, error)
	PublishMessage(context.Context, Spec) (Record, error)
	UpsertAlert(context.Context, AlertRequest) (Record, error)
	ResolveAlert(context.Context, ResolveAlertRequest) (Record, error)
}

Reporter reports observations only. The host supplies authenticated process provenance.

type ResolveAlertRequest

type ResolveAlertRequest struct {
	Key        string `json:"key"`
	ObservedAt string `json:"observedAt"`
}

type SetPresentationRequest

type SetPresentationRequest struct {
	ID             string  `json:"id"`
	Collapsed      *bool   `json:"collapsed,omitempty"`
	ToastDismissed *bool   `json:"toastDismissed,omitempty"`
	Read           *bool   `json:"read,omitempty"`
	SnoozedUntil   *string `json:"snoozedUntil,omitempty"`
	Acknowledged   *bool   `json:"acknowledged,omitempty"`
}

type Snapshot

type Snapshot struct {
	Revision uint64   `json:"revision"`
	Records  []Record `json:"records"`
}

type Source

type Source struct {
	PluginID     string                               `json:"pluginID,omitempty"`
	ConnectionID string                               `json:"connectionID,omitempty"`
	Resource     *resourcev2.ResourceNavigationIntent `json:"resource,omitempty"`
}

type Spec

type Spec struct {
	Presentation Presentation `json:"presentation"`
	Source       *Source      `json:"source,omitempty"`
	Severity     string       `json:"severity,omitempty"`
	ParentID     string       `json:"parentId,omitempty"`
}

type StartResourceActionRequest

type StartResourceActionRequest struct {
	PluginID     string                   `json:"pluginID"`
	Request      resourcev2.ActionRequest `json:"request"`
	Presentation Presentation             `json:"presentation"`
	ParentID     string                   `json:"parentId,omitempty"`
}

type Subscription

type Subscription struct {
	ID       string   `json:"id"`
	Snapshot Snapshot `json:"snapshot"`
}

type Task

type Task struct {
	State         string `json:"state"`
	Cancellation  string `json:"cancellation"`
	UnknownReason string `json:"unknownReason,omitempty"`
}

type Visibility

type Visibility struct {
	Collapsed      bool `json:"collapsed"`
	ToastDismissed bool `json:"toastDismissed"`
	Read           bool `json:"read"`
}

Jump to

Keyboard shortcuts

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