@telora/daemon 0.15.3 → 0.15.4

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 (98) 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-executor.d.ts.map +1 -1
  7. package/dist/focus-executor.js +30 -13
  8. package/dist/focus-executor.js.map +1 -1
  9. package/dist/focus-phase.d.ts +22 -0
  10. package/dist/focus-phase.d.ts.map +1 -0
  11. package/dist/focus-phase.js +54 -0
  12. package/dist/focus-phase.js.map +1 -0
  13. package/dist/index.js +0 -0
  14. package/dist/queries/focuses.d.ts +3 -0
  15. package/dist/queries/focuses.d.ts.map +1 -1
  16. package/dist/queries/focuses.js +8 -0
  17. package/dist/queries/focuses.js.map +1 -1
  18. package/package.json +2 -2
  19. package/dist/listener-review.d.ts +0 -37
  20. package/dist/listener-review.d.ts.map +0 -1
  21. package/dist/listener-review.js +0 -217
  22. package/dist/listener-review.js.map +0 -1
  23. package/dist/queries/strategies.d.ts +0 -97
  24. package/dist/queries/strategies.d.ts.map +0 -1
  25. package/dist/queries/strategies.js +0 -136
  26. package/dist/queries/strategies.js.map +0 -1
  27. package/dist/review-spawner.d.ts +0 -32
  28. package/dist/review-spawner.d.ts.map +0 -1
  29. package/dist/review-spawner.js +0 -170
  30. package/dist/review-spawner.js.map +0 -1
  31. package/dist/strategy-completion-event.d.ts +0 -63
  32. package/dist/strategy-completion-event.d.ts.map +0 -1
  33. package/dist/strategy-completion-event.js +0 -138
  34. package/dist/strategy-completion-event.js.map +0 -1
  35. package/dist/strategy-completion.d.ts +0 -85
  36. package/dist/strategy-completion.d.ts.map +0 -1
  37. package/dist/strategy-completion.js +0 -459
  38. package/dist/strategy-completion.js.map +0 -1
  39. package/dist/strategy-engine.d.ts +0 -47
  40. package/dist/strategy-engine.d.ts.map +0 -1
  41. package/dist/strategy-engine.js +0 -421
  42. package/dist/strategy-engine.js.map +0 -1
  43. package/dist/strategy-executor.d.ts +0 -55
  44. package/dist/strategy-executor.d.ts.map +0 -1
  45. package/dist/strategy-executor.js +0 -519
  46. package/dist/strategy-executor.js.map +0 -1
  47. package/dist/strategy-lifecycle.d.ts +0 -61
  48. package/dist/strategy-lifecycle.d.ts.map +0 -1
  49. package/dist/strategy-lifecycle.js +0 -544
  50. package/dist/strategy-lifecycle.js.map +0 -1
  51. package/dist/strategy-merge.d.ts +0 -77
  52. package/dist/strategy-merge.d.ts.map +0 -1
  53. package/dist/strategy-merge.js +0 -378
  54. package/dist/strategy-merge.js.map +0 -1
  55. package/dist/strategy-prompt-builder.d.ts +0 -24
  56. package/dist/strategy-prompt-builder.d.ts.map +0 -1
  57. package/dist/strategy-prompt-builder.js +0 -87
  58. package/dist/strategy-prompt-builder.js.map +0 -1
  59. package/dist/strategy-provisioning.d.ts +0 -16
  60. package/dist/strategy-provisioning.d.ts.map +0 -1
  61. package/dist/strategy-provisioning.js +0 -119
  62. package/dist/strategy-provisioning.js.map +0 -1
  63. package/dist/strategy-spawn-helpers.d.ts +0 -67
  64. package/dist/strategy-spawn-helpers.d.ts.map +0 -1
  65. package/dist/strategy-spawn-helpers.js +0 -160
  66. package/dist/strategy-spawn-helpers.js.map +0 -1
  67. package/dist/strategy-team-lifecycle.d.ts +0 -50
  68. package/dist/strategy-team-lifecycle.d.ts.map +0 -1
  69. package/dist/strategy-team-lifecycle.js +0 -256
  70. package/dist/strategy-team-lifecycle.js.map +0 -1
  71. package/dist/strategy-team-state.d.ts +0 -24
  72. package/dist/strategy-team-state.d.ts.map +0 -1
  73. package/dist/strategy-team-state.js +0 -43
  74. package/dist/strategy-team-state.js.map +0 -1
  75. package/dist/strategy-teardown.d.ts +0 -24
  76. package/dist/strategy-teardown.d.ts.map +0 -1
  77. package/dist/strategy-teardown.js +0 -158
  78. package/dist/strategy-teardown.js.map +0 -1
  79. package/dist/strategy-worktree-state.d.ts +0 -47
  80. package/dist/strategy-worktree-state.d.ts.map +0 -1
  81. package/dist/strategy-worktree-state.js +0 -104
  82. package/dist/strategy-worktree-state.js.map +0 -1
  83. package/dist/team-prompt-variants.d.ts +0 -17
  84. package/dist/team-prompt-variants.d.ts.map +0 -1
  85. package/dist/team-prompt-variants.js +0 -79
  86. package/dist/team-prompt-variants.js.map +0 -1
  87. package/dist/types/strategy.d.ts +0 -180
  88. package/dist/types/strategy.d.ts.map +0 -1
  89. package/dist/types/strategy.js +0 -5
  90. package/dist/types/strategy.js.map +0 -1
  91. package/dist/worktree-merge.d.ts +0 -23
  92. package/dist/worktree-merge.d.ts.map +0 -1
  93. package/dist/worktree-merge.js +0 -57
  94. package/dist/worktree-merge.js.map +0 -1
  95. package/dist/worktree-strategy.d.ts +0 -69
  96. package/dist/worktree-strategy.d.ts.map +0 -1
  97. package/dist/worktree-strategy.js +0 -214
  98. package/dist/worktree-strategy.js.map +0 -1
@@ -1,170 +0,0 @@
1
- /**
2
- * Review spawner.
3
- *
4
- * First-class review handling in the poll loop. Detects strategies
5
- * in `in_review` status and spawns a review team directly -- no
6
- * directive executor, no pending spawn directives, no special seeding.
7
- *
8
- * The review team examines diffs against acceptance criteria and creates
9
- * issues on specific deliveries where it finds gaps. When the team exits,
10
- * the exit handler moves the strategy back to verify. The existing
11
- * checkVerifyDeliveriesForOpenIssues poll handles delivery-level routing
12
- * to iterating.
13
- */
14
- import { getActiveStrategies, updateDeliveryStatus } from './queries/deliveries.js';
15
- import { getStrategyDeliveries } from './queries/strategies.js';
16
- import { fetchEffectiveWorkflow } from './queries/workflows.js';
17
- import { resolveAssemblyRecipe } from './assembly-engine.js';
18
- // Ensure resolvers are registered
19
- import './assembly-resolvers.js';
20
- import { hasActiveTeam, getActiveTeamCount } from './strategy-executor.js';
21
- import { spawnStrategyTeam } from './team-spawner.js';
22
- import { isInSpawnCooldown } from './spawn-cooldown.js';
23
- import { configForProduct } from './config.js';
24
- /**
25
- * Assembly recipe for review context.
26
- * Gathers acceptance criteria, the git diff, and delivery descriptions.
27
- */
28
- const REVIEW_ASSEMBLY_RECIPE = [
29
- 'delivery.acceptance_criteria',
30
- 'delivery.description',
31
- 'delivery.listing',
32
- 'git.diff_against_base',
33
- ];
34
- /**
35
- * Build the review prompt that gets sent to the review team after the
36
- * standard strategy prompt.
37
- */
38
- async function buildReviewMessage(config, strategyId, worktreePath) {
39
- const deliveries = await getStrategyDeliveries(strategyId);
40
- const assemblyContext = {
41
- strategyId,
42
- deliveryIds: deliveries.map(d => d.id),
43
- worktreePath,
44
- config,
45
- organizationId: config.organizationId,
46
- productId: config.productId,
47
- };
48
- let assembledContext = '';
49
- try {
50
- assembledContext = await resolveAssemblyRecipe(REVIEW_ASSEMBLY_RECIPE, assemblyContext);
51
- }
52
- catch (err) {
53
- console.warn(`[review-spawner] Assembly failed for strategy ${strategyId.slice(0, 8)}: ${err.message}`);
54
- }
55
- const prompt = `# Review Directive
56
-
57
- You are reviewing this strategy's deliveries. Your job is to examine the code changes (git diff) against the acceptance criteria for each delivery and identify any gaps.
58
-
59
- ## Instructions
60
-
61
- 1. Read the acceptance criteria and delivery descriptions above carefully.
62
- 2. Examine the git diff to understand what was actually built.
63
- 3. For each delivery, compare what was built against what was specified.
64
- 4. If you find gaps -- missing functionality, incomplete implementation, or deviations from acceptance criteria -- create issues on the specific delivery where the gap exists using \`telora_product_issue_create\`.
65
- 5. If a delivery fully meets its acceptance criteria, do nothing for that delivery.
66
- 6. When you are done reviewing all deliveries, exit cleanly.
67
-
68
- ## Issue Creation Guidelines
69
-
70
- - Create issues as type "Task" with status "To Do"
71
- - Be specific: describe exactly what is missing or incomplete
72
- - Reference the acceptance criterion that is not met
73
- - One issue per distinct gap (don't bundle unrelated gaps)
74
- - Do NOT create issues for style preferences or nice-to-haves -- only for acceptance criteria gaps
75
-
76
- ## Important
77
-
78
- - Do NOT modify any code. This is a review, not a fix.
79
- - Do NOT change delivery or strategy statuses.
80
- - Do NOT create new deliveries.
81
- - Focus only on acceptance criteria gaps in the actual code changes.`;
82
- const parts = [];
83
- if (assembledContext.trim()) {
84
- parts.push(assembledContext);
85
- }
86
- parts.push(prompt);
87
- return parts.join('\n\n');
88
- }
89
- // Store pending review messages for strategies that need a review team spawned.
90
- // Keyed by strategyId. Consumed by spawnStrategyTeam via consumePendingReviewMessage.
91
- const pendingReviewMessages = new Map();
92
- /**
93
- * Consume a pending review message for a strategy.
94
- * Returns the message and removes it from the map.
95
- */
96
- export function consumePendingReviewMessage(strategyId) {
97
- const message = pendingReviewMessages.get(strategyId);
98
- if (message) {
99
- pendingReviewMessages.delete(strategyId);
100
- }
101
- return message;
102
- }
103
- /**
104
- * Check if a strategy has a pending review message.
105
- */
106
- export function hasPendingReview(strategyId) {
107
- return pendingReviewMessages.has(strategyId);
108
- }
109
- /**
110
- * Detect strategies in `in_review` status and spawn review teams.
111
- *
112
- * Called from the daemon poll loop. For each in_review strategy without
113
- * an active team, assembles the review prompt and spawns a review team.
114
- */
115
- export async function processReviewStrategies(config, roles) {
116
- for (const product of config.products) {
117
- const pc = configForProduct(config, product);
118
- try {
119
- const strategies = await getActiveStrategies(pc.organizationId, product.id);
120
- for (const strategy of strategies) {
121
- if (strategy.status !== 'in_review')
122
- continue;
123
- if (hasActiveTeam(strategy.strategy_id))
124
- continue;
125
- if (isInSpawnCooldown(strategy.strategy_id))
126
- continue;
127
- if (!strategy.assigned_agent_role_id)
128
- continue;
129
- if (getActiveTeamCount() >= config.maxTotalSessions)
130
- break;
131
- const role = roles.get(strategy.assigned_agent_role_id);
132
- if (!role)
133
- continue;
134
- // Move verify deliveries to in_review so the completion detector
135
- // doesn't kill the review team (in_review is not a terminal status).
136
- console.log(`[review-spawner] Preparing review for "${strategy.strategy_name}"`);
137
- const deliveries = await getStrategyDeliveries(strategy.strategy_id);
138
- for (const d of deliveries) {
139
- if (d.executionStatus === 'verify') {
140
- try {
141
- const workflow = await fetchEffectiveWorkflow(d.id);
142
- const inReviewStage = workflow.stages.find(s => s.name === 'in_review');
143
- await updateDeliveryStatus(d.id, 'in_review', inReviewStage?.id ?? null);
144
- console.log(`[review-spawner] Delivery "${d.name}" moved to in_review`);
145
- }
146
- catch (err) {
147
- console.warn(`[review-spawner] Failed to move delivery "${d.name}" to in_review: ${err.message}`);
148
- }
149
- }
150
- }
151
- // Build the review message before spawning so it's ready when the team starts
152
- const reviewMessage = await buildReviewMessage(pc, strategy.strategy_id, null);
153
- pendingReviewMessages.set(strategy.strategy_id, reviewMessage);
154
- await spawnStrategyTeam({
155
- config: pc,
156
- strategyId: strategy.strategy_id,
157
- strategyName: strategy.strategy_name,
158
- role,
159
- pipelineConfig: strategy.pipeline_config,
160
- readOnly: strategy.read_only,
161
- lastClaudeSessionId: null,
162
- });
163
- }
164
- }
165
- catch (err) {
166
- console.warn(`[review-spawner] Failed to process review strategies for product ${product.id}: ${err.message}`);
167
- }
168
- }
169
- }
170
- //# sourceMappingURL=review-spawner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"review-spawner.js","sourceRoot":"","sources":["../src/review-spawner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAwB,MAAM,sBAAsB,CAAC;AACnF,kCAAkC;AAClC,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;GA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;oBAC5B,mBAAmB,EAAE,IAAI;iBAC1B,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CACV,oEAAoE,OAAO,CAAC,EAAE,KAAM,GAAa,CAAC,OAAO,EAAE,CAC5G,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,63 +0,0 @@
1
- /**
2
- * Strategy completion event handler - reacts to CompletionDetector events.
3
- *
4
- * Extracted from strategy-executor.ts. Handles the decision logic when a
5
- * team lead completes a work cycle: terminate if done, send more work, or
6
- * (for planning teams) refresh from MCP-written deliveries / escalate.
7
- */
8
- import type { ChildProcess } from 'node:child_process';
9
- import type { StrategyTeamState, StrategyDeliveryInfo, StrategyIssueInfo } from './types.js';
10
- import { CompletionDetector, type CompletionInfo } from './completion-detector.js';
11
- /** Reason string emitted when a planning team produces no deliveries. */
12
- export declare const PLANNING_NO_DELIVERIES_REASON = "planning produced no deliveries";
13
- export interface CompletionEventContext {
14
- strategyId: string;
15
- strategyName: string;
16
- teamState: StrategyTeamState;
17
- completionDetector: CompletionDetector;
18
- proc: ChildProcess;
19
- completionInfo: CompletionInfo;
20
- }
21
- /**
22
- * Injectable dependencies. Defaults to the real implementations; tests can
23
- * override them to assert behavior without spinning up Supabase/MCP.
24
- */
25
- export interface CompletionEventDeps {
26
- getStrategyDeliveries: (strategyId: string) => Promise<StrategyDeliveryInfo[]>;
27
- getStrategyIssues: (strategyId: string) => Promise<StrategyIssueInfo[]>;
28
- createEscalation: (params: {
29
- organizationId: string;
30
- sessionId: string;
31
- issueId: string | null;
32
- reasonType: string;
33
- description: string;
34
- whatWasTried?: string;
35
- helpNeeded?: string;
36
- }) => Promise<void>;
37
- terminateTeam: (strategyId: string) => boolean;
38
- }
39
- /**
40
- * Escalate when a planning team finishes its initial turn without writing
41
- * any deliveries via MCP. The team is then terminated -- no respawn.
42
- *
43
- * Exported so tests and sister deliveries can verify the contract.
44
- */
45
- export declare function escalatePlanningFailure(params: {
46
- organizationId: string;
47
- sessionId: string;
48
- strategyId: string;
49
- strategyName: string;
50
- agentRoleId: string;
51
- }, deps?: Pick<CompletionEventDeps, 'createEscalation'>): Promise<void>;
52
- /**
53
- * Handle a 'complete' event from the CompletionDetector.
54
- *
55
- * Queries current delivery and issue state to decide whether to:
56
- * - Terminate the team (all deliveries terminal or no open issues remain), or
57
- * - Send a mid-strategy handoff message with remaining work.
58
- *
59
- * Extracted from the inline event callback in spawnStrategyTeam to eliminate
60
- * deep nesting inside an async Promise chain inside an event listener.
61
- */
62
- export declare function handleCompletionEvent(ctx: CompletionEventContext, deps?: CompletionEventDeps): Promise<void>;
63
- //# sourceMappingURL=strategy-completion-event.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-completion-event.d.ts","sourceRoot":"","sources":["../src/strategy-completion-event.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE7F,OAAO,EAAE,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQnF,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,oCAAoC,CAAC;AAI/E,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,IAAI,EAAE,YAAY,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC/E,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACxE,gBAAgB,EAAE,CAAC,MAAM,EAAE;QACzB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CAChD;AASD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE;IACN,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB,EACD,IAAI,GAAE,IAAI,CAAC,mBAAmB,EAAE,kBAAkB,CAAe,GAChE,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAID;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,sBAAsB,EAC3B,IAAI,GAAE,mBAAiC,GACtC,OAAO,CAAC,IAAI,CAAC,CAoGf"}
@@ -1,138 +0,0 @@
1
- /**
2
- * Strategy completion event handler - reacts to CompletionDetector events.
3
- *
4
- * Extracted from strategy-executor.ts. Handles the decision logic when a
5
- * team lead completes a work cycle: terminate if done, send more work, or
6
- * (for planning teams) refresh from MCP-written deliveries / escalate.
7
- */
8
- import { sendMessage, withRetry, ESCALATION_REASONS } from '@telora/daemon-core';
9
- import { isStatusTerminal, isStatusAgentActionable } from './stage-classifier.js';
10
- import { getStrategyDeliveries, getStrategyIssues } from './queries/strategies.js';
11
- import { buildWakeMessage } from './strategy-prompt-builder.js';
12
- import { OPEN_ISSUE_STATUSES } from './constants.js';
13
- import { terminateTeam as defaultTerminateTeam } from './strategy-team-lifecycle.js';
14
- import { createEscalation as defaultCreateEscalation } from './queries/issues.js';
15
- /** Reason string emitted when a planning team produces no deliveries. */
16
- export const PLANNING_NO_DELIVERIES_REASON = 'planning produced no deliveries';
17
- const defaultDeps = {
18
- getStrategyDeliveries,
19
- getStrategyIssues,
20
- createEscalation: defaultCreateEscalation,
21
- terminateTeam: defaultTerminateTeam,
22
- };
23
- /**
24
- * Escalate when a planning team finishes its initial turn without writing
25
- * any deliveries via MCP. The team is then terminated -- no respawn.
26
- *
27
- * Exported so tests and sister deliveries can verify the contract.
28
- */
29
- export async function escalatePlanningFailure(params, deps = defaultDeps) {
30
- const { sessionId, strategyName, agentRoleId } = params;
31
- try {
32
- await withRetry(() => deps.createEscalation({
33
- organizationId: params.organizationId,
34
- sessionId,
35
- issueId: null,
36
- reasonType: ESCALATION_REASONS.NEEDS_CLARIFICATION,
37
- description: `Planning team for strategy "${strategyName}" finished its initial turn without ` +
38
- `creating any deliveries. Reason: ${PLANNING_NO_DELIVERIES_REASON}.\n\n` +
39
- `**Strategy:** ${strategyName}\n` +
40
- `**Strategy ID:** ${params.strategyId}\n` +
41
- `**Agent role:** ${agentRoleId}\n\n` +
42
- `The team has been terminated. A human must either scope the strategy ` +
43
- `manually or re-queue it after clarifying intent.`,
44
- whatWasTried: `Spawned a planning team to scope deliveries for "${strategyName}".`,
45
- helpNeeded: `Review the strategy intent and either scope deliveries manually or update the strategy description so the next planning attempt can succeed.`,
46
- }), { maxAttempts: 3, label: `escalation-planning-no-deliveries-${params.strategyId}` });
47
- console.log(`[strategy-executor] Created planning-failure escalation for "${strategyName}" ` +
48
- `(reason: ${PLANNING_NO_DELIVERIES_REASON})`);
49
- }
50
- catch (err) {
51
- console.error(`[strategy-executor] Failed to create planning-failure escalation for "${strategyName}": ${err.message}`);
52
- }
53
- }
54
- // ── Handler ─────────────────────────────────────────────────────────────
55
- /**
56
- * Handle a 'complete' event from the CompletionDetector.
57
- *
58
- * Queries current delivery and issue state to decide whether to:
59
- * - Terminate the team (all deliveries terminal or no open issues remain), or
60
- * - Send a mid-strategy handoff message with remaining work.
61
- *
62
- * Extracted from the inline event callback in spawnStrategyTeam to eliminate
63
- * deep nesting inside an async Promise chain inside an event listener.
64
- */
65
- export async function handleCompletionEvent(ctx, deps = defaultDeps) {
66
- const { strategyId, strategyName, teamState, completionDetector, proc } = ctx;
67
- const [currentDeliveries, currentIssues] = await Promise.all([
68
- deps.getStrategyDeliveries(strategyId),
69
- deps.getStrategyIssues(strategyId),
70
- ]);
71
- // Wake-cycle refresh (Option A): planning teams spawn with knownDeliveryIds
72
- // empty. The MCP-driven planning turn writes deliveries to the DB, so we
73
- // re-snapshot them here before any downstream merge/completion logic looks
74
- // at the set. WHY Option A: keeps the refresh on the existing wake path
75
- // instead of polling, so it runs exactly when new deliveries become visible.
76
- if (teamState.planningPhase) {
77
- if (currentDeliveries.length === 0) {
78
- console.warn(`[strategy-executor] Planning team for "${strategyName}" produced no deliveries ` +
79
- `-- escalating and terminating`);
80
- await escalatePlanningFailure({
81
- organizationId: teamState.organizationId,
82
- sessionId: teamState.leadSessionId ?? '',
83
- strategyId,
84
- strategyName,
85
- agentRoleId: teamState.roleId,
86
- }, deps);
87
- teamState.shutdownReason = 'work_complete';
88
- deps.terminateTeam(strategyId);
89
- return;
90
- }
91
- for (const d of currentDeliveries) {
92
- teamState.knownDeliveryIds.add(d.id);
93
- teamState.deliveryStageIds.set(d.id, d.currentWorkflowStageId);
94
- }
95
- teamState.planningPhase = false;
96
- console.log(`[strategy-executor] Planning refresh for "${strategyName}": ` +
97
- `${currentDeliveries.length} delivery(ies) discovered`);
98
- }
99
- // If all deliveries are terminal, shut down.
100
- const allTerminal = currentDeliveries.every(d => isStatusTerminal(d.executionStatus ?? ''));
101
- if (allTerminal) {
102
- console.log(`[strategy-executor] All deliveries terminal for "${strategyName}" -- terminating team`);
103
- teamState.shutdownReason = 'work_complete';
104
- deps.terminateTeam(strategyId);
105
- return;
106
- }
107
- // Check if there are actionable deliveries with open issues.
108
- const actionableDeliveryIds = new Set(currentDeliveries
109
- .filter(d => isStatusAgentActionable(d.executionStatus ?? ''))
110
- .map(d => d.id));
111
- if (actionableDeliveryIds.size === 0) {
112
- console.log(`[strategy-executor] No actionable deliveries for "${strategyName}" -- terminating team`);
113
- teamState.shutdownReason = 'work_complete';
114
- deps.terminateTeam(strategyId);
115
- return;
116
- }
117
- // Check for open issues across actionable deliveries.
118
- const hasOpenIssues = currentIssues.some(i => actionableDeliveryIds.has(i.deliveryId) && OPEN_ISSUE_STATUSES.has(i.status));
119
- if (!hasOpenIssues) {
120
- console.log(`[strategy-executor] Actionable deliveries have no open issues for "${strategyName}" -- ` +
121
- `terminating team. Auto-advance will handle verify transition.`);
122
- teamState.shutdownReason = 'work_complete';
123
- deps.terminateTeam(strategyId);
124
- return;
125
- }
126
- // Mid-strategy handoff: actionable work with open issues remains.
127
- // Send work immediately and reset the completion detector for the next cycle.
128
- console.log(`[strategy-executor] Mid-strategy handoff for "${strategyName}" -- sending new work`);
129
- const message = buildWakeMessage(currentDeliveries, currentIssues, teamState.knownDeliveryIds);
130
- // Update tracking state
131
- for (const d of currentDeliveries) {
132
- teamState.knownDeliveryIds.add(d.id);
133
- teamState.deliveryStageIds.set(d.id, d.currentWorkflowStageId);
134
- }
135
- completionDetector.reset();
136
- sendMessage(proc.stdin, message);
137
- }
138
- //# sourceMappingURL=strategy-completion-event.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-completion-event.js","sourceRoot":"","sources":["../src/strategy-completion-event.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,iB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C,CAAC,EAAE,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAClF,CAAC;IAEF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CACT,sEAAsE,YAAY,OAAO;YACzF,+DAA+D,CAChE,CAAC;QACF,SAAS,CAAC,cAAc,GAAG,eAAe,CAAC;QAC3C,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC/B,OAAO;IACT,CAAC;IAED,kEAAkE;IAClE,8EAA8E;IAC9E,OAAO,CAAC,GAAG,CACT,iDAAiD,YAAY,uBAAuB,CACrF,CAAC;IACF,MAAM,OAAO,GAAG,gBAAgB,CAAC,iBAAiB,EAAE,aAAa,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAE/F,wBAAwB;IACxB,KAAK,MAAM,CAAC,IAAI,iBAAiB,EAAE,CAAC;QAClC,SAAS,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrC,SAAS,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,sBAAsB,CAAC,CAAC;IACjE,CAAC;IAED,kBAAkB,CAAC,KAAK,EAAE,CAAC;IAC3B,WAAW,CAAC,IAAI,CAAC,KAAM,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC"}
@@ -1,85 +0,0 @@
1
- /**
2
- * Strategy team completion handling.
3
- *
4
- * Manages the post-execution lifecycle: advancing delivery statuses
5
- * based on issue completion, merging the strategy branch, cleaning up
6
- * worktrees, and updating session records.
7
- */
8
- import type { DaemonConfig, StrategyTeamState, StrategyDeliveryInfo, Workflow, PolicyFailureMode } from './types.js';
9
- import type { StageAdvanceResult } from './delivery-lifecycle.js';
10
- export { isStatusTerminal, isStatusAgentActionable } from './stage-classifier.js';
11
- /**
12
- * Decide whether to attempt mergeStrategyBranch on team exit.
13
- *
14
- * Skip merge when:
15
- * - The team did not succeed (failed exit or unclean shutdown), OR
16
- * - The team is still in its planning phase (no deliveries scoped, nothing
17
- * to merge -- this covers cancellation mid-planning).
18
- *
19
- * Exported for unit testing the gate logic in isolation.
20
- */
21
- export declare function shouldAttemptMerge(succeeded: boolean, teamState: Pick<StrategyTeamState, 'planningPhase'>): boolean;
22
- export interface TeamCompletionParams {
23
- config: DaemonConfig;
24
- teamState: StrategyTeamState;
25
- sessionId: string;
26
- code: number | null;
27
- signal: string | null;
28
- }
29
- /**
30
- * Handle the team lead process exiting.
31
- *
32
- * Responsibilities:
33
- * - Report git state for all known deliveries
34
- * - Advance delivery statuses based on issue completion
35
- * - Merge strategy branch to integration (if successful)
36
- * - Clean up worktree
37
- * - Update session record
38
- * - Record heartbeat counters
39
- * - Trigger re-poll for next work
40
- */
41
- export declare function handleTeamCompletion(params: TeamCompletionParams): Promise<void>;
42
- /**
43
- * External dependencies for advanceDeliveryStatuses.
44
- * Defaults to real implementations; overridable in tests.
45
- */
46
- export interface AdvanceDeliveryDeps {
47
- getStrategyDeliveries: (strategyId: string) => Promise<StrategyDeliveryInfo[]>;
48
- getDeliveryIssues: (deliveryId: string) => Promise<Array<{
49
- id: string;
50
- title: string;
51
- status: string;
52
- issueType: string;
53
- }>>;
54
- getDeliverySessionCount: (deliveryId: string) => Promise<number>;
55
- updateIssueStatus: (issueId: string, status: string) => Promise<void>;
56
- fetchEffectiveWorkflow: (deliveryId: string) => Promise<Workflow>;
57
- updateDeliveryStatus: (deliveryId: string, executionStatus: string, currentWorkflowStageId?: string | null) => Promise<void>;
58
- advanceDeliveryStage: (params: {
59
- deliveryId: string;
60
- deliveryName: string;
61
- organizationId: string;
62
- workflow: Workflow;
63
- currentStageId: string;
64
- exitCode: number;
65
- openIssueCount: number;
66
- sessionCount: number;
67
- policyFailureMode: PolicyFailureMode;
68
- sessionId: string | null;
69
- }) => Promise<StageAdvanceResult>;
70
- }
71
- /**
72
- * Advance delivery statuses after team completion.
73
- *
74
- * Re-queries all deliveries for the strategy from the database rather
75
- * than relying on the spawn-time snapshot in teamState.knownDeliveryIds.
76
- * This ensures deliveries added mid-flight (after the team was spawned)
77
- * are discovered and advanced, and that stale deliveryStageIds don't
78
- * cause deliveries to be skipped.
79
- *
80
- * For each delivery in 'coding' status:
81
- * - All issues Done (or no issues): advance via workflow (coding -> verify -> done)
82
- * - Open issues remain: re-queue to 'queued' so the next team session picks it up
83
- */
84
- export declare function advanceDeliveryStatuses(config: DaemonConfig, teamState: StrategyTeamState, sessionId: string, deps?: AdvanceDeliveryDeps): Promise<void>;
85
- //# sourceMappingURL=strategy-completion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-completion.d.ts","sourceRoot":"","sources":["../src/strategy-completion.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,QAAQ,EACR,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAcpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAelE,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAIlF;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAClD,OAAO,CAET;AAID,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA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