demian-cli 1.0.6 → 1.0.7

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/tui.mjs CHANGED
@@ -913,6 +913,10 @@ function isFinalAnswerWorkStep(step) {
913
913
  function isTerminalWorkStep(step) {
914
914
  return step.status === "completed" || step.status === "skipped" || step.status === "failed" || step.status === "blocked";
915
915
  }
916
+ function isResolvedWorkPlan(plan) {
917
+ const steps = plan?.steps ?? [];
918
+ return steps.length > 0 && steps.every((step) => step.status === "completed" || step.status === "skipped");
919
+ }
916
920
  function appendSentence(existing, sentence) {
917
921
  const cleanSentence = sentence.trim();
918
922
  if (!cleanSentence) return existing ?? "";
@@ -1313,7 +1317,10 @@ var init_store = __esm({
1313
1317
  this.#state.promptInput = "";
1314
1318
  this.#state.promptError = void 0;
1315
1319
  this.#state.activity = "starting session";
1316
- if (!isCompactCommand(prompt)) this.#clearTurnDiff();
1320
+ if (!isCompactCommand(prompt)) {
1321
+ this.#clearTurnDiff();
1322
+ this.#clearResolvedWorkPlan();
1323
+ }
1317
1324
  this.#resetPromptHistoryCursor();
1318
1325
  this.#notify();
1319
1326
  return Promise.resolve(prompt);
@@ -1325,7 +1332,10 @@ var init_store = __esm({
1325
1332
  this.#state.promptInput = "";
1326
1333
  this.#state.promptError = void 0;
1327
1334
  this.#state.activity = "starting session";
1328
- if (!isCompactCommand(queued)) this.#clearTurnDiff();
1335
+ if (!isCompactCommand(queued)) {
1336
+ this.#clearTurnDiff();
1337
+ this.#clearResolvedWorkPlan();
1338
+ }
1329
1339
  this.#resetPromptHistoryCursor();
1330
1340
  this.#notify();
1331
1341
  return Promise.resolve(queued);
@@ -2334,7 +2344,7 @@ var init_store = __esm({
2334
2344
  this.#state.activity = prompt ? "starting session" : "cancelled";
2335
2345
  if (prompt && !isCompactCommand(prompt)) {
2336
2346
  this.#clearTurnDiff();
2337
- this.#clearWorkPlan();
2347
+ this.#clearResolvedWorkPlan();
2338
2348
  }
2339
2349
  this.#resetPromptHistoryCursor();
2340
2350
  resolve(prompt);
@@ -2371,6 +2381,10 @@ var init_store = __esm({
2371
2381
  this.#state.progressNotes = [];
2372
2382
  this.#state.workPlanExpanded = false;
2373
2383
  }
2384
+ #clearResolvedWorkPlan() {
2385
+ if (!isResolvedWorkPlan(this.#state.workPlan)) return;
2386
+ this.#clearWorkPlan();
2387
+ }
2374
2388
  #markActiveWorkPlanBlocked(message) {
2375
2389
  const plan = this.#state.workPlan;
2376
2390
  if (!plan) return;
@@ -61,7 +61,7 @@ function isExitCommand(input2) {
61
61
  function isStopCommand(input2) {
62
62
  return input2.trim().toLowerCase() === "/stop";
63
63
  }
64
- function isCompactCommand(input2) {
64
+ function isCompactCommand2(input2) {
65
65
  return input2.trim().toLowerCase() === "/compact";
66
66
  }
67
67
  function isRetryCommand(input2) {
@@ -971,7 +971,10 @@ var TuiStore = class {
971
971
  this.#state.promptInput = "";
972
972
  this.#state.promptError = void 0;
973
973
  this.#state.activity = "starting session";
974
- if (!isCompactCommand(prompt)) this.#clearTurnDiff();
974
+ if (!isCompactCommand2(prompt)) {
975
+ this.#clearTurnDiff();
976
+ this.#clearResolvedWorkPlan();
977
+ }
975
978
  this.#resetPromptHistoryCursor();
976
979
  this.#notify();
977
980
  return Promise.resolve(prompt);
@@ -983,7 +986,10 @@ var TuiStore = class {
983
986
  this.#state.promptInput = "";
984
987
  this.#state.promptError = void 0;
985
988
  this.#state.activity = "starting session";
986
- if (!isCompactCommand(queued)) this.#clearTurnDiff();
989
+ if (!isCompactCommand2(queued)) {
990
+ this.#clearTurnDiff();
991
+ this.#clearResolvedWorkPlan();
992
+ }
987
993
  this.#resetPromptHistoryCursor();
988
994
  this.#notify();
989
995
  return Promise.resolve(queued);
@@ -1228,7 +1234,7 @@ var TuiStore = class {
1228
1234
  this.stopActiveTask();
1229
1235
  return;
1230
1236
  }
1231
- if (isCompactCommand(prompt)) {
1237
+ if (isCompactCommand2(prompt)) {
1232
1238
  this.#resolvePrompt(prompt);
1233
1239
  return;
1234
1240
  }
@@ -1990,9 +1996,9 @@ var TuiStore = class {
1990
1996
  this.#state.promptInput = "";
1991
1997
  this.#state.promptError = void 0;
1992
1998
  this.#state.activity = prompt ? "starting session" : "cancelled";
1993
- if (prompt && !isCompactCommand(prompt)) {
1999
+ if (prompt && !isCompactCommand2(prompt)) {
1994
2000
  this.#clearTurnDiff();
1995
- this.#clearWorkPlan();
2001
+ this.#clearResolvedWorkPlan();
1996
2002
  }
1997
2003
  this.#resetPromptHistoryCursor();
1998
2004
  resolve(prompt);
@@ -2000,7 +2006,7 @@ var TuiStore = class {
2000
2006
  }
2001
2007
  #rememberPrompt(prompt) {
2002
2008
  const value = prompt.trim();
2003
- if (!value || isExitCommand(value) || isStopCommand(value) || isCompactCommand(value) || isRetryCommand(value)) return;
2009
+ if (!value || isExitCommand(value) || isStopCommand(value) || isCompactCommand2(value) || isRetryCommand(value)) return;
2004
2010
  if (this.#promptHistory.at(-1) === value) {
2005
2011
  this.#state.canRetryLastPrompt = true;
2006
2012
  return;
@@ -2029,6 +2035,10 @@ var TuiStore = class {
2029
2035
  this.#state.progressNotes = [];
2030
2036
  this.#state.workPlanExpanded = false;
2031
2037
  }
2038
+ #clearResolvedWorkPlan() {
2039
+ if (!isResolvedWorkPlan(this.#state.workPlan)) return;
2040
+ this.#clearWorkPlan();
2041
+ }
2032
2042
  #markActiveWorkPlanBlocked(message) {
2033
2043
  const plan = this.#state.workPlan;
2034
2044
  if (!plan) return;
@@ -2151,6 +2161,10 @@ function isFinalAnswerWorkStep(step) {
2151
2161
  function isTerminalWorkStep(step) {
2152
2162
  return step.status === "completed" || step.status === "skipped" || step.status === "failed" || step.status === "blocked";
2153
2163
  }
2164
+ function isResolvedWorkPlan(plan) {
2165
+ const steps = plan?.steps ?? [];
2166
+ return steps.length > 0 && steps.every((step) => step.status === "completed" || step.status === "skipped");
2167
+ }
2154
2168
  function appendSentence(existing, sentence) {
2155
2169
  const cleanSentence = sentence.trim();
2156
2170
  if (!cleanSentence) return existing ?? "";
@@ -31736,7 +31750,7 @@ async function runTuiSession(flags, store2) {
31736
31750
  return 0;
31737
31751
  }
31738
31752
  if (!prompt) return 0;
31739
- if (isCompactCommand(prompt)) {
31753
+ if (isCompactCommand2(prompt)) {
31740
31754
  const result = compactInteractiveHistory(history, config.context.main);
31741
31755
  history = result.messages;
31742
31756
  store2.prepareForPrompt("waiting for next message");
@@ -32062,6 +32076,7 @@ async function undoDiffAction(actionId) {
32062
32076
  }
32063
32077
  function submitPrompt(prompt, displayPrompt, images = []) {
32064
32078
  if (isGoalClearPrompt(prompt)) clearRestoredGoal();
32079
+ if (!isCompactCommand(prompt)) clearResolvedRestoredWorkPlan();
32065
32080
  if (displayPrompt && displayPrompt !== prompt) displayPromptOverrides.push({ prompt, displayPrompt });
32066
32081
  pendingImages = images;
32067
32082
  store.clearPromptInput();
@@ -32159,6 +32174,15 @@ function clearRestoredGoal() {
32159
32174
  restoredGoalCleared = true;
32160
32175
  if (restoredSnapshot) restoredSnapshot = { ...restoredSnapshot, goal: void 0 };
32161
32176
  }
32177
+ function clearResolvedRestoredWorkPlan() {
32178
+ if (!restoredSnapshot || !isResolvedWorkPlan2(restoredSnapshot.workPlan)) return;
32179
+ restoredSnapshot = {
32180
+ ...restoredSnapshot,
32181
+ workPlan: void 0,
32182
+ workPlanExpanded: false,
32183
+ progressNotes: []
32184
+ };
32185
+ }
32162
32186
  function isGoalClearPrompt(prompt) {
32163
32187
  return /^\/(?:goal|ralph-loop)\s+(?:clear|reset)\b/i.test(String(prompt || "").trim());
32164
32188
  }
@@ -32195,6 +32219,10 @@ function isInternalPromptBlock(block) {
32195
32219
  const text = Array.isArray(block.lines) ? block.lines.join("\n").trim() : "";
32196
32220
  return /^You are running as sub agent:/i.test(text);
32197
32221
  }
32222
+ function isResolvedWorkPlan2(plan) {
32223
+ const steps = Array.isArray(plan?.steps) ? plan.steps : [];
32224
+ return steps.length > 0 && steps.every((step) => step?.status === "completed" || step?.status === "skipped");
32225
+ }
32198
32226
  function updateDiffState(event) {
32199
32227
  if (event?.type === "user.message" && !isNestedInvocationEvent2(event)) {
32200
32228
  diffState = void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "demian-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Local terminal coding agent with TUI, goals, cowork agents, permissions, and provider switching.",
5
5
  "type": "module",
6
6
  "icon": "media/demian.svg",