Documentation
¶
Index ¶
- Constants
- Variables
- func ApprovalObserver(events Service, lookup SessionLookup) func(ctx context.Context, approval runtimetypes.HITLApproval, approved bool)
- func LeaseFileName(workspaceID, root string) string
- func ParseScheduleInterval(value string) (time.Duration, error)
- func RelativePath(root, candidate string) (string, error)
- func Scope(workspaceID, root string) string
- func StartRetention(ctx context.Context, log PartitionPruner, setting RetentionSetting, ...) func()
- func Subject(workspaceID, root string) string
- func SweepRetention(ctx context.Context, log PartitionPruner, setting RetentionSetting, ...) ([]string, error)
- func TopicRecord(scope, topic, source string, payload json.RawMessage, at time.Time) (runtimetypes.Event, error)
- func ValidTopic(name string) bool
- type Event
- type Input
- type PartitionPruner
- type RetentionSetting
- type Roots
- type Schedule
- type Schedules
- func (s Schedules) Change(ctx context.Context, scope, id string, enabled *bool) error
- func (s Schedules) Create(ctx context.Context, scope string, req Schedule, now time.Time) (Schedule, error)
- func (s Schedules) Drain(ctx context.Context, scope string, now time.Time) ([]Event, error)
- func (s Schedules) List(ctx context.Context, scope string) ([]Schedule, error)
- func (s Schedules) Page(ctx context.Context, scope, cursor string, limit int) ([]Schedule, string, error)
- type Service
- type SessionLookup
- type SessionResolver
- type SkipFunc
- type TaskEventBridge
- type Watcher
- type WatcherConfig
Constants ¶
View Source
const ( SourceHuman = "human" SourceAgent = "agent" SourceSchedule = "schedule" SourceEditor = "editor" SourceWatcher = "watcher" SourceTool = "tool" SourceTerminal = "terminal" SourceApproval = "approval" SourceTrigger = "trigger" )
View Source
const ( TypeEventFired = "event.fired" TypeFSCreated = "fs.created" TypeFSModified = "fs.modified" TypeFSDeleted = "fs.deleted" TypeFSMoved = "fs.moved" TypeFSRescan = "fs.rescan" TypeEditorOpened = "editor.opened" TypeEditorClosed = "editor.closed" TypeEditorSaved = "editor.saved" TypeEditorDirty = "editor.dirty" TypeEditorClean = "editor.clean" TypeEditorSelection = "editor.selection" TypeTerminalStarted = "terminal.started" TypeTerminalExited = "terminal.exited" TypeToolWrote = "tool.wrote" TypeToolRan = "tool.ran" TypeApprovalDecided = "approval.decided" TypeTriggerStarted = "trigger.started" TypeTriggerSettled = "trigger.settled" )
View Source
const ( MaxDataBytes = 4096 MaxSubjectBytes = 1024 )
View Source
const DefaultRetentionSweep = 6 * time.Hour
Variables ¶
View Source
var ( ErrUnknownType = errors.New("workspaceevents: unknown event type") ErrSourceMismatch = errors.New("workspaceevents: event type does not belong to this source") ErrInvalidSubject = errors.New("workspaceevents: invalid subject") ErrInvalidData = errors.New("workspaceevents: data must be a JSON object") ErrDataTooLarge = errors.New("workspaceevents: data exceeds the size limit") ErrRootNotGranted = errors.New("workspaceevents: root is not a granted workspace root") )
View Source
var ErrDirectoryLimit = errors.New("workspaceevents: directory watch limit reached; deeper changes are not reported")
View Source
var ErrSchedule = errors.New("invalid schedule")
Functions ¶
func ApprovalObserver ¶
func ApprovalObserver(events Service, lookup SessionLookup) func(ctx context.Context, approval runtimetypes.HITLApproval, approved bool)
func LeaseFileName ¶
func RelativePath ¶
func StartRetention ¶
func StartRetention(ctx context.Context, log PartitionPruner, setting RetentionSetting, every time.Duration, tracker libtracker.ActivityTracker) func()
func SweepRetention ¶
func SweepRetention(ctx context.Context, log PartitionPruner, setting RetentionSetting, now time.Time, tracker libtracker.ActivityTracker) ([]string, error)
func TopicRecord ¶
func TopicRecord(scope, topic, source string, payload json.RawMessage, at time.Time) (runtimetypes.Event, error)
func ValidTopic ¶
Types ¶
type PartitionPruner ¶
type RetentionSetting ¶
type Schedule ¶
type Schedule struct {
CreatedBy string `json:"createdBy,omitempty"`
ID string `json:"id"`
Topic string `json:"topic"`
Payload json.RawMessage `json:"payload,omitempty"`
At *time.Time `json:"at,omitempty"`
Every string `json:"every,omitempty"`
Cron string `json:"cron,omitempty"`
Timezone string `json:"timezone,omitempty"`
Next time.Time `json:"next"`
Enabled bool `json:"enabled"`
}
type Schedules ¶
type Service ¶
type Service interface {
AnnounceCommitted(context.Context, string, Event)
GrantedRoot(candidate string) (string, error)
Append(ctx context.Context, root string, in Input) (Event, error)
AppendBatch(ctx context.Context, root string, ins []Input) ([]Event, error)
Since(ctx context.Context, root string, afterNID int64, limit int) ([]Event, error)
Recent(ctx context.Context, root string, beforeNID int64, limit int, filter ...runtimetypes.EventQuery) ([]Event, error)
Latest(ctx context.Context, root string) (int64, error)
Subscribe(ctx context.Context, root string, ch chan<- []byte) (libbus.Subscription, error)
}
type SessionLookup ¶
type SessionResolver ¶
type TaskEventBridge ¶
type TaskEventBridge struct {
// contains filtered or unexported fields
}
func NewTaskEventBridge ¶
func NewTaskEventBridge(inner taskengine.TaskEventSink, events Service, session SessionResolver) *TaskEventBridge
func (*TaskEventBridge) PublishTaskEvent ¶
func (b *TaskEventBridge) PublishTaskEvent(ctx context.Context, event taskengine.TaskEvent) error
func (*TaskEventBridge) Wants ¶
func (b *TaskEventBridge) Wants(kind taskengine.TaskEventKind) bool
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func NewWatcher ¶
func NewWatcher(events Service, roots Roots, cfg WatcherConfig) *Watcher
Click to show internal directories.
Click to hide internal directories.