@nomad-e/bluma-cli 0.0.30 → 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 +177 -83
- 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
|
|
@@ -2348,7 +2362,7 @@ ${editData.error.display}`;
|
|
|
2348
2362
|
|
|
2349
2363
|
// src/app/agent/subagents/init/init_subagent.ts
|
|
2350
2364
|
var InitAgentImpl = class extends BaseLLMSubAgent {
|
|
2351
|
-
id =
|
|
2365
|
+
id = `init_${Date.now()}`;
|
|
2352
2366
|
capabilities = ["/init"];
|
|
2353
2367
|
async execute(input, ctx) {
|
|
2354
2368
|
this.ctx = ctx;
|
|
@@ -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
|
|
|
@@ -3012,8 +3069,6 @@ async function checkForUpdates() {
|
|
|
3012
3069
|
}
|
|
3013
3070
|
if (!pkg?.name || !pkg?.version) return null;
|
|
3014
3071
|
const isCI = Boolean(process.env.CI);
|
|
3015
|
-
const isNoCache = process.env.BLUMA_UPDATE_NO_CACHE === "1";
|
|
3016
|
-
const isDev = process.env.NODE_ENV !== "production";
|
|
3017
3072
|
const updateCheckInterval = 0;
|
|
3018
3073
|
const notifier = updateNotifier({
|
|
3019
3074
|
pkg: { name: pkg.name, version: pkg.version },
|
|
@@ -3064,8 +3119,35 @@ var UpdateNotice = ({ message }) => {
|
|
|
3064
3119
|
};
|
|
3065
3120
|
var UpdateNotice_default = UpdateNotice;
|
|
3066
3121
|
|
|
3067
|
-
// src/app/ui/
|
|
3122
|
+
// src/app/ui/components/ErrorMessage.tsx
|
|
3123
|
+
import { Box as Box14, Text as Text13 } from "ink";
|
|
3068
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";
|
|
3069
3151
|
var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
3070
3152
|
const agentInstance = useRef(null);
|
|
3071
3153
|
const [history, setHistory] = useState4([]);
|
|
@@ -3083,6 +3165,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3083
3165
|
const [confirmationPreview, setConfirmationPreview] = useState4(
|
|
3084
3166
|
null
|
|
3085
3167
|
);
|
|
3168
|
+
const [isInitAgentActive, setIsInitAgentActive] = useState4(false);
|
|
3086
3169
|
const alwaysAcceptList = useRef([]);
|
|
3087
3170
|
const workdir = process.cwd();
|
|
3088
3171
|
const updateCheckRan = useRef(false);
|
|
@@ -3094,7 +3177,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3094
3177
|
...prev,
|
|
3095
3178
|
{
|
|
3096
3179
|
id: prev.length,
|
|
3097
|
-
component: /* @__PURE__ */
|
|
3180
|
+
component: /* @__PURE__ */ jsx15(Text14, { color: "yellow", children: "-- Task cancelled by dev. --" })
|
|
3098
3181
|
}
|
|
3099
3182
|
]);
|
|
3100
3183
|
}, [isProcessing, eventBus2]);
|
|
@@ -3107,16 +3190,19 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3107
3190
|
setIsProcessing(false);
|
|
3108
3191
|
return;
|
|
3109
3192
|
}
|
|
3193
|
+
if (cmd === "init") {
|
|
3194
|
+
setIsInitAgentActive(true);
|
|
3195
|
+
}
|
|
3110
3196
|
setIsProcessing(true);
|
|
3111
3197
|
setHistory((prev) => [
|
|
3112
3198
|
...prev,
|
|
3113
3199
|
{
|
|
3114
3200
|
id: prev.length,
|
|
3115
|
-
component: /* @__PURE__ */
|
|
3201
|
+
component: /* @__PURE__ */ jsx15(Box15, { marginBottom: 1, children: /* @__PURE__ */ jsx15(Text14, { color: "white", dimColor: true, children: text }) })
|
|
3116
3202
|
},
|
|
3117
3203
|
{
|
|
3118
3204
|
id: prev.length + 1,
|
|
3119
|
-
component: /* @__PURE__ */
|
|
3205
|
+
component: /* @__PURE__ */ jsx15(
|
|
3120
3206
|
SlashCommands_default,
|
|
3121
3207
|
{
|
|
3122
3208
|
input: text,
|
|
@@ -3136,8 +3222,8 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3136
3222
|
id: prev.length,
|
|
3137
3223
|
component: (
|
|
3138
3224
|
// Uma única Box para o espaçamento
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
/* @__PURE__ */
|
|
3225
|
+
/* @__PURE__ */ jsx15(Box15, { marginBottom: 1, children: /* @__PURE__ */ jsxs13(Text14, { color: "white", dimColor: true, children: [
|
|
3226
|
+
/* @__PURE__ */ jsxs13(Text14, { color: "white", children: [
|
|
3141
3227
|
">",
|
|
3142
3228
|
" "
|
|
3143
3229
|
] }),
|
|
@@ -3172,7 +3258,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3172
3258
|
[]
|
|
3173
3259
|
);
|
|
3174
3260
|
useEffect3(() => {
|
|
3175
|
-
setHistory([{ id: 0, component: /* @__PURE__ */
|
|
3261
|
+
setHistory([{ id: 0, component: /* @__PURE__ */ jsx15(Header, {}) }]);
|
|
3176
3262
|
const initializeAgent = async () => {
|
|
3177
3263
|
try {
|
|
3178
3264
|
agentInstance.current = new Agent(sessionId2, eventBus2);
|
|
@@ -3192,6 +3278,9 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3192
3278
|
};
|
|
3193
3279
|
const handleBackendMessage = (parsed) => {
|
|
3194
3280
|
try {
|
|
3281
|
+
if (parsed.type === "done" || parsed.type === "error") {
|
|
3282
|
+
setIsInitAgentActive(false);
|
|
3283
|
+
}
|
|
3195
3284
|
if (parsed.type === "connection_status") {
|
|
3196
3285
|
setStatusMessage(parsed.message);
|
|
3197
3286
|
return;
|
|
@@ -3224,7 +3313,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3224
3313
|
if (prev.length < 2) {
|
|
3225
3314
|
newHistory.push({
|
|
3226
3315
|
id: 1,
|
|
3227
|
-
component: /* @__PURE__ */
|
|
3316
|
+
component: /* @__PURE__ */ jsx15(
|
|
3228
3317
|
SessionInfo,
|
|
3229
3318
|
{
|
|
3230
3319
|
sessionId: sessionId2,
|
|
@@ -3245,7 +3334,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3245
3334
|
...prev,
|
|
3246
3335
|
{
|
|
3247
3336
|
id: prev.length,
|
|
3248
|
-
component: /* @__PURE__ */
|
|
3337
|
+
component: /* @__PURE__ */ jsx15(UpdateNotice_default, { message: msg })
|
|
3249
3338
|
}
|
|
3250
3339
|
]);
|
|
3251
3340
|
}
|
|
@@ -3259,10 +3348,10 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3259
3348
|
}
|
|
3260
3349
|
let newComponent = null;
|
|
3261
3350
|
if (parsed.type === "debug") {
|
|
3262
|
-
newComponent = /* @__PURE__ */
|
|
3351
|
+
newComponent = /* @__PURE__ */ jsx15(Text14, { color: "gray", children: parsed.message });
|
|
3263
3352
|
} else if (parsed.type === "protocol_violation") {
|
|
3264
|
-
newComponent = /* @__PURE__ */
|
|
3265
|
-
|
|
3353
|
+
newComponent = /* @__PURE__ */ jsxs13(
|
|
3354
|
+
Box15,
|
|
3266
3355
|
{
|
|
3267
3356
|
borderStyle: "round",
|
|
3268
3357
|
borderColor: "yellow",
|
|
@@ -3270,19 +3359,23 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3270
3359
|
marginBottom: 1,
|
|
3271
3360
|
paddingX: 1,
|
|
3272
3361
|
children: [
|
|
3273
|
-
/* @__PURE__ */
|
|
3274
|
-
/* @__PURE__ */
|
|
3275
|
-
/* @__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 })
|
|
3276
3365
|
]
|
|
3277
3366
|
}
|
|
3278
3367
|
);
|
|
3279
3368
|
} else if (parsed.type === "error") {
|
|
3280
|
-
newComponent = /* @__PURE__ */
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
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
|
+
);
|
|
3284
3377
|
} else if (parsed.type === "tool_call") {
|
|
3285
|
-
newComponent = /* @__PURE__ */
|
|
3378
|
+
newComponent = /* @__PURE__ */ jsx15(
|
|
3286
3379
|
ToolCallDisplay,
|
|
3287
3380
|
{
|
|
3288
3381
|
toolName: parsed.tool_name,
|
|
@@ -3291,7 +3384,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3291
3384
|
}
|
|
3292
3385
|
);
|
|
3293
3386
|
} else if (parsed.type === "tool_result") {
|
|
3294
|
-
newComponent = /* @__PURE__ */
|
|
3387
|
+
newComponent = /* @__PURE__ */ jsx15(
|
|
3295
3388
|
ToolResultDisplay,
|
|
3296
3389
|
{
|
|
3297
3390
|
toolName: parsed.tool_name,
|
|
@@ -3299,15 +3392,15 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3299
3392
|
}
|
|
3300
3393
|
);
|
|
3301
3394
|
} else if (parsed.type === "dev_overlay") {
|
|
3302
|
-
newComponent = /* @__PURE__ */
|
|
3303
|
-
/* @__PURE__ */
|
|
3395
|
+
newComponent = /* @__PURE__ */ jsx15(Box15, { marginBottom: 1, children: /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
3396
|
+
/* @__PURE__ */ jsxs13(Text14, { color: "blue", children: [
|
|
3304
3397
|
">",
|
|
3305
3398
|
" "
|
|
3306
3399
|
] }),
|
|
3307
3400
|
parsed.payload
|
|
3308
3401
|
] }) });
|
|
3309
3402
|
} else if (parsed.type === "log") {
|
|
3310
|
-
newComponent = /* @__PURE__ */
|
|
3403
|
+
newComponent = /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
3311
3404
|
"\u2139\uFE0F ",
|
|
3312
3405
|
parsed.message,
|
|
3313
3406
|
parsed.payload ? `: ${parsed.payload}` : ""
|
|
@@ -3337,7 +3430,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3337
3430
|
}, [eventBus2, sessionId2, handleConfirmation]);
|
|
3338
3431
|
const renderInteractiveComponent = () => {
|
|
3339
3432
|
if (mcpStatus !== "connected") {
|
|
3340
|
-
return /* @__PURE__ */
|
|
3433
|
+
return /* @__PURE__ */ jsx15(Box15, { borderStyle: "round", borderColor: "black", children: /* @__PURE__ */ jsx15(
|
|
3341
3434
|
SessionInfoConnectingMCP_default,
|
|
3342
3435
|
{
|
|
3343
3436
|
sessionId: sessionId2,
|
|
@@ -3347,7 +3440,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3347
3440
|
) });
|
|
3348
3441
|
}
|
|
3349
3442
|
if (pendingConfirmation) {
|
|
3350
|
-
return /* @__PURE__ */
|
|
3443
|
+
return /* @__PURE__ */ jsx15(
|
|
3351
3444
|
ConfirmationPrompt,
|
|
3352
3445
|
{
|
|
3353
3446
|
toolCalls: pendingConfirmation,
|
|
@@ -3359,20 +3452,21 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3359
3452
|
}
|
|
3360
3453
|
);
|
|
3361
3454
|
}
|
|
3362
|
-
return /* @__PURE__ */
|
|
3363
|
-
isProcessing && !pendingConfirmation && /* @__PURE__ */
|
|
3364
|
-
/* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ jsxs13(Box15, { flexDirection: "column", children: [
|
|
3456
|
+
isProcessing && !pendingConfirmation && /* @__PURE__ */ jsx15(WorkingTimer, {}),
|
|
3457
|
+
/* @__PURE__ */ jsx15(
|
|
3365
3458
|
InputPrompt,
|
|
3366
3459
|
{
|
|
3367
3460
|
onSubmit: handleSubmit,
|
|
3368
|
-
isReadOnly: isProcessing,
|
|
3461
|
+
isReadOnly: isProcessing || isInitAgentActive,
|
|
3462
|
+
disableWhileProcessing: isInitAgentActive,
|
|
3369
3463
|
onInterrupt: handleInterrupt
|
|
3370
3464
|
}
|
|
3371
3465
|
)
|
|
3372
3466
|
] });
|
|
3373
3467
|
};
|
|
3374
|
-
return /* @__PURE__ */
|
|
3375
|
-
/* @__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) }),
|
|
3376
3470
|
renderInteractiveComponent()
|
|
3377
3471
|
] });
|
|
3378
3472
|
};
|