Skip to content

V3.0.0#38

Draft
abrisene wants to merge 38 commits intomasterfrom
v3.0.0
Draft

V3.0.0#38
abrisene wants to merge 38 commits intomasterfrom
v3.0.0

Conversation

@abrisene
Copy link
Copy Markdown
Owner

No description provided.

abrisene and others added 30 commits February 12, 2026 21:53
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>
- Add backward() as primary method, deprecate last() (#27)
- Add freeze()/toMutable() bridges between mutable and immutable variants (#29)
- Fix stale Jest→Vitest and random-js→MT19937 references in CHANGELOG/README (#31)

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>
abrisene and others added 8 commits March 11, 2026 22:54
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant