Documentation
¶
Index ¶
- Constants
- Variables
- type AnswerRequest
- type CompileRequest
- type CreateJobRequest
- type Event
- type EventPublisher
- type Handler
- func (h *Handler) CancelJob(c echo.Context) error
- func (h *Handler) CreateJob(c echo.Context) error
- func (h *Handler) GetIndex(c echo.Context) error
- func (h *Handler) GetJob(c echo.Context) error
- func (h *Handler) GetLatestLint(c echo.Context) error
- func (h *Handler) GetLog(c echo.Context) error
- func (h *Handler) GetPage(c echo.Context) error
- func (h *Handler) GetReport(c echo.Context) error
- func (h *Handler) GetSchema(c echo.Context) error
- func (h *Handler) ListJobs(c echo.Context) error
- func (h *Handler) ListPages(c echo.Context) error
- func (h *Handler) PromoteQuery(c echo.Context) error
- func (h *Handler) RegisterGroup(g *echo.Group)
- func (h *Handler) RegisterRoutes(e *echo.Echo)
- func (h *Handler) SetJobCreator(creator interface{ ... })
- func (h *Handler) StreamEvents(c echo.Context) error
- func (h *Handler) UpdateSchema(c echo.Context) error
- type IssueKind
- type JobKind
- type JobStatus
- type KnowledgeAnswerReport
- type KnowledgeArchivedAnswer
- type KnowledgeAuthor
- type KnowledgeAuthorRequest
- type KnowledgeAuthorResult
- type KnowledgeCitation
- type KnowledgeCompileReport
- type KnowledgeConfidence
- type KnowledgeConflictRepairReport
- type KnowledgeIngestReport
- type KnowledgeJob
- type KnowledgeJobReport
- type KnowledgeJobSummary
- type KnowledgeLintReport
- type KnowledgeLogEntry
- type KnowledgePage
- type KnowledgePageSummary
- type KnowledgeSchemaDocument
- type KnowledgeStatus
- type LintIssue
- type LintRequest
- type LoopContextRequest
- type LoopContextResult
- type LoopContextSnippet
- type LoopContextStage
- type MemorySink
- type PromoteQueryResult
- type RepairConflictsRequest
- type Service
- func (s *Service) Answer(ctx context.Context, req AnswerRequest) (*KnowledgeAnswerReport, error)
- func (s *Service) CancelJob(id string) error
- func (s *Service) CancelJobForUser(id, userID, tenantID string) error
- func (s *Service) Compile(ctx context.Context, req CompileRequest) (*KnowledgeCompileReport, error)
- func (s *Service) CreateJob(ctx context.Context, req CreateJobRequest) (*KnowledgeJob, error)
- func (s *Service) GetIndexMarkdown(_ context.Context) (string, error)
- func (s *Service) GetJob(id string) (*KnowledgeJob, error)
- func (s *Service) GetJobForUser(id, userID, tenantID string) (*KnowledgeJob, error)
- func (s *Service) GetLatestLint(_ context.Context) (*KnowledgeLintReport, error)
- func (s *Service) GetLog(_ context.Context, limit int) ([]KnowledgeLogEntry, error)
- func (s *Service) GetPage(_ context.Context, slug string) (*KnowledgePage, error)
- func (s *Service) GetReport(id string) (*KnowledgeJobReport, error)
- func (s *Service) GetReportForUser(id, userID, tenantID string) (*KnowledgeJobReport, error)
- func (s *Service) GetSchema(_ context.Context) (*KnowledgeSchemaDocument, error)
- func (s *Service) HasCompiledKnowledge() bool
- func (s *Service) Lint(ctx context.Context, req LintRequest) (*KnowledgeLintReport, error)
- func (s *Service) ListJobsForUser(userID, tenantID string, activeOnly bool) ([]KnowledgeJobSummary, error)
- func (s *Service) ListPages(_ context.Context) ([]KnowledgePageSummary, error)
- func (s *Service) PromoteQuery(ctx context.Context, jobID string) (*KnowledgePageSummary, error)
- func (s *Service) RepairConflicts(ctx context.Context, req RepairConflictsRequest) (*KnowledgeConflictRepairReport, error)
- func (s *Service) ResolveLoopContext(ctx context.Context, req LoopContextRequest) (*LoopContextResult, error)
- func (s *Service) RetrieveAnswer(ctx context.Context, query string) (string, error)
- func (s *Service) RetrieveContext(ctx context.Context, query string, limit int) (string, error)
- func (s *Service) Subscribe(jobID string) (<-chan Event, func(), error)
- func (s *Service) SubscribeForUser(jobID, userID, tenantID string) (<-chan Event, func(), error)
- func (s *Service) UpdateSchema(_ context.Context, content string) (*KnowledgeSchemaDocument, error)
- type ServiceOptions
- type SourceSnapshot
Constants ¶
View Source
const ( PageTypeSourceSummary = "source_summary" PageTypeEntity = "entity" PageTypeConcept = "concept" PageTypeComparison = "comparison" PageTypeSynthesis = "synthesis" PageTypeDecision = "decision" )
Variables ¶
View Source
var ( ErrJobNotFound = errors.New("knowledge job not found") ErrJobForbidden = errors.New("knowledge job forbidden") ErrReportNotReady = errors.New("knowledge report not ready") ErrJobAlreadyTerminal = errors.New("knowledge job already terminal") ErrPageNotFound = errors.New("knowledge page not found") )
Functions ¶
This section is empty.
Types ¶
type AnswerRequest ¶
type CompileRequest ¶
type CreateJobRequest ¶
type CreateJobRequest struct {
RequestedID string `json:"requested_id,omitempty"`
UserID string `json:"user_id,omitempty"`
TenantID string `json:"tenant_id,omitempty"`
ProviderID string `json:"provider_id,omitempty"`
Query string `json:"query,omitempty"`
Kind JobKind `json:"kind"`
TargetPaths []string `json:"target_paths,omitempty"`
TargetSlugs []string `json:"target_slugs,omitempty"`
PageSlug string `json:"page_slug,omitempty"`
ArchiveAnswer bool `json:"archive_answer,omitempty"`
QueryScope string `json:"query_scope,omitempty"`
SelectedRefs []string `json:"selected_refs,omitempty"`
}
type EventPublisher ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) RegisterGroup ¶
func (*Handler) RegisterRoutes ¶
func (*Handler) SetJobCreator ¶
func (h *Handler) SetJobCreator(creator interface { CreateJob(ctx context.Context, req CreateJobRequest) (*KnowledgeJob, error) })
type IssueKind ¶
type IssueKind string
const ( IssueKindStaleHash IssueKind = "stale_hash" IssueKindOrphanPage IssueKind = "orphan_page" IssueKindDuplicateTopic IssueKind = "duplicate_topic" IssueKindMissingBacklinks IssueKind = "missing_backlinks" IssueKindLowQuality IssueKind = "low_quality" IssueKindMissingIndex IssueKind = "missing_index" IssueKindConflictingClaim IssueKind = "conflicting_claim" IssueKindInsufficientSrc IssueKind = "insufficient_sources" IssueKindMissingConcept IssueKind = "missing_concept_page" IssueKindMissingEntity IssueKind = "missing_entity_page" )
type KnowledgeAnswerReport ¶
type KnowledgeAnswerReport struct {
GeneratedAt time.Time `json:"generated_at"`
Query string `json:"query"`
Answer string `json:"answer"`
Citations []KnowledgeCitation `json:"citations"`
RelatedPages []KnowledgePageSummary `json:"related_pages,omitempty"`
ArchivedPath string `json:"archived_path,omitempty"`
Confidence KnowledgeConfidence `json:"confidence,omitempty"`
ConflictNotes []string `json:"conflict_notes,omitempty"`
OpenQuestions []string `json:"open_questions,omitempty"`
PromotedPageSlug string `json:"promoted_page_slug,omitempty"`
}
type KnowledgeArchivedAnswer ¶
type KnowledgeAuthor ¶
type KnowledgeAuthor interface {
AuthorDelta(ctx context.Context, req KnowledgeAuthorRequest) (*KnowledgeAuthorResult, error)
}
type KnowledgeAuthorRequest ¶
type KnowledgeAuthorRequest struct {
Schema string
Source SourceSnapshot
ExistingPages []KnowledgePageSummary
GeneratedAt time.Time
WorkspaceRoot string
}
type KnowledgeAuthorResult ¶
type KnowledgeAuthorResult struct {
Pages []KnowledgePage
Conflicts []string
Gaps []string
FallbackMode bool
}
type KnowledgeCitation ¶
type KnowledgeCompileReport ¶
type KnowledgeCompileReport = KnowledgeIngestReport
type KnowledgeConfidence ¶
type KnowledgeConfidence string
const ( KnowledgeConfidenceLow KnowledgeConfidence = "low" KnowledgeConfidenceMedium KnowledgeConfidence = "medium" KnowledgeConfidenceHigh KnowledgeConfidence = "high" )
type KnowledgeConflictRepairReport ¶
type KnowledgeConflictRepairReport struct {
GeneratedAt time.Time `json:"generated_at"`
CanonicalPages []KnowledgePageSummary `json:"canonical_pages,omitempty"`
SupersededPages []KnowledgePageSummary `json:"superseded_pages,omitempty"`
FixedPaths []string `json:"fixed_paths,omitempty"`
Lint *KnowledgeLintReport `json:"lint,omitempty"`
}
type KnowledgeIngestReport ¶
type KnowledgeIngestReport struct {
GeneratedAt time.Time `json:"generated_at"`
Pages []KnowledgePageSummary `json:"pages"`
NewPages []KnowledgePageSummary `json:"new_pages,omitempty"`
UpdatedPages []KnowledgePageSummary `json:"updated_pages,omitempty"`
SkippedSources []string `json:"skipped_sources,omitempty"`
Conflicts []string `json:"conflicts,omitempty"`
Gaps []string `json:"gaps,omitempty"`
ManifestPath string `json:"manifest_path"`
IndexPath string `json:"index_path"`
SchemaPath string `json:"schema_path"`
LogPath string `json:"log_path"`
FallbackMode bool `json:"fallback_mode,omitempty"`
}
type KnowledgeJob ¶
type KnowledgeJob struct {
ID string `json:"id"`
UserID string `json:"user_id,omitempty"`
TenantID string `json:"tenant_id,omitempty"`
ProviderID string `json:"provider_id,omitempty"`
Query string `json:"query,omitempty"`
Kind JobKind `json:"kind"`
Status JobStatus `json:"status"`
Progress int `json:"progress"`
Stage string `json:"stage,omitempty"`
Detail string `json:"detail,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Report *KnowledgeJobReport `json:"report,omitempty"`
}
type KnowledgeJobReport ¶
type KnowledgeJobReport struct {
Kind JobKind `json:"kind"`
Ingest *KnowledgeIngestReport `json:"ingest,omitempty"`
Compile *KnowledgeCompileReport `json:"compile,omitempty"`
Lint *KnowledgeLintReport `json:"lint,omitempty"`
Repair *KnowledgeConflictRepairReport `json:"repair,omitempty"`
Answer *KnowledgeAnswerReport `json:"answer,omitempty"`
}
type KnowledgeJobSummary ¶
type KnowledgeJobSummary struct {
ID string `json:"id"`
JobID string `json:"job_id"`
ProviderID string `json:"provider_id,omitempty"`
Query string `json:"query,omitempty"`
Kind JobKind `json:"kind"`
Status JobStatus `json:"status"`
Progress int `json:"progress"`
Stage string `json:"stage,omitempty"`
Detail string `json:"detail,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
type KnowledgeLintReport ¶
type KnowledgeLogEntry ¶
type KnowledgeLogEntry struct {
Timestamp time.Time `json:"timestamp"`
Operation string `json:"operation"`
Title string `json:"title"`
Sources []string `json:"sources,omitempty"`
NewPages []string `json:"new_pages,omitempty"`
UpdatedPages []string `json:"updated_pages,omitempty"`
Conflicts []string `json:"conflicts,omitempty"`
Gaps []string `json:"gaps,omitempty"`
Reason string `json:"reason,omitempty"`
}
type KnowledgePage ¶
type KnowledgePage struct {
KnowledgePageSummary
Content string `json:"content"`
Answers []KnowledgeArchivedAnswer `json:"answers,omitempty"`
}
type KnowledgePageSummary ¶
type KnowledgePageSummary struct {
Title string `json:"title"`
Slug string `json:"slug"`
PageType string `json:"page_type"`
Summary string `json:"summary"`
SourceRefs []string `json:"source_refs"`
Keywords []string `json:"keywords"`
Backlinks []string `json:"backlinks"`
GeneratedAt time.Time `json:"generated_at"`
UpdatedAt time.Time `json:"updated_at"`
SourceHash string `json:"source_hash"`
Status KnowledgeStatus `json:"status"`
Confidence KnowledgeConfidence `json:"confidence"`
ConflictsWith []string `json:"conflicts_with,omitempty"`
SupersededBy []string `json:"superseded_by,omitempty"`
DerivedFromQuery string `json:"derived_from_query,omitempty"`
}
type KnowledgeSchemaDocument ¶
type KnowledgeSchemaDocument struct {
Content string `json:"content"`
}
type KnowledgeStatus ¶
type KnowledgeStatus string
const ( KnowledgeStatusActive KnowledgeStatus = "active" KnowledgeStatusSuperseded KnowledgeStatus = "superseded" KnowledgeStatusConflicted KnowledgeStatus = "conflicted" )
type LintIssue ¶
type LintIssue struct {
Kind IssueKind `json:"kind"`
PageSlug string `json:"page_slug,omitempty"`
Message string `json:"message"`
AutoFixed bool `json:"auto_fixed,omitempty"`
Severity string `json:"severity,omitempty"`
Category string `json:"category,omitempty"`
RelatedPages []string `json:"related_pages,omitempty"`
SuggestedAction string `json:"suggested_action,omitempty"`
}
type LintRequest ¶
type LoopContextRequest ¶
type LoopContextRequest struct {
Stage LoopContextStage `json:"stage"`
Goal string `json:"goal,omitempty"`
CurrentStep string `json:"current_step,omitempty"`
PlanSummary string `json:"plan_summary,omitempty"`
TokenBudget int `json:"token_budget,omitempty"`
PriorFailureHints []string `json:"prior_failure_hints,omitempty"`
}
type LoopContextResult ¶
type LoopContextResult struct {
Context string `json:"context,omitempty"`
Snippets []LoopContextSnippet `json:"snippets,omitempty"`
SkipReason string `json:"skip_reason,omitempty"`
UsedCount int `json:"used_count,omitempty"`
UsedSlugs []string `json:"used_slugs,omitempty"`
}
type LoopContextSnippet ¶
type LoopContextSnippet struct {
Slug string `json:"slug"`
PageType string `json:"page_type"`
Status KnowledgeStatus `json:"status"`
Confidence KnowledgeConfidence `json:"confidence"`
Summary string `json:"summary"`
SourceRefs []string `json:"source_refs,omitempty"`
RiskLabel string `json:"risk_label,omitempty"`
}
type LoopContextStage ¶
type LoopContextStage string
const ( LoopContextStagePlanning LoopContextStage = "planning" LoopContextStageExecution LoopContextStage = "execution" LoopContextStageRecovery LoopContextStage = "recovery" LoopContextStageVerification LoopContextStage = "verification" )
type MemorySink ¶
type PromoteQueryResult ¶
type PromoteQueryResult struct {
Page KnowledgePageSummary `json:"page"`
}
type RepairConflictsRequest ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(options ServiceOptions) *Service
func (*Service) Answer ¶
func (s *Service) Answer(ctx context.Context, req AnswerRequest) (*KnowledgeAnswerReport, error)
func (*Service) CancelJobForUser ¶
func (*Service) Compile ¶
func (s *Service) Compile(ctx context.Context, req CompileRequest) (*KnowledgeCompileReport, error)
func (*Service) CreateJob ¶
func (s *Service) CreateJob(ctx context.Context, req CreateJobRequest) (*KnowledgeJob, error)
func (*Service) GetIndexMarkdown ¶
func (*Service) GetJobForUser ¶
func (s *Service) GetJobForUser(id, userID, tenantID string) (*KnowledgeJob, error)
func (*Service) GetLatestLint ¶
func (s *Service) GetLatestLint(_ context.Context) (*KnowledgeLintReport, error)
func (*Service) GetReportForUser ¶
func (s *Service) GetReportForUser(id, userID, tenantID string) (*KnowledgeJobReport, error)
func (*Service) GetSchema ¶
func (s *Service) GetSchema(_ context.Context) (*KnowledgeSchemaDocument, error)
func (*Service) HasCompiledKnowledge ¶
func (*Service) Lint ¶
func (s *Service) Lint(ctx context.Context, req LintRequest) (*KnowledgeLintReport, error)
func (*Service) ListJobsForUser ¶
func (s *Service) ListJobsForUser(userID, tenantID string, activeOnly bool) ([]KnowledgeJobSummary, error)
func (*Service) ListPages ¶
func (s *Service) ListPages(_ context.Context) ([]KnowledgePageSummary, error)
func (*Service) PromoteQuery ¶
func (*Service) RepairConflicts ¶
func (s *Service) RepairConflicts(ctx context.Context, req RepairConflictsRequest) (*KnowledgeConflictRepairReport, error)
func (*Service) ResolveLoopContext ¶
func (s *Service) ResolveLoopContext(ctx context.Context, req LoopContextRequest) (*LoopContextResult, error)
func (*Service) RetrieveAnswer ¶
func (*Service) RetrieveContext ¶
func (*Service) SubscribeForUser ¶
func (*Service) UpdateSchema ¶
type ServiceOptions ¶
type ServiceOptions struct {
WorkspaceDir string
RepoRoot string
MemorySink MemorySink
EventPublisher EventPublisher
KnowledgeAuthor KnowledgeAuthor
DefaultLintProviderID func() string
OnCompileSuccess func(context.Context, *KnowledgeCompileReport)
Now func() time.Time
}
Click to show internal directories.
Click to hide internal directories.