@gram-ai/elements 1.38.0 → 1.38.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.
Files changed (29) hide show
  1. package/dist/components/ActiveChatTitle.d.ts +22 -0
  2. package/dist/components/ActiveChatTitle.test.d.ts +1 -0
  3. package/dist/components/activeChatTitle.helpers.d.ts +12 -0
  4. package/dist/components/ui/tool-ui.d.ts +12 -8
  5. package/dist/elements.cjs +1 -1
  6. package/dist/elements.css +1 -1
  7. package/dist/elements.js +25 -24
  8. package/dist/{index--UMkUr53.js → index-CNSYMffp.js} +24353 -24258
  9. package/dist/index-CNSYMffp.js.map +1 -0
  10. package/dist/{index-Cz9y5YHw.cjs → index-DTZOelvp.cjs} +72 -72
  11. package/dist/index-DTZOelvp.cjs.map +1 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/{profiler-jAEvoPXB.cjs → profiler-CZDIhdNN.cjs} +2 -2
  14. package/dist/{profiler-jAEvoPXB.cjs.map → profiler-CZDIhdNN.cjs.map} +1 -1
  15. package/dist/{profiler-BHXyuGiY.js → profiler-DiD0upYa.js} +2 -2
  16. package/dist/{profiler-BHXyuGiY.js.map → profiler-DiD0upYa.js.map} +1 -1
  17. package/dist/{startRecording-Dw4aGDrV.cjs → startRecording-B2vd2HGG.cjs} +2 -2
  18. package/dist/{startRecording-Dw4aGDrV.cjs.map → startRecording-B2vd2HGG.cjs.map} +1 -1
  19. package/dist/{startRecording-D8IbKhJo.js → startRecording-DAV031k-.js} +2 -2
  20. package/dist/{startRecording-D8IbKhJo.js.map → startRecording-DAV031k-.js.map} +1 -1
  21. package/package.json +1 -1
  22. package/src/components/ActiveChatTitle.test.ts +39 -0
  23. package/src/components/ActiveChatTitle.tsx +152 -0
  24. package/src/components/activeChatTitle.helpers.ts +16 -0
  25. package/src/components/ui/tool-ui.tsx +48 -37
  26. package/src/hooks/useGramThreadListAdapter.tsx +37 -2
  27. package/src/index.ts +1 -0
  28. package/dist/index--UMkUr53.js.map +0 -1
  29. package/dist/index-Cz9y5YHw.cjs.map +0 -1
@@ -0,0 +1,22 @@
1
+ export interface ActiveChatTitleProps {
2
+ className?: string;
3
+ /**
4
+ * Title text size. `sm` suits the compact dock header; `base` matches the
5
+ * larger full-screen conversation header. Defaults to `sm`.
6
+ */
7
+ size?: "sm" | "base";
8
+ }
9
+ /**
10
+ * Inline-editable title for the active conversation, intended for a chat
11
+ * header. Reads the active thread's title from the assistant-ui runtime and
12
+ * saves edits through `threadListItem().rename`, which optimistically updates
13
+ * the runtime and calls the Gram thread-list adapter (→ chat.generateTitle).
14
+ *
15
+ * Renaming requires a persisted thread (a remote id). A brand-new conversation
16
+ * only has a local id until its first message, so the title renders as a
17
+ * read-only "New Chat" until then. Clearing the title (saving empty) resets it
18
+ * to automatic, session-context naming.
19
+ *
20
+ * Must be rendered inside an Elements runtime provider.
21
+ */
22
+ export declare function ActiveChatTitle({ className, size, }: ActiveChatTitleProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export declare const MAX_TITLE_LENGTH = 200;
2
+ export declare const FALLBACK_TITLE = "New Chat";
3
+ /**
4
+ * Decides what a title edit should persist. Trims the draft; reports `changed`
5
+ * false when it matches the current (already-trimmed) title so an untouched
6
+ * edit — including the empty "New Chat" fallback — saves nothing. An empty
7
+ * trimmed value is a deliberate reset to automatic naming.
8
+ */
9
+ export declare function resolveTitleEdit(draft: string, currentTitle: string): {
10
+ changed: boolean;
11
+ value: string;
12
+ };
@@ -51,6 +51,12 @@ interface SectionHighlight {
51
51
  /** Mark colour: "risk" (red, default) for findings, "search" (yellow) for a
52
52
  * text-search hit. */
53
53
  tone?: "risk" | "search";
54
+ /** Search tone only: index of the active query occurrence within THIS section
55
+ * (the unified thread navigator's current target). The host owns occurrence
56
+ * stepping, so this is controlled: the occurrence at this index renders bright
57
+ * and scrolls into view; null/undefined means this section holds no active
58
+ * occurrence, so all its hits render pale. */
59
+ activeOccurrence?: number | null;
54
60
  }
55
61
  interface ToolUIProps {
56
62
  /** Display name of the tool */
@@ -76,9 +82,10 @@ interface ToolUIProps {
76
82
  /** When set, highlight occurrences of this query (case-insensitive) in the
77
83
  * tool name — e.g. a thread search for "customer" lights up `get_customer`. */
78
84
  nameQuery?: string;
79
- /** Whether this tool holds the active thread-search match: bright highlights
80
- * (name + sections) when true, pale when false. */
81
- searchActive?: boolean;
85
+ /** Index of the active query occurrence within the tool name (the unified
86
+ * navigator's current target), or null when the active occurrence isn't in the
87
+ * name. Per-section args/output active occurrences ride their `*Highlight`. */
88
+ nameActiveOccurrence?: number | null;
82
89
  /** Additional class names */
83
90
  className?: string;
84
91
  /** MCP tool annotations */
@@ -103,9 +110,6 @@ interface ToolUISectionProps {
103
110
  language?: BundledLanguage;
104
111
  /** Flagged substrings — renders a navigable highlighted view + header icon. */
105
112
  highlight?: SectionHighlight;
106
- /** Search tone only: whether this tool holds the active thread match (bright
107
- * vs pale marks). */
108
- searchActive?: boolean;
109
113
  }
110
114
  declare function StatusIndicator({ status, }: {
111
115
  status: ToolStatus;
@@ -121,11 +125,11 @@ declare function SyntaxHighlightedCode({ text, language, className, }: {
121
125
  declare namespace SyntaxHighlightedCode {
122
126
  var displayName: string;
123
127
  }
124
- declare function ToolUISection({ title, content, defaultExpanded, highlightSyntax, language, highlight, searchActive, }: ToolUISectionProps): React.JSX.Element;
128
+ declare function ToolUISection({ title, content, defaultExpanded, highlightSyntax, language, highlight, }: ToolUISectionProps): React.JSX.Element;
125
129
  declare namespace ToolUISection {
126
130
  var displayName: string;
127
131
  }
128
- declare function ToolUI({ name, icon, provider, status, request, result, defaultExpanded, requestHighlight, resultHighlight, nameQuery, searchActive, className, annotations, onApproveOnce, onApproveForSession, onDeny, }: ToolUIProps): React.JSX.Element;
132
+ declare function ToolUI({ name, icon, provider, status, request, result, defaultExpanded, requestHighlight, resultHighlight, nameQuery, nameActiveOccurrence, className, annotations, onApproveOnce, onApproveForSession, onDeny, }: ToolUIProps): React.JSX.Element;
129
133
  declare namespace ToolUI {
130
134
  var displayName: string;
131
135
  }
package/dist/elements.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Cz9y5YHw.cjs"),r=require("./index-CGBkMd0d.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.Markdown=e.Markdown;exports.MessageContent=e.MessageContent;exports.PRESETS=e.PRESETS;exports.Replay=e.Replay;exports.ShareButton=e.ShareButton;exports.SyntaxHighlightedCode=e.SyntaxHighlightedCode;exports.TimeRangePicker=e.TimeRangePicker;exports.ToolFallback=e.ToolFallback;exports.ToolUI=e.ToolUI;exports.ToolUISection=e.ToolUISection;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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DTZOelvp.cjs"),t=require("./index-CGBkMd0d.cjs");exports.ActiveChatTitle=e.ActiveChatTitle;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.Markdown=e.Markdown;exports.MessageContent=e.MessageContent;exports.PRESETS=e.PRESETS;exports.Replay=e.Replay;exports.ShareButton=e.ShareButton;exports.SyntaxHighlightedCode=e.SyntaxHighlightedCode;exports.TimeRangePicker=e.TimeRangePicker;exports.ToolFallback=e.ToolFallback;exports.ToolUI=e.ToolUI;exports.ToolUISection=e.ToolUISection;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=t.sleep;exports.useChatId=t.useChatId;exports.useElements=t.useElements;exports.useGramElements=t.useElements;
2
2
  //# sourceMappingURL=elements.cjs.map