assignment-user-matcher 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +78 -3
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +8 -1
  5. package/dist/managers/WorkflowManager.d.ts +24 -0
  6. package/dist/managers/WorkflowManager.d.ts.map +1 -1
  7. package/dist/managers/WorkflowManager.js +77 -0
  8. package/dist/matcher.class.d.ts +52 -3
  9. package/dist/matcher.class.d.ts.map +1 -1
  10. package/dist/matcher.class.js +157 -2
  11. package/dist/scheduling/constraints/constraint.d.ts.map +1 -1
  12. package/dist/scheduling/constraints/constraint.js +7 -1
  13. package/dist/scheduling/constraints/contract.d.ts +1 -0
  14. package/dist/scheduling/constraints/contract.d.ts.map +1 -1
  15. package/dist/scheduling/constraints/contract.js +61 -16
  16. package/dist/scheduling/constraints/fairness.js +1 -1
  17. package/dist/scheduling/constraints/overtime.d.ts.map +1 -1
  18. package/dist/scheduling/constraints/overtime.js +4 -2
  19. package/dist/scheduling/constraints/site-eligibility.d.ts +11 -0
  20. package/dist/scheduling/constraints/site-eligibility.d.ts.map +1 -0
  21. package/dist/scheduling/constraints/site-eligibility.js +52 -0
  22. package/dist/scheduling/constraints/site-home.d.ts +14 -0
  23. package/dist/scheduling/constraints/site-home.d.ts.map +1 -0
  24. package/dist/scheduling/constraints/site-home.js +43 -0
  25. package/dist/scheduling/constraints/site-travel-gap.d.ts +19 -0
  26. package/dist/scheduling/constraints/site-travel-gap.d.ts.map +1 -0
  27. package/dist/scheduling/constraints/site-travel-gap.js +88 -0
  28. package/dist/scheduling/contract-hours.d.ts +42 -0
  29. package/dist/scheduling/contract-hours.d.ts.map +1 -0
  30. package/dist/scheduling/contract-hours.js +104 -0
  31. package/dist/scheduling/engine/objective.d.ts.map +1 -1
  32. package/dist/scheduling/engine/objective.js +5 -0
  33. package/dist/scheduling/engine/state.d.ts.map +1 -1
  34. package/dist/scheduling/engine/state.js +1 -0
  35. package/dist/scheduling/engine/timeline.d.ts +2 -0
  36. package/dist/scheduling/engine/timeline.d.ts.map +1 -1
  37. package/dist/scheduling/index.d.ts +4 -1
  38. package/dist/scheduling/index.d.ts.map +1 -1
  39. package/dist/scheduling/index.js +14 -1
  40. package/dist/scheduling/model.d.ts +11 -0
  41. package/dist/scheduling/model.d.ts.map +1 -1
  42. package/dist/scheduling/model.js +81 -1
  43. package/dist/scheduling/operations.d.ts +23 -1
  44. package/dist/scheduling/operations.d.ts.map +1 -1
  45. package/dist/scheduling/operations.js +85 -4
  46. package/dist/scheduling/provenance.d.ts +2 -2
  47. package/dist/scheduling/provenance.d.ts.map +1 -1
  48. package/dist/scheduling/provenance.js +15 -1
  49. package/dist/scheduling/scheduler.class.d.ts.map +1 -1
  50. package/dist/scheduling/scheduler.class.js +4 -1
  51. package/dist/scheduling/sites.d.ts +35 -0
  52. package/dist/scheduling/sites.d.ts.map +1 -0
  53. package/dist/scheduling/sites.js +112 -0
  54. package/dist/scheduling/types.d.ts +120 -1
  55. package/dist/scheduling/types.d.ts.map +1 -1
  56. package/dist/types/matcher.d.ts +49 -1
  57. package/dist/types/matcher.d.ts.map +1 -1
  58. package/dist/utils/keys.d.ts +2 -0
  59. package/dist/utils/keys.d.ts.map +1 -1
  60. package/dist/utils/keys.js +8 -0
  61. package/package.json +13 -1
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ /**
3
+ * Cross-site travel gap.
4
+ *
5
+ * When a person works two consecutive assignments at different sites, the gap
6
+ * between them must be at least the travel time between those sites. Only the
7
+ * immediate predecessor and successor on the person timeline are judged; a
8
+ * non-adjacent assignment does not create a direct travel obligation.
9
+ *
10
+ * The rule only enforces the gap; it does **not** count travel time as working
11
+ * time (CJEU C-266/14 would require that, but it is out of scope here — the
12
+ * caller models working time through `duty` and break rules).
13
+ *
14
+ * Because the default `min-rest` rule requires 11h between any two assignments,
15
+ * this rule mainly matters in split-shift setups where the caller has relaxed
16
+ * `minRestMinutes` or configured a `dailyRest` rule with a shorter window.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.siteTravelGap = void 0;
20
+ const sites_1 = require("../sites");
21
+ const support_1 = require("./support");
22
+ function siteTravelGap() {
23
+ return (0, support_1.fromVerdict)({
24
+ id: 'site-travel-gap',
25
+ hardness: 'hard',
26
+ verdict(state, pair) {
27
+ const inst = (0, support_1.instanceOf)(state, pair);
28
+ if (!inst?.siteId)
29
+ return (0, support_1.pass)('site-travel-gap', 'shift has no site');
30
+ const timeline = (0, support_1.timelineFor)(state, pair.employeeId);
31
+ const candidateRange = (0, support_1.rangeOf)(inst);
32
+ const ownId = (0, support_1.entryIdOf)(pair);
33
+ const siteId = inst.siteId;
34
+ let predecessor;
35
+ let successor;
36
+ for (const entry of timeline.all()) {
37
+ if (entry.id === ownId)
38
+ continue;
39
+ if (!entry.siteId || entry.siteId === siteId)
40
+ continue;
41
+ if (entry.end <= candidateRange.start) {
42
+ if (!predecessor || entry.end > predecessor.end) {
43
+ predecessor = entry;
44
+ }
45
+ }
46
+ if (entry.start >= candidateRange.end) {
47
+ if (!successor || entry.start < successor.start) {
48
+ successor = entry;
49
+ }
50
+ }
51
+ }
52
+ let worstActual = Infinity;
53
+ let worstRequired = 0;
54
+ let worstMessage = '';
55
+ if (predecessor) {
56
+ const needed = (0, sites_1.travelMinutesBetween)(state.ctx.siteIndex, predecessor.siteId, siteId);
57
+ if (needed !== undefined) {
58
+ const gap = candidateRange.start - predecessor.end;
59
+ if (gap < needed) {
60
+ worstActual = gap;
61
+ worstRequired = needed;
62
+ worstMessage = `only ${(0, support_1.h)(gap)} gap after a shift at "${predecessor.siteId}", need ${(0, support_1.h)(needed)} to reach "${siteId}"`;
63
+ }
64
+ }
65
+ }
66
+ if (successor) {
67
+ const needed = (0, sites_1.travelMinutesBetween)(state.ctx.siteIndex, siteId, successor.siteId);
68
+ if (needed !== undefined) {
69
+ const gap = successor.start - candidateRange.end;
70
+ if (gap < needed && needed - gap > worstRequired - worstActual) {
71
+ worstActual = gap;
72
+ worstRequired = needed;
73
+ worstMessage = `only ${(0, support_1.h)(gap)} gap before a shift at "${successor.siteId}", need ${(0, support_1.h)(needed)} to reach it from "${siteId}"`;
74
+ }
75
+ }
76
+ }
77
+ if (worstRequired > worstActual) {
78
+ return (0, support_1.fail)('site-travel-gap', 'hard', `site travel: ${worstMessage}`, {
79
+ actual: worstActual,
80
+ required: worstRequired,
81
+ unit: 'minutes',
82
+ });
83
+ }
84
+ return (0, support_1.pass)('site-travel-gap', `travel gap to "${siteId}" is sufficient`);
85
+ },
86
+ });
87
+ }
88
+ exports.siteTravelGap = siteTravelGap;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Contracted hours — pure arithmetic shared by the model, the contract rule,
3
+ * the objective and the result summary.
4
+ *
5
+ * A person's contracted week can be stated two ways: as minutes
6
+ * (`contract.weeklyMinutes`) or as a fraction of full time (`contract.fte`).
7
+ * Both resolve **once**, in `buildModel`, to `ModelContext.contractedWeeklyMinutes`,
8
+ * and every consumer — the overtime baseline, pro-rata fairness, the
9
+ * contract-hours objective, the period cap — reads that one map. Resolving in
10
+ * each rule separately is how a half-timer ends up with a full-time overtime
11
+ * threshold and a half-time fairness share in the same roster.
12
+ *
13
+ * The full-time week the fraction is measured against is caller data
14
+ * (`rules.contract.fullTimeWeeklyMinutes`, or the ordinary week the overtime
15
+ * rule already states). The engine ships no figure for it: what "full time"
16
+ * means is a contractual or statutory fact that differs by country and by
17
+ * collective agreement, and the library's position is to carry rule shapes and
18
+ * never a jurisdiction's values.
19
+ */
20
+ import type { ContractHoursSummary, Employee, SearchState, WorkingTimeRules } from './types';
21
+ /** Default `objectives.contractHoursWeight`: one soft point per hour away from contract. */
22
+ export declare const DEFAULT_CONTRACT_HOURS_WEIGHT = 1;
23
+ /** The full-time week the rules state, if any. */
24
+ export declare function fullTimeWeeklyMinutes(rules: WorkingTimeRules | undefined): number | undefined;
25
+ /**
26
+ * A person's contracted week in minutes, or `undefined` when their contract
27
+ * states none. Throws when an `fte` cannot be resolved — the engine never
28
+ * guesses a working week.
29
+ */
30
+ export declare function resolveContractedWeeklyMinutes(employee: Employee, rules: WorkingTimeRules | undefined): number | undefined;
31
+ /** A weekly figure pro-rated to a period of `periodDays` days. */
32
+ export declare function contractedPeriodMinutes(weeklyMinutes: number, periodDays: number): number;
33
+ /**
34
+ * Summed distance from contract across the roster, in hours, weighted. Lower
35
+ * is better; the objective adds it at the soft level. Symmetric on purpose —
36
+ * with coverage fixed by demand, penalising both surplus and shortfall is what
37
+ * distributes the hours pro rata instead of merely capping the busiest.
38
+ */
39
+ export declare function contractHoursPenalty(state: SearchState): number;
40
+ /** Planned against contracted, per employee with a contract, in input order. */
41
+ export declare function contractHoursSummary(state: SearchState): ContractHoursSummary[];
42
+ //# sourceMappingURL=contract-hours.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-hours.d.ts","sourceRoot":"","sources":["../../src/scheduling/contract-hours.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG7F,4FAA4F;AAC5F,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C,kDAAkD;AAClD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAE7F;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC1C,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,gBAAgB,GAAG,SAAS,GACpC,MAAM,GAAG,SAAS,CAwBpB;AAED,kEAAkE;AAClE,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEzF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAS/D;AAED,gFAAgF;AAChF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,oBAAoB,EAAE,CAqB/E"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ /**
3
+ * Contracted hours — pure arithmetic shared by the model, the contract rule,
4
+ * the objective and the result summary.
5
+ *
6
+ * A person's contracted week can be stated two ways: as minutes
7
+ * (`contract.weeklyMinutes`) or as a fraction of full time (`contract.fte`).
8
+ * Both resolve **once**, in `buildModel`, to `ModelContext.contractedWeeklyMinutes`,
9
+ * and every consumer — the overtime baseline, pro-rata fairness, the
10
+ * contract-hours objective, the period cap — reads that one map. Resolving in
11
+ * each rule separately is how a half-timer ends up with a full-time overtime
12
+ * threshold and a half-time fairness share in the same roster.
13
+ *
14
+ * The full-time week the fraction is measured against is caller data
15
+ * (`rules.contract.fullTimeWeeklyMinutes`, or the ordinary week the overtime
16
+ * rule already states). The engine ships no figure for it: what "full time"
17
+ * means is a contractual or statutory fact that differs by country and by
18
+ * collective agreement, and the library's position is to carry rule shapes and
19
+ * never a jurisdiction's values.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.contractHoursSummary = exports.contractHoursPenalty = exports.contractedPeriodMinutes = exports.resolveContractedWeeklyMinutes = exports.fullTimeWeeklyMinutes = exports.DEFAULT_CONTRACT_HOURS_WEIGHT = void 0;
23
+ const types_1 = require("./types");
24
+ /** Default `objectives.contractHoursWeight`: one soft point per hour away from contract. */
25
+ exports.DEFAULT_CONTRACT_HOURS_WEIGHT = 1;
26
+ /** The full-time week the rules state, if any. */
27
+ function fullTimeWeeklyMinutes(rules) {
28
+ return rules?.contract?.fullTimeWeeklyMinutes ?? rules?.overtime?.ordinaryPerWeekMinutes;
29
+ }
30
+ exports.fullTimeWeeklyMinutes = fullTimeWeeklyMinutes;
31
+ /**
32
+ * A person's contracted week in minutes, or `undefined` when their contract
33
+ * states none. Throws when an `fte` cannot be resolved — the engine never
34
+ * guesses a working week.
35
+ */
36
+ function resolveContractedWeeklyMinutes(employee, rules) {
37
+ const contract = employee.contract;
38
+ if (!contract)
39
+ return undefined;
40
+ if (contract.weeklyMinutes !== undefined) {
41
+ if (!Number.isFinite(contract.weeklyMinutes) || contract.weeklyMinutes < 0) {
42
+ throw new types_1.ScheduleValidationError(`Employee "${employee.id}" has invalid contract.weeklyMinutes: ${contract.weeklyMinutes}`);
43
+ }
44
+ return contract.weeklyMinutes;
45
+ }
46
+ if (contract.fte === undefined)
47
+ return undefined;
48
+ if (!Number.isFinite(contract.fte) || contract.fte <= 0 || contract.fte > 1) {
49
+ throw new types_1.ScheduleValidationError(`Employee "${employee.id}" has invalid contract.fte: ${contract.fte} (expected 0 < fte <= 1)`);
50
+ }
51
+ const fullTime = fullTimeWeeklyMinutes(rules);
52
+ if (fullTime === undefined) {
53
+ throw new types_1.ScheduleValidationError(`Employee "${employee.id}" has contract.fte but no full-time week to measure it against: set rules.contract.fullTimeWeeklyMinutes (or rules.overtime.ordinaryPerWeekMinutes)`);
54
+ }
55
+ return Math.round(fullTime * contract.fte);
56
+ }
57
+ exports.resolveContractedWeeklyMinutes = resolveContractedWeeklyMinutes;
58
+ /** A weekly figure pro-rated to a period of `periodDays` days. */
59
+ function contractedPeriodMinutes(weeklyMinutes, periodDays) {
60
+ return Math.round((weeklyMinutes * periodDays) / 7);
61
+ }
62
+ exports.contractedPeriodMinutes = contractedPeriodMinutes;
63
+ /**
64
+ * Summed distance from contract across the roster, in hours, weighted. Lower
65
+ * is better; the objective adds it at the soft level. Symmetric on purpose —
66
+ * with coverage fixed by demand, penalising both surplus and shortfall is what
67
+ * distributes the hours pro rata instead of merely capping the busiest.
68
+ */
69
+ function contractHoursPenalty(state) {
70
+ const weight = state.ctx.contractHoursWeight;
71
+ if (!(weight > 0) || state.ctx.contractedPeriodMinutes.size === 0)
72
+ return 0;
73
+ let penalty = 0;
74
+ for (const [employeeId, contracted] of state.ctx.contractedPeriodMinutes) {
75
+ const planned = state.minutesByEmployee.get(employeeId) ?? 0;
76
+ penalty += Math.abs(planned - contracted) / 60;
77
+ }
78
+ return penalty * weight;
79
+ }
80
+ exports.contractHoursPenalty = contractHoursPenalty;
81
+ /** Planned against contracted, per employee with a contract, in input order. */
82
+ function contractHoursSummary(state) {
83
+ const out = [];
84
+ for (const employee of state.ctx.employees) {
85
+ const weeklyMinutes = state.ctx.contractedWeeklyMinutes.get(employee.id);
86
+ const contractedMinutes = state.ctx.contractedPeriodMinutes.get(employee.id);
87
+ if (weeklyMinutes === undefined || contractedMinutes === undefined)
88
+ continue;
89
+ const plannedMinutes = state.minutesByEmployee.get(employee.id) ?? 0;
90
+ const fullTime = fullTimeWeeklyMinutes(state.ctx.rulesByEmployee.get(employee.id) ?? state.ctx.rules);
91
+ const fte = employee.contract?.fte ??
92
+ (fullTime !== undefined && fullTime > 0 ? Math.round((weeklyMinutes / fullTime) * 1000) / 1000 : undefined);
93
+ out.push({
94
+ employeeId: employee.id,
95
+ weeklyMinutes,
96
+ ...(fte !== undefined ? { fte } : {}),
97
+ contractedMinutes,
98
+ plannedMinutes,
99
+ deltaMinutes: plannedMinutes - contractedMinutes,
100
+ });
101
+ }
102
+ return out;
103
+ }
104
+ exports.contractHoursSummary = contractHoursSummary;
@@ -1 +1 @@
1
- {"version":3,"file":"objective.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/objective.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIxE,eAAO,MAAM,eAAe,QAAS,CAAC;AACtC,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAC1C,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,2DAA2D;AAC3D,MAAM,WAAW,QAAQ;IACrB,IA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E;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAK3E;AAED,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAMhF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,GAAG,QAAQ,CAgB5E;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAE1E;AAED,kEAAkE;AAClE,wBAAgB,QAAQ,CACpB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,UAAU,GAAG,UAAU,EAClC,cAAc,EAAE,MAAM,EACtB,aAAa,CAAC,EAAE,YAAY,EAAE,GAC/B,QAAQ,CAoBV;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CACjB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,UAAU,GAAG,UAAU,EAClC,cAAc,EAAE,MAAM,GACvB,MAAM,CAGR"}
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.score = exports.scoreLex = exports.softBreaches = exports.breachTotals = exports.minHoursShortfalls = exports.hoursVariance = exports.unfilledSlots = exports.tagShortage = exports.slotShortage = exports.isBetter = exports.compareScores = exports.DEFAULT_SOFT_WEIGHT = exports.MIN_HOURS_WEIGHT = exports.TAG_SHORTFALL_WEIGHT = exports.UNFILLED_WEIGHT = void 0;
30
30
  const fairness_1 = require("../constraints/fairness");
31
31
  const availability_1 = require("../constraints/availability");
32
+ const contract_hours_1 = require("../contract-hours");
32
33
  exports.UNFILLED_WEIGHT = 10000;
33
34
  exports.TAG_SHORTFALL_WEIGHT = 5000;
34
35
  exports.MIN_HOURS_WEIGHT = 100;
@@ -144,6 +145,10 @@ function scoreLex(ctx, state, objective, minHoursWeight, fairnessRules) {
144
145
  // Preferred/avoid availability windows are scored, not advisory: avoided
145
146
  // assignments cost, preferred ones credit, weighted per rule.
146
147
  totals.soft += (0, availability_1.preferencePenalty)(state);
148
+ // Contracted hours steer the plan: each person with a known contract is
149
+ // pulled towards their pro-rated period total, so a half-timer is planned
150
+ // half the hours rather than filled to the statutory ceiling.
151
+ totals.soft += (0, contract_hours_1.contractHoursPenalty)(state);
147
152
  if (objective === 'balanced')
148
153
  totals.soft += hoursVariance(ctx, state) / 60; // hours-scale variance term
149
154
  return totals;
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG1D,MAAM,WAAW,aAAc,SAAQ,WAAW;IAC9C,0FAA0F;IAC1F,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa,CAsB5D;AAED,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAqB5G;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAW3F;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAQrG"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG1D,MAAM,WAAW,aAAc,SAAQ,WAAW;IAC9C,0FAA0F;IAC1F,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa,CAsB5D;AAED,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAsB5G;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAW3F;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAQrG"}
@@ -56,6 +56,7 @@ function assign(state, employeeId, instanceId, reasons) {
56
56
  end: inst.endMinute,
57
57
  workingMinutes: inst.workingMinutes,
58
58
  tag: inst.shiftTypeTag,
59
+ siteId: inst.siteId,
59
60
  });
60
61
  state.reasons.set(pairKey(employeeId, instanceId), reasons);
61
62
  }
@@ -34,6 +34,8 @@ export interface TimelineEntry extends MinuteRange {
34
34
  workingMinutes: number;
35
35
  /** Free-form classification tag used by sequence rules (e.g. a shift type). */
36
36
  tag?: string;
37
+ /** Site where this span took place; drives cross-site travel-gap rules. */
38
+ siteId?: string;
37
39
  /** Historical entries are immutable and never returned by the mutable views. */
38
40
  historical?: boolean;
39
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,gDAAgD;AAChD,MAAM,WAAW,aAAc,SAAQ,WAAW;IAC9C,0EAA0E;IAC1E,EAAE,EAAE,MAAM,CAAC;IACX,wFAAwF;IACxF,cAAc,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,qBAAa,cAAc;IACvB,OAAO,CAAC,OAAO,CAAuB;IACtC,+DAA+D;IAC/D,OAAO,CAAC,MAAM,CAAiB;IAC/B,4EAA4E;IAC5E,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,KAAK,CAAS;gBAEV,OAAO,GAAE,aAAa,EAAO;IAMzC,oDAAoD;IACpD,GAAG,IAAI,SAAS,aAAa,EAAE;IAK/B,yEAAyE;IACzE,mBAAmB,IAAI,MAAM;IAK7B,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAQ/B,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAQ3B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,MA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,CAAqC;gBAElD,OAAO,GAAE,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,CAAa;IAM7D,yDAAyD;IACzD,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc;IASrC,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;IAIjD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAIlD,SAAS,IAAI,MAAM,EAAE;CAGxB"}
@@ -5,6 +5,9 @@ export { ScheduleValidationError } from './types';
5
5
  export { DEFAULT_MIN_REST_MINUTES } from './constraints/min-rest';
6
6
  export { checkCompliance, explainCandidate, repairSchedule, rankCandidates, diagnoseInfeasibility, type ComplianceReport, type Disruption, type RepairCandidate, type RepairResult, type InfeasibilityReport, } from './operations';
7
7
  export { PeriodClock, type MinuteRange, type ClockRange } from './time';
8
+ export { expandShiftInstances } from './model';
8
9
  export { hours, days, weeklyAverageOver } from './rules';
9
- export type { AssignmentPair, AvailabilityRule, BreakRule, ClockRangeConfig, ConsecutiveRule, ConstraintOptions, ConstraintViolation, DailyRestRule, DutyClassification, DutyQuota, Employee, EmployeeContract, EmployeeCost, EmployeeProtection, EngagementRule, FairnessRule, HistoricalAssignment, LedgerEntry, ModelContext, NightVolumeQuota, NightWorkRule, NoticeRule, ObjectiveWeights, OvertimeRule, Qualification, RestDayRule, RollingAverage, RuleVerdict, ScheduleInput, ScheduleProvenance, ScheduleResult, ScheduledAssignment, SchedulingConstraint, SearchState, Severity, ShiftInstance, ShiftTemplate, TimeOffEntry, WeeklyRestRule, WorkingTimeLimits, WorkingTimeRules, } from './types';
10
+ export { DEFAULT_CONTRACT_HOURS_WEIGHT, contractedPeriodMinutes, fullTimeWeeklyMinutes, resolveContractedWeeklyMinutes, } from './contract-hours';
11
+ export type { AssignmentPair, AvailabilityRule, BreakRule, ClockRangeConfig, ConsecutiveRule, ConstraintOptions, ConstraintViolation, ContractHoursRule, ContractHoursSummary, DailyRestRule, DutyClassification, DutyQuota, Employee, EmployeeContract, EmployeeCost, EmployeeProtection, EngagementRule, FairnessRule, HistoricalAssignment, LedgerEntry, ModelContext, NightVolumeQuota, NightWorkRule, NoticeRule, ObjectiveWeights, OvertimeRule, Qualification, RestDayRule, RollingAverage, RuleVerdict, ScheduleInput, ScheduleProvenance, ScheduleResult, ScheduledAssignment, SchedulingConstraint, SearchState, Severity, ShiftInstance, ShiftTemplate, Site, SiteIndex, TimeOffEntry, WeeklyRestRule, WorkingTimeLimits, WorkingTimeRules, } from './types';
12
+ export type { PersonTimeline, TimelineEntry, TimelineIndex } from './engine/timeline';
10
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scheduling/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAClD,4FAA4F;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,EACH,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GAC3B,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAIxE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEzD,YAAY,EACR,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT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AAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACnB,MAAM,SAAS,CAAC;AAIjB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.weeklyAverageOver = exports.days = exports.hours = exports.PeriodClock = exports.diagnoseInfeasibility = exports.rankCandidates = exports.repairSchedule = exports.explainCandidate = exports.checkCompliance = exports.DEFAULT_MIN_REST_MINUTES = exports.ScheduleValidationError = exports.ENGINE_VERSION = exports.solveSchedule = exports.ShiftScheduler = void 0;
3
+ exports.resolveContractedWeeklyMinutes = exports.fullTimeWeeklyMinutes = exports.contractedPeriodMinutes = exports.DEFAULT_CONTRACT_HOURS_WEIGHT = exports.weeklyAverageOver = exports.days = exports.hours = exports.expandShiftInstances = exports.PeriodClock = exports.diagnoseInfeasibility = exports.rankCandidates = exports.repairSchedule = exports.explainCandidate = exports.checkCompliance = exports.DEFAULT_MIN_REST_MINUTES = exports.ScheduleValidationError = exports.ENGINE_VERSION = exports.solveSchedule = exports.ShiftScheduler = void 0;
4
4
  /** Public surface of the scheduling module. */
5
5
  var scheduler_class_1 = require("./scheduler.class");
6
6
  Object.defineProperty(exports, "ShiftScheduler", { enumerable: true, get: function () { return scheduler_class_1.ShiftScheduler; } });
@@ -21,9 +21,22 @@ Object.defineProperty(exports, "diagnoseInfeasibility", { enumerable: true, get:
21
21
  // Time model, exported so hosts can resolve the same wall-clock the engine does.
22
22
  var time_1 = require("./time");
23
23
  Object.defineProperty(exports, "PeriodClock", { enumerable: true, get: function () { return time_1.PeriodClock; } });
24
+ // The dated occurrences a host draws its planning grid from. Exported so a
25
+ // grid addresses the same `<templateId>@<date>` ids the engine judges, rather
26
+ // than a re-derivation of them that can drift.
27
+ var model_1 = require("./model");
28
+ Object.defineProperty(exports, "expandShiftInstances", { enumerable: true, get: function () { return model_1.expandShiftInstances; } });
24
29
  // Rule-authoring arithmetic (no jurisdiction values, just the conversions
25
30
  // people get wrong — notably weekly-average → rolling-window-total).
26
31
  var rules_1 = require("./rules");
27
32
  Object.defineProperty(exports, "hours", { enumerable: true, get: function () { return rules_1.hours; } });
28
33
  Object.defineProperty(exports, "days", { enumerable: true, get: function () { return rules_1.days; } });
29
34
  Object.defineProperty(exports, "weeklyAverageOver", { enumerable: true, get: function () { return rules_1.weeklyAverageOver; } });
35
+ // Contracted-hours arithmetic, exported so a host resolves `fte` to the same
36
+ // weekly figure the engine plans against (for pay estimates, planned-hours
37
+ // reports) rather than a second derivation that can drift.
38
+ var contract_hours_1 = require("./contract-hours");
39
+ Object.defineProperty(exports, "DEFAULT_CONTRACT_HOURS_WEIGHT", { enumerable: true, get: function () { return contract_hours_1.DEFAULT_CONTRACT_HOURS_WEIGHT; } });
40
+ Object.defineProperty(exports, "contractedPeriodMinutes", { enumerable: true, get: function () { return contract_hours_1.contractedPeriodMinutes; } });
41
+ Object.defineProperty(exports, "fullTimeWeeklyMinutes", { enumerable: true, get: function () { return contract_hours_1.fullTimeWeeklyMinutes; } });
42
+ Object.defineProperty(exports, "resolveContractedWeeklyMinutes", { enumerable: true, get: function () { return contract_hours_1.resolveContractedWeeklyMinutes; } });
@@ -27,6 +27,17 @@
27
27
  import type { AvailabilityRule, ConstraintOptions, ModelContext, ObjectiveWeights, ScheduleInput, SchedulingConstraint, ShiftInstance, ShiftTemplate, WorkingTimeRules } from './types';
28
28
  import { PeriodClock, MINUTES_PER_DAY } from './time';
29
29
  export { daysBetween, addDays } from './time';
30
+ /**
31
+ * Expand a whole input's templates into the dated occurrences the engine will
32
+ * judge — the grid a host draws before anything is assigned.
33
+ *
34
+ * It takes the `ScheduleInput` rather than a clock so the caller cannot hand in
35
+ * a period clock built on a different timezone or length than the solve will
36
+ * use: the ids and wall-clock minutes here are the ones every later call
37
+ * (`explainCandidate`, `checkCompliance`, a returned `ScheduledAssignment`)
38
+ * refers to.
39
+ */
40
+ export declare function expandShiftInstances(input: ScheduleInput): ShiftInstance[];
30
41
  /** Expand one template into its dated instances inside the period. */
31
42
  export declare function expandTemplate(template: ShiftTemplate, clock: PeriodClock, periodDays: number, context: {
32
43
  nightRule?: WorkingTimeRules['nightWork'];
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/scheduling/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EACR,gBAAgB,EAChB,iBAAiB,EAGjB,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,gBAAgB,EACnB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAmE,MAAM,QAAQ,CAAC;AAEvH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9C,sEAAsE;AACtE,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE;IAAE,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW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OAAO,EAAE;IAAE,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAAC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,GACpF,aAAa,EAAE,CAyFjB;AA4GD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,SAAS,EAAE,QAAQ,EAAE,gBAAgB,GAAG,SAAS,GAAG,gBAAgB,CAIvH;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,KAAK,CAAC,EAAE,gBAAgB,EACxB,UAAU,CAAC,EAAE,gBAAgB,GAC9B,oBAAoB,EAAE,CAexB;AAiCD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CA0H7D;AAED,gEAAgE;AAChE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAKxF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -26,16 +26,52 @@
26
26
  * modeled properly here.
27
27
  */
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.MINUTES_PER_DAY = exports.availabilityApplies = exports.buildModel = exports.resolveConstraints = exports.mergeRules = exports.expandTemplate = exports.addDays = exports.daysBetween = void 0;
29
+ exports.MINUTES_PER_DAY = exports.availabilityApplies = exports.buildModel = exports.resolveConstraints = exports.mergeRules = exports.expandTemplate = exports.expandShiftInstances = exports.addDays = exports.daysBetween = void 0;
30
30
  const types_1 = require("./types");
31
31
  const constraint_1 = require("./constraints/constraint");
32
32
  const min_rest_1 = require("./constraints/min-rest");
33
33
  const overtime_1 = require("./constraints/overtime");
34
+ const contract_hours_1 = require("./contract-hours");
35
+ const sites_1 = require("./sites");
34
36
  const time_1 = require("./time");
35
37
  Object.defineProperty(exports, "MINUTES_PER_DAY", { enumerable: true, get: function () { return time_1.MINUTES_PER_DAY; } });
36
38
  var time_2 = require("./time");
37
39
  Object.defineProperty(exports, "daysBetween", { enumerable: true, get: function () { return time_2.daysBetween; } });
38
40
  Object.defineProperty(exports, "addDays", { enumerable: true, get: function () { return time_2.addDays; } });
41
+ /**
42
+ * Expand a whole input's templates into the dated occurrences the engine will
43
+ * judge — the grid a host draws before anything is assigned.
44
+ *
45
+ * It takes the `ScheduleInput` rather than a clock so the caller cannot hand in
46
+ * a period clock built on a different timezone or length than the solve will
47
+ * use: the ids and wall-clock minutes here are the ones every later call
48
+ * (`explainCandidate`, `checkCompliance`, a returned `ScheduledAssignment`)
49
+ * refers to.
50
+ */
51
+ function expandShiftInstances(input) {
52
+ (0, time_1.assertIsoDate)(input.period.startDate, 'period.startDate');
53
+ (0, time_1.assertIsoDate)(input.period.endDate, 'period.endDate');
54
+ const periodDays = (0, time_1.daysBetween)(input.period.startDate, input.period.endDate) + 1;
55
+ if (periodDays <= 0)
56
+ throw new types_1.ScheduleValidationError('period.endDate must not precede period.startDate');
57
+ const clock = new time_1.PeriodClock(input.period.startDate, periodDays, input.period.timeZone ?? 'UTC');
58
+ const publicHolidays = new Set(input.calendar?.publicHolidays ?? []);
59
+ for (const date of publicHolidays)
60
+ (0, time_1.assertIsoDate)(date, 'calendar.publicHolidays');
61
+ const context = { nightRule: input.rules?.nightWork, publicHolidays };
62
+ const instances = [];
63
+ const seen = new Set();
64
+ for (const template of input.shifts) {
65
+ for (const inst of expandTemplate(template, clock, periodDays, context)) {
66
+ if (seen.has(inst.id))
67
+ throw new types_1.ScheduleValidationError(`Duplicate shift instance id "${inst.id}"`);
68
+ seen.add(inst.id);
69
+ instances.push(inst);
70
+ }
71
+ }
72
+ return instances;
73
+ }
74
+ exports.expandShiftInstances = expandShiftInstances;
39
75
  /** Expand one template into its dated instances inside the period. */
40
76
  function expandTemplate(template, clock, periodDays, context) {
41
77
  if (!template.id)
@@ -208,6 +244,22 @@ function validateEmployee(employee) {
208
244
  (0, time_1.assertIsoDate)(q.validUntil, `employee "${employee.id}" qualifications.validUntil`);
209
245
  }
210
246
  }
247
+ function assertValidContractRule(rule, owner) {
248
+ if (!rule)
249
+ return;
250
+ for (const [field, value] of [
251
+ ['fullTimeWeeklyMinutes', rule.fullTimeWeeklyMinutes],
252
+ ['maxOverMinutes', rule.maxOverMinutes],
253
+ ['maxUnderMinutes', rule.maxUnderMinutes],
254
+ ]) {
255
+ if (value !== undefined && (!Number.isFinite(value) || value < 0)) {
256
+ throw new types_1.ScheduleValidationError(`${owner}: contract.${field} must be a non-negative number`);
257
+ }
258
+ }
259
+ if (rule.fullTimeWeeklyMinutes !== undefined && rule.fullTimeWeeklyMinutes === 0) {
260
+ throw new types_1.ScheduleValidationError(`${owner}: contract.fullTimeWeeklyMinutes must be positive`);
261
+ }
262
+ }
211
263
  /**
212
264
  * Merge the global rule set with one person's overrides.
213
265
  *
@@ -262,6 +314,7 @@ function buildHistory(history, clock, personIdOf) {
262
314
  end,
263
315
  workingMinutes: entry.workingMinutes ?? end - start,
264
316
  tag: entry.shiftTypeTag,
317
+ siteId: entry.siteId,
265
318
  historical: true,
266
319
  });
267
320
  out.set(personId, entries);
@@ -280,6 +333,7 @@ function buildModel(input) {
280
333
  throw new types_1.ScheduleValidationError('period.endDate must not precede period.startDate');
281
334
  const clock = new time_1.PeriodClock(input.period.startDate, periodDays, input.period.timeZone ?? 'UTC');
282
335
  const rules = input.rules ?? {};
336
+ const siteIndex = (0, sites_1.buildSiteIndex)(input.sites, input.travelSpeedKmh);
283
337
  const publicHolidays = new Set(input.calendar?.publicHolidays ?? []);
284
338
  for (const date of publicHolidays)
285
339
  (0, time_1.assertIsoDate)(date, 'calendar.publicHolidays');
@@ -315,6 +369,28 @@ function buildModel(input) {
315
369
  personIdOf.set(employee.id, personId);
316
370
  employeesOfPerson.set(personId, [...(employeesOfPerson.get(personId) ?? []), employee.id]);
317
371
  }
372
+ // The contracted week resolves exactly once, against the rules that apply
373
+ // to the person (a per-person override may carry its own full-time week),
374
+ // and every rule reads the resolved figure from the context.
375
+ const contractedWeeklyMinutes = new Map();
376
+ const contractedPeriod = new Map();
377
+ for (const employee of input.employees) {
378
+ const weekly = (0, contract_hours_1.resolveContractedWeeklyMinutes)(employee, rulesByEmployee.get(employee.id) ?? rules);
379
+ if (weekly === undefined)
380
+ continue;
381
+ contractedWeeklyMinutes.set(employee.id, weekly);
382
+ contractedPeriod.set(employee.id, (0, contract_hours_1.contractedPeriodMinutes)(weekly, periodDays));
383
+ }
384
+ const contractHoursWeight = input.objectives?.contractHoursWeight ?? contract_hours_1.DEFAULT_CONTRACT_HOURS_WEIGHT;
385
+ if (!Number.isFinite(contractHoursWeight) || contractHoursWeight < 0) {
386
+ throw new types_1.ScheduleValidationError(`objectives.contractHoursWeight must be a non-negative number`);
387
+ }
388
+ if (rules.contract)
389
+ assertValidContractRule(rules.contract, 'rules');
390
+ for (const employee of input.employees) {
391
+ if (employee.rules?.contract)
392
+ assertValidContractRule(employee.rules.contract, `employee "${employee.id}"`);
393
+ }
318
394
  const absences = new Map();
319
395
  for (const absence of input.absences ?? []) {
320
396
  const span = spanToMinutes(absence.from, absence.to, clock, 'absences');
@@ -349,12 +425,16 @@ function buildModel(input) {
349
425
  employeeTags,
350
426
  instances,
351
427
  instanceById,
428
+ siteIndex,
352
429
  employeeBlockedIntervals,
353
430
  minRestMinutes: input.constraints?.minRestMinutes ?? rules.dailyRest?.minMinutes ?? min_rest_1.DEFAULT_MIN_REST_MINUTES,
354
431
  constraints: resolveConstraints(input.constraints, rules, input.objectives),
355
432
  clock,
356
433
  rules,
357
434
  rulesByEmployee,
435
+ contractedWeeklyMinutes,
436
+ contractedPeriodMinutes: contractedPeriod,
437
+ contractHoursWeight,
358
438
  personIdOf,
359
439
  employeesOfPerson,
360
440
  history: buildHistory(input.history, clock, personIdOf),
@@ -17,7 +17,7 @@
17
17
  * - `diagnoseInfeasibility` — why the problem cannot be solved, before it is
18
18
  * attempted.
19
19
  */
20
- import type { AssignmentPair, ConstraintViolation, LedgerEntry, RuleVerdict, ScheduleInput, ScheduledAssignment } from './types';
20
+ import type { AssignmentPair, ConstraintViolation, LedgerEntry, RuleVerdict, ScheduleInput, ScheduledAssignment, ContractHoursSummary } from './types';
21
21
  export interface ComplianceReport {
22
22
  compliant: boolean;
23
23
  violations: ConstraintViolation[];
@@ -26,7 +26,15 @@ export interface ComplianceReport {
26
26
  pair: AssignmentPair;
27
27
  verdicts: RuleVerdict[];
28
28
  }>;
29
+ /**
30
+ * Obligations the roster accrues (compensatory rest, late-cancellation
31
+ * pay, protection fallbacks, time off in lieu) — the same ledger the
32
+ * solver reports for the same assignments, so a hand-edited roster can
33
+ * never validate as "compliant but owing nothing".
34
+ */
29
35
  ledger: LedgerEntry[];
36
+ /** Planned against contracted hours — the same summary the solver reports for the same assignments. */
37
+ contractHours: ContractHoursSummary[];
30
38
  }
31
39
  /**
32
40
  * Validate an externally-produced or hand-edited roster.
@@ -68,9 +76,23 @@ export interface RepairCandidate {
68
76
  marginalCostCents: number;
69
77
  /** How far below their fair share of extra work this person is. Higher means more owed. */
70
78
  fairnessDebt: number;
79
+ /**
80
+ * Where this shift would leave the person against their contracted period
81
+ * total: `(planned + this shift) − contracted`, negative while still under
82
+ * contract. Only for employees whose contracted week resolves.
83
+ */
84
+ contractDeltaMinutes?: number;
71
85
  /** Lower is a better call. */
72
86
  rank: number;
73
87
  rationale: string;
88
+ /** Site the candidate is travelling from (same-day assignment, then home site). */
89
+ originSiteId?: string;
90
+ /** Estimated travel minutes from origin to the shift's site. */
91
+ travelMinutes?: number;
92
+ /** Straight-line distance from origin to the shift's site, when minutes are unavailable. */
93
+ distanceKm?: number;
94
+ /** Whether the shift is at this employee's home site. */
95
+ isHomeSite: boolean;
74
96
  }
75
97
  export interface RepairResult {
76
98
  diff: {
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/scheduling/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;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