Hand checked processing selections to execution

This commit is contained in:
2026-11-16 14:18:38 +00:00
parent b1d1b8302c
commit e98e525b5c
19 changed files with 268 additions and 102 deletions

View File

@@ -19,6 +19,8 @@ import (
type StructuredLLMClient = structuredoutput.Client
// TranscriptModule is the minimal contract for framework-integrated modules.
// Propose may run concurrently on an instance across sections. Request data
// is borrowed for the call. Copy it before retaining it or modifying it.
type TranscriptModule interface {
Key() string
ReplacementPolicy() proposals.ReplacementPolicy
@@ -31,18 +33,35 @@ type StructuredCompletionResponse = structuredoutput.Response
// ModuleRunSpec identifies one resolved module instance in a pipeline.
type ModuleRunSpec struct {
ModuleKey string `json:"module_key"`
InstanceName string `json:"instance_name"`
ReplacementPolicy proposals.ReplacementPolicy `json:"replacement_policy"`
Index int `json:"-"`
ID *string `json:"-"`
Settings config.Stage `json:"-"`
Glossary []glossary.Entry `json:"-"`
ProtectedTerms []glossary.Term `json:"-"`
CaptureProposalExchange bool `json:"-"`
ProposalClient StructuredLLMClient `json:"-"`
ValidationClient StructuredLLMClient `json:"-"`
RepairClient StructuredLLMClient `json:"-"`
ModuleKey string `json:"module_key"`
InstanceName string `json:"instance_name"`
ReplacementPolicy proposals.ReplacementPolicy `json:"replacement_policy"`
Index int `json:"-"`
ID *string `json:"-"`
Settings config.Stage `json:"-"`
Glossary []glossary.Entry `json:"-"`
ProtectedTerms []glossary.Term `json:"-"`
GlossaryView *validators.GlossaryView `json:"-"`
GlossaryVariables *promptcontext.GlossaryVariables `json:"-"`
CaptureProposalExchange bool `json:"-"`
ProposalClient StructuredLLMClient `json:"-"`
ValidationClient StructuredLLMClient `json:"-"`
RepairClient StructuredLLMClient `json:"-"`
}
// PrepareGlossary constructs the read-only views used by proposal and validation.
func (s *ModuleRunSpec) PrepareGlossary() error {
if s.GlossaryVariables == nil {
variables, err := promptcontext.PrepareGlossaryVariables(s.Glossary, s.ProtectedTerms)
if err != nil {
return err
}
s.GlossaryVariables = &variables
}
if s.GlossaryView == nil {
s.GlossaryView = validators.PrepareGlossaryView(s.Glossary, s.ProtectedTerms)
}
return nil
}
// SectionMetadata captures chunk-level metadata without embedding full segment payloads.