@htilabs/platform-common-models 0.34.0 → 0.36.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 (52) hide show
  1. package/README.md +135 -0
  2. package/dist/constants/index.cjs +2 -0
  3. package/dist/constants/index.cjs.map +1 -1
  4. package/dist/constants/index.js +2 -0
  5. package/dist/constants/index.js.map +1 -1
  6. package/dist/{cvcEntry-DAuhe0cd.d.cts → cvcEntry-BqAGctqK.d.cts} +36 -36
  7. package/dist/{cvcEntry-DAuhe0cd.d.ts → cvcEntry-BqAGctqK.d.ts} +36 -36
  8. package/dist/{index-1pWiqEBC.d.cts → index-BTqHP4DM.d.cts} +1 -1
  9. package/dist/{index-uz57Fic9.d.ts → index-Dr6GBCoY.d.ts} +1 -1
  10. package/dist/index.cjs +2 -0
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +2 -2
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +2 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/models/index.d.cts +2 -2
  17. package/dist/models/index.d.ts +2 -2
  18. package/dist/org-directory/index.cjs +4 -3
  19. package/dist/org-directory/index.cjs.map +1 -1
  20. package/dist/org-directory/index.d.cts +22 -6
  21. package/dist/org-directory/index.d.ts +22 -6
  22. package/dist/org-directory/index.js +4 -3
  23. package/dist/org-directory/index.js.map +1 -1
  24. package/dist/points-of-contact/index.cjs +6 -3
  25. package/dist/points-of-contact/index.cjs.map +1 -1
  26. package/dist/points-of-contact/index.js +6 -3
  27. package/dist/points-of-contact/index.js.map +1 -1
  28. package/dist/schemas/index.d.cts +11 -11
  29. package/dist/schemas/index.d.ts +11 -11
  30. package/dist/share-review/index.cjs +301 -0
  31. package/dist/share-review/index.cjs.map +1 -0
  32. package/dist/share-review/index.d.cts +431 -0
  33. package/dist/share-review/index.d.ts +431 -0
  34. package/dist/share-review/index.js +263 -0
  35. package/dist/share-review/index.js.map +1 -0
  36. package/package.json +11 -1
  37. package/src/__sot__/README.md +2 -0
  38. package/src/__sot__/captureConflictSemantics.pin.json +156 -0
  39. package/src/generated/captureConflictSemantics.ts +200 -0
  40. package/src/orgDirectory/__tests__/orgDirectory.test.ts +60 -0
  41. package/src/orgDirectory/rules.ts +26 -9
  42. package/src/pointsOfContact/__tests__/writer.test.ts +15 -0
  43. package/src/shareReview/__tests__/captureConflictSemantics.test.ts +148 -0
  44. package/src/shareReview/__tests__/captureConflictSemanticsPin.test.ts +78 -0
  45. package/src/shareReview/__tests__/recommendedDecision.test.ts +35 -0
  46. package/src/shareReview/__tests__/reviewDecision.test.ts +102 -0
  47. package/src/shareReview/__tests__/shareFieldReviewPlan.test.ts +523 -0
  48. package/src/shareReview/captureConflictSemantics.ts +170 -0
  49. package/src/shareReview/index.ts +23 -0
  50. package/src/shareReview/recommendedDecision.ts +21 -0
  51. package/src/shareReview/reviewDecision.ts +71 -0
  52. package/src/shareReview/shareFieldReviewPlan.ts +288 -0
@@ -0,0 +1,431 @@
1
+ /**
2
+ * The REVIEW DECISION vocabulary — what a reviewer may record against one
3
+ * offered value in an inbound CaseShare review.
4
+ *
5
+ * Lifted from pave-2.0 packages/domain/src/reviewDecision.ts @ 312943078
6
+ * (th-hbo9t.2); the code is unchanged, the prose is trimmed to this package.
7
+ *
8
+ * One vocabulary over one persisted decision column: {@link FieldOfferDecision}
9
+ * in `shareFieldReviewPlan` is an alias of {@link ReviewDecision}. Which of
10
+ * the seven a given ROW admits is `isOfferedForRow` (the write gate), not this
11
+ * list.
12
+ *
13
+ * add — the offered value JOINS what is there. Recorded on an
14
+ * add row (pre-accepted; also the display-choice and the
15
+ * re-flag reset in the prototype). Never resolves a
16
+ * conflict.
17
+ * theirs_current — `log_end_date_current` only. Theirs becomes current and
18
+ * mine end-dates today.
19
+ * mine_current — `log_end_date_current` only. Mine stays current and
20
+ * theirs joins history.
21
+ * replace — take theirs. Mine stays in history by supersession,
22
+ * never deletion.
23
+ * keep_mine — keep mine; theirs is not adopted.
24
+ * keep_both_flagged — "I don't know yet." Keep BOTH and raise an open-conflict
25
+ * marker on the record. Resolves a conflict without
26
+ * deciding it, which is why an unauthored fallback can
27
+ * never destroy information.
28
+ * exclude — decline the offer outright, WITH a structured reason
29
+ * code. Distinct from `keep_mine`: that one resolves a
30
+ * conflict in favour of the held value, this one refuses
31
+ * the offer and tells the sender why.
32
+ */
33
+ declare const REVIEW_DECISIONS: readonly ["add", "theirs_current", "mine_current", "replace", "keep_mine", "keep_both_flagged", "exclude"];
34
+ type ReviewDecision = (typeof REVIEW_DECISIONS)[number];
35
+ /**
36
+ * Whether an arbitrary value is a review decision.
37
+ *
38
+ * An ALLOWLIST, deliberately — never `v != null && v !== "add"` or any other
39
+ * negation. A persisted decision column typically carries no enum, so the
40
+ * values that actually reach this are unconstrained: `""`, `" "`, `0`,
41
+ * `false`, `{}` and any arbitrary string all arrive. Every one of those passes
42
+ * a negation and fails this.
43
+ *
44
+ * That asymmetry is the whole point. A wrong answer here in the permissive
45
+ * direction admits a decision nobody offered onto a survivor record; a wrong
46
+ * answer in the strict direction refuses a legitimate one loudly. Only the
47
+ * second is recoverable.
48
+ */
49
+ declare function isReviewDecision(value: unknown): value is ReviewDecision;
50
+
51
+ /**
52
+ * How a CONFLICT between two values of the same captured field resolves at
53
+ * review time. Vocabulary fixed by the registry validator.
54
+ *
55
+ * - `additive_log` — entries add; never a conflict (a NAME is never a conflict,
56
+ * at most a display question).
57
+ * - `log_end_date_current` — one current entry + dated history; a conflict
58
+ * resolves by END-DATING one entry, BOTH kept.
59
+ * - `single_value_keep_replace` — true one-value facts; keep/replace by
60
+ * supersession, never deletion.
61
+ * - `no_conflict_derived` — the value never conflicts because it is derived.
62
+ */
63
+ declare const CAPTURE_CONFLICT_SEMANTICS: readonly ["additive_log", "log_end_date_current", "single_value_keep_replace", "no_conflict_derived"];
64
+ type CaptureConflictSemantics = (typeof CAPTURE_CONFLICT_SEMANTICS)[number];
65
+ /** Authored semantics keyed by registry field id (`capture.*` and kin). */
66
+ declare const CAPTURE_CONFLICT_SEMANTICS_BY_FIELD: Readonly<Record<string, CaptureConflictSemantics>>;
67
+ /** Provenance of the pin this module was emitted from. */
68
+ declare const CAPTURE_CONFLICT_SEMANTICS_SOURCE: Readonly<{
69
+ repo: "htilabstech/hti-features";
70
+ path: "src/hti_features/field_mapping/registry.json";
71
+ commit: "ed3a1f9";
72
+ registryVersion: 1;
73
+ /** Captured rows in the registry — the denominator for the sparse table. */
74
+ capturedRowCount: 533;
75
+ /** Rows that author a value — the size of the table above. */
76
+ authoredCount: 141;
77
+ }>;
78
+
79
+ /**
80
+ * The CAPTURE CONFLICT SEMANTICS axis of an inbound CaseShare review.
81
+ *
82
+ * Lifted from pave-2.0 packages/domain/src/captureConflictSemantics.ts @ 312943078
83
+ * (th-hbo9t.2, Thread ADR-THREAD-CASESHARE-INBOUND-REVIEW D-b / D-e) and RE-KEYED:
84
+ * PAVE looked semantics up by its `assertion_domain`; this kernel looks them up by
85
+ * the hti-features registry FIELD id (`capture.living_situation`, …), the key the
86
+ * registry authors at and the prototype's `window.HTI_CAPTURE_CONFLICT_SEMANTICS`
87
+ * block carries. A consumer maps its own carried fields to registry ids (Thread:
88
+ * the D-e differ table); the kernel never sees an app's field names.
89
+ *
90
+ * Answers ONE question, for one captured field: when the sender's value and the
91
+ * recipient's value disagree, what is the reviewer allowed to choose?
92
+ *
93
+ * ## UNAUTHORED IS NOT A VALUE
94
+ *
95
+ * The registry key is OPTIONAL and captured-rows-only, so for most captured
96
+ * fields NOBODY HAS RULED (the counts are in `CAPTURE_CONFLICT_SEMANTICS_SOURCE`).
97
+ * That is a distinct fact from every member of the vocabulary.
98
+ * {@link resolvedSemantics} therefore always reports `authored` alongside the
99
+ * value, and labels the fallback by `rulePath` rather than presenting it as a
100
+ * ruling.
101
+ *
102
+ * The fallback is `single_value_keep_replace`, which is not a guess: it is the
103
+ * prototype's own observed fallback. Its conflict-row render branches on
104
+ * `semantics === "log_end_date_current"` and gives EVERY other value the
105
+ * keep/replace pair (canon c2b0b8b0 `conflictRowHtml`, L351609-L351615).
106
+ *
107
+ * It is also the safe direction. `additive_log` resolves a disagreement by
108
+ * keeping both values silently; applying that to a true one-value fact (a vital
109
+ * status, a date of birth) would leave two contradictory "current" values with
110
+ * no conflict ever surfaced. `single_value_keep_replace` forces the reviewer to
111
+ * look — and because `keep_both_flagged` and `exclude` are offered on EVERY
112
+ * conflict regardless of semantics (L351616-L351617), the fallback never forces
113
+ * a value away.
114
+ *
115
+ * This module answers a FIELD question. Which decision a given review ROW
116
+ * admits (the write gate) also depends on the row's bucket, and is answered by
117
+ * `isOfferedForRow` in `shareFieldReviewPlan.ts`.
118
+ *
119
+ * ## Where the four values come from
120
+ *
121
+ * Not from here. `src/generated/captureConflictSemantics.ts` is generated from
122
+ * the hti-features field_mapping registry by
123
+ * `scripts/gen-capture-conflict-semantics.ts`; never hand-edit it.
124
+ */
125
+ /** A decision a reviewer can record against one conflict. */
126
+ type CaptureConflictDecision =
127
+ /** `log_end_date_current` only — theirs becomes current, mine end-dates today. */
128
+ "theirs_current"
129
+ /** `log_end_date_current` only — mine stays current, theirs joins history. */
130
+ | "mine_current"
131
+ /** Take theirs; mine stays in history by supersession, never deletion. */
132
+ | "replace"
133
+ /** Keep mine; theirs is not adopted. */
134
+ | "keep_mine"
135
+ /**
136
+ * "I don't know yet" — keep BOTH and flag the open conflict on the record.
137
+ *
138
+ * First-class and NON-BLOCKING: the registry doc states it "UNBLOCKS
139
+ * approval", and the prototype offers it on every conflict irrespective of
140
+ * semantics. It is the reason the unauthored fallback cannot destroy
141
+ * information — there is always an escape that decides nothing.
142
+ */
143
+ | "keep_both_flagged"
144
+ /**
145
+ * Decline the offer outright, with a structured reason code.
146
+ *
147
+ * Offered on every conflict row, like `keep_both_flagged` — the prototype
148
+ * renders "Don't bring theirs in…" outside the semantics branch (L351617).
149
+ * NOT in {@link ResolvedCaptureConflictSemantics.choices}: that list is the
150
+ * semantics-driven resolution set, and declining is a different act on a
151
+ * different control carrying a reason code. The row gate `isOfferedForRow`
152
+ * (shareFieldReviewPlan.ts) accounts for it separately.
153
+ */
154
+ | "exclude";
155
+ /** Why {@link resolvedSemantics} returned the value it did. */
156
+ type CaptureConflictRulePath =
157
+ /** The registry authors this field explicitly. */
158
+ "registry_authored"
159
+ /** No upstream ruling; fell back to the prototype's own default branch. */
160
+ | "unauthored_default_keep_replace";
161
+ interface ResolvedCaptureConflictSemantics {
162
+ /** The semantics in force — authored or fallen back to. */
163
+ semantics: CaptureConflictSemantics;
164
+ /**
165
+ * Whether the registry actually authored this field.
166
+ *
167
+ * `false` does NOT mean "no conflict semantics apply" — `semantics` still
168
+ * carries the operative value. It means no human upstream has ruled, so a
169
+ * caller that wants to report coverage, or to prompt for authoring, can tell
170
+ * the difference.
171
+ */
172
+ authored: boolean;
173
+ /** Which fact decided. Never omitted, so any resolution can be explained. */
174
+ rulePath: CaptureConflictRulePath;
175
+ /**
176
+ * Whether a disagreement on this field is a CONFLICT a reviewer must resolve.
177
+ *
178
+ * False for `additive_log` ("entries add — never a conflict") and for
179
+ * `no_conflict_derived` ("the value never conflicts because it is derived").
180
+ * Those offers are adopted without blocking the review.
181
+ */
182
+ producesConflict: boolean;
183
+ /**
184
+ * The resolution decisions offered, in the prototype's render order.
185
+ *
186
+ * `keep_both_flagged` is ALWAYS last and ALWAYS present when there is a
187
+ * conflict. Empty when `producesConflict` is false — nothing to decide.
188
+ */
189
+ choices: readonly CaptureConflictDecision[];
190
+ }
191
+ /**
192
+ * Resolve the review semantics for one registry field id.
193
+ *
194
+ * Total: every field resolves, because an unauthored one falls back rather
195
+ * than returning nothing. A resolver that could return "unknown" would put the
196
+ * branch in every caller, and the callers would not agree on it.
197
+ */
198
+ declare function resolvedSemantics(fieldId: string): ResolvedCaptureConflictSemantics;
199
+
200
+ /**
201
+ * The FIELD-GRAIN REVIEW PLAN of an inbound CaseShare.
202
+ *
203
+ * Lifted from pave-2.0 packages/domain/src/shareFieldReviewPlan.ts @ 312943078
204
+ * (th-hbo9t.2, Thread ADR-THREAD-CASESHARE-INBOUND-REVIEW D-b), with these changes:
205
+ *
206
+ * - RE-KEYED by registry field id (`fieldId`, e.g. `capture.living_situation`)
207
+ * instead of PAVE's `assertionDomain`.
208
+ * - PAVE's `unverified` bucket (and its tri-state `targetHeld: "unknown"` input)
209
+ * is DROPPED. It is a PAVE-only extra with no canon counterpart: canon has
210
+ * exactly two row kinds, adds and conflicts (`addsOf` / `conflictsOf`, canon
211
+ * c2b0b8b0 L351462-L351463). A caller that cannot establish the held side must
212
+ * not call the planner for that row as if it had.
213
+ * - PAVE's `survivorDeclined` input (its demographics decline lane) is DROPPED.
214
+ * It is a PAVE survivor-record rule, not part of the share-review kernel; a
215
+ * consumer with such a rule applies it before planning.
216
+ * - Decisions are judged PER ROW by one rule, {@link isOfferedForRow}: it is
217
+ * both the write gate and what decides whether a conflict is resolved.
218
+ * - The name display-question row cannot be excluded (canon renders only the
219
+ * two display buttons there), and derived fields get their own rule path.
220
+ *
221
+ * ## Two kinds, and only one of them blocks
222
+ *
223
+ * - An **add** is pre-accepted. The recipient holds nothing that competes, or
224
+ * the field's semantics say entries accumulate or are derived. It does NOT
225
+ * hold up approval.
226
+ * - A **conflict** is blocking until decided. Two values compete and the
227
+ * field's semantics say only one can be current, so a human has to choose.
228
+ *
229
+ * `blockingRemaining` counts undecided conflicts and nothing else — canon's
230
+ * `undecidedCount` is `conflictsOf(s).filter(c => !c.decision).length` (L351464).
231
+ *
232
+ * ## Input contracts
233
+ *
234
+ * - **Only offered fields are planned.** A field the sender did not send (no
235
+ * incoming value) is never an input: there is nothing to add or to decide.
236
+ * Canon builds rows only from the delivered payload (`payload.forEach`,
237
+ * L348703). The planner never synthesizes a row.
238
+ * - **An identical held value is not competing.** When the recipient already
239
+ * holds the same value the sender offers, the caller passes
240
+ * `targetPopulated: false`; the row is a no-op add, never a conflict. (Canon's
241
+ * re-review skips an unchanged value the same way, L348712.)
242
+ *
243
+ * ## NO VALUES CROSS THIS BOUNDARY
244
+ *
245
+ * The planner takes `targetPopulated: boolean`, never the held value and never
246
+ * the incoming one. Bucketing needs to know THAT a value competes, never WHAT
247
+ * it is, so the plan can be computed without a plaintext survivor value in scope.
248
+ */
249
+ /** One incoming field offer, reduced to what bucketing actually needs. */
250
+ interface FieldOfferInput {
251
+ /** Stable id of this offer within the share — the handle a decision pulls by. */
252
+ offerId: string;
253
+ /**
254
+ * The hti-features registry field id (`capture.*` and kin). Drives the
255
+ * semantics lookup. Only fields the sender actually offered are planned.
256
+ */
257
+ fieldId: string;
258
+ /**
259
+ * Whether the RECIPIENT already holds a DIFFERENT value for this field.
260
+ *
261
+ * Strictly boolean, and the caller must mean it:
262
+ * - `false` when the recipient looked and holds nothing, or holds exactly the
263
+ * offered value (an identical value does not compete);
264
+ * - `true` only when a different held value competes.
265
+ *
266
+ * It must not be used for "we did not check": that reads as "nothing
267
+ * competes" and pre-accepts an offer that should have been a conflict.
268
+ */
269
+ targetPopulated: boolean;
270
+ /** The recorded decision, when the reviewer has made one. */
271
+ decision?: FieldOfferDecision | null;
272
+ }
273
+ /**
274
+ * A decision recorded against an offer — an alias of {@link ReviewDecision}, so
275
+ * there is one vocabulary underneath. Which members a ROW admits is
276
+ * {@link isOfferedForRow}.
277
+ */
278
+ type FieldOfferDecision = ReviewDecision;
279
+ /**
280
+ * The name display-question's two answers: keep the current display name, or
281
+ * display the incoming one. Canon's `data-rvw-display` buttons (c2b0b8b0
282
+ * L351554-L351555); the click records `display_choice` AND `decision = "add"`
283
+ * (L351893) — both names join the name log either way.
284
+ */
285
+ declare const DISPLAY_CHOICES: readonly ["keep", "incoming"];
286
+ type DisplayChoice = (typeof DISPLAY_CHOICES)[number];
287
+ /** Why an offer landed in the bucket it did. */
288
+ type FieldOfferRulePath =
289
+ /** Nothing (different) competes on the recipient side — no question to ask. */
290
+ "no_held_value"
291
+ /** A value competes, but the field's semantics say entries accumulate. */
292
+ | "additive_never_conflicts"
293
+ /**
294
+ * A value competes, but the field is `no_conflict_derived`. Bucketed as an
295
+ * add (non-blocking, no choices). The prototype is SILENT on whether a
296
+ * derived value offered in a share is adopted as sent or recomputed by the
297
+ * recipient; this kernel decides only that it never blocks review.
298
+ */
299
+ | "derived_never_conflicts"
300
+ /** A value competes and only one can be current. A human must choose. */
301
+ | "conflict_requires_decision";
302
+ interface PlannedFieldOfferBase {
303
+ offerId: string;
304
+ fieldId: string;
305
+ bucket: "add" | "conflict";
306
+ /**
307
+ * Whether this row is holding up approval RIGHT NOW.
308
+ *
309
+ * Only a conflict without an OFFERED decision ({@link isOfferedForRow}) blocks.
310
+ * An add never does — including one the reviewer has not touched.
311
+ */
312
+ blocking: boolean;
313
+ /** The semantics in force, authored or fallen back to. */
314
+ semantics: CaptureConflictSemantics;
315
+ /** Whether the registry actually authored those semantics. */
316
+ semanticsAuthored: boolean;
317
+ /**
318
+ * The conflict-resolution choices offered (`keep_both_flagged` always last).
319
+ * Empty for an add — there is nothing to resolve. `exclude` is separate; see
320
+ * `canExclude`.
321
+ */
322
+ choices: readonly CaptureConflictDecision[];
323
+ rulePath: FieldOfferRulePath;
324
+ }
325
+ /**
326
+ * One planned row. `displayQuestion` and `canExclude` are typed together:
327
+ *
328
+ * - A **display-question** row (`capture.name` over a held name) asks only
329
+ * which name displays; it CANNOT be excluded. Canon's add row renders the two
330
+ * display buttons in the `display_question` branch and "Don't add this…" only
331
+ * in the `else if` branch (c2b0b8b0 L351542-L351569); "Two names never
332
+ * conflict; the only question is which one displays" (L346745).
333
+ * - Every other row can be declined with a reason (`exclude`).
334
+ */
335
+ type PlannedFieldOffer = PlannedFieldOfferBase & ({
336
+ /** The record shows ONE name; the reviewer chooses which ({@link DisplayChoice}). */
337
+ displayQuestion: true;
338
+ canExclude: false;
339
+ } | {
340
+ displayQuestion: false;
341
+ /** Declining the offer, with a structured reason code, is available. */
342
+ canExclude: true;
343
+ });
344
+ interface FieldReviewPlan {
345
+ /** Pre-accepted offers, in input order. */
346
+ adds: PlannedFieldOffer[];
347
+ /** Competing offers, in input order. */
348
+ conflicts: PlannedFieldOffer[];
349
+ /**
350
+ * Undecided conflicts. The number the surface shows and approval gates on.
351
+ *
352
+ * Zero does NOT mean the review is empty — a share of nothing but adds
353
+ * reports zero here and still has rows to render.
354
+ */
355
+ blockingRemaining: number;
356
+ }
357
+ /**
358
+ * Fields where the record displays ONE representative value while the log
359
+ * holds many, so a second value raises a display question instead of a
360
+ * conflict. Deliberately narrow: the prototype sets `display_question: true` on
361
+ * the name add and on no other row (L346745). A record shows every phone it
362
+ * holds, but ONE name.
363
+ */
364
+ declare const DISPLAY_REPRESENTATIVE_FIELDS: ReadonlySet<string>;
365
+ /**
366
+ * THE row gate: whether `decision` is one this review row admits.
367
+ *
368
+ * The write side MUST call this before persisting a decision, and the planner
369
+ * uses the same rule to decide whether a conflict is resolved — one rule, so a
370
+ * decision the surface would refuse can never clear a blocking row.
371
+ *
372
+ * - **Add row** → `add` (canon writes it on add rows: the seed, the display
373
+ * choice L351893, the re-flag reset L348744), plus `exclude` when the row
374
+ * `canExclude` (not on the name display question).
375
+ * - **Conflict row** → the field's semantics `choices` (the end-date pair OR
376
+ * keep/replace, canon L351609-L351615, plus `keep_both_flagged` L351616) and
377
+ * `exclude` (L351617). Never `add`, and never the OTHER semantics' pair:
378
+ * `replace` does not resolve an end-date conflict, `mine_current` does not
379
+ * resolve a keep/replace one.
380
+ *
381
+ * An allowlist over `unknown`: `""`, `null`, `0`, `{}` and arbitrary strings
382
+ * are refused.
383
+ */
384
+ declare function isOfferedForRow(row: Pick<PlannedFieldOfferBase, "bucket" | "choices"> & {
385
+ canExclude: boolean;
386
+ }, decision: unknown): decision is FieldOfferDecision;
387
+ /**
388
+ * Plan one share's field review.
389
+ *
390
+ * Pure and total: every offer lands in exactly one bucket, so the two arrays
391
+ * always partition the input and no offer can be dropped by falling through.
392
+ */
393
+ declare function planFieldReview(offers: readonly FieldOfferInput[]): FieldReviewPlan;
394
+ /**
395
+ * Whether the FIELD REVIEW is settled — no conflict is still undecided.
396
+ *
397
+ * ## NOT the whole approve gate
398
+ *
399
+ * This answers ONE condition. Canon's approve path also requires the share to
400
+ * be linked to a case before it looks at any decision (`case_not_linked`, canon
401
+ * c2b0b8b0 L348504); a caller treating this function as THE gate would approve
402
+ * an unlinked share. Named for what it measures so the caller still has to ask
403
+ * the other question.
404
+ *
405
+ * ## Recompute; never trust a stored counter
406
+ *
407
+ * Derive this from the conflicts at the moment of approving; do not read a
408
+ * denormalized per-share counter. An unclaimed share can carry a zero counter
409
+ * while holding undecided conflicts, because its review has not started.
410
+ */
411
+ declare function canApproveReview(plan: FieldReviewPlan): boolean;
412
+
413
+ /**
414
+ * Which decision a conflict-row recommendation (or "Accept all") resolves to.
415
+ *
416
+ * Lifted from pave-2.0 packages/composites/src/CaseShareReviewTakeover/
417
+ * RecommendationAssist.tsx @ 312943078 (th-hbo9t.2), where it sat in a React
418
+ * module; it is pure, so it lives in the kernel.
419
+ *
420
+ * Branches on SEMANTICS, exactly as the prototype's handlers do — per-row Apply
421
+ * (canon c2b0b8b0 L351836) and bulk "Accept all" over undecided conflicts
422
+ * (L351827): `log_end_date_current` → `theirs_current`, every other value →
423
+ * `replace`. Not on a stored `recommend.value`: the prototype's seed rows carry
424
+ * that field and its handlers never read it.
425
+ *
426
+ * Either way nothing is destroyed — the held value joins the history (end-dated
427
+ * or superseded).
428
+ */
429
+ declare function recommendedDecision(semantics: string): ReviewDecision;
430
+
431
+ export { CAPTURE_CONFLICT_SEMANTICS, CAPTURE_CONFLICT_SEMANTICS_BY_FIELD, CAPTURE_CONFLICT_SEMANTICS_SOURCE, type CaptureConflictDecision, type CaptureConflictRulePath, type CaptureConflictSemantics, DISPLAY_CHOICES, DISPLAY_REPRESENTATIVE_FIELDS, type DisplayChoice, type FieldOfferDecision, type FieldOfferInput, type FieldOfferRulePath, type FieldReviewPlan, type PlannedFieldOffer, REVIEW_DECISIONS, type ResolvedCaptureConflictSemantics, type ReviewDecision, canApproveReview, isOfferedForRow, isReviewDecision, planFieldReview, recommendedDecision, resolvedSemantics };