@bikdotai/bik-component-library 0.0.849-beta.2 → 0.0.849

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 (75) 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 +28 -16
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +2 -2
  6. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
  8. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
  10. package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/MentionPicker.js +11 -11
  12. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +1 -1
  16. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  18. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  20. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  22. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  23. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +4 -4
  24. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  25. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  26. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  27. package/dist/cjs/editor/BikEditor.styles.js +0 -6
  28. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  29. package/dist/cjs/icons/Informational/Common UI/ShieldOutline.js +2 -0
  30. package/dist/cjs/icons/Informational/Common UI/ShieldOutline.js.map +1 -0
  31. package/dist/cjs/icons/index.js +1 -1
  32. package/dist/esm/components/agent-builder/AgentBuilder.js +69 -71
  33. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  34. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +0 -8
  35. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +3 -0
  36. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +46 -33
  37. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  38. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +0 -3
  39. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +110 -113
  40. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  41. package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +0 -7
  42. package/dist/esm/components/agent-builder/components/MentionEditor.js +74 -89
  43. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  44. package/dist/esm/components/agent-builder/components/MentionField.js +26 -28
  45. package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
  46. package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +1 -14
  47. package/dist/esm/components/agent-builder/components/MentionPicker.js +138 -167
  48. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  49. package/dist/esm/components/agent-builder/components/RequireVerificationModal.js +5 -5
  50. package/dist/esm/components/agent-builder/components/RequireVerificationModal.js.map +1 -1
  51. package/dist/esm/components/agent-builder/components/SelectableListSection.js +72 -63
  52. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  53. package/dist/esm/components/agent-builder/constants/tools.d.ts +1 -1
  54. package/dist/esm/components/agent-builder/constants/tools.js +5 -6
  55. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  56. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +0 -7
  57. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +96 -99
  58. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  59. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +174 -165
  60. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  61. package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +4 -14
  62. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +38 -50
  63. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  64. package/dist/esm/components/agent-listing/AgentTableRow.js +1 -1
  65. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  66. package/dist/esm/editor/BikEditor.styles.js +0 -6
  67. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  68. package/dist/esm/icons/Informational/Common UI/ShieldOutline.d.ts +7 -0
  69. package/dist/esm/icons/Informational/Common UI/ShieldOutline.js +35 -0
  70. package/dist/esm/icons/Informational/Common UI/ShieldOutline.js.map +1 -0
  71. package/dist/esm/icons/Informational/Common UI/index.d.ts +1 -0
  72. package/dist/esm/icons/index.d.ts +25 -25
  73. package/dist/esm/icons/index.js +172 -170
  74. package/dist/esm/icons/index.js.map +1 -1
  75. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MentionEditor.js","sources":["../../../../../src/components/agent-builder/components/MentionEditor.tsx"],"sourcesContent":["import { BikEditor, BikEditorRef, MentionItem } from '@src/editor';\nimport React, {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type {\n\tVariableListInterfaceV3,\n\tVariableV3,\n} from '../../variable-picker-v3/model';\nimport { AgentTool } from '../AgentBuilder.model';\nimport {\n\tAiTextAreaShell,\n\tFieldBlock,\n\tFieldLabelRow,\n} from '../AgentBuilder.styled';\nimport { AGENT_EDITOR_STYLE } from '../constants/editorStyle';\nimport type { ToolAction, ToolSource } from '../constants/tools';\nimport {\n\tbuildMentionHtml,\n\tbuildVariableMentionItems,\n\teditorDocToInstructions,\n\tinstructionsToEditorHtml,\n\tMentionKindMeta,\n\tvariableTokenName,\n} from '../utils/mentionSerialization';\nimport { MentionPicker } from './MentionPicker';\n\ntype InsertFn = (kind: 'tool' | 'subagent', id: string, label?: string) => void;\n\ninterface MentionEditorProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: (text: string) => void;\n\tmaxLength: number;\n\tplaceholder?: string;\n\tminHeight?: string;\n\t/** Changing this remounts the editor with fresh content. */\n\tresetKey?: string | number;\n\t/** Items shown in the `@` picker (tools, and sub-agents where allowed). */\n\tmentionItems: MentionItem[];\n\t/** Tools used to serialise mention nodes back to `{{tool:KEY}}`. */\n\ttools: AgentTool[];\n\t/** Called when an item is picked from the `@` menu (to attach it upstream). */\n\tonMentionSelect?: (kind: 'tool' | 'subagent', id: string) => void;\n\tonFocus?: () => void;\n\t/** Receives an insert-at-cursor fn (and null on unmount) for side-panel adds. */\n\tregisterInsert?: (fn: InsertFn | null) => void;\n\t/**\n\t * When set, the `@` picker's Sub-agent view shows a \"Create new\" row that calls\n\t * this (opens the create-sub-agent drawer). Omit to hide it (e.g. the drawer's\n\t * own editors, which can't nest sub-agents).\n\t */\n\tonCreateSubAgent?: () => void;\n\t/**\n\t * Built-in tool actions (Rest API / Handover to email) shown in the `@` picker's\n\t * Tools view. Picking one opens its drawer instead of inserting a mention.\n\t */\n\ttoolActions?: ToolAction[];\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\tonConnectIntegration?: (source: ToolSource) => void;\n\t/**\n\t * Variable catalog for the `@` picker's \"Variables\" view. Picking one inserts\n\t * a `Variable: <name>` mention chip at the cursor, persisted as a\n\t * `{{variable:<name>}}` token. Omit to hide the category.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n\t/** Optional action(s) rendered inside the shell, below the editor. */\n\taction?: React.ReactNode;\n\t'data-test'?: string;\n}\n\n/**\n * Presentational BikEditor field with `@` mentions. Stores firebase token text\n * (`{{tool:KEY}}` / `{{subagent:ID}}`). Context-free — both the builder's\n * Step-3 fields and the create-sub-agent drawer compose it.\n */\nexport const MentionEditor: React.FC<MentionEditorProps> = ({\n\tlabel,\n\tvalue,\n\tonChange,\n\tmaxLength,\n\tplaceholder,\n\tminHeight = '200px',\n\tresetKey,\n\tmentionItems,\n\ttools,\n\tonMentionSelect,\n\tonFocus,\n\tregisterInsert,\n\tonCreateSubAgent,\n\ttoolActions,\n\tintegrationStatus,\n\tonConnectIntegration,\n\tvariablesData,\n\taction,\n\t...rest\n}) => {\n\tconst editorRef = useRef<BikEditorRef>(null);\n\tconst [count, setCount] = useState(value.length);\n\n\t// The picker dismissed itself already (stripping the \"@\" + query) — drop a\n\t// `Variable: <name>` mention chip at the cursor, same shape as tool /\n\t// sub-agent chips. `editorDocToInstructions` serializes it back to a\n\t// `{{variable:<name>}}` token.\n\tconst onSelectVariable = useCallback((variable: VariableV3) => {\n\t\tconst name = variableTokenName(variable.actualValue);\n\t\teditorRef.current?.insertInlineContent(\n\t\t\t`${buildMentionHtml(\n\t\t\t\tname,\n\t\t\t\t`Variable: ${variable.displayName}`,\n\t\t\t\t'variable',\n\t\t\t)}&nbsp;`,\n\t\t);\n\t}, []);\n\n\tconst insert = useCallback<InsertFn>(\n\t\t(kind, id, overrideLabel) => {\n\t\t\tconst editor = editorRef.current;\n\t\t\tif (!editor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst item = mentionItems.find(\n\t\t\t\t(m) =>\n\t\t\t\t\tString(m.id) === String(id) &&\n\t\t\t\t\t(m.meta as unknown as MentionKindMeta | undefined)?.kind === kind,\n\t\t\t);\n\t\t\tconst finalLabel = overrideLabel ?? item?.label ?? id;\n\t\t\teditor.insertInlineContent(\n\t\t\t\t`${buildMentionHtml(String(id), finalLabel, kind)}&nbsp;`,\n\t\t\t);\n\t\t},\n\t\t[mentionItems],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!registerInsert) {\n\t\t\treturn;\n\t\t}\n\t\tregisterInsert(insert);\n\t\treturn () => registerInsert(null);\n\t}, [registerInsert, insert]);\n\n\t// Mount-only initial HTML; recomputed (editor remounted via key) on resetKey.\n\t// Variable items are merged in so stored `{{name}}` tokens rehydrate as chips.\n\tconst initialHtml = useMemo(\n\t\t() =>\n\t\t\tinstructionsToEditorHtml(value, [\n\t\t\t\t...mentionItems,\n\t\t\t\t...buildVariableMentionItems(variablesData),\n\t\t\t]),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\tuseEffect(\n\t\t() => setCount(value.length),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\treturn (\n\t\t<FieldBlock>\n\t\t\t<FieldLabelRow>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t{count}/{maxLength}\n\t\t\t\t</BodyCaption>\n\t\t\t</FieldLabelRow>\n\n\t\t\t<AiTextAreaShell minHeight={minHeight} data-test={rest['data-test']}>\n\t\t\t\t<BikEditor\n\t\t\t\t\tkey={resetKey}\n\t\t\t\t\tref={editorRef}\n\t\t\t\t\tinitialContent={initialHtml}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t// Soft limit: blocks typing past the cap but lets a paste through\n\t\t\t\t\t// (overflow rendered grey) instead of rejecting the whole paste.\n\t\t\t\t\tcharacterLimit={maxLength}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"320px\"\n\t\t\t\t\tstyle={{ border: 'none' }}\n\t\t\t\t\teditorStyle={AGENT_EDITOR_STYLE}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tmentions={{\n\t\t\t\t\t\tagents: mentionItems,\n\t\t\t\t\t\tremoveTriggerOnDismiss: true,\n\t\t\t\t\t\trenderDropdown: (props) => (\n\t\t\t\t\t\t\t<MentionPicker\n\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\tonCreateSubAgent={onCreateSubAgent}\n\t\t\t\t\t\t\t\ttoolActions={toolActions}\n\t\t\t\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\t\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\t\t\tonSelectVariable={onSelectVariable}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tonSelect: (item) => {\n\t\t\t\t\t\t\tconst kind = (item.meta as unknown as MentionKindMeta | undefined)\n\t\t\t\t\t\t\t\t?.kind;\n\t\t\t\t\t\t\t// Variables never come through this path (they use the embedded\n\t\t\t\t\t\t\t// picker's onSelectVariable) and have nothing to attach upstream.\n\t\t\t\t\t\t\tif (kind === 'tool' || kind === 'subagent') {\n\t\t\t\t\t\t\t\tonMentionSelect?.(kind, String(item.id));\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\tonChange={(snapshot) => {\n\t\t\t\t\t\tsetCount(snapshot.characterCount);\n\t\t\t\t\t\tconst doc = editorRef.current?.getJSON() ?? null;\n\t\t\t\t\t\tonChange(editorDocToInstructions(doc, tools));\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t{action}\n\t\t\t</AiTextAreaShell>\n\t\t</FieldBlock>\n\t);\n};\n"],"names":["MentionEditor","label","value","onChange","maxLength","placeholder","minHeight","resetKey","mentionItems","tools","onMentionSelect","onFocus","registerInsert","onCreateSubAgent","toolActions","integrationStatus","onConnectIntegration","variablesData","action","rest","editorRef","useRef","count","setCount","useState","onSelectVariable","useCallback","variable","name","variableTokenName","buildMentionHtml","insert","kind","id","overrideLabel","editor","item","m","finalLabel","useEffect","initialHtml","useMemo","instructionsToEditorHtml","buildVariableMentionItems","FieldBlock","jsxs","FieldLabelRow","jsx","TitleSmall","COLORS","BodyCaption","AiTextAreaShell","BikEditor","AGENT_EDITOR_STYLE","props","MentionPicker","snapshot","doc","editorDocToInstructions"],"mappings":"+ZAiFaA,EAA8C,CAAC,CAC3D,MAAAC,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,UAAAC,EAAY,QACZ,SAAAC,EACA,aAAAC,EACA,MAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,qBAAAC,EACA,cAAAC,EACA,OAAAC,EACA,GAAGC,CACJ,IAAM,CACL,MAAMC,EAAYC,EAAAA,OAAqB,IAAI,EACrC,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAStB,EAAM,MAAM,EAMzCuB,EAAmBC,cAAaC,GAAyB,CAC9D,MAAMC,EAAOC,EAAAA,kBAAkBF,EAAS,WAAW,EACnDP,EAAU,SAAS,oBAClB,GAAGU,EAAAA,iBACFF,EACA,aAAaD,EAAS,WAAW,GACjC,UAAA,CACA,QAAA,CAEH,EAAG,CAAA,CAAE,EAECI,EAASL,EAAAA,YACd,CAACM,EAAMC,EAAIC,IAAkB,CAC5B,MAAMC,EAASf,EAAU,QACzB,GAAI,CAACe,EACJ,OAED,MAAMC,EAAO5B,EAAa,KACxB6B,GACA,OAAOA,EAAE,EAAE,IAAM,OAAOJ,CAAE,GACzBI,EAAE,MAAiD,OAASL,CAAA,EAEzDM,EAAaJ,GAAiBE,GAAM,OAASH,EACnDE,EAAO,oBACN,GAAGL,EAAAA,iBAAiB,OAAOG,CAAE,EAAGK,EAAYN,CAAI,CAAC,QAAA,CAE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,EAAK,EAAE,CAAC,CAEzC,CAAA,EAED,SAAWoB,GAAa,CACvBjC,EAASiC,EAAS,cAAc,EAChC,MAAMC,EAAMrC,EAAU,SAAS,QAAA,GAAa,KAC5CjB,EAASuD,EAAAA,wBAAwBD,EAAKhD,CAAK,CAAC,CAC7C,CAAA,EAxCKF,CAAA,EA0CLW,CAAA,CAAA,CACF,CAAA,EACD,CAEF"}
1
+ {"version":3,"file":"MentionEditor.js","sources":["../../../../../src/components/agent-builder/components/MentionEditor.tsx"],"sourcesContent":["import { BikEditor, BikEditorRef, MentionItem } from '@src/editor';\nimport React, {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentTool } from '../AgentBuilder.model';\nimport {\n\tAiTextAreaShell,\n\tFieldBlock,\n\tFieldLabelRow,\n} from '../AgentBuilder.styled';\nimport { AGENT_EDITOR_STYLE } from '../constants/editorStyle';\nimport type { ToolAction, ToolSource } from '../constants/tools';\nimport {\n\tbuildMentionHtml,\n\teditorDocToInstructions,\n\tinstructionsToEditorHtml,\n\tMentionKindMeta,\n} from '../utils/mentionSerialization';\nimport { MentionPicker } from './MentionPicker';\n\ntype InsertFn = (kind: 'tool' | 'subagent', id: string, label?: string) => void;\n\ninterface MentionEditorProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: (text: string) => void;\n\tmaxLength: number;\n\tplaceholder?: string;\n\tminHeight?: string;\n\t/** Changing this remounts the editor with fresh content. */\n\tresetKey?: string | number;\n\t/** Items shown in the `@` picker (tools, and sub-agents where allowed). */\n\tmentionItems: MentionItem[];\n\t/** Tools used to serialise mention nodes back to `{{tool:KEY}}`. */\n\ttools: AgentTool[];\n\t/** Called when an item is picked from the `@` menu (to attach it upstream). */\n\tonMentionSelect?: (kind: 'tool' | 'subagent', id: string) => void;\n\tonFocus?: () => void;\n\t/** Receives an insert-at-cursor fn (and null on unmount) for side-panel adds. */\n\tregisterInsert?: (fn: InsertFn | null) => void;\n\t/**\n\t * When set, the `@` picker's Sub-agent view shows a \"Create new\" row that calls\n\t * this (opens the create-sub-agent drawer). Omit to hide it (e.g. the drawer's\n\t * own editors, which can't nest sub-agents).\n\t */\n\tonCreateSubAgent?: () => void;\n\t/**\n\t * Built-in tool actions (Rest API / Handover to email) shown in the `@` picker's\n\t * Tools view. Picking one opens its drawer instead of inserting a mention.\n\t */\n\ttoolActions?: ToolAction[];\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\tonConnectIntegration?: (source: ToolSource) => void;\n\t/** Optional action(s) rendered inside the shell, below the editor. */\n\taction?: React.ReactNode;\n\t'data-test'?: string;\n}\n\n/**\n * Presentational BikEditor field with `@` mentions. Stores firebase token text\n * (`{{tool:KEY}}` / `{{subagent:ID}}`). Context-free — both the builder's\n * Step-3 fields and the create-sub-agent drawer compose it.\n */\nexport const MentionEditor: React.FC<MentionEditorProps> = ({\n\tlabel,\n\tvalue,\n\tonChange,\n\tmaxLength,\n\tplaceholder,\n\tminHeight = '200px',\n\tresetKey,\n\tmentionItems,\n\ttools,\n\tonMentionSelect,\n\tonFocus,\n\tregisterInsert,\n\tonCreateSubAgent,\n\ttoolActions,\n\tintegrationStatus,\n\tonConnectIntegration,\n\taction,\n\t...rest\n}) => {\n\tconst editorRef = useRef<BikEditorRef>(null);\n\tconst [count, setCount] = useState(value.length);\n\n\tconst insert = useCallback<InsertFn>(\n\t\t(kind, id, overrideLabel) => {\n\t\t\tconst editor = editorRef.current;\n\t\t\tif (!editor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst item = mentionItems.find(\n\t\t\t\t(m) =>\n\t\t\t\t\tString(m.id) === String(id) &&\n\t\t\t\t\t(m.meta as unknown as MentionKindMeta | undefined)?.kind === kind,\n\t\t\t);\n\t\t\tconst finalLabel = overrideLabel ?? item?.label ?? id;\n\t\t\teditor.insertInlineContent(\n\t\t\t\t`${buildMentionHtml(String(id), finalLabel, kind)}&nbsp;`,\n\t\t\t);\n\t\t},\n\t\t[mentionItems],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!registerInsert) {\n\t\t\treturn;\n\t\t}\n\t\tregisterInsert(insert);\n\t\treturn () => registerInsert(null);\n\t}, [registerInsert, insert]);\n\n\t// Mount-only initial HTML; recomputed (editor remounted via key) on resetKey.\n\tconst initialHtml = useMemo(\n\t\t() => instructionsToEditorHtml(value, mentionItems),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\tuseEffect(\n\t\t() => setCount(value.length),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\treturn (\n\t\t<FieldBlock>\n\t\t\t<FieldLabelRow>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t{count}/{maxLength}\n\t\t\t\t</BodyCaption>\n\t\t\t</FieldLabelRow>\n\n\t\t\t<AiTextAreaShell minHeight={minHeight} data-test={rest['data-test']}>\n\t\t\t\t<BikEditor\n\t\t\t\t\tkey={resetKey}\n\t\t\t\t\tref={editorRef}\n\t\t\t\t\tinitialContent={initialHtml}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t// Soft limit: blocks typing past the cap but lets a paste through\n\t\t\t\t\t// (overflow rendered grey) instead of rejecting the whole paste.\n\t\t\t\t\tcharacterLimit={maxLength}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"320px\"\n\t\t\t\t\tstyle={{ border: 'none' }}\n\t\t\t\t\teditorStyle={AGENT_EDITOR_STYLE}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tmentions={{\n\t\t\t\t\t\tagents: mentionItems,\n\t\t\t\t\t\tremoveTriggerOnDismiss: true,\n\t\t\t\t\t\trenderDropdown: (props) => (\n\t\t\t\t\t\t\t<MentionPicker\n\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\tonCreateSubAgent={onCreateSubAgent}\n\t\t\t\t\t\t\t\ttoolActions={toolActions}\n\t\t\t\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\t\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tonSelect: (item) => {\n\t\t\t\t\t\t\tconst kind = (item.meta as unknown as MentionKindMeta | undefined)\n\t\t\t\t\t\t\t\t?.kind;\n\t\t\t\t\t\t\tif (kind) {\n\t\t\t\t\t\t\t\tonMentionSelect?.(kind, String(item.id));\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\tonChange={(snapshot) => {\n\t\t\t\t\t\tsetCount(snapshot.characterCount);\n\t\t\t\t\t\tconst doc = editorRef.current?.getJSON() ?? null;\n\t\t\t\t\t\tonChange(editorDocToInstructions(doc, tools));\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t{action}\n\t\t\t</AiTextAreaShell>\n\t\t</FieldBlock>\n\t);\n};\n"],"names":["MentionEditor","label","value","onChange","maxLength","placeholder","minHeight","resetKey","mentionItems","tools","onMentionSelect","onFocus","registerInsert","onCreateSubAgent","toolActions","integrationStatus","onConnectIntegration","action","rest","editorRef","useRef","count","setCount","useState","insert","useCallback","kind","id","overrideLabel","editor","item","m","finalLabel","buildMentionHtml","useEffect","initialHtml","useMemo","instructionsToEditorHtml","FieldBlock","jsxs","FieldLabelRow","jsx","TitleSmall","COLORS","BodyCaption","AiTextAreaShell","BikEditor","AGENT_EDITOR_STYLE","props","MentionPicker","snapshot","doc","editorDocToInstructions"],"mappings":"+ZAqEaA,EAA8C,CAAC,CAC3D,MAAAC,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,UAAAC,EAAY,QACZ,SAAAC,EACA,aAAAC,EACA,MAA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YAAWY,EAAK,WAAW,EACjE,SAAA,CAAAuB,EAAAA,IAACK,EAAAA,UAAA,CAEA,IAAK3B,EACL,eAAgBgB,EAChB,YAAA9B,EAGA,eAAgBD,EAChB,UAAU,QACV,UAAU,QACV,MAAO,CAAE,OAAQ,MAAA,EACjB,YAAa2C,EAAAA,mBACb,QAAApC,EACA,SAAU,CACT,OAAQH,EACR,uBAAwB,GACxB,eAAiBwC,GAChBP,EAAAA,IAACQ,EAAAA,cAAA,CACC,GAAGD,EACJ,iBAAAnC,EACA,YAAAC,EACA,kBAAAC,EACA,qBAAAC,CAAA,CAAA,EAGF,SAAWc,GAAS,CACnB,MAAMJ,EAAQI,EAAK,MAChB,KACCJ,GACHhB,IAAkBgB,EAAM,OAAOI,EAAK,EAAE,CAAC,CAEzC,CAAA,EAED,SAAWoB,GAAa,CACvB5B,EAAS4B,EAAS,cAAc,EAChC,MAAMC,EAAMhC,EAAU,SAAS,QAAA,GAAa,KAC5ChB,EAASiD,EAAAA,wBAAwBD,EAAK1C,CAAK,CAAC,CAC7C,CAAA,EApCKF,CAAA,EAsCLU,CAAA,CAAA,CACF,CAAA,EACD,CAEF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react/jsx-runtime"),n=require("react"),y=require("../context/AgentBuilderContext.js"),a=require("../utils/mentionSerialization.js"),B=require("../utils/toolActions.js"),E=require("./MentionEditor.js"),f=({fieldKey:e,label:d,placeholder:T,maxLength:m,minHeight:M,...p})=>{const{value:t,patch:C,addReference:l,availableTools:i,availableSubAgents:u,applicationType:c,mentionResetKey:S,registerMentionField:g,notifyMentionFocus:q,onCreateSubAgent:v,requestCreateSubAgent:F,requestToolAction:b,configToolTemplates:A,integrationStatus:s,onConnectIntegration:r,variablesData:I}=y.useAgentBuilderContext(),x=n.useMemo(()=>[...a.buildAgentMentionItems(i,u,a.appTypeLabel(c)),...a.buildCustomToolMentionItems(t.configTools,t.restApiTools)],[i,u,c,t.configTools,t.restApiTools]),R=n.useMemo(()=>B.buildToolActions(A,b,s,r),[b,A,s,r]),$=n.useCallback(o=>g(e,o),[g,e]),j=n.useCallback((o,h)=>l(o,h),[l]);return k.jsx(E.MentionEditor,{label:d,value:t[e]??"",onChange:o=>C({[e]:o}),maxLength:m,placeholder:T,minHeight:M,resetKey:`${t.id}:${e}:${S}`,mentionItems:x,tools:i,onMentionSelect:j,onFocus:()=>q(e),registerInsert:$,onCreateSubAgent:v?F:void 0,toolActions:R,integrationStatus:s,onConnectIntegration:r,variablesData:I,"data-test":p["data-test"]})};exports.MentionField=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),n=require("react"),k=require("../context/AgentBuilderContext.js"),a=require("../utils/mentionSerialization.js"),y=require("../utils/toolActions.js"),B=require("./MentionEditor.js"),E=({fieldKey:e,label:d,placeholder:T,maxLength:m,minHeight:M,...p})=>{const{value:t,patch:C,addReference:l,availableTools:i,availableSubAgents:u,applicationType:c,mentionResetKey:S,registerMentionField:g,notifyMentionFocus:q,onCreateSubAgent:v,requestCreateSubAgent:F,requestToolAction:b,configToolTemplates:A,integrationStatus:s,onConnectIntegration:r}=k.useAgentBuilderContext(),I=n.useMemo(()=>[...a.buildAgentMentionItems(i,u,a.appTypeLabel(c)),...a.buildCustomToolMentionItems(t.configTools,t.restApiTools)],[i,u,c,t.configTools,t.restApiTools]),x=n.useMemo(()=>y.buildToolActions(A,b,s,r),[b,A,s,r]),R=n.useCallback(o=>g(e,o),[g,e]),$=n.useCallback((o,j)=>l(o,j),[l]);return h.jsx(B.MentionEditor,{label:d,value:t[e]??"",onChange:o=>C({[e]:o}),maxLength:m,placeholder:T,minHeight:M,resetKey:`${t.id}:${e}:${S}`,mentionItems:I,tools:i,onMentionSelect:$,onFocus:()=>q(e),registerInsert:R,onCreateSubAgent:v?F:void 0,toolActions:x,integrationStatus:s,onConnectIntegration:r,"data-test":p["data-test"]})};exports.MentionField=E;
2
2
  //# sourceMappingURL=MentionField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MentionField.js","sources":["../../../../../src/components/agent-builder/components/MentionField.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { AgentValue } from '../AgentBuilder.model';\nimport { ToolAction } from '../constants/tools';\nimport {\n\tMentionFieldKey,\n\tuseAgentBuilderContext,\n} from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\tbuildCustomToolMentionItems,\n} from '../utils/mentionSerialization';\nimport { buildToolActions } from '../utils/toolActions';\nimport { MentionEditor } from './MentionEditor';\n\ninterface MentionFieldProps {\n\t/** Which AgentValue field this editor reads / writes. */\n\tfieldKey: MentionFieldKey;\n\tlabel: string;\n\tplaceholder?: string;\n\tmaxLength: number;\n\tminHeight?: string;\n\t'data-test'?: string;\n}\n\n/**\n * Context-bound {@link MentionEditor} for the builder's Step-3 Instructions /\n * Guardrails. Both `@` tools and sub-agents are offered; the field registers its\n * insert + focus with the context so side-panel adds drop a chip into whichever\n * field was last focused, and remounts on `mentionResetKey`.\n */\nexport const MentionField: React.FC<MentionFieldProps> = ({\n\tfieldKey,\n\tlabel,\n\tplaceholder,\n\tmaxLength,\n\tminHeight,\n\t...rest\n}) => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\taddReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tapplicationType,\n\t\tmentionResetKey,\n\t\tregisterMentionField,\n\t\tnotifyMentionFocus,\n\t\tonCreateSubAgent,\n\t\trequestCreateSubAgent,\n\t\trequestToolAction,\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t\tvariablesData,\n\t} = useAgentBuilderContext();\n\n\t// Catalog tools + sub-agents, PLUS the inline custom tools (Rest API / email /\n\t// Slack) so their `{{tool:<id>}}` tokens rehydrate as chips on remount — they\n\t// live on the value, not in `availableTools`.\n\tconst mentionItems = useMemo(\n\t\t() => [\n\t\t\t...buildAgentMentionItems(\n\t\t\t\tavailableTools,\n\t\t\t\tavailableSubAgents,\n\t\t\t\tappTypeLabel(applicationType),\n\t\t\t),\n\t\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t\t],\n\t\t[\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tapplicationType,\n\t\t\tvalue.configTools,\n\t\t\tvalue.restApiTools,\n\t\t],\n\t);\n\n\t// Built-in tool actions (Rest API / email / Slack) shown in the `@` picker's\n\t// Tools view — picking one opens its drawer (Step 3) instead of inserting text.\n\t// The shared email / Slack forms are backend-driven: each is offered only when\n\t// its template was provided.\n\tconst toolActions = useMemo<ToolAction[]>(\n\t\t() =>\n\t\t\tbuildToolActions(\n\t\t\t\tconfigToolTemplates,\n\t\t\t\trequestToolAction,\n\t\t\t\tintegrationStatus,\n\t\t\t\tonConnectIntegration,\n\t\t\t),\n\t\t[\n\t\t\trequestToolAction,\n\t\t\tconfigToolTemplates,\n\t\t\tintegrationStatus,\n\t\t\tonConnectIntegration,\n\t\t],\n\t);\n\n\tconst registerInsert = useCallback(\n\t\t(fn: Parameters<typeof registerMentionField>[1]) =>\n\t\t\tregisterMentionField(fieldKey, fn),\n\t\t[registerMentionField, fieldKey],\n\t);\n\n\t// Route through the context's ref-backed `addReference`: BikEditor captures\n\t// this handler at mount, so reading `value.tools` here would keep only the last\n\t// pick. `addReference` always appends against the latest lists.\n\tconst onMentionSelect = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => addReference(kind, id),\n\t\t[addReference],\n\t);\n\n\treturn (\n\t\t<MentionEditor\n\t\t\tlabel={label}\n\t\t\tvalue={(value[fieldKey] as string | undefined) ?? ''}\n\t\t\tonChange={(text) => patch({ [fieldKey]: text } as Partial<AgentValue>)}\n\t\t\tmaxLength={maxLength}\n\t\t\tplaceholder={placeholder}\n\t\t\tminHeight={minHeight}\n\t\t\tresetKey={`${value.id}:${fieldKey}:${mentionResetKey}`}\n\t\t\tmentionItems={mentionItems}\n\t\t\ttools={availableTools}\n\t\t\tonMentionSelect={onMentionSelect}\n\t\t\tonFocus={() => notifyMentionFocus(fieldKey)}\n\t\t\tregisterInsert={registerInsert}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? requestCreateSubAgent : undefined}\n\t\t\ttoolActions={toolActions}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvariablesData={variablesData}\n\t\t\tdata-test={rest['data-test']}\n\t\t/>\n\t);\n};\n"],"names":["MentionField","fieldKey","label","placeholder","maxLength","minHeight","rest","value","patch","addReference","availableTools","availableSubAgents","applicationType","mentionResetKey","registerMentionField","notifyMentionFocus","onCreateSubAgent","requestCreateSubAgent","requestToolAction","configToolTemplates","integrationStatus","onConnectIntegration","variablesData","useAgentBuilderContext","mentionItems","useMemo","buildAgentMentionItems","appTypeLabel","buildCustomToolMentionItems","toolActions","buildToolActions","registerInsert","useCallback","fn","onMentionSelect","kind","id","jsx","MentionEditor","text"],"mappings":"0SA+BaA,EAA4C,CAAC,CACzD,SAAAC,EACA,MAAAC,EACA,YAAAC,EACA,UAAAC,EACA,UAAAC,EACA,GAAGC,CACJ,IAAM,CACL,KAAM,CACL,MAAAC,EACA,MAAAC,EACA,aAAAC,EACA,eAAAC,EACA,mBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,qBAAAC,EACA,mBAAAC,EACA,iBAAAC,EACA,sBAAAC,EACA,kBAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,qBAAAC,EACA,cAAAC,CAAA,EACGC,yBAAA,EAKEC,EAAeC,EAAAA,QACpB,IAAM,CACL,GAAGC,EAAAA,uBACFhB,EACAC,EACAgB,EAAAA,aAAaf,CAAe,CAAA,EAE7B,GAAGgB,8BAA4BrB,EAAM,YAAaA,EAAM,YAAY,CAAA,EAErE,CACCG,EACAC,EACAC,EACAL,EAAM,YACNA,EAAM,YAAA,CACP,EAOKsB,EAAcJ,EAAAA,QACnB,IACCK,EAAAA,iBACCX,EACAD,EACAE,EACAC,CAAA,EAEF,CACCH,EACAC,EACAC,EACAC,CAAA,CACD,EAGKU,EAAiBC,EAAAA,YACrBC,GACAnB,EAAqBb,EAAUgC,CAAE,EAClC,CAACnB,EAAsBb,CAAQ,CAAA,EAM1BiC,EAAkBF,EAAAA,YACvB,CAACG,EAA2BC,IAAe3B,EAAa0B,EAAMC,CAAE,EAChE,CAAC3B,CAAY,CAAA,EAGd,OACC4B,EAAAA,IAACC,EAAAA,cAAA,CACA,MAAApC,EACA,MAAQK,EAAMN,CAAQ,GAA4B,GAClD,SAAWsC,GAAS/B,EAAM,CAAE,CAACP,CAAQ,EAAGsC,EAA6B,EACrE,UAAAnC,EACA,YAAAD,EACA,UAAAE,EACA,SAAU,GAAGE,EAAM,EAAE,IAAIN,CAAQ,IAAIY,CAAe,GACpD,aAAAW,EACA,MAAOd,EACP,gBAAAwB,EACA,QAAS,IAAMnB,EAAmBd,CAAQ,EAC1C,eAAA8B,EACA,iBAAkBf,EAAmBC,EAAwB,OAAA,YAC7DY,EACA,kBAAAT,EACA,qBAAAC,EACA,cAAAC,EACA,YAAWhB,EAAK,WAAW,CAAA,CAAA,CAG9B"}
1
+ {"version":3,"file":"MentionField.js","sources":["../../../../../src/components/agent-builder/components/MentionField.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { AgentValue } from '../AgentBuilder.model';\nimport { ToolAction } from '../constants/tools';\nimport {\n\tMentionFieldKey,\n\tuseAgentBuilderContext,\n} from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\tbuildCustomToolMentionItems,\n} from '../utils/mentionSerialization';\nimport { buildToolActions } from '../utils/toolActions';\nimport { MentionEditor } from './MentionEditor';\n\ninterface MentionFieldProps {\n\t/** Which AgentValue field this editor reads / writes. */\n\tfieldKey: MentionFieldKey;\n\tlabel: string;\n\tplaceholder?: string;\n\tmaxLength: number;\n\tminHeight?: string;\n\t'data-test'?: string;\n}\n\n/**\n * Context-bound {@link MentionEditor} for the builder's Step-3 Instructions /\n * Guardrails. Both `@` tools and sub-agents are offered; the field registers its\n * insert + focus with the context so side-panel adds drop a chip into whichever\n * field was last focused, and remounts on `mentionResetKey`.\n */\nexport const MentionField: React.FC<MentionFieldProps> = ({\n\tfieldKey,\n\tlabel,\n\tplaceholder,\n\tmaxLength,\n\tminHeight,\n\t...rest\n}) => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\taddReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tapplicationType,\n\t\tmentionResetKey,\n\t\tregisterMentionField,\n\t\tnotifyMentionFocus,\n\t\tonCreateSubAgent,\n\t\trequestCreateSubAgent,\n\t\trequestToolAction,\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t} = useAgentBuilderContext();\n\n\t// Catalog tools + sub-agents, PLUS the inline custom tools (Rest API / email /\n\t// Slack) so their `{{tool:<id>}}` tokens rehydrate as chips on remount — they\n\t// live on the value, not in `availableTools`.\n\tconst mentionItems = useMemo(\n\t\t() => [\n\t\t\t...buildAgentMentionItems(\n\t\t\t\tavailableTools,\n\t\t\t\tavailableSubAgents,\n\t\t\t\tappTypeLabel(applicationType),\n\t\t\t),\n\t\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t\t],\n\t\t[\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tapplicationType,\n\t\t\tvalue.configTools,\n\t\t\tvalue.restApiTools,\n\t\t],\n\t);\n\n\t// Built-in tool actions (Rest API / email / Slack) shown in the `@` picker's\n\t// Tools view — picking one opens its drawer (Step 3) instead of inserting text.\n\t// The shared email / Slack forms are backend-driven: each is offered only when\n\t// its template was provided.\n\tconst toolActions = useMemo<ToolAction[]>(\n\t\t() =>\n\t\t\tbuildToolActions(\n\t\t\t\tconfigToolTemplates,\n\t\t\t\trequestToolAction,\n\t\t\t\tintegrationStatus,\n\t\t\t\tonConnectIntegration,\n\t\t\t),\n\t\t[\n\t\t\trequestToolAction,\n\t\t\tconfigToolTemplates,\n\t\t\tintegrationStatus,\n\t\t\tonConnectIntegration,\n\t\t],\n\t);\n\n\tconst registerInsert = useCallback(\n\t\t(fn: Parameters<typeof registerMentionField>[1]) =>\n\t\t\tregisterMentionField(fieldKey, fn),\n\t\t[registerMentionField, fieldKey],\n\t);\n\n\t// Route through the context's ref-backed `addReference`: BikEditor captures\n\t// this handler at mount, so reading `value.tools` here would keep only the last\n\t// pick. `addReference` always appends against the latest lists.\n\tconst onMentionSelect = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => addReference(kind, id),\n\t\t[addReference],\n\t);\n\n\treturn (\n\t\t<MentionEditor\n\t\t\tlabel={label}\n\t\t\tvalue={(value[fieldKey] as string | undefined) ?? ''}\n\t\t\tonChange={(text) => patch({ [fieldKey]: text } as Partial<AgentValue>)}\n\t\t\tmaxLength={maxLength}\n\t\t\tplaceholder={placeholder}\n\t\t\tminHeight={minHeight}\n\t\t\tresetKey={`${value.id}:${fieldKey}:${mentionResetKey}`}\n\t\t\tmentionItems={mentionItems}\n\t\t\ttools={availableTools}\n\t\t\tonMentionSelect={onMentionSelect}\n\t\t\tonFocus={() => notifyMentionFocus(fieldKey)}\n\t\t\tregisterInsert={registerInsert}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? requestCreateSubAgent : undefined}\n\t\t\ttoolActions={toolActions}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tdata-test={rest['data-test']}\n\t\t/>\n\t);\n};\n"],"names":["MentionField","fieldKey","label","placeholder","maxLength","minHeight","rest","value","patch","addReference","availableTools","availableSubAgents","applicationType","mentionResetKey","registerMentionField","notifyMentionFocus","onCreateSubAgent","requestCreateSubAgent","requestToolAction","configToolTemplates","integrationStatus","onConnectIntegration","useAgentBuilderContext","mentionItems","useMemo","buildAgentMentionItems","appTypeLabel","buildCustomToolMentionItems","toolActions","buildToolActions","registerInsert","useCallback","fn","onMentionSelect","kind","id","jsx","MentionEditor","text"],"mappings":"0SA+BaA,EAA4C,CAAC,CACzD,SAAAC,EACA,MAAAC,EACA,YAAAC,EACA,UAAAC,EACA,UAAAC,EACA,GAAGC,CACJ,IAAM,CACL,KAAM,CACL,MAAAC,EACA,MAAAC,EACA,aAAAC,EACA,eAAAC,EACA,mBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,qBAAAC,EACA,mBAAAC,EACA,iBAAAC,EACA,sBAAAC,EACA,kBAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,qBAAAC,CAAA,EACGC,yBAAA,EAKEC,EAAeC,EAAAA,QACpB,IAAM,CACL,GAAGC,EAAAA,uBACFf,EACAC,EACAe,EAAAA,aAAad,CAAe,CAAA,EAE7B,GAAGe,8BAA4BpB,EAAM,YAAaA,EAAM,YAAY,CAAA,EAErE,CACCG,EACAC,EACAC,EACAL,EAAM,YACNA,EAAM,YAAA,CACP,EAOKqB,EAAcJ,EAAAA,QACnB,IACCK,EAAAA,iBACCV,EACAD,EACAE,EACAC,CAAA,EAEF,CACCH,EACAC,EACAC,EACAC,CAAA,CACD,EAGKS,EAAiBC,EAAAA,YACrBC,GACAlB,EAAqBb,EAAU+B,CAAE,EAClC,CAAClB,EAAsBb,CAAQ,CAAA,EAM1BgC,EAAkBF,EAAAA,YACvB,CAACG,EAA2BC,IAAe1B,EAAayB,EAAMC,CAAE,EAChE,CAAC1B,CAAY,CAAA,EAGd,OACC2B,EAAAA,IAACC,EAAAA,cAAA,CACA,MAAAnC,EACA,MAAQK,EAAMN,CAAQ,GAA4B,GAClD,SAAWqC,GAAS9B,EAAM,CAAE,CAACP,CAAQ,EAAGqC,EAA6B,EACrE,UAAAlC,EACA,YAAAD,EACA,UAAAE,EACA,SAAU,GAAGE,EAAM,EAAE,IAAIN,CAAQ,IAAIY,CAAe,GACpD,aAAAU,EACA,MAAOb,EACP,gBAAAuB,EACA,QAAS,IAAMlB,EAAmBd,CAAQ,EAC1C,eAAA6B,EACA,iBAAkBd,EAAmBC,EAAwB,OAAA,YAC7DW,EACA,kBAAAR,EACA,qBAAAC,EACA,YAAWf,EAAK,WAAW,CAAA,CAAA,CAG9B"}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),Z=require("../../../assets/icons/chevronRight.svg.js"),K=require("../../../assets/icons/searchIcon.svg.js"),H=require("../../../icons/Arrows/Normal arrows/ArrowLeft.js"),s=require("react"),ee=require("styled-components"),D=require("../../TypographyStyle.js"),c=require("../../../constants/Theme.js"),te=require("../../variable-picker-v3/model.js"),E=require("../constants/tools.js"),z=require("../utils/mentionSerialization.js"),m=require("../utils/sourceIcons.js"),ne=require("../../variable-picker-v3/VariablePicker.js"),Q=require("../../../icons/Informational/Common UI/Shield.js"),re=a=>a&&typeof a=="object"&&"default"in a?a:{default:a},p=re(ee),g=a=>a.meta,R=a=>g(a)?.plainLabel??a.label,oe="__bik_create_subagent__",ie=({items:a,onSelect:S,registerKeyHandler:C,onClose:k,onCreateSubAgent:v,initialSource:N,toolActions:y,integrationStatus:U,onConnectIntegration:F,variablesData:A,onSelectVariable:M})=>{const[W,L]=s.useState(null),[d,P]=s.useState(N??null),[w,x]=s.useState(-1),[O,G]=s.useState(""),b=s.useMemo(()=>a.filter(e=>g(e)?.kind==="tool"),[a]),I=s.useMemo(()=>a.filter(e=>g(e)?.kind==="subagent"),[a]),T=s.useMemo(()=>{const e=[];return b.forEach(o=>{const h=g(o)?.source??"other";e.includes(h)||e.push(h)}),e},[b]),_=s.useMemo(()=>new Map((y??[]).map(e=>[e.source,e])),[y]),j=s.useMemo(()=>E.CATEGORIES.filter(e=>e.key==="tool"?b.length>0||(y?.length??0)>0:e.key==="variable"?(A?.length??0)>0&&!!M:I.length>0||!!v),[b.length,I.length,v,y?.length,A?.length,M]),q=j.length===1?j[0].key:null,l=W??q,f=l?l==="subagent"?{title:"Sub-agent",onBack:q?void 0:()=>L(null)}:l==="variable"?{title:"Variables",onBack:q?void 0:()=>L(null)}:d?{title:z.toolSourceLabel(d),onBack:N?void 0:()=>P(null),icon:m.sourceIcon(d)}:{title:"Tools",onBack:q?void 0:()=>L(null)}:null,u=s.useMemo(()=>{if(!l)return j.map(n=>({id:n.key,label:n.label,drillsIn:!0,onActivate:()=>{L(n.key),P(null)}}));if(l==="subagent"){const n=O.trim().toLowerCase(),t=I.filter(i=>!n||R(i).toLowerCase().includes(n)).map(i=>({id:String(i.id),label:R(i),drillsIn:!1,onActivate:()=>S(i)}));return v&&t.push({id:oe,label:"Create new",drillsIn:!1,isCreate:!0,onActivate:()=>{k?.(),v()}}),t}if(l==="variable")return[];if(!d){const n=(y??[]).map(t=>t.source).filter(t=>!T.includes(t));return[...T,...n].sort((t,i)=>E.toolSourceRank(t)-E.toolSourceRank(i)).map(t=>{const i=_.get(t);if((i!==void 0?i.connected:U?.[t])===!1)return{id:t,label:z.toolSourceLabel(t),drillsIn:!1,icon:m.sourceIcon(t)??i?.icon,rightLabel:"Connect",onActivate:()=>{k?.(),i?.onConnect?i.onConnect():F?.(t)}};const J=b.filter($=>(g($)?.source??"other")===t);if(J.length+(i?1:0)===1){const $=m.sourceIcon(t)??i?.icon;if(i)return{id:t,label:i.label,drillsIn:!1,icon:$,onActivate:()=>{k?.(),i.onSelect()}};const B=J[0];return{id:String(B.id),label:R(B),drillsIn:!1,icon:$,authRequired:g(B)?.authRequired,onActivate:()=>S(B)}}return{id:t,label:z.toolSourceLabel(t),drillsIn:!0,icon:m.sourceIcon(t)??i?.icon,onActivate:()=>P(t)}})}const e=O.trim().toLowerCase(),o=b.filter(n=>(g(n)?.source??"other")===d).filter(n=>!e||R(n).toLowerCase().includes(e)).map(n=>({id:String(n.id),label:R(n),drillsIn:!1,authRequired:g(n)?.authRequired,onActivate:()=>S(n)})),h=_.get(d);if(h){const n=d in E.CONFIG_TOOL_SOURCES;o.push({id:`create:${d}`,label:h.label,drillsIn:!1,isCreate:!n,onActivate:()=>{k?.(),h.onSelect()}})}return o},[l,j,d,O,b,I,T,S,k,v,y,_,U,F]);s.useEffect(()=>x(-1),[l,d,O,a]),s.useEffect(()=>G(""),[l,d]);const V=s.useRef({rows:u,activeIndex:w,header:f});V.current={rows:u,activeIndex:w,header:f},s.useEffect(()=>{if(C)return C(e=>{const{rows:o,activeIndex:h,header:n}=V.current;switch(e.key){case"ArrowDown":return o.length&&x(t=>(t+1)%o.length),!0;case"ArrowUp":return o.length&&x(t=>(t+o.length-1)%o.length),!0;case"ArrowRight":case"Enter":return(o[h]??o[0])?.onActivate(),!0;case"ArrowLeft":return n?.onBack?(n.onBack(),!0):!1;default:return!1}}),()=>C(null)},[C]);const X=l?u.length&&!u[0].drillsIn?"items":"sources":"categories",Y=l==="tool"&&!!d||l==="subagent";return r.jsxs(ae,{className:`bik-mention-picker bik-mention-picker--${X}`,children:[f&&r.jsxs(he,{type:"button",onClick:f.onBack,disabled:!f.onBack,style:{background:c.COLORS.surface.subdued,cursor:f.onBack?"pointer":"default"},children:[f.onBack&&r.jsx(H.default,{width:20,height:20,color:c.COLORS.content.primary}),f.icon&&m.renderSourceIcon(f.icon),r.jsxs(D.TitleSmall,{children:[" ",f.title]})]}),Y&&r.jsxs(ce,{children:[r.jsx(K.default,{width:20,height:20,color:c.COLORS.content.placeholder}),r.jsx(le,{autoFocus:!0,value:O,placeholder:"Search","data-test":"mention-picker-search",onChange:e=>G(e.target.value),onKeyDown:e=>{u.length&&(e.key==="ArrowDown"?(e.preventDefault(),x(o=>(o+1)%u.length)):e.key==="ArrowUp"?(e.preventDefault(),x(o=>(o+u.length-1)%u.length)):e.key==="Enter"&&(e.preventDefault(),(u[w]??u[0])?.onActivate()))}})]}),l==="variable"?r.jsx(ne.VariablePicker,{type:te.PickerType.EMBEDDED,data:A??[],showRecommendedBar:!1,onSelect:e=>{k?.(),M?.(e)}}):u.length===0?r.jsx(ge,{children:l==="subagent"?null:"No tools available"}):u.map((e,o)=>r.jsx(se,{type:"button",$active:o===w,onMouseEnter:()=>x(o),onMouseLeave:()=>x(-1),onClick:e.onActivate,children:e.isCreate?r.jsx(pe,{children:e.label}):r.jsxs(r.Fragment,{children:[r.jsxs(ue,{children:[m.renderSourceIcon(e.icon),r.jsx(D.BodySecondary,{color:c.COLORS.content.primary,children:e.label}),e.authRequired&&r.jsx(Q.default,{size:14,"aria-label":"Requires customer verification"})]}),e.rightLabel?r.jsx(fe,{children:e.rightLabel}):e.drillsIn&&r.jsx(Z.default,{width:12,height:12})]})},e.id)),u.some(e=>e.authRequired)&&r.jsxs(de,{children:[r.jsx(Q.default,{size:14}),r.jsx(D.BodyCaption,{color:c.COLORS.content.secondary,children:"Requires customer verification"})]})]})},ae=p.default.div`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),X=require("../../../assets/icons/chevronRight.svg.js"),Y=require("../../../assets/icons/searchIcon.svg.js"),Z=require("../../../icons/Arrows/Normal arrows/ArrowLeft.js"),l=require("react"),K=require("styled-components"),_=require("../../TypographyStyle.js"),c=require("../../../constants/Theme.js"),$=require("../constants/tools.js"),P=require("../utils/mentionSerialization.js"),y=require("../utils/sourceIcons.js"),J=require("../../../icons/Informational/Common UI/Shield.js"),H=a=>a&&typeof a=="object"&&"default"in a?a:{default:a},p=H(K),g=a=>a.meta,S=a=>g(a)?.plainLabel??a.label,ee="__bik_create_subagent__",te=({items:a,onSelect:R,registerKeyHandler:C,onClose:m,onCreateSubAgent:v,initialSource:z,toolActions:k,integrationStatus:D,onConnectIntegration:N})=>{const[Q,A]=l.useState(null),[u,B]=l.useState(z??null),[L,x]=l.useState(-1),[O,U]=l.useState(""),b=l.useMemo(()=>a.filter(e=>g(e)?.kind==="tool"),[a]),w=l.useMemo(()=>a.filter(e=>g(e)?.kind==="subagent"),[a]),E=l.useMemo(()=>{const e=[];return b.forEach(r=>{const h=g(r)?.source??"other";e.includes(h)||e.push(h)}),e},[b]),T=l.useMemo(()=>new Map((k??[]).map(e=>[e.source,e])),[k]),I=l.useMemo(()=>$.CATEGORIES.filter(e=>e.key==="tool"?b.length>0||(k?.length??0)>0:w.length>0||!!v),[b.length,w.length,v,k?.length]),M=I.length===1?I[0].key:null,d=Q??M,f=d?d==="subagent"?{title:"Sub-agent",onBack:M?void 0:()=>A(null)}:u?{title:P.toolSourceLabel(u),onBack:z?void 0:()=>B(null),icon:y.sourceIcon(u)}:{title:"Tools",onBack:M?void 0:()=>A(null)}:null,s=l.useMemo(()=>{if(!d)return I.map(n=>({id:n.key,label:n.label,drillsIn:!0,onActivate:()=>{A(n.key),B(null)}}));if(d==="subagent"){const n=O.trim().toLowerCase(),t=w.filter(i=>!n||S(i).toLowerCase().includes(n)).map(i=>({id:String(i.id),label:S(i),drillsIn:!1,onActivate:()=>R(i)}));return v&&t.push({id:ee,label:"Create new",drillsIn:!1,isCreate:!0,onActivate:()=>{m?.(),v()}}),t}if(!u){const n=(k??[]).map(t=>t.source).filter(t=>!E.includes(t));return[...E,...n].sort((t,i)=>$.toolSourceRank(t)-$.toolSourceRank(i)).map(t=>{const i=T.get(t);if((i!==void 0?i.connected:D?.[t])===!1)return{id:t,label:P.toolSourceLabel(t),drillsIn:!1,icon:y.sourceIcon(t)??i?.icon,rightLabel:"Connect",onActivate:()=>{m?.(),i?.onConnect?i.onConnect():N?.(t)}};const G=b.filter(j=>(g(j)?.source??"other")===t);if(G.length+(i?1:0)===1){const j=y.sourceIcon(t)??i?.icon;if(i)return{id:t,label:i.label,drillsIn:!1,icon:j,onActivate:()=>{m?.(),i.onSelect()}};const q=G[0];return{id:String(q.id),label:S(q),drillsIn:!1,icon:j,authRequired:g(q)?.authRequired,onActivate:()=>R(q)}}return{id:t,label:P.toolSourceLabel(t),drillsIn:!0,icon:y.sourceIcon(t)??i?.icon,onActivate:()=>B(t)}})}const e=O.trim().toLowerCase(),r=b.filter(n=>(g(n)?.source??"other")===u).filter(n=>!e||S(n).toLowerCase().includes(e)).map(n=>({id:String(n.id),label:S(n),drillsIn:!1,authRequired:g(n)?.authRequired,onActivate:()=>R(n)})),h=T.get(u);if(h){const n=u in $.CONFIG_TOOL_SOURCES;r.push({id:`create:${u}`,label:h.label,drillsIn:!1,isCreate:!n,onActivate:()=>{m?.(),h.onSelect()}})}return r},[d,I,u,O,b,w,E,R,m,v,k,T,D,N]);l.useEffect(()=>x(-1),[d,u,O,a]),l.useEffect(()=>U(""),[d,u]);const F=l.useRef({rows:s,activeIndex:L,header:f});F.current={rows:s,activeIndex:L,header:f},l.useEffect(()=>{if(C)return C(e=>{const{rows:r,activeIndex:h,header:n}=F.current;switch(e.key){case"ArrowDown":return r.length&&x(t=>(t+1)%r.length),!0;case"ArrowUp":return r.length&&x(t=>(t+r.length-1)%r.length),!0;case"ArrowRight":case"Enter":return(r[h]??r[0])?.onActivate(),!0;case"ArrowLeft":return n?.onBack?(n.onBack(),!0):!1;default:return!1}}),()=>C(null)},[C]);const V=d?s.length&&!s[0].drillsIn?"items":"sources":"categories",W=d==="tool"&&!!u||d==="subagent";return o.jsxs(ne,{className:`bik-mention-picker bik-mention-picker--${V}`,children:[f&&o.jsxs(ue,{type:"button",onClick:f.onBack,disabled:!f.onBack,style:{background:c.COLORS.surface.subdued,cursor:f.onBack?"pointer":"default"},children:[f.onBack&&o.jsx(Z.default,{width:20,height:20,color:c.COLORS.content.primary}),f.icon&&y.renderSourceIcon(f.icon),o.jsxs(_.TitleSmall,{children:[" ",f.title]})]}),W&&o.jsxs(oe,{children:[o.jsx(Y.default,{width:20,height:20,color:c.COLORS.content.placeholder}),o.jsx(re,{autoFocus:!0,value:O,placeholder:"Search","data-test":"mention-picker-search",onChange:e=>U(e.target.value),onKeyDown:e=>{s.length&&(e.key==="ArrowDown"?(e.preventDefault(),x(r=>(r+1)%s.length)):e.key==="ArrowUp"?(e.preventDefault(),x(r=>(r+s.length-1)%s.length)):e.key==="Enter"&&(e.preventDefault(),(s[L]??s[0])?.onActivate()))}})]}),s.length===0?o.jsx(de,{children:d==="subagent"?null:"No tools available"}):s.map((e,r)=>o.jsx(ie,{type:"button",$active:r===L,onMouseEnter:()=>x(r),onMouseLeave:()=>x(-1),onClick:e.onActivate,children:e.isCreate?o.jsx(se,{children:e.label}):o.jsxs(o.Fragment,{children:[o.jsxs(ae,{children:[y.renderSourceIcon(e.icon),o.jsx(_.BodySecondary,{color:c.COLORS.content.primary,children:e.label}),e.authRequired&&o.jsx(J.default,{size:14,"aria-label":"This tool requires customer verification"})]}),e.rightLabel?o.jsx(le,{children:e.rightLabel}):e.drillsIn&&o.jsx(X.default,{width:12,height:12})]})},e.id)),s.some(e=>e.authRequired)&&o.jsxs(ce,{children:[o.jsx(J.default,{size:14}),o.jsx(_.BodyCaption,{color:c.COLORS.content.secondary,children:"This tool requires customer verification"})]})]})},ne=p.default.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  min-width: 240px;
@@ -8,13 +8,13 @@
8
8
  border: 1px solid ${c.COLORS.stroke.primary};
9
9
  border-radius: 4px;
10
10
  box-shadow: 0px -2px 8px 0px #0000001f;
11
- `,ce=p.default.div`
11
+ `,oe=p.default.div`
12
12
  display: flex;
13
13
  align-items: center;
14
14
  gap: 8px;
15
15
  padding: 10px 12px;
16
16
  border-bottom: 1px solid ${c.COLORS.stroke.primary};
17
- `,le=p.default.input`
17
+ `,re=p.default.input`
18
18
  flex: 1;
19
19
  min-width: 0;
20
20
  border: none;
@@ -27,7 +27,7 @@
27
27
  &::placeholder {
28
28
  color: ${c.COLORS.content.placeholder};
29
29
  }
30
- `,se=p.default.button`
30
+ `,ie=p.default.button`
31
31
  display: flex;
32
32
  justify-content: space-between;
33
33
  align-items: center;
@@ -44,32 +44,32 @@
44
44
  &:hover {
45
45
  background: ${c.COLORS.surface.hovered};
46
46
  }
47
- `,ue=p.default.div`
47
+ `,ae=p.default.div`
48
48
  display: flex;
49
49
  align-items: center;
50
50
  gap: 12px;
51
51
  min-width: 0;
52
- `,de=p.default.div`
52
+ `,ce=p.default.div`
53
53
  display: flex;
54
54
  align-items: center;
55
55
  gap: 6px;
56
56
  padding: 8px 12px;
57
57
  border-top: 1px solid ${c.COLORS.stroke.primary};
58
- `,fe=p.default.span`
58
+ `,le=p.default.span`
59
59
  flex-shrink: 0;
60
60
  color: ${c.COLORS.content.brand};
61
61
  font-family: Inter;
62
62
  font-size: 14px;
63
63
  font-weight: 600;
64
64
  white-space: nowrap;
65
- `,pe=p.default.div`
65
+ `,se=p.default.div`
66
66
  width: 100%;
67
67
  text-align: center;
68
68
  color: ${c.COLORS.content.brand};
69
69
  font-family: Inter;
70
70
  font-size: 14px;
71
71
  font-weight: 600;
72
- `,he=p.default.button`
72
+ `,ue=p.default.button`
73
73
  display: flex;
74
74
  align-items: center;
75
75
  padding: 12px 16px;
@@ -82,10 +82,10 @@
82
82
  font-weight: 600;
83
83
  height: 48px;
84
84
  gap: 4px;
85
- `,ge=p.default.div`
85
+ `,de=p.default.div`
86
86
  padding: 12px 10px;
87
87
  font-family: Inter;
88
88
  font-size: 13px;
89
89
  color: ${c.COLORS.content.secondary};
90
- `;exports.MentionPicker=ie;
90
+ `;exports.MentionPicker=te;
91
91
  //# sourceMappingURL=MentionPicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MentionPicker.js","sources":["../../../../../src/components/agent-builder/components/MentionPicker.tsx"],"sourcesContent":["// import ChevronLeft from '@src/assets/icons/chevronLeft.svg';\nimport ChevronRight from '@src/assets/icons/chevronRight.svg';\nimport SearchIcon from '@src/assets/icons/searchIcon.svg';\nimport type { MentionDropdownRenderProps, MentionItem } from '@src/editor';\nimport { Shield } from '@src/icons';\nimport SvgArrowLeft from '@src/icons/Arrows/Normal arrows/ArrowLeft';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { VariablePicker } from '../../variable-picker-v3';\nimport { PickerType } from '../../variable-picker-v3/model';\nimport type {\n\tVariableListInterfaceV3,\n\tVariableV3,\n} from '../../variable-picker-v3/model';\nimport {\n\tCATEGORIES,\n\tCONFIG_TOOL_SOURCES,\n\ttoolSourceRank,\n} from '../constants/tools';\nimport type { Category, ToolAction, ToolSource } from '../constants/tools';\nimport {\n\tMentionKindMeta,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport { renderSourceIcon, sourceIcon, SourceIcon } from '../utils/sourceIcons';\n\nconst metaOf = (item: MentionItem): MentionKindMeta | undefined =>\n\titem.meta as unknown as MentionKindMeta | undefined;\n\nconst rowLabel = (item: MentionItem): string =>\n\tmetaOf(item)?.plainLabel ?? item.label;\n\n/** One navigable row in the picker's current view. */\ntype PickerRowModel = {\n\tid: string;\n\tlabel: string;\n\t/** Drill-in rows show a chevron; leaf (selectable) rows do not. */\n\tdrillsIn: boolean;\n\t/** Leading brand glyph (source rows only). */\n\ticon?: SourceIcon;\n\t/** Brand-coloured \"Create new\" action row (not a selectable item). */\n\tisCreate?: boolean;\n\t/**\n\t * Brand-coloured right-aligned action text (e.g. \"Connect\") shown in place of\n\t * the drill-in chevron — used for an unconnected integration source.\n\t */\n\trightLabel?: string;\n\t/** Tool leaf touches customer-private data → shows a shield glyph. */\n\tauthRequired?: boolean;\n\tonActivate: () => void;\n};\n\n/** Sentinel id for the sub-agent \"Create new\" row. */\nconst CREATE_SUBAGENT_ID = '__bik_create_subagent__';\n\ntype MentionPickerProps = MentionDropdownRenderProps & {\n\t/** Opens the create-sub-agent drawer (shows a \"Create new\" row in the Sub-agent view). */\n\tonCreateSubAgent?: () => void;\n\t/**\n\t * Open already drilled into this tool source (e.g. `'shopify'`) — its tool list\n\t * is shown immediately. */\n\tinitialSource?: string;\n\t/**\n\t * Built-in tool actions (Rest API / Handover to email) shown in the Tools view.\n\t * Picking one opens its config drawer (via `onSelect`) and dismisses the picker\n\t * — it never inserts a mention into the text.\n\t */\n\ttoolActions?: ToolAction[];\n\t/**\n\t * Per-source integration connection state. A source whose value is `false`\n\t * renders a \"Connect\" row (like an unconnected action) instead of drilling in —\n\t * so native source groups (Shopify / BigCommerce / ShipStation) show \"Connect\"\n\t * consistently with the config actions (Slack).\n\t */\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\t/** Open the connect flow for an unconnected source (used by the Connect row). */\n\tonConnectIntegration?: (source: ToolSource) => void;\n\t/**\n\t * Variable catalog for the \"Variables\" view (the shared VariablePicker's\n\t * `data`). Omitted / empty → the Variables category is not offered.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n\t/**\n\t * A variable was picked from the Variables view. The picker dismisses itself\n\t * (stripping the typed `@`) BEFORE calling this — the handler inserts a\n\t * `Variable: <name>` mention chip (see MentionEditor).\n\t */\n\tonSelectVariable?: (variable: VariableV3) => void;\n};\n\n/**\n * `@` reference picker. Drills:\n * root → Tools → <source> (Manifest / Shopify / …) → tool\n * → Sub-agent → sub-agent\n * → Variables → shared VariablePicker (embedded)\n * (\"Add condition\" is intentionally not shown yet.)\n *\n * Owns keyboard navigation (↑/↓ move, →/Enter activate, ← go back) over the\n * CURRENTLY visible rows — registered with the editor via `registerKeyHandler`.\n */\nexport const MentionPicker: React.FC<MentionPickerProps> = ({\n\titems,\n\tonSelect,\n\tregisterKeyHandler,\n\tonClose,\n\tonCreateSubAgent,\n\tinitialSource,\n\ttoolActions,\n\tintegrationStatus,\n\tonConnectIntegration,\n\tvariablesData,\n\tonSelectVariable,\n}) => {\n\tconst [category, setCategory] = useState<Category | null>(null);\n\tconst [source, setSource] = useState<string | null>(initialSource ?? null);\n\t// -1 = nothing highlighted; rows highlight only on hover / arrow keys\n\t// (a default highlight reads as a stuck hover state).\n\tconst [activeIndex, setActiveIndex] = useState(-1);\n\t// Search box shown inside a source's tool list (Manifest / Shopify); filters\n\t// that source's tools by name.\n\tconst [search, setSearch] = useState('');\n\n\tconst tools = useMemo(\n\t\t() => items.filter((i) => metaOf(i)?.kind === 'tool'),\n\t\t[items],\n\t);\n\tconst subAgents = useMemo(\n\t\t() => items.filter((i) => metaOf(i)?.kind === 'subagent'),\n\t\t[items],\n\t);\n\tconst sources = useMemo(() => {\n\t\tconst acc: string[] = [];\n\t\ttools.forEach((t) => {\n\t\t\tconst s = metaOf(t)?.source ?? 'other';\n\t\t\tif (!acc.includes(s)) {\n\t\t\t\tacc.push(s);\n\t\t\t}\n\t\t});\n\t\treturn acc;\n\t}, [tools]);\n\t// The built-in \"create\" action per source (Rest API / email / Slack). A source\n\t// with an action drills into [its instances + a \"Create new\" row] — like the\n\t// Sub-agent category — instead of showing a duplicate flat \"create\" row.\n\tconst actionBySource = useMemo(\n\t\t() =>\n\t\t\tnew Map<string, ToolAction>(\n\t\t\t\t(toolActions ?? []).map((a) => [a.source, a]),\n\t\t\t),\n\t\t[toolActions],\n\t);\n\n\t// Show a category when it has items — and ALWAYS show Sub-agent when creating\n\t// one is possible, so an agent with no sub-agents yet still gets the root\n\t// \"Tools / Sub-agent\" choice (with a \"Create new\" inside). When only one is\n\t// available (e.g. the sub-agent drawer offers tools only) the selector is skipped.\n\tconst availableCategories = useMemo(\n\t\t() =>\n\t\t\tCATEGORIES.filter((c) => {\n\t\t\t\tif (c.key === 'tool') {\n\t\t\t\t\treturn tools.length > 0 || (toolActions?.length ?? 0) > 0;\n\t\t\t\t}\n\t\t\t\tif (c.key === 'variable') {\n\t\t\t\t\treturn (variablesData?.length ?? 0) > 0 && !!onSelectVariable;\n\t\t\t\t}\n\t\t\t\treturn subAgents.length > 0 || !!onCreateSubAgent;\n\t\t\t}),\n\t\t[\n\t\t\ttools.length,\n\t\t\tsubAgents.length,\n\t\t\tonCreateSubAgent,\n\t\t\ttoolActions?.length,\n\t\t\tvariablesData?.length,\n\t\t\tonSelectVariable,\n\t\t],\n\t);\n\tconst soleCategory =\n\t\tavailableCategories.length === 1 ? availableCategories[0].key : null;\n\tconst activeCategory = category ?? soleCategory;\n\n\t// Title shown above the current view. `onBack` is omitted at a root level (a\n\t// sole category has nowhere to go back to) — the header then shows as a plain\n\t// title. When `onBack` is set the header leads with a back arrow, followed by\n\t// the source icon in a source detail view: `[← back][icon][title]`.\n\tconst header: {\n\t\ttitle: string;\n\t\tonBack?: () => void;\n\t\ticon?: SourceIcon;\n\t} | null = !activeCategory\n\t\t? null\n\t\t: activeCategory === 'subagent'\n\t\t? // Always titled — with a back arrow only when the category chooser is above.\n\t\t {\n\t\t\t\ttitle: 'Sub-agent',\n\t\t\t\tonBack: soleCategory ? undefined : () => setCategory(null),\n\t\t }\n\t\t: activeCategory === 'variable'\n\t\t? {\n\t\t\t\ttitle: 'Variables',\n\t\t\t\tonBack: soleCategory ? undefined : () => setCategory(null),\n\t\t }\n\t\t: source\n\t\t? {\n\t\t\t\ttitle: toolSourceLabel(source),\n\t\t\t\t// Deep-linked to a source (opened from a right-panel source button):\n\t\t\t\t// that source IS the root, so no back arrow. In the @-drill flow\n\t\t\t\t// (no initialSource) back returns to the source chooser.\n\t\t\t\tonBack: initialSource ? undefined : () => setSource(null),\n\t\t\t\ticon: sourceIcon(source),\n\t\t }\n\t\t: // Always titled — matches the Sub-agent header; back arrow only when the\n\t\t // category chooser is above (i.e. not the sole category).\n\t\t {\n\t\t\t\ttitle: 'Tools',\n\t\t\t\tonBack: soleCategory ? undefined : () => setCategory(null),\n\t\t };\n\n\t// Build the navigable rows for the current view.\n\tconst rows: PickerRowModel[] = useMemo(() => {\n\t\tif (!activeCategory) {\n\t\t\treturn availableCategories.map((c) => ({\n\t\t\t\tid: c.key,\n\t\t\t\tlabel: c.label,\n\t\t\t\tdrillsIn: true,\n\t\t\t\tonActivate: () => {\n\t\t\t\t\tsetCategory(c.key);\n\t\t\t\t\tsetSource(null);\n\t\t\t\t},\n\t\t\t}));\n\t\t}\n\t\tif (activeCategory === 'subagent') {\n\t\t\tconst sq = search.trim().toLowerCase();\n\t\t\tconst leaves: PickerRowModel[] = subAgents\n\t\t\t\t.filter((item) => !sq || rowLabel(item).toLowerCase().includes(sq))\n\t\t\t\t.map((item) => ({\n\t\t\t\t\tid: String(item.id),\n\t\t\t\t\tlabel: rowLabel(item),\n\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\tonActivate: () => onSelect(item),\n\t\t\t\t}));\n\t\t\t// \"Create new\" opens the drawer — first dismiss the menu (strips the \"@\").\n\t\t\tif (onCreateSubAgent) {\n\t\t\t\tleaves.push({\n\t\t\t\t\tid: CREATE_SUBAGENT_ID,\n\t\t\t\t\tlabel: 'Create new',\n\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\tisCreate: true,\n\t\t\t\t\tonActivate: () => {\n\t\t\t\t\t\tonClose?.();\n\t\t\t\t\t\tonCreateSubAgent();\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn leaves;\n\t\t}\n\t\tif (activeCategory === 'variable') {\n\t\t\t// The embedded VariablePicker owns this view (its own search + rows) —\n\t\t\t// no navigable PickerRow list of our own.\n\t\t\treturn [];\n\t\t}\n\t\tif (!source) {\n\t\t\t// One drill-in row per source: the real sources (from instances) plus any\n\t\t\t// action source (Rest API / email / Slack) with no instances yet, so it\n\t\t\t// still appears for first-time creation. Deduped — no more twin rows.\n\t\t\tconst actionOnly = (toolActions ?? [])\n\t\t\t\t.map((a) => a.source)\n\t\t\t\t.filter((s) => !sources.includes(s));\n\t\t\t// Fixed source order (manifest → shopify → rest_api → email → slack →\n\t\t\t// rest) so adding/updating a tool never reshuffles the picker rows.\n\t\t\treturn [...sources, ...actionOnly]\n\t\t\t\t.sort((a, b) => toolSourceRank(a) - toolSourceRank(b))\n\t\t\t\t.map((s) => {\n\t\t\t\t\tconst action = actionBySource.get(s);\n\t\t\t\t\t// Not connected → a \"Connect\" row (no drill-in / no instances / no\n\t\t\t\t\t// \"Create new\"); clicking dismisses the picker and runs the connect\n\t\t\t\t\t// flow. Applies to config actions (their own `connected`) AND native\n\t\t\t\t\t// source groups (via `integrationStatus`), so both look consistent.\n\t\t\t\t\tconst connected =\n\t\t\t\t\t\taction !== undefined\n\t\t\t\t\t\t\t? action.connected\n\t\t\t\t\t\t\t: integrationStatus?.[s as ToolSource];\n\t\t\t\t\tif (connected === false) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tid: s,\n\t\t\t\t\t\t\tlabel: toolSourceLabel(s),\n\t\t\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\t\t\ticon: sourceIcon(s) ?? action?.icon,\n\t\t\t\t\t\t\trightLabel: 'Connect',\n\t\t\t\t\t\t\tonActivate: () => {\n\t\t\t\t\t\t\t\tonClose?.();\n\t\t\t\t\t\t\t\tif (action?.onConnect) {\n\t\t\t\t\t\t\t\t\taction.onConnect();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonConnectIntegration?.(s as ToolSource);\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// A source whose drill-in view would hold exactly one leaf is\n\t\t\t\t\t// pointless to drill into — surface that single leaf right here at\n\t\t\t\t\t// the source level (its function name + the same source icon).\n\t\t\t\t\t// Covers \"no Rest API added yet\" (→ open the create modal directly)\n\t\t\t\t\t// and a config tool's single capability (Slack → \"Send Slack\n\t\t\t\t\t// message\", email → \"Send Email\").\n\t\t\t\t\tconst instances = tools.filter(\n\t\t\t\t\t\t(t) => (metaOf(t)?.source ?? 'other') === s,\n\t\t\t\t\t);\n\t\t\t\t\tif (instances.length + (action ? 1 : 0) === 1) {\n\t\t\t\t\t\tconst icon = sourceIcon(s) ?? action?.icon;\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tid: s,\n\t\t\t\t\t\t\t\tlabel: action.label,\n\t\t\t\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\tonActivate: () => {\n\t\t\t\t\t\t\t\t\tonClose?.();\n\t\t\t\t\t\t\t\t\taction.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\tconst only = instances[0];\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tid: String(only.id),\n\t\t\t\t\t\t\tlabel: rowLabel(only),\n\t\t\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\tauthRequired: metaOf(only)?.authRequired,\n\t\t\t\t\t\t\tonActivate: () => onSelect(only),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: s,\n\t\t\t\t\t\tlabel: toolSourceLabel(s),\n\t\t\t\t\t\tdrillsIn: true,\n\t\t\t\t\t\ticon: sourceIcon(s) ?? action?.icon,\n\t\t\t\t\t\tonActivate: () => setSource(s),\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t}\n\t\tconst q = search.trim().toLowerCase();\n\t\tconst leaves: PickerRowModel[] = tools\n\t\t\t.filter((t) => (metaOf(t)?.source ?? 'other') === source)\n\t\t\t.filter((t) => !q || rowLabel(t).toLowerCase().includes(q))\n\t\t\t.map((item) => ({\n\t\t\t\tid: String(item.id),\n\t\t\t\tlabel: rowLabel(item),\n\t\t\t\tdrillsIn: false,\n\t\t\t\tauthRequired: metaOf(item)?.authRequired,\n\t\t\t\tonActivate: () => onSelect(item),\n\t\t\t}));\n\t\t// A configurable source's add row, below any existing instances, opening\n\t\t// its drawer. Config tools (Slack / email) are a single fixed capability →\n\t\t// render like a normal tool leaf (label only, no icon — matching the tool\n\t\t// rows). Rest API instances are user-created, so its \"add\" stays a\n\t\t// brand-coloured create row.\n\t\tconst action = actionBySource.get(source);\n\t\tif (action) {\n\t\t\tconst isConfigTool = source in CONFIG_TOOL_SOURCES;\n\t\t\tleaves.push({\n\t\t\t\tid: `create:${source}`,\n\t\t\t\tlabel: action.label,\n\t\t\t\tdrillsIn: false,\n\t\t\t\tisCreate: !isConfigTool,\n\t\t\t\tonActivate: () => {\n\t\t\t\t\tonClose?.();\n\t\t\t\t\taction.onSelect();\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\treturn leaves;\n\t}, [\n\t\tactiveCategory,\n\t\tavailableCategories,\n\t\tsource,\n\t\tsearch,\n\t\ttools,\n\t\tsubAgents,\n\t\tsources,\n\t\tonSelect,\n\t\tonClose,\n\t\tonCreateSubAgent,\n\t\ttoolActions,\n\t\tactionBySource,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t]);\n\n\t// Reset highlight whenever the view (or filtered result set) changes.\n\tuseEffect(() => setActiveIndex(-1), [activeCategory, source, search, items]);\n\t// Clear the search box when leaving a source view.\n\tuseEffect(() => setSearch(''), [activeCategory, source]);\n\n\t// Keep the latest rows/index reachable from the stable key handler.\n\tconst navRef = useRef({ rows, activeIndex, header });\n\tnavRef.current = { rows, activeIndex, header };\n\n\tuseEffect(() => {\n\t\tif (!registerKeyHandler) {\n\t\t\treturn;\n\t\t}\n\t\tregisterKeyHandler((event) => {\n\t\t\tconst { rows: r, activeIndex: i, header: h } = navRef.current;\n\t\t\tswitch (event.key) {\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tif (r.length) setActiveIndex((p) => (p + 1) % r.length);\n\t\t\t\t\treturn true;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tif (r.length) setActiveIndex((p) => (p + r.length - 1) % r.length);\n\t\t\t\t\treturn true;\n\t\t\t\tcase 'ArrowRight':\n\t\t\t\tcase 'Enter':\n\t\t\t\t\t// Nothing highlighted yet → treat the first row as the target so\n\t\t\t\t\t// the editor's @-flow (type, then Enter) still works.\n\t\t\t\t\t(r[i] ?? r[0])?.onActivate();\n\t\t\t\t\treturn true;\n\t\t\t\tcase 'ArrowLeft':\n\t\t\t\t\tif (h?.onBack) {\n\t\t\t\t\t\th.onBack();\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\treturn () => registerKeyHandler(null);\n\t}, [registerKeyHandler]);\n\n\tconst variant = !activeCategory\n\t\t? 'categories'\n\t\t: rows.length && !rows[0].drillsIn\n\t\t? 'items'\n\t\t: 'sources';\n\n\t// Search lives inside a source's tool list (Manifest / Shopify) and in the\n\t// sub-agent list.\n\tconst showSearch =\n\t\t(activeCategory === 'tool' && !!source) || activeCategory === 'subagent';\n\n\treturn (\n\t\t<PickerCard className={`bik-mention-picker bik-mention-picker--${variant}`}>\n\t\t\t{header && (\n\t\t\t\t<PickerBack\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={header.onBack}\n\t\t\t\t\tdisabled={!header.onBack}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbackground: COLORS.surface.subdued,\n\t\t\t\t\t\tcursor: header.onBack ? 'pointer' : 'default',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{header.onBack && (\n\t\t\t\t\t\t<SvgArrowLeft\n\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\tcolor={COLORS.content.primary}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{header.icon && renderSourceIcon(header.icon)}\n\t\t\t\t\t<TitleSmall> {header.title}</TitleSmall>\n\t\t\t\t</PickerBack>\n\t\t\t)}\n\t\t\t{showSearch && (\n\t\t\t\t<PickerSearchRow>\n\t\t\t\t\t<SearchIcon\n\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\theight={20}\n\t\t\t\t\t\tcolor={COLORS.content.placeholder}\n\t\t\t\t\t/>\n\t\t\t\t\t<PickerSearchInput\n\t\t\t\t\t\t// Focus on open so the user can type immediately (appears only\n\t\t\t\t\t\t// after they drill into a source).\n\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tvalue={search}\n\t\t\t\t\t\tplaceholder=\"Search\"\n\t\t\t\t\t\tdata-test=\"mention-picker-search\"\n\t\t\t\t\t\tonChange={(e) => setSearch(e.target.value)}\n\t\t\t\t\t\tonKeyDown={(e) => {\n\t\t\t\t\t\t\tif (!rows.length) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tsetActiveIndex((p) => (p + 1) % rows.length);\n\t\t\t\t\t\t\t} else if (e.key === 'ArrowUp') {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tsetActiveIndex((p) => (p + rows.length - 1) % rows.length);\n\t\t\t\t\t\t\t} else if (e.key === 'Enter') {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t(rows[activeIndex] ?? rows[0])?.onActivate();\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</PickerSearchRow>\n\t\t\t)}\n\t\t\t{activeCategory === 'variable' ? (\n\t\t\t\t// Shared variable catalog, embedded as this drill-in view. Selecting a\n\t\t\t\t// variable dismisses the menu FIRST (strips the typed \"@\" + query),\n\t\t\t\t// then hands the variable up to insert its `{{token}}` at the cursor.\n\t\t\t\t<VariablePicker\n\t\t\t\t\ttype={PickerType.EMBEDDED}\n\t\t\t\t\tdata={variablesData ?? []}\n\t\t\t\t\tshowRecommendedBar={false}\n\t\t\t\t\tonSelect={(variable: VariableV3) => {\n\t\t\t\t\t\tonClose?.();\n\t\t\t\t\t\tonSelectVariable?.(variable);\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t) : rows.length === 0 ? (\n\t\t\t\t<PickerEmpty>\n\t\t\t\t\t{activeCategory === 'subagent' ? null : 'No tools available'}\n\t\t\t\t</PickerEmpty>\n\t\t\t) : (\n\t\t\t\trows.map((row, i) => (\n\t\t\t\t\t<PickerRow\n\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t$active={i === activeIndex}\n\t\t\t\t\t\tonMouseEnter={() => setActiveIndex(i)}\n\t\t\t\t\t\tonMouseLeave={() => setActiveIndex(-1)}\n\t\t\t\t\t\tonClick={row.onActivate}\n\t\t\t\t\t>\n\t\t\t\t\t\t{row.isCreate ? (\n\t\t\t\t\t\t\t<CreateRowText>{row.label}</CreateRowText>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<PickerRowMain>\n\t\t\t\t\t\t\t\t\t{renderSourceIcon(row.icon)}\n\t\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t\t{row.label}\n\t\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t\t{row.authRequired && (\n\t\t\t\t\t\t\t\t\t\t<Shield\n\t\t\t\t\t\t\t\t\t\t\tsize={14}\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Requires customer verification\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</PickerRowMain>\n\t\t\t\t\t\t\t\t{row.rightLabel ? (\n\t\t\t\t\t\t\t\t\t<RightActionText>{row.rightLabel}</RightActionText>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\trow.drillsIn && <ChevronRight width={12} height={12} />\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</PickerRow>\n\t\t\t\t))\n\t\t\t)}\n\t\t\t{rows.some((row) => row.authRequired) && (\n\t\t\t\t<PickerLegend>\n\t\t\t\t\t<Shield size={14} />\n\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\tRequires customer verification\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t</PickerLegend>\n\t\t\t)}\n\t\t</PickerCard>\n\t);\n};\n\nconst PickerCard = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-width: 240px;\n\tmax-height: 301px;\n\toverflow-y: auto;\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tbox-shadow: 0px -2px 8px 0px #0000001f;\n`;\n\n// Search box at the top of a source's tool list (Manifest / Shopify).\nconst PickerSearchRow = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 10px 12px;\n\tborder-bottom: 1px solid ${COLORS.stroke.primary};\n`;\n\nconst PickerSearchInput = styled.input`\n\tflex: 1;\n\tmin-width: 0;\n\tborder: none;\n\toutline: none;\n\tbackground: transparent;\n\tfont-family: Inter;\n\tfont-size: 14px;\n\tcolor: ${COLORS.content.primary};\n\n\t&::placeholder {\n\t\tcolor: ${COLORS.content.placeholder};\n\t}\n`;\n\nconst PickerRow = styled.button<{ $active?: boolean }>`\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tgap: 2px;\n\twidth: 100%;\n\tpadding: 8px 10px;\n\theight: 48px;\n\tborder: none;\n\tborder-bottom: 1px solid ${COLORS.stroke.primary};\n\tbackground: ${(p) => (p.$active ? COLORS.surface.subdued : 'transparent')};\n\tcursor: pointer;\n\ttext-align: left;\n\n\t&:hover {\n\t\tbackground: ${COLORS.surface.hovered};\n\t}\n`;\n\n// Left cluster: leading source glyph + label (chevron stays right via PickerRow).\nconst PickerRowMain = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n\tmin-width: 0;\n`;\n\n// Footer legend, shown when the list holds any auth-required tool.\nconst PickerLegend = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tpadding: 8px 12px;\n\tborder-top: 1px solid ${COLORS.stroke.primary};\n`;\n\n// Right-aligned brand action text (e.g. \"Connect\") in place of the chevron.\nconst RightActionText = styled.span`\n\tflex-shrink: 0;\n\tcolor: ${COLORS.content.brand};\n\tfont-family: Inter;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\twhite-space: nowrap;\n`;\n\n// \"Create new\" — centered brand text, no icon (matches the side-panel dropdown).\nconst CreateRowText = styled.div`\n\twidth: 100%;\n\ttext-align: center;\n\tcolor: ${COLORS.content.brand};\n\tfont-family: Inter;\n\tfont-size: 14px;\n\tfont-weight: 600;\n`;\n\nconst PickerBack = styled.button`\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: 12px 16px;\n\tborder: none;\n\tborder-bottom: 1px solid ${COLORS.stroke.primary};\n\tbackground: transparent;\n\tcursor: pointer;\n\tfont-family: Inter;\n\tfont-size: 12px;\n\tfont-weight: 600;\n\theight: 48px;\n\tgap: 4px;\n`;\n\nconst PickerEmpty = styled.div`\n\tpadding: 12px 10px;\n\tfont-family: Inter;\n\tfont-size: 13px;\n\tcolor: ${COLORS.content.secondary};\n`;\n"],"names":["metaOf","item","rowLabel","CREATE_SUBAGENT_ID","MentionPicker","items","onSelect","registerKeyHandler","onClose","onCreateSubAgent","initialSource","toolActions","integrationStatus","onConnectIntegration","variablesData","onSelectVariable","category","setCategory","useState","source","setSource","activeIndex","setActiveIndex","search","setSearch","tools","useMemo","i","subAgents","sources","acc","t","s","actionBySource","a","availableCategories","CATEGORIES","c","soleCategory","activeCategory","header","toolSourceLabel","sourceIcon","rows","sq","leaves","actionOnly","b","toolSourceRank","action","instances","icon","only","q","isConfigTool","CONFIG_TOOL_SOURCES","useEffect","navRef","useRef","event","r","h","p","variant","showSearch","jsxs","PickerCard","PickerBack","COLORS","jsx","SvgArrowLeft","renderSourceIcon","TitleSmall","PickerSearchRow","SearchIcon","PickerSearchInput","VariablePicker","PickerType","variable","PickerEmpty","row","PickerRow","CreateRowText","Fragment","PickerRowMain","BodySecondary","Shield","RightActionText","ChevronRight","PickerLegend","BodyCaption","styled"],"mappings":"gwBAgCMA,EAAUC,GACfA,EAAK,KAEAC,EAAYD,GACjBD,EAAOC,CAAI,GAAG,YAAcA,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O;AAAA,eACjCN,GAAOA,EAAE,QAAUM,EAAAA,OAAO,QAAQ,QAAU,aAAc;AAAA;AAAA;AAAA;AAAA;AAAA,gBAK1DA,EAAAA,OAAO,QAAQ,OAAO;AAAA;AAAA,EAKhCgB,GAAgBO,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvBF,GAAeE,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,yBAKHvB,EAAAA,OAAO,OAAO,OAAO;AAAA,EAIxCmB,GAAkBI,EAAAA,QAAO;AAAA;AAAA,UAErBvB,EAAAA,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAQxBc,GAAgBS,EAAAA,QAAO;AAAA;AAAA;AAAA,UAGnBvB,EAAAA,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA,EAMxBD,GAAawB,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,4BAKEvB,EAAAA,OAAO,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU3CW,GAAcY,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA,UAIjBvB,EAAAA,OAAO,QAAQ,SAAS;AAAA"}
1
+ {"version":3,"file":"MentionPicker.js","sources":["../../../../../src/components/agent-builder/components/MentionPicker.tsx"],"sourcesContent":["// import ChevronLeft from '@src/assets/icons/chevronLeft.svg';\nimport ChevronRight from '@src/assets/icons/chevronRight.svg';\nimport SearchIcon from '@src/assets/icons/searchIcon.svg';\nimport type { MentionDropdownRenderProps, MentionItem } from '@src/editor';\nimport { Shield } from '@src/icons';\nimport SvgArrowLeft from '@src/icons/Arrows/Normal arrows/ArrowLeft';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tCATEGORIES,\n\tCONFIG_TOOL_SOURCES,\n\ttoolSourceRank,\n} from '../constants/tools';\nimport type { Category, ToolAction, ToolSource } from '../constants/tools';\nimport {\n\tMentionKindMeta,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport { renderSourceIcon, sourceIcon, SourceIcon } from '../utils/sourceIcons';\n\nconst metaOf = (item: MentionItem): MentionKindMeta | undefined =>\n\titem.meta as unknown as MentionKindMeta | undefined;\n\nconst rowLabel = (item: MentionItem): string =>\n\tmetaOf(item)?.plainLabel ?? item.label;\n\n/** One navigable row in the picker's current view. */\ntype PickerRowModel = {\n\tid: string;\n\tlabel: string;\n\t/** Drill-in rows show a chevron; leaf (selectable) rows do not. */\n\tdrillsIn: boolean;\n\t/** Leading brand glyph (source rows only). */\n\ticon?: SourceIcon;\n\t/** Brand-coloured \"Create new\" action row (not a selectable item). */\n\tisCreate?: boolean;\n\t/**\n\t * Brand-coloured right-aligned action text (e.g. \"Connect\") shown in place of\n\t * the drill-in chevron — used for an unconnected integration source.\n\t */\n\trightLabel?: string;\n\t/** Tool leaf touches customer-private data → shows a shield glyph. */\n\tauthRequired?: boolean;\n\tonActivate: () => void;\n};\n\n/** Sentinel id for the sub-agent \"Create new\" row. */\nconst CREATE_SUBAGENT_ID = '__bik_create_subagent__';\n\ntype MentionPickerProps = MentionDropdownRenderProps & {\n\t/** Opens the create-sub-agent drawer (shows a \"Create new\" row in the Sub-agent view). */\n\tonCreateSubAgent?: () => void;\n\t/**\n\t * Open already drilled into this tool source (e.g. `'shopify'`) — its tool list\n\t * is shown immediately. */\n\tinitialSource?: string;\n\t/**\n\t * Built-in tool actions (Rest API / Handover to email) shown in the Tools view.\n\t * Picking one opens its config drawer (via `onSelect`) and dismisses the picker\n\t * — it never inserts a mention into the text.\n\t */\n\ttoolActions?: ToolAction[];\n\t/**\n\t * Per-source integration connection state. A source whose value is `false`\n\t * renders a \"Connect\" row (like an unconnected action) instead of drilling in —\n\t * so native source groups (Shopify / BigCommerce / ShipStation) show \"Connect\"\n\t * consistently with the config actions (Slack).\n\t */\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\t/** Open the connect flow for an unconnected source (used by the Connect row). */\n\tonConnectIntegration?: (source: ToolSource) => void;\n};\n\n/**\n * `@` reference picker. Drills:\n * root → Tools → <source> (Manifest / Shopify / …) → tool\n * → Sub-agent → sub-agent\n * (\"Add condition\" and \"Variables\" are intentionally not shown yet.)\n *\n * Owns keyboard navigation (↑/↓ move, →/Enter activate, ← go back) over the\n * CURRENTLY visible rows — registered with the editor via `registerKeyHandler`.\n */\nexport const MentionPicker: React.FC<MentionPickerProps> = ({\n\titems,\n\tonSelect,\n\tregisterKeyHandler,\n\tonClose,\n\tonCreateSubAgent,\n\tinitialSource,\n\ttoolActions,\n\tintegrationStatus,\n\tonConnectIntegration,\n}) => {\n\tconst [category, setCategory] = useState<Category | null>(null);\n\tconst [source, setSource] = useState<string | null>(initialSource ?? null);\n\t// -1 = nothing highlighted; rows highlight only on hover / arrow keys\n\t// (a default highlight reads as a stuck hover state).\n\tconst [activeIndex, setActiveIndex] = useState(-1);\n\t// Search box shown inside a source's tool list (Manifest / Shopify); filters\n\t// that source's tools by name.\n\tconst [search, setSearch] = useState('');\n\n\tconst tools = useMemo(\n\t\t() => items.filter((i) => metaOf(i)?.kind === 'tool'),\n\t\t[items],\n\t);\n\tconst subAgents = useMemo(\n\t\t() => items.filter((i) => metaOf(i)?.kind === 'subagent'),\n\t\t[items],\n\t);\n\tconst sources = useMemo(() => {\n\t\tconst acc: string[] = [];\n\t\ttools.forEach((t) => {\n\t\t\tconst s = metaOf(t)?.source ?? 'other';\n\t\t\tif (!acc.includes(s)) {\n\t\t\t\tacc.push(s);\n\t\t\t}\n\t\t});\n\t\treturn acc;\n\t}, [tools]);\n\t// The built-in \"create\" action per source (Rest API / email / Slack). A source\n\t// with an action drills into [its instances + a \"Create new\" row] — like the\n\t// Sub-agent category — instead of showing a duplicate flat \"create\" row.\n\tconst actionBySource = useMemo(\n\t\t() =>\n\t\t\tnew Map<string, ToolAction>(\n\t\t\t\t(toolActions ?? []).map((a) => [a.source, a]),\n\t\t\t),\n\t\t[toolActions],\n\t);\n\n\t// Show a category when it has items — and ALWAYS show Sub-agent when creating\n\t// one is possible, so an agent with no sub-agents yet still gets the root\n\t// \"Tools / Sub-agent\" choice (with a \"Create new\" inside). When only one is\n\t// available (e.g. the sub-agent drawer offers tools only) the selector is skipped.\n\tconst availableCategories = useMemo(\n\t\t() =>\n\t\t\tCATEGORIES.filter((c) =>\n\t\t\t\tc.key === 'tool'\n\t\t\t\t\t? tools.length > 0 || (toolActions?.length ?? 0) > 0\n\t\t\t\t\t: subAgents.length > 0 || !!onCreateSubAgent,\n\t\t\t),\n\t\t[tools.length, subAgents.length, onCreateSubAgent, toolActions?.length],\n\t);\n\tconst soleCategory =\n\t\tavailableCategories.length === 1 ? availableCategories[0].key : null;\n\tconst activeCategory = category ?? soleCategory;\n\n\t// Title shown above the current view. `onBack` is omitted at a root level (a\n\t// sole category has nowhere to go back to) — the header then shows as a plain\n\t// title. When `onBack` is set the header leads with a back arrow, followed by\n\t// the source icon in a source detail view: `[← back][icon][title]`.\n\tconst header: {\n\t\ttitle: string;\n\t\tonBack?: () => void;\n\t\ticon?: SourceIcon;\n\t} | null = !activeCategory\n\t\t? null\n\t\t: activeCategory === 'subagent'\n\t\t? // Always titled — with a back arrow only when the category chooser is above.\n\t\t {\n\t\t\t\ttitle: 'Sub-agent',\n\t\t\t\tonBack: soleCategory ? undefined : () => setCategory(null),\n\t\t }\n\t\t: source\n\t\t? {\n\t\t\t\ttitle: toolSourceLabel(source),\n\t\t\t\t// Deep-linked to a source (opened from a right-panel source button):\n\t\t\t\t// that source IS the root, so no back arrow. In the @-drill flow\n\t\t\t\t// (no initialSource) back returns to the source chooser.\n\t\t\t\tonBack: initialSource ? undefined : () => setSource(null),\n\t\t\t\ticon: sourceIcon(source),\n\t\t }\n\t\t: // Always titled — matches the Sub-agent header; back arrow only when the\n\t\t // category chooser is above (i.e. not the sole category).\n\t\t {\n\t\t\t\ttitle: 'Tools',\n\t\t\t\tonBack: soleCategory ? undefined : () => setCategory(null),\n\t\t };\n\n\t// Build the navigable rows for the current view.\n\tconst rows: PickerRowModel[] = useMemo(() => {\n\t\tif (!activeCategory) {\n\t\t\treturn availableCategories.map((c) => ({\n\t\t\t\tid: c.key,\n\t\t\t\tlabel: c.label,\n\t\t\t\tdrillsIn: true,\n\t\t\t\tonActivate: () => {\n\t\t\t\t\tsetCategory(c.key);\n\t\t\t\t\tsetSource(null);\n\t\t\t\t},\n\t\t\t}));\n\t\t}\n\t\tif (activeCategory === 'subagent') {\n\t\t\tconst sq = search.trim().toLowerCase();\n\t\t\tconst leaves: PickerRowModel[] = subAgents\n\t\t\t\t.filter((item) => !sq || rowLabel(item).toLowerCase().includes(sq))\n\t\t\t\t.map((item) => ({\n\t\t\t\t\tid: String(item.id),\n\t\t\t\t\tlabel: rowLabel(item),\n\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\tonActivate: () => onSelect(item),\n\t\t\t\t}));\n\t\t\t// \"Create new\" opens the drawer — first dismiss the menu (strips the \"@\").\n\t\t\tif (onCreateSubAgent) {\n\t\t\t\tleaves.push({\n\t\t\t\t\tid: CREATE_SUBAGENT_ID,\n\t\t\t\t\tlabel: 'Create new',\n\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\tisCreate: true,\n\t\t\t\t\tonActivate: () => {\n\t\t\t\t\t\tonClose?.();\n\t\t\t\t\t\tonCreateSubAgent();\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn leaves;\n\t\t}\n\t\tif (!source) {\n\t\t\t// One drill-in row per source: the real sources (from instances) plus any\n\t\t\t// action source (Rest API / email / Slack) with no instances yet, so it\n\t\t\t// still appears for first-time creation. Deduped — no more twin rows.\n\t\t\tconst actionOnly = (toolActions ?? [])\n\t\t\t\t.map((a) => a.source)\n\t\t\t\t.filter((s) => !sources.includes(s));\n\t\t\t// Fixed source order (manifest → shopify → rest_api → email → slack →\n\t\t\t// rest) so adding/updating a tool never reshuffles the picker rows.\n\t\t\treturn [...sources, ...actionOnly]\n\t\t\t\t.sort((a, b) => toolSourceRank(a) - toolSourceRank(b))\n\t\t\t\t.map((s) => {\n\t\t\t\t\tconst action = actionBySource.get(s);\n\t\t\t\t\t// Not connected → a \"Connect\" row (no drill-in / no instances / no\n\t\t\t\t\t// \"Create new\"); clicking dismisses the picker and runs the connect\n\t\t\t\t\t// flow. Applies to config actions (their own `connected`) AND native\n\t\t\t\t\t// source groups (via `integrationStatus`), so both look consistent.\n\t\t\t\t\tconst connected =\n\t\t\t\t\t\taction !== undefined\n\t\t\t\t\t\t\t? action.connected\n\t\t\t\t\t\t\t: integrationStatus?.[s as ToolSource];\n\t\t\t\t\tif (connected === false) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tid: s,\n\t\t\t\t\t\t\tlabel: toolSourceLabel(s),\n\t\t\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\t\t\ticon: sourceIcon(s) ?? action?.icon,\n\t\t\t\t\t\t\trightLabel: 'Connect',\n\t\t\t\t\t\t\tonActivate: () => {\n\t\t\t\t\t\t\t\tonClose?.();\n\t\t\t\t\t\t\t\tif (action?.onConnect) {\n\t\t\t\t\t\t\t\t\taction.onConnect();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonConnectIntegration?.(s as ToolSource);\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// A source whose drill-in view would hold exactly one leaf is\n\t\t\t\t\t// pointless to drill into — surface that single leaf right here at\n\t\t\t\t\t// the source level (its function name + the same source icon).\n\t\t\t\t\t// Covers \"no Rest API added yet\" (→ open the create modal directly)\n\t\t\t\t\t// and a config tool's single capability (Slack → \"Send Slack\n\t\t\t\t\t// message\", email → \"Send Email\").\n\t\t\t\t\tconst instances = tools.filter(\n\t\t\t\t\t\t(t) => (metaOf(t)?.source ?? 'other') === s,\n\t\t\t\t\t);\n\t\t\t\t\tif (instances.length + (action ? 1 : 0) === 1) {\n\t\t\t\t\t\tconst icon = sourceIcon(s) ?? action?.icon;\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tid: s,\n\t\t\t\t\t\t\t\tlabel: action.label,\n\t\t\t\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\tonActivate: () => {\n\t\t\t\t\t\t\t\t\tonClose?.();\n\t\t\t\t\t\t\t\t\taction.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\tconst only = instances[0];\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tid: String(only.id),\n\t\t\t\t\t\t\tlabel: rowLabel(only),\n\t\t\t\t\t\t\tdrillsIn: false,\n\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\tauthRequired: metaOf(only)?.authRequired,\n\t\t\t\t\t\t\tonActivate: () => onSelect(only),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: s,\n\t\t\t\t\t\tlabel: toolSourceLabel(s),\n\t\t\t\t\t\tdrillsIn: true,\n\t\t\t\t\t\ticon: sourceIcon(s) ?? action?.icon,\n\t\t\t\t\t\tonActivate: () => setSource(s),\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t}\n\t\tconst q = search.trim().toLowerCase();\n\t\tconst leaves: PickerRowModel[] = tools\n\t\t\t.filter((t) => (metaOf(t)?.source ?? 'other') === source)\n\t\t\t.filter((t) => !q || rowLabel(t).toLowerCase().includes(q))\n\t\t\t.map((item) => ({\n\t\t\t\tid: String(item.id),\n\t\t\t\tlabel: rowLabel(item),\n\t\t\t\tdrillsIn: false,\n\t\t\t\tauthRequired: metaOf(item)?.authRequired,\n\t\t\t\tonActivate: () => onSelect(item),\n\t\t\t}));\n\t\t// A configurable source's add row, below any existing instances, opening\n\t\t// its drawer. Config tools (Slack / email) are a single fixed capability →\n\t\t// render like a normal tool leaf (label only, no icon — matching the tool\n\t\t// rows). Rest API instances are user-created, so its \"add\" stays a\n\t\t// brand-coloured create row.\n\t\tconst action = actionBySource.get(source);\n\t\tif (action) {\n\t\t\tconst isConfigTool = source in CONFIG_TOOL_SOURCES;\n\t\t\tleaves.push({\n\t\t\t\tid: `create:${source}`,\n\t\t\t\tlabel: action.label,\n\t\t\t\tdrillsIn: false,\n\t\t\t\tisCreate: !isConfigTool,\n\t\t\t\tonActivate: () => {\n\t\t\t\t\tonClose?.();\n\t\t\t\t\taction.onSelect();\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\treturn leaves;\n\t}, [\n\t\tactiveCategory,\n\t\tavailableCategories,\n\t\tsource,\n\t\tsearch,\n\t\ttools,\n\t\tsubAgents,\n\t\tsources,\n\t\tonSelect,\n\t\tonClose,\n\t\tonCreateSubAgent,\n\t\ttoolActions,\n\t\tactionBySource,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t]);\n\n\t// Reset highlight whenever the view (or filtered result set) changes.\n\tuseEffect(() => setActiveIndex(-1), [activeCategory, source, search, items]);\n\t// Clear the search box when leaving a source view.\n\tuseEffect(() => setSearch(''), [activeCategory, source]);\n\n\t// Keep the latest rows/index reachable from the stable key handler.\n\tconst navRef = useRef({ rows, activeIndex, header });\n\tnavRef.current = { rows, activeIndex, header };\n\n\tuseEffect(() => {\n\t\tif (!registerKeyHandler) {\n\t\t\treturn;\n\t\t}\n\t\tregisterKeyHandler((event) => {\n\t\t\tconst { rows: r, activeIndex: i, header: h } = navRef.current;\n\t\t\tswitch (event.key) {\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tif (r.length) setActiveIndex((p) => (p + 1) % r.length);\n\t\t\t\t\treturn true;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tif (r.length) setActiveIndex((p) => (p + r.length - 1) % r.length);\n\t\t\t\t\treturn true;\n\t\t\t\tcase 'ArrowRight':\n\t\t\t\tcase 'Enter':\n\t\t\t\t\t// Nothing highlighted yet → treat the first row as the target so\n\t\t\t\t\t// the editor's @-flow (type, then Enter) still works.\n\t\t\t\t\t(r[i] ?? r[0])?.onActivate();\n\t\t\t\t\treturn true;\n\t\t\t\tcase 'ArrowLeft':\n\t\t\t\t\tif (h?.onBack) {\n\t\t\t\t\t\th.onBack();\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\treturn () => registerKeyHandler(null);\n\t}, [registerKeyHandler]);\n\n\tconst variant = !activeCategory\n\t\t? 'categories'\n\t\t: rows.length && !rows[0].drillsIn\n\t\t? 'items'\n\t\t: 'sources';\n\n\t// Search lives inside a source's tool list (Manifest / Shopify) and in the\n\t// sub-agent list.\n\tconst showSearch =\n\t\t(activeCategory === 'tool' && !!source) || activeCategory === 'subagent';\n\n\treturn (\n\t\t<PickerCard className={`bik-mention-picker bik-mention-picker--${variant}`}>\n\t\t\t{header && (\n\t\t\t\t<PickerBack\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={header.onBack}\n\t\t\t\t\tdisabled={!header.onBack}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbackground: COLORS.surface.subdued,\n\t\t\t\t\t\tcursor: header.onBack ? 'pointer' : 'default',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{header.onBack && (\n\t\t\t\t\t\t<SvgArrowLeft\n\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\tcolor={COLORS.content.primary}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{header.icon && renderSourceIcon(header.icon)}\n\t\t\t\t\t<TitleSmall> {header.title}</TitleSmall>\n\t\t\t\t</PickerBack>\n\t\t\t)}\n\t\t\t{showSearch && (\n\t\t\t\t<PickerSearchRow>\n\t\t\t\t\t<SearchIcon\n\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\theight={20}\n\t\t\t\t\t\tcolor={COLORS.content.placeholder}\n\t\t\t\t\t/>\n\t\t\t\t\t<PickerSearchInput\n\t\t\t\t\t\t// Focus on open so the user can type immediately (appears only\n\t\t\t\t\t\t// after they drill into a source).\n\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tvalue={search}\n\t\t\t\t\t\tplaceholder=\"Search\"\n\t\t\t\t\t\tdata-test=\"mention-picker-search\"\n\t\t\t\t\t\tonChange={(e) => setSearch(e.target.value)}\n\t\t\t\t\t\tonKeyDown={(e) => {\n\t\t\t\t\t\t\tif (!rows.length) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tsetActiveIndex((p) => (p + 1) % rows.length);\n\t\t\t\t\t\t\t} else if (e.key === 'ArrowUp') {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tsetActiveIndex((p) => (p + rows.length - 1) % rows.length);\n\t\t\t\t\t\t\t} else if (e.key === 'Enter') {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t(rows[activeIndex] ?? rows[0])?.onActivate();\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</PickerSearchRow>\n\t\t\t)}\n\t\t\t{rows.length === 0 ? (\n\t\t\t\t<PickerEmpty>\n\t\t\t\t\t{activeCategory === 'subagent' ? null : 'No tools available'}\n\t\t\t\t</PickerEmpty>\n\t\t\t) : (\n\t\t\t\trows.map((row, i) => (\n\t\t\t\t\t<PickerRow\n\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t$active={i === activeIndex}\n\t\t\t\t\t\tonMouseEnter={() => setActiveIndex(i)}\n\t\t\t\t\t\tonMouseLeave={() => setActiveIndex(-1)}\n\t\t\t\t\t\tonClick={row.onActivate}\n\t\t\t\t\t>\n\t\t\t\t\t\t{row.isCreate ? (\n\t\t\t\t\t\t\t<CreateRowText>{row.label}</CreateRowText>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<PickerRowMain>\n\t\t\t\t\t\t\t\t\t{renderSourceIcon(row.icon)}\n\t\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t\t{row.label}\n\t\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t\t{row.authRequired && (\n\t\t\t\t\t\t\t\t\t\t<Shield\n\t\t\t\t\t\t\t\t\t\t\tsize={14}\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"This tool requires customer verification\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</PickerRowMain>\n\t\t\t\t\t\t\t\t{row.rightLabel ? (\n\t\t\t\t\t\t\t\t\t<RightActionText>{row.rightLabel}</RightActionText>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\trow.drillsIn && <ChevronRight width={12} height={12} />\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</PickerRow>\n\t\t\t\t))\n\t\t\t)}\n\t\t\t{rows.some((row) => row.authRequired) && (\n\t\t\t\t<PickerLegend>\n\t\t\t\t\t<Shield size={14} />\n\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\tThis tool requires customer verification\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t</PickerLegend>\n\t\t\t)}\n\t\t</PickerCard>\n\t);\n};\n\nconst PickerCard = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-width: 240px;\n\tmax-height: 301px;\n\toverflow-y: auto;\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tbox-shadow: 0px -2px 8px 0px #0000001f;\n`;\n\n// Search box at the top of a source's tool list (Manifest / Shopify).\nconst PickerSearchRow = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 10px 12px;\n\tborder-bottom: 1px solid ${COLORS.stroke.primary};\n`;\n\nconst PickerSearchInput = styled.input`\n\tflex: 1;\n\tmin-width: 0;\n\tborder: none;\n\toutline: none;\n\tbackground: transparent;\n\tfont-family: Inter;\n\tfont-size: 14px;\n\tcolor: ${COLORS.content.primary};\n\n\t&::placeholder {\n\t\tcolor: ${COLORS.content.placeholder};\n\t}\n`;\n\nconst PickerRow = styled.button<{ $active?: boolean }>`\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tgap: 2px;\n\twidth: 100%;\n\tpadding: 8px 10px;\n\theight: 48px;\n\tborder: none;\n\tborder-bottom: 1px solid ${COLORS.stroke.primary};\n\tbackground: ${(p) => (p.$active ? COLORS.surface.subdued : 'transparent')};\n\tcursor: pointer;\n\ttext-align: left;\n\n\t&:hover {\n\t\tbackground: ${COLORS.surface.hovered};\n\t}\n`;\n\n// Left cluster: leading source glyph + label (chevron stays right via PickerRow).\nconst PickerRowMain = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n\tmin-width: 0;\n`;\n\n// Footer legend, shown when the list holds any auth-required tool.\nconst PickerLegend = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tpadding: 8px 12px;\n\tborder-top: 1px solid ${COLORS.stroke.primary};\n`;\n\n// Right-aligned brand action text (e.g. \"Connect\") in place of the chevron.\nconst RightActionText = styled.span`\n\tflex-shrink: 0;\n\tcolor: ${COLORS.content.brand};\n\tfont-family: Inter;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\twhite-space: nowrap;\n`;\n\n// \"Create new\" — centered brand text, no icon (matches the side-panel dropdown).\nconst CreateRowText = styled.div`\n\twidth: 100%;\n\ttext-align: center;\n\tcolor: ${COLORS.content.brand};\n\tfont-family: Inter;\n\tfont-size: 14px;\n\tfont-weight: 600;\n`;\n\nconst PickerBack = styled.button`\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: 12px 16px;\n\tborder: none;\n\tborder-bottom: 1px solid ${COLORS.stroke.primary};\n\tbackground: transparent;\n\tcursor: pointer;\n\tfont-family: Inter;\n\tfont-size: 12px;\n\tfont-weight: 600;\n\theight: 48px;\n\tgap: 4px;\n`;\n\nconst PickerEmpty = styled.div`\n\tpadding: 12px 10px;\n\tfont-family: Inter;\n\tfont-size: 13px;\n\tcolor: ${COLORS.content.secondary};\n`;\n"],"names":["metaOf","item","rowLabel","CREATE_SUBAGENT_ID","MentionPicker","items","onSelect","registerKeyHandler","onClose","onCreateSubAgent","initialSource","toolActions","integrationStatus","onConnectIntegration","category","setCategory","useState","source","setSource","activeIndex","setActiveIndex","search","setSearch","tools","useMemo","i","subAgents","sources","acc","t","s","actionBySource","a","availableCategories","CATEGORIES","c","soleCategory","activeCategory","header","toolSourceLabel","sourceIcon","rows","sq","leaves","actionOnly","b","toolSourceRank","action","instances","icon","only","q","isConfigTool","CONFIG_TOOL_SOURCES","useEffect","navRef","useRef","event","h","p","variant","showSearch","jsxs","PickerCard","PickerBack","COLORS","jsx","SvgArrowLeft","renderSourceIcon","TitleSmall","PickerSearchRow","SearchIcon","PickerSearchInput","PickerEmpty","row","PickerRow","CreateRowText","Fragment","PickerRowMain","BodySecondary","Shield","RightActionText","ChevronRight","PickerLegend","BodyCaption","styled"],"mappings":"mpBA0BMA,EAAUC,GACfA,EAAK,KAEAC,EAAYD,GACjBD,EAAOC,CAAI,GAAG,YAAcA,EAAK,MAuB5BE,GAAqB,0BA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B,EAAAA,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA,EAMxBD,GAAaqB,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,4BAKEpB,EAAAA,OAAO,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU3CQ,GAAcY,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA,UAIjBpB,EAAAA,OAAO,QAAQ,SAAS;AAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../TypographyStyle.js"),t=require("../../../constants/Theme.js"),n=require("../AgentBuilder.styled.js"),d=require("../../modals/styledModal.js"),c=require("../../../icons/Informational/eCommerce/ShieldCheck.js"),o=require("../../button/Button.js"),u=({open:s,toolLabel:l,onCancel:i,onConfirm:a})=>s?e.jsx(d.StyledModal,{"data-test":"agent-require-verification-modal",open:!0,onClose:i,width:"480px",children:e.jsxs(n.ModalBody,{style:{alignItems:"center",textAlign:"center"},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:48,height:48,borderRadius:"50%",background:t.COLORS.background.brandVeryLight},children:e.jsx(c.default,{size:24,color:t.COLORS.content.brand})}),e.jsx(r.TitleMedium,{color:t.COLORS.content.primary,children:"This will change who can use this agent"}),e.jsxs(r.BodyPrimary,{color:t.COLORS.content.secondary,style:{lineHeight:"24px"},children:["‘",l,"’ always requires customer authentication. Customers will be asked to verify their identity before this agent responds, once you go live."]}),e.jsxs(n.ModalActions,{children:[e.jsx("div",{style:{display:"flex"},children:e.jsx(o.Button,{"data-test":"agent-require-verification-cancel",buttonType:"secondary",size:"medium",matchParentWidth:!0,buttonText:"Cancel",onClick:i})}),e.jsx("div",{style:{display:"flex"},children:e.jsx(o.Button,{"data-test":"agent-require-verification-confirm",buttonType:"primary",size:"medium",matchParentWidth:!0,buttonText:"Add tool",onClick:a})})]})]})}):null;exports.RequireVerificationModal=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../../TypographyStyle.js"),t=require("../../../constants/Theme.js"),r=require("../AgentBuilder.styled.js"),d=require("../../modals/styledModal.js"),c=require("../../../icons/Informational/Common UI/ShieldOutline.js"),o=require("../../button/Button.js"),u=({open:s,toolLabel:l,onCancel:i,onConfirm:a})=>s?e.jsx(d.StyledModal,{"data-test":"agent-require-verification-modal",open:!0,onClose:i,width:"480px",children:e.jsxs(r.ModalBody,{style:{alignItems:"center",textAlign:"center"},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:48,height:48,borderRadius:"50%",background:t.COLORS.background.brandVeryLight},children:e.jsx(c.default,{size:24,color:t.COLORS.content.brand})}),e.jsx(n.TitleMedium,{color:t.COLORS.content.primary,children:"This will change who can use this agent"}),e.jsxs(n.BodyPrimary,{color:t.COLORS.content.secondary,style:{lineHeight:"24px"},children:["‘",l,"’ always requires customer authentication. Customers will be asked to verify their identity before this agent responds, once you go live."]}),e.jsxs(r.ModalActions,{children:[e.jsx("div",{style:{display:"flex"},children:e.jsx(o.Button,{"data-test":"agent-require-verification-cancel",buttonType:"secondary",size:"medium",matchParentWidth:!0,buttonText:"Cancel",onClick:i})}),e.jsx("div",{style:{display:"flex"},children:e.jsx(o.Button,{"data-test":"agent-require-verification-confirm",buttonType:"primary",size:"medium",matchParentWidth:!0,buttonText:"Add tool",onClick:a})})]})]})}):null;exports.RequireVerificationModal=u;
2
2
  //# sourceMappingURL=RequireVerificationModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequireVerificationModal.js","sources":["../../../../../src/components/agent-builder/components/RequireVerificationModal.tsx"],"sourcesContent":["import { ShieldCheck } from '@src/icons';\nimport React from 'react';\nimport { Button } from '@src/components/button';\nimport { StyledModal } from '@src/components/modals';\nimport { BodyPrimary, TitleMedium } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { ModalActions, ModalBody } from '../AgentBuilder.styled';\n\ninterface RequireVerificationModalProps {\n\topen: boolean;\n\t/** Name of the tool being added (shown in the copy). */\n\ttoolLabel: string;\n\t/** Dismiss without adding the tool (X / outside click / Cancel). */\n\tonCancel: () => void;\n\t/** Turn on customer verification and add the tool. */\n\tonConfirm: () => void;\n}\n\n/**\n * Shown when the merchant attaches a tool that touches customer-private data\n * (`auth_required`) while customer verification is off. Verification is mandatory\n * for such tools — confirming (\"Add tool\") turns it on and adds the tool;\n * cancelling skips the add. Centred layout per Figma (node 1165-21717).\n */\nexport const RequireVerificationModal: React.FC<\n\tRequireVerificationModalProps\n> = ({ open, toolLabel, onCancel, onConfirm }) => {\n\tif (!open) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-require-verification-modal\"\n\t\t\topen\n\t\t\tonClose={onCancel}\n\t\t\twidth=\"480px\"\n\t\t>\n\t\t\t<ModalBody style={{ alignItems: 'center', textAlign: 'center' }}>\n\t\t\t\t<span\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\twidth: 48,\n\t\t\t\t\t\theight: 48,\n\t\t\t\t\t\tborderRadius: '50%',\n\t\t\t\t\t\tbackground: COLORS.background.brandVeryLight,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<ShieldCheck size={24} color={COLORS.content.brand} />\n\t\t\t\t</span>\n\t\t\t\t<TitleMedium color={COLORS.content.primary}>\n\t\t\t\t\tThis will change who can use this agent\n\t\t\t\t</TitleMedium>\n\t\t\t\t<BodyPrimary\n\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\tstyle={{ lineHeight: '24px' }}\n\t\t\t\t>\n\t\t\t\t\t‘{toolLabel}’ always requires customer authentication. Customers will\n\t\t\t\t\tbe asked to verify their identity before this agent responds, once you\n\t\t\t\t\tgo live.\n\t\t\t\t</BodyPrimary>\n\n\t\t\t\t<ModalActions>\n\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdata-test=\"agent-require-verification-cancel\"\n\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\tbuttonText=\"Cancel\"\n\t\t\t\t\t\t\tonClick={onCancel}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdata-test=\"agent-require-verification-confirm\"\n\t\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\tbuttonText=\"Add tool\"\n\t\t\t\t\t\t\tonClick={onConfirm}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</ModalActions>\n\t\t\t</ModalBody>\n\t\t</StyledModal>\n\t);\n};\n"],"names":["RequireVerificationModal","open","toolLabel","onCancel","onConfirm","jsx","StyledModal","jsxs","ModalBody","COLORS","ShieldCheck","TitleMedium","BodyPrimary","ModalActions","Button"],"mappings":"2XAwBaA,EAET,CAAC,CAAE,KAAAC,EAAM,UAAAC,EAAW,SAAAC,EAAU,UAAAC,KAC5BH,EAKJI,EAAAA,IAACC,EAAAA,YAAA,CACA,YAAU,mCACV,KAAI,GACJ,QAASH,EACT,MAAM,QAEN,SAAAI,EAAAA,KAACC,aAAU,MAAO,CAAE,WAAY,SAAU,UAAW,UACpD,SAAA,CAAAH,EAAAA,IAAC,OAAA,CACA,MAAO,CACN,QAAS,cACT,WAAY,SACZ,eAAgB,SAChB,MAAO,GACP,OAAQ,GACR,aAAc,MACd,WAAYI,EAAAA,OAAO,WAAW,cAAA,EAG/B,eAACC,EAAAA,QAAA,CAAY,KAAM,GAAI,MAAOD,EAAAA,OAAO,QAAQ,KAAA,CAAO,CAAA,CAAA,QAEpDE,EAAAA,YAAA,CAAY,MAAOF,EAAAA,OAAO,QAAQ,QAAS,SAAA,0CAE5C,EACAF,EAAAA,KAACK,EAAAA,YAAA,CACA,MAAOH,EAAAA,OAAO,QAAQ,UACtB,MAAO,CAAE,WAAY,MAAA,EACrB,SAAA,CAAA,IACEP,EAAU,2IAAA,CAAA,CAAA,SAKZW,EAAAA,aAAA,CACA,SAAA,CAAAR,EAAAA,IAAC,MAAA,CAAI,MAAO,CAAE,QAAS,QACtB,SAAAA,EAAAA,IAACS,EAAAA,OAAA,CACA,YAAU,oCACV,WAAW,YACX,KAAK,SACL,iBAAgB,GAChB,WAAW,SACX,QAASX,CAAA,CAAA,EAEX,QACC,MAAA,CAAI,MAAO,CAAE,QAAS,QACtB,SAAAE,EAAAA,IAACS,EAAAA,OAAA,CACA,YAAU,qCACV,WAAW,UACX,KAAK,SACL,iBAAgB,GAChB,WAAW,WACX,QAASV,CAAA,CAAA,CACV,CACD,CAAA,CAAA,CACD,CAAA,CAAA,CACD,CAAA,CAAA,EA1DM"}
1
+ {"version":3,"file":"RequireVerificationModal.js","sources":["../../../../../src/components/agent-builder/components/RequireVerificationModal.tsx"],"sourcesContent":["import { ShieldOutline } from '@src/icons';\nimport React from 'react';\nimport { Button } from '@src/components/button';\nimport { StyledModal } from '@src/components/modals';\nimport { BodyPrimary, TitleMedium } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { ModalActions, ModalBody } from '../AgentBuilder.styled';\n\ninterface RequireVerificationModalProps {\n\topen: boolean;\n\t/** Name of the tool being added (shown in the copy). */\n\ttoolLabel: string;\n\t/** Dismiss without adding the tool (X / outside click / Cancel). */\n\tonCancel: () => void;\n\t/** Turn on customer verification and add the tool. */\n\tonConfirm: () => void;\n}\n\n/**\n * Shown when the merchant attaches a tool that touches customer-private data\n * (`auth_required`) while customer verification is off. Verification is mandatory\n * for such tools — confirming (\"Add tool\") turns it on and adds the tool;\n * cancelling skips the add. Centred layout per Figma (node 1165-21717).\n */\nexport const RequireVerificationModal: React.FC<\n\tRequireVerificationModalProps\n> = ({ open, toolLabel, onCancel, onConfirm }) => {\n\tif (!open) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-require-verification-modal\"\n\t\t\topen\n\t\t\tonClose={onCancel}\n\t\t\twidth=\"480px\"\n\t\t>\n\t\t\t<ModalBody style={{ alignItems: 'center', textAlign: 'center' }}>\n\t\t\t\t<span\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\twidth: 48,\n\t\t\t\t\t\theight: 48,\n\t\t\t\t\t\tborderRadius: '50%',\n\t\t\t\t\t\tbackground: COLORS.background.brandVeryLight,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<ShieldOutline size={24} color={COLORS.content.brand} />\n\t\t\t\t</span>\n\t\t\t\t<TitleMedium color={COLORS.content.primary}>\n\t\t\t\t\tThis will change who can use this agent\n\t\t\t\t</TitleMedium>\n\t\t\t\t<BodyPrimary\n\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\tstyle={{ lineHeight: '24px' }}\n\t\t\t\t>\n\t\t\t\t\t‘{toolLabel}’ always requires customer authentication. Customers will\n\t\t\t\t\tbe asked to verify their identity before this agent responds, once you\n\t\t\t\t\tgo live.\n\t\t\t\t</BodyPrimary>\n\n\t\t\t\t<ModalActions>\n\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdata-test=\"agent-require-verification-cancel\"\n\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\tbuttonText=\"Cancel\"\n\t\t\t\t\t\t\tonClick={onCancel}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdata-test=\"agent-require-verification-confirm\"\n\t\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\tbuttonText=\"Add tool\"\n\t\t\t\t\t\t\tonClick={onConfirm}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</ModalActions>\n\t\t\t</ModalBody>\n\t\t</StyledModal>\n\t);\n};\n"],"names":["RequireVerificationModal","open","toolLabel","onCancel","onConfirm","jsx","StyledModal","jsxs","ModalBody","COLORS","ShieldOutline","TitleMedium","BodyPrimary","ModalActions","Button"],"mappings":"6XAwBaA,EAET,CAAC,CAAE,KAAAC,EAAM,UAAAC,EAAW,SAAAC,EAAU,UAAAC,KAC5BH,EAKJI,EAAAA,IAACC,EAAAA,YAAA,CACA,YAAU,mCACV,KAAI,GACJ,QAASH,EACT,MAAM,QAEN,SAAAI,EAAAA,KAACC,aAAU,MAAO,CAAE,WAAY,SAAU,UAAW,UACpD,SAAA,CAAAH,EAAAA,IAAC,OAAA,CACA,MAAO,CACN,QAAS,cACT,WAAY,SACZ,eAAgB,SAChB,MAAO,GACP,OAAQ,GACR,aAAc,MACd,WAAYI,EAAAA,OAAO,WAAW,cAAA,EAG/B,eAACC,EAAAA,QAAA,CAAc,KAAM,GAAI,MAAOD,EAAAA,OAAO,QAAQ,KAAA,CAAO,CAAA,CAAA,QAEtDE,EAAAA,YAAA,CAAY,MAAOF,EAAAA,OAAO,QAAQ,QAAS,SAAA,0CAE5C,EACAF,EAAAA,KAACK,EAAAA,YAAA,CACA,MAAOH,EAAAA,OAAO,QAAQ,UACtB,MAAO,CAAE,WAAY,MAAA,EACrB,SAAA,CAAA,IACEP,EAAU,2IAAA,CAAA,CAAA,SAKZW,EAAAA,aAAA,CACA,SAAA,CAAAR,EAAAA,IAAC,MAAA,CAAI,MAAO,CAAE,QAAS,QACtB,SAAAA,EAAAA,IAACS,EAAAA,OAAA,CACA,YAAU,oCACV,WAAW,YACX,KAAK,SACL,iBAAgB,GAChB,WAAW,SACX,QAASX,CAAA,CAAA,EAEX,QACC,MAAA,CAAI,MAAO,CAAE,QAAS,QACtB,SAAAE,EAAAA,IAACS,EAAAA,OAAA,CACA,YAAU,qCACV,WAAW,UACX,KAAK,SACL,iBAAgB,GAChB,WAAW,WACX,QAASV,CAAA,CAAA,CACV,CACD,CAAA,CAAA,CACD,CAAA,CAAA,CACD,CAAA,CAAA,EA1DM"}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),oe=require("../../../assets/icons/delete.svg.js"),te=require("../../../assets/icons/edit.svg.js"),W=require("../../../assets/icons/plus.svg.js"),u=require("react"),le=require("styled-components"),a=require("../../TypographyStyle.js"),i=require("../../../constants/Theme.js"),d=require("../AgentBuilder.styled.js"),w=require("../utils/sourceIcons.js"),ce=require("./MentionPicker.js"),K=require("../../dropdown/Dropdown.js"),T=require("../../dropdown/utils.js"),re=require("../../button/Button.js"),se=require("../../states-modal/DeleteConfirmationModal.js"),g=require("../../tooltips/Tooltip.js"),ie=require("../../../icons/Informational/Common UI/Shield.js"),de=r=>r&&typeof r=="object"&&"default"in r?r:{default:r},m=de(le),U="__bik_create_new__",ue=({title:r,helper:L,items:S,addableOptions:C,onAdd:$,onRemove:q,dataTestPrefix:t,emptyText:P,createOption:l,onConfigure:B,sourceGroups:f,mentionItems:_,actionSources:j,confirmDelete:y,pickerOpensUp:D})=>{const[p,c]=u.useState(!1),[I,v]=u.useState(null),[A,O]=u.useState(null),[Q,R]=u.useState(null),x=!!f&&f.length>0,k=f?.find(e=>e.source===Q),s=_!==void 0,E=u.useRef(null),z=u.useRef(null),[b,M]=u.useState(null);u.useEffect(()=>{if(!s||!p)return;const e=h=>{const V=h.target;!E.current?.contains(V)&&!z.current?.contains(V)&&c(!1)},o=h=>{h.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",o)}},[s,p]);const X=x?s||S.length>0:s||C.length>0||!!l&&S.length>0,Y=S.length===0&&!!l&&!x&&!s,H=!!j&&j.length>0,Z=(x||H)&&S.length===0,G=()=>{if(s){M(null),c(e=>!e);return}if(x){R(null),c(e=>!e);return}if(C.length===0&&l){l.onSelect();return}c(e=>!e)},ee=(e,o)=>{if(A)return;const h=o();h&&typeof h.then=="function"&&(O(e),h.finally(()=>O(null)))},ne=()=>S.map(e=>{const o=e.onConfigure??(B?()=>B(e.id):void 0);return n.jsxs(d.SelectableRow,{"data-test":`${t}-row-${e.id}`,children:[w.renderSourceIcon(e.icon),e.authRequired&&n.jsx(g.Tooltip,{body:"Requires customer verification",placement:"top",children:n.jsx("span",{"data-test":`${t}-auth-${e.id}`,style:{display:"inline-flex",flexShrink:0},children:n.jsx(ie.default,{size:16})})}),n.jsx(g.Tooltip,{body:e.label,placement:"top",children:n.jsx(d.RowText,{children:n.jsx(a.BodySecondary,{numberOfLines:1,color:i.COLORS.content.primary,children:e.label})})}),n.jsxs(d.RowActions,{children:[o&&n.jsx(g.Tooltip,{body:"Edit",placement:"top",children:n.jsx(d.RowMenuButton,{"data-test":`${t}-edit-${e.id}`,"aria-label":`Edit ${e.label}`,disabled:A!==null,onClick:()=>ee(e.id,o),children:n.jsx(te.default,{width:16,height:16,color:i.COLORS.content.secondary})})}),o&&n.jsx(d.RowActionDivider,{"aria-hidden":!0}),n.jsx(g.Tooltip,{body:"Delete",placement:"top",children:n.jsx(d.RowMenuButton,{"data-test":`${t}-delete-${e.id}`,"aria-label":`Delete ${e.label}`,onClick:()=>y?v(e.id):q(e.id),children:n.jsx(oe.default,{width:16,height:16,color:i.COLORS.content.secondary})})})]})]},e.id)}),F=l?[...C,{label:l.label,value:U,searchKey:l.label,customComponent:n.jsx("div",{style:{width:"100%",textAlign:"center",color:i.COLORS.content.brand,fontFamily:"Inter",fontSize:14,fontWeight:600},children:l.label})}]:C,N=s?n.jsx(ce.MentionPicker,{items:_??[],query:"",activeIndex:0,initialSource:b??void 0,onSelect:e=>{c(!1),$(String(e.id))},onClose:()=>c(!1),onCreateSubAgent:l?()=>{c(!1),l.onSelect()}:void 0,toolActions:H?j?.map(e=>({...e,onSelect:()=>{c(!1),e.onSelect()}})):void 0,integrationStatus:Object.fromEntries((f??[]).filter(e=>e.connected!==void 0).map(e=>[e.source,e.connected])),onConnectIntegration:e=>{c(!1),f?.find(o=>o.source===e)?.onConnect?.()}},b??"__root__"):null;return n.jsxs(d.SideSection,{children:[n.jsxs(d.SideSectionHeader,{children:[n.jsx(a.TitleSmall,{color:i.COLORS.content.primary,children:r}),X&&n.jsxs(ae,{ref:E,children:[n.jsx(d.AddIconButton,{"data-test":`${t}-add`,onClick:G,"aria-label":`Add ${r}`,children:n.jsx(W.default,{width:16,height:16,color:i.COLORS.content.primary})}),s&&p&&b===null&&n.jsx(J,{$up:D,"data-test":`${t}-picker`,children:N})]})]}),L&&n.jsx(a.BodyCaption,{color:i.COLORS.content.secondary,children:L}),Z?n.jsxs(he,{ref:s?z:void 0,children:[n.jsxs(d.SourceButtonRow,{"data-test":`${t}-sources`,children:[f?.map(e=>n.jsxs(d.SourceButton,{type:"button","data-test":`${t}-source-${e.source}`,onClick:()=>{if(e.connected===!1){e.onConnect?.();return}if(s){M(e.source),c(!0);return}R(e.source)},children:[w.renderSourceIcon(w.SOURCE_ICONS[e.source],-4),n.jsx(a.BodyCaption,{color:i.COLORS.content.primary,children:e.label}),e.connected===!1&&n.jsx(a.BodySecondary,{color:i.COLORS.content.brand,children:"Connect"})]},e.source)),j?.map(e=>n.jsxs(d.SourceButton,{type:"button","data-test":`${t}-action-${e.source}`,onClick:e.connected===!1?()=>e.onConnect?.():()=>{c(!1),e.onSelect()},children:[w.renderSourceIcon(e.icon,-4),n.jsx(a.BodyCaption,{color:i.COLORS.content.primary,children:e.label}),e.connected===!1&&n.jsx(a.BodySecondary,{color:i.COLORS.content.brand,children:"Connect"})]},e.source))]}),s&&p&&b!==null&&n.jsx(J,{$align:"left",$up:D,"data-test":`${t}-picker`,children:N}),!s&&k&&n.jsx(K.Dropdown,{"data-test":`${t}-dropdown`,size:"small",width:"100%",isSearchable:!0,placeHolder:`Search ${k.label} tools`,options:k.options,onSelect:e=>{const o=T.unwrapDropdownValue(e);R(null),c(!1),o&&$(o)}})]}):n.jsxs(n.Fragment,{children:[!s&&p&&F.length>0&&n.jsx(K.Dropdown,{"data-test":`${t}-dropdown`,size:"small",width:"100%",isSearchable:!0,placeHolder:`Select ${r.toLowerCase()}`,options:F,onSelect:e=>{const o=T.unwrapDropdownValue(e);c(!1),o&&(o===U?l?.onSelect():$(o))}}),S.length===0&&!p?n.jsxs(n.Fragment,{children:[n.jsx(a.BodyCaption,{color:i.COLORS.content.placeholder,children:P}),Y&&l&&n.jsx(re.Button,{"data-test":`${t}-create`,buttonType:"secondary",size:"small",matchParentWidth:!0,LeadingIcon:W.default,buttonText:l.label,onClick:l.onSelect})]}):ne()]}),y&&I&&n.jsx(se.DeleteConfirmationModal,{"data-test":`${t}-delete-confirm`,header:`Delete this ${y.noun}?`,subHeader:`Deleting this ${y.noun} will also remove it from your instructions, wherever it's referenced.`,confirmationText:"Delete",zIndex:y.zIndex,onDeleteConfirmed:()=>{q(I),v(null)},onCancelClicked:()=>v(null)})]})},ae=m.default.div`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),oe=require("../../../assets/icons/delete.svg.js"),te=require("../../../assets/icons/edit.svg.js"),V=require("../../../assets/icons/plus.svg.js"),u=require("react"),le=require("styled-components"),a=require("../../TypographyStyle.js"),d=require("../../../constants/Theme.js"),i=require("../AgentBuilder.styled.js"),w=require("../utils/sourceIcons.js"),ce=require("./MentionPicker.js"),W=require("../../dropdown/Dropdown.js"),K=require("../../dropdown/utils.js"),re=require("../../button/Button.js"),se=require("../../states-modal/DeleteConfirmationModal.js"),g=require("../../tooltips/Tooltip.js"),ie=require("../../../icons/Informational/Common UI/Shield.js"),de=r=>r&&typeof r=="object"&&"default"in r?r:{default:r},m=de(le),U="__bik_create_new__",ue=({title:r,helper:L,items:S,addableOptions:C,onAdd:$,onRemove:q,dataTestPrefix:t,emptyText:P,createOption:l,onConfigure:B,sourceGroups:f,mentionItems:_,actionSources:j,confirmDelete:y,pickerOpensUp:D})=>{const[p,c]=u.useState(!1),[I,v]=u.useState(null),[A,O]=u.useState(null),[Q,R]=u.useState(null),x=!!f&&f.length>0,k=f?.find(e=>e.source===Q),s=_!==void 0,E=u.useRef(null),z=u.useRef(null),[b,M]=u.useState(null);u.useEffect(()=>{if(!s||!p)return;const e=h=>{const T=h.target;!E.current?.contains(T)&&!z.current?.contains(T)&&c(!1)},o=h=>{h.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",o)}},[s,p]);const X=x?s||S.length>0:s||C.length>0||!!l&&S.length>0,Y=S.length===0&&!!l&&!x&&!s,H=!!j&&j.length>0,Z=(x||H)&&S.length===0,G=()=>{if(s){M(null),c(e=>!e);return}if(x){R(null),c(e=>!e);return}if(C.length===0&&l){l.onSelect();return}c(e=>!e)},ee=(e,o)=>{if(A)return;const h=o();h&&typeof h.then=="function"&&(O(e),h.finally(()=>O(null)))},ne=()=>S.map(e=>{const o=e.onConfigure??(B?()=>B(e.id):void 0);return n.jsxs(i.SelectableRow,{"data-test":`${t}-row-${e.id}`,children:[w.renderSourceIcon(e.icon),n.jsxs(i.RowLabel,{children:[n.jsx(g.Tooltip,{body:e.label,placement:"top",children:n.jsx(i.RowText,{children:n.jsx(a.BodySecondary,{numberOfLines:1,color:d.COLORS.content.primary,children:e.label})})}),e.authRequired&&n.jsx(g.Tooltip,{body:"This tool requires customer verification",placement:"top",children:n.jsx("span",{"data-test":`${t}-auth-${e.id}`,style:{display:"inline-flex",flexShrink:0},children:n.jsx(ie.default,{size:16})})})]}),n.jsxs(i.RowActions,{children:[o&&n.jsx(g.Tooltip,{body:"Edit",placement:"top",children:n.jsx(i.RowMenuButton,{"data-test":`${t}-edit-${e.id}`,"aria-label":`Edit ${e.label}`,disabled:A!==null,onClick:()=>ee(e.id,o),children:n.jsx(te.default,{width:16,height:16,color:d.COLORS.content.secondary})})}),o&&n.jsx(i.RowActionDivider,{"aria-hidden":!0}),n.jsx(g.Tooltip,{body:"Delete",placement:"top",children:n.jsx(i.RowMenuButton,{"data-test":`${t}-delete-${e.id}`,"aria-label":`Delete ${e.label}`,onClick:()=>y?v(e.id):q(e.id),children:n.jsx(oe.default,{width:16,height:16,color:d.COLORS.content.secondary})})})]})]},e.id)}),F=l?[...C,{label:l.label,value:U,searchKey:l.label,customComponent:n.jsx("div",{style:{width:"100%",textAlign:"center",color:d.COLORS.content.brand,fontFamily:"Inter",fontSize:14,fontWeight:600},children:l.label})}]:C,N=s?n.jsx(ce.MentionPicker,{items:_??[],query:"",activeIndex:0,initialSource:b??void 0,onSelect:e=>{c(!1),$(String(e.id))},onClose:()=>c(!1),onCreateSubAgent:l?()=>{c(!1),l.onSelect()}:void 0,toolActions:H?j?.map(e=>({...e,onSelect:()=>{c(!1),e.onSelect()}})):void 0,integrationStatus:Object.fromEntries((f??[]).filter(e=>e.connected!==void 0).map(e=>[e.source,e.connected])),onConnectIntegration:e=>{c(!1),f?.find(o=>o.source===e)?.onConnect?.()}},b??"__root__"):null;return n.jsxs(i.SideSection,{children:[n.jsxs(i.SideSectionHeader,{children:[n.jsx(a.TitleSmall,{color:d.COLORS.content.primary,children:r}),X&&n.jsxs(ae,{ref:E,children:[n.jsx(i.AddIconButton,{"data-test":`${t}-add`,onClick:G,"aria-label":`Add ${r}`,children:n.jsx(V.default,{width:16,height:16,color:d.COLORS.content.primary})}),s&&p&&b===null&&n.jsx(J,{$up:D,"data-test":`${t}-picker`,children:N})]})]}),L&&n.jsx(a.BodyCaption,{color:d.COLORS.content.secondary,children:L}),Z?n.jsxs(he,{ref:s?z:void 0,children:[n.jsxs(i.SourceButtonRow,{"data-test":`${t}-sources`,children:[f?.map(e=>n.jsxs(i.SourceButton,{type:"button","data-test":`${t}-source-${e.source}`,onClick:()=>{if(e.connected===!1){e.onConnect?.();return}if(s){M(e.source),c(!0);return}R(e.source)},children:[w.renderSourceIcon(w.SOURCE_ICONS[e.source],-4),n.jsx(a.BodyCaption,{color:d.COLORS.content.primary,children:e.label}),e.connected===!1&&n.jsx(a.BodySecondary,{color:d.COLORS.content.brand,children:"Connect"})]},e.source)),j?.map(e=>n.jsxs(i.SourceButton,{type:"button","data-test":`${t}-action-${e.source}`,onClick:e.connected===!1?()=>e.onConnect?.():()=>{c(!1),e.onSelect()},children:[w.renderSourceIcon(e.icon,-4),n.jsx(a.BodyCaption,{color:d.COLORS.content.primary,children:e.label}),e.connected===!1&&n.jsx(a.BodySecondary,{color:d.COLORS.content.brand,children:"Connect"})]},e.source))]}),s&&p&&b!==null&&n.jsx(J,{$align:"left",$up:D,"data-test":`${t}-picker`,children:N}),!s&&k&&n.jsx(W.Dropdown,{"data-test":`${t}-dropdown`,size:"small",width:"100%",isSearchable:!0,placeHolder:`Search ${k.label} tools`,options:k.options,onSelect:e=>{const o=K.unwrapDropdownValue(e);R(null),c(!1),o&&$(o)}})]}):n.jsxs(n.Fragment,{children:[!s&&p&&F.length>0&&n.jsx(W.Dropdown,{"data-test":`${t}-dropdown`,size:"small",width:"100%",isSearchable:!0,placeHolder:`Select ${r.toLowerCase()}`,options:F,onSelect:e=>{const o=K.unwrapDropdownValue(e);c(!1),o&&(o===U?l?.onSelect():$(o))}}),S.length===0&&!p?n.jsxs(n.Fragment,{children:[n.jsx(a.BodyCaption,{color:d.COLORS.content.placeholder,children:P}),Y&&l&&n.jsx(re.Button,{"data-test":`${t}-create`,buttonType:"secondary",size:"small",matchParentWidth:!0,LeadingIcon:V.default,buttonText:l.label,onClick:l.onSelect})]}):ne()]}),y&&I&&n.jsx(se.DeleteConfirmationModal,{"data-test":`${t}-delete-confirm`,header:`Delete this ${y.noun}?`,subHeader:`Deleting this ${y.noun} will also remove it from your instructions, wherever it's referenced.`,confirmationText:"Delete",zIndex:y.zIndex,onDeleteConfirmed:()=>{q(I),v(null)},onCancelClicked:()=>v(null)})]})},ae=m.default.div`
2
2
  position: relative;
3
3
  display: flex;
4
4
  `,he=m.default.div`