@burdenoff/fe-libs 2026.1001.5 → 2026.1002.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/shared/assistant/createSandboxAssistantTransport.d.ts.map +1 -1
- package/dist/shared/assistant/createSandboxAssistantTransport.js +79 -74
- package/dist/shared/assistant/i18nManifest.d.ts +13 -5
- package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.js +8 -7
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/preview/AssistantPreviewOverlay.js +4 -4
- package/dist/shared/assistant/preview/types.d.ts +13 -0
- package/dist/shared/assistant/preview/types.d.ts.map +1 -1
- package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts +21 -1
- package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts.map +1 -1
- package/dist/shared/assistant/preview/useAssistantPreviewBridge.js +1 -1
- package/dist/shared/assistant/preview/writeActionResults.d.ts +10 -0
- package/dist/shared/assistant/preview/writeActionResults.d.ts.map +1 -0
- package/dist/shared/assistant/preview/writeActionResults.js +26 -0
- package/dist/shared/assistant/turnOutcome.d.ts.map +1 -1
- package/dist/shared/assistant/turnOutcome.js +3 -3
- package/dist/shared/assistant/turnOutcomeCopy.d.ts +3 -3
- package/dist/shared/assistant/turnOutcomeCopy.d.ts.map +1 -1
- package/dist/shared/assistant/turnOutcomeCopy.js +3 -3
- package/dist/shared/assistant/ui/AIAssistantPanel.js +14 -14
- package/dist/shared/assistant/ui/AssistantHeader.js +4 -4
- package/dist/shared/assistant/ui/useWriteProposals.d.ts.map +1 -1
- package/dist/shared/assistant/ui/useWriteProposals.js +126 -99
- package/dist/shared-assistant.js +125 -124
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWriteProposals.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useWriteProposals.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"useWriteProposals.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useWriteProposals.ts"],"names":[],"mappings":"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"}
|
|
@@ -4,21 +4,25 @@ import { useAssistantStore as t } from "../store.js";
|
|
|
4
4
|
import { readSandboxWriteCapabilitiesOnce as n } from "../api.js";
|
|
5
5
|
import { writeProposalErrorLine as r } from "../writeProposalErrorCopy.js";
|
|
6
6
|
import { getOrganizationId as i, getWorkspaceId as a } from "../context.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { redactWriteProposalText as o, writeProposalConfirmState as s, writeProposalSensitiveTexts as c } from "./writeProposalPresentation.js";
|
|
8
|
+
import { useAssistantPreview as l } from "../preview/context.js";
|
|
9
|
+
import { currentPreviewOwner as u, sameOwner as d } from "../preview/surfaceState.js";
|
|
10
|
+
import { deliverPreviewEvent as f } from "../preview/useAssistantPreviewBridge.js";
|
|
11
|
+
import { writeActionResultEvents as p } from "../preview/writeActionResults.js";
|
|
12
|
+
import { WRITE_PROPOSAL_SANDBOX_MODE as m, createSandboxWriteProposalClient as h } from "../writeProposals.js";
|
|
13
|
+
import { createWriteProposalDiscovery as g, readWriteProposalRefs as _, writeProposalSessionsToReopen as v, writeProposalsEnabledFor as y } from "../writeProposalDiscovery.js";
|
|
14
|
+
import { WRITE_REPLY_DECLINE_WAIT_MS as b, settleWithin as x, writeReplyLiveState as S } from "../writeReplySend.js";
|
|
15
|
+
import { useEffect as C, useMemo as w, useRef as T, useState as E } from "react";
|
|
12
16
|
//#region src/shared/assistant/ui/useWriteProposals.ts
|
|
13
|
-
var
|
|
17
|
+
var D = new Set([
|
|
14
18
|
"succeeded",
|
|
15
19
|
"failed",
|
|
16
20
|
"outcome_unknown",
|
|
17
21
|
"declined",
|
|
18
22
|
"superseded",
|
|
19
23
|
"expired"
|
|
20
|
-
]),
|
|
21
|
-
function
|
|
24
|
+
]), O = (e) => `${e.sandboxId}\u0000${e.sessionId}`;
|
|
25
|
+
function k(e) {
|
|
22
26
|
return {
|
|
23
27
|
accessToken: e.getAccessToken(),
|
|
24
28
|
workspaceToken: e.getWorkspaceToken(),
|
|
@@ -26,15 +30,15 @@ function S(e) {
|
|
|
26
30
|
organizationId: i()
|
|
27
31
|
};
|
|
28
32
|
}
|
|
29
|
-
function
|
|
33
|
+
function A() {
|
|
30
34
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
31
35
|
}
|
|
32
|
-
function
|
|
36
|
+
function j(e) {
|
|
33
37
|
let t = /* @__PURE__ */ new Set();
|
|
34
|
-
for (let n of e.messages) for (let e of
|
|
38
|
+
for (let n of e.messages) for (let e of _(n.metadata)) t.add(e.proposalId);
|
|
35
39
|
return t;
|
|
36
40
|
}
|
|
37
|
-
function
|
|
41
|
+
function M(e, t, n) {
|
|
38
42
|
if (n) {
|
|
39
43
|
let t = e.messages.find((e) => e.id === n);
|
|
40
44
|
if (t?.role === "assistant") return t;
|
|
@@ -45,11 +49,11 @@ function T(e, t, n) {
|
|
|
45
49
|
}
|
|
46
50
|
return null;
|
|
47
51
|
}
|
|
48
|
-
function
|
|
52
|
+
function N(e) {
|
|
49
53
|
let t = /* @__PURE__ */ new Map();
|
|
50
54
|
for (let n of e) {
|
|
51
55
|
if (n.view.status !== "pending") continue;
|
|
52
|
-
let e = `${
|
|
56
|
+
let e = `${O(n.session)}\u0000${n.session.conversationId}`, r = t.get(e) ?? {
|
|
53
57
|
session: n.session,
|
|
54
58
|
proposalIds: []
|
|
55
59
|
};
|
|
@@ -57,192 +61,215 @@ function E(e) {
|
|
|
57
61
|
}
|
|
58
62
|
return t;
|
|
59
63
|
}
|
|
60
|
-
function
|
|
61
|
-
let { getAccessToken:
|
|
64
|
+
function P(i) {
|
|
65
|
+
let { getAccessToken: P, getWorkspaceToken: F, userId: I } = e(), L = l(), R = T({
|
|
62
66
|
tr: i.tr,
|
|
63
67
|
productWriteApproval: i.productWriteApproval ?? "legacy",
|
|
64
|
-
getAccessToken:
|
|
65
|
-
getWorkspaceToken:
|
|
66
|
-
userId:
|
|
68
|
+
getAccessToken: P,
|
|
69
|
+
getWorkspaceToken: F,
|
|
70
|
+
userId: I,
|
|
71
|
+
preview: L
|
|
67
72
|
});
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
C(() => {
|
|
74
|
+
R.current = {
|
|
70
75
|
tr: i.tr,
|
|
71
76
|
productWriteApproval: i.productWriteApproval ?? "legacy",
|
|
72
|
-
getAccessToken:
|
|
73
|
-
getWorkspaceToken:
|
|
74
|
-
userId:
|
|
77
|
+
getAccessToken: P,
|
|
78
|
+
getWorkspaceToken: F,
|
|
79
|
+
userId: I,
|
|
80
|
+
preview: L
|
|
75
81
|
};
|
|
76
82
|
});
|
|
77
|
-
let [
|
|
78
|
-
|
|
79
|
-
let e =
|
|
83
|
+
let [z, B] = E({}), V = T({}), H = T(/* @__PURE__ */ new Map()), U = T(/* @__PURE__ */ new Map()), W = T(/* @__PURE__ */ new Set()), G = T(/* @__PURE__ */ new Map()), K = T(/* @__PURE__ */ new Set()), q = T(null), J = T(/* @__PURE__ */ new Set()), Y = T(/* @__PURE__ */ new Map()), X = T(/* @__PURE__ */ new Set()), [Z, ee] = E(() => /* @__PURE__ */ new Set());
|
|
84
|
+
C(() => {
|
|
85
|
+
let e = K.current, n = t.subscribe((e, t) => {
|
|
86
|
+
e.activeConversationId !== t.activeConversationId && W.current.clear();
|
|
87
|
+
}), i = (e) => {
|
|
80
88
|
if (e.length === 0) return;
|
|
81
|
-
let
|
|
82
|
-
for (let
|
|
83
|
-
let e =
|
|
84
|
-
e &&
|
|
89
|
+
let n = { ...V.current };
|
|
90
|
+
for (let r of [...e].sort((e, t) => e.view.createdAt - t.view.createdAt)) {
|
|
91
|
+
let e = n[r.view.proposalId];
|
|
92
|
+
if (!(e && D.has(e.view.status) && !D.has(r.view.status)) && (n[r.view.proposalId] = r, H.current.has(r.view.proposalId) || H.current.set(r.view.proposalId, U.current.get(`${O(r.session)}\u0000${r.session.conversationId}`) ?? u()), r.view.status === "succeeded" && !r.view.result?.errors?.length)) {
|
|
93
|
+
let n = H.current.get(r.view.proposalId);
|
|
94
|
+
if (!n || !d(n, u())) continue;
|
|
95
|
+
let i = t.getState(), a = i.conversations.find((e) => e.id === r.session.conversationId), s = a && (a.messages.find((e) => _(e.metadata).some((e) => e.proposalId === r.view.proposalId)) ?? M(a, r.session, null));
|
|
96
|
+
if (!s) continue;
|
|
97
|
+
if (i.activeConversationId === r.session.conversationId && R.current.preview?.onEvent) for (let e of p(r.view, r.session.conversationId, s.id, n)) W.current.has(e.action.id) || (W.current.add(e.action.id), f(R.current.preview, e));
|
|
98
|
+
if (!e || D.has(e.view.status)) continue;
|
|
99
|
+
i.addMessage(r.session.conversationId, {
|
|
100
|
+
id: A(),
|
|
101
|
+
role: "system",
|
|
102
|
+
content: R.current.tr("writeProposal.status.succeeded", "Done — {{summary}}", { summary: o(r.view.result?.summary || r.view.description.readbackPast, c(r.view)) }),
|
|
103
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
104
|
+
});
|
|
105
|
+
}
|
|
85
106
|
}
|
|
86
|
-
|
|
87
|
-
},
|
|
107
|
+
V.current = n, B(n);
|
|
108
|
+
}, s = (e, n, r) => {
|
|
88
109
|
let i = t.getState(), a = i.conversations.find((t) => t.id === e.conversationId);
|
|
89
110
|
if (!a) return;
|
|
90
|
-
let o =
|
|
111
|
+
let o = j(a), s = n.filter((e) => !o.has(e.proposalId) && (e.status === "pending" || e.status === "executing"));
|
|
91
112
|
if (s.length === 0) return;
|
|
92
|
-
let c =
|
|
93
|
-
c && i.mergeMessageMetadata(a.id, c.id, { writeProposalRefs: [...
|
|
113
|
+
let c = M(a, e, r);
|
|
114
|
+
c && i.mergeMessageMetadata(a.id, c.id, { writeProposalRefs: [..._(c.metadata), ...s.map((t) => ({
|
|
94
115
|
proposalId: t.proposalId,
|
|
95
116
|
sandboxId: e.sandboxId,
|
|
96
117
|
sessionId: e.sessionId
|
|
97
118
|
}))] });
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
119
|
+
}, l = h({
|
|
120
|
+
getWorkspaceId: a,
|
|
121
|
+
getAuthContext: () => k(R.current)
|
|
122
|
+
}), m = g({
|
|
123
|
+
client: {
|
|
124
|
+
...l,
|
|
125
|
+
list: (e, t) => {
|
|
126
|
+
let n = `${O(e)}\u0000${e.conversationId}`;
|
|
127
|
+
return U.current.has(n) || U.current.set(n, u()), l.list(e, t);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
103
130
|
capabilitiesOf: (e) => t.getState().sandboxWriteCapabilities[e],
|
|
104
|
-
actorOf: () =>
|
|
105
|
-
onList: (e, t,
|
|
106
|
-
let
|
|
131
|
+
actorOf: () => R.current.userId,
|
|
132
|
+
onList: (e, t, n) => {
|
|
133
|
+
let r = {
|
|
107
134
|
serverNow: t.serverNow,
|
|
108
135
|
arrivedAt: Date.now()
|
|
109
136
|
};
|
|
110
|
-
|
|
137
|
+
G.current.set(O(e), r), i(t.proposals.map((t) => ({
|
|
111
138
|
view: t,
|
|
112
|
-
...
|
|
139
|
+
...r,
|
|
113
140
|
session: e
|
|
114
|
-
}))),
|
|
141
|
+
}))), s(e, t.proposals, n.turnMessageId);
|
|
115
142
|
},
|
|
116
143
|
onView: (e, t) => {
|
|
117
|
-
let
|
|
118
|
-
|
|
144
|
+
let n = V.current[t.proposalId];
|
|
145
|
+
i([{
|
|
119
146
|
view: t,
|
|
120
|
-
...
|
|
121
|
-
serverNow:
|
|
122
|
-
arrivedAt:
|
|
147
|
+
...G.current.get(O(e)) ?? {
|
|
148
|
+
serverNow: n?.serverNow ?? NaN,
|
|
149
|
+
arrivedAt: n?.arrivedAt ?? NaN
|
|
123
150
|
},
|
|
124
151
|
session: e
|
|
125
152
|
}]);
|
|
126
153
|
},
|
|
127
154
|
onError: (e, n, i) => {
|
|
128
|
-
let a = r(n, i), { tr: o } =
|
|
155
|
+
let a = r(n, i), { tr: o } = R.current;
|
|
129
156
|
t.getState().addMessage(e.conversationId, {
|
|
130
|
-
id:
|
|
157
|
+
id: A(),
|
|
131
158
|
role: "system",
|
|
132
159
|
content: o(a.key, a.fallback),
|
|
133
160
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
134
161
|
});
|
|
135
162
|
}
|
|
136
163
|
});
|
|
137
|
-
|
|
138
|
-
let
|
|
164
|
+
q.current = m;
|
|
165
|
+
let v = Y.current;
|
|
139
166
|
return () => {
|
|
140
|
-
|
|
167
|
+
m.dispose(), n(), q.current === m && (q.current = null), e.clear(), v.clear();
|
|
141
168
|
};
|
|
142
|
-
}, []),
|
|
169
|
+
}, []), C(() => t.subscribe((e, t) => {
|
|
143
170
|
if (e.sandboxWriteCapabilities === t.sandboxWriteCapabilities) return;
|
|
144
|
-
let n =
|
|
171
|
+
let n = Y.current;
|
|
145
172
|
for (let [t, r] of [...n]) {
|
|
146
173
|
let i = e.sandboxWriteCapabilities[r.sandboxId];
|
|
147
|
-
i && (n.delete(t),
|
|
174
|
+
i && (n.delete(t), y(i) && (K.current.add(O(r)), q.current?.discover(r, "open")));
|
|
148
175
|
}
|
|
149
176
|
}), []);
|
|
150
|
-
let
|
|
151
|
-
let n =
|
|
177
|
+
let Q = (e, t) => {
|
|
178
|
+
let n = q.current;
|
|
152
179
|
if (!n) return;
|
|
153
|
-
let r =
|
|
154
|
-
for (let { session: e, proposalIds: a } of
|
|
180
|
+
let r = J.current, i = e.filter((e) => !r.has(e.view.proposalId));
|
|
181
|
+
for (let { session: e, proposalIds: a } of N(i).values()) {
|
|
155
182
|
for (let e of a) r.add(e);
|
|
156
183
|
n.declineAll(e, t, "system");
|
|
157
184
|
}
|
|
158
|
-
},
|
|
159
|
-
return
|
|
160
|
-
|
|
161
|
-
}),
|
|
185
|
+
}, $ = T(Q);
|
|
186
|
+
return C(() => {
|
|
187
|
+
$.current = Q;
|
|
188
|
+
}), C(() => t.subscribe((e, t) => {
|
|
162
189
|
if (e.conversations === t.conversations) return;
|
|
163
|
-
let n = new Set(e.conversations.map((e) => e.id)), r = Object.values(
|
|
164
|
-
r.length > 0 &&
|
|
190
|
+
let n = new Set(e.conversations.map((e) => e.id)), r = Object.values(V.current).filter((e) => !n.has(e.session.conversationId));
|
|
191
|
+
r.length > 0 && $.current(r, "conversation_closed");
|
|
165
192
|
}), []), {
|
|
166
|
-
panel:
|
|
193
|
+
panel: w(() => {
|
|
167
194
|
let e = (e) => t.getState().sandboxWriteCapabilities[e], r = (e) => {
|
|
168
|
-
let t =
|
|
195
|
+
let t = R.current;
|
|
169
196
|
if (t.productWriteApproval !== "proposal-v1") return;
|
|
170
|
-
let r =
|
|
197
|
+
let r = X.current;
|
|
171
198
|
if (r.has(e)) return;
|
|
172
199
|
let i = a();
|
|
173
|
-
i && (r.add(e), n(e, i,
|
|
200
|
+
i && (r.add(e), n(e, i, m, k(t)).finally(() => r.delete(e)));
|
|
174
201
|
};
|
|
175
202
|
return {
|
|
176
203
|
afterTurn: (e, t) => {
|
|
177
|
-
|
|
204
|
+
q.current?.discover(e, "turn", { turnMessageId: t });
|
|
178
205
|
},
|
|
179
206
|
openConversation: (n) => {
|
|
180
|
-
let i =
|
|
207
|
+
let i = q.current;
|
|
181
208
|
if (!i) return;
|
|
182
|
-
let a =
|
|
209
|
+
let a = Y.current;
|
|
183
210
|
for (let [e, t] of [...a]) t.conversationId !== n && a.delete(e);
|
|
184
211
|
let o = t.getState().conversations.find((e) => e.id === n);
|
|
185
|
-
if (o) for (let { session: t, issuing: n } of
|
|
212
|
+
if (o) for (let { session: t, issuing: n } of v(o)) {
|
|
186
213
|
let o = e(t.sandboxId);
|
|
187
|
-
if (
|
|
214
|
+
if (y(o)) {
|
|
188
215
|
i.discover(t, "open");
|
|
189
216
|
continue;
|
|
190
217
|
}
|
|
191
|
-
o || (a.set(`${
|
|
218
|
+
o || (a.set(`${O(t)}\u0000${t.conversationId}`, t), n && r(t.sandboxId));
|
|
192
219
|
}
|
|
193
220
|
},
|
|
194
221
|
ensureKnown: (t, n) => {
|
|
195
|
-
let r =
|
|
196
|
-
if (!r ||
|
|
197
|
-
let i =
|
|
198
|
-
|
|
222
|
+
let r = q.current;
|
|
223
|
+
if (!r || V.current[t.proposalId] || !y(e(t.sandboxId))) return;
|
|
224
|
+
let i = O(t);
|
|
225
|
+
K.current.has(i) || (K.current.add(i), r.discover({
|
|
199
226
|
sandboxId: t.sandboxId,
|
|
200
227
|
sessionId: t.sessionId,
|
|
201
228
|
conversationId: n
|
|
202
229
|
}, "mount"));
|
|
203
230
|
},
|
|
204
231
|
approve: async (e, t) => {
|
|
205
|
-
let n =
|
|
232
|
+
let n = V.current[e.proposalId], r = q.current;
|
|
206
233
|
!n || !r || await r.approve(n.session, e, t);
|
|
207
234
|
},
|
|
208
235
|
decline: async (e, t, n) => {
|
|
209
|
-
let r =
|
|
236
|
+
let r = V.current[e.proposalId], i = q.current;
|
|
210
237
|
!r || !i || await i.decline(r.session, e, t, "button", n);
|
|
211
238
|
},
|
|
212
239
|
presented: async (e, t) => {
|
|
213
|
-
let n =
|
|
240
|
+
let n = V.current[e.proposalId], r = q.current;
|
|
214
241
|
!n || !r || await r.presented(n.session, e, t);
|
|
215
242
|
},
|
|
216
|
-
entry: (e) =>
|
|
243
|
+
entry: (e) => V.current[e],
|
|
217
244
|
liveFor: (t) => {
|
|
218
|
-
let n =
|
|
219
|
-
return
|
|
245
|
+
let n = q.current;
|
|
246
|
+
return S(t ? Object.values(V.current).filter((e) => e.session.conversationId === t && !n?.isRetired(e.session.sandboxId)).map((t) => ({
|
|
220
247
|
status: t.view.status,
|
|
221
248
|
sandboxId: t.session.sandboxId,
|
|
222
|
-
offersConfirm:
|
|
249
|
+
offersConfirm: s(t.view, e(t.session.sandboxId)).offerConfirm
|
|
223
250
|
})) : []);
|
|
224
251
|
},
|
|
225
252
|
declineForReply: async (e, t, n) => {
|
|
226
|
-
let r =
|
|
253
|
+
let r = q.current;
|
|
227
254
|
if (!r) return;
|
|
228
255
|
let i = n;
|
|
229
|
-
await
|
|
256
|
+
await x([...N(Object.values(V.current).filter((t) => t.session.conversationId === e && !r.isRetired(t.session.sandboxId))).values()].map(({ session: e }) => r.declineAll(e, t, i, { report: !0 })), b);
|
|
230
257
|
},
|
|
231
258
|
withdraw: (e, t) => {
|
|
232
|
-
|
|
259
|
+
$.current(Object.values(V.current).filter((t) => t.session.conversationId === e), t);
|
|
233
260
|
},
|
|
234
261
|
retireSandbox: (e) => {
|
|
235
|
-
let t =
|
|
236
|
-
!t || t.isRetired(e) || (
|
|
262
|
+
let t = q.current;
|
|
263
|
+
!t || t.isRetired(e) || ($.current(Object.values(V.current).filter((t) => t.session.sandboxId === e), "sandbox_replaced"), t.retire(e), ee((t) => {
|
|
237
264
|
let n = new Set(t);
|
|
238
265
|
return n.add(e), n;
|
|
239
266
|
}));
|
|
240
267
|
}
|
|
241
268
|
};
|
|
242
269
|
}, []),
|
|
243
|
-
entries:
|
|
244
|
-
retiredSandboxes:
|
|
270
|
+
entries: z,
|
|
271
|
+
retiredSandboxes: Z
|
|
245
272
|
};
|
|
246
273
|
}
|
|
247
274
|
//#endregion
|
|
248
|
-
export {
|
|
275
|
+
export { P as useWriteProposals };
|