@tscircuit/capacity-autorouter 0.0.155 → 0.0.157

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -93,12 +93,16 @@ interface CapacityMeshNode {
93
93
  _targetConnectionName?: string;
94
94
  _strawNode?: boolean;
95
95
  _strawParentCapacityMeshNodeId?: CapacityMeshNodeId;
96
+ _isVirtualOffboard?: boolean;
97
+ _offboardNetName?: string;
96
98
  _adjacentNodeIds?: CapacityMeshNodeId[];
97
99
  _parent?: CapacityMeshNode;
98
100
  }
99
101
  interface CapacityMeshEdge {
100
102
  capacityMeshEdgeId: string;
101
103
  nodeIds: [CapacityMeshNodeId, CapacityMeshNodeId];
104
+ isOffboardEdge?: boolean;
105
+ offboardNetName?: string;
102
106
  }
103
107
 
104
108
  type CapacityPathId = string;
@@ -106,6 +110,10 @@ interface CapacityPath {
106
110
  capacityPathId: CapacityPathId;
107
111
  connectionName: string;
108
112
  nodeIds: CapacityMeshNodeId[];
113
+ /** True if this path was created by splitting at an offboard edge */
114
+ isFragmentedPath?: boolean;
115
+ /** MST pair connection name before fragmentation */
116
+ mstPairConnectionName?: string;
109
117
  }
110
118
 
111
119
  declare class BaseSolver {
@@ -1990,6 +1998,52 @@ declare class UselessViaRemovalSolver extends BaseSolver {
1990
1998
  visualize(): GraphicsObject;
1991
1999
  }
1992
2000
 
2001
+ interface SameNetViaMergerSolverInput {
2002
+ inputHdRoutes: HighDensityRoute$1[];
2003
+ obstacles: Obstacle[];
2004
+ colorMap: Record<string, string>;
2005
+ layerCount: number;
2006
+ connMap?: ConnectivityMap;
2007
+ outline?: Array<{
2008
+ x: number;
2009
+ y: number;
2010
+ }>;
2011
+ }
2012
+ type Via = {
2013
+ x: number;
2014
+ y: number;
2015
+ diameter: number;
2016
+ net: string;
2017
+ routeIndex: number;
2018
+ layers: number[];
2019
+ };
2020
+ declare class SameNetViaMergerSolver extends BaseSolver {
2021
+ private input;
2022
+ inputHdRoutes: HighDensityRoute$1[];
2023
+ mergedViaHdRoutes: HighDensityRoute$1[];
2024
+ unprocessedRoutes: HighDensityRoute$1[];
2025
+ vias: Via[];
2026
+ offendingVias: [Via, Via][];
2027
+ currentViaRoutes: HighDensityIntraNodeRoute$1[];
2028
+ connMap?: ConnectivityMap;
2029
+ colorMap: Record<string, string>;
2030
+ outline?: Array<{
2031
+ x: number;
2032
+ y: number;
2033
+ }>;
2034
+ obstacles: Obstacle[];
2035
+ viasByNet: Map<string, Via[]>;
2036
+ obstacleSHI: ObstacleSpatialHashIndex | null;
2037
+ hdRouteSHI: HighDensityRouteSpatialIndex | null;
2038
+ constructor(input: SameNetViaMergerSolverInput);
2039
+ private rebuildVias;
2040
+ private findNextOffendingPair;
2041
+ private handleOffendingPair;
2042
+ _step(): void;
2043
+ getMergedViaHdRoutes(): HighDensityRoute$1[] | null;
2044
+ visualize(): GraphicsObject;
2045
+ }
2046
+
1993
2047
  /**
1994
2048
  * A Disjoint Set Union (DSU) or Union-Find data structure.
1995
2049
  * It tracks a collection of disjoint sets and can efficiently merge them.
@@ -2076,6 +2130,7 @@ declare class AutoroutingPipelineSolver extends BaseSolver {
2076
2130
  deadEndSolver?: DeadEndSolver;
2077
2131
  uselessViaRemovalSolver1?: UselessViaRemovalSolver;
2078
2132
  uselessViaRemovalSolver2?: UselessViaRemovalSolver;
2133
+ sameNetViaMerger?: SameNetViaMergerSolver;
2079
2134
  multiSimplifiedPathSolver1?: MultiSimplifiedPathSolver;
2080
2135
  multiSimplifiedPathSolver2?: MultiSimplifiedPathSolver;
2081
2136
  viaDiameter: number;
@@ -2089,7 +2144,7 @@ declare class AutoroutingPipelineSolver extends BaseSolver {
2089
2144
  capacityNodes: CapacityMeshNode[] | null;
2090
2145
  capacityEdges: CapacityMeshEdge[] | null;
2091
2146
  cacheProvider: CacheProvider | null;
2092
- pipelineDef: (PipelineStep$1<typeof NetToPointPairsSolver2_OffBoardConnection> | PipelineStep$1<typeof CapacityMeshNodeSolver2_NodeUnderObstacle> | PipelineStep$1<typeof SingleLayerNodeMergerSolver> | PipelineStep$1<typeof StrawSolver> | PipelineStep$1<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep$1<typeof DeadEndSolver> | PipelineStep$1<typeof CapacityPathingGreedySolver> | PipelineStep$1<typeof CapacityPathingMultiSectionSolver> | PipelineStep$1<typeof CapacityEdgeToPortSegmentSolver> | PipelineStep$1<typeof CapacitySegmentToPointSolver> | PipelineStep$1<typeof UnravelMultiSectionSolver> | PipelineStep$1<typeof HighDensitySolver> | PipelineStep$1<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep$1<typeof UselessViaRemovalSolver> | PipelineStep$1<typeof MultiSimplifiedPathSolver>)[];
2147
+ pipelineDef: (PipelineStep$1<typeof NetToPointPairsSolver2_OffBoardConnection> | PipelineStep$1<typeof CapacityMeshNodeSolver2_NodeUnderObstacle> | PipelineStep$1<typeof SingleLayerNodeMergerSolver> | PipelineStep$1<typeof StrawSolver> | PipelineStep$1<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep$1<typeof DeadEndSolver> | PipelineStep$1<typeof CapacityPathingGreedySolver> | PipelineStep$1<typeof CapacityPathingMultiSectionSolver> | PipelineStep$1<typeof CapacityEdgeToPortSegmentSolver> | PipelineStep$1<typeof CapacitySegmentToPointSolver> | PipelineStep$1<typeof UnravelMultiSectionSolver> | PipelineStep$1<typeof HighDensitySolver> | PipelineStep$1<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep$1<typeof UselessViaRemovalSolver> | PipelineStep$1<typeof MultiSimplifiedPathSolver> | PipelineStep$1<typeof SameNetViaMergerSolver>)[];
2093
2148
  constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions$1);
2094
2149
  currentPipelineStepIndex: number;
2095
2150
  _step(): void;
@@ -2441,6 +2496,83 @@ declare class HyperAssignableViaCapacityPathingSolver extends HyperParameterSupe
2441
2496
  generateSolver(hyperParameters: HyperParameterOverrides): AssignableViaCapacityPathingSolver_DirectiveSubOptimal;
2442
2497
  }
2443
2498
 
2499
+ /**
2500
+ * Creates offboard edges between assignable via obstacles that share
2501
+ * the same `offBoardConnectsTo` net name. These obstacles represent off-board
2502
+ * connection points (like edge connectors) that are logically connected
2503
+ * through external wiring.
2504
+ *
2505
+ * The solver finds all capacity nodes with `_assignedViaObstacle.offBoardConnectsTo`,
2506
+ * groups them by net name, and creates zero-cost offboard edges between
2507
+ * matching nodes. This allows the pathing solver to route through these virtual
2508
+ * connections as if the obstacles were directly connected.
2509
+ */
2510
+ declare class OffboardCapacityNodeSolver extends BaseSolver {
2511
+ capacityNodes: CapacityMeshNode[];
2512
+ capacityEdges: CapacityMeshEdge[];
2513
+ enhancedEdges: CapacityMeshEdge[];
2514
+ private animationState;
2515
+ private assignableNodes;
2516
+ private shownNodes;
2517
+ private pendingEdges;
2518
+ private createdEdges;
2519
+ private nextEdgeId;
2520
+ private nodeMap;
2521
+ constructor(solverParams: {
2522
+ capacityNodes: CapacityMeshNode[];
2523
+ capacityEdges: CapacityMeshEdge[];
2524
+ });
2525
+ private initializeAssignableNodes;
2526
+ private initializePendingEdges;
2527
+ _step(): void;
2528
+ private createOffboardEdge;
2529
+ visualize(): GraphicsObject;
2530
+ getVirtualOffboardNodes(): CapacityMeshNode[];
2531
+ getOffboardEdges(): CapacityMeshEdge[];
2532
+ }
2533
+
2534
+ /**
2535
+ * Splits capacity paths at offboard edges into separate fragments.
2536
+ * When a path crosses an offboard edge (created by OffboardCapacityNodeSolver),
2537
+ * this solver breaks it into independent path segments.
2538
+ *
2539
+ * Each fragment becomes a separate connection with its own `connectionName`
2540
+ * (e.g., `AD_NET_frag_0`, `AD_NET_frag_1`). The solver also creates new
2541
+ * `SimpleRouteConnection` entries with appropriate `pointsToConnect` - the
2542
+ * original pad location plus a synthetic point at the offboard node.
2543
+ *
2544
+ * This enables downstream solvers to route each fragment independently,
2545
+ * treating them as separate traces that terminate at off-board connection points.
2546
+ */
2547
+ declare class OffboardPathFragmentSolver extends BaseSolver {
2548
+ private inputPaths;
2549
+ private capacityEdges;
2550
+ private originalConnections;
2551
+ fragmentedPaths: CapacityPath[];
2552
+ fragmentedConnections: SimpleRouteConnection[];
2553
+ fragmentedOriginalConnectionNames: Set<string>;
2554
+ private nextFragmentId;
2555
+ private animationState;
2556
+ private currentPath;
2557
+ private currentFragments;
2558
+ private currentFragmentIndex;
2559
+ private nodeMap;
2560
+ constructor({ capacityPaths, capacityEdges, capacityNodes, connections, }: {
2561
+ capacityPaths: CapacityPath[];
2562
+ capacityEdges: CapacityMeshEdge[];
2563
+ capacityNodes: CapacityMeshNode[];
2564
+ connections: SimpleRouteConnection[];
2565
+ });
2566
+ _step(): void;
2567
+ private createFragmentConnections;
2568
+ private splitPath;
2569
+ getFragmentedPaths(): CapacityPath[];
2570
+ getFragmentedConnections(): SimpleRouteConnection[];
2571
+ getFragmentedOriginalConnectionNames(): Set<string>;
2572
+ visualize(): GraphicsObject;
2573
+ private drawPath;
2574
+ }
2575
+
2444
2576
  interface CapacityMeshSolverOptions {
2445
2577
  capacityDepth?: number;
2446
2578
  targetMinCapacity?: number;
@@ -2472,6 +2604,8 @@ declare class AssignableViaAutoroutingPipelineSolver extends BaseSolver {
2472
2604
  highDensityStitchSolver?: MultipleHighDensityRouteStitchSolver;
2473
2605
  singleLayerNodeMerger?: SingleLayerNodeMergerSolver_OnlyMergeTargets;
2474
2606
  mergeAssignableViaNodes?: AssignableViaNodeMergerSolver;
2607
+ offboardCapacityNodeSolver?: OffboardCapacityNodeSolver;
2608
+ offboardPathFragmentSolver?: OffboardPathFragmentSolver;
2475
2609
  strawSolver?: StrawSolver;
2476
2610
  deadEndSolver?: DeadEndSolver;
2477
2611
  uselessViaRemovalSolver1?: UselessViaRemovalSolver;
@@ -2487,7 +2621,7 @@ declare class AssignableViaAutoroutingPipelineSolver extends BaseSolver {
2487
2621
  capacityNodes: CapacityMeshNode[] | null;
2488
2622
  capacityEdges: CapacityMeshEdge[] | null;
2489
2623
  cacheProvider: CacheProvider | null;
2490
- pipelineDef: (PipelineStep<typeof NetToPointPairsSolver> | PipelineStep<typeof CapacityMeshNodeSolver_OnlyTraverseLayersInAssignableObstacles> | PipelineStep<typeof AssignableViaNodeMergerSolver> | PipelineStep<typeof SingleLayerNodeMergerSolver_OnlyMergeTargets> | PipelineStep<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep<typeof DeadEndSolver> | PipelineStep<typeof HyperAssignableViaCapacityPathingSolver> | PipelineStep<typeof CapacityEdgeToPortSegmentSolver> | PipelineStep<typeof CapacitySegmentToPointSolver> | PipelineStep<typeof UnravelMultiSectionSolver> | PipelineStep<typeof HighDensitySolver> | PipelineStep<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep<typeof UselessViaRemovalSolver> | PipelineStep<typeof MultiSimplifiedPathSolver>)[];
2624
+ pipelineDef: (PipelineStep<typeof NetToPointPairsSolver> | PipelineStep<typeof CapacityMeshNodeSolver_OnlyTraverseLayersInAssignableObstacles> | PipelineStep<typeof AssignableViaNodeMergerSolver> | PipelineStep<typeof SingleLayerNodeMergerSolver_OnlyMergeTargets> | PipelineStep<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep<typeof OffboardCapacityNodeSolver> | PipelineStep<typeof DeadEndSolver> | PipelineStep<typeof HyperAssignableViaCapacityPathingSolver> | PipelineStep<typeof OffboardPathFragmentSolver> | PipelineStep<typeof CapacityEdgeToPortSegmentSolver> | PipelineStep<typeof CapacitySegmentToPointSolver> | PipelineStep<typeof UnravelMultiSectionSolver> | PipelineStep<typeof HighDensitySolver> | PipelineStep<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep<typeof UselessViaRemovalSolver> | PipelineStep<typeof MultiSimplifiedPathSolver>)[];
2491
2625
  constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions);
2492
2626
  currentPipelineStepIndex: number;
2493
2627
  _step(): void;