@iaforged/context-code 1.0.81 → 1.0.82
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/src/components/agents/AgentDetail.js +19 -210
- package/dist/src/components/agents/AgentEditor.js +60 -70
- package/dist/src/components/agents/AgentsList.js +3 -2
- package/dist/src/components/agents/AgentsMenu.js +10 -10
- package/dist/src/components/agents/ColorPicker.js +2 -2
- package/dist/src/components/agents/ToolSelector.js +13 -13
- package/dist/src/components/agents/agentFileUtils.js +12 -11
- package/dist/src/components/agents/new-agent-creation/CreateAgentWizard.js +1 -1
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +22 -68
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +30 -369
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +13 -15
- package/dist/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +4 -4
- package/dist/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +15 -22
- package/dist/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +2 -2
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +9 -9
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +3 -3
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +8 -38
- package/dist/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +4 -4
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +1 -1
- package/dist/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +3 -3
- package/dist/src/components/agents/validateAgent.js +16 -16
- package/dist/src/services/compact/compact.js +22 -20
- package/dist/src/tools/AgentTool/AgentTool.js +12 -8
- package/dist/src/tools/AgentTool/agentDisplay.js +5 -2
- package/dist/src/tools/AgentTool/loadAgentsDir.js +36 -0
- package/dist/src/tools/AgentTool/resumeAgent.js +7 -3
- package/dist/src/utils/model/providers.js +14 -0
- package/package.json +1 -1
|
@@ -1,226 +1,35 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { c as _c } from "react/compiler-runtime";
|
|
3
2
|
import figures from 'figures';
|
|
4
3
|
import { Box, Text } from '../../ink.js';
|
|
5
4
|
import { useKeybinding } from '../../keybindings/useKeybinding.js';
|
|
6
5
|
import { getAgentColor } from '../../tools/AgentTool/agentColorManager.js';
|
|
7
6
|
import { getMemoryScopeDisplay } from '../../tools/AgentTool/agentMemory.js';
|
|
8
7
|
import { resolveAgentTools } from '../../tools/AgentTool/agentToolUtils.js';
|
|
9
|
-
import { isBuiltInAgent } from '../../tools/AgentTool/loadAgentsDir.js';
|
|
10
|
-
import { getAgentModelDisplay } from '../../utils/model/agent.js';
|
|
8
|
+
import { isBuiltInAgent, } from '../../tools/AgentTool/loadAgentsDir.js';
|
|
9
|
+
import { getAgentModelDisplay, getAgentProviderDisplay, } from '../../utils/model/agent.js';
|
|
11
10
|
import { Markdown } from '../Markdown.js';
|
|
12
11
|
import { getActualRelativeAgentFilePath } from './agentFileUtils.js';
|
|
13
|
-
export function AgentDetail(
|
|
14
|
-
const $ = _c(48);
|
|
15
|
-
const { agent, tools, onBack } = t0;
|
|
12
|
+
export function AgentDetail({ agent, tools, onBack, }) {
|
|
16
13
|
const resolvedTools = resolveAgentTools(agent, tools, false);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let t2;
|
|
28
|
-
if ($[2] !== agent.agentType) {
|
|
29
|
-
t2 = getAgentColor(agent.agentType);
|
|
30
|
-
$[2] = agent.agentType;
|
|
31
|
-
$[3] = t2;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
t2 = $[3];
|
|
35
|
-
}
|
|
36
|
-
const backgroundColor = t2;
|
|
37
|
-
let t3;
|
|
38
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
39
|
-
t3 = {
|
|
40
|
-
context: "Confirmation"
|
|
41
|
-
};
|
|
42
|
-
$[4] = t3;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
t3 = $[4];
|
|
46
|
-
}
|
|
47
|
-
useKeybinding("confirm:no", onBack, t3);
|
|
48
|
-
let t4;
|
|
49
|
-
if ($[5] !== onBack) {
|
|
50
|
-
t4 = e => {
|
|
51
|
-
if (e.key === "return") {
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
onBack();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
$[5] = onBack;
|
|
57
|
-
$[6] = t4;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
t4 = $[6];
|
|
61
|
-
}
|
|
62
|
-
const handleKeyDown = t4;
|
|
63
|
-
const renderToolsList = function renderToolsList() {
|
|
14
|
+
const filePath = getActualRelativeAgentFilePath(agent);
|
|
15
|
+
const backgroundColor = getAgentColor(agent.agentType);
|
|
16
|
+
useKeybinding('confirm:no', onBack, { context: 'Confirmation' });
|
|
17
|
+
const handleKeyDown = (e) => {
|
|
18
|
+
if (e.key === 'return') {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
onBack();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function renderToolsList() {
|
|
64
24
|
if (resolvedTools.hasWildcard) {
|
|
65
|
-
return _jsx(Text, { children: "
|
|
25
|
+
return _jsx(Text, { children: "Todas las herramientas" });
|
|
66
26
|
}
|
|
67
27
|
if (!agent.tools || agent.tools.length === 0) {
|
|
68
|
-
return _jsx(Text, { children: "
|
|
28
|
+
return _jsx(Text, { children: "Ninguna" });
|
|
69
29
|
}
|
|
70
|
-
return _jsxs(_Fragment, { children: [resolvedTools.validTools.length > 0
|
|
71
|
-
};
|
|
72
|
-
const T0 = Box;
|
|
73
|
-
const t5 = "column";
|
|
74
|
-
const t6 = 1;
|
|
75
|
-
const t7 = 0;
|
|
76
|
-
const t8 = true;
|
|
77
|
-
let t9;
|
|
78
|
-
if ($[7] !== filePath) {
|
|
79
|
-
t9 = _jsx(Text, { dimColor: true, children: filePath });
|
|
80
|
-
$[7] = filePath;
|
|
81
|
-
$[8] = t9;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
t9 = $[8];
|
|
85
|
-
}
|
|
86
|
-
let t10;
|
|
87
|
-
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
88
|
-
t10 = _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Description" }), " (tells Claude when to use this agent):"] });
|
|
89
|
-
$[9] = t10;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
t10 = $[9];
|
|
93
|
-
}
|
|
94
|
-
let t11;
|
|
95
|
-
if ($[10] !== agent.whenToUse) {
|
|
96
|
-
t11 = _jsxs(Box, { flexDirection: "column", children: [t10, _jsx(Box, { marginLeft: 2, children: _jsx(Text, { children: agent.whenToUse }) })] });
|
|
97
|
-
$[10] = agent.whenToUse;
|
|
98
|
-
$[11] = t11;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
t11 = $[11];
|
|
102
|
-
}
|
|
103
|
-
const T1 = Box;
|
|
104
|
-
let t12;
|
|
105
|
-
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
106
|
-
t12 = _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Tools" }), ":", " "] });
|
|
107
|
-
$[12] = t12;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
t12 = $[12];
|
|
111
|
-
}
|
|
112
|
-
const t13 = renderToolsList();
|
|
113
|
-
let t14;
|
|
114
|
-
if ($[13] !== T1 || $[14] !== t12 || $[15] !== t13) {
|
|
115
|
-
t14 = _jsxs(T1, { children: [t12, t13] });
|
|
116
|
-
$[13] = T1;
|
|
117
|
-
$[14] = t12;
|
|
118
|
-
$[15] = t13;
|
|
119
|
-
$[16] = t14;
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
t14 = $[16];
|
|
123
|
-
}
|
|
124
|
-
let t15;
|
|
125
|
-
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
126
|
-
t15 = _jsx(Text, { bold: true, children: "Model" });
|
|
127
|
-
$[17] = t15;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
t15 = $[17];
|
|
131
|
-
}
|
|
132
|
-
let t16;
|
|
133
|
-
if ($[18] !== agent.model) {
|
|
134
|
-
t16 = getAgentModelDisplay(agent.model);
|
|
135
|
-
$[18] = agent.model;
|
|
136
|
-
$[19] = t16;
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
t16 = $[19];
|
|
140
|
-
}
|
|
141
|
-
let t17;
|
|
142
|
-
if ($[20] !== t16) {
|
|
143
|
-
t17 = _jsxs(Text, { children: [t15, ": ", t16] });
|
|
144
|
-
$[20] = t16;
|
|
145
|
-
$[21] = t17;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
t17 = $[21];
|
|
149
|
-
}
|
|
150
|
-
let t18;
|
|
151
|
-
if ($[22] !== agent.permissionMode) {
|
|
152
|
-
t18 = agent.permissionMode && _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Permission mode" }), ": ", agent.permissionMode] });
|
|
153
|
-
$[22] = agent.permissionMode;
|
|
154
|
-
$[23] = t18;
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
t18 = $[23];
|
|
158
|
-
}
|
|
159
|
-
let t19;
|
|
160
|
-
if ($[24] !== agent.memory) {
|
|
161
|
-
t19 = agent.memory && _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Memory" }), ": ", getMemoryScopeDisplay(agent.memory)] });
|
|
162
|
-
$[24] = agent.memory;
|
|
163
|
-
$[25] = t19;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
t19 = $[25];
|
|
167
|
-
}
|
|
168
|
-
let t20;
|
|
169
|
-
if ($[26] !== agent.hooks) {
|
|
170
|
-
t20 = agent.hooks && Object.keys(agent.hooks).length > 0 && _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Hooks" }), ": ", Object.keys(agent.hooks).join(", ")] });
|
|
171
|
-
$[26] = agent.hooks;
|
|
172
|
-
$[27] = t20;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
t20 = $[27];
|
|
176
|
-
}
|
|
177
|
-
let t21;
|
|
178
|
-
if ($[28] !== agent.skills) {
|
|
179
|
-
t21 = agent.skills && agent.skills.length > 0 && _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Skills" }), ":", " ", agent.skills.length > 10 ? `${agent.skills.length} skills` : agent.skills.join(", ")] });
|
|
180
|
-
$[28] = agent.skills;
|
|
181
|
-
$[29] = t21;
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
t21 = $[29];
|
|
185
|
-
}
|
|
186
|
-
let t22;
|
|
187
|
-
if ($[30] !== agent.agentType || $[31] !== backgroundColor) {
|
|
188
|
-
t22 = backgroundColor && _jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Color" }), ":", " ", _jsxs(Text, { backgroundColor: backgroundColor, color: "inverseText", children: [" ", agent.agentType, " "] })] }) });
|
|
189
|
-
$[30] = agent.agentType;
|
|
190
|
-
$[31] = backgroundColor;
|
|
191
|
-
$[32] = t22;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
t22 = $[32];
|
|
195
|
-
}
|
|
196
|
-
let t23;
|
|
197
|
-
if ($[33] !== agent) {
|
|
198
|
-
t23 = !isBuiltInAgent(agent) && _jsxs(_Fragment, { children: [_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "System prompt" }), ":"] }) }), _jsx(Box, { marginLeft: 2, marginRight: 2, children: _jsx(Markdown, { children: agent.getSystemPrompt() }) })] });
|
|
199
|
-
$[33] = agent;
|
|
200
|
-
$[34] = t23;
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
t23 = $[34];
|
|
204
|
-
}
|
|
205
|
-
let t24;
|
|
206
|
-
if ($[35] !== T0 || $[36] !== handleKeyDown || $[37] !== t11 || $[38] !== t14 || $[39] !== t17 || $[40] !== t18 || $[41] !== t19 || $[42] !== t20 || $[43] !== t21 || $[44] !== t22 || $[45] !== t23 || $[46] !== t9) {
|
|
207
|
-
t24 = _jsxs(T0, { flexDirection: t5, gap: t6, tabIndex: t7, autoFocus: t8, onKeyDown: handleKeyDown, children: [t9, t11, t14, t17, t18, t19, t20, t21, t22, t23] });
|
|
208
|
-
$[35] = T0;
|
|
209
|
-
$[36] = handleKeyDown;
|
|
210
|
-
$[37] = t11;
|
|
211
|
-
$[38] = t14;
|
|
212
|
-
$[39] = t17;
|
|
213
|
-
$[40] = t18;
|
|
214
|
-
$[41] = t19;
|
|
215
|
-
$[42] = t20;
|
|
216
|
-
$[43] = t21;
|
|
217
|
-
$[44] = t22;
|
|
218
|
-
$[45] = t23;
|
|
219
|
-
$[46] = t9;
|
|
220
|
-
$[47] = t24;
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
t24 = $[47];
|
|
30
|
+
return (_jsxs(_Fragment, { children: [resolvedTools.validTools.length > 0 ? (_jsx(Text, { children: resolvedTools.validTools.join(', ') })) : null, resolvedTools.invalidTools.length > 0 ? (_jsxs(Text, { color: "warning", children: [figures.warning, " No reconocidas:", ' ', resolvedTools.invalidTools.join(', ')] })) : null] }));
|
|
224
31
|
}
|
|
225
|
-
return
|
|
32
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, tabIndex: 0, autoFocus: true, onKeyDown: handleKeyDown, children: [_jsx(Text, { dimColor: true, children: filePath }), _jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Descripcion" }), " (indica cuando debe usarse este agente):"] }), _jsx(Box, { marginLeft: 2, children: _jsx(Text, { children: agent.whenToUse }) })] }), _jsxs(Box, { children: [_jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Herramientas" }), ":", ' '] }), renderToolsList()] }), _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Proveedor" }), ": ", getAgentProviderDisplay(agent.provider)] }), _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Modelo" }), ":", ' ', getAgentModelDisplay(agent.model, agent.provider)] }), agent.permissionMode ? (_jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Modo de permisos" }), ": ", agent.permissionMode] })) : null, agent.memory ? (_jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Memoria" }), ": ", getMemoryScopeDisplay(agent.memory)] })) : null, agent.hooks && Object.keys(agent.hooks).length > 0 ? (_jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Hooks" }), ": ", Object.keys(agent.hooks).join(', ')] })) : null, agent.skills && agent.skills.length > 0 ? (_jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Skills" }), ":", ' ', agent.skills.length > 10
|
|
33
|
+
? `${agent.skills.length} skills configuradas`
|
|
34
|
+
: agent.skills.join(', ')] })) : null, backgroundColor ? (_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Color" }), ":", ' ', _jsxs(Text, { backgroundColor: backgroundColor, color: "inverseText", children: [' ', agent.agentType, ' '] })] }) })) : null, !isBuiltInAgent(agent) ? (_jsxs(_Fragment, { children: [_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Prompt del sistema" }), ":"] }) }), _jsx(Box, { marginLeft: 2, marginRight: 2, children: _jsx(Markdown, { children: agent.getSystemPrompt() }) })] })) : null] }));
|
|
226
35
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import figures from 'figures';
|
|
4
4
|
import { useCallback, useMemo, useState } from 'react';
|
|
5
5
|
import { useSetAppState } from '../../state/AppState.js';
|
|
6
6
|
import { Box, Text } from '../../ink.js';
|
|
7
7
|
import { useKeybinding } from '../../keybindings/useKeybinding.js';
|
|
8
|
-
import { setAgentColor } from '../../tools/AgentTool/agentColorManager.js';
|
|
9
|
-
import { getActiveAgentsFromList, isCustomAgent, isPluginAgent } from '../../tools/AgentTool/loadAgentsDir.js';
|
|
8
|
+
import { setAgentColor, } from '../../tools/AgentTool/agentColorManager.js';
|
|
9
|
+
import { getActiveAgentsFromList, isCustomAgent, isPluginAgent, } from '../../tools/AgentTool/loadAgentsDir.js';
|
|
10
10
|
import { editFileInEditor } from '../../utils/promptEditor.js';
|
|
11
11
|
import { getActualAgentFilePath, updateAgentFile } from './agentFileUtils.js';
|
|
12
12
|
import { ColorPicker } from './ColorPicker.js';
|
|
13
13
|
import { ModelSelector } from './ModelSelector.js';
|
|
14
14
|
import { ToolSelector } from './ToolSelector.js';
|
|
15
15
|
import { getAgentSourceDisplayName } from './utils.js';
|
|
16
|
-
export function AgentEditor({ agent, tools, onSaved, onBack }) {
|
|
16
|
+
export function AgentEditor({ agent, tools, onSaved, onBack, }) {
|
|
17
17
|
const setAppState = useSetAppState();
|
|
18
18
|
const [editMode, setEditMode] = useState('menu');
|
|
19
19
|
const [selectedMenuIndex, setSelectedMenuIndex] = useState(0);
|
|
@@ -24,75 +24,71 @@ export function AgentEditor({ agent, tools, onSaved, onBack }) {
|
|
|
24
24
|
const result = await editFileInEditor(filePath);
|
|
25
25
|
if (result.error) {
|
|
26
26
|
setError(result.error);
|
|
27
|
+
return;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
onSaved(`Opened ${agent.agentType} in editor. If you made edits, restart to load the latest version.`);
|
|
30
|
-
}
|
|
29
|
+
onSaved(`Se abrio ${agent.agentType} en el editor. Si hiciste cambios, reinicia para cargar la version mas reciente.`);
|
|
31
30
|
}, [agent, onSaved]);
|
|
32
31
|
const handleSave = useCallback(async (changes = {}) => {
|
|
33
|
-
const { tools: newTools, color: newColor, model: newModel } = changes;
|
|
32
|
+
const { tools: newTools, color: newColor, model: newModel, provider: newProvider } = changes;
|
|
34
33
|
const finalColor = newColor ?? selectedColor;
|
|
35
34
|
const hasToolsChanged = newTools !== undefined;
|
|
36
35
|
const hasModelChanged = newModel !== undefined;
|
|
36
|
+
const hasProviderChanged = newProvider !== undefined;
|
|
37
37
|
const hasColorChanged = finalColor !== agent.color;
|
|
38
|
-
if (!hasToolsChanged &&
|
|
38
|
+
if (!hasToolsChanged &&
|
|
39
|
+
!hasModelChanged &&
|
|
40
|
+
!hasProviderChanged &&
|
|
41
|
+
!hasColorChanged) {
|
|
39
42
|
return false;
|
|
40
43
|
}
|
|
41
44
|
try {
|
|
42
|
-
// Only custom/plugin agents can be edited
|
|
43
|
-
// this is for type safety; the UI shouldn't allow editing otherwise
|
|
44
45
|
if (!isCustomAgent(agent) && !isPluginAgent(agent)) {
|
|
45
46
|
return false;
|
|
46
47
|
}
|
|
47
|
-
await updateAgentFile(agent, agent.whenToUse, newTools ?? agent.tools, agent.getSystemPrompt(), finalColor, newModel ?? agent.model);
|
|
48
|
+
await updateAgentFile(agent, agent.whenToUse, newTools ?? agent.tools, agent.getSystemPrompt(), finalColor, newModel ?? agent.model, newProvider ?? agent.provider);
|
|
48
49
|
if (hasColorChanged && finalColor) {
|
|
49
50
|
setAgentColor(agent.agentType, finalColor);
|
|
50
51
|
}
|
|
51
52
|
setAppState(state => {
|
|
52
|
-
const allAgents = state.agentDefinitions.allAgents.map(a => a.agentType === agent.agentType
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
const allAgents = state.agentDefinitions.allAgents.map(a => a.agentType === agent.agentType
|
|
54
|
+
? {
|
|
55
|
+
...a,
|
|
56
|
+
tools: newTools ?? a.tools,
|
|
57
|
+
color: finalColor,
|
|
58
|
+
model: newModel ?? a.model,
|
|
59
|
+
provider: newProvider ?? a.provider,
|
|
60
|
+
}
|
|
61
|
+
: a);
|
|
58
62
|
return {
|
|
59
63
|
...state,
|
|
60
64
|
agentDefinitions: {
|
|
61
65
|
...state.agentDefinitions,
|
|
62
66
|
activeAgents: getActiveAgentsFromList(allAgents),
|
|
63
|
-
allAgents
|
|
64
|
-
}
|
|
67
|
+
allAgents,
|
|
68
|
+
},
|
|
65
69
|
};
|
|
66
70
|
});
|
|
67
71
|
onSaved(`Updated agent: ${chalk.bold(agent.agentType)}`);
|
|
68
72
|
return true;
|
|
69
73
|
}
|
|
70
74
|
catch (err) {
|
|
71
|
-
setError(err instanceof Error ? err.message : '
|
|
75
|
+
setError(err instanceof Error ? err.message : 'No se pudo guardar el agente');
|
|
72
76
|
return false;
|
|
73
77
|
}
|
|
74
|
-
}, [agent,
|
|
75
|
-
const menuItems = useMemo(() => [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, {
|
|
82
|
-
label: 'Edit model',
|
|
83
|
-
action: () => setEditMode('edit-model')
|
|
84
|
-
}, {
|
|
85
|
-
label: 'Edit color',
|
|
86
|
-
action: () => setEditMode('edit-color')
|
|
87
|
-
}], [handleOpenInEditor]);
|
|
78
|
+
}, [agent, onSaved, selectedColor, setAppState]);
|
|
79
|
+
const menuItems = useMemo(() => [
|
|
80
|
+
{ label: 'Abrir en editor', action: handleOpenInEditor },
|
|
81
|
+
{ label: 'Editar herramientas', action: () => setEditMode('edit-tools') },
|
|
82
|
+
{ label: 'Editar modelo', action: () => setEditMode('edit-model') },
|
|
83
|
+
{ label: 'Editar color', action: () => setEditMode('edit-color') },
|
|
84
|
+
], [handleOpenInEditor]);
|
|
88
85
|
const handleEscape = useCallback(() => {
|
|
89
86
|
setError(null);
|
|
90
87
|
if (editMode === 'menu') {
|
|
91
88
|
onBack();
|
|
89
|
+
return;
|
|
92
90
|
}
|
|
93
|
-
|
|
94
|
-
setEditMode('menu');
|
|
95
|
-
}
|
|
91
|
+
setEditMode('menu');
|
|
96
92
|
}, [editMode, onBack]);
|
|
97
93
|
const handleMenuKeyDown = useCallback((e) => {
|
|
98
94
|
if (e.key === 'up') {
|
|
@@ -101,7 +97,7 @@ export function AgentEditor({ agent, tools, onSaved, onBack }) {
|
|
|
101
97
|
}
|
|
102
98
|
else if (e.key === 'down') {
|
|
103
99
|
e.preventDefault();
|
|
104
|
-
setSelectedMenuIndex(
|
|
100
|
+
setSelectedMenuIndex(index => Math.min(menuItems.length - 1, index + 1));
|
|
105
101
|
}
|
|
106
102
|
else if (e.key === 'return') {
|
|
107
103
|
e.preventDefault();
|
|
@@ -111,36 +107,30 @@ export function AgentEditor({ agent, tools, onSaved, onBack }) {
|
|
|
111
107
|
}
|
|
112
108
|
}
|
|
113
109
|
}, [menuItems, selectedMenuIndex]);
|
|
114
|
-
useKeybinding('confirm:no', handleEscape, {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
setEditMode('menu');
|
|
139
|
-
await handleSave({
|
|
140
|
-
model
|
|
141
|
-
});
|
|
142
|
-
} });
|
|
143
|
-
default:
|
|
144
|
-
return null;
|
|
110
|
+
useKeybinding('confirm:no', handleEscape, { context: 'Confirmation' });
|
|
111
|
+
if (editMode === 'edit-tools') {
|
|
112
|
+
return (_jsx(ToolSelector, { tools: tools, initialTools: agent.tools, onComplete: async (finalTools) => {
|
|
113
|
+
setEditMode('menu');
|
|
114
|
+
await handleSave({ tools: finalTools });
|
|
115
|
+
} }));
|
|
116
|
+
}
|
|
117
|
+
if (editMode === 'edit-color') {
|
|
118
|
+
return (_jsx(ColorPicker, { agentName: agent.agentType, currentColor: selectedColor ||
|
|
119
|
+
agent.color ||
|
|
120
|
+
'automatic', onConfirm: async (color) => {
|
|
121
|
+
setSelectedColor(color);
|
|
122
|
+
setEditMode('menu');
|
|
123
|
+
await handleSave({ color });
|
|
124
|
+
} }));
|
|
125
|
+
}
|
|
126
|
+
if (editMode === 'edit-model') {
|
|
127
|
+
return (_jsx(ModelSelector, { initialModel: agent.model, initialProvider: agent.provider, onComplete: async (selection) => {
|
|
128
|
+
setEditMode('menu');
|
|
129
|
+
await handleSave({
|
|
130
|
+
model: selection.model,
|
|
131
|
+
provider: selection.provider,
|
|
132
|
+
});
|
|
133
|
+
} }));
|
|
145
134
|
}
|
|
135
|
+
return (_jsxs(Box, { flexDirection: "column", tabIndex: 0, autoFocus: true, onKeyDown: handleMenuKeyDown, children: [_jsxs(Text, { dimColor: true, children: ["Origen: ", getAgentSourceDisplayName(agent.source)] }), _jsx(Box, { marginTop: 1, flexDirection: "column", children: menuItems.map((item, index) => (_jsxs(Text, { color: index === selectedMenuIndex ? 'suggestion' : undefined, children: [index === selectedMenuIndex ? `${figures.pointer} ` : ' ', item.label] }, item.label))) }), error ? (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "error", children: error }) })) : null] }));
|
|
146
136
|
}
|
|
@@ -3,7 +3,7 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
3
3
|
import figures from 'figures';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { Box, Text } from '../../ink.js';
|
|
6
|
-
import { AGENT_SOURCE_GROUPS, compareAgentsByName, getOverrideSourceLabel, resolveAgentModelDisplay } from '../../tools/AgentTool/agentDisplay.js';
|
|
6
|
+
import { AGENT_SOURCE_GROUPS, compareAgentsByName, getOverrideSourceLabel, resolveAgentModelDisplay, resolveAgentProviderDisplay } from '../../tools/AgentTool/agentDisplay.js';
|
|
7
7
|
import { count } from '../../utils/array.js';
|
|
8
8
|
import { Dialog } from '../design-system/Dialog.js';
|
|
9
9
|
import { Divider } from '../design-system/Divider.js';
|
|
@@ -42,8 +42,9 @@ export function AgentsList(t0) {
|
|
|
42
42
|
const { isOverridden, overriddenBy } = getOverrideInfo(agent_0);
|
|
43
43
|
const dimmed = isBuiltIn || isOverridden;
|
|
44
44
|
const textColor = !isBuiltIn && isSelected ? "suggestion" : undefined;
|
|
45
|
+
const resolvedProvider = resolveAgentProviderDisplay(agent_0);
|
|
45
46
|
const resolvedModel = resolveAgentModelDisplay(agent_0);
|
|
46
|
-
return _jsxs(Box, { children: [_jsx(Text, { dimColor: dimmed && !isSelected, color: textColor, children: isBuiltIn ? "" : isSelected ? `${figures.pointer} ` : " " }), _jsx(Text, { dimColor: dimmed && !isSelected, color: textColor, children: agent_0.agentType }), resolvedModel && _jsxs(Text, { dimColor: true, color: textColor, children: [" \xB7 ", resolvedModel] }), agent_0.memory && _jsxs(Text, { dimColor: true, color: textColor, children: [" \xB7 ", agent_0.memory, " memoria"] }), overriddenBy && _jsxs(Text, { dimColor: !isSelected, color: isSelected ? "warning" : undefined, children: [" ", figures.warning, " reemplazado por ", getOverrideSourceLabel(overriddenBy)] })] }, `${agent_0.agentType}-${agent_0.source}`);
|
|
47
|
+
return _jsxs(Box, { children: [_jsx(Text, { dimColor: dimmed && !isSelected, color: textColor, children: isBuiltIn ? "" : isSelected ? `${figures.pointer} ` : " " }), _jsx(Text, { dimColor: dimmed && !isSelected, color: textColor, children: agent_0.agentType }), resolvedProvider && _jsxs(Text, { dimColor: true, color: textColor, children: [" \xB7 ", resolvedProvider] }), resolvedModel && _jsxs(Text, { dimColor: true, color: textColor, children: [" \xB7 ", resolvedModel] }), agent_0.memory && _jsxs(Text, { dimColor: true, color: textColor, children: [" \xB7 ", agent_0.memory, " memoria"] }), overriddenBy && _jsxs(Text, { dimColor: !isSelected, color: isSelected ? "warning" : undefined, children: [" ", figures.warning, " reemplazado por ", getOverrideSourceLabel(overriddenBy)] })] }, `${agent_0.agentType}-${agent_0.source}`);
|
|
47
48
|
};
|
|
48
49
|
$[4] = isCreateNewSelected;
|
|
49
50
|
$[5] = selectedAgent?.agentType;
|
|
@@ -338,7 +338,7 @@ export function AgentsMenu(t0) {
|
|
|
338
338
|
let t14;
|
|
339
339
|
if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
|
|
340
340
|
t14 = {
|
|
341
|
-
label: "
|
|
341
|
+
label: "Ver agente",
|
|
342
342
|
value: "view"
|
|
343
343
|
};
|
|
344
344
|
$[60] = t14;
|
|
@@ -349,10 +349,10 @@ export function AgentsMenu(t0) {
|
|
|
349
349
|
let t15;
|
|
350
350
|
if ($[61] !== isEditable) {
|
|
351
351
|
t15 = isEditable ? [{
|
|
352
|
-
label: "
|
|
352
|
+
label: "Editar agente",
|
|
353
353
|
value: "edit"
|
|
354
354
|
}, {
|
|
355
|
-
label: "
|
|
355
|
+
label: "Eliminar agente",
|
|
356
356
|
value: "delete"
|
|
357
357
|
}] : [];
|
|
358
358
|
$[61] = isEditable;
|
|
@@ -364,7 +364,7 @@ export function AgentsMenu(t0) {
|
|
|
364
364
|
let t16;
|
|
365
365
|
if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
|
|
366
366
|
t16 = {
|
|
367
|
-
label: "
|
|
367
|
+
label: "Volver",
|
|
368
368
|
value: "back"
|
|
369
369
|
};
|
|
370
370
|
$[63] = t16;
|
|
@@ -603,10 +603,10 @@ export function AgentsMenu(t0) {
|
|
|
603
603
|
let t13;
|
|
604
604
|
if ($[112] === Symbol.for("react.memo_cache_sentinel")) {
|
|
605
605
|
t13 = [{
|
|
606
|
-
label: "
|
|
606
|
+
label: "Si, eliminar",
|
|
607
607
|
value: "yes"
|
|
608
608
|
}, {
|
|
609
|
-
label: "No,
|
|
609
|
+
label: "No, cancelar",
|
|
610
610
|
value: "no"
|
|
611
611
|
}];
|
|
612
612
|
$[112] = t13;
|
|
@@ -630,7 +630,7 @@ export function AgentsMenu(t0) {
|
|
|
630
630
|
}
|
|
631
631
|
let t15;
|
|
632
632
|
if ($[115] !== modeState.agent.agentType) {
|
|
633
|
-
t15 = _jsxs(Text, { children: ["
|
|
633
|
+
t15 = _jsxs(Text, { children: ["Seguro que quieres eliminar el agente", " ", _jsx(Text, { bold: true, children: modeState.agent.agentType }), "?"] });
|
|
634
634
|
$[115] = modeState.agent.agentType;
|
|
635
635
|
$[116] = t15;
|
|
636
636
|
}
|
|
@@ -639,7 +639,7 @@ export function AgentsMenu(t0) {
|
|
|
639
639
|
}
|
|
640
640
|
let t16;
|
|
641
641
|
if ($[117] !== modeState.agent.source) {
|
|
642
|
-
t16 = _jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: ["
|
|
642
|
+
t16 = _jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: ["Origen: ", modeState.agent.source] }) });
|
|
643
643
|
$[117] = modeState.agent.source;
|
|
644
644
|
$[118] = t16;
|
|
645
645
|
}
|
|
@@ -690,7 +690,7 @@ export function AgentsMenu(t0) {
|
|
|
690
690
|
}
|
|
691
691
|
let t20;
|
|
692
692
|
if ($[127] !== t14 || $[128] !== t15 || $[129] !== t16 || $[130] !== t19) {
|
|
693
|
-
t20 = _jsxs(Dialog, { title: "
|
|
693
|
+
t20 = _jsxs(Dialog, { title: "Eliminar agente", onCancel: t14, color: "error", children: [t15, t16, t19] });
|
|
694
694
|
$[127] = t14;
|
|
695
695
|
$[128] = t15;
|
|
696
696
|
$[129] = t16;
|
|
@@ -742,7 +742,7 @@ export function AgentsMenu(t0) {
|
|
|
742
742
|
}
|
|
743
743
|
const freshAgent = t13;
|
|
744
744
|
const agentToEdit = freshAgent || modeState.agent;
|
|
745
|
-
const t14 = `
|
|
745
|
+
const t14 = `Editar agente: ${agentToEdit.agentType}`;
|
|
746
746
|
let t15;
|
|
747
747
|
if ($[140] !== modeState.previousMode) {
|
|
748
748
|
t15 = () => setModeState(modeState.previousMode);
|
|
@@ -54,7 +54,7 @@ export function ColorPicker(t0) {
|
|
|
54
54
|
if ($[5] !== selectedIndex) {
|
|
55
55
|
t4 = COLOR_OPTIONS.map((option, index) => {
|
|
56
56
|
const isSelected = index === selectedIndex;
|
|
57
|
-
return _jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsx(Text, { color: isSelected ? "suggestion" : undefined, children: isSelected ? figures.pointer : " " }), option === "automatic" ? _jsx(Text, { bold: isSelected, children: "
|
|
57
|
+
return _jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsx(Text, { color: isSelected ? "suggestion" : undefined, children: isSelected ? figures.pointer : " " }), option === "automatic" ? _jsx(Text, { bold: isSelected, children: "Color automatico" }) : _jsxs(Box, { gap: 1, children: [_jsx(Text, { backgroundColor: AGENT_COLOR_TO_THEME_COLOR[option], color: "inverseText", children: " " }), _jsx(Text, { bold: isSelected, children: capitalize(option) })] })] }, option);
|
|
58
58
|
});
|
|
59
59
|
$[5] = selectedIndex;
|
|
60
60
|
$[6] = t4;
|
|
@@ -73,7 +73,7 @@ export function ColorPicker(t0) {
|
|
|
73
73
|
}
|
|
74
74
|
let t6;
|
|
75
75
|
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
76
|
-
t6 = _jsx(Text, { children: "
|
|
76
|
+
t6 = _jsx(Text, { children: "Vista previa: " });
|
|
77
77
|
$[9] = t6;
|
|
78
78
|
}
|
|
79
79
|
else {
|