@bikdotai/bik-component-library 0.0.866 → 0.0.867

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 (137) 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 +151 -29
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/ChannelSelectModal.js +2 -0
  6. package/dist/cjs/components/agent-builder/components/ChannelSelectModal.js.map +1 -0
  7. package/dist/cjs/components/agent-builder/components/ChannelsSection.js +2 -0
  8. package/dist/cjs/components/agent-builder/components/ChannelsSection.js.map +1 -0
  9. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
  10. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
  12. package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/MentionEditor.js +2 -2
  14. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
  16. package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/MentionPicker.js +13 -13
  18. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +3 -3
  20. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/constants/channels.js +2 -0
  22. package/dist/cjs/components/agent-builder/constants/channels.js.map +1 -0
  23. package/dist/cjs/components/agent-builder/constants/steps.js +1 -1
  24. package/dist/cjs/components/agent-builder/constants/steps.js.map +1 -1
  25. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  26. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  27. package/dist/cjs/components/agent-builder/steps/Step1About.js +1 -1
  28. package/dist/cjs/components/agent-builder/steps/Step1About.js.map +1 -1
  29. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +2 -2
  30. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  31. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  32. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  33. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  34. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  35. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +2 -2
  36. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  37. package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
  38. package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
  39. package/dist/cjs/icons/Social/Channels/ManifestGlass.js +2 -0
  40. package/dist/cjs/icons/Social/Channels/ManifestGlass.js.map +1 -0
  41. package/dist/cjs/icons/Social/Channels/ShipStation.js +2 -0
  42. package/dist/cjs/icons/Social/Channels/ShipStation.js.map +1 -0
  43. package/dist/cjs/icons/Social/Channels/Skio.js +2 -0
  44. package/dist/cjs/icons/Social/Channels/Skio.js.map +1 -0
  45. package/dist/cjs/icons/index.js +1 -1
  46. package/dist/cjs/index.js +1 -1
  47. package/dist/esm/components/agent-builder/AgentBuilder.js +103 -97
  48. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  49. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +76 -0
  50. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +68 -0
  51. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +224 -59
  52. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  53. package/dist/esm/components/agent-builder/components/ChannelSelectModal.d.ts +26 -0
  54. package/dist/esm/components/agent-builder/components/ChannelSelectModal.js +121 -0
  55. package/dist/esm/components/agent-builder/components/ChannelSelectModal.js.map +1 -0
  56. package/dist/esm/components/agent-builder/components/ChannelsSection.d.ts +10 -0
  57. package/dist/esm/components/agent-builder/components/ChannelsSection.js +183 -0
  58. package/dist/esm/components/agent-builder/components/ChannelsSection.js.map +1 -0
  59. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +135 -132
  60. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  61. package/dist/esm/components/agent-builder/components/GoLiveModal.js +12 -12
  62. package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
  63. package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +2 -0
  64. package/dist/esm/components/agent-builder/components/MentionEditor.js +47 -45
  65. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  66. package/dist/esm/components/agent-builder/components/MentionField.js +52 -51
  67. package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
  68. package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +5 -0
  69. package/dist/esm/components/agent-builder/components/MentionPicker.js +134 -132
  70. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  71. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +2 -0
  72. package/dist/esm/components/agent-builder/components/SelectableListSection.js +48 -46
  73. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  74. package/dist/esm/components/agent-builder/constants/channels.d.ts +56 -0
  75. package/dist/esm/components/agent-builder/constants/channels.js +41 -0
  76. package/dist/esm/components/agent-builder/constants/channels.js.map +1 -0
  77. package/dist/esm/components/agent-builder/constants/steps.d.ts +31 -1
  78. package/dist/esm/components/agent-builder/constants/steps.js +15 -6
  79. package/dist/esm/components/agent-builder/constants/steps.js.map +1 -1
  80. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +13 -1
  81. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +157 -148
  82. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  83. package/dist/esm/components/agent-builder/index.d.ts +5 -2
  84. package/dist/esm/components/agent-builder/steps/Step1About.js +15 -13
  85. package/dist/esm/components/agent-builder/steps/Step1About.js.map +1 -1
  86. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +55 -48
  87. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  88. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +158 -157
  89. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  90. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.d.ts +11 -0
  91. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +127 -23
  92. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  93. package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +10 -3
  94. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +31 -23
  95. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  96. package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +7 -5
  97. package/dist/esm/components/agent-builder/utils/sourceIcons.js +26 -26
  98. package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
  99. package/dist/esm/icons/Social/Channels/ManifestGlass.d.ts +6 -0
  100. package/dist/esm/icons/Social/Channels/ManifestGlass.js +252 -0
  101. package/dist/esm/icons/Social/Channels/ManifestGlass.js.map +1 -0
  102. package/dist/esm/icons/Social/Channels/ShipStation.d.ts +6 -0
  103. package/dist/esm/icons/Social/Channels/ShipStation.js +31 -0
  104. package/dist/esm/icons/Social/Channels/ShipStation.js.map +1 -0
  105. package/dist/esm/icons/Social/Channels/Skio.d.ts +6 -0
  106. package/dist/{cjs/assets/icons/Skio.svg.js → esm/icons/Social/Channels/Skio.js} +31 -2
  107. package/dist/esm/icons/Social/Channels/Skio.js.map +1 -0
  108. package/dist/esm/icons/Social/Channels/index.d.ts +3 -0
  109. package/dist/esm/icons/index.d.ts +25 -25
  110. package/dist/esm/icons/index.js +330 -324
  111. package/dist/esm/icons/index.js.map +1 -1
  112. package/dist/esm/index.js +671 -663
  113. package/dist/esm/index.js.map +1 -1
  114. package/package.json +1 -1
  115. package/dist/cjs/assets/icons/BigCommerce.svg.js +0 -2
  116. package/dist/cjs/assets/icons/BigCommerce.svg.js.map +0 -1
  117. package/dist/cjs/assets/icons/Gorgias.svg.js +0 -2
  118. package/dist/cjs/assets/icons/Gorgias.svg.js.map +0 -1
  119. package/dist/cjs/assets/icons/ManifestGlass.svg.js +0 -2
  120. package/dist/cjs/assets/icons/ManifestGlass.svg.js.map +0 -1
  121. package/dist/cjs/assets/icons/ShipStation.svg.js +0 -2
  122. package/dist/cjs/assets/icons/ShipStation.svg.js.map +0 -1
  123. package/dist/cjs/assets/icons/Shopify.svg.js +0 -2
  124. package/dist/cjs/assets/icons/Shopify.svg.js.map +0 -1
  125. package/dist/cjs/assets/icons/Skio.svg.js.map +0 -1
  126. package/dist/esm/assets/icons/BigCommerce.svg.js +0 -6
  127. package/dist/esm/assets/icons/BigCommerce.svg.js.map +0 -1
  128. package/dist/esm/assets/icons/Gorgias.svg.js +0 -6
  129. package/dist/esm/assets/icons/Gorgias.svg.js.map +0 -1
  130. package/dist/esm/assets/icons/ManifestGlass.svg.js +0 -6
  131. package/dist/esm/assets/icons/ManifestGlass.svg.js.map +0 -1
  132. package/dist/esm/assets/icons/ShipStation.svg.js +0 -6
  133. package/dist/esm/assets/icons/ShipStation.svg.js.map +0 -1
  134. package/dist/esm/assets/icons/Shopify.svg.js +0 -6
  135. package/dist/esm/assets/icons/Shopify.svg.js.map +0 -1
  136. package/dist/esm/assets/icons/Skio.svg.js +0 -6
  137. package/dist/esm/assets/icons/Skio.svg.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Step3HowItResponds.js","sources":["../../../../../src/components/agent-builder/steps/Step3HowItResponds.tsx"],"sourcesContent":["import { Shield } from '@src/icons';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Switch } from '@src/components/switch';\nimport { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentTool,\n\tAuthentication,\n\tConfigToolConfig,\n\tConfigToolKey,\n\tRestApiToolConfig,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport {\n\tSectionBodyWrap,\n\tSideSection,\n\tSideSectionHeader,\n\tStep3Divider,\n\tStep3Grid,\n\tStep3Root,\n} from '../AgentBuilder.styled';\nimport { ConfigToolPanel } from '../components/ConfigToolPanel';\nimport { CreateSubAgentPanel } from '../components/CreateSubAgentPanel';\nimport { MentionField } from '../components/MentionField';\nimport { RequireVerificationModal } from '../components/RequireVerificationModal';\nimport { RestApiToolPanel } from '../components/RestApiToolPanel';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from '../components/SelectableListSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { CONFIG_TOOL_SOURCES, ToolSource } from '../constants/tools';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\tbuildCustomToolMentionItems,\n\tconfigToolMentionItem,\n\tconfigToolName,\n\trestApiMentionItem,\n\trestApiToolName,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tsourceIcon,\n} from '../utils/sourceIcons';\nimport { buildToolActions } from '../utils/toolActions';\n\n/** Source brand glyph for a tool, as a dropdown leadingIcon element. */\nconst toolIconEl = (source: string): JSX.Element | undefined =>\n\trenderSourceIcon(sourceIcon(source)) ?? undefined;\n\n/** Dropdown option for a tool: icon left of the name, no description. */\nconst toolOption = (t: AgentTool): SingleOption => ({\n\tlabel: t.display_name,\n\tvalue: t.tool_id,\n\tleadingIcon: toolIconEl(t.source ?? ToolSource.Manifest),\n});\n\nconst STEP = STEP_DEFINITIONS[2];\n\n/** Customer-verification OTP methods, in the dropdown's display order. */\nconst AUTH_METHOD_OPTIONS: SingleOption[] = [\n\t{ label: 'OTP to phone', value: 'phone_otp' },\n\t{ label: 'OTP to email', value: 'email_otp' },\n];\n\n/** Drawer state — null when closed; `key` remounts it fresh per open. */\ninterface SubAgentPanelState {\n\tkey: number;\n\ttitle: string;\n\teditingId?: string;\n\tinitial?: SubAgentDraft;\n}\n\n/**\n * Config-tool drawer state; `key` remounts fresh. `restapi` is the bespoke Rest\n * API panel; `config` is the shared dynamic panel (email / Slack), tagged with\n * its `toolKey`.\n */\ninterface ToolDrawerState {\n\tkey: number;\n\tkind: 'restapi' | 'config';\n\ttoolKey?: ConfigToolKey;\n\tinitialRest?: RestApiToolConfig;\n\tinitialConfig?: ConfigToolConfig;\n}\n\n/** Upsert an item by id (replace when present, append otherwise). */\nconst upsertById = <T extends { id: string }>(\n\tlist: T[] | undefined,\n\titem: T,\n): T[] => {\n\tconst arr = list ?? [];\n\treturn arr.some((x) => x.id === item.id)\n\t\t? arr.map((x) => (x.id === item.id ? item : x))\n\t\t: [...arr, item];\n};\n\nexport const Step3HowItResponds: React.FC = () => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\tupdateField,\n\t\taddReference,\n\t\tremoveReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableModels,\n\t\tconfigToolTemplates,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tinsertMention,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tregisterSubAgentCreator,\n\t\tregisterToolActionHandler,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t\tvariablesData,\n\t} = useAgentBuilderContext();\n\n\tconst [panel, setPanel] = useState<SubAgentPanelState | null>(null);\n\tconst panelKeyRef = useRef(0);\n\n\t// Rest API (bespoke) + shared config-tool drawers (separate from the sub-agent one).\n\tconst [toolDrawer, setToolDrawer] = useState<ToolDrawerState | null>(null);\n\tconst toolDrawerKeyRef = useRef(0);\n\tconst openRestApi = useCallback((initial?: RestApiToolConfig) => {\n\t\ttoolDrawerKeyRef.current += 1;\n\t\tsetToolDrawer({\n\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\tkind: 'restapi',\n\t\t\tinitialRest: initial,\n\t\t});\n\t}, []);\n\tconst openConfigTool = useCallback(\n\t\t(toolKey: ConfigToolKey, initial?: ConfigToolConfig) => {\n\t\t\ttoolDrawerKeyRef.current += 1;\n\t\t\tsetToolDrawer({\n\t\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\t\tkind: 'config',\n\t\t\t\ttoolKey,\n\t\t\t\tinitialConfig: initial,\n\t\t\t});\n\t\t},\n\t\t[],\n\t);\n\tconst handleSaveRestApi = useCallback(\n\t\t(config: RestApiToolConfig) => {\n\t\t\tconst isNew = !(value.restApiTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ restApiTools: upsertById(value.restApiTools, config) });\n\t\t\t// Drop a reference chip at the cursor on creation (edits keep the chip).\n\t\t\t// Pass the source so the fresh chip gets its icon (it isn't in the\n\t\t\t// editor's mention list yet).\n\t\t\tif (isNew) {\n\t\t\t\tinsertMention(\n\t\t\t\t\t'tool',\n\t\t\t\t\tconfig.id,\n\t\t\t\t\trestApiMentionItem(config).label,\n\t\t\t\t\tToolSource.RestApi,\n\t\t\t\t);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.restApiTools, insertMention],\n\t);\n\tconst handleSaveConfigTool = useCallback(\n\t\t(config: ConfigToolConfig) => {\n\t\t\tconst isNew = !(value.configTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ configTools: upsertById(value.configTools, config) });\n\t\t\tif (isNew) {\n\t\t\t\tconst source =\n\t\t\t\t\tconfig.tool_key === 'send_slack_message'\n\t\t\t\t\t\t? ToolSource.Slack\n\t\t\t\t\t\t: ToolSource.EmailHandover;\n\t\t\t\tinsertMention(\n\t\t\t\t\t'tool',\n\t\t\t\t\tconfig.id,\n\t\t\t\t\tconfigToolMentionItem(config).label,\n\t\t\t\t\tsource,\n\t\t\t\t);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.configTools, insertMention],\n\t);\n\n\t// Open a tool action's drawer by picker source (restapi / email / slack).\n\tconst openToolAction = useCallback(\n\t\t(source: ToolSource) => {\n\t\t\tconst toolKey = CONFIG_TOOL_SOURCES[source];\n\t\t\tif (toolKey) {\n\t\t\t\topenConfigTool(toolKey);\n\t\t\t} else {\n\t\t\t\topenRestApi();\n\t\t\t}\n\t\t},\n\t\t[openConfigTool, openRestApi],\n\t);\n\t// Let the `@` reference picker (Instructions / Guardrails) open these drawers.\n\tuseEffect(() => {\n\t\tregisterToolActionHandler(openToolAction);\n\t\treturn () => registerToolActionHandler(null);\n\t}, [registerToolActionHandler, openToolAction]);\n\t// Sub-agents created / edited in this session, so a chip resolves (and reflects\n\t// a renamed sub-agent) before the consumer refreshes `availableSubAgents`.\n\tconst [createdSubAgents, setCreatedSubAgents] = useState<SubAgentRef[]>([]);\n\t// Ids of sub-agents saved this session that use an auth_required tool — they\n\t// make customer verification mandatory on the parent, just like a direct\n\t// auth_required tool. (A persisted sub-agent's tools aren't hydrated into\n\t// `value`, so it only joins this set once opened/edited in the panel.)\n\tconst [authRequiringSubAgents, setAuthRequiringSubAgents] = useState<\n\t\tSet<string>\n\t>(() => new Set());\n\t// Created/edited refs take precedence over the consumer-supplied list.\n\tconst subAgentById = new Map<string, SubAgentRef>();\n\tavailableSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tcreatedSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tconst knownSubAgents = Array.from(subAgentById.values());\n\n\tconst openCreate = useCallback(() => {\n\t\tpanelKeyRef.current += 1;\n\t\tsetPanel({ key: panelKeyRef.current, title: 'Create sub-agent' });\n\t}, []);\n\n\t// Let the `@` picker's \"Create new\" row open this step's drawer.\n\tuseEffect(() => {\n\t\tif (!onCreateSubAgent) {\n\t\t\treturn;\n\t\t}\n\t\tregisterSubAgentCreator(openCreate);\n\t\treturn () => registerSubAgentCreator(null);\n\t}, [registerSubAgentCreator, openCreate, onCreateSubAgent]);\n\n\tconst openConfigure = useCallback(\n\t\tasync (id: string) => {\n\t\t\tif (!onFetchSubAgent) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst data = await onFetchSubAgent(id);\n\t\t\tpanelKeyRef.current += 1;\n\t\t\tsetPanel({\n\t\t\t\tkey: panelKeyRef.current,\n\t\t\t\ttitle: 'Edit sub-agent',\n\t\t\t\teditingId: id,\n\t\t\t\tinitial: data,\n\t\t\t});\n\t\t},\n\t\t[onFetchSubAgent],\n\t);\n\n\t// ── Customer verification (auth) ──────────────────────────────────────────\n\t// Order tools (auth_required) can't run unless the customer is verified first,\n\t// so verification is MANDATORY whenever such a tool is attached (directly or\n\t// via a sub-agent). Derived before the handlers that read it.\n\tconst hasDirectAuthTool = value.tools.some(\n\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t);\n\tconst hasAuthRequiredSubAgent = value.subagents.some((id) =>\n\t\tauthRequiringSubAgents.has(id),\n\t);\n\tconst hasAuthRequiredTool = hasDirectAuthTool || hasAuthRequiredSubAgent;\n\tconst authEnabled = value.authentication?.enabled ?? false;\n\tconst authType: Authentication['type'] =\n\t\tvalue.authentication?.type ?? 'email_otp';\n\n\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\n\t\t\tlet savedId: string | undefined;\n\t\t\tif (panel?.editingId) {\n\t\t\t\tif (onUpdateSubAgent) {\n\t\t\t\t\tconst ref = await onUpdateSubAgent(panel.editingId, draft);\n\t\t\t\t\tsavedId = ref.id;\n\t\t\t\t\tsetCreatedSubAgents((prev) => [\n\t\t\t\t\t\t...prev.filter((s) => s.id !== ref.id),\n\t\t\t\t\t\tref,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else if (onCreateSubAgent) {\n\t\t\t\tconst ref = await onCreateSubAgent(draft);\n\t\t\t\tsavedId = ref.id;\n\t\t\t\tsetCreatedSubAgents((prev) => [...prev, ref]);\n\t\t\t\tpatch({ subagents: [...value.subagents, ref.id] });\n\t\t\t\tinsertMention('subagent', ref.id, `sub-agent: ${ref.name}`);\n\t\t\t}\n\t\t\t// A sub-agent that uses an auth_required tool forces customer\n\t\t\t// verification on the parent agent — the tool can't run otherwise. Record\n\t\t\t// it so verification stays mandatory (the reconcile effect turns it on and\n\t\t\t// the toggle locks), mirroring the direct-tool invariant.\n\t\t\tif (savedId) {\n\t\t\t\tconst targetId = savedId;\n\t\t\t\tconst subUsesAuthTool = draft.tools.some(\n\t\t\t\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t\t\t\t);\n\t\t\t\tsetAuthRequiringSubAgents((prev) => {\n\t\t\t\t\tconst next = new Set(prev);\n\t\t\t\t\tif (subUsesAuthTool) {\n\t\t\t\t\t\tnext.add(targetId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnext.delete(targetId);\n\t\t\t\t\t}\n\t\t\t\t\treturn next;\n\t\t\t\t});\n\t\t\t}\n\t\t\tsetPanel(null);\n\t\t},\n\t\t[\n\t\t\tpanel,\n\t\t\tonUpdateSubAgent,\n\t\t\tonCreateSubAgent,\n\t\t\tpatch,\n\t\t\tvalue.subagents,\n\t\t\tinsertMention,\n\t\t\tavailableTools,\n\t\t],\n\t);\n\n\t// Reconcile the invariant: a loaded agent that already holds an auth_required\n\t// tool must have verification on (a fail-closed tool otherwise runs silently).\n\tuseEffect(() => {\n\t\tif (hasAuthRequiredTool && !authEnabled) {\n\t\t\tpatch({ authentication: { enabled: true, type: authType } });\n\t\t}\n\t}, [hasAuthRequiredTool, authEnabled, authType, patch]);\n\n\t// A tool add awaiting the mandatory-verification confirm (null = no prompt).\n\tconst [pendingAuthTool, setPendingAuthTool] = useState<string | null>(null);\n\tconst addTool = useCallback(\n\t\t(id: string) => {\n\t\t\t// Always drop a chip at the cursor; addReference dedupes and reads the\n\t\t\t// latest value.\n\t\t\tinsertMention('tool', id);\n\t\t\taddReference('tool', id);\n\t\t},\n\t\t[insertMention, addReference],\n\t);\n\t// Adding an auth_required tool while verification is off prompts first; confirm\n\t// turns verification on and adds, cancel skips the add.\n\tconst handleAddTool = useCallback(\n\t\t(id: string) => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\tif (tool?.auth_required && !authEnabled) {\n\t\t\t\tsetPendingAuthTool(id);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\taddTool(id);\n\t\t},\n\t\t[availableTools, authEnabled, addTool],\n\t);\n\n\tconst toolItems: SelectableItem[] = value.tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: sourceIcon(tool.source ?? ToolSource.Manifest),\n\t\t\t\t\t\tauthRequired: tool.auth_required,\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// Inline-configured tools (Rest API + the shared email / Slack tools) live on\n\t// the value, not in `tools`. They render as rows in the same Tools list, each\n\t// with its own Configure (edit) action that reopens its drawer.\n\tconst restApiItems: SelectableItem[] = (value.restApiTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: restApiToolName(t),\n\t\t\ticon: SOURCE_ICONS[ToolSource.RestApi],\n\t\t\tonConfigure: () => openRestApi(t),\n\t\t}),\n\t);\n\tconst configToolItems: SelectableItem[] = (value.configTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: configToolName(t),\n\t\t\ticon: SOURCE_ICONS[\n\t\t\t\tt.tool_key === 'send_slack_message'\n\t\t\t\t\t? ToolSource.Slack\n\t\t\t\t\t: ToolSource.EmailHandover\n\t\t\t],\n\t\t\tonConfigure: () => openConfigTool(t.tool_key, t),\n\t\t}),\n\t);\n\tconst allToolItems: SelectableItem[] = [\n\t\t...toolItems,\n\t\t...restApiItems,\n\t\t...configToolItems,\n\t];\n\n\t// Built-in tools that open a config drawer instead of inserting a mention.\n\t// Shown as empty-state buttons AND in the `@` picker's Tools view. The shared\n\t// email / Slack forms are backend-driven, so each is offered only when its\n\t// template was provided.\n\tconst toolActionSources = buildToolActions(\n\t\tconfigToolTemplates,\n\t\topenToolAction,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t);\n\n\t// All tools are offered (even already-added ones) so a tool can be referenced\n\t// again in the text; the chip list below still shows each only once.\n\tconst toolOptions: SingleOption[] = availableTools.map(toolOption);\n\n\t// Group tools by source (Manifest / Shopify / …) for the empty-state buttons.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? ToolSource.Manifest;\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push(toolOption(t));\n\t\t});\n\t\treturn order.map((src) => ({\n\t\t\tsource: src,\n\t\t\tlabel: toolSourceLabel(src),\n\t\t\toptions: bySource.get(src) ?? [],\n\t\t\t// Not connected → the source button opens the connect flow instead of\n\t\t\t// its tool list (see SelectableListSection / onConnectIntegration).\n\t\t\tconnected: integrationStatus?.[src as ToolSource],\n\t\t\tonConnect: () => onConnectIntegration?.(src as ToolSource),\n\t\t}));\n\t})();\n\n\tconst subAgentItems: SelectableItem[] = value.subagents\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst sub = subAgentById.get(id);\n\t\t\treturn sub ? { id, label: sub.name } : null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\tconst subAgentOptions: SingleOption[] = knownSubAgents.map((s) => ({\n\t\tlabel: s.name,\n\t\tvalue: s.id,\n\t}));\n\n\t// Per-section `@`-picker items so the header \"+\" opens the same reference\n\t// picker as the Instructions editor, drilled straight into this section's\n\t// category (tools OR sub-agents).\n\tconst appLabel = appTypeLabel(applicationType);\n\tconst toolMentionItems = [\n\t\t...buildAgentMentionItems(availableTools, [], appLabel),\n\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t];\n\tconst subAgentMentionItems = buildAgentMentionItems(\n\t\t[],\n\t\tknownSubAgents,\n\t\tappLabel,\n\t);\n\n\tconst modelOptions: SingleOption[] = availableModels.map((m) => ({\n\t\tlabel: m.label,\n\t\tvalue: m.value,\n\t\tselected: m.value === value.model,\n\t}));\n\tconst selectedModel = availableModels.find((m) => m.value === value.model);\n\n\t// The template for the open shared-drawer tool (undefined unless a config\n\t// drawer is open and its template was provided).\n\tconst openConfigTemplate =\n\t\ttoolDrawer?.kind === 'config' && toolDrawer.toolKey\n\t\t\t? configToolTemplates?.[toolDrawer.toolKey]\n\t\t\t: undefined;\n\n\tconst verificationToggle = (\n\t\t<Switch\n\t\t\tdata-test=\"agent-auth-toggle\"\n\t\t\tvalue={authEnabled || hasAuthRequiredTool}\n\t\t\t// Mandatory (can't turn off) while an auth_required tool is attached.\n\t\t\tdisabled={hasAuthRequiredTool}\n\t\t\tonValueChange={async (enabled) => {\n\t\t\t\tpatch({ authentication: { enabled, type: authType } });\n\t\t\t}}\n\t\t/>\n\t);\n\t// While locked, a tooltip explains why the toggle can't be changed.\n\tconst verificationToggleNode = hasAuthRequiredTool ? (\n\t\t<Tooltip\n\t\t\tbody=\"Remove tools that requires customer verification to change this setting.\"\n\t\t\tplacement=\"bottom\"\n\t\t>\n\t\t\t<span style={{ display: 'flex' }}>{verificationToggle}</span>\n\t\t</Tooltip>\n\t) : (\n\t\tverificationToggle\n\t);\n\n\treturn (\n\t\t<Step3Root>\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<Step3Grid $grow>\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"instructions\"\n\t\t\t\t\t\tdata-test=\"agent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder=\"Write the steps in plain English. The agent will follow them exactly. The more specific you are, the better it performs.\"\n\t\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"guardrail\"\n\t\t\t\t\t\tdata-test=\"agent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tmaxLength={charLimits.guardrail}\n\t\t\t\t\t\tplaceholder=\"e.g. Never discuss competitor pricing. Always stay within the cancellation policy. Do not process refunds above ₹10,000 without human approval.\"\n\t\t\t\t\t\tminHeight=\"140px\"\n\t\t\t\t\t/>\n\t\t\t\t</SectionBodyWrap>\n\n\t\t\t\t<Step3Divider />\n\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools\"\n\t\t\t\t\t\thelper=\"Actions this agent can take while responding.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-tools\"\n\t\t\t\t\t\titems={allToolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\tmentionItems={toolMentionItems}\n\t\t\t\t\t\tactionSources={toolActionSources}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tonAdd={handleAddTool}\n\t\t\t\t\t\t// Strips the tool's tokens AND drops it from whichever list holds it\n\t\t\t\t\t\t// (catalog `tools` or an inline custom-tool list).\n\t\t\t\t\t\tonRemove={(id) => removeReference('tool', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'tool' }}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Sub-agents\"\n\t\t\t\t\t\thelper=\"Other agents this agent can hand off the conversation to.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-subagents\"\n\t\t\t\t\t\titems={subAgentItems}\n\t\t\t\t\t\taddableOptions={subAgentOptions}\n\t\t\t\t\t\tmentionItems={subAgentMentionItems}\n\t\t\t\t\t\temptyText=\"No sub-agents added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertMention('subagent', id);\n\t\t\t\t\t\t\taddReference('subagent', id);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('subagent', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'sub-agent' }}\n\t\t\t\t\t\tonConfigure={onFetchSubAgent ? openConfigure : undefined}\n\t\t\t\t\t\tcreateOption={\n\t\t\t\t\t\t\tonCreateSubAgent\n\t\t\t\t\t\t\t\t? { label: 'Create new', onSelect: openCreate }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t<SideSectionHeader>\n\t\t\t\t\t\t\t<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n\t\t\t\t\t\t\t\t<Shield size={20} />\n\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tRequire customer verification\n\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{verificationToggleNode}\n\t\t\t\t\t\t</SideSectionHeader>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t{hasAuthRequiredTool\n\t\t\t\t\t\t\t\t? 'Required — this agent uses a tool that accesses customer order details.'\n\t\t\t\t\t\t\t\t: 'Customers must verify their identity before this agent responds.'}\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t{(authEnabled || hasAuthRequiredTool) && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tSelect verification method\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-auth-method\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t\t// Popover is portalled, so \"100%\" collapses to content width —\n\t\t\t\t\t\t\t\t\t// match the input: 360px side column − 2×16px padding.\n\t\t\t\t\t\t\t\t\tdropdownWidth=\"328px\"\n\t\t\t\t\t\t\t\t\tplaceHolder=\"Select verification method\"\n\t\t\t\t\t\t\t\t\t// Flag the active method so the open list highlights that row\n\t\t\t\t\t\t\t\t\t// green (list-item 'selected' theme handles the styling).\n\t\t\t\t\t\t\t\t\toptions={AUTH_METHOD_OPTIONS.map((o) => ({\n\t\t\t\t\t\t\t\t\t\t...o,\n\t\t\t\t\t\t\t\t\t\tselected: o.value === authType,\n\t\t\t\t\t\t\t\t\t}))}\n\t\t\t\t\t\t\t\t\tdefaultOptions={[\n\t\t\t\t\t\t\t\t\t\tAUTH_METHOD_OPTIONS.find((o) => o.value === authType) ??\n\t\t\t\t\t\t\t\t\t\t\tAUTH_METHOD_OPTIONS[0],\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\t\tpatch({\n\t\t\t\t\t\t\t\t\t\t\t\tauthentication: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: v as Authentication['type'],\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t});\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/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</SideSection>\n\n\t\t\t\t\t{availableModels.length > 0 && (\n\t\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tAdvanced settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tSelect AI model\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"agent-model\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t// Popover is portalled, so \"100%\" collapses to content width —\n\t\t\t\t\t\t\t\t// match the input: 360px side column − 2×16px SectionBodyWrap\n\t\t\t\t\t\t\t\t// padding.\n\t\t\t\t\t\t\t\tdropdownWidth=\"328px\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select model\"\n\t\t\t\t\t\t\t\toptions={modelOptions}\n\t\t\t\t\t\t\t\tdefaultOptions={\n\t\t\t\t\t\t\t\t\tselectedModel\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: selectedModel.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: selectedModel.value,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\tupdateField('model', v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SideSection>\n\t\t\t\t\t)}\n\t\t\t\t</SectionBodyWrap>\n\t\t\t</Step3Grid>\n\n\t\t\t{panel && (\n\t\t\t\t<CreateSubAgentPanel\n\t\t\t\t\tkey={panel.key}\n\t\t\t\t\ttitle={panel.title}\n\t\t\t\t\tinitial={panel.initial}\n\t\t\t\t\t// Block reusing another sub-agent's name (exclude the one being edited).\n\t\t\t\t\texistingNames={value.subagents\n\t\t\t\t\t\t.filter((id) => id !== panel.editingId)\n\t\t\t\t\t\t.map((id) => subAgentById.get(id)?.name)\n\t\t\t\t\t\t.filter((n): n is string => !!n)}\n\t\t\t\t\tavailableTools={availableTools}\n\t\t\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\t\t\tappLabel={appTypeLabel(applicationType)}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tonImprove={onImproveSubAgent}\n\t\t\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setPanel(null)}\n\t\t\t\t\tonSave={handlePanelSave}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'restapi' && (\n\t\t\t\t<RestApiToolPanel\n\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\tinitial={toolDrawer.initialRest}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t// Block reusing another tool's name (exclude the one being edited).\n\t\t\t\t\texistingNames={(value.restApiTools ?? [])\n\t\t\t\t\t\t.filter((t) => t.id !== toolDrawer.initialRest?.id)\n\t\t\t\t\t\t.map((t) => t.name)}\n\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\tonSave={handleSaveRestApi}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'config' &&\n\t\t\t\ttoolDrawer.toolKey &&\n\t\t\t\topenConfigTemplate && (\n\t\t\t\t\t<ConfigToolPanel\n\t\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\t\ttoolKey={toolDrawer.toolKey}\n\t\t\t\t\t\ttemplate={openConfigTemplate}\n\t\t\t\t\t\tinitial={toolDrawer.initialConfig}\n\t\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\t\tonSave={handleSaveConfigTool}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t<RequireVerificationModal\n\t\t\t\topen={pendingAuthTool !== null}\n\t\t\t\ttoolLabel={\n\t\t\t\t\tavailableTools.find((t) => t.tool_id === pendingAuthTool)\n\t\t\t\t\t\t?.display_name ?? 'This tool'\n\t\t\t\t}\n\t\t\t\tonCancel={() => setPendingAuthTool(null)}\n\t\t\t\tonConfirm={() => {\n\t\t\t\t\tpatch({ authentication: { enabled: true, type: authType } });\n\t\t\t\t\tif (pendingAuthTool) {\n\t\t\t\t\t\taddTool(pendingAuthTool);\n\t\t\t\t\t}\n\t\t\t\t\tsetPendingAuthTool(null);\n\t\t\t\t}}\n\t\t\t/>\n\t\t</Step3Root>\n\t);\n};\n"],"names":["toolIconEl","source","renderSourceIcon","sourceIcon","toolOption","t","ToolSource","STEP","STEP_DEFINITIONS","AUTH_METHOD_OPTIONS","upsertById","list","item","arr","x","Step3HowItResponds","value","patch","updateField","addReference","removeReference","availableTools","availableSubAgents","availableModels","configToolTemplates","applicationType","charLimits","insertMention","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","registerSubAgentCreator","registerToolActionHandler","integrationStatus","onConnectIntegration","variablesData","useAgentBuilderContext","panel","setPanel","useState","panelKeyRef","useRef","toolDrawer","setToolDrawer","toolDrawerKeyRef","openRestApi","useCallback","initial","openConfigTool","toolKey","handleSaveRestApi","config","isNew","restApiMentionItem","handleSaveConfigTool","configToolMentionItem","openToolAction","CONFIG_TOOL_SOURCES","useEffect","createdSubAgents","setCreatedSubAgents","authRequiringSubAgents","setAuthRequiringSubAgents","subAgentById","s","knownSubAgents","openCreate","openConfigure","id","data","hasDirectAuthTool","hasAuthRequiredSubAgent","hasAuthRequiredTool","authEnabled","authType","handlePanelSave","draft","savedId","ref","prev","targetId","subUsesAuthTool","next","pendingAuthTool","setPendingAuthTool","addTool","handleAddTool","toolItems","tool","restApiItems","restApiToolName","SOURCE_ICONS","configToolItems","configToolName","allToolItems","toolActionSources","buildToolActions","toolOptions","toolSourceGroups","order","bySource","src","toolSourceLabel","subAgentItems","sub","subAgentOptions","appLabel","appTypeLabel","toolMentionItems","buildAgentMentionItems","buildCustomToolMentionItems","subAgentMentionItems","modelOptions","m","selectedModel","openConfigTemplate","verificationToggle","jsx","Switch","enabled","verificationToggleNode","Tooltip","Step3Root","StepSectionHeader","jsxs","Step3Grid","SectionBodyWrap","MentionField","Step3Divider","SelectableListSection","SideSection","SideSectionHeader","Shield","TitleSmall","COLORS","BodyCaption","Fragment","BodySecondary","Dropdown","o","opt","v","unwrapDropdownValue","CreateSubAgentPanel","n","RestApiToolPanel","ConfigToolPanel","RequireVerificationModal"],"mappings":";;;;;;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AAA,MAAA;AAAA,QACA,MAAMhE,MAAoB;AAAA,QAC1B,WACChE,EAAe,KAAK,CAAChB,MAAMA,EAAE,YAAYgF,CAAe,GACrD,gBAAgB;AAAA,QAEpB,UAAU,MAAMC,EAAmB,IAAI;AAAA,QACvC,WAAW,MAAM;AAChB,UAAArE,EAAM,EAAE,gBAAgB,EAAE,SAAS,IAAM,MAAM2D,EAAA,GAAY,GACvDS,KACHE,EAAQF,CAAe,GAExBC,EAAmB,IAAI;AAAA,QACxB;AAAA,MAAA;AAAA,IAAA;AAAA,EACD,GACD;AAEF;"}
1
+ {"version":3,"file":"Step3HowItResponds.js","sources":["../../../../../src/components/agent-builder/steps/Step3HowItResponds.tsx"],"sourcesContent":["import { Shield } from '@src/icons';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Switch } from '@src/components/switch';\nimport { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentTool,\n\tAuthentication,\n\tConfigToolConfig,\n\tConfigToolKey,\n\tRestApiToolConfig,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport {\n\tSectionBodyWrap,\n\tSideSection,\n\tSideSectionHeader,\n\tStep3Divider,\n\tStep3Grid,\n\tStep3Root,\n} from '../AgentBuilder.styled';\nimport { ConfigToolPanel } from '../components/ConfigToolPanel';\nimport { CreateSubAgentPanel } from '../components/CreateSubAgentPanel';\nimport { MentionField } from '../components/MentionField';\nimport { RequireVerificationModal } from '../components/RequireVerificationModal';\nimport { RestApiToolPanel } from '../components/RestApiToolPanel';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from '../components/SelectableListSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { CONFIG_TOOL_SOURCES, ToolSource } from '../constants/tools';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\tbuildCustomToolMentionItems,\n\tconfigToolMentionItem,\n\tconfigToolName,\n\trestApiMentionItem,\n\trestApiToolName,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tsourceIcon,\n} from '../utils/sourceIcons';\nimport { buildToolActions } from '../utils/toolActions';\n\n/** Source brand glyph for a tool, as a dropdown leadingIcon element. */\nconst toolIconEl = (source: string): JSX.Element | undefined =>\n\trenderSourceIcon(sourceIcon(source)) ?? undefined;\n\n/** Dropdown option for a tool: icon left of the name, no description. */\nconst toolOption = (t: AgentTool): SingleOption => ({\n\tlabel: t.display_name,\n\tvalue: t.tool_id,\n\tleadingIcon: toolIconEl(t.source ?? ToolSource.Manifest),\n});\n\nconst STEP = STEP_DEFINITIONS[2];\n\n/** Customer-verification OTP methods, in the dropdown's display order. */\nconst AUTH_METHOD_OPTIONS: SingleOption[] = [\n\t{ label: 'OTP to phone', value: 'phone_otp' },\n\t{ label: 'OTP to email', value: 'email_otp' },\n];\n\n/** Drawer state — null when closed; `key` remounts it fresh per open. */\ninterface SubAgentPanelState {\n\tkey: number;\n\ttitle: string;\n\teditingId?: string;\n\tinitial?: SubAgentDraft;\n}\n\n/**\n * Config-tool drawer state; `key` remounts fresh. `restapi` is the bespoke Rest\n * API panel; `config` is the shared dynamic panel (email / Slack), tagged with\n * its `toolKey`.\n */\ninterface ToolDrawerState {\n\tkey: number;\n\tkind: 'restapi' | 'config';\n\ttoolKey?: ConfigToolKey;\n\tinitialRest?: RestApiToolConfig;\n\tinitialConfig?: ConfigToolConfig;\n}\n\n/** Upsert an item by id (replace when present, append otherwise). */\nconst upsertById = <T extends { id: string }>(\n\tlist: T[] | undefined,\n\titem: T,\n): T[] => {\n\tconst arr = list ?? [];\n\treturn arr.some((x) => x.id === item.id)\n\t\t? arr.map((x) => (x.id === item.id ? item : x))\n\t\t: [...arr, item];\n};\n\nexport const Step3HowItResponds: React.FC = () => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\tupdateField,\n\t\taddReference,\n\t\tremoveReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableModels,\n\t\tconfigToolTemplates,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tinsertMention,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tregisterSubAgentCreator,\n\t\tregisterToolActionHandler,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t\tvariablesData,\n\t} = useAgentBuilderContext();\n\n\tconst [panel, setPanel] = useState<SubAgentPanelState | null>(null);\n\tconst panelKeyRef = useRef(0);\n\n\t// Rest API (bespoke) + shared config-tool drawers (separate from the sub-agent one).\n\tconst [toolDrawer, setToolDrawer] = useState<ToolDrawerState | null>(null);\n\tconst toolDrawerKeyRef = useRef(0);\n\tconst openRestApi = useCallback((initial?: RestApiToolConfig) => {\n\t\ttoolDrawerKeyRef.current += 1;\n\t\tsetToolDrawer({\n\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\tkind: 'restapi',\n\t\t\tinitialRest: initial,\n\t\t});\n\t}, []);\n\tconst openConfigTool = useCallback(\n\t\t(toolKey: ConfigToolKey, initial?: ConfigToolConfig) => {\n\t\t\ttoolDrawerKeyRef.current += 1;\n\t\t\tsetToolDrawer({\n\t\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\t\tkind: 'config',\n\t\t\t\ttoolKey,\n\t\t\t\tinitialConfig: initial,\n\t\t\t});\n\t\t},\n\t\t[],\n\t);\n\tconst handleSaveRestApi = useCallback(\n\t\t(config: RestApiToolConfig) => {\n\t\t\tconst isNew = !(value.restApiTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ restApiTools: upsertById(value.restApiTools, config) });\n\t\t\t// Drop a reference chip at the cursor on creation (edits keep the chip).\n\t\t\t// Pass the source so the fresh chip gets its icon (it isn't in the\n\t\t\t// editor's mention list yet).\n\t\t\tif (isNew) {\n\t\t\t\tinsertMention(\n\t\t\t\t\t'tool',\n\t\t\t\t\tconfig.id,\n\t\t\t\t\trestApiMentionItem(config).label,\n\t\t\t\t\tToolSource.RestApi,\n\t\t\t\t);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.restApiTools, insertMention],\n\t);\n\tconst handleSaveConfigTool = useCallback(\n\t\t(config: ConfigToolConfig) => {\n\t\t\tconst isNew = !(value.configTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ configTools: upsertById(value.configTools, config) });\n\t\t\tif (isNew) {\n\t\t\t\tconst source =\n\t\t\t\t\tconfig.tool_key === 'send_slack_message'\n\t\t\t\t\t\t? ToolSource.Slack\n\t\t\t\t\t\t: ToolSource.EmailHandover;\n\t\t\t\tinsertMention(\n\t\t\t\t\t'tool',\n\t\t\t\t\tconfig.id,\n\t\t\t\t\tconfigToolMentionItem(config).label,\n\t\t\t\t\tsource,\n\t\t\t\t);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.configTools, insertMention],\n\t);\n\n\t// Open a tool action's drawer by picker source (restapi / email / slack).\n\tconst openToolAction = useCallback(\n\t\t(source: ToolSource) => {\n\t\t\tconst toolKey = CONFIG_TOOL_SOURCES[source];\n\t\t\tif (toolKey) {\n\t\t\t\topenConfigTool(toolKey);\n\t\t\t} else {\n\t\t\t\topenRestApi();\n\t\t\t}\n\t\t},\n\t\t[openConfigTool, openRestApi],\n\t);\n\t// Let the `@` reference picker (Instructions / Guardrails) open these drawers.\n\tuseEffect(() => {\n\t\tregisterToolActionHandler(openToolAction);\n\t\treturn () => registerToolActionHandler(null);\n\t}, [registerToolActionHandler, openToolAction]);\n\t// Sub-agents created / edited in this session, so a chip resolves (and reflects\n\t// a renamed sub-agent) before the consumer refreshes `availableSubAgents`.\n\tconst [createdSubAgents, setCreatedSubAgents] = useState<SubAgentRef[]>([]);\n\t// Ids of sub-agents saved this session that use an auth_required tool — they\n\t// make customer verification mandatory on the parent, just like a direct\n\t// auth_required tool. (A persisted sub-agent's tools aren't hydrated into\n\t// `value`, so it only joins this set once opened/edited in the panel.)\n\tconst [authRequiringSubAgents, setAuthRequiringSubAgents] = useState<\n\t\tSet<string>\n\t>(() => new Set());\n\t// Created/edited refs take precedence over the consumer-supplied list.\n\tconst subAgentById = new Map<string, SubAgentRef>();\n\tavailableSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tcreatedSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tconst knownSubAgents = Array.from(subAgentById.values());\n\n\tconst openCreate = useCallback(() => {\n\t\tpanelKeyRef.current += 1;\n\t\tsetPanel({ key: panelKeyRef.current, title: 'Create sub-agent' });\n\t}, []);\n\n\t// Let the `@` picker's \"Create new\" row open this step's drawer.\n\tuseEffect(() => {\n\t\tif (!onCreateSubAgent) {\n\t\t\treturn;\n\t\t}\n\t\tregisterSubAgentCreator(openCreate);\n\t\treturn () => registerSubAgentCreator(null);\n\t}, [registerSubAgentCreator, openCreate, onCreateSubAgent]);\n\n\tconst openConfigure = useCallback(\n\t\tasync (id: string) => {\n\t\t\tif (!onFetchSubAgent) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst data = await onFetchSubAgent(id);\n\t\t\tpanelKeyRef.current += 1;\n\t\t\tsetPanel({\n\t\t\t\tkey: panelKeyRef.current,\n\t\t\t\ttitle: 'Edit sub-agent',\n\t\t\t\teditingId: id,\n\t\t\t\tinitial: data,\n\t\t\t});\n\t\t},\n\t\t[onFetchSubAgent],\n\t);\n\n\t// ── Customer verification (auth) ──────────────────────────────────────────\n\t// Order tools (auth_required) can't run unless the customer is verified first,\n\t// so verification is MANDATORY whenever such a tool is attached (directly or\n\t// via a sub-agent). Derived before the handlers that read it.\n\tconst hasDirectAuthTool = value.tools.some(\n\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t);\n\tconst hasAuthRequiredSubAgent = value.subagents.some((id) =>\n\t\tauthRequiringSubAgents.has(id),\n\t);\n\tconst hasAuthRequiredTool = hasDirectAuthTool || hasAuthRequiredSubAgent;\n\tconst authEnabled = value.authentication?.enabled ?? false;\n\tconst authType: Authentication['type'] =\n\t\tvalue.authentication?.type ?? 'email_otp';\n\t// BIK picks the OTP channel itself, so the merchant only gets the on/off\n\t// toggle there; Manifest still chooses the method.\n\tconst showAuthMethod = appTypeLabel(applicationType) !== 'BIK';\n\n\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\n\t\t\tlet savedId: string | undefined;\n\t\t\tif (panel?.editingId) {\n\t\t\t\tif (onUpdateSubAgent) {\n\t\t\t\t\tconst ref = await onUpdateSubAgent(panel.editingId, draft);\n\t\t\t\t\tsavedId = ref.id;\n\t\t\t\t\tsetCreatedSubAgents((prev) => [\n\t\t\t\t\t\t...prev.filter((s) => s.id !== ref.id),\n\t\t\t\t\t\tref,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else if (onCreateSubAgent) {\n\t\t\t\tconst ref = await onCreateSubAgent(draft);\n\t\t\t\tsavedId = ref.id;\n\t\t\t\tsetCreatedSubAgents((prev) => [...prev, ref]);\n\t\t\t\tpatch({ subagents: [...value.subagents, ref.id] });\n\t\t\t\tinsertMention('subagent', ref.id, `sub-agent: ${ref.name}`);\n\t\t\t}\n\t\t\t// A sub-agent that uses an auth_required tool forces customer\n\t\t\t// verification on the parent agent — the tool can't run otherwise. Record\n\t\t\t// it so verification stays mandatory (the reconcile effect turns it on and\n\t\t\t// the toggle locks), mirroring the direct-tool invariant.\n\t\t\tif (savedId) {\n\t\t\t\tconst targetId = savedId;\n\t\t\t\tconst subUsesAuthTool = draft.tools.some(\n\t\t\t\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t\t\t\t);\n\t\t\t\tsetAuthRequiringSubAgents((prev) => {\n\t\t\t\t\tconst next = new Set(prev);\n\t\t\t\t\tif (subUsesAuthTool) {\n\t\t\t\t\t\tnext.add(targetId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnext.delete(targetId);\n\t\t\t\t\t}\n\t\t\t\t\treturn next;\n\t\t\t\t});\n\t\t\t}\n\t\t\tsetPanel(null);\n\t\t},\n\t\t[\n\t\t\tpanel,\n\t\t\tonUpdateSubAgent,\n\t\t\tonCreateSubAgent,\n\t\t\tpatch,\n\t\t\tvalue.subagents,\n\t\t\tinsertMention,\n\t\t\tavailableTools,\n\t\t],\n\t);\n\n\t// Reconcile the invariant: a loaded agent that already holds an auth_required\n\t// tool must have verification on (a fail-closed tool otherwise runs silently).\n\tuseEffect(() => {\n\t\tif (hasAuthRequiredTool && !authEnabled) {\n\t\t\tpatch({ authentication: { enabled: true, type: authType } });\n\t\t}\n\t}, [hasAuthRequiredTool, authEnabled, authType, patch]);\n\n\t// A tool add awaiting the mandatory-verification confirm (null = no prompt).\n\tconst [pendingAuthTool, setPendingAuthTool] = useState<string | null>(null);\n\tconst addTool = useCallback(\n\t\t(id: string) => {\n\t\t\t// Always drop a chip at the cursor; addReference dedupes and reads the\n\t\t\t// latest value.\n\t\t\tinsertMention('tool', id);\n\t\t\taddReference('tool', id);\n\t\t},\n\t\t[insertMention, addReference],\n\t);\n\t// Adding an auth_required tool while verification is off prompts first; confirm\n\t// turns verification on and adds, cancel skips the add.\n\tconst handleAddTool = useCallback(\n\t\t(id: string) => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\tif (tool?.auth_required && !authEnabled) {\n\t\t\t\tsetPendingAuthTool(id);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\taddTool(id);\n\t\t},\n\t\t[availableTools, authEnabled, addTool],\n\t);\n\n\tconst toolItems: SelectableItem[] = value.tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: sourceIcon(tool.source ?? ToolSource.Manifest),\n\t\t\t\t\t\tauthRequired: tool.auth_required,\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// Inline-configured tools (Rest API + the shared email / Slack tools) live on\n\t// the value, not in `tools`. They render as rows in the same Tools list, each\n\t// with its own Configure (edit) action that reopens its drawer.\n\tconst restApiItems: SelectableItem[] = (value.restApiTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: restApiToolName(t),\n\t\t\ticon: SOURCE_ICONS[ToolSource.RestApi],\n\t\t\tonConfigure: () => openRestApi(t),\n\t\t}),\n\t);\n\tconst configToolItems: SelectableItem[] = (value.configTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: configToolName(t),\n\t\t\ticon: SOURCE_ICONS[\n\t\t\t\tt.tool_key === 'send_slack_message'\n\t\t\t\t\t? ToolSource.Slack\n\t\t\t\t\t: ToolSource.EmailHandover\n\t\t\t],\n\t\t\tonConfigure: () => openConfigTool(t.tool_key, t),\n\t\t}),\n\t);\n\tconst allToolItems: SelectableItem[] = [\n\t\t...toolItems,\n\t\t...restApiItems,\n\t\t...configToolItems,\n\t];\n\n\t// Built-in tools that open a config drawer instead of inserting a mention.\n\t// Shown as empty-state buttons AND in the `@` picker's Tools view. The shared\n\t// email / Slack forms are backend-driven, so each is offered only when its\n\t// template was provided.\n\tconst toolActionSources = buildToolActions(\n\t\tconfigToolTemplates,\n\t\topenToolAction,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t);\n\n\t// All tools are offered (even already-added ones) so a tool can be referenced\n\t// again in the text; the chip list below still shows each only once.\n\tconst toolOptions: SingleOption[] = availableTools.map(toolOption);\n\n\t// The native tool group is named after the host product — \"Manifest\" in\n\t// Manifest, \"BIK\" in BIK — so every surface that renders a source name needs it.\n\tconst appLabel = appTypeLabel(applicationType);\n\n\t// Group tools by source (Manifest / Shopify / …) for the empty-state buttons.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? ToolSource.Manifest;\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push(toolOption(t));\n\t\t});\n\t\treturn order.map((src) => ({\n\t\t\tsource: src,\n\t\t\tlabel: toolSourceLabel(src, appLabel),\n\t\t\toptions: bySource.get(src) ?? [],\n\t\t\t// Not connected → the source button opens the connect flow instead of\n\t\t\t// its tool list (see SelectableListSection / onConnectIntegration).\n\t\t\tconnected: integrationStatus?.[src as ToolSource],\n\t\t\tonConnect: () => onConnectIntegration?.(src as ToolSource),\n\t\t}));\n\t})();\n\n\tconst subAgentItems: SelectableItem[] = value.subagents\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst sub = subAgentById.get(id);\n\t\t\treturn sub ? { id, label: sub.name } : null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\tconst subAgentOptions: SingleOption[] = knownSubAgents.map((s) => ({\n\t\tlabel: s.name,\n\t\tvalue: s.id,\n\t}));\n\n\t// Per-section `@`-picker items so the header \"+\" opens the same reference\n\t// picker as the Instructions editor, drilled straight into this section's\n\t// category (tools OR sub-agents).\n\tconst toolMentionItems = [\n\t\t...buildAgentMentionItems(availableTools, [], appLabel),\n\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t];\n\tconst subAgentMentionItems = buildAgentMentionItems(\n\t\t[],\n\t\tknownSubAgents,\n\t\tappLabel,\n\t);\n\n\tconst modelOptions: SingleOption[] = availableModels.map((m) => ({\n\t\tlabel: m.label,\n\t\tvalue: m.value,\n\t\tselected: m.value === value.model,\n\t}));\n\tconst selectedModel = availableModels.find((m) => m.value === value.model);\n\n\t// The template for the open shared-drawer tool (undefined unless a config\n\t// drawer is open and its template was provided).\n\tconst openConfigTemplate =\n\t\ttoolDrawer?.kind === 'config' && toolDrawer.toolKey\n\t\t\t? configToolTemplates?.[toolDrawer.toolKey]\n\t\t\t: undefined;\n\n\tconst verificationToggle = (\n\t\t<Switch\n\t\t\tdata-test=\"agent-auth-toggle\"\n\t\t\tvalue={authEnabled || hasAuthRequiredTool}\n\t\t\t// Mandatory (can't turn off) while an auth_required tool is attached.\n\t\t\tdisabled={hasAuthRequiredTool}\n\t\t\tonValueChange={async (enabled) => {\n\t\t\t\tpatch({ authentication: { enabled, type: authType } });\n\t\t\t}}\n\t\t/>\n\t);\n\t// While locked, a tooltip explains why the toggle can't be changed.\n\tconst verificationToggleNode = hasAuthRequiredTool ? (\n\t\t<Tooltip\n\t\t\tbody=\"Remove tools that requires customer verification to change this setting.\"\n\t\t\tplacement=\"bottom\"\n\t\t>\n\t\t\t<span style={{ display: 'flex' }}>{verificationToggle}</span>\n\t\t</Tooltip>\n\t) : (\n\t\tverificationToggle\n\t);\n\n\treturn (\n\t\t<Step3Root>\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<Step3Grid $grow>\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"instructions\"\n\t\t\t\t\t\tdata-test=\"agent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder=\"Write the steps in plain English. The agent will follow them exactly. The more specific you are, the better it performs.\"\n\t\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"guardrail\"\n\t\t\t\t\t\tdata-test=\"agent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tmaxLength={charLimits.guardrail}\n\t\t\t\t\t\tplaceholder=\"e.g. Never discuss competitor pricing. Always stay within the cancellation policy. Do not process refunds above ₹10,000 without human approval.\"\n\t\t\t\t\t\tminHeight=\"140px\"\n\t\t\t\t\t/>\n\t\t\t\t</SectionBodyWrap>\n\n\t\t\t\t<Step3Divider />\n\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools\"\n\t\t\t\t\t\thelper=\"Actions this agent can take while responding.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-tools\"\n\t\t\t\t\t\titems={allToolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\tmentionItems={toolMentionItems}\n\t\t\t\t\t\tactionSources={toolActionSources}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tappLabel={appLabel}\n\t\t\t\t\t\tonAdd={handleAddTool}\n\t\t\t\t\t\t// Strips the tool's tokens AND drops it from whichever list holds it\n\t\t\t\t\t\t// (catalog `tools` or an inline custom-tool list).\n\t\t\t\t\t\tonRemove={(id) => removeReference('tool', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'tool' }}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Sub-agents\"\n\t\t\t\t\t\thelper=\"Other agents this agent can hand off the conversation to.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-subagents\"\n\t\t\t\t\t\titems={subAgentItems}\n\t\t\t\t\t\taddableOptions={subAgentOptions}\n\t\t\t\t\t\tmentionItems={subAgentMentionItems}\n\t\t\t\t\t\temptyText=\"No sub-agents added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertMention('subagent', id);\n\t\t\t\t\t\t\taddReference('subagent', id);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('subagent', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'sub-agent' }}\n\t\t\t\t\t\tonConfigure={onFetchSubAgent ? openConfigure : undefined}\n\t\t\t\t\t\tcreateOption={\n\t\t\t\t\t\t\tonCreateSubAgent\n\t\t\t\t\t\t\t\t? { label: 'Create new', onSelect: openCreate }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t<SideSectionHeader>\n\t\t\t\t\t\t\t<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n\t\t\t\t\t\t\t\t<Shield size={20} />\n\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tRequire customer verification\n\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{verificationToggleNode}\n\t\t\t\t\t\t</SideSectionHeader>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t{hasAuthRequiredTool\n\t\t\t\t\t\t\t\t? 'Required — this agent uses a tool that accesses customer order details.'\n\t\t\t\t\t\t\t\t: 'Customers must verify their identity before this agent responds.'}\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t{showAuthMethod && (authEnabled || hasAuthRequiredTool) && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tSelect verification method\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-auth-method\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t\t// Popover is portalled, so \"100%\" collapses to content width —\n\t\t\t\t\t\t\t\t\t// match the input: 360px side column − 2×16px padding.\n\t\t\t\t\t\t\t\t\tdropdownWidth=\"328px\"\n\t\t\t\t\t\t\t\t\tplaceHolder=\"Select verification method\"\n\t\t\t\t\t\t\t\t\t// Flag the active method so the open list highlights that row\n\t\t\t\t\t\t\t\t\t// green (list-item 'selected' theme handles the styling).\n\t\t\t\t\t\t\t\t\toptions={AUTH_METHOD_OPTIONS.map((o) => ({\n\t\t\t\t\t\t\t\t\t\t...o,\n\t\t\t\t\t\t\t\t\t\tselected: o.value === authType,\n\t\t\t\t\t\t\t\t\t}))}\n\t\t\t\t\t\t\t\t\tdefaultOptions={[\n\t\t\t\t\t\t\t\t\t\tAUTH_METHOD_OPTIONS.find((o) => o.value === authType) ??\n\t\t\t\t\t\t\t\t\t\t\tAUTH_METHOD_OPTIONS[0],\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\t\tpatch({\n\t\t\t\t\t\t\t\t\t\t\t\tauthentication: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: v as Authentication['type'],\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t});\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/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</SideSection>\n\n\t\t\t\t\t{availableModels.length > 0 && (\n\t\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tAdvanced settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tSelect AI model\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"agent-model\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t// Popover is portalled, so \"100%\" collapses to content width —\n\t\t\t\t\t\t\t\t// match the input: 360px side column − 2×16px SectionBodyWrap\n\t\t\t\t\t\t\t\t// padding.\n\t\t\t\t\t\t\t\tdropdownWidth=\"328px\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select model\"\n\t\t\t\t\t\t\t\toptions={modelOptions}\n\t\t\t\t\t\t\t\tdefaultOptions={\n\t\t\t\t\t\t\t\t\tselectedModel\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: selectedModel.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: selectedModel.value,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\tupdateField('model', v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SideSection>\n\t\t\t\t\t)}\n\t\t\t\t</SectionBodyWrap>\n\t\t\t</Step3Grid>\n\n\t\t\t{panel && (\n\t\t\t\t<CreateSubAgentPanel\n\t\t\t\t\tkey={panel.key}\n\t\t\t\t\ttitle={panel.title}\n\t\t\t\t\tinitial={panel.initial}\n\t\t\t\t\t// Block reusing another sub-agent's name (exclude the one being edited).\n\t\t\t\t\texistingNames={value.subagents\n\t\t\t\t\t\t.filter((id) => id !== panel.editingId)\n\t\t\t\t\t\t.map((id) => subAgentById.get(id)?.name)\n\t\t\t\t\t\t.filter((n): n is string => !!n)}\n\t\t\t\t\tavailableTools={availableTools}\n\t\t\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\t\t\tappLabel={appLabel}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tonImprove={onImproveSubAgent}\n\t\t\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setPanel(null)}\n\t\t\t\t\tonSave={handlePanelSave}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'restapi' && (\n\t\t\t\t<RestApiToolPanel\n\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\tinitial={toolDrawer.initialRest}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t// Block reusing another tool's name (exclude the one being edited).\n\t\t\t\t\texistingNames={(value.restApiTools ?? [])\n\t\t\t\t\t\t.filter((t) => t.id !== toolDrawer.initialRest?.id)\n\t\t\t\t\t\t.map((t) => t.name)}\n\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\tonSave={handleSaveRestApi}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'config' &&\n\t\t\t\ttoolDrawer.toolKey &&\n\t\t\t\topenConfigTemplate && (\n\t\t\t\t\t<ConfigToolPanel\n\t\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\t\ttoolKey={toolDrawer.toolKey}\n\t\t\t\t\t\ttemplate={openConfigTemplate}\n\t\t\t\t\t\tinitial={toolDrawer.initialConfig}\n\t\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\t\tonSave={handleSaveConfigTool}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t<RequireVerificationModal\n\t\t\t\topen={pendingAuthTool !== null}\n\t\t\t\ttoolLabel={\n\t\t\t\t\tavailableTools.find((t) => t.tool_id === pendingAuthTool)\n\t\t\t\t\t\t?.display_name ?? 'This tool'\n\t\t\t\t}\n\t\t\t\tonCancel={() => setPendingAuthTool(null)}\n\t\t\t\tonConfirm={() => {\n\t\t\t\t\tpatch({ authentication: { enabled: true, type: authType } });\n\t\t\t\t\tif (pendingAuthTool) {\n\t\t\t\t\t\taddTool(pendingAuthTool);\n\t\t\t\t\t}\n\t\t\t\t\tsetPendingAuthTool(null);\n\t\t\t\t}}\n\t\t\t/>\n\t\t</Step3Root>\n\t);\n};\n"],"names":["toolIconEl","source","renderSourceIcon","sourceIcon","toolOption","t","ToolSource","STEP","STEP_DEFINITIONS","AUTH_METHOD_OPTIONS","upsertById","list","item","arr","x","Step3HowItResponds","value","patch","updateField","addReference","removeReference","availableTools","availableSubAgents","availableModels","configToolTemplates","applicationType","charLimits","insertMention","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","registerSubAgentCreator","registerToolActionHandler","integrationStatus","onConnectIntegration","variablesData","useAgentBuilderContext","panel","setPanel","useState","panelKeyRef","useRef","toolDrawer","setToolDrawer","toolDrawerKeyRef","openRestApi","useCallback","initial","openConfigTool","toolKey","handleSaveRestApi","config","isNew","restApiMentionItem","handleSaveConfigTool","configToolMentionItem","openToolAction","CONFIG_TOOL_SOURCES","useEffect","createdSubAgents","setCreatedSubAgents","authRequiringSubAgents","setAuthRequiringSubAgents","subAgentById","s","knownSubAgents","openCreate","openConfigure","id","data","hasDirectAuthTool","hasAuthRequiredSubAgent","hasAuthRequiredTool","authEnabled","authType","showAuthMethod","appTypeLabel","handlePanelSave","draft","savedId","ref","prev","targetId","subUsesAuthTool","next","pendingAuthTool","setPendingAuthTool","addTool","handleAddTool","toolItems","tool","restApiItems","restApiToolName","SOURCE_ICONS","configToolItems","configToolName","allToolItems","toolActionSources","buildToolActions","toolOptions","appLabel","toolSourceGroups","order","bySource","src","toolSourceLabel","subAgentItems","sub","subAgentOptions","toolMentionItems","buildAgentMentionItems","buildCustomToolMentionItems","subAgentMentionItems","modelOptions","m","selectedModel","openConfigTemplate","verificationToggle","jsx","Switch","enabled","verificationToggleNode","Tooltip","Step3Root","StepSectionHeader","jsxs","Step3Grid","SectionBodyWrap","MentionField","Step3Divider","SelectableListSection","SideSection","SideSectionHeader","Shield","TitleSmall","COLORS","BodyCaption","Fragment","BodySecondary","Dropdown","o","opt","v","unwrapDropdownValue","CreateSubAgentPanel","n","RestApiToolPanel","ConfigToolPanel","RequireVerificationModal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAMA,KAAa,CAACC,MACnBC,GAAiBC,GAAWF,CAAM,CAAC,KAAK,QAGnCG,KAAa,CAACC,OAAgC;AAAA,EACnD,OAAOA,EAAE;AAAA,EACT,OAAOA,EAAE;AAAA,EACT,aAAaL,GAAWK,EAAE,UAAUC,EAAW,QAAQ;AACxD,IAEMC,KAAOC,GAAiB,CAAC,GAGzBC,IAAsC;AAAA,EAC3C,EAAE,OAAO,gBAAgB,OAAO,YAAA;AAAA,EAChC,EAAE,OAAO,gBAAgB,OAAO,YAAA;AACjC,GAwBMC,KAAa,CAClBC,GACAC,MACS;AACT,QAAMC,IAAMF,KAAQ,CAAA;AACpB,SAAOE,EAAI,KAAK,CAACC,MAAMA,EAAE,OAAOF,EAAK,EAAE,IACpCC,EAAI,IAAI,CAACC,MAAOA,EAAE,OAAOF,EAAK,KAAKA,IAAOE,CAAE,IAC5C,CAAC,GAAGD,GAAKD,CAAI;AACjB,GAE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AAC4B;AAAA,MAAA;AAAA,QAEA,SAASxG,EAAW;AAAA,QACpB,YAAAlB;AAAA,QACA,eAAAW;AAAA,QAEA,gBAAgBrB,EAAM,gBAAgB,CAAA,GACpC,OAAO,CAACX,MAAMA,EAAE,OAAOuC,EAAW,aAAa,EAAE,EACjD,IAAI,CAACvC,MAAMA,EAAE,IAAI;AAAA,QACnB,WAAW2B;AAAA,QACX,SAAS,MAAMa,EAAc,IAAI;AAAA,QACjC,QAAQO;AAAA,MAAA;AAAA,MAVHR,EAAW;AAAA,IAAA;AAAA,IAcjBA,GAAY,SAAS,YACrBA,EAAW,WACX0E,MACC,gBAAAE;AAAA,MAAC6B;AAAA,MAAA;AAAA,QAEA,SAASzG,EAAW;AAAA,QACpB,UAAU0E;AAAA,QACV,SAAS1E,EAAW;AAAA,QACpB,YAAAlB;AAAA,QACA,eAAAW;AAAA,QACA,WAAWL;AAAA,QACX,SAAS,MAAMa,EAAc,IAAI;AAAA,QACjC,QAAQW;AAAA,MAAA;AAAA,MARHZ,EAAW;AAAA,IAAA;AAAA,IAYnB,gBAAA4E;AAAA,MAAC8B;AAAA,MAAA;AAAA,QACA,MAAM/D,MAAoB;AAAA,QAC1B,WACClE,EAAe,KAAK,CAAChB,MAAMA,EAAE,YAAYkF,CAAe,GACrD,gBAAgB;AAAA,QAEpB,UAAU,MAAMC,EAAmB,IAAI;AAAA,QACvC,WAAW,MAAM;AAChB,UAAAvE,EAAM,EAAE,gBAAgB,EAAE,SAAS,IAAM,MAAM2D,EAAA,GAAY,GACvDW,KACHE,EAAQF,CAAe,GAExBC,EAAmB,IAAI;AAAA,QACxB;AAAA,MAAA;AAAA,IAAA;AAAA,EACD,GACD;AAEF;"}
@@ -1,2 +1,13 @@
1
1
  import { default as React } from 'react';
2
+ /**
3
+ * Step 4.
4
+ *
5
+ * **Manifest** (and any other host) keeps the original single free-text field:
6
+ * the method is implicit and the consumer always sends the seeded `'default'`.
7
+ *
8
+ * **BIK** picks a handover *method* first. "Use default settings" is selected by
9
+ * default and links out to where those defaults live; "Custom instructions" is
10
+ * deliberately disabled until that flow is built, so the free-text field only
11
+ * appears for an agent already saved with a non-default method.
12
+ */
2
13
  export declare const Step4HandoverRules: React.FC;
@@ -1,28 +1,132 @@
1
- import { jsxs as h, jsx as e } from "react/jsx-runtime";
2
- import { SectionBodyWrap as s } from "../AgentBuilder.styled.js";
3
- import { AiTextArea as d } from "../components/AiTextArea.js";
4
- import { StepSectionHeader as m } from "../components/StepSectionHeader.js";
5
- import { STEP_DEFINITIONS as p } from "../constants/steps.js";
6
- import { useAgentBuilderContext as l } from "../context/AgentBuilderContext.js";
7
- const t = p[3], S = () => {
8
- const { value: o, patch: n, charLimits: a } = l(), { handover: r } = o;
9
- return /* @__PURE__ */ h("div", { className: "bik-agent-step bik-agent-step--handover", children: [
10
- /* @__PURE__ */ e(m, { title: t.title, helper: t.helper }),
11
- /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(
12
- d,
13
- {
14
- "data-test": "handover-when",
15
- label: "Handover when",
16
- value: r.when,
17
- onChange: (i) => n({ handover: { ...r, when: i } }),
18
- maxLength: a.handoverWhen,
19
- placeholder: "e.g. Hand over if the customer is angry or asks for a human three times. Hand over if the order value exceeds ₹5,000.",
20
- minHeight: "120px"
21
- }
22
- ) })
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import x from "../../../assets/icons/RedirectToNew.svg.js";
3
+ import { RadioButton as m } from "../../radioButton/RadioButton.js";
4
+ import { TitleSmall as c, BodyCaption as p } from "../../TypographyStyle.js";
5
+ import { COLORS as a, BASE_COLORS as v } from "../../../constants/Theme.js";
6
+ import { SectionBodyWrap as u, FieldBlock as T, CardRow as w, RadioCard as f, RadioCardText as g, ChannelsLink as H } from "../AgentBuilder.styled.js";
7
+ import { AiTextArea as A } from "../components/AiTextArea.js";
8
+ import { StepSectionHeader as C } from "../components/StepSectionHeader.js";
9
+ import { STEP_DEFINITIONS as B } from "../constants/steps.js";
10
+ import { useAgentBuilderContext as S } from "../context/AgentBuilderContext.js";
11
+ import { appTypeLabel as O } from "../utils/mentionSerialization.js";
12
+ import { Tooltip as R } from "../../tooltips/Tooltip.js";
13
+ const d = B[3], h = "default", K = () => {
14
+ const { value: l, patch: i, applicationType: s, onSmartAgentHandover: o } = S(), { handover: n } = l, b = O(s) === "BIK", r = n.method !== h;
15
+ return b ? /* @__PURE__ */ t("div", { className: "bik-agent-step bik-agent-step--handover", children: [
16
+ /* @__PURE__ */ e(C, { title: d.title, helper: d.helper }),
17
+ /* @__PURE__ */ t(u, { children: [
18
+ /* @__PURE__ */ t(T, { children: [
19
+ /* @__PURE__ */ e(c, { color: a.content.primary, children: "Handover method" }),
20
+ /* @__PURE__ */ t(w, { children: [
21
+ /* @__PURE__ */ t(
22
+ f,
23
+ {
24
+ "data-test": "handover-method-default",
25
+ type: "button",
26
+ selected: !r,
27
+ onClick: () => i({ handover: { ...n, method: h } }),
28
+ children: [
29
+ /* @__PURE__ */ e(
30
+ m,
31
+ {
32
+ isActive: !r,
33
+ onValueChange: () => i({ handover: { ...n, method: h } }),
34
+ skipSelectingOff: !0,
35
+ activeColor: v.brand[800]
36
+ }
37
+ ),
38
+ /* @__PURE__ */ t(g, { children: [
39
+ /* @__PURE__ */ e(c, { color: a.content.primary, children: "Use default settings" }),
40
+ /* @__PURE__ */ t(p, { color: a.content.secondary, children: [
41
+ "As defined in",
42
+ " ",
43
+ o ? /* @__PURE__ */ t(
44
+ H,
45
+ {
46
+ "data-test": "handover-smart-agent-link",
47
+ type: "button",
48
+ onClick: (k) => {
49
+ k.stopPropagation(), o();
50
+ },
51
+ style: { display: "inline-flex" },
52
+ children: [
53
+ "Smart agent handover",
54
+ /* @__PURE__ */ e(x, { width: 12, height: 12 })
55
+ ]
56
+ }
57
+ ) : "Smart agent handover"
58
+ ] })
59
+ ] })
60
+ ]
61
+ }
62
+ ),
63
+ /* @__PURE__ */ e(
64
+ R,
65
+ {
66
+ body: "Custom handover rules are coming soon. For now this agent follows your smart agent handover settings.",
67
+ placement: "top",
68
+ children: /* @__PURE__ */ e(
69
+ "span",
70
+ {
71
+ style: {
72
+ flex: 1,
73
+ display: "flex",
74
+ cursor: "not-allowed"
75
+ },
76
+ children: /* @__PURE__ */ t(
77
+ f,
78
+ {
79
+ "data-test": "handover-method-custom",
80
+ type: "button",
81
+ disabled: !0,
82
+ selected: r,
83
+ children: [
84
+ /* @__PURE__ */ e(
85
+ m,
86
+ {
87
+ isActive: r,
88
+ isDisabled: !0,
89
+ onValueChange: () => {
90
+ },
91
+ skipSelectingOff: !0,
92
+ activeColor: v.brand[800]
93
+ }
94
+ ),
95
+ /* @__PURE__ */ t(g, { children: [
96
+ /* @__PURE__ */ e(c, { color: a.content.inactive, children: "Custom instructions" }),
97
+ /* @__PURE__ */ e(p, { color: a.content.inactive, children: "Write custom handover rules for this agent." })
98
+ ] })
99
+ ]
100
+ }
101
+ )
102
+ }
103
+ )
104
+ }
105
+ )
106
+ ] })
107
+ ] }),
108
+ r && /* @__PURE__ */ e(y, {})
109
+ ] })
110
+ ] }) : /* @__PURE__ */ t("div", { className: "bik-agent-step bik-agent-step--handover", children: [
111
+ /* @__PURE__ */ e(C, { title: d.title, helper: d.helper }),
112
+ /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(y, {}) })
23
113
  ] });
114
+ }, y = () => {
115
+ const { value: l, patch: i, charLimits: s } = S(), { handover: o } = l;
116
+ return /* @__PURE__ */ e(
117
+ A,
118
+ {
119
+ "data-test": "handover-when",
120
+ label: "Handover when",
121
+ value: o.when,
122
+ onChange: (n) => i({ handover: { ...o, when: n } }),
123
+ maxLength: s.handoverWhen,
124
+ placeholder: "e.g. Hand over if the customer is angry or asks for a human three times. Hand over if the order value exceeds ₹5,000.",
125
+ minHeight: "120px"
126
+ }
127
+ );
24
128
  };
25
129
  export {
26
- S as Step4HandoverRules
130
+ K as Step4HandoverRules
27
131
  };
28
132
  //# sourceMappingURL=Step4HandoverRules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step4HandoverRules.js","sources":["../../../../../src/components/agent-builder/steps/Step4HandoverRules.tsx"],"sourcesContent":["import React from 'react';\nimport { SectionBodyWrap } from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\nconst STEP = STEP_DEFINITIONS[3];\n\n// The \"Handover method\" radio section was removed: the method is UI-only and the\n// consumer always sends the seeded default ('default'); handover.method stays on\n// the value shape untouched.\nexport const Step4HandoverRules: React.FC = () => {\n\tconst { value, patch, charLimits } = useAgentBuilderContext();\n\tconst { handover } = value;\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--handover\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<SectionBodyWrap>\n\t\t\t\t<AiTextArea\n\t\t\t\t\tdata-test=\"handover-when\"\n\t\t\t\t\tlabel=\"Handover when\"\n\t\t\t\t\tvalue={handover.when}\n\t\t\t\t\tonChange={(text) => patch({ handover: { ...handover, when: text } })}\n\t\t\t\t\tmaxLength={charLimits.handoverWhen}\n\t\t\t\t\tplaceholder=\"e.g. Hand over if the customer is angry or asks for a human three times. Hand over if the order value exceeds ₹5,000.\"\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t/>\n\t\t\t</SectionBodyWrap>\n\t\t</div>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","Step4HandoverRules","value","patch","charLimits","useAgentBuilderContext","handover","jsxs","jsx","StepSectionHeader","SectionBodyWrap","AiTextArea","text"],"mappings":";;;;;;AAOA,MAAMA,IAAOC,EAAiB,CAAC,GAKlBC,IAA+B,MAAM;AACjD,QAAM,EAAE,OAAAC,GAAO,OAAAC,GAAO,YAAAC,EAAA,IAAeC,EAAA,GAC/B,EAAE,UAAAC,MAAaJ;AAErB,SACC,gBAAAK,EAAC,OAAA,EAAI,WAAU,2CACd,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAkB,OAAOV,EAAK,OAAO,QAAQA,EAAK,QAAQ;AAAA,sBAE1DW,GAAA,EACA,UAAA,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QACA,aAAU;AAAA,QACV,OAAM;AAAA,QACN,OAAOL,EAAS;AAAA,QAChB,UAAU,CAACM,MAAST,EAAM,EAAE,UAAU,EAAE,GAAGG,GAAU,MAAMM,EAAA,GAAQ;AAAA,QACnE,WAAWR,EAAW;AAAA,QACtB,aAAY;AAAA,QACZ,WAAU;AAAA,MAAA;AAAA,IAAA,EACX,CACD;AAAA,EAAA,GACD;AAEF;"}
1
+ {"version":3,"file":"Step4HandoverRules.js","sources":["../../../../../src/components/agent-builder/steps/Step4HandoverRules.tsx"],"sourcesContent":["import RedirectIcon from '@src/assets/icons/RedirectToNew.svg';\nimport React from 'react';\nimport { RadioButton } from '@src/components/radioButton/RadioButton';\nimport { Tooltip } from '@src/components/tooltips';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { BASE_COLORS, COLORS } from '@src/constants/Theme';\nimport type { HandoverMethod } from '../AgentBuilder.model';\nimport {\n\tCardRow,\n\tChannelsLink,\n\tFieldBlock,\n\tRadioCard,\n\tRadioCardText,\n\tSectionBodyWrap,\n} from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport { appTypeLabel } from '../utils/mentionSerialization';\n\nconst STEP = STEP_DEFINITIONS[3];\n\n/**\n * The stored `handover.method` that means \"inherit the store's smart-agent\n * handover settings\" — the BIK default, and the only method selectable today.\n */\nconst DEFAULT_METHOD: HandoverMethod = 'default';\n\n/**\n * Step 4.\n *\n * **Manifest** (and any other host) keeps the original single free-text field:\n * the method is implicit and the consumer always sends the seeded `'default'`.\n *\n * **BIK** picks a handover *method* first. \"Use default settings\" is selected by\n * default and links out to where those defaults live; \"Custom instructions\" is\n * deliberately disabled until that flow is built, so the free-text field only\n * appears for an agent already saved with a non-default method.\n */\nexport const Step4HandoverRules: React.FC = () => {\n\tconst { value, patch, applicationType, onSmartAgentHandover } =\n\t\tuseAgentBuilderContext();\n\tconst { handover } = value;\n\n\tconst isBik = appTypeLabel(applicationType) === 'BIK';\n\t// Anything other than the default method means the merchant is on custom\n\t// instructions, so the free-text field is what they need to see.\n\tconst usesCustom = handover.method !== DEFAULT_METHOD;\n\n\tif (!isBik) {\n\t\treturn (\n\t\t\t<div className=\"bik-agent-step bik-agent-step--handover\">\n\t\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<HandoverWhenField />\n\t\t\t\t</SectionBodyWrap>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--handover\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<SectionBodyWrap>\n\t\t\t\t<FieldBlock>\n\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\tHandover method\n\t\t\t\t\t</TitleSmall>\n\n\t\t\t\t\t<CardRow>\n\t\t\t\t\t\t<RadioCard\n\t\t\t\t\t\t\tdata-test=\"handover-method-default\"\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tselected={!usesCustom}\n\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\tpatch({ handover: { ...handover, method: DEFAULT_METHOD } })\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\t\tisActive={!usesCustom}\n\t\t\t\t\t\t\t\tonValueChange={() =>\n\t\t\t\t\t\t\t\t\tpatch({ handover: { ...handover, method: DEFAULT_METHOD } })\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\t\t\tactiveColor={BASE_COLORS.brand['800']}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tUse default settings\n\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\tAs defined in{' '}\n\t\t\t\t\t\t\t\t\t{onSmartAgentHandover ? (\n\t\t\t\t\t\t\t\t\t\t<ChannelsLink\n\t\t\t\t\t\t\t\t\t\t\tdata-test=\"handover-smart-agent-link\"\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t// The link sits inside the card's own click target, so\n\t\t\t\t\t\t\t\t\t\t\t// stop the click bubbling up and re-selecting the card.\n\t\t\t\t\t\t\t\t\t\t\tonClick={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\t\tonSmartAgentHandover();\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ display: 'inline-flex' }}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\tSmart agent handover\n\t\t\t\t\t\t\t\t\t\t\t<RedirectIcon width={12} height={12} />\n\t\t\t\t\t\t\t\t\t\t</ChannelsLink>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t'Smart agent handover'\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</RadioCardText>\n\t\t\t\t\t\t</RadioCard>\n\n\t\t\t\t\t\t{/* Custom handover rules aren't built yet — the card is shown so the\n\t\t\t\t\t\t merchant knows it's coming, but it can't be selected. */}\n\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\tbody=\"Custom handover rules are coming soon. For now this agent follows your smart agent handover settings.\"\n\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{/* A disabled <button> fires no mouse events, so the tooltip would\n\t\t\t\t\t\t\t never open on the card itself — the span is the hover target\n\t\t\t\t\t\t\t (same wrapper IconButton uses for its disabled tooltip). It also\n\t\t\t\t\t\t\t has to carry the card's `flex: 1`, since it is now the flex item. */}\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\tcursor: 'not-allowed',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<RadioCard\n\t\t\t\t\t\t\t\t\tdata-test=\"handover-method-custom\"\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t\t\tselected={usesCustom}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\t\t\t\tisActive={usesCustom}\n\t\t\t\t\t\t\t\t\t\tisDisabled\n\t\t\t\t\t\t\t\t\t\tonValueChange={() => undefined}\n\t\t\t\t\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\t\t\t\t\tactiveColor={BASE_COLORS.brand['800']}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.inactive}>\n\t\t\t\t\t\t\t\t\t\t\tCustom instructions\n\t\t\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.inactive}>\n\t\t\t\t\t\t\t\t\t\t\tWrite custom handover rules for this agent.\n\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t</RadioCardText>\n\t\t\t\t\t\t\t\t</RadioCard>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t</CardRow>\n\t\t\t\t</FieldBlock>\n\n\t\t\t\t{usesCustom && <HandoverWhenField />}\n\t\t\t</SectionBodyWrap>\n\t\t</div>\n\t);\n};\n\n/** The free-text \"Handover when\" field, shared by both layouts. */\nconst HandoverWhenField: React.FC = () => {\n\tconst { value, patch, charLimits } = useAgentBuilderContext();\n\tconst { handover } = value;\n\n\treturn (\n\t\t<AiTextArea\n\t\t\tdata-test=\"handover-when\"\n\t\t\tlabel=\"Handover when\"\n\t\t\tvalue={handover.when}\n\t\t\tonChange={(text) => patch({ handover: { ...handover, when: text } })}\n\t\t\tmaxLength={charLimits.handoverWhen}\n\t\t\tplaceholder=\"e.g. Hand over if the customer is angry or asks for a human three times. Hand over if the order value exceeds ₹5,000.\"\n\t\t\tminHeight=\"120px\"\n\t\t/>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","DEFAULT_METHOD","Step4HandoverRules","value","patch","applicationType","onSmartAgentHandover","useAgentBuilderContext","handover","isBik","appTypeLabel","usesCustom","jsxs","jsx","StepSectionHeader","SectionBodyWrap","FieldBlock","TitleSmall","COLORS","CardRow","RadioCard","RadioButton","BASE_COLORS","RadioCardText","BodyCaption","ChannelsLink","event","RedirectIcon","Tooltip","HandoverWhenField","charLimits","AiTextArea","text"],"mappings":";;;;;;;;;;;;AAqBA,MAAMA,IAAOC,EAAiB,CAAC,GAMzBC,IAAiC,WAa1BC,IAA+B,MAAM;AACjD,QAAM,EAAE,OAAAC,GAAO,OAAAC,GAAO,iBAAAC,GAAiB,sBAAAC,EAAA,IACtCC,EAAA,GACK,EAAE,UAAAC,MAAaL,GAEfM,IAAQC,EAAaL,CAAe,MAAM,OAG1CM,IAAaH,EAAS,WAAWP;AAEvC,SAAKQ,IAYJ,gBAAAG,EAAC,O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AOf,EAAK,OAAO,QAAQA,EAAK,QAAQ;AAAA,IAC3D,gBAAAc,EAACE,GAAA,EACA,UAAA,gBAAAF,EAACgB,GAAA,CAAA,CAAkB,EAAA,CACpB;AAAA,EAAA,GACD;AA2GH,GAGMA,IAA8B,MAAM;AACzC,QAAM,EAAE,OAAA1B,GAAO,OAAAC,GAAO,YAAA0B,EAAA,IAAevB,EAAA,GAC/B,EAAE,UAAAC,MAAaL;AAErB,SACC,gBAAAU;AAAA,IAACkB;AAAA,IAAA;AAAA,MACA,aAAU;AAAA,MACV,OAAM;AAAA,MACN,OAAOvB,EAAS;AAAA,MAChB,UAAU,CAACwB,MAAS5B,EAAM,EAAE,UAAU,EAAE,GAAGI,GAAU,MAAMwB,EAAA,GAAQ;AAAA,MACnE,WAAWF,EAAW;AAAA,MACtB,aAAY;AAAA,MACZ,WAAU;AAAA,IAAA;AAAA,EAAA;AAGb;"}
@@ -28,8 +28,13 @@ export interface MentionKindMeta {
28
28
  authRequired?: boolean;
29
29
  }
30
30
  export { TOOL_SOURCE_LABELS };
31
- /** Human label for a tool source; falls back to the host-app label, then the raw key. */
32
- export declare const toolSourceLabel: (source: string | undefined, fallback?: string) => string;
31
+ /**
32
+ * Human label for a tool source. The native tools are named after whichever host
33
+ * product the merchant is in — "Manifest" in Manifest, "BIK" in BIK — so both an
34
+ * explicit `manifest` source and a missing one resolve to `appLabel`. Every other
35
+ * source is a vendor name, then the raw key.
36
+ */
37
+ export declare const toolSourceLabel: (source: string | undefined, appLabel?: string) => string;
33
38
  /** Human label for the host application, used as the tool-chip prefix. */
34
39
  export declare const appTypeLabel: (applicationType?: ApplicationType) => string;
35
40
  /**
@@ -50,7 +55,9 @@ export declare const variableTokenName: (actualValue: string) => string;
50
55
  * save. Merge alongside {@link buildAgentMentionItems} for serialization.
51
56
  */
52
57
  export declare const buildVariableMentionItems: (variablesData?: VariableListInterfaceV3[]) => MentionItem[];
53
- /** Display name for a shared config tool: first recipient / channel, else generic. */
58
+ /** Display name for a shared config tool: the merchant's action name when set
59
+ * (MAP-7245), else first recipient / channel (pre-action-name tools), else
60
+ * generic. */
54
61
  export declare const configToolName: (t: ConfigToolConfig) => string;
55
62
  /** Display name for a Rest API tool row / chip. */
56
63
  export declare const restApiToolName: (t: RestApiToolConfig) => string;
@@ -1,5 +1,5 @@
1
- import { TOOL_SOURCE_LABELS as m, ToolSource as s } from "../constants/tools.js";
2
- const b = (e, t = "Manifest") => e ? m[e] ?? e : t, h = (e) => {
1
+ import { ToolSource as l, TOOL_SOURCE_LABELS as m } from "../constants/tools.js";
2
+ const b = (e, t = "Manifest") => !e || e === l.Manifest ? t : m[e] ?? e, h = (e) => {
3
3
  const t = e ? String(e) : "";
4
4
  return t === "BIK" ? "BIK" : t === "BSP" ? "BSP" : "Manifest";
5
5
  }, E = (e, t, n = "Manifest") => [
@@ -38,36 +38,44 @@ const b = (e, t = "Manifest") => e ? m[e] ?? e : t, h = (e) => {
38
38
  Object.values(a.variables ?? {}).forEach(n);
39
39
  };
40
40
  return e.forEach(n), t;
41
- }, k = (e) => e.tool_key === "send_slack_message" ? String(e.params.channelId?.value ?? "").trim() || "Send Slack message" : String(e.params.sendTo?.value ?? "").split(",").map((t) => t.trim()).filter(Boolean)[0] || "Send email", $ = (e) => e.name || "Rest API", f = (e) => {
42
- const t = $(e);
41
+ }, k = (e) => {
42
+ if (e.tool_key === "send_slack_message")
43
+ return String(e.params.channelId?.value ?? "").trim() || "Send Slack message";
44
+ if (e.tool_key === "send_email") {
45
+ const t = String(e.params.name?.value ?? "").trim();
46
+ return t || String(e.params.sendTo?.value ?? "").split(",").map((n) => n.trim()).filter(Boolean)[0] || "Send email";
47
+ }
48
+ return e.tool_key;
49
+ }, f = (e) => e.name || "Rest API", $ = (e) => {
50
+ const t = f(e);
43
51
  return {
44
52
  id: e.id,
45
- label: `${m[s.RestApi]} : ${t}`,
46
- meta: { kind: "tool", plainLabel: t, source: s.RestApi }
53
+ label: `${m[l.RestApi]} : ${t}`,
54
+ meta: { kind: "tool", plainLabel: t, source: l.RestApi }
47
55
  };
48
56
  }, S = (e) => {
49
- const t = e.tool_key === "send_slack_message" ? s.Slack : s.EmailHandover, n = k(e);
57
+ const t = e.tool_key === "send_slack_message" ? l.Slack : l.EmailHandover, n = k(e);
50
58
  return {
51
59
  id: e.id,
52
60
  label: `${m[t]} : ${n}`,
53
61
  meta: { kind: "tool", plainLabel: n, source: t }
54
62
  };
55
- }, M = (e = [], t = []) => [
56
- ...t.map(f),
63
+ }, y = (e = [], t = []) => [
64
+ ...t.map($),
57
65
  ...e.map(S)
58
- ], l = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), r = (e) => l(e).replace(/"/g, "&quot;"), p = (e, t, n, a) => `<span data-type="mentionAgent" class="bik-mention bik-mention--agent" data-id="${r(e)}" data-label="${r(t)}" data-kind="${r(n)}"` + (a ? ` data-source="${r(a)}"` : "") + `>${l(t)}</span>`, y = (e, t, n, a) => p(e, t, n, a), T = (e) => {
66
+ ], r = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), s = (e) => r(e).replace(/"/g, "&quot;"), p = (e, t, n, a) => `<span data-type="mentionAgent" class="bik-mention bik-mention--agent" data-id="${s(e)}" data-label="${s(t)}" data-kind="${s(n)}"` + (a ? ` data-source="${s(a)}"` : "") + `>${r(t)}</span>`, M = (e, t, n, a) => p(e, t, n, a), T = (e) => {
59
67
  const t = /* @__PURE__ */ new Map();
60
68
  for (const n of e) {
61
69
  const a = n.meta;
62
70
  a?.kind === "tool" ? t.set(`tool:${String(n.id)}`, n) : a?.kind === "subagent" ? t.set(`subagent:${String(n.id)}`, n) : a?.kind === "variable" && t.set(`variable:${String(n.id)}`, n);
63
71
  }
64
72
  return t;
65
- }, c = /\{\{((?:tool|subagent|variable):[^{}]+)\}\}/g, v = (e, t) => {
73
+ }, c = /\{\{((?:tool|subagent|variable):[^{}]+)\}\}/g, _ = (e, t) => {
66
74
  let n = "", a = 0;
67
75
  c.lastIndex = 0;
68
76
  let o;
69
77
  for (; (o = c.exec(e)) !== null; ) {
70
- n += l(e.slice(a, o.index));
78
+ n += r(e.slice(a, o.index));
71
79
  const i = t.get(o[1]);
72
80
  if (i) {
73
81
  const d = i.meta;
@@ -78,16 +86,16 @@ const b = (e, t = "Manifest") => e ? m[e] ?? e : t, h = (e) => {
78
86
  d.source
79
87
  );
80
88
  } else
81
- n += l(o[0]);
89
+ n += r(o[0]);
82
90
  a = c.lastIndex;
83
91
  }
84
- return n += l(e.slice(a)), n.replace(/\n/g, "<br>");
92
+ return n += r(e.slice(a)), n.replace(/\n/g, "<br>");
85
93
  }, A = (e, t = []) => {
86
94
  if (!e)
87
95
  return "";
88
96
  const n = T(t);
89
- return e.split(/\n{2,}/).map((a) => `<p>${v(a, n)}</p>`).join("");
90
- }, L = (e, t, n) => t === "variable" ? `{{variable:${e}}}` : (t ?? (n.has(e) ? "tool" : "subagent")) === "tool" ? `{{tool:${e}}}` : `{{subagent:${e}}}`, u = (e, t) => {
97
+ return e.split(/\n{2,}/).map((a) => `<p>${_(a, n)}</p>`).join("");
98
+ }, v = (e, t, n) => t === "variable" ? `{{variable:${e}}}` : (t ?? (n.has(e) ? "tool" : "subagent")) === "tool" ? `{{tool:${e}}}` : `{{subagent:${e}}}`, u = (e, t) => {
91
99
  switch (e.type) {
92
100
  case "text":
93
101
  return e.text ?? "";
@@ -97,7 +105,7 @@ const b = (e, t = "Manifest") => e ? m[e] ?? e : t, h = (e) => {
97
105
  if (n == null)
98
106
  return "";
99
107
  const a = e.attrs?.kind;
100
- return L(
108
+ return v(
101
109
  String(n),
102
110
  a == null ? null : String(a),
103
111
  t
@@ -126,7 +134,7 @@ const b = (e, t = "Manifest") => e ? m[e] ?? e : t, h = (e) => {
126
134
  ` : n;
127
135
  }
128
136
  }
129
- }, B = (e, t) => {
137
+ }, N = (e, t) => {
130
138
  if (!e)
131
139
  return "";
132
140
  const n = new Set(t.map((a) => a.tool_id));
@@ -139,15 +147,15 @@ export {
139
147
  m as TOOL_SOURCE_LABELS,
140
148
  h as appTypeLabel,
141
149
  E as buildAgentMentionItems,
142
- M as buildCustomToolMentionItems,
143
- y as buildMentionHtml,
150
+ y as buildCustomToolMentionItems,
151
+ M as buildMentionHtml,
144
152
  I as buildVariableMentionItems,
145
153
  S as configToolMentionItem,
146
154
  k as configToolName,
147
- B as editorDocToInstructions,
155
+ N as editorDocToInstructions,
148
156
  A as instructionsToEditorHtml,
149
- f as restApiMentionItem,
150
- $ as restApiToolName,
157
+ $ as restApiMentionItem,
158
+ f as restApiToolName,
151
159
  b as toolSourceLabel,
152
160
  g as variableTokenName
153
161
  };