@nomad-e/bluma-cli 0.1.28 → 0.1.30

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 +16 -7
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -5542,6 +5542,8 @@ var BluMaAgent = class {
5542
5542
  isInterrupted = false;
5543
5543
  /** Mesmo turnId durante processTurn + todo o loop de tool_calls (FactorRouter). */
5544
5544
  activeTurnContext = null;
5545
+ /** Evita POST /turns/.../end duplicado no mesmo turno (ex.: Esc após message_result). */
5546
+ factorRouterTurnClosed = false;
5545
5547
  constructor(sessionId, eventBus, llm, mcpClient, feedbackSystem) {
5546
5548
  this.sessionId = sessionId;
5547
5549
  this.eventBus = eventBus;
@@ -5551,6 +5553,7 @@ var BluMaAgent = class {
5551
5553
  this.skillLoader = new SkillLoader(process.cwd());
5552
5554
  this.eventBus.on("user_interrupt", () => {
5553
5555
  this.isInterrupted = true;
5556
+ void this.notifyFactorTurnEndIfNeeded("user_interrupt");
5554
5557
  this.eventBus.emit("backend_message", { type: "done", status: "interrupted" });
5555
5558
  });
5556
5559
  this.eventBus.on("user_overlay", async (data) => {
@@ -5612,6 +5615,7 @@ var BluMaAgent = class {
5612
5615
  }
5613
5616
  async processTurn(userInput, userContextInput) {
5614
5617
  this.isInterrupted = false;
5618
+ this.factorRouterTurnClosed = false;
5615
5619
  const inputText = String(userInput.content || "").trim();
5616
5620
  const turnId = uuidv43();
5617
5621
  this.activeTurnContext = {
@@ -5738,13 +5742,7 @@ var BluMaAgent = class {
5738
5742
  try {
5739
5743
  const resultObj = typeof toolResultContent === "string" ? JSON.parse(toolResultContent) : toolResultContent;
5740
5744
  if (resultObj.message_type === "result") {
5741
- if (this.activeTurnContext) {
5742
- await notifyFactorRouterTurnEnd({
5743
- turnId: this.activeTurnContext.turnId,
5744
- userContext: this.activeTurnContext,
5745
- reason: "message_result"
5746
- });
5747
- }
5745
+ await this.notifyFactorTurnEndIfNeeded("message_result");
5748
5746
  shouldContinueConversation = false;
5749
5747
  this.eventBus.emit("backend_message", { type: "done", status: "completed" });
5750
5748
  }
@@ -5788,6 +5786,17 @@ ${editData.error.display}`;
5788
5786
  }
5789
5787
  return this.activeTurnContext;
5790
5788
  }
5789
+ /** Um único aviso ao Factor Router por turno (fim normal ou interrupção). */
5790
+ async notifyFactorTurnEndIfNeeded(reason) {
5791
+ if (this.factorRouterTurnClosed || !this.activeTurnContext) return;
5792
+ this.factorRouterTurnClosed = true;
5793
+ const ctx = this.activeTurnContext;
5794
+ await notifyFactorRouterTurnEnd({
5795
+ turnId: ctx.turnId,
5796
+ userContext: ctx,
5797
+ reason
5798
+ });
5799
+ }
5791
5800
  async _continueConversation() {
5792
5801
  try {
5793
5802
  if (this.isInterrupted) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomad-e/bluma-cli",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "BluMa independent agent for automation and advanced software engineering.",
5
5
  "author": "Alex Fonseca",
6
6
  "license": "Apache-2.0",