@bikdotai/bik-component-library 0.0.871 → 0.0.872

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 (104) hide show
  1. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +5 -5
  2. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
  4. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/MentionPicker.js +27 -27
  6. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +6 -6
  8. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  10. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  12. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/utils/sourceGrouping.js +2 -0
  14. package/dist/cjs/components/agent-builder/utils/sourceGrouping.js.map +1 -0
  15. package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
  16. package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/utils/toolActions.js +1 -1
  18. package/dist/cjs/components/agent-builder/utils/toolActions.js.map +1 -1
  19. package/dist/cjs/icons/Social/Channels/Aftership.js +2 -0
  20. package/dist/cjs/icons/Social/Channels/Aftership.js.map +1 -0
  21. package/dist/cjs/icons/Social/Channels/Attentive.js +2 -0
  22. package/dist/cjs/icons/Social/Channels/Attentive.js.map +1 -0
  23. package/dist/cjs/icons/Social/Channels/Freshdesk.js +2 -0
  24. package/dist/cjs/icons/Social/Channels/Freshdesk.js.map +1 -0
  25. package/dist/cjs/icons/Social/Channels/GoogleSheets.js +2 -0
  26. package/dist/cjs/icons/Social/Channels/GoogleSheets.js.map +1 -0
  27. package/dist/cjs/icons/Social/Channels/Klavyio.js +2 -0
  28. package/dist/cjs/icons/Social/Channels/Klavyio.js.map +1 -0
  29. package/dist/cjs/icons/Social/Channels/Kustomer.js +2 -0
  30. package/dist/cjs/icons/Social/Channels/Kustomer.js.map +1 -0
  31. package/dist/cjs/icons/Social/Channels/Mailchimp.js +2 -0
  32. package/dist/cjs/icons/Social/Channels/Mailchimp.js.map +1 -0
  33. package/dist/cjs/icons/Social/Channels/OmniSend.js +2 -0
  34. package/dist/cjs/icons/Social/Channels/OmniSend.js.map +1 -0
  35. package/dist/cjs/icons/Social/Channels/Segment.js +2 -0
  36. package/dist/cjs/icons/Social/Channels/Segment.js.map +1 -0
  37. package/dist/cjs/icons/Social/Channels/ShipBob.js +2 -0
  38. package/dist/cjs/icons/Social/Channels/ShipBob.js.map +1 -0
  39. package/dist/cjs/icons/Social/Channels/Skio.js +1 -1
  40. package/dist/cjs/icons/Social/Channels/Skio.js.map +1 -1
  41. package/dist/cjs/icons/index.js +1 -1
  42. package/dist/esm/components/agent-builder/__fixtures__/integrationCatalog.d.ts +17 -0
  43. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +104 -96
  44. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  45. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +256 -242
  46. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  47. package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +0 -10
  48. package/dist/esm/components/agent-builder/components/MentionPicker.js +201 -199
  49. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  50. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +9 -0
  51. package/dist/esm/components/agent-builder/components/SelectableListSection.js +213 -188
  52. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  53. package/dist/esm/components/agent-builder/constants/tools.d.ts +46 -22
  54. package/dist/esm/components/agent-builder/constants/tools.js +86 -35
  55. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  56. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +289 -279
  57. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  58. package/dist/esm/components/agent-builder/utils/sourceGrouping.d.ts +39 -0
  59. package/dist/esm/components/agent-builder/utils/sourceGrouping.js +14 -0
  60. package/dist/esm/components/agent-builder/utils/sourceGrouping.js.map +1 -0
  61. package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +6 -4
  62. package/dist/esm/components/agent-builder/utils/sourceIcons.js +64 -33
  63. package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
  64. package/dist/esm/components/agent-builder/utils/toolActions.d.ts +11 -6
  65. package/dist/esm/components/agent-builder/utils/toolActions.js +23 -16
  66. package/dist/esm/components/agent-builder/utils/toolActions.js.map +1 -1
  67. package/dist/esm/icons/Social/Channels/Aftership.d.ts +6 -0
  68. package/dist/esm/icons/Social/Channels/Aftership.js +47 -0
  69. package/dist/esm/icons/Social/Channels/Aftership.js.map +1 -0
  70. package/dist/esm/icons/Social/Channels/Attentive.d.ts +6 -0
  71. package/dist/esm/icons/Social/Channels/Attentive.js +54 -0
  72. package/dist/esm/icons/Social/Channels/Attentive.js.map +1 -0
  73. package/dist/esm/icons/Social/Channels/Freshdesk.d.ts +6 -0
  74. package/dist/esm/icons/Social/Channels/Freshdesk.js +47 -0
  75. package/dist/esm/icons/Social/Channels/Freshdesk.js.map +1 -0
  76. package/dist/esm/icons/Social/Channels/GoogleSheets.d.ts +6 -0
  77. package/dist/esm/icons/Social/Channels/GoogleSheets.js +53 -0
  78. package/dist/esm/icons/Social/Channels/GoogleSheets.js.map +1 -0
  79. package/dist/esm/icons/Social/Channels/Klavyio.d.ts +6 -0
  80. package/dist/esm/icons/Social/Channels/Klavyio.js +47 -0
  81. package/dist/esm/icons/Social/Channels/Klavyio.js.map +1 -0
  82. package/dist/esm/icons/Social/Channels/Kustomer.d.ts +6 -0
  83. package/dist/esm/icons/Social/Channels/Kustomer.js +68 -0
  84. package/dist/esm/icons/Social/Channels/Kustomer.js.map +1 -0
  85. package/dist/esm/icons/Social/Channels/Mailchimp.d.ts +6 -0
  86. package/dist/esm/icons/Social/Channels/Mailchimp.js +31 -0
  87. package/dist/esm/icons/Social/Channels/Mailchimp.js.map +1 -0
  88. package/dist/esm/icons/Social/Channels/OmniSend.d.ts +6 -0
  89. package/dist/esm/icons/Social/Channels/OmniSend.js +47 -0
  90. package/dist/esm/icons/Social/Channels/OmniSend.js.map +1 -0
  91. package/dist/esm/icons/Social/Channels/Segment.d.ts +6 -0
  92. package/dist/esm/icons/Social/Channels/Segment.js +53 -0
  93. package/dist/esm/icons/Social/Channels/Segment.js.map +1 -0
  94. package/dist/esm/icons/Social/Channels/ShipBob.d.ts +6 -0
  95. package/dist/esm/icons/Social/Channels/ShipBob.js +28 -0
  96. package/dist/esm/icons/Social/Channels/ShipBob.js.map +1 -0
  97. package/dist/esm/icons/Social/Channels/Skio.js +41 -19
  98. package/dist/esm/icons/Social/Channels/Skio.js.map +1 -1
  99. package/dist/esm/icons/Social/Channels/Zendesk.d.ts +6 -0
  100. package/dist/esm/icons/Social/Channels/index.d.ts +10 -0
  101. package/dist/esm/icons/index.d.ts +26 -25
  102. package/dist/esm/icons/index.js +658 -638
  103. package/dist/esm/icons/index.js.map +1 -1
  104. 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 { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentTool,\n\tAuthentication,\n\tConfigToolConfig,\n\tConfigToolKey,\n\tRestApiToolConfig,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport {\n\tSectionBodyWrap,\n\tSideSection,\n\tSideSectionHeader,\n\tStep3Divider,\n\tStep3Grid,\n\tStep3Root,\n} from '../AgentBuilder.styled';\nimport { ConfigToolPanel } from '../components/ConfigToolPanel';\nimport { CreateSubAgentPanel } from '../components/CreateSubAgentPanel';\nimport { MentionField } from '../components/MentionField';\nimport { RequireVerificationModal } from '../components/RequireVerificationModal';\nimport { RestApiToolPanel } from '../components/RestApiToolPanel';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from '../components/SelectableListSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { CONFIG_TOOL_SOURCES, ToolSource } from '../constants/tools';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\tbuildCustomToolMentionItems,\n\tconfigToolMentionItem,\n\tconfigToolName,\n\trestApiMentionItem,\n\trestApiToolName,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tsourceIcon,\n} from '../utils/sourceIcons';\nimport { buildToolActions } from '../utils/toolActions';\n\n/** Source brand glyph for a tool, as a dropdown leadingIcon element. */\nconst toolIconEl = (source: string): JSX.Element | undefined =>\n\trenderSourceIcon(sourceIcon(source)) ?? undefined;\n\n/** Dropdown option for a tool: icon left of the name, no description. */\nconst toolOption = (t: AgentTool): SingleOption => ({\n\tlabel: t.display_name,\n\tvalue: t.tool_id,\n\tleadingIcon: toolIconEl(t.source ?? ToolSource.Manifest),\n});\n\nconst STEP = STEP_DEFINITIONS[2];\n\n/** Customer-verification OTP methods, in the dropdown's display order. */\nconst AUTH_METHOD_OPTIONS: SingleOption[] = [\n\t{ label: 'OTP to phone', value: 'phone_otp' },\n\t{ label: 'OTP to email', value: 'email_otp' },\n];\n\n/** Drawer state — null when closed; `key` remounts it fresh per open. */\ninterface SubAgentPanelState {\n\tkey: number;\n\ttitle: string;\n\teditingId?: string;\n\tinitial?: SubAgentDraft;\n}\n\n/**\n * Config-tool drawer state; `key` remounts fresh. `restapi` is the bespoke Rest\n * API panel; `config` is the shared dynamic panel (email / Slack), tagged with\n * its `toolKey`.\n */\ninterface ToolDrawerState {\n\tkey: number;\n\tkind: 'restapi' | 'config';\n\ttoolKey?: ConfigToolKey;\n\tinitialRest?: RestApiToolConfig;\n\tinitialConfig?: ConfigToolConfig;\n}\n\n/** Upsert an item by id (replace when present, append otherwise). */\nconst upsertById = <T extends { id: string }>(\n\tlist: T[] | undefined,\n\titem: T,\n): T[] => {\n\tconst arr = list ?? [];\n\treturn arr.some((x) => x.id === item.id)\n\t\t? arr.map((x) => (x.id === item.id ? item : x))\n\t\t: [...arr, item];\n};\n\nexport const Step3HowItResponds: React.FC = () => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\tupdateField,\n\t\taddReference,\n\t\tremoveReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableModels,\n\t\tconfigToolTemplates,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tinsertMention,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tregisterSubAgentCreator,\n\t\tregisterToolActionHandler,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t\tvariablesData,\n\t} = useAgentBuilderContext();\n\n\tconst [panel, setPanel] = useState<SubAgentPanelState | null>(null);\n\tconst panelKeyRef = useRef(0);\n\n\t// Rest API (bespoke) + shared config-tool drawers (separate from the sub-agent one).\n\tconst [toolDrawer, setToolDrawer] = useState<ToolDrawerState | null>(null);\n\tconst toolDrawerKeyRef = useRef(0);\n\tconst openRestApi = useCallback((initial?: RestApiToolConfig) => {\n\t\ttoolDrawerKeyRef.current += 1;\n\t\tsetToolDrawer({\n\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\tkind: 'restapi',\n\t\t\tinitialRest: initial,\n\t\t});\n\t}, []);\n\tconst openConfigTool = useCallback(\n\t\t(toolKey: ConfigToolKey, initial?: ConfigToolConfig) => {\n\t\t\ttoolDrawerKeyRef.current += 1;\n\t\t\tsetToolDrawer({\n\t\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\t\tkind: 'config',\n\t\t\t\ttoolKey,\n\t\t\t\tinitialConfig: initial,\n\t\t\t});\n\t\t},\n\t\t[],\n\t);\n\tconst handleSaveRestApi = useCallback(\n\t\t(config: RestApiToolConfig) => {\n\t\t\tconst isNew = !(value.restApiTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ restApiTools: upsertById(value.restApiTools, config) });\n\t\t\t// Drop a reference chip at the cursor on creation (edits keep the chip).\n\t\t\t// Pass the source so the fresh chip gets its icon (it isn't in the\n\t\t\t// editor's mention list yet).\n\t\t\tif (isNew) {\n\t\t\t\tinsertMention(\n\t\t\t\t\t'tool',\n\t\t\t\t\tconfig.id,\n\t\t\t\t\trestApiMentionItem(config).label,\n\t\t\t\t\tToolSource.RestApi,\n\t\t\t\t);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.restApiTools, insertMention],\n\t);\n\tconst handleSaveConfigTool = useCallback(\n\t\t(config: ConfigToolConfig) => {\n\t\t\tconst isNew = !(value.configTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ configTools: upsertById(value.configTools, config) });\n\t\t\tif (isNew) {\n\t\t\t\tconst source =\n\t\t\t\t\tconfig.tool_key === 'send_slack_message'\n\t\t\t\t\t\t? ToolSource.Slack\n\t\t\t\t\t\t: ToolSource.EmailHandover;\n\t\t\t\tinsertMention(\n\t\t\t\t\t'tool',\n\t\t\t\t\tconfig.id,\n\t\t\t\t\tconfigToolMentionItem(config).label,\n\t\t\t\t\tsource,\n\t\t\t\t);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.configTools, insertMention],\n\t);\n\n\t// Open a tool action's drawer by picker source (restapi / email / slack).\n\tconst openToolAction = useCallback(\n\t\t(source: ToolSource) => {\n\t\t\tconst toolKey = CONFIG_TOOL_SOURCES[source];\n\t\t\tif (toolKey) {\n\t\t\t\topenConfigTool(toolKey);\n\t\t\t} else {\n\t\t\t\topenRestApi();\n\t\t\t}\n\t\t},\n\t\t[openConfigTool, openRestApi],\n\t);\n\t// Let the `@` reference picker (Instructions / Guardrails) open these drawers.\n\tuseEffect(() => {\n\t\tregisterToolActionHandler(openToolAction);\n\t\treturn () => registerToolActionHandler(null);\n\t}, [registerToolActionHandler, openToolAction]);\n\t// Sub-agents created / edited in this session, so a chip resolves (and reflects\n\t// a renamed sub-agent) before the consumer refreshes `availableSubAgents`.\n\tconst [createdSubAgents, setCreatedSubAgents] = useState<SubAgentRef[]>([]);\n\t// Ids of sub-agents saved this session that use an auth_required tool — they\n\t// make customer verification mandatory on the parent, just like a direct\n\t// auth_required tool. (A persisted sub-agent's tools aren't hydrated into\n\t// `value`, so it only joins this set once opened/edited in the panel.)\n\tconst [authRequiringSubAgents, setAuthRequiringSubAgents] = useState<\n\t\tSet<string>\n\t>(() => new Set());\n\t// Created/edited refs take precedence over the consumer-supplied list.\n\tconst subAgentById = new Map<string, SubAgentRef>();\n\tavailableSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tcreatedSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tconst knownSubAgents = Array.from(subAgentById.values());\n\n\tconst openCreate = useCallback(() => {\n\t\tpanelKeyRef.current += 1;\n\t\tsetPanel({ key: panelKeyRef.current, title: 'Create sub-agent' });\n\t}, []);\n\n\t// Let the `@` picker's \"Create new\" row open this step's drawer.\n\tuseEffect(() => {\n\t\tif (!onCreateSubAgent) {\n\t\t\treturn;\n\t\t}\n\t\tregisterSubAgentCreator(openCreate);\n\t\treturn () => registerSubAgentCreator(null);\n\t}, [registerSubAgentCreator, openCreate, onCreateSubAgent]);\n\n\tconst openConfigure = useCallback(\n\t\tasync (id: string) => {\n\t\t\tif (!onFetchSubAgent) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst data = await onFetchSubAgent(id);\n\t\t\tpanelKeyRef.current += 1;\n\t\t\tsetPanel({\n\t\t\t\tkey: panelKeyRef.current,\n\t\t\t\ttitle: 'Edit sub-agent',\n\t\t\t\teditingId: id,\n\t\t\t\tinitial: data,\n\t\t\t});\n\t\t},\n\t\t[onFetchSubAgent],\n\t);\n\n\t// ── Customer verification (auth) ──────────────────────────────────────────\n\t// Order tools (auth_required) can't run unless the customer is verified first,\n\t// so verification is MANDATORY whenever such a tool is attached (directly or\n\t// via a sub-agent). Derived before the handlers that read it.\n\tconst hasDirectAuthTool = value.tools.some(\n\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t);\n\tconst hasAuthRequiredSubAgent = value.subagents.some((id) =>\n\t\tauthRequiringSubAgents.has(id),\n\t);\n\tconst hasAuthRequiredTool = hasDirectAuthTool || hasAuthRequiredSubAgent;\n\tconst authEnabled = value.authentication?.enabled ?? false;\n\tconst authType: Authentication['type'] =\n\t\tvalue.authentication?.type ?? 'email_otp';\n\t// BIK picks the OTP channel itself, so the merchant only gets the on/off\n\t// toggle there; Manifest still chooses the method.\n\tconst showAuthMethod = appTypeLabel(applicationType) !== 'BIK';\n\n\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\n\t\t\tlet savedId: string | undefined;\n\t\t\tif (panel?.editingId) {\n\t\t\t\tif (onUpdateSubAgent) {\n\t\t\t\t\tconst ref = await onUpdateSubAgent(panel.editingId, draft);\n\t\t\t\t\tsavedId = ref.id;\n\t\t\t\t\tsetCreatedSubAgents((prev) => [\n\t\t\t\t\t\t...prev.filter((s) => s.id !== ref.id),\n\t\t\t\t\t\tref,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else if (onCreateSubAgent) {\n\t\t\t\tconst ref = await onCreateSubAgent(draft);\n\t\t\t\tsavedId = ref.id;\n\t\t\t\tsetCreatedSubAgents((prev) => [...prev, ref]);\n\t\t\t\tpatch({ subagents: [...value.subagents, ref.id] });\n\t\t\t\tinsertMention('subagent', ref.id, `sub-agent: ${ref.name}`);\n\t\t\t}\n\t\t\t// A sub-agent that uses an auth_required tool forces customer\n\t\t\t// verification on the parent agent — the tool can't run otherwise. Record\n\t\t\t// it so verification stays mandatory (the reconcile effect turns it on and\n\t\t\t// the toggle locks), mirroring the direct-tool invariant.\n\t\t\tif (savedId) {\n\t\t\t\tconst targetId = savedId;\n\t\t\t\tconst subUsesAuthTool = draft.tools.some(\n\t\t\t\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t\t\t\t);\n\t\t\t\tsetAuthRequiringSubAgents((prev) => {\n\t\t\t\t\tconst next = new Set(prev);\n\t\t\t\t\tif (subUsesAuthTool) {\n\t\t\t\t\t\tnext.add(targetId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnext.delete(targetId);\n\t\t\t\t\t}\n\t\t\t\t\treturn next;\n\t\t\t\t});\n\t\t\t}\n\t\t\tsetPanel(null);\n\t\t},\n\t\t[\n\t\t\tpanel,\n\t\t\tonUpdateSubAgent,\n\t\t\tonCreateSubAgent,\n\t\t\tpatch,\n\t\t\tvalue.subagents,\n\t\t\tinsertMention,\n\t\t\tavailableTools,\n\t\t],\n\t);\n\n\t// Reconcile the invariant: a loaded agent that already holds an auth_required\n\t// tool must have verification on (a fail-closed tool otherwise runs silently).\n\tuseEffect(() => {\n\t\tif (hasAuthRequiredTool && !authEnabled) {\n\t\t\tpatch({ authentication: { enabled: true, type: authType } });\n\t\t}\n\t}, [hasAuthRequiredTool, authEnabled, authType, patch]);\n\n\t// A tool add awaiting the mandatory-verification confirm (null = no prompt).\n\tconst [pendingAuthTool, setPendingAuthTool] = useState<string | null>(null);\n\tconst addTool = useCallback(\n\t\t(id: string) => {\n\t\t\t// Always drop a chip at the cursor; addReference dedupes and reads the\n\t\t\t// latest value.\n\t\t\tinsertMention('tool', id);\n\t\t\taddReference('tool', id);\n\t\t},\n\t\t[insertMention, addReference],\n\t);\n\t// Adding an auth_required tool while verification is off prompts first; confirm\n\t// turns verification on and adds, cancel skips the add.\n\tconst handleAddTool = useCallback(\n\t\t(id: string) => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\tif (tool?.auth_required && !authEnabled) {\n\t\t\t\tsetPendingAuthTool(id);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\taddTool(id);\n\t\t},\n\t\t[availableTools, authEnabled, addTool],\n\t);\n\n\tconst toolItems: SelectableItem[] = value.tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: sourceIcon(tool.source ?? ToolSource.Manifest),\n\t\t\t\t\t\tauthRequired: tool.auth_required,\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// Inline-configured tools (Rest API + the shared email / Slack tools) live on\n\t// the value, not in `tools`. They render as rows in the same Tools list, each\n\t// with its own Configure (edit) action that reopens its drawer.\n\tconst restApiItems: SelectableItem[] = (value.restApiTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: restApiToolName(t),\n\t\t\ticon: SOURCE_ICONS[ToolSource.RestApi],\n\t\t\tonConfigure: () => openRestApi(t),\n\t\t}),\n\t);\n\tconst configToolItems: SelectableItem[] = (value.configTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: configToolName(t),\n\t\t\ticon: SOURCE_ICONS[\n\t\t\t\tt.tool_key === 'send_slack_message'\n\t\t\t\t\t? ToolSource.Slack\n\t\t\t\t\t: ToolSource.EmailHandover\n\t\t\t],\n\t\t\tonConfigure: () => openConfigTool(t.tool_key, t),\n\t\t}),\n\t);\n\tconst allToolItems: SelectableItem[] = [\n\t\t...toolItems,\n\t\t...restApiItems,\n\t\t...configToolItems,\n\t];\n\n\t// Built-in tools that open a config drawer instead of inserting a mention.\n\t// Shown as empty-state buttons AND in the `@` picker's Tools view. The shared\n\t// email / Slack forms are backend-driven, so each is offered only when its\n\t// template was provided.\n\tconst toolActionSources = buildToolActions(\n\t\tconfigToolTemplates,\n\t\topenToolAction,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t);\n\n\t// All tools are offered (even already-added ones) so a tool can be referenced\n\t// again in the text; the chip list below still shows each only once.\n\tconst toolOptions: SingleOption[] = availableTools.map(toolOption);\n\n\t// The native tool group is named after the host product — \"Manifest\" in\n\t// Manifest, \"BIK\" in BIK — so every surface that renders a source name needs it.\n\tconst appLabel = appTypeLabel(applicationType);\n\n\t// Group tools by source (Manifest / Shopify / …) for the empty-state buttons.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? ToolSource.Manifest;\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push(toolOption(t));\n\t\t});\n\t\treturn order.map((src) => ({\n\t\t\tsource: src,\n\t\t\tlabel: toolSourceLabel(src, appLabel),\n\t\t\toptions: bySource.get(src) ?? [],\n\t\t\t// Not connected → the source button opens the connect flow instead of\n\t\t\t// its tool list (see SelectableListSection / onConnectIntegration).\n\t\t\tconnected: integrationStatus?.[src as ToolSource],\n\t\t\tonConnect: () => onConnectIntegration?.(src as ToolSource),\n\t\t}));\n\t})();\n\n\tconst subAgentItems: SelectableItem[] = value.subagents\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst sub = subAgentById.get(id);\n\t\t\treturn sub ? { id, label: sub.name } : null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\tconst subAgentOptions: SingleOption[] = knownSubAgents.map((s) => ({\n\t\tlabel: s.name,\n\t\tvalue: s.id,\n\t}));\n\n\t// Per-section `@`-picker items so the header \"+\" opens the same reference\n\t// picker as the Instructions editor, drilled straight into this section's\n\t// category (tools OR sub-agents).\n\tconst toolMentionItems = [\n\t\t...buildAgentMentionItems(availableTools, [], appLabel),\n\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t];\n\tconst subAgentMentionItems = buildAgentMentionItems(\n\t\t[],\n\t\tknownSubAgents,\n\t\tappLabel,\n\t);\n\n\tconst modelOptions: SingleOption[] = availableModels.map((m) => ({\n\t\tlabel: m.label,\n\t\tvalue: m.value,\n\t\tselected: m.value === value.model,\n\t}));\n\tconst selectedModel = availableModels.find((m) => m.value === value.model);\n\n\t// The template for the open shared-drawer tool (undefined unless a config\n\t// drawer is open and its template was provided).\n\tconst openConfigTemplate =\n\t\ttoolDrawer?.kind === 'config' && toolDrawer.toolKey\n\t\t\t? configToolTemplates?.[toolDrawer.toolKey]\n\t\t\t: undefined;\n\n\tconst verificationToggle = (\n\t\t<Switch\n\t\t\tdata-test=\"agent-auth-toggle\"\n\t\t\tvalue={authEnabled || hasAuthRequiredTool}\n\t\t\t// Mandatory (can't turn off) while an auth_required tool is attached.\n\t\t\tdisabled={hasAuthRequiredTool}\n\t\t\tonValueChange={async (enabled) => {\n\t\t\t\tpatch({ authentication: { enabled, type: authType } });\n\t\t\t}}\n\t\t/>\n\t);\n\t// While locked, a tooltip explains why the toggle can't be changed.\n\tconst verificationToggleNode = hasAuthRequiredTool ? (\n\t\t<Tooltip\n\t\t\tbody=\"Remove tools that requires customer verification to change this setting.\"\n\t\t\tplacement=\"bottom\"\n\t\t>\n\t\t\t<span style={{ display: 'flex' }}>{verificationToggle}</span>\n\t\t</Tooltip>\n\t) : (\n\t\tverificationToggle\n\t);\n\n\treturn (\n\t\t<Step3Root>\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<Step3Grid $grow>\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"instructions\"\n\t\t\t\t\t\tdata-test=\"agent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder=\"Write the steps in plain English. The agent will follow them exactly. The more specific you are, the better it performs.\"\n\t\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"guardrail\"\n\t\t\t\t\t\tdata-test=\"agent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tmaxLength={charLimits.guardrail}\n\t\t\t\t\t\tplaceholder=\"e.g. Never discuss competitor pricing. Always stay within the cancellation policy. Do not process refunds above ₹10,000 without human approval.\"\n\t\t\t\t\t\tminHeight=\"140px\"\n\t\t\t\t\t/>\n\t\t\t\t</SectionBodyWrap>\n\n\t\t\t\t<Step3Divider />\n\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools\"\n\t\t\t\t\t\thelper=\"Actions this agent can take while responding.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-tools\"\n\t\t\t\t\t\titems={allToolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\tmentionItems={toolMentionItems}\n\t\t\t\t\t\tactionSources={toolActionSources}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tappLabel={appLabel}\n\t\t\t\t\t\tonAdd={handleAddTool}\n\t\t\t\t\t\t// Strips the tool's tokens AND drops it from whichever list holds it\n\t\t\t\t\t\t// (catalog `tools` or an inline custom-tool list).\n\t\t\t\t\t\tonRemove={(id) => removeReference('tool', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'tool' }}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Sub-agents\"\n\t\t\t\t\t\thelper=\"Other agents this agent can hand off the conversation to.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-subagents\"\n\t\t\t\t\t\titems={subAgentItems}\n\t\t\t\t\t\taddableOptions={subAgentOptions}\n\t\t\t\t\t\tmentionItems={subAgentMentionItems}\n\t\t\t\t\t\temptyText=\"No sub-agents added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertMention('subagent', id);\n\t\t\t\t\t\t\taddReference('subagent', id);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('subagent', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'sub-agent' }}\n\t\t\t\t\t\tonConfigure={onFetchSubAgent ? openConfigure : undefined}\n\t\t\t\t\t\tcreateOption={\n\t\t\t\t\t\t\tonCreateSubAgent\n\t\t\t\t\t\t\t\t? { label: 'Create new', onSelect: openCreate }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t<SideSectionHeader>\n\t\t\t\t\t\t\t<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n\t\t\t\t\t\t\t\t<Shield size={20} />\n\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tRequire customer verification\n\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{verificationToggleNode}\n\t\t\t\t\t\t</SideSectionHeader>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t{hasAuthRequiredTool\n\t\t\t\t\t\t\t\t? 'Required — this agent uses a tool that accesses customer order details.'\n\t\t\t\t\t\t\t\t: 'Customers must verify their identity before this agent responds.'}\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t{showAuthMethod && (authEnabled || hasAuthRequiredTool) && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tSelect verification method\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-auth-method\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t\t// Popover is portalled, so \"100%\" collapses to content width —\n\t\t\t\t\t\t\t\t\t// match the input: 360px side column − 2×16px padding.\n\t\t\t\t\t\t\t\t\tdropdownWidth=\"328px\"\n\t\t\t\t\t\t\t\t\tplaceHolder=\"Select verification method\"\n\t\t\t\t\t\t\t\t\t// Flag the active method so the open list highlights that row\n\t\t\t\t\t\t\t\t\t// green (list-item 'selected' theme handles the styling).\n\t\t\t\t\t\t\t\t\toptions={AUTH_METHOD_OPTIONS.map((o) => ({\n\t\t\t\t\t\t\t\t\t\t...o,\n\t\t\t\t\t\t\t\t\t\tselected: o.value === authType,\n\t\t\t\t\t\t\t\t\t}))}\n\t\t\t\t\t\t\t\t\tdefaultOptions={[\n\t\t\t\t\t\t\t\t\t\tAUTH_METHOD_OPTIONS.find((o) => o.value === authType) ??\n\t\t\t\t\t\t\t\t\t\t\tAUTH_METHOD_OPTIONS[0],\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\t\tpatch({\n\t\t\t\t\t\t\t\t\t\t\t\tauthentication: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: v as Authentication['type'],\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</SideSection>\n\n\t\t\t\t\t{availableModels.length > 0 && (\n\t\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tAdvanced settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tSelect AI model\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"agent-model\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t// Popover is portalled, so \"100%\" collapses to content width —\n\t\t\t\t\t\t\t\t// match the input: 360px side column − 2×16px SectionBodyWrap\n\t\t\t\t\t\t\t\t// padding.\n\t\t\t\t\t\t\t\tdropdownWidth=\"328px\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select model\"\n\t\t\t\t\t\t\t\toptions={modelOptions}\n\t\t\t\t\t\t\t\tdefaultOptions={\n\t\t\t\t\t\t\t\t\tselectedModel\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: selectedModel.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: selectedModel.value,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\tupdateField('model', v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SideSection>\n\t\t\t\t\t)}\n\t\t\t\t</SectionBodyWrap>\n\t\t\t</Step3Grid>\n\n\t\t\t{panel && (\n\t\t\t\t<CreateSubAgentPanel\n\t\t\t\t\tkey={panel.key}\n\t\t\t\t\ttitle={panel.title}\n\t\t\t\t\tinitial={panel.initial}\n\t\t\t\t\t// Block reusing another sub-agent's name (exclude the one being edited).\n\t\t\t\t\texistingNames={value.subagents\n\t\t\t\t\t\t.filter((id) => id !== panel.editingId)\n\t\t\t\t\t\t.map((id) => subAgentById.get(id)?.name)\n\t\t\t\t\t\t.filter((n): n is string => !!n)}\n\t\t\t\t\tavailableTools={availableTools}\n\t\t\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\t\t\tappLabel={appLabel}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tonImprove={onImproveSubAgent}\n\t\t\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setPanel(null)}\n\t\t\t\t\tonSave={handlePanelSave}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'restapi' && (\n\t\t\t\t<RestApiToolPanel\n\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\tinitial={toolDrawer.initialRest}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t// Block reusing another tool's name (exclude the one being edited).\n\t\t\t\t\texistingNames={(value.restApiTools ?? [])\n\t\t\t\t\t\t.filter((t) => t.id !== toolDrawer.initialRest?.id)\n\t\t\t\t\t\t.map((t) => t.name)}\n\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\tonSave={handleSaveRestApi}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'config' &&\n\t\t\t\ttoolDrawer.toolKey &&\n\t\t\t\topenConfigTemplate && (\n\t\t\t\t\t<ConfigToolPanel\n\t\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\t\ttoolKey={toolDrawer.toolKey}\n\t\t\t\t\t\ttemplate={openConfigTemplate}\n\t\t\t\t\t\tinitial={toolDrawer.initialConfig}\n\t\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\t\tonSave={handleSaveConfigTool}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t<RequireVerificationModal\n\t\t\t\topen={pendingAuthTool !== null}\n\t\t\t\ttoolLabel={\n\t\t\t\t\tavailableTools.find((t) => t.tool_id === pendingAuthTool)\n\t\t\t\t\t\t?.display_name ?? 'This tool'\n\t\t\t\t}\n\t\t\t\tonCancel={() => setPendingAuthTool(null)}\n\t\t\t\tonConfirm={() => {\n\t\t\t\t\tpatch({ authentication: { enabled: true, type: authType } });\n\t\t\t\t\tif (pendingAuthTool) {\n\t\t\t\t\t\taddTool(pendingAuthTool);\n\t\t\t\t\t}\n\t\t\t\t\tsetPendingAuthTool(null);\n\t\t\t\t}}\n\t\t\t/>\n\t\t</Step3Root>\n\t);\n};\n"],"names":["toolIconEl","source","renderSourceIcon","sourceIcon","toolOption","t","ToolSource","STEP","STEP_DEFINITIONS","AUTH_METHOD_OPTIONS","upsertById","list","item","arr","x","Step3HowItResponds","value","patch","updateField","addReference","removeReference","availableTools","availableSubAgents","availableModels","configToolTemplates","applicationType","charLimits","insertMention","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","registerSubAgentCreator","registerToolActionHandler","integrationStatus","onConnectIntegration","variablesData","useAgentBuilderContext","panel","setPanel","useState","panelKeyRef","useRef","toolDrawer","setToolDrawer","toolDrawerKeyRef","openRestApi","useCallback","initial","openConfigTool","toolKey","handleSaveRestApi","config","isNew","restApiMentionItem","handleSaveConfigTool","configToolMentionItem","openToolAction","CONFIG_TOOL_SOURCES","useEffect","createdSubAgents","setCreatedSubAgents","authRequiringSubAgents","setAuthRequiringSubAgents","subAgentById","s","knownSubAgents","openCreate","openConfigure","id","data","hasDirectAuthTool","hasAuthRequiredSubAgent","hasAuthRequiredTool","authEnabled","authType","showAuthMethod","appTypeLabel","handlePanelSave","draft","savedId","ref","prev","targetId","subUsesAuthTool","next","pendingAuthTool","setPendingAuthTool","addTool","handleAddTool","toolItems","tool","restApiItems","restApiToolName","SOURCE_ICONS","configToolItems","configToolName","allToolItems","toolActionSources","buildToolActions","toolOptions","appLabel","toolSourceGroups","order","bySource","src","toolSourceLabel","subAgentItems","sub","subAgentOptions","toolMentionItems","buildAgentMentionItems","buildCustomToolMentionItems","subAgentMentionItems","modelOptions","m","selectedModel","openConfigTemplate","verificationToggle","jsx","Switch","enabled","verificationToggleNode","Tooltip","Step3Root","StepSectionHeader","jsxs","Step3Grid","SectionBodyWrap","MentionField","Step3Divider","SelectableListSection","SideSection","SideSectionHeader","Shield","TitleSmall","COLORS","BodyCaption","Fragment","BodySecondary","Dropdown","o","opt","v","unwrapDropdownValue","CreateSubAgentPanel","n","RestApiToolPanel","ConfigToolPanel","RequireVerificationModal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;A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,IAAA;AAAA,IAYnB,gBAAA4E;AAAA,MAAC8B;AAAA,MAAA;AAAA,QACA,MAAM/D,MAAoB;AAAA,QAC1B,WACClE,EAAe,KAAK,CAAChB,MAAMA,EAAE,YAAYkF,CAAe,GACrD,gBAAgB;AAAA,QAEpB,UAAU,MAAMC,EAAmB,IAAI;AAAA,QACvC,WAAW,MAAM;AAChB,UAAAvE,EAAM,EAAE,gBAAgB,EAAE,SAAS,IAAM,MAAM2D,EAAA,GAAY,GACvDW,KACHE,EAAQF,CAAe,GAExBC,EAAmB,IAAI;AAAA,QACxB;AAAA,MAAA;AAAA,IAAA;AAAA,EACD,GACD;AAEF;"}
1
+ {"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 {\n\tCONFIG_TOOL_SOURCE_BY_KEY,\n\tCONFIG_TOOL_SOURCES,\n\tINTEGRATIONS_KEY,\n\tINTEGRATIONS_LABEL,\n\tToolSource,\n} 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 { partitionSources } from '../utils/sourceGrouping';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tsourceIcon,\n} from '../utils/sourceIcons';\nimport { buildToolActions } from '../utils/toolActions';\n\n/** Source brand glyph for a tool, as a dropdown leadingIcon element. */\nconst toolIconEl = (source: string): JSX.Element | undefined =>\n\trenderSourceIcon(sourceIcon(source)) ?? undefined;\n\n/** Dropdown option for a tool: icon left of the name, no description. */\nconst toolOption = (t: AgentTool): SingleOption => ({\n\tlabel: t.display_name,\n\tvalue: t.tool_id,\n\tleadingIcon: toolIconEl(t.source ?? ToolSource.Manifest),\n});\n\nconst STEP = STEP_DEFINITIONS[2];\n\n/** Customer-verification OTP methods, in the dropdown's display order. */\nconst AUTH_METHOD_OPTIONS: SingleOption[] = [\n\t{ label: 'OTP to phone', value: 'phone_otp' },\n\t{ label: 'OTP to email', value: 'email_otp' },\n];\n\n/** Drawer state — null when closed; `key` remounts it fresh per open. */\ninterface SubAgentPanelState {\n\tkey: number;\n\ttitle: string;\n\teditingId?: string;\n\tinitial?: SubAgentDraft;\n}\n\n/**\n * Config-tool drawer state; `key` remounts fresh. `restapi` is the bespoke Rest\n * API panel; `config` is the shared dynamic panel (email / Slack), tagged with\n * its `toolKey`.\n */\ninterface ToolDrawerState {\n\tkey: number;\n\tkind: 'restapi' | 'config';\n\ttoolKey?: ConfigToolKey;\n\tinitialRest?: RestApiToolConfig;\n\tinitialConfig?: ConfigToolConfig;\n}\n\n/** Upsert an item by id (replace when present, append otherwise). */\nconst upsertById = <T extends { id: string }>(\n\tlist: T[] | undefined,\n\titem: T,\n): T[] => {\n\tconst arr = list ?? [];\n\treturn arr.some((x) => x.id === item.id)\n\t\t? arr.map((x) => (x.id === item.id ? item : x))\n\t\t: [...arr, item];\n};\n\nexport const Step3HowItResponds: React.FC = () => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\tupdateField,\n\t\taddReference,\n\t\tremoveReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableModels,\n\t\tconfigToolTemplates,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tinsertMention,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tregisterSubAgentCreator,\n\t\tregisterToolActionHandler,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t\tvariablesData,\n\t} = useAgentBuilderContext();\n\n\tconst [panel, setPanel] = useState<SubAgentPanelState | null>(null);\n\tconst panelKeyRef = useRef(0);\n\n\t// Rest API (bespoke) + shared config-tool drawers (separate from the sub-agent one).\n\tconst [toolDrawer, setToolDrawer] = useState<ToolDrawerState | null>(null);\n\tconst toolDrawerKeyRef = useRef(0);\n\tconst openRestApi = useCallback((initial?: RestApiToolConfig) => {\n\t\ttoolDrawerKeyRef.current += 1;\n\t\tsetToolDrawer({\n\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\tkind: 'restapi',\n\t\t\tinitialRest: initial,\n\t\t});\n\t}, []);\n\tconst openConfigTool = useCallback(\n\t\t(toolKey: ConfigToolKey, initial?: ConfigToolConfig) => {\n\t\t\ttoolDrawerKeyRef.current += 1;\n\t\t\tsetToolDrawer({\n\t\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\t\tkind: 'config',\n\t\t\t\ttoolKey,\n\t\t\t\tinitialConfig: initial,\n\t\t\t});\n\t\t},\n\t\t[],\n\t);\n\tconst handleSaveRestApi = useCallback(\n\t\t(config: RestApiToolConfig) => {\n\t\t\tconst isNew = !(value.restApiTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ restApiTools: upsertById(value.restApiTools, config) });\n\t\t\t// Drop a reference chip at the cursor on creation (edits keep the chip).\n\t\t\t// Pass the source so the fresh chip gets its icon (it isn't in the\n\t\t\t// editor's mention list yet).\n\t\t\tif (isNew) {\n\t\t\t\tinsertMention(\n\t\t\t\t\t'tool',\n\t\t\t\t\tconfig.id,\n\t\t\t\t\trestApiMentionItem(config).label,\n\t\t\t\t\tToolSource.RestApi,\n\t\t\t\t);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.restApiTools, insertMention],\n\t);\n\tconst handleSaveConfigTool = useCallback(\n\t\t(config: ConfigToolConfig) => {\n\t\t\tconst isNew = !(value.configTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ configTools: upsertById(value.configTools, config) });\n\t\t\tif (isNew) {\n\t\t\t\tinsertMention(\n\t\t\t\t\t'tool',\n\t\t\t\t\tconfig.id,\n\t\t\t\t\tconfigToolMentionItem(config).label,\n\t\t\t\t\tCONFIG_TOOL_SOURCE_BY_KEY[config.tool_key],\n\t\t\t\t);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.configTools, insertMention],\n\t);\n\n\t// Open a tool action's drawer by picker source (restapi / email / slack).\n\tconst openToolAction = useCallback(\n\t\t(source: ToolSource, toolKey?: ConfigToolKey) => {\n\t\t\tconst key = toolKey ?? CONFIG_TOOL_SOURCES[source]?.[0];\n\t\t\tif (key) {\n\t\t\t\topenConfigTool(key);\n\t\t\t} else if (source == ToolSource.RestApi) {\n\t\t\t\topenRestApi();\n\t\t\t}\n\t\t},\n\t\t[openConfigTool, openRestApi],\n\t);\n\t// Let the `@` reference picker (Instructions / Guardrails) open these drawers.\n\tuseEffect(() => {\n\t\tregisterToolActionHandler(openToolAction);\n\t\treturn () => registerToolActionHandler(null);\n\t}, [registerToolActionHandler, openToolAction]);\n\t// Sub-agents created / edited in this session, so a chip resolves (and reflects\n\t// a renamed sub-agent) before the consumer refreshes `availableSubAgents`.\n\tconst [createdSubAgents, setCreatedSubAgents] = useState<SubAgentRef[]>([]);\n\t// Ids of sub-agents saved this session that use an auth_required tool — they\n\t// make customer verification mandatory on the parent, just like a direct\n\t// auth_required tool. (A persisted sub-agent's tools aren't hydrated into\n\t// `value`, so it only joins this set once opened/edited in the panel.)\n\tconst [authRequiringSubAgents, setAuthRequiringSubAgents] = useState<\n\t\tSet<string>\n\t>(() => new Set());\n\t// Created/edited refs take precedence over the consumer-supplied list.\n\tconst subAgentById = new Map<string, SubAgentRef>();\n\tavailableSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tcreatedSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tconst knownSubAgents = Array.from(subAgentById.values());\n\n\tconst openCreate = useCallback(() => {\n\t\tpanelKeyRef.current += 1;\n\t\tsetPanel({ key: panelKeyRef.current, title: 'Create sub-agent' });\n\t}, []);\n\n\t// Let the `@` picker's \"Create new\" row open this step's drawer.\n\tuseEffect(() => {\n\t\tif (!onCreateSubAgent) {\n\t\t\treturn;\n\t\t}\n\t\tregisterSubAgentCreator(openCreate);\n\t\treturn () => registerSubAgentCreator(null);\n\t}, [registerSubAgentCreator, openCreate, onCreateSubAgent]);\n\n\tconst openConfigure = useCallback(\n\t\tasync (id: string) => {\n\t\t\tif (!onFetchSubAgent) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst data = await onFetchSubAgent(id);\n\t\t\tpanelKeyRef.current += 1;\n\t\t\tsetPanel({\n\t\t\t\tkey: panelKeyRef.current,\n\t\t\t\ttitle: 'Edit sub-agent',\n\t\t\t\teditingId: id,\n\t\t\t\tinitial: data,\n\t\t\t});\n\t\t},\n\t\t[onFetchSubAgent],\n\t);\n\n\t// ── Customer verification (auth) ──────────────────────────────────────────\n\t// Order tools (auth_required) can't run unless the customer is verified first,\n\t// so verification is MANDATORY whenever such a tool is attached (directly or\n\t// via a sub-agent). Derived before the handlers that read it.\n\tconst hasDirectAuthTool = value.tools.some(\n\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t);\n\tconst hasAuthRequiredSubAgent = value.subagents.some((id) =>\n\t\tauthRequiringSubAgents.has(id),\n\t);\n\tconst hasAuthRequiredTool = hasDirectAuthTool || hasAuthRequiredSubAgent;\n\tconst authEnabled = value.authentication?.enabled ?? false;\n\tconst authType: Authentication['type'] =\n\t\tvalue.authentication?.type ?? 'email_otp';\n\t// BIK picks the OTP channel itself, so the merchant only gets the on/off\n\t// toggle there; Manifest still chooses the method.\n\tconst showAuthMethod = appTypeLabel(applicationType) !== 'BIK';\n\n\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\n\t\t\tlet savedId: string | undefined;\n\t\t\tif (panel?.editingId) {\n\t\t\t\tif (onUpdateSubAgent) {\n\t\t\t\t\tconst ref = await onUpdateSubAgent(panel.editingId, draft);\n\t\t\t\t\tsavedId = ref.id;\n\t\t\t\t\tsetCreatedSubAgents((prev) => [\n\t\t\t\t\t\t...prev.filter((s) => s.id !== ref.id),\n\t\t\t\t\t\tref,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else if (onCreateSubAgent) {\n\t\t\t\tconst ref = await onCreateSubAgent(draft);\n\t\t\t\tsavedId = ref.id;\n\t\t\t\tsetCreatedSubAgents((prev) => [...prev, ref]);\n\t\t\t\tpatch({ subagents: [...value.subagents, ref.id] });\n\t\t\t\tinsertMention('subagent', ref.id, `sub-agent: ${ref.name}`);\n\t\t\t}\n\t\t\t// A sub-agent that uses an auth_required tool forces customer\n\t\t\t// verification on the parent agent — the tool can't run otherwise. Record\n\t\t\t// it so verification stays mandatory (the reconcile effect turns it on and\n\t\t\t// the toggle locks), mirroring the direct-tool invariant.\n\t\t\tif (savedId) {\n\t\t\t\tconst targetId = savedId;\n\t\t\t\tconst subUsesAuthTool = draft.tools.some(\n\t\t\t\t\t(id) => availableTools.find((t) => t.tool_id === id)?.auth_required,\n\t\t\t\t);\n\t\t\t\tsetAuthRequiringSubAgents((prev) => {\n\t\t\t\t\tconst next = new Set(prev);\n\t\t\t\t\tif (subUsesAuthTool) {\n\t\t\t\t\t\tnext.add(targetId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnext.delete(targetId);\n\t\t\t\t\t}\n\t\t\t\t\treturn next;\n\t\t\t\t});\n\t\t\t}\n\t\t\tsetPanel(null);\n\t\t},\n\t\t[\n\t\t\tpanel,\n\t\t\tonUpdateSubAgent,\n\t\t\tonCreateSubAgent,\n\t\t\tpatch,\n\t\t\tvalue.subagents,\n\t\t\tinsertMention,\n\t\t\tavailableTools,\n\t\t],\n\t);\n\n\t// Reconcile the invariant: a loaded agent that already holds an auth_required\n\t// tool must have verification on (a fail-closed tool otherwise runs silently).\n\tuseEffect(() => {\n\t\tif (hasAuthRequiredTool && !authEnabled) {\n\t\t\tpatch({ authentication: { enabled: true, type: authType } });\n\t\t}\n\t}, [hasAuthRequiredTool, authEnabled, authType, patch]);\n\n\t// A tool add awaiting the mandatory-verification confirm (null = no prompt).\n\tconst [pendingAuthTool, setPendingAuthTool] = useState<string | null>(null);\n\tconst addTool = useCallback(\n\t\t(id: string) => {\n\t\t\t// Always drop a chip at the cursor; addReference dedupes and reads the\n\t\t\t// latest value.\n\t\t\tinsertMention('tool', id);\n\t\t\taddReference('tool', id);\n\t\t},\n\t\t[insertMention, addReference],\n\t);\n\t// Adding an auth_required tool while verification is off prompts first; confirm\n\t// turns verification on and adds, cancel skips the add.\n\tconst handleAddTool = useCallback(\n\t\t(id: string) => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\tif (tool?.auth_required && !authEnabled) {\n\t\t\t\tsetPendingAuthTool(id);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\taddTool(id);\n\t\t},\n\t\t[availableTools, authEnabled, addTool],\n\t);\n\n\tconst toolItems: SelectableItem[] = value.tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: sourceIcon(tool.source ?? ToolSource.Manifest),\n\t\t\t\t\t\tauthRequired: tool.auth_required,\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// Inline-configured tools (Rest API + the shared email / Slack tools) live on\n\t// the value, not in `tools`. They render as rows in the same Tools list, each\n\t// with its own Configure (edit) action that reopens its drawer.\n\tconst restApiItems: SelectableItem[] = (value.restApiTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: restApiToolName(t),\n\t\t\ticon: SOURCE_ICONS[ToolSource.RestApi],\n\t\t\tonConfigure: () => openRestApi(t),\n\t\t}),\n\t);\n\tconst configToolItems: SelectableItem[] = (value.configTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: configToolName(t),\n\t\t\ticon: SOURCE_ICONS[\n\t\t\t\tt.tool_key === 'send_slack_message'\n\t\t\t\t\t? ToolSource.Slack\n\t\t\t\t\t: ToolSource.EmailHandover\n\t\t\t],\n\t\t\tonConfigure: () => openConfigTool(t.tool_key, t),\n\t\t}),\n\t);\n\tconst allToolItems: SelectableItem[] = [\n\t\t...toolItems,\n\t\t...restApiItems,\n\t\t...configToolItems,\n\t];\n\n\t// Built-in tools that open a config drawer instead of inserting a mention.\n\t// Shown as empty-state buttons AND in the `@` picker's Tools view. The shared\n\t// email / Slack forms are backend-driven, so each is offered only when its\n\t// template was provided.\n\tconst toolActionSources = buildToolActions(\n\t\tconfigToolTemplates,\n\t\topenToolAction,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t);\n\n\t// All tools are offered (even already-added ones) so a tool can be referenced\n\t// again in the text; the chip list below still shows each only once.\n\tconst toolOptions: SingleOption[] = availableTools.map(toolOption);\n\n\t// The native tool group is named after the host product — \"Manifest\" in\n\t// Manifest, \"BIK\" in BIK — so every surface that renders a source name needs it.\n\tconst appLabel = appTypeLabel(applicationType);\n\n\t// Group tools by source (Manifest / Shopify / …) for the empty-state buttons.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? ToolSource.Manifest;\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push(toolOption(t));\n\t\t});\n\t\t// Same rule as the `@` picker: a source the store hasn't connected doesn't\n\t\t// get its own button — they all collapse into one \"Integrations\" button that\n\t\t// opens the picker on that group (SelectableListSection deep-links a source\n\t\t// button straight into the picker, and the umbrella key works like any other\n\t\t// source there). Action sources join the split too: Slack has no catalog\n\t\t// tools of its own, so without them an unconnected Slack would have nowhere\n\t\t// to live.\n\t\tconst { outside, inside } = partitionSources(\n\t\t\t[...order, ...toolActionSources.map((a) => a.source)],\n\t\t\tintegrationStatus,\n\t\t);\n\t\tconst shownOutside = new Set(outside);\n\t\tconst groups: SourceGroup[] = order\n\t\t\t.filter((src) => shownOutside.has(src))\n\t\t\t.map((src) => ({\n\t\t\t\tsource: src,\n\t\t\t\tlabel: toolSourceLabel(src, appLabel),\n\t\t\t\toptions: bySource.get(src) ?? [],\n\t\t\t\t// Reachable only when connected or ungated, so no connect flow needed —\n\t\t\t\t// kept for the picker's own gating, which reads these groups.\n\t\t\t\tconnected: integrationStatus?.[src as ToolSource],\n\t\t\t\tonConnect: () => onConnectIntegration?.(src as ToolSource),\n\t\t\t}));\n\t\tif (inside.length > 0) {\n\t\t\tgroups.push({\n\t\t\t\tsource: INTEGRATIONS_KEY,\n\t\t\t\tlabel: INTEGRATIONS_LABEL,\n\t\t\t\t// No options of its own: clicking opens the picker at the umbrella,\n\t\t\t\t// where each unconnected source offers \"Connect\".\n\t\t\t\toptions: [],\n\t\t\t});\n\t\t}\n\t\treturn groups;\n\t})();\n\n\tconst subAgentItems: SelectableItem[] = value.subagents\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst sub = subAgentById.get(id);\n\t\t\treturn sub ? { id, label: sub.name } : null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\tconst subAgentOptions: SingleOption[] = knownSubAgents.map((s) => ({\n\t\tlabel: s.name,\n\t\tvalue: s.id,\n\t}));\n\n\t// Per-section `@`-picker items so the header \"+\" opens the same reference\n\t// picker as the Instructions editor, drilled straight into this section's\n\t// category (tools OR sub-agents).\n\tconst toolMentionItems = [\n\t\t...buildAgentMentionItems(availableTools, [], appLabel),\n\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t];\n\tconst subAgentMentionItems = buildAgentMentionItems(\n\t\t[],\n\t\tknownSubAgents,\n\t\tappLabel,\n\t);\n\n\tconst modelOptions: SingleOption[] = availableModels.map((m) => ({\n\t\tlabel: m.label,\n\t\tvalue: m.value,\n\t\tselected: m.value === value.model,\n\t}));\n\tconst selectedModel = availableModels.find((m) => m.value === value.model);\n\n\t// The template for the open shared-drawer tool (undefined unless a config\n\t// drawer is open and its template was provided).\n\tconst openConfigTemplate =\n\t\ttoolDrawer?.kind === 'config' && toolDrawer.toolKey\n\t\t\t? configToolTemplates?.[toolDrawer.toolKey]\n\t\t\t: undefined;\n\n\tconst verificationToggle = (\n\t\t<Switch\n\t\t\tdata-test=\"agent-auth-toggle\"\n\t\t\tvalue={authEnabled || hasAuthRequiredTool}\n\t\t\t// Mandatory (can't turn off) while an auth_required tool is attached.\n\t\t\tdisabled={hasAuthRequiredTool}\n\t\t\tonValueChange={async (enabled) => {\n\t\t\t\tpatch({ authentication: { enabled, type: authType } });\n\t\t\t}}\n\t\t/>\n\t);\n\t// While locked, a tooltip explains why the toggle can't be changed.\n\tconst verificationToggleNode = hasAuthRequiredTool ? (\n\t\t<Tooltip\n\t\t\tbody=\"Remove tools that requires customer verification to change this setting.\"\n\t\t\tplacement=\"bottom\"\n\t\t>\n\t\t\t<span style={{ display: 'flex' }}>{verificationToggle}</span>\n\t\t</Tooltip>\n\t) : (\n\t\tverificationToggle\n\t);\n\n\treturn (\n\t\t<Step3Root>\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<Step3Grid $grow>\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"instructions\"\n\t\t\t\t\t\tdata-test=\"agent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder=\"Write the steps in plain English. The agent will follow them exactly. The more specific you are, the better it performs.\"\n\t\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"guardrail\"\n\t\t\t\t\t\tdata-test=\"agent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tmaxLength={charLimits.guardrail}\n\t\t\t\t\t\tplaceholder=\"e.g. Never discuss competitor pricing. Always stay within the cancellation policy. Do not process refunds above ₹10,000 without human approval.\"\n\t\t\t\t\t\tminHeight=\"140px\"\n\t\t\t\t\t/>\n\t\t\t\t</SectionBodyWrap>\n\n\t\t\t\t<Step3Divider />\n\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools\"\n\t\t\t\t\t\thelper=\"Actions this agent can take while responding.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-tools\"\n\t\t\t\t\t\titems={allToolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\t\tonConnectIntegration={(source) =>\n\t\t\t\t\t\t\tonConnectIntegration?.(source as ToolSource)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmentionItems={toolMentionItems}\n\t\t\t\t\t\tactionSources={toolActionSources}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tappLabel={appLabel}\n\t\t\t\t\t\tonAdd={handleAddTool}\n\t\t\t\t\t\t// Strips the tool's tokens AND drops it from whichever list holds it\n\t\t\t\t\t\t// (catalog `tools` or an inline custom-tool list).\n\t\t\t\t\t\tonRemove={(id) => removeReference('tool', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'tool' }}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Sub-agents\"\n\t\t\t\t\t\thelper=\"Other agents this agent can hand off the conversation to.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-subagents\"\n\t\t\t\t\t\titems={subAgentItems}\n\t\t\t\t\t\taddableOptions={subAgentOptions}\n\t\t\t\t\t\tmentionItems={subAgentMentionItems}\n\t\t\t\t\t\temptyText=\"No sub-agents added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertMention('subagent', id);\n\t\t\t\t\t\t\taddReference('subagent', id);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('subagent', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'sub-agent' }}\n\t\t\t\t\t\tonConfigure={onFetchSubAgent ? openConfigure : undefined}\n\t\t\t\t\t\tcreateOption={\n\t\t\t\t\t\t\tonCreateSubAgent\n\t\t\t\t\t\t\t\t? { label: 'Create new', onSelect: openCreate }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t<SideSectionHeader>\n\t\t\t\t\t\t\t<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n\t\t\t\t\t\t\t\t<Shield size={20} />\n\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tRequire customer verification\n\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{verificationToggleNode}\n\t\t\t\t\t\t</SideSectionHeader>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t{hasAuthRequiredTool\n\t\t\t\t\t\t\t\t? 'Required — this agent uses a tool that accesses customer order details.'\n\t\t\t\t\t\t\t\t: 'Customers must verify their identity before this agent responds.'}\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t{showAuthMethod && (authEnabled || hasAuthRequiredTool) && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tSelect verification method\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-auth-method\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t\t// Popover is portalled, so \"100%\" collapses to content width —\n\t\t\t\t\t\t\t\t\t// match the input: 360px side column − 2×16px padding.\n\t\t\t\t\t\t\t\t\tdropdownWidth=\"328px\"\n\t\t\t\t\t\t\t\t\tplaceHolder=\"Select verification method\"\n\t\t\t\t\t\t\t\t\t// Flag the active method so the open list highlights that row\n\t\t\t\t\t\t\t\t\t// green (list-item 'selected' theme handles the styling).\n\t\t\t\t\t\t\t\t\toptions={AUTH_METHOD_OPTIONS.map((o) => ({\n\t\t\t\t\t\t\t\t\t\t...o,\n\t\t\t\t\t\t\t\t\t\tselected: o.value === authType,\n\t\t\t\t\t\t\t\t\t}))}\n\t\t\t\t\t\t\t\t\tdefaultOptions={[\n\t\t\t\t\t\t\t\t\t\tAUTH_METHOD_OPTIONS.find((o) => o.value === authType) ??\n\t\t\t\t\t\t\t\t\t\t\tAUTH_METHOD_OPTIONS[0],\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\t\tpatch({\n\t\t\t\t\t\t\t\t\t\t\t\tauthentication: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: v as Authentication['type'],\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</SideSection>\n\n\t\t\t\t\t{availableModels.length > 0 && (\n\t\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tAdvanced settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tSelect AI model\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"agent-model\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t// Popover is portalled, so \"100%\" collapses to content width —\n\t\t\t\t\t\t\t\t// match the input: 360px side column − 2×16px SectionBodyWrap\n\t\t\t\t\t\t\t\t// padding.\n\t\t\t\t\t\t\t\tdropdownWidth=\"328px\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select model\"\n\t\t\t\t\t\t\t\toptions={modelOptions}\n\t\t\t\t\t\t\t\tdefaultOptions={\n\t\t\t\t\t\t\t\t\tselectedModel\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: selectedModel.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: selectedModel.value,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\tupdateField('model', v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SideSection>\n\t\t\t\t\t)}\n\t\t\t\t</SectionBodyWrap>\n\t\t\t</Step3Grid>\n\n\t\t\t{panel && (\n\t\t\t\t<CreateSubAgentPanel\n\t\t\t\t\tkey={panel.key}\n\t\t\t\t\ttitle={panel.title}\n\t\t\t\t\tinitial={panel.initial}\n\t\t\t\t\t// Block reusing another sub-agent's name (exclude the one being edited).\n\t\t\t\t\texistingNames={value.subagents\n\t\t\t\t\t\t.filter((id) => id !== panel.editingId)\n\t\t\t\t\t\t.map((id) => subAgentById.get(id)?.name)\n\t\t\t\t\t\t.filter((n): n is string => !!n)}\n\t\t\t\t\tavailableTools={availableTools}\n\t\t\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\t\t\tappLabel={appLabel}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tonImprove={onImproveSubAgent}\n\t\t\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setPanel(null)}\n\t\t\t\t\tonSave={handlePanelSave}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'restapi' && (\n\t\t\t\t<RestApiToolPanel\n\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\tinitial={toolDrawer.initialRest}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t// Block reusing another tool's name (exclude the one being edited).\n\t\t\t\t\texistingNames={(value.restApiTools ?? [])\n\t\t\t\t\t\t.filter((t) => t.id !== toolDrawer.initialRest?.id)\n\t\t\t\t\t\t.map((t) => t.name)}\n\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\tonSave={handleSaveRestApi}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'config' &&\n\t\t\t\ttoolDrawer.toolKey &&\n\t\t\t\topenConfigTemplate && (\n\t\t\t\t\t<ConfigToolPanel\n\t\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\t\ttoolKey={toolDrawer.toolKey}\n\t\t\t\t\t\ttemplate={openConfigTemplate}\n\t\t\t\t\t\tinitial={toolDrawer.initialConfig}\n\t\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\t\tonSave={handleSaveConfigTool}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t<RequireVerificationModal\n\t\t\t\topen={pendingAuthTool !== null}\n\t\t\t\ttoolLabel={\n\t\t\t\t\tavailableTools.find((t) => t.tool_id === pendingAuthTool)\n\t\t\t\t\t\t?.display_name ?? 'This tool'\n\t\t\t\t}\n\t\t\t\tonCancel={() => setPendingAuthTool(null)}\n\t\t\t\tonConfirm={() => {\n\t\t\t\t\tpatch({ authentication: { enabled: true, type: authType } });\n\t\t\t\t\tif (pendingAuthTool) {\n\t\t\t\t\t\taddTool(pendingAuthTool);\n\t\t\t\t\t}\n\t\t\t\t\tsetPendingAuthTool(null);\n\t\t\t\t}}\n\t\t\t/>\n\t\t</Step3Root>\n\t);\n};\n"],"names":["toolIconEl","source","renderSourceIcon","sourceIcon","toolOption","t","ToolSource","STEP","STEP_DEFINITIONS","AUTH_METHOD_OPTIONS","upsertById","list","item","arr","x","Step3HowItResponds","value","patch","updateField","addReference","removeReference","availableTools","availableSubAgents","availableModels","configToolTemplates","applicationType","charLimits","insertMention","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","registerSubAgentCreator","registerToolActionHandler","integrationStatus","onConnectIntegration","variablesData","useAgentBuilderContext","panel","setPanel","useState","panelKeyRef","useRef","toolDrawer","setToolDrawer","toolDrawerKeyRef","openRestApi","useCallback","initial","openConfigTool","toolKey","handleSaveRestApi","config","isNew","restApiMentionItem","handleSaveConfigTool","configToolMentionItem","CONFIG_TOOL_SOURCE_BY_KEY","openToolAction","key","CONFIG_TOOL_SOURCES","useEffect","createdSubAgents","setCreatedSubAgents","authRequiringSubAgents","setAuthRequiringSubAgents","subAgentById","s","knownSubAgents","openCreate","openConfigure","id","data","hasDirectAuthTool","hasAuthRequiredSubAgent","hasAuthRequiredTool","authEnabled","authType","showAuthMethod","appTypeLabel","handlePanelSave","draft","savedId","ref","prev","targetId","subUsesAuthTool","next","pendingAuthTool","setPendingAuthTool","addTool","handleAddTool","toolItems","tool","restApiItems","restApiToolName","SOURCE_ICONS","configToolItems","configToolName","allToolItems","toolActionSources","buildToolActions","toolOptions","appLabel","toolSourceGroups","order","bySource","src","outside","inside","partitionSources","shownOutside","groups","toolSourceLabel","INTEGRATIONS_KEY","INTEGRATIONS_LABEL","subAgentItems","sub","subAgentOptions","toolMentionItems","buildAgentMentionItems","buildCustomToolMentionItems","subAgentMentionItems","modelOptions","m","selectedModel","openConfigTemplate","verificationToggle","jsx","Switch","enabled","verificationToggleNode","Tooltip","Step3Root","StepSectionHeader","jsxs","Step3Grid","SectionBodyWrap","MentionField","Step3Divider","SelectableListSection","SideSection","SideSectionHeader","Shield","TitleSmall","COLORS","BodyCaption","Fragment","BodySecondary","Dropdown","o","opt","v","unwrapDropdownValue","CreateSubAgentPanel","n","RestApiToolPanel","ConfigToolPanel","RequireVerificationModal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoEA,MAAMA,KAAa,CAACC,MACnBC,GAAiBC,GAAWF,CAAM,CAAC,KAAK,QAGnCG,KAAa,CAACC,OAAgC;AAAA,EACnD,OAAOA,EAAE;AAAA,EACT,OAAOA,EAAE;AAAA,EACT,aAAaL,GAAWK,EAAE,UAAUC,EAAW,QAAQ;AACxD,IAEMC,KAAOC,GAAiB,CAAC,GAGzBC,IAAsC;AAAA,EAC3C,EAAE,OAAO,gBAAgB,OAAO,YAAA;AAAA,EAChC,EAAE,OAAO,gBAAgB,OAAO,YAAA;AACjC,GAwBMC,KAAa,CAClBC,GACAC,MACS;AACT,QAAMC,IAAMF,KAAQ,CAAA;AACpB,SAAOE,EAAI,KAAK,CAACC,MAAMA,EAAE,OAAOF,EAAK,EAAE,IACpCC,EAAI,IAAI,CAACC,MAAOA,EAAE,OAAOF,EAAK,KAAKA,IAAOE,CAAE,IAC5C,CAAC,GAAGD,GAAKD,CAAI;AACjB,GAEaG,KAA+B,MAAM;AACjD,QAAM;AAAA,IACL,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAA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A,EACD,GACD;AAEF;"}
@@ -0,0 +1,39 @@
1
+ import { ToolSource } from '../constants/tools';
2
+ /**
3
+ * Where each tool source belongs in the picker: its own row, or inside the
4
+ * "Integrations" umbrella.
5
+ */
6
+ export interface SourcePartition {
7
+ /** Sources with their own top-level row, in display order. */
8
+ outside: string[];
9
+ /** Sources the store has not connected, in display order. */
10
+ inside: string[];
11
+ }
12
+ /**
13
+ * A source belongs in the "Integrations" umbrella only when the store has NOT
14
+ * connected it.
15
+ *
16
+ * `integrationStatus` carries three distinct states, and all three matter:
17
+ *
18
+ * | value | meaning | row |
19
+ * | ----------- | ---------------------------------------- | --------- |
20
+ * | `undefined` | never gated — needs no connection at all | outside |
21
+ * | `true` | gated, and the store connected it | outside |
22
+ * | `false` | gated, and the store has not connected it | inside |
23
+ *
24
+ * `undefined` is what makes Manifest, Google Sheets, Handover to email and REST
25
+ * API sit outside for free: the backend never marks their tools
26
+ * `integration: true`, so the host never puts them in the map. A gated source
27
+ * missing from the host's app-id map lands here too — it reads as "needs no
28
+ * connection", which is why the host warns rather than silently gating it.
29
+ */
30
+ export declare const isUnconnectedSource: (source: string, integrationStatus?: Partial<Record<ToolSource, boolean>>) => boolean;
31
+ /**
32
+ * Split the picker's sources into the ones that get their own row and the ones
33
+ * that collapse into "Integrations". Both lists come back in {@link
34
+ * toolSourceRank} order, so a store's rows never reshuffle as tools are added.
35
+ *
36
+ * The SAME split drives the `@` picker, the Step-3 empty state and the sub-agent
37
+ * drawer — one rule, three surfaces, so they cannot drift apart.
38
+ */
39
+ export declare const partitionSources: (sources: string[], integrationStatus?: Partial<Record<ToolSource, boolean>>) => SourcePartition;
@@ -0,0 +1,14 @@
1
+ import { toolSourceRank as c } from "../constants/tools.js";
2
+ const u = (t, n) => n?.[t] === !1, d = (t, n) => {
3
+ const s = (o, i) => c(o) - c(i), e = [], r = [];
4
+ return t.forEach((o) => {
5
+ (u(o, n) ? r : e).push(
6
+ o
7
+ );
8
+ }), { outside: e.sort(s), inside: r.sort(s) };
9
+ };
10
+ export {
11
+ u as isUnconnectedSource,
12
+ d as partitionSources
13
+ };
14
+ //# sourceMappingURL=sourceGrouping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceGrouping.js","sources":["../../../../../src/components/agent-builder/utils/sourceGrouping.ts"],"sourcesContent":["import { ToolSource, toolSourceRank } from '../constants/tools';\n\n/**\n * Where each tool source belongs in the picker: its own row, or inside the\n * \"Integrations\" umbrella.\n */\nexport interface SourcePartition {\n\t/** Sources with their own top-level row, in display order. */\n\toutside: string[];\n\t/** Sources the store has not connected, in display order. */\n\tinside: string[];\n}\n\n/**\n * A source belongs in the \"Integrations\" umbrella only when the store has NOT\n * connected it.\n *\n * `integrationStatus` carries three distinct states, and all three matter:\n *\n * | value | meaning | row |\n * | ----------- | ---------------------------------------- | --------- |\n * | `undefined` | never gated — needs no connection at all | outside |\n * | `true` | gated, and the store connected it | outside |\n * | `false` | gated, and the store has not connected it | inside |\n *\n * `undefined` is what makes Manifest, Google Sheets, Handover to email and REST\n * API sit outside for free: the backend never marks their tools\n * `integration: true`, so the host never puts them in the map. A gated source\n * missing from the host's app-id map lands here too — it reads as \"needs no\n * connection\", which is why the host warns rather than silently gating it.\n */\nexport const isUnconnectedSource = (\n\tsource: string,\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>,\n): boolean => integrationStatus?.[source as ToolSource] === false;\n\n/**\n * Split the picker's sources into the ones that get their own row and the ones\n * that collapse into \"Integrations\". Both lists come back in {@link\n * toolSourceRank} order, so a store's rows never reshuffle as tools are added.\n *\n * The SAME split drives the `@` picker, the Step-3 empty state and the sub-agent\n * drawer — one rule, three surfaces, so they cannot drift apart.\n */\nexport const partitionSources = (\n\tsources: string[],\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>,\n): SourcePartition => {\n\tconst byRank = (a: string, b: string) =>\n\t\ttoolSourceRank(a) - toolSourceRank(b);\n\tconst outside: string[] = [];\n\tconst inside: string[] = [];\n\tsources.forEach((source) => {\n\t\t(isUnconnectedSource(source, integrationStatus) ? inside : outside).push(\n\t\t\tsource,\n\t\t);\n\t});\n\treturn { outside: outside.sort(byRank), inside: inside.sort(byRank) };\n};\n"],"names":["isUnconnectedSource","source","integrationStatus","partitionSources","sources","byRank","a","b","toolSourceRank","outside","inside"],"mappings":";AA+BO,MAAMA,IAAsB,CAClCC,GACAC,MACaA,IAAoBD,CAAoB,MAAM,IAU/CE,IAAmB,CAC/BC,GACAF,MACqB;AACrB,QAAMG,IAAS,CAACC,GAAWC,MAC1BC,EAAeF,CAAC,IAAIE,EAAeD,CAAC,GAC/BE,IAAoB,CAAA,GACpBC,IAAmB,CAAA;AACzB,SAAAN,EAAQ,QAAQ,CAACH,MAAW;AAC3B,KAACD,EAAoBC,GAAQC,CAAiB,IAAIQ,IAASD,GAAS;AAAA,MACnER;AAAA,IAAA;AAAA,EAEF,CAAC,GACM,EAAE,SAASQ,EAAQ,KAAKJ,CAAM,GAAG,QAAQK,EAAO,KAAKL,CAAM,EAAA;AACnE;"}
@@ -8,12 +8,14 @@ export type { IconComp, SourceIcon };
8
8
  * than aspect correction. Partial: not every source has a glyph, and the render
9
9
  * path null-guards. Look up with {@link sourceIcon} when the key is a dynamic /
10
10
  * unknown string rather than a {@link ToolSource}.
11
- *
12
- * `Aftership` is deliberately absent — we have no AfterShip brand asset yet, so
13
- * it resolves to {@link GENERIC_SOURCE_ICON}. Add the glyph to `@src/icons`
14
- * (same as ShipStation) and add its entry here to fix that.
15
11
  */
16
12
  export declare const SOURCE_ICONS: Partial<Record<ToolSource, SourceIcon>>;
13
+ /**
14
+ * Glyph for the synthetic "Integrations" umbrella row — the group that holds
15
+ * every source the store has not connected. Not a real source, so it has no
16
+ * entry in {@link SOURCE_ICONS}; {@link sourceIcon} resolves it by key.
17
+ */
18
+ export declare const INTEGRATIONS_ICON: SourceIcon;
17
19
  /**
18
20
  * Generic glyph for a tool whose source has no dedicated brand icon (any custom
19
21
  * / future integration the FE doesn't bundle a logo for). Ensures EVERY tool
@@ -1,39 +1,70 @@
1
- import m from "react";
2
- import { ToolSource as o } from "../constants/tools.js";
3
- import t from "../../../icons/Social/Social/SlackIcon.js";
4
- import n from "../../../icons/Informational/Communication/Email.js";
5
- import c from "../../../icons/BIK AI specific/Webhook.js";
6
- import S from "../../../icons/Informational/Identity/PuzzlePiece.js";
7
- import e from "../../../icons/Social/Social/Gorgias.js";
8
- import h from "../../../icons/Social/Channels/Skio.js";
9
- import p from "../../../icons/Social/Channels/ShipStation.js";
10
- import I from "../../../icons/Social/Social/BigCommerce.js";
11
- import f from "../../../icons/Social/Channels/ShopifyBrand.js";
12
- import a from "../../../icons/Social/Channels/ManifestGlass.js";
13
- import g from "../../../icons/Actions/Common actions/LinkSimpleHorizontal.js";
14
- const v = {
15
- [o.Manifest]: { Icon: a, w: 24, h: 24 },
16
- [o.Shopify]: { Icon: f, w: 24, h: 24 },
17
- [o.Bigcommerce]: { Icon: I, w: 20, h: 20 },
18
- [o.Shipstation]: { Icon: p, w: 22, h: 22 },
19
- [o.Skio]: { Icon: h, w: 20, h: 20 },
20
- [o.Gorgias]: { Icon: e, w: 20, h: 20 },
21
- [o.Integration]: { Icon: S, w: 20, h: 20 },
22
- [o.RestApi]: { Icon: c, w: 20, h: 20 },
23
- [o.EmailHandover]: { Icon: n, w: 20, h: 20 },
24
- [o.Slack]: { Icon: t, w: 20, h: 20 }
25
- }, w = {
26
- Icon: g,
1
+ import i from "react";
2
+ import { INTEGRATIONS_KEY as n, ToolSource as o } from "../constants/tools.js";
3
+ import e from "../../../icons/Social/Channels/GoogleSheets.js";
4
+ import S from "../../../icons/Social/Channels/ShipBob.js";
5
+ import h from "../../../icons/Social/Channels/Kustomer.js";
6
+ import c from "../../../icons/Social/Channels/Freshdesk.js";
7
+ import p from "../../../icons/Social/Social/Zendesk.js";
8
+ import I from "../../../icons/Social/Channels/Segment.js";
9
+ import f from "../../../icons/Social/Channels/Mailchimp.js";
10
+ import g from "../../../icons/Social/Channels/Attentive.js";
11
+ import v from "../../../icons/Social/Channels/OmniSend.js";
12
+ import w from "../../../icons/Social/Channels/Klavyio.js";
13
+ import s from "../../../icons/Social/Channels/Aftership.js";
14
+ import a from "../../../icons/Social/Social/SlackIcon.js";
15
+ import l from "../../../icons/Informational/Communication/Email.js";
16
+ import d from "../../../icons/BIK AI specific/Webhook.js";
17
+ import t from "../../../icons/Informational/Identity/PuzzlePiece.js";
18
+ import k from "../../../icons/Social/Social/Gorgias.js";
19
+ import E from "../../../icons/Social/Channels/Skio.js";
20
+ import u from "../../../icons/Social/Channels/ShipStation.js";
21
+ import O from "../../../icons/Social/Social/BigCommerce.js";
22
+ import G from "../../../icons/Social/Channels/ShopifyBrand.js";
23
+ import N from "../../../icons/Social/Channels/ManifestGlass.js";
24
+ import A from "../../../icons/Actions/Common actions/LinkSimpleHorizontal.js";
25
+ const C = {
26
+ [o.Manifest]: { Icon: N, w: 24, h: 24 },
27
+ [o.Shopify]: { Icon: G, w: 24, h: 24 },
28
+ [o.Bigcommerce]: { Icon: O, w: 20, h: 20 },
29
+ [o.Shipstation]: { Icon: u, w: 22, h: 22 },
30
+ [o.Skio]: { Icon: E, w: 20, h: 20 },
31
+ [o.Gorgias]: { Icon: k, w: 20, h: 20 },
32
+ [o.Integration]: { Icon: t, w: 20, h: 20 },
33
+ [o.RestApi]: { Icon: d, w: 20, h: 20 },
34
+ [o.EmailHandover]: { Icon: l, w: 20, h: 20 },
35
+ [o.Slack]: { Icon: a, w: 20, h: 20 },
36
+ // Standard-contract vendors — brand glyphs from the shared icon set.
37
+ [o.Aftership]: { Icon: s, w: 20, h: 20 },
38
+ [o.Klaviyo]: { Icon: w, w: 20, h: 20 },
39
+ [o.Omnisend]: { Icon: v, w: 20, h: 20 },
40
+ [o.Attentive]: { Icon: g, w: 20, h: 20 },
41
+ [o.Mailchimp]: { Icon: f, w: 20, h: 20 },
42
+ [o.Segment]: { Icon: I, w: 20, h: 20 },
43
+ [o.Zendesk]: { Icon: p, w: 20, h: 20 },
44
+ [o.Freshdesk]: { Icon: c, w: 20, h: 20 },
45
+ [o.Kustomer]: { Icon: h, w: 20, h: 20 },
46
+ [o.Shipbob]: { Icon: S, w: 20, h: 20 },
47
+ [o.GoogleSheets]: { Icon: e, w: 20, h: 20 }
48
+ }, R = {
49
+ Icon: t,
27
50
  w: 20,
28
51
  h: 20
29
- }, y = (r) => r ? v[r] ?? w : void 0, z = (r, i = 0) => r ? m.createElement(r.Icon, {
30
- width: r.w + i,
31
- height: r.h + i
52
+ }, _ = {
53
+ Icon: A,
54
+ w: 20,
55
+ h: 20
56
+ }, oo = (r) => {
57
+ if (r)
58
+ return r === n ? R : C[r] ?? _;
59
+ }, ro = (r, m = 0) => r ? i.createElement(r.Icon, {
60
+ width: r.w + m,
61
+ height: r.h + m
32
62
  }) : null;
33
63
  export {
34
- w as GENERIC_SOURCE_ICON,
35
- v as SOURCE_ICONS,
36
- z as renderSourceIcon,
37
- y as sourceIcon
64
+ _ as GENERIC_SOURCE_ICON,
65
+ R as INTEGRATIONS_ICON,
66
+ C as SOURCE_ICONS,
67
+ ro as renderSourceIcon,
68
+ oo as sourceIcon
38
69
  };
39
70
  //# sourceMappingURL=sourceIcons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sourceIcons.js","sources":["../../../../../src/components/agent-builder/utils/sourceIcons.ts"],"sourcesContent":["import {\n\tBigCommerce,\n\tEmail,\n\tGorgias,\n\tLinkSimpleHorizontal,\n\tManifestGlass,\n\tPuzzlePiece,\n\tShipStation,\n\tShopifyBrand,\n\tSkio,\n\tSlackIcon,\n\tWebhook,\n} from '@src/icons';\nimport React from 'react';\nimport { ToolSource } from '../constants/tools';\nimport type { IconComp, SourceIcon } from '../constants/tools';\n\n// The icon types live with the source enum (constants/tools) to keep the\n// dependency one-directional (util → constants); re-exported here so existing\n// `from '../utils/sourceIcons'` importers keep resolving them.\nexport type { IconComp, SourceIcon };\n\n/**\n * Per-source brand glyph — shared by the `@` picker and the Tools source\n * buttons. Every glyph comes from the shared icon library (`@src/icons`), so all\n * of them sit on a square 24 viewBox and `w`/`h` is purely optical sizing rather\n * than aspect correction. Partial: not every source has a glyph, and the render\n * path null-guards. Look up with {@link sourceIcon} when the key is a dynamic /\n * unknown string rather than a {@link ToolSource}.\n *\n * `Aftership` is deliberately absent — we have no AfterShip brand asset yet, so\n * it resolves to {@link GENERIC_SOURCE_ICON}. Add the glyph to `@src/icons`\n * (same as ShipStation) and add its entry here to fix that.\n */\nexport const SOURCE_ICONS: Partial<Record<ToolSource, SourceIcon>> = {\n\t[ToolSource.Manifest]: { Icon: ManifestGlass as IconComp, w: 24, h: 24 },\n\t[ToolSource.Shopify]: { Icon: ShopifyBrand as IconComp, w: 24, h: 24 },\n\t[ToolSource.Bigcommerce]: { Icon: BigCommerce as IconComp, w: 20, h: 20 },\n\t[ToolSource.Shipstation]: { Icon: ShipStation as IconComp, w: 22, h: 22 },\n\t[ToolSource.Skio]: { Icon: Skio as IconComp, w: 20, h: 20 },\n\t[ToolSource.Gorgias]: { Icon: Gorgias as IconComp, w: 20, h: 20 },\n\t[ToolSource.Integration]: { Icon: PuzzlePiece as IconComp, w: 20, h: 20 },\n\t[ToolSource.RestApi]: { Icon: Webhook as IconComp, w: 20, h: 20 },\n\t[ToolSource.EmailHandover]: { Icon: Email as IconComp, w: 20, h: 20 },\n\t[ToolSource.Slack]: { Icon: SlackIcon as IconComp, w: 20, h: 20 },\n};\n\n/**\n * Generic glyph for a tool whose source has no dedicated brand icon (any custom\n * / future integration the FE doesn't bundle a logo for). Ensures EVERY tool\n * chip still leads with an icon.\n */\nexport const GENERIC_SOURCE_ICON: SourceIcon = {\n\tIcon: LinkSimpleHorizontal as IconComp,\n\tw: 20,\n\th: 20,\n};\n\n/**\n * Lenient icon lookup for a source that may be a raw/dynamic string (a\n * bik-models tool source, an integration key, or the picker's `'other'`\n * fallback). A known source returns its brand glyph; any other NON-EMPTY source\n * falls back to {@link GENERIC_SOURCE_ICON} so no tool renders iconless. An\n * empty/undefined source (e.g. a sub-agent reference) returns `undefined`.\n */\nexport const sourceIcon = (\n\tsource: string | undefined,\n): SourceIcon | undefined =>\n\tsource\n\t\t? SOURCE_ICONS[source as ToolSource] ?? GENERIC_SOURCE_ICON\n\t\t: undefined;\n\n/**\n * Render a {@link SourceIcon} at its declared box. `sizeDelta` nudges both\n * dimensions (e.g. `-4` for the smaller source-button glyph). Returns `null` when\n * no icon is supplied, so callers can drop their own `icon &&` guard.\n */\nexport const renderSourceIcon = (\n\ticon: SourceIcon | undefined,\n\tsizeDelta = 0,\n): React.ReactElement | null =>\n\ticon\n\t\t? React.createElement(icon.Icon, {\n\t\t\t\twidth: icon.w + sizeDelta,\n\t\t\t\theight: icon.h + sizeDelta,\n\t\t })\n\t\t: null;\n"],"names":["SOURCE_ICONS","ToolSource","ManifestGlass","ShopifyBrand","BigCommerce","ShipStation","Skio","Gorgias","PuzzlePiece","Webhook","Email","SlackIcon","GENERIC_SOURCE_ICON","LinkSimpleHorizontal","sourceIcon","source","renderSourceIcon","icon","sizeDelta","React"],"mappings":";;;;;;;;;;;;;AAkCO,MAAMA,IAAwD;AAAA,EACpE,CAACC,EAAW,QAAQ,GAAG,EAAE,MAAMC,GAA2B,GAAG,IAAI,GAAG,GAAA;AAAA,EACpE,CAACD,EAAW,OAAO,GAAG,EAAE,MAAME,GAA0B,GAAG,IAAI,GAAG,GAAA;AAAA,EAClE,CAACF,EAAW,WAAW,GAAG,EAAE,MAAMG,GAAyB,GAAG,IAAI,GAAG,GAAA;AAAA,EACrE,CAACH,EAAW,WAAW,GAAG,EAAE,MAAMI,GAAyB,GAAG,IAAI,GAAG,GAAA;AAAA,EACrE,CAACJ,EAAW,IAAI,GAAG,EAAE,MAAMK,GAAkB,GAAG,IAAI,GAAG,GAAA;AAAA,EACvD,CAACL,EAAW,OAAO,GAAG,EAAE,MAAMM,GAAqB,GAAG,IAAI,GAAG,GAAA;AAAA,EAC7D,CAACN,EAAW,WAAW,GAAG,EAAE,MAAMO,GAAyB,GAAG,IAAI,GAAG,GAAA;AAAA,EACrE,CAACP,EAAW,OAAO,GAAG,EAAE,MAAMQ,GAAqB,GAAG,IAAI,GAAG,GAAA;AAAA,EAC7D,CAACR,EAAW,aAAa,GAAG,EAAE,MAAMS,GAAmB,GAAG,IAAI,GAAG,GAAA;AAAA,EACjE,CAACT,EAAW,KAAK,GAAG,EAAE,MAAMU,GAAuB,GAAG,IAAI,GAAG,GAAA;AAC9D,GAOaC,IAAkC;AAAA,EAC9C,MAAMC;AAAAA,EACN,GAAG;AAAA,EACH,GAAG;AACJ,GASaC,IAAa,CACzBC,MAEAA,IACGf,EAAae,CAAoB,KAAKH,IACtC,QAOSI,IAAmB,CAC/BC,GACAC,IAAY,MAEZD,IACGE,EAAM,cAAcF,EAAK,MAAM;AAAA,EAC/B,OAAOA,EAAK,IAAIC;AAAA,EAChB,QAAQD,EAAK,IAAIC;AACjB,CAAC,IACD;"}
1
+ {"version":3,"file":"sourceIcons.js","sources":["../../../../../src/components/agent-builder/utils/sourceIcons.ts"],"sourcesContent":["import {\n\tAftership,\n\tAttentive,\n\tBigCommerce,\n\tEmail,\n\tFreshdesk,\n\tGoogleSheets,\n\tGorgias,\n\tKlavyio,\n\tKustomer,\n\tLinkSimpleHorizontal,\n\tMailchimp,\n\tManifestGlass,\n\tOmniSend,\n\tPuzzlePiece,\n\tSegment,\n\tShipBob,\n\tShipStation,\n\tShopifyBrand,\n\tSkio,\n\tSlackIcon,\n\tWebhook,\n\tZendesk,\n} from '@src/icons';\nimport React from 'react';\nimport { INTEGRATIONS_KEY, ToolSource } from '../constants/tools';\nimport type { IconComp, SourceIcon } from '../constants/tools';\n\n// The icon types live with the source enum (constants/tools) to keep the\n// dependency one-directional (util → constants); re-exported here so existing\n// `from '../utils/sourceIcons'` importers keep resolving them.\nexport type { IconComp, SourceIcon };\n\n/**\n * Per-source brand glyph — shared by the `@` picker and the Tools source\n * buttons. Every glyph comes from the shared icon library (`@src/icons`), so all\n * of them sit on a square 24 viewBox and `w`/`h` is purely optical sizing rather\n * than aspect correction. Partial: not every source has a glyph, and the render\n * path null-guards. Look up with {@link sourceIcon} when the key is a dynamic /\n * unknown string rather than a {@link ToolSource}.\n */\nexport const SOURCE_ICONS: Partial<Record<ToolSource, SourceIcon>> = {\n\t[ToolSource.Manifest]: { Icon: ManifestGlass as IconComp, w: 24, h: 24 },\n\t[ToolSource.Shopify]: { Icon: ShopifyBrand as IconComp, w: 24, h: 24 },\n\t[ToolSource.Bigcommerce]: { Icon: BigCommerce as IconComp, w: 20, h: 20 },\n\t[ToolSource.Shipstation]: { Icon: ShipStation as IconComp, w: 22, h: 22 },\n\t[ToolSource.Skio]: { Icon: Skio as IconComp, w: 20, h: 20 },\n\t[ToolSource.Gorgias]: { Icon: Gorgias as IconComp, w: 20, h: 20 },\n\t[ToolSource.Integration]: { Icon: PuzzlePiece as IconComp, w: 20, h: 20 },\n\t[ToolSource.RestApi]: { Icon: Webhook as IconComp, w: 20, h: 20 },\n\t[ToolSource.EmailHandover]: { Icon: Email as IconComp, w: 20, h: 20 },\n\t[ToolSource.Slack]: { Icon: SlackIcon as IconComp, w: 20, h: 20 },\n\t// Standard-contract vendors — brand glyphs from the shared icon set.\n\t[ToolSource.Aftership]: { Icon: Aftership as IconComp, w: 20, h: 20 },\n\t[ToolSource.Klaviyo]: { Icon: Klavyio as IconComp, w: 20, h: 20 },\n\t[ToolSource.Omnisend]: { Icon: OmniSend as IconComp, w: 20, h: 20 },\n\t[ToolSource.Attentive]: { Icon: Attentive as IconComp, w: 20, h: 20 },\n\t[ToolSource.Mailchimp]: { Icon: Mailchimp as IconComp, w: 20, h: 20 },\n\t[ToolSource.Segment]: { Icon: Segment as IconComp, w: 20, h: 20 },\n\t[ToolSource.Zendesk]: { Icon: Zendesk as IconComp, w: 20, h: 20 },\n\t[ToolSource.Freshdesk]: { Icon: Freshdesk as IconComp, w: 20, h: 20 },\n\t[ToolSource.Kustomer]: { Icon: Kustomer as IconComp, w: 20, h: 20 },\n\t[ToolSource.Shipbob]: { Icon: ShipBob as IconComp, w: 20, h: 20 },\n\t[ToolSource.GoogleSheets]: { Icon: GoogleSheets as IconComp, w: 20, h: 20 },\n};\n\n/**\n * Glyph for the synthetic \"Integrations\" umbrella row — the group that holds\n * every source the store has not connected. Not a real source, so it has no\n * entry in {@link SOURCE_ICONS}; {@link sourceIcon} resolves it by key.\n */\nexport const INTEGRATIONS_ICON: SourceIcon = {\n\tIcon: PuzzlePiece as IconComp,\n\tw: 20,\n\th: 20,\n};\n\n/**\n * Generic glyph for a tool whose source has no dedicated brand icon (any custom\n * / future integration the FE doesn't bundle a logo for). Ensures EVERY tool\n * chip still leads with an icon.\n */\nexport const GENERIC_SOURCE_ICON: SourceIcon = {\n\tIcon: LinkSimpleHorizontal as IconComp,\n\tw: 20,\n\th: 20,\n};\n\n/**\n * Lenient icon lookup for a source that may be a raw/dynamic string (a\n * bik-models tool source, an integration key, or the picker's `'other'`\n * fallback). A known source returns its brand glyph; any other NON-EMPTY source\n * falls back to {@link GENERIC_SOURCE_ICON} so no tool renders iconless. An\n * empty/undefined source (e.g. a sub-agent reference) returns `undefined`.\n */\nexport const sourceIcon = (\n\tsource: string | undefined,\n): SourceIcon | undefined => {\n\tif (!source) {\n\t\treturn undefined;\n\t}\n\tif (source === INTEGRATIONS_KEY) {\n\t\treturn INTEGRATIONS_ICON;\n\t}\n\treturn SOURCE_ICONS[source as ToolSource] ?? GENERIC_SOURCE_ICON;\n};\n\n/**\n * Render a {@link SourceIcon} at its declared box. `sizeDelta` nudges both\n * dimensions (e.g. `-4` for the smaller source-button glyph). Returns `null` when\n * no icon is supplied, so callers can drop their own `icon &&` guard.\n */\nexport const renderSourceIcon = (\n\ticon: SourceIcon | undefined,\n\tsizeDelta = 0,\n): React.ReactElement | null =>\n\ticon\n\t\t? React.createElement(icon.Icon, {\n\t\t\t\twidth: icon.w + sizeDelta,\n\t\t\t\theight: icon.h + sizeDelta,\n\t\t })\n\t\t: null;\n"],"names":["SOURCE_ICONS","ToolSource","ManifestGlass","ShopifyBrand","BigCommerce","ShipStation","Skio","Gorgias","PuzzlePiece","Webhook","Email","SlackIcon","Aftership","Klavyio","OmniSend","Attentive","Mailchimp","Segment","Zendesk","Freshdesk","Kustomer","ShipBob","GoogleSheets","INTEGRATIONS_ICON","GENERIC_SOURCE_ICON","LinkSimpleHorizontal","sourceIcon","source","INTEGRATIONS_KEY","renderSourceIcon","icon","sizeDelta","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyCO,MAAMA,IAAwD;AAAA,EACpE,CAACC,EAAW,QAAQ,GAAG,EAAE,MAAMC,GAA2B,GAAG,IAAI,GAAG,GAAA;AAAA,EACpE,CAACD,EAAW,OAAO,GAAG,EAAE,MAAME,GAA0B,GAAG,IAAI,GAAG,GAAA;AAAA,EAClE,CAACF,EAAW,WAAW,GAAG,EAAE,MAAMG,GAAyB,GAAG,IAAI,GAAG,GAAA;AAAA,EACrE,CAACH,EAAW,WAAW,GAAG,EAAE,MAAMI,GAAyB,GAAG,IAAI,GAAG,GAAA;AAAA,EACrE,CAACJ,EAAW,IAAI,GAAG,EAAE,MAAMK,GAAkB,GAAG,IAAI,GAAG,GAAA;AAAA,EACvD,CAACL,EAAW,OAAO,GAAG,EAAE,MAAMM,GAAqB,GAAG,IAAI,GAAG,GAAA;AAAA,EAC7D,CAACN,EAAW,WAAW,GAAG,EAAE,MAAMO,GAAyB,GAAG,IAAI,GAAG,GAAA;AAAA,EACrE,CAACP,EAAW,OAAO,GAAG,EAAE,MAAMQ,GAAqB,GAAG,IAAI,GAAG,GAAA;AAAA,EAC7D,CAACR,EAAW,aAAa,GAAG,EAAE,MAAMS,GAAmB,GAAG,IAAI,GAAG,GAAA;AAAA,EACjE,CAACT,EAAW,KAAK,GAAG,EAAE,MAAMU,GAAuB,GAAG,IAAI,GAAG,GAAA;AAAA;AAAA,EAE7D,CAACV,EAAW,SAAS,GAAG,EAAE,MAAMW,GAAuB,GAAG,IAAI,GAAG,GAAA;AAAA,E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CAAC,IACD;"}
@@ -2,10 +2,15 @@ import { ConfigToolKey, ParamsBlob } from '../AgentBuilder.model';
2
2
  import { ToolAction, ToolSource } from '../constants/tools';
3
3
  /**
4
4
  * Single source of truth for the built-in tool "action" list (Rest API / email /
5
- * Slack) shown in the `@` picker AND the Step-3 / sub-agent Tools panel. A config
6
- * tool (email / Slack) is offered only when its backend template was provided.
7
- * The category name comes from `TOOL_SOURCE_LABELS`; the addable-action name from
8
- * `TOOL_ACTION_LABELS`. Consumers pass only how to open the drawer (`onSelect`) so
9
- * every surface renders identical actions/labels.
5
+ * Slack / Google Sheets) shown in the `@` picker AND the Step-3 / sub-agent Tools
6
+ * panel. A config tool is offered only when its backend template was provided.
7
+ *
8
+ * A source can offer SEVERAL actions — Google Sheets has one for reading a sheet
9
+ * and one for appending a row — so this yields one action per (source, tool key)
10
+ * and names it from `CONFIG_TOOL_ACTION_LABELS`. Rest API has no tool key: it
11
+ * keeps the source-level name from `TOOL_ACTION_LABELS`.
12
+ *
13
+ * Consumers pass only how to open the drawer (`onSelect`) so every surface
14
+ * renders identical actions/labels.
10
15
  */
11
- export declare const buildToolActions: (configToolTemplates: Partial<Record<ConfigToolKey, ParamsBlob>> | undefined, onSelect: (source: ToolSource) => void, integrationStatus?: Partial<Record<ToolSource, boolean>>, onConnect?: ((source: ToolSource) => void) | undefined) => ToolAction[];
16
+ export declare const buildToolActions: (configToolTemplates: Partial<Record<ConfigToolKey, ParamsBlob>> | undefined, onSelect: (source: ToolSource, toolKey?: ConfigToolKey) => void, integrationStatus?: Partial<Record<ToolSource, boolean>>, onConnect?: ((source: ToolSource) => void) | undefined) => ToolAction[];
@@ -1,19 +1,26 @@
1
- import { TOOL_ACTION_SOURCES as _, TOOL_ACTION_LABELS as l, TOOL_SOURCE_LABELS as L, CONFIG_TOOL_SOURCES as T } from "../constants/tools.js";
2
- import { SOURCE_ICONS as i } from "./sourceIcons.js";
3
- const m = (n, t, S, C) => _.filter((O) => {
4
- const o = T[O];
5
- return !o || !!n?.[o];
6
- }).map((O) => ({
7
- source: O,
8
- label: l[O] ?? L[O],
9
- icon: i[O],
10
- onSelect: () => t(O),
11
- // `undefined` unless the consumer reports this source's connection state,
12
- // in which case `false` makes the picker render a "Connect" row.
13
- connected: S?.[O],
14
- onConnect: () => C?.(O)
15
- }));
1
+ import { TOOL_ACTION_SOURCES as T, TOOL_ACTION_LABELS as o, TOOL_SOURCE_LABELS as a, CONFIG_TOOL_SOURCES as i, CONFIG_TOOL_ACTION_LABELS as A } from "../constants/tools.js";
2
+ import { SOURCE_ICONS as E } from "./sourceIcons.js";
3
+ const f = (L, t, S, l) => T.flatMap((O) => {
4
+ const _ = i[O], C = {
5
+ source: O,
6
+ icon: E[O],
7
+ connected: S?.[O],
8
+ onConnect: () => l?.(O)
9
+ };
10
+ return _ ? _.filter((n) => !!L?.[n]).map((n) => ({
11
+ ...C,
12
+ toolKey: n,
13
+ label: A[n],
14
+ onSelect: () => t(O, n)
15
+ })) : [
16
+ {
17
+ ...C,
18
+ label: o[O] ?? a[O],
19
+ onSelect: () => t(O)
20
+ }
21
+ ];
22
+ });
16
23
  export {
17
- m as buildToolActions
24
+ f as buildToolActions
18
25
  };
19
26
  //# sourceMappingURL=toolActions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolActions.js","sources":["../../../../../src/components/agent-builder/utils/toolActions.ts"],"sourcesContent":["import { ConfigToolKey, ParamsBlob } from '../AgentBuilder.model';\nimport {\n\tCONFIG_TOOL_SOURCES,\n\tTOOL_ACTION_LABELS,\n\tTOOL_ACTION_SOURCES,\n\tTOOL_SOURCE_LABELS,\n\tToolAction,\n\tToolSource,\n} from '../constants/tools';\nimport { SOURCE_ICONS } from './sourceIcons';\n\n/**\n * Single source of truth for the built-in tool \"action\" list (Rest API / email /\n * Slack) shown in the `@` picker AND the Step-3 / sub-agent Tools panel. A config\n * tool (email / Slack) is offered only when its backend template was provided.\n * The category name comes from `TOOL_SOURCE_LABELS`; the addable-action name from\n * `TOOL_ACTION_LABELS`. Consumers pass only how to open the drawer (`onSelect`) so\n * every surface renders identical actions/labels.\n */\nexport const buildToolActions = (\n\tconfigToolTemplates: Partial<Record<ConfigToolKey, ParamsBlob>> | undefined,\n\tonSelect: (source: ToolSource) => void,\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>,\n\tonConnect?: (source: ToolSource) => void,\n): ToolAction[] =>\n\tTOOL_ACTION_SOURCES.filter((source) => {\n\t\tconst toolKey = CONFIG_TOOL_SOURCES[source];\n\t\treturn !toolKey || Boolean(configToolTemplates?.[toolKey]);\n\t}).map((source) => ({\n\t\tsource,\n\t\tlabel: TOOL_ACTION_LABELS[source] ?? TOOL_SOURCE_LABELS[source],\n\t\ticon: SOURCE_ICONS[source],\n\t\tonSelect: () => onSelect(source),\n\t\t// `undefined` unless the consumer reports this source's connection state,\n\t\t// in which case `false` makes the picker render a \"Connect\" row.\n\t\tconnected: integrationStatus?.[source],\n\t\tonConnect: () => onConnect?.(source),\n\t}));\n"],"names":["buildToolActions","configToolTemplates","onSelect","integrationStatus","onConnect","TOOL_ACTION_SOURCES","source","toolKey","CONFIG_TOOL_SOURCES","TOOL_ACTION_LABELS","TOOL_SOURCE_LABELS","SOURCE_ICONS"],"mappings":";;AAmBO,MAAMA,IAAmB,CAC/BC,GACAC,GACAC,GACAC,MAEAC,EAAoB,OAAO,CAACC,MAAW;AACtC,QAAMC,IAAUC,EAAoBF,CAAM;AAC1C,SAAO,CAACC,KAAW,EAAQN,IAAsBM,CAAO;AACzD,CAAC,EAAE,IAAI,CAACD,OAAY;AAAA,EACnB,QAAAA;AAAA,EACA,OAAOG,EAAmBH,CAAM,KAAKI,EAAmBJ,CAAM;AAAA,EAC9D,MAAMK,EAAaL,CAAM;AAAA,EACzB,UAAU,MAAMJ,EAASI,CAAM;AAAA;AAAA;AAAA,EAG/B,WAAWH,IAAoBG,CAAM;AAAA,EACrC,WAAW,MAAMF,IAAYE,CAAM;AACpC,EAAE;"}
1
+ {"version":3,"file":"toolActions.js","sources":["../../../../../src/components/agent-builder/utils/toolActions.ts"],"sourcesContent":["import { ConfigToolKey, ParamsBlob } from '../AgentBuilder.model';\nimport {\n\tCONFIG_TOOL_ACTION_LABELS,\n\tCONFIG_TOOL_SOURCES,\n\tTOOL_ACTION_LABELS,\n\tTOOL_ACTION_SOURCES,\n\tTOOL_SOURCE_LABELS,\n\tToolAction,\n\tToolSource,\n} from '../constants/tools';\nimport { SOURCE_ICONS } from './sourceIcons';\n\n/**\n * Single source of truth for the built-in tool \"action\" list (Rest API / email /\n * Slack / Google Sheets) shown in the `@` picker AND the Step-3 / sub-agent Tools\n * panel. A config tool is offered only when its backend template was provided.\n *\n * A source can offer SEVERAL actions — Google Sheets has one for reading a sheet\n * and one for appending a row — so this yields one action per (source, tool key)\n * and names it from `CONFIG_TOOL_ACTION_LABELS`. Rest API has no tool key: it\n * keeps the source-level name from `TOOL_ACTION_LABELS`.\n *\n * Consumers pass only how to open the drawer (`onSelect`) so every surface\n * renders identical actions/labels.\n */\nexport const buildToolActions = (\n\tconfigToolTemplates: Partial<Record<ConfigToolKey, ParamsBlob>> | undefined,\n\tonSelect: (source: ToolSource, toolKey?: ConfigToolKey) => void,\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>,\n\tonConnect?: (source: ToolSource) => void,\n): ToolAction[] =>\n\tTOOL_ACTION_SOURCES.flatMap((source) => {\n\t\tconst toolKeys = CONFIG_TOOL_SOURCES[source];\n\t\t// `undefined` unless the consumer reports this source's connection state,\n\t\t// in which case `false` makes the picker render a \"Connect\" row.\n\t\tconst shared = {\n\t\t\tsource,\n\t\t\ticon: SOURCE_ICONS[source],\n\t\t\tconnected: integrationStatus?.[source],\n\t\t\tonConnect: () => onConnect?.(source),\n\t\t};\n\t\tif (!toolKeys) {\n\t\t\t// Rest API: one bespoke panel, no backend template to wait for.\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\t...shared,\n\t\t\t\t\tlabel: TOOL_ACTION_LABELS[source] ?? TOOL_SOURCE_LABELS[source],\n\t\t\t\t\tonSelect: () => onSelect(source),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\treturn toolKeys\n\t\t\t.filter((toolKey) => Boolean(configToolTemplates?.[toolKey]))\n\t\t\t.map((toolKey) => ({\n\t\t\t\t...shared,\n\t\t\t\ttoolKey,\n\t\t\t\tlabel: CONFIG_TOOL_ACTION_LABELS[toolKey],\n\t\t\t\tonSelect: () => onSelect(source, toolKey),\n\t\t\t}));\n\t});\n"],"names":["buildToolActions","configToolTemplates","onSelect","integrationStatus","onConnect","TOOL_ACTION_SOURCES","source","toolKeys","CONFIG_TOOL_SOURCES","shared","SOURCE_ICONS","toolKey","CONFIG_TOOL_ACTION_LABELS","TOOL_ACTION_LABELS","TOOL_SOURCE_LABELS"],"mappings":";;AAyBO,MAAMA,IAAmB,CAC/BC,GACAC,GACAC,GACAC,MAEAC,EAAoB,QAAQ,CAACC,MAAW;AACvC,QAAMC,IAAWC,EAAoBF,CAAM,GAGrCG,IAAS;AAAA,IACd,QAAAH;AAAA,IACA,MAAMI,EAAaJ,CAAM;AAAA,IACzB,WAAWH,IAAoBG,CAAM;AAAA,IACrC,WAAW,MAAMF,IAAYE,CAAM;AAAA,EAAA;AAEpC,SAAKC,IAUEA,EACL,OAAO,CAACI,MAAY,EAAQV,IAAsBU,CAAO,CAAE,EAC3D,IAAI,CAACA,OAAa;AAAA,IAClB,GAAGF;AAAA,IACH,SAAAE;AAAA,IACA,OAAOC,EAA0BD,CAAO;AAAA,IACxC,UAAU,MAAMT,EAASI,GAAQK,CAAO;AAAA,EAAA,EACvC,IAfK;AAAA,IACN;AAAA,MACC,GAAGF;AAAA,MACH,OAAOI,EAAmBP,CAAM,KAAKQ,EAAmBR,CAAM;AAAA,MAC9D,UAAU,MAAMJ,EAASI,CAAM;AAAA,IAAA;AAAA,EAChC;AAWH,CAAC;"}
@@ -0,0 +1,6 @@
1
+ import { SVGProps } from 'react';
2
+ interface Props extends SVGProps<SVGSVGElement> {
3
+ size?: number | string;
4
+ }
5
+ declare const SvgAftership: ({ size, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export default SvgAftership;