@jetta/cargo-stabilizer 0.1.0-3 → 0.1.0-6

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 (175) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/README.md +51 -11
  3. package/build/core/adapters/axle_adapter.d.ts +4 -4
  4. package/build/core/adapters/axle_adapter.d.ts.map +1 -1
  5. package/build/core/adapters/axle_adapter.js +10 -12
  6. package/build/core/adapters/build_axle_request.d.ts +15 -0
  7. package/build/core/adapters/build_axle_request.d.ts.map +1 -0
  8. package/build/core/adapters/build_axle_request.js +39 -0
  9. package/build/core/adapters/coordinate_mapper.d.ts +5 -5
  10. package/build/core/adapters/coordinate_mapper.d.ts.map +1 -1
  11. package/build/core/adapters/coordinate_mapper.js +11 -11
  12. package/build/core/adapters/empty_space_adapter.d.ts +10 -0
  13. package/build/core/adapters/empty_space_adapter.d.ts.map +1 -0
  14. package/build/core/adapters/empty_space_adapter.js +24 -0
  15. package/build/core/adapters/map_item_to_positioned_cube.d.ts +9 -0
  16. package/build/core/adapters/map_item_to_positioned_cube.d.ts.map +1 -0
  17. package/build/core/adapters/map_item_to_positioned_cube.js +16 -0
  18. package/build/core/adapters/run_axle_calculator.d.ts +16 -0
  19. package/build/core/adapters/run_axle_calculator.d.ts.map +1 -0
  20. package/build/core/adapters/run_axle_calculator.js +32 -0
  21. package/build/core/adapters/stability_adapter.d.ts +1 -1
  22. package/build/core/adapters/stability_adapter.d.ts.map +1 -1
  23. package/build/core/adapters/stability_adapter.js +1 -1
  24. package/build/core/candidates/build_candidate_context.d.ts +1 -1
  25. package/build/core/candidates/build_candidate_context.d.ts.map +1 -1
  26. package/build/core/candidates/build_candidate_context.js +3 -1
  27. package/build/core/candidates/candidate_context.d.ts +4 -1
  28. package/build/core/candidates/candidate_context.d.ts.map +1 -1
  29. package/build/core/candidates/candidate_generator.d.ts +1 -1
  30. package/build/core/candidates/candidate_generator.d.ts.map +1 -1
  31. package/build/core/candidates/candidate_generator.js +19 -16
  32. package/build/core/candidates/candidate_validation.d.ts +0 -12
  33. package/build/core/candidates/candidate_validation.d.ts.map +1 -1
  34. package/build/core/candidates/candidate_validation.js +32 -26
  35. package/build/core/candidates/enumerate_empty_space_slots.d.ts +15 -0
  36. package/build/core/candidates/enumerate_empty_space_slots.d.ts.map +1 -0
  37. package/build/core/candidates/enumerate_empty_space_slots.js +44 -0
  38. package/build/core/candidates/rank_candidates.d.ts.map +1 -1
  39. package/build/core/candidates/rank_candidates.js +3 -0
  40. package/build/core/evaluation/evaluation_context.d.ts +3 -1
  41. package/build/core/evaluation/evaluation_context.d.ts.map +1 -1
  42. package/build/core/evaluation/state_evaluator.d.ts +12 -1
  43. package/build/core/evaluation/state_evaluator.d.ts.map +1 -1
  44. package/build/core/evaluation/state_evaluator.js +28 -5
  45. package/build/core/exceptions/AxleCalculationError.d.ts +4 -0
  46. package/build/core/exceptions/AxleCalculationError.d.ts.map +1 -0
  47. package/build/core/exceptions/AxleCalculationError.js +6 -0
  48. package/build/core/exceptions/InvalidStabilizerOutputError.d.ts +4 -0
  49. package/build/core/exceptions/InvalidStabilizerOutputError.d.ts.map +1 -0
  50. package/build/core/exceptions/InvalidStabilizerOutputError.js +6 -0
  51. package/build/core/factory/read_stabilizer_config.d.ts +4 -2
  52. package/build/core/factory/read_stabilizer_config.d.ts.map +1 -1
  53. package/build/core/factory/read_stabilizer_config.js +6 -25
  54. package/build/core/factory/read_stabilizer_config_helpers.d.ts +28 -0
  55. package/build/core/factory/read_stabilizer_config_helpers.d.ts.map +1 -0
  56. package/build/core/factory/read_stabilizer_config_helpers.js +62 -0
  57. package/build/core/filters/loose_item_filter.d.ts +2 -2
  58. package/build/core/filters/loose_item_filter.d.ts.map +1 -1
  59. package/build/core/filters/loose_item_filter.js +3 -3
  60. package/build/core/geometry/box_geometry.d.ts +17 -1
  61. package/build/core/geometry/box_geometry.d.ts.map +1 -1
  62. package/build/core/geometry/box_geometry.js +67 -2
  63. package/build/core/move/apply_move.d.ts +1 -1
  64. package/build/core/move/apply_move.d.ts.map +1 -1
  65. package/build/core/move/apply_move.js +1 -1
  66. package/build/core/orchestration/StabilizerFlow.d.ts +2 -1
  67. package/build/core/orchestration/StabilizerFlow.d.ts.map +1 -1
  68. package/build/core/orchestration/StabilizerFlow.js +2 -2
  69. package/build/core/orchestration/build_milkrun_bands_from_config.d.ts +13 -0
  70. package/build/core/orchestration/build_milkrun_bands_from_config.d.ts.map +1 -0
  71. package/build/core/orchestration/build_milkrun_bands_from_config.js +14 -0
  72. package/build/core/orchestration/build_reorder_context.d.ts +1 -1
  73. package/build/core/orchestration/build_reorder_context.d.ts.map +1 -1
  74. package/build/core/orchestration/build_reorder_context.js +7 -7
  75. package/build/core/orchestration/read_primary_env.d.ts +9 -0
  76. package/build/core/orchestration/read_primary_env.d.ts.map +1 -0
  77. package/build/core/orchestration/read_primary_env.js +13 -0
  78. package/build/core/strategies/reorder/BeamSearchReorder.d.ts +1 -1
  79. package/build/core/strategies/reorder/BeamSearchReorder.d.ts.map +1 -1
  80. package/build/core/strategies/reorder/BeamSearchReorder.js +3 -3
  81. package/build/core/strategies/reorder/GeneticReorder.d.ts +1 -1
  82. package/build/core/strategies/reorder/GeneticReorder.d.ts.map +1 -1
  83. package/build/core/strategies/reorder/GravityCompaction.d.ts +1 -1
  84. package/build/core/strategies/reorder/GravityCompaction.d.ts.map +1 -1
  85. package/build/core/strategies/reorder/GravityCompaction.js +2 -2
  86. package/build/core/strategies/reorder/GreedyReorder.d.ts +1 -1
  87. package/build/core/strategies/reorder/GreedyReorder.d.ts.map +1 -1
  88. package/build/core/strategies/reorder/ReorderStrategy.d.ts +3 -1
  89. package/build/core/strategies/reorder/ReorderStrategy.d.ts.map +1 -1
  90. package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts +1 -1
  91. package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts.map +1 -1
  92. package/build/core/strategies/reorder/anneal_helpers.d.ts +1 -1
  93. package/build/core/strategies/reorder/anneal_helpers.d.ts.map +1 -1
  94. package/build/core/strategies/reorder/anneal_helpers.js +1 -1
  95. package/build/core/strategies/reorder/apply_if_gates_pass.d.ts +1 -1
  96. package/build/core/strategies/reorder/apply_if_gates_pass.d.ts.map +1 -1
  97. package/build/core/strategies/reorder/beam_context.d.ts +1 -1
  98. package/build/core/strategies/reorder/beam_context.d.ts.map +1 -1
  99. package/build/core/strategies/reorder/genetic/Chromosome.d.ts +1 -1
  100. package/build/core/strategies/reorder/genetic/Chromosome.d.ts.map +1 -1
  101. package/build/core/strategies/reorder/genetic/Chromosome.js +2 -2
  102. package/build/core/strategies/reorder/greedy_improvement.d.ts +1 -1
  103. package/build/core/strategies/reorder/greedy_improvement.d.ts.map +1 -1
  104. package/build/core/strategies/reorder/greedy_improvement.js +2 -2
  105. package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts +37 -0
  106. package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts.map +1 -0
  107. package/build/core/validation/contract/cargo_movement_wire_field_map.js +43 -0
  108. package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts +14 -0
  109. package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts.map +1 -0
  110. package/build/core/validation/contract/cargo_movement_wire_mapper.js +34 -0
  111. package/build/core/validation/contract/format_zod_error.d.ts +8 -0
  112. package/build/core/validation/contract/format_zod_error.d.ts.map +1 -0
  113. package/build/core/validation/contract/format_zod_error.js +11 -0
  114. package/build/core/validation/contract/index.d.ts +9 -0
  115. package/build/core/validation/contract/index.d.ts.map +1 -0
  116. package/build/core/validation/contract/index.js +8 -0
  117. package/build/core/validation/contract/map_contract_to_wire_shape.d.ts +3 -0
  118. package/build/core/validation/contract/map_contract_to_wire_shape.d.ts.map +1 -0
  119. package/build/core/validation/contract/map_contract_to_wire_shape.js +42 -0
  120. package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts +2 -0
  121. package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts.map +1 -0
  122. package/build/core/validation/contract/map_wire_input_to_contract_shape.js +60 -0
  123. package/build/core/validation/contract/map_wire_item_to_contract.d.ts +12 -0
  124. package/build/core/validation/contract/map_wire_item_to_contract.d.ts.map +1 -0
  125. package/build/core/validation/contract/map_wire_item_to_contract.js +49 -0
  126. package/build/core/validation/contract/parse_stabilizer_input.d.ts +48 -0
  127. package/build/core/validation/contract/parse_stabilizer_input.d.ts.map +1 -0
  128. package/build/core/validation/contract/parse_stabilizer_input.js +26 -0
  129. package/build/core/validation/contract/parse_stabilizer_output.d.ts +50 -0
  130. package/build/core/validation/contract/parse_stabilizer_output.d.ts.map +1 -0
  131. package/build/core/validation/contract/parse_stabilizer_output.js +24 -0
  132. package/build/core/validation/contract/stabilizer_domain_schema.d.ts +101 -0
  133. package/build/core/validation/contract/stabilizer_domain_schema.d.ts.map +1 -0
  134. package/build/core/validation/contract/stabilizer_domain_schema.js +64 -0
  135. package/build/core/validation/contract/stabilizer_input_schema.d.ts +36 -0
  136. package/build/core/validation/contract/stabilizer_input_schema.d.ts.map +1 -0
  137. package/build/core/validation/contract/stabilizer_input_schema.js +11 -0
  138. package/build/core/validation/contract/stabilizer_output_schema.d.ts +76 -0
  139. package/build/core/validation/contract/stabilizer_output_schema.d.ts.map +1 -0
  140. package/build/core/validation/contract/stabilizer_output_schema.js +16 -0
  141. package/build/core/validation/contract/wire_mapper_record_utils.d.ts +34 -0
  142. package/build/core/validation/contract/wire_mapper_record_utils.d.ts.map +1 -0
  143. package/build/core/validation/contract/wire_mapper_record_utils.js +66 -0
  144. package/build/core/validation/schemas/stabilizer_config_schema.d.ts +4 -1
  145. package/build/core/validation/schemas/stabilizer_config_schema.d.ts.map +1 -1
  146. package/build/core/validation/schemas/stabilizer_config_schema.js +4 -1
  147. package/build/core/waypoint/build_waypoint_zones.d.ts +1 -1
  148. package/build/core/waypoint/build_waypoint_zones.d.ts.map +1 -1
  149. package/build/core/waypoint/build_waypoint_zones.js +2 -2
  150. package/build/core/waypoint/milkrun_wall_reservation.d.ts +24 -0
  151. package/build/core/waypoint/milkrun_wall_reservation.d.ts.map +1 -0
  152. package/build/core/waypoint/milkrun_wall_reservation.js +57 -0
  153. package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts +15 -0
  154. package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts.map +1 -0
  155. package/build/core/waypoint/milkrun_wall_reservation_helpers.js +48 -0
  156. package/build/core/waypoint/milkrun_wall_reservation_types.d.ts +16 -0
  157. package/build/core/waypoint/milkrun_wall_reservation_types.d.ts.map +1 -0
  158. package/build/core/waypoint/milkrun_wall_reservation_types.js +1 -0
  159. package/build/core/waypoint/preserves_waypoint_order.d.ts +1 -1
  160. package/build/core/waypoint/preserves_waypoint_order.d.ts.map +1 -1
  161. package/build/core/waypoint/validate_waypoint_ids.d.ts +1 -1
  162. package/build/core/waypoint/validate_waypoint_ids.d.ts.map +1 -1
  163. package/build/index.d.ts +15 -6
  164. package/build/index.d.ts.map +1 -1
  165. package/build/index.js +30 -7
  166. package/package.json +1 -1
  167. package/build/core/validation/parse_stabilizer_input.d.ts +0 -8
  168. package/build/core/validation/parse_stabilizer_input.d.ts.map +0 -1
  169. package/build/core/validation/parse_stabilizer_input.js +0 -20
  170. package/build/core/validation/schemas/stabilizer_input_schema.d.ts +0 -110
  171. package/build/core/validation/schemas/stabilizer_input_schema.d.ts.map +0 -1
  172. package/build/core/validation/schemas/stabilizer_input_schema.js +0 -34
  173. package/build/core/validation/schemas/stabilizer_output_schema.d.ts +0 -13
  174. package/build/core/validation/schemas/stabilizer_output_schema.d.ts.map +0 -1
  175. package/build/core/validation/schemas/stabilizer_output_schema.js +0 -6
@@ -1,9 +1,17 @@
1
+ const GEOMETRY_EPSILON = 1e-6;
1
2
  /**
2
3
  * @param item - Cargo item with position and dimensions.
3
4
  * @returns Axis-aligned bounding box.
4
5
  */
5
6
  export function item_to_box(item) {
6
- return { x: item.x, y: item.y, z: item.z, w: item.w, h: item.h, d: item.d };
7
+ return {
8
+ x: item.x,
9
+ y: item.y,
10
+ z: item.z,
11
+ w: item.width,
12
+ h: item.height,
13
+ d: item.depth
14
+ };
7
15
  }
8
16
  /**
9
17
  * @param left - First box.
@@ -29,5 +37,62 @@ export function has_overlap(candidate, others) {
29
37
  * @returns True when candidate rests on container floor.
30
38
  */
31
39
  export function is_on_floor(candidate) {
32
- return candidate.y <= 1e-6;
40
+ return candidate.y <= GEOMETRY_EPSILON;
41
+ }
42
+ /**
43
+ * @param candidate - Candidate placement box.
44
+ * @param container - Container dimensions.
45
+ * @returns True when candidate fits inside container bounds.
46
+ */
47
+ export function is_inside_container(candidate, container) {
48
+ if (candidate.x < -GEOMETRY_EPSILON || candidate.y < -GEOMETRY_EPSILON || candidate.z < -GEOMETRY_EPSILON) {
49
+ return false;
50
+ }
51
+ if (candidate.x + candidate.w > container.width + GEOMETRY_EPSILON) {
52
+ return false;
53
+ }
54
+ if (candidate.y + candidate.h > container.height + GEOMETRY_EPSILON) {
55
+ return false;
56
+ }
57
+ return candidate.z + candidate.d <= container.length + GEOMETRY_EPSILON;
58
+ }
59
+ /**
60
+ * @param candidate - Candidate placement box.
61
+ * @param supporters - Existing item boxes (excluding candidate).
62
+ * @returns True when bottom face is on floor or supporter tops.
63
+ */
64
+ export function is_fully_supported(candidate, supporters) {
65
+ if (is_on_floor(candidate)) {
66
+ return true;
67
+ }
68
+ return sample_bottom_support_points(candidate).every(point => is_support_point_supported(point, supporters));
69
+ }
70
+ function sample_bottom_support_points(candidate) {
71
+ const { x, y, z, w, d } = candidate;
72
+ const mid_x = x + w / 2;
73
+ const mid_z = z + d / 2;
74
+ return [
75
+ { x, y, z },
76
+ { x: x + w, y, z },
77
+ { x, y, z: z + d },
78
+ { x: x + w, y, z: z + d },
79
+ { x: mid_x, y, z: mid_z }
80
+ ];
81
+ }
82
+ function is_support_point_supported(point, supporters) {
83
+ if (point.y <= GEOMETRY_EPSILON) {
84
+ return true;
85
+ }
86
+ return supporters.some(supporter => is_point_on_supporter_top(point, supporter));
87
+ }
88
+ function is_point_on_supporter_top(point, supporter) {
89
+ const top_y = supporter.y + supporter.h;
90
+ if (Math.abs(point.y - top_y) > GEOMETRY_EPSILON) {
91
+ return false;
92
+ }
93
+ const within_x = point.x >= supporter.x - GEOMETRY_EPSILON &&
94
+ point.x <= supporter.x + supporter.w + GEOMETRY_EPSILON;
95
+ const within_z = point.z >= supporter.z - GEOMETRY_EPSILON &&
96
+ point.z <= supporter.z + supporter.d + GEOMETRY_EPSILON;
97
+ return within_x && within_z;
33
98
  }
@@ -1,4 +1,4 @@
1
- import type { StabilizerContainer } from '../validation/schemas/stabilizer_input_schema.js';
1
+ import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
2
2
  export interface MoveCandidate {
3
3
  item_id: string;
4
4
  source_container_index: number;
@@ -1 +1 @@
1
- {"version":3,"file":"apply_move.d.ts","sourceRoot":"","sources":["../../../src/core/move/apply_move.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAA;AAE3F,MAAM,WAAW,aAAa;IAE1B,OAAO,EAAE,MAAM,CAAA;IACf,sBAAsB,EAAE,MAAM,CAAA;IAC9B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACpD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACtB,UAAU,EAAE,mBAAmB,EAAE,EACjC,SAAS,EAAE,aAAa,GACzB,IAAI,CAgBN;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,mBAAmB,EAAE,GAAG,mBAAmB,EAAE,CAGzF"}
1
+ {"version":3,"file":"apply_move.d.ts","sourceRoot":"","sources":["../../../src/core/move/apply_move.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAE7F,MAAM,WAAW,aAAa;IAE1B,OAAO,EAAE,MAAM,CAAA;IACf,sBAAsB,EAAE,MAAM,CAAA;IAC9B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACpD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACtB,UAAU,EAAE,mBAAmB,EAAE,EACjC,SAAS,EAAE,aAAa,GACzB,IAAI,CAgBN;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,mBAAmB,EAAE,GAAG,mBAAmB,EAAE,CAGzF"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export function apply_move(containers, candidate) {
7
7
  const source = containers[candidate.source_container_index];
8
- const item_index = source.items.findIndex(item => item._id === candidate.item_id);
8
+ const item_index = source.items.findIndex(item => item.item_id === candidate.item_id);
9
9
  if (item_index < 0) {
10
10
  return;
11
11
  }
@@ -1,4 +1,5 @@
1
- import type { StabilizerInput, StabilizerCargoState } from '../validation/schemas/stabilizer_input_schema.js';
1
+ import type { StabilizerInput } from '../validation/contract/stabilizer_input_schema.js';
2
+ import type { StabilizerCargoState } from '../validation/contract/stabilizer_domain_schema.js';
2
3
  /**
3
4
  * Runs stabilizer flow on validated input.
4
5
  * @param input - Raw stabilizer input.
@@ -1 +1 @@
1
- {"version":3,"file":"StabilizerFlow.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/StabilizerFlow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAA;AAO7G;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,CAchF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,OAAO,GAAG,oBAAoB,CAI1F"}
1
+ {"version":3,"file":"StabilizerFlow.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/StabilizerFlow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAA;AAO9F;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,CAiBhF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,OAAO,GAAG,oBAAoB,CAI1F"}
@@ -1,4 +1,4 @@
1
- import { parse_stabilizer_input } from '../validation/parse_stabilizer_input.js';
1
+ import { parse_stabilizer_input } from '../validation/contract/parse_stabilizer_input.js';
2
2
  import { read_stabilizer_config } from '../factory/read_stabilizer_config.js';
3
3
  import { create_reorder_strategy } from '../factory/strategy_factory.js';
4
4
  import { build_reorder_context } from './build_reorder_context.js';
@@ -9,7 +9,7 @@ import { stabilizer_logger } from '../logging/stabilizer_logger.js';
9
9
  * @returns Updated cargo_state.
10
10
  */
11
11
  export function run_stabilizer_flow(input) {
12
- const config = read_stabilizer_config(input.config);
12
+ const config = read_stabilizer_config(input.config, input.cargo_state);
13
13
  const context = build_reorder_context(input, config);
14
14
  stabilizer_logger.debug('reorder_strategy=' + config.reorder_strategy);
15
15
  stabilizer_logger.debug('container_count=' + context.containers.length +
@@ -0,0 +1,13 @@
1
+ import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
2
+ import type { StabilizerConfig } from '../validation/schemas/stabilizer_config_schema.js';
3
+ import type { WaypointMode } from '../waypoint/WaypointMode.js';
4
+ import type { MilkrunReservedBand } from '../waypoint/milkrun_wall_reservation_types.js';
5
+ /**
6
+ * Builds milkrun reserved bands when enforcement is enabled in config.
7
+ * @param baseline_containers - Baseline container layout.
8
+ * @param waypoint_mode - Resolved waypoint mode.
9
+ * @param config - Parsed stabilizer config.
10
+ * @returns Reserved Z bands (empty when milkrun enforcement is disabled).
11
+ */
12
+ export declare function build_milkrun_bands_from_config(baseline_containers: StabilizerContainer[], waypoint_mode: WaypointMode, config: StabilizerConfig): MilkrunReservedBand[];
13
+ //# sourceMappingURL=build_milkrun_bands_from_config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build_milkrun_bands_from_config.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/build_milkrun_bands_from_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAA;AAExF;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC3C,mBAAmB,EAAE,mBAAmB,EAAE,EAC1C,aAAa,EAAE,YAAY,EAC3B,MAAM,EAAE,gBAAgB,GACzB,mBAAmB,EAAE,CAMvB"}
@@ -0,0 +1,14 @@
1
+ import { build_milkrun_reserved_z_bands } from '../waypoint/milkrun_wall_reservation.js';
2
+ /**
3
+ * Builds milkrun reserved bands when enforcement is enabled in config.
4
+ * @param baseline_containers - Baseline container layout.
5
+ * @param waypoint_mode - Resolved waypoint mode.
6
+ * @param config - Parsed stabilizer config.
7
+ * @returns Reserved Z bands (empty when milkrun enforcement is disabled).
8
+ */
9
+ export function build_milkrun_bands_from_config(baseline_containers, waypoint_mode, config) {
10
+ const wall_count = config.enforce_milkrun_wall_reservation
11
+ ? config.number_of_wall_to_allocate_from_last_waypoints
12
+ : 0;
13
+ return build_milkrun_reserved_z_bands(baseline_containers, waypoint_mode, wall_count);
14
+ }
@@ -1,4 +1,4 @@
1
- import type { StabilizerInput } from '../validation/schemas/stabilizer_input_schema.js';
1
+ import type { StabilizerInput } from '../validation/contract/stabilizer_input_schema.js';
2
2
  import type { StabilizerConfig } from '../validation/schemas/stabilizer_config_schema.js';
3
3
  import type { ReorderContext } from '../strategies/reorder/ReorderStrategy.js';
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"build_reorder_context.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/build_reorder_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAA;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAO9E;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,gBAAgB,GACzB,cAAc,CAqBhB"}
1
+ {"version":3,"file":"build_reorder_context.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/build_reorder_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAQ9E;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,gBAAgB,GACzB,cAAc,CAsBhB"}
@@ -1,8 +1,9 @@
1
1
  import { collect_loose_items } from '../filters/loose_item_filter.js';
2
2
  import { validate_waypoint_ids } from '../waypoint/validate_waypoint_ids.js';
3
3
  import { build_waypoint_zones } from '../waypoint/build_waypoint_zones.js';
4
+ import { build_milkrun_bands_from_config } from './build_milkrun_bands_from_config.js';
5
+ import { read_primary_env } from './read_primary_env.js';
4
6
  import { clone_containers } from '../move/apply_move.js';
5
- import { InvalidStabilizerInputError } from '../exceptions/InvalidStabilizerInputError.js';
6
7
  /**
7
8
  * Builds reorder context from validated stabilizer input.
8
9
  * @param input - Validated stabilizer input.
@@ -10,20 +11,19 @@ import { InvalidStabilizerInputError } from '../exceptions/InvalidStabilizerInpu
10
11
  * @returns Reorder context for strategy execution.
11
12
  */
12
13
  export function build_reorder_context(input, config) {
13
- const env = input.cargo_state.envs[0];
14
- if (!env) {
15
- throw new InvalidStabilizerInputError('cargo_state.envs must contain at least one env');
16
- }
14
+ const env = read_primary_env(input);
17
15
  const all_items = env.containers.flatMap(container => container.items);
18
16
  const waypoint_mode = validate_waypoint_ids(all_items);
19
17
  const loose_items = collect_loose_items(env.containers);
18
+ const baseline_containers = clone_containers(env.containers);
20
19
  return {
21
20
  env,
22
21
  containers: env.containers,
23
- baseline_containers: clone_containers(env.containers),
22
+ baseline_containers,
24
23
  loose_items,
25
24
  config,
26
25
  waypoint_mode,
27
- waypoint_zones: build_waypoint_zones(env.containers, waypoint_mode)
26
+ waypoint_zones: build_waypoint_zones(baseline_containers, waypoint_mode),
27
+ milkrun_reserved_z_bands: build_milkrun_bands_from_config(baseline_containers, waypoint_mode, config)
28
28
  };
29
29
  }
@@ -0,0 +1,9 @@
1
+ import type { StabilizerInput } from '../validation/contract/stabilizer_input_schema.js';
2
+ import type { StabilizerEnv } from '../validation/contract/stabilizer_domain_schema.js';
3
+ /**
4
+ * Reads the primary env from stabilizer input.
5
+ * @param input - Validated stabilizer input.
6
+ * @returns First cargo env.
7
+ */
8
+ export declare function read_primary_env(input: StabilizerInput): StabilizerEnv;
9
+ //# sourceMappingURL=read_primary_env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read_primary_env.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/read_primary_env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAA;AAGvF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,aAAa,CAQtE"}
@@ -0,0 +1,13 @@
1
+ import { InvalidStabilizerInputError } from '../exceptions/InvalidStabilizerInputError.js';
2
+ /**
3
+ * Reads the primary env from stabilizer input.
4
+ * @param input - Validated stabilizer input.
5
+ * @returns First cargo env.
6
+ */
7
+ export function read_primary_env(input) {
8
+ const env = input.cargo_state.envs[0];
9
+ if (!env) {
10
+ throw new InvalidStabilizerInputError('cargo_state.envs must contain at least one env');
11
+ }
12
+ return env;
13
+ }
@@ -1,5 +1,5 @@
1
1
  import type { ReorderContext, ReorderStrategy } from './ReorderStrategy.js';
2
- import type { StabilizerContainer } from '../../validation/schemas/stabilizer_input_schema.js';
2
+ import type { StabilizerContainer } from '../../validation/contract/stabilizer_domain_schema.js';
3
3
  /**
4
4
  * Beam search reorder with configurable width and top-K expansion.
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BeamSearchReorder.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/BeamSearchReorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAY9F;;GAEG;AACH,qBAAa,iBAAkB,YAAW,eAAe;IAErD,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAkBtD"}
1
+ {"version":3,"file":"BeamSearchReorder.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/BeamSearchReorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAYhG;;GAEG;AACH,qBAAa,iBAAkB,YAAW,eAAe;IAErD,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAkBtD"}
@@ -54,14 +54,14 @@ function sort_loose_by_stability(context, eval_context) {
54
54
  const evaluation = evaluate_trial_layout(context.containers, eval_context);
55
55
  return [...context.loose_items].sort((left, right) => {
56
56
  const left_index = context.containers[left.container_index].items
57
- .findIndex(item => item._id === left.item_id);
57
+ .findIndex(item => item.item_id === left.item_id);
58
58
  const right_index = context.containers[right.container_index].items
59
- .findIndex(item => item._id === right.item_id);
59
+ .findIndex(item => item.item_id === right.item_id);
60
60
  const left_score = read_item_score(evaluation.stability, left.container_index, left_index);
61
61
  const right_score = read_item_score(evaluation.stability, right.container_index, right_index);
62
62
  return left_score - right_score;
63
63
  });
64
64
  }
65
65
  function find_container_index(containers, item_id) {
66
- return containers.findIndex(container => container.items.some(item => item._id === item_id));
66
+ return containers.findIndex(container => container.items.some(item => item.item_id === item_id));
67
67
  }
@@ -1,5 +1,5 @@
1
1
  import type { ReorderContext, ReorderStrategy } from './ReorderStrategy.js';
2
- import type { StabilizerContainer } from '../../validation/schemas/stabilizer_input_schema.js';
2
+ import type { StabilizerContainer } from '../../validation/contract/stabilizer_domain_schema.js';
3
3
  /**
4
4
  * Genetic algorithm reorder optimizing loose-item stability sum.
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GeneticReorder.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/GeneticReorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAa9F;;GAEG;AACH,qBAAa,cAAe,YAAW,eAAe;IAElD,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAgBtD"}
1
+ {"version":3,"file":"GeneticReorder.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/GeneticReorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAahG;;GAEG;AACH,qBAAa,cAAe,YAAW,eAAe;IAElD,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAgBtD"}
@@ -1,5 +1,5 @@
1
1
  import type { ReorderContext, ReorderStrategy } from './ReorderStrategy.js';
2
- import type { StabilizerContainer } from '../../validation/schemas/stabilizer_input_schema.js';
2
+ import type { StabilizerContainer } from '../../validation/contract/stabilizer_domain_schema.js';
3
3
  /**
4
4
  * Single-pass gravity compaction: unstable loose items to lowest feasible floor slot.
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GravityCompaction.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/GravityCompaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAW9F;;GAEG;AACH,qBAAa,iBAAkB,YAAW,eAAe;IAErD,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAatD"}
1
+ {"version":3,"file":"GravityCompaction.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/GravityCompaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAWhG;;GAEG;AACH,qBAAa,iBAAkB,YAAW,eAAe;IAErD,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAatD"}
@@ -37,12 +37,12 @@ function sort_loose_by_stability(context, containers) {
37
37
  return context.loose_items
38
38
  .map(loose => {
39
39
  const item_index = containers[loose.container_index].items
40
- .findIndex(item => item._id === loose.item_id);
40
+ .findIndex(item => item.item_id === loose.item_id);
41
41
  const score = read_item_score(evaluation.stability, loose.container_index, item_index);
42
42
  return { item_id: loose.item_id, container_index: loose.container_index, score };
43
43
  })
44
44
  .sort((left, right) => left.score - right.score);
45
45
  }
46
46
  function find_container_index(containers, item_id) {
47
- return containers.findIndex(container => container.items.some(item => item._id === item_id));
47
+ return containers.findIndex(container => container.items.some(item => item.item_id === item_id));
48
48
  }
@@ -1,5 +1,5 @@
1
1
  import type { ReorderContext, ReorderStrategy } from './ReorderStrategy.js';
2
- import type { StabilizerContainer } from '../../validation/schemas/stabilizer_input_schema.js';
2
+ import type { StabilizerContainer } from '../../validation/contract/stabilizer_domain_schema.js';
3
3
  /**
4
4
  * Greedy iterative reorder: fix worst loose item until plateau or max iterations.
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GreedyReorder.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/GreedyReorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAK9F;;GAEG;AACH,qBAAa,aAAc,YAAW,eAAe;IAEjD,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAiBtD"}
1
+ {"version":3,"file":"GreedyReorder.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/GreedyReorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAKhG;;GAEG;AACH,qBAAa,aAAc,YAAW,eAAe;IAEjD,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAiBtD"}
@@ -1,7 +1,8 @@
1
1
  import type { StabilizerConfig } from '../../validation/schemas/stabilizer_config_schema.js';
2
- import type { StabilizerContainer, StabilizerEnv } from '../../validation/schemas/stabilizer_input_schema.js';
2
+ import type { StabilizerContainer, StabilizerEnv } from '../../validation/contract/stabilizer_domain_schema.js';
3
3
  import type { LooseItemRef } from '../../filters/loose_item_filter.js';
4
4
  import type { WaypointMode, WaypointZone } from '../../waypoint/WaypointMode.js';
5
+ import type { MilkrunReservedBand } from '../../waypoint/milkrun_wall_reservation.js';
5
6
  export interface ReorderContext {
6
7
  env: StabilizerEnv;
7
8
  containers: StabilizerContainer[];
@@ -10,6 +11,7 @@ export interface ReorderContext {
10
11
  config: StabilizerConfig;
11
12
  waypoint_mode: WaypointMode;
12
13
  waypoint_zones: WaypointZone[];
14
+ milkrun_reserved_z_bands: MilkrunReservedBand[];
13
15
  }
14
16
  export interface ReorderStrategy {
15
17
  run(context: ReorderContext): StabilizerContainer[];
@@ -1 +1 @@
1
- {"version":3,"file":"ReorderStrategy.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/ReorderStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAA;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAEhF,MAAM,WAAW,cAAc;IAE3B,GAAG,EAAE,aAAa,CAAA;IAClB,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,mBAAmB,EAAE,mBAAmB,EAAE,CAAA;IAC1C,WAAW,EAAE,YAAY,EAAE,CAAA;IAC3B,MAAM,EAAE,gBAAgB,CAAA;IACxB,aAAa,EAAE,YAAY,CAAA;IAC3B,cAAc,EAAE,YAAY,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,eAAe;IAE5B,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE,CAAA;CACtD"}
1
+ {"version":3,"file":"ReorderStrategy.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/ReorderStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAA;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAA;AAC/G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAErF,MAAM,WAAW,cAAc;IAE3B,GAAG,EAAE,aAAa,CAAA;IAClB,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,mBAAmB,EAAE,mBAAmB,EAAE,CAAA;IAC1C,WAAW,EAAE,YAAY,EAAE,CAAA;IAC3B,MAAM,EAAE,gBAAgB,CAAA;IACxB,aAAa,EAAE,YAAY,CAAA;IAC3B,cAAc,EAAE,YAAY,EAAE,CAAA;IAC9B,wBAAwB,EAAE,mBAAmB,EAAE,CAAA;CAClD;AAED,MAAM,WAAW,eAAe;IAE5B,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE,CAAA;CACtD"}
@@ -1,5 +1,5 @@
1
1
  import type { ReorderContext, ReorderStrategy } from './ReorderStrategy.js';
2
- import type { StabilizerContainer } from '../../validation/schemas/stabilizer_input_schema.js';
2
+ import type { StabilizerContainer } from '../../validation/contract/stabilizer_domain_schema.js';
3
3
  /**
4
4
  * Simulated annealing reorder with hard gate rejection on invalid neighbors.
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SimulatedAnnealingReorder.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/SimulatedAnnealingReorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAyB9F;;GAEG;AACH,qBAAa,yBAA0B,YAAW,eAAe;IAE7D,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAqBtD"}
1
+ {"version":3,"file":"SimulatedAnnealingReorder.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/SimulatedAnnealingReorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAyBhG;;GAEG;AACH,qBAAa,yBAA0B,YAAW,eAAe;IAE7D,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,mBAAmB,EAAE;CAqBtD"}
@@ -1,5 +1,5 @@
1
1
  import type { ReorderContext } from './ReorderStrategy.js';
2
- import type { StabilizerContainer } from '../../validation/schemas/stabilizer_input_schema.js';
2
+ import type { StabilizerContainer } from '../../validation/contract/stabilizer_domain_schema.js';
3
3
  import type { MoveCandidate } from '../../move/apply_move.js';
4
4
  /**
5
5
  * Proposes a random valid neighbor move for simulated annealing.
@@ -1 +1 @@
1
- {"version":3,"file":"anneal_helpers.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/anneal_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAI7D;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,mBAAmB,EAAE,GAC/B,aAAa,GAAG,SAAS,CAgB3B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAWvE"}
1
+ {"version":3,"file":"anneal_helpers.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/anneal_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAChG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAI7D;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,mBAAmB,EAAE,GAC/B,aAAa,GAAG,SAAS,CAgB3B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAWvE"}
@@ -35,5 +35,5 @@ export function accept_move(delta, temperature) {
35
35
  return Math.random() < Math.exp(-delta / temperature);
36
36
  }
37
37
  function find_container_index(containers, item_id) {
38
- return containers.findIndex(container => container.items.some(item => item._id === item_id));
38
+ return containers.findIndex(container => container.items.some(item => item.item_id === item_id));
39
39
  }
@@ -1,4 +1,4 @@
1
- import type { StabilizerContainer } from '../../validation/schemas/stabilizer_input_schema.js';
1
+ import type { StabilizerContainer } from '../../validation/contract/stabilizer_domain_schema.js';
2
2
  import type { ReorderContext } from './ReorderStrategy.js';
3
3
  import type { MoveCandidate } from '../../move/apply_move.js';
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"apply_if_gates_pass.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/apply_if_gates_pass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAO7D;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,mBAAmB,EAAE,EAC9B,SAAS,EAAE,aAAa,GACzB,OAAO,CAWT"}
1
+ {"version":3,"file":"apply_if_gates_pass.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/apply_if_gates_pass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAO7D;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,mBAAmB,EAAE,EAC9B,SAAS,EAAE,aAAa,GACzB,OAAO,CAWT"}
@@ -1,5 +1,5 @@
1
1
  import type { ReorderContext } from './ReorderStrategy.js';
2
- import type { StabilizerContainer } from '../../validation/schemas/stabilizer_input_schema.js';
2
+ import type { StabilizerContainer } from '../../validation/contract/stabilizer_domain_schema.js';
3
3
  import type { LooseItemRef } from '../../filters/loose_item_filter.js';
4
4
  import type { StateEvaluationContext } from '../../evaluation/evaluation_context.js';
5
5
  export interface BeamExpansionContext {
@@ -1 +1 @@
1
- {"version":3,"file":"beam_context.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/beam_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAC9F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAEpF,MAAM,WAAW,oBAAoB;IAEjC,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,sBAAsB,CAAA;IAClC,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,KAAK,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,YAAY,CAAA;CACtB;AAED,MAAM,WAAW,SAAS;IAEtB,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,SAAS,EAAE,MAAM,CAAA;CACpB"}
1
+ {"version":3,"file":"beam_context.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/beam_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAEpF,MAAM,WAAW,oBAAoB;IAEjC,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,sBAAsB,CAAA;IAClC,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,KAAK,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,YAAY,CAAA;CACtB;AAED,MAAM,WAAW,SAAS;IAEtB,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,SAAS,EAAE,MAAM,CAAA;CACpB"}
@@ -1,6 +1,6 @@
1
1
  import type { MoveCandidate } from '../../../move/apply_move.js';
2
2
  import type { ReorderContext } from '../ReorderStrategy.js';
3
- import type { StabilizerContainer } from '../../../validation/schemas/stabilizer_input_schema.js';
3
+ import type { StabilizerContainer } from '../../../validation/contract/stabilizer_domain_schema.js';
4
4
  export interface ChromosomeGene {
5
5
  item_id: string;
6
6
  candidate: MoveCandidate;
@@ -1 +1 @@
1
- {"version":3,"file":"Chromosome.d.ts","sourceRoot":"","sources":["../../../../../src/core/strategies/reorder/genetic/Chromosome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAA;AAEjG,MAAM,WAAW,cAAc;IAE3B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,aAAa,CAAA;CAC3B;AAED,MAAM,WAAW,eAAe;IAE5B,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,cAAc,EACvB,eAAe,EAAE,MAAM,GACxB,eAAe,EAAE,CAQnB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG,eAAe,CAMlG;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC3B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,cAAc,EACvB,aAAa,EAAE,MAAM,GACtB,IAAI,CAeN;AAsBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,QAAQ,EAAE,eAAe,GAC1B,mBAAmB,EAAE,CAgBvB"}
1
+ {"version":3,"file":"Chromosome.d.ts","sourceRoot":"","sources":["../../../../../src/core/strategies/reorder/genetic/Chromosome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAA;AAEnG,MAAM,WAAW,cAAc;IAE3B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,aAAa,CAAA;CAC3B;AAED,MAAM,WAAW,eAAe;IAE5B,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,cAAc,EACvB,eAAe,EAAE,MAAM,GACxB,eAAe,EAAE,CAQnB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG,eAAe,CAMlG;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC3B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,cAAc,EACvB,aAAa,EAAE,MAAM,GACtB,IAAI,CAeN;AAsBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,QAAQ,EAAE,eAAe,GAC1B,mBAAmB,EAAE,CAgBvB"}
@@ -61,7 +61,7 @@ function build_identity_candidate(loose) {
61
61
  export function materialize_organism(baseline, organism) {
62
62
  const working = structuredClone(baseline);
63
63
  for (const gene of organism.genes) {
64
- const source_index = working.findIndex(container => container.items.some(item => item._id === gene.item_id));
64
+ const source_index = working.findIndex(container => container.items.some(item => item.item_id === gene.item_id));
65
65
  if (source_index < 0) {
66
66
  continue;
67
67
  }
@@ -72,7 +72,7 @@ export function materialize_organism(baseline, organism) {
72
72
  }
73
73
  function apply_gene(containers, candidate) {
74
74
  const source = containers[candidate.source_container_index];
75
- const item_index = source.items.findIndex(item => item._id === candidate.item_id);
75
+ const item_index = source.items.findIndex(item => item.item_id === candidate.item_id);
76
76
  if (item_index < 0) {
77
77
  return;
78
78
  }
@@ -1,5 +1,5 @@
1
1
  import type { ReorderContext } from './ReorderStrategy.js';
2
- import type { StabilizerContainer } from '../../validation/schemas/stabilizer_input_schema.js';
2
+ import type { StabilizerContainer } from '../../validation/contract/stabilizer_domain_schema.js';
3
3
  import type { StateEvaluationContext } from '../../evaluation/evaluation_context.js';
4
4
  /**
5
5
  * Attempts one greedy improvement on the worst loose item.
@@ -1 +1 @@
1
- {"version":3,"file":"greedy_improvement.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/greedy_improvement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAE9F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAepF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,mBAAmB,EAAE,EAC9B,YAAY,EAAE,sBAAsB,GACrC,OAAO,CAiBT"}
1
+ {"version":3,"file":"greedy_improvement.d.ts","sourceRoot":"","sources":["../../../../src/core/strategies/reorder/greedy_improvement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAEhG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAepF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,mBAAmB,EAAE,EAC9B,YAAY,EAAE,sBAAsB,GACrC,OAAO,CAiBT"}
@@ -49,7 +49,7 @@ function find_worst_loose(context, containers, item_scores) {
49
49
  let worst_score = Number.POSITIVE_INFINITY;
50
50
  for (const loose of context.loose_items) {
51
51
  const item_index = containers[loose.container_index].items
52
- .findIndex(item => item._id === loose.item_id);
52
+ .findIndex(item => item.item_id === loose.item_id);
53
53
  const score = item_scores[loose.container_index]?.[item_index] ?? 0;
54
54
  if (score < worst_score) {
55
55
  worst_score = score;
@@ -59,5 +59,5 @@ function find_worst_loose(context, containers, item_scores) {
59
59
  return worst;
60
60
  }
61
61
  function find_container_index(containers, item_id) {
62
- return containers.findIndex(container => container.items.some(item => item._id === item_id));
62
+ return containers.findIndex(container => container.items.some(item => item.item_id === item_id));
63
63
  }
@@ -0,0 +1,37 @@
1
+ export declare const ITEM_WIRE_TO_CONTRACT: {
2
+ readonly _id: "item_id";
3
+ readonly groupId: "group_id";
4
+ readonly w: "width";
5
+ readonly h: "height";
6
+ readonly d: "depth";
7
+ };
8
+ /**
9
+ * Cargo-movement wire keys feeding each contract item field, in precedence
10
+ * order. Items are read-only for the stabilizer apart from their position, so
11
+ * these keys are read rather than renamed: the original wire record is
12
+ * retained in `attributes` and is what gets emitted back.
13
+ */
14
+ export declare const ITEM_CONTRACT_WIRE_KEYS: Readonly<{
15
+ item_id: string[];
16
+ group_id: string[];
17
+ waypoint_id: string[];
18
+ width: string[];
19
+ height: string[];
20
+ depth: string[];
21
+ weight: string[];
22
+ }>;
23
+ /** Item fields the stabilizer mutates, and therefore must emit itself. */
24
+ export declare const ITEM_POSITION_KEYS: string[];
25
+ export declare const CONTAINER_WIRE_TO_CONTRACT: {
26
+ readonly sequencia: "sequence";
27
+ readonly largura: "width";
28
+ readonly altura: "height";
29
+ readonly comprimento: "length";
30
+ };
31
+ export declare const ENV_WIRE_TO_CONTRACT: {
32
+ readonly eixos: "axles";
33
+ };
34
+ export declare const CONTRACT_TO_ITEM_WIRE: Record<string, string>;
35
+ export declare const CONTRACT_TO_CONTAINER_WIRE: Record<string, string>;
36
+ export declare const CONTRACT_TO_ENV_WIRE: Record<string, string>;
37
+ //# sourceMappingURL=cargo_movement_wire_field_map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cargo_movement_wire_field_map.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/cargo_movement_wire_field_map.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB;;;;;;CAMxB,CAAA;AAEV;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;EAQlC,CAAA;AAEF,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,UAAkB,CAAA;AAEjD,eAAO,MAAM,0BAA0B;;;;;CAK7B,CAAA;AAEV,eAAO,MAAM,oBAAoB;;CAEvB,CAAA;AAEV,eAAO,MAAM,qBAAqB,wBAAoC,CAAA;AACtE,eAAO,MAAM,0BAA0B,wBAAyC,CAAA;AAChF,eAAO,MAAM,oBAAoB,wBAAmC,CAAA"}
@@ -0,0 +1,43 @@
1
+ export const ITEM_WIRE_TO_CONTRACT = {
2
+ _id: 'item_id',
3
+ groupId: 'group_id',
4
+ w: 'width',
5
+ h: 'height',
6
+ d: 'depth'
7
+ };
8
+ /**
9
+ * Cargo-movement wire keys feeding each contract item field, in precedence
10
+ * order. Items are read-only for the stabilizer apart from their position, so
11
+ * these keys are read rather than renamed: the original wire record is
12
+ * retained in `attributes` and is what gets emitted back.
13
+ */
14
+ export const ITEM_CONTRACT_WIRE_KEYS = Object.freeze({
15
+ item_id: ['item_id', '_id'],
16
+ group_id: ['groupId', 'group_id'],
17
+ waypoint_id: ['waypoint_id'],
18
+ width: ['w', 'width'],
19
+ height: ['h', 'height'],
20
+ depth: ['d', 'depth'],
21
+ weight: ['wg', 'peso', 'weight']
22
+ });
23
+ /** Item fields the stabilizer mutates, and therefore must emit itself. */
24
+ export const ITEM_POSITION_KEYS = ['x', 'y', 'z'];
25
+ export const CONTAINER_WIRE_TO_CONTRACT = {
26
+ sequencia: 'sequence',
27
+ largura: 'width',
28
+ altura: 'height',
29
+ comprimento: 'length'
30
+ };
31
+ export const ENV_WIRE_TO_CONTRACT = {
32
+ eixos: 'axles'
33
+ };
34
+ export const CONTRACT_TO_ITEM_WIRE = invert_map(ITEM_WIRE_TO_CONTRACT);
35
+ export const CONTRACT_TO_CONTAINER_WIRE = invert_map(CONTAINER_WIRE_TO_CONTRACT);
36
+ export const CONTRACT_TO_ENV_WIRE = invert_map(ENV_WIRE_TO_CONTRACT);
37
+ function invert_map(source) {
38
+ const inverted = {};
39
+ for (const [wire_key, contract_key] of Object.entries(source)) {
40
+ inverted[contract_key] = wire_key;
41
+ }
42
+ return inverted;
43
+ }
@@ -0,0 +1,14 @@
1
+ import type { StabilizerCargoState } from './stabilizer_domain_schema.js';
2
+ /**
3
+ * Maps a cargo-movement wire payload to the English contract shape.
4
+ * @param input_data - Unknown CM wire payload.
5
+ * @returns Object ready for strict contract parsing.
6
+ */
7
+ export declare function map_wire_input_to_contract(input_data: unknown): unknown;
8
+ /**
9
+ * Maps an English contract cargo state back to cargo-movement wire shape.
10
+ * @param cargo_state - English contract cargo state.
11
+ * @returns CM wire cargo state.
12
+ */
13
+ export declare function map_contract_to_wire_output(cargo_state: StabilizerCargoState): unknown;
14
+ //# sourceMappingURL=cargo_movement_wire_mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cargo_movement_wire_mapper.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/cargo_movement_wire_mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAOzE;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAsBvE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,oBAAoB,GAAG,OAAO,CAGtF"}