@mgamadeus/ddd-agents 0.8.0 → 0.8.1

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.
Files changed (48) hide show
  1. package/dist/chat.js +9 -9
  2. package/dist/chunks/{ConversationMarkdown-BsCjyhj4.js → ConversationMarkdown-Cg80bH6c.js} +3 -3
  3. package/dist/chunks/{ConversationMarkdown-BsCjyhj4.js.map → ConversationMarkdown-Cg80bH6c.js.map} +1 -1
  4. package/dist/chunks/{ConversationMessageInputComposerWidgets-CE8LpyXY.js → ConversationMessageInputComposerWidgets-DPflWZ5o.js} +5 -5
  5. package/dist/chunks/{ConversationMessageInputComposerWidgets-CE8LpyXY.js.map → ConversationMessageInputComposerWidgets-DPflWZ5o.js.map} +1 -1
  6. package/dist/chunks/{VoiceBarsIcon-BIcURsBF.js → VoiceBarsIcon-99m5pR-4.js} +3 -3
  7. package/dist/chunks/{VoiceBarsIcon-BIcURsBF.js.map → VoiceBarsIcon-99m5pR-4.js.map} +1 -1
  8. package/dist/chunks/{WebSearchResultsConversationWidget-DXhfSikV.js → WebSearchResultsConversationWidget-W7O1fBB0.js} +1825 -1314
  9. package/dist/chunks/WebSearchResultsConversationWidget-W7O1fBB0.js.map +1 -0
  10. package/dist/chunks/{canvas-reducers-D-YxAR4B.js → canvas-reducers-DDg9T7t8.js} +2 -2
  11. package/dist/chunks/{canvas-reducers-D-YxAR4B.js.map → canvas-reducers-DDg9T7t8.js.map} +1 -1
  12. package/dist/chunks/{canvas-title-slot-context-D6UXrkdJ.js → canvas-title-slot-context-vg_UPT-V.js} +2 -2
  13. package/dist/chunks/{canvas-title-slot-context-D6UXrkdJ.js.map → canvas-title-slot-context-vg_UPT-V.js.map} +1 -1
  14. package/dist/chunks/{canvasBodies-CQEBkIVw.js → canvasBodies-8jRybJVU.js} +18 -4
  15. package/dist/chunks/canvasBodies-8jRybJVU.js.map +1 -0
  16. package/dist/chunks/{canvasStorage-BbEI3h-8.js → canvasStorage-DaM9851h.js} +2 -2
  17. package/dist/chunks/{canvasStorage-BbEI3h-8.js.map → canvasStorage-DaM9851h.js.map} +1 -1
  18. package/dist/chunks/{widget-name-resolver-B9k-s_cF.js → widget-name-resolver-In5UWRB3.js} +63 -42
  19. package/dist/chunks/widget-name-resolver-In5UWRB3.js.map +1 -0
  20. package/dist/client-testing.js +4 -4
  21. package/dist/files/i18n-keys.json +124 -3
  22. package/dist/files/renderer/widget-tree/composed-node-schema.json +2 -0
  23. package/dist/image-render.js +7 -7
  24. package/dist/index.js +9 -8
  25. package/dist/kit.js +2 -2
  26. package/dist/preview.js +5 -5
  27. package/dist/renderer.js +54 -54
  28. package/dist/renderer.js.map +1 -1
  29. package/dist/styles.css +625 -305
  30. package/dist/types/entries/index.d.ts +1 -0
  31. package/dist/types/entries/widgets.d.ts +6 -0
  32. package/dist/types/renderer/canvas/canvas-behaviours.d.ts +1 -1
  33. package/dist/types/widgets/AttachedFilesConversationWidget/AttachedFilesConversationWidget.d.ts +6 -0
  34. package/dist/types/widgets/AttachedFilesConversationWidget/AttachedFilesStrip.d.ts +22 -0
  35. package/dist/types/widgets/AttachedFilesConversationWidget/attached-files.d.ts +24 -0
  36. package/dist/types/widgets/ImageGalleryConversationWidget/ImageGallery.d.ts +16 -0
  37. package/dist/types/widgets/ImageGalleryConversationWidget/ImageGalleryCanvasBody.d.ts +6 -0
  38. package/dist/types/widgets/ImageGalleryConversationWidget/ImageGalleryConversationWidget.d.ts +11 -0
  39. package/dist/types/widgets/ImageGalleryConversationWidget/shared/image-gallery-canvas.d.ts +3 -0
  40. package/dist/types/widgets/ImageGalleryConversationWidget/shared/image-gallery-payload.d.ts +42 -0
  41. package/dist/types/widgets/_shared/file-preview-source.d.ts +33 -0
  42. package/dist/voice.js +1 -1
  43. package/dist/widgets.js +78 -62
  44. package/package.json +1 -1
  45. package/public-api.json +25 -1
  46. package/dist/chunks/WebSearchResultsConversationWidget-DXhfSikV.js.map +0 -1
  47. package/dist/chunks/canvasBodies-CQEBkIVw.js.map +0 -1
  48. package/dist/chunks/widget-name-resolver-B9k-s_cF.js.map +0 -1
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { a as AgentsClientError, C as CONVERSATION_RUN_STATES_THAT_END_THE_CONVERSATION, r as readConversationRunStatusOfRunState } from "./chunks/conversation-CbWEHPbL.js";
3
3
  import { c as composeAttachmentMessageText } from "./chunks/compose-attachment-message-text-FvVJbrge.js";
4
- import { l as listWidgetHydratorTypes, j as getWidgetHydrator, g as registerWidgetHydrator, k as abandonWidgetHydrationReads, u as unregisterWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
5
- import { j as conversationWidgetRegistry, k as replaceConversationWidgetRegistryEntries } from "./chunks/widget-name-resolver-B9k-s_cF.js";
6
- import { l, s } from "./chunks/widget-name-resolver-B9k-s_cF.js";
7
- import { c, r, s as s2 } from "./chunks/canvasStorage-BbEI3h-8.js";
4
+ import { l as listWidgetHydratorTypes, k as getWidgetHydrator, h as registerWidgetHydrator, m as abandonWidgetHydrationReads, u as unregisterWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-W7O1fBB0.js";
5
+ import { j as conversationWidgetRegistry, k as replaceConversationWidgetRegistryEntries } from "./chunks/widget-name-resolver-In5UWRB3.js";
6
+ import { l, s } from "./chunks/widget-name-resolver-In5UWRB3.js";
7
+ import { c, r, s as s2 } from "./chunks/canvasStorage-DaM9851h.js";
8
8
  const DEFAULT_SCRIPTED_ASSISTANT_ANSWER = "Done.";
9
9
  const DEFAULT_PAGE_SIZE = 50;
10
10
  const copyOf = (value) => JSON.parse(JSON.stringify(value));
@@ -166,6 +166,17 @@
166
166
  "src/widgets/DriveFilesConversationWidget/DriveFilesConversationWidget.tsx"
167
167
  ]
168
168
  },
169
+ {
170
+ "key": "%count% pictures",
171
+ "defaultText": "%count% pictures",
172
+ "placeholders": [
173
+ "count"
174
+ ],
175
+ "contexts": [],
176
+ "usedIn": [
177
+ "src/widgets/ImageGalleryConversationWidget/ImageGalleryConversationWidget.tsx"
178
+ ]
179
+ },
169
180
  {
170
181
  "key": "%count% place",
171
182
  "defaultText": "%count% place",
@@ -257,6 +268,15 @@
257
268
  "src/widgets/DriveFilesConversationWidget/DriveFilesConversationWidget.tsx"
258
269
  ]
259
270
  },
271
+ {
272
+ "key": "1 picture",
273
+ "defaultText": "1 picture",
274
+ "placeholders": [],
275
+ "contexts": [],
276
+ "usedIn": [
277
+ "src/widgets/ImageGalleryConversationWidget/ImageGalleryConversationWidget.tsx"
278
+ ]
279
+ },
260
280
  {
261
281
  "key": "AI Extensions",
262
282
  "defaultText": "AI Extensions",
@@ -476,7 +496,8 @@
476
496
  "placeholders": [],
477
497
  "contexts": [],
478
498
  "usedIn": [
479
- "src/voice/AgentVoiceCallBand/AgentVoiceCallBand.tsx"
499
+ "src/voice/AgentVoiceCallBand/AgentVoiceCallBand.tsx",
500
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
480
501
  ]
481
502
  },
482
503
  {
@@ -789,6 +810,17 @@
789
810
  "src/voice/admin/agent-voice-admin-format.ts"
790
811
  ]
791
812
  },
813
+ {
814
+ "key": "Enlarge picture %letter%",
815
+ "defaultText": "Enlarge picture %letter%",
816
+ "placeholders": [
817
+ "letter"
818
+ ],
819
+ "contexts": [],
820
+ "usedIn": [
821
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
822
+ ]
823
+ },
792
824
  {
793
825
  "key": "Enter an amount, such as 250 or 1,250.75",
794
826
  "defaultText": "Enter an amount, such as 250 or 1,250.75",
@@ -988,7 +1020,8 @@
988
1020
  "placeholders": [],
989
1021
  "contexts": [],
990
1022
  "usedIn": [
991
- "src/kit/components/media/ImageGroup.composed.tsx"
1023
+ "src/kit/components/media/ImageGroup.composed.tsx",
1024
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
992
1025
  ]
993
1026
  },
994
1027
  {
@@ -1141,6 +1174,15 @@
1141
1174
  "src/voice/admin/agent-voice-admin-format.ts"
1142
1175
  ]
1143
1176
  },
1177
+ {
1178
+ "key": "None of these",
1179
+ "defaultText": "None of these",
1180
+ "placeholders": [],
1181
+ "contexts": [],
1182
+ "usedIn": [
1183
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
1184
+ ]
1185
+ },
1144
1186
  {
1145
1187
  "key": "Not answered",
1146
1188
  "defaultText": "Not answered",
@@ -1321,6 +1363,42 @@
1321
1363
  "src/chat/ConversationMessage/ConversationCallMarkerChip/ConversationCallMarkerChip.tsx"
1322
1364
  ]
1323
1365
  },
1366
+ {
1367
+ "key": "Pick a picture",
1368
+ "defaultText": "Pick a picture",
1369
+ "placeholders": [],
1370
+ "contexts": [],
1371
+ "usedIn": [
1372
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
1373
+ ]
1374
+ },
1375
+ {
1376
+ "key": "Picture could not be loaded",
1377
+ "defaultText": "Picture could not be loaded",
1378
+ "placeholders": [],
1379
+ "contexts": [],
1380
+ "usedIn": [
1381
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
1382
+ ]
1383
+ },
1384
+ {
1385
+ "key": "Pictures",
1386
+ "defaultText": "Pictures",
1387
+ "placeholders": [],
1388
+ "contexts": [],
1389
+ "usedIn": [
1390
+ "src/widgets/ImageGalleryConversationWidget/ImageGalleryConversationWidget.tsx"
1391
+ ]
1392
+ },
1393
+ {
1394
+ "key": "Pictures are not connected here",
1395
+ "defaultText": "Pictures are not connected here",
1396
+ "placeholders": [],
1397
+ "contexts": [],
1398
+ "usedIn": [
1399
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
1400
+ ]
1401
+ },
1324
1402
  {
1325
1403
  "key": "Planning what to do…",
1326
1404
  "defaultText": "Planning what to do…",
@@ -1377,7 +1455,8 @@
1377
1455
  "placeholders": [],
1378
1456
  "contexts": [],
1379
1457
  "usedIn": [
1380
- "src/kit/components/media/ImageGroup.composed.tsx"
1458
+ "src/kit/components/media/ImageGroup.composed.tsx",
1459
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
1381
1460
  ]
1382
1461
  },
1383
1462
  {
@@ -1440,6 +1519,17 @@
1440
1519
  "src/voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen.tsx"
1441
1520
  ]
1442
1521
  },
1522
+ {
1523
+ "key": "Remove %name%",
1524
+ "defaultText": "Remove %name%",
1525
+ "placeholders": [
1526
+ "name"
1527
+ ],
1528
+ "contexts": [],
1529
+ "usedIn": [
1530
+ "src/widgets/AttachedFilesConversationWidget/AttachedFilesStrip.tsx"
1531
+ ]
1532
+ },
1443
1533
  {
1444
1534
  "key": "Remove file",
1445
1535
  "defaultText": "Remove file",
@@ -2502,6 +2592,15 @@
2502
2592
  "src/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentPreviewWidget.tsx"
2503
2593
  ]
2504
2594
  },
2595
+ {
2596
+ "key": "Uploading…",
2597
+ "defaultText": "Uploading…",
2598
+ "placeholders": [],
2599
+ "contexts": [],
2600
+ "usedIn": [
2601
+ "src/widgets/AttachedFilesConversationWidget/AttachedFilesStrip.tsx"
2602
+ ]
2603
+ },
2505
2604
  {
2506
2605
  "key": "Usage limit reached",
2507
2606
  "defaultText": "Usage limit reached",
@@ -2511,6 +2610,28 @@
2511
2610
  "src/chat/ConversationErrorWidget/ConversationErrorWidget.tsx"
2512
2611
  ]
2513
2612
  },
2613
+ {
2614
+ "key": "Use %count% pictures",
2615
+ "defaultText": "Use %count% pictures",
2616
+ "placeholders": [
2617
+ "count"
2618
+ ],
2619
+ "contexts": [],
2620
+ "usedIn": [
2621
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
2622
+ ]
2623
+ },
2624
+ {
2625
+ "key": "Use picture %letter%",
2626
+ "defaultText": "Use picture %letter%",
2627
+ "placeholders": [
2628
+ "letter"
2629
+ ],
2630
+ "contexts": [],
2631
+ "usedIn": [
2632
+ "src/widgets/ImageGalleryConversationWidget/ImageGallery.tsx"
2633
+ ]
2634
+ },
2514
2635
  {
2515
2636
  "key": "Voice call",
2516
2637
  "defaultText": "Voice call",
@@ -3413,11 +3413,13 @@
3413
3413
  }
3414
3414
  },
3415
3415
  "widgetTypes": [
3416
+ "AttachedFiles",
3416
3417
  "ComposedView",
3417
3418
  "ConversationSearchResults",
3418
3419
  "CustomVisualization",
3419
3420
  "DriveFiles",
3420
3421
  "EntityMention",
3422
+ "ImageGallery",
3421
3423
  "MultiChoice",
3422
3424
  "QuickReplies",
3423
3425
  "SuggestedActions",
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import React, { useRef, useEffect } from "react";
4
- import { G as resolveWidgetName, j as conversationWidgetRegistry } from "./chunks/widget-name-resolver-B9k-s_cF.js";
5
- import { H } from "./chunks/widget-name-resolver-B9k-s_cF.js";
6
- import { y as ConversationWidgetRenderContext, a6 as WidgetImageReadinessContext, R as ReadOnlyConversationWidgetProvider, a7 as WidgetImageRenderContext, a8 as WidgetImageLiveHydrationContext, z as buildWidgetAgentSpaceKeyProps } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
7
- import { a9, aa, ab } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
4
+ import { G as resolveWidgetName, j as conversationWidgetRegistry } from "./chunks/widget-name-resolver-In5UWRB3.js";
5
+ import { H } from "./chunks/widget-name-resolver-In5UWRB3.js";
6
+ import { z as ConversationWidgetRenderContext, a7 as WidgetImageReadinessContext, R as ReadOnlyConversationWidgetProvider, a8 as WidgetImageRenderContext, a9 as WidgetImageLiveHydrationContext, A as buildWidgetAgentSpaceKeyProps } from "./chunks/WebSearchResultsConversationWidget-W7O1fBB0.js";
7
+ import { aa, ab, ac } from "./chunks/WebSearchResultsConversationWidget-W7O1fBB0.js";
8
8
  import { r as readWidgetImageReadiness, p as publishWidgetImageReadiness, i as interceptXMLHttpRequests, a as interceptFetchRequests, c as createHeaderlessResponse, t as toSameRealmFetchInput } from "./chunks/browser-request-interception-BnzFbH0m.js";
9
9
  import { W, b } from "./chunks/browser-request-interception-BnzFbH0m.js";
10
10
  import { U as getGoogleMapWidgetNames, X as getWidgetImageCaptureReadPathPrefix } from "./chunks/link-navigation-BUcy5qWW.js";
@@ -367,12 +367,12 @@ export {
367
367
  isGoogleMapCapture,
368
368
  publishWidgetImageReadiness,
369
369
  H as readComposedViewDataTimes,
370
- a9 as readFrozenHydration,
370
+ aa as readFrozenHydration,
371
371
  readWidgetImageReadiness,
372
372
  b as readWidgetImageReadinessGlobalNames,
373
373
  registerStaticWidgetImageComponents,
374
374
  staticWidgetImageComponents,
375
- aa as useWidgetImageLiveHydration,
376
- ab as useWidgetImageRender
375
+ ab as useWidgetImageLiveHydration,
376
+ ac as useWidgetImageRender
377
377
  };
378
378
  //# sourceMappingURL=image-render.js.map
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
- import { h, i } from "./chunks/widget-name-resolver-B9k-s_cF.js";
3
- import { r as registerCanvasBodies, c as canvasBodies } from "./chunks/canvasBodies-CQEBkIVw.js";
4
- import { g, a, b } from "./chunks/canvasBodies-CQEBkIVw.js";
5
- import { a as isPackageCanvasId, d as declareCanvasKind, f as forgetCanvasKind } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
6
- import { r, b as b2, c, e, g as g2 } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
2
+ import { h, i } from "./chunks/widget-name-resolver-In5UWRB3.js";
3
+ import { r as registerCanvasBodies, c as canvasBodies } from "./chunks/canvasBodies-8jRybJVU.js";
4
+ import { g, a, b } from "./chunks/canvasBodies-8jRybJVU.js";
5
+ import { a as isPackageCanvasId, d as declareCanvasKind, f as forgetCanvasKind } from "./chunks/WebSearchResultsConversationWidget-W7O1fBB0.js";
6
+ import { r, b as b2, c, e, g as g2, h as h2 } from "./chunks/WebSearchResultsConversationWidget-W7O1fBB0.js";
7
7
  import { r as registerCanvasFeatureFlags, c as canvasFeatureFlags } from "./chunks/canvas-feature-flags-Cn8xBliA.js";
8
8
  import { A, i as i2 } from "./chunks/icon-names-Di6c4zLo.js";
9
9
  import { A as A2, f } from "./chunks/host-color-scheme-Jhb7JZR7.js";
10
- import { A as A3, a as a2, B, C, b as b3, D, c as c2, d, e as e2, f as f2, G, H, g as g3, I, h as h2, L, M, i as i3, j, k, P, R, l, S, m, n, o, p, q, r as r2, T, s, t, u, v, w, W, x, y, z, E, F, J, K, N, O, Q, U, V, X, Y, Z, _, $, a0, a1, a2 as a22, a3, a4, a5, a6, a7, a8, a9, aa, ab } from "./chunks/link-navigation-BUcy5qWW.js";
10
+ import { A as A3, a as a2, B, C, b as b3, D, c as c2, d, e as e2, f as f2, G, H, g as g3, I, h as h3, L, M, i as i3, j, k, P, R, l, S, m, n, o, p, q, r as r2, T, s, t, u, v, w, W, x, y, z, E, F, J, K, N, O, Q, U, V, X, Y, Z, _, $, a0, a1, a2 as a22, a3, a4, a5, a6, a7, a8, a9, aa, ab } from "./chunks/link-navigation-BUcy5qWW.js";
11
11
  import { u as u2, a as a10 } from "./chunks/AgentsConversationClientContext-C4T7g_Qk.js";
12
12
  const registerCanvasKind = (kind) => {
13
13
  if (isPackageCanvasId(kind.canvasId)) {
@@ -43,7 +43,7 @@ export {
43
43
  H as HeroRow,
44
44
  g3 as HeroValue,
45
45
  I as Icon,
46
- h2 as InteractiveSurface,
46
+ h3 as InteractiveSurface,
47
47
  L as LoadingSpinner,
48
48
  M as Map,
49
49
  i3 as MapMarker,
@@ -95,7 +95,8 @@ export {
95
95
  c as registerDriveFileCanvasOpener,
96
96
  e as registerDriveFileCardsSource,
97
97
  b as registerEntityDetailBodies,
98
- g2 as registerWidgetHydrator,
98
+ g2 as registerFilePreviewSource,
99
+ h2 as registerWidgetHydrator,
99
100
  _ as reportRunningTurn,
100
101
  $ as reportWidgetCrash,
101
102
  a0 as setAgentsEnvironment,
package/dist/kit.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { A, C, a, b, c, d, e, E, r, f, u, g } from "./chunks/widget-name-resolver-B9k-s_cF.js";
3
- import { M } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
2
+ import { A, C, a, b, c, d, e, E, r, f, u, g } from "./chunks/widget-name-resolver-In5UWRB3.js";
3
+ import { M } from "./chunks/WebSearchResultsConversationWidget-W7O1fBB0.js";
4
4
  import { E as E2, u as u2 } from "./chunks/entity-detail-name-3A82gDAp.js";
5
5
  export {
6
6
  A as ApexChart,
package/dist/preview.js CHANGED
@@ -2,12 +2,12 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { s as Text, Y as getWidgetSelfHydrationKeyFieldName, e as DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME, V as getSandboxLegacyAliases } from "./chunks/link-navigation-BUcy5qWW.js";
4
4
  import { useRef, useState, useMemo, useEffect, useCallback } from "react";
5
- import { Q as buildComposedViewComponentRegistry, R as composedViewComponents, G as resolveWidgetName, j as conversationWidgetRegistry, o as ConversationWidgetErrorBoundary, S as ComposedViewComponentsContext } from "./chunks/widget-name-resolver-B9k-s_cF.js";
6
- import { aE as WidgetSurface, Y as readWidgetAgentSpaceKeyAttribute, h as canvasBehaviourOf, W as WidgetRenderReportContext, z as buildWidgetAgentSpaceKeyProps, S as StandaloneConversationWidgetProvider, y as ConversationWidgetRenderContext, a7 as WidgetImageRenderContext, ac as CANVAS_VIABLE_MIN_WIDTH, l as listWidgetHydratorTypes, j as getWidgetHydrator, u as unregisterWidgetHydrator, g as registerWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
7
- import { c as canvasBodies, E as EntityMentionAskButton } from "./chunks/canvasBodies-CQEBkIVw.js";
8
- import { f as decideCanvasOpen } from "./chunks/canvas-reducers-D-YxAR4B.js";
5
+ import { Q as buildComposedViewComponentRegistry, R as composedViewComponents, G as resolveWidgetName, j as conversationWidgetRegistry, o as ConversationWidgetErrorBoundary, S as ComposedViewComponentsContext } from "./chunks/widget-name-resolver-In5UWRB3.js";
6
+ import { aN as WidgetSurface, Z as readWidgetAgentSpaceKeyAttribute, j as canvasBehaviourOf, W as WidgetRenderReportContext, A as buildWidgetAgentSpaceKeyProps, S as StandaloneConversationWidgetProvider, z as ConversationWidgetRenderContext, a8 as WidgetImageRenderContext, ah as CANVAS_VIABLE_MIN_WIDTH, l as listWidgetHydratorTypes, k as getWidgetHydrator, u as unregisterWidgetHydrator, h as registerWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-W7O1fBB0.js";
7
+ import { c as canvasBodies, E as EntityMentionAskButton } from "./chunks/canvasBodies-8jRybJVU.js";
8
+ import { f as decideCanvasOpen } from "./chunks/canvas-reducers-DDg9T7t8.js";
9
9
  import { p as publishWidgetImageReadiness, i as interceptXMLHttpRequests, d as isFetchRequest, c as createHeaderlessResponse } from "./chunks/browser-request-interception-BnzFbH0m.js";
10
- import { C as ConversationWidgetProvider, a as ConversationMessageInputComposerWidgets } from "./chunks/ConversationMessageInputComposerWidgets-CE8LpyXY.js";
10
+ import { C as ConversationWidgetProvider, a as ConversationMessageInputComposerWidgets } from "./chunks/ConversationMessageInputComposerWidgets-DPflWZ5o.js";
11
11
  const page$1 = "agents_page_5VMDeD";
12
12
  const chatColumn = "agents_chatColumn_FWcgdJ";
13
13
  const widget = "agents_widget_3qpgMy";
package/dist/renderer.js CHANGED
@@ -1,17 +1,17 @@
1
1
  "use client";
2
- import { C, a, M, W, b, c, d, p, s } from "./chunks/ConversationMarkdown-BsCjyhj4.js";
3
- import { m as findWidgetFenceByPayloadHash, n as findWidgetFencesInMarkdown } from "./chunks/widget-name-resolver-B9k-s_cF.js";
4
- import { o, p as p2, q, t, v, w, j, x, y, z, B, D, F, G } from "./chunks/widget-name-resolver-B9k-s_cF.js";
5
- import { m as useResolvedConversationWidgetAgentSpaceKey, p as payloadHashOfInstanceId } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
6
- import { C as C2, n, o as o2, q as q2, t as t2, v as v2, w as w2, x as x2, y as y2, D as D2, L, R, S, W as W2, z as z2, h, A, B as B2, E, F as F2, G as G2, H, I, J, K, N, O, j as j2, P, Q, i, T, a as a2, U, V, X, Y, Z, g, _, s as s2, $, u, a0, a1, a2 as a22, a3, a4, a5 } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
7
- import { C as C3, d as d2, g as g2, i as i2, r, u as u2 } from "./chunks/canvas-title-slot-context-D6UXrkdJ.js";
8
- import { c as c2, u as u3 } from "./chunks/canvasBodies-CQEBkIVw.js";
2
+ import { C, a, M, W, b, c, d, p, s } from "./chunks/ConversationMarkdown-Cg80bH6c.js";
3
+ import { m as findWidgetFenceByPayloadHash, n as findWidgetFencesInMarkdown } from "./chunks/widget-name-resolver-In5UWRB3.js";
4
+ import { o, p as p2, q, t, v, w, j, x, y, z, B, D, F, G } from "./chunks/widget-name-resolver-In5UWRB3.js";
5
+ import { n as useResolvedConversationWidgetAgentSpaceKey, p as payloadHashOfInstanceId } from "./chunks/WebSearchResultsConversationWidget-W7O1fBB0.js";
6
+ import { C as C2, o as o2, q as q2, t as t2, v as v2, w as w2, x as x2, y as y2, z as z2, D as D2, L, R, S, W as W2, A, j as j2, B as B2, E, F as F2, G as G2, H, I, J, K, N, O, P, k, Q, T, i, U, a as a2, V, X, Y, Z, _, h, $, s as s2, a0, u, a1, a2 as a22, a3, a4, a5, a6 } from "./chunks/WebSearchResultsConversationWidget-W7O1fBB0.js";
7
+ import { C as C3, d as d2, g, i as i2, r, u as u2 } from "./chunks/canvas-title-slot-context-vg_UPT-V.js";
8
+ import { c as c2, u as u3 } from "./chunks/canvasBodies-8jRybJVU.js";
9
9
  import { jsxs, jsx } from "react/jsx-runtime";
10
10
  import { n as Skeleton } from "./chunks/link-navigation-BUcy5qWW.js";
11
11
  import { ac, ad, ae, af, ag } from "./chunks/link-navigation-BUcy5qWW.js";
12
12
  import { useMemo } from "react";
13
- import { a as a6, b as b2, c as c3, d as d3, e } from "./chunks/canvas-reducers-D-YxAR4B.js";
14
- import { a as a7 } from "./chunks/canvas-feature-flags-Cn8xBliA.js";
13
+ import { a as a7, b as b2, c as c3, d as d3, e } from "./chunks/canvas-reducers-DDg9T7t8.js";
14
+ import { a as a8 } from "./chunks/canvas-feature-flags-Cn8xBliA.js";
15
15
  const pickSection = (payloadValue, fallback) => {
16
16
  return payloadValue ?? fallback.data ?? void 0;
17
17
  };
@@ -41,7 +41,7 @@ const sectionCoversKeys = (payloadValue, requiredKeys) => {
41
41
  if (!payloadValue) {
42
42
  return false;
43
43
  }
44
- return requiredKeys.every((k) => payloadValue[k] !== void 0);
44
+ return requiredKeys.every((k2) => payloadValue[k2] !== void 0);
45
45
  };
46
46
  const isSectionIncomplete = (payloadValue, fallback, requiredKeys) => {
47
47
  if (!fallback.isLoading) {
@@ -50,8 +50,8 @@ const isSectionIncomplete = (payloadValue, fallback, requiredKeys) => {
50
50
  if (!payloadValue) {
51
51
  return true;
52
52
  }
53
- return requiredKeys.some((k) => {
54
- return payloadValue[k] === void 0;
53
+ return requiredKeys.some((k2) => {
54
+ return payloadValue[k2] === void 0;
55
55
  });
56
56
  };
57
57
  const ConversationWidgetGateSkeleton = () => /* @__PURE__ */ jsxs("div", { "data-testid": "ConversationWidgetGateSkeleton", children: [
@@ -99,20 +99,20 @@ const withConversationWidgetVariant = (base, rawPayload) => {
99
99
  export {
100
100
  ac as AgentsWidgetHydrationStateContainer,
101
101
  C2 as CANVAS_BOXED_INSET_PX,
102
- n as CANVAS_FILLS_SCREEN_WIDTH_PERCENT,
103
- o2 as CANVAS_MIN_WIDTH_PX,
104
- q2 as CHAT_COLUMN_MIN_WIDTH_PX,
102
+ o2 as CANVAS_FILLS_SCREEN_WIDTH_PERCENT,
103
+ q2 as CANVAS_MIN_WIDTH_PX,
104
+ t2 as CHAT_COLUMN_MIN_WIDTH_PX,
105
105
  C3 as CanvasTitleSlotContext,
106
106
  C as ConversationMarkdown,
107
- t2 as ConversationWidgetActions,
108
- v2 as ConversationWidgetAgentSpaceFrame,
109
- w2 as ConversationWidgetAgentSpaceHeader,
110
- x2 as ConversationWidgetContext,
107
+ v2 as ConversationWidgetActions,
108
+ w2 as ConversationWidgetAgentSpaceFrame,
109
+ x2 as ConversationWidgetAgentSpaceHeader,
110
+ y2 as ConversationWidgetContext,
111
111
  o as ConversationWidgetErrorBoundary,
112
112
  p2 as ConversationWidgetFeatureGate,
113
113
  ConversationWidgetGateSkeleton,
114
114
  a as ConversationWidgetHost,
115
- y2 as ConversationWidgetRenderContext,
115
+ z2 as ConversationWidgetRenderContext,
116
116
  D2 as DEFAULT_CANVAS_WIDTH_PERCENT,
117
117
  L as LEGACY_CARD_CLICK_ORIGIN,
118
118
  M as MarkdownLink,
@@ -123,71 +123,71 @@ export {
123
123
  ae as WidgetHydrationSlice,
124
124
  W2 as WidgetRenderReportContext,
125
125
  q as addComposedNodeSchemaApplicationPart,
126
- a6 as applyClearCanvas,
126
+ a7 as applyClearCanvas,
127
127
  b2 as applyCloseCanvas,
128
128
  c3 as applyOpenCanvas,
129
129
  d3 as applyResetCanvasForNewTurn,
130
130
  e as applySetCanvasCreatedEntityId,
131
131
  b as buildComposerWidgetFenceBlock,
132
132
  c as buildMessageTextWithComposerWidgets,
133
- z2 as buildWidgetAgentSpaceKeyProps,
133
+ A as buildWidgetAgentSpaceKeyProps,
134
134
  d as buildWidgetRenderReportSignal,
135
- h as canvasBehaviourOf,
135
+ j2 as canvasBehaviourOf,
136
136
  c2 as canvasBodies,
137
- a7 as canvasFeatureFlagOf,
138
- A as canvasInstanceIdForActiveAgentSpace,
139
- B2 as canvasInstanceIdForAgentSpace,
140
- E as canvasInstanceIdForEntity,
141
- F2 as canvasInstanceIdForMessage,
142
- G2 as canvasInstanceIdForMessagePayload,
143
- H as canvasInstanceIdForReference,
144
- I as canvasKindOpenerWidgetNamesOf,
145
- J as canvasWidthPercentOf,
137
+ a8 as canvasFeatureFlagOf,
138
+ B2 as canvasInstanceIdForActiveAgentSpace,
139
+ E as canvasInstanceIdForAgentSpace,
140
+ F2 as canvasInstanceIdForEntity,
141
+ G2 as canvasInstanceIdForMessage,
142
+ H as canvasInstanceIdForMessagePayload,
143
+ I as canvasInstanceIdForReference,
144
+ J as canvasKindOpenerWidgetNamesOf,
145
+ K as canvasWidthPercentOf,
146
146
  t as closestWidgetNames,
147
147
  v as composedNodeSchema,
148
148
  w as composedViewTreeToWire,
149
149
  j as conversationWidgetRegistry,
150
150
  af as createAgentsWidgetHydrationStateStore,
151
151
  d2 as deepLinkableWidgetNameForCanvas,
152
- K as defaultConversationWidgetCallbacks,
153
- N as entityIdOfInstanceId,
152
+ N as defaultConversationWidgetCallbacks,
153
+ O as entityIdOfInstanceId,
154
154
  findWidgetFenceByPayloadHash,
155
155
  findWidgetFencesInMarkdown,
156
156
  x as getComposedNodeSchema,
157
157
  y as getConversationWidgetRegistryRevision,
158
- O as getDeclaredCanvasIds,
158
+ P as getDeclaredCanvasIds,
159
159
  ag as getDefaultAgentsStateStore,
160
- g2 as getWidgetClickSignalSources,
161
- j2 as getWidgetHydrator,
162
- P as hasWidgetHydrator,
163
- Q as isCanvasAnchorLoaded,
160
+ g as getWidgetClickSignalSources,
161
+ k as getWidgetHydrator,
162
+ Q as hasWidgetHydrator,
163
+ T as isCanvasAnchorLoaded,
164
164
  i as isCanvasId,
165
- T as isCanvasReference,
165
+ U as isCanvasReference,
166
166
  a2 as isPackageCanvasId,
167
167
  isSectionIncomplete,
168
168
  isSectionLoading,
169
169
  i2 as isWidgetClickSignalSource,
170
170
  mergeSection,
171
171
  mergeSectionValues,
172
- U as messageAnchor,
173
- V as packageCanvasBehaviours,
174
- X as pageAnchor,
172
+ V as messageAnchor,
173
+ X as packageCanvasBehaviours,
174
+ Y as pageAnchor,
175
175
  p as parseWidgetRenderReportSignal,
176
176
  payloadHashOfInstanceId,
177
177
  pickSection,
178
178
  z as readComposedViewTree,
179
179
  B as readConversationWidgetRegistrations,
180
180
  D as readOpenEntityActionTarget,
181
- Y as readWidgetAgentSpaceKeyAttribute,
182
- Z as referenceOfCanvasInstanceId,
183
- g as registerWidgetHydrator,
181
+ Z as readWidgetAgentSpaceKeyAttribute,
182
+ _ as referenceOfCanvasInstanceId,
183
+ h as registerWidgetHydrator,
184
184
  F as resolveCanonicalWidgetName,
185
185
  r as resolveDeepLinkableWidget,
186
186
  G as resolveWidgetName,
187
- _ as sameCanvasAnchor,
187
+ $ as sameCanvasAnchor,
188
188
  s2 as sameCanvasIdentity,
189
189
  sectionCoversKeys,
190
- $ as shortStringHash,
190
+ a0 as shortStringHash,
191
191
  s as splitComposerWidgetFencesFromMessageText,
192
192
  u as unregisterWidgetHydrator,
193
193
  useAnchorWidgetAgentSpaceKey,
@@ -195,13 +195,13 @@ export {
195
195
  u3 as useAnchorWidgetPayload,
196
196
  u2 as useCanvasTitleSlot,
197
197
  useConversationWidgetAgentSpaceFallback,
198
- a0 as useConversationWidgetContext,
199
- a1 as useIsEmailWidgetRender,
200
- a22 as useReportWidgetRenderStatus,
198
+ a1 as useConversationWidgetContext,
199
+ a22 as useIsEmailWidgetRender,
200
+ a3 as useReportWidgetRenderStatus,
201
201
  useResolvedConversationWidgetAgentSpaceKey,
202
- a3 as useWidgetHydration,
203
- a4 as useWidgetMemory,
204
- a5 as useWidgetRenderReporter,
202
+ a4 as useWidgetHydration,
203
+ a5 as useWidgetMemory,
204
+ a6 as useWidgetRenderReporter,
205
205
  withConversationWidgetVariant
206
206
  };
207
207
  //# sourceMappingURL=renderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.js","sources":["../src/renderer/widget-hydration/section-hydration.ts","../src/renderer/_access/ConversationWidgetGateSkeleton.tsx","../src/renderer/_agent-space/use-conversation-widget-agent-space-fallback.ts","../src/renderer/canvas/use-anchor-widget-agent-space-key.ts","../src/renderer/read-conversation-widget-variant.ts"],"sourcesContent":["export interface SectionHydrationResult<T> {\n data: T | null;\n isLoading: boolean;\n error?: string | null;\n}\n\nexport type SectionHydrator<T> = () => SectionHydrationResult<T>;\n\n/**\n * Prefer payload-provided value; fall back to a hydrator result; undefined otherwise.\n * Callers should call the fallback hook unconditionally (React hook rules) and pass\n * its result here.\n */\nexport const pickSection = <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>): T | undefined => {\n return payloadValue ?? fallback.data ?? undefined;\n};\n\n/**\n * True when payload is missing the value AND the fallback is still loading.\n */\nexport const isSectionLoading = <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>): boolean => {\n return payloadValue === undefined && fallback.isLoading;\n};\n\n/**\n * Field-level merge of two section values. Payload fields (when defined) win\n * over hydrated fields; undefined payload fields are filled from the hydrated\n * value. Use when the agent sends partial section data (e.g. only a CTA) and\n * the client hydrates the remaining fields.\n */\nexport const mergeSectionValues = <T extends object>(\n payloadValue: T | undefined,\n hydratedValue: T | undefined,\n): T | undefined => {\n if (!hydratedValue) {\n return payloadValue;\n }\n if (!payloadValue) {\n return hydratedValue;\n }\n\n const defined: Partial<T> = {};\n for (const key of Object.keys(payloadValue) as Array<keyof T>) {\n const v = payloadValue[key];\n if (v !== undefined) {\n defined[key] = v;\n }\n }\n return { ...hydratedValue, ...defined } as T;\n};\n\n/**\n * Field-level merge for object sections. Payload fields (when defined) win over\n * fallback fields. Undefined payload fields are filled from the fallback. Use\n * this when the agent sends partial section data (e.g. only a CTA) and the\n * client needs to hydrate the remaining fields from app state.\n */\nexport const mergeSection = <T extends object>(\n payloadValue: T | undefined,\n fallback: SectionHydrationResult<T>,\n): T | undefined => {\n return mergeSectionValues(payloadValue, fallback.data ?? undefined);\n};\n\n/**\n * True when the payload provides every field in `requiredKeys` — the section\n * can render straight from the agent payload without waiting for hydration.\n */\nexport const sectionCoversKeys = <T extends object>(\n payloadValue: T | undefined,\n requiredKeys: ReadonlyArray<keyof T>,\n): boolean => {\n if (!payloadValue) {\n return false;\n }\n return requiredKeys.every((k) => payloadValue[k] !== undefined);\n};\n\n/**\n * True when the fallback is still loading AND the payload has not provided\n * every expected field (listed in `requiredKeys`). Use together with\n * `mergeSection` to decide whether to show a skeleton for the section.\n */\nexport const isSectionIncomplete = <T extends object>(\n payloadValue: T | undefined,\n fallback: SectionHydrationResult<T>,\n requiredKeys: ReadonlyArray<keyof T>,\n): boolean => {\n if (!fallback.isLoading) {\n return false;\n }\n if (!payloadValue) {\n return true;\n }\n return requiredKeys.some((k) => {\n return (payloadValue as T)[k] === undefined;\n });\n};\n","import { Skeleton } from \"../../provider/components\";\nimport React from \"react\";\n\n/**\n * Neutral loading state shown by ConversationWidgetFeatureGate while another agent space's feature\n * flags are being fetched. The gate can't know the gated widget's own skeleton, so this\n * is a generic widget-sized placeholder.\n */\nexport const ConversationWidgetGateSkeleton = () => (\n <div data-testid=\"ConversationWidgetGateSkeleton\">\n <Skeleton height=\"20px\" width=\"40%\" />\n <Skeleton height=\"64px\" width=\"100%\" borderRadius=\"8px\" />\n </div>\n);\n","import { SectionHydrationResult } from \"../widget-hydration\";\nimport { useResolvedConversationWidgetAgentSpaceKey } from \"./use-resolved-conversation-widget-agent-space-key\";\n\n/**\n * The empty fallback of a widget of another agent space: such a widget must not merge what the app holds for the\n * ACTIVE agent space into its own data.\n */\nconst ANOTHER_AGENT_SPACE_EMPTY_FALLBACK = { data: null, isLoading: false, error: null } as const;\n\n/**\n * Resolves the widget's agent space and picks the fallback every snapshot widget needs with it.\n *\n * - Active agent space → the caller's live `activeFallback`, so `mergeSection` keeps merging the app's fresher data.\n * - Another agent space → a static empty result, so the widget's own data passes through `mergeSection` unmixed.\n *\n * Pass the result of the active-fallback hook in directly:\n * useConversationWidgetAgentSpaceFallback(agentSpaceKeyAttribute, useSomeActiveHydration())\n * The hook order is the same on every render.\n */\nexport const useConversationWidgetAgentSpaceFallback = <T>(\n agentSpaceKeyAttribute: string | number | undefined,\n activeFallback: SectionHydrationResult<T>,\n): {\n anotherAgentSpaceKey: number | undefined;\n isAnotherAgentSpace: boolean;\n fallback: SectionHydrationResult<T>;\n} => {\n const { anotherAgentSpaceKey, isAnotherAgentSpace } = useResolvedConversationWidgetAgentSpaceKey(agentSpaceKeyAttribute);\n return {\n anotherAgentSpaceKey,\n isAnotherAgentSpace,\n fallback: isAnotherAgentSpace ? (ANOTHER_AGENT_SPACE_EMPTY_FALLBACK as SectionHydrationResult<T>) : activeFallback,\n };\n};\n","import { useMemo } from \"react\";\nimport { useResolvedConversationWidgetAgentSpaceKey } from \"../_agent-space/use-resolved-conversation-widget-agent-space-key\";\nimport type { CanvasState } from \"./canvas-state\";\nimport { payloadHashOfInstanceId } from \"./canvas-state\";\nimport { findWidgetFenceByPayloadHash, findWidgetFencesInMarkdown } from \"./find-widget-fences-in-markdown\";\n\n/**\n * The key of the agent space the fence of the anchor message names — unresolved, exactly what the inline widget\n * receives as its prop. Undefined for a page anchor, a missing anchor message or a fence that names no agent space.\n * For a body whose inline widget resolves the key itself, so both resolve it the same way.\n */\nexport const useAnchorWidgetFenceAgentSpaceKey = (\n canvas: CanvasState,\n anchorMessageMarkdown: string | null,\n widgetName: string,\n): string | undefined =>\n useMemo(() => {\n if (canvas.anchor.kind !== \"message\" || anchorMessageMarkdown === null) return undefined;\n const payloadHash = payloadHashOfInstanceId(canvas.instanceId);\n const fence =\n payloadHash !== undefined\n ? findWidgetFenceByPayloadHash(anchorMessageMarkdown, widgetName, payloadHash)\n : findWidgetFencesInMarkdown(anchorMessageMarkdown).find((candidate) => candidate.name === widgetName);\n return fence?.agentSpaceKey;\n }, [canvas.anchor, canvas.instanceId, anchorMessageMarkdown, widgetName]);\n\n/**\n * The agent space a message-anchored canvas body works on, resolved the way its inline widget resolves it: the agent\n * space the fence names when it is ANOTHER one than the active one, else the chat's agent space (`chatAgentSpaceKey`,\n * passed by the shell), else the active one. For a page anchor: the anchor's agent space.\n *\n * A fence that names the ACTIVE agent space is dropped here in favour of the chat's agent space — the order of the\n * inline widgets that compute `anotherAgentSpaceKey ?? chatAgentSpaceKey`. A widget whose inline render lets the\n * fence win reads {@link useAnchorWidgetFenceAgentSpaceKey} instead.\n */\nexport const useAnchorWidgetAgentSpaceKey = (\n canvas: CanvasState,\n anchorMessageMarkdown: string | null,\n widgetName: string,\n chatAgentSpaceKey: number | undefined,\n): number | undefined => {\n const fenceAgentSpaceKey = useAnchorWidgetFenceAgentSpaceKey(canvas, anchorMessageMarkdown, widgetName);\n const { anotherAgentSpaceKey, activeAgentSpaceKey } = useResolvedConversationWidgetAgentSpaceKey(fenceAgentSpaceKey);\n if (canvas.anchor.kind === \"page\") return canvas.anchor.agentSpaceKey;\n return anotherAgentSpaceKey ?? chatAgentSpaceKey ?? activeAgentSpaceKey;\n};\n","/**\n * Density flag shared by snapshot widgets. Lives on the payload, but it\n * is a PRESENTATION choice the agent makes — independent of whether the widget's data\n * came from the agent's payload or from live hydration.\n */\nexport type ConversationWidgetVariant = \"compact\" | \"full\";\n\ninterface WithVariant {\n variant?: ConversationWidgetVariant;\n}\n\n/**\n * Read just the `variant` flag out of a raw widget payload string, even when the\n * rest of the payload is incomplete (so the agent can request a density with a\n * minimal `{\"variant\":\"compact\"}` and let the data hydrate).\n */\nexport const readPayloadVariant = (rawPayload: string): ConversationWidgetVariant | undefined => {\n try {\n const parsed = JSON.parse(rawPayload) as { variant?: unknown };\n if (parsed && (parsed.variant === \"compact\" || parsed.variant === \"full\")) {\n return parsed.variant;\n }\n } catch {\n // Non-JSON or empty payload — no variant to read.\n }\n return undefined;\n};\n\n/**\n * Overlay the agent's requested `variant` onto the resolved widget data. The agent's\n * payload variant always wins; when the payload omits it the resolved data's own\n * variant (or the widget default) stands.\n */\nexport const withConversationWidgetVariant = <T extends WithVariant>(\n base: T | undefined,\n rawPayload: string,\n): T | undefined => {\n if (!base) {\n return base;\n }\n const variant = readPayloadVariant(rawPayload);\n return variant ? { ...base, variant } : base;\n};\n"],"names":["v"],"mappings":";;;;;;;;;;;;;;AAaO,MAAM,cAAc,CAAI,cAA6B,aAAuD;AACjH,SAAO,gBAAgB,SAAS,QAAQ;AAC1C;AAKO,MAAM,mBAAmB,CAAI,cAA6B,aAAiD;AAChH,SA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AAA,IACL;AAAA,IACA;AAAA,IACA,UAAU,sBAAuB,qCAAmE;AAAA,EAAA;AAExG;ACtBO,MAAM,oCAAoC,CAC/C,QACA,uBACA,eAEA,QAAQ,MAAM;AACZ,MAAI,OAAO,OAAO,SAAS,aAAa,0BAA0B,KAAM,QAAO;AAC/E,QAAM,cAAc,wBAAwB,OAAO,UAAU;AAC7D,QAAM,QACJ,gBAAgB,SACZ,6BAA6B,uBAAuB,YAAY,WAAW,IAC3E,2BAA2B,qBAAqB,EAAE,KAAK,CAAC,cAAc,UAAU,SAAS,UAAU;AACzG,SAAO,OAAO;AAChB,GAAG,CAAC,OAAO,QAAQ,OAAO,YAAY,uBAAuB,UAAU,CAAC;AAWnE,MAAM,+BAA+B,CAC1C,QACA,uBACA,YACA,sBACuB;AACvB,QAAM,qBAAqB,kCAAkC,QAAQ,uBAAuB,UAAU;AACtG,QAAM,EAAE,sBAAsB,wBAAwB,2CAA2C,kBAAkB;AACnH,MAAI,OAAO,OAAO,SAAS,OAAQ,QAAO,OAAO,OAAO;AACxD,SAAO,wBAAwB,qBAAqB;AACtD;AC7BO,MAAM,qBAAqB,CAAC,eAA8D;AAC/F,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,UAAU;AACpC,QAAI,WAAW,OAAO,YAAY,aAAa,OAAO,YAAY,SAAS;AACzE,aAAO,OAAO;AAAA,IAChB;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO;AACT;AAOO,MAAM,gCAAgC,CAC3C,MACA,eACkB;AAClB,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,QAAM,UAAU,mBAAmB,UAAU;AAC7C,SAAO,UAAU,EAAE,GAAG,MAAM,YAAY;AAC1C;"}
1
+ {"version":3,"file":"renderer.js","sources":["../src/renderer/widget-hydration/section-hydration.ts","../src/renderer/_access/ConversationWidgetGateSkeleton.tsx","../src/renderer/_agent-space/use-conversation-widget-agent-space-fallback.ts","../src/renderer/canvas/use-anchor-widget-agent-space-key.ts","../src/renderer/read-conversation-widget-variant.ts"],"sourcesContent":["export interface SectionHydrationResult<T> {\n data: T | null;\n isLoading: boolean;\n error?: string | null;\n}\n\nexport type SectionHydrator<T> = () => SectionHydrationResult<T>;\n\n/**\n * Prefer payload-provided value; fall back to a hydrator result; undefined otherwise.\n * Callers should call the fallback hook unconditionally (React hook rules) and pass\n * its result here.\n */\nexport const pickSection = <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>): T | undefined => {\n return payloadValue ?? fallback.data ?? undefined;\n};\n\n/**\n * True when payload is missing the value AND the fallback is still loading.\n */\nexport const isSectionLoading = <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>): boolean => {\n return payloadValue === undefined && fallback.isLoading;\n};\n\n/**\n * Field-level merge of two section values. Payload fields (when defined) win\n * over hydrated fields; undefined payload fields are filled from the hydrated\n * value. Use when the agent sends partial section data (e.g. only a CTA) and\n * the client hydrates the remaining fields.\n */\nexport const mergeSectionValues = <T extends object>(\n payloadValue: T | undefined,\n hydratedValue: T | undefined,\n): T | undefined => {\n if (!hydratedValue) {\n return payloadValue;\n }\n if (!payloadValue) {\n return hydratedValue;\n }\n\n const defined: Partial<T> = {};\n for (const key of Object.keys(payloadValue) as Array<keyof T>) {\n const v = payloadValue[key];\n if (v !== undefined) {\n defined[key] = v;\n }\n }\n return { ...hydratedValue, ...defined } as T;\n};\n\n/**\n * Field-level merge for object sections. Payload fields (when defined) win over\n * fallback fields. Undefined payload fields are filled from the fallback. Use\n * this when the agent sends partial section data (e.g. only a CTA) and the\n * client needs to hydrate the remaining fields from app state.\n */\nexport const mergeSection = <T extends object>(\n payloadValue: T | undefined,\n fallback: SectionHydrationResult<T>,\n): T | undefined => {\n return mergeSectionValues(payloadValue, fallback.data ?? undefined);\n};\n\n/**\n * True when the payload provides every field in `requiredKeys` — the section\n * can render straight from the agent payload without waiting for hydration.\n */\nexport const sectionCoversKeys = <T extends object>(\n payloadValue: T | undefined,\n requiredKeys: ReadonlyArray<keyof T>,\n): boolean => {\n if (!payloadValue) {\n return false;\n }\n return requiredKeys.every((k) => payloadValue[k] !== undefined);\n};\n\n/**\n * True when the fallback is still loading AND the payload has not provided\n * every expected field (listed in `requiredKeys`). Use together with\n * `mergeSection` to decide whether to show a skeleton for the section.\n */\nexport const isSectionIncomplete = <T extends object>(\n payloadValue: T | undefined,\n fallback: SectionHydrationResult<T>,\n requiredKeys: ReadonlyArray<keyof T>,\n): boolean => {\n if (!fallback.isLoading) {\n return false;\n }\n if (!payloadValue) {\n return true;\n }\n return requiredKeys.some((k) => {\n return (payloadValue as T)[k] === undefined;\n });\n};\n","import { Skeleton } from \"../../provider/components\";\nimport React from \"react\";\n\n/**\n * Neutral loading state shown by ConversationWidgetFeatureGate while another agent space's feature\n * flags are being fetched. The gate can't know the gated widget's own skeleton, so this\n * is a generic widget-sized placeholder.\n */\nexport const ConversationWidgetGateSkeleton = () => (\n <div data-testid=\"ConversationWidgetGateSkeleton\">\n <Skeleton height=\"20px\" width=\"40%\" />\n <Skeleton height=\"64px\" width=\"100%\" borderRadius=\"8px\" />\n </div>\n);\n","import { SectionHydrationResult } from \"../widget-hydration\";\nimport { useResolvedConversationWidgetAgentSpaceKey } from \"./use-resolved-conversation-widget-agent-space-key\";\n\n/**\n * The empty fallback of a widget of another agent space: such a widget must not merge what the app holds for the\n * ACTIVE agent space into its own data.\n */\nconst ANOTHER_AGENT_SPACE_EMPTY_FALLBACK = { data: null, isLoading: false, error: null } as const;\n\n/**\n * Resolves the widget's agent space and picks the fallback every snapshot widget needs with it.\n *\n * - Active agent space → the caller's live `activeFallback`, so `mergeSection` keeps merging the app's fresher data.\n * - Another agent space → a static empty result, so the widget's own data passes through `mergeSection` unmixed.\n *\n * Pass the result of the active-fallback hook in directly:\n * useConversationWidgetAgentSpaceFallback(agentSpaceKeyAttribute, useSomeActiveHydration())\n * The hook order is the same on every render.\n */\nexport const useConversationWidgetAgentSpaceFallback = <T>(\n agentSpaceKeyAttribute: string | number | undefined,\n activeFallback: SectionHydrationResult<T>,\n): {\n anotherAgentSpaceKey: number | undefined;\n isAnotherAgentSpace: boolean;\n fallback: SectionHydrationResult<T>;\n} => {\n const { anotherAgentSpaceKey, isAnotherAgentSpace } = useResolvedConversationWidgetAgentSpaceKey(agentSpaceKeyAttribute);\n return {\n anotherAgentSpaceKey,\n isAnotherAgentSpace,\n fallback: isAnotherAgentSpace ? (ANOTHER_AGENT_SPACE_EMPTY_FALLBACK as SectionHydrationResult<T>) : activeFallback,\n };\n};\n","import { useMemo } from \"react\";\nimport { useResolvedConversationWidgetAgentSpaceKey } from \"../_agent-space/use-resolved-conversation-widget-agent-space-key\";\nimport type { CanvasState } from \"./canvas-state\";\nimport { payloadHashOfInstanceId } from \"./canvas-state\";\nimport { findWidgetFenceByPayloadHash, findWidgetFencesInMarkdown } from \"./find-widget-fences-in-markdown\";\n\n/**\n * The key of the agent space the fence of the anchor message names — unresolved, exactly what the inline widget\n * receives as its prop. Undefined for a page anchor, a missing anchor message or a fence that names no agent space.\n * For a body whose inline widget resolves the key itself, so both resolve it the same way.\n */\nexport const useAnchorWidgetFenceAgentSpaceKey = (\n canvas: CanvasState,\n anchorMessageMarkdown: string | null,\n widgetName: string,\n): string | undefined =>\n useMemo(() => {\n if (canvas.anchor.kind !== \"message\" || anchorMessageMarkdown === null) return undefined;\n const payloadHash = payloadHashOfInstanceId(canvas.instanceId);\n const fence =\n payloadHash !== undefined\n ? findWidgetFenceByPayloadHash(anchorMessageMarkdown, widgetName, payloadHash)\n : findWidgetFencesInMarkdown(anchorMessageMarkdown).find((candidate) => candidate.name === widgetName);\n return fence?.agentSpaceKey;\n }, [canvas.anchor, canvas.instanceId, anchorMessageMarkdown, widgetName]);\n\n/**\n * The agent space a message-anchored canvas body works on, resolved the way its inline widget resolves it: the agent\n * space the fence names when it is ANOTHER one than the active one, else the chat's agent space (`chatAgentSpaceKey`,\n * passed by the shell), else the active one. For a page anchor: the anchor's agent space.\n *\n * A fence that names the ACTIVE agent space is dropped here in favour of the chat's agent space — the order of the\n * inline widgets that compute `anotherAgentSpaceKey ?? chatAgentSpaceKey`. A widget whose inline render lets the\n * fence win reads {@link useAnchorWidgetFenceAgentSpaceKey} instead.\n */\nexport const useAnchorWidgetAgentSpaceKey = (\n canvas: CanvasState,\n anchorMessageMarkdown: string | null,\n widgetName: string,\n chatAgentSpaceKey: number | undefined,\n): number | undefined => {\n const fenceAgentSpaceKey = useAnchorWidgetFenceAgentSpaceKey(canvas, anchorMessageMarkdown, widgetName);\n const { anotherAgentSpaceKey, activeAgentSpaceKey } = useResolvedConversationWidgetAgentSpaceKey(fenceAgentSpaceKey);\n if (canvas.anchor.kind === \"page\") return canvas.anchor.agentSpaceKey;\n return anotherAgentSpaceKey ?? chatAgentSpaceKey ?? activeAgentSpaceKey;\n};\n","/**\n * Density flag shared by snapshot widgets. Lives on the payload, but it\n * is a PRESENTATION choice the agent makes — independent of whether the widget's data\n * came from the agent's payload or from live hydration.\n */\nexport type ConversationWidgetVariant = \"compact\" | \"full\";\n\ninterface WithVariant {\n variant?: ConversationWidgetVariant;\n}\n\n/**\n * Read just the `variant` flag out of a raw widget payload string, even when the\n * rest of the payload is incomplete (so the agent can request a density with a\n * minimal `{\"variant\":\"compact\"}` and let the data hydrate).\n */\nexport const readPayloadVariant = (rawPayload: string): ConversationWidgetVariant | undefined => {\n try {\n const parsed = JSON.parse(rawPayload) as { variant?: unknown };\n if (parsed && (parsed.variant === \"compact\" || parsed.variant === \"full\")) {\n return parsed.variant;\n }\n } catch {\n // Non-JSON or empty payload — no variant to read.\n }\n return undefined;\n};\n\n/**\n * Overlay the agent's requested `variant` onto the resolved widget data. The agent's\n * payload variant always wins; when the payload omits it the resolved data's own\n * variant (or the widget default) stands.\n */\nexport const withConversationWidgetVariant = <T extends WithVariant>(\n base: T | undefined,\n rawPayload: string,\n): T | undefined => {\n if (!base) {\n return base;\n }\n const variant = readPayloadVariant(rawPayload);\n return variant ? { ...base, variant } : base;\n};\n"],"names":["v","k"],"mappings":";;;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