@burdenoff/fe-libs 2026.929.1 → 2026.930.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.
- package/dist/shared/assistant/api.d.ts +22 -0
- package/dist/shared/assistant/api.d.ts.map +1 -1
- package/dist/shared/assistant/api.js +112 -100
- package/dist/shared/assistant/i18nManifest.d.ts +1 -1
- package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.js +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +5 -1
- package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.d.ts +2 -0
- package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.js +104 -104
- package/dist/shared/assistant/ui/AssistantWriteProposalCard.d.ts +7 -0
- package/dist/shared/assistant/ui/AssistantWriteProposalCard.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantWriteProposalCard.js +91 -87
- package/dist/shared/assistant/ui/AssistantWriteProposalSlot.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantWriteProposalSlot.js +3 -2
- package/dist/shared/assistant/ui/useWriteProposalConfirm.d.ts +2 -2
- package/dist/shared/assistant/ui/useWriteProposals.d.ts +34 -2
- package/dist/shared/assistant/ui/useWriteProposals.d.ts.map +1 -1
- package/dist/shared/assistant/ui/useWriteProposals.js +133 -115
- package/dist/shared/assistant/ui/writeProposalPresentation.d.ts +26 -6
- package/dist/shared/assistant/ui/writeProposalPresentation.d.ts.map +1 -1
- package/dist/shared/assistant/ui/writeProposalPresentation.js +23 -16
- package/dist/shared/assistant/writeProposalDiscovery.d.ts +66 -2
- package/dist/shared/assistant/writeProposalDiscovery.d.ts.map +1 -1
- package/dist/shared/assistant/writeProposalDiscovery.js +121 -85
- package/dist/shared-assistant.js +155 -155
- package/package.json +1 -1
|
@@ -16,35 +16,68 @@ function r(e) {
|
|
|
16
16
|
}
|
|
17
17
|
return r;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
function i(e, t) {
|
|
20
|
+
return (e.sessionId === null || e.sessionId === t.sessionId) && (e.conversationId === null || e.conversationId === t.conversationId);
|
|
21
|
+
}
|
|
22
|
+
function a(e) {
|
|
23
|
+
let t = /* @__PURE__ */ new Map();
|
|
24
|
+
for (let n of e.messages) for (let i of r(n.metadata)) t.set(f(i), {
|
|
25
|
+
session: {
|
|
26
|
+
sandboxId: i.sandboxId,
|
|
27
|
+
sessionId: i.sessionId,
|
|
28
|
+
conversationId: e.id
|
|
29
|
+
},
|
|
30
|
+
issuing: !0
|
|
31
|
+
});
|
|
32
|
+
let n = e.backendSessionId;
|
|
33
|
+
if (n) for (let r = e.messages.length - 1; r >= 0; --r) {
|
|
34
|
+
let i = e.messages[r]?.metadata;
|
|
35
|
+
if (i?.sessionId !== n || typeof i.sandboxId != "string" || !i.sandboxId) continue;
|
|
36
|
+
let a = f({
|
|
37
|
+
sandboxId: i.sandboxId,
|
|
38
|
+
sessionId: n
|
|
39
|
+
}), o = t.get(a);
|
|
40
|
+
t.set(a, {
|
|
41
|
+
session: {
|
|
42
|
+
sandboxId: i.sandboxId,
|
|
43
|
+
sessionId: n,
|
|
44
|
+
conversationId: e.id
|
|
45
|
+
},
|
|
46
|
+
issuing: (o?.issuing ?? !1) || i.mode === "api-calls"
|
|
47
|
+
});
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return [...t.values()];
|
|
51
|
+
}
|
|
52
|
+
var o = 2e3, s = 5;
|
|
53
|
+
function c(e) {
|
|
21
54
|
return e?.proposals === !0 && e.writeApprovalMode === "proposal-v1";
|
|
22
55
|
}
|
|
23
|
-
function
|
|
56
|
+
function l() {
|
|
24
57
|
let e = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`;
|
|
25
58
|
return `wpr-${Date.now().toString(36)}-${e}`;
|
|
26
59
|
}
|
|
27
|
-
function
|
|
60
|
+
function u(n) {
|
|
28
61
|
return t(n) ? n : new e({
|
|
29
62
|
status: 0,
|
|
30
63
|
code: "UNKNOWN",
|
|
31
64
|
message: n instanceof Error ? n.message : String(n)
|
|
32
65
|
});
|
|
33
66
|
}
|
|
34
|
-
var
|
|
67
|
+
var d = {
|
|
35
68
|
set: (e, t) => setTimeout(e, t),
|
|
36
69
|
clear: (e) => clearTimeout(e)
|
|
37
|
-
},
|
|
38
|
-
function
|
|
70
|
+
}, f = (e) => `${e.sandboxId}\u0000${e.sessionId}`;
|
|
71
|
+
function p(e, t) {
|
|
39
72
|
return e ? {
|
|
40
73
|
reason: e.reason === "turn" ? "turn" : t.reason,
|
|
41
74
|
turnMessageId: t.turnMessageId ?? e.turnMessageId
|
|
42
75
|
} : t;
|
|
43
76
|
}
|
|
44
|
-
function
|
|
45
|
-
let t = e.timers ??
|
|
46
|
-
function
|
|
47
|
-
let t =
|
|
77
|
+
function m(e) {
|
|
78
|
+
let t = e.timers ?? d, n = e.pollMs ?? 2e3, r = e.maxPollFailures ?? 5, a = e.requestId ?? l, o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), m = !1, h = (t) => !m && c(e.capabilitiesOf(t.sandboxId)), g = (e) => h(e) && !s.has(e.sandboxId);
|
|
79
|
+
function _(e) {
|
|
80
|
+
let t = f(e), n = o.get(t);
|
|
48
81
|
return n ? n.session = e : (n = {
|
|
49
82
|
session: e,
|
|
50
83
|
since: null,
|
|
@@ -56,69 +89,72 @@ function f(e) {
|
|
|
56
89
|
failures: 0,
|
|
57
90
|
failureReported: !1,
|
|
58
91
|
executing: /* @__PURE__ */ new Set()
|
|
59
|
-
},
|
|
92
|
+
}, o.set(t, n)), n;
|
|
60
93
|
}
|
|
61
|
-
function
|
|
94
|
+
function v(e) {
|
|
62
95
|
e.hasTimer &&= (t.clear(e.timer), e.timer = null, !1);
|
|
63
96
|
}
|
|
64
|
-
function
|
|
97
|
+
function y(e, t) {
|
|
65
98
|
t.status === "executing" ? e.executing.add(t.proposalId) : e.executing.delete(t.proposalId);
|
|
66
99
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
e.timer = null, e.hasTimer = !1,
|
|
100
|
+
function b(e) {
|
|
101
|
+
m || e.hasTimer || e.running || e.queuedRun || e.executing.size === 0 || e.failures >= r || (e.hasTimer = !0, e.timer = t.set(() => {
|
|
102
|
+
e.timer = null, e.hasTimer = !1, C(e.session, "poll");
|
|
70
103
|
}, n));
|
|
71
104
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
105
|
+
function x(t, n) {
|
|
106
|
+
m || (y(t, n), e.onView(t.session, n), b(t));
|
|
74
107
|
}
|
|
75
|
-
async function
|
|
76
|
-
if (
|
|
77
|
-
let
|
|
78
|
-
let
|
|
108
|
+
async function S(t, n) {
|
|
109
|
+
if (v(t), !h(t.session)) return;
|
|
110
|
+
let a = e.actorOf?.() ?? null, o = (async () => {
|
|
111
|
+
let o;
|
|
79
112
|
try {
|
|
80
|
-
|
|
113
|
+
o = await e.client.list(t.session, {
|
|
81
114
|
status: "all",
|
|
82
115
|
...t.since === null ? {} : { since: t.since }
|
|
83
116
|
});
|
|
84
117
|
} catch (i) {
|
|
85
|
-
if (
|
|
86
|
-
t.failures += 1, (n.reason === "turn" || n.reason === "poll" && t.failures >= r) && !t.failureReported && (t.failureReported = !0, e.onError(t.session,
|
|
118
|
+
if (m) return;
|
|
119
|
+
t.failures += 1, (n.reason === "turn" || n.reason === "poll" && t.failures >= r) && !t.failureReported && (t.failureReported = !0, e.onError(t.session, u(i), "list"));
|
|
87
120
|
return;
|
|
88
121
|
}
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
122
|
+
if (m || a !== null && (e.actorOf?.() ?? null) !== a) return;
|
|
123
|
+
t.since = o.serverNow, t.failures = 0, t.failureReported = !1;
|
|
124
|
+
let s = o.proposals.filter((e) => i(e, t.session));
|
|
125
|
+
for (let e of s) y(t, e);
|
|
126
|
+
e.onList(t.session, s.length === o.proposals.length ? o : {
|
|
127
|
+
...o,
|
|
128
|
+
proposals: s
|
|
129
|
+
}, n);
|
|
94
130
|
})();
|
|
95
|
-
t.running =
|
|
131
|
+
t.running = o;
|
|
96
132
|
try {
|
|
97
|
-
await
|
|
133
|
+
await o;
|
|
98
134
|
} finally {
|
|
99
|
-
t.running ===
|
|
135
|
+
t.running === o && (t.running = null), b(t);
|
|
100
136
|
}
|
|
101
137
|
}
|
|
102
|
-
function
|
|
103
|
-
if (!
|
|
104
|
-
let r =
|
|
138
|
+
function C(e, t, n = {}) {
|
|
139
|
+
if (!h(e)) return Promise.resolve();
|
|
140
|
+
let r = _(e), i = {
|
|
105
141
|
reason: t,
|
|
106
142
|
turnMessageId: n.turnMessageId ?? null
|
|
107
143
|
};
|
|
108
|
-
if (r.queuedRun) return r.queued =
|
|
144
|
+
if (r.queuedRun) return r.queued = p(r.queued, i), r.queuedRun;
|
|
109
145
|
if (r.running) {
|
|
110
146
|
r.queued = i;
|
|
111
147
|
let e = r.running.then(() => {
|
|
112
148
|
let e = r.queued ?? i;
|
|
113
|
-
return r.queued = null, r.queuedRun = null,
|
|
149
|
+
return r.queued = null, r.queuedRun = null, S(r, e);
|
|
114
150
|
});
|
|
115
151
|
return r.queuedRun = e, e;
|
|
116
152
|
}
|
|
117
|
-
return
|
|
153
|
+
return S(r, i);
|
|
118
154
|
}
|
|
119
|
-
async function
|
|
120
|
-
if (!
|
|
121
|
-
let
|
|
155
|
+
async function w(t, n, r) {
|
|
156
|
+
if (!g(t)) return;
|
|
157
|
+
let i = _(t), o = !0;
|
|
122
158
|
try {
|
|
123
159
|
let s = await e.client.approve({
|
|
124
160
|
...t,
|
|
@@ -126,85 +162,85 @@ function f(e) {
|
|
|
126
162
|
}, {
|
|
127
163
|
payloadHash: n.payloadHash,
|
|
128
164
|
surface: r,
|
|
129
|
-
clientRequestId:
|
|
165
|
+
clientRequestId: a()
|
|
130
166
|
});
|
|
131
|
-
if (
|
|
132
|
-
s.kind === "settled" ? (
|
|
167
|
+
if (m) return;
|
|
168
|
+
s.kind === "settled" ? (x(i, s.proposal), o = !1) : s.proposal ? x(i, s.proposal) : i.executing.add(n.proposalId);
|
|
133
169
|
} catch (t) {
|
|
134
|
-
if (
|
|
135
|
-
let n =
|
|
136
|
-
n.current &&
|
|
170
|
+
if (m) return;
|
|
171
|
+
let n = u(t);
|
|
172
|
+
n.current && x(i, n.current), e.onError(i.session, n, "approve");
|
|
137
173
|
}
|
|
138
|
-
o && await
|
|
174
|
+
o && await C(i.session, "refresh");
|
|
139
175
|
}
|
|
140
|
-
async function
|
|
141
|
-
if (!
|
|
142
|
-
let s =
|
|
176
|
+
async function T(t, n, r, i, o) {
|
|
177
|
+
if (!g(t)) return;
|
|
178
|
+
let s = _(t);
|
|
143
179
|
try {
|
|
144
|
-
|
|
180
|
+
x(s, await e.client.decline({
|
|
145
181
|
...t,
|
|
146
182
|
proposalId: n.proposalId
|
|
147
183
|
}, {
|
|
148
184
|
reason: r,
|
|
149
|
-
method:
|
|
185
|
+
method: i,
|
|
150
186
|
...o ? { surface: o } : {},
|
|
151
|
-
clientRequestId:
|
|
187
|
+
clientRequestId: a()
|
|
152
188
|
}));
|
|
153
189
|
} catch (t) {
|
|
154
|
-
if (
|
|
155
|
-
let n =
|
|
156
|
-
n.current &&
|
|
190
|
+
if (m) return;
|
|
191
|
+
let n = u(t);
|
|
192
|
+
n.current && x(s, n.current), e.onError(s.session, n, "decline");
|
|
157
193
|
}
|
|
158
194
|
}
|
|
159
|
-
async function
|
|
160
|
-
if (!
|
|
161
|
-
let
|
|
195
|
+
async function E(t, n, r) {
|
|
196
|
+
if (!g(t) || n.status !== "pending") return;
|
|
197
|
+
let i = _(t);
|
|
162
198
|
try {
|
|
163
|
-
|
|
199
|
+
x(i, await e.client.presented({
|
|
164
200
|
...t,
|
|
165
201
|
proposalId: n.proposalId
|
|
166
202
|
}, {
|
|
167
203
|
payloadHash: n.payloadHash,
|
|
168
204
|
surface: r,
|
|
169
|
-
clientRequestId:
|
|
205
|
+
clientRequestId: a()
|
|
170
206
|
}));
|
|
171
207
|
} catch (e) {
|
|
172
|
-
if (
|
|
173
|
-
let t =
|
|
174
|
-
t.current &&
|
|
208
|
+
if (m) return;
|
|
209
|
+
let t = u(e);
|
|
210
|
+
t.current && x(i, t.current);
|
|
175
211
|
}
|
|
176
212
|
}
|
|
177
|
-
async function
|
|
178
|
-
if (!
|
|
179
|
-
let o =
|
|
213
|
+
async function D(t, n, r, i = {}) {
|
|
214
|
+
if (!h(t)) return !1;
|
|
215
|
+
let o = _(t);
|
|
180
216
|
try {
|
|
181
217
|
await e.client.declineAll(t, {
|
|
182
218
|
reason: n,
|
|
183
219
|
method: r,
|
|
184
|
-
clientRequestId:
|
|
220
|
+
clientRequestId: a()
|
|
185
221
|
});
|
|
186
222
|
} catch (t) {
|
|
187
|
-
return
|
|
223
|
+
return m || i.report && e.onError(o.session, u(t), "decline"), !1;
|
|
188
224
|
}
|
|
189
|
-
return
|
|
225
|
+
return m || i.refresh !== !1 && await C(o.session, "refresh"), !0;
|
|
190
226
|
}
|
|
191
227
|
return {
|
|
192
|
-
discover:
|
|
193
|
-
approve:
|
|
194
|
-
decline:
|
|
195
|
-
presented:
|
|
196
|
-
declineAll:
|
|
228
|
+
discover: C,
|
|
229
|
+
approve: w,
|
|
230
|
+
decline: T,
|
|
231
|
+
presented: E,
|
|
232
|
+
declineAll: D,
|
|
197
233
|
retire: (e) => {
|
|
198
|
-
|
|
234
|
+
s.add(e);
|
|
199
235
|
},
|
|
200
|
-
isRetired: (e) =>
|
|
201
|
-
isPolling: (e) => !!
|
|
236
|
+
isRetired: (e) => s.has(e),
|
|
237
|
+
isPolling: (e) => !!o.get(f(e))?.hasTimer,
|
|
202
238
|
dispose: () => {
|
|
203
|
-
|
|
204
|
-
for (let e of
|
|
205
|
-
|
|
239
|
+
m = !0;
|
|
240
|
+
for (let e of o.values()) v(e);
|
|
241
|
+
o.clear();
|
|
206
242
|
}
|
|
207
243
|
};
|
|
208
244
|
}
|
|
209
245
|
//#endregion
|
|
210
|
-
export {
|
|
246
|
+
export { s as WRITE_PROPOSAL_MAX_POLL_FAILURES, o as WRITE_PROPOSAL_POLL_MS, u as asWriteProposalError, m as createWriteProposalDiscovery, l as newWriteProposalRequestId, r as readWriteProposalRefs, i as writeProposalBelongsTo, a as writeProposalSessionsToReopen, c as writeProposalsEnabledFor };
|