@gooddata/sdk-ui-gen-ai 11.67.0-alpha.1 → 11.67.0-alpha.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/NOTICE +943 -2401
- package/README.md +44 -1
- package/esm/components/GenAIChatDialogConnected.d.ts +5 -8
- package/esm/components/GenAIChatDialogConnected.d.ts.map +1 -1
- package/esm/components/GenAIChatDialogConnected.js +4 -5
- package/esm/components/GenAIChatWrapper.js +1 -1
- package/esm/components/hooks/useAppEventSync.d.ts +18 -0
- package/esm/components/hooks/useAppEventSync.d.ts.map +1 -0
- package/esm/components/hooks/useAppEventSync.js +35 -0
- package/esm/components/hooks/useSettingsClick.d.ts +1 -2
- package/esm/components/hooks/useSettingsClick.d.ts.map +1 -1
- package/esm/components/hooks/useSettingsClick.js +7 -20
- package/esm/components/messages/conversationContents/ConversationErrorContent.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationErrorContent.js +1 -4
- package/esm/copilot/CopilotComposingOverlay.d.ts +4 -0
- package/esm/copilot/CopilotComposingOverlay.d.ts.map +1 -0
- package/esm/copilot/CopilotComposingOverlay.js +151 -0
- package/esm/copilot/CopilotInteractionComposing.d.ts +29 -0
- package/esm/copilot/CopilotInteractionComposing.d.ts.map +1 -0
- package/esm/copilot/CopilotInteractionComposing.js +39 -0
- package/esm/copilot/CopilotInteractionComposingWithHandler.d.ts +15 -0
- package/esm/copilot/CopilotInteractionComposingWithHandler.d.ts.map +1 -0
- package/esm/copilot/CopilotInteractionComposingWithHandler.js +11 -0
- package/esm/copilot/selectors.d.ts +4 -2
- package/esm/copilot/selectors.d.ts.map +1 -1
- package/esm/copilot/selectors.js +73 -14
- package/esm/copilot/transitions.d.ts.map +1 -1
- package/esm/copilot/transitions.js +264 -81
- package/esm/copilot/types.d.ts +10 -4
- package/esm/copilot/types.d.ts.map +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -0
- package/esm/internal.d.ts +1 -2
- package/esm/internal.d.ts.map +1 -1
- package/esm/localization/bundles/en-US.localization-bundle.d.ts +8 -0
- package/esm/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-US.localization-bundle.js +8 -0
- package/esm/sdk-ui-gen-ai.d.ts +58 -51
- package/esm/store/events.d.ts +6 -45
- package/esm/store/events.d.ts.map +1 -1
- package/esm/store/sideEffects/onEvent.d.ts +11 -3
- package/esm/store/sideEffects/onEvent.d.ts.map +1 -1
- package/esm/store/sideEffects/onEvent.js +32 -25
- package/esm/utils.d.ts +0 -4
- package/esm/utils.d.ts.map +1 -1
- package/esm/utils.js +1 -21
- package/package.json +25 -26
- package/styles/css/copilotInteractionComposing.css +94 -0
- package/styles/css/copilotInteractionComposing.css.map +1 -0
- package/styles/css/main.css +96 -0
- package/styles/css/main.css.map +1 -1
- package/styles/scss/copilotInteractionComposing.scss +106 -0
- package/styles/scss/main.scss +1 -0
- package/esm/components/hooks/useDashboardSavedSync.d.ts +0 -13
- package/esm/components/hooks/useDashboardSavedSync.d.ts.map +0 -1
- package/esm/components/hooks/useDashboardSavedSync.js +0 -14
- package/esm/components/hooks/usePublisherDocumentSavedSync.d.ts +0 -20
- package/esm/components/hooks/usePublisherDocumentSavedSync.d.ts.map +0 -1
- package/esm/components/hooks/usePublisherDocumentSavedSync.js +0 -18
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Register each build type with its reacting skills, pure definition acceptance po
|
|
|
27
27
|
and host application callback. Create one instance per editor/runtime, not a singleton.
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
|
-
import { CopilotBuildType, CopilotHandler } from "@gooddata/sdk-ui-gen-ai
|
|
30
|
+
import { CopilotBuildType, CopilotHandler } from "@gooddata/sdk-ui-gen-ai";
|
|
31
31
|
|
|
32
32
|
const copilot = new CopilotHandler({
|
|
33
33
|
registrations: [
|
|
@@ -64,6 +64,49 @@ copilot.dispose();
|
|
|
64
64
|
`useCopilotSnapshot(copilot)`; the hook adds no workflow owner. Application-owned string enums
|
|
65
65
|
can replace the built-in `CopilotBuildType` without changing the lifecycle algorithm.
|
|
66
66
|
|
|
67
|
+
Switching conversations clears foreground reasoning, not outstanding workflow ownership.
|
|
68
|
+
Activated creation requests continue to contribute progress across chats; edit and builder
|
|
69
|
+
scopes also include their matching background requests. Unanswered clarification questions keep
|
|
70
|
+
waiting across conversation switches, as do creation/builder workflows awaiting a general follow-up
|
|
71
|
+
reply. Ordinary completed edits without pending questions still release their lock.
|
|
72
|
+
Replying resumes the same workflow; failure, cancellation, target reset, or definition
|
|
73
|
+
application acknowledgement releases it. In-progress applications stay building until acknowledgement.
|
|
74
|
+
Clarifications can be answered through the form or by typing in chat. A clarification event with
|
|
75
|
+
`responses: null` dismisses the form before a typed reply; it does not cancel the workflow or release its lock.
|
|
76
|
+
The originating conversation owns its loader: ordinary messages, reasoning, completion, or failure in
|
|
77
|
+
another chat cannot replace its progress or release its lock. Ownership transfers only when another
|
|
78
|
+
conversation activates a configured skill for the same workflow and target. Superseded responses cannot
|
|
79
|
+
reclaim ownership or restore an old wait after the new workflow finishes; other targets remain independent.
|
|
80
|
+
|
|
81
|
+
## Composing overlay (alpha)
|
|
82
|
+
|
|
83
|
+
Wrap any editor with loading, reasoning, and waiting-for-reply presentation. No dashboard
|
|
84
|
+
configuration or Redux store is needed. The visibility predicate controls only composing UI;
|
|
85
|
+
wrapped content stays mounted. It is evaluated during rendering, so rerender when its inputs change.
|
|
86
|
+
The wrapper fills its host and positions the overlay relative to that host.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { CopilotInteractionComposing } from "@gooddata/sdk-ui-gen-ai";
|
|
90
|
+
import "@gooddata/sdk-ui-gen-ai/styles/css/copilotInteractionComposing.css";
|
|
91
|
+
|
|
92
|
+
<CopilotInteractionComposing
|
|
93
|
+
status="building"
|
|
94
|
+
reasoningTitle="Arranging visualizations"
|
|
95
|
+
isVisible={() => !isExporting}
|
|
96
|
+
onReplyInChat={openChat}
|
|
97
|
+
>
|
|
98
|
+
<Editor />
|
|
99
|
+
</CopilotInteractionComposing>;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Use `generating` or `building` for loading (optionally with a reasoning heading), `waiting`
|
|
103
|
+
for the reply banner, and `idle` for no composing UI. Supply `locale` for localized labels.
|
|
104
|
+
`CopilotInteractionComposingWithHandler` accepts `copilot` and `scope` instead of `status`
|
|
105
|
+
and `reasoningTitle` and subscribes directly to the same runtime-owned handler. Its optional
|
|
106
|
+
`onReplyInChat(threadId)` receives the owning waiting workflow's thread, not whichever
|
|
107
|
+
chat is currently selected. It does not dispose that handler when unmounted. Both variants also
|
|
108
|
+
ship in `styles/css/main.css`.
|
|
109
|
+
|
|
67
110
|
## License
|
|
68
111
|
|
|
69
112
|
(C) 2017-2026 GoodData Corporation
|
|
@@ -4,8 +4,7 @@ import type { GenAIChatEffort, GenAIObjectType, IColorPalette, IGenAIUserContext
|
|
|
4
4
|
import { type ChatAssistantMessageEvent, type ChatClarificationQuestionsEvent, type ChatClosedEvent, type ChatConversationChangedEvent, type ChatCopyToClipboardEvent, type ChatDefinitionReceivedEvent, type ChatEvent, type ChatFeedbackErrorEvent, type ChatFeedbackEvent, type ChatModeChangeEvent, type ChatOpenedEvent, type ChatReasoningEvent, type ChatResetEvent, type ChatSaveVisualizationErrorEvent, type ChatSaveVisualizationSuccessEvent, type ChatUserAnswersEvent, type ChatUserMessageEvent } from "../store/events.js";
|
|
5
5
|
import { type GenAIAssistantDisplayMode, type LinkHandlerEvent } from "./ConfigContext.js";
|
|
6
6
|
import { type GenAIChatDialogProps } from "./GenAIChatDialog.js";
|
|
7
|
-
import { type
|
|
8
|
-
import { type IPublisherDocumentSaved } from "./hooks/usePublisherDocumentSavedSync.js";
|
|
7
|
+
import { type ISequencedAppEvent } from "./hooks/useAppEventSync.js";
|
|
9
8
|
/**
|
|
10
9
|
* Discriminated union of GenAI chat events surfaced to a caller via {@link IGenAIChatDialogConnectedProps.onEvent}.
|
|
11
10
|
*
|
|
@@ -152,12 +151,10 @@ export interface IGenAIChatDialogConnectedProps {
|
|
|
152
151
|
*/
|
|
153
152
|
ambientUserContextLoading?: boolean;
|
|
154
153
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
154
|
+
* Recent events of the application the chat runs beside, such as a save of an object the chat
|
|
155
|
+
* drafted, oldest first. Each delivery carries a new `seq`. Events the chat does not know are ignored.
|
|
157
156
|
*/
|
|
158
|
-
|
|
159
|
-
/** A dashboard save reported by an application. Each save carries a new `seq`. */
|
|
160
|
-
dashboardSaved?: IDashboardSaved;
|
|
157
|
+
appEvents?: ReadonlyArray<ISequencedAppEvent>;
|
|
161
158
|
/**
|
|
162
159
|
* Agent ID to use for the seeded question. If not provided, the default agent will be used.
|
|
163
160
|
*/
|
|
@@ -199,6 +196,6 @@ export interface IGenAIChatDialogConnectedProps {
|
|
|
199
196
|
*
|
|
200
197
|
* @internal
|
|
201
198
|
*/
|
|
202
|
-
export declare function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, effort, isOpen, isDisabled, displayMode, onOpen, onClose, askedQuestion, conversationId, askSeq, userContext, ambientUserContext, ambientUserContextLoading,
|
|
199
|
+
export declare function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, effort, isOpen, isDisabled, displayMode, onOpen, onClose, askedQuestion, conversationId, askSeq, userContext, ambientUserContext, ambientUserContextLoading, appEvents, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks, onLinkClick, returnFocusTo, }: IGenAIChatDialogConnectedProps): import("react/jsx-runtime").JSX.Element;
|
|
203
200
|
export {};
|
|
204
201
|
//# sourceMappingURL=GenAIChatDialogConnected.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAIChatDialogConnected.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatDialogConnected.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAQ9G,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,eAAe,EACpB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,+BAA+B,EACpC,KAAK,iCAAiC,EACtC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAiB5B,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"GenAIChatDialogConnected.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatDialogConnected.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAQ9G,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,e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serContextAction, setHistoryAction, setUserContextAction, }
|
|
|
6
6
|
import { isChatAssistantMessageEvent, isChatClarificationQuestionsEvent, isChatClosedEvent, isChatConversationChangedEvent, isChatCopyToClipboardEvent, isChatDefinitionReceivedEvent, isChatFeedbackErrorEvent, isChatFeedbackEvent, isChatModeChangeEvent, isChatOpenedEvent, isChatReasoningEvent, isChatResetEvent, isChatSaveVisualizationErrorEvent, isChatSaveVisualizationSuccessEvent, isChatUserAnswersEvent, isChatUserMessageEvent, } from "../store/events.js";
|
|
7
7
|
import { activateConversationAction, clearThreadAction, newMessageAction, setSelectedAgentAction, setSelectedEffortAction, } from "../store/messages/messagesSlice.js";
|
|
8
8
|
import { GenAIChatDialog } from "./GenAIChatDialog.js";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import { useAppEventSync } from "./hooks/useAppEventSync.js";
|
|
10
|
+
const NO_APP_EVENTS = [];
|
|
11
11
|
import { sanitizeEffort } from "./utils/effortSelection.js";
|
|
12
12
|
export function toGenAIChatConnectedEvent(event) {
|
|
13
13
|
if (isChatOpenedEvent(event)) {
|
|
@@ -105,7 +105,7 @@ export function buildSeedActions({ conversationId, agentId, effort, askedQuestio
|
|
|
105
105
|
*
|
|
106
106
|
* @internal
|
|
107
107
|
*/
|
|
108
|
-
export function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, effort, isOpen, isDisabled = true, displayMode, onOpen, onClose, askedQuestion, conversationId, askSeq, userContext, ambientUserContext, ambientUserContextLoading,
|
|
108
|
+
export function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, effort, isOpen, isDisabled = true, displayMode, onOpen, onClose, askedQuestion, conversationId, askSeq, userContext, ambientUserContext, ambientUserContextLoading, appEvents = NO_APP_EVENTS, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks = true, onLinkClick, returnFocusTo, }) {
|
|
109
109
|
const defaultLinkClick = useCallback(({ itemUrl, newTab, preventDefault, type, dashboardStatus, }) => {
|
|
110
110
|
// NOTE: If dashboard is draft, do nothing for now
|
|
111
111
|
if (type === "dashboard" && dashboardStatus === "draft") {
|
|
@@ -160,8 +160,7 @@ export function GenAIChatDialogConnected({ backend, workspace, locale, canManage
|
|
|
160
160
|
loading: ambientUserContextLoading,
|
|
161
161
|
}));
|
|
162
162
|
}, [chatDispatcher, ambientUserContext, ambientUserContextLoading]);
|
|
163
|
-
|
|
164
|
-
useDashboardSavedSync(chatDispatcher, dashboardSaved);
|
|
163
|
+
useAppEventSync(chatDispatcher, appEvents);
|
|
165
164
|
// The token of the last seed we applied. Each ask is identified by `askSeq` (bumped on every ask,
|
|
166
165
|
// so even a repeated identical question re-seeds); we seed once per token. Without this guard the
|
|
167
166
|
// effect would replay the question whenever `settings`/`userContext` merely change object identity.
|
|
@@ -43,7 +43,7 @@ function GenAIChatWrapperComponent({ loadThread, clearThread, cancelLoading, set
|
|
|
43
43
|
navigationId: GEN_AI_INPUT_ANCHOR_ID,
|
|
44
44
|
tabIndex: -1,
|
|
45
45
|
});
|
|
46
|
-
const onSettingClick = useSettingsClick(
|
|
46
|
+
const onSettingClick = useSettingsClick();
|
|
47
47
|
if (evaluated && hasUnsupportedOpenAiModel) {
|
|
48
48
|
return (_jsx(GlobalError, { errorMessage: intl.formatMessage({ id: "gd.gen-ai.global-unsupported-model" }), errorDescription: intl.formatMessage({
|
|
49
49
|
id: "gd.gen-ai.global-unsupported-model.description",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type IAiAssistantAppEvent } from "@gooddata/sdk-pluggable-application-model";
|
|
2
|
+
import { dashboardSavedAction, publisherDocumentSavedAction } from "../../store/messages/messagesSlice.js";
|
|
3
|
+
/**
|
|
4
|
+
* An application event delivered to the chat. `seq` grows with every delivery, so the same event sent
|
|
5
|
+
* again is acted on again and the chat knows which deliveries it has seen.
|
|
6
|
+
*/
|
|
7
|
+
export interface ISequencedAppEvent {
|
|
8
|
+
seq: number;
|
|
9
|
+
event: IAiAssistantAppEvent;
|
|
10
|
+
}
|
|
11
|
+
type AppEventAction = ReturnType<typeof publisherDocumentSavedAction> | ReturnType<typeof dashboardSavedAction>;
|
|
12
|
+
/**
|
|
13
|
+
* Tells the chat store about the events of the application the chat runs beside, once per delivery
|
|
14
|
+
* and in delivery order. Events the chat does not know are ignored.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAppEventSync(dispatch: ((action: AppEventAction) => void) | null, appEvents: ReadonlyArray<ISequencedAppEvent>): void;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=useAppEventSync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppEventSync.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useAppEventSync.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,oBAAoB,EAG5B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAE3G;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,oBAAoB,CAAC;CAC/B;AAED,KAAK,cAAc,GACb,UAAU,CAAC,OAAO,4BAA4B,CAAC,GAC/C,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAY9C;;;GAGG;AACH,wBAAgB,eAAe,CAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC,GAAG,IAAI,EACnD,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,QAmB/C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { isAiAssistantDashboardSavedAppEvent, isAiAssistantPublisherDocumentSavedAppEvent, } from "@gooddata/sdk-pluggable-application-model";
|
|
4
|
+
import { dashboardSavedAction, publisherDocumentSavedAction } from "../../store/messages/messagesSlice.js";
|
|
5
|
+
function toAction(event) {
|
|
6
|
+
if (isAiAssistantPublisherDocumentSavedAppEvent(event)) {
|
|
7
|
+
return publisherDocumentSavedAction(event.payload);
|
|
8
|
+
}
|
|
9
|
+
if (isAiAssistantDashboardSavedAppEvent(event)) {
|
|
10
|
+
return dashboardSavedAction(event.payload);
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Tells the chat store about the events of the application the chat runs beside, once per delivery
|
|
16
|
+
* and in delivery order. Events the chat does not know are ignored.
|
|
17
|
+
*/
|
|
18
|
+
export function useAppEventSync(dispatch, appEvents) {
|
|
19
|
+
const lastSeq = useRef(0);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!dispatch) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
for (const { seq, event } of appEvents) {
|
|
25
|
+
if (seq <= lastSeq.current) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
lastSeq.current = seq;
|
|
29
|
+
const action = toAction(event);
|
|
30
|
+
if (action) {
|
|
31
|
+
dispatch(action);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, [dispatch, appEvents]);
|
|
35
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { type MouseEvent } from "react";
|
|
2
|
-
|
|
3
|
-
export declare function useSettingsClick(settings: ISettings | undefined): (type: "change-model" | "create") => (e: MouseEvent) => void;
|
|
2
|
+
export declare function useSettingsClick(): (type: "change-model" | "create") => (e: MouseEvent) => void;
|
|
4
3
|
//# sourceMappingURL=useSettingsClick.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSettingsClick.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useSettingsClick.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useSettingsClick.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useSettingsClick.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,OAAO,CAAC;AAgBrD,wBAAgB,gBAAgB,WAKjB,cAAc,GAAG,QAAQ,SAAS,UAAU,UAmD1D"}
|
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { useWorkspaceStrict } from "@gooddata/sdk-ui";
|
|
4
|
-
import {
|
|
4
|
+
import { getAbsoluteShellAppOrgSettingHref, getAbsoluteShellAppWorkspaceSettingHref, getShellAppOrgSettingHref, getShellAppWorkspaceSettingHref, } from "../../utils.js";
|
|
5
5
|
import { useConfig } from "../ConfigContext.js";
|
|
6
6
|
const GEN_AI_SECTION = "ai";
|
|
7
7
|
const CREATE_LLM_PROVIDER_ACTION = "create-llm-provider";
|
|
8
8
|
const CHANGE_LLM_MODEL_ACTION = "change-llm-model";
|
|
9
|
-
export function useSettingsClick(
|
|
9
|
+
export function useSettingsClick() {
|
|
10
10
|
const workspaceId = useWorkspaceStrict();
|
|
11
11
|
const { linkHandler, allowNativeLinks } = useConfig();
|
|
12
|
-
// When the shell host is enabled, the standalone home-ui at `/settings` or
|
|
13
|
-
// `/workspaces/{id}/settings` is bounced to the host base path, dropping the
|
|
14
|
-
// workspaceId and hash. Switch to host-shaped URLs so the deep-link
|
|
15
|
-
// (e.g. `#/ai/change-llm-model`) reaches the settings page intact.
|
|
16
|
-
const useShellAppUrls = Boolean(settings?.enableShellApplication);
|
|
17
12
|
return useCallback((type) => (e) => {
|
|
18
13
|
switch (type) {
|
|
19
14
|
case "change-model":
|
|
20
15
|
if (allowNativeLinks) {
|
|
21
|
-
window.location.href =
|
|
22
|
-
? getAbsoluteShellAppWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION)
|
|
23
|
-
: getAbsoluteWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION);
|
|
16
|
+
window.location.href = getAbsoluteShellAppWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION);
|
|
24
17
|
}
|
|
25
18
|
else {
|
|
26
19
|
linkHandler?.({
|
|
@@ -31,18 +24,14 @@ export function useSettingsClick(settings) {
|
|
|
31
24
|
newTab: e.metaKey,
|
|
32
25
|
section: GEN_AI_SECTION,
|
|
33
26
|
preventDefault: e.preventDefault.bind(e),
|
|
34
|
-
itemUrl:
|
|
35
|
-
? getShellAppWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION)
|
|
36
|
-
: getWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION),
|
|
27
|
+
itemUrl: getShellAppWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION),
|
|
37
28
|
});
|
|
38
29
|
e.stopPropagation();
|
|
39
30
|
}
|
|
40
31
|
break;
|
|
41
32
|
case "create":
|
|
42
33
|
if (allowNativeLinks) {
|
|
43
|
-
window.location.href =
|
|
44
|
-
? getAbsoluteShellAppOrgSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION)
|
|
45
|
-
: getAbsoluteSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION);
|
|
34
|
+
window.location.href = getAbsoluteShellAppOrgSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION);
|
|
46
35
|
}
|
|
47
36
|
else {
|
|
48
37
|
linkHandler?.({
|
|
@@ -53,13 +42,11 @@ export function useSettingsClick(settings) {
|
|
|
53
42
|
newTab: e.metaKey,
|
|
54
43
|
section: GEN_AI_SECTION,
|
|
55
44
|
preventDefault: e.preventDefault.bind(e),
|
|
56
|
-
itemUrl:
|
|
57
|
-
? getShellAppOrgSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION)
|
|
58
|
-
: getSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION),
|
|
45
|
+
itemUrl: getShellAppOrgSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION),
|
|
59
46
|
});
|
|
60
47
|
e.stopPropagation();
|
|
61
48
|
}
|
|
62
49
|
break;
|
|
63
50
|
}
|
|
64
|
-
}, [allowNativeLinks, linkHandler, workspaceId
|
|
51
|
+
}, [allowNativeLinks, linkHandler, workspaceId]);
|
|
65
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationErrorContent.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/conversationContents/ConversationErrorContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConversationErrorContent.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/conversationContents/ConversationErrorContent.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAIvE,MAAM,MAAM,6BAA6B,GAAG;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EACrC,IAAI,EACJ,OAAO,EACP,OAAO,EACP,WAAmB,EACnB,SAAS,EACT,MAAM,GACT,EAAE,6BAA6B,2CAwE/B"}
|
|
@@ -3,16 +3,13 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import cx from "classnames";
|
|
5
5
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
|
-
import { useSelector } from "react-redux";
|
|
7
6
|
import { UiButton } from "@gooddata/sdk-ui-kit";
|
|
8
|
-
import { settingsSelector } from "../../../store/chatWindow/chatWindowSelectors.js";
|
|
9
7
|
import { useSettingsClick } from "../../hooks/useSettingsClick.js";
|
|
10
8
|
import { MarkdownComponent } from "../contents/Markdown.js";
|
|
11
9
|
export function ConversationErrorContent({ code, traceId, message, useMarkdown = false, className, reason, }) {
|
|
12
|
-
const settings = useSelector(settingsSelector);
|
|
13
10
|
const [showMore, setShowMore] = useState(false);
|
|
14
11
|
const { formatMessage } = useIntl();
|
|
15
|
-
const onSettings = useSettingsClick(
|
|
12
|
+
const onSettings = useSettingsClick();
|
|
16
13
|
const components = useMemo(() => ({
|
|
17
14
|
b: (parts) => _jsx("strong", { children: parts }),
|
|
18
15
|
}), []);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotComposingOverlay.d.ts","sourceRoot":"","sources":["../../src/copilot/CopilotComposingOverlay.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,2BAA2B,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,2CAuKhF"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2026 GoodData Corporation
|
|
3
|
+
import { useLayoutEffect, useRef } from "react";
|
|
4
|
+
const speed = 1 / 3.6;
|
|
5
|
+
const springAt = 0.05;
|
|
6
|
+
const stiffness = 7;
|
|
7
|
+
const damping = 0.55;
|
|
8
|
+
export function DashboardAiComposingOverlay({ isWaiting }) {
|
|
9
|
+
const overlayRef = useRef(null);
|
|
10
|
+
const stateRef = useRef(null);
|
|
11
|
+
useLayoutEffect(() => {
|
|
12
|
+
const overlay = overlayRef.current;
|
|
13
|
+
if (!overlay) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const rects = Array.from(overlay.querySelectorAll("rect"));
|
|
17
|
+
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
18
|
+
let state = stateRef.current;
|
|
19
|
+
let width = 0;
|
|
20
|
+
let perimeter = 0;
|
|
21
|
+
let previousTime;
|
|
22
|
+
let frame;
|
|
23
|
+
const segment = (rect, start, length) => {
|
|
24
|
+
rect.style.strokeDasharray = `${length} ${Math.max(0, perimeter - length)}`;
|
|
25
|
+
rect.style.strokeDashoffset = String(-(((start % perimeter) + perimeter) % perimeter));
|
|
26
|
+
};
|
|
27
|
+
const animate = (time) => {
|
|
28
|
+
frame = undefined;
|
|
29
|
+
if (!state || !perimeter) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const dt = Math.min(0.05, (time - (previousTime ?? time)) / 1000);
|
|
33
|
+
previousTime = time;
|
|
34
|
+
const top = width / 2 / perimeter;
|
|
35
|
+
const runningLength = Math.min(600, perimeter * 0.25);
|
|
36
|
+
const waitingLength = Math.min(120, runningLength);
|
|
37
|
+
let settled = false;
|
|
38
|
+
if (isWaiting && state.mode === "run") {
|
|
39
|
+
state.mode = "cruise";
|
|
40
|
+
state.lap = Math.ceil(state.center + springAt - top);
|
|
41
|
+
}
|
|
42
|
+
else if (!isWaiting && state.mode !== "run") {
|
|
43
|
+
state.mode = "run";
|
|
44
|
+
state.speed = 0;
|
|
45
|
+
}
|
|
46
|
+
if (reducedMotion.matches) {
|
|
47
|
+
state.center = top;
|
|
48
|
+
state.length = isWaiting ? waitingLength : runningLength;
|
|
49
|
+
state.head = isWaiting ? 0 : 1;
|
|
50
|
+
state.lap = 0;
|
|
51
|
+
state.velocity = 0;
|
|
52
|
+
state.speed = 0;
|
|
53
|
+
state.mode = isWaiting ? "spring" : "run";
|
|
54
|
+
settled = true;
|
|
55
|
+
}
|
|
56
|
+
else if (state.mode === "cruise") {
|
|
57
|
+
state.center += speed * dt;
|
|
58
|
+
if (state.lap + top - state.center <= springAt) {
|
|
59
|
+
state.mode = "spring";
|
|
60
|
+
state.velocity = speed;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (state.mode === "spring") {
|
|
64
|
+
// Keep the spring target aligned with the top center while the container resizes.
|
|
65
|
+
const target = state.lap + top;
|
|
66
|
+
const steps = Math.max(1, Math.ceil(dt * 240));
|
|
67
|
+
const step = dt / steps;
|
|
68
|
+
for (let i = 0; i < steps; i++) {
|
|
69
|
+
const acceleration = -stiffness * stiffness * (state.center - target) -
|
|
70
|
+
2 * damping * stiffness * state.velocity;
|
|
71
|
+
state.velocity += acceleration * step;
|
|
72
|
+
state.center += state.velocity * step;
|
|
73
|
+
}
|
|
74
|
+
const easing = 1 - Math.exp(-dt * 3.2);
|
|
75
|
+
state.length += (waitingLength - state.length) * easing;
|
|
76
|
+
state.head += -state.head * easing;
|
|
77
|
+
settled =
|
|
78
|
+
Math.abs(state.center - target) < 0.00001 &&
|
|
79
|
+
Math.abs(state.velocity) < 0.00001 &&
|
|
80
|
+
Math.abs(state.length - waitingLength) < 0.01 &&
|
|
81
|
+
state.head < 0.0001;
|
|
82
|
+
if (settled) {
|
|
83
|
+
state.center = target;
|
|
84
|
+
state.length = waitingLength;
|
|
85
|
+
state.head = 0;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
state.speed = Math.min(1, state.speed + dt / 0.9);
|
|
90
|
+
state.center += speed * dt * state.speed * state.speed;
|
|
91
|
+
const easing = 1 - Math.exp(-dt * 2.5);
|
|
92
|
+
state.length += (runningLength - state.length) * easing;
|
|
93
|
+
state.head += (1 - state.head) * easing;
|
|
94
|
+
}
|
|
95
|
+
const start = state.center * perimeter - state.length / 2;
|
|
96
|
+
const coreLength = state.length * 0.55;
|
|
97
|
+
const coreStart = start + (state.length - coreLength) * (0.5 + 0.5 * state.head);
|
|
98
|
+
const [bloom, glow, tail, core] = rects;
|
|
99
|
+
segment(tail, start, state.length);
|
|
100
|
+
for (const rect of [bloom, glow, core]) {
|
|
101
|
+
segment(rect, coreStart, coreLength);
|
|
102
|
+
}
|
|
103
|
+
if (!settled) {
|
|
104
|
+
frame = requestAnimationFrame(animate);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const refresh = () => {
|
|
108
|
+
if (frame !== undefined) {
|
|
109
|
+
cancelAnimationFrame(frame);
|
|
110
|
+
}
|
|
111
|
+
previousTime = undefined;
|
|
112
|
+
animate(performance.now());
|
|
113
|
+
};
|
|
114
|
+
const fit = () => {
|
|
115
|
+
width = Math.max(0, overlay.clientWidth - 2);
|
|
116
|
+
const height = Math.max(0, overlay.clientHeight - 2);
|
|
117
|
+
perimeter = width && height ? 2 * (width + height) : 0;
|
|
118
|
+
for (const rect of rects) {
|
|
119
|
+
rect.setAttribute("width", String(width));
|
|
120
|
+
rect.setAttribute("height", String(height));
|
|
121
|
+
}
|
|
122
|
+
if (!state && perimeter) {
|
|
123
|
+
state = {
|
|
124
|
+
center: isWaiting ? width / 2 / perimeter : 0.62,
|
|
125
|
+
length: isWaiting ? Math.min(120, perimeter * 0.25) : Math.min(600, perimeter * 0.25),
|
|
126
|
+
head: isWaiting ? 0 : 1,
|
|
127
|
+
speed: 1,
|
|
128
|
+
mode: isWaiting ? "spring" : "run",
|
|
129
|
+
lap: 0,
|
|
130
|
+
velocity: 0,
|
|
131
|
+
};
|
|
132
|
+
stateRef.current = state;
|
|
133
|
+
}
|
|
134
|
+
refresh();
|
|
135
|
+
};
|
|
136
|
+
const observer = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(fit);
|
|
137
|
+
observer?.observe(overlay);
|
|
138
|
+
window.addEventListener("resize", fit);
|
|
139
|
+
reducedMotion.addEventListener("change", refresh);
|
|
140
|
+
fit();
|
|
141
|
+
return () => {
|
|
142
|
+
if (frame !== undefined) {
|
|
143
|
+
cancelAnimationFrame(frame);
|
|
144
|
+
}
|
|
145
|
+
observer?.disconnect();
|
|
146
|
+
window.removeEventListener("resize", fit);
|
|
147
|
+
reducedMotion.removeEventListener("change", refresh);
|
|
148
|
+
};
|
|
149
|
+
}, [isWaiting]);
|
|
150
|
+
return (_jsx("div", { "data-testid": "gd-copilot-composing-overlay", className: "gd-copilot-composing-overlay", ref: overlayRef, "aria-hidden": "true", children: ["bloom", "glow", "tail", "core"].map((layer) => (_jsx("svg", { className: `gd-copilot-composing-overlay__${layer}`, focusable: "false", children: _jsx("rect", { x: "1", y: "1", width: "0", height: "0" }) }, layer))) }));
|
|
151
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ILocale } from "@gooddata/sdk-ui";
|
|
3
|
+
import { type CopilotStatus } from "./types.js";
|
|
4
|
+
/** Configuration of the workflow-independent composing presentation. @alpha */
|
|
5
|
+
export interface ICopilotInteractionComposingProps {
|
|
6
|
+
/** Content that remains mounted and visible regardless of composing progress. */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Loading, building, waiting for a reply, or idle. */
|
|
9
|
+
status: CopilotStatus;
|
|
10
|
+
/** Optional reasoning heading displayed while generating or building. */
|
|
11
|
+
reasoningTitle?: string;
|
|
12
|
+
/** Pure host visibility predicate, evaluated on each render. Only composing UI is hidden. */
|
|
13
|
+
isVisible?: () => boolean;
|
|
14
|
+
/** Open the originating chat when the user chooses to reply. */
|
|
15
|
+
onReplyInChat?: () => void;
|
|
16
|
+
/** Locale for the waiting message and reply button. Defaults to en-US. */
|
|
17
|
+
locale?: ILocale;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Wrap content with a composing animation and optional reasoning or reply banner.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* This controlled component has no workflow state or store dependency. Its container fills its
|
|
24
|
+
* host; give the host a size and import `@gooddata/sdk-ui-gen-ai/styles/css/copilotInteractionComposing.css`.
|
|
25
|
+
* A visibility predicate is not a subscription; rerender when external visibility facts change.
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export declare function CopilotInteractionComposing({ children, status, reasoningTitle, isVisible, onReplyInChat, locale, }: ICopilotInteractionComposingProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=CopilotInteractionComposing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotInteractionComposing.d.ts","sourceRoot":"","sources":["../../src/copilot/CopilotInteractionComposing.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAMhD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAahD,+EAA+E;AAC/E,MAAM,WAAW,iCAAiC;IAC9C,iFAAiF;IACjF,QAAQ,EAAE,SAAS,CAAC;IACpB,uDAAuD;IACvD,MAAM,EAAE,aAAa,CAAC;IACtB,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;IAC1B,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,EACxC,QAAQ,EACR,MAAM,EACN,cAAc,EACd,SAAS,EACT,aAAa,EACb,MAAM,GACT,EAAE,iCAAiC,2CAmBnC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { FormattedMessage, defineMessages, useIntl } from "react-intl";
|
|
4
|
+
import { UiButton } from "@gooddata/sdk-ui-kit";
|
|
5
|
+
import { IntlWrapper } from "../localization/IntlWrapper.js";
|
|
6
|
+
import { DashboardAiComposingOverlay as CopilotComposingOverlay } from "./CopilotComposingOverlay.js";
|
|
7
|
+
const messages = defineMessages({
|
|
8
|
+
waiting: {
|
|
9
|
+
id: "gd.gen-ai.copilot.composing.waiting",
|
|
10
|
+
defaultMessage: "Waiting for your reply",
|
|
11
|
+
},
|
|
12
|
+
replyNow: {
|
|
13
|
+
id: "gd.gen-ai.copilot.composing.replyNow",
|
|
14
|
+
defaultMessage: "Reply now",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Wrap content with a composing animation and optional reasoning or reply banner.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This controlled component has no workflow state or store dependency. Its container fills its
|
|
22
|
+
* host; give the host a size and import `@gooddata/sdk-ui-gen-ai/styles/css/copilotInteractionComposing.css`.
|
|
23
|
+
* A visibility predicate is not a subscription; rerender when external visibility facts change.
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
export function CopilotInteractionComposing({ children, status, reasoningTitle, isVisible, onReplyInChat, locale, }) {
|
|
27
|
+
const visible = isVisible?.() ?? true;
|
|
28
|
+
const active = visible && status !== "idle";
|
|
29
|
+
return (_jsxs("div", { className: "gd-copilot-interaction-composing", children: [_jsx("div", { className: "gd-copilot-interaction-composing__content", children: children }), active ? _jsx(CopilotComposingOverlay, { isWaiting: status === "waiting" }) : null, visible ? (_jsx(IntlWrapper, { locale: locale, children: _jsx(ComposingStatus, { status: status, reasoningTitle: reasoningTitle, onReplyInChat: onReplyInChat }) })) : null] }));
|
|
30
|
+
}
|
|
31
|
+
function ComposingStatus({ status, reasoningTitle, onReplyInChat, }) {
|
|
32
|
+
const intl = useIntl();
|
|
33
|
+
const isWaiting = status === "waiting";
|
|
34
|
+
const showReasoning = (status === "generating" || status === "building") && !!reasoningTitle;
|
|
35
|
+
const showStatus = isWaiting || showReasoning;
|
|
36
|
+
return (_jsxs("div", { className: cx("gd-copilot-interaction-composing__status", {
|
|
37
|
+
"gd-copilot-interaction-composing__status--hidden": !showStatus,
|
|
38
|
+
}), "aria-hidden": !showStatus, children: [_jsx("div", { className: "gd-copilot-interaction-composing__message", role: showStatus ? "status" : undefined, children: isWaiting ? (_jsx(FormattedMessage, { ...messages.waiting })) : showReasoning ? (reasoningTitle) : null }), isWaiting && onReplyInChat ? (_jsx(UiButton, { variant: "tertiary", label: intl.formatMessage(messages.replyNow), onClick: onReplyInChat })) : null] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CopilotHandler } from "./CopilotHandler.js";
|
|
2
|
+
import { type ICopilotInteractionComposingProps } from "./CopilotInteractionComposing.js";
|
|
3
|
+
import { type CopilotBuildType, type ICopilotScope } from "./types.js";
|
|
4
|
+
/** Composing presentation driven directly by an existing copilot instance. @alpha */
|
|
5
|
+
export interface ICopilotInteractionComposingWithHandlerProps<TBuild extends string = CopilotBuildType> extends Omit<ICopilotInteractionComposingProps, "status" | "reasoningTitle" | "onReplyInChat"> {
|
|
6
|
+
/** Runtime-owned handler. This component never disposes it. */
|
|
7
|
+
copilot: CopilotHandler<TBuild>;
|
|
8
|
+
/** Workflow and optional target whose progress should be displayed. */
|
|
9
|
+
scope: ICopilotScope<TBuild>;
|
|
10
|
+
/** Open the waiting workflow's originating thread; falls back to the foreground thread. */
|
|
11
|
+
onReplyInChat?: (threadId?: string) => void;
|
|
12
|
+
}
|
|
13
|
+
/** Subscribe to a copilot instance without introducing another workflow state owner. @alpha */
|
|
14
|
+
export declare function CopilotInteractionComposingWithHandler<TBuild extends string = CopilotBuildType>({ copilot, scope, onReplyInChat, ...props }: ICopilotInteractionComposingWithHandlerProps<TBuild>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=CopilotInteractionComposingWithHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotInteractionComposingWithHandler.d.ts","sourceRoot":"","sources":["../../src/copilot/CopilotInteractionComposingWithHandler.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAEH,KAAK,iCAAiC,EACzC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAGvE,qFAAqF;AACrF,MAAM,WAAW,4CAA4C,CACzD,MAAM,SAAS,MAAM,GAAG,gBAAgB,CAC1C,SAAQ,IAAI,CAAC,iCAAiC,EAAE,QAAQ,GAAG,gBAAgB,GAAG,eAAe,CAAC;IAC5F,+DAA+D;IAC/D,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAChC,uEAAuE;IACvE,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,2FAA2F;IAC3F,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,+FAA+F;AAC/F,wBAAgB,sCAAsC,CAAC,MAAM,SAAS,MAAM,GAAG,gBAAgB,EAAE,EAC7F,OAAO,EACP,KAAK,EACL,aAAa,EACb,GAAG,KAAK,EACX,EAAE,4CAA4C,CAAC,MAAM,CAAC,2CAetD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CopilotInteractionComposing, } from "./CopilotInteractionComposing.js";
|
|
3
|
+
import { selectCopilotReasoningTitle, selectCopilotReplyThreadId, selectCopilotStatus } from "./selectors.js";
|
|
4
|
+
import { useCopilotSnapshot } from "./useCopilotSnapshot.js";
|
|
5
|
+
/** Subscribe to a copilot instance without introducing another workflow state owner. @alpha */
|
|
6
|
+
export function CopilotInteractionComposingWithHandler({ copilot, scope, onReplyInChat, ...props }) {
|
|
7
|
+
const snapshot = useCopilotSnapshot(copilot);
|
|
8
|
+
return (_jsx(CopilotInteractionComposing, { ...props, status: selectCopilotStatus(snapshot, scope), reasoningTitle: selectCopilotReasoningTitle(snapshot, scope), onReplyInChat: onReplyInChat
|
|
9
|
+
? () => onReplyInChat(selectCopilotReplyThreadId(copilot.getSnapshot(), scope))
|
|
10
|
+
: undefined }));
|
|
11
|
+
}
|
|
@@ -3,8 +3,10 @@ import { type CopilotBuildType, type CopilotStatus, type ICopilotScope, type ICo
|
|
|
3
3
|
export declare function selectCopilotGenerationPending<TBuild extends string = CopilotBuildType>(state: ICopilotSnapshot<TBuild>, type: TBuild): boolean;
|
|
4
4
|
/** Calculate progress without host presentation rules or side effects. @alpha */
|
|
5
5
|
export declare function selectCopilotStatus<TBuild extends string = CopilotBuildType>(state: ICopilotSnapshot<TBuild>, scope: ICopilotScope<TBuild>): CopilotStatus;
|
|
6
|
+
/** Resolve the newest waiting workflow's thread rather than the selected chat. @internal */
|
|
7
|
+
export declare function selectCopilotReplyThreadId<TBuild extends string>(state: ICopilotSnapshot<TBuild>, scope: ICopilotScope<TBuild>): string | undefined;
|
|
6
8
|
/** Query the originating conversation of an applied object. @alpha */
|
|
7
9
|
export declare function selectCopilotSource<TBuild extends string = CopilotBuildType>(state: ICopilotSnapshot<TBuild>, target: ICopilotTarget<TBuild>): ICopilotSource | undefined;
|
|
8
|
-
/** Query
|
|
9
|
-
export declare function selectCopilotReasoningTitle<TBuild extends string = CopilotBuildType>(state: ICopilotSnapshot<TBuild>): string | undefined;
|
|
10
|
+
/** Query foreground reasoning, optionally restricted to the owning workflow. @alpha */
|
|
11
|
+
export declare function selectCopilotReasoningTitle<TBuild extends string = CopilotBuildType>(state: ICopilotSnapshot<TBuild>, scope?: ICopilotScope<TBuild>): string | undefined;
|
|
10
12
|
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/copilot/selectors.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,aAAa,
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