@bikdotai/bik-component-library 0.0.853 → 0.0.855

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 (110) hide show
  1. package/dist/cjs/components/add-variableV2/AddDataPill.js +10 -0
  2. package/dist/cjs/components/add-variableV2/AddDataPill.js.map +1 -0
  3. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  4. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +11 -11
  6. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
  8. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/MentionEditor.js +7 -1
  10. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
  12. package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/MentionPicker.js +41 -14
  14. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +6 -5
  16. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +2 -2
  18. package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/components/VariableInlineField.js +65 -0
  20. package/dist/cjs/components/agent-builder/components/VariableInlineField.js.map +1 -0
  21. package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js +10 -0
  22. package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js.map +1 -0
  23. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  24. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  25. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  26. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  27. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  28. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  29. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +4 -4
  30. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  31. package/dist/cjs/components/toaster/Toaster.js +1 -1
  32. package/dist/cjs/components/toaster/Toaster.js.map +1 -1
  33. package/dist/cjs/components/toaster/Toaster.styled.js +7 -7
  34. package/dist/cjs/components/toaster/Toaster.styled.js.map +1 -1
  35. package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
  36. package/dist/cjs/components/variable-picker-v3/Content.js.map +1 -1
  37. package/dist/cjs/editor/BikEditor.js +1 -1
  38. package/dist/cjs/editor/BikEditor.js.map +1 -1
  39. package/dist/cjs/editor/BikEditor.styles.js +8 -0
  40. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  41. package/dist/cjs/editor/BikEditor.types.js.map +1 -1
  42. package/dist/cjs/editor/extensions/mention/MentionDropdown.js +1 -1
  43. package/dist/cjs/editor/extensions/mention/MentionDropdown.js.map +1 -1
  44. package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
  45. package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
  46. package/dist/cjs/index.js +1 -1
  47. package/dist/esm/components/add-variableV2/AddDataPill.d.ts +24 -0
  48. package/dist/esm/components/add-variableV2/AddDataPill.js +33 -0
  49. package/dist/esm/components/add-variableV2/AddDataPill.js.map +1 -0
  50. package/dist/esm/components/add-variableV2/index.d.ts +1 -0
  51. package/dist/esm/components/agent-builder/AgentBuilder.js +76 -74
  52. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  53. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +8 -0
  54. package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +8 -0
  55. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +182 -136
  56. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  57. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +3 -0
  58. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +195 -188
  59. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  60. package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +12 -0
  61. package/dist/esm/components/agent-builder/components/MentionEditor.js +144 -103
  62. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  63. package/dist/esm/components/agent-builder/components/MentionField.js +48 -45
  64. package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
  65. package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +14 -1
  66. package/dist/esm/components/agent-builder/components/MentionPicker.js +286 -218
  67. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  68. package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +8 -0
  69. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +192 -176
  70. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  71. package/dist/esm/components/agent-builder/components/ToolInstructionsField.d.ts +9 -0
  72. package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +67 -48
  73. package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
  74. package/dist/esm/components/agent-builder/components/VariableInlineField.d.ts +26 -0
  75. package/dist/esm/components/agent-builder/components/VariableInlineField.js +149 -0
  76. package/dist/esm/components/agent-builder/components/VariableInlineField.js.map +1 -0
  77. package/dist/esm/components/agent-builder/components/VariableTriggerArea.d.ts +46 -0
  78. package/dist/esm/components/agent-builder/components/VariableTriggerArea.js +118 -0
  79. package/dist/esm/components/agent-builder/components/VariableTriggerArea.js.map +1 -0
  80. package/dist/esm/components/agent-builder/constants/tools.d.ts +1 -1
  81. package/dist/esm/components/agent-builder/constants/tools.js +14 -13
  82. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  83. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +7 -0
  84. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +99 -96
  85. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  86. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +164 -160
  87. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  88. package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +14 -4
  89. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +54 -36
  90. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  91. package/dist/esm/components/toaster/Toaster.js +30 -25
  92. package/dist/esm/components/toaster/Toaster.js.map +1 -1
  93. package/dist/esm/components/toaster/Toaster.styled.js +5 -5
  94. package/dist/esm/components/toaster/Toaster.styled.js.map +1 -1
  95. package/dist/esm/components/variable-picker-v3/Content.js +16 -15
  96. package/dist/esm/components/variable-picker-v3/Content.js.map +1 -1
  97. package/dist/esm/editor/BikEditor.js +40 -34
  98. package/dist/esm/editor/BikEditor.js.map +1 -1
  99. package/dist/esm/editor/BikEditor.styles.js +20 -12
  100. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  101. package/dist/esm/editor/BikEditor.types.d.ts +9 -0
  102. package/dist/esm/editor/BikEditor.types.js.map +1 -1
  103. package/dist/esm/editor/extensions/mention/MentionDropdown.js +28 -28
  104. package/dist/esm/editor/extensions/mention/MentionDropdown.js.map +1 -1
  105. package/dist/esm/editor/extensions/mention/MentionExtension.js +23 -19
  106. package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
  107. package/dist/esm/icons/index.d.ts +25 -25
  108. package/dist/esm/index.js +543 -541
  109. package/dist/esm/index.js.map +1 -1
  110. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n\tStepScroll,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport { UndoToast } from './components/UndoToast';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tonConnectIntegration,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// True while onTestAgent's async work (e.g. save-as-draft before the test\n\t// modal opens) is in flight — loads + disables the Test agent button.\n\tconst [testingLocal, setTestingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tsetShowLeaveConfirm(false);\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(async () => {\n\t\tlogAction('onTestAgent');\n\t\tconst result = onTestAgent?.();\n\t\t// A new agent saves as draft before the test modal opens — that's slow, so\n\t\t// disable + load the button until it settles (prevents double-triggering).\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetTestingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetTestingLocal(false);\n\t\t\t}\n\t\t}\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\tconst handleCreateSubAgent = useCallback(\n\t\t(draft: SubAgentDraft) => {\n\t\t\tlogAction('onCreateSubAgent', draft);\n\t\t\treturn onCreateSubAgent\n\t\t\t\t? onCreateSubAgent(draft)\n\t\t\t\t: Promise.reject(new Error('onCreateSubAgent not provided'));\n\t\t},\n\t\t[logAction, onCreateSubAgent],\n\t);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tcharLimits={charLimits}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? handleCreateSubAgent : undefined}\n\t\t\tonFetchSubAgent={onFetchSubAgent}\n\t\t\tonUpdateSubAgent={onUpdateSubAgent}\n\t\t\tonImproveSubAgent={onImproveSubAgent}\n\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tisTesting={testingLocal}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\tconst wasSuccess = modalMode === 'success';\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\tif (wasSuccess) {\n\t\t\t\t\t\t\thandleGoToDashboard();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tdisableSaveDraft={!value.name.trim()}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<UndoToast />\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","onConnectIntegration","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","validation","applicationType","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","testingLocal","setTestingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepScroll","AgentBuilderFooter","GoLiveModal","wasSuccess","DiscardModal","UndoToast"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAwB,MAAM;AACnC,QAAM,EAAE,YAAAC,EAAA,IAAeC,GAAA;AACvB,UAAQD,GAAA;AAAA,IACP,KAAK;AACJ,+BAAQE,IAAA,EAAW;AAAA,IACpB,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B;AACC,aAAO;AAAA,EAAA;AAEV,GAiBaC,KAA4C,CAACC,MAAU;AACnE,QAAM;AAAA,IACL,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACAhB,GACE;AAAA,IACL,OAAAiB;AAAA,IACA,YAAAxB;AAAA,IACA,gBAAAyB;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC,IAAmB,CAAA;AAAA,IACnB,iBAAAC,IAAkB,CAAA;AAAA,IAClB,qBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,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EACA,UAAA;AAAA,YAAA,gBAAAV,EAACW,IAAA,EACA,UAAA,gBAAAX,EAACvE,IAAA,CAAA,CAAY,GACd;AAAA,YACA,gBAAAuE;AAAA,cAACY;AAAA,cAAA;AAAA,gBACA,YAAA7C;AAAA,gBACA,aAAatB,IAAckD,KAAkB;AAAA,gBAC7C,WAAWpB;AAAA,gBACX,UAAU,MAAM;AACf,kBAAAM,EAAU,UAAU,GACpBV,EAAa,SAAS;AAAA,gBACvB;AAAA,gBACA,cAAcN,KAAgBQ;AAAA,cAAA;AAAA,YAAA;AAAA,UAC/B,EAAA,CACD,EAAA,CAEF;AAAA,QAAA,GACD;AAAA,QAEA,gBAAA2B;AAAA,UAACa;AAAA,UAAA;AAAA,YACA,MAAM3C;AAAA,YACN,SAAS,MAAM;AACd,oBAAM4C,IAAa5C,MAAc;AACjC,cAAAC,EAAa,IAAI,GACb2C,KACHlB,EAAA;AAAA,YAEF;AAAA,YACA,WAAWG;AAAA,YACX,aAAa,MAAM;AAClB,cAAA5B,EAAa,IAAI,GACjBkB,GAAA;AAAA,YACD;AAAA,YACA,iBAAiB3C,IAAkBkD,IAAsB;AAAA,YACzD,cAAc/B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAA2B;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,MAAMtC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWc;AAAA,YACX,aAAaC;AAAA,YACb,kBAAkB,CAACvC,EAAM,KAAK,KAAA;AAAA,YAC9B,UAAUU,KAAYe;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBqC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEAhF,GAAa,cAAc;"}
1
+ {"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n\tStepScroll,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport { UndoToast } from './components/UndoToast';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tonConnectIntegration,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tvariablesData,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// True while onTestAgent's async work (e.g. save-as-draft before the test\n\t// modal opens) is in flight — loads + disables the Test agent button.\n\tconst [testingLocal, setTestingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tsetShowLeaveConfirm(false);\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(async () => {\n\t\tlogAction('onTestAgent');\n\t\tconst result = onTestAgent?.();\n\t\t// A new agent saves as draft before the test modal opens — that's slow, so\n\t\t// disable + load the button until it settles (prevents double-triggering).\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetTestingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetTestingLocal(false);\n\t\t\t}\n\t\t}\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\tconst handleCreateSubAgent = useCallback(\n\t\t(draft: SubAgentDraft) => {\n\t\t\tlogAction('onCreateSubAgent', draft);\n\t\t\treturn onCreateSubAgent\n\t\t\t\t? onCreateSubAgent(draft)\n\t\t\t\t: Promise.reject(new Error('onCreateSubAgent not provided'));\n\t\t},\n\t\t[logAction, onCreateSubAgent],\n\t);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvariablesData={variablesData}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tcharLimits={charLimits}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? handleCreateSubAgent : undefined}\n\t\t\tonFetchSubAgent={onFetchSubAgent}\n\t\t\tonUpdateSubAgent={onUpdateSubAgent}\n\t\t\tonImproveSubAgent={onImproveSubAgent}\n\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tisTesting={testingLocal}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\tconst wasSuccess = modalMode === 'success';\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\tif (wasSuccess) {\n\t\t\t\t\t\t\thandleGoToDashboard();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tdisableSaveDraft={!value.name.trim()}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<UndoToast />\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","onConnectIntegration","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","variablesData","validation","applicationType","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","testingLocal","setTestingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepScroll","AgentBuilderFooter","GoLiveModal","wasSuccess","DiscardModal","UndoToast"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAwB,MAAM;AACnC,QAAM,EAAE,YAAAC,EAAA,IAAeC,GAAA;AACvB,UAAQD,GAAA;AAAA,IACP,KAAK;AACJ,+BAAQE,IAAA,EAAW;AAAA,IACpB,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B;AACC,aAAO;AAAA,EAAA;AAEV,GAiBaC,KAA4C,CAACC,MAAU;AACnE,QAAM;AAAA,IACL,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACAhB,GACE;AAAA,IACL,OAAAiB;AAAA,IACA,YAAAxB;AAAA,IACA,gBAAAyB;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC,IAAmB,CAAA;AAAA,IACnB,iBAAAC,IAAkB,CAAA;AAAA,IAClB,qBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,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,EACA,UAAA;AAAA,YAAA,gBAAAV,EAACW,IAAA,EACA,UAAA,gBAAAX,EAACxE,IAAA,CAAA,CAAY,GACd;AAAA,YACA,gBAAAwE;AAAA,cAACY;AAAA,cAAA;AAAA,gBACA,YAAA7C;AAAA,gBACA,aAAavB,IAAcmD,KAAkB;AAAA,gBAC7C,WAAWpB;AAAA,gBACX,UAAU,MAAM;AACf,kBAAAM,EAAU,UAAU,GACpBV,EAAa,SAAS;AAAA,gBACvB;AAAA,gBACA,cAAcN,KAAgBQ;AAAA,cAAA;AAAA,YAAA;AAAA,UAC/B,EAAA,CACD,EAAA,CAEF;AAAA,QAAA,GACD;AAAA,QAEA,gBAAA2B;AAAA,UAACa;AAAA,UAAA;AAAA,YACA,MAAM3C;AAAA,YACN,SAAS,MAAM;AACd,oBAAM4C,IAAa5C,MAAc;AACjC,cAAAC,EAAa,IAAI,GACb2C,KACHlB,EAAA;AAAA,YAEF;AAAA,YACA,WAAWG;AAAA,YACX,aAAa,MAAM;AAClB,cAAA5B,EAAa,IAAI,GACjBkB,GAAA;AAAA,YACD;AAAA,YACA,iBAAiB5C,IAAkBmD,IAAsB;AAAA,YACzD,cAAc/B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAA2B;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,MAAMtC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWc;AAAA,YACX,aAAaC;AAAA,YACb,kBAAkB,CAACxC,EAAM,KAAK,KAAA;AAAA,YAC9B,UAAUW,KAAYe;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBqC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEAjF,GAAa,cAAc;"}
@@ -1,5 +1,6 @@
1
1
  import { AgentConfig, AgentHandoverConfig, AgentToolDoc, IntentOption, ModelOption, StepKey, StepValidation, SubAgentRef, Trigger } from '@bikdotai/bik-models/ai-agents';
2
2
  import { ApplicationType } from '@bikdotai/bik-models/growth';
3
+ import { VariableListInterfaceV3 } from '../variable-picker-v3/model';
3
4
  import { AgentCharLimits } from './constants/charLimits';
4
5
  import { ConfigToolKey, ToolSource } from './constants/tools';
5
6
  /**
@@ -232,6 +233,13 @@ export interface AgentBuilderConfig {
232
233
  * {@link AgentBuilderProps.onConnectIntegration}.
233
234
  */
234
235
  integrationStatus?: Partial<Record<ToolSource, boolean>>;
236
+ /**
237
+ * Variable catalog for the `@` picker's "Variables" view (the shared
238
+ * VariablePicker's `data` shape). Picking a variable inserts its
239
+ * `{{actualValue}}` token into the instructions / guardrails at the cursor.
240
+ * Omit (or pass empty) to hide the Variables category entirely.
241
+ */
242
+ variablesData?: VariableListInterfaceV3[];
235
243
  /** Host application context the merchant runs in (e.g. ApplicationType.MANIFEST). */
236
244
  applicationType?: ApplicationType;
237
245
  /** Optional consumer-supplied validity; merged over the builder's derived validity. */
@@ -1,4 +1,5 @@
1
1
  import { default as React } from 'react';
2
+ import { VariableListInterfaceV3 } from '../../variable-picker-v3/model';
2
3
  import { ConfigToolConfig, ConfigToolKey, ParamsBlob } from '../AgentBuilder.model';
3
4
  import { AgentCharLimits } from '../constants/charLimits';
4
5
  interface ConfigToolPanelProps {
@@ -18,6 +19,13 @@ interface ConfigToolPanelProps {
18
19
  /** Optional "Improve with AI" for multiline fields. Omit to hide it. */
19
20
  onImprove?: (text: string) => Promise<string>;
20
21
  charLimits?: AgentCharLimits;
22
+ /**
23
+ * Variable catalog for the `@` trigger. When non-empty, `@` in the email
24
+ * tool's Subject / Send To / Reply To / CC opens the variable picker
25
+ * directly, and Message Instructions upgrades to the variables-only mention
26
+ * editor. Absent → the drawer behaves exactly as before.
27
+ */
28
+ variablesData?: VariableListInterfaceV3[];
21
29
  /** SideModal stacking order — raise it when opened over another drawer. */
22
30
  zIndex?: number;
23
31
  }
@@ -1,18 +1,19 @@
1
- import { jsx as r, jsxs as k } from "react/jsx-runtime";
2
- import $ from "../../../assets/icons/cross.svg.js";
3
- import { useState as w } from "react";
4
- import u from "styled-components";
5
- import { TitleSmall as C, BodyCaption as E } from "../../TypographyStyle.js";
6
- import { COLORS as i } from "../../../constants/Theme.js";
7
- import { FieldBlock as D } from "../AgentBuilder.styled.js";
8
- import { AGENT_CHAR_LIMITS as O } from "../constants/charLimits.js";
9
- import { DRAWER_BODY_STYLE as R, DRAWER_HEADER_STYLE as L, DrawerHeaderText as A } from "./DrawerHeaderText.js";
10
- import { ToolInstructionsField as j } from "./ToolInstructionsField.js";
11
- import { SideModal as P } from "../../side-modal/SideModal.js";
12
- import { Switch as Y } from "../../switch/Switch.js";
13
- import { Input as F } from "../../input/Input.js";
14
- import { Tag as z } from "../../tag/Tag.js";
15
- const V = {
1
+ import { jsx as r, jsxs as I } from "react/jsx-runtime";
2
+ import L from "../../../assets/icons/cross.svg.js";
3
+ import j, { useState as R, useRef as T } from "react";
4
+ import w from "styled-components";
5
+ import { TitleSmall as O, BodyCaption as F } from "../../TypographyStyle.js";
6
+ import { COLORS as u } from "../../../constants/Theme.js";
7
+ import { FieldBlock as P } from "../AgentBuilder.styled.js";
8
+ import { AGENT_CHAR_LIMITS as Y } from "../constants/charLimits.js";
9
+ import { DRAWER_BODY_STYLE as V, DRAWER_HEADER_STYLE as z, DrawerHeaderText as M } from "./DrawerHeaderText.js";
10
+ import { ToolInstructionsField as H } from "./ToolInstructionsField.js";
11
+ import { VariableTriggerArea as A } from "./VariableTriggerArea.js";
12
+ import { SideModal as W } from "../../side-modal/SideModal.js";
13
+ import { Switch as q } from "../../switch/Switch.js";
14
+ import { Input as G } from "../../input/Input.js";
15
+ import { Tag as N } from "../../tag/Tag.js";
16
+ const J = {
16
17
  send_email: {
17
18
  title: "Send email",
18
19
  subtitle: "Notify someone by email when this agent can't continue. You pick the recipient, the AI drafts the message."
@@ -21,222 +22,267 @@ const V = {
21
22
  title: "Send Slack message",
22
23
  subtitle: "Post a message to a Slack channel. You pick the channel, the AI composes the message from the conversation."
23
24
  }
24
- }, H = ({
25
+ }, K = ({
25
26
  chips: n,
26
- onChange: a,
27
- placeholder: c,
28
- nativeID: p,
29
- hint: d
27
+ onChange: s,
28
+ placeholder: h,
29
+ nativeID: y,
30
+ hint: C,
31
+ variablesData: E
30
32
  }) => {
31
- const [m, h] = w(""), y = () => {
32
- const e = m.split(",").map((s) => s.trim()).filter(Boolean);
33
- e.length && a([...n, ...e.filter((s) => !n.includes(s))]), h("");
34
- };
35
- return /* @__PURE__ */ k(G, { children: [
33
+ const [i, g] = R(""), [$, a] = R(!1), v = T(null), S = T(null), x = () => {
34
+ const t = i.split(",").map((c) => c.trim()).filter(Boolean);
35
+ t.length && s([...n, ...t.filter((c) => !n.includes(c))]), g("");
36
+ }, f = T(x);
37
+ f.current = x;
38
+ const b = T(!1), l = T(!1);
39
+ return /* @__PURE__ */ I(X, { ref: v, children: [
36
40
  /* @__PURE__ */ r(
37
- N,
41
+ A,
38
42
  {
39
- id: p,
40
- type: "text",
41
- placeholder: c,
42
- value: m,
43
- onChange: (e) => h(e.target.value),
44
- onBlur: y,
45
- onKeyDown: (e) => {
46
- e.key === "Enter" || e.key === "," ? (e.preventDefault(), y()) : e.key === "Backspace" && m === "" && n.length > 0 && a(n.slice(0, -1));
47
- }
43
+ addDataButton: !0,
44
+ variablesData: E,
45
+ onOpenChange: (t) => {
46
+ b.current = t, !t && setTimeout(() => {
47
+ !l.current && !v.current?.contains(document.activeElement) && f.current(), l.current = !1;
48
+ }, 0);
49
+ },
50
+ onInsert: (t, c) => {
51
+ l.current = !0;
52
+ const k = c ?? i.length;
53
+ g(`${i.slice(0, k)}${t}${i.slice(k)}`), requestAnimationFrame(() => {
54
+ const p = S.current;
55
+ p?.focus(), p?.setSelectionRange(k + t.length, k + t.length);
56
+ });
57
+ },
58
+ children: /* @__PURE__ */ r(
59
+ Z,
60
+ {
61
+ id: y,
62
+ ref: S,
63
+ type: "text",
64
+ placeholder: $ && i === "" && (E?.length ?? 0) > 0 ? "Enter text, type @ to add variable" : h,
65
+ value: i,
66
+ onChange: (t) => g(t.target.value),
67
+ onFocus: () => a(!0),
68
+ onBlur: () => {
69
+ a(!1), setTimeout(() => {
70
+ !b.current && !v.current?.contains(document.activeElement) && f.current();
71
+ }, 0);
72
+ },
73
+ onKeyDown: (t) => {
74
+ t.key === "Enter" || t.key === "," ? (t.preventDefault(), x()) : t.key === "Backspace" && i === "" && n.length > 0 && s(n.slice(0, -1));
75
+ }
76
+ }
77
+ )
48
78
  }
49
79
  ),
50
- d,
51
- n.length > 0 && /* @__PURE__ */ r(q, { children: n.map((e, s) => /* @__PURE__ */ r(
52
- z,
80
+ C,
81
+ n.length > 0 && /* @__PURE__ */ r(ee, { children: n.map((t, c) => /* @__PURE__ */ r(
82
+ N,
53
83
  {
54
- tagText: e,
84
+ tagText: t.replace(/\{\{variable:([^}]+)\}\}/g, "{{$1}}"),
55
85
  theme: "light",
56
86
  type: "neutral",
57
87
  variant: "regular",
58
- TrailingIcon: $,
59
- onTrailingIconClicked: () => a(n.filter((x, g) => g !== s))
88
+ TrailingIcon: L,
89
+ onTrailingIconClicked: () => s(n.filter((k, p) => p !== c))
60
90
  },
61
- `${e}-${s}`
91
+ `${t}-${c}`
62
92
  )) })
63
93
  ] });
64
- }, M = (n, a) => {
65
- const c = {};
66
- return Object.keys(n).forEach((p) => {
67
- c[p] = a?.params[p]?.value ?? n[p].value;
68
- }), c;
69
- }, W = (n) => String(n ?? "").split(",").map((a) => a.trim()).filter(Boolean), pt = ({
94
+ }, Q = (n, s) => {
95
+ const h = {};
96
+ return Object.keys(n).forEach((y) => {
97
+ h[y] = s?.params[y]?.value ?? n[y].value;
98
+ }), h;
99
+ }, U = (n) => String(n ?? "").split(",").map((s) => s.trim()).filter(Boolean), ke = ({
70
100
  toolKey: n,
71
- template: a,
72
- onClose: c,
73
- onSave: p,
74
- initial: d,
75
- onImprove: m,
76
- charLimits: h = O,
77
- zIndex: y
101
+ template: s,
102
+ onClose: h,
103
+ onSave: y,
104
+ initial: C,
105
+ onImprove: E,
106
+ charLimits: i = Y,
107
+ variablesData: g,
108
+ zIndex: $
78
109
  }) => {
79
- const [e, s] = w(
80
- () => M(a, d)
81
- ), [x, g] = w(!1), v = Object.values(a), B = n === "send_email", f = (t, l) => s((o) => ({ ...o, [t]: l })), T = v.every(
82
- (t) => !t.required || String(e[t.key] ?? "").trim() !== ""
83
- ), I = async () => {
84
- if (!T || x)
110
+ const [a, v] = R(
111
+ () => Q(s, C)
112
+ ), [S, x] = R(!1), f = Object.values(s), b = n === "send_email", l = (e, m) => v((d) => ({ ...d, [e]: m })), t = f.every((e) => !(e.required && String(a[e.key] ?? "").trim() === "" || e.component === "MultilineInput" && String(a[e.key] ?? "").length > i.instructions)), c = async () => {
113
+ if (!t || S)
85
114
  return;
86
- const t = {};
87
- v.forEach((S) => {
88
- t[S.key] = { ...S, value: e[S.key] };
115
+ const e = {};
116
+ f.forEach((o) => {
117
+ e[o.key] = { ...o, value: a[o.key] };
89
118
  });
90
- const l = {
91
- id: d?.id ?? `${n}_${Date.now().toString(36)}`,
119
+ const m = {
120
+ id: C?.id ?? `${n}_${Date.now().toString(36)}`,
92
121
  tool_key: n,
93
- params: t
94
- }, o = p(l);
95
- if (o && typeof o.then == "function") {
96
- g(!0);
122
+ params: e
123
+ }, d = y(m);
124
+ if (d && typeof d.then == "function") {
125
+ x(!0);
97
126
  try {
98
- await o;
127
+ await d;
99
128
  } finally {
100
- g(!1);
129
+ x(!1);
101
130
  }
102
131
  }
103
- }, _ = (t) => {
104
- const l = `config-tool-${t.key.toLowerCase()}`;
105
- switch (t.component) {
132
+ }, k = (e) => {
133
+ const m = `config-tool-${e.key.toLowerCase()}`;
134
+ switch (e.component) {
106
135
  // Multi-value email chips — only for the email tool. Slack's KeywordInput
107
136
  // (channelId) falls through to the plain input below.
108
137
  case "KeywordInput":
109
- if (!B)
138
+ if (!b)
110
139
  break;
111
- return /* @__PURE__ */ k(D, { children: [
112
- /* @__PURE__ */ r(C, { color: i.content.primary, children: t.title }),
140
+ return /* @__PURE__ */ I(P, { children: [
141
+ /* @__PURE__ */ r(O, { color: u.content.primary, children: e.title }),
113
142
  /* @__PURE__ */ r(
114
- H,
143
+ K,
115
144
  {
116
- nativeID: l,
117
- placeholder: t.hint ?? "",
118
- chips: W(e[t.key]),
119
- onChange: (o) => f(t.key, o.join(",")),
120
- hint: /* @__PURE__ */ r(E, { color: i.content.secondary, children: "Press Enter or comma to add multiple emails" })
145
+ nativeID: m,
146
+ placeholder: e.hint ?? "",
147
+ chips: U(a[e.key]),
148
+ onChange: (o) => l(e.key, o.join(",")),
149
+ variablesData: g,
150
+ hint: /* @__PURE__ */ r(F, { color: u.content.secondary, children: "Press Enter or comma to add multiple emails" })
121
151
  }
122
152
  )
123
- ] }, t.key);
153
+ ] }, e.key);
124
154
  case "MultilineInput":
125
155
  return /* @__PURE__ */ r(
126
- j,
156
+ H,
127
157
  {
128
- "data-test": l,
129
- label: t.title,
130
- value: String(e[t.key] ?? ""),
131
- onChange: (o) => f(t.key, o),
132
- maxLength: h.instructions,
133
- placeholder: t.hint ?? "",
134
- onImprove: m
158
+ "data-test": m,
159
+ label: e.title,
160
+ value: String(a[e.key] ?? ""),
161
+ onChange: (o) => l(e.key, o),
162
+ maxLength: i.instructions,
163
+ placeholder: e.hint ?? "",
164
+ onImprove: E,
165
+ variablesData: g
135
166
  },
136
- t.key
167
+ e.key
137
168
  );
138
169
  case "Switch":
139
- return /* @__PURE__ */ k(J, { children: [
140
- /* @__PURE__ */ k(K, { children: [
141
- /* @__PURE__ */ r(C, { color: i.content.primary, children: t.title }),
142
- t.hint && /* @__PURE__ */ r(E, { color: i.content.secondary, children: t.hint })
170
+ return /* @__PURE__ */ I(te, { children: [
171
+ /* @__PURE__ */ I(ne, { children: [
172
+ /* @__PURE__ */ r(O, { color: u.content.primary, children: e.title }),
173
+ e.hint && /* @__PURE__ */ r(F, { color: u.content.secondary, children: e.hint })
143
174
  ] }),
144
175
  /* @__PURE__ */ r(
145
- Y,
176
+ q,
146
177
  {
147
- "data-test": l,
148
- value: !!e[t.key],
149
- onValueChange: async (o) => f(t.key, o)
178
+ "data-test": m,
179
+ value: !!a[e.key],
180
+ onValueChange: async (o) => l(e.key, o)
150
181
  }
151
182
  )
152
- ] }, t.key);
183
+ ] }, e.key);
153
184
  }
154
- return /* @__PURE__ */ r(
155
- F,
185
+ const d = /* @__PURE__ */ r(
186
+ G,
156
187
  {
157
- "data-test": l,
188
+ "data-test": m,
158
189
  variant: "small",
159
- labelText: t.title,
190
+ labelText: e.title,
160
191
  labelTextBold: !0,
161
- placeholder: t.hint ?? "",
162
- value: String(e[t.key] ?? ""),
163
- onChangeText: (o) => f(t.key, o)
164
- },
165
- t.key
192
+ placeholder: e.hint ?? "",
193
+ value: String(a[e.key] ?? ""),
194
+ onChangeText: (o) => l(e.key, o)
195
+ }
166
196
  );
167
- }, b = V[n];
197
+ return b ? /* @__PURE__ */ r(
198
+ A,
199
+ {
200
+ addDataButton: !0,
201
+ variablesData: g,
202
+ onInsert: (o, D) => {
203
+ const B = String(a[e.key] ?? ""), _ = D ?? B.length;
204
+ l(
205
+ e.key,
206
+ `${B.slice(0, _)}${o}${B.slice(_)}`
207
+ );
208
+ },
209
+ children: d
210
+ },
211
+ e.key
212
+ ) : /* @__PURE__ */ r(j.Fragment, { children: d }, e.key);
213
+ }, p = J[n];
168
214
  return /* @__PURE__ */ r(
169
- P,
215
+ W,
170
216
  {
171
- header: b.title,
217
+ header: p.title,
172
218
  closeOnEscapeKey: !1,
173
- zIndex: y,
174
- headerCustomComponent: /* @__PURE__ */ r(A, { title: b.title, subtitle: b.subtitle }),
219
+ zIndex: $,
220
+ headerCustomComponent: /* @__PURE__ */ r(M, { title: p.title, subtitle: p.subtitle }),
175
221
  hideCrossButton: !1,
176
222
  width: "431px",
177
- headerStyle: L,
178
- bodyStyle: R,
179
- onClose: c,
223
+ headerStyle: z,
224
+ bodyStyle: V,
225
+ onClose: h,
180
226
  saveButtonProps: {
181
227
  "data-test": "config-tool-save",
182
228
  buttonText: "Save",
183
229
  buttonType: "primary",
184
230
  size: "small",
185
- disabled: !T,
186
- isLoading: x,
187
- onClick: I
231
+ disabled: !t,
232
+ isLoading: S,
233
+ onClick: c
188
234
  },
189
235
  cancelButtonProps: {
190
236
  "data-test": "config-tool-cancel",
191
237
  buttonText: "Cancel",
192
238
  buttonType: "tertiaryGray",
193
239
  size: "small",
194
- onClick: c
240
+ onClick: h
195
241
  },
196
- children: v.map(_)
242
+ children: f.map(k)
197
243
  }
198
244
  );
199
- }, G = u.div`
245
+ }, X = w.div`
200
246
  display: flex;
201
247
  flex-direction: column;
202
248
  gap: 8px;
203
- `, N = u.input`
249
+ `, Z = w.input`
204
250
  width: 100%;
205
251
  min-width: 0;
206
252
  box-sizing: border-box;
207
253
  height: 32px;
208
254
  padding: 0 8px;
209
- border: 1px solid ${i.stroke.primary};
255
+ border: 1px solid ${u.stroke.primary};
210
256
  border-radius: 4px;
211
257
  font-family: 'Inter', sans-serif;
212
258
  font-size: 14px;
213
- color: ${i.content.primary};
214
- background: ${i.surface.standard};
259
+ color: ${u.content.primary};
260
+ background: ${u.surface.standard};
215
261
  outline: none;
216
262
 
217
263
  &::placeholder {
218
- color: ${i.content.secondary};
264
+ color: ${u.content.secondary};
219
265
  }
220
266
 
221
267
  &:focus {
222
- border-color: ${i.stroke.brand};
268
+ border-color: ${u.stroke.brand};
223
269
  }
224
- `, q = u.div`
270
+ `, ee = w.div`
225
271
  display: flex;
226
272
  flex-wrap: wrap;
227
273
  gap: 6px;
228
- `, J = u.div`
274
+ `, te = w.div`
229
275
  display: flex;
230
276
  align-items: center;
231
277
  justify-content: space-between;
232
278
  gap: 12px;
233
- `, K = u.div`
279
+ `, ne = w.div`
234
280
  display: flex;
235
281
  flex-direction: column;
236
282
  gap: 4px;
237
283
  min-width: 0;
238
284
  `;
239
285
  export {
240
- pt as ConfigToolPanel
286
+ ke as ConfigToolPanel
241
287
  };
242
288
  //# sourceMappingURL=ConfigToolPanel.js.map