@nomad-e/bluma-cli 0.1.73 → 0.1.74

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 +1640 -1846
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -21,6 +21,12 @@ var __copyProps = (to, from, except, desc) => {
21
21
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
22
 
23
23
  // src/app/agent/runtime/runtime_config.ts
24
+ var runtime_config_exports = {};
25
+ __export(runtime_config_exports, {
26
+ getRuntimeConfig: () => getRuntimeConfig,
27
+ getRuntimeConfigPath: () => getRuntimeConfigPath,
28
+ setRuntimeConfig: () => setRuntimeConfig
29
+ });
24
30
  import fs4 from "fs";
25
31
  import os4 from "os";
26
32
  import path5 from "path";
@@ -1611,146 +1617,6 @@ var init_poll_mailbox = __esm({
1611
1617
  }
1612
1618
  });
1613
1619
 
1614
- // src/app/ui/theme/themes.ts
1615
- var themes_exports = {};
1616
- __export(themes_exports, {
1617
- THEMES: () => THEMES,
1618
- getTheme: () => getTheme,
1619
- getThemeColors: () => getThemeColors,
1620
- listThemes: () => listThemes
1621
- });
1622
- function getTheme(name) {
1623
- return THEMES[name];
1624
- }
1625
- function listThemes() {
1626
- return Object.values(THEMES).map((t) => ({ name: t.name, description: t.description }));
1627
- }
1628
- function getThemeColors(name) {
1629
- return THEMES[name]?.colors;
1630
- }
1631
- var THEMES;
1632
- var init_themes = __esm({
1633
- "src/app/ui/theme/themes.ts"() {
1634
- "use strict";
1635
- THEMES = {
1636
- default: {
1637
- name: "Default",
1638
- description: "Classic dark terminal theme",
1639
- colors: {
1640
- background: "#000000",
1641
- foreground: "#ffffff",
1642
- accent: "#3b82f6",
1643
- error: "#ef4444",
1644
- success: "#22c55e",
1645
- warning: "#f59e0b",
1646
- info: "#06b6d4",
1647
- toolCall: "#8b5cf6",
1648
- toolResult: "#06b6d4",
1649
- assistantMessage: "#ffffff",
1650
- userMessage: "#9ca3af",
1651
- border: "#374151",
1652
- dim: "#6b7280"
1653
- }
1654
- },
1655
- dracula: {
1656
- name: "Dracula",
1657
- description: "Popular dark theme with purple accents",
1658
- colors: {
1659
- background: "#282a36",
1660
- foreground: "#f8f8f2",
1661
- accent: "#bd93f9",
1662
- error: "#ff5555",
1663
- success: "#50fa7b",
1664
- warning: "#ffb86c",
1665
- info: "#8be9fd",
1666
- toolCall: "#ff79c6",
1667
- toolResult: "#8be9fd",
1668
- assistantMessage: "#f8f8f2",
1669
- userMessage: "#6272a4",
1670
- border: "#44475a",
1671
- dim: "#6272a4"
1672
- }
1673
- },
1674
- github: {
1675
- name: "GitHub Dark",
1676
- description: "GitHub dark mode inspired theme",
1677
- colors: {
1678
- background: "#0d1117",
1679
- foreground: "#c9d1d9",
1680
- accent: "#58a6ff",
1681
- error: "#f85149",
1682
- success: "#3fb950",
1683
- warning: "#d29922",
1684
- info: "#58a6ff",
1685
- toolCall: "#bc8cff",
1686
- toolResult: "#39d353",
1687
- assistantMessage: "#c9d1d9",
1688
- userMessage: "#8b949e",
1689
- border: "#30363d",
1690
- dim: "#484f58"
1691
- }
1692
- },
1693
- monokai: {
1694
- name: "Monokai",
1695
- description: "Vibrant dark theme with green accents",
1696
- colors: {
1697
- background: "#272822",
1698
- foreground: "#f8f8f2",
1699
- accent: "#a6e22e",
1700
- error: "#f92672",
1701
- success: "#a6e22e",
1702
- warning: "#e6db74",
1703
- info: "#66d9ef",
1704
- toolCall: "#fd971f",
1705
- toolResult: "#66d9ef",
1706
- assistantMessage: "#f8f8f2",
1707
- userMessage: "#75715e",
1708
- border: "#3e3d32",
1709
- dim: "#75715e"
1710
- }
1711
- },
1712
- nord: {
1713
- name: "Nord",
1714
- description: "Arctic north-bluish color palette",
1715
- colors: {
1716
- background: "#2e3440",
1717
- foreground: "#d8dee9",
1718
- accent: "#88c0d0",
1719
- error: "#bf616a",
1720
- success: "#a3be8c",
1721
- warning: "#ebcb8b",
1722
- info: "#81a1c1",
1723
- toolCall: "#b48ead",
1724
- toolResult: "#88c0d0",
1725
- assistantMessage: "#d8dee9",
1726
- userMessage: "#4c566a",
1727
- border: "#3b4252",
1728
- dim: "#4c566a"
1729
- }
1730
- },
1731
- tokyo: {
1732
- name: "Tokyo Night",
1733
- description: "Clean dark theme with blue-purple tones",
1734
- colors: {
1735
- background: "#1a1b26",
1736
- foreground: "#a9b1d6",
1737
- accent: "#7aa2f7",
1738
- error: "#f7768e",
1739
- success: "#9ece6a",
1740
- warning: "#e0af68",
1741
- info: "#7dcfff",
1742
- toolCall: "#bb9af7",
1743
- toolResult: "#7dcfff",
1744
- assistantMessage: "#a9b1d6",
1745
- userMessage: "#565f89",
1746
- border: "#24283b",
1747
- dim: "#565f89"
1748
- }
1749
- }
1750
- };
1751
- }
1752
- });
1753
-
1754
1620
  // src/main.ts
1755
1621
  import React19 from "react";
1756
1622
  import { render } from "ink";
@@ -1762,8 +1628,8 @@ import { spawn as spawn6 } from "child_process";
1762
1628
  import { v4 as uuidv412 } from "uuid";
1763
1629
 
1764
1630
  // src/app/ui/App.tsx
1765
- import { useState as useState11, useEffect as useEffect11, useRef as useRef6, useCallback as useCallback4, memo as memo15 } from "react";
1766
- import { Box as Box27, Text as Text26, Static, useInput as useInput6 } from "ink";
1631
+ import { useState as useState10, useEffect as useEffect11, useRef as useRef6, useCallback as useCallback4, memo as memo15 } from "react";
1632
+ import { Box as Box35, Text as Text34, Static, useInput as useInput6 } from "ink";
1767
1633
 
1768
1634
  // src/app/ui/layout.tsx
1769
1635
  import { Box, Text } from "ink";
@@ -2346,7 +2212,7 @@ var getSlashCommands = () => [
2346
2212
  },
2347
2213
  {
2348
2214
  name: "/tasks",
2349
- description: "manage task list: /tasks [list|add|complete|update|remove|clear]",
2215
+ description: "manage mason list: /tasks [list|add|complete|update|remove|clear]",
2350
2216
  category: "session"
2351
2217
  },
2352
2218
  {
@@ -2671,15 +2537,6 @@ var getSlashCommands = () => [
2671
2537
  category: "session"
2672
2538
  }
2673
2539
  ];
2674
- var getSlashCommandsByGroup = () => {
2675
- const cmds = getSlashCommands();
2676
- const order = ["session", "agent", "inspect", "help", "input"];
2677
- return order.map((cat) => ({
2678
- category: cat,
2679
- label: CATEGORY_LABEL[cat],
2680
- commands: cmds.filter((c) => c.category === cat)
2681
- })).filter((group) => group.commands.length > 0);
2682
- };
2683
2540
  var SLASH_ROUTE_KEYWORDS = new Set(
2684
2541
  getSlashCommands().filter((c) => c.name.startsWith("/")).map((c) => c.name.slice(1).toLowerCase())
2685
2542
  );
@@ -2705,6 +2562,21 @@ var CATEGORY_LABEL = {
2705
2562
  help: "Help",
2706
2563
  input: "Input"
2707
2564
  };
2565
+ function formatSlashHelpLines() {
2566
+ const cmds = getSlashCommands();
2567
+ const byCat = (cat) => cmds.filter((c) => c.category === cat);
2568
+ const lines = [];
2569
+ for (const cat of ["help", "session", "input", "agent", "inspect"]) {
2570
+ const group = byCat(cat);
2571
+ if (group.length === 0) continue;
2572
+ lines.push(`${CATEGORY_LABEL[cat]}:`);
2573
+ for (const c of group) {
2574
+ lines.push(` ${c.name.padEnd(14)} ${c.description}`);
2575
+ }
2576
+ lines.push("");
2577
+ }
2578
+ return lines;
2579
+ }
2708
2580
  var filterSlashCommands = (query) => {
2709
2581
  const list = getSlashCommands();
2710
2582
  const q = (query || "").toLowerCase();
@@ -5068,7 +4940,7 @@ var TOOL_DISPLAY_LABELS = {
5068
4940
  wait_agent: "Wait for agent",
5069
4941
  list_agents: "List agents",
5070
4942
  todo: "Todo list",
5071
- task_boundary: "Task boundary",
4943
+ task_boundary: "Mason boundary",
5072
4944
  load_skill: "Load skill",
5073
4945
  coding_memory: "Coding memory",
5074
4946
  create_artifact: "Create artifact",
@@ -5078,11 +4950,11 @@ var TOOL_DISPLAY_LABELS = {
5078
4950
  ask_user_question: "Ask user",
5079
4951
  enter_plan_mode: "Enter plan mode",
5080
4952
  exit_plan_mode: "Exit plan mode",
5081
- task_create: "Task create",
5082
- task_list: "Task list",
5083
- task_get: "Task get",
5084
- task_update: "Task update",
5085
- task_stop: "Task stop",
4953
+ task_create: "Mason create",
4954
+ task_list: "Mason list",
4955
+ task_get: "Mason get",
4956
+ task_update: "Mason update",
4957
+ task_stop: "Mason stop",
5086
4958
  list_mcp_resources: "List MCP resources",
5087
4959
  read_mcp_resource: "Read MCP resource",
5088
4960
  cron_create: "Cron schedule",
@@ -5131,8 +5003,8 @@ var TOOL_INVOCATION_TITLES = {
5131
5003
  view_file_outline: "Outline",
5132
5004
  web_fetch: "Fetch",
5133
5005
  search_web: "Web",
5134
- spawn_agent: "Task",
5135
- wait_agent: "Task",
5006
+ spawn_agent: "Mason",
5007
+ wait_agent: "Mason",
5136
5008
  list_agents: "Agents",
5137
5009
  todo: "Todo",
5138
5010
  load_skill: "Skill",
@@ -5144,11 +5016,11 @@ var TOOL_INVOCATION_TITLES = {
5144
5016
  ask_user_question: "Question",
5145
5017
  enter_plan_mode: "Plan",
5146
5018
  exit_plan_mode: "Plan",
5147
- task_create: "Task",
5148
- task_list: "Task",
5149
- task_get: "Task",
5150
- task_update: "Task",
5151
- task_stop: "Task",
5019
+ task_create: "Mason",
5020
+ task_list: "Mason",
5021
+ task_get: "Mason",
5022
+ task_update: "Mason",
5023
+ task_stop: "Mason",
5152
5024
  list_mcp_resources: "MCP",
5153
5025
  read_mcp_resource: "MCP",
5154
5026
  cron_create: "Cron",
@@ -7388,6 +7260,10 @@ var globalContext = null;
7388
7260
  function initializeSkillContext(ctx) {
7389
7261
  globalContext = ctx;
7390
7262
  }
7263
+ function listAvailableSkills() {
7264
+ if (!globalContext?.skillLoader) return [];
7265
+ return globalContext.skillLoader.listAvailable();
7266
+ }
7391
7267
  async function loadSkill(args) {
7392
7268
  const { skill_name } = args;
7393
7269
  if (!skill_name || typeof skill_name !== "string") {
@@ -8521,7 +8397,9 @@ async function sendMessage(args) {
8521
8397
  error: `Worker session ${to} is ${workerSession.status}, cannot send follow-up`
8522
8398
  };
8523
8399
  }
8400
+ ensureMailbox(to);
8524
8401
  const messageId = sendFollowUp(to, process.env.BLUMA_SESSION_ID || "unknown", message2, waitForAck);
8402
+ sendSignal(to, "progress", { event: "new_message", messageId });
8525
8403
  if (waitForAck) {
8526
8404
  const ackResult = await waitForAckSignal(to, messageId, ackTimeout);
8527
8405
  if (!ackResult.acknowledged) {
@@ -15726,7 +15604,7 @@ var BluMaAgent = class {
15726
15604
  tool_name: toolName,
15727
15605
  arguments: toolArgs,
15728
15606
  preview: previewContent,
15729
- suppress_edit_diff_preview: false,
15607
+ suppress_edit_diff_preview: toolName === "edit_tool",
15730
15608
  tool_policy: this.buildToolPolicyForUi(toolName, toolArgs)
15731
15609
  });
15732
15610
  try {
@@ -18442,9 +18320,6 @@ function ChatTurnDuration({ durationMs }) {
18442
18320
  /* @__PURE__ */ jsx12(Text12, { color: BLUMA_TERMINAL.magenta, children: formatTurnDurationMs(durationMs) })
18443
18321
  ] }) });
18444
18322
  }
18445
- function TerminalRule({ width = 48 }) {
18446
- return /* @__PURE__ */ jsx12(Text12, { dimColor: true, children: "\u2500".repeat(Math.max(8, width)) });
18447
- }
18448
18323
 
18449
18324
  // src/app/ui/utils/expandablePreviewStore.ts
18450
18325
  var latest = null;
@@ -18721,10 +18596,10 @@ var ToolResultDisplayComponent = ({
18721
18596
  ] }) });
18722
18597
  }
18723
18598
  if (toolName.includes("spawn_agent") && parsed) {
18724
- return /* @__PURE__ */ jsx13(ResultGutter, { children: /* @__PURE__ */ jsx13(Text13, { dimColor: true, children: "Agent spawned" }) });
18599
+ return /* @__PURE__ */ jsx13(ResultGutter, { children: /* @__PURE__ */ jsx13(Text13, { dimColor: true, children: "Mason spawned" }) });
18725
18600
  }
18726
18601
  if (toolName.includes("wait_agent") && parsed) {
18727
- return /* @__PURE__ */ jsx13(ResultGutter, { children: /* @__PURE__ */ jsx13(Text13, { dimColor: true, children: "Waited for agent" }) });
18602
+ return /* @__PURE__ */ jsx13(ResultGutter, { children: /* @__PURE__ */ jsx13(Text13, { dimColor: true, children: "Waited for mason" }) });
18728
18603
  }
18729
18604
  if (toolName.includes("list_agents") && parsed) {
18730
18605
  return /* @__PURE__ */ jsx13(ResultGutter, { children: /* @__PURE__ */ jsx13(Text13, { dimColor: true, children: "Listed agents" }) });
@@ -19050,49 +18925,514 @@ var SessionInfoConnectingMCP = ({
19050
18925
  var SessionInfoConnectingMCP_default = SessionInfoConnectingMCP;
19051
18926
 
19052
18927
  // src/app/ui/components/SlashCommands.tsx
19053
- import { Box as Box17, Text as Text16 } from "ink";
19054
- import { useEffect as useEffect6, useRef as useRef4, useState as useState5 } from "react";
18928
+ import { Box as Box25, Text as Text24 } from "ink";
18929
+ import { useEffect as useEffect6, useRef as useRef4 } from "react";
19055
18930
 
19056
18931
  // src/app/ui/constants/historyLayout.ts
19057
18932
  var HEADER_PANEL_HISTORY_ID = 0;
19058
18933
 
19059
- // src/app/agent/runtime/session_view.ts
19060
- function isProcessAlive(pid) {
19061
- if (!pid || pid <= 0) return false;
19062
- try {
19063
- process.kill(pid, 0);
19064
- return true;
19065
- } catch {
19066
- return false;
18934
+ // src/app/ui/components/slash-commands/commandHelpers.tsx
18935
+ import { Box as Box17, Text as Text16 } from "ink";
18936
+
18937
+ // src/app/ui/components/slash-commands/constants.ts
18938
+ var COMMAND_HEADER_COLOR = BLUMA_TERMINAL.accent;
18939
+
18940
+ // src/app/ui/components/slash-commands/commandHelpers.tsx
18941
+ import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
18942
+ var outBox = (children) => /* @__PURE__ */ jsx18(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsx18(Box17, { paddingLeft: 1, flexDirection: "column", children }) });
18943
+ var usageBox = (title, body) => outBox(
18944
+ /* @__PURE__ */ jsxs16(Fragment6, { children: [
18945
+ /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: title }),
18946
+ /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: body })
18947
+ ] })
18948
+ );
18949
+
18950
+ // src/app/ui/components/SlashCommands.tsx
18951
+ init_runtime_config();
18952
+
18953
+ // src/app/ui/components/slash-commands/renderers/sessionRenderers.tsx
18954
+ import { Box as Box18, Text as Text17 } from "ink";
18955
+ init_session_registry();
18956
+ import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
18957
+ var renderSessionsSnapshot = () => {
18958
+ const sessions = listSessions();
18959
+ return outBox(
18960
+ /* @__PURE__ */ jsxs17(Fragment7, { children: [
18961
+ /* @__PURE__ */ jsxs17(Box18, { marginBottom: 1, children: [
18962
+ /* @__PURE__ */ jsx19(Text17, { bold: true, color: COMMAND_HEADER_COLOR, children: "Sessions" }),
18963
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
18964
+ " \xB7 ",
18965
+ sessions.length,
18966
+ " total"
18967
+ ] })
18968
+ ] }),
18969
+ /* @__PURE__ */ jsx19(Box18, { flexDirection: "column", children: sessions.length === 0 ? /* @__PURE__ */ jsx19(Text17, { dimColor: true, children: "No sessions registered." }) : sessions.map((session) => /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
18970
+ session.sessionId,
18971
+ " \xB7 ",
18972
+ session.status,
18973
+ " \xB7 ",
18974
+ session.pid || "n/a"
18975
+ ] }, session.sessionId)) })
18976
+ ] })
18977
+ );
18978
+ };
18979
+ var renderSessionStatus = (sessionId) => {
18980
+ const sessions = listSessions();
18981
+ const session = sessions.find((s) => s.sessionId === sessionId);
18982
+ if (!session) {
18983
+ return usageBox("Status", `Session not found: ${sessionId}`);
19067
18984
  }
19068
- }
19069
- function formatSessionLine(session) {
19070
- return `${session.sessionId} ${session.kind} ${session.status} ${session.updatedAt} ${session.title}`;
19071
- }
19072
- function formatLogLine(line) {
19073
- try {
19074
- const parsed = JSON.parse(line);
19075
- const ts = parsed.timestamp || (/* @__PURE__ */ new Date()).toISOString();
19076
- if (parsed.event_type === "log") {
19077
- return `[${ts}] ${String(parsed.level || "info").toUpperCase()} ${String(parsed.message || "")}`;
18985
+ return outBox(
18986
+ /* @__PURE__ */ jsxs17(Fragment7, { children: [
18987
+ /* @__PURE__ */ jsxs17(Box18, { marginBottom: 1, children: [
18988
+ /* @__PURE__ */ jsx19(Text17, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session Status" }),
18989
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
18990
+ " \xB7 ",
18991
+ session.sessionId
18992
+ ] })
18993
+ ] }),
18994
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
18995
+ "status: ",
18996
+ session.status
18997
+ ] }),
18998
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
18999
+ "started: ",
19000
+ new Date(session.startedAt).toISOString()
19001
+ ] }),
19002
+ session.updatedAt && /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19003
+ "updated: ",
19004
+ new Date(session.updatedAt).toISOString()
19005
+ ] }),
19006
+ session.pid && /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19007
+ "pid: ",
19008
+ session.pid
19009
+ ] })
19010
+ ] })
19011
+ );
19012
+ };
19013
+ var renderSessionLogs = (sessionId, lines = 20) => {
19014
+ const sessions = listSessions();
19015
+ const session = sessions.find((s) => s.sessionId === sessionId);
19016
+ if (!session) {
19017
+ return usageBox("Logs", `Session not found: ${sessionId}`);
19018
+ }
19019
+ const logLines = readSessionLog(sessionId);
19020
+ return outBox(
19021
+ /* @__PURE__ */ jsxs17(Fragment7, { children: [
19022
+ /* @__PURE__ */ jsxs17(Box18, { marginBottom: 1, children: [
19023
+ /* @__PURE__ */ jsx19(Text17, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session Logs" }),
19024
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19025
+ " \xB7 ",
19026
+ sessionId,
19027
+ " \xB7 last ",
19028
+ logLines.length,
19029
+ " lines"
19030
+ ] })
19031
+ ] }),
19032
+ /* @__PURE__ */ jsx19(Box18, { flexDirection: "column", children: logLines.map((line, i) => /* @__PURE__ */ jsx19(Text17, { dimColor: true, children: line }, i)) })
19033
+ ] })
19034
+ );
19035
+ };
19036
+ var renderAttachFollow = (action, sessionId) => {
19037
+ if (!sessionId) {
19038
+ return usageBox(action, `Usage: /${action} <session-id>`);
19039
+ }
19040
+ const sessions = listSessions();
19041
+ const session = sessions.find((s) => s.sessionId === sessionId);
19042
+ if (!session) {
19043
+ return usageBox(action, `Session not found: ${sessionId}`);
19044
+ }
19045
+ return outBox(
19046
+ /* @__PURE__ */ jsxs17(Fragment7, { children: [
19047
+ /* @__PURE__ */ jsxs17(Box18, { marginBottom: 1, children: [
19048
+ /* @__PURE__ */ jsx19(Text17, { bold: true, color: COMMAND_HEADER_COLOR, children: action === "attach" ? "Attach" : action === "follow" ? "Follow" : action === "kill" ? "Kill" : action === "resume" ? "Resume" : "Bridge" }),
19049
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19050
+ " \xB7 ",
19051
+ sessionId
19052
+ ] })
19053
+ ] }),
19054
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19055
+ "status: ",
19056
+ session.status
19057
+ ] }),
19058
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19059
+ "pid: ",
19060
+ session.pid || "n/a"
19061
+ ] }),
19062
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19063
+ "workspace: ",
19064
+ session.metadata?.workspaceRoot || "n/a"
19065
+ ] })
19066
+ ] })
19067
+ );
19068
+ };
19069
+ var renderKill = (sessionId) => renderAttachFollow("kill", sessionId);
19070
+ var renderResume = (sessionId) => renderAttachFollow("resume", sessionId);
19071
+ var renderAttach = (sessionId) => renderAttachFollow("attach", sessionId);
19072
+ var renderFollow = (sessionId) => renderAttachFollow("follow", sessionId);
19073
+ var renderBridgePanel = () => {
19074
+ const sessions = listSessions();
19075
+ const running = sessions.filter((session) => session.status === "running");
19076
+ return outBox(
19077
+ /* @__PURE__ */ jsxs17(Fragment7, { children: [
19078
+ /* @__PURE__ */ jsxs17(Box18, { marginBottom: 1, children: [
19079
+ /* @__PURE__ */ jsx19(Text17, { bold: true, color: COMMAND_HEADER_COLOR, children: "Bridge" }),
19080
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19081
+ " \xB7 ",
19082
+ sessions.length,
19083
+ " sessions"
19084
+ ] })
19085
+ ] }),
19086
+ /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19087
+ "running: ",
19088
+ running.length
19089
+ ] }),
19090
+ /* @__PURE__ */ jsx19(Text17, { dimColor: true, children: "attach: bluma attach <session-id>" }),
19091
+ /* @__PURE__ */ jsx19(Text17, { dimColor: true, children: "follow: bluma follow <session-id>" }),
19092
+ /* @__PURE__ */ jsx19(Text17, { dimColor: true, children: "logs: bluma logs <session-id>" }),
19093
+ /* @__PURE__ */ jsx19(Box18, { marginTop: 1, flexDirection: "column", children: sessions.slice(0, 8).map((session) => /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
19094
+ session.sessionId,
19095
+ " \xB7 ",
19096
+ session.status,
19097
+ " \xB7 ",
19098
+ session.pid || "n/a"
19099
+ ] }, session.sessionId)) })
19100
+ ] })
19101
+ );
19102
+ };
19103
+
19104
+ // src/app/ui/components/slash-commands/renderers/taskRenderers.tsx
19105
+ import { Box as Box19, Text as Text18 } from "ink";
19106
+ import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
19107
+ var renderMasonSnapshot = () => {
19108
+ const snapshot = buildTaskSnapshot();
19109
+ const stats = snapshot.stats;
19110
+ return outBox(
19111
+ /* @__PURE__ */ jsxs18(Fragment8, { children: [
19112
+ /* @__PURE__ */ jsxs18(Box19, { marginBottom: 1, children: [
19113
+ /* @__PURE__ */ jsx20(Text18, { bold: true, color: COMMAND_HEADER_COLOR, children: "Mason" }),
19114
+ /* @__PURE__ */ jsxs18(Text18, { dimColor: true, children: [
19115
+ " \xB7 ",
19116
+ stats.total,
19117
+ " total \xB7 ",
19118
+ stats.progress,
19119
+ "%"
19120
+ ] })
19121
+ ] }),
19122
+ snapshot.activeTask ? /* @__PURE__ */ jsxs18(Box19, { marginBottom: 1, flexDirection: "column", children: [
19123
+ /* @__PURE__ */ jsxs18(Text18, { dimColor: true, children: [
19124
+ "active ",
19125
+ snapshot.activeTask.mode,
19126
+ " \xB7 ",
19127
+ snapshot.activeTask.taskName
19128
+ ] }),
19129
+ /* @__PURE__ */ jsx20(Text18, { dimColor: true, children: snapshot.activeTask.status }),
19130
+ /* @__PURE__ */ jsx20(Text18, { dimColor: true, children: snapshot.activeTask.summary || "No summary." })
19131
+ ] }) : /* @__PURE__ */ jsx20(Text18, { dimColor: true, children: "No active task." }),
19132
+ /* @__PURE__ */ jsxs18(Box19, { flexDirection: "column", marginTop: 1, children: [
19133
+ snapshot.tasks.slice(0, 12).map((task) => {
19134
+ const done = task.status === "completed";
19135
+ const prefix = done ? "\u25A0" : task.status === "in_progress" ? "\u25A3" : "\u25A1";
19136
+ return /* @__PURE__ */ jsxs18(Text18, { dimColor: done, color: done ? void 0 : void 0, children: [
19137
+ prefix,
19138
+ " #",
19139
+ task.id,
19140
+ " ",
19141
+ task.description,
19142
+ " ",
19143
+ /* @__PURE__ */ jsxs18(Text18, { dimColor: true, children: [
19144
+ "(",
19145
+ task.priority,
19146
+ ")"
19147
+ ] })
19148
+ ] }, task.id);
19149
+ }),
19150
+ snapshot.tasks.length > 12 ? /* @__PURE__ */ jsxs18(Text18, { dimColor: true, children: [
19151
+ "\u2026 +",
19152
+ snapshot.tasks.length - 12,
19153
+ " more"
19154
+ ] }) : null
19155
+ ] })
19156
+ ] })
19157
+ );
19158
+ };
19159
+ var runTasksAdd = (agentRef, description, priority = "medium") => {
19160
+ updateTaskStore((state) => {
19161
+ const newId = state.tasks.length > 0 ? Math.max(...state.tasks.map((t) => t.id)) + 1 : 1;
19162
+ state.tasks.push({
19163
+ id: newId,
19164
+ description,
19165
+ priority,
19166
+ status: "pending",
19167
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
19168
+ });
19169
+ });
19170
+ if (agentRef.current) {
19171
+ agentRef.current.processTurn({ content: `/tasks add ${description}` }).catch(console.error);
19172
+ }
19173
+ return usageBox("Tasks", `Added task: ${description}`);
19174
+ };
19175
+ var runTasksComplete = (agentRef, id) => {
19176
+ updateTaskStore((state) => {
19177
+ const task = state.tasks.find((t) => t.id === id);
19178
+ if (task) {
19179
+ task.status = "completed";
19078
19180
  }
19079
- if (parsed.event_type === "backend_message") {
19080
- return `[${ts}] EVENT ${String(parsed.backend_type || "unknown")}`;
19181
+ });
19182
+ if (agentRef.current) {
19183
+ agentRef.current.processTurn({ content: `/tasks complete ${id}` }).catch(console.error);
19184
+ }
19185
+ return usageBox("Tasks", `Completed task #${id}`);
19186
+ };
19187
+ var runTasksUpdate = (agentRef, id, description, priority) => {
19188
+ updateTaskStore((state) => {
19189
+ const task = state.tasks.find((t) => t.id === id);
19190
+ if (task) {
19191
+ if (description) task.description = description;
19192
+ if (priority) task.priority = priority;
19081
19193
  }
19082
- if (parsed.event_type === "action_status") {
19083
- return `[${ts}] STATUS ${JSON.stringify(parsed.payload)}`;
19194
+ });
19195
+ if (agentRef.current) {
19196
+ agentRef.current.processTurn({ content: `/tasks update ${id} ${description}` }).catch(console.error);
19197
+ }
19198
+ return usageBox("Tasks", `Updated task #${id}`);
19199
+ };
19200
+ var runTasksRemove = (agentRef, id) => {
19201
+ updateTaskStore((state) => {
19202
+ state.tasks = state.tasks.filter((t) => t.id !== id);
19203
+ });
19204
+ if (agentRef.current) {
19205
+ agentRef.current.processTurn({ content: `/tasks remove ${id}` }).catch(console.error);
19206
+ }
19207
+ return usageBox("Tasks", `Removed task #${id}`);
19208
+ };
19209
+ var runTasksClear = (agentRef) => {
19210
+ updateTaskStore((state) => {
19211
+ state.tasks = [];
19212
+ });
19213
+ if (agentRef.current) {
19214
+ agentRef.current.processTurn({ content: `/tasks clear` }).catch(console.error);
19215
+ }
19216
+ return usageBox("Tasks", "Cleared all tasks");
19217
+ };
19218
+
19219
+ // src/app/ui/components/slash-commands/renderers/configRenderers.tsx
19220
+ import { Box as Box20, Text as Text19 } from "ink";
19221
+ init_runtime_config();
19222
+ init_sandbox_policy();
19223
+ import { Fragment as Fragment9, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
19224
+ var renderStatusline = () => {
19225
+ const cfg = getRuntimeConfig();
19226
+ const policy = getSandboxPolicy();
19227
+ const snapshot = buildTaskSnapshot();
19228
+ const parts = [
19229
+ `BluMa`,
19230
+ cfg.model,
19231
+ cfg.reasoningEffort,
19232
+ cfg.outputStyle,
19233
+ policy.isSandbox ? "sandbox" : "local",
19234
+ snapshot.activeTask ? snapshot.activeTask.taskName : "idle",
19235
+ `${snapshot.stats.completed}/${snapshot.stats.total}`
19236
+ ];
19237
+ return outBox(
19238
+ /* @__PURE__ */ jsxs19(Fragment9, { children: [
19239
+ /* @__PURE__ */ jsx21(Text19, { bold: true, color: COMMAND_HEADER_COLOR, children: "Statusline" }),
19240
+ /* @__PURE__ */ jsx21(Text19, { dimColor: true, children: parts.filter(Boolean).join(" \xB7 ") })
19241
+ ] })
19242
+ );
19243
+ };
19244
+ var renderModelConfig = (subcommand, rest) => {
19245
+ const cfg = getRuntimeConfig();
19246
+ if (!subcommand || subcommand === "show") {
19247
+ return outBox(
19248
+ /* @__PURE__ */ jsxs19(Fragment9, { children: [
19249
+ /* @__PURE__ */ jsxs19(Box20, { marginBottom: 1, children: [
19250
+ /* @__PURE__ */ jsx21(Text19, { bold: true, color: COMMAND_HEADER_COLOR, children: "Model" }),
19251
+ /* @__PURE__ */ jsxs19(Text19, { dimColor: true, children: [
19252
+ " \xB7 current: ",
19253
+ cfg.model
19254
+ ] })
19255
+ ] }),
19256
+ /* @__PURE__ */ jsx21(Text19, { dimColor: true, children: "Use: /model <name> or /model auto" })
19257
+ ] })
19258
+ );
19259
+ }
19260
+ if (subcommand === "list") {
19261
+ return usageBox("Model", "Available models: auto, gpt-4, claude-3, etc.");
19262
+ }
19263
+ const newModel = [subcommand, ...rest || []].join(" ");
19264
+ setRuntimeConfig({ model: newModel });
19265
+ return usageBox("Model", `Set model to: ${newModel}`);
19266
+ };
19267
+ var renderAgentConfig = (subcommand) => {
19268
+ const cfg = getRuntimeConfig();
19269
+ if (!subcommand) {
19270
+ return outBox(
19271
+ /* @__PURE__ */ jsxs19(Fragment9, { children: [
19272
+ /* @__PURE__ */ jsxs19(Box20, { marginBottom: 1, children: [
19273
+ /* @__PURE__ */ jsx21(Text19, { bold: true, color: COMMAND_HEADER_COLOR, children: "Agent" }),
19274
+ /* @__PURE__ */ jsxs19(Text19, { dimColor: true, children: [
19275
+ " \xB7 mode: ",
19276
+ cfg.agentMode
19277
+ ] })
19278
+ ] }),
19279
+ /* @__PURE__ */ jsx21(Text19, { dimColor: true, children: "Use: /agent [default|coordinator]" })
19280
+ ] })
19281
+ );
19282
+ }
19283
+ if (!["default", "coordinator"].includes(subcommand)) {
19284
+ return usageBox("Agent", "Valid modes: default, coordinator");
19285
+ }
19286
+ setRuntimeConfig({ agentMode: subcommand });
19287
+ return usageBox("Agent", `Set agent mode to: ${subcommand}`);
19288
+ };
19289
+ var renderFeatures = () => {
19290
+ const cfg = getRuntimeConfig();
19291
+ const features = cfg.features || {};
19292
+ return outBox(
19293
+ /* @__PURE__ */ jsxs19(Fragment9, { children: [
19294
+ /* @__PURE__ */ jsxs19(Box20, { marginBottom: 1, children: [
19295
+ /* @__PURE__ */ jsx21(Text19, { bold: true, color: COMMAND_HEADER_COLOR, children: "Features" }),
19296
+ /* @__PURE__ */ jsx21(Text19, { dimColor: true, children: " \xB7 runtime flags" })
19297
+ ] }),
19298
+ Object.keys(features).length === 0 ? /* @__PURE__ */ jsx21(Text19, { dimColor: true, children: "No features enabled." }) : Object.entries(features).map(([key, value]) => /* @__PURE__ */ jsxs19(Text19, { dimColor: true, children: [
19299
+ key,
19300
+ ": ",
19301
+ String(value)
19302
+ ] }, key))
19303
+ ] })
19304
+ );
19305
+ };
19306
+ var renderModelList = () => {
19307
+ return usageBox("Model", "Available models: auto, gpt-4, claude-3, etc.");
19308
+ };
19309
+ var runModelSet = (agentRef, model, setIsProcessing, markTurnStarted) => {
19310
+ setRuntimeConfig({ model });
19311
+ if (agentRef.current) {
19312
+ if (setIsProcessing && markTurnStarted) {
19313
+ setIsProcessing(true);
19314
+ markTurnStarted();
19084
19315
  }
19085
- if (parsed.event_type === "result") {
19086
- return `[${ts}] RESULT ${String(parsed.status || "success")}`;
19316
+ agentRef.current.processTurn({ content: `/model ${model}` }).catch(console.error);
19317
+ }
19318
+ return usageBox("Model", `Set model to: ${model}`);
19319
+ };
19320
+ var runEffortSet = (agentRef, effort, setIsProcessing, markTurnStarted) => {
19321
+ if (!["low", "medium", "high"].includes(effort)) {
19322
+ return usageBox("Effort", "Valid values: low, medium, high");
19323
+ }
19324
+ setRuntimeConfig({ reasoningEffort: effort });
19325
+ if (agentRef.current) {
19326
+ if (setIsProcessing && markTurnStarted) {
19327
+ setIsProcessing(true);
19328
+ markTurnStarted();
19087
19329
  }
19088
- } catch {
19330
+ agentRef.current.processTurn({ content: `/effort ${effort}` }).catch(console.error);
19089
19331
  }
19090
- return line;
19091
- }
19332
+ return usageBox("Effort", `Set effort to: ${effort}`);
19333
+ };
19334
+ var runStyleSet = (agentRef, style, setIsProcessing, markTurnStarted) => {
19335
+ if (!["concise", "balanced", "verbose"].includes(style)) {
19336
+ return usageBox("Style", "Valid values: concise, balanced, verbose");
19337
+ }
19338
+ setRuntimeConfig({ outputStyle: style });
19339
+ if (agentRef.current) {
19340
+ if (setIsProcessing && markTurnStarted) {
19341
+ setIsProcessing(true);
19342
+ markTurnStarted();
19343
+ }
19344
+ agentRef.current.processTurn({ content: `/style ${style}` }).catch(console.error);
19345
+ }
19346
+ return usageBox("Style", `Set style to: ${style}`);
19347
+ };
19348
+ var runSandboxSet = (agentRef, enabled, setIsProcessing, markTurnStarted) => {
19349
+ setRuntimeConfig({ sandboxEnabled: enabled });
19350
+ if (agentRef.current) {
19351
+ if (setIsProcessing && markTurnStarted) {
19352
+ setIsProcessing(true);
19353
+ markTurnStarted();
19354
+ }
19355
+ agentRef.current.processTurn({ content: `/sandbox ${enabled ? "on" : "off"}` }).catch(console.error);
19356
+ }
19357
+ return usageBox("Sandbox", `Sandbox ${enabled ? "enabled" : "disabled"}`);
19358
+ };
19359
+ var runWorktreeSet = (agentRef, path45, setIsProcessing, markTurnStarted) => {
19360
+ setRuntimeConfig({ workspaceRoot: path45 });
19361
+ if (agentRef.current) {
19362
+ if (setIsProcessing && markTurnStarted) {
19363
+ setIsProcessing(true);
19364
+ markTurnStarted();
19365
+ }
19366
+ agentRef.current.processTurn({ content: `/worktree ${path45}` }).catch(console.error);
19367
+ }
19368
+ return usageBox("Worktree", `Set worktree to: ${path45}`);
19369
+ };
19370
+ var runPermissionSet = (agentRef, mode, setIsProcessing, markTurnStarted) => {
19371
+ setRuntimeConfig({ permissionMode: mode });
19372
+ if (agentRef.current) {
19373
+ if (setIsProcessing && markTurnStarted) {
19374
+ setIsProcessing(true);
19375
+ markTurnStarted();
19376
+ }
19377
+ agentRef.current.processTurn({ content: `/permission ${mode}` }).catch(console.error);
19378
+ }
19379
+ return usageBox("Permission", `Set permission mode to: ${mode}`);
19380
+ };
19381
+ var runAgentSet = (agentRef, mode, setIsProcessing, markTurnStarted) => {
19382
+ if (!["default", "coordinator"].includes(mode)) {
19383
+ return usageBox("Agent", "Valid modes: default, coordinator");
19384
+ }
19385
+ setRuntimeConfig({ agentMode: mode });
19386
+ if (agentRef.current) {
19387
+ if (setIsProcessing && markTurnStarted) {
19388
+ setIsProcessing(true);
19389
+ markTurnStarted();
19390
+ }
19391
+ agentRef.current.processTurn({ content: `/agent ${mode}` }).catch(console.error);
19392
+ }
19393
+ return usageBox("Agent", `Set agent mode to: ${mode}`);
19394
+ };
19092
19395
 
19093
- // src/app/ui/components/SlashCommands.tsx
19094
- init_session_registry();
19396
+ // src/app/ui/components/slash-commands/renderers/permissionRenderers.tsx
19397
+ import { Box as Box21, Text as Text20 } from "ink";
19095
19398
  init_sandbox_policy();
19399
+ import { Fragment as Fragment10, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
19400
+ var renderPermissionsSnapshot = (toolName) => {
19401
+ const policy = getSandboxPolicy();
19402
+ const metadata = getAllNativeToolMetadata();
19403
+ return outBox(
19404
+ /* @__PURE__ */ jsxs20(Fragment10, { children: [
19405
+ /* @__PURE__ */ jsxs20(Box21, { marginBottom: 1, children: [
19406
+ /* @__PURE__ */ jsx22(Text20, { bold: true, color: COMMAND_HEADER_COLOR, children: "Permissions" }),
19407
+ /* @__PURE__ */ jsx22(Text20, { dimColor: true, children: " \xB7 sandbox policy" })
19408
+ ] }),
19409
+ /* @__PURE__ */ jsxs20(Text20, { dimColor: true, children: [
19410
+ "mode: ",
19411
+ policy.mode
19412
+ ] }),
19413
+ /* @__PURE__ */ jsxs20(Text20, { dimColor: true, children: [
19414
+ "workspace: ",
19415
+ policy.workspaceRoot
19416
+ ] }),
19417
+ /* @__PURE__ */ jsxs20(Box21, { marginTop: 1, flexDirection: "column", children: [
19418
+ /* @__PURE__ */ jsx22(Text20, { bold: true, color: COMMAND_HEADER_COLOR, children: "Native Tools" }),
19419
+ metadata.slice(0, 15).map((tool) => /* @__PURE__ */ jsxs20(Text20, { dimColor: true, children: [
19420
+ tool.name,
19421
+ " \xB7 ",
19422
+ tool.description || "no description"
19423
+ ] }, tool.name)),
19424
+ metadata.length > 15 && /* @__PURE__ */ jsxs20(Text20, { dimColor: true, children: [
19425
+ "\u2026 +",
19426
+ metadata.length - 15,
19427
+ " more"
19428
+ ] })
19429
+ ] })
19430
+ ] })
19431
+ );
19432
+ };
19433
+
19434
+ // src/app/ui/components/slash-commands/renderers/pluginRenderers.tsx
19435
+ import { Box as Box22, Text as Text21 } from "ink";
19096
19436
 
19097
19437
  // src/app/agent/runtime/diagnostics.ts
19098
19438
  init_runtime_config();
@@ -19145,975 +19485,612 @@ function buildDiagnosticsSnapshot(feedbackScore) {
19145
19485
  };
19146
19486
  }
19147
19487
 
19148
- // src/app/ui/components/SlashCommands.tsx
19149
- init_runtime_config();
19150
- import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
19151
- var COMMAND_HEADER_COLOR = BLUMA_TERMINAL.accent;
19152
- var RECOMMENDED_MODELS = [
19153
- "auto",
19154
- "auto"
19155
- ];
19156
- var SessionLivePanel = ({ sessionId, mode }) => {
19157
- const [session, setSession] = useState5(() => getSession(sessionId));
19158
- const [logs, setLogs] = useState5(() => readSessionLog(sessionId));
19159
- useEffect6(() => {
19160
- const sync = () => {
19161
- setSession(getSession(sessionId));
19162
- setLogs(readSessionLog(sessionId));
19163
- };
19164
- sync();
19165
- const interval = setInterval(sync, 1e3);
19166
- return () => clearInterval(interval);
19167
- }, [sessionId]);
19168
- if (!session) {
19169
- return /* @__PURE__ */ jsx18(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs16(Box17, { paddingLeft: 1, flexDirection: "column", children: [
19170
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: mode }),
19171
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19172
- "Unknown session: ",
19173
- sessionId
19174
- ] })
19175
- ] }) });
19176
- }
19177
- const alive = session.status === "running" ? isProcessAlive(session.pid) : false;
19178
- const recent = logs.slice(-16);
19179
- return /* @__PURE__ */ jsx18(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs16(Box17, { paddingLeft: 1, flexDirection: "column", children: [
19180
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19181
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: mode }),
19182
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19183
- " \xB7 ",
19184
- session.sessionId.slice(0, 8)
19488
+ // src/app/ui/components/slash-commands/renderers/pluginRenderers.tsx
19489
+ import { Fragment as Fragment11, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
19490
+ var renderPluginsSnapshot = () => {
19491
+ const plugins = listPlugins();
19492
+ const dirs = getPluginDirs();
19493
+ return outBox(
19494
+ /* @__PURE__ */ jsxs21(Fragment11, { children: [
19495
+ /* @__PURE__ */ jsxs21(Box22, { marginBottom: 1, children: [
19496
+ /* @__PURE__ */ jsx23(Text21, { bold: true, color: COMMAND_HEADER_COLOR, children: "Plugins" }),
19497
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19498
+ " \xB7 ",
19499
+ plugins.length,
19500
+ " installed"
19501
+ ] })
19502
+ ] }),
19503
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19504
+ "project: ",
19505
+ dirs.project
19185
19506
  ] }),
19186
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19507
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19508
+ "global: ",
19509
+ dirs.global
19510
+ ] }),
19511
+ /* @__PURE__ */ jsx23(Box22, { marginTop: 1, flexDirection: "column", children: plugins.length === 0 ? /* @__PURE__ */ jsx23(Text21, { dimColor: true, children: "No plugins installed." }) : plugins.slice(0, 12).map((plugin) => /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19512
+ plugin.name,
19187
19513
  " \xB7 ",
19188
- alive ? "live" : session.status
19189
- ] })
19190
- ] }),
19191
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: formatSessionLine(session) }),
19192
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19193
- "log: ",
19194
- session.logFile
19195
- ] }),
19196
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19197
- "bridge: bluma ",
19198
- mode,
19199
- " ",
19200
- session.sessionId
19201
- ] }),
19202
- /* @__PURE__ */ jsx18(Box17, { marginTop: 1, flexDirection: "column", children: recent.length === 0 ? /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No log entries yet." }) : recent.map((line, index) => /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: formatLogLine(line) }, `${session.sessionId}-${index}`)) })
19203
- ] }) });
19204
- };
19205
- var SlashCommands = ({
19206
- input,
19207
- setHistory,
19208
- agentRef
19209
- }) => {
19210
- const [cmd, ...args] = input.slice(1).trim().split(/\s+/);
19211
- const clearAppliedRef = useRef4(false);
19212
- const outBox = (children) => /* @__PURE__ */ jsx18(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsx18(Box17, { paddingLeft: 1, flexDirection: "column", children }) });
19213
- const usageBox = (title, body) => outBox(
19214
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19215
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: title }),
19216
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: body })
19514
+ plugin.source,
19515
+ " \xB7 ",
19516
+ plugin.manifest.version || "no version",
19517
+ " \xB7 ",
19518
+ plugin.manifest.description || "no description"
19519
+ ] }, plugin.name)) })
19217
19520
  ] })
19218
19521
  );
19219
- useEffect6(() => {
19220
- if ((cmd || "").toLowerCase() !== "clear" || clearAppliedRef.current) {
19221
- return;
19222
- }
19223
- clearAppliedRef.current = true;
19224
- setHistory((prev) => {
19225
- const header = prev.filter((item) => item.id === HEADER_PANEL_HISTORY_ID);
19226
- return [
19227
- ...header,
19228
- {
19229
- id: Date.now(),
19230
- component: outBox(
19231
- /* @__PURE__ */ jsxs16(Box17, { children: [
19232
- /* @__PURE__ */ jsx18(Text16, { color: "green", children: "[ok]" }),
19233
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " History cleared" })
19234
- ] })
19235
- )
19236
- }
19237
- ];
19238
- });
19239
- }, [cmd, input, setHistory]);
19240
- const showSessions = () => {
19241
- const sessions = listSessions();
19242
- if (sessions.length === 0) {
19243
- return usageBox("Sessions", "No sessions registered.");
19244
- }
19245
- return outBox(
19246
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19247
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19248
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Sessions" }),
19249
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19250
- " \xB7 ",
19251
- sessions.length,
19252
- " total"
19253
- ] })
19254
- ] }),
19255
- /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
19256
- sessions.slice(0, 12).map((session) => {
19257
- const alive = session.status === "running" ? isProcessAlive(session.pid) : false;
19258
- return /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", marginBottom: 1, children: [
19259
- /* @__PURE__ */ jsxs16(Text16, { color: BLUMA_TERMINAL.suggestion, bold: true, children: [
19260
- session.sessionId.slice(0, 8),
19261
- " ",
19262
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: alive ? "alive" : session.status })
19263
- ] }),
19264
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19265
- session.kind,
19266
- " \xB7 ",
19267
- session.updatedAt,
19268
- " \xB7 ",
19269
- session.title
19270
- ] }),
19271
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.workdir })
19272
- ] }, session.sessionId);
19273
- }),
19274
- sessions.length > 12 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19275
- "\u2026 +",
19276
- sessions.length - 12,
19277
- " more"
19278
- ] }) : null
19279
- ] })
19280
- ] })
19281
- );
19282
- };
19283
- const showSessionStatus = (sessionId) => {
19284
- const session = getSession(sessionId);
19285
- if (!session) {
19286
- return usageBox("Status", `Unknown session: ${sessionId}`);
19287
- }
19288
- const alive = session.status === "running" ? isProcessAlive(session.pid) : false;
19289
- return outBox(
19290
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19291
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session status" }),
19292
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.sessionId }),
19293
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19294
- session.kind,
19295
- " \xB7 ",
19296
- session.status,
19522
+ };
19523
+ var renderPluginDetails = (name) => {
19524
+ const plugin = getPlugin(name);
19525
+ if (!plugin) {
19526
+ return usageBox("Plugin", `Unknown plugin: ${name}`);
19527
+ }
19528
+ return outBox(
19529
+ /* @__PURE__ */ jsxs21(Fragment11, { children: [
19530
+ /* @__PURE__ */ jsxs21(Box22, { marginBottom: 1, children: [
19531
+ /* @__PURE__ */ jsx23(Text21, { bold: true, color: COMMAND_HEADER_COLOR, children: "Plugin" }),
19532
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19297
19533
  " \xB7 ",
19298
- alive ? "alive" : "offline"
19299
- ] }),
19300
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.updatedAt }),
19301
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.workdir }),
19302
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.title })
19303
- ] })
19304
- );
19305
- };
19306
- const showSessionLogs = (sessionId) => {
19307
- const session = getSession(sessionId);
19308
- if (!session) {
19309
- return usageBox("Logs", `Unknown session: ${sessionId}`);
19310
- }
19311
- const logs = readSessionLog(sessionId);
19312
- const recent = logs.slice(-10);
19313
- return outBox(
19314
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19315
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19316
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Logs" }),
19317
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19318
- " \xB7 ",
19319
- session.sessionId.slice(0, 8)
19320
- ] })
19321
- ] }),
19322
- recent.length === 0 ? /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No logs yet." }) : /* @__PURE__ */ jsx18(Box17, { flexDirection: "column", children: recent.map((line, i) => /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: formatLogLine(line) }, i)) })
19323
- ] })
19324
- );
19325
- };
19326
- const killSession2 = (sessionId) => {
19327
- const session = getSession(sessionId);
19328
- if (!session) {
19329
- return usageBox("Kill", `Unknown session: ${sessionId}`);
19330
- }
19331
- if (session.status !== "running") {
19332
- return usageBox("Kill", `Session ${sessionId} is already ${session.status}.`);
19333
- }
19334
- if (!session.pid || !isProcessAlive(session.pid)) {
19335
- updateSession(sessionId, {
19336
- status: "cancelled",
19337
- metadata: { ...session.metadata, signal: "stale-process" }
19338
- });
19339
- return usageBox("Kill", `Session ${sessionId} marked as cancelled.`);
19340
- }
19341
- try {
19342
- process.kill(session.pid, "SIGTERM");
19343
- updateSession(sessionId, {
19344
- status: "cancelled",
19345
- metadata: { ...session.metadata, signal: "SIGTERM" }
19346
- });
19347
- return usageBox("Kill", `Sent SIGTERM to ${sessionId} (${session.pid}).`);
19348
- } catch (error) {
19349
- return usageBox("Kill", `Failed to kill ${sessionId}: ${String(error?.message || error)}`);
19350
- }
19351
- };
19352
- const showResumeHint = (sessionId) => usageBox(
19353
- "Resume",
19354
- `Use the CLI command for now: bluma resume ${sessionId}.`
19355
- );
19356
- const renderTasksSnapshot = () => {
19357
- const snapshot = buildTaskSnapshot();
19358
- const stats = snapshot.stats;
19359
- return outBox(
19360
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19361
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19362
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Tasks" }),
19363
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19364
- " \xB7 ",
19365
- stats.total,
19366
- " total \xB7 ",
19367
- stats.progress,
19368
- "%"
19369
- ] })
19370
- ] }),
19371
- snapshot.activeTask ? /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, flexDirection: "column", children: [
19372
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19373
- "active ",
19374
- snapshot.activeTask.mode,
19375
- " \xB7 ",
19376
- snapshot.activeTask.taskName
19377
- ] }),
19378
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: snapshot.activeTask.status }),
19379
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: snapshot.activeTask.summary || "No summary." })
19380
- ] }) : /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No active task." }),
19381
- /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", marginTop: 1, children: [
19382
- snapshot.tasks.slice(0, 12).map((task) => {
19383
- const done = task.status === "completed";
19384
- const prefix = done ? "\u25A0" : task.status === "in_progress" ? "\u25A3" : "\u25A1";
19385
- return /* @__PURE__ */ jsxs16(Text16, { dimColor: done, color: done ? BLUMA_TERMINAL.muted : void 0, children: [
19386
- prefix,
19387
- " #",
19388
- task.id,
19389
- " ",
19390
- task.description,
19391
- " ",
19392
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19393
- "(",
19394
- task.priority,
19395
- ")"
19396
- ] })
19397
- ] }, task.id);
19398
- }),
19399
- snapshot.tasks.length > 12 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19400
- "\u2026 +",
19401
- snapshot.tasks.length - 12,
19402
- " more"
19403
- ] }) : null
19404
- ] })
19405
- ] })
19406
- );
19407
- };
19408
- const renderPermissionsSnapshot = (toolName) => {
19409
- const policy = getSandboxPolicy();
19410
- const metadata = getAllNativeToolMetadata();
19411
- const commandSafety = toolName ? assessCommandSafety(toolName, policy) : null;
19412
- const decision = toolName ? decideToolExecution(toolName) : null;
19413
- const rc = getRuntimeConfig();
19414
- return outBox(
19415
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19416
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19417
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Permissions" }),
19418
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19419
- " \xB7 ",
19420
- policy.isSandbox ? "sandbox" : "local"
19421
- ] })
19422
- ] }),
19423
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19424
- "runtime permission mode: ",
19425
- rc.permissionMode
19426
- ] }),
19427
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19428
- "agent mode: ",
19429
- rc.agentMode
19430
- ] }),
19431
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19432
- "workspace: ",
19433
- policy.workspaceRoot
19434
- ] }),
19435
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19436
- "mode: ",
19437
- policy.mode
19438
- ] }),
19439
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19440
- "native tools: ",
19441
- metadata.length
19442
- ] }),
19443
- toolName ? /* @__PURE__ */ jsxs16(Box17, { marginTop: 1, flexDirection: "column", children: [
19444
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: BLUMA_TERMINAL.suggestion, children: getToolDisplayLabel(toolName) }),
19445
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: decision ? decision.autoApprove ? "auto-approve" : "confirm" : "unknown" }),
19446
- decision?.reason ? /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: decision.reason }) : null,
19447
- commandSafety?.reason ? /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: commandSafety.reason }) : null
19448
- ] }) : /* @__PURE__ */ jsxs16(Box17, { marginTop: 1, flexDirection: "column", children: [
19449
- metadata.slice(0, 8).map((tool) => {
19450
- const decisionForTool = decideToolExecution(tool.name);
19451
- return /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19452
- getToolDisplayLabel(tool.name),
19453
- " \xB7 ",
19454
- tool.category,
19455
- " \xB7 ",
19456
- tool.riskLevel,
19457
- " \xB7",
19458
- " ",
19459
- decisionForTool.autoApprove ? "auto" : "confirm"
19460
- ] }, tool.name);
19461
- }),
19462
- metadata.length > 8 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19463
- "\u2026 +",
19464
- metadata.length - 8,
19465
- " more"
19466
- ] }) : null
19467
- ] })
19468
- ] })
19469
- );
19470
- };
19471
- const renderRuntimeConfig = () => {
19472
- const cfg = getRuntimeConfig();
19473
- return outBox(
19474
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19475
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19476
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Runtime" }),
19477
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \xB7 model / effort" })
19478
- ] }),
19479
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19480
- "model: ",
19481
- cfg.model
19482
- ] }),
19483
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19484
- "effort: ",
19485
- cfg.reasoningEffort
19486
- ] }),
19487
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19488
- "style: ",
19489
- cfg.outputStyle
19490
- ] }),
19491
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19492
- "permission mode: ",
19493
- cfg.permissionMode
19494
- ] }),
19495
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19496
- "agent mode: ",
19497
- cfg.agentMode
19498
- ] }),
19499
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19500
- "features:",
19501
- " ",
19502
- Object.keys(cfg.features || {}).length ? Object.entries(cfg.features || {}).map(([k, v]) => `${k}=${v}`).join(", ") : "(none)"
19503
- ] }),
19504
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19505
- "sandbox: ",
19506
- cfg.sandboxEnabled ? "on" : "off"
19507
- ] }),
19508
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19509
- "worktree: ",
19510
- cfg.workspaceRoot
19511
- ] }),
19512
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19513
- "settings: ",
19514
- getRuntimeConfigPath()
19515
- ] }),
19516
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19517
- "config: ",
19518
- cfg.updatedAt
19534
+ plugin.name
19519
19535
  ] })
19536
+ ] }),
19537
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19538
+ "source: ",
19539
+ plugin.source
19540
+ ] }),
19541
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19542
+ "root: ",
19543
+ plugin.root
19544
+ ] }),
19545
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19546
+ "manifest: ",
19547
+ plugin.manifestPath
19548
+ ] }),
19549
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19550
+ "version: ",
19551
+ plugin.manifest.version || "n/a"
19552
+ ] }),
19553
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19554
+ "entry: ",
19555
+ plugin.manifest.entry || "n/a"
19556
+ ] }),
19557
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19558
+ "description: ",
19559
+ plugin.manifest.description || "n/a"
19520
19560
  ] })
19521
- );
19522
- };
19523
- const renderStatusline = () => {
19524
- const cfg = getRuntimeConfig();
19525
- const policy = getSandboxPolicy();
19526
- const snapshot = buildTaskSnapshot();
19527
- const parts = [
19528
- `BluMa`,
19529
- cfg.model,
19530
- cfg.reasoningEffort,
19531
- cfg.outputStyle,
19532
- policy.isSandbox ? "sandbox" : "local",
19533
- snapshot.activeTask ? snapshot.activeTask.taskName : "idle",
19534
- `${snapshot.stats.completed}/${snapshot.stats.total}`
19535
- ];
19536
- return outBox(
19537
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19538
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Statusline" }),
19539
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: parts.filter(Boolean).join(" \xB7 ") })
19540
- ] })
19541
- );
19542
- };
19543
- const renderBridgePanel = () => {
19544
- const sessions = listSessions();
19545
- const running = sessions.filter((session) => session.status === "running");
19546
- return outBox(
19547
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19548
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19549
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Bridge" }),
19550
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19551
- " \xB7 ",
19552
- sessions.length,
19553
- " sessions"
19554
- ] })
19555
- ] }),
19556
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19557
- "current workspace: ",
19558
- getSandboxPolicy().workspaceRoot
19559
- ] }),
19560
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19561
- "running: ",
19562
- running.length
19563
- ] }),
19564
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "attach: bluma attach <session-id>" }),
19565
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "follow: bluma follow <session-id>" }),
19566
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "logs: bluma logs <session-id>" }),
19567
- /* @__PURE__ */ jsx18(Box17, { marginTop: 1, flexDirection: "column", children: sessions.slice(0, 8).map((session) => /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: formatSessionLine(session) }, session.sessionId)) })
19568
- ] })
19569
- );
19570
- };
19571
- const renderPlugins = () => {
19572
- const plugins = listPlugins();
19573
- const dirs = getPluginDirs();
19574
- return outBox(
19575
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19576
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19577
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Plugins" }),
19578
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19579
- " \xB7 ",
19580
- plugins.length,
19581
- " installed"
19582
- ] })
19583
- ] }),
19584
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19585
- "project: ",
19586
- dirs.project
19587
- ] }),
19588
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19589
- "global: ",
19590
- dirs.global
19591
- ] }),
19592
- /* @__PURE__ */ jsx18(Box17, { marginTop: 1, flexDirection: "column", children: plugins.length === 0 ? /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No plugins installed." }) : plugins.slice(0, 12).map((plugin) => /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19593
- plugin.name,
19594
- " \xB7 ",
19595
- plugin.source,
19596
- " \xB7 ",
19597
- plugin.manifest.version || "no version",
19598
- " \xB7 ",
19599
- plugin.manifest.description || "no description"
19600
- ] }, plugin.name)) })
19601
- ] })
19602
- );
19603
- };
19604
- const renderDiagnostics = () => {
19605
- const feedbackScore = agentRef.current?.getFeedbackScore?.();
19606
- const snapshot = buildDiagnosticsSnapshot(feedbackScore);
19607
- return outBox(
19608
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19609
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19610
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Diagnostics" }),
19611
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \xB7 health snapshot" })
19612
- ] }),
19613
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19614
- "model: ",
19615
- snapshot.runtime.model
19616
- ] }),
19617
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19618
- "effort: ",
19619
- snapshot.runtime.effort
19620
- ] }),
19621
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19622
- "style: ",
19623
- snapshot.runtime.style
19624
- ] }),
19625
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19626
- "permission: ",
19627
- snapshot.runtime.permissionMode
19628
- ] }),
19629
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19630
- "agent: ",
19631
- snapshot.runtime.agentMode
19632
- ] }),
19633
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19634
- "sandbox: ",
19635
- snapshot.runtime.sandbox
19636
- ] }),
19637
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19638
- "workspace: ",
19639
- snapshot.runtime.workspaceRoot
19640
- ] }),
19641
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19642
- "tasks: ",
19643
- snapshot.tasks.total,
19644
- " total \xB7 ",
19645
- snapshot.tasks.progress,
19646
- "% \xB7 active ",
19647
- snapshot.tasks.active || "none"
19648
- ] }),
19649
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19650
- "hooks: ",
19651
- snapshot.hooks.enabled ? "enabled" : "disabled",
19561
+ ] })
19562
+ );
19563
+ };
19564
+ var renderHooksSnapshot = () => {
19565
+ const state = getHookState();
19566
+ const recent = state.events.slice(-12).reverse();
19567
+ return outBox(
19568
+ /* @__PURE__ */ jsxs21(Fragment11, { children: [
19569
+ /* @__PURE__ */ jsxs21(Box22, { marginBottom: 1, children: [
19570
+ /* @__PURE__ */ jsx23(Text21, { bold: true, color: COMMAND_HEADER_COLOR, children: "Hooks" }),
19571
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19652
19572
  " \xB7 ",
19653
- snapshot.hooks.events,
19654
- "/",
19655
- snapshot.hooks.maxEvents
19656
- ] }),
19657
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19658
- "plugins: ",
19659
- snapshot.plugins.total,
19660
- " total \xB7 ",
19661
- snapshot.plugins.project,
19662
- " project \xB7 ",
19663
- snapshot.plugins.global,
19664
- " global"
19665
- ] }),
19666
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19667
- "sessions: ",
19668
- snapshot.sessions.total,
19669
- " total \xB7 ",
19670
- snapshot.sessions.running,
19671
- " running \xB7 ",
19672
- snapshot.sessions.completed,
19673
- " completed \xB7 ",
19674
- snapshot.sessions.cancelled,
19675
- " cancelled \xB7 ",
19676
- snapshot.sessions.error,
19677
- " error"
19678
- ] }),
19679
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19680
- "feedback: ",
19681
- typeof snapshot.feedbackScore === "number" ? snapshot.feedbackScore.toFixed(1) : "n/a"
19682
- ] })
19683
- ] })
19684
- );
19685
- };
19686
- const renderPluginDetails = (name) => {
19687
- const plugin = getPlugin(name);
19688
- if (!plugin) {
19689
- return usageBox("Plugin", `Unknown plugin: ${name}`);
19690
- }
19691
- return outBox(
19692
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19693
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19694
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Plugin" }),
19695
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19696
- " \xB7 ",
19697
- plugin.name
19698
- ] })
19699
- ] }),
19700
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19701
- "source: ",
19702
- plugin.source
19703
- ] }),
19704
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19705
- "root: ",
19706
- plugin.root
19707
- ] }),
19708
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19709
- "manifest: ",
19710
- plugin.manifestPath
19711
- ] }),
19712
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19713
- "version: ",
19714
- plugin.manifest.version || "n/a"
19715
- ] }),
19716
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19717
- "entry: ",
19718
- plugin.manifest.entry || "n/a"
19719
- ] }),
19720
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19721
- "description: ",
19722
- plugin.manifest.description || "n/a"
19573
+ state.enabled ? "enabled" : "disabled"
19723
19574
  ] })
19575
+ ] }),
19576
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19577
+ "state: ",
19578
+ getHookStatePath()
19579
+ ] }),
19580
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19581
+ "max events: ",
19582
+ state.maxEvents
19583
+ ] }),
19584
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19585
+ "stored: ",
19586
+ state.events.length
19587
+ ] }),
19588
+ /* @__PURE__ */ jsx23(Box22, { marginTop: 1, flexDirection: "column", children: recent.length === 0 ? /* @__PURE__ */ jsx23(Text21, { dimColor: true, children: "No hook events recorded yet." }) : recent.map((event) => /* @__PURE__ */ jsx23(Text21, { dimColor: true, children: formatHookEventLine(event) }, event.id)) })
19589
+ ] })
19590
+ );
19591
+ };
19592
+ var renderDiagnostics = (feedbackScore) => {
19593
+ const snapshot = buildDiagnosticsSnapshot(feedbackScore);
19594
+ return outBox(
19595
+ /* @__PURE__ */ jsxs21(Fragment11, { children: [
19596
+ /* @__PURE__ */ jsxs21(Box22, { marginBottom: 1, children: [
19597
+ /* @__PURE__ */ jsx23(Text21, { bold: true, color: COMMAND_HEADER_COLOR, children: "Diagnostics" }),
19598
+ /* @__PURE__ */ jsx23(Text21, { dimColor: true, children: " \xB7 health snapshot" })
19599
+ ] }),
19600
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19601
+ "model: ",
19602
+ snapshot.runtime.model
19603
+ ] }),
19604
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19605
+ "effort: ",
19606
+ snapshot.runtime.effort
19607
+ ] }),
19608
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19609
+ "style: ",
19610
+ snapshot.runtime.style
19611
+ ] }),
19612
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19613
+ "permission: ",
19614
+ snapshot.runtime.permissionMode
19615
+ ] }),
19616
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19617
+ "agent: ",
19618
+ snapshot.runtime.agentMode
19619
+ ] }),
19620
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19621
+ "sandbox: ",
19622
+ snapshot.runtime.sandbox
19623
+ ] }),
19624
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19625
+ "workspace: ",
19626
+ snapshot.runtime.workspaceRoot
19627
+ ] }),
19628
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19629
+ "mason: ",
19630
+ snapshot.tasks.total,
19631
+ " total \xB7 ",
19632
+ snapshot.tasks.progress,
19633
+ "% \xB7 active ",
19634
+ snapshot.tasks.active || "none"
19635
+ ] }),
19636
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19637
+ "hooks: ",
19638
+ snapshot.hooks.enabled ? "enabled" : "disabled",
19639
+ " \xB7 ",
19640
+ snapshot.hooks.events,
19641
+ "/",
19642
+ snapshot.hooks.maxEvents
19643
+ ] }),
19644
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19645
+ "plugins: ",
19646
+ snapshot.plugins.total,
19647
+ " total \xB7 ",
19648
+ snapshot.plugins.project,
19649
+ " project \xB7 ",
19650
+ snapshot.plugins.global,
19651
+ " global"
19652
+ ] }),
19653
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19654
+ "sessions: ",
19655
+ snapshot.sessions.total,
19656
+ " total \xB7 ",
19657
+ snapshot.sessions.running,
19658
+ " running \xB7 ",
19659
+ snapshot.sessions.completed,
19660
+ " completed \xB7 ",
19661
+ snapshot.sessions.cancelled,
19662
+ " cancelled \xB7 ",
19663
+ snapshot.sessions.error,
19664
+ " error"
19665
+ ] }),
19666
+ /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
19667
+ "feedback: ",
19668
+ typeof feedbackScore === "number" ? feedbackScore.toFixed(1) : "n/a"
19724
19669
  ] })
19725
- );
19726
- };
19727
- const renderHooks = () => {
19728
- const state = getHookState();
19729
- const recent = state.events.slice(-12).reverse();
19730
- return outBox(
19731
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19732
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19733
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Hooks" }),
19734
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19735
- " \xB7 ",
19736
- state.enabled ? "enabled" : "disabled"
19737
- ] })
19738
- ] }),
19739
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19740
- "state: ",
19741
- getHookStatePath()
19742
- ] }),
19743
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19744
- "max events: ",
19745
- state.maxEvents
19746
- ] }),
19747
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19748
- "stored: ",
19749
- state.events.length
19750
- ] }),
19751
- /* @__PURE__ */ jsx18(Box17, { marginTop: 1, flexDirection: "column", children: recent.length === 0 ? /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No hook events recorded yet." }) : recent.map((event) => /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: formatHookEventLine(event) }, event.id)) })
19752
- ] })
19753
- );
19754
- };
19755
- const runHooksCommand = (rest) => {
19756
- const sub = (rest[0] || "").toLowerCase();
19757
- if (!sub || sub === "list" || sub === "show") {
19758
- return renderHooks();
19759
- }
19760
- if (sub === "on") {
19761
- const next = setHookState({ enabled: true });
19762
- return usageBox("Hooks", `Hooks enabled (${next.events.length} stored events).`);
19763
- }
19764
- if (sub === "off") {
19765
- const next = setHookState({ enabled: false });
19766
- return usageBox("Hooks", `Hooks disabled (${next.events.length} stored events).`);
19767
- }
19768
- if (sub === "clear") {
19769
- const next = clearHookEvents();
19770
- return usageBox("Hooks", `Cleared hook events. ${next.events.length} remaining.`);
19670
+ ] })
19671
+ );
19672
+ };
19673
+ var runHooksOn = (agentRef, setIsProcessing, markTurnStarted) => {
19674
+ const state = getHookState();
19675
+ setHookState({ ...state, enabled: true });
19676
+ if (agentRef.current) {
19677
+ if (setIsProcessing && markTurnStarted) {
19678
+ setIsProcessing(true);
19679
+ markTurnStarted();
19771
19680
  }
19772
- if (sub === "max") {
19773
- const value = Number(rest[1]);
19774
- if (!Number.isFinite(value) || value <= 0) {
19775
- return usageBox("Hooks", "Usage: /hooks max <positive-number>");
19776
- }
19777
- const next = setHookState({ maxEvents: value });
19778
- return usageBox("Hooks", `Max events set to ${next.maxEvents}.`);
19681
+ agentRef.current.processTurn({ content: `/hooks on` }).catch(console.error);
19682
+ }
19683
+ return usageBox("Hooks", "Hooks enabled");
19684
+ };
19685
+ var runHooksOff = (agentRef, setIsProcessing, markTurnStarted) => {
19686
+ const state = getHookState();
19687
+ setHookState({ ...state, enabled: false });
19688
+ if (agentRef.current) {
19689
+ if (setIsProcessing && markTurnStarted) {
19690
+ setIsProcessing(true);
19691
+ markTurnStarted();
19779
19692
  }
19780
- return usageBox("Hooks", `Unknown subcommand: ${sub}`);
19781
- };
19782
- const runAttachCommand = (rest) => {
19783
- const sessionId = rest[0];
19784
- if (!sessionId) {
19785
- return usageBox("Attach", "Usage: /attach <session-id>");
19693
+ agentRef.current.processTurn({ content: `/hooks off` }).catch(console.error);
19694
+ }
19695
+ return usageBox("Hooks", "Hooks disabled");
19696
+ };
19697
+ var runHooksClear = (agentRef, setIsProcessing, markTurnStarted) => {
19698
+ clearHookEvents();
19699
+ if (agentRef.current) {
19700
+ if (setIsProcessing && markTurnStarted) {
19701
+ setIsProcessing(true);
19702
+ markTurnStarted();
19786
19703
  }
19787
- return /* @__PURE__ */ jsx18(SessionLivePanel, { sessionId, mode: "attach" });
19788
- };
19789
- const runFollowCommand = (rest) => {
19790
- const sessionId = rest[0];
19791
- if (!sessionId) {
19792
- return usageBox("Follow", "Usage: /follow <session-id>");
19704
+ agentRef.current.processTurn({ content: `/hooks clear` }).catch(console.error);
19705
+ }
19706
+ return usageBox("Hooks", "Hook events cleared");
19707
+ };
19708
+ var runHooksMax = (agentRef, max, setIsProcessing, markTurnStarted) => {
19709
+ const state = getHookState();
19710
+ setHookState({ ...state, maxEvents: max });
19711
+ if (agentRef.current) {
19712
+ if (setIsProcessing && markTurnStarted) {
19713
+ setIsProcessing(true);
19714
+ markTurnStarted();
19793
19715
  }
19794
- return /* @__PURE__ */ jsx18(SessionLivePanel, { sessionId, mode: "follow" });
19795
- };
19796
- const runPluginsCommand = (rest) => {
19797
- const sub = (rest[0] || "").toLowerCase();
19798
- if (!sub || sub === "list" || sub === "show") {
19799
- return renderPlugins();
19716
+ agentRef.current.processTurn({ content: `/hooks max ${max}` }).catch(console.error);
19717
+ }
19718
+ return usageBox("Hooks", `Max hook events set to: ${max}`);
19719
+ };
19720
+ var runPluginsRefresh = (agentRef, setIsProcessing, markTurnStarted) => {
19721
+ if (agentRef.current) {
19722
+ if (setIsProcessing && markTurnStarted) {
19723
+ setIsProcessing(true);
19724
+ markTurnStarted();
19800
19725
  }
19801
- if (sub === "refresh") {
19802
- return usageBox("Plugins", "Plugin registry is read on demand; list again to refresh.");
19726
+ agentRef.current.processTurn({ content: `/plugins refresh` }).catch(console.error);
19727
+ }
19728
+ return usageBox("Plugins", "Plugins refreshed");
19729
+ };
19730
+ var runPluginsPaths = (agentRef, paths, setIsProcessing, markTurnStarted) => {
19731
+ if (agentRef.current) {
19732
+ if (setIsProcessing && markTurnStarted) {
19733
+ setIsProcessing(true);
19734
+ markTurnStarted();
19803
19735
  }
19804
- if (sub === "paths") {
19805
- const dirs = getPluginDirs();
19806
- return outBox(
19807
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19808
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Plugin paths" }),
19809
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19810
- "project: ",
19811
- dirs.project
19812
- ] }),
19813
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19814
- "global: ",
19815
- dirs.global
19816
- ] })
19736
+ agentRef.current.processTurn({ content: `/plugins paths ${paths.join(" ")}` }).catch(console.error);
19737
+ }
19738
+ return usageBox("Plugins", `Plugin paths set: ${paths.join(", ")}`);
19739
+ };
19740
+
19741
+ // src/app/ui/components/slash-commands/renderers/infoRenderers.tsx
19742
+ import { Box as Box23, Text as Text22 } from "ink";
19743
+ import { Fragment as Fragment12, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
19744
+ var getMcpTools = () => [];
19745
+ var renderHelp = () => {
19746
+ const lines = formatSlashHelpLines();
19747
+ return outBox(
19748
+ /* @__PURE__ */ jsxs22(Fragment12, { children: [
19749
+ /* @__PURE__ */ jsxs22(Box23, { marginBottom: 1, children: [
19750
+ /* @__PURE__ */ jsx24(Text22, { bold: true, color: COMMAND_HEADER_COLOR, children: "Slash Commands" }),
19751
+ /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: " \xB7 grouped by category" })
19752
+ ] }),
19753
+ /* @__PURE__ */ jsx24(Box23, { flexDirection: "column", children: lines.map((line, i) => /* @__PURE__ */ jsx24(Text22, { dimColor: line === "", children: line === "" ? " " : line }, i)) })
19754
+ ] })
19755
+ );
19756
+ };
19757
+ var renderSkills = () => {
19758
+ const skills = listAvailableSkills();
19759
+ return outBox(
19760
+ /* @__PURE__ */ jsxs22(Fragment12, { children: [
19761
+ /* @__PURE__ */ jsxs22(Box23, { marginBottom: 1, children: [
19762
+ /* @__PURE__ */ jsx24(Text22, { bold: true, color: COMMAND_HEADER_COLOR, children: "Skills" }),
19763
+ /* @__PURE__ */ jsxs22(Text22, { dimColor: true, children: [
19764
+ " \xB7 ",
19765
+ skills.length,
19766
+ " available"
19817
19767
  ] })
19818
- );
19819
- }
19820
- return usageBox("Plugins", `Unknown subcommand: ${sub}`);
19821
- };
19822
- const runDiagnosticsCommand = (rest) => {
19823
- const sub = (rest[0] || "").toLowerCase();
19824
- if (!sub || sub === "show" || sub === "status") {
19825
- return renderDiagnostics();
19826
- }
19827
- if (sub === "help") {
19828
- return usageBox("Diagnostics", "Usage: /diagnostics [show|status]");
19829
- }
19830
- return usageBox("Diagnostics", `Unknown subcommand: ${sub}`);
19831
- };
19832
- const runTasksCommand = (subcommand, rest) => {
19833
- if (!subcommand || subcommand === "list") {
19834
- return renderTasksSnapshot();
19835
- }
19836
- if (subcommand === "add") {
19837
- const description = rest.join(" ").trim();
19838
- if (!description) {
19839
- return usageBox("Tasks", "Usage: /tasks add <description>");
19840
- }
19841
- updateTaskStore((state) => {
19842
- state.tasks.push({
19843
- id: state.nextId++,
19844
- description,
19845
- status: "pending",
19846
- priority: "medium",
19847
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
19848
- });
19849
- });
19850
- return renderTasksSnapshot();
19851
- }
19852
- if (subcommand === "complete") {
19853
- const id = Number(rest[0]);
19854
- if (!Number.isFinite(id)) {
19855
- return usageBox("Tasks", "Usage: /tasks complete <id>");
19856
- }
19857
- updateTaskStore((state) => {
19858
- const task = state.tasks.find((item) => item.id === id);
19859
- if (task) {
19860
- task.status = "completed";
19861
- task.completedAt = (/* @__PURE__ */ new Date()).toISOString();
19862
- }
19863
- });
19864
- return renderTasksSnapshot();
19865
- }
19866
- if (subcommand === "update") {
19867
- const id = Number(rest[0]);
19868
- const description = rest.slice(1).join(" ").trim();
19869
- if (!Number.isFinite(id) || !description) {
19870
- return usageBox("Tasks", "Usage: /tasks update <id> <description>");
19871
- }
19872
- updateTaskStore((state) => {
19873
- const task = state.tasks.find((item) => item.id === id);
19874
- if (task) {
19875
- task.description = description;
19876
- }
19877
- });
19878
- return renderTasksSnapshot();
19879
- }
19880
- if (subcommand === "remove") {
19881
- const id = Number(rest[0]);
19882
- if (!Number.isFinite(id)) {
19883
- return usageBox("Tasks", "Usage: /tasks remove <id>");
19884
- }
19885
- updateTaskStore((state) => {
19886
- state.tasks = state.tasks.filter((task) => task.id !== id);
19887
- });
19888
- return renderTasksSnapshot();
19889
- }
19890
- if (subcommand === "clear") {
19891
- updateTaskStore((state) => {
19892
- state.tasks = state.tasks.filter((task) => task.status !== "completed");
19893
- });
19894
- return renderTasksSnapshot();
19895
- }
19896
- if (subcommand === "sync") {
19897
- void (async () => {
19898
- const result = await todo({
19899
- action: "sync",
19900
- tasks: rest.length > 0 ? rest.join(" ").split("|").map((item) => ({ description: item.trim(), isComplete: false })) : []
19901
- });
19902
- setHistory((prev) => prev.concat({
19903
- id: Date.now(),
19904
- component: outBox(
19905
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: formatTodoResult(result) })
19906
- )
19907
- }));
19908
- })();
19909
- return usageBox("Tasks", "Syncing tasks...");
19910
- }
19911
- return usageBox("Tasks", `Unknown subcommand: ${subcommand}`);
19912
- };
19913
- const runPlanCommand = (subcommand, rest) => {
19914
- if (!subcommand || subcommand === "show") {
19915
- return renderTasksSnapshot();
19916
- }
19917
- if (subcommand === "start") {
19918
- const taskName = rest[0];
19919
- const summary = rest.slice(1).join(" ").trim();
19920
- if (!taskName) {
19921
- return usageBox("Plan", "Usage: /plan start <task-name> [summary]");
19922
- }
19923
- void (async () => {
19924
- const result = await taskBoundary({
19925
- task_name: taskName,
19926
- mode: "PLANNING",
19927
- task_status: "active",
19928
- task_summary: summary || `Planning ${taskName}`
19929
- });
19930
- setHistory((prev) => prev.concat({
19931
- id: Date.now(),
19932
- component: outBox(
19933
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19934
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: result.message }),
19935
- result.activeTask ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19936
- result.activeTask.mode,
19937
- " \xB7 ",
19938
- result.activeTask.taskName,
19939
- " \xB7 ",
19940
- result.activeTask.status
19941
- ] }) : null
19942
- ] })
19943
- )
19944
- }));
19945
- })();
19946
- return usageBox("Plan", `Starting plan: ${taskName}`);
19947
- }
19948
- if (subcommand === "end") {
19949
- void (async () => {
19950
- const result = await endTask();
19951
- setHistory((prev) => prev.concat({
19952
- id: Date.now(),
19953
- component: usageBox("Plan", result.message)
19954
- }));
19955
- })();
19956
- return usageBox("Plan", "Ending active plan...");
19957
- }
19958
- return usageBox("Plan", `Unknown subcommand: ${subcommand}`);
19959
- };
19960
- const runModelCommand = (rest) => {
19961
- const value = rest.join(" ").trim();
19962
- if (!value) {
19963
- return renderRuntimeConfig();
19964
- }
19965
- if (value.toLowerCase() === "list") {
19966
- return outBox(
19967
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19968
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19969
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Model picker" }),
19970
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \xB7 recommended" })
19971
- ] }),
19972
- /* @__PURE__ */ jsx18(Box17, { flexDirection: "column", children: RECOMMENDED_MODELS.map((model) => /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19973
- model === "auto" ? "current default" : "available",
19974
- " \xB7 ",
19975
- model
19976
- ] }, model)) })
19768
+ ] }),
19769
+ /* @__PURE__ */ jsx24(Box23, { flexDirection: "column", children: skills.length === 0 ? /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: "No skills available." }) : skills.map((skill) => /* @__PURE__ */ jsxs22(Text22, { dimColor: true, children: [
19770
+ skill.name,
19771
+ " \xB7 ",
19772
+ skill.source,
19773
+ " \xB7 ",
19774
+ skill.description || "no description"
19775
+ ] }, skill.name)) })
19776
+ ] })
19777
+ );
19778
+ };
19779
+ var renderMcp = (filter) => {
19780
+ const mcpTools = getMcpTools();
19781
+ const filtered = filter ? mcpTools.filter((t) => t.name?.toLowerCase().includes(filter.toLowerCase())) : mcpTools;
19782
+ return outBox(
19783
+ /* @__PURE__ */ jsxs22(Fragment12, { children: [
19784
+ /* @__PURE__ */ jsxs22(Box23, { marginBottom: 1, children: [
19785
+ /* @__PURE__ */ jsx24(Text22, { bold: true, color: COMMAND_HEADER_COLOR, children: "MCP Tools" }),
19786
+ /* @__PURE__ */ jsxs22(Text22, { dimColor: true, children: [
19787
+ " \xB7 ",
19788
+ filtered.length,
19789
+ " ",
19790
+ filter ? `matching "${filter}"` : "total"
19977
19791
  ] })
19978
- );
19979
- }
19980
- const next = setRuntimeConfig({ model: value });
19981
- return outBox(
19982
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19983
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Model" }),
19984
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19985
- "set to ",
19986
- next.model
19792
+ ] }),
19793
+ /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", children: [
19794
+ filtered.length === 0 ? /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: "No MCP tools found." }) : filtered.slice(0, 15).map((tool) => /* @__PURE__ */ jsxs22(Text22, { dimColor: true, children: [
19795
+ tool.name,
19796
+ " \xB7 ",
19797
+ tool.description || "no description"
19798
+ ] }, tool.name)),
19799
+ filtered.length > 15 && /* @__PURE__ */ jsxs22(Text22, { dimColor: true, children: [
19800
+ "\u2026 +",
19801
+ filtered.length - 15,
19802
+ " more"
19987
19803
  ] })
19988
19804
  ] })
19989
- );
19990
- };
19991
- const runEffortCommand = (rest) => {
19992
- const value = rest.join(" ").trim().toLowerCase();
19993
- if (!value) {
19994
- return renderRuntimeConfig();
19995
- }
19996
- if (!["low", "medium", "high"].includes(value)) {
19997
- return usageBox("Effort", "Usage: /effort [low|medium|high]");
19998
- }
19999
- const next = setRuntimeConfig({ reasoningEffort: value });
20000
- return outBox(
20001
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20002
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Effort" }),
20003
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20004
- "set to ",
20005
- next.reasoningEffort
19805
+ ] })
19806
+ );
19807
+ };
19808
+ var renderTools = (filter) => {
19809
+ const nativeTools = getAllNativeToolMetadata();
19810
+ const filtered = filter ? nativeTools.filter((t) => t.name.toLowerCase().includes(filter.toLowerCase())) : nativeTools;
19811
+ return outBox(
19812
+ /* @__PURE__ */ jsxs22(Fragment12, { children: [
19813
+ /* @__PURE__ */ jsxs22(Box23, { marginBottom: 1, children: [
19814
+ /* @__PURE__ */ jsx24(Text22, { bold: true, color: COMMAND_HEADER_COLOR, children: "Native Tools" }),
19815
+ /* @__PURE__ */ jsxs22(Text22, { dimColor: true, children: [
19816
+ " \xB7 ",
19817
+ filtered.length,
19818
+ " ",
19819
+ filter ? `matching "${filter}"` : "total"
20006
19820
  ] })
20007
- ] })
20008
- );
20009
- };
20010
- const runStyleCommand = (rest) => {
20011
- const value = rest.join(" ").trim().toLowerCase();
20012
- if (!value) {
20013
- return renderRuntimeConfig();
20014
- }
20015
- if (!["default", "compact", "brief"].includes(value)) {
20016
- return usageBox("Style", "Usage: /style [default|compact|brief]");
20017
- }
20018
- const next = setRuntimeConfig({ outputStyle: value });
20019
- return outBox(
20020
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20021
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Style" }),
20022
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20023
- "set to ",
20024
- next.outputStyle
19821
+ ] }),
19822
+ /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", children: [
19823
+ filtered.length === 0 ? /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: "No native tools found." }) : filtered.slice(0, 15).map((tool) => /* @__PURE__ */ jsxs22(Text22, { dimColor: true, children: [
19824
+ tool.name,
19825
+ " \xB7 ",
19826
+ tool.description || "no description"
19827
+ ] }, tool.name)),
19828
+ filtered.length > 15 && /* @__PURE__ */ jsxs22(Text22, { dimColor: true, children: [
19829
+ "\u2026 +",
19830
+ filtered.length - 15,
19831
+ " more"
20025
19832
  ] })
20026
19833
  ] })
20027
- );
20028
- };
20029
- const runSandboxCommand = (rest) => {
20030
- const value = rest.join(" ").trim().toLowerCase();
20031
- if (!value) {
20032
- return renderRuntimeConfig();
20033
- }
20034
- if (!["on", "off"].includes(value)) {
20035
- return usageBox("Sandbox", "Usage: /sandbox [on|off]");
20036
- }
20037
- const next = setRuntimeConfig({ sandboxEnabled: value === "on" });
19834
+ ] })
19835
+ );
19836
+ };
19837
+ var renderStats = () => {
19838
+ return outBox(
19839
+ /* @__PURE__ */ jsxs22(Fragment12, { children: [
19840
+ /* @__PURE__ */ jsxs22(Box23, { marginBottom: 1, children: [
19841
+ /* @__PURE__ */ jsx24(Text22, { bold: true, color: COMMAND_HEADER_COLOR, children: "Stats" }),
19842
+ /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: " \xB7 session statistics" })
19843
+ ] }),
19844
+ /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: "Use /stats for detailed statistics" })
19845
+ ] })
19846
+ );
19847
+ };
19848
+ var renderTheme = () => {
19849
+ return outBox(
19850
+ /* @__PURE__ */ jsxs22(Fragment12, { children: [
19851
+ /* @__PURE__ */ jsxs22(Box23, { marginBottom: 1, children: [
19852
+ /* @__PURE__ */ jsx24(Text22, { bold: true, color: COMMAND_HEADER_COLOR, children: "Theme" }),
19853
+ /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: " \xB7 current theme" })
19854
+ ] }),
19855
+ /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: "Use /theme to change theme" })
19856
+ ] })
19857
+ );
19858
+ };
19859
+ var renderAgents = () => {
19860
+ return outBox(
19861
+ /* @__PURE__ */ jsxs22(Fragment12, { children: [
19862
+ /* @__PURE__ */ jsxs22(Box23, { marginBottom: 1, children: [
19863
+ /* @__PURE__ */ jsx24(Text22, { bold: true, color: COMMAND_HEADER_COLOR, children: "Agents" }),
19864
+ /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: " \xB7 active agent sessions" })
19865
+ ] }),
19866
+ /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: "Use /agents to see active sessions" })
19867
+ ] })
19868
+ );
19869
+ };
19870
+ var renderDebugWorkers = () => {
19871
+ return outBox(
19872
+ /* @__PURE__ */ jsxs22(Fragment12, { children: [
19873
+ /* @__PURE__ */ jsxs22(Box23, { marginBottom: 1, children: [
19874
+ /* @__PURE__ */ jsx24(Text22, { bold: true, color: COMMAND_HEADER_COLOR, children: "Debug Workers" }),
19875
+ /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: " \xB7 worker debugging info" })
19876
+ ] }),
19877
+ /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: "Use /debug-workers to see worker status" })
19878
+ ] })
19879
+ );
19880
+ };
19881
+
19882
+ // src/app/ui/components/slash-commands/renderers/staticRenderers.tsx
19883
+ import { Text as Text23 } from "ink";
19884
+ import { Fragment as Fragment13, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
19885
+ var renderCompact = () => {
19886
+ return outBox(
19887
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19888
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Compact" }),
19889
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 manually compact conversation context" })
19890
+ ] })
19891
+ );
19892
+ };
19893
+ var renderCost = () => {
19894
+ return outBox(
19895
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19896
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Cost" }),
19897
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 show session cost and token usage" })
19898
+ ] })
19899
+ );
19900
+ };
19901
+ var renderExport = () => {
19902
+ return outBox(
19903
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19904
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Export" }),
19905
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 export conversation as markdown" })
19906
+ ] })
19907
+ );
19908
+ };
19909
+ var renderMemory = () => {
19910
+ return outBox(
19911
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19912
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Memory" }),
19913
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 manage session memories" })
19914
+ ] })
19915
+ );
19916
+ };
19917
+ var renderToken = () => {
19918
+ return outBox(
19919
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19920
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Token" }),
19921
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 show real-time token usage and budget" })
19922
+ ] })
19923
+ );
19924
+ };
19925
+ var renderHistory = () => {
19926
+ return outBox(
19927
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19928
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "History" }),
19929
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 show recent command history in this session" })
19930
+ ] })
19931
+ );
19932
+ };
19933
+ var renderAlias = (subcommand) => {
19934
+ if (!subcommand) {
20038
19935
  return outBox(
20039
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20040
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Sandbox" }),
20041
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: next.sandboxEnabled ? "on" : "off" })
19936
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19937
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Alias" }),
19938
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 create or manage command aliases" })
20042
19939
  ] })
20043
19940
  );
20044
- };
20045
- const runWorktreeCommand = (rest) => {
20046
- const value = rest.join(" ").trim();
20047
- if (!value) {
20048
- return renderRuntimeConfig();
19941
+ }
19942
+ return usageBox("Alias", `Usage: /alias [list|add|remove]`);
19943
+ };
19944
+ var renderCopy = () => {
19945
+ return outBox(
19946
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19947
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Copy" }),
19948
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 copy last output or selected text to clipboard" })
19949
+ ] })
19950
+ );
19951
+ };
19952
+ var renderTerminal = () => {
19953
+ return outBox(
19954
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19955
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Terminal" }),
19956
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 open interactive terminal session" })
19957
+ ] })
19958
+ );
19959
+ };
19960
+ var renderContext = () => {
19961
+ return outBox(
19962
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19963
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Context" }),
19964
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 inspect and manage current conversation context" })
19965
+ ] })
19966
+ );
19967
+ };
19968
+ var renderKeybindings = () => {
19969
+ return outBox(
19970
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19971
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Keybindings" }),
19972
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 show or configure keybindings" })
19973
+ ] })
19974
+ );
19975
+ };
19976
+ var renderVim = () => {
19977
+ return outBox(
19978
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19979
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Vim" }),
19980
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 toggle vim mode" })
19981
+ ] })
19982
+ );
19983
+ };
19984
+ var renderSettingsUnknown = () => {
19985
+ return usageBox("Settings", "Unknown setting. Use /settings to see available options.");
19986
+ };
19987
+ var renderSettingsEditUsage = () => {
19988
+ return usageBox("Settings", "Use /settings edit <key> <value> to modify settings.");
19989
+ };
19990
+ var renderChat = () => {
19991
+ return outBox(
19992
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
19993
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Chat" }),
19994
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 switch to conversational chat mode (no code execution)" })
19995
+ ] })
19996
+ );
19997
+ };
19998
+ var renderCode = () => {
19999
+ return outBox(
20000
+ /* @__PURE__ */ jsxs23(Fragment13, { children: [
20001
+ /* @__PURE__ */ jsx25(Text23, { bold: true, color: COMMAND_HEADER_COLOR, children: "Code" }),
20002
+ /* @__PURE__ */ jsx25(Text23, { dimColor: true, children: " \xB7 switch to code mode (agent can edit files and run commands)" })
20003
+ ] })
20004
+ );
20005
+ };
20006
+
20007
+ // src/app/ui/components/SlashCommands.tsx
20008
+ import { Fragment as Fragment14, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
20009
+ var SlashCommands = ({
20010
+ input,
20011
+ setHistory,
20012
+ agentRef,
20013
+ setIsProcessing,
20014
+ markTurnStarted
20015
+ }) => {
20016
+ const [cmd, ...args] = input.slice(1).trim().split(/\s+/);
20017
+ const clearAppliedRef = useRef4(false);
20018
+ const timerStartedRef = useRef4(false);
20019
+ useEffect6(() => {
20020
+ if (timerStartedRef.current) return;
20021
+ const agentCommands = /* @__PURE__ */ new Set([
20022
+ "commit",
20023
+ "pr",
20024
+ "release",
20025
+ "review",
20026
+ "bug",
20027
+ "debug",
20028
+ "fix",
20029
+ "refactor",
20030
+ "test",
20031
+ "optimize",
20032
+ "document",
20033
+ "summarize",
20034
+ "explain",
20035
+ "undo",
20036
+ "redo",
20037
+ "diff",
20038
+ "ctx",
20039
+ "snip",
20040
+ "dream",
20041
+ "collapse",
20042
+ "brief",
20043
+ "editor",
20044
+ "tasks",
20045
+ "model",
20046
+ "effort",
20047
+ "style",
20048
+ "sandbox",
20049
+ "worktree",
20050
+ "permissions",
20051
+ "agent",
20052
+ "hooks",
20053
+ "plugins"
20054
+ ]);
20055
+ if (cmd && agentCommands.has(cmd)) {
20056
+ timerStartedRef.current = true;
20057
+ if (setIsProcessing) setIsProcessing(true);
20058
+ if (markTurnStarted) markTurnStarted();
20059
+ }
20060
+ }, [cmd]);
20061
+ useEffect6(() => {
20062
+ if ((cmd || "").toLowerCase() !== "clear" || clearAppliedRef.current) {
20063
+ return;
20049
20064
  }
20050
- const next = setRuntimeConfig({ workspaceRoot: value });
20051
- return outBox(
20052
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20053
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Worktree" }),
20054
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: next.workspaceRoot })
20055
- ] })
20056
- );
20057
- };
20065
+ clearAppliedRef.current = true;
20066
+ setHistory((prev) => {
20067
+ const header = prev.filter((item) => item.id === HEADER_PANEL_HISTORY_ID);
20068
+ return [
20069
+ ...header,
20070
+ {
20071
+ id: Date.now(),
20072
+ component: outBox(
20073
+ /* @__PURE__ */ jsxs24(Box25, { children: [
20074
+ /* @__PURE__ */ jsx26(Text24, { color: "green", children: "[ok]" }),
20075
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: " History cleared" })
20076
+ ] })
20077
+ )
20078
+ }
20079
+ ];
20080
+ });
20081
+ }, [cmd, input, setHistory]);
20058
20082
  const render2 = () => {
20059
20083
  if (!cmd) {
20060
20084
  return null;
20061
20085
  }
20062
20086
  if (cmd === "help") {
20063
- const groups = getSlashCommandsByGroup();
20064
- return outBox(
20065
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20066
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
20067
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Slash commands \xB7 organized view" }),
20068
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20069
- " ",
20070
- "\xB7 type any command to execute; use /help",
20071
- " ",
20072
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: BLUMA_TERMINAL.suggestion, children: "<cmd>" }),
20073
- " ",
20074
- "for detail"
20075
- ] })
20076
- ] }),
20077
- /* @__PURE__ */ jsx18(TerminalRule, { width: 48 }),
20078
- /* @__PURE__ */ jsx18(Box17, { flexDirection: "column", marginTop: 1, children: groups.map((group) => /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, flexDirection: "column", children: [
20079
- /* @__PURE__ */ jsx18(Text16, { color: BLUMA_TERMINAL.suggestion, bold: true, children: group.label }),
20080
- /* @__PURE__ */ jsx18(Box17, { flexDirection: "column", marginTop: 0, children: group.commands.map((command) => /* @__PURE__ */ jsxs16(Box17, { flexDirection: "row", flexWrap: "wrap", children: [
20081
- /* @__PURE__ */ jsx18(Text16, { color: COMMAND_HEADER_COLOR, bold: true, children: command.name.padEnd(16, " ") }),
20082
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: command.description })
20083
- ] }, command.name)) })
20084
- ] }, group.category)) }),
20085
- /* @__PURE__ */ jsx18(TerminalRule, { width: 48 })
20086
- ] })
20087
- );
20087
+ return renderHelp();
20088
20088
  }
20089
20089
  if (cmd === "sessions") {
20090
- return showSessions();
20090
+ return renderSessionsSnapshot();
20091
20091
  }
20092
20092
  if (cmd === "agents") {
20093
- const entries = listSessions().filter((e) => e.kind === "agent");
20094
- if (entries.length === 0) {
20095
- return outBox(
20096
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20097
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Worker agents" }),
20098
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " No agent sessions in this CLI registry. Use the " }),
20099
- /* @__PURE__ */ jsx18(Text16, { bold: true, children: "spawn_agent" }),
20100
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " tool from chat, or " }),
20101
- /* @__PURE__ */ jsx18(Text16, { bold: true, children: "/agent coordinator" }),
20102
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " then ask the model to delegate." })
20103
- ] })
20104
- );
20105
- }
20106
- return outBox(
20107
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20108
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Worker agents" }),
20109
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20110
- " ",
20111
- entries.length,
20112
- " session(s)"
20113
- ] }),
20114
- /* @__PURE__ */ jsx18(Box17, { marginTop: 1, flexDirection: "column", children: entries.map((e) => /* @__PURE__ */ jsx18(Text16, { dimColor: true, wrap: "wrap", children: formatSessionLine(e) }, e.sessionId)) })
20115
- ] })
20116
- );
20093
+ return renderAgents();
20117
20094
  }
20118
20095
  if (cmd === "bridge") {
20119
20096
  return renderBridgePanel();
@@ -20123,23 +20100,41 @@ var SlashCommands = ({
20123
20100
  if (!sessionId) {
20124
20101
  return usageBox("Status", "Usage: /status <session-id>");
20125
20102
  }
20126
- return showSessionStatus(sessionId);
20103
+ return renderSessionStatus(sessionId);
20127
20104
  }
20128
20105
  if (cmd === "logs") {
20129
20106
  const sessionId = args[0];
20130
20107
  if (!sessionId) {
20131
20108
  return usageBox("Logs", "Usage: /logs <session-id>");
20132
20109
  }
20133
- return showSessionLogs(sessionId);
20110
+ return renderSessionLogs(sessionId);
20134
20111
  }
20135
20112
  if (cmd === "attach") {
20136
- return runAttachCommand(args);
20113
+ const sessionId = args[0];
20114
+ if (!sessionId) {
20115
+ return usageBox("Attach", "Usage: /attach <session-id>");
20116
+ }
20117
+ return renderAttach(sessionId);
20137
20118
  }
20138
20119
  if (cmd === "follow") {
20139
- return runFollowCommand(args);
20120
+ const sessionId = args[0];
20121
+ if (!sessionId) {
20122
+ return usageBox("Follow", "Usage: /follow <session-id>");
20123
+ }
20124
+ return renderFollow(sessionId);
20140
20125
  }
20141
20126
  if (cmd === "plugins") {
20142
- return runPluginsCommand(args);
20127
+ const sub = (args[0] || "").toLowerCase();
20128
+ if (!sub || sub === "list" || sub === "show") {
20129
+ return renderPluginsSnapshot();
20130
+ }
20131
+ if (sub === "refresh") {
20132
+ return runPluginsRefresh(agentRef);
20133
+ }
20134
+ if (sub === "paths") {
20135
+ return runPluginsPaths(agentRef, args.slice(1));
20136
+ }
20137
+ return usageBox("Plugins", `Unknown subcommand: ${sub}`);
20143
20138
  }
20144
20139
  if (cmd === "plugin") {
20145
20140
  const name = args[0];
@@ -20149,37 +20144,136 @@ var SlashCommands = ({
20149
20144
  return renderPluginDetails(name);
20150
20145
  }
20151
20146
  if (cmd === "diagnostics") {
20152
- return runDiagnosticsCommand(args);
20147
+ const sub = (args[0] || "").toLowerCase();
20148
+ if (!sub || sub === "show" || sub === "status") {
20149
+ return renderDiagnostics();
20150
+ }
20151
+ if (sub === "help") {
20152
+ return usageBox("Diagnostics", "Usage: /diagnostics [show|status]");
20153
+ }
20154
+ return usageBox("Diagnostics", `Unknown subcommand: ${sub}`);
20153
20155
  }
20154
20156
  if (cmd === "kill") {
20155
20157
  const sessionId = args[0];
20156
20158
  if (!sessionId) {
20157
20159
  return usageBox("Kill", "Usage: /kill <session-id>");
20158
20160
  }
20159
- return killSession2(sessionId);
20161
+ return renderKill(sessionId);
20160
20162
  }
20161
20163
  if (cmd === "resume") {
20162
20164
  const sessionId = args[0];
20163
20165
  if (!sessionId) {
20164
20166
  return usageBox("Resume", "Usage: /resume <session-id>");
20165
20167
  }
20166
- return showResumeHint(sessionId);
20168
+ return renderResume(sessionId);
20167
20169
  }
20168
20170
  if (cmd === "tasks") {
20169
- return runTasksCommand(args[0], args.slice(1));
20171
+ const subcommand = args[0];
20172
+ if (!subcommand || subcommand === "list") {
20173
+ return renderMasonSnapshot();
20174
+ }
20175
+ if (subcommand === "add") {
20176
+ const description = args.slice(1).join(" ").trim();
20177
+ if (!description) {
20178
+ return usageBox("Mason", "Usage: /tasks add <description>");
20179
+ }
20180
+ return runTasksAdd(agentRef, description);
20181
+ }
20182
+ if (subcommand === "complete") {
20183
+ const id = Number(args[1]);
20184
+ if (!Number.isFinite(id)) {
20185
+ return usageBox("Mason", "Usage: /tasks complete <id>");
20186
+ }
20187
+ return runTasksComplete(agentRef, id);
20188
+ }
20189
+ if (subcommand === "update") {
20190
+ const id = Number(args[1]);
20191
+ const description = args.slice(2).join(" ").trim();
20192
+ if (!Number.isFinite(id) || !description) {
20193
+ return usageBox("Mason", "Usage: /tasks update <id> <description>");
20194
+ }
20195
+ return runTasksUpdate(agentRef, id, description);
20196
+ }
20197
+ if (subcommand === "remove") {
20198
+ const id = Number(args[1]);
20199
+ if (!Number.isFinite(id)) {
20200
+ return usageBox("Mason", "Usage: /tasks remove <id>");
20201
+ }
20202
+ return runTasksRemove(agentRef, id);
20203
+ }
20204
+ if (subcommand === "clear") {
20205
+ return runTasksClear(agentRef);
20206
+ }
20207
+ if (subcommand === "sync") {
20208
+ void (async () => {
20209
+ const result = await todo({
20210
+ action: "sync",
20211
+ tasks: args.slice(1).length > 0 ? args.slice(1).join(" ").split("|").map((item) => ({ description: item.trim(), isComplete: false })) : []
20212
+ });
20213
+ setHistory((prev) => prev.concat({
20214
+ id: Date.now(),
20215
+ component: outBox(
20216
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: formatTodoResult(result) })
20217
+ )
20218
+ }));
20219
+ })();
20220
+ return usageBox("Mason", "Syncing tasks...");
20221
+ }
20222
+ return usageBox("Mason", `Unknown subcommand: ${subcommand}`);
20170
20223
  }
20171
20224
  if (cmd === "plan") {
20172
- return runPlanCommand(args[0], args.slice(1));
20225
+ const subcommand = args[0];
20226
+ if (!subcommand || subcommand === "show") {
20227
+ return renderMasonSnapshot();
20228
+ }
20229
+ if (subcommand === "start") {
20230
+ const taskName = args[1];
20231
+ const summary = args.slice(2).join(" ").trim();
20232
+ if (!taskName) {
20233
+ return usageBox("Plan", "Usage: /plan start <task-name> [summary]");
20234
+ }
20235
+ void (async () => {
20236
+ const result = await taskBoundary({
20237
+ task_name: taskName,
20238
+ mode: "PLANNING",
20239
+ task_status: "active",
20240
+ task_summary: summary || `Planning ${taskName}`
20241
+ });
20242
+ setHistory((prev) => prev.concat({
20243
+ id: Date.now(),
20244
+ component: outBox(
20245
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
20246
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: result.message }),
20247
+ result.activeTask ? /* @__PURE__ */ jsxs24(Text24, { dimColor: true, children: [
20248
+ result.activeTask.mode,
20249
+ " \xB7 ",
20250
+ result.activeTask.taskName,
20251
+ " \xB7 ",
20252
+ result.activeTask.status
20253
+ ] }) : null
20254
+ ] })
20255
+ )
20256
+ }));
20257
+ })();
20258
+ return usageBox("Plan", `Starting plan: ${taskName}`);
20259
+ }
20260
+ if (subcommand === "end") {
20261
+ void (async () => {
20262
+ const result = await endTask();
20263
+ setHistory((prev) => prev.concat({
20264
+ id: Date.now(),
20265
+ component: usageBox("Plan", result.message)
20266
+ }));
20267
+ })();
20268
+ return usageBox("Plan", "Ending active plan...");
20269
+ }
20270
+ return usageBox("Plan", `Unknown subcommand: ${subcommand}`);
20173
20271
  }
20174
20272
  if (cmd === "permissions") {
20175
20273
  const sub = (args[0] || "").toLowerCase();
20176
20274
  const modes = ["default", "plan", "accept_edits"];
20177
20275
  if (modes.includes(sub)) {
20178
- const next = setRuntimeConfig({ permissionMode: sub });
20179
- return usageBox(
20180
- "Permissions",
20181
- `permissionMode=${next.permissionMode} (system prompt refreshes on next BluMa start or /init).`
20182
- );
20276
+ return runPermissionSet(agentRef, sub);
20183
20277
  }
20184
20278
  return renderPermissionsSnapshot(args[0]);
20185
20279
  }
@@ -20187,19 +20281,9 @@ var SlashCommands = ({
20187
20281
  const sub = (args[0] || "").toLowerCase();
20188
20282
  const modes = ["default", "coordinator"];
20189
20283
  if (modes.includes(sub)) {
20190
- const next = setRuntimeConfig({ agentMode: sub });
20191
- return usageBox(
20192
- "Agent mode",
20193
- `agentMode=${next.agentMode} (restart session or /init for system prompt refresh).`
20194
- );
20284
+ return runAgentSet(agentRef, sub);
20195
20285
  }
20196
- const cfg = getRuntimeConfig();
20197
- return usageBox(
20198
- "Agent mode",
20199
- `current: ${cfg.agentMode}
20200
- set: /agent default | /agent coordinator
20201
- (list workers: /agents \u2014 not the same as /agent)`
20202
- );
20286
+ return renderAgentConfig();
20203
20287
  }
20204
20288
  if (cmd === "features") {
20205
20289
  const k = (args[0] || "").trim();
@@ -20210,85 +20294,79 @@ set: /agent default | /agent coordinator
20210
20294
  const cur = next.features[k];
20211
20295
  return usageBox("Features", `${k}=${cur} (also BLUMA_FEATURE_${k.toUpperCase()}=1)`);
20212
20296
  }
20213
- const cfg = getRuntimeConfig();
20214
- const keys = Object.keys(cfg.features || {});
20215
- const fromFile = keys.length > 0 ? keys.map((x) => ` ${x}: ${cfg.features[x]}`).join("\n") : " (none in settings.json)";
20216
- return usageBox(
20217
- "Features",
20218
- `${fromFile}
20219
- permission_ml effective: ${isFeatureEnabled("permission_ml")}
20220
- auto_dream effective: ${isFeatureEnabled("auto_dream")}
20221
- Usage: /features <key> on|off`
20222
- );
20297
+ return renderFeatures();
20223
20298
  }
20224
20299
  if (cmd === "model") {
20225
- return runModelCommand(args);
20300
+ const value = args.join(" ").trim();
20301
+ if (!value) {
20302
+ return renderModelConfig();
20303
+ }
20304
+ if (value.toLowerCase() === "list") {
20305
+ return renderModelList();
20306
+ }
20307
+ return runModelSet(agentRef, value);
20226
20308
  }
20227
20309
  if (cmd === "effort") {
20228
- return runEffortCommand(args);
20310
+ const value = args.join(" ").trim().toLowerCase();
20311
+ if (!value) {
20312
+ return renderModelConfig();
20313
+ }
20314
+ if (!["low", "medium", "high"].includes(value)) {
20315
+ return usageBox("Effort", "Usage: /effort [low|medium|high]");
20316
+ }
20317
+ return runEffortSet(agentRef, value);
20229
20318
  }
20230
20319
  if (cmd === "style") {
20231
- return runStyleCommand(args);
20320
+ const value = args.join(" ").trim().toLowerCase();
20321
+ if (!value) {
20322
+ return renderModelConfig();
20323
+ }
20324
+ if (!["default", "compact", "brief"].includes(value)) {
20325
+ return usageBox("Style", "Usage: /style [default|compact|brief]");
20326
+ }
20327
+ return runStyleSet(agentRef, value);
20232
20328
  }
20233
20329
  if (cmd === "sandbox") {
20234
- return runSandboxCommand(args);
20330
+ const value = args.join(" ").trim().toLowerCase();
20331
+ if (!value) {
20332
+ return renderModelConfig();
20333
+ }
20334
+ if (!["on", "off"].includes(value)) {
20335
+ return usageBox("Sandbox", "Usage: /sandbox [on|off]");
20336
+ }
20337
+ return runSandboxSet(agentRef, value === "on");
20235
20338
  }
20236
20339
  if (cmd === "worktree") {
20237
- return runWorktreeCommand(args);
20340
+ const value = args.join(" ").trim();
20341
+ if (!value) {
20342
+ return renderModelConfig();
20343
+ }
20344
+ return runWorktreeSet(agentRef, value);
20238
20345
  }
20239
20346
  if (cmd === "statusline") {
20240
20347
  return renderStatusline();
20241
20348
  }
20242
20349
  if (cmd === "hooks") {
20243
- return runHooksCommand(args);
20350
+ const sub = (args[0] || "").toLowerCase();
20351
+ if (!sub || sub === "list" || sub === "show") {
20352
+ return renderHooksSnapshot();
20353
+ }
20354
+ if (sub === "on") {
20355
+ return runHooksOn(agentRef);
20356
+ }
20357
+ if (sub === "off") {
20358
+ return runHooksOff(agentRef);
20359
+ }
20360
+ if (sub === "clear") {
20361
+ return runHooksClear(agentRef);
20362
+ }
20363
+ if (sub === "max") {
20364
+ return runHooksMax(agentRef, Number(args[1]));
20365
+ }
20366
+ return usageBox("Hooks", `Unknown subcommand: ${sub}`);
20244
20367
  }
20245
20368
  if (cmd === "skills") {
20246
- const list = agentRef.current?.listAvailableSkills?.() || [];
20247
- const dirs = agentRef.current?.getSkillsDirs?.();
20248
- const conflicts = agentRef.current?.getSkillConflictWarnings?.() || [];
20249
- return outBox(
20250
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20251
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
20252
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Skills (load_skill)" }),
20253
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20254
- " \xB7 ",
20255
- list.length,
20256
- " available"
20257
- ] })
20258
- ] }),
20259
- dirs ? /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, flexDirection: "column", children: [
20260
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20261
- "bundled: ",
20262
- String(dirs.bundled || "")
20263
- ] }),
20264
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20265
- "project: ",
20266
- String(dirs.project || "")
20267
- ] }),
20268
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20269
- "global: ",
20270
- String(dirs.global || "")
20271
- ] })
20272
- ] }) : null,
20273
- conflicts.length > 0 ? /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, flexDirection: "column", children: [
20274
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: BLUMA_TERMINAL.suggestion, children: "conflicts" }),
20275
- conflicts.slice(0, 6).map((warning, i) => /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: warning }, i)),
20276
- conflicts.length > 6 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20277
- "\u2026 +",
20278
- conflicts.length - 6,
20279
- " more"
20280
- ] }) : null
20281
- ] }) : null,
20282
- list.length === 0 ? /* @__PURE__ */ jsx18(Text16, { color: "yellow", children: "No skills found (check bundled dist/config/skills)." }) : /* @__PURE__ */ jsx18(Box17, { flexDirection: "column", children: list.map((s, i) => /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", marginBottom: 1, children: [
20283
- /* @__PURE__ */ jsx18(Text16, { color: BLUMA_TERMINAL.suggestion, bold: true, children: s.name }),
20284
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20285
- s.source,
20286
- " \u2014 ",
20287
- s.description || "\u2014"
20288
- ] })
20289
- ] }, i)) })
20290
- ] })
20291
- );
20369
+ return renderSkills();
20292
20370
  }
20293
20371
  if (cmd === "clear") {
20294
20372
  return null;
@@ -20297,288 +20375,39 @@ Usage: /features <key> on|off`
20297
20375
  return null;
20298
20376
  }
20299
20377
  if (cmd === "mcp") {
20300
- const all = agentRef.current?.getUiToolsDetailed?.() || agentRef.current?.getAvailableTools?.() || [];
20301
- const isMcp = (t) => t.source?.toLowerCase?.() === "mcp" || !!t.server && t.server !== "native";
20302
- const tools = all.filter(isMcp);
20303
20378
  const term = (args?.[0] || "").toLowerCase();
20304
- const filtered = term ? tools.filter((t) => (t.function?.name || t.name || "tool").toLowerCase().includes(term)) : tools;
20305
- const pad = (s, n) => s.length >= n ? s.slice(0, n - 1) + "\u2026" : s.padEnd(n, " ");
20306
- const colName = 34;
20307
- const colType = 10;
20308
- const colSource = 18;
20309
- return outBox(
20310
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20311
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
20312
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "MCP Tools" }),
20313
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 " }),
20314
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20315
- tools.length,
20316
- " total"
20317
- ] }),
20318
- term && /* @__PURE__ */ jsxs16(Fragment6, { children: [
20319
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 filter: " }),
20320
- /* @__PURE__ */ jsxs16(Text16, { color: BLUMA_TERMINAL.suggestion, children: [
20321
- '"',
20322
- term,
20323
- '"'
20324
- ] }),
20325
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20326
- " \u2022 showing: ",
20327
- filtered.length
20328
- ] })
20329
- ] })
20330
- ] }),
20331
- filtered.length === 0 ? /* @__PURE__ */ jsx18(Text16, { color: "yellow", children: "No MCP tools found" }) : /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
20332
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
20333
- pad("Name", colName),
20334
- " \u2502 ",
20335
- pad("Type", colType),
20336
- " \u2502 ",
20337
- pad("Source", colSource)
20338
- ] }) }),
20339
- /* @__PURE__ */ jsx18(Text16, { color: "gray", children: "\u2500".repeat(colName + colType + colSource + 6) }),
20340
- filtered.map((t, i) => {
20341
- const name = t.function?.name || t.name || "tool";
20342
- const type = t.function?.name ? "fn" : t.type || "tool";
20343
- const source = t.source || t.provider || "mcp";
20344
- return /* @__PURE__ */ jsxs16(Text16, { color: "white", children: [
20345
- pad(name, colName),
20346
- " \u2502 ",
20347
- pad(String(type), colType),
20348
- " \u2502 ",
20349
- pad(String(source), colSource)
20350
- ] }, i);
20351
- })
20352
- ] })
20353
- ] })
20354
- );
20379
+ return renderMcp(term);
20355
20380
  }
20356
20381
  if (cmd === "tools") {
20357
- const all = agentRef.current?.getUiToolsDetailed?.() || agentRef.current?.getAvailableTools?.() || [];
20358
- const isMcp = (t) => t.source?.toLowerCase?.() === "mcp" || !!t.server && t.server !== "native";
20359
- const tools = all.filter((t) => !isMcp(t));
20360
20382
  const term = (args?.[0] || "").toLowerCase();
20361
- const filtered = term ? tools.filter((t) => (t.function?.name || t.name || "tool").toLowerCase().includes(term)) : tools;
20362
- const pad = (s, n) => s.length >= n ? s.slice(0, n - 1) + "\u2026" : s.padEnd(n, " ");
20363
- const colName = 34;
20364
- const colType = 10;
20365
- const colSource = 18;
20366
- return outBox(
20367
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20368
- /* @__PURE__ */ jsx18(Text16, { color: COMMAND_HEADER_COLOR, bold: true, children: "Native Tools" }),
20369
- /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
20370
- "Total Native: ",
20371
- tools.length,
20372
- term ? ` | Filter: "${term}" | Showing: ${filtered.length}` : ""
20373
- ] }),
20374
- filtered.length === 0 ? /* @__PURE__ */ jsx18(Text16, { color: "yellow", children: "No native tools to display." }) : /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
20375
- /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
20376
- pad("Name", colName),
20377
- " | ",
20378
- pad("Type", colType),
20379
- " | ",
20380
- pad("Source", colSource)
20381
- ] }),
20382
- /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
20383
- "".padEnd(colName, "-"),
20384
- "---",
20385
- "".padEnd(colType, "-"),
20386
- "---",
20387
- "".padEnd(colSource, "-")
20388
- ] }),
20389
- filtered.map((t, i) => {
20390
- const name = t.function?.name || t.name || "tool";
20391
- const type = t.function?.name ? "fn" : t.type || "tool";
20392
- const source = t.source || "native";
20393
- return /* @__PURE__ */ jsxs16(Text16, { color: "white", children: [
20394
- pad(name, colName),
20395
- " | ",
20396
- pad(String(type), colType),
20397
- " | ",
20398
- pad(String(source), colSource)
20399
- ] }, i);
20400
- })
20401
- ] })
20402
- ] })
20403
- );
20383
+ return renderTools(term);
20404
20384
  }
20405
20385
  if (cmd === "debug-workers") {
20406
- const agents = agentRef.current?.agents || [];
20407
- const running = agents.filter((a) => a.status === "running");
20408
- const completed = agents.filter((a) => a.status === "completed");
20409
- const errored = agents.filter((a) => a.status === "error");
20410
- return outBox(
20411
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20412
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Debug Workers" }),
20413
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20414
- "Total: ",
20415
- agents.length,
20416
- " | Running: ",
20417
- running.length,
20418
- " | Completed: ",
20419
- completed.length,
20420
- " | Errors: ",
20421
- errored.length
20422
- ] }),
20423
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20424
- "Memory: ",
20425
- Math.round(process.memoryUsage().heapUsed / 1024 / 1024),
20426
- "MB heap"
20427
- ] }),
20428
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "EventBus listeners: N/A" }),
20429
- running.length > 0 && /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", marginTop: 1, children: [
20430
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: "green", children: "Running Workers:" }),
20431
- running.map((w) => /* @__PURE__ */ jsxs16(Text16, { color: "white", children: [
20432
- w.session_id.slice(0, 8),
20433
- "... ",
20434
- w.title,
20435
- " (PID: ",
20436
- w.pid || "N/A",
20437
- ")"
20438
- ] }, w.session_id))
20439
- ] })
20440
- ] })
20441
- );
20386
+ return renderDebugWorkers();
20442
20387
  }
20443
20388
  if (cmd === "compact") {
20444
- return outBox(
20445
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20446
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Context Compaction" }),
20447
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Auto-compact triggers at 180k tokens (threshold: 150k micro, 180k full)" }),
20448
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Target after compact: 100k tokens" }),
20449
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /compact to manually trigger context compaction." })
20450
- ] })
20451
- );
20389
+ return renderCompact();
20452
20390
  }
20453
20391
  if (cmd === "cost") {
20454
- return outBox(
20455
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20456
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session Cost" }),
20457
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Cost tracking is available via /stats for detailed session statistics." })
20458
- ] })
20459
- );
20392
+ return renderCost();
20460
20393
  }
20461
20394
  if (cmd === "export") {
20462
- return outBox(
20463
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20464
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Export Session" }),
20465
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Session logs are stored in ~/.bluma/sessions/" }),
20466
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /logs to view recent logs for a session." })
20467
- ] })
20468
- );
20395
+ return renderExport();
20469
20396
  }
20470
20397
  if (cmd === "memory") {
20471
- return outBox(
20472
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20473
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session Memory" }),
20474
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Memories are auto-extracted from conversations and stored in ~/.bluma/session_memory.json" }),
20475
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Relevant memories are injected into context automatically." })
20476
- ] })
20477
- );
20398
+ return renderMemory();
20478
20399
  }
20479
20400
  if (cmd === "stats") {
20480
- const mem = process.memoryUsage();
20481
- return outBox(
20482
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20483
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session Statistics" }),
20484
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20485
- "Heap: ",
20486
- Math.round(mem.heapUsed / 1024 / 1024),
20487
- "MB / ",
20488
- Math.round(mem.heapTotal / 1024 / 1024),
20489
- "MB"
20490
- ] }),
20491
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20492
- "RSS: ",
20493
- Math.round(mem.rss / 1024 / 1024),
20494
- "MB"
20495
- ] }),
20496
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20497
- "Uptime: ",
20498
- Math.round(process.uptime()),
20499
- "s"
20500
- ] }),
20501
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20502
- "Node: ",
20503
- process.version
20504
- ] }),
20505
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20506
- "Platform: ",
20507
- process.platform,
20508
- " (",
20509
- process.arch,
20510
- ")"
20511
- ] })
20512
- ] })
20513
- );
20401
+ return renderStats();
20514
20402
  }
20515
20403
  if (cmd === "theme") {
20516
- const themesModule = (init_themes(), __toCommonJS(themes_exports));
20517
- const themes = themesModule.listThemes();
20518
- const currentTheme = args[0];
20519
- if (currentTheme) {
20520
- const theme = themesModule.getTheme(currentTheme.toLowerCase().replace(/\s+/g, "_"));
20521
- if (!theme) {
20522
- return usageBox("Theme", `Unknown theme: ${currentTheme}. Available: ${themes.map((t) => t.name).join(", ")}`);
20523
- }
20524
- return outBox(
20525
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20526
- /* @__PURE__ */ jsxs16(Text16, { bold: true, color: "green", children: [
20527
- "Theme set to: ",
20528
- theme.name
20529
- ] }),
20530
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20531
- "Background: ",
20532
- theme.colors.background
20533
- ] }),
20534
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20535
- "Foreground: ",
20536
- theme.colors.foreground
20537
- ] }),
20538
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20539
- "Accent: ",
20540
- theme.colors.accent
20541
- ] })
20542
- ] })
20543
- );
20544
- }
20545
- return outBox(
20546
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20547
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Available Themes" }),
20548
- themes.map((t) => /* @__PURE__ */ jsxs16(Text16, { color: "white", children: [
20549
- " ",
20550
- t.name,
20551
- " \u2014 ",
20552
- t.description
20553
- ] }, t.name))
20554
- ] })
20555
- );
20404
+ return renderTheme();
20556
20405
  }
20557
20406
  if (cmd === "keybindings") {
20558
- return outBox(
20559
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20560
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Keybindings" }),
20561
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Custom keybindings are configured in ~/.bluma/settings.json" }),
20562
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " Ctrl+V / Cmd+V \u2014 Paste image or text" }),
20563
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " Ctrl+Shift+I \u2014 Paste image" }),
20564
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " Escape \u2014 Cancel / exit vim mode" }),
20565
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " : \u2014 Enter vim command mode" })
20566
- ] })
20567
- );
20407
+ return renderKeybindings();
20568
20408
  }
20569
20409
  if (cmd === "vim") {
20570
- return outBox(
20571
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20572
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Vim Mode" }),
20573
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Vim mode provides normal/insert/command modes." }),
20574
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " Escape \u2014 Switch to normal mode" }),
20575
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " i/a/o \u2014 Switch to insert mode" }),
20576
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " : \u2014 Enter command mode" }),
20577
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " h/j/k/l \u2014 Basic motions" }),
20578
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " w/b \u2014 Word motions" }),
20579
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " d/c/y \u2014 Delete/change/yank operators" })
20580
- ] })
20581
- );
20410
+ return renderVim();
20582
20411
  }
20583
20412
  if (cmd === "commit") {
20584
20413
  (async () => {
@@ -20630,7 +20459,7 @@ Report the commit hash and summary when done.`;
20630
20459
  setHistory((prev) => prev.concat({
20631
20460
  id: Date.now(),
20632
20461
  component: outBox(
20633
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20462
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
20634
20463
  "Failed to execute /commit: ",
20635
20464
  e?.message || String(e)
20636
20465
  ] }) })
@@ -20724,7 +20553,7 @@ Report the PR URL, number, title, and summary when done.`;
20724
20553
  setHistory((prev) => prev.concat({
20725
20554
  id: Date.now(),
20726
20555
  component: outBox(
20727
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20556
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
20728
20557
  "Failed to execute /pr: ",
20729
20558
  e?.message || String(e)
20730
20559
  ] }) })
@@ -20885,7 +20714,7 @@ Report the release version, tag, changelog summary, and verification results whe
20885
20714
  setHistory((prev) => prev.concat({
20886
20715
  id: Date.now(),
20887
20716
  component: outBox(
20888
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20717
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
20889
20718
  "Failed to execute /release: ",
20890
20719
  e?.message || String(e)
20891
20720
  ] }) })
@@ -20896,18 +20725,18 @@ Report the release version, tag, changelog summary, and verification results whe
20896
20725
  const bumpType = args.find((a) => ["major", "minor", "patch", "premajor", "preminor", "prepatch", "prerelease"].includes(a)) || "auto-detect";
20897
20726
  const dryRun = args.includes("--dry-run") || args.includes("--dryrun");
20898
20727
  return outBox(
20899
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20900
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
20901
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Release" }),
20902
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20728
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
20729
+ /* @__PURE__ */ jsxs24(Box25, { marginBottom: 1, children: [
20730
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "Release" }),
20731
+ /* @__PURE__ */ jsxs24(Text24, { dimColor: true, children: [
20903
20732
  " \xB7 ",
20904
20733
  bumpType,
20905
20734
  dryRun ? " (dry-run)" : ""
20906
20735
  ] })
20907
20736
  ] }),
20908
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Running pre-release checks (tests, build, lint)..." }),
20909
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Analyzing commits, generating changelog, bumping version..." }),
20910
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "The agent will tag, push, and create GitHub release." })
20737
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Running pre-release checks (tests, build, lint)..." }),
20738
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Analyzing commits, generating changelog, bumping version..." }),
20739
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "The agent will tag, push, and create GitHub release." })
20911
20740
  ] })
20912
20741
  );
20913
20742
  }
@@ -21094,7 +20923,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21094
20923
  setHistory((prev) => prev.concat({
21095
20924
  id: Date.now(),
21096
20925
  component: outBox(
21097
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20926
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21098
20927
  "Failed to execute /review: ",
21099
20928
  e?.message || String(e)
21100
20929
  ] }) })
@@ -21118,7 +20947,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21118
20947
  setHistory((prev) => prev.concat({
21119
20948
  id: Date.now(),
21120
20949
  component: outBox(
21121
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20950
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21122
20951
  "Failed to execute /ctx: ",
21123
20952
  e?.message || String(e)
21124
20953
  ] }) })
@@ -21142,7 +20971,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21142
20971
  setHistory((prev) => prev.concat({
21143
20972
  id: Date.now(),
21144
20973
  component: outBox(
21145
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20974
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21146
20975
  "Failed to execute /snip: ",
21147
20976
  e?.message || String(e)
21148
20977
  ] }) })
@@ -21162,7 +20991,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21162
20991
  setHistory((prev) => prev.concat({
21163
20992
  id: Date.now(),
21164
20993
  component: outBox(
21165
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20994
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21166
20995
  "Failed to execute /dream: ",
21167
20996
  e?.message || String(e)
21168
20997
  ] }) })
@@ -21185,7 +21014,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21185
21014
  setHistory((prev) => prev.concat({
21186
21015
  id: Date.now(),
21187
21016
  component: outBox(
21188
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21017
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21189
21018
  "Failed to execute /collapse: ",
21190
21019
  e?.message || String(e)
21191
21020
  ] }) })
@@ -21199,12 +21028,12 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21199
21028
  const messageText = args?.join(" ") || "";
21200
21029
  if (!messageText) {
21201
21030
  return outBox(
21202
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21203
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/brief" }),
21204
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Send a structured message to the user." }),
21205
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /brief <message> [--proactive] [--attach file1 file2]" }),
21206
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " --proactive Mark as proactive notification" }),
21207
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " --attach <f> Attach files to the message" })
21031
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21032
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "/brief" }),
21033
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Send a structured message to the user." }),
21034
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /brief <message> [--proactive] [--attach file1 file2]" }),
21035
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: " --proactive Mark as proactive notification" }),
21036
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: " --attach <f> Attach files to the message" })
21208
21037
  ] })
21209
21038
  );
21210
21039
  }
@@ -21227,7 +21056,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21227
21056
  setHistory((prev) => prev.concat({
21228
21057
  id: Date.now(),
21229
21058
  component: outBox(
21230
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21059
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21231
21060
  "Failed to execute /brief: ",
21232
21061
  e?.message || String(e)
21233
21062
  ] }) })
@@ -21247,7 +21076,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21247
21076
  setHistory((prev) => prev.concat({
21248
21077
  id: Date.now(),
21249
21078
  component: outBox(
21250
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21079
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21251
21080
  "Failed to execute /undo: ",
21252
21081
  e?.message || String(e)
21253
21082
  ] }) })
@@ -21267,7 +21096,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21267
21096
  setHistory((prev) => prev.concat({
21268
21097
  id: Date.now(),
21269
21098
  component: outBox(
21270
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21099
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21271
21100
  "Failed to execute /redo: ",
21272
21101
  e?.message || String(e)
21273
21102
  ] }) })
@@ -21287,7 +21116,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21287
21116
  setHistory((prev) => prev.concat({
21288
21117
  id: Date.now(),
21289
21118
  component: outBox(
21290
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21119
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21291
21120
  "Failed to execute /diff: ",
21292
21121
  e?.message || String(e)
21293
21122
  ] }) })
@@ -21301,10 +21130,10 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21301
21130
  const target = args.join(" ") || "";
21302
21131
  if (!target) {
21303
21132
  return outBox(
21304
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21305
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/explain" }),
21306
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Explain a file, function, or code snippet." }),
21307
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /explain <file> [line-range or function-name]" })
21133
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21134
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "/explain" }),
21135
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Explain a file, function, or code snippet." }),
21136
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /explain <file> [line-range or function-name]" })
21308
21137
  ] })
21309
21138
  );
21310
21139
  }
@@ -21317,7 +21146,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21317
21146
  setHistory((prev) => prev.concat({
21318
21147
  id: Date.now(),
21319
21148
  component: outBox(
21320
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21149
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21321
21150
  "Failed to execute /explain: ",
21322
21151
  e?.message || String(e)
21323
21152
  ] }) })
@@ -21338,7 +21167,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21338
21167
  setHistory((prev) => prev.concat({
21339
21168
  id: Date.now(),
21340
21169
  component: outBox(
21341
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21170
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21342
21171
  "Failed to execute /fix: ",
21343
21172
  e?.message || String(e)
21344
21173
  ] }) })
@@ -21352,10 +21181,10 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21352
21181
  const filePath = args.join(" ") || "";
21353
21182
  if (!filePath) {
21354
21183
  return outBox(
21355
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21356
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/editor" }),
21357
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Open a file in the external editor ($EDITOR or configured editor)." }),
21358
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /editor <file-path>" })
21184
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21185
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "/editor" }),
21186
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Open a file in the external editor ($EDITOR or configured editor)." }),
21187
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /editor <file-path>" })
21359
21188
  ] })
21360
21189
  );
21361
21190
  }
@@ -21368,7 +21197,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21368
21197
  setHistory((prev) => prev.concat({
21369
21198
  id: Date.now(),
21370
21199
  component: outBox(
21371
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21200
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21372
21201
  "Failed to execute /editor: ",
21373
21202
  e?.message || String(e)
21374
21203
  ] }) })
@@ -21381,7 +21210,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21381
21210
  if (cmd === "config") {
21382
21211
  const sub = (args[0] || "").toLowerCase();
21383
21212
  if (!sub || sub === "show" || sub === "list") {
21384
- return renderRuntimeConfig();
21213
+ return renderModelConfig();
21385
21214
  }
21386
21215
  if (sub === "edit") {
21387
21216
  const key = args[1];
@@ -21393,7 +21222,8 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21393
21222
  return usageBox("Config", `Set ${key} = ${JSON.stringify(next[key] || value)}`);
21394
21223
  }
21395
21224
  if (sub === "path") {
21396
- return usageBox("Config", `Config file: ${getRuntimeConfigPath()}`);
21225
+ const { getRuntimeConfigPath: getRuntimeConfigPath2 } = (init_runtime_config(), __toCommonJS(runtime_config_exports));
21226
+ return usageBox("Config", `Config file: ${getRuntimeConfigPath2()}`);
21397
21227
  }
21398
21228
  return usageBox("Config", `Unknown subcommand: ${sub}. Use: show | edit <key> <value> | path`);
21399
21229
  }
@@ -21401,17 +21231,17 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21401
21231
  const description = args.join(" ") || "";
21402
21232
  if (!description) {
21403
21233
  return outBox(
21404
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21405
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/debug" }),
21406
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Debug Coordinator mode \u2014 spawn workers to investigate, fix & verify in parallel." }),
21407
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /debug <describe the problem, symptom, or error>" }),
21408
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " " }),
21409
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "The agent will:" }),
21410
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 Act as Debug Coordinator \u2014 orchestrate a team of workers" }),
21411
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 Spawn parallel researchers to investigate different hypotheses" }),
21412
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 Synthesize findings and direct the fix" }),
21413
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 Spawn a fix worker + verification worker" }),
21414
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 Not stop until root cause is found, fixed, and proven" })
21234
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21235
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "/debug" }),
21236
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Debug Coordinator mode \u2014 spawn workers to investigate, fix & verify in parallel." }),
21237
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /debug <describe the problem, symptom, or error>" }),
21238
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: " " }),
21239
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "The agent will:" }),
21240
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: " \u2022 Act as Debug Coordinator \u2014 orchestrate a team of workers" }),
21241
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: " \u2022 Spawn parallel researchers to investigate different hypotheses" }),
21242
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: " \u2022 Synthesize findings and direct the fix" }),
21243
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: " \u2022 Spawn a fix worker + verification worker" }),
21244
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: " \u2022 Not stop until root cause is found, fixed, and proven" })
21415
21245
  ] })
21416
21246
  );
21417
21247
  }
@@ -21568,7 +21398,7 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
21568
21398
  setHistory((prev) => prev.concat({
21569
21399
  id: Date.now(),
21570
21400
  component: outBox(
21571
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21401
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21572
21402
  "Failed to execute /debug: ",
21573
21403
  e?.message || String(e)
21574
21404
  ] }) })
@@ -21582,10 +21412,10 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
21582
21412
  const description = args.join(" ") || "";
21583
21413
  if (!description) {
21584
21414
  return outBox(
21585
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21586
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/bug" }),
21587
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Alias for /debug \u2014 Debug Coordinator mode." }),
21588
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /bug <describe the problem> (or use /debug)" })
21415
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21416
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "/bug" }),
21417
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Alias for /debug \u2014 Debug Coordinator mode." }),
21418
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /bug <describe the problem> (or use /debug)" })
21589
21419
  ] })
21590
21420
  );
21591
21421
  }
@@ -21742,7 +21572,7 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
21742
21572
  setHistory((prev) => prev.concat({
21743
21573
  id: Date.now(),
21744
21574
  component: outBox(
21745
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21575
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21746
21576
  "Failed to execute /bug: ",
21747
21577
  e?.message || String(e)
21748
21578
  ] }) })
@@ -21768,7 +21598,7 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
21768
21598
  setHistory((prev) => prev.concat({
21769
21599
  id: Date.now(),
21770
21600
  component: outBox(
21771
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21601
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21772
21602
  "Failed to execute /test: ",
21773
21603
  e?.message || String(e)
21774
21604
  ] }) })
@@ -21797,7 +21627,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21797
21627
  setHistory((prev) => prev.concat({
21798
21628
  id: Date.now(),
21799
21629
  component: outBox(
21800
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21630
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21801
21631
  "Failed to execute /optimize: ",
21802
21632
  e?.message || String(e)
21803
21633
  ] }) })
@@ -21811,10 +21641,10 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21811
21641
  const target = args.join(" ") || "";
21812
21642
  if (!target) {
21813
21643
  return outBox(
21814
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21815
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/refactor" }),
21816
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Refactor code to improve structure without changing behavior." }),
21817
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /refactor <file or description of refactoring>" })
21644
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21645
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "/refactor" }),
21646
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Refactor code to improve structure without changing behavior." }),
21647
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /refactor <file or description of refactoring>" })
21818
21648
  ] })
21819
21649
  );
21820
21650
  }
@@ -21833,7 +21663,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21833
21663
  setHistory((prev) => prev.concat({
21834
21664
  id: Date.now(),
21835
21665
  component: outBox(
21836
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21666
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21837
21667
  "Failed to execute /refactor: ",
21838
21668
  e?.message || String(e)
21839
21669
  ] }) })
@@ -21847,10 +21677,10 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21847
21677
  const target = args.join(" ") || "";
21848
21678
  if (!target) {
21849
21679
  return outBox(
21850
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21851
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/document" }),
21852
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Generate documentation for a file, module, or function." }),
21853
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /document <file or module> [--format jsdoc|markdown|readme]" })
21680
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21681
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "/document" }),
21682
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Generate documentation for a file, module, or function." }),
21683
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /document <file or module> [--format jsdoc|markdown|readme]" })
21854
21684
  ] })
21855
21685
  );
21856
21686
  }
@@ -21869,7 +21699,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21869
21699
  setHistory((prev) => prev.concat({
21870
21700
  id: Date.now(),
21871
21701
  component: outBox(
21872
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21702
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21873
21703
  "Failed to execute /document: ",
21874
21704
  e?.message || String(e)
21875
21705
  ] }) })
@@ -21895,7 +21725,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21895
21725
  setHistory((prev) => prev.concat({
21896
21726
  id: Date.now(),
21897
21727
  component: outBox(
21898
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21728
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21899
21729
  "Failed to execute /summarize: ",
21900
21730
  e?.message || String(e)
21901
21731
  ] }) })
@@ -21906,45 +21736,22 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21906
21736
  return null;
21907
21737
  }
21908
21738
  if (cmd === "chat") {
21909
- const next = setRuntimeConfig({ agentMode: "default" });
21910
- return outBox(
21911
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21912
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Chat Mode" }),
21913
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Switched to conversational chat mode." }),
21914
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "The agent will focus on conversation and will not execute code or edit files unless explicitly asked." }),
21915
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /code to switch back to code mode." })
21916
- ] })
21917
- );
21739
+ return renderChat();
21918
21740
  }
21919
21741
  if (cmd === "code") {
21920
- const next = setRuntimeConfig({ agentMode: "default" });
21921
- return outBox(
21922
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21923
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Code Mode" }),
21924
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Switched to code mode." }),
21925
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "The agent can now edit files, run commands, and execute code." }),
21926
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /chat to switch back to conversational mode." })
21927
- ] })
21928
- );
21742
+ return renderCode();
21929
21743
  }
21930
21744
  if (cmd === "terminal") {
21931
- return outBox(
21932
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21933
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Terminal" }),
21934
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Interactive terminal sessions are not yet supported as a slash command." }),
21935
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use the agent's shell_command tool directly in chat instead." }),
21936
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: 'Example: "run npm test and show me the output"' })
21937
- ] })
21938
- );
21745
+ return renderTerminal();
21939
21746
  }
21940
21747
  if (cmd === "file") {
21941
21748
  const filePath = args.join(" ") || "";
21942
21749
  if (!filePath) {
21943
21750
  return outBox(
21944
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21945
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/file" }),
21946
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Create, open, or navigate to a file." }),
21947
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /file <path>" })
21751
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21752
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "/file" }),
21753
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Create, open, or navigate to a file." }),
21754
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /file <path>" })
21948
21755
  ] })
21949
21756
  );
21950
21757
  }
@@ -21962,7 +21769,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21962
21769
  setHistory((prev) => prev.concat({
21963
21770
  id: Date.now(),
21964
21771
  component: outBox(
21965
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21772
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21966
21773
  "Failed to execute /file: ",
21967
21774
  e?.message || String(e)
21968
21775
  ] }) })
@@ -21976,10 +21783,10 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21976
21783
  const query = args.join(" ") || "";
21977
21784
  if (!query) {
21978
21785
  return outBox(
21979
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21980
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/search" }),
21981
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Search the codebase for a pattern." }),
21982
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /search <query> [--files <glob>]" })
21786
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21787
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "/search" }),
21788
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Search the codebase for a pattern." }),
21789
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /search <query> [--files <glob>]" })
21983
21790
  ] })
21984
21791
  );
21985
21792
  }
@@ -21997,7 +21804,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21997
21804
  setHistory((prev) => prev.concat({
21998
21805
  id: Date.now(),
21999
21806
  component: outBox(
22000
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21807
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
22001
21808
  "Failed to execute /search: ",
22002
21809
  e?.message || String(e)
22003
21810
  ] }) })
@@ -22009,97 +21816,43 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22009
21816
  }
22010
21817
  if (cmd === "context") {
22011
21818
  const sub = (args[0] || "").toLowerCase();
22012
- if (!sub || sub === "show" || sub === "status") {
22013
- return outBox(
22014
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22015
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Conversation Context" }),
22016
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /ctx for detailed context inspection." }),
22017
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /compact to manually trigger compaction." }),
22018
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /snip to remove old snippets." }),
22019
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /collapse for aggressive context reduction." })
22020
- ] })
22021
- );
22022
- }
22023
- if (sub === "clear") {
22024
- return usageBox("Context", "Use /clear to clear the conversation history.");
22025
- }
22026
- return usageBox("Context", `Unknown subcommand: ${sub}. Use: show | clear`);
21819
+ return renderContext();
22027
21820
  }
22028
21821
  if (cmd === "token") {
22029
- return outBox(
22030
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22031
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Token Usage" }),
22032
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Token tracking is available via /stats and /cost for detailed session statistics." }),
22033
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Auto-compact triggers at 180k tokens (threshold: 150k micro, 180k full)." }),
22034
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Target after compact: 100k tokens." })
22035
- ] })
22036
- );
21822
+ return renderToken();
22037
21823
  }
22038
21824
  if (cmd === "settings") {
22039
21825
  const sub = (args[0] || "").toLowerCase();
22040
21826
  if (!sub || sub === "show" || sub === "list") {
22041
- return renderRuntimeConfig();
21827
+ return renderModelConfig();
22042
21828
  }
22043
21829
  if (sub === "edit") {
22044
21830
  const key = args[1];
22045
21831
  const value = args.slice(2).join(" ");
22046
21832
  if (!key) {
22047
- return usageBox("Settings", "Usage: /settings edit <key> <value>");
21833
+ return renderSettingsEditUsage();
22048
21834
  }
22049
21835
  const next = setRuntimeConfig({ [key]: value });
22050
21836
  return usageBox("Settings", `Set ${key} = ${JSON.stringify(next[key] || value)}`);
22051
21837
  }
22052
- return usageBox("Settings", `Unknown subcommand: ${sub}. Use: show | edit <key> <value>`);
21838
+ return renderSettingsUnknown();
22053
21839
  }
22054
21840
  if (cmd === "history") {
22055
- const limit = parseInt(args[0] || "20", 10);
22056
- return outBox(
22057
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22058
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Command History" }),
22059
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Recent commands are tracked in the session conversation." }),
22060
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /export to export the full conversation as markdown." }),
22061
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Session logs are stored in ~/.bluma/sessions/" })
22062
- ] })
22063
- );
21841
+ return renderHistory();
22064
21842
  }
22065
21843
  if (cmd === "alias") {
22066
21844
  const sub = (args[0] || "").toLowerCase();
22067
- if (!sub || sub === "list" || sub === "show") {
22068
- return outBox(
22069
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22070
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Command Aliases" }),
22071
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No custom aliases configured yet." }),
22072
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /alias add <name> <command>" }),
22073
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " /alias remove <name>" })
22074
- ] })
22075
- );
22076
- }
22077
- if (sub === "add") {
22078
- const name = args[1];
22079
- const command = args.slice(2).join(" ");
22080
- if (!name || !command) {
22081
- return usageBox("Alias", "Usage: /alias add <name> <command>");
22082
- }
22083
- return usageBox("Alias", `Alias "${name}" \u2192 "${command}" (stored in settings for future sessions).`);
22084
- }
22085
- if (sub === "remove") {
22086
- const name = args[1];
22087
- if (!name) {
22088
- return usageBox("Alias", "Usage: /alias remove <name>");
22089
- }
22090
- return usageBox("Alias", `Alias "${name}" removed.`);
22091
- }
22092
- return usageBox("Alias", `Unknown subcommand: ${sub}. Use: list | add <name> <command> | remove <name>`);
21845
+ return renderAlias(sub);
22093
21846
  }
22094
21847
  if (cmd === "macro") {
22095
21848
  const name = args[0] || "";
22096
21849
  if (!name) {
22097
21850
  return outBox(
22098
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22099
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Macros" }),
22100
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No macros configured yet." }),
22101
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /macro <name>" }),
22102
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: 'Macros are defined in ~/.bluma/settings.json under "macros".' })
21851
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21852
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "Macros" }),
21853
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "No macros configured yet." }),
21854
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /macro <name>" }),
21855
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: 'Macros are defined in ~/.bluma/settings.json under "macros".' })
22103
21856
  ] })
22104
21857
  );
22105
21858
  }
@@ -22112,7 +21865,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22112
21865
  setHistory((prev) => prev.concat({
22113
21866
  id: Date.now(),
22114
21867
  component: outBox(
22115
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21868
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
22116
21869
  "Failed to execute /macro: ",
22117
21870
  e?.message || String(e)
22118
21871
  ] }) })
@@ -22126,11 +21879,11 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22126
21879
  const name = args.join(" ") || "";
22127
21880
  if (!name) {
22128
21881
  return outBox(
22129
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22130
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Templates" }),
22131
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Create a project from a template." }),
22132
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /template <name>" }),
22133
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Available templates: react, nextjs, node-api, cli, library" })
21882
+ /* @__PURE__ */ jsxs24(Fragment14, { children: [
21883
+ /* @__PURE__ */ jsx26(Text24, { bold: true, color: COMMAND_HEADER_COLOR, children: "Templates" }),
21884
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Create a project from a template." }),
21885
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Usage: /template <name>" }),
21886
+ /* @__PURE__ */ jsx26(Text24, { dimColor: true, children: "Available templates: react, nextjs, node-api, cli, library" })
22134
21887
  ] })
22135
21888
  );
22136
21889
  }
@@ -22149,7 +21902,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22149
21902
  setHistory((prev) => prev.concat({
22150
21903
  id: Date.now(),
22151
21904
  component: outBox(
22152
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21905
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
22153
21906
  "Failed to execute /template: ",
22154
21907
  e?.message || String(e)
22155
21908
  ] }) })
@@ -22174,7 +21927,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22174
21927
  setHistory((prev) => prev.concat({
22175
21928
  id: Date.now(),
22176
21929
  component: outBox(
22177
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21930
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
22178
21931
  "Failed to execute /share: ",
22179
21932
  e?.message || String(e)
22180
21933
  ] }) })
@@ -22185,21 +21938,14 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22185
21938
  return null;
22186
21939
  }
22187
21940
  if (cmd === "copy") {
22188
- return outBox(
22189
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22190
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Copy" }),
22191
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Clipboard copy is available via Ctrl+V / Cmd+V paste support." }),
22192
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "On Linux, ensure wl-clipboard or xclip is installed for clipboard support." }),
22193
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: 'Use the agent to copy specific text: "copy the last test output to clipboard"' })
22194
- ] })
22195
- );
21941
+ return renderCopy();
22196
21942
  }
22197
- return outBox(/* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21943
+ return outBox(/* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
22198
21944
  "Command not recognized: /",
22199
21945
  cmd
22200
21946
  ] }));
22201
21947
  };
22202
- return /* @__PURE__ */ jsx18(Fragment6, { children: render2() });
21948
+ return /* @__PURE__ */ jsx26(Fragment14, { children: render2() });
22203
21949
  };
22204
21950
  var SlashCommands_default = SlashCommands;
22205
21951
 
@@ -22300,8 +22046,8 @@ Run: npm i -g ${BLUMA_PACKAGE_NAME} to update.`;
22300
22046
  init_sandbox_policy();
22301
22047
 
22302
22048
  // src/app/ui/components/UpdateNotice.tsx
22303
- import { Box as Box18, Text as Text17 } from "ink";
22304
- import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
22049
+ import { Box as Box26, Text as Text25 } from "ink";
22050
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
22305
22051
  function parseUpdateMessage(msg) {
22306
22052
  const lines = msg.split(/\r?\n/).map((l) => l.trim());
22307
22053
  const first = lines[0] || "";
@@ -22317,25 +22063,25 @@ function parseUpdateMessage(msg) {
22317
22063
  }
22318
22064
  var UpdateNotice = ({ message: message2 }) => {
22319
22065
  const { name, current, latest: latest2, hint } = parseUpdateMessage(message2);
22320
- return /* @__PURE__ */ jsx19(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs17(Box18, { flexDirection: "column", paddingLeft: 2, children: [
22321
- name && current && latest2 ? /* @__PURE__ */ jsx19(Text17, { color: BLUMA_TERMINAL.accent, bold: true, children: name }) : null,
22322
- name && current && latest2 ? /* @__PURE__ */ jsxs17(Text17, { dimColor: true, children: [
22066
+ return /* @__PURE__ */ jsx27(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs25(Box26, { flexDirection: "column", paddingLeft: 2, children: [
22067
+ name && current && latest2 ? /* @__PURE__ */ jsx27(Text25, { color: BLUMA_TERMINAL.accent, bold: true, children: name }) : null,
22068
+ name && current && latest2 ? /* @__PURE__ */ jsxs25(Text25, { dimColor: true, children: [
22323
22069
  current,
22324
22070
  " \u2192 ",
22325
22071
  latest2
22326
- ] }) : /* @__PURE__ */ jsx19(Text17, { dimColor: true, children: message2 }),
22327
- hint ? /* @__PURE__ */ jsx19(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx19(Text17, { dimColor: true, children: hint }) }) : null
22072
+ ] }) : /* @__PURE__ */ jsx27(Text25, { dimColor: true, children: message2 }),
22073
+ hint ? /* @__PURE__ */ jsx27(Box26, { marginTop: 1, children: /* @__PURE__ */ jsx27(Text25, { dimColor: true, children: hint }) }) : null
22328
22074
  ] }) });
22329
22075
  };
22330
22076
  var UpdateNotice_default = UpdateNotice;
22331
22077
 
22332
22078
  // src/app/ui/components/ErrorMessage.tsx
22333
- import { Box as Box19, Text as Text18 } from "ink";
22334
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
22335
- var ErrorMessage = ({ message: message2, details, hint }) => /* @__PURE__ */ jsx20(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs18(Box19, { flexDirection: "column", paddingLeft: 2, children: [
22336
- /* @__PURE__ */ jsx20(Text18, { color: BLUMA_TERMINAL.err, children: message2 }),
22337
- details ? /* @__PURE__ */ jsx20(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx20(Text18, { dimColor: true, children: details }) }) : null,
22338
- hint ? /* @__PURE__ */ jsx20(Box19, { marginTop: 1, children: /* @__PURE__ */ jsxs18(Text18, { dimColor: true, children: [
22079
+ import { Box as Box27, Text as Text26 } from "ink";
22080
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
22081
+ var ErrorMessage = ({ message: message2, details, hint }) => /* @__PURE__ */ jsx28(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs26(Box27, { flexDirection: "column", paddingLeft: 2, children: [
22082
+ /* @__PURE__ */ jsx28(Text26, { color: BLUMA_TERMINAL.err, children: message2 }),
22083
+ details ? /* @__PURE__ */ jsx28(Box27, { marginTop: 1, children: /* @__PURE__ */ jsx28(Text26, { dimColor: true, children: details }) }) : null,
22084
+ hint ? /* @__PURE__ */ jsx28(Box27, { marginTop: 1, children: /* @__PURE__ */ jsxs26(Text26, { dimColor: true, children: [
22339
22085
  "hint: ",
22340
22086
  hint
22341
22087
  ] }) }) : null
@@ -22344,8 +22090,8 @@ var ErrorMessage_default = ErrorMessage;
22344
22090
 
22345
22091
  // src/app/ui/components/ReasoningDisplay.tsx
22346
22092
  import { memo as memo11 } from "react";
22347
- import { Box as Box20, Text as Text19 } from "ink";
22348
- import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
22093
+ import { Box as Box28, Text as Text27 } from "ink";
22094
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
22349
22095
  var ReasoningDisplayComponent = ({
22350
22096
  reasoning,
22351
22097
  collapsed = false
@@ -22357,9 +22103,9 @@ var ReasoningDisplayComponent = ({
22357
22103
  const lines = reasoning.split("\n");
22358
22104
  const displayLines = lines.slice(0, maxLines);
22359
22105
  const truncated = lines.length > maxLines;
22360
- return /* @__PURE__ */ jsx21(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs19(Box20, { flexDirection: "column", paddingLeft: 1, children: [
22361
- displayLines.map((line, i) => /* @__PURE__ */ jsx21(Text19, { dimColor: true, wrap: "wrap", children: line }, i)),
22362
- truncated ? /* @__PURE__ */ jsxs19(Text19, { dimColor: true, children: [
22106
+ return /* @__PURE__ */ jsx29(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs27(Box28, { flexDirection: "column", paddingLeft: 1, children: [
22107
+ displayLines.map((line, i) => /* @__PURE__ */ jsx29(Text27, { dimColor: true, wrap: "wrap", children: line }, i)),
22108
+ truncated ? /* @__PURE__ */ jsxs27(Text27, { dimColor: true, children: [
22363
22109
  "\u2026 +",
22364
22110
  lines.length - maxLines,
22365
22111
  " lines"
@@ -22369,8 +22115,8 @@ var ReasoningDisplayComponent = ({
22369
22115
  var ReasoningDisplay = memo11(ReasoningDisplayComponent);
22370
22116
 
22371
22117
  // src/app/ui/components/StreamingText.tsx
22372
- import { useState as useState6, useEffect as useEffect7, useRef as useRef5, memo as memo12 } from "react";
22373
- import { Box as Box21, Text as Text20 } from "ink";
22118
+ import { useState as useState5, useEffect as useEffect7, useRef as useRef5, memo as memo12 } from "react";
22119
+ import { Box as Box29, Text as Text28 } from "ink";
22374
22120
 
22375
22121
  // src/app/ui/components/streamingTextFlush.ts
22376
22122
  function applyStreamEndFlush(params) {
@@ -22392,7 +22138,7 @@ function applyStreamEndFlush(params) {
22392
22138
  }
22393
22139
 
22394
22140
  // src/app/ui/components/StreamingText.tsx
22395
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
22141
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
22396
22142
  var THROTTLE_MS = 50;
22397
22143
  var MAX_VISIBLE_LINES = 20;
22398
22144
  var StreamingTextComponent = ({
@@ -22400,9 +22146,9 @@ var StreamingTextComponent = ({
22400
22146
  onReasoningComplete,
22401
22147
  onAssistantContentComplete
22402
22148
  }) => {
22403
- const [reasoning, setReasoning] = useState6("");
22404
- const [assistantContent, setAssistantContent] = useState6("");
22405
- const [isStreaming, setIsStreaming] = useState6(false);
22149
+ const [reasoning, setReasoning] = useState5("");
22150
+ const [assistantContent, setAssistantContent] = useState5("");
22151
+ const [isStreaming, setIsStreaming] = useState5(false);
22406
22152
  const reasoningRef = useRef5("");
22407
22153
  const contentRef = useRef5("");
22408
22154
  const lastUpdateRef = useRef5(0);
@@ -22491,26 +22237,26 @@ var StreamingTextComponent = ({
22491
22237
  truncatedCount = lines.length - MAX_VISIBLE_LINES;
22492
22238
  displayLines = lines.slice(-MAX_VISIBLE_LINES);
22493
22239
  }
22494
- return /* @__PURE__ */ jsxs20(Box21, { flexDirection: "column", children: [
22495
- truncatedCount > 0 ? /* @__PURE__ */ jsxs20(Text20, { dimColor: true, children: [
22240
+ return /* @__PURE__ */ jsxs28(Box29, { flexDirection: "column", children: [
22241
+ truncatedCount > 0 ? /* @__PURE__ */ jsxs28(Text28, { dimColor: true, children: [
22496
22242
  "\u2026 ",
22497
22243
  truncatedCount,
22498
22244
  " lines above hidden"
22499
22245
  ] }) : null,
22500
- displayLines.map((line, i) => /* @__PURE__ */ jsx22(Text20, { dimColor: dim, color: dim ? void 0 : BLUMA_TERMINAL.m3OnSurface, children: line }, i))
22246
+ displayLines.map((line, i) => /* @__PURE__ */ jsx30(Text28, { dimColor: dim, color: dim ? void 0 : BLUMA_TERMINAL.m3OnSurface, children: line }, i))
22501
22247
  ] });
22502
22248
  };
22503
- return /* @__PURE__ */ jsxs20(ChatBlock, { marginBottom: 1, children: [
22504
- reasoning ? /* @__PURE__ */ jsx22(Box21, { flexDirection: "column", paddingLeft: 2, children: renderLines(reasoning, true) }) : null,
22505
- assistantContent ? /* @__PURE__ */ jsx22(MessageResponse, { children: renderLines(assistantContent, false) }) : null
22249
+ return /* @__PURE__ */ jsxs28(ChatBlock, { marginBottom: 1, children: [
22250
+ reasoning ? /* @__PURE__ */ jsx30(Box29, { flexDirection: "column", paddingLeft: 2, children: renderLines(reasoning, true) }) : null,
22251
+ assistantContent ? /* @__PURE__ */ jsx30(MessageResponse, { children: renderLines(assistantContent, false) }) : null
22506
22252
  ] });
22507
22253
  };
22508
22254
  var StreamingText = memo12(StreamingTextComponent);
22509
22255
 
22510
22256
  // src/app/ui/components/ExpandedPreviewBlock.tsx
22511
22257
  import { memo as memo13 } from "react";
22512
- import { Box as Box22, Text as Text21 } from "ink";
22513
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
22258
+ import { Box as Box30, Text as Text29 } from "ink";
22259
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
22514
22260
  function ExpandedPreviewBlockComponent({ data }) {
22515
22261
  const cols = typeof process.stdout?.columns === "number" ? process.stdout.columns : 80;
22516
22262
  const rule = TERMINAL_RULE_CHAR.repeat(Math.max(8, cols));
@@ -22518,36 +22264,36 @@ function ExpandedPreviewBlockComponent({ data }) {
22518
22264
  const cap = EXPAND_OVERLAY_MAX_LINES;
22519
22265
  const shown = lines.slice(0, cap);
22520
22266
  const rest = lines.length - cap;
22521
- return /* @__PURE__ */ jsxs21(ChatBlock, { marginBottom: 1, children: [
22522
- /* @__PURE__ */ jsx23(Text21, { color: "white", children: rule }),
22523
- /* @__PURE__ */ jsxs21(Box22, { flexDirection: "column", paddingLeft: 1, children: [
22524
- /* @__PURE__ */ jsx23(Text21, { color: BLUMA_TERMINAL.accent, bold: true, children: "expand (Ctrl+O)" }),
22525
- /* @__PURE__ */ jsx23(Text21, { dimColor: true, children: data.title }),
22526
- /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
22267
+ return /* @__PURE__ */ jsxs29(ChatBlock, { marginBottom: 1, children: [
22268
+ /* @__PURE__ */ jsx31(Text29, { color: "white", children: rule }),
22269
+ /* @__PURE__ */ jsxs29(Box30, { flexDirection: "column", paddingLeft: 1, children: [
22270
+ /* @__PURE__ */ jsx31(Text29, { color: BLUMA_TERMINAL.accent, bold: true, children: "expand (Ctrl+O)" }),
22271
+ /* @__PURE__ */ jsx31(Text29, { dimColor: true, children: data.title }),
22272
+ /* @__PURE__ */ jsxs29(Text29, { dimColor: true, children: [
22527
22273
  "+",
22528
22274
  data.linesHidden,
22529
22275
  " lines were clipped in chat \xB7 below: up to ",
22530
22276
  cap,
22531
22277
  " lines \xB7 use read_file_lines before edit_tool"
22532
22278
  ] }),
22533
- /* @__PURE__ */ jsxs21(Box22, { flexDirection: "column", marginTop: 1, children: [
22534
- shown.map((line, i) => /* @__PURE__ */ jsx23(Text21, { dimColor: true, children: line.slice(0, 200) }, i)),
22535
- rest > 0 ? /* @__PURE__ */ jsxs21(Text21, { dimColor: true, children: [
22279
+ /* @__PURE__ */ jsxs29(Box30, { flexDirection: "column", marginTop: 1, children: [
22280
+ shown.map((line, i) => /* @__PURE__ */ jsx31(Text29, { dimColor: true, children: line.slice(0, 200) }, i)),
22281
+ rest > 0 ? /* @__PURE__ */ jsxs29(Text29, { dimColor: true, children: [
22536
22282
  "\u2026 +",
22537
22283
  rest,
22538
22284
  " more lines in this chunk"
22539
22285
  ] }) : null
22540
22286
  ] })
22541
22287
  ] }),
22542
- /* @__PURE__ */ jsx23(Text21, { color: "white", children: rule })
22288
+ /* @__PURE__ */ jsx31(Text29, { color: "white", children: rule })
22543
22289
  ] });
22544
22290
  }
22545
22291
  var ExpandedPreviewBlock = memo13(ExpandedPreviewBlockComponent);
22546
22292
 
22547
22293
  // src/app/ui/components/AskUserQuestionPrompt.tsx
22548
- import { memo as memo14, useState as useState7 } from "react";
22549
- import { Box as Box23, Text as Text22, useInput as useInput4 } from "ink";
22550
- import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
22294
+ import { memo as memo14, useState as useState6 } from "react";
22295
+ import { Box as Box31, Text as Text30, useInput as useInput4 } from "ink";
22296
+ import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
22551
22297
  var AskUserQuestionPromptComponent = ({
22552
22298
  questions,
22553
22299
  onAnswer,
@@ -22555,7 +22301,7 @@ var AskUserQuestionPromptComponent = ({
22555
22301
  }) => {
22556
22302
  const q = questions[0];
22557
22303
  const opts = q?.options ?? [];
22558
- const [selected, setSelected] = useState7(0);
22304
+ const [selected, setSelected] = useState6(0);
22559
22305
  useInput4((input, key) => {
22560
22306
  if (key.escape) {
22561
22307
  onCancel();
@@ -22598,52 +22344,52 @@ var AskUserQuestionPromptComponent = ({
22598
22344
  const cols = typeof process.stdout?.columns === "number" ? process.stdout.columns : 72;
22599
22345
  const rule = TERMINAL_RULE_CHAR.repeat(Math.min(cols - 2, 64));
22600
22346
  if (!q || opts.length === 0) {
22601
- return /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", marginBottom: 1, children: [
22602
- /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: rule }),
22603
- /* @__PURE__ */ jsx24(Text22, { color: BLUMA_TERMINAL.err, children: "Invalid question payload" })
22347
+ return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", marginBottom: 1, children: [
22348
+ /* @__PURE__ */ jsx32(Text30, { dimColor: true, children: rule }),
22349
+ /* @__PURE__ */ jsx32(Text30, { color: BLUMA_TERMINAL.err, children: "Invalid question payload" })
22604
22350
  ] });
22605
22351
  }
22606
- return /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", marginBottom: 1, children: [
22607
- /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: rule }),
22608
- /* @__PURE__ */ jsx24(Text22, { bold: true, color: BLUMA_TERMINAL.accent, children: "Question" }),
22609
- q.header ? /* @__PURE__ */ jsx24(Text22, { dimColor: true, wrap: "wrap", children: q.header }) : null,
22610
- /* @__PURE__ */ jsx24(Box23, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx24(Text22, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: q.question }) }),
22611
- /* @__PURE__ */ jsx24(Box23, { flexDirection: "column", marginTop: 1, paddingLeft: 1, children: opts.map((o, idx) => {
22352
+ return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", marginBottom: 1, children: [
22353
+ /* @__PURE__ */ jsx32(Text30, { dimColor: true, children: rule }),
22354
+ /* @__PURE__ */ jsx32(Text30, { bold: true, color: BLUMA_TERMINAL.accent, children: "Question" }),
22355
+ q.header ? /* @__PURE__ */ jsx32(Text30, { dimColor: true, wrap: "wrap", children: q.header }) : null,
22356
+ /* @__PURE__ */ jsx32(Box31, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx32(Text30, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: q.question }) }),
22357
+ /* @__PURE__ */ jsx32(Box31, { flexDirection: "column", marginTop: 1, paddingLeft: 1, children: opts.map((o, idx) => {
22612
22358
  const isSel = idx === selected;
22613
- return /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", marginBottom: 0, children: [
22614
- /* @__PURE__ */ jsxs22(Text22, { color: isSel ? BLUMA_TERMINAL.blue : void 0, bold: isSel, dimColor: !isSel, wrap: "wrap", children: [
22359
+ return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", marginBottom: 0, children: [
22360
+ /* @__PURE__ */ jsxs30(Text30, { color: isSel ? BLUMA_TERMINAL.blue : void 0, bold: isSel, dimColor: !isSel, wrap: "wrap", children: [
22615
22361
  "(",
22616
22362
  idx + 1,
22617
22363
  ") ",
22618
22364
  o.label
22619
22365
  ] }),
22620
- o.description ? /* @__PURE__ */ jsxs22(Text22, { dimColor: true, wrap: "wrap", children: [
22366
+ o.description ? /* @__PURE__ */ jsxs30(Text30, { dimColor: true, wrap: "wrap", children: [
22621
22367
  " ",
22622
22368
  o.description
22623
22369
  ] }) : null
22624
22370
  ] }, idx);
22625
22371
  }) }),
22626
- /* @__PURE__ */ jsx24(Box23, { marginTop: 1, children: /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: "Enter / number to choose \xB7 \u2191\u2193 \xB7 Esc cancel" }) }),
22627
- /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: rule })
22372
+ /* @__PURE__ */ jsx32(Box31, { marginTop: 1, children: /* @__PURE__ */ jsx32(Text30, { dimColor: true, children: "Enter / number to choose \xB7 \u2191\u2193 \xB7 Esc cancel" }) }),
22373
+ /* @__PURE__ */ jsx32(Text30, { dimColor: true, children: rule })
22628
22374
  ] });
22629
22375
  };
22630
22376
  var AskUserQuestionPrompt = memo14(AskUserQuestionPromptComponent);
22631
22377
 
22632
22378
  // src/app/ui/components/WorkerOverlay.tsx
22633
- import { useState as useState10 } from "react";
22634
- import { Box as Box26, useInput as useInput5 } from "ink";
22379
+ import { useState as useState9 } from "react";
22380
+ import { Box as Box34, useInput as useInput5 } from "ink";
22635
22381
 
22636
22382
  // src/app/ui/components/WorkerStatusList.tsx
22637
- import { useEffect as useEffect8, useState as useState8 } from "react";
22638
- import { Box as Box24, Text as Text23 } from "ink";
22383
+ import { useEffect as useEffect8, useState as useState7 } from "react";
22384
+ import { Box as Box32, Text as Text31 } from "ink";
22639
22385
  import Spinner2 from "ink-spinner";
22640
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
22386
+ import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
22641
22387
  var WorkerStatusList = ({
22642
22388
  parentSessionId,
22643
22389
  collapsed = false
22644
22390
  }) => {
22645
- const [workers, setWorkers] = useState8([]);
22646
- const [pollKey, setPollKey] = useState8(0);
22391
+ const [workers, setWorkers] = useState7([]);
22392
+ const [pollKey, setPollKey] = useState7(0);
22647
22393
  useEffect8(() => {
22648
22394
  const pollWorkers = async () => {
22649
22395
  try {
@@ -22696,49 +22442,49 @@ var WorkerStatusList = ({
22696
22442
  }, [pollKey, parentSessionId]);
22697
22443
  if (workers.length === 0) return null;
22698
22444
  if (collapsed) {
22699
- return /* @__PURE__ */ jsx25(Box24, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", children: /* @__PURE__ */ jsxs23(Text23, { bold: true, color: "yellow", children: [
22445
+ return /* @__PURE__ */ jsx33(Box32, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", children: /* @__PURE__ */ jsxs31(Text31, { bold: true, color: "yellow", children: [
22700
22446
  "Workers: ",
22701
22447
  workers.length
22702
22448
  ] }) });
22703
22449
  }
22704
- return /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", children: [
22705
- /* @__PURE__ */ jsxs23(Text23, { bold: true, color: "yellow", children: [
22450
+ return /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", children: [
22451
+ /* @__PURE__ */ jsxs31(Text31, { bold: true, color: "yellow", children: [
22706
22452
  "Workers (",
22707
22453
  workers.length,
22708
22454
  ")"
22709
22455
  ] }),
22710
- workers.map((w, idx) => /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", borderBottom: true, borderBottomColor: "gray", children: [
22711
- /* @__PURE__ */ jsxs23(Box24, { children: [
22712
- /* @__PURE__ */ jsx25(Text23, { color: "cyan", children: w.metadata?.agent_type === "researcher" ? "[R]" : w.metadata?.agent_type === "implementer" ? "[I]" : "[W]" }),
22713
- /* @__PURE__ */ jsxs23(Text23, { bold: true, color: "cyan", children: [
22456
+ workers.map((w, idx) => /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", borderBottom: true, borderBottomColor: "gray", children: [
22457
+ /* @__PURE__ */ jsxs31(Box32, { children: [
22458
+ /* @__PURE__ */ jsx33(Text31, { color: "cyan", children: w.metadata?.agent_type === "researcher" ? "[R]" : w.metadata?.agent_type === "implementer" ? "[I]" : "[W]" }),
22459
+ /* @__PURE__ */ jsxs31(Text31, { bold: true, color: "cyan", children: [
22714
22460
  " ",
22715
22461
  w.title
22716
22462
  ] }),
22717
- w.isAlive === true ? /* @__PURE__ */ jsxs23(Text23, { color: "green", children: [
22718
- /* @__PURE__ */ jsx25(Spinner2, {}),
22463
+ w.isAlive === true ? /* @__PURE__ */ jsxs31(Text31, { color: "green", children: [
22464
+ /* @__PURE__ */ jsx33(Spinner2, {}),
22719
22465
  " Running"
22720
- ] }) : /* @__PURE__ */ jsx25(Text23, { color: "gray", children: w.status })
22466
+ ] }) : /* @__PURE__ */ jsx33(Text31, { color: "gray", children: w.status })
22721
22467
  ] }),
22722
- w.progress && /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", children: [
22723
- /* @__PURE__ */ jsxs23(Text23, { color: "magenta", children: [
22468
+ w.progress && /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", children: [
22469
+ /* @__PURE__ */ jsxs31(Text31, { color: "magenta", children: [
22724
22470
  "Progress: ",
22725
22471
  w.progress.percent,
22726
22472
  "% ",
22727
22473
  w.progress.currentTask ? `- ${w.progress.currentTask}` : ""
22728
22474
  ] }),
22729
- /* @__PURE__ */ jsx25(Box24, { children: /* @__PURE__ */ jsx25(Text23, { color: "gray", children: Array.from({ length: 20 }).map((_, i) => i / 20 * 100 <= (w.progress.percent || 0) ? "#" : "-").join("") }) }),
22730
- /* @__PURE__ */ jsxs23(Box24, { children: [
22731
- w.progress.toolCallsCount !== void 0 && /* @__PURE__ */ jsxs23(Text23, { color: "blue", children: [
22475
+ /* @__PURE__ */ jsx33(Box32, { children: /* @__PURE__ */ jsx33(Text31, { color: "gray", children: Array.from({ length: 20 }).map((_, i) => i / 20 * 100 <= (w.progress.percent || 0) ? "#" : "-").join("") }) }),
22476
+ /* @__PURE__ */ jsxs31(Box32, { children: [
22477
+ w.progress.toolCallsCount !== void 0 && /* @__PURE__ */ jsxs31(Text31, { color: "blue", children: [
22732
22478
  " Tools: ",
22733
22479
  w.progress.toolCallsCount
22734
22480
  ] }),
22735
- w.progress.tokensUsed !== void 0 && /* @__PURE__ */ jsxs23(Text23, { color: "blue", children: [
22481
+ w.progress.tokensUsed !== void 0 && /* @__PURE__ */ jsxs31(Text31, { color: "blue", children: [
22736
22482
  " Tokens: ",
22737
22483
  w.progress.tokensUsed.toLocaleString()
22738
22484
  ] })
22739
22485
  ] })
22740
22486
  ] }),
22741
- /* @__PURE__ */ jsxs23(Text23, { dimColor: true, color: "gray", children: [
22487
+ /* @__PURE__ */ jsxs31(Text31, { dimColor: true, color: "gray", children: [
22742
22488
  "ID: ",
22743
22489
  w.session_id.slice(0, 8),
22744
22490
  "... PID: ",
@@ -22746,7 +22492,7 @@ var WorkerStatusList = ({
22746
22492
  " Started: ",
22747
22493
  new Date(w.started_at).toLocaleTimeString()
22748
22494
  ] }),
22749
- /* @__PURE__ */ jsxs23(Text23, { italic: true, dimColor: true, color: "gray", children: [
22495
+ /* @__PURE__ */ jsxs31(Text31, { italic: true, dimColor: true, color: "gray", children: [
22750
22496
  "Ctrl+Shift+",
22751
22497
  idx + 1,
22752
22498
  " para transcript"
@@ -22756,11 +22502,11 @@ var WorkerStatusList = ({
22756
22502
  };
22757
22503
 
22758
22504
  // src/app/ui/components/WorkerTranscript.tsx
22759
- import { useEffect as useEffect9, useState as useState9 } from "react";
22760
- import { Box as Box25, Text as Text24 } from "ink";
22761
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
22505
+ import { useEffect as useEffect9, useState as useState8 } from "react";
22506
+ import { Box as Box33, Text as Text32 } from "ink";
22507
+ import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
22762
22508
  var WorkerTranscript = ({ sessionId, title, onClose }) => {
22763
- const [messages, setMessages] = useState9([]);
22509
+ const [messages, setMessages] = useState8([]);
22764
22510
  useEffect9(() => {
22765
22511
  const loadTranscript = async () => {
22766
22512
  try {
@@ -22776,27 +22522,27 @@ var WorkerTranscript = ({ sessionId, title, onClose }) => {
22776
22522
  const interval = setInterval(loadTranscript, 3e3);
22777
22523
  return () => clearInterval(interval);
22778
22524
  }, [sessionId]);
22779
- return /* @__PURE__ */ jsxs24(Box25, { flexDirection: "column", borderStyle: "double", borderColor: "cyan", children: [
22780
- /* @__PURE__ */ jsxs24(Box25, { children: [
22781
- /* @__PURE__ */ jsxs24(Text24, { bold: true, color: "cyan", children: [
22525
+ return /* @__PURE__ */ jsxs32(Box33, { flexDirection: "column", borderStyle: "double", borderColor: "cyan", children: [
22526
+ /* @__PURE__ */ jsxs32(Box33, { children: [
22527
+ /* @__PURE__ */ jsxs32(Text32, { bold: true, color: "cyan", children: [
22782
22528
  "Transcript: ",
22783
22529
  title || sessionId.slice(0, 8),
22784
22530
  "..."
22785
22531
  ] }),
22786
- /* @__PURE__ */ jsx26(Text24, { color: "gray", dimColor: true, children: " ESC: fechar" })
22532
+ /* @__PURE__ */ jsx34(Text32, { color: "gray", dimColor: true, children: " ESC: fechar" })
22787
22533
  ] }),
22788
- /* @__PURE__ */ jsx26(Box25, { flexDirection: "column", height: 20, children: messages.length === 0 ? /* @__PURE__ */ jsx26(Text24, { dimColor: true, color: "gray", italic: true, children: "Nenhuma mensagem..." }) : messages.map((msg) => /* @__PURE__ */ jsxs24(Box25, { flexDirection: "column", children: [
22789
- /* @__PURE__ */ jsxs24(Box25, { children: [
22790
- /* @__PURE__ */ jsxs24(Text24, { dimColor: true, color: "gray", children: [
22534
+ /* @__PURE__ */ jsx34(Box33, { flexDirection: "column", height: 20, children: messages.length === 0 ? /* @__PURE__ */ jsx34(Text32, { dimColor: true, color: "gray", italic: true, children: "Nenhuma mensagem..." }) : messages.map((msg) => /* @__PURE__ */ jsxs32(Box33, { flexDirection: "column", children: [
22535
+ /* @__PURE__ */ jsxs32(Box33, { children: [
22536
+ /* @__PURE__ */ jsxs32(Text32, { dimColor: true, color: "gray", children: [
22791
22537
  "[",
22792
22538
  new Date(msg.timestamp).toLocaleTimeString(),
22793
22539
  "]"
22794
22540
  ] }),
22795
- /* @__PURE__ */ jsxs24(Text24, { color: msg.type === "progress_update" ? "green" : msg.type === "permission_request" ? "yellow" : "cyan", bold: true, children: [
22541
+ /* @__PURE__ */ jsxs32(Text32, { color: msg.type === "progress_update" ? "green" : msg.type === "permission_request" ? "yellow" : "cyan", bold: true, children: [
22796
22542
  " ",
22797
22543
  msg.type
22798
22544
  ] }),
22799
- /* @__PURE__ */ jsxs24(Text24, { dimColor: true, color: "gray", children: [
22545
+ /* @__PURE__ */ jsxs32(Text32, { dimColor: true, color: "gray", children: [
22800
22546
  " ",
22801
22547
  msg.from.slice(0, 8),
22802
22548
  "... \u2192 ",
@@ -22804,18 +22550,18 @@ var WorkerTranscript = ({ sessionId, title, onClose }) => {
22804
22550
  "..."
22805
22551
  ] })
22806
22552
  ] }),
22807
- /* @__PURE__ */ jsxs24(Text24, { children: [
22553
+ /* @__PURE__ */ jsxs32(Text32, { children: [
22808
22554
  " ",
22809
22555
  msg.content
22810
22556
  ] }),
22811
- msg.metadata?.progress && /* @__PURE__ */ jsxs24(Text24, { color: "magenta", children: [
22557
+ msg.metadata?.progress && /* @__PURE__ */ jsxs32(Text32, { color: "magenta", children: [
22812
22558
  " Progress: ",
22813
22559
  msg.metadata.progress.percent,
22814
22560
  "% ",
22815
22561
  msg.metadata.progress.currentTask || ""
22816
22562
  ] })
22817
22563
  ] }, msg.id)) }),
22818
- /* @__PURE__ */ jsx26(Box25, { borderTop: true, borderTopColor: "gray", children: /* @__PURE__ */ jsxs24(Text24, { dimColor: true, color: "gray", children: [
22564
+ /* @__PURE__ */ jsx34(Box33, { borderTop: true, borderTopColor: "gray", children: /* @__PURE__ */ jsxs32(Text32, { dimColor: true, color: "gray", children: [
22819
22565
  "Total: ",
22820
22566
  messages.length,
22821
22567
  " messages | Session: ",
@@ -22826,14 +22572,14 @@ var WorkerTranscript = ({ sessionId, title, onClose }) => {
22826
22572
  };
22827
22573
 
22828
22574
  // src/app/ui/components/WorkerOverlay.tsx
22829
- import { jsx as jsx27 } from "react/jsx-runtime";
22575
+ import { jsx as jsx35 } from "react/jsx-runtime";
22830
22576
  var WorkerOverlay = ({
22831
22577
  visible,
22832
22578
  sessionId,
22833
22579
  onClose,
22834
22580
  onZoomWorker
22835
22581
  }) => {
22836
- const [zoomedWorker, setZoomedWorker] = useState10(null);
22582
+ const [zoomedWorker, setZoomedWorker] = useState9(null);
22837
22583
  useInput5((input, key) => {
22838
22584
  if (!visible) return;
22839
22585
  if (key.escape) {
@@ -22847,13 +22593,13 @@ var WorkerOverlay = ({
22847
22593
  if (!visible) {
22848
22594
  return null;
22849
22595
  }
22850
- return /* @__PURE__ */ jsx27(Box26, { flexDirection: "column", children: zoomedWorker ? /* @__PURE__ */ jsx27(
22596
+ return /* @__PURE__ */ jsx35(Box34, { flexDirection: "column", children: zoomedWorker ? /* @__PURE__ */ jsx35(
22851
22597
  WorkerTranscript,
22852
22598
  {
22853
22599
  sessionId: zoomedWorker,
22854
22600
  onClose: () => setZoomedWorker(null)
22855
22601
  }
22856
- ) : /* @__PURE__ */ jsx27(
22602
+ ) : /* @__PURE__ */ jsx35(
22857
22603
  WorkerStatusList,
22858
22604
  {
22859
22605
  parentSessionId: sessionId,
@@ -22986,7 +22732,7 @@ IMPORTANT: Use the file_write tool to create all these files. Be thorough but co
22986
22732
  }
22987
22733
 
22988
22734
  // src/app/ui/App.tsx
22989
- import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
22735
+ import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
22990
22736
  var HISTORY_EMERGENCY_LIMIT = 3;
22991
22737
  var HISTORY_KEEP_AFTER_CLEANUP = 3;
22992
22738
  var blumaUpdateRegistryCheckStarted = false;
@@ -23013,7 +22759,17 @@ var AGENT_WORK_COMMANDS = /* @__PURE__ */ new Set([
23013
22759
  "release",
23014
22760
  "review",
23015
22761
  "bug",
23016
- "chat"
22762
+ "chat",
22763
+ // Commands that use run* functions and call processTurn()
22764
+ "tasks",
22765
+ "model",
22766
+ "effort",
22767
+ "style",
22768
+ "sandbox",
22769
+ "worktree",
22770
+ "permissions",
22771
+ "hooks",
22772
+ "plugins"
23017
22773
  ]);
23018
22774
  var BLOCKING_COMMANDS = /* @__PURE__ */ new Set(["init"]);
23019
22775
  var COMMAND_HEADER_COLOR2 = BLUMA_TERMINAL.accent;
@@ -23043,46 +22799,46 @@ function UserMessageWithOptionalImages({
23043
22799
  const cap = stripped2.trim();
23044
22800
  const capDisp = cap.length > 800 ? `${cap.slice(0, 800)}\u2026` : cap;
23045
22801
  const fallbackDisp = raw.length > 800 ? `${raw.slice(0, 800)}\u2026` : raw;
23046
- return /* @__PURE__ */ jsx28(ChatUserMessage, { children: pathStrs.length > 0 ? /* @__PURE__ */ jsx28(
22802
+ return /* @__PURE__ */ jsx36(ChatUserMessage, { children: pathStrs.length > 0 ? /* @__PURE__ */ jsx36(
23047
22803
  ChatUserImageBlock,
23048
22804
  {
23049
22805
  imageCount: pathStrs.length,
23050
22806
  caption: cap.length > 0 ? capDisp : null,
23051
22807
  captionDim: true
23052
22808
  }
23053
- ) : /* @__PURE__ */ jsx28(Text26, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: fallbackDisp }) });
22809
+ ) : /* @__PURE__ */ jsx36(Text34, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: fallbackDisp }) });
23054
22810
  }
23055
22811
  const displayRaw = raw.length > 1e4 ? `${raw.substring(0, 1e4)}...` : raw;
23056
22812
  const paths = collectImagePathStrings(displayRaw);
23057
22813
  const stripped = paths.length > 0 ? stripImagePathStrings(displayRaw, paths) : displayRaw;
23058
- return /* @__PURE__ */ jsx28(ChatUserMessage, { children: paths.length > 0 ? /* @__PURE__ */ jsx28(
22814
+ return /* @__PURE__ */ jsx36(ChatUserMessage, { children: paths.length > 0 ? /* @__PURE__ */ jsx36(
23059
22815
  ChatUserImageBlock,
23060
22816
  {
23061
22817
  imageCount: paths.length,
23062
22818
  caption: stripped.trim().length > 0 ? stripped : null
23063
22819
  }
23064
- ) : /* @__PURE__ */ jsx28(Text26, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: displayRaw }) });
22820
+ ) : /* @__PURE__ */ jsx36(Text34, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: displayRaw }) });
23065
22821
  }
23066
22822
  var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23067
22823
  const agentInstance = useRef6(null);
23068
- const [history, setHistory] = useState11([]);
23069
- const [statusMessage, setStatusMessage] = useState11(
22824
+ const [history, setHistory] = useState10([]);
22825
+ const [statusMessage, setStatusMessage] = useState10(
23070
22826
  "Initializing agent..."
23071
22827
  );
23072
- const [toolsCount, setToolsCount] = useState11(null);
23073
- const [mcpStatus, setMcpStatus] = useState11(
22828
+ const [toolsCount, setToolsCount] = useState10(null);
22829
+ const [mcpStatus, setMcpStatus] = useState10(
23074
22830
  "connecting"
23075
22831
  );
23076
- const [isProcessing, setIsProcessing] = useState11(true);
23077
- const [pendingConfirmation, setPendingConfirmation] = useState11(
22832
+ const [isProcessing, setIsProcessing] = useState10(true);
22833
+ const [pendingConfirmation, setPendingConfirmation] = useState10(
23078
22834
  null
23079
22835
  );
23080
- const [confirmationPreview, setConfirmationPreview] = useState11(
22836
+ const [confirmationPreview, setConfirmationPreview] = useState10(
23081
22837
  null
23082
22838
  );
23083
- const [pendingAskUserQuestions, setPendingAskUserQuestions] = useState11(null);
23084
- const [showWorkers, setShowWorkers] = useState11(false);
23085
- const [zoomedWorkerSession, setZoomedWorkerSession] = useState11(null);
22839
+ const [pendingAskUserQuestions, setPendingAskUserQuestions] = useState10(null);
22840
+ const [showWorkers, setShowWorkers] = useState10(false);
22841
+ const [zoomedWorkerSession, setZoomedWorkerSession] = useState10(null);
23086
22842
  useInput6((input, key) => {
23087
22843
  if (key.ctrl && key.shift && input.toLowerCase() === "w") {
23088
22844
  setShowWorkers((prev) => !prev);
@@ -23095,14 +22851,14 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23095
22851
  }
23096
22852
  }
23097
22853
  });
23098
- const [isInitAgentActive, setIsInitAgentActive] = useState11(false);
23099
- const [liveToolName, setLiveToolName] = useState11(null);
23100
- const [liveToolArgs, setLiveToolArgs] = useState11(void 0);
23101
- const [isReasoning, setIsReasoning] = useState11(false);
22854
+ const [isInitAgentActive, setIsInitAgentActive] = useState10(false);
22855
+ const [liveToolName, setLiveToolName] = useState10(null);
22856
+ const [liveToolArgs, setLiveToolArgs] = useState10(void 0);
22857
+ const [isReasoning, setIsReasoning] = useState10(false);
23102
22858
  const alwaysAcceptList = useRef6([]);
23103
22859
  const workdir = getSandboxPolicy().workspaceRoot;
23104
22860
  const turnStartedAtRef = useRef6(null);
23105
- const [processingStartMs, setProcessingStartMs] = useState11(null);
22861
+ const [processingStartMs, setProcessingStartMs] = useState10(null);
23106
22862
  const markTurnStarted = useCallback4(() => {
23107
22863
  const t = Date.now();
23108
22864
  turnStartedAtRef.current = t;
@@ -23120,7 +22876,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23120
22876
  ...prev,
23121
22877
  {
23122
22878
  id,
23123
- component: /* @__PURE__ */ jsx28(ChatMeta, { children: "Ctrl+O: no truncated preview to expand" }, id)
22879
+ component: /* @__PURE__ */ jsx36(ChatMeta, { children: "Ctrl+O: no truncated preview to expand" }, id)
23124
22880
  }
23125
22881
  ];
23126
22882
  }
@@ -23128,7 +22884,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23128
22884
  ...prev,
23129
22885
  {
23130
22886
  id,
23131
- component: /* @__PURE__ */ jsx28(ExpandedPreviewBlock, { data: p }, id)
22887
+ component: /* @__PURE__ */ jsx36(ExpandedPreviewBlock, { data: p }, id)
23132
22888
  }
23133
22889
  ];
23134
22890
  });
@@ -23150,7 +22906,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23150
22906
  ...prev,
23151
22907
  {
23152
22908
  id: nextId2,
23153
- component: /* @__PURE__ */ jsx28(UpdateNotice_default, { message: msg })
22909
+ component: /* @__PURE__ */ jsx36(UpdateNotice_default, { message: msg })
23154
22910
  }
23155
22911
  ];
23156
22912
  });
@@ -23162,7 +22918,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23162
22918
  return [
23163
22919
  {
23164
22920
  id: HEADER_PANEL_HISTORY_ID,
23165
- component: /* @__PURE__ */ jsx28(Header, { sessionId, workdir, cliVersion })
22921
+ component: /* @__PURE__ */ jsx36(Header, { sessionId, workdir, cliVersion })
23166
22922
  },
23167
22923
  ...tail
23168
22924
  ];
@@ -23180,7 +22936,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23180
22936
  ...prev,
23181
22937
  {
23182
22938
  id,
23183
- component: /* @__PURE__ */ jsx28(ChatMeta, { children: "cancelled (Esc)" })
22939
+ component: /* @__PURE__ */ jsx36(ChatMeta, { children: "cancelled (Esc)" })
23184
22940
  }
23185
22941
  ];
23186
22942
  });
@@ -23206,7 +22962,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23206
22962
  ...prev,
23207
22963
  {
23208
22964
  id,
23209
- component: /* @__PURE__ */ jsx28(ChatUserMessage, { children: /* @__PURE__ */ jsx28(Text26, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: text }) })
22965
+ component: /* @__PURE__ */ jsx36(ChatUserMessage, { children: /* @__PURE__ */ jsx36(Text34, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: text }) })
23210
22966
  }
23211
22967
  ];
23212
22968
  });
@@ -23222,7 +22978,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23222
22978
  ...prev,
23223
22979
  {
23224
22980
  id,
23225
- component: /* @__PURE__ */ jsxs25(ChatMeta, { children: [
22981
+ component: /* @__PURE__ */ jsxs33(ChatMeta, { children: [
23226
22982
  "Failed to initialize: ",
23227
22983
  error instanceof Error ? error.message : String(error)
23228
22984
  ] })
@@ -23240,7 +22996,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23240
22996
  ...prev,
23241
22997
  {
23242
22998
  id,
23243
- component: /* @__PURE__ */ jsx28(ChatMeta, { children: "Slash command not recognized or incomplete. Type /help for the list." })
22999
+ component: /* @__PURE__ */ jsx36(ChatMeta, { children: "Slash command not recognized or incomplete. Type /help for the list." })
23244
23000
  }
23245
23001
  ];
23246
23002
  });
@@ -23258,7 +23014,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23258
23014
  ...prev,
23259
23015
  {
23260
23016
  id,
23261
- component: /* @__PURE__ */ jsx28(ChatMeta, { children: "Usage: /img ./screenshot.png \u2014 optional text after the path is sent too" })
23017
+ component: /* @__PURE__ */ jsx36(ChatMeta, { children: "Usage: /img ./screenshot.png \u2014 optional text after the path is sent too" })
23262
23018
  }
23263
23019
  ];
23264
23020
  });
@@ -23277,7 +23033,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23277
23033
  ...prev,
23278
23034
  {
23279
23035
  id,
23280
- component: /* @__PURE__ */ jsx28(UserMessageWithOptionalImages, { raw: payload, variant: "slash-img" })
23036
+ component: /* @__PURE__ */ jsx36(UserMessageWithOptionalImages, { raw: payload, variant: "slash-img" })
23281
23037
  }
23282
23038
  ];
23283
23039
  });
@@ -23314,16 +23070,18 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23314
23070
  ...prev,
23315
23071
  {
23316
23072
  id: firstId,
23317
- component: /* @__PURE__ */ jsx28(ChatUserMessage, { children: /* @__PURE__ */ jsx28(Text26, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: text }) })
23073
+ component: /* @__PURE__ */ jsx36(ChatUserMessage, { children: /* @__PURE__ */ jsx36(Text34, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: text }) })
23318
23074
  },
23319
23075
  {
23320
23076
  id: secondId,
23321
- component: /* @__PURE__ */ jsx28(
23077
+ component: /* @__PURE__ */ jsx36(
23322
23078
  SlashCommands_default,
23323
23079
  {
23324
23080
  input: text,
23325
23081
  setHistory,
23326
- agentRef: agentInstance
23082
+ agentRef: agentInstance,
23083
+ setIsProcessing,
23084
+ markTurnStarted
23327
23085
  }
23328
23086
  )
23329
23087
  }
@@ -23350,7 +23108,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23350
23108
  ...prev,
23351
23109
  {
23352
23110
  id,
23353
- component: /* @__PURE__ */ jsx28(ChatUserMessage, { children: /* @__PURE__ */ jsxs25(Text26, { bold: true, color: "white", children: [
23111
+ component: /* @__PURE__ */ jsx36(ChatUserMessage, { children: /* @__PURE__ */ jsxs33(Text34, { bold: true, color: "white", children: [
23354
23112
  "$ !",
23355
23113
  command
23356
23114
  ] }) })
@@ -23376,7 +23134,7 @@ Please use command_status to check the result and report back to the user.`;
23376
23134
  ...prev,
23377
23135
  {
23378
23136
  id,
23379
- component: /* @__PURE__ */ jsxs25(Text26, { color: "red", children: [
23137
+ component: /* @__PURE__ */ jsxs33(Text34, { color: "red", children: [
23380
23138
  "Failed to execute: ",
23381
23139
  result.error || result.message
23382
23140
  ] })
@@ -23394,7 +23152,7 @@ Please use command_status to check the result and report back to the user.`;
23394
23152
  ...prev,
23395
23153
  {
23396
23154
  id,
23397
- component: /* @__PURE__ */ jsxs25(Text26, { color: "red", children: [
23155
+ component: /* @__PURE__ */ jsxs33(Text34, { color: "red", children: [
23398
23156
  "Error: ",
23399
23157
  err.message
23400
23158
  ] })
@@ -23414,7 +23172,7 @@ Please use command_status to check the result and report back to the user.`;
23414
23172
  ...prev,
23415
23173
  {
23416
23174
  id,
23417
- component: /* @__PURE__ */ jsx28(UserMessageWithOptionalImages, { raw: text, variant: "plain" })
23175
+ component: /* @__PURE__ */ jsx36(UserMessageWithOptionalImages, { raw: text, variant: "plain" })
23418
23176
  }
23419
23177
  ];
23420
23178
  });
@@ -23455,7 +23213,7 @@ Please use command_status to check the result and report back to the user.`;
23455
23213
  ...prev,
23456
23214
  {
23457
23215
  id,
23458
- component: /* @__PURE__ */ jsx28(ReasoningDisplay, { reasoning })
23216
+ component: /* @__PURE__ */ jsx36(ReasoningDisplay, { reasoning })
23459
23217
  }
23460
23218
  ];
23461
23219
  });
@@ -23471,7 +23229,7 @@ Please use command_status to check the result and report back to the user.`;
23471
23229
  ...prev,
23472
23230
  {
23473
23231
  id,
23474
- component: /* @__PURE__ */ jsx28(AssistantMessageDisplay, { content })
23232
+ component: /* @__PURE__ */ jsx36(AssistantMessageDisplay, { content })
23475
23233
  }
23476
23234
  ];
23477
23235
  });
@@ -23523,7 +23281,7 @@ Please use command_status to check the result and report back to the user.`;
23523
23281
  ...prev,
23524
23282
  {
23525
23283
  id,
23526
- component: /* @__PURE__ */ jsx28(ChatTurnDuration, { durationMs: ms })
23284
+ component: /* @__PURE__ */ jsx36(ChatTurnDuration, { durationMs: ms })
23527
23285
  }
23528
23286
  ];
23529
23287
  });
@@ -23633,14 +23391,14 @@ Please use command_status to check the result and report back to the user.`;
23633
23391
  }
23634
23392
  let newComponent = null;
23635
23393
  if (parsed.type === "debug") {
23636
- newComponent = /* @__PURE__ */ jsx28(ChatMeta, { children: parsed.message });
23394
+ newComponent = /* @__PURE__ */ jsx36(ChatMeta, { children: parsed.message });
23637
23395
  } else if (parsed.type === "protocol_violation") {
23638
- newComponent = /* @__PURE__ */ jsx28(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs25(Box27, { flexDirection: "column", paddingLeft: 2, children: [
23639
- /* @__PURE__ */ jsx28(Text26, { dimColor: true, children: parsed.content }),
23640
- /* @__PURE__ */ jsx28(Text26, { dimColor: true, children: parsed.message })
23396
+ newComponent = /* @__PURE__ */ jsx36(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs33(Box35, { flexDirection: "column", paddingLeft: 2, children: [
23397
+ /* @__PURE__ */ jsx36(Text34, { dimColor: true, children: parsed.content }),
23398
+ /* @__PURE__ */ jsx36(Text34, { dimColor: true, children: parsed.message })
23641
23399
  ] }) });
23642
23400
  } else if (parsed.type === "error") {
23643
- newComponent = /* @__PURE__ */ jsx28(
23401
+ newComponent = /* @__PURE__ */ jsx36(
23644
23402
  ErrorMessage_default,
23645
23403
  {
23646
23404
  message: parsed.message,
@@ -23667,7 +23425,7 @@ Please use command_status to check the result and report back to the user.`;
23667
23425
  parsed.tool_call_id
23668
23426
  );
23669
23427
  }
23670
- newComponent = isToolInvocationRowVisible(tn) ? /* @__PURE__ */ jsx28(
23428
+ newComponent = isToolInvocationRowVisible(tn) ? /* @__PURE__ */ jsx36(
23671
23429
  ToolInvocationBlock,
23672
23430
  {
23673
23431
  toolName: tn,
@@ -23688,7 +23446,7 @@ Please use command_status to check the result and report back to the user.`;
23688
23446
  pendingToolInvocationIdsRef.current,
23689
23447
  parsed.tool_call_id
23690
23448
  );
23691
- newComponent = /* @__PURE__ */ jsx28(
23449
+ newComponent = /* @__PURE__ */ jsx36(
23692
23450
  ToolResultDisplay,
23693
23451
  {
23694
23452
  toolName: parsed.tool_name,
@@ -23699,7 +23457,7 @@ Please use command_status to check the result and report back to the user.`;
23699
23457
  }
23700
23458
  );
23701
23459
  } else if (parsed.type === "user_overlay") {
23702
- newComponent = /* @__PURE__ */ jsx28(ChatUserMessage, { children: /* @__PURE__ */ jsx28(Text26, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: parsed.payload }) });
23460
+ newComponent = /* @__PURE__ */ jsx36(ChatUserMessage, { children: /* @__PURE__ */ jsx36(Text34, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: parsed.payload }) });
23703
23461
  } else if (parsed.type === "reasoning") {
23704
23462
  const r = String(parsed.content ?? "").trim();
23705
23463
  const key = reasoningDedupeKey(r);
@@ -23707,10 +23465,10 @@ Please use command_status to check the result and report back to the user.`;
23707
23465
  newComponent = null;
23708
23466
  } else {
23709
23467
  if (r) lastReasoningTextRef.current = key;
23710
- newComponent = /* @__PURE__ */ jsx28(ReasoningDisplay, { reasoning: String(parsed.content ?? "") });
23468
+ newComponent = /* @__PURE__ */ jsx36(ReasoningDisplay, { reasoning: String(parsed.content ?? "") });
23711
23469
  }
23712
23470
  } else if (parsed.type === "log") {
23713
- newComponent = /* @__PURE__ */ jsxs25(ChatMeta, { children: [
23471
+ newComponent = /* @__PURE__ */ jsxs33(ChatMeta, { children: [
23714
23472
  parsed.message,
23715
23473
  parsed.payload ? `: ${parsed.payload}` : ""
23716
23474
  ] });
@@ -23721,7 +23479,7 @@ Please use command_status to check the result and report back to the user.`;
23721
23479
  newComponent = null;
23722
23480
  } else {
23723
23481
  lastStreamAssistantKeyRef.current = key || null;
23724
- newComponent = /* @__PURE__ */ jsx28(AssistantMessageDisplay, { content: body });
23482
+ newComponent = /* @__PURE__ */ jsx36(AssistantMessageDisplay, { content: body });
23725
23483
  }
23726
23484
  }
23727
23485
  if (newComponent) {
@@ -23739,7 +23497,7 @@ Please use command_status to check the result and report back to the user.`;
23739
23497
  const ms = Date.now() - t;
23740
23498
  next.push({
23741
23499
  id: nextHistoryId(next),
23742
- component: /* @__PURE__ */ jsx28(ChatTurnDuration, { durationMs: ms })
23500
+ component: /* @__PURE__ */ jsx36(ChatTurnDuration, { durationMs: ms })
23743
23501
  });
23744
23502
  }
23745
23503
  }
@@ -23757,7 +23515,7 @@ Please use command_status to check the result and report back to the user.`;
23757
23515
  if (!msg) return;
23758
23516
  setHistory((prev) => {
23759
23517
  const id = nextHistoryId(prev);
23760
- return [...prev, { id, component: /* @__PURE__ */ jsx28(ChatMeta, { children: msg }) }];
23518
+ return [...prev, { id, component: /* @__PURE__ */ jsx36(ChatMeta, { children: msg }) }];
23761
23519
  });
23762
23520
  };
23763
23521
  uiEventBus.on("user_overlay", handleUiOverlay);
@@ -23772,7 +23530,7 @@ Please use command_status to check the result and report back to the user.`;
23772
23530
  }, [eventBus, sessionId, handleConfirmation]);
23773
23531
  const renderInteractiveComponent = () => {
23774
23532
  if (mcpStatus !== "connected") {
23775
- return /* @__PURE__ */ jsx28(
23533
+ return /* @__PURE__ */ jsx36(
23776
23534
  SessionInfoConnectingMCP_default,
23777
23535
  {
23778
23536
  workdir,
@@ -23780,8 +23538,8 @@ Please use command_status to check the result and report back to the user.`;
23780
23538
  }
23781
23539
  );
23782
23540
  }
23783
- return /* @__PURE__ */ jsxs25(Box27, { flexDirection: "column", children: [
23784
- pendingAskUserQuestions && pendingAskUserQuestions.length > 0 ? /* @__PURE__ */ jsx28(
23541
+ return /* @__PURE__ */ jsxs33(Box35, { flexDirection: "column", children: [
23542
+ pendingAskUserQuestions && pendingAskUserQuestions.length > 0 ? /* @__PURE__ */ jsx36(
23785
23543
  AskUserQuestionPrompt,
23786
23544
  {
23787
23545
  questions: pendingAskUserQuestions,
@@ -23797,7 +23555,7 @@ Please use command_status to check the result and report back to the user.`;
23797
23555
  }
23798
23556
  }
23799
23557
  ) : null,
23800
- pendingConfirmation ? /* @__PURE__ */ jsx28(
23558
+ pendingConfirmation ? /* @__PURE__ */ jsx36(
23801
23559
  ConfirmationPrompt,
23802
23560
  {
23803
23561
  toolCalls: pendingConfirmation,
@@ -23810,7 +23568,7 @@ Please use command_status to check the result and report back to the user.`;
23810
23568
  }
23811
23569
  }
23812
23570
  ) : null,
23813
- isProcessing && !pendingConfirmation && !pendingAskUserQuestions && /* @__PURE__ */ jsx28(
23571
+ isProcessing && !pendingConfirmation && !pendingAskUserQuestions && /* @__PURE__ */ jsx36(
23814
23572
  WorkingTimer,
23815
23573
  {
23816
23574
  eventBus,
@@ -23820,7 +23578,7 @@ Please use command_status to check the result and report back to the user.`;
23820
23578
  isReasoning
23821
23579
  }
23822
23580
  ),
23823
- /* @__PURE__ */ jsx28(
23581
+ /* @__PURE__ */ jsx36(
23824
23582
  InputPrompt,
23825
23583
  {
23826
23584
  onSubmit: handleSubmit,
@@ -23832,10 +23590,10 @@ Please use command_status to check the result and report back to the user.`;
23832
23590
  )
23833
23591
  ] });
23834
23592
  };
23835
- return /* @__PURE__ */ jsxs25(Box27, { flexDirection: "column", children: [
23836
- /* @__PURE__ */ jsx28(Static, { items: history, children: (item) => /* @__PURE__ */ jsx28(Box27, { children: item.component }, item.id) }),
23837
- liveToolName ? /* @__PURE__ */ jsx28(Box27, { paddingLeft: 2, marginBottom: 0, children: /* @__PURE__ */ jsxs25(Text26, { dimColor: true, children: [
23838
- /* @__PURE__ */ jsxs25(Text26, { color: BLUMA_TERMINAL.brandMagenta, bold: true, children: [
23593
+ return /* @__PURE__ */ jsxs33(Box35, { flexDirection: "column", children: [
23594
+ /* @__PURE__ */ jsx36(Static, { items: history, children: (item) => /* @__PURE__ */ jsx36(Box35, { children: item.component }, item.id) }),
23595
+ liveToolName ? /* @__PURE__ */ jsx36(Box35, { paddingLeft: 2, marginBottom: 0, children: /* @__PURE__ */ jsxs33(Text34, { dimColor: true, children: [
23596
+ /* @__PURE__ */ jsxs33(Text34, { color: BLUMA_TERMINAL.brandMagenta, bold: true, children: [
23839
23597
  "*",
23840
23598
  " "
23841
23599
  ] }),
@@ -23843,7 +23601,7 @@ Please use command_status to check the result and report back to the user.`;
23843
23601
  liveToolName,
23844
23602
  "\u2026"
23845
23603
  ] }) }) : null,
23846
- /* @__PURE__ */ jsx28(
23604
+ /* @__PURE__ */ jsx36(
23847
23605
  StreamingText,
23848
23606
  {
23849
23607
  eventBus,
@@ -23852,7 +23610,7 @@ Please use command_status to check the result and report back to the user.`;
23852
23610
  }
23853
23611
  ),
23854
23612
  renderInteractiveComponent(),
23855
- showWorkers && /* @__PURE__ */ jsx28(
23613
+ showWorkers && /* @__PURE__ */ jsx36(
23856
23614
  WorkerOverlay,
23857
23615
  {
23858
23616
  visible: showWorkers,
@@ -23926,6 +23684,42 @@ function stopTitleKeeper() {
23926
23684
 
23927
23685
  // src/main.ts
23928
23686
  init_session_registry();
23687
+
23688
+ // src/app/agent/runtime/session_view.ts
23689
+ function isProcessAlive(pid) {
23690
+ if (!pid || pid <= 0) return false;
23691
+ try {
23692
+ process.kill(pid, 0);
23693
+ return true;
23694
+ } catch {
23695
+ return false;
23696
+ }
23697
+ }
23698
+ function formatSessionLine(session) {
23699
+ return `${session.sessionId} ${session.kind} ${session.status} ${session.updatedAt} ${session.title}`;
23700
+ }
23701
+ function formatLogLine(line) {
23702
+ try {
23703
+ const parsed = JSON.parse(line);
23704
+ const ts = parsed.timestamp || (/* @__PURE__ */ new Date()).toISOString();
23705
+ if (parsed.event_type === "log") {
23706
+ return `[${ts}] ${String(parsed.level || "info").toUpperCase()} ${String(parsed.message || "")}`;
23707
+ }
23708
+ if (parsed.event_type === "backend_message") {
23709
+ return `[${ts}] EVENT ${String(parsed.backend_type || "unknown")}`;
23710
+ }
23711
+ if (parsed.event_type === "action_status") {
23712
+ return `[${ts}] STATUS ${JSON.stringify(parsed.payload)}`;
23713
+ }
23714
+ if (parsed.event_type === "result") {
23715
+ return `[${ts}] RESULT ${String(parsed.status || "success")}`;
23716
+ }
23717
+ } catch {
23718
+ }
23719
+ return line;
23720
+ }
23721
+
23722
+ // src/main.ts
23929
23723
  function extractUserMessage(envelope) {
23930
23724
  const c = envelope.context;
23931
23725
  if (c && typeof c === "object" && typeof c.user_request === "string") {
@@ -24099,7 +23893,6 @@ async function runAgentMode() {
24099
23893
  if (agentRef) {
24100
23894
  await agentRef.closeActiveTurn("worker_done_exit");
24101
23895
  }
24102
- finalizeSession(sessionId, "completed", { finishedBy: "done-event" });
24103
23896
  writeAgentEvent(sessionId, {
24104
23897
  event_type: "result",
24105
23898
  status: "success",
@@ -24112,6 +23905,7 @@ async function runAgentMode() {
24112
23905
  attachments: lastAttachments
24113
23906
  }
24114
23907
  });
23908
+ finalizeSession(sessionId, "completed", { finishedBy: "done-event" });
24115
23909
  process.exit(0);
24116
23910
  }
24117
23911
  });
@@ -24154,7 +23948,6 @@ async function runAgentMode() {
24154
23948
  if (!resultEmitted) {
24155
23949
  resultEmitted = true;
24156
23950
  await agent.closeActiveTurn("worker_post_turn_fallback");
24157
- finalizeSession(sessionId, "completed", { finishedBy: "post-turn-fallback" });
24158
23951
  writeAgentEvent(sessionId, {
24159
23952
  event_type: "result",
24160
23953
  status: "success",
@@ -24167,6 +23960,7 @@ async function runAgentMode() {
24167
23960
  attachments: lastAttachments
24168
23961
  }
24169
23962
  });
23963
+ finalizeSession(sessionId, "completed", { finishedBy: "post-turn-fallback" });
24170
23964
  process.exit(0);
24171
23965
  }
24172
23966
  } catch (err) {
@@ -24174,7 +23968,6 @@ async function runAgentMode() {
24174
23968
  if (agentRef) {
24175
23969
  await agentRef.closeActiveTurn("worker_exception");
24176
23970
  }
24177
- finalizeSession(sessionId, "error", { finishedBy: "exception" });
24178
23971
  writeAgentEvent(sessionId, {
24179
23972
  event_type: "result",
24180
23973
  status: "error",
@@ -24184,6 +23977,7 @@ async function runAgentMode() {
24184
23977
  details: err?.message
24185
23978
  }
24186
23979
  });
23980
+ finalizeSession(sessionId, "error", { finishedBy: "exception" });
24187
23981
  }
24188
23982
  process.exit(1);
24189
23983
  }