@within-7/minto 0.3.9 → 0.3.10
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/commands/agents/AgentsCommand.js +459 -655
- package/dist/commands/agents/AgentsCommand.js.map +2 -2
- package/dist/commands/agents/types.js +1 -0
- package/dist/commands/agents/types.js.map +2 -2
- package/dist/commands/agents/utils/fileOperations.js +96 -36
- package/dist/commands/agents/utils/fileOperations.js.map +3 -3
- package/dist/commands/agents/utils/index.js +3 -1
- package/dist/commands/agents/utils/index.js.map +2 -2
- package/dist/commands/context.js +54 -23
- package/dist/commands/context.js.map +2 -2
- package/dist/commands/export.js +673 -93
- package/dist/commands/export.js.map +2 -2
- package/dist/commands/language.js +19 -46
- package/dist/commands/language.js.map +2 -2
- package/dist/commands/mcp-interactive.js +419 -217
- package/dist/commands/mcp-interactive.js.map +2 -2
- package/dist/commands/model.js +415 -66
- package/dist/commands/model.js.map +2 -2
- package/dist/commands/permissions.js +75 -49
- package/dist/commands/permissions.js.map +2 -2
- package/dist/commands/plugin.js +882 -185
- package/dist/commands/plugin.js.map +3 -3
- package/dist/commands/resume.js +1 -1
- package/dist/commands/resume.js.map +1 -1
- package/dist/commands/sandbox.js +168 -70
- package/dist/commands/sandbox.js.map +2 -2
- package/dist/commands/setup.js +593 -107
- package/dist/commands/setup.js.map +2 -2
- package/dist/commands/stats.js +188 -131
- package/dist/commands/stats.js.map +2 -2
- package/dist/commands/status.js +75 -13
- package/dist/commands/status.js.map +2 -2
- package/dist/commands/undo.js +138 -174
- package/dist/commands/undo.js.map +2 -2
- package/dist/commands.js.map +1 -1
- package/dist/components/Help.js +165 -32
- package/dist/components/Help.js.map +2 -2
- package/dist/components/InfoPanel/InfoPanel.js +123 -0
- package/dist/components/InfoPanel/InfoPanel.js.map +7 -0
- package/dist/components/InfoPanel/index.js +5 -0
- package/dist/components/InfoPanel/index.js.map +7 -0
- package/dist/components/InfoPanel/types.js +1 -0
- package/dist/components/InfoPanel/types.js.map +7 -0
- package/dist/components/ModelSelector/BrandTextInput.js +43 -0
- package/dist/components/ModelSelector/BrandTextInput.js.map +7 -0
- package/dist/components/ModelSelector/ModelSelector.js +419 -501
- package/dist/components/ModelSelector/ModelSelector.js.map +2 -2
- package/dist/components/ModelSelector/WizardContainer.js +45 -0
- package/dist/components/ModelSelector/WizardContainer.js.map +7 -0
- package/dist/components/ModelSelector/index.js +1 -3
- package/dist/components/ModelSelector/index.js.map +2 -2
- package/dist/components/PromptInput.js +5 -5
- package/dist/components/PromptInput.js.map +2 -2
- package/dist/components/SimpleSelector/SimpleSelector.js +154 -0
- package/dist/components/SimpleSelector/SimpleSelector.js.map +7 -0
- package/dist/components/SimpleSelector/index.js +5 -0
- package/dist/components/SimpleSelector/index.js.map +7 -0
- package/dist/components/SimpleSelector/types.js +1 -0
- package/dist/components/SimpleSelector/types.js.map +7 -0
- package/dist/components/StatusOverlayContent.js +21 -0
- package/dist/components/StatusOverlayContent.js.map +7 -0
- package/dist/components/TabbedListView/ScrollableList.js +31 -5
- package/dist/components/TabbedListView/ScrollableList.js.map +2 -2
- package/dist/components/TabbedListView/TabbedListView.js +122 -47
- package/dist/components/TabbedListView/TabbedListView.js.map +2 -2
- package/dist/core/backupHook.js +29 -0
- package/dist/core/backupHook.js.map +7 -0
- package/dist/core/config/defaults.js +8 -2
- package/dist/core/config/defaults.js.map +2 -2
- package/dist/core/config/schema.js +14 -2
- package/dist/core/config/schema.js.map +2 -2
- package/dist/core/costTracker.js +0 -16
- package/dist/core/costTracker.js.map +2 -2
- package/dist/cost-tracker.js +0 -16
- package/dist/cost-tracker.js.map +2 -2
- package/dist/entrypoints/bootstrap.js +3 -1
- package/dist/entrypoints/bootstrap.js.map +2 -2
- package/dist/entrypoints/cli.js +32 -0
- package/dist/entrypoints/cli.js.map +2 -2
- package/dist/i18n/locales/en.js +300 -1
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/zh-CN.js +301 -2
- package/dist/i18n/locales/zh-CN.js.map +2 -2
- package/dist/i18n/types.js.map +1 -1
- package/dist/services/customCommands.js +30 -8
- package/dist/services/customCommands.js.map +2 -2
- package/dist/services/plugins/lspServers.js +1 -1
- package/dist/services/plugins/lspServers.js.map +2 -2
- package/dist/services/plugins/pluginRuntime.js +2 -1
- package/dist/services/plugins/pluginRuntime.js.map +2 -2
- package/dist/services/plugins/pluginValidation.js +10 -3
- package/dist/services/plugins/pluginValidation.js.map +2 -2
- package/dist/services/plugins/skillMarketplace.js +16 -8
- package/dist/services/plugins/skillMarketplace.js.map +2 -2
- package/dist/services/systemReminder.js +17 -6
- package/dist/services/systemReminder.js.map +2 -2
- package/dist/tools/FileEditTool/FileEditTool.js +7 -0
- package/dist/tools/FileEditTool/FileEditTool.js.map +2 -2
- package/dist/tools/FileWriteTool/FileWriteTool.js +7 -0
- package/dist/tools/FileWriteTool/FileWriteTool.js.map +2 -2
- package/dist/tools/MultiEditTool/MultiEditTool.js +7 -0
- package/dist/tools/MultiEditTool/MultiEditTool.js.map +2 -2
- package/dist/tools/NotebookEditTool/NotebookEditTool.js +2 -0
- package/dist/tools/NotebookEditTool/NotebookEditTool.js.map +2 -2
- package/dist/tools/TaskTool/TaskTool.js +9 -6
- package/dist/tools/TaskTool/TaskTool.js.map +2 -2
- package/dist/types/PermissionMode.js.map +1 -1
- package/dist/types/plugin.js +2 -4
- package/dist/types/plugin.js.map +2 -2
- package/dist/utils/agentHookExecutor.js +1 -4
- package/dist/utils/agentHookExecutor.js.map +2 -2
- package/dist/utils/agentLoader.js +67 -13
- package/dist/utils/agentLoader.js.map +2 -2
- package/dist/utils/agentMemory.js.map +2 -2
- package/dist/utils/claudeCodeSync.js +439 -0
- package/dist/utils/claudeCodeSync.js.map +7 -0
- package/dist/utils/config.js +1 -23
- package/dist/utils/config.js.map +2 -2
- package/dist/utils/execFileNoThrow.js +2 -1
- package/dist/utils/execFileNoThrow.js.map +2 -2
- package/dist/utils/marketplaceManager.js +80 -43
- package/dist/utils/marketplaceManager.js.map +2 -2
- package/dist/utils/messages.js +2 -2
- package/dist/utils/messages.js.map +2 -2
- package/dist/utils/pluginInstaller.js +34 -24
- package/dist/utils/pluginInstaller.js.map +2 -2
- package/dist/utils/pluginLoader.js +48 -25
- package/dist/utils/pluginLoader.js.map +2 -2
- package/dist/utils/repoFetcher.js +110 -0
- package/dist/utils/repoFetcher.js.map +7 -0
- package/dist/utils/skillLoader.js +18 -6
- package/dist/utils/skillLoader.js.map +2 -2
- package/dist/utils/stringSubstitution.js +4 -5
- package/dist/utils/stringSubstitution.js.map +2 -2
- package/dist/utils/teamConfig.js +153 -13
- package/dist/utils/teamConfig.js.map +2 -2
- package/dist/utils/terminal.js +1 -1
- package/dist/utils/terminal.js.map +2 -2
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/package.json +6 -6
|
@@ -17,11 +17,13 @@ import * as os from "os";
|
|
|
17
17
|
import { exec } from "child_process";
|
|
18
18
|
import { promisify } from "util";
|
|
19
19
|
import { getTheme } from "../../utils/theme.js";
|
|
20
|
+
import { clearScreen } from "../../utils/terminal.js";
|
|
20
21
|
import { SEMANTIC_COLORS } from "../../constants/colors.js";
|
|
21
22
|
const execAsync = promisify(exec);
|
|
22
23
|
import { getMCPTools } from "../../services/mcpClient.js";
|
|
23
24
|
import { getModelManager } from "../../utils/model.js";
|
|
24
25
|
import { randomUUID } from "crypto";
|
|
26
|
+
import { TabbedListView } from "../../components/TabbedListView/TabbedListView.js";
|
|
25
27
|
import {
|
|
26
28
|
UI_ICONS,
|
|
27
29
|
TOOL_CATEGORIES
|
|
@@ -31,6 +33,7 @@ import {
|
|
|
31
33
|
saveAgent,
|
|
32
34
|
deleteAgent,
|
|
33
35
|
openInEditor,
|
|
36
|
+
viewInPager,
|
|
34
37
|
updateAgent
|
|
35
38
|
} from "./utils/index.js";
|
|
36
39
|
function getDisplayModelName(modelId) {
|
|
@@ -327,7 +330,10 @@ function LoadingSpinner({ text }) {
|
|
|
327
330
|
return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: theme.primary }, UI_ICONS.loading[frame]), text && /* @__PURE__ */ React.createElement(Text, { color: theme.secondary }, " ", text));
|
|
328
331
|
}
|
|
329
332
|
function AgentsUI({ onExit }) {
|
|
330
|
-
const
|
|
333
|
+
const [phase, setPhase] = useState({ type: "main" });
|
|
334
|
+
const [activeTab, setActiveTab] = useState("all");
|
|
335
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
336
|
+
const [statusOverlay, setStatusOverlay] = useState(null);
|
|
331
337
|
const [modeState, setModeState] = useState({
|
|
332
338
|
mode: "list-agents",
|
|
333
339
|
location: "all"
|
|
@@ -420,21 +426,12 @@ function AgentsUI({ onExit }) {
|
|
|
420
426
|
setLoading(true);
|
|
421
427
|
clearAgentCache();
|
|
422
428
|
const abortController = new AbortController();
|
|
423
|
-
const loadingId = Date.now();
|
|
424
429
|
try {
|
|
425
430
|
const result = await getActiveAgents();
|
|
426
431
|
if (abortController.signal.aborted) {
|
|
427
432
|
return;
|
|
428
433
|
}
|
|
429
434
|
setAgents(result);
|
|
430
|
-
if (modeState.selectedAgent) {
|
|
431
|
-
const freshSelectedAgent = result.find(
|
|
432
|
-
(a) => a.agentType === modeState.selectedAgent.agentType
|
|
433
|
-
);
|
|
434
|
-
if (freshSelectedAgent) {
|
|
435
|
-
setModeState((prev) => ({ ...prev, selectedAgent: freshSelectedAgent }));
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
435
|
const availableTools = [];
|
|
439
436
|
let coreTools = [
|
|
440
437
|
{ name: "Read", description: "Read files from filesystem" },
|
|
@@ -488,526 +485,492 @@ function AgentsUI({ onExit }) {
|
|
|
488
485
|
}
|
|
489
486
|
};
|
|
490
487
|
}, [refreshKey, loadAgents]);
|
|
491
|
-
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
${changes.join("\n")}` : void 0;
|
|
495
|
-
const current = modeState.mode;
|
|
496
|
-
if (current === "list-agents") {
|
|
497
|
-
onExit(changesSummary);
|
|
498
|
-
return;
|
|
488
|
+
useEffect(() => {
|
|
489
|
+
if (phase.type === "main") {
|
|
490
|
+
setSearchQuery("");
|
|
499
491
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
case "
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
492
|
+
}, [phase]);
|
|
493
|
+
const activeMap = useMemo(() => {
|
|
494
|
+
const map = /* @__PURE__ */ new Map();
|
|
495
|
+
agents.forEach((a) => map.set(a.agentType, a));
|
|
496
|
+
return map;
|
|
497
|
+
}, [agents]);
|
|
498
|
+
const checkOverride = useCallback(
|
|
499
|
+
(agent) => {
|
|
500
|
+
const active = activeMap.get(agent.agentType);
|
|
501
|
+
const isOverridden = !!(active && active.location !== agent.location);
|
|
502
|
+
return {
|
|
503
|
+
isOverridden,
|
|
504
|
+
overriddenBy: isOverridden ? active.location : null
|
|
505
|
+
};
|
|
506
|
+
},
|
|
507
|
+
[activeMap]
|
|
508
|
+
);
|
|
509
|
+
const { tabs, items, title, footerHint, searchEnabled } = useMemo(() => {
|
|
510
|
+
switch (phase.type) {
|
|
511
|
+
case "main": {
|
|
512
|
+
const allAgents = agents;
|
|
513
|
+
const customAgents = allAgents.filter((a) => a.location !== "built-in");
|
|
514
|
+
const mainTabs = [
|
|
515
|
+
{ id: "all", label: "All", badge: customAgents.length },
|
|
516
|
+
{
|
|
517
|
+
id: "plugin",
|
|
518
|
+
label: "Plugin",
|
|
519
|
+
badge: customAgents.filter((a) => a.location === "plugin").length
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
id: "user",
|
|
523
|
+
label: "Personal",
|
|
524
|
+
badge: customAgents.filter((a) => a.location === "user").length
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
id: "project",
|
|
528
|
+
label: "Project",
|
|
529
|
+
badge: customAgents.filter((a) => a.location === "project").length
|
|
530
|
+
}
|
|
531
|
+
];
|
|
532
|
+
let mainItems = [];
|
|
533
|
+
mainItems.push({
|
|
534
|
+
id: "create-new",
|
|
535
|
+
label: "+ Create new agent",
|
|
536
|
+
description: "Create a new specialized agent"
|
|
541
537
|
});
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
538
|
+
const displayAgents = activeTab === "all" ? customAgents : customAgents.filter((a) => a.location === activeTab);
|
|
539
|
+
for (const agent of displayAgents) {
|
|
540
|
+
const { isOverridden, overriddenBy } = checkOverride(agent);
|
|
541
|
+
const agentModel = agent.model || null;
|
|
542
|
+
const modelDisplay = getDisplayModelName(agentModel);
|
|
543
|
+
const locationLabel = agent.location === "plugin" ? "Plugin" : agent.location === "user" ? "Personal" : agent.location === "project" ? "Project" : agent.location;
|
|
544
|
+
mainItems.push({
|
|
545
|
+
id: `${agent.agentType}-${agent.location}`,
|
|
546
|
+
label: agent.agentType,
|
|
547
|
+
description: agent.whenToUse || agent.description || "",
|
|
548
|
+
category: locationLabel,
|
|
549
|
+
metadata: modelDisplay,
|
|
550
|
+
status: isOverridden ? "disabled" : "enabled",
|
|
551
|
+
data: agent
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
return {
|
|
555
|
+
tabs: mainTabs,
|
|
556
|
+
items: mainItems,
|
|
557
|
+
title: "Agents",
|
|
558
|
+
footerHint: "\u2191\u2193 Navigate \xB7 Enter Select \xB7 Tab/\u2190\u2192 Switch \xB7 / Search \xB7 Esc Close",
|
|
559
|
+
searchEnabled: true
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
case "agent-actions": {
|
|
563
|
+
const agent = phase.agent;
|
|
564
|
+
const isBuiltIn = agent.location === "built-in";
|
|
565
|
+
const actionItems = [
|
|
566
|
+
{
|
|
567
|
+
id: "view",
|
|
568
|
+
label: "View details",
|
|
569
|
+
description: "Show agent configuration"
|
|
570
|
+
}
|
|
571
|
+
];
|
|
572
|
+
if (!isBuiltIn) {
|
|
573
|
+
actionItems.push({
|
|
574
|
+
id: "edit",
|
|
575
|
+
label: "Edit agent",
|
|
576
|
+
description: "Modify agent settings"
|
|
577
|
+
});
|
|
578
|
+
actionItems.push({
|
|
579
|
+
id: "delete",
|
|
580
|
+
label: "Delete agent",
|
|
581
|
+
description: "Remove this agent"
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
actionItems.push({
|
|
585
|
+
id: "back",
|
|
586
|
+
label: "Back",
|
|
587
|
+
description: "Return to agent list"
|
|
547
588
|
});
|
|
589
|
+
return {
|
|
590
|
+
tabs: [{ id: "actions", label: "Actions" }],
|
|
591
|
+
items: actionItems,
|
|
592
|
+
title: agent.agentType,
|
|
593
|
+
footerHint: "\u2191\u2193 Navigate \xB7 Enter Select \xB7 Esc Back",
|
|
594
|
+
searchEnabled: false
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
case "edit-actions": {
|
|
598
|
+
const agent = phase.agent;
|
|
599
|
+
const editItems = [
|
|
600
|
+
{
|
|
601
|
+
id: "open-editor",
|
|
602
|
+
label: "Open in editor",
|
|
603
|
+
description: "Edit the agent file directly"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
id: "edit-tools",
|
|
607
|
+
label: "Edit tools",
|
|
608
|
+
description: "Change available tools"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
id: "edit-model",
|
|
612
|
+
label: "Edit model",
|
|
613
|
+
description: "Change the model"
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
id: "edit-color",
|
|
617
|
+
label: "Edit color",
|
|
618
|
+
description: "Change the color tag"
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
id: "back",
|
|
622
|
+
label: "Back",
|
|
623
|
+
description: "Return to agent actions"
|
|
624
|
+
}
|
|
625
|
+
];
|
|
626
|
+
return {
|
|
627
|
+
tabs: [{ id: "edit", label: "Edit" }],
|
|
628
|
+
items: editItems,
|
|
629
|
+
title: `Edit: ${agent.agentType}`,
|
|
630
|
+
footerHint: "\u2191\u2193 Navigate \xB7 Enter Select \xB7 Esc Back",
|
|
631
|
+
searchEnabled: false
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
default:
|
|
635
|
+
return {
|
|
636
|
+
tabs: [{ id: "all", label: "All" }],
|
|
637
|
+
items: [],
|
|
638
|
+
title: "Agents",
|
|
639
|
+
footerHint: "",
|
|
640
|
+
searchEnabled: false
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
}, [phase, activeTab, agents, checkOverride]);
|
|
644
|
+
const handleTabChange = useCallback((tabId) => {
|
|
645
|
+
setActiveTab(tabId);
|
|
646
|
+
setSearchQuery("");
|
|
647
|
+
}, []);
|
|
648
|
+
const handleStatusDismiss = useCallback(() => {
|
|
649
|
+
setStatusOverlay(null);
|
|
650
|
+
setPhase({ type: "main" });
|
|
651
|
+
}, []);
|
|
652
|
+
const handleBack = useCallback(() => {
|
|
653
|
+
if (statusOverlay && statusOverlay.type !== "loading") {
|
|
654
|
+
handleStatusDismiss();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
switch (phase.type) {
|
|
658
|
+
case "main": {
|
|
659
|
+
const changesSummary = changes.length > 0 ? `Agent changes:
|
|
660
|
+
${changes.join("\n")}` : void 0;
|
|
661
|
+
onExit(changesSummary);
|
|
548
662
|
break;
|
|
549
|
-
|
|
550
|
-
case "
|
|
551
|
-
|
|
552
|
-
setModeState({
|
|
553
|
-
mode: "edit-agent",
|
|
554
|
-
selectedAgent: modeState.selectedAgent
|
|
555
|
-
});
|
|
663
|
+
}
|
|
664
|
+
case "agent-actions":
|
|
665
|
+
setPhase({ type: "main" });
|
|
556
666
|
break;
|
|
557
|
-
case "
|
|
558
|
-
|
|
559
|
-
mode: "agent-menu",
|
|
560
|
-
selectedAgent: modeState.selectedAgent
|
|
561
|
-
});
|
|
667
|
+
case "edit-actions":
|
|
668
|
+
setPhase({ type: "agent-actions", agent: phase.agent });
|
|
562
669
|
break;
|
|
563
670
|
default:
|
|
564
|
-
|
|
671
|
+
setPhase({ type: "main" });
|
|
565
672
|
break;
|
|
566
673
|
}
|
|
567
|
-
});
|
|
568
|
-
const
|
|
569
|
-
(
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
674
|
+
}, [phase, statusOverlay, changes, onExit, handleStatusDismiss]);
|
|
675
|
+
const handleClose = useCallback(() => {
|
|
676
|
+
if (statusOverlay && statusOverlay.type !== "loading") {
|
|
677
|
+
handleStatusDismiss();
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
if (phase.type === "main") {
|
|
681
|
+
const changesSummary = changes.length > 0 ? `Agent changes:
|
|
682
|
+
${changes.join("\n")}` : void 0;
|
|
683
|
+
onExit(changesSummary);
|
|
684
|
+
} else {
|
|
685
|
+
setPhase({ type: "main" });
|
|
686
|
+
setSearchQuery("");
|
|
687
|
+
}
|
|
688
|
+
}, [phase, statusOverlay, changes, onExit, handleStatusDismiss]);
|
|
689
|
+
const handleSelect = useCallback(
|
|
690
|
+
async (item) => {
|
|
691
|
+
switch (phase.type) {
|
|
692
|
+
case "main": {
|
|
693
|
+
if (item.id === "create-new") {
|
|
694
|
+
setCreateState({ type: "RESET" });
|
|
695
|
+
setModeState({ mode: "create-location" });
|
|
696
|
+
setPhase({ type: "create", step: { mode: "create-location" } });
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
const agent = item.data;
|
|
700
|
+
if (agent) {
|
|
701
|
+
setPhase({ type: "agent-actions", agent });
|
|
702
|
+
}
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
case "agent-actions": {
|
|
706
|
+
const agent = phase.agent;
|
|
707
|
+
if (item.id === "back") {
|
|
708
|
+
setPhase({ type: "main" });
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
if (item.id === "view") {
|
|
712
|
+
try {
|
|
713
|
+
viewInPager(agent);
|
|
714
|
+
setRefreshKey((prev) => prev + 1);
|
|
715
|
+
} catch (err) {
|
|
716
|
+
setStatusOverlay({
|
|
717
|
+
type: "error",
|
|
718
|
+
message: `Failed to open pager: ${err instanceof Error ? err.message : String(err)}`
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
} else if (item.id === "edit") {
|
|
722
|
+
setPhase({ type: "edit-actions", agent });
|
|
723
|
+
} else if (item.id === "delete") {
|
|
724
|
+
setPhase({ type: "delete-confirm", agent });
|
|
725
|
+
}
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
728
|
+
case "edit-actions": {
|
|
729
|
+
const agent = phase.agent;
|
|
730
|
+
if (item.id === "back") {
|
|
731
|
+
setPhase({ type: "agent-actions", agent });
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
if (item.id === "open-editor") {
|
|
735
|
+
try {
|
|
736
|
+
const filePath = getAgentFilePath(agent);
|
|
737
|
+
openInEditor(filePath);
|
|
738
|
+
clearAgentCache();
|
|
739
|
+
const reloaded = await getActiveAgents();
|
|
740
|
+
setAgents(reloaded);
|
|
741
|
+
const updated = reloaded.find(
|
|
742
|
+
(a) => a.agentType === agent.agentType
|
|
743
|
+
);
|
|
744
|
+
if (updated) {
|
|
745
|
+
setPhase({ type: "edit-actions", agent: updated });
|
|
746
|
+
}
|
|
747
|
+
setStatusOverlay({
|
|
748
|
+
type: "success",
|
|
749
|
+
message: "Editor closed"
|
|
750
|
+
});
|
|
751
|
+
} catch (err) {
|
|
752
|
+
setStatusOverlay({
|
|
753
|
+
type: "error",
|
|
754
|
+
message: `Failed to open editor: ${err instanceof Error ? err.message : String(err)}`
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
} else if (item.id === "edit-tools") {
|
|
758
|
+
setPhase({ type: "edit-tools", agent });
|
|
759
|
+
} else if (item.id === "edit-model") {
|
|
760
|
+
setPhase({ type: "edit-model", agent });
|
|
761
|
+
} else if (item.id === "edit-color") {
|
|
762
|
+
setPhase({ type: "edit-color", agent });
|
|
763
|
+
}
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
575
767
|
},
|
|
576
|
-
[
|
|
768
|
+
[phase]
|
|
577
769
|
);
|
|
578
|
-
const handleCreateNew = useCallback(() => {
|
|
579
|
-
console.log("=== STARTING AGENT CREATION FLOW ===");
|
|
580
|
-
console.log("Current mode state:", modeState);
|
|
581
|
-
setCreateState({ type: "RESET" });
|
|
582
|
-
console.log("Reset create state");
|
|
583
|
-
setModeState({ mode: "create-location" });
|
|
584
|
-
console.log("Set mode to create-location");
|
|
585
|
-
console.log("=== CREATE NEW HANDLER COMPLETED ===");
|
|
586
|
-
}, [modeState]);
|
|
587
770
|
const handleAgentCreated = useCallback((message) => {
|
|
588
771
|
setChanges((prev) => [...prev, message]);
|
|
589
772
|
setRefreshKey((prev) => prev + 1);
|
|
590
|
-
|
|
773
|
+
setPhase({ type: "main" });
|
|
591
774
|
}, []);
|
|
592
775
|
const handleAgentDeleted = useCallback((message) => {
|
|
593
776
|
setChanges((prev) => [...prev, message]);
|
|
594
777
|
setRefreshKey((prev) => prev + 1);
|
|
595
|
-
|
|
778
|
+
setPhase({ type: "main" });
|
|
596
779
|
}, []);
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
}
|
|
622
|
-
);
|
|
623
|
-
case "create-method":
|
|
624
|
-
return /* @__PURE__ */ React.createElement(
|
|
625
|
-
MethodSelect,
|
|
626
|
-
{
|
|
627
|
-
createState,
|
|
628
|
-
setCreateState,
|
|
629
|
-
setModeState
|
|
630
|
-
}
|
|
631
|
-
);
|
|
632
|
-
case "create-generate":
|
|
633
|
-
return /* @__PURE__ */ React.createElement(
|
|
634
|
-
GenerateStep,
|
|
635
|
-
{
|
|
636
|
-
createState,
|
|
637
|
-
setCreateState,
|
|
638
|
-
setModeState,
|
|
639
|
-
existingAgents: agents
|
|
640
|
-
}
|
|
641
|
-
);
|
|
642
|
-
case "create-type":
|
|
643
|
-
return /* @__PURE__ */ React.createElement(
|
|
644
|
-
TypeStep,
|
|
645
|
-
{
|
|
646
|
-
createState,
|
|
647
|
-
setCreateState,
|
|
648
|
-
setModeState,
|
|
649
|
-
existingAgents: agents
|
|
650
|
-
}
|
|
651
|
-
);
|
|
652
|
-
case "create-description":
|
|
653
|
-
return /* @__PURE__ */ React.createElement(
|
|
654
|
-
DescriptionStep,
|
|
655
|
-
{
|
|
656
|
-
createState,
|
|
657
|
-
setCreateState,
|
|
658
|
-
setModeState
|
|
659
|
-
}
|
|
660
|
-
);
|
|
661
|
-
case "create-tools":
|
|
662
|
-
return /* @__PURE__ */ React.createElement(
|
|
663
|
-
ToolsStep,
|
|
664
|
-
{
|
|
665
|
-
createState,
|
|
666
|
-
setCreateState,
|
|
667
|
-
setModeState,
|
|
668
|
-
tools
|
|
669
|
-
}
|
|
670
|
-
);
|
|
671
|
-
case "create-model":
|
|
672
|
-
return /* @__PURE__ */ React.createElement(
|
|
673
|
-
ModelStep,
|
|
674
|
-
{
|
|
675
|
-
createState,
|
|
676
|
-
setCreateState,
|
|
677
|
-
setModeState
|
|
678
|
-
}
|
|
679
|
-
);
|
|
680
|
-
case "create-color":
|
|
681
|
-
return /* @__PURE__ */ React.createElement(
|
|
682
|
-
ColorStep,
|
|
683
|
-
{
|
|
684
|
-
createState,
|
|
685
|
-
setCreateState,
|
|
686
|
-
setModeState
|
|
687
|
-
}
|
|
688
|
-
);
|
|
689
|
-
case "create-prompt":
|
|
690
|
-
return /* @__PURE__ */ React.createElement(
|
|
691
|
-
PromptStep,
|
|
692
|
-
{
|
|
693
|
-
createState,
|
|
694
|
-
setCreateState,
|
|
695
|
-
setModeState
|
|
696
|
-
}
|
|
697
|
-
);
|
|
698
|
-
case "create-confirm":
|
|
699
|
-
return /* @__PURE__ */ React.createElement(
|
|
700
|
-
ConfirmStep,
|
|
701
|
-
{
|
|
702
|
-
createState,
|
|
703
|
-
setCreateState,
|
|
704
|
-
setModeState,
|
|
705
|
-
tools,
|
|
706
|
-
onAgentCreated: handleAgentCreated
|
|
707
|
-
}
|
|
708
|
-
);
|
|
709
|
-
case "agent-menu":
|
|
710
|
-
return /* @__PURE__ */ React.createElement(
|
|
711
|
-
AgentMenu,
|
|
712
|
-
{
|
|
713
|
-
agent: modeState.selectedAgent,
|
|
714
|
-
setModeState
|
|
715
|
-
}
|
|
716
|
-
);
|
|
717
|
-
case "view-agent":
|
|
718
|
-
return /* @__PURE__ */ React.createElement(
|
|
719
|
-
ViewAgent,
|
|
720
|
-
{
|
|
721
|
-
agent: modeState.selectedAgent,
|
|
722
|
-
tools,
|
|
723
|
-
setModeState
|
|
724
|
-
}
|
|
725
|
-
);
|
|
726
|
-
case "edit-agent":
|
|
727
|
-
return /* @__PURE__ */ React.createElement(
|
|
728
|
-
EditMenu,
|
|
729
|
-
{
|
|
730
|
-
agent: modeState.selectedAgent,
|
|
731
|
-
setModeState
|
|
732
|
-
}
|
|
733
|
-
);
|
|
734
|
-
case "edit-tools":
|
|
735
|
-
return /* @__PURE__ */ React.createElement(
|
|
736
|
-
EditToolsStep,
|
|
737
|
-
{
|
|
738
|
-
agent: modeState.selectedAgent,
|
|
739
|
-
tools,
|
|
740
|
-
setModeState,
|
|
741
|
-
onAgentUpdated: (message, updated) => {
|
|
742
|
-
setChanges((prev) => [...prev, message]);
|
|
743
|
-
setRefreshKey((prev) => prev + 1);
|
|
744
|
-
setModeState({ mode: "agent-menu", selectedAgent: updated });
|
|
780
|
+
const handleAgentUpdated = useCallback(
|
|
781
|
+
(message, updated) => {
|
|
782
|
+
setChanges((prev) => [...prev, message]);
|
|
783
|
+
setRefreshKey((prev) => prev + 1);
|
|
784
|
+
setPhase({ type: "agent-actions", agent: updated });
|
|
785
|
+
},
|
|
786
|
+
[]
|
|
787
|
+
);
|
|
788
|
+
const wizardSetModeState = useCallback((state) => {
|
|
789
|
+
if (state.mode === "list-agents") {
|
|
790
|
+
setPhase({ type: "main" });
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
setModeState(state);
|
|
794
|
+
}, []);
|
|
795
|
+
if (phase.type === "create") {
|
|
796
|
+
switch (modeState.mode) {
|
|
797
|
+
case "create-location":
|
|
798
|
+
return /* @__PURE__ */ React.createElement(
|
|
799
|
+
LocationSelect,
|
|
800
|
+
{
|
|
801
|
+
createState,
|
|
802
|
+
setCreateState,
|
|
803
|
+
setModeState: wizardSetModeState
|
|
745
804
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
onAgentUpdated: (message, updated) => {
|
|
755
|
-
setChanges((prev) => [...prev, message]);
|
|
756
|
-
setRefreshKey((prev) => prev + 1);
|
|
757
|
-
setModeState({ mode: "agent-menu", selectedAgent: updated });
|
|
805
|
+
);
|
|
806
|
+
case "create-method":
|
|
807
|
+
return /* @__PURE__ */ React.createElement(
|
|
808
|
+
MethodSelect,
|
|
809
|
+
{
|
|
810
|
+
createState,
|
|
811
|
+
setCreateState,
|
|
812
|
+
setModeState: wizardSetModeState
|
|
758
813
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
setChanges((prev) => [...prev, message]);
|
|
769
|
-
setRefreshKey((prev) => prev + 1);
|
|
770
|
-
setModeState({ mode: "agent-menu", selectedAgent: updated });
|
|
814
|
+
);
|
|
815
|
+
case "create-generate":
|
|
816
|
+
return /* @__PURE__ */ React.createElement(
|
|
817
|
+
GenerateStep,
|
|
818
|
+
{
|
|
819
|
+
createState,
|
|
820
|
+
setCreateState,
|
|
821
|
+
setModeState: wizardSetModeState,
|
|
822
|
+
existingAgents: agents
|
|
771
823
|
}
|
|
772
|
-
}
|
|
773
|
-
);
|
|
774
|
-
case "delete-confirm":
|
|
775
|
-
return /* @__PURE__ */ React.createElement(
|
|
776
|
-
DeleteConfirm,
|
|
777
|
-
{
|
|
778
|
-
agent: modeState.selectedAgent,
|
|
779
|
-
setModeState,
|
|
780
|
-
onAgentDeleted: handleAgentDeleted
|
|
781
|
-
}
|
|
782
|
-
);
|
|
783
|
-
default:
|
|
784
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Header, { title: "Agents" }, /* @__PURE__ */ React.createElement(Text, null, "Mode: ", modeState.mode, " (Not implemented yet)"), /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, null, "Press Esc to go back"))), /* @__PURE__ */ React.createElement(InstructionBar, { instructions: "Esc to go back" }));
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
function AgentListView({
|
|
788
|
-
location,
|
|
789
|
-
agents,
|
|
790
|
-
allAgents,
|
|
791
|
-
onBack,
|
|
792
|
-
onSelect,
|
|
793
|
-
onCreateNew,
|
|
794
|
-
changes
|
|
795
|
-
}) {
|
|
796
|
-
const theme = getTheme();
|
|
797
|
-
const allAgentsList = allAgents || agents;
|
|
798
|
-
const customAgents = allAgentsList.filter((a) => a.location !== "built-in");
|
|
799
|
-
const builtInAgents = allAgentsList.filter((a) => a.location === "built-in");
|
|
800
|
-
const [selectedAgent, setSelectedAgent] = useState(null);
|
|
801
|
-
const [onCreateOption, setOnCreateOption] = useState(true);
|
|
802
|
-
const [currentLocation, setCurrentLocation] = useState(location);
|
|
803
|
-
const [inLocationTabs, setInLocationTabs] = useState(false);
|
|
804
|
-
const [selectedLocationTab, setSelectedLocationTab] = useState(0);
|
|
805
|
-
const locationTabs = [
|
|
806
|
-
{ label: "All", value: "all" },
|
|
807
|
-
{ label: "Personal", value: "user" },
|
|
808
|
-
{ label: "Project", value: "project" }
|
|
809
|
-
];
|
|
810
|
-
const activeMap = useMemo(() => {
|
|
811
|
-
const map = /* @__PURE__ */ new Map();
|
|
812
|
-
agents.forEach((a) => map.set(a.agentType, a));
|
|
813
|
-
return map;
|
|
814
|
-
}, [agents]);
|
|
815
|
-
const checkOverride = (agent) => {
|
|
816
|
-
const active = activeMap.get(agent.agentType);
|
|
817
|
-
const isOverridden = !!(active && active.location !== agent.location);
|
|
818
|
-
return {
|
|
819
|
-
isOverridden,
|
|
820
|
-
overriddenBy: isOverridden ? active.location : null
|
|
821
|
-
};
|
|
822
|
-
};
|
|
823
|
-
const renderCreateOption = () => /* @__PURE__ */ React.createElement(Box, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React.createElement(Text, { color: onCreateOption ? theme.primary : void 0 }, onCreateOption ? `${UI_ICONS.pointer} ` : " "), /* @__PURE__ */ React.createElement(Text, { bold: true, color: onCreateOption ? theme.primary : void 0 }, "\u2728 Create new agent"));
|
|
824
|
-
const renderAgent = (agent, isBuiltIn = false) => {
|
|
825
|
-
const isSelected = !isBuiltIn && !onCreateOption && selectedAgent?.agentType === agent.agentType && selectedAgent?.location === agent.location;
|
|
826
|
-
const { isOverridden, overriddenBy } = checkOverride(agent);
|
|
827
|
-
const dimmed = isBuiltIn || isOverridden;
|
|
828
|
-
const color = !isBuiltIn && isSelected ? theme.primary : void 0;
|
|
829
|
-
const agentModel = agent.model || null;
|
|
830
|
-
const modelDisplay = getDisplayModelName(agentModel);
|
|
831
|
-
return /* @__PURE__ */ React.createElement(
|
|
832
|
-
Box,
|
|
833
|
-
{
|
|
834
|
-
key: `${agent.agentType}-${agent.location}`,
|
|
835
|
-
flexDirection: "row",
|
|
836
|
-
alignItems: "center"
|
|
837
|
-
},
|
|
838
|
-
/* @__PURE__ */ React.createElement(Box, { flexDirection: "row", alignItems: "center", minWidth: 3 }, /* @__PURE__ */ React.createElement(Text, { color: dimmed && !isSelected ? SEMANTIC_COLORS.dim : color }, isBuiltIn ? "" : isSelected ? `${UI_ICONS.pointer} ` : " ")),
|
|
839
|
-
/* @__PURE__ */ React.createElement(Box, { flexDirection: "row", alignItems: "center", flexGrow: 1 }, /* @__PURE__ */ React.createElement(Text, { color: dimmed && !isSelected ? SEMANTIC_COLORS.dim : color }, agent.agentType), /* @__PURE__ */ React.createElement(Text, { color: dimmed ? SEMANTIC_COLORS.dim : "gray" }, " \xB7 ", modelDisplay)),
|
|
840
|
-
overriddenBy && /* @__PURE__ */ React.createElement(Box, { marginLeft: 1 }, /* @__PURE__ */ React.createElement(Text, { color: isSelected ? "yellow" : SEMANTIC_COLORS.dim }, UI_ICONS.warning, " overridden by ", overriddenBy))
|
|
841
|
-
);
|
|
842
|
-
};
|
|
843
|
-
const displayAgents = useMemo(() => {
|
|
844
|
-
if (currentLocation === "all") {
|
|
845
|
-
return [
|
|
846
|
-
...customAgents.filter((a) => a.location === "user"),
|
|
847
|
-
...customAgents.filter((a) => a.location === "project")
|
|
848
|
-
];
|
|
849
|
-
} else if (currentLocation === "user" || currentLocation === "project") {
|
|
850
|
-
return customAgents.filter((a) => a.location === currentLocation);
|
|
851
|
-
}
|
|
852
|
-
return customAgents;
|
|
853
|
-
}, [customAgents, currentLocation]);
|
|
854
|
-
useEffect(() => {
|
|
855
|
-
const tabIndex = locationTabs.findIndex(
|
|
856
|
-
(tab) => tab.value === currentLocation
|
|
857
|
-
);
|
|
858
|
-
if (tabIndex !== -1) {
|
|
859
|
-
setSelectedLocationTab(tabIndex);
|
|
860
|
-
}
|
|
861
|
-
}, [currentLocation, locationTabs]);
|
|
862
|
-
useEffect(() => {
|
|
863
|
-
if (displayAgents.length > 0 && !selectedAgent && !onCreateOption) {
|
|
864
|
-
setOnCreateOption(true);
|
|
865
|
-
}
|
|
866
|
-
}, [displayAgents.length, selectedAgent, onCreateOption]);
|
|
867
|
-
useInput((input, key) => {
|
|
868
|
-
if (key.escape) {
|
|
869
|
-
if (inLocationTabs) {
|
|
870
|
-
setInLocationTabs(false);
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
onBack();
|
|
874
|
-
return;
|
|
875
|
-
}
|
|
876
|
-
if (key.return) {
|
|
877
|
-
if (inLocationTabs) {
|
|
878
|
-
setCurrentLocation(locationTabs[selectedLocationTab].value);
|
|
879
|
-
setInLocationTabs(false);
|
|
880
|
-
return;
|
|
881
|
-
}
|
|
882
|
-
if (onCreateOption && onCreateNew) {
|
|
883
|
-
onCreateNew();
|
|
884
|
-
} else if (selectedAgent) {
|
|
885
|
-
onSelect(selectedAgent);
|
|
886
|
-
}
|
|
887
|
-
return;
|
|
888
|
-
}
|
|
889
|
-
if (key.tab) {
|
|
890
|
-
setInLocationTabs(!inLocationTabs);
|
|
891
|
-
return;
|
|
892
|
-
}
|
|
893
|
-
if (inLocationTabs) {
|
|
894
|
-
if (key.leftArrow) {
|
|
895
|
-
setSelectedLocationTab(
|
|
896
|
-
(prev) => prev > 0 ? prev - 1 : locationTabs.length - 1
|
|
897
824
|
);
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
825
|
+
case "create-type":
|
|
826
|
+
return /* @__PURE__ */ React.createElement(
|
|
827
|
+
TypeStep,
|
|
828
|
+
{
|
|
829
|
+
createState,
|
|
830
|
+
setCreateState,
|
|
831
|
+
setModeState: wizardSetModeState,
|
|
832
|
+
existingAgents: agents
|
|
833
|
+
}
|
|
901
834
|
);
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
}
|
|
910
|
-
displayAgents.forEach((agent) => {
|
|
911
|
-
const { isOverridden } = checkOverride(agent);
|
|
912
|
-
if (!isOverridden) {
|
|
913
|
-
allNavigableItems.push({ type: "agent", agent });
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
if (allNavigableItems.length === 0) return;
|
|
917
|
-
if (key.upArrow) {
|
|
918
|
-
if (onCreateOption) {
|
|
919
|
-
const lastAgent = allNavigableItems[allNavigableItems.length - 1];
|
|
920
|
-
if (lastAgent.type === "agent") {
|
|
921
|
-
setSelectedAgent(lastAgent.agent);
|
|
922
|
-
setOnCreateOption(false);
|
|
835
|
+
case "create-description":
|
|
836
|
+
return /* @__PURE__ */ React.createElement(
|
|
837
|
+
DescriptionStep,
|
|
838
|
+
{
|
|
839
|
+
createState,
|
|
840
|
+
setCreateState,
|
|
841
|
+
setModeState: wizardSetModeState
|
|
923
842
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
} else {
|
|
934
|
-
setSelectedAgent(prevItem.agent);
|
|
935
|
-
}
|
|
936
|
-
} else {
|
|
937
|
-
if (onCreateNew) {
|
|
938
|
-
setOnCreateOption(true);
|
|
939
|
-
setSelectedAgent(null);
|
|
940
|
-
}
|
|
843
|
+
);
|
|
844
|
+
case "create-tools":
|
|
845
|
+
return /* @__PURE__ */ React.createElement(
|
|
846
|
+
ToolsStep,
|
|
847
|
+
{
|
|
848
|
+
createState,
|
|
849
|
+
setCreateState,
|
|
850
|
+
setModeState: wizardSetModeState,
|
|
851
|
+
tools
|
|
941
852
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
setOnCreateOption(false);
|
|
853
|
+
);
|
|
854
|
+
case "create-model":
|
|
855
|
+
return /* @__PURE__ */ React.createElement(
|
|
856
|
+
ModelStep,
|
|
857
|
+
{
|
|
858
|
+
createState,
|
|
859
|
+
setCreateState,
|
|
860
|
+
setModeState: wizardSetModeState
|
|
951
861
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
}
|
|
961
|
-
} else {
|
|
962
|
-
if (onCreateNew) {
|
|
963
|
-
setOnCreateOption(true);
|
|
964
|
-
setSelectedAgent(null);
|
|
965
|
-
}
|
|
862
|
+
);
|
|
863
|
+
case "create-color":
|
|
864
|
+
return /* @__PURE__ */ React.createElement(
|
|
865
|
+
ColorStep,
|
|
866
|
+
{
|
|
867
|
+
createState,
|
|
868
|
+
setCreateState,
|
|
869
|
+
setModeState: wizardSetModeState
|
|
966
870
|
}
|
|
967
|
-
|
|
968
|
-
|
|
871
|
+
);
|
|
872
|
+
case "create-prompt":
|
|
873
|
+
return /* @__PURE__ */ React.createElement(
|
|
874
|
+
PromptStep,
|
|
875
|
+
{
|
|
876
|
+
createState,
|
|
877
|
+
setCreateState,
|
|
878
|
+
setModeState: wizardSetModeState
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
case "create-confirm":
|
|
882
|
+
return /* @__PURE__ */ React.createElement(
|
|
883
|
+
ConfirmStep,
|
|
884
|
+
{
|
|
885
|
+
createState,
|
|
886
|
+
setCreateState,
|
|
887
|
+
setModeState: wizardSetModeState,
|
|
888
|
+
tools,
|
|
889
|
+
onAgentCreated: handleAgentCreated
|
|
890
|
+
}
|
|
891
|
+
);
|
|
892
|
+
default:
|
|
893
|
+
setPhase({ type: "main" });
|
|
894
|
+
return null;
|
|
969
895
|
}
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
896
|
+
}
|
|
897
|
+
if (phase.type === "edit-tools") {
|
|
898
|
+
return /* @__PURE__ */ React.createElement(
|
|
899
|
+
EditToolsStep,
|
|
900
|
+
{
|
|
901
|
+
agent: phase.agent,
|
|
902
|
+
tools,
|
|
903
|
+
setModeState: (state) => {
|
|
904
|
+
clearScreen();
|
|
905
|
+
setPhase({ type: "edit-actions", agent: phase.agent });
|
|
906
|
+
},
|
|
907
|
+
onAgentUpdated: handleAgentUpdated
|
|
976
908
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
if (phase.type === "edit-model") {
|
|
912
|
+
return /* @__PURE__ */ React.createElement(
|
|
913
|
+
EditModelStep,
|
|
914
|
+
{
|
|
915
|
+
agent: phase.agent,
|
|
916
|
+
setModeState: (state) => {
|
|
917
|
+
clearScreen();
|
|
918
|
+
setPhase({ type: "edit-actions", agent: phase.agent });
|
|
919
|
+
},
|
|
920
|
+
onAgentUpdated: handleAgentUpdated
|
|
980
921
|
}
|
|
981
|
-
|
|
982
|
-
return null;
|
|
983
|
-
};
|
|
984
|
-
if (!agents.length || currentLocation !== "built-in" && !customAgents.length) {
|
|
985
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(EmptyStateInput, null), /* @__PURE__ */ React.createElement(Header, { title: "\u{1F916} Agents", subtitle: "" }, onCreateNew && /* @__PURE__ */ React.createElement(Box, { marginY: 1 }, renderCreateOption()), /* @__PURE__ */ React.createElement(Box, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { bold: true, color: theme.primary }, "\u{1F4AD} What are agents?")), /* @__PURE__ */ React.createElement(Text, null, "Specialized AI assistants that Minto can delegate to for specific tasks."), /* @__PURE__ */ React.createElement(Text, null, "Each agent has its own context, prompt, and tools."), /* @__PURE__ */ React.createElement(Box, { marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { bold: true, color: theme.primary }, "\u{1F4A1} Popular agent ideas:")), /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, null, "\u2022 \u{1F50D} Code Reviewer - Reviews PRs for best practices"), /* @__PURE__ */ React.createElement(Text, null, "\u2022 \u{1F512} Security Auditor - Finds vulnerabilities"), /* @__PURE__ */ React.createElement(Text, null, "\u2022 \u26A1 Performance Optimizer - Improves code speed"), /* @__PURE__ */ React.createElement(Text, null, "\u2022 \u{1F9D1}\u200D\u{1F4BC} Tech Lead - Makes architecture decisions"), /* @__PURE__ */ React.createElement(Text, null, "\u2022 \u{1F3A8} UX Expert - Improves user experience"))), currentLocation !== "built-in" && builtInAgents.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, null, UI_ICONS.separator.repeat(40))), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { bold: true, color: theme.secondary }, "Built-in (always available):"), builtInAgents.map((a) => renderAgent(a, true))))), /* @__PURE__ */ React.createElement(InstructionBar, { instructions: "Press Enter to create new agent \xB7 Esc to go back" }));
|
|
922
|
+
);
|
|
986
923
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
return /* @__PURE__ */ React.createElement(Box, { key: tab.value, flexDirection: "row" }, /* @__PURE__ */ React.createElement(
|
|
991
|
-
Text,
|
|
924
|
+
if (phase.type === "edit-color") {
|
|
925
|
+
return /* @__PURE__ */ React.createElement(
|
|
926
|
+
EditColorStep,
|
|
992
927
|
{
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
928
|
+
agent: phase.agent,
|
|
929
|
+
setModeState: (state) => {
|
|
930
|
+
clearScreen();
|
|
931
|
+
setPhase({ type: "edit-actions", agent: phase.agent });
|
|
932
|
+
},
|
|
933
|
+
onAgentUpdated: handleAgentUpdated
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
if (phase.type === "delete-confirm") {
|
|
938
|
+
return /* @__PURE__ */ React.createElement(
|
|
939
|
+
DeleteConfirm,
|
|
940
|
+
{
|
|
941
|
+
agent: phase.agent,
|
|
942
|
+
setModeState: (state) => {
|
|
943
|
+
clearScreen();
|
|
944
|
+
setPhase({ type: "agent-actions", agent: phase.agent });
|
|
945
|
+
},
|
|
946
|
+
onAgentDeleted: handleAgentDeleted
|
|
947
|
+
}
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
const currentTab = phase.type === "main" ? activeTab : phase.type === "agent-actions" ? "actions" : "edit";
|
|
951
|
+
return /* @__PURE__ */ React.createElement(
|
|
952
|
+
TabbedListView,
|
|
1007
953
|
{
|
|
1008
|
-
|
|
954
|
+
title,
|
|
955
|
+
tabs,
|
|
956
|
+
activeTab: currentTab,
|
|
957
|
+
onTabChange: handleTabChange,
|
|
958
|
+
items,
|
|
959
|
+
searchEnabled,
|
|
960
|
+
searchQuery,
|
|
961
|
+
onSearchChange: setSearchQuery,
|
|
962
|
+
onSelect: handleSelect,
|
|
963
|
+
onClose: handleClose,
|
|
964
|
+
onBack: handleBack,
|
|
965
|
+
statusOverlay,
|
|
966
|
+
footerHint,
|
|
967
|
+
groupByCategory: phase.type === "main" && activeTab === "all",
|
|
968
|
+
isLoading: loading,
|
|
969
|
+
loadingText: "Loading agents...",
|
|
970
|
+
emptyText: phase.type === "main" ? 'No agents found. Select "+ Create new agent" to get started.' : "No items",
|
|
971
|
+
statusDismissHint: "Enter Continue \xB7 Esc Back"
|
|
1009
972
|
}
|
|
1010
|
-
)
|
|
973
|
+
);
|
|
1011
974
|
}
|
|
1012
975
|
function GenerateStep({
|
|
1013
976
|
createState,
|
|
@@ -1618,146 +1581,6 @@ function MethodSelect({
|
|
|
1618
1581
|
))
|
|
1619
1582
|
), /* @__PURE__ */ React.createElement(InstructionBar, null));
|
|
1620
1583
|
}
|
|
1621
|
-
function AgentMenu({ agent, setModeState }) {
|
|
1622
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
1623
|
-
const options = [
|
|
1624
|
-
{ label: "View details", value: "view" },
|
|
1625
|
-
{
|
|
1626
|
-
label: "Edit agent",
|
|
1627
|
-
value: "edit",
|
|
1628
|
-
disabled: agent.location === "built-in"
|
|
1629
|
-
},
|
|
1630
|
-
{
|
|
1631
|
-
label: "Delete agent",
|
|
1632
|
-
value: "delete",
|
|
1633
|
-
disabled: agent.location === "built-in"
|
|
1634
|
-
}
|
|
1635
|
-
];
|
|
1636
|
-
const availableOptions = options.filter((opt) => !opt.disabled);
|
|
1637
|
-
const handleSelect = (value) => {
|
|
1638
|
-
switch (value) {
|
|
1639
|
-
case "view":
|
|
1640
|
-
setModeState({ mode: "view-agent", selectedAgent: agent });
|
|
1641
|
-
break;
|
|
1642
|
-
case "edit":
|
|
1643
|
-
setModeState({ mode: "edit-agent", selectedAgent: agent });
|
|
1644
|
-
break;
|
|
1645
|
-
case "delete":
|
|
1646
|
-
setModeState({ mode: "delete-confirm", selectedAgent: agent });
|
|
1647
|
-
break;
|
|
1648
|
-
}
|
|
1649
|
-
};
|
|
1650
|
-
useInput((input, key) => {
|
|
1651
|
-
if (key.return) {
|
|
1652
|
-
handleSelect(availableOptions[selectedIndex].value);
|
|
1653
|
-
} else if (key.upArrow) {
|
|
1654
|
-
setSelectedIndex(
|
|
1655
|
-
(prev) => prev > 0 ? prev - 1 : availableOptions.length - 1
|
|
1656
|
-
);
|
|
1657
|
-
} else if (key.downArrow) {
|
|
1658
|
-
setSelectedIndex(
|
|
1659
|
-
(prev) => prev < availableOptions.length - 1 ? prev + 1 : 0
|
|
1660
|
-
);
|
|
1661
|
-
}
|
|
1662
|
-
});
|
|
1663
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(
|
|
1664
|
-
Header,
|
|
1665
|
-
{
|
|
1666
|
-
title: `Agent: ${agent.agentType}`,
|
|
1667
|
-
subtitle: `${agent.location}`
|
|
1668
|
-
},
|
|
1669
|
-
/* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(
|
|
1670
|
-
SelectList,
|
|
1671
|
-
{
|
|
1672
|
-
options: availableOptions,
|
|
1673
|
-
selectedIndex,
|
|
1674
|
-
onChange: handleSelect,
|
|
1675
|
-
numbered: false
|
|
1676
|
-
}
|
|
1677
|
-
))
|
|
1678
|
-
), /* @__PURE__ */ React.createElement(InstructionBar, null));
|
|
1679
|
-
}
|
|
1680
|
-
function EditMenu({ agent, setModeState }) {
|
|
1681
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
1682
|
-
const [isOpening, setIsOpening] = useState(false);
|
|
1683
|
-
const [error, setError] = useState(null);
|
|
1684
|
-
const theme = getTheme();
|
|
1685
|
-
const options = [
|
|
1686
|
-
{ label: "Open in editor", value: "open-editor" },
|
|
1687
|
-
{ label: "Edit tools", value: "edit-tools" },
|
|
1688
|
-
{ label: "Edit model", value: "edit-model" },
|
|
1689
|
-
{ label: "Edit color", value: "edit-color" }
|
|
1690
|
-
];
|
|
1691
|
-
const handleSelect = async (value) => {
|
|
1692
|
-
switch (value) {
|
|
1693
|
-
case "open-editor":
|
|
1694
|
-
setIsOpening(true);
|
|
1695
|
-
try {
|
|
1696
|
-
const filePath = getAgentFilePath(agent);
|
|
1697
|
-
await openInEditor(filePath);
|
|
1698
|
-
setModeState({ mode: "agent-menu", selectedAgent: agent });
|
|
1699
|
-
} catch (err) {
|
|
1700
|
-
console.error("Failed to open editor:", err);
|
|
1701
|
-
setError(
|
|
1702
|
-
`Failed to open editor: ${err instanceof Error ? err.message : String(err)}`
|
|
1703
|
-
);
|
|
1704
|
-
} finally {
|
|
1705
|
-
setIsOpening(false);
|
|
1706
|
-
}
|
|
1707
|
-
break;
|
|
1708
|
-
case "edit-tools":
|
|
1709
|
-
setModeState({ mode: "edit-tools", selectedAgent: agent });
|
|
1710
|
-
break;
|
|
1711
|
-
case "edit-model":
|
|
1712
|
-
setModeState({ mode: "edit-model", selectedAgent: agent });
|
|
1713
|
-
break;
|
|
1714
|
-
case "edit-color":
|
|
1715
|
-
setModeState({ mode: "edit-color", selectedAgent: agent });
|
|
1716
|
-
break;
|
|
1717
|
-
}
|
|
1718
|
-
};
|
|
1719
|
-
const handleBack = () => {
|
|
1720
|
-
setModeState({ mode: "agent-menu", selectedAgent: agent });
|
|
1721
|
-
};
|
|
1722
|
-
useInput((input, key) => {
|
|
1723
|
-
if (key.escape) {
|
|
1724
|
-
handleBack();
|
|
1725
|
-
} else if (key.return && !isOpening) {
|
|
1726
|
-
handleSelect(options[selectedIndex].value);
|
|
1727
|
-
} else if (key.upArrow) {
|
|
1728
|
-
setSelectedIndex((prev) => prev > 0 ? prev - 1 : options.length - 1);
|
|
1729
|
-
} else if (key.downArrow) {
|
|
1730
|
-
setSelectedIndex((prev) => prev < options.length - 1 ? prev + 1 : 0);
|
|
1731
|
-
}
|
|
1732
|
-
});
|
|
1733
|
-
if (isOpening) {
|
|
1734
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(
|
|
1735
|
-
Header,
|
|
1736
|
-
{
|
|
1737
|
-
title: `Edit agent: ${agent.agentType}`,
|
|
1738
|
-
subtitle: "Opening in editor..."
|
|
1739
|
-
},
|
|
1740
|
-
/* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(LoadingSpinner, { text: "Opening file in editor..." }))
|
|
1741
|
-
), /* @__PURE__ */ React.createElement(InstructionBar, null));
|
|
1742
|
-
}
|
|
1743
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(
|
|
1744
|
-
Header,
|
|
1745
|
-
{
|
|
1746
|
-
title: `Edit agent: ${agent.agentType}`,
|
|
1747
|
-
subtitle: `Location: ${agent.location}`
|
|
1748
|
-
},
|
|
1749
|
-
error && /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "red" }, "\u2717 ", error)),
|
|
1750
|
-
/* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(
|
|
1751
|
-
SelectList,
|
|
1752
|
-
{
|
|
1753
|
-
options,
|
|
1754
|
-
selectedIndex,
|
|
1755
|
-
onChange: handleSelect,
|
|
1756
|
-
numbered: false
|
|
1757
|
-
}
|
|
1758
|
-
))
|
|
1759
|
-
), /* @__PURE__ */ React.createElement(InstructionBar, { instructions: "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc back" }));
|
|
1760
|
-
}
|
|
1761
1584
|
function EditToolsStep({
|
|
1762
1585
|
agent,
|
|
1763
1586
|
tools,
|
|
@@ -2166,26 +1989,6 @@ function EditColorStep({
|
|
|
2166
1989
|
}), /* @__PURE__ */ React.createElement(Box, { marginTop: 2 }, /* @__PURE__ */ React.createElement(Text, null, "Preview: "), /* @__PURE__ */ React.createElement(Text, { color: previewColor }, agent.agentType)))
|
|
2167
1990
|
), /* @__PURE__ */ React.createElement(InstructionBar, { instructions: "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc back" }));
|
|
2168
1991
|
}
|
|
2169
|
-
function ViewAgent({ agent, tools, setModeState }) {
|
|
2170
|
-
const theme = getTheme();
|
|
2171
|
-
const agentTools = Array.isArray(agent.tools) ? agent.tools : [];
|
|
2172
|
-
const hasAllTools = agent.tools === "*" || agentTools.includes("*");
|
|
2173
|
-
const locationPath = agent.location === "user" ? `~/.minto/agents/${agent.agentType}.md` : agent.location === "project" ? `.minto/agents/${agent.agentType}.md` : "(built-in)";
|
|
2174
|
-
const displayModel = getDisplayModelName(agent.model || null);
|
|
2175
|
-
const allowedTools = useMemo(() => {
|
|
2176
|
-
if (hasAllTools) return tools;
|
|
2177
|
-
return tools.filter(
|
|
2178
|
-
(tool) => agentTools.some((allowedTool) => {
|
|
2179
|
-
if (allowedTool.includes("*")) {
|
|
2180
|
-
const prefix = allowedTool.replace("*", "");
|
|
2181
|
-
return tool.name.startsWith(prefix);
|
|
2182
|
-
}
|
|
2183
|
-
return tool.name === allowedTool;
|
|
2184
|
-
})
|
|
2185
|
-
);
|
|
2186
|
-
}, [tools, agentTools, hasAllTools]);
|
|
2187
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Header, { title: `Agent: ${agent.agentType}`, subtitle: "Details" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Text, { bold: true }, "Type:"), " ", agent.agentType), /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Text, { bold: true }, "Location:"), " ", agent.location, " ", locationPath !== "(built-in)" ? `\xB7 ${locationPath}` : ""), /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Text, { bold: true }, "Description:"), " ", agent.whenToUse), /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Text, { bold: true }, "Model:"), " ", displayModel), /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Text, { bold: true }, "Color:"), " ", agent.color || "auto"), /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { bold: true }, "Tools:")), hasAllTools ? /* @__PURE__ */ React.createElement(Text, { color: theme.secondary }, "All tools (", tools.length, " available)") : /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingLeft: 2 }, allowedTools.map((tool) => /* @__PURE__ */ React.createElement(Fragment, { key: tool.name }, /* @__PURE__ */ React.createElement(Text, { color: theme.secondary }, "\u2022 ", tool.name)))), /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { bold: true }, "System Prompt:")), /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, null, agent.systemPrompt)))), /* @__PURE__ */ React.createElement(InstructionBar, null));
|
|
2188
|
-
}
|
|
2189
1992
|
function EditAgent({
|
|
2190
1993
|
agent,
|
|
2191
1994
|
tools,
|
|
@@ -2353,6 +2156,7 @@ var AgentsCommand_default = {
|
|
|
2353
2156
|
type: "local-jsx",
|
|
2354
2157
|
isEnabled: true,
|
|
2355
2158
|
isHidden: false,
|
|
2159
|
+
hidePromptInput: true,
|
|
2356
2160
|
async call(onExit) {
|
|
2357
2161
|
return /* @__PURE__ */ React.createElement(AgentsUI, { onExit });
|
|
2358
2162
|
},
|