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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  2. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +28 -16
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +2 -2
  6. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
  8. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
  10. package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/MentionPicker.js +11 -11
  12. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +1 -1
  16. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  18. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  20. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  22. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  23. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +4 -4
  24. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  25. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  26. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  27. package/dist/cjs/editor/BikEditor.styles.js +0 -6
  28. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  29. package/dist/cjs/icons/Informational/Common UI/ShieldOutline.js +2 -0
  30. package/dist/cjs/icons/Informational/Common UI/ShieldOutline.js.map +1 -0
  31. package/dist/cjs/icons/index.js +1 -1
  32. package/dist/esm/components/agent-builder/AgentBuilder.js +69 -71
  33. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  34. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +0 -8
  35. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +3 -0
  36. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +46 -33
  37. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  38. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +0 -3
  39. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +110 -113
  40. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  41. package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +0 -7
  42. package/dist/esm/components/agent-builder/components/MentionEditor.js +74 -89
  43. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  44. package/dist/esm/components/agent-builder/components/MentionField.js +26 -28
  45. package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
  46. package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +1 -14
  47. package/dist/esm/components/agent-builder/components/MentionPicker.js +138 -167
  48. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  49. package/dist/esm/components/agent-builder/components/RequireVerificationModal.js +5 -5
  50. package/dist/esm/components/agent-builder/components/RequireVerificationModal.js.map +1 -1
  51. package/dist/esm/components/agent-builder/components/SelectableListSection.js +72 -63
  52. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  53. package/dist/esm/components/agent-builder/constants/tools.d.ts +1 -1
  54. package/dist/esm/components/agent-builder/constants/tools.js +5 -6
  55. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  56. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +0 -7
  57. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +96 -99
  58. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  59. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +174 -165
  60. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  61. package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +4 -14
  62. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +38 -50
  63. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  64. package/dist/esm/components/agent-listing/AgentTableRow.js +1 -1
  65. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  66. package/dist/esm/editor/BikEditor.styles.js +0 -6
  67. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  68. package/dist/esm/icons/Informational/Common UI/ShieldOutline.d.ts +7 -0
  69. package/dist/esm/icons/Informational/Common UI/ShieldOutline.js +35 -0
  70. package/dist/esm/icons/Informational/Common UI/ShieldOutline.js.map +1 -0
  71. package/dist/esm/icons/Informational/Common UI/index.d.ts +1 -0
  72. package/dist/esm/icons/index.d.ts +25 -25
  73. package/dist/esm/icons/index.js +172 -170
  74. package/dist/esm/icons/index.js.map +1 -1
  75. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"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 {\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\tif (isNew) {\n\t\t\t\tinsertMention('tool', config.id, restApiMentionItem(config).label);\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\tinsertMention('tool', config.id, configToolMentionItem(config).label);\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// 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\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\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\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\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\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],\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.\n\tconst hasAuthRequiredTool = value.tools.some(\n\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t);\n\tconst authEnabled = value.authentication?.enabled ?? false;\n\tconst authType: Authentication['type'] =\n\t\tvalue.authentication?.type ?? 'email_otp';\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\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<Switch\n\t\t\t\t\t\t\t\tdata-test=\"agent-auth-toggle\"\n\t\t\t\t\t\t\t\tvalue={authEnabled || hasAuthRequiredTool}\n\t\t\t\t\t\t\t\t// Mandatory (can't turn off) while an auth_required tool is attached.\n\t\t\t\t\t\t\t\tdisabled={hasAuthRequiredTool}\n\t\t\t\t\t\t\t\tonValueChange={async (enabled) => {\n\t\t\t\t\t\t\t\t\tpatch({ authentication: { enabled, type: authType } });\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\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\toptions={AUTH_METHOD_OPTIONS}\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\tavailableTools={availableTools}\n\t\t\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\t\t\tvariablesData={variablesData}\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\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\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","subAgentById","s","knownSubAgents","openCreate","openConfigure","id","data","handlePanelSave","draft","ref","prev","hasAuthRequiredTool","authEnabled","authType","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","Step3Root","jsx","StepSectionHeader","jsxs","Step3Grid","SectionBodyWrap","MentionField","Step3Divider","SelectableListSection","SideSection","SideSectionHeader","Shield","TitleSmall","COLORS","Switch","enabled","BodyCaption","Fragment","BodySecondary","Dropdown","o","opt","v","unwrapDropdownValue","CreateSubAgentPanel","RestApiToolPanel","ConfigToolPanel","RequireVerificationModal"],"mappings":"6/BA4DMA,GAAcC,GACnBC,EAAAA,iBAAiBC,EAAAA,WAAWF,CAAM,CAAC,GAAK,OAGnCG,GAAcC,IAAgC,CACnD,MAAOA,EAAE,aACT,MAAOA,EAAE,QACT,YAAaL,GAAWK,EAAE,QAAUC,EAAAA,WAAW,QAAQ,CACxD,GAEMC,GAAOC,GAAAA,iBAAiB,CAAC,EAGzBC,EAAsC,CAC3C,CAAE,MAAO,eAAgB,MAAO,WAAA,EAChC,CAAE,MAAO,eAAgB,MAAO,WAAA,CACjC,EAwBMC,GAAa,CAClBC,EACAC,IACS,CACT,MAAMC,EAAMF,GAAQ,CAAA,EACpB,OAAOE,EAAI,KAAMC,GAAMA,EAAE,KAAOF,EAAK,EAAE,EACpCC,EAAI,IAAKC,GAAOA,EAAE,KAAOF,EAAK,GAAKA,EAAOE,CAAE,EAC5C,CAAC,GAAGD,EAAKD,CAAI,CACjB,EAEaG,GAA+B,IAAM,CACjD,KAAM,CACL,MAAAC,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,mBAAAC,GACA,gBAAAC,EACA,oBAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,kBAAAC,GACA,0BAAAC,EACA,wBAAAC,EACA,0BAAAC,EACA,kBAAAC,EACA,qBAAAC,EACA,cAAAC,EAAA,EACGC,0BAAA,EAEE,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAoC,IAAI,EAC5DC,EAAcC,EAAAA,OAAO,CAAC,EAGtB,CAACC,EAAYC,CAAa,EAAIJ,EAAAA,SAAiC,IAAI,EACnEK,EAAmBH,EAAAA,OAAO,CAAC,EAC3BI,EAAcC,cAAaC,GAAgC,CAChEH,EAAiB,SAAW,EAC5BD,EAAc,CACb,I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AC5B,OAAQ8B,EAAA,EAXH/B,EAAM,GAAA,EAeZK,GAAY,OAAS,WACrBmE,EAAAA,IAACwB,GAAAA,iBAAA,CAEA,QAAS3F,EAAW,YACpB,WAAAlB,EAEA,eAAgBV,EAAM,cAAgB,CAAA,GACpC,OAAQX,GAAMA,EAAE,KAAOuC,EAAW,aAAa,EAAE,EACjD,IAAKvC,GAAMA,EAAE,IAAI,EACnB,UAAW2B,EACX,QAAS,IAAMa,EAAc,IAAI,EACjC,OAAQO,EAAA,EATHR,EAAW,GAAA,EAajBA,GAAY,OAAS,UACrBA,EAAW,SACXiE,GACCE,EAAAA,IAACyB,GAAAA,gBAAA,CAEA,QAAS5F,EAAW,QACpB,SAAUiE,EACV,QAASjE,EAAW,cACpB,WAAAlB,EACA,UAAWM,EACX,QAAS,IAAMa,EAAc,IAAI,EACjC,OAAQW,EAAA,EAPHZ,EAAW,GAAA,EAWnBmE,EAAAA,IAAC0B,GAAAA,yBAAA,CACA,KAAM5D,IAAoB,KAC1B,UACCxD,EAAe,KAAMhB,GAAMA,EAAE,UAAYwE,CAAe,GACrD,cAAgB,YAEpB,SAAU,IAAMC,EAAmB,IAAI,EACvC,UAAW,IAAM,CAChB7D,EAAM,CAAE,eAAgB,CAAE,QAAS,GAAM,KAAM2D,CAAA,EAAY,EACvDC,GACHE,EAAQF,CAAe,EAExBC,EAAmB,IAAI,CACxB,CAAA,CAAA,CACD,EACD,CAEF"}
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} = 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\tif (isNew) {\n\t\t\t\tinsertMention('tool', config.id, restApiMentionItem(config).label);\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\tinsertMention('tool', config.id, configToolMentionItem(config).label);\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// 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\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\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\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\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\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],\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.\n\tconst hasAuthRequiredTool = value.tools.some(\n\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t);\n\tconst authEnabled = value.authentication?.enabled ?? false;\n\tconst authType: Authentication['type'] =\n\t\tvalue.authentication?.type ?? 'email_otp';\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\tavailableTools={availableTools}\n\t\t\t\t\tconfigToolTemplates={configToolTemplates}\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\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\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","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","subAgentById","s","knownSubAgents","openCreate","openConfigure","id","data","handlePanelSave","draft","ref","prev","hasAuthRequiredTool","authEnabled","authType","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","RestApiToolPanel","ConfigToolPanel","RequireVerificationModal"],"mappings":"qiCA6DMA,GAAcC,GACnBC,EAAAA,iBAAiBC,EAAAA,WAAWF,CAAM,CAAC,GAAK,OAGnCG,GAAcC,IAAgC,CACnD,MAAOA,EAAE,aACT,MAAOA,EAAE,QACT,YAAaL,GAAWK,EAAE,QAAUC,EAAAA,WAAW,QAAQ,CACxD,GAEMC,GAAOC,GAAAA,iBAAiB,CAAC,EAGzBC,EAAsC,CAC3C,CAAE,MAAO,eAAgB,MAAO,WAAA,EAChC,CAAE,MAAO,eAAgB,MAAO,WAAA,CACjC,EAwBMC,GAAa,CAClBC,EACAC,IACS,CACT,MAAMC,EAAMF,GAAQ,CAAA,EACpB,OAAOE,EAAI,KAAMC,GAAMA,EAAE,KAAOF,EAAK,EAAE,EACpCC,EAAI,IAAKC,GAAOA,EAAE,KAAOF,EAAK,GAAKA,EAAOE,CAAE,EAC5C,CAAC,GAAGD,EAAKD,CAAI,CACjB,EAEaG,GAA+B,IAAM,CACjD,KAAM,CACL,MAAAC,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,mBAAAC,GACA,gBAAAC,EACA,oBAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,kBAAAC,GACA,0BAAAC,EACA,wBAAAC,EACA,0BAAAC,EACA,k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AAU,IAAMC,EAAmB,IAAI,EACvC,UAAW,IAAM,CAChB5D,EAAM,CAAE,eAAgB,CAAE,QAAS,GAAM,KAAM0D,CAAA,EAAY,EACvDC,GACHE,EAAQF,CAAe,EAExBC,EAAmB,IAAI,CACxB,CAAA,CAAA,CACD,EACD,CAEF"}
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../constants/tools.js"),m=(e,t="Manifest")=>e?i.TOOL_SOURCE_LABELS[e]??e:t,L=e=>{const t=e?String(e):"";return t==="BIK"?"BIK":t==="BSP"?"BSP":"Manifest"},f=(e,t,n="Manifest")=>[...e.map(a=>({id:a.tool_id,label:`${m(a.source,n)} : ${a.display_name}`,meta:{kind:"tool",plainLabel:a.display_name,source:a.source,authRequired:a.auth_required}})),...t.map(a=>({id:a.id,label:`sub-agent: ${a.name}`,meta:{kind:"subagent",plainLabel:a.name}}))],d=e=>e.replace(/^\{\{|\}\}$/g,""),$=(e=[])=>{const t=[],n=a=>{const o=a.actualValue;o&&t.push({id:d(o),label:`Variable: ${a.displayName}`,meta:{kind:"variable",plainLabel:a.displayName}}),Object.values(a.variables??{}).forEach(n)};return e.forEach(n),t},p=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",b=e=>e.name||"Rest API",g=e=>{const t=b(e);return{id:e.id,label:`${i.TOOL_SOURCE_LABELS[i.ToolSource.RestApi]} : ${t}`,meta:{kind:"tool",plainLabel:t,source:i.ToolSource.RestApi}}},S=e=>{const t=e.tool_key==="send_slack_message"?i.ToolSource.Slack:i.ToolSource.EmailHandover,n=p(e);return{id:e.id,label:`${i.TOOL_SOURCE_LABELS[t]} : ${n}`,meta:{kind:"tool",plainLabel:n,source:t}}},_=(e=[],t=[])=>[...t.map(g),...e.map(S)],l=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),s=e=>l(e).replace(/"/g,"&quot;"),T=(e,t,n)=>`<span data-type="mentionAgent" class="bik-mention bik-mention--agent" data-id="${s(e)}" data-label="${s(t)}" data-kind="${s(n)}">${l(t)}</span>`,E=(e,t,n)=>T(e,t,n),O=e=>{const t=new Map;for(const n of e){const a=n.meta;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)}return t},c=/\{\{((?:tool|subagent|variable):[^{}]+)\}\}/g,v=(e,t)=>{let n="",a=0;c.lastIndex=0;let o;for(;(o=c.exec(e))!==null;){n+=l(e.slice(a,o.index));const r=t.get(o[1]);if(r){const k=r.meta.kind;n+=T(String(r.id),r.label,k)}else n+=l(o[0]);a=c.lastIndex}return n+=l(e.slice(a)),n.replace(/\n/g,"<br>")},I=(e,t=[])=>{if(!e)return"";const n=O(t);return e.split(/\n{2,}/).map(a=>`<p>${v(a,n)}</p>`).join("")},M=(e,t,n)=>t==="variable"?`{{variable:${e}}}`:(t??(n.has(e)?"tool":"subagent"))==="tool"?`{{tool:${e}}}`:`{{subagent:${e}}}`,u=(e,t)=>{switch(e.type){case"text":return e.text??"";case"mentionAgent":case"mentionTeam":{const n=e.attrs?.id;if(n==null)return"";const a=e.attrs?.kind;return M(String(n),a==null?null:String(a),t)}case"variable":return`{{${String(e.attrs?.variableName??"")}}}`;case"hardBreak":return`
2
- `;case"orderedList":case"bulletList":{const n=e.type==="orderedList";return(e.content??[]).map((a,o)=>`${n?`${o+1}.`:"-"} ${u(a,t).replace(/\n+$/,"")}`).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../constants/tools.js"),m=(e,t="Manifest")=>e?i.TOOL_SOURCE_LABELS[e]??e:t,L=e=>{const t=e?String(e):"";return t==="BIK"?"BIK":t==="BSP"?"BSP":"Manifest"},k=(e,t,n="Manifest")=>[...e.map(o=>({id:o.tool_id,label:`${m(o.source,n)} : ${o.display_name}`,meta:{kind:"tool",plainLabel:o.display_name,source:o.source,authRequired:o.auth_required}})),...t.map(o=>({id:o.id,label:`sub-agent: ${o.name}`,meta:{kind:"subagent",plainLabel:o.name}}))],d=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",p=e=>e.name||"Rest API",b=e=>{const t=p(e);return{id:e.id,label:`${i.TOOL_SOURCE_LABELS[i.ToolSource.RestApi]} : ${t}`,meta:{kind:"tool",plainLabel:t,source:i.ToolSource.RestApi}}},g=e=>{const t=e.tool_key==="send_slack_message"?i.ToolSource.Slack:i.ToolSource.EmailHandover,n=d(e);return{id:e.id,label:`${i.TOOL_SOURCE_LABELS[t]} : ${n}`,meta:{kind:"tool",plainLabel:n,source:t}}},_=(e=[],t=[])=>[...t.map(b),...e.map(g)],s=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),r=e=>s(e).replace(/"/g,"&quot;"),S=(e,t,n)=>`<span data-type="mentionAgent" class="bik-mention bik-mention--agent" data-id="${r(e)}" data-label="${r(t)}" data-kind="${r(n)}">${s(t)}</span>`,$=(e,t,n)=>S(e,t,n),f=e=>{const t=new Map;for(const n of e){const o=n.meta;o?.kind==="tool"?t.set(`tool:${String(n.id)}`,n):o?.kind==="subagent"&&t.set(`subagent:${String(n.id)}`,n)}return t},c=/\{\{(tool:[^}]+|subagent:[^}]+)\}\}/g,E=(e,t)=>{let n="",o=0;c.lastIndex=0;let a;for(;(a=c.exec(e))!==null;){n+=s(e.slice(o,a.index));const l=t.get(a[1]);if(l){const T=l.meta.kind;n+=S(String(l.id),l.label,T)}else n+=s(a[0]);o=c.lastIndex}return n+=s(e.slice(o)),n.replace(/\n/g,"<br>")},O=(e,t=[])=>{if(!e)return"";const n=f(t);return e.split(/\n{2,}/).map(o=>`<p>${E(o,n)}</p>`).join("")},A=(e,t,n)=>(t??(n.has(e)?"tool":"subagent"))==="tool"?`{{tool:${e}}}`:`{{subagent:${e}}}`,u=(e,t)=>{switch(e.type){case"text":return e.text??"";case"mentionAgent":case"mentionTeam":{const n=e.attrs?.id;if(n==null)return"";const o=e.attrs?.kind;return A(String(n),o==null?null:String(o),t)}case"variable":return`{{${String(e.attrs?.variableName??"")}}}`;case"hardBreak":return`
2
+ `;case"orderedList":case"bulletList":{const n=e.type==="orderedList";return(e.content??[]).map((o,a)=>`${n?`${a+1}.`:"-"} ${u(o,t).replace(/\n+$/,"")}`).join(`
3
3
  `)+`
4
- `}default:{const n=(e.content??[]).map(o=>u(o,t)).join("");return["paragraph","heading","listItem","blockquote"].includes(e.type)?`${n}
5
- `:n}}},A=(e,t)=>{if(!e)return"";const n=new Set(t.map(a=>a.tool_id));return u(e,n).replace(/\n+$/,"")};exports.TOOL_SOURCE_LABELS=i.TOOL_SOURCE_LABELS;exports.appTypeLabel=L;exports.buildAgentMentionItems=f;exports.buildCustomToolMentionItems=_;exports.buildMentionHtml=E;exports.buildVariableMentionItems=$;exports.configToolMentionItem=S;exports.configToolName=p;exports.editorDocToInstructions=A;exports.instructionsToEditorHtml=I;exports.restApiMentionItem=g;exports.restApiToolName=b;exports.toolSourceLabel=m;exports.variableTokenName=d;
4
+ `}default:{const n=(e.content??[]).map(a=>u(a,t)).join("");return["paragraph","heading","listItem","blockquote"].includes(e.type)?`${n}
5
+ `:n}}},I=(e,t)=>{if(!e)return"";const n=new Set(t.map(o=>o.tool_id));return u(e,n).replace(/\n+$/,"")};exports.TOOL_SOURCE_LABELS=i.TOOL_SOURCE_LABELS;exports.appTypeLabel=L;exports.buildAgentMentionItems=k;exports.buildCustomToolMentionItems=_;exports.buildMentionHtml=$;exports.configToolMentionItem=g;exports.configToolName=d;exports.editorDocToInstructions=I;exports.instructionsToEditorHtml=O;exports.restApiMentionItem=b;exports.restApiToolName=p;exports.toolSourceLabel=m;
6
6
  //# sourceMappingURL=mentionSerialization.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mentionSerialization.js","sources":["../../../../../src/components/agent-builder/utils/mentionSerialization.ts"],"sourcesContent":["import type { ApplicationType } from '@bikdotai/bik-models/growth';\nimport { MentionItem } from '@src/editor';\nimport type {\n\tSubHeader,\n\tVariableListInterfaceV3,\n\tVariableV3,\n} from '../../variable-picker-v3/model';\nimport {\n\tAgentTool,\n\tConfigToolConfig,\n\tRestApiToolConfig,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport { TOOL_SOURCE_LABELS, ToolSource } from '../constants/tools';\n\n/**\n * Serialization helpers between the BikEditor document and the firebase\n * `instructions` string.\n *\n * Firebase stores `instructions` as PLAIN TEXT with inline reference tokens:\n * - `{{subagent:<agentId>}}` — hand-off to another agent\n * - `{{tool:<tool_id>}}` — an action the agent can call\n * - `{{variable:<name>}}` — a template variable picked from the catalog\n *\n * In the editor those references are inserted via the `@` mention menu (which we\n * populate with BOTH tools and sub-agents). Mention nodes keep their `id` in the\n * ProseMirror doc JSON (the rendered HTML drops it), so we serialize from the doc\n * JSON — not from HTML.\n */\n\nexport interface MentionKindMeta {\n\t/** Distinguishes a tool / sub-agent / variable reference. */\n\tkind: 'tool' | 'subagent' | 'variable';\n\t/** Plain item name (no prefix) shown in the picker dropdown rows. */\n\tplainLabel?: string;\n\t/** For tools: the source bucket (manifest / shopify / …) the picker groups by. */\n\tsource?: string;\n\t/** For tools: touches customer-private data → shows a shield in the picker. */\n\tauthRequired?: boolean;\n}\n\n// Source labels moved to constants/tools.ts; re-exported for existing importers.\nexport { TOOL_SOURCE_LABELS };\n\n/** Human label for a tool source; falls back to the host-app label, then the raw key. */\nexport const toolSourceLabel = (\n\tsource: string | undefined,\n\tfallback = 'Manifest',\n): string => {\n\tif (!source) {\n\t\treturn fallback;\n\t}\n\treturn TOOL_SOURCE_LABELS[source as ToolSource] ?? source;\n};\n\n/** Human label for the host application, used as the tool-chip prefix. */\nexport const appTypeLabel = (applicationType?: ApplicationType): string => {\n\tconst key = applicationType ? String(applicationType) : '';\n\tif (key === 'BIK') {\n\t\treturn 'BIK';\n\t}\n\tif (key === 'BSP') {\n\t\treturn 'BSP';\n\t}\n\treturn 'Manifest';\n};\n\n/**\n * Build the combined `@` mention list from the available tools + sub-agents.\n *\n * The `label` is the CHIP text shown once inserted — tools read\n * `\"<App> : <tool name>\"` (e.g. \"Manifest : Look up order\"), sub-agents read\n * `\"sub-agent: <name>\"`. `meta.plainLabel` is the un-prefixed name for the\n * picker rows, and `meta.kind` drives the `{{tool}}` / `{{subagent}}` colour.\n */\nexport const buildAgentMentionItems = (\n\ttools: AgentTool[],\n\tsubAgents: SubAgentRef[],\n\tappLabel = 'Manifest',\n): MentionItem[] => [\n\t...tools.map(\n\t\t(t): MentionItem => ({\n\t\t\tid: t.tool_id,\n\t\t\tlabel: `${toolSourceLabel(t.source, appLabel)} : ${t.display_name}`,\n\t\t\tmeta: {\n\t\t\t\tkind: 'tool',\n\t\t\t\tplainLabel: t.display_name,\n\t\t\t\tsource: t.source,\n\t\t\t\tauthRequired: t.auth_required,\n\t\t\t},\n\t\t}),\n\t),\n\t...subAgents.map(\n\t\t(s): MentionItem => ({\n\t\t\tid: s.id,\n\t\t\tlabel: `sub-agent: ${s.name}`,\n\t\t\tmeta: { kind: 'subagent', plainLabel: s.name },\n\t\t}),\n\t),\n];\n\n/** Strip the `{{ }}` wrapper from a variable token (`{{a.b}}` → `a.b`). */\nexport const variableTokenName = (actualValue: string): string =>\n\tactualValue.replace(/^\\{\\{|\\}\\}$/g, '');\n\n/**\n * Flatten the (nested) variable catalog into mention items, so stored\n * `{{<name>}}` tokens rehydrate as `Variable: <display name>` chips. The item\n * id is the BARE token name (no braces) — `resolveMentionToken` re-wraps it on\n * save. Merge alongside {@link buildAgentMentionItems} for serialization.\n */\nexport const buildVariableMentionItems = (\n\tvariablesData: VariableListInterfaceV3[] = [],\n): MentionItem[] => {\n\tconst items: MentionItem[] = [];\n\tconst walk = (entry: VariableListInterfaceV3 | SubHeader | VariableV3) => {\n\t\tconst actual = (entry as VariableV3).actualValue;\n\t\tif (actual) {\n\t\t\titems.push({\n\t\t\t\tid: variableTokenName(actual),\n\t\t\t\tlabel: `Variable: ${entry.displayName}`,\n\t\t\t\tmeta: { kind: 'variable', plainLabel: entry.displayName },\n\t\t\t});\n\t\t}\n\t\tObject.values(entry.variables ?? {}).forEach(walk);\n\t};\n\tvariablesData.forEach(walk);\n\treturn items;\n};\n\n/** Display name for a shared config tool: first recipient / channel, else generic. */\nexport const configToolName = (t: ConfigToolConfig): string => {\n\tif (t.tool_key === 'send_slack_message') {\n\t\treturn (\n\t\t\tString(t.params['channelId']?.value ?? '').trim() || 'Send Slack message'\n\t\t);\n\t}\n\treturn (\n\t\tString(t.params['sendTo']?.value ?? '')\n\t\t\t.split(',')\n\t\t\t.map((s) => s.trim())\n\t\t\t.filter(Boolean)[0] || 'Send Email'\n\t);\n};\n\n/** Display name for a Rest API tool row / chip. */\nexport const restApiToolName = (t: RestApiToolConfig): string =>\n\tt.name || 'Rest API';\n\n/** The `@`-mention chip item for a Rest API tool (kind 'tool', restapi source). */\nexport const restApiMentionItem = (t: RestApiToolConfig): MentionItem => {\n\tconst name = restApiToolName(t);\n\treturn {\n\t\tid: t.id,\n\t\tlabel: `${TOOL_SOURCE_LABELS[ToolSource.RestApi]} : ${name}`,\n\t\tmeta: { kind: 'tool', plainLabel: name, source: ToolSource.RestApi },\n\t};\n};\n\n/** The `@`-mention chip item for a shared config tool (email / Slack). */\nexport const configToolMentionItem = (t: ConfigToolConfig): MentionItem => {\n\tconst source =\n\t\tt.tool_key === 'send_slack_message'\n\t\t\t? ToolSource.Slack\n\t\t\t: ToolSource.EmailHandover;\n\tconst name = configToolName(t);\n\treturn {\n\t\tid: t.id,\n\t\tlabel: `${TOOL_SOURCE_LABELS[source]} : ${name}`,\n\t\tmeta: { kind: 'tool', plainLabel: name, source },\n\t};\n};\n\n/**\n * Mention items for the inline-configured custom tools (Rest API + email / Slack)\n * so their `{{tool:<id>}}` tokens rehydrate as chips — they live on the agent\n * value, not in the catalog `availableTools`. Merge alongside\n * {@link buildAgentMentionItems} in the editor's mention list.\n */\nexport const buildCustomToolMentionItems = (\n\tconfigTools: ConfigToolConfig[] = [],\n\trestApiTools: RestApiToolConfig[] = [],\n): MentionItem[] => [\n\t...restApiTools.map(restApiMentionItem),\n\t...configTools.map(configToolMentionItem),\n];\n\nconst escapeHtml = (raw: string): string =>\n\traw.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n\nconst escapeAttr = (raw: string): string =>\n\tescapeHtml(raw).replace(/\"/g, '&quot;');\n\n/**\n * The HTML for a single mention chip. Must round-trip through the TipTap mention\n * extension's `parseHTML` (`span[data-type=\"mentionAgent\"]`, reading\n * `data-id`/`data-label`/`data-kind`) — see MentionExtension.ts. `normalizeHtml`\n * is taught to keep `data-type=\"mention…\"` spans so this survives to the parser.\n */\nconst mentionSpanHtml = (id: string, label: string, kind: string): string =>\n\t`<span data-type=\"mentionAgent\" class=\"bik-mention bik-mention--agent\"` +\n\t` data-id=\"${escapeAttr(id)}\" data-label=\"${escapeAttr(label)}\"` +\n\t` data-kind=\"${escapeAttr(kind)}\">${escapeHtml(label)}</span>`;\n\n/**\n * Public: HTML for one mention chip, for inserting at the cursor (e.g. when a\n * tool / sub-agent is added from the Step-3 side panel). Round-trips through the\n * same parser path as the rehydrated chips.\n */\nexport const buildMentionHtml = (\n\tid: string,\n\tlabel: string,\n\tkind: 'tool' | 'subagent' | 'variable',\n): string => mentionSpanHtml(id, label, kind);\n\n/**\n * `{{tool:<id>}}` / `{{subagent:<id>}}` / `{{<variableName>}}` → the mention\n * item that produced them. The map key is the token's INNER text.\n */\nconst buildTokenLookup = (\n\tmentionItems: MentionItem[],\n): Map<string, MentionItem> => {\n\tconst byToken = new Map<string, MentionItem>();\n\tfor (const item of mentionItems) {\n\t\tconst meta = item.meta as unknown as MentionKindMeta | undefined;\n\t\t// Everything is keyed by its kind-prefixed id (a tool's id is its tool_id).\n\t\tif (meta?.kind === 'tool') {\n\t\t\tbyToken.set(`tool:${String(item.id)}`, item);\n\t\t} else if (meta?.kind === 'subagent') {\n\t\t\tbyToken.set(`subagent:${String(item.id)}`, item);\n\t\t} else if (meta?.kind === 'variable') {\n\t\t\tbyToken.set(`variable:${String(item.id)}`, item);\n\t\t}\n\t}\n\treturn byToken;\n};\n\n// Matches the kind-prefixed reference tokens we render as chips. Other\n// `{{var}}` tokens fall through untouched (left as literal text for the\n// variable decoration).\nconst REFERENCE_TOKEN = /\\{\\{((?:tool|subagent|variable):[^{}]+)\\}\\}/g;\n\n/** Escape plain text, swapping recognised reference tokens for mention spans. */\nconst inlineToHtml = (\n\tsegment: string,\n\tbyToken: Map<string, MentionItem>,\n): string => {\n\tlet out = '';\n\tlet lastIndex = 0;\n\tREFERENCE_TOKEN.lastIndex = 0;\n\tlet match: RegExpExecArray | null;\n\twhile ((match = REFERENCE_TOKEN.exec(segment)) !== null) {\n\t\tout += escapeHtml(segment.slice(lastIndex, match.index));\n\t\tconst item = byToken.get(match[1]);\n\t\tif (item) {\n\t\t\tconst kind = (item.meta as unknown as MentionKindMeta).kind;\n\t\t\tout += mentionSpanHtml(String(item.id), item.label, kind);\n\t\t} else {\n\t\t\t// Not in any available list (removed tool / unknown variable) → keep the\n\t\t\t// raw token as literal text.\n\t\t\tout += escapeHtml(match[0]);\n\t\t}\n\t\tlastIndex = REFERENCE_TOKEN.lastIndex;\n\t}\n\tout += escapeHtml(segment.slice(lastIndex));\n\treturn out.replace(/\\n/g, '<br>');\n};\n\n/**\n * Convert the stored instructions string into HTML for `BikEditor.initialContent`.\n * `{{tool:KEY}}` / `{{subagent:ID}}` tokens are rehydrated into mention chips\n * (resolved via `mentionItems`); any other `{{…}}` token is left as literal text\n * for the editor's variable decoration. Newlines become paragraph / line breaks.\n */\nexport const instructionsToEditorHtml = (\n\ttext: string,\n\tmentionItems: MentionItem[] = [],\n): string => {\n\tif (!text) {\n\t\treturn '';\n\t}\n\tconst byToken = buildTokenLookup(mentionItems);\n\treturn text\n\t\t.split(/\\n{2,}/)\n\t\t.map((para) => `<p>${inlineToHtml(para, byToken)}</p>`)\n\t\t.join('');\n};\n\ninterface ProseMirrorNode {\n\ttype: string;\n\ttext?: string;\n\tattrs?: Record<string, unknown>;\n\tcontent?: ProseMirrorNode[];\n}\n\n/**\n * The token for a mention node. All kinds store their id in the node, so the\n * token value is just that id — the kind only picks the prefix. The node's\n * `kind` attr is authoritative; `toolIds` is a fallback for older content\n * saved before the kind attr existed.\n */\nconst resolveMentionToken = (\n\tid: string,\n\tkind: string | null,\n\ttoolIds: Set<string>,\n): string => {\n\tif (kind === 'variable') {\n\t\treturn `{{variable:${id}}}`;\n\t}\n\tconst resolved = kind ?? (toolIds.has(id) ? 'tool' : 'subagent');\n\treturn resolved === 'tool' ? `{{tool:${id}}}` : `{{subagent:${id}}}`;\n};\n\nconst nodeToText = (node: ProseMirrorNode, toolIds: Set<string>): string => {\n\tswitch (node.type) {\n\t\tcase 'text':\n\t\t\treturn node.text ?? '';\n\t\tcase 'mentionAgent':\n\t\tcase 'mentionTeam': {\n\t\t\tconst id = node.attrs?.['id'];\n\t\t\tif (id == null) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t\tconst kind = node.attrs?.['kind'];\n\t\t\treturn resolveMentionToken(\n\t\t\t\tString(id),\n\t\t\t\tkind == null ? null : String(kind),\n\t\t\t\ttoolIds,\n\t\t\t);\n\t\t}\n\t\tcase 'variable':\n\t\t\treturn `{{${String(node.attrs?.['variableName'] ?? '')}}}`;\n\t\tcase 'hardBreak':\n\t\t\treturn '\\n';\n\t\tcase 'orderedList':\n\t\tcase 'bulletList': {\n\t\t\t// Flattening to plain text otherwise drops the list markers, so a\n\t\t\t// numbered / bulleted list looks \"removed\" after publish. Emit an\n\t\t\t// ordinal (\"1. \") / bullet (\"- \") prefix per item to preserve it.\n\t\t\tconst ordered = node.type === 'orderedList';\n\t\t\treturn (\n\t\t\t\t(node.content ?? [])\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(item, i) =>\n\t\t\t\t\t\t\t`${ordered ? `${i + 1}.` : '-'} ${nodeToText(\n\t\t\t\t\t\t\t\titem,\n\t\t\t\t\t\t\t\ttoolIds,\n\t\t\t\t\t\t\t).replace(/\\n+$/, '')}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join('\\n') + '\\n'\n\t\t\t);\n\t\t}\n\t\tdefault: {\n\t\t\tconst inner = (node.content ?? [])\n\t\t\t\t.map((child) => nodeToText(child, toolIds))\n\t\t\t\t.join('');\n\t\t\t// Block nodes terminate with a newline so paragraphs stay separated.\n\t\t\tconst BLOCK_NODES = ['paragraph', 'heading', 'listItem', 'blockquote'];\n\t\t\treturn BLOCK_NODES.includes(node.type) ? `${inner}\\n` : inner;\n\t\t}\n\t}\n};\n\n/**\n * Convert a BikEditor document (from `ref.getJSON()`) into the firebase\n * instructions string, replacing mention nodes with `{{subagent:<id>}}` /\n * `{{tool:<tool_id>}}` tokens.\n */\nexport const editorDocToInstructions = (\n\tdoc: Record<string, unknown> | null,\n\ttools: AgentTool[],\n): string => {\n\tif (!doc) {\n\t\treturn '';\n\t}\n\tconst toolIds = new Set(tools.map((t) => t.tool_id));\n\treturn nodeToText(doc as unknown as ProseMirrorNode, toolIds).replace(\n\t\t/\\n+$/,\n\t\t'',\n\t);\n};\n"],"names":["toolSourceLabel","source","fallback","TOOL_SOURCE_LABELS","appTypeLabel","applicationType","key","buildAgentMentionItems","tools","subAgents","appLabel","t","s","variableTokenName","actualValue","buildVariableMentionItems","variablesData","items","walk","entry","actual","configToolName","restApiToolName","restApiMentionItem","name","ToolSource","configToolMentionItem","buildCustomToolMentionItems","configTools","restApiTools","escapeHtml","raw","escapeAttr","mentionSpanHtml","id","label","kind","buildMentionHtml","buildTokenLookup","mentionItems","byToken","item","meta","REFERENCE_TOKEN","inlineToHtml","segment","out","lastIndex","match","instructionsToEditorHtml","text","para","resolveMent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/utils/mentionSerialization.ts"],"sourcesContent":["import type { ApplicationType } from '@bikdotai/bik-models/growth';\nimport { MentionItem } from '@src/editor';\nimport {\n\tAgentTool,\n\tConfigToolConfig,\n\tRestApiToolConfig,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport { TOOL_SOURCE_LABELS, ToolSource } from '../constants/tools';\n\n/**\n * Serialization helpers between the BikEditor document and the firebase\n * `instructions` string.\n *\n * Firebase stores `instructions` as PLAIN TEXT with inline reference tokens:\n * - `{{subagent:<agentId>}}` — hand-off to another agent\n * - `{{tool:<tool_id>}}` — an action the agent can call\n * - `{{<variableName>}}` — a template variable\n *\n * In the editor those references are inserted via the `@` mention menu (which we\n * populate with BOTH tools and sub-agents). Mention nodes keep their `id` in the\n * ProseMirror doc JSON (the rendered HTML drops it), so we serialize from the doc\n * JSON — not from HTML.\n */\n\nexport interface MentionKindMeta {\n\t/** Distinguishes a tool reference from a sub-agent reference. */\n\tkind: 'tool' | 'subagent';\n\t/** Plain item name (no prefix) shown in the picker dropdown rows. */\n\tplainLabel?: string;\n\t/** For tools: the source bucket (manifest / shopify / …) the picker groups by. */\n\tsource?: string;\n\t/** For tools: touches customer-private data → shows a shield in the picker. */\n\tauthRequired?: boolean;\n}\n\n// Source labels moved to constants/tools.ts; re-exported for existing importers.\nexport { TOOL_SOURCE_LABELS };\n\n/** Human label for a tool source; falls back to the host-app label, then the raw key. */\nexport const toolSourceLabel = (\n\tsource: string | undefined,\n\tfallback = 'Manifest',\n): string => {\n\tif (!source) {\n\t\treturn fallback;\n\t}\n\treturn TOOL_SOURCE_LABELS[source as ToolSource] ?? source;\n};\n\n/** Human label for the host application, used as the tool-chip prefix. */\nexport const appTypeLabel = (applicationType?: ApplicationType): string => {\n\tconst key = applicationType ? String(applicationType) : '';\n\tif (key === 'BIK') {\n\t\treturn 'BIK';\n\t}\n\tif (key === 'BSP') {\n\t\treturn 'BSP';\n\t}\n\treturn 'Manifest';\n};\n\n/**\n * Build the combined `@` mention list from the available tools + sub-agents.\n *\n * The `label` is the CHIP text shown once inserted — tools read\n * `\"<App> : <tool name>\"` (e.g. \"Manifest : Look up order\"), sub-agents read\n * `\"sub-agent: <name>\"`. `meta.plainLabel` is the un-prefixed name for the\n * picker rows, and `meta.kind` drives the `{{tool}}` / `{{subagent}}` colour.\n */\nexport const buildAgentMentionItems = (\n\ttools: AgentTool[],\n\tsubAgents: SubAgentRef[],\n\tappLabel = 'Manifest',\n): MentionItem[] => [\n\t...tools.map(\n\t\t(t): MentionItem => ({\n\t\t\tid: t.tool_id,\n\t\t\tlabel: `${toolSourceLabel(t.source, appLabel)} : ${t.display_name}`,\n\t\t\tmeta: {\n\t\t\t\tkind: 'tool',\n\t\t\t\tplainLabel: t.display_name,\n\t\t\t\tsource: t.source,\n\t\t\t\tauthRequired: t.auth_required,\n\t\t\t},\n\t\t}),\n\t),\n\t...subAgents.map(\n\t\t(s): MentionItem => ({\n\t\t\tid: s.id,\n\t\t\tlabel: `sub-agent: ${s.name}`,\n\t\t\tmeta: { kind: 'subagent', plainLabel: s.name },\n\t\t}),\n\t),\n];\n\n/** Display name for a shared config tool: first recipient / channel, else generic. */\nexport const configToolName = (t: ConfigToolConfig): string => {\n\tif (t.tool_key === 'send_slack_message') {\n\t\treturn (\n\t\t\tString(t.params['channelId']?.value ?? '').trim() || 'Send Slack message'\n\t\t);\n\t}\n\treturn (\n\t\tString(t.params['sendTo']?.value ?? '')\n\t\t\t.split(',')\n\t\t\t.map((s) => s.trim())\n\t\t\t.filter(Boolean)[0] || 'Send Email'\n\t);\n};\n\n/** Display name for a Rest API tool row / chip. */\nexport const restApiToolName = (t: RestApiToolConfig): string =>\n\tt.name || 'Rest API';\n\n/** The `@`-mention chip item for a Rest API tool (kind 'tool', restapi source). */\nexport const restApiMentionItem = (t: RestApiToolConfig): MentionItem => {\n\tconst name = restApiToolName(t);\n\treturn {\n\t\tid: t.id,\n\t\tlabel: `${TOOL_SOURCE_LABELS[ToolSource.RestApi]} : ${name}`,\n\t\tmeta: { kind: 'tool', plainLabel: name, source: ToolSource.RestApi },\n\t};\n};\n\n/** The `@`-mention chip item for a shared config tool (email / Slack). */\nexport const configToolMentionItem = (t: ConfigToolConfig): MentionItem => {\n\tconst source =\n\t\tt.tool_key === 'send_slack_message'\n\t\t\t? ToolSource.Slack\n\t\t\t: ToolSource.EmailHandover;\n\tconst name = configToolName(t);\n\treturn {\n\t\tid: t.id,\n\t\tlabel: `${TOOL_SOURCE_LABELS[source]} : ${name}`,\n\t\tmeta: { kind: 'tool', plainLabel: name, source },\n\t};\n};\n\n/**\n * Mention items for the inline-configured custom tools (Rest API + email / Slack)\n * so their `{{tool:<id>}}` tokens rehydrate as chips — they live on the agent\n * value, not in the catalog `availableTools`. Merge alongside\n * {@link buildAgentMentionItems} in the editor's mention list.\n */\nexport const buildCustomToolMentionItems = (\n\tconfigTools: ConfigToolConfig[] = [],\n\trestApiTools: RestApiToolConfig[] = [],\n): MentionItem[] => [\n\t...restApiTools.map(restApiMentionItem),\n\t...configTools.map(configToolMentionItem),\n];\n\nconst escapeHtml = (raw: string): string =>\n\traw.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n\nconst escapeAttr = (raw: string): string =>\n\tescapeHtml(raw).replace(/\"/g, '&quot;');\n\n/**\n * The HTML for a single mention chip. Must round-trip through the TipTap mention\n * extension's `parseHTML` (`span[data-type=\"mentionAgent\"]`, reading\n * `data-id`/`data-label`/`data-kind`) — see MentionExtension.ts. `normalizeHtml`\n * is taught to keep `data-type=\"mention…\"` spans so this survives to the parser.\n */\nconst mentionSpanHtml = (id: string, label: string, kind: string): string =>\n\t`<span data-type=\"mentionAgent\" class=\"bik-mention bik-mention--agent\"` +\n\t` data-id=\"${escapeAttr(id)}\" data-label=\"${escapeAttr(label)}\"` +\n\t` data-kind=\"${escapeAttr(kind)}\">${escapeHtml(label)}</span>`;\n\n/**\n * Public: HTML for one mention chip, for inserting at the cursor (e.g. when a\n * tool / sub-agent is added from the Step-3 side panel). Round-trips through the\n * same parser path as the rehydrated chips.\n */\nexport const buildMentionHtml = (\n\tid: string,\n\tlabel: string,\n\tkind: 'tool' | 'subagent',\n): string => mentionSpanHtml(id, label, kind);\n\n/** `{{tool:<id>}}` / `{{subagent:<id>}}` → the mention item that produced them. */\nconst buildTokenLookup = (\n\tmentionItems: MentionItem[],\n): Map<string, MentionItem> => {\n\tconst byToken = new Map<string, MentionItem>();\n\tfor (const item of mentionItems) {\n\t\tconst meta = item.meta as unknown as MentionKindMeta | undefined;\n\t\t// Both tools and sub-agents are keyed by their id (a tool's id is its tool_id).\n\t\tif (meta?.kind === 'tool') {\n\t\t\tbyToken.set(`tool:${String(item.id)}`, item);\n\t\t} else if (meta?.kind === 'subagent') {\n\t\t\tbyToken.set(`subagent:${String(item.id)}`, item);\n\t\t}\n\t}\n\treturn byToken;\n};\n\n// Matches the reference tokens we render as chips. Other `{{var}}` tokens fall\n// through untouched (left as literal text for the variable decoration).\nconst REFERENCE_TOKEN = /\\{\\{(tool:[^}]+|subagent:[^}]+)\\}\\}/g;\n\n/** Escape plain text, swapping recognised reference tokens for mention spans. */\nconst inlineToHtml = (\n\tsegment: string,\n\tbyToken: Map<string, MentionItem>,\n): string => {\n\tlet out = '';\n\tlet lastIndex = 0;\n\tREFERENCE_TOKEN.lastIndex = 0;\n\tlet match: RegExpExecArray | null;\n\twhile ((match = REFERENCE_TOKEN.exec(segment)) !== null) {\n\t\tout += escapeHtml(segment.slice(lastIndex, match.index));\n\t\tconst item = byToken.get(match[1]);\n\t\tif (item) {\n\t\t\tconst kind = (item.meta as unknown as MentionKindMeta).kind;\n\t\t\tout += mentionSpanHtml(String(item.id), item.label, kind);\n\t\t} else {\n\t\t\t// Tool/sub-agent no longer in the available list → keep the raw token.\n\t\t\tout += escapeHtml(match[0]);\n\t\t}\n\t\tlastIndex = REFERENCE_TOKEN.lastIndex;\n\t}\n\tout += escapeHtml(segment.slice(lastIndex));\n\treturn out.replace(/\\n/g, '<br>');\n};\n\n/**\n * Convert the stored instructions string into HTML for `BikEditor.initialContent`.\n * `{{tool:KEY}}` / `{{subagent:ID}}` tokens are rehydrated into mention chips\n * (resolved via `mentionItems`); any other `{{…}}` token is left as literal text\n * for the editor's variable decoration. Newlines become paragraph / line breaks.\n */\nexport const instructionsToEditorHtml = (\n\ttext: string,\n\tmentionItems: MentionItem[] = [],\n): string => {\n\tif (!text) {\n\t\treturn '';\n\t}\n\tconst byToken = buildTokenLookup(mentionItems);\n\treturn text\n\t\t.split(/\\n{2,}/)\n\t\t.map((para) => `<p>${inlineToHtml(para, byToken)}</p>`)\n\t\t.join('');\n};\n\ninterface ProseMirrorNode {\n\ttype: string;\n\ttext?: string;\n\tattrs?: Record<string, unknown>;\n\tcontent?: ProseMirrorNode[];\n}\n\n/**\n * The token for a mention node. Both tools and sub-agents store their id in the\n * node, so the token value is just that id — the kind only picks the prefix. The\n * node's `kind` attr is authoritative; `toolIds` is a fallback for older content\n * saved before the kind attr existed.\n */\nconst resolveMentionToken = (\n\tid: string,\n\tkind: string | null,\n\ttoolIds: Set<string>,\n): string => {\n\tconst resolved = kind ?? (toolIds.has(id) ? 'tool' : 'subagent');\n\treturn resolved === 'tool' ? `{{tool:${id}}}` : `{{subagent:${id}}}`;\n};\n\nconst nodeToText = (node: ProseMirrorNode, toolIds: Set<string>): string => {\n\tswitch (node.type) {\n\t\tcase 'text':\n\t\t\treturn node.text ?? '';\n\t\tcase 'mentionAgent':\n\t\tcase 'mentionTeam': {\n\t\t\tconst id = node.attrs?.['id'];\n\t\t\tif (id == null) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t\tconst kind = node.attrs?.['kind'];\n\t\t\treturn resolveMentionToken(\n\t\t\t\tString(id),\n\t\t\t\tkind == null ? null : String(kind),\n\t\t\t\ttoolIds,\n\t\t\t);\n\t\t}\n\t\tcase 'variable':\n\t\t\treturn `{{${String(node.attrs?.['variableName'] ?? '')}}}`;\n\t\tcase 'hardBreak':\n\t\t\treturn '\\n';\n\t\tcase 'orderedList':\n\t\tcase 'bulletList': {\n\t\t\t// Flattening to plain text otherwise drops the list markers, so a\n\t\t\t// numbered / bulleted list looks \"removed\" after publish. Emit an\n\t\t\t// ordinal (\"1. \") / bullet (\"- \") prefix per item to preserve it.\n\t\t\tconst ordered = node.type === 'orderedList';\n\t\t\treturn (\n\t\t\t\t(node.content ?? [])\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(item, i) =>\n\t\t\t\t\t\t\t`${ordered ? `${i + 1}.` : '-'} ${nodeToText(\n\t\t\t\t\t\t\t\titem,\n\t\t\t\t\t\t\t\ttoolIds,\n\t\t\t\t\t\t\t).replace(/\\n+$/, '')}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join('\\n') + '\\n'\n\t\t\t);\n\t\t}\n\t\tdefault: {\n\t\t\tconst inner = (node.content ?? [])\n\t\t\t\t.map((child) => nodeToText(child, toolIds))\n\t\t\t\t.join('');\n\t\t\t// Block nodes terminate with a newline so paragraphs stay separated.\n\t\t\tconst BLOCK_NODES = ['paragraph', 'heading', 'listItem', 'blockquote'];\n\t\t\treturn BLOCK_NODES.includes(node.type) ? `${inner}\\n` : inner;\n\t\t}\n\t}\n};\n\n/**\n * Convert a BikEditor document (from `ref.getJSON()`) into the firebase\n * instructions string, replacing mention nodes with `{{subagent:<id>}}` /\n * `{{tool:<tool_id>}}` tokens.\n */\nexport const editorDocToInstructions = (\n\tdoc: Record<string, unknown> | null,\n\ttools: AgentTool[],\n): string => {\n\tif (!doc) {\n\t\treturn '';\n\t}\n\tconst toolIds = new Set(tools.map((t) => t.tool_id));\n\treturn nodeToText(doc as unknown as ProseMirrorNode, toolIds).replace(\n\t\t/\\n+$/,\n\t\t'',\n\t);\n};\n"],"names":["toolSourceLabel","source","fallback","TOOL_SOURCE_LABELS","appTypeLabel","applicationType","key","buildAgentMentionItems","tools","subAgents","appLabel","t","s","configToolName","restApiToolName","restApiMentionItem","name","ToolSource","configToolMentionItem","buildCustomToolMentionItems","configTools","restApiTools","escapeHtml","raw","escapeAttr","mentionSpanHtml","id","label","kind","buildMentionHtml","buildTokenLookup","mentionItems","byToken","item","meta","REFERENCE_TOKEN","inlineToHtml","segment","out","lastIndex","match","instructionsToEditorHtml","text","para","resolveMentionToken","toolIds","nodeToText","node","ordered","i","inner","child","editorDocToInstructions","doc"],"mappings":"yHAwCaA,EAAkB,CAC9BC,EACAC,EAAW,aAEND,EAGEE,EAAAA,mBAAmBF,CAAoB,GAAKA,EAF3CC,EAMIE,EAAgBC,GAA8C,CAC1E,MAAMC,EAAMD,EAAkB,OAAOA,CAAe,EAAI,GACxD,OAAIC,IAAQ,MACJ,MAEJA,IAAQ,MACJ,MAED,UACR,EAUaC,EAAyB,CACrCC,EACAC,EACAC,EAAW,aACQ,CACnB,GAAGF,EAAM,IACPG,IAAoB,CACpB,GAAIA,EAAE,QACN,MAAO,GAAGX,EAAgBW,EAAE,OAAQD,CAAQ,CAAC,MAAMC,EAAE,YAAY,GACjE,KAAM,CACL,KAAM,OACN,WAAYA,EAAE,aACd,OAAQA,EAAE,OACV,aAAcA,EAAE,aAAA,CACjB,EACD,EAED,GAAGF,EAAU,IACXG,IAAoB,CACpB,GAAIA,EAAE,GACN,MAAO,cAAcA,EAAE,IAAI,GAC3B,KAAM,CAAE,KAAM,WAAY,WAAYA,EAAE,IAAA,CAAK,EAC9C,CAEF,EAGaC,EAAkBF,GAC1BA,EAAE,WAAa,qBAEjB,OAAOA,EAAE,OAAO,WAAc,OAAS,EAAE,EAAE,KAAA,GAAU,qBAItD,OAAOA,EAAE,OAAO,QAAW,OAAS,EAAE,EACpC,MAAM,GAAG,EACT,IAAKC,GAAMA,EAAE,KAAA,CAAM,EACnB,OAAO,OAAO,EAAE,CAAC,GAAK,aAKbE,EAAmBH,GAC/BA,EAAE,MAAQ,WAGEI,EAAsBJ,GAAsC,CACxE,MAAMK,EAAOF,EAAgBH,CAAC,EAC9B,MAAO,CACN,GAAIA,EAAE,GACN,MAAO,GAAGR,qBAAmBc,EAAA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AAO,KAAK,OAAOE,EAAK,OAAQ,cAAmB,EAAE,CAAC,KACvD,IAAK,YACJ,MAAO;AAAA,EACR,IAAK,cACL,IAAK,aAAc,CAIlB,MAAMC,EAAUD,EAAK,OAAS,cAC9B,OACEA,EAAK,SAAW,CAAA,GACf,IACA,CAACd,EAAMgB,IACN,GAAGD,EAAU,GAAGC,EAAI,CAAC,IAAM,GAAG,IAAIH,EACjCb,EACAY,CAAA,EACC,QAAQ,OAAQ,EAAE,CAAC,EAAA,EAEtB,KAAK;AAAA,CAAI,EAAI;AAAA,CAEjB,CACA,QAAS,CACR,MAAMK,GAASH,EAAK,SAAW,CAAA,GAC7B,IAAKI,GAAUL,EAAWK,EAAON,CAAO,CAAC,EACzC,KAAK,EAAE,EAGT,MADoB,CAAC,YAAa,UAAW,WAAY,YAAY,EAClD,SAASE,EAAK,IAAI,EAAI,GAAGG,CAAK;AAAA,EAAOA,CACzD,CAAA,CAEF,EAOaE,EAA0B,CACtCC,EACA7C,IACY,CACZ,GAAI,CAAC6C,EACJ,MAAO,GAER,MAAMR,EAAU,IAAI,IAAIrC,EAAM,IAAKG,GAAMA,EAAE,OAAO,CAAC,EACnD,OAAOmC,EAAWO,EAAmCR,CAAO,EAAE,QAC7D,OACA,EAAA,CAEF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),y=require("../../assets/icons/delete.svg.js"),j=require("../../assets/icons/edit.svg.js"),b=require("../../assets/icons/playOutline.svg.js"),m=require("../../assets/icons/vertical_dots.svg.js"),O=require("../dropdown/DropdownPopover/index.js"),l=require("../TypographyStyle.js"),n=require("../../constants/Theme.js"),i=require("./AgentListing.styled.js"),C=require("../tag/Tag.js"),f=require("../tooltips/Tooltip.js"),S=require("../dropdown/utils.js"),L=e=>{switch(e.kind){case"topic":return`Topic: ${(e.label??"").replace(/_/g," ")}`;case"phrases":return e.items?.length?`Phrases: ${e.items.join(", ")}`:"Phrases";default:return e.label??""}},R=({agent:e,onRunAgent:d,onEditAgent:u,onDeleteAgent:s,onRowClick:r})=>{const c=e.status==="live",h=o=>{o.stopPropagation(),!e.isRunDisabled&&d(e)},p=[{label:"Edit",value:"edit",leadingIcon:t.jsx(j.default,{width:16,height:16,color:n.COLORS.content.secondary})},...s?[{label:"Delete",value:"delete",customComponent:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:n.COLORS.content.negative,fontFamily:"Inter",fontSize:14},children:[t.jsx(y.default,{width:16,height:16,color:n.COLORS.content.negative}),"Delete"]})}]:[]],x=o=>{o==="edit"?u(e):o==="delete"&&s?.(e)},a=t.jsx(i.ActionButton,{"data-test":`agent-row-run-${e.id}`,disabled:e.isRunDisabled,onClick:h,"aria-label":"Run agent",children:t.jsx(b.default,{width:20,height:20,color:n.COLORS.content.secondary})});return t.jsxs(i.BodyGridRow,{"data-test":`agent-row-${e.id}`,clickable:!!r,onClick:r?()=>r(e):void 0,children:[t.jsxs(i.Cell,{children:[t.jsx(l.TitleSmall,{numberOfLines:1,color:n.COLORS.content.primary,children:e.name}),t.jsxs(l.BodyCaption,{numberOfLines:1,color:n.COLORS.content.secondary,children:["Created: ",e.createdAtLabel]})]}),t.jsx(i.Cell,{children:t.jsx(l.BodySecondary,{numberOfLines:2,color:n.COLORS.content.primary,children:L(e.trigger)})}),t.jsx(i.Cell,{align:"right",children:t.jsx(l.BodySecondary,{color:n.COLORS.content.primary,children:e.triggerCount})}),t.jsx(i.Cell,{children:t.jsx(C.Tag,{tagText:c?"Live":"Draft",type:c?"positive":"neutral",variant:"regular"})}),t.jsx(i.Cell,{align:"center",children:t.jsxs(i.ActionGroup,{children:[e.isRunDisabled&&e.runDisabledTooltip?t.jsx(f.Tooltip,{body:e.runDisabledTooltip,placement:"top",children:t.jsx("span",{style:{display:"flex"},children:a})}):a,t.jsx("span",{style:{display:"flex"},onClick:o=>o.stopPropagation(),children:t.jsx(O.DropdownPopover,{"data-test":`agent-row-menu-${e.id}`,options:p,placement:"bottom-end",width:"160px",onSelect:o=>x(S.unwrapDropdownValue(o)),children:t.jsx(i.ActionButton,{"data-test":`agent-row-menu-button-${e.id}`,"aria-label":"More actions",children:t.jsx(m.default,{width:20,height:20,color:n.COLORS.content.secondary})})})})]})})]})};exports.AgentTableRow=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),y=require("../../assets/icons/delete.svg.js"),j=require("../../assets/icons/edit.svg.js"),b=require("../../assets/icons/playOutline.svg.js"),m=require("../../assets/icons/vertical_dots.svg.js"),O=require("../dropdown/DropdownPopover/index.js"),l=require("../TypographyStyle.js"),n=require("../../constants/Theme.js"),o=require("./AgentListing.styled.js"),C=require("../tag/Tag.js"),f=require("../tooltips/Tooltip.js"),S=require("../dropdown/utils.js"),L=e=>{switch(e.kind){case"topic":return`Topic: ${(e.label??"").replace(/_/g," ").toLowerCase()}`;case"phrases":return e.items?.length?`Phrases: ${e.items.join(", ")}`:"Phrases";default:return e.label??""}},R=({agent:e,onRunAgent:d,onEditAgent:u,onDeleteAgent:s,onRowClick:r})=>{const c=e.status==="live",h=i=>{i.stopPropagation(),!e.isRunDisabled&&d(e)},p=[{label:"Edit",value:"edit",leadingIcon:t.jsx(j.default,{width:16,height:16,color:n.COLORS.content.secondary})},...s?[{label:"Delete",value:"delete",customComponent:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:n.COLORS.content.negative,fontFamily:"Inter",fontSize:14},children:[t.jsx(y.default,{width:16,height:16,color:n.COLORS.content.negative}),"Delete"]})}]:[]],x=i=>{i==="edit"?u(e):i==="delete"&&s?.(e)},a=t.jsx(o.ActionButton,{"data-test":`agent-row-run-${e.id}`,disabled:e.isRunDisabled,onClick:h,"aria-label":"Run agent",children:t.jsx(b.default,{width:20,height:20,color:n.COLORS.content.secondary})});return t.jsxs(o.BodyGridRow,{"data-test":`agent-row-${e.id}`,clickable:!!r,onClick:r?()=>r(e):void 0,children:[t.jsxs(o.Cell,{children:[t.jsx(l.TitleSmall,{numberOfLines:1,color:n.COLORS.content.primary,children:e.name}),t.jsxs(l.BodyCaption,{numberOfLines:1,color:n.COLORS.content.secondary,children:["Created: ",e.createdAtLabel]})]}),t.jsx(o.Cell,{children:t.jsx(l.BodySecondary,{numberOfLines:2,color:n.COLORS.content.primary,children:L(e.trigger)})}),t.jsx(o.Cell,{align:"right",children:t.jsx(l.BodySecondary,{color:n.COLORS.content.primary,children:e.triggerCount})}),t.jsx(o.Cell,{children:t.jsx(C.Tag,{tagText:c?"Live":"Draft",type:c?"positive":"neutral",variant:"regular"})}),t.jsx(o.Cell,{align:"center",children:t.jsxs(o.ActionGroup,{children:[e.isRunDisabled&&e.runDisabledTooltip?t.jsx(f.Tooltip,{body:e.runDisabledTooltip,placement:"top",children:t.jsx("span",{style:{display:"flex"},children:a})}):a,t.jsx("span",{style:{display:"flex"},onClick:i=>i.stopPropagation(),children:t.jsx(O.DropdownPopover,{"data-test":`agent-row-menu-${e.id}`,options:p,placement:"bottom-end",width:"160px",onSelect:i=>x(S.unwrapDropdownValue(i)),children:t.jsx(o.ActionButton,{"data-test":`agent-row-menu-button-${e.id}`,"aria-label":"More actions",children:t.jsx(m.default,{width:20,height:20,color:n.COLORS.content.secondary})})})})]})})]})};exports.AgentTableRow=R;
2
2
  //# sourceMappingURL=AgentTableRow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentTableRow.js","sources":["../../../../src/components/agent-listing/AgentTableRow.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport EditIcon from '@src/assets/icons/edit.svg';\nimport PlayOutlineIcon from '@src/assets/icons/playOutline.svg';\nimport MoreIcon from '@src/assets/icons/vertical_dots.svg';\nimport React from 'react';\nimport { unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownPopover } from '@src/components/dropdown/DropdownPopover';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Tag } from '@src/components/tag';\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 { AgentListItem, AgentTriggerSummary } from './AgentListing.model';\nimport {\n\tActionButton,\n\tActionGroup,\n\tBodyGridRow,\n\tCell,\n} from './AgentListing.styled';\n\nconst triggerToText = (trigger: AgentTriggerSummary): string => {\n\tswitch (trigger.kind) {\n\t\tcase 'topic':\n\t\t\t// Intent keys arrive snake_cased (e.g. \"order_cancellation\"); show them\n\t\t\t// space-separated so the trigger reads as words, not a raw key.\n\t\t\treturn `Topic: ${(trigger.label ?? '').replace(/_/g, ' ')}`;\n\t\tcase 'phrases':\n\t\t\t// No enumerable phrase list (free-text trigger) → just the word.\n\t\t\treturn trigger.items?.length\n\t\t\t\t? `Phrases: ${trigger.items.join(', ')}`\n\t\t\t\t: 'Phrases';\n\t\tcase 'custom':\n\t\tdefault:\n\t\t\treturn trigger.label ?? '';\n\t}\n};\n\ninterface AgentTableRowProps {\n\tagent: AgentListItem;\n\tonRunAgent: (agent: AgentListItem) => void;\n\tonEditAgent: (agent: AgentListItem) => void;\n\t/** When set, render a delete action (the listing handles confirmation). */\n\tonDeleteAgent?: (agent: AgentListItem) => void;\n\tonRowClick?: (agent: AgentListItem) => void;\n}\n\nexport const AgentTableRow: React.FC<AgentTableRowProps> = ({\n\tagent,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n}) => {\n\tconst isLive = agent.status === 'live';\n\n\tconst handleRun = (e: React.MouseEvent) => {\n\t\te.stopPropagation();\n\t\tif (agent.isRunDisabled) {\n\t\t\treturn;\n\t\t}\n\t\tonRunAgent(agent);\n\t};\n\n\t// Edit + Delete live in the \"⋮\" menu beside the run button.\n\tconst menuOptions: SingleOption[] = [\n\t\t{\n\t\t\tlabel: 'Edit',\n\t\t\tvalue: 'edit',\n\t\t\tleadingIcon: (\n\t\t\t\t<EditIcon width={16} height={16} color={COLORS.content.secondary} />\n\t\t\t),\n\t\t},\n\t\t...(onDeleteAgent\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: 'Delete',\n\t\t\t\t\t\tvalue: 'delete',\n\t\t\t\t\t\t// Rendered red (icon + label) via customComponent.\n\t\t\t\t\t\tcustomComponent: (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tgap: 8,\n\t\t\t\t\t\t\t\t\tcolor: COLORS.content.negative,\n\t\t\t\t\t\t\t\t\tfontFamily: 'Inter',\n\t\t\t\t\t\t\t\t\tfontSize: 14,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.negative}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\tDelete\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t];\n\n\tconst handleMenuSelect = (value: string | undefined) => {\n\t\tif (value === 'edit') {\n\t\t\tonEditAgent(agent);\n\t\t} else if (value === 'delete') {\n\t\t\tonDeleteAgent?.(agent);\n\t\t}\n\t};\n\n\tconst playButton = (\n\t\t<ActionButton\n\t\t\tdata-test={`agent-row-run-${agent.id}`}\n\t\t\tdisabled={agent.isRunDisabled}\n\t\t\tonClick={handleRun}\n\t\t\taria-label=\"Run agent\"\n\t\t>\n\t\t\t<PlayOutlineIcon\n\t\t\t\twidth={20}\n\t\t\t\theight={20}\n\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t/>\n\t\t</ActionButton>\n\t);\n\n\treturn (\n\t\t<BodyGridRow\n\t\t\tdata-test={`agent-row-${agent.id}`}\n\t\t\tclickable={!!onRowClick}\n\t\t\tonClick={onRowClick ? () => onRowClick(agent) : undefined}\n\t\t>\n\t\t\t<Cell>\n\t\t\t\t<TitleSmall numberOfLines={1} color={COLORS.content.primary}>\n\t\t\t\t\t{agent.name}\n\t\t\t\t</TitleSmall>\n\t\t\t\t<BodyCaption numberOfLines={1} color={COLORS.content.secondary}>\n\t\t\t\t\tCreated: {agent.createdAtLabel}\n\t\t\t\t</BodyCaption>\n\t\t\t</Cell>\n\n\t\t\t<Cell>\n\t\t\t\t<BodySecondary numberOfLines={2} color={COLORS.content.primary}>\n\t\t\t\t\t{triggerToText(agent.trigger)}\n\t\t\t\t</BodySecondary>\n\t\t\t</Cell>\n\n\t\t\t<Cell align=\"right\">\n\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t{agent.triggerCount}\n\t\t\t\t</BodySecondary>\n\t\t\t</Cell>\n\n\t\t\t<Cell>\n\t\t\t\t<Tag\n\t\t\t\t\ttagText={isLive ? 'Live' : 'Draft'}\n\t\t\t\t\ttype={isLive ? 'positive' : 'neutral'}\n\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t/>\n\t\t\t</Cell>\n\n\t\t\t<Cell align=\"center\">\n\t\t\t\t<ActionGroup>\n\t\t\t\t\t{agent.isRunDisabled && agent.runDisabledTooltip ? (\n\t\t\t\t\t\t<Tooltip body={agent.runDisabledTooltip} placement=\"top\">\n\t\t\t\t\t\t\t<span style={{ display: 'flex' }}>{playButton}</span>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplayButton\n\t\t\t\t\t)}\n\t\t\t\t\t{/* Stop the row's onClick from firing when interacting with the menu. */}\n\t\t\t\t\t<span\n\t\t\t\t\t\tstyle={{ display: 'flex' }}\n\t\t\t\t\t\tonClick={(e) => e.stopPropagation()}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\t\tdata-test={`agent-row-menu-${agent.id}`}\n\t\t\t\t\t\t\toptions={menuOptions}\n\t\t\t\t\t\t\tplacement=\"bottom-end\"\n\t\t\t\t\t\t\twidth=\"160px\"\n\t\t\t\t\t\t\tonSelect={(opt) => handleMenuSelect(unwrapDropdownValue(opt))}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ActionButton\n\t\t\t\t\t\t\t\tdata-test={`agent-row-menu-button-${agent.id}`}\n\t\t\t\t\t\t\t\taria-label=\"More actions\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MoreIcon\n\t\t\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ActionButton>\n\t\t\t\t\t\t</DropdownPopover>\n\t\t\t\t\t</span>\n\t\t\t\t</ActionGroup>\n\t\t\t</Cell>\n\t\t</BodyGridRow>\n\t);\n};\n"],"names":["triggerToText","trigger","AgentTableRow","agent","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","isLive","handleRun","e","menuOptions","jsx","EditIcon","COLORS","jsxs","DeleteIcon","handleMenuSelect","value","playButton","ActionButton","PlayOutlineIcon","BodyGridRow","Cell","TitleSmall","BodyCaption","BodySecondary","Tag","ActionGroup","Tooltip","DropdownPopover","opt","unwrapDropdownValue","MoreIcon"],"mappings":"yjBAwBMA,EAAiBC,GAAyC,CAC/D,OAAQA,EAAQ,KAAA,CACf,IAAK,QAGJ,MAAO,WAAWA,EAAQ,OAAS,IAAI,QAAQ,KAAM,GAAG,CAAC,GAC1D,IAAK,UAEJ,OAAOA,EAAQ,OAAO,OACnB,YAAYA,EAAQ,MAAM,KAAK,IAAI,CAAC,GACpC,UAEJ,QACC,OAAOA,EAAQ,OAAS,EAAA,CAE3B,EAWaC,EAA8C,CAAC,CAC3D,MAAAC,EACA,WAAAC,EACA,YAAAC,EACA,cAAAC,EACA,WAAAC,CACD,IAA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,EAAAA,OAAO,QAAQ,SAAA,CAAA,CACvB,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CAAA,CAAA,CAGH"}
1
+ {"version":3,"file":"AgentTableRow.js","sources":["../../../../src/components/agent-listing/AgentTableRow.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport EditIcon from '@src/assets/icons/edit.svg';\nimport PlayOutlineIcon from '@src/assets/icons/playOutline.svg';\nimport MoreIcon from '@src/assets/icons/vertical_dots.svg';\nimport React from 'react';\nimport { unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownPopover } from '@src/components/dropdown/DropdownPopover';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Tag } from '@src/components/tag';\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 { AgentListItem, AgentTriggerSummary } from './AgentListing.model';\nimport {\n\tActionButton,\n\tActionGroup,\n\tBodyGridRow,\n\tCell,\n} from './AgentListing.styled';\n\nconst triggerToText = (trigger: AgentTriggerSummary): string => {\n\tswitch (trigger.kind) {\n\t\tcase 'topic':\n\t\t\t// Intent keys arrive snake_cased (e.g. \"order_cancellation\"); show them\n\t\t\t// space-separated and lowercased so the trigger reads as plain words,\n\t\t\t// not a raw key.\n\t\t\treturn `Topic: ${(trigger.label ?? '').replace(/_/g, ' ').toLowerCase()}`;\n\t\tcase 'phrases':\n\t\t\t// No enumerable phrase list (free-text trigger) → just the word.\n\t\t\treturn trigger.items?.length\n\t\t\t\t? `Phrases: ${trigger.items.join(', ')}`\n\t\t\t\t: 'Phrases';\n\t\tcase 'custom':\n\t\tdefault:\n\t\t\treturn trigger.label ?? '';\n\t}\n};\n\ninterface AgentTableRowProps {\n\tagent: AgentListItem;\n\tonRunAgent: (agent: AgentListItem) => void;\n\tonEditAgent: (agent: AgentListItem) => void;\n\t/** When set, render a delete action (the listing handles confirmation). */\n\tonDeleteAgent?: (agent: AgentListItem) => void;\n\tonRowClick?: (agent: AgentListItem) => void;\n}\n\nexport const AgentTableRow: React.FC<AgentTableRowProps> = ({\n\tagent,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n}) => {\n\tconst isLive = agent.status === 'live';\n\n\tconst handleRun = (e: React.MouseEvent) => {\n\t\te.stopPropagation();\n\t\tif (agent.isRunDisabled) {\n\t\t\treturn;\n\t\t}\n\t\tonRunAgent(agent);\n\t};\n\n\t// Edit + Delete live in the \"⋮\" menu beside the run button.\n\tconst menuOptions: SingleOption[] = [\n\t\t{\n\t\t\tlabel: 'Edit',\n\t\t\tvalue: 'edit',\n\t\t\tleadingIcon: (\n\t\t\t\t<EditIcon width={16} height={16} color={COLORS.content.secondary} />\n\t\t\t),\n\t\t},\n\t\t...(onDeleteAgent\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: 'Delete',\n\t\t\t\t\t\tvalue: 'delete',\n\t\t\t\t\t\t// Rendered red (icon + label) via customComponent.\n\t\t\t\t\t\tcustomComponent: (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tgap: 8,\n\t\t\t\t\t\t\t\t\tcolor: COLORS.content.negative,\n\t\t\t\t\t\t\t\t\tfontFamily: 'Inter',\n\t\t\t\t\t\t\t\t\tfontSize: 14,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.negative}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\tDelete\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t];\n\n\tconst handleMenuSelect = (value: string | undefined) => {\n\t\tif (value === 'edit') {\n\t\t\tonEditAgent(agent);\n\t\t} else if (value === 'delete') {\n\t\t\tonDeleteAgent?.(agent);\n\t\t}\n\t};\n\n\tconst playButton = (\n\t\t<ActionButton\n\t\t\tdata-test={`agent-row-run-${agent.id}`}\n\t\t\tdisabled={agent.isRunDisabled}\n\t\t\tonClick={handleRun}\n\t\t\taria-label=\"Run agent\"\n\t\t>\n\t\t\t<PlayOutlineIcon\n\t\t\t\twidth={20}\n\t\t\t\theight={20}\n\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t/>\n\t\t</ActionButton>\n\t);\n\n\treturn (\n\t\t<BodyGridRow\n\t\t\tdata-test={`agent-row-${agent.id}`}\n\t\t\tclickable={!!onRowClick}\n\t\t\tonClick={onRowClick ? () => onRowClick(agent) : undefined}\n\t\t>\n\t\t\t<Cell>\n\t\t\t\t<TitleSmall numberOfLines={1} color={COLORS.content.primary}>\n\t\t\t\t\t{agent.name}\n\t\t\t\t</TitleSmall>\n\t\t\t\t<BodyCaption numberOfLines={1} color={COLORS.content.secondary}>\n\t\t\t\t\tCreated: {agent.createdAtLabel}\n\t\t\t\t</BodyCaption>\n\t\t\t</Cell>\n\n\t\t\t<Cell>\n\t\t\t\t<BodySecondary numberOfLines={2} color={COLORS.content.primary}>\n\t\t\t\t\t{triggerToText(agent.trigger)}\n\t\t\t\t</BodySecondary>\n\t\t\t</Cell>\n\n\t\t\t<Cell align=\"right\">\n\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t{agent.triggerCount}\n\t\t\t\t</BodySecondary>\n\t\t\t</Cell>\n\n\t\t\t<Cell>\n\t\t\t\t<Tag\n\t\t\t\t\ttagText={isLive ? 'Live' : 'Draft'}\n\t\t\t\t\ttype={isLive ? 'positive' : 'neutral'}\n\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t/>\n\t\t\t</Cell>\n\n\t\t\t<Cell align=\"center\">\n\t\t\t\t<ActionGroup>\n\t\t\t\t\t{agent.isRunDisabled && agent.runDisabledTooltip ? (\n\t\t\t\t\t\t<Tooltip body={agent.runDisabledTooltip} placement=\"top\">\n\t\t\t\t\t\t\t<span style={{ display: 'flex' }}>{playButton}</span>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplayButton\n\t\t\t\t\t)}\n\t\t\t\t\t{/* Stop the row's onClick from firing when interacting with the menu. */}\n\t\t\t\t\t<span\n\t\t\t\t\t\tstyle={{ display: 'flex' }}\n\t\t\t\t\t\tonClick={(e) => e.stopPropagation()}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\t\tdata-test={`agent-row-menu-${agent.id}`}\n\t\t\t\t\t\t\toptions={menuOptions}\n\t\t\t\t\t\t\tplacement=\"bottom-end\"\n\t\t\t\t\t\t\twidth=\"160px\"\n\t\t\t\t\t\t\tonSelect={(opt) => handleMenuSelect(unwrapDropdownValue(opt))}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ActionButton\n\t\t\t\t\t\t\t\tdata-test={`agent-row-menu-button-${agent.id}`}\n\t\t\t\t\t\t\t\taria-label=\"More actions\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MoreIcon\n\t\t\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ActionButton>\n\t\t\t\t\t\t</DropdownPopover>\n\t\t\t\t\t</span>\n\t\t\t\t</ActionGroup>\n\t\t\t</Cell>\n\t\t</BodyGridRow>\n\t);\n};\n"],"names":["triggerToText","trigger","AgentTableRow","agent","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","isLive","handleRun","e","menuOptions","jsx","EditIcon","COLORS","jsxs","DeleteIcon","handleMenuSelect","value","playButton","ActionButton","PlayOutlineIcon","BodyGridRow","Cell","TitleSmall","BodyCaption","BodySecondary","Tag","ActionGroup","Tooltip","DropdownPopover","opt","unwrapDropdownValue","MoreIcon"],"mappings":"yjBAwBMA,EAAiBC,GAAyC,CAC/D,OAAQA,EAAQ,KAAA,CACf,IAAK,QAIJ,MAAO,WAAWA,EAAQ,OAAS,IAAI,QAAQ,KAAM,GAAG,EAAE,YAAA,CAAa,GACxE,IAAK,UAEJ,OAAOA,EAAQ,OAAO,OACnB,YAAYA,EAAQ,MAAM,KAAK,IAAI,CAAC,GACpC,UAEJ,QACC,OAAOA,EAAQ,OAAS,EAAA,CAE3B,EAWaC,EAA8C,CAAC,CAC3D,MAAAC,EACA,WAAAC,EACA,YAAAC,EACA,cAAAC,EACA,WAAAC,CACD,IAAM,CACL,MAAMC,EAASL,EAAM,SAAW,OAE1BM,EAAaC,GAAwB,CAC1CA,EAAE,gBAAA,EACE,CAAAP,EAAM,eAGVC,EAAWD,CAAK,CACjB,EAGMQ,EAA8B,CACnC,CACC,MAAO,OACP,MAAO,OACP,YACCC,EAAAA,IAACC,UAAA,CAAS,MAAO,GAAI,OAAQ,GAAI,MAAOC,SAAO,QAAQ,SAAA,CAAW,CAAA,EAGpE,GAAIR,EACD,CACA,CACC,MAAO,SACP,MAAO,SAEP,gBACCS,EAAAA,KAAC,MAAA,CACA,MAAO,CACN,QAAS,OACT,WAAY,SACZ,IAAK,EACL,MAAOD,EAAAA,OAAO,QAAQ,SACtB,WAAY,QACZ,SAAU,EAAA,EAGX,SAAA,CAAAF,EAAAA,IAACI,EAAAA,QAAA,CACA,MAAO,GACP,OAAQ,GACR,MAAOF,EAAAA,OAAO,QAAQ,QAAA,CAAA,EACrB,QAAA,CAAA,CAAA,CAEH,CAEF,EAEA,CAAA,CAAC,EAGCG,EAAoBC,GAA8B,CACnDA,IAAU,OACbb,EAAYF,CAAK,EACPe,IAAU,UACpBZ,IAAgBH,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M,mBAAoB,UAAU,MAClD,SAAAS,EAAAA,IAAC,OAAA,CAAK,MAAO,CAAE,QAAS,QAAW,SAAAO,EAAW,EAC/C,EAEAA,EAGDP,EAAAA,IAAC,OAAA,CACA,MAAO,CAAE,QAAS,MAAA,EAClB,QAAUF,GAAMA,EAAE,gBAAA,EAElB,SAAAE,EAAAA,IAACkB,EAAAA,gBAAA,CACA,YAAW,kBAAkB3B,EAAM,EAAE,GACrC,QAASQ,EACT,UAAU,aACV,MAAM,QACN,SAAWoB,GAAQd,EAAiBe,EAAAA,oBAAoBD,CAAG,CAAC,EAE5D,SAAAnB,EAAAA,IAACQ,EAAAA,aAAA,CACA,YAAW,yBAAyBjB,EAAM,EAAE,GAC5C,aAAW,eAEX,SAAAS,EAAAA,IAACqB,EAAAA,QAAA,CACA,MAAO,GACP,OAAQ,GACR,MAAOnB,EAAAA,OAAO,QAAQ,SAAA,CAAA,CACvB,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CAAA,CAAA,CAGH"}
@@ -89,12 +89,6 @@
89
89
  border-radius: 4px;
90
90
  font-weight: 500;
91
91
  }
92
- .bik-mention[data-kind='variable'] {
93
- color: #067647;
94
- background: #ecfdf3;
95
- border-radius: 4px;
96
- font-weight: 500;
97
- }
98
92
  .bik-variable {
99
93
  }
100
94
 
@@ -1 +1 @@
1
- {"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { BASE_COLORS, COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n\ttightParagraphs?: boolean;\n\tjsonMode?: boolean;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '60px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\t/* Paragraph spacing.\n\t\t Email/signature (rich): paragraphs carry the browser-default 1em block\n\t\t margin — the SAME spacing the sent HTML gets (we emit plain <p>, which\n\t\t renders against the default <p> margin in Gmail and our email viewer),\n\t\t so editor view == emitted HTML == Gmail. A single Enter = a new\n\t\t paragraph with a visible gap, like pasted Gmail/ChatGPT/Docs content.\n\t\t Other channels (WhatsApp/IG/FB/comments) are plain-text messaging, with\n\t\t no paragraph-gap concept — paragraphs are tight (margin:0) regardless of\n\t\t typed vs pasted. (A margin:0 attr still overrides to tight either way.) */\n\t\tp {\n\t\t\tmargin: ${({ tightParagraphs }) => (tightParagraphs ? '0' : '1em 0')};\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\t/* The empty placeholder paragraph shouldn't inherit the rich-mode 1em\n\t\t block margin (email/SMTP/signature) — otherwise the placeholder text\n\t\t is pushed down. Real (non-empty) paragraphs keep their spacing. */\n\t\tp.is-editor-empty:first-child {\n\t\t\tmargin: 0;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\n\t\t/* hidden in-flow copy of the placeholder so a multi-line\n\t\t placeholder grows the editor instead of showing a scrollbar (the\n\t\t zero-height float above adds no height). -1lh cancels the caret line. */\n\t\tp.is-editor-empty:first-child::after {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tdisplay: block;\n\t\t\tvisibility: hidden;\n\t\t\tpointer-events: none;\n\t\t\tmargin-top: -1.5em; /* one line at the editor's line-height: 1.5 */\n\t\t\tmargin-top: -1lh;\n\t\t}\n\n\t\t/* Characters pasted beyond the soft character limit — rendered grey so the\n\t\t overflow is visible but clearly marked (see CharacterLimitExtension). */\n\t\t.bik-editor-overflow {\n\t\t\tcolor: ${COLORS.content.placeholder};\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t/* Typed mention chips (agent-builder): distinct colour per reference kind. */\n\t.bik-mention[data-kind='tool'] {\n\t\tcolor: #1570ef;\n\t\tbackground: #eff8ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-mention[data-kind='subagent'] {\n\t\tcolor: #6938ef;\n\t\tbackground: #f4f3ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-mention[data-kind='variable'] {\n\t\tcolor: #067647;\n\t\tbackground: #ecfdf3;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-variable {\n\t}\n\n\t/* JSON body mode — scoped so normal-mode code blocks keep their default look\n\t (no reserved gutter, no monospace override). The frame is split: the header\n\t bar owns the top rounded border, the code area (BikJsonBody) owns its own\n\t full border so it can recolour on focus / error without touching the\n\t header. */\n\t${({ jsonMode }) =>\n\t\tjsonMode &&\n\t\tcss`\n\t\t\t/* The code block IS the editor surface, sitting below the header bar.\n\t\t\t White fills the scroller down to the min-height (no blank strip below\n\t\t\t short JSON); the header owns the grey. */\n\t\t\t.ProseMirror {\n\t\t\t\tpadding: 0;\n\t\t\t\tbackground: ${COLORS.surface.standard};\n\t\t\t}\n\t\t\t/* ProseMirror appends an empty trailing paragraph AFTER the code block\n\t\t\t (a <p><br class=\"ProseMirror-trailingBreak\"></p> caret-escape node).\n\t\t\t In JSON mode there's nothing to escape to — it only renders as a blank\n\t\t\t line under the JSON, which is the \"extra space at the bottom\". Hide it. */\n\t\t\t.ProseMirror pre + p {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t\t.ProseMirror pre {\n\t\t\t\tposition: relative;\n\t\t\t\tmargin: 0;\n\t\t\t\tbackground: transparent;\n\t\t\t\t/* Left padding reserves the line-number gutter; each .bik-json-lineno\n\t\t\t\t widget hangs back into it with a matching negative margin. Wide\n\t\t\t\t enough for a 3-digit line number (up to 999). */\n\t\t\t\tpadding: 12px 12px 12px 4.2em;\n\t\t\t\tfont-family: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo,\n\t\t\t\t\tConsolas, 'Liberation Mono', monospace;\n\t\t\t\tfont-size: 13px;\n\t\t\t\tline-height: 1.6;\n\t\t\t\twhite-space: pre;\n\t\t\t\toverflow-x: auto;\n\t\t\t\ttab-size: 2;\n\t\t\t}\n\t\t\t.ProseMirror pre code {\n\t\t\t\tbackground: none;\n\t\t\t\tpadding: 0;\n\t\t\t\tfont-size: inherit;\n\t\t\t\tcolor: #1f2328;\n\t\t\t}\n\t\t\t/* Line-number gutter — a contenteditable=false sibling of <code> rendered\n\t\t\t by the code-block node view (JsonCodeBlockView), absolutely positioned\n\t\t\t into the reserved left padding. It scrolls with <pre> as one block, so\n\t\t\t numbers stay aligned with their lines. Stacked right borders form one\n\t\t\t continuous divider. */\n\t\t\t.bik-json-gutter {\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 0;\n\t\t\t\ttop: 12px; /* == the code block's padding-top */\n\t\t\t\twidth: 3.5em; /* within the 4.2em reserved left padding */\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\tuser-select: none;\n\t\t\t\t-webkit-user-select: none;\n\t\t\t\tpointer-events: none;\n\t\t\t}\n\t\t\t.bik-json-lineno {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\theight: 1.6em; /* == code line-height (13px × 1.6) so rows align */\n\t\t\t\tline-height: 1.6;\n\t\t\t\tpadding-right: 0.7em;\n\t\t\t\ttext-align: right;\n\t\t\t\t/* Never let a 3-digit number (e.g. 210) break across two lines. */\n\t\t\t\twhite-space: nowrap;\n\t\t\t\tcolor: ${COLORS.content.placeholder};\n\t\t\t\tborder-right: 1px solid ${COLORS.stroke.primary};\n\t\t\t}\n\t\t\t.bik-json-key {\n\t\t\t\tcolor: #0550ae;\n\t\t\t}\n\t\t\t.bik-json-string {\n\t\t\t\tcolor: #0a7d33;\n\t\t\t}\n\t\t\t.bik-json-number {\n\t\t\t\tcolor: #b5590a;\n\t\t\t}\n\t\t\t.bik-json-boolean,\n\t\t\t.bik-json-null {\n\t\t\t\tcolor: #8250df;\n\t\t\t\tfont-weight: 500;\n\t\t\t}\n\t\t\t.bik-json-punct {\n\t\t\t\tcolor: #57606a;\n\t\t\t}\n\t\t`}\n\n\ta,\n\t.bik-link {\n\t\tcolor: #4f46e5;\n\t\ttext-decoration: underline;\n\t\ttext-decoration-color: #a5b4fc;\n\t\ttext-underline-offset: 2px;\n\t\tcursor: pointer;\n\t\t&:hover {\n\t\t\tcolor: #3730a3;\n\t\t\ttext-decoration-color: #6366f1;\n\t\t}\n\t}\n`;\n\n/**\n * jsonMode header bar: a \"JSON\" label on the left and the Beautify / Copy actions\n * on the right. Owns the frame's top rounded border (no bottom edge — the code\n * area below draws its own top border, so the seam stays a single line even when\n * it recolours on focus/error). Grey fill sets it apart from the white code\n * surface below.\n */\nexport const BikJsonHeader = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n\tpadding: 8px 12px;\n\tbackground: ${COLORS.surface.subdued};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-bottom: none;\n\tborder-radius: 4px 4px 0 0;\n\n\t.bik-json-header-label {\n\t\tfont-family: inherit;\n\t\tfont-size: 14px;\n\t\tline-height: 20px;\n\t\tfont-weight: 400;\n\t\tcolor: ${COLORS.content.secondary};\n\t\tuser-select: none;\n\t}\n\n\t.bik-json-header-actions {\n\t\tdisplay: flex;\n\t\tgap: 8px;\n\t}\n\n\tbutton {\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t\tgap: 4px;\n\t\theight: 28px;\n\t\tpadding: 0 8px;\n\t\tfont-family: inherit;\n\t\tfont-size: 12px;\n\t\tline-height: 16px;\n\t\tcolor: ${COLORS.content.secondary};\n\t\tbackground: ${COLORS.surface.standard};\n\t\tborder: 1px solid ${COLORS.stroke.primary};\n\t\tborder-radius: 4px;\n\t\tcursor: pointer;\n\n\t\t&:hover:not(:disabled) {\n\t\t\tbackground: ${COLORS.surface.subdued};\n\t\t}\n\t\t&:disabled {\n\t\t\topacity: 0.5;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n`;\n\n/**\n * jsonMode code surface below the header. Owns the recolourable border: brand on\n * focus, negative when the JSON is invalid (error wins over focus).\n */\nexport const BikJsonBody = styled.div<{ $error?: boolean }>`\n\tposition: relative;\n\toverflow: hidden;\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid\n\t\t${({ $error }) =>\n\t\t\t$error ? COLORS.content.negative : COLORS.stroke.primary};\n\tborder-radius: 0 0 4px 4px;\n\n\t&:focus-within {\n\t\tborder-color: ${({ $error }) =>\n\t\t\t$error ? COLORS.content.negative : BASE_COLORS.brand['800']};\n\t}\n`;\n\n/**\n * jsonMode empty state: a centered code glyph + placeholder line over the code\n * area. Pointer-events off so clicks focus the editor.\n */\nexport const BikJsonEmptyState = styled.div`\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 8px;\n\tcolor: ${COLORS.content.placeholder};\n\tfont-size: 14px;\n\tline-height: 20px;\n\tpointer-events: none;\n\tuser-select: none;\n`;\n\n/**\n * JSON parse-error alert rendered by BikEditor in jsonMode: a standalone rounded\n * card below the code area.\n */\nexport const BikJsonError = styled.div`\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 8px;\n\tmargin-top: 8px;\n\tpadding: 12px;\n\tfont-size: 12px;\n\tline-height: 16px;\n\tcolor: ${COLORS.content.negative};\n\tbackground: ${COLORS.background.negative.light};\n\tborder: 1px solid ${COLORS.stroke.negative.lightAlt};\n\tborder-radius: 4px;\n\tword-break: break-word;\n\n\tsvg {\n\t\tflex-shrink: 0;\n\t}\n\n\tstrong {\n\t\tfont-weight: 600;\n\t}\n`;\n"],"names":["BikEditorShell","styled","minHeight","maxHeight","tightParagraphs","COLORS","jsonMode","css","BikJsonHeader","BikJsonBody","$error","BASE_COLORS","BikJsonEmptyState","BikJsonError"],"mappings":"uNAGaA,EAAiBC,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,gBAUrB,CAAC,CAAE,UAAAC,KAAgBA,GAAa,MAAM;AAAA,gBACtC,CAAC,CAAE,UAAAC,KAAgBA,GAAa,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAiBzC,CAAC,CAAE,gBAAAC,CAAA,IAAuBA,EAAkB,IAAM,OAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YA4C3DC,EAAAA,OAAO,QAAQ,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,WAK3BA,EAAAA,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA,WAIpBA,EAAAA,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GA6B5B,CAAC,CAAE,SAAAC,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O;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa1BI,EAAcR,EAAAA,QAAO;AAAA;AAAA;AAAA,eAGnBI,EAAAA,OAAO,QAAQ,QAAQ;AAAA;AAAA,IAElC,CAAC,CAAE,OAAAK,CAAA,IACJA,EAASL,EAAAA,OAAO,QAAQ,SAAWA,EAAAA,OAAO,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,kBAIzC,CAAC,CAAE,OAAAK,KAClBA,EAASL,EAAAA,OAAO,QAAQ,SAAWM,EAAAA,YAAY,MAAM,GAAK,CAAC;AAAA;AAAA,EAQjDC,EAAoBX,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAQ9BI,EAAAA,OAAO,QAAQ,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,EAWvBQ,EAAeZ,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAQzBI,EAAAA,OAAO,QAAQ,QAAQ;AAAA,eAClBA,SAAO,WAAW,SAAS,KAAK;AAAA,qBAC1BA,SAAO,OAAO,SAAS,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA"}
1
+ {"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { BASE_COLORS, COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n\ttightParagraphs?: boolean;\n\tjsonMode?: boolean;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '60px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\t/* Paragraph spacing.\n\t\t Email/signature (rich): paragraphs carry the browser-default 1em block\n\t\t margin — the SAME spacing the sent HTML gets (we emit plain <p>, which\n\t\t renders against the default <p> margin in Gmail and our email viewer),\n\t\t so editor view == emitted HTML == Gmail. A single Enter = a new\n\t\t paragraph with a visible gap, like pasted Gmail/ChatGPT/Docs content.\n\t\t Other channels (WhatsApp/IG/FB/comments) are plain-text messaging, with\n\t\t no paragraph-gap concept — paragraphs are tight (margin:0) regardless of\n\t\t typed vs pasted. (A margin:0 attr still overrides to tight either way.) */\n\t\tp {\n\t\t\tmargin: ${({ tightParagraphs }) => (tightParagraphs ? '0' : '1em 0')};\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\t/* The empty placeholder paragraph shouldn't inherit the rich-mode 1em\n\t\t block margin (email/SMTP/signature) — otherwise the placeholder text\n\t\t is pushed down. Real (non-empty) paragraphs keep their spacing. */\n\t\tp.is-editor-empty:first-child {\n\t\t\tmargin: 0;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\n\t\t/* hidden in-flow copy of the placeholder so a multi-line\n\t\t placeholder grows the editor instead of showing a scrollbar (the\n\t\t zero-height float above adds no height). -1lh cancels the caret line. */\n\t\tp.is-editor-empty:first-child::after {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tdisplay: block;\n\t\t\tvisibility: hidden;\n\t\t\tpointer-events: none;\n\t\t\tmargin-top: -1.5em; /* one line at the editor's line-height: 1.5 */\n\t\t\tmargin-top: -1lh;\n\t\t}\n\n\t\t/* Characters pasted beyond the soft character limit — rendered grey so the\n\t\t overflow is visible but clearly marked (see CharacterLimitExtension). */\n\t\t.bik-editor-overflow {\n\t\t\tcolor: ${COLORS.content.placeholder};\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t/* Typed mention chips (agent-builder): distinct colour per reference kind. */\n\t.bik-mention[data-kind='tool'] {\n\t\tcolor: #1570ef;\n\t\tbackground: #eff8ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-mention[data-kind='subagent'] {\n\t\tcolor: #6938ef;\n\t\tbackground: #f4f3ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-variable {\n\t}\n\n\t/* JSON body mode — scoped so normal-mode code blocks keep their default look\n\t (no reserved gutter, no monospace override). The frame is split: the header\n\t bar owns the top rounded border, the code area (BikJsonBody) owns its own\n\t full border so it can recolour on focus / error without touching the\n\t header. */\n\t${({ jsonMode }) =>\n\t\tjsonMode &&\n\t\tcss`\n\t\t\t/* The code block IS the editor surface, sitting below the header bar.\n\t\t\t White fills the scroller down to the min-height (no blank strip below\n\t\t\t short JSON); the header owns the grey. */\n\t\t\t.ProseMirror {\n\t\t\t\tpadding: 0;\n\t\t\t\tbackground: ${COLORS.surface.standard};\n\t\t\t}\n\t\t\t/* ProseMirror appends an empty trailing paragraph AFTER the code block\n\t\t\t (a <p><br class=\"ProseMirror-trailingBreak\"></p> caret-escape node).\n\t\t\t In JSON mode there's nothing to escape to — it only renders as a blank\n\t\t\t line under the JSON, which is the \"extra space at the bottom\". Hide it. */\n\t\t\t.ProseMirror pre + p {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t\t.ProseMirror pre {\n\t\t\t\tposition: relative;\n\t\t\t\tmargin: 0;\n\t\t\t\tbackground: transparent;\n\t\t\t\t/* Left padding reserves the line-number gutter; each .bik-json-lineno\n\t\t\t\t widget hangs back into it with a matching negative margin. Wide\n\t\t\t\t enough for a 3-digit line number (up to 999). */\n\t\t\t\tpadding: 12px 12px 12px 4.2em;\n\t\t\t\tfont-family: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo,\n\t\t\t\t\tConsolas, 'Liberation Mono', monospace;\n\t\t\t\tfont-size: 13px;\n\t\t\t\tline-height: 1.6;\n\t\t\t\twhite-space: pre;\n\t\t\t\toverflow-x: auto;\n\t\t\t\ttab-size: 2;\n\t\t\t}\n\t\t\t.ProseMirror pre code {\n\t\t\t\tbackground: none;\n\t\t\t\tpadding: 0;\n\t\t\t\tfont-size: inherit;\n\t\t\t\tcolor: #1f2328;\n\t\t\t}\n\t\t\t/* Line-number gutter — a contenteditable=false sibling of <code> rendered\n\t\t\t by the code-block node view (JsonCodeBlockView), absolutely positioned\n\t\t\t into the reserved left padding. It scrolls with <pre> as one block, so\n\t\t\t numbers stay aligned with their lines. Stacked right borders form one\n\t\t\t continuous divider. */\n\t\t\t.bik-json-gutter {\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 0;\n\t\t\t\ttop: 12px; /* == the code block's padding-top */\n\t\t\t\twidth: 3.5em; /* within the 4.2em reserved left padding */\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\tuser-select: none;\n\t\t\t\t-webkit-user-select: none;\n\t\t\t\tpointer-events: none;\n\t\t\t}\n\t\t\t.bik-json-lineno {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\theight: 1.6em; /* == code line-height (13px × 1.6) so rows align */\n\t\t\t\tline-height: 1.6;\n\t\t\t\tpadding-right: 0.7em;\n\t\t\t\ttext-align: right;\n\t\t\t\t/* Never let a 3-digit number (e.g. 210) break across two lines. */\n\t\t\t\twhite-space: nowrap;\n\t\t\t\tcolor: ${COLORS.content.placeholder};\n\t\t\t\tborder-right: 1px solid ${COLORS.stroke.primary};\n\t\t\t}\n\t\t\t.bik-json-key {\n\t\t\t\tcolor: #0550ae;\n\t\t\t}\n\t\t\t.bik-json-string {\n\t\t\t\tcolor: #0a7d33;\n\t\t\t}\n\t\t\t.bik-json-number {\n\t\t\t\tcolor: #b5590a;\n\t\t\t}\n\t\t\t.bik-json-boolean,\n\t\t\t.bik-json-null {\n\t\t\t\tcolor: #8250df;\n\t\t\t\tfont-weight: 500;\n\t\t\t}\n\t\t\t.bik-json-punct {\n\t\t\t\tcolor: #57606a;\n\t\t\t}\n\t\t`}\n\n\ta,\n\t.bik-link {\n\t\tcolor: #4f46e5;\n\t\ttext-decoration: underline;\n\t\ttext-decoration-color: #a5b4fc;\n\t\ttext-underline-offset: 2px;\n\t\tcursor: pointer;\n\t\t&:hover {\n\t\t\tcolor: #3730a3;\n\t\t\ttext-decoration-color: #6366f1;\n\t\t}\n\t}\n`;\n\n/**\n * jsonMode header bar: a \"JSON\" label on the left and the Beautify / Copy actions\n * on the right. Owns the frame's top rounded border (no bottom edge — the code\n * area below draws its own top border, so the seam stays a single line even when\n * it recolours on focus/error). Grey fill sets it apart from the white code\n * surface below.\n */\nexport const BikJsonHeader = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n\tpadding: 8px 12px;\n\tbackground: ${COLORS.surface.subdued};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-bottom: none;\n\tborder-radius: 4px 4px 0 0;\n\n\t.bik-json-header-label {\n\t\tfont-family: inherit;\n\t\tfont-size: 14px;\n\t\tline-height: 20px;\n\t\tfont-weight: 400;\n\t\tcolor: ${COLORS.content.secondary};\n\t\tuser-select: none;\n\t}\n\n\t.bik-json-header-actions {\n\t\tdisplay: flex;\n\t\tgap: 8px;\n\t}\n\n\tbutton {\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t\tgap: 4px;\n\t\theight: 28px;\n\t\tpadding: 0 8px;\n\t\tfont-family: inherit;\n\t\tfont-size: 12px;\n\t\tline-height: 16px;\n\t\tcolor: ${COLORS.content.secondary};\n\t\tbackground: ${COLORS.surface.standard};\n\t\tborder: 1px solid ${COLORS.stroke.primary};\n\t\tborder-radius: 4px;\n\t\tcursor: pointer;\n\n\t\t&:hover:not(:disabled) {\n\t\t\tbackground: ${COLORS.surface.subdued};\n\t\t}\n\t\t&:disabled {\n\t\t\topacity: 0.5;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n`;\n\n/**\n * jsonMode code surface below the header. Owns the recolourable border: brand on\n * focus, negative when the JSON is invalid (error wins over focus).\n */\nexport const BikJsonBody = styled.div<{ $error?: boolean }>`\n\tposition: relative;\n\toverflow: hidden;\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid\n\t\t${({ $error }) =>\n\t\t\t$error ? COLORS.content.negative : COLORS.stroke.primary};\n\tborder-radius: 0 0 4px 4px;\n\n\t&:focus-within {\n\t\tborder-color: ${({ $error }) =>\n\t\t\t$error ? COLORS.content.negative : BASE_COLORS.brand['800']};\n\t}\n`;\n\n/**\n * jsonMode empty state: a centered code glyph + placeholder line over the code\n * area. Pointer-events off so clicks focus the editor.\n */\nexport const BikJsonEmptyState = styled.div`\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 8px;\n\tcolor: ${COLORS.content.placeholder};\n\tfont-size: 14px;\n\tline-height: 20px;\n\tpointer-events: none;\n\tuser-select: none;\n`;\n\n/**\n * JSON parse-error alert rendered by BikEditor in jsonMode: a standalone rounded\n * card below the code area.\n */\nexport const BikJsonError = styled.div`\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 8px;\n\tmargin-top: 8px;\n\tpadding: 12px;\n\tfont-size: 12px;\n\tline-height: 16px;\n\tcolor: ${COLORS.content.negative};\n\tbackground: ${COLORS.background.negative.light};\n\tborder: 1px solid ${COLORS.stroke.negative.lightAlt};\n\tborder-radius: 4px;\n\tword-break: break-word;\n\n\tsvg {\n\t\tflex-shrink: 0;\n\t}\n\n\tstrong {\n\t\tfont-weight: 600;\n\t}\n`;\n"],"names":["BikEditorShell","styled","minH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AAA,OAAO,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,kBAIzC,CAAC,CAAE,OAAAK,KAClBA,EAASL,EAAAA,OAAO,QAAQ,SAAWM,EAAAA,YAAY,MAAM,GAAK,CAAC;AAAA;AAAA,EAQjDC,EAAoBX,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAQ9BI,EAAAA,OAAO,QAAQ,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,EAWvBQ,EAAeZ,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAQzBI,EAAAA,OAAO,QAAQ,QAAQ;AAAA,eAClBA,SAAO,WAAW,SAAS,KAAK;AAAA,qBAC1BA,SAAO,OAAO,SAAS,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("react/jsx-runtime"),r=({size:e=24,color:l="currentColor",...t})=>{const o={width:e,height:e,color:l,...t};return C.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:C.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2048 3.62015C10.0728 3.57063 9.92724 3.57063 9.79518 3.62015L5.12851 5.37015C4.90083 5.45553 4.75 5.67318 4.75 5.91634V9.99967C4.75 12.0101 6.08102 13.6165 7.28254 14.6678C7.89555 15.2042 8.50582 15.6235 8.96167 15.9084C9.1902 16.0512 9.38148 16.1613 9.51696 16.2363C9.58474 16.2738 9.63867 16.3026 9.67644 16.3224C9.69533 16.3323 9.71018 16.34 9.72073 16.3454L9.73327 16.3518L9.73704 16.3537L9.73877 16.3546C9.90299 16.4367 10.0966 16.4369 10.2609 16.3548L10 15.833C10.2609 16.3548 10.2609 16.3548 10.2609 16.3548L10.263 16.3537L10.2667 16.3518L10.2793 16.3454C10.2898 16.34 10.3047 16.3323 10.3236 16.3224C10.3613 16.3026 10.4153 16.2738 10.483 16.2363C10.6185 16.1613 10.8098 16.0512 11.0383 15.9084C11.4942 15.6235 12.1044 15.2042 12.7175 14.6678C13.919 13.6165 15.25 12.0101 15.25 9.99967V5.91634C15.25 5.67318 15.0992 5.45553 14.8715 5.37015L10.2048 3.62015ZM10 15.833L9.73877 16.3546C9.73877 16.3546 9.73913 16.3548 10 15.833ZM10.42 14.9191C10.2547 15.0224 10.1118 15.1063 10 15.1696C9.88821 15.1063 9.74526 15.0224 9.58 14.9191C9.16085 14.6571 8.60445 14.2743 8.05079 13.7898C6.91898 12.7995 5.91667 11.4893 5.91667 9.99967V6.32059L10 4.78934L14.0833 6.32059V9.99967C14.0833 11.4893 13.081 12.7995 11.9492 13.7898C11.3956 14.2743 10.8391 14.6571 10.42 14.9191Z",fill:"currentColor"})})};exports.default=r;
2
+ //# sourceMappingURL=ShieldOutline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShieldOutline.js","sources":["../../../../../src/icons/Informational/Common UI/ShieldOutline.tsx"],"sourcesContent":["import type { SVGProps } from 'react';\n\ninterface Props extends SVGProps<SVGSVGElement> {\n\tsize?: number | string;\n\tcolor?: string;\n}\nconst SvgShieldOutline = ({\n\tsize = 24,\n\tcolor = 'currentColor',\n\t...rest\n}: Props) => {\n\tconst props = {\n\t\twidth: size,\n\t\theight: size,\n\t\tcolor,\n\t\t...rest,\n\t};\n\treturn (\n\t\t<svg\n\t\t\tviewBox=\"0 0 20 20\"\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<path\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M10.2048 3.62015C10.0728 3.57063 9.92724 3.57063 9.79518 3.62015L5.12851 5.37015C4.90083 5.45553 4.75 5.67318 4.75 5.91634V9.99967C4.75 12.0101 6.08102 13.6165 7.28254 14.6678C7.89555 15.2042 8.50582 15.6235 8.96167 15.9084C9.1902 16.0512 9.38148 16.1613 9.51696 16.2363C9.58474 16.2738 9.63867 16.3026 9.67644 16.3224C9.69533 16.3323 9.71018 16.34 9.72073 16.3454L9.73327 16.3518L9.73704 16.3537L9.73877 16.3546C9.90299 16.4367 10.0966 16.4369 10.2609 16.3548L10 15.833C10.2609 16.3548 10.2609 16.3548 10.2609 16.3548L10.263 16.3537L10.2667 16.3518L10.2793 16.3454C10.2898 16.34 10.3047 16.3323 10.3236 16.3224C10.3613 16.3026 10.4153 16.2738 10.483 16.2363C10.6185 16.1613 10.8098 16.0512 11.0383 15.9084C11.4942 15.6235 12.1044 15.2042 12.7175 14.6678C13.919 13.6165 15.25 12.0101 15.25 9.99967V5.91634C15.25 5.67318 15.0992 5.45553 14.8715 5.37015L10.2048 3.62015ZM10 15.833L9.73877 16.3546C9.73877 16.3546 9.73913 16.3548 10 15.833ZM10.42 14.9191C10.2547 15.0224 10.1118 15.1063 10 15.1696C9.88821 15.1063 9.74526 15.0224 9.58 14.9191C9.16085 14.6571 8.60445 14.2743 8.05079 13.7898C6.91898 12.7995 5.91667 11.4893 5.91667 9.99967V6.32059L10 4.78934L14.0833 6.32059V9.99967C14.0833 11.4893 13.081 12.7995 11.9492 13.7898C11.3956 14.2743 10.8391 14.6571 10.42 14.9191Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t);\n};\nexport default SvgShieldOutline;\n"],"names":["SvgShieldOutline","size","color","rest","props","jsx"],"mappings":"iJAMMA,EAAmB,CAAC,CACzB,KAAAC,EAAO,GACP,MAAAC,EAAQ,eACR,GAAGC,CACJ,IAAa,CACZ,MAAMC,EAAQ,CACb,MAAOH,EACP,OAAQA,EACR,MAAAC,EACA,GAAGC,CAAA,EAEJ,OACCE,EAAAA,IAAC,MAAA,CACA,QAAQ,YACR,KAAK,OACL,MAAM,6BACL,GAAGD,EAEJ,SAAAC,EAAAA,IAAC,OAAA,CACA,SAAS,UACT,SAAS,UACT,EAAE,2vCACF,KAAK,cAAA,CAAA,CACN,CAAA,CAGH"}