@burdenoff/fe-libs 2026.1001.6 → 2026.1002.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 (55) hide show
  1. package/dist/shared/assistant/createSandboxAssistantTransport.d.ts.map +1 -1
  2. package/dist/shared/assistant/createSandboxAssistantTransport.js +79 -74
  3. package/dist/shared/assistant/gatewayClient.d.ts +6 -0
  4. package/dist/shared/assistant/gatewayClient.d.ts.map +1 -1
  5. package/dist/shared/assistant/gatewayClient.js +1 -0
  6. package/dist/shared/assistant/history/historyApi.d.ts +12 -0
  7. package/dist/shared/assistant/history/historyApi.d.ts.map +1 -1
  8. package/dist/shared/assistant/history/historyApi.js +62 -46
  9. package/dist/shared/assistant/history/historyControls.d.ts +7 -0
  10. package/dist/shared/assistant/history/historyControls.d.ts.map +1 -1
  11. package/dist/shared/assistant/history/historyControls.js +19 -16
  12. package/dist/shared/assistant/history/historyEngine.d.ts +17 -1
  13. package/dist/shared/assistant/history/historyEngine.d.ts.map +1 -1
  14. package/dist/shared/assistant/history/historyEngine.js +507 -467
  15. package/dist/shared/assistant/history/historyList.d.ts +15 -0
  16. package/dist/shared/assistant/history/historyList.d.ts.map +1 -1
  17. package/dist/shared/assistant/history/historyList.js +37 -38
  18. package/dist/shared/assistant/history/historyOperations.d.ts +35 -3
  19. package/dist/shared/assistant/history/historyOperations.d.ts.map +1 -1
  20. package/dist/shared/assistant/history/historyOperations.js +64 -27
  21. package/dist/shared/assistant/history/historySearch.d.ts +110 -0
  22. package/dist/shared/assistant/history/historySearch.d.ts.map +1 -0
  23. package/dist/shared/assistant/history/historySearch.js +226 -0
  24. package/dist/shared/assistant/history/historySearchQuery.d.ts +50 -0
  25. package/dist/shared/assistant/history/historySearchQuery.d.ts.map +1 -0
  26. package/dist/shared/assistant/history/historySearchQuery.js +23 -0
  27. package/dist/shared/assistant/history/historyTransportErrors.d.ts +17 -0
  28. package/dist/shared/assistant/history/historyTransportErrors.d.ts.map +1 -1
  29. package/dist/shared/assistant/history/historyTransportErrors.js +9 -1
  30. package/dist/shared/assistant/history/historyTypes.d.ts +32 -0
  31. package/dist/shared/assistant/history/historyTypes.d.ts.map +1 -1
  32. package/dist/shared/assistant/history/useAssistantHistorySearch.d.ts +32 -0
  33. package/dist/shared/assistant/history/useAssistantHistorySearch.d.ts.map +1 -0
  34. package/dist/shared/assistant/history/useAssistantHistorySearch.js +34 -0
  35. package/dist/shared/assistant/i18nManifest.d.ts +21 -5
  36. package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
  37. package/dist/shared/assistant/i18nManifest.js +16 -7
  38. package/dist/shared/assistant/index.d.ts +4 -0
  39. package/dist/shared/assistant/index.d.ts.map +1 -1
  40. package/dist/shared/assistant/turnOutcome.d.ts.map +1 -1
  41. package/dist/shared/assistant/turnOutcome.js +3 -3
  42. package/dist/shared/assistant/turnOutcomeCopy.d.ts +3 -3
  43. package/dist/shared/assistant/turnOutcomeCopy.d.ts.map +1 -1
  44. package/dist/shared/assistant/turnOutcomeCopy.js +3 -3
  45. package/dist/shared/assistant/ui/AssistantConversationFilters.d.ts +5 -1
  46. package/dist/shared/assistant/ui/AssistantConversationFilters.d.ts.map +1 -1
  47. package/dist/shared/assistant/ui/AssistantConversationFilters.js +81 -74
  48. package/dist/shared/assistant/ui/AssistantConversationList.d.ts +9 -0
  49. package/dist/shared/assistant/ui/AssistantConversationList.d.ts.map +1 -1
  50. package/dist/shared/assistant/ui/AssistantConversationList.js +316 -242
  51. package/dist/shared/assistant/ui/AssistantHistorySearchBox.d.ts +12 -0
  52. package/dist/shared/assistant/ui/AssistantHistorySearchBox.d.ts.map +1 -0
  53. package/dist/shared/assistant/ui/AssistantHistorySearchBox.js +74 -0
  54. package/dist/shared-assistant.js +175 -171
  55. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"createSandboxAssistantTransport.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/createSandboxAssistantTransport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA2BH,OAAO,KAAK,EAGV,2BAA2B,EAE3B,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAOjB,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,2BAA2B,CAAC;IAClD,cAAc,EAAE,MAAM,MAAM,CAAC;CAC9B;AAYD,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,sBAAsB,EAC9B,IAAI,EAAE,aAAa,GAClB,yBAAyB,CAmO3B"}
1
+ {"version":3,"file":"createSandboxAssistantTransport.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/createSandboxAssistantTransport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4BH,OAAO,KAAK,EAGV,2BAA2B,EAE3B,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAOjB,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,2BAA2B,CAAC;IAClD,cAAc,EAAE,MAAM,MAAM,CAAC;CAC9B;AAYD,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,sBAAsB,EAC9B,IAAI,EAAE,aAAa,GAClB,yBAAyB,CAwP3B"}
@@ -1,115 +1,120 @@
1
- import { isQuotaExhaustedError as e } from "./quota.js";
1
+ import { assistantLlmTerminalCodeOf as e } from "./sandboxProxyError.js";
2
+ import { isQuotaExhaustedError as t } from "./quota.js";
2
3
  import "./gatewayClient.js";
3
- import { checkAssistantAiCredits as t, getAssistantMessages as n, getAssistantStreamAccess as r, reportAssistantAiTokenUsage as i, sendAssistantPromptAsync as a, stopReapedAssistantSandbox as o } from "./api.js";
4
- import { AssistantRuntimeManager as s } from "./runtime.js";
5
- import { buildProgress as c, isReapedSandboxConnectionError as l, isRecoverable as u, mergeMessagesById as d, sanitize as f } from "./progress.js";
6
- import { assistantUsageLedger as p, hasPendingUsageReports as m, reportUsageWithRetry as h, retryPendingUsageReports as g, usageSendRefusal as _ } from "./usageReporting.js";
4
+ import { checkAssistantAiCredits as n, getAssistantMessages as r, getAssistantStreamAccess as i, reportAssistantAiTokenUsage as a, sendAssistantPromptAsync as o, stopReapedAssistantSandbox as s } from "./api.js";
5
+ import { AssistantRuntimeManager as c } from "./runtime.js";
6
+ import { buildProgress as l, isReapedSandboxConnectionError as u, isRecoverable as d, mergeMessagesById as f, sanitize as p } from "./progress.js";
7
+ import { assistantUsageLedger as m, hasPendingUsageReports as h, reportUsageWithRetry as g, retryPendingUsageReports as _, usageSendRefusal as v } from "./usageReporting.js";
7
8
  //#region src/shared/assistant/createSandboxAssistantTransport.ts
8
- var v = 42e4, y = 400, b = 2e3, x = 5e3;
9
- function S() {
9
+ var y = 42e4, b = 400, x = 2e3, S = 5e3;
10
+ function C() {
10
11
  return typeof window > "u" ? {} : {
11
12
  currentUrl: window.location.href,
12
13
  currentPage: window.location.pathname.split("/").filter(Boolean).slice(0, 3).join("/") || "home",
13
14
  viewportSize: `${window.innerWidth}x${window.innerHeight}`
14
15
  };
15
16
  }
16
- function C(C, w) {
17
- let T = C.mode ?? "assistant", E = C.streamBudgetMs ?? v, D = { accumulateNarration: C.accumulateNarration === !0 }, O = C.ttlSeconds ?? 3600, k = C.isProdRuntime ?? (() => !1), A = C.enableCredits ?? !1, j = p("transport", C.product), M = (e) => async (t) => {
18
- t.messageId && await i(t.workspaceId, t.sessionId, t.messageId, t.model, t.tokens, e);
19
- }, N = new s({
20
- product: C.product,
21
- mode: T,
22
- ttlSeconds: O,
23
- isProd: k,
24
- getWorkspaceId: w.getWorkspaceId,
25
- getAuthContext: w.getAuthContext
26
- }), P = () => C.gatherPageContext ? { ...C.gatherPageContext() } : S();
27
- async function F(e, t, i, s) {
17
+ function w(w, T) {
18
+ let E = w.mode ?? "assistant", D = w.streamBudgetMs ?? y, O = { accumulateNarration: w.accumulateNarration === !0 }, k = w.ttlSeconds ?? 3600, A = w.isProdRuntime ?? (() => !1), j = w.enableCredits ?? !1, M = m("transport", w.product), N = (e) => async (t) => {
19
+ t.messageId && await a(t.workspaceId, t.sessionId, t.messageId, t.model, t.tokens, e);
20
+ }, P = new c({
21
+ product: w.product,
22
+ mode: E,
23
+ ttlSeconds: k,
24
+ isProd: A,
25
+ getWorkspaceId: T.getWorkspaceId,
26
+ getAuthContext: T.getAuthContext
27
+ }), F = () => w.gatherPageContext ? { ...w.gatherPageContext() } : C();
28
+ async function I(t, n, a, c) {
28
29
  try {
29
- let { sandboxId: o, sessionId: s } = await N.ensureRuntime();
30
- N.startKeepWarm();
31
- let l = Date.now();
32
- await a(o, t, s, e.prompt, T, P(), i, e.parts?.length ? { parts: e.parts } : void 0);
33
- let u = null, p = null, m = await r(o, t, s, T, i).catch(() => null);
30
+ let { sandboxId: e, sessionId: s } = await P.ensureRuntime();
31
+ P.startKeepWarm();
32
+ let c = Date.now();
33
+ await o(e, n, s, t.prompt, E, F(), a, t.parts?.length ? { parts: t.parts } : void 0);
34
+ let u = null, d = null, m = await i(e, n, s, E, a).catch(() => null);
34
35
  if (m && typeof EventSource < "u") try {
35
- p = new EventSource(m.url);
36
+ d = new EventSource(m.url);
36
37
  let e = () => {
37
38
  if (u) {
38
39
  let e = u;
39
40
  u = null, e();
40
41
  }
41
42
  };
42
- p.onmessage = e, p.addEventListener("message.part.updated", e), p.addEventListener("message.updated", e), p.onerror = () => {
43
- p?.close(), p = null;
43
+ d.onmessage = e, d.addEventListener("message.part.updated", e), d.addEventListener("message.updated", e), d.onerror = () => {
44
+ d?.close(), d = null;
44
45
  };
45
46
  } catch {
46
- p = null;
47
+ d?.close(), d = null;
47
48
  }
48
- let g = (t) => new Promise((n) => {
49
- if (e.signal.aborted) return n();
49
+ let h = (e) => new Promise((n) => {
50
+ if (t.signal.aborted) return n();
50
51
  let r = setTimeout(() => {
51
52
  u = null, n();
52
- }, t);
53
+ }, e);
53
54
  u = () => {
54
55
  clearTimeout(r), n();
55
56
  };
56
- }), _ = l + E, v = [], S = c([], l, D), w = l;
57
- for (; Date.now() < _;) {
58
- if (e.signal.aborted) throw Error("Cancelled");
59
- let r = await n(o, t, s, T, i, {
60
- sinceMs: w,
61
- surfaceTurnTerminal: !0
62
- });
63
- v = d(v, r);
64
- for (let e of r) {
65
- let t = e.info?.time?.created;
66
- typeof t == "number" && t > w && (w = t);
57
+ }), _ = c + D, v = [], y = l([], c, O), C = c;
58
+ try {
59
+ for (; Date.now() < _;) {
60
+ if (t.signal.aborted) throw Error("Cancelled");
61
+ let i = await r(e, n, s, E, a, {
62
+ sinceMs: C,
63
+ surfaceTurnTerminal: !0
64
+ });
65
+ v = f(v, i);
66
+ for (let e of i) {
67
+ let t = e.info?.time?.created;
68
+ typeof t == "number" && t > C && (C = t);
69
+ }
70
+ if (y = l(v, c, O), t.onProgress(p(y.content)), y.done) break;
71
+ let o = Date.now() - c < S ? b : x;
72
+ await (d ? h(o) : new Promise((e) => setTimeout(e, o)));
67
73
  }
68
- if (S = c(v, l, D), e.onProgress(f(S.content)), S.done) break;
69
- let a = Date.now() - l < x ? y : b;
70
- await (p ? g(a) : new Promise((e) => setTimeout(e, a)));
74
+ } finally {
75
+ d?.close();
71
76
  }
72
- if (p?.close(), !S.done) throw Error("The assistant timed out while responding. Please try again.");
73
- let O = await n(o, t, s, T, i, { limit: 50 }).catch(() => v), k = c(d(v, O), l, D);
74
- if (A) {
75
- let e = O.filter((e) => e.info?.role === "assistant").sort((e, t) => (t.info?.time?.created ?? 0) - (e.info?.time?.created ?? 0))[0], n = e?.info?.tokens, r = e?.info?.providerID && e?.info?.modelID ? `${e.info.providerID}/${e.info.modelID}` : void 0;
76
- e?.info?.id && n && (await h({
77
- workspaceId: t,
77
+ if (!y.done) throw Error("The assistant timed out while responding. Please try again.");
78
+ let T = await r(e, n, s, E, a, { limit: 50 }).catch(() => v), k = l(f(v, T), c, O);
79
+ if (j) {
80
+ let e = T.filter((e) => e.info?.role === "assistant").sort((e, t) => (t.info?.time?.created ?? 0) - (e.info?.time?.created ?? 0))[0], t = e?.info?.tokens, r = e?.info?.providerID && e?.info?.modelID ? `${e.info.providerID}/${e.info.modelID}` : void 0;
81
+ e?.info?.id && t && (await g({
82
+ workspaceId: n,
78
83
  sessionId: s,
79
84
  messageId: e.info.id,
80
85
  model: r,
81
- tokens: n
82
- }, M(i), { ledger: j })).ok && C.onCreditsUpdated?.();
86
+ tokens: t
87
+ }, N(a), { ledger: M })).ok && w.onCreditsUpdated?.();
83
88
  }
84
- return { text: f(k.content) };
85
- } catch (n) {
86
- if (s === 1 && u(n)) {
87
- let r = l(n);
88
- if (r) {
89
- let e = N.getSandboxId();
90
- e && await o(e, t, i).catch(() => void 0);
89
+ return { text: p(k.content) };
90
+ } catch (r) {
91
+ if (c === 1 && d(r)) {
92
+ let i = u(r), o = e(r) === "ASSISTANT_SESSION_REVOKED", c = i || o;
93
+ if (c) {
94
+ let e = P.getSandboxId();
95
+ e && await s(e, n, a, { ownerScoped: o }).catch(() => void 0);
91
96
  }
92
- return N.reset({ quarantineCurrentSandbox: r }), F(e, t, i, 2);
97
+ return P.reset({ quarantineCurrentSandbox: c }), I(t, n, a, 2);
93
98
  }
94
- throw n;
99
+ throw r;
95
100
  }
96
101
  }
97
102
  return {
98
- sendPrompt: async (n) => {
99
- let r = w.getWorkspaceId();
103
+ sendPrompt: async (e) => {
104
+ let r = T.getWorkspaceId();
100
105
  if (!r) throw Error("The assistant needs an active workspace. Open a workspace and try again.");
101
- let i = w.getAuthContext();
102
- if (A && m(j, r)) {
103
- let e = await g(j, r, M(i));
104
- if (!e.ok) throw _(e.kind);
106
+ let i = T.getAuthContext();
107
+ if (j && h(M, r)) {
108
+ let e = await _(M, r, N(i));
109
+ if (!e.ok) throw v(e.kind);
105
110
  }
106
- return A && t(r, i).catch((t) => {
107
- e(t) && C.onQuotaExhausted?.(t);
108
- }), F(n, r, i, 1);
111
+ return j && n(r, i).catch((e) => {
112
+ t(e) && w.onQuotaExhausted?.(e);
113
+ }), I(e, r, i, 1);
109
114
  },
110
- prewarm: (e) => N.prewarm(e),
111
- suspend: () => N.stopKeepWarm()
115
+ prewarm: (e) => P.prewarm(e),
116
+ suspend: () => P.stopKeepWarm()
112
117
  };
113
118
  }
114
119
  //#endregion
115
- export { C as createSandboxAssistantTransport };
120
+ export { w as createSandboxAssistantTransport };
@@ -29,6 +29,12 @@ export declare function executeAssistantGraphQLOnce<TData>(params: {
29
29
  variables: Record<string, unknown>;
30
30
  workspaceId: string;
31
31
  authContext?: AssistantSandboxAuthContext;
32
+ /**
33
+ * Cancels the call (BOFF-8159 S9: a history search a newer one replaced).
34
+ * Aborted before it leaves, it is never sent; aborted on the wire, the
35
+ * fetch is cancelled and the call rejects.
36
+ */
37
+ signal?: AbortSignal;
32
38
  }): Promise<TData>;
33
39
  export declare function executeSandboxGraphQL<TData>(params: {
34
40
  query: string;
@@ -1 +1 @@
1
- {"version":3,"file":"gatewayClient.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/gatewayClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAe3D;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,2BAA2B,GACxC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOzB;AAED;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,2BAA2B,CAAC;CAC3C,GAAG,OAAO,CAAC,KAAK,CAAC,CA6BjB;AAED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE;IACzD,KAAK,EAAE,MAAM,CAAC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,7 @@ async function r(n) {
21
21
  query: n.query,
22
22
  operationName: n.operationName,
23
23
  variables: n.variables,
24
+ ...n.signal ? { signal: n.signal } : {},
24
25
  authToken: n.authContext?.accessToken ?? void 0,
25
26
  workspaceToken: !0,
26
27
  workspaceId: n.workspaceId,
@@ -8,11 +8,21 @@ export interface AssistantHistoryTransport {
8
8
  * The live list. With a `filter` it needs the history controls: without
9
9
  * them it is refused (`AssistantHistoryControlsUnavailableError`) rather
10
10
  * than answered unfiltered.
11
+ *
12
+ * With a `query` it is a SEARCH (BOFF-8159 S9): the same list, narrowed to
13
+ * the conversations that hold the query, at most 50 a page — sent as its
14
+ * own document, never through the drift fallback (see the docblock). A
15
+ * query the server would refuse (not 2-100 code points) is not sent
16
+ * (`AssistantHistorySearchQueryError`), and neither is any search while the
17
+ * controls are unavailable. `options.signal` cancels it.
11
18
  */
12
19
  conversations(scope: AssistantHistoryScope, page: {
13
20
  first: number;
14
21
  after: string | null;
15
22
  filter?: AssistantHistoryConversationFilter;
23
+ query?: string;
24
+ }, options?: {
25
+ signal?: AbortSignal;
16
26
  }): Promise<AssistantHistoryHeaderPage>;
17
27
  entries(scope: AssistantHistoryScope, ref: AssistantHistoryConvRef, page: AssistantHistoryEntryPaging): Promise<AssistantHistoryEntryPage>;
18
28
  save(scope: AssistantHistoryScope, input: AssistantHistorySaveInput): Promise<AssistantHistorySavePayload>;
@@ -40,6 +50,8 @@ export type AssistantHistoryExecutor = <TData>(params: {
40
50
  operationName: string;
41
51
  variables: Record<string, unknown>;
42
52
  workspaceId: string;
53
+ /** Only a search passes one (BOFF-8159 S9). */
54
+ signal?: AbortSignal;
43
55
  }) => Promise<TData>;
44
56
  export interface GatewayHistoryTransportOptions {
45
57
  execute?: AssistantHistoryExecutor;
@@ -1 +1 @@
1
- {"version":3,"file":"historyApi.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC;CACzB;AAED,6FAA6F;AAC7F,eAAO,MAAM,qCAAqC,QAAc,CAAC;AACjE;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,IAAI,CAAC;AAEvD,sFAAsF;AACtF,MAAM,MAAM,wBAAwB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;AAErB,MAAM,WAAW,8BAA8B;IAC7C,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,MAAM,MAAM,CAAC;IACjC,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACpC,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAuBD,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,8BAAmC,GAC3C,yBAAyB,CAmT3B"}
@@ -1,13 +1,14 @@
1
1
  import { executeAssistantGraphQLOnce as e } from "../gatewayClient.js";
2
2
  import { getActorId as t, getWorkspaceId as n } from "../context.js";
3
- import { AssistantHistoryControlsUnavailableError as r, AssistantHistoryResponseError as i, AssistantHistoryScopeInactiveError as a } from "./historyTransportErrors.js";
4
- import { classifyAssistantHistoryError as o, isAssistantHistoryControlsDrift as s } from "./historyErrors.js";
5
- import { ASSISTANT_HISTORY_CHANGES_OPERATION as c, ASSISTANT_HISTORY_CHANGES_QUERY as l, ASSISTANT_HISTORY_CHANGES_QUERY_BASE as u, ASSISTANT_HISTORY_CONVERSATIONS_OPERATION as d, ASSISTANT_HISTORY_CONVERSATIONS_QUERY as f, ASSISTANT_HISTORY_CONVERSATIONS_QUERY_BASE as p, ASSISTANT_HISTORY_DELETE_MUTATION as m, ASSISTANT_HISTORY_DELETE_MUTATION_BASE as h, ASSISTANT_HISTORY_DELETE_OPERATION as g, ASSISTANT_HISTORY_ENTRIES_OPERATION as _, ASSISTANT_HISTORY_ENTRIES_QUERY as v, ASSISTANT_HISTORY_ENTRIES_QUERY_BASE as y, ASSISTANT_HISTORY_SAVE_MUTATION as b, ASSISTANT_HISTORY_SAVE_MUTATION_BASE as x, ASSISTANT_HISTORY_SAVE_OPERATION as S, ASSISTANT_HISTORY_UPDATE_MUTATION as C, ASSISTANT_HISTORY_UPDATE_OPERATION as w, buildHistoryDeleteVariables as T, buildHistoryEntriesVariables as E, buildHistoryListVariables as D, buildHistoryPageVariables as O, buildHistorySaveVariables as k, buildHistoryUpdateVariables as A } from "./historyOperations.js";
3
+ import { AssistantHistoryControlsUnavailableError as r, AssistantHistoryResponseError as i, AssistantHistoryScopeInactiveError as a, AssistantHistorySearchQueryError as o } from "./historyTransportErrors.js";
4
+ import { classifyAssistantHistoryError as s, isAssistantHistoryControlsDrift as c } from "./historyErrors.js";
5
+ import { ASSISTANT_HISTORY_CHANGES_OPERATION as l, ASSISTANT_HISTORY_CHANGES_QUERY as u, ASSISTANT_HISTORY_CHANGES_QUERY_BASE as d, ASSISTANT_HISTORY_CONVERSATIONS_OPERATION as f, ASSISTANT_HISTORY_CONVERSATIONS_QUERY as p, ASSISTANT_HISTORY_CONVERSATIONS_QUERY_BASE as m, ASSISTANT_HISTORY_DELETE_MUTATION as ee, ASSISTANT_HISTORY_DELETE_MUTATION_BASE as te, ASSISTANT_HISTORY_DELETE_OPERATION as h, ASSISTANT_HISTORY_ENTRIES_OPERATION as g, ASSISTANT_HISTORY_ENTRIES_QUERY as ne, ASSISTANT_HISTORY_ENTRIES_QUERY_BASE as re, ASSISTANT_HISTORY_SAVE_MUTATION as _, ASSISTANT_HISTORY_SAVE_MUTATION_BASE as v, ASSISTANT_HISTORY_SAVE_OPERATION as y, ASSISTANT_HISTORY_SEARCH_OPERATION as b, ASSISTANT_HISTORY_SEARCH_QUERY as x, ASSISTANT_HISTORY_UPDATE_MUTATION as S, ASSISTANT_HISTORY_UPDATE_OPERATION as C, buildHistoryDeleteVariables as w, buildHistoryEntriesVariables as ie, buildHistoryListVariables as ae, buildHistoryPageVariables as T, buildHistorySaveVariables as E, buildHistorySearchVariables as D, buildHistoryUpdateVariables as O } from "./historyOperations.js";
6
+ import { isServerHistorySearchQuery as k, normaliseHistorySearchQuery as A } from "./historySearchQuery.js";
6
7
  import { historyTimestampToIso as j } from "./historyTimestamps.js";
7
8
  //#region src/shared/assistant/history/historyApi.ts
8
9
  var M = 10 * 6e4, N = 2;
9
10
  function P(e) {
10
- let t = o(e);
11
+ let t = s(e);
11
12
  return t.class === "transient" && t.code !== "RATE_LIMIT_EXCEEDED";
12
13
  }
13
14
  function F(e) {
@@ -17,26 +18,27 @@ function F(e) {
17
18
  return null;
18
19
  }
19
20
  }
20
- function I(o = {}) {
21
- let j = o.execute ?? ((t) => e(t)), N = o.activeWorkspaceId ?? n, I = o.activeActorId ?? t, B = o.now ?? Date.now, V = !0, H = 0, K = !1, Y = 0, X = /* @__PURE__ */ new Set(), Z = (e) => {
21
+ function I(s = {}) {
22
+ let j = s.execute ?? ((t) => e(t)), N = s.activeWorkspaceId ?? n, I = s.activeActorId ?? t, B = s.now ?? Date.now, V = !0, H = 0, K = !1, Y = 0, X = /* @__PURE__ */ new Set(), Z = (e) => {
22
23
  if (e || (H = B() + M), e !== V) {
23
24
  V = e;
24
25
  for (let t of [...X]) try {
25
26
  t(e);
26
27
  } catch {}
27
28
  }
28
- }, Q = async (e, t, n, r) => {
29
+ }, Q = async (e, t, n, r, o) => {
29
30
  if (!e.workspaceId || !e.actorId || F(N) !== e.workspaceId || F(I) !== e.actorId) throw new a();
30
- let o = await j({
31
+ let s = await j({
31
32
  query: n,
32
33
  operationName: t,
33
34
  variables: r,
34
- workspaceId: e.workspaceId
35
+ workspaceId: e.workspaceId,
36
+ ...o ? { signal: o } : {}
35
37
  });
36
- if (!U(o)) throw new i(t, "no data");
37
- return o;
38
+ if (!U(s)) throw new i(t, "no data");
39
+ return s;
38
40
  }, $ = async (e, t, n, i, o = {}) => {
39
- let { full: c, base: l } = n, u = async () => {
41
+ let { full: s, base: l } = n, u = async () => {
40
42
  if (!l) throw new r(t);
41
43
  return i(await Q(e, t, l.query, l.variables), !1);
42
44
  };
@@ -46,10 +48,10 @@ function I(o = {}) {
46
48
  }
47
49
  let d;
48
50
  try {
49
- d = await Q(e, t, c.query, c.variables);
51
+ d = await Q(e, t, s.query, s.variables);
50
52
  } catch (n) {
51
53
  if (n instanceof a) throw n;
52
- if (s(n)) return Y = 0, Z(!1), u();
54
+ if (c(n)) return Y = 0, Z(!1), u();
53
55
  if (l && P(n) && (Y += 1, Y >= 2)) {
54
56
  Y = 0;
55
57
  let r;
@@ -65,6 +67,20 @@ function I(o = {}) {
65
67
  Y = 0;
66
68
  let f = i(d, !0);
67
69
  return Z(!0), f;
70
+ }, oe = async (e, t, n, i) => {
71
+ let a = A(n);
72
+ if (!k(a)) throw new o();
73
+ if (!V) throw new r(b);
74
+ let s = await Q(e, b, x, D(e, {
75
+ first: Math.max(1, Math.min(t.first, 50)),
76
+ after: t.after,
77
+ query: a,
78
+ ...t.filter ? { filter: t.filter } : {}
79
+ }), i), c = W(b), l = c.record(s.myAssistantConversations, "myAssistantConversations");
80
+ return {
81
+ nodes: c.list(l.nodes, "nodes").map((e) => q(c, e, !0)),
82
+ pageInfo: G(c, l.pageInfo)
83
+ };
68
84
  };
69
85
  return {
70
86
  controlsAvailable: () => V,
@@ -77,18 +93,18 @@ function I(o = {}) {
77
93
  V || (K = !0);
78
94
  },
79
95
  async changes(e, t) {
80
- let n = O(e, t);
81
- return $(e, c, {
96
+ let n = T(e, t);
97
+ return $(e, l, {
82
98
  full: {
83
- query: l,
99
+ query: u,
84
100
  variables: n
85
101
  },
86
102
  base: {
87
- query: u,
103
+ query: d,
88
104
  variables: n
89
105
  }
90
106
  }, (e, t) => {
91
- let n = W(c), r = n.record(e.myAssistantHistoryChanges, "myAssistantHistoryChanges");
107
+ let n = W(l), r = n.record(e.myAssistantHistoryChanges, "myAssistantHistoryChanges");
92
108
  return {
93
109
  nodes: n.list(r.nodes, "nodes").map((e) => q(n, e, t)),
94
110
  pageInfo: G(n, r.pageInfo),
@@ -96,37 +112,37 @@ function I(o = {}) {
96
112
  };
97
113
  }, { probe: !0 });
98
114
  },
99
- async conversations(e, t) {
100
- return $(e, d, {
115
+ async conversations(e, t, n = {}) {
116
+ return t.query === void 0 ? $(e, f, {
101
117
  full: {
102
- query: f,
103
- variables: D(e, t)
118
+ query: p,
119
+ variables: ae(e, t)
104
120
  },
105
121
  base: t.filter ? null : {
106
- query: p,
107
- variables: O(e, t)
122
+ query: m,
123
+ variables: T(e, t)
108
124
  }
109
125
  }, (e, t) => {
110
- let n = W(d), r = n.record(e.myAssistantConversations, "myAssistantConversations");
126
+ let n = W(f), r = n.record(e.myAssistantConversations, "myAssistantConversations");
111
127
  return {
112
128
  nodes: n.list(r.nodes, "nodes").map((e) => q(n, e, t)),
113
129
  pageInfo: G(n, r.pageInfo)
114
130
  };
115
- });
131
+ }) : oe(e, t, t.query, n.signal);
116
132
  },
117
133
  async entries(e, t, n) {
118
- let r = E(e, t, n);
119
- return $(e, _, {
134
+ let r = ie(e, t, n);
135
+ return $(e, g, {
120
136
  full: {
121
- query: v,
137
+ query: ne,
122
138
  variables: r
123
139
  },
124
140
  base: {
125
- query: y,
141
+ query: re,
126
142
  variables: r
127
143
  }
128
144
  }, (e, t) => {
129
- let n = W(_), r = n.record(e.myAssistantConversationEntries, "myAssistantConversationEntries");
145
+ let n = W(g), r = n.record(e.myAssistantConversationEntries, "myAssistantConversationEntries");
130
146
  return {
131
147
  conversation: q(n, r.conversation, t),
132
148
  nodes: n.list(r.nodes, "nodes").map((e) => J(n, e)),
@@ -135,18 +151,18 @@ function I(o = {}) {
135
151
  });
136
152
  },
137
153
  async save(e, t) {
138
- let n = k(e, t);
139
- return $(e, S, {
154
+ let n = E(e, t);
155
+ return $(e, y, {
140
156
  full: {
141
- query: b,
157
+ query: _,
142
158
  variables: n
143
159
  },
144
160
  base: {
145
- query: x,
161
+ query: v,
146
162
  variables: n
147
163
  }
148
164
  }, (e, t) => {
149
- let n = W(S), r = n.record(e.saveMyAssistantHistoryEntries, "saveMyAssistantHistoryEntries");
165
+ let n = W(y), r = n.record(e.saveMyAssistantHistoryEntries, "saveMyAssistantHistoryEntries");
150
166
  return {
151
167
  outcome: n.oneOf(r.outcome, L, "outcome"),
152
168
  conversation: q(n, r.conversation, t),
@@ -156,18 +172,18 @@ function I(o = {}) {
156
172
  });
157
173
  },
158
174
  async remove(e, t) {
159
- let n = T(e, t);
160
- return $(e, g, {
175
+ let n = w(e, t);
176
+ return $(e, h, {
161
177
  full: {
162
- query: m,
178
+ query: ee,
163
179
  variables: n
164
180
  },
165
181
  base: {
166
- query: h,
182
+ query: te,
167
183
  variables: n
168
184
  }
169
185
  }, (e, t) => {
170
- let n = W(g), r = n.record(e.deleteMyAssistantConversation, "deleteMyAssistantConversation");
186
+ let n = W(h), r = n.record(e.deleteMyAssistantConversation, "deleteMyAssistantConversation");
171
187
  return {
172
188
  outcome: n.oneOf(r.outcome, R, "outcome"),
173
189
  conversation: r.conversation == null ? null : q(n, r.conversation, t)
@@ -175,14 +191,14 @@ function I(o = {}) {
175
191
  });
176
192
  },
177
193
  async update(e, t, n) {
178
- return $(e, w, {
194
+ return $(e, C, {
179
195
  full: {
180
- query: C,
181
- variables: A(e, t, n)
196
+ query: S,
197
+ variables: O(e, t, n)
182
198
  },
183
199
  base: null
184
200
  }, (e) => {
185
- let t = W(w), n = t.record(e.updateMyAssistantConversation, "updateMyAssistantConversation");
201
+ let t = W(C), n = t.record(e.updateMyAssistantConversation, "updateMyAssistantConversation");
186
202
  return {
187
203
  outcome: t.oneOf(n.outcome, z, "outcome"),
188
204
  conversation: q(t, n.conversation, !0)
@@ -13,6 +13,13 @@ export declare const HISTORY_TITLE_MAX_CODE_POINTS = 80;
13
13
  export declare function clampToCodePoints(text: string, max: number): string;
14
14
  /** How many code points `text` holds. */
15
15
  export declare function codePointLength(text: string): number;
16
+ /**
17
+ * Text as the server reads a title or a search (`toStorableText`, then
18
+ * `\s+` → one space, trimmed): what it cannot store (U+0000, an unpaired
19
+ * surrogate) becomes U+FFFD, every run of whitespace one space, the ends
20
+ * trimmed. No length limit — each caller applies its own.
21
+ */
22
+ export declare function collapseHistoryText(text: string): string;
16
23
  /**
17
24
  * A title exactly as the server will store it: what cannot be stored becomes
18
25
  * U+FFFD, every run of whitespace one space, trimmed, then at most 80 code
@@ -1 +1 @@
1
- {"version":3,"file":"historyControls.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyControls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,kCAAkC,EAClC,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAOhD,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnE;AAED,yCAAyC;AACzC,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO1D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,2BAA2B,EAClC,KAAK,EAAE,2BAA2B,GACjC,2BA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YAAY,GAAG,SAAS,CAAC,EAC7E,MAAM,GAAE,QAAQ,CAAC,kCAAkC,CAA+B,GACjF,OAAO,CAWT;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,kCAAkC,CAAC,GAAG,SAAS,GAAG,MAAM,CAIzG;AAED,qFAAqF;AACrF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,kCAAkC,CAAC,GAAG,OAAO,CAMpG;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9E,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,QAAQ,CAAC,kCAAkC,CAAC,GACnD,sBAAsB,GAAG,IAAI,CAM/B"}
1
+ {"version":3,"file":"historyControls.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyControls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,kCAAkC,EAClC,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAOhD,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnE;AAED,yCAAyC;AACzC,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMxD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC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B,EAAE,QAAQ,CAAC,kCAAkC,CAIpF,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,IAAI,CAAC,2BAA2B,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,CAAC,EAC7E,MAAM,GAAE,QAAQ,CAAC,kCAAkC,CAA+B,GACjF,OAAO,CAWT;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,kCAAkC,CAAC,GAAG,SAAS,GAAG,MAAM,CAIzG;AAED,qFAAqF;AACrF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,kCAAkC,CAAC,GAAG,OAAO,CAMpG;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9E,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,QAAQ,CAAC,kCAAkC,CAAC,GACnD,sBAAsB,GAAG,IAAI,CAM/B"}
@@ -8,34 +8,37 @@ function o(e) {
8
8
  return Array.from(e).length;
9
9
  }
10
10
  function s(e) {
11
- return a(e.replaceAll(r, i).replace(n, i).replace(/\s+/g, " ").trim(), 80).trim();
11
+ return e.replaceAll(r, i).replace(n, i).replace(/\s+/g, " ").trim();
12
12
  }
13
- function c(e, t) {
13
+ function c(e) {
14
+ return a(s(e), 80).trim();
15
+ }
16
+ function l(e, t) {
14
17
  let n = {
15
18
  ...e,
16
19
  ...t
17
20
  };
18
21
  return t.archived === !0 && t.pinned === void 0 && delete n.pinned, t.pinned === !0 && t.archived === void 0 && delete n.archived, n;
19
22
  }
20
- function l(e) {
23
+ function u(e) {
21
24
  return !([
22
25
  e.title,
23
26
  e.pinned,
24
27
  e.archived
25
- ].filter((e) => e !== void 0).length === 0 || e.pinned === !0 && e.archived === !0 || e.title !== void 0 && (e.title.length === 0 || e.title !== s(e.title)));
28
+ ].filter((e) => e !== void 0).length === 0 || e.pinned === !0 && e.archived === !0 || e.title !== void 0 && (e.title.length === 0 || e.title !== c(e.title)));
26
29
  }
27
- function u(e) {
30
+ function d(e) {
28
31
  let t = !1, n = !1;
29
32
  for (let r of e.messages) if (r.role === "user" && (r.metadata?.voice === !0 ? n = !0 : t = !0, t && n)) return "MIXED";
30
33
  return n ? "VOICE" : t ? "CHAT" : null;
31
34
  }
32
- function d(e) {
35
+ function f(e) {
33
36
  return {
34
37
  typed: e === "CHAT" || e === "MIXED",
35
38
  spoken: e === "VOICE" || e === "MIXED"
36
39
  };
37
40
  }
38
- function f(e, t) {
41
+ function p(e, t) {
39
42
  let n = {};
40
43
  if (t === null) return n;
41
44
  for (let r of e) r.type !== "update" || r.scopeKey !== t || (n[r.convKey] ??= []).push({
@@ -44,13 +47,13 @@ function f(e, t) {
44
47
  });
45
48
  return n;
46
49
  }
47
- function p(e, t, n = []) {
50
+ function m(e, t, n = []) {
48
51
  let r = t?.pinnedAt ?? null, i = t?.archivedAt ?? null, a = null;
49
52
  for (let { patch: e, at: t } of n) {
50
53
  let n = new Date(t).toISOString();
51
54
  e.title !== void 0 && (a = e.title), e.archived === !0 ? (i ??= n, r = null) : e.archived === !1 && (i = null), e.pinned === !0 ? (r ??= n, i = null) : e.pinned === !1 && (r = null);
52
55
  }
53
- let o = d(t?.channel), s = d(e ? u(e) : null), c = o.typed || s.typed, l = o.spoken || s.spoken;
56
+ let o = f(t?.channel), s = f(e ? d(e) : null), c = o.typed || s.typed, l = o.spoken || s.spoken;
54
57
  return {
55
58
  pendingTitle: a,
56
59
  pinnedAt: r,
@@ -60,27 +63,27 @@ function p(e, t, n = []) {
60
63
  pending: n.length > 0
61
64
  };
62
65
  }
63
- var m = {
66
+ var h = {
64
67
  channel: "ANY",
65
68
  pinned: null,
66
69
  archived: "EXCLUDE"
67
70
  };
68
- function h(e, t = m) {
71
+ function g(e, t = h) {
69
72
  let n = t.archived ?? "EXCLUDE";
70
73
  if (n === "EXCLUDE" && e.archivedAt !== null || n === "ONLY" && e.archivedAt === null || t.pinned === !0 && e.pinnedAt === null || t.pinned === !1 && e.pinnedAt !== null) return !1;
71
- let r = d(e.channel), i = t.channel ?? "ANY";
74
+ let r = f(e.channel), i = t.channel ?? "ANY";
72
75
  return !(i === "CHAT" && !r.typed || i === "VOICE" && !r.spoken);
73
76
  }
74
- function g(e) {
77
+ function _(e) {
75
78
  if (!e) return "";
76
79
  let t = e.pinned === !0 ? "pinned" : e.pinned === !1 ? "unpinned" : "any";
77
80
  return `${e.channel ?? "ANY"}|${t}|${e.archived ?? "EXCLUDE"}`;
78
81
  }
79
- function _(e) {
82
+ function v(e) {
80
83
  return (e.channel ?? "ANY") === "ANY" && (e.pinned ?? null) === null && (e.archived ?? "EXCLUDE") === "EXCLUDE";
81
84
  }
82
- function v(e) {
85
+ function y(e) {
83
86
  return e.archived === "ONLY" ? "archived" : e.pinned === !0 ? "pinned" : e.channel === "VOICE" ? "voice" : e.channel === "CHAT" ? "chat" : null;
84
87
  }
85
88
  //#endregion
86
- export { m as DEFAULT_HISTORY_LIST_FILTER, t as HISTORY_TITLE_MAX_CODE_POINTS, e as MAX_PINNED, a as clampToCodePoints, c as coalesceUpdatePatch, o as codePointLength, v as historyFilterEmptyKind, g as historyFilterKey, _ as isDefaultHistoryFilter, l as isValidUpdatePatch, u as localChannelOf, h as matchesHistoryFilter, s as normaliseHistoryTitle, f as pendingUpdatesByConversation, p as resolveRowControls };
89
+ export { h as DEFAULT_HISTORY_LIST_FILTER, t as HISTORY_TITLE_MAX_CODE_POINTS, e as MAX_PINNED, a as clampToCodePoints, l as coalesceUpdatePatch, o as codePointLength, s as collapseHistoryText, y as historyFilterEmptyKind, _ as historyFilterKey, v as isDefaultHistoryFilter, u as isValidUpdatePatch, d as localChannelOf, g as matchesHistoryFilter, c as normaliseHistoryTitle, p as pendingUpdatesByConversation, m as resolveRowControls };