@meshagent/meshagent-tailwind 0.55.1 → 0.55.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 (38) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +34 -3
  3. package/dist/cjs/chat/agent-thread.d.ts +42 -7
  4. package/dist/cjs/chat/agent-thread.js +422 -183
  5. package/dist/cjs/chat/chat-input-state.d.ts +2 -0
  6. package/dist/cjs/chat/chat-input-state.js +41 -0
  7. package/dist/cjs/chat/chat-input.d.ts +14 -2
  8. package/dist/cjs/chat/chat-input.js +41 -76
  9. package/dist/cjs/chat/chat-scroller.js +45 -43
  10. package/dist/cjs/chat/chat-thread-timeline.d.ts +2 -0
  11. package/dist/cjs/chat/chat-thread-timeline.js +83 -10
  12. package/dist/cjs/chat/composer-action-button.d.ts +11 -0
  13. package/dist/cjs/chat/composer-action-button.js +68 -0
  14. package/dist/cjs/chat/use-chat-virtualizer.d.ts +14 -17
  15. package/dist/cjs/chat/use-chat-virtualizer.js +288 -222
  16. package/dist/cjs/chat/virtualization.d.ts +0 -5
  17. package/dist/cjs/chat/virtualization.js +4 -6
  18. package/dist/cjs/index.d.ts +1 -0
  19. package/dist/cjs/index.js +1 -0
  20. package/dist/esm/chat/agent-thread.d.ts +42 -7
  21. package/dist/esm/chat/agent-thread.js +424 -186
  22. package/dist/esm/chat/chat-input-state.d.ts +2 -0
  23. package/dist/esm/chat/chat-input-state.js +21 -0
  24. package/dist/esm/chat/chat-input.d.ts +14 -2
  25. package/dist/esm/chat/chat-input.js +41 -76
  26. package/dist/esm/chat/chat-scroller.js +46 -44
  27. package/dist/esm/chat/chat-thread-timeline.d.ts +2 -0
  28. package/dist/esm/chat/chat-thread-timeline.js +83 -10
  29. package/dist/esm/chat/composer-action-button.d.ts +11 -0
  30. package/dist/esm/chat/composer-action-button.js +48 -0
  31. package/dist/esm/chat/use-chat-virtualizer.d.ts +14 -17
  32. package/dist/esm/chat/use-chat-virtualizer.js +290 -226
  33. package/dist/esm/chat/virtualization.d.ts +0 -5
  34. package/dist/esm/chat/virtualization.js +4 -6
  35. package/dist/esm/index.d.ts +1 -0
  36. package/dist/esm/index.js +1 -0
  37. package/dist/index.css +1 -1
  38. package/package.json +6 -5
@@ -28,8 +28,7 @@ __export(virtualization_exports, {
28
28
  getTotalHeight: () => getTotalHeight,
29
29
  getVirtualWindowMetrics: () => getVirtualWindowMetrics,
30
30
  getVisiblePageRange: () => getVisiblePageRange,
31
- isNearBottom: () => isNearBottom,
32
- shouldAdjustScrollForHeightChange: () => shouldAdjustScrollForHeightChange
31
+ isNearBottom: () => isNearBottom
33
32
  });
34
33
  module.exports = __toCommonJS(virtualization_exports);
35
34
  const DEFAULT_PAGE_SIZE = 25;
@@ -54,7 +53,9 @@ function buildPageHeights(pageCount, measuredHeights) {
54
53
  const heights = [];
55
54
  for (let index = 0; index < pageCount; index += 1) {
56
55
  const measuredHeight = measuredHeights.get(index);
57
- heights.push(measuredHeight !== void 0 && measuredHeight > 0 ? measuredHeight : 0);
56
+ heights.push(
57
+ measuredHeight !== void 0 && measuredHeight > 0 ? measuredHeight : 0
58
+ );
58
59
  }
59
60
  return heights;
60
61
  }
@@ -138,6 +139,3 @@ function getVirtualWindowMetrics(prefixHeights, range) {
138
139
  function isNearBottom(args) {
139
140
  return args.scrollHeight - args.scrollTop - args.clientHeight <= Math.max(0, args.thresholdPx);
140
141
  }
141
- function shouldAdjustScrollForHeightChange(args) {
142
- return !args.isAtBottom && args.changedPageIndex <= Math.max(0, args.firstVisiblePageIndex);
143
- }
@@ -3,6 +3,7 @@ export { ChatFeedWidget } from './chat/chat-feed-widget.js';
3
3
  export type { ToolCall, ToolCallStatus } from './chat/chat-feed-widget.js';
4
4
  export * from './chat/chat-hooks.js';
5
5
  export * from './chat/chat-input.js';
6
+ export * from './chat/composer-action-button.js';
6
7
  export * from './chat/chat-message.js';
7
8
  export * from './chat/chat-typing-indicator.js';
8
9
  export * from './chat/conversation-descriptor.js';
package/dist/cjs/index.js CHANGED
@@ -31,6 +31,7 @@ __reExport(index_exports, require("./chat/chat-bot-view.js"), module.exports);
31
31
  var import_chat_feed_widget = require("./chat/chat-feed-widget.js");
32
32
  __reExport(index_exports, require("./chat/chat-hooks.js"), module.exports);
33
33
  __reExport(index_exports, require("./chat/chat-input.js"), module.exports);
34
+ __reExport(index_exports, require("./chat/composer-action-button.js"), module.exports);
34
35
  __reExport(index_exports, require("./chat/chat-message.js"), module.exports);
35
36
  __reExport(index_exports, require("./chat/chat-typing-indicator.js"), module.exports);
36
37
  __reExport(index_exports, require("./chat/conversation-descriptor.js"), module.exports);
@@ -1,8 +1,11 @@
1
1
  import type { ReactElement, ReactNode } from "react";
2
2
  import type { RoomClient, Tool } from "@meshagent/meshagent";
3
3
  import type { AgentMessage, AgentMessageEvent, BaseChatClient, ClientToolkitDescription } from "@meshagent/meshagent-agents";
4
- import type { AgentUsageSnapshot } from "./chat-thread-timeline.js";
4
+ import type { AgentUsageSnapshot, ChatThreadItem } from "./chat-thread-timeline.js";
5
5
  export { AgentUsageSnapshot, shouldReplaceAgentUsageSnapshot } from "./chat-thread-timeline.js";
6
+ export type { ChatThreadItem } from "./chat-thread-timeline.js";
7
+ import { type ChatInputProps } from "./chat-input.js";
8
+ import { ChatMessage } from "./chat-message.js";
6
9
  import type { ChatFeedWidget } from "./chat-feed-widget.js";
7
10
  export declare class AgentToolChoice {
8
11
  readonly toolkitName: string;
@@ -42,6 +45,9 @@ export interface AgentThreadProps {
42
45
  closeThreadOnUnmount?: boolean;
43
46
  onPersistedEventsInjectionStarted?: () => void;
44
47
  onPersistedEventsInjected?: (error: unknown | null) => void;
48
+ /** Called before a valid local submission begins any asynchronous work. */
49
+ onSubmissionStarted?: (message: ChatMessage, steeringTurnId?: string) => void;
50
+ onSubmissionFailed?: (message: ChatMessage, error: unknown) => void;
45
51
  onEventsChanged?: (threadId: string, events: readonly AgentMessageEvent[], latestMessage: AgentMessage | null) => void;
46
52
  }
47
53
  export interface AgentThreadProviderProps extends AgentThreadProps {
@@ -50,7 +56,7 @@ export interface AgentThreadProviderProps extends AgentThreadProps {
50
56
  export declare function formatAgentUsageTokenCount(value: number): string;
51
57
  export declare function formatAgentUsageFooter(usage: AgentUsageSnapshot): string;
52
58
  export declare function formatAgentUsageTooltip(usage: AgentUsageSnapshot): string;
53
- export declare function AgentUsageFooter({ usage, className }: {
59
+ export declare function AgentUsageFooter({ usage, className, }: {
54
60
  usage: AgentUsageSnapshot | null;
55
61
  className?: string;
56
62
  }): ReactElement;
@@ -69,7 +75,7 @@ export interface ShellLineProps {
69
75
  title?: string;
70
76
  className?: string;
71
77
  }
72
- export declare function ShellLine({ command, result, stdout, stderr, argumentsText, logs, title, className }: ShellLineProps): ReactElement | null;
78
+ export declare function ShellLine({ command, result, stdout, stderr, argumentsText, logs, title, className, }: ShellLineProps): ReactElement | null;
73
79
  export type EventLineState = "info" | "queued" | "running" | "in_progress" | "completed" | "failed" | "cancelled";
74
80
  export interface EventLineProps {
75
81
  headline: string;
@@ -79,14 +85,43 @@ export interface EventLineProps {
79
85
  failed?: boolean;
80
86
  className?: string;
81
87
  }
82
- export declare function EventLine({ headline, details, state, failed, className }: EventLineProps): ReactElement | null;
88
+ export declare function EventLine({ headline, details, state, failed, className, }: EventLineProps): ReactElement | null;
83
89
  export interface ChatThreadPreviewProps {
84
90
  room?: RoomClient;
85
91
  path: string;
86
92
  className?: string;
87
93
  }
88
94
  export declare function ChatThreadPreview({ room, path, className }: ChatThreadPreviewProps): ReactElement;
89
- export declare function AgentThreadProvider({ children, room, path, chatClient, disposeChatClient, agentName, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, collapseMessages, enableFileUpload, persistedEvents, deferLiveEvents, loadThread, injectPersistedEvents, composerDisabled: composerDisabledProp, closeThreadOnUnmount, onPersistedEventsInjectionStarted, onPersistedEventsInjected, onEventsChanged, }: AgentThreadProviderProps): ReactElement;
90
- export declare function AgentThreadFeed(): ReactElement;
91
- export declare function AgentThreadInput(): ReactElement;
95
+ export declare function AgentThreadProvider({ children, room, path, chatClient, disposeChatClient, agentName, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, collapseMessages, enableFileUpload, persistedEvents, deferLiveEvents, loadThread, injectPersistedEvents, composerDisabled: composerDisabledProp, closeThreadOnUnmount, onPersistedEventsInjectionStarted, onPersistedEventsInjected, onEventsChanged, onSubmissionStarted, onSubmissionFailed, }: AgentThreadProviderProps): ReactElement;
96
+ export interface AgentThreadFeedState {
97
+ /** Visible feed items in chronological order, including grouped tool calls. */
98
+ items: readonly ChatThreadItem[];
99
+ }
100
+ export declare function useAgentThreadFeedState(): AgentThreadFeedState;
101
+ /** Controls for application-owned turn status presentations. */
102
+ export declare function useAgentThreadStatus(): {
103
+ canInterrupt: boolean;
104
+ interrupt: () => Promise<void>;
105
+ };
106
+ export interface AgentThreadFeedProps {
107
+ /** Show the built-in progress overlay and reserve its bottom spacing. Defaults to true. */
108
+ showStatusIndicator?: boolean;
109
+ /** Renders application-owned content after a visible feed item without sending it to the agent. */
110
+ renderAfterItem?: (item: ChatThreadItem) => ReactNode;
111
+ /** Renders local content before the oldest item, or in place of the empty state. */
112
+ renderUnanchored?: () => ReactNode;
113
+ }
114
+ export declare function AgentThreadFeed({ renderAfterItem, renderUnanchored, showStatusIndicator, }?: AgentThreadFeedProps): ReactElement;
115
+ export interface AgentThreadInputProps extends Pick<ChatInputProps, "className" | "inputRowClassName" | "textareaClassName" | "leadingButton"> {
116
+ showSubmitButton?: boolean;
117
+ submitButtonComponent?: ChatInputProps["submitButtonComponent"];
118
+ }
119
+ export declare function AgentThreadInput({ className, inputRowClassName, textareaClassName, leadingButton, showSubmitButton, submitButtonComponent, }?: AgentThreadInputProps): ReactElement;
120
+ export interface AgentThreadSubmitButtonProps {
121
+ className?: string;
122
+ icon?: ReactNode;
123
+ title?: string;
124
+ ariaLabel?: string;
125
+ }
126
+ export declare function AgentThreadSubmitButton({ className, icon, title, ariaLabel, }?: AgentThreadSubmitButtonProps): ReactElement;
92
127
  export declare function AgentThread(props: AgentThreadProps): ReactElement;