@burdenoff/fe-libs 2026.930.4 → 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.
- package/dist/connections/ConnectionDetailsTab.d.ts +11 -0
- package/dist/connections/ConnectionDetailsTab.d.ts.map +1 -0
- package/dist/connections/ConnectionDetailsTab.js +71 -0
- package/dist/connections/ConnectionDialog.d.ts +57 -0
- package/dist/connections/ConnectionDialog.d.ts.map +1 -0
- package/dist/connections/ConnectionDialog.js +88 -0
- package/dist/connections/ConnectionDialogPanel.d.ts +26 -0
- package/dist/connections/ConnectionDialogPanel.d.ts.map +1 -0
- package/dist/connections/ConnectionDialogPanel.js +272 -0
- package/dist/connections/ConnectionFormTab.d.ts +37 -0
- package/dist/connections/ConnectionFormTab.d.ts.map +1 -0
- package/dist/connections/ConnectionFormTab.js +185 -0
- package/dist/connections/CredentialStorageSelector.d.ts +19 -0
- package/dist/connections/CredentialStorageSelector.d.ts.map +1 -0
- package/dist/connections/CredentialStorageSelector.js +294 -0
- package/dist/connections/DialogHeading.d.ts +7 -0
- package/dist/connections/DialogHeading.d.ts.map +1 -0
- package/dist/connections/DialogHeading.js +16 -0
- package/dist/connections/ProviderIcon.d.ts +10 -0
- package/dist/connections/ProviderIcon.d.ts.map +1 -0
- package/dist/connections/ProviderIcon.js +57 -0
- package/dist/connections/ProviderPickerPanel.d.ts +15 -0
- package/dist/connections/ProviderPickerPanel.d.ts.map +1 -0
- package/dist/connections/ProviderPickerPanel.js +84 -0
- package/dist/connections/ScopePicker.d.ts +15 -0
- package/dist/connections/ScopePicker.d.ts.map +1 -0
- package/dist/connections/ScopePicker.js +38 -0
- package/dist/connections/api.d.ts +60 -0
- package/dist/connections/api.d.ts.map +1 -0
- package/dist/connections/api.js +259 -0
- package/dist/connections/assets/bigconsole.png.js +4 -0
- package/dist/connections/assets/burdenoff.png.js +4 -0
- package/dist/connections/connectionFlow.d.ts +81 -0
- package/dist/connections/connectionFlow.d.ts.map +1 -0
- package/dist/connections/connectionFlow.js +101 -0
- package/dist/connections/frame.d.ts +32 -0
- package/dist/connections/frame.d.ts.map +1 -0
- package/dist/connections/frame.js +13 -0
- package/dist/connections/index.d.ts +24 -0
- package/dist/connections/index.d.ts.map +1 -0
- package/dist/connections/labels.d.ts +5 -0
- package/dist/connections/labels.d.ts.map +1 -0
- package/dist/connections/labels.js +35 -0
- package/dist/connections/oauthPopup.d.ts +48 -0
- package/dist/connections/oauthPopup.d.ts.map +1 -0
- package/dist/connections/oauthPopup.js +70 -0
- package/dist/connections/picker.d.ts +7 -0
- package/dist/connections/picker.d.ts.map +1 -0
- package/dist/connections/picker.js +16 -0
- package/dist/connections/providerIdentity.d.ts +23 -0
- package/dist/connections/providerIdentity.d.ts.map +1 -0
- package/dist/connections/providerIdentity.js +175 -0
- package/dist/connections/scopes.d.ts +42 -0
- package/dist/connections/scopes.d.ts.map +1 -0
- package/dist/connections/scopes.js +30 -0
- package/dist/connections/storage.d.ts +8 -0
- package/dist/connections/storage.d.ts.map +1 -0
- package/dist/connections/storage.js +21 -0
- package/dist/connections/types.d.ts +82 -0
- package/dist/connections/types.d.ts.map +1 -0
- package/dist/connections/useConnectionSubmit.d.ts +22 -0
- package/dist/connections/useConnectionSubmit.d.ts.map +1 -0
- package/dist/connections/useConnectionSubmit.js +99 -0
- package/dist/connections.d.ts +2 -0
- package/dist/connections.js +14 -0
- package/dist/credentials/AuthMethodSelector.d.ts +4 -0
- package/dist/credentials/AuthMethodSelector.d.ts.map +1 -1
- package/dist/credentials/AuthMethodSelector.js +42 -33
- package/dist/credentials/SchemaForm.d.ts +3 -28
- package/dist/credentials/SchemaForm.d.ts.map +1 -1
- package/dist/credentials/SchemaForm.js +116 -162
- package/dist/credentials/index.d.ts +5 -2
- package/dist/credentials/index.d.ts.map +1 -1
- package/dist/credentials/methods.d.ts +11 -0
- package/dist/credentials/methods.d.ts.map +1 -0
- package/dist/credentials/methods.js +6 -0
- package/dist/credentials/schema.d.ts +43 -0
- package/dist/credentials/schema.d.ts.map +1 -0
- package/dist/credentials/schema.js +56 -0
- package/dist/credentials/translate.d.ts +18 -0
- package/dist/credentials/translate.d.ts.map +1 -0
- package/dist/credentials/translate.js +7 -0
- package/dist/credentials/types.d.ts +1 -1
- package/dist/credentials.js +6 -3
- package/dist/shared/assistant/conversation.d.ts +5 -1
- package/dist/shared/assistant/conversation.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyApi.d.ts +25 -9
- package/dist/shared/assistant/history/historyApi.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyApi.js +220 -75
- package/dist/shared/assistant/history/historyControls.d.ts +86 -0
- package/dist/shared/assistant/history/historyControls.d.ts.map +1 -0
- package/dist/shared/assistant/history/historyControls.js +80 -0
- package/dist/shared/assistant/history/historyEngine.d.ts +23 -3
- package/dist/shared/assistant/history/historyEngine.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyEngine.js +578 -369
- package/dist/shared/assistant/history/historyErrors.d.ts +25 -5
- package/dist/shared/assistant/history/historyErrors.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyErrors.js +39 -30
- package/dist/shared/assistant/history/historyList.d.ts +33 -7
- package/dist/shared/assistant/history/historyList.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyList.js +72 -51
- package/dist/shared/assistant/history/historyOperations.d.ts +36 -7
- package/dist/shared/assistant/history/historyOperations.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyOperations.js +100 -25
- package/dist/shared/assistant/history/historyStatus.d.ts +27 -1
- package/dist/shared/assistant/history/historyStatus.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyStatus.js +6 -2
- package/dist/shared/assistant/history/historyStore.d.ts +29 -7
- package/dist/shared/assistant/history/historyStore.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyStore.js +172 -103
- package/dist/shared/assistant/history/historyTransportErrors.d.ts +28 -0
- package/dist/shared/assistant/history/historyTransportErrors.d.ts.map +1 -0
- package/dist/shared/assistant/history/historyTransportErrors.js +16 -0
- package/dist/shared/assistant/history/historyTypes.d.ts +80 -1
- package/dist/shared/assistant/history/historyTypes.d.ts.map +1 -1
- package/dist/shared/assistant/history/stampRegistry.d.ts +19 -1
- package/dist/shared/assistant/history/stampRegistry.d.ts.map +1 -1
- package/dist/shared/assistant/history/stampRegistry.js +13 -1
- package/dist/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/store.d.ts +8 -0
- package/dist/shared/assistant/store.d.ts.map +1 -1
- package/dist/shared/assistant/store.js +50 -46
- package/dist/shared/assistant/writeReplyBinder.d.ts +1 -1
- package/dist/shared-assistant.js +164 -162
- package/package.json +11 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./historyControls.js";
|
|
1
2
|
import { createProfileBoundStorage as e } from "./profileBoundStorage.js";
|
|
2
3
|
import { create as t } from "zustand";
|
|
3
4
|
import { persist as n } from "zustand/middleware";
|
|
@@ -27,7 +28,16 @@ function d(e) {
|
|
|
27
28
|
function f(e) {
|
|
28
29
|
return d(e) && typeof e.serverId == "string" && (e.clientConversationId === null || typeof e.clientConversationId == "string") && (e.title === null || typeof e.title == "string") && typeof e.legacy == "boolean" && typeof e.revision == "number" && typeof e.lastMessageSeq == "number" && typeof e.createdAt == "string" && typeof e.updatedAt == "string" && (e.gone === void 0 || e.gone === !0);
|
|
29
30
|
}
|
|
30
|
-
var p = (e) =>
|
|
31
|
+
var p = (e) => e === null || typeof e == "string", m = (e) => e === null || e === "CHAT" || e === "VOICE" || e === "MIXED";
|
|
32
|
+
function h(e) {
|
|
33
|
+
if (!f(e)) return null;
|
|
34
|
+
let t = { ...e };
|
|
35
|
+
return t.pinnedAt !== void 0 && !p(t.pinnedAt) && delete t.pinnedAt, t.archivedAt !== void 0 && !p(t.archivedAt) && delete t.archivedAt, t.channel !== void 0 && !m(t.channel) && delete t.channel, t;
|
|
36
|
+
}
|
|
37
|
+
function g(e) {
|
|
38
|
+
return e.pinnedAt !== void 0 && e.archivedAt !== void 0 && e.channel !== void 0;
|
|
39
|
+
}
|
|
40
|
+
var _ = (e) => new Set(Object.keys(e)), v = _({
|
|
31
41
|
gen: !0,
|
|
32
42
|
cursor: !0,
|
|
33
43
|
cursorRev: !0,
|
|
@@ -35,13 +45,14 @@ var p = (e) => new Set(Object.keys(e)), m = p({
|
|
|
35
45
|
hasOlderHeaders: !0,
|
|
36
46
|
pulledAt: !0,
|
|
37
47
|
resetAt: !0,
|
|
38
|
-
rescanning: !0
|
|
39
|
-
|
|
48
|
+
rescanning: !0,
|
|
49
|
+
ctl: !0
|
|
50
|
+
}), y = _({
|
|
40
51
|
scopeKey: !0,
|
|
41
52
|
at: !0,
|
|
42
53
|
confirmed: !0,
|
|
43
54
|
serverId: !0
|
|
44
|
-
}),
|
|
55
|
+
}), b = _({
|
|
45
56
|
serverId: !0,
|
|
46
57
|
clientConversationId: !0,
|
|
47
58
|
title: !0,
|
|
@@ -50,8 +61,11 @@ var p = (e) => new Set(Object.keys(e)), m = p({
|
|
|
50
61
|
lastMessageSeq: !0,
|
|
51
62
|
createdAt: !0,
|
|
52
63
|
updatedAt: !0,
|
|
64
|
+
pinnedAt: !0,
|
|
65
|
+
archivedAt: !0,
|
|
66
|
+
channel: !0,
|
|
53
67
|
gone: !0
|
|
54
|
-
}),
|
|
68
|
+
}), x = _({
|
|
55
69
|
id: !0,
|
|
56
70
|
type: !0,
|
|
57
71
|
scopeKey: !0,
|
|
@@ -61,7 +75,7 @@ var p = (e) => new Set(Object.keys(e)), m = p({
|
|
|
61
75
|
attempts: !0,
|
|
62
76
|
nextAttemptAt: !0,
|
|
63
77
|
parked: !0
|
|
64
|
-
}),
|
|
78
|
+
}), S = _({
|
|
65
79
|
id: !0,
|
|
66
80
|
type: !0,
|
|
67
81
|
scopeKey: !0,
|
|
@@ -70,26 +84,47 @@ var p = (e) => new Set(Object.keys(e)), m = p({
|
|
|
70
84
|
legacy: !0,
|
|
71
85
|
attempts: !0,
|
|
72
86
|
nextAttemptAt: !0
|
|
87
|
+
}), C = _({
|
|
88
|
+
id: !0,
|
|
89
|
+
type: !0,
|
|
90
|
+
scopeKey: !0,
|
|
91
|
+
convKey: !0,
|
|
92
|
+
serverId: !0,
|
|
93
|
+
legacy: !0,
|
|
94
|
+
patch: !0,
|
|
95
|
+
at: !0,
|
|
96
|
+
attempts: !0,
|
|
97
|
+
nextAttemptAt: !0
|
|
73
98
|
});
|
|
74
|
-
function
|
|
99
|
+
function w(e) {
|
|
100
|
+
switch (e.type) {
|
|
101
|
+
case "save": return x;
|
|
102
|
+
case "delete": return S;
|
|
103
|
+
case "update": return C;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function T(e, t) {
|
|
75
107
|
let n = {};
|
|
76
108
|
for (let [r, i] of Object.entries(e)) t.has(r) || (n[r] = i);
|
|
77
109
|
return n;
|
|
78
110
|
}
|
|
79
|
-
function
|
|
80
|
-
let r =
|
|
111
|
+
function E(e, t, n) {
|
|
112
|
+
let r = T(t, n), i = Object.assign({}, e, r);
|
|
81
113
|
for (let t of Object.keys(e)) !n.has(t) && !Object.hasOwn(r, t) && Reflect.deleteProperty(i, t);
|
|
82
114
|
return i;
|
|
83
115
|
}
|
|
84
|
-
function
|
|
116
|
+
function D(e) {
|
|
85
117
|
if (!d(e)) return {};
|
|
86
118
|
let t = {};
|
|
87
119
|
for (let [n, r] of Object.entries(e)) {
|
|
88
120
|
if (!d(r)) continue;
|
|
89
121
|
let e = {};
|
|
90
|
-
if (d(r.headers)) for (let [t, n] of Object.entries(r.headers))
|
|
122
|
+
if (d(r.headers)) for (let [t, n] of Object.entries(r.headers)) {
|
|
123
|
+
let r = h(n);
|
|
124
|
+
r && (e[t] = r);
|
|
125
|
+
}
|
|
91
126
|
let i = typeof r.gen == "number" && Number.isSafeInteger(r.gen) ? r.gen : 0;
|
|
92
|
-
t[n] = Object.assign(
|
|
127
|
+
t[n] = Object.assign(T(r, v), {
|
|
93
128
|
...i > 0 ? { gen: i } : {},
|
|
94
129
|
cursor: typeof r.cursor == "string" ? r.cursor : null,
|
|
95
130
|
cursorRev: typeof r.cursorRev == "number" ? r.cursorRev : 0,
|
|
@@ -97,18 +132,24 @@ function x(e) {
|
|
|
97
132
|
...r.hasOlderHeaders === !0 ? { hasOlderHeaders: !0 } : {},
|
|
98
133
|
...typeof r.pulledAt == "number" ? { pulledAt: r.pulledAt } : {},
|
|
99
134
|
...typeof r.resetAt == "number" ? { resetAt: r.resetAt } : {},
|
|
100
|
-
...r.rescanning === !0 ? { rescanning: !0 } : {}
|
|
135
|
+
...r.rescanning === !0 ? { rescanning: !0 } : {},
|
|
136
|
+
...r.ctl === 1 ? { ctl: 1 } : {}
|
|
101
137
|
});
|
|
102
138
|
}
|
|
103
139
|
return t;
|
|
104
140
|
}
|
|
105
|
-
function
|
|
106
|
-
return !d(e) || !(typeof e.id == "string" && typeof e.scopeKey == "string" && typeof e.convKey == "string" && typeof e.attempts == "number") ? !1 : e.type === "save" ? (e.kind === "TURN" || e.kind === "LOCAL_COMMAND" || e.kind === "NOTE") && Array.isArray(e.entries) : e.type === "delete" && typeof e.legacy == "boolean";
|
|
141
|
+
function O(e) {
|
|
142
|
+
return !d(e) || !(typeof e.id == "string" && typeof e.scopeKey == "string" && typeof e.convKey == "string" && typeof e.attempts == "number") ? !1 : e.type === "save" ? (e.kind === "TURN" || e.kind === "LOCAL_COMMAND" || e.kind === "NOTE") && Array.isArray(e.entries) : e.type === "update" ? typeof e.legacy == "boolean" && typeof e.at == "number" && k(e.patch) : e.type === "delete" && typeof e.legacy == "boolean";
|
|
107
143
|
}
|
|
108
|
-
function
|
|
144
|
+
function k(e) {
|
|
145
|
+
if (!d(e)) return !1;
|
|
146
|
+
let { title: t, pinned: n, archived: r } = e;
|
|
147
|
+
return t !== void 0 && typeof t != "string" || n !== void 0 && typeof n != "boolean" || r !== void 0 && typeof r != "boolean" ? !1 : t !== void 0 || n !== void 0 || r !== void 0;
|
|
148
|
+
}
|
|
149
|
+
function A(e) {
|
|
109
150
|
if (!d(e)) return {};
|
|
110
151
|
let t = {};
|
|
111
|
-
for (let [n, r] of Object.entries(e)) d(r) && typeof r.scopeKey == "string" && typeof r.at == "number" && typeof r.confirmed == "boolean" && (t[n] = Object.assign(
|
|
152
|
+
for (let [n, r] of Object.entries(e)) d(r) && typeof r.scopeKey == "string" && typeof r.at == "number" && typeof r.confirmed == "boolean" && (t[n] = Object.assign(T(r, y), {
|
|
112
153
|
scopeKey: r.scopeKey,
|
|
113
154
|
at: r.at,
|
|
114
155
|
confirmed: r.confirmed,
|
|
@@ -116,50 +157,52 @@ function C(e) {
|
|
|
116
157
|
}));
|
|
117
158
|
return t;
|
|
118
159
|
}
|
|
119
|
-
function
|
|
160
|
+
function j(e) {
|
|
120
161
|
return d(e) ? Object.fromEntries(Object.entries(e).filter((e) => typeof e[1] == "number")) : {};
|
|
121
162
|
}
|
|
122
|
-
function
|
|
123
|
-
return !d(e) || e.v !== 1 ? c() :
|
|
163
|
+
function M(e) {
|
|
164
|
+
return !d(e) || e.v !== 1 ? c() : z({
|
|
124
165
|
v: 1,
|
|
125
|
-
scopes:
|
|
126
|
-
outbox: Array.isArray(e.outbox) ? e.outbox.filter(
|
|
127
|
-
doneItemIds:
|
|
128
|
-
tombstones:
|
|
166
|
+
scopes: D(e.scopes),
|
|
167
|
+
outbox: Array.isArray(e.outbox) ? e.outbox.filter(O) : [],
|
|
168
|
+
doneItemIds: j(e.doneItemIds),
|
|
169
|
+
tombstones: A(e.tombstones)
|
|
129
170
|
});
|
|
130
171
|
}
|
|
131
|
-
function
|
|
132
|
-
return t.revision === e.revision ? t.gone
|
|
172
|
+
function N(e, t) {
|
|
173
|
+
return t.revision === e.revision ? !!e.gone == !!t.gone ? g(e) === g(t) ? e : g(t) ? t : e : t.gone ? t : e : t.revision > e.revision ? t : e;
|
|
133
174
|
}
|
|
134
|
-
function
|
|
135
|
-
let r =
|
|
136
|
-
return n === "stored" && e.revision === t.revision ?
|
|
175
|
+
function P(e, t, n) {
|
|
176
|
+
let r = N(e, t);
|
|
177
|
+
return n === "stored" && e.revision === t.revision ? E(r, t, b) : r;
|
|
137
178
|
}
|
|
138
|
-
function
|
|
139
|
-
return r === "stored" ?
|
|
140
|
-
...
|
|
141
|
-
...
|
|
179
|
+
function F(e, t, n, r) {
|
|
180
|
+
return r === "stored" ? T(t, n) : {
|
|
181
|
+
...T(t, n),
|
|
182
|
+
...T(e, n)
|
|
142
183
|
};
|
|
143
184
|
}
|
|
144
|
-
function
|
|
185
|
+
function I(e, t = 300) {
|
|
145
186
|
let n = Object.entries(e.headers);
|
|
146
|
-
|
|
187
|
+
if (n.length <= t) return e;
|
|
188
|
+
let r = (e, t) => e < t ? -1 : Number(e > t), i = (e, t) => e === t ? 0 : e < t ? 1 : -1, a = n.filter(([, e]) => typeof e.pinnedAt == "string" && !e.gone).sort(([e, t], [n, a]) => i(t.pinnedAt ?? "", a.pinnedAt ?? "") || r(e, n)).slice(0, Math.min(50, t)), o = new Set(a.map(([e]) => e)), s = n.filter(([e]) => !o.has(e)).sort(([e, t], [n, a]) => i(t.updatedAt, a.updatedAt) || r(e, n)).slice(0, t - a.length);
|
|
189
|
+
return {
|
|
147
190
|
...e,
|
|
148
|
-
headers: Object.fromEntries(
|
|
191
|
+
headers: Object.fromEntries([...a, ...s]),
|
|
149
192
|
hasOlderHeaders: !0
|
|
150
|
-
}
|
|
193
|
+
};
|
|
151
194
|
}
|
|
152
|
-
function
|
|
195
|
+
function L(e, t, n) {
|
|
153
196
|
if (!e) return t ?? l();
|
|
154
197
|
if (!t) return e;
|
|
155
198
|
if (u(e) !== u(t)) return u(e) > u(t) ? e : t;
|
|
156
199
|
let r = { ...e.headers };
|
|
157
200
|
for (let [e, i] of Object.entries(t.headers)) {
|
|
158
201
|
let t = r[e];
|
|
159
|
-
r[e] = t ?
|
|
202
|
+
r[e] = t ? P(t, i, n) : i;
|
|
160
203
|
}
|
|
161
204
|
let i = t.cursorRev > e.cursorRev ? t : e, a = Math.max(e.pulledAt ?? 0, t.pulledAt ?? 0), o = u(e), s = e.resetAt !== void 0 && t.resetAt !== void 0 ? Math.min(e.resetAt, t.resetAt) : void 0;
|
|
162
|
-
return Object.assign(
|
|
205
|
+
return Object.assign(F(e, t, v, n), {
|
|
163
206
|
...o > 0 ? { gen: o } : {},
|
|
164
207
|
cursor: i.cursor,
|
|
165
208
|
cursorRev: i.cursorRev,
|
|
@@ -167,21 +210,22 @@ function A(e, t, n) {
|
|
|
167
210
|
...e.hasOlderHeaders || t.hasOlderHeaders ? { hasOlderHeaders: !0 } : {},
|
|
168
211
|
...a > 0 ? { pulledAt: a } : {},
|
|
169
212
|
...s === void 0 ? {} : { resetAt: s },
|
|
170
|
-
...i.rescanning ? { rescanning: !0 } : {}
|
|
213
|
+
...i.rescanning ? { rescanning: !0 } : {},
|
|
214
|
+
...e.ctl === 1 || t.ctl === 1 ? { ctl: 1 } : {}
|
|
171
215
|
});
|
|
172
216
|
}
|
|
173
|
-
function
|
|
217
|
+
function R(e, t, n) {
|
|
174
218
|
if (!e) return t;
|
|
175
219
|
let r = e.serverId ?? t.serverId;
|
|
176
|
-
return Object.assign(
|
|
220
|
+
return Object.assign(F(e, t, y, n), {
|
|
177
221
|
scopeKey: e.scopeKey,
|
|
178
222
|
at: Math.min(e.at, t.at),
|
|
179
223
|
confirmed: e.confirmed || t.confirmed,
|
|
180
224
|
...r ? { serverId: r } : {}
|
|
181
225
|
});
|
|
182
226
|
}
|
|
183
|
-
function
|
|
184
|
-
let t = e.outbox.filter((t) => !(t.id in e.doneItemIds) && !(t.type
|
|
227
|
+
function z(e) {
|
|
228
|
+
let t = e.outbox.filter((t) => !(t.id in e.doneItemIds) && !(t.type !== "delete" && t.convKey in e.tombstones)), n = e.scopes;
|
|
185
229
|
for (let [t, r] of Object.entries(e.tombstones)) {
|
|
186
230
|
let e = n[r.scopeKey];
|
|
187
231
|
if (!e || !(t in e.headers)) continue;
|
|
@@ -200,13 +244,13 @@ function M(e) {
|
|
|
200
244
|
scopes: n
|
|
201
245
|
};
|
|
202
246
|
}
|
|
203
|
-
function
|
|
247
|
+
function B(e, t, n) {
|
|
204
248
|
let r = {};
|
|
205
|
-
for (let i of new Set([...Object.keys(e.scopes), ...Object.keys(t.scopes)])) r[i] =
|
|
249
|
+
for (let i of new Set([...Object.keys(e.scopes), ...Object.keys(t.scopes)])) r[i] = I(L(e.scopes[i], t.scopes[i], n));
|
|
206
250
|
let i = { ...e.doneItemIds };
|
|
207
251
|
for (let [e, n] of Object.entries(t.doneItemIds)) i[e] = Math.max(i[e] ?? 0, n);
|
|
208
252
|
let a = { ...e.tombstones };
|
|
209
|
-
for (let [e, r] of Object.entries(t.tombstones)) a[e] =
|
|
253
|
+
for (let [e, r] of Object.entries(t.tombstones)) a[e] = R(a[e], r, n);
|
|
210
254
|
let o = /* @__PURE__ */ new Map();
|
|
211
255
|
for (let n of [...e.outbox, ...t.outbox]) {
|
|
212
256
|
let e = o.get(n.id);
|
|
@@ -214,11 +258,9 @@ function N(e, t, n) {
|
|
|
214
258
|
}
|
|
215
259
|
if (n === "stored") for (let e of t.outbox) {
|
|
216
260
|
let t = o.get(e.id);
|
|
217
|
-
|
|
218
|
-
let n = t.type === "save" ? _ : v;
|
|
219
|
-
o.set(e.id, b(t, e, n));
|
|
261
|
+
!t || t === e || o.set(e.id, E(t, e, w(t)));
|
|
220
262
|
}
|
|
221
|
-
return
|
|
263
|
+
return z({
|
|
222
264
|
v: 1,
|
|
223
265
|
scopes: r,
|
|
224
266
|
outbox: [...o.values()],
|
|
@@ -226,13 +268,13 @@ function N(e, t, n) {
|
|
|
226
268
|
tombstones: a
|
|
227
269
|
});
|
|
228
270
|
}
|
|
229
|
-
function
|
|
230
|
-
return
|
|
271
|
+
function V(e) {
|
|
272
|
+
return B(e.memory, e.stored, "stored");
|
|
231
273
|
}
|
|
232
|
-
function
|
|
233
|
-
return
|
|
274
|
+
function H(e, t) {
|
|
275
|
+
return B(e, t, "either");
|
|
234
276
|
}
|
|
235
|
-
function
|
|
277
|
+
function U(e, t) {
|
|
236
278
|
let n = Object.fromEntries(Object.entries(e.doneItemIds).filter(([, e]) => t - e < o)), r = Object.entries(e.tombstones).filter(([, e]) => !e.confirmed || t - e.at < 2592e6);
|
|
237
279
|
if (r.length > 1e3) {
|
|
238
280
|
let e = r.filter(([, e]) => !e.confirmed), t = r.filter(([, e]) => e.confirmed).sort(([e, t], [n, r]) => r.at - t.at || (e < n ? -1 : Number(e > n))).slice(0, Math.max(0, a - e.length));
|
|
@@ -244,7 +286,7 @@ function I(e, t) {
|
|
|
244
286
|
tombstones: Object.fromEntries(r)
|
|
245
287
|
};
|
|
246
288
|
}
|
|
247
|
-
function
|
|
289
|
+
function W(e) {
|
|
248
290
|
if (e === null) return null;
|
|
249
291
|
try {
|
|
250
292
|
let t = JSON.parse(e);
|
|
@@ -253,14 +295,14 @@ function L(e) {
|
|
|
253
295
|
return null;
|
|
254
296
|
}
|
|
255
297
|
}
|
|
256
|
-
function
|
|
298
|
+
function G(e) {
|
|
257
299
|
return d(e) && typeof e.v == "number" && e.v > 1;
|
|
258
300
|
}
|
|
259
|
-
function
|
|
301
|
+
function K(e, t) {
|
|
260
302
|
if (e.v !== 1) return { ...t };
|
|
261
303
|
let n = Array.isArray(e.outbox) ? e.outbox : [], r = (e) => d(e) && typeof e.id == "string" && e.id in t.doneItemIds, i = new Set(t.outbox.map((e) => e.id)), a = /* @__PURE__ */ new Map(), o = null;
|
|
262
304
|
for (let e of n) {
|
|
263
|
-
if (
|
|
305
|
+
if (O(e)) {
|
|
264
306
|
i.has(e.id) && (o = e.id);
|
|
265
307
|
continue;
|
|
266
308
|
}
|
|
@@ -278,27 +320,27 @@ function z(e, t) {
|
|
|
278
320
|
outbox: s
|
|
279
321
|
};
|
|
280
322
|
}
|
|
281
|
-
function
|
|
323
|
+
function q(e, t, n, r) {
|
|
282
324
|
return {
|
|
283
325
|
getItem(t) {
|
|
284
|
-
let n =
|
|
285
|
-
return r.newer =
|
|
286
|
-
state:
|
|
326
|
+
let n = W(e.getItem(t));
|
|
327
|
+
return r.newer = G(n), n === null || r.newer ? null : {
|
|
328
|
+
state: M(n),
|
|
287
329
|
version: 0
|
|
288
330
|
};
|
|
289
331
|
},
|
|
290
332
|
setItem(i, a) {
|
|
291
|
-
let o =
|
|
292
|
-
if (
|
|
333
|
+
let o = W(e.peekItem(i));
|
|
334
|
+
if (G(o)) {
|
|
293
335
|
r.newer = !0;
|
|
294
336
|
return;
|
|
295
337
|
}
|
|
296
|
-
let s = o ?
|
|
338
|
+
let s = o ? M(o) : null, c = U(s ? V({
|
|
297
339
|
memory: a.state,
|
|
298
340
|
stored: s
|
|
299
341
|
}) : a.state, t());
|
|
300
342
|
e.setItem(i, JSON.stringify({
|
|
301
|
-
state: o ?
|
|
343
|
+
state: o ? K(o, c) : c,
|
|
302
344
|
version: 0
|
|
303
345
|
})), e.isCurrent(i) && n(e.lastWriteFailed());
|
|
304
346
|
},
|
|
@@ -307,7 +349,7 @@ function B(e, t, n, r) {
|
|
|
307
349
|
}
|
|
308
350
|
};
|
|
309
351
|
}
|
|
310
|
-
function
|
|
352
|
+
function J(e) {
|
|
311
353
|
return {
|
|
312
354
|
v: 1,
|
|
313
355
|
scopes: e.scopes,
|
|
@@ -316,22 +358,49 @@ function V(e) {
|
|
|
316
358
|
tombstones: e.tombstones
|
|
317
359
|
};
|
|
318
360
|
}
|
|
319
|
-
function
|
|
361
|
+
function Y(e, t, n) {
|
|
320
362
|
let r = { ...e.headers };
|
|
321
363
|
for (let [e, i] of Object.entries(t)) {
|
|
322
364
|
if (e in n) continue;
|
|
323
365
|
let t = r[e];
|
|
324
|
-
r[e] = t ?
|
|
366
|
+
r[e] = t ? N(t, i) : i;
|
|
325
367
|
}
|
|
326
|
-
return
|
|
368
|
+
return I({
|
|
327
369
|
...e,
|
|
328
370
|
headers: r
|
|
329
371
|
});
|
|
330
372
|
}
|
|
331
|
-
function
|
|
373
|
+
function X(e, i, a, o) {
|
|
332
374
|
return t()(n((e, t) => ({
|
|
333
375
|
...c(),
|
|
334
|
-
enqueueHistoryItem: (t) => e((e) => t.id in e.doneItemIds || e.outbox.some((e) => e.id === t.id) || t.type
|
|
376
|
+
enqueueHistoryItem: (t) => e((e) => t.id in e.doneItemIds || e.outbox.some((e) => e.id === t.id) || t.type !== "delete" && t.convKey in e.tombstones ? {} : { outbox: [...e.outbox, t] }),
|
|
377
|
+
queueHistoryUpdate: (t, n, r) => e((e) => {
|
|
378
|
+
if (t.id in e.doneItemIds || e.outbox.some((e) => e.id === t.id) || t.convKey in e.tombstones) return {};
|
|
379
|
+
let i = n === null ? -1 : e.outbox.findIndex((e) => e.id === n);
|
|
380
|
+
if (n === null || i < 0) return { outbox: [...e.outbox, t] };
|
|
381
|
+
let a = [...e.outbox];
|
|
382
|
+
return a[i] = t, z({
|
|
383
|
+
...J(e),
|
|
384
|
+
outbox: a,
|
|
385
|
+
doneItemIds: {
|
|
386
|
+
...e.doneItemIds,
|
|
387
|
+
[n]: r
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
}),
|
|
391
|
+
markHistoryScopeControls: (n, r) => {
|
|
392
|
+
let i = t().scopes[n];
|
|
393
|
+
return !i || u(i) !== r ? !1 : (i.ctl === 1 || e((e) => {
|
|
394
|
+
let t = e.scopes[n];
|
|
395
|
+
return !t || u(t) !== r ? {} : { scopes: {
|
|
396
|
+
...e.scopes,
|
|
397
|
+
[n]: {
|
|
398
|
+
...t,
|
|
399
|
+
ctl: 1
|
|
400
|
+
}
|
|
401
|
+
} };
|
|
402
|
+
}), !0);
|
|
403
|
+
},
|
|
335
404
|
updateHistoryItem: (t, n) => e((e) => {
|
|
336
405
|
let r = e.outbox.findIndex((e) => e.id === t), i = e.outbox[r];
|
|
337
406
|
if (!i) return {};
|
|
@@ -344,8 +413,8 @@ function U(e, i, a, o) {
|
|
|
344
413
|
if (t.length === 0) return {};
|
|
345
414
|
let r = { ...e.doneItemIds };
|
|
346
415
|
for (let e of t) r[e] = n;
|
|
347
|
-
return
|
|
348
|
-
...
|
|
416
|
+
return z({
|
|
417
|
+
...J(e),
|
|
349
418
|
doneItemIds: r
|
|
350
419
|
});
|
|
351
420
|
}),
|
|
@@ -354,49 +423,49 @@ function U(e, i, a, o) {
|
|
|
354
423
|
if (i.length === 0) return {};
|
|
355
424
|
let a = { ...e.doneItemIds };
|
|
356
425
|
for (let e of i) a[e] = r;
|
|
357
|
-
return
|
|
358
|
-
...
|
|
426
|
+
return z({
|
|
427
|
+
...J(e),
|
|
359
428
|
doneItemIds: a
|
|
360
429
|
});
|
|
361
430
|
}),
|
|
362
431
|
recordHistoryDelete: (t, n, r) => e((e) => {
|
|
363
432
|
let i = r && !(r.id in e.doneItemIds) && !e.outbox.some((e) => e.id === r.id);
|
|
364
|
-
return
|
|
365
|
-
...
|
|
433
|
+
return z({
|
|
434
|
+
...J(e),
|
|
366
435
|
outbox: i ? [...e.outbox, r] : e.outbox,
|
|
367
436
|
tombstones: {
|
|
368
437
|
...e.tombstones,
|
|
369
|
-
[t]:
|
|
438
|
+
[t]: R(e.tombstones[t], n, "either")
|
|
370
439
|
}
|
|
371
440
|
});
|
|
372
441
|
}),
|
|
373
|
-
recordHistoryTombstone: (t, n) => e((e) =>
|
|
374
|
-
...
|
|
442
|
+
recordHistoryTombstone: (t, n) => e((e) => z({
|
|
443
|
+
...J(e),
|
|
375
444
|
tombstones: {
|
|
376
445
|
...e.tombstones,
|
|
377
|
-
[t]:
|
|
446
|
+
[t]: R(e.tombstones[t], n, "either")
|
|
378
447
|
}
|
|
379
448
|
})),
|
|
380
449
|
applyHistoryFeedPage: (n, r) => {
|
|
381
450
|
let i = t().scopes[n];
|
|
382
451
|
return u(i) === r.gen ? (e((e) => {
|
|
383
452
|
let t = e.scopes[n] ?? l(r.gen), i = { ...e.tombstones };
|
|
384
|
-
for (let [e, { serverId: t }] of Object.entries(r.deleted)) i[e] =
|
|
453
|
+
for (let [e, { serverId: t }] of Object.entries(r.deleted)) i[e] = R(i[e], {
|
|
385
454
|
scopeKey: n,
|
|
386
455
|
at: r.at,
|
|
387
456
|
confirmed: !0,
|
|
388
457
|
serverId: t
|
|
389
458
|
}, "either");
|
|
390
459
|
let a = r.cursorRev >= t.cursorRev, o = {
|
|
391
|
-
...
|
|
460
|
+
...Y(t, r.headers, i),
|
|
392
461
|
...a ? {
|
|
393
462
|
cursor: r.cursor,
|
|
394
463
|
cursorRev: r.cursorRev
|
|
395
464
|
} : {},
|
|
396
465
|
pulledAt: r.at
|
|
397
466
|
};
|
|
398
|
-
return r.last && delete o.rescanning,
|
|
399
|
-
...
|
|
467
|
+
return r.last && delete o.rescanning, z({
|
|
468
|
+
...J(e),
|
|
400
469
|
scopes: {
|
|
401
470
|
...e.scopes,
|
|
402
471
|
[n]: o
|
|
@@ -409,7 +478,7 @@ function U(e, i, a, o) {
|
|
|
409
478
|
let r = e.scopes[t] ?? l();
|
|
410
479
|
return { scopes: {
|
|
411
480
|
...e.scopes,
|
|
412
|
-
[t]:
|
|
481
|
+
[t]: Y(r, n, e.tombstones)
|
|
413
482
|
} };
|
|
414
483
|
}),
|
|
415
484
|
markHistoryHeaderGone: (t, n) => e((e) => {
|
|
@@ -439,22 +508,22 @@ function U(e, i, a, o) {
|
|
|
439
508
|
}
|
|
440
509
|
} })), i;
|
|
441
510
|
},
|
|
442
|
-
pruneHistory: (t) => e((e) =>
|
|
511
|
+
pruneHistory: (t) => e((e) => U(J(e), t))
|
|
443
512
|
}), {
|
|
444
513
|
name: r,
|
|
445
|
-
storage:
|
|
446
|
-
partialize: (e) =>
|
|
514
|
+
storage: q(e, i, a, o),
|
|
515
|
+
partialize: (e) => J(e),
|
|
447
516
|
skipHydration: !0,
|
|
448
517
|
merge: (e, t) => ({
|
|
449
518
|
...t,
|
|
450
|
-
...
|
|
451
|
-
memory:
|
|
452
|
-
stored:
|
|
519
|
+
...V({
|
|
520
|
+
memory: J(t),
|
|
521
|
+
stored: M(e)
|
|
453
522
|
})
|
|
454
523
|
})
|
|
455
524
|
}));
|
|
456
525
|
}
|
|
457
|
-
function
|
|
526
|
+
function Z(e, t = {}) {
|
|
458
527
|
let n = null, i = !1, a = (e) => {
|
|
459
528
|
if (!(!n || e && i)) {
|
|
460
529
|
if (!e) {
|
|
@@ -468,7 +537,7 @@ function W(e, t = {}) {
|
|
|
468
537
|
i = !1;
|
|
469
538
|
}
|
|
470
539
|
}
|
|
471
|
-
}, o = { newer: !1 }, s =
|
|
540
|
+
}, o = { newer: !1 }, s = X(e, t.now ?? Date.now, a, o);
|
|
472
541
|
return {
|
|
473
542
|
useStore: s,
|
|
474
543
|
boundKey: () => e.boundKey(),
|
|
@@ -486,7 +555,7 @@ function W(e, t = {}) {
|
|
|
486
555
|
if (!e.isCurrent("hb-ai-assistant-history") || o.newer) return !1;
|
|
487
556
|
let t = s.persist.getOptions().storage;
|
|
488
557
|
return t ? (t.setItem(r, {
|
|
489
|
-
state:
|
|
558
|
+
state: J(s.getState()),
|
|
490
559
|
version: 0
|
|
491
560
|
}), !o.newer && !e.lastWriteFailed()) : !1;
|
|
492
561
|
},
|
|
@@ -495,9 +564,9 @@ function W(e, t = {}) {
|
|
|
495
564
|
}
|
|
496
565
|
};
|
|
497
566
|
}
|
|
498
|
-
var
|
|
567
|
+
var Q = Z(e({ onRefused: (e, t) => {
|
|
499
568
|
e !== "unbound" && console.warn(`[assistant] history not saved on this device (${e})`, t ?? "");
|
|
500
|
-
} })),
|
|
501
|
-
typeof window < "u" && typeof window.addEventListener == "function" && window.addEventListener("storage", (e) =>
|
|
569
|
+
} })), $ = Q.useStore;
|
|
570
|
+
typeof window < "u" && typeof window.addEventListener == "function" && window.addEventListener("storage", (e) => Q.handleStorageEvent(e.key));
|
|
502
571
|
//#endregion
|
|
503
|
-
export { o as ASSISTANT_HISTORY_DONE_TTL_MS, i as ASSISTANT_HISTORY_MAX_HEADERS, a as ASSISTANT_HISTORY_MAX_TOMBSTONES, r as ASSISTANT_HISTORY_STORAGE_NAME, s as ASSISTANT_HISTORY_TOMBSTONE_TTL_MS,
|
|
572
|
+
export { o as ASSISTANT_HISTORY_DONE_TTL_MS, i as ASSISTANT_HISTORY_MAX_HEADERS, a as ASSISTANT_HISTORY_MAX_TOMBSTONES, r as ASSISTANT_HISTORY_STORAGE_NAME, s as ASSISTANT_HISTORY_TOMBSTONE_TTL_MS, Q as assistantHistoryStore, I as boundAssistantHistoryHeaders, Z as createAssistantHistoryStore, c as emptyAssistantHistoryPersisted, l as emptyAssistantHistoryScopeState, g as headerHasControls, G as isNewerAssistantHistoryFormat, H as mergeAssistantHistoryPersisted, V as mergeAssistantHistoryWithStored, U as pruneAssistantHistoryPersisted, M as readAssistantHistoryPersisted, z as settleAssistantHistory, $ as useAssistantHistoryStore };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The errors the server-history transport raises itself (BOFF-7335,
|
|
3
|
+
* BOFF-8159) — as opposed to the errors the server answers with.
|
|
4
|
+
*
|
|
5
|
+
* ★ A LEAF: it imports nothing, so the transport (`historyApi`) and the
|
|
6
|
+
* classifier (`historyErrors`) can both use these classes without importing
|
|
7
|
+
* each other. (They lived in `historyApi` before; the assistant barrel
|
|
8
|
+
* exports this module, so the names a product imports are unchanged.)
|
|
9
|
+
*/
|
|
10
|
+
/** The server answered, but not with a shape this client understands. Never a reason to drop. */
|
|
11
|
+
export declare class AssistantHistoryResponseError extends Error {
|
|
12
|
+
constructor(operationName: string, detail: string);
|
|
13
|
+
}
|
|
14
|
+
/** The request's workspace or account is not the active one, so it was not sent. Hold, never drop. */
|
|
15
|
+
export declare class AssistantHistoryScopeInactiveError extends Error {
|
|
16
|
+
constructor();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The server (or the gateway in front of it) does not have the history
|
|
20
|
+
* controls (BOFF-8159), so a call that only exists with them — a control
|
|
21
|
+
* change, or a filtered list — was not made, or was refused for exactly that.
|
|
22
|
+
* Never a reason to pause history or drop anything: a control change waits
|
|
23
|
+
* until the controls are back.
|
|
24
|
+
*/
|
|
25
|
+
export declare class AssistantHistoryControlsUnavailableError extends Error {
|
|
26
|
+
constructor(operationName: string);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=historyTransportErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"historyTransportErrors.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/history/historyTransportErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,iGAAiG;AACjG,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAIlD;AAED,sGAAsG;AACtG,qBAAa,kCAAmC,SAAQ,KAAK;;CAK5D;AAED;;;;;;GAMG;AACH,qBAAa,wCAAyC,SAAQ,KAAK;gBACrD,aAAa,EAAE,MAAM;CAIlC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/shared/assistant/history/historyTransportErrors.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
constructor(e, t) {
|
|
4
|
+
super(`Assistant history: unexpected ${e} response (${t})`), this.name = "AssistantHistoryResponseError";
|
|
5
|
+
}
|
|
6
|
+
}, t = class extends Error {
|
|
7
|
+
constructor() {
|
|
8
|
+
super("Assistant history: the request's workspace or account is not the active one"), this.name = "AssistantHistoryScopeInactiveError";
|
|
9
|
+
}
|
|
10
|
+
}, n = class extends Error {
|
|
11
|
+
constructor(e) {
|
|
12
|
+
super(`Assistant history: ${e} needs the history controls, which the server does not have`), this.name = "AssistantHistoryControlsUnavailableError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as AssistantHistoryControlsUnavailableError, e as AssistantHistoryResponseError, t as AssistantHistoryScopeInactiveError };
|