mindweave 2.4.5 → 2.4.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.
Files changed (37) hide show
  1. package/dist/cli/App.js +35 -8
  2. package/dist/cli/App.js.map +1 -1
  3. package/dist/cli/attachments.js +18 -5
  4. package/dist/cli/attachments.js.map +1 -1
  5. package/dist/cli/backgroundWake.js +4 -0
  6. package/dist/cli/backgroundWake.js.map +1 -0
  7. package/dist/cli/commands.js +1 -1
  8. package/dist/cli/commands.js.map +1 -1
  9. package/dist/dynamo/contextBudget.js +145 -0
  10. package/dist/dynamo/contextBudget.js.map +1 -0
  11. package/dist/dynamo/contextWindow.js +18 -0
  12. package/dist/dynamo/contextWindow.js.map +1 -1
  13. package/dist/dynamo/engine.js +29 -7
  14. package/dist/dynamo/engine.js.map +1 -1
  15. package/dist/dynamo/prompt.js +4 -0
  16. package/dist/dynamo/prompt.js.map +1 -1
  17. package/dist/mcp/oauth/flow.js +20 -3
  18. package/dist/mcp/oauth/flow.js.map +1 -1
  19. package/dist/memory/autoMemory.js +42 -1
  20. package/dist/memory/autoMemory.js.map +1 -1
  21. package/dist/memory/compaction.js +19 -44
  22. package/dist/memory/compaction.js.map +1 -1
  23. package/dist/memory/session.js +4 -0
  24. package/dist/memory/session.js.map +1 -1
  25. package/dist/tools/backgroundShells.js +42 -4
  26. package/dist/tools/backgroundShells.js.map +1 -1
  27. package/dist/tools/readFile.js +29 -9
  28. package/dist/tools/readFile.js.map +1 -1
  29. package/dist/tools/runCommand.js +35 -8
  30. package/dist/tools/runCommand.js.map +1 -1
  31. package/dist/tools/subagent.js +41 -3
  32. package/dist/tools/subagent.js.map +1 -1
  33. package/dist/tools/todo.js +35 -0
  34. package/dist/tools/todo.js.map +1 -1
  35. package/dist/tools/verifyReport.js +144 -0
  36. package/dist/tools/verifyReport.js.map +1 -0
  37. package/package.json +2 -2
package/dist/cli/App.js CHANGED
@@ -25,7 +25,8 @@ import { useCallback, useEffect, useMemo, useReducer, useRef, useState } from "r
25
25
  import { isAbsolute, resolve } from "node:path";
26
26
  import { Box, Static, Text, measureElement, useApp, useInput, useStdout } from "ink";
27
27
  import { compactNow, contextUsed, respond } from "../dynamo/engine.js";
28
- import { contextPressure, sharpContextWindow } from "../dynamo/contextWindow.js";
28
+ import { contextPressure, sharpContextWindow, autoCompactThreshold } from "../dynamo/contextWindow.js";
29
+ import { contextBudget, formatBudget } from "../dynamo/contextBudget.js";
29
30
  import { createSession, resumeSession, reloadProjectMemory } from "../memory/session.js";
30
31
  import { saveSession, listSessions } from "../memory/store.js";
31
32
  import { stopChassis } from "../alternator/lane.js";
@@ -52,6 +53,7 @@ import { accessRefusal } from "../drivers/providerError.js";
52
53
  import { resolveAttachments, stripAttachments } from "./attachments.js";
53
54
  import { collapsePastes, wrapPastedText } from "../memory/pastedText.js";
54
55
  import { createDropHandles, expandHandles } from "./dropHandles.js";
56
+ import { shouldReactToBackground } from "./backgroundWake.js";
55
57
  import { TIPS, TipLine, nextTip, randomTipIndex } from "./components/TipLine.js";
56
58
  import { completePath } from "./pathComplete.js";
57
59
  import { formatHelp } from "./help.js";
@@ -848,13 +850,22 @@ export function App({ resumeSessionId, initialScreen }) {
848
850
  });
849
851
  }, []);
850
852
  // When a background shell finishes and Mindweave is idle, react to it automatically.
853
+ // `modalOpen` is a dependency on purpose: an open menu holds the wake back, and closing
854
+ // it has to re-run this check or the finished command waits for some unrelated render.
855
+ const modalOpen = overlay !== null || mcpOpen || trustOpen || needsKey;
851
856
  useEffect(() => {
852
- if (!ready || busy || needsKey || reactingRef.current)
853
- return;
854
857
  const mgr = session.current?.toolContext.backgroundShells;
855
- if (mgr && mgr.pendingCount() > 0)
858
+ const wake = shouldReactToBackground({
859
+ ready,
860
+ busy,
861
+ needsKey,
862
+ reacting: reactingRef.current,
863
+ modalOpen,
864
+ pending: mgr?.pendingCount() ?? 0,
865
+ });
866
+ if (wake)
856
867
  void reactToBackground();
857
- }, [bgTick, busy, ready, needsKey]);
868
+ }, [bgTick, busy, ready, needsKey, modalOpen]);
858
869
  // When the turn ends, send what's queued — CONSECUTIVE plain messages together, as
859
870
  // one turn (see messageQueue.ts for why), a slash command on its own. Chains: each
860
871
  // send ends, this fires again, until the queue is empty.
@@ -2441,9 +2452,25 @@ export function App({ resumeSessionId, initialScreen }) {
2441
2452
  return;
2442
2453
  }
2443
2454
  if (name === "/context") {
2444
- const text = s.projectContext || "No project context was captured for this directory.";
2445
- note("project context (what Mindweave sees at startup):");
2446
- say(text);
2455
+ // The old /context printed the startup project blurb, which answers a question
2456
+ // nobody asks twice. The one people ask every time a compaction fires is what is
2457
+ // filling the window — so that is the default, and the blurb moved to an argument.
2458
+ if (arg.trim() === "project") {
2459
+ const text = s.projectContext || "No project context was captured for this directory.";
2460
+ note("project context (what Mindweave sees at startup):");
2461
+ say(text);
2462
+ return;
2463
+ }
2464
+ // Only a measurement taken against the CURRENT model is passed through; a figure
2465
+ // carried over from another provider's tool serialisation would be the largest
2466
+ // single error in the table, and the table is meant to settle arguments.
2467
+ const measured = s.contextOverhead;
2468
+ const overhead = measured && measured.model === s.modelConfig.model ? measured.tokens : undefined;
2469
+ const budget = contextBudget(s.transcript, overhead);
2470
+ note("context breakdown:");
2471
+ say(`${formatBudget(budget, sharpContextWindow(s.modelConfig.model), autoCompactThreshold(s.modelConfig.model))}
2472
+
2473
+ /context project shows what Mindweave read about this directory at startup.`);
2447
2474
  return;
2448
2475
  }
2449
2476
  // /undo — roll back file changes. Bare undoes the last turn; `list` shows what's