@nomad-e/bluma-cli 0.0.46 → 0.0.48

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 (3) hide show
  1. package/README.md +556 -557
  2. package/dist/main.js +273 -107
  3. package/package.json +5 -2
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 useState5, useEffect as useEffect4, useRef as useRef2, useCallback, memo as memo4 } from "react";
10
- import { Box as Box15, Text as Text14, Static } from "ink";
10
+ import { Box as Box16, Text as Text15, Static } from "ink";
11
11
 
12
12
  // src/app/ui/layout.tsx
13
13
  import { Box, Text } from "ink";
@@ -1705,22 +1705,25 @@ When asked to perform tasks such as fixing bugs, adding features, refactoring, o
1705
1705
  - Organize your entire reasoning and planning there.
1706
1706
 
1707
1707
  3. USE THE DYNAMIC AND REFLECTIVE PROBLEM-SOLVING TOOL
1708
- - Break down the task into **remaining_tasks** following this tool's guidelines.
1708
+ - Break down the task into **task_checklist** following this tool's guidelines.
1709
1709
  - Use the **thought** field for detailed analysis, revisions, and reasoning.
1710
- - Keep the **remaining_tasks** checklist updated with the mandatory format (\u{1F5F9} done, \u2610 pending).
1710
+ - Keep the **task_checklist** checklist updated with the mandatory format (\u{1F5F9} done, \u2610 pending).
1711
1711
  - Adjust total thoughts count as needed.
1712
1712
  - Explore hypotheses, verify them via chain-of-thought, and recommend appropriate tools for each step.
1713
- - Never put future steps or to-do items inside **thought**, only in **remaining_tasks**.
1713
+ - Never put future steps or to-do items inside **thought**, only in **task_checklist**.
1714
1714
 
1715
- 4. PROCESS REMAINING TASKS
1716
- - Execute the pending tasks from the **remaining_tasks** checklist one by one, updating the list and reasoning.
1715
+ 4. PROCESS TASKS IN CHECKLIST
1716
+ - Execute the pending tasks from the **task_checklist** checklist one by one, updating the list and reasoning.
1717
1717
  - Use recommended tools as per the reflective analysis.
1718
1718
  - Do not finalize or deliver a final answer before completing all pending tasks.
1719
1719
 
1720
1720
  5. CLOSE THE TASK AND THE TURN
1721
- - When all **remaining_tasks** are done, notify the user clearly:
1721
+ - Only close the turn when **all** originally planned tasks and any subtasks discovered during execution are fully completed.
1722
+ - Never treat the completion of a single subtask as completion of the entire objective.
1723
+ - When all **task_checklist** are done (all marked with \u{1F5F9}), notify the user clearly:
1722
1724
  "Task completed. There are no further pending actions."
1723
- - You MUST call the \`<agent_end_task_rules>\` tool to close the turn.
1725
+ - You MUST call the \`<agent_end_task_rules>\` tool **only at this stage** to close the turn.
1726
+ - Closing the turn ends the current autonomous workflow; ensure no further actions are pending or reasonably expected.
1724
1727
  - Do not perform any action after calling this tool in the same turn.
1725
1728
 
1726
1729
  6. WAIT FOR NEW TASK
@@ -1732,8 +1735,8 @@ When asked to perform tasks such as fixing bugs, adding features, refactoring, o
1732
1735
  ### IMPORTANT RULES
1733
1736
  - Sending the initial message is mandatory and marks the turn start.
1734
1737
  - Using the reasoning notebook is mandatory.
1735
- - Breaking the task into **remaining_tasks** with the reflective problem-solving tool is mandatory.
1736
- - Never include future steps in the **thought** field, only in the **remaining_tasks** checklist.
1738
+ - Breaking the task into **task_checklist** with the reflective problem-solving tool is mandatory.
1739
+ - Never include future steps in the **thought** field, only in the **task_checklist** checklist.
1737
1740
  - Calling \`<agent_end_task_rules>\` is mandatory to close the turn.
1738
1741
  - Decline out-of-scope tasks professionally before calling \`<agent_end_task_rules>\`.
1739
1742
  - Process only one task per turn, never multiple concurrently.
@@ -1801,7 +1804,10 @@ CRITICAL: Your laptop (**reasoning_nootebook**) is your ORGANIZED MIND
1801
1804
 
1802
1805
 
1803
1806
  <agent_end_task_rules>
1804
- This tool is mandatory.
1807
+ This tool is mandatory but **MUST ONLY** be used once **all** planned and pending tasks in the \`task_checklist\` checklist are fully completed.
1808
+ - Never call this tool after completing only part of a multi-step or multi-subtask request.
1809
+ - It is strictly forbidden to call \`agent_end_task\` if there are still unchecked items in \`task_checklist\`.
1810
+ - Before calling, verify that **task_checklist is empty** or **contains only completed (\u{1F5F9})** entries.
1805
1811
  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.
1806
1812
  </agent_end_task_rules>
1807
1813
 
@@ -2257,9 +2263,9 @@ CRITICAL: Your laptop (reasoning_nootebook) is your ORGANIZED MIND
2257
2263
  - Jumping between unrelated subtasks
2258
2264
 
2259
2265
  Important rule:
2260
- Do not include future steps/to-dos in thought; put them strictly in remaining_tasks, using the mandated checklist markers.
2266
+ Do not include future steps/to-dos in thought; put them strictly in task_checklist, using the mandated checklist markers.
2261
2267
 
2262
- - remaining_tasks: Checklist list of high-level upcoming tasks.
2268
+ - task_checklist: Checklist list of high-level upcoming tasks.
2263
2269
  Format is mandatory:
2264
2270
  - "\u{1F5F8}" \u2192 for tasks not yet done (pending)
2265
2271
  - "[ ]" \u2192 for tasks already completed
@@ -2308,7 +2314,7 @@ Rule Summary:
2308
2314
  - Always use tools (ls, readLines, count_lines, shell_command, edit_tool) to gather evidence before writing.
2309
2315
  - Never invent file content. Read files via tools to confirm.
2310
2316
 
2311
- ## OUTPUT & PROTOCOLS
2317
+ ## OUTPUT
2312
2318
  - Emit 'backend_message' events through tools only (message_notify_user) for progress updates.
2313
2319
  - Before writing BluMa.md, propose structure via message_notify_user and proceed using edit_tool.
2314
2320
  - If an irreversible operation is needed (e.g., overwriting an existing BluMa.md), issue 'confirmation_request' unless user policy indicates auto-approval.
@@ -2880,15 +2886,15 @@ var renderBlumaNotebook = ({
2880
2886
  paddingX: 1,
2881
2887
  children: [
2882
2888
  /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
2883
- /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Thought:" }),
2889
+ /* @__PURE__ */ jsx8(Text8, { color: "white", bold: true, children: "Reasoning:" }),
2884
2890
  /* @__PURE__ */ jsx8(Box8, { marginLeft: 2, children: /* @__PURE__ */ jsx8(Text8, { color: "gray", children: thinkingData.thought }) })
2885
2891
  ] }),
2886
- thinkingData.remaining_tasks && thinkingData.remaining_tasks.length > 0 && /* @__PURE__ */ jsxs8(Box8, { marginTop: 1, flexDirection: "column", children: [
2887
- /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Remaining Tasks:" }),
2888
- thinkingData.remaining_tasks.map((task, index) => /* @__PURE__ */ jsx8(Box8, { marginLeft: 2, children: /* @__PURE__ */ jsx8(Text8, { children: /* @__PURE__ */ jsx8(
2892
+ thinkingData.task_checklist && thinkingData.task_checklist.length > 0 && /* @__PURE__ */ jsxs8(Box8, { marginTop: 1, flexDirection: "column", children: [
2893
+ /* @__PURE__ */ jsx8(Text8, { color: "white", bold: true, children: "Todos:" }),
2894
+ thinkingData.task_checklist.map((task, index) => /* @__PURE__ */ jsx8(Box8, { marginLeft: 2, children: /* @__PURE__ */ jsx8(Text8, { children: /* @__PURE__ */ jsx8(
2889
2895
  Text8,
2890
2896
  {
2891
- color: task.startsWith("\u{1F5F9}") ? "green" : "yellow",
2897
+ color: task.startsWith("\u{1F5F9}") ? "gray" : "white",
2892
2898
  strikethrough: task.startsWith("\u{1F5F9}"),
2893
2899
  children: task
2894
2900
  }
@@ -2917,7 +2923,7 @@ var renderEditToolCall = ({
2917
2923
  filepath = "Error parsing arguments";
2918
2924
  }
2919
2925
  const finalFileName = filepath;
2920
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 1, children: [
2926
+ return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 1, borderStyle: "round", borderColor: "gray", borderDimColor: true, children: [
2921
2927
  /* @__PURE__ */ jsx8(Box8, { children: /* @__PURE__ */ jsxs8(Text8, { bold: true, children: [
2922
2928
  /* @__PURE__ */ jsx8(Text8, { color: "green", children: "\u25CF " }),
2923
2929
  "Edit File"
@@ -2970,8 +2976,167 @@ var ToolCallDisplay = memo2(ToolCallDisplayComponent);
2970
2976
 
2971
2977
  // src/app/ui/components/ToolResultDisplay.tsx
2972
2978
  import { memo as memo3 } from "react";
2979
+ import { Box as Box11 } from "ink";
2980
+
2981
+ // src/app/ui/components/MarkdownRenderer.tsx
2973
2982
  import { Box as Box10, Text as Text9 } from "ink";
2974
- import { jsx as jsx10 } from "react/jsx-runtime";
2983
+ import { marked } from "marked";
2984
+ import { highlight } from "cli-highlight";
2985
+ import chalk from "chalk";
2986
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
2987
+ function renderTokens(tokens) {
2988
+ const out = [];
2989
+ for (const token of tokens) {
2990
+ switch (token.type) {
2991
+ case "heading": {
2992
+ const t = token;
2993
+ const colors = {
2994
+ 1: chalk.bold.hex("#0969da"),
2995
+ // Azul GitHub
2996
+ 2: chalk.bold.hex("#1a7f37"),
2997
+ // Verde suave
2998
+ 3: chalk.bold.hex("#8250df"),
2999
+ // Roxo
3000
+ 4: chalk.bold.hex("#cf222e"),
3001
+ // Vermelho
3002
+ 5: chalk.bold.hex("#9a6700"),
3003
+ // Amarelo escuro
3004
+ 6: chalk.bold.hex("#57606a")
3005
+ // Cinza
3006
+ };
3007
+ out.push(
3008
+ /* @__PURE__ */ jsx10(Box10, { marginBottom: 1, children: /* @__PURE__ */ jsx10(Text9, { children: colors[t.depth](`# ${t.text}`) }) }, out.length)
3009
+ );
3010
+ break;
3011
+ }
3012
+ case "paragraph": {
3013
+ const p = token;
3014
+ out.push(
3015
+ /* @__PURE__ */ jsx10(Box10, { marginBottom: 1, flexDirection: "row", children: renderInline(p.text) }, out.length)
3016
+ );
3017
+ break;
3018
+ }
3019
+ case "list": {
3020
+ const l = token;
3021
+ l.items.forEach((item, idx) => {
3022
+ const text = item.tokens ? item.tokens.map((t) => t.type === "text" ? t.text : "").join("") : item.text;
3023
+ out.push(
3024
+ /* @__PURE__ */ jsxs9(Box10, { paddingLeft: 2, children: [
3025
+ /* @__PURE__ */ jsx10(Text9, { color: "white", children: l.ordered ? `${idx + 1}.` : "\u2022" }),
3026
+ /* @__PURE__ */ jsxs9(Text9, { children: [
3027
+ " ",
3028
+ renderInline(text)
3029
+ ] })
3030
+ ] }, out.length)
3031
+ );
3032
+ });
3033
+ out.push(/* @__PURE__ */ jsx10(Box10, { marginBottom: 1 }, out.length));
3034
+ break;
3035
+ }
3036
+ case "code": {
3037
+ const c = token;
3038
+ const highlighted = highlight(c.text, {
3039
+ language: c.lang ?? "text",
3040
+ ignoreIllegals: true
3041
+ });
3042
+ out.push(
3043
+ /* @__PURE__ */ jsxs9(
3044
+ Box10,
3045
+ {
3046
+ flexDirection: "column",
3047
+ borderStyle: "round",
3048
+ borderColor: "gray",
3049
+ children: [
3050
+ /* @__PURE__ */ jsx10(Box10, { marginBottom: 1, children: /* @__PURE__ */ jsx10(Text9, { bold: true, color: "cyan", children: c.lang ?? "code" }) }),
3051
+ /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsx10(Text9, { children: highlighted }) })
3052
+ ]
3053
+ },
3054
+ out.length
3055
+ )
3056
+ );
3057
+ break;
3058
+ }
3059
+ case "blockquote": {
3060
+ const b = token;
3061
+ out.push(
3062
+ /* @__PURE__ */ jsxs9(Box10, { flexDirection: "row", children: [
3063
+ /* @__PURE__ */ jsx10(Text9, { color: "#0969da", children: "\u2502 " }),
3064
+ /* @__PURE__ */ jsx10(Text9, { dimColor: true, italic: true, children: b.text })
3065
+ ] }, out.length)
3066
+ );
3067
+ break;
3068
+ }
3069
+ case "table": {
3070
+ const table = token;
3071
+ const headerCells = table.header.map(
3072
+ (cell) => chalk.bold(cell.text)
3073
+ );
3074
+ out.push(
3075
+ /* @__PURE__ */ jsx10(Box10, { flexDirection: "row", children: headerCells.map((h, i) => /* @__PURE__ */ jsx10(Box10, { paddingRight: 2, children: /* @__PURE__ */ jsx10(Text9, { children: h }) }, i)) }, out.length)
3076
+ );
3077
+ table.rows.forEach((row) => {
3078
+ out.push(
3079
+ /* @__PURE__ */ jsx10(Box10, { flexDirection: "row", children: row.map((cell, i) => /* @__PURE__ */ jsx10(Box10, { paddingRight: 2, children: /* @__PURE__ */ jsx10(Text9, { children: cell.text }) }, i)) }, out.length)
3080
+ );
3081
+ });
3082
+ out.push(/* @__PURE__ */ jsx10(Box10, { marginBottom: 1 }, out.length));
3083
+ break;
3084
+ }
3085
+ default:
3086
+ if (token.text) {
3087
+ out.push(/* @__PURE__ */ jsx10(Text9, { children: token.text }, out.length));
3088
+ }
3089
+ }
3090
+ }
3091
+ return out;
3092
+ }
3093
+ function renderInline(text) {
3094
+ const parts = [];
3095
+ let rest = text;
3096
+ const regex = /(\*\*(.+?)\*\*|\*(.+?)\*|`(.+?)`|\[(.+?)\]\((.+?)\))/;
3097
+ while (rest.length) {
3098
+ const m = rest.match(regex);
3099
+ if (!m) {
3100
+ parts.push(/* @__PURE__ */ jsx10(Text9, { children: rest }, parts.length));
3101
+ break;
3102
+ }
3103
+ const index = m.index ?? 0;
3104
+ if (index > 0)
3105
+ parts.push(/* @__PURE__ */ jsx10(Text9, { children: rest.slice(0, index) }, parts.length));
3106
+ const token = m[0];
3107
+ if (token.startsWith("**")) {
3108
+ parts.push(
3109
+ /* @__PURE__ */ jsx10(Text9, { bold: true, children: m[2] }, parts.length)
3110
+ );
3111
+ } else if (token.startsWith("*")) {
3112
+ parts.push(
3113
+ /* @__PURE__ */ jsx10(Text9, { italic: true, children: m[3] }, parts.length)
3114
+ );
3115
+ } else if (token.startsWith("`")) {
3116
+ parts.push(
3117
+ /* @__PURE__ */ jsx10(Text9, { children: /* @__PURE__ */ jsx10(Text9, { backgroundColor: "#eaeef2", color: "black", children: ` ${m[4]} ` }) }, parts.length)
3118
+ );
3119
+ } else if (token.startsWith("[")) {
3120
+ parts.push(
3121
+ /* @__PURE__ */ jsxs9(Text9, { underline: true, color: "#0969da", children: [
3122
+ m[5],
3123
+ " (",
3124
+ m[6],
3125
+ ")"
3126
+ ] }, parts.length)
3127
+ );
3128
+ }
3129
+ rest = rest.slice(index + token.length);
3130
+ }
3131
+ return parts;
3132
+ }
3133
+ var MarkdownRenderer = ({ markdown }) => {
3134
+ const tokens = marked.lexer(markdown);
3135
+ return /* @__PURE__ */ jsx10(Box10, { flexDirection: "column", children: renderTokens(tokens) });
3136
+ };
3137
+
3138
+ // src/app/ui/components/ToolResultDisplay.tsx
3139
+ import { jsx as jsx11 } from "react/jsx-runtime";
2975
3140
  var ToolResultDisplayComponent = ({ toolName, result }) => {
2976
3141
  if (!toolName.includes("message_notify_user")) {
2977
3142
  return null;
@@ -2980,7 +3145,7 @@ var ToolResultDisplayComponent = ({ toolName, result }) => {
2980
3145
  const parsed = JSON.parse(result);
2981
3146
  if (parsed.content && parsed.content.body) {
2982
3147
  const bodyText = parsed.content.body.trim();
2983
- return /* @__PURE__ */ jsx10(Box10, { marginBottom: 1, paddingX: 1, children: /* @__PURE__ */ jsx10(Text9, { children: bodyText }) });
3148
+ return /* @__PURE__ */ jsx11(Box11, { marginBottom: 1, paddingX: 1, flexDirection: "column", children: /* @__PURE__ */ jsx11(MarkdownRenderer, { markdown: bodyText }) });
2984
3149
  }
2985
3150
  } catch (e) {
2986
3151
  return null;
@@ -2990,50 +3155,50 @@ var ToolResultDisplayComponent = ({ toolName, result }) => {
2990
3155
  var ToolResultDisplay = memo3(ToolResultDisplayComponent);
2991
3156
 
2992
3157
  // src/app/ui/SessionInfoConnectingMCP.tsx
2993
- import { Box as Box11, Text as Text10 } from "ink";
3158
+ import { Box as Box12, Text as Text11 } from "ink";
2994
3159
  import Spinner from "ink-spinner";
2995
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3160
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2996
3161
  var SessionInfoConnectingMCP = ({
2997
3162
  sessionId: sessionId2,
2998
3163
  workdir,
2999
3164
  statusMessage
3000
3165
  }) => {
3001
- return /* @__PURE__ */ jsx11(
3002
- Box11,
3166
+ return /* @__PURE__ */ jsx12(
3167
+ Box12,
3003
3168
  {
3004
3169
  borderStyle: "round",
3005
3170
  borderColor: "gray",
3006
3171
  marginBottom: 1,
3007
- children: /* @__PURE__ */ jsxs9(
3008
- Box11,
3172
+ children: /* @__PURE__ */ jsxs10(
3173
+ Box12,
3009
3174
  {
3010
3175
  marginLeft: 1,
3011
3176
  flexDirection: "column",
3012
3177
  children: [
3013
- /* @__PURE__ */ jsxs9(Text10, { children: [
3014
- /* @__PURE__ */ jsx11(Text10, { bold: true, color: "white", children: "localhost" }),
3178
+ /* @__PURE__ */ jsxs10(Text11, { children: [
3179
+ /* @__PURE__ */ jsx12(Text11, { bold: true, color: "white", children: "localhost" }),
3015
3180
  " ",
3016
- /* @__PURE__ */ jsx11(Text10, { color: "gray", children: " session:" }),
3181
+ /* @__PURE__ */ jsx12(Text11, { color: "gray", children: " session:" }),
3017
3182
  " ",
3018
- /* @__PURE__ */ jsx11(Text10, { color: "magenta", children: sessionId2 })
3183
+ /* @__PURE__ */ jsx12(Text11, { color: "magenta", children: sessionId2 })
3019
3184
  ] }),
3020
- /* @__PURE__ */ jsxs9(Text10, { children: [
3021
- /* @__PURE__ */ jsx11(Text10, { color: "magenta", children: "\u21B3" }),
3185
+ /* @__PURE__ */ jsxs10(Text11, { children: [
3186
+ /* @__PURE__ */ jsx12(Text11, { color: "magenta", children: "\u21B3" }),
3022
3187
  " ",
3023
- /* @__PURE__ */ jsxs9(Text10, { color: "gray", children: [
3188
+ /* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
3024
3189
  "workdir: ",
3025
3190
  workdir
3026
3191
  ] })
3027
3192
  ] }),
3028
- /* @__PURE__ */ jsxs9(Text10, { children: [
3029
- /* @__PURE__ */ jsx11(Text10, { color: "magenta", children: "\u21B3" }),
3193
+ /* @__PURE__ */ jsxs10(Text11, { children: [
3194
+ /* @__PURE__ */ jsx12(Text11, { color: "magenta", children: "\u21B3" }),
3030
3195
  " ",
3031
- /* @__PURE__ */ jsx11(Text10, { color: "gray", children: "mcp: " }),
3032
- /* @__PURE__ */ jsxs9(Text10, { color: "yellow", children: [
3033
- /* @__PURE__ */ jsx11(Spinner, { type: "dots" }),
3196
+ /* @__PURE__ */ jsx12(Text11, { color: "gray", children: "mcp: " }),
3197
+ /* @__PURE__ */ jsxs10(Text11, { color: "yellow", children: [
3198
+ /* @__PURE__ */ jsx12(Spinner, { type: "dots" }),
3034
3199
  " "
3035
3200
  ] }),
3036
- /* @__PURE__ */ jsx11(Text10, { color: "white", children: statusMessage || "Please wait while we establish connections." })
3201
+ /* @__PURE__ */ jsx12(Text11, { color: "white", children: statusMessage || "Please wait while we establish connections." })
3037
3202
  ] })
3038
3203
  ]
3039
3204
  }
@@ -3044,11 +3209,11 @@ var SessionInfoConnectingMCP = ({
3044
3209
  var SessionInfoConnectingMCP_default = SessionInfoConnectingMCP;
3045
3210
 
3046
3211
  // src/app/ui/components/SlashCommands.tsx
3047
- import { Box as Box12, Text as Text11 } from "ink";
3048
- import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3212
+ import { Box as Box13, Text as Text12 } from "ink";
3213
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3049
3214
  var SlashCommands = ({ input, setHistory, agentRef }) => {
3050
3215
  const [cmd, ...args] = input.slice(1).trim().split(/\s+/);
3051
- const outBox = (children) => /* @__PURE__ */ jsx12(Box12, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginBottom: 1, flexDirection: "column", children });
3216
+ const outBox = (children) => /* @__PURE__ */ jsx13(Box13, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginBottom: 1, flexDirection: "column", children });
3052
3217
  const render2 = () => {
3053
3218
  if (!cmd) {
3054
3219
  return null;
@@ -3056,9 +3221,9 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
3056
3221
  if (cmd === "help") {
3057
3222
  const cmds = getSlashCommands();
3058
3223
  return outBox(
3059
- /* @__PURE__ */ jsxs10(Fragment2, { children: [
3060
- /* @__PURE__ */ jsx12(Text11, { color: "magenta", bold: true, children: "Available commands" }),
3061
- cmds.map((c, i) => /* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
3224
+ /* @__PURE__ */ jsxs11(Fragment2, { children: [
3225
+ /* @__PURE__ */ jsx13(Text12, { color: "magenta", bold: true, children: "Available commands" }),
3226
+ cmds.map((c, i) => /* @__PURE__ */ jsxs11(Text12, { color: "gray", children: [
3062
3227
  c.name,
3063
3228
  " - ",
3064
3229
  c.description
@@ -3068,7 +3233,7 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
3068
3233
  }
3069
3234
  if (cmd === "clear") {
3070
3235
  setHistory((prev) => prev.filter((item) => item.id === 0 || item.id === 1));
3071
- return outBox(/* @__PURE__ */ jsx12(Text11, { color: "green", children: "History cleared." }));
3236
+ return outBox(/* @__PURE__ */ jsx13(Text12, { color: "green", children: "History cleared." }));
3072
3237
  }
3073
3238
  if (cmd === "init") {
3074
3239
  (async () => {
@@ -3077,7 +3242,7 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
3077
3242
  } catch (e) {
3078
3243
  setHistory((prev) => prev.concat({
3079
3244
  id: Date.now(),
3080
- component: outBox(/* @__PURE__ */ jsxs10(Text11, { color: "red", children: [
3245
+ component: outBox(/* @__PURE__ */ jsxs11(Text12, { color: "red", children: [
3081
3246
  "Failed to execute /init: ",
3082
3247
  e?.message || String(e)
3083
3248
  ] }))
@@ -3097,22 +3262,22 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
3097
3262
  const colType = 10;
3098
3263
  const colSource = 18;
3099
3264
  return outBox(
3100
- /* @__PURE__ */ jsxs10(Fragment2, { children: [
3101
- /* @__PURE__ */ jsx12(Text11, { color: "magenta", bold: true, children: "MCP Tools" }),
3102
- /* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
3265
+ /* @__PURE__ */ jsxs11(Fragment2, { children: [
3266
+ /* @__PURE__ */ jsx13(Text12, { color: "magenta", bold: true, children: "MCP Tools" }),
3267
+ /* @__PURE__ */ jsxs11(Text12, { color: "gray", children: [
3103
3268
  "Total MCP: ",
3104
3269
  tools.length,
3105
3270
  term ? ` | Filter: "${term}" | Showing: ${filtered.length}` : ""
3106
3271
  ] }),
3107
- filtered.length === 0 ? /* @__PURE__ */ jsx12(Text11, { color: "yellow", children: "No MCP tools to display." }) : /* @__PURE__ */ jsxs10(Box12, { flexDirection: "column", children: [
3108
- /* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
3272
+ filtered.length === 0 ? /* @__PURE__ */ jsx13(Text12, { color: "yellow", children: "No MCP tools to display." }) : /* @__PURE__ */ jsxs11(Box13, { flexDirection: "column", children: [
3273
+ /* @__PURE__ */ jsxs11(Text12, { color: "gray", children: [
3109
3274
  pad("Name", colName),
3110
3275
  " | ",
3111
3276
  pad("Type", colType),
3112
3277
  " | ",
3113
3278
  pad("Source", colSource)
3114
3279
  ] }),
3115
- /* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
3280
+ /* @__PURE__ */ jsxs11(Text12, { color: "gray", children: [
3116
3281
  "".padEnd(colName, "-"),
3117
3282
  "---",
3118
3283
  "".padEnd(colType, "-"),
@@ -3123,7 +3288,7 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
3123
3288
  const name = t.function?.name || t.name || "tool";
3124
3289
  const type = t.function?.name ? "fn" : t.type || "tool";
3125
3290
  const source = t.source || t.provider || "mcp";
3126
- return /* @__PURE__ */ jsxs10(Text11, { color: "white", children: [
3291
+ return /* @__PURE__ */ jsxs11(Text12, { color: "white", children: [
3127
3292
  pad(name, colName),
3128
3293
  " | ",
3129
3294
  pad(String(type), colType),
@@ -3146,22 +3311,22 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
3146
3311
  const colType = 10;
3147
3312
  const colSource = 18;
3148
3313
  return outBox(
3149
- /* @__PURE__ */ jsxs10(Fragment2, { children: [
3150
- /* @__PURE__ */ jsx12(Text11, { color: "magenta", bold: true, children: "Native Tools" }),
3151
- /* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
3314
+ /* @__PURE__ */ jsxs11(Fragment2, { children: [
3315
+ /* @__PURE__ */ jsx13(Text12, { color: "magenta", bold: true, children: "Native Tools" }),
3316
+ /* @__PURE__ */ jsxs11(Text12, { color: "gray", children: [
3152
3317
  "Total Native: ",
3153
3318
  tools.length,
3154
3319
  term ? ` | Filter: "${term}" | Showing: ${filtered.length}` : ""
3155
3320
  ] }),
3156
- filtered.length === 0 ? /* @__PURE__ */ jsx12(Text11, { color: "yellow", children: "No native tools to display." }) : /* @__PURE__ */ jsxs10(Box12, { flexDirection: "column", children: [
3157
- /* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
3321
+ filtered.length === 0 ? /* @__PURE__ */ jsx13(Text12, { color: "yellow", children: "No native tools to display." }) : /* @__PURE__ */ jsxs11(Box13, { flexDirection: "column", children: [
3322
+ /* @__PURE__ */ jsxs11(Text12, { color: "gray", children: [
3158
3323
  pad("Name", colName),
3159
3324
  " | ",
3160
3325
  pad("Type", colType),
3161
3326
  " | ",
3162
3327
  pad("Source", colSource)
3163
3328
  ] }),
3164
- /* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
3329
+ /* @__PURE__ */ jsxs11(Text12, { color: "gray", children: [
3165
3330
  "".padEnd(colName, "-"),
3166
3331
  "---",
3167
3332
  "".padEnd(colType, "-"),
@@ -3172,7 +3337,7 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
3172
3337
  const name = t.function?.name || t.name || "tool";
3173
3338
  const type = t.function?.name ? "fn" : t.type || "tool";
3174
3339
  const source = t.source || "native";
3175
- return /* @__PURE__ */ jsxs10(Text11, { color: "white", children: [
3340
+ return /* @__PURE__ */ jsxs11(Text12, { color: "white", children: [
3176
3341
  pad(name, colName),
3177
3342
  " | ",
3178
3343
  pad(String(type), colType),
@@ -3184,12 +3349,12 @@ var SlashCommands = ({ input, setHistory, agentRef }) => {
3184
3349
  ] })
3185
3350
  );
3186
3351
  }
3187
- return outBox(/* @__PURE__ */ jsxs10(Text11, { color: "red", children: [
3352
+ return outBox(/* @__PURE__ */ jsxs11(Text12, { color: "red", children: [
3188
3353
  "Command not recognized: /",
3189
3354
  cmd
3190
3355
  ] }));
3191
3356
  };
3192
- return /* @__PURE__ */ jsx12(Fragment2, { children: render2() });
3357
+ return /* @__PURE__ */ jsx13(Fragment2, { children: render2() });
3193
3358
  };
3194
3359
  var SlashCommands_default = SlashCommands;
3195
3360
 
@@ -3260,8 +3425,8 @@ async function checkForUpdates() {
3260
3425
  }
3261
3426
 
3262
3427
  // src/app/ui/components/UpdateNotice.tsx
3263
- import { Box as Box13, Text as Text12 } from "ink";
3264
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3428
+ import { Box as Box14, Text as Text13 } from "ink";
3429
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3265
3430
  function parseUpdateMessage(msg) {
3266
3431
  const lines = msg.split(/\r?\n/).map((l) => l.trim());
3267
3432
  const first = lines[0] || "";
@@ -3280,20 +3445,20 @@ function parseUpdateMessage(msg) {
3280
3445
  }
3281
3446
  var UpdateNotice = ({ message }) => {
3282
3447
  const { name, current, latest, hint } = parseUpdateMessage(message);
3283
- return /* @__PURE__ */ jsxs11(Box13, { flexDirection: "column", marginBottom: 1, children: [
3284
- /* @__PURE__ */ jsx13(Text12, { color: "yellow", bold: true, children: "Update Available" }),
3285
- name && current && latest ? /* @__PURE__ */ jsx13(Text12, { color: "gray", children: `${name}: ${current} \u2192 ${latest}` }) : /* @__PURE__ */ jsx13(Text12, { color: "gray", children: message }),
3286
- hint ? /* @__PURE__ */ jsx13(Text12, { color: "gray", children: hint }) : null
3448
+ return /* @__PURE__ */ jsxs12(Box14, { flexDirection: "column", marginBottom: 1, children: [
3449
+ /* @__PURE__ */ jsx14(Text13, { color: "yellow", bold: true, children: "Update Available" }),
3450
+ name && current && latest ? /* @__PURE__ */ jsx14(Text13, { color: "gray", children: `${name}: ${current} \u2192 ${latest}` }) : /* @__PURE__ */ jsx14(Text13, { color: "gray", children: message }),
3451
+ hint ? /* @__PURE__ */ jsx14(Text13, { color: "gray", children: hint }) : null
3287
3452
  ] });
3288
3453
  };
3289
3454
  var UpdateNotice_default = UpdateNotice;
3290
3455
 
3291
3456
  // src/app/ui/components/ErrorMessage.tsx
3292
- import { Box as Box14, Text as Text13 } from "ink";
3293
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3457
+ import { Box as Box15, Text as Text14 } from "ink";
3458
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3294
3459
  var ErrorMessage = ({ message, details, hint }) => {
3295
- return /* @__PURE__ */ jsxs12(
3296
- Box14,
3460
+ return /* @__PURE__ */ jsxs13(
3461
+ Box15,
3297
3462
  {
3298
3463
  borderStyle: "round",
3299
3464
  borderColor: "red",
@@ -3302,10 +3467,10 @@ var ErrorMessage = ({ message, details, hint }) => {
3302
3467
  flexDirection: "column",
3303
3468
  marginBottom: 1,
3304
3469
  children: [
3305
- /* @__PURE__ */ jsx14(Text13, { color: "red", bold: true, children: "Error" }),
3306
- /* @__PURE__ */ jsx14(Text13, { color: "red", children: message }),
3307
- details ? /* @__PURE__ */ jsx14(Text13, { color: "red", dimColor: true, children: details }) : null,
3308
- hint ? /* @__PURE__ */ jsxs12(Text13, { color: "gray", children: [
3470
+ /* @__PURE__ */ jsx15(Text14, { color: "red", bold: true, children: "Error" }),
3471
+ /* @__PURE__ */ jsx15(Text14, { color: "red", children: message }),
3472
+ details ? /* @__PURE__ */ jsx15(Text14, { color: "red", dimColor: true, children: details }) : null,
3473
+ hint ? /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
3309
3474
  "Hint: ",
3310
3475
  hint
3311
3476
  ] }) : null
@@ -3316,7 +3481,7 @@ var ErrorMessage = ({ message, details, hint }) => {
3316
3481
  var ErrorMessage_default = ErrorMessage;
3317
3482
 
3318
3483
  // src/app/ui/App.tsx
3319
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3484
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3320
3485
  var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3321
3486
  const agentInstance = useRef2(null);
3322
3487
  const [history, setHistory] = useState5([]);
@@ -3346,7 +3511,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3346
3511
  ...prev,
3347
3512
  {
3348
3513
  id: prev.length,
3349
- component: /* @__PURE__ */ jsx15(Text14, { color: "yellow", children: "-- Task cancelled by dev. --" })
3514
+ component: /* @__PURE__ */ jsx16(Text15, { color: "yellow", children: "-- Task cancelled by dev. --" })
3350
3515
  }
3351
3516
  ]);
3352
3517
  }, [isProcessing, eventBus2]);
@@ -3370,11 +3535,11 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3370
3535
  ...prev,
3371
3536
  {
3372
3537
  id: prev.length,
3373
- component: /* @__PURE__ */ jsx15(Box15, { marginBottom: 1, children: /* @__PURE__ */ jsx15(Text14, { color: "white", dimColor: true, children: text }) })
3538
+ component: /* @__PURE__ */ jsx16(Box16, { marginBottom: 1, children: /* @__PURE__ */ jsx16(Text15, { color: "white", dimColor: true, children: text }) })
3374
3539
  },
3375
3540
  {
3376
3541
  id: prev.length + 1,
3377
- component: /* @__PURE__ */ jsx15(
3542
+ component: /* @__PURE__ */ jsx16(
3378
3543
  SlashCommands_default,
3379
3544
  {
3380
3545
  input: text,
@@ -3394,8 +3559,8 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3394
3559
  id: prev.length,
3395
3560
  component: (
3396
3561
  // Uma única Box para o espaçamento
3397
- /* @__PURE__ */ jsx15(Box15, { marginBottom: 1, children: /* @__PURE__ */ jsxs13(Text14, { color: "white", dimColor: true, children: [
3398
- /* @__PURE__ */ jsxs13(Text14, { color: "white", children: [
3562
+ /* @__PURE__ */ jsx16(Box16, { marginBottom: 1, children: /* @__PURE__ */ jsxs14(Text15, { color: "white", dimColor: true, children: [
3563
+ /* @__PURE__ */ jsxs14(Text15, { color: "white", children: [
3399
3564
  "\u276F",
3400
3565
  " "
3401
3566
  ] }),
@@ -3430,7 +3595,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3430
3595
  []
3431
3596
  );
3432
3597
  useEffect4(() => {
3433
- setHistory([{ id: 0, component: /* @__PURE__ */ jsx15(Header, {}) }]);
3598
+ setHistory([{ id: 0, component: /* @__PURE__ */ jsx16(Header, {}) }]);
3434
3599
  const initializeAgent = async () => {
3435
3600
  try {
3436
3601
  agentInstance.current = new Agent(sessionId2, eventBus2);
@@ -3485,7 +3650,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3485
3650
  if (prev.length < 2) {
3486
3651
  newHistory.push({
3487
3652
  id: 1,
3488
- component: /* @__PURE__ */ jsx15(
3653
+ component: /* @__PURE__ */ jsx16(
3489
3654
  SessionInfo,
3490
3655
  {
3491
3656
  sessionId: sessionId2,
@@ -3506,7 +3671,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3506
3671
  ...prev,
3507
3672
  {
3508
3673
  id: prev.length,
3509
- component: /* @__PURE__ */ jsx15(UpdateNotice_default, { message: msg })
3674
+ component: /* @__PURE__ */ jsx16(UpdateNotice_default, { message: msg })
3510
3675
  }
3511
3676
  ]);
3512
3677
  }
@@ -3520,10 +3685,10 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3520
3685
  }
3521
3686
  let newComponent = null;
3522
3687
  if (parsed.type === "debug") {
3523
- newComponent = /* @__PURE__ */ jsx15(Text14, { color: "gray", children: parsed.message });
3688
+ newComponent = /* @__PURE__ */ jsx16(Text15, { color: "gray", children: parsed.message });
3524
3689
  } else if (parsed.type === "protocol_violation") {
3525
- newComponent = /* @__PURE__ */ jsxs13(
3526
- Box15,
3690
+ newComponent = /* @__PURE__ */ jsxs14(
3691
+ Box16,
3527
3692
  {
3528
3693
  borderStyle: "round",
3529
3694
  borderColor: "yellow",
@@ -3531,14 +3696,14 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3531
3696
  marginBottom: 1,
3532
3697
  paddingX: 1,
3533
3698
  children: [
3534
- /* @__PURE__ */ jsx15(Text14, { color: "yellow", bold: true, children: "Protocol Violation" }),
3535
- /* @__PURE__ */ jsx15(Text14, { color: "gray", children: parsed.content }),
3536
- /* @__PURE__ */ jsx15(Text14, { color: "yellow", children: parsed.message })
3699
+ /* @__PURE__ */ jsx16(Text15, { color: "yellow", bold: true, children: "Protocol Violation" }),
3700
+ /* @__PURE__ */ jsx16(Text15, { color: "gray", children: parsed.content }),
3701
+ /* @__PURE__ */ jsx16(Text15, { color: "yellow", children: parsed.message })
3537
3702
  ]
3538
3703
  }
3539
3704
  );
3540
3705
  } else if (parsed.type === "error") {
3541
- newComponent = /* @__PURE__ */ jsx15(
3706
+ newComponent = /* @__PURE__ */ jsx16(
3542
3707
  ErrorMessage_default,
3543
3708
  {
3544
3709
  message: parsed.message,
@@ -3547,7 +3712,8 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3547
3712
  }
3548
3713
  );
3549
3714
  } else if (parsed.type === "tool_call") {
3550
- newComponent = /* @__PURE__ */ jsx15(
3715
+ const nextId = history.length;
3716
+ newComponent = /* @__PURE__ */ jsx16(
3551
3717
  ToolCallDisplay,
3552
3718
  {
3553
3719
  toolName: parsed.tool_name,
@@ -3556,7 +3722,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3556
3722
  }
3557
3723
  );
3558
3724
  } else if (parsed.type === "tool_result") {
3559
- newComponent = /* @__PURE__ */ jsx15(
3725
+ newComponent = /* @__PURE__ */ jsx16(
3560
3726
  ToolResultDisplay,
3561
3727
  {
3562
3728
  toolName: parsed.tool_name,
@@ -3564,15 +3730,15 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3564
3730
  }
3565
3731
  );
3566
3732
  } else if (parsed.type === "user_overlay") {
3567
- newComponent = /* @__PURE__ */ jsx15(Box15, { marginBottom: 1, children: /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
3568
- /* @__PURE__ */ jsxs13(Text14, { color: "magenta", children: [
3733
+ newComponent = /* @__PURE__ */ jsx16(Box16, { marginBottom: 1, children: /* @__PURE__ */ jsxs14(Text15, { color: "gray", children: [
3734
+ /* @__PURE__ */ jsxs14(Text15, { color: "magenta", children: [
3569
3735
  "\u276F",
3570
3736
  " "
3571
3737
  ] }),
3572
3738
  parsed.payload
3573
3739
  ] }) });
3574
3740
  } else if (parsed.type === "log") {
3575
- newComponent = /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
3741
+ newComponent = /* @__PURE__ */ jsxs14(Text15, { color: "gray", children: [
3576
3742
  "\u2139\uFE0F ",
3577
3743
  parsed.message,
3578
3744
  parsed.payload ? `: ${parsed.payload}` : ""
@@ -3602,7 +3768,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3602
3768
  }, [eventBus2, sessionId2, handleConfirmation]);
3603
3769
  const renderInteractiveComponent = () => {
3604
3770
  if (mcpStatus !== "connected") {
3605
- return /* @__PURE__ */ jsx15(Box15, { borderStyle: "round", borderColor: "black", children: /* @__PURE__ */ jsx15(
3771
+ return /* @__PURE__ */ jsx16(Box16, { borderStyle: "round", borderColor: "black", children: /* @__PURE__ */ jsx16(
3606
3772
  SessionInfoConnectingMCP_default,
3607
3773
  {
3608
3774
  sessionId: sessionId2,
@@ -3612,7 +3778,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3612
3778
  ) });
3613
3779
  }
3614
3780
  if (pendingConfirmation) {
3615
- return /* @__PURE__ */ jsx15(
3781
+ return /* @__PURE__ */ jsx16(
3616
3782
  ConfirmationPrompt,
3617
3783
  {
3618
3784
  toolCalls: pendingConfirmation,
@@ -3624,9 +3790,9 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3624
3790
  }
3625
3791
  );
3626
3792
  }
3627
- return /* @__PURE__ */ jsxs13(Box15, { flexDirection: "column", children: [
3628
- isProcessing && !pendingConfirmation && /* @__PURE__ */ jsx15(WorkingTimer, {}),
3629
- /* @__PURE__ */ jsx15(
3793
+ return /* @__PURE__ */ jsxs14(Box16, { flexDirection: "column", children: [
3794
+ isProcessing && !pendingConfirmation && /* @__PURE__ */ jsx16(WorkingTimer, {}),
3795
+ /* @__PURE__ */ jsx16(
3630
3796
  InputPrompt,
3631
3797
  {
3632
3798
  onSubmit: handleSubmit,
@@ -3637,8 +3803,8 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
3637
3803
  )
3638
3804
  ] });
3639
3805
  };
3640
- return /* @__PURE__ */ jsxs13(Box15, { flexDirection: "column", children: [
3641
- /* @__PURE__ */ jsx15(Static, { items: history, children: (item) => /* @__PURE__ */ jsx15(Box15, { children: item.component }, item.id) }),
3806
+ return /* @__PURE__ */ jsxs14(Box16, { flexDirection: "column", children: [
3807
+ /* @__PURE__ */ jsx16(Static, { items: history, children: (item) => /* @__PURE__ */ jsx16(Box16, { children: item.component }, item.id) }),
3642
3808
  renderInteractiveComponent()
3643
3809
  ] });
3644
3810
  };