@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.
Files changed (58) hide show
  1. package/dist/chat.js +71 -827
  2. package/dist/chat.js.map +1 -1
  3. package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js +631 -0
  4. package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js.map +1 -0
  5. package/dist/chunks/{WebSearchResultsConversationWidget-DRBQvycE.js → WebSearchResultsConversationWidget-as3p5bHw.js} +92 -85
  6. package/dist/chunks/WebSearchResultsConversationWidget-as3p5bHw.js.map +1 -0
  7. package/dist/chunks/{decide-canvas-open-DBWoWtAC.js → canvas-behaviours-AvzKSYyv.js} +3 -19
  8. package/dist/chunks/canvas-behaviours-AvzKSYyv.js.map +1 -0
  9. package/dist/chunks/canvas-reducers-Bfp_i7lc.js +88 -0
  10. package/dist/chunks/canvas-reducers-Bfp_i7lc.js.map +1 -0
  11. package/dist/chunks/{canvasBodies-DLjDkviP.js → canvasBodies-Cvu3l38p.js} +6 -3
  12. package/dist/chunks/{canvasBodies-DLjDkviP.js.map → canvasBodies-Cvu3l38p.js.map} +1 -1
  13. package/dist/chunks/canvasStorage-EvQsGdto.js +65 -0
  14. package/dist/chunks/canvasStorage-EvQsGdto.js.map +1 -0
  15. package/dist/chunks/contract-BxmMxYPF.js +96 -0
  16. package/dist/chunks/contract-BxmMxYPF.js.map +1 -0
  17. package/dist/chunks/conversation-BEF0aesf.js +31 -0
  18. package/dist/chunks/conversation-BEF0aesf.js.map +1 -0
  19. package/dist/chunks/{ConversationMarkdown-CJhAnuVa.js → widget-click-signal-sources-DulRkNvZ.js} +22 -77
  20. package/dist/chunks/widget-click-signal-sources-DulRkNvZ.js.map +1 -0
  21. package/dist/chunks/{widget-name-resolver-C8SfpiR5.js → widget-name-resolver-BGN3HpoG.js} +61 -30
  22. package/dist/chunks/widget-name-resolver-BGN3HpoG.js.map +1 -0
  23. package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js → withPollingChangeSubscription-B16htQGd.js} +2 -2
  24. package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js.map → withPollingChangeSubscription-B16htQGd.js.map} +1 -1
  25. package/dist/client-testing.js +28 -6
  26. package/dist/client-testing.js.map +1 -1
  27. package/dist/client.js +1 -1
  28. package/dist/contract.js +8 -27
  29. package/dist/contract.js.map +1 -1
  30. package/dist/image-render.js +8 -8
  31. package/dist/index.js +6 -5
  32. package/dist/kit.js +2 -2
  33. package/dist/preview.js +44 -16
  34. package/dist/preview.js.map +1 -1
  35. package/dist/renderer.js +62 -57
  36. package/dist/renderer.js.map +1 -1
  37. package/dist/styles.css +55 -22
  38. package/dist/types/client/testing/widget-hydration-stand-ins.d.ts +12 -3
  39. package/dist/types/entries/chat.d.ts +2 -0
  40. package/dist/types/entries/client-testing.d.ts +2 -0
  41. package/dist/types/entries/contract.d.ts +1 -0
  42. package/dist/types/entries/index.d.ts +1 -1
  43. package/dist/types/entries/preview.d.ts +1 -0
  44. package/dist/types/entries/renderer.d.ts +3 -1
  45. package/dist/types/kit/components/data/chart-model.d.ts +2 -2
  46. package/dist/types/kit/components/data/use-chart-palette.d.ts +2 -2
  47. package/dist/types/kit/components/map/use-google-maps-auth-failure.d.ts +18 -0
  48. package/dist/types/kit/entity-detail/entity-detail-bodies.d.ts +2 -0
  49. package/dist/types/renderer/canvas/entity-detail-instance.d.ts +5 -3
  50. package/dist/types/renderer/widget-hydration/use-widget-hydration.d.ts +5 -0
  51. package/dist/types/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.d.ts +8 -0
  52. package/dist/widgets.js +33 -33
  53. package/package.json +1 -1
  54. package/public-api.json +19 -1
  55. package/dist/chunks/ConversationMarkdown-CJhAnuVa.js.map +0 -1
  56. package/dist/chunks/WebSearchResultsConversationWidget-DRBQvycE.js.map +0 -1
  57. package/dist/chunks/decide-canvas-open-DBWoWtAC.js.map +0 -1
  58. package/dist/chunks/widget-name-resolver-C8SfpiR5.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"decide-canvas-open-DBWoWtAC.js","sources":["../../src/renderer/canvas/canvas-behaviours.ts","../../src/renderer/canvas/decide-canvas-open.ts"],"sourcesContent":["import { getFurtherCanvasBehaviours } from \"../../provider/environment\";\n\n/**\n * The CANVAS BEHAVIOURS — one declaration per canvas of how it lives on the surface: how long it stays (`lifetime`),\n * how it takes the screen (`layout`), what happens on a narrow viewport and whether its body starts flush at the top.\n *\n * Keyed on a CANVAS id, not a widget name: one body may have several openers, and one widget can be inline with a\n * detail canvas. The widget registry lists which canvases a widget may open (`opensCanvases`); the canvas BODIES (React\n * components) live in `canvasBodies.tsx`, imported only by the shell. The package declares the canvases of its own\n * widgets here (`packageCanvasBehaviours`); an app declares the canvases of its widgets on its agents environment\n * (`AgentsEnvironment.furtherCanvasBehaviours`), read at every lookup. This module imports nothing but the environment\n * module (which has no runtime imports), so the conversation slice and its specs can read it during store\n * initialisation (the widget registry is downstream of the store; a slice → registry import forms a temporal-dead-zone\n * cycle).\n */\n\n/** The canvases of the package's own widgets. */\nexport type PackageCanvasId = \"conversationSearchResults\" | \"webSearchResults\" | \"entityDetail\" | \"mapFullScreen\";\n\n/**\n * The id of a canvas: one of the package's (`PackageCanvasId`) or one an app declares\n * (`AgentsEnvironment.furtherCanvasBehaviours`). Append-only while a stored pointer (`canvasStorage.ts`) may still name\n * the id. A string, because the app's ids are not known to the package; `isCanvasId` checks a value against both.\n */\nexport type CanvasId = PackageCanvasId | (string & {});\n\n/**\n * `turn`: the canvas belongs to one question — the next SEND closes it for good (the card in the transcript is the\n * way back). `pinned`: a work surface for the whole conversation — it stays through sends and stays re-openable after\n * the customer closes it. Lifetime says nothing about a reload: the canvas open at reload time is restored for BOTH.\n */\nexport type CanvasLifetime = \"turn\" | \"pinned\";\n\n/**\n * `split`: the canvas is the right pane beside the chat. `canvasFillsScreen`: the canvas takes the screen and the chat\n * becomes the narrow companion (a full work surface such as an editor); the host's compact mode is overridden while it\n * is open.\n */\nexport type CanvasLayout = \"split\" | \"canvasFillsScreen\";\n\n/**\n * Below the viable split width (`CANVAS_VIABLE_MIN_WIDTH`): `none` — a live delivery does not take the phone screen\n * over (the card stays, the customer taps it), and the wide → narrow crossing closes an open canvas; `overlay` — the\n * canvas is the widget's only surface, so it opens as the full-screen overlay and survives the crossing.\n */\nexport type CanvasNarrowViewport = \"none\" | \"overlay\";\n\nexport interface CanvasBehaviour {\n readonly lifetime: CanvasLifetime;\n readonly layout: CanvasLayout;\n /** Width of the canvas pane as a percentage of the split. Only read for `layout: \"split\"`; default 50. */\n readonly widthPercent?: number;\n readonly narrowViewport: CanvasNarrowViewport;\n /**\n * The body starts flush at its top edge (a hero image, an iframe) — the pane keeps its gap under the close row, unless\n * `overlayCloseButton` floats the row over the body.\n */\n readonly fullBleed: boolean;\n /**\n * The close button floats over the body's top edge instead of reserving a row of its own, and the pane drops its top\n * and side padding — for a body whose top (a hero image) may sit under the button. The button is then muted\n * `inverted` + `onDark`, since it sits on the dark image. Default false: the row stays in flow so it never covers\n * content.\n */\n readonly overlayCloseButton?: boolean;\n}\n\n/** Width of the canvas pane (% of the split) when a behaviour declares none. */\nexport const DEFAULT_CANVAS_WIDTH_PERCENT = 50;\n\n/** The narrowest the customer can pull the canvas (px); pulling further and holding folds the tab into \"close\". */\nexport const CANVAS_MIN_WIDTH_PX = 420;\n\n/** What the chat column keeps beside the widest canvas (px). */\nexport const CHAT_COLUMN_MIN_WIDTH_PX = 360;\n\n/**\n * The boxed canvas card's inset from its pane edge (px) — the pull tab sits on the card's edge, not the pane's. The\n * pane's padding reads it as `--agents-canvas-inset` (`.splitViewPaneBoxed`), so this is the one place it is set.\n */\nexport const CANVAS_BOXED_INSET_PX = 8;\n\n/** Width of the canvas pane for `layout: \"canvasFillsScreen\"` — the chat keeps a narrow companion column. */\nexport const CANVAS_FILLS_SCREEN_WIDTH_PERCENT = 72;\n\n/** The canvases of the package's own widgets. */\nexport const packageCanvasBehaviours: Readonly<Record<PackageCanvasId, CanvasBehaviour>> = {\n conversationSearchResults: { lifetime: \"turn\", layout: \"split\", narrowViewport: \"none\", fullBleed: false },\n webSearchResults: { lifetime: \"turn\", layout: \"split\", narrowViewport: \"none\", fullBleed: false },\n // One entity's detail, opened from a ComposedView row (`openEntity`) — a click, never a live delivery.\n entityDetail: { lifetime: \"turn\", layout: \"split\", widthPercent: 40, narrowViewport: \"none\", fullBleed: false },\n // A ComposedView `Map` node, full screen — the widest split a turn canvas takes, the map flush.\n mapFullScreen: { lifetime: \"turn\", layout: \"split\", widthPercent: 65, narrowViewport: \"none\", fullBleed: true },\n};\n\nconst hasOwnCanvasBehaviour = (behaviours: Readonly<Record<string, CanvasBehaviour>>, canvasId: string): boolean =>\n Object.prototype.hasOwnProperty.call(behaviours, canvasId);\n\n/**\n * The behaviour of a canvas: the package's own, else the one the app declares\n * (`AgentsEnvironment.furtherCanvasBehaviours`); undefined for an id nobody declared (a stale stored pointer, a typo —\n * the opening rule ignores it). An app cannot replace a package canvas's behaviour.\n */\nexport const canvasBehaviourOf = (canvasId: CanvasId): CanvasBehaviour | undefined => {\n if (hasOwnCanvasBehaviour(packageCanvasBehaviours, canvasId)) {\n return packageCanvasBehaviours[canvasId as PackageCanvasId];\n }\n const furtherCanvasBehaviours = getFurtherCanvasBehaviours();\n return hasOwnCanvasBehaviour(furtherCanvasBehaviours, canvasId) ? furtherCanvasBehaviours[canvasId] : undefined;\n};\n\n/** Every declared canvas id: the package's own first, then the app's further ones. */\nexport const getDeclaredCanvasIds = (): readonly CanvasId[] => {\n const packageCanvasIds = Object.keys(packageCanvasBehaviours);\n const furtherCanvasIds = Object.keys(getFurtherCanvasBehaviours()).filter(\n (canvasId) => !packageCanvasIds.includes(canvasId),\n );\n return [...packageCanvasIds, ...furtherCanvasIds];\n};\n\n/** Type guard for a value read from untrusted input (`sessionStorage`, a URL): is it a declared canvas id? */\nexport const isCanvasId = (value: unknown): value is CanvasId =>\n typeof value === \"string\" && canvasBehaviourOf(value) !== undefined;\n\nexport const canvasWidthPercentOf = (behaviour: CanvasBehaviour): number =>\n behaviour.layout === \"canvasFillsScreen\"\n ? CANVAS_FILLS_SCREEN_WIDTH_PERCENT\n : (behaviour.widthPercent ?? DEFAULT_CANVAS_WIDTH_PERCENT);\n","import type { CanvasBehaviour } from \"./canvas-behaviours\";\nimport { CanvasOpenRequest, CanvasState, LastClosedCanvas, sameCanvasIdentity } from \"./canvas-state\";\n\n/**\n * Why an open request is ignored. Every reason is a sentence the shell could log:\n * - `unknownCanvas` no behaviour is declared for the id (a stale stored pointer, a typo)\n * - `noSurface` the host renders no split (`disableSplitView`), so there is nowhere to open\n * - `replay` a delivery-origin request for a message that was NOT just delivered — history\n * replay, a reload, scroll-back; rejected BEFORE anything is read or written\n * - `alreadyOpen` a delivery-origin request for the identity that is already open (the agent re-emits\n * an editor widget after a rebuild) — the open canvas is kept, never remounted\n * - `customerClosedIt` the customer closed exactly this identity and nothing has cleared the veto yet\n * - `noTakeoverOnNarrowViewport` a live delivery on a narrow viewport of a canvas that declares no overlay — the\n * card stays, the customer taps it\n */\nexport type CanvasOpenIgnoreReason =\n | \"unknownCanvas\"\n | \"noSurface\"\n | \"replay\"\n | \"alreadyOpen\"\n | \"customerClosedIt\"\n | \"noTakeoverOnNarrowViewport\";\n\nexport type CanvasOpenDecision =\n | { readonly kind: \"accept\" }\n | { readonly kind: \"ignore\"; readonly reason: CanvasOpenIgnoreReason };\n\nconst ACCEPT: CanvasOpenDecision = { kind: \"accept\" };\n\nconst ignore = (reason: CanvasOpenIgnoreReason): CanvasOpenDecision => ({ kind: \"ignore\", reason });\n\n/**\n * THE opening rule — the one place that answers \"may this canvas open now?\". Pure: it reads the behaviour, the open\n * canvas, the last closed one and the request, and returns Accept or Ignore. It never mutates; the reducer\n * (`canvas-reducers.ts`) applies an Accept. There is no merge rung: the same identity opened again from a card click\n * is a fresh Accept (remount), and the refresh contract of a pinned work surface is a value the body derives from the\n * message list, not a reducer merge.\n *\n * A `cardClick`, an `openedByPage` and a `restoredAfterReload` request always open (the customer, the page or the\n * stored pointer decided); only `deliveredInMessage` is judged.\n */\nexport const decideCanvasOpen = (\n behaviour: CanvasBehaviour | undefined,\n openCanvas: CanvasState | null,\n lastClosedCanvas: LastClosedCanvas | null,\n request: CanvasOpenRequest,\n): CanvasOpenDecision => {\n if (behaviour === undefined) return ignore(\"unknownCanvas\");\n if (!request.hostHasCanvasSurface) return ignore(\"noSurface\");\n if (request.origin !== \"deliveredInMessage\") return ACCEPT;\n\n // Replay is rejected first: a replayed message must not touch the open canvas in any way.\n if (!request.justDelivered) return ignore(\"replay\");\n if (openCanvas !== null && sameCanvasIdentity(openCanvas, request)) return ignore(\"alreadyOpen\");\n if (lastClosedCanvas !== null && lastClosedCanvas.closedByCustomer && sameCanvasIdentity(lastClosedCanvas, request)) {\n return ignore(\"customerClosedIt\");\n }\n if (!request.viewportViable && behaviour.narrowViewport === \"none\") return ignore(\"noTakeoverOnNarrowViewport\");\n return ACCEPT;\n};\n"],"names":[],"mappings":";;;AAoEO,MAAM,+BAA+B;AAGrC,MAAM,sBAAsB;AAG5B,MAAM,2BAA2B;AAMjC,MAAM,wBAAwB;AAG9B,MAAM,oCAAoC;AAG1C,MAAM,0BAA8E;AAAA,EACzF,2BAA2B,EAAE,UAAU,QAAQ,QAAQ,SAAS,gBAAgB,QAAQ,WAAW,MAAA;AAAA,EACnG,kBAAkB,EAAE,UAAU,QAAQ,QAAQ,SAAS,gBAAgB,QAAQ,WAAW,MAAA;AAAA;AAAA,EAE1F,cAAc,EAAE,UAAU,QAAQ,QAAQ,SAAS,cAAc,IAAI,gBAAgB,QAAQ,WAAW,MAAA;AAAA;AAAA,EAExG,eAAe,EAAE,UAAU,QAAQ,QAAQ,SAAS,cAAc,IAAI,gBAAgB,QAAQ,WAAW,KAAA;AAC3G;AAEA,MAAM,wBAAwB,CAAC,YAAuD,a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