Files
weichen dc29b84cdf feat(ctx): inject cleaned project dialogue into squad and assistant
Add dialoguectx packaging, conflictresolve adjudication with HITL routing,
workspace context/dialogue/ injection (default on), and goose 00071.
2026-09-24 17:04:04 +00:00

77 lines
2.7 KiB
Go

// Package dialoguectx collects, cleans, and packages project member dialogue
// for injection into squad workspaces and assistant prompts.
package dialoguectx
import "time"
const (
AuthorityCollabDialogue = "collab_dialogue"
DefaultMaxDays = 7
DefaultMaxTurns = 80
MaxDaysCap = 31
MaxTurnsCap = 200
MaxDigestRunes = 2400
MaxTurnContentRunes = 480
MinContentRunes = 4
)
// CollectOptions controls dialogue collection and packaging.
type CollectOptions struct {
ProjectID int64
AllowedStageKey string // empty = no stage filter
MaxDays int
MaxTurns int
Now time.Time
}
// RichDialogueTurn is a cleaned, metadata-enriched dialogue unit.
type RichDialogueTurn struct {
MessageID int64 `json:"message_id"`
SessionID string `json:"session_id"`
SpeakerID int64 `json:"speaker_id"`
SpeakerName string `json:"speaker_name"`
SystemRole string `json:"system_role"`
ProjectRole string `json:"project_role"`
DocDuty string `json:"doc_duty,omitempty"`
Role string `json:"role"` // user | assistant
Content string `json:"content"`
StageKey string `json:"stage_key,omitempty"`
DayKey string `json:"day_key"`
Category string `json:"category,omitempty"`
ContentKind string `json:"content_kind,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
// DialogueFact is a structured claim extracted from dialogue.
type DialogueFact struct {
Key string `json:"key"`
Value string `json:"value"`
SourceMessageID int64 `json:"source_message_id"`
SpeakerID int64 `json:"speaker_id"`
SpeakerName string `json:"speaker_name"`
StatedAt time.Time `json:"stated_at"`
Authority string `json:"authority"`
ExplicitEvidence bool `json:"explicit_evidence"`
}
// Package is the layered dialogue payload written under context/dialogue/.
type Package struct {
DigestMD string `json:"-"`
TurnsMD string `json:"-"`
Facts []DialogueFact `json:"facts"`
ConfirmationsMD string `json:"-"`
ExcludedPrivate int `json:"excluded_private"`
ExcludedNoAccess int `json:"excluded_no_access"`
ExcludedNoise int `json:"excluded_noise"`
TurnCount int `json:"turn_count"`
CoveredFrom time.Time `json:"covered_from,omitempty"`
CoveredTo time.Time `json:"covered_to,omitempty"`
AssembledAt time.Time `json:"assembled_at"`
InjectionEnabled bool `json:"injection_enabled"`
}
// AssistantSnippet is a short prompt fragment for MemoryComposer.
type AssistantSnippet struct {
Text string
}