workflows

package
v1.0.0-rc.12 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 23 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

Overview

Package workflows runs project-owned JavaScript against a narrow document API.

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = errors.New("workflow conflict")

Functions

func Definitions

func Definitions(dir string) ([]string, error)

Types

type Change

type Change struct {
	Path       string `json:"path"`
	BeforeHash string `json:"beforeHash"`
	Before     string `json:"before,omitempty"`
	After      string `json:"after,omitempty"`
	Binary     []byte `json:"binary,omitempty"`
}

type Definition

type Definition struct {
	Name     string `json:"name"`
	Source   string `json:"source"`
	Revision string `json:"revision"`
}

func Load

func Load(dir, name string) (Definition, error)

type Invocation

type Invocation struct {
	Name, Revision, ID, Origin string
	EventNID                   int64
	Payload                    json.RawMessage
}

type ModelFunc

type ModelFunc func(context.Context, string) (string, Usage, error)

type Run

type Run struct {
	EventNID      int64     `json:"eventNid,omitempty"`
	RequireLatest bool      `json:"requireLatest,omitempty"`
	HasPacket     bool      `json:"hasPacket,omitempty"`
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	Revision      string    `json:"revision"`
	Origin        string    `json:"origin"`
	Status        string    `json:"status"`
	Summary       string    `json:"summary"`
	Error         string    `json:"error,omitempty"`
	Created       time.Time `json:"created"`
	Updated       time.Time `json:"updated"`
	Changes       []Change  `json:"changes,omitempty"`
	Model         *Usage    `json:"model,omitempty"`
}

type Service

type Service struct {
	DB            libdb.DBManager
	WorkspaceID   string
	Model         ModelFunc
	AuthorizeRead func(context.Context, string) error
	// contains filtered or unexported fields
}

func (*Service) Decide

func (s *Service) Decide(ctx context.Context, dir, id, decision string) (Run, error)

func (*Service) Get

func (s *Service) Get(ctx context.Context, dir, id string) (Run, error)

func (*Service) Recent

func (s *Service) Recent(ctx context.Context, dir string) ([]Run, error)

func (*Service) Run

func (s *Service) Run(ctx context.Context, dir string, invocation Invocation) (Run, error)

func (*Service) Save

func (s *Service) Save(dir string, d Definition) (Definition, error)

type Usage

type Usage struct {
	Provider     string `json:"provider"`
	Model        string `json:"model"`
	Milliseconds int64  `json:"milliseconds"`
	Input        int    `json:"inputTokens,omitempty"`
	Output       int    `json:"outputTokens,omitempty"`
}

Jump to

Keyboard shortcuts

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