@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,104 +0,0 @@
1
- /**
2
- * Strategy worktree state management — write-through cache.
3
- *
4
- * Tracks persistent strategy worktrees using a local Map as the
5
- * synchronous read cache, backed by the strategy_worktrees DB table.
6
- *
7
- * Read path: all get/has/getAll calls are synchronous (Map lookup).
8
- * Write path: update Map immediately, then fire async DB write.
9
- * Startup: hydrateFromDb() loads all records from DB into the Map.
10
- *
11
- * The Map is authoritative during runtime. The DB is authoritative
12
- * across restarts. Async DB writes are fire-and-forget with logging.
13
- */
14
- import { upsertWorktreeRecord, removeWorktreeRecord, listWorktreeRecords, } from './queries/worktrees.js';
15
- // ── Module-level config ──────────────────────────────────────────────
16
- let configuredProductId = null;
17
- // ── Persistent worktree tracking ─────────────────────────────────────
18
- /** Persistent strategy worktrees: strategyId -> StrategyWorktreeInfo */
19
- const strategyWorktrees = new Map();
20
- /**
21
- * Hydrate the in-memory cache from the database.
22
- *
23
- * Call once during daemon startup, BEFORE rebuildStrategyWorktreeState.
24
- * Stores the productId for subsequent write-through operations.
25
- */
26
- export async function hydrateFromDb(productId) {
27
- configuredProductId = productId;
28
- let records;
29
- try {
30
- records = await listWorktreeRecords(productId);
31
- }
32
- catch (err) {
33
- console.warn(`[worktree-state] Failed to hydrate from DB, starting with empty cache:`, err.message);
34
- return;
35
- }
36
- let hydrated = 0;
37
- for (const record of records) {
38
- strategyWorktrees.set(record.strategyId, {
39
- strategyId: record.strategyId,
40
- strategyName: '', // Not stored in DB — rebuilt by callers
41
- worktreePath: record.worktreePath,
42
- branchName: record.branchName,
43
- createdAt: new Date(record.createdAt),
44
- hasQaDevServer: false, // Runtime-only state
45
- });
46
- hydrated++;
47
- }
48
- if (hydrated > 0) {
49
- console.log(`[worktree-state] Hydrated ${hydrated} worktree(s) from DB`);
50
- }
51
- }
52
- /**
53
- * Get a single strategy worktree by strategy ID.
54
- */
55
- export function getStrategyWorktree(strategyId) {
56
- return strategyWorktrees.get(strategyId);
57
- }
58
- /**
59
- * Add or update a strategy worktree entry.
60
- *
61
- * Updates the Map synchronously, then fires an async DB upsert.
62
- */
63
- export function setStrategyWorktree(strategyId, info) {
64
- strategyWorktrees.set(strategyId, info);
65
- // Write-through: async DB upsert (fire-and-forget)
66
- upsertWorktreeRecord({
67
- strategyId,
68
- productId: configuredProductId,
69
- worktreePath: info.worktreePath,
70
- branchName: info.branchName,
71
- status: 'active',
72
- }).catch((err) => {
73
- console.warn(`[worktree-state] DB upsert failed for strategy ${strategyId}:`, err.message);
74
- });
75
- }
76
- /**
77
- * Remove a strategy worktree entry.
78
- * Returns whether the entry existed.
79
- *
80
- * Deletes from Map synchronously, then fires an async DB remove.
81
- */
82
- export function removeStrategyWorktree(strategyId) {
83
- const existed = strategyWorktrees.delete(strategyId);
84
- if (existed) {
85
- // Write-through: async DB remove (fire-and-forget)
86
- removeWorktreeRecord(strategyId).catch((err) => {
87
- console.warn(`[worktree-state] DB remove failed for strategy ${strategyId}:`, err.message);
88
- });
89
- }
90
- return existed;
91
- }
92
- /**
93
- * Get all strategy worktrees.
94
- */
95
- export function getAllStrategyWorktrees() {
96
- return strategyWorktrees;
97
- }
98
- /**
99
- * Check if a strategy has a persistent worktree.
100
- */
101
- export function hasStrategyWorktree(strategyId) {
102
- return strategyWorktrees.has(strategyId);
103
- }
104
- //# sourceMappingURL=strategy-worktree-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-worktree-state.js","sourceRoot":"","sources":["../src/strategy-worktree-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,wEAAwE;AAExE,IAAI,mBAAmB,GAAkB,IAAI,CAAC;AAE9C,wEAAwE;AAExE,wEAAwE;AACxE,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAgC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,SAAiB;IACnD,mBAAmB,GAAG,SAAS,CAAC;IAEhC,IAAI,OAAO,CAAC;IACZ,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC;IAAC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a,CAAC,OAAO,CACvB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAErD,IAAI,OAAO,EAAE,CAAC;QACZ,mDAAmD;QACnD,oBAAoB,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YAC7C,OAAO,CAAC,IAAI,CACV,kDAAkD,UAAU,GAAG,EAC9D,GAAa,CAAC,OAAO,CACvB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB;IACpD,OAAO,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Strategy team prompt variants.
3
- *
4
- * Contains functions that build non-planning prompt variants sent to
5
- * active strategy teams: wake messages for new work delivery.
6
- *
7
- * Extracted from strategy-prompt-builder.ts for maintainability.
8
- */
9
- import type { StrategyDeliveryInfo, StrategyIssueInfo } from './types.js';
10
- /**
11
- * Build a wake message for an idle team when new work is available.
12
- *
13
- * The team already has role context and execution instructions from the
14
- * initial prompt. This message is a lean update with just the new work.
15
- */
16
- export declare function buildWakeMessage(deliveries: StrategyDeliveryInfo[], issues: StrategyIssueInfo[], knownDeliveryIds: Set<string>): string;
17
- //# sourceMappingURL=team-prompt-variants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"team-prompt-variants.d.ts","sourceRoot":"","sources":["../src/team-prompt-variants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAGpB;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,oBAAoB,EAAE,EAClC,MAAM,EAAE,iBAAiB,EAAE,EAC3B,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC5B,MAAM,CAwER"}
@@ -1,79 +0,0 @@
1
- /**
2
- * Strategy team prompt variants.
3
- *
4
- * Contains functions that build non-planning prompt variants sent to
5
- * active strategy teams: wake messages for new work delivery.
6
- *
7
- * Extracted from strategy-prompt-builder.ts for maintainability.
8
- */
9
- import { isStatusAgentActionable } from './stage-classifier.js';
10
- /**
11
- * Build a wake message for an idle team when new work is available.
12
- *
13
- * The team already has role context and execution instructions from the
14
- * initial prompt. This message is a lean update with just the new work.
15
- */
16
- export function buildWakeMessage(deliveries, issues, knownDeliveryIds) {
17
- const parts = [];
18
- parts.push('## New Work Available');
19
- parts.push('');
20
- const actionableDeliveries = deliveries.filter(d => isStatusAgentActionable(d.executionStatus ?? ''));
21
- if (actionableDeliveries.length === 0) {
22
- parts.push('No actionable deliveries at this time.');
23
- parts.push('');
24
- return parts.join('\n');
25
- }
26
- for (const delivery of actionableDeliveries) {
27
- const isNew = !knownDeliveryIds.has(delivery.id);
28
- const tag = isNew ? ' (NEW)' : '';
29
- parts.push(`### ${delivery.name} [${delivery.executionStatus}]${tag}`);
30
- parts.push(`**Delivery ID:** ${delivery.id}`);
31
- if (delivery.description) {
32
- parts.push(`**Description:** ${delivery.description}`);
33
- }
34
- // Compact issue listing
35
- const deliveryIssues = issues.filter(i => i.deliveryId === delivery.id);
36
- const actionableIssues = deliveryIssues.filter(i => i.issueType !== 'Context Group');
37
- if (actionableIssues.length > 0) {
38
- const statusCounts = new Map();
39
- for (const issue of actionableIssues) {
40
- statusCounts.set(issue.status, (statusCounts.get(issue.status) ?? 0) + 1);
41
- }
42
- const countParts = [];
43
- for (const s of ['To Do', 'In Progress', 'Done', 'Blocked', 'In Review']) {
44
- const count = statusCounts.get(s);
45
- if (count !== undefined) {
46
- countParts.push(`${count} ${s}`);
47
- }
48
- }
49
- parts.push(`**Issues (${countParts.join(', ')}):**`);
50
- }
51
- const wakeContextGroups = deliveryIssues.filter(i => i.issueType === 'Context Group');
52
- for (const issue of deliveryIssues) {
53
- if (issue.issueType === 'Context Group') {
54
- const children = deliveryIssues.filter(i => i.parentIssueId === issue.id);
55
- const depsSuffix = issue.dependsOn && issue.dependsOn.length > 0
56
- ? ` [depends on: ${issue.dependsOn.map(depId => {
57
- const depCg = wakeContextGroups.find(cg => cg.id === depId);
58
- return depCg ? `"${depCg.title}"` : depId;
59
- }).join(', ')}]`
60
- : '';
61
- if (children.length > 0) {
62
- const childSummaries = children.map(c => `${c.key} (${c.status})`).join(', ');
63
- parts.push(` Context Group: "${issue.title}"${depsSuffix} -- children: ${childSummaries}`);
64
- }
65
- else {
66
- parts.push(` Context Group: "${issue.title}"${depsSuffix}`);
67
- }
68
- }
69
- else if (!issue.parentIssueId) {
70
- parts.push(` - ${issue.key}: ${issue.title} (${issue.status})`);
71
- }
72
- }
73
- parts.push('');
74
- }
75
- parts.push('Do NOT poll for new deliveries. The daemon will send them to you directly.');
76
- parts.push('');
77
- return parts.join('\n');
78
- }
79
- //# sourceMappingURL=team-prompt-variants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"team-prompt-variants.js","sourceRoot":"","sources":["../src/team-prompt-variants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAAkC,EAClC,MAA2B,EAC3B,gBAA6B;IAE7B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACpC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,MAAM,oBAAoB,GAAG,UAAU,CAAC,MAAM,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from '../completion-detector.js';
6
- /**
7
- * Pipeline configuration for a strategy.
8
- * Controls CI/CD behavior after delivery completion.
9
- */
10
- export interface PipelineConfig {
11
- ci: {
12
- enabled: boolean;
13
- mergeStrategy: 'fast-forward' | 'rebase' | 'merge-commit';
14
- };
15
- cd: {
16
- enabled: boolean;
17
- };
18
- teams: {
19
- enabled: boolean;
20
- };
21
- review?: {
22
- enabled: boolean;
23
- };
24
- model?: string | null;
25
- }
26
- /**
27
- * Strategy from database (simplified for daemon)
28
- */
29
- export interface Strategy {
30
- id: string;
31
- name: string;
32
- description: string | null;
33
- pipelineConfig: PipelineConfig | null;
34
- }
35
- /**
36
- * In-memory state for a persistent strategy worktree.
37
- * Tracks worktrees that outlive individual team sessions.
38
- */
39
- export interface StrategyWorktreeInfo {
40
- /** Strategy UUID this worktree belongs to. */
41
- strategyId: string;
42
- /** Strategy name for logging. */
43
- strategyName: string;
44
- /** Filesystem path to the worktree. */
45
- worktreePath: string;
46
- /** Git branch name for this strategy's work. */
47
- branchName: string;
48
- /** When the worktree was created. */
49
- createdAt: Date;
50
- /** Whether a QA dev server is currently running in this worktree. */
51
- hasQaDevServer: boolean;
52
- }
53
- /**
54
- * Execution configuration for a strategy team.
55
- * Controls parallelism and worker lifecycle.
56
- */
57
- export interface StrategyExecutionConfig {
58
- /** Maximum number of concurrent worker agents. Default: 3. */
59
- maxWorkers: number;
60
- /** Poll interval in ms when idle (all work done). Default: 30000. */
61
- idlePollIntervalMs: number;
62
- /** Poll interval in ms during active execution for new deliveries. Default: 60000. */
63
- activePollIntervalMs: number;
64
- }
65
- /**
66
- * Team lifecycle phases.
67
- *
68
- * No idle phase: when all work is done, the team terminates.
69
- * If new deliveries arrive later, a fresh team is spawned.
70
- */
71
- export type StrategyTeamPhase = 'initializing' | 'executing' | 'shutting_down' | 'terminated';
72
- /**
73
- * In-memory state for a strategy's Agent Team.
74
- * Tracks the team lifecycle from spawn to completion.
75
- */
76
- export interface StrategyTeamState {
77
- /** Strategy UUID this team is executing. */
78
- strategyId: string;
79
- /** Strategy name for logging. */
80
- strategyName: string;
81
- /** Agent role assigned to this strategy. */
82
- roleId: string;
83
- /** Agent role name for logging. */
84
- roleName: string;
85
- /** Organization ID for API calls. */
86
- organizationId: string;
87
- /** Product ID for scoping queries. */
88
- productId: string;
89
- /** Execution config (max workers, etc.). */
90
- executionConfig: StrategyExecutionConfig;
91
- /** Pipeline config from the strategy. */
92
- pipelineConfig: PipelineConfig | null;
93
- /** When this team was spawned. */
94
- startedAt: Date;
95
- /** Current team lifecycle phase. */
96
- phase: StrategyTeamPhase;
97
- /** Set of delivery IDs the team is aware of. */
98
- knownDeliveryIds: Set<string>;
99
- /** Deliveries that have already triggered an integration merge mid-flight. */
100
- mergedDeliveryIds: Set<string>;
101
- /**
102
- * True when the team was spawned with zero deliveries and is expected to
103
- * scope them via MCP during its initial planning turn. Cleared as soon as
104
- * the wake-cycle refresh observes at least one delivery, after which the
105
- * team is treated as a normal execution team.
106
- */
107
- planningPhase: boolean;
108
- /** Session ID for the team lead agent (if spawned). */
109
- leadSessionId: string | null;
110
- /** PID of the team lead process. */
111
- leadPid: number | null;
112
- /** Reference to the team lead's stdin for sending messages. */
113
- leadStdin: Writable | null;
114
- /** Git branch name for this strategy's work. */
115
- branchName: string;
116
- /** Worktree path for this strategy's work. */
117
- worktreePath: string | null;
118
- /** Current workflow stage ID for each delivery. */
119
- deliveryStageIds: Map<string, string | null>;
120
- /** Whether the team lead is currently resolving a merge conflict. */
121
- resolvingMergeConflict: boolean;
122
- /** Why the team was terminated (set by terminateTeam callers). */
123
- shutdownReason: 'work_complete' | 'deactivated' | 'error' | 'user_stopped' | null;
124
- /** Whether this is a read-only audit session (no commits allowed). */
125
- readOnly: boolean;
126
- /** Completion detector instance for multi-cycle idle/wake support. */
127
- completionDetector: CompletionDetector | null;
128
- /** Claude Code internal session ID (from system.init event) for --resume support. */
129
- claudeSessionId: string | null;
130
- }
131
- /**
132
- * Summary info about a delivery within the strategy.
133
- * Used by the DAG builder.
134
- */
135
- export interface StrategyDeliveryInfo {
136
- id: string;
137
- name: string;
138
- description: string | null;
139
- priorityRank: number;
140
- executionStatus: string | null;
141
- acceptanceCriteria: string | null;
142
- techContext: string | null;
143
- currentWorkflowStageId: string | null;
144
- mergeCommitSha: string | null;
145
- gitState: string | null;
146
- stageDescription: string | null;
147
- }
148
- /**
149
- * Cross-delivery CG dependency declaration from planning output.
150
- * Indicates that a CG in one delivery depends on a CG in another delivery,
151
- * which implies a delivery-level dependency edge.
152
- */
153
- export interface CrossDeliveryCGDependency {
154
- /** CG name in the dependent delivery. */
155
- fromCG: string;
156
- /** Delivery name containing the dependent CG. */
157
- fromDelivery: string;
158
- /** CG name in the dependency delivery. */
159
- dependsOnCG: string;
160
- /** Delivery name containing the dependency CG. */
161
- dependsOnDelivery: string;
162
- }
163
- /**
164
- * Issue info as returned for strategy-level queries.
165
- */
166
- export interface StrategyIssueInfo {
167
- id: string;
168
- key: string;
169
- title: string;
170
- description: string | null;
171
- status: string;
172
- issueType: string;
173
- priority: string | null;
174
- deliveryId: string;
175
- parentIssueId: string | null;
176
- context: string | null;
177
- relevantFiles: string | null;
178
- dependsOn: string[] | null;
179
- }
180
- //# sourceMappingURL=strategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../../src/types/strategy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE;QACF,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,cAAc,GAAG,QAAQ,GAAG,cAAc,CAAC;KAC3D,CAAC;IACF,EAAE,EAAE;QACF,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,KAAK,EAAE;QACL,OAAO,EAAE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EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC5B"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Strategy execution types.
3
- */
4
- export {};
5
- //# sourceMappingURL=strategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../src/types/strategy.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Merge worktree management.
3
- *
4
- * The persistent merge worktree is a detached-HEAD worktree at
5
- * `.telora/merge-worktree/` used by merge operations so the main
6
- * repo working tree is never touched during merges.
7
- */
8
- import type { DaemonConfig } from './types.js';
9
- /**
10
- * Derive the merge worktree path from config. Deterministic -- no state.
11
- */
12
- export declare function getMergeWorktreePath(config: DaemonConfig): string;
13
- /**
14
- * Create or validate the persistent merge worktree.
15
- *
16
- * Uses a detached HEAD worktree at `.telora/merge-worktree/` so merge
17
- * functions can checkout any branch without "already checked out" conflicts.
18
- * The main repo working tree is never touched during merge operations.
19
- *
20
- * Called once from initGit() after ensureIntegrationBranch().
21
- */
22
- export declare function ensureMergeWorktree(config: DaemonConfig): string;
23
- //# sourceMappingURL=worktree-merge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktree-merge.d.ts","sourceRoot":"","sources":["../src/worktree-merge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAEjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAqChE"}
@@ -1,57 +0,0 @@
1
- /**
2
- * Merge worktree management.
3
- *
4
- * The persistent merge worktree is a detached-HEAD worktree at
5
- * `.telora/merge-worktree/` used by merge operations so the main
6
- * repo working tree is never touched during merges.
7
- */
8
- import { existsSync, mkdirSync, rmSync } from 'node:fs';
9
- import { join } from 'node:path';
10
- import { runGitSync } from './git-types.js';
11
- /**
12
- * Derive the merge worktree path from config. Deterministic -- no state.
13
- */
14
- export function getMergeWorktreePath(config) {
15
- return join(config.repoPath, '.telora', 'merge-worktree');
16
- }
17
- /**
18
- * Create or validate the persistent merge worktree.
19
- *
20
- * Uses a detached HEAD worktree at `.telora/merge-worktree/` so merge
21
- * functions can checkout any branch without "already checked out" conflicts.
22
- * The main repo working tree is never touched during merge operations.
23
- *
24
- * Called once from initGit() after ensureIntegrationBranch().
25
- */
26
- export function ensureMergeWorktree(config) {
27
- const teloraDir = join(config.repoPath, '.telora');
28
- const wtPath = getMergeWorktreePath(config);
29
- // Ensure .telora directory exists
30
- if (!existsSync(teloraDir)) {
31
- mkdirSync(teloraDir, { recursive: true });
32
- }
33
- if (existsSync(wtPath)) {
34
- // Validate it's a functioning worktree (has a .git file or directory)
35
- const gitMarker = join(wtPath, '.git');
36
- if (existsSync(gitMarker)) {
37
- console.log(`[merge-worktree] Using existing merge worktree: ${wtPath}`);
38
- return wtPath;
39
- }
40
- // Directory exists but isn't a valid worktree -- prune and recreate
41
- console.log(`[merge-worktree] Stale merge worktree detected, recreating...`);
42
- rmSync(wtPath, { recursive: true, force: true });
43
- runGitSync(['worktree', 'prune'], config.repoPath);
44
- }
45
- else {
46
- // Prune in case git still has a stale entry for this path
47
- runGitSync(['worktree', 'prune'], config.repoPath);
48
- }
49
- // Create detached HEAD worktree (avoids branch conflicts)
50
- const result = runGitSync(['worktree', 'add', '--detach', wtPath], config.repoPath);
51
- if (!result.success) {
52
- throw new Error(`Failed to create merge worktree: ${result.error}`);
53
- }
54
- console.log(`[merge-worktree] Created merge worktree: ${wtPath}`);
55
- return wtPath;
56
- }
57
- //# sourceMappingURL=worktree-merge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktree-merge.js","sourceRoot":"","sources":["../src/worktree-merge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAoB;IACvD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS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CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,4CAA4C,MAAM,EAAE,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,69 +0,0 @@
1
- /**
2
- * Strategy worktree lifecycle: canonical removal and orphan cleanup.
3
- *
4
- * safeRemoveStrategyWorktree is the single code path for all strategy
5
- * worktree removals -- it merges before removing and conditionally
6
- * clears in-memory state.
7
- *
8
- * cleanupOrphanStrategyWorktrees scans the worktree directory on startup
9
- * and removes worktrees that no longer match any active strategy.
10
- */
11
- import type { DaemonConfig } from './types.js';
12
- /**
13
- * Parameters for the canonical worktree removal function.
14
- */
15
- export interface SafeRemoveStrategyWorktreeParams {
16
- config: DaemonConfig;
17
- worktreePath: string;
18
- branchName: string;
19
- /** Human-readable name for logging and merge commit messages. */
20
- deliveryName: string;
21
- /** Delivery/strategy ID for merge traceability. Falls back to deliveryName. */
22
- deliveryId?: string;
23
- /** If provided, clears in-memory worktree state on successful removal. */
24
- strategyId?: string;
25
- }
26
- /**
27
- * Result of a canonical worktree removal attempt.
28
- */
29
- export interface SafeRemoveResult {
30
- /** Whether the worktree was actually removed from disk. */
31
- removed: boolean;
32
- /** Whether a merge to integration was attempted and succeeded. */
33
- merged: boolean;
34
- /** Error message if merge failed. */
35
- mergeError?: string;
36
- }
37
- /**
38
- * Canonical strategy worktree removal: merge-before-remove + conditional cleanup.
39
- *
40
- * Every code path that removes a strategy worktree should route through this
41
- * function. It encapsulates the full lifecycle:
42
- * 1. Check for unmerged commits on the branch
43
- * 2. Attempt merge to integration if needed
44
- * 3. Call removeWorktree with safety guards (handles uncommitted changes)
45
- * 4. Conditionally clear in-memory state based on whether removal succeeded
46
- *
47
- * Returns structured result so callers can count cleaned/preserved and log.
48
- */
49
- export declare function safeRemoveStrategyWorktree(params: SafeRemoveStrategyWorktreeParams): Promise<SafeRemoveResult>;
50
- /**
51
- * Clean up orphan strategy worktrees on daemon startup.
52
- *
53
- * Scans the worktree directory and cross-references against active
54
- * strategies (those with assigned agent roles and queued deliveries).
55
- * Worktrees that don't match any active strategy are orphans from a
56
- * previous daemon run and are cleaned up.
57
- *
58
- * Conservative approach:
59
- * - Safety-commits any uncommitted changes before removal
60
- * - Checks for unmerged commits before deleting
61
- * - Logs all actions for auditability
62
- *
63
- * @returns Count of orphans cleaned up and preserved
64
- */
65
- export declare function cleanupOrphanStrategyWorktrees(config: DaemonConfig): Promise<{
66
- cleaned: number;
67
- preserved: number;
68
- }>;
69
- //# sourceMappingURL=worktree-strategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktree-strategy.d.ts","sourceRoot":"","sources":["../src/worktree-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAU/C;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,OAAO,EAAE,OAAO,CAAC;IACjB,kEAAkE;IAClE,MAAM,EAAE,OAAO,CAAC;IAChB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,gCAAgC,GACvC,OAAO,CAAC,gBAAgB,CAAC,CA8D3B;AAID;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAsHjD"}