@burdenoff/fe-libs 2026.1007.5 → 2026.1008.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/api.d.ts +11 -0
- package/dist/shared/assistant/api.d.ts.map +1 -1
- package/dist/shared/assistant/api.js +6 -2
- package/dist/shared/assistant/attachmentCommit.d.ts +175 -0
- package/dist/shared/assistant/attachmentCommit.d.ts.map +1 -0
- package/dist/shared/assistant/attachmentCommit.js +638 -0
- package/dist/shared/assistant/attachments.d.ts +39 -19
- package/dist/shared/assistant/attachments.d.ts.map +1 -1
- package/dist/shared/assistant/conversation.d.ts +14 -0
- package/dist/shared/assistant/conversation.d.ts.map +1 -1
- package/dist/shared/assistant/createSandboxAssistantTransport.d.ts +8 -1
- package/dist/shared/assistant/createSandboxAssistantTransport.d.ts.map +1 -1
- package/dist/shared/assistant/createSandboxAssistantTransport.js +70 -51
- package/dist/shared/assistant/history/historyEngine.js +280 -280
- package/dist/shared/assistant/history/historyMapping.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyMapping.js +19 -12
- package/dist/shared/assistant/i18nManifest.d.ts +23 -2
- package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.js +26 -3
- package/dist/shared/assistant/index.d.ts +9 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/localUiCommandCopy.d.ts +23 -0
- package/dist/shared/assistant/localUiCommandCopy.d.ts.map +1 -1
- package/dist/shared/assistant/localUiCommandCopy.js +60 -23
- package/dist/shared/assistant/localUiCommands.d.ts +29 -0
- package/dist/shared/assistant/localUiCommands.d.ts.map +1 -1
- package/dist/shared/assistant/localUiCommands.js +18 -7
- package/dist/shared/assistant/types.d.ts +19 -8
- package/dist/shared/assistant/types.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +1624 -1266
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +18 -3
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.js +1 -1
- package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +5 -0
- package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageItem.js +89 -84
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts +5 -0
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageList.js +26 -25
- package/dist/shared/assistant/ui/AssistantUiOfferLink.d.ts +45 -0
- package/dist/shared/assistant/ui/AssistantUiOfferLink.d.ts.map +1 -0
- package/dist/shared/assistant/ui/AssistantUiOfferLink.js +56 -0
- package/dist/shared/assistant/ui/assistantOverlayState.d.ts +9 -0
- package/dist/shared/assistant/ui/assistantOverlayState.d.ts.map +1 -1
- package/dist/shared/assistant/ui/assistantOverlayState.js +37 -28
- package/dist/shared/assistant/ui/composer/AssistantAttachmentChips.d.ts +8 -5
- package/dist/shared/assistant/ui/composer/AssistantAttachmentChips.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantAttachmentChips.js +26 -9
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +3 -2
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +214 -125
- package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.js +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +15 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +127 -118
- package/dist/shared/assistant/ui/voice/VoiceConversationView.d.ts +6 -1
- package/dist/shared/assistant/ui/voice/VoiceConversationView.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceConversationView.js +7 -7
- package/dist/shared/assistant/ui/voice/VoiceTranscriptDrawer.d.ts +6 -1
- package/dist/shared/assistant/ui/voice/VoiceTranscriptDrawer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceTranscriptDrawer.js +15 -12
- package/dist/shared/assistant/uiActions/actOnResolve.d.ts +108 -0
- package/dist/shared/assistant/uiActions/actOnResolve.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/actOnResolve.js +51 -0
- package/dist/shared/assistant/uiActions/linkContext.d.ts +29 -0
- package/dist/shared/assistant/uiActions/linkContext.d.ts.map +1 -1
- package/dist/shared/assistant/uiActions/linkContext.js +37 -10
- package/dist/shared/assistant/uiActions/navIntent.d.ts +58 -0
- package/dist/shared/assistant/uiActions/navIntent.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/navIntent.js +79 -0
- package/dist/shared/assistant/uiActions/navigateAction.d.ts +6 -1
- package/dist/shared/assistant/uiActions/navigateAction.d.ts.map +1 -1
- package/dist/shared/assistant/uiActions/navigateAction.js +18 -14
- package/dist/shared/assistant/uiActions/navigationOutcome.d.ts +16 -2
- package/dist/shared/assistant/uiActions/navigationOutcome.d.ts.map +1 -1
- package/dist/shared/assistant/uiActions/navigationOutcome.js +6 -2
- package/dist/shared/assistant/uiActions/offerYesOnSurface.d.ts +39 -0
- package/dist/shared/assistant/uiActions/offerYesOnSurface.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/offerYesOnSurface.js +34 -0
- package/dist/shared/assistant/uiActions/uiCatalogue.d.ts +14 -0
- package/dist/shared/assistant/uiActions/uiCatalogue.d.ts.map +1 -1
- package/dist/shared/assistant/uiActions/uiCatalogue.js +23 -3
- package/dist/shared/assistant/uiActions/uiOffers.d.ts +249 -0
- package/dist/shared/assistant/uiActions/uiOffers.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/uiOffers.js +195 -0
- package/dist/shared/assistant/useAssistantAttachments.d.ts +20 -2
- package/dist/shared/assistant/useAssistantAttachments.d.ts.map +1 -1
- package/dist/shared/assistant/useAssistantAttachments.js +146 -202
- package/dist/shared/assistant/useAttachmentCommitter.d.ts +17 -0
- package/dist/shared/assistant/useAttachmentCommitter.d.ts.map +1 -0
- package/dist/shared/assistant/useAttachmentCommitter.js +41 -0
- package/dist/shared/assistant/voiceCommit.d.ts +36 -0
- package/dist/shared/assistant/voiceCommit.d.ts.map +1 -0
- package/dist/shared/assistant/voiceCommit.js +24 -0
- package/dist/shared/assistant/writeProposals.d.ts +6 -0
- package/dist/shared/assistant/writeProposals.d.ts.map +1 -1
- package/dist/shared/assistant/writeReplyBinder.d.ts +40 -0
- package/dist/shared/assistant/writeReplyBinder.d.ts.map +1 -1
- package/dist/shared/assistant/writeReplyBinder.js +100 -83
- package/dist/shared/assistant/writeReplySend.d.ts +14 -0
- package/dist/shared/assistant/writeReplySend.d.ts.map +1 -1
- package/dist/shared/assistant/writeReplySend.js +32 -29
- package/dist/shared/hooks/index.d.ts +2 -0
- package/dist/shared/hooks/index.d.ts.map +1 -1
- package/dist/shared/navigation/unsavedChanges.d.ts +83 -0
- package/dist/shared/navigation/unsavedChanges.d.ts.map +1 -0
- package/dist/shared/navigation/unsavedChanges.js +46 -0
- package/dist/shared-assistant.js +247 -238
- package/dist/shared-hooks.js +10 -9
- package/dist/shared.js +20 -19
- package/dist/storage/filesPort.d.ts +111 -0
- package/dist/storage/filesPort.d.ts.map +1 -0
- package/dist/storage/filesPort.js +262 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +9 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeReplyBinder.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/writeReplyBinder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG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er.expired",
|
|
21
|
+
fallback: "That suggestion has expired. Ask again, or use the menu."
|
|
22
|
+
}), n = [
|
|
20
23
|
"yes",
|
|
21
24
|
"yeah",
|
|
22
25
|
"yep",
|
|
@@ -32,7 +35,7 @@ var e = Object.freeze({
|
|
|
32
35
|
"yes please",
|
|
33
36
|
"sounds good",
|
|
34
37
|
"thats right"
|
|
35
|
-
],
|
|
38
|
+
], r = [
|
|
36
39
|
"no",
|
|
37
40
|
"nope",
|
|
38
41
|
"nah",
|
|
@@ -46,25 +49,25 @@ var e = Object.freeze({
|
|
|
46
49
|
"forget it",
|
|
47
50
|
"wait",
|
|
48
51
|
"hold on"
|
|
49
|
-
],
|
|
52
|
+
], i = [
|
|
50
53
|
"please",
|
|
51
54
|
"thanks",
|
|
52
55
|
"thank you"
|
|
53
|
-
],
|
|
54
|
-
affirm: Object.freeze([...
|
|
55
|
-
negative: Object.freeze([...
|
|
56
|
-
courtesy: Object.freeze([...
|
|
57
|
-
maxAffirmTokens:
|
|
58
|
-
}),
|
|
59
|
-
...t,
|
|
56
|
+
], a = 4, o = Object.freeze({
|
|
57
|
+
affirm: Object.freeze([...n]),
|
|
58
|
+
negative: Object.freeze([...r]),
|
|
59
|
+
courtesy: Object.freeze([...i]),
|
|
60
|
+
maxAffirmTokens: a
|
|
61
|
+
}), s = new Set(n), c = new Set(r), l = new Set(i), u = new Set([...r, ...i]), d = Math.max(...[
|
|
60
62
|
...n,
|
|
61
|
-
...r
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
...r,
|
|
64
|
+
...i
|
|
65
|
+
].map((e) => e.split(" ").length)), f = /[\p{L}\p{N}]+(?:['‘’ʼ`][\p{L}\p{N}]+)*/gu, p = /['‘’ʼ`]/g, m = /[,;:.!?…–—\n]|(?:^|\s)-+(?:\s|$)/u, h = /^[\s,;:.!?…–—-]+/u;
|
|
66
|
+
function g(e) {
|
|
67
|
+
let t = [...e.matchAll(f)].map((e) => {
|
|
65
68
|
let t = e.index ?? 0;
|
|
66
69
|
return {
|
|
67
|
-
word: e[0].toLowerCase().replace(
|
|
70
|
+
word: e[0].toLowerCase().replace(p, ""),
|
|
68
71
|
start: t,
|
|
69
72
|
end: t + e[0].length
|
|
70
73
|
};
|
|
@@ -73,128 +76,142 @@ function h(e) {
|
|
|
73
76
|
let i = t[r + 1];
|
|
74
77
|
return {
|
|
75
78
|
...n,
|
|
76
|
-
closesClause: i === void 0 ||
|
|
79
|
+
closesClause: i === void 0 || m.test(e.slice(n.end, i.start))
|
|
77
80
|
};
|
|
78
81
|
});
|
|
79
82
|
}
|
|
80
|
-
function
|
|
81
|
-
for (let i = Math.min(
|
|
83
|
+
function _(e, t, n, r) {
|
|
84
|
+
for (let i = Math.min(d, n - t); i > 0; i--) if (r.has(e.slice(t, t + i).join(" "))) return i;
|
|
82
85
|
return 0;
|
|
83
86
|
}
|
|
84
|
-
function
|
|
85
|
-
for (let i = Math.min(
|
|
87
|
+
function v(e, t, n, r) {
|
|
88
|
+
for (let i = Math.min(d, n - t); i > 0; i--) if (r.has(e.slice(n - i, n).join(" "))) return i;
|
|
86
89
|
return 0;
|
|
87
90
|
}
|
|
88
|
-
function
|
|
89
|
-
if (n <= t || n - t >
|
|
91
|
+
function y(e, t, n) {
|
|
92
|
+
if (n <= t || n - t > a) return !1;
|
|
90
93
|
for (let r = t; r < n;) {
|
|
91
|
-
let t =
|
|
94
|
+
let t = _(e, r, n, s);
|
|
92
95
|
if (t === 0) return !1;
|
|
93
96
|
r += t;
|
|
94
97
|
}
|
|
95
98
|
return !0;
|
|
96
99
|
}
|
|
97
|
-
|
|
100
|
+
var b = /[?¿؟?]/u;
|
|
101
|
+
function x(e) {
|
|
102
|
+
return typeof e != "string" || b.test(e);
|
|
103
|
+
}
|
|
104
|
+
function S(e) {
|
|
98
105
|
return typeof e == "string" && /^en(?:[-_][A-Za-z0-9]{1,8})*$/i.test(e.trim());
|
|
99
106
|
}
|
|
100
|
-
var
|
|
107
|
+
var C = (e, t = null) => ({
|
|
101
108
|
cls: e,
|
|
102
109
|
remainder: t
|
|
103
110
|
});
|
|
104
|
-
function
|
|
105
|
-
if (typeof e != "string" || !
|
|
106
|
-
let n = e.normalize("NFKC"), r =
|
|
111
|
+
function w(e, t) {
|
|
112
|
+
if (typeof e != "string" || !S(t)) return C("other");
|
|
113
|
+
let n = e.normalize("NFKC"), r = g(n), i = r.map((e) => e.word), a = i.length;
|
|
107
114
|
for (;;) {
|
|
108
|
-
let e =
|
|
115
|
+
let e = v(i, 0, a, l);
|
|
109
116
|
if (e === 0 || e >= a) break;
|
|
110
117
|
a -= e;
|
|
111
118
|
}
|
|
112
|
-
let
|
|
113
|
-
if (
|
|
114
|
-
let d =
|
|
119
|
+
let o = +(i[0] === "please" && a > 1);
|
|
120
|
+
if (y(i, 0, a) || y(i, o, a)) return C("affirm");
|
|
121
|
+
let d = _(i, o, a, c);
|
|
115
122
|
if (d > 0) {
|
|
116
|
-
let e =
|
|
123
|
+
let e = o + d - 1, t = o + d;
|
|
117
124
|
for (; t < a;) {
|
|
118
|
-
let n =
|
|
125
|
+
let n = _(i, t, a, u);
|
|
119
126
|
if (n === 0) break;
|
|
120
127
|
let o = r[t + n - 1];
|
|
121
128
|
if (t + n < a && !o.closesClause) break;
|
|
122
129
|
e = t + n - 1, t += n;
|
|
123
130
|
}
|
|
124
|
-
if (t >= a || !r[e].closesClause ||
|
|
125
|
-
let
|
|
126
|
-
return
|
|
131
|
+
if (t >= a || !r[e].closesClause || y(i, t, a)) return C("decline");
|
|
132
|
+
let s = n.slice(r[e].end).replace(h, "").trim();
|
|
133
|
+
return s ? C("decline_redirect", s) : C("decline");
|
|
127
134
|
}
|
|
128
|
-
return
|
|
135
|
+
return _(i, o, a, s) > 0 || _(i, 0, a, s) > 0 ? C("affirm_with_change") : C("other");
|
|
129
136
|
}
|
|
130
|
-
function
|
|
131
|
-
return
|
|
137
|
+
function T(e, t) {
|
|
138
|
+
return w(e, t).cls;
|
|
132
139
|
}
|
|
133
|
-
var
|
|
134
|
-
function
|
|
135
|
-
return
|
|
140
|
+
var E = new Set(["typed", "spoken"]);
|
|
141
|
+
function D(e) {
|
|
142
|
+
return E.has(e);
|
|
136
143
|
}
|
|
137
|
-
function
|
|
144
|
+
function O(e) {
|
|
138
145
|
return e === "affirm" ? "affirm" : e === "decline" || e === "decline_redirect" ? "decline" : "other";
|
|
139
146
|
}
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
let { cls:
|
|
143
|
-
if (!
|
|
147
|
+
var k = () => ({ from: "utterance" });
|
|
148
|
+
function A(n) {
|
|
149
|
+
let { cls: r, origin: i, localUiMatch: a } = n;
|
|
150
|
+
if (!D(i)) return {
|
|
144
151
|
action: "forward",
|
|
145
|
-
text:
|
|
152
|
+
text: k(),
|
|
146
153
|
declineAll: null,
|
|
147
154
|
writeReply: null,
|
|
148
155
|
voiceLine: null
|
|
149
156
|
};
|
|
150
|
-
let
|
|
151
|
-
kind:
|
|
152
|
-
origin:
|
|
153
|
-
};
|
|
154
|
-
if (a === 0) return n === "affirm" ? {
|
|
155
|
-
action: "forward",
|
|
156
|
-
text: E(),
|
|
157
|
-
declineAll: null,
|
|
158
|
-
writeReply: o,
|
|
159
|
-
voiceLine: null
|
|
160
|
-
} : {
|
|
161
|
-
action: "normal",
|
|
162
|
-
writeReply: o
|
|
157
|
+
let o = Number.isFinite(n.liveCount) && n.liveCount > 0 ? Math.floor(n.liveCount) : 0, s = {
|
|
158
|
+
kind: O(r),
|
|
159
|
+
origin: i
|
|
163
160
|
};
|
|
164
|
-
|
|
161
|
+
if (o === 0) {
|
|
162
|
+
if (r === "affirm") {
|
|
163
|
+
let e = n.question === !1 ? n.offer : "none";
|
|
164
|
+
return e === "acceptable" ? { action: "accept_offer" } : e === "expired" ? {
|
|
165
|
+
action: "local_reply",
|
|
166
|
+
line: t,
|
|
167
|
+
values: { count: 0 }
|
|
168
|
+
} : {
|
|
169
|
+
action: "forward",
|
|
170
|
+
text: k(),
|
|
171
|
+
declineAll: null,
|
|
172
|
+
writeReply: s,
|
|
173
|
+
voiceLine: null
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
action: "normal",
|
|
178
|
+
writeReply: s
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
switch (r) {
|
|
165
182
|
case "affirm": return {
|
|
166
183
|
action: "local_reply",
|
|
167
|
-
line:
|
|
168
|
-
values: { count:
|
|
184
|
+
line: n.execution === "enabled" ? o === 1 ? e.useButton : e.whichOne : e.replyCannotRun,
|
|
185
|
+
values: { count: o }
|
|
169
186
|
};
|
|
170
187
|
case "affirm_with_change": return {
|
|
171
188
|
action: "forward",
|
|
172
|
-
text:
|
|
189
|
+
text: k(),
|
|
173
190
|
declineAll: "corrected",
|
|
174
|
-
writeReply:
|
|
191
|
+
writeReply: s,
|
|
175
192
|
voiceLine: null
|
|
176
193
|
};
|
|
177
194
|
case "decline": return {
|
|
178
195
|
action: "forward",
|
|
179
|
-
text:
|
|
196
|
+
text: k(),
|
|
180
197
|
declineAll: "user_declined",
|
|
181
|
-
writeReply:
|
|
198
|
+
writeReply: s,
|
|
182
199
|
voiceLine: e.cancelled
|
|
183
200
|
};
|
|
184
201
|
case "decline_redirect": {
|
|
185
|
-
let
|
|
186
|
-
if (!
|
|
202
|
+
let t = n.remainder?.trim() ?? "";
|
|
203
|
+
if (!t) return {
|
|
187
204
|
action: "forward",
|
|
188
|
-
text:
|
|
205
|
+
text: k(),
|
|
189
206
|
declineAll: "user_declined",
|
|
190
|
-
writeReply:
|
|
207
|
+
writeReply: s,
|
|
191
208
|
voiceLine: e.cancelled
|
|
192
209
|
};
|
|
193
210
|
let r = {
|
|
194
211
|
from: "remainder",
|
|
195
|
-
value:
|
|
212
|
+
value: t
|
|
196
213
|
};
|
|
197
|
-
return
|
|
214
|
+
return a ? {
|
|
198
215
|
action: "local",
|
|
199
216
|
text: r,
|
|
200
217
|
declineAll: "redirected"
|
|
@@ -202,32 +219,32 @@ function D(t) {
|
|
|
202
219
|
action: "forward",
|
|
203
220
|
text: r,
|
|
204
221
|
declineAll: "redirected",
|
|
205
|
-
writeReply:
|
|
222
|
+
writeReply: s,
|
|
206
223
|
voiceLine: null
|
|
207
224
|
};
|
|
208
225
|
}
|
|
209
|
-
case "other": return
|
|
226
|
+
case "other": return a ? {
|
|
210
227
|
action: "local",
|
|
211
|
-
text:
|
|
228
|
+
text: k(),
|
|
212
229
|
declineAll: null
|
|
213
230
|
} : {
|
|
214
231
|
action: "forward",
|
|
215
|
-
text:
|
|
232
|
+
text: k(),
|
|
216
233
|
declineAll: null,
|
|
217
|
-
writeReply:
|
|
234
|
+
writeReply: s,
|
|
218
235
|
voiceLine: null
|
|
219
236
|
};
|
|
220
237
|
default: return {
|
|
221
238
|
action: "forward",
|
|
222
|
-
text:
|
|
239
|
+
text: k(),
|
|
223
240
|
declineAll: null,
|
|
224
241
|
writeReply: {
|
|
225
242
|
kind: "other",
|
|
226
|
-
origin:
|
|
243
|
+
origin: i
|
|
227
244
|
},
|
|
228
245
|
voiceLine: null
|
|
229
246
|
};
|
|
230
247
|
}
|
|
231
248
|
}
|
|
232
249
|
//#endregion
|
|
233
|
-
export { e as WRITE_REPLY_COPY,
|
|
250
|
+
export { e as WRITE_REPLY_COPY, o as WRITE_REPLY_LEXICON, t as WRITE_REPLY_OFFER_EXPIRED, w as analyseWriteReply, T as classifyWriteReply, A as decideWriteReply, x as isQuestionReply, D as isUserOriginatedWriteReply };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WriteReplyDeclineReason, WriteReplyLine, WriteReplyTag } from './writeReplyBinder';
|
|
2
|
+
import { UiOfferYesState } from './uiActions/uiOffers';
|
|
2
3
|
import { SandboxWriteCapabilities, WriteExecutionState } from './writeProposals';
|
|
3
4
|
/** Where a person's own reply came from. */
|
|
4
5
|
export type WriteReplyPersonOrigin = "typed" | "spoken";
|
|
@@ -52,6 +53,14 @@ export type WriteReplyPlan =
|
|
|
52
53
|
kind: "send";
|
|
53
54
|
declineAll: WriteReplyDeclineReason | null;
|
|
54
55
|
bound: WriteReplyBound;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* ★ BOFF-8060 (N3): open the one page the model offered — re-validated and
|
|
59
|
+
* claimed by the caller, through a registered handler. Nothing is sent,
|
|
60
|
+
* nothing is declined; navigation only.
|
|
61
|
+
*/
|
|
62
|
+
| {
|
|
63
|
+
kind: "accept_offer";
|
|
55
64
|
};
|
|
56
65
|
export interface WriteReplyPlanInput {
|
|
57
66
|
/** What the person typed or said, as they said it. */
|
|
@@ -63,6 +72,11 @@ export interface WriteReplyPlanInput {
|
|
|
63
72
|
live: WriteReplyLiveState;
|
|
64
73
|
/** Does a local UI command match this text? (`matchLocalUiCommand`) */
|
|
65
74
|
matchesLocalCommand: (text: string) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* ★ BOFF-8060 (N3): `offerYesState` for the newest reply of the surface the
|
|
77
|
+
* reply came from. Absent: `none`.
|
|
78
|
+
*/
|
|
79
|
+
offer?: UiOfferYesState;
|
|
66
80
|
}
|
|
67
81
|
/**
|
|
68
82
|
* The plan for a person's reply. Pure: every effect is the caller's, and the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeReplySend.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/writeReplySend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"writeReplySend.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/writeReplySend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EACV,w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B,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAC/C;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,CAkFzE;AAED,mEAAmE;AACnE,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,sBAAsB,EAAE,GACtC,mBAAmB,CAQrB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC;AAOD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,OAAO,CAAC,OAAO,CAAC,EAAE,EACjC,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,gBAAiC,GACxC,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,CAelC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,wBAAwB,GAAG,IAAI,GAAG,SAAS,GACxD,QAAQ,GAAG,aAAa,CAK1B"}
|
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
import { analyseWriteReply as e, decideWriteReply as t } from "./writeReplyBinder.js";
|
|
1
|
+
import { analyseWriteReply as e, decideWriteReply as t, isQuestionReply as n } from "./writeReplyBinder.js";
|
|
2
2
|
//#region src/shared/assistant/writeReplySend.ts
|
|
3
|
-
function
|
|
4
|
-
let { text:
|
|
3
|
+
function r(r) {
|
|
4
|
+
let { text: i, origin: a } = r, o = r.hasAttachments ? {
|
|
5
5
|
cls: "other",
|
|
6
6
|
remainder: null
|
|
7
|
-
} : e(
|
|
8
|
-
cls:
|
|
9
|
-
liveCount:
|
|
10
|
-
origin:
|
|
11
|
-
localUiMatch:
|
|
12
|
-
remainder:
|
|
13
|
-
execution:
|
|
7
|
+
} : e(i, r.locale), s = o.cls === "decline_redirect" && o.remainder ? o.remainder : i, c = !r.hasAttachments && r.matchesLocalCommand(s), l = t({
|
|
8
|
+
cls: o.cls,
|
|
9
|
+
liveCount: r.live.count,
|
|
10
|
+
origin: a,
|
|
11
|
+
localUiMatch: c,
|
|
12
|
+
remainder: o.remainder,
|
|
13
|
+
execution: r.live.execution,
|
|
14
|
+
offer: r.offer ?? "none",
|
|
15
|
+
question: n(i)
|
|
14
16
|
});
|
|
15
|
-
switch (
|
|
17
|
+
switch (l.action) {
|
|
18
|
+
case "accept_offer": return { kind: "accept_offer" };
|
|
16
19
|
case "local_reply": return {
|
|
17
20
|
kind: "local_reply",
|
|
18
|
-
line:
|
|
19
|
-
values:
|
|
21
|
+
line: l.line,
|
|
22
|
+
values: l.values
|
|
20
23
|
};
|
|
21
24
|
case "normal": return {
|
|
22
25
|
kind: "send",
|
|
23
26
|
declineAll: null,
|
|
24
27
|
bound: {
|
|
25
|
-
writeReply:
|
|
26
|
-
promptText:
|
|
28
|
+
writeReply: l.writeReply,
|
|
29
|
+
promptText: i,
|
|
27
30
|
localCommands: !0
|
|
28
31
|
}
|
|
29
32
|
};
|
|
30
33
|
case "local": {
|
|
31
|
-
let e =
|
|
32
|
-
return
|
|
34
|
+
let e = l.text.from === "remainder" ? l.text.value : i;
|
|
35
|
+
return l.declineAll === null ? {
|
|
33
36
|
kind: "send",
|
|
34
37
|
declineAll: null,
|
|
35
38
|
bound: {
|
|
36
39
|
writeReply: {
|
|
37
40
|
kind: "other",
|
|
38
|
-
origin:
|
|
41
|
+
origin: a
|
|
39
42
|
},
|
|
40
|
-
promptText:
|
|
43
|
+
promptText: i,
|
|
41
44
|
localCommands: !0
|
|
42
45
|
}
|
|
43
46
|
} : {
|
|
44
47
|
kind: "local",
|
|
45
48
|
commandText: e,
|
|
46
|
-
declineAll:
|
|
49
|
+
declineAll: l.declineAll,
|
|
47
50
|
fallback: {
|
|
48
51
|
writeReply: {
|
|
49
52
|
kind: "decline",
|
|
50
|
-
origin:
|
|
53
|
+
origin: a
|
|
51
54
|
},
|
|
52
55
|
promptText: e,
|
|
53
56
|
localCommands: !1
|
|
@@ -56,27 +59,27 @@ function n(n) {
|
|
|
56
59
|
}
|
|
57
60
|
case "forward": return {
|
|
58
61
|
kind: "send",
|
|
59
|
-
declineAll:
|
|
62
|
+
declineAll: l.declineAll,
|
|
60
63
|
bound: {
|
|
61
|
-
writeReply:
|
|
62
|
-
promptText:
|
|
64
|
+
writeReply: l.writeReply,
|
|
65
|
+
promptText: l.text.from === "remainder" ? l.text.value : i,
|
|
63
66
|
localCommands: !1
|
|
64
67
|
}
|
|
65
68
|
};
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
|
-
function
|
|
71
|
+
function i(e) {
|
|
69
72
|
let t = e.filter((e) => e.status === "pending");
|
|
70
73
|
return {
|
|
71
74
|
count: t.length,
|
|
72
75
|
execution: t.some((e) => e.offersConfirm) ? "enabled" : "fenced"
|
|
73
76
|
};
|
|
74
77
|
}
|
|
75
|
-
var
|
|
78
|
+
var a = 8e3, o = {
|
|
76
79
|
set: (e, t) => setTimeout(e, t),
|
|
77
80
|
clear: (e) => clearTimeout(e)
|
|
78
81
|
};
|
|
79
|
-
function
|
|
82
|
+
function s(e, t, n = o) {
|
|
80
83
|
return new Promise((r) => {
|
|
81
84
|
let i = !1, a = n.set(() => {
|
|
82
85
|
i || (i = !0, r("timed_out"));
|
|
@@ -86,8 +89,8 @@ function o(e, t, n = a) {
|
|
|
86
89
|
});
|
|
87
90
|
});
|
|
88
91
|
}
|
|
89
|
-
function
|
|
92
|
+
function c(e) {
|
|
90
93
|
return e?.proposals === !0 && e.writeApprovalMode === "proposal-v1" ? "proposal-v1" : "legacy";
|
|
91
94
|
}
|
|
92
95
|
//#endregion
|
|
93
|
-
export {
|
|
96
|
+
export { a as WRITE_REPLY_DECLINE_WAIT_MS, r as planWriteReply, c as promptWriteApproval, s as settleWithin, i as writeReplyLiveState };
|
|
@@ -38,4 +38,6 @@ export type { UseQuotaErrorToastOptions, QuotaExhaustedEventDetail } from './use
|
|
|
38
38
|
export { useUpgradePrompt, publishPlanUsageSnapshot, PLAN_USAGE_SNAPSHOT_EVENT, } from './useUpgradePrompt';
|
|
39
39
|
export type { UseUpgradePromptOptions, UseUpgradePromptResult, PlanUsageEntry, PlanUsageSnapshot, } from './useUpgradePrompt';
|
|
40
40
|
export { useCurrentContextSearchParams, appendContextToPath, } from './useCurrentContextSearchParams';
|
|
41
|
+
export { useUnsavedChanges, listUnsavedChanges, registerUnsavedChange, unsavedChangesBlocking, UNSAVED_CHANGE_LABEL_MAX, } from '../navigation/unsavedChanges';
|
|
42
|
+
export type { UnsavedChange, UseUnsavedChangesOptions, NavigationInitiator, } from '../navigation/unsavedChanges';
|
|
41
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAc,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,oBAAoB,8CAA2D,CAAC;AAE7F;;GAEG;AACH,wBAAgB,uBAAuB,2BAMtC;AAOD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa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E,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAGjG,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ★ BOFF-8060 (N4, C9): the leave-page guard.
|
|
3
|
+
*
|
|
4
|
+
* A page that holds work the person has not saved — an editor with changes, a
|
|
5
|
+
* half-filled form — says so here, in its own words, for as long as it holds
|
|
6
|
+
* it. The assistant reads the list before it moves the person anywhere:
|
|
7
|
+
*
|
|
8
|
+
* - an assistant-initiated navigation (a typed or spoken "take me to…", "go
|
|
9
|
+
* back", "take me there", a "yes" to an offer, act-on-resolve) is REFUSED
|
|
10
|
+
* while anything is listed (`createAssistantNavigate`), and the panel says
|
|
11
|
+
* "You have unsaved changes in {label}. Save or discard them, then ask
|
|
12
|
+
* again." The draft is never lost to the assistant;
|
|
13
|
+
* - act-on-resolve's guard R5 passes only when the list is empty;
|
|
14
|
+
* - the person's own navigation (the sidebar, a link they click, an "Open
|
|
15
|
+
* {page}" link they tap) is not touched: it stays at sidebar parity.
|
|
16
|
+
*
|
|
17
|
+
* Page-scoped: an entry lives exactly as long as the component that registered
|
|
18
|
+
* it is mounted AND reports itself dirty. Unmounting (leaving the page) or
|
|
19
|
+
* going clean (saved, discarded) removes it. Nothing is persisted.
|
|
20
|
+
*
|
|
21
|
+
* ★★ One registry per page, not per copy of this module: a product microfe and
|
|
22
|
+
* the assistant overlay can end up with two copies of fe-libs in one bundle
|
|
23
|
+
* (a local-source plugin, a duplicate install), and a registry held in module
|
|
24
|
+
* scope would then leave the assistant reading an empty list while the editor
|
|
25
|
+
* wrote to the other one. The registry lives on `globalThis` under a
|
|
26
|
+
* registered symbol, so every copy reads and writes the same one.
|
|
27
|
+
*/
|
|
28
|
+
/** One unsaved change: where it is, in the product's own (translated) words. */
|
|
29
|
+
export interface UnsavedChange {
|
|
30
|
+
/** Stable id of what holds the change, e.g. `dashboard-editor`. */
|
|
31
|
+
id: string;
|
|
32
|
+
/** What the person calls it, e.g. "the dashboard editor". Shown in the reply. */
|
|
33
|
+
label: string;
|
|
34
|
+
}
|
|
35
|
+
export interface UseUnsavedChangesOptions {
|
|
36
|
+
/** Stable id of what holds the change. Two registrations with one id are listed once. */
|
|
37
|
+
id: string;
|
|
38
|
+
/** What the person calls it, translated by the product. */
|
|
39
|
+
label: string;
|
|
40
|
+
/** Does it hold unsaved changes right now? */
|
|
41
|
+
dirty: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** Longest label kept: it is quoted in a one-line reply. */
|
|
44
|
+
export declare const UNSAVED_CHANGE_LABEL_MAX = 80;
|
|
45
|
+
/**
|
|
46
|
+
* Register one unsaved change. Returns the function that removes it; call it
|
|
47
|
+
* when the change is saved or discarded, or when its holder goes away.
|
|
48
|
+
*
|
|
49
|
+
* ★ A registration is never dropped for a poor label: an empty label still
|
|
50
|
+
* counts as unsaved (the reply then names "this page"). Losing a guard over a
|
|
51
|
+
* missing word would be the expensive mistake.
|
|
52
|
+
*/
|
|
53
|
+
export declare function registerUnsavedChange(change: UnsavedChange): () => void;
|
|
54
|
+
/**
|
|
55
|
+
* The unsaved changes on the page right now, oldest registration first, one
|
|
56
|
+
* per id. Empty when nothing is unsaved.
|
|
57
|
+
*/
|
|
58
|
+
export declare function listUnsavedChanges(): UnsavedChange[];
|
|
59
|
+
/**
|
|
60
|
+
* Report a page's unsaved changes for as long as `dirty` is true and the
|
|
61
|
+
* calling component is mounted.
|
|
62
|
+
*
|
|
63
|
+
* ```tsx
|
|
64
|
+
* useUnsavedChanges({
|
|
65
|
+
* id: "dashboard-editor",
|
|
66
|
+
* label: t("dashboards.editor.unsavedLabel", "the dashboard editor"),
|
|
67
|
+
* dirty: hasChanges,
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function useUnsavedChanges({ id, label, dirty }: UseUnsavedChangesOptions): void;
|
|
72
|
+
/** Who started a navigation: the person (a link, the sidebar) or the assistant. */
|
|
73
|
+
export type NavigationInitiator = "person" | "assistant";
|
|
74
|
+
/**
|
|
75
|
+
* Should a navigation be refused for unsaved changes? Only one the ASSISTANT
|
|
76
|
+
* started, and only while something is unsaved; the person's own navigation
|
|
77
|
+
* never is. Returns the changes to name in the refusal, or null to go ahead.
|
|
78
|
+
*
|
|
79
|
+
* ★ Anything but an explicit `"person"` counts as the assistant's, so a caller
|
|
80
|
+
* that forgets to say is guarded rather than let through.
|
|
81
|
+
*/
|
|
82
|
+
export declare function unsavedChangesBlocking(initiator: NavigationInitiator | undefined): UnsavedChange[] | null;
|
|
83
|
+
//# sourceMappingURL=unsavedChanges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsavedChanges.d.ts","sourceRoot":"","sources":["../../../src/shared/navigation/unsavedChanges.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,yFAAyF;IACzF,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,4DAA4D;AAC5D,eAAO,MAAM,wBAAwB,KAAK,CAAC;AA6B3C;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,IAAI,CAMvE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,aAAa,EAAE,CASpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,wBAAwB,GAAG,IAAI,CAKtF;AAED,mFAAmF;AACnF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEzD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,mBAAmB,GAAG,SAAS,GACzC,aAAa,EAAE,GAAG,IAAI,CAIxB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useEffect as e } from "react";
|
|
2
|
+
//#region src/shared/navigation/unsavedChanges.ts
|
|
3
|
+
var t = 80, n = Symbol.for("burdenoff.fe-libs.unsavedChanges.v1");
|
|
4
|
+
function r() {
|
|
5
|
+
let e = globalThis, t = e[n];
|
|
6
|
+
if (t instanceof Map) return t;
|
|
7
|
+
let r = /* @__PURE__ */ new Map();
|
|
8
|
+
return e[n] = r, r;
|
|
9
|
+
}
|
|
10
|
+
function i(e) {
|
|
11
|
+
let t = e.replace(/\s+/g, " ").trim();
|
|
12
|
+
return t.length <= 80 ? t : `${t.slice(0, 79).trimEnd()}…`;
|
|
13
|
+
}
|
|
14
|
+
function a(e) {
|
|
15
|
+
let t = Symbol(e.id);
|
|
16
|
+
return r().set(t, {
|
|
17
|
+
id: e.id,
|
|
18
|
+
label: i(e.label)
|
|
19
|
+
}), () => {
|
|
20
|
+
r().delete(t);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function o() {
|
|
24
|
+
let e = /* @__PURE__ */ new Set(), t = [];
|
|
25
|
+
for (let n of r().values()) e.has(n.id) || (e.add(n.id), t.push({ ...n }));
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
function s({ id: t, label: n, dirty: r }) {
|
|
29
|
+
e(() => {
|
|
30
|
+
if (r) return a({
|
|
31
|
+
id: t,
|
|
32
|
+
label: n
|
|
33
|
+
});
|
|
34
|
+
}, [
|
|
35
|
+
t,
|
|
36
|
+
n,
|
|
37
|
+
r
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
function c(e) {
|
|
41
|
+
if (e === "person") return null;
|
|
42
|
+
let t = o();
|
|
43
|
+
return t.length > 0 ? t : null;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { t as UNSAVED_CHANGE_LABEL_MAX, o as listUnsavedChanges, a as registerUnsavedChange, c as unsavedChangesBlocking, s as useUnsavedChanges };
|