@narumitw/pi-plan-mode 0.60.0 → 0.60.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @narumitw/pi-plan-mode
2
2
 
3
+ ## 0.60.1
4
+
5
+ ### Patch Changes
6
+
7
+ - cf7b63d: Put editor widget names and short current count/state summaries in their divider lines. Remove duplicate body titles while retaining safety text, detail rows, privacy modes, and standalone RPC/tool output. In fullscreen Pi, click anywhere in a widget to collapse it to one named line, then click that line to restore the latest content. Preserve independent, session-local disclosure through updates without taking editor focus, changing domain data, or stopping background work. Existing owner controls provide keyboard restoration; regular-mode mouse input remains terminal-owned.
8
+
9
+ The Kit minor release supplies the named widget state and publisher disclosure APIs. Changesets raises all adopting consumers' Kit dependency floors in the same Version PR. Publish and verify the exact Kit artifact before its consumers.
10
+ - Updated dependencies [cf7b63d]
11
+ - @narumitw/pi-tui-kit@0.70.0
12
+
3
13
  ## 0.60.0
4
14
 
5
15
  ### Minor Changes
package/README.md CHANGED
@@ -177,6 +177,7 @@ Enabling questionnaires again does not call the model or reopen old questions.
177
177
  Free discussion keeps the same read-only restrictions and allows plain-text questions without questionnaire dialogs.
178
178
  Completed plans are still displayed, stored, and marked `plan ready`, but no automatic action menu opens; use `/plan` manually to implement, save, export, revise, exit, or enable questionnaires.
179
179
  The editor widget shows the interaction mode and the available F2 or `/plan` entry point, including when a plan is ready.
180
+ In fullscreen TUI mode, click the **Plan mode** divider or any body row, including its blank right side, to collapse or expand it. Collapse changes only the display, not the workflow or read-only restrictions. The choice survives status updates and branch navigation, but resets on session replacement or reload. Open `/plan` without arguments to expand it from the keyboard.
180
181
  The interaction mode restores with the active workflow on reload or resume; a new workflow starts with questionnaires enabled.
181
182
  See [interaction switching](./docs/command-workflows.md#questionnaires-and-free-discussion) for RPC behavior and recovery.
182
183
 
package/dist/index.ts CHANGED
@@ -1197,35 +1197,55 @@ import { EditorStatusWidget } from "@narumitw/pi-tui-kit/editor-status-widget";
1197
1197
  var STATUS_KEY = "plan-mode";
1198
1198
  var PLAN_WIDGET_KEY = "plan-mode-plan";
1199
1199
  var BIDI_CONTROLS = /[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/gu;
1200
- function updatePlanModeUi(ctx, state, toolSummary, interactionShortcut) {
1200
+ function updatePlanModeUi(ctx, state, toolSummary, interactionShortcut, widgetState) {
1201
1201
  ctx.ui.setStatus(STATUS_KEY, formatStatus(state));
1202
1202
  const discussion = state.interactionMode === "discussion";
1203
1203
  const interactionHint = formatInteractionHint(state, ctx.mode === "tui" ? interactionShortcut : void 0);
1204
- let lines;
1204
+ let presentation;
1205
1205
  if (state.enabled && state.latestPlan) {
1206
- lines = [
1207
- "Proposed plan ready",
1208
- ...discussion ? ["Plan mode: free discussion"] : [],
1209
- "Use /plan to implement, save, revise, or exit Plan mode.",
1210
- interactionHint
1211
- ];
1206
+ const actions = "Use /plan to implement, save, revise, or exit Plan mode.";
1207
+ presentation = {
1208
+ summary: discussion ? "Ready \xB7 Free discussion" : "Ready",
1209
+ body: ["File edits remain blocked.", actions, interactionHint],
1210
+ fallback: [
1211
+ "Proposed plan ready",
1212
+ ...discussion ? ["Plan mode: free discussion"] : [],
1213
+ actions,
1214
+ interactionHint
1215
+ ]
1216
+ };
1212
1217
  } else if (state.enabled) {
1213
- lines = [
1214
- discussion ? "Plan mode: free discussion" : "Plan mode: planning",
1215
- toolSummary(),
1216
- discussion ? "Plain-text questions are allowed; questionnaires are paused." : "Finish with plan_mode_complete when decision-ready.",
1217
- interactionHint
1218
- ];
1218
+ const tools = toolSummary();
1219
+ const discussionHint = "Plain-text questions are allowed; questionnaires are paused.";
1220
+ presentation = {
1221
+ summary: discussion ? "Free discussion" : "Planning",
1222
+ body: ["File edits remain blocked.", tools, ...discussion ? [discussionHint] : [], interactionHint],
1223
+ fallback: [
1224
+ discussion ? "Plan mode: free discussion" : "Plan mode: planning",
1225
+ tools,
1226
+ discussion ? discussionHint : "Finish with plan_mode_complete when decision-ready.",
1227
+ interactionHint
1228
+ ]
1229
+ };
1219
1230
  } else if (state.savedPlan) {
1220
- lines = ["Plan saved for later", "Use /plan to show, implement, or clear it."];
1231
+ const actions = "Use /plan to show, implement, or clear it.";
1232
+ presentation = { summary: "Saved", body: [actions], fallback: ["Plan saved for later", actions] };
1221
1233
  } else if (state.activeImplementation) {
1222
- lines = ["Implementation plan active", "Use /plan to show, replace, or clear it."];
1234
+ const actions = "Use /plan to show, replace, or clear it.";
1235
+ presentation = {
1236
+ summary: "Implementation active",
1237
+ body: [actions],
1238
+ fallback: ["Implementation plan active", actions]
1239
+ };
1223
1240
  }
1224
- publishPlanModeWidget(ctx, lines);
1241
+ publishPlanModeWidget(ctx, presentation, widgetState);
1225
1242
  }
1226
- function createPlanModeWidget(lines, theme) {
1243
+ function createPlanModeWidget(lines, theme, state, summary) {
1227
1244
  return new EditorStatusWidget({
1228
1245
  theme,
1246
+ name: "Plan mode",
1247
+ summary,
1248
+ state,
1229
1249
  renderBody: () => lines.map((line, index) => {
1230
1250
  const text = sanitizePlanModeWidgetLine(line);
1231
1251
  return index === 0 ? text : theme.fg("muted", text);
@@ -1287,17 +1307,20 @@ function planModeStatusText(state, toolSummary) {
1287
1307
  if (state.activeImplementation) return "An implementation plan is active.";
1288
1308
  return "Plan mode is off.";
1289
1309
  }
1290
- function publishPlanModeWidget(ctx, lines) {
1291
- if (!lines) {
1310
+ function publishPlanModeWidget(ctx, presentation, widgetState) {
1311
+ if (!presentation) {
1292
1312
  ctx.ui.setWidget(PLAN_WIDGET_KEY, void 0);
1293
1313
  return;
1294
1314
  }
1295
1315
  if (ctx.mode !== "tui") {
1296
- ctx.ui.setWidget(PLAN_WIDGET_KEY, [...lines]);
1316
+ ctx.ui.setWidget(PLAN_WIDGET_KEY, [...presentation.fallback]);
1297
1317
  return;
1298
1318
  }
1299
- const snapshot = [...lines];
1300
- ctx.ui.setWidget(PLAN_WIDGET_KEY, (_tui, theme) => createPlanModeWidget(snapshot, theme));
1319
+ const snapshot = [...presentation.body];
1320
+ ctx.ui.setWidget(
1321
+ PLAN_WIDGET_KEY,
1322
+ (_tui, theme) => createPlanModeWidget(snapshot, theme, widgetState, presentation.summary)
1323
+ );
1301
1324
  }
1302
1325
  function formatInteractionHint(state, interactionShortcut) {
1303
1326
  const action = state.interactionMode === "discussion" ? "enable questionnaires" : "switch to free discussion";
@@ -1550,6 +1573,7 @@ function planMode(pi, dependencies = {}) {
1550
1573
  let workflowOwner;
1551
1574
  let currentSession;
1552
1575
  let currentSessionContext;
1576
+ let widgetState = { collapsed: false };
1553
1577
  let interactiveUiPromise;
1554
1578
  const loadInteractiveUi = () => {
1555
1579
  if (dependencies.loadInteractiveUi) return dependencies.loadInteractiveUi();
@@ -1774,6 +1798,10 @@ function planMode(pi, dependencies = {}) {
1774
1798
  "The interactive /plan menu is unavailable in print and JSON modes. Use /plan start or /plan <prompt>."
1775
1799
  );
1776
1800
  }
1801
+ if (ctx.mode === "tui" && widgetState.collapsed) {
1802
+ widgetState.collapsed = false;
1803
+ updateUi(ctx);
1804
+ }
1777
1805
  if (!state.enabled) {
1778
1806
  if (state.activeImplementation && ctx.hasUI) {
1779
1807
  await showActivePlanMenu(ctx);
@@ -1864,6 +1892,7 @@ function planMode(pi, dependencies = {}) {
1864
1892
  cancelDeferredFreshImplementation();
1865
1893
  const generation = ++menuGeneration;
1866
1894
  finalizationRequest.reset();
1895
+ widgetState = { collapsed: false };
1867
1896
  currentSession = ctx.sessionManager;
1868
1897
  currentSessionContext = ctx;
1869
1898
  workflowOwner = void 0;
@@ -2000,6 +2029,7 @@ function planMode(pi, dependencies = {}) {
2000
2029
  if (currentSession === ctx.sessionManager) {
2001
2030
  currentSession = void 0;
2002
2031
  currentSessionContext = void 0;
2032
+ widgetState = { collapsed: false };
2003
2033
  }
2004
2034
  });
2005
2035
  pi.on("tool_call", async (event, ctx) => {
@@ -3169,6 +3199,7 @@ ${intent.plan}`,
3169
3199
  }
3170
3200
  function bindWorkflowSessionIfNeeded(ctx) {
3171
3201
  if (currentSession === ctx.sessionManager) return;
3202
+ widgetState = { collapsed: false };
3172
3203
  currentSession = ctx.sessionManager;
3173
3204
  workflowOwner = void 0;
3174
3205
  workflowMutex.bindSession(ctx.sessionManager);
@@ -3206,7 +3237,7 @@ ${intent.plan}`,
3206
3237
  return false;
3207
3238
  }
3208
3239
  function updateUi(ctx) {
3209
- updatePlanModeUi(ctx, state, formatToolSummary, interaction.shortcutLabel(ctx));
3240
+ updatePlanModeUi(ctx, state, formatToolSummary, interaction.shortcutLabel(ctx), widgetState);
3210
3241
  }
3211
3242
  function clearUi(ctx) {
3212
3243
  clearPlanModeUi(ctx);