@tscircuit/core 0.0.2128 → 0.0.2130

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.
Files changed (2) hide show
  1. package/dist/index.js +48 -10
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -118370,11 +118370,15 @@ function Group_getRoutingPhasePlans(group) {
118370
118370
  return [...breakoutPlans, ...plans];
118371
118371
  }
118372
118372
 
118373
+ // lib/utils/autorouting/routing-phase-preparation-error.ts
118374
+ var RoutingPhasePreparationError = class extends Error {
118375
+ };
118376
+
118373
118377
  // package.json
118374
118378
  var package_default = {
118375
118379
  name: "@tscircuit/core",
118376
118380
  type: "module",
118377
- version: "0.0.2127",
118381
+ version: "0.0.2129",
118378
118382
  types: "dist/index.d.ts",
118379
118383
  main: "dist/index.js",
118380
118384
  module: "dist/index.js",
@@ -118413,7 +118417,7 @@ var package_default = {
118413
118417
  "@tscircuit/cableprinter": "^0.0.6",
118414
118418
  "@tscircuit/capacity-autorouter": "^0.0.965",
118415
118419
  "@tscircuit/checks": "^0.0.247",
118416
- "@tscircuit/circuit-json-util": "^0.0.119",
118420
+ "@tscircuit/circuit-json-util": "^0.0.121",
118417
118421
  "@tscircuit/common": "^0.0.20",
118418
118422
  "@tscircuit/copper-pour-solver": "^0.0.67",
118419
118423
  "@tscircuit/create-fdm-enclosure": "0.0.4",
@@ -118516,7 +118520,7 @@ var package_default = {
118516
118520
  "jscad-fiber": "^0.0.88"
118517
118521
  },
118518
118522
  overrides: {
118519
- "@tscircuit/circuit-json-util": "^0.0.119",
118523
+ "@tscircuit/circuit-json-util": "^0.0.121",
118520
118524
  "@tscircuit/props": "^0.0.698",
118521
118525
  "circuit-json": "^0.0.525",
118522
118526
  "@tscircuit/cableprinter": "^0.0.6"
@@ -118661,16 +118665,27 @@ function Group_filterSimpleRouteJsonForPhase(simpleRouteJson, phasePlan) {
118661
118665
  }
118662
118666
  if (positiveConnectionIncluded) differentialPairs.push(differentialPair);
118663
118667
  }
118664
- const connectionByName = new Map(
118665
- connections.map((connection) => [connection.name, connection])
118668
+ const srjConnectionByName = new Map(
118669
+ simpleRouteJson.connections.map((connection) => [
118670
+ connection.name,
118671
+ connection
118672
+ ])
118666
118673
  );
118667
118674
  const buses = (simpleRouteJson.buses ?? []).map((bus) => {
118668
118675
  const connectionNames = bus.connectionNames.filter(
118669
118676
  (connectionName) => includedConnectionNames.has(connectionName)
118670
118677
  );
118678
+ const cohortConnectionNames = bus.connectionNames.filter(
118679
+ (connectionName) => srjConnectionByName.get(connectionName)?.routingPcbGroupId === phasePlan.routingPcbGroupId
118680
+ );
118681
+ if (bus.maxLengthSkew !== void 0 && connectionNames.length > 0 && connectionNames.length !== cohortConnectionNames.length) {
118682
+ throw new RoutingPhasePreparationError(
118683
+ `Length-matched bus "${bus.name || "unnamed bus"}" cannot be split across autorouting phases. Assign the complete bus to one routingPhaseIndex.`
118684
+ );
118685
+ }
118671
118686
  const connectionExitTargets = Object.fromEntries(
118672
118687
  connectionNames.flatMap((connectionName) => {
118673
- const connection = connectionByName.get(connectionName);
118688
+ const connection = srjConnectionByName.get(connectionName);
118674
118689
  if (!connection) return [];
118675
118690
  const pairedTarget = getPairedBreakoutExitTarget(
118676
118691
  simpleRouteJson,
@@ -120961,10 +120976,33 @@ var Group5 = class extends NormalComponent {
120961
120976
  if (this._hasStartedAsyncAutorouting) return;
120962
120977
  this._hasStartedAsyncAutorouting = true;
120963
120978
  if (this._getAutorouterConfig().local) {
120964
- this._queueAsyncEffect(
120965
- "autorouting",
120966
- async () => this._runLocalAutorouting()
120967
- );
120979
+ this._queueAsyncEffect("autorouting", async () => {
120980
+ try {
120981
+ await this._runLocalAutorouting();
120982
+ } catch (error) {
120983
+ if (!(error instanceof RoutingPhasePreparationError)) throw error;
120984
+ const { db: db2 } = this.root;
120985
+ const pcbErrorId = `pcb_autorouter_error_subcircuit_${this.subcircuit_id}`;
120986
+ const alreadyRecorded = db2.pcb_autorouting_error.list().some(
120987
+ (recordedError) => recordedError.pcb_error_id === pcbErrorId && recordedError.message === error.message
120988
+ );
120989
+ if (!alreadyRecorded) {
120990
+ db2.pcb_autorouting_error.insert({
120991
+ pcb_error_id: pcbErrorId,
120992
+ error_type: "pcb_autorouting_error",
120993
+ message: error.message,
120994
+ subcircuit_id: this.subcircuit_id ?? void 0
120995
+ });
120996
+ this.root?.emit("autorouting:error", {
120997
+ type: "autorouting:error",
120998
+ subcircuit_id: this.subcircuit_id,
120999
+ componentDisplayName: this.getString(),
121000
+ error: { message: error.message }
121001
+ });
121002
+ }
121003
+ throw error;
121004
+ }
121005
+ });
120968
121006
  } else {
120969
121007
  this._queueAsyncEffect(
120970
121008
  "make-http-autorouting-request",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2128",
4
+ "version": "0.0.2130",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@tscircuit/cableprinter": "^0.0.6",
41
41
  "@tscircuit/capacity-autorouter": "^0.0.965",
42
42
  "@tscircuit/checks": "^0.0.247",
43
- "@tscircuit/circuit-json-util": "^0.0.119",
43
+ "@tscircuit/circuit-json-util": "^0.0.121",
44
44
  "@tscircuit/common": "^0.0.20",
45
45
  "@tscircuit/copper-pour-solver": "^0.0.67",
46
46
  "@tscircuit/create-fdm-enclosure": "0.0.4",
@@ -143,7 +143,7 @@
143
143
  "jscad-fiber": "^0.0.88"
144
144
  },
145
145
  "overrides": {
146
- "@tscircuit/circuit-json-util": "^0.0.119",
146
+ "@tscircuit/circuit-json-util": "^0.0.121",
147
147
  "@tscircuit/props": "^0.0.698",
148
148
  "circuit-json": "^0.0.525",
149
149
  "@tscircuit/cableprinter": "^0.0.6"