@mgamadeus/ddd-agents 0.1.6 → 0.1.7

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.
@@ -266,3 +266,22 @@
266
266
  }
267
267
  }
268
268
  }
269
+
270
+ // `renderAssistantAvatar`: the host's avatar left of an assistant message, at its top; the message keeps the rest of
271
+ // the row.
272
+ .assistantMessageWithAvatar {
273
+ display: flex;
274
+ align-items: flex-start;
275
+ gap: $x1;
276
+ min-width: 0;
277
+ }
278
+
279
+ .assistantAvatar {
280
+ flex: 0 0 auto;
281
+ display: flex;
282
+ }
283
+
284
+ .assistantMessageBesideAvatar {
285
+ flex: 1 1 auto;
286
+ min-width: 0;
287
+ }
package/dist/styles.css CHANGED
@@ -5811,7 +5811,8 @@ thead + tbody .agents_row_VBlQR-:first-child {
5811
5811
  gap: 0.5rem;
5812
5812
  padding-top: 0.5rem;
5813
5813
  }
5814
- .agents_actions_IOFQ5W svg path {
5814
+
5815
+ .agents_ownAction_Mcpl9H svg path {
5815
5816
  fill: currentColor;
5816
5817
  }
5817
5818
 
@@ -6198,6 +6199,23 @@ thead + tbody .agents_row_VBlQR-:first-child {
6198
6199
  height: var(--agents-illustration-width);
6199
6200
  transform: rotate(-4.841deg);
6200
6201
  aspect-ratio: 1;
6202
+ }
6203
+
6204
+ .agents_assistantMessageWithAvatar_apVeK1 {
6205
+ display: flex;
6206
+ align-items: flex-start;
6207
+ gap: 0.5rem;
6208
+ min-width: 0;
6209
+ }
6210
+
6211
+ .agents_assistantAvatar_QDnNOx {
6212
+ flex: 0 0 auto;
6213
+ display: flex;
6214
+ }
6215
+
6216
+ .agents_assistantMessageBesideAvatar_fL4QyP {
6217
+ flex: 1 1 auto;
6218
+ min-width: 0;
6201
6219
  }.agents_avatar_Vlh0Vn {
6202
6220
  --agents-skeleton-radius: 0.25rem;
6203
6221
  width: 2.5rem;
@@ -57,6 +57,11 @@ interface ConversationMessageListProps {
57
57
  * publishes that gap as `--chat-messages-gap`. Undefined (every other host) renders the rows exactly as before.
58
58
  */
59
59
  renderAfterMessage?: (message: ChatMessage) => React.ReactNode;
60
+ /**
61
+ * Host content beside each shown assistant message (an avatar face, 24–28 px): it stands left of the message, at its
62
+ * top. Undefined (every other host) renders the assistant messages exactly as before.
63
+ */
64
+ renderAssistantAvatar?: (message: ChatMessage) => React.ReactNode;
60
65
  /** The backend refuses every widget signal of a closed conversation, so no widget renders its controls. */
61
66
  isConversationClosed?: boolean;
62
67
  }
@@ -71,5 +76,5 @@ export declare const findUnansweredWidgetMessageId: (messages: ChatMessage[]) =>
71
76
  * widget of the same name. Pure, order-based: the newest widget of a type is the live one.
72
77
  */
73
78
  export declare const findSupersededWidgetMessageIds: (messages: ChatMessage[]) => Set<string | number>;
74
- export declare const ConversationMessageList: ({ className, messages, currentCategory, aiPromptExtension, isDebugMode, aiThinking, thinkingIndicator, hideAssistantMeta, userMessageTheme, error, rateLimitRetryAfterSeconds, onRetryFailedRun, messagesBottomRef, messagesListRef, enableFreshMessageBlockReveal, taskInstructionMessageId, renderAfterMessage, isConversationClosed, }: ConversationMessageListProps) => import("react/jsx-runtime").JSX.Element;
79
+ export declare const ConversationMessageList: ({ className, messages, currentCategory, aiPromptExtension, isDebugMode, aiThinking, thinkingIndicator, hideAssistantMeta, userMessageTheme, error, rateLimitRetryAfterSeconds, onRetryFailedRun, messagesBottomRef, messagesListRef, enableFreshMessageBlockReveal, taskInstructionMessageId, renderAfterMessage, renderAssistantAvatar, isConversationClosed, }: ConversationMessageListProps) => import("react/jsx-runtime").JSX.Element;
75
80
  export {};
@@ -217,6 +217,8 @@ export interface ConversationViewProps {
217
217
  * started each turn. Forwarded through ConversationViewBody to ConversationMessageList. Undefined changes nothing.
218
218
  */
219
219
  renderAfterMessage?: (message: ChatMessage) => React.ReactNode;
220
+ /** Host content beside each shown assistant message (an avatar face), forwarded through ConversationViewBody. */
221
+ renderAssistantAvatar?: (message: ChatMessage) => React.ReactNode;
220
222
  /** Forwarded through ConversationViewBody to ConversationMessageList: a closed conversation renders no widget controls. */
221
223
  isConversationClosed?: boolean;
222
224
  onSuggestionClick: (text: string) => void;
@@ -218,6 +218,8 @@ export interface ConversationViewProps {
218
218
  * activity card under the message that started each turn). Undefined changes nothing.
219
219
  */
220
220
  renderAfterMessage?: (message: ChatMessage) => React.ReactNode;
221
+ /** Host content beside each shown assistant message (an avatar face), forwarded to ConversationMessageList. */
222
+ renderAssistantAvatar?: (message: ChatMessage) => React.ReactNode;
221
223
  /** Forwarded to ConversationMessageList: a closed conversation renders no widget controls. */
222
224
  isConversationClosed?: boolean;
223
225
  onSuggestionClick: (text: string) => void;
@@ -1,6 +1,7 @@
1
1
  import { type ComponentType, type HTMLAttributes, type ReactNode, type Ref, type RefObject } from "react";
2
2
  import type { AgentsConversationClient } from "../../client/AgentsConversationClient";
3
3
  import { type ConversationAttachmentReference } from "../../contract/conversation";
4
+ import type { ChatMessage } from "../chat-message";
4
5
  import type { ConversationComposerWidget } from "../../renderer/conversation-composer-widget";
5
6
  import type { ComposerLibraryFile } from "../../renderer/composer-library-file";
6
7
  import type { AgentsChatStore } from "../store/create-agents-chat-store";
@@ -20,6 +21,19 @@ export interface AgentChatActivityProps {
20
21
  agentSpaceKey: number;
21
22
  /** The chat's resolved activity timing (`activityTiming`, the environment's, the package's), for the component's motion. */
22
23
  activityTiming?: ResolvedAgentChatActivityTiming;
24
+ /** The chat's store, for a component that reads more of the chat's state (`useAgentsChatSelector`). */
25
+ chatStore: AgentsChatStore;
26
+ /**
27
+ * The newest widget-carrying assistant message the owner has not answered yet (no later owner message, no later
28
+ * widget click) — null when there is none ({@link findUnansweredWidgetMessageId}). Whether that widget waits for an
29
+ * answer is the widget class's `AWAITS_OWNER_INPUT` on the server; the wire does not carry it, so a host that tells
30
+ * questions from other widgets checks the widget names of that message itself.
31
+ */
32
+ unansweredWidgetMessageId: string | number | null;
33
+ }
34
+ /** What the host's avatar beside an assistant message gets (`AssistantAvatar`). */
35
+ export interface AgentChatAssistantAvatarProps {
36
+ message: ChatMessage;
23
37
  }
24
38
  /** What the host's activity history under a message gets: the finished turn that message started, if any. */
25
39
  export interface AgentChatActivityHistoryProps {
@@ -76,6 +90,12 @@ export interface AgentChatControllerProps {
76
90
  sendModelSource?: AgentChatSendModelSource;
77
91
  /** Called after a send that carried attachments, so the host clears them from the composer. */
78
92
  onAttachmentsSent?: () => void;
93
+ /**
94
+ * Called once for every send the chat accepted (typed, a widget's send, the opening request's message), with the
95
+ * text as sent, right when it goes out — e.g. for a host's send animation. A refused send (a closed conversation, a
96
+ * start still in flight) reports nothing.
97
+ */
98
+ onMessageSent?: (messageText: string) => void;
79
99
  /**
80
100
  * Called after an accepted send that carried composer widgets (the widget context's and `hostComposerWidgets`), with
81
101
  * those widgets — the host clears the ones it owns.
@@ -115,8 +135,14 @@ export interface AgentChatControllerProps {
115
135
  outgoingAttachments?: ConversationAttachmentReference[];
116
136
  /** Composer widgets the host holds outside the widget context, sent with the next send (see `ConversationMessageInput`). */
117
137
  hostComposerWidgets?: ConversationComposerWidget[];
118
- /** The agent's activity at the tail of the thread (the agent avatar slot). */
138
+ /**
139
+ * The agent's activity at the tail of the thread (the agent avatar slot). Always mounted, also between turns: it is
140
+ * the resting avatar under the last message while `active` and `isAgentWorkingOnTask` are false, and the working one
141
+ * during a turn — one instance, never remounted by a turn's start or end.
142
+ */
119
143
  ThinkingIndicator: ComponentType<AgentChatActivityProps>;
144
+ /** Shown left of each assistant message, at its top (an avatar face, 24–28 px). Undefined: no avatar. */
145
+ AssistantAvatar?: ComponentType<AgentChatAssistantAvatarProps>;
120
146
  /** A layer over the message column (a voice chat's focus mode); shown while `isContentOverlayShown`. */
121
147
  ContentOverlay?: ComponentType<AgentChatActivityProps>;
122
148
  /** The kept activity lines under the message that started a turn (with `keepActivityHistoryAfterAnswer`). */
@@ -1,5 +1,5 @@
1
1
  export { AgentChat, type AgentChatProps } from "../chat/AgentChat/AgentChat";
2
- export { AgentChatController, type AgentChatActivityHistoryProps, type AgentChatActivityProps, type AgentChatComposerHandle, type AgentChatControllerProps, type AgentChatSendModelSource, } from "../chat/controller/AgentChatController";
2
+ export { AgentChatController, type AgentChatActivityHistoryProps, type AgentChatAssistantAvatarProps, type AgentChatActivityProps, type AgentChatComposerHandle, type AgentChatControllerProps, type AgentChatSendModelSource, } from "../chat/controller/AgentChatController";
3
3
  export { useAgentsConversationClient, useOptionalAgentsConversationClient, } from "../client/AgentsConversationClientContext";
4
4
  export { AgentChatActivityIndicator, type AgentChatActivityIndicatorProps, } from "../chat/AgentChatActivityIndicator/AgentChatActivityIndicator";
5
5
  export { AgentChatActivityStack, ACTIVITY_STACK_VISIBLE_LINES } from "../chat/AgentChatActivityStack/AgentChatActivityStack";
@@ -27,7 +27,7 @@ export { ConversationWidgetProvider, type ConversationWidgetProviderProps } from
27
27
  export { CanvasRestoreOnMount, type CanvasRestoreOnMountProps } from "../renderer/canvas/CanvasRestoreOnMount";
28
28
  export { ConversationDeepLinkedWidget, type ConversationDeepLinkedWidgetProps, } from "../renderer/ConversationDeepLinkedWidget";
29
29
  export { CanvasPane } from "../chat/CanvasPane/CanvasPane";
30
- export { ConversationMessageList } from "../chat/ConversationMessageList/ConversationMessageList";
30
+ export { ConversationMessageList, findUnansweredWidgetMessageId, } from "../chat/ConversationMessageList/ConversationMessageList";
31
31
  export { ConversationMessageUser, type ConversationMessageUserProps, type ConversationMessageUserTheme, } from "../chat/ConversationMessage/ConversationMessageUser/ConversationMessageUser";
32
32
  export { ConversationMessageWidgets, type ConversationMessageWidgetsProps, } from "../chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageWidgets";
33
33
  export { ConversationMessageSystem, type ConversationMessageSystemProps, } from "../chat/ConversationMessage/ConversationMessageSystem/ConversationMessageSystem";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgamadeus/ddd-agents",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "The web frontend of the ddd-agents module: the agent chat, the widget renderer and the composed-view kit.",
5
5
  "keywords": [
6
6
  "ddd",
package/public-api.json CHANGED
@@ -602,6 +602,7 @@
602
602
  "SUCCESS_BEAT_MS",
603
603
  "createAgentsChatStore",
604
604
  "deriveAgentActivity",
605
+ "findUnansweredWidgetMessageId",
605
606
  "formatElapsedClock",
606
607
  "isStepStillRunning",
607
608
  "normalizeServerMessageToMarkdown",
@@ -630,6 +631,7 @@
630
631
  "AgentChatActivityIndicatorProps",
631
632
  "AgentChatActivityProps",
632
633
  "AgentChatActivityTiming",
634
+ "AgentChatAssistantAvatarProps",
633
635
  "AgentChatComposerHandle",
634
636
  "AgentChatControllerProps",
635
637
  "AgentChatProps",