domain

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ReviewInterval = 5

ReviewInterval 全局审阅间隔(每 N 章触发一次)。

Variables

This section is empty.

Functions

func ShouldArcReview

func ShouldArcReview(isArcEnd, isVolumeEnd bool, volume, arc int) (bool, string)

ShouldArcReview 长篇模式下判断是否需要弧级/卷级评审。

func ShouldReview

func ShouldReview(completedCount int) (bool, string)

ShouldReview 根据已完成章节数判断是否需要全局审阅(短篇/中篇模式)。

func TotalChapters

func TotalChapters(volumes []VolumeOutline) int

TotalChapters 计算分层大纲的总章节数。

func WordCount

func WordCount(content string) int

WordCount 按 rune 计算字数。

Types

type ArcOutline

type ArcOutline struct {
	Index    int            `json:"index"` // 卷内弧序号
	Title    string         `json:"title"`
	Goal     string         `json:"goal"` // 弧目标(起承转合)
	Chapters []OutlineEntry `json:"chapters"`
}

ArcOutline 弧级大纲。

type ArcSummary

type ArcSummary struct {
	Volume    int      `json:"volume"`
	Arc       int      `json:"arc"`
	Title     string   `json:"title"`
	Summary   string   `json:"summary"`
	KeyEvents []string `json:"key_events"`
}

ArcSummary 弧级摘要,弧结束时由 Editor 生成。

type ChapterPlan

type ChapterPlan struct {
	Chapter    int    `json:"chapter"`
	Title      string `json:"title"`
	Goal       string `json:"goal"`
	Conflict   string `json:"conflict"`
	Hook       string `json:"hook"`
	EmotionArc string `json:"emotion_arc,omitempty"`
	Notes      string `json:"notes,omitempty"` // Agent 的自由备忘
}

ChapterPlan 章节写作构思,Writer 自主生成。 不再强制场景拆分,Agent 自己决定如何组织内容。

type ChapterSummary

type ChapterSummary struct {
	Chapter    int      `json:"chapter"`
	Summary    string   `json:"summary"`
	Characters []string `json:"characters"`
	KeyEvents  []string `json:"key_events"`
}

ChapterSummary 章节摘要,供后续章节的上下文窗口使用。

type Character

type Character struct {
	Name        string   `json:"name"`
	Aliases     []string `json:"aliases,omitempty"` // 别名/称号/绰号(如"废物少年"、"炎哥")
	Role        string   `json:"role"`
	Description string   `json:"description"`
	Arc         string   `json:"arc"`
	Traits      []string `json:"traits"`
	Tier        string   `json:"tier,omitempty"` // core / important / secondary / decorative(默认 important)
}

Character 角色档案。

type CharacterSnapshot

type CharacterSnapshot struct {
	Volume     int    `json:"volume"`
	Arc        int    `json:"arc"`
	Name       string `json:"name"`
	Status     string `json:"status"`
	Power      string `json:"power,omitempty"`
	Motivation string `json:"motivation"`
	Relations  string `json:"relations,omitempty"`
}

CharacterSnapshot 角色状态快照,弧边界时记录。

type CommitResult

type CommitResult struct {
	Chapter        int              `json:"chapter"`
	Committed      bool             `json:"committed"`
	WordCount      int              `json:"word_count"`
	NextChapter    int              `json:"next_chapter"`
	ReviewRequired bool             `json:"review_required"`
	ReviewReason   string           `json:"review_reason,omitempty"`
	HookType       string           `json:"hook_type,omitempty"`
	DominantStrand string           `json:"dominant_strand,omitempty"`
	Feedback       *OutlineFeedback `json:"feedback,omitempty"`
	// 长篇分层信号
	ArcEnd    bool `json:"arc_end,omitempty"`
	VolumeEnd bool `json:"volume_end,omitempty"`
	Volume    int  `json:"volume,omitempty"`
	Arc       int  `json:"arc,omitempty"`
}

CommitResult 是 commit_chapter 工具的结构化返回值。 宿主程序和 Coordinator 读取此信号做控制决策。

type ConsistencyIssue

type ConsistencyIssue struct {
	Type        string `json:"type"`     // consistency / character / pacing / continuity / foreshadow / hook
	Severity    string `json:"severity"` // critical / error / warning
	Description string `json:"description"`
	Suggestion  string `json:"suggestion,omitempty"`
}

ConsistencyIssue 一致性问题。

type ContextProfile

type ContextProfile struct {
	SummaryWindow  int  // 加载最近 N 章摘要
	TimelineWindow int  // 加载最近 N 章时间线
	Layered        bool // true = 启用分层摘要加载(卷摘要+弧摘要+章摘要)
}

ContextProfile 上下文加载策略,根据总章节数自适应。

func NewContextProfile

func NewContextProfile(totalChapters int) ContextProfile

NewContextProfile 根据总章节数计算上下文策略。

type DimensionScore

type DimensionScore struct {
	Dimension string `json:"dimension"`         // consistency / character / pacing / continuity / foreshadow / hook
	Score     int    `json:"score"`             // 0-100
	Verdict   string `json:"verdict"`           // pass / warning / fail
	Comment   string `json:"comment,omitempty"` // 该维度的简要结论
}

DimensionScore 单维度评审评分。

type FlowState

type FlowState string

FlowState 当前活动流程类型,用于 checkpoint 恢复。

const (
	FlowWriting   FlowState = "writing"
	FlowReviewing FlowState = "reviewing"
	FlowRewriting FlowState = "rewriting"
	FlowPolishing FlowState = "polishing"
	FlowSteering  FlowState = "steering"
)

type ForeshadowEntry

type ForeshadowEntry struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	PlantedAt   int    `json:"planted_at"`
	Status      string `json:"status"` // planted / advanced / resolved
	ResolvedAt  int    `json:"resolved_at,omitempty"`
}

ForeshadowEntry 伏笔条目。

type ForeshadowUpdate

type ForeshadowUpdate struct {
	ID          string `json:"id"`
	Action      string `json:"action"` // plant / advance / resolve
	Description string `json:"description,omitempty"`
}

ForeshadowUpdate 伏笔增量操作。

type Novel

type Novel struct {
	Name          string `json:"name"`
	TotalChapters int    `json:"total_chapters"`
}

Novel 小说元信息。

type OutlineEntry

type OutlineEntry struct {
	Chapter   int      `json:"chapter"`
	Title     string   `json:"title"`
	CoreEvent string   `json:"core_event"`
	Hook      string   `json:"hook"`
	Scenes    []string `json:"scenes"`
}

OutlineEntry 大纲条目,对应一章。

func FlattenOutline

func FlattenOutline(volumes []VolumeOutline) []OutlineEntry

FlattenOutline 将分层大纲展开为扁平章节列表,保持全局章节号连续。

type OutlineFeedback

type OutlineFeedback struct {
	Deviation  string `json:"deviation"`  // 偏离描述
	Suggestion string `json:"suggestion"` // 调整建议
}

OutlineFeedback Writer 对大纲的反馈,提交章节时可选。

type Phase

type Phase string

Phase 表示小说创作阶段。

const (
	PhaseInit     Phase = "init"
	PhasePremise  Phase = "premise"
	PhaseOutline  Phase = "outline"
	PhaseWriting  Phase = "writing"
	PhaseComplete Phase = "complete"
)

type PlanningTier

type PlanningTier string

PlanningTier 表示作品规划的长度级别。

const (
	PlanningTierShort PlanningTier = "short"
	PlanningTierMid   PlanningTier = "mid"
	PlanningTierLong  PlanningTier = "long"
)

type Progress

type Progress struct {
	NovelName         string      `json:"novel_name"`
	Phase             Phase       `json:"phase"`
	CurrentChapter    int         `json:"current_chapter"`
	TotalChapters     int         `json:"total_chapters"`
	CompletedChapters []int       `json:"completed_chapters"`
	TotalWordCount    int         `json:"total_word_count"`
	ChapterWordCounts map[int]int `json:"chapter_word_counts,omitempty"` // 每章字数,支持重写时修正总字数
	InProgressChapter int         `json:"in_progress_chapter,omitempty"` // 正在写作的章节(场景级恢复)
	CompletedScenes   []int       `json:"completed_scenes,omitempty"`    // 当前章节已完成的场景编号
	Flow              FlowState   `json:"flow,omitempty"`                // 当前流程
	PendingRewrites   []int       `json:"pending_rewrites,omitempty"`    // 待重写章节队列
	RewriteReason     string      `json:"rewrite_reason,omitempty"`      // 重写原因
	StrandHistory     []string    `json:"strand_history,omitempty"`      // 按章节顺序记录 dominant_strand
	HookHistory       []string    `json:"hook_history,omitempty"`        // 按章节顺序记录 hook_type
	// 长篇分层追踪(仅长篇模式使用,短篇/中篇为零值)
	CurrentVolume int  `json:"current_volume,omitempty"`
	CurrentArc    int  `json:"current_arc,omitempty"`
	Layered       bool `json:"layered,omitempty"`
}

Progress 进度追踪,持久化到 meta/progress.json。

func (*Progress) IsResumable

func (p *Progress) IsResumable() bool

IsResumable 判断是否可以从断点恢复。

func (*Progress) NextChapter

func (p *Progress) NextChapter() int

NextChapter 返回下一个要写的章节号。

type RelationshipEntry

type RelationshipEntry struct {
	CharacterA string `json:"character_a"`
	CharacterB string `json:"character_b"`
	Relation   string `json:"relation"`
	Chapter    int    `json:"chapter"`
}

RelationshipEntry 人物关系条目。

type ReviewEntry

type ReviewEntry struct {
	Chapter          int                `json:"chapter"`
	Scope            string             `json:"scope"` // chapter / global / arc
	Issues           []ConsistencyIssue `json:"issues"`
	Dimensions       []DimensionScore   `json:"dimensions,omitempty"` // 分维度评分
	Verdict          string             `json:"verdict"`              // accept / polish / rewrite
	Summary          string             `json:"summary"`
	AffectedChapters []int              `json:"affected_chapters,omitempty"` // 需要重写/打磨的章节号
}

ReviewEntry Editor 的审阅条目。

func (*ReviewEntry) CriticalCount

func (r *ReviewEntry) CriticalCount() int

CriticalCount 返回 critical 级别问题数量。

func (*ReviewEntry) ErrorCount

func (r *ReviewEntry) ErrorCount() int

ErrorCount 返回 error 级别问题数量。

type RunMeta

type RunMeta struct {
	StartedAt    string       `json:"started_at"`
	Provider     string       `json:"provider,omitempty"`
	Style        string       `json:"style"`
	Model        string       `json:"model"`
	PlanningTier PlanningTier `json:"planning_tier,omitempty"`
	SteerHistory []SteerEntry `json:"steer_history,omitempty"`
	PendingSteer string       `json:"pending_steer,omitempty"` // 未完成的 Steer 指令,中断恢复时重新注入
}

RunMeta 运行元信息,持久化到 meta/run.json。

type StateChange

type StateChange struct {
	Chapter  int    `json:"chapter"`
	Entity   string `json:"entity"`              // 角色名或实体名
	Field    string `json:"field"`               // 变化属性:realm/location/status/power/relation 等
	OldValue string `json:"old_value,omitempty"` // 变化前(首次出现可空)
	NewValue string `json:"new_value"`           // 变化后
	Reason   string `json:"reason,omitempty"`    // 变化原因
}

StateChange 角色/实体状态变化记录。

type SteerEntry

type SteerEntry struct {
	Input     string `json:"input"`
	Timestamp string `json:"timestamp"`
}

SteerEntry 用户干预记录。

type TimelineEvent

type TimelineEvent struct {
	Chapter    int      `json:"chapter"`
	Time       string   `json:"time"`
	Event      string   `json:"event"`
	Characters []string `json:"characters,omitempty"`
}

TimelineEvent 时间线事件。

type VolumeOutline

type VolumeOutline struct {
	Index int          `json:"index"`
	Title string       `json:"title"`
	Theme string       `json:"theme"` // 本卷核心冲突/主题
	Arcs  []ArcOutline `json:"arcs"`
}

VolumeOutline 卷级大纲(长篇分层模式)。

type VolumeSummary

type VolumeSummary struct {
	Volume    int      `json:"volume"`
	Title     string   `json:"title"`
	Summary   string   `json:"summary"`
	KeyEvents []string `json:"key_events"`
}

VolumeSummary 卷级摘要,卷结束时生成。

type WorldRule

type WorldRule struct {
	Category string `json:"category"` // magic / technology / geography / society / other
	Rule     string `json:"rule"`     // 规则描述
	Boundary string `json:"boundary"` // 不可违反的边界
}

WorldRule 世界观规则条目。

Jump to

Keyboard shortcuts

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