@tscircuit/core 0.0.2329 → 0.0.2330

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
@@ -2017,6 +2017,24 @@ interface AutoroutingStartEvent extends AutoroutingExecutionMetadata {
2017
2017
  phaseStageCount?: number;
2018
2018
  simpleRouteJson: SimpleRouteJson;
2019
2019
  }
2020
+ /** Hypergraph route search iterations. */
2021
+ type Iterations = number;
2022
+ /**
2023
+ * Which connections were hardest to route in one stage, mirrored from the
2024
+ * autorouter: each pair's solo search iterations, highest first.
2025
+ */
2026
+ interface AutorouterComputeCostSummary {
2027
+ readonly metric: "hypergraph_route_search_iterations";
2028
+ /** Every pair that was measured, including those cut from topPairs. */
2029
+ readonly measuredPairCount: number;
2030
+ /** The most expensive pairs, highest first; at most 25. */
2031
+ readonly topPairs: readonly {
2032
+ readonly connectionName: string;
2033
+ readonly rootConnectionNames: readonly string[];
2034
+ readonly pcbPortIds: readonly [string | null, string | null];
2035
+ readonly iterations: Iterations;
2036
+ }[];
2037
+ }
2020
2038
  interface AutoroutingErrorEvent extends AutoroutingExecutionMetadata {
2021
2039
  type: "autorouting:error";
2022
2040
  subcircuit_id: string;
@@ -2030,6 +2048,7 @@ interface AutoroutingErrorEvent extends AutoroutingExecutionMetadata {
2030
2048
  };
2031
2049
  simpleRouteJson?: SimpleRouteJson;
2032
2050
  debugGraphics?: any;
2051
+ computeCostSummary?: AutorouterComputeCostSummary;
2033
2052
  }
2034
2053
  interface AutoroutingProgressEvent extends AutoroutingExecutionMetadata {
2035
2054
  type: "autorouting:progress";
@@ -2041,6 +2060,7 @@ interface AutoroutingProgressEvent extends AutoroutingExecutionMetadata {
2041
2060
  progress: number;
2042
2061
  iterationsPerSecond?: number;
2043
2062
  debugGraphics?: any;
2063
+ computeCostSummary?: AutorouterComputeCostSummary;
2044
2064
  }
2045
2065
  interface AutoroutingEndEvent extends AutoroutingExecutionMetadata {
2046
2066
  /**
@@ -2059,6 +2079,7 @@ interface AutoroutingEndEvent extends AutoroutingExecutionMetadata {
2059
2079
  phaseStageIndex?: number;
2060
2080
  phaseStageCount?: number;
2061
2081
  simpleRouteJson: SimpleRouteJson;
2082
+ computeCostSummary?: AutorouterComputeCostSummary;
2062
2083
  }
2063
2084
  interface PackingStartEvent {
2064
2085
  type: "packing:start";
@@ -229364,6 +229385,7 @@ type AutorouterProgressEvent = {
229364
229385
  phase?: string;
229365
229386
  iterationsPerSecond?: number;
229366
229387
  debugGraphics?: GraphicsObject$1;
229388
+ computeCostSummary?: AutorouterComputeCostSummary;
229367
229389
  };
229368
229390
  type AutorouterEvent = AutorouterCompleteEvent | AutorouterErrorEvent | AutorouterProgressEvent;
229369
229391
  interface GenericLocalAutorouter {
@@ -229375,6 +229397,7 @@ interface GenericLocalAutorouter {
229375
229397
  on(event: "error", callback: (ev: AutorouterErrorEvent) => void): void;
229376
229398
  on(event: "progress", callback: (ev: AutorouterProgressEvent) => void): void;
229377
229399
  solveSync(): SimplifiedPcbTrace[];
229400
+ getComputeCostSummary?(): AutorouterComputeCostSummary | undefined;
229378
229401
  /**
229379
229402
  * Return a transformed routing problem for a subsequent autorouting phase.
229380
229403
  * Autorouters that only produce final traces can omit this method.
@@ -229604,4 +229627,4 @@ declare function checkCircuitJsonAssemblyExplosionCollisions(circuitJson: AnyCir
229604
229627
  manifold?: ManifoldToplevel;
229605
229628
  }): Promise<AssemblyExplosionCollisionCheck>;
229606
229629
 
229607
- export { Ammeter, AnalogAcSweepSimulation, AnalogAnalysisSimulation, AnalogDcOperatingPointSimulation, AnalogDcSweepSimulation, AnalogDigitalStimulus, AnalogEyeDiagram, AnalogSimulation, AnalogSweepParameter, AnalogTransientSimulation, Antenna, AssemblyBolt, AssemblyCable, type AssemblyCableJsxProps, type AssemblyCadAssemblyJsxProps, AssemblyDevice, type AssemblyDeviceJsxProps, AssemblyDrawingDimension, AssemblyDrawingPage, AssemblyDrawingPartView, AssemblyDrawingTitleBlock, type AssemblyExplosionCollisionCheck, type AssemblyExplosionCollisionCheckStatus, type AssemblyExplosionLine, AssemblyExplosionMove, type AssemblyExplosionOptions, AssemblyExplosionStage, type AssemblyExplosionStageRef, type AssemblyExplosionView, AssemblyMotor, type AssemblyMotorJsxProps, AssemblyPart, type AssemblyPartJsxProps, AssemblyPrintedPart, type AssemblyPrintedPartJsxProps, AssemblyReferenceSurface, AssemblyScreen, type AssemblyScreenJsxProps, AssemblySubassembly, type AssemblySubassemblyJsxProps, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingCacheDisabledReason, type AutoroutingCacheStatus, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingExecutionMetadata, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, Bus, CadAssembly, CadModel, Capacitor, Chip, Circuit, type CircuitJsonMetadata, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, DifferentialPair, Diode, DrcCheck, EnclosureCutoutAperture, EnclosureFdmBox, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, IbisModel, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbBend, type PcbGroupId, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbReturnCurrentExcitation, PcbReturnCurrentSimulation, PcbSoldermaskOpening, PcbStiffener, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicGraphic, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicSheet, SchematicSymbol, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteBounds, type SimpleRouteBus, type SimpleRouteBusTermination, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimpleRoutePoint, type SimplifiedPcbTrace, type SingleLayerConnectionPoint, SmtPad, SolderJumper, SolderPaste, type SolverEndedEvent, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, SystemBlockComponent, SystemBlockConnection, SystemBlockGroup, SystemBlockPage, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, analog, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, assembly, assemblyPath, checkCircuitJsonAssemblyExplosionCollisions, createUseComponent, enclosure, getAssemblyExplosion, getCircuitJsonAssemblyExplosion, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveAssemblyExplosionStages, resolveStaticFileImport, sel, serializeAssemblyExplosion, simulation, systemblock, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
229630
+ export { Ammeter, AnalogAcSweepSimulation, AnalogAnalysisSimulation, AnalogDcOperatingPointSimulation, AnalogDcSweepSimulation, AnalogDigitalStimulus, AnalogEyeDiagram, AnalogSimulation, AnalogSweepParameter, AnalogTransientSimulation, Antenna, AssemblyBolt, AssemblyCable, type AssemblyCableJsxProps, type AssemblyCadAssemblyJsxProps, AssemblyDevice, type AssemblyDeviceJsxProps, AssemblyDrawingDimension, AssemblyDrawingPage, AssemblyDrawingPartView, AssemblyDrawingTitleBlock, type AssemblyExplosionCollisionCheck, type AssemblyExplosionCollisionCheckStatus, type AssemblyExplosionLine, AssemblyExplosionMove, type AssemblyExplosionOptions, AssemblyExplosionStage, type AssemblyExplosionStageRef, type AssemblyExplosionView, AssemblyMotor, type AssemblyMotorJsxProps, AssemblyPart, type AssemblyPartJsxProps, AssemblyPrintedPart, type AssemblyPrintedPartJsxProps, AssemblyReferenceSurface, AssemblyScreen, type AssemblyScreenJsxProps, AssemblySubassembly, type AssemblySubassemblyJsxProps, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterComputeCostSummary, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingCacheDisabledReason, type AutoroutingCacheStatus, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingExecutionMetadata, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, Bus, CadAssembly, CadModel, Capacitor, Chip, Circuit, type CircuitJsonMetadata, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, DifferentialPair, Diode, DrcCheck, EnclosureCutoutAperture, EnclosureFdmBox, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, IbisModel, Inductor, Interconnect, IsolatedCircuit, type Iterations, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbBend, type PcbGroupId, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbReturnCurrentExcitation, PcbReturnCurrentSimulation, PcbSoldermaskOpening, PcbStiffener, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicGraphic, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicSheet, SchematicSymbol, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteBounds, type SimpleRouteBus, type SimpleRouteBusTermination, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimpleRoutePoint, type SimplifiedPcbTrace, type SingleLayerConnectionPoint, SmtPad, SolderJumper, SolderPaste, type SolverEndedEvent, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, SystemBlockComponent, SystemBlockConnection, SystemBlockGroup, SystemBlockPage, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, analog, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, assembly, assemblyPath, checkCircuitJsonAssemblyExplosionCollisions, createUseComponent, enclosure, getAssemblyExplosion, getCircuitJsonAssemblyExplosion, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveAssemblyExplosionStages, resolveStaticFileImport, sel, serializeAssemblyExplosion, simulation, systemblock, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -148356,7 +148356,12 @@ var TscircuitAutorouter = class {
148356
148356
  run,
148357
148357
  (progress) => {
148358
148358
  this.cycleCount++;
148359
- this.emitEvent({ ...progress, steps: this.cycleCount });
148359
+ const computeCostSummary = this.getComputeCostSummary();
148360
+ this.emitEvent({
148361
+ ...progress,
148362
+ steps: this.cycleCount,
148363
+ ...computeCostSummary !== void 0 ? { computeCostSummary } : {}
148364
+ });
148360
148365
  }
148361
148366
  );
148362
148367
  if (run.stopped) return;
@@ -148422,13 +148427,15 @@ var TscircuitAutorouter = class {
148422
148427
  this.cycleCount++;
148423
148428
  const debugGraphics = this.solver?.preview() || void 0;
148424
148429
  const progress = this.solver.progress;
148430
+ const computeCostSummary = this.getComputeCostSummary();
148425
148431
  this.emitEvent({
148426
148432
  type: "progress",
148427
148433
  steps: this.cycleCount,
148428
148434
  iterationsPerSecond,
148429
148435
  progress,
148430
148436
  phase: "getCurrentPhase" in this.solver ? this.solver.getCurrentPhase() : this.solver.activeSubSolver?.getSolverName() ?? this.solver.getSolverName(),
148431
- debugGraphics
148437
+ debugGraphics,
148438
+ ...computeCostSummary !== void 0 ? { computeCostSummary } : {}
148432
148439
  });
148433
148440
  if (this.stepDelay > 0) {
148434
148441
  this.timeoutId = setTimeout(
@@ -148518,6 +148525,9 @@ var TscircuitAutorouter = class {
148518
148525
  }
148519
148526
  return this.solver.getOutputSimplifiedPcbTraces();
148520
148527
  }
148528
+ getComputeCostSummary() {
148529
+ return this.solver.getComputeCostSummary?.();
148530
+ }
148521
148531
  /**
148522
148532
  * Get the mapping of obstacle IDs to root connection names that were
148523
148533
  * connected via off-board paths (e.g., interconnects).
@@ -159602,7 +159612,7 @@ var RoutingPhasePreparationError = class extends Error {
159602
159612
  var package_default = {
159603
159613
  name: "@tscircuit/core",
159604
159614
  type: "module",
159605
- version: "0.0.2328",
159615
+ version: "0.0.2329",
159606
159616
  types: "dist/index.d.ts",
159607
159617
  main: "dist/index.js",
159608
159618
  module: "dist/index.js",
@@ -162214,13 +162224,15 @@ var Group = class extends NormalComponent {
162214
162224
  traces: eventOutputPcbTraces
162215
162225
  };
162216
162226
  previousStageOutputSimpleRouteJson = transformedSimpleRouteJson ? outputSimpleRouteJson : void 0;
162227
+ const computeCostSummary = cachedResult ? cachedResult.computeCostSummary : autorouter?.getComputeCostSummary?.();
162217
162228
  if (!cachedResult && cacheKey) {
162218
162229
  await cacheLocalAutoroutingPhaseResult({
162219
162230
  cacheEngine,
162220
162231
  cacheKey,
162221
162232
  result: {
162222
162233
  ...simpleRouteJson,
162223
- traces
162234
+ traces,
162235
+ ...computeCostSummary !== void 0 ? { computeCostSummary } : {}
162224
162236
  }
162225
162237
  });
162226
162238
  }
@@ -162237,6 +162249,7 @@ var Group = class extends NormalComponent {
162237
162249
  });
162238
162250
  this.root?.emit("autorouting:end", {
162239
162251
  ...savedPhasePaths,
162252
+ ...computeCostSummary !== void 0 ? { computeCostSummary } : {},
162240
162253
  type: "autorouting:end",
162241
162254
  subcircuit_id: this.subcircuit_id,
162242
162255
  componentDisplayName: this.getString(),
@@ -162315,7 +162328,9 @@ var Group = class extends NormalComponent {
162315
162328
  error_type: "pcb_autorouting_error",
162316
162329
  message: error instanceof Error ? error.message : String(error)
162317
162330
  });
162331
+ const computeCostSummary = autorouter?.getComputeCostSummary?.();
162318
162332
  this.root?.emit("autorouting:error", {
162333
+ ...computeCostSummary !== void 0 ? { computeCostSummary } : {},
162319
162334
  type: "autorouting:error",
162320
162335
  subcircuit_id: this.subcircuit_id,
162321
162336
  componentDisplayName: this.getString(),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2329",
4
+ "version": "0.0.2330",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",