projectknowledge

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeProject = "project"
	ScopeOrg     = "org"

	DefaultOrgRef = "default"

	StateCandidate       = "candidate"
	StateValidated       = "validated"
	StateProjectPromoted = "project_promoted"
	StateOrgReview       = "org_review"
	StateOrgPromoted     = "org_promoted"
	StateRejected        = "rejected"
	StateSuperseded      = "superseded"

	ReuseOutcomeUsed         = "used"
	ReuseOutcomeSkipped      = "skipped"
	ReuseOutcomeStale        = "stale"
	ReuseOutcomeContradicted = "contradicted"
)

Variables

View Source
var ErrInvalidInput = errors.New("invalid input")

Functions

This section is empty.

Types

type ConfidenceAssessmentReader

type ConfidenceAssessmentReader interface {
	GetAssessment(ctx context.Context, projectID string, claimID string) (projectconfidence.ConfidenceAssessment, error)
}

type CreateCandidateInput

type CreateCandidateInput struct {
	ProjectID              string   `json:"project_id"`
	KnowledgeRef           string   `json:"knowledge_ref"`
	ClaimID                string   `json:"claim_id"`
	ClaimRef               string   `json:"claim_ref"`
	ConfidenceAssessmentID string   `json:"confidence_assessment_id,omitempty"`
	ConfidenceScore        int      `json:"confidence_score,omitempty"`
	ConfidenceBand         string   `json:"confidence_band,omitempty"`
	Summary                string   `json:"summary"`
	ReuseGuidance          string   `json:"reuse_guidance"`
	EvidenceRefs           []string `json:"evidence_refs,omitempty"`
	VerifierRefs           []string `json:"verifier_refs,omitempty"`
	OutcomeRefs            []string `json:"outcome_refs,omitempty"`
	PromotionRefs          []string `json:"promotion_refs,omitempty"`
	SupersedesRef          string   `json:"supersedes_ref,omitempty"`
}

type EvidenceClaimReader

type EvidenceClaimReader interface {
	GetClaim(ctx context.Context, projectID string, claimID string) (projectevidence.ClaimRecord, error)
}

type KnowledgeFilter

type KnowledgeFilter struct {
	Scope          string `json:"scope,omitempty"`
	OrgRef         string `json:"org_ref,omitempty"`
	State          string `json:"state,omitempty"`
	ClaimID        string `json:"claim_id,omitempty"`
	KnowledgeRef   string `json:"knowledge_ref,omitempty"`
	ConfidenceBand string `json:"confidence_band,omitempty"`
	MinConfidence  *int   `json:"min_confidence,omitempty"`
	MaxConfidence  *int   `json:"max_confidence,omitempty"`
	PageSize       int    `json:"page_size,omitempty"`
	PageToken      string `json:"page_token,omitempty"`
}

type KnowledgeRecord

type KnowledgeRecord struct {
	ID                     string    `json:"id"`
	ProjectID              string    `json:"project_id"`
	Scope                  string    `json:"scope"`
	OrgRef                 string    `json:"org_ref,omitempty"`
	KnowledgeRef           string    `json:"knowledge_ref"`
	ClaimID                string    `json:"claim_id"`
	ClaimRef               string    `json:"claim_ref"`
	ConfidenceAssessmentID string    `json:"confidence_assessment_id"`
	ConfidenceScore        int       `json:"confidence_score"`
	ConfidenceBand         string    `json:"confidence_band"`
	State                  string    `json:"state"`
	Summary                string    `json:"summary"`
	ReuseGuidance          string    `json:"reuse_guidance"`
	EvidenceRefs           []string  `json:"evidence_refs,omitempty"`
	VerifierRefs           []string  `json:"verifier_refs,omitempty"`
	OutcomeRefs            []string  `json:"outcome_refs,omitempty"`
	PromotionRefs          []string  `json:"promotion_refs,omitempty"`
	SupersedesRef          string    `json:"supersedes_ref,omitempty"`
	SupersededByRef        string    `json:"superseded_by_ref,omitempty"`
	CreatedAt              time.Time `json:"created_at"`
	UpdatedAt              time.Time `json:"updated_at"`
	PromotedAt             time.Time `json:"promoted_at,omitempty"`
}

type KnowledgeReuseEvent

type KnowledgeReuseEvent struct {
	ID              string    `json:"id"`
	ProjectID       string    `json:"project_id"`
	KnowledgeID     string    `json:"knowledge_id"`
	AgentRunID      string    `json:"agent_run_id,omitempty"`
	TraceID         string    `json:"trace_id,omitempty"`
	ReuseRef        string    `json:"reuse_ref"`
	Revalidated     bool      `json:"revalidated"`
	RevalidationRef string    `json:"revalidation_ref,omitempty"`
	Outcome         string    `json:"outcome"`
	Summary         string    `json:"summary,omitempty"`
	CreatedAt       time.Time `json:"created_at"`
}

type OrgGateInput

type OrgGateInput struct {
	Claim                projectevidence.ClaimRecord            `json:"claim"`
	Confidence           projectconfidence.ConfidenceAssessment `json:"confidence"`
	ClaimCheckActionable int                                    `json:"claim_check_actionable"`
	Scope                string                                 `json:"scope"`
	OrgRef               string                                 `json:"org_ref,omitempty"`
	DecisionRef          string                                 `json:"decision_ref"`
	VerifierRef          string                                 `json:"verifier_ref"`
	Rationale            string                                 `json:"rationale"`
	DecidedBy            string                                 `json:"decided_by"`
}

type OrgGateOptions

type OrgGateOptions struct {
	ProjectID            string
	ClaimID              string
	ClaimCheckActionable int
	Scope                string
	OrgRef               string
	DecisionRef          string
	VerifierRef          string
	Rationale            string
	DecidedBy            string
}

type ProjectGateInput

type ProjectGateInput struct {
	Claim      projectevidence.ClaimRecord            `json:"claim"`
	Confidence projectconfidence.ConfidenceAssessment `json:"confidence"`
}

type ProjectGateOptions

type ProjectGateOptions struct {
	ProjectID string
	ClaimID   string
}

type PromoteOrgInput

type PromoteOrgInput struct {
	ProjectID   string       `json:"project_id"`
	KnowledgeID string       `json:"knowledge_id"`
	Gate        OrgGateInput `json:"gate"`
}

type PromoteOrgWithInputsInput

type PromoteOrgWithInputsInput struct {
	ProjectID            string
	KnowledgeID          string
	ClaimCheckActionable int
	Scope                string
	OrgRef               string
	DecisionRef          string
	VerifierRef          string
	Rationale            string
	DecidedBy            string
}

type PromoteProjectInput

type PromoteProjectInput struct {
	ProjectID   string           `json:"project_id"`
	KnowledgeID string           `json:"knowledge_id"`
	DecisionRef string           `json:"decision_ref"`
	VerifierRef string           `json:"verifier_ref"`
	Rationale   string           `json:"rationale"`
	Gate        ProjectGateInput `json:"gate"`
}

type PromoteProjectWithInputsInput

type PromoteProjectWithInputsInput struct {
	ProjectID   string
	KnowledgeID string
	DecisionRef string
	VerifierRef string
	Rationale   string
}

type PromotionDecision

type PromotionDecision struct {
	ID              string    `json:"id"`
	ProjectID       string    `json:"project_id"`
	KnowledgeID     string    `json:"knowledge_id"`
	FromState       string    `json:"from_state"`
	ToState         string    `json:"to_state"`
	Scope           string    `json:"scope"`
	DecisionRef     string    `json:"decision_ref"`
	VerifierRef     string    `json:"verifier_ref"`
	ConfidenceScore int       `json:"confidence_score"`
	Rationale       string    `json:"rationale"`
	DecidedBy       string    `json:"decided_by,omitempty"`
	DecidedAt       time.Time `json:"decided_at"`
}

type PromotionInputAdapter

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

func NewPromotionInputAdapter

func NewPromotionInputAdapter(evidence EvidenceClaimReader, confidence ConfidenceAssessmentReader) *PromotionInputAdapter

func (*PromotionInputAdapter) BuildOrgGate

func (adapter *PromotionInputAdapter) BuildOrgGate(ctx context.Context, options OrgGateOptions) (OrgGateInput, error)

func (*PromotionInputAdapter) BuildProjectGate

func (adapter *PromotionInputAdapter) BuildProjectGate(ctx context.Context, options ProjectGateOptions) (ProjectGateInput, error)

type RecordReuseEventInput

type RecordReuseEventInput struct {
	ProjectID       string `json:"project_id"`
	KnowledgeID     string `json:"knowledge_id"`
	AgentRunID      string `json:"agent_run_id,omitempty"`
	TraceID         string `json:"trace_id,omitempty"`
	ReuseRef        string `json:"reuse_ref"`
	Revalidated     bool   `json:"revalidated"`
	RevalidationRef string `json:"revalidation_ref,omitempty"`
	Outcome         string `json:"outcome"`
	Summary         string `json:"summary,omitempty"`
}

type RejectInput

type RejectInput struct {
	ProjectID   string `json:"project_id"`
	KnowledgeID string `json:"knowledge_id"`
	DecisionRef string `json:"decision_ref"`
	VerifierRef string `json:"verifier_ref"`
	Rationale   string `json:"rationale"`
	DecidedBy   string `json:"decided_by,omitempty"`
}

type Service

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

func New

func New(store Store) *Service

func (*Service) CreateCandidate

func (svc *Service) CreateCandidate(ctx context.Context, input CreateCandidateInput) (KnowledgeRecord, error)

func (*Service) GetKnowledge

func (svc *Service) GetKnowledge(ctx context.Context, projectID string, knowledgeID string) (KnowledgeRecord, error)

func (*Service) ListKnowledge

func (svc *Service) ListKnowledge(ctx context.Context, projectID string, filter KnowledgeFilter) ([]KnowledgeRecord, error)

func (*Service) ListOrgKnowledge

func (svc *Service) ListOrgKnowledge(ctx context.Context, orgRef string, filter KnowledgeFilter) ([]KnowledgeRecord, error)

func (*Service) PromoteOrg

func (svc *Service) PromoteOrg(ctx context.Context, input PromoteOrgInput) (KnowledgeRecord, error)

func (*Service) PromoteOrgWithInputs

func (svc *Service) PromoteOrgWithInputs(ctx context.Context, adapter *PromotionInputAdapter, input PromoteOrgWithInputsInput) (KnowledgeRecord, error)

func (*Service) PromoteProject

func (svc *Service) PromoteProject(ctx context.Context, input PromoteProjectInput) (KnowledgeRecord, error)

func (*Service) PromoteProjectWithInputs

func (svc *Service) PromoteProjectWithInputs(ctx context.Context, adapter *PromotionInputAdapter, input PromoteProjectWithInputsInput) (KnowledgeRecord, error)

func (*Service) RecordReuseEvent

func (svc *Service) RecordReuseEvent(ctx context.Context, input RecordReuseEventInput) (KnowledgeReuseEvent, error)

func (*Service) Reject

func (svc *Service) Reject(ctx context.Context, input RejectInput) (KnowledgeRecord, error)

func (*Service) SubmitOrgReview

func (svc *Service) SubmitOrgReview(ctx context.Context, input SubmitOrgReviewInput) (KnowledgeRecord, error)

func (*Service) Supersede

func (svc *Service) Supersede(ctx context.Context, input SupersedeInput) (KnowledgeRecord, error)

func (*Service) ValidateCandidate

func (svc *Service) ValidateCandidate(ctx context.Context, input ValidateCandidateInput) (KnowledgeRecord, error)

func (*Service) ValidateCandidateWithInputs

func (svc *Service) ValidateCandidateWithInputs(ctx context.Context, adapter *PromotionInputAdapter, input ValidateCandidateWithInputsInput) (KnowledgeRecord, error)

type Store

type Store interface {
	CreateKnowledge(ctx context.Context, record KnowledgeRecord) (KnowledgeRecord, error)
	GetKnowledge(ctx context.Context, projectID string, knowledgeID string) (KnowledgeRecord, error)
	ListKnowledge(ctx context.Context, projectID string, filter KnowledgeFilter) ([]KnowledgeRecord, error)
	ListOrgKnowledge(ctx context.Context, orgRef string, filter KnowledgeFilter) ([]KnowledgeRecord, error)
	UpdateKnowledge(ctx context.Context, record KnowledgeRecord) (KnowledgeRecord, error)
	CreateDecision(ctx context.Context, decision PromotionDecision) (PromotionDecision, error)
	ListDecisions(ctx context.Context, projectID string, knowledgeID string) ([]PromotionDecision, error)
	CreateReuseEvent(ctx context.Context, event KnowledgeReuseEvent) (KnowledgeReuseEvent, error)
	ListReuseEvents(ctx context.Context, projectID string, knowledgeID string) ([]KnowledgeReuseEvent, error)
}

type SubmitOrgReviewInput

type SubmitOrgReviewInput struct {
	ProjectID   string `json:"project_id"`
	KnowledgeID string `json:"knowledge_id"`
	OrgRef      string `json:"org_ref,omitempty"`
	DecisionRef string `json:"decision_ref"`
	VerifierRef string `json:"verifier_ref"`
	Rationale   string `json:"rationale"`
	DecidedBy   string `json:"decided_by"`
}

type SupersedeInput

type SupersedeInput struct {
	ProjectID       string `json:"project_id"`
	KnowledgeID     string `json:"knowledge_id"`
	SupersededByRef string `json:"superseded_by_ref"`
	DecisionRef     string `json:"decision_ref"`
	VerifierRef     string `json:"verifier_ref"`
	Rationale       string `json:"rationale"`
	DecidedBy       string `json:"decided_by,omitempty"`
}

type ValidateCandidateInput

type ValidateCandidateInput struct {
	ProjectID   string           `json:"project_id"`
	KnowledgeID string           `json:"knowledge_id"`
	DecisionRef string           `json:"decision_ref"`
	VerifierRef string           `json:"verifier_ref"`
	Rationale   string           `json:"rationale"`
	Gate        ProjectGateInput `json:"gate"`
}

type ValidateCandidateWithInputsInput

type ValidateCandidateWithInputsInput struct {
	ProjectID   string
	KnowledgeID string
	DecisionRef string
	VerifierRef string
	Rationale   string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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