@yemi33/minions 0.1.1755 → 0.1.1756

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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1756 (2026-05-06)
4
+
5
+ ### Other
6
+ - perf(doc-chat): cache locked answer in stream stripper, drop 20K doc truncation
7
+
3
8
  ## 0.1.1755 (2026-05-06)
4
9
 
5
10
  ### Fixes
package/dashboard.js CHANGED
@@ -2653,10 +2653,40 @@ function _recoverPartialDocChatResponse(result, sessionKey) {
2653
2653
  }
2654
2654
 
2655
2655
 
2656
+ // Wraps the streaming onChunk so that once the document delimiter is observed
2657
+ // in the growing text, subsequent chunks reuse the locked answer instead of
2658
+ // re-scanning the tail. The model emits "<explanation> ---DOCUMENT--- <full file>"
2659
+ // — the answer portion can't grow after the delimiter, so re-parsing every
2660
+ // chunk through the regenerated file body is wasted O(n²) work.
2661
+ //
2662
+ // Also dedups identical post-strip answers: the upstream accumulator dedups
2663
+ // against the raw growing text, but that text keeps changing as the document
2664
+ // body streams in even though the visible answer is locked. Without this
2665
+ // guard the SSE writer fires a duplicate `chunk` event for every doc-body
2666
+ // delta, which triggers a client DOM rerender and localStorage write each time.
2667
+ function _makeDocChatStreamStripper(onChunk) {
2668
+ if (!onChunk) return undefined;
2669
+ let lockedAnswer = null;
2670
+ let lastSent;
2671
+ return (text) => {
2672
+ let answer;
2673
+ if (lockedAnswer !== null) {
2674
+ answer = lockedAnswer;
2675
+ } else {
2676
+ const parsed = _parseDocChatResultText(text);
2677
+ if (parsed.content !== null) lockedAnswer = parsed.answer;
2678
+ answer = parsed.answer;
2679
+ }
2680
+ if (answer === lastSent) return;
2681
+ lastSent = answer;
2682
+ onChunk(answer);
2683
+ };
2684
+ }
2685
+
2656
2686
  // Doc-specific wrapper — adds document context, parses ---DOCUMENT---
2657
2687
  async function ccDocCall({ message, document, title, filePath, selection, canEdit, isJson, model, freshSession, onAbortReady }) {
2658
2688
  const sessionKey = filePath || title;
2659
- const docSlice = document.slice(0, 20000);
2689
+ const docSlice = String(document || '');
2660
2690
 
2661
2691
  // freshSession: true → discard any prior session for this key so the call starts clean.
2662
2692
  // Used by one-shot generation flows (e.g. Create Plan from meeting) that must not
@@ -2720,7 +2750,8 @@ async function ccDocCall({ message, document, title, filePath, selection, canEdi
2720
2750
 
2721
2751
  async function ccDocCallStreaming({ message, document, title, filePath, selection, canEdit, isJson, model, freshSession, onAbortReady, onChunk, onToolUse, onRetry }) {
2722
2752
  const sessionKey = filePath || title;
2723
- const docSlice = document.slice(0, 20000);
2753
+ const docSlice = String(document || '');
2754
+ const streamStripper = _makeDocChatStreamStripper(onChunk);
2724
2755
 
2725
2756
  if (freshSession && sessionKey) {
2726
2757
  docSessions.delete(sessionKey);
@@ -2742,7 +2773,7 @@ async function ccDocCallStreaming({ message, document, title, filePath, selectio
2742
2773
  systemPrompt: DOC_CHAT_SYSTEM_PROMPT,
2743
2774
  ...(model ? { model } : {}),
2744
2775
  onAbortReady,
2745
- onChunk: (text) => { if (onChunk) onChunk(_docChatDisplayText(text)); },
2776
+ onChunk: streamStripper,
2746
2777
  onToolUse,
2747
2778
  onRetry,
2748
2779
  });
@@ -7464,6 +7495,7 @@ module.exports = {
7464
7495
  parsePinnedEntries,
7465
7496
  _parseDocChatResultText,
7466
7497
  _formatDocChatContext,
7498
+ _makeDocChatStreamStripper,
7467
7499
  _docChatErrorMessage,
7468
7500
  _docChatPartialWarning,
7469
7501
  _docChatFailureResponse,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "runtime": "copilot",
3
3
  "models": null,
4
- "cachedAt": "2026-05-06T22:01:51.910Z"
4
+ "cachedAt": "2026-05-06T22:29:15.651Z"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.1755",
3
+ "version": "0.1.1756",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"