@evo-dev/core 0.0.1-alpha.15 → 0.0.1-alpha.17

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.
@@ -627,6 +627,11 @@ var DEFAULT_MAX_RAW_EVENT_BYTES = 64 * 1024;
627
627
  // packages/core/src/evolution/knowledge/index.ts
628
628
  import { mkdir, readFile as readFile2, readdir as readdir2, rename, rm, stat as stat2, writeFile } from "node:fs/promises";
629
629
  import { dirname as dirname3, isAbsolute as isAbsolute3, join as join3, relative as relative2, resolve as resolve2 } from "node:path";
630
+
631
+ // packages/core/src/evolution/knowledge/change-store.ts
632
+ var KNOWLEDGE_CHANGE_LOCK_STALE_MS = 5 * 60 * 1000;
633
+
634
+ // packages/core/src/evolution/knowledge/index.ts
630
635
  var RESERVED_OKF_FILENAMES = new Set(["index.md", "log.md"]);
631
636
  var ACTIVE_OKF_REVIEW_STATES = ["accepted", "auto-accepted"];
632
637
  var OKF_REVIEW_STATES = [
@@ -881,6 +886,7 @@ function parseOkfConceptFile(okfDir, filePath, content) {
881
886
  reviewState,
882
887
  lifecycle: lifecycleParsed.lifecycle,
883
888
  lifecyclePersisted: lifecycleParsed.persisted,
889
+ verificationSnapshot: parseOkfVerificationSnapshot(frontmatter),
884
890
  title,
885
891
  description,
886
892
  tags,
@@ -891,6 +897,21 @@ function parseOkfConceptFile(okfDir, filePath, content) {
891
897
  body: parsed.body
892
898
  };
893
899
  }
900
+ function parseOkfVerificationSnapshot(frontmatter) {
901
+ const block = extractNestedYamlBlock(frontmatter, "evodev", "verificationSnapshot");
902
+ if (block === null)
903
+ return null;
904
+ const schemaVersion = readIndentedYamlScalar(block, "schemaVersion");
905
+ const verifiedAt = normalizeIsoDateString(readIndentedYamlScalar(block, "verifiedAt"));
906
+ if (schemaVersion !== "1" || verifiedAt === null)
907
+ return null;
908
+ return {
909
+ schemaVersion: 1,
910
+ verifiedAt,
911
+ evidenceRefs: readYamlList(block, "evidenceRefs"),
912
+ repository: null
913
+ };
914
+ }
894
915
  function matchesConceptFilters(concept, input, equivalentProjectKeys) {
895
916
  const projectKeys = (equivalentProjectKeys ?? []).map(sanitizeSlug);
896
917
  if (input.projectKey !== undefined && concept.repoTags.length > 0 && ![sanitizeSlug(input.projectKey), ...projectKeys].some((projectKey) => concept.repoTags.includes(projectKey) || concept.tags.includes(`repo:${projectKey}`))) {
@@ -1456,7 +1477,7 @@ function createDefaultTeamRuntimeSettings() {
1456
1477
  }
1457
1478
  function createDefaultMemorySettings() {
1458
1479
  return {
1459
- autoAccept: true,
1480
+ reviewKnowledgeUpdates: true,
1460
1481
  runtimeInjection: true,
1461
1482
  staleReview: true,
1462
1483
  lexicalIndex: true,
@@ -1465,6 +1486,9 @@ function createDefaultMemorySettings() {
1465
1486
  }
1466
1487
  function createDefaultEvolutionSettings() {
1467
1488
  return {
1489
+ schedule: {
1490
+ dailyTime: "02:00"
1491
+ },
1468
1492
  automation: {
1469
1493
  knowledge: true,
1470
1494
  semanticKnowledge: false,
@@ -1516,6 +1540,10 @@ function mergeSettings(existing, defaults = createDefaultSettings()) {
1516
1540
  evolution: {
1517
1541
  ...defaults.evolution,
1518
1542
  ...existing.evolution,
1543
+ schedule: {
1544
+ ...defaults.evolution.schedule,
1545
+ ...existing.evolution?.schedule
1546
+ },
1519
1547
  automation: {
1520
1548
  ...defaults.evolution.automation,
1521
1549
  ...existing.evolution?.automation
@@ -1574,8 +1602,12 @@ function parseSettings(value) {
1574
1602
  function parseEvolutionSettings(value, path) {
1575
1603
  const input = expectRecord2(value, path);
1576
1604
  const defaults = createDefaultEvolutionSettings();
1605
+ const schedule = expectRecord2(input.schedule ?? defaults.schedule, `${path}.schedule`);
1577
1606
  const automation = expectRecord2(input.automation ?? defaults.automation, `${path}.automation`);
1578
1607
  return {
1608
+ schedule: {
1609
+ dailyTime: parseDailyTime(schedule.dailyTime ?? defaults.schedule.dailyTime, `${path}.schedule.dailyTime`)
1610
+ },
1579
1611
  automation: {
1580
1612
  knowledge: automation.knowledge === undefined ? defaults.automation.knowledge : expectBoolean(automation.knowledge, `${path}.automation.knowledge`),
1581
1613
  semanticKnowledge: automation.semanticKnowledge === undefined ? defaults.automation.semanticKnowledge : expectBoolean(automation.semanticKnowledge, `${path}.automation.semanticKnowledge`),
@@ -1583,11 +1615,22 @@ function parseEvolutionSettings(value, path) {
1583
1615
  }
1584
1616
  };
1585
1617
  }
1618
+ function parseDailyTime(value, path) {
1619
+ const dailyTime = expectString2(value, path);
1620
+ const match = /^(\d{2}):(\d{2})$/u.exec(dailyTime);
1621
+ if (match === null || Number(match[1]) > 23 || Number(match[2]) > 59) {
1622
+ throw new EvoDevConfigError(`Invalid ${path}; expected a 24-hour HH:MM time`);
1623
+ }
1624
+ return dailyTime;
1625
+ }
1586
1626
  function parseMemorySettings(value, path) {
1587
1627
  const input = expectRecord2(value, path);
1588
1628
  const defaults = createDefaultMemorySettings();
1629
+ if (input.autoAccept !== undefined) {
1630
+ expectBoolean(input.autoAccept, `${path}.autoAccept`);
1631
+ }
1589
1632
  return {
1590
- autoAccept: input.autoAccept === undefined ? defaults.autoAccept : expectBoolean(input.autoAccept, `${path}.autoAccept`),
1633
+ reviewKnowledgeUpdates: input.reviewKnowledgeUpdates === undefined ? defaults.reviewKnowledgeUpdates : expectBoolean(input.reviewKnowledgeUpdates, `${path}.reviewKnowledgeUpdates`),
1591
1634
  runtimeInjection: input.runtimeInjection === undefined ? defaults.runtimeInjection : expectBoolean(input.runtimeInjection, `${path}.runtimeInjection`),
1592
1635
  staleReview: input.staleReview === undefined ? defaults.staleReview : expectBoolean(input.staleReview, `${path}.staleReview`),
1593
1636
  lexicalIndex: input.lexicalIndex === undefined ? defaults.lexicalIndex : expectBoolean(input.lexicalIndex, `${path}.lexicalIndex`),