Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigColumnsToMeta(config map[string]any) []types.ColumnMeta
- func FeedbackCountsByThread(entries []types.ViewContextEntry) map[string]int
- func FilterByThreadID(entries []types.ViewContextEntry, threadID string) []types.ViewContextEntry
- func FormatForPrompt(entries []types.ViewContextEntry) string
- func HasLabel(labels []string, target string) bool
- func MappingSchemaHash(sheet types.SheetSpec, comp types.ComponentSpec) string
- func NormalizeDefinition(def *types.ViewDefinition)
- func NormalizeRowKey(key string) string
- func OutputMatchesDataSource(output *types.TaskOutput, ds *types.DataSource) bool
- func OutputSearchText(outputType, title, summary, data string) string
- func PopulateStatusOptions(ctx context.Context, def *types.ViewDefinition)
- func RowSearchText(row *ViewRow) string
- type ActionSpecJSON
- type Artifact
- type AttachedFile
- type ChatMessage
- type ChatState
- type ContextCompactor
- func (cc *ContextCompactor) AppendEntry(ctx context.Context, entry types.ViewContextEntry) error
- func (cc *ContextCompactor) Available() bool
- func (cc *ContextCompactor) Compact(ctx context.Context, viewID string, entries []types.ViewContextEntry) error
- func (cc *ContextCompactor) ReadContext(ctx context.Context, viewID string) ([]types.ViewContextEntry, error)
- func (cc *ContextCompactor) ShouldCompact(entries []types.ViewContextEntry) bool
- type Copilot
- func (c *Copilot) BuildActiveTasksContext(ctx context.Context, workspaceID uint, viewContent string, viewID string) string
- func (c *Copilot) BuildViewDataContext(ctx context.Context, viewID string, viewContent string, userMessage string) string
- func (c *Copilot) BuildWorkspaceContext(ctx context.Context, workspaceID uint) string
- func (c *Copilot) ChatAvailable() bool
- func (c *Copilot) CreateChatState(workspaceID string) *ChatState
- func (c *Copilot) DeleteChatState(ctx context.Context, workspaceID, id string) error
- func (c *Copilot) EnsureViewAgentsExist(ctx context.Context, workspaceID uint, viewContent string) []OperationResult
- func (c *Copilot) ExecuteOperations(ctx context.Context, workspaceID uint, ops []bamltypes.Operation, ...) []OperationResult
- func (c *Copilot) FormatHistory(messages []ChatMessage) string
- func (c *Copilot) GenerateStream(ctx context.Context, cs *ChatState, 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) LoadChatState(ctx context.Context, workspaceID, viewID string) (*ChatState, error)
- func (c *Copilot) PersistChatMeta(ctx context.Context, cs *ChatState) error
- func (c *Copilot) PersistOperations(ctx context.Context, viewID string, results []OperationResult)
- func (c *Copilot) PersistPublishedViewID(ctx context.Context, chatID, viewID string) error
- func (c *Copilot) PersistViewContent(ctx context.Context, viewID, viewContent string) error
- func (c *Copilot) PublishView(ctx context.Context, cs *ChatState, 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) RunRows(ctx context.Context, workspaceID uint, viewID string, sheet types.SheetSpec, ...) (*types.ResolvedData, error)
- func (r *DataResolver) Store() *ViewStore
- type DetailLayoutResponse
- func ClassifyDetailTemplate(ctx context.Context, tableTitle string, columns []types.ColumnMeta) DetailLayoutResponse
- func DetailTemplateForComponent(comp *types.ComponentSpec) DetailLayoutResponse
- func InferDetailTemplate(columns []types.ColumnMeta) DetailLayoutResponse
- func ResolveProjectedLayout(template DetailLayoutResponse, projection DetailProjection) DetailLayoutResponse
- type DetailProjection
- type DetailSectionJSON
- type DetailSurface
- type DraftSummary
- type EmailThreadFetcher
- type EmbeddingClient
- type EmbeddingUpdate
- type ExcludedRowSnapshot
- type ImportParams
- type ImportResult
- type OperationResult
- type PartialChatResponse
- type ResolveOptions
- type RowDetailContext
- type SearchCriterion
- type SyncResult
- type ThreadMessage
- type ToolWriteInput
- type UpsertOpts
- type VectorSearchResult
- type ViewRow
- type ViewStore
- func (s *ViewStore) Available() bool
- func (s *ViewStore) BulkUpdateEmbeddings(ctx context.Context, viewID string, updates []EmbeddingUpdate) error
- func (s *ViewStore) CleanupStaleImportRows(ctx context.Context, viewID, sheetID, componentID string, keepIDs []string) (int64, error)
- 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) DeleteImport(ctx context.Context, viewID, sheetID, importID string) error
- func (s *ViewStore) DeleteRowsByIDs(ctx context.Context, viewID string, rowIDs []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) EmbedRowsAsync(viewID string)
- func (s *ViewStore) Embedder() *EmbeddingClient
- func (s *ViewStore) EnrichImportRow(ctx context.Context, viewID string, row ViewRow) error
- func (s *ViewStore) EnsureIndexes(ctx context.Context, viewID string) error
- func (s *ViewStore) EnsureVectorIndex(ctx context.Context, viewID string, dims int) error
- func (s *ViewStore) ExcludeRow(ctx context.Context, viewID, sheetID, rowID string) error
- func (s *ViewStore) FindByStableRef(ctx context.Context, viewID, sheetID, ref string) (*ViewRow, error)
- func (s *ViewStore) FindRowByKey(ctx context.Context, viewID, sheetID, componentID, rowKey string) (*ViewRow, error)
- func (s *ViewStore) FindRows(ctx context.Context, viewID, sheetID, column, value string, limit int) ([]ViewRow, 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) GetRowByID(ctx context.Context, viewID, rowID string) (*ViewRow, error)
- func (s *ViewStore) GetRowTaskIndex(ctx context.Context, viewID string) ([]ViewRow, error)
- func (s *ViewStore) GetRows(ctx context.Context, viewID, sheetID, componentID string) ([]ViewRow, error)
- func (s *ViewStore) GetRowsBySource(ctx context.Context, viewID, sheetID, componentID, source string) ([]ViewRow, error)
- func (s *ViewStore) GetRowsForMailbox(ctx context.Context, viewID string) ([]ViewRow, error)
- func (s *ViewStore) GetRowsPage(ctx context.Context, viewID, sheetID, componentID string, offset, limit int) ([]ViewRow, int, error)
- func (s *ViewStore) GetWidgetRows(ctx context.Context, viewID, sheetID string) ([]WidgetRow, error)
- func (s *ViewStore) MergeCells(ctx context.Context, viewID, rowID string, newCells map[string]string, ...) error
- func (s *ViewStore) ReembedRow(ctx context.Context, viewID, rowID string)
- func (s *ViewStore) RenameColumn(ctx context.Context, ...) error
- func (s *ViewStore) RestoreRow(ctx context.Context, viewID, sheetID, rowID string) error
- func (s *ViewStore) SearchRows(ctx context.Context, viewID, sheetID, componentID string, ...) ([]ViewRow, error)
- func (s *ViewStore) SearchRowsText(ctx context.Context, viewID, sheetID, componentID, query string, ...) ([]ViewRow, int, error)
- func (s *ViewStore) UpdateCells(ctx context.Context, viewID, sheetID, rowID string, cells map[string]string) error
- func (s *ViewStore) UpdateRow(ctx context.Context, viewID, rowID string, cells map[string]string, ...) error
- func (s *ViewStore) UpdateRowEmbedding(ctx context.Context, viewID, rowID string, searchText string, ...) error
- func (s *ViewStore) UpdateSchemaHash(ctx context.Context, viewID, sheetID, componentID, schemaHash string) error
- func (s *ViewStore) UpsertRow(ctx context.Context, viewID, sheetID, componentID string, ...) (string, bool, error)
- func (s *ViewStore) UpsertRows(ctx context.Context, viewID string, rows []ViewRow) error
- func (s *ViewStore) UpsertRowsNoEmbed(ctx context.Context, viewID string, rows []ViewRow) error
- func (s *ViewStore) UpsertWidgetRow(ctx context.Context, viewID string, row WidgetRow) error
- func (s *ViewStore) VectorSearch(ctx context.Context, viewID, sheetID string, queryEmbedding []float64, ...) ([]VectorSearchResult, error)
- type ViewSync
- type ViewSyncOpts
- type WidgetListData
- type WidgetListItem
- type WidgetMapData
- type WidgetMapMarker
- type WidgetMetric
- type WidgetRow
Constants ¶
const ( SectionEmailThread = string(bamltypes.SectionTypeEMAIL_THREAD) SectionApproval = string(bamltypes.SectionTypeAPPROVAL) SectionInputForm = string(bamltypes.SectionTypeINPUT_FORM) SectionTaskProgress = string(bamltypes.SectionTypeTASK_PROGRESS) SectionOutputGallery = string(bamltypes.SectionTypeOUTPUT_GALLERY) SectionDataSummary = string(bamltypes.SectionTypeDATA_SUMMARY) SectionSubtasks = string(bamltypes.SectionTypeSUBTASKS) EmphasisPrimary = string(bamltypes.SectionEmphasisPRIMARY) EmphasisSecondary = string(bamltypes.SectionEmphasisSECONDARY) EmphasisCollapsed = string(bamltypes.SectionEmphasisCOLLAPSED) ActionRetry = "RETRY" ActionCancel = "CANCEL" )
const ( RowSourceImport = "import" RowSourceSync = "sync" )
const ComponentRegistryDoc = `` /* 6145-byte string literal not displayed */
const UpdateTypeConversation = string(bamltypes.ViewUpdateTypeCONVERSATION)
UpdateTypeConversation is the BAML enum value for conversation-only updates (no view content changes). Exported so the API layer can reference it without importing the generated baml_client/types package directly.
const ViewSyncTimeout = 90 * time.Second
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 ConfigColumnsToMeta ¶ added in v0.1.110
func ConfigColumnsToMeta(config map[string]any) []types.ColumnMeta
func FeedbackCountsByThread ¶ added in v0.1.133
func FeedbackCountsByThread(entries []types.ViewContextEntry) map[string]int
FeedbackCountsByThread scans entries and returns a map of thread_id to the number of feedback/link/note entries anchored to that thread.
func FilterByThreadID ¶ added in v0.1.133
func FilterByThreadID(entries []types.ViewContextEntry, threadID string) []types.ViewContextEntry
FilterByThreadID returns entries whose metadata.thread_id matches the given value. Compaction entries are excluded since they are aggregate summaries.
func FormatForPrompt ¶ added in v0.1.131
func FormatForPrompt(entries []types.ViewContextEntry) string
FormatForPrompt renders context entries as a markdown section suitable for injection into an agent's system prompt.
func HasLabel ¶ added in v0.1.134
HasLabel reports whether the label list contains the given target label.
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 NormalizeRowKey ¶ added in v0.1.124
NormalizeRowKey normalizes a row key for consistent dedup across tasks.
func OutputMatchesDataSource ¶
func OutputMatchesDataSource(output *types.TaskOutput, ds *types.DataSource) bool
func OutputSearchText ¶ added in v0.1.125
OutputSearchText builds a query string from a task output for vector search.
func PopulateStatusOptions ¶ added in v0.1.133
func PopulateStatusOptions(ctx context.Context, def *types.ViewDefinition)
func RowSearchText ¶ added in v0.1.125
RowSearchText builds a deterministic, schema-agnostic search string from a row's merged cells. Keys are sorted for reproducibility.
Types ¶
type ActionSpecJSON ¶ added in v0.1.110
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 AttachedFile ¶ added in v0.1.112
type ChatMessage ¶ added in v0.1.112
type ChatMessage struct {
Role string `json:"role"`
Content string `json:"content"`
Timestamp int64 `json:"ts"`
Operations []OperationResult `json:"operations,omitempty"`
}
type ChatState ¶ added in v0.1.112
type ChatState 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 []ChatMessage `json:"messages"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type ContextCompactor ¶ added in v0.1.131
type ContextCompactor struct {
// contains filtered or unexported fields
}
ContextCompactor reads a view's context stream, optionally compacts it via LLM summarization, and provides the compacted context for injection.
func NewContextCompactor ¶ added in v0.1.131
func NewContextCompactor(s2 *common.S2Client, openAIKey string) *ContextCompactor
func (*ContextCompactor) AppendEntry ¶ added in v0.1.131
func (cc *ContextCompactor) AppendEntry(ctx context.Context, entry types.ViewContextEntry) error
AppendEntry appends a context entry to the view's S2 stream.
func (*ContextCompactor) Available ¶ added in v0.1.131
func (cc *ContextCompactor) Available() bool
func (*ContextCompactor) Compact ¶ added in v0.1.131
func (cc *ContextCompactor) Compact(ctx context.Context, viewID string, entries []types.ViewContextEntry) error
Compact summarizes the given entries via LLM and appends a compaction frame.
func (*ContextCompactor) ReadContext ¶ added in v0.1.131
func (cc *ContextCompactor) ReadContext(ctx context.Context, viewID string) ([]types.ViewContextEntry, error)
ReadContext reads the view context stream and returns the effective entries: the last compaction summary (if any) plus all entries appended after it.
func (*ContextCompactor) ShouldCompact ¶ added in v0.1.131
func (cc *ContextCompactor) ShouldCompact(entries []types.ViewContextEntry) bool
ShouldCompact returns true if there are enough raw entries since the last compaction to justify a new compaction pass.
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) BuildActiveTasksContext ¶ added in v0.1.112
func (c *Copilot) BuildActiveTasksContext(ctx context.Context, workspaceID uint, viewContent string, viewID string) string
BuildActiveTasksContext loads active/waiting tasks for the view's agents and formats them for the BAML prompt so the model can reason about what to approve, reject, or dispatch.
func (*Copilot) BuildViewDataContext ¶ added in v0.1.108
func (c *Copilot) BuildViewDataContext(ctx context.Context, viewID string, viewContent string, userMessage string) string
BuildViewDataContext loads relevant row data from MongoDB for a published view using vector search keyed on the user's message, and formats it as a readable text table for the BAML prompt. Falls back to recent rows if vector search is unavailable.
func (*Copilot) BuildWorkspaceContext ¶
func (*Copilot) ChatAvailable ¶ added in v0.1.112
func (*Copilot) CreateChatState ¶ added in v0.1.112
func (*Copilot) DeleteChatState ¶ added in v0.1.112
func (*Copilot) EnsureViewAgentsExist ¶ added in v0.1.117
func (c *Copilot) EnsureViewAgentsExist(ctx context.Context, workspaceID uint, viewContent string) []OperationResult
EnsureViewAgentsExist creates any agents referenced in the view that don't exist yet — handles the case where the model puts agent names in the view without emitting CREATE_AGENT operations.
func (*Copilot) ExecuteOperations ¶
func (*Copilot) FormatHistory ¶
func (c *Copilot) FormatHistory(messages []ChatMessage) string
func (*Copilot) GenerateStream ¶
func (c *Copilot) GenerateStream( ctx context.Context, cs *ChatState, workspaceID uint, userMessage string, viewID string, attachedFiles []AttachedFile, onChunk func(partial *PartialChatResponse), ) (*bamltypes.ViewDraftResponse, error)
func (*Copilot) IndexDraftCreated ¶
func (*Copilot) IndexDraftPublished ¶
func (*Copilot) IndexDraftPublishedAsync ¶ added in v0.1.107
func (*Copilot) ListDrafts ¶
func (*Copilot) LoadChatState ¶ added in v0.1.112
func (*Copilot) PersistChatMeta ¶ added in v0.1.112
Public persistence API — thin wrappers for callers.
func (*Copilot) PersistOperations ¶ added in v0.1.112
func (c *Copilot) PersistOperations(ctx context.Context, viewID string, results []OperationResult)
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)
func (*DataResolver) RunRows ¶ added in v0.1.123
func (r *DataResolver) RunRows( ctx context.Context, workspaceID uint, viewID string, sheet types.SheetSpec, comp types.ComponentSpec, limit int, opts ResolveOptions, ) (*types.ResolvedData, error)
RunRows runs BAML remapping for a limited set of rows in a sheet. If limit <= 0, all rows are remapped. Rows are processed in batches of 5.
func (*DataResolver) Store ¶
func (r *DataResolver) Store() *ViewStore
Store returns the ViewStore for direct access (used by the views API for cell edits).
type DetailLayoutResponse ¶ added in v0.1.110
type DetailLayoutResponse struct {
Sections []DetailSectionJSON `json:"sections" bson:"sections"`
Actions []ActionSpecJSON `json:"actions" bson:"actions"`
}
func ClassifyDetailTemplate ¶ added in v0.1.110
func ClassifyDetailTemplate(ctx context.Context, tableTitle string, columns []types.ColumnMeta) DetailLayoutResponse
func DetailTemplateForComponent ¶ added in v0.1.110
func DetailTemplateForComponent(comp *types.ComponentSpec) DetailLayoutResponse
func InferDetailTemplate ¶ added in v0.1.110
func InferDetailTemplate(columns []types.ColumnMeta) DetailLayoutResponse
func ResolveProjectedLayout ¶ added in v0.1.110
func ResolveProjectedLayout(template DetailLayoutResponse, projection DetailProjection) DetailLayoutResponse
type DetailProjection ¶ added in v0.1.110
type DetailProjection struct {
Surface DetailSurface
Blocker *types.ResolvedBlocker
Outputs []*types.TaskOutput
GalleryOutputs []*types.TaskOutput
ThreadOutputs []*types.TaskOutput
HasTask bool
HasSubtasks bool
IsTaskWaiting bool
IsTaskError bool
IsTaskActive bool
}
func ProjectDetail ¶ added in v0.1.110
func ProjectDetail(task *types.AgentTask, outputs []*types.TaskOutput, subtasks []*types.AgentTask) DetailProjection
type DetailSectionJSON ¶ added in v0.1.110
type DetailSurface ¶ added in v0.1.110
type DetailSurface string
const ( DetailSurfaceDetails DetailSurface = "details" DetailSurfaceConversation DetailSurface = "conversation" DetailSurfaceOutputs DetailSurface = "outputs" )
type DraftSummary ¶
type EmailThreadFetcher ¶ added in v0.1.110
type EmailThreadFetcher struct {
// contains filtered or unexported fields
}
func NewEmailThreadFetcher ¶ added in v0.1.110
func NewEmailThreadFetcher(backend repository.BackendRepository) *EmailThreadFetcher
func (*EmailThreadFetcher) FetchThreads ¶ added in v0.1.110
func (f *EmailThreadFetcher) FetchThreads(ctx context.Context, workspaceID uint, threadIDs []string) map[string][]ThreadMessage
type EmbeddingClient ¶ added in v0.1.125
type EmbeddingClient struct {
// contains filtered or unexported fields
}
func NewEmbeddingClient ¶ added in v0.1.125
func NewEmbeddingClient(apiKey string) *EmbeddingClient
func (*EmbeddingClient) Available ¶ added in v0.1.125
func (c *EmbeddingClient) Available() bool
func (*EmbeddingClient) Dims ¶ added in v0.1.125
func (c *EmbeddingClient) Dims() int
type EmbeddingUpdate ¶ added in v0.1.147
EmbeddingUpdate holds the fields needed to persist an embedding without touching any other row data (avoids overwriting concurrent cell updates).
type ExcludedRowSnapshot ¶ added in v0.1.108
type ExcludedRowSnapshot struct {
ComponentID string `bson:"component_id,omitempty"`
TaskID string `bson:"task_id"`
RowKey string `bson:"row_key"`
SourceOutputIDs []string `bson:"source_output_ids,omitempty"`
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 ImportParams ¶ added in v0.1.119
type ImportResult ¶ added in v0.1.119
type ImportResult struct {
ImportID string `json:"import_id"`
RowCount int `json:"row_count"`
ColumnCount int `json:"column_count"`
NewColumns []string `json:"new_columns,omitempty"`
ParseErrors []string `json:"parse_errors,omitempty"`
}
func ImportData ¶ added in v0.1.119
func ImportData(ctx context.Context, p ImportParams) (*ImportResult, error)
type OperationResult ¶
type OperationResult struct {
Type string `json:"type"`
Name string `json:"name"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
AgentID string `json:"agent_id,omitempty"`
TaskID string `json:"task_id,omitempty"`
AgentName string `json:"agent_name,omitempty"`
Message string `json:"message,omitempty"`
ScheduleID string `json:"schedule_id,omitempty"`
}
type PartialChatResponse ¶ added in v0.1.112
type ResolveOptions ¶
type RowDetailContext ¶ added in v0.1.110
type RowDetailContext struct {
ParentTaskID string
DetailTaskID string
SourceOutputIDs []string
Task *types.AgentTask
Outputs []*types.TaskOutput
Subtasks []*types.AgentTask
}
func ResolveRowDetailContext ¶ added in v0.1.110
func ResolveRowDetailContext( ctx context.Context, backend rowDetailContextBackend, workspaceID uint, parentTask *types.AgentTask, parentOutputs []*types.TaskOutput, row *ViewRow, ) (RowDetailContext, error)
type SearchCriterion ¶ added in v0.1.125
SearchCriterion is a column + value pair for targeted row lookups.
type SyncResult ¶ added in v0.1.125
SyncResult captures what happened across all sheets.
type ThreadMessage ¶ added in v0.1.110
type ThreadMessage struct {
ID string `json:"id"`
ThreadID string `json:"thread_id"`
From string `json:"from"`
To string `json:"to"`
Subject string `json:"subject"`
Body string `json:"body"`
Snippet string `json:"snippet"`
Date string `json:"date"`
Timestamp int64 `json:"timestamp"`
IsOutbound bool `json:"is_outbound"`
Labels []string `json:"labels,omitempty"`
Deeplink string `json:"deeplink,omitempty"`
}
type ToolWriteInput ¶ added in v0.1.125
type ToolWriteInput struct {
ViewID string
WorkspaceID uint
SourceSheetID string
SourceComponentID string
Cells map[string]string
RowID string
ForceInsert bool // skip candidate matching, always insert a new row
}
ToolWriteInput describes a write made by the view tool that should be propagated to other sheets in the same view via the full BAML pipeline.
type UpsertOpts ¶ added in v0.1.125
type UpsertOpts struct {
TaskID string
GroupID string
OutputID string
SchemaHash string
RowKey string // override auto-derived key
}
UpsertOpts carries optional metadata for UpsertRow. ViewSync passes these; ViewClient can leave them empty.
type VectorSearchResult ¶ added in v0.1.125
VectorSearchResult wraps a ViewRow with its similarity score.
type ViewRow ¶
type ViewRow struct {
ID string `bson:"_id"`
StableRef string `bson:"stable_ref,omitempty"`
SheetID string `bson:"sheet_id"`
ComponentID string `bson:"component_id,omitempty"`
Marker bool `bson:"marker,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"`
OutputSignature string `bson:"output_signature,omitempty"`
SourceOutputIDs []string `bson:"source_output_ids,omitempty"`
Cells map[string]string `bson:"cells"`
Manual map[string]string `bson:"manual,omitempty"`
Pinned map[string]string `bson:"pinned,omitempty"`
Source string `bson:"source,omitempty"`
ImportID string `bson:"import_id,omitempty"`
SearchText string `bson:"search_text,omitempty"`
Embedding []float64 `bson:"embedding,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 the three-layer merge: pinned (import seed) -> cells (BAML-computed) -> manual (user edits).
type ViewStore ¶
type ViewStore struct {
// contains filtered or unexported fields
}
func NewViewStore ¶
func NewViewStore(mongo *common.MongoClient, openAIKey string) *ViewStore
func (*ViewStore) BulkUpdateEmbeddings ¶ added in v0.1.147
func (s *ViewStore) BulkUpdateEmbeddings(ctx context.Context, viewID string, updates []EmbeddingUpdate) error
BulkUpdateEmbeddings writes search_text and embedding for many rows in a single bulk operation. Only those two fields are $set — cells, pinned, manual etc. are untouched, eliminating the read-modify-write race in EmbedRowsAsync.
func (*ViewStore) CleanupStaleImportRows ¶ added in v0.1.119
func (s *ViewStore) CleanupStaleImportRows(ctx context.Context, viewID, sheetID, componentID string, keepIDs []string) (int64, error)
CleanupStaleImportRows removes import-source rows that weren't part of the current import batch. Called after upsert so valid rows are already written — this cleans up orphans from previous imports (different row count or legacy ID format) without a destructive delete-before-insert window.
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. Import-sourced rows are skipped — their pinned values are never cleared.
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) DeleteImport ¶ added in v0.1.112
DeleteImport removes all rows from a specific import batch.
func (*ViewStore) DeleteRowsByIDs ¶ added in v0.1.112
DeleteRowsByIDs removes specific rows by their document IDs.
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. Import-sourced rows are always protected from deletion.
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) EmbedRowsAsync ¶ added in v0.1.145
EmbedRowsAsync kicks off embedding generation in the background for the given view.
func (*ViewStore) Embedder ¶ added in v0.1.125
func (s *ViewStore) Embedder() *EmbeddingClient
func (*ViewStore) EnrichImportRow ¶ added in v0.1.112
EnrichImportRow updates the Cells and task association on an existing import row without changing its Pinned values or identity.
func (*ViewStore) EnsureIndexes ¶ added in v0.1.110
EnsureIndexes creates indexes required for the view collection, including a unique index on stable_ref.
func (*ViewStore) EnsureVectorIndex ¶ added in v0.1.125
EnsureVectorIndex creates the vectorSearch index for a view collection if it doesn't already exist. Safe to call repeatedly — it's a no-op when the index is already present.
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) FindByStableRef ¶ added in v0.1.125
func (s *ViewStore) FindByStableRef(ctx context.Context, viewID, sheetID, ref string) (*ViewRow, error)
FindByStableRef looks up a row by its stable_ref within a sheet scope. Returns nil if not found.
func (*ViewStore) FindRowByKey ¶ added in v0.1.124
func (s *ViewStore) FindRowByKey(ctx context.Context, viewID, sheetID, componentID, rowKey string) (*ViewRow, error)
FindRowByKey looks up a row by its normalized row_key within a specific sheet/component scope. Returns nil if not found.
func (*ViewStore) FindRows ¶ added in v0.1.125
func (s *ViewStore) FindRows(ctx context.Context, viewID, sheetID, column, value string, limit int) ([]ViewRow, error)
FindRows performs an indexed text search for rows matching a column/value pair within a sheet scope. Uses regex-based SearchRows under the hood.
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) GetRowByID ¶ added in v0.1.110
GetRowByID loads a row by _id only (no sheet filter). Used for detail layout cache lookups.
func (*ViewStore) GetRowTaskIndex ¶ added in v0.1.145
GetRowTaskIndex loads only the _id, task_id, and thread_id fields from all rows in a view. Used by the mailbox to map tasks to rows without loading full cell data.
func (*ViewStore) GetRowsBySource ¶ added in v0.1.112
func (s *ViewStore) GetRowsBySource(ctx context.Context, viewID, sheetID, componentID, source string) ([]ViewRow, error)
GetRowsBySource returns rows filtered by source (e.g. "import") within a component scope.
func (*ViewStore) GetRowsForMailbox ¶ added in v0.1.145
GetRowsForMailbox loads all rows with cell data but excludes the large embedding and search_text fields. The mailbox needs MergedCells() for thread_id extraction and row labels.
func (*ViewStore) GetRowsPage ¶ added in v0.1.145
func (s *ViewStore) GetRowsPage(ctx context.Context, viewID, sheetID, componentID string, offset, limit int) ([]ViewRow, int, error)
GetRowsPage returns a paginated slice of rows and the total count. Uses MongoDB Skip/Limit for server-side pagination.
func (*ViewStore) GetWidgetRows ¶ added in v0.1.108
GetWidgetRows loads all widget rows for a sheet.
func (*ViewStore) MergeCells ¶ added in v0.1.123
func (s *ViewStore) MergeCells(ctx context.Context, viewID, rowID string, newCells map[string]string, outputID string) error
MergeCells performs a cell-level merge on an existing row's computed cells. Only non-empty values in newCells are written; empty strings are skipped (meaning "leave the existing value as-is"). The outputID is appended to the row's output tracking arrays.
func (*ViewStore) ReembedRow ¶ added in v0.1.125
ReembedRow fetches the latest state of a row, recomputes its search_text and embedding, and writes them back. Call after MergeCells to keep the vector index current. No-op if the embedder is not configured.
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) SearchRows ¶ added in v0.1.125
func (s *ViewStore) SearchRows(ctx context.Context, viewID, sheetID, componentID string, criteria []SearchCriterion, maxResults int) ([]ViewRow, error)
SearchRows finds rows where any cell (cells or pinned) matches one of the search criteria using case-insensitive regex. Returns at most maxResults rows. This enables targeted lookups instead of loading the entire collection.
func (*ViewStore) SearchRowsText ¶ added in v0.1.145
func (s *ViewStore) SearchRowsText(ctx context.Context, viewID, sheetID, componentID, query string, offset, limit int) ([]ViewRow, int, error)
SearchRowsText performs a case-insensitive free-text search across the search_text field (populated by autoEmbed) and falls back to a regex scan across all cell values. Returns paginated results with total count.
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) UpdateRow ¶ added in v0.1.125
func (s *ViewStore) UpdateRow(ctx context.Context, viewID, rowID string, cells map[string]string, outputID string) error
UpdateRow merges cells into an existing row and recomputes its embedding. A convenience wrapper around MergeCells + ReembedRow.
func (*ViewStore) UpdateRowEmbedding ¶ added in v0.1.125
func (s *ViewStore) UpdateRowEmbedding(ctx context.Context, viewID, rowID string, searchText string, embedding []float64) error
UpdateRowEmbedding recomputes and stores the search_text and embedding for a single row. Call after MergeCells to keep the vector index current.
func (*ViewStore) UpdateSchemaHash ¶ added in v0.1.110
func (s *ViewStore) UpdateSchemaHash(ctx context.Context, viewID, sheetID, componentID, schemaHash string) error
UpdateSchemaHash stamps a new schema_hash on all rows in a component scope without remapping cells. Used when columns are added — missing cell keys render as empty so no cell mutation is needed.
func (*ViewStore) UpsertRow ¶ added in v0.1.125
func (s *ViewStore) UpsertRow(ctx context.Context, viewID, sheetID, componentID string, cells map[string]string, opts UpsertOpts) (string, bool, error)
UpsertRow is the single entry point for creating or merging a row. It derives the row key from cells (schema-agnostic), normalizes it, sets StableRef, checks for an existing row via FindRowByKey / FindByStableRef, and either merges into the existing row or creates a new one. Returns (rowID, created, error).
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. Automatically computes embeddings for rows that don't already have them when an embedding client is configured.
func (*ViewStore) UpsertRowsNoEmbed ¶ added in v0.1.145
UpsertRowsNoEmbed inserts/updates rows without running embeddings. Use when embeddings will be generated asynchronously (e.g. during large imports).
func (*ViewStore) UpsertWidgetRow ¶ added in v0.1.108
UpsertWidgetRow writes a single widget row.
func (*ViewStore) VectorSearch ¶ added in v0.1.125
func (s *ViewStore) VectorSearch(ctx context.Context, viewID, sheetID string, queryEmbedding []float64, limit int) ([]VectorSearchResult, error)
VectorSearch runs a $vectorSearch aggregation against the view collection. Returns up to `limit` rows pre-filtered by sheetID, ranked by cosine similarity.
type ViewSync ¶ added in v0.1.125
type ViewSync struct {
// contains filtered or unexported fields
}
func NewViewSync ¶ added in v0.1.125
func NewViewSync(opts ViewSyncOpts) *ViewSync
func (*ViewSync) ClassifyFloor ¶ added in v0.1.139
func (*ViewSync) HighMatchThreshold ¶ added in v0.1.125
func (*ViewSync) Sync ¶ added in v0.1.125
func (vs *ViewSync) Sync(ctx context.Context, output *types.TaskOutput) *SyncResult
Sync is the top-level entry point. It loads all schema contexts for the view and runs syncSchema for every sheet. Vector search + BAML determine relevance per sheet — there is no hardcoded output-type gating.
func (*ViewSync) SyncToolWrite ¶ added in v0.1.125
func (vs *ViewSync) SyncToolWrite(ctx context.Context, input ToolWriteInput) *SyncResult
SyncToolWrite propagates a view-tool write to all other sheets in the view using the same vector search + BAML pipeline as Sync. The source sheet (already written by the tool) is excluded.
type ViewSyncOpts ¶ added in v0.1.125
type ViewSyncOpts struct {
Store *ViewStore
Backend repository.BackendRepository
Config types.ViewSyncConfig
}
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.