@mgamadeus/ddd-agents 0.3.13 → 0.3.14
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 +33 -0
- package/dist/chat.js +12 -12
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{ConversationMessageInputComposerWidgets-CPV4BK3v.js → ConversationMessageInputComposerWidgets-D5NlHJlV.js} +5 -5
- package/dist/chunks/{ConversationMessageInputComposerWidgets-CPV4BK3v.js.map → ConversationMessageInputComposerWidgets-D5NlHJlV.js.map} +1 -1
- package/dist/chunks/{WebSearchResultsConversationWidget-DTnsU_C-.js → WebSearchResultsConversationWidget-Dpy5qp4j.js} +237 -120
- package/dist/chunks/WebSearchResultsConversationWidget-Dpy5qp4j.js.map +1 -0
- package/dist/chunks/{canvas-feature-flags-BmmxC3bz.js → canvas-feature-flags-Cn8xBliA.js} +3 -2
- package/dist/chunks/{canvas-feature-flags-BmmxC3bz.js.map → canvas-feature-flags-Cn8xBliA.js.map} +1 -1
- package/dist/chunks/{canvas-reducers-8GHP6886.js → canvas-reducers-CgL_H6Oc.js} +2 -3
- package/dist/chunks/{canvas-reducers-8GHP6886.js.map → canvas-reducers-CgL_H6Oc.js.map} +1 -1
- package/dist/chunks/{canvas-title-slot-context-C43hdu4i.js → canvas-title-slot-context-_Kf45ABB.js} +3 -3
- package/dist/chunks/{canvas-title-slot-context-C43hdu4i.js.map → canvas-title-slot-context-_Kf45ABB.js.map} +1 -1
- package/dist/chunks/{canvasBodies-DJ-gJy-T.js → canvasBodies-4iDPQLb0.js} +5 -5
- package/dist/chunks/{canvasBodies-DJ-gJy-T.js.map → canvasBodies-4iDPQLb0.js.map} +1 -1
- package/dist/chunks/{canvasStorage-EZDxQQaK.js → canvasStorage-De3tMK4L.js} +2 -2
- package/dist/chunks/{canvasStorage-EZDxQQaK.js.map → canvasStorage-De3tMK4L.js.map} +1 -1
- package/dist/chunks/{widget-name-resolver-Ne0vKw4N.js → widget-name-resolver-JEJ1Hd0T.js} +2 -2
- package/dist/chunks/{widget-name-resolver-Ne0vKw4N.js.map → widget-name-resolver-JEJ1Hd0T.js.map} +1 -1
- package/dist/client-testing.js +4 -4
- package/dist/files/widgets/DriveFilesConversationWidget/DriveFilesConversationWidget.md +3 -0
- package/dist/image-render.js +7 -7
- package/dist/index.js +39 -17
- package/dist/index.js.map +1 -1
- package/dist/kit.js +2 -2
- package/dist/preview.js +5 -6
- package/dist/preview.js.map +1 -1
- package/dist/renderer.js +61 -57
- package/dist/renderer.js.map +1 -1
- package/dist/styles.css +8 -0
- package/dist/types/entries/index.d.ts +2 -0
- package/dist/types/entries/widgets.d.ts +1 -0
- package/dist/types/renderer/canvas/canvas-behaviours.d.ts +18 -6
- package/dist/types/renderer/canvas/canvas-kind-declarations.d.ts +17 -0
- package/dist/types/renderer/canvas/canvas-kinds.d.ts +42 -0
- package/dist/types/renderer/canvas/canvas-state.d.ts +12 -0
- package/dist/types/widgets/CanvasLauncherWidget/CanvasLauncherWidget.d.ts +6 -1
- package/dist/types/widgets/DriveFilesConversationWidget/DriveFilesConversationWidget.d.ts +3 -2
- package/dist/types/widgets/DriveFilesConversationWidget/shared/drive-file-canvas-openers.d.ts +29 -0
- package/dist/widgets.js +61 -58
- package/package.json +1 -1
- package/public-api.json +15 -0
- package/dist/chunks/WebSearchResultsConversationWidget-DTnsU_C-.js.map +0 -1
- package/dist/chunks/canvas-behaviours-C9hzl4a0.js +0 -45
- package/dist/chunks/canvas-behaviours-C9hzl4a0.js.map +0 -1
package/README.md
CHANGED
|
@@ -143,6 +143,39 @@ registerDriveFileCardsSource({
|
|
|
143
143
|
Without a source the card says the drive is not connected. A card's `openLink` is followed only as a path of this app
|
|
144
144
|
or a same-origin URL, through `onNavigate`. A cloud drive host uses the source of `@mgamadeus/ddd-clouddrive/agents`.
|
|
145
145
|
|
|
146
|
+
A store can open its files and folders in the canvas beside the chat instead of a new tab. It registers a canvas kind
|
|
147
|
+
and an opener for its store name; stores without an opener keep the tab and the download:
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
import { registerCanvasKind, registerDriveFileCanvasOpener } from "@mgamadeus/ddd-agents";
|
|
151
|
+
import { canvasInstanceIdForReference, referenceOfCanvasInstanceId } from "@mgamadeus/ddd-agents/renderer";
|
|
152
|
+
|
|
153
|
+
registerCanvasKind({
|
|
154
|
+
canvasId: "exampleDriveFile",
|
|
155
|
+
behaviour: { lifetime: "pinned", layout: "split", narrowViewport: "overlay", fullBleed: false },
|
|
156
|
+
body: ({ canvas }) => <FileViewer reference={referenceOfCanvasInstanceId(canvas.instanceId)} />,
|
|
157
|
+
openedByWidgets: ["DriveFiles"],
|
|
158
|
+
});
|
|
159
|
+
registerDriveFileCanvasOpener("drive", (card) =>
|
|
160
|
+
card.isFolder ? null : { canvasId: "exampleDriveFile", instanceId: canvasInstanceIdForReference("exampleDriveFile", card.reference) },
|
|
161
|
+
);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The opener answers per entry (`null` = no canvas for this one); the instance id carries the store's reference only, and
|
|
165
|
+
the body reads the file itself under the viewer's rights. `@mgamadeus/ddd-clouddrive/agents` brings both for the cloud
|
|
166
|
+
drive (`registerCloudDriveFileCanvas`).
|
|
167
|
+
|
|
168
|
+
## Canvas kinds
|
|
169
|
+
|
|
170
|
+
A canvas is declared by its behaviour (`CanvasBehaviour`: lifetime, layout, narrow viewport) and its body (the component
|
|
171
|
+
the pane mounts). An app declares the canvases of its own widgets as before (`AgentsEnvironment.furtherCanvasBehaviours`
|
|
172
|
+
+ `registerCanvasBodies`). A further package brings a whole canvas in one call, `registerCanvasKind({ canvasId,
|
|
173
|
+
behaviour, body, openedByWidgets?, featureFlag? })`, outside React and before the first render: the app declares
|
|
174
|
+
nothing for it. `openedByWidgets` names the widgets in a message the canvas opens from; after a reload its pointer
|
|
175
|
+
restores only while the anchor message still carries one of them. An id of the package's own canvases is refused; for
|
|
176
|
+
any other id the app's `furtherCanvasBehaviours` entry wins over the kind's behaviour, so a host can tune a kind (its
|
|
177
|
+
width, its lifetime). `unregisterCanvasKind(canvasId)` takes a kind off again.
|
|
178
|
+
|
|
146
179
|
## AgentChat in a host window
|
|
147
180
|
|
|
148
181
|
| Prop | Default | |
|
package/dist/chat.js
CHANGED
|
@@ -5,18 +5,17 @@ import { u as useAgentsConversationClient, a as useOptionalAgentsConversationCli
|
|
|
5
5
|
import { w as withPollingChangeSubscription } from "./chunks/withPollingChangeSubscription-CWavoKjJ.js";
|
|
6
6
|
import { s as Text, F as classNames, I as Icon, ab as useAgentsTexts, G as GlowFrame, v as Tooltip, B as Button, 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-DH3f2g9a.js";
|
|
7
7
|
import { i as isAgentsClientError, a as AgentsClientError } from "./chunks/conversation-CbWEHPbL.js";
|
|
8
|
-
import { h as findBalancedJsonObjectEnd, r as resolveDeepLinkableWidget, d as buildMessageTextWithComposerWidgets, s as splitComposerWidgetFencesFromMessageText, j as WidgetWindowRootContext, a as ConversationMarkdown, i as isWidgetClickSignalSource, C as CanvasTitleSlotContext, e as buildWidgetRenderReportSignal, W as WIDGET_RENDER_REPORT_SIGNAL_SOURCE, k as createWidgetRenderReportCollector, l as WidgetRenderReportCollectorContext } from "./chunks/canvas-title-slot-context-
|
|
9
|
-
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-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { A, d, E, I, r, e, f, g, h } from "./chunks/ConversationMessageInputComposerWidgets-CPV4BK3v.js";
|
|
8
|
+
import { h as findBalancedJsonObjectEnd, r as resolveDeepLinkableWidget, d as buildMessageTextWithComposerWidgets, s as splitComposerWidgetFencesFromMessageText, j as WidgetWindowRootContext, a as ConversationMarkdown, i as isWidgetClickSignalSource, C as CanvasTitleSlotContext, e as buildWidgetRenderReportSignal, W as WIDGET_RENDER_REPORT_SIGNAL_SOURCE, k as createWidgetRenderReportCollector, l as WidgetRenderReportCollectorContext } from "./chunks/canvas-title-slot-context-_Kf45ABB.js";
|
|
9
|
+
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-JEJ1Hd0T.js";
|
|
10
|
+
import { a0 as useConversationWidgetContext, h as canvasBehaviourOf, I as canvasKindOpenerWidgetNamesOf, p as payloadHashOfInstanceId, z as buildWidgetAgentSpaceKeyProps, q as CHAT_COLUMN_MIN_WIDTH_PX, o as CANVAS_MIN_WIDTH_PX, b5 as useCanvasViable, D as DEFAULT_CANVAS_WIDTH_PERCENT, J as canvasWidthPercentOf, C as CANVAS_BOXED_INSET_PX, ar as ElementWidthCanvasViability, af as CanvasViabilityContext } from "./chunks/WebSearchResultsConversationWidget-Dpy5qp4j.js";
|
|
11
|
+
import { r as readStoredCanvas, c as clearStoredCanvas } from "./chunks/canvasStorage-De3tMK4L.js";
|
|
12
|
+
import { b as ConversationErrorType, a as ConversationMessageInputComposerWidgets, u as useAgentsChatSelector, C as ConversationWidgetProvider, c as createAgentsChatStore } from "./chunks/ConversationMessageInputComposerWidgets-D5NlHJlV.js";
|
|
13
|
+
import { A, d, E, I, r, e, f, g, h } from "./chunks/ConversationMessageInputComposerWidgets-D5NlHJlV.js";
|
|
15
14
|
import { l as lastWireMessageIsUnansweredUserMessage, P as PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES, b as buildChangedMessagesRequest, d as deriveAgentActivity } from "./chunks/contract-C18owGKs.js";
|
|
16
15
|
import { S } from "./chunks/contract-C18owGKs.js";
|
|
17
16
|
import { t as textKey } from "./chunks/text-key-DnoZ4lAk.js";
|
|
18
|
-
import { c as canvasBodies } from "./chunks/canvasBodies-
|
|
19
|
-
import {
|
|
17
|
+
import { c as canvasBodies } from "./chunks/canvasBodies-4iDPQLb0.js";
|
|
18
|
+
import { a as canvasFeatureFlagOf } from "./chunks/canvas-feature-flags-Cn8xBliA.js";
|
|
20
19
|
import { flushSync } from "react-dom";
|
|
21
20
|
const history = "agents_history_BIbikt";
|
|
22
21
|
const styles$n = {
|
|
@@ -312,9 +311,10 @@ const normalizeServerMessageToMarkdown = (message2) => {
|
|
|
312
311
|
return referenceNakedWidgetJson(repairMalformedWidgetFences(stripPreCallMessageMarker(result)));
|
|
313
312
|
};
|
|
314
313
|
const anchorMessageCarriesCanvasWidget = (pointer, anchorMessage) => {
|
|
315
|
-
const openers = new Set(
|
|
316
|
-
conversationWidgetRegistry.widgets.filter((entry) => entry.opensCanvases?.includes(pointer.canvasId)).map((entry) => entry.name)
|
|
317
|
-
|
|
314
|
+
const openers = /* @__PURE__ */ new Set([
|
|
315
|
+
...conversationWidgetRegistry.widgets.filter((entry) => entry.opensCanvases?.includes(pointer.canvasId)).map((entry) => entry.name),
|
|
316
|
+
...canvasKindOpenerWidgetNamesOf(pointer.canvasId)
|
|
317
|
+
]);
|
|
318
318
|
if (openers.size === 0) return false;
|
|
319
319
|
const payloadHash = payloadHashOfInstanceId(pointer.instanceId);
|
|
320
320
|
return findWidgetFencesInMarkdown(normalizeServerMessageToMarkdown(anchorMessage.message)).some(
|