@telora/daemon 0.15.3 → 0.15.5

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 (115) hide show
  1. package/build-info.json +2 -2
  2. package/dist/directive-executor.d.ts +18 -3
  3. package/dist/directive-executor.d.ts.map +1 -1
  4. package/dist/directive-executor.js +45 -4
  5. package/dist/directive-executor.js.map +1 -1
  6. package/dist/focus-completion.js +12 -12
  7. package/dist/focus-completion.js.map +1 -1
  8. package/dist/focus-executor.d.ts.map +1 -1
  9. package/dist/focus-executor.js +30 -13
  10. package/dist/focus-executor.js.map +1 -1
  11. package/dist/focus-phase.d.ts +22 -0
  12. package/dist/focus-phase.d.ts.map +1 -0
  13. package/dist/focus-phase.js +54 -0
  14. package/dist/focus-phase.js.map +1 -0
  15. package/dist/focus-team-state.d.ts +6 -0
  16. package/dist/focus-team-state.d.ts.map +1 -1
  17. package/dist/focus-team-state.js +13 -0
  18. package/dist/focus-team-state.js.map +1 -1
  19. package/dist/index.js +0 -0
  20. package/dist/listener.d.ts.map +1 -1
  21. package/dist/listener.js +0 -5
  22. package/dist/listener.js.map +1 -1
  23. package/dist/queries/focuses.d.ts +5 -0
  24. package/dist/queries/focuses.d.ts.map +1 -1
  25. package/dist/queries/focuses.js +15 -0
  26. package/dist/queries/focuses.js.map +1 -1
  27. package/dist/review-defect-detector.d.ts +16 -95
  28. package/dist/review-defect-detector.d.ts.map +1 -1
  29. package/dist/review-defect-detector.js +19 -211
  30. package/dist/review-defect-detector.js.map +1 -1
  31. package/dist/state-cascade.d.ts +45 -41
  32. package/dist/state-cascade.d.ts.map +1 -1
  33. package/dist/state-cascade.js +123 -215
  34. package/dist/state-cascade.js.map +1 -1
  35. package/package.json +2 -2
  36. package/dist/listener-review.d.ts +0 -37
  37. package/dist/listener-review.d.ts.map +0 -1
  38. package/dist/listener-review.js +0 -217
  39. package/dist/listener-review.js.map +0 -1
  40. package/dist/queries/strategies.d.ts +0 -97
  41. package/dist/queries/strategies.d.ts.map +0 -1
  42. package/dist/queries/strategies.js +0 -136
  43. package/dist/queries/strategies.js.map +0 -1
  44. package/dist/review-spawner.d.ts +0 -32
  45. package/dist/review-spawner.d.ts.map +0 -1
  46. package/dist/review-spawner.js +0 -170
  47. package/dist/review-spawner.js.map +0 -1
  48. package/dist/strategy-completion-event.d.ts +0 -63
  49. package/dist/strategy-completion-event.d.ts.map +0 -1
  50. package/dist/strategy-completion-event.js +0 -138
  51. package/dist/strategy-completion-event.js.map +0 -1
  52. package/dist/strategy-completion.d.ts +0 -85
  53. package/dist/strategy-completion.d.ts.map +0 -1
  54. package/dist/strategy-completion.js +0 -459
  55. package/dist/strategy-completion.js.map +0 -1
  56. package/dist/strategy-engine.d.ts +0 -47
  57. package/dist/strategy-engine.d.ts.map +0 -1
  58. package/dist/strategy-engine.js +0 -421
  59. package/dist/strategy-engine.js.map +0 -1
  60. package/dist/strategy-executor.d.ts +0 -55
  61. package/dist/strategy-executor.d.ts.map +0 -1
  62. package/dist/strategy-executor.js +0 -519
  63. package/dist/strategy-executor.js.map +0 -1
  64. package/dist/strategy-lifecycle.d.ts +0 -61
  65. package/dist/strategy-lifecycle.d.ts.map +0 -1
  66. package/dist/strategy-lifecycle.js +0 -544
  67. package/dist/strategy-lifecycle.js.map +0 -1
  68. package/dist/strategy-merge.d.ts +0 -77
  69. package/dist/strategy-merge.d.ts.map +0 -1
  70. package/dist/strategy-merge.js +0 -378
  71. package/dist/strategy-merge.js.map +0 -1
  72. package/dist/strategy-prompt-builder.d.ts +0 -24
  73. package/dist/strategy-prompt-builder.d.ts.map +0 -1
  74. package/dist/strategy-prompt-builder.js +0 -87
  75. package/dist/strategy-prompt-builder.js.map +0 -1
  76. package/dist/strategy-provisioning.d.ts +0 -16
  77. package/dist/strategy-provisioning.d.ts.map +0 -1
  78. package/dist/strategy-provisioning.js +0 -119
  79. package/dist/strategy-provisioning.js.map +0 -1
  80. package/dist/strategy-spawn-helpers.d.ts +0 -67
  81. package/dist/strategy-spawn-helpers.d.ts.map +0 -1
  82. package/dist/strategy-spawn-helpers.js +0 -160
  83. package/dist/strategy-spawn-helpers.js.map +0 -1
  84. package/dist/strategy-team-lifecycle.d.ts +0 -50
  85. package/dist/strategy-team-lifecycle.d.ts.map +0 -1
  86. package/dist/strategy-team-lifecycle.js +0 -256
  87. package/dist/strategy-team-lifecycle.js.map +0 -1
  88. package/dist/strategy-team-state.d.ts +0 -24
  89. package/dist/strategy-team-state.d.ts.map +0 -1
  90. package/dist/strategy-team-state.js +0 -43
  91. package/dist/strategy-team-state.js.map +0 -1
  92. package/dist/strategy-teardown.d.ts +0 -24
  93. package/dist/strategy-teardown.d.ts.map +0 -1
  94. package/dist/strategy-teardown.js +0 -158
  95. package/dist/strategy-teardown.js.map +0 -1
  96. package/dist/strategy-worktree-state.d.ts +0 -47
  97. package/dist/strategy-worktree-state.d.ts.map +0 -1
  98. package/dist/strategy-worktree-state.js +0 -104
  99. package/dist/strategy-worktree-state.js.map +0 -1
  100. package/dist/team-prompt-variants.d.ts +0 -17
  101. package/dist/team-prompt-variants.d.ts.map +0 -1
  102. package/dist/team-prompt-variants.js +0 -79
  103. package/dist/team-prompt-variants.js.map +0 -1
  104. package/dist/types/strategy.d.ts +0 -180
  105. package/dist/types/strategy.d.ts.map +0 -1
  106. package/dist/types/strategy.js +0 -5
  107. package/dist/types/strategy.js.map +0 -1
  108. package/dist/worktree-merge.d.ts +0 -23
  109. package/dist/worktree-merge.d.ts.map +0 -1
  110. package/dist/worktree-merge.js +0 -57
  111. package/dist/worktree-merge.js.map +0 -1
  112. package/dist/worktree-strategy.d.ts +0 -69
  113. package/dist/worktree-strategy.d.ts.map +0 -1
  114. package/dist/worktree-strategy.js +0 -214
  115. package/dist/worktree-strategy.js.map +0 -1
@@ -1,519 +0,0 @@
1
- /**
2
- * Strategy executor - manages Agent Team lifecycle per strategy.
3
- *
4
- * Replaces the per-delivery agent spawning model. When a strategy has
5
- * an assigned agent role and queued deliveries, the executor spawns
6
- * a single Agent Team (one lead agent process) scoped to the entire strategy.
7
- *
8
- * The lead agent:
9
- * 1. Reads all deliveries + issues for the strategy
10
- * 2. Builds a task DAG with dependencies
11
- * 3. Spawns worker teammates to execute issues in parallel
12
- * 4. Advances delivery stages as their issues complete
13
- * 5. Terminates when all work is done; fresh team spawned for new work
14
- *
15
- * This module is the orchestration entry point. Pure logic is extracted to:
16
- * - strategy-team-state.ts -- active teams map, config derivation
17
- * - strategy-merge.ts -- branch merge logic
18
- * - strategy-completion.ts -- post-execution completion handling
19
- * - strategy-spawn-helpers.ts -- log streams, stream handlers, process close
20
- * - strategy-team-lifecycle.ts -- terminate, wait, detect deactivated, merge checks
21
- * - strategy-completion-event.ts -- completion event handler
22
- */
23
- import { spawn } from 'node:child_process';
24
- import { mkdirSync, existsSync } from 'node:fs';
25
- import { createSession, updateSession, getActiveStrategies, } from './supabase.js';
26
- import { createWorktree, runGitSync, repoHasCommits } from './git.js';
27
- import { installAuditPreCommitHook } from './audit-hooks.js';
28
- import { getStrategyWorktree, setStrategyWorktree } from './strategy-worktree-state.js';
29
- import { withRetry, sendMessage, productLabel } from '@telora/daemon-core';
30
- import { recordActivity } from './heartbeat.js';
31
- import { buildStrategyTeamPrompt } from './strategy-prompt-builder.js';
32
- import { buildRoleFrameworkPrompt } from './team-prompt-base.js';
33
- import { getStrategyDeliveries, getStrategyIssues, getProductContextForStrategy, getProductDeploymentProfileSnapshot, fetchStrategyWorkflow } from './queries/strategies.js';
34
- import { buildSpawnEnvironment } from './spawn-environment.js';
35
- import { sanitizeGitSegment } from './git-utils.js';
36
- import { recordStrategyTeardown } from './spawn-cooldown.js';
37
- import { consumePendingSpawnDirective, assembleDirectiveContent } from './directive-executor.js';
38
- import { resolveAssemblyRecipe } from './assembly-engine.js';
39
- import './assembly-resolvers.js';
40
- import { isStatusAgentActionable, isStatusBlocking } from './stage-classifier.js';
41
- // ── Imports from extracted modules ──────────────────────────────────────
42
- import { getActiveTeams, deriveExecutionConfig, } from './strategy-team-state.js';
43
- import { setupTeamLogStreams, attachStreamHandlers, handleTeamProcessClose, } from './strategy-spawn-helpers.js';
44
- import { terminateTeam, } from './strategy-team-lifecycle.js';
45
- import { handleCompletionEvent, } from './strategy-completion-event.js';
46
- // ── Re-exports for backward compatibility ───────────────────────────────
47
- export { getActiveTeams, hasActiveTeam, getActiveTeamCount, } from './strategy-team-state.js';
48
- export { mergeStrategyBranch, } from './strategy-merge.js';
49
- export { handleTeamCompletion, advanceDeliveryStatuses, isStatusTerminal, isStatusAgentActionable, } from './strategy-completion.js';
50
- export { terminateTeam, waitForTeamExit, terminateAllTeams, detectDeactivatedStrategies, checkAndMergeCompletedDeliveries, } from './strategy-team-lifecycle.js';
51
- // ── Resource governor (optional, injected by StrategyEngine) ─────────
52
- let governor = null;
53
- /** Inject the resource governor for global concurrency limiting. */
54
- export function initGovernor(gov) {
55
- governor = gov;
56
- }
57
- /**
58
- * Pre-spawn guard: enforce rank-ordered execution.
59
- *
60
- * Walk deliveries in priority_rank order (already sorted by API).
61
- * A delivery is actionable only if all lower-ranked deliveries are non-blocking.
62
- *
63
- * Returns:
64
- * - 'planning' when the strategy has zero deliveries (agent will scope them).
65
- * - 'execute' with the filtered actionable deliveries when work is queued.
66
- * - 'skip' when a non-actionable blocking status holds at the front of the queue.
67
- */
68
- function findActionableDeliveries(deliveries, strategyName) {
69
- // Zero deliveries -- the team's first act is to scope them.
70
- if (deliveries.length === 0) {
71
- return { kind: 'planning' };
72
- }
73
- let nextActionable = null;
74
- for (const d of deliveries) {
75
- const status = d.executionStatus ?? '';
76
- if (!isStatusBlocking(status))
77
- continue;
78
- if (isStatusAgentActionable(status)) {
79
- nextActionable = d;
80
- }
81
- else {
82
- // Blocking status (planning, paused) prevents subsequent deliveries
83
- console.log(`[strategy-executor] Delivery "${d.name}" (rank ${d.priorityRank}) ` +
84
- `is in "${status}" state -- blocking subsequent deliveries in strategy "${strategyName}"`);
85
- }
86
- break;
87
- }
88
- if (!nextActionable || !isStatusAgentActionable(nextActionable.executionStatus ?? '')) {
89
- console.log(`[strategy-executor] No actionable deliveries for strategy "${strategyName}" -- skipping spawn`);
90
- return { kind: 'skip' };
91
- }
92
- return {
93
- kind: 'execute',
94
- deliveries: deliveries.filter(d => isStatusAgentActionable(d.executionStatus ?? '')),
95
- };
96
- }
97
- // ── Team spawning ────────────────────────────────────────────────────
98
- /**
99
- * Generate branch name for strategy-level work.
100
- */
101
- export function generateStrategyBranchName(role, strategyName, strategyId) {
102
- const sanitizedRoleName = sanitizeGitSegment(role.name);
103
- const shortId = strategyId.slice(0, 8);
104
- const sanitizedStrategyName = sanitizeGitSegment(strategyName);
105
- return `agent/${sanitizedRoleName}/${sanitizedStrategyName}-${shortId}`;
106
- }
107
- /**
108
- * Build Claude Code CLI arguments for the team lead.
109
- */
110
- function buildTeamLeadArgs(config, pipelineConfig, resumeSessionId) {
111
- const args = [];
112
- // --resume must come early, before --input-format stream-json
113
- if (resumeSessionId) {
114
- args.push('--resume', resumeSessionId);
115
- }
116
- args.push('--dangerously-skip-permissions');
117
- args.push('--setting-sources', 'project,local');
118
- args.push('--input-format', 'stream-json');
119
- args.push('--output-format', 'stream-json');
120
- args.push('--verbose');
121
- // Enable in-process teammate mode for the team lead
122
- args.push('--teammate-mode', 'in-process');
123
- // Honour pipeline config model override
124
- const model = pipelineConfig?.model;
125
- if (model) {
126
- args.push('--model', model);
127
- }
128
- return args;
129
- }
130
- /**
131
- * Spawn a strategy team to execute all deliveries in a strategy.
132
- *
133
- * Creates a single Agent Team (lead process) that reads all deliveries
134
- * and issues, builds a task DAG, and coordinates worker execution.
135
- */
136
- export async function spawnStrategyTeam(params) {
137
- const { config, strategyId, strategyName, role, pipelineConfig, readOnly = false, lastClaudeSessionId } = params;
138
- const activeTeams = getActiveTeams();
139
- // Prevent double-spawn
140
- if (activeTeams.has(strategyId)) {
141
- console.warn(`[strategy-executor] Team already active for strategy "${strategyName}", skipping spawn`);
142
- return;
143
- }
144
- const executionConfig = deriveExecutionConfig(pipelineConfig);
145
- const branchName = generateStrategyBranchName(role, strategyName, strategyId);
146
- // Initialize team state
147
- const teamState = {
148
- strategyId,
149
- strategyName,
150
- roleId: role.id,
151
- roleName: role.name,
152
- organizationId: config.organizationId,
153
- productId: config.productId,
154
- executionConfig,
155
- pipelineConfig,
156
- startedAt: new Date(),
157
- phase: 'initializing',
158
- knownDeliveryIds: new Set(),
159
- mergedDeliveryIds: new Set(),
160
- planningPhase: false,
161
- shutdownReason: null,
162
- deliveryStageIds: new Map(),
163
- leadSessionId: null,
164
- leadPid: null,
165
- leadStdin: null,
166
- branchName,
167
- worktreePath: null,
168
- resolvingMergeConflict: false,
169
- readOnly,
170
- completionDetector: null,
171
- claudeSessionId: null,
172
- };
173
- activeTeams.set(strategyId, teamState);
174
- const currentProduct = config.products.find(p => p.id === config.productId);
175
- const productTag = config.products.length > 1 && currentProduct ? ` [${productLabel(currentProduct)}]` : '';
176
- console.log(`[strategy-executor] Spawning team for strategy "${strategyName}"${readOnly ? ' [READ-ONLY]' : ''}${productTag}`);
177
- console.log(` Role: ${role.name}`);
178
- console.log(` Model: ${pipelineConfig?.model ?? '(CLI default)'}`);
179
- console.log(` Max workers: ${executionConfig.maxWorkers}`);
180
- console.log(` Branch: ${branchName}`);
181
- if (config.products.length > 1) {
182
- console.log(` Product: ${currentProduct ? productLabel(currentProduct) : config.productId.slice(0, 8)}`);
183
- console.log(` Repo: ${config.repoPath}`);
184
- }
185
- // Fetch all deliveries, issues, product context, deployment profile, and loop context
186
- let deliveries;
187
- let issues;
188
- let productContextDocs;
189
- let deploymentProfileSnapshot;
190
- let loopContext;
191
- try {
192
- [deliveries, issues, productContextDocs, deploymentProfileSnapshot, loopContext] = await Promise.all([
193
- getStrategyDeliveries(strategyId),
194
- getStrategyIssues(strategyId),
195
- getProductContextForStrategy(config.productId, strategyId),
196
- getProductDeploymentProfileSnapshot(config.productId).catch((err) => {
197
- console.debug(`[strategy-executor] Could not fetch deployment profile snapshot (non-fatal):`, err.message);
198
- return null;
199
- }),
200
- (async () => {
201
- try {
202
- const assemblyCtx = {
203
- strategyId,
204
- deliveryIds: [],
205
- worktreePath: null,
206
- config,
207
- organizationId: config.organizationId,
208
- productId: config.productId,
209
- };
210
- return await resolveAssemblyRecipe(['loop.context', 'strategy.injections'], assemblyCtx);
211
- }
212
- catch (err) {
213
- console.debug(`[strategy-executor] Could not fetch loop context (non-fatal):`, err.message);
214
- return '';
215
- }
216
- })(),
217
- ]);
218
- }
219
- catch (err) {
220
- console.error(`[strategy-executor] Failed to fetch context for strategy "${strategyName}":`, err.message);
221
- activeTeams.delete(strategyId);
222
- return;
223
- }
224
- // Check for pending spawn directive (e.g., review stage spawn)
225
- const pendingDirective = consumePendingSpawnDirective(strategyId);
226
- // Pre-spawn guard: enforce rank-ordered execution.
227
- // Skip when a pending spawn directive exists -- the directive has its own intent.
228
- let actionableDeliveries = [];
229
- let isPlanningSpawn = false;
230
- if (pendingDirective) {
231
- actionableDeliveries = deliveries.filter(d => isStatusAgentActionable(d.executionStatus ?? ''));
232
- }
233
- else {
234
- const decision = findActionableDeliveries(deliveries, strategyName);
235
- if (decision.kind === 'skip') {
236
- activeTeams.delete(strategyId);
237
- return;
238
- }
239
- if (decision.kind === 'planning') {
240
- isPlanningSpawn = true;
241
- teamState.planningPhase = true;
242
- console.log(`[strategy-executor] Strategy "${strategyName}" has no deliveries -- spawning planning team`);
243
- }
244
- else {
245
- actionableDeliveries = decision.deliveries;
246
- }
247
- }
248
- // Track known deliveries, pre-populate already-completed ones.
249
- // Empty deliveries (planning spawn) yields zero iterations: knownDeliveryIds
250
- // stays empty until the wake-cycle refresh in handleCompletionEvent picks
251
- // up MCP-written deliveries, at which point planningPhase is cleared.
252
- for (const d of deliveries) {
253
- teamState.knownDeliveryIds.add(d.id);
254
- teamState.deliveryStageIds.set(d.id, d.currentWorkflowStageId);
255
- if (!isStatusAgentActionable(d.executionStatus ?? '') && !isStatusBlocking(d.executionStatus ?? '')) {
256
- teamState.mergedDeliveryIds.add(d.id);
257
- }
258
- }
259
- if (isPlanningSpawn) {
260
- console.log(` Deliveries: 0 (planning required)`);
261
- }
262
- else {
263
- console.log(` Deliveries: ${deliveries.length} (${actionableDeliveries.length} queued)`);
264
- }
265
- console.log(` Issues: ${issues.length}`);
266
- // Ensure log directory exists
267
- if (!existsSync(config.logDir)) {
268
- mkdirSync(config.logDir, { recursive: true, mode: 0o700 });
269
- }
270
- // Reuse persistent strategy worktree (created by ensureStrategyWorktrees in poll loop)
271
- let worktreePath;
272
- const existingWorktree = getStrategyWorktree(strategyId);
273
- if (existingWorktree) {
274
- worktreePath = existingWorktree.worktreePath;
275
- // Rebase onto integration to pick up latest changes from other strategies
276
- const rebaseResult = runGitSync(['rebase', config.integrationBranch], worktreePath);
277
- if (!rebaseResult.success) {
278
- runGitSync(['rebase', '--abort'], worktreePath);
279
- console.warn(`[strategy-executor] Rebase failed for "${strategyName}", continuing with existing state`);
280
- }
281
- console.log(` Worktree (reused): ${worktreePath}`);
282
- }
283
- else {
284
- // Guard: can't create worktrees in a repo with no commits
285
- if (!repoHasCommits(config.repoPath)) {
286
- console.warn(`[strategy-executor] Repository has no commits -- cannot create worktree for "${strategyName}"`);
287
- activeTeams.delete(strategyId);
288
- recordStrategyTeardown(strategyId);
289
- return;
290
- }
291
- // Fallback: worktree doesn't exist yet (race condition or first poll)
292
- console.warn(`[strategy-executor] No persistent worktree for "${strategyName}", creating inline`);
293
- try {
294
- worktreePath = await createWorktree(config, branchName);
295
- setStrategyWorktree(strategyId, {
296
- strategyId,
297
- strategyName,
298
- worktreePath,
299
- branchName,
300
- createdAt: new Date(),
301
- hasQaDevServer: false,
302
- });
303
- console.log(` Worktree (created inline): ${worktreePath}`);
304
- // Install audit pre-commit hook for read-only strategies
305
- if (readOnly) {
306
- installAuditPreCommitHook(worktreePath);
307
- console.log(` Installed audit pre-commit hook (read-only mode)`);
308
- }
309
- }
310
- catch (err) {
311
- console.error(`[strategy-executor] Failed to create worktree for strategy "${strategyName}":`, err instanceof Error ? err.message : String(err));
312
- activeTeams.delete(strategyId);
313
- recordStrategyTeardown(strategyId);
314
- return;
315
- }
316
- }
317
- teamState.worktreePath = worktreePath;
318
- // Create session record for the team lead
319
- let session;
320
- try {
321
- session = await createSession({
322
- organizationId: config.organizationId,
323
- roleId: role.id,
324
- issueId: null,
325
- strategyId,
326
- branchName,
327
- sessionType: pendingDirective?.sessionType ?? 'coding',
328
- });
329
- teamState.leadSessionId = session.id;
330
- }
331
- catch (err) {
332
- console.error(`[strategy-executor] Failed to create session for strategy "${strategyName}":`, err.message);
333
- // Worktree is strategy-owned and persists even if session creation fails
334
- activeTeams.delete(strategyId);
335
- return;
336
- }
337
- recordActivity();
338
- // Build the team lead prompt.
339
- // Priority: pending spawn directive > current stage directive > legacy full prompt.
340
- // When a directive exists, compose: role framework + assembled directive content.
341
- // This ensures the workflow stage controls what the agent does.
342
- const promptContext = {
343
- strategyId,
344
- strategyName,
345
- organizationId: config.organizationId,
346
- productId: config.productId,
347
- deliveries,
348
- issues,
349
- executionConfig,
350
- pipelineConfig,
351
- productContextDocs,
352
- deploymentProfileSnapshot,
353
- readOnly,
354
- loopContext,
355
- };
356
- let prompt;
357
- let directiveModel = null;
358
- if (pendingDirective && pendingDirective.message.trim()) {
359
- // Spawn directive from directive-executor (e.g., review stage transition)
360
- prompt = buildRoleFrameworkPrompt(role, promptContext)
361
- + '\n\n'
362
- + pendingDirective.message;
363
- directiveModel = pendingDirective.model;
364
- console.log(`[strategy-executor] Using pending spawn directive for "${strategyName}" ` +
365
- `(${pendingDirective.message.length} chars directive, model: ${directiveModel ?? 'default'})`);
366
- }
367
- else {
368
- // No pending directive -- check if the current stage has a directive in the DB.
369
- // This handles the common case: initial spawn into "building" stage.
370
- let stageDirectiveContent = null;
371
- let stageDirectiveModel = null;
372
- try {
373
- const workflow = await fetchStrategyWorkflow(strategyId);
374
- // Find the strategy's current workflow stage. Query getActiveStrategies to
375
- // get the current_workflow_stage_id, then match against the workflow stages.
376
- const activeStrategies = await getActiveStrategies(config.organizationId, config.productId);
377
- const strategyRecord = activeStrategies.find(s => s.strategy_id === strategyId);
378
- const currentStageId = strategyRecord?.current_workflow_stage_id;
379
- const currentStage = currentStageId
380
- ? workflow.stages.find(s => s.id === currentStageId)
381
- : workflow.stages.find(s => s.name === 'building'); // fallback
382
- if (currentStage?.agentDirective) {
383
- const directiveContent = await assembleDirectiveContent(config, strategyId, currentStage.agentDirective, worktreePath);
384
- if (directiveContent.trim()) {
385
- stageDirectiveContent = directiveContent;
386
- stageDirectiveModel = currentStage.agentDirective.model;
387
- }
388
- }
389
- }
390
- catch (err) {
391
- console.debug(`[strategy-executor] Could not fetch stage directive for "${strategyName}" (falling back to legacy prompt):`, err.message);
392
- }
393
- if (stageDirectiveContent) {
394
- prompt = buildRoleFrameworkPrompt(role, promptContext)
395
- + '\n\n'
396
- + stageDirectiveContent;
397
- directiveModel = stageDirectiveModel;
398
- console.log(`[strategy-executor] Using stage directive for "${strategyName}" (${stageDirectiveContent.length} chars)`);
399
- }
400
- else {
401
- // Legacy fallback: full hardcoded prompt
402
- prompt = buildStrategyTeamPrompt(role, promptContext);
403
- }
404
- }
405
- // Set up log file streams
406
- const logs = setupTeamLogStreams(config.logDir, branchName, strategyName);
407
- // Build args and env
408
- // Never resume when spawning for a directive (fresh session)
409
- const resumeId = (pendingDirective || directiveModel) ? null : (lastClaudeSessionId ?? null);
410
- // If a directive specifies a model override, use it
411
- const effectivePipelineConfig = directiveModel
412
- ? { ...pipelineConfig, model: directiveModel }
413
- : pipelineConfig;
414
- const args = buildTeamLeadArgs(config, effectivePipelineConfig, resumeId);
415
- if (resumeId) {
416
- console.log(`[strategy-executor] Resuming Claude session ${resumeId} for "${strategyName}"`);
417
- }
418
- const spawnEnv = buildSpawnEnvironment(config, {
419
- orgId: config.organizationId,
420
- strategyId,
421
- sessionId: session.id,
422
- });
423
- // Update session to starting
424
- await updateSession(session.id, {
425
- status: 'starting',
426
- started_at: new Date().toISOString(),
427
- stdout_path: logs.stdoutPath,
428
- stderr_path: logs.stderrPath,
429
- });
430
- // Acquire governor slot (if governor is configured)
431
- if (governor) {
432
- try {
433
- await governor.acquireSlot('strategy');
434
- }
435
- catch (err) {
436
- console.warn(`[strategy-executor] Governor denied slot for "${strategyName}":`, err.message);
437
- // Mark session as failed so it doesn't linger in `starting` status
438
- await updateSession(session.id, {
439
- status: 'failed',
440
- exit_reason: 'Governor denied slot',
441
- exit_category: 'governor_denied',
442
- ended_at: new Date().toISOString(),
443
- }).catch(updateErr => {
444
- console.warn(`[strategy-executor] Failed to update session after governor denial:`, updateErr.message);
445
- });
446
- activeTeams.delete(strategyId);
447
- return;
448
- }
449
- }
450
- // Spawn the team lead process
451
- const proc = spawn(config.claudeCodePath, args, {
452
- cwd: worktreePath,
453
- env: spawnEnv,
454
- stdio: ['pipe', 'pipe', 'pipe'],
455
- });
456
- teamState.leadPid = proc.pid ?? null;
457
- teamState.leadStdin = proc.stdin;
458
- teamState.phase = 'executing';
459
- // Attach stream parser, completion detector, activity tracker, event handlers
460
- const { completionDetector, activityTracker } = attachStreamHandlers({
461
- proc, teamState, strategyId, strategyName, sessionId: session.id, logs,
462
- });
463
- // Send prompt via stdin (single message -- directive content is already composed in)
464
- sendMessage(proc.stdin, prompt);
465
- // Update session to running
466
- await updateSession(session.id, {
467
- status: 'running',
468
- pid: proc.pid,
469
- });
470
- console.log(`[strategy-executor] Team lead spawned for "${strategyName}" (PID: ${proc.pid}, session: ${session.id})`);
471
- // Handle completion -- check for more work or terminate.
472
- // No idle phase: if actionable work remains, send it immediately (mid-strategy
473
- // handoff). If all work is done, terminate. A fresh team is spawned if new
474
- // deliveries arrive later (~$0.50-1.00 exploration cost, but clean context).
475
- completionDetector.on('complete', (info) => {
476
- console.log(`[strategy-executor] Team lead for "${strategyName}" completed work cycle: ` +
477
- `${info.turnCount} turns, $${info.totalCostUsd.toFixed(4)}`);
478
- handleCompletionEvent({ strategyId, strategyName, teamState, completionDetector, proc, completionInfo: info }).catch(err => {
479
- console.warn(`[strategy-executor] Failed to check delivery state for "${strategyName}":`, err.message);
480
- // Fallback: terminate to avoid idle money burn.
481
- terminateTeam(strategyId);
482
- });
483
- });
484
- // Handle process exit
485
- const spawnedAt = Date.now();
486
- proc.on('close', (code, signal) => {
487
- handleTeamProcessClose({
488
- code, signal, strategyName, strategyId, resumeId, spawnedAt,
489
- teamState, sessionId: session.id, config, completionDetector,
490
- activityTracker, logs, params, governor, spawnStrategyTeam,
491
- }).catch(err => {
492
- console.error(`[strategy-executor] handleTeamProcessClose failed for "${strategyName}":`, err.message);
493
- });
494
- });
495
- proc.on('error', async (err) => {
496
- console.error(`[strategy-executor] Team lead for "${strategyName}" error:`, err.message);
497
- // Release governor slot (if governor is configured)
498
- governor?.releaseSlot('strategy');
499
- try {
500
- await withRetry(() => updateSession(session.id, {
501
- status: 'failed',
502
- exit_reason: `Process error: ${err.message}`,
503
- exit_category: 'error',
504
- ended_at: new Date().toISOString(),
505
- }), { maxAttempts: 3, baseDelayMs: 1000, label: 'session-update-error' });
506
- }
507
- catch (updateErr) {
508
- console.warn(`[strategy-executor] Failed to update session after retries:`, updateErr.message);
509
- }
510
- completionDetector.destroy();
511
- logs.stdoutLogStream.end();
512
- logs.stderrStream.end();
513
- logs.jsonlStream.end();
514
- // Worktree is strategy-owned — do not remove on team error
515
- teamState.phase = 'terminated';
516
- activeTeams.delete(strategyId);
517
- });
518
- }
519
- //# sourceMappingURL=strategy-executor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-executor.js","sourceRoot":"","sources":["../src/strategy-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAOhD,OAAO,EACL,aAAa,EACb,aAAa,EACb,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAA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K,EAAE,sBAAsB,EAAE,CACrE,CAAC;QACJ,CAAC;QAAC,OAAO,SAAS,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,6DAA6D,EAAG,SAAmB,CAAC,OAAO,CAAC,CAAC;QAC5G,CAAC;QAED,kBAAkB,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;QAEvB,2DAA2D;QAC3D,SAAS,CAAC,KAAK,GAAG,YAAY,CAAC;QAC/B,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,61 +0,0 @@
1
- /**
2
- * Strategy lifecycle management.
3
- *
4
- * Handles persistent worktree provisioning for active strategies and
5
- * coordinated teardown when strategies are deactivated. Replaces the
6
- * separate detectDeactivatedStrategies() and checkQaForDeactivatedStrategies()
7
- * flows with a single unified lifecycle.
8
- */
9
- import type { DaemonConfig, AgentRole } from './types.js';
10
- /**
11
- * Ensure persistent worktrees exist for all active strategies.
12
- *
13
- * Called each poll cycle BEFORE processReadyStrategies(). Creates
14
- * worktrees for active strategies that don't have one yet.
15
- * Syncs integration with main once per cycle (not per strategy).
16
- */
17
- export declare function ensureStrategyWorktrees(config: DaemonConfig, roles: Map<string, AgentRole>): Promise<void>;
18
- /**
19
- * Tear down a single strategy: stop QA, terminate team, remove worktree.
20
- *
21
- * Each step is independently try/caught so a failure in one
22
- * does not prevent the others from running.
23
- */
24
- export declare function teardownStrategy(config: DaemonConfig, strategyId: string, strategyName: string): Promise<void>;
25
- /**
26
- * Detect deactivated strategies and tear them down.
27
- *
28
- * Replaces both detectDeactivatedStrategies() from strategy-executor.ts
29
- * and checkQaForDeactivatedStrategies() from qa-orchestrator.ts.
30
- * A single pass handles both team termination and QA cleanup.
31
- */
32
- export declare function checkForDeactivatedStrategies(config: DaemonConfig): Promise<void>;
33
- /**
34
- * Rebuild the strategy-worktree-state after a daemon restart.
35
- *
36
- * Two-phase approach:
37
- * Phase 1 (DB-first): If hydrateFromDb() populated the Map, validate
38
- * each entry against disk and enrich with strategy names. Removes
39
- * stale entries (worktree deleted from disk) and cleans up entries
40
- * for deactivated strategies.
41
- * Phase 2 (disk fallback): Scans for agent-* directories NOT already
42
- * in the Map. Covers first-run after migration and manually created
43
- * worktrees. Matches by ID prefix against active strategies.
44
- *
45
- * Also removes legacy qa-* directories from the pre-persistent worktree era.
46
- *
47
- * Must run AFTER hydrateFromDb() and crash recovery but BEFORE startListeners().
48
- */
49
- export declare function rebuildStrategyWorktreeState(config: DaemonConfig): Promise<void>;
50
- /**
51
- * Reconcile git state for active strategy worktrees after startup.
52
- *
53
- * Checks all rebuilt strategy worktrees and re-reports `worktree_active`
54
- * for deliveries in coding/queued status. This ensures the DB reflects
55
- * accurate git state even if previous reportGitState calls were lost
56
- * (network blip, circuit breaker, daemon crash).
57
- *
58
- * Must run AFTER rebuildStrategyWorktreeState().
59
- */
60
- export declare function reconcileGitState(_config: DaemonConfig): Promise<void>;
61
- //# sourceMappingURL=strategy-lifecycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-lifecycle.d.ts","sourceRoot":"","sources":["../src/strategy-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAuB1D;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CA4Gf;AAID;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAqGf;AAED;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CA0Df;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CA4Lf;AAID;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAiCf"}