@salesforce/afv-skills 1.51.0 → 1.52.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.
@@ -42,119 +42,139 @@ Each row: **name — engine (DB/Apex) — what it does.** "DB w/ ESO" means the
42
42
  | **TimeSlot Designated Work** | Apex | Reserves a time slot/shift for a specific work type — only that type schedules in that window. All-or-nothing rule (no relevance groups). |
43
43
  | **Service Crew Resources Availability** | Apex | Ensures a crew-type resource is only assigned when the crew meets the parent record's minimum crew size. |
44
44
 
45
- ### Interview order — MANDATORY
45
+ ### Requirements mapping
46
+
47
+ Don't start from the rule list — start from **what the business needs**, then map each requirement to the rule(s) that satisfy it. Walk the user through this mapping:
48
+
49
+ | If the requirement is… | Use this work rule |
50
+ |---|---|
51
+ | Resources need specific skills / proficiency levels | **Match Skills**; **Extended Match** |
52
+ | Non-skill matching factors (e.g., serviceable postal codes) | **Match Boolean**; **Match Skills**; **Extended Match** |
53
+ | Breaks during the day / specific or multiple breaks | **Service Resource Availability** (+ work rule entries for multiple breaks, ESO) |
54
+ | Can work go into overtime? Can resources travel outside working hours? | **Service Resource Availability** |
55
+ | Max number / duration of appointments per resource per day | **Count Rule** |
56
+ | A specific resource **must** be assigned | **Required Resources** |
57
+ | A specific resource **must not** be assigned | **Excluded Resources** |
58
+ | Customer has specific service-call time windows | **Service Appointment Visiting Hours** |
59
+ | Ensure crew-type resources get scheduled | **Service Crew Resources Availability** |
60
+ | Appointments have arrival windows / required arrival times | **Match Time Rule** |
61
+ | Cap travel distance from home / control travel cost across large territories | **Maximum Travel from Home** — ask whether the cap is by **distance** or by **travel time** (see note below) |
62
+ | Assign specific work types to a resource for part/all of a day | **TimeSlot Designated Work** |
63
+ | Restrict work to the resource's **primary and secondary** service territory memberships | **Working Territories** |
46
64
 
47
- Walk through the 16 work rule types **in the exact order of the table in *The 16 work rule types* above** — top to bottom, one rule at a time. **Do NOT split the interview into a separate "which rules apply" pass and a later "configure them" pass, and do NOT reorder the rules.** For each rule, in order:
65
+ Always include exactly one **Service Resource Availability** rule — the only mandatory rule this skill emits. Never emit Earliest Start Permitted or Due Date — provisioned automatically.
48
66
 
49
- 1. **Decide whether it applies.** Service Resource Availability is always in (no question). For every other rule, either the user's stated business needs already make it obviously needed, or ask the short **Applies when / ask** question in that rule's entry below. Interpret the user's needs against the *What it does* column — e.g. "resources need the right skills" → Match Skills; "cap travel from home" → Maximum Travel from Home.
50
- 2. **If it applies and it has configuration, ask that rule's config question(s) right now** — before moving on to the next rule. Never defer configuration to the end. If the rule is selection-only (no config), just confirm it and continue.
67
+ **Arrival Window Match Time rules (opt-in default pair).** If the user wants appointments to honor customer **arrival windows**, ask them to confirm, and if they agree, emit **two** Match Time rules with these exact default settings — do not ask the user to fill these in, they are the standard arrival-window configuration:
51
68
 
52
- Then continue to the next rule in the table. Ask one question at a time. Only after you have walked all 16 rules is the rule list final.
69
+ | Setting | Rule A | Rule B |
70
+ |---|---|---|
71
+ | Name | `Arrival Window Start` | `Arrival Window End` |
72
+ | Service Schedule Time Property | `SchedStartTime` | `SchedStartTime` |
73
+ | Service Time Operator | `Later than or Equal to` | `Before or Equal to` |
74
+ | Service Time Property | `ArrivalWindowStartTime` | `ArrivalWindowEndTime` |
75
+ | Pass Empty Values | `true` | `true` |
53
76
 
54
- **Do NOT ask a relevance-group / subset question on every rule.** Most rules apply policy-wide, and asking "all or a subset?" after each one is noise. Instead:
77
+ Emit each as a Match Time work rule whose `params` carry those four values (keys `serviceScheduleTimeProperty`, `serviceTimeOperator`, `serviceTimeProperty`, `passEmptyValues`). These are separate from the mandatory Earliest Start Permitted / Due Date rules (never emitted).
55
78
 
56
- - **React to scoping the user volunteers.** If while answering a rule's question the user signals the rule is only for a specific scenario, workforce, or work type — e.g. "only for part-time techs," "just for installation jobs," "tighter cap in France" — *then* pursue it: confirm the basis (Service Territory Member for a resource subset, Service Appointment for a work subset), get the Boolean field name, and record `relevanceGroup: { basis, booleanField }` on that rule. (First check the rule supports that basis under ES&O — see *Relevance Groups*.)
57
- - **Otherwise sweep for it once, at the end.** After all 16 rules are walked, ask a single closing question: *"Are there any constraints here that should apply only to a certain part of your workforce or to certain types of work — rather than to everyone/everything? For example, different break or travel limits for part-time vs. full-time techs, or stricter handling for a specific work type or region."* Only if the user says yes do you scope the affected rules (per the *Relevance Groups* section). If no, leave every `relevanceGroup` null.
79
+ **Interpreting and emitting break times (clock time vs. shift-start offset):** A Service Resource Availability rule expresses breaks in one of two shapes, and **this skill decides the shape and emits the values the data-layer skill needs** — the data-layer skill never receives a clock time it has to convert. Choose the shape as follows:
58
80
 
59
- Always include exactly one **Service Resource Availability** rule — the only mandatory rule this skill emits. Never emit Earliest Start Permitted or Due Date — provisioned automatically.
81
+ - **One fixed daily break at an absolute clock time** (e.g. "30 minutes at 12:00 every day") → emit it as an **absolute** break: `{ "mode": "absolute", "startClock": "12:00", "durationMinutes": 30 }`. No offset math, no working-day start needed.
82
+ - **One or more breaks defined as an offset from the start of the working day** (e.g. "a 30-minute lunch starting 3 hours into the shift") → emit each as an **offset** break, in **minutes from the start of the working day**: `{ "mode": "offset", "earliestStartOffsetMinutes": 180, "latestEndOffsetMinutes": 240, "durationMinutes": 30 }`. All three of `earliestStartOffsetMinutes`, `latestEndOffsetMinutes`, and `durationMinutes` are **mandatory** for an offset break. **When the user states the break in offset terms already** (e.g. "3 hours after the start of day"), that offset *is* `earliestStartOffsetMinutes` (180) — **do not ask for the working-day start; you don't need it.**
83
+ - **Breaks given as clock times but there is more than one** (e.g. "15 minutes at 10:00 and 30 minutes at 12:00") → you must use the **offset** shape, which means **converting each clock time into an offset from the start of the working day**. You cannot do that without knowing when the day starts, so **ask the user for the shift / working-day start**, then compute `earliestStartOffsetMinutes = (break start clock − day start)` in minutes for each break. Never assume the day starts at midnight (that would turn "10:00" into a wrong 600-minute offset). *(Only ask for the day start in this clock-time case — never when the break is already expressed as an offset.)*
60
84
 
61
- ---
85
+ **Always emit `latestEndOffsetMinutes` for every offset break — ask for it directly, do not fabricate a window.** The earliest start comes from what the user stated (an offset, or a converted clock time) — **do not invent ± tolerance windows around it** (no "±1 hour" / "±2 hour" options). If the user only gave a break start (or a duration with no stated finish-by), **ask them plainly for the latest the break may end**, phrased in the *same terms they used*: if they gave an offset ("starts 3 hours after start of day"), ask "what is the latest it may end, as time after the start of the day?" and convert (e.g. "4 hours after start" → 240); if they gave a clock time, ask for a clock time and convert with the day start. If the user says the break is fixed/pinned with no flex, set `latestEndOffsetMinutes = earliestStartOffsetMinutes + durationMinutes`. Never emit an offset break missing any of the three fields, and never guess the latest-end. If a break requirement is too involved to convert reliably, ask clarifying questions or recommend the manual approach rather than guessing.
86
+
87
+ **Maximum Travel from Home — establish the cap type, not the unit.** When a requirement caps how far a resource may travel from home, **ask the user whether the cap is by distance or by travel time** — the two are configured differently and the data-layer skill needs to know which. Emit the value and the type in `params`: `{ "maxTravelFromHome": 50, "maxTravelFromHomeType": "Distance" | "Travel Time" }`. Interpret the user's phrasing to set the *type* — "50 miles"/"50 km" ⇒ `Distance`, "45 minutes" ⇒ `Travel Time` — but **do not ask for or emit a distance unit (miles vs km): it is not part of the work-rule config**; the unit is governed by the org's locale/distance settings elsewhere, so the rule stores only the number. For `Travel Time` the value is minutes. Never emit the cap value without its type.
62
88
 
63
- ### The rules, in interview order
89
+ ### Per-rule configuration
64
90
 
65
- Take these in the order shown — it matches the table above. For each entry: **Applies when** tells you how to decide it's needed; **Ask** lists the config questions to ask *immediately* on a yes; **Emit** gives the exact `params` keys — use them verbatim so the data-layer skill can map them.
91
+ Once the requirements mapping has selected which rules to build, configure the specifics for each. The **`Emit` line gives the exact `params` keys** — use these verbatim so the data-layer skill can map them. Only configure rules the user selected; skip the rest.
66
92
 
67
93
  ---
68
94
 
69
- **1. Service Resource Availability** *(always present — the only mandatory rule)*
70
- Applies when: always. No applicability question.
95
+ **Service Resource Availability** *(always present)*
96
+ Gate: Always included — no selection needed.
71
97
  Ask:
72
98
  - "Can work run into **overtime**?" (yes/no)
73
99
  - "Can resources **travel outside working hours** to/from home?" — if yes, ask how many minutes from home (to first job) and to home (from last job); "no limit" = 120; "no" = 0 for both
74
- - Breaks interview (see *Interpreting and emitting break times* below)
100
+ - Breaks interview (see *Interpreting and emitting break times*)
75
101
 
76
102
  Emit: `{ "enableOvertime": true|false, "travelFromHomeMinutes": <number>, "travelToHomeMinutes": <number>, "breaks": [ … ] }`
77
- Note: Travel values are minutes — 0 = no travel outside working hours, 120 = effectively unlimited. If the user gives no availability detail, emit baseline (`enableOvertime: false`, travel keys and breaks omitted).
103
+ Note: Travel values are minutes — 0 = no travel outside working hours, 120 = effectively unlimited. If user gives no availability detail, emit baseline (`enableOvertime: false`, travel keys and breaks omitted).
78
104
 
79
105
  ---
80
106
 
81
- **2. Match Time Rule** *(arrival windows)*
82
- Applies when: appointments should honor customer **arrival windows** / required arrival times. Ask: "Should appointments honor customer arrival windows?"
83
- Emit: on a yes, emit the **two** default rules from the *Arrival Window Match Time rules* table below — do not ask the user to fill these in.
107
+ **Match Time Rule** *(arrival windows)*
108
+ Gate: Only if selected in requirements mapping.
109
+ Ask: "Should appointments honor customer **arrival windows**?"
110
+ Emit: Two default rules from the Arrival Window table — no further questions.
84
111
 
85
112
  ---
86
113
 
87
- **3. Match Skills**
88
- Applies when: resources need specific skills / proficiency levels.
114
+ **Match Skills**
115
+ Gate: Only if selected in requirements mapping.
89
116
  Ask: "Should the resource also **meet a minimum skill level** (proficiency), or is simply *having* the skill enough?"
90
117
  Emit: `{ "matchSkillLevel": true|false }`
91
118
  Note: Do not ask about skill-type AND/OR logic — this skill does not configure `skillTypeLogic`.
92
119
 
93
120
  ---
94
121
 
95
- **4. Match Fields**
96
- Applies when: one appointment field must match one resource field (1:1). (For one appointment field vs. multiple resource values, use Extended Match instead.)
122
+ **Match Fields**
123
+ Gate: Only if selected in requirements mapping.
97
124
  Ask: "Which Service Appointment field must match which Service Resource field, and with what operator?"
98
125
  Emit: `{ "serviceProperty": "<SA field>", "resourceProperty": "<resource field>", "booleanOperator": "=" }`
99
126
  Note: Operator is one of `=`, `>=`, `<=`, `>`, `<` (default `=`). Field names are the customer's own — pass through as given.
100
127
 
101
128
  ---
102
129
 
103
- **5. Match Boolean**
104
- Applies when: a checkbox on the resource must be true/false — including non-skill matching factors (e.g., serviceable postal codes).
130
+ **Match Boolean**
131
+ Gate: Only if selected in requirements mapping.
105
132
  Ask: "Which checkbox field on the resource must be true (or false)?"
106
133
  Emit: `{ "resourceProperty": "<resource field>", "value": true|false }`
107
134
  Note: Max 5 Match Boolean rules per policy.
108
135
 
109
136
  ---
110
137
 
111
- **6. Extended Match** *(advisory only — data-layer skill will not build this)*
112
- Applies when: custom-criteria matching via a junction object (e.g., serviceable postal codes, product lines).
113
- Ask: None — no params to collect. Advise the user to set up before deploying:
114
- 1. A junction object with exactly **two** Master-Detail relationships (to Service Resource + matched object) — packaged trigger requires exactly two or the rule fails
115
- 2. A Service Appointment Lookup field driving the match; a reference field on the junction matched against it
116
- 3. Once those exist, create and configure the rule manually in Setup (Field Service Settings → Scheduling → Work Rules)
117
-
118
- Capture intended objects/fields in `prerequisites` as advisory text — do not emit in `workRules[]`.
119
-
120
- ---
121
-
122
- **7. Match Territory** — *(skip entirely; not part of the interview)*
123
- This interview never emits a standalone Match Territory rule. **Skip it silently** — do not ask a Match Territory question, and do not announce or narrate that you are skipping it. Move straight from rule 6 to rule 8 with no mention of Match Territory at all. (If a user explicitly asks for primary/relocation-only territory scoping, advise manual configuration then — but never raise it yourself. Also: don't cover a resource by both Match Territory and Working Territories.)
138
+ **Maximum Travel from Home**
139
+ Gate: Only if selected in requirements mapping.
140
+ Ask: "Is the cap by **distance** or by **travel time**?" (see cap-type note in Requirements mapping)
141
+ Emit: `{ "maxTravelFromHome": <number>, "maxTravelFromHomeType": "Distance"|"Travel Time" }`
142
+ Note: Distance unit (miles vs km) is not part of the rule — governed by org locale. For Travel Time, value is minutes.
124
143
 
125
144
  ---
126
145
 
127
- **8. Working Territories**
128
- Applies when: work must be restricted to the resource's **primary and secondary** service territory memberships.
146
+ **Working Territories**
147
+ Gate: Only if selected in requirements mapping.
129
148
  Ask: None — selecting the rule is sufficient.
130
149
  Emit: `{ "workingLocationEnablePrimary": true }`
150
+ Note: No separate Match Territory question — the interview does not emit a standalone Match Territory rule. If primary/relocation-only scoping is needed, advise manual configuration.
131
151
 
132
152
  ---
133
153
 
134
- **9. Maximum Travel from Home**
135
- Applies when: capping distance/travel time between a resource's home and any assigned appointment / controlling travel cost across large territories.
136
- Ask: "Is the cap by **distance** or by **travel time**?" (see the cap-type note below), plus the cap value.
137
- Emit: `{ "maxTravelFromHome": <number>, "maxTravelFromHomeType": "Distance"|"Travel Time" }`
138
- Note: Distance unit (miles vs km) is not part of the rule — governed by org locale. For Travel Time, value is minutes.
139
-
140
- ---
154
+ **Service Crew Resources Availability**
155
+ Gate: Only if selected in requirements mapping.
156
+ Ask:
157
+ - "Should the rule evaluate individual crew members' availability and skills, not just the crew record?" → `considerCrewMembership`
158
+ - "What is the maximum number of extra resources beyond the base crew that can be pulled in?" → `maxAdditionalResources` (optional)
141
159
 
142
- **10. Required Resources** *(selection-only)*
143
- Applies when: any work order ever has a resource marked **Required** that must always be assigned. Ask: "Do any work orders ever have a specific resource marked *Required* that must always be assigned to that job?"
144
- Emit: `{}`
145
- Prerequisite: Resource Preference records must exist on the work order / WOLI — the rule enforces them but does not create them.
160
+ Emit: `{ "considerCrewMembership": true|false, "maxAdditionalResources": <number> }` (omit `maxAdditionalResources` if blank)
146
161
 
147
162
  ---
148
163
 
149
- **11. Excluded Resources** *(selection-only)*
150
- Applies when: any work order ever has a resource marked **Excluded** that must never be assigned. Ask: "Do any work orders ever have a resource marked *Excluded* that must never be assigned?"
151
- Emit: `{}`
152
- Prerequisite: Resource Preference records must exist on the work order / WOLI — the rule enforces them but does not create them.
164
+ **Extended Match** *(advisory only — data-layer skill will not build this)*
165
+ Gate: Only if selected in requirements mapping.
166
+ Ask: None — no params to collect.
167
+ Advise the user to set up before deploying:
168
+ 1. A junction object with exactly **two** Master-Detail relationships (to Service Resource + matched object) — packaged trigger requires exactly two or the rule fails
169
+ 2. A Service Appointment Lookup field driving the match; a reference field on the junction matched against it
170
+ 3. Once those exist, create and configure the rule manually in Setup (Field Service Settings → Scheduling → Work Rules)
171
+
172
+ Capture intended objects/fields in `prerequisites` as advisory text — do not emit in `workRules[]`.
153
173
 
154
174
  ---
155
175
 
156
- **12. Count Rule**
157
- Applies when: capping the number/duration of appointments (or a custom value) per resource per day.
176
+ **Count Rule**
177
+ Gate: Only if selected in requirements mapping.
158
178
  Ask: Have the user describe the limit in plain terms, then classify into:
159
179
  - `countBy` — `"Appointments"` (count of jobs), `"Hours"` (duration cap), or `"Custom"` (sum of a custom SA field)
160
180
  - `maxValue` — the numeric cap (for Hours, convert to hours)
@@ -165,67 +185,32 @@ Note: Time Resolution is always Daily; counted object is always Service Appointm
165
185
 
166
186
  ---
167
187
 
168
- **13. Work Capacity** *(ESO only — selection-only)*
169
- Applies when: Work Capacity Limit records cap how much work schedules per territory. Ask: "Do you use Work Capacity Limit records to cap how much work can be scheduled per territory?"
188
+ **Selection-only rules** *(no config fields — each rule acts as an on/off switch that tells the scheduler to enforce constraints defined elsewhere in the org; selected in requirements mapping, no further questions needed)*
189
+
190
+ **Required Resources / Excluded Resources**
191
+ Gate: Only if selected in requirements mapping.
170
192
  Emit: `{}`
171
- Prerequisite: WorkCapacityLimit records must be configured per territory outside the policy.
193
+ Prerequisite: Resource Preference records must exist on the work order / WOLI — the rule enforces them but does not create them.
172
194
 
173
- ---
195
+ **Work Capacity** *(ESO only)*
196
+ Gate: Only if selected in requirements mapping.
197
+ Emit: `{}`
198
+ Prerequisite: WorkCapacityLimit records must be configured per territory outside the policy.
174
199
 
175
- **14. Service Appointment Visiting Hours** *(selection-only)*
176
- Applies when: customers have allowed visit windows that should block scheduling outside those hours. Ask: "Do customers have allowed visit windows (e.g., weekdays only, or mornings only) that should block scheduling outside those hours?"
200
+ **Service Appointment Visiting Hours**
201
+ Gate: Only if selected in requirements mapping.
177
202
  Emit: `{}`
178
- Note: Do not ask for the windows — they are per-account data on OperatingHours records, not a policy-wide value. All-or-nothing rule — no relevance-group scoping.
203
+ Note: Do not ask for the windows — they are per-account data on OperatingHours records, not a policy-wide value. (No relevance-group scoping.)
179
204
  Prerequisite: Each account must have visiting/operating hours populated; the Work Order's Visiting Hours must resolve from the account.
180
205
 
181
- ---
182
-
183
- **15. TimeSlot Designated Work** *(selection-only)*
184
- Applies when: certain time slots must be reserved for specific types of work. Ask: "Do you need to reserve certain time slots for specific types of work (e.g., install work only in morning slots)?"
206
+ **TimeSlot Designated Work**
207
+ Gate: Only if selected in requirements mapping.
185
208
  Emit: `{}`
186
- Note: Do not ask for slot→work mappings — that is data setup. Phrase the selection as "types of work," not "Work Type" (the designation is broader than the Work Type object). All-or-nothing rule — no relevance-group scoping.
209
+ Note: Do not ask for slot→work mappings — that is data setup. Phrase the selection as "types of work," not "Work Type" (the designation is broader than the Work Type object). (No relevance-group scoping.)
187
210
  Prerequisite: Time slots must be configured to designate the intended work.
188
211
 
189
212
  ---
190
213
 
191
- **16. Service Crew Resources Availability**
192
- Applies when: crew-type resources must only be assigned when the crew meets the parent record's minimum crew size.
193
- Ask:
194
- - "Should the rule evaluate individual crew members' availability and skills, not just the crew record?" → `considerCrewMembership`
195
- - "What is the maximum number of extra resources beyond the base crew that can be pulled in?" → `maxAdditionalResources` (optional)
196
-
197
- Emit: `{ "considerCrewMembership": true|false, "maxAdditionalResources": <number> }` (omit `maxAdditionalResources` if blank)
198
-
199
- ---
200
-
201
- ### Configuration reference notes
202
-
203
- These deep-dives support the **Ask** lines above; consult them when configuring the rule that references them.
204
-
205
- **Arrival Window Match Time rules (default pair — rule 2).** When the user confirms appointments should honor customer arrival windows, emit **two** Match Time rules with these exact default settings — do not ask the user to fill these in, they are the standard arrival-window configuration:
206
-
207
- | Setting | Rule A | Rule B |
208
- |---|---|---|
209
- | Name | `Arrival Window Start` | `Arrival Window End` |
210
- | Service Schedule Time Property | `SchedStartTime` | `SchedStartTime` |
211
- | Service Time Operator | `Later than or Equal to` | `Before or Equal to` |
212
- | Service Time Property | `ArrivalWindowStartTime` | `ArrivalWindowEndTime` |
213
- | Pass Empty Values | `true` | `true` |
214
-
215
- Emit each as a Match Time work rule whose `params` carry those four values (keys `serviceScheduleTimeProperty`, `serviceTimeOperator`, `serviceTimeProperty`, `passEmptyValues`). These are separate from the mandatory Earliest Start Permitted / Due Date rules (never emitted).
216
-
217
- **Interpreting and emitting break times — clock time vs. shift-start offset (rule 1).** A Service Resource Availability rule expresses breaks in one of two shapes, and **this skill decides the shape and emits the values the data-layer skill needs** — the data-layer skill never receives a clock time it has to convert. Choose the shape as follows:
218
-
219
- - **One fixed daily break at an absolute clock time** (e.g. "30 minutes at 12:00 every day") → emit it as an **absolute** break: `{ "mode": "absolute", "startClock": "12:00", "durationMinutes": 30 }`. No offset math, no working-day start needed.
220
- - **One or more breaks defined as an offset from the start of the working day** (e.g. "a 30-minute lunch starting 3 hours into the shift") → emit each as an **offset** break, in **minutes from the start of the working day**: `{ "mode": "offset", "earliestStartOffsetMinutes": 180, "latestEndOffsetMinutes": 240, "durationMinutes": 30 }`. All three of `earliestStartOffsetMinutes`, `latestEndOffsetMinutes`, and `durationMinutes` are **mandatory** for an offset break. **When the user states the break in offset terms already** (e.g. "3 hours after the start of day"), that offset *is* `earliestStartOffsetMinutes` (180) — **do not ask for the working-day start; you don't need it.**
221
- - **Breaks given as clock times but there is more than one** (e.g. "15 minutes at 10:00 and 30 minutes at 12:00") → you must use the **offset** shape, which means **converting each clock time into an offset from the start of the working day**. You cannot do that without knowing when the day starts, so **ask the user for the shift / working-day start**, then compute `earliestStartOffsetMinutes = (break start clock − day start)` in minutes for each break. Never assume the day starts at midnight (that would turn "10:00" into a wrong 600-minute offset). *(Only ask for the day start in this clock-time case — never when the break is already expressed as an offset.)*
222
-
223
- **Always emit `latestEndOffsetMinutes` for every offset break — ask for it directly, do not fabricate a window.** The earliest start comes from what the user stated (an offset, or a converted clock time) — **do not invent ± tolerance windows around it** (no "±1 hour" / "±2 hour" options). If the user only gave a break start (or a duration with no stated finish-by), **ask them plainly for the latest the break may end**, phrased in the *same terms they used*: if they gave an offset ("starts 3 hours after start of day"), ask "what is the latest it may end, as time after the start of the day?" and convert (e.g. "4 hours after start" → 240); if they gave a clock time, ask for a clock time and convert with the day start. If the user says the break is fixed/pinned with no flex, set `latestEndOffsetMinutes = earliestStartOffsetMinutes + durationMinutes`. Never emit an offset break missing any of the three fields, and never guess the latest-end. If a break requirement is too involved to convert reliably, ask clarifying questions or recommend the manual approach rather than guessing.
224
-
225
- **Maximum Travel from Home — establish the cap type, not the unit (rule 9).** When a requirement caps how far a resource may travel from home, **ask the user whether the cap is by distance or by travel time** — the two are configured differently and the data-layer skill needs to know which. Emit the value and the type in `params`: `{ "maxTravelFromHome": 50, "maxTravelFromHomeType": "Distance" | "Travel Time" }`. Interpret the user's phrasing to set the *type* — "50 miles"/"50 km" ⇒ `Distance`, "45 minutes" ⇒ `Travel Time` — but **do not ask for or emit a distance unit (miles vs km): it is not part of the work-rule config**; the unit is governed by the org's locale/distance settings elsewhere, so the rule stores only the number. For `Travel Time` the value is minutes. Never emit the cap value without its type.
226
-
227
- ---
228
-
229
214
  ## Relevance Groups
230
215
 
231
216
  A relevance group scopes a single work rule or service objective so it applies only to certain appointments or resources, instead of the whole policy. This lets one policy hold different logic for different work or resource types — e.g., different break/travel limits for part-time vs. full-time employees, or expedited scheduling for high-value accounts.