@burdenoff/fe-libs 2026.1028.4 → 2026.1028.6
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 +5 -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/ui/AiCreditBalance.d.ts +36 -0
- package/dist/shared/assistant/ui/AiCreditBalance.js +32 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1594 -1502
- 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/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/useAiCreditStatus.d.ts +18 -0
- package/dist/shared/assistant/useAiCreditStatus.js +40 -0
- package/dist/shared/providers/shell/useAssistantShellLabels.d.ts +10 -0
- package/dist/shared/providers/shell/useAssistantShellLabels.js +9 -1
- package/dist/shared-assistant.js +331 -326
- package/package.json +1 -1
|
@@ -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 };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AiCreditStatus } from './productAiCredits';
|
|
2
|
+
export interface UseAiCreditStatusOptions {
|
|
3
|
+
/** Workspace to read. Defaults to the shell's active workspace. */
|
|
4
|
+
workspaceId?: string;
|
|
5
|
+
/** False skips the read entirely, for a product that does not meter AI. */
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/** Injected reader, for tests. Defaults to `fetchAiCreditStatus`. */
|
|
8
|
+
read?: (productKey: string, workspaceId?: string) => Promise<AiCreditStatus | null>;
|
|
9
|
+
}
|
|
10
|
+
export interface AiCreditStatusState {
|
|
11
|
+
/** The last successful read, or null when unknown. */
|
|
12
|
+
status: AiCreditStatus | null;
|
|
13
|
+
/** True until the first read settles. */
|
|
14
|
+
loading: boolean;
|
|
15
|
+
/** Read the balance again now. */
|
|
16
|
+
refresh: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function useAiCreditStatus(productKey: string, options?: UseAiCreditStatusOptions): AiCreditStatusState;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { quotaExhaustedEventName as e } from "./quota.js";
|
|
2
|
+
import { fetchAiCreditStatus as t } from "./productAiCredits.js";
|
|
3
|
+
import { aiCreditsUpdatedEventName as n } from "./aiCredits.js";
|
|
4
|
+
import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
5
|
+
//#region src/shared/assistant/useAiCreditStatus.ts
|
|
6
|
+
function s(s, c = {}) {
|
|
7
|
+
let { workspaceId: l, enabled: u = !0, read: d = t } = c, [f, p] = o(null), [m, h] = o(u), g = a(0), _ = r(async () => {
|
|
8
|
+
if (!u || !s) return;
|
|
9
|
+
let e = ++g.current, t = await d(s, l);
|
|
10
|
+
e === g.current && (p(t), h(!1));
|
|
11
|
+
}, [
|
|
12
|
+
u,
|
|
13
|
+
s,
|
|
14
|
+
l,
|
|
15
|
+
d
|
|
16
|
+
]);
|
|
17
|
+
return i(() => {
|
|
18
|
+
if (!u || !s) {
|
|
19
|
+
p(null), h(!1);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (h(!0), _(), typeof window > "u") return;
|
|
23
|
+
let t = () => {
|
|
24
|
+
_();
|
|
25
|
+
}, r = n(s), i = e(s);
|
|
26
|
+
return window.addEventListener(r, t), window.addEventListener(i, t), () => {
|
|
27
|
+
window.removeEventListener(r, t), window.removeEventListener(i, t), g.current += 1;
|
|
28
|
+
};
|
|
29
|
+
}, [
|
|
30
|
+
u,
|
|
31
|
+
s,
|
|
32
|
+
_
|
|
33
|
+
]), {
|
|
34
|
+
status: f,
|
|
35
|
+
loading: m,
|
|
36
|
+
refresh: _
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { s as useAiCreditStatus };
|
|
@@ -50,3 +50,13 @@ export declare function useAssistantChromeLabels(): {
|
|
|
50
50
|
* every product.
|
|
51
51
|
*/
|
|
52
52
|
export declare function useAssistantDisclaimerLabel(): string;
|
|
53
|
+
/**
|
|
54
|
+
* The AI-credit balance line shown before an AI action (BOFF-3732). Platform
|
|
55
|
+
* shell labels, so one seed in the `workspaces` dictionary translates them for
|
|
56
|
+
* every product.
|
|
57
|
+
*/
|
|
58
|
+
export declare function useAiCreditBalanceLabels(): {
|
|
59
|
+
remaining: (count: string) => string;
|
|
60
|
+
unlimited: string;
|
|
61
|
+
exhausted: string;
|
|
62
|
+
};
|
|
@@ -53,5 +53,13 @@ function n() {
|
|
|
53
53
|
function r() {
|
|
54
54
|
return e()("assistantChrome.aiDisclaimer", "AI can make mistakes. Check important details.");
|
|
55
55
|
}
|
|
56
|
+
function i() {
|
|
57
|
+
let t = e();
|
|
58
|
+
return {
|
|
59
|
+
remaining: (e) => t("assistantChrome.aiCreditsRemaining", "{{count}} AI credits left", { count: e }),
|
|
60
|
+
unlimited: t("assistantChrome.aiCreditsUnlimited", "Unlimited AI credits on this plan"),
|
|
61
|
+
exhausted: t("assistantChrome.aiCreditsExhausted", "No AI credits left. AI actions resume next cycle or after an upgrade.")
|
|
62
|
+
};
|
|
63
|
+
}
|
|
56
64
|
//#endregion
|
|
57
|
-
export { n as useAssistantChromeLabels, r as useAssistantDisclaimerLabel, t as useWorkflowAssistantLabels };
|
|
65
|
+
export { i as useAiCreditBalanceLabels, n as useAssistantChromeLabels, r as useAssistantDisclaimerLabel, t as useWorkflowAssistantLabels };
|