@mgamadeus/ddd-agents 0.1.6 → 0.1.8

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 CHANGED
@@ -130,6 +130,10 @@ key the generator cannot see as a literal is wrapped in `textKey("…")`.
130
130
  | `showsTopBlurBand` | `false` | the frosted band under a floating top bar, following the chat pane |
131
131
  | `composerRef` | — | `setComposerDraft(text)` puts a draft into the mounted composer, never sends |
132
132
  | `ThinkingIndicator` | `AgentChatActivityIndicator` | the activity at the tail of the thread; `AgentChatActivityStack` is the stacked feed (one sentence per tool call, older lines drifting up under a top mask, a polite status region for the newest), and `(props) => <AgentChatActivityIndicator {...props} dotsVariant="pulse" />` the calm dots |
133
+ | `ThinkingIndicator` mounting | — | always mounted, also between turns: the resting avatar under the last message (`active` and `isAgentWorkingOnTask` false); its props carry the `chatStore` and `unansweredWidgetMessageId` (an open widget question) |
134
+ | `AssistantAvatar` | — | a face left of each assistant message, at its top (`AgentChatAssistantAvatarProps`: the message) |
135
+ | `onMessageSent` | — | `(messageText) => …` once for every accepted send (typed, a widget's, the opening request's), e.g. a send animation |
136
+ | `inputActionsSlot` / `inputActionsSlotStart` | — | host controls in the composer's action row; the package fills only its own icons, a host icon keeps its own fill |
133
137
  | `activityTiming` | `AgentsEnvironment.chatActivityTiming`, else the package | the activity read window (3000 ms), the read floor while a turn runs (4000), the line paces (2200 / 1400 with a backlog) and the success beat (1400); a host with a realtime push that writes `activityUpdatedAt` lowers the read window so a narrated line shows at once |
134
138
 
135
139
  The canvas split fits by the width of the chat's own container (`ResizeObserver`), not the viewport: below 850 px the
package/dist/chat.js CHANGED
@@ -411,6 +411,7 @@ const aiGlow = "agents_aiGlow_ymjeH5";
411
411
  const editableInput = "agents_editableInput_bxHt-e";
412
412
  const showPlaceholder = "agents_showPlaceholder_Q8SwX5";
413
413
  const actions = "agents_actions_IOFQ5W";
414
+ const ownAction = "agents_ownAction_Mcpl9H";
414
415
  const actionsStart = "agents_actionsStart_AxeqA8";
415
416
  const statusRow = "agents_statusRow_xoILly";
416
417
  const characterCounter = "agents_characterCounter_VbCSLM";
@@ -428,6 +429,7 @@ const styles$i = {
428
429
  editableInput,
429
430
  showPlaceholder,
430
431
  actions,
432
+ ownAction,
431
433
  actionsStart,
432
434
  statusRow,
433
435
  characterCounter,
@@ -658,7 +660,7 @@ const ConversationMessageInput = (props) => {
658
660
  /* @__PURE__ */ jsxs("div", { className: styles$i.actions, children: [
659
661
  !isCompactStacked && !!actionsSlotStart && /* @__PURE__ */ jsx("div", { className: styles$i.actionsStart, children: actionsSlotStart }),
660
662
  actionsSlot,
661
- sendReplacementWhenEmpty && !hasSendableContent ? sendReplacementWhenEmpty : /* @__PURE__ */ jsx("div", { className: classNames({ [styles$i.sendBlocked]: isMessageTooLong }), children: /* @__PURE__ */ jsx(
663
+ sendReplacementWhenEmpty && !hasSendableContent ? sendReplacementWhenEmpty : /* @__PURE__ */ jsx("div", { className: classNames(styles$i.ownAction, { [styles$i.sendBlocked]: isMessageTooLong }), children: /* @__PURE__ */ jsx(
662
664
  Tooltip,
663
665
  {
664
666
  text: isMessageTooLong ? "Your message is over the %maxLength% character limit" : void 0,
@@ -698,6 +700,9 @@ const suggestions = "agents_suggestions_Z6d9ZA";
698
700
  const chatMessages = "agents_chatMessages_XEnoP- agents_narrow_vtbLHb";
699
701
  const messageRow = "agents_messageRow_7dAHb8";
700
702
  const messagesBottom = "agents_messagesBottom_VVwooZ";
703
+ const assistantMessageWithAvatar = "agents_assistantMessageWithAvatar_apVeK1";
704
+ const assistantAvatar = "agents_assistantAvatar_QDnNOx";
705
+ const assistantMessageBesideAvatar = "agents_assistantMessageBesideAvatar_fL4QyP";
701
706
  const classes$1 = {
702
707
  canvasReopenControl,
703
708
  splitViewRoot,
@@ -708,7 +713,10 @@ const classes$1 = {
708
713
  suggestions,
709
714
  chatMessages,
710
715
  messageRow,
711
- messagesBottom
716
+ messagesBottom,
717
+ assistantMessageWithAvatar,
718
+ assistantAvatar,
719
+ assistantMessageBesideAvatar
712
720
  };
713
721
  const avatar = "agents_avatar_Vlh0Vn";
714
722
  const title = "agents_title_j4BUnD";
@@ -1507,6 +1515,7 @@ const ConversationMessageList = ({
1507
1515
  enableFreshMessageBlockReveal,
1508
1516
  taskInstructionMessageId,
1509
1517
  renderAfterMessage,
1518
+ renderAssistantAvatar,
1510
1519
  isConversationClosed = false
1511
1520
  }) => {
1512
1521
  const list = messages ?? [];
@@ -1552,6 +1561,12 @@ const ConversationMessageList = ({
1552
1561
  },
1553
1562
  message2.id
1554
1563
  );
1564
+ if (renderAssistantAvatar) {
1565
+ messageNode = /* @__PURE__ */ jsxs("div", { className: classes$1.assistantMessageWithAvatar, children: [
1566
+ /* @__PURE__ */ jsx("div", { className: classes$1.assistantAvatar, children: renderAssistantAvatar(message2) }),
1567
+ /* @__PURE__ */ jsx("div", { className: classes$1.assistantMessageBesideAvatar, children: messageNode })
1568
+ ] }, message2.id);
1569
+ }
1555
1570
  } else if (message2.role === "SYSTEM" && isDebugMode) {
1556
1571
  messageNode = /* @__PURE__ */ jsx(
1557
1572
  ConversationMessageSystem,
@@ -1832,6 +1847,7 @@ const ConversationViewBody = (props) => {
1832
1847
  isQuestionPinSuspended = false,
1833
1848
  taskInstructionMessageId,
1834
1849
  renderAfterMessage,
1850
+ renderAssistantAvatar,
1835
1851
  isConversationClosed,
1836
1852
  onSuggestionClick,
1837
1853
  onSendMessage
@@ -2099,6 +2115,7 @@ const ConversationViewBody = (props) => {
2099
2115
  enableFreshMessageBlockReveal: enablePinQuestionAndRevealAnswer,
2100
2116
  taskInstructionMessageId,
2101
2117
  renderAfterMessage,
2118
+ renderAssistantAvatar,
2102
2119
  isConversationClosed
2103
2120
  }
2104
2121
  ) }) }) : null
@@ -3670,6 +3687,7 @@ const AgentChatController = (props) => {
3670
3687
  isOnboardingSetupConversation = false,
3671
3688
  sendModelSource,
3672
3689
  onAttachmentsSent,
3690
+ onMessageSent,
3673
3691
  onComposerWidgetsSent,
3674
3692
  attachLibraryFilesToComposer,
3675
3693
  startingIdeasMarkdown,
@@ -3696,6 +3714,7 @@ const AgentChatController = (props) => {
3696
3714
  outgoingAttachments,
3697
3715
  hostComposerWidgets,
3698
3716
  ThinkingIndicator,
3717
+ AssistantAvatar,
3699
3718
  ContentOverlay,
3700
3719
  ActivityHistory,
3701
3720
  children,
@@ -3851,9 +3870,10 @@ const AgentChatController = (props) => {
3851
3870
  chatStore.dispatch({ type: "canvasResetForNewTurn" });
3852
3871
  const model = sendModelSource?.readModelForNextSend();
3853
3872
  const sentMessageText = client.composeSentMessageText ? client.composeSentMessageText(message2, attachments) : message2;
3854
- const reportSentAttachments = () => {
3873
+ const reportAcceptedSend = () => {
3855
3874
  if (attachments?.length) onAttachmentsSent?.();
3856
3875
  if (composerWidgets?.length) onComposerWidgetsSent?.(composerWidgets);
3876
+ onMessageSent?.(message2);
3857
3877
  };
3858
3878
  if (conversation?.id) {
3859
3879
  const postConversationId = conversation.id;
@@ -3863,7 +3883,7 @@ const AgentChatController = (props) => {
3863
3883
  ).catch(
3864
3884
  (failure) => chatStore.dispatch({ type: "messagePostFailed", error: toAgentsClientErrorOfPort(failure) })
3865
3885
  );
3866
- reportSentAttachments();
3886
+ reportAcceptedSend();
3867
3887
  return true;
3868
3888
  }
3869
3889
  if (startingNewConversation) return false;
@@ -3880,7 +3900,7 @@ const AgentChatController = (props) => {
3880
3900
  }).catch((failure) => {
3881
3901
  chatStore.dispatch({ type: "startFailed", error: toAgentsClientErrorOfPort(failure) });
3882
3902
  });
3883
- reportSentAttachments();
3903
+ reportAcceptedSend();
3884
3904
  return true;
3885
3905
  },
3886
3906
  [
@@ -3892,6 +3912,7 @@ const AgentChatController = (props) => {
3892
3912
  sendModelSource,
3893
3913
  onAttachmentsSent,
3894
3914
  onComposerWidgetsSent,
3915
+ onMessageSent,
3895
3916
  isConversationRunEnded,
3896
3917
  rejectAsConversationClosed,
3897
3918
  fetchOpeningPage,
@@ -4029,13 +4050,20 @@ const AgentChatController = (props) => {
4029
4050
  ) : null,
4030
4051
  [ActivityHistory, activityHistoryByTurnMessageId]
4031
4052
  );
4053
+ const unansweredWidgetMessageId = useMemo(() => findUnansweredWidgetMessageId(messages ?? []), [messages]);
4054
+ const renderAssistantAvatar = useCallback(
4055
+ (message2) => AssistantAvatar ? /* @__PURE__ */ jsx(AssistantAvatar, { message: message2 }) : null,
4056
+ [AssistantAvatar]
4057
+ );
4032
4058
  const activityProps = {
4033
4059
  active: agentActivity.active,
4034
4060
  failed: !!error,
4035
4061
  activityTicker,
4036
4062
  isAgentWorkingOnTask: agentActivity.active || activityTicker.phase === "live",
4037
4063
  agentSpaceKey,
4038
- activityTiming: resolvedActivityTiming
4064
+ activityTiming: resolvedActivityTiming,
4065
+ chatStore,
4066
+ unansweredWidgetMessageId
4039
4067
  };
4040
4068
  return /* @__PURE__ */ jsx(CanvasViabilityContext.Provider, { value: canvasViability, children: /* @__PURE__ */ jsx(WidgetRenderReportCollectorContext.Provider, { value: renderReportCollector, children: /* @__PURE__ */ jsxs(
4041
4069
  ConversationWidgetProvider,
@@ -4078,6 +4106,7 @@ const AgentChatController = (props) => {
4078
4106
  allowSendWhileAiThinking: true,
4079
4107
  thinkingIndicator: /* @__PURE__ */ jsx(ThinkingIndicator, { ...activityProps }),
4080
4108
  renderAfterMessage: keepActivityHistoryAfterAnswer ? renderActivityHistoryAfterMessage : void 0,
4109
+ renderAssistantAvatar: AssistantAvatar ? renderAssistantAvatar : void 0,
4081
4110
  hideAssistantMeta: true,
4082
4111
  userMessageTheme: "dark",
4083
4112
  error,
@@ -4559,6 +4588,7 @@ export {
4559
4588
  SUCCESS_BEAT_MS,
4560
4589
  createAgentsChatStore,
4561
4590
  deriveAgentActivity,
4591
+ findUnansweredWidgetMessageId,
4562
4592
  formatElapsedClock,
4563
4593
  isStepStillRunning,
4564
4594
  normalizeServerMessageToMarkdown,