@burdenoff/microfe-movethewheels 2026.1107.6 → 2026.1107.7

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.
@@ -451,6 +451,27 @@ export type MtwAssignmentSuggestions = {
451
451
  routeId: Scalars['ID']['output'];
452
452
  vehicles: Array<MtwVehicleSuggestion>;
453
453
  };
454
+ export type MtwCapacityBasis = {
455
+ __typename?: 'MtwCapacityBasis';
456
+ /** Vehicles with status ACTIVE or IN_TRANSIT. */
457
+ activeVehicles: Scalars['Int']['output'];
458
+ /** Null when the capacity is unknown. */
459
+ jobsPerVehiclePerWeek?: Maybe<Scalars['Float']['output']>;
460
+ laneShareBasis: MtwLaneShareBasis;
461
+ /** Vehicles whose job history the observed throughput rests on. */
462
+ observedVehicles: Scalars['Int']['output'];
463
+ source: MtwCapacitySource;
464
+ /** activeVehicles x jobsPerVehiclePerWeek, before any scenario capacity change. Null when unknown. */
465
+ weeklyFleetCapacity?: Maybe<Scalars['Float']['output']>;
466
+ };
467
+ /** Where the jobs-per-vehicle-per-week figure behind the fleet capacity comes from. */
468
+ export type MtwCapacitySource =
469
+ /** Observed: the median across vehicles of each vehicle's busiest closed week in the last 12 weeks. */
470
+ 'OBSERVED'
471
+ /** Supplied by the caller in jobsPerVehiclePerWeek. */
472
+ | 'OVERRIDE'
473
+ /** No vehicle-assigned jobs in the history and no override: capacity is unknown. */
474
+ | 'UNKNOWN';
454
475
  /**
455
476
  * MoveTheWheels-owned cargo/item master used for warehouse inventory and shipment payloads.
456
477
  * This is not a sellable storefront product; commerce SKUs must live in global-store-svc
@@ -1229,6 +1250,42 @@ export type MtwDemandForecastVariance = {
1229
1250
  scopeType: DemandForecastScope;
1230
1251
  volumeVariance: Scalars['Int']['output'];
1231
1252
  };
1253
+ export type MtwDemandScenarioComparison = {
1254
+ __typename?: 'MtwDemandScenarioComparison';
1255
+ /** The forecast with no changes, compared against current capacity. */
1256
+ baseline: MtwScenarioResult;
1257
+ capacity: MtwCapacityBasis;
1258
+ generatedAt: Scalars['DateTime']['output'];
1259
+ /** One result per input scenario, in input order. */
1260
+ scenarios: Array<MtwScenarioResult>;
1261
+ weeks: Scalars['Int']['output'];
1262
+ };
1263
+ export type MtwDemandScenarioComparisonInput = {
1264
+ /** Jobs one available vehicle handles per week. When omitted the throughput observed over the last 12 closed weeks is used. */
1265
+ jobsPerVehiclePerWeek?: InputMaybe<Scalars['Float']['input']>;
1266
+ /** Up to 4 scenarios to compare side by side with the baseline. An empty list gives the baseline capacity-vs-demand view. */
1267
+ scenarios?: InputMaybe<Array<MtwDemandScenarioInput>>;
1268
+ /** Forecast weeks to compare, starting this ISO week. Clamped to 1..12, like the forecast queries. */
1269
+ weeks?: InputMaybe<Scalars['Int']['input']>;
1270
+ };
1271
+ export type MtwDemandScenarioInput = {
1272
+ /** Fleet capacity change in percent, from -100 to 500 (for example +20 for two extra trucks on a fleet of ten). */
1273
+ capacityChangePct?: InputMaybe<Scalars['Float']['input']>;
1274
+ /** Lane keys to close (at most 200). A closed lane carries no demand; what it would have carried is reported as lost. */
1275
+ closedLanes?: InputMaybe<Array<Scalars['String']['input']>>;
1276
+ /** Demand change on every lane in percent, from -100 to 500. */
1277
+ demandChangePct?: InputMaybe<Scalars['Float']['input']>;
1278
+ /** Per-lane demand changes (at most 200). */
1279
+ laneAdjustments?: InputMaybe<Array<MtwDemandScenarioLaneAdjustmentInput>>;
1280
+ /** Unique within the comparison, 1 to 80 characters; "Baseline" is reserved for the unchanged forecast. */
1281
+ name: Scalars['String']['input'];
1282
+ };
1283
+ export type MtwDemandScenarioLaneAdjustmentInput = {
1284
+ /** Demand change on this lane in percent, from -100 to 500, applied on top of the scenario-wide change. */
1285
+ demandChangePct: Scalars['Float']['input'];
1286
+ /** Lane key as returned in MtwDemandForecastPoint.scopeKey (Origin->Destination). */
1287
+ laneKey: Scalars['String']['input'];
1288
+ };
1232
1289
  /** One proposed shipment -> vehicle + driver pairing. */
1233
1290
  export type MtwDispatchAssignment = {
1234
1291
  __typename?: 'MtwDispatchAssignment';
@@ -2592,6 +2649,14 @@ export type MtwInventoryTransferResult = {
2592
2649
  destination: MtwInventoryItem;
2593
2650
  source: MtwInventoryItem;
2594
2651
  };
2652
+ /** How the fleet capacity is divided between lanes. */
2653
+ export type MtwLaneShareBasis =
2654
+ /** No vehicle-assigned history: capacity follows each lane's share of the baseline forecast. */
2655
+ 'DEMAND_SHARE'
2656
+ /** Capacity is unknown, or there is no demand to divide it by. */
2657
+ | 'NONE'
2658
+ /** Each lane's share of the vehicle-assigned jobs in the last 12 closed weeks. */
2659
+ | 'VEHICLE_HISTORY';
2595
2660
  export type MtwMarketplaceStats = {
2596
2661
  __typename?: 'MtwMarketplaceStats';
2597
2662
  activeProviders: Scalars['Int']['output'];
@@ -3620,6 +3685,68 @@ export type MtwRunScheduledReportsInput = {
3620
3685
  idempotencyKey?: InputMaybe<Scalars['String']['input']>;
3621
3686
  triggerData?: InputMaybe<Scalars['JSON']['input']>;
3622
3687
  };
3688
+ export type MtwScenarioLaneResult = {
3689
+ __typename?: 'MtwScenarioLaneResult';
3690
+ baselineRevenue: Scalars['Float']['output'];
3691
+ /** Totals over the compared weeks. */
3692
+ baselineVolume: Scalars['Int']['output'];
3693
+ /** Own-fleet capacity for this lane over the compared weeks. Null when unknown or when no fleet share is observed on the lane. */
3694
+ capacity?: Maybe<Scalars['Float']['output']>;
3695
+ closed: Scalars['Boolean']['output'];
3696
+ /** The lane-specific demand change applied in this scenario. */
3697
+ demandChangePct: Scalars['Float']['output'];
3698
+ /** Demand exceeds the lane's capacity in at least one week. */
3699
+ flagged: Scalars['Boolean']['output'];
3700
+ laneKey: Scalars['String']['output'];
3701
+ laneLabel: Scalars['String']['output'];
3702
+ lostRevenue: Scalars['Float']['output'];
3703
+ lostVolume: Scalars['Int']['output'];
3704
+ scenarioRevenue: Scalars['Float']['output'];
3705
+ scenarioVolume: Scalars['Int']['output'];
3706
+ /** Scenario volume above the lane's capacity, summed week by week. */
3707
+ shortfall: Scalars['Float']['output'];
3708
+ };
3709
+ export type MtwScenarioResult = {
3710
+ __typename?: 'MtwScenarioResult';
3711
+ capacityChangePct: Scalars['Float']['output'];
3712
+ /** Closed lanes the forecast knows. */
3713
+ closedLanes: Array<Scalars['String']['output']>;
3714
+ demandChangePct: Scalars['Float']['output'];
3715
+ /** Lanes ordered by shortfall, then scenario volume. */
3716
+ lanes: Array<MtwScenarioLaneResult>;
3717
+ lostRevenue: Scalars['Float']['output'];
3718
+ lostVolume: Scalars['Int']['output'];
3719
+ name: Scalars['String']['output'];
3720
+ revenueDelta: Scalars['Float']['output'];
3721
+ /** Lanes flagged for a shortfall. */
3722
+ shortfallLanes: Scalars['Int']['output'];
3723
+ /** Fleet capacity over the compared weeks. Null when unknown. */
3724
+ totalCapacity?: Maybe<Scalars['Float']['output']>;
3725
+ totalRevenue: Scalars['Float']['output'];
3726
+ /** Weekly fleet shortfalls summed over the compared weeks. */
3727
+ totalShortfall: Scalars['Float']['output'];
3728
+ totalVolume: Scalars['Int']['output'];
3729
+ /** Lane keys named in the scenario that have no forecast; they change nothing. */
3730
+ unknownLanes: Array<Scalars['String']['output']>;
3731
+ /** totalVolume / totalCapacity. Null without a positive capacity. */
3732
+ utilization?: Maybe<Scalars['Float']['output']>;
3733
+ /** totalVolume minus the baseline's. */
3734
+ volumeDelta: Scalars['Int']['output'];
3735
+ weeks: Array<MtwScenarioWeekResult>;
3736
+ };
3737
+ export type MtwScenarioWeekResult = {
3738
+ __typename?: 'MtwScenarioWeekResult';
3739
+ baselineRevenue: Scalars['Float']['output'];
3740
+ baselineVolume: Scalars['Int']['output'];
3741
+ /** Fleet capacity for the week after the scenario's capacity change. Null when unknown. */
3742
+ capacity?: Maybe<Scalars['Float']['output']>;
3743
+ periodEnd: Scalars['DateTime']['output'];
3744
+ periodStart: Scalars['DateTime']['output'];
3745
+ scenarioRevenue: Scalars['Float']['output'];
3746
+ scenarioVolume: Scalars['Int']['output'];
3747
+ /** Scenario volume above capacity; 0 when capacity is unknown. */
3748
+ shortfall: Scalars['Float']['output'];
3749
+ };
3623
3750
  /** Outcome of one scheduled-reports fire. */
3624
3751
  export type MtwScheduledReportsRun = {
3625
3752
  __typename?: 'MtwScheduledReportsRun';
@@ -3773,6 +3900,118 @@ export type MtwShipmentLegsArgs = {
3773
3900
  export type MtwShipmentTrackingEventsArgs = {
3774
3901
  pagination?: InputMaybe<PaginationInput>;
3775
3902
  };
3903
+ export type MtwShipmentDecision = {
3904
+ __typename?: 'MtwShipmentDecision';
3905
+ /** Provider-qualified model that wrote the rationale, when one did. */
3906
+ aiModel?: Maybe<Scalars['String']['output']>;
3907
+ aiStatus: MtwDecisionRationaleStatus;
3908
+ aiSummary?: Maybe<Scalars['String']['output']>;
3909
+ breached?: Maybe<Scalars['Boolean']['output']>;
3910
+ chosenOptionId?: Maybe<Scalars['ID']['output']>;
3911
+ createdAt: Scalars['DateTime']['output'];
3912
+ createdBy: Scalars['String']['output'];
3913
+ /** The shipment's carrier when the proposal was made. */
3914
+ currentCarrierId?: Maybe<Scalars['String']['output']>;
3915
+ decidedAt?: Maybe<Scalars['DateTime']['output']>;
3916
+ decidedBy?: Maybe<Scalars['String']['output']>;
3917
+ decisionReason?: Maybe<Scalars['String']['output']>;
3918
+ expiresAt: Scalars['DateTime']['output'];
3919
+ /** Carrier recommendation: delivered shipments the ranking looked at. */
3920
+ historyCount?: Maybe<Scalars['Int']['output']>;
3921
+ id: Scalars['ID']['output'];
3922
+ kind: MtwShipmentDecisionKind;
3923
+ /** Carrier recommendation: whether the shipment had an origin and destination to match a lane on. */
3924
+ laneKnown?: Maybe<Scalars['Boolean']['output']>;
3925
+ /** The deterministic ranker that produced the options. */
3926
+ method: Scalars['String']['output'];
3927
+ /** Ranked options, best first. Empty when there is nothing to recommend (no carrier history yet). */
3928
+ options: Array<MtwShipmentDecisionOption>;
3929
+ outcome?: Maybe<MtwShipmentDecisionOutcome>;
3930
+ predictedSlipMinutes?: Maybe<Scalars['Int']['output']>;
3931
+ /** The shipment's promised delivery when the proposal was made. */
3932
+ promisedDelivery?: Maybe<Scalars['DateTime']['output']>;
3933
+ riskLevel?: Maybe<Scalars['String']['output']>;
3934
+ /** Exception remediation: the forecast the options were ranked from. */
3935
+ riskScore?: Maybe<Scalars['Int']['output']>;
3936
+ shipmentId: Scalars['ID']['output'];
3937
+ shipmentNumber?: Maybe<Scalars['String']['output']>;
3938
+ signals: Array<Scalars['String']['output']>;
3939
+ status: MtwShipmentDecisionStatus;
3940
+ };
3941
+ export type MtwShipmentDecisionAction =
3942
+ /** Keep the shipment as it is and accept the delay. */
3943
+ 'ACCEPT_SLIP'
3944
+ /** Move the shipment's order to another vehicle (follow-up on the order). */
3945
+ | 'REASSIGN_VEHICLE'
3946
+ /** Move the promised delivery to the predicted time. */
3947
+ | 'REPROMISE_DELIVERY'
3948
+ /** Get a fresh tracking update from the driver or carrier (follow-up). */
3949
+ | 'REQUEST_TRACKING_UPDATE'
3950
+ /** Hand the not-yet-collected shipment to a carrier with a better record on its lane. */
3951
+ | 'SWITCH_CARRIER'
3952
+ /** Use this carrier for the shipment. */
3953
+ | 'USE_CARRIER';
3954
+ export type MtwShipmentDecisionExecution =
3955
+ /** Accepting changes the shipment. */
3956
+ 'APPLY'
3957
+ /** Accepting records the decision; followUpMutation names the manual step that carries it out. */
3958
+ | 'FOLLOW_UP'
3959
+ /** Accepting only records the decision. */
3960
+ | 'RECORD';
3961
+ export type MtwShipmentDecisionKind = 'CARRIER_RECOMMENDATION' | 'EXCEPTION_REMEDIATION';
3962
+ /** One ranked option of a shipment decision. */
3963
+ export type MtwShipmentDecisionOption = {
3964
+ __typename?: 'MtwShipmentDecisionOption';
3965
+ action: MtwShipmentDecisionAction;
3966
+ /** Model-written rationale, when AI produced one. */
3967
+ aiRationale?: Maybe<Scalars['String']['output']>;
3968
+ /** The carrier accepting assigns (USE_CARRIER, SWITCH_CARRIER). */
3969
+ carrierId?: Maybe<Scalars['String']['output']>;
3970
+ /** Ranker confidence from 0 to 1, from how much evidence the option stands on. Not a probability of success. */
3971
+ confidence: Scalars['Float']['output'];
3972
+ currency?: Maybe<Scalars['String']['output']>;
3973
+ /** Delivered shipments of this carrier in the history window (carrier options). */
3974
+ deliveredCount?: Maybe<Scalars['Int']['output']>;
3975
+ execution: MtwShipmentDecisionExecution;
3976
+ /** Arguments for followUpMutation, e.g. the delivery job or shipment id. */
3977
+ followUpArgs?: Maybe<Scalars['JSON']['output']>;
3978
+ /** The existing mutation that carries out a FOLLOW_UP option. */
3979
+ followUpMutation?: Maybe<Scalars['String']['output']>;
3980
+ id: Scalars['ID']['output'];
3981
+ /** Delivered shipments of this carrier on this shipment's lane. */
3982
+ laneDeliveredCount?: Maybe<Scalars['Int']['output']>;
3983
+ laneOnTimeCount?: Maybe<Scalars['Int']['output']>;
3984
+ /** Median recorded freight cost of this carrier on the lane, in currency. */
3985
+ medianLaneCost?: Maybe<Scalars['Float']['output']>;
3986
+ /** The promised delivery accepting sets (REPROMISE_DELIVERY). */
3987
+ newEstimatedDelivery?: Maybe<Scalars['DateTime']['output']>;
3988
+ onTimeCount?: Maybe<Scalars['Int']['output']>;
3989
+ rank: Scalars['Int']['output'];
3990
+ /** The ranker's own factual rationale. */
3991
+ rationale: Scalars['String']['output'];
3992
+ /** Reason codes, e.g. LANE_HISTORY, ON_TIME_STRONG, LOWEST_LANE_COST, PREDICTED_SLIP, TRACKING_STALE. */
3993
+ reasons: Array<Scalars['String']['output']>;
3994
+ /** Carrier ranking score from 0 to 1 (carrier options only). */
3995
+ score?: Maybe<Scalars['Float']['output']>;
3996
+ };
3997
+ export type MtwShipmentDecisionOutcome =
3998
+ /** The shipment was changed. */
3999
+ 'APPLIED'
4000
+ /** The decision was recorded; the follow-up step is still to be done. */
4001
+ | 'FOLLOW_UP'
4002
+ /** The decision was recorded; nothing on the shipment changed. */
4003
+ | 'RECORDED';
4004
+ export type MtwShipmentDecisionStatus =
4005
+ /** An option was accepted; outcome says what that did. */
4006
+ 'ACCEPTED'
4007
+ /** Superseded by a newer proposal or past its expiry without a decision. */
4008
+ | 'EXPIRED'
4009
+ /** Waiting for a decision. */
4010
+ | 'PROPOSED'
4011
+ /** Rejected; nothing on the shipment changed. */
4012
+ | 'REJECTED'
4013
+ /** An option was accepted but the shipment had changed since the proposal; decisionReason says how. Nothing was changed. */
4014
+ | 'STALE';
3776
4015
  export type MtwShipmentLeg = {
3777
4016
  __typename?: 'MtwShipmentLeg';
3778
4017
  actualArrival?: Maybe<Scalars['DateTime']['output']>;
@@ -4509,6 +4748,13 @@ export type Mutation = {
4509
4748
  importMtwDrivers: MtwImportResult;
4510
4749
  importMtwVehicles: MtwImportResult;
4511
4750
  importMtwWarehouses: MtwImportResult;
4751
+ /**
4752
+ * Accept one option of an open decision. An APPLY option changes the shipment
4753
+ * (carrier or promised delivery); FOLLOW_UP and RECORD options only record the
4754
+ * decision. When the shipment changed since the proposal the decision is marked
4755
+ * STALE and nothing is changed.
4756
+ */
4757
+ mtwAcceptShipmentDecision: MtwShipmentDecision;
4512
4758
  /**
4513
4759
  * Accept the listed assignments of an open plan and reject the rest. One PLANNED
4514
4760
  * route is created per accepted assignment, through the normal route checks.
@@ -4535,8 +4781,22 @@ export type Mutation = {
4535
4781
  * expires any older open one.
4536
4782
  */
4537
4783
  mtwPlanDispatch: MtwDispatchPlan;
4784
+ /**
4785
+ * Rank the workspace's carriers for a PLANNED shipment's lane from its own
4786
+ * delivery history. Proposal only: the shipment's carrier is unchanged until an
4787
+ * option is accepted. A newer proposal expires the shipment's open one.
4788
+ */
4789
+ mtwRecommendCarrier: MtwShipmentDecision;
4538
4790
  /** Reject every assignment of an open plan. Writes no route or delivery job. */
4539
4791
  mtwRejectDispatchPlan: MtwDispatchPlan;
4792
+ /** Reject every option of an open decision. Nothing on the shipment changes. */
4793
+ mtwRejectShipmentDecision: MtwShipmentDecision;
4794
+ /**
4795
+ * Rank remediations for a shipment its risk forecast says is late or at risk.
4796
+ * Proposal only: nothing on the shipment changes until an option is accepted.
4797
+ * Refused when the shipment is neither at risk nor past its promise.
4798
+ */
4799
+ mtwResolveException: MtwShipmentDecision;
4540
4800
  /**
4541
4801
  * Re-forecast every in-flight shipment of the workspace and notify for any that
4542
4802
  * started slipping. Fired by wspace-scheduler-svc as this service's own service
@@ -4772,6 +5032,10 @@ export type MutationImportMtwVehiclesArgs = {
4772
5032
  export type MutationImportMtwWarehousesArgs = {
4773
5033
  input: MtwImportInput;
4774
5034
  };
5035
+ export type MutationMtwAcceptShipmentDecisionArgs = {
5036
+ decisionId: Scalars['ID']['input'];
5037
+ optionId: Scalars['ID']['input'];
5038
+ };
4775
5039
  export type MutationMtwApplyDispatchPlanArgs = {
4776
5040
  accept: Array<Scalars['ID']['input']>;
4777
5041
  planId: Scalars['ID']['input'];
@@ -4782,9 +5046,18 @@ export type MutationMtwNarrateShipmentRiskForecastArgs = {
4782
5046
  export type MutationMtwPlanDispatchArgs = {
4783
5047
  input?: InputMaybe<MtwPlanDispatchInput>;
4784
5048
  };
5049
+ export type MutationMtwRecommendCarrierArgs = {
5050
+ shipmentId: Scalars['ID']['input'];
5051
+ };
4785
5052
  export type MutationMtwRejectDispatchPlanArgs = {
4786
5053
  planId: Scalars['ID']['input'];
4787
5054
  };
5055
+ export type MutationMtwRejectShipmentDecisionArgs = {
5056
+ decisionId: Scalars['ID']['input'];
5057
+ };
5058
+ export type MutationMtwResolveExceptionArgs = {
5059
+ shipmentId: Scalars['ID']['input'];
5060
+ };
4788
5061
  export type MutationMtwRunRiskSweepArgs = {
4789
5062
  input?: InputMaybe<MtwRunRiskSweepInput>;
4790
5063
  };
@@ -5089,6 +5362,8 @@ export type Query = {
5089
5362
  /** Null until the workspace's forecast has been calculated once. */
5090
5363
  demandForecastRunStatus?: Maybe<MtwDemandForecastRunStatus>;
5091
5364
  demandForecastVariance: Array<MtwDemandForecastVariance>;
5365
+ /** Compare what-if scenarios on the lane forecast side by side, each against fleet capacity. */
5366
+ demandScenarioComparison: MtwDemandScenarioComparison;
5092
5367
  driver?: Maybe<MtwDriver>;
5093
5368
  drivers: Array<MtwDriver>;
5094
5369
  driversCount: Scalars['Int']['output'];
@@ -5170,6 +5445,8 @@ export type Query = {
5170
5445
  mtwImportSpec: Array<MtwImportEntitySpec>;
5171
5446
  /** The workspace's most recent dispatch plan, whatever its status. */
5172
5447
  mtwLatestDispatchPlan?: Maybe<MtwDispatchPlan>;
5448
+ /** The shipment's most recent decision of this kind, whatever its status. */
5449
+ mtwLatestShipmentDecision?: Maybe<MtwShipmentDecision>;
5173
5450
  /** The workspace's MoveTheWheels operational defaults; platform defaults when none were saved. */
5174
5451
  mtwModuleSettings: MtwModuleSettings;
5175
5452
  mtwPalletGeometryPreview: MtwPalletGeometryPreview;
@@ -5201,6 +5478,7 @@ export type Query = {
5201
5478
  mtwRiskSweepSchedule?: Maybe<MtwRiskSweepSchedule>;
5202
5479
  /** Recent risk sweeps of the workspace, newest first. */
5203
5480
  mtwRiskSweeps: Array<MtwRiskSweep>;
5481
+ mtwShipmentDecision?: Maybe<MtwShipmentDecision>;
5204
5482
  /** The shipment's current or last risk episode, or null if it has never been at risk. */
5205
5483
  mtwShipmentRiskEpisode?: Maybe<MtwShipmentRiskEpisode>;
5206
5484
  mtwShipmentRiskForecast: MtwRiskForecast;
@@ -5309,6 +5587,9 @@ export type QueryDemandForecastVarianceArgs = {
5309
5587
  limit?: InputMaybe<Scalars['Int']['input']>;
5310
5588
  scopeType: DemandForecastScope;
5311
5589
  };
5590
+ export type QueryDemandScenarioComparisonArgs = {
5591
+ input?: InputMaybe<MtwDemandScenarioComparisonInput>;
5592
+ };
5312
5593
  export type QueryDriverArgs = {
5313
5594
  id: Scalars['ID']['input'];
5314
5595
  };
@@ -5510,6 +5791,10 @@ export type QueryMtwFreightInvoiceReviewPageArgs = {
5510
5791
  shipmentId?: InputMaybe<Scalars['ID']['input']>;
5511
5792
  status?: InputMaybe<MtwFreightInvoiceReviewStatus>;
5512
5793
  };
5794
+ export type QueryMtwLatestShipmentDecisionArgs = {
5795
+ kind: MtwShipmentDecisionKind;
5796
+ shipmentId: Scalars['ID']['input'];
5797
+ };
5513
5798
  export type QueryMtwPalletGeometryPreviewArgs = {
5514
5799
  input: MtwPalletGeometryPreviewInput;
5515
5800
  };
@@ -5596,6 +5881,9 @@ export type QueryMtwReuseReservationTransitionPageArgs = {
5596
5881
  export type QueryMtwRiskSweepsArgs = {
5597
5882
  pagination?: InputMaybe<PaginationInput>;
5598
5883
  };
5884
+ export type QueryMtwShipmentDecisionArgs = {
5885
+ id: Scalars['ID']['input'];
5886
+ };
5599
5887
  export type QueryMtwShipmentRiskEpisodeArgs = {
5600
5888
  shipmentId: Scalars['ID']['input'];
5601
5889
  };
@@ -0,0 +1,111 @@
1
+ import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
2
+ import { executeGraphQL as t } from "../utils/graphqlClient.js";
3
+ import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
4
+ //#region src/movethewheels/hooks/useShipmentDecision.ts
5
+ var o = "\n id\n kind\n shipmentId\n shipmentNumber\n status\n method\n options {\n id\n rank\n action\n execution\n confidence\n score\n reasons\n rationale\n aiRationale\n carrierId\n newEstimatedDelivery\n followUpMutation\n followUpArgs\n deliveredCount\n onTimeCount\n laneDeliveredCount\n laneOnTimeCount\n medianLaneCost\n currency\n }\n chosenOptionId\n outcome\n decisionReason\n currentCarrierId\n promisedDelivery\n riskScore\n predictedSlipMinutes\n breached\n laneKnown\n historyCount\n aiStatus\n aiSummary\n aiModel\n expiresAt\n decidedAt\n createdAt\n", s = `
6
+ query LatestShipmentDecision($shipmentId: ID!, $kind: MtwShipmentDecisionKind!) {
7
+ mtwLatestShipmentDecision(shipmentId: $shipmentId, kind: $kind) {
8
+ ${o}
9
+ }
10
+ }
11
+ `, c = `
12
+ mutation RecommendCarrier($shipmentId: ID!) {
13
+ mtwRecommendCarrier(shipmentId: $shipmentId) {
14
+ ${o}
15
+ }
16
+ }
17
+ `, l = `
18
+ mutation ResolveException($shipmentId: ID!) {
19
+ mtwResolveException(shipmentId: $shipmentId) {
20
+ ${o}
21
+ }
22
+ }
23
+ `, u = `
24
+ mutation AcceptShipmentDecision($decisionId: ID!, $optionId: ID!) {
25
+ mtwAcceptShipmentDecision(decisionId: $decisionId, optionId: $optionId) {
26
+ ${o}
27
+ }
28
+ }
29
+ `, d = `
30
+ mutation RejectShipmentDecision($decisionId: ID!) {
31
+ mtwRejectShipmentDecision(decisionId: $decisionId) {
32
+ ${o}
33
+ }
34
+ }
35
+ `;
36
+ function f(o, f) {
37
+ let { apiGatewayUrl: p, authToken: m, workspaceToken: h, workspaceId: g, tenantId: _, currentUser: v } = e(), y = i(() => ({
38
+ apiGatewayUrl: p,
39
+ authToken: m,
40
+ workspaceToken: h,
41
+ workspaceId: g,
42
+ tenantId: _,
43
+ actorId: v?.id
44
+ }), [
45
+ p,
46
+ m,
47
+ h,
48
+ g,
49
+ _,
50
+ v?.id
51
+ ]), [b, x] = a(null), [S, C] = a(!1), [w, T] = a(null), [E, D] = a(null), O = n(async (e) => {
52
+ if (o) {
53
+ C(!0), T(null);
54
+ try {
55
+ let n = await t({
56
+ ...y,
57
+ signal: e
58
+ }, s, {
59
+ shipmentId: o,
60
+ kind: f
61
+ });
62
+ if (e?.aborted) return;
63
+ x(n.mtwLatestShipmentDecision);
64
+ } catch (t) {
65
+ if (e?.aborted) return;
66
+ T(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to load the decision"));
67
+ } finally {
68
+ e?.aborted || C(!1);
69
+ }
70
+ }
71
+ }, [
72
+ y,
73
+ o,
74
+ f
75
+ ]);
76
+ r(() => {
77
+ let e = new AbortController();
78
+ return x(null), O(e.signal), () => e.abort();
79
+ }, [O]);
80
+ let k = n(async (e, t, n) => {
81
+ D(e);
82
+ try {
83
+ let e = n(await t());
84
+ return x(e), e;
85
+ } catch (e) {
86
+ throw O(), e;
87
+ } finally {
88
+ D(null);
89
+ }
90
+ }, [O]);
91
+ return {
92
+ decision: b,
93
+ isLoading: S,
94
+ error: w,
95
+ pendingAction: E,
96
+ refetch: () => void O(),
97
+ propose: n(() => o ? f === "CARRIER_RECOMMENDATION" ? k("propose", () => t(y, c, { shipmentId: o }, "SINGLE_ATTEMPT"), (e) => e.mtwRecommendCarrier) : k("propose", () => t(y, l, { shipmentId: o }, "SINGLE_ATTEMPT"), (e) => e.mtwResolveException) : Promise.reject(/* @__PURE__ */ Error("No shipment selected")), [
98
+ y,
99
+ f,
100
+ k,
101
+ o
102
+ ]),
103
+ accept: n((e, n) => k("accept", () => t(y, u, {
104
+ decisionId: e,
105
+ optionId: n
106
+ }, "SINGLE_ATTEMPT"), (e) => e.mtwAcceptShipmentDecision), [y, k]),
107
+ reject: n((e) => k("reject", () => t(y, d, { decisionId: e }, "SINGLE_ATTEMPT"), (e) => e.mtwRejectShipmentDecision), [y, k])
108
+ };
109
+ }
110
+ //#endregion
111
+ export { f as useShipmentDecision };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * CarrierRecommendationDialog (BOFF-10908)
3
+ *
4
+ * Carrier recommendation cards for one PLANNED shipment, opened from the
5
+ * dispatch planner when the shipment should go with a carrier rather than the
6
+ * own fleet (no free vehicle, or the dispatcher prefers a carrier). Accepting
7
+ * a card assigns that carrier to the shipment; rejecting changes nothing.
8
+ */
9
+ type Translate = (key: string, fallback: string) => string;
10
+ interface CarrierRecommendationDialogProps {
11
+ shipment: {
12
+ id: string;
13
+ number: string | null;
14
+ } | null;
15
+ onOpenChange: (open: boolean) => void;
16
+ onApplied?: () => void;
17
+ t: Translate;
18
+ }
19
+ export declare function CarrierRecommendationDialog({ shipment, onOpenChange, onApplied, t, }: CarrierRecommendationDialogProps): import('react').JSX.Element;
20
+ export {};
@@ -2,6 +2,8 @@ import { DispatchAssignment } from '../hooks/useDispatchPlan';
2
2
  export type DispatchChoice = 'accept' | 'reject' | null;
3
3
  type Translate = (key: string, fallback: string) => string;
4
4
  export declare function reasonLabel(reason: string, t: Translate): string;
5
+ /** Text colour for a 0..1 confidence; shared by every decision card. */
6
+ export declare function confidenceTone(confidence: number): string;
5
7
  interface DispatchDecisionCardProps {
6
8
  assignment: DispatchAssignment;
7
9
  /** True while the plan can still be decided. */
@@ -10,7 +12,9 @@ interface DispatchDecisionCardProps {
10
12
  disabled: boolean;
11
13
  onChoose: (choice: DispatchChoice) => void;
12
14
  onOpenRoute: (routeId: string) => void;
15
+ /** When set, an open card also offers a carrier recommendation for its shipment. */
16
+ onRecommendCarrier?: (shipmentId: string, shipmentNumber: string | null) => void;
13
17
  t: Translate;
14
18
  }
15
- export declare function DispatchDecisionCard({ assignment, open, choice, disabled, onChoose, onOpenRoute, t, }: DispatchDecisionCardProps): import('react').JSX.Element;
19
+ export declare function DispatchDecisionCard({ assignment, open, choice, disabled, onChoose, onOpenRoute, onRecommendCarrier, t, }: DispatchDecisionCardProps): import('react').JSX.Element;
16
20
  export {};
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ import { ShipmentDecision, ShipmentDecisionKind, ShipmentDecisionOption } from '../hooks/useShipmentDecision';
3
+ type Translate = (key: string, fallback: string) => string;
4
+ interface ShipmentDecisionPanelProps {
5
+ shipmentId: string | undefined;
6
+ kind: ShipmentDecisionKind;
7
+ t: Translate;
8
+ /** Called after an accepted option changed the shipment. */
9
+ onApplied?: (decision: ShipmentDecision) => void;
10
+ /** The manual step for an accepted FOLLOW_UP option, rendered under its card. */
11
+ renderFollowUp?: (option: ShipmentDecisionOption) => ReactNode;
12
+ }
13
+ export declare function ShipmentDecisionPanel({ shipmentId, kind, t, onApplied, renderFollowUp, }: ShipmentDecisionPanelProps): import('react').JSX.Element;
14
+ export {};
@@ -71,7 +71,7 @@ export declare function useDispatchPlan(): {
71
71
  plan: DispatchPlan | null;
72
72
  isLoading: boolean;
73
73
  error: Error | null;
74
- pendingAction: "reject" | "propose" | "apply" | null;
74
+ pendingAction: "propose" | "apply" | "reject" | null;
75
75
  refetch: () => undefined;
76
76
  propose: (options?: PlanDispatchOptions) => Promise<DispatchPlan>;
77
77
  apply: (planId: string, accept: string[]) => Promise<DispatchPlan>;
@@ -0,0 +1,67 @@
1
+ import { DecisionRationaleStatus } from './useDispatchPlan';
2
+ export type ShipmentDecisionKind = 'CARRIER_RECOMMENDATION' | 'EXCEPTION_REMEDIATION';
3
+ export type ShipmentDecisionStatus = 'PROPOSED' | 'ACCEPTED' | 'REJECTED' | 'STALE' | 'EXPIRED';
4
+ export type ShipmentDecisionAction = 'USE_CARRIER' | 'REASSIGN_VEHICLE' | 'REPROMISE_DELIVERY' | 'REQUEST_TRACKING_UPDATE' | 'SWITCH_CARRIER' | 'ACCEPT_SLIP';
5
+ export type ShipmentDecisionExecution = 'APPLY' | 'FOLLOW_UP' | 'RECORD';
6
+ export type ShipmentDecisionOutcome = 'APPLIED' | 'RECORDED' | 'FOLLOW_UP';
7
+ export interface ShipmentDecisionOption {
8
+ id: string;
9
+ rank: number;
10
+ action: ShipmentDecisionAction;
11
+ execution: ShipmentDecisionExecution;
12
+ confidence: number;
13
+ score: number | null;
14
+ reasons: string[];
15
+ rationale: string;
16
+ aiRationale: string | null;
17
+ carrierId: string | null;
18
+ newEstimatedDelivery: string | null;
19
+ followUpMutation: string | null;
20
+ followUpArgs: Record<string, string> | null;
21
+ deliveredCount: number | null;
22
+ onTimeCount: number | null;
23
+ laneDeliveredCount: number | null;
24
+ laneOnTimeCount: number | null;
25
+ medianLaneCost: number | null;
26
+ currency: string | null;
27
+ }
28
+ export interface ShipmentDecision {
29
+ id: string;
30
+ kind: ShipmentDecisionKind;
31
+ shipmentId: string;
32
+ shipmentNumber: string | null;
33
+ status: ShipmentDecisionStatus;
34
+ method: string;
35
+ options: ShipmentDecisionOption[];
36
+ chosenOptionId: string | null;
37
+ outcome: ShipmentDecisionOutcome | null;
38
+ decisionReason: string | null;
39
+ currentCarrierId: string | null;
40
+ promisedDelivery: string | null;
41
+ riskScore: number | null;
42
+ predictedSlipMinutes: number | null;
43
+ breached: boolean | null;
44
+ laneKnown: boolean | null;
45
+ historyCount: number | null;
46
+ aiStatus: DecisionRationaleStatus;
47
+ aiSummary: string | null;
48
+ aiModel: string | null;
49
+ expiresAt: string;
50
+ decidedAt: string | null;
51
+ createdAt: string;
52
+ }
53
+ type PendingAction = 'propose' | 'accept' | 'reject';
54
+ /**
55
+ * @param shipmentId the shipment, or undefined while nothing is selected (no request is made)
56
+ */
57
+ export declare function useShipmentDecision(shipmentId: string | undefined, kind: ShipmentDecisionKind): {
58
+ decision: ShipmentDecision | null;
59
+ isLoading: boolean;
60
+ error: Error | null;
61
+ pendingAction: PendingAction | null;
62
+ refetch: () => undefined;
63
+ propose: () => Promise<ShipmentDecision>;
64
+ accept: (decisionId: string, optionId: string) => Promise<ShipmentDecision>;
65
+ reject: (decisionId: string) => Promise<ShipmentDecision>;
66
+ };
67
+ export {};