@aurora-foundation/obsidian-next 0.4.8 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/chunk-2JWDGXTR.js +42 -0
  2. package/dist/chunk-3UCL6RYE.js +7272 -0
  3. package/dist/chunk-3VZGPA3N.js +42 -0
  4. package/dist/chunk-3XR3GZLX.js +7809 -0
  5. package/dist/chunk-6YJSTQKN.js +7817 -0
  6. package/dist/chunk-7XFP3ZUD.js +42 -0
  7. package/dist/chunk-ASDVTRIQ.js +7805 -0
  8. package/dist/chunk-BAKREPY2.js +439 -0
  9. package/dist/chunk-BFRO5BO2.js +42 -0
  10. package/dist/chunk-CHNVBJN3.js +7272 -0
  11. package/dist/chunk-DAR45YDV.js +42 -0
  12. package/dist/chunk-FNXAI27K.js +7812 -0
  13. package/dist/chunk-HKPL675M.js +42 -0
  14. package/dist/chunk-INEXRRON.js +42 -0
  15. package/dist/chunk-ISO6GNIB.js +429 -0
  16. package/dist/chunk-MGDY5JUY.js +581 -0
  17. package/dist/chunk-OFTKVOQ2.js +7828 -0
  18. package/dist/chunk-PD4ZKYTJ.js +7838 -0
  19. package/dist/chunk-PQSPCOJ7.js +7616 -0
  20. package/dist/chunk-QSEH5NXV.js +7807 -0
  21. package/dist/chunk-RUEIA6Z5.js +42 -0
  22. package/dist/chunk-S5IDXE2L.js +42 -0
  23. package/dist/chunk-UG3HWGIO.js +42 -0
  24. package/dist/chunk-UOESII6R.js +42 -0
  25. package/dist/chunk-VWMT4HCP.js +7668 -0
  26. package/dist/chunk-YFQI44IA.js +42 -0
  27. package/dist/chunk-ZR7MEF3B.js +7605 -0
  28. package/dist/context-NI6N46WG.js +10 -0
  29. package/dist/index.js +585 -345
  30. package/dist/memory-GXW2OA2T.js +13 -0
  31. package/dist/resume-EA6ISWW2.js +15 -0
  32. package/dist/resume-EIM5FN42.js +15 -0
  33. package/dist/resume-FBVK6NAI.js +15 -0
  34. package/dist/resume-H6J5PQIA.js +15 -0
  35. package/dist/resume-JDDVTMM4.js +15 -0
  36. package/dist/resume-JFYYR7DJ.js +15 -0
  37. package/dist/resume-KGFAZY34.js +15 -0
  38. package/dist/resume-MF5TM2ZB.js +15 -0
  39. package/dist/resume-O6PLICAA.js +15 -0
  40. package/dist/resume-PZU3PWCJ.js +15 -0
  41. package/dist/resume-YD76GI2J.js +15 -0
  42. package/dist/resume-YKAKOXWV.js +15 -0
  43. package/dist/session-37MDDCWV.js +14 -0
  44. package/dist/session-56ZI3GZV.js +14 -0
  45. package/dist/session-5OFIDWGU.js +14 -0
  46. package/dist/session-7LPACLRV.js +14 -0
  47. package/dist/session-CJ6HSKDI.js +14 -0
  48. package/dist/session-CUXGN26I.js +14 -0
  49. package/dist/session-DCGNGGMV.js +14 -0
  50. package/dist/session-LEVSW6JH.js +14 -0
  51. package/dist/session-MHZAYMLC.js +14 -0
  52. package/dist/session-NNU7OW5K.js +14 -0
  53. package/dist/session-R5UG5PZR.js +14 -0
  54. package/dist/session-T64DMDAU.js +14 -0
  55. package/dist/settings-4ALCRT5S.js +8 -0
  56. package/dist/skills/defaults/clipboard.mjs +46 -0
  57. package/dist/skills/defaults/notify.mjs +36 -0
  58. package/dist/skills/defaults/open_app.mjs +53 -0
  59. package/dist/skills/defaults/speak.mjs +47 -0
  60. package/dist/skills/defaults/spotify_control.mjs +187 -0
  61. package/package.json +7 -4
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  memory
4
- } from "./chunk-6TXUOTT2.js";
4
+ } from "./chunk-MGDY5JUY.js";
5
5
  import {
6
6
  resumeCommand
7
- } from "./chunk-ZIWLQSLK.js";
7
+ } from "./chunk-RUEIA6Z5.js";
8
8
  import {
9
9
  auditLog,
10
10
  auditor,
@@ -17,14 +17,15 @@ import {
17
17
  sandbox,
18
18
  scheduler,
19
19
  session,
20
+ skillsManager,
20
21
  tasks,
21
22
  tools,
22
23
  undo,
23
24
  usage
24
- } from "./chunk-KY22FIT3.js";
25
+ } from "./chunk-PD4ZKYTJ.js";
25
26
  import {
26
27
  context
27
- } from "./chunk-5OKGLNQW.js";
28
+ } from "./chunk-BAKREPY2.js";
28
29
  import {
29
30
  checkDependencies,
30
31
  isComputerUseAvailable
@@ -38,19 +39,19 @@ import {
38
39
  } from "./chunk-S6GNETVE.js";
39
40
  import {
40
41
  settings
41
- } from "./chunk-LPGNO3PK.js";
42
+ } from "./chunk-ISO6GNIB.js";
42
43
  import {
43
44
  bus
44
45
  } from "./chunk-WQM6FFSD.js";
45
46
  import "./chunk-R6P2E2ZQ.js";
46
47
 
47
48
  // src/index.ts
48
- import React30 from "react";
49
+ import React31 from "react";
49
50
  import { render } from "ink";
50
51
 
51
52
  // src/ui/Root.tsx
52
- import React29, { useState as useState28, useEffect as useEffect22, useCallback as useCallback7, useRef } from "react";
53
- import { Box as Box32, Text as Text32, useApp, useInput as useInput25, useStdout } from "ink";
53
+ import React30, { useState as useState29, useEffect as useEffect23, useCallback as useCallback7, useRef } from "react";
54
+ import { Box as Box33, Text as Text33, useApp, useInput as useInput26, useStdout } from "ink";
54
55
 
55
56
  // src/components/ApprovalPrompt.tsx
56
57
  import { useState, useCallback } from "react";
@@ -370,6 +371,7 @@ var COMMANDS = [
370
371
  { name: "/mcp", desc: "Model Context Protocol", isView: true },
371
372
  { name: "/resume", desc: "Restore saved session", isView: true },
372
373
  { name: "/ollama", desc: "Ollama model registry", isView: true },
374
+ { name: "/skills", desc: "Skills store - browse & manage", isView: true },
373
375
  { name: "/clear", desc: "Clear conversation" },
374
376
  { name: "/exit", desc: "Save session and exit" }
375
377
  ];
@@ -496,8 +498,8 @@ var CommandPalette = ({ onSelect, onClose }) => {
496
498
  };
497
499
 
498
500
  // src/ui/MessageList.tsx
499
- import React8 from "react";
500
- import { Box as Box10, Text as Text10 } from "ink";
501
+ import React7 from "react";
502
+ import { Box as Box9, Text as Text9 } from "ink";
501
503
 
502
504
  // src/components/AgentLine.tsx
503
505
  import { Box as Box7, Text as Text7 } from "ink";
@@ -850,7 +852,7 @@ var AgentLine = ({
850
852
  const showGlitter = isStreaming;
851
853
  const hasMarkdown = content.includes("```") || content.includes("# ") || content.match(/^\s*[-*]\s/m) || content.includes("`") || content.includes("**") || content.includes("__") || content.includes("*") && content.split("*").length > 2;
852
854
  const renderedContent = hasMarkdown && !isProcessing ? renderMarkdown(content) : content;
853
- return /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", paddingX: 0, children: /* @__PURE__ */ jsx7(Box7, { flexDirection: "row", children: /* @__PURE__ */ jsx7(Box7, { flexGrow: 1, flexDirection: "column", children: renderedContent.split("\n").map((line, i) => /* @__PURE__ */ jsx7(Text7, { color: showGlitter ? "gray" : "white", children: line || " " }, i)) }) }) });
855
+ return /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", paddingX: 0, flexGrow: 1, children: /* @__PURE__ */ jsx7(Text7, { color: showGlitter ? "gray" : "white", children: renderedContent }) });
854
856
  };
855
857
 
856
858
  // src/components/ToolOutput.tsx
@@ -926,10 +928,106 @@ var ToolOutput = ({
926
928
  ] });
927
929
  };
928
930
 
929
- // src/components/WelcomeBanner.tsx
930
- import React7 from "react";
931
- import { Box as Box9, Text as Text9 } from "ink";
931
+ // src/ui/MessageList.tsx
932
932
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
933
+ function formatToolName(tool) {
934
+ return tool.split(/[_-]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
935
+ }
936
+ function summarizeArgs(tool, argsJson) {
937
+ try {
938
+ const args = JSON.parse(argsJson);
939
+ const firstVal = Object.values(args)[0];
940
+ if (typeof firstVal === "string") {
941
+ const cleaned = firstVal.trim();
942
+ return cleaned.length > 60 ? cleaned.slice(0, 60) + "..." : cleaned;
943
+ }
944
+ return "";
945
+ } catch {
946
+ return "";
947
+ }
948
+ }
949
+ var MessageListComponent = ({
950
+ events,
951
+ maxEvents = 50,
952
+ scrollOffset = 0
953
+ }) => {
954
+ const end = events.length - scrollOffset;
955
+ const start = Math.max(0, end - maxEvents);
956
+ const visibleEvents = events.slice(start, end);
957
+ return /* @__PURE__ */ jsx9(Box9, { flexDirection: "column", children: visibleEvents.map((event, i) => {
958
+ const prevEvent = visibleEvents[i - 1];
959
+ const nextEvent = visibleEvents[i + 1];
960
+ let content = null;
961
+ const isToolResult = event.type === "tool_result" && prevEvent?.type === "tool_start";
962
+ const needsMargin = !isToolResult;
963
+ if (event.type === "user_input") {
964
+ content = /* @__PURE__ */ jsx9(Box9, { children: /* @__PURE__ */ jsxs8(Text9, { backgroundColor: "#1a1a2e", color: "#e0e0e0", children: [
965
+ " > ",
966
+ event.content,
967
+ " "
968
+ ] }) });
969
+ } else if (event.type === "thought") {
970
+ if (event.content.startsWith("Mode:")) return null;
971
+ if (event.hidden) return null;
972
+ const isLast = i === visibleEvents.length - 1;
973
+ const doneNext = nextEvent?.type === "done" ? nextEvent : null;
974
+ const durationSuffix = doneNext?.durationMs ? ` (${(doneNext.durationMs / 1e3).toFixed(1)}s)` : "";
975
+ content = /* @__PURE__ */ jsxs8(Box9, { children: [
976
+ /* @__PURE__ */ jsxs8(Text9, { color: "white", children: [
977
+ "\u23FA",
978
+ " "
979
+ ] }),
980
+ /* @__PURE__ */ jsx9(AgentLine, { content: event.content + durationSuffix, isStreaming: isLast && !doneNext })
981
+ ] });
982
+ } else if (event.type === "tool_start") {
983
+ const argsSummary = summarizeArgs(event.tool, event.args);
984
+ const displayName = formatToolName(event.tool);
985
+ content = /* @__PURE__ */ jsxs8(Box9, { children: [
986
+ /* @__PURE__ */ jsxs8(Text9, { color: "cyan", children: [
987
+ "\u23FA",
988
+ " "
989
+ ] }),
990
+ /* @__PURE__ */ jsx9(Text9, { color: "cyan", bold: true, children: displayName }),
991
+ argsSummary ? /* @__PURE__ */ jsxs8(Text9, { color: "cyan", dimColor: true, children: [
992
+ "(",
993
+ argsSummary,
994
+ ")"
995
+ ] }) : null
996
+ ] });
997
+ } else if (event.type === "tool_result") {
998
+ content = /* @__PURE__ */ jsx9(Box9, { paddingLeft: 2, children: /* @__PURE__ */ jsx9(
999
+ ToolOutput,
1000
+ {
1001
+ tool: event.tool,
1002
+ output: event.output,
1003
+ isError: event.isError
1004
+ }
1005
+ ) });
1006
+ } else if (event.type === "done") {
1007
+ if (prevEvent?.type === "thought") return null;
1008
+ const duration = event.durationMs ? ` (${(event.durationMs / 1e3).toFixed(1)}s)` : "";
1009
+ content = /* @__PURE__ */ jsx9(Box9, { children: /* @__PURE__ */ jsxs8(Text9, { color: "green", children: [
1010
+ "\u23FA",
1011
+ " Done",
1012
+ duration
1013
+ ] }) });
1014
+ } else if (event.type === "error") {
1015
+ content = /* @__PURE__ */ jsx9(Box9, { children: /* @__PURE__ */ jsxs8(Text9, { color: "red", children: [
1016
+ "\u23FA",
1017
+ " ",
1018
+ event.message
1019
+ ] }) });
1020
+ }
1021
+ if (!content) return null;
1022
+ return /* @__PURE__ */ jsx9(Box9, { marginTop: needsMargin ? 1 : 0, flexDirection: "column", children: content }, i);
1023
+ }) });
1024
+ };
1025
+ var MessageList = React7.memo(MessageListComponent);
1026
+
1027
+ // src/components/WelcomeBanner.tsx
1028
+ import React8 from "react";
1029
+ import { Box as Box10, Text as Text10 } from "ink";
1030
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
933
1031
  function renderBannerArt() {
934
1032
  return [
935
1033
  " ,\u259E\u2580\u2580\u2580\u2580\u2580\u259A,",
@@ -951,35 +1049,35 @@ var WelcomeBannerComponent = ({ model, mode, version = "v1.0", sandbox: sandbox2
951
1049
  const cwd = process.cwd();
952
1050
  const home = process.env.HOME || process.env.USERPROFILE || "";
953
1051
  const shortCwd = cwd.startsWith(home) ? "~" + cwd.slice(home.length) : cwd;
954
- return /* @__PURE__ */ jsxs8(Box9, { flexDirection: "row", paddingX: 1, marginBottom: 1, children: [
955
- /* @__PURE__ */ jsxs8(Box9, { flexDirection: "column", marginRight: 1, children: [
956
- /* @__PURE__ */ jsx9(Text9, { color: "red", bold: true, children: art[0] }),
957
- /* @__PURE__ */ jsx9(Text9, { color: "red", children: art[1] }),
958
- /* @__PURE__ */ jsx9(Text9, { color: "red", children: art[2] }),
959
- /* @__PURE__ */ jsx9(Text9, { color: "red", dimColor: true, children: art[3] })
1052
+ return /* @__PURE__ */ jsxs9(Box10, { flexDirection: "row", paddingX: 1, marginBottom: 1, children: [
1053
+ /* @__PURE__ */ jsxs9(Box10, { flexDirection: "column", marginRight: 1, children: [
1054
+ /* @__PURE__ */ jsx10(Text10, { color: "red", bold: true, children: art[0] }),
1055
+ /* @__PURE__ */ jsx10(Text10, { color: "red", children: art[1] }),
1056
+ /* @__PURE__ */ jsx10(Text10, { color: "red", children: art[2] }),
1057
+ /* @__PURE__ */ jsx10(Text10, { color: "red", dimColor: true, children: art[3] })
960
1058
  ] }),
961
- /* @__PURE__ */ jsxs8(Box9, { flexDirection: "column", justifyContent: "center", children: [
962
- /* @__PURE__ */ jsxs8(Text9, { bold: true, color: "white", children: [
1059
+ /* @__PURE__ */ jsxs9(Box10, { flexDirection: "column", justifyContent: "center", children: [
1060
+ /* @__PURE__ */ jsxs9(Text10, { bold: true, color: "white", children: [
963
1061
  "obsidian ",
964
- /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: version })
1062
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: version })
965
1063
  ] }),
966
- /* @__PURE__ */ jsxs8(Text9, { children: [
1064
+ /* @__PURE__ */ jsxs9(Text10, { children: [
967
1065
  formatModel(model),
968
1066
  " ",
969
- /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "\xB7" }),
1067
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "\xB7" }),
970
1068
  " ",
971
- /* @__PURE__ */ jsxs8(Text9, { color: mode === "auto" ? "green" : mode === "plan" ? "yellow" : "red", children: [
1069
+ /* @__PURE__ */ jsxs9(Text10, { color: mode === "auto" ? "green" : mode === "plan" ? "yellow" : "red", children: [
972
1070
  mode,
973
1071
  " mode"
974
1072
  ] }),
975
1073
  " ",
976
- /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "\xB7" }),
1074
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "\xB7" }),
977
1075
  " ",
978
- /* @__PURE__ */ jsx9(Text9, { color: sandbox2 === "sandbox" ? "green" : "yellow", children: sandbox2 === "sandbox" ? "sandbox" : "no sandbox" })
1076
+ /* @__PURE__ */ jsx10(Text10, { color: sandbox2 === "sandbox" ? "green" : "yellow", children: sandbox2 === "sandbox" ? "sandbox" : "no sandbox" })
979
1077
  ] }),
980
- /* @__PURE__ */ jsxs8(Box9, { children: [
981
- /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: shortCwd }),
982
- branch && /* @__PURE__ */ jsxs8(Text9, { color: "gray", children: [
1078
+ /* @__PURE__ */ jsxs9(Box10, { children: [
1079
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: shortCwd }),
1080
+ branch && /* @__PURE__ */ jsxs9(Text10, { color: "gray", children: [
983
1081
  " (",
984
1082
  branch,
985
1083
  ")"
@@ -988,111 +1086,7 @@ var WelcomeBannerComponent = ({ model, mode, version = "v1.0", sandbox: sandbox2
988
1086
  ] })
989
1087
  ] });
990
1088
  };
991
- var WelcomeBanner = React7.memo(WelcomeBannerComponent);
992
-
993
- // src/ui/MessageList.tsx
994
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
995
- function formatToolName(tool) {
996
- return tool.split(/[_-]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
997
- }
998
- function summarizeArgs(tool, argsJson) {
999
- try {
1000
- const args = JSON.parse(argsJson);
1001
- const firstVal = Object.values(args)[0];
1002
- if (typeof firstVal === "string") {
1003
- const cleaned = firstVal.trim();
1004
- return cleaned.length > 60 ? cleaned.slice(0, 60) + "..." : cleaned;
1005
- }
1006
- return "";
1007
- } catch {
1008
- return "";
1009
- }
1010
- }
1011
- var MessageListComponent = ({
1012
- events,
1013
- maxEvents = 50,
1014
- model = "",
1015
- mode = "safe",
1016
- version = "v1.0",
1017
- scrollOffset = 0,
1018
- sandbox: sandbox2 = "local",
1019
- branch = ""
1020
- }) => {
1021
- const end = events.length - scrollOffset;
1022
- const start = Math.max(0, end - maxEvents);
1023
- const visibleEvents = events.slice(start, end);
1024
- return /* @__PURE__ */ jsxs9(Box10, { flexDirection: "column", children: [
1025
- /* @__PURE__ */ jsx10(WelcomeBanner, { model, mode, version, sandbox: sandbox2, branch }),
1026
- visibleEvents.map((event, i) => {
1027
- const prevEvent = visibleEvents[i - 1];
1028
- const nextEvent = visibleEvents[i + 1];
1029
- let content = null;
1030
- const isToolResult = event.type === "tool_result" && prevEvent?.type === "tool_start";
1031
- const needsMargin = !isToolResult;
1032
- if (event.type === "user_input") {
1033
- content = /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsxs9(Text10, { backgroundColor: "#1a1a2e", color: "#e0e0e0", children: [
1034
- " > ",
1035
- event.content,
1036
- " "
1037
- ] }) });
1038
- } else if (event.type === "thought") {
1039
- if (event.content.startsWith("Mode:")) return null;
1040
- if (event.hidden) return null;
1041
- const isLast = i === visibleEvents.length - 1;
1042
- const doneNext = nextEvent?.type === "done" ? nextEvent : null;
1043
- const durationSuffix = doneNext?.durationMs ? ` (${(doneNext.durationMs / 1e3).toFixed(1)}s)` : "";
1044
- content = /* @__PURE__ */ jsxs9(Box10, { children: [
1045
- /* @__PURE__ */ jsxs9(Text10, { color: "white", children: [
1046
- "\u23FA",
1047
- " "
1048
- ] }),
1049
- /* @__PURE__ */ jsx10(AgentLine, { content: event.content + durationSuffix, isStreaming: isLast && !doneNext })
1050
- ] });
1051
- } else if (event.type === "tool_start") {
1052
- const argsSummary = summarizeArgs(event.tool, event.args);
1053
- const displayName = formatToolName(event.tool);
1054
- content = /* @__PURE__ */ jsxs9(Box10, { children: [
1055
- /* @__PURE__ */ jsxs9(Text10, { color: "cyan", children: [
1056
- "\u23FA",
1057
- " "
1058
- ] }),
1059
- /* @__PURE__ */ jsx10(Text10, { color: "cyan", bold: true, children: displayName }),
1060
- argsSummary ? /* @__PURE__ */ jsxs9(Text10, { color: "cyan", dimColor: true, children: [
1061
- "(",
1062
- argsSummary,
1063
- ")"
1064
- ] }) : null
1065
- ] });
1066
- } else if (event.type === "tool_result") {
1067
- content = /* @__PURE__ */ jsx10(Box10, { paddingLeft: 2, children: /* @__PURE__ */ jsx10(
1068
- ToolOutput,
1069
- {
1070
- tool: event.tool,
1071
- output: event.output,
1072
- isError: event.isError
1073
- }
1074
- ) });
1075
- } else if (event.type === "done") {
1076
- if (prevEvent?.type === "thought") return null;
1077
- const duration = event.durationMs ? ` (${(event.durationMs / 1e3).toFixed(1)}s)` : "";
1078
- content = /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsxs9(Text10, { color: "green", children: [
1079
- "\u23FA",
1080
- " Done",
1081
- duration
1082
- ] }) });
1083
- } else if (event.type === "error") {
1084
- content = /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsxs9(Text10, { color: "red", children: [
1085
- "\u23FA",
1086
- " ",
1087
- event.message
1088
- ] }) });
1089
- }
1090
- if (!content) return null;
1091
- return /* @__PURE__ */ jsx10(Box10, { marginTop: needsMargin ? 1 : 0, flexDirection: "column", children: content }, i);
1092
- })
1093
- ] });
1094
- };
1095
- var MessageList = React8.memo(MessageListComponent);
1089
+ var WelcomeBanner = React8.memo(WelcomeBannerComponent);
1096
1090
 
1097
1091
  // src/ui/views/DoctorView.tsx
1098
1092
  import { useState as useState8, useEffect as useEffect4 } from "react";
@@ -3461,7 +3455,7 @@ var Agent = class {
3461
3455
  registerAbilities(scheduler);
3462
3456
  scheduler.start();
3463
3457
  if (resumeSessionId && resumeSessionId !== "PREVENT_CLEAR") {
3464
- const { session: session2 } = await import("./session-XFLOXGU3.js");
3458
+ const { session: session2 } = await import("./session-37MDDCWV.js");
3465
3459
  const result = await session2.restore(resumeSessionId);
3466
3460
  if (!result.success) {
3467
3461
  bus.emitAgent({
@@ -3490,7 +3484,7 @@ var Agent = class {
3490
3484
  await undo.init(this.sessionId);
3491
3485
  auditLog.setSessionId(this.sessionId);
3492
3486
  await auditLog.init();
3493
- const s = await (await import("./settings-YKJFSKMO.js")).settings.load();
3487
+ const s = await (await import("./settings-4ALCRT5S.js")).settings.load();
3494
3488
  redactor.setEnabled(s.security.piiRedaction);
3495
3489
  this.initialized = true;
3496
3490
  }
@@ -3518,7 +3512,7 @@ var Agent = class {
3518
3512
  break;
3519
3513
  case "/resume":
3520
3514
  if (args.length > 0) {
3521
- const { resumeCommand: resumeCommand2 } = await import("./resume-PLF4XGBD.js");
3515
+ const { resumeCommand: resumeCommand2 } = await import("./resume-O6PLICAA.js");
3522
3516
  await resumeCommand2(args);
3523
3517
  return true;
3524
3518
  }
@@ -3607,16 +3601,8 @@ ${change.beforeContent.slice(0, 500)}...` : ""}`;
3607
3601
  bus.emitAgent({
3608
3602
  type: "thought",
3609
3603
  content: `[${mode}] ${complexityLabel}`,
3610
- hidden: complexity === "simple"
3611
- // Hide for simple tasks to reduce flicker
3604
+ hidden: true
3612
3605
  });
3613
- if (suggestPlanMode && mode !== "plan") {
3614
- bus.emitAgent({
3615
- type: "thought",
3616
- content: "[TIP] Complex task detected. Consider switching to plan mode (Shift+Tab) for better results.",
3617
- hidden: false
3618
- });
3619
- }
3620
3606
  if (mode === "plan") {
3621
3607
  await this.runPlanMode(input);
3622
3608
  } else {
@@ -3755,7 +3741,7 @@ ${this.formatPlan(plan)}`
3755
3741
  [${taskProgress}]`;
3756
3742
  }
3757
3743
  try {
3758
- const { memory: memory2 } = await import("./memory-OAMK27IZ.js");
3744
+ const { memory: memory2 } = await import("./memory-GXW2OA2T.js");
3759
3745
  const results = await memory2.search(input);
3760
3746
  if (results.length > 0) {
3761
3747
  const relevant = results.slice(0, 3).map((m) => `- ${m.key}: ${m.content}`).join("\n");
@@ -3777,31 +3763,21 @@ ${relevant}`;
3777
3763
  }
3778
3764
  const response = await llm.streamChat(enhancedInput);
3779
3765
  if (response !== null) {
3780
- let finalResponse = response;
3781
3766
  const toolOutput = llm.getLastToolOutput();
3782
- if (finalResponse && !toolOutput) {
3783
- const lower = finalResponse.toLowerCase();
3767
+ if (response && !toolOutput) {
3768
+ const lower = response.toLowerCase();
3784
3769
  const isPromiseToAct = lower.includes("i'll check") || lower.includes("let me check") || lower.includes("i'll look") || lower.includes("let me look") || lower.includes("i'll list") || lower.includes("let me list") || lower.includes("i'll search") || lower.includes("let me search") || lower.includes("i'll run") || lower.includes("let me run") || lower.includes("i'll execute") || lower.includes("let me execute") || lower.includes("i will use") || lower.includes("let me use") || lower.includes("checking") || lower.includes("looking into");
3785
3770
  if (isPromiseToAct) {
3786
- const followUp = await llm.streamChat(
3771
+ await llm.streamChat(
3787
3772
  "[System] You said you would check but did not call any tools. Call the appropriate tool NOW and present the actual results to the user."
3788
3773
  );
3789
- if (followUp && followUp.trim()) {
3790
- finalResponse = followUp;
3791
- }
3792
3774
  }
3793
3775
  }
3794
- if (finalResponse && finalResponse.trim()) {
3795
- bus.emitAgent({ type: "thought", content: finalResponse });
3796
- } else if (toolOutput) {
3797
- bus.emitAgent({ type: "thought", content: toolOutput });
3798
- } else {
3776
+ if (!response?.trim() && !toolOutput) {
3799
3777
  const followUp = await llm.streamChat(
3800
3778
  "[System] You returned an empty response. Please execute the requested task or answer the question."
3801
3779
  );
3802
- if (followUp && followUp.trim()) {
3803
- bus.emitAgent({ type: "thought", content: followUp });
3804
- } else {
3780
+ if (!followUp?.trim()) {
3805
3781
  bus.emitAgent({
3806
3782
  type: "error",
3807
3783
  message: "Model returned empty response (multiple attempts)."
@@ -5064,25 +5040,230 @@ var SandboxView = ({ onClose }) => {
5064
5040
  ] });
5065
5041
  };
5066
5042
 
5067
- // src/components/SettingsMenu.tsx
5068
- import { useState as useState27, useCallback as useCallback6, useEffect as useEffect21 } from "react";
5043
+ // src/ui/views/SkillsView.tsx
5044
+ import { useState as useState27, useEffect as useEffect21 } from "react";
5069
5045
  import { Box as Box31, Text as Text31, useInput as useInput24 } from "ink";
5070
5046
  import { jsx as jsx31, jsxs as jsxs30 } from "react/jsx-runtime";
5047
+ var SkillsView = ({ onExit }) => {
5048
+ const [skills, setSkills] = useState27([]);
5049
+ const [selected, setSelected] = useState27(0);
5050
+ const [mode, setMode] = useState27("list");
5051
+ const [status, setStatus] = useState27(null);
5052
+ const [error, setError] = useState27(null);
5053
+ const [loading, setLoading] = useState27(true);
5054
+ const refresh = async () => {
5055
+ try {
5056
+ await skillsManager.init();
5057
+ const all = await skillsManager.listAll();
5058
+ setSkills(all);
5059
+ if (selected >= all.length) setSelected(Math.max(0, all.length - 1));
5060
+ } catch (e) {
5061
+ setError(e.message);
5062
+ }
5063
+ setLoading(false);
5064
+ };
5065
+ useEffect21(() => {
5066
+ refresh();
5067
+ }, []);
5068
+ useInput24(async (input, key) => {
5069
+ if (mode === "detail") {
5070
+ if (key.escape) {
5071
+ setMode("list");
5072
+ return;
5073
+ }
5074
+ return;
5075
+ }
5076
+ if (key.escape) {
5077
+ onExit();
5078
+ return;
5079
+ }
5080
+ if (key.upArrow) {
5081
+ setSelected((p) => p > 0 ? p - 1 : Math.max(0, skills.length - 1));
5082
+ setStatus(null);
5083
+ setError(null);
5084
+ }
5085
+ if (key.downArrow) {
5086
+ setSelected((p) => p < skills.length - 1 ? p + 1 : 0);
5087
+ setStatus(null);
5088
+ setError(null);
5089
+ }
5090
+ if (skills.length === 0) return;
5091
+ const skill = skills[selected];
5092
+ if (key.return || input === "t") {
5093
+ try {
5094
+ if (skill.enabled) {
5095
+ await skillsManager.disable(skill.name);
5096
+ setStatus(`Disabled '${skill.name}' - will take effect on restart`);
5097
+ } else {
5098
+ await skillsManager.enable(skill.name);
5099
+ setStatus(`Enabled '${skill.name}' - will take effect on restart`);
5100
+ }
5101
+ await refresh();
5102
+ } catch (e) {
5103
+ setError(e.message);
5104
+ }
5105
+ }
5106
+ if (input === "v") {
5107
+ setMode("detail");
5108
+ }
5109
+ if ((input === "r" || key.delete) && skill.source === "user") {
5110
+ const ok = await skillsManager.remove(skill.name);
5111
+ if (ok) {
5112
+ setStatus(`Removed '${skill.name}'`);
5113
+ await refresh();
5114
+ } else {
5115
+ setError(`Cannot remove '${skill.name}'`);
5116
+ }
5117
+ }
5118
+ if (input === "c" && skill.source === "default") {
5119
+ const ok = await skillsManager.copyToUser(skill.name);
5120
+ if (ok) {
5121
+ setStatus(`Copied '${skill.name}' to user skills for customization`);
5122
+ await refresh();
5123
+ } else {
5124
+ setError(`Failed to copy '${skill.name}'`);
5125
+ }
5126
+ }
5127
+ if (input === "l") {
5128
+ setLoading(true);
5129
+ setStatus("Reloading skills...");
5130
+ try {
5131
+ await tools.init();
5132
+ await refresh();
5133
+ setStatus("Skills reloaded");
5134
+ } catch (e) {
5135
+ setError(e.message);
5136
+ }
5137
+ setLoading(false);
5138
+ }
5139
+ });
5140
+ const VISIBLE = 8;
5141
+ const startIdx = Math.max(0, Math.min(selected - Math.floor(VISIBLE / 2), skills.length - VISIBLE));
5142
+ const endIdx = Math.min(startIdx + VISIBLE, skills.length);
5143
+ const visible = skills.slice(startIdx, endIdx);
5144
+ if (loading) {
5145
+ return /* @__PURE__ */ jsx31(Box31, { flexDirection: "column", paddingX: 1, children: /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "Loading skills..." }) });
5146
+ }
5147
+ if (mode === "detail" && skills[selected]) {
5148
+ const s = skills[selected];
5149
+ return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", paddingX: 1, borderStyle: "round", borderColor: "gray", children: [
5150
+ /* @__PURE__ */ jsx31(Box31, { marginBottom: 1, borderStyle: "single", borderTop: false, borderLeft: false, borderRight: false, borderBottom: true, borderColor: "gray", children: /* @__PURE__ */ jsx31(Text31, { bold: true, color: "cyan", children: "SKILL DETAIL" }) }),
5151
+ /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", gap: 0, children: [
5152
+ /* @__PURE__ */ jsxs30(Text31, { children: [
5153
+ /* @__PURE__ */ jsx31(Text31, { bold: true, children: "Name: " }),
5154
+ /* @__PURE__ */ jsx31(Text31, { color: "white", children: s.name })
5155
+ ] }),
5156
+ /* @__PURE__ */ jsxs30(Text31, { children: [
5157
+ /* @__PURE__ */ jsx31(Text31, { bold: true, children: "Source: " }),
5158
+ /* @__PURE__ */ jsx31(Text31, { color: s.source === "default" ? "yellow" : "green", children: s.source })
5159
+ ] }),
5160
+ /* @__PURE__ */ jsxs30(Text31, { children: [
5161
+ /* @__PURE__ */ jsx31(Text31, { bold: true, children: "Status: " }),
5162
+ /* @__PURE__ */ jsx31(Text31, { color: s.enabled ? "green" : "red", children: s.enabled ? "Enabled" : "Disabled" })
5163
+ ] }),
5164
+ /* @__PURE__ */ jsxs30(Text31, { children: [
5165
+ /* @__PURE__ */ jsx31(Text31, { bold: true, children: "File: " }),
5166
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: s.filename })
5167
+ ] }),
5168
+ /* @__PURE__ */ jsx31(Box31, { marginTop: 1, children: /* @__PURE__ */ jsx31(Text31, { children: /* @__PURE__ */ jsx31(Text31, { bold: true, children: "Description: " }) }) }),
5169
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", wrap: "wrap", children: s.description || "No description" })
5170
+ ] }),
5171
+ /* @__PURE__ */ jsx31(Box31, { marginTop: 1, borderStyle: "single", borderTop: true, borderLeft: false, borderRight: false, borderBottom: false, borderColor: "gray", children: /* @__PURE__ */ jsxs30(Text31, { color: "gray", children: [
5172
+ /* @__PURE__ */ jsx31(Text31, { bold: true, children: "Esc" }),
5173
+ " Back"
5174
+ ] }) })
5175
+ ] });
5176
+ }
5177
+ return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", paddingX: 1, borderStyle: "round", borderColor: "gray", children: [
5178
+ /* @__PURE__ */ jsxs30(Box31, { marginBottom: 1, borderStyle: "single", borderTop: false, borderLeft: false, borderRight: false, borderBottom: true, borderColor: "gray", children: [
5179
+ /* @__PURE__ */ jsx31(Text31, { bold: true, color: "cyan", children: "SKILLS STORE" }),
5180
+ /* @__PURE__ */ jsxs30(Text31, { color: "gray", children: [
5181
+ " ",
5182
+ skills.filter((s) => s.enabled).length,
5183
+ "/",
5184
+ skills.length,
5185
+ " active"
5186
+ ] })
5187
+ ] }),
5188
+ error && /* @__PURE__ */ jsx31(Box31, { marginBottom: 1, children: /* @__PURE__ */ jsxs30(Text31, { color: "red", children: [
5189
+ "[ERROR] ",
5190
+ error
5191
+ ] }) }),
5192
+ status && /* @__PURE__ */ jsx31(Box31, { marginBottom: 1, children: /* @__PURE__ */ jsx31(Text31, { color: "green", children: status }) }),
5193
+ /* @__PURE__ */ jsxs30(Box31, { flexDirection: "row", marginBottom: 1, children: [
5194
+ /* @__PURE__ */ jsx31(Box31, { width: 4, children: /* @__PURE__ */ jsx31(Text31, { color: "gray", bold: true, children: " " }) }),
5195
+ /* @__PURE__ */ jsx31(Box31, { width: 22, children: /* @__PURE__ */ jsx31(Text31, { color: "gray", bold: true, children: "Skill" }) }),
5196
+ /* @__PURE__ */ jsx31(Box31, { width: 10, children: /* @__PURE__ */ jsx31(Text31, { color: "gray", bold: true, children: "Source" }) }),
5197
+ /* @__PURE__ */ jsx31(Box31, { width: 10, children: /* @__PURE__ */ jsx31(Text31, { color: "gray", bold: true, children: "Status" }) }),
5198
+ /* @__PURE__ */ jsx31(Box31, { flexGrow: 1, children: /* @__PURE__ */ jsx31(Text31, { color: "gray", bold: true, children: "Description" }) })
5199
+ ] }),
5200
+ skills.length === 0 ? /* @__PURE__ */ jsx31(Box31, { paddingY: 2, justifyContent: "center", children: /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "No skills found. Create one with /tool create_skill or add .mjs files to ~/.obsidian-next/skills/" }) }) : visible.map((s, idx) => {
5201
+ const realIndex = startIdx + idx;
5202
+ const isSel = realIndex === selected;
5203
+ return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "row", children: [
5204
+ /* @__PURE__ */ jsx31(Box31, { width: 4, children: /* @__PURE__ */ jsx31(Text31, { color: isSel ? "cyan" : "white", children: isSel ? "> " : " " }) }),
5205
+ /* @__PURE__ */ jsx31(Box31, { width: 22, children: /* @__PURE__ */ jsx31(Text31, { color: isSel ? "cyan" : "white", bold: isSel, children: s.name }) }),
5206
+ /* @__PURE__ */ jsx31(Box31, { width: 10, children: /* @__PURE__ */ jsx31(Text31, { color: s.source === "default" ? "yellow" : "green", children: s.source }) }),
5207
+ /* @__PURE__ */ jsx31(Box31, { width: 10, children: /* @__PURE__ */ jsx31(Text31, { color: s.enabled ? "green" : "red", children: s.enabled ? "ON" : "OFF" }) }),
5208
+ /* @__PURE__ */ jsx31(Box31, { flexGrow: 1, children: /* @__PURE__ */ jsx31(Text31, { color: "gray", wrap: "truncate-end", children: s.description.slice(0, 50) }) })
5209
+ ] }, s.name);
5210
+ }),
5211
+ skills.length > VISIBLE && /* @__PURE__ */ jsx31(Box31, { marginTop: 1, children: /* @__PURE__ */ jsxs30(Text31, { color: "gray", children: [
5212
+ "[",
5213
+ startIdx + 1,
5214
+ "-",
5215
+ endIdx,
5216
+ " of ",
5217
+ skills.length,
5218
+ "]"
5219
+ ] }) }),
5220
+ /* @__PURE__ */ jsx31(Box31, { marginTop: 1, borderStyle: "single", borderTop: true, borderLeft: false, borderRight: false, borderBottom: false, borderColor: "gray", children: /* @__PURE__ */ jsxs30(Text31, { children: [
5221
+ /* @__PURE__ */ jsx31(Text31, { bold: true, color: "white", children: "Enter" }),
5222
+ " ",
5223
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "Toggle" }),
5224
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: " \xB7 " }),
5225
+ /* @__PURE__ */ jsx31(Text31, { bold: true, color: "white", children: "V" }),
5226
+ " ",
5227
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "Detail" }),
5228
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: " \xB7 " }),
5229
+ /* @__PURE__ */ jsx31(Text31, { bold: true, color: "white", children: "C" }),
5230
+ " ",
5231
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "Customize" }),
5232
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: " \xB7 " }),
5233
+ /* @__PURE__ */ jsx31(Text31, { bold: true, color: "red", children: "R" }),
5234
+ " ",
5235
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "Remove" }),
5236
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: " \xB7 " }),
5237
+ /* @__PURE__ */ jsx31(Text31, { bold: true, color: "white", children: "L" }),
5238
+ " ",
5239
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "Reload" }),
5240
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: " \xB7 " }),
5241
+ /* @__PURE__ */ jsx31(Text31, { bold: true, children: "Esc" }),
5242
+ " ",
5243
+ /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "Back" })
5244
+ ] }) })
5245
+ ] });
5246
+ };
5247
+
5248
+ // src/components/SettingsMenu.tsx
5249
+ import { useState as useState28, useCallback as useCallback6, useEffect as useEffect22 } from "react";
5250
+ import { Box as Box32, Text as Text32, useInput as useInput25 } from "ink";
5251
+ import { jsx as jsx32, jsxs as jsxs31 } from "react/jsx-runtime";
5071
5252
  var SettingsMenu = ({
5072
5253
  onClose,
5073
5254
  initialTab
5074
5255
  }) => {
5075
- const [view, setView] = useState27(initialTab || "categories");
5076
- const [selectedIndex, setSelectedIndex] = useState27(0);
5077
- const [currentSettings, setCurrentSettings] = useState27(null);
5078
- const [currentConfig, setCurrentConfig] = useState27(null);
5079
- const [saving, setSaving] = useState27(false);
5080
- const [confirmation, setConfirmation] = useState27(null);
5081
- useEffect21(() => {
5256
+ const [view, setView] = useState28(initialTab || "categories");
5257
+ const [selectedIndex, setSelectedIndex] = useState28(0);
5258
+ const [currentSettings, setCurrentSettings] = useState28(null);
5259
+ const [currentConfig, setCurrentConfig] = useState28(null);
5260
+ const [saving, setSaving] = useState28(false);
5261
+ const [confirmation, setConfirmation] = useState28(null);
5262
+ useEffect22(() => {
5082
5263
  settings.load().then(setCurrentSettings);
5083
5264
  config.load().then(setCurrentConfig);
5084
5265
  }, []);
5085
- useEffect21(() => {
5266
+ useEffect22(() => {
5086
5267
  setSelectedIndex(0);
5087
5268
  }, [view]);
5088
5269
  const saveAndUpdate = useCallback6(async (updates) => {
@@ -5654,7 +5835,7 @@ var SettingsMenu = ({
5654
5835
  saveConfigUpdate,
5655
5836
  onClose
5656
5837
  ]);
5657
- useInput24((input, key) => {
5838
+ useInput25((input, key) => {
5658
5839
  if (!currentSettings) return;
5659
5840
  if (confirmation) {
5660
5841
  if (input === "y" || input === "Y" || key.return)
@@ -5678,11 +5859,11 @@ var SettingsMenu = ({
5678
5859
  if (num >= 1 && num <= items.length) setSelectedIndex(num - 1);
5679
5860
  });
5680
5861
  if (!currentSettings || !currentConfig) {
5681
- return /* @__PURE__ */ jsx31(Box31, { padding: 1, children: /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "Loading settings..." }) });
5862
+ return /* @__PURE__ */ jsx32(Box32, { padding: 1, children: /* @__PURE__ */ jsx32(Text32, { color: "gray", children: "Loading settings..." }) });
5682
5863
  }
5683
5864
  if (confirmation) {
5684
- return /* @__PURE__ */ jsxs30(
5685
- Box31,
5865
+ return /* @__PURE__ */ jsxs31(
5866
+ Box32,
5686
5867
  {
5687
5868
  flexDirection: "column",
5688
5869
  paddingX: 1,
@@ -5690,14 +5871,14 @@ var SettingsMenu = ({
5690
5871
  height: "100%",
5691
5872
  justifyContent: "center",
5692
5873
  children: [
5693
- /* @__PURE__ */ jsx31(Box31, { marginBottom: 1, children: /* @__PURE__ */ jsx31(Text31, { color: "red", bold: true, children: "[ ! ] Confirmation Required" }) }),
5694
- /* @__PURE__ */ jsx31(Box31, { marginBottom: 1, children: /* @__PURE__ */ jsx31(Text31, { color: "white", children: confirmation.message }) }),
5695
- /* @__PURE__ */ jsxs30(Box31, { children: [
5696
- /* @__PURE__ */ jsx31(Text31, { color: "gray", children: " " }),
5697
- /* @__PURE__ */ jsx31(Text31, { color: "red", bold: true, children: "(y)" }),
5698
- /* @__PURE__ */ jsx31(Text31, { color: "gray", children: " Confirm " }),
5699
- /* @__PURE__ */ jsx31(Text31, { color: "red", bold: true, children: "(n)" }),
5700
- /* @__PURE__ */ jsx31(Text31, { color: "gray", children: " Cancel" })
5874
+ /* @__PURE__ */ jsx32(Box32, { marginBottom: 1, children: /* @__PURE__ */ jsx32(Text32, { color: "red", bold: true, children: "[ ! ] Confirmation Required" }) }),
5875
+ /* @__PURE__ */ jsx32(Box32, { marginBottom: 1, children: /* @__PURE__ */ jsx32(Text32, { color: "white", children: confirmation.message }) }),
5876
+ /* @__PURE__ */ jsxs31(Box32, { children: [
5877
+ /* @__PURE__ */ jsx32(Text32, { color: "gray", children: " " }),
5878
+ /* @__PURE__ */ jsx32(Text32, { color: "red", bold: true, children: "(y)" }),
5879
+ /* @__PURE__ */ jsx32(Text32, { color: "gray", children: " Confirm " }),
5880
+ /* @__PURE__ */ jsx32(Text32, { color: "red", bold: true, children: "(n)" }),
5881
+ /* @__PURE__ */ jsx32(Text32, { color: "gray", children: " Cancel" })
5701
5882
  ] })
5702
5883
  ]
5703
5884
  }
@@ -5729,8 +5910,8 @@ var SettingsMenu = ({
5729
5910
  return "Settings";
5730
5911
  }
5731
5912
  };
5732
- return /* @__PURE__ */ jsxs30(
5733
- Box31,
5913
+ return /* @__PURE__ */ jsxs31(
5914
+ Box32,
5734
5915
  {
5735
5916
  flexDirection: "column",
5736
5917
  paddingX: 1,
@@ -5738,17 +5919,17 @@ var SettingsMenu = ({
5738
5919
  width: "100%",
5739
5920
  height: "100%",
5740
5921
  children: [
5741
- /* @__PURE__ */ jsxs30(Box31, { marginBottom: 1, flexDirection: "row", justifyContent: "flex-start", children: [
5742
- /* @__PURE__ */ jsxs30(Text31, { bold: true, color: "white", children: [
5922
+ /* @__PURE__ */ jsxs31(Box32, { marginBottom: 1, flexDirection: "row", justifyContent: "flex-start", children: [
5923
+ /* @__PURE__ */ jsxs31(Text32, { bold: true, color: "white", children: [
5743
5924
  "[ ",
5744
5925
  getViewTitle(),
5745
5926
  " ]"
5746
5927
  ] }),
5747
- /* @__PURE__ */ jsxs30(Box31, { marginLeft: 2, children: [
5748
- saving && /* @__PURE__ */ jsx31(Text31, { color: "yellow", children: "Saving... " }),
5749
- /* @__PURE__ */ jsx31(Text31, { color: "gray", children: "Mode: " }),
5750
- /* @__PURE__ */ jsx31(
5751
- Text31,
5928
+ /* @__PURE__ */ jsxs31(Box32, { marginLeft: 2, children: [
5929
+ saving && /* @__PURE__ */ jsx32(Text32, { color: "yellow", children: "Saving... " }),
5930
+ /* @__PURE__ */ jsx32(Text32, { color: "gray", children: "Mode: " }),
5931
+ /* @__PURE__ */ jsx32(
5932
+ Text32,
5752
5933
  {
5753
5934
  color: currentSettings.mode === "auto" ? "green" : currentSettings.mode === "plan" ? "yellow" : "white",
5754
5935
  bold: true,
@@ -5757,60 +5938,60 @@ var SettingsMenu = ({
5757
5938
  )
5758
5939
  ] })
5759
5940
  ] }),
5760
- /* @__PURE__ */ jsx31(Box31, { flexDirection: "column", marginBottom: 1, children: items.map((item, index) => {
5941
+ /* @__PURE__ */ jsx32(Box32, { flexDirection: "column", marginBottom: 1, children: items.map((item, index) => {
5761
5942
  const isSelected = index === selectedIndex;
5762
5943
  const indicator = isSelected ? ">" : " ";
5763
5944
  let valueDisplay = null;
5764
5945
  if (item.type === "toggle") {
5765
- valueDisplay = /* @__PURE__ */ jsx31(Text31, { color: item.value ? "green" : "red", children: item.value ? "ON" : "OFF" });
5946
+ valueDisplay = /* @__PURE__ */ jsx32(Text32, { color: item.value ? "green" : "red", children: item.value ? "ON" : "OFF" });
5766
5947
  } else if (item.type === "select" && view === "mode") {
5767
- valueDisplay = /* @__PURE__ */ jsx31(Text31, { color: item.value ? "green" : "gray", children: item.value ? "[*]" : "[ ]" });
5948
+ valueDisplay = /* @__PURE__ */ jsx32(Text32, { color: item.value ? "green" : "gray", children: item.value ? "[*]" : "[ ]" });
5768
5949
  } else if (item.type === "select" && view === "models") {
5769
- valueDisplay = /* @__PURE__ */ jsx31(Text31, { color: item.value ? "green" : "gray", children: item.value ? " (Active)" : "" });
5950
+ valueDisplay = /* @__PURE__ */ jsx32(Text32, { color: item.value ? "green" : "gray", children: item.value ? " (Active)" : "" });
5770
5951
  }
5771
- return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", marginBottom: 0, children: [
5772
- /* @__PURE__ */ jsxs30(Box31, { children: [
5773
- /* @__PURE__ */ jsxs30(Text31, { color: isSelected ? "red" : "gray", children: [
5952
+ return /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", marginBottom: 0, children: [
5953
+ /* @__PURE__ */ jsxs31(Box32, { children: [
5954
+ /* @__PURE__ */ jsxs31(Text32, { color: isSelected ? "red" : "gray", children: [
5774
5955
  indicator,
5775
5956
  " "
5776
5957
  ] }),
5777
- /* @__PURE__ */ jsx31(Text31, { color: isSelected ? "white" : "gray", bold: isSelected, children: item.label }),
5778
- valueDisplay && /* @__PURE__ */ jsx31(Text31, { children: " " }),
5958
+ /* @__PURE__ */ jsx32(Text32, { color: isSelected ? "white" : "gray", bold: isSelected, children: item.label }),
5959
+ valueDisplay && /* @__PURE__ */ jsx32(Text32, { children: " " }),
5779
5960
  valueDisplay
5780
5961
  ] }),
5781
- item.description && isSelected && /* @__PURE__ */ jsx31(Box31, { marginLeft: 2, children: /* @__PURE__ */ jsxs30(Text31, { color: "gray", dimColor: true, children: [
5962
+ item.description && isSelected && /* @__PURE__ */ jsx32(Box32, { marginLeft: 2, children: /* @__PURE__ */ jsxs31(Text32, { color: "gray", dimColor: true, children: [
5782
5963
  " ",
5783
5964
  item.description
5784
5965
  ] }) })
5785
5966
  ] }, item.key);
5786
5967
  }) }),
5787
- view === "permissions" && /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", marginBottom: 1, paddingX: 0, children: [
5788
- /* @__PURE__ */ jsx31(Text31, { color: "gray", bold: true, children: "Allowed patterns:" }),
5789
- currentSettings.permissions.allow.length === 0 ? /* @__PURE__ */ jsxs30(Text31, { color: "gray", dimColor: true, children: [
5968
+ view === "permissions" && /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", marginBottom: 1, paddingX: 0, children: [
5969
+ /* @__PURE__ */ jsx32(Text32, { color: "gray", bold: true, children: "Allowed patterns:" }),
5970
+ currentSettings.permissions.allow.length === 0 ? /* @__PURE__ */ jsxs31(Text32, { color: "gray", dimColor: true, children: [
5790
5971
  " ",
5791
5972
  "(none)"
5792
- ] }) : currentSettings.permissions.allow.slice(0, 5).map((p, i) => /* @__PURE__ */ jsxs30(Text31, { color: "green", children: [
5973
+ ] }) : currentSettings.permissions.allow.slice(0, 5).map((p, i) => /* @__PURE__ */ jsxs31(Text32, { color: "green", children: [
5793
5974
  " ",
5794
5975
  "+ ",
5795
5976
  p
5796
5977
  ] }, i)),
5797
- currentSettings.permissions.allow.length > 5 && /* @__PURE__ */ jsxs30(Text31, { color: "gray", dimColor: true, children: [
5978
+ currentSettings.permissions.allow.length > 5 && /* @__PURE__ */ jsxs31(Text32, { color: "gray", dimColor: true, children: [
5798
5979
  " ",
5799
5980
  "... and ",
5800
5981
  currentSettings.permissions.allow.length - 5,
5801
5982
  " more"
5802
5983
  ] }),
5803
- /* @__PURE__ */ jsxs30(Box31, { marginTop: 1, children: [
5804
- /* @__PURE__ */ jsx31(Text31, { color: "gray", bold: true, children: "Denied patterns:" }),
5805
- currentSettings.permissions.deny.length === 0 ? /* @__PURE__ */ jsxs30(Text31, { color: "gray", dimColor: true, children: [
5984
+ /* @__PURE__ */ jsxs31(Box32, { marginTop: 1, children: [
5985
+ /* @__PURE__ */ jsx32(Text32, { color: "gray", bold: true, children: "Denied patterns:" }),
5986
+ currentSettings.permissions.deny.length === 0 ? /* @__PURE__ */ jsxs31(Text32, { color: "gray", dimColor: true, children: [
5806
5987
  " ",
5807
5988
  "(none)"
5808
- ] }) : currentSettings.permissions.deny.slice(0, 5).map((p, i) => /* @__PURE__ */ jsxs30(Text31, { color: "red", children: [
5989
+ ] }) : currentSettings.permissions.deny.slice(0, 5).map((p, i) => /* @__PURE__ */ jsxs31(Text32, { color: "red", children: [
5809
5990
  " ",
5810
5991
  "- ",
5811
5992
  p
5812
5993
  ] }, i)),
5813
- currentSettings.permissions.deny.length > 5 && /* @__PURE__ */ jsxs30(Text31, { color: "gray", dimColor: true, children: [
5994
+ currentSettings.permissions.deny.length > 5 && /* @__PURE__ */ jsxs31(Text32, { color: "gray", dimColor: true, children: [
5814
5995
  " ",
5815
5996
  "... and ",
5816
5997
  currentSettings.permissions.deny.length - 5,
@@ -5818,7 +5999,7 @@ var SettingsMenu = ({
5818
5999
  ] })
5819
6000
  ] })
5820
6001
  ] }),
5821
- /* @__PURE__ */ jsx31(Box31, { marginTop: 1, children: /* @__PURE__ */ jsx31(Text31, { color: "gray", dimColor: true, children: "Arrows: navigate Enter: select Esc: back Shift+Tab: cycle mode" }) })
6002
+ /* @__PURE__ */ jsx32(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx32(Text32, { color: "gray", dimColor: true, children: "Arrows: navigate Enter: select Esc: back Shift+Tab: cycle mode" }) })
5822
6003
  ]
5823
6004
  }
5824
6005
  );
@@ -5839,26 +6020,32 @@ function getGitBranch() {
5839
6020
  }
5840
6021
 
5841
6022
  // src/ui/Root.tsx
5842
- import { jsx as jsx32, jsxs as jsxs31 } from "react/jsx-runtime";
5843
- var MAX_EVENTS = 50;
6023
+ import { jsx as jsx33, jsxs as jsxs32 } from "react/jsx-runtime";
5844
6024
  var Root = () => {
5845
- const [events, setEvents] = useState28([]);
5846
- const [input, setInput] = useState28("");
5847
- const [pendingPrompt, setPendingPrompt] = useState28(null);
5848
- const [taskProgress, setTaskProgress] = useState28(tasks.getProgress());
6025
+ const [events, setEvents] = useState29([]);
6026
+ const [input, setInput] = useState29("");
6027
+ const [pendingPrompt, setPendingPrompt] = useState29(null);
6028
+ const [taskProgress, setTaskProgress] = useState29(tasks.getProgress());
5849
6029
  const { exit } = useApp();
5850
6030
  const { stdout } = useStdout();
5851
- const [columns, setColumns] = useState28(stdout?.columns || 80);
5852
- const [scrollOffset, setScrollOffset] = useState28(0);
5853
- useEffect22(() => {
6031
+ const [columns, setColumns] = useState29(stdout?.columns || 80);
6032
+ const [rows, setRows] = useState29(stdout?.rows || 24);
6033
+ const [scrollOffset, setScrollOffset] = useState29(0);
6034
+ const BANNER_HEIGHT = 6;
6035
+ const INPUT_AREA_HEIGHT = 6;
6036
+ const dynamicMaxEvents = Math.max(5, rows - (BANNER_HEIGHT + INPUT_AREA_HEIGHT));
6037
+ useEffect23(() => {
5854
6038
  if (!stdout) return;
5855
- const onResize = () => setColumns(stdout.columns);
6039
+ const onResize = () => {
6040
+ setColumns(stdout.columns);
6041
+ setRows(stdout.rows);
6042
+ };
5856
6043
  stdout.on("resize", onResize);
5857
6044
  return () => {
5858
6045
  stdout.off("resize", onResize);
5859
6046
  };
5860
6047
  }, [stdout]);
5861
- const [stats, setStats] = useState28({
6048
+ const [stats, setStats] = useState29({
5862
6049
  cost: 0,
5863
6050
  model: "Loading...",
5864
6051
  mode: "safe",
@@ -5866,19 +6053,20 @@ var Root = () => {
5866
6053
  sandbox: "local",
5867
6054
  branch: ""
5868
6055
  });
5869
- const [activeView, setActiveView] = useState28("chat");
5870
- const [settingsTab, setSettingsTab] = useState28();
5871
- const [isBusy, setIsBusy] = useState28(false);
5872
- const [isInitCommand, setIsInitCommand] = useState28(false);
5873
- const [isBackgroundBusy, setIsBackgroundBusy] = useState28(false);
5874
- const [currentActivity, setCurrentActivity] = useState28(null);
5875
- const [showPalette, setShowPalette] = useState28(false);
5876
- const [busyStartTime, setBusyStartTime] = useState28(Date.now());
5877
- const [contextPct, setContextPct] = useState28(100);
5878
- const [lastExitAttempt, setLastExitAttempt] = useState28(0);
5879
- const lastThoughtUpdate = useRef(0);
5880
- const THOUGHT_THROTTLE_MS = 100;
5881
- useEffect22(() => {
6056
+ const [activeView, setActiveView] = useState29("chat");
6057
+ const [settingsTab, setSettingsTab] = useState29();
6058
+ const [isBusy, setIsBusy] = useState29(false);
6059
+ const [isInitCommand, setIsInitCommand] = useState29(false);
6060
+ const [isBackgroundBusy, setIsBackgroundBusy] = useState29(false);
6061
+ const [currentActivity, setCurrentActivity] = useState29(null);
6062
+ const [showPalette, setShowPalette] = useState29(false);
6063
+ const [busyStartTime, setBusyStartTime] = useState29(Date.now());
6064
+ const [contextPct, setContextPct] = useState29(100);
6065
+ const [lastExitAttempt, setLastExitAttempt] = useState29(0);
6066
+ const pendingEventsRef = useRef([]);
6067
+ const flushTimerRef = useRef(null);
6068
+ const RENDER_BATCH_MS = 150;
6069
+ useEffect23(() => {
5882
6070
  const updateStats = async () => {
5883
6071
  const cfg = await config.load();
5884
6072
  const conf = cfg;
@@ -5915,19 +6103,66 @@ var Root = () => {
5915
6103
  bus.off("agent", statHandler);
5916
6104
  };
5917
6105
  }, []);
5918
- useEffect22(() => {
6106
+ useEffect23(() => {
5919
6107
  history.load().then((loadedEvents) => {
5920
6108
  if (loadedEvents.length > 0) {
5921
6109
  setEvents(loadedEvents);
5922
6110
  }
5923
6111
  });
5924
6112
  }, []);
5925
- useEffect22(() => {
6113
+ useEffect23(() => {
5926
6114
  if (events.length > 0) {
5927
6115
  history.save(events);
5928
6116
  }
5929
6117
  }, [events]);
5930
- useEffect22(() => {
6118
+ const flushEvents = useCallback7(() => {
6119
+ flushTimerRef.current = null;
6120
+ const batch = pendingEventsRef.current;
6121
+ if (batch.length === 0) return;
6122
+ pendingEventsRef.current = [];
6123
+ setEvents((prev) => {
6124
+ let result = prev;
6125
+ for (const event of batch) {
6126
+ if (event.type === "thought" && event.streaming) {
6127
+ let replaced = false;
6128
+ for (let i = result.length - 1; i >= 0; i--) {
6129
+ const e = result[i];
6130
+ if (e.type === "user_input" || e.type === "clear_history") break;
6131
+ if (e.type === "thought" && e.streaming) {
6132
+ if (event.content.startsWith(e.content)) {
6133
+ result = [...result];
6134
+ result[i] = event;
6135
+ replaced = true;
6136
+ }
6137
+ break;
6138
+ }
6139
+ }
6140
+ if (replaced) continue;
6141
+ }
6142
+ const last = result[result.length - 1];
6143
+ if (event.type === "thought" && last && last.type === "thought") {
6144
+ if (last.content === event.content) continue;
6145
+ result = [...result];
6146
+ result[result.length - 1] = event;
6147
+ } else {
6148
+ result = [...result, event];
6149
+ }
6150
+ }
6151
+ return result;
6152
+ });
6153
+ setScrollOffset(0);
6154
+ }, []);
6155
+ const scheduleFlush = useCallback7((immediate) => {
6156
+ if (immediate) {
6157
+ if (flushTimerRef.current) {
6158
+ clearTimeout(flushTimerRef.current);
6159
+ }
6160
+ flushEvents();
6161
+ } else if (!flushTimerRef.current) {
6162
+ flushTimerRef.current = setTimeout(flushEvents, RENDER_BATCH_MS);
6163
+ }
6164
+ }, [flushEvents]);
6165
+ useEffect23(() => {
5931
6166
  const handler = (event) => {
5932
6167
  if (event.type === "clear_history") {
5933
6168
  setEvents([]);
@@ -6021,23 +6256,12 @@ var Root = () => {
6021
6256
  } else if (event.type === "tool_result" || event.type === "done" || event.type === "error") {
6022
6257
  setCurrentActivity(null);
6023
6258
  }
6024
- if (event.type === "thought") {
6025
- const now = Date.now();
6026
- if (now - lastThoughtUpdate.current < THOUGHT_THROTTLE_MS) {
6027
- return;
6028
- }
6029
- lastThoughtUpdate.current = now;
6259
+ if (event.type === "thought" && event.hidden) {
6260
+ return;
6030
6261
  }
6031
- setEvents((prev) => {
6032
- const last = prev[prev.length - 1];
6033
- if (event.type === "thought" && last && last.type === "thought") {
6034
- if (last.content === event.content) return prev;
6035
- const newEvents = [...prev];
6036
- newEvents[newEvents.length - 1] = event;
6037
- return newEvents;
6038
- }
6039
- return [...prev, event];
6040
- });
6262
+ pendingEventsRef.current.push(event);
6263
+ const isImmediate = event.type === "done" || event.type === "error";
6264
+ scheduleFlush(isImmediate);
6041
6265
  };
6042
6266
  const userHandler = (event) => {
6043
6267
  if (event.type === "user_input") {
@@ -6045,10 +6269,8 @@ var Root = () => {
6045
6269
  setIsInitCommand(true);
6046
6270
  }
6047
6271
  if (!event.silent) {
6048
- setEvents((prev) => [
6049
- ...prev,
6050
- { type: "user_input", content: event.content }
6051
- ]);
6272
+ pendingEventsRef.current.push({ type: "user_input", content: event.content });
6273
+ scheduleFlush(true);
6052
6274
  }
6053
6275
  setIsBusy(true);
6054
6276
  setBusyStartTime(Date.now());
@@ -6059,14 +6281,17 @@ var Root = () => {
6059
6281
  return () => {
6060
6282
  bus.off("agent", handler);
6061
6283
  bus.off("user", userHandler);
6284
+ if (flushTimerRef.current) {
6285
+ clearTimeout(flushTimerRef.current);
6286
+ }
6062
6287
  };
6063
- }, []);
6064
- const [inputKey, setInputKey] = useState28(0);
6065
- const [selectedIndex, setSelectedIndex] = useState28(0);
6288
+ }, [scheduleFlush]);
6289
+ const [inputKey, setInputKey] = useState29(0);
6290
+ const [selectedIndex, setSelectedIndex] = useState29(0);
6066
6291
  const query = input.toLowerCase();
6067
6292
  const isCommand = input.startsWith("/");
6068
6293
  const matches = isCommand ? COMMANDS.filter((c) => c.name.startsWith(query)) : [];
6069
- useEffect22(() => {
6294
+ useEffect23(() => {
6070
6295
  setSelectedIndex(0);
6071
6296
  }, [input]);
6072
6297
  const cycleMode = useCallback7(async () => {
@@ -6100,7 +6325,7 @@ var Root = () => {
6100
6325
  const handlePromptResolve = useCallback7(() => {
6101
6326
  setPendingPrompt(null);
6102
6327
  }, []);
6103
- useInput25((inputChar, key) => {
6328
+ useInput26((inputChar, key) => {
6104
6329
  if (inputChar === "" || key.ctrl && inputChar === "c") {
6105
6330
  const now = Date.now();
6106
6331
  if (now - lastExitAttempt < 2e3) {
@@ -6129,14 +6354,6 @@ var Root = () => {
6129
6354
  cycleMode();
6130
6355
  return;
6131
6356
  }
6132
- if (key.pageUp) {
6133
- setScrollOffset((prev) => Math.min(Math.max(0, events.length - 10), prev + 5));
6134
- return;
6135
- }
6136
- if (key.pageDown) {
6137
- setScrollOffset((prev) => Math.max(0, prev - 5));
6138
- return;
6139
- }
6140
6357
  if (key.ctrl && inputChar === "t") {
6141
6358
  setActiveView("task");
6142
6359
  return;
@@ -6185,7 +6402,7 @@ var Root = () => {
6185
6402
  setInput((prev) => prev + inputChar);
6186
6403
  }
6187
6404
  });
6188
- const lastSubmitTime = React29.useRef(0);
6405
+ const lastSubmitTime = React30.useRef(0);
6189
6406
  const handleSubmit = (value) => {
6190
6407
  if (!value.trim()) return;
6191
6408
  const now = Date.now();
@@ -6197,7 +6414,7 @@ var Root = () => {
6197
6414
  bus.emitUser({ type: "user_input", content: trimmed, silent });
6198
6415
  setInput("");
6199
6416
  };
6200
- useEffect22(() => {
6417
+ useEffect23(() => {
6201
6418
  const uiHandler = (event) => {
6202
6419
  if (event.type === "approval_response") {
6203
6420
  if (event.requestId === "ui:clear") {
@@ -6223,7 +6440,7 @@ var Root = () => {
6223
6440
  const renderInput = () => {
6224
6441
  const placeholder = isBusy ? "Thinking..." : pendingPrompt ? "Respond to prompt above..." : "Message or / for commands...";
6225
6442
  if (input.length === 0) {
6226
- return /* @__PURE__ */ jsx32(Text32, { color: "gray", children: placeholder });
6443
+ return /* @__PURE__ */ jsx33(Text33, { color: "gray", children: placeholder });
6227
6444
  }
6228
6445
  const commandMatch = input.match(/^\/([a-zA-Z0-9_-]+)/);
6229
6446
  if (commandMatch) {
@@ -6231,37 +6448,38 @@ var Root = () => {
6231
6448
  const rest = input.slice(command.length);
6232
6449
  const isExactMatch = COMMANDS.some((c) => c.name === command);
6233
6450
  const isValidCommand = COMMANDS.some((c) => c.name === command || c.name.startsWith(command));
6234
- return /* @__PURE__ */ jsxs31(Text32, { children: [
6235
- /* @__PURE__ */ jsx32(Text32, { color: isExactMatch ? "red" : isValidCommand ? "yellow" : void 0, children: command }),
6451
+ return /* @__PURE__ */ jsxs32(Text33, { children: [
6452
+ /* @__PURE__ */ jsx33(Text33, { color: isExactMatch ? "red" : isValidCommand ? "yellow" : void 0, children: command }),
6236
6453
  rest,
6237
- /* @__PURE__ */ jsx32(Text32, { children: "_" })
6454
+ /* @__PURE__ */ jsx33(Text33, { children: "_" })
6238
6455
  ] });
6239
6456
  }
6240
- return /* @__PURE__ */ jsxs31(Text32, { children: [
6457
+ return /* @__PURE__ */ jsxs32(Text33, { children: [
6241
6458
  input,
6242
- /* @__PURE__ */ jsx32(Text32, { children: "_" })
6459
+ /* @__PURE__ */ jsx33(Text33, { children: "_" })
6243
6460
  ] });
6244
6461
  };
6245
- const tokens = usage.getSessionTokens();
6462
+ const tokens = React30.useMemo(() => usage.getSessionTokens(), [isBusy]);
6463
+ const separatorLine = React30.useMemo(() => "\u2500".repeat(columns), [columns]);
6246
6464
  const renderView = () => {
6247
6465
  const closeView = () => setActiveView("chat");
6248
6466
  switch (activeView) {
6249
6467
  case "settings":
6250
- return /* @__PURE__ */ jsx32(SettingsMenu, { initialTab: settingsTab, onClose: closeView });
6468
+ return /* @__PURE__ */ jsx33(SettingsMenu, { initialTab: settingsTab, onClose: closeView });
6251
6469
  case "doctor":
6252
- return /* @__PURE__ */ jsx32(DoctorView, { onClose: closeView });
6470
+ return /* @__PURE__ */ jsx33(DoctorView, { onClose: closeView });
6253
6471
  case "help":
6254
- return /* @__PURE__ */ jsx32(HelpView, { onClose: closeView });
6472
+ return /* @__PURE__ */ jsx33(HelpView, { onClose: closeView });
6255
6473
  case "init":
6256
- return /* @__PURE__ */ jsx32(InitView, { onClose: closeView });
6474
+ return /* @__PURE__ */ jsx33(InitView, { onClose: closeView });
6257
6475
  case "usage":
6258
- return /* @__PURE__ */ jsx32(UsageView, { onClose: closeView });
6476
+ return /* @__PURE__ */ jsx33(UsageView, { onClose: closeView });
6259
6477
  case "task":
6260
- return /* @__PURE__ */ jsx32(TaskView, { onClose: closeView });
6478
+ return /* @__PURE__ */ jsx33(TaskView, { onClose: closeView });
6261
6479
  case "context":
6262
- return /* @__PURE__ */ jsx32(ContextView, { onClose: closeView });
6480
+ return /* @__PURE__ */ jsx33(ContextView, { onClose: closeView });
6263
6481
  case "sessions":
6264
- return /* @__PURE__ */ jsx32(
6482
+ return /* @__PURE__ */ jsx33(
6265
6483
  SessionView,
6266
6484
  {
6267
6485
  onClose: closeView,
@@ -6272,60 +6490,68 @@ var Root = () => {
6272
6490
  }
6273
6491
  );
6274
6492
  case "mcp":
6275
- return /* @__PURE__ */ jsx32(MCPView, { onExit: closeView });
6493
+ return /* @__PURE__ */ jsx33(MCPView, { onExit: closeView });
6276
6494
  case "status":
6277
- return /* @__PURE__ */ jsx32(StatusView, { onClose: closeView });
6495
+ return /* @__PURE__ */ jsx33(StatusView, { onClose: closeView });
6278
6496
  case "mode_select":
6279
- return /* @__PURE__ */ jsx32(ModeSelectView, { onClose: closeView });
6497
+ return /* @__PURE__ */ jsx33(ModeSelectView, { onClose: closeView });
6280
6498
  case "memory":
6281
- return /* @__PURE__ */ jsx32(MemoryView, { onClose: closeView });
6499
+ return /* @__PURE__ */ jsx33(MemoryView, { onClose: closeView });
6282
6500
  case "tool_list":
6283
- return /* @__PURE__ */ jsx32(ToolListView, { onClose: closeView });
6501
+ return /* @__PURE__ */ jsx33(ToolListView, { onClose: closeView });
6284
6502
  case "diff_list":
6285
- return /* @__PURE__ */ jsx32(DiffListView, { onClose: closeView });
6503
+ return /* @__PURE__ */ jsx33(DiffListView, { onClose: closeView });
6286
6504
  case "undo":
6287
- return /* @__PURE__ */ jsx32(UndoView, { onClose: closeView });
6505
+ return /* @__PURE__ */ jsx33(UndoView, { onClose: closeView });
6288
6506
  case "pilot":
6289
- return /* @__PURE__ */ jsx32(PilotView, { onClose: closeView });
6507
+ return /* @__PURE__ */ jsx33(PilotView, { onClose: closeView });
6290
6508
  case "models":
6291
- return /* @__PURE__ */ jsx32(ModelsView, { onClose: closeView });
6509
+ return /* @__PURE__ */ jsx33(ModelsView, { onClose: closeView });
6292
6510
  case "scheduler":
6293
- return /* @__PURE__ */ jsx32(SchedulerView, { onClose: closeView });
6511
+ return /* @__PURE__ */ jsx33(SchedulerView, { onClose: closeView });
6294
6512
  case "scheduled_tasks":
6295
- return /* @__PURE__ */ jsx32(ScheduledTasksView, { onClose: closeView });
6513
+ return /* @__PURE__ */ jsx33(ScheduledTasksView, { onClose: closeView });
6296
6514
  case "ollama":
6297
- return /* @__PURE__ */ jsx32(OllamaView, { onClose: closeView });
6515
+ return /* @__PURE__ */ jsx33(OllamaView, { onClose: closeView });
6298
6516
  case "sandbox":
6299
- return /* @__PURE__ */ jsx32(SandboxView, { onClose: closeView });
6517
+ return /* @__PURE__ */ jsx33(SandboxView, { onClose: closeView });
6518
+ case "skills":
6519
+ return /* @__PURE__ */ jsx33(SkillsView, { onExit: closeView });
6300
6520
  default:
6301
6521
  return null;
6302
6522
  }
6303
6523
  };
6304
- return /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", height: "100%", children: [
6305
- /* @__PURE__ */ jsx32(
6306
- Box32,
6524
+ const banner = React30.useMemo(() => /* @__PURE__ */ jsx33(
6525
+ WelcomeBanner,
6526
+ {
6527
+ model: stats.model,
6528
+ mode: stats.mode,
6529
+ version: stats.version,
6530
+ sandbox: stats.sandbox,
6531
+ branch: stats.branch
6532
+ }
6533
+ ), [stats.model, stats.mode, stats.version, stats.sandbox, stats.branch]);
6534
+ return /* @__PURE__ */ jsxs32(Box33, { flexDirection: "column", height: rows, children: [
6535
+ activeView === "chat" && /* @__PURE__ */ jsx33(Box33, { flexShrink: 0, children: banner }),
6536
+ /* @__PURE__ */ jsx33(
6537
+ Box33,
6307
6538
  {
6308
6539
  flexDirection: "column",
6309
- flexGrow: 1,
6540
+ flexGrow: activeView === "chat" ? 1 : 1,
6310
6541
  overflowY: "hidden",
6311
- justifyContent: activeView !== "chat" ? "flex-start" : "flex-end",
6312
- children: activeView === "chat" ? /* @__PURE__ */ jsx32(
6542
+ justifyContent: "flex-end",
6543
+ children: activeView === "chat" ? /* @__PURE__ */ jsx33(
6313
6544
  MessageList,
6314
6545
  {
6315
6546
  events,
6316
- maxEvents: MAX_EVENTS,
6317
- model: stats.model,
6318
- mode: stats.mode,
6319
- version: stats.version,
6320
- scrollOffset,
6321
- sandbox: stats.sandbox,
6322
- branch: stats.branch
6547
+ maxEvents: dynamicMaxEvents,
6548
+ scrollOffset: 0
6323
6549
  }
6324
6550
  ) : renderView()
6325
6551
  }
6326
6552
  ),
6327
- activeView === "chat" && /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", flexShrink: 0, children: [
6328
- isBusy && !isInitCommand && /* @__PURE__ */ jsx32(
6553
+ activeView === "chat" && /* @__PURE__ */ jsxs32(Box33, { flexDirection: "column", flexShrink: 0, children: [
6554
+ isBusy && !isInitCommand && /* @__PURE__ */ jsx33(
6329
6555
  ThinkingIndicator,
6330
6556
  {
6331
6557
  activity: currentActivity,
@@ -6333,8 +6559,8 @@ var Root = () => {
6333
6559
  tokensIn: tokens.input
6334
6560
  }
6335
6561
  ),
6336
- isBackgroundBusy && /* @__PURE__ */ jsx32(Box32, { marginLeft: 2, children: /* @__PURE__ */ jsx32(Text32, { dimColor: true, children: "Background task running..." }) }),
6337
- pendingPrompt?.type === "approval" && /* @__PURE__ */ jsx32(Box32, { marginBottom: 0, children: /* @__PURE__ */ jsx32(
6562
+ isBackgroundBusy && /* @__PURE__ */ jsx33(Box33, { marginLeft: 2, children: /* @__PURE__ */ jsx33(Text33, { dimColor: true, children: "Background task running..." }) }),
6563
+ pendingPrompt?.type === "approval" && /* @__PURE__ */ jsx33(Box33, { marginBottom: 0, children: /* @__PURE__ */ jsx33(
6338
6564
  ApprovalPrompt,
6339
6565
  {
6340
6566
  requestId: pendingPrompt.requestId,
@@ -6343,7 +6569,7 @@ var Root = () => {
6343
6569
  onResolve: handlePromptResolve
6344
6570
  }
6345
6571
  ) }),
6346
- pendingPrompt?.type === "choice" && /* @__PURE__ */ jsx32(Box32, { marginBottom: 0, children: /* @__PURE__ */ jsx32(
6572
+ pendingPrompt?.type === "choice" && /* @__PURE__ */ jsx33(Box33, { marginBottom: 0, children: /* @__PURE__ */ jsx33(
6347
6573
  ChoicePrompt,
6348
6574
  {
6349
6575
  question: pendingPrompt.question,
@@ -6351,7 +6577,7 @@ var Root = () => {
6351
6577
  onResolve: handlePromptResolve
6352
6578
  }
6353
6579
  ) }),
6354
- pendingPrompt?.type === "text_input" && /* @__PURE__ */ jsx32(Box32, { marginBottom: 0, children: /* @__PURE__ */ jsx32(
6580
+ pendingPrompt?.type === "text_input" && /* @__PURE__ */ jsx33(Box33, { marginBottom: 0, children: /* @__PURE__ */ jsx33(
6355
6581
  TextInputPrompt,
6356
6582
  {
6357
6583
  requestId: pendingPrompt.requestId,
@@ -6361,14 +6587,14 @@ var Root = () => {
6361
6587
  onResolve: handlePromptResolve
6362
6588
  }
6363
6589
  ) }),
6364
- /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", children: [
6365
- /* @__PURE__ */ jsx32(Box32, { paddingX: 0, children: /* @__PURE__ */ jsx32(Text32, { dimColor: true, children: "\u2500".repeat(columns) }) }),
6366
- /* @__PURE__ */ jsxs31(Box32, { paddingX: 1, children: [
6367
- /* @__PURE__ */ jsx32(Text32, { color: "red", bold: true, children: "> " }),
6590
+ /* @__PURE__ */ jsxs32(Box33, { flexDirection: "column", children: [
6591
+ /* @__PURE__ */ jsx33(Box33, { paddingX: 0, children: /* @__PURE__ */ jsx33(Text33, { dimColor: true, children: separatorLine }) }),
6592
+ /* @__PURE__ */ jsxs32(Box33, { paddingX: 1, children: [
6593
+ /* @__PURE__ */ jsx33(Text33, { color: "red", bold: true, children: "> " }),
6368
6594
  renderInput()
6369
6595
  ] })
6370
6596
  ] }),
6371
- showPalette && /* @__PURE__ */ jsx32(
6597
+ showPalette && /* @__PURE__ */ jsx33(
6372
6598
  CommandPalette,
6373
6599
  {
6374
6600
  onSelect: (cmd) => {
@@ -6379,24 +6605,24 @@ var Root = () => {
6379
6605
  onClose: () => setShowPalette(false)
6380
6606
  }
6381
6607
  ),
6382
- !showPalette && /* @__PURE__ */ jsx32(CommandPopup, { matches, selectedIndex }),
6383
- matches.length === 0 && !showPalette && /* @__PURE__ */ jsxs31(Box32, { flexDirection: "column", children: [
6384
- /* @__PURE__ */ jsx32(Box32, { paddingX: 0, children: /* @__PURE__ */ jsx32(Text32, { dimColor: true, children: "\u2500".repeat(columns) }) }),
6385
- /* @__PURE__ */ jsxs31(Box32, { paddingX: 1, flexDirection: "row", justifyContent: "space-between", children: [
6386
- /* @__PURE__ */ jsxs31(Box32, { children: [
6387
- /* @__PURE__ */ jsx32(Text32, { color: MODE_STYLE[stats.mode].color, children: MODE_STYLE[stats.mode].icon }),
6388
- /* @__PURE__ */ jsx32(Text32, { children: " " }),
6389
- /* @__PURE__ */ jsxs31(Text32, { bold: true, color: MODE_STYLE[stats.mode].color, children: [
6608
+ !showPalette && /* @__PURE__ */ jsx33(CommandPopup, { matches, selectedIndex }),
6609
+ matches.length === 0 && !showPalette && /* @__PURE__ */ jsxs32(Box33, { flexDirection: "column", children: [
6610
+ /* @__PURE__ */ jsx33(Box33, { paddingX: 0, children: /* @__PURE__ */ jsx33(Text33, { dimColor: true, children: separatorLine }) }),
6611
+ /* @__PURE__ */ jsxs32(Box33, { paddingX: 1, flexDirection: "row", justifyContent: "space-between", children: [
6612
+ /* @__PURE__ */ jsxs32(Box33, { children: [
6613
+ /* @__PURE__ */ jsx33(Text33, { color: MODE_STYLE[stats.mode].color, children: MODE_STYLE[stats.mode].icon }),
6614
+ /* @__PURE__ */ jsx33(Text33, { children: " " }),
6615
+ /* @__PURE__ */ jsxs32(Text33, { bold: true, color: MODE_STYLE[stats.mode].color, children: [
6390
6616
  stats.mode,
6391
6617
  " mode"
6392
6618
  ] }),
6393
- /* @__PURE__ */ jsx32(Text32, { dimColor: true, children: " (shift+tab to cycle)" }),
6394
- /* @__PURE__ */ jsx32(Text32, { color: "gray", children: " \xB7 " }),
6395
- /* @__PURE__ */ jsx32(Text32, { color: stats.sandbox === "sandbox" ? "green" : "yellow", children: stats.sandbox === "sandbox" ? "sandbox" : "no sandbox" })
6619
+ /* @__PURE__ */ jsx33(Text33, { dimColor: true, children: " (shift+tab to cycle)" }),
6620
+ /* @__PURE__ */ jsx33(Text33, { color: "gray", children: " \xB7 " }),
6621
+ /* @__PURE__ */ jsx33(Text33, { color: stats.sandbox === "sandbox" ? "green" : "yellow", children: stats.sandbox === "sandbox" ? "sandbox" : "no sandbox" })
6396
6622
  ] }),
6397
- /* @__PURE__ */ jsxs31(Box32, { children: [
6398
- /* @__PURE__ */ jsx32(Text32, { dimColor: true, children: "Context left until auto-compact: " }),
6399
- /* @__PURE__ */ jsxs31(Text32, { color: contextPct > 50 ? "green" : contextPct > 20 ? "yellow" : "red", children: [
6623
+ /* @__PURE__ */ jsxs32(Box33, { children: [
6624
+ /* @__PURE__ */ jsx33(Text33, { dimColor: true, children: "Context left until auto-compact: " }),
6625
+ /* @__PURE__ */ jsxs32(Text33, { color: contextPct > 50 ? "green" : contextPct > 20 ? "yellow" : "red", children: [
6400
6626
  contextPct,
6401
6627
  "%"
6402
6628
  ] })
@@ -6588,6 +6814,15 @@ var ollamaCommand = async (_args) => {
6588
6814
  });
6589
6815
  };
6590
6816
 
6817
+ // src/commands/skills.ts
6818
+ var skillsCommand = async (_args) => {
6819
+ bus.emitAgent({
6820
+ type: "view_request",
6821
+ viewId: "skills",
6822
+ command: "skills"
6823
+ });
6824
+ };
6825
+
6591
6826
  // src/core/commands.ts
6592
6827
  var CommandRegistry = class {
6593
6828
  commands = /* @__PURE__ */ new Map();
@@ -6695,6 +6930,11 @@ var CommandRegistry = class {
6695
6930
  isView: true,
6696
6931
  viewId: "ollama"
6697
6932
  });
6933
+ this.register("skills", "Manage default and custom skills", skillsCommand, {
6934
+ isView: true,
6935
+ viewId: "skills",
6936
+ aliases: ["skill"]
6937
+ });
6698
6938
  }
6699
6939
  register(name, description, handler, options = {}) {
6700
6940
  const def = { name, description, handler, ...options };
@@ -7101,7 +7341,7 @@ function renderUI() {
7101
7341
  process.stdout.write("\x1B[?1049h");
7102
7342
  process.stdout.write("\x1B[2J");
7103
7343
  process.stdout.write("\x1B[H");
7104
- const { waitUntilExit } = render(React30.createElement(Root), {
7344
+ const { waitUntilExit } = render(React31.createElement(Root), {
7105
7345
  patchConsole: false,
7106
7346
  exitOnCtrlC: false
7107
7347
  });