@nomad-e/bluma-cli 0.1.57 → 0.1.58

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.
Files changed (2) hide show
  1. package/dist/main.js +58 -120
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -15990,12 +15990,11 @@ Run: npm i -g ${BLUMA_PACKAGE_NAME} to update.`;
15990
15990
  }
15991
15991
  }
15992
15992
 
15993
- // src/app/ui/components/StartupUpdateGate.tsx
15993
+ // src/app/ui/components/UpdateNotice.tsx
15994
15994
  import { Box as Box17, Text as Text16 } from "ink";
15995
-
15996
- // src/app/ui/utils/update_message.ts
15995
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
15997
15996
  function parseUpdateMessage(msg) {
15998
- const lines = String(msg ?? "").split(/\r?\n/).map((l) => l.trim());
15997
+ const lines = msg.split(/\r?\n/).map((l) => l.trim());
15999
15998
  const first = lines[0] || "";
16000
15999
  const hintLine = lines.slice(1).join(" ") || "";
16001
16000
  const nameMatch = first.match(/Update available for\s+([^!]+)!/i);
@@ -16007,38 +16006,19 @@ function parseUpdateMessage(msg) {
16007
16006
  hint: hintLine || void 0
16008
16007
  };
16009
16008
  }
16010
- function extractInstallCommand(hint) {
16011
- if (!hint) return null;
16012
- const match = hint.match(/Run:\s*(.+?)(?:\s+to update\.?)?$/i);
16013
- return match?.[1]?.trim() || null;
16014
- }
16015
-
16016
- // src/app/ui/components/StartupUpdateGate.tsx
16017
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
16018
- var StartupUpdateGate = ({
16019
- message: message2
16020
- }) => {
16009
+ var UpdateNotice = ({ message: message2 }) => {
16021
16010
  const { name, current, latest: latest2, hint } = parseUpdateMessage(message2);
16022
- const command = extractInstallCommand(hint);
16023
- return /* @__PURE__ */ jsx18(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", paddingX: 1, paddingTop: 1, children: [
16024
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
16025
- /* @__PURE__ */ jsx18(Text16, { color: BLUMA_TERMINAL.orange, children: "\u273B " }),
16026
- /* @__PURE__ */ jsx18(Text16, { color: BLUMA_TERMINAL.blue, bold: true, children: "Blu" }),
16027
- /* @__PURE__ */ jsx18(Text16, { color: BLUMA_TERMINAL.magenta, bold: true, children: "Ma" }),
16028
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " update gate" })
16029
- ] }),
16030
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: BLUMA_TERMINAL.claude, children: name || "New BluMa version available" }),
16031
- current && latest2 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
16011
+ return /* @__PURE__ */ jsx18(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", paddingLeft: 2, children: [
16012
+ name && current && latest2 ? /* @__PURE__ */ jsx18(Text16, { color: BLUMA_TERMINAL.claude, bold: true, children: name }) : null,
16013
+ name && current && latest2 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
16032
16014
  current,
16033
16015
  " \u2192 ",
16034
16016
  latest2
16035
- ] }) : null,
16036
- /* @__PURE__ */ jsx18(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text16, { dimColor: true, wrap: "wrap", children: command ? `Run this command to update:
16037
- ${command}` : hint || "An update is available for BluMa CLI." }) }),
16038
- /* @__PURE__ */ jsx18(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text16, { color: BLUMA_TERMINAL.warn, bold: true, children: "Press Enter to continue" }) })
16017
+ ] }) : /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: message2 }),
16018
+ hint ? /* @__PURE__ */ jsx18(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: hint }) }) : null
16039
16019
  ] }) });
16040
16020
  };
16041
- var StartupUpdateGate_default = StartupUpdateGate;
16021
+ var UpdateNotice_default = UpdateNotice;
16042
16022
 
16043
16023
  // src/app/ui/components/ErrorMessage.tsx
16044
16024
  import { Box as Box18, Text as Text17 } from "ink";
@@ -16630,10 +16610,6 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
16630
16610
  "Initializing agent..."
16631
16611
  );
16632
16612
  const [toolsCount, setToolsCount] = useState11(null);
16633
- const [startupPhase, setStartupPhase] = useState11("checking");
16634
- const [startupUpdateMessage, setStartupUpdateMessage] = useState11(
16635
- null
16636
- );
16637
16613
  const [mcpStatus, setMcpStatus] = useState11(
16638
16614
  "connecting"
16639
16615
  );
@@ -16647,12 +16623,23 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
16647
16623
  const [pendingAskUserQuestions, setPendingAskUserQuestions] = useState11(null);
16648
16624
  const [showWorkers, setShowWorkers] = useState11(false);
16649
16625
  const [zoomedWorkerSession, setZoomedWorkerSession] = useState11(null);
16626
+ useInput6((input, key) => {
16627
+ if (key.ctrl && key.shift && input.toLowerCase() === "w") {
16628
+ setShowWorkers((prev) => !prev);
16629
+ }
16630
+ if (key.escape && showWorkers) {
16631
+ if (zoomedWorkerSession) {
16632
+ setZoomedWorkerSession(null);
16633
+ } else {
16634
+ setShowWorkers(false);
16635
+ }
16636
+ }
16637
+ });
16650
16638
  const [isInitAgentActive, setIsInitAgentActive] = useState11(false);
16651
16639
  const [liveToolName, setLiveToolName] = useState11(null);
16652
16640
  const [liveToolArgs, setLiveToolArgs] = useState11(void 0);
16653
16641
  const [isReasoning, setIsReasoning] = useState11(false);
16654
16642
  const alwaysAcceptList = useRef6([]);
16655
- const agentInitializationStartedRef = useRef6(false);
16656
16643
  const workdir = process.cwd();
16657
16644
  const turnStartedAtRef = useRef6(null);
16658
16645
  const [processingStartMs, setProcessingStartMs] = useState11(null);
@@ -16686,33 +16673,6 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
16686
16673
  ];
16687
16674
  });
16688
16675
  }, []);
16689
- const startAgentInitialization = useCallback4(async () => {
16690
- if (agentInitializationStartedRef.current) return;
16691
- agentInitializationStartedRef.current = true;
16692
- try {
16693
- agentInstance.current = new Agent(sessionId, eventBus);
16694
- await agentInstance.current.initialize();
16695
- appendHookEvent({
16696
- type: "session:init",
16697
- sessionId,
16698
- summary: "agent initialized"
16699
- });
16700
- eventBus.emit("backend_message", {
16701
- type: "status",
16702
- status: "mcp_connected",
16703
- tools: agentInstance.current.getAvailableTools().length
16704
- });
16705
- setStartupPhase("ready");
16706
- } catch (error) {
16707
- const errorMessage = error instanceof Error ? error.message : "Unknown error during Agent initialization.";
16708
- setStartupPhase("failed");
16709
- setStatusMessage(errorMessage);
16710
- eventBus.emit("backend_message", {
16711
- type: "error",
16712
- message: errorMessage
16713
- });
16714
- }
16715
- }, [eventBus, sessionId]);
16716
16676
  useEffect11(() => {
16717
16677
  expandPreviewHotkeyBus.on("expand", appendExpandPreviewToHistory);
16718
16678
  return () => {
@@ -16720,24 +16680,22 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
16720
16680
  };
16721
16681
  }, [appendExpandPreviewToHistory]);
16722
16682
  useEffect11(() => {
16723
- if (process.env.CI || blumaUpdateRegistryCheckStarted) {
16724
- setStartupPhase("starting-agent");
16725
- void startAgentInitialization();
16726
- return;
16727
- }
16683
+ if (process.env.CI || blumaUpdateRegistryCheckStarted) return;
16728
16684
  blumaUpdateRegistryCheckStarted = true;
16729
- setStatusMessage("Checking for updates...");
16730
16685
  void checkForUpdates().then((msg) => {
16731
- if (!msg) {
16732
- setStartupPhase("starting-agent");
16733
- void startAgentInitialization();
16734
- return;
16735
- }
16736
- setStartupUpdateMessage(msg);
16737
- setStartupPhase("update-available");
16738
- setStatusMessage("Update available");
16686
+ if (!msg) return;
16687
+ setHistory((prev) => {
16688
+ const nextId2 = prev.length === 0 ? 1 : Math.max(...prev.map((h) => h.id), HEADER_PANEL_HISTORY_ID) + 1;
16689
+ return [
16690
+ ...prev,
16691
+ {
16692
+ id: nextId2,
16693
+ component: /* @__PURE__ */ jsx27(UpdateNotice_default, { message: msg })
16694
+ }
16695
+ ];
16696
+ });
16739
16697
  });
16740
- }, [startAgentInitialization]);
16698
+ }, []);
16741
16699
  useEffect11(() => {
16742
16700
  setHistory((prev) => {
16743
16701
  const tail = prev.filter((h) => h.id !== HEADER_PANEL_HISTORY_ID);
@@ -16767,28 +16725,6 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
16767
16725
  ];
16768
16726
  });
16769
16727
  }, [isProcessing, eventBus]);
16770
- const continuePastUpdateGate = useCallback4(() => {
16771
- if (startupPhase !== "update-available") return;
16772
- setStartupPhase("starting-agent");
16773
- setStatusMessage("Connecting to MCP...");
16774
- void startAgentInitialization();
16775
- }, [startupPhase, startAgentInitialization]);
16776
- useInput6((input, key) => {
16777
- if (startupPhase === "update-available" && (key.return || input === "\n" || input === "\r")) {
16778
- continuePastUpdateGate();
16779
- return;
16780
- }
16781
- if (key.ctrl && key.shift && input.toLowerCase() === "w") {
16782
- setShowWorkers((prev) => !prev);
16783
- }
16784
- if (key.escape && showWorkers) {
16785
- if (zoomedWorkerSession) {
16786
- setZoomedWorkerSession(null);
16787
- } else {
16788
- setShowWorkers(false);
16789
- }
16790
- }
16791
- });
16792
16728
  const handleSubmit = useCallback4(
16793
16729
  (text) => {
16794
16730
  if (!text || !agentInstance.current) return;
@@ -17044,6 +16980,28 @@ Please use command_status to check the result and report back to the user.`;
17044
16980
  }
17045
16981
  }, [history.length]);
17046
16982
  useEffect11(() => {
16983
+ const initializeAgent = async () => {
16984
+ try {
16985
+ agentInstance.current = new Agent(sessionId, eventBus);
16986
+ await agentInstance.current.initialize();
16987
+ appendHookEvent({
16988
+ type: "session:init",
16989
+ sessionId,
16990
+ summary: "agent initialized"
16991
+ });
16992
+ eventBus.emit("backend_message", {
16993
+ type: "status",
16994
+ status: "mcp_connected",
16995
+ tools: agentInstance.current.getAvailableTools().length
16996
+ });
16997
+ } catch (error) {
16998
+ const errorMessage = error instanceof Error ? error.message : "Unknown error during Agent initialization.";
16999
+ eventBus.emit("backend_message", {
17000
+ type: "error",
17001
+ message: errorMessage
17002
+ });
17003
+ }
17004
+ };
17047
17005
  const handleBackendMessage = (parsed) => {
17048
17006
  try {
17049
17007
  const appendTurnDurationIfAny = () => {
@@ -17298,6 +17256,7 @@ Please use command_status to check the result and report back to the user.`;
17298
17256
  uiEventBus.on("user_overlay", handleUiOverlay);
17299
17257
  uiEventBus.on("input_notice", handleInputNotice);
17300
17258
  eventBus.on("backend_message", handleBackendMessage);
17259
+ initializeAgent();
17301
17260
  return () => {
17302
17261
  uiEventBus.off("user_overlay", handleUiOverlay);
17303
17262
  uiEventBus.off("input_notice", handleInputNotice);
@@ -17305,27 +17264,6 @@ Please use command_status to check the result and report back to the user.`;
17305
17264
  };
17306
17265
  }, [eventBus, sessionId, handleConfirmation]);
17307
17266
  const renderInteractiveComponent = () => {
17308
- if (startupPhase === "checking") {
17309
- return /* @__PURE__ */ jsx27(
17310
- SessionInfoConnectingMCP_default,
17311
- {
17312
- workdir,
17313
- statusMessage: statusMessage || "Checking for updates..."
17314
- }
17315
- );
17316
- }
17317
- if (startupPhase === "update-available" && startupUpdateMessage) {
17318
- return /* @__PURE__ */ jsx27(StartupUpdateGate_default, { message: startupUpdateMessage });
17319
- }
17320
- if (startupPhase === "failed") {
17321
- return /* @__PURE__ */ jsx27(Box26, { flexDirection: "column", children: /* @__PURE__ */ jsx27(
17322
- ErrorMessage_default,
17323
- {
17324
- message: statusMessage || "Startup failed",
17325
- hint: "Fix the error above and restart BluMa."
17326
- }
17327
- ) });
17328
- }
17329
17267
  if (mcpStatus !== "connected") {
17330
17268
  return /* @__PURE__ */ jsx27(
17331
17269
  SessionInfoConnectingMCP_default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomad-e/bluma-cli",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "description": "BluMa independent agent for automation and advanced software engineering.",
5
5
  "author": "Alex Fonseca",
6
6
  "license": "Apache-2.0",