Conversation
Breaking changes: - Modular MarkovChain: monolithic markov.ts split into markov-chain.ts, batch.ts, blend.ts, multi-dim-chain.ts, utils.ts, types.ts, defaults.ts - Removed ScaledMarkovChain (non-serializable, broken encapsulation) - Removed analysis/export/visualization methods (extractPatterns, findSimilar, exportAsGraph, diff, toJSON, rankByLikelihood, isAnomaly, withSelector) - Removed random-js dependency; internal Mersenne Twister 19937 PRNG - Removed StateSelector type (dead code after withSelector removal) Added: - Generic types: MarkovChain<T>, Distribution<T> with full type safety - MarkovChainBatch for efficient bulk sequence/edge additions - Chain blending with 5 strategies (arithmetic, geometric, harmonic, max, min) - MultiDimMarkovChain with named-function registry for serializable state keys - Sequence scoring: log probability and perplexity via score() - Constraint-based generation: length, content, pattern, custom validators - Static dual-API: blendDTOs(), score(), getStats() operate on DTOs directly - Internal MT19937 with rejection sampling and 53-bit real resolution - ESM/CJS dual output via tsup Fixed: - MarkovChainBatch.commit() now returns MarkovChain<T> (was untyped) - MCAnalyzeOptions properly omits inherited constraints field - MultiDimMarkovChain.clone() no longer shares engine reference - Removed unnecessary type casts in batch operations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ethods Instance mutation methods (addSequence, addSequences, addEdge, add, addValues, remove) now return new instances instead of mutating `this` via the removed private `update()` method. The engine is cloned so original and new instances have independent RNG state. Constructor uses static method directly for initial sequence ingestion. Tests and examples updated to capture return values or use chaining. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reflects new return types on instance mutation methods, adds pages for MarkovChainBatch, MultiDimMarkovChain, blend types, constraints, score, and stats interfaces. Removes stale typedoc assets from version upgrade. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Drop Travis CI (.travis.yml), Jest config (jest.config.js), and package-lock.json in preparation for pnpm + Vitest migration. Add .nvmrc pinning Node 22. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace Jest + ts-jest with Vitest for native ESM support without --experimental-vm-modules. Add vitest.config.ts with v8 coverage and matching thresholds. Update test imports and package.json scripts/deps. Remove coveralls, @types/jest, jest, ts-jest. Apply gts formatting fixes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Generated HTML docs are now excluded from version control. GitHub Actions will regenerate and deploy to GitHub Pages on version tags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ci.yml: lint, typecheck, test (Node 18/20/22 matrix), build - docs.yml: typedoc → GitHub Pages on version tags + manual dispatch - release.yml: validate → npm publish with provenance → GitHub Release Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use dts: { resolve: true } for faster type generation. Update
CLAUDE.md build instructions to reflect pnpm, Vitest, and
CI-deployed docs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflicts: keep pnpm lockfile (delete package-lock.json), keep v3.0.0 devDependencies (vitest, modern toolchain). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CI was failing because pnpm/action-setup@v4 requires the pnpm version to be specified via packageManager in package.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two issues caused gts lint to silently fail in CI: 1. pnpm strict isolation prevented eslint from resolving gts plugins — fixed with .npmrc public-hoist-pattern for eslint/prettier pkgs 2. .prettierrc.js used CommonJS (module.exports) but package.json has "type": "module" — renamed to .prettierrc.cjs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ports RandomSampler from @acausal/utils-random into the core package. Provides seeded sampling from common distributions (normal, truncated normal, exponential, gamma, beta, Poisson, binomial, geometric, Weibull, Cauchy, logistic, log-normal) built on top of the MT19937 Random class. Includes data-driven sampleDistribution(params) that dispatches on typed DistributionParams objects, enabling YAML-driven distribution definitions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…kovChain Mutable instances now mutate in place and return `this` for chaining (private → protected for subclass access). Immutable variants return new instances from mutating methods for functional patterns and safe sharing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix Distribution.new() shared singleton mutation (#1) - Fix Box-Muller and logistic log(0) singularity (#2) - Fix pickWeighted masking to redistribute proportionally (#3) - Deep-clone gram distributions in MarkovChain.clone() (#4) - Fix blend weight renormalization for geometric/harmonic (#5, #6) - Fix single-distribution blend reference leak (#10) - Fix ImmutableMultiDimMarkovChain engine sharing (#7) - Add parameter validation to all 14 sampler methods (#11) - Add stateKeyRegistry collision detection + unregisterStateKey (#13) - Add generate() min/max validation + empty-string rejection (#14) - Add Weibull 3-parameter location support (#18) - Document `as this` subclass limitation on immutable variants (#8) - Add NaN/Infinity validation to Distribution.addSourceValues/addNormalValues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Document MultiDimMarkovChain.addSequence clone-on-write asymmetry (#9) - Add delimiter collision warning in addSequence (#12) - Add maxOrder > 0 validation in MarkovChain constructor/new (#14) - Document Poisson draw count divergence (#15) - Rename truncatedNormal → clampedNormal, keep deprecated alias (#16) - Optimize ImmutableMultiDimMarkovChain.addSequence (#17) - Document MT_PREWARM constant rationale (#19) - Document analyze() PRNG side effects (#20) - Document constraint retry cap in generate() (#21) - Document PRNG correlation on fork for immutable variants (#22) - Export MersenneTwister19937 and createEntropy for advanced use (#23) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Mark internal static methods and DTO types with @internal (#24, #25) - Convert Distribution.pick and MarkovChain.new to options objects (#26) - Replace MCInsertOption boolean|string with false|string union (#28) - Add int()/float() aliases on Random, mark real()/integer() internal (#30) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…king - 12 distribution shape tests: mean/variance/range over 10k samples - Blend strategy validation: arithmetic 50/50, geometric/harmonic sanity - Masking proportional redistribution test over 10k picks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract validateWeights() in distribution.ts to deduplicate NaN/Infinity checks - Extract arithmeticMean() in blend.ts to deduplicate 3 identical reduces - Fix bool() to use this.real() instead of bypassing instance method - Remove leftover commented-out code in distribution.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add tests for Random.int/float aliases and pickWeighted edge cases - Add sampleDistribution tests for all remaining distribution types - Test RandomSampler.engine getter - Remove unused bool() export from mersenne-twister Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pre-filter at L83-91 already excludes entries with value <= 0, making the subsequent nonZeroValues check always true. Removed the dead else branches to improve coverage and reduce confusion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move hand-written docs from readme/ to docs/ - Typedoc now outputs to .site/ (gitignored) - Update CI workflow, package.json clean script, readme links - docs/.local/ remains gitignored for planning files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Standalone Astro/Starlight project in website/ - Auto-generated API reference via starlight-typedoc (52 pages) - Hand-written guides: distributions, Markov chains, quick start - Dark mode default, GitHub social link, Pagefind search - CI workflow updated to build and deploy Starlight to GitHub Pages - Scripts: docs (build), docs:dev (preview), docs:typedoc (raw) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix all 15 prettier formatting errors across 5 files - Consolidate 4 separate CI jobs into one sequential pipeline per node version (lint → typecheck → test → build) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v3.0.0 review fixes, cleanup, and coverage
New guides: RandomSampler (statistical distributions, data-driven sampling), chain analysis (getStats, score, analyze), immutable patterns (freeze/toMutable, PRNG forking). Expanded markov-chains guide with batch operations, blending strategies (5 strategies with decision tree), MultiDimMarkovChain, and constraint-based generation. Added architecture diagram to introduction. Installed astro-mermaid for diagram support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
astro-mermaid's injectScript('page') doesn't work with Starlight.
Load mermaid from CDN via Starlight's head config instead. The
astro-mermaid remark plugin still handles code block transformation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Name Generator: Markov chain name generation with training data editor - Distribution Explorer: 12 statistical distributions with live histograms - Weight Editor: Weighted distribution builder with probability visualization - Chain Visualizer: Transition matrix and gram structure inspector - Blend Comparison: Side-by-side blend strategy comparison (5 strategies) All components use React islands (client:load) with shared playground CSS that inherits Starlight's theme variables. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…style cleanup - Switch .playground-controls from flex-wrap to CSS grid for consistent column alignment across all components - Reduce separator margins and h3 visual weight for tighter vertical rhythm - Add hover states to histogram bars and tags - Increase histogram height to 200px for better distribution shape readability - Extract inline styles to CSS classes: .playground-table, .playground-items, .playground-item-row, .playground-column-header, .playground-gram-label, .playground-axis-labels, .playground-grams, .playground-small-value - Remove hardcoded dark-mode fallback colors from CSS variables - NameGenerator: rename "Generate" to "Re-roll" for clarity - DistributionExplorer: remove inline minWidth styles - WeightEditor: use CSS grid for item rows, useRef for nextId - ChainVisualizer: remove redundant Unique States section, use CSS table classes - BlendComparison: deduplicate generated names, show both chain weights, move blended column to center position, use CSS column header class Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Starlight documentation site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.