@bikdotai/bik-component-library 0.0.829 → 0.0.830-beta.1
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.
- package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +17 -65
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +41 -0
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/DrawerHeaderText.js +9 -0
- package/dist/cjs/components/agent-builder/components/DrawerHeaderText.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +20 -20
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +23 -0
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +5 -5
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +5 -0
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -0
- package/dist/cjs/components/agent-builder/constants/tools.js +2 -0
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -0
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +3 -3
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/cjs/components/side-modal/SideModal.style.js +11 -10
- package/dist/cjs/components/side-modal/SideModal.style.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.js +100 -96
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +144 -1
- package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +0 -21
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +42 -111
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +33 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +242 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -0
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +9 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +318 -219
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.d.ts +25 -0
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.js +32 -0
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.js.map +1 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +6 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.js +38 -30
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionField.js +77 -52
- package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +7 -0
- package/dist/esm/components/agent-builder/components/MentionPicker.js +139 -129
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +27 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +267 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -0
- package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +14 -0
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +166 -140
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.d.ts +19 -0
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +66 -0
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -0
- package/dist/esm/components/agent-builder/constants/tools.d.ts +65 -0
- package/dist/esm/components/agent-builder/constants/tools.js +29 -0
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -0
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +19 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +169 -140
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/index.d.ts +2 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +241 -141
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +18 -3
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +81 -62
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +15 -9
- package/dist/esm/components/agent-builder/utils/sourceIcons.js +16 -8
- package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/esm/components/side-modal/SideModal.style.js +1 -0
- package/dist/esm/components/side-modal/SideModal.style.js.map +1 -1
- package/dist/esm/index.js +97 -95
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigToolPanel.js","sources":["../../../../../src/components/agent-builder/components/ConfigToolPanel.tsx"],"sourcesContent":["import CrossIcon from '@src/assets/icons/cross.svg';\nimport React, { useState } from 'react';\nimport styled from 'styled-components';\nimport { Input } from '@src/components/input';\nimport { SideModal } from '@src/components/side-modal';\nimport { Switch } from '@src/components/switch';\nimport { Tag } from '@src/components/tag';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tConfigToolConfig,\n\tConfigToolKey,\n\tParamField,\n\tParamsBlob,\n} from '../AgentBuilder.model';\nimport { FieldBlock } from '../AgentBuilder.styled';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport {\n\tDRAWER_BODY_STYLE,\n\tDRAWER_HEADER_STYLE,\n\tDrawerHeaderText,\n} from './DrawerHeaderText';\nimport { ToolInstructionsField } from './ToolInstructionsField';\n\n/** Header copy per shared-drawer tool. */\nconst TOOL_COPY: Record<ConfigToolKey, { title: string; subtitle: string }> = {\n\tsend_email: {\n\t\ttitle: 'Handover to email',\n\t\tsubtitle:\n\t\t\t\"Notify someone by email when this agent can't continue. You pick the recipient, the AI drafts the message.\",\n\t},\n\tsend_slack_message: {\n\t\ttitle: 'Send Slack message',\n\t\tsubtitle:\n\t\t\t'Post a message to a Slack channel. You pick the channel, the AI composes the message from the conversation.',\n\t},\n};\n\ninterface ConfigToolPanelProps {\n\t/** Which tool this drawer configures (drives copy + persistence). */\n\ttoolKey: ConfigToolKey;\n\t/**\n\t * The backend template (`list-catalog` → params) for `toolKey`. The form is\n\t * DYNAMIC: exactly these fields render, in this order, each by its\n\t * `component` kind (KeywordInput | MultilineInput | Switch | fallback input).\n\t */\n\ttemplate: ParamsBlob;\n\tonClose: () => void;\n\t/** Persist the filled template. A pending promise shows the Save loader. */\n\tonSave: (config: ConfigToolConfig) => void | Promise<void>;\n\t/** Seed values when editing an existing tool. */\n\tinitial?: ConfigToolConfig;\n\t/** Optional \"Improve with AI\" for multiline fields. Omit to hide it. */\n\tonImprove?: (text: string) => Promise<string>;\n\tcharLimits?: AgentCharLimits;\n\t/** SideModal stacking order — raise it when opened over another drawer. */\n\tzIndex?: number;\n}\n\ninterface EmailChipsFieldProps {\n\tchips: string[];\n\tonChange: (next: string[]) => void;\n\tplaceholder: string;\n\tnativeID?: string;\n\t/** Optional helper caption shown between the input and the chips. */\n\thint?: React.ReactNode;\n}\n\n/**\n * Email entry field: type an address and press Enter / comma (or blur) to add\n * it. Added emails render as removable chips BELOW the input — not inside it.\n * Backspace on an empty input removes the last chip.\n */\nconst EmailChipsField: React.FC<EmailChipsFieldProps> = ({\n\tchips,\n\tonChange,\n\tplaceholder,\n\tnativeID,\n\thint,\n}) => {\n\tconst [buffer, setBuffer] = useState('');\n\n\tconst commit = () => {\n\t\tconst parts = buffer\n\t\t\t.split(',')\n\t\t\t.map((s) => s.trim())\n\t\t\t.filter(Boolean);\n\t\tif (parts.length) {\n\t\t\tonChange([...chips, ...parts.filter((p) => !chips.includes(p))]);\n\t\t}\n\t\tsetBuffer('');\n\t};\n\n\treturn (\n\t\t<ChipsFieldWrap>\n\t\t\t<EmailInputBox\n\t\t\t\tid={nativeID}\n\t\t\t\ttype=\"text\"\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\tvalue={buffer}\n\t\t\t\tonChange={(e) => setBuffer(e.target.value)}\n\t\t\t\tonBlur={commit}\n\t\t\t\tonKeyDown={(e) => {\n\t\t\t\t\tif (e.key === 'Enter' || e.key === ',') {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tcommit();\n\t\t\t\t\t} else if (\n\t\t\t\t\t\te.key === 'Backspace' &&\n\t\t\t\t\t\tbuffer === '' &&\n\t\t\t\t\t\tchips.length > 0\n\t\t\t\t\t) {\n\t\t\t\t\t\tonChange(chips.slice(0, -1));\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t{hint}\n\t\t\t{chips.length > 0 && (\n\t\t\t\t<ChipRow>\n\t\t\t\t\t{chips.map((email, i) => (\n\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\tkey={`${email}-${i}`}\n\t\t\t\t\t\t\ttagText={email}\n\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t\t\t\tTrailingIcon={CrossIcon}\n\t\t\t\t\t\t\tonTrailingIconClicked={() =>\n\t\t\t\t\t\t\t\tonChange(chips.filter((_, idx) => idx !== i))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</ChipRow>\n\t\t\t)}\n\t\t</ChipsFieldWrap>\n\t);\n};\n\n/** Field values keyed by param key (the editable part of a {@link ParamsBlob}). */\ntype ParamValues = Record<string, string | boolean | number | object>;\n\nconst seedValues = (\n\ttemplate: ParamsBlob,\n\tinitial?: ConfigToolConfig,\n): ParamValues => {\n\tconst values: ParamValues = {};\n\tObject.keys(template).forEach((key) => {\n\t\tvalues[key] = initial?.params[key]?.value ?? template[key].value;\n\t});\n\treturn values;\n};\n\n/** Chips ↔ the string value KeywordInput fields carry (comma-separated). */\nconst toChips = (value: unknown): string[] =>\n\tString(value ?? '')\n\t\t.split(',')\n\t\t.map((s) => s.trim())\n\t\t.filter(Boolean);\n\n/**\n * Shared right-side drawer for the params-driven configurable tools (email /\n * Slack). Fully backend-driven: it renders the template fields by their\n * `component` kind and returns the same blob with values filled in. KeywordInput\n * renders as multi-value email chips only for `send_email`; every other tool\n * gets a plain single-line input. Mount it fresh per open (key it) so `initial`\n * seeds the state. Built on the shared `SideModal` shell.\n */\nexport const ConfigToolPanel: React.FC<ConfigToolPanelProps> = ({\n\ttoolKey,\n\ttemplate,\n\tonClose,\n\tonSave,\n\tinitial,\n\tonImprove,\n\tcharLimits = AGENT_CHAR_LIMITS,\n\tzIndex,\n}) => {\n\tconst [values, setValues] = useState<ParamValues>(() =>\n\t\tseedValues(template, initial),\n\t);\n\tconst [saving, setSaving] = useState(false);\n\n\tconst fields = Object.values(template);\n\tconst isEmail = toolKey === 'send_email';\n\tconst setValue = (key: string, value: string | boolean | number | object) =>\n\t\tsetValues((prev) => ({ ...prev, [key]: value }));\n\n\tconst canSave = fields.every(\n\t\t(f) => !f.required || String(values[f.key] ?? '').trim() !== '',\n\t);\n\n\tconst handleSave = async () => {\n\t\tif (!canSave || saving) {\n\t\t\treturn;\n\t\t}\n\t\tconst params: ParamsBlob = {};\n\t\tfields.forEach((f) => {\n\t\t\t// Save the FULL descriptor with only `value` changed — the backend\n\t\t\t// infers each field's type from `component` and reads `required`.\n\t\t\tparams[f.key] = { ...f, value: values[f.key] };\n\t\t});\n\t\tconst config: ConfigToolConfig = {\n\t\t\tid: initial?.id ?? `${toolKey}_${Date.now().toString(36)}`,\n\t\t\ttool_key: toolKey,\n\t\t\tparams,\n\t\t};\n\t\tconst result = onSave(config);\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSaving(false);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst renderField = (field: ParamField) => {\n\t\tconst testId = `config-tool-${field.key.toLowerCase()}`;\n\t\tswitch (field.component) {\n\t\t\t// Multi-value email chips — only for the email tool. Slack's KeywordInput\n\t\t\t// (channelId) falls through to the plain input below.\n\t\t\tcase 'KeywordInput':\n\t\t\t\tif (!isEmail) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<FieldBlock key={field.key}>\n\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t{field.title}\n\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t<EmailChipsField\n\t\t\t\t\t\t\tnativeID={testId}\n\t\t\t\t\t\t\tplaceholder={field.hint ?? ''}\n\t\t\t\t\t\t\tchips={toChips(values[field.key])}\n\t\t\t\t\t\t\tonChange={(chips) => setValue(field.key, chips.join(','))}\n\t\t\t\t\t\t\thint={\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\tPress Enter or comma to add multiple emails\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FieldBlock>\n\t\t\t\t);\n\t\t\tcase 'MultilineInput':\n\t\t\t\treturn (\n\t\t\t\t\t<ToolInstructionsField\n\t\t\t\t\t\tkey={field.key}\n\t\t\t\t\t\tdata-test={testId}\n\t\t\t\t\t\tlabel={field.title}\n\t\t\t\t\t\tvalue={String(values[field.key] ?? '')}\n\t\t\t\t\t\tonChange={(text) => setValue(field.key, text)}\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder={field.hint ?? ''}\n\t\t\t\t\t\tonImprove={onImprove}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tcase 'Switch':\n\t\t\t\treturn (\n\t\t\t\t\t<SwitchRow key={field.key}>\n\t\t\t\t\t\t<SwitchText>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t{field.title}\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t{field.hint && (\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\t{field.hint}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</SwitchText>\n\t\t\t\t\t\t<Switch\n\t\t\t\t\t\t\tdata-test={testId}\n\t\t\t\t\t\t\tvalue={Boolean(values[field.key])}\n\t\t\t\t\t\t\tonValueChange={async (next) => setValue(field.key, next)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SwitchRow>\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\treturn (\n\t\t\t<Input\n\t\t\t\tkey={field.key}\n\t\t\t\tdata-test={testId}\n\t\t\t\tvariant=\"small\"\n\t\t\t\tlabelText={field.title}\n\t\t\t\tlabelTextBold\n\t\t\t\tplaceholder={field.hint ?? ''}\n\t\t\t\tvalue={String(values[field.key] ?? '')}\n\t\t\t\tonChangeText={(text) => setValue(field.key, text)}\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst copy = TOOL_COPY[toolKey];\n\n\treturn (\n\t\t<SideModal\n\t\t\theader={copy.title}\n\t\t\tcloseOnEscapeKey={false}\n\t\t\tzIndex={zIndex}\n\t\t\theaderCustomComponent={\n\t\t\t\t<DrawerHeaderText title={copy.title} subtitle={copy.subtitle} />\n\t\t\t}\n\t\t\thideCrossButton={false}\n\t\t\twidth=\"431px\"\n\t\t\theaderStyle={DRAWER_HEADER_STYLE}\n\t\t\tbodyStyle={DRAWER_BODY_STYLE}\n\t\t\tonClose={onClose}\n\t\t\tsaveButtonProps={{\n\t\t\t\t'data-test': 'config-tool-save',\n\t\t\t\tbuttonText: 'Save',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tdisabled: !canSave,\n\t\t\t\tisLoading: saving,\n\t\t\t\tonClick: handleSave,\n\t\t\t}}\n\t\t\tcancelButtonProps={{\n\t\t\t\t'data-test': 'config-tool-cancel',\n\t\t\t\tbuttonText: 'Cancel',\n\t\t\t\tbuttonType: 'tertiaryGray',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onClose,\n\t\t\t}}\n\t\t>\n\t\t\t{fields.map(renderField)}\n\t\t</SideModal>\n\t);\n};\n\nconst ChipsFieldWrap = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\nconst EmailInputBox = styled.input`\n\twidth: 100%;\n\tmin-width: 0;\n\tbox-sizing: border-box;\n\theight: 32px;\n\tpadding: 0 8px;\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tfont-family: 'Inter', sans-serif;\n\tfont-size: 14px;\n\tcolor: ${COLORS.content.primary};\n\tbackground: ${COLORS.surface.standard};\n\toutline: none;\n\n\t&::placeholder {\n\t\tcolor: ${COLORS.content.secondary};\n\t}\n\n\t&:focus {\n\t\tborder-color: ${COLORS.stroke.brand};\n\t}\n`;\n\nconst ChipRow = styled.div`\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px;\n`;\n\nconst SwitchRow = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 12px;\n`;\n\nconst SwitchText = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tmin-width: 0;\n`;\n"],"names":["TOOL_COPY","EmailChipsField","chips","onChange","placeholder","nativeID","hint","buffer","setBuffer","useState","commit","parts","p","ChipsFieldWrap","jsx","EmailInputBox","ChipRow","email","i","Tag","CrossIcon","_","idx","seedValues","template","initial","values","key","toChips","value","s","ConfigToolPanel","toolKey","onClose","onSave","onImprove","charLimits","AGENT_CHAR_LIMITS","zIndex","setValues","saving","setSaving","fields","isEmail","setValue","prev","canSave","f","handleSave","params","config","result","renderField","field","testId","FieldBlock","TitleSmall","COLORS","BodyCaption","ToolInstructionsField","text","SwitchRow","jsxs","SwitchText","Switch","next","Input","copy","SideModal","DrawerHeaderText","DRAWER_HEADER_STYLE","DRAWER_BODY_STYLE","styled"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAMA,IAAwE;AAAA,EAC7E,YAAY;AAAA,IACX,OAAO;AAAA,IACP,UACC;AAAA,EAAA;AAAA,EAEF,oBAAoB;AAAA,IACnB,OAAO;AAAA,IACP,UACC;AAAA,EAAA;AAEH,GAqCM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AAA,MAE/D,iBAAiB;AAAA,MACjB,OAAM;AAAA,MACN,aAAaG;AAAA,MACb,WAAWC;AAAA,MACX,SAAAtC;AAAA,MACA,iBAAiB;AAAA,QAChB,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,MAAM;AAAA,QACN,UAAU,CAACa;AAAA,QACX,WAAWN;AAAA,QACX,SAASQ;AAAA,MAAA;AAAA,MAEV,mBAAmB;AAAA,QAClB,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,MAAM;AAAA,QACN,SAASf;AAAA,MAAA;AAAA,MAGT,UAAAS,EAAO,IAAIU,CAAW;AAAA,IAAA;AAAA,EAAA;AAG1B,GAEMvC,IAAiB2D,EAAO;AAAA;AAAA;AAAA;AAAA,GAMxBzD,IAAgByD,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAMRf,EAAO,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,UAIhCA,EAAO,QAAQ,OAAO;AAAA,eACjBA,EAAO,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA,WAI3BA,EAAO,QAAQ,SAAS;AAAA;AAAA;AAAA;AAAA,kBAIjBA,EAAO,OAAO,KAAK;AAAA;AAAA,GAI/BzC,IAAUwD,EAAO;AAAA;AAAA;AAAA;AAAA,GAMjBX,IAAYW,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOnBT,IAAaS,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { AgentTool, SubAgentDraft } from '../AgentBuilder.model';
|
|
2
|
+
import { AgentTool, ConfigToolKey, ParamsBlob, SubAgentDraft } from '../AgentBuilder.model';
|
|
3
3
|
import { AgentCharLimits } from '../constants/charLimits';
|
|
4
4
|
interface CreateSubAgentPanelProps {
|
|
5
5
|
onClose: () => void;
|
|
@@ -8,6 +8,14 @@ interface CreateSubAgentPanelProps {
|
|
|
8
8
|
availableTools: AgentTool[];
|
|
9
9
|
/** Optional "Improve with AI" for instructions / guardrails. Omit to hide the buttons. */
|
|
10
10
|
onImprove?: (kind: 'instructions' | 'guardrail', text: string) => Promise<string>;
|
|
11
|
+
/** Optional "Improve with AI" for the Rest API / config-tool drawers. */
|
|
12
|
+
onImproveToolInstructions?: (text: string) => Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Backend templates (email / Slack) that drive the shared config-tool drawer.
|
|
15
|
+
* Each present key enables its tool action in this drawer; absent → hidden.
|
|
16
|
+
* Same prop the main builder gets — sub-agents can add the same tools.
|
|
17
|
+
*/
|
|
18
|
+
configToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;
|
|
11
19
|
/** Header title — "Create sub-agent" (default) or "Edit sub-agent". */
|
|
12
20
|
title?: string;
|
|
13
21
|
/** Initial values, e.g. when configuring an existing sub-agent. */
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { MentionEditor as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
1
|
+
import { jsxs as rt, Fragment as Kt, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as r, useRef as v, useMemo as wt, useCallback as a } from "react";
|
|
3
|
+
import Nt from "styled-components";
|
|
4
|
+
import { addUnique as it } from "../../../utils/arrayUtils.js";
|
|
5
|
+
import { COLORS as F } from "../../../constants/Theme.js";
|
|
6
|
+
import { AGENT_CHAR_LIMITS as Bt } from "../constants/charLimits.js";
|
|
7
|
+
import { CONFIG_TOOL_SOURCES as lt, ToolSource as p, TOOL_ACTION_SOURCES as Lt, TOOL_SOURCE_LABELS as Dt } from "../constants/tools.js";
|
|
8
|
+
import { buildAgentMentionItems as Gt, buildCustomToolMentionItems as Pt, restApiMentionItem as Ut, configToolMentionItem as zt, restApiToolName as Ht, configToolName as $t, toolSourceLabel as Ft } from "../utils/mentionSerialization.js";
|
|
9
|
+
import { sourceIcon as j, SOURCE_ICONS as W, renderSourceIcon as at } from "../utils/sourceIcons.js";
|
|
10
|
+
import { ConfigToolPanel as jt } from "./ConfigToolPanel.js";
|
|
11
|
+
import { DRAWER_BODY_STYLE as Wt, DRAWER_HEADER_STYLE as Yt, DrawerHeaderText as Xt } from "./DrawerHeaderText.js";
|
|
12
|
+
import { MentionEditor as ct } from "./MentionEditor.js";
|
|
13
|
+
import { RestApiToolPanel as Zt } from "./RestApiToolPanel.js";
|
|
14
|
+
import { SelectableListSection as qt } from "./SelectableListSection.js";
|
|
15
|
+
import { SideModal as Jt } from "../../side-modal/SideModal.js";
|
|
16
|
+
import { Input as Qt } from "../../input/Input.js";
|
|
17
|
+
import { Toaster as Vt } from "../../toaster/Toaster.js";
|
|
18
|
+
const te = 1e3, ut = 1002, dt = (A, f) => {
|
|
19
|
+
const s = A ?? [];
|
|
20
|
+
return s.some((u) => u.id === f.id) ? s.map((u) => u.id === f.id ? f : u) : [...s, f];
|
|
21
|
+
}, mt = Nt.button`
|
|
18
22
|
align-self: flex-start;
|
|
19
|
-
border: 1px solid ${
|
|
20
|
-
color: ${
|
|
21
|
-
background: ${
|
|
23
|
+
border: 1px solid ${F.stroke.primary};
|
|
24
|
+
color: ${F.content.primary};
|
|
25
|
+
background: ${F.surface.standard};
|
|
22
26
|
border-radius: 8px;
|
|
23
27
|
padding: 6px 12px;
|
|
24
28
|
font-size: 13px;
|
|
@@ -30,232 +34,327 @@ const q = mt.button`
|
|
|
30
34
|
cursor: default;
|
|
31
35
|
opacity: 0.6;
|
|
32
36
|
}
|
|
33
|
-
`,
|
|
34
|
-
onClose:
|
|
35
|
-
onSave:
|
|
36
|
-
availableTools:
|
|
37
|
-
onImprove:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
`, Te = ({
|
|
38
|
+
onClose: A,
|
|
39
|
+
onSave: f,
|
|
40
|
+
availableTools: s,
|
|
41
|
+
onImprove: u,
|
|
42
|
+
onImproveToolInstructions: Y,
|
|
43
|
+
configToolTemplates: X,
|
|
44
|
+
title: Z = "Create sub-agent",
|
|
45
|
+
initial: g,
|
|
46
|
+
appLabel: q = "Manifest",
|
|
47
|
+
charLimits: h = Bt
|
|
42
48
|
}) => {
|
|
43
|
-
const [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
const [k, pt] = r(g?.name ?? ""), [T, x] = r(g?.instructions ?? ""), [b, R] = r(g?.guardrail ?? ""), [M, _] = r(g?.tools ?? []), [m, K] = r(
|
|
50
|
+
g?.configTools ?? []
|
|
51
|
+
), [d, w] = r(
|
|
52
|
+
g?.restApiTools ?? []
|
|
53
|
+
), [i, y] = r(null), E = v(0), [J, Q] = r(!1), [ft, N] = r(0), [gt, B] = r(0), [S, V] = r(null), L = wt(
|
|
54
|
+
() => [
|
|
55
|
+
...Gt(s, [], q),
|
|
56
|
+
...Pt(m, d)
|
|
57
|
+
],
|
|
58
|
+
[s, q, m, d]
|
|
59
|
+
), O = v({}), D = v("instructions"), yt = a((t) => {
|
|
60
|
+
O.current.instructions = t ?? void 0;
|
|
61
|
+
}, []), ht = a((t) => {
|
|
62
|
+
O.current.guardrail = t ?? void 0;
|
|
63
|
+
}, []), Tt = a(() => {
|
|
64
|
+
D.current = "instructions";
|
|
65
|
+
}, []), bt = a(() => {
|
|
66
|
+
D.current = "guardrail";
|
|
67
|
+
}, []), tt = a(
|
|
55
68
|
(t, e) => {
|
|
56
|
-
t === "tool" &&
|
|
69
|
+
t === "tool" && _((o) => it(o, e));
|
|
57
70
|
},
|
|
58
71
|
[]
|
|
59
|
-
),
|
|
60
|
-
(
|
|
61
|
-
}, []),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
id: K.current,
|
|
67
|
-
message: `Tool "${e?.display_name ?? "Tool"}" removed`
|
|
72
|
+
), C = a((t, e) => {
|
|
73
|
+
(O.current[D.current] ?? O.current.instructions)?.("tool", t, e);
|
|
74
|
+
}, []), G = a((t) => {
|
|
75
|
+
E.current += 1, y({
|
|
76
|
+
key: E.current,
|
|
77
|
+
kind: "restapi",
|
|
78
|
+
initialRest: t
|
|
68
79
|
});
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
}, []), P = a(
|
|
81
|
+
(t, e) => {
|
|
82
|
+
E.current += 1, y({
|
|
83
|
+
key: E.current,
|
|
84
|
+
kind: "config",
|
|
85
|
+
toolKey: t,
|
|
86
|
+
initialConfig: e
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
[]
|
|
90
|
+
), St = a(
|
|
91
|
+
(t) => {
|
|
92
|
+
const e = lt[t];
|
|
93
|
+
e ? P(e) : G();
|
|
94
|
+
},
|
|
95
|
+
[P, G]
|
|
96
|
+
), Ct = a(
|
|
97
|
+
(t) => {
|
|
98
|
+
const e = !d.some((o) => o.id === t.id);
|
|
99
|
+
w((o) => dt(o, t)), e && C(t.id, Ut(t).label), y(null);
|
|
100
|
+
},
|
|
101
|
+
[d, C]
|
|
102
|
+
), It = a(
|
|
103
|
+
(t) => {
|
|
104
|
+
const e = !m.some((o) => o.id === t.id);
|
|
105
|
+
K((o) => dt(o, t)), e && C(t.id, zt(t).label), y(null);
|
|
106
|
+
},
|
|
107
|
+
[m, C]
|
|
108
|
+
), [U, z] = r(
|
|
109
|
+
null
|
|
110
|
+
), H = v(null), et = v(0), vt = (t) => {
|
|
111
|
+
const e = s.find((n) => n.tool_id === t)?.display_name ?? d.find((n) => n.id === t)?.name ?? "Tool", o = `{{tool:${t}}}`, l = (n) => n.split(o).join("");
|
|
112
|
+
H.current = {
|
|
113
|
+
instructions: T,
|
|
114
|
+
guardrail: b,
|
|
115
|
+
tools: M,
|
|
116
|
+
configTools: m,
|
|
117
|
+
restApiTools: d
|
|
118
|
+
}, x((n) => l(n)), R((n) => l(n)), _((n) => n.filter((I) => I !== t)), K((n) => n.filter((I) => I.id !== t)), w((n) => n.filter((I) => I.id !== t)), N((n) => n + 1), B((n) => n + 1), et.current += 1, z({ id: et.current, message: `Tool "${e}" removed` });
|
|
119
|
+
}, At = () => {
|
|
120
|
+
const t = H.current;
|
|
121
|
+
t && (x(t.instructions), R(t.guardrail), _(t.tools), K(t.configTools), w(t.restApiTools), N((e) => e + 1), B((e) => e + 1), H.current = null), z(null);
|
|
122
|
+
}, ot = k.trim().length > 0 && (T.trim().length > 0 || b.trim().length > 0), xt = M.map((t) => {
|
|
123
|
+
const e = s.find((o) => o.tool_id === t);
|
|
74
124
|
return e ? {
|
|
75
125
|
id: t,
|
|
76
126
|
label: e.display_name,
|
|
77
|
-
icon:
|
|
127
|
+
icon: j(e.source ?? p.Manifest)
|
|
78
128
|
} : null;
|
|
79
|
-
}).filter((t) => t !== null),
|
|
129
|
+
}).filter((t) => t !== null), Rt = d.map((t) => ({
|
|
130
|
+
id: t.id,
|
|
131
|
+
label: Ht(t),
|
|
132
|
+
icon: W[p.RestApi],
|
|
133
|
+
onConfigure: () => G(t)
|
|
134
|
+
})), _t = m.map((t) => ({
|
|
135
|
+
id: t.id,
|
|
136
|
+
label: $t(t),
|
|
137
|
+
icon: W[t.tool_key === "send_slack_message" ? p.Slack : p.EmailHandover],
|
|
138
|
+
onConfigure: () => P(t.tool_key, t)
|
|
139
|
+
})), Et = [
|
|
140
|
+
...xt,
|
|
141
|
+
...Rt,
|
|
142
|
+
..._t
|
|
143
|
+
], $ = Lt.filter(
|
|
144
|
+
(t) => {
|
|
145
|
+
const e = lt[t];
|
|
146
|
+
return !e || !!X?.[e];
|
|
147
|
+
}
|
|
148
|
+
).map((t) => ({
|
|
149
|
+
source: t,
|
|
150
|
+
label: Dt[t],
|
|
151
|
+
icon: W[t],
|
|
152
|
+
onSelect: () => St(t)
|
|
153
|
+
})), nt = i?.kind === "config" && i.toolKey ? X?.[i.toolKey] : void 0, Ot = s.map((t) => ({
|
|
80
154
|
label: t.display_name,
|
|
81
155
|
value: t.tool_id,
|
|
82
|
-
leadingIcon:
|
|
83
|
-
})),
|
|
156
|
+
leadingIcon: at(j(t.source ?? p.Manifest)) ?? void 0
|
|
157
|
+
})), kt = (() => {
|
|
84
158
|
const t = [], e = /* @__PURE__ */ new Map();
|
|
85
|
-
return
|
|
86
|
-
const
|
|
87
|
-
e.has(
|
|
88
|
-
label:
|
|
89
|
-
value:
|
|
90
|
-
leadingIcon:
|
|
159
|
+
return s.forEach((o) => {
|
|
160
|
+
const l = o.source ?? p.Manifest;
|
|
161
|
+
e.has(l) || (e.set(l, []), t.push(l)), e.get(l)?.push({
|
|
162
|
+
label: o.display_name,
|
|
163
|
+
value: o.tool_id,
|
|
164
|
+
leadingIcon: at(j(o.source ?? p.Manifest)) ?? void 0
|
|
91
165
|
});
|
|
92
|
-
}), t.map((
|
|
93
|
-
source:
|
|
94
|
-
label:
|
|
95
|
-
options: e.get(
|
|
166
|
+
}), t.map((o) => ({
|
|
167
|
+
source: o,
|
|
168
|
+
label: Ft(o),
|
|
169
|
+
options: e.get(o) ?? []
|
|
96
170
|
}));
|
|
97
|
-
})(),
|
|
98
|
-
if (!
|
|
171
|
+
})(), Mt = async () => {
|
|
172
|
+
if (!ot || J)
|
|
99
173
|
return;
|
|
100
|
-
const t =
|
|
101
|
-
name:
|
|
102
|
-
instructions:
|
|
103
|
-
guardrail:
|
|
104
|
-
tools:
|
|
174
|
+
const t = f({
|
|
175
|
+
name: k.trim(),
|
|
176
|
+
instructions: T,
|
|
177
|
+
guardrail: b,
|
|
178
|
+
tools: M,
|
|
179
|
+
configTools: m,
|
|
180
|
+
restApiTools: d
|
|
105
181
|
});
|
|
106
182
|
if (t && typeof t.then == "function") {
|
|
107
|
-
|
|
183
|
+
Q(!0);
|
|
108
184
|
try {
|
|
109
185
|
await t;
|
|
110
186
|
} finally {
|
|
111
|
-
|
|
187
|
+
Q(!1);
|
|
112
188
|
}
|
|
113
189
|
}
|
|
114
|
-
},
|
|
115
|
-
if (!(!
|
|
116
|
-
|
|
190
|
+
}, st = async (t) => {
|
|
191
|
+
if (!(!u || S)) {
|
|
192
|
+
V(t);
|
|
117
193
|
try {
|
|
118
|
-
const
|
|
119
|
-
t === "instructions" ? (
|
|
194
|
+
const o = await u(t, t === "instructions" ? T : b);
|
|
195
|
+
t === "instructions" ? (x(o), N((l) => l + 1)) : (R(o), B((l) => l + 1));
|
|
120
196
|
} finally {
|
|
121
|
-
|
|
197
|
+
V(null);
|
|
122
198
|
}
|
|
123
199
|
}
|
|
124
200
|
};
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
ut,
|
|
135
|
-
{
|
|
136
|
-
width: 20,
|
|
137
|
-
height: 20,
|
|
138
|
-
color: u.content.secondary
|
|
139
|
-
}
|
|
140
|
-
) })
|
|
141
|
-
] }),
|
|
142
|
-
/* @__PURE__ */ l(xt, { children: [
|
|
143
|
-
/* @__PURE__ */ o(
|
|
144
|
-
Rt,
|
|
145
|
-
{
|
|
146
|
-
"data-test": "subagent-name",
|
|
147
|
-
labelText: "Agent name",
|
|
148
|
-
labelTextBold: !0,
|
|
149
|
-
placeholder: "Enter agent name",
|
|
150
|
-
value: I,
|
|
151
|
-
maxCharLimit: v.name,
|
|
152
|
-
maxCharLimitPosition: "TOP",
|
|
153
|
-
maxCharStyle: { fontSize: 12, lineHeight: "16px" },
|
|
154
|
-
onChangeText: J
|
|
155
|
-
}
|
|
156
|
-
),
|
|
157
|
-
/* @__PURE__ */ o(
|
|
158
|
-
j,
|
|
159
|
-
{
|
|
160
|
-
"data-test": "subagent-instructions",
|
|
161
|
-
label: "Instructions",
|
|
162
|
-
value: d,
|
|
163
|
-
onChange: h,
|
|
164
|
-
maxLength: v.instructions,
|
|
165
|
-
placeholder: "Write the steps in plain English. Type @ to reference a tool.",
|
|
166
|
-
minHeight: "160px",
|
|
167
|
-
resetKey: `instr-${Q}`,
|
|
168
|
-
mentionItems: _,
|
|
169
|
-
tools: a,
|
|
170
|
-
onMentionSelect: H,
|
|
171
|
-
onFocus: Z,
|
|
172
|
-
registerInsert: X,
|
|
173
|
-
action: p ? /* @__PURE__ */ o(
|
|
174
|
-
q,
|
|
175
|
-
{
|
|
176
|
-
type: "button",
|
|
177
|
-
"data-test": "subagent-improve-instructions",
|
|
178
|
-
disabled: g !== null,
|
|
179
|
-
onClick: () => F("instructions"),
|
|
180
|
-
children: g === "instructions" ? "Improving…" : "Improve with AI"
|
|
181
|
-
}
|
|
182
|
-
) : void 0
|
|
183
|
-
}
|
|
184
|
-
),
|
|
185
|
-
/* @__PURE__ */ o(
|
|
186
|
-
j,
|
|
187
|
-
{
|
|
188
|
-
"data-test": "subagent-guardrail",
|
|
189
|
-
label: "Guardrails",
|
|
190
|
-
value: m,
|
|
191
|
-
onChange: b,
|
|
192
|
-
maxLength: v.guardrail,
|
|
193
|
-
placeholder: "e.g. Never discuss competitor pricing. Type @ to reference a tool.",
|
|
194
|
-
minHeight: "160px",
|
|
195
|
-
resetKey: `guard-${V}`,
|
|
196
|
-
mentionItems: _,
|
|
197
|
-
tools: a,
|
|
198
|
-
onMentionSelect: H,
|
|
199
|
-
onFocus: tt,
|
|
200
|
-
registerInsert: Y,
|
|
201
|
-
action: p ? /* @__PURE__ */ o(
|
|
202
|
-
q,
|
|
203
|
-
{
|
|
204
|
-
type: "button",
|
|
205
|
-
"data-test": "subagent-improve-guardrail",
|
|
206
|
-
disabled: g !== null,
|
|
207
|
-
onClick: () => F("guardrail"),
|
|
208
|
-
children: g === "guardrail" ? "Improving…" : "Improve with AI"
|
|
209
|
-
}
|
|
210
|
-
) : void 0
|
|
211
|
-
}
|
|
212
|
-
),
|
|
213
|
-
/* @__PURE__ */ o(
|
|
214
|
-
At,
|
|
215
|
-
{
|
|
216
|
-
title: "Tools this agent can use",
|
|
217
|
-
dataTestPrefix: "subagent-tools",
|
|
218
|
-
items: rt,
|
|
219
|
-
addableOptions: st,
|
|
220
|
-
sourceGroups: it,
|
|
221
|
-
mentionItems: _,
|
|
222
|
-
emptyText: "No tools added yet.",
|
|
223
|
-
onAdd: (t) => {
|
|
224
|
-
et(t), y((e) => N(e, t));
|
|
225
|
-
},
|
|
226
|
-
onRemove: nt
|
|
227
|
-
}
|
|
228
|
-
)
|
|
229
|
-
] }),
|
|
230
|
-
/* @__PURE__ */ l(Ct, { children: [
|
|
231
|
-
/* @__PURE__ */ o(
|
|
232
|
-
z,
|
|
201
|
+
return /* @__PURE__ */ rt(Kt, { children: [
|
|
202
|
+
/* @__PURE__ */ rt(
|
|
203
|
+
Jt,
|
|
204
|
+
{
|
|
205
|
+
header: Z,
|
|
206
|
+
closeOnEscapeKey: !1,
|
|
207
|
+
zIndex: te,
|
|
208
|
+
headerCustomComponent: /* @__PURE__ */ c(
|
|
209
|
+
Xt,
|
|
233
210
|
{
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
size: "small",
|
|
237
|
-
buttonText: "Save",
|
|
238
|
-
disabled: !L,
|
|
239
|
-
isLoading: E,
|
|
240
|
-
onClick: at
|
|
211
|
+
title: Z,
|
|
212
|
+
subtitle: "Each sub-agent handles one piece of the job. Use @ in the main instructions to call them."
|
|
241
213
|
}
|
|
242
214
|
),
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
215
|
+
width: "421px",
|
|
216
|
+
headerStyle: Yt,
|
|
217
|
+
bodyStyle: Wt,
|
|
218
|
+
onClose: A,
|
|
219
|
+
saveButtonProps: {
|
|
220
|
+
"data-test": "subagent-save",
|
|
221
|
+
buttonText: "Save",
|
|
222
|
+
buttonType: "primary",
|
|
223
|
+
size: "small",
|
|
224
|
+
disabled: !ot,
|
|
225
|
+
isLoading: J,
|
|
226
|
+
onClick: Mt
|
|
227
|
+
},
|
|
228
|
+
cancelButtonProps: {
|
|
229
|
+
"data-test": "subagent-cancel",
|
|
230
|
+
buttonText: "Cancel",
|
|
231
|
+
buttonType: "tertiaryGray",
|
|
232
|
+
size: "small",
|
|
233
|
+
onClick: A
|
|
234
|
+
},
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ c(
|
|
237
|
+
Qt,
|
|
238
|
+
{
|
|
239
|
+
"data-test": "subagent-name",
|
|
240
|
+
labelText: "Agent name",
|
|
241
|
+
labelTextBold: !0,
|
|
242
|
+
placeholder: "Enter agent name",
|
|
243
|
+
value: k,
|
|
244
|
+
maxCharLimit: h.name,
|
|
245
|
+
maxCharLimitPosition: "TOP",
|
|
246
|
+
maxCharStyle: { fontSize: 12, lineHeight: "16px" },
|
|
247
|
+
onChangeText: pt
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
/* @__PURE__ */ c(
|
|
251
|
+
ct,
|
|
252
|
+
{
|
|
253
|
+
"data-test": "subagent-instructions",
|
|
254
|
+
label: "Instructions",
|
|
255
|
+
value: T,
|
|
256
|
+
onChange: x,
|
|
257
|
+
maxLength: h.instructions,
|
|
258
|
+
placeholder: "Write the steps in plain English. Type @ to reference a tool.",
|
|
259
|
+
minHeight: "160px",
|
|
260
|
+
resetKey: `instr-${ft}`,
|
|
261
|
+
mentionItems: L,
|
|
262
|
+
tools: s,
|
|
263
|
+
toolActions: $,
|
|
264
|
+
onMentionSelect: tt,
|
|
265
|
+
onFocus: Tt,
|
|
266
|
+
registerInsert: yt,
|
|
267
|
+
action: u ? /* @__PURE__ */ c(
|
|
268
|
+
mt,
|
|
269
|
+
{
|
|
270
|
+
type: "button",
|
|
271
|
+
"data-test": "subagent-improve-instructions",
|
|
272
|
+
disabled: S !== null,
|
|
273
|
+
onClick: () => st("instructions"),
|
|
274
|
+
children: S === "instructions" ? "Improving…" : "Improve with AI"
|
|
275
|
+
}
|
|
276
|
+
) : void 0
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ c(
|
|
280
|
+
ct,
|
|
281
|
+
{
|
|
282
|
+
"data-test": "subagent-guardrail",
|
|
283
|
+
label: "Guardrails",
|
|
284
|
+
value: b,
|
|
285
|
+
onChange: R,
|
|
286
|
+
maxLength: h.guardrail,
|
|
287
|
+
placeholder: "e.g. Never discuss competitor pricing. Type @ to reference a tool.",
|
|
288
|
+
minHeight: "160px",
|
|
289
|
+
resetKey: `guard-${gt}`,
|
|
290
|
+
mentionItems: L,
|
|
291
|
+
tools: s,
|
|
292
|
+
toolActions: $,
|
|
293
|
+
onMentionSelect: tt,
|
|
294
|
+
onFocus: bt,
|
|
295
|
+
registerInsert: ht,
|
|
296
|
+
action: u ? /* @__PURE__ */ c(
|
|
297
|
+
mt,
|
|
298
|
+
{
|
|
299
|
+
type: "button",
|
|
300
|
+
"data-test": "subagent-improve-guardrail",
|
|
301
|
+
disabled: S !== null,
|
|
302
|
+
onClick: () => st("guardrail"),
|
|
303
|
+
children: S === "guardrail" ? "Improving…" : "Improve with AI"
|
|
304
|
+
}
|
|
305
|
+
) : void 0
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ c(
|
|
309
|
+
qt,
|
|
310
|
+
{
|
|
311
|
+
title: "Tools this agent can use",
|
|
312
|
+
dataTestPrefix: "subagent-tools",
|
|
313
|
+
items: Et,
|
|
314
|
+
addableOptions: Ot,
|
|
315
|
+
sourceGroups: kt,
|
|
316
|
+
mentionItems: L,
|
|
317
|
+
actionSources: $,
|
|
318
|
+
emptyText: "No tools added yet.",
|
|
319
|
+
onAdd: (t) => {
|
|
320
|
+
C(t), _((e) => it(e, t));
|
|
321
|
+
},
|
|
322
|
+
onRemove: vt
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
i?.kind === "restapi" && /* @__PURE__ */ c(
|
|
329
|
+
Zt,
|
|
330
|
+
{
|
|
331
|
+
initial: i.initialRest,
|
|
332
|
+
charLimits: h,
|
|
333
|
+
onImprove: Y,
|
|
334
|
+
onClose: () => y(null),
|
|
335
|
+
onSave: Ct,
|
|
336
|
+
zIndex: ut
|
|
337
|
+
},
|
|
338
|
+
i.key
|
|
339
|
+
),
|
|
340
|
+
i?.kind === "config" && i.toolKey && nt && /* @__PURE__ */ c(
|
|
341
|
+
jt,
|
|
342
|
+
{
|
|
343
|
+
toolKey: i.toolKey,
|
|
344
|
+
template: nt,
|
|
345
|
+
initial: i.initialConfig,
|
|
346
|
+
charLimits: h,
|
|
347
|
+
onImprove: Y,
|
|
348
|
+
onClose: () => y(null),
|
|
349
|
+
onSave: It,
|
|
350
|
+
zIndex: ut
|
|
351
|
+
},
|
|
352
|
+
i.key
|
|
353
|
+
),
|
|
354
|
+
U && /* @__PURE__ */ c(
|
|
355
|
+
Vt,
|
|
257
356
|
{
|
|
258
|
-
text:
|
|
357
|
+
text: U.message,
|
|
259
358
|
type: "info",
|
|
260
359
|
position: "top-right",
|
|
261
360
|
autoClose: 5e3,
|
|
@@ -263,15 +362,15 @@ const q = mt.button`
|
|
|
263
362
|
buttonProps: {
|
|
264
363
|
buttonText: "Undo",
|
|
265
364
|
showButton: !0,
|
|
266
|
-
onButtonClick: () => (
|
|
365
|
+
onButtonClick: () => (At(), {})
|
|
267
366
|
},
|
|
268
|
-
onCloseToast: () =>
|
|
367
|
+
onCloseToast: () => z(null)
|
|
269
368
|
},
|
|
270
|
-
|
|
369
|
+
U.id
|
|
271
370
|
)
|
|
272
371
|
] });
|
|
273
372
|
};
|
|
274
373
|
export {
|
|
275
|
-
|
|
374
|
+
Te as CreateSubAgentPanel
|
|
276
375
|
};
|
|
277
376
|
//# sourceMappingURL=CreateSubAgentPanel.js.map
|