work

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 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

Index

Constants

View Source
const (
	StatusPending   = "pending"
	StatusRunning   = "running"
	StatusCompleted = "completed"
	StatusFailed    = "failed"
	StatusCanceled  = "canceled"
)
View Source
const (
	KindWebResearch = "web_research"
	KindSubagent    = "subagent"
)

Variables

View Source
var ErrNotFound = errors.New("work: not found")

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	ID           string    `json:"id"`
	JobID        string    `json:"job_id"`
	SourceID     string    `json:"source_id,omitempty"`
	SourceURL    string    `json:"source_url,omitempty"`
	Kind         string    `json:"kind"`
	Path         string    `json:"path"`
	MIMEType     string    `json:"mime_type,omitempty"`
	ByteCount    int64     `json:"byte_count,omitempty"`
	Summary      string    `json:"summary,omitempty"`
	MetadataJSON string    `json:"metadata_json,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
}

type ArtifactStore

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

func NewArtifactStore

func NewArtifactStore(root string) *ArtifactStore

func (*ArtifactStore) Write

func (s *ArtifactStore) Write(jobID string, artifactID string, kind string, data []byte) (string, int64, error)

type Fact

type Fact struct {
	ID           string    `json:"id"`
	JobID        string    `json:"job_id"`
	Claim        string    `json:"claim"`
	Confidence   float64   `json:"confidence,omitempty"`
	SourceIDs    []string  `json:"source_ids,omitempty"`
	ArtifactIDs  []string  `json:"artifact_ids,omitempty"`
	MetadataJSON string    `json:"metadata_json,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
}

type Job

type Job struct {
	ID             string     `json:"id"`
	Kind           string     `json:"kind"`
	Status         string     `json:"status"`
	Task           string     `json:"task,omitempty"`
	Summary        string     `json:"summary,omitempty"`
	ResultJSON     string     `json:"result_json,omitempty"`
	WorkerRef      string     `json:"worker_ref,omitempty"`
	TokenUsageJSON string     `json:"token_usage_json,omitempty"`
	InputJSON      string     `json:"input_json,omitempty"`
	Error          string     `json:"error,omitempty"`
	Attempts       int        `json:"attempts,omitempty"`
	HeartbeatAt    *time.Time `json:"heartbeat_at,omitempty"`
	StartedAt      *time.Time `json:"started_at,omitempty"`
	CreatedAt      time.Time  `json:"created_at"`
	UpdatedAt      time.Time  `json:"updated_at"`
	FinishedAt     *time.Time `json:"finished_at,omitempty"`
}

type JobFilter

type JobFilter struct {
	Kinds      []string
	KindPrefix string
	Statuses   []string
	WorkerRef  string
	Before     *time.Time
	Limit      int
}

type SQLiteStore

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

func NewSQLiteStore

func NewSQLiteStore(path string) (*SQLiteStore, error)

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

func (*SQLiteStore) CreateArtifact

func (s *SQLiteStore) CreateArtifact(ctx context.Context, artifact Artifact) error

func (*SQLiteStore) CreateJob

func (s *SQLiteStore) CreateJob(ctx context.Context, job Job) error

func (*SQLiteStore) DeleteJob

func (s *SQLiteStore) DeleteJob(ctx context.Context, id string) error

func (*SQLiteStore) DeleteJobsByWorkerRef

func (s *SQLiteStore) DeleteJobsByWorkerRef(ctx context.Context, workerRef string) error

func (*SQLiteStore) GetJob

func (s *SQLiteStore) GetJob(ctx context.Context, id string) (Job, error)

func (*SQLiteStore) ListArtifacts

func (s *SQLiteStore) ListArtifacts(ctx context.Context, jobID string) ([]Artifact, error)

func (*SQLiteStore) ListArtifactsForExpiredJobs

func (s *SQLiteStore) ListArtifactsForExpiredJobs(ctx context.Context, kind string, before time.Time) ([]Artifact, error)

func (*SQLiteStore) ListFacts

func (s *SQLiteStore) ListFacts(ctx context.Context, jobID string) ([]Fact, error)

func (*SQLiteStore) ListJobs

func (s *SQLiteStore) ListJobs(ctx context.Context, filter JobFilter) ([]Job, error)

func (*SQLiteStore) ReplaceFacts

func (s *SQLiteStore) ReplaceFacts(ctx context.Context, jobID string, facts []Fact) error

func (*SQLiteStore) UpdateJob

func (s *SQLiteStore) UpdateJob(ctx context.Context, job Job) error

type Store

type Store interface {
	CreateJob(ctx context.Context, job Job) error
	UpdateJob(ctx context.Context, job Job) error
	GetJob(ctx context.Context, id string) (Job, error)
	ListJobs(ctx context.Context, filter JobFilter) ([]Job, error)
	DeleteJob(ctx context.Context, id string) error
	DeleteJobsByWorkerRef(ctx context.Context, workerRef string) error

	CreateArtifact(ctx context.Context, artifact Artifact) error
	ListArtifacts(ctx context.Context, jobID string) ([]Artifact, error)
	ListArtifactsForExpiredJobs(ctx context.Context, kind string, before time.Time) ([]Artifact, error)

	ReplaceFacts(ctx context.Context, jobID string, facts []Fact) error
	ListFacts(ctx context.Context, jobID string) ([]Fact, error)
}

Jump to

Keyboard shortcuts

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