shared

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TextComparisonPolicy = "dnd.text_comparison.v1"

TextComparisonPolicy identifies the shared D&D text-comparison semantics. A semantic change requires a new value and a review of every dependent identity, mapping, normalization, and validator policy.

Variables

This section is empty.

Functions

func ComparisonKey added in v0.3.0

func ComparisonKey(value string) string

ComparisonKey returns the D&D Unicode- and case-insensitive comparison key.

func ContainsTokenSequence

func ContainsTokenSequence(value string, query string) bool

ContainsTokenSequence reports whether value contains the complete normalized query token sequence as consecutive tokens.

func ModelCandidateFromResponse added in v0.4.0

func ModelCandidateFromResponse(response contracts.StructuredCompletionResponse) (*contracts.ModelCandidate, error)

ModelCandidateFromResponse returns an owned candidate for the exact validated structured response produced by the shared LLM boundary.

func NormalizedTokens

func NormalizedTokens(value string) []string

NormalizedTokens returns identity-normalized alphanumeric tokens from a D&D value.

func PrepareChunkExtraction

PrepareChunkExtraction validates common D&D extraction prerequisites and prepares owned chunk-scoped source material for prompt inputs.

func PromptInputs

func PromptInputs(sourceInput contracts.LLMInputMaterial, references contracts.ReferenceSet) contracts.LLMInputSet

func ReferenceMediaTypes

func ReferenceMediaTypes() []string

func ReferencePromptInput

func ReferencePromptInput(slot contracts.ResolvedReferenceSlot) []byte

func ReferenceSlots

func ReferenceSlots(descriptions ReferenceSlotDescriptions) []contracts.ReferenceSlot

func ResolveUnitID

func ResolveUnitID(index source.DocumentIndex, field string, ref UnitRef) (int, error)

func TranscriptPromptMaterial

func TranscriptPromptMaterial(material contracts.LLMInputMaterial) contracts.LLMInputMaterial

Types

type CitationResolver

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

CitationResolver resolves cited ranges against one source document.

func NewCitationResolver

func NewCitationResolver(doc *source.SourceDocument) (*CitationResolver, error)

NewCitationResolver prepares citation resolution for doc.

func (*CitationResolver) CitedText

func (r *CitationResolver) CitedText(refs []source.SourceRef) (string, error)

CitedText resolves cited source ranges in document order, including each source unit once, and joins the resulting text with newlines.

type PromptAssetManifest

type PromptAssetManifest struct {
	ModuleDir           string
	ModuleFiles         []promptfs.ModulePromptFile
	SharedFiles         []string
	ExternalSharedFiles []promptfs.SharedPromptFile
}

PromptAssetManifest is the ordered set of assets that make up one prompt. Module files are addressed in the owning module filesystem. SharedFiles use names in sharedPromptPaths, while ExternalSharedFiles are explicit caller-owned descriptors. Both kinds are mounted beneath sharedassets.

func (PromptAssetManifest) Hash

func (manifest PromptAssetManifest) Hash(moduleFS fs.FS) (string, error)

func (PromptAssetManifest) PromptFS

func (manifest PromptAssetManifest) PromptFS(moduleFS fs.FS) (fs.FS, error)

type ReferenceSlotDescriptions

type ReferenceSlotDescriptions struct {
	Glossary string
	Party    string
	Players  string
	Roster   string
}

type SourceRefOrder

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

SourceRefOrder provides a stable snapshot of a source document's unit ordering for source-reference comparison and canonicalization.

func NewSourceRefOrder

func NewSourceRefOrder(doc *source.SourceDocument) SourceRefOrder

NewSourceRefOrder captures the source identity and unit positions from doc.

func NewSourceRefOrderFromIndex

func NewSourceRefOrderFromIndex(index source.DocumentIndex) SourceRefOrder

NewSourceRefOrderFromIndex captures source identity and unit positions from one document index for source-reference comparison and canonicalization.

func (SourceRefOrder) Canonicalize

func (o SourceRefOrder) Canonicalize(refs []source.SourceRef) []source.SourceRef

Canonicalize returns an owned, stable-sorted, exactly de-duplicated copy of refs. It deliberately preserves invalid references for diagnostics.

func (SourceRefOrder) EarliestValid

func (o SourceRefOrder) EarliestValid(refs []source.SourceRef) (int, bool)

EarliestValid returns the earliest document position among valid refs.

func (SourceRefOrder) Less

func (o SourceRefOrder) Less(left, right source.SourceRef) bool

Less orders references by source identity, then document positions when available, and finally literal endpoint IDs.

type SourceRefResponse

type SourceRefResponse struct {
	SourceID    string  `json:"source_id"`
	StartUnitID UnitRef `json:"start_unit_id"`
	EndUnitID   UnitRef `json:"end_unit_id"`
}

type UnitRef

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

func UnitRefFromInt

func UnitRefFromInt(value int) UnitRef

func (UnitRef) Int

func (ref UnitRef) Int() int

func (UnitRef) MarshalJSON

func (ref UnitRef) MarshalJSON() ([]byte, error)

func (UnitRef) String

func (ref UnitRef) String() string

func (*UnitRef) UnmarshalJSON

func (ref *UnitRef) UnmarshalJSON(raw []byte) error

Directories

Path Synopsis
Package diagnostics provides bounded, safe text for deterministic D&D decisions and findings.
Package diagnostics provides bounded, safe text for deterministic D&D decisions and findings.
Package registryresolver provides the shared reference-selection and caching mechanics used by immutable D&D registry views.
Package registryresolver provides the shared reference-selection and caching mechanics used by immutable D&D registry views.

Jump to

Keyboard shortcuts

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