@jetta/cargo-stabilizer 0.1.0-9 → 0.1.1
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/README.md +17 -11
- package/build/core/adapters/axle_adapter.d.ts +1 -0
- package/build/core/adapters/axle_adapter.d.ts.map +1 -1
- package/build/core/adapters/axle_adapter.js +3 -18
- package/build/core/adapters/axle_load_evaluation.d.ts +8 -0
- package/build/core/adapters/axle_load_evaluation.d.ts.map +1 -0
- package/build/core/adapters/axle_load_evaluation.js +1 -0
- package/build/core/adapters/build_axle_request.d.ts +2 -9
- package/build/core/adapters/build_axle_request.d.ts.map +1 -1
- package/build/core/adapters/build_axle_request.js +52 -24
- package/build/core/adapters/compute_axle_excess_kg.d.ts +8 -0
- package/build/core/adapters/compute_axle_excess_kg.d.ts.map +1 -0
- package/build/core/adapters/compute_axle_excess_kg.js +19 -0
- package/build/core/adapters/coordinate_mapper.d.ts +1 -1
- package/build/core/adapters/coordinate_mapper.js +3 -3
- package/build/core/adapters/evaluate_axle_load.d.ts +10 -0
- package/build/core/adapters/evaluate_axle_load.d.ts.map +1 -0
- package/build/core/adapters/evaluate_axle_load.js +32 -0
- package/build/core/adapters/map_item_to_stacking_item.d.ts +14 -0
- package/build/core/adapters/map_item_to_stacking_item.d.ts.map +1 -0
- package/build/core/adapters/map_item_to_stacking_item.js +40 -0
- package/build/core/adapters/run_axle_calculator.d.ts.map +1 -1
- package/build/core/adapters/run_axle_calculator.js +21 -16
- package/build/core/candidates/candidate_validation.d.ts.map +1 -1
- package/build/core/candidates/candidate_validation.js +4 -0
- package/build/core/candidates/is_candidate_stacking_valid.d.ts +14 -0
- package/build/core/candidates/is_candidate_stacking_valid.d.ts.map +1 -0
- package/build/core/candidates/is_candidate_stacking_valid.js +43 -0
- package/build/core/constants/TieRatioOrientation.d.ts +6 -0
- package/build/core/constants/TieRatioOrientation.d.ts.map +1 -0
- package/build/core/constants/TieRatioOrientation.js +5 -0
- package/build/core/evaluation/compare_search_states.d.ts +12 -0
- package/build/core/evaluation/compare_search_states.d.ts.map +1 -0
- package/build/core/evaluation/compare_search_states.js +12 -0
- package/build/core/evaluation/evaluate_search_gates.d.ts +18 -0
- package/build/core/evaluation/evaluate_search_gates.d.ts.map +1 -0
- package/build/core/evaluation/evaluate_search_gates.js +30 -0
- package/build/core/evaluation/evaluation_result.d.ts +15 -0
- package/build/core/evaluation/evaluation_result.d.ts.map +1 -0
- package/build/core/evaluation/evaluation_result.js +1 -0
- package/build/core/evaluation/genetic_fitness.d.ts +9 -0
- package/build/core/evaluation/genetic_fitness.d.ts.map +1 -0
- package/build/core/evaluation/genetic_fitness.js +16 -0
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts +8 -0
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts.map +1 -0
- package/build/core/evaluation/is_non_axle_gates_pass.js +8 -0
- package/build/core/evaluation/is_search_trial_admissible.d.ts +10 -0
- package/build/core/evaluation/is_search_trial_admissible.d.ts.map +1 -0
- package/build/core/evaluation/is_search_trial_admissible.js +17 -0
- package/build/core/evaluation/is_waypoint_order_valid.d.ts +10 -0
- package/build/core/evaluation/is_waypoint_order_valid.d.ts.map +1 -0
- package/build/core/evaluation/is_waypoint_order_valid.js +14 -0
- package/build/core/evaluation/state_evaluator.d.ts +2 -10
- package/build/core/evaluation/state_evaluator.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.js +6 -26
- package/build/core/factory/read_stabilizer_config.d.ts +3 -2
- package/build/core/factory/read_stabilizer_config.d.ts.map +1 -1
- package/build/core/factory/read_stabilizer_config_helpers.d.ts +9 -5
- package/build/core/factory/read_stabilizer_config_helpers.d.ts.map +1 -1
- package/build/core/factory/read_stabilizer_config_helpers.js +12 -1
- package/build/core/filters/collect_movable_items.d.ts +18 -0
- package/build/core/filters/collect_movable_items.d.ts.map +1 -0
- package/build/core/filters/collect_movable_items.js +53 -0
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.d.ts +8 -0
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.d.ts.map +1 -0
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.js +41 -0
- package/build/core/filters/is_item_on_cm_floor.d.ts +8 -0
- package/build/core/filters/is_item_on_cm_floor.d.ts.map +1 -0
- package/build/core/filters/is_item_on_cm_floor.js +9 -0
- package/build/core/geometry/has_penetrating_overlap.d.ts +9 -0
- package/build/core/geometry/has_penetrating_overlap.d.ts.map +1 -0
- package/build/core/geometry/has_penetrating_overlap.js +27 -0
- 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.map +1 -1
- package/build/core/orchestration/build_reorder_context.js +3 -5
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.js +10 -12
- package/build/core/strategies/reorder/GeneticReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/GeneticReorder.js +2 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.js +14 -5
- package/build/core/strategies/reorder/append_admitted_trial.d.ts +11 -0
- package/build/core/strategies/reorder/append_admitted_trial.d.ts.map +1 -0
- package/build/core/strategies/reorder/append_admitted_trial.js +22 -0
- package/build/core/strategies/reorder/beam_context.d.ts +1 -0
- package/build/core/strategies/reorder/beam_context.d.ts.map +1 -1
- package/build/core/strategies/reorder/compare_beam_states.d.ts +9 -0
- package/build/core/strategies/reorder/compare_beam_states.d.ts.map +1 -0
- package/build/core/strategies/reorder/compare_beam_states.js +26 -0
- package/build/core/strategies/reorder/greedy_improvement.d.ts.map +1 -1
- package/build/core/strategies/reorder/greedy_improvement.js +3 -2
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts +10 -0
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts.map +1 -0
- package/build/core/strategies/reorder/is_improving_greedy_trial.js +17 -0
- package/build/core/strategies/reorder/select_surviving_beam.d.ts +11 -0
- package/build/core/strategies/reorder/select_surviving_beam.d.ts.map +1 -0
- package/build/core/strategies/reorder/select_surviving_beam.js +13 -0
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts +37 -3
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts.map +1 -1
- package/build/core/validation/contract/cargo_movement_wire_field_map.js +40 -6
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts.map +1 -1
- package/build/core/validation/contract/cargo_movement_wire_mapper.js +10 -1
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts.map +1 -1
- package/build/core/validation/contract/map_contract_to_wire_shape.js +12 -21
- package/build/core/validation/contract/map_input_config.d.ts +9 -0
- package/build/core/validation/contract/map_input_config.d.ts.map +1 -0
- package/build/core/validation/contract/map_input_config.js +40 -0
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts.map +1 -1
- package/build/core/validation/contract/map_wire_input_to_contract_shape.js +28 -22
- package/build/core/validation/contract/map_wire_item_stacking.d.ts +7 -0
- package/build/core/validation/contract/map_wire_item_stacking.d.ts.map +1 -0
- package/build/core/validation/contract/map_wire_item_stacking.js +40 -0
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts +1 -5
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts.map +1 -1
- package/build/core/validation/contract/map_wire_item_to_contract.js +16 -14
- package/build/core/validation/contract/parse_stabilizer_input.d.ts +49 -7
- package/build/core/validation/contract/parse_stabilizer_input.d.ts.map +1 -1
- package/build/core/validation/contract/parse_stabilizer_input.js +2 -0
- package/build/core/validation/contract/parse_stabilizer_output.d.ts +34 -5
- package/build/core/validation/contract/parse_stabilizer_output.d.ts.map +1 -1
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts +6 -0
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts.map +1 -0
- package/build/core/validation/contract/reject_forbidden_input_fields.js +53 -0
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts +36 -65
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts.map +1 -1
- package/build/core/validation/contract/stabilizer_domain_schema.js +16 -38
- package/build/core/validation/contract/stabilizer_env_schema.d.ts +112 -0
- package/build/core/validation/contract/stabilizer_env_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_env_schema.js +38 -0
- package/build/core/validation/contract/stabilizer_input_schema.d.ts +51 -7
- package/build/core/validation/contract/stabilizer_input_schema.d.ts.map +1 -1
- package/build/core/validation/contract/stabilizer_input_schema.js +2 -2
- package/build/core/validation/contract/stabilizer_item_schema.d.ts +25 -0
- package/build/core/validation/contract/stabilizer_item_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_item_schema.js +23 -0
- package/build/core/validation/contract/stabilizer_output_schema.d.ts +68 -10
- package/build/core/validation/contract/stabilizer_output_schema.d.ts.map +1 -1
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts +14 -0
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts.map +1 -0
- package/build/core/validation/contract/uniquify_contract_item_ids.js +54 -0
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts +2 -1
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts.map +1 -1
- package/build/core/validation/schemas/stabilizer_config_schema.js +2 -1
- package/build/index.d.ts +11 -12
- package/build/index.d.ts.map +1 -1
- package/build/index.js +29 -21
- package/package.json +28 -13
- package/CHANGELOG.md +0 -38
package/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Logger } from '@jetta/logger';
|
|
2
|
-
import {
|
|
2
|
+
import { run_stabilizer_flow } from './core/orchestration/StabilizerFlow.js';
|
|
3
3
|
import { stabilizer_logger } from './core/logging/stabilizer_logger.js';
|
|
4
|
-
import {
|
|
4
|
+
import { parse_stabilizer_input, parse_stabilizer_output } from './core/validation/contract/index.js';
|
|
5
5
|
export { REORDER_STRATEGY, REORDER_STRATEGY_VALUES } from './core/constants/ReorderStrategy.js';
|
|
6
6
|
export { MixedWaypointIdError } from './core/exceptions/MixedWaypointIdError.js';
|
|
7
7
|
export { UnknownReorderStrategyError } from './core/exceptions/UnknownReorderStrategyError.js';
|
|
@@ -11,13 +11,36 @@ export { parse_stabilizer_input, safe_parse_stabilizer_input, parse_stabilizer_o
|
|
|
11
11
|
const messages = [];
|
|
12
12
|
const UNKNOWN_IDENTITY = 'UNKNOWN';
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Parses unknown wire or English input, then runs the typed stabilizer.
|
|
15
15
|
* @param input - Cargo-movement wire payload or English contract input.
|
|
16
|
-
* @returns Success or error response with
|
|
16
|
+
* @returns Success or error response with typed cargo_state on success.
|
|
17
17
|
*/
|
|
18
18
|
export async function stabilize(input) {
|
|
19
19
|
const identity = read_stabilizer_identity(input);
|
|
20
|
-
return Logger.run_with_cargo_info(identity.company, identity.cargo_id, () =>
|
|
20
|
+
return Logger.run_with_cargo_info(identity.company, identity.cargo_id, () => {
|
|
21
|
+
try {
|
|
22
|
+
return run_stabilize(parse_stabilizer_input(input));
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return build_error_response(error);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
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) {
|
|
35
|
+
stabilizer_logger.log('cargo-stabilizer started');
|
|
36
|
+
try {
|
|
37
|
+
const cargo_state = run_stabilizer_flow(input);
|
|
38
|
+
stabilizer_logger.log('cargo-stabilizer finished successfully');
|
|
39
|
+
return build_success_response(cargo_state);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return build_error_response(error);
|
|
43
|
+
}
|
|
21
44
|
}
|
|
22
45
|
function read_stabilizer_identity(input) {
|
|
23
46
|
if (typeof input !== 'object' || input === null) {
|
|
@@ -29,17 +52,6 @@ function read_stabilizer_identity(input) {
|
|
|
29
52
|
cargo_id: record.id !== undefined ? String(record.id) : UNKNOWN_IDENTITY
|
|
30
53
|
};
|
|
31
54
|
}
|
|
32
|
-
function run_stabilize(input) {
|
|
33
|
-
stabilizer_logger.log('cargo-stabilizer started');
|
|
34
|
-
try {
|
|
35
|
-
const cargo_state = run_stabilizer_flow_from_unknown(input);
|
|
36
|
-
stabilizer_logger.log('cargo-stabilizer finished successfully');
|
|
37
|
-
return build_success_response(cargo_state);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
return build_error_response(error);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
55
|
function build_success_response(cargo_state) {
|
|
44
56
|
const english_response = {
|
|
45
57
|
status: 'success',
|
|
@@ -50,11 +62,7 @@ function build_success_response(cargo_state) {
|
|
|
50
62
|
if (validated.status !== 'success') {
|
|
51
63
|
throw new Error('Expected success response after stabilizer flow');
|
|
52
64
|
}
|
|
53
|
-
return
|
|
54
|
-
status: 'success',
|
|
55
|
-
data: map_contract_to_wire_output(validated.data),
|
|
56
|
-
messages: validated.messages
|
|
57
|
-
};
|
|
65
|
+
return validated;
|
|
58
66
|
}
|
|
59
67
|
function build_error_response(err) {
|
|
60
68
|
stabilizer_logger.warn('cargo-stabilizer finished with error');
|
package/package.json
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetta/cargo-stabilizer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
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",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./build/index.d.ts",
|
|
12
|
+
"default": "./build/index.js"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
8
16
|
"engines": {
|
|
9
17
|
"node": ">=24"
|
|
10
18
|
},
|
|
11
19
|
"files": [
|
|
12
20
|
"build"
|
|
13
21
|
],
|
|
22
|
+
"private": false,
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
14
26
|
"scripts": {
|
|
15
27
|
"audit": "npm audit --omit=dev",
|
|
16
28
|
"preversion": "git fetch --prune --tags",
|
|
17
|
-
"version": "npm run build",
|
|
29
|
+
"version": "npm run build && npm run lint:package",
|
|
30
|
+
"prepack": "npm run build && npm run lint:package",
|
|
18
31
|
"postversion": "git push origin HEAD --follow-tags",
|
|
19
32
|
"publish:alpha": "npm version --tag-version-prefix=alpha-v",
|
|
20
33
|
"publish:stable": "npm version",
|
|
@@ -29,23 +42,25 @@
|
|
|
29
42
|
"coverage:ci": "c8 --reporter=text --reporter=text-summary --check-coverage --lines 75 --functions 75 --branches 75 --statements 75 npm run test"
|
|
30
43
|
},
|
|
31
44
|
"dependencies": {
|
|
32
|
-
"@jetta/axle-load-calculator": "^0.
|
|
33
|
-
"@jetta/cargo-stability": "^2.0.
|
|
34
|
-
"@jetta/empty-spaces-manager": "^0.1.1
|
|
45
|
+
"@jetta/axle-load-calculator": "^0.3.3",
|
|
46
|
+
"@jetta/cargo-stability": "^2.0.2",
|
|
47
|
+
"@jetta/empty-spaces-manager": "^0.1.1",
|
|
48
|
+
"@jetta/number-compare": "^3.0.3",
|
|
49
|
+
"@jetta/stacking-constraints": "^1.1.0",
|
|
35
50
|
"zod": "^4.4.3"
|
|
36
51
|
},
|
|
37
52
|
"devDependencies": {
|
|
38
53
|
"@types/chai": "^5.2.3",
|
|
39
54
|
"@types/mocha": "^10.0.10",
|
|
40
|
-
"@types/node": "^
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
42
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
-
"c8": "^
|
|
55
|
+
"@types/node": "^26.3.0",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^8.68.0",
|
|
57
|
+
"@typescript-eslint/parser": "^8.68.0",
|
|
58
|
+
"c8": "^12.0.0",
|
|
44
59
|
"chai": "^6.2.2",
|
|
45
|
-
"eslint": "^9.
|
|
46
|
-
"mocha": "^11.
|
|
47
|
-
"publint": "^0.3.
|
|
48
|
-
"tsx": "^4.
|
|
60
|
+
"eslint": "^10.9.1",
|
|
61
|
+
"mocha": "^11.8.0",
|
|
62
|
+
"publint": "^0.3.24",
|
|
63
|
+
"tsx": "^4.23.12",
|
|
49
64
|
"typescript": "^6.0.3"
|
|
50
65
|
}
|
|
51
66
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to `@jetta/cargo-stabilizer` are documented in this file.
|
|
4
|
-
|
|
5
|
-
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
-
|
|
7
|
-
## [Unreleased]
|
|
8
|
-
|
|
9
|
-
### Added
|
|
10
|
-
|
|
11
|
-
- Strict English internal I/O contract with bidirectional cargo-movement wire mapper (`map_wire_input_to_contract`, `map_contract_to_wire_output`).
|
|
12
|
-
- Organization gates: waypoint Z zones, macro delivery order (`preserve_tie_block_organization`), and milkrun wall reservation (`enforce_milkrun_wall_reservation`).
|
|
13
|
-
- Empty-space candidate discovery for floor and elevated slots via `@jetta/empty-spaces-manager`.
|
|
14
|
-
- Supporter-top candidate slots aligned to each stacked item footprint, included in beam expansion (`top_k ∪ supporter_top`).
|
|
15
|
-
- Elevated candidates must sit on a supporter `(x, z)` origin so stacked loose items copy the supporter footprint.
|
|
16
|
-
- Public contract exports: `parse_stabilizer_input`, `parse_stabilizer_output`, `safe_parse_stabilizer_input`, `safe_parse_stabilizer_output`, and related domain types.
|
|
17
|
-
|
|
18
|
-
### Changed
|
|
19
|
-
|
|
20
|
-
- README documents I/O contract mapping, configuration keys, dependencies, and test/coverage commands.
|
|
21
|
-
- Reorder objective is whole-cargo `transport_score`; loose-item score sum is only a tie-break. Axle, waypoint, and milkrun gates are unchanged.
|
|
22
|
-
|
|
23
|
-
### Testing
|
|
24
|
-
|
|
25
|
-
- Expanded Mocha suite to 126 tests mirroring `src/` under `test/src/`.
|
|
26
|
-
- Local coverage gate at 80% on lines, functions, branches, and statements (`npm run coverage`).
|
|
27
|
-
- CI coverage gate at 75% (`npm run coverage:ci`).
|
|
28
|
-
- Mocha setup preloads core modules so c8 attributes coverage consistently across the full suite.
|
|
29
|
-
|
|
30
|
-
## [0.1.0-3] - 2026-08-14
|
|
31
|
-
|
|
32
|
-
### Added
|
|
33
|
-
|
|
34
|
-
- Initial library scaffold (JET-2262).
|
|
35
|
-
- Five config-selectable reorder strategies: gravity, greedy, beam search, simulated annealing, genetic.
|
|
36
|
-
- Zod-validated input contract with `waypoint_id` rules and multi-container support.
|
|
37
|
-
- Shared evaluator: cargo-stability transport gate, axle-load-calculator folga gate, waypoint order.
|
|
38
|
-
- Public `stabilize()` API compatible with cargo-movement legacy response shape.
|