@wrongstack/tui 0.6.6 → 0.7.0

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/index.d.ts CHANGED
@@ -100,8 +100,9 @@ interface RunTuiOptions {
100
100
  * context chip uses this for its progress denominator.
101
101
  */
102
102
  effectiveMaxContext?: number;
103
- /**
104
- * Render into the terminal's alternate screen buffer (like vim/less/htop).
103
+ /** Absolute project root for goal.json loading. */
104
+ projectRoot?: string;
105
+ /** Render into the terminal's alternate screen buffer (like vim/less/htop).
105
106
  * Default: false — native scrollback stays live so chat history is
106
107
  * scrollable via mouse wheel / Shift+PgUp, which matches the user's
107
108
  * "this is a chat app, let me scroll the chat" intuition. Pass true
package/dist/index.js CHANGED
@@ -1654,7 +1654,8 @@ function StatusBar({
1654
1654
  projectName,
1655
1655
  processCount,
1656
1656
  hiddenItems,
1657
- eternalStage
1657
+ eternalStage,
1658
+ goalSummary
1658
1659
  }) {
1659
1660
  const hiddenSet = new Set(hiddenItems);
1660
1661
  const usage = tokenCounter?.total();
@@ -1662,7 +1663,7 @@ function StatusBar({
1662
1663
  const cache2 = tokenCounter?.cacheStats();
1663
1664
  const stateColor = state === "idle" ? "cyan" : state === "aborting" ? "yellow" : "green";
1664
1665
  const stateLabel = state === "idle" ? "idle" : state === "aborting" ? "aborting\u2026" : "thinking\u2026";
1665
- const hasSecondLine = yolo || autonomy && autonomy !== "off" || elapsedMs !== void 0 || git !== null && git !== void 0 || projectName !== void 0 && projectName.length > 0;
1666
+ const hasSecondLine = yolo || autonomy && autonomy !== "off" || elapsedMs !== void 0 || git !== null && git !== void 0 || projectName !== void 0 && projectName.length > 0 || goalSummary !== null && goalSummary !== void 0;
1666
1667
  const fleetHasActivity = fleet && (fleet.running > 0 || fleet.idle > 0 || fleet.pending > 0 || fleet.completed > 0) || subagentCount > 0;
1667
1668
  const hasThirdLine = todos && (todos.pending > 0 || todos.inProgress > 0 || todos.completed > 0) || plan && (plan.open > 0 || plan.inProgress > 0 || plan.done > 0) || fleetHasActivity;
1668
1669
  return /* @__PURE__ */ jsxs(
@@ -1768,6 +1769,18 @@ function StatusBar({
1768
1769
  projectName
1769
1770
  ] })
1770
1771
  ] }) : null,
1772
+ goalSummary ? /* @__PURE__ */ jsxs(Fragment, { children: [
1773
+ yolo || elapsedMs !== void 0 || projectName ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2502" }) : null,
1774
+ /* @__PURE__ */ jsxs(Text, { color: goalSummary.goalState === "active" ? "green" : goalSummary.goalState === "paused" ? "yellow" : goalSummary.goalState === "completed" ? "green" : "dim", children: [
1775
+ "\u{1F3AF} ",
1776
+ goalSummary.goal.length > 40 ? `${goalSummary.goal.slice(0, 37)}\u2026` : goalSummary.goal,
1777
+ " [",
1778
+ goalSummary.goalState,
1779
+ "] (iter ",
1780
+ goalSummary.iterations,
1781
+ ")"
1782
+ ] })
1783
+ ] }) : null,
1771
1784
  git ? /* @__PURE__ */ jsxs(Fragment, { children: [
1772
1785
  yolo || elapsedMs !== void 0 || projectName ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2502" }) : null,
1773
1786
  /* @__PURE__ */ jsxs(Text, { children: [
@@ -2756,6 +2769,9 @@ function reducer(state, action) {
2756
2769
  case "eternalStage": {
2757
2770
  return { ...state, eternalStage: action.stage };
2758
2771
  }
2772
+ case "goalSummary": {
2773
+ return { ...state, goalSummary: action.summary };
2774
+ }
2759
2775
  }
2760
2776
  }
2761
2777
  var PASTE_THRESHOLD_CHARS = 200;
@@ -2844,6 +2860,28 @@ function App({
2844
2860
  useEffect(() => {
2845
2861
  setStatuslineHiddenItems(hiddenItems);
2846
2862
  }, [setStatuslineHiddenItems]);
2863
+ const projectRoot = agent.ctx.projectRoot;
2864
+ useEffect(() => {
2865
+ if (!projectRoot) return;
2866
+ const goalPath = path2.join(projectRoot, ".wrongstack", "goal.json");
2867
+ fs2.readFile(goalPath, "utf8").then((raw) => {
2868
+ const goal = JSON.parse(raw);
2869
+ if (goal?.goal && typeof goal.iterations === "number") {
2870
+ const lastEntry = goal.journal?.[goal.journal.length - 1];
2871
+ dispatch({
2872
+ type: "goalSummary",
2873
+ summary: {
2874
+ goal: goal.goal,
2875
+ goalState: goal.goalState ?? "active",
2876
+ iterations: goal.iterations,
2877
+ lastTask: lastEntry?.task,
2878
+ lastStatus: lastEntry?.status
2879
+ }
2880
+ });
2881
+ }
2882
+ }).catch(() => {
2883
+ });
2884
+ }, [projectRoot]);
2847
2885
  const [state, dispatch] = useReducer(reducer, {
2848
2886
  entries: banner ? [
2849
2887
  {
@@ -2890,7 +2928,8 @@ function App({
2890
2928
  streamFleet: true,
2891
2929
  checkpoints: [],
2892
2930
  rewindOverlay: null,
2893
- eternalStage: null
2931
+ eternalStage: null,
2932
+ goalSummary: null
2894
2933
  });
2895
2934
  const builderRef = useRef(null);
2896
2935
  if (builderRef.current === null) {
@@ -2899,7 +2938,6 @@ function App({
2899
2938
  const activeCtrlRef = useRef(null);
2900
2939
  const inputGateRef = useRef(false);
2901
2940
  const lastEnterAtRef = useRef(0);
2902
- const projectRoot = agent.ctx.projectRoot;
2903
2941
  const projectName = React2.useMemo(() => {
2904
2942
  const base = path2.basename(projectRoot);
2905
2943
  return base && base !== path2.sep ? base : void 0;
@@ -4728,7 +4766,8 @@ User message:
4728
4766
  subagentCount: Object.keys(state.fleet).length,
4729
4767
  processCount: getProcessRegistry().activeCount,
4730
4768
  hiddenItems,
4731
- eternalStage: state.eternalStage
4769
+ eternalStage: state.eternalStage,
4770
+ goalSummary: state.goalSummary
4732
4771
  }
4733
4772
  ),
4734
4773
  director ? /* @__PURE__ */ jsx(FleetPanel, { entries: state.fleet, totalCost: state.fleetCost, roster: fleetRoster }) : null
@@ -4879,7 +4918,8 @@ async function runTui(opts) {
4879
4918
  initialAsk: opts.initialAsk,
4880
4919
  getSDDContext: opts.getSDDContext,
4881
4920
  onSDDOutput: opts.onSDDOutput,
4882
- sessionsDir: opts.sessionsDir
4921
+ sessionsDir: opts.sessionsDir,
4922
+ projectRoot: opts.projectRoot
4883
4923
  }),
4884
4924
  { exitOnCtrlC: false }
4885
4925
  );