Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Props = {
onComplete: (message: string) => void;
onCancel: () => void;
};
export function CreateAgentWizard(t0) {
export function CreateAgentWizard(t0: Props): React.ReactNode {
const $ = _c(17);
const {
tools,
Expand Down Expand Up @@ -77,14 +77,14 @@ export function CreateAgentWizard(t0) {
const steps = t5;
let t6;
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
t6 = {};
t6 = {} as AgentWizardData;
$[13] = t6;
} else {
t6 = $[13];
}
let t7;
if ($[14] !== onCancel || $[15] !== steps) {
t7 = <WizardProvider steps={steps} initialData={t6} onComplete={_temp} onCancel={onCancel} title="Create new agent" showStepCounter={false} />;
t7 = <WizardProvider<AgentWizardData> steps={steps} initialData={t6} onComplete={_temp} onCancel={onCancel} title="Create new agent" showStepCounter={false} />;
$[14] = onCancel;
$[15] = steps;
$[16] = t7;
Expand Down
27 changes: 27 additions & 0 deletions src/components/agents/new-agent-creation/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { AgentColorName } from '../../../tools/AgentTool/agentColorManager.js'
import type { AgentMemoryScope } from '../../../tools/AgentTool/agentMemory.js'
import type { CustomAgentDefinition } from '../../../tools/AgentTool/loadAgentsDir.js'
import type { SettingSource } from '../../../utils/settings/constants.js'

export type GeneratedAgentDraft = {
identifier: string
whenToUse: string
systemPrompt: string
}

export type AgentWizardData = {
location?: SettingSource
method?: 'generate' | 'manual'
generationPrompt?: string
isGenerating?: boolean
generatedAgent?: GeneratedAgentDraft
wasGenerated?: boolean
agentType?: string
systemPrompt?: string
whenToUse?: string
selectedTools?: string[]
selectedModel?: string
selectedColor?: AgentColorName
selectedMemory?: AgentMemoryScope
finalAgent?: CustomAgentDefinition
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function ColorStep() {
goBack,
updateWizardData,
wizardData
} = useWizard();
} = useWizard<AgentWizardData>();
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {
Expand All @@ -31,20 +31,24 @@ export function ColorStep() {
let t1;
if ($[1] !== goNext || $[2] !== updateWizardData || $[3] !== wizardData.agentType || $[4] !== wizardData.location || $[5] !== wizardData.selectedModel || $[6] !== wizardData.selectedTools || $[7] !== wizardData.systemPrompt || $[8] !== wizardData.whenToUse) {
t1 = color => {
const { agentType, location, systemPrompt, whenToUse } = wizardData;
if (!agentType || !whenToUse || !systemPrompt || !location) {
return;
}
updateWizardData({
selectedColor: color,
finalAgent: {
agentType: wizardData.agentType,
whenToUse: wizardData.whenToUse,
getSystemPrompt: () => wizardData.systemPrompt,
agentType,
whenToUse,
getSystemPrompt: () => systemPrompt,
tools: wizardData.selectedTools,
...(wizardData.selectedModel ? {
model: wizardData.selectedModel
} : {}),
...(color ? {
color: color as AgentColorName
} : {}),
source: wizardData.location
source: location
}
});
goNext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Props = {
onSaveAndEdit: () => void;
error?: string | null;
};
export function ConfirmStep(t0) {
export function ConfirmStep(t0: Props): React.ReactNode {
const $ = _c(88);
const {
tools,
Expand All @@ -37,7 +37,7 @@ export function ConfirmStep(t0) {
const {
goBack,
wizardData
} = useWizard();
} = useWizard<AgentWizardData>();
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t1 = {
Expand Down Expand Up @@ -69,6 +69,9 @@ export function ConfirmStep(t0) {
}
const handleKeyDown = t2;
const agent = wizardData.finalAgent;
if (!agent || !wizardData.location) {
return <WizardDialogLayout subtitle="Confirm and save" footerText={<Byline><ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="go back" /></Byline>}><Box flexDirection="column"><Text color="error">Agent draft is incomplete.</Text></Box></WizardDialogLayout>;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
let T0;
let T1;
let t10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export function DescriptionStep() {
goBack,
updateWizardData,
wizardData
} = useWizard();
} = useWizard<AgentWizardData>();
const [whenToUse, setWhenToUse] = useState(wizardData.whenToUse || "");
const [cursorOffset, setCursorOffset] = useState(whenToUse.length);
const [error, setError] = useState(null);
const [error, setError] = useState<string | null>(null);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function LocationStep() {
goNext,
updateWizardData,
cancel
} = useWizard();
} = useWizard<AgentWizardData>();
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function MemoryStep() {
goBack,
updateWizardData,
wizardData
} = useWizard();
} = useWizard<AgentWizardData>();
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {
Expand Down Expand Up @@ -72,12 +72,13 @@ export function MemoryStep() {
t2 = value => {
const memory = value === "none" ? undefined : value as AgentMemoryScope;
const agentType = wizardData.finalAgent?.agentType;
const systemPrompt = wizardData.systemPrompt ?? "";
updateWizardData({
selectedMemory: memory,
finalAgent: wizardData.finalAgent ? {
...wizardData.finalAgent,
memory,
getSystemPrompt: isAutoMemoryEnabled() && memory && agentType ? () => wizardData.systemPrompt + "\n\n" + loadAgentMemoryPrompt(agentType, memory) : () => wizardData.systemPrompt
getSystemPrompt: isAutoMemoryEnabled() && memory && agentType ? () => systemPrompt + "\n\n" + loadAgentMemoryPrompt(agentType, memory) : () => systemPrompt
} : undefined
});
goNext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function MethodStep() {
goBack,
updateWizardData,
goToStep
} = useWizard();
} = useWizard<AgentWizardData>();
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function ModelStep() {
goBack,
updateWizardData,
wizardData
} = useWizard();
} = useWizard<AgentWizardData>();
let t0;
if ($[0] !== goNext || $[1] !== updateWizardData) {
t0 = model => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export function PromptStep() {
goBack,
updateWizardData,
wizardData
} = useWizard();
} = useWizard<AgentWizardData>();
const [systemPrompt, setSystemPrompt] = useState(wizardData.systemPrompt || "");
const [cursorOffset, setCursorOffset] = useState(systemPrompt.length);
const [error, setError] = useState(null);
const [error, setError] = useState<string | null>(null);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { AgentWizardData } from '../types.js';
type Props = {
tools: Tools;
};
export function ToolsStep(t0) {
export function ToolsStep(t0: Props): React.ReactNode {
const $ = _c(9);
const {
tools
Expand All @@ -21,7 +21,7 @@ export function ToolsStep(t0) {
goBack,
updateWizardData,
wizardData
} = useWizard();
} = useWizard<AgentWizardData>();
let t1;
if ($[0] !== goNext || $[1] !== updateWizardData) {
t1 = selectedTools => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import type { AgentWizardData } from '../types.js';
type Props = {
existingAgents: AgentDefinition[];
};
export function TypeStep(_props) {
export function TypeStep(_props: Props): React.ReactNode {
const $ = _c(15);
const {
goNext,
goBack,
updateWizardData,
wizardData
} = useWizard();
} = useWizard<AgentWizardData>();
const [agentType, setAgentType] = useState(wizardData.agentType || "");
const [error, setError] = useState(null);
const [error, setError] = useState<string | null>(null);
const [cursorOffset, setCursorOffset] = useState(agentType.length);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
Expand Down
Loading