@bikdotai/bik-component-library 0.0.830 → 0.0.831-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 +15 -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/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.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 +251 -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 +33 -0
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.js +42 -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 +76 -51
- 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 +162 -145
- 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 +270 -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 +77 -0
- package/dist/esm/components/agent-builder/constants/tools.js +34 -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/editor/extensions/mention/MentionExtension.js +60 -57
- package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/esm/index.js +97 -95
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentBuilderContext.js","sources":["../../../../../src/components/agent-builder/context/AgentBuilderContext.tsx"],"sourcesContent":["import type { ApplicationType } from '@bikdotai/bik-models/growth';\nimport React, {\n\tuseCallback,\n\tuseContext,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport {\n\tAgentTool,\n\tAgentValue,\n\tIntentOption,\n\tModelOption,\n\tStepKey,\n\tStepValidation,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { getStepIndex, STEP_KEYS } from '../constants/steps';\n\n/** Mention-capable text fields in Step 3 (both store firebase token text). */\nexport type MentionFieldKey = 'instructions' | 'guardrail';\ntype MentionInsertFn = (\n\tkind: 'tool' | 'subagent',\n\tid: string,\n\tlabel?: string,\n) => void;\n\n/** Toast shown after a tool / sub-agent is removed, offering an undo. */\nexport interface UndoToastState {\n\t/** Bumped per removal so the toast timer restarts. */\n\tid: number;\n\tmessage: string;\n}\n\nexport interface AgentBuilderContextShape {\n\t/** Controlled value relayed from props. */\n\tvalue: AgentValue;\n\t/** Patch one or more fields. */\n\tpatch: (partial: Partial<AgentValue>) => void;\n\t/** Patch a single field. */\n\tupdateField: <K extends keyof AgentValue>(key: K, val: AgentValue[K]) => void;\n\t/**\n\t * Remove a tool / sub-agent everywhere: drops it from the list AND strips ALL\n\t * its `{{tool:KEY}}` / `{{subagent:ID}}` tokens from BOTH the instructions and\n\t * the guardrails, remounts the editors, and raises an undo toast.\n\t */\n\tremoveReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/**\n\t * Append a tool / sub-agent id to its list (deduped), reading the LATEST value\n\t * via a ref. Use this instead of `patch({ tools: [...value.tools, id] })` from\n\t * any handler that may be captured with a stale `value` — notably the `@`\n\t * editor's mount-time `onSelect`, which would otherwise keep only the last pick.\n\t */\n\taddReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/** Remount signal for the mention editors after an external edit. */\n\tmentionResetKey: number;\n\t/**\n\t * Insert a tool / sub-agent mention chip at the last cursor position of\n\t * whichever mention field was focused most recently (Instructions or\n\t * Guardrails). `label` overrides the chip text (e.g. a just-created sub-agent\n\t * not yet in the available list).\n\t */\n\tinsertMention: (\n\t\tkind: 'tool' | 'subagent',\n\t\tid: string,\n\t\tlabel?: string,\n\t) => void;\n\t/** A mention field registers its editor-backed insert here (internal). */\n\tregisterMentionField: (\n\t\tfieldKey: MentionFieldKey,\n\t\tfn: MentionInsertFn | null,\n\t) => void;\n\t/** A mention field reports focus so inserts target it (internal). */\n\tnotifyMentionFocus: (fieldKey: MentionFieldKey) => void;\n\n\t// Undo (post-removal)\n\t/** Non-null while the undo toast should be visible. */\n\tundoToast: UndoToastState | null;\n\t/** Restore the last removed tool / sub-agent (list + stripped tokens). */\n\tundoRemoval: () => void;\n\t/** Dismiss the undo toast without restoring. */\n\tdismissUndo: () => void;\n\n\t// Navigation\n\tactiveStep: StepKey;\n\tactiveIndex: number;\n\tgoToStep: (step: StepKey) => void;\n\tgoNext: () => void;\n\tgoPrev: () => void;\n\tisFirstStep: boolean;\n\tisLastStep: boolean;\n\n\t// Validation\n\tvalidation: StepValidation;\n\tisActiveStepValid: boolean;\n\n\t// Reference data\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\t/** Host application context (e.g. MANIFEST) — drives tool-chip labelling. */\n\tapplicationType?: ApplicationType;\n\t/** Resolved per-field character limits (consumer overrides merged over defaults). */\n\tcharLimits: AgentCharLimits;\n\t/** When true, step-rail items are not clickable (Back / Next only). */\n\tdisableStepNavigation: boolean;\n\n\t// Sub-agent creation (Step 3 drawer)\n\t/** Persist a new sub-agent and resolve with its ref. Omit to hide the create flow. */\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/**\n\t * Step 3 registers its \"open create-sub-agent drawer\" action here so the `@`\n\t * picker's \"Create new\" row can trigger it. Pass `null` to unregister.\n\t */\n\tregisterSubAgentCreator: (fn: (() => void) | null) => void;\n\t/** Open the create-sub-agent drawer (no-op until Step 3 registers it). */\n\trequestCreateSubAgent: () => void;\n\t/** Fetch a sub-agent's editable data (Configure). Omit to hide Configure. */\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\t/** Persist edits to an existing sub-agent. */\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/** Optional \"Improve with AI\" for the drawer's instructions / guardrails. */\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n}\n\nconst AgentBuilderContext =\n\tReact.createContext<AgentBuilderContextShape | null>(null);\n\nexport const useAgentBuilderContext = (): AgentBuilderContextShape => {\n\tconst ctx = useContext(AgentBuilderContext);\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t'useAgentBuilderContext must be used within an AgentBuilderProvider',\n\t\t);\n\t}\n\treturn ctx;\n};\n\n/** Validity derived purely from the current value (no effects). */\nconst deriveValidation = (\n\tvalue: AgentValue,\n\tlimits: AgentCharLimits,\n): StepValidation => {\n\tconst triggerValid =\n\t\tvalue.trigger.mode === 'custom_intent'\n\t\t\t? (value.trigger.custom_intent ?? '').trim().length > 0\n\t\t\t: value.trigger.intents.length > 0;\n\n\treturn {\n\t\tabout:\n\t\t\tvalue.name.trim().length > 0 &&\n\t\t\tvalue.name.length <= limits.name &&\n\t\t\tvalue.description.length <= limits.description,\n\t\ttrigger: triggerValid,\n\t\t// At least one of Instructions / Guardrails must be filled.\n\t\tresponse:\n\t\t\tvalue.instructions.trim().length > 0 ||\n\t\t\t(value.guardrail ?? '').trim().length > 0,\n\t\t// Optional until specced further — never blocks go-live.\n\t\thandover: true,\n\t};\n};\n\ninterface ProviderProps {\n\tvalue: AgentValue;\n\tonChange: (patch: Partial<AgentValue>) => void;\n\tactiveStep?: StepKey;\n\tonStepChange?: (step: StepKey) => void;\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\tvalidation?: Partial<StepValidation>;\n\tapplicationType?: ApplicationType;\n\tcharLimits?: Partial<AgentCharLimits>;\n\tdisableStepNavigation?: boolean;\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\tchildren: React.ReactNode;\n}\n\nexport const AgentBuilderProvider: React.FC<ProviderProps> = ({\n\tvalue,\n\tonChange,\n\tactiveStep: controlledStep,\n\tonStepChange,\n\tavailableTools,\n\tavailableSubAgents,\n\tavailableIntents,\n\tavailableModels,\n\tvalidation: validationOverride,\n\tapplicationType,\n\tcharLimits: charLimitsOverride,\n\tdisableStepNavigation = true,\n\tonCreateSubAgent,\n\tonFetchSubAgent,\n\tonUpdateSubAgent,\n\tonImproveSubAgent,\n\tchildren,\n}) => {\n\tconst [internalStep, setInternalStep] = useState<StepKey>('about');\n\tconst activeStep = controlledStep ?? internalStep;\n\tconst activeIndex = getStepIndex(activeStep);\n\n\t// Latest value, so closure-captured handlers (e.g. the `@` editor's mount-time\n\t// mention onSelect) append against the current lists, not a stale snapshot.\n\tconst valueRef = useRef(value);\n\tvalueRef.current = value;\n\n\t// Bumped when a mention field is edited from OUTSIDE its editor (removing a\n\t// tool from the side list, undo), forcing the mention editors to remount.\n\tconst [mentionResetKey, setMentionResetKey] = useState(0);\n\n\t// Each mention field registers an editor-backed insert fn + reports focus, so\n\t// side-panel adds drop a chip into the last-focused field at its cursor.\n\tconst mentionInsertersRef = useRef<\n\t\tPartial<Record<MentionFieldKey, MentionInsertFn>>\n\t>({});\n\tconst lastFocusedFieldRef = useRef<MentionFieldKey>('instructions');\n\tconst registerMentionField = useCallback(\n\t\t(fieldKey: MentionFieldKey, fn: MentionInsertFn | null) => {\n\t\t\tif (fn) {\n\t\t\t\tmentionInsertersRef.current[fieldKey] = fn;\n\t\t\t} else {\n\t\t\t\tdelete mentionInsertersRef.current[fieldKey];\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\tconst notifyMentionFocus = useCallback((fieldKey: MentionFieldKey) => {\n\t\tlastFocusedFieldRef.current = fieldKey;\n\t}, []);\n\n\t// Step 3 registers its drawer opener here; the `@` picker's \"Create new\" calls it.\n\tconst subAgentCreatorRef = useRef<(() => void) | null>(null);\n\tconst registerSubAgentCreator = useCallback((fn: (() => void) | null) => {\n\t\tsubAgentCreatorRef.current = fn;\n\t}, []);\n\tconst requestCreateSubAgent = useCallback(() => {\n\t\tsubAgentCreatorRef.current?.();\n\t}, []);\n\tconst insertMention = useCallback<MentionInsertFn>((kind, id, label) => {\n\t\tconst inserters = mentionInsertersRef.current;\n\t\tconst target =\n\t\t\tinserters[lastFocusedFieldRef.current] ?? inserters.instructions;\n\t\ttarget?.(kind, id, label);\n\t}, []);\n\n\t// Undo state for the most recent removal.\n\tconst [undoToast, setUndoToast] = useState<UndoToastState | null>(null);\n\tconst undoSnapshotRef = useRef<Partial<AgentValue> | null>(null);\n\tconst undoIdRef = useRef(0);\n\n\tconst goToStep = useCallback(\n\t\t(step: StepKey) => {\n\t\t\tif (controlledStep === undefined) {\n\t\t\t\tsetInternalStep(step);\n\t\t\t}\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[controlledStep, onStepChange],\n\t);\n\n\tconst goNext = useCallback(() => {\n\t\tconst next = STEP_KEYS[Math.min(activeIndex + 1, STEP_KEYS.length - 1)];\n\t\tgoToStep(next);\n\t}, [activeIndex, goToStep]);\n\n\tconst goPrev = useCallback(() => {\n\t\tconst prev = STEP_KEYS[Math.max(activeIndex - 1, 0)];\n\t\tgoToStep(prev);\n\t}, [activeIndex, goToStep]);\n\n\tconst patch = useCallback(\n\t\t(partial: Partial<AgentValue>) => onChange(partial),\n\t\t[onChange],\n\t);\n\n\tconst updateField = useCallback(\n\t\t<K extends keyof AgentValue>(key: K, val: AgentValue[K]) =>\n\t\t\tonChange({ [key]: val } as Partial<AgentValue>),\n\t\t[onChange],\n\t);\n\n\tconst addReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\tconst v = valueRef.current;\n\t\t\tif (kind === 'tool') {\n\t\t\t\tif (!v.tools.includes(id)) {\n\t\t\t\t\tonChange({ tools: [...v.tools, id] });\n\t\t\t\t}\n\t\t\t} else if (!v.subagents.includes(id)) {\n\t\t\t\tonChange({ subagents: [...v.subagents, id] });\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t);\n\n\tconst removeReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\t// Tokens store the id for both kinds (a tool's id is its tool_id).\n\t\t\tconst token = kind === 'tool' ? `{{tool:${id}}}` : `{{subagent:${id}}}`;\n\t\t\tconst strip = (text: string) => text.split(token).join('');\n\n\t\t\t// Snapshot the four fields a removal touches, for undo.\n\t\t\tundoSnapshotRef.current = {\n\t\t\t\ttools: value.tools,\n\t\t\t\tsubagents: value.subagents,\n\t\t\t\tinstructions: value.instructions,\n\t\t\t\tguardrail: value.guardrail,\n\t\t\t};\n\n\t\t\tconst next: Partial<AgentValue> = {\n\t\t\t\tinstructions: strip(value.instructions),\n\t\t\t\tguardrail: strip(value.guardrail ?? ''),\n\t\t\t\t...(kind === 'tool'\n\t\t\t\t\t? { tools: value.tools.filter((t) => t !== id) }\n\t\t\t\t\t: { subagents: value.subagents.filter((s) => s !== id) }),\n\t\t\t};\n\t\t\tonChange(next);\n\t\t\tsetMentionResetKey((k) => k + 1);\n\n\t\t\tconst label =\n\t\t\t\tkind === 'tool'\n\t\t\t\t\t? availableTools.find((t) => t.tool_id === id)?.display_name ?? 'Tool'\n\t\t\t\t\t: availableSubAgents.find((s) => s.id === id)?.name ?? 'Sub-agent';\n\t\t\tundoIdRef.current += 1;\n\t\t\tsetUndoToast({\n\t\t\t\tid: undoIdRef.current,\n\t\t\t\tmessage: `${kind === 'tool' ? 'Tool' : 'Sub-agent'} \"${label}\" removed`,\n\t\t\t});\n\t\t},\n\t\t[availableTools, availableSubAgents, value, onChange],\n\t);\n\n\tconst undoRemoval = useCallback(() => {\n\t\tif (undoSnapshotRef.current) {\n\t\t\tonChange(undoSnapshotRef.current);\n\t\t\tundoSnapshotRef.current = null;\n\t\t\tsetMentionResetKey((k) => k + 1);\n\t\t}\n\t\tsetUndoToast(null);\n\t}, [onChange]);\n\n\tconst dismissUndo = useCallback(() => setUndoToast(null), []);\n\n\t// Consumer overrides merged over the built-in defaults (name 60, rest 1000).\n\tconst charLimits = useMemo<AgentCharLimits>(\n\t\t() => ({ ...AGENT_CHAR_LIMITS, ...charLimitsOverride }),\n\t\t[charLimitsOverride],\n\t);\n\n\tconst validation: StepValidation = useMemo(\n\t\t() => ({ ...deriveValidation(value, charLimits), ...validationOverride }),\n\t\t[value, charLimits, validationOverride],\n\t);\n\n\tconst ctx = useMemo<AgentBuilderContextShape>(\n\t\t() => ({\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\taddReference,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tisFirstStep: activeIndex === 0,\n\t\t\tisLastStep: activeIndex === STEP_KEYS.length - 1,\n\t\t\tvalidation,\n\t\t\tisActiveStepValid: validation[activeStep],\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tapplicationType,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t}),\n\t\t[\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\taddReference,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tvalidation,\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tapplicationType,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t],\n\t);\n\n\treturn (\n\t\t<AgentBuilderContext.Provider value={ctx}>\n\t\t\t{children}\n\t\t</AgentBuilderContext.Provider>\n\t);\n};\n"],"names":["AgentBuilderContext","React","useAgentBuilderContext","ctx","useContext","deriveValidation","value","limits","triggerValid","AgentBuilderProvider","onChange","controlledStep","onStepChange","availableTools","availableSubAgents","availableIntents","availableModels","validationOverride","applicationType","charLimitsOverride","disableStepNavigation","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","children","internalStep","setInternalStep","useState","activeStep","activeIndex","getStepIndex","valueRef","useRef","mentionResetKey","setMentionResetKey","mentionInsertersRef","lastFocusedFieldRef","registerMentionField","useCallback","fieldKey","fn","notifyMentionFocus","subAgentCreatorRef","registerSubAgentCreator","requestCreateSubAgent","insertMention","kind","id","label","inserters","undoToast","setUndoToast","undoSnapshotRef","undoIdRef","goToStep","step","goNext","next","STEP_KEYS","goPrev","prev","patch","partial","updateField","key","val","addReference","v","removeReference","token","strip","text","t","s","k","undoRemoval","dismissUndo","charLimits","useMemo","AGENT_CHAR_LIMITS","validation"],"mappings":";;;;AAoIA,MAAMA,KACLC,GAAM,cAA+C,IAAI,GAE7CC,KAAyB,MAAgC;AACrE,QAAMC,IAAMC,GAAWJ,EAAmB;AAC1C,MAAI,CAACG;AACJ,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAGF,SAAOA;AACR,GAGME,KAAmB,CACxBC,GACAC,MACoB;AACpB,QAAMC,IACLF,EAAM,QAAQ,SAAS,mBACnBA,EAAM,QAAQ,iBAAiB,IAAI,KAAA,EAAO,SAAS,IACpDA,EAAM,QAAQ,QAAQ,SAAS;AAEnC,SAAO;AAAA,IACN,OACCA,EAAM,KAAK,KAAA,EAAO,SAAS,KAC3BA,EAAM,KAAK,UAAUC,EAAO,QAC5BD,EAAM,YAAY,UAAUC,EAAO;AAAA,IACpC,SAASC;AAAA;AAAA,IAET,UACCF,EAAM,aAAa,KAAA,EAAO,SAAS,MAClCA,EAAM,aAAa,IAAI,KAAA,EAAO,SAAS;AAAA;AAAA,IAEzC,UAAU;AAAA,EAAA;AAEZ,GAyBaG,KAAgD,CAAC;AAAA,EAC7D,OAAAH;AAAA,EACA,UAAAI;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AAAA,MACAhD;AAAA,MACAC;AAAA,MACAyB;AAAA,MACAE;AAAA,MACAG;AAAA,MACAqB;AAAA,MACApE;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAE;AAAA,MACA4D;AAAA,MACA1D;AAAA,MACAC;AAAA,MACAuB;AAAA,MACAC;AAAA,MACAvB;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA;AAAA,EACD;AAGD,4BACExB,GAAoB,UAApB,EAA6B,OAAOG,IACnC,UAAAsB,IACF;AAEF;"}
|
|
1
|
+
{"version":3,"file":"AgentBuilderContext.js","sources":["../../../../../src/components/agent-builder/context/AgentBuilderContext.tsx"],"sourcesContent":["import type { ApplicationType } from '@bikdotai/bik-models/growth';\nimport React, {\n\tuseCallback,\n\tuseContext,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport {\n\tAgentTool,\n\tAgentValue,\n\tConfigToolKey,\n\tIntentOption,\n\tModelOption,\n\tParamsBlob,\n\tStepKey,\n\tStepValidation,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { getStepIndex, STEP_KEYS } from '../constants/steps';\nimport type { ToolSource } from '../constants/tools';\n\n/** Mention-capable text fields in Step 3 (both store firebase token text). */\nexport type MentionFieldKey = 'instructions' | 'guardrail';\ntype MentionInsertFn = (\n\tkind: 'tool' | 'subagent',\n\tid: string,\n\tlabel?: string,\n) => void;\n\n/** Toast shown after a tool / sub-agent is removed, offering an undo. */\nexport interface UndoToastState {\n\t/** Bumped per removal so the toast timer restarts. */\n\tid: number;\n\tmessage: string;\n}\n\nexport interface AgentBuilderContextShape {\n\t/** Controlled value relayed from props. */\n\tvalue: AgentValue;\n\t/** Patch one or more fields. */\n\tpatch: (partial: Partial<AgentValue>) => void;\n\t/** Patch a single field. */\n\tupdateField: <K extends keyof AgentValue>(key: K, val: AgentValue[K]) => void;\n\t/**\n\t * Remove a tool / sub-agent everywhere: drops it from the list AND strips ALL\n\t * its `{{tool:KEY}}` / `{{subagent:ID}}` tokens from BOTH the instructions and\n\t * the guardrails, remounts the editors, and raises an undo toast.\n\t */\n\tremoveReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/**\n\t * Append a tool / sub-agent id to its list (deduped), reading the LATEST value\n\t * via a ref. Use this instead of `patch({ tools: [...value.tools, id] })` from\n\t * any handler that may be captured with a stale `value` — notably the `@`\n\t * editor's mount-time `onSelect`, which would otherwise keep only the last pick.\n\t */\n\taddReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/** Remount signal for the mention editors after an external edit. */\n\tmentionResetKey: number;\n\t/**\n\t * Insert a tool / sub-agent mention chip at the last cursor position of\n\t * whichever mention field was focused most recently (Instructions or\n\t * Guardrails). `label` overrides the chip text (e.g. a just-created sub-agent\n\t * not yet in the available list).\n\t */\n\tinsertMention: (\n\t\tkind: 'tool' | 'subagent',\n\t\tid: string,\n\t\tlabel?: string,\n\t) => void;\n\t/** A mention field registers its editor-backed insert here (internal). */\n\tregisterMentionField: (\n\t\tfieldKey: MentionFieldKey,\n\t\tfn: MentionInsertFn | null,\n\t) => void;\n\t/** A mention field reports focus so inserts target it (internal). */\n\tnotifyMentionFocus: (fieldKey: MentionFieldKey) => void;\n\n\t// Undo (post-removal)\n\t/** Non-null while the undo toast should be visible. */\n\tundoToast: UndoToastState | null;\n\t/** Restore the last removed tool / sub-agent (list + stripped tokens). */\n\tundoRemoval: () => void;\n\t/** Dismiss the undo toast without restoring. */\n\tdismissUndo: () => void;\n\n\t// Navigation\n\tactiveStep: StepKey;\n\tactiveIndex: number;\n\tgoToStep: (step: StepKey) => void;\n\tgoNext: () => void;\n\tgoPrev: () => void;\n\tisFirstStep: boolean;\n\tisLastStep: boolean;\n\n\t// Validation\n\tvalidation: StepValidation;\n\tisActiveStepValid: boolean;\n\n\t// Reference data\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\t/**\n\t * Backend templates for the shared-drawer tools (email / Slack), keyed by\n\t * `tool_key`. A present key drives its dynamic form + enables its tool action.\n\t */\n\tconfigToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;\n\t/** Host application context (e.g. MANIFEST) — drives tool-chip labelling. */\n\tapplicationType?: ApplicationType;\n\t/** Resolved per-field character limits (consumer overrides merged over defaults). */\n\tcharLimits: AgentCharLimits;\n\t/** When true, step-rail items are not clickable (Back / Next only). */\n\tdisableStepNavigation: boolean;\n\n\t// Sub-agent creation (Step 3 drawer)\n\t/** Persist a new sub-agent and resolve with its ref. Omit to hide the create flow. */\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/**\n\t * Step 3 registers its \"open create-sub-agent drawer\" action here so the `@`\n\t * picker's \"Create new\" row can trigger it. Pass `null` to unregister.\n\t */\n\tregisterSubAgentCreator: (fn: (() => void) | null) => void;\n\t/** Open the create-sub-agent drawer (no-op until Step 3 registers it). */\n\trequestCreateSubAgent: () => void;\n\t/**\n\t * Step 3 registers its \"open the drawer for this built-in tool action\"\n\t * (Rest API / email handover / Slack) handler here so the `@` reference picker\n\t * can trigger it. Pass `null` to unregister.\n\t */\n\tregisterToolActionHandler: (\n\t\tfn: ((source: ToolSource) => void) | null,\n\t) => void;\n\t/** Open a built-in tool action's drawer (no-op until Step 3 registers it). */\n\trequestToolAction: (source: ToolSource) => void;\n\t/** Fetch a sub-agent's editable data (Configure). Omit to hide Configure. */\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\t/** Persist edits to an existing sub-agent. */\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/** Optional \"Improve with AI\" for the drawer's instructions / guardrails. */\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\t/** Optional \"Improve with AI\" for the Rest API / email-handover tool drawers. */\n\tonImproveToolInstructions?: (text: string) => Promise<string>;\n}\n\nconst AgentBuilderContext =\n\tReact.createContext<AgentBuilderContextShape | null>(null);\n\nexport const useAgentBuilderContext = (): AgentBuilderContextShape => {\n\tconst ctx = useContext(AgentBuilderContext);\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t'useAgentBuilderContext must be used within an AgentBuilderProvider',\n\t\t);\n\t}\n\treturn ctx;\n};\n\n/** Validity derived purely from the current value (no effects). */\nconst deriveValidation = (\n\tvalue: AgentValue,\n\tlimits: AgentCharLimits,\n): StepValidation => {\n\tconst triggerValid =\n\t\tvalue.trigger.mode === 'custom_intent'\n\t\t\t? (value.trigger.custom_intent ?? '').trim().length > 0\n\t\t\t: value.trigger.intents.length > 0;\n\n\treturn {\n\t\tabout:\n\t\t\tvalue.name.trim().length > 0 &&\n\t\t\tvalue.name.length <= limits.name &&\n\t\t\tvalue.description.length <= limits.description,\n\t\ttrigger: triggerValid,\n\t\t// At least one of Instructions / Guardrails must be filled.\n\t\tresponse:\n\t\t\tvalue.instructions.trim().length > 0 ||\n\t\t\t(value.guardrail ?? '').trim().length > 0,\n\t\t// Optional until specced further — never blocks go-live.\n\t\thandover: true,\n\t};\n};\n\ninterface ProviderProps {\n\tvalue: AgentValue;\n\tonChange: (patch: Partial<AgentValue>) => void;\n\tactiveStep?: StepKey;\n\tonStepChange?: (step: StepKey) => void;\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\tconfigToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;\n\tvalidation?: Partial<StepValidation>;\n\tapplicationType?: ApplicationType;\n\tcharLimits?: Partial<AgentCharLimits>;\n\tdisableStepNavigation?: boolean;\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\tonImproveToolInstructions?: (text: string) => Promise<string>;\n\tchildren: React.ReactNode;\n}\n\nexport const AgentBuilderProvider: React.FC<ProviderProps> = ({\n\tvalue,\n\tonChange,\n\tactiveStep: controlledStep,\n\tonStepChange,\n\tavailableTools,\n\tavailableSubAgents,\n\tavailableIntents,\n\tavailableModels,\n\tconfigToolTemplates,\n\tvalidation: validationOverride,\n\tapplicationType,\n\tcharLimits: charLimitsOverride,\n\tdisableStepNavigation = true,\n\tonCreateSubAgent,\n\tonFetchSubAgent,\n\tonUpdateSubAgent,\n\tonImproveSubAgent,\n\tonImproveToolInstructions,\n\tchildren,\n}) => {\n\tconst [internalStep, setInternalStep] = useState<StepKey>('about');\n\tconst activeStep = controlledStep ?? internalStep;\n\tconst activeIndex = getStepIndex(activeStep);\n\n\t// Latest value, so closure-captured handlers (e.g. the `@` editor's mount-time\n\t// mention onSelect) append against the current lists, not a stale snapshot.\n\tconst valueRef = useRef(value);\n\tvalueRef.current = value;\n\n\t// Bumped when a mention field is edited from OUTSIDE its editor (removing a\n\t// tool from the side list, undo), forcing the mention editors to remount.\n\tconst [mentionResetKey, setMentionResetKey] = useState(0);\n\n\t// Each mention field registers an editor-backed insert fn + reports focus, so\n\t// side-panel adds drop a chip into the last-focused field at its cursor.\n\tconst mentionInsertersRef = useRef<\n\t\tPartial<Record<MentionFieldKey, MentionInsertFn>>\n\t>({});\n\tconst lastFocusedFieldRef = useRef<MentionFieldKey>('instructions');\n\tconst registerMentionField = useCallback(\n\t\t(fieldKey: MentionFieldKey, fn: MentionInsertFn | null) => {\n\t\t\tif (fn) {\n\t\t\t\tmentionInsertersRef.current[fieldKey] = fn;\n\t\t\t} else {\n\t\t\t\tdelete mentionInsertersRef.current[fieldKey];\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\tconst notifyMentionFocus = useCallback((fieldKey: MentionFieldKey) => {\n\t\tlastFocusedFieldRef.current = fieldKey;\n\t}, []);\n\n\t// Step 3 registers its drawer opener here; the `@` picker's \"Create new\" calls it.\n\tconst subAgentCreatorRef = useRef<(() => void) | null>(null);\n\tconst registerSubAgentCreator = useCallback((fn: (() => void) | null) => {\n\t\tsubAgentCreatorRef.current = fn;\n\t}, []);\n\tconst requestCreateSubAgent = useCallback(() => {\n\t\tsubAgentCreatorRef.current?.();\n\t}, []);\n\n\t// Step 3 registers a dispatcher that opens a built-in tool action's drawer.\n\tconst toolActionHandlerRef = useRef<((source: ToolSource) => void) | null>(\n\t\tnull,\n\t);\n\tconst registerToolActionHandler = useCallback(\n\t\t(fn: ((source: ToolSource) => void) | null) => {\n\t\t\ttoolActionHandlerRef.current = fn;\n\t\t},\n\t\t[],\n\t);\n\tconst requestToolAction = useCallback((source: ToolSource) => {\n\t\ttoolActionHandlerRef.current?.(source);\n\t}, []);\n\tconst insertMention = useCallback<MentionInsertFn>((kind, id, label) => {\n\t\tconst inserters = mentionInsertersRef.current;\n\t\tconst target =\n\t\t\tinserters[lastFocusedFieldRef.current] ?? inserters.instructions;\n\t\ttarget?.(kind, id, label);\n\t}, []);\n\n\t// Undo state for the most recent removal.\n\tconst [undoToast, setUndoToast] = useState<UndoToastState | null>(null);\n\tconst undoSnapshotRef = useRef<Partial<AgentValue> | null>(null);\n\tconst undoIdRef = useRef(0);\n\n\tconst goToStep = useCallback(\n\t\t(step: StepKey) => {\n\t\t\tif (controlledStep === undefined) {\n\t\t\t\tsetInternalStep(step);\n\t\t\t}\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[controlledStep, onStepChange],\n\t);\n\n\tconst goNext = useCallback(() => {\n\t\tconst next = STEP_KEYS[Math.min(activeIndex + 1, STEP_KEYS.length - 1)];\n\t\tgoToStep(next);\n\t}, [activeIndex, goToStep]);\n\n\tconst goPrev = useCallback(() => {\n\t\tconst prev = STEP_KEYS[Math.max(activeIndex - 1, 0)];\n\t\tgoToStep(prev);\n\t}, [activeIndex, goToStep]);\n\n\tconst patch = useCallback(\n\t\t(partial: Partial<AgentValue>) => onChange(partial),\n\t\t[onChange],\n\t);\n\n\tconst updateField = useCallback(\n\t\t<K extends keyof AgentValue>(key: K, val: AgentValue[K]) =>\n\t\t\tonChange({ [key]: val } as Partial<AgentValue>),\n\t\t[onChange],\n\t);\n\n\tconst addReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\tconst v = valueRef.current;\n\t\t\tif (kind === 'tool') {\n\t\t\t\tif (!v.tools.includes(id)) {\n\t\t\t\t\tonChange({ tools: [...v.tools, id] });\n\t\t\t\t}\n\t\t\t} else if (!v.subagents.includes(id)) {\n\t\t\t\tonChange({ subagents: [...v.subagents, id] });\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t);\n\n\tconst removeReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\t// Tokens store the id for both kinds (a tool's id is its tool_id).\n\t\t\tconst token = kind === 'tool' ? `{{tool:${id}}}` : `{{subagent:${id}}}`;\n\t\t\tconst strip = (text: string) => text.split(token).join('');\n\n\t\t\t// Snapshot every field a removal touches, for undo. Custom tools (Rest\n\t\t\t// API / email / Slack) live on their own lists, so include them too.\n\t\t\tundoSnapshotRef.current = {\n\t\t\t\ttools: value.tools,\n\t\t\t\tsubagents: value.subagents,\n\t\t\t\tconfigTools: value.configTools,\n\t\t\t\trestApiTools: value.restApiTools,\n\t\t\t\tinstructions: value.instructions,\n\t\t\t\tguardrail: value.guardrail,\n\t\t\t};\n\n\t\t\tconst next: Partial<AgentValue> = {\n\t\t\t\tinstructions: strip(value.instructions),\n\t\t\t\tguardrail: strip(value.guardrail ?? ''),\n\t\t\t\t...(kind === 'tool'\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t// A tool id may be a catalog tool OR an inline custom tool — drop\n\t\t\t\t\t\t\t// it from whichever list holds it (the others are no-op filters).\n\t\t\t\t\t\t\ttools: value.tools.filter((t) => t !== id),\n\t\t\t\t\t\t\tconfigTools: (value.configTools ?? []).filter((t) => t.id !== id),\n\t\t\t\t\t\t\trestApiTools: (value.restApiTools ?? []).filter(\n\t\t\t\t\t\t\t\t(t) => t.id !== id,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t }\n\t\t\t\t\t: { subagents: value.subagents.filter((s) => s !== id) }),\n\t\t\t};\n\t\t\tonChange(next);\n\t\t\tsetMentionResetKey((k) => k + 1);\n\n\t\t\tconst label =\n\t\t\t\tkind === 'tool'\n\t\t\t\t\t? availableTools.find((t) => t.tool_id === id)?.display_name ??\n\t\t\t\t\t (value.restApiTools ?? []).find((t) => t.id === id)?.name ??\n\t\t\t\t\t 'Tool'\n\t\t\t\t\t: availableSubAgents.find((s) => s.id === id)?.name ?? 'Sub-agent';\n\t\t\tundoIdRef.current += 1;\n\t\t\tsetUndoToast({\n\t\t\t\tid: undoIdRef.current,\n\t\t\t\tmessage: `${kind === 'tool' ? 'Tool' : 'Sub-agent'} \"${label}\" removed`,\n\t\t\t});\n\t\t},\n\t\t[availableTools, availableSubAgents, value, onChange],\n\t);\n\n\tconst undoRemoval = useCallback(() => {\n\t\tif (undoSnapshotRef.current) {\n\t\t\tonChange(undoSnapshotRef.current);\n\t\t\tundoSnapshotRef.current = null;\n\t\t\tsetMentionResetKey((k) => k + 1);\n\t\t}\n\t\tsetUndoToast(null);\n\t}, [onChange]);\n\n\tconst dismissUndo = useCallback(() => setUndoToast(null), []);\n\n\t// Consumer overrides merged over the built-in defaults (name 60, rest 1000).\n\tconst charLimits = useMemo<AgentCharLimits>(\n\t\t() => ({ ...AGENT_CHAR_LIMITS, ...charLimitsOverride }),\n\t\t[charLimitsOverride],\n\t);\n\n\tconst validation: StepValidation = useMemo(\n\t\t() => ({ ...deriveValidation(value, charLimits), ...validationOverride }),\n\t\t[value, charLimits, validationOverride],\n\t);\n\n\tconst ctx = useMemo<AgentBuilderContextShape>(\n\t\t() => ({\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\taddReference,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tisFirstStep: activeIndex === 0,\n\t\t\tisLastStep: activeIndex === STEP_KEYS.length - 1,\n\t\t\tvalidation,\n\t\t\tisActiveStepValid: validation[activeStep],\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tconfigToolTemplates,\n\t\t\tapplicationType,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tregisterToolActionHandler,\n\t\t\trequestToolAction,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t\tonImproveToolInstructions,\n\t\t}),\n\t\t[\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\taddReference,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tvalidation,\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tconfigToolTemplates,\n\t\t\tapplicationType,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tregisterToolActionHandler,\n\t\t\trequestToolAction,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t\tonImproveToolInstructions,\n\t\t],\n\t);\n\n\treturn (\n\t\t<AgentBuilderContext.Provider value={ctx}>\n\t\t\t{children}\n\t\t</AgentBuilderContext.Provider>\n\t);\n};\n"],"names":["AgentBuilderContext","React","useAgentBuilderContext","ctx","useContext","deriveValidation","value","limits","triggerValid","AgentBuilderProvider","onChange","controlledStep","onStepChange","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","validationOverride","applicationType","charLimitsOverride","disableStepNavigation","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","children","internalStep","setInternalStep","useState","activeStep","activeIndex","getStepIndex","valueRef","useRef","mentionResetKey","setMentionResetKey","mentionInsertersRef","lastFocusedFieldRef","registerMentionField","useCallback","fieldKey","fn","notifyMentionFocus","subAgentCreatorRef","registerSubAgentCreator","requestCreateSubAgent","toolActionHandlerRef","registerToolActionHandler","requestToolAction","source","insertMention","kind","id","label","inserters","undoToast","setUndoToast","undoSnapshotRef","undoIdRef","goToStep","step","goNext","next","STEP_KEYS","goPrev","prev","patch","partial","updateField","key","val","addReference","v","removeReference","token","strip","text","t","k","undoRemoval","dismissUndo","charLimits","useMemo","AGENT_CHAR_LIMITS","validation"],"mappings":";;;;AAwJA,MAAMA,KACLC,GAAM,cAA+C,IAAI,GAE7CC,KAAyB,MAAgC;AACrE,QAAMC,IAAMC,GAAWJ,EAAmB;AAC1C,MAAI,CAACG;AACJ,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAGF,SAAOA;AACR,GAGME,KAAmB,CACxBC,GACAC,MACoB;AACpB,QAAMC,IACLF,EAAM,QAAQ,SAAS,mBACnBA,EAAM,QAAQ,iBAAiB,IAAI,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MACAC;AAAA,MACAC;AAAA,MACAE;AAAA,MACAgE;AAAA,MACA9D;AAAA,MACAC;AAAA,MACAwB;AAAA,MACAC;AAAA,MACAE;AAAA,MACAC;AAAA,MACA3B;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA;AAAA,EACD;AAGD,4BACE1B,GAAoB,UAApB,EAA6B,OAAOG,IACnC,UAAAwB,IACF;AAEF;"}
|
|
@@ -4,5 +4,6 @@ export type { AgentDraft } from './hooks/useAgentDraft';
|
|
|
4
4
|
export { AGENT_CHAR_LIMITS } from './constants/charLimits';
|
|
5
5
|
export type { AgentCharLimits } from './constants/charLimits';
|
|
6
6
|
export { STEP_DEFINITIONS } from './constants/steps';
|
|
7
|
+
export { ToolSource } from './constants/tools';
|
|
7
8
|
export { buildAgentMentionItems, editorDocToInstructions, instructionsToEditorHtml, } from './utils/mentionSerialization';
|
|
8
|
-
export type { AgentBuilderProps, AgentBuilderConfig, AgentValue, AgentStatus as AgentBuilderStatus, StepKey, StepValidation, TriggerMode, AgentTriggerValue, AgentHandoverConfig, HandoverMethod, AgentTool, SubAgentRef, SubAgentDraft, IntentOption, ModelOption, } from './AgentBuilder.model';
|
|
9
|
+
export type { AgentBuilderProps, AgentBuilderConfig, AgentValue, AgentStatus as AgentBuilderStatus, StepKey, StepValidation, TriggerMode, AgentTriggerValue, AgentHandoverConfig, HandoverMethod, AgentTool, SubAgentRef, SubAgentDraft, IntentOption, ModelOption, RestApiToolConfig, RestApiMethod, RestApiHeader, ConfigToolConfig, ConfigToolKey, ParamField, ParamsBlob, ToolRef, CatalogTool, CustomTool, } from './AgentBuilder.model';
|
|
@@ -1,225 +1,325 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { TitleSmall as
|
|
4
|
-
import { COLORS as
|
|
5
|
-
import { Step3Root as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsxs as T, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useRef as j, useCallback as r, useEffect as W } from "react";
|
|
3
|
+
import { TitleSmall as $ } from "../../TypographyStyle.js";
|
|
4
|
+
import { COLORS as z } from "../../../constants/Theme.js";
|
|
5
|
+
import { Step3Root as ve, Step3Grid as Ie, SectionBodyWrap as V, Step3Divider as Ce, SideSection as Oe } from "../AgentBuilder.styled.js";
|
|
6
|
+
import { ConfigToolPanel as we } from "../components/ConfigToolPanel.js";
|
|
7
|
+
import { CreateSubAgentPanel as Re } from "../components/CreateSubAgentPanel.js";
|
|
8
|
+
import { MentionField as q } from "../components/MentionField.js";
|
|
9
|
+
import { RestApiToolPanel as ke } from "../components/RestApiToolPanel.js";
|
|
10
|
+
import { SelectableListSection as J } from "../components/SelectableListSection.js";
|
|
11
|
+
import { StepSectionHeader as _e } from "../components/StepSectionHeader.js";
|
|
12
|
+
import { STEP_DEFINITIONS as Ee } from "../constants/steps.js";
|
|
13
|
+
import { CONFIG_TOOL_SOURCES as Q, ToolSource as g, TOOL_ACTION_SOURCES as Le, TOOL_SOURCE_LABELS as Me } from "../constants/tools.js";
|
|
14
|
+
import { useAgentBuilderContext as xe } from "../context/AgentBuilderContext.js";
|
|
15
|
+
import { restApiMentionItem as Ke, configToolMentionItem as Ne, restApiToolName as Pe, configToolName as De, toolSourceLabel as He, buildAgentMentionItems as X, appTypeLabel as Y } from "../utils/mentionSerialization.js";
|
|
16
|
+
import { sourceIcon as te, SOURCE_ICONS as P, renderSourceIcon as Be } from "../utils/sourceIcons.js";
|
|
17
|
+
import { Dropdown as Fe } from "../../dropdown/Dropdown.js";
|
|
18
|
+
import { unwrapDropdownValue as Ge } from "../../dropdown/utils.js";
|
|
19
|
+
const Ue = (t) => Be(te(t)) ?? void 0, Z = (t) => ({
|
|
20
|
+
label: t.display_name,
|
|
21
|
+
value: t.tool_id,
|
|
22
|
+
leadingIcon: Ue(t.source ?? g.Manifest)
|
|
23
|
+
}), ee = Ee[2], oe = (t, i) => {
|
|
24
|
+
const f = t ?? [];
|
|
25
|
+
return f.some((c) => c.id === i.id) ? f.map((c) => c.id === i.id ? i : c) : [...f, i];
|
|
26
|
+
}, so = () => {
|
|
21
27
|
const {
|
|
22
|
-
value:
|
|
23
|
-
patch:
|
|
24
|
-
updateField:
|
|
25
|
-
addReference:
|
|
26
|
-
removeReference:
|
|
27
|
-
availableTools:
|
|
28
|
-
availableSubAgents:
|
|
29
|
-
availableModels:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
value: t,
|
|
29
|
+
patch: i,
|
|
30
|
+
updateField: f,
|
|
31
|
+
addReference: c,
|
|
32
|
+
removeReference: D,
|
|
33
|
+
availableTools: b,
|
|
34
|
+
availableSubAgents: ne,
|
|
35
|
+
availableModels: C,
|
|
36
|
+
configToolTemplates: O,
|
|
37
|
+
applicationType: H,
|
|
38
|
+
charLimits: S,
|
|
39
|
+
insertMention: s,
|
|
40
|
+
onCreateSubAgent: p,
|
|
41
|
+
onFetchSubAgent: h,
|
|
42
|
+
onUpdateSubAgent: w,
|
|
43
|
+
onImproveSubAgent: le,
|
|
44
|
+
onImproveToolInstructions: R,
|
|
45
|
+
registerSubAgentCreator: k,
|
|
46
|
+
registerToolActionHandler: _
|
|
47
|
+
} = xe(), [d, y] = N(null), A = j(0), [a, u] = N(null), v = j(0), E = r((e) => {
|
|
48
|
+
v.current += 1, u({
|
|
49
|
+
key: v.current,
|
|
50
|
+
kind: "restapi",
|
|
51
|
+
initialRest: e
|
|
52
|
+
});
|
|
53
|
+
}, []), L = r(
|
|
54
|
+
(e, o) => {
|
|
55
|
+
v.current += 1, u({
|
|
56
|
+
key: v.current,
|
|
57
|
+
kind: "config",
|
|
58
|
+
toolKey: e,
|
|
59
|
+
initialConfig: o
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
[]
|
|
63
|
+
), ie = r(
|
|
64
|
+
(e) => {
|
|
65
|
+
const o = !(t.restApiTools ?? []).some((n) => n.id === e.id);
|
|
66
|
+
i({ restApiTools: oe(t.restApiTools, e) }), o && s("tool", e.id, Ke(e).label), u(null);
|
|
67
|
+
},
|
|
68
|
+
[i, t.restApiTools, s]
|
|
69
|
+
), ae = r(
|
|
70
|
+
(e) => {
|
|
71
|
+
const o = !(t.configTools ?? []).some((n) => n.id === e.id);
|
|
72
|
+
i({ configTools: oe(t.configTools, e) }), o && s("tool", e.id, Ne(e).label), u(null);
|
|
73
|
+
},
|
|
74
|
+
[i, t.configTools, s]
|
|
75
|
+
), M = r(
|
|
76
|
+
(e) => {
|
|
77
|
+
const o = Q[e];
|
|
78
|
+
o ? L(o) : E();
|
|
79
|
+
},
|
|
80
|
+
[L, E]
|
|
81
|
+
);
|
|
82
|
+
W(() => (_(M), () => _(null)), [_, M]);
|
|
83
|
+
const [se, B] = N([]), I = /* @__PURE__ */ new Map();
|
|
84
|
+
ne.forEach((e) => I.set(e.id, e)), se.forEach((e) => I.set(e.id, e));
|
|
85
|
+
const F = Array.from(I.values()), x = r(() => {
|
|
86
|
+
A.current += 1, y({ key: A.current, title: "Create sub-agent" });
|
|
42
87
|
}, []);
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
46
|
-
}, [
|
|
47
|
-
const
|
|
88
|
+
W(() => {
|
|
89
|
+
if (p)
|
|
90
|
+
return k(x), () => k(null);
|
|
91
|
+
}, [k, x, p]);
|
|
92
|
+
const re = r(
|
|
48
93
|
async (e) => {
|
|
49
|
-
if (!
|
|
94
|
+
if (!h)
|
|
50
95
|
return;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
key:
|
|
96
|
+
const o = await h(e);
|
|
97
|
+
A.current += 1, y({
|
|
98
|
+
key: A.current,
|
|
54
99
|
title: "Edit sub-agent",
|
|
55
100
|
editingId: e,
|
|
56
|
-
initial:
|
|
101
|
+
initial: o
|
|
57
102
|
});
|
|
58
103
|
},
|
|
59
|
-
[
|
|
60
|
-
),
|
|
104
|
+
[h]
|
|
105
|
+
), ce = r(
|
|
61
106
|
async (e) => {
|
|
62
|
-
if (
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
...n.filter((
|
|
67
|
-
|
|
107
|
+
if (d?.editingId) {
|
|
108
|
+
if (w) {
|
|
109
|
+
const o = await w(d.editingId, e);
|
|
110
|
+
B((n) => [
|
|
111
|
+
...n.filter((m) => m.id !== o.id),
|
|
112
|
+
o
|
|
68
113
|
]);
|
|
69
114
|
}
|
|
70
|
-
} else if (
|
|
71
|
-
const
|
|
72
|
-
|
|
115
|
+
} else if (p) {
|
|
116
|
+
const o = await p(e);
|
|
117
|
+
B((n) => [...n, o]), i({ subagents: [...t.subagents, o.id] }), s("subagent", o.id, `sub-agent: ${o.name}`);
|
|
73
118
|
}
|
|
74
|
-
|
|
119
|
+
y(null);
|
|
75
120
|
},
|
|
76
121
|
[
|
|
77
|
-
|
|
78
|
-
|
|
122
|
+
d,
|
|
123
|
+
w,
|
|
124
|
+
p,
|
|
79
125
|
i,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
d
|
|
126
|
+
t.subagents,
|
|
127
|
+
s
|
|
83
128
|
]
|
|
84
|
-
),
|
|
85
|
-
const
|
|
86
|
-
return
|
|
129
|
+
), de = t.tools.map((e) => {
|
|
130
|
+
const o = b.find((n) => n.tool_id === e);
|
|
131
|
+
return o ? {
|
|
87
132
|
id: e,
|
|
88
|
-
label:
|
|
89
|
-
icon:
|
|
133
|
+
label: o.display_name,
|
|
134
|
+
icon: te(o.source ?? g.Manifest)
|
|
90
135
|
} : null;
|
|
91
|
-
}).filter((e) => e !== null),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
136
|
+
}).filter((e) => e !== null), pe = (t.restApiTools ?? []).map(
|
|
137
|
+
(e) => ({
|
|
138
|
+
id: e.id,
|
|
139
|
+
label: Pe(e),
|
|
140
|
+
icon: P[g.RestApi],
|
|
141
|
+
onConfigure: () => E(e)
|
|
142
|
+
})
|
|
143
|
+
), ue = (t.configTools ?? []).map(
|
|
144
|
+
(e) => ({
|
|
145
|
+
id: e.id,
|
|
146
|
+
label: De(e),
|
|
147
|
+
icon: P[e.tool_key === "send_slack_message" ? g.Slack : g.EmailHandover],
|
|
148
|
+
onConfigure: () => L(e.tool_key, e)
|
|
149
|
+
})
|
|
150
|
+
), me = [
|
|
151
|
+
...de,
|
|
152
|
+
...pe,
|
|
153
|
+
...ue
|
|
154
|
+
], ge = Le.filter(
|
|
155
|
+
(e) => {
|
|
156
|
+
const o = Q[e];
|
|
157
|
+
return !o || !!O?.[o];
|
|
158
|
+
}
|
|
159
|
+
).map((e) => ({
|
|
160
|
+
source: e,
|
|
161
|
+
label: Me[e],
|
|
162
|
+
icon: P[e],
|
|
163
|
+
onSelect: () => M(e)
|
|
164
|
+
})), fe = b.map(Z), be = (() => {
|
|
165
|
+
const e = [], o = /* @__PURE__ */ new Map();
|
|
166
|
+
return b.forEach((n) => {
|
|
167
|
+
const m = n.source ?? g.Manifest;
|
|
168
|
+
o.has(m) || (o.set(m, []), e.push(m)), o.get(m)?.push(Z(n));
|
|
96
169
|
}), e.map((n) => ({
|
|
97
170
|
source: n,
|
|
98
|
-
label:
|
|
99
|
-
options:
|
|
171
|
+
label: He(n),
|
|
172
|
+
options: o.get(n) ?? []
|
|
100
173
|
}));
|
|
101
|
-
})(),
|
|
102
|
-
const
|
|
103
|
-
return
|
|
104
|
-
}).filter((e) => e !== null),
|
|
174
|
+
})(), Se = t.subagents.map((e) => {
|
|
175
|
+
const o = I.get(e);
|
|
176
|
+
return o ? { id: e, label: o.name } : null;
|
|
177
|
+
}).filter((e) => e !== null), Te = F.map((e) => ({
|
|
105
178
|
label: e.name,
|
|
106
179
|
value: e.id
|
|
107
|
-
})),
|
|
180
|
+
})), G = Y(H), he = X(b, [], G), ye = X(
|
|
108
181
|
[],
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
),
|
|
182
|
+
F,
|
|
183
|
+
G
|
|
184
|
+
), Ae = C.map((e) => ({
|
|
112
185
|
label: e.label,
|
|
113
186
|
value: e.value,
|
|
114
|
-
selected: e.value ===
|
|
115
|
-
})),
|
|
116
|
-
return /* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
|
|
187
|
+
selected: e.value === t.model
|
|
188
|
+
})), K = C.find((e) => e.value === t.model), U = a?.kind === "config" && a.toolKey ? O?.[a.toolKey] : void 0;
|
|
189
|
+
return /* @__PURE__ */ T(ve, { children: [
|
|
190
|
+
/* @__PURE__ */ l(_e, { title: ee.title, helper: ee.helper }),
|
|
191
|
+
/* @__PURE__ */ T(Ie, { $grow: !0, children: [
|
|
192
|
+
/* @__PURE__ */ T(V, { children: [
|
|
193
|
+
/* @__PURE__ */ l(
|
|
194
|
+
q,
|
|
122
195
|
{
|
|
123
196
|
fieldKey: "instructions",
|
|
124
197
|
"data-test": "agent-instructions",
|
|
125
198
|
label: "Instructions",
|
|
126
|
-
maxLength:
|
|
199
|
+
maxLength: S.instructions,
|
|
127
200
|
placeholder: "Write what this agent should do. Type @ to reference a tool or sub-agent.",
|
|
128
201
|
minHeight: "200px"
|
|
129
202
|
}
|
|
130
203
|
),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
|
|
204
|
+
/* @__PURE__ */ l(
|
|
205
|
+
q,
|
|
133
206
|
{
|
|
134
207
|
fieldKey: "guardrail",
|
|
135
208
|
"data-test": "agent-guardrail",
|
|
136
209
|
label: "Guardrails",
|
|
137
|
-
maxLength:
|
|
210
|
+
maxLength: S.guardrail,
|
|
138
211
|
placeholder: "Things this agent must never do. Type @ to reference a tool or sub-agent.",
|
|
139
212
|
minHeight: "140px"
|
|
140
213
|
}
|
|
141
214
|
)
|
|
142
215
|
] }),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
|
|
216
|
+
/* @__PURE__ */ l(Ce, {}),
|
|
217
|
+
/* @__PURE__ */ T(V, { children: [
|
|
218
|
+
/* @__PURE__ */ l(
|
|
219
|
+
J,
|
|
147
220
|
{
|
|
148
221
|
title: "Tools",
|
|
149
222
|
helper: "Actions this agent can take while responding.",
|
|
150
223
|
dataTestPrefix: "agent-tools",
|
|
151
|
-
items:
|
|
152
|
-
addableOptions:
|
|
153
|
-
sourceGroups:
|
|
154
|
-
mentionItems:
|
|
224
|
+
items: me,
|
|
225
|
+
addableOptions: fe,
|
|
226
|
+
sourceGroups: be,
|
|
227
|
+
mentionItems: he,
|
|
228
|
+
actionSources: ge,
|
|
155
229
|
emptyText: "No tools added yet.",
|
|
156
230
|
onAdd: (e) => {
|
|
157
|
-
|
|
231
|
+
s("tool", e), c("tool", e);
|
|
158
232
|
},
|
|
159
|
-
onRemove: (e) =>
|
|
233
|
+
onRemove: (e) => D("tool", e)
|
|
160
234
|
}
|
|
161
235
|
),
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
|
|
236
|
+
/* @__PURE__ */ l(
|
|
237
|
+
J,
|
|
164
238
|
{
|
|
165
239
|
title: "Sub-agents",
|
|
166
240
|
helper: "Other agents this agent can hand off the conversation to.",
|
|
167
241
|
dataTestPrefix: "agent-subagents",
|
|
168
|
-
items:
|
|
169
|
-
addableOptions:
|
|
170
|
-
mentionItems:
|
|
242
|
+
items: Se,
|
|
243
|
+
addableOptions: Te,
|
|
244
|
+
mentionItems: ye,
|
|
171
245
|
emptyText: "No sub-agents added yet.",
|
|
172
246
|
onAdd: (e) => {
|
|
173
|
-
|
|
247
|
+
s("subagent", e), c("subagent", e);
|
|
174
248
|
},
|
|
175
|
-
onRemove: (e) =>
|
|
176
|
-
onConfigure:
|
|
177
|
-
createOption:
|
|
249
|
+
onRemove: (e) => D("subagent", e),
|
|
250
|
+
onConfigure: h ? re : void 0,
|
|
251
|
+
createOption: p ? { label: "Create new", onSelect: x } : void 0
|
|
178
252
|
}
|
|
179
253
|
),
|
|
180
|
-
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
|
|
254
|
+
C.length > 0 && /* @__PURE__ */ T(Oe, { children: [
|
|
255
|
+
/* @__PURE__ */ l($, { color: z.content.primary, children: "Advanced settings" }),
|
|
256
|
+
/* @__PURE__ */ l($, { color: z.content.secondary, children: "Select AI model" }),
|
|
257
|
+
/* @__PURE__ */ l(
|
|
258
|
+
Fe,
|
|
185
259
|
{
|
|
186
260
|
"data-test": "agent-model",
|
|
187
261
|
size: "small",
|
|
188
262
|
width: "100%",
|
|
189
263
|
placeHolder: "Select model",
|
|
190
|
-
options:
|
|
191
|
-
defaultOptions:
|
|
264
|
+
options: Ae,
|
|
265
|
+
defaultOptions: K ? [
|
|
192
266
|
{
|
|
193
|
-
label:
|
|
194
|
-
value:
|
|
267
|
+
label: K.label,
|
|
268
|
+
value: K.value
|
|
195
269
|
}
|
|
196
270
|
] : void 0,
|
|
197
271
|
onSelect: (e) => {
|
|
198
|
-
const
|
|
199
|
-
|
|
272
|
+
const o = Ge(e);
|
|
273
|
+
o && f("model", o);
|
|
200
274
|
}
|
|
201
275
|
}
|
|
202
276
|
)
|
|
203
277
|
] })
|
|
204
278
|
] })
|
|
205
279
|
] }),
|
|
206
|
-
|
|
207
|
-
|
|
280
|
+
d && /* @__PURE__ */ l(
|
|
281
|
+
Re,
|
|
282
|
+
{
|
|
283
|
+
title: d.title,
|
|
284
|
+
initial: d.initial,
|
|
285
|
+
availableTools: b,
|
|
286
|
+
configToolTemplates: O,
|
|
287
|
+
appLabel: Y(H),
|
|
288
|
+
charLimits: S,
|
|
289
|
+
onImprove: le,
|
|
290
|
+
onImproveToolInstructions: R,
|
|
291
|
+
onClose: () => y(null),
|
|
292
|
+
onSave: ce
|
|
293
|
+
},
|
|
294
|
+
d.key
|
|
295
|
+
),
|
|
296
|
+
a?.kind === "restapi" && /* @__PURE__ */ l(
|
|
297
|
+
ke,
|
|
298
|
+
{
|
|
299
|
+
initial: a.initialRest,
|
|
300
|
+
charLimits: S,
|
|
301
|
+
onImprove: R,
|
|
302
|
+
onClose: () => u(null),
|
|
303
|
+
onSave: ie
|
|
304
|
+
},
|
|
305
|
+
a.key
|
|
306
|
+
),
|
|
307
|
+
a?.kind === "config" && a.toolKey && U && /* @__PURE__ */ l(
|
|
308
|
+
we,
|
|
208
309
|
{
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
onSave: $
|
|
310
|
+
toolKey: a.toolKey,
|
|
311
|
+
template: U,
|
|
312
|
+
initial: a.initialConfig,
|
|
313
|
+
charLimits: S,
|
|
314
|
+
onImprove: R,
|
|
315
|
+
onClose: () => u(null),
|
|
316
|
+
onSave: ae
|
|
217
317
|
},
|
|
218
|
-
|
|
318
|
+
a.key
|
|
219
319
|
)
|
|
220
320
|
] });
|
|
221
321
|
};
|
|
222
322
|
export {
|
|
223
|
-
|
|
323
|
+
so as Step3HowItResponds
|
|
224
324
|
};
|
|
225
325
|
//# sourceMappingURL=Step3HowItResponds.js.map
|