Skip to content

About

Shared zero-dependency 3-layer spatial anatomy, legal-cavity MEP routing graph, and declarative code constraint engine for Pascal Editor plugins.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

@kruschdev/pascal-mep-kernel

License: MIT npm version Zero Dependencies Kernel Tests Full Suite Purity Gate

A zero-dependency, framework-free TypeScript spatial anatomy, legal-cavity routing, and declarative code constraint kernel shared across my Pascal Editor Structural, MEP, and Architectural Surfaces plugins.

I built @kruschdev/pascal-mep-kernel so Structural (IRC), Plumbing (IPC), HVAC (IMC), Electrical (NEC), and Architectural Surfaces (IRC/GA-214/IECC/TCNA) all observe the exact same building geometry, route strictly inside legal building cavities, and enforce identical placement and audit thresholds from one single source of truth.

Aymeric House Finished Architecture vs 4-Trade Coordinated MEP Cutaway

Aymeric House 4-Trade Cutaway Showcase (Recorded Live in Pascal Editor)

Live Pascal Editor Cutaway Showcase on Aymeric House: Finished Two-Story Architecture peeling into Framing X-Ray and layering Structural (IRC), Plumbing (IPC), Dual-Wing HVAC (IMC), and Electrical (NEC) to 1,412 coordinated nodes with 0/0/0/0 audit errors

Watch 4-Trade Deep-Dive Walkthrough w/ Breaker Box & BOMs (assets/aymeric-house-4trade-deepdive-x.mp4) · Cutaway Showcase (assets/aymeric-house-4trade-cutaway.mp4) · Media Kit · Deep-Dive Script

On Aymeric House (two stories, 21 zones, U-shaped open Lanai courtyard with pool, pitched wing roofs, and central flat roof), one coordinated pass produces 1,412 nodes with 0 / 0 / 0 / 0 errors, zero ducts or electrical cables crossing the courtyard, and zero wires cutting any of the 30 door and window openings.

6-Plugin Pascal MEP, Surfaces & Catalog Ecosystem

All six MIT-licensed external plugins coordinate in real-world jobsite priority order (1 -> 2 -> 3 -> 4 -> 5) alongside the SolidCraft B-rep Manufacturer SKU Catalog on top of @kruschdev/pascal-mep-kernel:

Priority Plugin Standards Unit Tests Role in Ecosystem
Core @kruschdev/pascal-mep-kernel 3-Layer Engine 169 / 169 Spatial anatomy, legal-cavity router, declarative rule evaluator
#1 @kruschdev/pascal-plugin-structural IRC / AWC NDS / AISC 104 / 104 Framing skeleton, engineered beams/columns, connectors, fire blocking
#2 @kruschdev/pascal-plugin-plumbing IPC / UPC / IFGC 79 / 79 Gravity-sloped DWV, dry vents, PEX manifolds, fuel gas, dryer vents
#3 @kruschdev/pascal-plugin-hvac IMC / Manual J-D-S / IECC 95 / 95 Dual-wing split/mini-split HVAC, trunks, ERV, exhausts, condensate
#4 @kruschdev/pascal-plugin-electrical NEC / NFPA 72 135 / 135 Panels, 3D cover-off interior, circuits, opening-safe & courtyard-safe routing
#5 @kruschdev/pascal-plugin-surfaces IRC / GA-214 / IECC / TCNA / NWFA / NSI 57 / 57 All 15 surface & envelope domains, Pool Surfaces, 44 recipes, 236 SKUs, 60 procedural GLBs + 28 B-rep swatches, 7 3D cutaways
Catalog @kruschdev/pascal-plugin-catalog CSI MasterFormat / SolidCraft B-Rep 19 / 19 606+ real-world manufacturer B-rep SKUs across 9 trades & 108 brands, + Real SKU registration, 16 Site-Built raw material takeoffs

Architecture (3 Layers)

  1. Layer 1: Shared Cross-Trade Spatial Anatomy (@kruschdev/pascal-mep-kernel/anatomy)

    • WeakMap-memoized compileBuildingAnatomy(nodes) so all four trades observe identical building geometry in O(1) amortized lookups.
    • Story and level hierarchy (resolveNodeLevelId, belongsToLevel, compareLevelsVertically, resolveLevelHeightM, isGroundOrLowestWalledLevel, isHighestWalledLevelInBuilding, findImmediateLowerWalledLevel) ranking explicit level ordinal before baseElevation.
    • 7-type canonical roof shell (flat, shed, gable, hip, dutch, mansard, conical) with multi-hop parent roof transform accumulation, per-segment spatial adoption, and upper-wing seating.
    • Unified wall and opening extraction (native door/window nodes plus wall-attached item openings) with unclamped rawSillYM for floor-to-ceiling storefront glass, framed framedSillYM, and exact 3D OrientedPrismY keepout prisms.
    • Concave building footprint enclosure (pointInPolygon2D, planar half-edge bounded faces, 16-ray fallback, NFD-normalized multilingual room polygons, outdoor courtyard exclusion, and footprint clustering).
    • Cross-trade spatial occupancy grid (TradeOccupancyGrid, exact rotated OBB beam/column clash detection, resolveMepRunExtents, and strict trade-priority ordering structural < plumbing < hvac < electrical).
  2. Layer 2: Legal-Space-First Routing Graph (@kruschdev/pascal-mep-kernel/router)

    • compileLegalCavityGraph builds navigable cavities by construction: solid wall stud bays minus 3D door/window/header keepout prisms, enclosed overhead plenums and attics clamped beneath roof surfaces, and under-slab/crawlspace trenches.
    • routeInLegalCavities solves constrained shortest paths across orthogonal, euclidean-cavity, gravity-slope, and non-descending-vent modes with TradeOccupancyGrid reservation and cumulative bend budgets.
  3. Layer 3: Single-Source Declarative Code Rule Engine (@kruschdev/pascal-mep-kernel/rules)

    • Typed DeclarativeRule schema and dual-projection evaluator (filterLegalCandidates for placement/routing generators and evaluateDeclarativeRules for live compliance auditors).
    • Enforces placement-vs-audit soundness (effectivePlacementThreshold + validateRuleTable) so placement rules are never looser than audit rules.

Installation and Subpath Exports

npm install @kruschdev/pascal-mep-kernel
# or
bun add @kruschdev/pascal-mep-kernel

The published npm tarball (77 KB) ships precompiled pure ESM + .d.ts with zero runtime dependencies and zero React/JSX, so Next.js, Turbopack, Vite, Bun, and Node hosts can consume it directly without extra transpilePackages configuration.

Subpath Purpose Runtime Constraints
@kruschdev/pascal-mep-kernel Unified barrel re-exporting types, anatomy, router, and rules Zero deps, zero React/Three/@pascal-app/*/node:*
@kruschdev/pascal-mep-kernel/types Canonical Vec2, Vec3, OrientedPrismY, SceneNodeLike, and trade priority types Pure TypeScript
@kruschdev/pascal-mep-kernel/anatomy compileBuildingAnatomy, roof shell, openings, concave footprints, TradeOccupancyGrid Pure TypeScript
@kruschdev/pascal-mep-kernel/router compileLegalCavityGraph, routeInLegalCavities, gravity/vent/orthogonal/cavity modes Pure TypeScript
@kruschdev/pascal-mep-kernel/rules DeclarativeRule schema, validateRuleTable, filterLegalCandidates, evaluateDeclarativeRules Pure TypeScript

Corpus and Suite Verification

  • Unit Tests: 169 / 169 kernel tests (135,888 assertions) and 658 / 658 tests across the full 7-repo stack (158,984 assertions, 0 failures).
  • Boundary Purity: 5 / 5 kernel subpaths verified 100% framework-free and zero-dependency (34 / 34 entry boundary gates across the full stack).
  • Real-World Corpus: Audited across 246 real public Pascal buildings (145 / 246 completely 0/0/0/0 clean across all four trades, PLB 245/246, HVC 222/246, ELC 198/246, STR 167/246, 0 crashes, 0 NaN geometry outputs).
bun install
bun run check # tsc --noEmit && bun test src && bun run check:purity && bun run build

License

MIT. Created by Kevin Ruschman (@kruschdev).

About

Shared zero-dependency 3-layer spatial anatomy, legal-cavity MEP routing graph, and declarative code constraint engine for Pascal Editor plugins.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages