groove-dev 0.27.134 → 0.27.136

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 (85) hide show
  1. package/moe-training/client/domain-tagger.js +1 -1
  2. package/moe-training/scripts/retag-delegate-yield.js +303 -0
  3. package/moe-training/test/shared/envelope-schema.test.js +3 -3
  4. package/node_modules/@groove-dev/cli/package.json +1 -1
  5. package/node_modules/@groove-dev/daemon/package.json +1 -1
  6. package/node_modules/@groove-dev/daemon/src/adaptive.js +77 -0
  7. package/node_modules/@groove-dev/daemon/src/api.js +35 -5
  8. package/node_modules/@groove-dev/daemon/src/journalist.js +28 -12
  9. package/node_modules/@groove-dev/daemon/src/model-lab.js +53 -76
  10. package/node_modules/@groove-dev/daemon/src/process.js +91 -2
  11. package/node_modules/@groove-dev/daemon/src/rotator.js +45 -3
  12. package/node_modules/@groove-dev/gui/dist/assets/{index-Dozp69tK.js → index-BrZHF7pK.js} +1770 -1766
  13. package/node_modules/@groove-dev/gui/dist/assets/index-DIfiwdKl.css +1 -0
  14. package/node_modules/@groove-dev/gui/dist/index.html +2 -2
  15. package/node_modules/@groove-dev/gui/package.json +1 -1
  16. package/node_modules/@groove-dev/gui/src/components/agents/agent-chat.jsx +60 -18
  17. package/node_modules/@groove-dev/gui/src/components/agents/agent-feed.jsx +42 -20
  18. package/node_modules/@groove-dev/gui/src/components/agents/agent-file-tree.jsx +1 -1
  19. package/node_modules/@groove-dev/gui/src/components/agents/workspace-mode.jsx +1 -1
  20. package/node_modules/@groove-dev/gui/src/components/chat/chat-messages.jsx +2 -22
  21. package/node_modules/@groove-dev/gui/src/components/editor/code-editor.jsx +9 -9
  22. package/node_modules/@groove-dev/gui/src/components/editor/file-tree.jsx +1 -1
  23. package/node_modules/@groove-dev/gui/src/components/editor/terminal.jsx +7 -0
  24. package/node_modules/@groove-dev/gui/src/components/lab/chat-playground.jsx +59 -51
  25. package/node_modules/@groove-dev/gui/src/components/lab/lab-assistant.jsx +48 -48
  26. package/node_modules/@groove-dev/gui/src/components/lab/metrics-panel.jsx +39 -38
  27. package/node_modules/@groove-dev/gui/src/components/lab/parameter-panel.jsx +4 -5
  28. package/node_modules/@groove-dev/gui/src/components/lab/preset-manager.jsx +11 -11
  29. package/node_modules/@groove-dev/gui/src/components/lab/runtime-config.jsx +66 -62
  30. package/node_modules/@groove-dev/gui/src/components/lab/system-prompt-editor.jsx +13 -13
  31. package/node_modules/@groove-dev/gui/src/components/layout/breadcrumb-bar.jsx +1 -1
  32. package/node_modules/@groove-dev/gui/src/components/preview/preview-workspace.jsx +62 -22
  33. package/node_modules/@groove-dev/gui/src/components/ui/slider.jsx +16 -17
  34. package/node_modules/@groove-dev/gui/src/components/ui/table-tree.jsx +38 -0
  35. package/node_modules/@groove-dev/gui/src/stores/groove.js +23 -9
  36. package/node_modules/@groove-dev/gui/src/views/editor.jsx +1 -1
  37. package/node_modules/@groove-dev/gui/src/views/model-lab.jsx +101 -87
  38. package/node_modules/moe-training/client/domain-tagger.js +1 -1
  39. package/node_modules/moe-training/scripts/retag-delegate-yield.js +303 -0
  40. package/node_modules/moe-training/test/shared/envelope-schema.test.js +3 -3
  41. package/package.json +1 -1
  42. package/packages/cli/package.json +1 -1
  43. package/packages/daemon/package.json +1 -1
  44. package/packages/daemon/src/adaptive.js +77 -0
  45. package/packages/daemon/src/api.js +35 -5
  46. package/packages/daemon/src/journalist.js +28 -12
  47. package/packages/daemon/src/model-lab.js +53 -76
  48. package/packages/daemon/src/process.js +91 -2
  49. package/packages/daemon/src/rotator.js +45 -3
  50. package/packages/gui/dist/assets/{index-Dozp69tK.js → index-BrZHF7pK.js} +1770 -1766
  51. package/packages/gui/dist/assets/index-DIfiwdKl.css +1 -0
  52. package/packages/gui/dist/index.html +2 -2
  53. package/packages/gui/package.json +1 -1
  54. package/packages/gui/src/components/agents/agent-chat.jsx +60 -18
  55. package/packages/gui/src/components/agents/agent-feed.jsx +42 -20
  56. package/packages/gui/src/components/agents/agent-file-tree.jsx +1 -1
  57. package/packages/gui/src/components/agents/workspace-mode.jsx +1 -1
  58. package/packages/gui/src/components/chat/chat-messages.jsx +2 -22
  59. package/packages/gui/src/components/editor/code-editor.jsx +9 -9
  60. package/packages/gui/src/components/editor/file-tree.jsx +1 -1
  61. package/packages/gui/src/components/editor/terminal.jsx +7 -0
  62. package/packages/gui/src/components/lab/chat-playground.jsx +59 -51
  63. package/packages/gui/src/components/lab/lab-assistant.jsx +48 -48
  64. package/packages/gui/src/components/lab/metrics-panel.jsx +39 -38
  65. package/packages/gui/src/components/lab/parameter-panel.jsx +4 -5
  66. package/packages/gui/src/components/lab/preset-manager.jsx +11 -11
  67. package/packages/gui/src/components/lab/runtime-config.jsx +66 -62
  68. package/packages/gui/src/components/lab/system-prompt-editor.jsx +13 -13
  69. package/packages/gui/src/components/layout/breadcrumb-bar.jsx +1 -1
  70. package/packages/gui/src/components/preview/preview-workspace.jsx +62 -22
  71. package/packages/gui/src/components/ui/slider.jsx +16 -17
  72. package/packages/gui/src/components/ui/table-tree.jsx +38 -0
  73. package/packages/gui/src/stores/groove.js +23 -9
  74. package/packages/gui/src/views/editor.jsx +1 -1
  75. package/packages/gui/src/views/model-lab.jsx +101 -87
  76. package/plan_files/DELEGATE_YIELD_TRAINING_TAGS.md +135 -0
  77. package/plan_files/session-quality-rotation-fixes.md +218 -0
  78. package/test.py +571 -0
  79. package/node_modules/@groove-dev/gui/dist/assets/index-BgQL4bNl.css +0 -1
  80. package/packages/gui/dist/assets/index-BgQL4bNl.css +0 -1
  81. /package/{AGENT_ORCHESTRATION.md → plan_files/AGENT_ORCHESTRATION.md} +0 -0
  82. /package/{DYNAMIC_LEAF_ARCH.md → plan_files/DYNAMIC_LEAF_ARCH.md} +0 -0
  83. /package/{EMBEDDING_DIAGNOSTIC.md → plan_files/EMBEDDING_DIAGNOSTIC.md} +0 -0
  84. /package/{EMBEDDING_SERVICE_BUILD_PLAN.md → plan_files/EMBEDDING_SERVICE_BUILD_PLAN.md} +0 -0
  85. /package/{MOE_TRAINING_PIPELINE.md → plan_files/MOE_TRAINING_PIPELINE.md} +0 -0
@@ -34,6 +34,7 @@ export class Rotator extends EventEmitter {
34
34
  this.rotating = new Set();
35
35
  this.lastRotationTime = new Map(); // agentId -> timestamp of last rotation
36
36
  this._lastContextState = new Map(); // agentId -> { contextUsage, timestamp }
37
+ this.compactionCounts = new Map(); // agentId -> number of natural compactions
37
38
  this.enabled = false;
38
39
  this.liveScores = {};
39
40
  this.scoreHistory = {};
@@ -148,6 +149,9 @@ export class Rotator extends EventEmitter {
148
149
 
149
150
  if (ageSec > 1800) score -= 5;
150
151
  if (ageSec > 3600) score -= 10;
152
+ if (ageSec > 7200) score -= 15;
153
+ if (ageSec > 14400) score -= 20;
154
+ if (ageSec > 28800) score -= 25;
151
155
 
152
156
  score = Math.max(0, Math.min(100, score));
153
157
 
@@ -236,13 +240,34 @@ export class Rotator extends EventEmitter {
236
240
  }
237
241
  }
238
242
 
243
+ // --- Change 4: Truncation-triggered immediate rotation (all providers) ---
244
+ if (agent.consecutiveTruncations >= 2) {
245
+ console.log(` Rotator: ${agent.name} consecutiveTruncations=${agent.consecutiveTruncations} — FORCE rotating (incomplete_response)`);
246
+ await this.rotate(agent.id, { reason: 'incomplete_response', qualityScore: 0 });
247
+ continue;
248
+ }
249
+
250
+ // --- Change 3: Compaction-aware rotation for self-managing providers ---
251
+ const compactions = this.compactionCounts.get(agent.id) || 0;
252
+ if (compactions >= 5) {
253
+ console.log(` Rotator: ${agent.name} compactions=${compactions} — FORCE rotating (compaction_ceiling)`);
254
+ await this.rotate(agent.id, { reason: 'compaction_ceiling' });
255
+ continue;
256
+ }
257
+
239
258
  // Quality rotation uses a shorter cooldown (2 min vs 5 min) so degraded
240
259
  // agents don't persist producing bad output for 8-10 minutes
241
260
  if (this._isOnCooldown(agent.id, QUALITY_COOLDOWN_MS)) continue;
242
261
 
262
+ // Effective quality threshold: lower for agents showing degradation signals
263
+ let effectiveQualityThreshold = QUALITY_THRESHOLD;
264
+ if (compactions >= 3 || agent.truncationSuspected || agent.cacheResetDetected) {
265
+ effectiveQualityThreshold = 55;
266
+ }
267
+
243
268
  // All providers: quality-based rotation — detects degradation before tokens are wasted
244
269
  const quality = this.scoreLiveSession(agent);
245
- if (quality.hasEnoughData && quality.score < QUALITY_THRESHOLD) {
270
+ if (quality.hasEnoughData && quality.score < effectiveQualityThreshold) {
246
271
  // Severe degradation (score < 25): rotate immediately regardless of idle state.
247
272
  // The agent is producing bad output — waiting for idle is counterproductive.
248
273
  if (quality.score < 25) {
@@ -293,6 +318,7 @@ export class Rotator extends EventEmitter {
293
318
  this.daemon.classifier.clearAgent(agentId);
294
319
  delete this.liveScores[agentId];
295
320
  delete this.scoreHistory[agentId];
321
+ this.compactionCounts.delete(agentId);
296
322
 
297
323
  let brief = await journalist.generateHandoffBrief(agent, {
298
324
  reason: options.reason,
@@ -317,7 +343,7 @@ export class Rotator extends EventEmitter {
317
343
  reason: options.reason || 'manual',
318
344
  oldTokens: agent.tokensUsed,
319
345
  contextUsage: agent.contextUsage,
320
- brief: brief.slice(0, 4000),
346
+ brief: brief.slice(0, 6000),
321
347
  }, agent.workingDir, agent.teamId);
322
348
  }
323
349
 
@@ -482,6 +508,22 @@ export class Rotator extends EventEmitter {
482
508
  }
483
509
 
484
510
  recordNaturalCompaction(agent, peakUsage, currentUsage) {
511
+ // Guard: require valid agent data to prevent duplicate ghost entries
512
+ if (!agent?.id || !agent?.name || !agent?.provider) return;
513
+
514
+ // Dedup: skip if we already recorded a compaction for this agent within 30s
515
+ const now = Date.now();
516
+ const recent = this.rotationHistory.filter(
517
+ (r) => r.reason === 'natural_compaction' && r.agentId === agent.id
518
+ );
519
+ if (recent.length > 0) {
520
+ const lastTs = new Date(recent[recent.length - 1].timestamp).getTime();
521
+ if (now - lastTs < 30_000) return;
522
+ }
523
+
524
+ // Track compaction count for compaction-ceiling rotation
525
+ this.compactionCounts.set(agent.id, (this.compactionCounts.get(agent.id) || 0) + 1);
526
+
485
527
  const record = {
486
528
  agentId: agent.id,
487
529
  agentName: agent.name,
@@ -492,7 +534,7 @@ export class Rotator extends EventEmitter {
492
534
  contextAfter: currentUsage,
493
535
  reason: 'natural_compaction',
494
536
  qualityScore: null,
495
- timestamp: new Date().toISOString(),
537
+ timestamp: new Date(now).toISOString(),
496
538
  newAgentId: agent.id,
497
539
  newTokens: agent.tokensUsed || 0,
498
540
  };