webui

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLibraryViewModel

func BuildLibraryViewModel(projectPath string) (ui.LibraryViewModel, error)

BuildLibraryViewModel reads a CLI-generated project's library into the cockpit library view model. A project without a library yields an empty view model and is not treated as an error.

func NewArtifactsHandler

func NewArtifactsHandler(state ArtifactDashboardState) http.Handler

NewArtifactsHandler renders CLI-generated papers, analyses, diagrams, and reports.

func NewCreateProjectHandler

func NewCreateProjectHandler() http.Handler

NewCreateProjectHandler creates a local project workspace from an HTMX form post.

func NewForgeHomeHandler

func NewForgeHomeHandler(state ForgeHomeState) http.Handler

NewForgeHomeHandler renders the Forge home timeline.

func NewInformationArchitectureHandler

func NewInformationArchitectureHandler(state DashboardInformationArchitecture) http.Handler

func NewLabNotebookHandler

func NewLabNotebookHandler(state LabNotebookTimelineState) http.Handler

func NewLibraryHandler

func NewLibraryHandler(state ui.LibraryViewModel) http.Handler

NewLibraryHandler renders the HTMX library screen from the shared library view model.

func NewOSSHandler

func NewOSSHandler(state ui.OSSDashboardViewModel) http.Handler

NewOSSHandler renders OSS repository studies from the shared OSS dashboard view model.

func NewOpenProjectHandler

func NewOpenProjectHandler() http.Handler

NewOpenProjectHandler opens an existing local project workspace from an HTMX form post.

func NewParserConflictReviewHandler

func NewParserConflictReviewHandler(state ParserConflictReviewState) http.Handler

func NewPrivacyModelHandler

func NewPrivacyModelHandler(state DashboardPrivacyModel) http.Handler

func NewProjectHandler

func NewProjectHandler() http.Handler

NewProjectHandler renders the HTMX create/open project screen.

func NewResearchMapHandler

func NewResearchMapHandler(state ResearchMapCockpitState) http.Handler

func NewRouter

func NewRouter(cfg Config) http.Handler

NewRouter builds the local research cockpit HTTP handler. View models are rebuilt per request from the active project folder so the dashboard always reflects current CLI-generated state. The CLI remains the authoritative automation path; this router only visualizes project state.

func NewScreeningCockpitHandler

func NewScreeningCockpitHandler(state ScreeningCockpitState) http.Handler

NewScreeningCockpitHandler renders the HTMX screening cockpit.

func NewSearchHandler

func NewSearchHandler(state ui.SearchFormState) http.Handler

NewSearchHandler renders the HTMX search screen from the shared search view model.

func NewShellHandler

func NewShellHandler() http.Handler

NewShellHandler returns the dependency-light local web GUI shell handler.

func NewSourcePlanningHandler

func NewSourcePlanningHandler() http.Handler

NewSourcePlanningHandler renders the source-planning cockpit over protocol compiler output.

func NewWorkbenchIndexHandler

func NewWorkbenchIndexHandler(state WorkbenchIndexState) http.Handler

func Routes

func Routes() []string

Routes returns the sorted list of top-level routes the dashboard serves. It is used by `rforge ui --json` and tests to describe the dashboard surface without binding a port.

Types

type AcquisitionQueueState

type AcquisitionQueueState struct {
	ProjectPath string
	QueuePath   string
	Items       []documents.LegalAcquisitionQueueItem
}

func BuildAcquisitionQueueState

func BuildAcquisitionQueueState(projectPath string) AcquisitionQueueState

type AnalysisDetail

type AnalysisDetail struct {
	Ready         bool
	RunID         string
	I2            float64
	Tau2          float64
	Q             float64
	HasForestPlot bool
	HasFunnelPlot bool
	Warnings      []string
}

AnalysisDetail surfaces a stored meta-analysis result for the cockpit: heterogeneity metrics, plot availability, and runner warnings.

type AnalysisWorkbenchState

type AnalysisWorkbenchState struct {
	ProjectPath string
	Runs        []analysis.AnalysisRun
	Manifests   []analysis.AnalysisArtifactManifest
}

func BuildAnalysisWorkbenchState

func BuildAnalysisWorkbenchState(projectPath string) AnalysisWorkbenchState

type ArtifactDashboardState

type ArtifactDashboardState struct {
	Papers         ui.LibraryViewModel
	Analysis       ui.AnalysisViewModel
	AnalysisDetail AnalysisDetail
	CitationGraph  ui.CitationGraphViewModel
	PRISMA         PRISMAFlowState
	Reports        ui.ReportViewModel
}

ArtifactDashboardState combines CLI-generated outputs for the local web GUI.

func BuildArtifactDashboardState

func BuildArtifactDashboardState(projectPath string) (ArtifactDashboardState, error)

BuildArtifactDashboardState assembles the artifacts cockpit view from a CLI-generated project workspace: imported papers, screening-derived PRISMA counts, and meta-analysis readiness.

func (ArtifactDashboardState) CitationGraphSVG

func (s ArtifactDashboardState) CitationGraphSVG() template.HTML

CitationGraphSVG renders a small accessible SVG preview for exported citation graphs.

type Config

type Config struct {
	// ProjectPath is the initial research project folder the dashboard reads
	// CLI-generated artifacts (library, screening, analysis, citation graph,
	// PDFs) from. It can be changed at runtime via the in-browser project
	// switcher. An empty path serves the shell and project create/open forms.
	ProjectPath string
}

Config configures the local research cockpit server.

type DashboardInformationArchitecture

type DashboardInformationArchitecture struct {
	SchemaVersion       string              `json:"schemaVersion"`
	Diagram             []string            `json:"diagram"`
	Routes              []DashboardRoute    `json:"routes"`
	BackgroundJobs      []DashboardJob      `json:"backgroundJobs"`
	OwnershipBoundaries []OwnershipBoundary `json:"ownershipBoundaries"`
}

func BuildDashboardInformationArchitecture

func BuildDashboardInformationArchitecture() DashboardInformationArchitecture

func (DashboardInformationArchitecture) HasRoute

func (ia DashboardInformationArchitecture) HasRoute(path string) bool

type DashboardJob

type DashboardJob struct{ Name, Trigger, StatusArtifact string }

type DashboardPrivacyModel

type DashboardPrivacyModel struct {
	SchemaVersion string
	Assets        []PrivacyAsset
}

func BuildDashboardPrivacyModel

func BuildDashboardPrivacyModel() DashboardPrivacyModel

func (DashboardPrivacyModel) HasAsset

func (m DashboardPrivacyModel) HasAsset(name string) bool

type DashboardRoute

type DashboardRoute struct {
	Path         string `json:"path"`
	Partial      string `json:"partial"`
	ViewModel    string `json:"viewModel"`
	NoJSFallback string `json:"noJsFallback"`
	Owner        string `json:"owner"`
}

type DedupeReviewState

type DedupeReviewState struct {
	ProjectPath string
	Records     []library.PaperRecord
	Clusters    []library.IdentityCluster
	Conflicts   []library.IdentityConflictRecord
	DecisionLog library.IdentityDecisionLog
	PRISMA      PRISMAFlowState
	AuditEvents []provenance.Event
}

DedupeReviewState powers the visual identity-cluster review screen.

func BuildDedupeReviewState

func BuildDedupeReviewState(projectPath string) (DedupeReviewState, error)

BuildDedupeReviewState reads identity clusters, reversible decision history, conflict records, PRISMA counts, and audit provenance for the dedupe cockpit.

type EvidenceCoverageSummary

type EvidenceCoverageSummary struct {
	Accepted  int `json:"accepted"`
	Suggested int `json:"suggested"`
	Other     int `json:"other"`
}

type EvidenceGridState

type EvidenceGridState struct {
	ProjectPath string
	GridPath    string
	Rows        []evidence.ExtractionGridRow
}

func BuildEvidenceGridState

func BuildEvidenceGridState(projectPath string) EvidenceGridState

type ForgeBackgroundJob

type ForgeBackgroundJob struct{ ID, Status, Command string }

type ForgeGate

type ForgeGate struct{ Gate, Reason string }

type ForgeHomeState

type ForgeHomeState struct {
	ActiveProject      string
	ProjectTitle       string
	CurrentState       string
	ProvenanceEvents   []provenance.Event
	BlockedReviewGates []ForgeGate
	BackgroundJobs     []ForgeBackgroundJob
	NextSafeActions    []ForgeNextAction
}

func BuildForgeHomeState

func BuildForgeHomeState(projectPath string) (ForgeHomeState, error)

BuildForgeHomeState assembles the Forge home timeline from project-local state, provenance, background jobs, blocked review gates, and next actions.

type ForgeNextAction

type ForgeNextAction struct{ Label, CLI string }

type GraphJSON

type GraphJSON struct {
	Nodes []GraphJSONNode `json:"nodes"`
	Edges []GraphJSONEdge `json:"edges"`
}

GraphJSON is the data payload the vendored citation-graph.js fetches and renders interactively. It is built from the same project citation graph the server-rendered SVG fallback uses.

func BuildCitationGraphJSON

func BuildCitationGraphJSON(projectPath string) (GraphJSON, error)

BuildCitationGraphJSON assembles the interactive-client graph payload from the project's exported citation graph (data/citation-graph.json).

type GraphJSONEdge

type GraphJSONEdge struct {
	Source string `json:"source"`
	Target string `json:"target"`
}

GraphJSONEdge is one directed citation edge (citing -> referenced).

type GraphJSONNode

type GraphJSONNode struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	Stem  string `json:"stem"`
	Href  string `json:"href"`
}

GraphJSONNode is one citation-graph node delivered to the interactive client. Stem/Href let the browser link a node to its /papers/{id} reading page without re-implementing the CLI's safe-stem normalization.

type LabNotebookEvent

type LabNotebookEvent struct {
	ID        string         `json:"id"`
	Timestamp string         `json:"timestamp"`
	Actor     string         `json:"actor"`
	ActorKind string         `json:"actorKind"`
	Category  string         `json:"category"`
	Action    string         `json:"action"`
	Target    string         `json:"target"`
	Inputs    map[string]any `json:"inputs,omitempty"`
	Outputs   map[string]any `json:"outputs,omitempty"`
	Warnings  []string       `json:"warnings,omitempty"`
}

type LabNotebookTimelineState

type LabNotebookTimelineState struct {
	SchemaVersion   string             `json:"schemaVersion"`
	ProjectPath     string             `json:"projectPath"`
	TotalEvents     int                `json:"totalEvents"`
	HumanEvents     int                `json:"humanEvents"`
	AutomatedEvents int                `json:"automatedEvents"`
	Events          []LabNotebookEvent `json:"events"`
	SnapshotPath    string             `json:"snapshotPath"`
}

func BuildLabNotebookTimelineState

func BuildLabNotebookTimelineState(projectPath string) (LabNotebookTimelineState, error)

type OwnershipBoundary

type OwnershipBoundary struct{ Area, Boundary string }

type PRISMAFlowState

type PRISMAFlowState struct {
	Records  int
	Screened int
	Included int
}

PRISMAFlowState summarizes CLI-generated screening counts for the web artifacts view.

type PackageExportCenterState

type PackageExportCenterState struct {
	ProjectPath          string
	PackageContents      []string
	RedactionResults     []string
	Checksums            []string
	Lockfiles            []string
	ExternalToolVersions []string
	ParserManifests      []string
	AnalysisArtifacts    []string
	ReportOutputs        []string
	ReviewerDecisionLogs []string
}

func BuildPackageExportCenterState

func BuildPackageExportCenterState(projectPath string) PackageExportCenterState

type PaperListViewModel

type PaperListViewModel struct {
	Papers []PaperSummary
	Empty  bool
}

PaperListViewModel lists parsed papers available to read in the dashboard.

func BuildPaperList

func BuildPaperList(projectPath string) (PaperListViewModel, error)

BuildPaperList reads the project's parsed/ directory into a readable paper list. A project without parsed documents yields an empty, non-error model.

type PaperSummary

type PaperSummary struct {
	ID           string
	Title        string
	Authors      string
	PassageCount int
	HasPDF       bool
}

PaperSummary is one readable paper in the cockpit paper list.

type PaperView

type PaperView struct {
	ID       string
	Title    string
	Authors  string
	Abstract string
	Sections []parsing.Section
	HasPDF   bool
	Warnings []string
}

PaperView is the per-paper reading view: parsed structure plus an optional project-local PDF rendered natively by the browser.

func BuildPaperView

func BuildPaperView(projectPath, id string) (PaperView, bool, error)

BuildPaperView loads a single parsed paper for the reading view. ok is false when no parsed document exists for the id.

type ParserArbitrationFieldRow

type ParserArbitrationFieldRow struct {
	Field      string
	ParserName string
	Confidence string
	RawText    string
	Offsets    string
	Warnings   string
}

type ParserConflictReviewState

type ParserConflictReviewState struct {
	Parsers             []string
	ParserLabels        map[string]string
	Fields              []ParserArbitrationFieldRow
	Controls            []string
	ReviewerRequired    bool
	AutoAcceptConflicts bool
	CLIEquivalent       string
}

func BuildParserConflictReviewState

func BuildParserConflictReviewState() ParserConflictReviewState

func (ParserConflictReviewState) HasParser

func (s ParserConflictReviewState) HasParser(name string) bool

type PrivacyAsset

type PrivacyAsset struct{ Name, DefaultPermission, ExportRule, ReviewGate, UIBehavior string }

type ReportClaimPanelState

type ReportClaimPanelState struct {
	ProjectPath      string
	PanelPath        string
	Rows             []reportpkg.ClaimTracePanelRow
	BlockFinalExport bool
	Blockers         []string
}

func BuildReportClaimPanelState

func BuildReportClaimPanelState(projectPath string) ReportClaimPanelState

type ResearchMapCockpitState

type ResearchMapCockpitState struct {
	SchemaVersion         string                  `json:"schemaVersion"`
	ProjectPath           string                  `json:"projectPath"`
	Filter                string                  `json:"filter,omitempty"`
	Neighborhood          string                  `json:"neighborhood,omitempty"`
	ConceptMap            []ResearchMapItem       `json:"conceptMap"`
	CitationNeighborhoods []ResearchMapItem       `json:"citationNeighborhoods"`
	RetrievalClusters     []ResearchMapItem       `json:"retrievalClusters"`
	RetrievalHits         []ResearchMapItem       `json:"retrievalHits,omitempty"`
	ScreeningPriority     []ResearchMapItem       `json:"screeningPriority,omitempty"`
	ScreeningStatus       []ResearchMapItem       `json:"screeningStatus,omitempty"`
	ParserQuality         []ResearchMapItem       `json:"parserQuality,omitempty"`
	EvidenceCoverage      EvidenceCoverageSummary `json:"evidenceCoverage"`
	ProvenanceOverlays    []ResearchMapItem       `json:"provenanceOverlays,omitempty"`
	KeyboardAlternatives  []string                `json:"keyboardAlternatives"`
	SnapshotExportPath    string                  `json:"snapshotExportPath"`
}

func BuildResearchMapCockpitState

func BuildResearchMapCockpitState(projectPath string) (ResearchMapCockpitState, error)

func BuildResearchMapCockpitStateWithOptions

func BuildResearchMapCockpitStateWithOptions(projectPath string, opts ResearchMapOptions) (ResearchMapCockpitState, error)

type ResearchMapItem

type ResearchMapItem struct {
	ID     string `json:"id"`
	Label  string `json:"label"`
	Detail string `json:"detail"`
}

type ResearchMapOptions

type ResearchMapOptions struct {
	Filter, Neighborhood string
	IncludeProvenance    bool
}

type RetrievalTuningState

type RetrievalTuningState struct {
	ProjectPath          string
	Query                string
	Backends             []retrieval.RetrievalBackendBenchmark
	QueryResults         []retrieval.RetrievalBenchmarkQueryResult
	PrivacyNotes         []string
	ReproducibilityNotes []string
	CLIEquivalent        string
}

func BuildRetrievalTuningState

func BuildRetrievalTuningState(projectPath string) RetrievalTuningState

type ScreeningCockpitState

type ScreeningCockpitState struct {
	ProjectPath         string
	Stage               screening.Stage
	TotalRecords        int
	ActiveRunID         string
	ActiveLearningQueue []screening.PrioritizedRecord
	UncertaintyQueue    []screening.PrioritizedRecord
	UncertainQueue      []screening.UncertainQueueItem
	Progress            screening.ProgressReport
	Stopping            screening.StoppingRecommendation
	HasAuditBundle      bool
	AuditBundlePath     string
}

ScreeningCockpitState combines active-learning, uncertainty, progress, stopping, and audit-bundle state for the HTMX screening cockpit.

func BuildScreeningCockpitState

func BuildScreeningCockpitState(projectPath string) (ScreeningCockpitState, error)

BuildScreeningCockpitState reads screening decisions and library records into the HTMX screening cockpit: active-learning queue, uncertainty/exploration flags, progress metrics, stopping diagnostics, and audit-bundle links.

type ScreenshotDiff

type ScreenshotDiff struct {
	// SameBounds is false when the images differ in size (always a regression).
	SameBounds bool
	// DiffRatio is the fraction of pixels (0..1) that differ by more than
	// screenshotChannelThreshold on any channel. Only meaningful when SameBounds.
	DiffRatio float64
}

ScreenshotDiff summarizes a pixel comparison between two PNG screenshots.

type WorkbenchCard

type WorkbenchCard struct{ Label, Route, Purpose, CLI, Fallback string }

type WorkbenchIndexState

type WorkbenchIndexState struct{ Workbenches []WorkbenchCard }

func BuildWorkbenchIndexState

func BuildWorkbenchIndexState() WorkbenchIndexState

func (WorkbenchIndexState) Has

func (s WorkbenchIndexState) Has(label string) bool

Jump to

Keyboard shortcuts

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