@burdenoff/fe-libs 2026.1028.3 → 2026.1028.5
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/appControls/grammar.d.ts +2 -0
- package/dist/shared/assistant/appControls/grammar.js +101 -93
- package/dist/shared/assistant/appControls/registry.d.ts +2 -0
- package/dist/shared/assistant/appControls/registry.js +20 -12
- package/dist/shared/assistant/commandCompletions.d.ts +9 -0
- package/dist/shared/assistant/commandCompletions.js +161 -0
- package/dist/shared/assistant/index.d.ts +3 -0
- package/dist/shared/assistant/localUiCommands.d.ts +16 -0
- package/dist/shared/assistant/localUiCommands.js +192 -105
- package/dist/shared/assistant/localeCommands/engine.d.ts +6 -0
- package/dist/shared/assistant/localeCommands/engine.js +212 -116
- package/dist/shared/assistant/turnTimeline.d.ts +18 -6
- package/dist/shared/assistant/turnTimeline.js +57 -39
- package/dist/shared/assistant/turnTimingReport.d.ts +10 -1
- package/dist/shared/assistant/turnTimingReport.js +19 -6
- package/dist/shared/assistant/ui/AssistantChatArea.js +1491 -1406
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +239 -237
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +8 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +142 -131
- package/dist/shared/assistant/ui/draftCommandCheck.d.ts +7 -0
- package/dist/shared/assistant/ui/draftCommandCheck.js +17 -0
- package/dist/shared/assistant/ui/useVoiceSession.js +218 -202
- package/dist/shared/assistant/uiActions/backStack.d.ts +1 -0
- package/dist/shared/assistant/uiActions/backStack.js +13 -5
- package/dist/shared/assistant/uiActions/deixis.d.ts +2 -0
- package/dist/shared/assistant/uiActions/deixis.js +12 -1
- package/dist/shared/assistant/uiActions/draftPathname.d.ts +13 -0
- package/dist/shared/assistant/uiActions/draftPathname.js +31 -0
- package/dist/shared/assistant/uiActions/recordNames.js +33 -30
- package/dist/shared/assistant/voice/handsfree/handsFreeController.d.ts +3 -0
- package/dist/shared/assistant/voice/handsfree/handsFreeController.js +5 -1
- package/dist/shared/assistant/voice/handsfree/useHandsFreeInterrupt.d.ts +1 -0
- package/dist/shared/assistant/voice/handsfree/useHandsFreeInterrupt.js +1 -0
- package/dist/shared/assistant/voice/useVoiceInput.d.ts +3 -1
- package/dist/shared/assistant/voice/useVoiceInput.js +49 -43
- package/dist/shared-assistant.js +329 -326
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { hasCommandCompletion as e } from "../commandCompletions.js";
|
|
2
|
+
import { effectiveManifest as t, isEnabled as n } from "./gate.js";
|
|
3
|
+
import { foldText as r, foldWords as i } from "./fold.js";
|
|
4
|
+
import { closedSlot as a, compileFrame as o, matchFrame as s } from "./frames.js";
|
|
5
|
+
import { buildPrep as c, isQuestionText as l, normaliseSaid as u } from "./normalise.js";
|
|
6
|
+
import { languageNameMap as d } from "./languageNames.js";
|
|
7
|
+
import { LOCALE_TABLES as f, activeCommandLocales as p } from "./active.js";
|
|
8
|
+
import { ENGLISH_COMMAND_ADDITIONS as m } from "./tables/en.js";
|
|
8
9
|
//#region src/shared/assistant/localeCommands/engine.ts
|
|
9
|
-
var
|
|
10
|
+
var h = {
|
|
10
11
|
maxLength: 80,
|
|
11
12
|
courtesy: {
|
|
12
13
|
prefix: [
|
|
@@ -33,38 +34,38 @@ var m = {
|
|
|
33
34
|
],
|
|
34
35
|
compound: []
|
|
35
36
|
};
|
|
36
|
-
function
|
|
37
|
-
let r = { p:
|
|
37
|
+
function g(e, t, n) {
|
|
38
|
+
let r = { p: a([[e.places, "place"]], n) };
|
|
38
39
|
if (t) {
|
|
39
|
-
let { pick: e, controls:
|
|
40
|
-
r.o =
|
|
40
|
+
let { pick: e, controls: i } = t;
|
|
41
|
+
r.o = a([...e.ordinals.map((e, t) => [e, t + 1]), [e.last, "last"]], n), r.n = a(e.numbers.map((e, t) => [e, t + 1]), n), r.d = a([[i.directions.asc, "asc"], [i.directions.desc, "desc"]], n);
|
|
41
42
|
}
|
|
42
43
|
return r;
|
|
43
44
|
}
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
-
let l =
|
|
45
|
+
var _ = /* @__PURE__ */ new Map();
|
|
46
|
+
function v(e, t, n, i, a, s) {
|
|
47
|
+
let l = _.get(s);
|
|
47
48
|
if (l) return l;
|
|
48
|
-
let u =
|
|
49
|
-
frame:
|
|
49
|
+
let u = g(t, e, a), d = (e) => e.map((e) => o(e, a, u)), f = (e) => e.map((e) => ({
|
|
50
|
+
frame: o(e.template, a, u),
|
|
50
51
|
weak: e.weak === !0
|
|
51
|
-
})), p = () => [], m = e?.controls,
|
|
52
|
-
fold:
|
|
53
|
-
zh:
|
|
54
|
-
prep:
|
|
52
|
+
})), p = () => [], m = e?.controls, h = {
|
|
53
|
+
fold: a,
|
|
54
|
+
zh: a === "zh",
|
|
55
|
+
prep: c(i, a),
|
|
55
56
|
closed: u,
|
|
56
57
|
goto: {
|
|
57
58
|
go: d(t.go),
|
|
58
59
|
open: d(t.open),
|
|
59
60
|
show: d(t.show)
|
|
60
61
|
},
|
|
61
|
-
ambiguous: new Set(t.ambiguous.map((e) =>
|
|
62
|
+
ambiguous: new Set(t.ambiguous.map((e) => x(r(e, a), a))),
|
|
62
63
|
there: d(e?.there ?? []),
|
|
63
64
|
back: d(e?.back ?? []),
|
|
64
65
|
pick: d(e?.pick.frames ?? []),
|
|
65
|
-
language: d(
|
|
66
|
+
language: d(n),
|
|
66
67
|
theme: (e?.theme ?? []).map((e) => ({
|
|
67
|
-
frame:
|
|
68
|
+
frame: o(e.template, a, u),
|
|
68
69
|
family: e.family,
|
|
69
70
|
invert: e.invert === !0,
|
|
70
71
|
saysTheme: e.saysTheme === !0
|
|
@@ -91,56 +92,56 @@ function _(e, t, r, i, o, c) {
|
|
|
91
92
|
searchClear: d(m?.searchClear ?? [])
|
|
92
93
|
}
|
|
93
94
|
};
|
|
94
|
-
return
|
|
95
|
-
}
|
|
96
|
-
function v(e) {
|
|
97
|
-
return _(e, e.goto, e.language, e, e.locale, `native:${e.locale}`);
|
|
95
|
+
return _.set(s, h), h;
|
|
98
96
|
}
|
|
99
97
|
function y(e) {
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
return v(e, e.goto, e.language, e, e.locale, `native:${e.locale}`);
|
|
99
|
+
}
|
|
100
|
+
function b(e) {
|
|
101
|
+
let t = e?.locale ?? "en", n = e ?? h;
|
|
102
|
+
return v(null, m.goto, m.language, {
|
|
102
103
|
...n,
|
|
103
104
|
polite: void 0
|
|
104
105
|
}, t, `english:${t}`);
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
+
function x(e, t) {
|
|
107
108
|
return t === "es" ? e.replace(/^(?:el|la|los|las|un|una|unos|unas) (?=\S)/, "") : t === "ar" ? e.replace(/^(?:لل|ال)(?=\S{2})/, "") : e;
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
-
let i = /* @__PURE__ */ new Map(), a = (e,
|
|
111
|
-
let a =
|
|
110
|
+
function S(e, t, n) {
|
|
111
|
+
let i = /* @__PURE__ */ new Map(), a = (e, n) => {
|
|
112
|
+
let a = x(r(e, t), t);
|
|
112
113
|
if (!a) return;
|
|
113
114
|
let o = i.get(a) ?? [];
|
|
114
|
-
o.some((e) => e.path ===
|
|
115
|
+
o.some((e) => e.path === n.path) || o.push(n), i.set(a, o);
|
|
115
116
|
};
|
|
116
117
|
for (let t of e) {
|
|
117
118
|
a(t.label, t), t.context && a(`${t.context} ${t.label}`, t);
|
|
118
|
-
for (let e of
|
|
119
|
+
for (let e of n?.(t.label) ?? []) a(e, t);
|
|
119
120
|
}
|
|
120
121
|
return i;
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
-
let i =
|
|
123
|
+
function C(e, t, n) {
|
|
124
|
+
let i = x(e, n), a = t.filter((e) => x(r(e.label, n), n) === i);
|
|
124
125
|
return a.length === 1 ? a[0] ?? null : null;
|
|
125
126
|
}
|
|
126
|
-
function
|
|
127
|
-
let n =
|
|
127
|
+
function w(e, t) {
|
|
128
|
+
let n = x(e, t.fold);
|
|
128
129
|
if (t.zh) return [...t.ambiguous].some((e) => n.endsWith(e));
|
|
129
130
|
let r = n.split(" "), i = r[r.length - 1] ?? "", a = r.slice(-2).join(" ");
|
|
130
131
|
return t.ambiguous.has(i) || t.ambiguous.has(a);
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function T(e, t, n) {
|
|
133
134
|
let i = /* @__PURE__ */ new Map(), a = "";
|
|
134
|
-
for (let
|
|
135
|
+
for (let o of [
|
|
135
136
|
"go",
|
|
136
137
|
"open",
|
|
137
138
|
"show"
|
|
138
|
-
]) for (let c of e.goto[
|
|
139
|
+
]) for (let c of e.goto[o]) for (let l of s(c, t)) {
|
|
139
140
|
let t = l.x;
|
|
140
141
|
if (!t) continue;
|
|
141
|
-
let
|
|
142
|
-
if (
|
|
143
|
-
for (let e of
|
|
142
|
+
let s = n.get(x(t, e.fold));
|
|
143
|
+
if (s && !(o === "open" && l.p === void 0 && (w(t, e) || s.some((t) => w(r(t.label, e.fold), e))))) {
|
|
144
|
+
for (let e of s) i.set(e.path, e);
|
|
144
145
|
a = t;
|
|
145
146
|
}
|
|
146
147
|
}
|
|
@@ -149,16 +150,16 @@ function w(e, t, r) {
|
|
|
149
150
|
query: a
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
|
-
function
|
|
153
|
-
for (let r of e.theme) if (!(n === "mode-only" && r.saysTheme) &&
|
|
153
|
+
function E(e, t, n) {
|
|
154
|
+
for (let r of e.theme) if (!(n === "mode-only" && r.saysTheme) && s(r.frame, t).length !== 0) return {
|
|
154
155
|
kind: "family",
|
|
155
156
|
family: r.invert ? r.family === "dark" ? "light" : "dark" : r.family
|
|
156
157
|
};
|
|
157
158
|
return null;
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
+
function D(e, t) {
|
|
160
161
|
let n = [];
|
|
161
|
-
for (let r of e.pick) for (let i of
|
|
162
|
+
for (let r of e.pick) for (let i of s(r, t)) {
|
|
162
163
|
let t = i.o ?? i.n, r = i.o === void 0 ? "n" : "o", a = t === void 0 ? void 0 : e.closed[r]?.get(t);
|
|
163
164
|
a === "last" ? n.push({ kind: "last" }) : typeof a == "number" && n.push({
|
|
164
165
|
kind: "ordinal",
|
|
@@ -168,15 +169,15 @@ function E(e, t) {
|
|
|
168
169
|
let [r] = n;
|
|
169
170
|
return r && n.every((e) => JSON.stringify(e) === JSON.stringify(r)) ? r : null;
|
|
170
171
|
}
|
|
171
|
-
var
|
|
172
|
-
function
|
|
173
|
-
let n = e.filter((e) =>
|
|
172
|
+
var O = (e, t) => e.some((e) => s(e, t).length > 0);
|
|
173
|
+
function k(e, t) {
|
|
174
|
+
let n = e.filter((e) => s(e.frame, t).length > 0);
|
|
174
175
|
return n.length === 0 ? null : { weak: n.every((e) => e.weak) };
|
|
175
176
|
}
|
|
176
|
-
var
|
|
177
|
-
function
|
|
177
|
+
var A = 60, j = 4;
|
|
178
|
+
function M(e, t, n) {
|
|
178
179
|
if (n.zh) return t;
|
|
179
|
-
let
|
|
180
|
+
let r = i(e, n.fold), a = r.flatMap((e, t) => e.folded.map((e) => ({
|
|
180
181
|
token: e,
|
|
181
182
|
owner: t
|
|
182
183
|
}))), o = t.split(" ");
|
|
@@ -184,15 +185,15 @@ function j(e, t, n) {
|
|
|
184
185
|
if (!o.every((t, n) => a[e + n]?.token === t)) continue;
|
|
185
186
|
let t = a[e]?.owner, n = a[e + o.length - 1]?.owner;
|
|
186
187
|
if (t === void 0 || n === void 0 || a.filter((e) => e.owner >= t && e.owner <= n).length !== o.length) break;
|
|
187
|
-
return
|
|
188
|
+
return r.slice(t, n + 1).map((e) => e.said).join(" ");
|
|
188
189
|
}
|
|
189
190
|
return t;
|
|
190
191
|
}
|
|
191
|
-
function
|
|
192
|
+
function N(e, t) {
|
|
192
193
|
let n = t === void 0 ? void 0 : e.closed.d?.get(t);
|
|
193
194
|
return n === "asc" || n === "desc" ? n : null;
|
|
194
195
|
}
|
|
195
|
-
function
|
|
196
|
+
function P(e, t, n, i, a, o) {
|
|
196
197
|
let { registered: c } = i;
|
|
197
198
|
if (e.prep.compound.some((n) => e.zh ? t.includes(n) : ` ${t} `.includes(` ${n} `))) return null;
|
|
198
199
|
let l = [], u = (e, t) => l.push({
|
|
@@ -200,7 +201,7 @@ function N(e, t, r, i, a, s) {
|
|
|
200
201
|
weak: t
|
|
201
202
|
}), { phrases: d } = e.controls, f = (e, n, r) => {
|
|
202
203
|
if (!n) return;
|
|
203
|
-
let i =
|
|
204
|
+
let i = k(d[e], t);
|
|
204
205
|
i && u(r, i.weak);
|
|
205
206
|
};
|
|
206
207
|
if (f("notifications", c["header.notifications"], { control: "header.notifications" }), f("help", c["header.help"], { control: "header.help" }), f("sidebarCollapse", c.sidebar, {
|
|
@@ -210,34 +211,34 @@ function N(e, t, r, i, a, s) {
|
|
|
210
211
|
control: "sidebar",
|
|
211
212
|
collapsed: !1
|
|
212
213
|
}), f("history", c["assistant.history"], { control: "assistant.history" }), f("transcript", c["assistant.transcript"], { control: "assistant.transcript" }), f("previewOpen", c["assistant.preview"], { control: "assistant.preview" }), f("previewClose", c["assistant.preview"], { control: "assistant.preview.close" }), f("newConversation", c["assistant.conversation.new"], { control: "assistant.conversation.new" }), c.language && e.language.length > 0) {
|
|
213
|
-
let
|
|
214
|
-
for (let
|
|
215
|
-
let t = i.lang,
|
|
216
|
-
|
|
214
|
+
let n = new Set(a.map((t) => x(r(t.label, e.fold), e.fold)));
|
|
215
|
+
for (let r of e.language) for (let i of s(r, t)) {
|
|
216
|
+
let t = i.lang, r = t === void 0 ? void 0 : o.get(t);
|
|
217
|
+
r && t !== void 0 && !n.has(x(t, e.fold)) && u({
|
|
217
218
|
control: "language",
|
|
218
|
-
code:
|
|
219
|
+
code: r
|
|
219
220
|
}, !1);
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
let p = i.page;
|
|
223
224
|
if (p) {
|
|
224
|
-
if (p.tabs.length > 0) for (let n of e.controls.tab) for (let r of
|
|
225
|
-
let t = r.x ?
|
|
225
|
+
if (p.tabs.length > 0) for (let n of e.controls.tab) for (let r of s(n, t)) {
|
|
226
|
+
let t = r.x ? C(r.x, p.tabs, e.fold) : null;
|
|
226
227
|
t && u({
|
|
227
228
|
control: "page.tab",
|
|
228
229
|
name: t.label
|
|
229
230
|
}, !1);
|
|
230
231
|
}
|
|
231
232
|
if (p.filters.length > 0) {
|
|
232
|
-
|
|
233
|
+
O(e.controls.filterClear, t) && u({
|
|
233
234
|
control: "page.filter.clear",
|
|
234
235
|
filter: null
|
|
235
236
|
}, !1);
|
|
236
|
-
for (let n of e.controls.filter) for (let r of
|
|
237
|
+
for (let n of e.controls.filter) for (let r of s(n, t)) {
|
|
237
238
|
if (!r.x) continue;
|
|
238
|
-
let t = p.filters.filter((t) =>
|
|
239
|
+
let t = p.filters.filter((t) => C(r.x, t.options, e.fold) !== null), [n] = t;
|
|
239
240
|
if (!n) continue;
|
|
240
|
-
let i =
|
|
241
|
+
let i = C(r.x, n.options, e.fold);
|
|
241
242
|
i && u({
|
|
242
243
|
control: "page.filter",
|
|
243
244
|
filter: t.length === 1 ? n.label : null,
|
|
@@ -246,16 +247,16 @@ function N(e, t, r, i, a, s) {
|
|
|
246
247
|
}
|
|
247
248
|
}
|
|
248
249
|
if (p.sorts.length > 0) {
|
|
249
|
-
for (let n of e.controls.sort) for (let r of
|
|
250
|
-
let t = r.x ?
|
|
250
|
+
for (let n of e.controls.sort) for (let r of s(n, t)) {
|
|
251
|
+
let t = r.x ? C(r.x, p.sorts, e.fold) : null;
|
|
251
252
|
t && u({
|
|
252
253
|
control: "page.sort",
|
|
253
254
|
field: t.label,
|
|
254
|
-
direction:
|
|
255
|
+
direction: N(e, r.d)
|
|
255
256
|
}, !1);
|
|
256
257
|
}
|
|
257
|
-
for (let n of e.controls.sortDirection) for (let r of
|
|
258
|
-
let t =
|
|
258
|
+
for (let n of e.controls.sortDirection) for (let r of s(n, t)) {
|
|
259
|
+
let t = N(e, r.d);
|
|
259
260
|
t && u({
|
|
260
261
|
control: "page.sort",
|
|
261
262
|
field: null,
|
|
@@ -264,69 +265,69 @@ function N(e, t, r, i, a, s) {
|
|
|
264
265
|
}
|
|
265
266
|
}
|
|
266
267
|
if (p.searchable) {
|
|
267
|
-
|
|
268
|
-
let
|
|
269
|
-
for (let
|
|
270
|
-
let t = i.q?.trim() ?? "",
|
|
271
|
-
!t || t.length >
|
|
268
|
+
O(e.controls.searchClear, t) && u({ control: "page.search.clear" }, !1);
|
|
269
|
+
let r = null, i = O(e.controls.searchVerbOnly, t);
|
|
270
|
+
for (let n of i ? [] : e.controls.search) for (let i of s(n, t)) {
|
|
271
|
+
let t = i.q?.trim() ?? "", n = e.zh ? 0 : t.split(" ").length;
|
|
272
|
+
!t || t.length > A || n > j || (r === null || t.length < r.length) && (r = t);
|
|
272
273
|
}
|
|
273
|
-
|
|
274
|
+
r !== null && u({
|
|
274
275
|
control: "page.search",
|
|
275
|
-
query:
|
|
276
|
+
query: M(n, r, e)
|
|
276
277
|
}, !1);
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
280
|
let m = l.filter((e) => !e.weak), h = m.length > 0 ? m : l, [g] = h;
|
|
280
281
|
return g && h.every((e) => JSON.stringify(e) === JSON.stringify(g)) ? g : null;
|
|
281
282
|
}
|
|
282
|
-
function
|
|
283
|
+
function F(e, t, n, r, i, a, o) {
|
|
283
284
|
let s = {};
|
|
284
285
|
if (i.enabled("theme")) {
|
|
285
|
-
let n =
|
|
286
|
+
let n = E(e, r, t.themeWords);
|
|
286
287
|
n && (s.theme = n);
|
|
287
288
|
}
|
|
288
|
-
if (i.enabled("back") && t.backRunnable &&
|
|
289
|
-
let t =
|
|
289
|
+
if (i.enabled("back") && t.backRunnable && O(e.back, r) && (s.back = !0), i.enabled("pick") && t.navigation) {
|
|
290
|
+
let t = D(e, r);
|
|
290
291
|
t && (s.pick = t);
|
|
291
292
|
}
|
|
292
|
-
if (i.enabled("there") && t.navigation &&
|
|
293
|
-
let t =
|
|
293
|
+
if (i.enabled("there") && t.navigation && O(e.there, r) && (s.there = !0), i.enabled("goto")) {
|
|
294
|
+
let t = T(e, r, o);
|
|
294
295
|
t && (s.goto = t);
|
|
295
296
|
}
|
|
296
297
|
if (t.controls && (i.enabled("controls") || i.enabled("language"))) {
|
|
297
|
-
let o =
|
|
298
|
+
let o = P(e, r, n, t.controls, t.destinations, a);
|
|
298
299
|
o && (o.request.control === "language" ? i.enabled("language") : i.enabled("controls")) && (s.control = o);
|
|
299
300
|
}
|
|
300
301
|
return s;
|
|
301
302
|
}
|
|
302
|
-
function
|
|
303
|
-
let r = e
|
|
304
|
-
ui:
|
|
305
|
-
input:
|
|
306
|
-
narrow:
|
|
303
|
+
function I(e) {
|
|
304
|
+
let r = t(e.manifest), i = p({
|
|
305
|
+
ui: e.uiLocale,
|
|
306
|
+
input: e.inputLocale,
|
|
307
|
+
narrow: e.commandLocales,
|
|
307
308
|
manifest: r
|
|
308
|
-
}), a = i.length > 0 &&
|
|
309
|
+
}), a = i.length > 0 && n(r, "en", "goto"), o = n(r, "en", "language");
|
|
309
310
|
if (i.length === 0 && !o) return [];
|
|
310
|
-
let s =
|
|
311
|
-
tables:
|
|
311
|
+
let s = l(e.said), c = i.map((e) => f[e]), m = e.controls?.languages ?? [], h = [], g = (e) => d({
|
|
312
|
+
tables: c,
|
|
312
313
|
appLanguages: m,
|
|
313
314
|
fold: e
|
|
314
315
|
});
|
|
315
|
-
for (let
|
|
316
|
-
let i =
|
|
316
|
+
for (let t of c) {
|
|
317
|
+
let i = y(t), a = u(e.said, i.prep, s);
|
|
317
318
|
if (a === null) continue;
|
|
318
|
-
let o =
|
|
319
|
+
let o = F(i, e, e.said, a, { enabled: (e) => n(r, t.locale, e) }, g(t.locale), S(e.destinations, t.locale, t.nameForms));
|
|
319
320
|
Object.keys(o).length > 0 && h.push({
|
|
320
|
-
source:
|
|
321
|
+
source: t.locale,
|
|
321
322
|
intents: o
|
|
322
323
|
});
|
|
323
324
|
}
|
|
324
325
|
if (!s && (a || o)) {
|
|
325
|
-
let
|
|
326
|
-
for (let
|
|
327
|
-
let
|
|
326
|
+
let t = i.length > 0 ? c : [null];
|
|
327
|
+
for (let n of t) {
|
|
328
|
+
let t = b(n), r = u(e.said, t.prep, !1);
|
|
328
329
|
if (r === null) continue;
|
|
329
|
-
let i =
|
|
330
|
+
let i = F(t, e, e.said, r, { enabled: (e) => e === "goto" ? a : e === "language" ? o : !1 }, g(t.fold), S(e.destinations, t.fold));
|
|
330
331
|
Object.keys(i).length > 0 && h.push({
|
|
331
332
|
source: "en",
|
|
332
333
|
intents: i
|
|
@@ -335,17 +336,112 @@ function F(n) {
|
|
|
335
336
|
}
|
|
336
337
|
return h;
|
|
337
338
|
}
|
|
338
|
-
function
|
|
339
|
-
let r = e
|
|
340
|
-
ui:
|
|
341
|
-
input:
|
|
342
|
-
narrow:
|
|
339
|
+
function L(e) {
|
|
340
|
+
let r = t(e.manifest), i = p({
|
|
341
|
+
ui: e.uiLocale,
|
|
342
|
+
input: e.inputLocale,
|
|
343
|
+
narrow: e.commandLocales,
|
|
343
344
|
manifest: r
|
|
344
|
-
}), a =
|
|
345
|
-
return i.some((
|
|
346
|
-
let i =
|
|
347
|
-
return s === null ? !1 :
|
|
345
|
+
}), a = l(e.said);
|
|
346
|
+
return i.some((t) => {
|
|
347
|
+
let i = f[t], o = y(i), s = u(e.said, o.prep, a);
|
|
348
|
+
return s === null ? !1 : n(r, t, "there") && O(o.there, s) || n(r, t, "pick") && D(o, s) !== null;
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
function R(i, a) {
|
|
352
|
+
let o = t(i.manifest), s = p({
|
|
353
|
+
ui: i.uiLocale,
|
|
354
|
+
input: i.inputLocale,
|
|
355
|
+
narrow: i.commandLocales,
|
|
356
|
+
manifest: o
|
|
357
|
+
}), c = s.map((e) => f[e]), m = c.map((e) => ({
|
|
358
|
+
compiled: y(e),
|
|
359
|
+
table: e,
|
|
360
|
+
enabled: (t) => n(o, e.locale, t)
|
|
361
|
+
}));
|
|
362
|
+
if (n(o, "en", "language") || s.length > 0 && n(o, "en", "goto")) for (let e of c.length ? c : [null]) m.push({
|
|
363
|
+
compiled: b(e),
|
|
364
|
+
table: e,
|
|
365
|
+
enabled: (e) => e === "language" ? n(o, "en", "language") : e === "goto" && s.length > 0 && n(o, "en", "goto")
|
|
348
366
|
});
|
|
367
|
+
for (let { compiled: t, table: n, enabled: o } of m) {
|
|
368
|
+
let s = [], f = (e, t) => {
|
|
369
|
+
e && s.push(...t);
|
|
370
|
+
};
|
|
371
|
+
f(o("theme"), t.theme.filter((e) => i.themeWords !== "mode-only" || !e.saysTheme).map((e) => e.frame)), f(o("back") && i.backRunnable, t.back), f(o("there") && i.navigation, t.there), f(o("pick") && i.navigation, t.pick), f(o("goto"), [
|
|
372
|
+
...t.goto.go,
|
|
373
|
+
...t.goto.open,
|
|
374
|
+
...t.goto.show
|
|
375
|
+
]);
|
|
376
|
+
let p = i.controls, m = p?.page;
|
|
377
|
+
if (p && (f(o("language") && p.registered.language, t.language), o("controls"))) {
|
|
378
|
+
let e = p.registered;
|
|
379
|
+
for (let [n, r] of [
|
|
380
|
+
["notifications", e["header.notifications"]],
|
|
381
|
+
["help", e["header.help"]],
|
|
382
|
+
["sidebarCollapse", e.sidebar],
|
|
383
|
+
["sidebarExpand", e.sidebar],
|
|
384
|
+
["history", e["assistant.history"]],
|
|
385
|
+
["transcript", e["assistant.transcript"]],
|
|
386
|
+
["previewOpen", e["assistant.preview"]],
|
|
387
|
+
["previewClose", e["assistant.preview"]],
|
|
388
|
+
["newConversation", e["assistant.conversation.new"]]
|
|
389
|
+
]) f(r, t.controls.phrases[n].map((e) => e.frame));
|
|
390
|
+
m && (f(m.tabs.length > 0, t.controls.tab), f(m.filters.length > 0, [...t.controls.filter, ...t.controls.filterClear]), f(m.sorts.length > 0, [...t.controls.sort, ...t.controls.sortDirection]), f(m.searchable, [...t.controls.search, ...t.controls.searchClear]));
|
|
391
|
+
}
|
|
392
|
+
let h = new Set(S(i.destinations, t.fold, n?.nameForms).keys());
|
|
393
|
+
for (let e of [
|
|
394
|
+
...i.destinations.map((e) => e.label),
|
|
395
|
+
...(m?.tabs ?? []).map((e) => e.label),
|
|
396
|
+
...(m?.sorts ?? []).map((e) => e.label),
|
|
397
|
+
...(m?.filters ?? []).flatMap((e) => e.options.map((e) => e.label))
|
|
398
|
+
]) h.add(r(e, t.fold));
|
|
399
|
+
for (let e of [...h]) {
|
|
400
|
+
if (t.fold === "es") for (let t of [
|
|
401
|
+
"el",
|
|
402
|
+
"la",
|
|
403
|
+
"los",
|
|
404
|
+
"las",
|
|
405
|
+
"un",
|
|
406
|
+
"una",
|
|
407
|
+
"unos",
|
|
408
|
+
"unas"
|
|
409
|
+
]) h.add(`${t} ${e}`);
|
|
410
|
+
t.fold === "ar" && (h.add(`ال${e}`), h.add(`لل${e}`));
|
|
411
|
+
}
|
|
412
|
+
let g = d({
|
|
413
|
+
tables: c,
|
|
414
|
+
appLanguages: p?.languages ?? [],
|
|
415
|
+
fold: t.fold
|
|
416
|
+
}), _ = (n) => s.some((r) => e(r.expressions[0], n, {
|
|
417
|
+
maxLength: t.prep.maxLength,
|
|
418
|
+
slots: {
|
|
419
|
+
x: [...h],
|
|
420
|
+
lang: [...g.keys()]
|
|
421
|
+
}
|
|
422
|
+
}, a)), v = r(i.said, t.fold), y = u(i.said, t.prep, l(i.said));
|
|
423
|
+
if (y !== null && _(y)) return !0;
|
|
424
|
+
let b = u(i.said, t.prep, !0);
|
|
425
|
+
if (b !== null && _(b)) return !0;
|
|
426
|
+
for (let e = 1; e < v.length; e += 1) {
|
|
427
|
+
if (!t.zh && v[e] !== " ") continue;
|
|
428
|
+
let n = v.slice(0, e), r = v.slice(e + +!t.zh);
|
|
429
|
+
if (n.startsWith(r) && a(`${n}${t.zh ? "" : " "}${n}`)) return !0;
|
|
430
|
+
}
|
|
431
|
+
if ([
|
|
432
|
+
...t.prep.prefix,
|
|
433
|
+
...t.prep.fillers,
|
|
434
|
+
...t.prep.polite?.prefix ?? []
|
|
435
|
+
].some((e) => e.startsWith(y ?? v)) && _("")) return !0;
|
|
436
|
+
let x = t.zh ? "" : " ";
|
|
437
|
+
for (let e of [...t.prep.suffix, ...t.prep.polite?.suffix ?? []]) for (let t = 1; t <= e.length; t += 1) {
|
|
438
|
+
let n = x + e.slice(0, t);
|
|
439
|
+
if (!v.endsWith(n)) continue;
|
|
440
|
+
let r = v.slice(0, -n.length);
|
|
441
|
+
if (r && a(r)) return !0;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return !1;
|
|
349
445
|
}
|
|
350
446
|
//#endregion
|
|
351
|
-
export {
|
|
447
|
+
export { y as compileNative, R as couldBeLocaleCommandPrefix, I as matchLocaleIntents, L as mayBeThereOrPick };
|
|
@@ -85,15 +85,15 @@
|
|
|
85
85
|
* window event: any script on the page can dispatch that event, so a listener
|
|
86
86
|
* on it can be fed invented timings. Only this module calls subscribers.
|
|
87
87
|
*/
|
|
88
|
-
export declare const TURN_MILESTONES: readonly ["speechEnded", "graceStarted", "graceEnded", "handedOver", "accepted", "cleared", "attemptStarted", "prewarmJoined", "bootAdopted", "provisionStarted", "createRequested", "sandboxRunning", "serviceReady", "runtimeReady", "promptSent", "lastQuietPoll", "streamOpen", "streamRemint", "firstDelta", "firstOutput", "firstText", "streamIdle", "answerDone", "complete", "speechQueued", "ttsStarted", "firstAudio", "audioEnded"];
|
|
88
|
+
export declare const TURN_MILESTONES: readonly ["speechEnded", "lastSpeechFrame", "recognizerSpeechEnded", "graceStarted", "graceEnded", "handedOver", "accepted", "cleared", "attemptStarted", "prewarmJoined", "bootAdopted", "provisionStarted", "createRequested", "sandboxRunning", "serviceReady", "runtimeReady", "promptSent", "lastQuietPoll", "streamOpen", "streamRemint", "firstDelta", "firstOutput", "firstText", "streamIdle", "answerDone", "complete", "speechQueued", "ttsStarted", "firstAudio", "audioEnded"];
|
|
89
89
|
export type TurnMilestone = (typeof TURN_MILESTONES)[number];
|
|
90
90
|
/**
|
|
91
91
|
* How the runtime was found:
|
|
92
92
|
* - `warm`: a remembered sandbox with a fresh readiness proof, session reused
|
|
93
93
|
* - `new-session`: that sandbox, but a new session
|
|
94
94
|
* - `preopened`: that sandbox, and a new session the first-keystroke warm had
|
|
95
|
-
* already opened (BOFF-8015). The
|
|
96
|
-
*
|
|
95
|
+
* already opened (BOFF-8015). The H2 collector gives it its own bounded
|
|
96
|
+
* class; older collectors count it as `warm`
|
|
97
97
|
* - `probed`: a RUNNING sandbox was reused only after a reachability probe
|
|
98
98
|
* - `adopted`: a boot was joined and waited out — the sandbox was listed
|
|
99
99
|
* PROVISIONING/PENDING, or its service answered "not up yet" during the
|
|
@@ -120,7 +120,7 @@ export type TurnRuntime = 'warm' | 'preopened' | 'new-session' | 'probed' | 'ado
|
|
|
120
120
|
*/
|
|
121
121
|
export type TurnTimelineOutcome = 'answered' | 'timedOut' | 'refused' | 'failed' | 'stopped';
|
|
122
122
|
export interface TurnDimensions {
|
|
123
|
-
channel: 'chat' | 'voice';
|
|
123
|
+
channel: 'chat' | 'voice' | 'listen';
|
|
124
124
|
mode: string;
|
|
125
125
|
product: string;
|
|
126
126
|
/** The reply language the turn asked for. */
|
|
@@ -170,6 +170,8 @@ export interface TurnAttempt extends TurnAttemptFacts {
|
|
|
170
170
|
}
|
|
171
171
|
export interface TurnTimeline extends TurnDimensions, TurnAttemptFacts {
|
|
172
172
|
turnId: string;
|
|
173
|
+
/** The selected preference, not the elapsed grace timer. */
|
|
174
|
+
selectedGraceMs?: number;
|
|
173
175
|
at: Partial<Record<TurnMilestone, number>>;
|
|
174
176
|
/** Earlier attempts of a retried turn, oldest first. */
|
|
175
177
|
attempts?: TurnAttempt[];
|
|
@@ -177,7 +179,7 @@ export interface TurnTimeline extends TurnDimensions, TurnAttemptFacts {
|
|
|
177
179
|
outcome?: TurnTimelineOutcome;
|
|
178
180
|
}
|
|
179
181
|
/** Marks a voice turn brings with it, taken before the panel has an id for it. */
|
|
180
|
-
export type VoiceTurnTiming = Partial<Record<'speechEnded' | 'graceStarted' | 'graceEnded' | 'handedOver', number>>;
|
|
182
|
+
export type VoiceTurnTiming = Partial<Record<'speechEnded' | 'lastSpeechFrame' | 'recognizerSpeechEnded' | 'graceStarted' | 'graceEnded' | 'handedOver' | 'selectedGraceMs', number>>;
|
|
181
183
|
/** Announced on `window` with a copy of the timeline each time it changes. */
|
|
182
184
|
export declare const TURN_TIMELINE_EVENT = "burdenoff:assistant-turn-timeline";
|
|
183
185
|
/** Receives a copy of a timeline each time it changes. */
|
|
@@ -204,7 +206,7 @@ export declare function beginTurn(turnId: string, dimensions: TurnDimensions, ca
|
|
|
204
206
|
/**
|
|
205
207
|
* Record a milestone. The FIRST time wins — the poll that first saw output is
|
|
206
208
|
* the one that counts, however many polls follow — and a turn that was never
|
|
207
|
-
* begun is ignored,
|
|
209
|
+
* begun is ignored, unclassified history cannot create a model-turn measurement.
|
|
208
210
|
*/
|
|
209
211
|
export declare function markTurn(turnId: string, milestone: TurnMilestone, at?: number): void;
|
|
210
212
|
/** Facts about the turn learnt along the way. The first answer to each stands. */
|
|
@@ -371,3 +373,13 @@ export declare function isComparableTurn(timeline: TurnTimeline): boolean;
|
|
|
371
373
|
* cold, tool / no tool, language, device, channel, or any combination.
|
|
372
374
|
*/
|
|
373
375
|
export declare function summariseTurnTimelines(timelines: readonly TurnTimeline[], groupOf: (timeline: TurnTimeline) => string, include?: (timeline: TurnTimeline) => boolean): Record<string, Partial<Record<TurnSegmentName, SegmentStats>>>;
|
|
376
|
+
/**
|
|
377
|
+
* Measure a manual Listen request through the existing timeline/report path.
|
|
378
|
+
* Only a confirmed useful answer in this page can seed it; notices, previews
|
|
379
|
+
* and unclassified history never become useful-audio samples. The new clock
|
|
380
|
+
* starts when playback is committed, not at the original model request (which
|
|
381
|
+
* may have finished hours ago). No message id is sent by the reporter.
|
|
382
|
+
*/
|
|
383
|
+
export declare function beginListenTurn(messageId: string, at?: number): string | undefined;
|
|
384
|
+
/** Finish a Listen startup once. Audio is marked only by the engine's onStart. */
|
|
385
|
+
export declare function finishListenTurn(id: string | undefined, outcome: 'answered' | 'failed' | 'stopped', at?: number): void;
|