@jetta/cargo-stabilizer 0.1.0-15 → 0.1.0-3
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/CHANGELOG.md +1 -35
- package/README.md +16 -62
- package/build/core/adapters/axle_adapter.d.ts +4 -5
- package/build/core/adapters/axle_adapter.d.ts.map +1 -1
- package/build/core/adapters/axle_adapter.js +23 -6
- package/build/core/adapters/coordinate_mapper.d.ts +5 -5
- package/build/core/adapters/coordinate_mapper.d.ts.map +1 -1
- package/build/core/adapters/coordinate_mapper.js +13 -13
- package/build/core/adapters/stability_adapter.d.ts +1 -1
- package/build/core/adapters/stability_adapter.d.ts.map +1 -1
- package/build/core/adapters/stability_adapter.js +1 -1
- package/build/core/candidates/build_candidate_context.d.ts +1 -1
- package/build/core/candidates/build_candidate_context.d.ts.map +1 -1
- package/build/core/candidates/build_candidate_context.js +1 -3
- package/build/core/candidates/candidate_context.d.ts +1 -4
- package/build/core/candidates/candidate_context.d.ts.map +1 -1
- package/build/core/candidates/candidate_generator.d.ts +1 -1
- package/build/core/candidates/candidate_generator.d.ts.map +1 -1
- package/build/core/candidates/candidate_generator.js +16 -33
- package/build/core/candidates/candidate_validation.d.ts +12 -0
- package/build/core/candidates/candidate_validation.d.ts.map +1 -1
- package/build/core/candidates/candidate_validation.js +26 -40
- package/build/core/candidates/rank_candidates.d.ts.map +1 -1
- package/build/core/candidates/rank_candidates.js +0 -3
- package/build/core/evaluation/evaluation_context.d.ts +1 -3
- package/build/core/evaluation/evaluation_context.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.d.ts +10 -13
- package/build/core/evaluation/state_evaluator.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.js +15 -19
- package/build/core/factory/read_stabilizer_config.d.ts +2 -5
- package/build/core/factory/read_stabilizer_config.d.ts.map +1 -1
- package/build/core/factory/read_stabilizer_config.js +25 -6
- package/build/core/filters/loose_item_filter.d.ts +2 -2
- package/build/core/filters/loose_item_filter.d.ts.map +1 -1
- package/build/core/filters/loose_item_filter.js +3 -3
- package/build/core/geometry/box_geometry.d.ts +1 -17
- package/build/core/geometry/box_geometry.d.ts.map +1 -1
- package/build/core/geometry/box_geometry.js +2 -67
- package/build/core/move/apply_move.d.ts +1 -3
- package/build/core/move/apply_move.d.ts.map +1 -1
- package/build/core/move/apply_move.js +1 -1
- package/build/core/orchestration/StabilizerFlow.d.ts +1 -2
- package/build/core/orchestration/StabilizerFlow.d.ts.map +1 -1
- package/build/core/orchestration/StabilizerFlow.js +1 -1
- package/build/core/orchestration/build_reorder_context.d.ts +1 -1
- package/build/core/orchestration/build_reorder_context.d.ts.map +1 -1
- package/build/core/orchestration/build_reorder_context.js +12 -10
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.js +16 -15
- package/build/core/strategies/reorder/GeneticReorder.d.ts +1 -1
- package/build/core/strategies/reorder/GeneticReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/GeneticReorder.js +1 -2
- package/build/core/strategies/reorder/GravityCompaction.d.ts +1 -1
- package/build/core/strategies/reorder/GravityCompaction.d.ts.map +1 -1
- package/build/core/strategies/reorder/GravityCompaction.js +2 -2
- package/build/core/strategies/reorder/GreedyReorder.d.ts +1 -1
- package/build/core/strategies/reorder/GreedyReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/ReorderStrategy.d.ts +1 -3
- package/build/core/strategies/reorder/ReorderStrategy.d.ts.map +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.js +5 -14
- package/build/core/strategies/reorder/anneal_helpers.d.ts +1 -1
- package/build/core/strategies/reorder/anneal_helpers.d.ts.map +1 -1
- package/build/core/strategies/reorder/anneal_helpers.js +1 -1
- package/build/core/strategies/reorder/apply_if_gates_pass.d.ts +1 -1
- package/build/core/strategies/reorder/apply_if_gates_pass.d.ts.map +1 -1
- package/build/core/strategies/reorder/beam_context.d.ts +1 -2
- package/build/core/strategies/reorder/beam_context.d.ts.map +1 -1
- package/build/core/strategies/reorder/genetic/Chromosome.d.ts +1 -1
- package/build/core/strategies/reorder/genetic/Chromosome.d.ts.map +1 -1
- package/build/core/strategies/reorder/genetic/Chromosome.js +2 -2
- package/build/core/strategies/reorder/greedy_improvement.d.ts +1 -1
- package/build/core/strategies/reorder/greedy_improvement.d.ts.map +1 -1
- package/build/core/strategies/reorder/greedy_improvement.js +4 -5
- package/build/core/validation/parse_stabilizer_input.d.ts +8 -0
- package/build/core/validation/parse_stabilizer_input.d.ts.map +1 -0
- package/build/core/validation/parse_stabilizer_input.js +20 -0
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts +2 -6
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts.map +1 -1
- package/build/core/validation/schemas/stabilizer_config_schema.js +2 -6
- package/build/core/validation/schemas/stabilizer_input_schema.d.ts +110 -0
- package/build/core/validation/schemas/stabilizer_input_schema.d.ts.map +1 -0
- package/build/core/validation/schemas/stabilizer_input_schema.js +34 -0
- package/build/core/validation/schemas/stabilizer_output_schema.d.ts +13 -0
- package/build/core/validation/schemas/stabilizer_output_schema.d.ts.map +1 -0
- package/build/core/validation/schemas/stabilizer_output_schema.js +6 -0
- package/build/core/waypoint/build_waypoint_zones.d.ts +1 -1
- package/build/core/waypoint/build_waypoint_zones.d.ts.map +1 -1
- package/build/core/waypoint/build_waypoint_zones.js +2 -2
- package/build/core/waypoint/preserves_waypoint_order.d.ts +1 -1
- package/build/core/waypoint/preserves_waypoint_order.d.ts.map +1 -1
- package/build/core/waypoint/validate_waypoint_ids.d.ts +1 -1
- package/build/core/waypoint/validate_waypoint_ids.d.ts.map +1 -1
- package/build/index.d.ts +7 -15
- package/build/index.d.ts.map +1 -1
- package/build/index.js +11 -42
- package/package.json +10 -12
- package/build/core/adapters/axle_load_evaluation.d.ts +0 -8
- package/build/core/adapters/axle_load_evaluation.d.ts.map +0 -1
- package/build/core/adapters/axle_load_evaluation.js +0 -1
- package/build/core/adapters/build_axle_request.d.ts +0 -8
- package/build/core/adapters/build_axle_request.d.ts.map +0 -1
- package/build/core/adapters/build_axle_request.js +0 -67
- package/build/core/adapters/compute_axle_excess_kg.d.ts +0 -8
- package/build/core/adapters/compute_axle_excess_kg.d.ts.map +0 -1
- package/build/core/adapters/compute_axle_excess_kg.js +0 -19
- package/build/core/adapters/empty_space_adapter.d.ts +0 -10
- package/build/core/adapters/empty_space_adapter.d.ts.map +0 -1
- package/build/core/adapters/empty_space_adapter.js +0 -24
- package/build/core/adapters/evaluate_axle_load.d.ts +0 -10
- package/build/core/adapters/evaluate_axle_load.d.ts.map +0 -1
- package/build/core/adapters/evaluate_axle_load.js +0 -32
- package/build/core/adapters/map_item_to_positioned_cube.d.ts +0 -9
- package/build/core/adapters/map_item_to_positioned_cube.d.ts.map +0 -1
- package/build/core/adapters/map_item_to_positioned_cube.js +0 -16
- package/build/core/adapters/map_item_to_stacking_item.d.ts +0 -14
- package/build/core/adapters/map_item_to_stacking_item.d.ts.map +0 -1
- package/build/core/adapters/map_item_to_stacking_item.js +0 -40
- package/build/core/adapters/run_axle_calculator.d.ts +0 -16
- package/build/core/adapters/run_axle_calculator.d.ts.map +0 -1
- package/build/core/adapters/run_axle_calculator.js +0 -37
- package/build/core/candidates/collect_container_slots.d.ts +0 -16
- package/build/core/candidates/collect_container_slots.d.ts.map +0 -1
- package/build/core/candidates/collect_container_slots.js +0 -20
- package/build/core/candidates/enumerate_empty_space_slots.d.ts +0 -15
- package/build/core/candidates/enumerate_empty_space_slots.d.ts.map +0 -1
- package/build/core/candidates/enumerate_empty_space_slots.js +0 -44
- package/build/core/candidates/enumerate_supporter_top_slots.d.ts +0 -11
- package/build/core/candidates/enumerate_supporter_top_slots.d.ts.map +0 -1
- package/build/core/candidates/enumerate_supporter_top_slots.js +0 -36
- package/build/core/candidates/is_candidate_stacking_valid.d.ts +0 -14
- package/build/core/candidates/is_candidate_stacking_valid.d.ts.map +0 -1
- package/build/core/candidates/is_candidate_stacking_valid.js +0 -43
- package/build/core/candidates/is_elevated_on_supporter_origin.d.ts +0 -14
- package/build/core/candidates/is_elevated_on_supporter_origin.d.ts.map +0 -1
- package/build/core/candidates/is_elevated_on_supporter_origin.js +0 -28
- package/build/core/constants/TieRatioOrientation.d.ts +0 -6
- package/build/core/constants/TieRatioOrientation.d.ts.map +0 -1
- package/build/core/constants/TieRatioOrientation.js +0 -5
- package/build/core/evaluation/compare_search_states.d.ts +0 -12
- package/build/core/evaluation/compare_search_states.d.ts.map +0 -1
- package/build/core/evaluation/compare_search_states.js +0 -12
- package/build/core/evaluation/compute_reorder_objective.d.ts +0 -13
- package/build/core/evaluation/compute_reorder_objective.d.ts.map +0 -1
- package/build/core/evaluation/compute_reorder_objective.js +0 -13
- package/build/core/evaluation/evaluate_search_gates.d.ts +0 -18
- package/build/core/evaluation/evaluate_search_gates.d.ts.map +0 -1
- package/build/core/evaluation/evaluate_search_gates.js +0 -30
- package/build/core/evaluation/evaluation_result.d.ts +0 -15
- package/build/core/evaluation/evaluation_result.d.ts.map +0 -1
- package/build/core/evaluation/evaluation_result.js +0 -1
- package/build/core/evaluation/genetic_fitness.d.ts +0 -9
- package/build/core/evaluation/genetic_fitness.d.ts.map +0 -1
- package/build/core/evaluation/genetic_fitness.js +0 -16
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts +0 -8
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts.map +0 -1
- package/build/core/evaluation/is_non_axle_gates_pass.js +0 -8
- package/build/core/evaluation/is_search_trial_admissible.d.ts +0 -10
- package/build/core/evaluation/is_search_trial_admissible.d.ts.map +0 -1
- package/build/core/evaluation/is_search_trial_admissible.js +0 -17
- package/build/core/evaluation/is_waypoint_order_valid.d.ts +0 -10
- package/build/core/evaluation/is_waypoint_order_valid.d.ts.map +0 -1
- package/build/core/evaluation/is_waypoint_order_valid.js +0 -14
- package/build/core/exceptions/AxleCalculationError.d.ts +0 -4
- package/build/core/exceptions/AxleCalculationError.d.ts.map +0 -1
- package/build/core/exceptions/AxleCalculationError.js +0 -6
- package/build/core/exceptions/InvalidStabilizerOutputError.d.ts +0 -4
- package/build/core/exceptions/InvalidStabilizerOutputError.d.ts.map +0 -1
- package/build/core/exceptions/InvalidStabilizerOutputError.js +0 -6
- package/build/core/factory/read_stabilizer_config_helpers.d.ts +0 -32
- package/build/core/factory/read_stabilizer_config_helpers.d.ts.map +0 -1
- package/build/core/factory/read_stabilizer_config_helpers.js +0 -73
- package/build/core/filters/collect_movable_items.d.ts +0 -18
- package/build/core/filters/collect_movable_items.d.ts.map +0 -1
- package/build/core/filters/collect_movable_items.js +0 -53
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.d.ts +0 -8
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.d.ts.map +0 -1
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.js +0 -41
- package/build/core/filters/is_item_on_cm_floor.d.ts +0 -8
- package/build/core/filters/is_item_on_cm_floor.d.ts.map +0 -1
- package/build/core/filters/is_item_on_cm_floor.js +0 -9
- package/build/core/geometry/has_penetrating_overlap.d.ts +0 -9
- package/build/core/geometry/has_penetrating_overlap.d.ts.map +0 -1
- package/build/core/geometry/has_penetrating_overlap.js +0 -27
- package/build/core/orchestration/build_milkrun_bands_from_config.d.ts +0 -13
- package/build/core/orchestration/build_milkrun_bands_from_config.d.ts.map +0 -1
- package/build/core/orchestration/build_milkrun_bands_from_config.js +0 -14
- package/build/core/orchestration/read_primary_env.d.ts +0 -9
- package/build/core/orchestration/read_primary_env.d.ts.map +0 -1
- package/build/core/orchestration/read_primary_env.js +0 -13
- package/build/core/strategies/reorder/append_admitted_trial.d.ts +0 -11
- package/build/core/strategies/reorder/append_admitted_trial.d.ts.map +0 -1
- package/build/core/strategies/reorder/append_admitted_trial.js +0 -22
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts +0 -10
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts.map +0 -1
- package/build/core/strategies/reorder/is_improving_greedy_trial.js +0 -17
- package/build/core/strategies/reorder/select_beam_expansion_candidates.d.ts +0 -9
- package/build/core/strategies/reorder/select_beam_expansion_candidates.d.ts.map +0 -1
- package/build/core/strategies/reorder/select_beam_expansion_candidates.js +0 -28
- package/build/core/strategies/reorder/select_surviving_beam.d.ts +0 -11
- package/build/core/strategies/reorder/select_surviving_beam.d.ts.map +0 -1
- package/build/core/strategies/reorder/select_surviving_beam.js +0 -13
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts +0 -71
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts.map +0 -1
- package/build/core/validation/contract/cargo_movement_wire_field_map.js +0 -77
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts +0 -14
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts.map +0 -1
- package/build/core/validation/contract/cargo_movement_wire_mapper.js +0 -43
- package/build/core/validation/contract/format_zod_error.d.ts +0 -8
- package/build/core/validation/contract/format_zod_error.d.ts.map +0 -1
- package/build/core/validation/contract/format_zod_error.js +0 -11
- package/build/core/validation/contract/index.d.ts +0 -9
- package/build/core/validation/contract/index.d.ts.map +0 -1
- package/build/core/validation/contract/index.js +0 -8
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts +0 -3
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts.map +0 -1
- package/build/core/validation/contract/map_contract_to_wire_shape.js +0 -33
- package/build/core/validation/contract/map_input_config.d.ts +0 -9
- package/build/core/validation/contract/map_input_config.d.ts.map +0 -1
- package/build/core/validation/contract/map_input_config.js +0 -40
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts +0 -2
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts.map +0 -1
- package/build/core/validation/contract/map_wire_input_to_contract_shape.js +0 -66
- package/build/core/validation/contract/map_wire_item_stacking.d.ts +0 -7
- package/build/core/validation/contract/map_wire_item_stacking.d.ts.map +0 -1
- package/build/core/validation/contract/map_wire_item_stacking.js +0 -40
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts +0 -8
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts.map +0 -1
- package/build/core/validation/contract/map_wire_item_to_contract.js +0 -51
- package/build/core/validation/contract/parse_stabilizer_input.d.ts +0 -90
- package/build/core/validation/contract/parse_stabilizer_input.d.ts.map +0 -1
- package/build/core/validation/contract/parse_stabilizer_input.js +0 -28
- package/build/core/validation/contract/parse_stabilizer_output.d.ts +0 -79
- package/build/core/validation/contract/parse_stabilizer_output.d.ts.map +0 -1
- package/build/core/validation/contract/parse_stabilizer_output.js +0 -24
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts +0 -6
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts.map +0 -1
- package/build/core/validation/contract/reject_forbidden_input_fields.js +0 -53
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts +0 -72
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_domain_schema.js +0 -42
- package/build/core/validation/contract/stabilizer_env_schema.d.ts +0 -112
- package/build/core/validation/contract/stabilizer_env_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_env_schema.js +0 -38
- package/build/core/validation/contract/stabilizer_input_schema.d.ts +0 -80
- package/build/core/validation/contract/stabilizer_input_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_input_schema.js +0 -11
- package/build/core/validation/contract/stabilizer_item_schema.d.ts +0 -25
- package/build/core/validation/contract/stabilizer_item_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_item_schema.js +0 -23
- package/build/core/validation/contract/stabilizer_output_schema.d.ts +0 -134
- package/build/core/validation/contract/stabilizer_output_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_output_schema.js +0 -16
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts +0 -14
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts.map +0 -1
- package/build/core/validation/contract/uniquify_contract_item_ids.js +0 -54
- package/build/core/validation/contract/wire_mapper_record_utils.d.ts +0 -34
- package/build/core/validation/contract/wire_mapper_record_utils.d.ts.map +0 -1
- package/build/core/validation/contract/wire_mapper_record_utils.js +0 -66
- package/build/core/waypoint/milkrun_wall_reservation.d.ts +0 -24
- package/build/core/waypoint/milkrun_wall_reservation.d.ts.map +0 -1
- package/build/core/waypoint/milkrun_wall_reservation.js +0 -57
- package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts +0 -15
- package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts.map +0 -1
- package/build/core/waypoint/milkrun_wall_reservation_helpers.js +0 -48
- package/build/core/waypoint/milkrun_wall_reservation_types.d.ts +0 -16
- package/build/core/waypoint/milkrun_wall_reservation_types.d.ts.map +0 -1
- package/build/core/waypoint/milkrun_wall_reservation_types.js +0 -1
package/build/index.js
CHANGED
|
@@ -1,40 +1,26 @@
|
|
|
1
1
|
import { Logger } from '@jetta/logger';
|
|
2
|
-
import {
|
|
2
|
+
import { run_stabilizer_flow_from_unknown } from './core/orchestration/StabilizerFlow.js';
|
|
3
3
|
import { stabilizer_logger } from './core/logging/stabilizer_logger.js';
|
|
4
|
-
import { parse_stabilizer_input, parse_stabilizer_output } from './core/validation/contract/index.js';
|
|
5
4
|
export { REORDER_STRATEGY, REORDER_STRATEGY_VALUES } from './core/constants/ReorderStrategy.js';
|
|
6
5
|
export { MixedWaypointIdError } from './core/exceptions/MixedWaypointIdError.js';
|
|
7
6
|
export { UnknownReorderStrategyError } from './core/exceptions/UnknownReorderStrategyError.js';
|
|
8
7
|
export { InvalidStabilizerInputError } from './core/exceptions/InvalidStabilizerInputError.js';
|
|
9
|
-
export { InvalidStabilizerOutputError } from './core/exceptions/InvalidStabilizerOutputError.js';
|
|
10
|
-
export { parse_stabilizer_input, safe_parse_stabilizer_input, parse_stabilizer_output, safe_parse_stabilizer_output, map_wire_input_to_contract, map_contract_to_wire_output } from './core/validation/contract/index.js';
|
|
11
8
|
const messages = [];
|
|
12
9
|
const UNKNOWN_IDENTITY = 'UNKNOWN';
|
|
13
10
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param input -
|
|
16
|
-
* @returns Success or error response with
|
|
11
|
+
* Stabilizes cargo by reordering loose items (legacy CM-compatible response).
|
|
12
|
+
* @param input - Stabilizer input matching cargo-movement wire shape.
|
|
13
|
+
* @returns Success or error response with messages array.
|
|
17
14
|
*/
|
|
18
15
|
export async function stabilize(input) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return run_stabilize(parse_stabilizer_input(input));
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
return build_error_response(error);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
16
|
+
const company = input.company !== undefined ? String(input.company) : UNKNOWN_IDENTITY;
|
|
17
|
+
const cargo_id = input.id !== undefined ? String(input.id) : UNKNOWN_IDENTITY;
|
|
18
|
+
return Logger.run_with_cargo_info(company, cargo_id, () => run_stabilize(input));
|
|
28
19
|
}
|
|
29
|
-
|
|
30
|
-
* Runs stabilizer on a parsed contract input. `unknown` is not accepted.
|
|
31
|
-
* @param input - Validated stabilizer input.
|
|
32
|
-
* @returns Success or error response.
|
|
33
|
-
*/
|
|
34
|
-
export function run_stabilize(input) {
|
|
20
|
+
function run_stabilize(input) {
|
|
35
21
|
stabilizer_logger.log('cargo-stabilizer started');
|
|
36
22
|
try {
|
|
37
|
-
const cargo_state =
|
|
23
|
+
const cargo_state = run_stabilizer_flow_from_unknown(input);
|
|
38
24
|
stabilizer_logger.log('cargo-stabilizer finished successfully');
|
|
39
25
|
return build_success_response(cargo_state);
|
|
40
26
|
}
|
|
@@ -42,27 +28,12 @@ export function run_stabilize(input) {
|
|
|
42
28
|
return build_error_response(error);
|
|
43
29
|
}
|
|
44
30
|
}
|
|
45
|
-
function read_stabilizer_identity(input) {
|
|
46
|
-
if (typeof input !== 'object' || input === null) {
|
|
47
|
-
return { company: UNKNOWN_IDENTITY, cargo_id: UNKNOWN_IDENTITY };
|
|
48
|
-
}
|
|
49
|
-
const record = input;
|
|
50
|
-
return {
|
|
51
|
-
company: record.company !== undefined ? String(record.company) : UNKNOWN_IDENTITY,
|
|
52
|
-
cargo_id: record.id !== undefined ? String(record.id) : UNKNOWN_IDENTITY
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
31
|
function build_success_response(cargo_state) {
|
|
56
|
-
|
|
32
|
+
return {
|
|
57
33
|
status: 'success',
|
|
58
34
|
data: cargo_state,
|
|
59
35
|
messages: [...messages]
|
|
60
36
|
};
|
|
61
|
-
const validated = parse_stabilizer_output(english_response);
|
|
62
|
-
if (validated.status !== 'success') {
|
|
63
|
-
throw new Error('Expected success response after stabilizer flow');
|
|
64
|
-
}
|
|
65
|
-
return validated;
|
|
66
37
|
}
|
|
67
38
|
function build_error_response(err) {
|
|
68
39
|
stabilizer_logger.warn('cargo-stabilizer finished with error');
|
|
@@ -70,13 +41,11 @@ function build_error_response(err) {
|
|
|
70
41
|
if (err.stack) {
|
|
71
42
|
stabilizer_logger.error(err.stack);
|
|
72
43
|
}
|
|
73
|
-
|
|
44
|
+
return {
|
|
74
45
|
status: 'error',
|
|
75
46
|
data: err.message,
|
|
76
47
|
messages: [...messages, err.message]
|
|
77
48
|
};
|
|
78
|
-
parse_stabilizer_output(response);
|
|
79
|
-
return response;
|
|
80
49
|
}
|
|
81
50
|
export { run_stabilizer_flow_from_unknown } from './core/orchestration/StabilizerFlow.js';
|
|
82
51
|
export { create_reorder_strategy } from './core/factory/strategy_factory.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetta/cargo-stabilizer",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-3",
|
|
4
4
|
"description": "Stable loose-item reorder library for cargo-movement (JET-2262)",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -29,25 +29,23 @@
|
|
|
29
29
|
"coverage:ci": "c8 --reporter=text --reporter=text-summary --check-coverage --lines 75 --functions 75 --branches 75 --statements 75 npm run test"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@jetta/axle-load-calculator": "^0.
|
|
32
|
+
"@jetta/axle-load-calculator": "^0.1.3",
|
|
33
33
|
"@jetta/cargo-stability": "^2.0.1-3",
|
|
34
34
|
"@jetta/empty-spaces-manager": "^0.1.1-0",
|
|
35
|
-
"@jetta/number-compare": "^3.0.3",
|
|
36
|
-
"@jetta/stacking-constraints": "^1.1.0",
|
|
37
35
|
"zod": "^4.4.3"
|
|
38
36
|
},
|
|
39
37
|
"devDependencies": {
|
|
40
38
|
"@types/chai": "^5.2.3",
|
|
41
39
|
"@types/mocha": "^10.0.10",
|
|
42
|
-
"@types/node": "^
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
44
|
-
"@typescript-eslint/parser": "^8.
|
|
45
|
-
"c8": "^
|
|
40
|
+
"@types/node": "^25.9.1",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
42
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
43
|
+
"c8": "^11.0.0",
|
|
46
44
|
"chai": "^6.2.2",
|
|
47
|
-
"eslint": "^
|
|
48
|
-
"mocha": "^11.
|
|
49
|
-
"publint": "^0.3.
|
|
50
|
-
"tsx": "^4.
|
|
45
|
+
"eslint": "^9.39.4",
|
|
46
|
+
"mocha": "^11.7.6",
|
|
47
|
+
"publint": "^0.3.23",
|
|
48
|
+
"tsx": "^4.22.3",
|
|
51
49
|
"typescript": "^6.0.3"
|
|
52
50
|
}
|
|
53
51
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axle_load_evaluation.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/axle_load_evaluation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAE/B,KAAK,EAAE,OAAO,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { StabilizerEnv } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
-
/**
|
|
3
|
-
* Builds the axle-load-calculator request from typed stabilizer env fields.
|
|
4
|
-
* @param env - Stabilizer env with containers, vehicle, and axles.
|
|
5
|
-
* @returns Calculator request payload.
|
|
6
|
-
*/
|
|
7
|
-
export declare function build_axle_request(env: StabilizerEnv): Record<string, unknown>;
|
|
8
|
-
//# sourceMappingURL=build_axle_request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_axle_request.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/build_axle_request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,aAAa,EAGhB,MAAM,oDAAoD,CAAA;AAE3D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkB9E"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builds the axle-load-calculator request from typed stabilizer env fields.
|
|
3
|
-
* @param env - Stabilizer env with containers, vehicle, and axles.
|
|
4
|
-
* @returns Calculator request payload.
|
|
5
|
-
*/
|
|
6
|
-
export function build_axle_request(env) {
|
|
7
|
-
const wire_env = {
|
|
8
|
-
...map_vehicle_to_wire(env.vehicle),
|
|
9
|
-
containers: env.containers.map(map_container_to_axle_wire)
|
|
10
|
-
};
|
|
11
|
-
if (env.axles !== undefined) {
|
|
12
|
-
wire_env.eixos = env.axles.map(axle => ({
|
|
13
|
-
distanciaOrigem: axle.distance_from_origin,
|
|
14
|
-
pesoMaxSuportado: axle.max_supported_weight,
|
|
15
|
-
pesoDnit: axle.dnit_weight,
|
|
16
|
-
tara: axle.tare,
|
|
17
|
-
sequenciaContainer: axle.container_sequence,
|
|
18
|
-
sequence: axle.sequence
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
return { envs: [wire_env] };
|
|
22
|
-
}
|
|
23
|
-
function map_vehicle_to_wire(vehicle) {
|
|
24
|
-
if (vehicle === undefined) {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
_id: vehicle.vehicle_id,
|
|
29
|
-
tipoVeiculo: vehicle.vehicle_type,
|
|
30
|
-
tipoVersao: vehicle.version_type,
|
|
31
|
-
tipoSuspensao: vehicle.suspension_type,
|
|
32
|
-
primeiroEixo: vehicle.first_axle,
|
|
33
|
-
tara: vehicle.tare,
|
|
34
|
-
pesoMaxSuportado: vehicle.max_supported_weight,
|
|
35
|
-
qtd: vehicle.quantity
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function map_container_to_axle_wire(container) {
|
|
39
|
-
return {
|
|
40
|
-
sequencia: container.sequence,
|
|
41
|
-
largura: container.width,
|
|
42
|
-
altura: container.height,
|
|
43
|
-
comprimento: container.length,
|
|
44
|
-
distPinoRei: container.kingpin_distance,
|
|
45
|
-
containerDistanceAhead: container.container_distance_ahead,
|
|
46
|
-
pesoMaxSuportado: container.max_supported_weight,
|
|
47
|
-
tara: container.tare,
|
|
48
|
-
pesoDeCarga: container.cargo_weight,
|
|
49
|
-
grouper: container.grouper,
|
|
50
|
-
items: container.items.map(map_item_to_axle_wire)
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function map_item_to_axle_wire(item) {
|
|
54
|
-
return {
|
|
55
|
-
_id: item.item_id,
|
|
56
|
-
x: item.x,
|
|
57
|
-
y: item.z,
|
|
58
|
-
z: item.y,
|
|
59
|
-
w: item.width,
|
|
60
|
-
h: item.height,
|
|
61
|
-
d: item.depth,
|
|
62
|
-
peso: item.weight ?? 0,
|
|
63
|
-
largura: item.width,
|
|
64
|
-
altura: item.height,
|
|
65
|
-
comprimento: item.depth
|
|
66
|
-
};
|
|
67
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sums kilograms over the folga limit across container axle rows.
|
|
3
|
-
* @param axles - Calculator pesoEixos rows.
|
|
4
|
-
* @param folga_pct - Axle load margin percent.
|
|
5
|
-
* @returns Total excess kilograms; zero when all axles are within limits.
|
|
6
|
-
*/
|
|
7
|
-
export declare function compute_axle_excess_kg(axles: Record<string, unknown>[], folga_pct: number): number;
|
|
8
|
-
//# sourceMappingURL=compute_axle_excess_kg.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compute_axle_excess_kg.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/compute_axle_excess_kg.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAChC,SAAS,EAAE,MAAM,GAClB,MAAM,CAQR"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sums kilograms over the folga limit across container axle rows.
|
|
3
|
-
* @param axles - Calculator pesoEixos rows.
|
|
4
|
-
* @param folga_pct - Axle load margin percent.
|
|
5
|
-
* @returns Total excess kilograms; zero when all axles are within limits.
|
|
6
|
-
*/
|
|
7
|
-
export function compute_axle_excess_kg(axles, folga_pct) {
|
|
8
|
-
let excess_kg = 0;
|
|
9
|
-
for (const axle of axles) {
|
|
10
|
-
excess_kg += axle_row_excess_kg(axle, folga_pct);
|
|
11
|
-
}
|
|
12
|
-
return excess_kg;
|
|
13
|
-
}
|
|
14
|
-
function axle_row_excess_kg(axle, folga_pct) {
|
|
15
|
-
const final_kg = Number(axle.pesoCarregadoFinal ?? 0);
|
|
16
|
-
const max_kg = Number(axle.pesoMaxFinal ?? 0);
|
|
17
|
-
const limit_kg = max_kg * (1 + folga_pct / 100);
|
|
18
|
-
return Math.max(0, final_kg - limit_kg);
|
|
19
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Space } from '@jetta/empty-spaces-manager';
|
|
2
|
-
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
3
|
-
/**
|
|
4
|
-
* Finds empty regions in a container after allocating pinned and other items.
|
|
5
|
-
* @param container - Stabilizer container layout.
|
|
6
|
-
* @param exclude_item_id - Loose item id to omit from obstacles (virtual remove).
|
|
7
|
-
* @returns Empty space fragments from EmptySpaceFinder.
|
|
8
|
-
*/
|
|
9
|
-
export declare function find_empty_spaces_in_container(container: StabilizerContainer, exclude_item_id?: string): Space[];
|
|
10
|
-
//# sourceMappingURL=empty_space_adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"empty_space_adapter.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/empty_space_adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,EAAE,MAAM,6BAA6B,CAAA;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAE7F;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC1C,SAAS,EAAE,mBAAmB,EAC9B,eAAe,CAAC,EAAE,MAAM,GACzB,KAAK,EAAE,CAgBT"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { EmptySpaceFinder, Space } from '@jetta/empty-spaces-manager';
|
|
2
|
-
import { map_item_to_positioned_cube } from './map_item_to_positioned_cube.js';
|
|
3
|
-
/**
|
|
4
|
-
* Finds empty regions in a container after allocating pinned and other items.
|
|
5
|
-
* @param container - Stabilizer container layout.
|
|
6
|
-
* @param exclude_item_id - Loose item id to omit from obstacles (virtual remove).
|
|
7
|
-
* @returns Empty space fragments from EmptySpaceFinder.
|
|
8
|
-
*/
|
|
9
|
-
export function find_empty_spaces_in_container(container, exclude_item_id) {
|
|
10
|
-
const container_space = new Space({
|
|
11
|
-
x: 0,
|
|
12
|
-
y: 0,
|
|
13
|
-
z: 0,
|
|
14
|
-
width: container.width,
|
|
15
|
-
height: container.height,
|
|
16
|
-
length: container.length
|
|
17
|
-
});
|
|
18
|
-
const obstacles = container.items
|
|
19
|
-
.filter(item => item.item_id !== exclude_item_id)
|
|
20
|
-
.map(map_item_to_positioned_cube);
|
|
21
|
-
const finder = new EmptySpaceFinder(container_space, []);
|
|
22
|
-
finder.allocate_item_list(obstacles);
|
|
23
|
-
return finder.empty_spaces();
|
|
24
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { StabilizerEnv } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
-
import type { AxleLoadEvaluation } from './axle_load_evaluation.js';
|
|
3
|
-
/**
|
|
4
|
-
* Evaluates axle legality and excess kilograms in one calculator pass.
|
|
5
|
-
* @param env - Stabilizer env with containers and axles.
|
|
6
|
-
* @param folga_pct - Axle load margin percent.
|
|
7
|
-
* @returns Validity and excess over the folga-adjusted max.
|
|
8
|
-
*/
|
|
9
|
-
export declare function evaluate_axle_load(env: StabilizerEnv, folga_pct: number): AxleLoadEvaluation;
|
|
10
|
-
//# sourceMappingURL=evaluate_axle_load.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate_axle_load.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/evaluate_axle_load.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAA;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAEnE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAc5F"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { run_axle_calculator } from './run_axle_calculator.js';
|
|
2
|
-
import { compute_axle_excess_kg } from './compute_axle_excess_kg.js';
|
|
3
|
-
/**
|
|
4
|
-
* Evaluates axle legality and excess kilograms in one calculator pass.
|
|
5
|
-
* @param env - Stabilizer env with containers and axles.
|
|
6
|
-
* @param folga_pct - Axle load margin percent.
|
|
7
|
-
* @returns Validity and excess over the folga-adjusted max.
|
|
8
|
-
*/
|
|
9
|
-
export function evaluate_axle_load(env, folga_pct) {
|
|
10
|
-
if (!env.axles || env.axles.length === 0) {
|
|
11
|
-
return { valid: true, excess_kg: 0 };
|
|
12
|
-
}
|
|
13
|
-
const result = run_axle_calculator(env);
|
|
14
|
-
if (!result.calculated) {
|
|
15
|
-
return { valid: false, excess_kg: Number.POSITIVE_INFINITY };
|
|
16
|
-
}
|
|
17
|
-
return evaluation_from_calculated_env(result.env, folga_pct);
|
|
18
|
-
}
|
|
19
|
-
function evaluation_from_calculated_env(calculated_env, folga_pct) {
|
|
20
|
-
const containers = (calculated_env.containers ?? []);
|
|
21
|
-
const axles = collect_container_axle_rows(containers);
|
|
22
|
-
const excess_kg = compute_axle_excess_kg(axles, folga_pct);
|
|
23
|
-
return { valid: excess_kg === 0, excess_kg };
|
|
24
|
-
}
|
|
25
|
-
function collect_container_axle_rows(containers) {
|
|
26
|
-
const rows = [];
|
|
27
|
-
for (const container of containers) {
|
|
28
|
-
const axles = (container.pesoEixos ?? []);
|
|
29
|
-
rows.push(...axles);
|
|
30
|
-
}
|
|
31
|
-
return rows;
|
|
32
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Space } from '@jetta/empty-spaces-manager';
|
|
2
|
-
import type { StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
3
|
-
/**
|
|
4
|
-
* Maps a stabilizer item to an empty-spaces positioned cube.
|
|
5
|
-
* @param item - Stabilizer item record.
|
|
6
|
-
* @returns Positioned cube for EmptySpaceFinder allocation.
|
|
7
|
-
*/
|
|
8
|
-
export declare function map_item_to_positioned_cube(item: StabilizerItem): Space;
|
|
9
|
-
//# sourceMappingURL=map_item_to_positioned_cube.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map_item_to_positioned_cube.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/map_item_to_positioned_cube.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAExF;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,cAAc,GAAG,KAAK,CAUvE"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Space } from '@jetta/empty-spaces-manager';
|
|
2
|
-
/**
|
|
3
|
-
* Maps a stabilizer item to an empty-spaces positioned cube.
|
|
4
|
-
* @param item - Stabilizer item record.
|
|
5
|
-
* @returns Positioned cube for EmptySpaceFinder allocation.
|
|
6
|
-
*/
|
|
7
|
-
export function map_item_to_positioned_cube(item) {
|
|
8
|
-
return new Space({
|
|
9
|
-
x: item.x,
|
|
10
|
-
y: item.y,
|
|
11
|
-
z: item.z,
|
|
12
|
-
width: item.width,
|
|
13
|
-
height: item.height,
|
|
14
|
-
length: item.depth
|
|
15
|
-
});
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type Item } from '@jetta/stacking-constraints';
|
|
2
|
-
import type { StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
3
|
-
/**
|
|
4
|
-
* Maps a stabilizer item onto a stacking-constraints Item.
|
|
5
|
-
* @param item - Stabilizer item.
|
|
6
|
-
* @param position - Optional pose override for a candidate slot.
|
|
7
|
-
* @returns Stacking-constraints item.
|
|
8
|
-
*/
|
|
9
|
-
export declare function map_item_to_stacking_item(item: StabilizerItem, position?: {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
z: number;
|
|
13
|
-
}): Item;
|
|
14
|
-
//# sourceMappingURL=map_item_to_stacking_item.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map_item_to_stacking_item.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/map_item_to_stacking_item.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,IAAI,EAAsB,MAAM,6BAA6B,CAAA;AACnG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAKxF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACrC,IAAI,EAAE,cAAc,EACpB,QAAQ,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/C,IAAI,CAYN"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { default_stacking_rules } from '@jetta/stacking-constraints';
|
|
2
|
-
const ALLOWED_FAMILIES_CONSTRAINT = 'ALLOWED_FAMILIES';
|
|
3
|
-
const SUPPORTED_WEIGHT_UNIT = 'supportedWeight';
|
|
4
|
-
/**
|
|
5
|
-
* Maps a stabilizer item onto a stacking-constraints Item.
|
|
6
|
-
* @param item - Stabilizer item.
|
|
7
|
-
* @param position - Optional pose override for a candidate slot.
|
|
8
|
-
* @returns Stacking-constraints item.
|
|
9
|
-
*/
|
|
10
|
-
export function map_item_to_stacking_item(item, position) {
|
|
11
|
-
return {
|
|
12
|
-
itemId: item.item_id,
|
|
13
|
-
x: position?.x ?? item.x,
|
|
14
|
-
y: position?.y ?? item.y,
|
|
15
|
-
z: position?.z ?? item.z,
|
|
16
|
-
width: item.width,
|
|
17
|
-
height: item.height,
|
|
18
|
-
length: item.depth,
|
|
19
|
-
stackingRules: build_stacking_rules(item)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function build_stacking_rules(item) {
|
|
23
|
-
const rules = default_stacking_rules();
|
|
24
|
-
return {
|
|
25
|
-
...rules,
|
|
26
|
-
family: item.family ?? rules.family,
|
|
27
|
-
allowedFamilies: item.supported_families ?? [...rules.allowedFamilies],
|
|
28
|
-
enableOnlyAllowedFamilies: is_family_constraint_enabled(item),
|
|
29
|
-
weight: item.weight !== undefined && item.weight > 0 ? item.weight : rules.weight,
|
|
30
|
-
enableMaximumStackingWeight: item.stacking_unit === SUPPORTED_WEIGHT_UNIT,
|
|
31
|
-
maximumStackingWeight: item.supported_weight ?? rules.maximumStackingWeight,
|
|
32
|
-
enableStackSameItemOnly: item.stack_same_item === true,
|
|
33
|
-
enableStackSameAreaOnly: item.stack_same_area === true,
|
|
34
|
-
priority: item.priority ?? rules.priority,
|
|
35
|
-
...(item.waypoint_id !== undefined ? { waypoint_id: item.waypoint_id } : {})
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function is_family_constraint_enabled(item) {
|
|
39
|
-
return item.constraint === ALLOWED_FAMILIES_CONSTRAINT || item.stack_families === true;
|
|
40
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { StabilizerEnv } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
-
export type AxleCalculatorResult = {
|
|
3
|
-
calculated: true;
|
|
4
|
-
env: Record<string, unknown>;
|
|
5
|
-
} | {
|
|
6
|
-
calculated: false;
|
|
7
|
-
reason: string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Runs the axle-load calculator for a candidate env layout.
|
|
11
|
-
* @param env - Stabilizer env with containers and axles.
|
|
12
|
-
* @returns Calculated env, or the reason the layout was rejected.
|
|
13
|
-
* @throws {AxleCalculationError} When the vehicle or item configuration cannot be calculated.
|
|
14
|
-
*/
|
|
15
|
-
export declare function run_axle_calculator(env: StabilizerEnv): AxleCalculatorResult;
|
|
16
|
-
//# sourceMappingURL=run_axle_calculator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run_axle_calculator.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/run_axle_calculator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAA;AAEvF,MAAM,MAAM,oBAAoB,GAC1B;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAClD;IAAE,UAAU,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,oBAAoB,CAW5E"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { calculate_weight_on_axles_physics, ItemOverlapError } from '@jetta/axle-load-calculator';
|
|
2
|
-
import { build_axle_request } from './build_axle_request.js';
|
|
3
|
-
import { AxleCalculationError } from '../exceptions/AxleCalculationError.js';
|
|
4
|
-
import { stabilizer_logger } from '../logging/stabilizer_logger.js';
|
|
5
|
-
/**
|
|
6
|
-
* Runs the axle-load calculator for a candidate env layout.
|
|
7
|
-
* @param env - Stabilizer env with containers and axles.
|
|
8
|
-
* @returns Calculated env, or the reason the layout was rejected.
|
|
9
|
-
* @throws {AxleCalculationError} When the vehicle or item configuration cannot be calculated.
|
|
10
|
-
*/
|
|
11
|
-
export function run_axle_calculator(env) {
|
|
12
|
-
const request = build_axle_request(env);
|
|
13
|
-
try {
|
|
14
|
-
return calculated_env_from_physics(request);
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
return handle_calculator_failure(error);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function calculated_env_from_physics(request) {
|
|
21
|
-
const output = calculate_weight_on_axles_physics(request);
|
|
22
|
-
if (Array.isArray(output.envs) && output.envs.length > 0) {
|
|
23
|
-
return { calculated: true, env: output.envs[0] };
|
|
24
|
-
}
|
|
25
|
-
throw new AxleCalculationError('calculator returned no envs');
|
|
26
|
-
}
|
|
27
|
-
function handle_calculator_failure(error) {
|
|
28
|
-
if (error instanceof ItemOverlapError) {
|
|
29
|
-
stabilizer_logger.debug('axle gate rejected candidate layout: ' + error.message);
|
|
30
|
-
return { calculated: false, reason: error.message };
|
|
31
|
-
}
|
|
32
|
-
if (error instanceof AxleCalculationError) {
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
36
|
-
throw new AxleCalculationError(message);
|
|
37
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
-
import type { CandidateSlotKind } from '../move/apply_move.js';
|
|
3
|
-
import type { EmptySpaceSlot } from './enumerate_empty_space_slots.js';
|
|
4
|
-
export interface TaggedSlot {
|
|
5
|
-
position: EmptySpaceSlot;
|
|
6
|
-
slot_kind: CandidateSlotKind;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Collects empty-space origins and per-supporter top origins, supporter first.
|
|
10
|
-
* @param container - Target container layout.
|
|
11
|
-
* @param item - Loose item to place.
|
|
12
|
-
* @param exclude_item_id - Loose item id omitted from obstacles and supporters.
|
|
13
|
-
* @returns Tagged slots with supporter-top entries before empty-space entries.
|
|
14
|
-
*/
|
|
15
|
-
export declare function collect_container_slots(container: StabilizerContainer, item: StabilizerContainer['items'][number], exclude_item_id: string): TaggedSlot[];
|
|
16
|
-
//# sourceMappingURL=collect_container_slots.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collect_container_slots.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/collect_container_slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAItE,MAAM,WAAW,UAAU;IAEvB,QAAQ,EAAE,cAAc,CAAA;IACxB,SAAS,EAAE,iBAAiB,CAAA;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,SAAS,EAAE,mBAAmB,EAC9B,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAC1C,eAAe,EAAE,MAAM,GACxB,UAAU,EAAE,CAQd"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { enumerate_empty_space_slots } from './enumerate_empty_space_slots.js';
|
|
2
|
-
import { enumerate_supporter_top_slots } from './enumerate_supporter_top_slots.js';
|
|
3
|
-
/**
|
|
4
|
-
* Collects empty-space origins and per-supporter top origins, supporter first.
|
|
5
|
-
* @param container - Target container layout.
|
|
6
|
-
* @param item - Loose item to place.
|
|
7
|
-
* @param exclude_item_id - Loose item id omitted from obstacles and supporters.
|
|
8
|
-
* @returns Tagged slots with supporter-top entries before empty-space entries.
|
|
9
|
-
*/
|
|
10
|
-
export function collect_container_slots(container, item, exclude_item_id) {
|
|
11
|
-
const supporter = enumerate_supporter_top_slots(container, item, exclude_item_id);
|
|
12
|
-
const empty = enumerate_empty_space_slots(container, item, exclude_item_id);
|
|
13
|
-
return [
|
|
14
|
-
...tag_slots(supporter, 'supporter_top'),
|
|
15
|
-
...tag_slots(empty, 'empty_space')
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
function tag_slots(slots, slot_kind) {
|
|
19
|
-
return slots.map(position => ({ position, slot_kind }));
|
|
20
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { StabilizerContainer, StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
-
export interface EmptySpaceSlot {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
z: number;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Enumerates candidate positions from empty-space regions where the item fits.
|
|
9
|
-
* @param container - Target container layout.
|
|
10
|
-
* @param item - Loose item dimensions.
|
|
11
|
-
* @param exclude_item_id - Item id to omit from obstacle list.
|
|
12
|
-
* @returns Slot positions at each fitting empty-space origin.
|
|
13
|
-
*/
|
|
14
|
-
export declare function enumerate_empty_space_slots(container: StabilizerContainer, item: StabilizerItem, exclude_item_id: string): EmptySpaceSlot[];
|
|
15
|
-
//# sourceMappingURL=enumerate_empty_space_slots.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enumerate_empty_space_slots.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/enumerate_empty_space_slots.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAG7G,MAAM,WAAW,cAAc;IAE3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACZ;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACvC,SAAS,EAAE,mBAAmB,EAC9B,IAAI,EAAE,cAAc,EACpB,eAAe,EAAE,MAAM,GACxB,cAAc,EAAE,CAmBlB"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { find_empty_spaces_in_container } from '../adapters/empty_space_adapter.js';
|
|
2
|
-
/**
|
|
3
|
-
* Enumerates candidate positions from empty-space regions where the item fits.
|
|
4
|
-
* @param container - Target container layout.
|
|
5
|
-
* @param item - Loose item dimensions.
|
|
6
|
-
* @param exclude_item_id - Item id to omit from obstacle list.
|
|
7
|
-
* @returns Slot positions at each fitting empty-space origin.
|
|
8
|
-
*/
|
|
9
|
-
export function enumerate_empty_space_slots(container, item, exclude_item_id) {
|
|
10
|
-
const spaces = find_empty_spaces_in_container(container, exclude_item_id);
|
|
11
|
-
const slots = [];
|
|
12
|
-
for (const space of spaces) {
|
|
13
|
-
if (!space_fits_item(space, item)) {
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
slots.push({
|
|
17
|
-
x: space.get_x(),
|
|
18
|
-
y: space.get_y(),
|
|
19
|
-
z: space.get_z()
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return dedupe_slots(slots);
|
|
23
|
-
}
|
|
24
|
-
function space_fits_item(space, item) {
|
|
25
|
-
return space.get_width() >= item.width - 1e-6 &&
|
|
26
|
-
space.get_height() >= item.height - 1e-6 &&
|
|
27
|
-
space.get_length() >= item.depth - 1e-6;
|
|
28
|
-
}
|
|
29
|
-
function dedupe_slots(slots) {
|
|
30
|
-
const seen = new Set();
|
|
31
|
-
const unique = [];
|
|
32
|
-
for (const slot of slots) {
|
|
33
|
-
const key = `${round_coord(slot.x)}:${round_coord(slot.y)}:${round_coord(slot.z)}`;
|
|
34
|
-
if (seen.has(key)) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
seen.add(key);
|
|
38
|
-
unique.push(slot);
|
|
39
|
-
}
|
|
40
|
-
return unique;
|
|
41
|
-
}
|
|
42
|
-
function round_coord(value) {
|
|
43
|
-
return Math.round(value * 1000) / 1000;
|
|
44
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { StabilizerContainer, StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
-
import type { EmptySpaceSlot } from './enumerate_empty_space_slots.js';
|
|
3
|
-
/**
|
|
4
|
-
* Emits one candidate origin per supporter footprint (x, supporter top y, z).
|
|
5
|
-
* @param container - Target container layout.
|
|
6
|
-
* @param item - Loose item dimensions.
|
|
7
|
-
* @param exclude_item_id - Loose item id omitted as a supporter.
|
|
8
|
-
* @returns Slot positions aligned to each supporter origin.
|
|
9
|
-
*/
|
|
10
|
-
export declare function enumerate_supporter_top_slots(container: StabilizerContainer, item: StabilizerItem, exclude_item_id: string): EmptySpaceSlot[];
|
|
11
|
-
//# sourceMappingURL=enumerate_supporter_top_slots.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enumerate_supporter_top_slots.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/enumerate_supporter_top_slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAC7G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAItE;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CACzC,SAAS,EAAE,mBAAmB,EAC9B,IAAI,EAAE,cAAc,EACpB,eAAe,EAAE,MAAM,GACxB,cAAc,EAAE,CAgBlB"}
|