@gram-ai/elements 1.33.2 → 1.34.0
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/components/ui/time-range-picker.d.ts +17 -1
- package/dist/components/ui/time-range-picker.test.d.ts +1 -0
- package/dist/elements.cjs +1 -1
- package/dist/elements.js +19 -16
- package/dist/hooks/useGramThreadListAdapter.d.ts +13 -0
- package/dist/{index-CGoLfO5p.js → index-B5lZrrO2.js} +52 -37
- package/dist/index-B5lZrrO2.js.map +1 -0
- package/dist/{index-reVrRxP1.js → index-BFU6NvbL.js} +6854 -6807
- package/dist/index-BFU6NvbL.js.map +1 -0
- package/dist/{index-DAWGW1Nj.cjs → index-C08dvTEo.cjs} +43 -43
- package/dist/index-C08dvTEo.cjs.map +1 -0
- package/dist/index-DzZ1-jQY.cjs +194 -0
- package/dist/index-DzZ1-jQY.cjs.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/lib/messageConverter.d.ts +58 -8
- package/dist/lib/models.d.ts +1 -1
- package/dist/lib/utils.d.ts +2 -0
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.js +1 -1
- package/dist/{profiler-B3tfiOx4.cjs → profiler-BRnyr1GA.cjs} +2 -2
- package/dist/{profiler-B3tfiOx4.cjs.map → profiler-BRnyr1GA.cjs.map} +1 -1
- package/dist/{profiler-noho3NG9.js → profiler-KLSTpp6I.js} +2 -2
- package/dist/{profiler-noho3NG9.js.map → profiler-KLSTpp6I.js.map} +1 -1
- package/dist/{startRecording-mkmig-2n.js → startRecording-BfxB1xxR.js} +2 -2
- package/dist/{startRecording-mkmig-2n.js.map → startRecording-BfxB1xxR.js.map} +1 -1
- package/dist/{startRecording-7Oy6wM18.cjs → startRecording-CKx-YWbq.cjs} +2 -2
- package/dist/{startRecording-7Oy6wM18.cjs.map → startRecording-CKx-YWbq.cjs.map} +1 -1
- package/dist/types/index.d.ts +64 -1
- package/package.json +4 -2
- package/src/components/assistant-ui/thread.tsx +7 -3
- package/src/components/ui/time-range-picker.test.ts +57 -0
- package/src/components/ui/time-range-picker.tsx +29 -4
- package/src/contexts/ElementsProvider.tsx +57 -8
- package/src/hooks/useGramThreadListAdapter.tsx +68 -6
- package/src/index.ts +16 -0
- package/src/lib/cassette.ts +1 -19
- package/src/lib/contextCompaction.test.ts +2 -2
- package/src/lib/contextCompaction.ts +20 -8
- package/src/lib/messageConverter.ts +94 -56
- package/src/lib/models.ts +19 -7
- package/src/lib/utils.ts +20 -0
- package/src/types/index.ts +73 -1
- package/dist/index-BCV7Zf9E.cjs +0 -194
- package/dist/index-BCV7Zf9E.cjs.map +0 -1
- package/dist/index-CGoLfO5p.js.map +0 -1
- package/dist/index-DAWGW1Nj.cjs.map +0 -1
- package/dist/index-reVrRxP1.js.map +0 -1
|
@@ -11,6 +11,15 @@ export interface TimeRangePreset {
|
|
|
11
11
|
}
|
|
12
12
|
export declare const PRESETS: TimeRangePreset[];
|
|
13
13
|
export declare function getPresetRange(preset: DateRangePreset): TimeRange;
|
|
14
|
+
type ParseResult = {
|
|
15
|
+
type: "preset";
|
|
16
|
+
preset: DateRangePreset;
|
|
17
|
+
} | {
|
|
18
|
+
type: "custom";
|
|
19
|
+
range: TimeRange;
|
|
20
|
+
label?: string;
|
|
21
|
+
} | null;
|
|
22
|
+
export declare function parseWithAI(input: string, apiUrl: string, projectSlug?: string, authHeaders?: Record<string, string>): Promise<ParseResult>;
|
|
14
23
|
export interface TimeRangePickerProps {
|
|
15
24
|
/** Current preset value */
|
|
16
25
|
preset?: DateRangePreset | null;
|
|
@@ -40,10 +49,17 @@ export interface TimeRangePickerProps {
|
|
|
40
49
|
apiUrl?: string;
|
|
41
50
|
/** Project slug for API authentication */
|
|
42
51
|
projectSlug?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Auth headers to send with the AI parsing request to /chat/completions
|
|
54
|
+
* (e.g. `{ "Gram-Session": token }`). The `/chat/completions` proxy
|
|
55
|
+
* authenticates from request headers, not cookies, so without these the
|
|
56
|
+
* request is rejected with 401 and natural-language parsing silently fails.
|
|
57
|
+
*/
|
|
58
|
+
authHeaders?: Record<string, string>;
|
|
43
59
|
/** Additional class name for the trigger */
|
|
44
60
|
className?: string;
|
|
45
61
|
}
|
|
46
|
-
declare function TimeRangePicker({ preset, customRange, onPresetChange, onCustomRangeChange, onClearCustomRange, customRangeLabel: initialCustomLabel, showLive, isLive, onLiveChange, availablePresets, disabled, timezone, apiUrl, projectSlug, className, }: TimeRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
declare function TimeRangePicker({ preset, customRange, onPresetChange, onCustomRangeChange, onClearCustomRange, customRangeLabel: initialCustomLabel, showLive, isLive, onLiveChange, availablePresets, disabled, timezone, apiUrl, projectSlug, authHeaders, className, }: TimeRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
47
63
|
declare namespace TimeRangePicker {
|
|
48
64
|
var displayName: string;
|
|
49
65
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/elements.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DzZ1-jQY.cjs"),r=require("./index-C08dvTEo.cjs");exports.CREDITS_EXHAUSTED_MESSAGE=e.CREDITS_EXHAUSTED_MESSAGE;exports.Calendar=e.Calendar;exports.Chat=e.Chat;exports.ChatHistory=e.ChatHistory;exports.ElementsProvider=e.ElementsProvider;exports.GramElementsProvider=e.ElementsProvider;exports.MODELS=e.MODELS;exports.MessageContent=e.MessageContent;exports.PRESETS=e.PRESETS;exports.Replay=e.Replay;exports.ShareButton=e.ShareButton;exports.TimeRangePicker=e.TimeRangePicker;exports.ToolFallback=e.ToolFallback;exports.convertGramMessagesToExported=e.convertGramMessagesToExported;exports.convertGramMessagesToUIMessages=e.convertGramMessagesToUIMessages;exports.defineFrontendTool=e.defineFrontendTool;exports.describeStreamError=e.describeStreamError;exports.getPresetRange=e.getPresetRange;exports.trackError=e.trackError;exports.useRecordCassette=e.useRecordCassette;exports.useThreadId=e.useThreadId;exports.sleep=r.sleep;exports.useChatId=r.useChatId;exports.useElements=r.useElements;exports.useGramElements=r.useElements;
|
|
2
2
|
//# sourceMappingURL=elements.cjs.map
|
package/dist/elements.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { aj as s,
|
|
2
|
-
import {
|
|
1
|
+
import { aj as s, ar as r, aa as t, ab as o, a8 as n, a8 as E, al as m, ae as d, aq as l, af as S, ac as T, ao as c, ad as g, an as i, am as C, ah as h, ak as p, ap as u, ai as I, ag as M, a9 as R } from "./index-BFU6NvbL.js";
|
|
2
|
+
import { s as P, W as f, I as k, I as v } from "./index-B5lZrrO2.js";
|
|
3
3
|
export {
|
|
4
4
|
s as CREDITS_EXHAUSTED_MESSAGE,
|
|
5
5
|
r as Calendar,
|
|
@@ -7,21 +7,24 @@ export {
|
|
|
7
7
|
o as ChatHistory,
|
|
8
8
|
n as ElementsProvider,
|
|
9
9
|
E as GramElementsProvider,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
m as MODELS,
|
|
11
|
+
d as MessageContent,
|
|
12
|
+
l as PRESETS,
|
|
13
13
|
S as Replay,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
T as ShareButton,
|
|
15
|
+
c as TimeRangePicker,
|
|
16
|
+
g as ToolFallback,
|
|
17
|
+
i as convertGramMessagesToExported,
|
|
18
|
+
C as convertGramMessagesToUIMessages,
|
|
19
|
+
h as defineFrontendTool,
|
|
20
|
+
p as describeStreamError,
|
|
19
21
|
u as getPresetRange,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
P as sleep,
|
|
23
|
+
I as trackError,
|
|
24
|
+
f as useChatId,
|
|
25
|
+
k as useElements,
|
|
26
|
+
v as useGramElements,
|
|
27
|
+
M as useRecordCassette,
|
|
28
|
+
R as useThreadId
|
|
26
29
|
};
|
|
27
30
|
//# sourceMappingURL=elements.js.map
|
|
@@ -9,6 +9,19 @@ export interface ThreadListAdapterOptions {
|
|
|
9
9
|
headers: Record<string, string>;
|
|
10
10
|
/** Map to translate local thread IDs to UUIDs (shared with transport) */
|
|
11
11
|
localIdToUuidMap?: Map<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Extra query parameters forwarded to `chat.list` to filter which threads are
|
|
14
|
+
* listed. Opaque to the adapter — the consumer chooses the keys.
|
|
15
|
+
*/
|
|
16
|
+
threadListFilters?: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Don't client-mint a chat id for a brand-new thread. When true, `initialize`
|
|
19
|
+
* waits for the transport to assign the id (via the shared `localIdToUuidMap`,
|
|
20
|
+
* e.g. a server-minted id reported through the transport context's
|
|
21
|
+
* `adoptChatId` bind closure) instead of generating one with
|
|
22
|
+
* `crypto.randomUUID()`. Use this when the backend owns chat-id creation.
|
|
23
|
+
*/
|
|
24
|
+
deferThreadIdMinting?: boolean;
|
|
12
25
|
}
|
|
13
26
|
/**
|
|
14
27
|
* Hook that creates a RemoteThreadListAdapter for the Gram API.
|
|
@@ -2945,14 +2945,28 @@ function tX(e, t) {
|
|
|
2945
2945
|
if (!e)
|
|
2946
2946
|
throw new Error(t);
|
|
2947
2947
|
}
|
|
2948
|
-
|
|
2948
|
+
function rX(e, t) {
|
|
2949
|
+
return new Promise((r, n) => {
|
|
2950
|
+
if (t?.aborted) {
|
|
2951
|
+
n(new DOMException("Aborted", "AbortError"));
|
|
2952
|
+
return;
|
|
2953
|
+
}
|
|
2954
|
+
const i = () => {
|
|
2955
|
+
clearTimeout(a), t?.removeEventListener("abort", i), n(new DOMException("Aborted", "AbortError"));
|
|
2956
|
+
}, a = setTimeout(() => {
|
|
2957
|
+
t?.removeEventListener("abort", i), r();
|
|
2958
|
+
}, e);
|
|
2959
|
+
t?.addEventListener("abort", i, { once: !0 });
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2962
|
+
const yI = Pt(null), nX = () => {
|
|
2949
2963
|
const e = mt(yI);
|
|
2950
2964
|
if (!e)
|
|
2951
2965
|
throw new Error("useChatId must be used within ElementsProvider");
|
|
2952
2966
|
return e.chatId;
|
|
2953
2967
|
}, gI = Pt(
|
|
2954
2968
|
void 0
|
|
2955
|
-
),
|
|
2969
|
+
), iX = Pt(null), mA = () => {
|
|
2956
2970
|
const e = mt(gI);
|
|
2957
2971
|
if (!e)
|
|
2958
2972
|
throw new Error("useElements must be used within a ElementsProvider");
|
|
@@ -24828,7 +24842,7 @@ function WK(e) {
|
|
|
24828
24842
|
}
|
|
24829
24843
|
var sE = Symbol("radix.slottable");
|
|
24830
24844
|
// @__NO_SIDE_EFFECTS__
|
|
24831
|
-
function
|
|
24845
|
+
function aX(e) {
|
|
24832
24846
|
const t = ({ children: r }) => /* @__PURE__ */ _(Nr, { children: r });
|
|
24833
24847
|
return t.displayName = `${e}.Slottable`, t.__radixId = sE, t;
|
|
24834
24848
|
}
|
|
@@ -24901,8 +24915,8 @@ var cE = Object.freeze({
|
|
|
24901
24915
|
)
|
|
24902
24916
|
);
|
|
24903
24917
|
uE.displayName = YK;
|
|
24904
|
-
var
|
|
24905
|
-
function
|
|
24918
|
+
var oX = uE;
|
|
24919
|
+
function sX(e, t) {
|
|
24906
24920
|
const r = P.createContext(t), n = (a) => {
|
|
24907
24921
|
const { children: o, ...s } = a, c = P.useMemo(() => s, Object.values(s));
|
|
24908
24922
|
return /* @__PURE__ */ _(r.Provider, { value: c, children: o });
|
|
@@ -29734,7 +29748,7 @@ function V4(e) {
|
|
|
29734
29748
|
const t = ({ children: r }) => /* @__PURE__ */ _(Nr, { children: r });
|
|
29735
29749
|
return t.displayName = `${e}.Slottable`, t.__radixId = wC, t;
|
|
29736
29750
|
}
|
|
29737
|
-
var
|
|
29751
|
+
var cX = /* @__PURE__ */ V4("Slottable");
|
|
29738
29752
|
function K4(e) {
|
|
29739
29753
|
return P.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === wC;
|
|
29740
29754
|
}
|
|
@@ -30193,7 +30207,7 @@ function bY({
|
|
|
30193
30207
|
const OC = Pt(
|
|
30194
30208
|
null
|
|
30195
30209
|
);
|
|
30196
|
-
function
|
|
30210
|
+
function uX({
|
|
30197
30211
|
children: e,
|
|
30198
30212
|
tools: t
|
|
30199
30213
|
}) {
|
|
@@ -30729,7 +30743,7 @@ function XY(e) {
|
|
|
30729
30743
|
return t.filter((i) => !n.has(i.id ?? i.language));
|
|
30730
30744
|
}, t;
|
|
30731
30745
|
}
|
|
30732
|
-
const
|
|
30746
|
+
const lX = XY([zK, YY]);
|
|
30733
30747
|
export {
|
|
30734
30748
|
l6 as A,
|
|
30735
30749
|
Z4 as B,
|
|
@@ -30737,25 +30751,26 @@ export {
|
|
|
30737
30751
|
EE as D,
|
|
30738
30752
|
gI as E,
|
|
30739
30753
|
CE as F,
|
|
30740
|
-
|
|
30741
|
-
|
|
30742
|
-
|
|
30743
|
-
|
|
30744
|
-
|
|
30745
|
-
|
|
30746
|
-
|
|
30747
|
-
|
|
30748
|
-
|
|
30754
|
+
Be as G,
|
|
30755
|
+
MG as H,
|
|
30756
|
+
mA as I,
|
|
30757
|
+
RI as J,
|
|
30758
|
+
yA as K,
|
|
30759
|
+
xA as L,
|
|
30760
|
+
c5 as M,
|
|
30761
|
+
pE as N,
|
|
30762
|
+
hE as O,
|
|
30749
30763
|
pe as P,
|
|
30750
|
-
|
|
30764
|
+
bv as Q,
|
|
30751
30765
|
BE as R,
|
|
30752
|
-
|
|
30753
|
-
|
|
30754
|
-
|
|
30755
|
-
|
|
30756
|
-
|
|
30757
|
-
|
|
30758
|
-
|
|
30766
|
+
cX as S,
|
|
30767
|
+
iX as T,
|
|
30768
|
+
CI as U,
|
|
30769
|
+
fo as V,
|
|
30770
|
+
nX as W,
|
|
30771
|
+
eX as X,
|
|
30772
|
+
YY as Y,
|
|
30773
|
+
zK as Z,
|
|
30759
30774
|
tX as a,
|
|
30760
30775
|
er as b,
|
|
30761
30776
|
fc as c,
|
|
@@ -30767,20 +30782,20 @@ export {
|
|
|
30767
30782
|
TG as i,
|
|
30768
30783
|
Ya as j,
|
|
30769
30784
|
z5 as k,
|
|
30770
|
-
|
|
30785
|
+
sX as l,
|
|
30771
30786
|
mT as m,
|
|
30772
30787
|
u6 as n,
|
|
30773
30788
|
d6 as o,
|
|
30774
|
-
|
|
30775
|
-
|
|
30776
|
-
|
|
30777
|
-
|
|
30778
|
-
|
|
30789
|
+
aX as p,
|
|
30790
|
+
oX as q,
|
|
30791
|
+
lX as r,
|
|
30792
|
+
rX as s,
|
|
30793
|
+
yI as t,
|
|
30779
30794
|
Br as u,
|
|
30780
|
-
|
|
30781
|
-
|
|
30782
|
-
|
|
30783
|
-
|
|
30784
|
-
|
|
30795
|
+
uX as v,
|
|
30796
|
+
ae as w,
|
|
30797
|
+
wA as x,
|
|
30798
|
+
W4 as y,
|
|
30799
|
+
yr as z
|
|
30785
30800
|
};
|
|
30786
|
-
//# sourceMappingURL=index-
|
|
30801
|
+
//# sourceMappingURL=index-B5lZrrO2.js.map
|