@iaforged/context-code 1.0.80 → 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/LogoV2/FeedColumn.js +3 -4
- package/dist/src/components/LogoV2/LogoV2.js +10 -10
- package/dist/src/components/LogoV2/WelcomeV2.js +1 -1
- 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/ModelSelector.js +204 -52
- 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/types.js +1 -0
- 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/agent.js +12 -3
- package/dist/src/utils/model/providerOverrideContext.js +11 -0
- package/dist/src/utils/model/providers.js +14 -0
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Box } from '../../ink.js';
|
|
5
|
-
import { Divider } from '../design-system/Divider.js';
|
|
6
5
|
import { calculateFeedWidth, Feed } from './Feed.js';
|
|
7
6
|
export function FeedColumn(t0) {
|
|
8
7
|
const $ = _c(10);
|
|
@@ -23,7 +22,7 @@ export function FeedColumn(t0) {
|
|
|
23
22
|
if ($[2] !== actualWidth || $[3] !== feeds) {
|
|
24
23
|
let t3;
|
|
25
24
|
if ($[5] !== actualWidth || $[6] !== feeds.length) {
|
|
26
|
-
t3 = (feed_0, index) =>
|
|
25
|
+
t3 = (feed_0, index) => _jsx(React.Fragment, { children: _jsx(Feed, { config: feed_0, actualWidth: actualWidth }) }, index);
|
|
27
26
|
$[5] = actualWidth;
|
|
28
27
|
$[6] = feeds.length;
|
|
29
28
|
$[7] = t3;
|
|
@@ -41,7 +40,7 @@ export function FeedColumn(t0) {
|
|
|
41
40
|
}
|
|
42
41
|
let t3;
|
|
43
42
|
if ($[8] !== t2) {
|
|
44
|
-
t3 = _jsx(Box, { flexDirection: "column", children: t2 });
|
|
43
|
+
t3 = _jsx(Box, { flexDirection: "column", gap: 1, children: t2 });
|
|
45
44
|
$[8] = t2;
|
|
46
45
|
$[9] = t3;
|
|
47
46
|
}
|
|
@@ -251,8 +251,8 @@ export function LogoV2() {
|
|
|
251
251
|
}
|
|
252
252
|
const layoutMode = getLayoutMode(columns);
|
|
253
253
|
const userTheme = resolveThemeSetting(getGlobalConfig().theme);
|
|
254
|
-
const borderTitle = ` ${color("claude", userTheme)("
|
|
255
|
-
const compactBorderTitle = color("claude", userTheme)("
|
|
254
|
+
const borderTitle = ` ${color("claude", userTheme)("CTX")} ${color("inactive", userTheme)(`v${version}`)} `;
|
|
255
|
+
const compactBorderTitle = color("claude", userTheme)(" CTX ");
|
|
256
256
|
if (layoutMode === "compact") {
|
|
257
257
|
let welcomeMessage = formatWelcomeMessage(username);
|
|
258
258
|
if (stringWidth(welcomeMessage) > columns - 4) {
|
|
@@ -335,7 +335,7 @@ export function LogoV2() {
|
|
|
335
335
|
t18 = $[42];
|
|
336
336
|
t19 = $[43];
|
|
337
337
|
}
|
|
338
|
-
return _jsxs(_Fragment, { children: [_jsx(OffscreenFreeze, { children: _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "claude", borderText: t11, paddingX:
|
|
338
|
+
return _jsxs(_Fragment, { children: [_jsx(OffscreenFreeze, { children: _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "claude", borderText: t11, paddingX: 2, paddingY: 1, alignItems: "center", width: columns, children: [_jsx(Text, { color: "claude", children: "CTX" }), _jsx(Text, { bold: true, children: welcomeMessage }), t12, _jsx(Text, { dimColor: true, children: modelDisplayName }), _jsx(Text, { dimColor: true, children: billingType }), agentName ? _jsxs(Text, { dimColor: true, children: ["@", agentName] }) : null, _jsx(Text, { dimColor: true, children: truncatedCwd })] }) }), t14, t15, t16, t17, t18, t19] });
|
|
339
339
|
}
|
|
340
340
|
const welcomeMessage_0 = formatWelcomeMessage(username);
|
|
341
341
|
const modelLine = !process.env.IS_DEMO && config.oauthAccount?.organizationName ? `${modelDisplayName} · ${billingType} · ${config.oauthAccount.organizationName}` : `${modelDisplayName} · ${billingType}`;
|
|
@@ -364,9 +364,9 @@ export function LogoV2() {
|
|
|
364
364
|
t14 = $[45];
|
|
365
365
|
}
|
|
366
366
|
const T2 = Box;
|
|
367
|
-
const t15 =
|
|
368
|
-
const t16 =
|
|
369
|
-
const t17 =
|
|
367
|
+
const t15 = "column";
|
|
368
|
+
const t16 = 2;
|
|
369
|
+
const t17 = 2;
|
|
370
370
|
let t18;
|
|
371
371
|
if ($[46] !== welcomeMessage_0) {
|
|
372
372
|
t18 = _jsx(Box, { marginTop: 1, children: _jsx(Text, { bold: true, children: welcomeMessage_0 }) });
|
|
@@ -404,7 +404,7 @@ export function LogoV2() {
|
|
|
404
404
|
}
|
|
405
405
|
let t22;
|
|
406
406
|
if ($[53] !== t20 || $[54] !== t21) {
|
|
407
|
-
t22 = _jsxs(Box, { flexDirection: "column", alignItems: "center", children: [t20, t21] });
|
|
407
|
+
t22 = _jsxs(Box, { flexDirection: "column", alignItems: "center", children: [_jsx(Text, { color: "claude", children: "CTX" }), t20, t21] });
|
|
408
408
|
$[53] = t20;
|
|
409
409
|
$[54] = t21;
|
|
410
410
|
$[55] = t22;
|
|
@@ -414,7 +414,7 @@ export function LogoV2() {
|
|
|
414
414
|
}
|
|
415
415
|
let t23;
|
|
416
416
|
if ($[56] !== leftWidth || $[57] !== t18 || $[58] !== t22) {
|
|
417
|
-
t23 = _jsxs(Box, { flexDirection: "column", width: leftWidth, justifyContent: "space-between", alignItems: "center", minHeight:
|
|
417
|
+
t23 = _jsxs(Box, { flexDirection: "column", width: leftWidth, justifyContent: "space-between", alignItems: "center", minHeight: 11, children: [t18, t19, t22] });
|
|
418
418
|
$[56] = leftWidth;
|
|
419
419
|
$[57] = t18;
|
|
420
420
|
$[58] = t22;
|
|
@@ -425,14 +425,14 @@ export function LogoV2() {
|
|
|
425
425
|
}
|
|
426
426
|
let t24;
|
|
427
427
|
if ($[60] !== layoutMode) {
|
|
428
|
-
t24 =
|
|
428
|
+
t24 = null;
|
|
429
429
|
$[60] = layoutMode;
|
|
430
430
|
$[61] = t24;
|
|
431
431
|
}
|
|
432
432
|
else {
|
|
433
433
|
t24 = $[61];
|
|
434
434
|
}
|
|
435
|
-
const t25 =
|
|
435
|
+
const t25 = _jsx(FeedColumn, { feeds: showOnboarding ? [createProjectOnboardingFeed(getSteps()), createRecentActivityFeed(activities)] : showGuestPassesUpsell ? [createRecentActivityFeed(activities), createGuestPassesFeed()] : showOverageCreditUpsell ? [createRecentActivityFeed(activities), createOverageCreditFeed()] : [createRecentActivityFeed(activities), createWhatsNewFeed(changelog)], maxWidth: Math.max(leftWidth, rightWidth) });
|
|
436
436
|
let t26;
|
|
437
437
|
if ($[62] !== T2 || $[63] !== t15 || $[64] !== t23 || $[65] !== t24 || $[66] !== t25) {
|
|
438
438
|
t26 = _jsxs(T2, { flexDirection: t15, paddingX: t16, gap: t17, children: [t23, t24, t25] });
|
|
@@ -4,5 +4,5 @@ import { Box, Text } from '../../ink.js';
|
|
|
4
4
|
import { Clawd } from './Clawd.js';
|
|
5
5
|
const WELCOME_WIDTH = 54;
|
|
6
6
|
export function WelcomeV2() {
|
|
7
|
-
return (_jsx(Box, { flexDirection: "column", width: WELCOME_WIDTH, children: _jsxs(Box, { borderStyle: "round", borderColor: "claude", paddingX:
|
|
7
|
+
return (_jsx(Box, { flexDirection: "column", width: WELCOME_WIDTH, children: _jsxs(Box, { borderStyle: "round", borderColor: "claude", paddingX: 3, paddingY: 1, flexDirection: "column", alignItems: "center", children: [_jsx(Text, { color: "claude", children: "CTX" }), _jsx(Text, { bold: true, children: "Context Code" }), _jsxs(Text, { dimColor: true, children: ["v", MACRO.VERSION] }), _jsx(Box, { marginTop: 1, marginBottom: 1, children: _jsx(Clawd, {}) }), _jsx(Text, { children: "Lee, edita y ejecuta sin perder contexto." }), _jsx(Text, { dimColor: true, children: "Configuracion inicial" })] }) }));
|
|
8
8
|
}
|
|
@@ -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;
|