@mgamadeus/ddd-agents 0.1.0-alpha.23 → 0.1.0-alpha.25
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/dist/chat.js +71 -827
- package/dist/chat.js.map +1 -1
- package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js +631 -0
- package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js.map +1 -0
- package/dist/chunks/{WebSearchResultsConversationWidget-DRBQvycE.js → WebSearchResultsConversationWidget-as3p5bHw.js} +92 -85
- package/dist/chunks/WebSearchResultsConversationWidget-as3p5bHw.js.map +1 -0
- package/dist/chunks/{decide-canvas-open-DBWoWtAC.js → canvas-behaviours-AvzKSYyv.js} +3 -19
- package/dist/chunks/canvas-behaviours-AvzKSYyv.js.map +1 -0
- package/dist/chunks/canvas-reducers-Bfp_i7lc.js +88 -0
- package/dist/chunks/canvas-reducers-Bfp_i7lc.js.map +1 -0
- package/dist/chunks/{canvasBodies-DLjDkviP.js → canvasBodies-Cvu3l38p.js} +6 -3
- package/dist/chunks/{canvasBodies-DLjDkviP.js.map → canvasBodies-Cvu3l38p.js.map} +1 -1
- package/dist/chunks/canvasStorage-EvQsGdto.js +65 -0
- package/dist/chunks/canvasStorage-EvQsGdto.js.map +1 -0
- package/dist/chunks/contract-BxmMxYPF.js +96 -0
- package/dist/chunks/contract-BxmMxYPF.js.map +1 -0
- package/dist/chunks/conversation-BEF0aesf.js +31 -0
- package/dist/chunks/conversation-BEF0aesf.js.map +1 -0
- package/dist/chunks/{ConversationMarkdown-CJhAnuVa.js → widget-click-signal-sources-DulRkNvZ.js} +22 -77
- package/dist/chunks/widget-click-signal-sources-DulRkNvZ.js.map +1 -0
- package/dist/chunks/{widget-name-resolver-C8SfpiR5.js → widget-name-resolver-BGN3HpoG.js} +61 -30
- package/dist/chunks/widget-name-resolver-BGN3HpoG.js.map +1 -0
- package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js → withPollingChangeSubscription-B16htQGd.js} +2 -2
- package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js.map → withPollingChangeSubscription-B16htQGd.js.map} +1 -1
- package/dist/client-testing.js +28 -6
- package/dist/client-testing.js.map +1 -1
- package/dist/client.js +1 -1
- package/dist/contract.js +8 -27
- package/dist/contract.js.map +1 -1
- package/dist/image-render.js +8 -8
- package/dist/index.js +6 -5
- package/dist/kit.js +2 -2
- package/dist/preview.js +44 -16
- package/dist/preview.js.map +1 -1
- package/dist/renderer.js +62 -57
- package/dist/renderer.js.map +1 -1
- package/dist/styles.css +55 -22
- package/dist/types/client/testing/widget-hydration-stand-ins.d.ts +12 -3
- package/dist/types/entries/chat.d.ts +2 -0
- package/dist/types/entries/client-testing.d.ts +2 -0
- package/dist/types/entries/contract.d.ts +1 -0
- package/dist/types/entries/index.d.ts +1 -1
- package/dist/types/entries/preview.d.ts +1 -0
- package/dist/types/entries/renderer.d.ts +3 -1
- package/dist/types/kit/components/data/chart-model.d.ts +2 -2
- package/dist/types/kit/components/data/use-chart-palette.d.ts +2 -2
- package/dist/types/kit/components/map/use-google-maps-auth-failure.d.ts +18 -0
- package/dist/types/kit/entity-detail/entity-detail-bodies.d.ts +2 -0
- package/dist/types/renderer/canvas/entity-detail-instance.d.ts +5 -3
- package/dist/types/renderer/widget-hydration/use-widget-hydration.d.ts +5 -0
- package/dist/types/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.d.ts +8 -0
- package/dist/widgets.js +33 -33
- package/package.json +1 -1
- package/public-api.json +19 -1
- package/dist/chunks/ConversationMarkdown-CJhAnuVa.js.map +0 -1
- package/dist/chunks/WebSearchResultsConversationWidget-DRBQvycE.js.map +0 -1
- package/dist/chunks/decide-canvas-open-DBWoWtAC.js.map +0 -1
- package/dist/chunks/widget-name-resolver-C8SfpiR5.js.map +0 -1
package/dist/renderer.js.map
CHANGED
|
@@ -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","k"],"mappings":"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"}
|
|
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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"}
|
package/dist/styles.css
CHANGED
|
@@ -5231,6 +5231,28 @@ thead + tbody .agents_row_VBlQR-:first-child {
|
|
|
5231
5231
|
.agents_cardFooter_mobDKj {
|
|
5232
5232
|
flex-wrap: wrap;
|
|
5233
5233
|
}
|
|
5234
|
+
}.agents_stripReveal_6XAjCM {
|
|
5235
|
+
display: grid;
|
|
5236
|
+
grid-template-rows: 0fr;
|
|
5237
|
+
transition: grid-template-rows 250ms ease, opacity 200ms ease;
|
|
5238
|
+
opacity: 0;
|
|
5239
|
+
}
|
|
5240
|
+
|
|
5241
|
+
.agents_stripRevealOpen_sWkJwh {
|
|
5242
|
+
grid-template-rows: 1fr;
|
|
5243
|
+
opacity: 1;
|
|
5244
|
+
}
|
|
5245
|
+
|
|
5246
|
+
.agents_stripRevealInner_C2VlV7 {
|
|
5247
|
+
min-height: 0;
|
|
5248
|
+
overflow: hidden;
|
|
5249
|
+
}
|
|
5250
|
+
|
|
5251
|
+
.agents_strip_rKQFvx {
|
|
5252
|
+
display: flex;
|
|
5253
|
+
flex-wrap: wrap;
|
|
5254
|
+
gap: 0.5rem;
|
|
5255
|
+
padding: 0.5rem 0.5rem 0.25rem 0;
|
|
5234
5256
|
}.agents_page_5VMDeD {
|
|
5235
5257
|
display: flex;
|
|
5236
5258
|
flex-wrap: wrap;
|
|
@@ -5301,6 +5323,39 @@ thead + tbody .agents_row_VBlQR-:first-child {
|
|
|
5301
5323
|
flex-direction: column;
|
|
5302
5324
|
gap: 0.125rem;
|
|
5303
5325
|
min-width: 0;
|
|
5326
|
+
}.agents_page_C2OHtV {
|
|
5327
|
+
display: flex;
|
|
5328
|
+
flex-direction: column;
|
|
5329
|
+
gap: 1rem;
|
|
5330
|
+
width: 100%;
|
|
5331
|
+
padding: 1.5rem;
|
|
5332
|
+
background: var(--agents-bg-var);
|
|
5333
|
+
}
|
|
5334
|
+
|
|
5335
|
+
.agents_panel_GY8e08 {
|
|
5336
|
+
display: flex;
|
|
5337
|
+
flex-direction: column;
|
|
5338
|
+
gap: 0.25rem;
|
|
5339
|
+
padding: 1rem;
|
|
5340
|
+
border-radius: 1rem;
|
|
5341
|
+
background: var(--agents-bg-surface);
|
|
5342
|
+
box-shadow: 0 0.125rem 0.125rem rgba(var(--agents-shadow-rgb), 0.08), 0 0.25rem 0.5rem rgba(var(--agents-shadow-rgb), 0.05), 0 0.5rem 1.5rem rgba(var(--agents-shadow-rgb), 0.03);
|
|
5343
|
+
}
|
|
5344
|
+
|
|
5345
|
+
.agents_footer_NcyZo- {
|
|
5346
|
+
display: flex;
|
|
5347
|
+
justify-content: flex-end;
|
|
5348
|
+
margin-top: 0.5rem;
|
|
5349
|
+
}
|
|
5350
|
+
|
|
5351
|
+
.agents_composer_u-IY2N {
|
|
5352
|
+
display: flex;
|
|
5353
|
+
flex-direction: column;
|
|
5354
|
+
gap: 0.5rem;
|
|
5355
|
+
padding: 1rem;
|
|
5356
|
+
border-radius: 1rem;
|
|
5357
|
+
background: var(--agents-bg-surface);
|
|
5358
|
+
box-shadow: 0 0.125rem 0.125rem rgba(var(--agents-shadow-rgb), 0.08), 0 0.25rem 0.5rem rgba(var(--agents-shadow-rgb), 0.05), 0 0.5rem 1.5rem rgba(var(--agents-shadow-rgb), 0.03);
|
|
5304
5359
|
}.agents_history_BIbikt {
|
|
5305
5360
|
display: flex;
|
|
5306
5361
|
flex-direction: column;
|
|
@@ -5759,28 +5814,6 @@ thead + tbody .agents_row_VBlQR-:first-child {
|
|
|
5759
5814
|
white-space: nowrap;
|
|
5760
5815
|
visibility: hidden;
|
|
5761
5816
|
pointer-events: none;
|
|
5762
|
-
}.agents_stripReveal_6XAjCM {
|
|
5763
|
-
display: grid;
|
|
5764
|
-
grid-template-rows: 0fr;
|
|
5765
|
-
transition: grid-template-rows 250ms ease, opacity 200ms ease;
|
|
5766
|
-
opacity: 0;
|
|
5767
|
-
}
|
|
5768
|
-
|
|
5769
|
-
.agents_stripRevealOpen_sWkJwh {
|
|
5770
|
-
grid-template-rows: 1fr;
|
|
5771
|
-
opacity: 1;
|
|
5772
|
-
}
|
|
5773
|
-
|
|
5774
|
-
.agents_stripRevealInner_C2VlV7 {
|
|
5775
|
-
min-height: 0;
|
|
5776
|
-
overflow: hidden;
|
|
5777
|
-
}
|
|
5778
|
-
|
|
5779
|
-
.agents_strip_rKQFvx {
|
|
5780
|
-
display: flex;
|
|
5781
|
-
flex-wrap: wrap;
|
|
5782
|
-
gap: 0.5rem;
|
|
5783
|
-
padding: 0.5rem 0.5rem 0.25rem 0;
|
|
5784
5817
|
}.agents_narrow_vtbLHb {
|
|
5785
5818
|
width: 60%;
|
|
5786
5819
|
margin-left: auto;
|
|
@@ -16,18 +16,27 @@ export type WidgetHydrationStandInAnswer = unknown | {
|
|
|
16
16
|
* hydrator. A key that names no registered hydrator gets a stand-in hydrator of that type, so a widget hydrates even
|
|
17
17
|
* when the spec did not import the app's hydrator module. The widget runs its live code path (`useWidgetHydration`
|
|
18
18
|
* with the provider's state store); the answer arrives asynchronously, as a real read does. `restore()` puts the
|
|
19
|
-
* real hydrators back
|
|
19
|
+
* real hydrators back, removes the added ones and abandons every read started through the stand-ins that has not
|
|
20
|
+
* settled yet: the hydration hook keeps one in-flight read per key beyond a store and a mount, so a read left pending
|
|
21
|
+
* would otherwise hold every later mount of the same key in loading.
|
|
20
22
|
*/
|
|
21
23
|
export declare class WidgetHydrationStandIns {
|
|
22
24
|
protected readonly answers: Readonly<Record<string, WidgetHydrationStandInAnswer>>;
|
|
23
25
|
protected readonly replacedHydrators: Map<string, RegisteredWidget<unknown, unknown>>;
|
|
24
26
|
protected readonly addedTypes: string[];
|
|
27
|
+
/** The hydration key of every read started through the stand-ins that has not settled yet, by its rejection. */
|
|
28
|
+
protected readonly unsettledReadKeys: Map<(reason: Error) => void, string>;
|
|
25
29
|
constructor(answers: Readonly<Record<string, WidgetHydrationStandInAnswer>>);
|
|
26
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Puts the real hydrators back, removes the stand-ins added for types nothing had registered, and aborts and
|
|
32
|
+
* forgets the reads still pending, so the next mount of their keys reads anew.
|
|
33
|
+
*/
|
|
27
34
|
restore(): void;
|
|
28
35
|
protected replaceHydrator(type: string, registered: RegisteredWidget<unknown, unknown>): void;
|
|
29
|
-
/**
|
|
36
|
+
/** One read, abandoned by `restore()` while it has not settled. */
|
|
30
37
|
protected answer(type: string, derivedKey: string, payload: unknown, context: WidgetHydratorContext, registered: RegisteredWidget<unknown, unknown> | undefined): Promise<unknown>;
|
|
38
|
+
/** The answer for one read: the derived key's entry, else the type's, else the real hydrator (none: a failed read). */
|
|
39
|
+
protected readAnswer(type: string, derivedKey: string, payload: unknown, context: WidgetHydratorContext, registered: RegisteredWidget<unknown, unknown> | undefined): Promise<unknown>;
|
|
31
40
|
}
|
|
32
41
|
/** Installs hydration stand-ins (`WidgetHydrationStandIns`); call `restore()` on the result after the spec. */
|
|
33
42
|
export declare const installWidgetHydrationStandIns: (answers: Readonly<Record<string, WidgetHydrationStandInAnswer>>) => WidgetHydrationStandIns;
|
|
@@ -17,8 +17,10 @@ export { ConversationErrorCard, type ConversationErrorCardProps } from "../chat/
|
|
|
17
17
|
export { ConversationMessageInputAttachmentsErrorBox } from "../chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsErrorBox";
|
|
18
18
|
export { ConversationMessageInputAttachmentsPreviewStrip } from "../chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsPreviewStrip";
|
|
19
19
|
export { normalizeServerMessageToMarkdown } from "../chat/normalize-server-message-to-markdown";
|
|
20
|
+
export { PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES, SIGNAL_SOURCES_THAT_OWE_NO_WORK, } from "../chat/last-wire-message-is-unanswered-user-message";
|
|
20
21
|
export { ConversationWidgetProvider, type ConversationWidgetProviderProps } from "../renderer/ConversationWidgetContext";
|
|
21
22
|
export { CanvasRestoreOnMount, type CanvasRestoreOnMountProps } from "../renderer/canvas/CanvasRestoreOnMount";
|
|
23
|
+
export { ConversationDeepLinkedWidget, type ConversationDeepLinkedWidgetProps, } from "../renderer/ConversationDeepLinkedWidget";
|
|
22
24
|
export { CanvasPane } from "../chat/CanvasPane/CanvasPane";
|
|
23
25
|
export { ConversationMessageList } from "../chat/ConversationMessageList/ConversationMessageList";
|
|
24
26
|
export { ConversationMessageUser, type ConversationMessageUserProps, type ConversationMessageUserTheme, } from "../chat/ConversationMessage/ConversationMessageUser/ConversationMessageUser";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export * from "../client/testing/createInMemoryAgentsConversationClient";
|
|
2
2
|
export { installWidgetHydrationStandIns, WidgetHydrationStandIns, type WidgetHydrationStandInAnswer, } from "../client/testing/widget-hydration-stand-ins";
|
|
3
3
|
export { installTestConversationWidgets, TestConversationWidgetsInstallation, type TestConversationWidgetsOptions, } from "../client/testing/test-conversation-widgets";
|
|
4
|
+
export { resetGoogleMapsAuthFailureForTests, simulateGoogleMapsAuthFailure, } from "../kit/components/map/use-google-maps-auth-failure";
|
|
5
|
+
export { clearStoredCanvas, readStoredCanvas, storeOpenCanvas, type StoredCanvasPointer, } from "../renderer/canvas/canvasStorage";
|
|
@@ -5,6 +5,6 @@ export { registerCanvasBodies } from "../renderer/canvas/canvasBodies";
|
|
|
5
5
|
export { registerCanvasFeatureFlags } from "../renderer/canvas/canvas-feature-flags";
|
|
6
6
|
export { registerWidgetHydrator } from "../renderer/widget-hydration/widget-hydration.registry";
|
|
7
7
|
export { registerComposedViewDataSourceFetcher, type ComposedViewDataSourceFetcher, } from "../renderer/widget-tree/composed-view-data-sources";
|
|
8
|
-
export { readEntityDetailBodyDefinitions, registerEntityDetailBodies, type EntityDetailBodyDefinition, } from "../kit/entity-detail/entity-detail-bodies";
|
|
8
|
+
export { getEntityDetailBody, readEntityDetailBodyDefinitions, registerEntityDetailBodies, type EntityDetailBodyDefinition, } from "../kit/entity-detail/entity-detail-bodies";
|
|
9
9
|
export { readConceptExplainerTypeDefinitions, registerConceptExplainerTypes, } from "../widgets/ConceptExplainerConversationWidget/shared/concept-explainer-types";
|
|
10
10
|
export type { ConceptExplainerTypeDefinition } from "../widgets/ConceptExplainerConversationWidget/shared/concept-explainer-type";
|
|
@@ -6,4 +6,5 @@ export { publishWidgetPreviewSignal, readWidgetPreviewSignalGlobalNames, WIDGET_
|
|
|
6
6
|
export { installWidgetPreviewRequests, isPendingResponse, widgetPreviewRequestKey } from "../preview/widget-preview-requests";
|
|
7
7
|
export { installWidgetPreviewHydration } from "../preview/widget-preview-hydration";
|
|
8
8
|
export { buildPreviewComposedViewComponents } from "../preview/preview-stub-components";
|
|
9
|
+
export { EntityMentionAskFlowStory } from "../widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory";
|
|
9
10
|
export { mapFixtureToDeclaredAgentSpaceKeyFieldName } from "../renderer/_agent-space/declared-agent-space-key-field-name";
|
|
@@ -12,7 +12,8 @@ export { unregisterWidgetHydrator } from "../renderer/widget-hydration/widget-hy
|
|
|
12
12
|
export * from "../renderer/canvas/canvas-behaviours";
|
|
13
13
|
export * from "../renderer/canvas/canvas-state";
|
|
14
14
|
export { canvasBodies, canvasFeatureFlagOf, type CanvasBodyProps } from "../renderer/canvas/canvasBodies";
|
|
15
|
-
export {
|
|
15
|
+
export { readOpenEntityActionTarget, type OpenEntityActionTarget, } from "../renderer/canvas/entity-detail-instance";
|
|
16
|
+
export { composedViewTreeToWire, readComposedViewTree } from "../renderer/widget-tree/composed-view-tree";
|
|
16
17
|
export { addComposedNodeSchemaApplicationPart, composedNodeSchema, getComposedNodeSchema, type ComposedNodeSchema, type ComposedNodeSchemaApplicationPart, } from "../renderer/widget-tree/composed-node-schema";
|
|
17
18
|
export { ConversationWidgetRenderContext, useIsEmailWidgetRender } from "../renderer/ConversationWidgetRenderContext";
|
|
18
19
|
export { ConversationWidgetActions } from "../renderer/ConversationWidgetActions/ConversationWidgetActions";
|
|
@@ -29,3 +30,4 @@ export { applyClearCanvas, applyCloseCanvas, applyOpenCanvas, applyResetCanvasFo
|
|
|
29
30
|
export { withConversationWidgetVariant, type ConversationWidgetVariant } from "../renderer/read-conversation-widget-variant";
|
|
30
31
|
export { buildWidgetRenderReportSignal, parseWidgetRenderReportSignal, WIDGET_RENDER_REPORT_SIGNAL_SOURCE, type ParsedWidgetRenderReport, type WidgetRenderBlockReport, } from "../renderer/render-report/widget-render-report-collector";
|
|
31
32
|
export { deepLinkableWidgetNameForCanvas, resolveDeepLinkableWidget } from "../renderer/resolve-deep-linkable-widget";
|
|
33
|
+
export { getWidgetClickSignalSources, isWidgetClickSignalSource } from "../renderer/widget-click-signal-sources";
|
|
@@ -14,7 +14,7 @@ export interface ChartSeriesDeclaration {
|
|
|
14
14
|
/** The model wrote the label — a single named series gets its legend entry (ChatGPT's "MRR"). */
|
|
15
15
|
hasExplicitLabel: boolean;
|
|
16
16
|
}
|
|
17
|
-
/** The theme colours the chart draws with, resolved from the `--
|
|
17
|
+
/** The theme colours the chart draws with, resolved from the `--agents-*` tokens at render time. */
|
|
18
18
|
export interface ChartPalette {
|
|
19
19
|
seriesColors: string[];
|
|
20
20
|
axisTextColor: string;
|
|
@@ -61,7 +61,7 @@ export interface ChartBarRow {
|
|
|
61
61
|
valueText: string;
|
|
62
62
|
/** The filled part of the track, 0 to 1. */
|
|
63
63
|
fraction: number;
|
|
64
|
-
/** The colour token of the bar (`--
|
|
64
|
+
/** The colour token of the bar (`--agents-chart-0N`). */
|
|
65
65
|
colorToken: string;
|
|
66
66
|
/** The signed change ("+2", "-3", "0"); undefined when the row has no number in the delta field. */
|
|
67
67
|
deltaText?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ChartPalette } from "./chart-model";
|
|
2
2
|
/**
|
|
3
|
-
* The chart's colours, read from the theme tokens (`--
|
|
4
|
-
* `--agents-fg` for a donut's total,
|
|
3
|
+
* The chart's colours, read from the theme tokens (`--agents-chart-01` … `--agents-chart-08` for the series,
|
|
4
|
+
* `--agents-fg-light` for the axis text, `--agents-fg` for a donut's total,
|
|
5
5
|
* `--agents-divider-gl` for the grid, `--agents-bg-surface` for the slice gaps). ApexCharts writes colours into SVG attributes
|
|
6
6
|
* and computes shades from them, where a `var()` does not resolve — so the values are read once per scheme from the
|
|
7
7
|
* element's computed style, never written as hex in the component.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether Google refused the Maps key for this page. The SDK reports a refused key — a referrer the
|
|
3
|
+
* key does not allow, a disabled API — only through the global `window.gm_authFailure` callback; the script itself
|
|
4
|
+
* loads fine, so `useGoogleMapApiLoader` sees no error. After a refusal every new map fails inside the SDK, so the
|
|
5
|
+
* `Map` node stops creating Google maps, shows its points without the map and reports `failed`.
|
|
6
|
+
*
|
|
7
|
+
* One page-wide flag: the handler is installed once and keeps any handler that was there before.
|
|
8
|
+
*/
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window {
|
|
11
|
+
gm_authFailure?: () => void;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare const useGoogleMapsAuthFailure: () => boolean;
|
|
15
|
+
/** For specs: the flag back to its initial state. */
|
|
16
|
+
export declare const resetGoogleMapsAuthFailureForTests: () => void;
|
|
17
|
+
/** For specs and stories: what the SDK's callback does. */
|
|
18
|
+
export declare const simulateGoogleMapsAuthFailure: () => void;
|
|
@@ -27,6 +27,8 @@ export declare const readEntityDetailBodyDefinitions: (modules: Record<string, {
|
|
|
27
27
|
export declare const entityDetailBodies: Record<string, EntityDetailBodyDefinition>;
|
|
28
28
|
/** Adds an app's entity detail bodies. Runs outside React, before the first render; an entity type registers once. */
|
|
29
29
|
export declare const registerEntityDetailBodies: (definitions: readonly EntityDetailBodyDefinition[]) => void;
|
|
30
|
+
/** The body registered for one entity type (the package's or an app's), or undefined when none is. */
|
|
31
|
+
export declare const getEntityDetailBody: (entityType: string) => EntityDetailBodyDefinition | undefined;
|
|
30
32
|
/** The registry the canvas body uses — the folder's by default; a spec or a story may provide stubs. */
|
|
31
33
|
export declare const EntityDetailBodiesContext: React.Context<Readonly<Record<string, EntityDetailBodyDefinition>>>;
|
|
32
34
|
export declare const useEntityDetailBodies: () => Readonly<Record<string, EntityDetailBodyDefinition>>;
|
|
@@ -2,6 +2,10 @@ export interface EntityDetailTarget {
|
|
|
2
2
|
entityType: string;
|
|
3
3
|
entityId: string;
|
|
4
4
|
}
|
|
5
|
+
/** The entity an `openEntity` action opens: its type, its id and the key of its agent space when the entity names one. */
|
|
6
|
+
export interface OpenEntityActionTarget extends EntityDetailTarget {
|
|
7
|
+
agentSpaceKey?: number;
|
|
8
|
+
}
|
|
5
9
|
export declare const canvasInstanceIdForEntityDetail: (target: EntityDetailTarget) => string;
|
|
6
10
|
/** The entity an `entityDetail` instance id names, or undefined for another instance id. */
|
|
7
11
|
export declare const readEntityDetailInstanceId: (instanceId: string) => EntityDetailTarget | undefined;
|
|
@@ -22,6 +26,4 @@ export declare const isRowBoundOpenEntityAction: (action: Record<string, unknown
|
|
|
22
26
|
* scope the event fires in (each row of a resolved `$from` list carries its own `entityRef` + `entity`) — NEVER an
|
|
23
27
|
* `entity` written on the action; undefined without a row or for a row without an entity.
|
|
24
28
|
*/
|
|
25
|
-
export declare const readOpenEntityActionTarget: (action: Record<string, unknown>, currentRow?: unknown) =>
|
|
26
|
-
agentSpaceKey?: number;
|
|
27
|
-
}) | undefined;
|
|
29
|
+
export declare const readOpenEntityActionTarget: (action: Record<string, unknown>, currentRow?: unknown) => OpenEntityActionTarget | undefined;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { WidgetHydrationStatus } from "./widget-hydration.types";
|
|
2
|
+
/**
|
|
3
|
+
* Aborts the in-flight read of each key and forgets the key, so the next mount reads anew instead of joining a read
|
|
4
|
+
* that no store waits for any more. Test support: the hydration stand-ins call it when they are restored.
|
|
5
|
+
*/
|
|
6
|
+
export declare const abandonWidgetHydrationReads: (keys: Iterable<string>) => void;
|
|
2
7
|
export interface UseWidgetHydrationResult<TData> {
|
|
3
8
|
data: TData | null;
|
|
4
9
|
status: WidgetHydrationStatus;
|
package/dist/types/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The "Ask about this" flow for the story and the browser check: a stand-in for the detail panel's
|
|
3
|
+
* footer (the `entityDetail` shell is the canvas shell's, the bodies come from the entity types) with the real button, and the real
|
|
4
|
+
* composer strip of the chat input, so a click shows the chip where the owner types.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EntityMentionAskFlowStory: (props: {
|
|
7
|
+
maxWidth?: number;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/widgets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { U as WidgetSurface, V as SkeletonCircle, X as SkeletonLine, F as useIsEmailWidgetRender } from "./chunks/WebSearchResultsConversationWidget-as3p5bHw.js";
|
|
3
|
+
import { T, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap } from "./chunks/WebSearchResultsConversationWidget-as3p5bHw.js";
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { z as classNames, q as Text, p as StatusChip } from "./chunks/index-7Qc_3GbG.js";
|
|
6
6
|
import { e, v } from "./chunks/index-7Qc_3GbG.js";
|
|
@@ -130,48 +130,48 @@ const useElementVisible = (ref) => {
|
|
|
130
130
|
return intersecting && documentVisible;
|
|
131
131
|
};
|
|
132
132
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
T as CANVAS_VIABLE_MIN_WIDTH,
|
|
134
|
+
Y as CanvasWidgetCard,
|
|
135
|
+
Z as CanvasWidgetSwitch,
|
|
136
136
|
CardFooter,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
_ as ClockConversationWidget,
|
|
138
|
+
$ as ConceptExplainerConversationWidget,
|
|
139
|
+
a0 as ConversationSearchResultsConversationWidget,
|
|
140
|
+
a1 as CurrencyConverterConversationWidget,
|
|
141
|
+
a2 as CustomVisualizationConversationWidget,
|
|
142
|
+
a3 as DonePill,
|
|
143
|
+
a4 as EntityMentionConversationWidget,
|
|
144
144
|
e as HeroValue,
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
a5 as MultiChoiceConversationWidget,
|
|
146
|
+
a6 as QuickRepliesConversationWidget,
|
|
147
147
|
SkeletonCircle,
|
|
148
148
|
SkeletonLine,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
a7 as SkeletonPill,
|
|
150
|
+
a8 as SkeletonWidgetLabel,
|
|
151
|
+
a9 as SuggestedActions,
|
|
152
|
+
aa as ToolTraceConversationWidget,
|
|
153
|
+
ab as WebSearchResultsConversationWidget,
|
|
154
|
+
ac as WidgetKpiValue,
|
|
155
155
|
WidgetLabel,
|
|
156
156
|
WidgetListRow,
|
|
157
157
|
WidgetStatusChip,
|
|
158
158
|
WidgetSurface,
|
|
159
159
|
WidgetSurfaceSkeleton,
|
|
160
160
|
v as WidgetText,
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
ad as WritingDraftConversationWidget,
|
|
162
|
+
ae as canvasForMessageWidget,
|
|
163
163
|
createEntityUpdateChannel,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
164
|
+
af as formatConceptExplainerNumber,
|
|
165
|
+
ag as normalizeSearchHitExcerpt,
|
|
166
|
+
ah as pickAllowed,
|
|
167
|
+
ai as pickAllowedValue,
|
|
168
|
+
aj as pickReviewExternalId,
|
|
169
|
+
ak as pickSafeAlias,
|
|
170
|
+
al as pickSafeAliases,
|
|
171
|
+
am as pickText,
|
|
172
|
+
an as readConceptExplainerNumber,
|
|
173
|
+
ao as readConceptExplainerValue,
|
|
174
|
+
ap as useCanvasViable,
|
|
175
175
|
useElementVisible
|
|
176
176
|
};
|
|
177
177
|
//# sourceMappingURL=widgets.js.map
|
package/package.json
CHANGED
package/public-api.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"escapePlainTextForText",
|
|
46
46
|
"getAgentDisplayName",
|
|
47
47
|
"getAgentsEnvironment",
|
|
48
|
+
"getEntityDetailBody",
|
|
48
49
|
"getFurtherCanvasBehaviours",
|
|
49
50
|
"getFurtherWidgetClickSignalSources",
|
|
50
51
|
"getGoogleMapWidgetNames",
|
|
@@ -191,6 +192,7 @@
|
|
|
191
192
|
"canvasWidthPercentOf",
|
|
192
193
|
"closestWidgetNames",
|
|
193
194
|
"composedNodeSchema",
|
|
195
|
+
"composedViewTreeToWire",
|
|
194
196
|
"conversationWidgetRegistry",
|
|
195
197
|
"createAgentsWidgetHydrationStateStore",
|
|
196
198
|
"deepLinkableWidgetNameForCanvas",
|
|
@@ -202,12 +204,14 @@
|
|
|
202
204
|
"getConversationWidgetRegistryRevision",
|
|
203
205
|
"getDeclaredCanvasIds",
|
|
204
206
|
"getDefaultAgentsStateStore",
|
|
207
|
+
"getWidgetClickSignalSources",
|
|
205
208
|
"getWidgetHydrator",
|
|
206
209
|
"hasWidgetHydrator",
|
|
207
210
|
"isCanvasAnchorLoaded",
|
|
208
211
|
"isCanvasId",
|
|
209
212
|
"isSectionIncomplete",
|
|
210
213
|
"isSectionLoading",
|
|
214
|
+
"isWidgetClickSignalSource",
|
|
211
215
|
"mergeSection",
|
|
212
216
|
"mergeSectionValues",
|
|
213
217
|
"messageAnchor",
|
|
@@ -218,6 +222,7 @@
|
|
|
218
222
|
"pickSection",
|
|
219
223
|
"readComposedViewTree",
|
|
220
224
|
"readConversationWidgetRegistrations",
|
|
225
|
+
"readOpenEntityActionTarget",
|
|
221
226
|
"readWidgetAgentSpaceKeyAttribute",
|
|
222
227
|
"registerWidgetHydrator",
|
|
223
228
|
"resolveCanonicalWidgetName",
|
|
@@ -274,6 +279,7 @@
|
|
|
274
279
|
"InjectSignalOptions",
|
|
275
280
|
"LastClosedCanvas",
|
|
276
281
|
"OpenEngagementEditConversationWidgetPayload",
|
|
282
|
+
"OpenEntityActionTarget",
|
|
277
283
|
"PackageCanvasId",
|
|
278
284
|
"ParsedWidgetRenderReport",
|
|
279
285
|
"PayloadConversationWidgetProps",
|
|
@@ -396,6 +402,7 @@
|
|
|
396
402
|
"AGENTS_CLIENT_ERROR_CODE_REQUEST_ABORTED",
|
|
397
403
|
"AgentsClientError",
|
|
398
404
|
"CONVERSATION_RUN_STATES_THAT_END_THE_CONVERSATION",
|
|
405
|
+
"buildChangedMessagesRequest",
|
|
399
406
|
"isAgentsClientError",
|
|
400
407
|
"readConversationRunStatusOfRunState"
|
|
401
408
|
],
|
|
@@ -466,13 +473,19 @@
|
|
|
466
473
|
"InMemoryAgentsConversationClient",
|
|
467
474
|
"TestConversationWidgetsInstallation",
|
|
468
475
|
"WidgetHydrationStandIns",
|
|
476
|
+
"clearStoredCanvas",
|
|
469
477
|
"createInMemoryAgentsConversationClient",
|
|
470
478
|
"installTestConversationWidgets",
|
|
471
|
-
"installWidgetHydrationStandIns"
|
|
479
|
+
"installWidgetHydrationStandIns",
|
|
480
|
+
"readStoredCanvas",
|
|
481
|
+
"resetGoogleMapsAuthFailureForTests",
|
|
482
|
+
"simulateGoogleMapsAuthFailure",
|
|
483
|
+
"storeOpenCanvas"
|
|
472
484
|
],
|
|
473
485
|
"types": [
|
|
474
486
|
"InMemoryAgentsConversationClientData",
|
|
475
487
|
"RecordedConversation",
|
|
488
|
+
"StoredCanvasPointer",
|
|
476
489
|
"TestConversationWidgetsOptions",
|
|
477
490
|
"WidgetHydrationStandInAnswer"
|
|
478
491
|
]
|
|
@@ -488,6 +501,7 @@
|
|
|
488
501
|
"CanvasPane",
|
|
489
502
|
"CanvasRestoreOnMount",
|
|
490
503
|
"ConversationClosedBar",
|
|
504
|
+
"ConversationDeepLinkedWidget",
|
|
491
505
|
"ConversationErrorCard",
|
|
492
506
|
"ConversationErrorType",
|
|
493
507
|
"ConversationMessageInput",
|
|
@@ -502,6 +516,8 @@
|
|
|
502
516
|
"EMPTY_AGENTS_CHAT_OPENING_REQUEST",
|
|
503
517
|
"INITIAL_AGENTS_CHAT_STATE",
|
|
504
518
|
"MAX_MESSAGE_LENGTH",
|
|
519
|
+
"PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES",
|
|
520
|
+
"SIGNAL_SOURCES_THAT_OWE_NO_WORK",
|
|
505
521
|
"SUCCESS_BEAT_MS",
|
|
506
522
|
"createAgentsChatStore",
|
|
507
523
|
"deriveAgentActivity",
|
|
@@ -541,6 +557,7 @@
|
|
|
541
557
|
"ChatMessage",
|
|
542
558
|
"ChatScrollTarget",
|
|
543
559
|
"ConversationClosedBarProps",
|
|
560
|
+
"ConversationDeepLinkedWidgetProps",
|
|
544
561
|
"ConversationErrorCardProps",
|
|
545
562
|
"ConversationMessageInputAttachmentPreview",
|
|
546
563
|
"ConversationMessageInputAttachmentUploadStatus",
|
|
@@ -560,6 +577,7 @@
|
|
|
560
577
|
},
|
|
561
578
|
"./preview": {
|
|
562
579
|
"values": [
|
|
580
|
+
"EntityMentionAskFlowStory",
|
|
563
581
|
"PREVIEW_AGENT_SPACE_KEY",
|
|
564
582
|
"WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME",
|
|
565
583
|
"WidgetPreview",
|