Documentation
¶
Index ¶
- Constants
- Variables
- func MappingSchemaHash(sheet types.SheetSpec, comp types.ComponentSpec) string
- func NormalizeDefinition(def *types.ViewDefinition)
- func OutputMatchesDataSource(output *types.TaskOutput, ds *types.DataSource) bool
- type Artifact
- type Copilot
- func (c *Copilot) BuildViewDataContext(ctx context.Context, viewID string, viewContent string) string
- func (c *Copilot) BuildWorkspaceContext(ctx context.Context, workspaceID uint) string
- func (c *Copilot) CreateDraft(workspaceID string) *Draft
- func (c *Copilot) DeleteDraft(ctx context.Context, workspaceID, draftID string) error
- func (c *Copilot) DraftsAvailable() bool
- func (c *Copilot) ExecuteOperations(ctx context.Context, workspaceID uint, ops []bamltypes.Operation) []OperationResult
- func (c *Copilot) FormatHistory(messages []DraftMessage) string
- func (c *Copilot) GenerateStream(ctx context.Context, draft *Draft, workspaceID uint, userMessage string, ...) (*bamltypes.ViewDraftResponse, error)
- func (c *Copilot) IndexDraftCreated(ctx context.Context, workspaceID, draftID, desc, viewName, viewID string) error
- func (c *Copilot) IndexDraftPublished(ctx context.Context, workspaceID, draftID, viewName, viewID string) error
- func (c *Copilot) IndexDraftPublishedAsync(workspaceID, draftID, viewName, viewID string)
- func (c *Copilot) ListDrafts(ctx context.Context, workspaceID string) ([]DraftSummary, error)
- func (c *Copilot) LoadDraft(ctx context.Context, workspaceID, draftID string) (*Draft, error)
- func (c *Copilot) PersistMeta(ctx context.Context, draft *Draft) error
- func (c *Copilot) PersistPublishedViewID(ctx context.Context, draftID, viewID string) error
- func (c *Copilot) PersistViewContent(ctx context.Context, draftID, viewContent string) error
- func (c *Copilot) PublishView(ctx context.Context, draft *Draft, workspaceID uint) (*types.View, error)
- func (c *Copilot) ReconcileViewContent(ctx context.Context, workspaceID uint, viewContent string, ...) (string, error)
- type DataResolver
- func (r *DataResolver) RegenerateRow(ctx context.Context, workspaceID uint, viewID string, sheet types.SheetSpec, ...) (*types.ResolvedData, error)
- func (r *DataResolver) Resolve(ctx context.Context, workspaceID uint, viewID string, sheet types.SheetSpec, ...) (*types.ResolvedData, error)
- func (r *DataResolver) ResolveWidgets(ctx context.Context, workspaceID uint, viewID string, sheet types.SheetSpec, ...) ([]types.WidgetData, error)
- func (r *DataResolver) Store() *ViewStore
- type Draft
- type DraftMessage
- type DraftSummary
- type ExcludedRowSnapshot
- type OperationResult
- type PartialViewDraftResponse
- type ResolveOptions
- type ViewRow
- type ViewStore
- func (s *ViewStore) Available() bool
- func (s *ViewStore) ClearManualCells(ctx context.Context, viewID, sheetID, componentID string, ...) error
- func (s *ViewStore) DeleteColumn(ctx context.Context, viewID, sheetID, componentID, key, schemaHash string) error
- func (s *ViewStore) DeleteRowsNotInGroups(ctx context.Context, viewID, sheetID, componentID string, ...) error
- func (s *ViewStore) DeleteSheet(ctx context.Context, viewID, sheetID string) error
- func (s *ViewStore) DeleteWidgetRows(ctx context.Context, viewID, sheetID string) error
- func (s *ViewStore) DropView(ctx context.Context, viewID string) error
- func (s *ViewStore) ExcludeRow(ctx context.Context, viewID, sheetID, rowID string) error
- func (s *ViewStore) GetExcludedRows(ctx context.Context, viewID, sheetID string) ([]ExcludedRowSnapshot, error)
- func (s *ViewStore) GetRow(ctx context.Context, viewID, sheetID, rowID string) (*ViewRow, error)
- func (s *ViewStore) GetRows(ctx context.Context, viewID, sheetID, componentID string) ([]ViewRow, error)
- func (s *ViewStore) GetWidgetRows(ctx context.Context, viewID, sheetID string) ([]WidgetRow, error)
- func (s *ViewStore) RenameColumn(ctx context.Context, ...) error
- func (s *ViewStore) RestoreRow(ctx context.Context, viewID, sheetID, rowID string) error
- func (s *ViewStore) UpdateCells(ctx context.Context, viewID, sheetID, rowID string, cells map[string]string) error
- func (s *ViewStore) UpsertRows(ctx context.Context, viewID string, rows []ViewRow) error
- func (s *ViewStore) UpsertWidgetRow(ctx context.Context, viewID string, row WidgetRow) error
- type WidgetListData
- type WidgetListItem
- type WidgetMapData
- type WidgetMapMarker
- type WidgetMetric
- type WidgetRow
Constants ¶
const ComponentRegistryDoc = `` /* 4865-byte string literal not displayed */
Variables ¶
var ErrInvalidViewColumnKey = errors.New("invalid view column key")
var ErrNoOutputsForTask = errors.New("no outputs found for task")
var ErrViewRowNotFound = errors.New("view row not found")
Functions ¶
func MappingSchemaHash ¶ added in v0.1.104
func MappingSchemaHash(sheet types.SheetSpec, comp types.ComponentSpec) string
func NormalizeDefinition ¶
func NormalizeDefinition(def *types.ViewDefinition)
NormalizeDefinition canonicalizes a view definition for persistence. It enforces the same schema invariants used by the copilot publish path.
func OutputMatchesDataSource ¶
func OutputMatchesDataSource(output *types.TaskOutput, ds *types.DataSource) bool
Types ¶
type Artifact ¶
type Artifact struct {
// contains filtered or unexported fields
}
Artifact derives stable identity and display properties from a TaskOutput. BAML ExtractOutputs provides artifact_key, artifact_label, and artifact_kind at generation time. The methods below prefer those explicit values and fall back to lightweight heuristics for outputs created before the BAML enrichment.
func ArtifactOf ¶
func ArtifactOf(o *types.TaskOutput) Artifact
func (Artifact) MatchesKey ¶
type Copilot ¶
type Copilot struct {
// contains filtered or unexported fields
}
func NewCopilot ¶
func NewCopilot(s2 *common.S2Client, redis *common.RedisClient, backend repository.BackendRepository, storage *clients.StorageClient, agentAPI *orchestration.AgentAPI, store *ViewStore) *Copilot
func (*Copilot) BuildViewDataContext ¶ added in v0.1.108
func (c *Copilot) BuildViewDataContext(ctx context.Context, viewID string, viewContent string) string
BuildViewDataContext loads row data from MongoDB for a published view and formats it as a readable text table that can be injected into the BAML prompt.
func (*Copilot) BuildWorkspaceContext ¶
func (*Copilot) CreateDraft ¶
func (*Copilot) DeleteDraft ¶
func (*Copilot) DraftsAvailable ¶
func (*Copilot) ExecuteOperations ¶
func (*Copilot) FormatHistory ¶
func (c *Copilot) FormatHistory(messages []DraftMessage) string
func (*Copilot) GenerateStream ¶
func (*Copilot) IndexDraftCreated ¶
func (*Copilot) IndexDraftPublished ¶
func (*Copilot) IndexDraftPublishedAsync ¶ added in v0.1.107
func (*Copilot) ListDrafts ¶
func (*Copilot) PersistMeta ¶
Public persistence API — thin wrappers for callers.
func (*Copilot) PersistPublishedViewID ¶
func (*Copilot) PersistViewContent ¶
func (*Copilot) PublishView ¶
func (*Copilot) ReconcileViewContent ¶
type DataResolver ¶
type DataResolver struct {
// contains filtered or unexported fields
}
func NewDataResolver ¶
func NewDataResolver(backend repository.BackendRepository, store *ViewStore) *DataResolver
func (*DataResolver) RegenerateRow ¶
func (r *DataResolver) RegenerateRow(ctx context.Context, workspaceID uint, viewID string, sheet types.SheetSpec, comp types.ComponentSpec, taskID string, opts ResolveOptions) (*types.ResolvedData, error)
RegenerateRow re-maps a single task's outputs through BAML for one sheet, replacing the cached rows for that task. Returns the full re-assembled table.
func (*DataResolver) Resolve ¶
func (r *DataResolver) Resolve(ctx context.Context, workspaceID uint, viewID string, sheet types.SheetSpec, comp types.ComponentSpec, opts ResolveOptions) (*types.ResolvedData, error)
Resolve maps task outputs to a sheet table's schema using BAML.
func (*DataResolver) ResolveWidgets ¶ added in v0.1.108
func (r *DataResolver) ResolveWidgets(ctx context.Context, workspaceID uint, viewID string, sheet types.SheetSpec, comp types.ComponentSpec, opts ResolveOptions) ([]types.WidgetData, error)
ResolveWidgets maps the sheet's view rows through BAML into each widget's data format. Results are stored as WidgetRow documents in MongoDB, keyed by a content hash so unchanged data skips BAML entirely.
func (*DataResolver) Store ¶
func (r *DataResolver) Store() *ViewStore
Store returns the ViewStore for direct access (used by the views API for cell edits).
type Draft ¶
type Draft struct {
ID string `json:"id"`
WorkspaceID string `json:"workspace_id"`
Status string `json:"status"`
ViewContent string `json:"view_content"`
PublishedViewID string `json:"published_view_id,omitempty"`
Messages []DraftMessage `json:"messages"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type DraftMessage ¶
type DraftSummary ¶
type ExcludedRowSnapshot ¶ added in v0.1.108
type ExcludedRowSnapshot struct {
TaskID string `bson:"task_id"`
RowKey string `bson:"row_key"`
Cells map[string]string `bson:"cells"`
}
ExcludedRowSnapshot is the data we store when a user deletes a row so the BAML mapper knows not to regenerate it.
type OperationResult ¶
type ResolveOptions ¶
type ViewRow ¶
type ViewRow struct {
ID string `bson:"_id"`
SheetID string `bson:"sheet_id"`
ComponentID string `bson:"component_id,omitempty"`
GroupID string `bson:"group_id"`
TaskID string `bson:"task_id"`
RowKey string `bson:"row_key"`
SchemaHash string `bson:"schema_hash"`
OutputIDs []string `bson:"output_ids"`
SourceOutputIDs []string `bson:"source_output_ids,omitempty"`
Cells map[string]string `bson:"cells"`
Manual map[string]string `bson:"manual,omitempty"`
UpdatedAt time.Time `bson:"updated_at"`
}
ViewRow is the MongoDB document schema for a single rendered row in a sheet.
func (*ViewRow) MergedCells ¶
MergedCells returns cells with manual edits overlaid on top of BAML-mapped cells.
type ViewStore ¶
type ViewStore struct {
// contains filtered or unexported fields
}
func NewViewStore ¶
func NewViewStore(mongo *common.MongoClient) *ViewStore
func (*ViewStore) ClearManualCells ¶
func (s *ViewStore) ClearManualCells(ctx context.Context, viewID, sheetID, componentID string, rowIDs, columnKeys []string) error
ClearManualCells removes manual overlays for the given rows and columns.
func (*ViewStore) DeleteColumn ¶
func (s *ViewStore) DeleteColumn(ctx context.Context, viewID, sheetID, componentID, key, schemaHash string) error
DeleteColumn removes a column key from cells and manual across a component scope.
func (*ViewStore) DeleteRowsNotInGroups ¶
func (s *ViewStore) DeleteRowsNotInGroups(ctx context.Context, viewID, sheetID, componentID string, groupIDs, keepRowIDs []string) error
DeleteRowsNotInGroups removes stale rows for the remapped groups.
func (*ViewStore) DeleteSheet ¶
DeleteSheet removes all rows for a sheet.
func (*ViewStore) DeleteWidgetRows ¶ added in v0.1.108
DeleteWidgetRows removes all widget rows for a sheet.
func (*ViewStore) ExcludeRow ¶
ExcludeRow snapshots a row's data into the per-sheet exclusion document, then hard-deletes the row. The snapshot is passed to the BAML mapper so it knows not to regenerate matching rows.
func (*ViewStore) GetExcludedRows ¶ added in v0.1.108
func (s *ViewStore) GetExcludedRows(ctx context.Context, viewID, sheetID string) ([]ExcludedRowSnapshot, error)
GetExcludedRows returns the exclusion snapshots for a sheet.
func (*ViewStore) GetWidgetRows ¶ added in v0.1.108
GetWidgetRows loads all widget rows for a sheet.
func (*ViewStore) RenameColumn ¶
func (s *ViewStore) RenameColumn(ctx context.Context, viewID, sheetID, componentID, oldKey, newKey, schemaHash string) error
RenameColumn renames a column key in cells and manual across a component scope.
func (*ViewStore) RestoreRow ¶
RestoreRow removes a snapshot from the exclusion document by matching task_id and row_key. The row will be regenerated on the next mapping pass.
func (*ViewStore) UpdateCells ¶
func (s *ViewStore) UpdateCells(ctx context.Context, viewID, sheetID, rowID string, cells map[string]string) error
UpdateCells writes user-edited values into the manual overlay.
func (*ViewStore) UpsertRows ¶
UpsertRows bulk-upserts rows into the view collection. Existing manual edits and excluded flags are preserved — only computed row data is replaced.
type WidgetListData ¶ added in v0.1.108
type WidgetListData struct {
Items []WidgetListItem `bson:"items"`
}
type WidgetListItem ¶ added in v0.1.108
type WidgetMapData ¶ added in v0.1.108
type WidgetMapData struct {
Markers []WidgetMapMarker `bson:"markers"`
}
type WidgetMapMarker ¶ added in v0.1.108
type WidgetMetric ¶ added in v0.1.108
type WidgetRow ¶ added in v0.1.108
type WidgetRow struct {
ID string `bson:"_id"`
SheetID string `bson:"sheet_id"`
WidgetID string `bson:"widget_id"`
Type string `bson:"type"`
Status string `bson:"status"`
Error string `bson:"error,omitempty"`
SchemaHash string `bson:"schema_hash"`
Metric *WidgetMetric `bson:"metric,omitempty"`
MapData *WidgetMapData `bson:"map_data,omitempty"`
ListData *WidgetListData `bson:"list_data,omitempty"`
UpdatedAt time.Time `bson:"updated_at"`
}
WidgetRow is the MongoDB document for resolved widget data.