@nomad-e/bluma-cli 0.1.72 → 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.
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";
@@ -199,7 +205,7 @@ var init_permission_rules = __esm({
199
205
  matchesPattern(pattern, value) {
200
206
  if (pattern === "*") return true;
201
207
  if (pattern.includes("*")) {
202
- const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*");
208
+ const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, ".*").replace(/\*/g, ".*");
203
209
  const regex = new RegExp("^" + escaped + "$");
204
210
  return regex.test(value);
205
211
  }
@@ -319,13 +325,31 @@ var init_sandbox_policy = __esm({
319
325
  init_runtime_config();
320
326
  init_permission_rules();
321
327
  BLOCKED_COMMAND_PATTERNS = [
322
- // No command patterns blocked sandbox isolation handles safety
328
+ { pattern: /\bsudo\b/, reason: "Privilege escalation is not allowed." },
329
+ { pattern: /\bsu\b\s/, reason: "User switching is not allowed." },
330
+ { pattern: /\brm\s+-rf\s+\/\b/, reason: "Deleting root filesystem is blocked." },
331
+ { pattern: /\bcurl\b.*\|\s*(bash|sh|zsh)/i, reason: "Pipe-to-shell execution is blocked." },
332
+ { pattern: /\bwget\b.*\|\s*(bash|sh|zsh)/i, reason: "Pipe-to-shell execution is blocked." },
333
+ { pattern: /\beval\b\s*\(/, reason: "Eval execution is blocked." },
334
+ { pattern: /\bmkfs\b/, reason: "Filesystem formatting is blocked." },
335
+ { pattern: /\bdd\s+of=/, reason: "Raw disk write is blocked." }
323
336
  ];
324
337
  HIGH_RISK_COMMAND_PATTERNS = [
325
- // No high-risk patterns — all commands allowed inside sandbox
338
+ /\brm\s+-rf\b/,
339
+ /\bchmod\s+-?777\b/,
340
+ /\bchown\s/,
341
+ /\bmkfs\b/,
342
+ /\bformat\b/
326
343
  ];
327
344
  MODERATE_RISK_COMMAND_PATTERNS = [
328
- // No moderate-risk patterns — all commands allowed inside sandbox
345
+ /\bnpm\s+install\b/,
346
+ /\bnpm\s+update\b/,
347
+ /\byarn\s+install\b/,
348
+ /\byarn\s+upgrade\b/,
349
+ /\bpnpm\s+install\b/,
350
+ /\bpip\s+install\b/,
351
+ /\bapt-get\s+install\b/,
352
+ /\bbrew\s+install\b/
329
353
  ];
330
354
  }
331
355
  });
@@ -1593,146 +1617,6 @@ var init_poll_mailbox = __esm({
1593
1617
  }
1594
1618
  });
1595
1619
 
1596
- // src/app/ui/theme/themes.ts
1597
- var themes_exports = {};
1598
- __export(themes_exports, {
1599
- THEMES: () => THEMES,
1600
- getTheme: () => getTheme,
1601
- getThemeColors: () => getThemeColors,
1602
- listThemes: () => listThemes
1603
- });
1604
- function getTheme(name) {
1605
- return THEMES[name];
1606
- }
1607
- function listThemes() {
1608
- return Object.values(THEMES).map((t) => ({ name: t.name, description: t.description }));
1609
- }
1610
- function getThemeColors(name) {
1611
- return THEMES[name]?.colors;
1612
- }
1613
- var THEMES;
1614
- var init_themes = __esm({
1615
- "src/app/ui/theme/themes.ts"() {
1616
- "use strict";
1617
- THEMES = {
1618
- default: {
1619
- name: "Default",
1620
- description: "Classic dark terminal theme",
1621
- colors: {
1622
- background: "#000000",
1623
- foreground: "#ffffff",
1624
- accent: "#3b82f6",
1625
- error: "#ef4444",
1626
- success: "#22c55e",
1627
- warning: "#f59e0b",
1628
- info: "#06b6d4",
1629
- toolCall: "#8b5cf6",
1630
- toolResult: "#06b6d4",
1631
- assistantMessage: "#ffffff",
1632
- userMessage: "#9ca3af",
1633
- border: "#374151",
1634
- dim: "#6b7280"
1635
- }
1636
- },
1637
- dracula: {
1638
- name: "Dracula",
1639
- description: "Popular dark theme with purple accents",
1640
- colors: {
1641
- background: "#282a36",
1642
- foreground: "#f8f8f2",
1643
- accent: "#bd93f9",
1644
- error: "#ff5555",
1645
- success: "#50fa7b",
1646
- warning: "#ffb86c",
1647
- info: "#8be9fd",
1648
- toolCall: "#ff79c6",
1649
- toolResult: "#8be9fd",
1650
- assistantMessage: "#f8f8f2",
1651
- userMessage: "#6272a4",
1652
- border: "#44475a",
1653
- dim: "#6272a4"
1654
- }
1655
- },
1656
- github: {
1657
- name: "GitHub Dark",
1658
- description: "GitHub dark mode inspired theme",
1659
- colors: {
1660
- background: "#0d1117",
1661
- foreground: "#c9d1d9",
1662
- accent: "#58a6ff",
1663
- error: "#f85149",
1664
- success: "#3fb950",
1665
- warning: "#d29922",
1666
- info: "#58a6ff",
1667
- toolCall: "#bc8cff",
1668
- toolResult: "#39d353",
1669
- assistantMessage: "#c9d1d9",
1670
- userMessage: "#8b949e",
1671
- border: "#30363d",
1672
- dim: "#484f58"
1673
- }
1674
- },
1675
- monokai: {
1676
- name: "Monokai",
1677
- description: "Vibrant dark theme with green accents",
1678
- colors: {
1679
- background: "#272822",
1680
- foreground: "#f8f8f2",
1681
- accent: "#a6e22e",
1682
- error: "#f92672",
1683
- success: "#a6e22e",
1684
- warning: "#e6db74",
1685
- info: "#66d9ef",
1686
- toolCall: "#fd971f",
1687
- toolResult: "#66d9ef",
1688
- assistantMessage: "#f8f8f2",
1689
- userMessage: "#75715e",
1690
- border: "#3e3d32",
1691
- dim: "#75715e"
1692
- }
1693
- },
1694
- nord: {
1695
- name: "Nord",
1696
- description: "Arctic north-bluish color palette",
1697
- colors: {
1698
- background: "#2e3440",
1699
- foreground: "#d8dee9",
1700
- accent: "#88c0d0",
1701
- error: "#bf616a",
1702
- success: "#a3be8c",
1703
- warning: "#ebcb8b",
1704
- info: "#81a1c1",
1705
- toolCall: "#b48ead",
1706
- toolResult: "#88c0d0",
1707
- assistantMessage: "#d8dee9",
1708
- userMessage: "#4c566a",
1709
- border: "#3b4252",
1710
- dim: "#4c566a"
1711
- }
1712
- },
1713
- tokyo: {
1714
- name: "Tokyo Night",
1715
- description: "Clean dark theme with blue-purple tones",
1716
- colors: {
1717
- background: "#1a1b26",
1718
- foreground: "#a9b1d6",
1719
- accent: "#7aa2f7",
1720
- error: "#f7768e",
1721
- success: "#9ece6a",
1722
- warning: "#e0af68",
1723
- info: "#7dcfff",
1724
- toolCall: "#bb9af7",
1725
- toolResult: "#7dcfff",
1726
- assistantMessage: "#a9b1d6",
1727
- userMessage: "#565f89",
1728
- border: "#24283b",
1729
- dim: "#565f89"
1730
- }
1731
- }
1732
- };
1733
- }
1734
- });
1735
-
1736
1620
  // src/main.ts
1737
1621
  import React19 from "react";
1738
1622
  import { render } from "ink";
@@ -1744,8 +1628,8 @@ import { spawn as spawn6 } from "child_process";
1744
1628
  import { v4 as uuidv412 } from "uuid";
1745
1629
 
1746
1630
  // src/app/ui/App.tsx
1747
- import { useState as useState11, useEffect as useEffect11, useRef as useRef6, useCallback as useCallback4, memo as memo15 } from "react";
1748
- 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";
1749
1633
 
1750
1634
  // src/app/ui/layout.tsx
1751
1635
  import { Box, Text } from "ink";
@@ -2328,7 +2212,7 @@ var getSlashCommands = () => [
2328
2212
  },
2329
2213
  {
2330
2214
  name: "/tasks",
2331
- description: "manage task list: /tasks [list|add|complete|update|remove|clear]",
2215
+ description: "manage mason list: /tasks [list|add|complete|update|remove|clear]",
2332
2216
  category: "session"
2333
2217
  },
2334
2218
  {
@@ -2653,15 +2537,6 @@ var getSlashCommands = () => [
2653
2537
  category: "session"
2654
2538
  }
2655
2539
  ];
2656
- var getSlashCommandsByGroup = () => {
2657
- const cmds = getSlashCommands();
2658
- const order = ["session", "agent", "inspect", "help", "input"];
2659
- return order.map((cat) => ({
2660
- category: cat,
2661
- label: CATEGORY_LABEL[cat],
2662
- commands: cmds.filter((c) => c.category === cat)
2663
- })).filter((group) => group.commands.length > 0);
2664
- };
2665
2540
  var SLASH_ROUTE_KEYWORDS = new Set(
2666
2541
  getSlashCommands().filter((c) => c.name.startsWith("/")).map((c) => c.name.slice(1).toLowerCase())
2667
2542
  );
@@ -2687,6 +2562,21 @@ var CATEGORY_LABEL = {
2687
2562
  help: "Help",
2688
2563
  input: "Input"
2689
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
+ }
2690
2580
  var filterSlashCommands = (query) => {
2691
2581
  const list = getSlashCommands();
2692
2582
  const q = (query || "").toLowerCase();
@@ -5050,7 +4940,7 @@ var TOOL_DISPLAY_LABELS = {
5050
4940
  wait_agent: "Wait for agent",
5051
4941
  list_agents: "List agents",
5052
4942
  todo: "Todo list",
5053
- task_boundary: "Task boundary",
4943
+ task_boundary: "Mason boundary",
5054
4944
  load_skill: "Load skill",
5055
4945
  coding_memory: "Coding memory",
5056
4946
  create_artifact: "Create artifact",
@@ -5060,11 +4950,11 @@ var TOOL_DISPLAY_LABELS = {
5060
4950
  ask_user_question: "Ask user",
5061
4951
  enter_plan_mode: "Enter plan mode",
5062
4952
  exit_plan_mode: "Exit plan mode",
5063
- task_create: "Task create",
5064
- task_list: "Task list",
5065
- task_get: "Task get",
5066
- task_update: "Task update",
5067
- 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",
5068
4958
  list_mcp_resources: "List MCP resources",
5069
4959
  read_mcp_resource: "Read MCP resource",
5070
4960
  cron_create: "Cron schedule",
@@ -5113,8 +5003,8 @@ var TOOL_INVOCATION_TITLES = {
5113
5003
  view_file_outline: "Outline",
5114
5004
  web_fetch: "Fetch",
5115
5005
  search_web: "Web",
5116
- spawn_agent: "Task",
5117
- wait_agent: "Task",
5006
+ spawn_agent: "Mason",
5007
+ wait_agent: "Mason",
5118
5008
  list_agents: "Agents",
5119
5009
  todo: "Todo",
5120
5010
  load_skill: "Skill",
@@ -5126,11 +5016,11 @@ var TOOL_INVOCATION_TITLES = {
5126
5016
  ask_user_question: "Question",
5127
5017
  enter_plan_mode: "Plan",
5128
5018
  exit_plan_mode: "Plan",
5129
- task_create: "Task",
5130
- task_list: "Task",
5131
- task_get: "Task",
5132
- task_update: "Task",
5133
- task_stop: "Task",
5019
+ task_create: "Mason",
5020
+ task_list: "Mason",
5021
+ task_get: "Mason",
5022
+ task_update: "Mason",
5023
+ task_stop: "Mason",
5134
5024
  list_mcp_resources: "MCP",
5135
5025
  read_mcp_resource: "MCP",
5136
5026
  cron_create: "Cron",
@@ -7370,6 +7260,10 @@ var globalContext = null;
7370
7260
  function initializeSkillContext(ctx) {
7371
7261
  globalContext = ctx;
7372
7262
  }
7263
+ function listAvailableSkills() {
7264
+ if (!globalContext?.skillLoader) return [];
7265
+ return globalContext.skillLoader.listAvailable();
7266
+ }
7373
7267
  async function loadSkill(args) {
7374
7268
  const { skill_name } = args;
7375
7269
  if (!skill_name || typeof skill_name !== "string") {
@@ -8503,7 +8397,9 @@ async function sendMessage(args) {
8503
8397
  error: `Worker session ${to} is ${workerSession.status}, cannot send follow-up`
8504
8398
  };
8505
8399
  }
8400
+ ensureMailbox(to);
8506
8401
  const messageId = sendFollowUp(to, process.env.BLUMA_SESSION_ID || "unknown", message2, waitForAck);
8402
+ sendSignal(to, "progress", { event: "new_message", messageId });
8507
8403
  if (waitForAck) {
8508
8404
  const ackResult = await waitForAckSignal(to, messageId, ackTimeout);
8509
8405
  if (!ackResult.acknowledged) {
@@ -15708,7 +15604,7 @@ var BluMaAgent = class {
15708
15604
  tool_name: toolName,
15709
15605
  arguments: toolArgs,
15710
15606
  preview: previewContent,
15711
- suppress_edit_diff_preview: false,
15607
+ suppress_edit_diff_preview: toolName === "edit_tool",
15712
15608
  tool_policy: this.buildToolPolicyForUi(toolName, toolArgs)
15713
15609
  });
15714
15610
  try {
@@ -18424,9 +18320,6 @@ function ChatTurnDuration({ durationMs }) {
18424
18320
  /* @__PURE__ */ jsx12(Text12, { color: BLUMA_TERMINAL.magenta, children: formatTurnDurationMs(durationMs) })
18425
18321
  ] }) });
18426
18322
  }
18427
- function TerminalRule({ width = 48 }) {
18428
- return /* @__PURE__ */ jsx12(Text12, { dimColor: true, children: "\u2500".repeat(Math.max(8, width)) });
18429
- }
18430
18323
 
18431
18324
  // src/app/ui/utils/expandablePreviewStore.ts
18432
18325
  var latest = null;
@@ -18703,10 +18596,10 @@ var ToolResultDisplayComponent = ({
18703
18596
  ] }) });
18704
18597
  }
18705
18598
  if (toolName.includes("spawn_agent") && parsed) {
18706
- 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" }) });
18707
18600
  }
18708
18601
  if (toolName.includes("wait_agent") && parsed) {
18709
- 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" }) });
18710
18603
  }
18711
18604
  if (toolName.includes("list_agents") && parsed) {
18712
18605
  return /* @__PURE__ */ jsx13(ResultGutter, { children: /* @__PURE__ */ jsx13(Text13, { dimColor: true, children: "Listed agents" }) });
@@ -19032,49 +18925,514 @@ var SessionInfoConnectingMCP = ({
19032
18925
  var SessionInfoConnectingMCP_default = SessionInfoConnectingMCP;
19033
18926
 
19034
18927
  // src/app/ui/components/SlashCommands.tsx
19035
- import { Box as Box17, Text as Text16 } from "ink";
19036
- 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";
19037
18930
 
19038
18931
  // src/app/ui/constants/historyLayout.ts
19039
18932
  var HEADER_PANEL_HISTORY_ID = 0;
19040
18933
 
19041
- // src/app/agent/runtime/session_view.ts
19042
- function isProcessAlive(pid) {
19043
- if (!pid || pid <= 0) return false;
19044
- try {
19045
- process.kill(pid, 0);
19046
- return true;
19047
- } catch {
19048
- 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}`);
19049
18984
  }
19050
- }
19051
- function formatSessionLine(session) {
19052
- return `${session.sessionId} ${session.kind} ${session.status} ${session.updatedAt} ${session.title}`;
19053
- }
19054
- function formatLogLine(line) {
19055
- try {
19056
- const parsed = JSON.parse(line);
19057
- const ts = parsed.timestamp || (/* @__PURE__ */ new Date()).toISOString();
19058
- if (parsed.event_type === "log") {
19059
- 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";
19060
19180
  }
19061
- if (parsed.event_type === "backend_message") {
19062
- 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;
19063
19193
  }
19064
- if (parsed.event_type === "action_status") {
19065
- 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();
19066
19315
  }
19067
- if (parsed.event_type === "result") {
19068
- 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();
19069
19329
  }
19070
- } catch {
19330
+ agentRef.current.processTurn({ content: `/effort ${effort}` }).catch(console.error);
19071
19331
  }
19072
- return line;
19073
- }
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
+ };
19074
19395
 
19075
- // src/app/ui/components/SlashCommands.tsx
19076
- init_session_registry();
19396
+ // src/app/ui/components/slash-commands/renderers/permissionRenderers.tsx
19397
+ import { Box as Box21, Text as Text20 } from "ink";
19077
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";
19078
19436
 
19079
19437
  // src/app/agent/runtime/diagnostics.ts
19080
19438
  init_runtime_config();
@@ -19127,975 +19485,612 @@ function buildDiagnosticsSnapshot(feedbackScore) {
19127
19485
  };
19128
19486
  }
19129
19487
 
19130
- // src/app/ui/components/SlashCommands.tsx
19131
- init_runtime_config();
19132
- import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
19133
- var COMMAND_HEADER_COLOR = BLUMA_TERMINAL.accent;
19134
- var RECOMMENDED_MODELS = [
19135
- "auto",
19136
- "auto"
19137
- ];
19138
- var SessionLivePanel = ({ sessionId, mode }) => {
19139
- const [session, setSession] = useState5(() => getSession(sessionId));
19140
- const [logs, setLogs] = useState5(() => readSessionLog(sessionId));
19141
- useEffect6(() => {
19142
- const sync = () => {
19143
- setSession(getSession(sessionId));
19144
- setLogs(readSessionLog(sessionId));
19145
- };
19146
- sync();
19147
- const interval = setInterval(sync, 1e3);
19148
- return () => clearInterval(interval);
19149
- }, [sessionId]);
19150
- if (!session) {
19151
- return /* @__PURE__ */ jsx18(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs16(Box17, { paddingLeft: 1, flexDirection: "column", children: [
19152
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: mode }),
19153
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19154
- "Unknown session: ",
19155
- sessionId
19156
- ] })
19157
- ] }) });
19158
- }
19159
- const alive = session.status === "running" ? isProcessAlive(session.pid) : false;
19160
- const recent = logs.slice(-16);
19161
- return /* @__PURE__ */ jsx18(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs16(Box17, { paddingLeft: 1, flexDirection: "column", children: [
19162
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19163
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: mode }),
19164
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19165
- " \xB7 ",
19166
- 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
19167
19506
  ] }),
19168
- /* @__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,
19169
19513
  " \xB7 ",
19170
- alive ? "live" : session.status
19171
- ] })
19172
- ] }),
19173
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: formatSessionLine(session) }),
19174
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19175
- "log: ",
19176
- session.logFile
19177
- ] }),
19178
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19179
- "bridge: bluma ",
19180
- mode,
19181
- " ",
19182
- session.sessionId
19183
- ] }),
19184
- /* @__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}`)) })
19185
- ] }) });
19186
- };
19187
- var SlashCommands = ({
19188
- input,
19189
- setHistory,
19190
- agentRef
19191
- }) => {
19192
- const [cmd, ...args] = input.slice(1).trim().split(/\s+/);
19193
- const clearAppliedRef = useRef4(false);
19194
- const outBox = (children) => /* @__PURE__ */ jsx18(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsx18(Box17, { paddingLeft: 1, flexDirection: "column", children }) });
19195
- const usageBox = (title, body) => outBox(
19196
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19197
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: title }),
19198
- /* @__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)) })
19199
19520
  ] })
19200
19521
  );
19201
- useEffect6(() => {
19202
- if ((cmd || "").toLowerCase() !== "clear" || clearAppliedRef.current) {
19203
- return;
19204
- }
19205
- clearAppliedRef.current = true;
19206
- setHistory((prev) => {
19207
- const header = prev.filter((item) => item.id === HEADER_PANEL_HISTORY_ID);
19208
- return [
19209
- ...header,
19210
- {
19211
- id: Date.now(),
19212
- component: outBox(
19213
- /* @__PURE__ */ jsxs16(Box17, { children: [
19214
- /* @__PURE__ */ jsx18(Text16, { color: "green", children: "[ok]" }),
19215
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " History cleared" })
19216
- ] })
19217
- )
19218
- }
19219
- ];
19220
- });
19221
- }, [cmd, input, setHistory]);
19222
- const showSessions = () => {
19223
- const sessions = listSessions();
19224
- if (sessions.length === 0) {
19225
- return usageBox("Sessions", "No sessions registered.");
19226
- }
19227
- return outBox(
19228
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19229
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19230
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Sessions" }),
19231
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19232
- " \xB7 ",
19233
- sessions.length,
19234
- " total"
19235
- ] })
19236
- ] }),
19237
- /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
19238
- sessions.slice(0, 12).map((session) => {
19239
- const alive = session.status === "running" ? isProcessAlive(session.pid) : false;
19240
- return /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", marginBottom: 1, children: [
19241
- /* @__PURE__ */ jsxs16(Text16, { color: BLUMA_TERMINAL.suggestion, bold: true, children: [
19242
- session.sessionId.slice(0, 8),
19243
- " ",
19244
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: alive ? "alive" : session.status })
19245
- ] }),
19246
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19247
- session.kind,
19248
- " \xB7 ",
19249
- session.updatedAt,
19250
- " \xB7 ",
19251
- session.title
19252
- ] }),
19253
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.workdir })
19254
- ] }, session.sessionId);
19255
- }),
19256
- sessions.length > 12 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19257
- "\u2026 +",
19258
- sessions.length - 12,
19259
- " more"
19260
- ] }) : null
19261
- ] })
19262
- ] })
19263
- );
19264
- };
19265
- const showSessionStatus = (sessionId) => {
19266
- const session = getSession(sessionId);
19267
- if (!session) {
19268
- return usageBox("Status", `Unknown session: ${sessionId}`);
19269
- }
19270
- const alive = session.status === "running" ? isProcessAlive(session.pid) : false;
19271
- return outBox(
19272
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19273
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session status" }),
19274
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.sessionId }),
19275
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19276
- session.kind,
19277
- " \xB7 ",
19278
- 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: [
19279
19533
  " \xB7 ",
19280
- alive ? "alive" : "offline"
19281
- ] }),
19282
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.updatedAt }),
19283
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.workdir }),
19284
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: session.title })
19285
- ] })
19286
- );
19287
- };
19288
- const showSessionLogs = (sessionId) => {
19289
- const session = getSession(sessionId);
19290
- if (!session) {
19291
- return usageBox("Logs", `Unknown session: ${sessionId}`);
19292
- }
19293
- const logs = readSessionLog(sessionId);
19294
- const recent = logs.slice(-10);
19295
- return outBox(
19296
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19297
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19298
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Logs" }),
19299
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19300
- " \xB7 ",
19301
- session.sessionId.slice(0, 8)
19302
- ] })
19303
- ] }),
19304
- 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)) })
19305
- ] })
19306
- );
19307
- };
19308
- const killSession2 = (sessionId) => {
19309
- const session = getSession(sessionId);
19310
- if (!session) {
19311
- return usageBox("Kill", `Unknown session: ${sessionId}`);
19312
- }
19313
- if (session.status !== "running") {
19314
- return usageBox("Kill", `Session ${sessionId} is already ${session.status}.`);
19315
- }
19316
- if (!session.pid || !isProcessAlive(session.pid)) {
19317
- updateSession(sessionId, {
19318
- status: "cancelled",
19319
- metadata: { ...session.metadata, signal: "stale-process" }
19320
- });
19321
- return usageBox("Kill", `Session ${sessionId} marked as cancelled.`);
19322
- }
19323
- try {
19324
- process.kill(session.pid, "SIGTERM");
19325
- updateSession(sessionId, {
19326
- status: "cancelled",
19327
- metadata: { ...session.metadata, signal: "SIGTERM" }
19328
- });
19329
- return usageBox("Kill", `Sent SIGTERM to ${sessionId} (${session.pid}).`);
19330
- } catch (error) {
19331
- return usageBox("Kill", `Failed to kill ${sessionId}: ${String(error?.message || error)}`);
19332
- }
19333
- };
19334
- const showResumeHint = (sessionId) => usageBox(
19335
- "Resume",
19336
- `Use the CLI command for now: bluma resume ${sessionId}.`
19337
- );
19338
- const renderTasksSnapshot = () => {
19339
- const snapshot = buildTaskSnapshot();
19340
- const stats = snapshot.stats;
19341
- return outBox(
19342
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19343
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19344
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Tasks" }),
19345
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19346
- " \xB7 ",
19347
- stats.total,
19348
- " total \xB7 ",
19349
- stats.progress,
19350
- "%"
19351
- ] })
19352
- ] }),
19353
- snapshot.activeTask ? /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, flexDirection: "column", children: [
19354
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19355
- "active ",
19356
- snapshot.activeTask.mode,
19357
- " \xB7 ",
19358
- snapshot.activeTask.taskName
19359
- ] }),
19360
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: snapshot.activeTask.status }),
19361
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: snapshot.activeTask.summary || "No summary." })
19362
- ] }) : /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No active task." }),
19363
- /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", marginTop: 1, children: [
19364
- snapshot.tasks.slice(0, 12).map((task) => {
19365
- const done = task.status === "completed";
19366
- const prefix = done ? "\u25A0" : task.status === "in_progress" ? "\u25A3" : "\u25A1";
19367
- return /* @__PURE__ */ jsxs16(Text16, { dimColor: done, color: done ? BLUMA_TERMINAL.muted : void 0, children: [
19368
- prefix,
19369
- " #",
19370
- task.id,
19371
- " ",
19372
- task.description,
19373
- " ",
19374
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19375
- "(",
19376
- task.priority,
19377
- ")"
19378
- ] })
19379
- ] }, task.id);
19380
- }),
19381
- snapshot.tasks.length > 12 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19382
- "\u2026 +",
19383
- snapshot.tasks.length - 12,
19384
- " more"
19385
- ] }) : null
19386
- ] })
19387
- ] })
19388
- );
19389
- };
19390
- const renderPermissionsSnapshot = (toolName) => {
19391
- const policy = getSandboxPolicy();
19392
- const metadata = getAllNativeToolMetadata();
19393
- const commandSafety = toolName ? assessCommandSafety(toolName, policy) : null;
19394
- const decision = toolName ? decideToolExecution(toolName) : null;
19395
- const rc = getRuntimeConfig();
19396
- return outBox(
19397
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19398
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19399
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Permissions" }),
19400
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19401
- " \xB7 ",
19402
- policy.isSandbox ? "sandbox" : "local"
19403
- ] })
19404
- ] }),
19405
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19406
- "runtime permission mode: ",
19407
- rc.permissionMode
19408
- ] }),
19409
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19410
- "agent mode: ",
19411
- rc.agentMode
19412
- ] }),
19413
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19414
- "workspace: ",
19415
- policy.workspaceRoot
19416
- ] }),
19417
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19418
- "mode: ",
19419
- policy.mode
19420
- ] }),
19421
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19422
- "native tools: ",
19423
- metadata.length
19424
- ] }),
19425
- toolName ? /* @__PURE__ */ jsxs16(Box17, { marginTop: 1, flexDirection: "column", children: [
19426
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: BLUMA_TERMINAL.suggestion, children: getToolDisplayLabel(toolName) }),
19427
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: decision ? decision.autoApprove ? "auto-approve" : "confirm" : "unknown" }),
19428
- decision?.reason ? /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: decision.reason }) : null,
19429
- commandSafety?.reason ? /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: commandSafety.reason }) : null
19430
- ] }) : /* @__PURE__ */ jsxs16(Box17, { marginTop: 1, flexDirection: "column", children: [
19431
- metadata.slice(0, 8).map((tool) => {
19432
- const decisionForTool = decideToolExecution(tool.name);
19433
- return /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19434
- getToolDisplayLabel(tool.name),
19435
- " \xB7 ",
19436
- tool.category,
19437
- " \xB7 ",
19438
- tool.riskLevel,
19439
- " \xB7",
19440
- " ",
19441
- decisionForTool.autoApprove ? "auto" : "confirm"
19442
- ] }, tool.name);
19443
- }),
19444
- metadata.length > 8 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19445
- "\u2026 +",
19446
- metadata.length - 8,
19447
- " more"
19448
- ] }) : null
19449
- ] })
19450
- ] })
19451
- );
19452
- };
19453
- const renderRuntimeConfig = () => {
19454
- const cfg = getRuntimeConfig();
19455
- return outBox(
19456
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19457
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19458
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Runtime" }),
19459
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \xB7 model / effort" })
19460
- ] }),
19461
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19462
- "model: ",
19463
- cfg.model
19464
- ] }),
19465
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19466
- "effort: ",
19467
- cfg.reasoningEffort
19468
- ] }),
19469
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19470
- "style: ",
19471
- cfg.outputStyle
19472
- ] }),
19473
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19474
- "permission mode: ",
19475
- cfg.permissionMode
19476
- ] }),
19477
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19478
- "agent mode: ",
19479
- cfg.agentMode
19480
- ] }),
19481
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19482
- "features:",
19483
- " ",
19484
- Object.keys(cfg.features || {}).length ? Object.entries(cfg.features || {}).map(([k, v]) => `${k}=${v}`).join(", ") : "(none)"
19485
- ] }),
19486
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19487
- "sandbox: ",
19488
- cfg.sandboxEnabled ? "on" : "off"
19489
- ] }),
19490
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19491
- "worktree: ",
19492
- cfg.workspaceRoot
19493
- ] }),
19494
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19495
- "settings: ",
19496
- getRuntimeConfigPath()
19497
- ] }),
19498
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19499
- "config: ",
19500
- cfg.updatedAt
19534
+ plugin.name
19501
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"
19502
19560
  ] })
19503
- );
19504
- };
19505
- const renderStatusline = () => {
19506
- const cfg = getRuntimeConfig();
19507
- const policy = getSandboxPolicy();
19508
- const snapshot = buildTaskSnapshot();
19509
- const parts = [
19510
- `BluMa`,
19511
- cfg.model,
19512
- cfg.reasoningEffort,
19513
- cfg.outputStyle,
19514
- policy.isSandbox ? "sandbox" : "local",
19515
- snapshot.activeTask ? snapshot.activeTask.taskName : "idle",
19516
- `${snapshot.stats.completed}/${snapshot.stats.total}`
19517
- ];
19518
- return outBox(
19519
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19520
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Statusline" }),
19521
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: parts.filter(Boolean).join(" \xB7 ") })
19522
- ] })
19523
- );
19524
- };
19525
- const renderBridgePanel = () => {
19526
- const sessions = listSessions();
19527
- const running = sessions.filter((session) => session.status === "running");
19528
- return outBox(
19529
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19530
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19531
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Bridge" }),
19532
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19533
- " \xB7 ",
19534
- sessions.length,
19535
- " sessions"
19536
- ] })
19537
- ] }),
19538
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19539
- "current workspace: ",
19540
- getSandboxPolicy().workspaceRoot
19541
- ] }),
19542
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19543
- "running: ",
19544
- running.length
19545
- ] }),
19546
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "attach: bluma attach <session-id>" }),
19547
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "follow: bluma follow <session-id>" }),
19548
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "logs: bluma logs <session-id>" }),
19549
- /* @__PURE__ */ jsx18(Box17, { marginTop: 1, flexDirection: "column", children: sessions.slice(0, 8).map((session) => /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: formatSessionLine(session) }, session.sessionId)) })
19550
- ] })
19551
- );
19552
- };
19553
- const renderPlugins = () => {
19554
- const plugins = listPlugins();
19555
- const dirs = getPluginDirs();
19556
- return outBox(
19557
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19558
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19559
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Plugins" }),
19560
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19561
- " \xB7 ",
19562
- plugins.length,
19563
- " installed"
19564
- ] })
19565
- ] }),
19566
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19567
- "project: ",
19568
- dirs.project
19569
- ] }),
19570
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19571
- "global: ",
19572
- dirs.global
19573
- ] }),
19574
- /* @__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: [
19575
- plugin.name,
19576
- " \xB7 ",
19577
- plugin.source,
19578
- " \xB7 ",
19579
- plugin.manifest.version || "no version",
19580
- " \xB7 ",
19581
- plugin.manifest.description || "no description"
19582
- ] }, plugin.name)) })
19583
- ] })
19584
- );
19585
- };
19586
- const renderDiagnostics = () => {
19587
- const feedbackScore = agentRef.current?.getFeedbackScore?.();
19588
- const snapshot = buildDiagnosticsSnapshot(feedbackScore);
19589
- return outBox(
19590
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19591
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19592
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Diagnostics" }),
19593
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \xB7 health snapshot" })
19594
- ] }),
19595
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19596
- "model: ",
19597
- snapshot.runtime.model
19598
- ] }),
19599
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19600
- "effort: ",
19601
- snapshot.runtime.effort
19602
- ] }),
19603
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19604
- "style: ",
19605
- snapshot.runtime.style
19606
- ] }),
19607
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19608
- "permission: ",
19609
- snapshot.runtime.permissionMode
19610
- ] }),
19611
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19612
- "agent: ",
19613
- snapshot.runtime.agentMode
19614
- ] }),
19615
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19616
- "sandbox: ",
19617
- snapshot.runtime.sandbox
19618
- ] }),
19619
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19620
- "workspace: ",
19621
- snapshot.runtime.workspaceRoot
19622
- ] }),
19623
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19624
- "tasks: ",
19625
- snapshot.tasks.total,
19626
- " total \xB7 ",
19627
- snapshot.tasks.progress,
19628
- "% \xB7 active ",
19629
- snapshot.tasks.active || "none"
19630
- ] }),
19631
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19632
- "hooks: ",
19633
- 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: [
19634
19572
  " \xB7 ",
19635
- snapshot.hooks.events,
19636
- "/",
19637
- snapshot.hooks.maxEvents
19638
- ] }),
19639
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19640
- "plugins: ",
19641
- snapshot.plugins.total,
19642
- " total \xB7 ",
19643
- snapshot.plugins.project,
19644
- " project \xB7 ",
19645
- snapshot.plugins.global,
19646
- " global"
19647
- ] }),
19648
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19649
- "sessions: ",
19650
- snapshot.sessions.total,
19651
- " total \xB7 ",
19652
- snapshot.sessions.running,
19653
- " running \xB7 ",
19654
- snapshot.sessions.completed,
19655
- " completed \xB7 ",
19656
- snapshot.sessions.cancelled,
19657
- " cancelled \xB7 ",
19658
- snapshot.sessions.error,
19659
- " error"
19660
- ] }),
19661
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19662
- "feedback: ",
19663
- typeof snapshot.feedbackScore === "number" ? snapshot.feedbackScore.toFixed(1) : "n/a"
19664
- ] })
19665
- ] })
19666
- );
19667
- };
19668
- const renderPluginDetails = (name) => {
19669
- const plugin = getPlugin(name);
19670
- if (!plugin) {
19671
- return usageBox("Plugin", `Unknown plugin: ${name}`);
19672
- }
19673
- return outBox(
19674
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19675
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19676
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Plugin" }),
19677
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19678
- " \xB7 ",
19679
- plugin.name
19680
- ] })
19681
- ] }),
19682
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19683
- "source: ",
19684
- plugin.source
19685
- ] }),
19686
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19687
- "root: ",
19688
- plugin.root
19689
- ] }),
19690
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19691
- "manifest: ",
19692
- plugin.manifestPath
19693
- ] }),
19694
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19695
- "version: ",
19696
- plugin.manifest.version || "n/a"
19697
- ] }),
19698
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19699
- "entry: ",
19700
- plugin.manifest.entry || "n/a"
19701
- ] }),
19702
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19703
- "description: ",
19704
- plugin.manifest.description || "n/a"
19573
+ state.enabled ? "enabled" : "disabled"
19705
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"
19706
19669
  ] })
19707
- );
19708
- };
19709
- const renderHooks = () => {
19710
- const state = getHookState();
19711
- const recent = state.events.slice(-12).reverse();
19712
- return outBox(
19713
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19714
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19715
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Hooks" }),
19716
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19717
- " \xB7 ",
19718
- state.enabled ? "enabled" : "disabled"
19719
- ] })
19720
- ] }),
19721
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19722
- "state: ",
19723
- getHookStatePath()
19724
- ] }),
19725
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19726
- "max events: ",
19727
- state.maxEvents
19728
- ] }),
19729
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19730
- "stored: ",
19731
- state.events.length
19732
- ] }),
19733
- /* @__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)) })
19734
- ] })
19735
- );
19736
- };
19737
- const runHooksCommand = (rest) => {
19738
- const sub = (rest[0] || "").toLowerCase();
19739
- if (!sub || sub === "list" || sub === "show") {
19740
- return renderHooks();
19741
- }
19742
- if (sub === "on") {
19743
- const next = setHookState({ enabled: true });
19744
- return usageBox("Hooks", `Hooks enabled (${next.events.length} stored events).`);
19745
- }
19746
- if (sub === "off") {
19747
- const next = setHookState({ enabled: false });
19748
- return usageBox("Hooks", `Hooks disabled (${next.events.length} stored events).`);
19749
- }
19750
- if (sub === "clear") {
19751
- const next = clearHookEvents();
19752
- 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();
19753
19680
  }
19754
- if (sub === "max") {
19755
- const value = Number(rest[1]);
19756
- if (!Number.isFinite(value) || value <= 0) {
19757
- return usageBox("Hooks", "Usage: /hooks max <positive-number>");
19758
- }
19759
- const next = setHookState({ maxEvents: value });
19760
- 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();
19761
19692
  }
19762
- return usageBox("Hooks", `Unknown subcommand: ${sub}`);
19763
- };
19764
- const runAttachCommand = (rest) => {
19765
- const sessionId = rest[0];
19766
- if (!sessionId) {
19767
- 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();
19768
19703
  }
19769
- return /* @__PURE__ */ jsx18(SessionLivePanel, { sessionId, mode: "attach" });
19770
- };
19771
- const runFollowCommand = (rest) => {
19772
- const sessionId = rest[0];
19773
- if (!sessionId) {
19774
- 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();
19775
19715
  }
19776
- return /* @__PURE__ */ jsx18(SessionLivePanel, { sessionId, mode: "follow" });
19777
- };
19778
- const runPluginsCommand = (rest) => {
19779
- const sub = (rest[0] || "").toLowerCase();
19780
- if (!sub || sub === "list" || sub === "show") {
19781
- 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();
19782
19725
  }
19783
- if (sub === "refresh") {
19784
- 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();
19785
19735
  }
19786
- if (sub === "paths") {
19787
- const dirs = getPluginDirs();
19788
- return outBox(
19789
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19790
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Plugin paths" }),
19791
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19792
- "project: ",
19793
- dirs.project
19794
- ] }),
19795
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19796
- "global: ",
19797
- dirs.global
19798
- ] })
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"
19799
19767
  ] })
19800
- );
19801
- }
19802
- return usageBox("Plugins", `Unknown subcommand: ${sub}`);
19803
- };
19804
- const runDiagnosticsCommand = (rest) => {
19805
- const sub = (rest[0] || "").toLowerCase();
19806
- if (!sub || sub === "show" || sub === "status") {
19807
- return renderDiagnostics();
19808
- }
19809
- if (sub === "help") {
19810
- return usageBox("Diagnostics", "Usage: /diagnostics [show|status]");
19811
- }
19812
- return usageBox("Diagnostics", `Unknown subcommand: ${sub}`);
19813
- };
19814
- const runTasksCommand = (subcommand, rest) => {
19815
- if (!subcommand || subcommand === "list") {
19816
- return renderTasksSnapshot();
19817
- }
19818
- if (subcommand === "add") {
19819
- const description = rest.join(" ").trim();
19820
- if (!description) {
19821
- return usageBox("Tasks", "Usage: /tasks add <description>");
19822
- }
19823
- updateTaskStore((state) => {
19824
- state.tasks.push({
19825
- id: state.nextId++,
19826
- description,
19827
- status: "pending",
19828
- priority: "medium",
19829
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
19830
- });
19831
- });
19832
- return renderTasksSnapshot();
19833
- }
19834
- if (subcommand === "complete") {
19835
- const id = Number(rest[0]);
19836
- if (!Number.isFinite(id)) {
19837
- return usageBox("Tasks", "Usage: /tasks complete <id>");
19838
- }
19839
- updateTaskStore((state) => {
19840
- const task = state.tasks.find((item) => item.id === id);
19841
- if (task) {
19842
- task.status = "completed";
19843
- task.completedAt = (/* @__PURE__ */ new Date()).toISOString();
19844
- }
19845
- });
19846
- return renderTasksSnapshot();
19847
- }
19848
- if (subcommand === "update") {
19849
- const id = Number(rest[0]);
19850
- const description = rest.slice(1).join(" ").trim();
19851
- if (!Number.isFinite(id) || !description) {
19852
- return usageBox("Tasks", "Usage: /tasks update <id> <description>");
19853
- }
19854
- updateTaskStore((state) => {
19855
- const task = state.tasks.find((item) => item.id === id);
19856
- if (task) {
19857
- task.description = description;
19858
- }
19859
- });
19860
- return renderTasksSnapshot();
19861
- }
19862
- if (subcommand === "remove") {
19863
- const id = Number(rest[0]);
19864
- if (!Number.isFinite(id)) {
19865
- return usageBox("Tasks", "Usage: /tasks remove <id>");
19866
- }
19867
- updateTaskStore((state) => {
19868
- state.tasks = state.tasks.filter((task) => task.id !== id);
19869
- });
19870
- return renderTasksSnapshot();
19871
- }
19872
- if (subcommand === "clear") {
19873
- updateTaskStore((state) => {
19874
- state.tasks = state.tasks.filter((task) => task.status !== "completed");
19875
- });
19876
- return renderTasksSnapshot();
19877
- }
19878
- if (subcommand === "sync") {
19879
- void (async () => {
19880
- const result = await todo({
19881
- action: "sync",
19882
- tasks: rest.length > 0 ? rest.join(" ").split("|").map((item) => ({ description: item.trim(), isComplete: false })) : []
19883
- });
19884
- setHistory((prev) => prev.concat({
19885
- id: Date.now(),
19886
- component: outBox(
19887
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: formatTodoResult(result) })
19888
- )
19889
- }));
19890
- })();
19891
- return usageBox("Tasks", "Syncing tasks...");
19892
- }
19893
- return usageBox("Tasks", `Unknown subcommand: ${subcommand}`);
19894
- };
19895
- const runPlanCommand = (subcommand, rest) => {
19896
- if (!subcommand || subcommand === "show") {
19897
- return renderTasksSnapshot();
19898
- }
19899
- if (subcommand === "start") {
19900
- const taskName = rest[0];
19901
- const summary = rest.slice(1).join(" ").trim();
19902
- if (!taskName) {
19903
- return usageBox("Plan", "Usage: /plan start <task-name> [summary]");
19904
- }
19905
- void (async () => {
19906
- const result = await taskBoundary({
19907
- task_name: taskName,
19908
- mode: "PLANNING",
19909
- task_status: "active",
19910
- task_summary: summary || `Planning ${taskName}`
19911
- });
19912
- setHistory((prev) => prev.concat({
19913
- id: Date.now(),
19914
- component: outBox(
19915
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19916
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: result.message }),
19917
- result.activeTask ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19918
- result.activeTask.mode,
19919
- " \xB7 ",
19920
- result.activeTask.taskName,
19921
- " \xB7 ",
19922
- result.activeTask.status
19923
- ] }) : null
19924
- ] })
19925
- )
19926
- }));
19927
- })();
19928
- return usageBox("Plan", `Starting plan: ${taskName}`);
19929
- }
19930
- if (subcommand === "end") {
19931
- void (async () => {
19932
- const result = await endTask();
19933
- setHistory((prev) => prev.concat({
19934
- id: Date.now(),
19935
- component: usageBox("Plan", result.message)
19936
- }));
19937
- })();
19938
- return usageBox("Plan", "Ending active plan...");
19939
- }
19940
- return usageBox("Plan", `Unknown subcommand: ${subcommand}`);
19941
- };
19942
- const runModelCommand = (rest) => {
19943
- const value = rest.join(" ").trim();
19944
- if (!value) {
19945
- return renderRuntimeConfig();
19946
- }
19947
- if (value.toLowerCase() === "list") {
19948
- return outBox(
19949
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19950
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
19951
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Model picker" }),
19952
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \xB7 recommended" })
19953
- ] }),
19954
- /* @__PURE__ */ jsx18(Box17, { flexDirection: "column", children: RECOMMENDED_MODELS.map((model) => /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19955
- model === "auto" ? "current default" : "available",
19956
- " \xB7 ",
19957
- model
19958
- ] }, 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"
19959
19791
  ] })
19960
- );
19961
- }
19962
- const next = setRuntimeConfig({ model: value });
19963
- return outBox(
19964
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19965
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Model" }),
19966
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19967
- "set to ",
19968
- 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"
19969
19803
  ] })
19970
19804
  ] })
19971
- );
19972
- };
19973
- const runEffortCommand = (rest) => {
19974
- const value = rest.join(" ").trim().toLowerCase();
19975
- if (!value) {
19976
- return renderRuntimeConfig();
19977
- }
19978
- if (!["low", "medium", "high"].includes(value)) {
19979
- return usageBox("Effort", "Usage: /effort [low|medium|high]");
19980
- }
19981
- const next = setRuntimeConfig({ reasoningEffort: value });
19982
- return outBox(
19983
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
19984
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Effort" }),
19985
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
19986
- "set to ",
19987
- 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"
19988
19820
  ] })
19989
- ] })
19990
- );
19991
- };
19992
- const runStyleCommand = (rest) => {
19993
- const value = rest.join(" ").trim().toLowerCase();
19994
- if (!value) {
19995
- return renderRuntimeConfig();
19996
- }
19997
- if (!["default", "compact", "brief"].includes(value)) {
19998
- return usageBox("Style", "Usage: /style [default|compact|brief]");
19999
- }
20000
- const next = setRuntimeConfig({ outputStyle: value });
20001
- return outBox(
20002
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20003
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Style" }),
20004
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20005
- "set to ",
20006
- 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"
20007
19832
  ] })
20008
19833
  ] })
20009
- );
20010
- };
20011
- const runSandboxCommand = (rest) => {
20012
- const value = rest.join(" ").trim().toLowerCase();
20013
- if (!value) {
20014
- return renderRuntimeConfig();
20015
- }
20016
- if (!["on", "off"].includes(value)) {
20017
- return usageBox("Sandbox", "Usage: /sandbox [on|off]");
20018
- }
20019
- 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) {
20020
19935
  return outBox(
20021
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20022
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Sandbox" }),
20023
- /* @__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" })
20024
19939
  ] })
20025
19940
  );
20026
- };
20027
- const runWorktreeCommand = (rest) => {
20028
- const value = rest.join(" ").trim();
20029
- if (!value) {
20030
- 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;
20031
20064
  }
20032
- const next = setRuntimeConfig({ workspaceRoot: value });
20033
- return outBox(
20034
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20035
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Worktree" }),
20036
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: next.workspaceRoot })
20037
- ] })
20038
- );
20039
- };
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]);
20040
20082
  const render2 = () => {
20041
20083
  if (!cmd) {
20042
20084
  return null;
20043
20085
  }
20044
20086
  if (cmd === "help") {
20045
- const groups = getSlashCommandsByGroup();
20046
- return outBox(
20047
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20048
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
20049
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Slash commands \xB7 organized view" }),
20050
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20051
- " ",
20052
- "\xB7 type any command to execute; use /help",
20053
- " ",
20054
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: BLUMA_TERMINAL.suggestion, children: "<cmd>" }),
20055
- " ",
20056
- "for detail"
20057
- ] })
20058
- ] }),
20059
- /* @__PURE__ */ jsx18(TerminalRule, { width: 48 }),
20060
- /* @__PURE__ */ jsx18(Box17, { flexDirection: "column", marginTop: 1, children: groups.map((group) => /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, flexDirection: "column", children: [
20061
- /* @__PURE__ */ jsx18(Text16, { color: BLUMA_TERMINAL.suggestion, bold: true, children: group.label }),
20062
- /* @__PURE__ */ jsx18(Box17, { flexDirection: "column", marginTop: 0, children: group.commands.map((command) => /* @__PURE__ */ jsxs16(Box17, { flexDirection: "row", flexWrap: "wrap", children: [
20063
- /* @__PURE__ */ jsx18(Text16, { color: COMMAND_HEADER_COLOR, bold: true, children: command.name.padEnd(16, " ") }),
20064
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: command.description })
20065
- ] }, command.name)) })
20066
- ] }, group.category)) }),
20067
- /* @__PURE__ */ jsx18(TerminalRule, { width: 48 })
20068
- ] })
20069
- );
20087
+ return renderHelp();
20070
20088
  }
20071
20089
  if (cmd === "sessions") {
20072
- return showSessions();
20090
+ return renderSessionsSnapshot();
20073
20091
  }
20074
20092
  if (cmd === "agents") {
20075
- const entries = listSessions().filter((e) => e.kind === "agent");
20076
- if (entries.length === 0) {
20077
- return outBox(
20078
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20079
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Worker agents" }),
20080
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " No agent sessions in this CLI registry. Use the " }),
20081
- /* @__PURE__ */ jsx18(Text16, { bold: true, children: "spawn_agent" }),
20082
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " tool from chat, or " }),
20083
- /* @__PURE__ */ jsx18(Text16, { bold: true, children: "/agent coordinator" }),
20084
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " then ask the model to delegate." })
20085
- ] })
20086
- );
20087
- }
20088
- return outBox(
20089
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20090
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Worker agents" }),
20091
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20092
- " ",
20093
- entries.length,
20094
- " session(s)"
20095
- ] }),
20096
- /* @__PURE__ */ jsx18(Box17, { marginTop: 1, flexDirection: "column", children: entries.map((e) => /* @__PURE__ */ jsx18(Text16, { dimColor: true, wrap: "wrap", children: formatSessionLine(e) }, e.sessionId)) })
20097
- ] })
20098
- );
20093
+ return renderAgents();
20099
20094
  }
20100
20095
  if (cmd === "bridge") {
20101
20096
  return renderBridgePanel();
@@ -20105,23 +20100,41 @@ var SlashCommands = ({
20105
20100
  if (!sessionId) {
20106
20101
  return usageBox("Status", "Usage: /status <session-id>");
20107
20102
  }
20108
- return showSessionStatus(sessionId);
20103
+ return renderSessionStatus(sessionId);
20109
20104
  }
20110
20105
  if (cmd === "logs") {
20111
20106
  const sessionId = args[0];
20112
20107
  if (!sessionId) {
20113
20108
  return usageBox("Logs", "Usage: /logs <session-id>");
20114
20109
  }
20115
- return showSessionLogs(sessionId);
20110
+ return renderSessionLogs(sessionId);
20116
20111
  }
20117
20112
  if (cmd === "attach") {
20118
- return runAttachCommand(args);
20113
+ const sessionId = args[0];
20114
+ if (!sessionId) {
20115
+ return usageBox("Attach", "Usage: /attach <session-id>");
20116
+ }
20117
+ return renderAttach(sessionId);
20119
20118
  }
20120
20119
  if (cmd === "follow") {
20121
- return runFollowCommand(args);
20120
+ const sessionId = args[0];
20121
+ if (!sessionId) {
20122
+ return usageBox("Follow", "Usage: /follow <session-id>");
20123
+ }
20124
+ return renderFollow(sessionId);
20122
20125
  }
20123
20126
  if (cmd === "plugins") {
20124
- 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}`);
20125
20138
  }
20126
20139
  if (cmd === "plugin") {
20127
20140
  const name = args[0];
@@ -20131,37 +20144,136 @@ var SlashCommands = ({
20131
20144
  return renderPluginDetails(name);
20132
20145
  }
20133
20146
  if (cmd === "diagnostics") {
20134
- 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}`);
20135
20155
  }
20136
20156
  if (cmd === "kill") {
20137
20157
  const sessionId = args[0];
20138
20158
  if (!sessionId) {
20139
20159
  return usageBox("Kill", "Usage: /kill <session-id>");
20140
20160
  }
20141
- return killSession2(sessionId);
20161
+ return renderKill(sessionId);
20142
20162
  }
20143
20163
  if (cmd === "resume") {
20144
20164
  const sessionId = args[0];
20145
20165
  if (!sessionId) {
20146
20166
  return usageBox("Resume", "Usage: /resume <session-id>");
20147
20167
  }
20148
- return showResumeHint(sessionId);
20168
+ return renderResume(sessionId);
20149
20169
  }
20150
20170
  if (cmd === "tasks") {
20151
- 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}`);
20152
20223
  }
20153
20224
  if (cmd === "plan") {
20154
- 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}`);
20155
20271
  }
20156
20272
  if (cmd === "permissions") {
20157
20273
  const sub = (args[0] || "").toLowerCase();
20158
20274
  const modes = ["default", "plan", "accept_edits"];
20159
20275
  if (modes.includes(sub)) {
20160
- const next = setRuntimeConfig({ permissionMode: sub });
20161
- return usageBox(
20162
- "Permissions",
20163
- `permissionMode=${next.permissionMode} (system prompt refreshes on next BluMa start or /init).`
20164
- );
20276
+ return runPermissionSet(agentRef, sub);
20165
20277
  }
20166
20278
  return renderPermissionsSnapshot(args[0]);
20167
20279
  }
@@ -20169,19 +20281,9 @@ var SlashCommands = ({
20169
20281
  const sub = (args[0] || "").toLowerCase();
20170
20282
  const modes = ["default", "coordinator"];
20171
20283
  if (modes.includes(sub)) {
20172
- const next = setRuntimeConfig({ agentMode: sub });
20173
- return usageBox(
20174
- "Agent mode",
20175
- `agentMode=${next.agentMode} (restart session or /init for system prompt refresh).`
20176
- );
20284
+ return runAgentSet(agentRef, sub);
20177
20285
  }
20178
- const cfg = getRuntimeConfig();
20179
- return usageBox(
20180
- "Agent mode",
20181
- `current: ${cfg.agentMode}
20182
- set: /agent default | /agent coordinator
20183
- (list workers: /agents \u2014 not the same as /agent)`
20184
- );
20286
+ return renderAgentConfig();
20185
20287
  }
20186
20288
  if (cmd === "features") {
20187
20289
  const k = (args[0] || "").trim();
@@ -20192,85 +20294,79 @@ set: /agent default | /agent coordinator
20192
20294
  const cur = next.features[k];
20193
20295
  return usageBox("Features", `${k}=${cur} (also BLUMA_FEATURE_${k.toUpperCase()}=1)`);
20194
20296
  }
20195
- const cfg = getRuntimeConfig();
20196
- const keys = Object.keys(cfg.features || {});
20197
- const fromFile = keys.length > 0 ? keys.map((x) => ` ${x}: ${cfg.features[x]}`).join("\n") : " (none in settings.json)";
20198
- return usageBox(
20199
- "Features",
20200
- `${fromFile}
20201
- permission_ml effective: ${isFeatureEnabled("permission_ml")}
20202
- auto_dream effective: ${isFeatureEnabled("auto_dream")}
20203
- Usage: /features <key> on|off`
20204
- );
20297
+ return renderFeatures();
20205
20298
  }
20206
20299
  if (cmd === "model") {
20207
- 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);
20208
20308
  }
20209
20309
  if (cmd === "effort") {
20210
- 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);
20211
20318
  }
20212
20319
  if (cmd === "style") {
20213
- 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);
20214
20328
  }
20215
20329
  if (cmd === "sandbox") {
20216
- 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");
20217
20338
  }
20218
20339
  if (cmd === "worktree") {
20219
- return runWorktreeCommand(args);
20340
+ const value = args.join(" ").trim();
20341
+ if (!value) {
20342
+ return renderModelConfig();
20343
+ }
20344
+ return runWorktreeSet(agentRef, value);
20220
20345
  }
20221
20346
  if (cmd === "statusline") {
20222
20347
  return renderStatusline();
20223
20348
  }
20224
20349
  if (cmd === "hooks") {
20225
- 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}`);
20226
20367
  }
20227
20368
  if (cmd === "skills") {
20228
- const list = agentRef.current?.listAvailableSkills?.() || [];
20229
- const dirs = agentRef.current?.getSkillsDirs?.();
20230
- const conflicts = agentRef.current?.getSkillConflictWarnings?.() || [];
20231
- return outBox(
20232
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20233
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
20234
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Skills (load_skill)" }),
20235
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20236
- " \xB7 ",
20237
- list.length,
20238
- " available"
20239
- ] })
20240
- ] }),
20241
- dirs ? /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, flexDirection: "column", children: [
20242
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20243
- "bundled: ",
20244
- String(dirs.bundled || "")
20245
- ] }),
20246
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20247
- "project: ",
20248
- String(dirs.project || "")
20249
- ] }),
20250
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20251
- "global: ",
20252
- String(dirs.global || "")
20253
- ] })
20254
- ] }) : null,
20255
- conflicts.length > 0 ? /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, flexDirection: "column", children: [
20256
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: BLUMA_TERMINAL.suggestion, children: "conflicts" }),
20257
- conflicts.slice(0, 6).map((warning, i) => /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: warning }, i)),
20258
- conflicts.length > 6 ? /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20259
- "\u2026 +",
20260
- conflicts.length - 6,
20261
- " more"
20262
- ] }) : null
20263
- ] }) : null,
20264
- 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: [
20265
- /* @__PURE__ */ jsx18(Text16, { color: BLUMA_TERMINAL.suggestion, bold: true, children: s.name }),
20266
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20267
- s.source,
20268
- " \u2014 ",
20269
- s.description || "\u2014"
20270
- ] })
20271
- ] }, i)) })
20272
- ] })
20273
- );
20369
+ return renderSkills();
20274
20370
  }
20275
20371
  if (cmd === "clear") {
20276
20372
  return null;
@@ -20279,288 +20375,39 @@ Usage: /features <key> on|off`
20279
20375
  return null;
20280
20376
  }
20281
20377
  if (cmd === "mcp") {
20282
- const all = agentRef.current?.getUiToolsDetailed?.() || agentRef.current?.getAvailableTools?.() || [];
20283
- const isMcp = (t) => t.source?.toLowerCase?.() === "mcp" || !!t.server && t.server !== "native";
20284
- const tools = all.filter(isMcp);
20285
20378
  const term = (args?.[0] || "").toLowerCase();
20286
- const filtered = term ? tools.filter((t) => (t.function?.name || t.name || "tool").toLowerCase().includes(term)) : tools;
20287
- const pad = (s, n) => s.length >= n ? s.slice(0, n - 1) + "\u2026" : s.padEnd(n, " ");
20288
- const colName = 34;
20289
- const colType = 10;
20290
- const colSource = 18;
20291
- return outBox(
20292
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20293
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
20294
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "MCP Tools" }),
20295
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 " }),
20296
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20297
- tools.length,
20298
- " total"
20299
- ] }),
20300
- term && /* @__PURE__ */ jsxs16(Fragment6, { children: [
20301
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 filter: " }),
20302
- /* @__PURE__ */ jsxs16(Text16, { color: BLUMA_TERMINAL.suggestion, children: [
20303
- '"',
20304
- term,
20305
- '"'
20306
- ] }),
20307
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20308
- " \u2022 showing: ",
20309
- filtered.length
20310
- ] })
20311
- ] })
20312
- ] }),
20313
- filtered.length === 0 ? /* @__PURE__ */ jsx18(Text16, { color: "yellow", children: "No MCP tools found" }) : /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
20314
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
20315
- pad("Name", colName),
20316
- " \u2502 ",
20317
- pad("Type", colType),
20318
- " \u2502 ",
20319
- pad("Source", colSource)
20320
- ] }) }),
20321
- /* @__PURE__ */ jsx18(Text16, { color: "gray", children: "\u2500".repeat(colName + colType + colSource + 6) }),
20322
- filtered.map((t, i) => {
20323
- const name = t.function?.name || t.name || "tool";
20324
- const type = t.function?.name ? "fn" : t.type || "tool";
20325
- const source = t.source || t.provider || "mcp";
20326
- return /* @__PURE__ */ jsxs16(Text16, { color: "white", children: [
20327
- pad(name, colName),
20328
- " \u2502 ",
20329
- pad(String(type), colType),
20330
- " \u2502 ",
20331
- pad(String(source), colSource)
20332
- ] }, i);
20333
- })
20334
- ] })
20335
- ] })
20336
- );
20379
+ return renderMcp(term);
20337
20380
  }
20338
20381
  if (cmd === "tools") {
20339
- const all = agentRef.current?.getUiToolsDetailed?.() || agentRef.current?.getAvailableTools?.() || [];
20340
- const isMcp = (t) => t.source?.toLowerCase?.() === "mcp" || !!t.server && t.server !== "native";
20341
- const tools = all.filter((t) => !isMcp(t));
20342
20382
  const term = (args?.[0] || "").toLowerCase();
20343
- const filtered = term ? tools.filter((t) => (t.function?.name || t.name || "tool").toLowerCase().includes(term)) : tools;
20344
- const pad = (s, n) => s.length >= n ? s.slice(0, n - 1) + "\u2026" : s.padEnd(n, " ");
20345
- const colName = 34;
20346
- const colType = 10;
20347
- const colSource = 18;
20348
- return outBox(
20349
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20350
- /* @__PURE__ */ jsx18(Text16, { color: COMMAND_HEADER_COLOR, bold: true, children: "Native Tools" }),
20351
- /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
20352
- "Total Native: ",
20353
- tools.length,
20354
- term ? ` | Filter: "${term}" | Showing: ${filtered.length}` : ""
20355
- ] }),
20356
- filtered.length === 0 ? /* @__PURE__ */ jsx18(Text16, { color: "yellow", children: "No native tools to display." }) : /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
20357
- /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
20358
- pad("Name", colName),
20359
- " | ",
20360
- pad("Type", colType),
20361
- " | ",
20362
- pad("Source", colSource)
20363
- ] }),
20364
- /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
20365
- "".padEnd(colName, "-"),
20366
- "---",
20367
- "".padEnd(colType, "-"),
20368
- "---",
20369
- "".padEnd(colSource, "-")
20370
- ] }),
20371
- filtered.map((t, i) => {
20372
- const name = t.function?.name || t.name || "tool";
20373
- const type = t.function?.name ? "fn" : t.type || "tool";
20374
- const source = t.source || "native";
20375
- return /* @__PURE__ */ jsxs16(Text16, { color: "white", children: [
20376
- pad(name, colName),
20377
- " | ",
20378
- pad(String(type), colType),
20379
- " | ",
20380
- pad(String(source), colSource)
20381
- ] }, i);
20382
- })
20383
- ] })
20384
- ] })
20385
- );
20383
+ return renderTools(term);
20386
20384
  }
20387
20385
  if (cmd === "debug-workers") {
20388
- const agents = agentRef.current?.agents || [];
20389
- const running = agents.filter((a) => a.status === "running");
20390
- const completed = agents.filter((a) => a.status === "completed");
20391
- const errored = agents.filter((a) => a.status === "error");
20392
- return outBox(
20393
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20394
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Debug Workers" }),
20395
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20396
- "Total: ",
20397
- agents.length,
20398
- " | Running: ",
20399
- running.length,
20400
- " | Completed: ",
20401
- completed.length,
20402
- " | Errors: ",
20403
- errored.length
20404
- ] }),
20405
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20406
- "Memory: ",
20407
- Math.round(process.memoryUsage().heapUsed / 1024 / 1024),
20408
- "MB heap"
20409
- ] }),
20410
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "EventBus listeners: N/A" }),
20411
- running.length > 0 && /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", marginTop: 1, children: [
20412
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: "green", children: "Running Workers:" }),
20413
- running.map((w) => /* @__PURE__ */ jsxs16(Text16, { color: "white", children: [
20414
- w.session_id.slice(0, 8),
20415
- "... ",
20416
- w.title,
20417
- " (PID: ",
20418
- w.pid || "N/A",
20419
- ")"
20420
- ] }, w.session_id))
20421
- ] })
20422
- ] })
20423
- );
20386
+ return renderDebugWorkers();
20424
20387
  }
20425
20388
  if (cmd === "compact") {
20426
- return outBox(
20427
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20428
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Context Compaction" }),
20429
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Auto-compact triggers at 180k tokens (threshold: 150k micro, 180k full)" }),
20430
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Target after compact: 100k tokens" }),
20431
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /compact to manually trigger context compaction." })
20432
- ] })
20433
- );
20389
+ return renderCompact();
20434
20390
  }
20435
20391
  if (cmd === "cost") {
20436
- return outBox(
20437
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20438
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session Cost" }),
20439
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Cost tracking is available via /stats for detailed session statistics." })
20440
- ] })
20441
- );
20392
+ return renderCost();
20442
20393
  }
20443
20394
  if (cmd === "export") {
20444
- return outBox(
20445
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20446
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Export Session" }),
20447
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Session logs are stored in ~/.bluma/sessions/" }),
20448
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /logs to view recent logs for a session." })
20449
- ] })
20450
- );
20395
+ return renderExport();
20451
20396
  }
20452
20397
  if (cmd === "memory") {
20453
- return outBox(
20454
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20455
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session Memory" }),
20456
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Memories are auto-extracted from conversations and stored in ~/.bluma/session_memory.json" }),
20457
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Relevant memories are injected into context automatically." })
20458
- ] })
20459
- );
20398
+ return renderMemory();
20460
20399
  }
20461
20400
  if (cmd === "stats") {
20462
- const mem = process.memoryUsage();
20463
- return outBox(
20464
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20465
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Session Statistics" }),
20466
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20467
- "Heap: ",
20468
- Math.round(mem.heapUsed / 1024 / 1024),
20469
- "MB / ",
20470
- Math.round(mem.heapTotal / 1024 / 1024),
20471
- "MB"
20472
- ] }),
20473
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20474
- "RSS: ",
20475
- Math.round(mem.rss / 1024 / 1024),
20476
- "MB"
20477
- ] }),
20478
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20479
- "Uptime: ",
20480
- Math.round(process.uptime()),
20481
- "s"
20482
- ] }),
20483
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20484
- "Node: ",
20485
- process.version
20486
- ] }),
20487
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20488
- "Platform: ",
20489
- process.platform,
20490
- " (",
20491
- process.arch,
20492
- ")"
20493
- ] })
20494
- ] })
20495
- );
20401
+ return renderStats();
20496
20402
  }
20497
20403
  if (cmd === "theme") {
20498
- const themesModule = (init_themes(), __toCommonJS(themes_exports));
20499
- const themes = themesModule.listThemes();
20500
- const currentTheme = args[0];
20501
- if (currentTheme) {
20502
- const theme = themesModule.getTheme(currentTheme.toLowerCase().replace(/\s+/g, "_"));
20503
- if (!theme) {
20504
- return usageBox("Theme", `Unknown theme: ${currentTheme}. Available: ${themes.map((t) => t.name).join(", ")}`);
20505
- }
20506
- return outBox(
20507
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20508
- /* @__PURE__ */ jsxs16(Text16, { bold: true, color: "green", children: [
20509
- "Theme set to: ",
20510
- theme.name
20511
- ] }),
20512
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20513
- "Background: ",
20514
- theme.colors.background
20515
- ] }),
20516
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20517
- "Foreground: ",
20518
- theme.colors.foreground
20519
- ] }),
20520
- /* @__PURE__ */ jsxs16(Text16, { dimColor: true, children: [
20521
- "Accent: ",
20522
- theme.colors.accent
20523
- ] })
20524
- ] })
20525
- );
20526
- }
20527
- return outBox(
20528
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20529
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Available Themes" }),
20530
- themes.map((t) => /* @__PURE__ */ jsxs16(Text16, { color: "white", children: [
20531
- " ",
20532
- t.name,
20533
- " \u2014 ",
20534
- t.description
20535
- ] }, t.name))
20536
- ] })
20537
- );
20404
+ return renderTheme();
20538
20405
  }
20539
20406
  if (cmd === "keybindings") {
20540
- return outBox(
20541
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20542
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Keybindings" }),
20543
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Custom keybindings are configured in ~/.bluma/settings.json" }),
20544
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " Ctrl+V / Cmd+V \u2014 Paste image or text" }),
20545
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " Ctrl+Shift+I \u2014 Paste image" }),
20546
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " Escape \u2014 Cancel / exit vim mode" }),
20547
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " : \u2014 Enter vim command mode" })
20548
- ] })
20549
- );
20407
+ return renderKeybindings();
20550
20408
  }
20551
20409
  if (cmd === "vim") {
20552
- return outBox(
20553
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20554
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Vim Mode" }),
20555
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Vim mode provides normal/insert/command modes." }),
20556
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " Escape \u2014 Switch to normal mode" }),
20557
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " i/a/o \u2014 Switch to insert mode" }),
20558
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " : \u2014 Enter command mode" }),
20559
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " h/j/k/l \u2014 Basic motions" }),
20560
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " w/b \u2014 Word motions" }),
20561
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " d/c/y \u2014 Delete/change/yank operators" })
20562
- ] })
20563
- );
20410
+ return renderVim();
20564
20411
  }
20565
20412
  if (cmd === "commit") {
20566
20413
  (async () => {
@@ -20612,7 +20459,7 @@ Report the commit hash and summary when done.`;
20612
20459
  setHistory((prev) => prev.concat({
20613
20460
  id: Date.now(),
20614
20461
  component: outBox(
20615
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20462
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
20616
20463
  "Failed to execute /commit: ",
20617
20464
  e?.message || String(e)
20618
20465
  ] }) })
@@ -20706,7 +20553,7 @@ Report the PR URL, number, title, and summary when done.`;
20706
20553
  setHistory((prev) => prev.concat({
20707
20554
  id: Date.now(),
20708
20555
  component: outBox(
20709
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20556
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
20710
20557
  "Failed to execute /pr: ",
20711
20558
  e?.message || String(e)
20712
20559
  ] }) })
@@ -20867,7 +20714,7 @@ Report the release version, tag, changelog summary, and verification results whe
20867
20714
  setHistory((prev) => prev.concat({
20868
20715
  id: Date.now(),
20869
20716
  component: outBox(
20870
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20717
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
20871
20718
  "Failed to execute /release: ",
20872
20719
  e?.message || String(e)
20873
20720
  ] }) })
@@ -20878,18 +20725,18 @@ Report the release version, tag, changelog summary, and verification results whe
20878
20725
  const bumpType = args.find((a) => ["major", "minor", "patch", "premajor", "preminor", "prepatch", "prerelease"].includes(a)) || "auto-detect";
20879
20726
  const dryRun = args.includes("--dry-run") || args.includes("--dryrun");
20880
20727
  return outBox(
20881
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
20882
- /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
20883
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Release" }),
20884
- /* @__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: [
20885
20732
  " \xB7 ",
20886
20733
  bumpType,
20887
20734
  dryRun ? " (dry-run)" : ""
20888
20735
  ] })
20889
20736
  ] }),
20890
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Running pre-release checks (tests, build, lint)..." }),
20891
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Analyzing commits, generating changelog, bumping version..." }),
20892
- /* @__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." })
20893
20740
  ] })
20894
20741
  );
20895
20742
  }
@@ -21076,7 +20923,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21076
20923
  setHistory((prev) => prev.concat({
21077
20924
  id: Date.now(),
21078
20925
  component: outBox(
21079
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20926
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21080
20927
  "Failed to execute /review: ",
21081
20928
  e?.message || String(e)
21082
20929
  ] }) })
@@ -21100,7 +20947,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21100
20947
  setHistory((prev) => prev.concat({
21101
20948
  id: Date.now(),
21102
20949
  component: outBox(
21103
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20950
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21104
20951
  "Failed to execute /ctx: ",
21105
20952
  e?.message || String(e)
21106
20953
  ] }) })
@@ -21124,7 +20971,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21124
20971
  setHistory((prev) => prev.concat({
21125
20972
  id: Date.now(),
21126
20973
  component: outBox(
21127
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20974
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21128
20975
  "Failed to execute /snip: ",
21129
20976
  e?.message || String(e)
21130
20977
  ] }) })
@@ -21144,7 +20991,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21144
20991
  setHistory((prev) => prev.concat({
21145
20992
  id: Date.now(),
21146
20993
  component: outBox(
21147
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
20994
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21148
20995
  "Failed to execute /dream: ",
21149
20996
  e?.message || String(e)
21150
20997
  ] }) })
@@ -21167,7 +21014,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21167
21014
  setHistory((prev) => prev.concat({
21168
21015
  id: Date.now(),
21169
21016
  component: outBox(
21170
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21017
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21171
21018
  "Failed to execute /collapse: ",
21172
21019
  e?.message || String(e)
21173
21020
  ] }) })
@@ -21181,12 +21028,12 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21181
21028
  const messageText = args?.join(" ") || "";
21182
21029
  if (!messageText) {
21183
21030
  return outBox(
21184
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21185
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/brief" }),
21186
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Send a structured message to the user." }),
21187
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /brief <message> [--proactive] [--attach file1 file2]" }),
21188
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " --proactive Mark as proactive notification" }),
21189
- /* @__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" })
21190
21037
  ] })
21191
21038
  );
21192
21039
  }
@@ -21209,7 +21056,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21209
21056
  setHistory((prev) => prev.concat({
21210
21057
  id: Date.now(),
21211
21058
  component: outBox(
21212
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21059
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21213
21060
  "Failed to execute /brief: ",
21214
21061
  e?.message || String(e)
21215
21062
  ] }) })
@@ -21229,7 +21076,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21229
21076
  setHistory((prev) => prev.concat({
21230
21077
  id: Date.now(),
21231
21078
  component: outBox(
21232
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21079
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21233
21080
  "Failed to execute /undo: ",
21234
21081
  e?.message || String(e)
21235
21082
  ] }) })
@@ -21249,7 +21096,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21249
21096
  setHistory((prev) => prev.concat({
21250
21097
  id: Date.now(),
21251
21098
  component: outBox(
21252
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21099
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21253
21100
  "Failed to execute /redo: ",
21254
21101
  e?.message || String(e)
21255
21102
  ] }) })
@@ -21269,7 +21116,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21269
21116
  setHistory((prev) => prev.concat({
21270
21117
  id: Date.now(),
21271
21118
  component: outBox(
21272
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21119
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21273
21120
  "Failed to execute /diff: ",
21274
21121
  e?.message || String(e)
21275
21122
  ] }) })
@@ -21283,10 +21130,10 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21283
21130
  const target = args.join(" ") || "";
21284
21131
  if (!target) {
21285
21132
  return outBox(
21286
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21287
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/explain" }),
21288
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Explain a file, function, or code snippet." }),
21289
- /* @__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]" })
21290
21137
  ] })
21291
21138
  );
21292
21139
  }
@@ -21299,7 +21146,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21299
21146
  setHistory((prev) => prev.concat({
21300
21147
  id: Date.now(),
21301
21148
  component: outBox(
21302
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21149
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21303
21150
  "Failed to execute /explain: ",
21304
21151
  e?.message || String(e)
21305
21152
  ] }) })
@@ -21320,7 +21167,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21320
21167
  setHistory((prev) => prev.concat({
21321
21168
  id: Date.now(),
21322
21169
  component: outBox(
21323
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21170
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21324
21171
  "Failed to execute /fix: ",
21325
21172
  e?.message || String(e)
21326
21173
  ] }) })
@@ -21334,10 +21181,10 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21334
21181
  const filePath = args.join(" ") || "";
21335
21182
  if (!filePath) {
21336
21183
  return outBox(
21337
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21338
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/editor" }),
21339
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Open a file in the external editor ($EDITOR or configured editor)." }),
21340
- /* @__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>" })
21341
21188
  ] })
21342
21189
  );
21343
21190
  }
@@ -21350,7 +21197,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21350
21197
  setHistory((prev) => prev.concat({
21351
21198
  id: Date.now(),
21352
21199
  component: outBox(
21353
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21200
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21354
21201
  "Failed to execute /editor: ",
21355
21202
  e?.message || String(e)
21356
21203
  ] }) })
@@ -21363,7 +21210,7 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21363
21210
  if (cmd === "config") {
21364
21211
  const sub = (args[0] || "").toLowerCase();
21365
21212
  if (!sub || sub === "show" || sub === "list") {
21366
- return renderRuntimeConfig();
21213
+ return renderModelConfig();
21367
21214
  }
21368
21215
  if (sub === "edit") {
21369
21216
  const key = args[1];
@@ -21375,7 +21222,8 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21375
21222
  return usageBox("Config", `Set ${key} = ${JSON.stringify(next[key] || value)}`);
21376
21223
  }
21377
21224
  if (sub === "path") {
21378
- return usageBox("Config", `Config file: ${getRuntimeConfigPath()}`);
21225
+ const { getRuntimeConfigPath: getRuntimeConfigPath2 } = (init_runtime_config(), __toCommonJS(runtime_config_exports));
21226
+ return usageBox("Config", `Config file: ${getRuntimeConfigPath2()}`);
21379
21227
  }
21380
21228
  return usageBox("Config", `Unknown subcommand: ${sub}. Use: show | edit <key> <value> | path`);
21381
21229
  }
@@ -21383,17 +21231,17 @@ Start coordinating now. Triage the changes, then spawn your 3 reviewers.`
21383
21231
  const description = args.join(" ") || "";
21384
21232
  if (!description) {
21385
21233
  return outBox(
21386
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21387
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/debug" }),
21388
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Debug Coordinator mode \u2014 spawn workers to investigate, fix & verify in parallel." }),
21389
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /debug <describe the problem, symptom, or error>" }),
21390
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " " }),
21391
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "The agent will:" }),
21392
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 Act as Debug Coordinator \u2014 orchestrate a team of workers" }),
21393
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 Spawn parallel researchers to investigate different hypotheses" }),
21394
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 Synthesize findings and direct the fix" }),
21395
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " \u2022 Spawn a fix worker + verification worker" }),
21396
- /* @__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" })
21397
21245
  ] })
21398
21246
  );
21399
21247
  }
@@ -21550,7 +21398,7 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
21550
21398
  setHistory((prev) => prev.concat({
21551
21399
  id: Date.now(),
21552
21400
  component: outBox(
21553
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21401
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21554
21402
  "Failed to execute /debug: ",
21555
21403
  e?.message || String(e)
21556
21404
  ] }) })
@@ -21564,10 +21412,10 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
21564
21412
  const description = args.join(" ") || "";
21565
21413
  if (!description) {
21566
21414
  return outBox(
21567
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21568
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/bug" }),
21569
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Alias for /debug \u2014 Debug Coordinator mode." }),
21570
- /* @__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)" })
21571
21419
  ] })
21572
21420
  );
21573
21421
  }
@@ -21724,7 +21572,7 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
21724
21572
  setHistory((prev) => prev.concat({
21725
21573
  id: Date.now(),
21726
21574
  component: outBox(
21727
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21575
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21728
21576
  "Failed to execute /bug: ",
21729
21577
  e?.message || String(e)
21730
21578
  ] }) })
@@ -21750,7 +21598,7 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
21750
21598
  setHistory((prev) => prev.concat({
21751
21599
  id: Date.now(),
21752
21600
  component: outBox(
21753
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21601
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21754
21602
  "Failed to execute /test: ",
21755
21603
  e?.message || String(e)
21756
21604
  ] }) })
@@ -21779,7 +21627,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21779
21627
  setHistory((prev) => prev.concat({
21780
21628
  id: Date.now(),
21781
21629
  component: outBox(
21782
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21630
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21783
21631
  "Failed to execute /optimize: ",
21784
21632
  e?.message || String(e)
21785
21633
  ] }) })
@@ -21793,10 +21641,10 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21793
21641
  const target = args.join(" ") || "";
21794
21642
  if (!target) {
21795
21643
  return outBox(
21796
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21797
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/refactor" }),
21798
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Refactor code to improve structure without changing behavior." }),
21799
- /* @__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>" })
21800
21648
  ] })
21801
21649
  );
21802
21650
  }
@@ -21815,7 +21663,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21815
21663
  setHistory((prev) => prev.concat({
21816
21664
  id: Date.now(),
21817
21665
  component: outBox(
21818
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21666
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21819
21667
  "Failed to execute /refactor: ",
21820
21668
  e?.message || String(e)
21821
21669
  ] }) })
@@ -21829,10 +21677,10 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21829
21677
  const target = args.join(" ") || "";
21830
21678
  if (!target) {
21831
21679
  return outBox(
21832
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21833
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/document" }),
21834
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Generate documentation for a file, module, or function." }),
21835
- /* @__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]" })
21836
21684
  ] })
21837
21685
  );
21838
21686
  }
@@ -21851,7 +21699,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21851
21699
  setHistory((prev) => prev.concat({
21852
21700
  id: Date.now(),
21853
21701
  component: outBox(
21854
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21702
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21855
21703
  "Failed to execute /document: ",
21856
21704
  e?.message || String(e)
21857
21705
  ] }) })
@@ -21877,7 +21725,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21877
21725
  setHistory((prev) => prev.concat({
21878
21726
  id: Date.now(),
21879
21727
  component: outBox(
21880
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21728
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21881
21729
  "Failed to execute /summarize: ",
21882
21730
  e?.message || String(e)
21883
21731
  ] }) })
@@ -21888,45 +21736,22 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21888
21736
  return null;
21889
21737
  }
21890
21738
  if (cmd === "chat") {
21891
- const next = setRuntimeConfig({ agentMode: "default" });
21892
- return outBox(
21893
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21894
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Chat Mode" }),
21895
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Switched to conversational chat mode." }),
21896
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "The agent will focus on conversation and will not execute code or edit files unless explicitly asked." }),
21897
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /code to switch back to code mode." })
21898
- ] })
21899
- );
21739
+ return renderChat();
21900
21740
  }
21901
21741
  if (cmd === "code") {
21902
- const next = setRuntimeConfig({ agentMode: "default" });
21903
- return outBox(
21904
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21905
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Code Mode" }),
21906
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Switched to code mode." }),
21907
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "The agent can now edit files, run commands, and execute code." }),
21908
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /chat to switch back to conversational mode." })
21909
- ] })
21910
- );
21742
+ return renderCode();
21911
21743
  }
21912
21744
  if (cmd === "terminal") {
21913
- return outBox(
21914
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21915
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Terminal" }),
21916
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Interactive terminal sessions are not yet supported as a slash command." }),
21917
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use the agent's shell_command tool directly in chat instead." }),
21918
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: 'Example: "run npm test and show me the output"' })
21919
- ] })
21920
- );
21745
+ return renderTerminal();
21921
21746
  }
21922
21747
  if (cmd === "file") {
21923
21748
  const filePath = args.join(" ") || "";
21924
21749
  if (!filePath) {
21925
21750
  return outBox(
21926
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21927
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/file" }),
21928
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Create, open, or navigate to a file." }),
21929
- /* @__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>" })
21930
21755
  ] })
21931
21756
  );
21932
21757
  }
@@ -21944,7 +21769,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21944
21769
  setHistory((prev) => prev.concat({
21945
21770
  id: Date.now(),
21946
21771
  component: outBox(
21947
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21772
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21948
21773
  "Failed to execute /file: ",
21949
21774
  e?.message || String(e)
21950
21775
  ] }) })
@@ -21958,10 +21783,10 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21958
21783
  const query = args.join(" ") || "";
21959
21784
  if (!query) {
21960
21785
  return outBox(
21961
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21962
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "/search" }),
21963
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Search the codebase for a pattern." }),
21964
- /* @__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>]" })
21965
21790
  ] })
21966
21791
  );
21967
21792
  }
@@ -21979,7 +21804,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21979
21804
  setHistory((prev) => prev.concat({
21980
21805
  id: Date.now(),
21981
21806
  component: outBox(
21982
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21807
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
21983
21808
  "Failed to execute /search: ",
21984
21809
  e?.message || String(e)
21985
21810
  ] }) })
@@ -21991,97 +21816,43 @@ Read the relevant files, identify optimization opportunities, and suggest specif
21991
21816
  }
21992
21817
  if (cmd === "context") {
21993
21818
  const sub = (args[0] || "").toLowerCase();
21994
- if (!sub || sub === "show" || sub === "status") {
21995
- return outBox(
21996
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
21997
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Conversation Context" }),
21998
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /ctx for detailed context inspection." }),
21999
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /compact to manually trigger compaction." }),
22000
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /snip to remove old snippets." }),
22001
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /collapse for aggressive context reduction." })
22002
- ] })
22003
- );
22004
- }
22005
- if (sub === "clear") {
22006
- return usageBox("Context", "Use /clear to clear the conversation history.");
22007
- }
22008
- return usageBox("Context", `Unknown subcommand: ${sub}. Use: show | clear`);
21819
+ return renderContext();
22009
21820
  }
22010
21821
  if (cmd === "token") {
22011
- return outBox(
22012
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22013
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Token Usage" }),
22014
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Token tracking is available via /stats and /cost for detailed session statistics." }),
22015
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Auto-compact triggers at 180k tokens (threshold: 150k micro, 180k full)." }),
22016
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Target after compact: 100k tokens." })
22017
- ] })
22018
- );
21822
+ return renderToken();
22019
21823
  }
22020
21824
  if (cmd === "settings") {
22021
21825
  const sub = (args[0] || "").toLowerCase();
22022
21826
  if (!sub || sub === "show" || sub === "list") {
22023
- return renderRuntimeConfig();
21827
+ return renderModelConfig();
22024
21828
  }
22025
21829
  if (sub === "edit") {
22026
21830
  const key = args[1];
22027
21831
  const value = args.slice(2).join(" ");
22028
21832
  if (!key) {
22029
- return usageBox("Settings", "Usage: /settings edit <key> <value>");
21833
+ return renderSettingsEditUsage();
22030
21834
  }
22031
21835
  const next = setRuntimeConfig({ [key]: value });
22032
21836
  return usageBox("Settings", `Set ${key} = ${JSON.stringify(next[key] || value)}`);
22033
21837
  }
22034
- return usageBox("Settings", `Unknown subcommand: ${sub}. Use: show | edit <key> <value>`);
21838
+ return renderSettingsUnknown();
22035
21839
  }
22036
21840
  if (cmd === "history") {
22037
- const limit = parseInt(args[0] || "20", 10);
22038
- return outBox(
22039
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22040
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Command History" }),
22041
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Recent commands are tracked in the session conversation." }),
22042
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Use /export to export the full conversation as markdown." }),
22043
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Session logs are stored in ~/.bluma/sessions/" })
22044
- ] })
22045
- );
21841
+ return renderHistory();
22046
21842
  }
22047
21843
  if (cmd === "alias") {
22048
21844
  const sub = (args[0] || "").toLowerCase();
22049
- if (!sub || sub === "list" || sub === "show") {
22050
- return outBox(
22051
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22052
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Command Aliases" }),
22053
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No custom aliases configured yet." }),
22054
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /alias add <name> <command>" }),
22055
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: " /alias remove <name>" })
22056
- ] })
22057
- );
22058
- }
22059
- if (sub === "add") {
22060
- const name = args[1];
22061
- const command = args.slice(2).join(" ");
22062
- if (!name || !command) {
22063
- return usageBox("Alias", "Usage: /alias add <name> <command>");
22064
- }
22065
- return usageBox("Alias", `Alias "${name}" \u2192 "${command}" (stored in settings for future sessions).`);
22066
- }
22067
- if (sub === "remove") {
22068
- const name = args[1];
22069
- if (!name) {
22070
- return usageBox("Alias", "Usage: /alias remove <name>");
22071
- }
22072
- return usageBox("Alias", `Alias "${name}" removed.`);
22073
- }
22074
- return usageBox("Alias", `Unknown subcommand: ${sub}. Use: list | add <name> <command> | remove <name>`);
21845
+ return renderAlias(sub);
22075
21846
  }
22076
21847
  if (cmd === "macro") {
22077
21848
  const name = args[0] || "";
22078
21849
  if (!name) {
22079
21850
  return outBox(
22080
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22081
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Macros" }),
22082
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "No macros configured yet." }),
22083
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /macro <name>" }),
22084
- /* @__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".' })
22085
21856
  ] })
22086
21857
  );
22087
21858
  }
@@ -22094,7 +21865,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22094
21865
  setHistory((prev) => prev.concat({
22095
21866
  id: Date.now(),
22096
21867
  component: outBox(
22097
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21868
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
22098
21869
  "Failed to execute /macro: ",
22099
21870
  e?.message || String(e)
22100
21871
  ] }) })
@@ -22108,11 +21879,11 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22108
21879
  const name = args.join(" ") || "";
22109
21880
  if (!name) {
22110
21881
  return outBox(
22111
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22112
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Templates" }),
22113
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Create a project from a template." }),
22114
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Usage: /template <name>" }),
22115
- /* @__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" })
22116
21887
  ] })
22117
21888
  );
22118
21889
  }
@@ -22131,7 +21902,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22131
21902
  setHistory((prev) => prev.concat({
22132
21903
  id: Date.now(),
22133
21904
  component: outBox(
22134
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21905
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
22135
21906
  "Failed to execute /template: ",
22136
21907
  e?.message || String(e)
22137
21908
  ] }) })
@@ -22156,7 +21927,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22156
21927
  setHistory((prev) => prev.concat({
22157
21928
  id: Date.now(),
22158
21929
  component: outBox(
22159
- /* @__PURE__ */ jsx18(Box17, { children: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21930
+ /* @__PURE__ */ jsx26(Box25, { children: /* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
22160
21931
  "Failed to execute /share: ",
22161
21932
  e?.message || String(e)
22162
21933
  ] }) })
@@ -22167,21 +21938,14 @@ Read the relevant files, identify optimization opportunities, and suggest specif
22167
21938
  return null;
22168
21939
  }
22169
21940
  if (cmd === "copy") {
22170
- return outBox(
22171
- /* @__PURE__ */ jsxs16(Fragment6, { children: [
22172
- /* @__PURE__ */ jsx18(Text16, { bold: true, color: COMMAND_HEADER_COLOR, children: "Copy" }),
22173
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "Clipboard copy is available via Ctrl+V / Cmd+V paste support." }),
22174
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: "On Linux, ensure wl-clipboard or xclip is installed for clipboard support." }),
22175
- /* @__PURE__ */ jsx18(Text16, { dimColor: true, children: 'Use the agent to copy specific text: "copy the last test output to clipboard"' })
22176
- ] })
22177
- );
21941
+ return renderCopy();
22178
21942
  }
22179
- return outBox(/* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
21943
+ return outBox(/* @__PURE__ */ jsxs24(Text24, { color: "red", children: [
22180
21944
  "Command not recognized: /",
22181
21945
  cmd
22182
21946
  ] }));
22183
21947
  };
22184
- return /* @__PURE__ */ jsx18(Fragment6, { children: render2() });
21948
+ return /* @__PURE__ */ jsx26(Fragment14, { children: render2() });
22185
21949
  };
22186
21950
  var SlashCommands_default = SlashCommands;
22187
21951
 
@@ -22282,8 +22046,8 @@ Run: npm i -g ${BLUMA_PACKAGE_NAME} to update.`;
22282
22046
  init_sandbox_policy();
22283
22047
 
22284
22048
  // src/app/ui/components/UpdateNotice.tsx
22285
- import { Box as Box18, Text as Text17 } from "ink";
22286
- 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";
22287
22051
  function parseUpdateMessage(msg) {
22288
22052
  const lines = msg.split(/\r?\n/).map((l) => l.trim());
22289
22053
  const first = lines[0] || "";
@@ -22299,25 +22063,25 @@ function parseUpdateMessage(msg) {
22299
22063
  }
22300
22064
  var UpdateNotice = ({ message: message2 }) => {
22301
22065
  const { name, current, latest: latest2, hint } = parseUpdateMessage(message2);
22302
- return /* @__PURE__ */ jsx19(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs17(Box18, { flexDirection: "column", paddingLeft: 2, children: [
22303
- name && current && latest2 ? /* @__PURE__ */ jsx19(Text17, { color: BLUMA_TERMINAL.accent, bold: true, children: name }) : null,
22304
- 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: [
22305
22069
  current,
22306
22070
  " \u2192 ",
22307
22071
  latest2
22308
- ] }) : /* @__PURE__ */ jsx19(Text17, { dimColor: true, children: message2 }),
22309
- 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
22310
22074
  ] }) });
22311
22075
  };
22312
22076
  var UpdateNotice_default = UpdateNotice;
22313
22077
 
22314
22078
  // src/app/ui/components/ErrorMessage.tsx
22315
- import { Box as Box19, Text as Text18 } from "ink";
22316
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
22317
- var ErrorMessage = ({ message: message2, details, hint }) => /* @__PURE__ */ jsx20(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs18(Box19, { flexDirection: "column", paddingLeft: 2, children: [
22318
- /* @__PURE__ */ jsx20(Text18, { color: BLUMA_TERMINAL.err, children: message2 }),
22319
- details ? /* @__PURE__ */ jsx20(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx20(Text18, { dimColor: true, children: details }) }) : null,
22320
- 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: [
22321
22085
  "hint: ",
22322
22086
  hint
22323
22087
  ] }) }) : null
@@ -22326,8 +22090,8 @@ var ErrorMessage_default = ErrorMessage;
22326
22090
 
22327
22091
  // src/app/ui/components/ReasoningDisplay.tsx
22328
22092
  import { memo as memo11 } from "react";
22329
- import { Box as Box20, Text as Text19 } from "ink";
22330
- 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";
22331
22095
  var ReasoningDisplayComponent = ({
22332
22096
  reasoning,
22333
22097
  collapsed = false
@@ -22339,9 +22103,9 @@ var ReasoningDisplayComponent = ({
22339
22103
  const lines = reasoning.split("\n");
22340
22104
  const displayLines = lines.slice(0, maxLines);
22341
22105
  const truncated = lines.length > maxLines;
22342
- return /* @__PURE__ */ jsx21(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs19(Box20, { flexDirection: "column", paddingLeft: 1, children: [
22343
- displayLines.map((line, i) => /* @__PURE__ */ jsx21(Text19, { dimColor: true, wrap: "wrap", children: line }, i)),
22344
- 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: [
22345
22109
  "\u2026 +",
22346
22110
  lines.length - maxLines,
22347
22111
  " lines"
@@ -22351,8 +22115,8 @@ var ReasoningDisplayComponent = ({
22351
22115
  var ReasoningDisplay = memo11(ReasoningDisplayComponent);
22352
22116
 
22353
22117
  // src/app/ui/components/StreamingText.tsx
22354
- import { useState as useState6, useEffect as useEffect7, useRef as useRef5, memo as memo12 } from "react";
22355
- 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";
22356
22120
 
22357
22121
  // src/app/ui/components/streamingTextFlush.ts
22358
22122
  function applyStreamEndFlush(params) {
@@ -22374,7 +22138,7 @@ function applyStreamEndFlush(params) {
22374
22138
  }
22375
22139
 
22376
22140
  // src/app/ui/components/StreamingText.tsx
22377
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
22141
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
22378
22142
  var THROTTLE_MS = 50;
22379
22143
  var MAX_VISIBLE_LINES = 20;
22380
22144
  var StreamingTextComponent = ({
@@ -22382,9 +22146,9 @@ var StreamingTextComponent = ({
22382
22146
  onReasoningComplete,
22383
22147
  onAssistantContentComplete
22384
22148
  }) => {
22385
- const [reasoning, setReasoning] = useState6("");
22386
- const [assistantContent, setAssistantContent] = useState6("");
22387
- const [isStreaming, setIsStreaming] = useState6(false);
22149
+ const [reasoning, setReasoning] = useState5("");
22150
+ const [assistantContent, setAssistantContent] = useState5("");
22151
+ const [isStreaming, setIsStreaming] = useState5(false);
22388
22152
  const reasoningRef = useRef5("");
22389
22153
  const contentRef = useRef5("");
22390
22154
  const lastUpdateRef = useRef5(0);
@@ -22473,26 +22237,26 @@ var StreamingTextComponent = ({
22473
22237
  truncatedCount = lines.length - MAX_VISIBLE_LINES;
22474
22238
  displayLines = lines.slice(-MAX_VISIBLE_LINES);
22475
22239
  }
22476
- return /* @__PURE__ */ jsxs20(Box21, { flexDirection: "column", children: [
22477
- 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: [
22478
22242
  "\u2026 ",
22479
22243
  truncatedCount,
22480
22244
  " lines above hidden"
22481
22245
  ] }) : null,
22482
- 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))
22483
22247
  ] });
22484
22248
  };
22485
- return /* @__PURE__ */ jsxs20(ChatBlock, { marginBottom: 1, children: [
22486
- reasoning ? /* @__PURE__ */ jsx22(Box21, { flexDirection: "column", paddingLeft: 2, children: renderLines(reasoning, true) }) : null,
22487
- 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
22488
22252
  ] });
22489
22253
  };
22490
22254
  var StreamingText = memo12(StreamingTextComponent);
22491
22255
 
22492
22256
  // src/app/ui/components/ExpandedPreviewBlock.tsx
22493
22257
  import { memo as memo13 } from "react";
22494
- import { Box as Box22, Text as Text21 } from "ink";
22495
- 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";
22496
22260
  function ExpandedPreviewBlockComponent({ data }) {
22497
22261
  const cols = typeof process.stdout?.columns === "number" ? process.stdout.columns : 80;
22498
22262
  const rule = TERMINAL_RULE_CHAR.repeat(Math.max(8, cols));
@@ -22500,36 +22264,36 @@ function ExpandedPreviewBlockComponent({ data }) {
22500
22264
  const cap = EXPAND_OVERLAY_MAX_LINES;
22501
22265
  const shown = lines.slice(0, cap);
22502
22266
  const rest = lines.length - cap;
22503
- return /* @__PURE__ */ jsxs21(ChatBlock, { marginBottom: 1, children: [
22504
- /* @__PURE__ */ jsx23(Text21, { color: "white", children: rule }),
22505
- /* @__PURE__ */ jsxs21(Box22, { flexDirection: "column", paddingLeft: 1, children: [
22506
- /* @__PURE__ */ jsx23(Text21, { color: BLUMA_TERMINAL.accent, bold: true, children: "expand (Ctrl+O)" }),
22507
- /* @__PURE__ */ jsx23(Text21, { dimColor: true, children: data.title }),
22508
- /* @__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: [
22509
22273
  "+",
22510
22274
  data.linesHidden,
22511
22275
  " lines were clipped in chat \xB7 below: up to ",
22512
22276
  cap,
22513
22277
  " lines \xB7 use read_file_lines before edit_tool"
22514
22278
  ] }),
22515
- /* @__PURE__ */ jsxs21(Box22, { flexDirection: "column", marginTop: 1, children: [
22516
- shown.map((line, i) => /* @__PURE__ */ jsx23(Text21, { dimColor: true, children: line.slice(0, 200) }, i)),
22517
- 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: [
22518
22282
  "\u2026 +",
22519
22283
  rest,
22520
22284
  " more lines in this chunk"
22521
22285
  ] }) : null
22522
22286
  ] })
22523
22287
  ] }),
22524
- /* @__PURE__ */ jsx23(Text21, { color: "white", children: rule })
22288
+ /* @__PURE__ */ jsx31(Text29, { color: "white", children: rule })
22525
22289
  ] });
22526
22290
  }
22527
22291
  var ExpandedPreviewBlock = memo13(ExpandedPreviewBlockComponent);
22528
22292
 
22529
22293
  // src/app/ui/components/AskUserQuestionPrompt.tsx
22530
- import { memo as memo14, useState as useState7 } from "react";
22531
- import { Box as Box23, Text as Text22, useInput as useInput4 } from "ink";
22532
- 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";
22533
22297
  var AskUserQuestionPromptComponent = ({
22534
22298
  questions,
22535
22299
  onAnswer,
@@ -22537,7 +22301,7 @@ var AskUserQuestionPromptComponent = ({
22537
22301
  }) => {
22538
22302
  const q = questions[0];
22539
22303
  const opts = q?.options ?? [];
22540
- const [selected, setSelected] = useState7(0);
22304
+ const [selected, setSelected] = useState6(0);
22541
22305
  useInput4((input, key) => {
22542
22306
  if (key.escape) {
22543
22307
  onCancel();
@@ -22580,52 +22344,52 @@ var AskUserQuestionPromptComponent = ({
22580
22344
  const cols = typeof process.stdout?.columns === "number" ? process.stdout.columns : 72;
22581
22345
  const rule = TERMINAL_RULE_CHAR.repeat(Math.min(cols - 2, 64));
22582
22346
  if (!q || opts.length === 0) {
22583
- return /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", marginBottom: 1, children: [
22584
- /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: rule }),
22585
- /* @__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" })
22586
22350
  ] });
22587
22351
  }
22588
- return /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", marginBottom: 1, children: [
22589
- /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: rule }),
22590
- /* @__PURE__ */ jsx24(Text22, { bold: true, color: BLUMA_TERMINAL.accent, children: "Question" }),
22591
- q.header ? /* @__PURE__ */ jsx24(Text22, { dimColor: true, wrap: "wrap", children: q.header }) : null,
22592
- /* @__PURE__ */ jsx24(Box23, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx24(Text22, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: q.question }) }),
22593
- /* @__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) => {
22594
22358
  const isSel = idx === selected;
22595
- return /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", marginBottom: 0, children: [
22596
- /* @__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: [
22597
22361
  "(",
22598
22362
  idx + 1,
22599
22363
  ") ",
22600
22364
  o.label
22601
22365
  ] }),
22602
- o.description ? /* @__PURE__ */ jsxs22(Text22, { dimColor: true, wrap: "wrap", children: [
22366
+ o.description ? /* @__PURE__ */ jsxs30(Text30, { dimColor: true, wrap: "wrap", children: [
22603
22367
  " ",
22604
22368
  o.description
22605
22369
  ] }) : null
22606
22370
  ] }, idx);
22607
22371
  }) }),
22608
- /* @__PURE__ */ jsx24(Box23, { marginTop: 1, children: /* @__PURE__ */ jsx24(Text22, { dimColor: true, children: "Enter / number to choose \xB7 \u2191\u2193 \xB7 Esc cancel" }) }),
22609
- /* @__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 })
22610
22374
  ] });
22611
22375
  };
22612
22376
  var AskUserQuestionPrompt = memo14(AskUserQuestionPromptComponent);
22613
22377
 
22614
22378
  // src/app/ui/components/WorkerOverlay.tsx
22615
- import { useState as useState10 } from "react";
22616
- 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";
22617
22381
 
22618
22382
  // src/app/ui/components/WorkerStatusList.tsx
22619
- import { useEffect as useEffect8, useState as useState8 } from "react";
22620
- 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";
22621
22385
  import Spinner2 from "ink-spinner";
22622
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
22386
+ import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
22623
22387
  var WorkerStatusList = ({
22624
22388
  parentSessionId,
22625
22389
  collapsed = false
22626
22390
  }) => {
22627
- const [workers, setWorkers] = useState8([]);
22628
- const [pollKey, setPollKey] = useState8(0);
22391
+ const [workers, setWorkers] = useState7([]);
22392
+ const [pollKey, setPollKey] = useState7(0);
22629
22393
  useEffect8(() => {
22630
22394
  const pollWorkers = async () => {
22631
22395
  try {
@@ -22678,49 +22442,49 @@ var WorkerStatusList = ({
22678
22442
  }, [pollKey, parentSessionId]);
22679
22443
  if (workers.length === 0) return null;
22680
22444
  if (collapsed) {
22681
- 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: [
22682
22446
  "Workers: ",
22683
22447
  workers.length
22684
22448
  ] }) });
22685
22449
  }
22686
- return /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", children: [
22687
- /* @__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: [
22688
22452
  "Workers (",
22689
22453
  workers.length,
22690
22454
  ")"
22691
22455
  ] }),
22692
- workers.map((w, idx) => /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", borderBottom: true, borderBottomColor: "gray", children: [
22693
- /* @__PURE__ */ jsxs23(Box24, { children: [
22694
- /* @__PURE__ */ jsx25(Text23, { color: "cyan", children: w.metadata?.agent_type === "researcher" ? "[R]" : w.metadata?.agent_type === "implementer" ? "[I]" : "[W]" }),
22695
- /* @__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: [
22696
22460
  " ",
22697
22461
  w.title
22698
22462
  ] }),
22699
- w.isAlive === true ? /* @__PURE__ */ jsxs23(Text23, { color: "green", children: [
22700
- /* @__PURE__ */ jsx25(Spinner2, {}),
22463
+ w.isAlive === true ? /* @__PURE__ */ jsxs31(Text31, { color: "green", children: [
22464
+ /* @__PURE__ */ jsx33(Spinner2, {}),
22701
22465
  " Running"
22702
- ] }) : /* @__PURE__ */ jsx25(Text23, { color: "gray", children: w.status })
22466
+ ] }) : /* @__PURE__ */ jsx33(Text31, { color: "gray", children: w.status })
22703
22467
  ] }),
22704
- w.progress && /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", children: [
22705
- /* @__PURE__ */ jsxs23(Text23, { color: "magenta", children: [
22468
+ w.progress && /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", children: [
22469
+ /* @__PURE__ */ jsxs31(Text31, { color: "magenta", children: [
22706
22470
  "Progress: ",
22707
22471
  w.progress.percent,
22708
22472
  "% ",
22709
22473
  w.progress.currentTask ? `- ${w.progress.currentTask}` : ""
22710
22474
  ] }),
22711
- /* @__PURE__ */ jsx25(Box24, { children: /* @__PURE__ */ jsx25(Text23, { color: "gray", children: Array.from({ length: 20 }).map((_, i) => i / 20 * 100 <= (w.progress.percent || 0) ? "#" : "-").join("") }) }),
22712
- /* @__PURE__ */ jsxs23(Box24, { children: [
22713
- 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: [
22714
22478
  " Tools: ",
22715
22479
  w.progress.toolCallsCount
22716
22480
  ] }),
22717
- w.progress.tokensUsed !== void 0 && /* @__PURE__ */ jsxs23(Text23, { color: "blue", children: [
22481
+ w.progress.tokensUsed !== void 0 && /* @__PURE__ */ jsxs31(Text31, { color: "blue", children: [
22718
22482
  " Tokens: ",
22719
22483
  w.progress.tokensUsed.toLocaleString()
22720
22484
  ] })
22721
22485
  ] })
22722
22486
  ] }),
22723
- /* @__PURE__ */ jsxs23(Text23, { dimColor: true, color: "gray", children: [
22487
+ /* @__PURE__ */ jsxs31(Text31, { dimColor: true, color: "gray", children: [
22724
22488
  "ID: ",
22725
22489
  w.session_id.slice(0, 8),
22726
22490
  "... PID: ",
@@ -22728,7 +22492,7 @@ var WorkerStatusList = ({
22728
22492
  " Started: ",
22729
22493
  new Date(w.started_at).toLocaleTimeString()
22730
22494
  ] }),
22731
- /* @__PURE__ */ jsxs23(Text23, { italic: true, dimColor: true, color: "gray", children: [
22495
+ /* @__PURE__ */ jsxs31(Text31, { italic: true, dimColor: true, color: "gray", children: [
22732
22496
  "Ctrl+Shift+",
22733
22497
  idx + 1,
22734
22498
  " para transcript"
@@ -22738,11 +22502,11 @@ var WorkerStatusList = ({
22738
22502
  };
22739
22503
 
22740
22504
  // src/app/ui/components/WorkerTranscript.tsx
22741
- import { useEffect as useEffect9, useState as useState9 } from "react";
22742
- import { Box as Box25, Text as Text24 } from "ink";
22743
- 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";
22744
22508
  var WorkerTranscript = ({ sessionId, title, onClose }) => {
22745
- const [messages, setMessages] = useState9([]);
22509
+ const [messages, setMessages] = useState8([]);
22746
22510
  useEffect9(() => {
22747
22511
  const loadTranscript = async () => {
22748
22512
  try {
@@ -22758,27 +22522,27 @@ var WorkerTranscript = ({ sessionId, title, onClose }) => {
22758
22522
  const interval = setInterval(loadTranscript, 3e3);
22759
22523
  return () => clearInterval(interval);
22760
22524
  }, [sessionId]);
22761
- return /* @__PURE__ */ jsxs24(Box25, { flexDirection: "column", borderStyle: "double", borderColor: "cyan", children: [
22762
- /* @__PURE__ */ jsxs24(Box25, { children: [
22763
- /* @__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: [
22764
22528
  "Transcript: ",
22765
22529
  title || sessionId.slice(0, 8),
22766
22530
  "..."
22767
22531
  ] }),
22768
- /* @__PURE__ */ jsx26(Text24, { color: "gray", dimColor: true, children: " ESC: fechar" })
22532
+ /* @__PURE__ */ jsx34(Text32, { color: "gray", dimColor: true, children: " ESC: fechar" })
22769
22533
  ] }),
22770
- /* @__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: [
22771
- /* @__PURE__ */ jsxs24(Box25, { children: [
22772
- /* @__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: [
22773
22537
  "[",
22774
22538
  new Date(msg.timestamp).toLocaleTimeString(),
22775
22539
  "]"
22776
22540
  ] }),
22777
- /* @__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: [
22778
22542
  " ",
22779
22543
  msg.type
22780
22544
  ] }),
22781
- /* @__PURE__ */ jsxs24(Text24, { dimColor: true, color: "gray", children: [
22545
+ /* @__PURE__ */ jsxs32(Text32, { dimColor: true, color: "gray", children: [
22782
22546
  " ",
22783
22547
  msg.from.slice(0, 8),
22784
22548
  "... \u2192 ",
@@ -22786,18 +22550,18 @@ var WorkerTranscript = ({ sessionId, title, onClose }) => {
22786
22550
  "..."
22787
22551
  ] })
22788
22552
  ] }),
22789
- /* @__PURE__ */ jsxs24(Text24, { children: [
22553
+ /* @__PURE__ */ jsxs32(Text32, { children: [
22790
22554
  " ",
22791
22555
  msg.content
22792
22556
  ] }),
22793
- msg.metadata?.progress && /* @__PURE__ */ jsxs24(Text24, { color: "magenta", children: [
22557
+ msg.metadata?.progress && /* @__PURE__ */ jsxs32(Text32, { color: "magenta", children: [
22794
22558
  " Progress: ",
22795
22559
  msg.metadata.progress.percent,
22796
22560
  "% ",
22797
22561
  msg.metadata.progress.currentTask || ""
22798
22562
  ] })
22799
22563
  ] }, msg.id)) }),
22800
- /* @__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: [
22801
22565
  "Total: ",
22802
22566
  messages.length,
22803
22567
  " messages | Session: ",
@@ -22808,14 +22572,14 @@ var WorkerTranscript = ({ sessionId, title, onClose }) => {
22808
22572
  };
22809
22573
 
22810
22574
  // src/app/ui/components/WorkerOverlay.tsx
22811
- import { jsx as jsx27 } from "react/jsx-runtime";
22575
+ import { jsx as jsx35 } from "react/jsx-runtime";
22812
22576
  var WorkerOverlay = ({
22813
22577
  visible,
22814
22578
  sessionId,
22815
22579
  onClose,
22816
22580
  onZoomWorker
22817
22581
  }) => {
22818
- const [zoomedWorker, setZoomedWorker] = useState10(null);
22582
+ const [zoomedWorker, setZoomedWorker] = useState9(null);
22819
22583
  useInput5((input, key) => {
22820
22584
  if (!visible) return;
22821
22585
  if (key.escape) {
@@ -22829,13 +22593,13 @@ var WorkerOverlay = ({
22829
22593
  if (!visible) {
22830
22594
  return null;
22831
22595
  }
22832
- return /* @__PURE__ */ jsx27(Box26, { flexDirection: "column", children: zoomedWorker ? /* @__PURE__ */ jsx27(
22596
+ return /* @__PURE__ */ jsx35(Box34, { flexDirection: "column", children: zoomedWorker ? /* @__PURE__ */ jsx35(
22833
22597
  WorkerTranscript,
22834
22598
  {
22835
22599
  sessionId: zoomedWorker,
22836
22600
  onClose: () => setZoomedWorker(null)
22837
22601
  }
22838
- ) : /* @__PURE__ */ jsx27(
22602
+ ) : /* @__PURE__ */ jsx35(
22839
22603
  WorkerStatusList,
22840
22604
  {
22841
22605
  parentSessionId: sessionId,
@@ -22968,7 +22732,7 @@ IMPORTANT: Use the file_write tool to create all these files. Be thorough but co
22968
22732
  }
22969
22733
 
22970
22734
  // src/app/ui/App.tsx
22971
- import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
22735
+ import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
22972
22736
  var HISTORY_EMERGENCY_LIMIT = 3;
22973
22737
  var HISTORY_KEEP_AFTER_CLEANUP = 3;
22974
22738
  var blumaUpdateRegistryCheckStarted = false;
@@ -22995,7 +22759,17 @@ var AGENT_WORK_COMMANDS = /* @__PURE__ */ new Set([
22995
22759
  "release",
22996
22760
  "review",
22997
22761
  "bug",
22998
- "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"
22999
22773
  ]);
23000
22774
  var BLOCKING_COMMANDS = /* @__PURE__ */ new Set(["init"]);
23001
22775
  var COMMAND_HEADER_COLOR2 = BLUMA_TERMINAL.accent;
@@ -23025,46 +22799,46 @@ function UserMessageWithOptionalImages({
23025
22799
  const cap = stripped2.trim();
23026
22800
  const capDisp = cap.length > 800 ? `${cap.slice(0, 800)}\u2026` : cap;
23027
22801
  const fallbackDisp = raw.length > 800 ? `${raw.slice(0, 800)}\u2026` : raw;
23028
- return /* @__PURE__ */ jsx28(ChatUserMessage, { children: pathStrs.length > 0 ? /* @__PURE__ */ jsx28(
22802
+ return /* @__PURE__ */ jsx36(ChatUserMessage, { children: pathStrs.length > 0 ? /* @__PURE__ */ jsx36(
23029
22803
  ChatUserImageBlock,
23030
22804
  {
23031
22805
  imageCount: pathStrs.length,
23032
22806
  caption: cap.length > 0 ? capDisp : null,
23033
22807
  captionDim: true
23034
22808
  }
23035
- ) : /* @__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 }) });
23036
22810
  }
23037
22811
  const displayRaw = raw.length > 1e4 ? `${raw.substring(0, 1e4)}...` : raw;
23038
22812
  const paths = collectImagePathStrings(displayRaw);
23039
22813
  const stripped = paths.length > 0 ? stripImagePathStrings(displayRaw, paths) : displayRaw;
23040
- return /* @__PURE__ */ jsx28(ChatUserMessage, { children: paths.length > 0 ? /* @__PURE__ */ jsx28(
22814
+ return /* @__PURE__ */ jsx36(ChatUserMessage, { children: paths.length > 0 ? /* @__PURE__ */ jsx36(
23041
22815
  ChatUserImageBlock,
23042
22816
  {
23043
22817
  imageCount: paths.length,
23044
22818
  caption: stripped.trim().length > 0 ? stripped : null
23045
22819
  }
23046
- ) : /* @__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 }) });
23047
22821
  }
23048
22822
  var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23049
22823
  const agentInstance = useRef6(null);
23050
- const [history, setHistory] = useState11([]);
23051
- const [statusMessage, setStatusMessage] = useState11(
22824
+ const [history, setHistory] = useState10([]);
22825
+ const [statusMessage, setStatusMessage] = useState10(
23052
22826
  "Initializing agent..."
23053
22827
  );
23054
- const [toolsCount, setToolsCount] = useState11(null);
23055
- const [mcpStatus, setMcpStatus] = useState11(
22828
+ const [toolsCount, setToolsCount] = useState10(null);
22829
+ const [mcpStatus, setMcpStatus] = useState10(
23056
22830
  "connecting"
23057
22831
  );
23058
- const [isProcessing, setIsProcessing] = useState11(true);
23059
- const [pendingConfirmation, setPendingConfirmation] = useState11(
22832
+ const [isProcessing, setIsProcessing] = useState10(true);
22833
+ const [pendingConfirmation, setPendingConfirmation] = useState10(
23060
22834
  null
23061
22835
  );
23062
- const [confirmationPreview, setConfirmationPreview] = useState11(
22836
+ const [confirmationPreview, setConfirmationPreview] = useState10(
23063
22837
  null
23064
22838
  );
23065
- const [pendingAskUserQuestions, setPendingAskUserQuestions] = useState11(null);
23066
- const [showWorkers, setShowWorkers] = useState11(false);
23067
- const [zoomedWorkerSession, setZoomedWorkerSession] = useState11(null);
22839
+ const [pendingAskUserQuestions, setPendingAskUserQuestions] = useState10(null);
22840
+ const [showWorkers, setShowWorkers] = useState10(false);
22841
+ const [zoomedWorkerSession, setZoomedWorkerSession] = useState10(null);
23068
22842
  useInput6((input, key) => {
23069
22843
  if (key.ctrl && key.shift && input.toLowerCase() === "w") {
23070
22844
  setShowWorkers((prev) => !prev);
@@ -23077,14 +22851,14 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23077
22851
  }
23078
22852
  }
23079
22853
  });
23080
- const [isInitAgentActive, setIsInitAgentActive] = useState11(false);
23081
- const [liveToolName, setLiveToolName] = useState11(null);
23082
- const [liveToolArgs, setLiveToolArgs] = useState11(void 0);
23083
- 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);
23084
22858
  const alwaysAcceptList = useRef6([]);
23085
22859
  const workdir = getSandboxPolicy().workspaceRoot;
23086
22860
  const turnStartedAtRef = useRef6(null);
23087
- const [processingStartMs, setProcessingStartMs] = useState11(null);
22861
+ const [processingStartMs, setProcessingStartMs] = useState10(null);
23088
22862
  const markTurnStarted = useCallback4(() => {
23089
22863
  const t = Date.now();
23090
22864
  turnStartedAtRef.current = t;
@@ -23102,7 +22876,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23102
22876
  ...prev,
23103
22877
  {
23104
22878
  id,
23105
- 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)
23106
22880
  }
23107
22881
  ];
23108
22882
  }
@@ -23110,7 +22884,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23110
22884
  ...prev,
23111
22885
  {
23112
22886
  id,
23113
- component: /* @__PURE__ */ jsx28(ExpandedPreviewBlock, { data: p }, id)
22887
+ component: /* @__PURE__ */ jsx36(ExpandedPreviewBlock, { data: p }, id)
23114
22888
  }
23115
22889
  ];
23116
22890
  });
@@ -23132,7 +22906,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23132
22906
  ...prev,
23133
22907
  {
23134
22908
  id: nextId2,
23135
- component: /* @__PURE__ */ jsx28(UpdateNotice_default, { message: msg })
22909
+ component: /* @__PURE__ */ jsx36(UpdateNotice_default, { message: msg })
23136
22910
  }
23137
22911
  ];
23138
22912
  });
@@ -23144,7 +22918,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23144
22918
  return [
23145
22919
  {
23146
22920
  id: HEADER_PANEL_HISTORY_ID,
23147
- component: /* @__PURE__ */ jsx28(Header, { sessionId, workdir, cliVersion })
22921
+ component: /* @__PURE__ */ jsx36(Header, { sessionId, workdir, cliVersion })
23148
22922
  },
23149
22923
  ...tail
23150
22924
  ];
@@ -23162,7 +22936,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23162
22936
  ...prev,
23163
22937
  {
23164
22938
  id,
23165
- component: /* @__PURE__ */ jsx28(ChatMeta, { children: "cancelled (Esc)" })
22939
+ component: /* @__PURE__ */ jsx36(ChatMeta, { children: "cancelled (Esc)" })
23166
22940
  }
23167
22941
  ];
23168
22942
  });
@@ -23188,7 +22962,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23188
22962
  ...prev,
23189
22963
  {
23190
22964
  id,
23191
- 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 }) })
23192
22966
  }
23193
22967
  ];
23194
22968
  });
@@ -23204,7 +22978,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23204
22978
  ...prev,
23205
22979
  {
23206
22980
  id,
23207
- component: /* @__PURE__ */ jsxs25(ChatMeta, { children: [
22981
+ component: /* @__PURE__ */ jsxs33(ChatMeta, { children: [
23208
22982
  "Failed to initialize: ",
23209
22983
  error instanceof Error ? error.message : String(error)
23210
22984
  ] })
@@ -23222,7 +22996,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23222
22996
  ...prev,
23223
22997
  {
23224
22998
  id,
23225
- 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." })
23226
23000
  }
23227
23001
  ];
23228
23002
  });
@@ -23240,7 +23014,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23240
23014
  ...prev,
23241
23015
  {
23242
23016
  id,
23243
- 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" })
23244
23018
  }
23245
23019
  ];
23246
23020
  });
@@ -23259,7 +23033,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23259
23033
  ...prev,
23260
23034
  {
23261
23035
  id,
23262
- component: /* @__PURE__ */ jsx28(UserMessageWithOptionalImages, { raw: payload, variant: "slash-img" })
23036
+ component: /* @__PURE__ */ jsx36(UserMessageWithOptionalImages, { raw: payload, variant: "slash-img" })
23263
23037
  }
23264
23038
  ];
23265
23039
  });
@@ -23296,16 +23070,18 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23296
23070
  ...prev,
23297
23071
  {
23298
23072
  id: firstId,
23299
- 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 }) })
23300
23074
  },
23301
23075
  {
23302
23076
  id: secondId,
23303
- component: /* @__PURE__ */ jsx28(
23077
+ component: /* @__PURE__ */ jsx36(
23304
23078
  SlashCommands_default,
23305
23079
  {
23306
23080
  input: text,
23307
23081
  setHistory,
23308
- agentRef: agentInstance
23082
+ agentRef: agentInstance,
23083
+ setIsProcessing,
23084
+ markTurnStarted
23309
23085
  }
23310
23086
  )
23311
23087
  }
@@ -23332,7 +23108,7 @@ var AppComponent = ({ eventBus, sessionId, cliVersion }) => {
23332
23108
  ...prev,
23333
23109
  {
23334
23110
  id,
23335
- 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: [
23336
23112
  "$ !",
23337
23113
  command
23338
23114
  ] }) })
@@ -23358,7 +23134,7 @@ Please use command_status to check the result and report back to the user.`;
23358
23134
  ...prev,
23359
23135
  {
23360
23136
  id,
23361
- component: /* @__PURE__ */ jsxs25(Text26, { color: "red", children: [
23137
+ component: /* @__PURE__ */ jsxs33(Text34, { color: "red", children: [
23362
23138
  "Failed to execute: ",
23363
23139
  result.error || result.message
23364
23140
  ] })
@@ -23376,7 +23152,7 @@ Please use command_status to check the result and report back to the user.`;
23376
23152
  ...prev,
23377
23153
  {
23378
23154
  id,
23379
- component: /* @__PURE__ */ jsxs25(Text26, { color: "red", children: [
23155
+ component: /* @__PURE__ */ jsxs33(Text34, { color: "red", children: [
23380
23156
  "Error: ",
23381
23157
  err.message
23382
23158
  ] })
@@ -23396,7 +23172,7 @@ Please use command_status to check the result and report back to the user.`;
23396
23172
  ...prev,
23397
23173
  {
23398
23174
  id,
23399
- component: /* @__PURE__ */ jsx28(UserMessageWithOptionalImages, { raw: text, variant: "plain" })
23175
+ component: /* @__PURE__ */ jsx36(UserMessageWithOptionalImages, { raw: text, variant: "plain" })
23400
23176
  }
23401
23177
  ];
23402
23178
  });
@@ -23437,7 +23213,7 @@ Please use command_status to check the result and report back to the user.`;
23437
23213
  ...prev,
23438
23214
  {
23439
23215
  id,
23440
- component: /* @__PURE__ */ jsx28(ReasoningDisplay, { reasoning })
23216
+ component: /* @__PURE__ */ jsx36(ReasoningDisplay, { reasoning })
23441
23217
  }
23442
23218
  ];
23443
23219
  });
@@ -23453,7 +23229,7 @@ Please use command_status to check the result and report back to the user.`;
23453
23229
  ...prev,
23454
23230
  {
23455
23231
  id,
23456
- component: /* @__PURE__ */ jsx28(AssistantMessageDisplay, { content })
23232
+ component: /* @__PURE__ */ jsx36(AssistantMessageDisplay, { content })
23457
23233
  }
23458
23234
  ];
23459
23235
  });
@@ -23505,7 +23281,7 @@ Please use command_status to check the result and report back to the user.`;
23505
23281
  ...prev,
23506
23282
  {
23507
23283
  id,
23508
- component: /* @__PURE__ */ jsx28(ChatTurnDuration, { durationMs: ms })
23284
+ component: /* @__PURE__ */ jsx36(ChatTurnDuration, { durationMs: ms })
23509
23285
  }
23510
23286
  ];
23511
23287
  });
@@ -23615,14 +23391,14 @@ Please use command_status to check the result and report back to the user.`;
23615
23391
  }
23616
23392
  let newComponent = null;
23617
23393
  if (parsed.type === "debug") {
23618
- newComponent = /* @__PURE__ */ jsx28(ChatMeta, { children: parsed.message });
23394
+ newComponent = /* @__PURE__ */ jsx36(ChatMeta, { children: parsed.message });
23619
23395
  } else if (parsed.type === "protocol_violation") {
23620
- newComponent = /* @__PURE__ */ jsx28(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsxs25(Box27, { flexDirection: "column", paddingLeft: 2, children: [
23621
- /* @__PURE__ */ jsx28(Text26, { dimColor: true, children: parsed.content }),
23622
- /* @__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 })
23623
23399
  ] }) });
23624
23400
  } else if (parsed.type === "error") {
23625
- newComponent = /* @__PURE__ */ jsx28(
23401
+ newComponent = /* @__PURE__ */ jsx36(
23626
23402
  ErrorMessage_default,
23627
23403
  {
23628
23404
  message: parsed.message,
@@ -23649,7 +23425,7 @@ Please use command_status to check the result and report back to the user.`;
23649
23425
  parsed.tool_call_id
23650
23426
  );
23651
23427
  }
23652
- newComponent = isToolInvocationRowVisible(tn) ? /* @__PURE__ */ jsx28(
23428
+ newComponent = isToolInvocationRowVisible(tn) ? /* @__PURE__ */ jsx36(
23653
23429
  ToolInvocationBlock,
23654
23430
  {
23655
23431
  toolName: tn,
@@ -23670,7 +23446,7 @@ Please use command_status to check the result and report back to the user.`;
23670
23446
  pendingToolInvocationIdsRef.current,
23671
23447
  parsed.tool_call_id
23672
23448
  );
23673
- newComponent = /* @__PURE__ */ jsx28(
23449
+ newComponent = /* @__PURE__ */ jsx36(
23674
23450
  ToolResultDisplay,
23675
23451
  {
23676
23452
  toolName: parsed.tool_name,
@@ -23681,7 +23457,7 @@ Please use command_status to check the result and report back to the user.`;
23681
23457
  }
23682
23458
  );
23683
23459
  } else if (parsed.type === "user_overlay") {
23684
- 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 }) });
23685
23461
  } else if (parsed.type === "reasoning") {
23686
23462
  const r = String(parsed.content ?? "").trim();
23687
23463
  const key = reasoningDedupeKey(r);
@@ -23689,10 +23465,10 @@ Please use command_status to check the result and report back to the user.`;
23689
23465
  newComponent = null;
23690
23466
  } else {
23691
23467
  if (r) lastReasoningTextRef.current = key;
23692
- newComponent = /* @__PURE__ */ jsx28(ReasoningDisplay, { reasoning: String(parsed.content ?? "") });
23468
+ newComponent = /* @__PURE__ */ jsx36(ReasoningDisplay, { reasoning: String(parsed.content ?? "") });
23693
23469
  }
23694
23470
  } else if (parsed.type === "log") {
23695
- newComponent = /* @__PURE__ */ jsxs25(ChatMeta, { children: [
23471
+ newComponent = /* @__PURE__ */ jsxs33(ChatMeta, { children: [
23696
23472
  parsed.message,
23697
23473
  parsed.payload ? `: ${parsed.payload}` : ""
23698
23474
  ] });
@@ -23703,7 +23479,7 @@ Please use command_status to check the result and report back to the user.`;
23703
23479
  newComponent = null;
23704
23480
  } else {
23705
23481
  lastStreamAssistantKeyRef.current = key || null;
23706
- newComponent = /* @__PURE__ */ jsx28(AssistantMessageDisplay, { content: body });
23482
+ newComponent = /* @__PURE__ */ jsx36(AssistantMessageDisplay, { content: body });
23707
23483
  }
23708
23484
  }
23709
23485
  if (newComponent) {
@@ -23721,7 +23497,7 @@ Please use command_status to check the result and report back to the user.`;
23721
23497
  const ms = Date.now() - t;
23722
23498
  next.push({
23723
23499
  id: nextHistoryId(next),
23724
- component: /* @__PURE__ */ jsx28(ChatTurnDuration, { durationMs: ms })
23500
+ component: /* @__PURE__ */ jsx36(ChatTurnDuration, { durationMs: ms })
23725
23501
  });
23726
23502
  }
23727
23503
  }
@@ -23739,7 +23515,7 @@ Please use command_status to check the result and report back to the user.`;
23739
23515
  if (!msg) return;
23740
23516
  setHistory((prev) => {
23741
23517
  const id = nextHistoryId(prev);
23742
- return [...prev, { id, component: /* @__PURE__ */ jsx28(ChatMeta, { children: msg }) }];
23518
+ return [...prev, { id, component: /* @__PURE__ */ jsx36(ChatMeta, { children: msg }) }];
23743
23519
  });
23744
23520
  };
23745
23521
  uiEventBus.on("user_overlay", handleUiOverlay);
@@ -23754,7 +23530,7 @@ Please use command_status to check the result and report back to the user.`;
23754
23530
  }, [eventBus, sessionId, handleConfirmation]);
23755
23531
  const renderInteractiveComponent = () => {
23756
23532
  if (mcpStatus !== "connected") {
23757
- return /* @__PURE__ */ jsx28(
23533
+ return /* @__PURE__ */ jsx36(
23758
23534
  SessionInfoConnectingMCP_default,
23759
23535
  {
23760
23536
  workdir,
@@ -23762,8 +23538,8 @@ Please use command_status to check the result and report back to the user.`;
23762
23538
  }
23763
23539
  );
23764
23540
  }
23765
- return /* @__PURE__ */ jsxs25(Box27, { flexDirection: "column", children: [
23766
- pendingAskUserQuestions && pendingAskUserQuestions.length > 0 ? /* @__PURE__ */ jsx28(
23541
+ return /* @__PURE__ */ jsxs33(Box35, { flexDirection: "column", children: [
23542
+ pendingAskUserQuestions && pendingAskUserQuestions.length > 0 ? /* @__PURE__ */ jsx36(
23767
23543
  AskUserQuestionPrompt,
23768
23544
  {
23769
23545
  questions: pendingAskUserQuestions,
@@ -23779,7 +23555,7 @@ Please use command_status to check the result and report back to the user.`;
23779
23555
  }
23780
23556
  }
23781
23557
  ) : null,
23782
- pendingConfirmation ? /* @__PURE__ */ jsx28(
23558
+ pendingConfirmation ? /* @__PURE__ */ jsx36(
23783
23559
  ConfirmationPrompt,
23784
23560
  {
23785
23561
  toolCalls: pendingConfirmation,
@@ -23792,7 +23568,7 @@ Please use command_status to check the result and report back to the user.`;
23792
23568
  }
23793
23569
  }
23794
23570
  ) : null,
23795
- isProcessing && !pendingConfirmation && !pendingAskUserQuestions && /* @__PURE__ */ jsx28(
23571
+ isProcessing && !pendingConfirmation && !pendingAskUserQuestions && /* @__PURE__ */ jsx36(
23796
23572
  WorkingTimer,
23797
23573
  {
23798
23574
  eventBus,
@@ -23802,7 +23578,7 @@ Please use command_status to check the result and report back to the user.`;
23802
23578
  isReasoning
23803
23579
  }
23804
23580
  ),
23805
- /* @__PURE__ */ jsx28(
23581
+ /* @__PURE__ */ jsx36(
23806
23582
  InputPrompt,
23807
23583
  {
23808
23584
  onSubmit: handleSubmit,
@@ -23814,10 +23590,10 @@ Please use command_status to check the result and report back to the user.`;
23814
23590
  )
23815
23591
  ] });
23816
23592
  };
23817
- return /* @__PURE__ */ jsxs25(Box27, { flexDirection: "column", children: [
23818
- /* @__PURE__ */ jsx28(Static, { items: history, children: (item) => /* @__PURE__ */ jsx28(Box27, { children: item.component }, item.id) }),
23819
- liveToolName ? /* @__PURE__ */ jsx28(Box27, { paddingLeft: 2, marginBottom: 0, children: /* @__PURE__ */ jsxs25(Text26, { dimColor: true, children: [
23820
- /* @__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: [
23821
23597
  "*",
23822
23598
  " "
23823
23599
  ] }),
@@ -23825,7 +23601,7 @@ Please use command_status to check the result and report back to the user.`;
23825
23601
  liveToolName,
23826
23602
  "\u2026"
23827
23603
  ] }) }) : null,
23828
- /* @__PURE__ */ jsx28(
23604
+ /* @__PURE__ */ jsx36(
23829
23605
  StreamingText,
23830
23606
  {
23831
23607
  eventBus,
@@ -23834,7 +23610,7 @@ Please use command_status to check the result and report back to the user.`;
23834
23610
  }
23835
23611
  ),
23836
23612
  renderInteractiveComponent(),
23837
- showWorkers && /* @__PURE__ */ jsx28(
23613
+ showWorkers && /* @__PURE__ */ jsx36(
23838
23614
  WorkerOverlay,
23839
23615
  {
23840
23616
  visible: showWorkers,
@@ -23908,6 +23684,42 @@ function stopTitleKeeper() {
23908
23684
 
23909
23685
  // src/main.ts
23910
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
23911
23723
  function extractUserMessage(envelope) {
23912
23724
  const c = envelope.context;
23913
23725
  if (c && typeof c === "object" && typeof c.user_request === "string") {
@@ -24081,7 +23893,6 @@ async function runAgentMode() {
24081
23893
  if (agentRef) {
24082
23894
  await agentRef.closeActiveTurn("worker_done_exit");
24083
23895
  }
24084
- finalizeSession(sessionId, "completed", { finishedBy: "done-event" });
24085
23896
  writeAgentEvent(sessionId, {
24086
23897
  event_type: "result",
24087
23898
  status: "success",
@@ -24094,6 +23905,7 @@ async function runAgentMode() {
24094
23905
  attachments: lastAttachments
24095
23906
  }
24096
23907
  });
23908
+ finalizeSession(sessionId, "completed", { finishedBy: "done-event" });
24097
23909
  process.exit(0);
24098
23910
  }
24099
23911
  });
@@ -24136,7 +23948,6 @@ async function runAgentMode() {
24136
23948
  if (!resultEmitted) {
24137
23949
  resultEmitted = true;
24138
23950
  await agent.closeActiveTurn("worker_post_turn_fallback");
24139
- finalizeSession(sessionId, "completed", { finishedBy: "post-turn-fallback" });
24140
23951
  writeAgentEvent(sessionId, {
24141
23952
  event_type: "result",
24142
23953
  status: "success",
@@ -24149,6 +23960,7 @@ async function runAgentMode() {
24149
23960
  attachments: lastAttachments
24150
23961
  }
24151
23962
  });
23963
+ finalizeSession(sessionId, "completed", { finishedBy: "post-turn-fallback" });
24152
23964
  process.exit(0);
24153
23965
  }
24154
23966
  } catch (err) {
@@ -24156,7 +23968,6 @@ async function runAgentMode() {
24156
23968
  if (agentRef) {
24157
23969
  await agentRef.closeActiveTurn("worker_exception");
24158
23970
  }
24159
- finalizeSession(sessionId, "error", { finishedBy: "exception" });
24160
23971
  writeAgentEvent(sessionId, {
24161
23972
  event_type: "result",
24162
23973
  status: "error",
@@ -24166,6 +23977,7 @@ async function runAgentMode() {
24166
23977
  details: err?.message
24167
23978
  }
24168
23979
  });
23980
+ finalizeSession(sessionId, "error", { finishedBy: "exception" });
24169
23981
  }
24170
23982
  process.exit(1);
24171
23983
  }