@bikdotai/bik-component-library 0.0.841-beta.0 → 0.0.841

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 (147) hide show
  1. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  2. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +51 -39
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js +1 -1
  6. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js +1 -1
  8. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +2 -2
  10. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +1 -1
  12. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/DiscardModal.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/DiscardModal.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
  16. package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
  18. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/components/MentionPicker.js +22 -22
  20. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +4 -4
  22. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  23. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +6 -6
  24. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  25. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js +1 -1
  26. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  27. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  28. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  29. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  30. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  31. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +3 -1
  32. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  33. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  34. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  35. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  36. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  37. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +5 -3
  38. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  39. package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
  40. package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
  41. package/dist/cjs/components/agent-listing/AgentTable.js +1 -1
  42. package/dist/cjs/components/agent-listing/AgentTable.js.map +1 -1
  43. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  44. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  45. package/dist/cjs/components/agent-listing/AgentTableShimmer.js +2 -0
  46. package/dist/cjs/components/agent-listing/AgentTableShimmer.js.map +1 -0
  47. package/dist/cjs/components/agent-listing/DeleteAgentModal.js +1 -1
  48. package/dist/cjs/components/agent-listing/DeleteAgentModal.js.map +1 -1
  49. package/dist/cjs/components/avatar/Avatar.js +1 -1
  50. package/dist/cjs/components/avatar/Avatar.js.map +1 -1
  51. package/dist/cjs/components/avatar/Avatar.styled.js +4 -12
  52. package/dist/cjs/components/avatar/Avatar.styled.js.map +1 -1
  53. package/dist/cjs/components/button/Button.styled.js +1 -0
  54. package/dist/cjs/components/button/Button.styled.js.map +1 -1
  55. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  56. package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
  57. package/dist/cjs/editor/BikEditor.js +1 -1
  58. package/dist/cjs/editor/BikEditor.js.map +1 -1
  59. package/dist/cjs/editor/BikEditor.styles.js +97 -54
  60. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  61. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -3
  62. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  63. package/dist/cjs/icons/Informational/Common UI/Shield.js +2 -0
  64. package/dist/cjs/icons/Informational/Common UI/Shield.js.map +1 -0
  65. package/dist/cjs/icons/index.js +1 -1
  66. package/dist/esm/components/agent-builder/AgentBuilder.js +106 -102
  67. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  68. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +3 -6
  69. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +118 -106
  70. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  71. package/dist/esm/components/agent-builder/__fixtures__/agentValue.d.ts +11 -0
  72. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js +29 -21
  73. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  74. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +27 -26
  75. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  76. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +25 -25
  77. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  78. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +24 -23
  79. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  80. package/dist/esm/components/agent-builder/components/DiscardModal.d.ts +3 -1
  81. package/dist/esm/components/agent-builder/components/DiscardModal.js +33 -24
  82. package/dist/esm/components/agent-builder/components/DiscardModal.js.map +1 -1
  83. package/dist/esm/components/agent-builder/components/GoLiveModal.js +23 -21
  84. package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
  85. package/dist/esm/components/agent-builder/components/MentionEditor.js +19 -19
  86. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  87. package/dist/esm/components/agent-builder/components/MentionPicker.js +174 -144
  88. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  89. package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +2 -0
  90. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +111 -105
  91. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  92. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +13 -4
  93. package/dist/esm/components/agent-builder/components/SelectableListSection.js +161 -136
  94. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  95. package/dist/esm/components/agent-builder/components/StepSectionHeader.js +7 -7
  96. package/dist/esm/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  97. package/dist/esm/components/agent-builder/constants/tools.js +6 -6
  98. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  99. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +104 -103
  100. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  101. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +101 -102
  102. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  103. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +146 -144
  104. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  105. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +23 -79
  106. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  107. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +35 -23
  108. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  109. package/dist/esm/components/agent-listing/AgentListing.js +65 -65
  110. package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
  111. package/dist/esm/components/agent-listing/AgentTable.d.ts +2 -0
  112. package/dist/esm/components/agent-listing/AgentTable.js +16 -15
  113. package/dist/esm/components/agent-listing/AgentTable.js.map +1 -1
  114. package/dist/esm/components/agent-listing/AgentTableRow.js +11 -11
  115. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  116. package/dist/esm/components/agent-listing/AgentTableShimmer.d.ts +12 -0
  117. package/dist/esm/components/agent-listing/AgentTableShimmer.js +20 -0
  118. package/dist/esm/components/agent-listing/AgentTableShimmer.js.map +1 -0
  119. package/dist/esm/components/agent-listing/DeleteAgentModal.js +8 -8
  120. package/dist/esm/components/agent-listing/DeleteAgentModal.js.map +1 -1
  121. package/dist/esm/components/agent-listing/__fixtures__/agents.d.ts +3 -0
  122. package/dist/esm/components/avatar/Avatar.d.ts +1 -2
  123. package/dist/esm/components/avatar/Avatar.js +24 -34
  124. package/dist/esm/components/avatar/Avatar.js.map +1 -1
  125. package/dist/esm/components/avatar/Avatar.styled.d.ts +0 -1
  126. package/dist/esm/components/avatar/Avatar.styled.js +8 -17
  127. package/dist/esm/components/avatar/Avatar.styled.js.map +1 -1
  128. package/dist/esm/components/button/Button.styled.js +25 -19
  129. package/dist/esm/components/button/Button.styled.js.map +1 -1
  130. package/dist/esm/components/dropdown/Dropdown.js +18 -13
  131. package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
  132. package/dist/esm/editor/BikEditor.js +173 -160
  133. package/dist/esm/editor/BikEditor.js.map +1 -1
  134. package/dist/esm/editor/BikEditor.styles.d.ts +20 -3
  135. package/dist/esm/editor/BikEditor.styles.js +102 -57
  136. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  137. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.d.ts +5 -8
  138. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +87 -68
  139. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  140. package/dist/esm/icons/Informational/Common UI/Shield.d.ts +7 -0
  141. package/dist/esm/icons/Informational/Common UI/Shield.js +34 -0
  142. package/dist/esm/icons/Informational/Common UI/Shield.js.map +1 -0
  143. package/dist/esm/icons/Informational/Common UI/index.d.ts +1 -0
  144. package/dist/esm/icons/index.d.ts +1 -1
  145. package/dist/esm/icons/index.js +156 -154
  146. package/dist/esm/icons/index.js.map +1 -1
  147. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SelectableListSection.js","sources":["../../../../../src/components/agent-builder/components/SelectableListSection.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport EditIcon from '@src/assets/icons/edit.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport { MentionItem } from '@src/editor';\nimport React, { useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { DeleteConfirmationModal } from '@src/components/states-modal';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAddIconButton,\n\tRowActionDivider,\n\tRowActions,\n\tRowMenuButton,\n\tRowText,\n\tSelectableRow,\n\tSideSection,\n\tSideSectionHeader,\n\tSourceButton,\n\tSourceButtonRow,\n} from '../AgentBuilder.styled';\nimport { ToolAction } from '../constants/tools';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tSourceIcon,\n} from '../utils/sourceIcons';\nimport { MentionPicker } from './MentionPicker';\n\nexport interface SelectableItem {\n\tid: string;\n\tlabel: string;\n\t/** Leading brand glyph (e.g. a tool's source icon). */\n\ticon?: SourceIcon;\n\t/**\n\t * When set, this row shows an edit (Configure) icon that calls this instead of\n\t * the section-level `onConfigure`. Use for rows that open their own drawer\n\t * (e.g. a configured Rest API / email-handover tool).\n\t */\n\tonConfigure?: () => void;\n}\n\n/** A tool source for the empty-state picker (Tools): a button → its searchable list. */\nexport interface SourceGroup {\n\tsource: string;\n\tlabel: string;\n\toptions: SingleOption[];\n\t/**\n\t * Integration connection state for this source. `false` = the store hasn't\n\t * connected it → clicking the source button calls {@link onConnect} instead of\n\t * opening its tool list. `true`/absent → opens normally.\n\t */\n\tconnected?: boolean;\n\t/** Open the connect flow for this source (used when `connected === false`). */\n\tonConnect?: () => void;\n}\n\n/** Sentinel value for the \"create new\" entry in the add dropdown. */\nconst CREATE_OPTION_VALUE = '__bik_create_new__';\n\ninterface SelectableListSectionProps {\n\ttitle: string;\n\thelper?: string;\n\titems: SelectableItem[];\n\t/**\n\t * Options shown in the add dropdown. Pass ALL items (not just unselected\n\t * ones) when re-picking an already-added item is allowed (e.g. to insert its\n\t * mention again) — the chip list still shows each item only once.\n\t */\n\taddableOptions: SingleOption[];\n\tonAdd: (id: string) => void;\n\tonRemove: (id: string) => void;\n\tdataTestPrefix: string;\n\temptyText: string;\n\t/**\n\t * Adds a \"create new\" entry at the top of the add dropdown (e.g. \"Create\n\t * sub-agent\"). Selecting it calls `onSelect` instead of `onAdd`.\n\t */\n\tcreateOption?: { label: string; onSelect: () => void };\n\t/**\n\t * When provided, each row shows an edit (Configure) icon next to Delete.\n\t * Omit for tools (Delete only).\n\t */\n\tonConfigure?: (id: string) => void;\n\t/**\n\t * Tool sources (e.g. Manifest / Shopify). When set, the empty state shows a\n\t * button per source; clicking one reveals a searchable dropdown of just that\n\t * source's options. Selecting calls `onAdd`. Takes precedence over the plain\n\t * `addableOptions` dropdown.\n\t */\n\tsourceGroups?: SourceGroup[];\n\t/**\n\t * When provided, the header \"+\" opens the same `@` reference picker used in the\n\t * Instructions editor (a {@link MentionPicker} popover) instead of the inline\n\t * select dropdown. Pass the items for THIS section only (tools OR sub-agents) —\n\t * the picker auto-drills into the single category. Selecting a row calls\n\t * `onAdd(id)`; the picker's \"Create new\" row (sub-agents) calls\n\t * `createOption.onSelect`.\n\t */\n\tmentionItems?: MentionItem[];\n\t/**\n\t * Built-in \"action\" tools (e.g. Rest API / Handover to email) that open a\n\t * config drawer via `onSelect` instead of adding a mention. Shown as\n\t * empty-state source buttons (only while no items exist, alongside\n\t * `sourceGroups`) AND as rows inside the `@` picker's Tools view.\n\t */\n\tactionSources?: ToolAction[];\n\t/**\n\t * When set, the row Delete icon opens a confirmation modal (instead of\n\t * removing immediately); `onRemove` runs only on confirm. `noun` fills the one\n\t * shared message template (\"Delete this <noun>?\" …); `zIndex` raises the modal\n\t * above a parent drawer. Omit to delete directly.\n\t */\n\tconfirmDelete?: { noun: string; zIndex?: number };\n}\n\nexport const SelectableListSection: React.FC<SelectableListSectionProps> = ({\n\ttitle,\n\thelper,\n\titems,\n\taddableOptions,\n\tonAdd,\n\tonRemove,\n\tdataTestPrefix,\n\temptyText,\n\tcreateOption,\n\tonConfigure,\n\tsourceGroups,\n\tmentionItems,\n\tactionSources,\n\tconfirmDelete,\n}) => {\n\tconst [adding, setAdding] = useState(false);\n\t// Row id awaiting delete confirmation (null = modal closed).\n\tconst [pendingDeleteId, setPendingDeleteId] = useState<string | null>(null);\n\t// Tools: which source's searchable list is open (null = just show the buttons).\n\tconst [activeSource, setActiveSource] = useState<string | null>(null);\n\tconst hasSourceGroups = !!sourceGroups && sourceGroups.length > 0;\n\tconst activeGroup = sourceGroups?.find((g) => g.source === activeSource);\n\t// When set, \"+\" opens the `@` MentionPicker popover instead of a select input.\n\tconst usePicker = mentionItems !== undefined;\n\t// Separate anchors for the header \"+\" popover and the empty-state source-button\n\t// popover — when empty both render at once, so a shared ref would misfire the\n\t// outside-click check (closing the header picker when a source row is clicked).\n\tconst headerPickerRef = useRef<HTMLDivElement>(null);\n\tconst sourcePickerRef = useRef<HTMLDivElement>(null);\n\t// Source (Shopify / Manifest) the empty-state button opened the picker into;\n\t// null when \"+\" opened it at the root source list.\n\tconst [pickerSource, setPickerSource] = useState<string | null>(null);\n\n\t// Dismiss the picker popover on outside click / Escape.\n\tuseEffect(() => {\n\t\tif (!usePicker || !adding) {\n\t\t\treturn;\n\t\t}\n\t\tconst onDocMouseDown = (e: MouseEvent) => {\n\t\t\tconst target = e.target as Node;\n\t\t\tif (\n\t\t\t\t!headerPickerRef.current?.contains(target) &&\n\t\t\t\t!sourcePickerRef.current?.contains(target)\n\t\t\t) {\n\t\t\t\tsetAdding(false);\n\t\t\t}\n\t\t};\n\t\tconst onKeyDown = (e: KeyboardEvent) => {\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\tsetAdding(false);\n\t\t\t}\n\t\t};\n\t\tdocument.addEventListener('mousedown', onDocMouseDown);\n\t\tdocument.addEventListener('keydown', onKeyDown);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('mousedown', onDocMouseDown);\n\t\t\tdocument.removeEventListener('keydown', onKeyDown);\n\t\t};\n\t}, [usePicker, adding]);\n\n\t// Header \"+\" picks an EXISTING item (and, once some exist, re-creates via the\n\t// dropdown's footer row). With an empty list + a createOption the body shows a\n\t// dedicated \"Create new\" button instead, so the header \"+\" would be redundant.\n\t// In picker mode the \"+\" always shows (even empty) — for tools it sits next to\n\t// the empty-state source buttons; the create flow lives inside the picker.\n\tconst showAddButton = hasSourceGroups\n\t\t? usePicker || items.length > 0\n\t\t: usePicker ||\n\t\t addableOptions.length > 0 ||\n\t\t (!!createOption && items.length > 0);\n\t// Empty state offers a one-click \"Create new\" (sub-agents) rather than burying\n\t// it behind a single-item dropdown. In picker mode the \"+\" opens the picker\n\t// (with its own \"Create new\" row) instead, so skip the standalone button.\n\tconst showEmptyCreate =\n\t\titems.length === 0 && !!createOption && !hasSourceGroups && !usePicker;\n\tconst hasActionSources = !!actionSources && actionSources.length > 0;\n\t// Source buttons ONLY while no item is added — the tool sources (Manifest /\n\t// Shopify …) plus the built-in action tools (Rest API / Handover to email).\n\t// Once an item exists, adding more uses the header \"+\" → picker (the buttons\n\t// never come back); the action tools still live inside that picker.\n\tconst showSourceButtons =\n\t\t(hasSourceGroups || hasActionSources) && items.length === 0;\n\t// Nothing existing to pick → skip the 1-item dropdown and create directly.\n\tconst handleAddClick = () => {\n\t\tif (usePicker) {\n\t\t\t// Toggle the `@` reference-picker popover (rendered under the \"+\"), opened\n\t\t\t// at the root source list (no pre-drilled source).\n\t\t\tsetPickerSource(null);\n\t\t\tsetAdding((v) => !v);\n\t\t\treturn;\n\t\t}\n\t\tif (hasSourceGroups) {\n\t\t\tsetActiveSource(null);\n\t\t\tsetAdding((v) => !v);\n\t\t\treturn;\n\t\t}\n\t\tif (addableOptions.length === 0 && createOption) {\n\t\t\tcreateOption.onSelect();\n\t\t\treturn;\n\t\t}\n\t\tsetAdding((v) => !v);\n\t};\n\n\tconst renderChipRows = () =>\n\t\titems.map((item) => {\n\t\t\t// Per-item configure wins; otherwise fall back to the section-level one.\n\t\t\tconst configure =\n\t\t\t\titem.onConfigure ??\n\t\t\t\t(onConfigure ? () => onConfigure(item.id) : undefined);\n\t\t\treturn (\n\t\t\t\t<SelectableRow\n\t\t\t\t\tkey={item.id}\n\t\t\t\t\tdata-test={`${dataTestPrefix}-row-${item.id}`}\n\t\t\t\t>\n\t\t\t\t\t{renderSourceIcon(item.icon)}\n\t\t\t\t\t<RowText>\n\t\t\t\t\t\t<BodySecondary numberOfLines={1} color={COLORS.content.primary}>\n\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t</RowText>\n\t\t\t\t\t<RowActions>\n\t\t\t\t\t\t{configure && (\n\t\t\t\t\t\t\t// Configurable rows (sub-agents, Rest API / email tools) get an\n\t\t\t\t\t\t\t// always-visible edit icon.\n\t\t\t\t\t\t\t<RowMenuButton\n\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-edit-${item.id}`}\n\t\t\t\t\t\t\t\taria-label={`Edit ${item.label}`}\n\t\t\t\t\t\t\t\tonClick={configure}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EditIcon\n\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</RowMenuButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{configure && <RowActionDivider aria-hidden />}\n\t\t\t\t\t\t<RowMenuButton\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-delete-${item.id}`}\n\t\t\t\t\t\t\taria-label={`Delete ${item.label}`}\n\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\tconfirmDelete ? setPendingDeleteId(item.id) : onRemove(item.id)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RowMenuButton>\n\t\t\t\t\t</RowActions>\n\t\t\t\t</SelectableRow>\n\t\t\t);\n\t\t});\n\t// \"Create new\" is a brand-coloured footer row at the BOTTOM of the dropdown,\n\t// separated from the selectable items by a divider.\n\tconst dropdownOptions: SingleOption[] = createOption\n\t\t? [\n\t\t\t\t...addableOptions,\n\t\t\t\t{\n\t\t\t\t\tlabel: createOption.label,\n\t\t\t\t\tvalue: CREATE_OPTION_VALUE,\n\t\t\t\t\tsearchKey: createOption.label,\n\t\t\t\t\tcustomComponent: (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\tcolor: COLORS.content.brand,\n\t\t\t\t\t\t\t\tfontFamily: 'Inter',\n\t\t\t\t\t\t\t\tfontSize: 14,\n\t\t\t\t\t\t\t\tfontWeight: 600,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{createOption.label}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t ]\n\t\t: addableOptions;\n\n\t// One picker instance reused by the header \"+\" and the empty-state source\n\t// buttons. `key` remounts it so a source button re-drills into its own tools\n\t// (the initial drill-in level is read once, on mount).\n\tconst pickerNode = usePicker ? (\n\t\t<MentionPicker\n\t\t\tkey={pickerSource ?? '__root__'}\n\t\t\titems={mentionItems ?? []}\n\t\t\tquery=\"\"\n\t\t\tactiveIndex={0}\n\t\t\tinitialSource={pickerSource ?? undefined}\n\t\t\tonSelect={(item) => {\n\t\t\t\tsetAdding(false);\n\t\t\t\tonAdd(String(item.id));\n\t\t\t}}\n\t\t\tonClose={() => setAdding(false)}\n\t\t\tonCreateSubAgent={\n\t\t\t\tcreateOption\n\t\t\t\t\t? () => {\n\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\tcreateOption.onSelect();\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\ttoolActions={\n\t\t\t\thasActionSources\n\t\t\t\t\t? actionSources?.map((a) => ({\n\t\t\t\t\t\t\t...a,\n\t\t\t\t\t\t\tonSelect: () => {\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\ta.onSelect();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }))\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\t// Gate native source rows in the picker on their connected state, derived\n\t\t\t// from the source groups (which already carry connected/onConnect). This is\n\t\t\t// what makes the \"+\" dropdown show \"Connect\" for unconnected vendors,\n\t\t\t// consistent with the empty-state buttons.\n\t\t\tintegrationStatus={Object.fromEntries(\n\t\t\t\t(sourceGroups ?? [])\n\t\t\t\t\t.filter((g) => g.connected !== undefined)\n\t\t\t\t\t.map((g) => [g.source, g.connected]),\n\t\t\t)}\n\t\t\tonConnectIntegration={(source) => {\n\t\t\t\tsetAdding(false);\n\t\t\t\tsourceGroups?.find((g) => g.source === source)?.onConnect?.();\n\t\t\t}}\n\t\t/>\n\t) : null;\n\n\treturn (\n\t\t<SideSection>\n\t\t\t<SideSectionHeader>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{title}</TitleSmall>\n\t\t\t\t{showAddButton && (\n\t\t\t\t\t<AddButtonWrap ref={headerPickerRef}>\n\t\t\t\t\t\t<AddIconButton\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-add`}\n\t\t\t\t\t\t\tonClick={handleAddClick}\n\t\t\t\t\t\t\taria-label={`Add ${title}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PlusIcon width={20} height={20} color={COLORS.content.brand} />\n\t\t\t\t\t\t</AddIconButton>\n\t\t\t\t\t\t{usePicker && adding && pickerSource === null && (\n\t\t\t\t\t\t\t<PickerPopover data-test={`${dataTestPrefix}-picker`}>\n\t\t\t\t\t\t\t\t{pickerNode}\n\t\t\t\t\t\t\t</PickerPopover>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</AddButtonWrap>\n\t\t\t\t)}\n\t\t\t</SideSectionHeader>\n\n\t\t\t{helper && (\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{helper}</BodyCaption>\n\t\t\t)}\n\n\t\t\t{showSourceButtons ? (\n\t\t\t\t<SourcePickerAnchor ref={usePicker ? sourcePickerRef : undefined}>\n\t\t\t\t\t{/* No tools yet: one button per source (never shown once a tool exists). */}\n\t\t\t\t\t<SourceButtonRow data-test={`${dataTestPrefix}-sources`}>\n\t\t\t\t\t\t{sourceGroups?.map((g) => (\n\t\t\t\t\t\t\t<SourceButton\n\t\t\t\t\t\t\t\tkey={g.source}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-source-${g.source}`}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t// Not connected → open the connect flow instead of the tools.\n\t\t\t\t\t\t\t\t\tif (g.connected === false) {\n\t\t\t\t\t\t\t\t\t\tg.onConnect?.();\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (usePicker) {\n\t\t\t\t\t\t\t\t\t\t// Open the `@` picker drilled straight into this source's tools.\n\t\t\t\t\t\t\t\t\t\tsetPickerSource(g.source);\n\t\t\t\t\t\t\t\t\t\tsetAdding(true);\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetActiveSource(g.source);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{renderSourceIcon(SOURCE_ICONS[g.source], -4)}\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t{g.label}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t{g.connected === false && (\n\t\t\t\t\t\t\t\t\t// Not connected → show \"Connect\" upfront (consistent with\n\t\t\t\t\t\t\t\t\t// the `@` picker); clicking runs the connect flow.\n\t\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.brand}>\n\t\t\t\t\t\t\t\t\t\tConnect\n\t\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</SourceButton>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t{/* Built-in action tools (Rest API / Handover to email) open a drawer. */}\n\t\t\t\t\t\t{actionSources?.map((a) => (\n\t\t\t\t\t\t\t<SourceButton\n\t\t\t\t\t\t\t\tkey={a.source}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-action-${a.source}`}\n\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\ta.connected === false ? () => a.onConnect?.() : a.onSelect\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{renderSourceIcon(a.icon, -4)}\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t{a.label}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t{a.connected === false && (\n\t\t\t\t\t\t\t\t\t// Not connected → \"Connect\" upfront (consistent with the\n\t\t\t\t\t\t\t\t\t// source buttons and the `@` picker).\n\t\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.brand}>\n\t\t\t\t\t\t\t\t\t\tConnect\n\t\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</SourceButton>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</SourceButtonRow>\n\n\t\t\t\t\t{/* Picker mode: clicking a source opens its tools in the `@` picker. */}\n\t\t\t\t\t{usePicker && adding && pickerSource !== null && (\n\t\t\t\t\t\t<PickerPopover $align=\"left\" data-test={`${dataTestPrefix}-picker`}>\n\t\t\t\t\t\t\t{pickerNode}\n\t\t\t\t\t\t</PickerPopover>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Legacy (non-picker) mode: chosen source → its searchable tool list. */}\n\t\t\t\t\t{!usePicker && activeGroup && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-dropdown`}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\tplaceHolder={`Search ${activeGroup.label} tools`}\n\t\t\t\t\t\t\toptions={activeGroup.options}\n\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\tsetActiveSource(null);\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\tonAdd(v);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</SourcePickerAnchor>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{!usePicker && adding && dropdownOptions.length > 0 && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-dropdown`}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\tplaceHolder={`Select ${title.toLowerCase()}`}\n\t\t\t\t\t\t\toptions={dropdownOptions}\n\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\tif (!v) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (v === CREATE_OPTION_VALUE) {\n\t\t\t\t\t\t\t\t\tcreateOption?.onSelect();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonAdd(v);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{items.length === 0 && !adding ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t\t{emptyText}\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t{showEmptyCreate && createOption && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-create`}\n\t\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tLeadingIcon={PlusIcon}\n\t\t\t\t\t\t\t\t\tbuttonText={createOption.label}\n\t\t\t\t\t\t\t\t\tonClick={createOption.onSelect}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\trenderChipRows()\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{confirmDelete && pendingDeleteId && (\n\t\t\t\t<DeleteConfirmationModal\n\t\t\t\t\tdata-test={`${dataTestPrefix}-delete-confirm`}\n\t\t\t\t\theader={`Delete this ${confirmDelete.noun}?`}\n\t\t\t\t\tsubHeader={`Deleting this ${confirmDelete.noun} will also remove it from your instructions, wherever it's referenced.`}\n\t\t\t\t\tconfirmationText=\"Delete\"\n\t\t\t\t\tzIndex={confirmDelete.zIndex}\n\t\t\t\t\tonDeleteConfirmed={() => {\n\t\t\t\t\t\tonRemove(pendingDeleteId);\n\t\t\t\t\t\tsetPendingDeleteId(null);\n\t\t\t\t\t}}\n\t\t\t\t\tonCancelClicked={() => setPendingDeleteId(null)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</SideSection>\n\t);\n};\n\n// Anchors the `@`-picker popover to the header \"+\" button.\nconst AddButtonWrap = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n`;\n\n// Anchors the `@`-picker popover to the empty-state source buttons.\nconst SourcePickerAnchor = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\n// Floating card under the trigger. Aligns to the \"+\" (right) or the source\n// buttons (left) so it stays inside the side panel.\nconst PickerPopover = styled.div<{ $align?: 'left' | 'right' }>`\n\tposition: absolute;\n\ttop: calc(100% + 4px);\n\t${(p) => (p.$align === 'left' ? 'left: 0;' : 'right: 0;')}\n\tz-index: 30;\n`;\n"],"names":["CREATE_OPTION_VALUE","SelectableListSection","title","helper","items","addableOptions","onAdd","onRemove","dataTestPrefix","emptyText","createOption","onConfigure","sourceGroups","mentionItems","actionSources","confirmDelete","adding","setAdding","useState","pendingDeleteId","setPendingDeleteId","activeSource","setActiveSource","hasSourceGroups","activeGroup","g","usePicker","headerPickerRef","useRef","sourcePickerRef","pickerSource","setPickerSource","useEffect","onDocMouseDown","e","target","onKeyDown","showAddButton","showEmptyCreate","hasActionSources","showSourceButtons","handleAddClick","v","renderChipRows","item","configure","jsxs","SelectableRow","renderSourceIcon","jsx","RowText","BodySecondary","COLORS","RowActions","RowMenuButton","EditIcon","RowActionDivider","DeleteIcon","dropdownOptions","pickerNode","MentionPicker","a","source","SideSection","SideSectionHeader","TitleSmall","AddButtonWrap","AddIconButton","PlusIcon","PickerPopover","BodyCaption","SourcePickerAnchor","SourceButtonRow","SourceButton","SOURCE_ICONS","Dropdown","opt","unwrapDropdownValue","Fragment","Button","DeleteConfirmationModal","styled","p"],"mappings":";;;;;;;;;;;;;;;AAiEA,MAAMA,IAAsB,sBA0DfC,KAA8D,CAAC;AAAA,EAC3E,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpC,CAACC,GAAiBC,CAAkB,IAAIF,EAAwB,IAAI,GAEpE,CAACG,GAAcC,CAAe,IAAIJ,EAAwB,IAAI,GAC9DK,IAAkB,CAAC,CAACX,KAAgBA,EAAa,SAAS,GAC1DY,IAAcZ,GAAc,KAAK,CAACa,MAAMA,EAAE,WAAWJ,CAAY,G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gB;AAAA,YAChB,aAAa4D;AAAAA,YACb,YAAY1D,EAAa;AAAA,YACzB,SAASA,EAAa;AAAA,UAAA;AAAA,QAAA;AAAA,MACvB,EAAA,CAEF,IAEAiC,GAAA;AAAA,IAAe,GAEjB;AAAA,IAEA5B,KAAiBI,KACjB,gBAAA8B;AAAA,MAAC+B;AAAA,MAAA;AAAA,QACA,aAAW,GAAGxE,CAAc;AAAA,QAC5B,QAAQ,eAAeO,EAAc,IAAI;AAAA,QACzC,WAAW,iBAAiBA,EAAc,IAAI;AAAA,QAC9C,kBAAiB;AAAA,QACjB,QAAQA,EAAc;AAAA,QACtB,mBAAmB,MAAM;AACxB,UAAAR,EAASY,CAAe,GACxBC,EAAmB,IAAI;AAAA,QACxB;AAAA,QACA,iBAAiB,MAAMA,EAAmB,IAAI;AAAA,MAAA;AAAA,IAAA;AAAA,EAC/C,GAEF;AAEF,GAGM8C,KAAgBe,EAAO;AAAA;AAAA;AAAA,GAMvBV,KAAqBU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAS5BZ,IAAgBY,EAAO;AAAA;AAAA;AAAA,GAG1B,CAACC,MAAOA,EAAE,WAAW,SAAS,aAAa,WAAY;AAAA;AAAA;"}
1
+ {"version":3,"file":"SelectableListSection.js","sources":["../../../../../src/components/agent-builder/components/SelectableListSection.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport EditIcon from '@src/assets/icons/edit.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport { MentionItem } from '@src/editor';\nimport React, { useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { DeleteConfirmationModal } from '@src/components/states-modal';\nimport { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAddIconButton,\n\tRowActionDivider,\n\tRowActions,\n\tRowMenuButton,\n\tRowText,\n\tSelectableRow,\n\tSideSection,\n\tSideSectionHeader,\n\tSourceButton,\n\tSourceButtonRow,\n} from '../AgentBuilder.styled';\nimport { ToolAction } from '../constants/tools';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tSourceIcon,\n} from '../utils/sourceIcons';\nimport { MentionPicker } from './MentionPicker';\n\nexport interface SelectableItem {\n\tid: string;\n\tlabel: string;\n\t/** Leading brand glyph (e.g. a tool's source icon). */\n\ticon?: SourceIcon;\n\t/**\n\t * When set, this row shows an edit (Configure) icon that calls this instead of\n\t * the section-level `onConfigure`. Use for rows that open their own drawer\n\t * (e.g. a configured Rest API / email-handover tool). A pending promise\n\t * disables the row's edit button until it settles (e.g. while the consumer\n\t * fetches the sub-agent's data before opening its drawer).\n\t */\n\tonConfigure?: () => void | Promise<void>;\n}\n\n/** A tool source for the empty-state picker (Tools): a button → its searchable list. */\nexport interface SourceGroup {\n\tsource: string;\n\tlabel: string;\n\toptions: SingleOption[];\n\t/**\n\t * Integration connection state for this source. `false` = the store hasn't\n\t * connected it → clicking the source button calls {@link onConnect} instead of\n\t * opening its tool list. `true`/absent → opens normally.\n\t */\n\tconnected?: boolean;\n\t/** Open the connect flow for this source (used when `connected === false`). */\n\tonConnect?: () => void;\n}\n\n/** Sentinel value for the \"create new\" entry in the add dropdown. */\nconst CREATE_OPTION_VALUE = '__bik_create_new__';\n\ninterface SelectableListSectionProps {\n\ttitle: string;\n\thelper?: string;\n\titems: SelectableItem[];\n\t/**\n\t * Options shown in the add dropdown. Pass ALL items (not just unselected\n\t * ones) when re-picking an already-added item is allowed (e.g. to insert its\n\t * mention again) — the chip list still shows each item only once.\n\t */\n\taddableOptions: SingleOption[];\n\tonAdd: (id: string) => void;\n\tonRemove: (id: string) => void;\n\tdataTestPrefix: string;\n\temptyText: string;\n\t/**\n\t * Adds a \"create new\" entry at the top of the add dropdown (e.g. \"Create\n\t * sub-agent\"). Selecting it calls `onSelect` instead of `onAdd`.\n\t */\n\tcreateOption?: { label: string; onSelect: () => void };\n\t/**\n\t * When provided, each row shows an edit (Configure) icon next to Delete.\n\t * Omit for tools (Delete only). A pending promise disables the edit buttons\n\t * until it settles.\n\t */\n\tonConfigure?: (id: string) => void | Promise<void>;\n\t/**\n\t * Tool sources (e.g. Manifest / Shopify). When set, the empty state shows a\n\t * button per source; clicking one reveals a searchable dropdown of just that\n\t * source's options. Selecting calls `onAdd`. Takes precedence over the plain\n\t * `addableOptions` dropdown.\n\t */\n\tsourceGroups?: SourceGroup[];\n\t/**\n\t * When provided, the header \"+\" opens the same `@` reference picker used in the\n\t * Instructions editor (a {@link MentionPicker} popover) instead of the inline\n\t * select dropdown. Pass the items for THIS section only (tools OR sub-agents) —\n\t * the picker auto-drills into the single category. Selecting a row calls\n\t * `onAdd(id)`; the picker's \"Create new\" row (sub-agents) calls\n\t * `createOption.onSelect`.\n\t */\n\tmentionItems?: MentionItem[];\n\t/**\n\t * Built-in \"action\" tools (e.g. Rest API / Handover to email) that open a\n\t * config drawer via `onSelect` instead of adding a mention. Shown as\n\t * empty-state source buttons (only while no items exist, alongside\n\t * `sourceGroups`) AND as rows inside the `@` picker's Tools view.\n\t */\n\tactionSources?: ToolAction[];\n\t/**\n\t * When set, the row Delete icon opens a confirmation modal (instead of\n\t * removing immediately); `onRemove` runs only on confirm. `noun` fills the one\n\t * shared message template (\"Delete this <noun>?\" …); `zIndex` raises the modal\n\t * above a parent drawer. Omit to delete directly.\n\t */\n\tconfirmDelete?: { noun: string; zIndex?: number };\n\t/**\n\t * Open the `@` picker popover above the trigger instead of below. Use inside\n\t * a drawer where the section sits near the bottom — opening downward\n\t * stretches the drawer and leaves a gap.\n\t */\n\tpickerOpensUp?: boolean;\n}\n\nexport const SelectableListSection: React.FC<SelectableListSectionProps> = ({\n\ttitle,\n\thelper,\n\titems,\n\taddableOptions,\n\tonAdd,\n\tonRemove,\n\tdataTestPrefix,\n\temptyText,\n\tcreateOption,\n\tonConfigure,\n\tsourceGroups,\n\tmentionItems,\n\tactionSources,\n\tconfirmDelete,\n\tpickerOpensUp,\n}) => {\n\tconst [adding, setAdding] = useState(false);\n\t// Row id awaiting delete confirmation (null = modal closed).\n\tconst [pendingDeleteId, setPendingDeleteId] = useState<string | null>(null);\n\t// Row id whose configure handler is in flight (async fetch before its drawer\n\t// opens) — all edit buttons are disabled meanwhile so the UI isn't\n\t// unresponsive to double clicks.\n\tconst [configuringId, setConfiguringId] = useState<string | null>(null);\n\t// Tools: which source's searchable list is open (null = just show the buttons).\n\tconst [activeSource, setActiveSource] = useState<string | null>(null);\n\tconst hasSourceGroups = !!sourceGroups && sourceGroups.length > 0;\n\tconst activeGroup = sourceGroups?.find((g) => g.source === activeSource);\n\t// When set, \"+\" opens the `@` MentionPicker popover instead of a select input.\n\tconst usePicker = mentionItems !== undefined;\n\t// Separate anchors for the header \"+\" popover and the empty-state source-button\n\t// popover — when empty both render at once, so a shared ref would misfire the\n\t// outside-click check (closing the header picker when a source row is clicked).\n\tconst headerPickerRef = useRef<HTMLDivElement>(null);\n\tconst sourcePickerRef = useRef<HTMLDivElement>(null);\n\t// Source (Shopify / Manifest) the empty-state button opened the picker into;\n\t// null when \"+\" opened it at the root source list.\n\tconst [pickerSource, setPickerSource] = useState<string | null>(null);\n\n\t// Dismiss the picker popover on outside click / Escape.\n\tuseEffect(() => {\n\t\tif (!usePicker || !adding) {\n\t\t\treturn;\n\t\t}\n\t\tconst onDocMouseDown = (e: MouseEvent) => {\n\t\t\tconst target = e.target as Node;\n\t\t\tif (\n\t\t\t\t!headerPickerRef.current?.contains(target) &&\n\t\t\t\t!sourcePickerRef.current?.contains(target)\n\t\t\t) {\n\t\t\t\tsetAdding(false);\n\t\t\t}\n\t\t};\n\t\tconst onKeyDown = (e: KeyboardEvent) => {\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\tsetAdding(false);\n\t\t\t}\n\t\t};\n\t\tdocument.addEventListener('mousedown', onDocMouseDown);\n\t\tdocument.addEventListener('keydown', onKeyDown);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('mousedown', onDocMouseDown);\n\t\t\tdocument.removeEventListener('keydown', onKeyDown);\n\t\t};\n\t}, [usePicker, adding]);\n\n\t// Header \"+\" picks an EXISTING item (and, once some exist, re-creates via the\n\t// dropdown's footer row). With an empty list + a createOption the body shows a\n\t// dedicated \"Create new\" button instead, so the header \"+\" would be redundant.\n\t// In picker mode the \"+\" always shows (even empty) — for tools it sits next to\n\t// the empty-state source buttons; the create flow lives inside the picker.\n\tconst showAddButton = hasSourceGroups\n\t\t? usePicker || items.length > 0\n\t\t: usePicker ||\n\t\t addableOptions.length > 0 ||\n\t\t (!!createOption && items.length > 0);\n\t// Empty state offers a one-click \"Create new\" (sub-agents) rather than burying\n\t// it behind a single-item dropdown. In picker mode the \"+\" opens the picker\n\t// (with its own \"Create new\" row) instead, so skip the standalone button.\n\tconst showEmptyCreate =\n\t\titems.length === 0 && !!createOption && !hasSourceGroups && !usePicker;\n\tconst hasActionSources = !!actionSources && actionSources.length > 0;\n\t// Source buttons ONLY while no item is added — the tool sources (Manifest /\n\t// Shopify …) plus the built-in action tools (Rest API / Handover to email).\n\t// Once an item exists, adding more uses the header \"+\" → picker (the buttons\n\t// never come back); the action tools still live inside that picker.\n\tconst showSourceButtons =\n\t\t(hasSourceGroups || hasActionSources) && items.length === 0;\n\t// Nothing existing to pick → skip the 1-item dropdown and create directly.\n\tconst handleAddClick = () => {\n\t\tif (usePicker) {\n\t\t\t// Toggle the `@` reference-picker popover (rendered under the \"+\"), opened\n\t\t\t// at the root source list (no pre-drilled source).\n\t\t\tsetPickerSource(null);\n\t\t\tsetAdding((v) => !v);\n\t\t\treturn;\n\t\t}\n\t\tif (hasSourceGroups) {\n\t\t\tsetActiveSource(null);\n\t\t\tsetAdding((v) => !v);\n\t\t\treturn;\n\t\t}\n\t\tif (addableOptions.length === 0 && createOption) {\n\t\t\tcreateOption.onSelect();\n\t\t\treturn;\n\t\t}\n\t\tsetAdding((v) => !v);\n\t};\n\n\t// Run a row's configure handler; a returned promise disables the edit\n\t// buttons until it settles (same promise-sniff as the drawer Save buttons).\n\tconst handleConfigureClick = (\n\t\tid: string,\n\t\tconfigure: () => void | Promise<void>,\n\t) => {\n\t\tif (configuringId) {\n\t\t\treturn;\n\t\t}\n\t\tconst result = configure();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetConfiguringId(id);\n\t\t\tvoid (result as Promise<void>).finally(() => setConfiguringId(null));\n\t\t}\n\t};\n\n\tconst renderChipRows = () =>\n\t\titems.map((item) => {\n\t\t\t// Per-item configure wins; otherwise fall back to the section-level one.\n\t\t\tconst configure =\n\t\t\t\titem.onConfigure ??\n\t\t\t\t(onConfigure ? () => onConfigure(item.id) : undefined);\n\t\t\treturn (\n\t\t\t\t<SelectableRow\n\t\t\t\t\tkey={item.id}\n\t\t\t\t\tdata-test={`${dataTestPrefix}-row-${item.id}`}\n\t\t\t\t>\n\t\t\t\t\t{renderSourceIcon(item.icon)}\n\t\t\t\t\t{/* Row label truncates to one line; tooltip surfaces the full name. */}\n\t\t\t\t\t<Tooltip body={item.label} placement=\"top\">\n\t\t\t\t\t\t<RowText>\n\t\t\t\t\t\t\t<BodySecondary numberOfLines={1} color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t</RowText>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t\t<RowActions>\n\t\t\t\t\t\t{configure && (\n\t\t\t\t\t\t\t// Configurable rows (sub-agents, Rest API / email tools) get an\n\t\t\t\t\t\t\t// always-visible edit icon.\n\t\t\t\t\t\t\t<Tooltip body=\"Edit\" placement=\"top\">\n\t\t\t\t\t\t\t\t<RowMenuButton\n\t\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-edit-${item.id}`}\n\t\t\t\t\t\t\t\t\taria-label={`Edit ${item.label}`}\n\t\t\t\t\t\t\t\t\tdisabled={configuringId !== null}\n\t\t\t\t\t\t\t\t\tonClick={() => handleConfigureClick(item.id, configure)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<EditIcon\n\t\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</RowMenuButton>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{configure && <RowActionDivider aria-hidden />}\n\t\t\t\t\t\t<Tooltip body=\"Delete\" placement=\"top\">\n\t\t\t\t\t\t\t<RowMenuButton\n\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-delete-${item.id}`}\n\t\t\t\t\t\t\t\taria-label={`Delete ${item.label}`}\n\t\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\t\tconfirmDelete\n\t\t\t\t\t\t\t\t\t\t? setPendingDeleteId(item.id)\n\t\t\t\t\t\t\t\t\t\t: onRemove(item.id)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</RowMenuButton>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t</RowActions>\n\t\t\t\t</SelectableRow>\n\t\t\t);\n\t\t});\n\t// \"Create new\" is a brand-coloured footer row at the BOTTOM of the dropdown,\n\t// separated from the selectable items by a divider.\n\tconst dropdownOptions: SingleOption[] = createOption\n\t\t? [\n\t\t\t\t...addableOptions,\n\t\t\t\t{\n\t\t\t\t\tlabel: createOption.label,\n\t\t\t\t\tvalue: CREATE_OPTION_VALUE,\n\t\t\t\t\tsearchKey: createOption.label,\n\t\t\t\t\tcustomComponent: (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\tcolor: COLORS.content.brand,\n\t\t\t\t\t\t\t\tfontFamily: 'Inter',\n\t\t\t\t\t\t\t\tfontSize: 14,\n\t\t\t\t\t\t\t\tfontWeight: 600,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{createOption.label}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t ]\n\t\t: addableOptions;\n\n\t// One picker instance reused by the header \"+\" and the empty-state source\n\t// buttons. `key` remounts it so a source button re-drills into its own tools\n\t// (the initial drill-in level is read once, on mount).\n\tconst pickerNode = usePicker ? (\n\t\t<MentionPicker\n\t\t\tkey={pickerSource ?? '__root__'}\n\t\t\titems={mentionItems ?? []}\n\t\t\tquery=\"\"\n\t\t\tactiveIndex={0}\n\t\t\tinitialSource={pickerSource ?? undefined}\n\t\t\tonSelect={(item) => {\n\t\t\t\tsetAdding(false);\n\t\t\t\tonAdd(String(item.id));\n\t\t\t}}\n\t\t\tonClose={() => setAdding(false)}\n\t\t\tonCreateSubAgent={\n\t\t\t\tcreateOption\n\t\t\t\t\t? () => {\n\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\tcreateOption.onSelect();\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\ttoolActions={\n\t\t\t\thasActionSources\n\t\t\t\t\t? actionSources?.map((a) => ({\n\t\t\t\t\t\t\t...a,\n\t\t\t\t\t\t\tonSelect: () => {\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\ta.onSelect();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }))\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\t// Gate native source rows in the picker on their connected state, derived\n\t\t\t// from the source groups (which already carry connected/onConnect). This is\n\t\t\t// what makes the \"+\" dropdown show \"Connect\" for unconnected vendors,\n\t\t\t// consistent with the empty-state buttons.\n\t\t\tintegrationStatus={Object.fromEntries(\n\t\t\t\t(sourceGroups ?? [])\n\t\t\t\t\t.filter((g) => g.connected !== undefined)\n\t\t\t\t\t.map((g) => [g.source, g.connected]),\n\t\t\t)}\n\t\t\tonConnectIntegration={(source) => {\n\t\t\t\tsetAdding(false);\n\t\t\t\tsourceGroups?.find((g) => g.source === source)?.onConnect?.();\n\t\t\t}}\n\t\t/>\n\t) : null;\n\n\treturn (\n\t\t<SideSection>\n\t\t\t<SideSectionHeader>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{title}</TitleSmall>\n\t\t\t\t{showAddButton && (\n\t\t\t\t\t<AddButtonWrap ref={headerPickerRef}>\n\t\t\t\t\t\t<AddIconButton\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-add`}\n\t\t\t\t\t\t\tonClick={handleAddClick}\n\t\t\t\t\t\t\taria-label={`Add ${title}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PlusIcon width={16} height={16} color={COLORS.content.primary} />\n\t\t\t\t\t\t</AddIconButton>\n\t\t\t\t\t\t{usePicker && adding && pickerSource === null && (\n\t\t\t\t\t\t\t<PickerPopover\n\t\t\t\t\t\t\t\t$up={pickerOpensUp}\n\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-picker`}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{pickerNode}\n\t\t\t\t\t\t\t</PickerPopover>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</AddButtonWrap>\n\t\t\t\t)}\n\t\t\t</SideSectionHeader>\n\n\t\t\t{helper && (\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{helper}</BodyCaption>\n\t\t\t)}\n\n\t\t\t{showSourceButtons ? (\n\t\t\t\t<SourcePickerAnchor ref={usePicker ? sourcePickerRef : undefined}>\n\t\t\t\t\t{/* No tools yet: one button per source (never shown once a tool exists). */}\n\t\t\t\t\t<SourceButtonRow data-test={`${dataTestPrefix}-sources`}>\n\t\t\t\t\t\t{sourceGroups?.map((g) => (\n\t\t\t\t\t\t\t<SourceButton\n\t\t\t\t\t\t\t\tkey={g.source}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-source-${g.source}`}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t// Not connected → open the connect flow instead of the tools.\n\t\t\t\t\t\t\t\t\tif (g.connected === false) {\n\t\t\t\t\t\t\t\t\t\tg.onConnect?.();\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (usePicker) {\n\t\t\t\t\t\t\t\t\t\t// Open the `@` picker drilled straight into this source's tools.\n\t\t\t\t\t\t\t\t\t\tsetPickerSource(g.source);\n\t\t\t\t\t\t\t\t\t\tsetAdding(true);\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetActiveSource(g.source);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{renderSourceIcon(SOURCE_ICONS[g.source], -4)}\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t{g.label}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t{g.connected === false && (\n\t\t\t\t\t\t\t\t\t// Not connected → show \"Connect\" upfront (consistent with\n\t\t\t\t\t\t\t\t\t// the `@` picker); clicking runs the connect flow.\n\t\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.brand}>\n\t\t\t\t\t\t\t\t\t\tConnect\n\t\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</SourceButton>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t{actionSources?.map((a) => (\n\t\t\t\t\t\t\t<SourceButton\n\t\t\t\t\t\t\t\tkey={a.source}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-action-${a.source}`}\n\t\t\t\t\t\t\t\t// Not connected → connect flow; otherwise close any open source\n\t\t\t\t\t\t\t\t// picker before opening this drawer, else the previous source's\n\t\t\t\t\t\t\t\t// popup lingers behind it.\n\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\ta.connected === false\n\t\t\t\t\t\t\t\t\t\t? () => a.onConnect?.()\n\t\t\t\t\t\t\t\t\t\t: () => {\n\t\t\t\t\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\t\t\t\t\ta.onSelect();\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{renderSourceIcon(a.icon, -4)}\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t{a.label}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t{a.connected === false && (\n\t\t\t\t\t\t\t\t\t// Not connected → \"Connect\" upfront (consistent with the\n\t\t\t\t\t\t\t\t\t// source buttons and the `@` picker).\n\t\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.brand}>\n\t\t\t\t\t\t\t\t\t\tConnect\n\t\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</SourceButton>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</SourceButtonRow>\n\n\t\t\t\t\t{/* Picker mode: clicking a source opens its tools in the `@` picker. */}\n\t\t\t\t\t{usePicker && adding && pickerSource !== null && (\n\t\t\t\t\t\t<PickerPopover\n\t\t\t\t\t\t\t$align=\"left\"\n\t\t\t\t\t\t\t$up={pickerOpensUp}\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-picker`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{pickerNode}\n\t\t\t\t\t\t</PickerPopover>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Legacy (non-picker) mode: chosen source → its searchable tool list. */}\n\t\t\t\t\t{!usePicker && activeGroup && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-dropdown`}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\tplaceHolder={`Search ${activeGroup.label} tools`}\n\t\t\t\t\t\t\toptions={activeGroup.options}\n\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\tsetActiveSource(null);\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\tonAdd(v);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</SourcePickerAnchor>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{!usePicker && adding && dropdownOptions.length > 0 && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-dropdown`}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\tplaceHolder={`Select ${title.toLowerCase()}`}\n\t\t\t\t\t\t\toptions={dropdownOptions}\n\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\tif (!v) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (v === CREATE_OPTION_VALUE) {\n\t\t\t\t\t\t\t\t\tcreateOption?.onSelect();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonAdd(v);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{items.length === 0 && !adding ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t\t{emptyText}\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t{showEmptyCreate && createOption && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-create`}\n\t\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tLeadingIcon={PlusIcon}\n\t\t\t\t\t\t\t\t\tbuttonText={createOption.label}\n\t\t\t\t\t\t\t\t\tonClick={createOption.onSelect}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\trenderChipRows()\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{confirmDelete && pendingDeleteId && (\n\t\t\t\t<DeleteConfirmationModal\n\t\t\t\t\tdata-test={`${dataTestPrefix}-delete-confirm`}\n\t\t\t\t\theader={`Delete this ${confirmDelete.noun}?`}\n\t\t\t\t\tsubHeader={`Deleting this ${confirmDelete.noun} will also remove it from your instructions, wherever it's referenced.`}\n\t\t\t\t\tconfirmationText=\"Delete\"\n\t\t\t\t\tzIndex={confirmDelete.zIndex}\n\t\t\t\t\tonDeleteConfirmed={() => {\n\t\t\t\t\t\tonRemove(pendingDeleteId);\n\t\t\t\t\t\tsetPendingDeleteId(null);\n\t\t\t\t\t}}\n\t\t\t\t\tonCancelClicked={() => setPendingDeleteId(null)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</SideSection>\n\t);\n};\n\n// Anchors the `@`-picker popover to the header \"+\" button.\nconst AddButtonWrap = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n`;\n\n// Anchors the `@`-picker popover to the empty-state source buttons.\nconst SourcePickerAnchor = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\n// Floating card under the trigger. Aligns to the \"+\" (right) or the source\n// buttons (left) so it stays inside the side panel.\nconst PickerPopover = styled.div<{ $align?: 'left' | 'right'; $up?: boolean }>`\n\tposition: absolute;\n\t${(p) => (p.$up ? 'bottom: calc(100% + 4px);' : 'top: calc(100% + 4px);')}\n\t${(p) => (p.$align === 'left' ? 'left: 0;' : 'right: 0;')}\n\tz-index: 30;\n`;\n"],"names":["CREATE_OPTION_VALUE","SelectableListSection","title","helper","items","addableOptions","onAdd","onRemove","dataTestPrefix","emptyText","createOption","onConfigure","sourceGroups","mentionItems","actionSources","confirmDelete","pickerOpensUp","adding","setAdding","useState","pendingDeleteId","setPendingDeleteId","configuringId","setConfiguringId","activeSource","setActiveSource","hasSourceGroups","activeGroup","g","usePicker","headerPickerRef","useRef","sourcePickerRef","pickerSource","setPickerSource","useEffect","onDocMouseDown","e","target","onKeyDown","showAddButton","showEmptyCreate","hasActionSources","showSourceButtons","handleAddClick","v","handleConfigureClick","id","configure","result","renderChipRows","item","jsxs","SelectableRow","renderSourceIcon","jsx","Tooltip","RowText","BodySecondary","COLORS","RowActions","RowMenuButton","EditIcon","RowActionDivider","DeleteIcon","dropdownOptions","pickerNode","MentionPicker","a","source","SideSection","SideSectionHeader","TitleSmall","AddButtonWrap","AddIconButton","PlusIcon","PickerPopover","BodyCaption","SourcePickerAnchor","SourceButtonRow","SourceButton","SOURCE_ICONS","Dropdown","opt","unwrapDropdownValue","Fragment","Button","DeleteConfirmationModal","styled","p"],"mappings":";;;;;;;;;;;;;;;;AAoEA,MAAMA,IAAsB,sBAiEfC,KAA8D,CAAC;AAAA,EAC3E,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpC,CAACC,GAAiBC,CAAkB,IAAIF,EAAwB,IAAI,GAIpE,CAACG,GAAeC,CAAgB,IAAIJ,EAAwB,IAAI,GAEhE,CAACK,IAAcC,CAAe,IAAIN,EAAwB,IAAI,GAC9DO,IAAkB,CAAC,CAACd,KAAgBA,EAAa,SAAS,GAC1De,IAAcf,GAAc,KAAK,CAACgB,MAAMA,EAAE,WAAWJ,EAAY,GAEjEK,IAAYhB,MAAiB,QAI7BiB,IAAkBC,EAAuB,IAAI,GAC7CC,IAAkBD,EAAuB,IAAI,GAG7C,CAACE,GAAcC,CAAe,IAAIf,EAAwB,IAAI;AAGpE,EAAAgB,GAAU,MAAM;AACf,QAAI,CAACN,KAAa,CAACZ;AAClB;AAED,UAAMmB,IAAiB,CAACC,MAAkB;AACzC,YAAMC,IAASD,EAAE;AACjB,MACC,CAACP,EAAgB,SAAS,SAASQ,CAAM,KACzC,CAACN,EAAgB,SAAS,SAASM,CAAM,KAEzCpB,EAAU,EAAK;AAAA,IAEjB,GACMqB,IAAY,CAACF,MAAqB;AACvC,MAAIA,EAAE,QAAQ,YACbnB,EAAU,EAAK;AAAA,I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A9B,EAACsB,GAAA,EAAY,OAAOlB,EAAO,QAAQ,aACjC,UAAAlD,GACF;AAAA,QACCgC,MAAmB/B,KACnB,gBAAA6C;AAAA,UAAC+B;AAAA,UAAA;AAAA,YACA,aAAW,GAAG9E,CAAc;AAAA,YAC5B,YAAW;AAAA,YACX,MAAK;AAAA,YACL,kBAAgB;AAAA,YAChB,aAAamE;AAAAA,YACb,YAAYjE,EAAa;AAAA,YACzB,SAASA,EAAa;AAAA,UAAA;AAAA,QAAA;AAAA,MACvB,EAAA,CAEF,IAEAwC,GAAA;AAAA,IAAe,GAEjB;AAAA,IAEAnC,KAAiBK,KACjB,gBAAAmC;AAAA,MAACgC;AAAA,MAAA;AAAA,QACA,aAAW,GAAG/E,CAAc;AAAA,QAC5B,QAAQ,eAAeO,EAAc,IAAI;AAAA,QACzC,WAAW,iBAAiBA,EAAc,IAAI;AAAA,QAC9C,kBAAiB;AAAA,QACjB,QAAQA,EAAc;AAAA,QACtB,mBAAmB,MAAM;AACxB,UAAAR,EAASa,CAAe,GACxBC,EAAmB,IAAI;AAAA,QACxB;AAAA,QACA,iBAAiB,MAAMA,EAAmB,IAAI;AAAA,MAAA;AAAA,IAAA;AAAA,EAC/C,GAEF;AAEF,GAGMoD,KAAgBe,EAAO;AAAA;AAAA;AAAA,GAMvBV,KAAqBU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAS5BZ,IAAgBY,EAAO;AAAA;AAAA,GAE1B,CAACC,MAAOA,EAAE,MAAM,8BAA8B,wBAAyB;AAAA,GACvE,CAACA,MAAOA,EAAE,WAAW,SAAS,aAAa,WAAY;AAAA;AAAA;"}
@@ -1,13 +1,13 @@
1
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
- import { TitleRegular as n, BodySecondary as i } from "../../TypographyStyle.js";
3
- import { COLORS as e } from "../../../constants/Theme.js";
1
+ import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
+ import { TitleRegular as n, BodyCaption as c } from "../../TypographyStyle.js";
3
+ import { COLORS as t } from "../../../constants/Theme.js";
4
4
  import { SectionHeaderWrap as m } from "../AgentBuilder.styled.js";
5
5
  const s = ({
6
- title: t,
6
+ title: e,
7
7
  helper: o
8
- }) => /* @__PURE__ */ c(m, { children: [
9
- /* @__PURE__ */ r(n, { color: e.content.primary, children: t }),
10
- o && /* @__PURE__ */ r(i, { color: e.content.secondary, children: o })
8
+ }) => /* @__PURE__ */ i(m, { children: [
9
+ /* @__PURE__ */ r(n, { color: t.content.primary, children: e }),
10
+ o && /* @__PURE__ */ r(c, { color: t.content.secondary, children: o })
11
11
  ] });
12
12
  export {
13
13
  s as StepSectionHeader
@@ -1 +1 @@
1
- {"version":3,"file":"StepSectionHeader.js","sources":["../../../../../src/components/agent-builder/components/StepSectionHeader.tsx"],"sourcesContent":["import React from 'react';\nimport { BodySecondary, TitleRegular } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { SectionHeaderWrap } from '../AgentBuilder.styled';\n\ninterface StepSectionHeaderProps {\n\ttitle: string;\n\thelper?: string;\n}\n\nexport const StepSectionHeader: React.FC<StepSectionHeaderProps> = ({\n\ttitle,\n\thelper,\n}) => (\n\t<SectionHeaderWrap>\n\t\t<TitleRegular color={COLORS.content.primary}>{title}</TitleRegular>\n\t\t{helper && (\n\t\t\t<BodySecondary color={COLORS.content.secondary}>{helper}</BodySecondary>\n\t\t)}\n\t</SectionHeaderWrap>\n);\n"],"names":["StepSectionHeader","title","helper","SectionHeaderWrap","jsx","TitleRegular","COLORS","BodySecondary"],"mappings":";;;;AAUO,MAAMA,IAAsD,CAAC;AAAA,EACnE,OAAAC;AAAA,EACA,QAAAC;AACD,wBACEC,GAAA,EACA,UAAA;AAAA,EAAA,gBAAAC,EAACC,GAAA,EAAa,OAAOC,EAAO,QAAQ,SAAU,UAAAL,GAAM;AAAA,EACnDC,KACA,gBAAAE,EAACG,GAAA,EAAc,OAAOD,EAAO,QAAQ,WAAY,UAAAJ,EAAA,CAAO;AAAA,EAAA,CAE1D;"}
1
+ {"version":3,"file":"StepSectionHeader.js","sources":["../../../../../src/components/agent-builder/components/StepSectionHeader.tsx"],"sourcesContent":["import React from 'react';\nimport { BodyCaption, TitleRegular } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { SectionHeaderWrap } from '../AgentBuilder.styled';\n\ninterface StepSectionHeaderProps {\n\ttitle: string;\n\thelper?: string;\n}\n\nexport const StepSectionHeader: React.FC<StepSectionHeaderProps> = ({\n\ttitle,\n\thelper,\n}) => (\n\t<SectionHeaderWrap>\n\t\t<TitleRegular color={COLORS.content.primary}>{title}</TitleRegular>\n\t\t{helper && (\n\t\t\t<BodyCaption color={COLORS.content.secondary}>{helper}</BodyCaption>\n\t\t)}\n\t</SectionHeaderWrap>\n);\n"],"names":["StepSectionHeader","title","helper","SectionHeaderWrap","jsx","TitleRegular","COLORS","BodyCaption"],"mappings":";;;;AAUO,MAAMA,IAAsD,CAAC;AAAA,EACnE,OAAAC;AAAA,EACA,QAAAC;AACD,wBACEC,GAAA,EACA,UAAA;AAAA,EAAA,gBAAAC,EAACC,GAAA,EAAa,OAAOC,EAAO,QAAQ,SAAU,UAAAL,GAAM;AAAA,EACnDC,KACA,gBAAAE,EAACG,GAAA,EAAY,OAAOD,EAAO,QAAQ,WAAY,UAAAJ,EAAA,CAAO;AAAA,EAAA,CAExD;"}
@@ -1,4 +1,4 @@
1
- const s = [
1
+ const t = [
2
2
  { key: "tool", label: "Tools" },
3
3
  { key: "subagent", label: "Sub-agent" }
4
4
  ];
@@ -14,7 +14,7 @@ const n = {
14
14
  slack: "Slack"
15
15
  }, _ = {
16
16
  rest_api: "REST API",
17
- email_handover: "Handover to email",
17
+ email_handover: "Send Email",
18
18
  slack: "Send Slack message"
19
19
  }, m = [
20
20
  "rest_api",
@@ -30,18 +30,18 @@ const n = {
30
30
  slack: 5
31
31
  // Manifest is intentionally omitted so it sorts AFTER the integration sources
32
32
  // (unknown/unranked → last). The generic "Manifest" group is being phased out.
33
- }, t = Object.keys(e).length, o = (a) => e[a] ?? t, c = {
33
+ }, s = Object.keys(e).length, c = (a) => e[a] ?? s, l = {
34
34
  email_handover: "send_email",
35
35
  slack: "send_slack_message"
36
36
  };
37
37
  export {
38
- s as CATEGORIES,
39
- c as CONFIG_TOOL_SOURCES,
38
+ t as CATEGORIES,
39
+ l as CONFIG_TOOL_SOURCES,
40
40
  _ as TOOL_ACTION_LABELS,
41
41
  m as TOOL_ACTION_SOURCES,
42
42
  n as TOOL_SOURCE_LABELS,
43
43
  e as TOOL_SOURCE_RANK,
44
44
  i as ToolSource,
45
- o as toolSourceRank
45
+ c as toolSourceRank
46
46
  };
47
47
  //# sourceMappingURL=tools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sources":["../../../../../src/components/agent-builder/constants/tools.ts"],"sourcesContent":["import type { ToolSource as ModelToolSource } from '@bikdotai/bik-models/ai-agents/models/agent-tool';\nimport type { FunctionComponent, SVGAttributes } from 'react';\n\n/**\n * Static tool-related constants for the builder's Step 3 (tools & sub-agents):\n * the reference-picker category tabs and the per-source display labels. Kept here\n * (rather than inline in the picker / serialization utils) so the labels a user\n * sees are all in one obvious place.\n */\n\n/** A reference-picker category tab. */\nexport type Category = 'tool' | 'subagent';\n\n/** Category tabs shown at the root of the `@` reference picker. */\nexport const CATEGORIES: { key: Category; label: string }[] = [\n\t{ key: 'tool', label: 'Tools' },\n\t{ key: 'subagent', label: 'Sub-agent' },\n];\n\n/**\n * Every tool \"source\" the builder renders an icon / label / picker entry for.\n * Enum VALUES are the backend's canonical read-only `source` wire strings\n * (`app/agents/config/schema.py` → `ToolSource`, derived from `tool_key`): the\n * configurable tools are `email_handover` / `rest_api` / `slack`, every native\n * tool is `manifest`. `shopify` / `integration` are legacy bik-models sources\n * kept for back-compat (the backend now collapses natives to `manifest`).\n * Dynamic/unknown sources are looked up leniently — see `toolSourceLabel` and\n * `sourceIcon`.\n *\n * This is the RUNTIME mirror of the canonical `@bikdotai/bik-models` `ToolSource`\n * union (the shape the backend persists as `AgentToolDoc.source`). We keep an\n * enum — not a re-export of the type — because the members are needed at runtime\n * for labels, ranks, icons and `===` comparisons; a type-only union can't do\n * that. The two are kept in lock-step by {@link ToolSourceMatchesBikModels}\n * below, which fails to compile if they ever drift.\n */\nexport enum ToolSource {\n\tManifest = 'manifest',\n\tShopify = 'shopify',\n\tBigcommerce = 'bigcommerce',\n\tShipstation = 'shipstation',\n\tIntegration = 'integration',\n\tRestApi = 'rest_api',\n\tEmailHandover = 'email_handover',\n\tSlack = 'slack',\n}\n\n/**\n * Compile-time guard that {@link ToolSource} stays a faithful mirror of the\n * canonical `@bikdotai/bik-models` `ToolSource` union. If a source is added to\n * (or removed from) either side without the other, `AssertTrue` receives `false`\n * and this type stops compiling — so the runtime enum can never silently diverge\n * from what the backend persists as `AgentToolDoc.source`. The tuple wrappers\n * (`[…]`) stop the conditionals from distributing over the unions, so it checks\n * set-equality in both directions.\n *\n * Type-only (erased at build): a drift shows up as a compile error on\n * `ToolSourceMatchesBikModels` telling you to reconcile this enum with\n * `@bikdotai/bik-models` (bump the dep and/or the enum).\n */\ntype AssertTrue<T extends true> = T;\ntype ToolSourceMatchesBikModels = AssertTrue<\n\t[`${ToolSource}`] extends [ModelToolSource]\n\t\t? [ModelToolSource] extends [`${ToolSource}`]\n\t\t\t? true\n\t\t\t: false\n\t\t: false\n>;\n\n/**\n * Display labels for the known tool sources — the CATEGORY/integration name, used\n * for the picker's source headers (drill-in groups), the empty-state source\n * buttons and the mention-chip prefix. A source is a category (\"Slack\") you drill\n * into; the specific addable action inside it (\"Send Slack message\") is\n * `TOOL_ACTION_LABELS`. Unknown sources fall back to the raw key (see\n * `toolSourceLabel`).\n */\nexport const TOOL_SOURCE_LABELS: Record<ToolSource, string> = {\n\t[ToolSource.Manifest]: 'Manifest',\n\t[ToolSource.Shopify]: 'Shopify',\n\t[ToolSource.Bigcommerce]: 'BigCommerce',\n\t[ToolSource.Shipstation]: 'ShipStation',\n\t[ToolSource.Integration]: 'Integration',\n\t[ToolSource.RestApi]: 'Rest API',\n\t[ToolSource.EmailHandover]: 'Email',\n\t[ToolSource.Slack]: 'Slack',\n};\n\n/**\n * The addable action inside a configurable/rest source — shown as the \"add\" row\n * in the `@` picker (below any existing instances) and the empty-state button.\n * Distinct from `TOOL_SOURCE_LABELS`, which names the category the action lives in\n * (e.g. category \"Slack\" → action \"Send Slack message\").\n */\nexport const TOOL_ACTION_LABELS: Partial<Record<ToolSource, string>> = {\n\t[ToolSource.RestApi]: 'REST API',\n\t[ToolSource.EmailHandover]: 'Handover to email',\n\t[ToolSource.Slack]: 'Send Slack message',\n};\n\n/** A tool source's brand-glyph component. */\nexport type IconComp = FunctionComponent<SVGAttributes<SVGElement>>;\n\n/** Brand glyph for a tool source, with its own size so each keeps its aspect ratio. */\nexport interface SourceIcon {\n\tIcon: IconComp;\n\tw: number;\n\th: number;\n}\n\n/**\n * A built-in \"tool\" that opens a config drawer (Rest API / email handover /\n * Slack) rather than inserting a mention. Surfaced as an empty-state source\n * button in the Tools section and as a row in the `@`-picker Tools view; picking\n * it opens the drawer and never writes into the instructions text.\n */\nexport interface ToolAction {\n\tsource: ToolSource;\n\tlabel: string;\n\ticon?: SourceIcon;\n\t/** Open this tool's config drawer. */\n\tonSelect: () => void;\n\t/**\n\t * Integration connection state for this source. `undefined` = no connection\n\t * gating (default). `false` = the store hasn't connected this integration →\n\t * the `@` picker shows a \"Connect\" row that calls {@link onConnect} instead of\n\t * drilling in / offering \"Create new\". `true` = connected (renders normally).\n\t * Set by the consumer via `config.integrationStatus` (today: Slack only).\n\t */\n\tconnected?: boolean;\n\t/** Open the parent's connect flow for this source (used when `connected === false`). */\n\tonConnect?: () => void;\n}\n\n/** Sources of the built-in drawer tools, in display order. */\nexport const TOOL_ACTION_SOURCES: ToolSource[] = [\n\tToolSource.RestApi,\n\tToolSource.EmailHandover,\n\tToolSource.Slack,\n];\n\n/**\n * Fixed display rank for the `@`-picker's tool-source groups (lower = higher). The\n * picker sorts its source rows by this so adding/updating a tool never reshuffles\n * them. Any source not listed here (dynamic/unknown, e.g. Integration) sorts AFTER\n * Slack, keeping its discovery order among the rest (Array.sort is stable).\n */\nexport const TOOL_SOURCE_RANK: Partial<Record<ToolSource, number>> = {\n\t[ToolSource.Shopify]: 0,\n\t[ToolSource.Bigcommerce]: 1,\n\t[ToolSource.Shipstation]: 2,\n\t[ToolSource.RestApi]: 3,\n\t[ToolSource.EmailHandover]: 4,\n\t[ToolSource.Slack]: 5,\n\t// Manifest is intentionally omitted so it sorts AFTER the integration sources\n\t// (unknown/unranked → last). The generic \"Manifest\" group is being phased out.\n};\n\nconst UNRANKED_SOURCE_RANK = Object.keys(TOOL_SOURCE_RANK).length;\n\n/** Sort rank for a source string; unknown sources rank after all known ones. */\nexport const toolSourceRank = (source: string): number =>\n\tTOOL_SOURCE_RANK[source as ToolSource] ?? UNRANKED_SOURCE_RANK;\n\n/**\n * `tool_key` of a configurable shared-drawer tool (email / Slack). Lives here (not\n * in AgentBuilder.model) so this leaf constants file has no back-edge to the model\n * — the dependency stays one-way (model → constants), avoiding a circular import.\n */\nexport type ConfigToolKey = 'send_email' | 'send_slack_message';\n\n/**\n * Drawer sources rendered by the shared dynamic panel (`ConfigToolPanel`), each\n * mapped to its backend `tool_key`. Rest API is absent — it has a bespoke panel.\n */\nexport const CONFIG_TOOL_SOURCES: Partial<Record<ToolSource, ConfigToolKey>> = {\n\t[ToolSource.EmailHandover]: 'send_email',\n\t[ToolSource.Slack]: 'send_slack_message',\n};\n"],"names":["CATEGORIES","ToolSource","TOOL_SOURCE_LABELS","TOOL_ACTION_LABELS","TOOL_ACTION_SOURCES","TOOL_SOURCE_RANK","UNRANKED_SOURCE_RANK","toolSourceRank","source","CONFIG_TOOL_SOURCES"],"mappings":"AAcO,MAAMA,IAAiD;AAAA,EAC7D,EAAE,KAAK,QAAQ,OAAO,QAAA;AAAA,EACtB,EAAE,KAAK,YAAY,OAAO,YAAA;AAC3B;AAmBO,IAAKC,sBAAAA,OACXA,EAAA,WAAW,YACXA,EAAA,UAAU,WACVA,EAAA,cAAc,eACdA,EAAA,cAAc,eACdA,EAAA,cAAc,eACdA,EAAA,UAAU,YACVA,EAAA,gBAAgB,kBAChBA,EAAA,QAAQ,SARGA,IAAAA,KAAA,CAAA,CAAA;AAyCL,MAAMC,IAAiD;AAAA,EAC5D,UAAsB;AAAA,EACtB,SAAqB;AAAA,EACrB,aAAyB;AAAA,EACzB,aAAyB;AAAA,EACzB,aAAyB;AAAA,EACzB,UAAqB;AAAA,EACrB,gBAA2B;AAAA,EAC3B,OAAmB;AACrB,GAQaC,IAA0D;AAAA,EACrE,UAAqB;AAAA,EACrB,gBAA2B;AAAA,EAC3B,OAAmB;AACrB,GAqCaC,IAAoC;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA;AACD,GAQaC,IAAwD;AAAA,EACnE,SAAqB;AAAA,EACrB,aAAyB;AAAA,EACzB,aAAyB;AAAA,EACzB,UAAqB;AAAA,EACrB,gBAA2B;AAAA,EAC3B,OAAmB;AAAA;AAAA;AAGrB,GAEMC,IAAuB,OAAO,KAAKD,CAAgB,EAAE,QAG9CE,IAAiB,CAACC,MAC9BH,EAAiBG,CAAoB,KAAKF,GAa9BG,IAAkE;AAAA,EAC7E,gBAA2B;AAAA,EAC3B,OAAmB;AACrB;"}
1
+ {"version":3,"file":"tools.js","sources":["../../../../../src/components/agent-builder/constants/tools.ts"],"sourcesContent":["import type { ToolSource as ModelToolSource } from '@bikdotai/bik-models/ai-agents/models/agent-tool';\nimport type { FunctionComponent, SVGAttributes } from 'react';\n\n/**\n * Static tool-related constants for the builder's Step 3 (tools & sub-agents):\n * the reference-picker category tabs and the per-source display labels. Kept here\n * (rather than inline in the picker / serialization utils) so the labels a user\n * sees are all in one obvious place.\n */\n\n/** A reference-picker category tab. */\nexport type Category = 'tool' | 'subagent';\n\n/** Category tabs shown at the root of the `@` reference picker. */\nexport const CATEGORIES: { key: Category; label: string }[] = [\n\t{ key: 'tool', label: 'Tools' },\n\t{ key: 'subagent', label: 'Sub-agent' },\n];\n\n/**\n * Every tool \"source\" the builder renders an icon / label / picker entry for.\n * Enum VALUES are the backend's canonical read-only `source` wire strings\n * (`app/agents/config/schema.py` → `ToolSource`, derived from `tool_key`): the\n * configurable tools are `email_handover` / `rest_api` / `slack`, every native\n * tool is `manifest`. `shopify` / `integration` are legacy bik-models sources\n * kept for back-compat (the backend now collapses natives to `manifest`).\n * Dynamic/unknown sources are looked up leniently — see `toolSourceLabel` and\n * `sourceIcon`.\n *\n * This is the RUNTIME mirror of the canonical `@bikdotai/bik-models` `ToolSource`\n * union (the shape the backend persists as `AgentToolDoc.source`). We keep an\n * enum — not a re-export of the type — because the members are needed at runtime\n * for labels, ranks, icons and `===` comparisons; a type-only union can't do\n * that. The two are kept in lock-step by {@link ToolSourceMatchesBikModels}\n * below, which fails to compile if they ever drift.\n */\nexport enum ToolSource {\n\tManifest = 'manifest',\n\tShopify = 'shopify',\n\tBigcommerce = 'bigcommerce',\n\tShipstation = 'shipstation',\n\tIntegration = 'integration',\n\tRestApi = 'rest_api',\n\tEmailHandover = 'email_handover',\n\tSlack = 'slack',\n}\n\n/**\n * Compile-time guard that {@link ToolSource} stays a faithful mirror of the\n * canonical `@bikdotai/bik-models` `ToolSource` union. If a source is added to\n * (or removed from) either side without the other, `AssertTrue` receives `false`\n * and this type stops compiling — so the runtime enum can never silently diverge\n * from what the backend persists as `AgentToolDoc.source`. The tuple wrappers\n * (`[…]`) stop the conditionals from distributing over the unions, so it checks\n * set-equality in both directions.\n *\n * Type-only (erased at build): a drift shows up as a compile error on\n * `ToolSourceMatchesBikModels` telling you to reconcile this enum with\n * `@bikdotai/bik-models` (bump the dep and/or the enum).\n */\ntype AssertTrue<T extends true> = T;\ntype ToolSourceMatchesBikModels = AssertTrue<\n\t[`${ToolSource}`] extends [ModelToolSource]\n\t\t? [ModelToolSource] extends [`${ToolSource}`]\n\t\t\t? true\n\t\t\t: false\n\t\t: false\n>;\n\n/**\n * Display labels for the known tool sources — the CATEGORY/integration name, used\n * for the picker's source headers (drill-in groups), the empty-state source\n * buttons and the mention-chip prefix. A source is a category (\"Slack\") you drill\n * into; the specific addable action inside it (\"Send Slack message\") is\n * `TOOL_ACTION_LABELS`. Unknown sources fall back to the raw key (see\n * `toolSourceLabel`).\n */\nexport const TOOL_SOURCE_LABELS: Record<ToolSource, string> = {\n\t[ToolSource.Manifest]: 'Manifest',\n\t[ToolSource.Shopify]: 'Shopify',\n\t[ToolSource.Bigcommerce]: 'BigCommerce',\n\t[ToolSource.Shipstation]: 'ShipStation',\n\t[ToolSource.Integration]: 'Integration',\n\t[ToolSource.RestApi]: 'Rest API',\n\t[ToolSource.EmailHandover]: 'Email',\n\t[ToolSource.Slack]: 'Slack',\n};\n\n/**\n * The addable action inside a configurable/rest source — shown as the \"add\" row\n * in the `@` picker (below any existing instances) and the empty-state button.\n * Distinct from `TOOL_SOURCE_LABELS`, which names the category the action lives in\n * (e.g. category \"Slack\" → action \"Send Slack message\").\n */\nexport const TOOL_ACTION_LABELS: Partial<Record<ToolSource, string>> = {\n\t[ToolSource.RestApi]: 'REST API',\n\t[ToolSource.EmailHandover]: 'Send Email',\n\t[ToolSource.Slack]: 'Send Slack message',\n};\n\n/** A tool source's brand-glyph component. */\nexport type IconComp = FunctionComponent<SVGAttributes<SVGElement>>;\n\n/** Brand glyph for a tool source, with its own size so each keeps its aspect ratio. */\nexport interface SourceIcon {\n\tIcon: IconComp;\n\tw: number;\n\th: number;\n}\n\n/**\n * A built-in \"tool\" that opens a config drawer (Rest API / email handover /\n * Slack) rather than inserting a mention. Surfaced as an empty-state source\n * button in the Tools section and as a row in the `@`-picker Tools view; picking\n * it opens the drawer and never writes into the instructions text.\n */\nexport interface ToolAction {\n\tsource: ToolSource;\n\tlabel: string;\n\ticon?: SourceIcon;\n\t/** Open this tool's config drawer. */\n\tonSelect: () => void;\n\t/**\n\t * Integration connection state for this source. `undefined` = no connection\n\t * gating (default). `false` = the store hasn't connected this integration →\n\t * the `@` picker shows a \"Connect\" row that calls {@link onConnect} instead of\n\t * drilling in / offering \"Create new\". `true` = connected (renders normally).\n\t * Set by the consumer via `config.integrationStatus` (today: Slack only).\n\t */\n\tconnected?: boolean;\n\t/** Open the parent's connect flow for this source (used when `connected === false`). */\n\tonConnect?: () => void;\n}\n\n/** Sources of the built-in drawer tools, in display order. */\nexport const TOOL_ACTION_SOURCES: ToolSource[] = [\n\tToolSource.RestApi,\n\tToolSource.EmailHandover,\n\tToolSource.Slack,\n];\n\n/**\n * Fixed display rank for the `@`-picker's tool-source groups (lower = higher). The\n * picker sorts its source rows by this so adding/updating a tool never reshuffles\n * them. Any source not listed here (dynamic/unknown, e.g. Integration) sorts AFTER\n * Slack, keeping its discovery order among the rest (Array.sort is stable).\n */\nexport const TOOL_SOURCE_RANK: Partial<Record<ToolSource, number>> = {\n\t[ToolSource.Shopify]: 0,\n\t[ToolSource.Bigcommerce]: 1,\n\t[ToolSource.Shipstation]: 2,\n\t[ToolSource.RestApi]: 3,\n\t[ToolSource.EmailHandover]: 4,\n\t[ToolSource.Slack]: 5,\n\t// Manifest is intentionally omitted so it sorts AFTER the integration sources\n\t// (unknown/unranked → last). The generic \"Manifest\" group is being phased out.\n};\n\nconst UNRANKED_SOURCE_RANK = Object.keys(TOOL_SOURCE_RANK).length;\n\n/** Sort rank for a source string; unknown sources rank after all known ones. */\nexport const toolSourceRank = (source: string): number =>\n\tTOOL_SOURCE_RANK[source as ToolSource] ?? UNRANKED_SOURCE_RANK;\n\n/**\n * `tool_key` of a configurable shared-drawer tool (email / Slack). Lives here (not\n * in AgentBuilder.model) so this leaf constants file has no back-edge to the model\n * — the dependency stays one-way (model → constants), avoiding a circular import.\n */\nexport type ConfigToolKey = 'send_email' | 'send_slack_message';\n\n/**\n * Drawer sources rendered by the shared dynamic panel (`ConfigToolPanel`), each\n * mapped to its backend `tool_key`. Rest API is absent — it has a bespoke panel.\n */\nexport const CONFIG_TOOL_SOURCES: Partial<Record<ToolSource, ConfigToolKey>> = {\n\t[ToolSource.EmailHandover]: 'send_email',\n\t[ToolSource.Slack]: 'send_slack_message',\n};\n"],"names":["CATEGORIES","ToolSource","TOOL_SOURCE_LABELS","TOOL_ACTION_LABELS","TOOL_ACTION_SOURCES","TOOL_SOURCE_RANK","UNRANKED_SOURCE_RANK","toolSourceRank","source","CONFIG_TOOL_SOURCES"],"mappings":"AAcO,MAAMA,IAAiD;AAAA,EAC7D,EAAE,KAAK,QAAQ,OAAO,QAAA;AAAA,EACtB,EAAE,KAAK,YAAY,OAAO,YAAA;AAC3B;AAmBO,IAAKC,sBAAAA,OACXA,EAAA,WAAW,YACXA,EAAA,UAAU,WACVA,EAAA,cAAc,eACdA,EAAA,cAAc,eACdA,EAAA,cAAc,eACdA,EAAA,UAAU,YACVA,EAAA,gBAAgB,kBAChBA,EAAA,QAAQ,SARGA,IAAAA,KAAA,CAAA,CAAA;AAyCL,MAAMC,IAAiD;AAAA,EAC5D,UAAsB;AAAA,EACtB,SAAqB;AAAA,EACrB,aAAyB;AAAA,EACzB,aAAyB;AAAA,EACzB,aAAyB;AAAA,EACzB,UAAqB;AAAA,EACrB,gBAA2B;AAAA,EAC3B,OAAmB;AACrB,GAQaC,IAA0D;AAAA,EACrE,UAAqB;AAAA,EACrB,gBAA2B;AAAA,EAC3B,OAAmB;AACrB,GAqCaC,IAAoC;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA;AACD,GAQaC,IAAwD;AAAA,EACnE,SAAqB;AAAA,EACrB,aAAyB;AAAA,EACzB,aAAyB;AAAA,EACzB,UAAqB;AAAA,EACrB,gBAA2B;AAAA,EAC3B,OAAmB;AAAA;AAAA;AAGrB,GAEMC,IAAuB,OAAO,KAAKD,CAAgB,EAAE,QAG9CE,IAAiB,CAACC,MAC9BH,EAAiBG,CAAoB,KAAKF,GAa9BG,IAAkE;AAAA,EAC7E,gBAA2B;AAAA,EAC3B,OAAmB;AACrB;"}
@@ -1,219 +1,220 @@
1
1
  import { jsx as pt } from "react/jsx-runtime";
2
2
  import xt, { useState as h, useRef as u, useCallback as e, useMemo as B, useContext as Rt } from "react";
3
3
  import { AGENT_CHAR_LIMITS as Tt } from "../constants/charLimits.js";
4
- import { getStepIndex as At, STEP_KEYS as A } from "../constants/steps.js";
4
+ import { getStepIndex as At, STEP_KEYS as f } from "../constants/steps.js";
5
5
  const ut = xt.createContext(null), Ft = () => {
6
- const t = Rt(ut);
7
- if (!t)
6
+ const s = Rt(ut);
7
+ if (!s)
8
8
  throw new Error(
9
9
  "useAgentBuilderContext must be used within an AgentBuilderProvider"
10
10
  );
11
- return t;
12
- }, _t = (t, r) => {
13
- const m = t.trigger.mode === "custom_intent" ? (t.trigger.custom_intent ?? "").trim().length > 0 : t.trigger.intents.length > 0;
11
+ return s;
12
+ }, _t = (s, r) => {
13
+ const m = s.trigger.mode === "custom_intent" ? (s.trigger.custom_intent ?? "").trim().length > 0 : s.trigger.intents.length > 0;
14
14
  return {
15
- about: t.name.trim().length > 0 && t.name.length <= r.name && t.description.length <= r.description,
15
+ about: s.name.trim().length > 0 && s.name.length <= r.name && s.description.length <= r.description,
16
16
  trigger: m,
17
17
  // At least one of Instructions / Guardrails must be filled.
18
- response: t.instructions.trim().length > 0 || (t.guardrail ?? "").trim().length > 0,
18
+ response: s.instructions.trim().length > 0 || (s.guardrail ?? "").trim().length > 0,
19
19
  // Optional until specced further — never blocks go-live.
20
20
  handover: !0
21
21
  };
22
22
  }, Pt = ({
23
- value: t,
23
+ value: s,
24
24
  onChange: r,
25
25
  activeStep: m,
26
26
  onStepChange: F,
27
- availableTools: f,
28
- availableSubAgents: p,
27
+ availableTools: x,
28
+ availableSubAgents: R,
29
29
  availableIntents: P,
30
30
  availableModels: E,
31
31
  configToolTemplates: $,
32
32
  integrationStatus: w,
33
33
  onConnectIntegration: H,
34
- validation: L,
35
- applicationType: V,
36
- charLimits: b,
37
- disableStepNavigation: j = !0,
38
- onCreateSubAgent: q,
39
- onFetchSubAgent: y,
40
- onUpdateSubAgent: I,
34
+ validation: I,
35
+ applicationType: L,
36
+ charLimits: V,
37
+ disableStepNavigation: b = !0,
38
+ onCreateSubAgent: j,
39
+ onFetchSubAgent: q,
40
+ onUpdateSubAgent: y,
41
41
  onImproveSubAgent: K,
42
- onImproveToolInstructions: G,
42
+ onImproveToolInstructions: a,
43
43
  children: lt
44
44
  }) => {
45
- const [dt, gt] = h("about"), x = m ?? dt, i = At(x), N = u(t);
46
- N.current = t;
47
- const [U, Y] = h(0), _ = u({}), a = u("instructions"), z = e(
48
- (s, o) => {
49
- o ? _.current[s] = o : delete _.current[s];
45
+ const [dt, gt] = h("about"), T = m ?? dt, i = At(T), G = u(s);
46
+ G.current = s;
47
+ const [N, U] = h(0), M = u({}), Y = u("instructions"), z = e(
48
+ (t, o) => {
49
+ o ? M.current[t] = o : delete M.current[t];
50
50
  },
51
51
  []
52
- ), D = e((s) => {
53
- a.current = s;
54
- }, []), J = u(null), Q = e((s) => {
55
- J.current = s;
52
+ ), D = e((t) => {
53
+ Y.current = t;
54
+ }, []), J = u(null), Q = e((t) => {
55
+ J.current = t;
56
56
  }, []), W = e(() => {
57
57
  J.current?.();
58
58
  }, []), X = u(
59
59
  null
60
60
  ), Z = e(
61
- (s) => {
62
- X.current = s;
61
+ (t) => {
62
+ X.current = t;
63
63
  },
64
64
  []
65
- ), k = e((s) => {
66
- X.current?.(s);
67
- }, []), C = e((s, o, c) => {
68
- const d = _.current;
69
- (d[a.current] ?? d.instructions)?.(s, o, c);
70
- }, []), [O, M] = h(null), R = u(null), v = u(0), l = e(
71
- (s) => {
72
- m === void 0 && gt(s), F?.(s);
65
+ ), k = e((t) => {
66
+ X.current?.(t);
67
+ }, []), C = e((t, o, c) => {
68
+ const d = M.current;
69
+ (d[Y.current] ?? d.instructions)?.(t, o, c);
70
+ }, []), [O, S] = h(null), A = u(null), v = u(0), _ = B(
71
+ () => ({ ...Tt, ...V }),
72
+ [V]
73
+ ), p = B(
74
+ () => ({ ..._t(s, _), ...I }),
75
+ [s, _, I]
76
+ ), l = e(
77
+ (t) => {
78
+ const o = f.indexOf(t);
79
+ o > i && f.slice(0, o).some((c) => !p[c]) || (m === void 0 && gt(t), F?.(t));
73
80
  },
74
- [m, F]
81
+ [m, F, i, p]
75
82
  ), tt = e(() => {
76
- const s = A[Math.min(i + 1, A.length - 1)];
77
- l(s);
83
+ const t = f[Math.min(i + 1, f.length - 1)];
84
+ l(t);
78
85
  }, [i, l]), st = e(() => {
79
- const s = A[Math.max(i - 1, 0)];
80
- l(s);
86
+ const t = f[Math.max(i - 1, 0)];
87
+ l(t);
81
88
  }, [i, l]), ot = e(
82
- (s) => r(s),
89
+ (t) => r(t),
83
90
  [r]
84
91
  ), nt = e(
85
- (s, o) => r({ [s]: o }),
92
+ (t, o) => r({ [t]: o }),
86
93
  [r]
87
94
  ), et = e(
88
- (s, o) => {
89
- const c = N.current;
90
- s === "tool" ? !((c.configTools ?? []).some((g) => g.id === o) || (c.restApiTools ?? []).some((g) => g.id === o)) && !c.tools.includes(o) && r({ tools: [...c.tools, o] }) : c.subagents.includes(o) || r({ subagents: [...c.subagents, o] });
95
+ (t, o) => {
96
+ const c = G.current;
97
+ t === "tool" ? !((c.configTools ?? []).some((g) => g.id === o) || (c.restApiTools ?? []).some((g) => g.id === o)) && !c.tools.includes(o) && r({ tools: [...c.tools, o] }) : c.subagents.includes(o) || r({ subagents: [...c.subagents, o] });
91
98
  },
92
99
  [r]
93
100
  ), rt = e(
94
- (s, o) => {
95
- const c = s === "tool" ? `{{tool:${o}}}` : `{{subagent:${o}}}`, d = (n) => n.split(c).join("");
96
- R.current = {
97
- tools: t.tools,
98
- subagents: t.subagents,
99
- configTools: t.configTools,
100
- restApiTools: t.restApiTools,
101
- instructions: t.instructions,
102
- guardrail: t.guardrail
101
+ (t, o) => {
102
+ const c = t === "tool" ? `{{tool:${o}}}` : `{{subagent:${o}}}`, d = (n) => n.split(c).join("");
103
+ A.current = {
104
+ tools: s.tools,
105
+ subagents: s.subagents,
106
+ configTools: s.configTools,
107
+ restApiTools: s.restApiTools,
108
+ instructions: s.instructions,
109
+ guardrail: s.guardrail
103
110
  };
104
111
  const g = {
105
- instructions: d(t.instructions),
106
- guardrail: d(t.guardrail ?? ""),
107
- ...s === "tool" ? {
112
+ instructions: d(s.instructions),
113
+ guardrail: d(s.guardrail ?? ""),
114
+ ...t === "tool" ? {
108
115
  // A tool id may be a catalog tool OR an inline custom tool — drop
109
116
  // it from whichever list holds it (the others are no-op filters).
110
- tools: t.tools.filter((n) => n !== o),
111
- configTools: (t.configTools ?? []).filter((n) => n.id !== o),
112
- restApiTools: (t.restApiTools ?? []).filter(
117
+ tools: s.tools.filter((n) => n !== o),
118
+ configTools: (s.configTools ?? []).filter((n) => n.id !== o),
119
+ restApiTools: (s.restApiTools ?? []).filter(
113
120
  (n) => n.id !== o
114
121
  )
115
- } : { subagents: t.subagents.filter((n) => n !== o) }
122
+ } : { subagents: s.subagents.filter((n) => n !== o) }
116
123
  };
117
- r(g), Y((n) => n + 1);
118
- const ft = s === "tool" ? f.find((n) => n.tool_id === o)?.display_name ?? (t.restApiTools ?? []).find((n) => n.id === o)?.name ?? "Tool" : p.find((n) => n.id === o)?.name ?? "Sub-agent";
119
- v.current += 1, M({
124
+ r(g), U((n) => n + 1);
125
+ const mt = t === "tool" ? x.find((n) => n.tool_id === o)?.display_name ?? (s.restApiTools ?? []).find((n) => n.id === o)?.name ?? "Tool" : R.find((n) => n.id === o)?.name ?? "Sub-agent";
126
+ v.current += 1, S({
120
127
  id: v.current,
121
- message: `${s === "tool" ? "Tool" : "Sub-agent"} "${ft}" removed`
128
+ message: `${t === "tool" ? "Tool" : "Sub-agent"} "${mt}" removed`
122
129
  });
123
130
  },
124
- [f, p, t, r]
131
+ [x, R, s, r]
125
132
  ), ct = e(() => {
126
- R.current && (r(R.current), R.current = null, Y((s) => s + 1)), M(null);
127
- }, [r]), it = e(() => M(null), []), T = B(
128
- () => ({ ...Tt, ...b }),
129
- [b]
130
- ), S = B(
131
- () => ({ ..._t(t, T), ...L }),
132
- [t, T, L]
133
- ), mt = B(
133
+ A.current && (r(A.current), A.current = null, U((t) => t + 1)), S(null);
134
+ }, [r]), it = e(() => S(null), []), ft = B(
134
135
  () => ({
135
- value: t,
136
+ value: s,
136
137
  patch: ot,
137
138
  updateField: nt,
138
139
  addReference: et,
139
140
  removeReference: rt,
140
- mentionResetKey: U,
141
+ mentionResetKey: N,
141
142
  insertMention: C,
142
143
  registerMentionField: z,
143
144
  notifyMentionFocus: D,
144
145
  undoToast: O,
145
146
  undoRemoval: ct,
146
147
  dismissUndo: it,
147
- activeStep: x,
148
+ activeStep: T,
148
149
  activeIndex: i,
149
150
  goToStep: l,
150
151
  goNext: tt,
151
152
  goPrev: st,
152
153
  isFirstStep: i === 0,
153
- isLastStep: i === A.length - 1,
154
- validation: S,
155
- isActiveStepValid: S[x],
156
- availableTools: f,
157
- availableSubAgents: p,
154
+ isLastStep: i === f.length - 1,
155
+ validation: p,
156
+ isActiveStepValid: p[T],
157
+ availableTools: x,
158
+ availableSubAgents: R,
158
159
  availableIntents: P,
159
160
  availableModels: E,
160
161
  configToolTemplates: $,
161
162
  integrationStatus: w,
162
163
  onConnectIntegration: H,
163
- applicationType: V,
164
- charLimits: T,
165
- disableStepNavigation: j,
166
- onCreateSubAgent: q,
164
+ applicationType: L,
165
+ charLimits: _,
166
+ disableStepNavigation: b,
167
+ onCreateSubAgent: j,
167
168
  registerSubAgentCreator: Q,
168
169
  requestCreateSubAgent: W,
169
170
  registerToolActionHandler: Z,
170
171
  requestToolAction: k,
171
- onFetchSubAgent: y,
172
- onUpdateSubAgent: I,
172
+ onFetchSubAgent: q,
173
+ onUpdateSubAgent: y,
173
174
  onImproveSubAgent: K,
174
- onImproveToolInstructions: G
175
+ onImproveToolInstructions: a
175
176
  }),
176
177
  [
177
- t,
178
+ s,
178
179
  ot,
179
180
  nt,
180
181
  et,
181
182
  rt,
182
- U,
183
+ N,
183
184
  C,
184
185
  z,
185
186
  D,
186
187
  O,
187
188
  ct,
188
189
  it,
189
- x,
190
+ T,
190
191
  i,
191
192
  l,
192
193
  tt,
193
194
  st,
194
- S,
195
- f,
196
195
  p,
196
+ x,
197
+ R,
197
198
  P,
198
199
  E,
199
200
  $,
200
201
  w,
201
202
  H,
202
- V,
203
- T,
203
+ L,
204
+ _,
205
+ b,
204
206
  j,
205
- q,
206
207
  Q,
207
208
  W,
208
209
  Z,
209
210
  k,
211
+ q,
210
212
  y,
211
- I,
212
213
  K,
213
- G
214
+ a
214
215
  ]
215
216
  );
216
- return /* @__PURE__ */ pt(ut.Provider, { value: mt, children: lt });
217
+ return /* @__PURE__ */ pt(ut.Provider, { value: ft, children: lt });
217
218
  };
218
219
  export {
219
220
  Pt as AgentBuilderProvider,