@mgamadeus/ddd-agents 0.1.1 → 0.1.3
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 +129 -0
- package/dist/chat.js +407 -265
- 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-kmmw_19Y.js} +5 -4
- package/dist/chunks/contract-kmmw_19Y.js.map +1 -0
- package/dist/chunks/{conversation-BEF0aesf.js → conversation-CbWEHPbL.js} +12 -3
- package/dist/chunks/conversation-CbWEHPbL.js.map +1 -0
- 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-CWavoKjJ.js} +7 -3
- package/dist/chunks/withPollingChangeSubscription-CWavoKjJ.js.map +1 -0
- package/dist/client-testing.js +7 -8
- package/dist/client-testing.js.map +1 -1
- package/dist/client.js +470 -2
- package/dist/client.js.map +1 -1
- package/dist/contract.js +6 -5
- 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 +1636 -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 +318 -122
- package/dist/types/chat/AgentChat/AgentChat.d.ts +6 -0
- package/dist/types/chat/AgentChatActivityDots/AgentChatActivityDots.d.ts +11 -0
- package/dist/types/chat/AgentChatActivityIndicator/AgentChatActivityIndicator.d.ts +7 -2
- package/dist/types/chat/AgentChatActivityStack/AgentChatActivityStack.d.ts +15 -0
- package/dist/types/chat/controller/AgentChatController.d.ts +38 -1
- package/dist/types/chat/controller/activity-ticker.d.ts +5 -2
- package/dist/types/chat/controller/chat-activity-timing.d.ts +30 -0
- package/dist/types/chat/controller/use-activity-ticker.d.ts +6 -0
- package/dist/types/chat/controller/use-conversation-activity.d.ts +6 -2
- 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 +30 -0
- package/dist/types/client/http/agents-http-wire.d.ts +201 -0
- package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +64 -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 +35 -0
- package/dist/types/entries/chat.d.ts +6 -2
- 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 +20 -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 +101 -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/conversation-BEF0aesf.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
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { AgentChat, type AgentChatProps } from "../chat/AgentChat/AgentChat";
|
|
2
|
-
export { AgentChatController, type AgentChatActivityHistoryProps, type AgentChatActivityProps, type AgentChatControllerProps, type AgentChatSendModelSource, } from "../chat/controller/AgentChatController";
|
|
3
|
-
export {
|
|
2
|
+
export { AgentChatController, type AgentChatActivityHistoryProps, type AgentChatActivityProps, type AgentChatComposerHandle, type AgentChatControllerProps, type AgentChatSendModelSource, } from "../chat/controller/AgentChatController";
|
|
3
|
+
export { useAgentsConversationClient, useOptionalAgentsConversationClient, } from "../client/AgentsConversationClientContext";
|
|
4
|
+
export { AgentChatActivityIndicator, type AgentChatActivityIndicatorProps, } from "../chat/AgentChatActivityIndicator/AgentChatActivityIndicator";
|
|
5
|
+
export { AgentChatActivityStack, ACTIVITY_STACK_VISIBLE_LINES } from "../chat/AgentChatActivityStack/AgentChatActivityStack";
|
|
6
|
+
export { AgentChatActivityDots, type AgentChatActivityDotsProps, type AgentChatActivityDotsVariant, } from "../chat/AgentChatActivityDots/AgentChatActivityDots";
|
|
4
7
|
export { AgentChatActivityHistory } from "../chat/AgentChatActivityHistory/AgentChatActivityHistory";
|
|
5
8
|
export { ConversationClosedBar, type ConversationClosedBarProps } from "../chat/ConversationClosedBar/ConversationClosedBar";
|
|
6
9
|
export * from "../chat/store";
|
|
@@ -32,4 +35,5 @@ export { ConversationMessageInput, MAX_MESSAGE_LENGTH, type ConversationMessageI
|
|
|
32
35
|
export type { ConversationMessageInputAttachmentPreview, ConversationMessageInputAttachmentUploadStatus, } from "../chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentPreviewWidget";
|
|
33
36
|
export type { AssistantServerMessagePayload } from "../chat/normalize-server-message-to-markdown";
|
|
34
37
|
export { useActivityTicker, SUCCESS_BEAT_MS } from "../chat/controller/use-activity-ticker";
|
|
38
|
+
export { type AgentChatActivityTiming, type ResolvedAgentChatActivityTiming, DEFAULT_AGENT_CHAT_ACTIVITY_TIMING, resolveAgentChatActivityTiming, } from "../chat/controller/chat-activity-timing";
|
|
35
39
|
export { formatElapsedClock, isStepStillRunning, type ActivityTickerLine } from "../chat/controller/activity-ticker";
|
|
@@ -2,3 +2,7 @@ export * from "../client/AgentsConversationClient";
|
|
|
2
2
|
export * from "../client/AgentsConversationClientContext";
|
|
3
3
|
export * from "../client/polling/createPollingConversationChangeSubscription";
|
|
4
4
|
export * from "../client/polling/withPollingChangeSubscription";
|
|
5
|
+
export * from "../client/http/createAgentsHttpConversationClient";
|
|
6
|
+
export * from "../client/http/agents-http-wire";
|
|
7
|
+
export * from "../client/http/agents-http-mappers";
|
|
8
|
+
export { composeAttachmentMessageText } from "../client/compose-attachment-message-text";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ConversationMarkdown, type ConversationMarkdownProps } from "../renderer/ConversationMarkdown";
|
|
2
|
+
export { MarkdownLink, type MarkdownLinkProps } from "../renderer/MarkdownLink";
|
|
2
3
|
export { ConversationWidgetHost, type ConversationWidgetRenderProps } from "../renderer/ConversationWidgetHost";
|
|
3
4
|
export { ConversationWidgetErrorBoundary } from "../renderer/ConversationWidgetErrorBoundary";
|
|
4
5
|
export { type ConversationWidgetUpsellProps, ConversationWidgetFeatureGate, } from "../renderer/_access/ConversationWidgetFeatureGate";
|
|
@@ -18,7 +18,7 @@ export { WebSearchResultsConversationWidget } from "../widgets/WebSearchResultsC
|
|
|
18
18
|
export { WritingDraftConversationWidget } from "../widgets/WritingDraftConversationWidget/WritingDraftConversationWidget";
|
|
19
19
|
export * from "../widgets/_shared/modern";
|
|
20
20
|
export type { CanvasLauncherWidgetCanvas } from "../widgets/CanvasLauncherWidget/CanvasLauncherWidget";
|
|
21
|
-
export { CANVAS_VIABLE_MIN_WIDTH, useCanvasViable } from "../widgets/CanvasLauncherWidget/use-canvas-viable";
|
|
21
|
+
export { CANVAS_VIABLE_MIN_WIDTH, CanvasViabilityContext, type CanvasViabilitySource, ElementWidthCanvasViability, readCanvasViable, useCanvasViable, } from "../widgets/CanvasLauncherWidget/use-canvas-viable";
|
|
22
22
|
export { WidgetLabel } from "../widgets/_shared/WidgetLabel";
|
|
23
23
|
export { WidgetFooter } from "../widgets/_shared/WidgetFooter";
|
|
24
24
|
/** @deprecated Renamed to `WidgetFooter`. */
|
|
@@ -148,7 +148,10 @@ export interface AgentsSplitViewPane {
|
|
|
148
148
|
/** Two panes side by side; the side pane slides in over the right edge and covers the screen below a width. */
|
|
149
149
|
export interface AgentsSplitViewProps {
|
|
150
150
|
isSideOpen: boolean;
|
|
151
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Below this width the open side pane covers the main pane. The package default measures the split view's own box
|
|
153
|
+
* (the chat container); a replacement may keep reading the viewport.
|
|
154
|
+
*/
|
|
152
155
|
coversBelowWidth?: number;
|
|
153
156
|
main: AgentsSplitViewPane;
|
|
154
157
|
side: AgentsSplitViewPane;
|
|
@@ -311,7 +314,7 @@ export interface AgentsHeroValueProps {
|
|
|
311
314
|
color?: string;
|
|
312
315
|
}
|
|
313
316
|
/** The type scale of the widgets, from the hero figure down to the micro label. */
|
|
314
|
-
export type AgentsWidgetTextVariant = "hero" | "headline" | "gaugeValue" | "value" | "caption" | "label" | "micro" | "inherit";
|
|
317
|
+
export type AgentsWidgetTextVariant = "hero" | "headline" | "title" | "gaugeValue" | "value" | "caption" | "label" | "micro" | "inherit";
|
|
315
318
|
export type AgentsWidgetTextTone = "default" | "light" | "cta";
|
|
316
319
|
/** A text of the widget type scale. A string child is a text key unless `translate` is false. */
|
|
317
320
|
export interface AgentsWidgetTextProps {
|
|
@@ -2,8 +2,10 @@ import type { ComponentType, ErrorInfo, ReactNode } from "react";
|
|
|
2
2
|
import type { AgentsComponents } from "./components/types";
|
|
3
3
|
import type { ConversationWidgetStatePartition } from "../renderer/conversation-widget-state-partition";
|
|
4
4
|
import type { ChatAssistantCategory } from "../chat/chat-assistant-identity";
|
|
5
|
+
import type { AgentChatActivityTiming } from "../chat/controller/chat-activity-timing";
|
|
5
6
|
import type { ComposedNodeSchemaApplicationPart } from "../renderer/widget-tree/composed-node-schema";
|
|
6
7
|
import type { CanvasBehaviour } from "../renderer/canvas/canvas-behaviours";
|
|
8
|
+
import type { OpenEntityActionTarget } from "../renderer/canvas/entity-detail-instance";
|
|
7
9
|
/** Translates interface copy. The key is the English source text. */
|
|
8
10
|
export interface AgentsTexts {
|
|
9
11
|
translate: (key: string, replacements?: Record<string, string | number>, context?: string) => string;
|
|
@@ -138,6 +140,12 @@ export interface AgentsEnvironment {
|
|
|
138
140
|
buildWidgetOfAnotherAgentSpaceExplanation?: (agentSpaceLabel: string) => string;
|
|
139
141
|
/** The name the owner knows the agent by, for the interface texts that name it. Default: `the assistant`. */
|
|
140
142
|
agentDisplayName?: string;
|
|
143
|
+
/**
|
|
144
|
+
* The timing of every chat's activity reads and working indicator, for the fields a chat's own `activityTiming`
|
|
145
|
+
* leaves out (`AgentChatActivityTiming`). Default: the package's values (one activity read per 3 s, a line at least
|
|
146
|
+
* 2.2 s beside the face). A host with a realtime push that writes `activityUpdatedAt` lowers the read window.
|
|
147
|
+
*/
|
|
148
|
+
chatActivityTiming?: AgentChatActivityTiming;
|
|
141
149
|
/** A React hook returning what the error card of a reached budget offers. Default: no upgrade, the plain wording. */
|
|
142
150
|
useBudgetLimit?: () => AgentsBudgetLimit;
|
|
143
151
|
/** A React hook returning the map script loader's state. Default: no maps. */
|
|
@@ -154,6 +162,18 @@ export interface AgentsEnvironment {
|
|
|
154
162
|
* replacements, which may read a string as markup. Default: the text unchanged.
|
|
155
163
|
*/
|
|
156
164
|
escapePlainTextForText?: (text: string) => string;
|
|
165
|
+
/**
|
|
166
|
+
* Decides where a link of the package goes — every anchor (Markdown links, sources, kit links) and every link the
|
|
167
|
+
* package opens by code (a video's watch page, an `openUrl` action, a gallery image without a lightbox). `event` is
|
|
168
|
+
* the click, null when there is none. Return true when the host navigated itself (an in-app route; the package then
|
|
169
|
+
* does nothing), false to let the package open the link in a new tab. Default: every link opens in a new tab.
|
|
170
|
+
*/
|
|
171
|
+
onNavigate?: (href: string, event: MouseEvent | null) => boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Opens the entity of an `openEntity` action (a composed view's row, a map point) on a host route instead of the
|
|
174
|
+
* `entityDetail` canvas. Return true when the host opened it, false to open the canvas. Default: the canvas.
|
|
175
|
+
*/
|
|
176
|
+
onOpenEntity?: (target: OpenEntityActionTarget) => boolean;
|
|
157
177
|
/** Opens the images in the app's lightbox, starting at `startIndex`. Default: the start image in a new tab. */
|
|
158
178
|
openImageGallery?: (images: AgentsGalleryImage[], startIndex: number) => void;
|
|
159
179
|
/** Reports a widget that crashed while rendering. Default: nothing (the crash is logged to the console). */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Where a host keeps its colour theme on the root element: a class, or an attribute with a value. */
|
|
2
|
+
export interface HostColorSchemeSource {
|
|
3
|
+
/** The element that carries the theme. Default: the root element (`<html>`). */
|
|
4
|
+
element?: Element;
|
|
5
|
+
/** Dark while the element has this class (e.g. `dark`). */
|
|
6
|
+
darkClassName?: string;
|
|
7
|
+
/** Dark while this attribute (e.g. `data-mode`) has the value `darkAttributeValue`. */
|
|
8
|
+
attributeName?: string;
|
|
9
|
+
/** The attribute's value for dark. Default `dark`. */
|
|
10
|
+
darkAttributeValue?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The attribute on the root element that pins the package's colour scheme (`dark` or `light`). */
|
|
13
|
+
export declare const AGENTS_THEME_ATTRIBUTE_NAME = "data-agents-theme";
|
|
14
|
+
/**
|
|
15
|
+
* Lets the package's colour scheme (its dark set, `color-scheme`) follow a host theme kept as a class or an attribute:
|
|
16
|
+
* mirrors it now and on every change into `data-agents-theme="dark" | "light"` on the root element, which the package
|
|
17
|
+
* stylesheet reads before `prefers-color-scheme` and `data-theme`. Returns the stop, which removes the attribute again.
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* followHostColorScheme({ darkClassName: "dark" }); // <html class="dark">
|
|
21
|
+
* followHostColorScheme({ attributeName: "data-mode" }); // <html data-mode="dark">
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const followHostColorScheme: (source: HostColorSchemeSource) => (() => void);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { AgentsProvider, type AgentsProviderProps, useAgentsActiveAgentSpaceKey, useAgentsBudgetLimit, useAgentsComponents, useAgentsEnvironment, useAgentsMapsLoader, useAgentsOwnerSettings, useAgentsStateDispatch, useAgentsStateSelector, useAgentsTexts, } from "./AgentsProvider";
|
|
2
2
|
export { type AgentsAssistantBackgroundProps, type AgentsAssistantIconBadgeProps, type AgentsBudgetLimit, type AgentsEnvironment, type AgentsGalleryImage, type AgentsMapsLoaderState, type AgentsOwnerSettings, type AgentsSandboxLegacyAliases, type AgentsStateAction, type AgentsStateStore, type AgentsTexts, appendAnotherAgentSpaceToOwnerText, buildUnnamedAgentSpaceLabel, buildWidgetOfAnotherAgentSpaceExplanation, DEFAULT_AGENTS_TEXTS, DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX, DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME, escapePlainTextForText, getAgentDisplayName, getAgentsEnvironment, getFurtherCanvasBehaviours, getFurtherWidgetClickSignalSources, getGoogleMapWidgetNames, getSandboxLegacyAliases, getWidgetImageCaptureReadPathPrefix, getWidgetSelfHydrationKeyFieldName, openImageGallery, reportRunningTurn, reportWidgetCrash, setAgentsEnvironment, translateText, } from "./environment";
|
|
3
3
|
export { classNames } from "./class-names";
|
|
4
|
+
export { useAgentsConversationClient, useOptionalAgentsConversationClient, } from "../client/AgentsConversationClientContext";
|
|
5
|
+
export { AgentsLink, type AgentsLinkNavigation, type AgentsLinkProps, useAgentsLinkNavigation, } from "./link-navigation";
|
|
6
|
+
export { DEFAULT_AGENTS_COMPONENTS } from "./components/default-components";
|
|
7
|
+
export { AGENTS_THEME_ATTRIBUTE_NAME, followHostColorScheme, type HostColorSchemeSource, } from "./host-color-scheme";
|
|
4
8
|
export * from "./components";
|
|
5
9
|
export type { AgentsTextRole, AgentsTextWeight, AgentsTextReplacements, AgentsTextProps, AgentsButtonVariant, AgentsButtonSize, AgentsButtonProps, AgentsIconName, AgentsIconSize, AgentsIconProps, AgentsInteractiveSurfaceProps, AgentsSkeletonProps, AgentsLoadingSpinnerProps, AgentsTooltipProps, AgentsGlowFrameProps, AgentsProgressBarProps, AgentsSplitViewPane, AgentsSplitViewProps, AgentsTrendDeltaProps, AgentsCheckboxProps, AgentsTextInputProps, AgentsTextAreaProps, AgentsRangeSliderProps, AgentsDateInputProps, AgentsChoiceOption, AgentsRadioGroupProps, AgentsSelectOption, AgentsSelectProps, AgentsTabsOption, AgentsTabsProps, AgentsStatusBadgeStatus, AgentsStatusBadgeProps, AgentsMapPosition, AgentsMapProps, AgentsMapMarkerProps, AgentsModalLayerProps, AgentsHeroRowProps, AgentsHeroValueProps, AgentsWidgetTextVariant, AgentsWidgetTextTone, AgentsWidgetTextProps, AgentsSkeletonTextProps, AgentsStatusChipTone, AgentsStatusChipProps, AgentsSegment, AgentsSegmentBarProps, AgentsMarkdownComponents, AgentsMarkdownProps, AgentsWidgetFeatureGateProps, AgentsConversationSearchHit, AgentsConversationSearchGroup, AgentsConversationSearchResultsListProps, AgentsComponents, } from "./components/types";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AnchorHTMLAttributes, type MouseEvent as ReactMouseEvent } from "react";
|
|
2
|
+
import type { AgentsEnvironment } from "./environment";
|
|
3
|
+
/**
|
|
4
|
+
* Opens a link through the environment's `onNavigate` (the host decides: an in-app route, a new tab, nothing), else in
|
|
5
|
+
* a new tab. `event` is the click that asked for it, when there is one.
|
|
6
|
+
*/
|
|
7
|
+
export declare const openLinkThroughEnvironment: (environment: Pick<AgentsEnvironment, "onNavigate">, href: string, event: MouseEvent | null) => void;
|
|
8
|
+
/** How package code opens a link: through the host's `onNavigate`, else in a new tab. */
|
|
9
|
+
export interface AgentsLinkNavigation {
|
|
10
|
+
/** Opens `href` (a link opened by code, e.g. a button: the package's `window.open` places). */
|
|
11
|
+
openLink: (href: string, event?: ReactMouseEvent | MouseEvent) => void;
|
|
12
|
+
/**
|
|
13
|
+
* The click handler of an anchor that opens in a new tab: hands the click to the host's `onNavigate` and keeps the
|
|
14
|
+
* browser from following the anchor when the host took it.
|
|
15
|
+
*/
|
|
16
|
+
handleLinkClick: (event: ReactMouseEvent<HTMLAnchorElement>, href?: string) => void;
|
|
17
|
+
}
|
|
18
|
+
/** The link navigation of this subtree (`AgentsEnvironment.onNavigate`). */
|
|
19
|
+
export declare const useAgentsLinkNavigation: () => AgentsLinkNavigation;
|
|
20
|
+
export type AgentsLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
21
|
+
/** The hast node react-markdown passes to a custom component; never put on the DOM element. */
|
|
22
|
+
node?: unknown;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The anchor every package link renders: a new tab without opener or referrer, unless the host's `onNavigate` takes
|
|
26
|
+
* the click (an in-app route). A host's own widget uses it for the same behaviour.
|
|
27
|
+
*/
|
|
28
|
+
export declare const AgentsLink: (props: AgentsLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks a text key the package translates later, where the translate call does not see it as a literal (a table of
|
|
3
|
+
* labels, a helper's argument): returns the key unchanged. `scripts/i18n-keys.mjs` lists every marked key in
|
|
4
|
+
* `i18n-keys.json`, so a host that translates the package's texts finds it there.
|
|
5
|
+
*/
|
|
6
|
+
export declare const textKey: <Key extends string>(key: Key) => Key;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type MarkdownLinkProps =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type AgentsLinkProps } from "../provider/link-navigation";
|
|
2
|
+
export type MarkdownLinkProps = AgentsLinkProps;
|
|
3
|
+
/**
|
|
4
|
+
* The link of a chat message (the `a` component `ConversationMarkdown` hands to `Markdown`): a new-tab anchor with a
|
|
5
|
+
* dotted underline, or the host's own navigation (`AgentsEnvironment.onNavigate`). A host's `Markdown` replacement may
|
|
6
|
+
* wrap it (`components.a`). `node` is dropped so react-markdown's hast node never lands on the DOM element.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MarkdownLink: (props: MarkdownLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Min
|
|
3
|
-
*
|
|
4
|
-
* a panel that immediately closes.
|
|
2
|
+
* Min width (px) at which the canvas side-panel split is usable. Mirrors the split view's `coversBelowWidth` in
|
|
3
|
+
* ConversationView — below it the open canvas covers the chat, so a canvas widget must render its content inline instead
|
|
4
|
+
* of opening a panel that immediately closes.
|
|
5
5
|
*/
|
|
6
6
|
export declare const CANVAS_VIABLE_MIN_WIDTH = 850;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
* Where the chat reads whether the canvas split fits: the width of the chat's own container. `AgentChatController`
|
|
9
|
+
* measures its chat area and provides it (`CanvasViabilityContext`); without one, the viewport decides.
|
|
10
|
+
*/
|
|
11
|
+
export interface CanvasViabilitySource {
|
|
12
|
+
/** Whether the split fits now. */
|
|
13
|
+
isViable: () => boolean;
|
|
14
|
+
/** Calls `listener` whenever `isViable()` flips; returns the unsubscribe. */
|
|
15
|
+
subscribe: (listener: () => void) => () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The width of one element as the canvas viability (`ResizeObserver`). Until the element is laid out (no width yet: not
|
|
19
|
+
* mounted, or a test DOM without layout) the viewport decides, as before.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ElementWidthCanvasViability implements CanvasViabilitySource {
|
|
22
|
+
protected readonly minWidth: number;
|
|
23
|
+
protected elementWidth: number | null;
|
|
24
|
+
protected viable: boolean;
|
|
25
|
+
protected readonly listeners: Set<() => void>;
|
|
26
|
+
protected resizeObserver: ResizeObserver | null;
|
|
27
|
+
protected observedElement: Element | null;
|
|
28
|
+
constructor(minWidth?: number);
|
|
29
|
+
isViable: () => boolean;
|
|
30
|
+
subscribe: (listener: () => void) => (() => void);
|
|
31
|
+
/** Measures `element` from now on (null stops measuring). A ref callback of the container calls it. */
|
|
32
|
+
observe: (element: Element | null) => void;
|
|
33
|
+
/** The viewport changed: an element not laid out yet follows the viewport. */
|
|
34
|
+
receiveViewportResize: () => void;
|
|
35
|
+
protected receiveWidth(width: number | null): void;
|
|
36
|
+
protected notifyWhenFlipped(): void;
|
|
37
|
+
}
|
|
38
|
+
/** The canvas viability of the chat around (`AgentChatController` provides its chat area's); null = the viewport's. */
|
|
39
|
+
export declare const CanvasViabilityContext: import("react").Context<CanvasViabilitySource | null>;
|
|
40
|
+
/** Whether the split fits: the source's answer, else the viewport's. Read where no hook can (an event handler). */
|
|
41
|
+
export declare const readCanvasViable: (source: CanvasViabilitySource | null) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* True when the chat is wide enough for the canvas side panel: the chat container's width inside a chat that measures
|
|
44
|
+
* it (`CanvasViabilityContext`), else the viewport's. Re-renders the consumer ONLY when the boolean crosses
|
|
45
|
+
* {@link CANVAS_VIABLE_MIN_WIDTH} — NOT on every resize pixel. This matters because the consumers (the canvas widgets,
|
|
46
|
+
* ConversationView) re-mount heavy, self-fetching lists; a width-tracking hook would re-render them on every resize
|
|
47
|
+
* tick and make dragging the window janky.
|
|
14
48
|
*/
|
|
15
49
|
export declare const useCanvasViable: () => boolean;
|
package/dist/types/widgets/EntityMentionConversationWidget/shared/entity-mention-presentation.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type AgentsIconName } from "../../../provider/components";
|
|
2
|
-
export declare const FALLBACK_ENTITY_LABEL
|
|
2
|
+
export declare const FALLBACK_ENTITY_LABEL: "About this entry";
|
|
3
3
|
export declare const entityTypeIcon: (entityType: string) => AgentsIconName;
|
|
4
4
|
export declare const entityTypeFallbackLabel: (entityType: string) => string;
|
|
@@ -19,6 +19,7 @@ export interface WidgetKpiValueProps {
|
|
|
19
19
|
/**
|
|
20
20
|
* The KPI value of the chat widgets and the kit's KPI node: the hero scale (the app's dashboard scale) (48px bold,
|
|
21
21
|
* tabular, scaled down to fit) re-used, never a second type scale. The label is known before the data, so it is never
|
|
22
|
-
* a skeleton. A text value sits
|
|
22
|
+
* a skeleton. A text value (18px, `title`) sits on the bottom of the same hero line box as a number, so the value
|
|
23
|
+
* lines and the lines under them align across a row of KPIs.
|
|
23
24
|
*/
|
|
24
25
|
export declare const WidgetKpiValue: (props: WidgetKpiValueProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/widgets.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { X as WidgetSurface, Y as SkeletonCircle, Z as SkeletonLine, F as useIsEmailWidgetRender } from "./chunks/WebSearchResultsConversationWidget-BXt98hGu.js";
|
|
3
|
+
import { _, $, a0, U, a0 as a02, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, V, as, at, au, av } from "./chunks/WebSearchResultsConversationWidget-BXt98hGu.js";
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { F as classNames, s as Text, r as StatusChip } from "./chunks/link-navigation-DyTApNeA.js";
|
|
6
|
+
import { g, x } from "./chunks/link-navigation-DyTApNeA.js";
|
|
7
7
|
import { useSyncExternalStore, useState, useEffect } from "react";
|
|
8
8
|
const row$1 = "agents_row_3Kb6Jj";
|
|
9
9
|
const withoutLeading = "agents_withoutLeading_7XTCP7";
|
|
@@ -130,52 +130,55 @@ const useElementVisible = (ref) => {
|
|
|
130
130
|
return intersecting && documentVisible;
|
|
131
131
|
};
|
|
132
132
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
_ as CANVAS_VIABLE_MIN_WIDTH,
|
|
134
|
+
$ as CUSTOM_VISUALIZATION_SANDBOX_CONFIG,
|
|
135
|
+
a0 as CanvasLauncherWidget,
|
|
136
|
+
U as CanvasViabilityContext,
|
|
137
|
+
a02 as CanvasWidgetCard,
|
|
138
|
+
a1 as CanvasWidgetSwitch,
|
|
138
139
|
WidgetFooter as CardFooter,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
140
|
+
a2 as ClockConversationWidget,
|
|
141
|
+
a3 as ConceptExplainerConversationWidget,
|
|
142
|
+
a4 as ConversationSearchResultsConversationWidget,
|
|
143
|
+
a5 as CurrencyConverterConversationWidget,
|
|
144
|
+
a6 as CustomVisualizationConversationWidget,
|
|
145
|
+
a7 as DonePill,
|
|
146
|
+
a8 as ElementWidthCanvasViability,
|
|
147
|
+
a9 as EntityMentionConversationWidget,
|
|
148
|
+
g as HeroValue,
|
|
149
|
+
aa as MultiChoiceConversationWidget,
|
|
150
|
+
ab as QuickRepliesConversationWidget,
|
|
149
151
|
SkeletonCircle,
|
|
150
152
|
SkeletonLine,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
ac as SkeletonPill,
|
|
154
|
+
ad as SkeletonWidgetLabel,
|
|
155
|
+
ae as SuggestedActions,
|
|
156
|
+
af as ToolTraceConversationWidget,
|
|
157
|
+
ag as WebSearchResultsConversationWidget,
|
|
156
158
|
WidgetFooter,
|
|
157
|
-
|
|
159
|
+
ah as WidgetKpiValue,
|
|
158
160
|
WidgetLabel,
|
|
159
161
|
WidgetListRow,
|
|
160
162
|
WidgetStatusChip,
|
|
161
163
|
WidgetSurface,
|
|
162
164
|
WidgetSurfaceSkeleton,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
x as WidgetText,
|
|
166
|
+
ai as WritingDraftConversationWidget,
|
|
167
|
+
aj as canvasForMessageWidget,
|
|
166
168
|
createEntityUpdateChannel,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
169
|
+
ak as formatConceptExplainerNumber,
|
|
170
|
+
al as normalizeSearchHitExcerpt,
|
|
171
|
+
am as pickAllowed,
|
|
172
|
+
an as pickAllowedValue,
|
|
173
|
+
ao as pickReviewExternalId,
|
|
174
|
+
ap as pickSafeAlias,
|
|
175
|
+
aq as pickSafeAliases,
|
|
176
|
+
ar as pickText,
|
|
177
|
+
V as readCanvasViable,
|
|
178
|
+
as as readConceptExplainerNumber,
|
|
179
|
+
at as readConceptExplainerValue,
|
|
180
|
+
au as resolveCustomVisualizationFrameUrl,
|
|
181
|
+
av as useCanvasViable,
|
|
179
182
|
useElementVisible
|
|
180
183
|
};
|
|
181
184
|
//# sourceMappingURL=widgets.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgamadeus/ddd-agents",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
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",
|
|
@@ -146,6 +146,7 @@
|
|
|
146
146
|
"./chat/Conversation.module.scss": "./dist/files/chat/Conversation.module.scss",
|
|
147
147
|
"./chat/ConversationViewBody/ConversationViewBody.module.scss": "./dist/files/chat/ConversationViewBody/ConversationViewBody.module.scss",
|
|
148
148
|
"./image-render/WidgetImageRender.module.scss": "./dist/files/image-render/WidgetImageRender.module.scss",
|
|
149
|
+
"./i18n-keys.json": "./dist/files/i18n-keys.json",
|
|
149
150
|
"./package.json": "./package.json"
|
|
150
151
|
},
|
|
151
152
|
"files": [
|
|
@@ -216,8 +217,9 @@
|
|
|
216
217
|
"access": "public"
|
|
217
218
|
},
|
|
218
219
|
"scripts": {
|
|
219
|
-
"build": "node scripts/clean.mjs && vite build && tsc -p tsconfig.build.json && node scripts/check-package.mjs .",
|
|
220
|
+
"build": "node scripts/clean.mjs && node scripts/i18n-keys.mjs --check && vite build && tsc -p tsconfig.build.json && node scripts/check-package.mjs .",
|
|
220
221
|
"check-package": "node scripts/check-package.mjs .",
|
|
222
|
+
"i18n-keys": "node scripts/i18n-keys.mjs --write",
|
|
221
223
|
"test": "vitest run",
|
|
222
224
|
"typecheck": "tsc -p tsconfig.build.json --noEmit --declaration false --emitDeclarationOnly false"
|
|
223
225
|
}
|