@nomad-e/bluma-cli 0.0.31 → 0.0.32
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/main.js +176 -80
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -7,7 +7,7 @@ import { v4 as uuidv42 } from "uuid";
|
|
|
7
7
|
|
|
8
8
|
// src/app/ui/App.tsx
|
|
9
9
|
import { useState as useState4, useEffect as useEffect3, useRef, useCallback, memo as memo4 } from "react";
|
|
10
|
-
import { Box as
|
|
10
|
+
import { Box as Box15, Text as Text14, Static } from "ink";
|
|
11
11
|
|
|
12
12
|
// src/app/ui/layout.tsx
|
|
13
13
|
import { Box, Text } from "ink";
|
|
@@ -243,12 +243,14 @@ var filterSlashCommands = (query) => {
|
|
|
243
243
|
};
|
|
244
244
|
|
|
245
245
|
// src/app/ui/components/InputPrompt.tsx
|
|
246
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
246
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
247
247
|
var uiEventBus = global.__bluma_ui_eventbus__ || new EventEmitter();
|
|
248
248
|
global.__bluma_ui_eventbus__ = uiEventBus;
|
|
249
249
|
var InputPrompt = ({ onSubmit, isReadOnly, onInterrupt, disableWhileProcessing = false }) => {
|
|
250
250
|
const { stdout } = useStdout();
|
|
251
251
|
const [viewWidth, setViewWidth] = useState(() => stdout.columns - 6);
|
|
252
|
+
const [slashOpen, setSlashOpen] = useState(false);
|
|
253
|
+
const [slashIndex, setSlashIndex] = useState(0);
|
|
252
254
|
useEffect(() => {
|
|
253
255
|
const onResize = () => setViewWidth(stdout.columns - 6);
|
|
254
256
|
stdout.on("resize", onResize);
|
|
@@ -268,7 +270,7 @@ var InputPrompt = ({ onSubmit, isReadOnly, onInterrupt, disableWhileProcessing =
|
|
|
268
270
|
}
|
|
269
271
|
onSubmit(value);
|
|
270
272
|
};
|
|
271
|
-
const effectiveReadOnly =
|
|
273
|
+
const effectiveReadOnly = isReadOnly;
|
|
272
274
|
const { text, cursorPosition, viewStart } = useCustomInput({
|
|
273
275
|
onSubmit: (value) => {
|
|
274
276
|
if (disableWhileProcessing && isReadOnly) return;
|
|
@@ -278,19 +280,14 @@ var InputPrompt = ({ onSubmit, isReadOnly, onInterrupt, disableWhileProcessing =
|
|
|
278
280
|
isReadOnly: effectiveReadOnly,
|
|
279
281
|
onInterrupt
|
|
280
282
|
});
|
|
281
|
-
const [slashOpen, setSlashOpen] = useState(false);
|
|
282
|
-
const [slashIndex, setSlashIndex] = useState(0);
|
|
283
283
|
const visibleText = text.slice(viewStart, viewStart + viewWidth);
|
|
284
284
|
const visibleCursorPosition = cursorPosition - viewStart;
|
|
285
285
|
const textBeforeCursor = visibleText.slice(0, visibleCursorPosition);
|
|
286
|
-
const charAtCursor = visibleText.slice(
|
|
287
|
-
visibleCursorPosition,
|
|
288
|
-
visibleCursorPosition + 1
|
|
289
|
-
);
|
|
286
|
+
const charAtCursor = visibleText.slice(visibleCursorPosition, visibleCursorPosition + 1);
|
|
290
287
|
const textAfterCursor = visibleText.slice(visibleCursorPosition + 1);
|
|
291
288
|
const cursorGlyph = charAtCursor && charAtCursor.length > 0 ? charAtCursor : " ";
|
|
292
289
|
const borderColor = isReadOnly ? "gray" : "gray";
|
|
293
|
-
const placeholder = isReadOnly ? "
|
|
290
|
+
const placeholder = isReadOnly ? " Press Esc to cancel | Enter message while agent runs" : "";
|
|
294
291
|
const showPlaceholder = text.length === 0 && isReadOnly;
|
|
295
292
|
const slashQuery = useMemo(() => text.startsWith("/") ? text : "", [text]);
|
|
296
293
|
const slashSuggestions = useMemo(() => {
|
|
@@ -327,29 +324,40 @@ var InputPrompt = ({ onSubmit, isReadOnly, onInterrupt, disableWhileProcessing =
|
|
|
327
324
|
}
|
|
328
325
|
}, { isActive: slashOpen });
|
|
329
326
|
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
"
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
327
|
+
disableWhileProcessing ? (
|
|
328
|
+
// Modo bloqueado visualmente, mantendo hooks estáveis
|
|
329
|
+
/* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(Box2, { borderStyle: "round", borderColor: "gray", borderDimColor: true, children: /* @__PURE__ */ jsxs2(Box2, { flexDirection: "row", paddingX: 1, flexWrap: "nowrap", children: [
|
|
330
|
+
/* @__PURE__ */ jsxs2(Text2, { color: "white", children: [
|
|
331
|
+
">",
|
|
332
|
+
" "
|
|
333
|
+
] }),
|
|
334
|
+
/* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "ctrl+c to exit" })
|
|
335
|
+
] }) }) })
|
|
336
|
+
) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
337
|
+
/* @__PURE__ */ jsx2(Box2, { borderStyle: "round", borderColor, borderDimColor: !isReadOnly, children: /* @__PURE__ */ jsxs2(Box2, { flexDirection: "row", paddingX: 1, flexWrap: "nowrap", children: [
|
|
338
|
+
/* @__PURE__ */ jsxs2(Text2, { color: "white", children: [
|
|
339
|
+
">",
|
|
340
|
+
" "
|
|
341
|
+
] }),
|
|
342
|
+
/* @__PURE__ */ jsx2(Text2, { children: textBeforeCursor }),
|
|
343
|
+
/* @__PURE__ */ jsx2(Text2, { inverse: true, children: cursorGlyph }),
|
|
344
|
+
showPlaceholder ? /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: placeholder }) : /* @__PURE__ */ jsx2(Text2, { children: textAfterCursor })
|
|
345
|
+
] }) }),
|
|
346
|
+
slashOpen && slashSuggestions.length > 0 && /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", marginTop: 1, children: slashSuggestions.map((s, idx) => {
|
|
347
|
+
const isSelected = idx === slashIndex;
|
|
348
|
+
return /* @__PURE__ */ jsxs2(Box2, { paddingLeft: 1, paddingY: 0, children: [
|
|
349
|
+
/* @__PURE__ */ jsx2(Text2, { color: isSelected ? "blue" : "gray", children: isSelected ? "\u276F " : " " }),
|
|
350
|
+
/* @__PURE__ */ jsxs2(Text2, { color: isSelected ? "blue" : "white", bold: isSelected, dimColor: !isSelected, children: [
|
|
351
|
+
s.name,
|
|
352
|
+
" ",
|
|
353
|
+
/* @__PURE__ */ jsxs2(Text2, { color: "gray", children: [
|
|
354
|
+
"- ",
|
|
355
|
+
s.description
|
|
356
|
+
] })
|
|
349
357
|
] })
|
|
350
|
-
] })
|
|
351
|
-
|
|
352
|
-
|
|
358
|
+
] }, s.name);
|
|
359
|
+
}) })
|
|
360
|
+
] }),
|
|
353
361
|
/* @__PURE__ */ jsx2(Box2, { paddingX: 1, justifyContent: "center", children: /* @__PURE__ */ jsxs2(Text2, { color: "gray", dimColor: true, children: [
|
|
354
362
|
"ctrl+c to exit | /help to explore commands | esc to interrupt | ",
|
|
355
363
|
isReadOnly ? "Read-only mode (message passthrough)" : "Editable mode"
|
|
@@ -1189,14 +1197,14 @@ var MCPClient = class {
|
|
|
1189
1197
|
async invoke(toolName, args) {
|
|
1190
1198
|
const route = this.toolToServerMap.get(toolName);
|
|
1191
1199
|
if (!route) {
|
|
1192
|
-
return { error: `
|
|
1200
|
+
return { error: `This tool '${toolName}'is not found or registered you must use the correct name of this tool.` };
|
|
1193
1201
|
}
|
|
1194
1202
|
if (route.server === "native") {
|
|
1195
1203
|
return this.nativeToolInvoker.invoke(route.originalName, args);
|
|
1196
1204
|
} else {
|
|
1197
1205
|
const session = this.sessions.get(route.server);
|
|
1198
1206
|
if (!session) {
|
|
1199
|
-
return { error: `
|
|
1207
|
+
return { error: `Session to the server '${route.server}' n\xE3o encontrada.` };
|
|
1200
1208
|
}
|
|
1201
1209
|
const result = await session.callTool({ name: route.originalName, arguments: args });
|
|
1202
1210
|
return result.content;
|
|
@@ -1223,7 +1231,7 @@ var MCPClient = class {
|
|
|
1223
1231
|
try {
|
|
1224
1232
|
await session.close();
|
|
1225
1233
|
} catch (error) {
|
|
1226
|
-
console.error(`[MCPClient]
|
|
1234
|
+
console.error(`[MCPClient]Error closing connection to'${name}':`, error);
|
|
1227
1235
|
}
|
|
1228
1236
|
}
|
|
1229
1237
|
}
|
|
@@ -1248,12 +1256,12 @@ var AdvancedFeedbackSystem = class {
|
|
|
1248
1256
|
this.cumulativeScore += penalty;
|
|
1249
1257
|
return {
|
|
1250
1258
|
score: penalty,
|
|
1251
|
-
message: "
|
|
1259
|
+
message: "You are attempting a direct message without a tool_call. All replies must contain tool_call.",
|
|
1252
1260
|
correction: `
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1261
|
+
## PROTOCOL VIOLATION \u2014 SERIOUS
|
|
1262
|
+
You are sending a direct response without tool_call, which is strictly prohibited.
|
|
1263
|
+
PENALTY APPLIED: ${penalty.toFixed(1)} points deducted.
|
|
1264
|
+
You MUST always use tool_call without exception.
|
|
1257
1265
|
`.trim()
|
|
1258
1266
|
};
|
|
1259
1267
|
}
|
|
@@ -1824,6 +1832,7 @@ var BluMaAgent = class {
|
|
|
1824
1832
|
this.feedbackSystem = feedbackSystem;
|
|
1825
1833
|
this.eventBus.on("user_interrupt", () => {
|
|
1826
1834
|
this.isInterrupted = true;
|
|
1835
|
+
this.eventBus.emit("backend_message", { type: "done", status: "interrupted" });
|
|
1827
1836
|
});
|
|
1828
1837
|
this.eventBus.on("dev_overlay", async (data) => {
|
|
1829
1838
|
const clean = String(data.payload ?? "").trim();
|
|
@@ -2129,6 +2138,11 @@ Do not include future steps/to-dos in thought; put them strictly in remaining_ta
|
|
|
2129
2138
|
</edit_tool_rules>
|
|
2130
2139
|
|
|
2131
2140
|
|
|
2141
|
+
<agent_end_task_rules>
|
|
2142
|
+
This tool is mandatory.
|
|
2143
|
+
You must use it to inform developer {username} that the task has been completed and that there are no further pending actions, in accordance with the objectives defined for the task.
|
|
2144
|
+
</agent_end_task_rules>
|
|
2145
|
+
|
|
2132
2146
|
### Tool Naming Policy
|
|
2133
2147
|
- Use plain, unmodified, lowercase tool names
|
|
2134
2148
|
- No special characters, spaces, or version suffixes
|
|
@@ -2461,9 +2475,52 @@ var Agent = class {
|
|
|
2461
2475
|
const apiKey = process.env.AZURE_OPENAI_API_KEY;
|
|
2462
2476
|
const apiVersion = process.env.AZURE_OPENAI_API_VERSION;
|
|
2463
2477
|
this.deploymentName = process.env.AZURE_OPENAI_DEPLOYMENT || "";
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2478
|
+
const missing = [];
|
|
2479
|
+
if (!endpoint) missing.push("AZURE_OPENAI_ENDPOINT");
|
|
2480
|
+
if (!apiKey) missing.push("AZURE_OPENAI_API_KEY");
|
|
2481
|
+
if (!apiVersion) missing.push("AZURE_OPENAI_API_VERSION");
|
|
2482
|
+
if (!this.deploymentName) missing.push("AZURE_OPENAI_DEPLOYMENT");
|
|
2483
|
+
if (missing.length > 0) {
|
|
2484
|
+
const platform = process.platform;
|
|
2485
|
+
const varList = missing.join(", ");
|
|
2486
|
+
let guidance = "";
|
|
2487
|
+
if (platform === "win32") {
|
|
2488
|
+
guidance = [
|
|
2489
|
+
"Windows (PowerShell):",
|
|
2490
|
+
` $env:${missing[0]}="<value>" # sess\xE3o atual`,
|
|
2491
|
+
...missing.slice(1).map((v) => ` $env:${v}="<value>"`),
|
|
2492
|
+
" # Persistir para o utilizador:",
|
|
2493
|
+
...missing.map((v) => ` [System.Environment]::SetEnvironmentVariable("${v}", "<value>", "User")`),
|
|
2494
|
+
"",
|
|
2495
|
+
"Windows (cmd.exe):",
|
|
2496
|
+
...missing.map((v) => ` setx ${v} "<value>"`)
|
|
2497
|
+
].join("");
|
|
2498
|
+
} else if (platform === "darwin" || platform === "linux") {
|
|
2499
|
+
guidance = [
|
|
2500
|
+
"macOS/Linux (bash/zsh):",
|
|
2501
|
+
...missing.map((v) => ` echo 'export ${v}="<value>"' >> ~/.bashrc # ou ~/.zshrc`),
|
|
2502
|
+
" source ~/.bashrc # ou: source ~/.zshrc"
|
|
2503
|
+
].join("");
|
|
2504
|
+
} else {
|
|
2505
|
+
guidance = [
|
|
2506
|
+
"Generic POSIX:",
|
|
2507
|
+
...missing.map((v) => ` export ${v}="<value>"`)
|
|
2508
|
+
].join("");
|
|
2509
|
+
}
|
|
2510
|
+
const message = [
|
|
2511
|
+
`Missing required environment variables: ${varList}.`,
|
|
2512
|
+
`Configure them globally using the commands below (based on your OS), or set them in the config file: ${globalEnvPath}.`,
|
|
2513
|
+
"",
|
|
2514
|
+
guidance
|
|
2515
|
+
].join("");
|
|
2516
|
+
this.eventBus.emit("backend_message", {
|
|
2517
|
+
type: "error",
|
|
2518
|
+
code: "missing_env",
|
|
2519
|
+
missing,
|
|
2520
|
+
path: globalEnvPath,
|
|
2521
|
+
message
|
|
2522
|
+
});
|
|
2523
|
+
throw new Error(message);
|
|
2467
2524
|
}
|
|
2468
2525
|
const openai = new OpenAI({
|
|
2469
2526
|
// Configuração do cliente OpenAI hospedado no Azure
|
|
@@ -2819,7 +2876,7 @@ var SessionInfoConnectingMCP_default = SessionInfoConnectingMCP;
|
|
|
2819
2876
|
|
|
2820
2877
|
// src/app/ui/components/SlashCommands.tsx
|
|
2821
2878
|
import { Box as Box12, Text as Text11 } from "ink";
|
|
2822
|
-
import { Fragment, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2879
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2823
2880
|
var SlashCommands = ({ input, setHistory, agentRef }) => {
|
|
2824
2881
|
const [cmd, ...args] = input.slice(1).trim().split(/\s+/);
|
|
2825
2882
|
const outBox = (children) => /* @__PURE__ */ jsx12(Box12, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginBottom: 1, flexDirection: "column", children });
|
|
@@ -2830,7 +2887,7 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
|
|
|
2830
2887
|
if (cmd === "help") {
|
|
2831
2888
|
const cmds = getSlashCommands();
|
|
2832
2889
|
return outBox(
|
|
2833
|
-
/* @__PURE__ */ jsxs10(
|
|
2890
|
+
/* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2834
2891
|
/* @__PURE__ */ jsx12(Text11, { color: "cyan", bold: true, children: "Available commands" }),
|
|
2835
2892
|
cmds.map((c, i) => /* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
|
|
2836
2893
|
c.name,
|
|
@@ -2871,7 +2928,7 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
|
|
|
2871
2928
|
const colType = 10;
|
|
2872
2929
|
const colSource = 18;
|
|
2873
2930
|
return outBox(
|
|
2874
|
-
/* @__PURE__ */ jsxs10(
|
|
2931
|
+
/* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2875
2932
|
/* @__PURE__ */ jsx12(Text11, { color: "cyan", bold: true, children: "MCP Tools" }),
|
|
2876
2933
|
/* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
|
|
2877
2934
|
"Total MCP: ",
|
|
@@ -2920,7 +2977,7 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
|
|
|
2920
2977
|
const colType = 10;
|
|
2921
2978
|
const colSource = 18;
|
|
2922
2979
|
return outBox(
|
|
2923
|
-
/* @__PURE__ */ jsxs10(
|
|
2980
|
+
/* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2924
2981
|
/* @__PURE__ */ jsx12(Text11, { color: "cyan", bold: true, children: "Native Tools" }),
|
|
2925
2982
|
/* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
|
|
2926
2983
|
"Total Native: ",
|
|
@@ -2963,7 +3020,7 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
|
|
|
2963
3020
|
cmd
|
|
2964
3021
|
] }));
|
|
2965
3022
|
};
|
|
2966
|
-
return /* @__PURE__ */ jsx12(
|
|
3023
|
+
return /* @__PURE__ */ jsx12(Fragment2, { children: render2() });
|
|
2967
3024
|
};
|
|
2968
3025
|
var SlashCommands_default = SlashCommands;
|
|
2969
3026
|
|
|
@@ -3062,8 +3119,35 @@ var UpdateNotice = ({ message }) => {
|
|
|
3062
3119
|
};
|
|
3063
3120
|
var UpdateNotice_default = UpdateNotice;
|
|
3064
3121
|
|
|
3065
|
-
// src/app/ui/
|
|
3122
|
+
// src/app/ui/components/ErrorMessage.tsx
|
|
3123
|
+
import { Box as Box14, Text as Text13 } from "ink";
|
|
3066
3124
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3125
|
+
var ErrorMessage = ({ message, details, hint }) => {
|
|
3126
|
+
return /* @__PURE__ */ jsxs12(
|
|
3127
|
+
Box14,
|
|
3128
|
+
{
|
|
3129
|
+
borderStyle: "round",
|
|
3130
|
+
borderColor: "red",
|
|
3131
|
+
paddingX: 1,
|
|
3132
|
+
paddingY: 0,
|
|
3133
|
+
flexDirection: "column",
|
|
3134
|
+
marginBottom: 1,
|
|
3135
|
+
children: [
|
|
3136
|
+
/* @__PURE__ */ jsx14(Text13, { color: "red", bold: true, children: "Error" }),
|
|
3137
|
+
/* @__PURE__ */ jsx14(Text13, { color: "red", children: message }),
|
|
3138
|
+
details ? /* @__PURE__ */ jsx14(Text13, { color: "red", dimColor: true, children: details }) : null,
|
|
3139
|
+
hint ? /* @__PURE__ */ jsxs12(Text13, { color: "gray", children: [
|
|
3140
|
+
"Hint: ",
|
|
3141
|
+
hint
|
|
3142
|
+
] }) : null
|
|
3143
|
+
]
|
|
3144
|
+
}
|
|
3145
|
+
);
|
|
3146
|
+
};
|
|
3147
|
+
var ErrorMessage_default = ErrorMessage;
|
|
3148
|
+
|
|
3149
|
+
// src/app/ui/App.tsx
|
|
3150
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3067
3151
|
var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
3068
3152
|
const agentInstance = useRef(null);
|
|
3069
3153
|
const [history, setHistory] = useState4([]);
|
|
@@ -3081,6 +3165,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3081
3165
|
const [confirmationPreview, setConfirmationPreview] = useState4(
|
|
3082
3166
|
null
|
|
3083
3167
|
);
|
|
3168
|
+
const [isInitAgentActive, setIsInitAgentActive] = useState4(false);
|
|
3084
3169
|
const alwaysAcceptList = useRef([]);
|
|
3085
3170
|
const workdir = process.cwd();
|
|
3086
3171
|
const updateCheckRan = useRef(false);
|
|
@@ -3092,7 +3177,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3092
3177
|
...prev,
|
|
3093
3178
|
{
|
|
3094
3179
|
id: prev.length,
|
|
3095
|
-
component: /* @__PURE__ */
|
|
3180
|
+
component: /* @__PURE__ */ jsx15(Text14, { color: "yellow", children: "-- Task cancelled by dev. --" })
|
|
3096
3181
|
}
|
|
3097
3182
|
]);
|
|
3098
3183
|
}, [isProcessing, eventBus2]);
|
|
@@ -3105,16 +3190,19 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3105
3190
|
setIsProcessing(false);
|
|
3106
3191
|
return;
|
|
3107
3192
|
}
|
|
3193
|
+
if (cmd === "init") {
|
|
3194
|
+
setIsInitAgentActive(true);
|
|
3195
|
+
}
|
|
3108
3196
|
setIsProcessing(true);
|
|
3109
3197
|
setHistory((prev) => [
|
|
3110
3198
|
...prev,
|
|
3111
3199
|
{
|
|
3112
3200
|
id: prev.length,
|
|
3113
|
-
component: /* @__PURE__ */
|
|
3201
|
+
component: /* @__PURE__ */ jsx15(Box15, { marginBottom: 1, children: /* @__PURE__ */ jsx15(Text14, { color: "white", dimColor: true, children: text }) })
|
|
3114
3202
|
},
|
|
3115
3203
|
{
|
|
3116
3204
|
id: prev.length + 1,
|
|
3117
|
-
component: /* @__PURE__ */
|
|
3205
|
+
component: /* @__PURE__ */ jsx15(
|
|
3118
3206
|
SlashCommands_default,
|
|
3119
3207
|
{
|
|
3120
3208
|
input: text,
|
|
@@ -3134,8 +3222,8 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3134
3222
|
id: prev.length,
|
|
3135
3223
|
component: (
|
|
3136
3224
|
// Uma única Box para o espaçamento
|
|
3137
|
-
/* @__PURE__ */
|
|
3138
|
-
/* @__PURE__ */
|
|
3225
|
+
/* @__PURE__ */ jsx15(Box15, { marginBottom: 1, children: /* @__PURE__ */ jsxs13(Text14, { color: "white", dimColor: true, children: [
|
|
3226
|
+
/* @__PURE__ */ jsxs13(Text14, { color: "white", children: [
|
|
3139
3227
|
">",
|
|
3140
3228
|
" "
|
|
3141
3229
|
] }),
|
|
@@ -3170,7 +3258,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3170
3258
|
[]
|
|
3171
3259
|
);
|
|
3172
3260
|
useEffect3(() => {
|
|
3173
|
-
setHistory([{ id: 0, component: /* @__PURE__ */
|
|
3261
|
+
setHistory([{ id: 0, component: /* @__PURE__ */ jsx15(Header, {}) }]);
|
|
3174
3262
|
const initializeAgent = async () => {
|
|
3175
3263
|
try {
|
|
3176
3264
|
agentInstance.current = new Agent(sessionId2, eventBus2);
|
|
@@ -3190,6 +3278,9 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3190
3278
|
};
|
|
3191
3279
|
const handleBackendMessage = (parsed) => {
|
|
3192
3280
|
try {
|
|
3281
|
+
if (parsed.type === "done" || parsed.type === "error") {
|
|
3282
|
+
setIsInitAgentActive(false);
|
|
3283
|
+
}
|
|
3193
3284
|
if (parsed.type === "connection_status") {
|
|
3194
3285
|
setStatusMessage(parsed.message);
|
|
3195
3286
|
return;
|
|
@@ -3222,7 +3313,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3222
3313
|
if (prev.length < 2) {
|
|
3223
3314
|
newHistory.push({
|
|
3224
3315
|
id: 1,
|
|
3225
|
-
component: /* @__PURE__ */
|
|
3316
|
+
component: /* @__PURE__ */ jsx15(
|
|
3226
3317
|
SessionInfo,
|
|
3227
3318
|
{
|
|
3228
3319
|
sessionId: sessionId2,
|
|
@@ -3243,7 +3334,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3243
3334
|
...prev,
|
|
3244
3335
|
{
|
|
3245
3336
|
id: prev.length,
|
|
3246
|
-
component: /* @__PURE__ */
|
|
3337
|
+
component: /* @__PURE__ */ jsx15(UpdateNotice_default, { message: msg })
|
|
3247
3338
|
}
|
|
3248
3339
|
]);
|
|
3249
3340
|
}
|
|
@@ -3257,10 +3348,10 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3257
3348
|
}
|
|
3258
3349
|
let newComponent = null;
|
|
3259
3350
|
if (parsed.type === "debug") {
|
|
3260
|
-
newComponent = /* @__PURE__ */
|
|
3351
|
+
newComponent = /* @__PURE__ */ jsx15(Text14, { color: "gray", children: parsed.message });
|
|
3261
3352
|
} else if (parsed.type === "protocol_violation") {
|
|
3262
|
-
newComponent = /* @__PURE__ */
|
|
3263
|
-
|
|
3353
|
+
newComponent = /* @__PURE__ */ jsxs13(
|
|
3354
|
+
Box15,
|
|
3264
3355
|
{
|
|
3265
3356
|
borderStyle: "round",
|
|
3266
3357
|
borderColor: "yellow",
|
|
@@ -3268,19 +3359,23 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3268
3359
|
marginBottom: 1,
|
|
3269
3360
|
paddingX: 1,
|
|
3270
3361
|
children: [
|
|
3271
|
-
/* @__PURE__ */
|
|
3272
|
-
/* @__PURE__ */
|
|
3273
|
-
/* @__PURE__ */
|
|
3362
|
+
/* @__PURE__ */ jsx15(Text14, { color: "yellow", bold: true, children: "Protocol Violation" }),
|
|
3363
|
+
/* @__PURE__ */ jsx15(Text14, { color: "gray", children: parsed.content }),
|
|
3364
|
+
/* @__PURE__ */ jsx15(Text14, { color: "yellow", children: parsed.message })
|
|
3274
3365
|
]
|
|
3275
3366
|
}
|
|
3276
3367
|
);
|
|
3277
3368
|
} else if (parsed.type === "error") {
|
|
3278
|
-
newComponent = /* @__PURE__ */
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3369
|
+
newComponent = /* @__PURE__ */ jsx15(
|
|
3370
|
+
ErrorMessage_default,
|
|
3371
|
+
{
|
|
3372
|
+
message: parsed.message,
|
|
3373
|
+
details: parsed.details || void 0,
|
|
3374
|
+
hint: parsed.hint || void 0
|
|
3375
|
+
}
|
|
3376
|
+
);
|
|
3282
3377
|
} else if (parsed.type === "tool_call") {
|
|
3283
|
-
newComponent = /* @__PURE__ */
|
|
3378
|
+
newComponent = /* @__PURE__ */ jsx15(
|
|
3284
3379
|
ToolCallDisplay,
|
|
3285
3380
|
{
|
|
3286
3381
|
toolName: parsed.tool_name,
|
|
@@ -3289,7 +3384,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3289
3384
|
}
|
|
3290
3385
|
);
|
|
3291
3386
|
} else if (parsed.type === "tool_result") {
|
|
3292
|
-
newComponent = /* @__PURE__ */
|
|
3387
|
+
newComponent = /* @__PURE__ */ jsx15(
|
|
3293
3388
|
ToolResultDisplay,
|
|
3294
3389
|
{
|
|
3295
3390
|
toolName: parsed.tool_name,
|
|
@@ -3297,15 +3392,15 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3297
3392
|
}
|
|
3298
3393
|
);
|
|
3299
3394
|
} else if (parsed.type === "dev_overlay") {
|
|
3300
|
-
newComponent = /* @__PURE__ */
|
|
3301
|
-
/* @__PURE__ */
|
|
3395
|
+
newComponent = /* @__PURE__ */ jsx15(Box15, { marginBottom: 1, children: /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
3396
|
+
/* @__PURE__ */ jsxs13(Text14, { color: "blue", children: [
|
|
3302
3397
|
">",
|
|
3303
3398
|
" "
|
|
3304
3399
|
] }),
|
|
3305
3400
|
parsed.payload
|
|
3306
3401
|
] }) });
|
|
3307
3402
|
} else if (parsed.type === "log") {
|
|
3308
|
-
newComponent = /* @__PURE__ */
|
|
3403
|
+
newComponent = /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
3309
3404
|
"\u2139\uFE0F ",
|
|
3310
3405
|
parsed.message,
|
|
3311
3406
|
parsed.payload ? `: ${parsed.payload}` : ""
|
|
@@ -3335,7 +3430,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3335
3430
|
}, [eventBus2, sessionId2, handleConfirmation]);
|
|
3336
3431
|
const renderInteractiveComponent = () => {
|
|
3337
3432
|
if (mcpStatus !== "connected") {
|
|
3338
|
-
return /* @__PURE__ */
|
|
3433
|
+
return /* @__PURE__ */ jsx15(Box15, { borderStyle: "round", borderColor: "black", children: /* @__PURE__ */ jsx15(
|
|
3339
3434
|
SessionInfoConnectingMCP_default,
|
|
3340
3435
|
{
|
|
3341
3436
|
sessionId: sessionId2,
|
|
@@ -3345,7 +3440,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3345
3440
|
) });
|
|
3346
3441
|
}
|
|
3347
3442
|
if (pendingConfirmation) {
|
|
3348
|
-
return /* @__PURE__ */
|
|
3443
|
+
return /* @__PURE__ */ jsx15(
|
|
3349
3444
|
ConfirmationPrompt,
|
|
3350
3445
|
{
|
|
3351
3446
|
toolCalls: pendingConfirmation,
|
|
@@ -3357,20 +3452,21 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3357
3452
|
}
|
|
3358
3453
|
);
|
|
3359
3454
|
}
|
|
3360
|
-
return /* @__PURE__ */
|
|
3361
|
-
isProcessing && !pendingConfirmation && /* @__PURE__ */
|
|
3362
|
-
/* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ jsxs13(Box15, { flexDirection: "column", children: [
|
|
3456
|
+
isProcessing && !pendingConfirmation && /* @__PURE__ */ jsx15(WorkingTimer, {}),
|
|
3457
|
+
/* @__PURE__ */ jsx15(
|
|
3363
3458
|
InputPrompt,
|
|
3364
3459
|
{
|
|
3365
3460
|
onSubmit: handleSubmit,
|
|
3366
|
-
isReadOnly: isProcessing,
|
|
3461
|
+
isReadOnly: isProcessing || isInitAgentActive,
|
|
3462
|
+
disableWhileProcessing: isInitAgentActive,
|
|
3367
3463
|
onInterrupt: handleInterrupt
|
|
3368
3464
|
}
|
|
3369
3465
|
)
|
|
3370
3466
|
] });
|
|
3371
3467
|
};
|
|
3372
|
-
return /* @__PURE__ */
|
|
3373
|
-
/* @__PURE__ */
|
|
3468
|
+
return /* @__PURE__ */ jsxs13(Box15, { flexDirection: "column", children: [
|
|
3469
|
+
/* @__PURE__ */ jsx15(Static, { items: history, children: (item) => /* @__PURE__ */ jsx15(Box15, { children: item.component }, item.id) }),
|
|
3374
3470
|
renderInteractiveComponent()
|
|
3375
3471
|
] });
|
|
3376
3472
|
};
|