@burdenoff/fe-libs 2026.930.5 → 2026.1001.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 (45) hide show
  1. package/dist/connections/api.d.ts.map +1 -1
  2. package/dist/connections/api.js +4 -3
  3. package/dist/connections/oauthPopup.d.ts.map +1 -1
  4. package/dist/connections/oauthPopup.js +8 -9
  5. package/dist/shared/assistant/conversation.d.ts +5 -1
  6. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  7. package/dist/shared/assistant/history/historyApi.d.ts +25 -9
  8. package/dist/shared/assistant/history/historyApi.d.ts.map +1 -1
  9. package/dist/shared/assistant/history/historyApi.js +220 -75
  10. package/dist/shared/assistant/history/historyControls.d.ts +86 -0
  11. package/dist/shared/assistant/history/historyControls.d.ts.map +1 -0
  12. package/dist/shared/assistant/history/historyControls.js +80 -0
  13. package/dist/shared/assistant/history/historyEngine.d.ts +23 -3
  14. package/dist/shared/assistant/history/historyEngine.d.ts.map +1 -1
  15. package/dist/shared/assistant/history/historyEngine.js +578 -369
  16. package/dist/shared/assistant/history/historyErrors.d.ts +25 -5
  17. package/dist/shared/assistant/history/historyErrors.d.ts.map +1 -1
  18. package/dist/shared/assistant/history/historyErrors.js +39 -30
  19. package/dist/shared/assistant/history/historyList.d.ts +33 -7
  20. package/dist/shared/assistant/history/historyList.d.ts.map +1 -1
  21. package/dist/shared/assistant/history/historyList.js +72 -51
  22. package/dist/shared/assistant/history/historyOperations.d.ts +36 -7
  23. package/dist/shared/assistant/history/historyOperations.d.ts.map +1 -1
  24. package/dist/shared/assistant/history/historyOperations.js +100 -25
  25. package/dist/shared/assistant/history/historyStatus.d.ts +27 -1
  26. package/dist/shared/assistant/history/historyStatus.d.ts.map +1 -1
  27. package/dist/shared/assistant/history/historyStatus.js +6 -2
  28. package/dist/shared/assistant/history/historyStore.d.ts +29 -7
  29. package/dist/shared/assistant/history/historyStore.d.ts.map +1 -1
  30. package/dist/shared/assistant/history/historyStore.js +172 -103
  31. package/dist/shared/assistant/history/historyTransportErrors.d.ts +28 -0
  32. package/dist/shared/assistant/history/historyTransportErrors.d.ts.map +1 -0
  33. package/dist/shared/assistant/history/historyTransportErrors.js +16 -0
  34. package/dist/shared/assistant/history/historyTypes.d.ts +80 -1
  35. package/dist/shared/assistant/history/historyTypes.d.ts.map +1 -1
  36. package/dist/shared/assistant/history/stampRegistry.d.ts +19 -1
  37. package/dist/shared/assistant/history/stampRegistry.d.ts.map +1 -1
  38. package/dist/shared/assistant/history/stampRegistry.js +13 -1
  39. package/dist/shared/assistant/index.d.ts +2 -0
  40. package/dist/shared/assistant/index.d.ts.map +1 -1
  41. package/dist/shared/assistant/store.d.ts +8 -0
  42. package/dist/shared/assistant/store.d.ts.map +1 -1
  43. package/dist/shared/assistant/store.js +50 -46
  44. package/dist/shared-assistant.js +164 -162
  45. package/package.json +1 -1
@@ -25,8 +25,14 @@
25
25
  * `RATE_LIMIT_EXCEEDED` (a busy scope, or the bound on tombstones for
26
26
  * never-seen ids), which carries `retryAfter` seconds. Backed off,
27
27
  * retried indefinitely: every write is idempotent.
28
+ * - `controls-unavailable` (BOFF-8159) — the transport found the server
29
+ * without the history controls. It never reaches here as a schema error:
30
+ * the transport's drift fallback ({@link isAssistantHistoryControlsDrift})
31
+ * answers with the documents from before the controls instead, so history
32
+ * carries on and nothing pauses. Only a call that has no such document (a
33
+ * control change, a filtered list) is refused this way, and it waits.
28
34
  */
29
- export type AssistantHistoryErrorClass = "schema-unavailable" | "rejected" | "quota" | "auth" | "not-found" | "scope-inactive" | "transient";
35
+ export type AssistantHistoryErrorClass = "schema-unavailable" | "rejected" | "quota" | "auth" | "not-found" | "scope-inactive" | "controls-unavailable" | "transient";
30
36
  export interface AssistantHistoryErrorVerdict {
31
37
  class: AssistantHistoryErrorClass;
32
38
  /** The first `extensions.code` found, for logs. */
@@ -38,6 +44,15 @@ export interface AssistantHistoryErrorVerdict {
38
44
  }
39
45
  /** The validator's two keys — the ONLY errors that drop a queued item. */
40
46
  export declare const ASSISTANT_HISTORY_REJECTION_KEYS: readonly string[];
47
+ /**
48
+ * A schema mismatch caused by the history controls alone: its message is a
49
+ * graphql-js validation message (`Cannot query field "pinnedAt"…`, `Unknown
50
+ * argument "filter"…`, `Unknown type "AssistantHistoryConversationFilter"`)
51
+ * AND it names a control. Coded or not — the gateway's request-phase remap
52
+ * answers `BAD_USER_INPUT` with the graphql-js message — and never our own
53
+ * validator's refusal, which carries an i18n key and no such message.
54
+ */
55
+ export declare function isAssistantHistoryControlsDrift(error: unknown): boolean;
41
56
  export declare function classifyAssistantHistoryError(error: unknown): AssistantHistoryErrorVerdict;
42
57
  /** How long a schema mismatch pauses the whole engine. */
43
58
  export declare const ASSISTANT_HISTORY_SCHEMA_PAUSE_MS: number;
@@ -46,9 +61,11 @@ export declare const ASSISTANT_HISTORY_QUOTA_RETRY_MS: number;
46
61
  export declare const ASSISTANT_HISTORY_BACKOFF_BASE_MS = 1000;
47
62
  export declare const ASSISTANT_HISTORY_BACKOFF_MAX_MS: number;
48
63
  /**
49
- * `drop` — this item only (and only a save); `pause` — the whole engine, for
50
- * `delayMs`; `park` — this item, until the panel opens or `delayMs`; `hold` —
51
- * until the scope, account or token changes; `retry` — this item after `delayMs`.
64
+ * `drop` — this item only (a save or a control change, never a delete);
65
+ * `pause` — the whole engine, for `delayMs`; `park` — this item, until the
66
+ * panel opens or `delayMs`; `hold` — until the scope, account or token
67
+ * changes, or (a control change) until the server has the controls again;
68
+ * `retry` — this item after `delayMs`.
52
69
  */
53
70
  export type AssistantHistoryRetryAction = "drop" | "pause" | "park" | "hold" | "retry";
54
71
  export interface AssistantHistoryRetryPlan {
@@ -64,9 +81,12 @@ export declare function assistantHistoryBackoffMs(attempts: number, random?: ()
64
81
  * let the conversation come back from the server on the next pull. A delete
65
82
  * the validator refuses (which only a client bug can cause) is retried on the
66
83
  * slow schedule instead, so the defect is visible rather than silent.
84
+ *
85
+ * A control change the validator refuses is dropped like a save: it can never
86
+ * be stored, and the list then shows what the server holds.
67
87
  */
68
88
  export declare function planAssistantHistoryRetry(verdict: AssistantHistoryErrorVerdict, item: {
69
- type: "save" | "delete";
89
+ type: "save" | "delete" | "update";
70
90
  attempts: number;
71
91
  }, random?: () => number): AssistantHistoryRetryPlan;
72
92
  //# sourceMappingURL=historyErrors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"historyErrors.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAQH,MAAM,MAAM,0BAA0B,GAClC,oBAAoB,GACpB,UAAU,GACV,OAAO,GACP,MAAM,GACN,WAAW,GACX,gBAAgB,GAChB,WAAW,CAAC;AAEhB,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,0BAA0B,CAAC;IAClC,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qGAAqG;IACrG,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,0EAA0E;AAC1E,eAAO,MAAM,gCAAgC,EAAE,SAAS,MAAM,EAG7D,CAAC;AAwCF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,4BAA4B,CA8C1F;AAID,0DAA0D;AAC1D,eAAO,MAAM,iCAAiC,QAAa,CAAC;AAC5D,4EAA4E;AAC5E,eAAO,MAAM,gCAAgC,QAAc,CAAC;AAC5D,eAAO,MAAM,iCAAiC,OAAQ,CAAC;AACvD,eAAO,MAAM,gCAAgC,QAAa,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvF,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,2BAA2B,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+EAA+E;AAC/E,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,MAAoB,GAAG,MAAM,CAQtG;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,4BAA4B,EACrC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EACnD,MAAM,GAAE,MAAM,MAAoB,GACjC,yBAAyB,CAuB3B"}
1
+ {"version":3,"file":"historyErrors.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AASH,MAAM,MAAM,0BAA0B,GAClC,oBAAoB,GACpB,UAAU,GACV,OAAO,GACP,MAAM,GACN,WAAW,GACX,gBAAgB,GAChB,sBAAsB,GACtB,WAAW,CAAC;AAEhB,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,0BAA0B,CAAC;IAClC,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qGAAqG;IACrG,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,0EAA0E;AAC1E,eAAO,MAAM,gCAAgC,EAAE,SAAS,MAAM,EAG7D,CAAC;AAmDF;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKvE;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,4BAA4B,CAiD1F;AAID,0DAA0D;AAC1D,eAAO,MAAM,iCAAiC,QAAa,CAAC;AAC5D,4EAA4E;AAC5E,eAAO,MAAM,gCAAgC,QAAc,CAAC;AAC5D,eAAO,MAAM,iCAAiC,OAAQ,CAAC;AACvD,eAAO,MAAM,gCAAgC,QAAa,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvF,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,2BAA2B,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+EAA+E;AAC/E,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,MAAoB,GAAG,MAAM,CAQtG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,4BAA4B,EACrC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAC9D,MAAM,GAAE,MAAM,MAAoB,GACjC,yBAAyB,CAwB3B"}
@@ -1,74 +1,83 @@
1
1
  import { classifyQuotaError as e, extensionObjectsIn as t, isQuotaExhaustedError as n } from "../quota.js";
2
- import { AssistantHistoryResponseError as r, AssistantHistoryScopeInactiveError as i } from "./historyApi.js";
2
+ import { AssistantHistoryControlsUnavailableError as r, AssistantHistoryResponseError as i, AssistantHistoryScopeInactiveError as a } from "./historyTransportErrors.js";
3
3
  //#region src/shared/assistant/history/historyErrors.ts
4
- var a = ["assistant.errors.invalidHistoryInput", "assistant.errors.historyPayloadTooLarge"], o = /Cannot query field|Unknown argument|Unknown type|is not defined by type|Variable "\$[^"]+" got invalid/i, s = new Set(["GRAPHQL_VALIDATION_FAILED", "GRAPHQL_PARSE_FAILED"]), c = new Set(["UNAUTHENTICATED", "FORBIDDEN"]);
5
- function l(e) {
4
+ var o = ["assistant.errors.invalidHistoryInput", "assistant.errors.historyPayloadTooLarge"], s = /Cannot query field|Unknown argument|Unknown type|is not defined by type|Variable "\$[^"]+" got invalid/i, c = new Set(["GRAPHQL_VALIDATION_FAILED", "GRAPHQL_PARSE_FAILED"]), l = new Set(["UNAUTHENTICATED", "FORBIDDEN"]);
5
+ function u(e) {
6
6
  return e instanceof Error ? e.message : typeof e == "string" ? e : "";
7
7
  }
8
- function u(e, t) {
8
+ function d(e, t) {
9
9
  for (let n of e) {
10
10
  let e = n[t];
11
11
  if (typeof e == "string" && e.length > 0) return e;
12
12
  }
13
13
  }
14
- function d(e) {
14
+ function f(e) {
15
15
  for (let t of e) {
16
16
  let e = t.retryAfter;
17
17
  if (typeof e == "number" && Number.isFinite(e) && e > 0) return Math.min(e, 3600) * 1e3;
18
18
  }
19
19
  }
20
- function f(f) {
21
- if (f instanceof i) return { class: "scope-inactive" };
22
- if (f instanceof r) return { class: "schema-unavailable" };
23
- let p = t(f), m = new Set(p.map((e) => e.code).filter((e) => typeof e == "string")), h = new Set(p.map((e) => e.i18nKey).filter((e) => typeof e == "string")), g = u(p, "code"), _ = u(p, "i18nKey"), v = (e) => ({
20
+ var p = /\b(?:pinnedAt|archivedAt|channel|filter|AssistantHistoryConversationFilter|AssistantHistoryChannel(?:Filter)?|AssistantHistoryArchivedFilter|AssistantHistoryUpdateOutcome|updateMyAssistantConversation|UpdateMyAssistantConversationInput|UpdateMyAssistantConversationPayload)\b/;
21
+ function m(e) {
22
+ let n = u(e);
23
+ if (!s.test(n) || !p.test(n)) return !1;
24
+ let r = t(e).map((e) => e.i18nKey);
25
+ return !o.some((e) => r.includes(e));
26
+ }
27
+ function h(p) {
28
+ if (p instanceof a) return { class: "scope-inactive" };
29
+ if (p instanceof r) return { class: "controls-unavailable" };
30
+ if (p instanceof i) return { class: "schema-unavailable" };
31
+ let m = t(p), h = new Set(m.map((e) => e.code).filter((e) => typeof e == "string")), g = new Set(m.map((e) => e.i18nKey).filter((e) => typeof e == "string")), _ = d(m, "code"), v = d(m, "i18nKey"), y = (e) => ({
24
32
  class: e,
25
- ...g ? { code: g } : {},
26
- ..._ ? { i18nKey: _ } : {}
33
+ ..._ ? { code: _ } : {},
34
+ ...v ? { i18nKey: v } : {}
27
35
  });
28
- if (m.has("BAD_USER_INPUT") && a.some((e) => h.has(e))) return v("rejected");
29
- if (o.test(l(f)) || [...m].some((e) => s.has(e))) return v("schema-unavailable");
30
- if (m.has("RATE_LIMIT_EXCEEDED")) {
31
- let e = d(p);
36
+ if (h.has("BAD_USER_INPUT") && o.some((e) => g.has(e))) return y("rejected");
37
+ if (s.test(u(p)) || [...h].some((e) => c.has(e))) return y("schema-unavailable");
38
+ if (h.has("RATE_LIMIT_EXCEEDED")) {
39
+ let e = f(m);
32
40
  return {
33
- ...v("transient"),
41
+ ...y("transient"),
34
42
  ...e ? { retryAfterMs: e } : {}
35
43
  };
36
44
  }
37
- return e(f) !== null || n(f) ? v("quota") : [...m].some((e) => c.has(e)) ? v("auth") : m.has("NOT_FOUND") ? v("not-found") : m.has("BAD_USER_INPUT") ? v("schema-unavailable") : v("transient");
45
+ return e(p) !== null || n(p) ? y("quota") : [...h].some((e) => l.has(e)) ? y("auth") : h.has("NOT_FOUND") ? y("not-found") : h.has("BAD_USER_INPUT") ? y("schema-unavailable") : y("transient");
38
46
  }
39
- var p = 5 * 6e4, m = 10 * 6e4, h = 1e3, g = 5 * 6e4;
40
- function _(e, t = Math.random) {
41
- let n = Math.min(g, h * 2 ** Math.max(0, Math.min(e, 20))), r = n / 2 + n / 2 * Math.min(Math.max(t(), 0), 1);
47
+ var g = 5 * 6e4, _ = 10 * 6e4, v = 1e3, y = 5 * 6e4;
48
+ function b(e, t = Math.random) {
49
+ let n = Math.min(y, v * 2 ** Math.max(0, Math.min(e, 20))), r = n / 2 + n / 2 * Math.min(Math.max(t(), 0), 1);
42
50
  return Math.round(r);
43
51
  }
44
- function v(e, t, n = Math.random) {
52
+ function x(e, t, n = Math.random) {
45
53
  switch (e.class) {
46
- case "rejected": return t.type === "save" ? {
54
+ case "rejected": return t.type === "delete" ? {
55
+ action: "retry",
56
+ delayMs: y
57
+ } : {
47
58
  action: "drop",
48
59
  delayMs: 0
49
- } : {
50
- action: "retry",
51
- delayMs: g
52
60
  };
53
61
  case "schema-unavailable": return {
54
62
  action: "pause",
55
- delayMs: p
63
+ delayMs: g
56
64
  };
57
65
  case "quota": return {
58
66
  action: "park",
59
- delayMs: m
67
+ delayMs: _
60
68
  };
61
69
  case "auth":
62
- case "scope-inactive": return {
70
+ case "scope-inactive":
71
+ case "controls-unavailable": return {
63
72
  action: "hold",
64
73
  delayMs: 0
65
74
  };
66
75
  case "not-found":
67
76
  case "transient": return {
68
77
  action: "retry",
69
- delayMs: Math.max(_(t.attempts, n), e.retryAfterMs ?? 0)
78
+ delayMs: Math.max(b(t.attempts, n), e.retryAfterMs ?? 0)
70
79
  };
71
80
  }
72
81
  }
73
82
  //#endregion
74
- export { h as ASSISTANT_HISTORY_BACKOFF_BASE_MS, g as ASSISTANT_HISTORY_BACKOFF_MAX_MS, m as ASSISTANT_HISTORY_QUOTA_RETRY_MS, a as ASSISTANT_HISTORY_REJECTION_KEYS, p as ASSISTANT_HISTORY_SCHEMA_PAUSE_MS, _ as assistantHistoryBackoffMs, f as classifyAssistantHistoryError, v as planAssistantHistoryRetry };
83
+ export { v as ASSISTANT_HISTORY_BACKOFF_BASE_MS, y as ASSISTANT_HISTORY_BACKOFF_MAX_MS, _ as ASSISTANT_HISTORY_QUOTA_RETRY_MS, o as ASSISTANT_HISTORY_REJECTION_KEYS, g as ASSISTANT_HISTORY_SCHEMA_PAUSE_MS, b as assistantHistoryBackoffMs, h as classifyAssistantHistoryError, m as isAssistantHistoryControlsDrift, x as planAssistantHistoryRetry };
@@ -1,11 +1,15 @@
1
1
  import { AssistantModeConfig, Conversation, ConversationSyncStamp } from '../conversation';
2
2
  import { AssistantMode } from '../types';
3
- import { AssistantHistoryConvKey, AssistantHistoryHeader, AssistantHistoryScope, AssistantHistoryScopeKey, AssistantHistoryServerConversation, AssistantHistoryTombstone } from './historyTypes';
3
+ import { AssistantHistoryChannel, AssistantHistoryConvKey, AssistantHistoryConversationFilter, AssistantHistoryHeader, AssistantHistoryOutboxItem, AssistantHistoryScope, AssistantHistoryScopeKey, AssistantHistoryServerConversation, AssistantHistoryTombstone } from './historyTypes';
4
4
  /** The scope a stamped conversation belongs to. */
5
5
  export declare function historyScopeKeyOfStamp(sync: ConversationSyncStamp): AssistantHistoryScopeKey;
6
6
  /** A server conversation's key here: its client id, or `legacy:<id>` for a pre-v2 row. */
7
7
  export declare function historyConvKeyOf(conversation: Pick<AssistantHistoryServerConversation, "id" | "clientConversationId">): AssistantHistoryConvKey;
8
- /** The header the list keeps for a live server conversation. */
8
+ /**
9
+ * The header the list keeps for a live server conversation. The history
10
+ * controls are copied only when the server's answer carried them: a header
11
+ * read without them leaves them out (unknown), never null ("not pinned").
12
+ */
9
13
  export declare function historyHeaderOf(conversation: AssistantHistoryServerConversation): AssistantHistoryHeader;
10
14
  /**
11
15
  * Has this conversation got anything to lose — so it must never be reused as
@@ -72,6 +76,16 @@ export interface AssistantHistoryListRow {
72
76
  /** Why its latest turns are not being saved. */
73
77
  blocked?: ConversationSyncStamp["blocked"];
74
78
  loading: boolean;
79
+ /** When it was pinned (a queued pin: when the person pinned it). Null: not pinned. */
80
+ pinnedAt: string | null;
81
+ /** When it was archived. Null: not archived. */
82
+ archivedAt: string | null;
83
+ /** The kinds of person turns it holds (the server's and this device's together). Null: none yet, or unknown. */
84
+ channel: AssistantHistoryChannel | null;
85
+ /** The server's pin and archive state is known here (it may be offered). */
86
+ controlsKnown: boolean;
87
+ /** A control change to it is queued and not answered yet. */
88
+ controlsPending: boolean;
75
89
  }
76
90
  export interface AssistantHistoryListInput {
77
91
  conversations: readonly Conversation[];
@@ -83,13 +97,23 @@ export interface AssistantHistoryListInput {
83
97
  olderHeaders?: Readonly<Record<AssistantHistoryConvKey, AssistantHistoryHeader>>;
84
98
  tombstones: Readonly<Record<AssistantHistoryConvKey, AssistantHistoryTombstone>>;
85
99
  loadingIds?: Readonly<Record<string, true>>;
100
+ /** The history outbox: its queued control changes are what the rows show first. */
101
+ outbox?: readonly AssistantHistoryOutboxItem[];
86
102
  }
87
103
  export interface AssistantHistoryList {
88
104
  workspace: AssistantHistoryListRow[];
89
105
  device: Conversation[];
90
106
  }
91
- /** The two groups the list renders (see the module docblock). */
92
- export declare function selectAssistantHistoryList(input: AssistantHistoryListInput): AssistantHistoryList;
107
+ /**
108
+ * The two groups the list renders (see the module docblock), filtered by
109
+ * `filter` — by default every conversation that is not archived.
110
+ *
111
+ * "This workspace" leads with the pinned rows (newest pin first), then the
112
+ * rest by `updatedAt`, newest first. "On this device" keeps the order it has
113
+ * always had: nothing there can be pinned (a device-only conversation keeps
114
+ * only Rename and Delete), and the filter's channel reads its own messages.
115
+ */
116
+ export declare function selectAssistantHistoryList(input: AssistantHistoryListInput, filter?: Readonly<AssistantHistoryConversationFilter>): AssistantHistoryList;
93
117
  /** Server-backed conversations kept on this device at most (the least recently opened go first). */
94
118
  export declare const ASSISTANT_HISTORY_MAX_CACHED_CONVERSATIONS = 25;
95
119
  export interface HistoryEvictionInput {
@@ -107,9 +131,11 @@ export interface HistoryEvictionInput {
107
131
  * The server-backed conversations to evict, least recently opened first.
108
132
  *
109
133
  * Never evicted: device-only conversations (they exist nowhere else), the open
110
- * one, one with queued saves or deletes, one with a turn or a voice session in
111
- * it, one renamed here (the new name exists only here) or one whose turns are
112
- * not being saved (`blocked`: its history is only here too).
134
+ * one, one with queued saves, deletes or control changes (the engine's
135
+ * `isProtected` holds every conversation the outbox names), one with a turn or
136
+ * a voice session in it, one renamed here before renames were synced (the name
137
+ * exists only here) or one whose turns are not being saved (`blocked`: its
138
+ * history is only here too).
113
139
  */
114
140
  export declare function selectHistoryEvictions(input: HistoryEvictionInput): string[];
115
141
  //# sourceMappingURL=historyList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"historyList.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyList.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAEZ,qBAAqB,EACtB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AC;CACxB;AAID,iEAAiE;AACjE,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,yBAAyB,GAAG,oBAAoB,CAgDjG;AAID,oGAAoG;AACpG,eAAO,MAAM,0CAA0C,KAAK,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;IACvC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,WAAW,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,CAAC;CACtD;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAkB5E"}
1
+ {"version":3,"file":"historyList.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyList.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAEZ,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAQ9C,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,kCAAkC,EACvC,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,kCAAkC,EACvC,KAAK,yBAAyB,EAC/B,MAAM,gBAAgB,CAAC;AAExB,mDAAmD;AACnD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,qBAAqB,GAAG,wBAAwB,CAM5F;AAED,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,IAAI,CAAC,kCAAkC,EAAE,IAAI,GAAG,sBAAsB,CAAC,GACpF,uBAAuB,CAEzB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,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AAO,MAAM,0CAA0C,KAAK,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;IACvC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,WAAW,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,CAAC;CACtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAkB5E"}
@@ -1,18 +1,19 @@
1
1
  import "../autoRouting.js";
2
- import { modeRequiresConfirmWrites as e } from "../api.js";
3
- import { assistantHistoryScopeKey as t, legacyHistoryConvKey as n } from "./historyTypes.js";
2
+ import { DEFAULT_HISTORY_LIST_FILTER as e, matchesHistoryFilter as t, pendingUpdatesByConversation as n, resolveRowControls as r } from "./historyControls.js";
3
+ import { modeRequiresConfirmWrites as i } from "../api.js";
4
+ import { assistantHistoryScopeKey as a, legacyHistoryConvKey as o } from "./historyTypes.js";
4
5
  //#region src/shared/assistant/history/historyList.ts
5
- function r(e) {
6
- return t({
6
+ function s(e) {
7
+ return a({
7
8
  actorId: e.actorId,
8
9
  workspaceId: e.workspaceId,
9
10
  product: e.product
10
11
  });
11
12
  }
12
- function i(e) {
13
- return e.clientConversationId ?? n(e.id);
13
+ function c(e) {
14
+ return e.clientConversationId ?? o(e.id);
14
15
  }
15
- function a(e) {
16
+ function l(e) {
16
17
  return {
17
18
  serverId: e.id,
18
19
  clientConversationId: e.clientConversationId,
@@ -21,29 +22,32 @@ function a(e) {
21
22
  revision: e.revision,
22
23
  lastMessageSeq: e.lastMessageSeq,
23
24
  createdAt: e.createdAt,
24
- updatedAt: e.updatedAt
25
+ updatedAt: e.updatedAt,
26
+ ...e.pinnedAt === void 0 ? {} : { pinnedAt: e.pinnedAt },
27
+ ...e.archivedAt === void 0 ? {} : { archivedAt: e.archivedAt },
28
+ ...e.channel === void 0 ? {} : { channel: e.channel }
25
29
  };
26
30
  }
27
- function o(e) {
31
+ function u(e) {
28
32
  return e.messages.length > 0 || !!e.backendSessionId || !!e.sync?.serverId || e.sync?.origin === "remote" || e.sync?.origin === "legacy";
29
33
  }
30
- function s(e) {
34
+ function d(e) {
31
35
  return e?.sync?.origin === "legacy";
32
36
  }
33
- function c(e, t) {
37
+ function f(e, t) {
34
38
  let n = e?.sync;
35
39
  return !n || !t ? !1 : n.product !== t.product || n.workspaceId !== t.workspaceId || n.actorId !== t.actorId;
36
40
  }
37
- function l(e, t) {
38
- if (o(e)) return !1;
41
+ function p(e, t) {
42
+ if (u(e)) return !1;
39
43
  let n = e.sync;
40
44
  return !t || !n ? !t && !n : n.product === t.product && n.workspaceId === t.workspaceId && n.actorId === t.actorId;
41
45
  }
42
- function u(t) {
43
- return t.find((t) => t.id === "assistant" || !t.writeCapable && !t.requiresAdmin && !e(t.id))?.id ?? "assistant";
46
+ function m(e) {
47
+ return e.find((e) => e.id === "assistant" || !e.writeCapable && !e.requiresAdmin && !i(e.id))?.id ?? "assistant";
44
48
  }
45
- function d(e, t, n, r) {
46
- let i = u(r.modes), a = i === "assistant" && r.autoRouting ? "auto" : void 0;
49
+ function h(e, t, n, r) {
50
+ let i = m(r.modes), a = i === "assistant" && r.autoRouting ? "auto" : void 0;
47
51
  return {
48
52
  id: e,
49
53
  title: t.title ?? "",
@@ -66,51 +70,68 @@ function d(e, t, n, r) {
66
70
  }
67
71
  };
68
72
  }
69
- var f = (e, t) => e > t ? e : t;
70
- function p(e) {
71
- let t = [], n = /* @__PURE__ */ new Map(), i = e.loadingIds ?? {};
72
- for (let a of e.conversations) {
73
- let o = a.sync;
74
- if (!o) {
75
- t.push(a);
73
+ var g = (e, t) => e > t ? e : t, _ = [];
74
+ function v(i, a = e) {
75
+ let o = [], c = /* @__PURE__ */ new Map(), l = i.loadingIds ?? {}, u = n(i.outbox ?? [], i.scopeKey);
76
+ for (let e of i.conversations) {
77
+ let n = e.sync;
78
+ if (!n) {
79
+ t(r(e, null), a) && o.push(e);
76
80
  continue;
77
81
  }
78
- if (e.scopeKey === null || r(o) !== e.scopeKey || a.id in e.tombstones) continue;
79
- let s = e.headers[a.id] ?? e.olderHeaders?.[a.id] ?? null;
80
- n.set(a.id, {
81
- key: a.id,
82
- title: a.title,
83
- updatedAt: s ? f(a.updatedAt, s.updatedAt) : a.updatedAt,
84
- conversation: a,
85
- header: s,
86
- legacy: o.origin === "legacy",
87
- ...o.blocked ? { blocked: o.blocked } : {},
88
- loading: a.id in i
82
+ if (i.scopeKey === null || s(n) !== i.scopeKey || e.id in i.tombstones) continue;
83
+ let d = i.headers[e.id] ?? i.olderHeaders?.[e.id] ?? null, f = r(e, d, u[e.id] ?? _);
84
+ c.set(e.id, {
85
+ key: e.id,
86
+ title: f.pendingTitle ?? e.title,
87
+ updatedAt: d ? g(e.updatedAt, d.updatedAt) : e.updatedAt,
88
+ conversation: e,
89
+ header: d,
90
+ legacy: n.origin === "legacy",
91
+ ...n.blocked ? { blocked: n.blocked } : {},
92
+ loading: e.id in l,
93
+ pinnedAt: f.pinnedAt,
94
+ archivedAt: f.archivedAt,
95
+ channel: f.channel,
96
+ controlsKnown: f.known,
97
+ controlsPending: f.pending
89
98
  });
90
99
  }
91
- if (e.scopeKey !== null) {
92
- let t = [e.headers, e.olderHeaders ?? {}];
93
- for (let r of t) for (let [t, a] of Object.entries(r)) n.has(t) || a.gone || t in e.tombstones || n.set(t, {
94
- key: t,
95
- title: a.title ?? "",
96
- updatedAt: a.updatedAt,
97
- conversation: null,
98
- header: a,
99
- legacy: a.legacy,
100
- loading: t in i
101
- });
100
+ if (i.scopeKey !== null) {
101
+ let e = [i.headers, i.olderHeaders ?? {}];
102
+ for (let t of e) for (let [e, n] of Object.entries(t)) {
103
+ if (c.has(e) || n.gone || e in i.tombstones) continue;
104
+ let t = r(null, n, u[e] ?? _);
105
+ c.set(e, {
106
+ key: e,
107
+ title: t.pendingTitle ?? n.title ?? "",
108
+ updatedAt: n.updatedAt,
109
+ conversation: null,
110
+ header: n,
111
+ legacy: n.legacy,
112
+ loading: e in l,
113
+ pinnedAt: t.pinnedAt,
114
+ archivedAt: t.archivedAt,
115
+ channel: t.channel,
116
+ controlsKnown: t.known,
117
+ controlsPending: t.pending
118
+ });
119
+ }
102
120
  }
103
121
  return {
104
- workspace: [...n.values()].sort((e, t) => e.updatedAt === t.updatedAt ? e.key < t.key ? -1 : 1 : e.updatedAt < t.updatedAt ? 1 : -1),
105
- device: t
122
+ workspace: [...c.values()].filter((e) => t(e, a)).sort(y),
123
+ device: o
106
124
  };
107
125
  }
108
- var m = 25;
109
- function h(e) {
126
+ function y(e, t) {
127
+ return e.pinnedAt === null == (t.pinnedAt === null) ? e.pinnedAt !== null && t.pinnedAt !== null && e.pinnedAt !== t.pinnedAt ? e.pinnedAt < t.pinnedAt ? 1 : -1 : e.updatedAt === t.updatedAt ? e.key < t.key ? -1 : Number(e.key > t.key) : e.updatedAt < t.updatedAt ? 1 : -1 : e.pinnedAt === null ? 1 : -1;
128
+ }
129
+ var b = 25;
130
+ function x(e) {
110
131
  let t = e.conversations.filter((e) => !!e.sync?.serverId), n = t.length - e.max;
111
132
  if (n <= 0) return [];
112
133
  let r = (e) => e.sync?.openedAt ?? e.updatedAt;
113
134
  return t.filter((t) => t.id !== e.activeConversationId && !t.sync?.titleLocked && !t.sync?.blocked && !e.isProtected(t)).sort((e, t) => r(e) === r(t) ? e.id < t.id ? -1 : 1 : r(e) < r(t) ? -1 : 1).slice(0, n).map((e) => e.id);
114
135
  }
115
136
  //#endregion
116
- export { m as ASSISTANT_HISTORY_MAX_CACHED_CONVERSATIONS, o as conversationHasHistory, i as historyConvKeyOf, a as historyHeaderOf, r as historyScopeKeyOfStamp, c as isOtherScopeHistoryConversation, s as isReadOnlyHistoryConversation, l as isReusableHistoryDraft, d as materializeHistoryHeader, u as resolveHistoryReopenMode, p as selectAssistantHistoryList, h as selectHistoryEvictions };
137
+ export { b as ASSISTANT_HISTORY_MAX_CACHED_CONVERSATIONS, u as conversationHasHistory, c as historyConvKeyOf, l as historyHeaderOf, s as historyScopeKeyOfStamp, f as isOtherScopeHistoryConversation, d as isReadOnlyHistoryConversation, p as isReusableHistoryDraft, h as materializeHistoryHeader, m as resolveHistoryReopenMode, v as selectAssistantHistoryList, x as selectHistoryEvictions };
@@ -1,24 +1,53 @@
1
- import { AssistantHistoryConvRef, AssistantHistoryEntryPaging, AssistantHistorySaveInput, AssistantHistoryScope } from './historyTypes';
1
+ import { AssistantHistoryConvRef, AssistantHistoryConversationFilter, AssistantHistoryEntryPaging, AssistantHistorySaveInput, AssistantHistoryScope, AssistantHistoryUpdatePatch } from './historyTypes';
2
2
  export declare const ASSISTANT_HISTORY_CHANGES_OPERATION = "AssistantHistoryChanges";
3
- export declare const ASSISTANT_HISTORY_CHANGES_QUERY = "\n query AssistantHistoryChanges($productId: String!, $first: Int, $after: String) {\n myAssistantHistoryChanges(productId: $productId, first: $first, after: $after) {\n nodes {\n id\n clientConversationId\n productId\n title\n legacy\n revision\n lastMessageSeq\n deleted\n deletedAt\n createdAt\n updatedAt\n}\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n}\n resetRequired\n }\n }\n";
3
+ export declare const ASSISTANT_HISTORY_CHANGES_QUERY: string;
4
+ export declare const ASSISTANT_HISTORY_CHANGES_QUERY_BASE: string;
4
5
  export declare const ASSISTANT_HISTORY_CONVERSATIONS_OPERATION = "AssistantHistoryConversations";
5
- export declare const ASSISTANT_HISTORY_CONVERSATIONS_QUERY = "\n query AssistantHistoryConversations($productId: String!, $first: Int, $after: String) {\n myAssistantConversations(productId: $productId, first: $first, after: $after) {\n nodes {\n id\n clientConversationId\n productId\n title\n legacy\n revision\n lastMessageSeq\n deleted\n deletedAt\n createdAt\n updatedAt\n}\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n}\n }\n }\n";
6
+ /** With the controls, the list takes a `filter` (omitted: every live conversation, archived included). */
7
+ export declare const ASSISTANT_HISTORY_CONVERSATIONS_QUERY = "\n query AssistantHistoryConversations(\n $productId: String!\n $first: Int\n $after: String\n $filter: AssistantHistoryConversationFilter\n ) {\n myAssistantConversations(productId: $productId, first: $first, after: $after, filter: $filter) {\n nodes {\n id\n clientConversationId\n productId\n title\n legacy\n revision\n lastMessageSeq\n deleted\n deletedAt\n createdAt\n updatedAt\n pinnedAt\n archivedAt\n channel\n}\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n}\n }\n }\n";
8
+ export declare const ASSISTANT_HISTORY_CONVERSATIONS_QUERY_BASE = "\n query AssistantHistoryConversations($productId: String!, $first: Int, $after: String) {\n myAssistantConversations(productId: $productId, first: $first, after: $after) {\n nodes {\n id\n clientConversationId\n productId\n title\n legacy\n revision\n lastMessageSeq\n deleted\n deletedAt\n createdAt\n updatedAt\n}\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n}\n }\n }\n";
6
9
  export declare const ASSISTANT_HISTORY_ENTRIES_OPERATION = "AssistantHistoryEntries";
7
- export declare const ASSISTANT_HISTORY_ENTRIES_QUERY = "\n query AssistantHistoryEntries(\n $productId: String!\n $clientConversationId: ID\n $conversationId: ID\n $first: Int\n $after: String\n $sinceSeq: Int\n $last: Int\n $before: String\n ) {\n myAssistantConversationEntries(\n productId: $productId\n clientConversationId: $clientConversationId\n conversationId: $conversationId\n first: $first\n after: $after\n sinceSeq: $sinceSeq\n last: $last\n before: $before\n ) {\n conversation {\n id\n clientConversationId\n productId\n title\n legacy\n revision\n lastMessageSeq\n deleted\n deletedAt\n createdAt\n updatedAt\n}\n nodes {\n id\n clientMessageId\n kind\n role\n content\n seq\n createdAt\n clientCreatedAt\n metadata\n}\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n}\n }\n }\n";
10
+ export declare const ASSISTANT_HISTORY_ENTRIES_QUERY: string;
11
+ export declare const ASSISTANT_HISTORY_ENTRIES_QUERY_BASE: string;
8
12
  export declare const ASSISTANT_HISTORY_SAVE_OPERATION = "SaveAssistantHistoryEntries";
9
- export declare const ASSISTANT_HISTORY_SAVE_MUTATION = "\n mutation SaveAssistantHistoryEntries($input: SaveMyAssistantHistoryEntriesInput!) {\n saveMyAssistantHistoryEntries(input: $input) {\n outcome\n conversation {\n id\n clientConversationId\n productId\n title\n legacy\n revision\n lastMessageSeq\n deleted\n deletedAt\n createdAt\n updatedAt\n}\n entries {\n id\n clientMessageId\n kind\n role\n content\n seq\n createdAt\n clientCreatedAt\n metadata\n}\n droppedMetadataKeys\n }\n }\n";
13
+ export declare const ASSISTANT_HISTORY_SAVE_MUTATION: string;
14
+ export declare const ASSISTANT_HISTORY_SAVE_MUTATION_BASE: string;
10
15
  export declare const ASSISTANT_HISTORY_DELETE_OPERATION = "DeleteAssistantHistoryConversation";
11
- export declare const ASSISTANT_HISTORY_DELETE_MUTATION = "\n mutation DeleteAssistantHistoryConversation(\n $productId: String!\n $clientConversationId: ID\n $conversationId: ID\n ) {\n deleteMyAssistantConversation(\n productId: $productId\n clientConversationId: $clientConversationId\n conversationId: $conversationId\n ) {\n outcome\n conversation {\n id\n clientConversationId\n productId\n title\n legacy\n revision\n lastMessageSeq\n deleted\n deletedAt\n createdAt\n updatedAt\n}\n }\n }\n";
12
- /** Every operation, for the contract test and for anything that audits what the client sends. */
16
+ export declare const ASSISTANT_HISTORY_DELETE_MUTATION: string;
17
+ export declare const ASSISTANT_HISTORY_DELETE_MUTATION_BASE: string;
18
+ /** Rename, pin, archive (BOFF-8159). FULL only: there is nothing to fall back to. */
19
+ export declare const ASSISTANT_HISTORY_UPDATE_OPERATION = "UpdateAssistantHistoryConversation";
20
+ export declare const ASSISTANT_HISTORY_UPDATE_MUTATION = "\n mutation UpdateAssistantHistoryConversation($input: UpdateMyAssistantConversationInput!) {\n updateMyAssistantConversation(input: $input) {\n outcome\n conversation {\n id\n clientConversationId\n productId\n title\n legacy\n revision\n lastMessageSeq\n deleted\n deletedAt\n createdAt\n updatedAt\n pinnedAt\n archivedAt\n channel\n}\n }\n }\n";
21
+ /**
22
+ * Every document, for the contract test and for anything that audits what the
23
+ * client sends: the FULL set (six operations) and the BASE set (the five from
24
+ * before the controls), each validated against the server's SDL.
25
+ */
13
26
  export declare const ASSISTANT_HISTORY_OPERATIONS: ReadonlyArray<{
14
27
  operationName: string;
15
28
  document: string;
29
+ set: "full" | "base";
16
30
  }>;
17
31
  export declare function buildHistoryPageVariables(scope: AssistantHistoryScope, page: {
18
32
  first: number;
19
33
  after: string | null;
20
34
  }): Record<string, unknown>;
35
+ /**
36
+ * The live list's variables. `filter` is sent only when given: omitted, the
37
+ * server answers exactly as before the controls (every live conversation,
38
+ * archived included); given, archived defaults to EXCLUDE there.
39
+ */
40
+ export declare function buildHistoryListVariables(scope: AssistantHistoryScope, page: {
41
+ first: number;
42
+ after: string | null;
43
+ filter?: AssistantHistoryConversationFilter;
44
+ }): Record<string, unknown>;
21
45
  export declare function buildHistoryEntriesVariables(scope: AssistantHistoryScope, ref: AssistantHistoryConvRef, page: AssistantHistoryEntryPaging): Record<string, unknown>;
22
46
  export declare function buildHistorySaveVariables(scope: AssistantHistoryScope, input: AssistantHistorySaveInput): Record<string, unknown>;
23
47
  export declare function buildHistoryDeleteVariables(scope: AssistantHistoryScope, ref: AssistantHistoryConvRef): Record<string, unknown>;
48
+ /**
49
+ * A control change (BOFF-8159). Only the fields in the patch are sent: a field
50
+ * left out is never written by the server, so a rename can never unpin.
51
+ */
52
+ export declare function buildHistoryUpdateVariables(scope: AssistantHistoryScope, ref: AssistantHistoryConvRef, patch: AssistantHistoryUpdatePatch): Record<string, unknown>;
24
53
  //# sourceMappingURL=historyOperations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"historyOperations.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyOperations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,uBAAuB,EACvB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+ {"version":3,"file":"historyOperations.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyOperations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EACV,uBAAuB,EACvB,kCAAkC,EAClC,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AAyCxB,eAAO,MAAM,mCAAmC,4BAA4B,CAAC;AAU7E,eAAO,MAAM,+BAA+B,QAAoC,CAAC;AACjF,eAAO,MAAM,oCAAoC,QAAyC,CAAC;AAE3F,eAAO,MAAM,yCAAyC,kCACrB,CAAC;AAClC,0GAA0G;AAC1G,eAAO,MAAM,qCAAqC,+iBAYjD,CAAC;AACF,eAAO,MAAM,0CAA0C,sbAOtD,CAAC;AAEF,eAAO,MAAM,mCAAmC,4BAA4B,CAAC;AA4B7E,eAAO,MAAM,+BAA+B,QAAoC,CAAC;AACjF,eAAO,MAAM,oCAAoC,QAAyC,CAAC;AAE3F,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAW9E,eAAO,MAAM,+BAA+B,QAAoC,CAAC;AACjF,eAAO,MAAM,oCAAoC,QAAyC,CAAC;AAE3F,eAAO,MAAM,kCAAkC,uCAAuC,CAAC;AAiBvF,eAAO,MAAM,iCAAiC,QAAsC,CAAC;AACrF,eAAO,MAAM,sCAAsC,QAA2C,CAAC;AAE/F,qFAAqF;AACrF,eAAO,MAAM,kCAAkC,uCAAuC,CAAC;AACvF,eAAO,MAAM,iCAAiC,gYAO7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,aAAa,CAAC;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACtB,CAwDA,CAAC;AAIF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,qBAAqB,EAC5B,IAAI,E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