Documentation
¶
Index ¶
- type ArcBoundary
- type Store
- func (s *Store) AppendDraft(chapter int, content string) error
- func (s *Store) AppendStateChanges(changes []domain.StateChange) error
- func (s *Store) AppendSteerEntry(entry domain.SteerEntry) error
- func (s *Store) AppendTimelineEvents(newEvents []domain.TimelineEvent) error
- func (s *Store) CheckArcBoundary(chapter int) (*ArcBoundary, error)
- func (s *Store) ClearHandledSteer() error
- func (s *Store) ClearInProgress() error
- func (s *Store) ClearLastCommit() error
- func (s *Store) ClearLastReview() error
- func (s *Store) ClearLayeredOutline() error
- func (s *Store) ClearPendingRewrites() error
- func (s *Store) ClearPendingSteer() error
- func (s *Store) ClearStaleSignals()
- func (s *Store) CompleteRewrite(chapter int) error
- func (s *Store) Dir() string
- func (s *Store) ExtractDialogue(characterName string, aliases []string, maxSamples int) []string
- func (s *Store) ExtractStyleAnchors(maxAnchors int) []string
- func (s *Store) GetChapterFromLayered(chapter int) (*domain.OutlineEntry, error)
- func (s *Store) GetChapterOutline(chapter int) (*domain.OutlineEntry, error)
- func (s *Store) Init() error
- func (s *Store) InitProgress(novelName string, totalChapters int) error
- func (s *Store) InitRunMeta(style, provider, model string) error
- func (s *Store) LoadActiveForeshadow() ([]domain.ForeshadowEntry, error)
- func (s *Store) LoadAllSummaries(current int) ([]domain.ChapterSummary, error)
- func (s *Store) LoadAllVolumeSummaries() ([]domain.VolumeSummary, error)
- func (s *Store) LoadAndClearLastCommit() (*domain.CommitResult, error)
- func (s *Store) LoadAndClearLastReview() (*domain.ReviewEntry, error)
- func (s *Store) LoadArcSummaries(volume int) ([]domain.ArcSummary, error)
- func (s *Store) LoadArcSummary(volume, arc int) (*domain.ArcSummary, error)
- func (s *Store) LoadChapterContent(chapter int) (string, int, error)
- func (s *Store) LoadChapterPlan(chapter int) (*domain.ChapterPlan, error)
- func (s *Store) LoadChapterRange(from, to, maxRunes int) (map[int]string, error)
- func (s *Store) LoadChapterText(chapter int) (string, error)
- func (s *Store) LoadCharacters() ([]domain.Character, error)
- func (s *Store) LoadDraft(chapter int) (string, error)
- func (s *Store) LoadForeshadowLedger() ([]domain.ForeshadowEntry, error)
- func (s *Store) LoadLastCommit() (*domain.CommitResult, error)
- func (s *Store) LoadLastReview(fromChapter int) (*domain.ReviewEntry, error)
- func (s *Store) LoadLastReviewSignal() (*domain.ReviewEntry, error)
- func (s *Store) LoadLatestSnapshots() ([]domain.CharacterSnapshot, error)
- func (s *Store) LoadLayeredOutline() ([]domain.VolumeOutline, error)
- func (s *Store) LoadOutline() ([]domain.OutlineEntry, error)
- func (s *Store) LoadPremise() (string, error)
- func (s *Store) LoadProgress() (*domain.Progress, error)
- func (s *Store) LoadRecentStateChanges(currentChapter, count int) ([]domain.StateChange, error)
- func (s *Store) LoadRecentSummaries(current, count int) ([]domain.ChapterSummary, error)
- func (s *Store) LoadRecentTimeline(current, window int) ([]domain.TimelineEvent, error)
- func (s *Store) LoadRelationships() ([]domain.RelationshipEntry, error)
- func (s *Store) LoadReview(chapter int) (*domain.ReviewEntry, error)
- func (s *Store) LoadRunMeta() (*domain.RunMeta, error)
- func (s *Store) LoadSnapshots(volume, arc int) ([]domain.CharacterSnapshot, error)
- func (s *Store) LoadStateChanges() ([]domain.StateChange, error)
- func (s *Store) LoadSummary(chapter int) (*domain.ChapterSummary, error)
- func (s *Store) LoadTimeline() ([]domain.TimelineEvent, error)
- func (s *Store) LoadVolumeSummary(volume int) (*domain.VolumeSummary, error)
- func (s *Store) LoadWorldRules() ([]domain.WorldRule, error)
- func (s *Store) LocateChapter(chapter int) (volume, arc int, err error)
- func (s *Store) MarkChapterComplete(chapter, wordCount int, hookType, dominantStrand string) error
- func (s *Store) MarkComplete() error
- func (s *Store) SaveArcSummary(sum domain.ArcSummary) error
- func (s *Store) SaveChapterPlan(plan domain.ChapterPlan) error
- func (s *Store) SaveCharacterSnapshots(volume, arc int, snapshots []domain.CharacterSnapshot) error
- func (s *Store) SaveCharacters(chars []domain.Character) error
- func (s *Store) SaveCheckpoint(label string) error
- func (s *Store) SaveDraft(chapter int, content string) error
- func (s *Store) SaveFinalChapter(chapter int, content string) error
- func (s *Store) SaveForeshadowLedger(entries []domain.ForeshadowEntry) error
- func (s *Store) SaveLastCommit(result domain.CommitResult) error
- func (s *Store) SaveLastReview(r domain.ReviewEntry) error
- func (s *Store) SaveLayeredOutline(volumes []domain.VolumeOutline) error
- func (s *Store) SaveOutline(entries []domain.OutlineEntry) error
- func (s *Store) SavePremise(content string) error
- func (s *Store) SaveProgress(p *domain.Progress) error
- func (s *Store) SaveRelationships(entries []domain.RelationshipEntry) error
- func (s *Store) SaveReview(r domain.ReviewEntry) error
- func (s *Store) SaveRunMeta(meta domain.RunMeta) error
- func (s *Store) SaveSummary(sum domain.ChapterSummary) error
- func (s *Store) SaveTimeline(events []domain.TimelineEvent) error
- func (s *Store) SaveVolumeSummary(sum domain.VolumeSummary) error
- func (s *Store) SaveWorldRules(rules []domain.WorldRule) error
- func (s *Store) SetFlow(flow domain.FlowState) error
- func (s *Store) SetLayered(layered bool) error
- func (s *Store) SetPendingRewrites(chapters []int, reason string) error
- func (s *Store) SetPendingSteer(input string) error
- func (s *Store) SetPlanningTier(tier domain.PlanningTier) error
- func (s *Store) SetTotalChapters(n int) error
- func (s *Store) UpdateForeshadow(chapter int, updates []domain.ForeshadowUpdate) error
- func (s *Store) UpdatePhase(phase domain.Phase) error
- func (s *Store) UpdateRelationships(changes []domain.RelationshipEntry) error
- func (s *Store) UpdateVolumeArc(volume, arc int) error
- func (s *Store) ValidateChapterCommit(chapter int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArcBoundary ¶
type ArcBoundary struct {
IsArcEnd bool // 是否为弧内最后一章
IsVolumeEnd bool // 是否同时为卷内最后一章
Volume int // 当前章所在卷
Arc int // 当前章所在弧
NextVolume int // 下一章所在卷(0 = 全书结束)
NextArc int // 下一章所在弧(0 = 全书结束)
}
ArcBoundary 弧边界信息。
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store 封装小说输出目录,提供所有状态读写操作。
func (*Store) AppendDraft ¶
AppendDraft 追加内容到现有草稿(续写模式)。 读取和写入在同一个写锁内完成,防止并发追加丢失数据。
func (*Store) AppendStateChanges ¶
func (s *Store) AppendStateChanges(changes []domain.StateChange) error
AppendStateChanges 追加角色状态变化到 meta/state_changes.json。
func (*Store) AppendSteerEntry ¶
func (s *Store) AppendSteerEntry(entry domain.SteerEntry) error
AppendSteerEntry 追加用户干预记录到 meta/run.json。
func (*Store) AppendTimelineEvents ¶
func (s *Store) AppendTimelineEvents(newEvents []domain.TimelineEvent) error
AppendTimelineEvents 追加时间线事件。
func (*Store) CheckArcBoundary ¶
func (s *Store) CheckArcBoundary(chapter int) (*ArcBoundary, error)
CheckArcBoundary 检查某章是否为弧/卷的最后一章。 非分层大纲或未找到章节时返回 nil。
func (*Store) ClearHandledSteer ¶
ClearHandledSteer 原子性地清除 PendingSteer 并重置 FlowSteering 状态。 同时操作 run.json 和 progress.json,在同一个写锁内完成,避免崩溃导致不一致。
func (*Store) ClearInProgress ¶
ClearInProgress 清除进度中间状态(章节提交后调用)。
func (*Store) ClearLastCommit ¶
ClearLastCommit 清除 commit 信号文件,防止重复消费。
func (*Store) ClearLastReview ¶
ClearLastReview 清除审阅信号文件,防止重复消费。
func (*Store) ClearLayeredOutline ¶
ClearLayeredOutline 清理分层大纲文件,供从长篇降级为普通大纲时使用。
func (*Store) ClearPendingRewrites ¶
ClearPendingRewrites 强制清空重写队列。
func (*Store) ClearPendingSteer ¶
ClearPendingSteer 清除已处理的 Steer 指令。
func (*Store) ClearStaleSignals ¶
func (s *Store) ClearStaleSignals()
ClearStaleSignals 清理残留的信号文件。 在进程重启时调用,防止上次崩溃遗留的信号被误消费。
func (*Store) CompleteRewrite ¶
CompleteRewrite 从待重写队列中移除已完成的章节。 队列清空时自动将 Flow 重置为 writing 并清除 RewriteReason。
func (*Store) ExtractDialogue ¶
ExtractDialogue 从已提交章节中提取指定角色的对话片段。 通过检查对话所在段落是否包含角色名/别名来关联。
func (*Store) ExtractStyleAnchors ¶
ExtractStyleAnchors 从已提交章节中提取代表性段落作为风格锚点。 选取描写密度高(非对话、非短句)的段落。
func (*Store) GetChapterFromLayered ¶
func (s *Store) GetChapterFromLayered(chapter int) (*domain.OutlineEntry, error)
GetChapterFromLayered 从分层大纲中按全局章节号查找。
func (*Store) GetChapterOutline ¶
func (s *Store) GetChapterOutline(chapter int) (*domain.OutlineEntry, error)
GetChapterOutline 获取指定章节的大纲条目。
func (*Store) InitProgress ¶
InitProgress 创建初始进度。
func (*Store) InitRunMeta ¶
InitRunMeta 初始化或更新运行元信息,保留已有的 SteerHistory。
func (*Store) LoadActiveForeshadow ¶
func (s *Store) LoadActiveForeshadow() ([]domain.ForeshadowEntry, error)
LoadActiveForeshadow 返回未回收的伏笔条目(status != "resolved")。
func (*Store) LoadAllSummaries ¶
func (s *Store) LoadAllSummaries(current int) ([]domain.ChapterSummary, error)
LoadAllSummaries 加载 current 章之前的所有摘要(短篇全量模式)。
func (*Store) LoadAllVolumeSummaries ¶
func (s *Store) LoadAllVolumeSummaries() ([]domain.VolumeSummary, error)
LoadAllVolumeSummaries 加载所有已有卷摘要。 从分层大纲获取实际卷数,无分层大纲时扫描到首个缺失为止。
func (*Store) LoadAndClearLastCommit ¶
func (s *Store) LoadAndClearLastCommit() (*domain.CommitResult, error)
LoadAndClearLastCommit 原子性读取并清除 commit 信号,防止 TOCTOU 竞态。
func (*Store) LoadAndClearLastReview ¶
func (s *Store) LoadAndClearLastReview() (*domain.ReviewEntry, error)
LoadAndClearLastReview 原子性读取并清除审阅信号,防止 TOCTOU 竞态。
func (*Store) LoadArcSummaries ¶
func (s *Store) LoadArcSummaries(volume int) ([]domain.ArcSummary, error)
LoadArcSummaries 加载一卷内所有已有弧摘要。 从分层大纲获取实际弧数,无分层大纲时扫描到首个缺失为止。
func (*Store) LoadArcSummary ¶
func (s *Store) LoadArcSummary(volume, arc int) (*domain.ArcSummary, error)
LoadArcSummary 读取指定弧的摘要。
func (*Store) LoadChapterContent ¶
LoadChapterContent 加载章节草稿正文及字数。
func (*Store) LoadChapterPlan ¶
func (s *Store) LoadChapterPlan(chapter int) (*domain.ChapterPlan, error)
LoadChapterPlan 读取章节构思。
func (*Store) LoadChapterRange ¶
LoadChapterRange 读取指定范围的终稿原文片段(每章截取前 maxRunes 个字符)。
func (*Store) LoadChapterText ¶
LoadChapterText 读取已提交的终稿原文。
func (*Store) LoadCharacters ¶
LoadCharacters 从 characters.json 读取角色档案。
func (*Store) LoadForeshadowLedger ¶
func (s *Store) LoadForeshadowLedger() ([]domain.ForeshadowEntry, error)
LoadForeshadowLedger 读取伏笔账本。
func (*Store) LoadLastCommit ¶
func (s *Store) LoadLastCommit() (*domain.CommitResult, error)
LoadLastCommit 读取最近一次 commit 结果。
func (*Store) LoadLastReview ¶
func (s *Store) LoadLastReview(fromChapter int) (*domain.ReviewEntry, error)
LoadLastReview 读取最近一次全局审阅。从 chapter 往前搜索。
func (*Store) LoadLastReviewSignal ¶
func (s *Store) LoadLastReviewSignal() (*domain.ReviewEntry, error)
LoadLastReviewSignal 读取审阅信号文件。
func (*Store) LoadLatestSnapshots ¶
func (s *Store) LoadLatestSnapshots() ([]domain.CharacterSnapshot, error)
LoadLatestSnapshots 加载最近一次角色快照(按卷弧倒序查找)。 从分层大纲获取实际卷弧数量,避免盲扫。
func (*Store) LoadLayeredOutline ¶
func (s *Store) LoadLayeredOutline() ([]domain.VolumeOutline, error)
LoadLayeredOutline 读取分层大纲。
func (*Store) LoadOutline ¶
func (s *Store) LoadOutline() ([]domain.OutlineEntry, error)
LoadOutline 从 outline.json 读取结构化大纲。
func (*Store) LoadPremise ¶
LoadPremise 读取 premise.md。不存在时返回空字符串。
func (*Store) LoadProgress ¶
LoadProgress 读取 meta/progress.json。不存在时返回 nil。
func (*Store) LoadRecentStateChanges ¶
func (s *Store) LoadRecentStateChanges(currentChapter, count int) ([]domain.StateChange, error)
LoadRecentStateChanges 加载指定章节之前最近 count 章的状态变化。
func (*Store) LoadRecentSummaries ¶
func (s *Store) LoadRecentSummaries(current, count int) ([]domain.ChapterSummary, error)
LoadRecentSummaries 加载 current 章之前最近 count 章的摘要。
func (*Store) LoadRecentTimeline ¶
func (s *Store) LoadRecentTimeline(current, window int) ([]domain.TimelineEvent, error)
LoadRecentTimeline 返回最近 window 章内的时间线事件(chapter >= current-window)。
func (*Store) LoadRelationships ¶
func (s *Store) LoadRelationships() ([]domain.RelationshipEntry, error)
LoadRelationships 读取人物关系状态。
func (*Store) LoadReview ¶
func (s *Store) LoadReview(chapter int) (*domain.ReviewEntry, error)
LoadReview 读取章节审阅结果。
func (*Store) LoadRunMeta ¶
LoadRunMeta 读取运行元信息。
func (*Store) LoadSnapshots ¶
func (s *Store) LoadSnapshots(volume, arc int) ([]domain.CharacterSnapshot, error)
LoadSnapshots 读取指定卷弧的角色快照。
func (*Store) LoadStateChanges ¶
func (s *Store) LoadStateChanges() ([]domain.StateChange, error)
LoadStateChanges 读取全部状态变化记录。
func (*Store) LoadSummary ¶
func (s *Store) LoadSummary(chapter int) (*domain.ChapterSummary, error)
LoadSummary 读取指定章节的摘要。
func (*Store) LoadTimeline ¶
func (s *Store) LoadTimeline() ([]domain.TimelineEvent, error)
LoadTimeline 读取时间线。
func (*Store) LoadVolumeSummary ¶
func (s *Store) LoadVolumeSummary(volume int) (*domain.VolumeSummary, error)
LoadVolumeSummary 读取指定卷的摘要。
func (*Store) LoadWorldRules ¶
LoadWorldRules 读取世界规则。
func (*Store) LocateChapter ¶
LocateChapter 根据全局章节号定位所在的卷和弧。
func (*Store) MarkChapterComplete ¶
MarkChapterComplete 标记章节完成,原子性更新进度。 支持重写场景:如果章节已完成,先减去旧字数再加新字数。 hookType 和 dominantStrand 用于节奏追踪,可为空。
func (*Store) SaveArcSummary ¶
func (s *Store) SaveArcSummary(sum domain.ArcSummary) error
SaveArcSummary 保存弧级摘要到 summaries/arc-v{vol}a{arc}.json。
func (*Store) SaveChapterPlan ¶
func (s *Store) SaveChapterPlan(plan domain.ChapterPlan) error
SaveChapterPlan 保存章节构思到 drafts/{ch}.plan.json。
func (*Store) SaveCharacterSnapshots ¶
func (s *Store) SaveCharacterSnapshots(volume, arc int, snapshots []domain.CharacterSnapshot) error
SaveCharacterSnapshots 保存角色状态快照到 meta/snapshots/v{vol}a{arc}.json。
func (*Store) SaveCharacters ¶
SaveCharacters 同时保存 characters.json 和 characters.md。
func (*Store) SaveCheckpoint ¶
SaveCheckpoint 保存当前进度快照到 meta/checkpoints/。
func (*Store) SaveFinalChapter ¶
SaveFinalChapter 保存最终章节正文到 chapters/{ch}.md。
func (*Store) SaveForeshadowLedger ¶
func (s *Store) SaveForeshadowLedger(entries []domain.ForeshadowEntry) error
SaveForeshadowLedger 全量写入 foreshadow_ledger.json + foreshadow_ledger.md。
func (*Store) SaveLastCommit ¶
func (s *Store) SaveLastCommit(result domain.CommitResult) error
SaveLastCommit 保存最近一次 commit 结果到 meta/last_commit.json。 用于宿主程序读取结构化信号。
func (*Store) SaveLastReview ¶
func (s *Store) SaveLastReview(r domain.ReviewEntry) error
SaveLastReview 保存最近一次审阅结果到 meta/last_review.json,供宿主读取。
func (*Store) SaveLayeredOutline ¶
func (s *Store) SaveLayeredOutline(volumes []domain.VolumeOutline) error
SaveLayeredOutline 保存分层大纲(长篇模式)。 同时保存 layered_outline.json(机器读)和 layered_outline.md(人读)。
func (*Store) SaveOutline ¶
func (s *Store) SaveOutline(entries []domain.OutlineEntry) error
SaveOutline 同时保存 outline.json(机器读)和 outline.md(人读)。
func (*Store) SavePremise ¶
SavePremise 保存故事前提到 premise.md。
func (*Store) SaveProgress ¶
SaveProgress 保存进度到 meta/progress.json。
func (*Store) SaveRelationships ¶
func (s *Store) SaveRelationships(entries []domain.RelationshipEntry) error
SaveRelationships 全量写入 relationship_state.json + relationship_state.md。
func (*Store) SaveReview ¶
func (s *Store) SaveReview(r domain.ReviewEntry) error
SaveReview 保存审阅结果。scope=chapter 写 reviews/{ch}.json,scope=global 写 reviews/{ch}-global.json。
func (*Store) SaveRunMeta ¶
SaveRunMeta 保存运行元信息到 meta/run.json。
func (*Store) SaveSummary ¶
func (s *Store) SaveSummary(sum domain.ChapterSummary) error
SaveSummary 保存章节摘要到 summaries/{ch}.json。
func (*Store) SaveTimeline ¶
func (s *Store) SaveTimeline(events []domain.TimelineEvent) error
SaveTimeline 全量写入 timeline.json + timeline.md。
func (*Store) SaveVolumeSummary ¶
func (s *Store) SaveVolumeSummary(sum domain.VolumeSummary) error
SaveVolumeSummary 保存卷级摘要到 summaries/vol-v{vol}.json。
func (*Store) SaveWorldRules ¶
SaveWorldRules 全量写入 world_rules.json + world_rules.md。
func (*Store) SetPendingRewrites ¶
SetPendingRewrites 设置待重写章节队列和原因。
func (*Store) SetPendingSteer ¶
SetPendingSteer 记录未完成的 Steer 指令,用于中断恢复。
func (*Store) SetPlanningTier ¶
func (s *Store) SetPlanningTier(tier domain.PlanningTier) error
SetPlanningTier 记录当前作品采用的规划级别。
func (*Store) SetTotalChapters ¶
SetTotalChapters 根据大纲长度设定总章节数。
func (*Store) UpdateForeshadow ¶
func (s *Store) UpdateForeshadow(chapter int, updates []domain.ForeshadowUpdate) error
UpdateForeshadow 批量应用伏笔增量操作。
func (*Store) UpdatePhase ¶
UpdatePhase 更新创作阶段。
func (*Store) UpdateRelationships ¶
func (s *Store) UpdateRelationships(changes []domain.RelationshipEntry) error
UpdateRelationships 合并关系变化。相同人物对的关系会被更新为最新值。
func (*Store) UpdateVolumeArc ¶
UpdateVolumeArc 更新当前卷弧位置。
func (*Store) ValidateChapterCommit ¶
ValidateChapterCommit 校验当前章节是否允许提交。 在重写/打磨流程中,只允许提交待处理队列中的章节。