groove-dev 0.26.17 → 0.26.18

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.
@@ -1768,7 +1768,17 @@ Keep responses concise. Help them think, don't lecture them about the system the
1768
1768
  }
1769
1769
 
1770
1770
  const baseDir = daemon.config?.defaultWorkingDir || daemon.projectDir;
1771
- const defaultTeamId = daemon.teams.getDefault()?.id || null;
1771
+
1772
+ // Use the planner's teamId so launched agents join the correct team.
1773
+ // Accept explicit teamId from request body, or find the most recent planner agent.
1774
+ let launchTeamId = req.body?.teamId || null;
1775
+ if (!launchTeamId) {
1776
+ const planners = daemon.registry.getAll()
1777
+ .filter((a) => a.role === 'planner')
1778
+ .sort((a, b) => (b.lastActivity || '').localeCompare(a.lastActivity || ''));
1779
+ launchTeamId = planners[0]?.teamId || null;
1780
+ }
1781
+ const defaultTeamId = launchTeamId || daemon.teams.getDefault()?.id || null;
1772
1782
 
1773
1783
  // If planner specified a project directory, create it and use it as workingDir
1774
1784
  let projectWorkingDir = baseDir;
@@ -370,8 +370,9 @@ For normal file edits within your scope, proceed without review.
370
370
  this._checkPhase2(agent.id);
371
371
 
372
372
  // Auto-trigger idle QC in the same team
373
- if (status === 'completed' && (agent.tokensUsed || 0) > 2000) {
374
- this._triggerIdleQC(agent);
373
+ if (status === 'completed') {
374
+ const files = this.daemon.journalist?.getAgentFiles(agent) || [];
375
+ if (files.length > 0) this._triggerIdleQC(agent);
375
376
  }
376
377
  });
377
378
 
@@ -567,10 +568,11 @@ For normal file edits within your scope, proceed without review.
567
568
  // Phase 2 auto-spawn: check if all phase 1 agents for a team are done
568
569
  this._checkPhase2(agent.id);
569
570
 
570
- // Auto-trigger idle QC: if this agent did real work and there's an idle QC
571
+ // Auto-trigger idle QC: if this agent modified files and there's an idle QC
571
572
  // in the same team, activate it to verify the changes
572
- if (finalStatus === 'completed' && (agent.tokensUsed || 0) > 2000) {
573
- this._triggerIdleQC(agent);
573
+ if (finalStatus === 'completed') {
574
+ const files = this.daemon.journalist?.getAgentFiles(agent) || [];
575
+ if (files.length > 0) this._triggerIdleQC(agent);
574
576
  }
575
577
  });
576
578
 
@@ -671,11 +673,14 @@ For normal file edits within your scope, proceed without review.
671
673
  // Remove from pending
672
674
  pending.splice(i, 1);
673
675
 
674
- // Check if phase 1 agents did any real work.
675
- // Low token usage means they just introduced themselves and waited.
676
+ // Check if phase 1 agents did any real work by looking at file modifications.
677
+ // If no agent modified any files, there's nothing to QC.
678
+ const journalist = this.daemon.journalist;
676
679
  const phase1Idle = group.waitFor.every((id) => {
677
680
  const a = registry.get(id);
678
- return !a || (a.tokensUsed || 0) < 2000;
681
+ if (!a) return true;
682
+ const files = journalist?.getAgentFiles(a) || [];
683
+ return files.length === 0;
679
684
  });
680
685
 
681
686
  // Auto-spawn phase 2 agents — if phase 1 was idle, clear the prompt
@@ -716,19 +721,20 @@ For normal file edits within your scope, proceed without review.
716
721
 
717
722
  /**
718
723
  * Auto-trigger an idle QC agent in the same team when a teammate completes real work.
719
- * "Idle" = running with low token usage (just an intro message, awaiting instructions).
724
+ * "Idle" = running fullstack agent that hasn't modified any files yet.
720
725
  */
721
726
  _triggerIdleQC(completedAgent) {
722
727
  const registry = this.daemon.registry;
723
728
  if (!completedAgent.teamId) return;
724
729
 
725
- // Find a running fullstack/QC agent in the same team that's idle
730
+ // Find a running fullstack/QC agent in the same team that's idle (no files modified)
731
+ const journalist = this.daemon.journalist;
726
732
  const qc = registry.getAll().find((a) =>
727
733
  a.id !== completedAgent.id &&
728
734
  a.teamId === completedAgent.teamId &&
729
735
  a.role === 'fullstack' &&
730
736
  a.status === 'running' &&
731
- (a.tokensUsed || 0) < 2000
737
+ (journalist?.getAgentFiles(a) || []).length === 0
732
738
  );
733
739
  if (!qc) return;
734
740