@evo-dev/core 0.0.1-alpha.2 → 0.0.1-alpha.20

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 (79) hide show
  1. package/assets/skills/coding/knowledge-distillation/SKILL.md +5 -3
  2. package/assets/team/agents/code-reviewer.md +48 -0
  3. package/assets/team/agents/docs-maintainer.md +51 -0
  4. package/assets/team/agents/implementation-engineer.md +51 -0
  5. package/assets/team/agents/product-scope-analyst.md +58 -0
  6. package/assets/team/agents/release-engineer.md +55 -0
  7. package/assets/team/agents/security-boundary-reviewer.md +50 -0
  8. package/assets/team/agents/solution-architect.md +51 -0
  9. package/assets/team/agents/verification-engineer.md +51 -0
  10. package/assets/team/team.md +102 -0
  11. package/dist/assets/index.js +5 -5
  12. package/dist/config/index.js +793 -241
  13. package/dist/index.js +20840 -12908
  14. package/dist/plugins/index.js +13 -13
  15. package/package.json +1 -1
  16. package/src/agents/index.ts +1 -265
  17. package/src/code-agent-traces/index.ts +11 -12
  18. package/src/config/index.ts +2 -0
  19. package/src/config/settings.ts +116 -7
  20. package/src/config/store.ts +1 -1
  21. package/src/daemon/index.ts +1 -41
  22. package/src/evolution/candidates/index.ts +730 -0
  23. package/src/evolution/control/index.ts +20 -0
  24. package/src/evolution/evidence/analysis.ts +533 -0
  25. package/src/evolution/evidence/index.ts +3 -0
  26. package/src/evolution/evidence/session-memory/analysis.ts +287 -0
  27. package/src/evolution/evidence/session-memory/constants.ts +9 -0
  28. package/src/evolution/evidence/session-memory/index.ts +9 -0
  29. package/src/evolution/evidence/session-memory/paths.ts +29 -0
  30. package/src/evolution/evidence/session-memory/policy.ts +39 -0
  31. package/src/evolution/evidence/session-memory/retention.ts +643 -0
  32. package/src/evolution/evidence/session-memory/segment.ts +216 -0
  33. package/src/evolution/evidence/session-memory/semantic-packet.ts +408 -0
  34. package/src/evolution/evidence/session-memory/sensitivity.ts +335 -0
  35. package/src/evolution/evidence/session-memory/state-machine.ts +249 -0
  36. package/src/evolution/evidence/session-memory/storage.ts +744 -0
  37. package/src/evolution/evidence/session-memory/types.ts +296 -0
  38. package/src/evolution/evidence/session-memory/updater.ts +199 -0
  39. package/src/evolution/formatters.ts +169 -0
  40. package/src/evolution/imports/apply.ts +435 -0
  41. package/src/evolution/imports/diff.ts +472 -0
  42. package/src/evolution/imports/index.ts +7 -0
  43. package/src/evolution/imports/materialize.ts +640 -0
  44. package/src/evolution/imports/paths.ts +129 -0
  45. package/src/evolution/imports/stage.ts +414 -0
  46. package/src/evolution/imports/storage.ts +952 -0
  47. package/src/evolution/imports/types.ts +226 -0
  48. package/src/evolution/index.ts +19 -2827
  49. package/src/evolution/knowledge/change-store.ts +558 -0
  50. package/src/evolution/knowledge/changes.ts +459 -0
  51. package/src/evolution/knowledge/freshness.ts +69 -0
  52. package/src/{knowledge → evolution/knowledge}/index.ts +1532 -206
  53. package/src/evolution/knowledge/review.ts +446 -0
  54. package/src/evolution/knowledge/support.ts +135 -0
  55. package/src/evolution/paths.ts +44 -0
  56. package/src/evolution/processor/distillation.ts +518 -0
  57. package/src/evolution/processor/index.ts +3 -0
  58. package/src/evolution/processor/process.ts +594 -0
  59. package/src/{learning → evolution/review}/index.ts +10 -14
  60. package/src/evolution/schema.ts +639 -0
  61. package/src/evolution/shared.ts +1053 -0
  62. package/src/evolution/triggers/classification.ts +102 -0
  63. package/src/evolution/triggers/index.ts +295 -0
  64. package/src/hooks/index.ts +281 -197
  65. package/src/index.ts +15 -4
  66. package/src/projects/index.ts +934 -0
  67. package/src/runtime-logs/index.ts +100 -13
  68. package/src/team/index.ts +582 -3
  69. package/src/utils/errors.ts +13 -0
  70. package/src/utils/fs.ts +40 -0
  71. package/src/utils/hash.ts +9 -0
  72. package/src/utils/ids.ts +12 -0
  73. package/src/utils/index.ts +7 -0
  74. package/src/utils/parsing.ts +11 -0
  75. package/src/utils/text.ts +18 -0
  76. package/src/utils/time.ts +5 -0
  77. package/src/workflow/index.ts +3 -21
  78. package/src/project/index.ts +0 -507
  79. package/src/task/index.ts +0 -840
@@ -0,0 +1,639 @@
1
+ import type { SessionEvidenceSegmentV1 } from "./evidence/session-memory/types.ts";
2
+ import type { OkfKnowledgeActivationResult, OkfKnowledgePlan } from "./knowledge/index.ts";
3
+
4
+ export type EvolutionEvidenceSourceKind =
5
+ | "evodev-execution-event"
6
+ | "team-agent-trace"
7
+ | "session-trace"
8
+ | "session-memory-segment"
9
+ | "verification"
10
+ | "review-summary"
11
+ | "user-feedback"
12
+ | "code-agent-trace-ref";
13
+
14
+ export type EvolutionEvidenceEventKind =
15
+ | "trace"
16
+ | "tool-call"
17
+ | "skill-call"
18
+ | "subagent"
19
+ | "verification"
20
+ | "review"
21
+ | "user-feedback"
22
+ | "error"
23
+ | "run-state";
24
+
25
+ export type EvolutionNormalizedEventType =
26
+ | "SessionStart"
27
+ | "UserPromptSubmit"
28
+ | "UserPromptExpansion"
29
+ | "PreToolUse"
30
+ | "PermissionRequest"
31
+ | "PostToolUse"
32
+ | "PostToolUseFailure"
33
+ | "PostToolBatch"
34
+ | "PermissionDenied"
35
+ | "SubagentStart"
36
+ | "Stop"
37
+ | "StopFailure"
38
+ | "TeammateIdle"
39
+ | "SubagentStop"
40
+ | "TaskCreated"
41
+ | "TaskCompleted"
42
+ | "PreCompact"
43
+ | "PostCompact"
44
+ | "SessionEnd"
45
+ | "ConfigChange"
46
+ | "CwdChanged"
47
+ | "FileChanged"
48
+ | "WorktreeCreate"
49
+ | "WorktreeRemove"
50
+ | "unknown";
51
+
52
+ export type EvolutionTriggerStrength = "none" | "conditional" | "strong";
53
+ export type EvolutionTriggerReason =
54
+ | "none"
55
+ | "turn-completed"
56
+ | "task-completed"
57
+ | "session-ended"
58
+ | "role-completed"
59
+ | "stop-failure"
60
+ | "tool-failure"
61
+ | "permission-denied"
62
+ | "explicit-command"
63
+ | "failure-signal";
64
+
65
+ export type EvolutionEpisodeKind = "session" | "turn" | "task" | "role";
66
+ export type EvolutionEpisodeStatus = "open" | "closed" | "failed";
67
+ export type EvolutionTriggerStatus = "pending" | "processing" | "consumed" | "failed" | "skipped";
68
+ export type SegmentEvolutionTriggerReason =
69
+ | "session-memory-init"
70
+ | "session-memory-threshold"
71
+ | "intent-refinement"
72
+ | "user-interruption"
73
+ | "failure-signal"
74
+ | "permission-denied"
75
+ | "verification-after-fix"
76
+ | "explicit-memory-intent"
77
+ | "historical-import";
78
+ export type SegmentEvolutionTriggerStrength = "normal" | "strong";
79
+
80
+ export type EvolutionKnowledgeKind =
81
+ | "run-summary"
82
+ | "lesson"
83
+ | "rule"
84
+ | "workflow-hint"
85
+ | "skill-gap"
86
+ | "role-note"
87
+ | "verification-pattern";
88
+
89
+ export type EvolutionReviewState =
90
+ | "auto-accepted"
91
+ | "auto-stored/unreviewed"
92
+ | "needs-human"
93
+ | "accepted"
94
+ | "rejected"
95
+ | "deferred"
96
+ | "stale"
97
+ | "deprecated"
98
+ | "superseded"
99
+ | "revoked";
100
+
101
+ export type EvolutionAuthority = "contextual" | "reviewed";
102
+ export type EvolutionConfidence = "low" | "medium" | "high";
103
+
104
+ export type EvolutionProposalKind =
105
+ | "skill"
106
+ | "rule"
107
+ | "role-agent"
108
+ | "team"
109
+ | "ci"
110
+ | "test"
111
+ | "docs"
112
+ | "engineering-practice";
113
+
114
+ export type EvolutionImprovementEvalStatus =
115
+ | "not-requested"
116
+ | "awaiting-eval"
117
+ | "evaluating"
118
+ | "effective"
119
+ | "ineffective"
120
+ | "inconclusive";
121
+
122
+ export interface EvolutionImprovementEvalResult {
123
+ targetImproved: boolean | null;
124
+ hardRegression: boolean | null;
125
+ summary: string;
126
+ assertions: Array<{
127
+ label: string;
128
+ status: "pass" | "fail" | "unknown";
129
+ }>;
130
+ evaluatedBy: "local-code-agent" | "local-eval-orchestrator";
131
+ metrics: {
132
+ durationMs: number;
133
+ modelCalls: number;
134
+ inputTokens: number | null;
135
+ outputTokens: number | null;
136
+ toolCalls: number | null;
137
+ };
138
+ retention: {
139
+ metadataOnly: true;
140
+ replayInputStored: false;
141
+ replayOutputStored: false;
142
+ };
143
+ }
144
+
145
+ export interface EvolutionImprovementEval {
146
+ recommended: boolean;
147
+ requested: boolean;
148
+ status: EvolutionImprovementEvalStatus;
149
+ requestedAt: string | null;
150
+ evaluatedAt: string | null;
151
+ evidenceRef: string | null;
152
+ result: EvolutionImprovementEvalResult | null;
153
+ }
154
+
155
+ export interface EvolutionPrivacyFields {
156
+ classification: "local-private";
157
+ rawPromptsStored: false;
158
+ rawLogsStored: false;
159
+ sourceDumpsStored: false;
160
+ rawCommandOutputStored: false;
161
+ secretsStored: false;
162
+ internalLinksStored: boolean;
163
+ }
164
+
165
+ export interface EvolutionEvidenceWindow {
166
+ schemaVersion: 1;
167
+ id: string;
168
+ kind: "evidence-window";
169
+ projectKey: string;
170
+ runId: string;
171
+ taskId: string | null;
172
+ createdAt: string;
173
+ sourceRefs: EvolutionEvidenceSourceRef[];
174
+ events: EvolutionEvidenceEvent[];
175
+ episodes: EvolutionEpisode[];
176
+ triggerPolicy: EvolutionTriggerPolicy;
177
+ privacy: EvolutionPrivacyFields;
178
+ }
179
+
180
+ export interface EvolutionEvidenceSourceRef {
181
+ id: string;
182
+ kind: EvolutionEvidenceSourceKind;
183
+ path: string;
184
+ roleId: string | null;
185
+ rawContentStored: false;
186
+ externalContentCopied: false;
187
+ }
188
+
189
+ export interface EvolutionEvidenceEvent {
190
+ id: string;
191
+ kind: EvolutionEvidenceEventKind;
192
+ eventType: EvolutionNormalizedEventType;
193
+ hookEventId: string | null;
194
+ occurredAt: string | null;
195
+ summary: string;
196
+ roleId: string | null;
197
+ taskId: string | null;
198
+ evidenceRef: string;
199
+ episodeIds: string[];
200
+ triggerStrength: EvolutionTriggerStrength;
201
+ triggerReason: EvolutionTriggerReason;
202
+ rawContentStored: false;
203
+ }
204
+
205
+ export interface EvolutionEpisode {
206
+ id: string;
207
+ kind: EvolutionEpisodeKind;
208
+ status: EvolutionEpisodeStatus;
209
+ roleId: string | null;
210
+ taskId: string | null;
211
+ startedAt: string | null;
212
+ endedAt: string | null;
213
+ eventIds: string[];
214
+ triggerStrength: EvolutionTriggerStrength;
215
+ triggerReason: EvolutionTriggerReason;
216
+ summary: string;
217
+ rawContentStored: false;
218
+ }
219
+
220
+ export interface EvolutionTriggerPolicy {
221
+ strongest: EvolutionTriggerStrength;
222
+ reasons: EvolutionTriggerReason[];
223
+ distillRecommended: boolean;
224
+ evidenceSignals: {
225
+ failures: number;
226
+ verifications: number;
227
+ roleLifecycle: number;
228
+ skillCalls: number;
229
+ };
230
+ }
231
+
232
+ export interface EvolutionTriggerRecord {
233
+ schemaVersion: 1;
234
+ id: string;
235
+ kind: "evolution-trigger";
236
+ projectKey: string;
237
+ runId: string;
238
+ roleId: string | null;
239
+ taskId: string | null;
240
+ eventType: EvolutionNormalizedEventType;
241
+ eventId: string | null;
242
+ evidenceRef: string | null;
243
+ summary: string;
244
+ triggerStrength: EvolutionTriggerStrength;
245
+ triggerReason: EvolutionTriggerReason;
246
+ status: EvolutionTriggerStatus;
247
+ attempts: number;
248
+ createdAt: string;
249
+ updatedAt: string;
250
+ processedBatchId: string | null;
251
+ lastError: string | null;
252
+ rawContentStored: false;
253
+ privacy: EvolutionPrivacyFields;
254
+ }
255
+
256
+ export interface SegmentEvolutionTriggerRecord {
257
+ schemaVersion: 1;
258
+ id: string;
259
+ kind: "segment-evolution-trigger";
260
+ projectKey: string;
261
+ sessionKey: string;
262
+ runId: string | null;
263
+ roleId: string | null;
264
+ segmentId: string;
265
+ segmentPath: string;
266
+ strength: SegmentEvolutionTriggerStrength;
267
+ reason: SegmentEvolutionTriggerReason;
268
+ summary: string;
269
+ status: EvolutionTriggerStatus;
270
+ attempts: number;
271
+ createdAt: string;
272
+ updatedAt: string;
273
+ processedBatchId: string | null;
274
+ lastError: string | null;
275
+ rawContentStored: false;
276
+ }
277
+
278
+ export interface EvolutionTriggerDecision {
279
+ eventType: EvolutionNormalizedEventType;
280
+ strength: EvolutionTriggerStrength;
281
+ reason: EvolutionTriggerReason;
282
+ shouldQueue: boolean;
283
+ summary: string;
284
+ }
285
+
286
+ export interface EvolutionKnowledgeRecord {
287
+ schemaVersion: 1;
288
+ id: string;
289
+ kind: EvolutionKnowledgeKind;
290
+ title: string;
291
+ projectKey: string;
292
+ summary: string;
293
+ body: string;
294
+ roleTags: string[];
295
+ tags: string[];
296
+ reviewState: EvolutionReviewState;
297
+ authority: EvolutionAuthority;
298
+ confidence: EvolutionConfidence;
299
+ provenance: {
300
+ runId: string;
301
+ taskId: string | null;
302
+ evidenceWindowId: string;
303
+ sourceRefs: string[];
304
+ createdAt: string;
305
+ createdBy: "evodev";
306
+ rawLogsStored: false;
307
+ rawPromptsStored: false;
308
+ sourceDumpsStored: false;
309
+ rawCommandOutputStored: false;
310
+ };
311
+ relations: {
312
+ relatedKnowledgeIds: string[];
313
+ evosCaseIds: string[];
314
+ proposalIds: string[];
315
+ supersedes: string[];
316
+ };
317
+ privacy: EvolutionPrivacyFields;
318
+ runtime: {
319
+ canLoad: boolean;
320
+ hardBlocking: false;
321
+ };
322
+ }
323
+
324
+ export interface EvolutionKnowledgeReviewHistoryRecord {
325
+ version: 1;
326
+ kind: "evolution-knowledge-review-state-changed";
327
+ knowledgeId: string;
328
+ projectKey: string;
329
+ roleTags: string[];
330
+ artifactCreatedAt: string;
331
+ previousReviewState: EvolutionReviewState;
332
+ nextReviewState: EvolutionReviewState;
333
+ changedAt: string;
334
+ metadataOnly: true;
335
+ }
336
+
337
+ export interface EvolutionEvosCase {
338
+ schemaVersion: 1;
339
+ id: string;
340
+ kind: "evos-case";
341
+ projectKey: string;
342
+ title: string;
343
+ roleTags: string[];
344
+ tags: string[];
345
+ reviewState: EvolutionReviewState;
346
+ confidence: EvolutionConfidence;
347
+ trigger: {
348
+ kind: "task-completion" | "plan-task-completion" | "session-completion" | "manual";
349
+ summary: string;
350
+ };
351
+ intervention: {
352
+ summary: string;
353
+ roleIds: string[];
354
+ };
355
+ result: {
356
+ summary: string;
357
+ verificationSignals: string[];
358
+ };
359
+ expectedFutureBehavior: string;
360
+ provenance: {
361
+ runId: string;
362
+ taskId: string | null;
363
+ evidenceWindowId: string;
364
+ sourceRefs: string[];
365
+ createdAt: string;
366
+ createdBy: "evodev";
367
+ rawLogsStored: false;
368
+ rawPromptsStored: false;
369
+ sourceDumpsStored: false;
370
+ rawCommandOutputStored: false;
371
+ };
372
+ privacy: EvolutionPrivacyFields;
373
+ }
374
+
375
+ export interface EvolutionRepoProposalCurrentState {
376
+ checkedAt: string;
377
+ headSha: string;
378
+ statusFingerprint: string;
379
+ verdict: "unresolved" | "resolved" | "unknown";
380
+ ownership: "governance" | "implementation" | "not-applicable";
381
+ explicitUserRequest: boolean;
382
+ checkedPaths: string[];
383
+ relatedCommits: string[];
384
+ summary: string;
385
+ }
386
+
387
+ export interface EvolutionRepoProposalRecurrence {
388
+ gapKey: string;
389
+ independentSessionCount: number;
390
+ sourceSessionKeys: string[];
391
+ }
392
+
393
+ export interface EvolutionRepoProposalSupersession {
394
+ policy: "session-proposal-v2";
395
+ reason: string;
396
+ supersededAt: string;
397
+ }
398
+
399
+ export interface EvolutionRepoProposal {
400
+ schemaVersion: 1;
401
+ id: string;
402
+ kind: EvolutionProposalKind;
403
+ projectKey: string;
404
+ title: string;
405
+ summary: string;
406
+ rationale: string;
407
+ roleTags: string[];
408
+ tags: string[];
409
+ reviewState: "pending" | "accepted" | "rejected" | "deferred" | "applied" | "superseded";
410
+ reviewStateChangedAt?: string;
411
+ confidence: EvolutionConfidence;
412
+ targetRepoPath: string | null;
413
+ currentState?: EvolutionRepoProposalCurrentState;
414
+ recurrence?: EvolutionRepoProposalRecurrence;
415
+ supersession?: EvolutionRepoProposalSupersession;
416
+ plannedFiles: Array<{
417
+ relativePath: string;
418
+ action: "create" | "update";
419
+ reason: string;
420
+ proposedChange?: string;
421
+ }>;
422
+ lastDecision?: {
423
+ state: "accepted" | "rejected" | "deferred";
424
+ reason: string | null;
425
+ decidedAt: string;
426
+ };
427
+ improvementEval?: EvolutionImprovementEval;
428
+ apply: {
429
+ autoApply: false;
430
+ requiresExplicitCommand: true;
431
+ rollbackPlan: string;
432
+ };
433
+ provenance: {
434
+ runId: string;
435
+ taskId: string | null;
436
+ evidenceWindowId: string;
437
+ sourceRefs: string[];
438
+ createdAt: string;
439
+ createdBy: "evodev";
440
+ rawLogsStored: false;
441
+ rawPromptsStored: false;
442
+ sourceDumpsStored: false;
443
+ rawCommandOutputStored: false;
444
+ };
445
+ privacy: EvolutionPrivacyFields;
446
+ }
447
+
448
+ export interface EvolutionReviewCandidate {
449
+ schemaVersion: 1;
450
+ kind: "evolution-review-candidate";
451
+ id: string;
452
+ projectKey: string;
453
+ runId: string;
454
+ createdAt: string;
455
+ candidateKind: string;
456
+ title: string;
457
+ targetStore: string;
458
+ targetPath: string;
459
+ stableKey: string;
460
+ reviewState: "needs-human" | "accepted" | "rejected" | "deferred";
461
+ reviewStateChangedAt?: string;
462
+ reasons: string[];
463
+ candidate: unknown;
464
+ provenance: {
465
+ runId: string;
466
+ evidenceWindowId: string;
467
+ evidenceRefs: string[];
468
+ createdBy: "evodev";
469
+ rawLogsStored: false;
470
+ rawPromptsStored: false;
471
+ sourceDumpsStored: false;
472
+ rawCommandOutputStored: false;
473
+ };
474
+ privacy: EvolutionPrivacyFields;
475
+ }
476
+
477
+ export interface EvolutionDistillationBatch {
478
+ schemaVersion: 1;
479
+ id: string;
480
+ projectKey: string;
481
+ runId: string;
482
+ createdAt: string;
483
+ evidenceWindow: EvolutionEvidenceWindow;
484
+ knowledgeRecords: EvolutionKnowledgeRecord[];
485
+ evosCases: EvolutionEvosCase[];
486
+ repoProposals: EvolutionRepoProposal[];
487
+ warnings: string[];
488
+ }
489
+
490
+ export interface EvolutionAnalyzeInput {
491
+ homeDir: string;
492
+ runId: string;
493
+ projectKey?: string;
494
+ projectDir?: string;
495
+ now?: string | Date;
496
+ }
497
+
498
+ export interface EvolutionAnalyzeResult {
499
+ evidenceWindow: EvolutionEvidenceWindow;
500
+ warnings: string[];
501
+ }
502
+
503
+ export interface EvolutionWriteResult {
504
+ evidenceWindowPath: string;
505
+ batchPath: string;
506
+ knowledgePaths: string[];
507
+ evosCasePaths: string[];
508
+ repoProposalPaths: string[];
509
+ knowledgeIndexPath: string;
510
+ evosIndexPath: string;
511
+ }
512
+
513
+ export interface EvolutionActivationResult {
514
+ evidenceWindowPath: string;
515
+ batchPath: string;
516
+ okf: OkfKnowledgeActivationResult;
517
+ evosCasePaths: string[];
518
+ repoProposalPaths: string[];
519
+ evosIndexPath: string;
520
+ }
521
+
522
+ export interface EvolutionReviewSnapshot {
523
+ projectKey: string | null;
524
+ knowledgeRecords: EvolutionKnowledgeRecord[];
525
+ evosCases: EvolutionEvosCase[];
526
+ repoProposals: EvolutionRepoProposal[];
527
+ reviewCandidates: EvolutionReviewCandidate[];
528
+ triggers: EvolutionTriggerRecord[];
529
+ }
530
+
531
+ export interface EvolutionEvosCaseQueryResult {
532
+ cases: EvolutionEvosCase[];
533
+ warnings: string[];
534
+ }
535
+
536
+ export interface EvolutionResolvedPaths {
537
+ projectKey: string;
538
+ runId: string;
539
+ evolutionStateDir: string;
540
+ runStateDir: string;
541
+ evidenceWindowPath: string;
542
+ batchPath: string;
543
+ triggersDir: string;
544
+ reviewCandidatesDir: string;
545
+ repoProposalsDir: string;
546
+ repoProposalsIndexPath: string;
547
+ knowledgeProjectDir: string;
548
+ knowledgeRecordsDir: string;
549
+ knowledgeIndexPath: string;
550
+ knowledgeReviewHistoryPath: string;
551
+ evosCasesProjectDir: string;
552
+ evosIndexPath: string;
553
+ }
554
+
555
+ export interface EvolutionTriggerInput {
556
+ homeDir: string;
557
+ projectKey: string;
558
+ runId: string;
559
+ roleId?: string | null;
560
+ taskId?: string | null;
561
+ eventType: string;
562
+ eventId?: string | null;
563
+ evidenceRef?: string | null;
564
+ summary?: string | null;
565
+ now?: string | Date;
566
+ }
567
+
568
+ export interface SegmentEvolutionTriggerInput {
569
+ homeDir: string;
570
+ projectKey: string;
571
+ sessionKey: string;
572
+ runId?: string | null;
573
+ roleId?: string | null;
574
+ segmentId: string;
575
+ segmentPath: string;
576
+ strength: SegmentEvolutionTriggerStrength;
577
+ reason: SegmentEvolutionTriggerReason;
578
+ summary: string;
579
+ now?: string | Date;
580
+ }
581
+
582
+ export interface EvolutionTriggerListInput {
583
+ homeDir: string;
584
+ projectKey?: string;
585
+ runId?: string;
586
+ status?: EvolutionTriggerStatus;
587
+ }
588
+
589
+ export interface SegmentEvolutionTriggerListInput {
590
+ homeDir: string;
591
+ projectKey?: string;
592
+ runId?: string;
593
+ status?: EvolutionTriggerStatus;
594
+ }
595
+
596
+ export interface EvolutionProcessInput {
597
+ homeDir: string;
598
+ projectKey?: string;
599
+ runId?: string;
600
+ limit?: number;
601
+ now?: string | Date;
602
+ dryRun?: boolean;
603
+ distillSessionKnowledge?: SessionKnowledgeDistiller;
604
+ onProgress?: (progress: EvolutionProcessProgress) => void | Promise<void>;
605
+ }
606
+
607
+ export interface SessionKnowledgeDistillerInput {
608
+ homeDir: string;
609
+ segment: SessionEvidenceSegmentV1;
610
+ evidenceWindow: EvolutionEvidenceWindow;
611
+ now: string;
612
+ }
613
+
614
+ export type SessionKnowledgeDistiller = (
615
+ input: SessionKnowledgeDistillerInput,
616
+ ) => Promise<OkfKnowledgePlan>;
617
+
618
+ export interface EvolutionProcessProgress {
619
+ phase: "started" | "updated" | "completed";
620
+ total: number;
621
+ processed: number;
622
+ consumed: number;
623
+ skipped: number;
624
+ failed: number;
625
+ pending: number;
626
+ }
627
+
628
+ export interface EvolutionProcessResult {
629
+ processed: number;
630
+ consumed: number;
631
+ skipped: number;
632
+ failed: number;
633
+ pending: number;
634
+ triggerIds: string[];
635
+ batchIds: string[];
636
+ pendingChangeIds: string[];
637
+ warnings: string[];
638
+ dryRun: boolean;
639
+ }