@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The panel may live outside a Router; observe paths without polling. */
|
|
2
|
+
type PathSource = Pick<EventTarget, 'addEventListener' | 'removeEventListener'> & {
|
|
3
|
+
location: Pick<Location, 'pathname'>;
|
|
4
|
+
history?: Pick<History, 'pushState' | 'replaceState'>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Only pathnames are compared. History arguments/state, query strings and
|
|
8
|
+
* hashes are passed through untouched and are never retained or emitted.
|
|
9
|
+
* Multiple panels share one observer; the last cleanup restores our wrappers
|
|
10
|
+
* only if another integration has not replaced them in the meantime.
|
|
11
|
+
*/
|
|
12
|
+
export declare function subscribeDraftPathname(source: PathSource, listener: () => void): () => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/shared/assistant/uiActions/draftPathname.ts
|
|
2
|
+
var e = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
let r = e.get(t);
|
|
5
|
+
if (!r) {
|
|
6
|
+
let n = /* @__PURE__ */ new Set(), i = t.location.pathname, a = () => {
|
|
7
|
+
let e = t.location.pathname;
|
|
8
|
+
if (e !== i) {
|
|
9
|
+
i = e;
|
|
10
|
+
for (let e of [...n]) e();
|
|
11
|
+
}
|
|
12
|
+
}, o = t.history, s = o?.pushState, c = o?.replaceState, l = (e) => function(...t) {
|
|
13
|
+
let n = e.apply(this, t);
|
|
14
|
+
return queueMicrotask(a), n;
|
|
15
|
+
}, u = typeof s == "function" ? l(s) : void 0, d = typeof c == "function" ? l(c) : void 0;
|
|
16
|
+
o && u && (o.pushState = u), o && d && (o.replaceState = d), t.addEventListener("popstate", a), r = {
|
|
17
|
+
listeners: n,
|
|
18
|
+
dispose: () => {
|
|
19
|
+
t.removeEventListener("popstate", a), o && u && o.pushState === u && s && (o.pushState = s), o && d && o.replaceState === d && c && (o.replaceState = c);
|
|
20
|
+
}
|
|
21
|
+
}, e.set(t, r);
|
|
22
|
+
}
|
|
23
|
+
let i = r, a = () => n();
|
|
24
|
+
i.listeners.add(a);
|
|
25
|
+
let o = !0;
|
|
26
|
+
return () => {
|
|
27
|
+
o && (o = !1, i.listeners.delete(a), i.listeners.size === 0 && (i.dispose(), e.delete(t)));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { t as subscribeDraftPathname };
|
|
@@ -2,55 +2,58 @@ import { canonical as e } from "../appControls/text.js";
|
|
|
2
2
|
import { fillEntityRoute as t } from "./entityRoutes.js";
|
|
3
3
|
import { ENTITY_TARGET_PREFIX as n } from "./resolveTarget.js";
|
|
4
4
|
//#region src/shared/assistant/uiActions/recordNames.ts
|
|
5
|
-
var r = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), i = new Set(/* @__PURE__ */ "it.that.this.there.here.back.them.those.one.link.page.screen.list.tab.section.view.all.my.the.new.first.second.third.fourth.last.next.previous.settings".split(".")), a = /(?:^| )(?:page|screen|list|tab|section|view|settings|menu)$/, o = 60, s = "(?:open|go to|take me to|pull up|bring up|navigate to|switch to|show me)", c = "(?:open|go to|take me to|pull up|bring up|navigate to)";
|
|
6
|
-
function l(e
|
|
5
|
+
var r = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), i = new Set(/* @__PURE__ */ "it.that.this.there.here.back.them.those.one.link.page.screen.list.tab.section.view.all.my.the.new.first.second.third.fourth.last.next.previous.settings".split(".")), a = /(?:^| )(?:page|screen|list|tab|section|view|settings|menu)$/, o = 60, s = "(?:open|go to|take me to|pull up|bring up|navigate to|switch to|show me)", c = /* @__PURE__ */ RegExp("^(?:open|go to|take me to|pull up|bring up|navigate to) (?:the |my )?(.+)$");
|
|
6
|
+
function l(e) {
|
|
7
|
+
return [RegExp(`^${s} (?:the |my )?(${e}) (?:(?:called|named) )?(.+)$`), RegExp(`^${s} (?:the |my )?(.+?) (${e})$`)];
|
|
8
|
+
}
|
|
9
|
+
function u(e, t) {
|
|
7
10
|
if (t.length === 0) return null;
|
|
8
|
-
let n = (e) => t.filter((t) => t.nouns.includes(e)).map((e) => e.id),
|
|
11
|
+
let n = (e) => t.filter((t) => t.nouns.includes(e)).map((e) => e.id), s = [...new Set(t.flatMap((e) => e.nouns))].sort((e, t) => t.length - e.length), u = (e) => {
|
|
9
12
|
let t = e.trim();
|
|
10
13
|
return t.length >= 2 && t.length <= o && !i.has(t) && !a.test(t);
|
|
11
14
|
};
|
|
12
|
-
if (
|
|
13
|
-
let t = l.map((e) => r(e)).join("|"),
|
|
14
|
-
if (
|
|
15
|
-
let e = n(
|
|
15
|
+
if (s.length > 0) {
|
|
16
|
+
let [t, i] = l(s.map((e) => r(e)).join("|")), a = t.exec(e);
|
|
17
|
+
if (a && u(a[2] ?? "")) {
|
|
18
|
+
let e = n(a[1] ?? "");
|
|
16
19
|
if (e.length > 0) return {
|
|
17
|
-
name: (
|
|
20
|
+
name: (a[2] ?? "").trim(),
|
|
18
21
|
adapterIds: e
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
let e = n(
|
|
24
|
+
let o = i.exec(e);
|
|
25
|
+
if (o && u(o[1] ?? "")) {
|
|
26
|
+
let e = n(o[2] ?? "");
|
|
24
27
|
if (e.length > 0) return {
|
|
25
|
-
name: (
|
|
28
|
+
name: (o[1] ?? "").trim(),
|
|
26
29
|
adapterIds: e
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
|
-
let d =
|
|
33
|
+
let d = c.exec(e);
|
|
31
34
|
return d && u(d[1] ?? "") && (d[1] ?? "").length >= 3 ? {
|
|
32
35
|
name: (d[1] ?? "").trim(),
|
|
33
36
|
adapterIds: []
|
|
34
37
|
} : null;
|
|
35
38
|
}
|
|
36
|
-
var
|
|
37
|
-
function
|
|
39
|
+
var d = 4;
|
|
40
|
+
function f(t) {
|
|
38
41
|
return e(t);
|
|
39
42
|
}
|
|
40
|
-
var
|
|
41
|
-
function
|
|
43
|
+
var p = f;
|
|
44
|
+
function m(e, t) {
|
|
42
45
|
let n = t.split(" ");
|
|
43
46
|
return e.split(" ").every((e) => n.some((t) => t.startsWith(e)));
|
|
44
47
|
}
|
|
45
|
-
function
|
|
46
|
-
let i =
|
|
48
|
+
function h(e, r) {
|
|
49
|
+
let i = p(e);
|
|
47
50
|
if (!i) return { kind: "none" };
|
|
48
51
|
let a = [];
|
|
49
52
|
for (let e of r) for (let r of e.matches) {
|
|
50
53
|
let o = t(e.route, r.params);
|
|
51
54
|
if (o === null) continue;
|
|
52
|
-
let s =
|
|
53
|
-
!c && !
|
|
55
|
+
let s = p(r.name), c = s === i;
|
|
56
|
+
!c && !m(i, s) || a.some((e) => e.destination.path === o) || a.push({
|
|
54
57
|
adapterId: e.adapter.id,
|
|
55
58
|
noun: e.noun,
|
|
56
59
|
exact: c,
|
|
@@ -76,23 +79,23 @@ function m(e, r) {
|
|
|
76
79
|
nouns: [...new Set(l.map((e) => e.noun))]
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
|
-
var
|
|
80
|
-
function
|
|
82
|
+
var g = 2500, _ = 50, v = 200;
|
|
83
|
+
function y(e) {
|
|
81
84
|
if (typeof e != "object" || !e) return !1;
|
|
82
85
|
let { name: t, params: n } = e;
|
|
83
86
|
if (typeof t != "string") return !1;
|
|
84
87
|
let r = t.trim();
|
|
85
|
-
if (r.length === 0 || r.length >
|
|
88
|
+
if (r.length === 0 || r.length > v || typeof n != "object" || !n || Array.isArray(n)) return !1;
|
|
86
89
|
let i = Object.values(n);
|
|
87
90
|
return i.length > 0 && i.every((e) => typeof e == "string");
|
|
88
91
|
}
|
|
89
|
-
function
|
|
92
|
+
function b(e) {
|
|
90
93
|
if (!Array.isArray(e)) return [];
|
|
91
94
|
let t = [];
|
|
92
|
-
for (let n of e) if (
|
|
95
|
+
for (let n of e) if (y(n) && t.push(n), t.length >= 50) break;
|
|
93
96
|
return t;
|
|
94
97
|
}
|
|
95
|
-
async function
|
|
98
|
+
async function x(e) {
|
|
96
99
|
let t = new AbortController(), n, r = new Promise((r) => {
|
|
97
100
|
n = setTimeout(() => {
|
|
98
101
|
t.abort(), r(null);
|
|
@@ -116,10 +119,10 @@ async function b(e) {
|
|
|
116
119
|
adapter: n,
|
|
117
120
|
route: i,
|
|
118
121
|
noun: s,
|
|
119
|
-
matches:
|
|
122
|
+
matches: b(o)
|
|
120
123
|
};
|
|
121
124
|
}));
|
|
122
|
-
return
|
|
125
|
+
return h(e.name, n);
|
|
123
126
|
} catch {
|
|
124
127
|
return { kind: "none" };
|
|
125
128
|
} finally {
|
|
@@ -127,4 +130,4 @@ async function b(e) {
|
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
//#endregion
|
|
130
|
-
export {
|
|
133
|
+
export { d as RECORD_CHOICE_MAX, g as RECORD_LOOKUP_TIMEOUT_MS, _ as RECORD_MATCHES_MAX, y as isRecordMatch, x as lookupNamedRecords, f as normaliseRecordName, u as parseRecordRequest, h as planRecordResolution, b as sanitizeRecordMatches };
|
|
@@ -33,6 +33,9 @@ export interface ControllerDeps {
|
|
|
33
33
|
onFallback: (reason: FallbackReason) => void;
|
|
34
34
|
/** A barge-in that produced no words within `NOTHING_HEARD_MS`. */
|
|
35
35
|
onNothingHeard?: () => void;
|
|
36
|
+
/** Timing only: end of the latest echo-approved voiced capture frame. */
|
|
37
|
+
onSpeechFrame?: (at: number) => void;
|
|
38
|
+
now?: () => number;
|
|
36
39
|
isEnabled: () => boolean;
|
|
37
40
|
prerollMs?: number;
|
|
38
41
|
setTimer?: (fn: () => void, ms: number) => ReturnType<typeof setTimeout>;
|
|
@@ -66,7 +66,11 @@ function u(u) {
|
|
|
66
66
|
rmsDb: e.rmsDb,
|
|
67
67
|
zcr: e.zcr
|
|
68
68
|
}, t.pass);
|
|
69
|
-
r.event === "onset"
|
|
69
|
+
if (r.event === "onset" && M(t.reason), b && r.voiced && t.pass) {
|
|
70
|
+
let t = u.now?.() ?? performance.now(), n = _?.context ? Math.max(0, (_.context.currentTime - e.ctxTime) * 1e3) : 0;
|
|
71
|
+
u.onSpeechFrame?.(t - n);
|
|
72
|
+
}
|
|
73
|
+
r.event !== "onset" && b && r.inSegment && u.transport.pushFrame(n), r.event === "end" && j();
|
|
70
74
|
}, P = () => {
|
|
71
75
|
if (!v && !_) return;
|
|
72
76
|
v = !1, k(), b && u.transport.cancelUtterance(b.id), b = null, g.invalidate(), u.transport.stop(), h.clear(), p.reset(), m.reset();
|
|
@@ -24,6 +24,7 @@ export interface UseHandsFreeInterruptOptions {
|
|
|
24
24
|
language: string;
|
|
25
25
|
/** The user's voice started while the assistant was audible. */
|
|
26
26
|
onBargeIn: () => void;
|
|
27
|
+
onSpeechFrame?: (at: number) => void;
|
|
27
28
|
onTranscript: (text: string, final: boolean, language: string | undefined) => void;
|
|
28
29
|
/**
|
|
29
30
|
* The backend stream's privacy-notice version this person accepted (it is
|
|
@@ -94,6 +94,8 @@ export interface UseVoiceInputOptions {
|
|
|
94
94
|
* here) means the user can freely edit while dictation continues.
|
|
95
95
|
*/
|
|
96
96
|
onFinalize: (text: string) => void;
|
|
97
|
+
/** Browser endpoint notification time; not an acoustic timestamp. */
|
|
98
|
+
onSpeechEnd?: (at: number) => void;
|
|
97
99
|
/**
|
|
98
100
|
* BCP-47 tag to listen for. Omit to follow the app locale, which is what this
|
|
99
101
|
* hook did unconditionally before (BOFF-7108).
|
|
@@ -137,4 +139,4 @@ export interface UseVoiceInputResult {
|
|
|
137
139
|
toggle: () => void;
|
|
138
140
|
clearError: () => void;
|
|
139
141
|
}
|
|
140
|
-
export declare function useVoiceInput({ onFinalize, language: requested, }: UseVoiceInputOptions): UseVoiceInputResult;
|
|
142
|
+
export declare function useVoiceInput({ onFinalize, onSpeechEnd, language: requested, }: UseVoiceInputOptions): UseVoiceInputResult;
|
|
@@ -35,72 +35,78 @@ function d(e) {
|
|
|
35
35
|
default: return "unknown";
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function f({ onFinalize: s,
|
|
39
|
-
let { locale:
|
|
38
|
+
function f({ onFinalize: s, onSpeechEnd: c, language: f }) {
|
|
39
|
+
let { locale: p } = e(), [m, h] = i(!1), [g, _] = i(!1), [v, y] = i(""), [b, x] = i(null), S = r(null), C = r(0), w = r(-Infinity), T = r(0), E = r(c);
|
|
40
40
|
n(() => {
|
|
41
|
-
|
|
41
|
+
E.current = c;
|
|
42
|
+
}, [c]);
|
|
43
|
+
let D = r(s);
|
|
44
|
+
n(() => {
|
|
45
|
+
D.current = s;
|
|
42
46
|
}, [s]);
|
|
43
|
-
let
|
|
47
|
+
let O = o() !== null, k = f ?? a[p] ?? "en-US";
|
|
44
48
|
n(() => () => {
|
|
45
|
-
|
|
49
|
+
S.current?.abort(), S.current = null;
|
|
46
50
|
}, []);
|
|
47
|
-
let
|
|
51
|
+
let A = t((e = "manual") => {
|
|
48
52
|
let t = o();
|
|
49
|
-
if (!t ||
|
|
53
|
+
if (!t || S.current || e === "auto" && u(w.current, performance.now())) return;
|
|
50
54
|
let n = new t();
|
|
51
|
-
n.continuous = !0, n.interimResults = !0, n.lang =
|
|
52
|
-
let r =
|
|
53
|
-
n.
|
|
54
|
-
|
|
55
|
+
n.continuous = !0, n.interimResults = !0, n.lang = k;
|
|
56
|
+
let r = C.current;
|
|
57
|
+
n.onspeechend = () => {
|
|
58
|
+
r === C.current && E.current?.(performance.now());
|
|
59
|
+
}, n.onresult = (e) => {
|
|
60
|
+
if (r !== C.current) return;
|
|
55
61
|
let t = "", n = "";
|
|
56
62
|
for (let r = e.resultIndex; r < e.results.length; r += 1) {
|
|
57
63
|
let i = e.results[r], a = i[0]?.transcript ?? "";
|
|
58
64
|
i.isFinal ? t += a : n += a;
|
|
59
65
|
}
|
|
60
|
-
t.trim() &&
|
|
66
|
+
t.trim() && D.current(t.trim()), y(n.trim());
|
|
61
67
|
}, n.onerror = (e) => {
|
|
62
|
-
if (r !==
|
|
68
|
+
if (r !== C.current) return;
|
|
63
69
|
let t = d(e.error);
|
|
64
|
-
t !== "no-speech" &&
|
|
70
|
+
t !== "no-speech" && x(t);
|
|
65
71
|
}, n.onend = () => {
|
|
66
|
-
r ===
|
|
72
|
+
r === C.current && (S.current = null, _(!1), h(!1), y(""));
|
|
67
73
|
}, n.onstart = () => {
|
|
68
|
-
r ===
|
|
69
|
-
},
|
|
74
|
+
r === C.current && (_(!1), h(!0));
|
|
75
|
+
}, _(!0);
|
|
70
76
|
try {
|
|
71
77
|
n.start();
|
|
72
78
|
} catch {
|
|
73
|
-
|
|
79
|
+
w.current = performance.now(), T.current += 1, T.current >= l && x("unknown"), S.current = null, _(!1), h(!1);
|
|
74
80
|
return;
|
|
75
81
|
}
|
|
76
|
-
|
|
77
|
-
}, [
|
|
78
|
-
let e =
|
|
79
|
-
|
|
80
|
-
}, []),
|
|
82
|
+
S.current = n, T.current = 0, x(null), y("");
|
|
83
|
+
}, [k]), j = t(() => {
|
|
84
|
+
let e = S.current;
|
|
85
|
+
S.current = null, C.current += 1, e?.stop(), _(!1), h(!1), y("");
|
|
86
|
+
}, []), M = r(k);
|
|
81
87
|
n(() => {
|
|
82
|
-
|
|
83
|
-
}, [
|
|
84
|
-
let
|
|
85
|
-
|
|
88
|
+
M.current !== k && (M.current = k, j(), x(null));
|
|
89
|
+
}, [k, j]);
|
|
90
|
+
let N = t(() => {
|
|
91
|
+
m || g ? j() : A();
|
|
86
92
|
}, [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]),
|
|
93
|
+
m,
|
|
94
|
+
g,
|
|
95
|
+
A,
|
|
96
|
+
j
|
|
97
|
+
]), P = t(() => x(null), []);
|
|
92
98
|
return {
|
|
93
|
-
isSupported:
|
|
94
|
-
isListening:
|
|
95
|
-
isStarting:
|
|
96
|
-
isActive:
|
|
97
|
-
interim:
|
|
98
|
-
error:
|
|
99
|
-
language:
|
|
100
|
-
start:
|
|
101
|
-
stop:
|
|
102
|
-
toggle:
|
|
103
|
-
clearError:
|
|
99
|
+
isSupported: O,
|
|
100
|
+
isListening: m,
|
|
101
|
+
isStarting: g,
|
|
102
|
+
isActive: m || g,
|
|
103
|
+
interim: v,
|
|
104
|
+
error: b,
|
|
105
|
+
language: k,
|
|
106
|
+
start: A,
|
|
107
|
+
stop: j,
|
|
108
|
+
toggle: N,
|
|
109
|
+
clearError: P
|
|
104
110
|
};
|
|
105
111
|
}
|
|
106
112
|
//#endregion
|