server

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionRequest

type ActionRequest struct {
	SessionID   string       `json:"sessionId"`
	Annotations []Annotation `json:"annotations"`
	Output      string       `json:"output"`
	RequestedAt string       `json:"timestamp"`
}

type Annotation

type Annotation struct {
	ID                   string             `json:"id"`
	SessionID            string             `json:"sessionId,omitempty"`
	X                    float64            `json:"x,omitempty"`
	Y                    float64            `json:"y,omitempty"`
	Comment              string             `json:"comment"`
	Element              string             `json:"element"`
	ElementPath          string             `json:"elementPath"`
	Timestamp            int64              `json:"timestamp,omitempty"`
	SelectedText         string             `json:"selectedText,omitempty"`
	BoundingBox          map[string]any     `json:"boundingBox,omitempty"`
	NearbyText           string             `json:"nearbyText,omitempty"`
	CSSClasses           string             `json:"cssClasses,omitempty"`
	NearbyElements       string             `json:"nearbyElements,omitempty"`
	ComputedStyles       string             `json:"computedStyles,omitempty"`
	FullPath             string             `json:"fullPath,omitempty"`
	Accessibility        string             `json:"accessibility,omitempty"`
	IsMultiSelect        bool               `json:"isMultiSelect,omitempty"`
	IsFixed              bool               `json:"isFixed,omitempty"`
	ReactComponents      string             `json:"reactComponents,omitempty"`
	SourceFile           string             `json:"sourceFile,omitempty"`
	ElementBoundingBoxes []map[string]any   `json:"elementBoundingBoxes,omitempty"`
	URL                  string             `json:"url,omitempty"`
	Intent               AnnotationIntent   `json:"intent,omitempty"`
	Severity             AnnotationSeverity `json:"severity,omitempty"`
	Status               AnnotationStatus   `json:"status,omitempty"`
	Thread               []ThreadMessage    `json:"thread,omitempty"`
	CreatedAt            string             `json:"createdAt,omitempty"`
	UpdatedAt            string             `json:"updatedAt,omitempty"`
	ResolvedAt           string             `json:"resolvedAt,omitempty"`
	ResolvedBy           string             `json:"resolvedBy,omitempty"`
	AuthorID             string             `json:"authorId,omitempty"`
}

type AnnotationIntent

type AnnotationIntent string

type AnnotationSeverity

type AnnotationSeverity string

type AnnotationStatus

type AnnotationStatus string
const (
	StatusPending      AnnotationStatus = "pending"
	StatusAcknowledged AnnotationStatus = "acknowledged"
	StatusResolved     AnnotationStatus = "resolved"
	StatusDismissed    AnnotationStatus = "dismissed"
)

type Event

type Event struct {
	Type      EventType `json:"type"`
	Timestamp string    `json:"timestamp"`
	SessionID string    `json:"sessionId"`
	Sequence  int64     `json:"sequence"`
	Payload   any       `json:"payload"`
}

type EventType

type EventType string
const (
	EventAnnotationCreated EventType = "annotation.created"
	EventAnnotationUpdated EventType = "annotation.updated"
	EventAnnotationDeleted EventType = "annotation.deleted"
	EventSessionCreated    EventType = "session.created"
	EventSessionUpdated    EventType = "session.updated"
	EventSessionClosed     EventType = "session.closed"
	EventThreadMessage     EventType = "thread.message"
	EventActionRequested   EventType = "action.requested"
)

type Service

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

func NewService

func NewService(address string, logger *slog.Logger) *Service

func (*Service) ListenAndServe

func (s *Service) ListenAndServe() error

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

type Session

type Session struct {
	ID        string         `json:"id"`
	URL       string         `json:"url"`
	Status    string         `json:"status"`
	CreatedAt string         `json:"createdAt"`
	UpdatedAt string         `json:"updatedAt,omitempty"`
	ProjectID string         `json:"projectId,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

type SessionWithAnnotations

type SessionWithAnnotations struct {
	Session
	Annotations []Annotation `json:"annotations"`
}

type Store

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

func NewStore

func NewStore() *Store

func (*Store) AddAnnotation

func (s *Store) AddAnnotation(sessionID string, annotation Annotation) (Annotation, bool)

func (*Store) AddThreadMessage

func (s *Store) AddThreadMessage(annotationID, role, content string) (Annotation, bool)

func (*Store) CreateSession

func (s *Store) CreateSession(url, projectID string) Session

func (*Store) DeleteAnnotation

func (s *Store) DeleteAnnotation(id string) (Annotation, bool)

func (*Store) EmitActionRequested

func (s *Store) EmitActionRequested(sessionID string, request ActionRequest)

func (*Store) GetAllAnnotationsNeedingAttention

func (s *Store) GetAllAnnotationsNeedingAttention() []Annotation

func (*Store) GetAllAnnotationsNeedingAttentionByProjectID

func (s *Store) GetAllAnnotationsNeedingAttentionByProjectID(projectID string) []Annotation

func (*Store) GetAnnotation

func (s *Store) GetAnnotation(id string) (Annotation, bool)

func (*Store) GetAnnotationsNeedingAttention

func (s *Store) GetAnnotationsNeedingAttention(sessionID string) []Annotation

func (*Store) GetEventsSince

func (s *Store) GetEventsSince(sessionID string, sequence int64) []Event

func (*Store) GetSession

func (s *Store) GetSession(id string) (Session, bool)

func (*Store) GetSessionAnnotations

func (s *Store) GetSessionAnnotations(sessionID string) []Annotation

func (*Store) GetSessionWithAnnotations

func (s *Store) GetSessionWithAnnotations(id string) (SessionWithAnnotations, bool)

func (*Store) ListSessions

func (s *Store) ListSessions() []Session

func (*Store) SubscribeAll

func (s *Store) SubscribeAll() (<-chan Event, func())

func (*Store) SubscribeSession

func (s *Store) SubscribeSession(sessionID string) (<-chan Event, func())

func (*Store) TouchProject

func (s *Store) TouchProject(projectID string)

func (*Store) TouchSession

func (s *Store) TouchSession(sessionID string)

func (*Store) UpdateAnnotation

func (s *Store) UpdateAnnotation(id string, patch map[string]any) (Annotation, bool)

type ThreadMessage

type ThreadMessage struct {
	ID        string `json:"id"`
	Role      string `json:"role"`
	Content   string `json:"content"`
	Timestamp int64  `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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