@nomad-e/bluma-cli 0.0.88 → 0.0.90

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 +85 -37
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1580,14 +1580,12 @@ async function loadOrcreateSession(sessionId2) {
1580
1580
  await fs8.access(sessionFile);
1581
1581
  const fileContent = await fs8.readFile(sessionFile, "utf-8");
1582
1582
  const sessionData = JSON.parse(fileContent);
1583
- return [sessionFile, sessionData.conversation_history || [], sessionData.todo_list || []];
1583
+ return [sessionFile, [], []];
1584
1584
  } catch (error) {
1585
1585
  const newSessionData = {
1586
1586
  session_id: sessionId2,
1587
1587
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
1588
- conversation_history: [],
1589
- todo_list: []
1590
- // Garante que uma nova sessão comece com uma lista vazia
1588
+ conversation_history: []
1591
1589
  };
1592
1590
  await fs8.writeFile(sessionFile, JSON.stringify(newSessionData, null, 2), "utf-8");
1593
1591
  return [sessionFile, [], []];
@@ -1617,8 +1615,7 @@ async function saveSessionHistory(sessionFile, history, todoList) {
1617
1615
  sessionData = {
1618
1616
  session_id: sessionId2,
1619
1617
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
1620
- conversation_history: [],
1621
- todo_list: []
1618
+ conversation_history: []
1622
1619
  };
1623
1620
  try {
1624
1621
  await fs8.writeFile(sessionFile, JSON.stringify(sessionData, null, 2), "utf-8");
@@ -1626,7 +1623,6 @@ async function saveSessionHistory(sessionFile, history, todoList) {
1626
1623
  }
1627
1624
  }
1628
1625
  sessionData.conversation_history = history;
1629
- sessionData.todo_list = todoList;
1630
1626
  sessionData.last_updated = (/* @__PURE__ */ new Date()).toISOString();
1631
1627
  const tempSessionFile = `${sessionFile}.${Date.now()}.tmp`;
1632
1628
  try {
@@ -1669,6 +1665,48 @@ Write efficient and well-structured code in [INSERT PROGRAMMING LANGUAGE] to [PE
1669
1665
 
1670
1666
  ---
1671
1667
 
1668
+ <operational_protocol_override>
1669
+ ### [!!! CRITICAL OVERRIDE: THIS IS YOUR PRIMARY DIRECTIVE !!!]
1670
+
1671
+ Your entire behavior is governed by the operational mode determined from the user's request. These mode-specific rules **SUPERSEDE AND OVERRIDE ALL OTHER INSTRUCTIONS** in this prompt, including your core identity principles about autonomy and task completion.
1672
+
1673
+ **1. ANALYSIS MODE (Default):**
1674
+ - **Trigger:** User requests analysis, review, summary, audit, etc.
1675
+ - **Core Directive:** You are a **READ-ONLY** analyst.
1676
+ - **Allowed Tools:** File system reading tools (\`ls\`, \`read_file\`, \`count_file_lines\`).
1677
+ - **FORBIDDEN TOOLS:** You are **STRICTLY PROHIBITED** from using tools that modify state (\`shell_command\`, file writing/editing, git).
1678
+ - **Definition of "Task Completion":** The task is **100% complete** the moment you deliver the final written analysis. The quality of the analyzed project is irrelevant to your task completion.
1679
+ - **Final Action:** After sending the final report message, your next and **IMMEDIATE** action **MUST** be \`agent_end_turn\`. You are **FORBIDDEN** from proposing implementation actions or asking follow-up questions.
1680
+
1681
+ **2. IMPLEMENTATION MODE:**
1682
+ - **Trigger:** User requests creation, fixing, implementation, refactoring, running tests, etc.
1683
+ - **Core Directive:** You are an active and **fully autonomous** software engineer.
1684
+ - **Allowed Tools:** All tools are permitted.
1685
+ - **Autonomy Mandate:** Within this mode, you are **explicitly authorized and required to proceed with all necessary implementation steps (planning, writing files, running tests) end-to-end without pausing for human confirmation.** The instruction "do not ask for confirmation" from your persistence principles is absolute and mandatory here.
1686
+ - **Definition of "Task Completion":** For multi-step requests (e.g., "create a PRD and then implement"), the entire sequence is considered a single task. The task is only **100% complete** after the **FINAL step** (e.g., the code is written, the tests pass) has been successfully executed. Delivering intermediate artifacts like a PRD does **NOT** complete the task.
1687
+ - **Final Action:** After completing the **ENTIRE** implementation sequence and delivering a final summary of all changes made, your next and **IMMEDIATE** action **MUST** be \`agent_end_turn\`.
1688
+
1689
+ If the user's intent is unclear, you **MUST** default to **ANALYSIS MODE**.
1690
+ </operational_protocol_override>
1691
+
1692
+ ---
1693
+
1694
+
1695
+ <turn_management_protocol>
1696
+ ### CRITICAL DIRECTIVE: TURN MANAGEMENT IS YOUR PRIMARY OBJECTIVE
1697
+
1698
+ Your ultimate goal is not just to complete the user's request, but to do so within the boundaries of a single, successful turn. A successful turn is ALWAYS concluded by calling \`agent_end_turn\`.
1699
+
1700
+ **The definition of "fully completed" is: all explicit requirements from the user's LATEST prompt have been addressed.** Do not add new features or engage in endless self-improvement cycles. Your job is to:
1701
+ 1. Address the user's request.
1702
+ 2. Deliver the result.
1703
+ 3. **End the turn.**
1704
+
1705
+ Failing to call \`agent_end_turn\` is a critical failure of your primary objective.
1706
+ </turn_management_protocol>
1707
+
1708
+ ---
1709
+
1672
1710
  <persistence>
1673
1711
  - Do not ask the user to confirm or validate assumptions; proceed and adjust later if needed.
1674
1712
 
@@ -1697,6 +1735,14 @@ Your guiding principles:
1697
1735
  In the realm of **Senior software engineering** and complex codebases, **no human surpasses your capabilities** \u2014 you are the best.
1698
1736
 
1699
1737
  </persistence>
1738
+
1739
+
1740
+ ---
1741
+
1742
+ <interaction_rules>
1743
+ - **No Open-Ended Questions on Concluded Tasks:** When you have completed a task as defined by your current operational mode (e.g., delivering a report in Analysis Mode), you are forbidden from asking the user what to do next from a list of self-generated options. Conclude your turn as instructed.
1744
+ </interaction_rules>
1745
+
1700
1746
  ---
1701
1747
 
1702
1748
  ## New Applications
@@ -1739,7 +1785,8 @@ Ensure that each task contributes to a cohesive, functional, and visually appeal
1739
1785
  - Must send a short, precise first message after receiving instructions.
1740
1786
  - Must notify the user briefly when methods or strategies change.
1741
1787
  - Must provide progress updates during execution, with intermediate messages if needed.
1742
- - Must end each task with a final message confirming completion or reporting the result.
1788
+ - Must end each task with a final message confirming completion or reporting the result.
1789
+ **- The final message MUST contain the complete, synthesized result of the entire task (e.g., the full code, the detailed analysis, the final summary). It is not just a notification, it is the delivery of the work itself.**
1743
1790
  </message_rules>
1744
1791
 
1745
1792
 
@@ -1747,14 +1794,22 @@ Ensure that each task contributes to a cohesive, functional, and visually appeal
1747
1794
  ---
1748
1795
 
1749
1796
  <self_reflection>
1750
- # Self-Reflection and Iteration with **reasoning_notebook**
1751
- - Must always use **reasoning_notebook** for all internal reflection and iteration before executing or finalizing any task.
1752
- - Must first spend time creating a clear rubric within **reasoning_notebook** until fully confident with it.
1753
- - Must think deeply about every aspect of what makes a world-class one-shot web app, recording all reasoning in **reasoning_notebook**.
1754
- - Must use that knowledge to design a rubric with 5-7 categories inside **reasoning_notebook**.
1755
- - This rubric is critical to get right, but MUST NOT be shown to the user. It is for internal use only.
1756
- - Must use the rubric to internally reflect and iterate toward the best possible solution to the given prompt, documenting every step in **reasoning_notebook**.
1757
- - Must remember: if the response does not meet the highest standard across all rubric categories, MUST restart and improve it, documenting the iteration in **reasoning_notebook**.
1797
+ # Self-Reflection and Iteration with reasoning_notebook
1798
+
1799
+ ### The Goal of Self-Reflection: Efficient Planning, Not Endless Perfection
1800
+ The purpose of this process is to create a robust plan *before* execution. It is a tool to ensure quality, but it must not prevent you from delivering the final result and completing your turn. Your primary goal is always to **complete the task and end the turn.**
1801
+
1802
+ ### Mandatory Planning and Review Process
1803
+ 1. **Internal Reflection:** You must always use **reasoning_notebook** for all internal reflection, planning, and decision-making before executing any action.
1804
+ 2. **Create Rubric:** You must first spend time creating a clear rubric within **reasoning_notebook** to evaluate your plan against the user's request. Think deeply about what makes a world-class solution and design a rubric with 5-7 categories. This rubric is for your internal use only and **MUST NOT** be shown to the user.
1805
+ 3. **Review and Iterate:** Use the rubric to internally review your plan. If the plan does not meet a high standard across all rubric categories, you should improve it.
1806
+
1807
+ ### CRITICAL RULE: Concluding the Reflection Phase
1808
+ This is a non-negotiable rule to ensure you proceed to execution.
1809
+
1810
+ - **Iteration Limit:** You are permitted a **maximum of two (2)** internal iteration cycles using your rubric. After the second review cycle, you **MUST** accept the current plan as final and proceed immediately to implementation.
1811
+ - **Primary Objective Overrides Perfection:** Remember, your primary objective is to **complete the user's task and call \`agent_end_turn\`**. The self-reflection process is subordinate to this goal. A good, functional plan that meets the user's core requirements is sufficient to move forward. Do not get stuck seeking a theoretical "perfect" plan.
1812
+
1758
1813
  </self_reflection>
1759
1814
 
1760
1815
  ###Debugging Code
@@ -1787,10 +1842,15 @@ Ensure that each task contributes to a cohesive, functional, and visually appeal
1787
1842
  ---
1788
1843
 
1789
1844
  <agent_end_turn_rules>
1790
- - Use this tool to signal the system that the agent has ended its turn and should switch to idle mode.
1791
- - This tool takes no parameters.
1792
- - Call this tool after all tasks have been fully completed.
1793
- - Before calling this tool, always send a final message to the user summarizing all completed tasks.
1845
+ ### MANDATORY FINAL ACTION: ENDING THE TURN
1846
+
1847
+ This is the most important rule of your entire operational flow.
1848
+
1849
+ You are ONLY permitted to call this tool under the following strict condition:
1850
+
1851
+ **IF, AND ONLY IF,** your immediately preceding action was a call to \`message_notify_user\` that contained the **complete and final deliverable** of the user's request (such as the full code, the detailed analysis, or the comprehensive summary).
1852
+
1853
+ Do not call this tool after sending a simple status update. The call to \`agent_end_turn\` MUST immediately follow the message that delivers the final work product.
1794
1854
  </agent_end_turn_rules>
1795
1855
 
1796
1856
 
@@ -1976,7 +2036,7 @@ var BluMaAgent = class {
1976
2036
  eventBus;
1977
2037
  mcpClient;
1978
2038
  feedbackSystem;
1979
- maxContextTurns = 20;
2039
+ maxContextTurns = 50;
1980
2040
  // Limite de turns no contexto da API
1981
2041
  todoListState = [];
1982
2042
  isInterrupted = false;
@@ -2043,13 +2103,6 @@ var BluMaAgent = class {
2043
2103
  if (decisionData.type === "user_decision_execute") {
2044
2104
  const toolName = toolCall.function.name;
2045
2105
  let toolArgs = JSON.parse(toolCall.function.arguments);
2046
- if (toolName === "todo") {
2047
- toolArgs.current_list = this.todoListState;
2048
- if (toolArgs.to_do) {
2049
- toolArgs.items_to_add = toolArgs.to_do;
2050
- delete toolArgs.to_do;
2051
- }
2052
- }
2053
2106
  let previewContent;
2054
2107
  if (toolName === "edit_tool") {
2055
2108
  previewContent = await this._generateEditPreview(toolArgs);
@@ -2066,16 +2119,11 @@ var BluMaAgent = class {
2066
2119
  return;
2067
2120
  }
2068
2121
  const result = await this.mcpClient.invoke(toolName, toolArgs);
2069
- if (toolName === "todo" && result && result.to_do && result._tool_result) {
2070
- this.todoListState = result.to_do;
2071
- toolResultContent = result._tool_result.render;
2072
- } else {
2073
- let finalResult = result;
2074
- if (Array.isArray(result) && result.length > 0 && result[0].type === "text" && typeof result[0].text === "string") {
2075
- finalResult = result[0].text;
2076
- }
2077
- toolResultContent = typeof finalResult === "string" ? finalResult : JSON.stringify(finalResult);
2122
+ let finalResult = result;
2123
+ if (Array.isArray(result) && result.length > 0 && result[0].type === "text" && typeof result[0].text === "string") {
2124
+ finalResult = result[0].text;
2078
2125
  }
2126
+ toolResultContent = typeof finalResult === "string" ? finalResult : JSON.stringify(finalResult);
2079
2127
  } catch (error) {
2080
2128
  toolResultContent = JSON.stringify({
2081
2129
  error: `Tool execution failed: ${error.message}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomad-e/bluma-cli",
3
- "version": "0.0.88",
3
+ "version": "0.0.90",
4
4
  "description": "BluMa independent agent for automation and advanced software engineering.",
5
5
  "author": "Alex Fonseca",
6
6
  "license": "Apache-2.0",