@cleocode/core 2026.3.57 → 2026.3.59

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 (136) hide show
  1. package/dist/agents/agent-registry.d.ts +206 -0
  2. package/dist/agents/agent-registry.d.ts.map +1 -0
  3. package/dist/agents/agent-schema.d.ts.map +1 -1
  4. package/dist/agents/execution-learning.d.ts +223 -0
  5. package/dist/agents/execution-learning.d.ts.map +1 -0
  6. package/dist/agents/health-monitor.d.ts +161 -0
  7. package/dist/agents/health-monitor.d.ts.map +1 -0
  8. package/dist/agents/index.d.ts +4 -1
  9. package/dist/agents/index.d.ts.map +1 -1
  10. package/dist/agents/retry.d.ts +57 -4
  11. package/dist/agents/retry.d.ts.map +1 -1
  12. package/dist/backfill/index.d.ts +83 -0
  13. package/dist/backfill/index.d.ts.map +1 -0
  14. package/dist/bootstrap.d.ts +1 -1
  15. package/dist/config.d.ts +47 -0
  16. package/dist/config.d.ts.map +1 -1
  17. package/dist/index.d.ts +2 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +6985 -5068
  20. package/dist/index.js.map +4 -4
  21. package/dist/intelligence/adaptive-validation.d.ts +151 -0
  22. package/dist/intelligence/adaptive-validation.d.ts.map +1 -0
  23. package/dist/intelligence/impact.d.ts +34 -1
  24. package/dist/intelligence/impact.d.ts.map +1 -1
  25. package/dist/intelligence/index.d.ts +7 -2
  26. package/dist/intelligence/index.d.ts.map +1 -1
  27. package/dist/intelligence/types.d.ts +60 -0
  28. package/dist/intelligence/types.d.ts.map +1 -1
  29. package/dist/internal.d.ts +8 -4
  30. package/dist/internal.d.ts.map +1 -1
  31. package/dist/lib/index.d.ts +10 -0
  32. package/dist/lib/index.d.ts.map +1 -0
  33. package/dist/lib/retry.d.ts +128 -0
  34. package/dist/lib/retry.d.ts.map +1 -0
  35. package/dist/nexus/sharing/index.d.ts +48 -2
  36. package/dist/nexus/sharing/index.d.ts.map +1 -1
  37. package/dist/sessions/session-enforcement.d.ts.map +1 -1
  38. package/dist/stats/index.d.ts +1 -0
  39. package/dist/stats/index.d.ts.map +1 -1
  40. package/dist/stats/workflow-telemetry.d.ts +89 -0
  41. package/dist/stats/workflow-telemetry.d.ts.map +1 -0
  42. package/dist/store/brain-schema.d.ts.map +1 -1
  43. package/dist/store/converters.d.ts.map +1 -1
  44. package/dist/store/cross-db-cleanup.d.ts +93 -0
  45. package/dist/store/cross-db-cleanup.d.ts.map +1 -0
  46. package/dist/store/db-helpers.d.ts.map +1 -1
  47. package/dist/store/migration-sqlite.d.ts.map +1 -1
  48. package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
  49. package/dist/store/sqlite.d.ts.map +1 -1
  50. package/dist/store/task-store.d.ts.map +1 -1
  51. package/dist/store/tasks-schema.d.ts +18 -3
  52. package/dist/store/tasks-schema.d.ts.map +1 -1
  53. package/dist/store/validation-schemas.d.ts +32 -0
  54. package/dist/store/validation-schemas.d.ts.map +1 -1
  55. package/dist/tasks/add.d.ts +10 -1
  56. package/dist/tasks/add.d.ts.map +1 -1
  57. package/dist/tasks/complete.d.ts.map +1 -1
  58. package/dist/tasks/enforcement.d.ts +22 -0
  59. package/dist/tasks/enforcement.d.ts.map +1 -0
  60. package/dist/tasks/epic-enforcement.d.ts +199 -0
  61. package/dist/tasks/epic-enforcement.d.ts.map +1 -0
  62. package/dist/tasks/index.d.ts +1 -1
  63. package/dist/tasks/index.d.ts.map +1 -1
  64. package/dist/tasks/pipeline-stage.d.ts +181 -0
  65. package/dist/tasks/pipeline-stage.d.ts.map +1 -0
  66. package/dist/tasks/update.d.ts +2 -0
  67. package/dist/tasks/update.d.ts.map +1 -1
  68. package/migrations/drizzle-brain/20260321000001_t033-brain-indexes/migration.sql +12 -0
  69. package/migrations/drizzle-brain/20260321000001_t033-brain-indexes/snapshot.json +1232 -0
  70. package/migrations/drizzle-tasks/20260321000000_t033-connection-health/migration.sql +518 -0
  71. package/migrations/drizzle-tasks/20260321000000_t033-connection-health/snapshot.json +4312 -0
  72. package/migrations/drizzle-tasks/20260321000002_t060-pipeline-stage-binding/migration.sql +82 -0
  73. package/migrations/drizzle-tasks/20260321000002_t060-pipeline-stage-binding/snapshot.json +9 -0
  74. package/package.json +5 -5
  75. package/schemas/config.schema.json +37 -1547
  76. package/src/__tests__/sharing.test.ts +24 -0
  77. package/src/agents/__tests__/agent-registry.test.ts +351 -0
  78. package/src/agents/__tests__/execution-learning.test.ts +684 -0
  79. package/src/agents/__tests__/health-monitor.test.ts +332 -0
  80. package/src/agents/__tests__/registry.test.ts +30 -2
  81. package/src/agents/agent-registry.ts +394 -0
  82. package/src/agents/agent-schema.ts +5 -0
  83. package/src/agents/execution-learning.ts +675 -0
  84. package/src/agents/health-monitor.ts +279 -0
  85. package/src/agents/index.ts +37 -1
  86. package/src/agents/retry.ts +57 -4
  87. package/src/backfill/index.ts +309 -0
  88. package/src/bootstrap.ts +1 -1
  89. package/src/config.ts +126 -0
  90. package/src/index.ts +8 -1
  91. package/src/intelligence/__tests__/adaptive-validation.test.ts +694 -0
  92. package/src/intelligence/__tests__/impact.test.ts +165 -1
  93. package/src/intelligence/adaptive-validation.ts +764 -0
  94. package/src/intelligence/impact.ts +203 -0
  95. package/src/intelligence/index.ts +19 -0
  96. package/src/intelligence/types.ts +76 -0
  97. package/src/internal.ts +39 -0
  98. package/src/lib/__tests__/retry.test.ts +321 -0
  99. package/src/lib/index.ts +16 -0
  100. package/src/lib/retry.ts +224 -0
  101. package/src/lifecycle/__tests__/chain-store.test.ts +7 -0
  102. package/src/lifecycle/__tests__/tessera-engine.test.ts +52 -0
  103. package/src/nexus/sharing/index.ts +142 -2
  104. package/src/sessions/__tests__/session-edge-cases.test.ts +24 -1
  105. package/src/sessions/session-enforcement.ts +13 -2
  106. package/src/stats/index.ts +7 -0
  107. package/src/stats/workflow-telemetry.ts +502 -0
  108. package/src/store/__tests__/migration-safety.test.ts +3 -0
  109. package/src/store/__tests__/session-store.test.ts +132 -1
  110. package/src/store/__tests__/task-store.test.ts +22 -1
  111. package/src/store/__tests__/test-db-helper.ts +29 -2
  112. package/src/store/brain-schema.ts +4 -1
  113. package/src/store/converters.ts +2 -0
  114. package/src/store/cross-db-cleanup.ts +192 -0
  115. package/src/store/db-helpers.ts +2 -0
  116. package/src/store/migration-sqlite.ts +6 -0
  117. package/src/store/sqlite-data-accessor.ts +20 -28
  118. package/src/store/sqlite.ts +14 -2
  119. package/src/store/task-store.ts +6 -0
  120. package/src/store/tasks-schema.ts +59 -20
  121. package/src/tasks/__tests__/add.test.ts +16 -0
  122. package/src/tasks/__tests__/complete-unblocks.test.ts +10 -1
  123. package/src/tasks/__tests__/complete.test.ts +11 -2
  124. package/src/tasks/__tests__/epic-enforcement.test.ts +909 -0
  125. package/src/tasks/__tests__/minimal-test.test.ts +28 -0
  126. package/src/tasks/__tests__/pipeline-stage.test.ts +403 -0
  127. package/src/tasks/__tests__/update.test.ts +40 -6
  128. package/src/tasks/add.ts +128 -2
  129. package/src/tasks/complete.ts +29 -17
  130. package/src/tasks/enforcement.ts +127 -0
  131. package/src/tasks/epic-enforcement.ts +364 -0
  132. package/src/tasks/index.ts +1 -0
  133. package/src/tasks/pipeline-stage.ts +293 -0
  134. package/src/tasks/update.ts +62 -0
  135. package/templates/config.template.json +34 -111
  136. package/templates/global-config.template.json +24 -40
@@ -6,6 +6,7 @@
6
6
  * - Task impact assessment (direct + transitive dependents)
7
7
  * - Change impact prediction (cancel, block, complete, reprioritize)
8
8
  * - Blast radius calculation (scope quantification)
9
+ * - Free-text impact prediction (predictImpact) — T043
9
10
  *
10
11
  * @module intelligence
11
12
  */
@@ -22,6 +23,8 @@ import type {
22
23
  ChangeImpact,
23
24
  ChangeType,
24
25
  ImpactAssessment,
26
+ ImpactedTask,
27
+ ImpactReport,
25
28
  } from './types.js';
26
29
 
27
30
  // ============================================================================
@@ -636,3 +639,203 @@ function generateRecommendation(
636
639
  );
637
640
  }
638
641
  }
642
+
643
+ // ============================================================================
644
+ // Free-text Impact Prediction (T043)
645
+ // ============================================================================
646
+
647
+ /**
648
+ * Score a task against a change description using simple keyword matching.
649
+ *
650
+ * Normalises both strings to lowercase and counts overlapping tokens (words).
651
+ * Returns a score in [0, 1] — 1 meaning every non-trivial token in the change
652
+ * description was found in the task text.
653
+ */
654
+ function scoreTaskMatch(change: string, task: Task): number {
655
+ const STOP_WORDS = new Set([
656
+ 'a',
657
+ 'an',
658
+ 'the',
659
+ 'and',
660
+ 'or',
661
+ 'in',
662
+ 'of',
663
+ 'to',
664
+ 'for',
665
+ 'with',
666
+ 'on',
667
+ 'at',
668
+ 'by',
669
+ 'is',
670
+ 'it',
671
+ 'be',
672
+ 'as',
673
+ 'if',
674
+ 'do',
675
+ 'not',
676
+ ]);
677
+
678
+ const tokenise = (text: string): string[] =>
679
+ text
680
+ .toLowerCase()
681
+ .split(/\W+/)
682
+ .filter((t) => t.length > 2 && !STOP_WORDS.has(t));
683
+
684
+ const changeTokens = new Set(tokenise(change));
685
+ if (changeTokens.size === 0) return 0;
686
+
687
+ const taskText = `${task.title ?? ''} ${task.description ?? ''}`;
688
+ const taskTokens = new Set(tokenise(taskText));
689
+
690
+ let matches = 0;
691
+ for (const token of changeTokens) {
692
+ if (taskTokens.has(token)) matches++;
693
+ }
694
+
695
+ return matches / changeTokens.size;
696
+ }
697
+
698
+ /**
699
+ * Predict the downstream impact of a free-text change description.
700
+ *
701
+ * Uses fuzzy keyword matching to identify candidate tasks that relate to
702
+ * the change, then walks the reverse dependency graph to enumerate all
703
+ * downstream tasks that may be affected.
704
+ *
705
+ * @remarks
706
+ * The matching is purely lexical (no embeddings). Tasks are ranked by
707
+ * how many tokens from the change description appear in their title and
708
+ * description. The top `matchLimit` (default: 5) matched tasks are used
709
+ * as seeds for downstream dependency tracing.
710
+ *
711
+ * @example
712
+ * ```ts
713
+ * import { predictImpact } from '@cleocode/core';
714
+ *
715
+ * const report = await predictImpact('Modify authentication flow', process.cwd());
716
+ * console.log(report.summary);
717
+ * // "3 tasks matched 'Modify authentication flow'; 7 downstream tasks affected."
718
+ * for (const task of report.affectedTasks) {
719
+ * console.log(`${task.id} (${task.exposure}): ${task.reason}`);
720
+ * }
721
+ * ```
722
+ *
723
+ * @param change - Free-text description of the proposed change (e.g. "Modify X")
724
+ * @param cwd - Working directory used to locate the tasks database
725
+ * @param accessor - Optional pre-created DataAccessor (useful in tests)
726
+ * @param matchLimit - Maximum number of seed tasks to match (default: 5)
727
+ * @returns Full impact prediction report
728
+ */
729
+ export async function predictImpact(
730
+ change: string,
731
+ cwd?: string,
732
+ accessor?: DataAccessor,
733
+ matchLimit = 5,
734
+ ): Promise<ImpactReport> {
735
+ const acc = accessor ?? (await getAccessor(cwd));
736
+ const tasks = await loadAllTasks(acc);
737
+ const taskMap = new Map(tasks.map((t) => [t.id, t]));
738
+ const dependentsMap = buildDependentsMap(tasks);
739
+
740
+ // --- Step 1: Score every task against the change description ---
741
+ const scored = tasks
742
+ .map((t) => ({ task: t, score: scoreTaskMatch(change, t) }))
743
+ .filter(({ score }) => score > 0)
744
+ .sort((a, b) => b.score - a.score);
745
+
746
+ const seeds = scored.slice(0, matchLimit).map(({ task }) => task);
747
+
748
+ if (seeds.length === 0) {
749
+ return {
750
+ change,
751
+ matchedTasks: [],
752
+ affectedTasks: [],
753
+ totalAffected: 0,
754
+ summary: `No tasks matched the change description "${change}".`,
755
+ };
756
+ }
757
+
758
+ // --- Step 2: Collect all affected task IDs via reverse dependency graph ---
759
+ const directMatchIds = new Set(seeds.map((t) => t.id));
760
+
761
+ // Map: taskId -> exposure level
762
+ const exposureMap = new Map<string, ImpactedTask['exposure']>();
763
+ for (const id of directMatchIds) {
764
+ exposureMap.set(id, 'direct');
765
+ }
766
+
767
+ // BFS over dependents for each seed
768
+ for (const seed of seeds) {
769
+ const transitive = collectTransitiveDependents(seed.id, dependentsMap);
770
+ for (const depId of transitive) {
771
+ if (!exposureMap.has(depId)) {
772
+ // Determine whether this is a direct dependent of the seed or further out
773
+ const isDirectDependent = (dependentsMap.get(seed.id) ?? new Set()).has(depId);
774
+ exposureMap.set(depId, isDirectDependent ? 'dependent' : 'transitive');
775
+ }
776
+ }
777
+ }
778
+
779
+ // --- Step 3: Build ImpactedTask list ---
780
+ const EXPOSURE_ORDER: Record<ImpactedTask['exposure'], number> = {
781
+ direct: 0,
782
+ dependent: 1,
783
+ transitive: 2,
784
+ };
785
+
786
+ const affectedTasks: ImpactedTask[] = [];
787
+
788
+ for (const [id, exposure] of exposureMap) {
789
+ const task = taskMap.get(id);
790
+ if (!task) continue;
791
+
792
+ const downstreamTransitive = collectTransitiveDependents(id, dependentsMap);
793
+ const downstreamCount = downstreamTransitive.size;
794
+
795
+ let reason: string;
796
+ if (exposure === 'direct') {
797
+ reason = `Task title/description matched "${change}".`;
798
+ } else if (exposure === 'dependent') {
799
+ const seedNames = seeds
800
+ .filter((s) => (dependentsMap.get(s.id) ?? new Set()).has(id))
801
+ .map((s) => s.id)
802
+ .join(', ');
803
+ reason = `Directly depends on matched task(s): ${seedNames}.`;
804
+ } else {
805
+ reason = 'Downstream of a matched task via transitive dependency chain.';
806
+ }
807
+
808
+ affectedTasks.push({
809
+ id,
810
+ title: task.title,
811
+ status: task.status,
812
+ priority: task.priority,
813
+ exposure,
814
+ downstreamCount,
815
+ reason,
816
+ });
817
+ }
818
+
819
+ // Sort: exposure order first, then descending downstream count
820
+ affectedTasks.sort((a, b) => {
821
+ const expDiff = EXPOSURE_ORDER[a.exposure] - EXPOSURE_ORDER[b.exposure];
822
+ if (expDiff !== 0) return expDiff;
823
+ return b.downstreamCount - a.downstreamCount;
824
+ });
825
+
826
+ const matchedTasks = affectedTasks.filter((t) => t.exposure === 'direct');
827
+ const totalAffected = affectedTasks.length;
828
+
829
+ const summary =
830
+ matchedTasks.length === 0
831
+ ? `No tasks matched "${change}".`
832
+ : `${matchedTasks.length} task(s) matched "${change}"; ${totalAffected} total task(s) affected (including downstream).`;
833
+
834
+ return {
835
+ change,
836
+ matchedTasks,
837
+ affectedTasks,
838
+ totalAffected,
839
+ summary,
840
+ };
841
+ }
@@ -5,15 +5,32 @@
5
5
  * detection, pattern matching, and pattern storage backed by the existing
6
6
  * brain_patterns and brain_learnings tables.
7
7
  *
8
+ * Also provides adaptive validation gate focus and confidence scoring via
9
+ * the adaptive-validation module (T035).
10
+ *
8
11
  * @task Wave3A
9
12
  * @epic T5149
10
13
  */
11
14
 
15
+ export type {
16
+ AdaptiveValidationSuggestion,
17
+ GateFocusRecommendation,
18
+ StorePredictionOptions,
19
+ VerificationConfidenceScore,
20
+ } from './adaptive-validation.js';
21
+ // Adaptive validation (T035)
22
+ export {
23
+ predictAndStore,
24
+ scoreVerificationConfidence,
25
+ storePrediction,
26
+ suggestGateFocus,
27
+ } from './adaptive-validation.js';
12
28
  // Impact analysis
13
29
  export {
14
30
  analyzeChangeImpact,
15
31
  analyzeTaskImpact,
16
32
  calculateBlastRadius,
33
+ predictImpact,
17
34
  } from './impact.js';
18
35
  // Patterns
19
36
  export {
@@ -37,6 +54,8 @@ export type {
37
54
  ChangeType,
38
55
  DetectedPattern,
39
56
  ImpactAssessment,
57
+ ImpactedTask,
58
+ ImpactReport,
40
59
  LearningContext,
41
60
  PatternExtractionOptions,
42
61
  PatternMatch,
@@ -245,6 +245,82 @@ export interface AffectedTask {
245
245
  reason: string;
246
246
  }
247
247
 
248
+ // ============================================================================
249
+ // Impact Prediction (free-text change description)
250
+ // ============================================================================
251
+
252
+ /**
253
+ * A single task predicted to be affected by a free-text change description.
254
+ *
255
+ * Produced by {@link predictImpact} after matching candidate tasks against
256
+ * the change description and running downstream dependency analysis.
257
+ */
258
+ export interface ImpactedTask {
259
+ /** Task ID. */
260
+ id: string;
261
+
262
+ /** Task title. */
263
+ title: string;
264
+
265
+ /** Current task status. */
266
+ status: string;
267
+
268
+ /** Current task priority. */
269
+ priority: string;
270
+
271
+ /**
272
+ * Severity estimate for this task's exposure to the change.
273
+ *
274
+ * - `direct` — task title/description matched the change description
275
+ * - `dependent` — task depends on a matched task
276
+ * - `transitive` — downstream of a dependent via the dependency graph
277
+ */
278
+ exposure: 'direct' | 'dependent' | 'transitive';
279
+
280
+ /**
281
+ * Number of downstream tasks that depend on this task.
282
+ * Higher values indicate higher cascading risk.
283
+ */
284
+ downstreamCount: number;
285
+
286
+ /** Why this task is predicted to be affected. */
287
+ reason: string;
288
+ }
289
+
290
+ /**
291
+ * Full impact prediction report for a free-text change description.
292
+ *
293
+ * Returned by {@link predictImpact}. Combines fuzzy task search with
294
+ * reverse dependency analysis to enumerate which tasks are at risk.
295
+ */
296
+ export interface ImpactReport {
297
+ /** The original free-text change description. */
298
+ change: string;
299
+
300
+ /**
301
+ * Tasks directly matched by the change description (fuzzy search).
302
+ * These are the "seed" tasks from which downstream impact is traced.
303
+ */
304
+ matchedTasks: ImpactedTask[];
305
+
306
+ /**
307
+ * All tasks predicted to be affected, ordered by exposure severity
308
+ * (direct first, then dependents, then transitive) and then by
309
+ * descending downstream count.
310
+ */
311
+ affectedTasks: ImpactedTask[];
312
+
313
+ /**
314
+ * Total count of distinct affected tasks (including direct matches).
315
+ */
316
+ totalAffected: number;
317
+
318
+ /**
319
+ * Human-readable summary of predicted impact scope.
320
+ */
321
+ summary: string;
322
+ }
323
+
248
324
  // ============================================================================
249
325
  // Blast Radius
250
326
  // ============================================================================
package/src/internal.ts CHANGED
@@ -33,6 +33,9 @@ export { findAdrs } from './adrs/find.js';
33
33
  export { listAdrs, showAdr, syncAdrsToDb, validateAllAdrs } from './adrs/index.js';
34
34
  // Audit
35
35
  export type { AuditEntry } from './audit.js';
36
+ // Backfill
37
+ export type { BackfillOptions, BackfillResult, BackfillTaskChange } from './backfill/index.js';
38
+ export { backfillTasks, generateAcFromDescription } from './backfill/index.js';
36
39
  export type { BootstrapContext, BootstrapOptions } from './bootstrap.js';
37
40
  // Bootstrap (global setup)
38
41
  export {
@@ -63,6 +66,7 @@ export {
63
66
  analyzeChangeImpact,
64
67
  analyzeTaskImpact,
65
68
  calculateBlastRadius,
69
+ predictImpact,
66
70
  } from './intelligence/impact.js';
67
71
  export {
68
72
  extractPatternsFromHistory,
@@ -84,6 +88,8 @@ export type {
84
88
  ChangeType,
85
89
  DetectedPattern,
86
90
  ImpactAssessment,
91
+ ImpactedTask,
92
+ ImpactReport,
87
93
  LearningContext,
88
94
  PatternExtractionOptions,
89
95
  PatternMatch,
@@ -95,6 +101,14 @@ export type {
95
101
 
96
102
  // Issue
97
103
  export { collectDiagnostics } from './issue/diagnostics.js';
104
+ // Lib — shared primitives
105
+ export {
106
+ computeDelay,
107
+ type RetryablePredicate,
108
+ type RetryContext,
109
+ type RetryOptions,
110
+ withRetry as withRetryShared,
111
+ } from './lib/retry.js';
98
112
  export {
99
113
  addChain,
100
114
  advanceInstance,
@@ -348,6 +362,12 @@ export {
348
362
  } from './snapshot/index.js';
349
363
  // System
350
364
  export { getDashboard, getProjectStats } from './stats/index.js';
365
+ // Workflow telemetry (T065)
366
+ export {
367
+ getWorkflowComplianceReport,
368
+ type WorkflowComplianceReport,
369
+ type WorkflowRuleMetric,
370
+ } from './stats/workflow-telemetry.js';
351
371
  // Sticky
352
372
  export { archiveSticky } from './sticky/archive.js';
353
373
  export {
@@ -599,9 +619,14 @@ export { coreTaskStats } from './tasks/task-ops.js';
599
619
  // ---------------------------------------------------------------------------
600
620
 
601
621
  export type {
622
+ AgentExecutionEvent,
623
+ AgentExecutionOutcome,
602
624
  AgentHealthReport,
625
+ AgentHealthStatus,
626
+ AgentPerformanceSummary,
603
627
  AgentRecoveryResult,
604
628
  CapacitySummary,
629
+ HealingSuggestion,
605
630
  ListAgentFilters,
606
631
  RegisterAgentOptions,
607
632
  RetryPolicy,
@@ -610,25 +635,39 @@ export type {
610
635
  } from './agents/index.js';
611
636
  // Agents — runtime registry, health, retry, capacity
612
637
  export {
638
+ // health-monitor functions (T039)
613
639
  checkAgentHealth,
640
+ // registry / capacity / retry
614
641
  classifyError,
615
642
  createRetryPolicy,
616
643
  DEFAULT_RETRY_POLICY,
617
644
  deregisterAgent,
645
+ detectCrashedAgents,
646
+ detectStaleAgents,
618
647
  findLeastLoadedAgent,
648
+ findStaleAgentRows,
619
649
  generateAgentId,
620
650
  getAgentErrorHistory,
621
651
  getAgentInstance,
652
+ getAgentPerformanceHistory,
622
653
  getAvailableCapacity,
623
654
  getCapacitySummary,
624
655
  getHealthReport,
656
+ getSelfHealingSuggestions,
657
+ HEARTBEAT_INTERVAL_MS,
625
658
  heartbeat,
626
659
  incrementTasksCompleted,
627
660
  isOverloaded,
628
661
  listAgentInstances,
629
662
  markCrashed,
663
+ processAgentLifecycleEvent,
664
+ recordAgentExecution,
665
+ recordFailurePattern,
666
+ recordHeartbeat,
630
667
  recoverCrashedAgents,
631
668
  registerAgent as registerAgentInstance,
669
+ STALE_THRESHOLD_MS,
670
+ storeHealingStrategy,
632
671
  updateAgentStatus,
633
672
  updateCapacity,
634
673
  withRetry,