@burdenoff/fe-libs 2026.1016.3 → 2026.1017.2
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/README.md +25 -1
- package/dist/shared/assistant/i18nManifest.d.ts +1 -0
- package/dist/shared/assistant/i18nManifest.js +1 -0
- package/dist/shared/assistant/speech/hostedTtsSpeechEngine.d.ts +6 -0
- package/dist/shared/assistant/speech/hostedTtsSpeechEngine.js +118 -101
- package/dist/shared/assistant/speech/notifyCancellationSpeechEngine.js +3 -0
- package/dist/shared/assistant/speech/routingSpeechEngine.js +11 -8
- package/dist/shared/assistant/speech/types.d.ts +11 -0
- package/dist/shared/assistant/ui/AssistantMessageItem.js +110 -100
- package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts +10 -0
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +278 -261
- package/dist/shared/assistant/ui/useVoiceSession.js +222 -227
- package/dist/shared/assistant/voice/handsfree/playbackReference.d.ts +15 -4
- package/dist/shared/assistant/voice/handsfree/playbackReference.js +9 -6
- package/dist/shared/pages/AiPage.d.ts +0 -8
- package/dist/shared/pages/AiPage.js +126 -72
- package/dist/shared/pages/ai/CatalogPanel.d.ts +9 -0
- package/dist/shared/pages/ai/CatalogPanel.js +80 -0
- package/dist/shared/pages/ai/ReadNotice.d.ts +4 -0
- package/dist/shared/pages/ai/ReadNotice.js +18 -0
- package/dist/shared/pages/ai/SummaryPanel.d.ts +7 -0
- package/dist/shared/pages/ai/SummaryPanel.js +135 -0
- package/dist/shared/pages/ai/contracts.d.ts +45 -0
- package/dist/shared/pages/ai/contracts.js +159 -0
- package/dist/shared/pages/ai/i18n.d.ts +1 -0
- package/dist/shared/pages/ai/i18n.js +10 -0
- package/dist/shared/pages/ai/useAiRead.d.ts +18 -0
- package/dist/shared/pages/ai/useAiRead.js +57 -0
- package/dist/shared/utils/mockData.js +212 -0
- package/dist/shared-assistant.js +270 -270
- package/package.json +1 -5
|
@@ -18,7 +18,10 @@ function o(e, r) {
|
|
|
18
18
|
let i = t;
|
|
19
19
|
t = null, n = [], i();
|
|
20
20
|
}
|
|
21
|
-
function s(
|
|
21
|
+
function s() {
|
|
22
|
+
return e !== null;
|
|
23
|
+
}
|
|
24
|
+
function c(t) {
|
|
22
25
|
let r = e;
|
|
23
26
|
if (r) try {
|
|
24
27
|
let e = r.context.createMediaElementSource(t), i = r.context.createGain();
|
|
@@ -37,19 +40,19 @@ function s(t) {
|
|
|
37
40
|
]) t.addEventListener(e, () => o(a, !1));
|
|
38
41
|
} catch {}
|
|
39
42
|
}
|
|
40
|
-
function
|
|
43
|
+
function l() {
|
|
41
44
|
for (let e of n) try {
|
|
42
45
|
e.gain.gain.value = 0;
|
|
43
46
|
} catch {}
|
|
44
47
|
}
|
|
45
|
-
function
|
|
48
|
+
function u(e) {
|
|
46
49
|
r = e;
|
|
47
50
|
}
|
|
48
|
-
function
|
|
51
|
+
function d() {
|
|
49
52
|
return n.some((e) => e.active) ? "hosted" : r ? "device" : null;
|
|
50
53
|
}
|
|
51
|
-
function
|
|
54
|
+
function f() {
|
|
52
55
|
e = null, t = null, n = [], r = !1;
|
|
53
56
|
}
|
|
54
57
|
//#endregion
|
|
55
|
-
export {
|
|
58
|
+
export { d as activePlaybackSource, i as attachPlaybackReference, a as detachPlaybackReference, s as isPlaybackReferenceAttached, f as resetPlaybackReferenceForTest, u as setDeviceVoice, l as silencePlaybackReference, c as tapPlaybackElement };
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AiPage Component
|
|
3
|
-
*
|
|
4
|
-
* Simple branded placeholder page for the /ai route across all app shells.
|
|
5
|
-
* Shows product-specific AI branding with a "coming soon" state.
|
|
6
|
-
*/
|
|
7
1
|
export interface AiPageProps {
|
|
8
|
-
/** Display name of the product (e.g., "VibeControls", "FluidGrids") */
|
|
9
2
|
productName: string;
|
|
10
|
-
/** Machine-readable product identifier (e.g., "vibecontrols", "fluidgrids") */
|
|
11
3
|
productId: string;
|
|
12
4
|
}
|
|
13
5
|
export declare function AiPage({ productName, productId }: AiPageProps): import('react/jsx-runtime').JSX.Element;
|
|
@@ -1,78 +1,132 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useSafeGatewayClient as e } from "../graphql/GatewayContext.js";
|
|
2
|
+
import { useAuth as t } from "../providers/shell/AuthProvider.js";
|
|
3
|
+
import { useActiveContext as n } from "../providers/shell/ActiveContextProvider.js";
|
|
4
|
+
import { useI18n as r } from "../providers/shell/I18nProvider.js";
|
|
5
|
+
import { PermissionProvider as i, usePermissions as a, useSafePermissions as o } from "../providers/shell/PermissionProvider.js";
|
|
6
|
+
import { MODELS as s, PROVIDERS as c, SUMMARY as l, catalog as u, sevenDays as d, summary as f } from "./ai/contracts.js";
|
|
7
|
+
import { useAiTr as p } from "./ai/i18n.js";
|
|
8
|
+
import { CatalogPanel as m } from "./ai/CatalogPanel.js";
|
|
9
|
+
import { SummaryPanel as h } from "./ai/SummaryPanel.js";
|
|
10
|
+
import { useAiRead as g } from "./ai/useAiRead.js";
|
|
11
|
+
import { useCallback as _, useMemo as v, useState as y } from "react";
|
|
12
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
3
13
|
//#region src/shared/pages/AiPage.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
description: "AI-powered workflows that adapt to your needs"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
icon: n,
|
|
12
|
-
title: "Smart Suggestions",
|
|
13
|
-
description: "Context-aware recommendations and insights"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
icon: r,
|
|
17
|
-
title: "Instant Analysis",
|
|
18
|
-
description: "Real-time data processing and pattern recognition"
|
|
19
|
-
}
|
|
20
|
-
];
|
|
21
|
-
function s({ productName: t, productId: n }) {
|
|
22
|
-
return /* @__PURE__ */ i("div", {
|
|
23
|
-
className: "flex flex-col items-center justify-center min-h-[calc(100vh-4rem)] px-4 py-12",
|
|
14
|
+
function C({ productName: t, productId: n }) {
|
|
15
|
+
let r = p(), i = e("workspace");
|
|
16
|
+
return /* @__PURE__ */ S("main", {
|
|
17
|
+
className: "mx-auto w-full max-w-6xl space-y-6 px-4 py-6 sm:px-6",
|
|
24
18
|
"data-product-id": n,
|
|
25
|
-
children: /* @__PURE__ */
|
|
26
|
-
className: "
|
|
27
|
-
children: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
19
|
+
children: [/* @__PURE__ */ S("header", {
|
|
20
|
+
className: "space-y-2",
|
|
21
|
+
children: [/* @__PURE__ */ x("h1", {
|
|
22
|
+
className: "text-2xl font-semibold text-foreground",
|
|
23
|
+
children: r("title", "{product} AI operations", { product: t })
|
|
24
|
+
}), /* @__PURE__ */ x("p", {
|
|
25
|
+
className: "max-w-3xl text-sm text-muted-foreground",
|
|
26
|
+
children: r("intro", "Review the workspace model catalog and recorded AI usage.")
|
|
27
|
+
})]
|
|
28
|
+
}), i ? /* @__PURE__ */ x(w, { children: /* @__PURE__ */ x(T, {
|
|
29
|
+
productId: n,
|
|
30
|
+
client: i
|
|
31
|
+
}) }) : /* @__PURE__ */ x("p", {
|
|
32
|
+
role: "status",
|
|
33
|
+
children: r("unavailable", "AI operations are unavailable in this context.")
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function w({ children: e }) {
|
|
38
|
+
let t = o(), { workspaceId: r } = n();
|
|
39
|
+
return t ? e : /* @__PURE__ */ x(i, {
|
|
40
|
+
scopeId: r ?? null,
|
|
41
|
+
gateway: "workspace",
|
|
42
|
+
children: e
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function T({ productId: e, client: i }) {
|
|
46
|
+
let o = t(), { workspaceId: C } = n(), w = a(), { locale: T } = r(), E = p(), D = v(() => ({
|
|
47
|
+
workspaceId: C ?? "",
|
|
48
|
+
actorId: o.user?.id ?? "",
|
|
49
|
+
profileId: o.activeProfileId,
|
|
50
|
+
accessToken: o.tokens?.accessToken ?? null,
|
|
51
|
+
workspaceToken: o.workspaceToken
|
|
52
|
+
}), [
|
|
53
|
+
C,
|
|
54
|
+
o.user?.id,
|
|
55
|
+
o.activeProfileId,
|
|
56
|
+
o.tokens?.accessToken,
|
|
57
|
+
o.workspaceToken
|
|
58
|
+
]), [O, k] = y(d), [A, j] = y({
|
|
59
|
+
scope: D,
|
|
60
|
+
models: 0,
|
|
61
|
+
providers: 0,
|
|
62
|
+
revision: 0
|
|
63
|
+
}), M = A.scope === D ? A.models : 0, N = A.scope === D ? A.providers : 0, P = A.scope === D ? A.revision : 0, F = (e) => o.isLoading ? "loading" : !o.isAuthenticated || !D.workspaceId || !D.actorId || !D.accessToken ? "unavailable" : w.isLoading || w.scopeId !== D.workspaceId ? "loading" : w.error ? "unavailable" : !w.isSuperAdmin && w.permissions?.actorId !== D.actorId ? "loading" : w.hasPermission(e) ? "ready" : "denied", I = v(() => ({ pagination: {
|
|
64
|
+
limit: 20,
|
|
65
|
+
offset: M
|
|
66
|
+
} }), [M]), L = v(() => ({ pagination: {
|
|
67
|
+
limit: 20,
|
|
68
|
+
offset: N
|
|
69
|
+
} }), [N]), R = v(() => ({
|
|
70
|
+
...O,
|
|
71
|
+
productKey: e
|
|
72
|
+
}), [O, e]), z = _((e) => u(e, "models"), []), B = _((e) => u(e, "providers"), []), V = _((t) => f(t, D.workspaceId, e, O), [
|
|
73
|
+
D.workspaceId,
|
|
74
|
+
e,
|
|
75
|
+
O
|
|
76
|
+
]), H = g(i, D, F("prompt-model:read"), s, I, z, P), U = g(i, D, F("prompt-provider:read"), c, L, B, P), W = g(i, D, F("prompt-invocation:read"), l, R, V, P);
|
|
77
|
+
function G() {
|
|
78
|
+
k(d()), j({
|
|
79
|
+
scope: D,
|
|
80
|
+
models: M,
|
|
81
|
+
providers: N,
|
|
82
|
+
revision: P + 1
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return /* @__PURE__ */ S(b, { children: [
|
|
86
|
+
/* @__PURE__ */ S("div", {
|
|
87
|
+
className: "flex flex-wrap items-center justify-between gap-3",
|
|
88
|
+
children: [/* @__PURE__ */ x("p", {
|
|
89
|
+
className: "text-sm text-muted-foreground",
|
|
90
|
+
children: E("readonly", "Read-only workspace view")
|
|
91
|
+
}), /* @__PURE__ */ x("button", {
|
|
92
|
+
type: "button",
|
|
93
|
+
onClick: G,
|
|
94
|
+
className: "rounded-md border border-border px-3 py-2 text-sm font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
95
|
+
children: E("refresh", "Refresh")
|
|
96
|
+
})]
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ x(h, {
|
|
99
|
+
state: W,
|
|
100
|
+
window: O,
|
|
101
|
+
locale: T
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ S("div", {
|
|
104
|
+
className: "grid gap-6 lg:grid-cols-2",
|
|
105
|
+
children: [/* @__PURE__ */ x(m, {
|
|
106
|
+
kind: "models",
|
|
107
|
+
state: H,
|
|
108
|
+
offset: M,
|
|
109
|
+
locale: T,
|
|
110
|
+
onPage: (e) => j({
|
|
111
|
+
scope: D,
|
|
112
|
+
models: e,
|
|
113
|
+
providers: N,
|
|
114
|
+
revision: P
|
|
72
115
|
})
|
|
73
|
-
|
|
116
|
+
}), /* @__PURE__ */ x(m, {
|
|
117
|
+
kind: "providers",
|
|
118
|
+
state: U,
|
|
119
|
+
offset: N,
|
|
120
|
+
locale: T,
|
|
121
|
+
onPage: (e) => j({
|
|
122
|
+
scope: D,
|
|
123
|
+
models: M,
|
|
124
|
+
providers: e,
|
|
125
|
+
revision: P
|
|
126
|
+
})
|
|
127
|
+
})]
|
|
74
128
|
})
|
|
75
|
-
});
|
|
129
|
+
] });
|
|
76
130
|
}
|
|
77
131
|
//#endregion
|
|
78
|
-
export {
|
|
132
|
+
export { C as AiPage };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CatalogPage } from './contracts';
|
|
2
|
+
import { ReadState } from './useAiRead';
|
|
3
|
+
export declare function CatalogPanel({ kind, state, offset, locale, onPage, }: {
|
|
4
|
+
kind: 'models' | 'providers';
|
|
5
|
+
state: ReadState<CatalogPage>;
|
|
6
|
+
offset: number;
|
|
7
|
+
locale: string;
|
|
8
|
+
onPage: (offset: number) => void;
|
|
9
|
+
}): import('react/jsx-runtime').JSX.Element;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { exactInteger as e } from "./contracts.js";
|
|
2
|
+
import { useAiTr as t } from "./i18n.js";
|
|
3
|
+
import { ReadNotice as n } from "./ReadNotice.js";
|
|
4
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
//#region src/shared/pages/ai/CatalogPanel.tsx
|
|
6
|
+
function o({ kind: o, state: s, offset: c, locale: l, onPage: u }) {
|
|
7
|
+
let d = t(), f = o === "models" ? d("models", "Model catalog") : d("providers", "Provider catalog");
|
|
8
|
+
return /* @__PURE__ */ a("section", {
|
|
9
|
+
"aria-label": f,
|
|
10
|
+
className: "min-w-0 rounded-xl border border-border bg-card p-4 sm:p-5",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ i("h2", {
|
|
13
|
+
className: "mb-2 text-lg font-semibold",
|
|
14
|
+
children: f
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ i("p", {
|
|
17
|
+
className: "mb-4 text-sm text-muted-foreground",
|
|
18
|
+
children: o === "models" ? d("modelsDescription", "Models registered for this workspace") : d("providersDescription", "Providers registered for this workspace")
|
|
19
|
+
}),
|
|
20
|
+
s.status === "ready" ? /* @__PURE__ */ a(r, { children: [
|
|
21
|
+
/* @__PURE__ */ i("p", {
|
|
22
|
+
className: "mb-3 text-sm text-muted-foreground",
|
|
23
|
+
children: d("catalogTotal", "{count} catalog entries", { count: e(String(s.data.total), l) })
|
|
24
|
+
}),
|
|
25
|
+
s.data.items.length === 0 ? /* @__PURE__ */ i("p", {
|
|
26
|
+
className: "text-sm",
|
|
27
|
+
children: d("emptyCatalog", "No entries on this page.")
|
|
28
|
+
}) : /* @__PURE__ */ i("ul", {
|
|
29
|
+
tabIndex: 0,
|
|
30
|
+
"aria-label": d("catalogEntries", "{section} entries", { section: f }),
|
|
31
|
+
className: "max-h-96 overflow-y-auto divide-y divide-border rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
32
|
+
children: s.data.items.map((e) => /* @__PURE__ */ a("li", {
|
|
33
|
+
className: "space-y-1 py-3",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ i("h3", {
|
|
36
|
+
className: "break-words font-medium",
|
|
37
|
+
children: e.displayName
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ a("p", {
|
|
40
|
+
className: "break-all text-sm text-muted-foreground",
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ i("bdi", { children: e.key }),
|
|
43
|
+
" · ",
|
|
44
|
+
/* @__PURE__ */ i("bdi", { children: e.detail })
|
|
45
|
+
]
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ a("p", {
|
|
48
|
+
className: "text-xs text-muted-foreground",
|
|
49
|
+
children: [e.isActive ? d("active", "Active catalog entry") : d("inactive", "Inactive catalog entry"), e.deprecated ? ` · ${d("deprecated", "Deprecated")}` : ""]
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
}, e.id))
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ i("p", {
|
|
55
|
+
className: "mt-3 text-xs text-muted-foreground",
|
|
56
|
+
children: d("registrationNotice", "Registration does not guarantee live availability.")
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ a("nav", {
|
|
59
|
+
"aria-label": d("pagination", "{section} pages", { section: f }),
|
|
60
|
+
className: "mt-4 flex flex-wrap gap-2",
|
|
61
|
+
children: [/* @__PURE__ */ i("button", {
|
|
62
|
+
type: "button",
|
|
63
|
+
disabled: c === 0,
|
|
64
|
+
onClick: () => u(Math.max(0, c - 20)),
|
|
65
|
+
className: "rounded-md border border-border px-3 py-2 text-sm disabled:opacity-50",
|
|
66
|
+
children: d("previous", "Previous")
|
|
67
|
+
}), /* @__PURE__ */ i("button", {
|
|
68
|
+
type: "button",
|
|
69
|
+
disabled: !s.data.hasMore,
|
|
70
|
+
onClick: () => u(c + 20),
|
|
71
|
+
className: "rounded-md border border-border px-3 py-2 text-sm disabled:opacity-50",
|
|
72
|
+
children: d("next", "Next")
|
|
73
|
+
})]
|
|
74
|
+
})
|
|
75
|
+
] }) : /* @__PURE__ */ i(n, { status: s.status })
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { o as CatalogPanel };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useAiTr as e } from "./i18n.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/shared/pages/ai/ReadNotice.tsx
|
|
4
|
+
function n({ status: n }) {
|
|
5
|
+
let r = e();
|
|
6
|
+
return /* @__PURE__ */ t("p", {
|
|
7
|
+
role: "status",
|
|
8
|
+
className: "text-sm text-muted-foreground",
|
|
9
|
+
children: {
|
|
10
|
+
loading: r("loading", "Loading this workspace…"),
|
|
11
|
+
denied: r("denied", "You do not have permission to read this section."),
|
|
12
|
+
unavailable: r("unavailable", "AI operations are unavailable in this context."),
|
|
13
|
+
error: r("error", "This read could not be completed. Refresh to try again.")
|
|
14
|
+
}[n]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { n as ReadNotice };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UsageSummary, UsageWindow } from './contracts';
|
|
2
|
+
import { ReadState } from './useAiRead';
|
|
3
|
+
export declare function SummaryPanel({ state, window, locale, }: {
|
|
4
|
+
state: ReadState<UsageSummary>;
|
|
5
|
+
window: UsageWindow;
|
|
6
|
+
locale: string;
|
|
7
|
+
}): import('react/jsx-runtime').JSX.Element;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { exactInteger as e, exactUsd as t } from "./contracts.js";
|
|
2
|
+
import { useAiTr as n } from "./i18n.js";
|
|
3
|
+
import { ReadNotice as r } from "./ReadNotice.js";
|
|
4
|
+
import { useMemo as i } from "react";
|
|
5
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
//#region src/shared/pages/ai/SummaryPanel.tsx
|
|
7
|
+
function c({ label: r, value: i, cost: a, locale: c }) {
|
|
8
|
+
let l = n();
|
|
9
|
+
return /* @__PURE__ */ s("div", {
|
|
10
|
+
className: "min-w-0 rounded-lg bg-muted/40 p-3",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ o("dt", {
|
|
13
|
+
className: "text-sm text-muted-foreground",
|
|
14
|
+
children: r
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ o("dd", {
|
|
17
|
+
className: "mt-1 break-all text-xl font-semibold tabular-nums",
|
|
18
|
+
children: i.knownSubtotal === null ? l("unknown", "Unknown") : a ? t(i.knownSubtotal, c) : e(i.knownSubtotal, c)
|
|
19
|
+
}),
|
|
20
|
+
/* @__PURE__ */ o("dd", {
|
|
21
|
+
className: "mt-2 text-xs text-muted-foreground",
|
|
22
|
+
children: l("coverage", "{known} attempts reported; {missing} missing", {
|
|
23
|
+
known: e(i.knownAttempts, c),
|
|
24
|
+
missing: e(i.missingAttempts, c)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function l({ state: t, window: l, locale: u }) {
|
|
31
|
+
let d = n(), f = d("summary", "Recorded usage"), p = i(() => new Intl.DateTimeFormat(u, {
|
|
32
|
+
year: "numeric",
|
|
33
|
+
month: "short",
|
|
34
|
+
day: "numeric",
|
|
35
|
+
hour: "2-digit",
|
|
36
|
+
minute: "2-digit",
|
|
37
|
+
timeZone: "UTC"
|
|
38
|
+
}), [u]), m = t.status === "ready" ? [
|
|
39
|
+
[d("operations", "Operations"), t.data.operations],
|
|
40
|
+
[d("attempts", "Recorded attempts"), t.data.attempts],
|
|
41
|
+
[d("known", "Known"), t.data.knownAttempts],
|
|
42
|
+
[d("partial", "Partial"), t.data.partialAttempts],
|
|
43
|
+
[d("unknownAttempts", "Unknown"), t.data.unknownAttempts],
|
|
44
|
+
[d("pending", "Pending (included in unknown)"), t.data.pendingAttempts]
|
|
45
|
+
] : [];
|
|
46
|
+
return /* @__PURE__ */ s("section", {
|
|
47
|
+
"aria-label": f,
|
|
48
|
+
className: "min-w-0 rounded-xl border border-border bg-card p-4 sm:p-5",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ o("h2", {
|
|
51
|
+
className: "text-lg font-semibold",
|
|
52
|
+
children: f
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ o("p", {
|
|
55
|
+
className: "mt-2 break-words text-sm text-muted-foreground",
|
|
56
|
+
children: d("window", "{from} to {to} UTC", {
|
|
57
|
+
from: p.format(new Date(l.from)),
|
|
58
|
+
to: p.format(new Date(l.to))
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ o("p", {
|
|
62
|
+
className: "mt-2 text-sm text-muted-foreground",
|
|
63
|
+
children: d("summaryNotice", "Recorded attempts for this product. Usage may be incomplete; costs are estimated subtotals.")
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ o("div", {
|
|
66
|
+
className: "mt-4",
|
|
67
|
+
"aria-live": "polite",
|
|
68
|
+
children: t.status === "ready" ? /* @__PURE__ */ s(a, { children: [
|
|
69
|
+
t.data.attempts === "0" && /* @__PURE__ */ o("p", {
|
|
70
|
+
className: "mb-4 text-sm",
|
|
71
|
+
children: d("emptySummary", "No recorded attempts in this window. Unknown subtotals are not zero usage.")
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ o("dl", {
|
|
74
|
+
className: "grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6",
|
|
75
|
+
children: m.map(([t, n]) => /* @__PURE__ */ s("div", {
|
|
76
|
+
className: "min-w-0",
|
|
77
|
+
children: [/* @__PURE__ */ o("dt", {
|
|
78
|
+
className: "text-xs text-muted-foreground",
|
|
79
|
+
children: t
|
|
80
|
+
}), /* @__PURE__ */ o("dd", {
|
|
81
|
+
className: "break-all text-xl font-semibold tabular-nums",
|
|
82
|
+
children: e(n, u)
|
|
83
|
+
})]
|
|
84
|
+
}, t))
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ s("dl", {
|
|
87
|
+
className: "mt-5 grid gap-3 sm:grid-cols-2 2xl:grid-cols-4",
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ o(c, {
|
|
90
|
+
label: d("input", "Known input tokens"),
|
|
91
|
+
value: t.data.inputTokens,
|
|
92
|
+
locale: u
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ o(c, {
|
|
95
|
+
label: d("output", "Known output tokens"),
|
|
96
|
+
value: t.data.outputTokens,
|
|
97
|
+
locale: u
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ o(c, {
|
|
100
|
+
label: d("total", "Known total tokens"),
|
|
101
|
+
value: t.data.totalTokens,
|
|
102
|
+
locale: u
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ o(c, {
|
|
105
|
+
label: d("cost", "Known estimated cost subtotal"),
|
|
106
|
+
value: t.data.costMicroUsd,
|
|
107
|
+
cost: !0,
|
|
108
|
+
locale: u
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ s("details", {
|
|
113
|
+
className: "mt-4 text-sm text-muted-foreground",
|
|
114
|
+
children: [/* @__PURE__ */ o("summary", {
|
|
115
|
+
className: "cursor-pointer",
|
|
116
|
+
children: d("usageHelp", "About these figures")
|
|
117
|
+
}), /* @__PURE__ */ s("div", {
|
|
118
|
+
className: "mt-2 space-y-2 text-xs",
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ o("p", { children: d("coverageHelp", "Unknown means no supplied value; zero is a reported value. Missing counts show incomplete coverage. Pending attempts are included in unknown.") }),
|
|
121
|
+
/* @__PURE__ */ o("p", { children: d("recordedHelp", "These are recorded attempts, not all provider traffic or an invoice. Legacy records are excluded. Failed or timed-out attempts may still report usage. Cached input is included in input tokens.") }),
|
|
122
|
+
/* @__PURE__ */ o("p", { children: d("exactWindow", "Exact UTC range: {from} (inclusive) to {to} (exclusive).", {
|
|
123
|
+
from: l.from,
|
|
124
|
+
to: l.to
|
|
125
|
+
}) })
|
|
126
|
+
]
|
|
127
|
+
})]
|
|
128
|
+
})
|
|
129
|
+
] }) : /* @__PURE__ */ o(r, { status: t.status })
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { l as SummaryPanel };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Read-only operations owned by Prompts; deliberately exclude credentials and V1. */
|
|
2
|
+
export declare const MODELS: import('graphql').DocumentNode;
|
|
3
|
+
export declare const PROVIDERS: import('graphql').DocumentNode;
|
|
4
|
+
export declare const SUMMARY: import('graphql').DocumentNode;
|
|
5
|
+
export interface CatalogItem {
|
|
6
|
+
id: string;
|
|
7
|
+
key: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
detail: string;
|
|
11
|
+
deprecated: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface CatalogPage {
|
|
14
|
+
items: CatalogItem[];
|
|
15
|
+
total: number;
|
|
16
|
+
hasMore: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface UsageComponent {
|
|
19
|
+
knownSubtotal: string | null;
|
|
20
|
+
knownAttempts: string;
|
|
21
|
+
missingAttempts: string;
|
|
22
|
+
}
|
|
23
|
+
export interface UsageSummary {
|
|
24
|
+
operations: string;
|
|
25
|
+
attempts: string;
|
|
26
|
+
pendingAttempts: string;
|
|
27
|
+
knownAttempts: string;
|
|
28
|
+
partialAttempts: string;
|
|
29
|
+
unknownAttempts: string;
|
|
30
|
+
inputTokens: UsageComponent;
|
|
31
|
+
outputTokens: UsageComponent;
|
|
32
|
+
totalTokens: UsageComponent;
|
|
33
|
+
costMicroUsd: UsageComponent;
|
|
34
|
+
}
|
|
35
|
+
export interface UsageWindow {
|
|
36
|
+
from: string;
|
|
37
|
+
to: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const PAGE_SIZE = 20;
|
|
40
|
+
export declare function integer(value: unknown): string;
|
|
41
|
+
export declare function catalog(value: unknown, kind: 'models' | 'providers'): CatalogPage;
|
|
42
|
+
export declare function summary(value: unknown, workspaceId: string, productKey: string, window: UsageWindow): UsageSummary;
|
|
43
|
+
export declare function exactInteger(value: string, locale: string): string;
|
|
44
|
+
export declare function exactUsd(value: string, locale: string): string;
|
|
45
|
+
export declare function sevenDays(now?: Date): UsageWindow;
|