reporting

package
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package reporting defines the agently-core reporting runtime boundary for canonical compile/fill/print-backed export operations.

Index

Constants

View Source
const (
	DefaultWorkerBatchLimit  = 1
	DefaultStaleRunningAfter = 15 * time.Minute
)
View Source
const Name = "reporting"
View Source
const (
	SourceKindReportSpec = "reportSpec"
)

Variables

View Source
var (
	// ErrNotFound hides artifact/job existence across principals.
	ErrNotFound = errors.New("reporting: not found")
	// ErrJobNotQueued indicates a queued worker claim race or invalid lifecycle
	// transition when a caller tries to start a non-queued export job.
	ErrJobNotQueued = errors.New("reporting: job not queued")
	// ErrAlreadyExists indicates a storage collision on a generated reporting ID.
	ErrAlreadyExists = errors.New("reporting: already exists")
	// ErrConflict indicates an idempotency replay with different immutable
	// run-reference input.
	ErrConflict = errors.New("reporting: conflict")
)

Functions

This section is empty.

Types

type ActiveReportRun added in v0.1.23

type ActiveReportRun struct {
	ReportRunID     string                     `json:"reportRunId"`
	Revision        int64                      `json:"revision"`
	Status          string                     `json:"status"`
	ArtifactRef     string                     `json:"artifactRef"`
	Origin          string                     `json:"origin"`
	BuilderRef      string                     `json:"builderRef,omitempty"`
	PresetID        string                     `json:"presetId,omitempty"`
	SourceKind      string                     `json:"sourceKind,omitempty"`
	SourceID        string                     `json:"sourceId,omitempty"`
	RequestedParams map[string]json.RawMessage `json:"requestedParams"`
	EffectiveParams map[string]json.RawMessage `json:"effectiveParams"`
	CompletedAt     string                     `json:"completedAt"`
}

ActiveReportRun is the sanitized model-facing view of a durable report run. It deliberately omits owner identity and all materialized report snapshots.

type ActiveReportRunResolver added in v0.1.23

type ActiveReportRunResolver interface {
	GetContext(ctx context.Context, conversationID string) (*reportcontext.Record, error)
	GetRun(ctx context.Context, reportRunID, conversationID string) (*reportrun.Record, error)
}

ActiveReportRunResolver is the narrow, read-only reportingrun.Service surface used by the model-facing active-run resolver.

type Artifact

type Artifact struct {
	ArtifactID   string        `json:"artifactId,omitempty"`
	JobID        string        `json:"jobId,omitempty"`
	ArtifactRef  string        `json:"artifactRef,omitempty"`
	OwnerID      string        `json:"ownerId,omitempty"`
	Format       ExportFormat  `json:"format,omitempty"`
	ContentType  string        `json:"contentType,omitempty"`
	SourceURL    string        `json:"sourceURL,omitempty"`
	Data         []byte        `json:"data,omitempty"`
	CreatedAt    time.Time     `json:"createdAt,omitempty"`
	RetentionTTL time.Duration `json:"retentionTtl,omitempty"`
}

Artifact is the downloadable export payload persisted by agently-core.

func (*Artifact) GetOwnerID

func (a *Artifact) GetOwnerID() string

type AuditEvent

type AuditEvent struct {
	EventType   string                 `json:"eventType,omitempty"`
	ArtifactRef string                 `json:"artifactRef,omitempty"`
	Version     int                    `json:"version,omitempty"`
	JobID       string                 `json:"jobId,omitempty"`
	ArtifactID  string                 `json:"artifactId,omitempty"`
	ActorID     string                 `json:"actorId,omitempty"`
	ActorRef    string                 `json:"actorRef,omitempty"`
	OccurredAt  time.Time              `json:"occurredAt,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

AuditEvent is the generic reporting audit payload emitted by the service.

type AuditSink

type AuditSink interface {
	Record(ctx context.Context, event *AuditEvent) error
}

AuditSink records reporting lifecycle events.

type CompileAndExportFencedReportRequest added in v0.1.22

type CompileAndExportFencedReportRequest struct {
	Content        string              `json:"content,omitempty"`
	Fences         []FencedReportFence `json:"fences,omitempty"`
	ReportID       string              `json:"reportId,omitempty"`
	Format         ExportFormat        `json:"format,omitempty"`
	ConversationID string              `json:"conversationId,omitempty"`
	WorkspaceID    string              `json:"workspaceId,omitempty"`
}

CompileAndExportFencedReportRequest carries progressive Forge fences through backend compilation and synchronous export without requiring a caller to copy the potentially large canonical export envelope between tool calls.

type CompileAndExportFencedReportResult added in v0.1.22

type CompileAndExportFencedReportResult struct {
	ReportID    string       `json:"reportId,omitempty"`
	Job         *ExportJob   `json:"job,omitempty"`
	Artifact    *Artifact    `json:"artifact,omitempty"`
	Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
}

CompileAndExportFencedReportResult is deliberately compact so MCP callers do not receive the compiled ReportSpec, ReportFill, ReportPrint, or artifact bytes in the tool result.

type CompileAndExportForgeUIRequest added in v0.1.30

type CompileAndExportForgeUIRequest struct {
	ViewRef             string                     `json:"viewRef,omitempty"`
	UI                  json.RawMessage            `json:"ui,omitempty"`
	DataSourceRefs      []string                   `json:"dataSourceRefs,omitempty"`
	DataSourceOverrides map[string]json.RawMessage `json:"dataSourceOverrides,omitempty"`
	ReportID            string                     `json:"reportId,omitempty"`
	Title               string                     `json:"title,omitempty"`
	Format              ExportFormat               `json:"format,omitempty"`
	ConversationID      string                     `json:"conversationId,omitempty"`
	WorkspaceID         string                     `json:"workspaceId,omitempty"`
	Target              ForgeTargetContext         `json:"target,omitempty"`
}

type CompileAndExportForgeUIResult added in v0.1.30

type CompileAndExportForgeUIResult = CompileAndExportFencedReportResult

type CompileFencedReportRequest added in v0.1.22

type CompileFencedReportRequest struct {
	Content  string              `json:"content,omitempty"`
	Fences   []FencedReportFence `json:"fences,omitempty"`
	ReportID string              `json:"reportId,omitempty"`
	Format   ExportFormat        `json:"format,omitempty"`
}

type CompileFencedReportResult added in v0.1.22

type CompileFencedReportResult struct {
	ReportID            string               `json:"reportId,omitempty"`
	ReportDocument      json.RawMessage      `json:"reportDocument,omitempty"`
	ReportSpec          json.RawMessage      `json:"reportSpec,omitempty"`
	ReportFill          json.RawMessage      `json:"reportFill,omitempty"`
	ReportPrint         json.RawMessage      `json:"reportPrint,omitempty"`
	ReportExportRequest *ReportExportRequest `json:"reportExportRequest,omitempty"`
	Diagnostics         []Diagnostic         `json:"diagnostics,omitempty"`
}

type CompileRequest

type CompileRequest struct {
	ArtifactRef string          `json:"artifactRef,omitempty"`
	SourceKind  string          `json:"sourceKind,omitempty"`
	Document    json.RawMessage `json:"document,omitempty"`
}

CompileRequest carries an authored artifact into the backend compile seam.

type CompileResult

type CompileResult struct {
	ArtifactRef string          `json:"artifactRef,omitempty"`
	ReportSpec  json.RawMessage `json:"reportSpec,omitempty"`
	Diagnostics []Diagnostic    `json:"diagnostics,omitempty"`
	CompiledAt  time.Time       `json:"compiledAt,omitempty"`
}

CompileResult is the canonical compile response.

type Compiler

type Compiler interface {
	Compile(ctx context.Context, request *CompileRequest) (*CompileResult, error)
}

Compiler lowers authored artifacts into canonical ReportSpec payloads.

type CompleteExportRequest

type CompleteExportRequest struct {
	JobID        string        `json:"jobId,omitempty"`
	ContentType  string        `json:"contentType,omitempty"`
	Data         []byte        `json:"data,omitempty"`
	Diagnostics  []Diagnostic  `json:"diagnostics,omitempty"`
	RetentionTTL time.Duration `json:"retentionTtl,omitempty"`
}

CompleteExportRequest records a successful export artifact.

type DeleteReportRequest added in v0.1.23

type DeleteReportRequest struct {
	ArtifactID  string `json:"artifactId,omitempty"`
	ArtifactRef string `json:"artifactRef,omitempty"`
	ReportID    string `json:"reportId,omitempty"`
}

type DeleteReportResult added in v0.1.23

type DeleteReportResult struct {
	ArtifactID string `json:"artifactId,omitempty"`
	ReportID   string `json:"reportId,omitempty"`
	Deleted    bool   `json:"deleted"`
}

type Diagnostic

type Diagnostic struct {
	Code         string `json:"code,omitempty"`
	Severity     string `json:"severity,omitempty"`
	Path         string `json:"path,omitempty"`
	Message      string `json:"message,omitempty"`
	SuggestedFix string `json:"suggestedFix,omitempty"`
	// Cause contains the underlying operational error when a diagnostic is
	// produced from a failed integration step. It is intentionally optional so
	// existing diagnostics remain compact and do not expose implementation
	// details unless the producer explicitly opts in.
	Cause string `json:"cause,omitempty"`
}

Diagnostic is the structured backend diagnostic shape used across compile and export operations.

type DuplicateReportRequest added in v0.1.23

type DuplicateReportRequest struct {
	ArtifactID  string `json:"artifactId,omitempty"`
	ArtifactRef string `json:"artifactRef,omitempty"`
	ReportID    string `json:"reportId,omitempty"`
	Title       string `json:"title,omitempty"`
}

type ExportFormat

type ExportFormat string

ExportFormat identifies the requested artifact type.

const (
	ExportFormatPDF  ExportFormat = "pdf"
	ExportFormatCSV  ExportFormat = "csv"
	ExportFormatXLSX ExportFormat = "xlsx"
)

type ExportJob

type ExportJob struct {
	JobID             string          `json:"jobId,omitempty"`
	ArtifactRef       string          `json:"artifactRef,omitempty"`
	OwnerID           string          `json:"ownerId,omitempty"`
	ConversationID    string          `json:"conversationId,omitempty"`
	WorkspaceID       string          `json:"workspaceId,omitempty"`
	AuthContextRef    string          `json:"authContextRef,omitempty"`
	Format            ExportFormat    `json:"format,omitempty"`
	Scope             ExportScope     `json:"scope,omitempty"`
	Status            JobStatus       `json:"status,omitempty"`
	ReportRunID       string          `json:"reportRunId,omitempty"`
	ReportRunRevision int64           `json:"-"`
	ExportRequestID   string          `json:"-"`
	ReportSpec        json.RawMessage `json:"reportSpec,omitempty"`
	ReportFill        json.RawMessage `json:"reportFill,omitempty"`
	ReportPrint       json.RawMessage `json:"reportPrint,omitempty"`
	Metadata          json.RawMessage `json:"metadata,omitempty"`
	ArtifactID        string          `json:"artifactId,omitempty"`
	Error             string          `json:"error,omitempty"`
	Diagnostics       []Diagnostic    `json:"diagnostics,omitempty"`
	SubmittedAt       time.Time       `json:"submittedAt,omitempty"`
	StartedAt         *time.Time      `json:"startedAt,omitempty"`
	CompletedAt       *time.Time      `json:"completedAt,omitempty"`
	RetentionTTL      time.Duration   `json:"retentionTtl,omitempty"`
}

ExportJob is the persisted async export job state.

func (*ExportJob) GetOwnerID

func (j *ExportJob) GetOwnerID() string

type ExportJobStatus added in v0.1.23

type ExportJobStatus struct {
	JobID          string        `json:"jobId,omitempty"`
	ArtifactRef    string        `json:"artifactRef,omitempty"`
	OwnerID        string        `json:"ownerId,omitempty"`
	ConversationID string        `json:"conversationId,omitempty"`
	WorkspaceID    string        `json:"workspaceId,omitempty"`
	ReportRunID    string        `json:"reportRunId,omitempty"`
	Format         ExportFormat  `json:"format,omitempty"`
	Scope          ExportScope   `json:"scope,omitempty"`
	Status         JobStatus     `json:"status,omitempty"`
	ArtifactID     string        `json:"artifactId,omitempty"`
	Error          string        `json:"error,omitempty"`
	Diagnostics    []Diagnostic  `json:"diagnostics,omitempty"`
	SubmittedAt    time.Time     `json:"submittedAt,omitempty"`
	StartedAt      *time.Time    `json:"startedAt,omitempty"`
	CompletedAt    *time.Time    `json:"completedAt,omitempty"`
	RetentionTTL   time.Duration `json:"retentionTtl,omitempty"`
}

ExportJobStatus is the compact public lifecycle view of an export job.

type ExportScope

type ExportScope string

ExportScope identifies the export source lifecycle.

const (
	ExportScopeDraft             ExportScope = "draft"
	ExportScopeSavedPayload      ExportScope = "saved_payload"
	ExportScopeSavedView         ExportScope = "saved_view"
	ExportScopePublishedSnapshot ExportScope = "published_snapshot"
)

type ExportSource added in v0.1.17

type ExportSource struct {
	Kind        string          `json:"kind,omitempty"`
	ArtifactID  string          `json:"artifactId,omitempty"`
	ArtifactRef string          `json:"artifactRef,omitempty"`
	ReportID    string          `json:"reportId,omitempty"`
	WindowKey   string          `json:"windowKey,omitempty"`
	PresetID    string          `json:"presetId,omitempty"`
	ReportSpec  json.RawMessage `json:"reportSpec,omitempty"`
	ReportFill  json.RawMessage `json:"reportFill,omitempty"`
	ReportPrint json.RawMessage `json:"reportPrint,omitempty"`
	Metadata    json.RawMessage `json:"metadata,omitempty"`
}

type Exporter

type Exporter interface {
	Export(ctx context.Context, request *RenderRequest) (*RenderResult, error)
}

Exporter turns canonical report artifacts into a persisted downloadable artifact without re-interpreting authoring semantics.

func NewForgeCSVExporter

func NewForgeCSVExporter() Exporter

func NewForgeExporter

func NewForgeExporter(options *ForgeExporterOptions) Exporter

func NewForgePDFExporter

func NewForgePDFExporter(options *ForgePDFExporterOptions) Exporter

NewForgePDFExporter constructs a Forge-backed PDF exporter.

func NewForgeXLSXExporter

func NewForgeXLSXExporter() Exporter

type FailExportRequest

type FailExportRequest struct {
	JobID       string       `json:"jobId,omitempty"`
	Error       string       `json:"error,omitempty"`
	Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
}

FailExportRequest records a failed export result.

type FencedReportFence added in v0.1.22

type FencedReportFence struct {
	Kind    string          `json:"kind"`
	Index   int             `json:"index,omitempty"`
	Payload json.RawMessage `json:"payload"`
}

type ForgeCSVExporter

type ForgeCSVExporter struct{}

func (*ForgeCSVExporter) Export

func (e *ForgeCSVExporter) Export(_ context.Context, request *RenderRequest) (*RenderResult, error)

type ForgeExporter

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

func (*ForgeExporter) Export

func (e *ForgeExporter) Export(ctx context.Context, request *RenderRequest) (*RenderResult, error)

type ForgeExporterOptions

type ForgeExporterOptions struct {
	PDF *ForgePDFExporterOptions
}

type ForgePDFExporter

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

ForgePDFExporter renders canonical ReportPrint payloads into deterministic PDF bytes using Forge's Go export engine.

func (*ForgePDFExporter) Export

func (e *ForgePDFExporter) Export(_ context.Context, request *RenderRequest) (*RenderResult, error)

Export renders a canonical ReportPrint payload into PDF bytes.

type ForgePDFExporterOptions

type ForgePDFExporterOptions struct {
	CreationDate time.Time
}

ForgePDFExporterOptions configures the canonical Forge-backed PDF exporter.

type ForgeTargetContext added in v0.1.30

type ForgeTargetContext struct {
	Platform     string   `json:"platform,omitempty"`
	FormFactor   string   `json:"formFactor,omitempty"`
	Surface      string   `json:"surface,omitempty"`
	Capabilities []string `json:"capabilities,omitempty"`
}

type ForgeUIViewResolver added in v0.1.30

type ForgeUIViewResolver interface {
	ResolveForgeUIView(context.Context, string, ForgeTargetContext, []string) (*ResolvedForgeUIView, error)
}

type ForgeXLSXExporter

type ForgeXLSXExporter struct{}

func (*ForgeXLSXExporter) Export

func (e *ForgeXLSXExporter) Export(_ context.Context, request *RenderRequest) (*RenderResult, error)

type GetActiveReportRunInput added in v0.1.23

type GetActiveReportRunInput struct{}

GetActiveReportRunInput is deliberately empty. Owner and conversation identity come exclusively from authenticated and trusted runtime context.

func (*GetActiveReportRunInput) UnmarshalJSON added in v0.1.23

func (*GetActiveReportRunInput) UnmarshalJSON(data []byte) error

UnmarshalJSON rejects every model-supplied field. The local MCP registry skips decoding for its normal empty argument map, while every non-empty map is decoded here and must fail closed.

type GetArtifactInput

type GetArtifactInput struct {
	ArtifactID  string `json:"artifactId,omitempty"`
	IncludeData bool   `json:"includeData,omitempty"`
}

type GetExportStatusInput

type GetExportStatusInput struct {
	JobID string `json:"jobId,omitempty"`
}

type GetReportInput added in v0.1.15

type GetReportInput struct {
	ArtifactID  string `json:"artifactId,omitempty"`
	ArtifactRef string `json:"artifactRef,omitempty"`
	ReportID    string `json:"reportId,omitempty"`
}

type GetSharedArtifactInput

type GetSharedArtifactInput struct {
	ArtifactID string `json:"artifactId,omitempty"`
}

type JobStatus

type JobStatus string

JobStatus identifies the async export lifecycle.

const (
	JobStatusQueued    JobStatus = "queued"
	JobStatusRunning   JobStatus = "running"
	JobStatusSucceeded JobStatus = "succeeded"
	JobStatusFailed    JobStatus = "failed"
)

type ListExportArtifactsInput

type ListExportArtifactsInput struct {
	ArtifactRef string       `json:"artifactRef,omitempty"`
	JobID       string       `json:"jobId,omitempty"`
	Format      ExportFormat `json:"format,omitempty"`
	Limit       int          `json:"limit,omitempty"`
}

type ListExportArtifactsResult

type ListExportArtifactsResult struct {
	Artifacts  []*Artifact `json:"artifacts,omitempty"`
	TotalCount int         `json:"totalCount,omitempty"`
}

type ListExportJobsInput

type ListExportJobsInput struct {
	ArtifactRef string       `json:"artifactRef,omitempty"`
	Format      ExportFormat `json:"format,omitempty"`
	Scope       ExportScope  `json:"scope,omitempty"`
	Status      JobStatus    `json:"status,omitempty"`
	Limit       int          `json:"limit,omitempty"`
}

type ListExportJobsResult

type ListExportJobsResult struct {
	Jobs       []*ExportJob `json:"jobs,omitempty"`
	TotalCount int          `json:"totalCount,omitempty"`
}

type ListReportsInput added in v0.1.15

type ListReportsInput struct {
	ArtifactRef string `json:"artifactRef,omitempty"`
	ReportID    string `json:"reportId,omitempty"`
	OrderID     string `json:"orderId,omitempty"`
	Limit       int    `json:"limit,omitempty"`
}

type ListReportsResult added in v0.1.15

type ListReportsResult struct {
	Reports    []*ReportSummary `json:"reports,omitempty"`
	TotalCount int              `json:"totalCount,omitempty"`
}

type ListSharedArtifactsInput

type ListSharedArtifactsInput struct {
	ArtifactRef string `json:"artifactRef,omitempty"`
	ReportID    string `json:"reportId,omitempty"`
	Kind        string `json:"kind,omitempty"`
	Lifecycle   string `json:"lifecycle,omitempty"`
	Limit       int    `json:"limit,omitempty"`
}

type ListSharedArtifactsResult

type ListSharedArtifactsResult struct {
	Artifacts  []*SharedArtifact `json:"artifacts,omitempty"`
	TotalCount int               `json:"totalCount,omitempty"`
}

type MemoryStore

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

MemoryStore is the simplest in-process reporting store. It is intended for scaffolding, tests, and bootstrap paths before durable Datly persistence is wired in.

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore constructs an empty in-memory reporting store.

func (*MemoryStore) CreateJob

func (s *MemoryStore) CreateJob(_ context.Context, job *ExportJob) error

CreateJob persists a queued export job.

func (*MemoryStore) CreateSharedArtifact

func (s *MemoryStore) CreateSharedArtifact(_ context.Context, artifact *SharedArtifact) error

CreateSharedArtifact persists a shared reporting artifact.

func (*MemoryStore) DeleteSharedArtifact added in v0.1.23

func (s *MemoryStore) DeleteSharedArtifact(_ context.Context, artifactID string) error

DeleteSharedArtifact removes a persisted shared reporting artifact.

func (*MemoryStore) GetArtifact

func (s *MemoryStore) GetArtifact(_ context.Context, artifactID string) (*Artifact, error)

GetArtifact returns a cloned export artifact.

func (*MemoryStore) GetJob

func (s *MemoryStore) GetJob(_ context.Context, jobID string) (*ExportJob, error)

GetJob returns a cloned export job.

func (*MemoryStore) GetSharedArtifact

func (s *MemoryStore) GetSharedArtifact(_ context.Context, artifactID string) (*SharedArtifact, error)

GetSharedArtifact returns a cloned shared reporting artifact.

func (*MemoryStore) ListArtifacts

func (s *MemoryStore) ListArtifacts(_ context.Context) ([]*Artifact, error)

ListArtifacts returns cloned export artifacts in unspecified order.

func (*MemoryStore) ListJobs

func (s *MemoryStore) ListJobs(_ context.Context) ([]*ExportJob, error)

ListJobs returns cloned export jobs in unspecified order.

func (*MemoryStore) ListSharedArtifacts

func (s *MemoryStore) ListSharedArtifacts(_ context.Context) ([]*SharedArtifact, error)

ListSharedArtifacts returns cloned shared reporting artifacts in unspecified order.

func (*MemoryStore) PutArtifact

func (s *MemoryStore) PutArtifact(_ context.Context, artifact *Artifact) error

PutArtifact stores a completed export artifact.

func (*MemoryStore) UpdateJob

func (s *MemoryStore) UpdateJob(_ context.Context, job *ExportJob) error

UpdateJob replaces a persisted export job.

func (*MemoryStore) UpdateSharedArtifact

func (s *MemoryStore) UpdateSharedArtifact(_ context.Context, artifact *SharedArtifact) error

UpdateSharedArtifact replaces a persisted shared reporting artifact.

type Options

type Options struct {
	Compiler Compiler
	Exporter Exporter
	Store    Store
	// ActiveRunResolver is wired only when durable browser-run persistence and
	// reporting orchestration are both enabled.
	ActiveRunResolver ActiveReportRunResolver
	Audit             AuditSink
	Scratchpad        *afsscratchpad.Service
	ScratchpadFS      afs.Service
	TokenProvider     tokenctx.Provider
	Now               func() time.Time
	NewID             func() string
	// ExportFromRunEnabled gates only the T2 run-reference submission mode.
	// Legacy payload submission remains available when this is false.
	ExportFromRunEnabled bool
	// ConversationAdoptionEnabled allows the active-run resolver to expose an
	// adopted completed manual run when its full durable snapshot is valid.
	ConversationAdoptionEnabled bool
	ForgeUIViewResolver         ForgeUIViewResolver
}

Options configures a reporting Service.

type RecordAuditEventInput

type RecordAuditEventInput struct {
	Event *AuditEvent `json:"event,omitempty"`
}

RecordAuditEventInput carries a UI-originated reporting audit event through the reporting service boundary.

type RecordReportRunRequest added in v0.1.23

type RecordReportRunRequest struct {
	ArtifactID  string    `json:"artifactId,omitempty"`
	ArtifactRef string    `json:"artifactRef,omitempty"`
	ReportID    string    `json:"reportId,omitempty"`
	RanAt       time.Time `json:"ranAt,omitempty"`
}

type RenderRequest

type RenderRequest struct {
	JobID             string          `json:"jobId,omitempty"`
	ArtifactRef       string          `json:"artifactRef,omitempty"`
	OwnerID           string          `json:"ownerId,omitempty"`
	ConversationID    string          `json:"conversationId,omitempty"`
	WorkspaceID       string          `json:"workspaceId,omitempty"`
	AuthContextRef    string          `json:"authContextRef,omitempty"`
	Format            ExportFormat    `json:"format,omitempty"`
	Scope             ExportScope     `json:"scope,omitempty"`
	ReportRunID       string          `json:"reportRunId,omitempty"`
	ReportRunRevision int64           `json:"reportRunRevision,omitempty"`
	ReportSpec        json.RawMessage `json:"reportSpec,omitempty"`
	ReportFill        json.RawMessage `json:"reportFill,omitempty"`
	ReportPrint       json.RawMessage `json:"reportPrint,omitempty"`
	Metadata          json.RawMessage `json:"metadata,omitempty"`
}

RenderRequest is the worker-facing canonical export payload handed to the backend exporter boundary.

type RenderResult

type RenderResult struct {
	ContentType  string        `json:"contentType,omitempty"`
	Data         []byte        `json:"data,omitempty"`
	Diagnostics  []Diagnostic  `json:"diagnostics,omitempty"`
	RetentionTTL time.Duration `json:"retentionTtl,omitempty"`
}

RenderResult is the exporter output consumed by agently-core artifact persistence.

type ReportExportRequest

type ReportExportRequest struct {
	Version     int                `json:"version,omitempty"`
	Kind        string             `json:"kind,omitempty"`
	Target      ReportExportTarget `json:"target,omitempty"`
	Source      ReportExportSource `json:"source,omitempty"`
	ReportSpec  json.RawMessage    `json:"reportSpec,omitempty"`
	ReportFill  json.RawMessage    `json:"reportFill,omitempty"`
	ReportPrint json.RawMessage    `json:"reportPrint,omitempty"`
	Metadata    json.RawMessage    `json:"metadata,omitempty"`
}

ReportExportRequest is the canonical Forge export handoff envelope accepted by agently-core reporting export submission.

type ReportExportSource

type ReportExportSource struct {
	From             string `json:"from,omitempty"`
	ArtifactKind     string `json:"artifactKind,omitempty"`
	ArtifactRef      string `json:"artifactRef,omitempty"`
	Title            string `json:"title,omitempty"`
	ReportID         string `json:"reportId,omitempty"`
	PayloadID        string `json:"payloadId,omitempty"`
	SourceArtifactID string `json:"sourceArtifactId,omitempty"`
	DocumentVersion  int    `json:"documentVersion,omitempty"`
}

type ReportExportTarget

type ReportExportTarget struct {
	Format ExportFormat `json:"format,omitempty"`
}

type ReportSpecCompiler

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

ReportSpecCompiler is the first backend compile implementation. It accepts already-canonical ReportSpec payloads and validates the top-level contract before returning them to the runtime. It does not lower raw authoring artifacts yet.

func NewReportSpecCompiler

func NewReportSpecCompiler(now func() time.Time) *ReportSpecCompiler

NewReportSpecCompiler constructs a compiler for canonical ReportSpec inputs.

func (*ReportSpecCompiler) Compile

Compile validates and returns a canonical ReportSpec payload.

type ReportSummary added in v0.1.17

type ReportSummary struct {
	ArtifactID       string     `json:"artifactId,omitempty"`
	ArtifactRef      string     `json:"artifactRef,omitempty"`
	ReportID         string     `json:"reportId,omitempty"`
	Title            string     `json:"title,omitempty"`
	OwnerID          string     `json:"ownerId,omitempty"`
	ReportType       string     `json:"reportType,omitempty"`
	BuilderRef       string     `json:"builderRef,omitempty"`
	OrderIDs         []string   `json:"orderIds,omitempty"`
	DefaultFrom      string     `json:"defaultFrom,omitempty"`
	DefaultTo        string     `json:"defaultTo,omitempty"`
	LastRunAt        *time.Time `json:"lastRunAt,omitempty"`
	Lifecycle        string     `json:"lifecycle,omitempty"`
	Version          int        `json:"version,omitempty"`
	DocumentVersion  int        `json:"documentVersion,omitempty"`
	SourceArtifactID string     `json:"sourceArtifactId,omitempty"`
	CreatedAt        time.Time  `json:"createdAt,omitempty"`
	UpdatedAt        *time.Time `json:"updatedAt,omitempty"`
}

ReportSummary is the lightweight catalog projection. Full authored and compiled payloads remain available through get_report.

type ResolvedForgeUIView added in v0.1.30

type ResolvedForgeUIView struct {
	UI          json.RawMessage
	DataSources map[string]json.RawMessage
}

type RunExportInput

type RunExportInput struct {
	JobID string `json:"jobId,omitempty"`
}

type RunExportStore added in v0.1.23

type RunExportStore interface {
	SubmitJobFromRun(ctx context.Context, candidate *ExportJob) (job *ExportJob, replay bool, err error)
	ClaimJob(ctx context.Context, jobID string, startedAt time.Time) (*ExportJob, error)
	CompleteJobWithArtifact(ctx context.Context, jobID string, artifact *Artifact, diagnostics []Diagnostic, completedAt time.Time, retentionTTL time.Duration) (*ExportJob, error)
	FailJob(ctx context.Context, jobID, errorText string, diagnostics []Diagnostic, completedAt time.Time) (*ExportJob, error)
	ReconcileRunningJobs(ctx context.Context, staleBefore, reconciledAt time.Time, errorText string) ([]*ExportJob, error)
}

RunExportStore is the T2 extension implemented by durable reporting store adapters. It keeps run snapshot copy, idempotency, job transitions, and artifact completion inside the store's atomic/recoverable boundary.

type RunQueuedExportsInput

type RunQueuedExportsInput struct {
	Limit int `json:"limit,omitempty"`
}

type RunQueuedExportsResult

type RunQueuedExportsResult struct {
	Jobs           []*ExportJob `json:"jobs,omitempty"`
	ProcessedCount int          `json:"processedCount,omitempty"`
	SucceededCount int          `json:"succeededCount,omitempty"`
	FailedCount    int          `json:"failedCount,omitempty"`
}

type SaveReportRequest added in v0.1.15

type SaveReportRequest struct {
	ArtifactRef     string          `json:"artifactRef,omitempty"`
	ReportID        string          `json:"reportId,omitempty"`
	Title           string          `json:"title,omitempty"`
	Version         int             `json:"version,omitempty"`
	DocumentVersion int             `json:"documentVersion,omitempty"`
	ReportDocument  json.RawMessage `json:"reportDocument,omitempty"`
	ReportSpec      json.RawMessage `json:"reportSpec,omitempty"`
	CompileState    json.RawMessage `json:"compileState,omitempty"`
	ReportFill      json.RawMessage `json:"reportFill,omitempty"`
	ReportPrint     json.RawMessage `json:"reportPrint,omitempty"`
	Metadata        json.RawMessage `json:"metadata,omitempty"`
}

type Service

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

Service is the agently-core runtime boundary for reporting compile and export job orchestration.

func New

func New(opts Options) *Service

New constructs a reporting Service.

func (*Service) AsyncConfig added in v0.1.23

func (s *Service) AsyncConfig(toolName string) *asynccfg.Config

func (*Service) AsyncConfigs added in v0.1.23

func (s *Service) AsyncConfigs() []*asynccfg.Config

AsyncConfigs links exact export submission jobs to exact status reads. The generic async runtime owns the bounded wait; no reporting-specific wait tool or model-driven polling loop is exposed.

func (*Service) Compile

func (s *Service) Compile(ctx context.Context, request *CompileRequest) (*CompileResult, error)

Compile runs the configured canonical compiler.

func (*Service) CompileAndExportFencedReport added in v0.1.22

func (s *Service) CompileAndExportFencedReport(ctx context.Context, request *CompileAndExportFencedReportRequest) (*CompileAndExportFencedReportResult, error)

CompileAndExportFencedReport compiles progressive Forge fences, submits the canonical envelope directly, runs the configured exporter, and returns a compact artifact projection.

func (*Service) CompileAndExportForgeUI added in v0.1.30

func (s *Service) CompileAndExportForgeUI(ctx context.Context, request *CompileAndExportForgeUIRequest) (*CompileAndExportForgeUIResult, error)

func (*Service) CompileFencedReport added in v0.1.22

func (s *Service) CompileFencedReport(_ context.Context, request *CompileFencedReportRequest) (*CompileFencedReportResult, error)

CompileFencedReport compiles progressive Forge fences into an export-ready canonical reporting envelope.

func (*Service) CompleteExport

func (s *Service) CompleteExport(ctx context.Context, request *CompleteExportRequest) (*ExportJob, error)

CompleteExport persists a finished export artifact and marks the job succeeded.

func (*Service) DeleteReport added in v0.1.23

func (s *Service) DeleteReport(ctx context.Context, request *DeleteReportRequest) (*DeleteReportResult, error)

func (*Service) DuplicateReport added in v0.1.23

func (s *Service) DuplicateReport(ctx context.Context, request *DuplicateReportRequest) (*SharedArtifact, error)

func (*Service) FailExport

func (s *Service) FailExport(ctx context.Context, request *FailExportRequest) (*ExportJob, error)

FailExport marks an export job failed.

func (*Service) GetActiveReportRun added in v0.1.23

func (s *Service) GetActiveReportRun(ctx context.Context) (*ActiveReportRun, error)

GetActiveReportRun resolves the active pointer first and then reads that exact run through reportingrun.Service. Every invalid or unavailable state is intentionally collapsed to ErrNotFound.

func (*Service) GetArtifact

func (s *Service) GetArtifact(ctx context.Context, artifactID string) (*Artifact, error)

GetArtifact returns an artifact visible to the current principal.

func (*Service) GetExportStatus

func (s *Service) GetExportStatus(ctx context.Context, jobID string) (*ExportJob, error)

GetExportStatus returns a job visible to the current principal.

func (*Service) GetReport added in v0.1.15

func (s *Service) GetReport(ctx context.Context, input *GetReportInput) (*SharedArtifact, error)

func (*Service) GetSharedArtifact

func (s *Service) GetSharedArtifact(ctx context.Context, artifactID string) (*SharedArtifact, error)

GetSharedArtifact returns a shared artifact visible to the current principal.

func (*Service) ListExportArtifacts

func (s *Service) ListExportArtifacts(ctx context.Context, input *ListExportArtifactsInput) (*ListExportArtifactsResult, error)

ListExportArtifacts returns export artifacts visible to the current principal.

func (*Service) ListExportJobs

func (s *Service) ListExportJobs(ctx context.Context, input *ListExportJobsInput) (*ListExportJobsResult, error)

ListExportJobs returns export jobs visible to the current principal.

func (*Service) ListReports added in v0.1.15

func (s *Service) ListReports(ctx context.Context, input *ListReportsInput) (*ListReportsResult, error)

func (*Service) ListSharedArtifacts

func (s *Service) ListSharedArtifacts(ctx context.Context, input *ListSharedArtifactsInput) (*ListSharedArtifactsResult, error)

ListSharedArtifacts returns shared artifacts visible to the current principal.

func (*Service) Method

func (s *Service) Method(name string) (svc.Executable, error)

func (*Service) Methods

func (s *Service) Methods() svc.Signatures

func (*Service) Name

func (s *Service) Name() string

func (*Service) ReconcileStaleRunningExports added in v0.1.23

func (s *Service) ReconcileStaleRunningExports(ctx context.Context, staleAfter time.Duration) ([]*ExportJob, error)

ReconcileStaleRunningExports marks interrupted running jobs failed after a bounded timeout. Filesystem stores may instead finish a job when they find the artifact durably written before a prior process stopped.

func (*Service) RecordAuditEvent

func (s *Service) RecordAuditEvent(ctx context.Context, input *RecordAuditEventInput) (*AuditEvent, error)

RecordAuditEvent validates and records a structured reporting audit event.

func (*Service) RecordReportRun added in v0.1.23

func (s *Service) RecordReportRun(ctx context.Context, request *RecordReportRunRequest) (*SharedArtifact, error)

func (*Service) RunExport

func (s *Service) RunExport(ctx context.Context, jobID string) (*ExportJob, error)

RunExport executes a queued job through the configured exporter boundary and persists either a completed artifact or a failed job state.

func (*Service) RunQueuedExports

func (s *Service) RunQueuedExports(ctx context.Context, limit int) (*RunQueuedExportsResult, error)

RunQueuedExports executes queued jobs in submitted order up to limit.

func (*Service) SaveReport added in v0.1.15

func (s *Service) SaveReport(ctx context.Context, request *SaveReportRequest) (*SharedArtifact, error)

func (*Service) ShareArtifact

func (s *Service) ShareArtifact(ctx context.Context, request *ShareArtifactRequest) (*SharedArtifact, error)

ShareArtifact creates or returns a shared artifact such as a saved view.

func (*Service) StartExport

func (s *Service) StartExport(ctx context.Context, jobID string) (*ExportJob, error)

StartExport marks a queued job running. Intended for async workers.

func (*Service) SubmitExport

func (s *Service) SubmitExport(ctx context.Context, request *SubmitExportRequest) (*ExportJob, error)

SubmitExport enqueues a canonical export job.

func (*Service) TransitionArtifact

func (s *Service) TransitionArtifact(ctx context.Context, request *TransitionArtifactRequest) (*SharedArtifact, error)

TransitionArtifact mutates lifecycle state or materializes a published snapshot.

func (*Service) UpdateReport added in v0.1.15

func (s *Service) UpdateReport(ctx context.Context, request *UpdateReportRequest) (*SharedArtifact, error)

type ShareArtifactRequest

type ShareArtifactRequest struct {
	ArtifactRef         string               `json:"artifactRef,omitempty"`
	Version             int                  `json:"version,omitempty"`
	Lifecycle           string               `json:"lifecycle,omitempty"`
	ReportDocument      json.RawMessage      `json:"reportDocument,omitempty"`
	ReportExportRequest *ReportExportRequest `json:"reportExportRequest,omitempty"`
	SavedViewOverlay    json.RawMessage      `json:"savedViewOverlay,omitempty"`
	Metadata            json.RawMessage      `json:"metadata,omitempty"`
}

ShareArtifactRequest creates or returns a shared reporting artifact through the reporting persistence boundary.

type SharedArtifact

type SharedArtifact struct {
	ArtifactID       string          `json:"artifactId,omitempty"`
	ArtifactRef      string          `json:"artifactRef,omitempty"`
	OwnerID          string          `json:"ownerId,omitempty"`
	OwnerRef         string          `json:"ownerRef,omitempty"`
	Kind             string          `json:"kind,omitempty"`
	Lifecycle        string          `json:"lifecycle,omitempty"`
	Version          int             `json:"version,omitempty"`
	ReportID         string          `json:"reportId,omitempty"`
	Title            string          `json:"title,omitempty"`
	SourceArtifactID string          `json:"sourceArtifactId,omitempty"`
	BaseArtifactRef  string          `json:"baseArtifactRef,omitempty"`
	PolicyRef        string          `json:"policyRef,omitempty"`
	DocumentVersion  int             `json:"documentVersion,omitempty"`
	Document         json.RawMessage `json:"document,omitempty"`
	ReportSpec       json.RawMessage `json:"reportSpec,omitempty"`
	CompileState     json.RawMessage `json:"compileState,omitempty"`
	ReportFill       json.RawMessage `json:"reportFill,omitempty"`
	ReportPrint      json.RawMessage `json:"reportPrint,omitempty"`
	SavedViewOverlay json.RawMessage `json:"savedViewOverlay,omitempty"`
	Metadata         json.RawMessage `json:"metadata,omitempty"`
	CreatedAt        time.Time       `json:"createdAt,omitempty"`
	UpdatedAt        *time.Time      `json:"updatedAt,omitempty"`
}

SharedArtifact is the persisted saved-view / published-snapshot shell owned by agently-core. Payload fields remain opaque JSON at this boundary.

func (*SharedArtifact) GetOwnerID

func (a *SharedArtifact) GetOwnerID() string

type StartExportInput

type StartExportInput struct {
	JobID string `json:"jobId,omitempty"`
}

type Store

type Store interface {
	CreateJob(ctx context.Context, job *ExportJob) error
	GetJob(ctx context.Context, jobID string) (*ExportJob, error)
	ListJobs(ctx context.Context) ([]*ExportJob, error)
	UpdateJob(ctx context.Context, job *ExportJob) error
	PutArtifact(ctx context.Context, artifact *Artifact) error
	GetArtifact(ctx context.Context, artifactID string) (*Artifact, error)
	ListArtifacts(ctx context.Context) ([]*Artifact, error)
	CreateSharedArtifact(ctx context.Context, artifact *SharedArtifact) error
	GetSharedArtifact(ctx context.Context, artifactID string) (*SharedArtifact, error)
	ListSharedArtifacts(ctx context.Context) ([]*SharedArtifact, error)
	UpdateSharedArtifact(ctx context.Context, artifact *SharedArtifact) error
	DeleteSharedArtifact(ctx context.Context, artifactID string) error
}

Store persists export jobs and artifacts.

func NewStoreAdapter

func NewStoreAdapter(client reportstore.Client) Store

NewStoreAdapter bridges the generic reporting store client into the reporting service's Store interface.

type SubmitExportRequest

type SubmitExportRequest struct {
	ArtifactRef         string               `json:"artifactRef,omitempty"`
	Format              ExportFormat         `json:"format,omitempty"`
	Scope               ExportScope          `json:"scope,omitempty"`
	ConversationID      string               `json:"conversationId,omitempty"`
	WorkspaceID         string               `json:"workspaceId,omitempty"`
	Source              *ExportSource        `json:"source,omitempty"`
	ReportSpec          json.RawMessage      `json:"reportSpec,omitempty"`
	ReportFill          json.RawMessage      `json:"reportFill,omitempty"`
	ReportPrint         json.RawMessage      `json:"reportPrint,omitempty"`
	Metadata            json.RawMessage      `json:"metadata,omitempty"`
	ReportExportRequest *ReportExportRequest `json:"reportExportRequest,omitempty"`
	// ReportRunID selects the T2 run-reference mode.
	// ExportRequestID is deliberately absent: trusted runtime/host context
	// supplies it outside the model-visible arguments. The backend loads and
	// records the authoritative completed run revision.
	ReportRunID string `json:"reportRunId,omitempty"`
	// contains filtered or unexported fields
}

SubmitExportRequest queues an export job against canonical reporting models.

func (*SubmitExportRequest) UnmarshalJSON added in v0.1.23

func (r *SubmitExportRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON remembers whether a run-reference payload contained anything beyond its exact model-visible surface. The marker is unexported so it does not add schema fields, while still preventing encoding/json from silently discarding browser/legacy aliases such as artifact, spec, or request.

type TransitionArtifactRequest

type TransitionArtifactRequest struct {
	ArtifactRef         string               `json:"artifactRef,omitempty"`
	From                string               `json:"from,omitempty"`
	To                  string               `json:"to,omitempty"`
	Reason              string               `json:"reason,omitempty"`
	Version             int                  `json:"version,omitempty"`
	ReportDocument      json.RawMessage      `json:"reportDocument,omitempty"`
	ReportExportRequest *ReportExportRequest `json:"reportExportRequest,omitempty"`
	Metadata            json.RawMessage      `json:"metadata,omitempty"`
}

TransitionArtifactRequest mutates or materializes a lifecycle transition through the reporting persistence boundary.

type UpdateReportRequest added in v0.1.15

type UpdateReportRequest struct {
	ArtifactID      string          `json:"artifactId,omitempty"`
	ArtifactRef     string          `json:"artifactRef,omitempty"`
	ReportID        string          `json:"reportId,omitempty"`
	Title           string          `json:"title,omitempty"`
	Version         int             `json:"version,omitempty"`
	DocumentVersion int             `json:"documentVersion,omitempty"`
	ReportDocument  json.RawMessage `json:"reportDocument,omitempty"`
	ReportSpec      json.RawMessage `json:"reportSpec,omitempty"`
	CompileState    json.RawMessage `json:"compileState,omitempty"`
	ReportFill      json.RawMessage `json:"reportFill,omitempty"`
	ReportPrint     json.RawMessage `json:"reportPrint,omitempty"`
	Metadata        json.RawMessage `json:"metadata,omitempty"`
}

type Worker

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

func NewWorker

func NewWorker(service *Service, options WorkerOptions) *Worker

func (*Worker) RunOnce

func (w *Worker) RunOnce(ctx context.Context) (*RunQueuedExportsResult, error)

func (*Worker) Start

func (w *Worker) Start(ctx context.Context) error

type WorkerOptions

type WorkerOptions struct {
	Interval                     time.Duration
	BatchLimit                   int
	Logger                       func(format string, args ...interface{})
	ReconcileStaleRunningExports bool
	StaleRunningAfter            time.Duration
}

Jump to

Keyboard shortcuts

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