callout

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildImpactGraph

func BuildImpactGraph(docs []PendingDoc, opts ImpactOpts) string

BuildImpactGraph returns the full 3-section ASCII block:

  • section 1 — scope tree (per-folder file + token counts)
  • section 2 — RELAY block (pre-written user message with computed numbers)
  • section 3 — ACTION block (LLM instruction: wait → confirm → process)

Returns a single-line "no pending" message when len(docs) == 0.

func EstimateTokens

func EstimateTokens(text string) int

EstimateTokens estimates token count using a blended CJK/Latin ratio. CJK ≈ 1 tok/char; Latin/other ≈ 0.25 tok/char. Errs high for CJK-aware models.

func IsAllSensitive

func IsAllSensitive(paths []string) bool

IsAllSensitive returns true when every path has at least one sensitive keyword component.

Types

type CostLine

type CostLine struct {
	ModelName string
	CostUSD   float64
}

CostLine is one row in the estimated cost table.

func EstimateCost

func EstimateCost(totalTokens int, rates []ModelRate) []CostLine

EstimateCost returns one CostLine per model, sorted cheapest-first.

type ImpactOpts

type ImpactOpts struct {
	ToolName          string      // "docgraph_embeddings" or "docgraph_enrichment"
	ModelHint         string      // shown in header, e.g. "text-embedding-3-small"
	WorkspaceDir      string      // workspace root (or project root in single-project mode)
	Rates             []ModelRate // from DefaultRates()
	ConfirmationToken string      // hex token; empty when all-sensitive or N=0
}

ImpactOpts configures BuildImpactGraph output.

type ModelRate

type ModelRate struct {
	Name      string
	InputPerM float64   // USD per million input tokens
	AsOf      time.Time // date rates were verified; footer warns if >180 days old
}

ModelRate holds a hardcoded rate for one LLM/embedding model. Rates are intentionally approximate — purpose is order-of-magnitude awareness.

func DefaultRates

func DefaultRates() []ModelRate

DefaultRates returns the hardcoded rate table.

type PendingDoc

type PendingDoc struct {
	FilePath    string // relative to WorkspaceDir
	BodyExcerpt string // from DB; used for token estimation only — no disk read
}

PendingDoc is one document awaiting LLM processing.

type SensitiveFlag

type SensitiveFlag struct {
	Path      string // relative folder path
	FileCount int
}

SensitiveFlag marks a folder path that contains at least one sensitive keyword component.

func FlagSensitivePaths

func FlagSensitivePaths(paths []string) []SensitiveFlag

FlagSensitivePaths returns entries where any path component contains a sensitive keyword (case-insensitive substring match within each component).

Jump to

Keyboard shortcuts

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