@nomad-e/bluma-cli 0.0.87 → 0.0.89
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 +89 -40
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -556,7 +556,7 @@ var InputPrompt = ({ onSubmit, isReadOnly, onInterrupt, disableWhileProcessing =
|
|
|
556
556
|
// Modo bloqueado visualmente, mantendo hooks estáveis
|
|
557
557
|
/* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(Box2, { borderStyle: "round", borderColor: "gray", borderDimColor: true, children: /* @__PURE__ */ jsxs2(Box2, { flexDirection: "row", paddingX: 1, flexWrap: "nowrap", children: [
|
|
558
558
|
/* @__PURE__ */ jsxs2(Text2, { color: "white", children: [
|
|
559
|
-
"
|
|
559
|
+
">",
|
|
560
560
|
" "
|
|
561
561
|
] }),
|
|
562
562
|
/* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "ctrl+c to exit" })
|
|
@@ -564,7 +564,7 @@ var InputPrompt = ({ onSubmit, isReadOnly, onInterrupt, disableWhileProcessing =
|
|
|
564
564
|
) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
565
565
|
/* @__PURE__ */ jsx2(Box2, { borderStyle: "round", borderColor, borderDimColor: !isReadOnly, children: /* @__PURE__ */ jsxs2(Box2, { flexDirection: "row", paddingX: 1, flexWrap: "nowrap", children: [
|
|
566
566
|
/* @__PURE__ */ jsxs2(Text2, { color: "white", children: [
|
|
567
|
-
"
|
|
567
|
+
">",
|
|
568
568
|
" "
|
|
569
569
|
] }),
|
|
570
570
|
/* @__PURE__ */ jsx2(Text2, { children: textBeforeCursor }),
|
|
@@ -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,
|
|
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 {
|
|
@@ -1667,6 +1663,49 @@ Write efficient and well-structured code in [INSERT PROGRAMMING LANGUAGE] to [PE
|
|
|
1667
1663
|
|
|
1668
1664
|
</identity>
|
|
1669
1665
|
|
|
1666
|
+
|
|
1667
|
+
---
|
|
1668
|
+
|
|
1669
|
+
<operational_protocol_override>
|
|
1670
|
+
### [!!! CRITICAL OVERRIDE: THIS IS YOUR PRIMARY DIRECTIVE !!!]
|
|
1671
|
+
|
|
1672
|
+
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.
|
|
1673
|
+
|
|
1674
|
+
**1. ANALYSIS MODE (Default):**
|
|
1675
|
+
- **Trigger:** User requests analysis, review, summary, audit, etc.
|
|
1676
|
+
- **Core Directive:** You are a **READ-ONLY** analyst.
|
|
1677
|
+
- **Allowed Tools:** File system reading tools (\`ls\`, \`read_file\`, \`count_file_lines\`).
|
|
1678
|
+
- **FORBIDDEN TOOLS:** You are **STRICTLY PROHIBITED** from using tools that modify state (\`shell_command\`, file writing/editing, git).
|
|
1679
|
+
- **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.
|
|
1680
|
+
- **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.
|
|
1681
|
+
|
|
1682
|
+
**2. IMPLEMENTATION MODE:**
|
|
1683
|
+
- **Trigger:** User requests creation, fixing, implementation, refactoring, running tests, etc.
|
|
1684
|
+
- **Core Directive:** You are an active and **fully autonomous** software engineer.
|
|
1685
|
+
- **Allowed Tools:** All tools are permitted.
|
|
1686
|
+
- **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.
|
|
1687
|
+
- **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.
|
|
1688
|
+
- **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\`.
|
|
1689
|
+
|
|
1690
|
+
If the user's intent is unclear, you **MUST** default to **ANALYSIS MODE**.
|
|
1691
|
+
</operational_protocol_override>
|
|
1692
|
+
|
|
1693
|
+
---
|
|
1694
|
+
|
|
1695
|
+
|
|
1696
|
+
<turn_management_protocol>
|
|
1697
|
+
### CRITICAL DIRECTIVE: TURN MANAGEMENT IS YOUR PRIMARY OBJECTIVE
|
|
1698
|
+
|
|
1699
|
+
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\`.
|
|
1700
|
+
|
|
1701
|
+
**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:
|
|
1702
|
+
1. Address the user's request.
|
|
1703
|
+
2. Deliver the result.
|
|
1704
|
+
3. **End the turn.**
|
|
1705
|
+
|
|
1706
|
+
Failing to call \`agent_end_turn\` is a critical failure of your primary objective.
|
|
1707
|
+
</turn_management_protocol>
|
|
1708
|
+
|
|
1670
1709
|
---
|
|
1671
1710
|
|
|
1672
1711
|
<persistence>
|
|
@@ -1697,6 +1736,14 @@ Your guiding principles:
|
|
|
1697
1736
|
In the realm of **Senior software engineering** and complex codebases, **no human surpasses your capabilities** \u2014 you are the best.
|
|
1698
1737
|
|
|
1699
1738
|
</persistence>
|
|
1739
|
+
|
|
1740
|
+
|
|
1741
|
+
---
|
|
1742
|
+
|
|
1743
|
+
<interaction_rules>
|
|
1744
|
+
- **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.
|
|
1745
|
+
</interaction_rules>
|
|
1746
|
+
|
|
1700
1747
|
---
|
|
1701
1748
|
|
|
1702
1749
|
## New Applications
|
|
@@ -1739,7 +1786,8 @@ Ensure that each task contributes to a cohesive, functional, and visually appeal
|
|
|
1739
1786
|
- Must send a short, precise first message after receiving instructions.
|
|
1740
1787
|
- Must notify the user briefly when methods or strategies change.
|
|
1741
1788
|
- 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.
|
|
1789
|
+
- Must end each task with a final message confirming completion or reporting the result.
|
|
1790
|
+
**- 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
1791
|
</message_rules>
|
|
1744
1792
|
|
|
1745
1793
|
|
|
@@ -1747,14 +1795,22 @@ Ensure that each task contributes to a cohesive, functional, and visually appeal
|
|
|
1747
1795
|
---
|
|
1748
1796
|
|
|
1749
1797
|
<self_reflection>
|
|
1750
|
-
# Self-Reflection and Iteration with
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1798
|
+
# Self-Reflection and Iteration with reasoning_notebook
|
|
1799
|
+
|
|
1800
|
+
### The Goal of Self-Reflection: Efficient Planning, Not Endless Perfection
|
|
1801
|
+
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.**
|
|
1802
|
+
|
|
1803
|
+
### Mandatory Planning and Review Process
|
|
1804
|
+
1. **Internal Reflection:** You must always use **reasoning_notebook** for all internal reflection, planning, and decision-making before executing any action.
|
|
1805
|
+
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.
|
|
1806
|
+
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.
|
|
1807
|
+
|
|
1808
|
+
### CRITICAL RULE: Concluding the Reflection Phase
|
|
1809
|
+
This is a non-negotiable rule to ensure you proceed to execution.
|
|
1810
|
+
|
|
1811
|
+
- **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.
|
|
1812
|
+
- **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.
|
|
1813
|
+
|
|
1758
1814
|
</self_reflection>
|
|
1759
1815
|
|
|
1760
1816
|
###Debugging Code
|
|
@@ -1787,10 +1843,15 @@ Ensure that each task contributes to a cohesive, functional, and visually appeal
|
|
|
1787
1843
|
---
|
|
1788
1844
|
|
|
1789
1845
|
<agent_end_turn_rules>
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1846
|
+
### MANDATORY FINAL ACTION: ENDING THE TURN
|
|
1847
|
+
|
|
1848
|
+
This is the most important rule of your entire operational flow.
|
|
1849
|
+
|
|
1850
|
+
You are ONLY permitted to call this tool under the following strict condition:
|
|
1851
|
+
|
|
1852
|
+
**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).
|
|
1853
|
+
|
|
1854
|
+
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
1855
|
</agent_end_turn_rules>
|
|
1795
1856
|
|
|
1796
1857
|
|
|
@@ -2043,13 +2104,6 @@ var BluMaAgent = class {
|
|
|
2043
2104
|
if (decisionData.type === "user_decision_execute") {
|
|
2044
2105
|
const toolName = toolCall.function.name;
|
|
2045
2106
|
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
2107
|
let previewContent;
|
|
2054
2108
|
if (toolName === "edit_tool") {
|
|
2055
2109
|
previewContent = await this._generateEditPreview(toolArgs);
|
|
@@ -2066,16 +2120,11 @@ var BluMaAgent = class {
|
|
|
2066
2120
|
return;
|
|
2067
2121
|
}
|
|
2068
2122
|
const result = await this.mcpClient.invoke(toolName, toolArgs);
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
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);
|
|
2123
|
+
let finalResult = result;
|
|
2124
|
+
if (Array.isArray(result) && result.length > 0 && result[0].type === "text" && typeof result[0].text === "string") {
|
|
2125
|
+
finalResult = result[0].text;
|
|
2078
2126
|
}
|
|
2127
|
+
toolResultContent = typeof finalResult === "string" ? finalResult : JSON.stringify(finalResult);
|
|
2079
2128
|
} catch (error) {
|
|
2080
2129
|
toolResultContent = JSON.stringify({
|
|
2081
2130
|
error: `Tool execution failed: ${error.message}`,
|
|
@@ -3612,7 +3661,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3612
3661
|
// Uma única Box para o espaçamento
|
|
3613
3662
|
/* @__PURE__ */ jsx16(Box16, { marginBottom: 1, children: /* @__PURE__ */ jsxs14(Text15, { color: "white", dimColor: true, children: [
|
|
3614
3663
|
/* @__PURE__ */ jsxs14(Text15, { color: "white", children: [
|
|
3615
|
-
"
|
|
3664
|
+
">",
|
|
3616
3665
|
" "
|
|
3617
3666
|
] }),
|
|
3618
3667
|
displayText
|
|
@@ -3783,7 +3832,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
3783
3832
|
} else if (parsed.type === "user_overlay") {
|
|
3784
3833
|
newComponent = /* @__PURE__ */ jsx16(Box16, { marginBottom: 1, children: /* @__PURE__ */ jsxs14(Text15, { color: "gray", children: [
|
|
3785
3834
|
/* @__PURE__ */ jsxs14(Text15, { color: "magenta", children: [
|
|
3786
|
-
"
|
|
3835
|
+
">",
|
|
3787
3836
|
" "
|
|
3788
3837
|
] }),
|
|
3789
3838
|
parsed.payload
|