@tushell/story-lattice
v0.1.0
Published
Storytelling Lattice for the Tushell Platform: narrative DAG types, structural analysis (entry/exit points, bottlenecks, branches, longest path), and Mermaid diagram generation.
Downloads
188
Keywords
Readme
@tushell/story-lattice
The Storytelling Lattice: a narrative DAG of story units (scenes, events, beats, insights, bottlenecks, branches, moments) connected by causality, temporal, leads-to, and echoes edges. Aligned with NCP (Narrative Context Protocol) story types.
Implements rispecs/04-story-engine/storytelling-lattice.rispec.md.
What's inside
- Types —
StoryLattice,LatticeNode,LatticeEdge,LatticeAnalysis, plusisStoryLattice/isStoryLatticeStringguards andparseStoryLattice - DAG analysis —
analyzeLattice()computes entry/exit points, bottlenecks, branches, and the longest path - Mermaid generation —
generateMermaidDag()renders a themed flowchart with per-type node shapes and Four Directions coloring - Key helpers —
formatLatticeKey()/singularFallbackKey()for thelattices:/lattice:Redis namespaces
Usage
import { parseStoryLattice, analyzeLattice, generateMermaidDag } from "@tushell/story-lattice"
const lattice = parseStoryLattice(redisValue)
if (lattice) {
const analysis = analyzeLattice(lattice) // depth, bottlenecks, longest_path...
const mermaid = generateMermaidDag(lattice) // render with any Mermaid runtime
}No runtime dependencies.
