service

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 99 Imported by: 1 module, 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 service is the application boundary (ADR-0008): the UI, MCP, CLI and HTTP adapters call it, and it defines the persistence interfaces that web/ implements.

Index

Constants

View Source
const (
	MaxPendingPerSubmitter = 50
	MaxPendingApprovals    = 1000
)

The most requests that may wait for a person at once (SDD-015 section 5). A flood of requests by one agent must not bury the ones that matter or block everyone else, so each submitter has a share of its own: the user in network mode (every key of a user counts together), else the actor. The workspace as a whole has a much larger bound.

View Source
const (
	EventApprovalRequested = "approval.requested"
	EventApprovalDecided   = "approval.decided"
)

The events of the approval queue (SDD-015 section 7).

View Source
const (
	// BundleFormat is the value of the manifest's "format".
	BundleFormat = "stuarty-bundle"

	// BundleVersion is the layout of the container; an importer refuses a higher one. Version 2 adds the
	// production and the timelines after the first (SDD-005 section 16.1.1); version 1 is still read. Version 3
	// is version 2 with no first document, the bundle of a project with no timeline (section 16.1.2): only that
	// bundle carries it, so that a build that reads up to version 2 asks to be updated instead of calling the
	// bundle damaged, and every other bundle stays readable by such a build.
	BundleVersion = 3
)

The container of a project bundle (SDD-005 section 16.1): a zip with the extension .vvbundle and flat entry names.

View Source
const (
	ScopeRead   = "read"
	ScopeEdit   = "edit"
	ScopeMedia  = "media"
	ScopeRender = "render"
	ScopeAdmin  = "admin"
)

Scopes of a caller (ADR-0019, SDD-007 section 4).

View Source
const (
	RoleAdmin  = "admin"
	RoleMember = "member"
)

Roles of network mode (SDD-007 section 4.1).

View Source
const (
	CodeAgentNotFound    = "E_AGENT_NOT_FOUND"
	CodeChatNotFound     = "E_CHAT_NOT_FOUND"
	CodeAgentUnavailable = "E_AGENT_UNAVAILABLE"
)

Codes of the hosted agent chat (SDD-017 section 11).

View Source
const (
	ChatFormatJSON     = "json"
	ChatFormatMarkdown = "markdown"
)

Transcript formats.

View Source
const (
	ModeLocal   = "local"
	ModeNetwork = "network"
)

Modes of the server a Doctor report describes.

View Source
const (
	CodeUnauthorized     = "E_UNAUTHORIZED"
	CodeForbidden        = "E_FORBIDDEN"
	CodePayloadTooLarge  = "E_PAYLOAD_TOO_LARGE"
	CodeNothingToUndo    = "E_NOTHING_TO_UNDO"
	CodeNothingToRedo    = "E_NOTHING_TO_REDO"
	CodeQueueFull        = "E_QUEUE_FULL"
	CodeRateLimited      = "E_RATE_LIMITED"
	CodeWorkspaceLocked  = "E_WORKSPACE_LOCKED"
	CodeLintBlocking     = "E_LINT_BLOCKING"
	CodeClientClosed     = "E_CLIENT_CLOSED"
	CodeMethodNotAllowed = "E_METHOD_NOT_ALLOWED"
	// CodeLocked is an account that exists with nobody signed in: nothing of the user's content is read or
	// written (ADR-0052, SDD-007 section 3.9).
	CodeLocked = "E_LOCKED"

	// CodeConnectionNotFound, CodeConnectionDestination and CodeVaultLocked are the codes of SDD-014 section 7.
	CodeConnectionNotFound    = "E_CONNECTION_NOT_FOUND"
	CodeConnectionDestination = "E_CONNECTION_DESTINATION"
	CodeVaultLocked           = "E_VAULT_LOCKED"
	// CodeWebhookNotFound is declared in webhook_ops.go (SDD-022 section 8).
	// CodePrivilegedSession, CodeApprovalNotFound, CodeCostCeiling and CodeApprovalExpired are the codes of SDD-015 section 8.
	CodePrivilegedSession = "E_PRIVILEGED_SESSION"
	CodeApprovalNotFound  = "E_APPROVAL_NOT_FOUND"
	CodeCostCeiling       = "E_COST_CEILING"
	CodeApprovalExpired   = "E_APPROVAL_EXPIRED"
	// CodePublish is the code of SDD-020 section 11: a network refused or failed a publication.
	CodePublish = "E_PUBLISH"
	// CodeProvider and CodePriceUnknown are the codes of SDD-016 section 8.
	CodeProvider     = "E_PROVIDER"
	CodePriceUnknown = "E_PRICE_UNKNOWN"
)

Codes the service adds to those of the core (SDD-000 section 8).

View Source
const (
	FormatMP4 = "mp4"
	FormatGIF = "gif"
	FormatWAV = "wav"
	FormatAAC = "aac"
	// FormatPNG is one frame at the size of the project, chosen with args.at (VV-037).
	FormatPNG = "png"
)

The formats of an export job (SDD-003 section 2.8, SDD-004 section 8.1). The empty format is mp4.

View Source
const (
	JobImageGenerate = "image.generate"
	JobVoiceGenerate = "voice.generate"
)

The job kinds of image and voice generation (SDD-016 section 6.1).

View Source
const (
	ImageImportReady   = "ready"   // the file is an image of the workspace; the document or the layer was made
	ImageImportPending = "pending" // the ingest of the file outlived wait_ms: nothing was made, import the Hash again
)

The states of an ImageImportResult.

View Source
const (
	JobIngest = "ingest"
	JobExport = "export"
	// JobExportBatch is the parent of an ExportBatch; its children are export jobs (SDD-004 section 8.4).
	JobExportBatch = "export_batch"
	JobFrame       = "frame"
	// JobImageExport records an ImageExport: an image belongs to no project, so the job has none (D-111).
	JobImageExport = "image.export"
)

Job kinds (SDD-000 section 6).

View Source
const (
	JobQueued    = "queued"
	JobRunning   = "running"
	JobSucceeded = "succeeded"
	JobFailed    = "failed"
	JobCancelled = "cancelled"
)

Job states.

View Source
const (
	CodeIngestFailed = "E_INGEST_FAILED"
	CodeExportFailed = "E_EXPORT_FAILED"
	CodeVerifyFailed = "E_VERIFY_FAILED"
	CodeCancelled    = "E_CANCELLED"
)

Codes that describe the outcome of a job (SDD-000 section 8); they travel inside the Job, not as the error of a call.

View Source
const (
	SignInReady       = "ready"
	SignInNeedsSignIn = "needs_sign_in"
)

The states of a sign-in connection (SDD-016 section 12.4).

View Source
const (
	CodeCaptureUnavailable = "E_CAPTURE_UNAVAILABLE"
	CodeCaptureFailed      = "E_CAPTURE_FAILED"
	CodeRecordingNotFound  = "E_RECORDING_NOT_FOUND"
)

The error codes of SDD-025 (SDD-000 section 8).

View Source
const (
	QueueKindIngest = "video.ingest"
	QueueKindExport = "video.export"
	QueueKindFrame  = "video.frame"
	// QueueKindExportBatch is the parent job of an export batch (SDD-004 section 8.4). It runs on the default
	// queue: it holds no encoder, its children are exports that take their own slots.
	QueueKindExportBatch = "video.export_batch"
)

Kinds of the queue messages (SDD-005 section 14.1). The payload of each is {"job_id": "job_..."} and nothing else.

View Source
const (
	AccountReady       = "ready"
	AccountNeedsSignIn = "needs_sign_in"
	// AccountNeedsAccount is a sign-in that reached several accounts and none is chosen yet (SDD-020
	// section 17).
	AccountNeedsAccount = "needs_account"
)

The account states of SDD-020 section 7.6.

View Source
const CodeWebhookNotFound = "E_WEBHOOK_NOT_FOUND"

CodeWebhookNotFound is the code of SDD-022 section 8.

View Source
const EventImageUpdated = "image.updated"

EventImageUpdated is the type of the event a committed batch of an image document publishes.

View Source
const EventPublicationUpdated = "publication.updated"

EventPublicationUpdated is the event of a publication that changed (SDD-020 section 29).

View Source
const (

	// HeavyKey is the part of the limiter key that names the shared bucket.
	HeavyKey = "heavy"
)

heavyOperations are the operations that cost a render, an ingest or an archive read; together they share 10 calls a minute per credential (SDD-007 section 4.4).

View Source
const HeavyPerMinute = heavyPerMinute

HeavyPerMinute is the number of calls the limiter of heavy operations should allow a minute; the web layer builds the limiter with it.

View Source
const ICSContentType = "text/calendar; charset=utf-8"

ICSContentType is the media type of the export.

View Source
const JobFaceTrack = "face_track"

JobFaceTrack is the kind of a face track job (SDD-024 section 6).

View Source
const JobImageEdit = "image.edit"

JobImageEdit is the job kind that removes the background of a layer, or generates an image into a document, with the provider of a connection (SDD-016 section 6.5).

View Source
const JobPublishUpload = "publish.upload"

JobPublishUpload is the job kind of SDD-020 section 10: one post, one connection, after approval.

View Source
const JobTextDraft = "text.draft"

JobTextDraft is the job kind of a draft of a text made with a model (SDD-019 section 6).

View Source
const JobTextGenerate = "text.generate"

JobTextGenerate is the job kind of a text generation (SDD-016 section 6).

View Source
const JobTranscribe = "transcribe"

JobTranscribe is the kind of a transcription job (SDD-011 section 10).

View Source
const JobVideoGenerate = "video.generate"

JobVideoGenerate is the job kind of a video generation (SDD-016 section 6.4).

View Source
const JobWaitingApproval = "waiting_approval"

JobWaitingApproval is the state of a job of a kind that needs approval, until a person or a rule approves it (SDD-015 section 5). The job is not running and has made no call.

View Source
const KindPublishScheduled = "publish.scheduled"

KindPublishScheduled is the kind of the approval request of a scheduled post (SDD-020 section 26). A rule the person wrote for this kind approves it without asking.

View Source
const LintScopeFast = "fast"

LintScopeFast marks totals computed by the fast rules only.

View Source
const MaxAudioMeasureSeconds = 600

MaxAudioMeasureSeconds is the longest range AudioMeasure measures.

View Source
const (
	// MaxBatchItems is the most exports one batch holds.
	MaxBatchItems = 12
)

The limits of a batch (SDD-004 section 8.4).

View Source
const MaxImageFileBytes int64 = 64 << 20

MaxImageFileBytes is the largest file the browser may send into an image (SDD-021 section 10.2): 64 MiB, or STUARTY_MAX_IMPORT_BYTES when that is smaller. A larger picture is put on the server and imported by its path.

View Source
const (
	// PreviewWindowSeconds is the length of the window that is rendered first.
	PreviewWindowSeconds = 2
)

The processed sound of the timeline preview (SDD-004 section 7.1, epic 51): a file per source, rendered by the mixer of the export before the envelope and the loudness gain, kept in the cache folder audio-previews/ and served by key. The plan hands the key out; the route asks for the file; a file that is not there is rendered, a window of two seconds first and then the whole item.

View Source
const ScopePostsRead = "posts:read"

ScopePostsRead is the scope of the read API of the blog (SDD-020 section 47): a key that holds only it reaches the routes of the published posts and nothing else.

View Source
const StarterActor = "system:starter"

StarterActor is the creator of the starter templates. A template with no owner and this creator is shared: in network mode every user sees it (and none can change it), while a template with no owner and another creator belongs to the local workspace and stays hidden from users.

View Source
const StatusClientClosed = 499

StatusClientClosed is the status for a request its caller gave up on (the nginx convention); it is below 500, so it is not logged as a server fault.

View Source
const UntrustedNotice = untrusted.Notice

UntrustedNotice is the sentence of SDD-003 section 1.3.

Variables

View Source
var (
	ErrNotFound = errors.New("service: not found")
	ErrExists   = errors.New("service: already exists")
	ErrStale    = errors.New("service: stale")
	// ErrBadCursor is a page cursor the store did not produce.
	ErrBadCursor = errors.New("service: invalid cursor")
)

Sentinel errors returned by the store (SDD-005 section 2 item 8). The service maps them to the codes of SDD-000 section 8.

AllScopes is the five scopes of SDD-000 section 4 and the scope of the read API of the blog: what a local caller holds.

View Source
var ErrAudioRangeTooLong = errors.New("service: the range to measure is longer than the limit")

ErrAudioRangeTooLong is what a meter returns for a range longer than MaxAudioMeasureSeconds.

View Source
var ErrUploadBodyTooLarge = errors.New("service: the body of the chunk is over the limit")

ErrUploadBodyTooLarge is what the body of a chunk reports when its reader crossed the limit of the route; the HTTP adapter maps the framework's own error to it, and any other caller of the Service may return it from a reader.

ExportFormats are the export formats in the order the help lists them; the default (mp4) comes first. The MCP definition of job_start must list the same values.

View Source
var LockedAllowed = map[string]bool{
	"CommandHelp": true, "ExportPresetList": true, "ToolsStatus": true, "Doctor": true,
}

LockedAllowed are the operations that answer while the studio is locked: they read no content of the user (SDD-007 section 3.9 item 6). Every other operation of the Service answers E_LOCKED first.

View Source
var OperationDomains = map[string]string{}/* 227 elements not displayed */

OperationDomains is the domain of every method of Service (SDD-000 section 1.1, ADR-0043): the registry of the operations that are not edit commands, whose domains the command registries carry themselves. A method with no entry fails TestOperationDomains, so a later epic cannot add an operation that no domain owns.

View Source
var Scopes = map[string]string{}/* 227 elements not displayed */

Scopes is the scope each method needs (SDD-007 section 5.1 item 2). A test lists the methods of the Service interface and fails when one has no entry.

Functions

func CalendarDayText added in v0.57.0

func CalendarDayText(d *CalendarDay) string

CalendarDayText is one day on a line.

func CalendarPlanText added in v0.57.0

func CalendarPlanText(p *CalendarPlanResult) string

CalendarPlanText is a range of the calendar: the days that hold something, the slots with the target that fills each, and the publications when they were asked for.

func CalendarSlotText added in v0.57.0

func CalendarSlotText(s *CalendarSlot) string

CalendarSlotText is one slot on a line.

func CanonicalHint

func CanonicalHint(hint string) string

CanonicalHint turns the HTTP form of a hint, as an HTTP server wrote it, back to the tool names. A client that relays the error of a server (the stdio MCP and the CLI over a running server) applies it before ForSurface, so the hint names the surface that answered and not the one that carried it.

func CaptureActivityOf added in v0.57.0

func CaptureActivityOf(s Service) (capturehost.Activity, bool)

CaptureActivityOf is the indicator of a Service made by New, for the desktop shell to draw (SDD-025 section 19.4). A service with no capture, or a test one with no indicator, says no helper is alive. The second result is false for a Service that is not a server.

func CheckpointText added in v0.35.0

func CheckpointText(state string, c *Checkpoint) string

CheckpointText is the text of one checkpoint after an operation on it (SDD-003 section 3.7.1): the note line, then "<state> checkpoint "<name>" at r<revision> by <actor>", with the note after a dash.

func DefaultModel

func DefaultModel(dir, name string) (model string, ok bool)

DefaultModel is the model the last install of the tool recorded as the workspace default. ok is false when none is recorded or the recorded model is no longer installed and verified.

func EditText

func EditText(r *EditResult) string

EditText is the text of an edit result (SDD-003 section 3.5). The result carries no frame rate, so the ranges of findings are printed in frames only.

func FontSetFor

func FontSetFor(workspace string, doc *timeline.Document) *rasterize.FontSet

FontSetFor returns the font set a render of doc uses: the bundled families plus the user fonts of the document, read by hash from the font store of the workspace (SDD-007 section 7.7). A document without user fonts gets the shared bundled set. The set is never shared between documents, so two projects that name a family alike never see each other's files.

func FontSetForNested added in v0.37.0

func FontSetForNested(
	workspace string, doc *timeline.Document, nested map[string]*timeline.Document,
) *rasterize.FontSet

FontSetForNested is FontSetFor for a document whose compositions use the nested timelines: the fonts those timelines name are added for the families the document does not name itself (withNestedFonts).

func ImageEditText added in v0.31.0

func ImageEditText(r *ImageEditResult) string

ImageEditText is the text of the result of an image batch, the form the CLI prints and the MCP tool returns: the state and the revision, what changed, what was created and the findings the batch introduced.

func ImageExportText added in v0.31.0

func ImageExportText(r *ImageExportResult) string

ImageExportText is the text of an image export: the file, and the export job a publication takes as its thumbnail (D-111), so a reader of the text alone has the id as well.

func ImageStepText added in v0.31.0

func ImageStepText(r *ImageStepResult) string

ImageStepText is the text of an undo or a redo of an image.

func JobFinal

func JobFinal(state string) bool

JobFinal reports whether a job state is final: succeeded, failed or cancelled.

func JoinOr

func JoinOr(names []string) string

JoinOr writes names as "a, b or c", the way the hints and the help list choices.

func OperationDomain added in v0.33.0

func OperationDomain(method string) (string, bool)

OperationDomain is the domain of a Service method.

func PublicationListText added in v0.56.0

func PublicationListText(res *PublicationListResult) string

PublicationListText is the text of a page of publications.

func PublicationText added in v0.56.0

func PublicationText(p *Publication) string

PublicationText is what a person or an agent reads: one line for the publication and one for each target, with the time in its zone and in UTC, the state, the address when it is published and the error when it failed. The CLI and the MCP tool publication print it.

func RoleScopes

func RoleScopes(role string) []string

RoleScopes is what a role may do: an administrator holds the five scopes, a member the four that work on own projects. An unknown role holds none.

func SchedulerOf added in v0.37.0

func SchedulerOf(s Service) (*pub.Scheduler, bool)

SchedulerOf returns the publication scheduler of a Service made by New. The server runs it next to the queue workers (SDD-020 section 27); a command that is not a server never does.

func SeedBuiltInImageTemplates added in v0.41.0

func SeedBuiltInImageTemplates(ctx context.Context, st Store, nowMs int64, set []BuiltInTemplate) (int, error)

SeedBuiltInImageTemplates installs image templates that ship with the product into the library of images, with the same rules as SeedBuiltInTemplates. In network mode they belong to no user and are shared and read only (SharedImageTemplate). It returns how many it added.

func SeedBuiltInTemplates added in v0.41.0

func SeedBuiltInTemplates(ctx context.Context, st Store, nowMs int64, set []BuiltInTemplate) (int, error)

SeedBuiltInTemplates installs timeline templates that ship with the product into the template library, as the starter templates are (ADR-0022 item 8): shared, each with a fixed identifier, so that a workspace that holds one is left as it is and a template that a migration or a person changed is never overwritten. It returns how many it added.

func SeedStarterTemplates

func SeedStarterTemplates(ctx context.Context, st Store, nowMs int64) (int, error)

SeedStarterTemplates copies the starter templates into the template library (ADR-0022 item 8). Each has a fixed identifier, so a workspace that already holds it is left as it is: a later start adds nothing, and a template that a migration brought to a newer schema is not overwritten with the embedded one. It returns how many templates it added.

func SharedImageTemplate added in v0.41.0

func SharedImageTemplate(h ImageHead) bool

SharedImageTemplate reports whether a row is a template that ships with the product (VV-291, SDD-021): in network mode it belongs to no user and every user may read it and make a document from it, but none may change it. The starter actor made it and it has no owner, and it is still the document that ships: the seed writes revision 1, so a template that a person edited in local mode (revision 2 or later) stays private to the workspace and is not published by serving it in network mode (VV-300).

func ShutdownRecordings added in v0.52.0

func ShutdownRecordings(s Service)

ShutdownRecordings ends the recordings of a Service made by New when the process closes. It is not an operation: no caller of the API may drive it.

func TextFor

func TextFor(s Surface, text string) string

TextFor is hintFor for the text of a result, which also tells the caller what to call next.

func UndoText

func UndoText(r *UndoResult) string

UndoText is the text of an undo or a redo (SDD-003 section 3.9).

func VerifiedTool

func VerifiedTool(dir, name, kind, model string) (path string, ok bool)

VerifiedTool returns the absolute path of an installed file after checking its SHA-256 against tools/installed.json: a helper is never run, and a model never read, before this succeeds (SDD-007 section 6.8 item 6). ok is false when it is not installed or the bytes changed.

func WebhookDispatcherOf added in v0.47.0

func WebhookDispatcherOf(s Service) (*webhooks.Dispatcher, bool)

WebhookDispatcherOf returns the dispatcher of a Service made by New; the server runs it next to the queue workers and the publication scheduler. A command that is not a server never does.

func WithCaller

func WithCaller(ctx context.Context, c Caller) context.Context

WithCaller returns a context carrying c.

Types

type ActivityEntry added in v0.61.0

type ActivityEntry struct {
	ID          string          `json:"id"`
	At          string          `json:"at"`
	Actor       string          `json:"actor"                  untrusted:"true"`
	ActorKind   string          `json:"actor_kind"`
	ActorLabel  string          `json:"actor_label"            untrusted:"true"`
	Domain      string          `json:"domain"`
	Action      string          `json:"action"`
	ProjectID   string          `json:"project_id,omitempty"`
	ProjectName string          `json:"project_name,omitempty" untrusted:"true"`
	SubjectID   string          `json:"subject_id,omitempty"`
	SubjectKind string          `json:"subject_kind,omitempty"`
	Revision    int64           `json:"revision,omitempty"`
	Details     json.RawMessage `json:"details,omitempty"`
}

ActivityEntry is one normalized entry in the Activity History timeline.

type ActivityKey added in v0.61.0

type ActivityKey struct {
	AtMs      int64  `json:"at"`
	Source    string `json:"source"`
	Subject   string `json:"subject"`
	Sequence  int64  `json:"sequence"`
	ProjectID string `json:"project"`
}

ActivityKey orders events from independent logs and breaks ties within a millisecond.

type ActivityListRequest added in v0.61.0

type ActivityListRequest struct {
	ProjectID string `json:"project_id,omitempty"`
	ActorKind string `json:"actor_kind,omitempty"`
	Domain    string `json:"domain,omitempty"`
	Cursor    string `json:"cursor,omitempty"`
	Limit     int    `json:"limit,omitempty"`
}

ActivityListRequest queries the human- and agent-attributed activity timeline, newest first, globally or scoped to one project (epic 111).

type ActivityListResult added in v0.61.0

type ActivityListResult struct {
	Entries    []ActivityEntry `json:"entries"`
	NextCursor *string         `json:"next_cursor"`
}

ActivityListResult is one cursor-paginated page of ActivityEntry rows.

type ActivityPageQuery added in v0.61.0

type ActivityPageQuery struct {
	ProjectID string
	Owner     string
	Before    ActivityKey
	Limit     int
}

ActivityPageQuery selects one page from the combined activity logs.

type ActivityRow added in v0.61.0

type ActivityRow struct {
	Key        ActivityKey
	Actor      string
	ActorLabel string
	Action     string
	Details    json.RawMessage
}

ActivityRow is the metadata of an audit or revision row before display normalization.

type AgentProfileListRequest added in v0.35.0

type AgentProfileListRequest struct{}

AgentProfileListRequest has no member.

type AgentProfileListResult added in v0.35.0

type AgentProfileListResult struct {
	Profiles    []agenthost.Profile `json:"profiles"`
	Suggestions []AgentSuggestion   `json:"suggestions"`
	// CanWrite is true for the caller who may write a profile: a person with the admin scope.
	CanWrite bool `json:"can_write"`
	// Available is false when this process cannot host an agent (a command line client that
	// owns the workspace for one command).
	Available bool `json:"available"`
}

AgentProfileListResult is the profiles of the workspace and the suggestions (SDD-017 section 3).

type AgentProfileRemoveRequest added in v0.35.0

type AgentProfileRemoveRequest struct {
	Name string `json:"name"`
}

AgentProfileRemoveRequest names the profile.

type AgentProfileSetRequest added in v0.35.0

type AgentProfileSetRequest struct {
	Name    string   `json:"name"`
	Command string   `json:"command"`
	Args    []string `json:"args,omitempty"`
}

AgentProfileSetRequest writes a profile: a name, an executable and its arguments.

type AgentSuggestion added in v0.35.0

type AgentSuggestion struct {
	Name        string   `json:"name"`
	Title       string   `json:"title"`
	Executables []string `json:"executables"`
	Args        []string `json:"args"`
	Install     string   `json:"install"`
	// Found is true when one of the executables is on the search path of the server. FoundPath is
	// the absolute path found, shown to a person who may write a profile and to nobody else.
	Found     bool   `json:"found"`
	FoundPath string `json:"found_path,omitempty"`
}

AgentSuggestion is a known agent (core/chat) and whether its program was found on this machine.

type ApprovableKind added in v0.32.0

type ApprovableKind struct {
	// Name is the job kind: 1 to 80 characters of [a-z0-9_.:-], not one of the built-in kinds.
	Name string
	// Scope is the scope needed to submit the kind; render when empty.
	Scope string
	// ProjectWide marks a kind whose work belongs to the project and not to one of its timelines (a generation, a
	// draft): with no timeline_id the job is kept under the first active timeline, whatever the number of
	// timelines, and the caller is never asked which (SDD-016 section 6, SDD-003 section 1.7).
	ProjectWide bool
	// Anchor is optional: the timeline the job must be kept under because its work is made from that timeline (a
	// post, from the timeline of its export), so that trashing that timeline and no other ends the job. An empty
	// answer leaves the job where ProjectWide or the request put it.
	Anchor func(ctx context.Context, c Caller, req *JobStartRequest) string
	// Prepare checks the arguments and describes the action. It makes no outbound call.
	Prepare func(ctx context.Context, req JobStartRequest) (Prepared, error)
	// Run is the job once approved. It reaches the network only through connections.Manager.With.
	Run func(ctx context.Context, run JobRun) (JobOutcome, error)
	// Abandon is optional. It is called when a job of the kind is cancelled while queued again after a shutdown
	// interrupted a run that had started work at a provider (the task of a video, kept in the saved input): it
	// asks the provider to stop that work and returns the cost that is owed for it, or nil when nothing is owed.
	Abandon func(ctx context.Context, job *JobRow) *core.Money
}

ApprovableKind is a job kind that needs approval. A feature epic registers its kinds in Options.JobKinds (publishing, generation); the product registers none of its own here.

type ApprovalDecideRequest added in v0.32.0

type ApprovalDecideRequest struct {
	ID       string `json:"id"`
	Decision string `json:"decision"`
	Reason   string `json:"reason,omitempty"`
}

ApprovalDecideRequest is the answer of a person: Decision is approve or reject.

type ApprovalListRequest added in v0.32.0

type ApprovalListRequest struct {
	State     string `json:"state,omitempty"`
	ProjectID string `json:"project_id,omitempty"`
	Page
}

ApprovalListRequest lists the requests of the queue. State is pending (the default), approved, rejected, expired or all.

type ApprovalListResult added in v0.32.0

type ApprovalListResult struct {
	Envelope
	Requests   []approval.Request `json:"requests"`
	NextCursor *string            `json:"next_cursor"`
	Total      int                `json:"total"`
	Text       string             `json:"text"`
}

ApprovalListResult is a page of requests, newest first.

type ApprovalRef added in v0.32.0

type ApprovalRef struct {
	ID string `json:"id"`
}

ApprovalRef names a request or a rule.

type ApprovalRuleListRequest added in v0.32.0

type ApprovalRuleListRequest struct{}

ApprovalRuleListRequest has no member.

type ApprovalRuleListResult added in v0.32.0

type ApprovalRuleListResult struct {
	Rules []approval.RuleView `json:"rules"`
}

ApprovalRuleListResult is every rule, oldest first.

type ApprovalRuleSetRequest added in v0.32.0

type ApprovalRuleSetRequest struct {
	ID            string `json:"id,omitempty"`
	Kind          string `json:"kind"`
	ConnectionID  string `json:"connection_id,omitempty"`
	ProjectID     string `json:"project_id,omitempty"`
	Currency      string `json:"currency,omitempty"`
	PerItemMicros *int64 `json:"per_item_micros,omitempty"`
	PerDayMicros  *int64 `json:"per_day_micros,omitempty"`
	Enabled       *bool  `json:"enabled,omitempty"`
}

ApprovalRuleSetRequest creates a rule, or replaces the one named by ID. A limit is in micros, a millionth of the currency unit. Enabled defaults to true.

type ArtifactRow

type ArtifactRow struct {
	AssetHash string
	Kind      string // probe, normalized, proxy, thumbnails, peaks, silence, loudness, transcript
	Profile   int    // profile version; part of the file name
	Variant   string // transcripts: the 12 hex key of provider, model and language; empty otherwise
	Ext       string // file extension without the dot
	RelPath   string // relative to the workspace, forward slashes
	SizeBytes int64
	SHA256    string // of the artifact file
	Meta      json.RawMessage
	CreatedMs int64
}

ArtifactRow lists a derived file of an asset.

type AssetFacts

type AssetFacts struct {
	// Kind is the class the probe gave the file; SetFacts leaves the stored
	// kind alone when it is empty.
	Kind                       string
	NormalizedVersion          *int // profile version of the normalized file the facts were measured on
	DurationMs                 *int64
	Width, Height              *int
	HasAudio                   bool
	HasAlpha                   bool // a video whose normalized file keeps an alpha channel
	FrameRateNum, FrameRateDen *int
	FrameCount                 *int64
	SampleCount                *int64
	// FrameDelays is the display time in milliseconds of each frame of an animated image; empty for a still.
	FrameDelays []int
}

AssetFacts are the probe facts of an asset, all nil until ingest is ready.

type AssetInfo added in v0.33.0

type AssetInfo struct {
	Tags        []string `json:"tags,omitempty"`
	Reusable    *bool    `json:"reusable,omitempty"`
	Description string   `json:"description,omitempty"`
	// SoundKind is music, voice or effect; it is kept for the audio files of the call (SDD-011 section 14.12).
	SoundKind string `json:"sound_kind,omitempty"`
}

AssetInfo is what an import says about the files it brings, beyond their origin (SDD-011 section 14.4).

type AssetLibraryService added in v0.33.0

type AssetLibraryService interface {
	AssetGet(ctx context.Context, req AssetRef) (*AssetResult, error)
	AssetUses(ctx context.Context, req AssetUsesRequest) (*AssetUsesResult, error)
	AssetSetInfo(ctx context.Context, req AssetSetInfoRequest) (*AssetResult, error)
	AssetTag(ctx context.Context, req AssetTagRequest) (*AssetResult, error)
	AssetRename(ctx context.Context, req AssetRenameRequest) (*AssetResult, error)
	// AssetReveal is the checked path of the stored file, for a person in local mode only (SDD-011 section 14.10).
	AssetReveal(ctx context.Context, req AssetRevealRequest) (*AssetRevealResult, error)
}

AssetLibraryService is the operations that read and write one entry of the asset library (SDD-011 section 14.4); AssetList, which lists them, is in Service beside the other lists.

type AssetListRequest

type AssetListRequest struct {
	// Kind keeps only "image", "video", "audio" or "lut" files; empty lists every kind.
	Kind string `json:"kind,omitempty"`
	// Section keeps the kinds of a section of the library: "visual" (image, lut), "video" (video) or "audio" (audio).
	Section string `json:"section,omitempty"`
	// Tag keeps the files that carry the tag.
	Tag string `json:"tag,omitempty"`
	// Project keeps the files a production, or one of its timelines, uses.
	Project string `json:"project,omitempty"`
	// Origin keeps the files of one origin kind.
	Origin string `json:"origin,omitempty"`
	// Reusable keeps the files marked reusable (true) or not (false).
	Reusable *bool `json:"reusable,omitempty"`
	// SoundKind keeps the audio files of one sound kind: music, voice or effect.
	SoundKind string `json:"sound_kind,omitempty"`
	// Text is a full-text query over name, tags, description and origin.
	Text string `json:"text,omitempty"`
	// Limit keeps the first files of the list; 0 is the default of 500 (VV-192).
	Limit  int    `json:"limit,omitempty"`
	Cursor string `json:"cursor,omitempty"`
}

AssetListRequest asks for the files the workspace holds, across its projects (SDD-011 section 14.4).

type AssetListResult

type AssetListResult struct {
	Envelope
	Assets []LibraryAsset `json:"assets"`
	Total  int            `json:"total"`
	// FileCount, TotalBytes and TotalSizeText are about every file that matches the filters, not the page: the
	// distinct files, what they weigh with each hash once, and that weight in words (SDD-011 section 14.9).
	// Unsized counts the files among them whose size is unknown; they add nothing to the total.
	FileCount     int    `json:"file_count"`
	TotalBytes    int64  `json:"total_bytes"`
	TotalSizeText string `json:"total_size_text"`
	Unsized       int    `json:"unsized"`
	// TagsInUse is the tags the files that match the other filters carry, with how many files carry each, most used
	// first (SDD-011 section 14.11); the tag picker draws it.
	TagsInUse  []asset.TagCount `json:"tags_in_use"`
	NextCursor *string          `json:"next_cursor"`
	Text       string           `json:"text"`
}

AssetListResult lists the files, oldest name first.

type AssetRef added in v0.33.0

type AssetRef struct {
	Hash string `json:"hash"`
}

AssetRef names a file of the library by its content hash.

type AssetRenameRequest added in v0.48.0

type AssetRenameRequest struct {
	Hash string `json:"hash"`
	Name string `json:"name"`
}

AssetRenameRequest changes the name a file is shown under (SDD-011 section 14.8); the stored file is never renamed.

type AssetRepo

type AssetRepo interface {
	// Upsert inserts the row or returns the existing one; created reports which.
	Upsert(ctx context.Context, row AssetRow) (existing AssetRow, created bool, err error)
	Get(ctx context.Context, hash string) (AssetRow, error)
	SetIngest(
		ctx context.Context,
		hash string,
		st IngestState,
		progress float64,
		errJSON json.RawMessage,
		nowMs int64,
	) error
	SetFacts(ctx context.Context, hash string, f AssetFacts, nowMs int64) error
	// PutArtifact replaces the same (hash, kind, profile, variant, ext).
	PutArtifact(ctx context.Context, a ArtifactRow) error
	Artifacts(ctx context.Context, hash string) ([]ArtifactRow, error)

	// PutProjectAsset inserts or replaces the same (project, asset id);
	// ErrExists when the project already maps the hash to another asset id.
	PutProjectAsset(ctx context.Context, r ProjectAssetRow) error
	GetProjectAsset(ctx context.Context, projectID, assetID string) (ProjectAssetRow, error)
	FindProjectAssetByHash(ctx context.Context, projectID, hash string) (ProjectAssetRow, error)
	ListProjectAssets(ctx context.Context, projectID string, states ...ProjectAssetState) ([]ProjectAssetRow, error)
	SetProjectAssetState(
		ctx context.Context,
		projectID, assetID string,
		st ProjectAssetState,
		by string,
		atMs int64,
		snapshot json.RawMessage,
	) error
	ProjectsReferencing(ctx context.Context, hash string) ([]string, error) // project ids, any state
	PendingForHash(ctx context.Context, hash string) ([]ProjectAssetRow, error)
	// MovePendingProjectAssets hands the files still waiting under one id to the timeline that will hold them.
	MovePendingProjectAssets(ctx context.Context, fromID, toID string) error

	// For TrashEmpty.
	DeleteTrashedProjectAssets(ctx context.Context, projectID string) (int64, error)
	Unreferenced(ctx context.Context) ([]AssetRow, error) // assets with no project_assets row
	Delete(ctx context.Context, hash string) error        // cascades artifacts
}

AssetRepo stores assets, project assets and artifacts.

type AssetResult added in v0.33.0

type AssetResult struct {
	Envelope
	LibraryAsset
	Text string `json:"text"`
}

AssetResult is one entry of the library with the projects that use it.

type AssetRevealRequest added in v0.53.0

type AssetRevealRequest struct {
	Hash string `json:"hash"`
}

AssetRevealRequest names a stored file of the library by its content hash. It never carries a path (SDD-011 section 14.10).

type AssetRevealResult added in v0.53.0

type AssetRevealResult struct {
	Path    string `json:"path"`
	Display string `json:"display"`
}

AssetRevealResult is the checked path of the stored original, for a person to open its folder. Path is the resolved absolute path (the file manager takes it); Display is the same path with control and bidirectional characters written out, which is what a page draws. It is personal data: it is never logged, put in an event or an audit row, or returned by any other operation.

type AssetRow

type AssetRow struct {
	Hash         string // sha256:<64 hex>
	Kind         string // video, audio, image; empty until the probe classified the file
	SizeBytes    int64
	OriginalName string // untrusted
	IngestState  IngestState
	Progress     float64
	IngestError  json.RawMessage // typed error (SDD-002 A.8) when failed
	Facts        AssetFacts
	CreatedMs    int64
	UpdatedMs    int64
}

AssetRow is a catalogued original file, shared by every project.

type AssetSetInfoRequest added in v0.33.0

type AssetSetInfoRequest struct {
	Hash        string  `json:"hash"`
	Description *string `json:"description,omitempty"`
	RightsNote  *string `json:"rights_note,omitempty"`
	Reusable    *bool   `json:"reusable,omitempty"`
	// SoundKind is music, voice or effect, for an audio file; the empty string clears it (SDD-011 section 14.12).
	SoundKind *string `json:"sound_kind,omitempty"`
}

AssetSetInfoRequest changes what the user records about a file; a member left out stays as it is. RightsNote is the user's own record, never a licence check.

type AssetTagRequest added in v0.33.0

type AssetTagRequest struct {
	Hash   string   `json:"hash"`
	Add    []string `json:"add,omitempty"`
	Remove []string `json:"remove,omitempty"`
}

AssetTagRequest adds and removes tags of a file.

type AssetUse added in v0.33.0

type AssetUse = assets.Use

AssetUse is a project that uses a file.

type AssetUsesRequest added in v0.33.0

type AssetUsesRequest struct {
	Hash string `json:"hash"`
	Page
}

AssetUsesRequest asks for the projects that use a file.

type AssetUsesResult added in v0.33.0

type AssetUsesResult struct {
	Envelope
	Hash       string     `json:"hash"`
	Uses       []AssetUse `json:"uses"`
	NextCursor *string    `json:"next_cursor"`
	Text       string     `json:"text"`
}

AssetUsesResult lists the projects that use a file.

type AudioLevels added in v0.35.0

type AudioLevels struct {
	// IntegratedLUFS is the loudness of ITU-R BS.1770-4, nil for silence or less than 0.4 s.
	IntegratedLUFS *float64 `json:"integrated_lufs"`
	// TruePeakDBTP is the highest sample after oversampling, nil for digital silence.
	TruePeakDBTP *float64 `json:"true_peak_dbtp"`
	// NoiseFloorDBFS is the level of the quietest tenth of the 100 ms blocks, -120 for digital silence.
	NoiseFloorDBFS float64 `json:"noise_floor_dbfs"`
	// SpeechToNoiseDB is the integrated loudness minus the noise floor.
	SpeechToNoiseDB *float64 `json:"speech_to_noise_db"`
}

AudioLevels is the measurement of one render of the range.

type AudioMeasureInput added in v0.35.0

type AudioMeasureInput struct {
	Doc    *timeline.Document
	JobID  string
	ItemID string
	// Start and End are the frames to measure, the end exclusive.
	Start, End int64
}

AudioMeasureInput is what the meter needs.

type AudioMeasureOutput added in v0.35.0

type AudioMeasureOutput struct {
	Before, After AudioLevels
	Seconds       float64
}

AudioMeasureOutput is what the meter measured.

type AudioMeasureRequest added in v0.35.0

type AudioMeasureRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	// ItemID measures that item alone, with the chain of its track; its own range is the default range.
	ItemID string `json:"item_id,omitempty"`
	// Start and End are the range, as in an export; both empty is the item's range, or the whole timeline.
	Start string `json:"start,omitempty"`
	End   string `json:"end,omitempty"`
}

AudioMeasureRequest asks for the level of the sound of a project with and without its processors (SDD-004 section 7.1): of the whole timeline, of a range, or of one item.

type AudioMeasureResult added in v0.35.0

type AudioMeasureResult struct {
	ProjectID  string      `json:"project_id"`
	Revision   int64       `json:"revision"`
	ItemID     string      `json:"item_id,omitempty"`
	StartFrame int64       `json:"start_frame"`
	EndFrame   int64       `json:"end_frame"`
	Seconds    float64     `json:"seconds"`
	Before     AudioLevels `json:"before"`
	After      AudioLevels `json:"after"`
	Text       string      `json:"text"`
}

AudioMeasureResult is the measurement of the range before the processors and after them, both before the loudness gain of the export.

type AudioMeter added in v0.35.0

type AudioMeter interface {
	MeasureAudio(ctx context.Context, in AudioMeasureInput) (*AudioMeasureOutput, error)
}

AudioMeter is implemented by an Exporter that can render the audio of a project and measure it.

type AudioPreviewInput added in v0.39.0

type AudioPreviewInput struct {
	Doc    *timeline.Document
	Source plan.AudioSource
	JobID  string
	// OutPath is a path that does not exist yet: the render writes the 16-bit WAV there.
	OutPath string
}

AudioPreviewInput is one render of the preview: the source to render, from the document of its item.

type AudioPreviewRenderer added in v0.39.0

type AudioPreviewRenderer interface {
	RenderAudioPreview(ctx context.Context, in AudioPreviewInput) error
}

AudioPreviewRenderer is implemented by an Exporter that can render the processed sound of one source.

type AuditEntry

type AuditEntry struct {
	ID        int64           `json:"id"`
	At        string          `json:"at"`
	Actor     string          `json:"actor"`
	Action    string          `json:"action"`
	ProjectID string          `json:"project_id,omitempty"`
	SubjectID string          `json:"subject_id,omitempty"`
	Details   json.RawMessage `json:"details,omitempty"`
}

AuditEntry is one row of the audit table.

type AuditListRequest

type AuditListRequest struct {
	// ProjectID keeps the entries of one project; empty means every project the caller may see.
	ProjectID string `json:"project_id,omitempty"`
	Cursor    string `json:"cursor,omitempty"`
	Limit     int    `json:"limit,omitempty"`
}

AuditListRequest pages the audit table, newest first.

type AuditListResult

type AuditListResult struct {
	Entries    []AuditEntry `json:"entries"`
	NextCursor *string      `json:"next_cursor"`
}

AuditListResult is a page of the audit table.

type AuditRepo

type AuditRepo interface {
	Append(ctx context.Context, row AuditRow) error
	List(ctx context.Context, projectID string, beforeID int64, limit int) ([]AuditRow, error) // projectID "" means all
	ActivityPage(ctx context.Context, query ActivityPageQuery) ([]ActivityRow, error)
}

AuditRepo appends to and lists the audit table; it has no update or delete.

type AuditRow

type AuditRow struct {
	ID        int64
	AtMs      int64
	Actor     string
	Action    string
	ProjectID *string
	SubjectID *string
	Details   json.RawMessage
}

AuditRow is one entry of the audit table.

type BackupRepo

type BackupRepo interface {
	Put(ctx context.Context, b BackupRow) error
	List(ctx context.Context, ownerKind, ownerID string) ([]BackupRow, error) // Document left empty
	Get(ctx context.Context, id int64) (BackupRow, error)
}

BackupRepo stores document backups.

type BackupRow

type BackupRow struct {
	ID            int64
	OwnerKind     string // "project" or "template"
	OwnerID       string
	Revision      int64 // 0 for a template
	SchemaVersion int
	Document      []byte
	Reason        string // e.g. "migrate v1 to v2", "import"
	CreatedMs     int64
}

BackupRow is a document saved before a migration or import.

type BatchItem added in v0.33.0

type BatchItem struct {
	Index    int           `json:"index"`
	Preset   string        `json:"preset,omitempty"`
	Format   string        `json:"format"`
	Codec    string        `json:"codec,omitempty"`
	JobID    string        `json:"job_id,omitempty"`
	State    string        `json:"state"`
	Progress float64       `json:"progress"`
	Result   *ExportResult `json:"result,omitempty"`
	Error    *Error        `json:"error,omitempty"`
}

BatchItem is one export of a batch as it stands now, read from its child job.

type BatchResult added in v0.33.0

type BatchResult struct {
	Total     int         `json:"total"`
	Succeeded int         `json:"succeeded"`
	Failed    int         `json:"failed"`
	Cancelled int         `json:"cancelled"`
	Items     []BatchItem `json:"items"`
}

BatchResult is the state of the children of a batch.

type BeatGrid

type BeatGrid struct {
	TempoBPM   float64 `json:"tempo_bpm"`
	Confidence float64 `json:"confidence"`
	Count      int     `json:"count"`
	// FirstMS are the first beats, in milliseconds of the asset.
	FirstMS []int64 `json:"first_ms"`
	Reason  string  `json:"reason,omitempty"`
}

BeatGrid is the detected beat grid of the audio of an asset (RF-044). An empty grid has TempoBPM 0 and a reason: audio without a steady pulse (speech, ambience) has no beats, and audio.mark_beats refuses it.

type BlogService added in v0.41.0

type BlogService interface {
	PostCheck(ctx context.Context, req PostCheckRequest) (*PostCheckResult, error)
	PublishedPostList(ctx context.Context, req PublishedPostListRequest) (*PublishedPostListResult, error)
	PublishedPostGet(ctx context.Context, req PublishedPostGetRequest) (*PublishedPostResult, error)
	PublishedPostMedia(ctx context.Context, req PublishedPostMediaRequest) (*PublishedPostMediaResult, error)
}

BlogService is the part of the service that checks a blog post (SDD-019 section 13) and serves the posts a blog_api destination published (SDD-020 section 47). Service embeds it.

type BrandFont

type BrandFont struct {
	Files []BrandFontFile `json:"files"`
}

BrandFont is a family of the brand kit.

type BrandFontFile

type BrandFontFile struct {
	Weight int    `json:"weight"`
	Hash   string `json:"hash"`
}

BrandFontFile is one weight of a brand font, stored by hash in the font store.

type BrandKit

type BrandKit struct {
	Colors    map[string]string    `json:"colors,omitempty"`
	Fonts     map[string]BrandFont `json:"fonts,omitempty"`
	UpdatedMs int64                `json:"updated_ms,omitempty"`
	Text      string               `json:"text"`
}

BrandKit is the brand kit of the workspace, or of the user in network mode.

type BrandKitGetRequest

type BrandKitGetRequest struct{}

BrandKitGetRequest has no members.

type BrandKitRepo

type BrandKitRepo interface {
	Get(ctx context.Context, owner string) (BrandKitRow, error) // ErrNotFound when there is none
	Put(ctx context.Context, row BrandKitRow) error
}

BrandKitRepo stores the brand kit.

type BrandKitRow

type BrandKitRow struct {
	OwnerUserID string
	Document    json.RawMessage
	UpdatedMs   int64
	UpdatedBy   string
}

BrandKitRow is the brand kit of one owner, "" in local mode.

type BrandKitSetRequest

type BrandKitSetRequest struct {
	Colors map[string]string    `json:"colors,omitempty"`
	Fonts  map[string]BrandFont `json:"fonts,omitempty"`
}

BrandKitSetRequest replaces the brand kit (SDD-005 section 5.11). Every member is optional, but at least one must be present: an empty member (an empty map) clears it, a body with none is refused.

type BriefGetRequest added in v0.31.0

type BriefGetRequest struct {
	ProjectID string `json:"project_id"`
}

BriefGetRequest reads the brief of a project.

type BriefResult added in v0.31.0

type BriefResult struct {
	Envelope
	ProjectID string     `json:"project_id"`
	ItemID    string     `json:"item_id,omitempty"` // empty when the project has no brief
	Text      string     `json:"text"                 untrusted:"true"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

BriefResult is the brief of a project.

type BriefSetRequest added in v0.31.0

type BriefSetRequest struct {
	ProjectID string `json:"project_id"`
	Text      string `json:"text"` // Markdown; empty clears the brief
	DryRun    bool   `json:"dry_run,omitempty"`
}

BriefSetRequest writes the brief of a project.

type BriefingAnswer added in v0.33.0

type BriefingAnswer struct {
	ID    string `json:"id"`
	Value string `json:"value" untrusted:"true"`
}

BriefingAnswer is an answer a brief holds.

type BriefingAnswerRequest added in v0.33.0

type BriefingAnswerRequest struct {
	ProjectID string            `json:"project_id"`
	Kind      string            `json:"kind,omitempty"`    // the set of the answers; left out, the set of the kind of the project
	Answers   map[string]string `json:"answers"`           // question id to answer; see BriefingQuestions
	Replace   bool              `json:"replace,omitempty"` // allow replacing a brief written by hand
	DryRun    bool              `json:"dry_run,omitempty"`
}

BriefingAnswerRequest answers the briefing of a project: the answers replace the brief.

type BriefingQuestion added in v0.33.0

type BriefingQuestion struct {
	ID       string   `json:"id"`
	Heading  string   `json:"heading"`
	Text     string   `json:"text"`
	Kind     string   `json:"kind"` // text, choice, seconds or date
	Required bool     `json:"required"`
	Options  []string `json:"options,omitempty"`
	MaxChars int      `json:"max_chars,omitempty"`
	Min      int      `json:"min,omitempty"`
	Max      int      `json:"max,omitempty"`
}

BriefingQuestion is one question of the briefing.

type BriefingQuestionsRequest added in v0.33.0

type BriefingQuestionsRequest struct {
	ProjectID string `json:"project_id,omitempty"`
	// Kind is the set of questions to ask: short, commercial, long, text or image. Left out, it is the set of the
	// kind of the project (a text project asks the questions of a text, an image project those of an image; a
	// video, a project not decided yet and a request with no project ask the short video), VV-399. The set is not
	// stored with the project (SDD-018 section 17): a caller that wants another one says so.
	Kind string `json:"kind,omitempty"`
}

BriefingQuestionsRequest asks for the questions. With a project id the result also carries what the brief of that project already answers.

type BriefingQuestionsResult added in v0.33.0

type BriefingQuestionsResult struct {
	Envelope
	ProjectID string `json:"project_id,omitempty"`
	// ProductionKind is the set the questions belong to, so a surface that did not choose one knows which it got.
	ProductionKind string             `json:"production_kind"`
	Questions      []BriefingQuestion `json:"questions"`
	// HasBrief is true when the project has a brief that is not empty. Guided is true when that brief was
	// written by the briefing, and Answers then holds its answers; a brief written by hand is Free and is
	// replaced only with replace true.
	HasBrief bool             `json:"has_brief"`
	Guided   bool             `json:"guided"`
	Answers  []BriefingAnswer `json:"answers,omitempty"`
	Text     string           `json:"text"`
}

BriefingQuestionsResult is the questions and, for a project, the state of its brief.

type BriefingService added in v0.33.0

type BriefingService interface {
	BriefingQuestions(ctx context.Context, req BriefingQuestionsRequest) (*BriefingQuestionsResult, error)
	BriefingAnswer(ctx context.Context, req BriefingAnswerRequest) (*BriefResult, error)
}

BriefingService is the guided briefing of a production (SDD-005 section 5.12.1, RF-301): the questions, and the answers that become the brief of the project. The questions and the rules are in core/project; a person at a form, the CLI, the HTTP API and an agent in a chat all use the same ones.

type BuiltInTemplate added in v0.41.0

type BuiltInTemplate struct {
	ID       string
	Document []byte
}

BuiltInTemplate is a template that ships with the product (SDD-018 section 17): a fixed identifier and the canonical document. The service knows nothing of where it comes from.

type BundleDocument

type BundleDocument struct {
	SHA256 string `json:"sha256"`
	Bytes  int64  `json:"bytes"`
}

BundleDocument is the canonical document entry.

type BundleFontFile

type BundleFontFile struct {
	Hash   string `json:"hash"`
	Family string `json:"family"`
	Weight int    `json:"weight"`
	Bytes  int64  `json:"bytes"`
}

BundleFontFile is one weight of a user font.

type BundleItem added in v0.31.0

type BundleItem struct {
	Kind     string          `json:"kind"`
	Title    string          `json:"title"`
	Position int             `json:"position"`
	TextKind string          `json:"text_kind,omitempty"` // kind text: script, copy or caption (SDD-019)
	Text     *BundleDocument `json:"text,omitempty"`
	Format   string          `json:"format,omitempty"`
	Timeline string          `json:"timeline,omitempty"`
}

BundleItem is an active item of the project. Timeline names the timeline by its key in the bundle ("main", "t1", ...); an output keeps its format and no job, because the file is not in the bundle. Text describes the entry item.<n>.md (n is the index of the item in the list) that holds the Markdown of a brief or a text that is not empty: the texts stay out of the manifest, whose size is capped far below what 256 items of 256 KiB hold.

type BundleLog

type BundleLog struct {
	Count  int64  `json:"count"`
	SHA256 string `json:"sha256"`
}

BundleLog describes operations.ndjson.

type BundleManifest

type BundleManifest struct {
	Format        string        `json:"format"`
	BundleVersion int           `json:"bundle_version"`
	AppVersion    string        `json:"app_version"`
	CreatedAt     string        `json:"created_at"`
	Project       BundleProject `json:"project"`
	// Document is left out by the bundle of a project with no timeline (SDD-005 section 16.1.2), which has no
	// document.json either.
	Document   *BundleDocument  `json:"document,omitempty"`
	Operations *BundleLog       `json:"operations,omitempty"`
	Media      []BundleMedia    `json:"media"`
	Fonts      []BundleFontFile `json:"fonts"`
	// Production and Timelines are the members of version 2: the items of the project, and every timeline but
	// the first (the first is Document and Operations).
	Production *BundleProduction `json:"production,omitempty"`
	Timelines  []BundleTimeline  `json:"timelines,omitempty"`
	// contains filtered or unexported fields
}

BundleManifest is manifest.json, the first entry of a bundle.

type BundleMedia

type BundleMedia struct {
	Hash     string            `json:"hash"`
	Kind     string            `json:"kind"`
	Name     string            `json:"name"`
	Bytes    int64             `json:"bytes"`
	AssetIDs []string          `json:"asset_ids"`
	Names    map[string]string `json:"names,omitempty"`
}

BundleMedia is one original file of the bundle, with every asset id that points at it. Name is the display name of the first asset id; Names holds, by asset id, the display name of any other that differs from its document.

type BundleProduction added in v0.31.0

type BundleProduction struct {
	Name string `json:"name"`
	// Description and Goal are the context of the project (SDD-005 section 5.12.2); a project with none, and a
	// bundle made before epic 56, leave them out.
	Description string        `json:"description,omitempty"`
	Goal        *project.Goal `json:"goal,omitempty"`
	// Kind is the stored kind of the project (SDD-005 section 5.12.4); left out for undecided, and by a bundle made
	// before epic 78, which imports as undecided and reads its kind from its items.
	Kind  string       `json:"kind,omitempty"`
	Items []BundleItem `json:"items"`
}

BundleProduction is the project around its timelines.

type BundleProject

type BundleProject struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	SchemaVersion int    `json:"schema_version"`
	Revision      int64  `json:"revision"`
}

BundleProject names the project the bundle was taken from.

type BundleTimeline added in v0.31.0

type BundleTimeline struct {
	Key           string         `json:"key"`
	ID            string         `json:"id"`
	Name          string         `json:"name"`
	SchemaVersion int            `json:"schema_version"`
	Revision      int64          `json:"revision"`
	Document      BundleDocument `json:"document"`
	Operations    *BundleLog     `json:"operations,omitempty"`
}

BundleTimeline is a timeline other than the first: its document entry timeline.<key>.json and its log timeline.<key>.ndjson, described as Document and Operations are for the first.

type CalendarDay added in v0.57.0

type CalendarDay = pub.Day

CalendarDay is a day of the calendar: a note, a theme and a quiet mark.

type CalendarDaySetRequest added in v0.57.0

type CalendarDaySetRequest = pub.DayInput

CalendarDaySetRequest writes the note and the theme of a day; a member left out stays, an empty one clears it.

type CalendarExportRequest added in v0.57.0

type CalendarExportRequest struct {
	From      string `json:"from"`
	To        string `json:"to"`
	Zone      string `json:"zone,omitempty"`
	ProjectID string `json:"project_id,omitempty"`
}

CalendarExportRequest asks for the targets of a range as an iCalendar file.

type CalendarExportResult added in v0.57.0

type CalendarExportResult struct {
	Filename    string `json:"filename"`
	ContentType string `json:"content_type"`
	Body        string `json:"body"`
}

CalendarExportResult is the file: its name, its media type and its bytes as text.

type CalendarPlanRequest added in v0.57.0

type CalendarPlanRequest struct {
	From      string `json:"from"`
	To        string `json:"to"`
	Zone      string `json:"zone,omitempty"`
	ProjectID string `json:"project_id,omitempty"`
	// Publications asks for the publications of the range too, paged by Limit and Offset as PublicationList.
	Publications bool `json:"publications,omitempty"`
	Limit        int  `json:"limit,omitempty"`
	Offset       int  `json:"offset,omitempty"`
}

CalendarPlanRequest asks for a range of the calendar: From inclusive and To exclusive, each a date (the start of that day in Zone), a local time read in Zone, or an instant.

type CalendarPlanResult added in v0.57.0

type CalendarPlanResult = pub.Plan

CalendarPlanResult is the days, the slots and, when asked, the publications of a range.

type CalendarQuietSetRequest added in v0.57.0

type CalendarQuietSetRequest struct {
	Date  string `json:"date"`
	Zone  string `json:"zone,omitempty"`
	Quiet bool   `json:"quiet"`
}

CalendarQuietSetRequest marks a day as quiet or clears the mark.

type CalendarSlot added in v0.57.0

type CalendarSlot = corepub.Rule

CalendarSlot is a recurring slot.

type CalendarSlotDeleteRequest added in v0.57.0

type CalendarSlotDeleteRequest struct {
	ID string `json:"id"`
}

CalendarSlotDeleteRequest names the slot to remove.

type CalendarSlotDeleteResult added in v0.57.0

type CalendarSlotDeleteResult struct {
	ID      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

CalendarSlotDeleteResult says which slot was removed.

type CalendarSlotSaveRequest added in v0.57.0

type CalendarSlotSaveRequest = pub.SlotInput

CalendarSlotSaveRequest creates a slot (no id) or replaces one.

type Caller

type Caller struct {
	Actor       string   // "user:<id>", "key:<key id>" or "local:<label>" (SDD-000 section 3)
	Scopes      []string // subset of read, edit, media, render, admin
	OwnerUserID string   // network mode: the user who owns the key or session; empty in local mode
	ProjectID   string   // a key limited to one project; empty means any
	// ChatSessionID is the hosted chat session a session token is bound to (SDD-017 section 8.1). Only the
	// authentication of a session token sets it: a person, the local token and a key never carry one, so a skill
	// they read is recorded in no session.
	ChatSessionID string
	// Browser is true for a person at the editor, who proved it with the
	// session cookie. The local token and the agent surfaces are not.
	Browser bool
	// Operator is true for the person at the terminal of the owner machine, set
	// only by the CLI command tools:install after its confirmation. It is the
	// third caller class that may start the install step.
	Operator bool
}

Caller is what authentication established (SDD-007 section 5.1) and the adapters put in the context.

func CallerFrom

func CallerFrom(ctx context.Context) (Caller, bool)

CallerFrom returns the caller of the context.

type CaptionValidateRequest added in v0.36.0

type CaptionValidateRequest struct {
	ProjectID string `json:"project_id,omitempty"`
	ItemID    string `json:"item_id,omitempty"`
	Body      string `json:"body,omitempty"`
	Text      string `json:"text,omitempty"`
	// Network is the network of Text; with ItemID it limits the answer to the variant of that network.
	Network string `json:"network,omitempty"`
}

CaptionValidateRequest measures a caption against the limits of its networks (SDD-019 section 5.2). Exactly one of ItemID (a stored caption), Body (a whole caption, saved or not) and Text with Network (one variant) is given.

type CaptionValidateResult added in v0.36.0

type CaptionValidateResult struct {
	Envelope
	ProjectID string                 `json:"project_id,omitempty"`
	Variants  []CaptionVariantReport `json:"variants"`
	// OK is true when no variant has a problem.
	OK   bool   `json:"ok"`
	Text string `json:"text"`
}

CaptionValidateResult is the report of every variant, in the order of the caption.

type CaptionVariantReport added in v0.36.0

type CaptionVariantReport struct {
	writing.CaptionReport
	// Words is the number of words of the variant text, for the person who reads the counters.
	Words int `json:"words"`
}

CaptionVariantReport is the report of one variant.

type CaptureIndicator added in v0.57.0

type CaptureIndicator interface {
	CaptureActivity() capturehost.Activity
}

CaptureIndicator is what a Capturer that keeps the indicator of SDD-025 section 19.4 offers: whether a helper that was asked to capture is alive. It is driven by the host, never by a recording row, a window or a page.

type CaptureInfo added in v0.52.0

type CaptureInfo struct {
	DurationMS    int64
	Width, Height int
}

CaptureInfo is what a recorded file holds.

type CaptureSession added in v0.52.0

type CaptureSession interface {
	Started() capturehost.Started
	// Encoder is the FFmpeg name of the encoder the helper was told to use.
	Encoder() string
	// Events ends with one terminal event: Finished, Failed or Lost.
	Events() <-chan capturehost.Event
	// Stop asks for a graceful end.
	Stop() error
	// Pause asks every source to stop writing; Resume asks them to write again.
	Pause() error
	Resume() error
	// Kill ends the helper and its process tree at once.
	Kill()
	// Close releases the session after its events ended.
	Close() error
}

CaptureSession is one running recording.

type CaptureStart added in v0.52.0

type CaptureStart struct {
	RecordingID string
	Kind        string
	SourceID    string
	FPS         int
	// Output is the absolute path of the .mp4 file.
	Output string
	// MaxSeconds is the longest the recording may run; it sets the deadline of the helper process.
	MaxSeconds int

	// The tracks beyond the screen and the file of each, in the folder of Output (SDD-025 section 16).
	Microphone       string
	MicrophoneOutput string
	SystemAudio      bool
	SystemOutput     string
	Camera           string
	CameraOutput     string
	Events           bool
	EventsOutput     string
}

CaptureStart is what the service asks the helper to record.

type Capturer added in v0.52.0

type Capturer interface {
	// Sources lists the displays and windows that can be captured.
	Sources(ctx context.Context) (capturehost.Sources, error)
	// Start starts the helper and the recording and returns once the first frame is in. ctx bounds the start
	// only: the recording lives until it ends, is stopped or is killed.
	Start(ctx context.Context, req CaptureStart) (CaptureSession, error)
	// Inspect reads a recorded file and reports what is decodable in it.
	Inspect(ctx context.Context, path string) (CaptureInfo, error)
}

Capturer is the native capture helper as the service sees it (SDD-025 section 7). The product's one implementation is capturehost.Live; a test supplies a fake. The service never starts a helper without having checked that the caller is a person first.

func NewLiveCapturer added in v0.52.0

func NewLiveCapturer(l *capturehost.Live) Capturer

NewLiveCapturer makes the Capturer of the product over capturehost.Live.

type ChatActivityResult added in v0.52.0

type ChatActivityResult struct {
	SessionID       string             `json:"session_id"`
	State           chat.State         `json:"state"`
	Skill           chat.SkillSlot     `json:"skill"`
	SkillsLoaded    []chat.LoadedSkill `json:"skills_loaded"`
	Tool            *chat.ToolActivity `json:"tool"`
	UpdatedAt       time.Time          `json:"updated_at"`
	UntrustedNotice string             `json:"untrusted_notice"`
}

ChatActivityResult is what a session is doing: the skill it read and the tool it called last (SDD-017 section 8.1). It is the result of chat.Reduce, told from the events of the session and nothing else; the titles of the tools and the names of the skills are text from an agent or from the library, and the notice says so.

type ChatAnswerRequest added in v0.35.0

type ChatAnswerRequest struct {
	SessionID string `json:"session_id"`
	RequestID string `json:"request_id"`
	Answer    string `json:"answer"`
}

ChatAnswerRequest answers a permission request of the agent: allow, reject or cancel.

type ChatCancelRequest added in v0.35.0

type ChatCancelRequest struct {
	SessionID string `json:"session_id"`
	End       bool   `json:"end,omitempty"`
}

ChatCancelRequest cancels the turn in progress; with End it ends the session.

type ChatRef added in v0.35.0

type ChatRef struct {
	SessionID string `json:"session_id"`
}

ChatRef names a session.

type ChatSendRequest added in v0.35.0

type ChatSendRequest struct {
	SessionID string `json:"session_id"`
	Text      string `json:"text"`
}

ChatSendRequest sends the next message of the person to the agent.

type ChatService added in v0.35.0

type ChatService interface {
	AgentProfileList(ctx context.Context, req AgentProfileListRequest) (*AgentProfileListResult, error)
	AgentProfileSet(ctx context.Context, req AgentProfileSetRequest) (*agenthost.Profile, error)
	AgentProfileRemove(ctx context.Context, req AgentProfileRemoveRequest) (*agenthost.Profile, error)
	ChatSessionStart(ctx context.Context, req ChatSessionStartRequest) (*ChatSession, error)
	ChatSend(ctx context.Context, req ChatSendRequest) (*ChatSession, error)
	ChatCancel(ctx context.Context, req ChatCancelRequest) (*ChatSession, error)
	ChatAnswerPermission(ctx context.Context, req ChatAnswerRequest) (*ChatSession, error)
	ChatSessionList(ctx context.Context, req ChatSessionListRequest) (*ChatSessionListResult, error)
	ChatSessionGet(ctx context.Context, req ChatRef) (*ChatSession, error)
	ChatTranscriptGet(ctx context.Context, req ChatTranscriptRequest) (*ChatTranscriptResult, error)
	ChatActivityGet(ctx context.Context, req ChatRef) (*ChatActivityResult, error)
	ChatSessionDelete(ctx context.Context, req ChatRef) (*ChatSession, error)
}

ChatService is the hosted agent chat (SDD-017). The profiles are written, and a session is started, steered, answered and deleted, only by a person in a browser session; every other caller, the session token of a hosted agent included, gets E_PRIVILEGED_SESSION. The reads take the read scope and the project check of the session.

type ChatSession added in v0.35.0

type ChatSession struct {
	ID         string         `json:"id"`
	ProjectID  string         `json:"project_id"`
	Profile    string         `json:"profile"`
	State      chat.State     `json:"state"`
	EndReason  chat.EndReason `json:"end_reason,omitempty"`
	Title      string         `json:"title"`
	CreatedAt  time.Time      `json:"created_at"`
	UpdatedAt  time.Time      `json:"updated_at"`
	EndedAt    *time.Time     `json:"ended_at,omitempty"`
	EventCount int            `json:"event_count"`
	// Live is true while the agent process of the session runs.
	Live bool `json:"live"`
}

ChatSession is a chat session as a client sees it (SDD-017 section 9).

type ChatSessionListRequest added in v0.35.0

type ChatSessionListRequest struct {
	ProjectID string `json:"project_id"`
}

ChatSessionListRequest lists the sessions of a project, newest first.

type ChatSessionListResult added in v0.35.0

type ChatSessionListResult struct {
	Sessions []ChatSession `json:"sessions"`
}

ChatSessionListResult is the sessions of a project.

type ChatSessionStartRequest added in v0.35.0

type ChatSessionStartRequest struct {
	ProjectID string `json:"project_id"`
	Profile   string `json:"profile"`
}

ChatSessionStartRequest starts a session of a project with a profile.

type ChatTranscriptRequest added in v0.35.0

type ChatTranscriptRequest struct {
	SessionID string `json:"session_id"`
	After     int64  `json:"after,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	Format    string `json:"format,omitempty"`
}

ChatTranscriptRequest reads the events of a session after a number (JSON), or the whole transcript as Markdown.

type ChatTranscriptResult added in v0.35.0

type ChatTranscriptResult struct {
	Session ChatSession  `json:"session"`
	Events  []chat.Event `json:"events,omitempty"`
	// NextAfter is the number to ask for the next page; nil when there is none.
	NextAfter *int64 `json:"next_after,omitempty"`
	Markdown  string `json:"markdown,omitempty"`
}

ChatTranscriptResult is a page of events, or the Markdown of the whole transcript. Every text in it is untrusted (SDD-007 section 8).

type Checkpoint added in v0.35.0

type Checkpoint struct {
	Envelope
	Name     string    `json:"name"`
	Note     string    `json:"note"`
	Revision int64     `json:"revision"`
	Actor    string    `json:"actor"`
	At       time.Time `json:"at"`
	Auto     bool      `json:"auto"`
}

Checkpoint is a name and a note on a revision (SDD-005 section 5.14).

type CheckpointCreateRequest added in v0.35.0

type CheckpointCreateRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"`
	Name       string `json:"name"`
	Note       string `json:"note,omitempty"`
	Revision   int64  `json:"revision,omitempty"`
}

CheckpointCreateRequest names a revision, the current one when Revision is 0.

type CheckpointListRequest added in v0.35.0

type CheckpointListRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"`
}

CheckpointListRequest lists the checkpoints of a timeline.

type CheckpointListResult added in v0.35.0

type CheckpointListResult struct {
	Envelope
	ProjectID   string       `json:"project_id"`
	Revision    int64        `json:"revision"`
	Checkpoints []Checkpoint `json:"checkpoints"`
	Text        string       `json:"text"`
}

CheckpointListResult is the checkpoints of a timeline, newest revision first.

type CheckpointRemoveRequest added in v0.35.0

type CheckpointRemoveRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"`
	Name       string `json:"name"`
}

CheckpointRemoveRequest removes a checkpoint, never a revision.

type CheckpointRenameRequest added in v0.35.0

type CheckpointRenameRequest struct {
	ProjectID  string  `json:"project_id"`
	TimelineID string  `json:"timeline_id,omitempty"`
	Name       string  `json:"name"`
	NewName    string  `json:"new_name"`
	Note       *string `json:"note,omitempty"`
}

CheckpointRenameRequest changes the name of a checkpoint, and its note when Note is present.

type CheckpointRepo added in v0.35.0

type CheckpointRepo interface {
	Create(ctx context.Context, row CheckpointRow) error // ErrExists on a duplicate name
	Get(ctx context.Context, projectID, name string) (CheckpointRow, error)
	// List returns the checkpoints of the project, newest revision first, then by name.
	List(ctx context.Context, projectID string) ([]CheckpointRow, error)
	// Rename changes the name, and the note when note is not nil, and makes the checkpoint a named one (Auto
	// false). ErrNotFound; ErrExists on a taken name.
	Rename(ctx context.Context, projectID, name, newName string, note *string) error
	Remove(ctx context.Context, projectID, name string) error // ErrNotFound
	// TrimAuto removes the oldest automatic checkpoints until at most keep remain.
	TrimAuto(ctx context.Context, projectID string, keep int) error
}

CheckpointRepo stores the checkpoints of a timeline. No method touches the log.

type CheckpointRow added in v0.35.0

type CheckpointRow struct {
	ProjectID string
	Name      string
	Note      string
	Revision  int64
	Actor     string
	Auto      bool
	AtMs      int64
}

CheckpointRow is a name and a note on a revision of a timeline (SDD-005 section 5.14).

type ChildPolicy

type ChildPolicy struct {
	// Limits is true when prlimit(1) bounds every child (Linux).
	Limits bool
	// LimitsWhy is why the limits are unavailable, when they are.
	LimitsWhy string
	// Sandbox is the path of bwrap when STUARTY_SANDBOX=bwrap wraps every child; empty is none.
	Sandbox string
}

ChildPolicy says what bounds the child processes of this owner.

type ClipZoom added in v0.59.0

type ClipZoom struct {
	ItemID string    `json:"item_id"`
	N      int       `json:"n"`
	Start  TimeValue `json:"start"`
	End    TimeValue `json:"end"`
}

ClipZoom is one zoom of a clip that plays the asset, in the time of the timeline: N counts the zooms of the clip from 1, Start is where the view starts to move in and End where it is back.

type CodecAvailability added in v0.33.0

type CodecAvailability struct {
	Codec     string `json:"codec"`
	Available bool   `json:"available"`
	Encoder   string `json:"encoder,omitempty"`
	// Reason is why the codec is not available: the answer of each candidate, with no path.
	Reason string `json:"reason,omitempty"`
}

CodecAvailability says whether this machine can write a codec, and with what.

type CodecReporter added in v0.33.0

type CodecReporter interface {
	Codecs(ctx context.Context) []CodecAvailability
}

CodecReporter is implemented by an Exporter that can say which codecs the machine writes.

type CommandDetail

type CommandDetail struct {
	CommandSummary
	Description string         `json:"description"`
	ArgsSchema  map[string]any `json:"args_schema"` // JSON Schema 2020-12 (SDD-002 section A.2)
	Example     map[string]any `json:"example"`     // a valid args value
	Errors      []string       `json:"errors"`
}

CommandDetail is one command with its arguments.

type CommandHelpRequest

type CommandHelpRequest struct {
	Name string `json:"name,omitempty"` // empty: list every public command
	// Domain is the domain whose commands are listed or explained: one of SDD-000 section 1.1, "video" when empty.
	// With no Name and no Domain the result also lists the domains (SDD-003 section 4.8).
	Domain string `json:"domain,omitempty"`
}

CommandHelpRequest asks for one command or for the list of them.

type CommandHelpResult

type CommandHelpResult struct {
	Commands []CommandSummary `json:"commands,omitempty"` // when Name is empty
	Command  *CommandDetail   `json:"command,omitempty"`  // when Name is set
	// Domains is every domain with its operation count, when neither Name nor Domain was asked.
	Domains []DomainSummary `json:"domains,omitempty"`
	Text    string          `json:"text"`
}

CommandHelpResult is the list, or the detail of one command.

func Discovery added in v0.33.0

func Discovery(video *command.Registry) *CommandHelpResult

Discovery is the first discovery call: command_help with no name and no domain. It lists the operations of the timeline registry, then one line per domain and the structured member (SDD-003 section 4.8). It needs no store, so the budget check of NFR-020 measures it without a workspace.

type CommandSummary

type CommandSummary struct {
	Name    string `json:"name"`
	Summary string `json:"summary"`
	Scope   string `json:"scope"` // "edit" | "media"
}

CommandSummary is a command in the list.

type ConnectionCreateRequest

type ConnectionCreateRequest struct {
	Kind     string   `json:"kind"`
	Label    string   `json:"label"`
	Endpoint string   `json:"endpoint"`
	Hosts    []string `json:"hosts,omitempty"`
	Accepts  []string `json:"accepts"`
	Secret   string   `json:"secret"`
}

ConnectionCreateRequest is SDD-014 section 5. Secret is the credential of the destination; it goes into the vault and is in no result.

type ConnectionListRequest

type ConnectionListRequest struct{}

ConnectionListRequest has no member.

type ConnectionListResult

type ConnectionListResult struct {
	Connections []connections.Connection `json:"connections"`
}

ConnectionListResult is every connection of the workspace, oldest first.

type ConnectionRef

type ConnectionRef struct {
	ID string `json:"id"`
}

ConnectionRef names a connection.

type ConnectionTestResult

type ConnectionTestResult struct {
	ID     string `json:"id"`
	OK     bool   `json:"ok"`
	Status int    `json:"status"`
	// Message is the start of the answer of the destination, delimited as untrusted text.
	Message string `json:"message" untrusted:"true"`
}

ConnectionTestResult is the outcome of one request through a connection.

type CostCeilingSetRequest added in v0.32.0

type CostCeilingSetRequest struct {
	ProjectID     string `json:"project_id,omitempty"`
	Currency      string `json:"currency"`
	PerItemMicros *int64 `json:"per_item_micros,omitempty"`
	PerDayMicros  *int64 `json:"per_day_micros,omitempty"`
}

CostCeilingSetRequest sets the ceiling of the workspace (no ProjectID) or of a project, in one currency. With both limits empty it removes the ceiling.

type CostLine added in v0.32.0

type CostLine struct {
	Scope     string `json:"scope"` // workspace or project
	ProjectID string `json:"project_id,omitempty"`
	Currency  string `json:"currency"`
	Micros    int64  `json:"micros"`
}

CostLine is what was spent today in one scope and currency.

type CostSummaryRequest added in v0.32.0

type CostSummaryRequest struct{}

CostSummaryRequest has no member.

type CostSummaryResult added in v0.32.0

type CostSummaryResult struct {
	Ceilings []approval.CeilingView `json:"ceilings"`
	Today    []CostLine             `json:"today"`
	Day      string                 `json:"day"`
	Days     []approval.Total       `json:"days"`
}

CostSummaryResult is SDD-015 section 6: the ceilings, today, and the last 30 days.

type CutsProposal added in v0.54.0

type CutsProposal struct {
	cuts.Proposal

	// Batch makes the cut on a new vertical timeline of the project: add the timeline with ProjectItemAdd (kind
	// timeline, the default 9:16 preset), place MediaFile in it with MediaImport, then send Batch to it. The
	// service fills the face track of the framing.
	Batch []command.Operation `json:"batch"`
}

CutsProposal is one proposal with the batch of commands a person accepts.

type CutsProposeRequest added in v0.54.0

type CutsProposeRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	AssetID    string `json:"asset_id"`
	// Count, MinMS and MaxMS override the defaults of cuts.DefaultOptions when not zero.
	Count int `json:"count,omitempty"`
	MinMS int `json:"min_ms,omitempty"`
	MaxMS int `json:"max_ms,omitempty"`
}

CutsProposeRequest asks for the vertical cuts of an asset (SDD-024 section 8).

type CutsProposeResult added in v0.54.0

type CutsProposeResult struct {
	UntrustedNotice string `json:"untrusted_notice,omitempty"`
	ProjectID       string `json:"project_id"`
	Revision        int64  `json:"revision"`
	AssetID         string `json:"asset_id"`
	// MediaFile is the one entry of `files` of the MediaImport that places the asset in the new timeline under
	// the id the batch uses (`asset.add` is issued only by the import flow, SDD-002 section A.9).
	MediaFile ImportFile     `json:"media_file"`
	Proposals []CutsProposal `json:"proposals"`
	Text      string         `json:"text"`
}

CutsProposeResult is the proposals; it changed nothing.

type DiffEntry added in v0.35.0

type DiffEntry = command.DiffEntry

DiffEntry is one change between two revisions (SDD-002 A.5), classified.

type DocSummary

type DocSummary struct {
	Width, Height         int
	FPSNum, FPSDen        int
	DurationFrames        int64 // end of the last item, 0 when empty
	Tracks, Items, Assets int
}

DocSummary is computed by the service from the document and written by the commit, so that listing never parses a document (SDD-005 section 5.1). It is SDD-005's ProjectSummary, renamed because SDD-003 §2.3 gives that name to the listing item of the API.

type DoctorCheck

type DoctorCheck struct {
	Name   string `json:"name"`
	OK     bool   `json:"ok"`
	Detail string `json:"detail"`
	Hint   string `json:"hint,omitempty"`
	// Optional marks a check whose failure does not stop the product from working (the transcription
	// helper and its model): it does not make the CLI exit non-zero (VV-110).
	Optional bool `json:"optional,omitempty"`
	// Status is what the text shows for the check: ok, warn (it passed with a hint), missing (an
	// optional check failed) or fail. A reader of the JSON sees the same as a reader of the text.
	Status string `json:"status"`
}

DoctorCheck is one line of the report.

type DoctorOptions

type DoctorOptions struct {
	// Mode is ModeLocal or ModeNetwork; ModeLocal when empty.
	Mode string
	// StartedAt is when the process started.
	StartedAt time.Time
	// Environ lists the environment as KEY=value lines; os.Environ when nil.
	Environ func() []string
	// FFmpegPins maps "ffmpeg" and "ffprobe" to the SHA-256 the embedded manifest records for the
	// bundled copy on this platform. Empty until the release embeds one.
	FFmpegPins map[string]string
	// Integrity runs PRAGMA integrity_check and returns what it printed ("ok" when sound).
	Integrity func(ctx context.Context) (string, error)
	// Child is the policy the owner applied to FFmpeg and whisper.cpp (SDD-007 sections 6.5 and 6.7).
	Child ChildPolicy
	// GPURenderer is set when STUARTY_EXPORT_RENDERER=gpu asks for the GPU render host.
	GPURenderer GPURenderer
}

DoctorOptions is what the process adds to the report: facts only it knows.

type DoctorRequest

type DoctorRequest struct {
	// Full runs the checks; without it only the identity is answered.
	Full bool `json:"full,omitempty"`
	// Verify recomputes the SHA-256 of FFmpeg, ffprobe and the installed helpers.
	Verify bool `json:"verify,omitempty"`
	// GC runs the orphan sweep; only the owner of the machine may ask for it.
	GC bool `json:"gc,omitempty"`
	// Bundle writes exports/diagnostics/doctor-<UTC timestamp>.zip inside the workspace.
	Bundle bool `json:"bundle,omitempty"`
	// BundleProject adds the document of this project to the bundle: the explicit flag of RF-207.
	BundleProject string `json:"bundle_project,omitempty"`
}

DoctorRequest asks for the diagnostic report (SDD-003 section 2, SDD-011 section 8.6).

type DoctorResult

type DoctorResult struct {
	Version    string        `json:"version"`
	APIVersion string        `json:"api_version"`
	Mode       string        `json:"mode"`
	PID        int           `json:"pid"`
	StartedAt  time.Time     `json:"started_at"`
	Workspace  string        `json:"workspace,omitempty"`
	Checks     []DoctorCheck `json:"checks,omitempty"`
	// GC is what the sweep removed, when it was asked for.
	GC *SweepResult `json:"gc,omitempty"`
	// Bundle is the slash path of the bundle inside the workspace, when it was asked for.
	Bundle string `json:"bundle,omitempty"`
	Text   string `json:"text"`
}

DoctorResult is the report.

type DomainSummary added in v0.33.0

type DomainSummary struct {
	Name       string `json:"name"`
	Summary    string `json:"summary"`
	Operations int    `json:"operations"`
}

DomainSummary is a domain in the discovery list: its description and how many edit operations it has.

type Downloader

type Downloader interface {
	Do(req *http.Request) (*http.Response, error)
}

Downloader does one HTTP request; in the product it is the client of outbound.HelperDownload, which is the only one that may dial.

type DraftArgs added in v0.36.0

type DraftArgs struct {
	ItemID       string   `json:"item_id"`
	ConnectionID string   `json:"connection_id"`
	Model        string   `json:"model"`
	Instruction  string   `json:"instruction"`
	Network      string   `json:"network,omitempty"`
	MaxTokens    int      `json:"max_tokens,omitempty"`
	Temperature  *float64 `json:"temperature,omitempty"`
}

DraftArgs are the arguments of a text.draft job.

type EditRequest

type EditRequest struct {
	ProjectID      string              `json:"project_id"`
	TimelineID     string              `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	BaseRevision   int64               `json:"base_revision"`
	Operations     []command.Operation `json:"operations"` // 1 to 200
	IdempotencyKey string              `json:"idempotency_key,omitempty"`
	DryRun         bool                `json:"dry_run,omitempty"`
	// contains filtered or unexported fields
}

EditRequest is a batch of operations (SDD-003 section 2.4).

type EditResult

type EditResult struct {
	Envelope
	ProjectID    string           `json:"project_id"`
	Revision     int64            `json:"revision"`
	BaseRevision int64            `json:"base_revision"`
	Applied      bool             `json:"applied"`
	DryRun       bool             `json:"dry_run"`
	Replayed     bool             `json:"replayed"`
	Actor        string           `json:"actor"`
	Created      []string         `json:"created"`
	Effective    []OpEffect       `json:"effective"`
	Diff         []command.Change `json:"diff"`
	Findings     []lint.Finding   `json:"findings"`
	Lint         LintTotals       `json:"lint"`
	Description  string           `json:"description"` // summaries of the commands, one line (SDD-012 section 15)
}

EditResult is the outcome of a batch.

func EditInternal

func EditInternal(ctx context.Context, s Service, req EditRequest) (*EditResult, error)

EditInternal is Edit for the commands only the service itself issues, such as the asset.add batch that closes an ingest (SDD-005 section 5.5). The scope of the command is still checked against the caller; only the refusal of an internal command is lifted. It returns an error for a Service that was not made by New. Test-only: product code never calls it; TestSecurity_T05_EditInternalOnlyFromTests fails the build when it does.

type Enqueuer

type Enqueuer interface {
	Enqueue(ctx context.Context, tx Tx, kind, jobID string) error
}

Enqueuer hands a job to the workers. Enqueue runs inside the write transaction that created the job row, so that both exist or neither does; an implementation on a transactional queue inserts its message through the transaction, one on an inline queue runs the job after the commit.

type Envelope

type Envelope struct {
	UntrustedNotice string `json:"untrusted_notice,omitempty"`
}

Envelope is embedded in every result that has a field tagged untrusted:"true".

type Error

type Error struct {
	Code      string         `json:"code"`
	Message   string         `json:"message"`
	Hint      string         `json:"hint,omitempty"`
	Retryable bool           `json:"retryable"`
	OpIndex   *int           `json:"op_index,omitempty"`
	Path      string         `json:"path,omitempty"`
	Details   map[string]any `json:"details,omitempty"`
}

Error is the error of every service method (SDD-003 section 2.2).

func AssetNameHiddenCharacterError added in v0.54.0

func AssetNameHiddenCharacterError() *Error

AssetNameHiddenCharacterError is the error of AssetRename for a name with a control or invisible character, for a surface that refuses the character before the Service runs (the HTTP binder): the same error the rules give.

func EventError

func EventError(e *Error) *Error

EventError is the error of an event. An event reaches every subscriber of the project, whoever they are, so it never carries the name of a configuration variable (SDD-007 section 9.1): an administrator reads the full error from JobGet and AuditList. It copies, like forCaller.

func (*Error) Document

func (se *Error) Document() ErrorDocument

Document is the error document of SDD-003 section 1.4 for this error.

func (*Error) Error

func (e *Error) Error() string

func (*Error) ExitCode

func (e *Error) ExitCode() int

ExitCode is 2 when a retry can succeed and 1 otherwise.

func (*Error) ForSurface

func (e *Error) ForSurface(s Surface) *Error

ForSurface returns a copy of the error whose hint names the commands of the surface.

func (*Error) HTTPStatus

func (e *Error) HTTPStatus() int

HTTPStatus is the status of SDD-000 section 8; an unknown code is 500.

func (*Error) IsRetryable

func (se *Error) IsRetryable() bool

IsRetryable reports whether a failure is safe to retry: the flag it carries or a code SDD-000 section 8 marks retryable.

func (*Error) Text

func (se *Error) Text(withDetails bool) string

Text is the error text of SDD-003 section 3.9, capped at 2,000 characters with the details cut first. The MCP adapter leaves the details line out (withDetails false) because the envelope that follows it carries them.

type ErrorDocument

type ErrorDocument struct {
	Type      string         `json:"type"`
	Title     string         `json:"title"`
	Status    int            `json:"status"`
	Detail    string         `json:"detail"`
	Code      string         `json:"code"`
	Message   string         `json:"message"`
	Hint      string         `json:"hint,omitempty"`
	Retryable bool           `json:"retryable"`
	OpIndex   *int           `json:"op_index,omitempty"`
	Path      string         `json:"path,omitempty"`
	Details   map[string]any `json:"details,omitempty"`
}

ErrorDocument is the error document of SDD-003 section 1.4 without the HTTP-only members instance and request_id.

type Event

type Event struct {
	// Type is "batch.committed", "project.updated", "nested.updated", "job.updated" or
	// "asset.updated".
	Type        string
	ProjectID   string
	Revision    int64
	Kind        string // edit, undo or redo, for batch.committed; the job kind for job.updated
	Actor       string
	Description string
	At          time.Time

	// The members below are set by job.updated and asset.updated, which are
	// not replayable and carry no revision.
	JobID   string
	AssetID string // the asset id of this project, for asset.updated
	// TimelineID is the timeline that changed, for nested.updated: ProjectID is then a timeline that holds it.
	TimelineID string
	State      string
	Progress   float64
	Message    string
	Error      *Error
	Result     *JobResult
	// Approval is the request of approval.requested and approval.decided (SDD-015 section 7), and
	// Owner the user it belongs to in network mode, so that a member's stream carries their own only.
	Approval *approval.Request
	Owner    string
	// Publication is the publication of publication.updated (SDD-020 section 29).
	Publication *pub.Publication

	// The members below are set by image.updated (SDD-006 section 12): ImageID names the document, and
	// Revision, Kind, Actor and At are those of the committed batch.
	ImageID      string
	BaseRevision int64
	Diff         json.RawMessage
}

Event is what the service publishes after the change is durable (SDD-006 section 3). The hub that carries it is the business of the events task; the service only calls Options.Publish.

type ExportArgs

type ExportArgs struct {
	Start string `json:"start,omitempty"`
	End   string `json:"end,omitempty"`
	// Format is mp4 (the default), gif, wav or aac (SDD-004 section 8.1).
	Format string `json:"format,omitempty"`
	// At is the time of the frame of a png export, "0s" when absent; only for format png (VV-037).
	At string `json:"at,omitempty"`
	// Preset is a platform preset of SDD-004 section 8.2; it needs the format mp4.
	Preset string `json:"preset,omitempty"`
	// Codec is h264 (the default), hevc or av1, for the format mp4 (SDD-004 section 8.3).
	Codec string `json:"codec,omitempty"`
}

ExportArgs are the arguments of an export job.

type ExportBatchItem added in v0.33.0

type ExportBatchItem struct {
	Preset string `json:"preset,omitempty"`
	Format string `json:"format,omitempty"`
	Codec  string `json:"codec,omitempty"`
	Start  string `json:"start,omitempty"`
	End    string `json:"end,omitempty"`
}

ExportBatchItem is one export of a batch: a preset, or the format, codec and range of a plain export.

type ExportBatchRequest added in v0.33.0

type ExportBatchRequest struct {
	ProjectID  string            `json:"project_id"`
	TimelineID string            `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Items      []ExportBatchItem `json:"items"`
	WaitMS     int               `json:"wait_ms,omitempty"`
}

ExportBatchRequest starts the exports of one project, one after the other, as one job (RF-088).

type ExportCheckRequest added in v0.33.0

type ExportCheckRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Preset     string `json:"preset"`
	// Start and End are the range to export, as in an export job; both empty is the whole timeline.
	Start string `json:"start,omitempty"`
	End   string `json:"end,omitempty"`
	// Codec is the codec the estimate of the size is for; empty is the first codec of the preset.
	Codec string `json:"codec,omitempty"`
}

ExportCheckRequest asks whether a project fits a preset before anything is encoded.

type ExportCheckResult added in v0.33.0

type ExportCheckResult struct {
	ProjectID string `json:"project_id"`
	Revision  int64  `json:"revision"`
	Preset    string `json:"preset"`
	OK        bool   `json:"ok"`
	// Errors and Warnings count the findings by severity, so the result reads like the one of Lint.
	Errors         int                  `json:"errors"`
	Warnings       int                  `json:"warnings"`
	Findings       []exportcore.Finding `json:"findings"`
	DurationMS     int64                `json:"duration_ms"`
	EstimatedBytes int64                `json:"estimated_bytes"`
	Text           string               `json:"text"`
}

ExportCheckResult is what ExportCheck found, with the exact limit of every finding.

type ExportFileRequest

type ExportFileRequest struct {
	JobID string `json:"job_id"`
}

ExportFileRequest names a finished export by its job.

type ExportInput

type ExportInput struct {
	JobID string
	Doc   *timeline.Document
	// Nested are the timelines the compositions of Doc use, by id, as they were when the export started.
	Nested map[string]*timeline.Document
	// OutPath is the final file. The exporter writes it only after the file
	// passed its verification, and leaves nothing there otherwise.
	OutPath    string
	Start, End int64 // frames; End 0 is the end of the timeline
	// Format is mp4, gif, wav or aac; empty is mp4.
	Format string
	// MaxBytes is STUARTY_MAX_EXPORT_BYTES: the encoder stops at this size
	// instead of filling the disk first; 0 means no ceiling.
	MaxBytes int64
	// Preset is the id of a platform preset and Codec the codec asked for (h264, hevc or av1); both are for
	// mp4 (SDD-004 sections 8.2 and 8.3). Empty is none.
	Preset, Codec string
	// OnProgress receives the frames written and the total.
	OnProgress func(done, total int)
}

ExportInput is one export for an Exporter.

type ExportOutput

type ExportOutput struct {
	Bytes        int64
	SHA256       string
	DurationMS   int64
	Frames       int
	VideoCodec   string
	AudioCodec   string
	LoudnessLUFS *float64
	// CodecFallback is the codec the preset preferred when the video is H.264 instead, and Notes say so.
	CodecFallback string
	Notes         []string
	// Width and Height are the pixels of the file when they differ from the project's
	// (a GIF is capped); zero means the project's size.
	Width, Height int
	// Checks are the verification checks that ran. The job succeeds only when
	// every one is ok and the file is on disk with the size reported.
	Checks []VerifyCheck
}

ExportOutput is what a verified export produced.

type ExportPresetInfo added in v0.33.0

type ExportPresetInfo struct {
	ID        string              `json:"id"`
	Network   string              `json:"network"`
	Placement string              `json:"placement"`
	Label     string              `json:"label"`
	Container string              `json:"container"`
	Codecs    []string            `json:"codecs"`
	Limits    ExportPresetLimits  `json:"limits"`
	Targets   ExportPresetTargets `json:"targets"`
	Sources   []exportcore.Source `json:"sources"`
}

ExportPresetInfo is one preset as a person or an agent reads it.

type ExportPresetLimits added in v0.33.0

type ExportPresetLimits struct {
	MinDurationMS int64  `json:"min_duration_ms,omitempty"`
	MaxDurationMS int64  `json:"max_duration_ms,omitempty"`
	MinFPS        int    `json:"min_fps,omitempty"`
	MaxFPS        int    `json:"max_fps,omitempty"`
	MinWidth      int    `json:"min_width,omitempty"`
	MinHeight     int    `json:"min_height,omitempty"`
	MaxWidth      int    `json:"max_width,omitempty"`
	MaxHeight     int    `json:"max_height,omitempty"`
	AspectRatio   string `json:"aspect_ratio,omitempty"`
	MaxBytes      int64  `json:"max_bytes,omitempty"`
	MaxVideoKbps  int    `json:"max_video_kbps,omitempty"`
}

ExportPresetLimits are the limits of a preset in units a reader does not have to convert. A field that is absent is a limit the source page does not state.

type ExportPresetListRequest added in v0.33.0

type ExportPresetListRequest struct {
	Codecs bool `json:"codecs,omitempty"`
}

ExportPresetListRequest asks for the presets of SDD-004 section 8.2. Codecs also asks which codecs this machine can write, which runs the test encodes of SDD-004 section 8.3 the first time.

type ExportPresetListResult added in v0.33.0

type ExportPresetListResult struct {
	Presets []ExportPresetInfo `json:"presets"`
	// Codecs is present when the request asked for it and the exporter can tell.
	Codecs []CodecAvailability `json:"codecs,omitempty"`
	Text   string              `json:"text"`
}

ExportPresetListResult is the list of presets.

type ExportPresetTargets added in v0.33.0

type ExportPresetTargets struct {
	Width     int `json:"width"`
	Height    int `json:"height"`
	VideoKbps int `json:"video_kbps"`
	AudioKbps int `json:"audio_kbps"`
}

ExportPresetTargets are what an export with the preset asks of the encoders.

type ExportResult

type ExportResult struct {
	Revision     int64         `json:"revision"`
	Format       string        `json:"format,omitempty"` // mp4, gif, wav or aac; empty on a result stored before formats
	Path         string        `json:"path,omitempty"`   // absolute; local callers only
	DownloadURL  string        `json:"download_url"`
	Bytes        int64         `json:"bytes"`
	SHA256       string        `json:"sha256,omitempty"`
	Duration     TimeValue     `json:"duration"`
	Width        int           `json:"width"`
	Height       int           `json:"height"`
	FPS          string        `json:"fps"`
	VideoCodec   string        `json:"video_codec"`
	AudioCodec   string        `json:"audio_codec"`
	LoudnessLUFS *float64      `json:"loudness_lufs,omitempty"`
	Checks       []VerifyCheck `json:"checks"`
	// Preset is the platform preset the export was made for, when there was one.
	Preset string `json:"preset,omitempty"`
	// CodecFallback is the codec the preset preferred when this machine could not write it and the video
	// is H.264 instead; Notes say so in words (SDD-004 section 8.3).
	CodecFallback string   `json:"codec_fallback,omitempty"`
	Notes         []string `json:"notes,omitempty"`
}

ExportResult is the result of a succeeded export (SDD-003 section 2.8).

type Exporter

type Exporter interface {
	Export(ctx context.Context, in ExportInput) (*ExportOutput, error)
}

Exporter renders and verifies a project. An error that is an *ffmpeg.Error carries its code (E_EXPORT_FAILED, E_VERIFY_FAILED, E_LINT_BLOCKING, ...) into the job.

type FaceDetector added in v0.54.0

type FaceDetector interface {
	Detect(ctx context.Context, in *aihost.Input, progress func(done, total int)) (facetrack.Track, error)
}

FaceDetector finds the faces of a range of a video. The product's one is the aihost.Host over the verified files of the face set; a test supplies a fake.

type FacePaths added in v0.54.0

type FacePaths struct {
	Helper, Runtime, Model string
}

FacePaths are the three files of the face set, each verified against tools/installed.json just now.

type FaceTrackArgs added in v0.54.0

type FaceTrackArgs struct {
	AssetID string `json:"asset_id"`
	// FPS is the frames analysed per second, 1 to 10; 5 when zero.
	FPS int `json:"fps,omitempty"`
	// StartMS and EndMS are the range of the asset; the whole asset when both are zero.
	StartMS int `json:"start_ms,omitempty"`
	EndMS   int `json:"end_ms,omitempty"`
}

FaceTrackArgs are the arguments of JobStart for a face track.

type FaceTrackResult added in v0.54.0

type FaceTrackResult struct {
	AssetID  string `json:"asset_id"`
	Samples  int    `json:"samples"`
	Faces    int    `json:"faces"`
	Provider string `json:"provider"`
	FPS      int    `json:"fps"`
}

FaceTrackResult is the result of a finished face track job.

type File

type File struct {
	Path         string // slash path relative to the workspace
	DownloadName string // file name for Content-Disposition; empty means the job id
	ContentType  string
	Size         int64
	ETag         string // quoted
	ModTime      time.Time
	Immutable    bool
	MaxAge       int    // seconds of the Cache-Control header
	Body         []byte // the bytes to send when the file is built from the artifact (kind lut); Path is then not read
	// Header is added to the answer of a file that is served (the frames a processed window covers).
	Header map[string]string
	// Pending says the file does not exist yet and is being made: the answer is 202, not a file (kind audio_preview).
	Pending bool
}

File is a stored file, resolved to a path inside the workspace.

type FileRef

type FileRef struct {
	Kind      string `json:"kind"` // "proxy", "chunks", "thumbnail", "strip", "peaks", "bitmap" or "audio_preview"
	ProjectID string `json:"project_id,omitempty"`
	ID        string `json:"id"`                // the asset id; the key of a bitmap or of a processed sound
	Variant   string `json:"variant,omitempty"` // thumbnail width: 160, 320 or 640; the first frame of a processed window
}

FileRef names a stored file for download (SDD-003 section 2.9).

type FileResult

type FileResult struct {
	Path        string `json:"path,omitempty"` // local mode only
	DownloadURL string `json:"download_url"`
	Bytes       int64  `json:"bytes"`
	Text        string `json:"text"`
}

FileResult names a file the caller can fetch.

type FontFamily

type FontFamily struct {
	Family  string `json:"family"`
	Weights []int  `json:"weights"`
}

FontFamily is one bundled family and the weights shipped for it.

type FontImportRequest

type FontImportRequest struct {
	Path string `json:"path"` // absolute
}

FontImportRequest reads a font file from the machine of the server (SDD-007 section 7.7).

type FontImportResult

type FontImportResult struct {
	Hash         string `json:"hash"`
	Bytes        int64  `json:"bytes"`
	Deduplicated bool   `json:"deduplicated"`
	Text         string `json:"text"`
}

FontImportResult is the stored font. Hash is in the form of a document, so a font.add can name it.

type FontListRequest

type FontListRequest struct{}

FontListRequest has no members.

type FontListResult

type FontListResult struct {
	Fonts    []FontFamily   `json:"fonts"`
	Imported []ImportedFont `json:"imported"`
}

FontListResult is the bundled set (SDD-001 section 3.9), by family name, and the fonts imported into the font store with their hash (VV-094). In network mode only the fonts the caller owns are listed.

type FontRepo

type FontRepo interface {
	// Record adds owner to the owners of hash; recording twice changes nothing.
	Record(ctx context.Context, owner, hash string, atMs int64) error
	Owns(ctx context.Context, owner, hash string) (bool, error)
	// Owned lists the hashes owner imported or brought, oldest first.
	Owned(ctx context.Context, owner string) ([]string, error)
}

FontRepo records which user imported or brought each stored font file. A hash is in the form of a document, "sha256:" and 64 hex digits.

type GPURenderer

type GPURenderer struct {
	// Requested is true when the configured renderer is gpu.
	Requested bool
	// Host is the absolute path of stuarty-render; empty when it was not found.
	Host string
}

GPURenderer says whether the GPU renderer was requested and where its host was found.

type Gate added in v0.49.0

type Gate interface {
	// Check returns nil when operations may read and write, and an error while the studio is locked.
	Check() error
}

Gate says whether the studio is open. The account manager is the one implementation; with none, the Service is always open (a workspace with no account, a test, a network server).

type GeneratedItem added in v0.36.0

type GeneratedItem struct {
	// AssetID is the asset of the project; Hash is the content hash the library names it by.
	AssetID string `json:"asset_id"`
	Hash    string `json:"hash"`
	Kind    string `json:"kind"`
	Bytes   int64  `json:"bytes"`
	// State is the ingest state when the job ended: the ingest runs after the job.
	State string `json:"state"`
	// RevisedPrompt is the prompt as the provider rewrote it, when it does: untrusted text.
	RevisedPrompt string `json:"revised_prompt,omitempty" untrusted:"true"`
}

GeneratedItem is one file a generation stored as an asset.

type GeneratedResult added in v0.36.0

type GeneratedResult struct {
	Provider  string          `json:"provider"`
	Model     string          `json:"model"`
	Items     []GeneratedItem `json:"items"`
	Requested int             `json:"requested"`
	Delivered int             `json:"delivered"`
	// Notes say, in words the product wrote, what did not arrive.
	Notes []string   `json:"notes,omitempty"`
	Cost  core.Money `json:"cost"`
	// Image is what an image.edit job did to the document (SDD-016 section 6.5); other kinds leave it out.
	Image *ImageApplied `json:"image,omitempty"`
}

GeneratedResult is the result of a succeeded image.generate or voice.generate job (SDD-016 section 6.1).

type HistoryDiffRequest added in v0.35.0

type HistoryDiffRequest struct {
	ProjectID      string `json:"project_id"`
	TimelineID     string `json:"timeline_id,omitempty"`
	From           int64  `json:"from,omitempty"`
	FromCheckpoint string `json:"from_checkpoint,omitempty"`
	Until          int64  `json:"until,omitempty"`
}

HistoryDiffRequest asks for the difference between two revisions. From is a revision or, as FromCheckpoint, the name of a checkpoint; To is a revision, the current one when 0.

type HistoryDiffResult added in v0.35.0

type HistoryDiffResult struct {
	Envelope
	ProjectID string      `json:"project_id"`
	Revision  int64       `json:"revision"` // the current revision of the timeline
	From      int64       `json:"from"`
	To        int64       `json:"to"`
	Count     int         `json:"count"`
	Entries   []DiffEntry `json:"entries"`
	Text      string      `json:"text"`
}

HistoryDiffResult is the difference between two revisions.

type HistoryEntry

type HistoryEntry struct {
	Revision     int64     `json:"revision"`
	Kind         string    `json:"kind"`
	Actor        string    `json:"actor"`
	At           time.Time `json:"at"`
	Ops          []string  `json:"ops"`
	Changes      int       `json:"changes"`
	Description  string    `json:"description"`    // summaries of the commands, one line (SDD-012 section 15)
	UndoableByMe bool      `json:"undoable_by_me"` // the step Undo takes for the caller now
	RedoableByMe bool      `json:"redoable_by_me"` // the step Redo takes for the caller now
	UndoOf       *int64    `json:"undo_of,omitempty"`
	UndoneBy     *int64    `json:"undone_by,omitempty"`
}

HistoryEntry is one step of the history.

type HistoryListRequest

type HistoryListRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Actor      string `json:"actor,omitempty"`
	Page
}

HistoryListRequest pages the history, newest first.

type HistoryListResult

type HistoryListResult struct {
	ProjectID  string         `json:"project_id"`
	Revision   int64          `json:"revision"`
	Entries    []HistoryEntry `json:"entries"`
	NextCursor *string        `json:"next_cursor"`
	Text       string         `json:"text"`
}

HistoryListResult is a page of the history.

type HistoryQuery

type HistoryQuery struct {
	Before int64  // revisions below this one; 0 means from the newest
	Actor  string // optional filter
	Limit  int    // 1 to 200
}

HistoryQuery selects a page of the history, newest first.

type HistoryRef

type HistoryRef struct {
	Revision int64     `json:"revision"`
	Kind     string    `json:"kind"`
	Actor    string    `json:"actor"`
	At       time.Time `json:"at"`
}

HistoryRef names a step of the history.

type HistoryRevertRequest added in v0.35.0

type HistoryRevertRequest struct {
	ProjectID    string `json:"project_id"`
	TimelineID   string `json:"timeline_id,omitempty"`
	Revision     int64  `json:"revision,omitempty"`
	Checkpoint   string `json:"checkpoint,omitempty"`
	BaseRevision int64  `json:"base_revision,omitempty"`
	DryRun       bool   `json:"dry_run,omitempty"`
}

HistoryRevertRequest takes a timeline back to an earlier revision (SDD-003 section 2.5.1). Exactly one of Revision and Checkpoint names the target.

type HistoryRevertResult added in v0.35.0

type HistoryRevertResult struct {
	EditResult
	Kind   string `json:"kind"`   // "revert"
	Target int64  `json:"target"` // the revision the document was taken back to
	Same   bool   `json:"same"`   // the document already equals that revision: nothing was written
	Text   string `json:"text"`
}

HistoryRevertResult is an EditResult (its diff is the change the revert makes) with the target.

type IdempotencyRepo

type IdempotencyRepo interface {
	// Get returns ErrNotFound for a missing or expired row (expires_ms <= nowMs).
	Get(ctx context.Context, projectID, actor, key string, nowMs int64) (IdempotencyRow, error)
	// Put replaces an expired row with the same key; ErrExists when a live row has it.
	Put(ctx context.Context, row IdempotencyRow) error
	PurgeExpired(ctx context.Context, nowMs int64) (int64, error)
	// PurgeProjectExpired deletes the expired keys of one project: the commit
	// does it in its own transaction (section 9.2 step 12) without touching
	// another project's rows.
	PurgeProjectExpired(ctx context.Context, projectID string, nowMs int64) (int64, error)
	// CountLive is how many unexpired keys one actor holds in one project, and when the first of
	// them expires (zero when there is none). The commit refuses a new key at the ceiling and
	// evicts nothing (SDD-005 section 10, SDD-007 section 9.1).
	CountLive(ctx context.Context, projectID, actor string, nowMs int64) (n int, firstExpiresMs int64, err error)
}

IdempotencyRepo stores idempotency keys.

type IdempotencyRow

type IdempotencyRow struct {
	ProjectID   string
	Actor       string
	Key         string
	RequestHash string // lower-case hex sha256 of the canonical JSON of the request's operations
	Revision    int64
	Result      json.RawMessage // the result as first returned (SDD-003 shape), without "replayed"
	CreatedMs   int64
	ExpiresMs   int64
}

IdempotencyRow is a stored result for an idempotency key.

type ImageApplied added in v0.39.0

type ImageApplied struct {
	ImageID  string `json:"image_id"`
	LayerID  string `json:"layer_id,omitempty"`
	Revision int64  `json:"revision,omitempty"`
	Applied  bool   `json:"applied"`
}

ImageApplied says what the job did to the document (SDD-016 section 6.5): the layer it replaced or added, the revision of the batch, and whether the batch was applied.

type ImageArgs added in v0.36.0

type ImageArgs struct {
	ConnectionID string `json:"connection_id"`
	provider.ImageRequest
}

ImageArgs are the arguments of an image.generate job: the connection, and the request of SDD-016 section 5.1.

type ImageCheckpointCreateRequest added in v0.41.0

type ImageCheckpointCreateRequest struct {
	ImageID  string `json:"image_id"`
	Name     string `json:"name"`
	Note     string `json:"note,omitempty"`
	Revision int64  `json:"revision,omitempty"`
}

ImageCheckpointCreateRequest names a revision of an image, the current one when Revision is 0.

type ImageCheckpointListRequest added in v0.41.0

type ImageCheckpointListRequest struct {
	ImageID string `json:"image_id"`
}

ImageCheckpointListRequest lists the checkpoints of an image.

type ImageCheckpointListResult added in v0.41.0

type ImageCheckpointListResult struct {
	Envelope
	ImageID     string       `json:"image_id"`
	Revision    int64        `json:"revision"`
	Checkpoints []Checkpoint `json:"checkpoints"`
	Text        string       `json:"text"       `
}

ImageCheckpointListResult is the checkpoints of an image, newest revision first.

type ImageCheckpointRemoveRequest added in v0.41.0

type ImageCheckpointRemoveRequest struct {
	ImageID string `json:"image_id"`
	Name    string `json:"name"`
}

ImageCheckpointRemoveRequest removes a checkpoint, never a revision.

type ImageCheckpointRenameRequest added in v0.41.0

type ImageCheckpointRenameRequest struct {
	ImageID string  `json:"image_id"`
	Name    string  `json:"name"`
	NewName string  `json:"new_name"`
	Note    *string `json:"note,omitempty"`
}

ImageCheckpointRenameRequest changes the name of a checkpoint, and its note when Note is present.

type ImageCreateRequest added in v0.31.0

type ImageCreateRequest struct {
	Name       string                         `json:"name,omitempty"`
	Preset     string                         `json:"preset,omitempty"`
	Width      int                            `json:"width,omitempty"`
	Height     int                            `json:"height,omitempty"`
	Background string                         `json:"background,omitempty"`
	Template   bool                           `json:"template,omitempty"`    // the new document is a template
	TemplateID string                         `json:"template_id,omitempty"` // make it from this template
	Values     map[string]coreimage.SlotValue `json:"values,omitempty"`
	ID         string                         `json:"id,omitempty"`
}

ImageCreateRequest makes a document: blank (a preset or a size), or from a template with values.

type ImageCreateResult added in v0.31.0

type ImageCreateResult struct {
	Envelope
	ImageID  string `json:"image_id"`
	Revision int64  `json:"revision"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	Text     string `json:"text"     untrusted:"true"`
}

ImageCreateResult answers ImageCreate.

type ImageDescribeRequest added in v0.31.0

type ImageDescribeRequest struct {
	ImageID string `json:"image_id"`
}

ImageDescribeRequest reads one document.

type ImageDescribeResult added in v0.31.0

type ImageDescribeResult struct {
	Envelope
	ImageID    string            `json:"image_id"`
	Revision   int64             `json:"revision"`
	Name       string            `json:"name"       untrusted:"true"`
	Width      int               `json:"width"`
	Height     int               `json:"height"`
	Background string            `json:"background"`
	Template   bool              `json:"template"`
	Layers     []coreimage.Layer `json:"layers"     untrusted:"true"`
	Findings   []lint.Finding    `json:"findings"`
	Lint       LintTotals        `json:"lint"`
	Text       string            `json:"text"       untrusted:"true"`
}

ImageDescribeResult is the text view and the structure of a document.

type ImageDiffRequest added in v0.41.0

type ImageDiffRequest struct {
	ImageID        string `json:"image_id"`
	From           int64  `json:"from,omitempty"`
	FromCheckpoint string `json:"from_checkpoint,omitempty"`
	Until          int64  `json:"until,omitempty"`
}

ImageDiffRequest asks for the difference between two revisions of an image. From is a revision or, as FromCheckpoint, the name of a checkpoint; Until is a revision, the current one when 0.

type ImageDiffResult added in v0.41.0

type ImageDiffResult struct {
	Envelope
	ImageID  string      `json:"image_id"`
	Revision int64       `json:"revision"` // the current revision of the image
	From     int64       `json:"from"`
	To       int64       `json:"to"`
	Count    int         `json:"count"`
	Entries  []DiffEntry `json:"entries"`
	Text     string      `json:"text"   `
}

ImageDiffResult is the difference between two revisions of an image: its layers, its canvas and its files.

type ImageEditRequest added in v0.31.0

type ImageEditRequest struct {
	ImageID        string              `json:"image_id"`
	BaseRevision   int64               `json:"base_revision"`
	Operations     []command.Operation `json:"operations"` // 1 to 200
	IdempotencyKey string              `json:"idempotency_key,omitempty"`
	DryRun         bool                `json:"dry_run,omitempty"`
}

ImageEditRequest is a batch of image operations.

type ImageEditResult added in v0.31.0

type ImageEditResult struct {
	Envelope
	ImageID      string           `json:"image_id"`
	Revision     int64            `json:"revision"`
	BaseRevision int64            `json:"base_revision"`
	Applied      bool             `json:"applied"`
	DryRun       bool             `json:"dry_run"`
	Replayed     bool             `json:"replayed"`
	Actor        string           `json:"actor"`
	Created      []string         `json:"created"`
	Effective    []OpEffect       `json:"effective"`
	Diff         []command.Change `json:"diff"`
	Findings     []lint.Finding   `json:"findings"`
	Lint         LintTotals       `json:"lint"`
	Description  string           `json:"description"   untrusted:"true"`
}

ImageEditResult is the outcome of a batch.

type ImageExportRequest added in v0.31.0

type ImageExportRequest struct {
	ImageID string `json:"image_id"`
	Format  string `json:"format,omitempty"` // png (default), jpeg or webp
	Quality int    `json:"quality,omitempty"`
	Preset  string `json:"preset,omitempty"` // resample to a named size
	Width   int    `json:"width,omitempty"`
	Height  int    `json:"height,omitempty"`
}

ImageExportRequest renders a document to a file.

type ImageExportResult added in v0.31.0

type ImageExportResult struct {
	ImageID string `json:"image_id"`
	// JobID is the export job of kind image.export that records the file; a publication takes it as its
	// thumbnail (SDD-020 section 4).
	JobID    string `json:"job_id,omitempty"`
	Revision int64  `json:"revision"`
	Format   string `json:"format"`
	Path     string `json:"path"`
	Bytes    int64  `json:"bytes"`
	SHA256   string `json:"sha256"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	Text     string `json:"text"`
}

ImageExportResult describes the file written.

type ImageFileRequest added in v0.32.0

type ImageFileRequest struct {
	ImageID string `json:"image_id"`
	Name    string `json:"name"`
}

ImageFileRequest names a file that ImageExport wrote.

type ImageFrameRequest added in v0.32.0

type ImageFrameRequest struct {
	ImageID string `json:"image_id"`
	Width   int    `json:"width,omitempty"` // 16 to 4096; 0 is the canvas width
}

ImageFrameRequest asks for the picture of a document at a width.

type ImageFrameResult added in v0.32.0

type ImageFrameResult struct {
	ImageID  string `json:"image_id"`
	Revision int64  `json:"revision"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	MIME     string `json:"mime"`
	Image    []byte `json:"image"`
}

ImageFrameResult is the picture: PNG bytes with the straight alpha of the document.

type ImageGenerateRequest added in v0.36.0

type ImageGenerateRequest struct {
	ProjectID    string `json:"project_id"`
	ConnectionID string `json:"connection_id"`
	provider.ImageRequest
	WaitMS int  `json:"wait_ms,omitempty"`
	DryRun bool `json:"dry_run,omitempty"`
}

ImageGenerateRequest starts an image generation in a project: the arguments of the job kind image.generate (SDD-016 section 6.1) and the wait and the dry run of JobStart.

type ImageHead added in v0.31.0

type ImageHead struct {
	ID            string
	Name          string
	Template      bool
	Revision      int64
	SchemaVersion int
	Width, Height int
	Layers        int
	CreatedMs     int64
	UpdatedMs     int64
	CreatedBy     string
	OwnerUserID   *string // network mode only
}

ImageHead is an image row without its document.

type ImageHistoryEntry added in v0.32.0

type ImageHistoryEntry struct {
	Revision int64     `json:"revision"`
	Kind     string    `json:"kind"` // edit, undo or redo
	Actor    string    `json:"actor"`
	At       time.Time `json:"at"`
	Ops      []string  `json:"ops"`
	Changes  int       `json:"changes"`
	// What the step did, in English words, from the summaries of the image commands (SDD-021 section 4); never layer
	// text. The panel shows it as received.
	Description string `json:"description"`
	UndoOf      *int64 `json:"undo_of,omitempty"`   // the revision an undo or a redo acted on
	UndoneBy    *int64 `json:"undone_by,omitempty"` // the revision that undid this batch
	Skipped     int    `json:"skipped,omitempty"`   // the primitives an undo or a redo left alone
	Mine        bool   `json:"mine"`                // made by the caller
}

ImageHistoryEntry is one batch of the log.

type ImageHistoryRequest added in v0.32.0

type ImageHistoryRequest struct {
	ImageID string `json:"image_id"`
	Limit   int    `json:"limit,omitempty"` // 1 to 100; default 30
}

ImageHistoryRequest asks for the latest batches of a document.

type ImageHistoryResult added in v0.32.0

type ImageHistoryResult struct {
	ImageID  string              `json:"image_id"`
	Revision int64               `json:"revision"`
	Entries  []ImageHistoryEntry `json:"entries"`
}

ImageHistoryResult lists the latest batches, newest first.

type ImageImportFileRequest added in v0.38.0

type ImageImportFileRequest struct {
	ImageImportRequest

	FileName string    // a label, never a path: only its base name is kept
	Body     io.Reader // the bytes of the file; at most MaxImageFileBytes are read
	Size     int64     // the declared length of the body, or -1 when it is not known
}

ImageImportFileRequest brings a file that arrives as the bytes of a request into an image document: the options of ImageImport (Path and Hash are not given), the name the browser gave the file, and the bytes.

type ImageImportRequest added in v0.38.0

type ImageImportRequest struct {
	Path           string `json:"path,omitempty"`            // an absolute path on the machine of the server
	Hash           string `json:"hash,omitempty"`            // an image already in the workspace
	ImageID        string `json:"image_id,omitempty"`        // put the file in this document
	Name           string `json:"name,omitempty"`            // the document, or the layer when ImageID is given
	Width          int    `json:"width,omitempty"`           // the canvas of a new document
	Height         int    `json:"height,omitempty"`          // the canvas of a new document
	Preset         string `json:"preset,omitempty"`          // the canvas of a new document
	WaitMS         int    `json:"wait_ms,omitempty"`         // how long to wait for the ingest; 0 is 10,000
	BaseRevision   int64  `json:"base_revision,omitempty"`   // with ImageID
	IdempotencyKey string `json:"idempotency_key,omitempty"` // with ImageID
	DryRun         bool   `json:"dry_run,omitempty"`
}

ImageImportRequest brings an image file into an image document (SDD-021 section 10.1): the file of Path or the library file Hash, as a new document, or as one more layer of ImageID.

type ImageImportResult added in v0.38.0

type ImageImportResult struct {
	Envelope
	State    string         `json:"state"`
	ImageID  string         `json:"image_id,omitempty"`
	Revision int64          `json:"revision,omitempty"`
	Created  bool           `json:"created"`            // a new document
	LayerID  string         `json:"layer_id,omitempty"` // the layer the file became
	Hash     string         `json:"hash,omitempty"`
	Name     string         `json:"name"               untrusted:"true"` // the name the file is known by
	Width    int            `json:"width,omitempty"`
	Height   int            `json:"height,omitempty"`
	JobID    string         `json:"job_id,omitempty"` // the ingest of a pending file
	Applied  bool           `json:"applied"`
	DryRun   bool           `json:"dry_run"`
	Replayed bool           `json:"replayed"`
	Findings []lint.Finding `json:"findings"`
	Lint     LintTotals     `json:"lint"`
	Text     string         `json:"text"               untrusted:"true"`
}

ImageImportResult answers ImageImport.

type ImageListRequest added in v0.31.0

type ImageListRequest struct {
	Templates string `json:"templates,omitempty"` // "", "only" or "none"
	Page
}

ImageListRequest lists the documents.

type ImageListResult added in v0.31.0

type ImageListResult struct {
	Envelope
	Images     []ImageSummary `json:"images"`
	NextCursor *string        `json:"next_cursor"`
	Text       string         `json:"text"        untrusted:"true"`
}

ImageListResult answers ImageList.

type ImageModelArgs added in v0.39.0

type ImageModelArgs struct {
	ConnectionID string `json:"connection_id"`
	ImageID      string `json:"image_id"`
	// Operation is provider.OperationRemoveBackground or provider.OperationGenerate.
	Operation string `json:"operation"`
	Model     string `json:"model"`
	// LayerID is the layer whose background is removed, or the layer a generated picture must cover.
	LayerID string `json:"layer_id,omitempty"`
	// Prompt and Size are for generate only.
	Prompt string `json:"prompt,omitempty"`
	Size   string `json:"size,omitempty"`
}

ImageModelArgs are the arguments of an image.edit job (SDD-016 section 6.5).

type ImageModelEditRequest added in v0.39.0

type ImageModelEditRequest struct {
	ProjectID string `json:"project_id"`
	ImageModelArgs
	WaitMS int  `json:"wait_ms,omitempty"`
	DryRun bool `json:"dry_run,omitempty"`
}

ImageModelEditRequest starts an image.edit job in a project: the arguments of the job kind, and the wait and the dry run of JobStart.

type ImageOpRow added in v0.31.0

type ImageOpRow struct {
	ImageID        string
	Revision       int64
	Kind           OperationKind
	Actor          string
	BaseRevision   int64
	TargetRevision *int64
	AtMs           int64
	Ops            json.RawMessage
	Inverse        json.RawMessage
	Diff           json.RawMessage
	Skipped        json.RawMessage
	DocSHA256      string
	ClosedBy       *int64
	IdempotencyKey *string
	RequestHash    string
	Result         json.RawMessage
}

ImageOpRow is one committed batch of an image, the log row of SDD-005 section 5.13.

type ImageOpenFromAssetRequest added in v0.61.0

type ImageOpenFromAssetRequest struct {
	AssetHash string `json:"asset_hash"`
	Name      string `json:"name,omitempty"`
	Width     int    `json:"width,omitempty"`
	Height    int    `json:"height,omitempty"`
	Preset    string `json:"preset,omitempty"`
	WaitMS    int    `json:"wait_ms,omitempty"`
	DryRun    bool   `json:"dry_run,omitempty"`
}

ImageOpenFromAssetRequest opens a standalone image document directly from a workspace asset hash.

type ImageQuery added in v0.31.0

type ImageQuery struct {
	OwnerUserID string // network mode: only this owner's images; empty means all
	Offset      int
	Limit       int
	Templates   string // "" every image, "only" the templates, "none" the documents that are not
}

ImageQuery lists images: newest first, from Offset, at most Limit (and one more to tell there is a next page).

type ImageRepo added in v0.31.0

type ImageRepo interface {
	// Create inserts a row; ErrExists when the id is taken.
	Create(ctx context.Context, row ImageRow) error
	// Get returns the row; ErrNotFound when there is none.
	Get(ctx context.Context, id string) (ImageRow, error)
	// List returns up to q.Limit+1 heads.
	List(ctx context.Context, q ImageQuery) ([]ImageHead, error)
	// Commit sets the document and the revision to fromRevision+1; ErrStale when the row is no longer at fromRevision.
	Commit(ctx context.Context, id string, fromRevision int64, u ImageUpdate) error
	AppendOp(ctx context.Context, op ImageOpRow) error
	// OpsSince returns the batches after a revision, oldest first.
	OpsSince(ctx context.Context, id string, revision int64) ([]ImageOpRow, error)
	// OpsPage is OpsSince with a limit: the replay of the image stream reads the log in pages (SDD-006 section 12.2).
	OpsPage(ctx context.Context, id string, revision int64, limit int) ([]ImageOpRow, error)
	// LastOpen returns the latest batch of the actor, after the first revision, of one of the kinds, that no undo
	// or redo has consumed; ErrNotFound when there is none.
	LastOpen(ctx context.Context, id, actor string, kinds []OperationKind) (ImageOpRow, error)
	// Close marks a batch as consumed by the revision that undid or redid it.
	Close(ctx context.Context, id string, revision, by int64) error
	// CloseOpenRedo ends the redo chain of the actor: the undos still open are closed by the new revision.
	CloseOpenRedo(ctx context.Context, id, actor string, by int64) error
	// ByKey returns the batch the actor made with an idempotency key; ErrNotFound when there is none.
	ByKey(ctx context.Context, id, actor, key string) (ImageOpRow, error)
}

ImageRepo is the store of image documents. Every method that writes runs inside Store.Write, whose one transaction serializes the writers of an image.

type ImageRevertRequest added in v0.41.0

type ImageRevertRequest struct {
	ImageID      string `json:"image_id"`
	Revision     int64  `json:"revision,omitempty"`
	Checkpoint   string `json:"checkpoint,omitempty"`
	BaseRevision int64  `json:"base_revision,omitempty"`
	DryRun       bool   `json:"dry_run,omitempty"`
}

ImageRevertRequest takes an image back to an earlier revision. Exactly one of Revision and Checkpoint names the target.

type ImageRevertResult added in v0.41.0

type ImageRevertResult struct {
	ImageEditResult
	Kind   string `json:"kind"`   // "revert"
	Target int64  `json:"target"` // the revision the document was taken back to
	Same   bool   `json:"same"`   // the document already equals that revision: nothing was written
	Text   string `json:"text"  `
}

ImageRevertResult is an ImageEditResult (its diff is the change the revert makes) with the target.

type ImageRow added in v0.31.0

type ImageRow struct {
	ImageHead
	Document  json.RawMessage
	DocSHA256 string
}

ImageRow is an image document as stored (SDD-005 section 5.13).

type ImageStepRequest added in v0.31.0

type ImageStepRequest struct {
	ImageID string `json:"image_id"`
	DryRun  bool   `json:"dry_run,omitempty"`
}

ImageStepRequest undoes or redoes the last step of the caller.

type ImageStepResult added in v0.31.0

type ImageStepResult struct {
	ImageEditResult
	Kind    string            `json:"kind"` // "undo" | "redo"
	Step    int64             `json:"step"` // the revision undone or redone
	Skipped []command.Skipped `json:"skipped"`
}

ImageStepResult is an edit result plus the step undone or redone and what was skipped.

type ImageSummary added in v0.31.0

type ImageSummary struct {
	ImageID   string `json:"image_id"`
	Name      string `json:"name"       untrusted:"true"`
	Template  bool   `json:"template"`
	Revision  int64  `json:"revision"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	Layers    int    `json:"layers"`
	UpdatedMs int64  `json:"updated_ms"`
}

ImageSummary is one line of the list.

type ImageUpdate added in v0.31.0

type ImageUpdate struct {
	Name          string
	Template      bool
	SchemaVersion int
	Document      json.RawMessage
	DocSHA256     string
	Width, Height int
	Layers        int
	UpdatedMs     int64
}

ImageUpdate is what a commit writes into the row.

type ImportFile

type ImportFile struct {
	Path    string `json:"path,omitempty"`     // absolute
	Hash    string `json:"hash,omitempty"`     // sha256:<64 hex> of a file of the library, in place of a path
	AssetID string `json:"asset_id,omitempty"` // optional caller-chosen id; ignored for a duplicate
	// contains filtered or unexported fields
}

ImportFile is one file of a MediaImport call (SDD-003 section 2.6): a path, or the hash of a file that the library already holds (SDD-011 section 14.3).

type ImportedAsset

type ImportedAsset struct {
	AssetID string `json:"asset_id,omitempty"`
	// Hash is the content hash that the brand kit logo and font.add take (VV-117).
	Hash         string        `json:"hash,omitempty"`
	Name         string        `json:"name"             untrusted:"true"` // base name only; untrusted
	Kind         string        `json:"kind,omitempty"`
	State        string        `json:"state"`
	Progress     float64       `json:"progress"`
	JobID        string        `json:"job_id,omitempty"`
	Deduplicated bool          `json:"deduplicated"`
	Probe        *ProbeSummary `json:"probe,omitempty"`
	Error        *Error        `json:"error,omitempty"`
	// Replaces is the offer of a file imported with a render key that clips of the timeline already use under an
	// earlier render (SDD-011 section 15.4): nothing is replaced until MotionReplace or clip.replace_media.
	Replaces []RenderOffer `json:"replaces,omitempty"`
	// contains filtered or unexported fields
}

ImportedAsset is one entry per file of the request, in order. It never carries the directory of the path.

type ImportedFont

type ImportedFont struct {
	Hash  string `json:"hash"`
	Bytes int64  `json:"bytes"`
}

ImportedFont is a font file of the font store, named by the hash that font.add and the brand kit take.

type InboxListRequest added in v0.53.0

type InboxListRequest struct{}

InboxListRequest has no member.

type InboxListResult added in v0.53.0

type InboxListResult struct {
	Envelope
	Rows    []inbox.Row `json:"rows"`
	Waiting int         `json:"waiting"`
}

InboxListResult is every request that waits for the caller and the ones answered last, newest first (inbox.Order). Waiting counts the rows that wait. The text members of a row are untrusted.

type InboxService added in v0.53.0

type InboxService interface {
	InboxList(ctx context.Context, req InboxListRequest) (*InboxListResult, error)
}

InboxService is the one list of what waits for a person (SDD-015 section 4.1, epic 77, D-137). It is a read over the permission requests of the hosted agent chat and the approval queue; it decides nothing, and a row is answered by ChatAnswerPermission or ApprovalDecide.

type IngestState

type IngestState string

IngestState is the ingest state of an asset: pending, ingesting, ready or failed.

const (
	IngestPending   IngestState = "pending"
	IngestIngesting IngestState = "ingesting"
	IngestReady     IngestState = "ready"
	IngestFailed    IngestState = "failed"
)

The ingest states.

type Ingester

type Ingester func(ctx context.Context, in ingest.Input) (*ingest.Result, error)

Ingester runs the ingest of one stored original; ingest.Run is the default.

type InstalledTool

type InstalledTool struct {
	Name    string `json:"name"`
	Kind    string `json:"kind"`
	Model   string `json:"model,omitempty"`
	Version string `json:"version"`
	SHA256  string `json:"sha256"`
	Path    string `json:"path"` // slash path under tools/
}

InstalledTool is a line of tools/installed.json.

type ItemRow added in v0.31.0

type ItemRow struct {
	ID        string
	ProjectID string
	Kind      string
	Title     string
	Position  int
	State     ProjectState
	Ref       string // timeline: the timeline id; output: the export job id
	Body      string // brief and text
	Format    string // output
	TextKind  string // text: script, copy or caption (SDD-019); empty for any other kind
	CreatedMs int64
	UpdatedMs int64
	CreatedBy string
	TrashedMs *int64
}

ItemRow is a row of project_items.

type Job

type Job struct {
	JobID     string      `json:"job_id"`
	Kind      string      `json:"kind"`
	ProjectID *string     `json:"project_id"` // null for an ingest job
	State     string      `json:"state"`
	Progress  float64     `json:"progress"`
	Message   string      `json:"message,omitempty"`
	Result    *JobResult  `json:"result,omitempty"`
	Error     *Error      `json:"error,omitempty"`
	Lint      *LintTotals `json:"lint,omitempty"`
	// ApprovalID is the approval request of a job of a kind that needs approval (SDD-015 section 5).
	ApprovalID string `json:"approval_id,omitempty"`
	// Estimate is the cost estimated before a text generation runs (SDD-016 section 6); it is on the job from the
	// moment the job exists, also for a dry run and for a job that waits for approval.
	Estimate *core.Money `json:"estimate,omitempty"`
	// Warnings are notes about an accepted export that are not a reason to refuse it, such as a huge GIF.
	Warnings []string `json:"warnings,omitempty"`
	// DryRun marks the answer to a dry run: nothing was created, so JobID is empty and there is no job to read
	// with job_get; State is the one the job would start in (VV-303).
	DryRun     bool       `json:"dry_run,omitempty"`
	Actor      string     `json:"actor"`
	CreatedAt  time.Time  `json:"created_at"`
	StartedAt  *time.Time `json:"started_at,omitempty"`
	FinishedAt *time.Time `json:"finished_at,omitempty"`
	Text       string     `json:"text"`
}

Job is the job object of SDD-003 section 2.8.

type JobCancelRequest

type JobCancelRequest struct {
	JobID string `json:"job_id"`
}

JobCancelRequest asks for the cancellation of a job.

type JobGetRequest

type JobGetRequest struct {
	JobID  string `json:"job_id"`
	WaitMS int    `json:"wait_ms,omitempty"`
}

JobGetRequest reads a job.

type JobLimit

type JobLimit struct {
	Kind        string
	Max         int    // concurrent queued+running jobs of this kind
	Actor       string // when set, MaxPerActor is applied to this actor's jobs of the kind
	MaxPerActor int
	// Reason, when set, applies MaxPerReason to the jobs of the kind whose input has this reason.
	Reason       string
	MaxPerReason int
}

JobLimit is the concurrency limit checked by CreateLimited.

type JobListRequest

type JobListRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	State      string `json:"state,omitempty"`
	Page
}

JobListRequest lists the jobs of a project. State empty is the queued and running jobs plus the 10 most recent final ones; "active", "all" and each state filter.

type JobListResult

type JobListResult struct {
	ProjectID  string  `json:"project_id"`
	Jobs       []Job   `json:"jobs"`
	NextCursor *string `json:"next_cursor"`
	Text       string  `json:"text"`
}

JobListResult is a page of jobs, newest first.

type JobOutcome added in v0.32.0

type JobOutcome struct {
	// Result is stored on the job row.
	Result json.RawMessage
	// Cost is the real cost, when the job spent. A job that succeeds and reports none is settled at its
	// estimate: the daily ceiling must never count less than what may have been spent.
	Cost *core.Money
}

JobOutcome is what a finished job reports.

type JobRepo

type JobRepo interface {
	// CreateLimited inserts the job in state queued unless the limit is
	// reached, in which case it returns *QueueFullError. Call it inside Write.
	CreateLimited(ctx context.Context, row JobRow, lim *JobLimit) error
	Get(ctx context.Context, id string) (JobRow, error)
	List(ctx context.Context, projectID string, states []string, limit int) ([]JobRow, error)
	ActiveIngestForHash(ctx context.Context, hash string) (JobRow, error)

	Claim(ctx context.Context, id string, nowMs int64) (claimed bool, err error)
	Progress(ctx context.Context, id string, progress float64, message string, nowMs int64) (updated bool, err error)
	// Finish moves a running job to a terminal state; false when it was not running.
	Finish(ctx context.Context, id, state string, result, errJSON json.RawMessage, nowMs int64) (bool, error)
	// SaveInput replaces the input of a running job; false when it was not running. A job that must resume
	// after a restart (video.generate) stores there what it needs, such as the task id of a provider.
	SaveInput(ctx context.Context, id string, input json.RawMessage, nowMs int64) (bool, error)
	// Requeue moves a running job back to queued (shutdown interruption or recovery).
	Requeue(ctx context.Context, id, message string, nowMs int64) (bool, error)
	// RequestCancel sets cancel_requested; a queued job becomes cancelled at once.
	// It returns the row as it is afterwards.
	RequestCancel(ctx context.Context, id string, nowMs int64) (JobRow, error)
	// Running returns every job in state running (used by recovery at start-up).
	Running(ctx context.Context) ([]JobRow, error)
	// QueuedBefore returns the jobs still queued that were created before
	// the instant, oldest first (recovery dispatches them again).
	QueuedBefore(ctx context.Context, createdBeforeMs int64) ([]JobRow, error)

	// CreateWaiting inserts a job in state waiting_approval, with the request it waits on in
	// row.ApprovalID (SDD-015 section 5). Call it inside Write.
	CreateWaiting(ctx context.Context, row JobRow) error
	// Release moves a waiting_approval job to queued; false when it was not waiting.
	Release(ctx context.Context, id string, nowMs int64) (bool, error)
	// FinishWaiting moves a waiting_approval job to a terminal state with its error; false when it
	// was not waiting.
	FinishWaiting(ctx context.Context, id, state string, errJSON json.RawMessage, nowMs int64) (bool, error)
}

JobRepo stores jobs. Claim, Progress, Finish and Requeue are single conditional updates; false means the row was not in the expected state.

type JobResult

type JobResult struct {
	Export     *ExportResult     `json:"export,omitempty"`
	Publish    *PublishResult    `json:"publish,omitempty"`
	Transcribe *TranscribeResult `json:"transcribe,omitempty"`
	// FaceTrack is the result of a face_track job (SDD-024 section 6).
	FaceTrack *FaceTrackResult `json:"face_track,omitempty"`
	// Batch is the state of the children of an export_batch job, read from them whenever the job is read.
	Batch *BatchResult `json:"batch,omitempty"`
	Text  *TextResult  `json:"text,omitempty"`
	// Generated is the files an image.generate or voice.generate job stored as assets (SDD-016 section 6.1).
	Generated *GeneratedResult `json:"generated,omitempty"`
	// Image is the file an image.export job wrote (SDD-021 section 6).
	Image *ImageExportResult `json:"image,omitempty"`
}

JobResult has exactly one member set.

type JobRow

type JobRow struct {
	ID        string
	Kind      string  // ingest, transcribe, export, frame
	ProjectID *string // nil for ingest
	AssetHash *string // ingest and transcribe
	Actor     string
	State     string // queued, running, succeeded, failed, cancelled
	Progress  float64
	Message   string
	Input     json.RawMessage
	// InputLocked says the input is sealed and the studio is locked, so Input is empty (SDD-005 section 5.17.2).
	InputLocked     bool
	Result          json.RawMessage
	Error           json.RawMessage // typed error object (SDD-002 A.8)
	CancelRequested bool
	Attempts        int
	CreatedMs       int64
	UpdatedMs       int64
	StartedMs       *int64
	FinishedMs      *int64
	// ApprovalID is the approval request a job in state waiting_approval waits on, and the request
	// that released it afterwards (SDD-015 section 5); empty for a job that needs none.
	ApprovalID string
}

JobRow is a job of the editor (ADR-0018), not a vukem queue row.

type JobRun added in v0.32.0

type JobRun struct {
	ID        string
	Kind      string
	Actor     string
	ProjectID string
	Input     json.RawMessage
	// Report records the progress of the job, 0 to 1, and a short message.
	Report func(ctx context.Context, progress float64, message string)
	// SaveInput replaces the input the job is given, durably: a run that is interrupted and queued again starts
	// with the saved input, so a job that submits work to a provider saves its task id here before it waits.
	SaveInput func(ctx context.Context, input json.RawMessage) error
	// CancelRequested reports whether a person asked for this job to be cancelled (a shutdown is not that).
	CancelRequested func(ctx context.Context) bool
}

JobRun is the job as Run sees it.

type JobRunner

type JobRunner interface {
	// RunJob runs the job whose message was delivered. It returns nil when the
	// job was finished, was taken by another delivery or does not exist, and
	// the context error when a shutdown interrupted it (the job is requeued).
	RunJob(ctx context.Context, jobID string) error
	// Recover is the start-up recovery of SDD-005 section 14.5.
	Recover(ctx context.Context) error
	// Cancel asks a job to stop (SDD-005 section 14.4) and returns when the
	// request is recorded; a queued job is cancelled at once, a running one
	// as soon as its context ends.
	Cancel(ctx context.Context, jobID string) error
}

JobRunner is the worker side of the service: the queue handlers and the start-up recovery call it. It is not an operation of the Service interface, because no caller of the API may drive a job by hand.

func RunnerOf

func RunnerOf(s Service) (JobRunner, bool)

RunnerOf returns the JobRunner of a Service made by New.

type JobStartRequest

type JobStartRequest struct {
	ProjectID  string          `json:"project_id"`
	TimelineID string          `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Kind       string          `json:"kind"`
	Args       json.RawMessage `json:"args,omitempty"`
	WaitMS     int             `json:"wait_ms,omitempty"`
	DryRun     bool            `json:"dry_run,omitempty"`
}

JobStartRequest starts a job of a project; only the kind "export" exists in this build.

type Key

type Key struct {
	KeyID      string     `json:"key_id"`
	Name       string     `json:"name"`
	Scopes     []string   `json:"scopes"`
	ProjectID  *string    `json:"project_id"`
	CreatedAt  time.Time  `json:"created_at"`
	LastUsedAt *time.Time `json:"last_used_at"`
	ExpiresAt  *time.Time `json:"expires_at"`
	RevokedAt  *time.Time `json:"revoked_at"`
	UserID     string     `json:"-"`
}

Key is an API key as a client sees it: never the secret and never its hash.

type KeyCreateRequest

type KeyCreateRequest struct {
	Name          string   `json:"name"`
	Scopes        []string `json:"scopes"`
	ProjectID     string   `json:"project_id,omitempty"`
	ExpiresInDays int      `json:"expires_in_days,omitempty"`
}

KeyCreateRequest is SDD-007 section 4.2 "Creation".

type KeyCreateResult

type KeyCreateResult struct {
	Key    Key    `json:"key"`
	Secret string `json:"secret"`
}

KeyCreateResult carries the secret, the one time it is shown.

type KeyLimitError

type KeyLimitError struct {
	Rate   bool // the creations of the last hour; otherwise the active keys
	Active int
	Recent int
	Oldest time.Time // the earliest creation of the window
}

KeyLimitError is what CreateKey returns when a limit stops the creation.

func (*KeyLimitError) Error

func (e *KeyLimitError) Error() string

type KeyListRequest

type KeyListRequest struct{}

KeyListRequest has no member: a user lists their own keys.

type KeyListResult

type KeyListResult struct {
	Keys []Key `json:"keys"`
}

KeyListResult is the keys of the caller.

type KeyRevokeRequest

type KeyRevokeRequest struct {
	KeyID string `json:"key_id"`
}

KeyRevokeRequest names the key.

type KeyStore

type KeyStore interface {
	// CreateKey checks the limits of k and, in the same step, issues the secret
	// and records the key; it returns *KeyLimitError when a limit is reached.
	CreateKey(ctx context.Context, k NewKey) (secret string, key Key, err error)
	// ListKeys returns the keys of a user, newest first.
	ListKeys(ctx context.Context, userID string) ([]Key, error)
	// RevokeKey revokes a key at once and keeps its row. userID "" matches a
	// key of any owner. A key that does not exist for that owner is ErrNotFound.
	RevokeKey(ctx context.Context, keyID, userID string) (Key, error)
}

KeyStore is where the keys of network mode live (SDD-007 section 4.2). The service validates and decides; the store holds the rows and issues the secret, which only the web layer can do because the generator is vukem's.

type LibraryAsset

type LibraryAsset = assets.LibraryAsset

LibraryAsset is one file of the workspace by content, with the hash that the brand kit and font.add take, its origin, tags and reuse (SDD-011 section 14.1).

type LibraryEntry added in v0.31.0

type LibraryEntry struct {
	Kind        string `json:"kind"` // memory, skill or prompt
	Name        string `json:"name"`
	Description string `json:"description"      untrusted:"true"`
	Scope       string `json:"scope,omitempty"`  // memory: workspace or a project id
	Origin      string `json:"origin,omitempty"` // skills: built-in, user or imported
	Reviewed    bool   `json:"reviewed"`         // skills: a person read it as it is now
	Loaded      bool   `json:"loaded,omitempty"` // skills: the agent session of the request has read it (SDD-018 section 7)
	Kept        bool   `json:"kept"`             // memory: a person kept it
	Actor       string `json:"actor,omitempty"`
	// ActorName is how a screen names the agent that wrote the entry ("Claude Code"); empty for a person
	// (SDD-018 section 18).
	ActorName string `json:"actor_name,omitempty"`
	// ProjectName is the name of the project a memory note is scoped to, beside Scope, which holds its id.
	ProjectName string    `json:"project_name,omitempty"  untrusted:"true"`
	Tags        []string  `json:"tags,omitempty"          untrusted:"true"`
	State       string    `json:"state"` // ok, or invalid when the file cannot be read
	Error       string    `json:"error,omitempty"         untrusted:"true"`
	LintErrors  int       `json:"lint_errors,omitempty"`
	LintWarns   int       `json:"lint_warnings,omitempty"`
	HasScripts  bool      `json:"has_scripts,omitempty"` // skills: the folder holds a script, stored inert
	UpdatedAt   time.Time `json:"updated_at"`
	// Warning is a sentence of the product that says why an entry is not offered to an agent.
	Warning string `json:"warning,omitempty"`
}

LibraryEntry is one row of a list: what is known of an entry without its body.

type LibraryFinding added in v0.31.0

type LibraryFinding struct {
	Code     string `json:"code"`
	Severity string `json:"severity"` // error or warning
	Path     string `json:"path,omitempty"`
	Line     int    `json:"line,omitempty"`
	Message  string `json:"message"`
}

LibraryFinding is one result of the skill lint.

type LibraryHit added in v0.31.0

type LibraryHit struct {
	LibraryEntry
	Snippet string `json:"snippet" untrusted:"true"`
}

LibraryHit is a result of a search.

type LibraryListResult added in v0.31.0

type LibraryListResult struct {
	Envelope
	Kind    string         `json:"kind"`
	Entries []LibraryEntry `json:"entries"`
	Text    string         `json:"text"`
}

LibraryListResult is a list of entries of one kind.

type LibraryRef added in v0.31.0

type LibraryRef struct {
	Name string `json:"name"`
	// AgentView is set by an agent surface: the call then sees only what is reviewed or kept.
	AgentView bool `json:"agent_view,omitempty"`
}

LibraryRef names one entry.

type LibraryReindexRequest added in v0.31.0

type LibraryReindexRequest struct{}

LibraryReindexRequest has no members.

type LibraryReindexResult added in v0.31.0

type LibraryReindexResult struct {
	Envelope
	Memory  int      `json:"memory"`
	Skills  int      `json:"skills"`
	Prompts int      `json:"prompts"`
	Invalid int      `json:"invalid"`
	Ignored []string `json:"ignored,omitempty" untrusted:"true"` // file names that are not valid names
	Text    string   `json:"text"`
}

LibraryReindexResult says what the rebuild of the index found.

type LibraryRemoveResult added in v0.31.0

type LibraryRemoveResult struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
	Text string `json:"text"`
}

LibraryRemoveResult says what was removed.

type LibrarySearchRequest added in v0.31.0

type LibrarySearchRequest struct {
	Query             string   `json:"query"`
	Kinds             []string `json:"kinds,omitempty"`
	Scope             string   `json:"scope,omitempty"`
	Tags              []string `json:"tags,omitempty"`
	Origin            string   `json:"origin,omitempty"`
	IncludeUnreviewed bool     `json:"include_unreviewed,omitempty"`
	Limit             int      `json:"limit,omitempty"`  // default 20, at most 50
	Budget            int      `json:"budget,omitempty"` // characters, default 4000, at most 16000
	AgentView         bool     `json:"agent_view,omitempty"`
}

LibrarySearchRequest is one full-text query over the three kinds.

type LibrarySearchResult added in v0.31.0

type LibrarySearchResult struct {
	Envelope
	Hits      []LibraryHit `json:"hits"`
	Total     int          `json:"total"`
	Truncated bool         `json:"truncated,omitempty"`
	Text      string       `json:"text"`
}

LibrarySearchResult is the answer of a search; it fits its budget.

type Lifecycle added in v0.55.0

type Lifecycle interface {
	OnLock(fn func())
	OnUnlock(fn func())
}

Lifecycle is what the Service asks of the account manager: to be told when the studio locks and when it unlocks (ADR-0053). account.Manager is the one implementation.

type Limits

type Limits struct {
	MaxImportBytes     int64 // STUARTY_MAX_IMPORT_BYTES
	MinFreeBytes       int64 // STUARTY_MIN_FREE_BYTES
	MaxIngests         int   // STUARTY_MAX_INGESTS: ingest jobs running at once
	MaxQueuedIngests   int   // ingest jobs waiting
	MaxExports         int   // STUARTY_MAX_EXPORTS: exports queued or running
	MaxExportsPerActor int   // STUARTY_MAX_EXPORTS_PER_KEY: running; two more may wait
	// MaxTranscribes is STUARTY_MAX_TRANSCRIBES: transcriptions running at once.
	MaxTranscribes int
	// MaxTranscribesPerActor is STUARTY_MAX_TRANSCRIBES_PER_KEY: the
	// transcriptions of one actor that are queued or running.
	MaxTranscribesPerActor int
	// MaxTranscribeSeconds is STUARTY_MAX_TRANSCRIBE_SECONDS: the longest audio of one job.
	MaxTranscribeSeconds int64
	// MaxExportBytes is STUARTY_MAX_EXPORT_BYTES: the largest exported file.
	MaxExportBytes int64
	Ceilings       ffmpeg.Ceilings
}

Limits are the ceilings of SDD-007 section 9.1 that this part of the service enforces. A zero field takes its default.

func (Limits) WithDefaults

func (l Limits) WithDefaults() Limits

WithDefaults is the limits with every unset field at its default; the workers of the owner size themselves from it.

type LintRequest

type LintRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Severity   string `json:"severity,omitempty"`    // minimum to list; default "warning" (everything); "error"
	Page
}

LintRequest runs the whole lint on the current revision.

type LintResult

type LintResult struct {
	ProjectID  string         `json:"project_id"`
	Revision   int64          `json:"revision"`
	Errors     int            `json:"errors"`
	Warnings   int            `json:"warnings"`
	Findings   []lint.Finding `json:"findings"`
	NextCursor *string        `json:"next_cursor"`
	Text       string         `json:"text"`
}

LintResult is a page of findings with the totals over all of them.

type LintTotals

type LintTotals struct {
	Errors    int    `json:"errors"`
	Warnings  int    `json:"warnings"`
	LintScope string `json:"lint_scope,omitempty"`
}

LintTotals counts findings. In an edit result LintScope is "fast": only the doc and item rules ran, so the totals can differ from lint of the project, which runs every rule (VV-082).

type Loudness

type Loudness struct {
	IntegratedLUFS *float64 `json:"integrated_lufs"`
	RangeLU        float64  `json:"range_lu"`
	TruePeakDBTP   *float64 `json:"true_peak_dbtp"`
}

Loudness is the measured loudness of the audio of an asset.

type Media

type Media struct {
	Content *enginestore.Store
	Guard   *pathguard.Guard
	Runner  *ffmpeg.Runner
	// FFmpegMissing is Discover's error when ffmpeg or ffprobe cannot be used.
	// An ingest or an export returns it; editing does not read it.
	FFmpegMissing error
	Caps          *ffmpeg.Capabilities
	Ingest        Ingester
	// Frames renders the frames and sheets of ViewFrame and ViewSheet.
	Frames *frame.Frames
	// FreeBytes reports the free space of the volume of a directory.
	FreeBytes func(dir string) (uint64, error)
}

Media is what the import and the ingest need from the process: the content store, the path guard and the FFmpeg runner. A zero Media makes MediaImport answer E_INTERNAL; the tests of the other operations never set it.

type MediaEntry

type MediaEntry struct {
	AssetID         string   `json:"asset_id"`
	Name            string   `json:"name"             untrusted:"true"` // base name; untrusted
	Kind            string   `json:"kind"`
	State           string   `json:"state"`
	Progress        float64  `json:"progress"`
	DurationFrames  *int64   `json:"duration_frames"`
	DurationSeconds *float64 `json:"duration_seconds"`
	Width           int      `json:"width,omitempty"`
	Height          int      `json:"height,omitempty"`
	HasAudio        bool     `json:"has_audio"`
	Trashed         bool     `json:"trashed"`
	Strip           *Strip   `json:"strip,omitempty"`
	Error           *Error   `json:"error,omitempty"`
}

MediaEntry is one asset of the list.

type MediaImportRequest

type MediaImportRequest struct {
	ProjectID  string       `json:"project_id"`
	TimelineID string       `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Files      []ImportFile `json:"files"`
	WaitMS     int          `json:"wait_ms,omitempty"` // 0 to 25000
	DryRun     bool         `json:"dry_run,omitempty"` // checks paths and limits, copies nothing
	// Origin says where the files came from; every file of the call shares it (SDD-011 section 14.2).
	Origin *asset.Origin `json:"origin,omitempty"`
	// Info is applied to the files of the call (SDD-011 section 14.4).
	Info *AssetInfo `json:"info,omitempty"`
}

MediaImportRequest imports 1 to 50 files into a project.

type MediaImportResult

type MediaImportResult struct {
	Envelope
	ProjectID string          `json:"project_id"`
	Revision  int64           `json:"revision"`
	Assets    []ImportedAsset `json:"assets"`
	Failed    int             `json:"failed"`
	Imported  int             `json:"imported"`
	Text      string          `json:"text"`
}

MediaImportResult answers MediaImport.

type MediaInspectRequest

type MediaInspectRequest struct {
	ProjectID  string   `json:"project_id"`
	TimelineID string   `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	AssetID    string   `json:"asset_id"`
	Sections   []string `json:"sections,omitempty"` // default ["probe"]: probe, transcript, silences, loudness, beats, words, fillers, zooms
	MinSilence string   `json:"min_silence,omitempty"`
	Page
}

MediaInspectRequest reads one asset.

type MediaInspectResult

type MediaInspectResult struct {
	Envelope
	AssetID   string        `json:"asset_id"`
	Kind      string        `json:"kind"`
	State     string        `json:"state"`
	Progress  float64       `json:"progress"`
	Available []string      `json:"available"`
	Strip     *Strip        `json:"strip,omitempty"`
	Probe     *ProbeSummary `json:"probe,omitempty"`
	Silences  []TimeRange   `json:"silences,omitempty"`
	Loudness  *Loudness     `json:"loudness,omitempty"`
	Beats     *BeatGrid     `json:"beats,omitempty"`
	// Words and Fillers answer the sections of that name: the transcript with the timeline range of each word,
	// and the filler words and repetitions to review (SDD-023).
	Words   *TranscriptViewResult   `json:"words,omitempty"`
	Fillers *TranscriptDetectResult `json:"fillers,omitempty"`
	// Zooms answers the section of that name: the zooms in the scale keyframes of the clips that play the asset, which
	// is what a screen take finished with recording.auto_zoom holds (SDD-025 section 17).
	Zooms      []ClipZoom     `json:"zooms,omitempty"`
	Untrusted  *UntrustedData `json:"untrusted,omitempty"`
	Error      *Error         `json:"error,omitempty"`
	NextCursor *string        `json:"next_cursor"`
	Text       string         `json:"text"`
}

MediaInspectResult answers MediaInspect. An asset that is not ready answers with its state and progress instead of an error.

type MediaListRequest

type MediaListRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Page
}

MediaListRequest lists every asset of a project.

type MediaListResult

type MediaListResult struct {
	Envelope
	ProjectID  string       `json:"project_id"`
	Assets     []MediaEntry `json:"assets"`
	NextCursor *string      `json:"next_cursor"`
	Text       string       `json:"text"`
}

MediaListResult answers MediaList.

type MediaStateResult

type MediaStateResult struct {
	AssetID string `json:"asset_id"`
	State   string `json:"state"` // "pending" | "active" | "trashed"
	Text    string `json:"text"`
}

MediaStateResult is the state an asset ended in.

type MediaTrashRequest

type MediaTrashRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	AssetID    string `json:"asset_id"`
	DryRun     bool   `json:"dry_run,omitempty"`
}

MediaTrashRequest trashes or restores an asset of a project.

type MemoryGetResult added in v0.31.0

type MemoryGetResult struct {
	Envelope
	Entry LibraryEntry `json:"entry"`
	Body  string       `json:"body"  untrusted:"true"`
	Text  string       `json:"text"`
}

MemoryGetResult is a note.

type MemoryListRequest added in v0.31.0

type MemoryListRequest struct {
	Scope             string   `json:"scope,omitempty"`
	Tags              []string `json:"tags,omitempty"`
	IncludeUnreviewed bool     `json:"include_unreviewed,omitempty"` // notes no person kept yet
	AgentView         bool     `json:"agent_view,omitempty"`
}

MemoryListRequest lists the notes.

type MemoryWriteRequest added in v0.31.0

type MemoryWriteRequest struct {
	Name        string   `json:"name,omitempty"` // empty: made from the description
	Description string   `json:"description"`
	Scope       string   `json:"scope,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Body        string   `json:"body,omitempty"`
	// Keep is for a person: true keeps the note, false releases it. A note a person writes is kept.
	Keep *bool `json:"keep,omitempty"`
}

MemoryWriteRequest writes a note: it creates it, or replaces the one of that name.

type MemoryWriteResult added in v0.31.0

type MemoryWriteResult struct {
	Envelope
	Entry LibraryEntry `json:"entry"`
	Text  string       `json:"text"`
}

MemoryWriteResult is the note that was written.

type MigrateError

type MigrateError struct {
	Kind string // "project" or "template"
	ID   string
	Err  error
}

MigrateError is a document that could not be migrated: it names the project or template, and the start-up stops (SDD-005 section 8, NFR-012). Nothing of that document was written.

func (*MigrateError) Error

func (e *MigrateError) Error() string

func (*MigrateError) Unwrap

func (e *MigrateError) Unwrap() error

type MigrateOptions

type MigrateOptions struct {
	// NowMs is the clock for the backup rows and the log rows.
	NowMs int64
	// Migrate chains the migration functions of a document; the default is
	// timeline.Migrate. Tests replace it to exercise a version that does not exist yet.
	Migrate func(timeline.RawDoc) (timeline.RawDoc, error)
}

MigrateOptions of MigrateStoredDocuments.

type MigrateResult

type MigrateResult struct {
	Projects  int
	Templates int
}

MigrateResult counts what a start-up migrated.

func MigrateStoredDocuments

func MigrateStoredDocuments(ctx context.Context, st Store, o MigrateOptions) (MigrateResult, error)

MigrateStoredDocuments is step 5 of the start-up order (SDD-005 section 7, section 8): every project and template whose schema_version is below the current one is migrated in its own write transaction, holding the project lock. The original document is kept in document_backups; a project also gets a `migrate` log row that closes every undo and redo chain, and a resync floor at its new revision, so no client resumes a stream across the migration. A failure rolls back that document, names it and stops: a half-migrated workspace would break NFR-012. No client is connected at start-up, so no event is published.

type ModelPicker

type ModelPicker interface {
	// InstalledModels are the names of the models installed and verified now.
	InstalledModels() []string
	// WithModel is the provider bound to one model, installed or not.
	WithModel(model string) transcribe.Provider
}

ModelPicker is implemented by a provider that can run more than one model, so a job may name one of the installed models (VV-007).

type ModelView added in v0.34.0

type ModelView struct {
	ID            string `json:"id"`
	Name          string `json:"name"           untrusted:"true"`
	ContextTokens int    `json:"context_tokens"`
	OutputTokens  int    `json:"output_tokens"`
	// Price is nil when none is known: a generation with this model is refused until a person sets one.
	Price *provider.Price `json:"price"`
	// PriceSource is user, catalogue or none (provider.Source*).
	PriceSource string `json:"price_source"`
	// Capability is the hint of the adapter: text, image, voice or empty (SDD-016 section 2.2).
	Capability string `json:"capability,omitempty"`
}

ModelView is a model of the catalogue with the price that would be used and where it comes from.

type MotionBrand added in v0.35.0

type MotionBrand struct {
	Colors map[string]string `json:"colors,omitempty"` // name to #RRGGBB
	Fonts  []string          `json:"fonts,omitempty"`  // family names
}

MotionBrand is the part of the brand kit a render needs: names and values, never a file.

type MotionBriefRequest added in v0.35.0

type MotionBriefRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	From       string `json:"from,omitempty"`        // a time; default 0s
	Until      string `json:"until,omitempty"`       // a time, exclusive; default the end of the timeline
	TrackID    string `json:"track_id,omitempty"`    // the visual track the clip goes on
}

MotionBriefRequest asks for the brief of a range of a timeline.

type MotionBriefResult added in v0.35.0

type MotionBriefResult struct {
	Envelope
	ProjectID      string            `json:"project_id"`
	Revision       int64             `json:"revision"`
	From           TimeValue         `json:"from"`
	Until          TimeValue         `json:"until"`
	Width          int               `json:"width"`
	Height         int               `json:"height"`
	FrameRate      timeline.Rational `json:"frame_rate"`
	DurationFrames int               `json:"duration_frames"`
	Duration       TimeValue         `json:"duration"`
	SafeArea       motion.Rect       `json:"safe_area"`
	Margins        motion.Margins    `json:"margins"`
	Track          *motion.TrackInfo `json:"track,omitempty"`
	NeedsAlpha     bool              `json:"needs_alpha"`
	BrandKit       MotionBrand       `json:"brand_kit"`
	Captions       []MotionCaption   `json:"captions"`
	Frames         []MotionFrame     `json:"frames"`
	// ImageTokens is the total of the reference frames.
	ImageTokens int    `json:"image_tokens"`
	Text        string `json:"text"`
}

MotionBriefResult is what an external render must fit (SDD-011 section 15.1).

type MotionCaption added in v0.35.0

type MotionCaption struct {
	ItemID string `json:"item_id"`
	Start  int    `json:"start"`
	End    int    `json:"end"`
	Text   string `json:"text"    untrusted:"true"`
}

MotionCaption is a caption inside the range; Start and End are frames relative to the start of the range.

type MotionCheckRequest added in v0.35.0

type MotionCheckRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	AssetID    string `json:"asset_id"`
	From       string `json:"from,omitempty"`     // a time; default 0s
	Until      string `json:"until,omitempty"`    // a time, exclusive; default the end of the timeline
	TrackID    string `json:"track_id,omitempty"` // the visual track the clip goes on
}

MotionCheckRequest asks whether an asset fits the brief of a range of a timeline: the request of the brief and the asset.

type MotionCheckResult added in v0.35.0

type MotionCheckResult struct {
	Envelope
	ProjectID string `json:"project_id"`
	Revision  int64  `json:"revision"`
	AssetID   string `json:"asset_id"`
	AssetName string `json:"asset_name" untrusted:"true"`
	// OK is true when the asset fits the brief.
	OK         bool              `json:"ok"`
	Mismatches []motion.Mismatch `json:"mismatches"`
	// The brief the file was compared with.
	Width          int               `json:"width"`
	Height         int               `json:"height"`
	FrameRate      timeline.Rational `json:"frame_rate"`
	DurationFrames int               `json:"duration_frames"`
	NeedsAlpha     bool              `json:"needs_alpha"`
	Text           string            `json:"text"`
}

MotionCheckResult lists each way a file does not fit the brief, with the value expected (SDD-011 section 15.3).

type MotionFrame added in v0.35.0

type MotionFrame struct {
	Role        string    `json:"role"` // before or after
	At          TimeValue `json:"at"`
	Width       int       `json:"width"`
	Height      int       `json:"height"`
	ImageTokens int       `json:"image_tokens"`
	MIME        string    `json:"mime"`
	// Path is the cached file for a local caller; any other caller gets the bytes.
	Path  string `json:"path,omitempty"`
	Image []byte `json:"image_base64,omitempty" bulk:"true"`
}

MotionFrame is a reference picture of the composed timeline just outside the range.

type MotionReplaceRequest added in v0.35.0

type MotionReplaceRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	AssetID    string `json:"asset_id"`              // the new render, an asset of the timeline
	// RenderKey is the key of the animation; default the render key of the origin of the new asset.
	RenderKey string `json:"render_key,omitempty"`
	DryRun    bool   `json:"dry_run,omitempty"`
}

MotionReplaceRequest replaces, in one batch, the media of every clip that reads an earlier render of an animation with a new render of it (SDD-011 section 15.4).

type MotionReplaceResult added in v0.35.0

type MotionReplaceResult struct {
	EditResult
	RenderKey string   `json:"render_key"`
	AssetID   string   `json:"asset_id"`
	Replaced  []string `json:"replaced"` // the item ids
}

MotionReplaceResult is the edit of the batch and the clips it replaced.

type MotionService added in v0.35.0

type MotionService interface {
	MotionBrief(ctx context.Context, req MotionBriefRequest) (*MotionBriefResult, error)
	MotionCheck(ctx context.Context, req MotionCheckRequest) (*MotionCheckResult, error)
	MotionReplace(ctx context.Context, req MotionReplaceRequest) (*MotionReplaceResult, error)
}

MotionService is the hand-off from an external motion engine (SDD-011 section 15): what a render must fit, whether a file does and the replacement of a clip's media. The rules are in core/motion; the product runs no engine.

type NewKey

type NewKey struct {
	KeyID     string
	UserID    string
	Name      string
	Scopes    []string
	ProjectID string
	TTL       time.Duration
	// The limits, checked by the store in the same step as the insert so that
	// concurrent creations cannot all pass the check.
	Now       time.Time
	MaxActive int
	MaxRecent int
	Window    time.Duration
}

NewKey is what the key store records for a key that passed validation.

type OpEffect

type OpEffect struct {
	Index     int            `json:"index"`
	Op        string         `json:"op"`
	Effective map[string]any `json:"effective"`
	Created   []string       `json:"created,omitempty"`
}

OpEffect is what one operation of a batch did.

type OperationFilter

type OperationFilter struct {
	ExcludeActor string // when set, rows of this actor are left out
	Limit        int    // maximum rows; 0 means 1000
	MaxBytes     int    // stop after the row that makes the total of Ops+Inverse+Diff exceed this; 0 means no limit
}

OperationFilter bounds OperationRepo.Since.

type OperationKind

type OperationKind string

OperationKind is the kind of a committed batch.

const (
	OpEdit    OperationKind = "edit"
	OpUndo    OperationKind = "undo"
	OpRedo    OperationKind = "redo"
	OpMigrate OperationKind = "migrate"
	OpImport  OperationKind = "import"
)

The kinds of operation rows.

type OperationRepo

type OperationRepo interface {
	Append(ctx context.Context, row OperationRow) error // ErrExists on a duplicate revision
	Get(ctx context.Context, projectID string, revision int64) (OperationRow, error)
	// Count is the number of rows of the project, of one actor when actor is set.
	Count(ctx context.Context, projectID, actor string) (int64, error)
	// Since returns rows with revision > after in ascending order.
	Since(ctx context.Context, projectID string, after int64, f OperationFilter) ([]OperationRow, error)
	// Page returns rows in descending order and whether older rows exist.
	Page(ctx context.Context, projectID string, q HistoryQuery) ([]OperationRow, bool, error)
	UndoCandidate(ctx context.Context, projectID, actor string) (OperationRow, error) // ErrNotFound: nothing to undo
	RedoCandidate(ctx context.Context, projectID, actor string) (OperationRow, error) // ErrNotFound: nothing to redo
	// Close sets closed_by on one row (it was consumed by that revision).
	// ErrStale when the row is missing or already closed.
	Close(ctx context.Context, projectID string, revision, by int64) error
	// CloseOpenRedo closes every open undo row of the actor (a new edit ends its redo chain).
	CloseOpenRedo(ctx context.Context, projectID, actor string, by int64) error
	// CloseAllOpen closes every open row of the project (a migration or import ends all undo chains).
	CloseAllOpen(ctx context.Context, projectID string, by int64) error
}

OperationRepo stores the operation log.

type OperationRow

type OperationRow struct {
	ProjectID      string
	Revision       int64
	Kind           OperationKind
	Actor          string
	BaseRevision   int64
	TargetRevision *int64 // undo and redo: the batch consumed
	AtMs           int64
	Ops            json.RawMessage // []command.Operation, ids filled in, resolved included
	Inverse        json.RawMessage // []command.Primitive in apply order
	Diff           json.RawMessage // []command.Change
	Skipped        json.RawMessage // []Skipped, undo and redo only; else nil
	SchemaVersion  int
	DocSHA256      string
	ClosedBy       *int64
	IdempotencyKey *string
}

OperationRow is one row of the append-only operation log.

type Options

type Options struct {
	Store Store
	// Gate closes every operation but the ones of LockedAllowed while the studio is locked (ADR-0052); nil
	// leaves the Service always open.
	Gate Gate
	// Files seals the files of the library with the data key of the account (ADR-0053); nil leaves them clear text.
	Files account.FileSealer
	// Lifecycle tells the Service when the studio locks and unlocks, so it drops what the key made readable (the index
	// of the library, the caches) at lock and builds the index at the unlock; nil for a workspace with no account.
	Lifecycle Lifecycle
	// Registry is the command registry of the build; default command.Default().
	Registry *command.Registry
	// Now is the service clock (SDD-005 section 2 item 2); default time.Now.
	Now func() time.Time
	// NewIDs makes identifiers; default timeline.NewID (cryptographic).
	NewIDs func(prefix string) string
	// Publish receives events after the commit, in revision order per project.
	Publish func(Event)
	// Lint is the environment of the lint rules. SafeArea defaults to
	// plan.SafeArea; TextSize is the text Measurer that production supplies
	// (web/app/owner/lintmeasure.go); while it is nil, L_SAFE_AREA is skipped.
	Lint lint.Env

	// Workspace is the workspace directory: the content store, the artifacts
	// and the exports are under it.
	Workspace string
	// Media is the import and ingest machinery; see Media.
	Media Media
	// Exporter renders and verifies exports; JobStart for an export answers
	// E_INTERNAL without one.
	Exporter Exporter
	// Enqueue delivers a job to the workers. Without one the job rows are
	// created and nothing runs them.
	Enqueue Enqueuer
	// Limits are the ceilings of SDD-007 section 9.1.
	Limits Limits
	// Version is the binary version written into the template files.
	Version string
	// BuiltInSkills is the set of skills that ship with the product, one folder per skill; the service
	// installs it into the library at start (SDD-018 section 16). Nil installs none.
	BuiltInSkills fs.FS
	// Transcriber is the transcription provider of the transcribe job; without
	// one JobStart for it answers E_TRANSCRIBE_UNAVAILABLE.
	Transcriber transcribe.Provider
	// FaceDetector replaces the face helper of the install set; nil runs the helper of tools/ when it is
	// installed (SDD-024). Tests supply a fake.
	FaceDetector FaceDetector
	// Tools is the install step of the helper; nil means it is not available.
	Tools *Tools
	// Doctor is what the diagnostic report learns from the process.
	Doctor DoctorOptions
	// Keys stores the API keys of network mode; without one the key operations
	// answer E_NOT_FOUND, as in local mode.
	Keys KeyStore
	// Connections is the registry of the destinations the user connected and the holder of their
	// credentials; without one the service builds a registry over the store with a vault in the
	// workspace that has no master key source, so a connection cannot be created (SDD-014).
	Connections *connections.Manager
	// Social is the registry of the social network connectors (SDD-020); without one the build publishes
	// to no network and the social operations answer empty lists.
	Social *social.Registry
	// Blog is the registry of the blog destinations (SDD-020 part 5); without one the service has the five of the
	// build.
	Blog *destinations.Registry
	// Providers is the registry of the AI providers, with their adapters registered (SDD-016); without one
	// the service has a registry with no provider, so no generation can start.
	Providers *providers.Registry
	// SignIns are the sign-ins to an AI provider of this build (SDD-016 section 12); without any the
	// sign-in operations answer that none is built in, and no credential is ever renewed.
	SignIns *oauth.SignIns
	// JobKinds are the job kinds that need approval, registered by the epics of publishing and
	// generation (SDD-015 section 5). The product registers none of its own; tests register one.
	JobKinds []ApprovableKind
	// Heavy limits the heavy operations (jobs, media, template, font, bundle and OpenTimelineIO imports and exports) per actor; nil counts nothing.
	Heavy RateLimiter
	// HeavyPerMinute is the limit Heavy enforces, for the error message; zero is HeavyPerMinute.
	HeavyPerMinute int
	// Log receives the job lines (start, end, failure); nil discards them.
	Log *slog.Logger
	// WebP encodes the WebP export of an image; without one that format answers webp_unavailable (SDD-021 section 6).
	WebP export.WebPEncoder
	// JobWait is how long TrashEmpty waits for the jobs of a trashed project to stop; zero is 15 s.
	JobWait time.Duration
	// SchedulerClock is the clock the publication scheduler sleeps on; tests move it. Default: the service
	// clock to read and the system timer to wait.
	SchedulerClock pub.Clock
	// Agents hosts the agent a user installed, for the chat (SDD-017). Nil in a process that only runs a
	// command: the chat operations that need a process then answer E_AGENT_UNAVAILABLE, and the reads work.
	Agents *agenthost.Host
	// WebhookTimeout is how long one delivery of an outbound webhook may take; zero is 10 s (SDD-022). Tests shorten it.
	WebhookTimeout time.Duration
	// Capture is the native capture helper (SDD-025); nil where capture does not exist, and then CaptureReason
	// says why (platform, web, network_mode or helper_missing) in E_CAPTURE_UNAVAILABLE.
	Capture       Capturer
	CaptureReason string
	// RecordingMaxSeconds is the longest recording (STUARTY_MAX_RECORDING_SECONDS); zero is 14,400.
	RecordingMaxSeconds int
}

Options configure New. Store is required.

type OtioLost

type OtioLost struct {
	ID      string `json:"id,omitempty"`
	Name    string `json:"name,omitempty" untrusted:"true"`
	Feature string `json:"feature"        untrusted:"true"`
}

OtioLost is an item an OpenTimelineIO conversion could not carry. Its name and feature come from a project or from an imported file, so they are untrusted (SDD-007 section 8.1).

type OtioMatch

type OtioMatch struct {
	Ref     string `json:"ref"      untrusted:"true"`
	AssetID string `json:"asset_id"`
	Matched string `json:"matched"` // always "by_name"
}

OtioMatch is a media reference of an imported file answered by an asset of the project because the names are equal. The file carries no content hash, so the match is not proof of identity (VV-025).

type OtioMedia

type OtioMedia struct {
	Ref    string `json:"ref"              untrusted:"true"`
	Status string `json:"status"`
	Reason string `json:"reason,omitempty" untrusted:"true"`
}

OtioMedia is a media reference of an imported file. The reference and the reason come from the file, so they are untrusted.

type Page

type Page struct {
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"` // default: per operation, SDD-003 section 3.10
}

Page selects a page of a list (SDD-003 section 1.5).

type PlanWindowRequest

type PlanWindowRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	From       int    `json:"from"`
	Until      int    `json:"until"`
	// Width is the output width in pixels the preview draws at; 0 is the project width. The
	// bitmaps of the plan are rasterized at that scale, as ViewFrame does (SDD-004 section 10).
	Width int `json:"width,omitempty"`
	// Pin, when not 0, must be the current revision (SDD-003 section 6.3). Set
	// by the HTTP adapter from rev; never on the wire of the Service.
	Pin int64 `json:"-"`
}

PlanWindowRequest asks for the render plan of frames From up to, not including, Until (SDD-004 section 10).

type PlanWindowResult

type PlanWindowResult = plan.WindowPlan

PlanWindowResult is the compact plan of a window; Revision is the revision it was read at.

type PostCheckRequest added in v0.41.0

type PostCheckRequest struct {
	ProjectID string `json:"project_id"`
	ItemID    string `json:"item_id"`
}

PostCheckRequest names a stored post.

type PostCheckResult added in v0.41.0

type PostCheckResult struct {
	Envelope
	ProjectID string           `json:"project_id"`
	ItemID    string           `json:"item_id"`
	Meta      writing.PostMeta `json:"meta"`
	// Slug is the slug the post is sent with: the one of the front matter, or the one made from the title.
	Slug string `json:"slug"`
	// OK is true when the post has no issue.
	OK     bool                `json:"ok"`
	Issues []writing.PostIssue `json:"issues"`
	Images []PostImageReport   `json:"images"`
	Words  int                 `json:"words"`
	// Markdown is the body after the front matter, which the page shows as the preview; the page computes none of it.
	Markdown string `json:"markdown" untrusted:"true"`
	// HTML is the sanitised rendering of the body, with the images written as images/<name>. It is for a destination:
	// a surface that draws a preview draws the structure of the text, never this field as markup (SDD-019 section 11).
	HTML string `json:"html" untrusted:"true"`
	Text string `json:"text"`
}

PostCheckResult is the check of a post: its metadata, every problem and the sanitised HTML.

type PostImageReport added in v0.41.0

type PostImageReport struct {
	// AssetID is the id in the text; Role is cover or body.
	AssetID string `json:"asset_id"`
	Role    string `json:"role"`
	// Name is the file name the image gets in images/.
	Name string `json:"name"`
	// Found is true when the id is an active image asset of the project.
	Found       bool   `json:"found"`
	Bytes       int64  `json:"bytes,omitempty"`
	ContentType string `json:"content_type,omitempty"`
}

PostImageReport is one image the post uses: its reference, where it goes in a package, and whether the project has it as an image.

type Prepared added in v0.32.0

type Prepared struct {
	// Summary tells the person what will be sent or generated, at most 500 characters of plain text.
	Summary string
	// ConnectionID is the destination connection of the action; empty when it has none.
	ConnectionID string
	// Estimate is the estimated cost; zero micros for an action that costs nothing.
	Estimate core.Money
	// Input is what the job needs to run; it is stored in the job and given to Run.
	Input json.RawMessage
}

Prepared is what a job kind says about an action before it is approved (SDD-015 section 5).

type ProbeSummary

type ProbeSummary struct {
	Kind       string     `json:"kind"`
	Container  string     `json:"container,omitempty"`
	Duration   *TimeValue `json:"duration,omitempty"` // in project frames; absent for an image
	Width      int        `json:"width,omitempty"`
	Height     int        `json:"height,omitempty"`
	FrameRate  string     `json:"frame_rate,omitempty"`
	VideoCodec string     `json:"video_codec,omitempty"`
	AudioCodec string     `json:"audio_codec,omitempty"`
	SampleRate int        `json:"sample_rate,omitempty"`
	Channels   int        `json:"channels,omitempty"`
	HasAudio   bool       `json:"has_audio"`
	SizeBytes  int64      `json:"size_bytes"`
	// Animated, Frames and LoopDurationMS describe an animated image (APNG, GIF): the number of frames
	// and the time of one pass over the delays of all of them, in milliseconds.
	Animated       bool  `json:"animated,omitempty"`
	Frames         int   `json:"frames,omitempty"`
	LoopDurationMS int64 `json:"loop_duration_ms,omitempty"`
}

ProbeSummary is what the probe says about an asset.

type ProductionHead added in v0.31.0

type ProductionHead struct {
	ID          string
	Name        string
	State       ProjectState
	CreatedMs   int64
	UpdatedMs   int64
	CreatedBy   string
	OwnerUserID *string // network mode only (SDD-007 4.1)
	TrashedMs   *int64
	TrashedBy   *string
	// Context is the description and the goal of the project (SDD-005 section 5.12.2); Name is also its name.
	// Empty text for a project made before epic 56.
	Description string
	Goal        project.Goal
	// Kind is the stored kind of the project, an intent that is undecided until it is chosen, and Skipped the steps
	// of its workflow a person skipped (SDD-005 section 5.12.4). The kind a surface shows is derived from them and
	// from the items by core/project.
	Kind    project.Intent
	Skipped []project.StepID
	// Standalone is true for a lightweight standalone video editor session (SDD-005 section 5.12.5, epic 105).
	Standalone bool
	// Timelines counts the active timeline items.
	Timelines int
	// Timeline is the head of the first active timeline by position; its ID is empty when there is none.
	Timeline ProjectHead
}

ProductionHead is a project in the sense of ADR-0039: the production row, the number of its active timelines and the head of the first of them, which is what the list shows.

type ProductionQuery added in v0.31.0

type ProductionQuery = ProjectQuery

ProductionQuery selects a page of the list of projects; the members are those of ProjectQuery.

type ProductionRepo added in v0.31.0

type ProductionRepo interface {
	List(ctx context.Context, q ProductionQuery) (items []ProductionHead, next string, err error)
	Count(ctx context.Context, q ProductionQuery) (int, error)
	Get(ctx context.Context, id string) (ProductionHead, error) // ErrNotFound
	Create(ctx context.Context, h ProductionHead) error         // ErrExists
	// SetState writes the state of the project and mirrors it on the rows of the timelines of its active timeline
	// items. ErrNotFound when there is no such project.
	SetState(ctx context.Context, id string, st ProjectState, by string, atMs int64) error
	// Touch sets updated_ms.
	Touch(ctx context.Context, id string, atMs int64) error
	// SetContext writes the name, the description and the goal and sets updated_ms. ErrNotFound when there is no
	// such project.
	SetContext(ctx context.Context, id string, c project.Context, atMs int64) error
	// Promote converts a standalone session into a full production project, clearing standalone and writing the
	// validated context and kind in one statement (SDD-005 section 5.12.5).
	Promote(ctx context.Context, id string, c project.Context, kind project.Intent, atMs int64) error
	// SetKind writes the stored kind of the project and sets updated_ms. ErrNotFound when there is no such project.
	SetKind(ctx context.Context, id string, kind project.Intent, atMs int64) error
	// SetSkippedSteps writes the steps the person skipped and sets updated_ms. ErrNotFound when there is no such
	// project.
	SetSkippedSteps(ctx context.Context, id string, steps []project.StepID, atMs int64) error
	// FollowName renames the project id from one name to another, and does nothing when the project is not named
	// from (SDD-005 section 5.12): a rename of its first timeline, while the two carry one name.
	FollowName(ctx context.Context, id, from, to string) error
	// Delete is a hard delete that cascades the items; the timeline rows are the business of the caller. Only
	// TrashEmpty calls it.
	Delete(ctx context.Context, id string) error

	Items(ctx context.Context, projectID string) ([]ItemRow, error) // by position, then id
	Item(ctx context.Context, itemID string) (ItemRow, error)       // ErrNotFound
	CreateItem(
		ctx context.Context,
		it ItemRow,
	) error // ErrExists for a second brief or a timeline already in an item
	UpdateItem(ctx context.Context, it ItemRow) error // title, body, state, trashed_ms, updated_ms
	// SetPositions numbers the items 0 to n-1 in the order of ids.
	SetPositions(ctx context.Context, projectID string, ids []string) error
	// ProjectOfTimeline is the project whose timeline item has ref timelineID; ErrNotFound when none.
	ProjectOfTimeline(ctx context.Context, timelineID string) (string, error)
	// ActiveTimelines lists the active timeline items of a project by position.
	ActiveTimelines(ctx context.Context, projectID string) ([]TimelineRef, error)

	// The texts of a production and their revisions (SDD-019). CreateItem of a text item writes its revision 1
	// ('created') in the same call, so a text item never exists without a revision.
	//
	// TextItems lists text items with the facts of their latest revision, newest first, with the body of each.
	TextItems(ctx context.Context, q TextQuery) (items []TextHead, next string, err error)
	// TextRevisions lists the revisions of a text, newest first, without bodies; before is a revision number to
	// start under (0 for the latest); the answer has at most limit rows.
	TextRevisions(ctx context.Context, itemID string, before, limit int) ([]TextRevisionRow, error)
	// TextRevision reads one revision with its body; ErrNotFound when there is none.
	TextRevision(ctx context.Context, itemID string, revision int) (TextRevisionRow, error)
	// TextLatest is the latest revision of a text, with its body; ErrNotFound when the item has none.
	TextLatest(ctx context.Context, itemID string) (TextRevisionRow, error)
	// AddTextRevision appends a revision and drops those below pruneBefore, and sets the body and the
	// updated_ms of the item to those of the revision.
	AddTextRevision(ctx context.Context, rev TextRevisionRow, pruneBefore int) error
}

ProductionRepo stores projects as productions and their items.

type ProductionService added in v0.31.0

type ProductionService interface {
	ProjectDescribe(ctx context.Context, req ProjectDescribeRequest) (*ProjectDescribeResult, error)
	ProjectDuplicate(ctx context.Context, req ProjectDuplicateRequest) (*ProjectCreateResult, error)
	ProjectItemAdd(ctx context.Context, req ProjectItemAddRequest) (*ProjectItemResult, error)
	ProjectItemMove(ctx context.Context, req ProjectItemMoveRequest) (*ProjectItemResult, error)
	ProjectItemRename(ctx context.Context, req ProjectItemRenameRequest) (*ProjectItemResult, error)
	ProjectItemTrash(ctx context.Context, req ProjectItemTrashRequest) (*ProjectItemResult, error)
	ProjectItemRestore(ctx context.Context, req ProjectItemTrashRequest) (*ProjectItemResult, error)
	ProjectStepSkip(ctx context.Context, req ProjectStepSkipRequest) (*ProjectStepSkipResult, error)
	BriefGet(ctx context.Context, req BriefGetRequest) (*BriefResult, error)
	BriefSet(ctx context.Context, req BriefSetRequest) (*BriefResult, error)
}

ProductionService is the part of the service that works on the production of a project (SDD-003 section 2.3.1, ADR-0039): its items, its brief, its description and its copy. Service embeds it.

type ProductionState added in v0.31.0

type ProductionState = project.Production

ProductionState is what a project has and lacks (RF-303); core/project computes it.

type ProjectAssetRow

type ProjectAssetRow struct {
	ProjectID  string
	AssetID    string // ast_...
	AssetHash  string
	State      ProjectAssetState
	Name       string          // display name at import; untrusted
	Snapshot   json.RawMessage // the SDD-001 Asset object, kept for restore; nil until known
	ImportedBy string
	ImportedMs int64
	TrashedBy  *string
	TrashedMs  *int64
}

ProjectAssetRow maps a project's asset identifier to a hash and its trash state.

type ProjectAssetState

type ProjectAssetState string

ProjectAssetState is the state of a project's use of an asset: pending, active or trashed.

const (
	ProjectAssetPending ProjectAssetState = "pending"
	ProjectAssetActive  ProjectAssetState = "active"
	ProjectAssetTrashed ProjectAssetState = "trashed"
)

The project asset states.

type ProjectBundleExportRequest

type ProjectBundleExportRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	// IncludeLog false leaves operations.ndjson out, to share without history. Default true.
	IncludeLog *bool `json:"include_log,omitempty"`
	WaitMS     int   `json:"wait_ms,omitempty"`
}

ProjectBundleExportRequest asks for a .vvbundle of the current revision of a project (SDD-005 section 16, RF-006).

type ProjectBundleImportRequest

type ProjectBundleImportRequest struct {
	Path string `json:"path"` // absolute
	// AsNew false keeps the project id (E_ID_EXISTS when it exists, even trashed); true makes a
	// new id and leaves the log out.
	AsNew  bool `json:"as_new,omitempty"`
	DryRun bool `json:"dry_run,omitempty"`
}

ProjectBundleImportRequest reads a .vvbundle from the machine of the server (SDD-005 section 16.3).

type ProjectContext added in v0.46.0

type ProjectContext struct {
	Description string      `json:"description" untrusted:"true"`
	Goal        ProjectGoal `json:"goal"`
	Complete    bool        `json:"complete"`
}

ProjectContext is what a project says about itself, and what an agent reads first. Complete is false for a project made before epic 56, which has neither text.

type ProjectCounts

type ProjectCounts struct {
	Tracks       int `json:"tracks"`
	Items        int `json:"items"`
	Assets       int `json:"assets"`
	CaptionWords int `json:"caption_words"`
}

ProjectCounts counts what a project holds.

type ProjectCreateRequest

type ProjectCreateRequest struct {
	Name        string      `json:"name"`        // 4 to 32 characters
	Description string      `json:"description"` // 64 to 1024 characters
	Goal        ProjectGoal `json:"goal"`        // the five parts 16 to 280 characters each, and a due date
	// Preset and FPS are deprecated and create nothing: a video asks for them when it is added (ProjectItemAdd).
	// They are removed in release 1.0.0. Preset is "9:16", "1:1", "16:9" or "4:5"; FPS is "<n>" or "<n>/1001".
	Preset string `json:"preset,omitempty"`
	FPS    string `json:"fps,omitempty"`
	ID     string `json:"id,omitempty"` // optional caller-chosen id; E_ID_EXISTS if taken
	DryRun bool   `json:"dry_run,omitempty"`
	// Kind is what the project is meant to become: "text", "video", "image" or "undecided" (the default). It
	// creates no timeline, format or media (SDD-005 section 5.12.4).
	Kind string `json:"kind,omitempty"`
}

ProjectCreateRequest creates a project with its context and no timeline (SDD-005 section 5.12.2).

type ProjectCreateResult

type ProjectCreateResult struct {
	Envelope
	ProjectID string `json:"project_id"`
	Kind      string `json:"kind"` // the effective kind
	Name      string `json:"name"       untrusted:"true"`
	Revision  int64  `json:"revision"` // 0: a new project has an empty document and no batch yet
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	FPS       string `json:"fps"`
	Created   bool   `json:"created"` // false on a dry run
	Text      string `json:"text"`
}

ProjectCreateResult is the created project.

type ProjectDescribeRequest added in v0.31.0

type ProjectDescribeRequest struct {
	ProjectID string `json:"project_id"`
	MaxTokens int    `json:"max_tokens,omitempty"` // default 1500; 200 to 6000
}

ProjectDescribeRequest asks for the text view of a production.

type ProjectDescribeResult added in v0.31.0

type ProjectDescribeResult struct {
	Envelope
	ProjectID   string           `json:"project_id"`
	Name        string           `json:"name"                 untrusted:"true"`
	State       string           `json:"state"`
	Description string           `json:"description"          untrusted:"true"`
	Goal        ProjectGoal      `json:"goal"`
	Complete    bool             `json:"complete"` // false for a project made before epic 56 that nobody completed
	Standalone  bool             `json:"standalone,omitempty"`
	Kind        string           `json:"kind"` // the effective kind (SDD-005 section 5.12.4)
	Production  ProductionState  `json:"production"`
	Workflow    project.Workflow `json:"workflow"`
	// TextSummary and NextPostAt are the same facts a project list gives (SDD-005 section 5.12.4).
	TextSummary *TextSummary  `json:"text_summary,omitempty"`
	NextPostAt  *time.Time    `json:"next_post_at"`
	Items       []ProjectItem `json:"items"`
	Text        string        `json:"text"`
}

ProjectDescribeResult is the production as text, with its structure.

type ProjectDuplicateRequest added in v0.31.0

type ProjectDuplicateRequest struct {
	ProjectID string `json:"project_id"`
	Name      string `json:"name,omitempty"` // default: the name followed by " copy"
	DryRun    bool   `json:"dry_run,omitempty"`
}

ProjectDuplicateRequest copies a project.

type ProjectGetRequest

type ProjectGetRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Detail     string `json:"detail,omitempty"`      // default "concise"; "full"; "document"
	Page
}

ProjectGetRequest reads a project.

type ProjectGetResult

type ProjectGetResult struct {
	Envelope
	ProjectID string `json:"project_id"`
	Name      string `json:"name"       untrusted:"true"`
	// The description and the goal come right after the name: an agent reads them first.
	Description    string        `json:"description"          untrusted:"true"`
	Goal           ProjectGoal   `json:"goal"`
	Complete       bool          `json:"complete"` // false for a project made before epic 56 that nobody completed
	Standalone     bool          `json:"standalone,omitempty"`
	Kind           string        `json:"kind"` // the effective kind (SDD-005 section 5.12.4)
	Revision       int64         `json:"revision"`
	State          string        `json:"state"`
	Width          int           `json:"width"`
	Height         int           `json:"height"`
	FPS            string        `json:"fps"`
	DurationFrames int64         `json:"duration_frames"`
	Duration       TimeValue     `json:"duration"`
	Counts         ProjectCounts `json:"counts"`
	// TimelineID is the timeline the head and the text are about.
	TimelineID string           `json:"timeline_id,omitempty"`
	Items      []ProjectItem    `json:"items"`
	Production ProductionState  `json:"production"`
	Workflow   project.Workflow `json:"workflow"`
	// TextSummary is what the text of the project is like (its kind, words and reading time); NextPostAt is when
	// the next post goes out, null when none is planned (SDD-005 section 5.12.4, SDD-020 section 23).
	TextSummary *TextSummary       `json:"text_summary,omitempty"`
	NextPostAt  *time.Time         `json:"next_post_at"`
	NextCursor  *string            `json:"next_cursor"`
	Document    *timeline.Document `json:"document,omitempty"     bulk:"true"`
	Text        string             `json:"text,omitempty"`
}

ProjectGetResult is the head of a project and, by detail, its text or document.

type ProjectGoal added in v0.46.0

type ProjectGoal struct {
	Specific   string `json:"specific"   untrusted:"true"`
	Measurable string `json:"measurable" untrusted:"true"`
	Achievable string `json:"achievable" untrusted:"true"`
	Relevant   string `json:"relevant"   untrusted:"true"`
	TimeBound  string `json:"time_bound" untrusted:"true"`
	Due        string `json:"due"` // YYYY-MM-DD
}

ProjectGoal is the SMART goal of a project (SDD-005 section 5.12.2). The text is the creator's: an agent reads it as data, never as an instruction.

type ProjectHead

type ProjectHead struct {
	ID            string
	Name          string
	State         ProjectState
	Revision      int64
	SchemaVersion int
	Summary       DocSummary
	CreatedMs     int64
	UpdatedMs     int64
	CreatedBy     string
	OwnerUserID   *string // network mode only (SDD-007 4.1)
	TrashedMs     *int64
	TrashedBy     *string
	ResyncFloor   int64
}

ProjectHead is a project row without its document.

type ProjectItem added in v0.31.0

type ProjectItem struct {
	ID         string    `json:"id"`
	Kind       string    `json:"kind"` // "brief" | "text" | "timeline" | "output" | "publication"
	Title      string    `json:"title"                 untrusted:"true"`
	Position   int       `json:"position"`
	State      string    `json:"state"`                 // "active" | "trashed"
	TimelineID string    `json:"timeline_id,omitempty"` // kind timeline
	JobID      string    `json:"job_id,omitempty"`      // kind output: the export job
	Format     string    `json:"format,omitempty"`      // kind output: the destination format; publication: its networks
	Status     string    `json:"status,omitempty"`      // kind publication: pending_approval or published, from its targets
	Text       string    `json:"text,omitempty"        untrusted:"true"`
	TextKind   string    `json:"text_kind,omitempty"` // kind text: "script" | "copy" | "caption" (SDD-019)
	UpdatedAt  time.Time `json:"updated_at"`
}

ProjectItem is an item of a production (SDD-003 section 2.3.1).

type ProjectItemAddRequest added in v0.31.0

type ProjectItemAddRequest struct {
	ProjectID string `json:"project_id"`
	Kind      string `json:"kind"`                // "text", "timeline" or "output"
	Title     string `json:"title"`               // 1 to 120 characters
	Position  *int   `json:"position,omitempty"`  // default: the end
	Text      string `json:"text,omitempty"`      // kind text
	TextKind  string `json:"text_kind,omitempty"` // kind text: "script", "copy" (default) or "caption"
	Preset    string `json:"preset,omitempty"`    // kind timeline
	FPS       string `json:"fps,omitempty"`       // kind timeline
	JobID     string `json:"job_id,omitempty"`    // kind output: a succeeded export job of this project
	DryRun    bool   `json:"dry_run,omitempty"`
}

ProjectItemAddRequest adds an item to a production.

type ProjectItemMoveRequest added in v0.31.0

type ProjectItemMoveRequest struct {
	ProjectID string `json:"project_id"`
	ItemID    string `json:"item_id"`
	Position  int    `json:"position"`
	DryRun    bool   `json:"dry_run,omitempty"`
}

ProjectItemMoveRequest moves an item to a position.

type ProjectItemRenameRequest added in v0.31.0

type ProjectItemRenameRequest struct {
	ProjectID string `json:"project_id"`
	ItemID    string `json:"item_id"`
	Title     string `json:"title"`
	DryRun    bool   `json:"dry_run,omitempty"`
}

ProjectItemRenameRequest changes the title of an item.

type ProjectItemResult added in v0.31.0

type ProjectItemResult struct {
	Envelope
	ProjectID  string          `json:"project_id"`
	Item       ProjectItem     `json:"item"`
	Production ProductionState `json:"production"`
	Text       string          `json:"text"`
}

ProjectItemResult is the item an operation ended with and the state of its production.

type ProjectItemTrashRequest added in v0.31.0

type ProjectItemTrashRequest struct {
	ProjectID string `json:"project_id"`
	ItemID    string `json:"item_id"`
	DryRun    bool   `json:"dry_run,omitempty"`
}

ProjectItemTrashRequest trashes or restores an item.

type ProjectListRequest

type ProjectListRequest struct {
	State string `json:"state,omitempty"` // default "active"; "trashed" | "all"
	Page
}

ProjectListRequest lists projects.

type ProjectListResult

type ProjectListResult struct {
	Envelope
	Projects   []ProjectSummary `json:"projects"`
	NextCursor *string          `json:"next_cursor"`
	Text       string           `json:"text"`
}

ProjectListResult is a page of projects.

type ProjectOtioExportRequest

type ProjectOtioExportRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
}

ProjectOtioExportRequest asks for the OpenTimelineIO file of the head revision (SDD-001 section 9).

type ProjectOtioExportResult

type ProjectOtioExportResult struct {
	Envelope
	ProjectID string     `json:"project_id"`
	Revision  int64      `json:"revision"`
	FileName  string     `json:"file_name"  untrusted:"true"` // a safe name, ending in .otio
	Content   string     `json:"content"`                     // the file, deterministic JSON
	Lost      []OtioLost `json:"lost"`
	Text      string     `json:"text"`
}

ProjectOtioExportResult is the .otio text and what it could not carry.

type ProjectOtioImportRequest

type ProjectOtioImportRequest struct {
	ProjectID    string `json:"project_id"`
	TimelineID   string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	BaseRevision int64  `json:"base_revision"`
	Path         string `json:"path"` // absolute
	DryRun       bool   `json:"dry_run,omitempty"`
	// AllowPartial imports what the project can take when the file refers to media the project does not have;
	// without it such a file is refused and nothing is applied (VV-133).
	AllowPartial bool `json:"allow_partial,omitempty"`
}

ProjectOtioImportRequest reads an .otio file from the machine of the server and applies it to a project as one batch.

type ProjectOtioImportResult

type ProjectOtioImportResult struct {
	Envelope
	ProjectID string `json:"project_id"`
	Revision  int64  `json:"revision"`
	Applied   bool   `json:"applied"`
	// Edit is the result of the batch applied through Edit: one undo step.
	Edit *EditResult `json:"edit"`
	// UnresolvedMedia is every reference of the file that no asset of the project answers.
	UnresolvedMedia []OtioMedia `json:"unresolved_media"`
	// MatchedMedia is every reference answered by an asset of the same name, not by content.
	MatchedMedia []OtioMatch `json:"matched_media"`
	// Lost is what the batch cannot carry, and the clips it left out.
	Lost []OtioLost `json:"lost"`
	// Warnings are notes about the import that are not a reason to refuse it.
	Warnings []string `json:"warnings"`
	Text     string   `json:"text"`
}

ProjectOtioImportResult is the batch the file became and what it left out.

type ProjectQuery

type ProjectQuery struct {
	State             ProjectState // "" means active only
	IncludeTrashed    bool         // both states; wins over State
	StandaloneOnly    bool         // true: only standalone video sessions (standalone = 1)
	IncludeStandalone bool         // true: both regular productions and standalone sessions (e.g. TrashEmpty)
	OwnerUserID       string       // network mode: only this user's projects, applied in SQL
	ProjectID         string       // a key limited to one project: the timelines of that one
	After             string       // opaque cursor from the previous page
	Limit             int          // 1 to 200; 0 means 50
}

ProjectQuery selects a page of the project listing.

type ProjectRepo

type ProjectRepo interface {
	List(ctx context.Context, q ProjectQuery) (items []ProjectHead, next string, err error)
	// Count is the number of projects the query selects, ignoring its cursor and limit.
	Count(ctx context.Context, q ProjectQuery) (int, error)
	Head(ctx context.Context, id string) (ProjectHead, error)
	Get(ctx context.Context, id string) (ProjectRow, error) // with the document
	Create(ctx context.Context, row ProjectRow) error       // ErrExists
	// Commit writes the new document and moves revision from expected to
	// expected+1 in one guarded UPDATE ... WHERE id=? AND revision=?.
	// ErrStale when no row matched.
	Commit(ctx context.Context, id string, expected int64, u ProjectUpdate) error
	SetState(ctx context.Context, id string, st ProjectState, by string, atMs int64) error
	// Delete is a hard delete; it cascades, and also removes the
	// document_backups of the project. Only TrashEmpty calls it.
	Delete(ctx context.Context, id string) error
}

ProjectRepo stores projects.

type ProjectRow

type ProjectRow struct {
	ProjectHead
	Document  []byte // canonical JSON as stored
	DocSHA256 string // lower-case hex of sha256(Document)
}

ProjectRow is a project with its document.

type ProjectState

type ProjectState string

ProjectState is the trash state of a project.

const (
	ProjectActive  ProjectState = "active"
	ProjectTrashed ProjectState = "trashed"
)

The states of a project.

type ProjectStateResult

type ProjectStateResult struct {
	ProjectID string `json:"project_id"`
	State     string `json:"state"` // "active" | "trashed"
	Text      string `json:"text"`
}

ProjectStateResult is the state a project ended in.

type ProjectStepSkipRequest added in v0.52.0

type ProjectStepSkipRequest struct {
	ProjectID string `json:"project_id"`
	Step      string `json:"step"`              // a step id of SDD-000 section 1
	Restore   bool   `json:"restore,omitempty"` // put a skipped step back
	DryRun    bool   `json:"dry_run,omitempty"`
}

ProjectStepSkipRequest skips an optional step of the workflow of a project, or with Restore puts it back.

type ProjectStepSkipResult added in v0.52.0

type ProjectStepSkipResult struct {
	Envelope
	ProjectID string           `json:"project_id"`
	Workflow  project.Workflow `json:"workflow"`
	Changed   bool             `json:"changed"` // false on a dry run and when nothing changed
	Text      string           `json:"text"`
}

ProjectStepSkipResult is the workflow after the change.

type ProjectSummary

type ProjectSummary struct {
	ID string `json:"id"`
	// ProjectID is ID under the name every other answer gives it (VV-107); ID stays for compatibility.
	ProjectID string    `json:"project_id"`
	Name      string    `json:"name"       untrusted:"true"`
	Revision  int64     `json:"revision"`
	State     string    `json:"state"` // "active" | "trashed"
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	FPS       string    `json:"fps"`      // "30" or "30000/1001"
	Duration  TimeValue `json:"duration"` // end of the last item
	// Complete is false for a project made before epic 56, which has no description and no goal yet.
	Complete bool `json:"complete"`
	// Standalone is true for a lightweight standalone video editor session (epic 105).
	Standalone bool `json:"standalone,omitempty"`
	// Kind is the effective kind of the project and TextSummary says what its text is like, when it holds one
	// (SDD-005 section 5.12.4).
	Kind        string       `json:"kind"`
	TextSummary *TextSummary `json:"text_summary,omitempty"`
	// CurrentStep is the step the project stands at (SDD-000 section 1, the step ids); empty when every step is
	// done or skipped. NextPostAt is when the next post of the project goes out, null when none is planned
	// (SDD-020 section 23).
	CurrentStep string     `json:"current_step,omitempty"`
	NextPostAt  *time.Time `json:"next_post_at"`
	Tracks      int        `json:"tracks"`
	Items       int        `json:"items"`
	Assets      int        `json:"assets"`
	// TimelineID is the first active timeline, the one the other members are about; Timelines is how many the
	// project holds.
	TimelineID string    `json:"timeline_id,omitempty"`
	Timelines  int       `json:"timelines"`
	UpdatedAt  time.Time `json:"updated_at"` // UTC
}

ProjectSummary is an item of the project listing.

type ProjectTrashRequest

type ProjectTrashRequest struct {
	ProjectID string `json:"project_id"`
	DryRun    bool   `json:"dry_run,omitempty"`
}

ProjectTrashRequest trashes or restores a project.

type ProjectTx

type ProjectTx interface {
	Tx
	Project() ProjectRow // as loaded when the transaction started
}

ProjectTx is a Tx of WriteProject.

type ProjectUpdate

type ProjectUpdate struct {
	Name          string
	SchemaVersion int
	Document      []byte
	DocSHA256     string
	Summary       DocSummary
	UpdatedMs     int64
	ResyncFloor   *int64 // set only by migration and import
}

ProjectUpdate is what a commit writes to the project row.

type ProjectUpdateRequest added in v0.46.0

type ProjectUpdateRequest struct {
	ProjectID   string       `json:"project_id"`
	Name        *string      `json:"name,omitempty"`
	Description *string      `json:"description,omitempty"`
	Goal        *ProjectGoal `json:"goal,omitempty"`
	DryRun      bool         `json:"dry_run,omitempty"`
}

ProjectUpdateRequest changes the name, the description or the goal of a project. A member that is left out is kept; a goal is sent whole, because a goal with a part missing is not a goal.

type ProjectUpdateResult added in v0.46.0

type ProjectUpdateResult struct {
	Envelope
	ProjectID   string      `json:"project_id"`
	Name        string      `json:"name"        untrusted:"true"`
	Description string      `json:"description" untrusted:"true"`
	Goal        ProjectGoal `json:"goal"`
	Complete    bool        `json:"complete"`
	Updated     bool        `json:"updated"` // false on a dry run
	Text        string      `json:"text"`
}

ProjectUpdateResult is the project after the change.

type PromptGetResult added in v0.31.0

type PromptGetResult struct {
	Envelope
	Entry     LibraryEntry      `json:"entry"`
	Body      string            `json:"body"                untrusted:"true"`
	Variables []string          `json:"variables,omitempty"`
	Defaults  map[string]string `json:"defaults,omitempty"  untrusted:"true"`
	Text      string            `json:"text"`
}

PromptGetResult is a prompt.

type PromptListRequest added in v0.31.0

type PromptListRequest struct {
	Tags      []string `json:"tags,omitempty"`
	AgentView bool     `json:"agent_view,omitempty"`
}

PromptListRequest lists the prompts.

type PromptRenderRequest added in v0.31.0

type PromptRenderRequest struct {
	Name      string            `json:"name"`
	Values    map[string]string `json:"values,omitempty"`
	AgentView bool              `json:"agent_view,omitempty"`
}

PromptRenderRequest replaces the variables of a prompt.

type PromptRenderResult added in v0.31.0

type PromptRenderResult struct {
	Envelope
	Name     string `json:"name"`
	Rendered string `json:"rendered" untrusted:"true"`
	Text     string `json:"text"`
}

PromptRenderResult is the text of a prompt with its variables replaced.

type PromptWriteRequest added in v0.31.0

type PromptWriteRequest struct {
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Tags        []string          `json:"tags,omitempty"`
	Defaults    map[string]string `json:"defaults,omitempty"`
	Body        string            `json:"body"`
}

PromptWriteRequest writes a prompt.

type PromptWriteResult added in v0.31.0

type PromptWriteResult struct {
	Envelope
	Entry     LibraryEntry `json:"entry"`
	Variables []string     `json:"variables,omitempty"`
	Text      string       `json:"text"`
}

PromptWriteResult is the prompt that was written.

type ProviderListRequest added in v0.34.0

type ProviderListRequest struct{}

ProviderListRequest has no member.

type ProviderListResult added in v0.34.0

type ProviderListResult struct {
	Providers []ProviderView        `json:"providers"`
	Prices    []provider.PriceEntry `json:"prices"`
}

ProviderListResult is every registered provider and the price table the person edits.

type ProviderModelsRequest added in v0.34.0

type ProviderModelsRequest struct {
	ConnectionID string `json:"connection_id"`
	Refresh      bool   `json:"refresh,omitempty"`
}

ProviderModelsRequest reads the catalogue of one connection. Refresh asks for a new read.

type ProviderModelsResult added in v0.34.0

type ProviderModelsResult struct {
	ConnectionID string      `json:"connection_id"`
	Provider     string      `json:"provider"`
	Models       []ModelView `json:"models"`
	FetchedAt    time.Time   `json:"fetched_at"`
	// Cached is true when the list came from memory (it is at most ten minutes old).
	Cached bool `json:"cached"`
}

ProviderModelsResult is the catalogue of a connection, read from its provider.

type ProviderPriceSetRequest added in v0.34.0

type ProviderPriceSetRequest struct {
	Provider            string `json:"provider"`
	Model               string `json:"model"`
	Currency            string `json:"currency,omitempty"`
	InputMicrosPerMTok  *int64 `json:"input_micros_per_mtok,omitempty"`
	OutputMicrosPerMTok *int64 `json:"output_micros_per_mtok,omitempty"`
	// Unit is empty for a price of tokens, image for the price of one image and mchar for the price of a million
	// characters of speech (SDD-016 section 4.5); the last two set UnitMicros and leave the token amounts out.
	Unit       string `json:"unit,omitempty"`
	UnitMicros *int64 `json:"unit_micros,omitempty"`
}

ProviderPriceSetRequest sets the price of a model of a provider, or removes it when both amounts are empty. The amounts are millionths of the currency unit for a million tokens.

type ProviderPricesResult added in v0.34.0

type ProviderPricesResult struct {
	Prices []provider.PriceEntry `json:"prices"`
}

ProviderPricesResult is the price table after a change.

type ProviderSignIn added in v0.38.0

type ProviderSignIn struct {
	ConnectionID string `json:"connection_id"`
	Provider     string `json:"provider"`
	Label        string `json:"label"             untrusted:"true"`
	Account      string `json:"account,omitempty" untrusted:"true"`
	// State is ready, or needs_sign_in when the provider no longer accepts the sign-in or it was not finished.
	State string `json:"state"`
}

ProviderSignIn is a connection made by a sign-in, with who it is for. It never carries a token.

type ProviderSignInBeginRequest added in v0.38.0

type ProviderSignInBeginRequest struct {
	// Provider is the id of the provider, for example openai or openrouter.
	Provider string `json:"provider"`
	// Label names a new connection; empty is the default name of the provider.
	Label string `json:"label,omitempty"`
	// ConnectionID signs in again an existing connection that was made by a sign-in.
	ConnectionID string `json:"connection_id,omitempty"`
	// RedirectURI is the address of the sign-in page of this server, where the provider sends the browser.
	RedirectURI string `json:"redirect_uri"`
}

ProviderSignInBeginRequest starts the sign-in of an AI provider in the browser (SDD-016 section 12).

type ProviderSignInBeginResult added in v0.38.0

type ProviderSignInBeginResult struct {
	ConnectionID string `json:"connection_id"`
	AuthorizeURL string `json:"authorize_url"`
}

ProviderSignInBeginResult has the address the person opens to consent. It holds no secret.

type ProviderSignInCompleteRequest added in v0.38.0

type ProviderSignInCompleteRequest struct {
	State string `json:"state"`
	Code  string `json:"code,omitempty"`
	// Error is the error the provider reported instead of a code (access_denied...).
	Error string `json:"error,omitempty"`
	// ClientID is the client the provider issued at the first sign-in of a host (OpenAI).
	ClientID string `json:"client_id,omitempty"`
}

ProviderSignInCompleteRequest is what the provider sent back to the redirect address.

type ProviderSignInListRequest added in v0.38.0

type ProviderSignInListRequest struct{}

ProviderSignInListRequest has no member.

type ProviderSignInListResult added in v0.38.0

type ProviderSignInListResult struct {
	SignIns []ProviderSignIn `json:"sign_ins"`
}

ProviderSignInListResult is the sign-in connections, oldest first.

type ProviderView added in v0.34.0

type ProviderView struct {
	providers.Descriptor
	// Connections are the ids of the connections whose kind is this provider.
	Connections []string `json:"connections"`
}

ProviderView is a provider and the connections the person made to it (SDD-016 section 7).

type Publication added in v0.37.0

type Publication = pub.Publication

Publication is a publication with its targets (SDD-020 section 23).

type PublicationCancelRequest added in v0.37.0

type PublicationCancelRequest struct {
	ID       string `json:"id"`
	TargetID string `json:"target_id,omitempty"`
}

PublicationCancelRequest cancels a target, or every one that has not gone out.

type PublicationCreateRequest added in v0.37.0

type PublicationCreateRequest = pub.CreateInput

PublicationCreateRequest plans a publication; every target starts as a draft.

type PublicationDuplicateRequest added in v0.57.0

type PublicationDuplicateRequest = pub.DuplicateInput

PublicationDuplicateRequest copies a publication to another day or hour, as drafts.

type PublicationGetRequest added in v0.37.0

type PublicationGetRequest struct {
	ID string `json:"id"`
}

PublicationGetRequest names a publication.

type PublicationListRequest added in v0.37.0

type PublicationListRequest struct {
	ProjectID string `json:"project_id,omitempty"`
	State     string `json:"state,omitempty"`
	Network   string `json:"network,omitempty"`
	From      string `json:"from,omitempty"`
	To        string `json:"to,omitempty"`
	// Zone is the IANA zone a date or a local time of From and To is read in; empty is UTC.
	Zone   string `json:"zone,omitempty"`
	Limit  int    `json:"limit,omitempty"`
	Offset int    `json:"offset,omitempty"`
}

PublicationListRequest selects publications: by project, by the state or the network of a target, or by a time range (from inclusive, to exclusive, RFC 3339).

type PublicationListResult added in v0.37.0

type PublicationListResult struct {
	Publications []Publication `json:"publications"`
	Total        int           `json:"total"`
}

PublicationListResult is a page of publications.

type PublicationRetryRequest added in v0.37.0

type PublicationRetryRequest PublicationTargetRequest

PublicationRetryRequest asks for approval to send a failed target again.

type PublicationScheduleRequest added in v0.37.0

type PublicationScheduleRequest struct {
	ID                string `json:"id"`
	TargetID          string `json:"target_id,omitempty"`
	At                string `json:"at,omitempty"`
	Zone              string `json:"zone,omitempty"`
	LateWindowMinutes *int   `json:"late_window_minutes,omitempty"`
	// ConfirmQuietDay is a person's yes to a post on a day marked as quiet (SDD-020 section 30A.1).
	ConfirmQuietDay bool `json:"confirm_quiet_day,omitempty"`
}

PublicationScheduleRequest gives a target its time and asks for approval.

type PublicationSendNowRequest added in v0.37.0

type PublicationSendNowRequest PublicationTargetRequest

PublicationSendNowRequest asks for approval to send a target as soon as it is approved.

type PublicationTargetRequest added in v0.37.0

type PublicationTargetRequest struct {
	ID       string `json:"id"`
	TargetID string `json:"target_id,omitempty"`
	// ConfirmQuietDay is a person's yes to a post on a day marked as quiet (SDD-020 section 30A.1); any other caller
	// is refused on that day whatever it passes.
	ConfirmQuietDay bool `json:"confirm_quiet_day,omitempty"`
}

PublicationTargetRequest names a target of a publication.

type PublicationUpdateRequest added in v0.37.0

type PublicationUpdateRequest = pub.UpdateInput

PublicationUpdateRequest changes a publication; what it leaves out stays as it is.

type PublishArgs added in v0.34.0

type PublishArgs struct {
	// ConnectionID is the connection of the network and the account the video goes to.
	ConnectionID string `json:"connection_id"`
	// Export is the id of a succeeded export job of the project: the video.
	Export string `json:"export"`
	// Thumbnail is the id of a succeeded export job of a still of the project, or of an image.export job the
	// caller made (SDD-020 section 10); optional.
	Thumbnail   string   `json:"thumbnail,omitempty"`
	Title       string   `json:"title"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	// Visibility is private (the default), unlisted or public.
	Visibility string `json:"visibility,omitempty"`
	// MadeForKids must be set: the person declares it.
	MadeForKids  *bool `json:"made_for_kids,omitempty"`
	AIDisclosure bool  `json:"ai_disclosure,omitempty"`
}

PublishArgs is the post of a publication: what the person or the agent decides (SDD-020 section 10).

type PublishNowRequest added in v0.34.0

type PublishNowRequest struct {
	ProjectID string `json:"project_id"`
	// TimelineID is optional and must be a timeline of the project: the job is kept on the timeline of its export.
	TimelineID string `json:"timeline_id,omitempty"`
	PublishArgs
	WaitMS int  `json:"wait_ms,omitempty"`
	DryRun bool `json:"dry_run,omitempty"`
}

PublishNowRequest starts the publication of one post.

type PublishResult added in v0.34.0

type PublishResult struct {
	Network      string `json:"network"`
	ConnectionID string `json:"connection_id"`
	RemoteID     string `json:"remote_id"     untrusted:"true"`
	URL          string `json:"url"           untrusted:"true"`
	// State is processing, published, or sent_as_draft for a file the network took as a draft to be finished in
	// its own app (SDD-020 section 38).
	State string `json:"state"`
	// ThumbnailError is the kind of the error of the thumbnail when the video went up and the thumbnail did
	// not (quota, auth...).
	ThumbnailError string `json:"thumbnail_error,omitempty"`
}

PublishResult is what a publication produced; it is the result of a succeeded job.

type PublishStatusRequest added in v0.34.0

type PublishStatusRequest struct {
	JobID string `json:"job_id"`
}

PublishStatusRequest names the job of a publication.

type PublishStatusResult added in v0.34.0

type PublishStatusResult struct {
	JobID string `json:"job_id"`
	// State is waiting_approval, uploading, processing, published, sent_as_draft or failed.
	State  string         `json:"state"`
	Result *PublishResult `json:"result,omitempty"`
	Error  *Error         `json:"error,omitempty"`
}

PublishStatusResult is the state of a publication (SDD-020 section 4).

type PublishValidateRequest added in v0.34.0

type PublishValidateRequest struct {
	ProjectID string `json:"project_id"`
	PublishArgs
}

PublishValidateRequest checks a post against the limits of its network.

type PublishValidateResult added in v0.34.0

type PublishValidateResult struct {
	Network string `json:"network"`
	// State is prepared when no issue is left, and invalid otherwise.
	State  string          `json:"state"`
	Issues []publish.Issue `json:"issues"`
	// Summary is what a person would read before approving.
	Summary string `json:"summary,omitempty" untrusted:"true"`
}

PublishValidateResult says whether a post may be submitted.

type PublishedPostGetRequest added in v0.41.0

type PublishedPostGetRequest struct {
	Slug string `json:"slug"`
}

PublishedPostGetRequest names a post by its slug.

type PublishedPostImage added in v0.41.0

type PublishedPostImage struct {
	Name        string `json:"name"`
	Role        string `json:"role"`
	ContentType string `json:"content_type"`
	Bytes       int64  `json:"bytes"`
	SHA256      string `json:"sha256"`
	// URL is the route that serves the image.
	URL string `json:"url"`
}

PublishedPostImage is an image of a published post, as the read API lists it.

type PublishedPostListRequest added in v0.41.0

type PublishedPostListRequest struct {
	Limit  int    `json:"limit,omitempty"`
	Cursor string `json:"cursor,omitempty"`
}

PublishedPostListRequest is a page of the published posts.

type PublishedPostListResult added in v0.41.0

type PublishedPostListResult struct {
	Envelope
	Posts      []PublishedPostSummary `json:"posts"`
	NextCursor string                 `json:"next_cursor,omitempty"`
	ETag       string                 `json:"-"`
}

PublishedPostListResult is a page of the list. NextCursor is empty on the last page; ETag is the strong tag of the content of the page, for If-None-Match.

type PublishedPostMediaRequest added in v0.41.0

type PublishedPostMediaRequest struct {
	Slug string `json:"slug"`
	Name string `json:"name"`
}

PublishedPostMediaRequest names an image of a published post.

type PublishedPostMediaResult added in v0.41.0

type PublishedPostMediaResult struct {
	Path        string
	ContentType string
	Bytes       int64
	SHA256      string
}

PublishedPostMediaResult is where the bytes of an image are: a path relative to the workspace, which an adapter serves.

type PublishedPostResult added in v0.41.0

type PublishedPostResult struct {
	Envelope
	PublishedPostSummary
	Markdown string               `json:"markdown" untrusted:"true"`
	HTML     string               `json:"html"     untrusted:"true"`
	Images   []PublishedPostImage `json:"images"`
	ETag     string               `json:"-"`
}

PublishedPostResult is one published post with its body.

type PublishedPostSummary added in v0.41.0

type PublishedPostSummary struct {
	Slug         string    `json:"slug"`
	Title        string    `json:"title"           untrusted:"true"`
	Summary      string    `json:"summary"         untrusted:"true"`
	Tags         []string  `json:"tags"            untrusted:"true"`
	Language     string    `json:"language"`
	CanonicalURL string    `json:"canonical_url"   untrusted:"true"`
	Cover        string    `json:"cover,omitempty"`
	PublishedAt  time.Time `json:"published_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

PublishedPostSummary is a post of the list: its metadata and no body.

type QueueFullError

type QueueFullError struct {
	Running   []string
	Kind      string
	Ceiling   int
	PerActor  bool
	PerReason bool // the ceiling of the jobs of the kind with one reason (JobLimit.Reason)
}

QueueFullError is returned by JobRepo.CreateLimited: the jobs that hold the slots (their ids), the kind that is full, the ceiling that was reached and whether it is the one of a single actor.

func (*QueueFullError) Error

func (e *QueueFullError) Error() string

type RateLimiter

type RateLimiter interface {
	// Allow spends a token for key. When it is not allowed, retryAfter says how
	// long to wait. An error is a failing store, and the caller is refused.
	Allow(ctx context.Context, key string) (allowed bool, retryAfter time.Duration, err error)
}

RateLimiter decides whether one more call of a heavy operation may run. The web layer implements it over vukem's Limiter (the service imports no vukem package). A key is "heavy:<bucket>", see heavyBucket.

type Recording added in v0.52.0

type Recording struct {
	ID         string          `json:"recording_id"`
	ProjectID  string          `json:"project_id"`
	State      string          `json:"state"`
	Review     string          `json:"review,omitempty"`
	Source     RecordingSource `json:"source"`
	Width      int             `json:"width,omitempty"`
	Height     int             `json:"height,omitempty"`
	FPS        int             `json:"fps"`
	Encoder    string          `json:"encoder,omitempty"`
	DurationMS int64           `json:"duration_ms"`
	Frames     int64           `json:"frames"`
	Dropped    int64           `json:"dropped"`
	Bytes      int64           `json:"bytes"`
	StopReason string          `json:"stop_reason,omitempty"`
	Error      *Error          `json:"error,omitempty"`
	AssetID    string          `json:"asset_id,omitempty"`
	// Tracks and Pauses are what the recording holds beyond the screen (SDD-025 section 16); EventsCount is the
	// pointer events saved; Levels is set only while the recording runs.
	Tracks      []RecordingTrack `json:"tracks"`
	Pauses      []RecordingPause `json:"pauses"`
	EventsCount int64            `json:"events_count"`
	Levels      *RecordingLevels `json:"levels,omitempty"`
	// Upload is where a browser recording is, while it receives chunks (SDD-025 section 18.3).
	Upload *RecordingUpload `json:"upload,omitempty"`
	// Plan is set while a person has still to start the recording; Marks and Proposals are what agents and people
	// added (SDD-025 section 19).
	Plan      *RecordingPlan      `json:"plan,omitempty"`
	Marks     []RecordingMark     `json:"marks"`
	Proposals []RecordingProposal `json:"proposals"`
	Actor     string              `json:"actor"`
	CreatedAt time.Time           `json:"created_at"`
	StartedAt *time.Time          `json:"started_at,omitempty"`
	EndedAt   *time.Time          `json:"ended_at,omitempty"`
	Text      string              `json:"text"`
}

Recording is a recording as a surface sees it (SDD-025 section 9.2).

type RecordingCutRange added in v0.57.0

type RecordingCutRange struct {
	FromMS   int64  `json:"from_ms"`
	ToMS     int64  `json:"to_ms"`
	Reason   string `json:"reason"             untrusted:"true"`
	Decision string `json:"decision,omitempty"`
}

RecordingCutRange is a stretch of a take to cut, in active milliseconds, with the reason given.

type RecordingDevice added in v0.55.0

type RecordingDevice struct {
	ID      string `json:"id"`
	Name    string `json:"name"    untrusted:"true"`
	Default bool   `json:"default"`
}

RecordingDevice is a microphone or a camera. Its id is the opaque one the helper made; the name is untrusted text.

type RecordingEvent added in v0.55.0

type RecordingEvent struct {
	TMS    int64  `json:"t_ms"`
	Kind   string `json:"kind"`
	Button string `json:"button,omitempty"`
	X      int    `json:"x"`
	Y      int    `json:"y"`
}

RecordingEvent is a pointer position or a button edge, in active ms and in pixels of the captured source.

type RecordingEventsRequest added in v0.55.0

type RecordingEventsRequest struct {
	ID     string `json:"recording_id"`
	FromMS int64  `json:"from_ms,omitempty"`
	Kind   string `json:"kind,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

RecordingEventsRequest reads the pointer events of a recording. Kind is clicks (the default) or all.

type RecordingEventsResult added in v0.55.0

type RecordingEventsResult struct {
	ID     string `json:"recording_id"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
	// Total counts the events of the kind asked for, from from_ms on.
	Total     int              `json:"total"`
	Events    []RecordingEvent `json:"events"`
	Truncated bool             `json:"truncated"`
	Text      string           `json:"text"`
}

RecordingEventsResult is the part of the event file a request selected.

type RecordingLevels added in v0.55.0

type RecordingLevels struct {
	Microphone int `json:"microphone"`
	System     int `json:"system"`
}

RecordingLevels are the peaks of the sound tracks over the last moment, 0 to 1000, while a recording runs.

type RecordingListRequest added in v0.52.0

type RecordingListRequest struct {
	ProjectID string `json:"project_id"`
}

RecordingListRequest lists the recordings of a project, newest first.

type RecordingListResult added in v0.52.0

type RecordingListResult struct {
	Recordings []Recording `json:"recordings"`
}

RecordingListResult is the visible recordings of a project.

type RecordingMark added in v0.57.0

type RecordingMark struct {
	N         int       `json:"n"`
	Kind      string    `json:"kind"`
	AtMS      int64     `json:"at_ms"`
	EndMS     int64     `json:"end_ms,omitempty"`
	Note      string    `json:"note,omitempty"   untrusted:"true"`
	Actor     string    `json:"actor"`
	CreatedAt time.Time `json:"created_at"`
}

RecordingMark is a mark as a surface sees it.

type RecordingMarkRequest added in v0.57.0

type RecordingMarkRequest struct {
	ID    string `json:"recording_id"`
	Kind  string `json:"kind"`
	AtMS  int64  `json:"at_ms"`
	EndMS int64  `json:"end_ms,omitempty"`
	Note  string `json:"note,omitempty"   untrusted:"true"`
}

RecordingMarkRequest adds a mark to a take (SDD-025 section 19.2). EndMS 0 is a point.

type RecordingPause added in v0.55.0

type RecordingPause struct {
	FromMS int64 `json:"from_ms"`
	ToMS   int64 `json:"to_ms"`
}

RecordingPause is a pause, in ms on the wall clock since the start; no file holds that time.

type RecordingPlaceRequest added in v0.52.0

type RecordingPlaceRequest struct {
	ID         string `json:"recording_id"`
	TimelineID string `json:"timeline_id,omitempty"`
}

RecordingPlaceRequest places a recording a person added on a timeline of its project.

type RecordingPlan added in v0.57.0

type RecordingPlan struct {
	SourceID    string `json:"source_id"`
	FPS         int    `json:"fps"`
	Microphone  string `json:"microphone,omitempty"`
	SystemAudio bool   `json:"system_audio,omitempty"`
	Camera      string `json:"camera,omitempty"`
	Events      bool   `json:"events,omitempty"`
	ScriptID    string `json:"script_id,omitempty"`
	Notes       string `json:"notes,omitempty"        untrusted:"true"`
}

RecordingPlan is the stored plan of a prepared recording. SourceID is the display or window it records, for the dialog to show the title the helper gives it: the plan keeps no title of its own.

type RecordingPrepareRequest added in v0.57.0

type RecordingPrepareRequest struct {
	ProjectID  string          `json:"project_id"`
	Source     RecordingSource `json:"source"`
	FPS        int             `json:"fps,omitempty"`
	Microphone string          `json:"microphone,omitempty"`
	// SystemAudio, Camera and Events are asked for as RecordingStartRequest asks for them.
	SystemAudio bool   `json:"system_audio,omitempty"`
	Camera      string `json:"camera,omitempty"`
	Events      bool   `json:"events,omitempty"`
	// ScriptID is a written script of the project (a text item of kind script) the person will read.
	ScriptID string `json:"script_id,omitempty"`
	// Notes are for the person who presses record; at most 2,000 characters.
	Notes string `json:"notes,omitempty" untrusted:"true"`
}

RecordingPrepareRequest is the plan of a recording (SDD-025 section 19.2): what a person will record, with the helper not started. FPS 0 is 30.

type RecordingProposal added in v0.57.0

type RecordingProposal struct {
	ID        string              `json:"proposal_id"`
	State     string              `json:"state"`
	Actor     string              `json:"actor"`
	CreatedAt time.Time           `json:"created_at"`
	Ranges    []RecordingCutRange `json:"ranges"`
	DecidedBy string              `json:"decided_by,omitempty"`
	DecidedAt *time.Time          `json:"decided_at,omitempty"`
	// Revision is the revision of the timeline the accepted ranges produced.
	Revision int64 `json:"revision,omitempty"`
}

RecordingProposal is a proposal of cuts as a surface sees it.

type RecordingProposalDecideRequest added in v0.57.0

type RecordingProposalDecideRequest struct {
	ID         string `json:"recording_id"`
	ProposalID string `json:"proposal_id"`
	Accept     []bool `json:"accept"`
	TimelineID string `json:"timeline_id,omitempty"`
}

RecordingProposalDecideRequest is the decision of a person: Accept[i] is the decision on range i, one for each.

type RecordingProposalDecideResult added in v0.57.0

type RecordingProposalDecideResult struct {
	Recording Recording   `json:"recording"`
	Edit      *EditResult `json:"edit,omitempty"`
	Text      string      `json:"text"`
}

RecordingProposalDecideResult is the recording after the decision and, when ranges were accepted, the edit that cut them: one batch, so one undo restores the timeline.

type RecordingProposeCutsRequest added in v0.57.0

type RecordingProposeCutsRequest struct {
	ID     string              `json:"recording_id"`
	Ranges []RecordingCutRange `json:"ranges"`
}

RecordingProposeCutsRequest proposes cuts of a ready recording. It changes no timeline.

type RecordingRef added in v0.52.0

type RecordingRef struct {
	ID string `json:"recording_id"`
}

RecordingRef names a recording.

type RecordingSource added in v0.52.0

type RecordingSource struct {
	Kind string `json:"kind"`
	ID   string `json:"id"`
	// Name is the title the person saw in the picker; optional, untrusted and sealed in the database.
	Name string `json:"name,omitempty" untrusted:"true"`
}

RecordingSource names the source of a recording.

type RecordingSourceInfo added in v0.52.0

type RecordingSourceInfo struct {
	ID     string `json:"id"`
	Name   string `json:"name"   untrusted:"true"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

RecordingSourceInfo is a display or a window that can be captured. A window title is untrusted text.

type RecordingSourcesRequest added in v0.52.0

type RecordingSourcesRequest struct{}

RecordingSourcesRequest has no member.

type RecordingSourcesResult added in v0.52.0

type RecordingSourcesResult struct {
	Displays    []RecordingSourceInfo `json:"displays"`
	Windows     []RecordingSourceInfo `json:"windows"`
	Microphones []RecordingDevice     `json:"microphones"`
	Cameras     []RecordingDevice     `json:"cameras"`
	// SystemAudio says whether the mix the computer plays can be recorded.
	SystemAudio bool `json:"system_audio"`
}

RecordingSourcesResult is what can be captured now.

type RecordingStartRequest added in v0.52.0

type RecordingStartRequest struct {
	ProjectID string          `json:"project_id"`
	Source    RecordingSource `json:"source"`
	FPS       int             `json:"fps,omitempty"`
	// Microphone is a device id from RecordingSources, or "default"; empty records none (SDD-025 section 16).
	Microphone string `json:"microphone,omitempty"`
	// SystemAudio records the mix the computer plays on a track of its own.
	SystemAudio bool `json:"system_audio,omitempty"`
	// Camera is a device id from RecordingSources; empty records none.
	Camera string `json:"camera,omitempty"`
	// Events saves the pointer position and the clicks (never a key) beside the recording.
	Events bool `json:"events,omitempty"`
	// RecordingID starts a recording an agent or a person prepared (SDD-025 section 19.2): its stored plan is the
	// request, and every other member must be empty.
	RecordingID string `json:"recording_id,omitempty"`
}

RecordingStartRequest is SDD-025 section 9.1. FPS 0 is 30.

type RecordingTrack added in v0.55.0

type RecordingTrack struct {
	Kind       string `json:"kind"`
	StartMS    int64  `json:"start_ms"`
	DurationMS int64  `json:"duration_ms"`
	Bytes      int64  `json:"bytes"`
	// Lost is a track whose device went away during the recording.
	Lost    bool   `json:"lost,omitempty"`
	AssetID string `json:"asset_id,omitempty"`
}

RecordingTrack is one source of a recording: its kind, where it starts on the shared clock, and how long it is.

type RecordingUpload added in v0.56.0

type RecordingUpload struct {
	Container     string                 `json:"container"`
	MaxChunkBytes int64                  `json:"max_chunk_bytes"`
	Tracks        []RecordingUploadTrack `json:"tracks"`
}

RecordingUpload is what a client reads to resume an upload: present while a browser recording receives chunks.

type RecordingUploadBeginRequest added in v0.56.0

type RecordingUploadBeginRequest struct {
	ProjectID string `json:"project_id"`
	// Container is webm or mp4, what the browser records.
	Container string `json:"container"`
	// Camera says that a second track, the camera, will be uploaded.
	Camera bool `json:"camera,omitempty"`
	// Label is optional plain text about what was shared; untrusted and sealed in the database.
	Label string `json:"label,omitempty" untrusted:"true"`
}

RecordingUploadBeginRequest starts a recording that the browser will upload (SDD-025 section 18.3).

type RecordingUploadChunkRequest added in v0.56.0

type RecordingUploadChunkRequest struct {
	ID    string
	Track string
	Index int
	// SHA256 is the lowercase hexadecimal digest of the body, which the server checks.
	SHA256 string
	// ElapsedMS is the clock of the recorder; informational, and checked against the duration limit.
	ElapsedMS int64
	Body      io.Reader
	// Size is the declared length of the body, or -1.
	Size int64
}

RecordingUploadChunkRequest is one chunk of a track: the bytes are Body, and nothing else is read from it.

type RecordingUploadChunkResult added in v0.56.0

type RecordingUploadChunkResult struct {
	ID    string `json:"recording_id"`
	Track string `json:"track"`
	Index int    `json:"index"`
	// NextIndex is the chunk the track waits for.
	NextIndex int `json:"next_index"`
	// Duplicate is true when the chunk was already stored and the same: nothing changed.
	Duplicate bool `json:"duplicate"`
	// Bytes is what the server holds for the recording, every track.
	Bytes int64  `json:"bytes"`
	Text  string `json:"text"`
}

RecordingUploadChunkResult says where the track is after a chunk.

type RecordingUploadCount added in v0.56.0

type RecordingUploadCount struct {
	Kind   string `json:"kind"`
	Chunks int    `json:"chunks"`
}

RecordingUploadCount is the number of chunks the browser sent on a track.

type RecordingUploadFinishRequest added in v0.56.0

type RecordingUploadFinishRequest struct {
	ID        string                 `json:"recording_id"`
	Tracks    []RecordingUploadCount `json:"tracks,omitempty"`
	ElapsedMS int64                  `json:"elapsed_ms,omitempty"`
}

RecordingUploadFinishRequest ends an upload: the server assembles what it has.

type RecordingUploadTrack added in v0.56.0

type RecordingUploadTrack struct {
	Kind      string `json:"kind"`
	NextIndex int    `json:"next_index"`
	Bytes     int64  `json:"bytes"`
}

RecordingUploadTrack is where one track of an upload is.

type RenderOffer added in v0.35.0

type RenderOffer struct {
	AssetID string   `json:"asset_id"`
	Name    string   `json:"name"     untrusted:"true"`
	ItemIDs []string `json:"item_ids"`
}

RenderOffer says that an earlier render of the same animation (the same render key) is used by clips of the timeline: the clips are replaced by MotionReplace, or by clip.replace_media in one edit.

type Repos

type Repos interface {
	Projects() ProjectRepo
	Productions() ProductionRepo
	Operations() OperationRepo
	Idempotency() IdempotencyRepo
	Assets() AssetRepo
	Jobs() JobRepo
	Templates() TemplateRepo
	Backups() BackupRepo
	Audit() AuditRepo
	Checkpoints() CheckpointRepo
	// ImageCheckpoints is the checkpoints of the image documents: the same repository, over `image_checkpoints`
	// (SDD-005 section 5.14.1), with the id of the image in the ProjectID of a row.
	ImageCheckpoints() CheckpointRepo
	Fonts() FontRepo
	BrandKit() BrandKitRepo
	Images() ImageRepo
	Connections() connections.Store
	Approvals() approval.Store
	// Accounts is the one local account of the workspace (SDD-005 section 5.17).
	Accounts() account.Store
	AssetLibrary() assets.Store
	Publications() publish.Store
	Blog() destinations.Store
	Chat() agenthost.Store
	Webhooks() webhooks.Store
	// Recordings is the screen recordings (SDD-005 section 5.18).
	Recordings() recordings.Store
}

Repos groups the repositories. On a Tx they are bound to the transaction.

type ScriptEstimateRequest added in v0.36.0

type ScriptEstimateRequest struct {
	ProjectID      string `json:"project_id,omitempty"`
	ItemID         string `json:"item_id,omitempty"`
	Text           string `json:"text,omitempty"`
	WordsPerMinute int    `json:"words_per_minute,omitempty"` // 60 to 300; default 150
}

ScriptEstimateRequest estimates the duration of a script when read aloud. Give ItemID (a stored script) or Text.

type ScriptEstimateResult added in v0.36.0

type ScriptEstimateResult struct {
	Envelope
	ProjectID string `json:"project_id,omitempty"`
	writing.Estimate
	Text string `json:"text"`
}

ScriptEstimateResult is the estimate of a script.

type Service

type Service interface {
	ProductionService
	WritingService
	BlogService
	BriefingService
	AssetLibraryService
	ChatService
	InboxService
	MotionService

	ProjectList(ctx context.Context, req ProjectListRequest) (*ProjectListResult, error)
	ProjectCreate(ctx context.Context, req ProjectCreateRequest) (*ProjectCreateResult, error)
	ProjectUpdate(ctx context.Context, req ProjectUpdateRequest) (*ProjectUpdateResult, error)
	ProjectGet(ctx context.Context, req ProjectGetRequest) (*ProjectGetResult, error)
	ProjectTrash(ctx context.Context, req ProjectTrashRequest) (*ProjectStateResult, error)
	ProjectRestore(ctx context.Context, req ProjectTrashRequest) (*ProjectStateResult, error)

	// Standalone video sessions (SDD-005 section 5.12.5, epic 105): quick-open video editing without creating a
	// production project first, with optional promotion to a full project.
	StandaloneVideoList(ctx context.Context, req StandaloneVideoListRequest) (*ProjectListResult, error)
	StandaloneVideoCreate(ctx context.Context, req StandaloneVideoCreateRequest) (*StandaloneVideoResult, error)
	StandaloneVideoUpload(ctx context.Context, req StandaloneVideoUploadRequest) (*StandaloneVideoResult, error)
	StandalonePromote(ctx context.Context, req StandalonePromoteRequest) (*ProjectUpdateResult, error)

	Edit(ctx context.Context, req EditRequest) (*EditResult, error)
	CommandHelp(ctx context.Context, req CommandHelpRequest) (*CommandHelpResult, error)

	HistoryList(ctx context.Context, req HistoryListRequest) (*HistoryListResult, error)
	Undo(ctx context.Context, req UndoRequest) (*UndoResult, error)
	Redo(ctx context.Context, req UndoRequest) (*UndoResult, error)
	HistoryRevert(ctx context.Context, req HistoryRevertRequest) (*HistoryRevertResult, error)
	HistoryDiff(ctx context.Context, req HistoryDiffRequest) (*HistoryDiffResult, error)
	CheckpointCreate(ctx context.Context, req CheckpointCreateRequest) (*Checkpoint, error)
	CheckpointList(ctx context.Context, req CheckpointListRequest) (*CheckpointListResult, error)
	CheckpointRename(ctx context.Context, req CheckpointRenameRequest) (*Checkpoint, error)
	CheckpointRemove(ctx context.Context, req CheckpointRemoveRequest) (*Checkpoint, error)

	Lint(ctx context.Context, req LintRequest) (*LintResult, error)

	MediaImport(ctx context.Context, req MediaImportRequest) (*MediaImportResult, error)
	MediaInspect(ctx context.Context, req MediaInspectRequest) (*MediaInspectResult, error)
	MediaList(ctx context.Context, req MediaListRequest) (*MediaListResult, error)
	MediaTrash(ctx context.Context, req MediaTrashRequest) (*MediaStateResult, error)
	MediaRestore(ctx context.Context, req MediaTrashRequest) (*MediaStateResult, error)

	JobStart(ctx context.Context, req JobStartRequest) (*Job, error)
	ProjectBundleExport(ctx context.Context, req ProjectBundleExportRequest) (*Job, error)
	ProjectBundleImport(ctx context.Context, req ProjectBundleImportRequest) (*ProjectCreateResult, error)
	ProjectOtioExport(ctx context.Context, req ProjectOtioExportRequest) (*ProjectOtioExportResult, error)
	ProjectOtioImport(ctx context.Context, req ProjectOtioImportRequest) (*ProjectOtioImportResult, error)

	FontImport(ctx context.Context, req FontImportRequest) (*FontImportResult, error)
	BrandKitGet(ctx context.Context, req BrandKitGetRequest) (*BrandKit, error)
	BrandKitSet(ctx context.Context, req BrandKitSetRequest) (*BrandKit, error)

	// The library: memory notes, skills and prompts kept as files in the workspace (SDD-018). The text of every
	// entry is untrusted; a skill that a person has not reviewed is not offered to an agent.
	MemoryList(ctx context.Context, req MemoryListRequest) (*LibraryListResult, error)
	MemoryGet(ctx context.Context, req LibraryRef) (*MemoryGetResult, error)
	MemoryWrite(ctx context.Context, req MemoryWriteRequest) (*MemoryWriteResult, error)
	MemoryRemove(ctx context.Context, req LibraryRef) (*LibraryRemoveResult, error)
	SkillList(ctx context.Context, req SkillListRequest) (*LibraryListResult, error)
	SkillGet(ctx context.Context, req LibraryRef) (*SkillGetResult, error)
	SkillWrite(ctx context.Context, req SkillWriteRequest) (*SkillWriteResult, error)
	SkillImport(ctx context.Context, req SkillImportRequest) (*SkillImportResult, error)
	SkillMarkReviewed(ctx context.Context, req SkillReviewRequest) (*SkillReviewResult, error)
	SkillLint(ctx context.Context, req LibraryRef) (*SkillLintResult, error)
	SkillExport(ctx context.Context, req SkillExportRequest) (*SkillExportResult, error)
	PromptList(ctx context.Context, req PromptListRequest) (*LibraryListResult, error)
	PromptGet(ctx context.Context, req LibraryRef) (*PromptGetResult, error)
	PromptWrite(ctx context.Context, req PromptWriteRequest) (*PromptWriteResult, error)
	PromptRender(ctx context.Context, req PromptRenderRequest) (*PromptRenderResult, error)
	LibrarySearch(ctx context.Context, req LibrarySearchRequest) (*LibrarySearchResult, error)
	LibraryReindex(ctx context.Context, req LibraryReindexRequest) (*LibraryReindexResult, error)

	// The AI provider layer (SDD-016): the providers and their models, the price table, and a text generation,
	// which is a job of a kind that needs approval (SDD-015 section 5).
	ProviderList(ctx context.Context, req ProviderListRequest) (*ProviderListResult, error)
	ProviderModels(ctx context.Context, req ProviderModelsRequest) (*ProviderModelsResult, error)
	ProviderPriceSet(ctx context.Context, req ProviderPriceSetRequest) (*ProviderPricesResult, error)
	TextGenerate(ctx context.Context, req TextGenerateRequest) (*Job, error)
	ImageGenerate(ctx context.Context, req ImageGenerateRequest) (*Job, error)
	VoiceGenerate(ctx context.Context, req VoiceGenerateRequest) (*Job, error)
	VideoGenerate(ctx context.Context, req VideoGenerateRequest) (*Job, error)
	VoiceList(ctx context.Context, req VoiceListRequest) (*VoiceListResult, error)
	// ImageModelEdit removes the background of a layer, or generates an image into a document, with a provider
	// (SDD-016 section 6.5); a job of a kind that needs approval.
	ImageModelEdit(ctx context.Context, req ImageModelEditRequest) (*Job, error)
	// The sign-in to an AI provider in the browser (SDD-016 section 12): only a person begins and completes one.
	ProviderSignInBegin(ctx context.Context, req ProviderSignInBeginRequest) (*ProviderSignInBeginResult, error)
	ProviderSignInComplete(ctx context.Context, req ProviderSignInCompleteRequest) (*ProviderSignIn, error)
	ProviderSignInList(ctx context.Context, req ProviderSignInListRequest) (*ProviderSignInListResult, error)

	JobGet(ctx context.Context, req JobGetRequest) (*Job, error)
	JobList(ctx context.Context, req JobListRequest) (*JobListResult, error)
	JobCancel(ctx context.Context, req JobCancelRequest) (*Job, error)

	TemplateList(ctx context.Context, req TemplateListRequest) (*TemplateListResult, error)
	TemplateSave(ctx context.Context, req TemplateSaveRequest) (*TemplateResult, error)
	TemplateInstantiate(ctx context.Context, req TemplateInstantiateRequest) (*TemplateInstantiateResult, error)
	TemplateExport(ctx context.Context, req TemplateRef) (*FileResult, error)
	TemplateImport(ctx context.Context, req TemplateImportRequest) (*TemplateResult, error)

	// SnapPoints, FontList, ExportFile and AuditList are read operations of the
	// editor and of the administrator (SDD-000 section 1).
	SnapPoints(ctx context.Context, req SnapPointsRequest) (*SnapPointsResult, error)
	FontList(ctx context.Context, req FontListRequest) (*FontListResult, error)
	// TranscriptView and TranscriptDetectFillers read the transcript of an asset to edit by text (SDD-023):
	// the words with their timeline ranges, and the filler words and repetitions to review. Neither changes
	// anything; the cut is the command transcript.delete_range of Edit.
	TranscriptView(ctx context.Context, req TranscriptViewRequest) (*TranscriptViewResult, error)
	TranscriptDetectFillers(ctx context.Context, req TranscriptDetectRequest) (*TranscriptDetectResult, error)
	// CutsPropose proposes vertical cuts of an asset from its transcript and its face track (SDD-024 section 8).
	// It changes nothing: a person sends the batch of a proposal to a new timeline.
	CutsPropose(ctx context.Context, req CutsProposeRequest) (*CutsProposeResult, error)
	// AssetList lists the files the projects hold, by content hash, for the picker of a brand logo (VV-117).
	AssetList(ctx context.Context, req AssetListRequest) (*AssetListResult, error)
	ExportFile(ctx context.Context, req ExportFileRequest) (*File, error)
	// ExportPresetList, ExportCheck and ExportBatch are the export presets, the check against one and the batch of
	// exports of SDD-004 sections 8.2 to 8.4 (RF-087 to RF-089).
	ExportPresetList(ctx context.Context, req ExportPresetListRequest) (*ExportPresetListResult, error)
	ExportCheck(ctx context.Context, req ExportCheckRequest) (*ExportCheckResult, error)
	ExportBatch(ctx context.Context, req ExportBatchRequest) (*Job, error)
	// AudioMeasure is the loudness, true peak and noise floor of a range or an item with and without its audio
	// processors (SDD-004 section 7.1, epic 34).
	AudioMeasure(ctx context.Context, req AudioMeasureRequest) (*AudioMeasureResult, error)
	AuditList(ctx context.Context, req AuditListRequest) (*AuditListResult, error)
	ActivityList(ctx context.Context, req ActivityListRequest) (*ActivityListResult, error)

	// Doctor is the diagnostic report (SDD-003 section 2, SDD-011 section 8.6).
	Doctor(ctx context.Context, req DoctorRequest) (*DoctorResult, error)

	// TrashEmpty deletes what is in the trash for good; HTTP only, for a
	// browser session or an admin key (SDD-007 section 5.3).
	TrashEmpty(ctx context.Context, req TrashEmptyRequest) (*TrashEmptyResult, error)

	// ToolsInstall downloads the transcription helper and its model; it is the
	// only operation that does, and only a person can call it (SDD-007 6.8).
	ToolsInstall(ctx context.Context, req ToolsInstallRequest) (*ToolsInstallResult, error)
	ToolsStatus(ctx context.Context, req ToolsStatusRequest) (*ToolsStatusResult, error)

	// ViewFrame and ViewSheet render the current revision through the export
	// executor (SDD-003 section 2.7).
	ViewFrame(ctx context.Context, req ViewFrameRequest) (*ViewResult, error)
	ViewSheet(ctx context.Context, req ViewSheetRequest) (*ViewResult, error)

	// PlanWindow reads the render plan of a window of frames (SDD-004 section 10).
	PlanWindow(ctx context.Context, req PlanWindowRequest) (*PlanWindowResult, error)

	// OpenFile resolves a stored file of an asset for download; the caller
	// serves the bytes.
	OpenFile(ctx context.Context, ref FileRef) (*File, error)

	// KeyCreate, KeyList and KeyRevoke manage the API keys of network mode, for
	// a person who logged in; a key cannot call them (SDD-007 section 4.2).
	KeyCreate(ctx context.Context, req KeyCreateRequest) (*KeyCreateResult, error)
	KeyList(ctx context.Context, req KeyListRequest) (*KeyListResult, error)
	KeyRevoke(ctx context.Context, req KeyRevokeRequest) (*Key, error)

	// The image documents of SDD-021: creation (blank or from a template), the list, the text view, batches of
	// image operations, undo and redo, and the export to a file.
	ImageCreate(ctx context.Context, req ImageCreateRequest) (*ImageCreateResult, error)
	ImageList(ctx context.Context, req ImageListRequest) (*ImageListResult, error)
	ImageDescribe(ctx context.Context, req ImageDescribeRequest) (*ImageDescribeResult, error)
	ImageEdit(ctx context.Context, req ImageEditRequest) (*ImageEditResult, error)
	ImageUndo(ctx context.Context, req ImageStepRequest) (*ImageStepResult, error)
	ImageRedo(ctx context.Context, req ImageStepRequest) (*ImageStepResult, error)
	// ImageRevert and the checkpoints of an image are those of a timeline (SDD-003 section 2.5.1) for an image
	// document (SDD-021 section 4).
	ImageRevert(ctx context.Context, req ImageRevertRequest) (*ImageRevertResult, error)
	ImageDiff(ctx context.Context, req ImageDiffRequest) (*ImageDiffResult, error)
	ImageCheckpointCreate(ctx context.Context, req ImageCheckpointCreateRequest) (*Checkpoint, error)
	ImageCheckpointList(ctx context.Context, req ImageCheckpointListRequest) (*ImageCheckpointListResult, error)
	ImageCheckpointRename(ctx context.Context, req ImageCheckpointRenameRequest) (*Checkpoint, error)
	ImageCheckpointRemove(ctx context.Context, req ImageCheckpointRemoveRequest) (*Checkpoint, error)
	ImageExport(ctx context.Context, req ImageExportRequest) (*ImageExportResult, error)
	// ImageImport brings an image file into an image document: a new one, or a layer of ImageID (SDD-021 section 10.1).
	ImageImport(ctx context.Context, req ImageImportRequest) (*ImageImportResult, error)
	// ImageImportFile is ImageImport for a file that arrives as the bytes of a request (SDD-021 section 10.2); HTTP only.
	ImageImportFile(ctx context.Context, req ImageImportFileRequest) (*ImageImportResult, error)
	// ImageOpenFromAsset opens a standalone image document directly from a workspace asset hash (epic 105).
	ImageOpenFromAsset(ctx context.Context, req ImageOpenFromAssetRequest) (*ImageImportResult, error)
	// ImageFrame, ImageHistory and ImageFile are the reads of the image editor screen (SDD-012 section 24.3); HTTP only.
	ImageFrame(ctx context.Context, req ImageFrameRequest) (*ImageFrameResult, error)
	ImageHistory(ctx context.Context, req ImageHistoryRequest) (*ImageHistoryResult, error)
	ImageFile(ctx context.Context, req ImageFileRequest) (*File, error)
	// ConnectionList and ConnectionGet read the destinations the user connected; ConnectionCreate,
	// ConnectionRemove and ConnectionTest are for an administrator. No result carries a credential
	// (SDD-014 section 5).
	ConnectionList(ctx context.Context, req ConnectionListRequest) (*ConnectionListResult, error)
	ConnectionGet(ctx context.Context, req ConnectionRef) (*connections.Connection, error)
	ConnectionCreate(ctx context.Context, req ConnectionCreateRequest) (*connections.Connection, error)
	ConnectionRemove(ctx context.Context, req ConnectionRef) (*connections.Connection, error)
	ConnectionTest(ctx context.Context, req ConnectionRef) (*ConnectionTestResult, error)

	// The outbound webhooks (SDD-022). All but the list of events are for an administrator; no result carries the
	// signing secret except WebhookCreate and WebhookRotateSecret, once.
	WebhookEventList(ctx context.Context, req WebhookEventListRequest) (*WebhookEventListResult, error)
	WebhookList(ctx context.Context, req WebhookListRequest) (*WebhookListResult, error)
	WebhookGet(ctx context.Context, req WebhookRef) (*Webhook, error)
	WebhookCreate(ctx context.Context, req WebhookCreateRequest) (*WebhookSecretResult, error)
	WebhookUpdate(ctx context.Context, req WebhookUpdateRequest) (*Webhook, error)
	WebhookRemove(ctx context.Context, req WebhookRef) (*Webhook, error)
	WebhookRotateSecret(ctx context.Context, req WebhookRef) (*WebhookSecretResult, error)
	WebhookTest(ctx context.Context, req WebhookRef) (*WebhookDelivery, error)
	WebhookDeliveryList(ctx context.Context, req WebhookDeliveriesRequest) (*WebhookDeliveriesResult, error)
	WebhookRedeliver(ctx context.Context, req WebhookRedeliverRequest) (*WebhookDelivery, error)

	// Screen recording (SDD-025). RecordingStart, RecordingConfirm and RecordingDismiss are for a person in a
	// privileged browser session and answer E_PRIVILEGED_SESSION to everyone else; stopping is always allowed.
	RecordingSources(ctx context.Context, req RecordingSourcesRequest) (*RecordingSourcesResult, error)
	RecordingStart(ctx context.Context, req RecordingStartRequest) (*Recording, error)
	RecordingStop(ctx context.Context, req RecordingRef) (*Recording, error)
	RecordingPause(ctx context.Context, req RecordingRef) (*Recording, error)
	RecordingResume(ctx context.Context, req RecordingRef) (*Recording, error)
	RecordingEvents(ctx context.Context, req RecordingEventsRequest) (*RecordingEventsResult, error)
	RecordingCancel(ctx context.Context, req RecordingRef) (*Recording, error)
	RecordingGet(ctx context.Context, req RecordingRef) (*Recording, error)
	RecordingList(ctx context.Context, req RecordingListRequest) (*RecordingListResult, error)
	RecordingConfirm(ctx context.Context, req RecordingRef) (*Recording, error)
	RecordingDismiss(ctx context.Context, req RecordingRef) (*Recording, error)
	RecordingPlace(ctx context.Context, req RecordingPlaceRequest) (*EditResult, error)
	// RecordingPrepare, RecordingMark and RecordingProposeCuts are the agent flow of SDD-025 section 19; none starts
	// a capture. RecordingProposalDecide is a person's: the accepted ranges are one batch.
	RecordingPrepare(ctx context.Context, req RecordingPrepareRequest) (*Recording, error)
	RecordingMark(ctx context.Context, req RecordingMarkRequest) (*Recording, error)
	RecordingProposeCuts(ctx context.Context, req RecordingProposeCutsRequest) (*Recording, error)
	RecordingProposalDecide(
		ctx context.Context,
		req RecordingProposalDecideRequest,
	) (*RecordingProposalDecideResult, error)
	// A recording a browser captures and uploads (SDD-025 section 18): all three are for a person in a privileged
	// browser session, and HTTP only.
	RecordingUploadBegin(ctx context.Context, req RecordingUploadBeginRequest) (*Recording, error)
	RecordingUploadChunk(ctx context.Context, req RecordingUploadChunkRequest) (*RecordingUploadChunkResult, error)
	RecordingUploadFinish(ctx context.Context, req RecordingUploadFinishRequest) (*Recording, error)

	// The approval queue, its rules and the cost ceilings (SDD-015). Reading is for every caller that
	// may read; ApprovalDecide, ApprovalRuleSet, ApprovalRuleRemove and CostCeilingSet are for a
	// person in a privileged browser session and answer E_PRIVILEGED_SESSION to everyone else.
	ApprovalList(ctx context.Context, req ApprovalListRequest) (*ApprovalListResult, error)
	ApprovalGet(ctx context.Context, req ApprovalRef) (*approval.Request, error)
	ApprovalDecide(ctx context.Context, req ApprovalDecideRequest) (*approval.Request, error)
	ApprovalRuleList(ctx context.Context, req ApprovalRuleListRequest) (*ApprovalRuleListResult, error)
	ApprovalRuleSet(ctx context.Context, req ApprovalRuleSetRequest) (*approval.RuleView, error)
	ApprovalRuleRemove(ctx context.Context, req ApprovalRef) (*approval.RuleView, error)
	CostSummary(ctx context.Context, req CostSummaryRequest) (*CostSummaryResult, error)
	CostCeilingSet(ctx context.Context, req CostCeilingSetRequest) (*CostSummaryResult, error)

	// The social networks and publishing (SDD-020). A publication is a job of a kind that needs approval:
	// PublishNow answers a job in waiting_approval, and nothing leaves the machine before a person approves.
	SocialNetworkList(ctx context.Context, req SocialNetworkListRequest) (*SocialNetworkListResult, error)
	SocialConnectBegin(ctx context.Context, req SocialConnectBeginRequest) (*SocialConnectBeginResult, error)
	SocialConnectComplete(ctx context.Context, req SocialConnectCompleteRequest) (*SocialAccount, error)
	SocialAccountList(ctx context.Context, req SocialAccountListRequest) (*SocialAccountListResult, error)
	SocialAccountSelect(ctx context.Context, req SocialAccountSelectRequest) (*SocialAccount, error)
	SocialPriceSet(ctx context.Context, req SocialPriceSetRequest) (*SocialAccount, error)
	PublishValidate(ctx context.Context, req PublishValidateRequest) (*PublishValidateResult, error)
	PublishNow(ctx context.Context, req PublishNowRequest) (*Job, error)
	PublishStatus(ctx context.Context, req PublishStatusRequest) (*PublishStatusResult, error)

	// The calendar of publications (SDD-020 sections 23 to 31): a publication with one target per account, each
	// with its time. PublicationSchedule, PublicationSendNow and PublicationRetry only ask for approval: a
	// target is sent by the scheduler, after a person or a rule the person wrote approved it.
	PublicationCreate(ctx context.Context, req PublicationCreateRequest) (*Publication, error)
	PublicationGet(ctx context.Context, req PublicationGetRequest) (*Publication, error)
	PublicationList(ctx context.Context, req PublicationListRequest) (*PublicationListResult, error)
	PublicationUpdate(ctx context.Context, req PublicationUpdateRequest) (*Publication, error)
	PublicationSchedule(ctx context.Context, req PublicationScheduleRequest) (*Publication, error)
	PublicationSendNow(ctx context.Context, req PublicationSendNowRequest) (*Publication, error)
	PublicationRetry(ctx context.Context, req PublicationRetryRequest) (*Publication, error)
	PublicationCancel(ctx context.Context, req PublicationCancelRequest) (*Publication, error)

	// The day of the calendar (SDD-020 section 30A, D-146): a range with its days and slots, the note and theme of a
	// day, quiet days (a person only), recurring slots, a copy of a publication, and the .ics export.
	PublicationDuplicate(ctx context.Context, req PublicationDuplicateRequest) (*Publication, error)
	CalendarPlan(ctx context.Context, req CalendarPlanRequest) (*CalendarPlanResult, error)
	CalendarDaySet(ctx context.Context, req CalendarDaySetRequest) (*CalendarDay, error)
	CalendarQuietSet(ctx context.Context, req CalendarQuietSetRequest) (*CalendarDay, error)
	CalendarSlotSave(ctx context.Context, req CalendarSlotSaveRequest) (*CalendarSlot, error)
	CalendarSlotDelete(ctx context.Context, req CalendarSlotDeleteRequest) (*CalendarSlotDeleteResult, error)
	CalendarExport(ctx context.Context, req CalendarExportRequest) (*CalendarExportResult, error)
}

Service is the single application boundary (ADR-0008): the UI, MCP, CLI and HTTP adapters call it. This is the part of the interface of SDD-003 section 2.1: projects, edits, history, lint, media, jobs, templates, fonts, bundles, OpenTimelineIO and system. Every method returns a *Error on failure and never a partial result with a non-nil error.

func New

func New(o Options) (Service, error)

New returns the in-process Service over a store.

type SkillExportRequest added in v0.31.0

type SkillExportRequest struct {
	Names []string `json:"names,omitempty"` // empty: every reviewed skill
}

SkillExportRequest exports skills as folders in the Agent Skills layout.

type SkillExportResult added in v0.31.0

type SkillExportResult struct {
	Names []string `json:"names"`
	Path  string   `json:"path,omitempty"` // the folder that holds them; to a local caller only
	Text  string   `json:"text"`
}

SkillExportResult says what was exported.

type SkillFileInput added in v0.31.0

type SkillFileInput struct {
	Path string `json:"path"`
	Text string `json:"text"`
}

SkillFileInput is a file of a skill that a caller writes.

type SkillFileView added in v0.31.0

type SkillFileView struct {
	Path   string `json:"path"`
	Bytes  int    `json:"bytes"`
	Script bool   `json:"script,omitempty"` // stored inert, never run
	Binary bool   `json:"binary,omitempty"` // not text: its content is not returned
	Text   string `json:"text,omitempty"   untrusted:"true"`
}

SkillFileView is one file of a skill folder.

type SkillGetResult added in v0.31.0

type SkillGetResult struct {
	Envelope
	Entry         LibraryEntry     `json:"entry"`
	License       string           `json:"license,omitempty"       untrusted:"true"`
	Compatibility string           `json:"compatibility,omitempty" untrusted:"true"`
	AllowedTools  string           `json:"allowed_tools,omitempty" untrusted:"true"`
	Source        string           `json:"source,omitempty"        untrusted:"true"`
	Body          string           `json:"body"                    untrusted:"true"`
	Files         []SkillFileView  `json:"files,omitempty"`
	Findings      []LibraryFinding `json:"findings,omitempty"`
	// ContentHash is the hash of the content returned, which a person sends back to mark it as read.
	ContentHash string `json:"content_hash"`
	Text        string `json:"text"`
}

SkillGetResult is a skill: its text and its files.

type SkillImportRequest added in v0.31.0

type SkillImportRequest struct {
	Path    string `json:"path"`             // absolute: a folder, a .zip or a .tar.gz
	Source  string `json:"source,omitempty"` // where it came from; the base name of the path if empty
	Replace bool   `json:"replace,omitempty"`
}

SkillImportRequest imports a skill from a folder or an archive on the machine of the server.

type SkillImportResult added in v0.31.0

type SkillImportResult struct {
	Envelope
	Entry    LibraryEntry     `json:"entry"`
	Findings []LibraryFinding `json:"findings,omitempty"`
	Files    int              `json:"files"`
	Text     string           `json:"text"`
}

SkillImportResult is the skill that was imported: unreviewed, with the findings of the lint.

type SkillLintResult added in v0.31.0

type SkillLintResult struct {
	Name     string           `json:"name"`
	Findings []LibraryFinding `json:"findings"`
	Errors   int              `json:"errors"`
	Warnings int              `json:"warnings"`
	Text     string           `json:"text"`
}

SkillLintResult is the lint of a skill.

type SkillListRequest added in v0.31.0

type SkillListRequest struct {
	Origin            string `json:"origin,omitempty"`
	IncludeUnreviewed bool   `json:"include_unreviewed,omitempty"`
	AgentView         bool   `json:"agent_view,omitempty"`
	// SessionID is the agent session whose loaded skills are marked `loaded`. Left out, it is the session an
	// agent's own token is bound to; a person with no session marks none.
	SessionID string `json:"session_id,omitempty"`
}

SkillListRequest lists the skills.

type SkillReviewRequest added in v0.32.0

type SkillReviewRequest struct {
	Name        string `json:"name"`
	ContentHash string `json:"content_hash"`
}

SkillReviewRequest marks a skill as read: its name and the content hash of the skill as the person read it (SkillGetResult.ContentHash). A skill that changed since is not marked (SDD-018 section 7).

type SkillReviewResult added in v0.31.0

type SkillReviewResult struct {
	Envelope
	Entry LibraryEntry `json:"entry"`
	Text  string       `json:"text"`
}

SkillReviewResult is the skill after a person marked it as read.

type SkillWriteRequest added in v0.31.0

type SkillWriteRequest struct {
	Name          string            `json:"name"`
	Description   string            `json:"description"`
	License       string            `json:"license,omitempty"`
	Compatibility string            `json:"compatibility,omitempty"`
	AllowedTools  string            `json:"allowed_tools,omitempty"`
	Metadata      map[string]string `json:"metadata,omitempty"`
	Body          string            `json:"body"`
	// Files are the other files of the folder. Omitted (null) keeps those the skill has; an empty list removes them.
	Files []SkillFileInput `json:"files"`
}

SkillWriteRequest writes a skill. The origin, the source and the review are the product's to record.

type SkillWriteResult added in v0.31.0

type SkillWriteResult struct {
	Envelope
	Entry    LibraryEntry     `json:"entry"`
	Findings []LibraryFinding `json:"findings,omitempty"`
	Text     string           `json:"text"`
}

SkillWriteResult is the skill that was written, with the findings of the lint.

type SkippedOp

type SkippedOp struct {
	PrimitiveIndex int             `json:"primitive_index"`
	Primitive      json.RawMessage `json:"primitive"`
	Fields         []string        `json:"fields,omitempty"`
	Reason         string          `json:"reason"`
	ByRevision     *int64          `json:"by_revision,omitempty"`
	ByActor        string          `json:"by_actor,omitempty"`
	Details        map[string]any  `json:"details,omitempty"`
}

SkippedOp is a primitive an undo or redo did not apply (SDD-005 section 12.3).

type SlotInfo

type SlotInfo struct {
	Name           string `json:"name"`
	Kind           string `json:"kind"` // "media" | "text" | "caption"
	Required       bool   `json:"required"`
	Description    string `json:"description"               untrusted:"true"`
	DurationPolicy string `json:"duration_policy,omitempty"`
}

SlotInfo describes one slot of a template (SDD-003 section 2.9).

type SlotValue

type SlotValue struct {
	AssetID  string            `json:"asset_id,omitempty"`
	SourceIn string            `json:"source_in,omitempty"` // a time; with asset_id
	Text     *string           `json:"text,omitempty"`
	Words    []command.WordArg `json:"words,omitempty"`
}

SlotValue fills one slot; exactly one member is given.

type SnapPointsRequest

type SnapPointsRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	// Revision, when set, is the revision the caller holds; a project that has moved on answers
	// E_REVISION_CONFLICT with the current revision, so a cached answer is never mixed with a new one.
	Revision int64 `json:"revision,omitempty"`
	// Words adds the start and end of every caption word.
	Words bool `json:"words,omitempty"`
}

SnapPointsRequest asks for the snap points of a project (SDD-012 section 7.8).

type SnapPointsResult

type SnapPointsResult struct {
	Revision int64 `json:"revision"`
	plan.Snap
}

SnapPointsResult is the snap structure of SDD-012 section 7.8.

type SocialAccount added in v0.34.0

type SocialAccount struct {
	ConnectionID string `json:"connection_id"`
	Network      string `json:"network"`
	Label        string `json:"label"                   untrusted:"true"`
	AccountID    string `json:"account_id,omitempty"`
	AccountTitle string `json:"account_title,omitempty" untrusted:"true"`
	// State is ready, needs_sign_in when no refresh token is kept, or needs_account when the sign-in reached
	// several accounts and a person has not chosen one.
	State string `json:"state"`
	// Choices are the accounts a person chooses from when State is needs_account; never a token.
	Choices []SocialChoice `json:"choices,omitempty"`
	// Price is what a post to the network costs, for a network that charges for one (X): the amounts the
	// connection is estimated at, with the page they were read from and the date they were read or edited.
	Price *publish.Price `json:"price,omitempty"`
}

SocialAccount is a connection of a social network with the account it signs in as. It never carries a token.

type SocialAccountListRequest added in v0.34.0

type SocialAccountListRequest struct{}

SocialAccountListRequest has no member.

type SocialAccountListResult added in v0.34.0

type SocialAccountListResult struct {
	Accounts []SocialAccount `json:"accounts"`
}

SocialAccountListResult is the social connections, oldest first.

type SocialAccountSelectRequest added in v0.36.0

type SocialAccountSelectRequest struct {
	ConnectionID string `json:"connection_id"`
	// AccountID is the id of one of the choices of the connection.
	AccountID string `json:"account_id"`
}

SocialAccountSelectRequest chooses the account of a connection whose sign-in reached several.

type SocialChoice added in v0.36.0

type SocialChoice struct {
	ID    string `json:"id"`
	Title string `json:"title" untrusted:"true"`
}

SocialChoice is an account a sign-in reached.

type SocialConnectBeginRequest added in v0.34.0

type SocialConnectBeginRequest struct {
	Network string `json:"network"`
	// Label names the connection; empty is the name of the network.
	Label string `json:"label,omitempty"`
	// ClientID and ClientSecret are those of the developer project the person created; the secret goes into
	// the vault and is in no result. Leave both out with ConnectionID to sign in again.
	ClientID     string `json:"client_id,omitempty"`
	ClientSecret string `json:"client_secret,omitempty"`
	// ConnectionID signs in again an existing connection of the network.
	ConnectionID string `json:"connection_id,omitempty"`
	// RedirectURI is the origin of the app plus the redirect path; it must be the address the person
	// authorised in the developer project.
	RedirectURI string `json:"redirect_uri"`
}

SocialConnectBeginRequest starts the sign-in of a network with the user's own app (SDD-020 section 6).

type SocialConnectBeginResult added in v0.34.0

type SocialConnectBeginResult struct {
	ConnectionID string `json:"connection_id"`
	AuthorizeURL string `json:"authorize_url"`
}

SocialConnectBeginResult has the address the person opens to consent. It holds no secret.

type SocialConnectCompleteRequest added in v0.34.0

type SocialConnectCompleteRequest struct {
	State string `json:"state"`
	Code  string `json:"code,omitempty"`
	// Error is the error the network reported instead of a code (access_denied...).
	Error string `json:"error,omitempty"`
}

SocialConnectCompleteRequest is what the network sent back to the redirect address.

type SocialNetworkListRequest added in v0.34.0

type SocialNetworkListRequest struct{}

SocialNetworkListRequest has no member.

type SocialNetworkListResult added in v0.34.0

type SocialNetworkListResult struct {
	Networks []social.Description `json:"networks"`
	// RedirectPath is the path of the sign-in redirect on this server, to be added to the origin of the
	// app and pasted in the developer project of the network.
	RedirectPath string `json:"redirect_path"`
}

SocialNetworkListResult is the networks of the build.

type SocialPriceSetRequest added in v0.39.0

type SocialPriceSetRequest struct {
	ConnectionID string `json:"connection_id"`
	// PostMicros is the price of a post and LinkMicros the price of a post with a link, in millionths of the
	// currency of the network.
	PostMicros int64 `json:"post_micros"`
	LinkMicros int64 `json:"link_micros"`
}

SocialPriceSetRequest corrects the price of a post on a network that charges for one, when the network changes it (SDD-020 section 39).

type StandalonePromoteRequest added in v0.61.0

type StandalonePromoteRequest struct {
	ProjectID   string      `json:"project_id"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Goal        ProjectGoal `json:"goal"`
	Kind        string      `json:"kind,omitempty"`
	DryRun      bool        `json:"dry_run,omitempty"`
}

StandalonePromoteRequest converts a standalone video session into a full production project.

type StandaloneVideoCreateRequest added in v0.61.0

type StandaloneVideoCreateRequest struct {
	Name      string `json:"name,omitempty"`
	Preset    string `json:"preset,omitempty"` // "9:16", "1:1", "16:9", "4:5"; default "9:16" (or video dims when omitted)
	FPS       string `json:"fps,omitempty"`    // default "30"
	Path      string `json:"path,omitempty"`
	AssetHash string `json:"asset_hash,omitempty"`
	WaitMS    int    `json:"wait_ms,omitempty"`
	ID        string `json:"id,omitempty"`
	DryRun    bool   `json:"dry_run,omitempty"`
}

StandaloneVideoCreateRequest creates a standalone video editing session, optionally importing a local path or workspace library asset and placing it onto track V1 at 0s.

type StandaloneVideoListRequest added in v0.61.0

type StandaloneVideoListRequest struct {
	State string `json:"state,omitempty"` // default "active"; "trashed" | "all"
	Page
}

StandaloneVideoListRequest lists standalone video editor sessions (SDD-005 section 5.12.5, epic 105).

type StandaloneVideoResult added in v0.61.0

type StandaloneVideoResult struct {
	Envelope
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id"`
	Name       string `json:"name"                  untrusted:"true"`
	Standalone bool   `json:"standalone"`
	Revision   int64  `json:"revision"`
	Width      int    `json:"width"`
	Height     int    `json:"height"`
	FPS        string `json:"fps"`
	TrackID    string `json:"track_id,omitempty"`
	AssetID    string `json:"asset_id,omitempty"`
	AssetHash  string `json:"asset_hash,omitempty"`
	AssetState string `json:"asset_state,omitempty"`
	ClipID     string `json:"clip_id,omitempty"`
	JobID      string `json:"job_id,omitempty"`
	Created    bool   `json:"created"`
	Text       string `json:"text"`
}

StandaloneVideoResult is the created standalone video session and optional placed clip.

type StandaloneVideoUploadRequest added in v0.61.0

type StandaloneVideoUploadRequest struct {
	Name     string
	Preset   string
	FPS      string
	WaitMS   int
	FileName string
	Body     io.Reader
	Size     int64
	DryRun   bool
}

StandaloneVideoUploadRequest creates a standalone video editing session from a browser-uploaded file.

type Store

type Store interface {
	Repos

	// Write runs fn in one write transaction (BEGIN IMMEDIATE). fn returning
	// an error rolls back. Hooks added with AfterCommit run after a
	// successful commit, in order, on the calling goroutine, before Write returns.
	Write(ctx context.Context, fn func(ctx context.Context, tx Tx) error) error

	// WriteProject is Write plus: it first acquires the in-process lock of
	// the project (waiting while ctx is live), then loads the project row
	// inside the transaction, and holds the lock until Write has returned
	// including the AfterCommit hooks. ErrNotFound when the project does not
	// exist (fn is not called). A trashed project is passed to fn.
	WriteProject(ctx context.Context, projectID string, fn func(ctx context.Context, tx ProjectTx) error) error

	Close() error
}

Store is the only persistence dependency of Service. Reads on Repos use the reader pool and never wait for the writer. A single-statement write on Repos (a job progress update) is allowed outside a transaction; anything that must be atomic with another write goes through Write or WriteProject.

type Strip

type Strip struct {
	TileW      int `json:"tile_w"`
	TileH      int `json:"tile_h"`
	Columns    int `json:"columns"`
	Count      int `json:"count"`
	IntervalMS int `json:"interval_ms"`
}

Strip describes the sprite of timeline tiles of a video asset.

type Surface

type Surface int

Surface is the way a caller reached the product. The hints of an error are written with the names of the MCP tools, the surface the agents read most; every other surface gets the same hint with the names of its own commands (VV-101). Only the text of the hint changes: the code, the message and the details are the same on every surface.

const (
	SurfaceMCP Surface = iota
	SurfaceCLI
	SurfaceHTTP
	SurfaceUI
)

The surfaces of the product.

type SweepResult

type SweepResult struct {
	StoreFiles    int `json:"store_files"`
	ArtifactDirs  int `json:"artifact_dirs"`
	ExportDirs    int `json:"export_dirs"`
	FrameDirs     int `json:"frame_dirs"`
	IncomingFiles int `json:"incoming_files"`
}

SweepResult counts what a sweep removed.

type Sweeper

type Sweeper interface {
	Sweep(ctx context.Context) (SweepResult, error)
}

Sweeper removes the files that an interrupted emptying left behind. The owner runs it at start-up and doctor reports it (SDD-005 section 13.4).

func SweeperOf

func SweeperOf(s Service) (Sweeper, bool)

SweeperOf returns the sweeper of a Service made by New.

type TemplateImportRequest

type TemplateImportRequest struct {
	Path   string `json:"path"` // absolute
	DryRun bool   `json:"dry_run,omitempty"`
}

TemplateImportRequest reads a template file from the machine of the server.

type TemplateInstantiateRequest

type TemplateInstantiateRequest struct {
	TemplateID string               `json:"template_id"`
	Name       string               `json:"name"`
	Fill       map[string]SlotValue `json:"fill,omitempty"`
	ID         string               `json:"id,omitempty"`
	DryRun     bool                 `json:"dry_run,omitempty"`
	// BrandColors are names of template.colors that take the colour of the brand kit, and BrandFonts
	// are families of the kit added to the fonts of the project (SDD-005 section 5.11).
	BrandColors []string `json:"brand_colors,omitempty"`
	BrandFonts  []string `json:"brand_fonts,omitempty"`
}

TemplateInstantiateRequest makes a project from a template.

type TemplateInstantiateResult

type TemplateInstantiateResult struct {
	ProjectID string         `json:"project_id"`
	Revision  int64          `json:"revision"`
	Unfilled  []string       `json:"unfilled"`
	Findings  []lint.Finding `json:"findings"`
	Text      string         `json:"text"`
}

TemplateInstantiateResult is the new project and what is still to fill.

type TemplateListRequest

type TemplateListRequest struct{ Page }

TemplateListRequest pages the template library.

type TemplateListResult

type TemplateListResult struct {
	Envelope
	Templates  []TemplateSummary `json:"templates"`
	NextCursor *string           `json:"next_cursor"`
	Text       string            `json:"text"`
}

TemplateListResult answers TemplateList.

type TemplateRef

type TemplateRef struct {
	TemplateID string `json:"template_id"`
}

TemplateRef names a template.

type TemplateRepo

type TemplateRepo interface {
	Create(ctx context.Context, row TemplateRow) error
	Get(ctx context.Context, id string) (TemplateRow, error)
	// List pages the templates of ownerUserID, or every template when it is
	// empty (local mode); Document is left empty.
	List(ctx context.Context, limit int, after, ownerUserID string) ([]TemplateRow, string, error)
	UpdateDocument(
		ctx context.Context,
		id string,
		schemaVersion int,
		doc []byte,
		sha string,
		slots json.RawMessage,
		sum DocSummary,
	) error
}

TemplateRepo stores templates.

type TemplateResult

type TemplateResult struct {
	Envelope
	Template TemplateSummary `json:"template"`
	// Deduplicated is true when an import found the same content already stored and created nothing (VV-128).
	Deduplicated bool   `json:"deduplicated,omitempty"`
	Text         string `json:"text"`
}

TemplateResult answers TemplateSave and TemplateImport.

type TemplateRow

type TemplateRow struct {
	ID              string
	Name            string
	Description     string
	SchemaVersion   int
	Document        []byte
	DocSHA256       string
	Slots           json.RawMessage // [{name, kind, required, description}] for listing
	Summary         DocSummary
	SourceProjectID *string
	CreatedMs       int64
	CreatedBy       string
	OwnerUserID     *string // network mode: the user who saved it; nil in local mode
}

TemplateRow is a saved template document.

type TemplateSaveRequest

type TemplateSaveRequest struct {
	ProjectID   string `json:"project_id"`
	TimelineID  string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	DryRun      bool   `json:"dry_run,omitempty"`
}

TemplateSaveRequest makes a template from a project.

type TemplateSummary

type TemplateSummary struct {
	TemplateID  string            `json:"template_id"`
	Name        string            `json:"name"             untrusted:"true"`
	Description string            `json:"description"      untrusted:"true"`
	Slots       []SlotInfo        `json:"slots"`
	Colors      map[string]string `json:"colors,omitempty"`
	Width       int               `json:"width"`
	Height      int               `json:"height"`
	Duration    TimeValue         `json:"duration"`
}

TemplateSummary is a template without its document.

type TextArgs added in v0.34.0

type TextArgs struct {
	ConnectionID string `json:"connection_id"`
	provider.TextRequest
}

TextArgs are the arguments of a text.generate job: the connection, and the request of SDD-016 section 5.

type TextDraftRequest added in v0.36.0

type TextDraftRequest struct {
	ProjectID    string   `json:"project_id"`
	ItemID       string   `json:"item_id"`
	ConnectionID string   `json:"connection_id"`
	Model        string   `json:"model"`
	Instruction  string   `json:"instruction"`
	Network      string   `json:"network,omitempty"` // a caption: draft the variant of this network
	MaxTokens    int      `json:"max_tokens,omitempty"`
	Temperature  *float64 `json:"temperature,omitempty"`
	WaitMS       int      `json:"wait_ms,omitempty"`
	DryRun       bool     `json:"dry_run,omitempty"`
}

TextDraftRequest asks a model for a draft of a text (SDD-019 section 6): the arguments of the job kind text.draft, and the wait and the dry run of JobStart.

type TextGenerateRequest added in v0.34.0

type TextGenerateRequest struct {
	ProjectID    string `json:"project_id"`
	ConnectionID string `json:"connection_id"`
	provider.TextRequest
	WaitMS int  `json:"wait_ms,omitempty"`
	DryRun bool `json:"dry_run,omitempty"`
}

TextGenerateRequest starts a text generation in a project: the arguments of the job kind text.generate (SDD-016 section 6) and the wait and the dry run of JobStart.

type TextGetRequest added in v0.36.0

type TextGetRequest struct {
	ProjectID string `json:"project_id"`
	ItemID    string `json:"item_id"`
	Revision  int    `json:"revision,omitempty"` // default: the latest
}

TextGetRequest reads a text, or one of its revisions.

type TextGetResult added in v0.36.0

type TextGetResult struct {
	Envelope
	ProjectID string       `json:"project_id"`
	Item      TextItem     `json:"item"`
	Revision  TextRevision `json:"revision"`
	// Body is the Markdown of the revision: untrusted text, a model may have written it.
	Body string `json:"body" untrusted:"true"`
	Text string `json:"text"`
}

TextGetResult is a text with its body.

type TextHead added in v0.36.0

type TextHead struct {
	Item         ItemRow
	ProjectName  string
	Revision     int
	RevisionBy   string
	RevisionSrc  string
	ProjectOwner *string
}

TextHead is a text item with the project it is in and the facts of its latest revision.

type TextItem added in v0.36.0

type TextItem struct {
	ID          string `json:"id"`
	ProjectID   string `json:"project_id"`
	ProjectName string `json:"project_name,omitempty" untrusted:"true"`
	Title       string `json:"title"                  untrusted:"true"`
	TextKind    string `json:"text_kind"` // "script" | "copy" | "caption"
	State       string `json:"state"`     // "active" | "trashed"
	Words       int    `json:"words"`
	// ReadingMinutes is the minutes to read the text, from writing.ReadingMinutes (SDD-005 section 5.12.4).
	ReadingMinutes int       `json:"reading_minutes"`
	Revision       int       `json:"revision"` // the latest revision
	UpdatedBy      string    `json:"updated_by,omitempty"`
	UpdatedAt      time.Time `json:"updated_at"`
}

TextItem is a text of a production without its body.

type TextListRequest added in v0.36.0

type TextListRequest struct {
	ProjectID string `json:"project_id,omitempty"`
	TextKind  string `json:"text_kind,omitempty"` // "script", "copy" or "caption"; default: every kind
	State     string `json:"state,omitempty"`     // "active" (default) or "trashed"
	Cursor    string `json:"cursor,omitempty"`
	Limit     int    `json:"limit,omitempty"` // 1 to 100; default 50
}

TextListRequest lists texts. With no project it lists those of every project the caller may see.

type TextListResult added in v0.36.0

type TextListResult struct {
	Envelope
	// ProjectID echoes the project the list was asked for; empty for a list across projects.
	ProjectID  string     `json:"project_id,omitempty"`
	Texts      []TextItem `json:"texts"`
	NextCursor string     `json:"next_cursor,omitempty"`
	Text       string     `json:"text"`
}

TextListResult is a page of texts, newest first.

type TextQuery added in v0.36.0

type TextQuery struct {
	ProjectID   string // one project; empty for every project the caller may see
	OwnerUserID string // network mode: only this user's projects
	TextKind    string // empty for every kind
	State       ProjectState
	After       string // opaque cursor from the previous page
	Limit       int    // 1 to 100; 0 means 50
}

TextQuery selects a page of text items.

type TextResult added in v0.34.0

type TextResult struct {
	Provider string `json:"provider"`
	Model    string `json:"model"`
	// Text is what the model wrote: untrusted text, delimited wherever a text view shows it to an agent.
	Text         string     `json:"text"          untrusted:"true"`
	FinishReason string     `json:"finish_reason"`
	InputTokens  int        `json:"input_tokens"`
	OutputTokens int        `json:"output_tokens"`
	Cost         core.Money `json:"cost"`
	// ItemID and Revision are set by a text.draft job: the text and the revision the draft was written as.
	ItemID   string `json:"item_id,omitempty"`
	Revision int    `json:"revision,omitempty"`
}

TextResult is the result of a succeeded text.generate job (SDD-016 section 6).

type TextRevertRequest added in v0.36.0

type TextRevertRequest struct {
	ProjectID string `json:"project_id"`
	ItemID    string `json:"item_id"`
	Revision  int    `json:"revision"`
	DryRun    bool   `json:"dry_run,omitempty"`
}

TextRevertRequest brings an older revision back as a new one.

type TextRevision added in v0.36.0

type TextRevision struct {
	Revision   int         `json:"revision"`
	Actor      string      `json:"actor"`
	Source     string      `json:"source"` // "created" | "write" | "generated" | "revert"
	RevertedTo *int        `json:"reverted_to,omitempty"`
	Provider   string      `json:"provider,omitempty"`
	Model      string      `json:"model,omitempty"       untrusted:"true"`
	Cost       *core.Money `json:"cost,omitempty"`
	JobID      string      `json:"job_id,omitempty"`
	CreatedAt  time.Time   `json:"created_at"`
}

TextRevision is one revision of a text, without its body.

type TextRevisionRow added in v0.36.0

type TextRevisionRow struct {
	ItemID     string
	Revision   int
	Body       string // empty in a list
	Actor      string
	Source     string // created, write, generated or revert
	RevertedTo *int
	Provider   string
	Model      string
	CostMicros *int64
	Currency   string
	JobID      string
	CreatedMs  int64
}

TextRevisionRow is a row of text_revisions.

type TextRevisionsRequest added in v0.36.0

type TextRevisionsRequest struct {
	ProjectID string `json:"project_id"`
	ItemID    string `json:"item_id"`
	// Before starts the list under this revision (the next_before of the previous page); 0 starts at the latest.
	Before int `json:"before,omitempty"`
	Limit  int `json:"limit,omitempty"` // 1 to 100; default 50
	// From and To ask for the difference between two revisions at paragraph level; To defaults to the latest.
	From int `json:"from,omitempty"`
	To   int `json:"to,omitempty"`
}

TextRevisionsRequest lists the revisions of a text, and optionally compares two.

type TextRevisionsResult added in v0.36.0

type TextRevisionsResult struct {
	Envelope
	ProjectID  string            `json:"project_id"`
	ItemID     string            `json:"item_id"`
	Revisions  []TextRevision    `json:"revisions"`
	NextBefore int               `json:"next_before,omitempty"`
	Diff       *writing.TextDiff `json:"diff,omitempty"`
	DiffFrom   int               `json:"diff_from,omitempty"`
	DiffTo     int               `json:"diff_to,omitempty"`
	Text       string            `json:"text"`
}

TextRevisionsResult is a page of revisions, newest first, and the difference when asked.

type TextSummary added in v0.52.0

type TextSummary struct {
	ItemID         string `json:"item_id"`
	TextKind       string `json:"text_kind"`
	Words          int    `json:"words"`
	ReadingMinutes int    `json:"reading_minutes"`                  // the words divided by 200, rounded up
	Excerpt        string `json:"excerpt"         untrusted:"true"` // the first 160 characters, without the front matter of a post
}

TextSummary is what a list of projects says about the text of a project: its kind, its words, how long it takes to read and its first characters (SDD-005 section 5.12.4).

type TextWriteRequest added in v0.36.0

type TextWriteRequest struct {
	ProjectID string `json:"project_id"`
	// ItemID names the text to write; empty makes a new text (Title and TextKind).
	ItemID   string `json:"item_id,omitempty"`
	Title    string `json:"title,omitempty"`     // 1 to 120 characters; needed to make a text
	TextKind string `json:"text_kind,omitempty"` // making a text: script, copy (default), caption or post
	Text     string `json:"text"`                // the Markdown, at most 256 KiB
	// BaseRevision, when set, must be the latest revision of the text: the write is refused when someone wrote
	// after the revision the writer read.
	BaseRevision *int `json:"base_revision,omitempty"`
	DryRun       bool `json:"dry_run,omitempty"`
}

TextWriteRequest makes a text, or saves a new revision of one.

type TextWriteResult added in v0.36.0

type TextWriteResult struct {
	Envelope
	ProjectID string       `json:"project_id"`
	Item      TextItem     `json:"item"`
	Revision  TextRevision `json:"revision"`
	// Created is true when the call made the text; Changed is false when the body was the latest one already and no
	// revision was made.
	Created bool   `json:"created"`
	Changed bool   `json:"changed"`
	Text    string `json:"text"`
}

TextWriteResult is the text after a write, a revert or a draft.

type TimeRange

type TimeRange struct {
	Start TimeValue `json:"start"`
	End   TimeValue `json:"end"`
}

TimeRange is a range of project frames, the end exclusive.

type TimeValue

type TimeValue struct {
	Frame   int64   `json:"frame"`
	Seconds float64 `json:"seconds"` // frame * fps.den / fps.num, rounded to 3 decimals
}

TimeValue is a time in project terms (SDD-002 section A.4).

type TimelineRef added in v0.31.0

type TimelineRef struct {
	ItemID     string
	TimelineID string
	Title      string
}

TimelineRef is an active timeline item of a project.

type ToolFile

type ToolFile struct {
	Name    string `json:"name"`
	Bytes   int64  `json:"bytes"`
	Host    string `json:"host"`
	License string `json:"license,omitempty"`
}

ToolFile is one file of an install, with what it costs.

type ToolOffer added in v0.54.0

type ToolOffer struct {
	Name          string     `json:"name"`
	Files         []ToolFile `json:"files"`
	DownloadBytes int64      `json:"download_bytes"`
	// Dataset is the dataset the model was trained on, whose terms are not the licence of the weights.
	Dataset string `json:"dataset,omitempty"`
	// Published is false while a file of the set has not been built yet: the install is refused.
	Published bool `json:"published"`
	Installed bool `json:"installed"`
}

ToolOffer is an install set the person may choose, with what it costs and its licences, so a prompt shows them before anything is downloaded (SDD-024 section 3 item 2).

type Tools

type Tools struct {
	// Dir is <workspace>/tools.
	Dir string
	// Manifest pins every file, its size and its SHA-256.
	Manifest transcribe.Manifest
	// Client downloads; in the product it is outbound.HelperDownload.
	Client Downloader
	// GOOS and GOARCH select the helper; the runtime's when empty.
	GOOS, GOARCH string
	// OpenH264 pins the Cisco library of the own FFmpeg build; the embedded manifest when it has no
	// entries. Its hosts are not those of Manifest: the client of the install is built over both.
	OpenH264 ffmpeg.OpenH264Manifest
	// Face pins the local AI helper, the ONNX Runtime library and the face model (SDD-024 section 3).
	// The zero value means this build offers no face tracking; its hosts are joined to the client of
	// the install like those of the other manifests.
	Face aihost.Manifest
}

Tools is what the install step needs: the manifest that pins what may be downloaded, the client that does it, and the directory it installs into. The install step is the only code path that downloads (SDD-007 section 6.8); no job, no edit and no read starts it.

func (*Tools) FaceStack added in v0.54.0

func (t *Tools) FaceStack() (p FacePaths, ok bool)

FaceStack returns the verified paths of the helper, the runtime library and the model, or ok false when the set is not installed or a file no longer has its recorded digest (SDD-007 section 6.11 item 2). It never downloads anything.

type ToolsInstallRequest

type ToolsInstallRequest struct {
	Name  string `json:"name"`
	Model string `json:"model,omitempty"`
	// Force downloads again what is installed and verified.
	Force bool `json:"force,omitempty"`
}

ToolsInstallRequest names what to install.

type ToolsInstallResult

type ToolsInstallResult struct {
	State         string     `json:"state"` // "running", or "installed" when nothing had to be downloaded
	Files         []ToolFile `json:"files"`
	DownloadBytes int64      `json:"download_bytes"`
	Text          string     `json:"text"`
}

ToolsInstallResult is the answer of the install call: it announces the size and the source before the first byte arrives.

type ToolsInstaller

type ToolsInstaller interface {
	ToolsInstall(ctx context.Context, req ToolsInstallRequest) (*ToolsInstallResult, error)
	ToolsStatus(ctx context.Context, req ToolsStatusRequest) (*ToolsStatusResult, error)
}

ToolsInstaller is the install step alone, over a directory of tools and no store. The CLI uses it to install while a server owns the workspace: the process that runs the command is the person at the terminal, and the server finds the files on its next read of tools/installed.json (SDD-007 section 6.8). The server itself still refuses the local token and the agent surfaces.

func NewToolsInstaller

func NewToolsInstaller(t *Tools) ToolsInstaller

NewToolsInstaller returns the install step over t.

type ToolsStatusRequest

type ToolsStatusRequest struct{}

ToolsStatusRequest has no members.

type ToolsStatusResult

type ToolsStatusResult struct {
	Installed []InstalledTool `json:"installed"`
	// Offers are the install sets besides the transcription helper, with their size and licences.
	Offers []ToolOffer `json:"offers"`
	State  string      `json:"state"` // "idle", "running" or "failed"
	Done   int64       `json:"done_bytes"`
	Total  int64       `json:"total_bytes"`
	Error  *Error      `json:"error,omitempty"`
	Text   string      `json:"text"`
}

ToolsStatusResult is what is installed and how a running install is going.

type TranscribeArgs

type TranscribeArgs struct {
	AssetID  string `json:"asset_id"`
	Language string `json:"language,omitempty"` // BCP 47 code or "auto"; default "auto"
	// Model is the name of an installed whisper model (tiny, base, small, large-v3-turbo); empty is the
	// workspace default. Only a name, never a path (VV-007).
	Model string `json:"model,omitempty"`
}

TranscribeArgs are the arguments of JobStart for a transcription.

type TranscribeResult

type TranscribeResult struct {
	AssetID  string `json:"asset_id"`
	Language string `json:"language"`
	Words    int    `json:"words"`
}

TranscribeResult is the result of a finished transcription job.

type TranscriptDetectRequest added in v0.50.0

type TranscriptDetectRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"`
	AssetID    string `json:"asset_id"`
	// RepeatWindowMS is the longest gap between the two copies of a repetition; 0 is the default, 700.
	RepeatWindowMS int64 `json:"repeat_window_ms,omitempty"`
}

TranscriptDetectRequest asks for the filler words and repetitions of an asset.

type TranscriptDetectResult added in v0.50.0

type TranscriptDetectResult struct {
	UntrustedNotice string                 `json:"untrusted_notice,omitempty"`
	ProjectID       string                 `json:"project_id"`
	Revision        int64                  `json:"revision"`
	AssetID         string                 `json:"asset_id"`
	Language        string                 `json:"language"`
	Suggestions     []TranscriptSuggestion `json:"suggestions"`
	// Rule says what was checked, so that an empty list is not read as "no fillers": the language the rules
	// know, or that only repetitions were checked.
	Rule string `json:"rule"`
	// FillerRules says whether the language has a list of filler words, so that a UI can say what was checked in
	// the language of the person.
	FillerRules bool   `json:"filler_rules"`
	Text        string `json:"text"`
}

TranscriptDetectResult is the list of suggestions at one revision. The revision does not change by asking.

func (*TranscriptDetectResult) ForAgent added in v0.50.0

ForAgent is the list of suggestions for a surface an agent reads, as TranscriptViewResult.ForAgent.

type TranscriptLine

type TranscriptLine struct {
	StartMS int64  `json:"start_ms"`
	EndMS   int64  `json:"end_ms"`
	Text    string `json:"text"     untrusted:"true"`
}

TranscriptLine is one line of the transcript of an asset: a segment of words with the time it starts at. Its text is from the media, so it is untrusted.

type TranscriptSuggestion added in v0.50.0

type TranscriptSuggestion struct {
	Kind     string `json:"kind"`
	Strength string `json:"strength"`
	FromWord int    `json:"from_word"`
	ToWord   int    `json:"to_word"`
	Text     string `json:"text"      untrusted:"true"`
	StartMS  int64  `json:"start_ms"`
	EndMS    int64  `json:"end_ms"`
}

TranscriptSuggestion is a range of words a person may remove. Nothing is removed by asking for it.

type TranscriptViewRequest added in v0.50.0

type TranscriptViewRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	AssetID    string `json:"asset_id"`
}

TranscriptViewRequest asks for the words of an asset with the timeline range of each.

type TranscriptViewResult added in v0.50.0

type TranscriptViewResult struct {
	UntrustedNotice string           `json:"untrusted_notice,omitempty"`
	ProjectID       string           `json:"project_id"`
	Revision        int64            `json:"revision"`
	AssetID         string           `json:"asset_id"`
	Language        string           `json:"language"`
	Words           []TranscriptWord `json:"words"`
	// SkippedItems show the asset but play it with a speed curve or backwards, so no word is placed on them.
	SkippedItems []string `json:"skipped_items"`
	Text         string   `json:"text"`
}

TranscriptViewResult is the transcript as the timeline shows it at one revision.

func (*TranscriptViewResult) ForAgent added in v0.50.0

ForAgent is the view for a surface an agent reads (the CLI): the text of each word is escaped and capped, and the text of the result lists the words inside an untrusted block, each with the index transcript.delete_range names.

type TranscriptWord added in v0.50.0

type TranscriptWord struct {
	Index  int                `json:"index"`
	Text   string             `json:"text"   untrusted:"true"`
	Start  int                `json:"start"`
	End    int                `json:"end"`
	Ranges []transcript.Range `json:"ranges"`
}

TranscriptWord is a word of the transcript with where the timeline shows it. Start and End are frames of the asset, the ranges frames of the timeline; a word with no range was cut or lies outside every item.

type TrashEmptyRequest

type TrashEmptyRequest struct {
	ProjectID     string `json:"project_id,omitempty"`
	OlderThanDays int    `json:"older_than_days,omitempty"`
}

TrashEmptyRequest limits what is emptied: one trashed project, and/or only what has been in the trash for that many days.

type TrashEmptyResult

type TrashEmptyResult struct {
	Projects      int    `json:"projects"`
	ProjectAssets int    `json:"project_assets"`
	Assets        int    `json:"assets"`
	BytesFreed    int64  `json:"bytes_freed"`
	Text          string `json:"text"`
}

TrashEmptyResult counts what was deleted.

type Tx

type Tx interface {
	Repos
	AfterCommit(fn func())
}

Tx is a write transaction.

type UndoRequest

type UndoRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	DryRun     bool   `json:"dry_run,omitempty"`
}

UndoRequest undoes or redoes one step.

type UndoResult

type UndoResult struct {
	EditResult
	Kind    string      `json:"kind"` // "undo" | "redo"
	Undone  *HistoryRef `json:"undone,omitempty"`
	Redone  *HistoryRef `json:"redone,omitempty"`
	Skipped []SkippedOp `json:"skipped"`
}

UndoResult is an EditResult plus the step undone or redone and what was skipped.

type UntrustedData

type UntrustedData struct {
	Name     string            `json:"name"               untrusted:"true"`
	Metadata map[string]string `json:"metadata,omitempty" untrusted:"true"`
	// Transcript is one page of the transcript, when the section was asked for.
	Transcript []TranscriptLine `json:"transcript,omitempty"`
	// Words and Suggestions answer the sections words and fillers: the text of a word comes from the media, so
	// the words and the suggestions are here and the summaries in the result carry none.
	Words       []TranscriptWord       `json:"words,omitempty"`
	Suggestions []TranscriptSuggestion `json:"suggestions,omitempty"`
}

UntrustedData holds every string that came from the file (ADR-0020 item 5).

type VerifyCheck

type VerifyCheck struct {
	Name   string `json:"name"` // streams, duration, dimensions, pixel_format, faststart
	OK     bool   `json:"ok"`
	Detail string `json:"detail"`
}

VerifyCheck is one check of the verification of an export (ADR-0018 item 6).

type VideoArgs added in v0.38.0

type VideoArgs struct {
	ConnectionID string `json:"connection_id"`
	provider.VideoRequest
}

VideoArgs are the arguments of a video.generate job: the connection, and the request of SDD-016 section 5.4.

type VideoGenerateRequest added in v0.38.0

type VideoGenerateRequest struct {
	ProjectID    string `json:"project_id"`
	ConnectionID string `json:"connection_id"`
	provider.VideoRequest
	WaitMS int  `json:"wait_ms,omitempty"`
	DryRun bool `json:"dry_run,omitempty"`
}

VideoGenerateRequest starts a video generation in a project: the arguments of the job kind video.generate (SDD-016 section 6.4) and the wait and the dry run of JobStart.

type ViewCell

type ViewCell struct {
	Index int       `json:"index"`
	At    TimeValue `json:"at"`
}

ViewCell is one picture of a view: the index is 1-based, row-major.

type ViewFrameRequest

type ViewFrameRequest struct {
	ProjectID  string `json:"project_id"`
	TimelineID string `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	At         string `json:"at"`                    // a time; required
	MaxTokens  int    `json:"max_tokens,omitempty"`  // default 800; 100 to 1568
	Width      int    `json:"width,omitempty"`       // even; exclusive with MaxTokens
	// Pin, when not 0, must be the current revision (SDD-003 section 6.3). Set
	// by the HTTP adapter from rev; never on the wire of the Service.
	Pin int64 `json:"-"`
}

ViewFrameRequest asks for one frame of the current revision. There is no revision member: only the current revision is rendered.

type ViewResult

type ViewResult struct {
	ProjectID   string     `json:"project_id"`
	Revision    int64      `json:"revision"`
	Mode        string     `json:"mode"` // "frame" | "sheet"
	Width       int        `json:"width"`
	Height      int        `json:"height"`
	ImageTokens int        `json:"image_tokens"`
	MIME        string     `json:"mime"`
	Cells       []ViewCell `json:"cells"`
	// Path is the cached file on the machine of the server; a local caller only.
	Path  string `json:"path,omitempty"`
	Image []byte `json:"image_base64,omitempty" bulk:"true"`
	// Composite says the picture depends on timelines other than ProjectID (compositions): a request pinned to
	// the revision of the project is then not immutable, because those can change without it.
	Composite bool   `json:"-"`
	Text      string `json:"text"`
}

ViewResult is an image and what it shows.

type ViewSheetRequest

type ViewSheetRequest struct {
	ProjectID  string   `json:"project_id"`
	TimelineID string   `json:"timeline_id,omitempty"` // SDD-003 section 1.7
	Times      []string `json:"times,omitempty"`       // 2 to 16; exclusive with From, Until and Count
	From       string   `json:"from,omitempty"`        // default "0s"
	Until      string   `json:"until,omitempty"`       // inclusive; default the last frame
	Count      int      `json:"count,omitempty"`       // default 9; 2 to 16
	Cols       int      `json:"cols,omitempty"`        // default ceil(sqrt(count))
	MaxTokens  int      `json:"max_tokens,omitempty"`  // default 1500; 100 to 1568
	// Pin, when not 0, must be the current revision (SDD-003 section 6.3). Set
	// by the HTTP adapter from rev; never on the wire of the Service.
	Pin int64 `json:"-"`
}

ViewSheetRequest asks for a contact sheet of the current revision.

type VoiceArgs added in v0.36.0

type VoiceArgs struct {
	ConnectionID string `json:"connection_id"`
	provider.VoiceRequest
}

VoiceArgs are the arguments of a voice.generate job: the connection, and the request of SDD-016 section 5.2.

type VoiceGenerateRequest added in v0.36.0

type VoiceGenerateRequest struct {
	ProjectID    string `json:"project_id"`
	ConnectionID string `json:"connection_id"`
	provider.VoiceRequest
	WaitMS int  `json:"wait_ms,omitempty"`
	DryRun bool `json:"dry_run,omitempty"`
}

VoiceGenerateRequest starts a speech generation in a project: the arguments of the job kind voice.generate.

type VoiceListRequest added in v0.36.0

type VoiceListRequest struct {
	ConnectionID string `json:"connection_id"`
}

VoiceListRequest reads the voices of one connection.

type VoiceListResult added in v0.36.0

type VoiceListResult struct {
	ConnectionID string      `json:"connection_id"`
	Provider     string      `json:"provider"`
	Voices       []VoiceView `json:"voices"`
}

VoiceListResult is the voices of a connection.

type VoiceView added in v0.36.0

type VoiceView struct {
	ID       string `json:"id"`
	Name     string `json:"name"               untrusted:"true"`
	Language string `json:"language,omitempty"`
	// Source is provider for a list the provider answered and documented for one its documentation gives.
	Source string `json:"source"`
}

VoiceView is a voice of a provider.

type Webhook added in v0.47.0

type Webhook struct {
	ID           string               `json:"id"`
	Name         string               `json:"name"          untrusted:"true"`
	URL          string               `json:"url"`
	Events       []string             `json:"events"`
	Enabled      bool                 `json:"enabled"`
	SecretSet    bool                 `json:"secret_set"`
	CreatedAt    time.Time            `json:"created_at"`
	UpdatedAt    time.Time            `json:"updated_at"`
	LastDelivery *WebhookLastDelivery `json:"last_delivery"`
}

Webhook is a webhook as a surface sees it (SDD-022 section 2). It never carries the signing secret.

type WebhookCreateRequest added in v0.47.0

type WebhookCreateRequest struct {
	Name    string   `json:"name"`
	URL     string   `json:"url"`
	Events  []string `json:"events"`
	Enabled *bool    `json:"enabled,omitempty"`
}

WebhookCreateRequest is SDD-022 section 6. Enabled defaults to true.

type WebhookDeliveriesRequest added in v0.47.0

type WebhookDeliveriesRequest struct {
	ID     string `json:"id"`
	Limit  int    `json:"limit,omitempty"`
	Offset int    `json:"offset,omitempty"`
}

WebhookDeliveriesRequest lists the deliveries of a webhook, newest first. Limit is 1 to 100, default 50.

type WebhookDeliveriesResult added in v0.47.0

type WebhookDeliveriesResult struct {
	Deliveries []WebhookDelivery `json:"deliveries"`
}

WebhookDeliveriesResult is a page of deliveries.

type WebhookDelivery added in v0.47.0

type WebhookDelivery struct {
	webhooks.Delivery

	At         time.Time          `json:"at"`
	AttemptLog []webhooks.Attempt `json:"attempt_log"`
}

WebhookDelivery is a delivery with the record of its attempts. It never carries the body of an answer.

type WebhookEventListRequest added in v0.47.0

type WebhookEventListRequest struct{}

WebhookEventListRequest has no member.

type WebhookEventListResult added in v0.47.0

type WebhookEventListResult struct {
	Events []core.EventInfo `json:"events"`
}

WebhookEventListResult is the events a webhook may choose, each with the sentence that explains it.

type WebhookLastDelivery added in v0.47.0

type WebhookLastDelivery struct {
	ID     string    `json:"id"`
	State  string    `json:"state"`
	Status int       `json:"status"`
	At     time.Time `json:"at"`
}

WebhookLastDelivery is the newest delivery of a webhook.

type WebhookListRequest added in v0.47.0

type WebhookListRequest struct{}

WebhookListRequest has no member.

type WebhookListResult added in v0.47.0

type WebhookListResult struct {
	Webhooks []Webhook `json:"webhooks"`
}

WebhookListResult is every webhook, oldest first.

type WebhookRedeliverRequest added in v0.47.0

type WebhookRedeliverRequest struct {
	ID         string `json:"id"`
	DeliveryID string `json:"delivery_id"`
}

WebhookRedeliverRequest names the delivery to send again.

type WebhookRef added in v0.47.0

type WebhookRef struct {
	ID string `json:"id"`
}

WebhookRef names a webhook.

type WebhookSecretResult added in v0.47.0

type WebhookSecretResult struct {
	Webhook
	Secret string `json:"secret"`
}

WebhookSecretResult is a webhook with its signing secret, in the answer of the creation and of the rotation and in no other: the person keeps it, and the product cannot show it again (ADR-0033).

type WebhookUpdateRequest added in v0.47.0

type WebhookUpdateRequest struct {
	ID      string    `json:"id"`
	Name    *string   `json:"name,omitempty"`
	URL     *string   `json:"url,omitempty"`
	Events  *[]string `json:"events,omitempty"`
	Enabled *bool     `json:"enabled,omitempty"`
}

WebhookUpdateRequest changes the members that are set.

type WritingService added in v0.36.0

type WritingService interface {
	TextList(ctx context.Context, req TextListRequest) (*TextListResult, error)
	TextGet(ctx context.Context, req TextGetRequest) (*TextGetResult, error)
	TextWrite(ctx context.Context, req TextWriteRequest) (*TextWriteResult, error)
	TextRevisions(ctx context.Context, req TextRevisionsRequest) (*TextRevisionsResult, error)
	TextRevert(ctx context.Context, req TextRevertRequest) (*TextWriteResult, error)
	TextDraft(ctx context.Context, req TextDraftRequest) (*Job, error)
	CaptionValidate(ctx context.Context, req CaptionValidateRequest) (*CaptionValidateResult, error)
	ScriptEstimate(ctx context.Context, req ScriptEstimateRequest) (*ScriptEstimateResult, error)
}

WritingService is the part of the service that works on the texts of a production (SDD-019): the scripts, the copy and the captions, their revisions, the checks against a network and the draft made with a model. Service embeds it.

Source Files

Directories

Path Synopsis
Package account is the local account of a workspace (ADR-0052, SDD-007 section 3.9): the Argon2id key derivation, the data key and its two wrappings, the recovery key, the sealing of the fields of the store, and the Manager that holds the data key in memory while a person is signed in.
Package account is the local account of a workspace (ADR-0052, SDD-007 section 3.9): the Argon2id key derivation, the data key and its two wrappings, the recovery key, the sealing of the fields of the store, and the Manager that holds the data key in memory while a person is signed in.
Package agenthost starts the agent a user installed, speaks the Agent Client Protocol to it over its standard streams, and turns what it says into the events of a chat transcript (ADR-0037, SDD-017).
Package agenthost starts the agent a user installed, speaks the Agent Client Protocol to it over its standard streams, and turns what it says into the events of a chat transcript (ADR-0037, SDD-017).
Package approval is the approval queue of the service (ADR-0032 items 3 to 5, SDD-015): the records of the requests, the rules and the ceilings, the ledger of costs, the check of who may decide, and the evaluation that gathers what the pure rules of core/approval need.
Package approval is the approval queue of the service (ADR-0032 items 3 to 5, SDD-015): the records of the requests, the rules and the ceilings, the ledger of costs, the check of who may decide, and the evaluation that gathers what the pure rules of core/approval need.
Package assets is the asset library over the files of the workspace (SDD-011 section 14): the entry of a file with its origin, tags and uses, the filters and the full-text search, and the writes of the library side of an asset.
Package assets is the asset library over the files of the workspace (SDD-011 section 14): the entry of a file with its origin, tags and uses, the filters and the full-text search, and the writes of the library side of an asset.
Package config is the boot-time validation of the configuration (SDD-007 section 4.5): the one function that decides whether the process may start, and the facts the adapters need from it (the mode, the address, the public origin).
Package config is the boot-time validation of the configuration (SDD-007 section 4.5): the one function that decides whether the process may start, and the facts the adapters need from it (the mode, the address, the public origin).
Package connections is the registry of the destinations the user connected (ADR-0032, SDD-014): the record, its validation, the vault entry that holds its credential and the connector kinds that use it.
Package connections is the registry of the destinations the user connected (ADR-0032, SDD-014): the record, its validation, the vault entry that holds its credential and the connector kinds that use it.
connectionstest
Package connectionstest is a connection with a credential, for the tests of the packages that use connections (the provider adapters, the connectors of later epics).
Package connectionstest is a connection with a credential, for the tests of the packages that use connections (the provider adapters, the connectors of later epics).
oauth
Package oauth is the generic authorization-code flow with PKCE that a connector signs in with (SDD-020 section 6; epics 12 and 24 reuse it).
Package oauth is the generic authorization-code flow with PKCE that a connector signs in with (SDD-020 section 6; epics 12 and 24 reuse it).
oauth/oauthtest
Package oauthtest is a fake authorization server and provider API on loopback, for the tests of the sign-in flow (epic 12, SDD-016 section 12): it plays the OpenAI authorization and token endpoints, the OpenRouter key exchange and the model and text endpoints of both, checks PKCE, single-use codes and rotating refresh tokens, and records every token it issued so a test can look for one where it must not be.
Package oauthtest is a fake authorization server and provider API on loopback, for the tests of the sign-in flow (epic 12, SDD-016 section 12): it plays the OpenAI authorization and token endpoints, the OpenRouter key exchange and the model and text endpoints of both, checks PKCE, single-use codes and rotating refresh tokens, and records every token it issued so a test can look for one where it must not be.
Package crashpoint marks the places of the commit path where the crash tests kill the process (SDD-005 section 18 check 6).
Package crashpoint marks the places of the commit path where the crash tests kill the process (SDD-005 section 18 check 6).
Package events builds the payloads of the event stream (SDD-006 section 3) and decides what a connecting client is owed (section 4.3).
Package events builds the payloads of the event stream (SDD-006 section 3) and decides what a connecting client is owed (section 4.3).
Package exporter adapts engine/export.Run to service.Exporter: it supplies the pieces the engine needs (runner, capabilities, artifacts folder), reports its progress, and turns the verified result into the output the service checks again before a job may succeed (ADR-0018 item 6).
Package exporter adapts engine/export.Run to service.Exporter: it supplies the pieces the engine needs (runner, capabilities, artifacts folder), reports its progress, and turns the verified result into the output the service checks again before a job may succeed (ADR-0018 item 6).
Package library keeps the memory, the skills and the prompts of a workspace as Markdown files under library/ and an index of them for search (ADR-0040, SDD-018).
Package library keeps the memory, the skills and the prompts of a workspace as Markdown files under library/ and an index of them for search (ADR-0040, SDD-018).
Package logging is the structured log of the product (ADR-0026 item 2): one line per event on standard error and in a rotating file under the workspace `logs/` folder.
Package logging is the structured log of the product (ADR-0026 item 2): one line per event on standard error and in a rotating file under the workspace `logs/` folder.
Package pathguard turns the path a caller names for a media import into an open file handle, or refuses it (SDD-007 section 7.1).
Package pathguard turns the path a caller names for a media import into an open file handle, or refuses it (SDD-007 section 7.1).
Package providers is the AI provider layer (SDD-016, ADR-0036): the interfaces an adapter implements, the registry that finds the adapter of a connection, the catalogue of models read from the provider at run time, and the price table the person edits.
Package providers is the AI provider layer (SDD-016, ADR-0036): the interfaces an adapter implements, the registry that finds the adapter of a connection, the catalogue of models read from the provider at run time, and the price table the person edits.
anthropic
Package anthropic is the adapter of Anthropic for text: the Messages API with an API key (SDD-016 section 2.1).
Package anthropic is the adapter of Anthropic for text: the Messages API with an API key (SDD-016 section 2.1).
google
Package google is the adapter of Google for video, through the Gemini API with the user's own API key (SDD-016 section 2.3).
Package google is the adapter of Google for video, through the Gemini API with the user's own API key (SDD-016 section 2.3).
openai
Package openai is the adapter of OpenAI for text (the Chat Completions API), images and speech, with an API key (SDD-016 sections 2.1 and 2.2).
Package openai is the adapter of OpenAI for text (the Chat Completions API), images and speech, with an API key (SDD-016 sections 2.1 and 2.2).
openrouter
Package openrouter is the adapter of OpenRouter for text: the Chat Completions wire it speaks, with a key the person pasted or one the sign-in of OpenRouter issued (SDD-016 section 12).
Package openrouter is the adapter of OpenRouter for text: the Chat Completions wire it speaks, with a key the person pasted or one the sign-in of OpenRouter issued (SDD-016 section 12).
providertest
Package providertest is the fake provider server of the contract tests of the adapters (NFR-064, SDD-016 section 11): it checks each request an adapter makes against what the documentation of the API says and answers with a recorded response.
Package providertest is the fake provider server of the contract tests of the adapters (NFR-064, SDD-016 section 11): it checks each request an adapter makes against what the documentation of the API says and answers with a recorded response.
wire
Package wire is the part of an adapter that is the same for every provider: one JSON request through the gated client of a connection, a bounded read of the answer, and the mapping of a failure to a providers.Error built from the status and a short code, never from the body (SDD-016 section 9).
Package wire is the part of an adapter that is the same for every provider: one JSON request through the gated client of a connection, a bounded read of the answer, and the mapping of a failure to a providers.Error built from the status and a short code, never from the body (SDD-016 section 9).
Package publish is the calendar of publications and the scheduler that sends an approved post at its time (SDD-020 sections 23 to 29, ADR-0046).
Package publish is the calendar of publications and the scheduler that sends an approved post at its time (SDD-020 sections 23 to 29, ADR-0046).
destinations
Package destinations sends a blog post to where a creator's blog lives: files for a static site, WordPress, a webhook of their own automation, or the read API of Stuarty itself (SDD-020 part 5).
Package destinations sends a blog post to where a creator's blog lives: files for a static site, WordPress, a webhook of their own automation, or the read API of Stuarty itself (SDD-020 part 5).
Package recordings is the storage contract of the screen recordings (SDD-025, SDD-005 section 5.18): the row, and the Store the database implements.
Package recordings is the storage contract of the screen recordings (SDD-025, SDD-005 section 5.18): the row, and the Store the database implements.
Package remote is service.Service over the HTTP API of a running owner (SDD-003 section 5.2, ADR-0008 item 5): the CLI and the stdio MCP server use it when a server owns the workspace or STUARTY_URL is set.
Package remote is service.Service over the HTTP API of a running owner (SDD-003 section 5.2, ADR-0008 item 5): the CLI and the stdio MCP server use it when a server owns the workspace or STUARTY_URL is set.
Package social is the frame every social network connector plugs into (ADR-0035, SDD-020): the Connector interface, its registry, the error a connector returns and the store of upload sessions.
Package social is the frame every social network connector plugs into (ADR-0035, SDD-020): the Connector interface, its registry, the error a connector returns and the store of upload sessions.
facebook
Package facebook is the Facebook connector (SDD-020 part 2): a Reel goes up to a Page the person chose after signing in with their own Meta app, through the three steps of the Reels API (start, upload, finish).
Package facebook is the Facebook connector (SDD-020 part 2): a Reel goes up to a Page the person chose after signing in with their own Meta app, through the three steps of the Reels API (start, upload, finish).
fake
Package fake is a connector for tests (SDD-020 section 5).
Package fake is a connector for tests (SDD-020 section 5).
instagram
Package instagram is the Instagram connector (SDD-020 part 2): a Reel goes up through the resumable upload of the Instagram API with Facebook Login, to a professional account the person chose after signing in with their own Meta app.
Package instagram is the Instagram connector (SDD-020 part 2): a Reel goes up through the resumable upload of the Instagram API with Facebook Login, to a professional account the person chose after signing in with their own Meta app.
meta
Package meta is what the Instagram and the Facebook connectors share (SDD-020 part 2): the sign-in with the user's own Meta app, the account the person chooses, and the client of the Graph API.
Package meta is what the Instagram and the Facebook connectors share (SDD-020 part 2): the sign-in with the user's own Meta app, the account the person chooses, and the client of the Graph API.
meta/metatest
Package metatest replays recorded request and response pairs of the Graph API, for the tests of the Meta connectors.
Package metatest replays recorded request and response pairs of the Graph API, for the tests of the Meta connectors.
socialtest
Package socialtest replays recorded request and response pairs of a network, for the tests of the connectors of X and TikTok (SDD-020 part 4).
Package socialtest replays recorded request and response pairs of a network, for the tests of the connectors of X and TikTok (SDD-020 part 4).
tiktok
Package tiktok is the TikTok connector (SDD-020 part 4): the user's own TikTok developer app signs in with Login Kit, and a video goes to the person's inbox as a draft through the upload endpoint of the Content Posting API, to be finished and published in the TikTok app.
Package tiktok is the TikTok connector (SDD-020 part 4): the user's own TikTok developer app signs in with Login Kit, and a video goes to the person's inbox as a draft through the upload endpoint of the Content Posting API, to be finished and published in the TikTok app.
x
Package x is the X connector (SDD-020 part 4): the user's own X developer app signs in with OAuth 2.0 and PKCE, a video goes up through the chunked media upload, and the post is created with the text and the video.
Package x is the X connector (SDD-020 part 4): the user's own X developer app signs in with OAuth 2.0 and PKCE, a video goes up through the chunked media upload, and the post is created with the text and the video.
youtube
Package youtube is the YouTube connector (SDD-020 section 7): the user's own Google project signs in with the generic flow of service/connections/oauth, and a video goes up through the resumable upload of the YouTube Data API.
Package youtube is the YouTube connector (SDD-020 section 7): the user's own Google project signs in with the generic flow of service/connections/oauth, and a video goes up through the resumable upload of the YouTube Data API.
Package templates embeds the starter templates every workspace starts with (ADR-0022 item 8).
Package templates embeds the starter templates every workspace starts with (ADR-0022 item 8).
Package testproject makes the projects that tests need: a project with a valid context (epic 56 made the description and the goal required) and, when a test edits a timeline, one timeline in it.
Package testproject makes the projects that tests need: a project with a valid context (epic 56 made the description and the goal required) and, when a test edits a timeline, one timeline in it.
Package textview renders the texts of SDD-003 section 3: pure functions of a document, a list or a result, plus the project's frame rate.
Package textview renders the texts of SDD-003 section 3: pure functions of a document, a list or a result, plus the project's frame rate.
Package untrusted is the one place where text that the product did not generate (a transcript, a file name, tags of a container, the text of a project or a template) is cleaned, escaped, cut and delimited before it reaches an agent (SDD-007 section 8, ADR-0020 item 5).
Package untrusted is the one place where text that the product did not generate (a transcript, a file name, tags of a container, the text of a project or a template) is cleaned, escaped, cut and delimited before it reaches an agent (SDD-007 section 8, ADR-0020 item 5).
Package vault is the encrypted file that holds the credentials of the connections (ADR-0033, SDD-014 section 3).
Package vault is the encrypted file that holds the credentials of the connections (ADR-0033, SDD-014 section 3).
Package webhooks is the delivery side of the outbound webhooks (SDD-022): the records, the store they live in, and the dispatcher that turns an event into deliveries and sends them on a bounded worker, with retries and a record of every attempt.
Package webhooks is the delivery side of the outbound webhooks (SDD-022): the records, the store they live in, and the dispatcher that turns an event into deliveries and sends them on a bounded worker, with retries and a record of every attempt.
Package workspace is the data folder every surface shares (ADR-0008, SDD-005 section 6): where it is, the lock that makes one process its owner, runtime.json that advertises the owner, and the local token file that authenticates local clients (SDD-007 section 3).
Package workspace is the data folder every surface shares (ADR-0008, SDD-005 section 6): where it is, the lock that makes one process its owner, runtime.json that advertises the owner, and the local token file that authenticates local clients (SDD-007 section 3).

Jump to

Keyboard shortcuts

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