@burdenoff/fe-libs 2026.930.5 → 2026.1001.1

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 (41) hide show
  1. package/dist/shared/assistant/conversation.d.ts +5 -1
  2. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  3. package/dist/shared/assistant/history/historyApi.d.ts +25 -9
  4. package/dist/shared/assistant/history/historyApi.d.ts.map +1 -1
  5. package/dist/shared/assistant/history/historyApi.js +220 -75
  6. package/dist/shared/assistant/history/historyControls.d.ts +86 -0
  7. package/dist/shared/assistant/history/historyControls.d.ts.map +1 -0
  8. package/dist/shared/assistant/history/historyControls.js +80 -0
  9. package/dist/shared/assistant/history/historyEngine.d.ts +23 -3
  10. package/dist/shared/assistant/history/historyEngine.d.ts.map +1 -1
  11. package/dist/shared/assistant/history/historyEngine.js +578 -369
  12. package/dist/shared/assistant/history/historyErrors.d.ts +25 -5
  13. package/dist/shared/assistant/history/historyErrors.d.ts.map +1 -1
  14. package/dist/shared/assistant/history/historyErrors.js +39 -30
  15. package/dist/shared/assistant/history/historyList.d.ts +33 -7
  16. package/dist/shared/assistant/history/historyList.d.ts.map +1 -1
  17. package/dist/shared/assistant/history/historyList.js +72 -51
  18. package/dist/shared/assistant/history/historyOperations.d.ts +36 -7
  19. package/dist/shared/assistant/history/historyOperations.d.ts.map +1 -1
  20. package/dist/shared/assistant/history/historyOperations.js +100 -25
  21. package/dist/shared/assistant/history/historyStatus.d.ts +27 -1
  22. package/dist/shared/assistant/history/historyStatus.d.ts.map +1 -1
  23. package/dist/shared/assistant/history/historyStatus.js +6 -2
  24. package/dist/shared/assistant/history/historyStore.d.ts +29 -7
  25. package/dist/shared/assistant/history/historyStore.d.ts.map +1 -1
  26. package/dist/shared/assistant/history/historyStore.js +172 -103
  27. package/dist/shared/assistant/history/historyTransportErrors.d.ts +28 -0
  28. package/dist/shared/assistant/history/historyTransportErrors.d.ts.map +1 -0
  29. package/dist/shared/assistant/history/historyTransportErrors.js +16 -0
  30. package/dist/shared/assistant/history/historyTypes.d.ts +80 -1
  31. package/dist/shared/assistant/history/historyTypes.d.ts.map +1 -1
  32. package/dist/shared/assistant/history/stampRegistry.d.ts +19 -1
  33. package/dist/shared/assistant/history/stampRegistry.d.ts.map +1 -1
  34. package/dist/shared/assistant/history/stampRegistry.js +13 -1
  35. package/dist/shared/assistant/index.d.ts +2 -0
  36. package/dist/shared/assistant/index.d.ts.map +1 -1
  37. package/dist/shared/assistant/store.d.ts +8 -0
  38. package/dist/shared/assistant/store.d.ts.map +1 -1
  39. package/dist/shared/assistant/store.js +50 -46
  40. package/dist/shared-assistant.js +164 -162
  41. package/package.json +1 -1
@@ -302,7 +302,11 @@ export interface ConversationSyncStamp {
302
302
  hasOlder?: true;
303
303
  /** Where "Show earlier messages" continues from. */
304
304
  olderCursor?: string;
305
- /** Renamed on this device: the server's title never overwrites it (renames are not synced). */
305
+ /**
306
+ * Renamed on this device only — before renames were synced, or while server
307
+ * history could not address it — so the server's title never overwrites it
308
+ * here. A rename that IS synced (BOFF-8159) lifts it.
309
+ */
306
310
  titleLocked?: true;
307
311
  /** Why the latest turns are not being saved. */
308
312
  blocked?: "quota" | "invalid" | "scope";
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/conversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAIhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,sBAAsB,GAC9B,MAAM,GACN,cAAc,GACd,SAAS,GACT,UAAU,GACV,OAAO,CAAC;AAEZ,MAAM,MAAM,2BAA2B,GACnC,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IAClC,EAAE,EAAE,aAAa,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,2FAA2F;IAC3F,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;OAQG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;;;;;;;;;;;OAeG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;;;;;;;;OAaG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B"}
@@ -1,25 +1,39 @@
1
- import { AssistantHistoryChangePage, AssistantHistoryConvRef, AssistantHistoryDeletePayload, AssistantHistoryEntryPage, AssistantHistoryEntryPaging, AssistantHistoryHeaderPage, AssistantHistorySaveInput, AssistantHistorySavePayload, AssistantHistoryScope } from './historyTypes';
1
+ import { AssistantHistoryChangePage, AssistantHistoryConvRef, AssistantHistoryConversationFilter, AssistantHistoryDeletePayload, AssistantHistoryEntryPage, AssistantHistoryEntryPaging, AssistantHistoryHeaderPage, AssistantHistorySaveInput, AssistantHistorySavePayload, AssistantHistoryScope, AssistantHistoryUpdatePatch, AssistantHistoryUpdatePayload } from './historyTypes';
2
2
  export interface AssistantHistoryTransport {
3
3
  changes(scope: AssistantHistoryScope, page: {
4
4
  first: number;
5
5
  after: string | null;
6
6
  }): Promise<AssistantHistoryChangePage>;
7
+ /**
8
+ * The live list. With a `filter` it needs the history controls: without
9
+ * them it is refused (`AssistantHistoryControlsUnavailableError`) rather
10
+ * than answered unfiltered.
11
+ */
7
12
  conversations(scope: AssistantHistoryScope, page: {
8
13
  first: number;
9
14
  after: string | null;
15
+ filter?: AssistantHistoryConversationFilter;
10
16
  }): Promise<AssistantHistoryHeaderPage>;
11
17
  entries(scope: AssistantHistoryScope, ref: AssistantHistoryConvRef, page: AssistantHistoryEntryPaging): Promise<AssistantHistoryEntryPage>;
12
18
  save(scope: AssistantHistoryScope, input: AssistantHistorySaveInput): Promise<AssistantHistorySavePayload>;
13
19
  remove(scope: AssistantHistoryScope, ref: AssistantHistoryConvRef): Promise<AssistantHistoryDeletePayload>;
20
+ /** A control change (BOFF-8159). Refused, unsent, while the controls are unavailable. */
21
+ update(scope: AssistantHistoryScope, ref: AssistantHistoryConvRef, patch: AssistantHistoryUpdatePatch): Promise<AssistantHistoryUpdatePayload>;
22
+ /** Whether the server has the history controls, as far as the last answer showed (true until one says not). */
23
+ controlsAvailable(): boolean;
24
+ /** Hear every change of {@link controlsAvailable}. Returns the unsubscribe. */
25
+ onControlsChange(listener: (available: boolean) => void): () => void;
26
+ /** The next feed read tries the controls again, without waiting for the ten-minute recheck. */
27
+ recheckControls(): void;
14
28
  }
15
- /** The server answered, but not with a shape this client understands. Never a reason to drop. */
16
- export declare class AssistantHistoryResponseError extends Error {
17
- constructor(operationName: string, detail: string);
18
- }
19
- /** The request's workspace or account is not the active one, so it was not sent. Hold, never drop. */
20
- export declare class AssistantHistoryScopeInactiveError extends Error {
21
- constructor();
22
- }
29
+ /** While the controls are unavailable: how often the feed tries the FULL documents again. */
30
+ export declare const ASSISTANT_HISTORY_CONTROLS_RECHECK_MS: number;
31
+ /**
32
+ * Consecutive masked failures of FULL documents ("Unexpected error." from a
33
+ * gateway that hides validation errors) after which a BASE retry that
34
+ * succeeds is read as drift.
35
+ */
36
+ export declare const ASSISTANT_HISTORY_MASKED_DRIFT_STREAK = 2;
23
37
  /** One GraphQL call, as `executeAssistantGraphQLOnce` makes it. Injected in tests. */
24
38
  export type AssistantHistoryExecutor = <TData>(params: {
25
39
  query: string;
@@ -33,6 +47,8 @@ export interface GatewayHistoryTransportOptions {
33
47
  activeWorkspaceId?: () => string;
34
48
  /** The signed-in account right now (default: the access token's subject). */
35
49
  activeActorId?: () => string | null;
50
+ /** Epoch ms now, for the controls recheck (default: `Date.now`). */
51
+ now?: () => number;
36
52
  }
37
53
  export declare function createGatewayHistoryTransport(options?: GatewayHistoryTransportOptions): AssistantHistoryTransport;
38
54
  //# sourceMappingURL=historyApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"historyApi.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAqBH,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EAEvB,6BAA6B,EAE7B,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAG1B,yBAAyB,EAEzB,2BAA2B,EAC3B,qBAAqB,EAGtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,yBAAyB;IACxC,OAAO,CACL,KAAK,EAAE,qBAAqB,EAC5B,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAC5C,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACvC,aAAa,CACX,KAAK,EAAE,qBAAqB,EAC5B,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAC5C,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACvC,OAAO,CACL,KAAK,EAAE,qBAAqB,EAC5B,GAAG,EAAE,uBAAuB,EAC5B,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtC,IAAI,CACF,KAAK,EAAE,qBAAqB,EAC5B,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxC,MAAM,CACJ,KAAK,EA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AE,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;CACrB,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,CA6Q3B"}
@@ -1,116 +1,243 @@
1
1
  import { executeAssistantGraphQLOnce as e } from "../gatewayClient.js";
2
2
  import { getActorId as t, getWorkspaceId as n } from "../context.js";
3
- import { ASSISTANT_HISTORY_CHANGES_OPERATION as r, ASSISTANT_HISTORY_CHANGES_QUERY as i, ASSISTANT_HISTORY_CONVERSATIONS_OPERATION as a, ASSISTANT_HISTORY_CONVERSATIONS_QUERY as o, ASSISTANT_HISTORY_DELETE_MUTATION as s, ASSISTANT_HISTORY_DELETE_OPERATION as c, ASSISTANT_HISTORY_ENTRIES_OPERATION as l, ASSISTANT_HISTORY_ENTRIES_QUERY as u, ASSISTANT_HISTORY_SAVE_MUTATION as d, ASSISTANT_HISTORY_SAVE_OPERATION as f, buildHistoryDeleteVariables as p, buildHistoryEntriesVariables as m, buildHistoryPageVariables as h, buildHistorySaveVariables as g } from "./historyOperations.js";
4
- import { historyTimestampToIso as _ } from "./historyTimestamps.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";
6
+ import { historyTimestampToIso as j } from "./historyTimestamps.js";
5
7
  //#region src/shared/assistant/history/historyApi.ts
6
- var v = class extends Error {
7
- constructor(e, t) {
8
- super(`Assistant history: unexpected ${e} response (${t})`), this.name = "AssistantHistoryResponseError";
9
- }
10
- }, y = class extends Error {
11
- constructor() {
12
- super("Assistant history: the request's workspace or account is not the active one"), this.name = "AssistantHistoryScopeInactiveError";
13
- }
14
- };
15
- function b(e) {
8
+ var M = 10 * 6e4, N = 2;
9
+ function P(e) {
10
+ let t = o(e);
11
+ return t.class === "transient" && t.code !== "RATE_LIMIT_EXCEEDED";
12
+ }
13
+ function F(e) {
16
14
  try {
17
15
  return e();
18
16
  } catch {
19
17
  return null;
20
18
  }
21
19
  }
22
- function x(_ = {}) {
23
- let x = _.execute ?? ((t) => e(t)), w = _.activeWorkspaceId ?? n, T = _.activeActorId ?? t, j = async (e, t, n, r) => {
24
- if (!e.workspaceId || !e.actorId || b(w) !== e.workspaceId || b(T) !== e.actorId) throw new y();
25
- let i = await x({
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) => {
22
+ if (e || (H = B() + M), e !== V) {
23
+ V = e;
24
+ for (let t of [...X]) try {
25
+ t(e);
26
+ } catch {}
27
+ }
28
+ }, Q = async (e, t, n, r) => {
29
+ if (!e.workspaceId || !e.actorId || F(N) !== e.workspaceId || F(I) !== e.actorId) throw new a();
30
+ let o = await j({
26
31
  query: n,
27
32
  operationName: t,
28
33
  variables: r,
29
34
  workspaceId: e.workspaceId
30
35
  });
31
- if (!E(i)) throw new v(t, "no data");
32
- return i;
36
+ if (!U(o)) throw new i(t, "no data");
37
+ return o;
38
+ }, $ = async (e, t, n, i, o = {}) => {
39
+ let { full: c, base: l } = n, u = async () => {
40
+ if (!l) throw new r(t);
41
+ return i(await Q(e, t, l.query, l.variables), !1);
42
+ };
43
+ if (!V) {
44
+ if (!(o.probe === !0 && (K || B() >= H))) return u();
45
+ K = !1, H = B() + M;
46
+ }
47
+ let d;
48
+ try {
49
+ d = await Q(e, t, c.query, c.variables);
50
+ } catch (n) {
51
+ if (n instanceof a) throw n;
52
+ if (s(n)) return Y = 0, Z(!1), u();
53
+ if (l && P(n) && (Y += 1, Y >= 2)) {
54
+ Y = 0;
55
+ let r;
56
+ try {
57
+ r = await Q(e, t, l.query, l.variables);
58
+ } catch {
59
+ throw n;
60
+ }
61
+ return Z(!1), i(r, !1);
62
+ }
63
+ throw n;
64
+ }
65
+ Y = 0;
66
+ let f = i(d, !0);
67
+ return Z(!0), f;
33
68
  };
34
69
  return {
35
- async changes(e, t) {
36
- let n = await j(e, r, i, h(e, t)), a = D(r), o = a.record(n.myAssistantHistoryChanges, "myAssistantHistoryChanges");
37
- return {
38
- nodes: a.list(o.nodes, "nodes").map((e) => k(a, e)),
39
- pageInfo: O(a, o.pageInfo),
40
- resetRequired: a.bool(o.resetRequired, "resetRequired")
70
+ controlsAvailable: () => V,
71
+ onControlsChange(e) {
72
+ return X.add(e), () => {
73
+ X.delete(e);
41
74
  };
42
75
  },
76
+ recheckControls() {
77
+ V || (K = !0);
78
+ },
79
+ async changes(e, t) {
80
+ let n = O(e, t);
81
+ return $(e, c, {
82
+ full: {
83
+ query: l,
84
+ variables: n
85
+ },
86
+ base: {
87
+ query: u,
88
+ variables: n
89
+ }
90
+ }, (e, t) => {
91
+ let n = W(c), r = n.record(e.myAssistantHistoryChanges, "myAssistantHistoryChanges");
92
+ return {
93
+ nodes: n.list(r.nodes, "nodes").map((e) => q(n, e, t)),
94
+ pageInfo: G(n, r.pageInfo),
95
+ resetRequired: n.bool(r.resetRequired, "resetRequired")
96
+ };
97
+ }, { probe: !0 });
98
+ },
43
99
  async conversations(e, t) {
44
- let n = await j(e, a, o, h(e, t)), r = D(a), i = r.record(n.myAssistantConversations, "myAssistantConversations");
45
- return {
46
- nodes: r.list(i.nodes, "nodes").map((e) => k(r, e)),
47
- pageInfo: O(r, i.pageInfo)
48
- };
100
+ return $(e, d, {
101
+ full: {
102
+ query: f,
103
+ variables: D(e, t)
104
+ },
105
+ base: t.filter ? null : {
106
+ query: p,
107
+ variables: O(e, t)
108
+ }
109
+ }, (e, t) => {
110
+ let n = W(d), r = n.record(e.myAssistantConversations, "myAssistantConversations");
111
+ return {
112
+ nodes: n.list(r.nodes, "nodes").map((e) => q(n, e, t)),
113
+ pageInfo: G(n, r.pageInfo)
114
+ };
115
+ });
49
116
  },
50
117
  async entries(e, t, n) {
51
- let r = await j(e, l, u, m(e, t, n)), i = D(l), a = i.record(r.myAssistantConversationEntries, "myAssistantConversationEntries");
52
- return {
53
- conversation: k(i, a.conversation),
54
- nodes: i.list(a.nodes, "nodes").map((e) => A(i, e)),
55
- pageInfo: O(i, a.pageInfo)
56
- };
118
+ let r = E(e, t, n);
119
+ return $(e, _, {
120
+ full: {
121
+ query: v,
122
+ variables: r
123
+ },
124
+ base: {
125
+ query: y,
126
+ variables: r
127
+ }
128
+ }, (e, t) => {
129
+ let n = W(_), r = n.record(e.myAssistantConversationEntries, "myAssistantConversationEntries");
130
+ return {
131
+ conversation: q(n, r.conversation, t),
132
+ nodes: n.list(r.nodes, "nodes").map((e) => J(n, e)),
133
+ pageInfo: G(n, r.pageInfo)
134
+ };
135
+ });
57
136
  },
58
137
  async save(e, t) {
59
- let n = await j(e, f, d, g(e, t)), r = D(f), i = r.record(n.saveMyAssistantHistoryEntries, "saveMyAssistantHistoryEntries");
60
- return {
61
- outcome: r.oneOf(i.outcome, S, "outcome"),
62
- conversation: k(r, i.conversation),
63
- entries: r.list(i.entries, "entries").map((e) => A(r, e)),
64
- droppedMetadataKeys: r.list(i.droppedMetadataKeys, "droppedMetadataKeys").map((e) => r.string(e, "droppedMetadataKeys[]"))
65
- };
138
+ let n = k(e, t);
139
+ return $(e, S, {
140
+ full: {
141
+ query: b,
142
+ variables: n
143
+ },
144
+ base: {
145
+ query: x,
146
+ variables: n
147
+ }
148
+ }, (e, t) => {
149
+ let n = W(S), r = n.record(e.saveMyAssistantHistoryEntries, "saveMyAssistantHistoryEntries");
150
+ return {
151
+ outcome: n.oneOf(r.outcome, L, "outcome"),
152
+ conversation: q(n, r.conversation, t),
153
+ entries: n.list(r.entries, "entries").map((e) => J(n, e)),
154
+ droppedMetadataKeys: n.list(r.droppedMetadataKeys, "droppedMetadataKeys").map((e) => n.string(e, "droppedMetadataKeys[]"))
155
+ };
156
+ });
66
157
  },
67
158
  async remove(e, t) {
68
- let n = await j(e, c, s, p(e, t)), r = D(c), i = r.record(n.deleteMyAssistantConversation, "deleteMyAssistantConversation");
69
- return {
70
- outcome: r.oneOf(i.outcome, C, "outcome"),
71
- conversation: i.conversation == null ? null : k(r, i.conversation)
72
- };
159
+ let n = T(e, t);
160
+ return $(e, g, {
161
+ full: {
162
+ query: m,
163
+ variables: n
164
+ },
165
+ base: {
166
+ query: h,
167
+ variables: n
168
+ }
169
+ }, (e, t) => {
170
+ let n = W(g), r = n.record(e.deleteMyAssistantConversation, "deleteMyAssistantConversation");
171
+ return {
172
+ outcome: n.oneOf(r.outcome, R, "outcome"),
173
+ conversation: r.conversation == null ? null : q(n, r.conversation, t)
174
+ };
175
+ });
176
+ },
177
+ async update(e, t, n) {
178
+ return $(e, w, {
179
+ full: {
180
+ query: C,
181
+ variables: A(e, t, n)
182
+ },
183
+ base: null
184
+ }, (e) => {
185
+ let t = W(w), n = t.record(e.updateMyAssistantConversation, "updateMyAssistantConversation");
186
+ return {
187
+ outcome: t.oneOf(n.outcome, z, "outcome"),
188
+ conversation: q(t, n.conversation, !0)
189
+ };
190
+ });
73
191
  }
74
192
  };
75
193
  }
76
- var S = [
194
+ var L = [
77
195
  "APPLIED",
78
196
  "ALREADY_APPLIED",
79
197
  "CONVERSATION_DELETED"
80
- ], C = [
198
+ ], R = [
81
199
  "DELETED",
82
200
  "ALREADY_DELETED",
83
201
  "TOMBSTONED_UNSEEN",
84
202
  "NOT_PRESENT"
85
- ], w = [
203
+ ], z = [
204
+ "APPLIED",
205
+ "ALREADY_APPLIED",
206
+ "CONVERSATION_DELETED",
207
+ "PIN_LIMIT_REACHED"
208
+ ], B = [
209
+ "CHAT",
210
+ "VOICE",
211
+ "MIXED"
212
+ ], V = [
86
213
  "USER",
87
214
  "ASSISTANT",
88
215
  "NOTE"
89
- ], T = [
216
+ ], H = [
90
217
  "TURN",
91
218
  "LOCAL_COMMAND",
92
219
  "NOTE"
93
220
  ];
94
- function E(e) {
221
+ function U(e) {
95
222
  return typeof e == "object" && !!e && !Array.isArray(e);
96
223
  }
97
- function D(e) {
224
+ function W(e) {
98
225
  let t = (t) => {
99
- throw new v(e, t);
226
+ throw new i(e, t);
100
227
  };
101
228
  return {
102
- record: (e, n) => E(e) ? e : t(n),
229
+ record: (e, n) => U(e) ? e : t(n),
103
230
  list: (e, n) => Array.isArray(e) ? e : t(n),
104
231
  string: (e, n) => typeof e == "string" ? e : t(n),
105
232
  optionalString: (e, n) => e == null ? null : typeof e == "string" ? e : t(n),
106
233
  int: (e, n) => typeof e == "number" && Number.isSafeInteger(e) ? e : t(n),
107
234
  optionalInt: (e, n) => e == null ? null : typeof e == "number" && Number.isSafeInteger(e) ? e : t(n),
108
235
  bool: (e, n) => typeof e == "boolean" ? e : t(n),
109
- time: (e, n) => _(e) ?? t(n),
236
+ time: (e, n) => j(e) ?? t(n),
110
237
  oneOf: (e, n, r) => n.find((t) => t === e) ?? t(r)
111
238
  };
112
239
  }
113
- function O(e, t) {
240
+ function G(e, t) {
114
241
  let n = e.record(t, "pageInfo");
115
242
  return {
116
243
  hasNextPage: e.bool(n.hasNextPage, "pageInfo.hasNextPage"),
@@ -119,35 +246,53 @@ function O(e, t) {
119
246
  endCursor: e.optionalString(n.endCursor, "pageInfo.endCursor")
120
247
  };
121
248
  }
122
- function k(e, t) {
123
- let n = e.record(t, "conversation");
249
+ function K(e) {
250
+ let t = {};
251
+ for (let n of ["pinnedAt", "archivedAt"]) {
252
+ let r = e[n];
253
+ if (r === null) t[n] = null;
254
+ else {
255
+ let e = j(r);
256
+ e !== null && (t[n] = e);
257
+ }
258
+ }
259
+ if (e.channel === null) t.channel = null;
260
+ else {
261
+ let n = B.find((t) => t === e.channel);
262
+ n && (t.channel = n);
263
+ }
264
+ return t;
265
+ }
266
+ function q(e, t, n) {
267
+ let r = e.record(t, "conversation");
124
268
  return {
125
- id: e.string(n.id, "conversation.id"),
126
- clientConversationId: e.optionalString(n.clientConversationId, "conversation.clientConversationId"),
127
- productId: e.string(n.productId, "conversation.productId"),
128
- title: e.optionalString(n.title, "conversation.title"),
129
- legacy: e.bool(n.legacy, "conversation.legacy"),
130
- revision: e.int(n.revision, "conversation.revision"),
131
- lastMessageSeq: e.int(n.lastMessageSeq, "conversation.lastMessageSeq"),
132
- deleted: e.bool(n.deleted, "conversation.deleted"),
133
- deletedAt: n.deletedAt == null ? null : e.time(n.deletedAt, "conversation.deletedAt"),
134
- createdAt: e.time(n.createdAt, "conversation.createdAt"),
135
- updatedAt: e.time(n.updatedAt, "conversation.updatedAt")
269
+ id: e.string(r.id, "conversation.id"),
270
+ clientConversationId: e.optionalString(r.clientConversationId, "conversation.clientConversationId"),
271
+ productId: e.string(r.productId, "conversation.productId"),
272
+ title: e.optionalString(r.title, "conversation.title"),
273
+ legacy: e.bool(r.legacy, "conversation.legacy"),
274
+ revision: e.int(r.revision, "conversation.revision"),
275
+ lastMessageSeq: e.int(r.lastMessageSeq, "conversation.lastMessageSeq"),
276
+ deleted: e.bool(r.deleted, "conversation.deleted"),
277
+ deletedAt: r.deletedAt == null ? null : e.time(r.deletedAt, "conversation.deletedAt"),
278
+ createdAt: e.time(r.createdAt, "conversation.createdAt"),
279
+ updatedAt: e.time(r.updatedAt, "conversation.updatedAt"),
280
+ ...n ? K(r) : {}
136
281
  };
137
282
  }
138
- function A(e, t) {
283
+ function J(e, t) {
139
284
  let n = e.record(t, "entry");
140
285
  return {
141
286
  id: e.string(n.id, "entry.id"),
142
287
  clientMessageId: e.optionalString(n.clientMessageId, "entry.clientMessageId"),
143
- kind: T.find((e) => e === n.kind) ?? null,
144
- role: e.oneOf(n.role, w, "entry.role"),
288
+ kind: H.find((e) => e === n.kind) ?? null,
289
+ role: e.oneOf(n.role, V, "entry.role"),
145
290
  content: e.string(n.content, "entry.content"),
146
291
  seq: e.optionalInt(n.seq, "entry.seq"),
147
292
  createdAt: e.time(n.createdAt, "entry.createdAt"),
148
293
  clientCreatedAt: e.optionalString(n.clientCreatedAt, "entry.clientCreatedAt"),
149
- metadata: E(n.metadata) ? n.metadata : null
294
+ metadata: U(n.metadata) ? n.metadata : null
150
295
  };
151
296
  }
152
297
  //#endregion
153
- export { v as AssistantHistoryResponseError, y as AssistantHistoryScopeInactiveError, x as createGatewayHistoryTransport };
298
+ export { M as ASSISTANT_HISTORY_CONTROLS_RECHECK_MS, N as ASSISTANT_HISTORY_MASKED_DRIFT_STREAK, I as createGatewayHistoryTransport };
@@ -0,0 +1,86 @@
1
+ import { Conversation } from '../conversation';
2
+ import { AssistantHistoryChannel, AssistantHistoryConvKey, AssistantHistoryConversationFilter, AssistantHistoryHeader, AssistantHistoryOutboxItem, AssistantHistoryScopeKey, AssistantHistoryUpdatePatch } from './historyTypes';
3
+ /**
4
+ * The server's cap on pinned conversations per person, workspace and product
5
+ * (wspace-conversations `MAX_PINNED_PER_SCOPE`). The server enforces it
6
+ * (`PIN_LIMIT_REACHED`); here it is only the number the notice names, and the
7
+ * bound on the pinned fetch.
8
+ */
9
+ export declare const MAX_PINNED = 50;
10
+ /** A title's length on the server, in code points (not UTF-16 units). */
11
+ export declare const HISTORY_TITLE_MAX_CODE_POINTS = 80;
12
+ /** `text` cut to at most `max` code points (never splitting a surrogate pair). */
13
+ export declare function clampToCodePoints(text: string, max: number): string;
14
+ /** How many code points `text` holds. */
15
+ export declare function codePointLength(text: string): number;
16
+ /**
17
+ * A title exactly as the server will store it: what cannot be stored becomes
18
+ * U+FFFD, every run of whitespace one space, trimmed, then at most 80 code
19
+ * points (and trimmed again, so a cut never leaves a trailing space the server
20
+ * would remove). Empty means "no title": the server refuses one.
21
+ */
22
+ export declare function normaliseHistoryTitle(text: string): string;
23
+ /**
24
+ * One patch from two queued ones, the newer winning field by field — and the
25
+ * pair rule kept: a newer archive drops an older pin, a newer pin drops an
26
+ * older archive (the server refuses both at once, and would apply them in
27
+ * that order anyway).
28
+ */
29
+ export declare function coalesceUpdatePatch(older: AssistantHistoryUpdatePatch, newer: AssistantHistoryUpdatePatch): AssistantHistoryUpdatePatch;
30
+ /** A patch the server accepts: at least one field, and never pin and archive together. */
31
+ export declare function isValidUpdatePatch(patch: AssistantHistoryUpdatePatch): boolean;
32
+ /**
33
+ * Which kinds of person turns this device holds for a conversation, from the
34
+ * voice marker on its USER messages (notes and replies do not count; a local
35
+ * command counts as the person's turn, as on the server). Null with none.
36
+ */
37
+ export declare function localChannelOf(conversation: Pick<Conversation, "messages">): AssistantHistoryChannel | null;
38
+ /** A queued control change, as the row reads it. */
39
+ export interface AssistantHistoryPendingUpdate {
40
+ patch: AssistantHistoryUpdatePatch;
41
+ /** Epoch ms the person made it. */
42
+ at: number;
43
+ }
44
+ /** The queued control changes of one scope, per conversation, oldest first. */
45
+ export declare function pendingUpdatesByConversation(outbox: readonly AssistantHistoryOutboxItem[], scopeKey: AssistantHistoryScopeKey | null): Record<AssistantHistoryConvKey, AssistantHistoryPendingUpdate[]>;
46
+ /** What one row shows for the controls. */
47
+ export interface AssistantHistoryRowControls {
48
+ /** A queued rename's title; null when none is queued (the row keeps its own). */
49
+ pendingTitle: string | null;
50
+ pinnedAt: string | null;
51
+ archivedAt: string | null;
52
+ channel: AssistantHistoryChannel | null;
53
+ /** The server's control state is known here (a header with the controls, or a queued change). */
54
+ known: boolean;
55
+ /** A control change is queued and not answered yet. */
56
+ pending: boolean;
57
+ }
58
+ /**
59
+ * A row's controls. Precedence: the queued changes (oldest to newest), then
60
+ * the header, then this device's conversation.
61
+ *
62
+ * - Pin and archive come from the header (this device keeps no pin or archive
63
+ * of its own); a queued change overrides them, dated by when it was made.
64
+ * - The channel is the UNION of the header's and this device's: the header
65
+ * counts every stored turn, this device may hold a spoken turn the server
66
+ * has not stored yet, or only a window of the older ones.
67
+ * - The title: a queued rename; otherwise the row's own (the engine keeps a
68
+ * held conversation's title in step with the server, and a title renamed on
69
+ * this device before renames were synced — `titleLocked` — stays here).
70
+ */
71
+ export declare function resolveRowControls(conversation: Pick<Conversation, "messages"> | null, header: AssistantHistoryHeader | null, pending?: readonly AssistantHistoryPendingUpdate[]): AssistantHistoryRowControls;
72
+ /** The list's default: every conversation that is not archived. */
73
+ export declare const DEFAULT_HISTORY_LIST_FILTER: Readonly<AssistantHistoryConversationFilter>;
74
+ /**
75
+ * Does a row pass the filter — the server's rule, applied here to what the
76
+ * device holds: CHAT means it holds a typed person turn, VOICE a spoken one,
77
+ * and a MIXED row matches both. A row whose channel is unknown matches only
78
+ * ANY. Archived rows are left out unless asked for.
79
+ */
80
+ export declare function matchesHistoryFilter(row: Pick<AssistantHistoryRowControls, "pinnedAt" | "archivedAt" | "channel">, filter?: Readonly<AssistantHistoryConversationFilter>): boolean;
81
+ /**
82
+ * A filter as a stable key ("" for none): the list's "Show older" listing is
83
+ * paged per filter, and its `hasMore` answers for one key only.
84
+ */
85
+ export declare function historyFilterKey(filter: Readonly<AssistantHistoryConversationFilter> | undefined): string;
86
+ //# sourceMappingURL=historyControls.d.ts.map
@@ -0,0 +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,2BAA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