@mgamadeus/ddd-agents 0.1.1 → 0.1.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.
- package/README.md +100 -0
- package/dist/chat.js +132 -111
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{ConversationMessageInputComposerWidgets-BO3jS0eZ.js → ConversationMessageInputComposerWidgets-r_RwCqr7.js} +11 -8
- package/dist/chunks/ConversationMessageInputComposerWidgets-r_RwCqr7.js.map +1 -0
- package/dist/chunks/{WebSearchResultsConversationWidget-H6cbTapV.js → WebSearchResultsConversationWidget-BXt98hGu.js} +161 -102
- package/dist/chunks/WebSearchResultsConversationWidget-BXt98hGu.js.map +1 -0
- package/dist/chunks/{canvas-behaviours-AvzKSYyv.js → canvas-behaviours-BpN_1xdZ.js} +2 -2
- package/dist/chunks/{canvas-behaviours-AvzKSYyv.js.map → canvas-behaviours-BpN_1xdZ.js.map} +1 -1
- package/dist/chunks/{canvas-reducers-Cdxt8yDF.js → canvas-reducers-CuX6L1zg.js} +3 -3
- package/dist/chunks/{canvas-reducers-Cdxt8yDF.js.map → canvas-reducers-CuX6L1zg.js.map} +1 -1
- package/dist/chunks/{canvasBodies-CsLrZ-M-.js → canvasBodies-Ds-cTn47.js} +9 -6
- package/dist/chunks/{canvasBodies-CsLrZ-M-.js.map → canvasBodies-Ds-cTn47.js.map} +1 -1
- package/dist/chunks/{canvasStorage-EvQsGdto.js → canvasStorage-DHNluopA.js} +2 -2
- package/dist/chunks/{canvasStorage-EvQsGdto.js.map → canvasStorage-DHNluopA.js.map} +1 -1
- package/dist/chunks/compose-attachment-message-text-FvVJbrge.js +8 -0
- package/dist/chunks/compose-attachment-message-text-FvVJbrge.js.map +1 -0
- package/dist/chunks/{contract-BxmMxYPF.js → contract-Z08LBOqt.js} +4 -3
- package/dist/chunks/contract-Z08LBOqt.js.map +1 -0
- package/dist/chunks/conversation-BEF0aesf.js.map +1 -1
- package/dist/chunks/host-color-scheme-Jhb7JZR7.js +30 -0
- package/dist/chunks/host-color-scheme-Jhb7JZR7.js.map +1 -0
- package/dist/chunks/{index-7Qc_3GbG.js → link-navigation-DyTApNeA.js} +156 -73
- package/dist/chunks/link-navigation-DyTApNeA.js.map +1 -0
- package/dist/chunks/text-key-DnoZ4lAk.js +6 -0
- package/dist/chunks/text-key-DnoZ4lAk.js.map +1 -0
- package/dist/chunks/{widget-click-signal-sources-1gIs1yiN.js → widget-click-signal-sources-Ch-y8gxw.js} +9 -5
- package/dist/chunks/{widget-click-signal-sources-1gIs1yiN.js.map → widget-click-signal-sources-Ch-y8gxw.js.map} +1 -1
- package/dist/chunks/{widget-image-readiness-signal-D3ci53xr.js → widget-image-readiness-signal-C5yaKpJJ.js} +2 -2
- package/dist/chunks/{widget-image-readiness-signal-D3ci53xr.js.map → widget-image-readiness-signal-C5yaKpJJ.js.map} +1 -1
- package/dist/chunks/{widget-name-resolver-D_ZzXy-Q.js → widget-name-resolver-DboFMAq2.js} +25 -25
- package/dist/chunks/widget-name-resolver-DboFMAq2.js.map +1 -0
- package/dist/chunks/{withPollingChangeSubscription-B16htQGd.js → withPollingChangeSubscription-CNXgt3Ri.js} +6 -2
- package/dist/chunks/withPollingChangeSubscription-CNXgt3Ri.js.map +1 -0
- package/dist/client-testing.js +6 -7
- package/dist/client-testing.js.map +1 -1
- package/dist/client.js +431 -2
- package/dist/client.js.map +1 -1
- package/dist/contract.js +1 -1
- package/dist/files/chat/Conversation.module.scss +1 -1
- package/dist/files/chat/ConversationViewBody/ConversationViewBody.module.scss +1 -1
- package/dist/files/i18n-keys.json +1617 -0
- package/dist/files/image-render/WidgetImageRender.module.scss +9 -3
- package/dist/files/styles/_surfaces.scss +6 -6
- package/dist/image-render.js +7 -7
- package/dist/index.js +64 -55
- package/dist/index.js.map +1 -1
- package/dist/kit.js +2 -2
- package/dist/preview.js +8 -8
- package/dist/provider.js +61 -52
- package/dist/provider.js.map +1 -1
- package/dist/renderer.js +16 -15
- package/dist/styles.css +170 -107
- package/dist/types/chat/AgentChat/AgentChat.d.ts +6 -0
- package/dist/types/chat/controller/AgentChatController.d.ts +28 -1
- package/dist/types/client/AgentsConversationClient.d.ts +7 -1
- package/dist/types/client/compose-attachment-message-text.d.ts +7 -0
- package/dist/types/client/http/agents-http-mappers.d.ts +23 -0
- package/dist/types/client/http/agents-http-wire.d.ts +188 -0
- package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +55 -0
- package/dist/types/client/polling/createPollingConversationChangeSubscription.d.ts +7 -4
- package/dist/types/client/polling/withPollingChangeSubscription.d.ts +3 -2
- package/dist/types/contract/conversation.d.ts +8 -0
- package/dist/types/entries/chat.d.ts +2 -1
- package/dist/types/entries/client.d.ts +4 -0
- package/dist/types/entries/renderer.d.ts +1 -0
- package/dist/types/entries/widgets.d.ts +1 -1
- package/dist/types/provider/components/types.d.ts +5 -2
- package/dist/types/provider/environment.d.ts +13 -0
- package/dist/types/provider/host-color-scheme.d.ts +24 -0
- package/dist/types/provider/index.d.ts +4 -0
- package/dist/types/provider/link-navigation.d.ts +28 -0
- package/dist/types/provider/text-key.d.ts +6 -0
- package/dist/types/renderer/MarkdownLink.d.ts +8 -6
- package/dist/types/widgets/CanvasLauncherWidget/use-canvas-viable.d.ts +43 -9
- package/dist/types/widgets/EntityMentionConversationWidget/shared/entity-mention-presentation.d.ts +1 -1
- package/dist/types/widgets/_shared/modern/WidgetKpiValue.d.ts +2 -1
- package/dist/widgets.js +43 -40
- package/package.json +4 -2
- package/public-api.json +85 -18
- package/dist/chunks/ConversationMessageInputComposerWidgets-BO3jS0eZ.js.map +0 -1
- package/dist/chunks/WebSearchResultsConversationWidget-H6cbTapV.js.map +0 -1
- package/dist/chunks/contract-BxmMxYPF.js.map +0 -1
- package/dist/chunks/index-7Qc_3GbG.js.map +0 -1
- package/dist/chunks/widget-name-resolver-D_ZzXy-Q.js.map +0 -1
- package/dist/chunks/withPollingChangeSubscription-B16htQGd.js.map +0 -1
package/README.md
CHANGED
|
@@ -20,3 +20,103 @@ Entries: `@mgamadeus/ddd-agents` (provider and setup), `/provider` (the provider
|
|
|
20
20
|
`/client`, `/client/testing`, `/preview`, `/image-render`, and the stylesheet `@mgamadeus/ddd-agents/styles.css`
|
|
21
21
|
(import it once). Non-code files (widget documentation, preview fixtures, contracts, the node schema, the
|
|
22
22
|
sandbox frame, SCSS tokens) are exported one subpath per file at their path below `src`. React 19 and the libraries listed under `peerDependencies` come from the application.
|
|
23
|
+
|
|
24
|
+
## The conversation client over HTTP
|
|
25
|
+
|
|
26
|
+
`createAgentsHttpConversationClient` (`/client`) binds the client port to the module's own conversation routes
|
|
27
|
+
(`AgentConversationReadsTrait`, `AgentConversationWritesTrait`, the application's start route of
|
|
28
|
+
`AgentConversationStartTrait`, optionally `AgentSelectableModelsTrait`):
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { createAgentsHttpConversationClient } from "@mgamadeus/ddd-agents/client";
|
|
32
|
+
|
|
33
|
+
const client = createAgentsHttpConversationClient({
|
|
34
|
+
baseUrl: "/api/agents/conversations", // the #[Route] of the application's conversations controller
|
|
35
|
+
fetchOptions: () => ({ headers: { Authorization: `Bearer ${readAccessToken()}` } }), // read per request
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
<AgentsProvider client={client}><AgentChat /></AgentsProvider>;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
| Port function | Route below `baseUrl` |
|
|
42
|
+
|---|---|
|
|
43
|
+
| `listConversations` | `GET /listAllConversations` (root conversations, `agentSpaceId` filter for a key above 0, newest first) |
|
|
44
|
+
| `getConversationMetadata` | `GET /{id}` |
|
|
45
|
+
| `getConversationRunState` | `GET /{id}/runState` |
|
|
46
|
+
| `getNewestMessagesPage`, `getOlderMessagesPage`, `getChangedMessages` | `GET /{id}/messages` (query options `filters`, `orderBy`, `top`, `expand`) |
|
|
47
|
+
| `getConversationActivity` | `GET /{id}/activity` |
|
|
48
|
+
| `searchConversations` | `GET /search` |
|
|
49
|
+
| `searchConversationMessages` | `GET /{id}/messages/search` |
|
|
50
|
+
| `startConversation` | `POST /start`, or `POST /start/{agentSpaceKey}` for a key above 0 (`buildStartPath` changes it) |
|
|
51
|
+
| `postMessage`, `injectSignal`, `retryConversation` | `POST /{id}/postMessage`, `/{id}/injectSignal`, `/{id}/retry` |
|
|
52
|
+
| `renameConversation`, `deleteConversation` | `PATCH /{id}/title`, `DELETE /{id}` |
|
|
53
|
+
| `getSelectableModels` | `GET /selectable-models`, only with `hasSelectableModelsRoute: true` |
|
|
54
|
+
|
|
55
|
+
Further options: `fetch` (default: the global one), `extraRequestParameters` (query parameters per operation),
|
|
56
|
+
`polling` (the intervals of the live updates, or `false` for a host with its own push transport). Attachments travel in
|
|
57
|
+
the message text (`composeAttachmentMessageText`). Every failure rejects with `AgentsClientError`: the `errorCode` of the
|
|
58
|
+
body first (`AI_BUDGET_REACHED`, `RATE_LIMIT_EXCEEDED`, `CONVERSATION_CLOSED`), then the status (429 with `Retry-After`,
|
|
59
|
+
404, 401/403, 5xx), a transport failure as `network`, a cancelled request as `other` / `REQUEST_ABORTED`. The wire types
|
|
60
|
+
(`Wire…`) and the mappers (`mapWireConversation`, `mapWireConversationMessage`, …) are exported for a binding of its own
|
|
61
|
+
over the same routes.
|
|
62
|
+
|
|
63
|
+
**Live updates.** The client comes with the polling default over `GET /{id}/runState`, which reads at once after a post,
|
|
64
|
+
a signal or a retry the server accepted. A binding of its own gets the same from `withPollingChangeSubscription(client)`;
|
|
65
|
+
the port's optional `getConversationRunState` is read before `getConversationMetadata` when a binding has it.
|
|
66
|
+
`useAgentsConversationClient()` (`/client`, `/chat`, the root and `/provider`) returns the client of the chat around —
|
|
67
|
+
the one of `AgentsProvider`, or the `client` an `AgentChat` got as a prop.
|
|
68
|
+
|
|
69
|
+
## Texts and translations
|
|
70
|
+
|
|
71
|
+
Every interface text of the package goes through `AgentsEnvironment.texts.translate(key, replacements, context)`; the key
|
|
72
|
+
is the English text with `%placeholders%`, `context` the plural category (`one` / `other`) where a count decides.
|
|
73
|
+
`@mgamadeus/ddd-agents/i18n-keys.json` lists every key: `key`, `defaultText`, `placeholders`, `contexts`, `usedIn` (the
|
|
74
|
+
source files). Set `texts` app-wide (`setAgentsEnvironment`) or per subtree (`<AgentsProvider environment={{ texts }}>`).
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
setAgentsEnvironment({
|
|
78
|
+
texts: { translate: (key, replacements) => fillPlaceholders(dictionary[key] ?? key, replacements) },
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
In the package, `pnpm i18n-keys` rewrites the manifest from the sources; the build and the specs fail when it is stale. A
|
|
83
|
+
key the generator cannot see as a literal is wrapped in `textKey("…")`.
|
|
84
|
+
|
|
85
|
+
## Links, entities and default components
|
|
86
|
+
|
|
87
|
+
- `AgentsEnvironment.onNavigate(href, event)` decides where every package link goes — Markdown links, sources, kit links
|
|
88
|
+
and the links opened by code (a video's watch page, an `openUrl` action, a gallery image without a lightbox). Return
|
|
89
|
+
`true` when the host navigated (an in-app route), `false` for the default new tab. `AgentsLink` and
|
|
90
|
+
`useAgentsLinkNavigation()` give a host's own widget the same behaviour.
|
|
91
|
+
- `AgentsEnvironment.onOpenEntity(target)` opens the entity of an `openEntity` action on a host route; return `false` to
|
|
92
|
+
open the `entityDetail` canvas as before.
|
|
93
|
+
- `DEFAULT_AGENTS_COMPONENTS` (root, `/provider`) holds the package's default components, so a replacement can wrap one;
|
|
94
|
+
`MarkdownLink` (`/renderer`) is the chat's link component, which a `Markdown` replacement receives as `components.a`.
|
|
95
|
+
|
|
96
|
+
## AgentChat in a host window
|
|
97
|
+
|
|
98
|
+
| Prop | Default | |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| `disableSplitView` | `false` | the message column without the canvas split |
|
|
101
|
+
| `hostHasCanvasSurface` | `!disableSplitView` | whether a canvas may open (with the split off: in a surface of the host's own, e.g. `CanvasPane`) |
|
|
102
|
+
| `backgroundPaintedByHost` | `true` | `false` paints the pane with `--agents-chat-background` |
|
|
103
|
+
| `showsTopBlurBand` | `false` | the frosted band under a floating top bar, following the chat pane |
|
|
104
|
+
| `composerRef` | — | `setComposerDraft(text)` puts a draft into the mounted composer, never sends |
|
|
105
|
+
|
|
106
|
+
The canvas split fits by the width of the chat's own container (`ResizeObserver`), not the viewport: below 850 px the
|
|
107
|
+
open canvas covers the chat. The default `SplitView` honours `coversBelowWidth` the same way. The default chat starts its
|
|
108
|
+
thread at the top of the pane (`--agents-chat-top-padding: 24px` on its chat area); a host with a top bar floating over
|
|
109
|
+
the thread sets that variable on `[data-agents-chat-scroll]` or through its own `chatAreaClassName`.
|
|
110
|
+
|
|
111
|
+
## Stylesheet and theme
|
|
112
|
+
|
|
113
|
+
- The package's root rules (`:root` variables, the image render's `html, body` reset) sit in the cascade layer
|
|
114
|
+
`agents-defaults`: a plain host rule or a host layer declared after it wins (`@layer agents-defaults, base, …;`).
|
|
115
|
+
- Dark: `prefers-color-scheme`, `data-theme="dark|light"` on the root element, and `data-agents-theme="dark|light"`,
|
|
116
|
+
which pins over both. `followHostColorScheme({ darkClassName: "dark" })` or `({ attributeName: "data-mode" })` mirrors
|
|
117
|
+
a host theme kept as a class or an attribute into `data-agents-theme`; it returns the stop.
|
|
118
|
+
- Colour tokens: set the plain variables (`--agents-fg`, `--agents-fg-cta`, `--agents-shadow`, …); package rules mix
|
|
119
|
+
them with `color-mix()`. The `--agents-<name>-rgb` triplets of 0.1 keep working at the root element: each plain colour
|
|
120
|
+
of the triplet list defaults to `rgb(var(--agents-<name>-rgb))`.
|
|
121
|
+
- `--agents-fg-on-accent` is the text on an accent fill (white in light, dark in dark mode); `--agents-fg-on-dark` stays
|
|
122
|
+
white for text over a dark scrim.
|
package/dist/chat.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useEffect, useMemo, useState, useImperativeHandle, useLayoutEffect, useCallback, useContext, memo, Fragment as Fragment$1, useReducer } from "react";
|
|
4
|
-
import { u as useAgentsConversationClient, a as useOptionalAgentsConversationClient } from "./chunks/AgentsConversationClientContext-C4T7g_Qk.js";
|
|
5
|
-
import { w as withPollingChangeSubscription } from "./chunks/withPollingChangeSubscription-
|
|
6
|
-
import {
|
|
4
|
+
import { u as useAgentsConversationClient, a as useOptionalAgentsConversationClient, A as AgentsConversationClientProvider } from "./chunks/AgentsConversationClientContext-C4T7g_Qk.js";
|
|
5
|
+
import { w as withPollingChangeSubscription } from "./chunks/withPollingChangeSubscription-CNXgt3Ri.js";
|
|
6
|
+
import { s as Text, I as Icon, ab as useAgentsTexts, G as GlowFrame, v as Tooltip, B as Button, F as classNames, n as Skeleton, a5 as useAgentsEnvironment, j as Markdown, K as getAgentDisplayName, a3 as useAgentsBudgetLimit, h as InteractiveSurface, L as LoadingSpinner, a1 as translateText, p as SplitView, _ as reportRunningTurn, a2 as useAgentsActiveAgentSpaceKey, P as ProgressBar } from "./chunks/link-navigation-DyTApNeA.js";
|
|
7
7
|
import { i as isAgentsClientError, A as AgentsClientError } from "./chunks/conversation-BEF0aesf.js";
|
|
8
|
-
import { W as WIDGET_FENCE_LANG, G as resolveWidgetName, j as conversationWidgetRegistry, n as findWidgetFencesInMarkdown, o as ConversationWidgetErrorBoundary, p as ConversationWidgetFeatureGate, T as parseWidgetJsonObject, F as resolveCanonicalWidgetName, y as getConversationWidgetRegistryRevision, U as BARE_WIDGET_LINE_GLOBAL, t as closestWidgetNames } from "./chunks/widget-name-resolver-
|
|
9
|
-
import { E as useConversationWidgetContext, p as payloadHashOfInstanceId, j as buildWidgetAgentSpaceKeyProps,
|
|
10
|
-
import { c as canvasBehaviourOf, d as CHAT_COLUMN_MIN_WIDTH_PX, b as CANVAS_MIN_WIDTH_PX, D as DEFAULT_CANVAS_WIDTH_PERCENT, e as canvasWidthPercentOf, C as CANVAS_BOXED_INSET_PX } from "./chunks/canvas-behaviours-
|
|
11
|
-
import { r as readStoredCanvas, c as clearStoredCanvas } from "./chunks/canvasStorage-
|
|
12
|
-
import { r as resolveDeepLinkableWidget, c as WidgetWindowRootContext, C as ConversationMarkdown, i as isWidgetClickSignalSource, b as buildWidgetRenderReportSignal, W as WIDGET_RENDER_REPORT_SIGNAL_SOURCE, e as createWidgetRenderReportCollector, f as WidgetRenderReportCollectorContext } from "./chunks/widget-click-signal-sources-
|
|
13
|
-
import { b as ConversationErrorType, a as ConversationMessageInputComposerWidgets, u as useAgentsChatSelector, C as ConversationWidgetProvider, c as createAgentsChatStore } from "./chunks/ConversationMessageInputComposerWidgets-
|
|
14
|
-
import { A, d, E, I, r, e, f, g, h } from "./chunks/ConversationMessageInputComposerWidgets-
|
|
15
|
-
import {
|
|
8
|
+
import { W as WIDGET_FENCE_LANG, G as resolveWidgetName, j as conversationWidgetRegistry, n as findWidgetFencesInMarkdown, o as ConversationWidgetErrorBoundary, p as ConversationWidgetFeatureGate, T as parseWidgetJsonObject, F as resolveCanonicalWidgetName, y as getConversationWidgetRegistryRevision, U as BARE_WIDGET_LINE_GLOBAL, t as closestWidgetNames } from "./chunks/widget-name-resolver-DboFMAq2.js";
|
|
9
|
+
import { E as useConversationWidgetContext, p as payloadHashOfInstanceId, j as buildWidgetAgentSpaceKeyProps, av as useCanvasViable, a8 as ElementWidthCanvasViability, U as CanvasViabilityContext } from "./chunks/WebSearchResultsConversationWidget-BXt98hGu.js";
|
|
10
|
+
import { c as canvasBehaviourOf, d as CHAT_COLUMN_MIN_WIDTH_PX, b as CANVAS_MIN_WIDTH_PX, D as DEFAULT_CANVAS_WIDTH_PERCENT, e as canvasWidthPercentOf, C as CANVAS_BOXED_INSET_PX } from "./chunks/canvas-behaviours-BpN_1xdZ.js";
|
|
11
|
+
import { r as readStoredCanvas, c as clearStoredCanvas } from "./chunks/canvasStorage-DHNluopA.js";
|
|
12
|
+
import { r as resolveDeepLinkableWidget, c as WidgetWindowRootContext, C as ConversationMarkdown, i as isWidgetClickSignalSource, b as buildWidgetRenderReportSignal, W as WIDGET_RENDER_REPORT_SIGNAL_SOURCE, e as createWidgetRenderReportCollector, f as WidgetRenderReportCollectorContext } from "./chunks/widget-click-signal-sources-Ch-y8gxw.js";
|
|
13
|
+
import { b as ConversationErrorType, a as ConversationMessageInputComposerWidgets, u as useAgentsChatSelector, C as ConversationWidgetProvider, c as createAgentsChatStore } from "./chunks/ConversationMessageInputComposerWidgets-r_RwCqr7.js";
|
|
14
|
+
import { A, d, E, I, r, e, f, g, h } from "./chunks/ConversationMessageInputComposerWidgets-r_RwCqr7.js";
|
|
15
|
+
import { t as textKey } from "./chunks/text-key-DnoZ4lAk.js";
|
|
16
|
+
import { c as canvasBodies } from "./chunks/canvasBodies-Ds-cTn47.js";
|
|
16
17
|
import { c as canvasFeatureFlagOf } from "./chunks/canvas-feature-flags-BmmxC3bz.js";
|
|
17
18
|
import { flushSync } from "react-dom";
|
|
18
|
-
import { b as buildChangedMessagesRequest, d as deriveAgentActivity } from "./chunks/contract-
|
|
19
|
+
import { b as buildChangedMessagesRequest, d as deriveAgentActivity } from "./chunks/contract-Z08LBOqt.js";
|
|
19
20
|
const history = "agents_history_BIbikt";
|
|
20
21
|
const styles$l = {
|
|
21
22
|
history
|
|
@@ -523,10 +524,10 @@ const ConversationMessageInput = (props) => {
|
|
|
523
524
|
} = props;
|
|
524
525
|
const { removeComposerWidget, replaceComposerWidgetFields } = useConversationWidgetContext();
|
|
525
526
|
const [inputValue, setInputValue] = useState("");
|
|
526
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
527
527
|
const inputRef = useRef(null);
|
|
528
528
|
const isComposingRef = useRef(false);
|
|
529
|
-
const
|
|
529
|
+
const texts = useAgentsTexts();
|
|
530
|
+
const translatedPlaceholder = useMemo(() => texts.translate(placeholder), [texts, placeholder]);
|
|
530
531
|
const collapsedPillSizerRef = useRef(null);
|
|
531
532
|
const measuresCollapsedPillWidth = compact2 && !!onCollapsedPillWidthChange;
|
|
532
533
|
const isMessageTooLong = inputValue.length > MAX_MESSAGE_LENGTH;
|
|
@@ -603,12 +604,6 @@ const ConversationMessageInput = (props) => {
|
|
|
603
604
|
isComposingRef.current = false;
|
|
604
605
|
handleInput();
|
|
605
606
|
};
|
|
606
|
-
const handleFocus = () => {
|
|
607
|
-
setIsFocused(true);
|
|
608
|
-
};
|
|
609
|
-
const handleBlur = () => {
|
|
610
|
-
setIsFocused(false);
|
|
611
|
-
};
|
|
612
607
|
const handleContainerMouseDown = (e2) => {
|
|
613
608
|
const target = e2.target;
|
|
614
609
|
if (target === inputRef.current || inputRef.current?.contains(target)) return;
|
|
@@ -686,9 +681,7 @@ const ConversationMessageInput = (props) => {
|
|
|
686
681
|
onCompositionStart: handleCompositionStart,
|
|
687
682
|
onCompositionEnd: handleCompositionEnd,
|
|
688
683
|
onKeyDown: handleKeyPress,
|
|
689
|
-
|
|
690
|
-
onBlur: handleBlur,
|
|
691
|
-
className: `${styles$h.editableInput} ${!inputValue && !isFocused ? styles$h.showPlaceholder : ""}`,
|
|
684
|
+
className: `${styles$h.editableInput} ${!inputValue ? styles$h.showPlaceholder : ""}`,
|
|
692
685
|
"data-placeholder": translatedPlaceholder,
|
|
693
686
|
"data-testid": `${testId}-textarea`
|
|
694
687
|
}
|
|
@@ -821,7 +814,7 @@ const ConversationMessageUser = (props) => {
|
|
|
821
814
|
const { text, isGenericChat, theme = "default" } = props;
|
|
822
815
|
const { text: proseText, widgets } = useMemo(() => splitComposerWidgetFencesFromMessageText(text), [text]);
|
|
823
816
|
const bubbleClass = theme === "light" ? styles$g.whiteBubble : theme === "dark" ? styles$g.darkBubble : theme === "primary" ? styles$g.primaryBubble : void 0;
|
|
824
|
-
const textColor = theme === "light" ? "var(--agents-fg)" : theme === "dark" ? "var(--agents-chat-user-bubble-text)" : "var(--agents-fg-on-
|
|
817
|
+
const textColor = theme === "light" ? "var(--agents-fg)" : theme === "dark" ? "var(--agents-chat-user-bubble-text)" : "var(--agents-fg-on-accent)";
|
|
825
818
|
return /* @__PURE__ */ jsxs("div", { className: classNames(styles$g.message, bubbleClass), "data-testid": "chat-message-user", children: [
|
|
826
819
|
/* @__PURE__ */ jsx(ConversationMessageUserWidgets, { widgets }),
|
|
827
820
|
/* @__PURE__ */ jsx(Text, { allowNewLines: true, translate: false, color: textColor, children: proseText })
|
|
@@ -1060,7 +1053,7 @@ const ConversationMessageHeader = memo((props) => {
|
|
|
1060
1053
|
const { aiPromptExtensionCategory, aiPromptExtension } = props;
|
|
1061
1054
|
const iconName = aiPromptExtension?.iconClass ?? "ai";
|
|
1062
1055
|
return /* @__PURE__ */ jsxs("div", { className: styles$e.responseHeader, children: [
|
|
1063
|
-
/* @__PURE__ */ jsx("span", { className: styles$e.iconContainer, children: /* @__PURE__ */ jsx(Icon, { color: "
|
|
1056
|
+
/* @__PURE__ */ jsx("span", { className: styles$e.iconContainer, children: /* @__PURE__ */ jsx(Icon, { color: "var(--agents-fg-on-accent)", hostIconName: iconName }) }),
|
|
1064
1057
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1065
1058
|
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", children: aiPromptExtension?.name ?? "AI Extensions" }),
|
|
1066
1059
|
aiPromptExtensionCategory !== void 0 ? /* @__PURE__ */ jsx(Text, { role: "caption", replacements: { productName: aiPromptExtensionCategory?.name }, children: "%productName% Assistant" }) : null,
|
|
@@ -1269,7 +1262,7 @@ const ConversationMessageSystemHeader = memo((props) => {
|
|
|
1269
1262
|
const { aiPromptExtensionCategory, aiPromptExtension, isContentExpanded, onExpandContentClick } = props;
|
|
1270
1263
|
return /* @__PURE__ */ jsxs("div", { className: styles$c.responseHeaderLayout, children: [
|
|
1271
1264
|
/* @__PURE__ */ jsxs("div", { className: styles$c.responseHeader, children: [
|
|
1272
|
-
/* @__PURE__ */ jsx("span", { className: styles$c.iconContainer, children: /* @__PURE__ */ jsx(Icon, { color: "
|
|
1265
|
+
/* @__PURE__ */ jsx("span", { className: styles$c.iconContainer, children: /* @__PURE__ */ jsx(Icon, { color: "var(--agents-fg-on-accent)", name: "wizard" }) }),
|
|
1273
1266
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1274
1267
|
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", children: aiPromptExtension?.name ?? "AI Extensions" }),
|
|
1275
1268
|
aiPromptExtensionCategory !== void 0 ? /* @__PURE__ */ jsxs(Text, { role: "caption", children: [
|
|
@@ -1330,11 +1323,11 @@ const formatCallDuration = (durationSeconds) => {
|
|
|
1330
1323
|
return `${minutes}:${String(seconds).padStart(2, "0")} min`;
|
|
1331
1324
|
};
|
|
1332
1325
|
const MARKER_LABELS = {
|
|
1333
|
-
started: { inApp: "Voice chat started", phoneLine: "Phone call started" },
|
|
1334
|
-
ended: { inApp: "Voice chat ended", phoneLine: "Phone call ended" },
|
|
1335
|
-
declined: { inApp: "You declined a voice chat with %agentName%", phoneLine: "Phone call declined" },
|
|
1336
|
-
missed: { inApp: "You missed a voice chat with %agentName%", phoneLine: "Phone call not answered" },
|
|
1337
|
-
notConnected: { inApp: "Voice chat did not connect", phoneLine: "Phone call not answered" }
|
|
1326
|
+
started: { inApp: textKey("Voice chat started"), phoneLine: textKey("Phone call started") },
|
|
1327
|
+
ended: { inApp: textKey("Voice chat ended"), phoneLine: textKey("Phone call ended") },
|
|
1328
|
+
declined: { inApp: textKey("You declined a voice chat with %agentName%"), phoneLine: textKey("Phone call declined") },
|
|
1329
|
+
missed: { inApp: textKey("You missed a voice chat with %agentName%"), phoneLine: textKey("Phone call not answered") },
|
|
1330
|
+
notConnected: { inApp: textKey("Voice chat did not connect"), phoneLine: textKey("Phone call not answered") }
|
|
1338
1331
|
};
|
|
1339
1332
|
const callMarkerStateOf = (isCallEnd, endReason) => {
|
|
1340
1333
|
if (!isCallEnd) return "started";
|
|
@@ -1657,15 +1650,15 @@ const ConversationSuggestionWidget = (props) => {
|
|
|
1657
1650
|
AssistantIconBadge,
|
|
1658
1651
|
{
|
|
1659
1652
|
iconName: suggestion.iconClass ?? "",
|
|
1660
|
-
color: "
|
|
1661
|
-
backgroundColor: "
|
|
1653
|
+
color: "var(--agents-fg-on-accent)",
|
|
1654
|
+
backgroundColor: "color-mix(in srgb, var(--agents-neutral-000) 20%, transparent)"
|
|
1662
1655
|
}
|
|
1663
1656
|
) : null,
|
|
1664
1657
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1665
|
-
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", color: "
|
|
1666
|
-
/* @__PURE__ */ jsx(Text, { role: "caption", color: "
|
|
1658
|
+
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", color: "var(--agents-fg-on-accent)", children: suggestion.name }),
|
|
1659
|
+
/* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-on-accent)", children: suggestion.description })
|
|
1667
1660
|
] }),
|
|
1668
|
-
/* @__PURE__ */ jsx(Icon, { color: "
|
|
1661
|
+
/* @__PURE__ */ jsx(Icon, { color: "var(--agents-fg-on-accent)", className: styles$6.arrowIcon, name: "arrowRight" })
|
|
1669
1662
|
] }) });
|
|
1670
1663
|
};
|
|
1671
1664
|
const ConversationIntroWidget = ({
|
|
@@ -1680,7 +1673,7 @@ const ConversationIntroWidget = ({
|
|
|
1680
1673
|
AssistantIconBadge,
|
|
1681
1674
|
{
|
|
1682
1675
|
iconName: aiPromptExtensionIcon,
|
|
1683
|
-
color: "
|
|
1676
|
+
color: "var(--agents-fg-on-accent)",
|
|
1684
1677
|
backgroundColor: "var(--agents-assistant-400)",
|
|
1685
1678
|
isLarge: true
|
|
1686
1679
|
}
|
|
@@ -3686,9 +3679,21 @@ const AgentChatController = (props) => {
|
|
|
3686
3679
|
ThinkingIndicator,
|
|
3687
3680
|
ContentOverlay,
|
|
3688
3681
|
ActivityHistory,
|
|
3689
|
-
children
|
|
3682
|
+
children,
|
|
3683
|
+
disableSplitView = false,
|
|
3684
|
+
hostHasCanvasSurface = !disableSplitView,
|
|
3685
|
+
backgroundPaintedByHost: backgroundPaintedByHost2 = true,
|
|
3686
|
+
composerRef
|
|
3690
3687
|
} = props;
|
|
3688
|
+
const [canvasViability] = useState(() => new ElementWidthCanvasViability());
|
|
3691
3689
|
const conversationMessageInputApiRef = useRef(null);
|
|
3690
|
+
useImperativeHandle(
|
|
3691
|
+
composerRef,
|
|
3692
|
+
() => ({
|
|
3693
|
+
setComposerDraft: (text) => conversationMessageInputApiRef.current?.insertTextIntoInput(text)
|
|
3694
|
+
}),
|
|
3695
|
+
[]
|
|
3696
|
+
);
|
|
3692
3697
|
useEffect(() => {
|
|
3693
3698
|
if (!initialComposerPrompt) return;
|
|
3694
3699
|
conversationMessageInputApiRef.current?.insertTextIntoInput(initialComposerPrompt);
|
|
@@ -3997,79 +4002,90 @@ const AgentChatController = (props) => {
|
|
|
3997
4002
|
isAgentWorkingOnTask: agentActivity.active || activityTicker.phase === "live",
|
|
3998
4003
|
agentSpaceKey
|
|
3999
4004
|
};
|
|
4000
|
-
return /* @__PURE__ */ jsx(
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4005
|
+
return /* @__PURE__ */ jsx(CanvasViabilityContext.Provider, { value: canvasViability, children: /* @__PURE__ */ jsx(WidgetRenderReportCollectorContext.Provider, { value: renderReportCollector, children: /* @__PURE__ */ jsxs(
|
|
4006
|
+
ConversationWidgetProvider,
|
|
4007
|
+
{
|
|
4008
|
+
callbacks: widgetCallbacks,
|
|
4009
|
+
chatStore,
|
|
4010
|
+
hostHasCanvasSurface,
|
|
4011
|
+
children: [
|
|
4012
|
+
/* @__PURE__ */ jsx(
|
|
4013
|
+
ConversationDeepLinkedWidget,
|
|
4014
|
+
{
|
|
4015
|
+
widgetName: deepLinkedWidget?.name,
|
|
4016
|
+
agentSpaceKey
|
|
4017
|
+
},
|
|
4018
|
+
deepLinkedWidget?.mountKey ?? 0
|
|
4019
|
+
),
|
|
4020
|
+
/* @__PURE__ */ jsx(CanvasRestoreOnMount, { conversationId: liveConversationId, messages }),
|
|
4021
|
+
children,
|
|
4022
|
+
/* @__PURE__ */ jsx("div", { className: chatAreaClassName, ref: canvasViability.observe, children: /* @__PURE__ */ jsx("div", { className: chatWrapClassName, children: /* @__PURE__ */ jsx(
|
|
4023
|
+
ConversationView,
|
|
4024
|
+
{
|
|
4025
|
+
enableCanvasToggle: true,
|
|
4026
|
+
boxCanvasBelowTopBar: true,
|
|
4027
|
+
disableSplitView,
|
|
4028
|
+
confineTopBlurBandToChatPane: confineTopBlurBandToChatPane2,
|
|
4029
|
+
progressStepperSlot,
|
|
4030
|
+
enablePinQuestionAndRevealAnswer: true,
|
|
4031
|
+
isQuestionPinSuspended,
|
|
4032
|
+
scrollRef: chatScrollRef,
|
|
4033
|
+
scrollToBottomNonce,
|
|
4034
|
+
followBottomRef,
|
|
4035
|
+
scrollJumpActiveRef,
|
|
4036
|
+
backgroundPaintedByHost: backgroundPaintedByHost2,
|
|
4037
|
+
currentCategory: void 0,
|
|
4038
|
+
aiPromptExtension: void 0,
|
|
4039
|
+
suggestions: void 0,
|
|
4040
|
+
messages: chatMessages2,
|
|
4041
|
+
aiThinking: agentActivity.active,
|
|
4042
|
+
allowSendWhileAiThinking: true,
|
|
4043
|
+
thinkingIndicator: /* @__PURE__ */ jsx(ThinkingIndicator, { ...activityProps }),
|
|
4044
|
+
renderAfterMessage: keepActivityHistoryAfterAnswer ? renderActivityHistoryAfterMessage : void 0,
|
|
4045
|
+
hideAssistantMeta: true,
|
|
4046
|
+
userMessageTheme: "dark",
|
|
4047
|
+
error,
|
|
4048
|
+
rateLimitRetryAfterSeconds,
|
|
4049
|
+
onRetryFailedRun: handleRetryFailedRun,
|
|
4050
|
+
isDebugMode: false,
|
|
4051
|
+
categoriesLoaded: true,
|
|
4052
|
+
conversationId: conversationId ?? conversation?.id ?? void 0,
|
|
4053
|
+
startingNewConversation,
|
|
4054
|
+
showMessagesWithoutConversation: true,
|
|
4055
|
+
hasMoreOlder,
|
|
4056
|
+
loadingOlder,
|
|
4057
|
+
onLoadOlder: loadOlderOfLiveConversation,
|
|
4058
|
+
autoScroll: !!conversationId || (messages?.length ?? 0) > 0,
|
|
4059
|
+
isCompact,
|
|
4060
|
+
inputActionsSlot,
|
|
4061
|
+
inputTopSlot,
|
|
4062
|
+
inputSendDisabled,
|
|
4063
|
+
inputReplacementSlot,
|
|
4064
|
+
inputBandSlot,
|
|
4065
|
+
inputPlaceholder,
|
|
4066
|
+
inputSendReplacementWhenEmpty,
|
|
4067
|
+
inputGlowUnderlay,
|
|
4068
|
+
contentOverlaySlot: ContentOverlay ? /* @__PURE__ */ jsx(ContentOverlay, { ...activityProps }) : void 0,
|
|
4069
|
+
isContentOverlayShown,
|
|
4070
|
+
outgoingAttachmentImages: outgoingAttachments,
|
|
4071
|
+
taskInstructionMessageId,
|
|
4072
|
+
isConversationClosed: isConversationRunEnded,
|
|
4073
|
+
conversationMessageInputApiRef,
|
|
4074
|
+
onSuggestionClick: () => {
|
|
4075
|
+
},
|
|
4076
|
+
onSendMessage: handleSendMessage
|
|
4077
|
+
}
|
|
4078
|
+
) }) })
|
|
4079
|
+
]
|
|
4080
|
+
}
|
|
4081
|
+
) }) });
|
|
4068
4082
|
};
|
|
4069
4083
|
const chatArea = "agents_chatArea_4XiCda";
|
|
4084
|
+
const chatAreaWithTopBlurBand = "agents_chatAreaWithTopBlurBand_W-AdU0";
|
|
4070
4085
|
const chatWrap = "agents_chatWrap_yS-zs5";
|
|
4071
4086
|
const styles$3 = {
|
|
4072
4087
|
chatArea,
|
|
4088
|
+
chatAreaWithTopBlurBand,
|
|
4073
4089
|
chatWrap
|
|
4074
4090
|
};
|
|
4075
4091
|
const selectConversation = (state) => state.conversation;
|
|
@@ -4085,8 +4101,10 @@ const AgentChat = (props) => {
|
|
|
4085
4101
|
conversationId: appConversationId,
|
|
4086
4102
|
onNewConversation,
|
|
4087
4103
|
inputReplacementSlot,
|
|
4088
|
-
chatAreaClassName
|
|
4104
|
+
chatAreaClassName,
|
|
4089
4105
|
chatWrapClassName = styles$3.chatWrap,
|
|
4106
|
+
showsTopBlurBand = false,
|
|
4107
|
+
confineTopBlurBandToChatPane: confineTopBlurBandToChatPane2 = showsTopBlurBand,
|
|
4090
4108
|
...controllerProps
|
|
4091
4109
|
} = props;
|
|
4092
4110
|
const mountedClient = useOptionalAgentsConversationClient();
|
|
@@ -4120,10 +4138,11 @@ const AgentChat = (props) => {
|
|
|
4120
4138
|
if (client === null) {
|
|
4121
4139
|
throw new Error("AgentChat has no conversation client: pass `client`, or mount it in <AgentsProvider client={…}>.");
|
|
4122
4140
|
}
|
|
4123
|
-
return /* @__PURE__ */ jsx(
|
|
4141
|
+
return /* @__PURE__ */ jsx(AgentsConversationClientProvider, { client, children: /* @__PURE__ */ jsx(
|
|
4124
4142
|
AgentChatController,
|
|
4125
4143
|
{
|
|
4126
4144
|
...controllerProps,
|
|
4145
|
+
confineTopBlurBandToChatPane: confineTopBlurBandToChatPane2,
|
|
4127
4146
|
chatStore,
|
|
4128
4147
|
client,
|
|
4129
4148
|
agentSpaceKey,
|
|
@@ -4133,10 +4152,10 @@ const AgentChat = (props) => {
|
|
|
4133
4152
|
ThinkingIndicator,
|
|
4134
4153
|
ActivityHistory,
|
|
4135
4154
|
inputReplacementSlot: inputReplacementSlot ?? (isConversationRunEnded ? /* @__PURE__ */ jsx(ConversationClosedBar, {}) : void 0),
|
|
4136
|
-
chatAreaClassName,
|
|
4155
|
+
chatAreaClassName: chatAreaClassName ?? classNames(styles$3.chatArea, showsTopBlurBand ? styles$3.chatAreaWithTopBlurBand : void 0),
|
|
4137
4156
|
chatWrapClassName
|
|
4138
4157
|
}
|
|
4139
|
-
);
|
|
4158
|
+
) });
|
|
4140
4159
|
};
|
|
4141
4160
|
const useDebouncedSemanticSearch = (fetcher, enabled) => {
|
|
4142
4161
|
const [query, setQuery] = useState("");
|
|
@@ -4450,9 +4469,11 @@ export {
|
|
|
4450
4469
|
useAgentsChatSelector,
|
|
4451
4470
|
f as useAgentsChatState,
|
|
4452
4471
|
g as useAgentsChatStore,
|
|
4472
|
+
useAgentsConversationClient,
|
|
4453
4473
|
useAgentsConversationRunStatus,
|
|
4454
4474
|
useConversationMessageSearch,
|
|
4455
4475
|
useConversationsSearch,
|
|
4456
|
-
h as useOptionalAgentsChatStore
|
|
4476
|
+
h as useOptionalAgentsChatStore,
|
|
4477
|
+
useOptionalAgentsConversationClient
|
|
4457
4478
|
};
|
|
4458
4479
|
//# sourceMappingURL=chat.js.map
|