@burdenoff/fe-libs 2026.1009.2 → 2026.1010.2

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 (58) hide show
  1. package/dist/shared/assistant/appControls/grammar.js +48 -41
  2. package/dist/shared/assistant/appControls/languages.d.ts +2 -0
  3. package/dist/shared/assistant/appControls/languages.js +8 -5
  4. package/dist/shared/assistant/index.d.ts +18 -0
  5. package/dist/shared/assistant/localUiCommands.d.ts +33 -0
  6. package/dist/shared/assistant/localUiCommands.js +159 -88
  7. package/dist/shared/assistant/localeCommands/active.d.ts +19 -0
  8. package/dist/shared/assistant/localeCommands/active.js +25 -0
  9. package/dist/shared/assistant/localeCommands/assent.d.ts +25 -0
  10. package/dist/shared/assistant/localeCommands/assent.js +78 -0
  11. package/dist/shared/assistant/localeCommands/engine.d.ts +89 -0
  12. package/dist/shared/assistant/localeCommands/engine.js +351 -0
  13. package/dist/shared/assistant/localeCommands/evaluate.d.ts +77 -0
  14. package/dist/shared/assistant/localeCommands/evaluate.js +180 -0
  15. package/dist/shared/assistant/localeCommands/fold.d.ts +17 -0
  16. package/dist/shared/assistant/localeCommands/fold.js +66 -0
  17. package/dist/shared/assistant/localeCommands/frames.d.ts +23 -0
  18. package/dist/shared/assistant/localeCommands/frames.js +150 -0
  19. package/dist/shared/assistant/localeCommands/gate.d.ts +37 -0
  20. package/dist/shared/assistant/localeCommands/gate.js +137 -0
  21. package/dist/shared/assistant/localeCommands/languageNames.d.ts +11 -0
  22. package/dist/shared/assistant/localeCommands/languageNames.js +53 -0
  23. package/dist/shared/assistant/localeCommands/nameForms.d.ts +21 -0
  24. package/dist/shared/assistant/localeCommands/nameForms.js +44 -0
  25. package/dist/shared/assistant/localeCommands/normalise.d.ts +49 -0
  26. package/dist/shared/assistant/localeCommands/normalise.js +87 -0
  27. package/dist/shared/assistant/localeCommands/symbols.d.ts +8 -0
  28. package/dist/shared/assistant/localeCommands/symbols.js +6 -0
  29. package/dist/shared/assistant/localeCommands/tables/ar.d.ts +10 -0
  30. package/dist/shared/assistant/localeCommands/tables/ar.js +343 -0
  31. package/dist/shared/assistant/localeCommands/tables/en.d.ts +12 -0
  32. package/dist/shared/assistant/localeCommands/tables/en.js +28 -0
  33. package/dist/shared/assistant/localeCommands/tables/es.d.ts +7 -0
  34. package/dist/shared/assistant/localeCommands/tables/es.js +356 -0
  35. package/dist/shared/assistant/localeCommands/tables/hi.d.ts +9 -0
  36. package/dist/shared/assistant/localeCommands/tables/hi.js +495 -0
  37. package/dist/shared/assistant/localeCommands/tables/ta.d.ts +10 -0
  38. package/dist/shared/assistant/localeCommands/tables/ta.js +429 -0
  39. package/dist/shared/assistant/localeCommands/tables/zh.d.ts +9 -0
  40. package/dist/shared/assistant/localeCommands/tables/zh.js +402 -0
  41. package/dist/shared/assistant/localeCommands/types.d.ts +172 -0
  42. package/dist/shared/assistant/localeCommands/types.js +19 -0
  43. package/dist/shared/assistant/ui/AssistantChatArea.js +1340 -1330
  44. package/dist/shared/assistant/uiActions/linkContext.d.ts +20 -1
  45. package/dist/shared/assistant/uiActions/linkContext.js +39 -21
  46. package/dist/shared/assistant/uiActions/offerYesOnSurface.d.ts +6 -0
  47. package/dist/shared/assistant/uiActions/offerYesOnSurface.js +1 -1
  48. package/dist/shared/assistant/writeReplyBinder.d.ts +1 -1
  49. package/dist/shared/assistant/writeReplySend.d.ts +16 -0
  50. package/dist/shared/assistant/writeReplySend.js +23 -1
  51. package/dist/shared/graphql/client.d.ts +20 -0
  52. package/dist/shared/graphql/client.js +196 -191
  53. package/dist/shared/graphql/retryPolicy.d.ts +27 -0
  54. package/dist/shared/graphql/retryPolicy.js +10 -0
  55. package/dist/shared/utils/apollo.d.ts +6 -2
  56. package/dist/shared/utils/apollo.js +26 -25
  57. package/dist/shared-assistant.js +55 -37
  58. package/package.json +2 -2
@@ -20,8 +20,27 @@ export interface SurfaceMessage {
20
20
  localAction?: unknown;
21
21
  } & Record<string, unknown>) | undefined;
22
22
  }
23
+ /**
24
+ * ★ BOFF-8977: how many refused "yes" exchanges (a person line and the panel's
25
+ * note about the refusal) `latestReplyOnSurface` may look through.
26
+ */
27
+ export declare const REFUSED_OFFER_LOOK_THROUGH_MAX = 3;
28
+ export interface LatestReplyOptions<T extends SurfaceMessage> {
29
+ /**
30
+ * ★ BOFF-8977: after a refused "yes" the thread is offer reply, "yes", refusal
31
+ * note, and the newest reply is the note — which links nothing, so "take me
32
+ * there" and a second "yes" read nothing. With this set, a trailing run of up
33
+ * to three (person line, refusal note) pairs is looked THROUGH to the reply
34
+ * that made the offer, but only when that reply still owns every refused
35
+ * offer (`ownsOffer`): the refusal released the offer, so it is live again.
36
+ * Default off.
37
+ */
38
+ lookThroughRefusedOffers?: {
39
+ ownsOffer: (reply: T, offerId: string) => boolean;
40
+ } | undefined;
41
+ }
23
42
  /** The newest assistant message on the surface, or null when a person message came after it. */
24
- export declare function latestReplyOnSurface<T extends SurfaceMessage>(messages: readonly T[], voiceSessionId: string | undefined): T | null;
43
+ export declare function latestReplyOnSurface<T extends SurfaceMessage>(messages: readonly T[], voiceSessionId: string | undefined, options?: LatestReplyOptions<T>): T | null;
25
44
  export declare function rememberPresentedList(messageId: string, candidates: readonly LocalDestination[]): void;
26
45
  export declare const presentedListFor: (messageId: string) => LocalDestination[] | undefined;
27
46
  /** @internal for tests */
@@ -4,8 +4,26 @@ import { extractInAppLinks as r } from "./inAppLinks.js";
4
4
  var i = (e, t) => {
5
5
  let n = e.metadata?.voice === !0;
6
6
  return t === void 0 ? !n : n && e.metadata?.voiceSessionId === t;
7
- };
8
- function a(e, t) {
7
+ }, a = 3;
8
+ function o(e) {
9
+ if (e.role !== "assistant") return null;
10
+ let t = e.metadata?.localAction;
11
+ if (typeof t != "object" || !t) return null;
12
+ let n = t;
13
+ return n.kind === "navigate" && n.via === "offer" && n.outcome === "refused" && typeof n.offerId == "string" ? n.offerId : null;
14
+ }
15
+ function s(e, t, n = {}) {
16
+ let r = n.lookThroughRefusedOffers;
17
+ if (r) {
18
+ let n = e.filter((e) => i(e, t)), a = [], s = n.length - 1;
19
+ for (; a.length < 3;) {
20
+ let e = n[s], t = n[s - 1], r = e ? o(e) : null;
21
+ if (r === null || t?.role !== "user") break;
22
+ a.push(r), s -= 2;
23
+ }
24
+ let c = n[s];
25
+ if (a.length > 0 && c?.role === "assistant" && a.every((e) => r.ownsOffer(c, e))) return c;
26
+ }
9
27
  for (let n = e.length - 1; n >= 0; --n) {
10
28
  let r = e[n];
11
29
  if (!(!r || !i(r, t))) {
@@ -15,16 +33,16 @@ function a(e, t) {
15
33
  }
16
34
  return null;
17
35
  }
18
- var o = 50, s = /* @__PURE__ */ new Map();
19
- function c(e, t) {
20
- for (s.delete(e), s.set(e, t.map((e) => ({ ...e }))); s.size > o;) {
21
- let e = s.keys().next();
36
+ var c = 50, l = /* @__PURE__ */ new Map();
37
+ function u(e, t) {
38
+ for (l.delete(e), l.set(e, t.map((e) => ({ ...e }))); l.size > c;) {
39
+ let e = l.keys().next();
22
40
  if (e.done) break;
23
- s.delete(e.value);
41
+ l.delete(e.value);
24
42
  }
25
43
  }
26
- var l = (e) => s.get(e), u = () => s.clear();
27
- function d(e, t) {
44
+ var d = (e) => l.get(e), f = () => l.clear();
45
+ function p(e, t) {
28
46
  let n = [...e.targets], r = [];
29
47
  for (let { offerId: e, target: i } of t) {
30
48
  if (r.some((e) => e.path === i.path)) continue;
@@ -42,41 +60,41 @@ function d(e, t) {
42
60
  offers: r
43
61
  };
44
62
  }
45
- var f = null, p = (e) => {
46
- if (f?.text === e) return f.links;
63
+ var m = null, h = (e) => {
64
+ if (m?.text === e) return m.links;
47
65
  let t = r(e);
48
- return f = {
66
+ return m = {
49
67
  text: e,
50
68
  links: t
51
69
  }, t;
52
70
  };
53
- function m(t, r) {
71
+ function g(t, r) {
54
72
  let i = t.metadata?.localAction;
55
73
  if (typeof i != "object" || !i) return null;
56
74
  let a = i;
57
75
  if (a.kind !== "choose-destination") return null;
58
- let o = l(t.id);
76
+ let o = d(t.id);
59
77
  if (o) return {
60
78
  candidates: o.map((t) => n(t.path, r, e(t) ? t.label : void 0)),
61
79
  candidateIds: o.map((e) => e.id)
62
80
  };
63
- let s = Array.isArray(a.candidateIds) ? a.candidateIds : [], c = s.filter((e) => typeof e == "string"), u = s.map((e) => typeof e == "string" ? r.destinations.find((t) => t.id === e) ?? null : null);
64
- return u.length === 0 || u.some((e) => e === null) ? {
81
+ let s = Array.isArray(a.candidateIds) ? a.candidateIds : [], c = s.filter((e) => typeof e == "string"), l = s.map((e) => typeof e == "string" ? r.destinations.find((t) => t.id === e) ?? null : null);
82
+ return l.length === 0 || l.some((e) => e === null) ? {
65
83
  candidates: null,
66
84
  candidateIds: c
67
85
  } : {
68
- candidates: u,
86
+ candidates: l,
69
87
  candidateIds: c
70
88
  };
71
89
  }
72
- function h(e) {
90
+ function _(e) {
73
91
  if (!e.reply) return null;
74
- let n = t(p(e.text), e.resolve), r = m(e.reply, e.resolve);
92
+ let n = t(h(e.text), e.resolve), r = g(e.reply, e.resolve);
75
93
  if (!e.offers || e.offers.length === 0) return {
76
94
  links: n,
77
95
  pendingChoice: r
78
96
  };
79
- let i = d(n, e.offers);
97
+ let i = p(n, e.offers);
80
98
  return {
81
99
  links: i.links,
82
100
  pendingChoice: r,
@@ -84,4 +102,4 @@ function h(e) {
84
102
  };
85
103
  }
86
104
  //#endregion
87
- export { h as buildNavigationContext, u as clearPresentedLists, a as latestReplyOnSurface, l as presentedListFor, c as rememberPresentedList, d as withOfferedTargets };
105
+ export { a as REFUSED_OFFER_LOOK_THROUGH_MAX, _ as buildNavigationContext, f as clearPresentedLists, s as latestReplyOnSurface, d as presentedListFor, u as rememberPresentedList, p as withOfferedTargets };
@@ -29,6 +29,12 @@ export interface UiOfferYesOnSurfaceInput<T extends SurfaceMessage> extends Omit
29
29
  } | null | undefined;
30
30
  /** What the person saw of a reply (the projection both surfaces render). */
31
31
  displayedText: (reply: T) => string;
32
+ /**
33
+ * ★ BOFF-8977: look through a refused "yes" (and its note) to the reply that
34
+ * made the offer — the refusal gave the offer back, so a second "yes" after
35
+ * saving is the same question again. Default on; `false` is the old reading.
36
+ */
37
+ lookThroughRefusedOffers?: boolean;
32
38
  }
33
39
  export interface UiOfferYesOnSurface<T extends SurfaceMessage> {
34
40
  state: UiOfferYesState;
@@ -3,7 +3,7 @@ import { isTurnInFlight as t } from "../turnState.js";
3
3
  import { latestReplyOnSurface as n } from "./linkContext.js";
4
4
  //#region src/shared/assistant/uiActions/offerYesOnSurface.ts
5
5
  function r(r, i) {
6
- let a = n(i.messages, i.voiceSessionId);
6
+ let a = n(i.messages, i.voiceSessionId, { lookThroughRefusedOffers: i.lookThroughRefusedOffers === !1 ? void 0 : { ownsOffer: (e, t) => r.offersFor(e.id).some((e) => e.offerId === t) } });
7
7
  if (!a) return {
8
8
  state: "none",
9
9
  reply: null
@@ -148,7 +148,7 @@ export declare const WRITE_REPLY_COPY: Readonly<{
148
148
  export declare const WRITE_REPLY_OFFER_EXPIRED: WriteReplyLine;
149
149
  /** The lexicons, for the tests. Frozen copies. */
150
150
  export declare const WRITE_REPLY_LEXICON: Readonly<{
151
- affirm: readonly ("yes" | "ok" | "confirm" | "approve" | "yeah" | "yep" | "yup" | "okay" | "sure" | "do it" | "go ahead" | "please do" | "yes please" | "sounds good" | "thats right")[];
151
+ affirm: readonly ("yes" | "ok" | "confirm" | "okay" | "yeah" | "approve" | "yep" | "yup" | "sure" | "do it" | "go ahead" | "please do" | "yes please" | "sounds good" | "thats right")[];
152
152
  negative: readonly ("stop" | "no" | "cancel" | "wait" | "nope" | "nah" | "dont" | "do not" | "never mind" | "nevermind" | "not now" | "forget it" | "hold on")[];
153
153
  courtesy: readonly ("please" | "thanks" | "thank you")[];
154
154
  maxAffirmTokens: 4;
@@ -61,6 +61,12 @@ export type WriteReplyPlan =
61
61
  */
62
62
  | {
63
63
  kind: "accept_offer";
64
+ /**
65
+ * ★ BOFF-8867: the acceptance came through the multilingual assent row
66
+ * (the words are not an English affirm). If the offer then cannot run, the
67
+ * reply is forwarded as `other`, never tagged `affirm`.
68
+ */
69
+ viaAssent?: true;
64
70
  };
65
71
  export interface WriteReplyPlanInput {
66
72
  /** What the person typed or said, as they said it. */
@@ -77,6 +83,16 @@ export interface WriteReplyPlanInput {
77
83
  * reply came from. Absent: `none`.
78
84
  */
79
85
  offer?: UiOfferYesState;
86
+ /**
87
+ * ★ BOFF-8867 (BOFF-8994): the whole reply is a bare yes in a language with a
88
+ * switched-on table, the product attests the leave guard, and nothing in it
89
+ * negates or asks (`offerAssentFor`, the one pure helper the corpus runners
90
+ * call as well). It lets the offer rows — and ONLY them — read an `other`
91
+ * reply as a yes: with a change waiting, with an attachment, or with no offer
92
+ * to accept, the reply is exactly what it was. The English classifier and
93
+ * every write row are untouched (OD-14).
94
+ */
95
+ offerAssent?: boolean;
80
96
  }
81
97
  /**
82
98
  * The plan for a person's reply. Pure: every effect is the caller's, and the
@@ -4,7 +4,29 @@ function r(r) {
4
4
  let { text: i, origin: a } = r, o = r.hasAttachments ? {
5
5
  cls: "other",
6
6
  remainder: null
7
- } : e(i, r.locale), s = o.cls === "decline_redirect" && o.remainder ? o.remainder : i, c = !r.hasAttachments && r.matchesLocalCommand(s), l = t({
7
+ } : e(i, r.locale), s = o.cls === "decline_redirect" && o.remainder ? o.remainder : i, c = !r.hasAttachments && r.matchesLocalCommand(s);
8
+ if (r.offerAssent === !0 && o.cls === "other" && !r.hasAttachments && r.live.count === 0 && !n(i)) {
9
+ let e = t({
10
+ cls: "affirm",
11
+ liveCount: 0,
12
+ origin: a,
13
+ localUiMatch: !1,
14
+ remainder: null,
15
+ execution: r.live.execution,
16
+ offer: r.offer ?? "none",
17
+ question: !1
18
+ });
19
+ if (e.action === "accept_offer") return {
20
+ kind: "accept_offer",
21
+ viaAssent: !0
22
+ };
23
+ if (e.action === "local_reply") return {
24
+ kind: "local_reply",
25
+ line: e.line,
26
+ values: e.values
27
+ };
28
+ }
29
+ let l = t({
8
30
  cls: o.cls,
9
31
  liveCount: r.live.count,
10
32
  origin: a,
@@ -1,5 +1,25 @@
1
1
  import { ApolloClient, InMemoryCache } from '@apollo/client/core';
2
+ import { RetryLink } from '@apollo/client/link/retry';
2
3
  import { Gateway } from '../config';
4
+ import { RetryPolicyOperation } from './retryPolicy';
5
+ /**
6
+ * Decide whether the transport may retry a failed operation. Pure so it can be
7
+ * unit-tested without a client. Mutations are never retried (an ambiguous
8
+ * 504/timeout may have committed the write; a replay could duplicate it) unless
9
+ * the operation context sets `retryMutation: true`.
10
+ */
11
+ export declare function shouldRetryOperationError(error: Error | undefined | null, operation: RetryPolicyOperation | undefined, circuitOpen: boolean): boolean;
12
+ export interface CreateRetryLinkOptions {
13
+ maxAttempts: number;
14
+ /** Backoff override (tests); defaults to 1s..8s with jitter. */
15
+ delay?: {
16
+ initial: number;
17
+ max: number;
18
+ jitter: boolean;
19
+ };
20
+ }
21
+ /** Shared RetryLink: transient-failure retries for queries only (mutations opt in). */
22
+ export declare function createRetryLink({ maxAttempts, delay }: CreateRetryLinkOptions): RetryLink;
3
23
  /**
4
24
  * Check if the network circuit breaker is currently open (backend unreachable).
5
25
  * Useful for showing "backend offline" banners in the UI.