@wrongstack/tui 0.89.3 → 0.104.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.js CHANGED
@@ -4324,6 +4324,106 @@ function ProcessListMonitor() {
4324
4324
  ] })
4325
4325
  ] });
4326
4326
  }
4327
+ function GoalPanel({ goal }) {
4328
+ if (!goal) {
4329
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", padding: 1, children: [
4330
+ /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsx(Text, { bold: true, color: theme.accent, children: "\u{1F3AF} Goal" }) }),
4331
+ /* @__PURE__ */ jsxs(Box, { children: [
4332
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "No goal set. Use " }),
4333
+ /* @__PURE__ */ jsxs(Text, { color: theme.accent, children: [
4334
+ "/goal set ",
4335
+ "<mission>"
4336
+ ] }),
4337
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " to create one." })
4338
+ ] }),
4339
+ /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Press F9 or Esc to close." }) })
4340
+ ] });
4341
+ }
4342
+ const displayGoal = goal.refinedGoal || goal.goal;
4343
+ const stateIcon = goal.goalState === "active" ? "\u{1F504}" : goal.goalState === "paused" ? "\u23F8" : goal.goalState === "completed" ? "\u2705" : "\u23F9";
4344
+ const stateColor = goal.goalState === "active" ? "green" : goal.goalState === "paused" ? "yellow" : goal.goalState === "completed" ? "green" : "red";
4345
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", padding: 1, children: [
4346
+ /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { bold: true, color: theme.accent, children: [
4347
+ "\u{1F3AF} Goal \u2014 ",
4348
+ goal.goalState
4349
+ ] }) }),
4350
+ /* @__PURE__ */ jsxs(Box, { marginBottom: 1, children: [
4351
+ /* @__PURE__ */ jsxs(Text, { children: [
4352
+ stateIcon,
4353
+ " "
4354
+ ] }),
4355
+ /* @__PURE__ */ jsx(Text, { bold: true, children: displayGoal })
4356
+ ] }),
4357
+ goal.refinedGoal && goal.refinedGoal !== goal.goal && /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
4358
+ " (original: ",
4359
+ goal.goal.length > 60 ? goal.goal.slice(0, 57) + "\u2026" : goal.goal,
4360
+ ")"
4361
+ ] }) }),
4362
+ typeof goal.progress === "number" && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
4363
+ /* @__PURE__ */ jsx(Box, { children: renderProgressBar(goal.progress, goal.progressTrend) }),
4364
+ goal.progressNote && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
4365
+ " ",
4366
+ goal.progressNote
4367
+ ] }) })
4368
+ ] }),
4369
+ goal.deliverables && goal.deliverables.length > 0 && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
4370
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { bold: true, children: [
4371
+ "Deliverables (",
4372
+ goal.deliverables.length,
4373
+ "):"
4374
+ ] }) }),
4375
+ goal.deliverables.map((d, i) => {
4376
+ const done = /^\[[x✓]\]|✅|\(done\)/i.test(d);
4377
+ return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { color: done ? "green" : void 0, dimColor: !done, children: [
4378
+ " ",
4379
+ done ? "\u2713" : "\u25CB",
4380
+ " ",
4381
+ d
4382
+ ] }) }, i);
4383
+ })
4384
+ ] }),
4385
+ /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
4386
+ /* @__PURE__ */ jsxs(Box, { children: [
4387
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Iterations: " }),
4388
+ /* @__PURE__ */ jsx(Text, { children: goal.iterations })
4389
+ ] }),
4390
+ /* @__PURE__ */ jsxs(Box, { children: [
4391
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "State: " }),
4392
+ /* @__PURE__ */ jsxs(Text, { color: stateColor, children: [
4393
+ stateIcon,
4394
+ " ",
4395
+ goal.goalState
4396
+ ] })
4397
+ ] }),
4398
+ goal.lastTask && /* @__PURE__ */ jsxs(Box, { children: [
4399
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Last task: " }),
4400
+ /* @__PURE__ */ jsx(Text, { children: goal.lastTask.length > 50 ? goal.lastTask.slice(0, 47) + "\u2026" : goal.lastTask })
4401
+ ] }),
4402
+ /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Press F9 or Esc to close." }) })
4403
+ ] })
4404
+ ] });
4405
+ }
4406
+ function renderProgressBar(progress, trend) {
4407
+ const pct = Math.min(100, Math.max(0, Math.round(progress)));
4408
+ const filled = Math.round(pct / 5);
4409
+ const empty = 20 - filled;
4410
+ const trendIcon = trend === "accelerating" ? " \u{1F680}" : trend === "stalling" ? " \u26A0\uFE0F" : trend === "steady" ? " \u27A1\uFE0F" : "";
4411
+ return /* @__PURE__ */ jsxs(Box, { children: [
4412
+ /* @__PURE__ */ jsx(Text, { bold: true, children: "Progress: " }),
4413
+ /* @__PURE__ */ jsx(Text, { color: "green", children: "\u2588".repeat(filled) }),
4414
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2591".repeat(empty) }),
4415
+ /* @__PURE__ */ jsxs(Text, { bold: true, children: [
4416
+ " ",
4417
+ pct,
4418
+ "%"
4419
+ ] }),
4420
+ trend && /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
4421
+ trendIcon,
4422
+ " ",
4423
+ trend
4424
+ ] })
4425
+ ] });
4426
+ }
4327
4427
  var DELAY_PRESETS_MS = [0, 15e3, 3e4, 45e3, 6e4, 12e4];
4328
4428
  var SETTINGS_MODES = ["off", "suggest", "auto"];
4329
4429
  var LOG_LEVELS = ["error", "warn", "info", "debug", "trace"];
@@ -6834,6 +6934,9 @@ function reducer(state, action) {
6834
6934
  case "toggleProcessList": {
6835
6935
  return { ...state, processListOpen: !state.processListOpen };
6836
6936
  }
6937
+ case "toggleGoalPanel": {
6938
+ return { ...state, goalPanelOpen: !state.goalPanelOpen };
6939
+ }
6837
6940
  case "checkpointReceived": {
6838
6941
  const existing = state.checkpoints.find((c) => c.promptIndex === action.cp.promptIndex);
6839
6942
  if (existing) return state;
@@ -7237,8 +7340,13 @@ function App({
7237
7340
  type: "goalSummary",
7238
7341
  summary: {
7239
7342
  goal: goal.goal,
7343
+ refinedGoal: goal.refinedGoal,
7240
7344
  goalState: goal.goalState ?? "active",
7241
7345
  iterations: goal.iterations,
7346
+ progress: goal.progress,
7347
+ progressNote: goal.progressNote,
7348
+ progressTrend: goal.progressTrend,
7349
+ deliverables: goal.deliverables,
7242
7350
  lastTask: lastEntry?.task,
7243
7351
  lastStatus: lastEntry?.status
7244
7352
  }
@@ -7331,6 +7439,7 @@ function App({
7331
7439
  todosMonitorOpen: false,
7332
7440
  queuePanelOpen: false,
7333
7441
  processListOpen: false,
7442
+ goalPanelOpen: false,
7334
7443
  collabSession: null,
7335
7444
  checkpoints: [],
7336
7445
  rewindOverlay: null,
@@ -8807,6 +8916,23 @@ function App({
8807
8916
  }
8808
8917
  return;
8809
8918
  }
8919
+ if (key.fn === 9) {
8920
+ if (state.goalPanelOpen) {
8921
+ dispatch({ type: "toggleGoalPanel" });
8922
+ } else {
8923
+ if (state.agentsMonitorOpen) dispatch({ type: "toggleAgentsMonitor" });
8924
+ if (state.monitorOpen) dispatch({ type: "toggleMonitor" });
8925
+ if (state.worktreeMonitorOpen) dispatch({ type: "worktreeMonitorToggle" });
8926
+ if (state.todosMonitorOpen) dispatch({ type: "toggleTodosMonitor" });
8927
+ if (state.autoPhase?.monitorOpen) dispatch({ type: "autoPhaseMonitorToggle" });
8928
+ if (state.settingsPicker.open) dispatch({ type: "settingsClose" });
8929
+ if (state.queuePanelOpen) dispatch({ type: "toggleQueuePanel" });
8930
+ if (state.processListOpen) dispatch({ type: "toggleProcessList" });
8931
+ if (state.helpOpen) dispatch({ type: "toggleHelp" });
8932
+ dispatch({ type: "toggleGoalPanel" });
8933
+ }
8934
+ return;
8935
+ }
8810
8936
  if (key.ctrl && input === "s") {
8811
8937
  if (state.settingsPicker.open) {
8812
8938
  dispatch({ type: "settingsClose" });
@@ -8877,6 +9003,10 @@ function App({
8877
9003
  dispatch({ type: "toggleProcessList" });
8878
9004
  return;
8879
9005
  }
9006
+ if (state.goalPanelOpen) {
9007
+ dispatch({ type: "toggleGoalPanel" });
9008
+ return;
9009
+ }
8880
9010
  }
8881
9011
  if (input === "?" && !key.ctrl && !key.meta && draftRef.current.buffer === "" && !state.slashPicker.open && !state.picker.open && !state.modelPicker.open && !state.autonomyPicker.open && !state.settingsPicker.open && !state.rewindOverlay && !state.monitorOpen && !state.agentsMonitorOpen && !state.worktreeMonitorOpen && !state.todosMonitorOpen && !state.autoPhase?.monitorOpen) {
8882
9012
  dispatch({ type: "toggleHelp" });
@@ -8963,7 +9093,7 @@ function App({
8963
9093
  setDraft(buffer, buffer.length);
8964
9094
  return;
8965
9095
  }
8966
- const overlayOpen = state.monitorOpen || state.agentsMonitorOpen || state.worktreeMonitorOpen || state.todosMonitorOpen || state.queuePanelOpen || state.processListOpen || state.helpOpen || (state.autoPhase?.monitorOpen ?? false) || state.rewindOverlay !== null;
9096
+ const overlayOpen = state.monitorOpen || state.agentsMonitorOpen || state.worktreeMonitorOpen || state.todosMonitorOpen || state.queuePanelOpen || state.processListOpen || state.goalPanelOpen || state.helpOpen || (state.autoPhase?.monitorOpen ?? false) || state.rewindOverlay !== null;
8967
9097
  if (key.upArrow) {
8968
9098
  if (!overlayOpen && state.inputHistory.length > 0) {
8969
9099
  dispatch({ type: "historyUp" });
@@ -9320,8 +9450,21 @@ function App({
9320
9450
  if (!builder) return;
9321
9451
  const steering = state.steeringPending;
9322
9452
  let effectiveText = trimmed;
9323
- const hasChips = trimmed ? new RegExp(INLINE_TOKEN_SRC, "g").test(trimmed) : false;
9324
- if (enhanceEnabledRef.current && state.status === "idle" && !steering && !hasChips && shouldEnhance(trimmed)) {
9453
+ const chips = [];
9454
+ let cleanText = trimmed;
9455
+ const chipRe = new RegExp(INLINE_TOKEN_SRC, "g");
9456
+ let chipMatch;
9457
+ while ((chipMatch = chipRe.exec(trimmed)) !== null) {
9458
+ chips.push(chipMatch[0]);
9459
+ }
9460
+ if (chips.length > 0) {
9461
+ cleanText = trimmed.replace(chipRe, "").replace(/\s{2,}/g, " ").trim();
9462
+ if (!cleanText) {
9463
+ cleanText = trimmed;
9464
+ chips.length = 0;
9465
+ }
9466
+ }
9467
+ if (enhanceEnabledRef.current && state.status === "idle" && !steering && shouldEnhance(cleanText)) {
9325
9468
  dispatch({ type: "enhanceBusy", on: true });
9326
9469
  const ac = new AbortController();
9327
9470
  enhanceAbortRef.current = ac;
@@ -9331,7 +9474,7 @@ function App({
9331
9474
  result = await enhanceUserPrompt({
9332
9475
  provider: agent.ctx.provider,
9333
9476
  model: agent.ctx.model,
9334
- text: trimmed,
9477
+ text: cleanText,
9335
9478
  signal: ac.signal,
9336
9479
  onError: (reason) => {
9337
9480
  enhanceErr = reason;
@@ -9353,27 +9496,30 @@ function App({
9353
9496
  }
9354
9497
  });
9355
9498
  }
9356
- if (result && !normalizedEqual(result.refined, trimmed)) {
9499
+ if (result && !normalizedEqual(result.refined, cleanText)) {
9500
+ const chipSuffix = chips.length > 0 ? ` ${chips.join(" ")}` : "";
9501
+ const refinedWithChips = result.refined + chipSuffix;
9502
+ const englishWithChips = result.english + chipSuffix;
9357
9503
  const decision = await new Promise((resolve) => {
9358
9504
  dispatch({
9359
9505
  type: "enhanceOpen",
9360
9506
  info: {
9361
9507
  original: trimmed,
9362
- refined: result.refined,
9363
- english: result.english,
9508
+ refined: refinedWithChips,
9509
+ english: englishWithChips,
9364
9510
  resolve
9365
9511
  }
9366
9512
  });
9367
9513
  });
9368
9514
  dispatch({ type: "enhanceClose" });
9369
9515
  if (decision === "edit") {
9370
- setDraft(result.refined, result.refined.length);
9516
+ setDraft(refinedWithChips, refinedWithChips.length);
9371
9517
  return;
9372
9518
  }
9373
9519
  if (decision === "english") {
9374
- effectiveText = result.english;
9520
+ effectiveText = englishWithChips;
9375
9521
  } else {
9376
- effectiveText = decision === "refined" ? result.refined : trimmed;
9522
+ effectiveText = decision === "refined" ? refinedWithChips : trimmed;
9377
9523
  }
9378
9524
  }
9379
9525
  }
@@ -9734,7 +9880,8 @@ User message:
9734
9880
  ) : null,
9735
9881
  Object.keys(state.worktrees).length > 0 && !state.worktreeMonitorOpen && !state.monitorOpen ? /* @__PURE__ */ jsx(WorktreePanel, { worktrees: state.worktrees, nowTick }) : null,
9736
9882
  state.queuePanelOpen ? /* @__PURE__ */ jsx(QueuePanel, { items: state.queue }) : null,
9737
- state.processListOpen ? /* @__PURE__ */ jsx(ProcessListMonitor, {}) : null
9883
+ state.processListOpen ? /* @__PURE__ */ jsx(ProcessListMonitor, {}) : null,
9884
+ state.goalPanelOpen ? /* @__PURE__ */ jsx(GoalPanel, { goal: state.goalSummary }) : null
9738
9885
  ] })
9739
9886
  ] }) });
9740
9887
  }