akm-cli 0.9.17-alpha.8 → 0.9.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +277 -1694
  2. package/STABILITY.md +9 -8
  3. package/dist/assets/hints/cli-hints-full.md +6 -7
  4. package/dist/assets/improve-strategies/catchup.json +0 -3
  5. package/dist/assets/improve-strategies/consolidate.json +0 -1
  6. package/dist/assets/improve-strategies/default.json +1 -2
  7. package/dist/assets/improve-strategies/proactive-maintenance.json +1 -2
  8. package/dist/assets/improve-strategies/quick.json +1 -2
  9. package/dist/assets/improve-strategies/reflect-distill.json +1 -2
  10. package/dist/assets/improve-strategies/thorough.json +0 -3
  11. package/dist/assets/prompts/consolidate-pair.md +20 -0
  12. package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +17 -19
  13. package/dist/assets/stash-skeleton/facts/conventions/domains.md +2 -2
  14. package/dist/assets/templates/html/health.html +3 -5
  15. package/dist/cli/retired-commands.js +1 -1
  16. package/dist/cli/unknown-flags.js +24 -1
  17. package/dist/cli.js +46 -1
  18. package/dist/commands/health/archive-usage.js +92 -0
  19. package/dist/commands/health/data-dir-usage.js +25 -13
  20. package/dist/commands/health/html-report.js +1 -4
  21. package/dist/commands/health/improve-metrics.js +25 -37
  22. package/dist/commands/health/md-report.js +1 -6
  23. package/dist/commands/health/report-view-model.js +4 -14
  24. package/dist/commands/health/windows.js +0 -1
  25. package/dist/commands/health.js +13 -0
  26. package/dist/commands/improve/consolidate/continuity-check.js +137 -0
  27. package/dist/commands/improve/consolidate/pair-pass.js +791 -0
  28. package/dist/commands/improve/consolidate.js +38 -63
  29. package/dist/commands/improve/extract-prompt.js +1 -2
  30. package/dist/commands/improve/improve-cli.js +1 -1
  31. package/dist/commands/improve/improve-strategies.js +23 -5
  32. package/dist/commands/improve/improve.js +19 -30
  33. package/dist/commands/improve/ledger.js +3 -2
  34. package/dist/commands/improve/loop-stages.js +5 -85
  35. package/dist/commands/improve/memory/memory-belief.js +3 -1
  36. package/dist/commands/improve/memory/memory-improve.js +262 -11
  37. package/dist/commands/improve/planner.js +0 -5
  38. package/dist/commands/improve/preparation.js +20 -135
  39. package/dist/commands/improve/retrieval-scope.js +19 -4
  40. package/dist/commands/improve/salience.js +1 -14
  41. package/dist/commands/improve/stage.js +0 -1
  42. package/dist/commands/lint/base-linter.js +19 -11
  43. package/dist/commands/proposal/drain.js +8 -1
  44. package/dist/commands/proposal/proposal-cli.js +16 -2
  45. package/dist/commands/proposal/proposal-types.js +7 -0
  46. package/dist/commands/proposal/proposal.js +37 -6
  47. package/dist/commands/proposal/repository.js +613 -4
  48. package/dist/commands/proposal/validators/proposals.js +9 -0
  49. package/dist/commands/read/knowledge.js +3 -2
  50. package/dist/commands/read/show.js +0 -14
  51. package/dist/commands/sources/info.js +122 -18
  52. package/dist/commands/sources/stash-cli.js +23 -3
  53. package/dist/core/bundle-rename.js +1 -7
  54. package/dist/core/config/config-schema.js +8 -1
  55. package/dist/core/config/config.js +23 -48
  56. package/dist/core/config/engine-semantics.js +0 -2
  57. package/dist/core/config/schema/improve-processes.js +17 -42
  58. package/dist/core/config/schema/index-config.js +5 -25
  59. package/dist/core/file-change.js +13 -5
  60. package/dist/core/improve-result.js +22 -6
  61. package/dist/core/improve-types.js +0 -1
  62. package/dist/core/loopback.js +7 -12
  63. package/dist/core/parse.js +13 -16
  64. package/dist/core/state/migrations.js +15 -0
  65. package/dist/core/time.js +0 -20
  66. package/dist/indexer/db/llm-cache.js +2 -2
  67. package/dist/indexer/ensure-index.js +2 -2
  68. package/dist/indexer/index-written-assets.js +2 -3
  69. package/dist/indexer/indexer.js +18 -418
  70. package/dist/indexer/passes/metadata.js +0 -19
  71. package/dist/indexer/walk/walker.js +3 -4
  72. package/dist/llm/client.js +8 -10
  73. package/dist/llm/embedders/remote.js +1 -2
  74. package/dist/llm/feature-gate.js +0 -5
  75. package/dist/output/shapes/helpers.js +20 -4
  76. package/dist/output/text/command-format.js +9 -8
  77. package/dist/output/text/proposal-format.js +47 -1
  78. package/dist/output/text/show-format.js +0 -20
  79. package/dist/scripts/akm-migrate-node.js +923 -950
  80. package/dist/scripts/akm-migrate.js +923 -950
  81. package/dist/setup/steps/connection.js +5 -6
  82. package/dist/setup/steps/platforms.js +2 -2
  83. package/dist/sources/providers/git-stash.js +83 -4
  84. package/dist/storage/repositories/improve-ledger-repository.js +48 -7
  85. package/dist/storage/repositories/index-connection.js +5 -2
  86. package/dist/storage/repositories/index-entries-repository.js +4 -7
  87. package/dist/storage/repositories/index-entry-schema.js +4 -2
  88. package/dist/storage/repositories/index-llm-cache-repository.js +7 -26
  89. package/dist/storage/repositories/index-schema.js +55 -104
  90. package/dist/storage/repositories/proposals-repository.js +61 -0
  91. package/dist/storage/repositories/salience-repository.js +1 -19
  92. package/docs/migration/README.md +1 -1
  93. package/docs/migration/release-notes/0.9.17.md +130 -41
  94. package/docs/migration/release-notes/README.md +7 -0
  95. package/docs/reference/cli.md +27 -21
  96. package/docs/reference/configuration.md +21 -12
  97. package/docs/reference/data-and-telemetry.md +0 -1
  98. package/package.json +1 -1
  99. package/schemas/akm-config.json +0 -342
  100. package/dist/assets/improve-strategies/graph-refresh.json +0 -15
  101. package/dist/assets/prompts/contradiction-judge.md +0 -33
  102. package/dist/assets/prompts/graph-extract-system.md +0 -1
  103. package/dist/assets/prompts/graph-extract-user-prompt.md +0 -35
  104. package/dist/assets/prompts/metadata-enhance-system.md +0 -1
  105. package/dist/assets/tasks/improve/akm-graph-refresh-weekly.yml +0 -4
  106. package/dist/indexer/db/graph-db.js +0 -399
  107. package/dist/indexer/graph/graph-extraction.js +0 -809
  108. package/dist/indexer/graph/graph-related.js +0 -131
  109. package/dist/indexer/graph/graph-types.js +0 -4
  110. package/dist/llm/graph-extract.js +0 -892
  111. package/dist/llm/metadata-enhance.js +0 -95
@@ -27255,7 +27255,8 @@ var STATE_MIGRATION_SAFETY_BY_ID = Object.freeze({
27255
27255
  "025-task-history-vocabulary-backfill": "data-preserving-rebuild",
27256
27256
  "026-proposals-strip-legacy-fragment-refs": "data-preserving-rebuild",
27257
27257
  "027-extract-sessions-seen-harness-rename": "data-preserving-rebuild",
27258
- "028-improve-ledger": "historical-destructive"
27258
+ "028-improve-ledger": "historical-destructive",
27259
+ "029-improve-ledger-content-hash": "additive"
27259
27260
  });
27260
27261
  var STATE_MIGRATIONS = [
27261
27262
  {
@@ -27993,6 +27994,12 @@ var STATE_MIGRATIONS = [
27993
27994
  DROP TABLE IF EXISTS improve_cycle_metrics;
27994
27995
  DROP TABLE IF EXISTS canary_queries;
27995
27996
  `
27997
+ },
27998
+ {
27999
+ id: "029-improve-ledger-content-hash",
28000
+ up: `
28001
+ ALTER TABLE improve_ledger ADD COLUMN content_hash TEXT DEFAULT NULL;
28002
+ `
27996
28003
  }
27997
28004
  ];
27998
28005
  assertMigrationRegistry(STATE_MIGRATIONS);
@@ -28224,7 +28231,6 @@ var BUILTIN_IMPROVE_STRATEGY_NAMES = [
28224
28231
  "default",
28225
28232
  "quick",
28226
28233
  "thorough",
28227
- "graph-refresh",
28228
28234
  "consolidate",
28229
28235
  "catchup",
28230
28236
  "reflect-distill",
@@ -28235,7 +28241,6 @@ var IMPROVE_PROCESS_ENGINE_CAPABILITIES = {
28235
28241
  distill: "llm",
28236
28242
  consolidate: "llm",
28237
28243
  memoryInference: "llm",
28238
- graphExtraction: "llm",
28239
28244
  extract: "llm",
28240
28245
  validation: "llm",
28241
28246
  triage: "runner",
@@ -28322,7 +28327,6 @@ var INTERESTING_DELTA_PATHS = [
28322
28327
  "improve.memoryInference.written",
28323
28328
  "improve.memoryInference.yieldRate",
28324
28329
  "improve.memoryInference.skippedNoFacts",
28325
- "improve.graphExtraction.failures",
28326
28330
  "improve.autoAccept.promoted",
28327
28331
  "improve.autoAccept.validationFailed",
28328
28332
  "improve.coverage.acceptedProposals",
@@ -28369,13 +28373,12 @@ function renderRunsDetailMd(runs) {
28369
28373
  "distill_q/llm-fail/judge/validator/cfg/skip",
28370
28374
  "cons_proc/promo/merge/del",
28371
28375
  "mem_cons/written/skip",
28372
- "graph_f/e/r",
28373
28376
  "orphans",
28374
28377
  "lint_f/fl",
28375
28378
  "result_status"
28376
28379
  ];
28377
28380
  const rows = runs.map((r) => {
28378
- const totalActions = r.actions.reflect.ok + r.actions.reflect.failed + r.actions.reflect.cooldown + r.actions.reflect.skipped + r.actions.distill.queued + r.actions.distill.llmFailed + r.actions.distill.judgeRejected + r.actions.distill.validatorRejected + r.actions.distill.configDisabled + r.actions.distill.skipped + r.actions.memoryPrune + r.actions.memoryInference + r.actions.graphExtraction + r.actions.error;
28381
+ const totalActions = r.actions.reflect.ok + r.actions.reflect.failed + r.actions.reflect.cooldown + r.actions.reflect.skipped + r.actions.distill.queued + r.actions.distill.llmFailed + r.actions.distill.judgeRejected + r.actions.distill.validatorRejected + r.actions.distill.configDisabled + r.actions.distill.skipped + r.actions.memoryPrune + r.actions.memoryInference + r.actions.error;
28379
28382
  return [
28380
28383
  r.startedAt,
28381
28384
  String(r.ok),
@@ -28385,7 +28388,6 @@ function renderRunsDetailMd(runs) {
28385
28388
  `${r.actions.distill.queued}/${r.actions.distill.llmFailed}/${r.actions.distill.judgeRejected}/${r.actions.distill.validatorRejected}/${r.actions.distill.configDisabled}/${r.actions.distill.skipped}`,
28386
28389
  `${r.consolidation.processed}/${r.consolidation.promoted}/${r.consolidation.merged}/${r.consolidation.deleted}`,
28387
28390
  `${r.memoryInference.considered}/${r.memoryInference.written}/${r.memoryInference.skippedNoFacts}`,
28388
- `${r.graphExtraction.extractedFiles}/${r.graphExtraction.entities}/${r.graphExtraction.relations}`,
28389
28391
  String(r.orphansPurged),
28390
28392
  `${r.lintFixed}/${r.lintFlagged}`,
28391
28393
  r.resultStatus ?? "valid"
@@ -28400,8 +28402,6 @@ function renderWindowCompareMd(windows, deltas) {
28400
28402
  const badIfPositive = new Set([
28401
28403
  "improve.actions.reflect.failed",
28402
28404
  "improve.actions.distill.llmFailed",
28403
- "improve.graphExtraction.failures",
28404
- "improve.graphExtraction.nonArrayBatchFailures",
28405
28405
  "improve.wallTime.medianMs",
28406
28406
  "improve.wallTime.p95Ms",
28407
28407
  "improve.memoryInference.skippedNoFacts"
@@ -28522,7 +28522,11 @@ function shapeProposalProducerOutput(result, detail) {
28522
28522
  }
28523
28523
  function shapeProposalEntry(entry, detail) {
28524
28524
  if (detail === "brief") {
28525
- return pickFields(entry, ["id", "ref", "status", "source", "createdAt"]);
28525
+ const retirement = entry.retirement;
28526
+ return {
28527
+ ...pickFields(entry, ["id", "ref", "status", "source", "createdAt"]),
28528
+ ...retirement?.continuityRisk ? { continuityRisk: true } : {}
28529
+ };
28526
28530
  }
28527
28531
  if (detail === "normal") {
28528
28532
  return pickFields(entry, [
@@ -28535,7 +28539,8 @@ function shapeProposalEntry(entry, detail) {
28535
28539
  "updatedAt",
28536
28540
  "confidence",
28537
28541
  "gateDecision",
28538
- "review"
28542
+ "review",
28543
+ "retirement"
28539
28544
  ]);
28540
28545
  }
28541
28546
  return pickFields(entry, [
@@ -28549,7 +28554,11 @@ function shapeProposalEntry(entry, detail) {
28549
28554
  "confidence",
28550
28555
  "gateDecision",
28551
28556
  "payload",
28552
- "review"
28557
+ "review",
28558
+ "retirement",
28559
+ "retiredArchive",
28560
+ "promotionSource",
28561
+ "promotionSourceHash"
28553
28562
  ]);
28554
28563
  }
28555
28564
  function shapeProposalListOutput(result, detail) {
@@ -28796,7 +28805,6 @@ function shapeShowOutput(result, detail, shape = "human") {
28796
28805
  "workflowParameters",
28797
28806
  "steps",
28798
28807
  "keys",
28799
- "related",
28800
28808
  "links",
28801
28809
  ...FRAGMENT_PROVENANCE_FIELDS,
28802
28810
  ...FRAGMENT_CONTEXT_FIELDS
@@ -28818,7 +28826,6 @@ function shapeShowOutput(result, detail, shape = "human") {
28818
28826
  "run",
28819
28827
  "origin",
28820
28828
  "keys",
28821
- "related",
28822
28829
  "links",
28823
28830
  ...FRAGMENT_PROVENANCE_FIELDS,
28824
28831
  ...FRAGMENT_CONTEXT_FIELDS
@@ -28847,7 +28854,6 @@ function shapeShowOutput(result, detail, shape = "human") {
28847
28854
  "cwd",
28848
28855
  "activeRun",
28849
28856
  "keys",
28850
- "related",
28851
28857
  "links",
28852
28858
  ...FRAGMENT_PROVENANCE_FIELDS,
28853
28859
  ...FRAGMENT_CONTEXT_FIELDS,
@@ -29603,11 +29609,17 @@ function formatInfoPlain(r) {
29603
29609
  const lines = [];
29604
29610
  if (r.version)
29605
29611
  lines.push(`version: ${String(r.version)}`);
29612
+ if (typeof r.error === "string")
29613
+ lines.push(`error: ${r.error}`);
29606
29614
  if (r.bundleDir)
29607
29615
  lines.push(`bundleDir: ${String(r.bundleDir)}`);
29608
29616
  if (r.defaultBundle !== undefined) {
29609
29617
  lines.push(`defaultBundle: ${r.defaultBundle === null ? "(none)" : String(r.defaultBundle)}`);
29610
29618
  }
29619
+ if (typeof r.configError === "string")
29620
+ lines.push(`configError: ${r.configError}`);
29621
+ if (typeof r.bundleDirError === "string")
29622
+ lines.push(`bundleDirError: ${r.bundleDirError}`);
29611
29623
  if (Array.isArray(r.assetTypes) && r.assetTypes.length > 0) {
29612
29624
  lines.push(`assetTypes: ${r.assetTypes.join(", ")}`);
29613
29625
  }
@@ -29989,13 +30001,6 @@ Warnings (${warnings.length}):`;
29989
30001
  out += `
29990
30002
  - ${String(message)}`;
29991
30003
  }
29992
- const notices = Array.isArray(indexResult.notices) ? indexResult.notices : [];
29993
- for (const notice of notices) {
29994
- const severity = notice.severity === "info" ? "info" : "warning";
29995
- const field = typeof notice.field === "string" ? ` field=${notice.field}` : "";
29996
- out += `
29997
- notice[${severity}] ${notice.code} adapter=${notice.adapter}${field}` + (notice.message ? `: ${notice.message}` : "");
29998
- }
29999
30004
  const verification = indexResult.verification;
30000
30005
  if (verification?.ok === false && verification.message) {
30001
30006
  out += `
@@ -30410,7 +30415,10 @@ Generate one with \`akm improve <ref>\` or \`akm proposal new <type> <name> --ta
30410
30415
  const created = String(p.createdAt);
30411
30416
  const gate = formatGateDecisionSummary(p.gateDecision);
30412
30417
  const gateSuffix = gate ? ` ${gate}` : "";
30413
- lines.push(`${id} [${status}] ${ref} source=${source} ${created}${gateSuffix}`);
30418
+ const retirement = p.retirement;
30419
+ const flagged = p.continuityRisk === true || Boolean(retirement?.continuityRisk);
30420
+ const continuitySuffix = flagged ? " ⚠ continuity-risk" : "";
30421
+ lines.push(`${id} [${status}] ${ref} source=${source} ${created}${gateSuffix}${continuitySuffix}`);
30414
30422
  }
30415
30423
  return lines.join(`
30416
30424
  `).trimEnd();
@@ -30450,6 +30458,30 @@ function formatProposalShowPlain(r) {
30450
30458
  if (review.decidedAt)
30451
30459
  lines.push(`review.decidedAt: ${String(review.decidedAt)}`);
30452
30460
  }
30461
+ const retirement = p.retirement;
30462
+ if (retirement) {
30463
+ lines.push(`retire: ${String(retirement.retiredRef)} -> ${String(retirement.successorRef)}`);
30464
+ lines.push(`retire.label: ${String(retirement.judgeLabel)} (cosine=${String(retirement.cosine)})`);
30465
+ lines.push(`retire.reason: ${String(retirement.judgeReason)}`);
30466
+ const continuityRisk = retirement.continuityRisk;
30467
+ if (continuityRisk) {
30468
+ const failingQueries = typeof continuityRisk.failingQueries === "number" ? continuityRisk.failingQueries : 0;
30469
+ const unverifiedQueries = typeof continuityRisk.unverifiedQueries === "number" ? continuityRisk.unverifiedQueries : 0;
30470
+ const summary = [];
30471
+ if (failingQueries > 0) {
30472
+ summary.push(`${failingQueries} of the retired asset's own quer${failingQueries === 1 ? "y" : "ies"} would not have found the successor top 10`);
30473
+ }
30474
+ if (unverifiedQueries > 0) {
30475
+ summary.push(`${unverifiedQueries} quer${unverifiedQueries === 1 ? "y" : "ies"} unverified (search failed or used the keyword-only fallback)`);
30476
+ }
30477
+ lines.push(`retire.continuityRisk: ${summary.join("; ")} — excluded from bulk accept`);
30478
+ const ranks = Array.isArray(continuityRisk.ranks) ? continuityRisk.ranks : [];
30479
+ for (const rank of ranks) {
30480
+ const successorRank = rank.successorRank === null || rank.successorRank === undefined ? "absent from top 10" : `#${String(rank.successorRank)}`;
30481
+ lines.push(` - "${String(rank.query)}": retired #${String(rank.retiredRank)}, successor ${successorRank}`);
30482
+ }
30483
+ }
30484
+ }
30453
30485
  const validation = r.validation;
30454
30486
  if (validation) {
30455
30487
  const findings = Array.isArray(validation.findings) ? validation.findings : [];
@@ -30843,19 +30875,6 @@ function formatShowPlain(r, detail) {
30843
30875
  if (r.schemaVersion !== undefined)
30844
30876
  lines.push(`schemaVersion: ${String(r.schemaVersion)}`);
30845
30877
  }
30846
- const related = typeof r.related === "object" && r.related !== null ? r.related : undefined;
30847
- const relatedHits = related && Array.isArray(related.hits) ? related.hits : [];
30848
- if (related) {
30849
- lines.push("");
30850
- lines.push(`related: ${String(related.total ?? relatedHits.length)}`);
30851
- for (const hit of relatedHits) {
30852
- lines.push(` - ${String(hit.type ?? "?")}: ${formatRelatedLabel(hit)}`);
30853
- const shared = Array.isArray(hit.sharedEntities) ? hit.sharedEntities.map(String) : [];
30854
- if (shared.length > 0)
30855
- lines.push(` shared: ${shared.join(", ")}`);
30856
- lines.push(` relationCount: ${String(hit.relationCount ?? 0)}`);
30857
- }
30858
- }
30859
30878
  const links = typeof r.links === "object" && r.links !== null ? r.links : undefined;
30860
30879
  if (links) {
30861
30880
  lines.push("");
@@ -30905,13 +30924,6 @@ function formatShowPlain(r, detail) {
30905
30924
  return lines.length > 0 ? lines.join(`
30906
30925
  `) : null;
30907
30926
  }
30908
- function formatRelatedLabel(hit) {
30909
- const ref = typeof hit.ref === "string" ? hit.ref : undefined;
30910
- if (ref)
30911
- return ref;
30912
- const pathValue = typeof hit.path === "string" ? hit.path : "?";
30913
- return pathValue.split("/").pop() ?? pathValue;
30914
- }
30915
30927
  // src/output/text/workflow-format.ts
30916
30928
  function formatWorkflowListPlain(result) {
30917
30929
  const runs = Array.isArray(result.runs) ? result.runs : [];
@@ -31233,9 +31245,6 @@ var catchup_default = {
31233
31245
  memoryInference: {
31234
31246
  enabled: false
31235
31247
  },
31236
- graphExtraction: {
31237
- enabled: false
31238
- },
31239
31248
  extract: {
31240
31249
  enabled: false
31241
31250
  },
@@ -31267,7 +31276,6 @@ var consolidate_default = {
31267
31276
  distill: { enabled: false },
31268
31277
  consolidate: { enabled: true, allowedTypes: ["memory"], maxChunkSize: 25 },
31269
31278
  memoryInference: { enabled: false },
31270
- graphExtraction: { enabled: false },
31271
31279
  extract: { enabled: false },
31272
31280
  triage: { enabled: false },
31273
31281
  validation: { enabled: false },
@@ -31277,7 +31285,7 @@ var consolidate_default = {
31277
31285
  };
31278
31286
  // src/assets/improve-strategies/default.json
31279
31287
  var default_default = {
31280
- description: "Standard improve pass — reflect, distill, advisory consolidation, graph extraction, and validation. Memory inference is listed below but only runs when experimental.improveAutonomy is set; improve-stage extract and proactive maintenance off.",
31288
+ description: "Standard improve pass — reflect, distill, consolidation (promotion plus the reviewed pair-pass retire/supersede proposals), and validation. Memory inference is listed below but only runs when experimental.improveAutonomy is set; improve-stage extract and proactive maintenance off.",
31281
31289
  processes: {
31282
31290
  reflect: {
31283
31291
  enabled: true,
@@ -31287,7 +31295,6 @@ var default_default = {
31287
31295
  distill: { enabled: true, allowedTypes: ["memory"], requirePlannedRefs: true },
31288
31296
  consolidate: { enabled: true, allowedTypes: ["memory"] },
31289
31297
  memoryInference: { enabled: true },
31290
- graphExtraction: { enabled: true },
31291
31298
  extract: { enabled: false, triage: { enabled: true, minScore: 2 } },
31292
31299
  validation: { enabled: true },
31293
31300
  proactiveMaintenance: { enabled: false, dueDays: 30, maxPerRun: 15 },
@@ -31295,25 +31302,9 @@ var default_default = {
31295
31302
  },
31296
31303
  sync: { enabled: true, push: true }
31297
31304
  };
31298
- // src/assets/improve-strategies/graph-refresh.json
31299
- var graph_refresh_default = {
31300
- description: "Full-corpus graph extraction pass — rebuilds graph relationships across all stash files. Disables all other sub-processes. Use via `akm improve --strategy graph-refresh` or the embedded `graph-refresh-weekly` task.",
31301
- processes: {
31302
- reflect: { enabled: false },
31303
- distill: { enabled: false },
31304
- consolidate: { enabled: false },
31305
- memoryInference: { enabled: false },
31306
- graphExtraction: { enabled: true, fullScan: true },
31307
- extract: { enabled: false },
31308
- triage: { enabled: false },
31309
- validation: { enabled: false },
31310
- proactiveMaintenance: { enabled: false }
31311
- },
31312
- sync: { enabled: true, push: true }
31313
- };
31314
31305
  // src/assets/improve-strategies/proactive-maintenance.json
31315
31306
  var proactive_maintenance_default = {
31316
- description: "Opt-in proactive-maintenance pass — reflect, distill, proposal triage (promote, high budget), and the proactive-maintenance lane (maxPerRun 100); consolidate/memoryInference/graphExtraction/extract off. Sync disabled: an interrupted run would otherwise leave an uncommitted backlog.",
31307
+ description: "Opt-in proactive-maintenance pass — reflect, distill, proposal triage (promote, high budget), and the proactive-maintenance lane (maxPerRun 100); consolidate/memoryInference/extract off. Sync disabled: an interrupted run would otherwise leave an uncommitted backlog.",
31317
31308
  processes: {
31318
31309
  reflect: {
31319
31310
  enabled: true,
@@ -31322,7 +31313,6 @@ var proactive_maintenance_default = {
31322
31313
  distill: { enabled: true, allowedTypes: ["memory"] },
31323
31314
  consolidate: { enabled: false },
31324
31315
  memoryInference: { enabled: false },
31325
- graphExtraction: { enabled: false },
31326
31316
  extract: { enabled: false },
31327
31317
  validation: { enabled: false },
31328
31318
  triage: {
@@ -31339,7 +31329,7 @@ var proactive_maintenance_default = {
31339
31329
  };
31340
31330
  // src/assets/improve-strategies/quick.json
31341
31331
  var quick_default = {
31342
- description: "Reflect-only pass — no extract, distill, consolidate, memoryInference, or graphExtraction.",
31332
+ description: "Reflect-only pass — no extract, distill, consolidate, or memoryInference.",
31343
31333
  processes: {
31344
31334
  reflect: {
31345
31335
  enabled: true,
@@ -31349,7 +31339,6 @@ var quick_default = {
31349
31339
  distill: { enabled: false },
31350
31340
  consolidate: { enabled: false },
31351
31341
  memoryInference: { enabled: false },
31352
- graphExtraction: { enabled: false },
31353
31342
  triage: { enabled: false },
31354
31343
  validation: { enabled: false },
31355
31344
  proactiveMaintenance: { enabled: false }
@@ -31358,7 +31347,7 @@ var quick_default = {
31358
31347
  };
31359
31348
  // src/assets/improve-strategies/reflect-distill.json
31360
31349
  var reflect_distill_default = {
31361
- description: "Reflect + distill pass — reflect, distill, memoryInference, and proposal triage (promote); proactiveMaintenance/consolidate/graphExtraction/extract off. Sync disabled: an interrupted run would otherwise leave an uncommitted backlog.",
31350
+ description: "Reflect + distill pass — reflect, distill, memoryInference, and proposal triage (promote); proactiveMaintenance/consolidate/extract off. Sync disabled: an interrupted run would otherwise leave an uncommitted backlog.",
31362
31351
  processes: {
31363
31352
  reflect: {
31364
31353
  enabled: true,
@@ -31367,7 +31356,6 @@ var reflect_distill_default = {
31367
31356
  distill: { enabled: true, allowedTypes: ["memory"], requirePlannedRefs: false },
31368
31357
  consolidate: { enabled: false },
31369
31358
  memoryInference: { enabled: true },
31370
- graphExtraction: { enabled: false },
31371
31359
  extract: {
31372
31360
  enabled: false,
31373
31361
  timeoutMs: 300000,
@@ -31408,9 +31396,6 @@ var thorough_default = {
31408
31396
  memoryInference: {
31409
31397
  enabled: true
31410
31398
  },
31411
- graphExtraction: {
31412
- enabled: true
31413
- },
31414
31399
  extract: {
31415
31400
  enabled: false,
31416
31401
  triage: {
@@ -31441,607 +31426,134 @@ var thorough_default = {
31441
31426
  }
31442
31427
  };
31443
31428
 
31444
- // src/core/config/config.ts
31445
- import fs10 from "node:fs";
31446
- import os2 from "node:os";
31447
- import path14 from "node:path";
31448
- import { isDeepStrictEqual } from "node:util";
31429
+ // node_modules/zod/v3/external.js
31430
+ var exports_external = {};
31431
+ __export(exports_external, {
31432
+ void: () => voidType,
31433
+ util: () => util,
31434
+ unknown: () => unknownType,
31435
+ union: () => unionType,
31436
+ undefined: () => undefinedType,
31437
+ tuple: () => tupleType,
31438
+ transformer: () => effectsType,
31439
+ symbol: () => symbolType,
31440
+ string: () => stringType,
31441
+ strictObject: () => strictObjectType,
31442
+ setErrorMap: () => setErrorMap,
31443
+ set: () => setType,
31444
+ record: () => recordType,
31445
+ quotelessJson: () => quotelessJson,
31446
+ promise: () => promiseType,
31447
+ preprocess: () => preprocessType,
31448
+ pipeline: () => pipelineType,
31449
+ ostring: () => ostring,
31450
+ optional: () => optionalType,
31451
+ onumber: () => onumber,
31452
+ oboolean: () => oboolean,
31453
+ objectUtil: () => objectUtil,
31454
+ object: () => objectType,
31455
+ number: () => numberType,
31456
+ nullable: () => nullableType,
31457
+ null: () => nullType,
31458
+ never: () => neverType,
31459
+ nativeEnum: () => nativeEnumType,
31460
+ nan: () => nanType,
31461
+ map: () => mapType,
31462
+ makeIssue: () => makeIssue,
31463
+ literal: () => literalType,
31464
+ lazy: () => lazyType,
31465
+ late: () => late,
31466
+ isValid: () => isValid,
31467
+ isDirty: () => isDirty,
31468
+ isAsync: () => isAsync,
31469
+ isAborted: () => isAborted,
31470
+ intersection: () => intersectionType,
31471
+ instanceof: () => instanceOfType,
31472
+ getParsedType: () => getParsedType,
31473
+ getErrorMap: () => getErrorMap,
31474
+ function: () => functionType,
31475
+ enum: () => enumType,
31476
+ effect: () => effectsType,
31477
+ discriminatedUnion: () => discriminatedUnionType,
31478
+ defaultErrorMap: () => en_default,
31479
+ datetimeRegex: () => datetimeRegex,
31480
+ date: () => dateType,
31481
+ custom: () => custom,
31482
+ coerce: () => coerce,
31483
+ boolean: () => booleanType,
31484
+ bigint: () => bigIntType,
31485
+ array: () => arrayType,
31486
+ any: () => anyType,
31487
+ addIssueToContext: () => addIssueToContext,
31488
+ ZodVoid: () => ZodVoid,
31489
+ ZodUnknown: () => ZodUnknown,
31490
+ ZodUnion: () => ZodUnion,
31491
+ ZodUndefined: () => ZodUndefined,
31492
+ ZodType: () => ZodType,
31493
+ ZodTuple: () => ZodTuple,
31494
+ ZodTransformer: () => ZodEffects,
31495
+ ZodSymbol: () => ZodSymbol,
31496
+ ZodString: () => ZodString,
31497
+ ZodSet: () => ZodSet,
31498
+ ZodSchema: () => ZodType,
31499
+ ZodRecord: () => ZodRecord,
31500
+ ZodReadonly: () => ZodReadonly,
31501
+ ZodPromise: () => ZodPromise,
31502
+ ZodPipeline: () => ZodPipeline,
31503
+ ZodParsedType: () => ZodParsedType,
31504
+ ZodOptional: () => ZodOptional,
31505
+ ZodObject: () => ZodObject,
31506
+ ZodNumber: () => ZodNumber,
31507
+ ZodNullable: () => ZodNullable,
31508
+ ZodNull: () => ZodNull,
31509
+ ZodNever: () => ZodNever,
31510
+ ZodNativeEnum: () => ZodNativeEnum,
31511
+ ZodNaN: () => ZodNaN,
31512
+ ZodMap: () => ZodMap,
31513
+ ZodLiteral: () => ZodLiteral,
31514
+ ZodLazy: () => ZodLazy,
31515
+ ZodIssueCode: () => ZodIssueCode,
31516
+ ZodIntersection: () => ZodIntersection,
31517
+ ZodFunction: () => ZodFunction,
31518
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
31519
+ ZodError: () => ZodError,
31520
+ ZodEnum: () => ZodEnum,
31521
+ ZodEffects: () => ZodEffects,
31522
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
31523
+ ZodDefault: () => ZodDefault,
31524
+ ZodDate: () => ZodDate,
31525
+ ZodCatch: () => ZodCatch,
31526
+ ZodBranded: () => ZodBranded,
31527
+ ZodBoolean: () => ZodBoolean,
31528
+ ZodBigInt: () => ZodBigInt,
31529
+ ZodArray: () => ZodArray,
31530
+ ZodAny: () => ZodAny,
31531
+ Schema: () => ZodType,
31532
+ ParseStatus: () => ParseStatus,
31533
+ OK: () => OK,
31534
+ NEVER: () => NEVER,
31535
+ INVALID: () => INVALID,
31536
+ EMPTY_PATH: () => EMPTY_PATH,
31537
+ DIRTY: () => DIRTY,
31538
+ BRAND: () => BRAND
31539
+ });
31449
31540
 
31450
- // src/core/extra-params.ts
31451
- var EXTRA_PARAMS_PROTECTED_TOP_LEVEL_KEYS = [
31452
- "model",
31453
- "messages",
31454
- "temperature",
31455
- "maxtokens",
31456
- "responseformat",
31457
- "stream",
31458
- "streamoptions",
31459
- "enablethinking",
31460
- "reasoningeffort",
31461
- "chattemplatekwargs"
31462
- ];
31463
- var EXTRA_PARAMS_CREDENTIAL_KEYS = [
31464
- "authorization",
31465
- "headers",
31466
- "apikey",
31467
- "token",
31468
- "password",
31469
- "secret",
31470
- "cookie",
31471
- "setcookie"
31472
- ];
31473
- var PROTECTED_TOP_LEVEL_KEYS = new Set(EXTRA_PARAMS_PROTECTED_TOP_LEVEL_KEYS);
31474
- var CREDENTIAL_KEYS = new Set(EXTRA_PARAMS_CREDENTIAL_KEYS);
31475
- var LEGACY_EXTRA_PARAMS_FIELD = {
31476
- model: "model",
31477
- temperature: "temperature",
31478
- maxtokens: "maxTokens",
31479
- enablethinking: "enableThinking",
31480
- reasoningeffort: "reasoningEffort"
31481
- };
31482
- var LIFTABLE_EXTRA_PARAMS_KEYS = new Set(["temperature", "maxtokens", "enablethinking", "reasoningeffort"]);
31483
- var EXTRA_PARAMS_NO_FIELD_REMEDY = {
31484
- messages: "AKM builds the request messages internally — remove it from extraParams",
31485
- responseformat: "AKM controls the response format internally — remove it from extraParams",
31486
- stream: "AKM controls streaming internally — remove it from extraParams",
31487
- streamoptions: "AKM controls streaming internally — remove it from extraParams",
31488
- chattemplatekwargs: "set engines.<name>.enableThinking instead of chat_template_kwargs.enable_thinking"
31489
- };
31490
- function protectedKeyRemedy(normalized) {
31491
- const field = LEGACY_EXTRA_PARAMS_FIELD[normalized];
31492
- if (field) {
31493
- const note = normalized === "reasoningeffort" ? " (moved to a first-class field in 0.9.2)" : "";
31494
- return `set engines.<name>.${field} instead${note}`;
31495
- }
31496
- return EXTRA_PARAMS_NO_FIELD_REMEDY[normalized];
31497
- }
31498
- function normalizeExtraParamKey(key) {
31499
- return key.toLowerCase().replace(/[^a-z0-9]/g, "");
31500
- }
31501
- function validateExtraParams(value) {
31502
- if (!value || typeof value !== "object" || Array.isArray(value)) {
31503
- return [{ path: [], message: "must be an object" }];
31541
+ // node_modules/zod/v3/helpers/util.js
31542
+ var util;
31543
+ (function(util2) {
31544
+ util2.assertEqual = (_) => {};
31545
+ function assertIs(_arg) {}
31546
+ util2.assertIs = assertIs;
31547
+ function assertNever2(_x) {
31548
+ throw new Error;
31504
31549
  }
31505
- const issues = [];
31506
- const seen = new WeakSet;
31507
- const visit2 = (entry, path12) => {
31508
- if (Array.isArray(entry)) {
31509
- if (seen.has(entry))
31510
- return;
31511
- seen.add(entry);
31512
- entry.forEach((child, index) => {
31513
- visit2(child, [...path12, index]);
31514
- });
31515
- return;
31516
- }
31517
- if (!entry || typeof entry !== "object")
31518
- return;
31519
- if (seen.has(entry))
31520
- return;
31521
- seen.add(entry);
31522
- for (const [key, child] of Object.entries(entry)) {
31523
- const normalized = normalizeExtraParamKey(key);
31524
- if (path12.length === 0 && PROTECTED_TOP_LEVEL_KEYS.has(normalized)) {
31525
- const remedy = protectedKeyRemedy(normalized);
31526
- issues.push({
31527
- path: [key],
31528
- message: remedy ? `${key} is protected by AKM — ${remedy}.` : `${key} is protected by AKM`
31529
- });
31530
- }
31531
- if (CREDENTIAL_KEYS.has(normalized)) {
31532
- issues.push({ path: [...path12, key], message: `${key} cannot carry credentials` });
31533
- }
31534
- visit2(child, [...path12, key]);
31550
+ util2.assertNever = assertNever2;
31551
+ util2.arrayToEnum = (items) => {
31552
+ const obj = {};
31553
+ for (const item of items) {
31554
+ obj[item] = item;
31535
31555
  }
31536
- };
31537
- visit2(value, []);
31538
- return issues;
31539
- }
31540
- function formatExtraParamsIssue(label, issue) {
31541
- const suffix = issue.path.map((part) => typeof part === "number" ? `[${part}]` : `.${part}`).join("");
31542
- return `${label}${suffix} ${issue.message}`;
31543
- }
31544
- function liftLegacyEngineExtraParams(raw) {
31545
- const lifted = [];
31546
- const conflicts = [];
31547
- const rawEngines = raw.engines;
31548
- if (!isRecord(rawEngines)) {
31549
- return { config: raw, lifted, conflicts };
31550
- }
31551
- const engines = {};
31552
- let anyEngineChanged = false;
31553
- for (const [name, engineValue] of Object.entries(rawEngines)) {
31554
- if (!isRecord(engineValue) || !isRecord(engineValue.extraParams)) {
31555
- engines[name] = engineValue;
31556
- continue;
31557
- }
31558
- const engine = { ...engineValue };
31559
- const extraParams = { ...engineValue.extraParams };
31560
- let engineChanged = false;
31561
- for (const [rawKey, value] of Object.entries(engineValue.extraParams)) {
31562
- const normalized = normalizeExtraParamKey(rawKey);
31563
- if (!LIFTABLE_EXTRA_PARAMS_KEYS.has(normalized))
31564
- continue;
31565
- const field = LEGACY_EXTRA_PARAMS_FIELD[normalized];
31566
- if (!field)
31567
- continue;
31568
- const existing = engine[field];
31569
- if (existing !== undefined && existing !== value) {
31570
- conflicts.push({ engine: name, key: rawKey, field, extraParamsValue: value, fieldValue: existing });
31571
- continue;
31572
- }
31573
- delete extraParams[rawKey];
31574
- engineChanged = true;
31575
- if (existing === value) {
31576
- lifted.push(`engines.${name}.extraParams.${rawKey} is redundant — engines.${name}.${field} is already set to the same value; dropped the extraParams entry`);
31577
- continue;
31578
- }
31579
- engine[field] = value;
31580
- lifted.push(`engines.${name}.extraParams.${rawKey} -> engines.${name}.${field}`);
31581
- }
31582
- if (!engineChanged) {
31583
- engines[name] = engineValue;
31584
- continue;
31585
- }
31586
- anyEngineChanged = true;
31587
- if (Object.keys(extraParams).length > 0) {
31588
- engine.extraParams = extraParams;
31589
- } else {
31590
- delete engine.extraParams;
31591
- }
31592
- engines[name] = engine;
31593
- }
31594
- if (!anyEngineChanged) {
31595
- return { config: raw, lifted, conflicts };
31596
- }
31597
- return { config: { ...raw, engines }, lifted, conflicts };
31598
- }
31599
-
31600
- // src/core/config/config-io.ts
31601
- import fs8 from "node:fs";
31602
- import path12 from "node:path";
31603
-
31604
- // src/core/file-lock.ts
31605
- import { randomUUID } from "node:crypto";
31606
- import fs7 from "node:fs";
31607
- function readLockSnapshot(lockPath) {
31608
- let fd;
31609
- try {
31610
- fd = fs7.openSync(lockPath, "r");
31611
- } catch (err) {
31612
- if (err.code === "ENOENT")
31613
- return;
31614
- throw err;
31615
- }
31616
- try {
31617
- const rawContent = readTextFileDescriptorWithLimit(fd, MAX_LOCK_METADATA_BYTES, "Lock metadata", lockPath);
31618
- const stat = fs7.fstatSync(fd);
31619
- return {
31620
- rawContent,
31621
- identity: { dev: stat.dev, ino: stat.ino, size: stat.size, mtimeMs: stat.mtimeMs }
31622
- };
31623
- } finally {
31624
- fs7.closeSync(fd);
31625
- }
31626
- }
31627
- function sameIdentity(left, right) {
31628
- return left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs;
31629
- }
31630
- function releaseLockRaw(lockPath) {
31631
- try {
31632
- fs7.unlinkSync(lockPath);
31633
- } catch {}
31634
- }
31635
- function tryAcquireLockSync(lockPath, payload) {
31636
- try {
31637
- fs7.writeFileSync(lockPath, payload, { flag: "wx" });
31638
- } catch (err) {
31639
- if (err.code === "EEXIST")
31640
- return;
31641
- throw err;
31642
- }
31643
- let snapshot;
31644
- try {
31645
- snapshot = readLockSnapshot(lockPath);
31646
- } catch (error2) {
31647
- releaseLockRaw(lockPath);
31648
- throw error2;
31649
- }
31650
- if (!snapshot) {
31651
- releaseLockRaw(lockPath);
31652
- throw new Error(`Could not read newly acquired lock at ${lockPath}.`);
31653
- }
31654
- return { lockPath, ...snapshot };
31655
- }
31656
- function launcherPidFromEnv() {
31657
- const raw = process.env.AKM_LAUNCHER_PID;
31658
- if (!raw)
31659
- return;
31660
- const pid = Number.parseInt(raw, 10);
31661
- return Number.isInteger(pid) && pid > 0 ? pid : undefined;
31662
- }
31663
- function createLockPayload(metadata = {}) {
31664
- const launcherPid = launcherPidFromEnv();
31665
- return JSON.stringify({
31666
- ...metadata,
31667
- pid: process.pid,
31668
- ...launcherPid !== undefined ? { launcherPid } : {},
31669
- lockId: randomUUID()
31670
- });
31671
- }
31672
- function probeLock(lockPath, opts) {
31673
- let snapshot;
31674
- try {
31675
- snapshot = readLockSnapshot(lockPath);
31676
- } catch (error2) {
31677
- const code = error2?.code;
31678
- if (code === "EACCES" || code === "EPERM")
31679
- return { state: "inaccessible", code };
31680
- return { state: "stale", reason: "unreadable" };
31681
- }
31682
- if (!snapshot)
31683
- return { state: "absent" };
31684
- const { rawContent, identity: identity3 } = snapshot;
31685
- const ageMs = Date.now() - identity3.mtimeMs;
31686
- const { holderPid, launcherPid } = extractLockIdentity(rawContent);
31687
- if (holderPid === undefined) {
31688
- return { state: "stale", reason: "invalid_pid", ageMs, rawContent, identity: identity3 };
31689
- }
31690
- if (!isProcessAlive(holderPid)) {
31691
- return { state: "stale", reason: "pid_dead", holderPid, launcherPid, ageMs, rawContent, identity: identity3 };
31692
- }
31693
- if (opts?.staleAfterMs !== undefined && ageMs > opts.staleAfterMs) {
31694
- return { state: "stale", reason: "age_exceeded", holderPid, launcherPid, ageMs, rawContent, identity: identity3 };
31695
- }
31696
- return { state: "held", holderPid, launcherPid, ageMs, rawContent, identity: identity3 };
31697
- }
31698
- function reclaimStaleLock(lockPath, probe, options) {
31699
- if (probe.rawContent === undefined || probe.identity === undefined)
31700
- return false;
31701
- const expectedContent = probe.rawContent;
31702
- const expectedIdentity = probe.identity;
31703
- let current;
31704
- try {
31705
- current = readLockSnapshot(lockPath);
31706
- } catch {
31707
- return false;
31708
- }
31709
- if (!current || current.rawContent !== expectedContent || !sameIdentity(current.identity, expectedIdentity)) {
31710
- return false;
31711
- }
31712
- const quarantinePath = `${lockPath}.stale-${process.pid}-${randomUUID()}`;
31713
- try {
31714
- fs7.renameSync(lockPath, quarantinePath);
31715
- } catch (err) {
31716
- if (err.code === "ENOENT")
31717
- return false;
31718
- throw err;
31719
- }
31720
- let quarantined;
31721
- try {
31722
- quarantined = readLockSnapshot(quarantinePath);
31723
- } catch {
31724
- quarantined = undefined;
31725
- }
31726
- if (!quarantined || quarantined.rawContent !== expectedContent || !sameIdentity(quarantined.identity, expectedIdentity)) {
31727
- try {
31728
- fs7.linkSync(quarantinePath, lockPath);
31729
- } catch (err) {
31730
- if (err.code !== "EEXIST")
31731
- throw err;
31732
- }
31733
- releaseLockRaw(quarantinePath);
31734
- return false;
31735
- }
31736
- options?.afterQuarantineVerified?.();
31737
- try {
31738
- fs7.unlinkSync(quarantinePath);
31739
- return true;
31740
- } catch (err) {
31741
- if (err.code === "ENOENT")
31742
- return false;
31743
- throw err;
31744
- }
31745
- }
31746
- function releaseLock(ownership) {
31747
- const { lockPath } = ownership;
31748
- let current;
31749
- try {
31750
- current = readLockSnapshot(lockPath);
31751
- } catch {
31752
- return;
31753
- }
31754
- if (current && current.rawContent === ownership.rawContent && sameIdentity(current.identity, ownership.identity)) {
31755
- releaseLockRaw(lockPath);
31756
- }
31757
- }
31758
- function extractLockIdentity(content) {
31759
- const trimmed = content.trim();
31760
- if (!trimmed)
31761
- return {};
31762
- if (trimmed.startsWith("{")) {
31763
- try {
31764
- const parsed = JSON.parse(trimmed);
31765
- const pid2 = typeof parsed.pid === "number" ? parsed.pid : Number.NaN;
31766
- const rawLauncherPid = typeof parsed.launcherPid === "number" ? parsed.launcherPid : Number.NaN;
31767
- return {
31768
- holderPid: Number.isInteger(pid2) && pid2 > 0 ? pid2 : undefined,
31769
- launcherPid: Number.isInteger(rawLauncherPid) && rawLauncherPid > 0 ? rawLauncherPid : undefined
31770
- };
31771
- } catch {
31772
- return {};
31773
- }
31774
- }
31775
- const pid = Number.parseInt(trimmed, 10);
31776
- return { holderPid: Number.isInteger(pid) && pid > 0 ? pid : undefined };
31777
- }
31778
-
31779
- // src/core/config/config-io.ts
31780
- function readConfigText(configPath) {
31781
- try {
31782
- return readTextFile(configPath, "Config file");
31783
- } catch (err) {
31784
- if (err.code === "ENOENT")
31785
- return;
31786
- throw err;
31787
- }
31788
- }
31789
- function parseConfigText(text, sourcePath) {
31790
- const stripped = stripJsonComments(text);
31791
- const where = sourcePath ? ` at ${sourcePath}` : "";
31792
- let parsed;
31793
- try {
31794
- parsed = JSON.parse(stripped);
31795
- } catch (err) {
31796
- const detail = err instanceof Error ? err.message : String(err);
31797
- throw new ConfigError(`Failed to parse config JSON${where}: ${detail}`, "INVALID_CONFIG_FILE", "Edit the file to fix the JSON syntax error. Comments (// and /* */) are allowed; trailing commas are not.");
31798
- }
31799
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
31800
- throw new ConfigError(`Config file${where} must contain a JSON object at the root, got ${describeJsonRoot(parsed)}.`, "INVALID_CONFIG_FILE");
31801
- }
31802
- return parsed;
31803
- }
31804
- function describeJsonRoot(value) {
31805
- if (value === null)
31806
- return "null";
31807
- if (Array.isArray(value))
31808
- return "an array";
31809
- if (typeof value === "string")
31810
- return "a string";
31811
- if (typeof value === "number")
31812
- return "a number";
31813
- if (typeof value === "boolean")
31814
- return "a boolean";
31815
- return typeof value;
31816
- }
31817
- function writeConfigAtomic(configPath, config) {
31818
- writeFileAtomic(configPath, `${JSON.stringify(config, null, 2)}
31819
- `);
31820
- }
31821
- var MAX_CONFIG_BACKUPS = 5;
31822
- function backupExistingConfig(configPath, now = new Date) {
31823
- if (!fs8.existsSync(configPath))
31824
- return;
31825
- const backupDir = path12.join(getCacheDir(), "config-backups");
31826
- fs8.mkdirSync(backupDir, { recursive: true, mode: 448 });
31827
- fs8.chmodSync(backupDir, 448);
31828
- const timestamp = now.toISOString().replace(/[.:]/g, "-");
31829
- let sequence = 0;
31830
- let timestamped;
31831
- while (true) {
31832
- timestamped = path12.join(backupDir, `config-${timestamp}${sequence === 0 ? "" : `-${sequence}`}.json`);
31833
- try {
31834
- fs8.copyFileSync(configPath, timestamped, fs8.constants.COPYFILE_EXCL);
31835
- break;
31836
- } catch (error2) {
31837
- if (error2.code !== "EEXIST")
31838
- throw error2;
31839
- sequence++;
31840
- }
31841
- }
31842
- const latest = path12.join(backupDir, "config.latest.json");
31843
- fs8.copyFileSync(configPath, latest);
31844
- fs8.chmodSync(timestamped, 384);
31845
- fs8.chmodSync(latest, 384);
31846
- pruneOldBackups(backupDir);
31847
- return { timestamped, latest };
31848
- }
31849
- function pruneOldBackups(backupDir) {
31850
- pruneToNewest(backupDir, MAX_CONFIG_BACKUPS, (entry) => entry.isFile() && isTimestampedConfigBackup(entry.name));
31851
- }
31852
- function isTimestampedConfigBackup(name) {
31853
- return name.startsWith("config-") && name.endsWith(".json") && name !== "config.latest.json";
31854
- }
31855
- function pruneToNewest(dir, keep, select) {
31856
- let entries;
31857
- try {
31858
- entries = fs8.readdirSync(dir, { withFileTypes: true });
31859
- } catch {
31860
- return;
31861
- }
31862
- const candidates = entries.filter(select).map((entry) => {
31863
- const full = path12.join(dir, entry.name);
31864
- let mtime = 0;
31865
- try {
31866
- mtime = fs8.statSync(full).mtimeMs;
31867
- } catch {}
31868
- return { path: full, mtime };
31869
- }).sort((a, b) => b.mtime - a.mtime);
31870
- for (const stale of candidates.slice(keep)) {
31871
- try {
31872
- fs8.rmSync(stale.path, { recursive: true, force: true });
31873
- } catch {}
31874
- }
31875
- }
31876
- function getConfigLockPath() {
31877
- return path12.join(getConfigDir(), "config.json.lck");
31878
- }
31879
- var CONFIG_LOCK_MAX_RETRIES = 40;
31880
- var CONFIG_LOCK_RETRY_DELAY_MS = 50;
31881
- function sleepSyncMs(ms) {
31882
- sleepSync(ms);
31883
- }
31884
- function acquireConfigLock() {
31885
- const lockPath = getConfigLockPath();
31886
- try {
31887
- fs8.mkdirSync(path12.dirname(lockPath), { recursive: true });
31888
- } catch {}
31889
- for (let attempt = 0;attempt < CONFIG_LOCK_MAX_RETRIES; attempt++) {
31890
- try {
31891
- const ownership = tryAcquireLockSync(lockPath, createLockPayload());
31892
- if (ownership) {
31893
- return () => releaseLock(ownership);
31894
- }
31895
- } catch (error2) {
31896
- throw new ConfigError(`Unable to acquire config lock at ${lockPath}: ${error2 instanceof Error ? error2.message : String(error2)}`, "INVALID_CONFIG_FILE");
31897
- }
31898
- const probe = probeLock(lockPath);
31899
- if (probe.state === "stale" && reclaimStaleLock(lockPath, probe)) {
31900
- continue;
31901
- }
31902
- if (attempt < CONFIG_LOCK_MAX_RETRIES - 1) {
31903
- sleepSyncMs(CONFIG_LOCK_RETRY_DELAY_MS);
31904
- }
31905
- }
31906
- throw new ConfigError(`Timed out waiting for config lock at ${lockPath}. Another AKM process may be updating config.`, "INVALID_CONFIG_FILE");
31907
- }
31908
- function withConfigLock(fn) {
31909
- const release = acquireConfigLock();
31910
- try {
31911
- return fn();
31912
- } finally {
31913
- release();
31914
- }
31915
- }
31916
-
31917
- // node_modules/zod/v3/external.js
31918
- var exports_external = {};
31919
- __export(exports_external, {
31920
- void: () => voidType,
31921
- util: () => util,
31922
- unknown: () => unknownType,
31923
- union: () => unionType,
31924
- undefined: () => undefinedType,
31925
- tuple: () => tupleType,
31926
- transformer: () => effectsType,
31927
- symbol: () => symbolType,
31928
- string: () => stringType,
31929
- strictObject: () => strictObjectType,
31930
- setErrorMap: () => setErrorMap,
31931
- set: () => setType,
31932
- record: () => recordType,
31933
- quotelessJson: () => quotelessJson,
31934
- promise: () => promiseType,
31935
- preprocess: () => preprocessType,
31936
- pipeline: () => pipelineType,
31937
- ostring: () => ostring,
31938
- optional: () => optionalType,
31939
- onumber: () => onumber,
31940
- oboolean: () => oboolean,
31941
- objectUtil: () => objectUtil,
31942
- object: () => objectType,
31943
- number: () => numberType,
31944
- nullable: () => nullableType,
31945
- null: () => nullType,
31946
- never: () => neverType,
31947
- nativeEnum: () => nativeEnumType,
31948
- nan: () => nanType,
31949
- map: () => mapType,
31950
- makeIssue: () => makeIssue,
31951
- literal: () => literalType,
31952
- lazy: () => lazyType,
31953
- late: () => late,
31954
- isValid: () => isValid,
31955
- isDirty: () => isDirty,
31956
- isAsync: () => isAsync,
31957
- isAborted: () => isAborted,
31958
- intersection: () => intersectionType,
31959
- instanceof: () => instanceOfType,
31960
- getParsedType: () => getParsedType,
31961
- getErrorMap: () => getErrorMap,
31962
- function: () => functionType,
31963
- enum: () => enumType,
31964
- effect: () => effectsType,
31965
- discriminatedUnion: () => discriminatedUnionType,
31966
- defaultErrorMap: () => en_default,
31967
- datetimeRegex: () => datetimeRegex,
31968
- date: () => dateType,
31969
- custom: () => custom,
31970
- coerce: () => coerce,
31971
- boolean: () => booleanType,
31972
- bigint: () => bigIntType,
31973
- array: () => arrayType,
31974
- any: () => anyType,
31975
- addIssueToContext: () => addIssueToContext,
31976
- ZodVoid: () => ZodVoid,
31977
- ZodUnknown: () => ZodUnknown,
31978
- ZodUnion: () => ZodUnion,
31979
- ZodUndefined: () => ZodUndefined,
31980
- ZodType: () => ZodType,
31981
- ZodTuple: () => ZodTuple,
31982
- ZodTransformer: () => ZodEffects,
31983
- ZodSymbol: () => ZodSymbol,
31984
- ZodString: () => ZodString,
31985
- ZodSet: () => ZodSet,
31986
- ZodSchema: () => ZodType,
31987
- ZodRecord: () => ZodRecord,
31988
- ZodReadonly: () => ZodReadonly,
31989
- ZodPromise: () => ZodPromise,
31990
- ZodPipeline: () => ZodPipeline,
31991
- ZodParsedType: () => ZodParsedType,
31992
- ZodOptional: () => ZodOptional,
31993
- ZodObject: () => ZodObject,
31994
- ZodNumber: () => ZodNumber,
31995
- ZodNullable: () => ZodNullable,
31996
- ZodNull: () => ZodNull,
31997
- ZodNever: () => ZodNever,
31998
- ZodNativeEnum: () => ZodNativeEnum,
31999
- ZodNaN: () => ZodNaN,
32000
- ZodMap: () => ZodMap,
32001
- ZodLiteral: () => ZodLiteral,
32002
- ZodLazy: () => ZodLazy,
32003
- ZodIssueCode: () => ZodIssueCode,
32004
- ZodIntersection: () => ZodIntersection,
32005
- ZodFunction: () => ZodFunction,
32006
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
32007
- ZodError: () => ZodError,
32008
- ZodEnum: () => ZodEnum,
32009
- ZodEffects: () => ZodEffects,
32010
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
32011
- ZodDefault: () => ZodDefault,
32012
- ZodDate: () => ZodDate,
32013
- ZodCatch: () => ZodCatch,
32014
- ZodBranded: () => ZodBranded,
32015
- ZodBoolean: () => ZodBoolean,
32016
- ZodBigInt: () => ZodBigInt,
32017
- ZodArray: () => ZodArray,
32018
- ZodAny: () => ZodAny,
32019
- Schema: () => ZodType,
32020
- ParseStatus: () => ParseStatus,
32021
- OK: () => OK,
32022
- NEVER: () => NEVER,
32023
- INVALID: () => INVALID,
32024
- EMPTY_PATH: () => EMPTY_PATH,
32025
- DIRTY: () => DIRTY,
32026
- BRAND: () => BRAND
32027
- });
32028
-
32029
- // node_modules/zod/v3/helpers/util.js
32030
- var util;
32031
- (function(util2) {
32032
- util2.assertEqual = (_) => {};
32033
- function assertIs(_arg) {}
32034
- util2.assertIs = assertIs;
32035
- function assertNever2(_x) {
32036
- throw new Error;
32037
- }
32038
- util2.assertNever = assertNever2;
32039
- util2.arrayToEnum = (items) => {
32040
- const obj = {};
32041
- for (const item of items) {
32042
- obj[item] = item;
32043
- }
32044
- return obj;
31556
+ return obj;
32045
31557
  };
32046
31558
  util2.getValidEnumValues = (obj) => {
32047
31559
  const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
@@ -32389,8 +31901,8 @@ function getErrorMap() {
32389
31901
  }
32390
31902
  // node_modules/zod/v3/helpers/parseUtil.js
32391
31903
  var makeIssue = (params) => {
32392
- const { data, path: path13, errorMaps, issueData } = params;
32393
- const fullPath = [...path13, ...issueData.path || []];
31904
+ const { data, path: path12, errorMaps, issueData } = params;
31905
+ const fullPath = [...path12, ...issueData.path || []];
32394
31906
  const fullIssue = {
32395
31907
  ...issueData,
32396
31908
  path: fullPath
@@ -32502,11 +32014,11 @@ var errorUtil;
32502
32014
 
32503
32015
  // node_modules/zod/v3/types.js
32504
32016
  class ParseInputLazyPath {
32505
- constructor(parent, value, path13, key) {
32017
+ constructor(parent, value, path12, key) {
32506
32018
  this._cachedPath = [];
32507
32019
  this.parent = parent;
32508
32020
  this.data = value;
32509
- this._path = path13;
32021
+ this._path = path12;
32510
32022
  this._key = key;
32511
32023
  }
32512
32024
  get path() {
@@ -35785,108 +35297,258 @@ function custom(check, _params = {}, fatal) {
35785
35297
  }
35786
35298
  });
35787
35299
  }
35788
- if (!r) {
35789
- const params = cleanParams(_params, data);
35790
- const _fatal = params.fatal ?? fatal ?? true;
35791
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
35300
+ if (!r) {
35301
+ const params = cleanParams(_params, data);
35302
+ const _fatal = params.fatal ?? fatal ?? true;
35303
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
35304
+ }
35305
+ return;
35306
+ });
35307
+ return ZodAny.create();
35308
+ }
35309
+ var late = {
35310
+ object: ZodObject.lazycreate
35311
+ };
35312
+ var ZodFirstPartyTypeKind;
35313
+ (function(ZodFirstPartyTypeKind2) {
35314
+ ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
35315
+ ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
35316
+ ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
35317
+ ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
35318
+ ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
35319
+ ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
35320
+ ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
35321
+ ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
35322
+ ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
35323
+ ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
35324
+ ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
35325
+ ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
35326
+ ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
35327
+ ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
35328
+ ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
35329
+ ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
35330
+ ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
35331
+ ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
35332
+ ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
35333
+ ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
35334
+ ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
35335
+ ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
35336
+ ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
35337
+ ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
35338
+ ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
35339
+ ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
35340
+ ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
35341
+ ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
35342
+ ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
35343
+ ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
35344
+ ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
35345
+ ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
35346
+ ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
35347
+ ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
35348
+ ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
35349
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
35350
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
35351
+ var instanceOfType = (cls, params = {
35352
+ message: `Input not instance of ${cls.name}`
35353
+ }) => custom((data) => data instanceof cls, params);
35354
+ var stringType = ZodString.create;
35355
+ var numberType = ZodNumber.create;
35356
+ var nanType = ZodNaN.create;
35357
+ var bigIntType = ZodBigInt.create;
35358
+ var booleanType = ZodBoolean.create;
35359
+ var dateType = ZodDate.create;
35360
+ var symbolType = ZodSymbol.create;
35361
+ var undefinedType = ZodUndefined.create;
35362
+ var nullType = ZodNull.create;
35363
+ var anyType = ZodAny.create;
35364
+ var unknownType = ZodUnknown.create;
35365
+ var neverType = ZodNever.create;
35366
+ var voidType = ZodVoid.create;
35367
+ var arrayType = ZodArray.create;
35368
+ var objectType = ZodObject.create;
35369
+ var strictObjectType = ZodObject.strictCreate;
35370
+ var unionType = ZodUnion.create;
35371
+ var discriminatedUnionType = ZodDiscriminatedUnion.create;
35372
+ var intersectionType = ZodIntersection.create;
35373
+ var tupleType = ZodTuple.create;
35374
+ var recordType = ZodRecord.create;
35375
+ var mapType = ZodMap.create;
35376
+ var setType = ZodSet.create;
35377
+ var functionType = ZodFunction.create;
35378
+ var lazyType = ZodLazy.create;
35379
+ var literalType = ZodLiteral.create;
35380
+ var enumType = ZodEnum.create;
35381
+ var nativeEnumType = ZodNativeEnum.create;
35382
+ var promiseType = ZodPromise.create;
35383
+ var effectsType = ZodEffects.create;
35384
+ var optionalType = ZodOptional.create;
35385
+ var nullableType = ZodNullable.create;
35386
+ var preprocessType = ZodEffects.createWithPreprocess;
35387
+ var pipelineType = ZodPipeline.create;
35388
+ var ostring = () => stringType().optional();
35389
+ var onumber = () => numberType().optional();
35390
+ var oboolean = () => booleanType().optional();
35391
+ var coerce = {
35392
+ string: (arg) => ZodString.create({ ...arg, coerce: true }),
35393
+ number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
35394
+ boolean: (arg) => ZodBoolean.create({
35395
+ ...arg,
35396
+ coerce: true
35397
+ }),
35398
+ bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
35399
+ date: (arg) => ZodDate.create({ ...arg, coerce: true })
35400
+ };
35401
+ var NEVER = INVALID;
35402
+ // src/core/extra-params.ts
35403
+ var EXTRA_PARAMS_PROTECTED_TOP_LEVEL_KEYS = [
35404
+ "model",
35405
+ "messages",
35406
+ "temperature",
35407
+ "maxtokens",
35408
+ "responseformat",
35409
+ "stream",
35410
+ "streamoptions",
35411
+ "enablethinking",
35412
+ "reasoningeffort",
35413
+ "chattemplatekwargs"
35414
+ ];
35415
+ var EXTRA_PARAMS_CREDENTIAL_KEYS = [
35416
+ "authorization",
35417
+ "headers",
35418
+ "apikey",
35419
+ "token",
35420
+ "password",
35421
+ "secret",
35422
+ "cookie",
35423
+ "setcookie"
35424
+ ];
35425
+ var PROTECTED_TOP_LEVEL_KEYS = new Set(EXTRA_PARAMS_PROTECTED_TOP_LEVEL_KEYS);
35426
+ var CREDENTIAL_KEYS = new Set(EXTRA_PARAMS_CREDENTIAL_KEYS);
35427
+ var LEGACY_EXTRA_PARAMS_FIELD = {
35428
+ model: "model",
35429
+ temperature: "temperature",
35430
+ maxtokens: "maxTokens",
35431
+ enablethinking: "enableThinking",
35432
+ reasoningeffort: "reasoningEffort"
35433
+ };
35434
+ var LIFTABLE_EXTRA_PARAMS_KEYS = new Set(["temperature", "maxtokens", "enablethinking", "reasoningeffort"]);
35435
+ var EXTRA_PARAMS_NO_FIELD_REMEDY = {
35436
+ messages: "AKM builds the request messages internally — remove it from extraParams",
35437
+ responseformat: "AKM controls the response format internally — remove it from extraParams",
35438
+ stream: "AKM controls streaming internally — remove it from extraParams",
35439
+ streamoptions: "AKM controls streaming internally — remove it from extraParams",
35440
+ chattemplatekwargs: "set engines.<name>.enableThinking instead of chat_template_kwargs.enable_thinking"
35441
+ };
35442
+ function protectedKeyRemedy(normalized) {
35443
+ const field = LEGACY_EXTRA_PARAMS_FIELD[normalized];
35444
+ if (field) {
35445
+ const note = normalized === "reasoningeffort" ? " (moved to a first-class field in 0.9.2)" : "";
35446
+ return `set engines.<name>.${field} instead${note}`;
35447
+ }
35448
+ return EXTRA_PARAMS_NO_FIELD_REMEDY[normalized];
35449
+ }
35450
+ function normalizeExtraParamKey(key) {
35451
+ return key.toLowerCase().replace(/[^a-z0-9]/g, "");
35452
+ }
35453
+ function validateExtraParams(value) {
35454
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
35455
+ return [{ path: [], message: "must be an object" }];
35456
+ }
35457
+ const issues = [];
35458
+ const seen = new WeakSet;
35459
+ const visit2 = (entry, path12) => {
35460
+ if (Array.isArray(entry)) {
35461
+ if (seen.has(entry))
35462
+ return;
35463
+ seen.add(entry);
35464
+ entry.forEach((child, index) => {
35465
+ visit2(child, [...path12, index]);
35466
+ });
35467
+ return;
35468
+ }
35469
+ if (!entry || typeof entry !== "object")
35470
+ return;
35471
+ if (seen.has(entry))
35472
+ return;
35473
+ seen.add(entry);
35474
+ for (const [key, child] of Object.entries(entry)) {
35475
+ const normalized = normalizeExtraParamKey(key);
35476
+ if (path12.length === 0 && PROTECTED_TOP_LEVEL_KEYS.has(normalized)) {
35477
+ const remedy = protectedKeyRemedy(normalized);
35478
+ issues.push({
35479
+ path: [key],
35480
+ message: remedy ? `${key} is protected by AKM — ${remedy}.` : `${key} is protected by AKM`
35481
+ });
35482
+ }
35483
+ if (CREDENTIAL_KEYS.has(normalized)) {
35484
+ issues.push({ path: [...path12, key], message: `${key} cannot carry credentials` });
35485
+ }
35486
+ visit2(child, [...path12, key]);
35487
+ }
35488
+ };
35489
+ visit2(value, []);
35490
+ return issues;
35491
+ }
35492
+ function formatExtraParamsIssue(label, issue) {
35493
+ const suffix = issue.path.map((part) => typeof part === "number" ? `[${part}]` : `.${part}`).join("");
35494
+ return `${label}${suffix} ${issue.message}`;
35495
+ }
35496
+ function liftLegacyEngineExtraParams(raw) {
35497
+ const lifted = [];
35498
+ const conflicts = [];
35499
+ const rawEngines = raw.engines;
35500
+ if (!isRecord(rawEngines)) {
35501
+ return { config: raw, lifted, conflicts };
35502
+ }
35503
+ const engines = {};
35504
+ let anyEngineChanged = false;
35505
+ for (const [name, engineValue] of Object.entries(rawEngines)) {
35506
+ if (!isRecord(engineValue) || !isRecord(engineValue.extraParams)) {
35507
+ engines[name] = engineValue;
35508
+ continue;
35509
+ }
35510
+ const engine = { ...engineValue };
35511
+ const extraParams = { ...engineValue.extraParams };
35512
+ let engineChanged = false;
35513
+ for (const [rawKey, value] of Object.entries(engineValue.extraParams)) {
35514
+ const normalized = normalizeExtraParamKey(rawKey);
35515
+ if (!LIFTABLE_EXTRA_PARAMS_KEYS.has(normalized))
35516
+ continue;
35517
+ const field = LEGACY_EXTRA_PARAMS_FIELD[normalized];
35518
+ if (!field)
35519
+ continue;
35520
+ const existing = engine[field];
35521
+ if (existing !== undefined && existing !== value) {
35522
+ conflicts.push({ engine: name, key: rawKey, field, extraParamsValue: value, fieldValue: existing });
35523
+ continue;
35524
+ }
35525
+ delete extraParams[rawKey];
35526
+ engineChanged = true;
35527
+ if (existing === value) {
35528
+ lifted.push(`engines.${name}.extraParams.${rawKey} is redundant — engines.${name}.${field} is already set to the same value; dropped the extraParams entry`);
35529
+ continue;
35792
35530
  }
35793
- return;
35794
- });
35795
- return ZodAny.create();
35531
+ engine[field] = value;
35532
+ lifted.push(`engines.${name}.extraParams.${rawKey} -> engines.${name}.${field}`);
35533
+ }
35534
+ if (!engineChanged) {
35535
+ engines[name] = engineValue;
35536
+ continue;
35537
+ }
35538
+ anyEngineChanged = true;
35539
+ if (Object.keys(extraParams).length > 0) {
35540
+ engine.extraParams = extraParams;
35541
+ } else {
35542
+ delete engine.extraParams;
35543
+ }
35544
+ engines[name] = engine;
35545
+ }
35546
+ if (!anyEngineChanged) {
35547
+ return { config: raw, lifted, conflicts };
35548
+ }
35549
+ return { config: { ...raw, engines }, lifted, conflicts };
35796
35550
  }
35797
- var late = {
35798
- object: ZodObject.lazycreate
35799
- };
35800
- var ZodFirstPartyTypeKind;
35801
- (function(ZodFirstPartyTypeKind2) {
35802
- ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
35803
- ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
35804
- ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
35805
- ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
35806
- ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
35807
- ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
35808
- ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
35809
- ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
35810
- ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
35811
- ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
35812
- ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
35813
- ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
35814
- ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
35815
- ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
35816
- ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
35817
- ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
35818
- ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
35819
- ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
35820
- ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
35821
- ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
35822
- ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
35823
- ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
35824
- ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
35825
- ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
35826
- ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
35827
- ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
35828
- ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
35829
- ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
35830
- ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
35831
- ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
35832
- ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
35833
- ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
35834
- ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
35835
- ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
35836
- ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
35837
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
35838
- })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
35839
- var instanceOfType = (cls, params = {
35840
- message: `Input not instance of ${cls.name}`
35841
- }) => custom((data) => data instanceof cls, params);
35842
- var stringType = ZodString.create;
35843
- var numberType = ZodNumber.create;
35844
- var nanType = ZodNaN.create;
35845
- var bigIntType = ZodBigInt.create;
35846
- var booleanType = ZodBoolean.create;
35847
- var dateType = ZodDate.create;
35848
- var symbolType = ZodSymbol.create;
35849
- var undefinedType = ZodUndefined.create;
35850
- var nullType = ZodNull.create;
35851
- var anyType = ZodAny.create;
35852
- var unknownType = ZodUnknown.create;
35853
- var neverType = ZodNever.create;
35854
- var voidType = ZodVoid.create;
35855
- var arrayType = ZodArray.create;
35856
- var objectType = ZodObject.create;
35857
- var strictObjectType = ZodObject.strictCreate;
35858
- var unionType = ZodUnion.create;
35859
- var discriminatedUnionType = ZodDiscriminatedUnion.create;
35860
- var intersectionType = ZodIntersection.create;
35861
- var tupleType = ZodTuple.create;
35862
- var recordType = ZodRecord.create;
35863
- var mapType = ZodMap.create;
35864
- var setType = ZodSet.create;
35865
- var functionType = ZodFunction.create;
35866
- var lazyType = ZodLazy.create;
35867
- var literalType = ZodLiteral.create;
35868
- var enumType = ZodEnum.create;
35869
- var nativeEnumType = ZodNativeEnum.create;
35870
- var promiseType = ZodPromise.create;
35871
- var effectsType = ZodEffects.create;
35872
- var optionalType = ZodOptional.create;
35873
- var nullableType = ZodNullable.create;
35874
- var preprocessType = ZodEffects.createWithPreprocess;
35875
- var pipelineType = ZodPipeline.create;
35876
- var ostring = () => stringType().optional();
35877
- var onumber = () => numberType().optional();
35878
- var oboolean = () => booleanType().optional();
35879
- var coerce = {
35880
- string: (arg) => ZodString.create({ ...arg, coerce: true }),
35881
- number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
35882
- boolean: (arg) => ZodBoolean.create({
35883
- ...arg,
35884
- coerce: true
35885
- }),
35886
- bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
35887
- date: (arg) => ZodDate.create({ ...arg, coerce: true })
35888
- };
35889
- var NEVER = INVALID;
35551
+
35890
35552
  // src/core/config/schema/primitives.ts
35891
35553
  var CURRENT_CONFIG_VERSION = "0.9.0";
35892
35554
  var positiveInt = exports_external.number().int().positive();
@@ -36179,8 +35841,6 @@ var CONSOLIDATE_PROCESS_FIELDS = {
36179
35841
  limit: processLimitField,
36180
35842
  minPoolSize: exports_external.number().int().min(0).optional(),
36181
35843
  maxChunkSize: exports_external.number().int().min(1).max(50).optional(),
36182
- incrementalSince: exports_external.string().optional(),
36183
- neighborsPerChanged: exports_external.number().int().min(1).optional(),
36184
35844
  p90ChunkSecondsDefault: exports_external.number().finite().positive().optional(),
36185
35845
  antiCollapse: antiCollapseField
36186
35846
  };
@@ -36188,13 +35848,6 @@ var MEMORY_INFERENCE_PROCESS_FIELDS = {
36188
35848
  minPendingCount: exports_external.number().int().min(0).optional(),
36189
35849
  cls: clsField
36190
35850
  };
36191
- var GRAPH_EXTRACTION_PROCESS_FIELDS = {
36192
- topN: positiveInt.optional(),
36193
- includeTypes: exports_external.array(exports_external.string().min(1)).min(1).optional(),
36194
- batchSize: positiveInt.optional(),
36195
- fullScan: exports_external.boolean().optional(),
36196
- maxChunksPerAsset: positiveInt.optional()
36197
- };
36198
35851
  var EXTRACT_PROCESS_FIELDS = {
36199
35852
  defaultSince: exports_external.string().min(1).optional(),
36200
35853
  maxTotalChars: positiveInt.optional(),
@@ -36230,7 +35883,6 @@ var ImproveProcessConfigSchema = exports_external.object({
36230
35883
  ...DISTILL_PROCESS_FIELDS,
36231
35884
  ...CONSOLIDATE_PROCESS_FIELDS,
36232
35885
  ...MEMORY_INFERENCE_PROCESS_FIELDS,
36233
- ...GRAPH_EXTRACTION_PROCESS_FIELDS,
36234
35886
  ...EXTRACT_PROCESS_FIELDS,
36235
35887
  ...TRIAGE_PROCESS_FIELDS,
36236
35888
  ...PROACTIVE_MAINTENANCE_PROCESS_FIELDS
@@ -36239,17 +35891,16 @@ var ReflectProcessConfigSchema = exports_external.object({ ...IMPROVE_PROCESS_BA
36239
35891
  var DistillProcessConfigSchema = exports_external.object({ ...IMPROVE_PROCESS_BASE_FIELDS, ...DISTILL_PROCESS_FIELDS }).passthrough().superRefine(rejectExcludeRefPrefixesOutsideReflect);
36240
35892
  var ConsolidateProcessConfigSchema = exports_external.object({ ...IMPROVE_PROCESS_BASE_FIELDS, ...CONSOLIDATE_PROCESS_FIELDS }).passthrough().superRefine(rejectExcludeRefPrefixesOutsideReflect);
36241
35893
  var MemoryInferenceProcessConfigSchema = exports_external.object({ ...IMPROVE_PROCESS_BASE_FIELDS, ...MEMORY_INFERENCE_PROCESS_FIELDS }).passthrough();
36242
- var GraphExtractionProcessConfigSchema = exports_external.object({ ...IMPROVE_PROCESS_BASE_FIELDS, ...GRAPH_EXTRACTION_PROCESS_FIELDS }).passthrough();
36243
35894
  var ExtractProcessConfigSchema = exports_external.object({ ...IMPROVE_PROCESS_BASE_FIELDS, ...EXTRACT_PROCESS_FIELDS }).passthrough();
36244
35895
  var ValidationProcessConfigSchema = exports_external.object({ ...IMPROVE_PROCESS_BASE_FIELDS }).passthrough();
36245
35896
  var TriageProcessConfigSchema = exports_external.object({ ...IMPROVE_PROCESS_BASE_FIELDS, ...TRIAGE_PROCESS_FIELDS }).passthrough();
36246
35897
  var ProactiveMaintenanceProcessConfigSchema = exports_external.object({ ...IMPROVE_PROCESS_BASE_FIELDS, ...PROACTIVE_MAINTENANCE_PROCESS_FIELDS }).passthrough();
35898
+ var RETIRED_PROCESS_NAMES = new Set(["graphExtraction"]);
36247
35899
  var ImproveProfileProcessesSchema = exports_external.object({
36248
35900
  reflect: ReflectProcessConfigSchema.optional(),
36249
35901
  distill: DistillProcessConfigSchema.optional(),
36250
35902
  consolidate: ConsolidateProcessConfigSchema.optional(),
36251
35903
  memoryInference: MemoryInferenceProcessConfigSchema.optional(),
36252
- graphExtraction: GraphExtractionProcessConfigSchema.optional(),
36253
35904
  extract: ExtractProcessConfigSchema.optional(),
36254
35905
  validation: ValidationProcessConfigSchema.optional(),
36255
35906
  triage: TriageProcessConfigSchema.optional(),
@@ -36262,7 +35913,7 @@ var ImproveProfileProcessesSchema = exports_external.object({
36262
35913
  });
36263
35914
  }
36264
35915
  for (const [name, process2] of Object.entries(val)) {
36265
- if (!(name in IMPROVE_PROCESS_ENGINE_CAPABILITIES) && process2 !== null && typeof process2 === "object" && process2.enabled === true) {
35916
+ if (!(name in IMPROVE_PROCESS_ENGINE_CAPABILITIES) && !RETIRED_PROCESS_NAMES.has(name) && process2 !== null && typeof process2 === "object" && process2.enabled === true) {
36266
35917
  ctx.addIssue({
36267
35918
  code: exports_external.ZodIssueCode.custom,
36268
35919
  path: [name],
@@ -36331,11 +35982,8 @@ var IndexPassConfigSchema = exports_external.preprocess((raw, ctx) => {
36331
35982
  model: nonEmptyString.optional(),
36332
35983
  timeoutMs: exports_external.union([positiveInt, exports_external.null()]).optional(),
36333
35984
  enabled: exports_external.boolean().optional(),
36334
- llm: LlmInvocationOverridesSchema.optional(),
36335
- graphExtractionBatchSize: positiveInt.optional(),
36336
- graphExtractionIncludeTypes: exports_external.array(exports_external.string().min(1)).nonempty().optional()
35985
+ llm: LlmInvocationOverridesSchema.optional()
36337
35986
  }).passthrough());
36338
- var MetadataEnhanceSchema = exports_external.object({ enabled: exports_external.boolean().optional() }).passthrough();
36339
35987
  var IndexDefaultsSchema = exports_external.object({
36340
35988
  engine: engineName.optional(),
36341
35989
  model: nonEmptyString.optional(),
@@ -36348,7 +35996,7 @@ var IndexConfigRuntimeSchema = exports_external.preprocess((raw, ctx) => {
36348
35996
  if (Array.isArray(raw)) {
36349
35997
  ctx.addIssue({
36350
35998
  code: exports_external.ZodIssueCode.custom,
36351
- message: 'Invalid `index` config: expected an object keyed by pass name (e.g. `{ "enrichment": { "enabled": false } }`).'
35999
+ message: 'Invalid `index` config: expected an object keyed by pass name (e.g. `{ "memory": { "enabled": false } }`).'
36352
36000
  });
36353
36001
  return raw;
36354
36002
  }
@@ -36372,8 +36020,7 @@ var IndexConfigRuntimeSchema = exports_external.preprocess((raw, ctx) => {
36372
36020
  }
36373
36021
  return cleaned ?? raw;
36374
36022
  }, exports_external.object({
36375
- defaults: IndexDefaultsSchema.optional(),
36376
- metadataEnhance: MetadataEnhanceSchema.optional()
36023
+ defaults: IndexDefaultsSchema.optional()
36377
36024
  }).catchall(IndexPassConfigSchema));
36378
36025
  var IndexConfigSchema = IndexConfigRuntimeSchema;
36379
36026
 
@@ -36648,144 +36295,502 @@ var AkmConfigSchema = AkmConfigBaseSchema.superRefine((config, ctx) => {
36648
36295
  }
36649
36296
  }
36650
36297
  if (config.defaultWriteTarget !== undefined) {
36651
- const target = config.bundles?.[config.defaultWriteTarget];
36652
- if (!target) {
36298
+ const target = config.bundles?.[config.defaultWriteTarget];
36299
+ if (!target) {
36300
+ ctx.addIssue({
36301
+ code: exports_external.ZodIssueCode.custom,
36302
+ path: ["defaultWriteTarget"],
36303
+ message: `defaultWriteTarget "${config.defaultWriteTarget}" does not name a configured bundle`
36304
+ });
36305
+ } else if (target.enabled === false) {
36306
+ ctx.addIssue({
36307
+ code: exports_external.ZodIssueCode.custom,
36308
+ path: ["defaultWriteTarget"],
36309
+ message: `defaultWriteTarget "${config.defaultWriteTarget}" is disabled`
36310
+ });
36311
+ }
36312
+ }
36313
+ for (const key of ["llm", "agent", "improve"]) {
36314
+ if (config.defaults && key in config.defaults) {
36315
+ ctx.addIssue({
36316
+ code: exports_external.ZodIssueCode.custom,
36317
+ path: ["defaults", key],
36318
+ message: `defaults.${key} is retired in 0.9`
36319
+ });
36320
+ }
36321
+ }
36322
+ for (const [name, engine] of Object.entries(config.engines ?? {})) {
36323
+ if (engine.kind === "agent" && engine.llmEngine) {
36324
+ const fallback = config.engines?.[engine.llmEngine];
36325
+ if (!fallback || fallback.kind !== "llm") {
36326
+ ctx.addIssue({
36327
+ code: exports_external.ZodIssueCode.custom,
36328
+ path: ["engines", name, "llmEngine"],
36329
+ message: "llmEngine must name an LLM engine"
36330
+ });
36331
+ }
36332
+ }
36333
+ }
36334
+ const defaultEngine = config.defaults?.engine;
36335
+ if (defaultEngine && !config.engines?.[defaultEngine]) {
36336
+ ctx.addIssue({
36337
+ code: exports_external.ZodIssueCode.custom,
36338
+ path: ["defaults", "engine"],
36339
+ message: "engine does not name a configured engine"
36340
+ });
36341
+ }
36342
+ const defaultLlm = config.defaults?.llmEngine;
36343
+ if (defaultLlm && config.engines?.[defaultLlm]?.kind !== "llm") {
36344
+ ctx.addIssue({
36345
+ code: exports_external.ZodIssueCode.custom,
36346
+ path: ["defaults", "llmEngine"],
36347
+ message: "llmEngine must name an LLM engine"
36348
+ });
36349
+ }
36350
+ const workflowJudge = config.workflow?.judgeEngine;
36351
+ if (workflowJudge && !config.engines?.[workflowJudge]) {
36352
+ ctx.addIssue({
36353
+ code: exports_external.ZodIssueCode.custom,
36354
+ path: ["workflow", "judgeEngine"],
36355
+ message: "judgeEngine does not name a configured engine"
36356
+ });
36357
+ }
36358
+ const defaultStrategy = config.defaults?.improveStrategy;
36359
+ if (defaultStrategy && defaultStrategy !== "graph-refresh" && !BUILTIN_IMPROVE_STRATEGY_NAMES.includes(defaultStrategy) && !config.improve?.strategies?.[defaultStrategy]) {
36360
+ ctx.addIssue({
36361
+ code: exports_external.ZodIssueCode.custom,
36362
+ path: ["defaults", "improveStrategy"],
36363
+ message: "improveStrategy does not name a built-in or configured strategy"
36364
+ });
36365
+ }
36366
+ for (const [strategyName, strategy] of Object.entries(config.improve?.strategies ?? {})) {
36367
+ const strategyEngine = strategy.engine;
36368
+ if (strategyEngine) {
36369
+ const engine = config.engines?.[strategyEngine];
36370
+ if (!engine || engine.kind !== "llm") {
36371
+ ctx.addIssue({
36372
+ code: exports_external.ZodIssueCode.custom,
36373
+ path: ["improve", "strategies", strategyName, "engine"],
36374
+ message: engine ? "strategy engine must be an LLM engine" : "engine does not name a configured engine"
36375
+ });
36376
+ }
36377
+ }
36378
+ for (const [processName, process2] of Object.entries(strategy.processes ?? {})) {
36379
+ const processConfig = process2;
36380
+ const capability = IMPROVE_PROCESS_ENGINE_CAPABILITIES[processName];
36381
+ if (processConfig.engine && capability === null) {
36382
+ ctx.addIssue({
36383
+ code: exports_external.ZodIssueCode.custom,
36384
+ path: ["improve", "strategies", strategyName, "processes", processName, "engine"],
36385
+ message: `${processName} does not dispatch an engine`
36386
+ });
36387
+ } else {
36388
+ const processEngine = processConfig.engine ?? strategyEngine;
36389
+ if (processEngine && capability === "llm") {
36390
+ const engine = config.engines?.[processEngine];
36391
+ if (!engine || engine.kind !== "llm") {
36392
+ ctx.addIssue({
36393
+ code: exports_external.ZodIssueCode.custom,
36394
+ path: ["improve", "strategies", strategyName, "processes", processName, "engine"],
36395
+ message: engine ? `${processName} requires an LLM engine` : "engine does not name a configured engine"
36396
+ });
36397
+ }
36398
+ } else if (processConfig.engine && capability === "runner" && !config.engines?.[processConfig.engine]) {
36399
+ ctx.addIssue({
36400
+ code: exports_external.ZodIssueCode.custom,
36401
+ path: ["improve", "strategies", strategyName, "processes", processName, "engine"],
36402
+ message: "engine does not name a configured engine"
36403
+ });
36404
+ }
36405
+ }
36406
+ const judgmentEngine = processConfig.judgment?.engine;
36407
+ if (processConfig.judgment?.enabled === true && judgmentEngine) {
36408
+ const engine = config.engines?.[judgmentEngine];
36409
+ if (!engine) {
36410
+ ctx.addIssue({
36411
+ code: exports_external.ZodIssueCode.custom,
36412
+ path: ["improve", "strategies", strategyName, "processes", processName, "judgment", "engine"],
36413
+ message: "engine does not name a configured engine"
36414
+ });
36415
+ }
36416
+ }
36417
+ }
36418
+ }
36419
+ if (config.defaultWriteTarget !== undefined) {
36420
+ const knownNames = Object.keys(config.bundles ?? {});
36421
+ if (knownNames.length === 0) {
36653
36422
  ctx.addIssue({
36654
36423
  code: exports_external.ZodIssueCode.custom,
36655
36424
  path: ["defaultWriteTarget"],
36656
- message: `defaultWriteTarget "${config.defaultWriteTarget}" does not name a configured bundle`
36425
+ message: `defaultWriteTarget "${config.defaultWriteTarget}" cannot be resolved: no bundles configured. ` + "Add at least one entry to `bundles` first."
36657
36426
  });
36658
- } else if (target.enabled === false) {
36427
+ } else if (!knownNames.includes(config.defaultWriteTarget)) {
36659
36428
  ctx.addIssue({
36660
36429
  code: exports_external.ZodIssueCode.custom,
36661
36430
  path: ["defaultWriteTarget"],
36662
- message: `defaultWriteTarget "${config.defaultWriteTarget}" is disabled`
36431
+ message: `defaultWriteTarget "${config.defaultWriteTarget}" does not match any configured bundle: ${knownNames.map((n) => `"${n}"`).join(", ")}.`
36663
36432
  });
36664
36433
  }
36665
36434
  }
36666
- for (const key of ["llm", "agent", "improve"]) {
36667
- if (config.defaults && key in config.defaults) {
36668
- ctx.addIssue({
36669
- code: exports_external.ZodIssueCode.custom,
36670
- path: ["defaults", key],
36671
- message: `defaults.${key} is retired in 0.9`
36672
- });
36435
+ });
36436
+
36437
+ // src/core/config/deep-merge.ts
36438
+ var UNSAFE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
36439
+ function isPlainObject(value) {
36440
+ if (value === null || typeof value !== "object" || Array.isArray(value))
36441
+ return false;
36442
+ const prototype = Object.getPrototypeOf(value);
36443
+ return prototype === Object.prototype || prototype === null;
36444
+ }
36445
+ function copyConfigValue(value) {
36446
+ if (Array.isArray(value))
36447
+ return value.map(copyConfigValue);
36448
+ if (!isPlainObject(value))
36449
+ return value;
36450
+ const copy = {};
36451
+ for (const key of Object.keys(value)) {
36452
+ if (UNSAFE_KEYS.has(key))
36453
+ throw new TypeError(`Unsafe configuration key: ${key}`);
36454
+ copy[key] = copyConfigValue(value[key]);
36455
+ }
36456
+ return copy;
36457
+ }
36458
+ function deepMergeConfig(base, override) {
36459
+ const result = copyConfigValue(base);
36460
+ for (const key of Object.keys(override)) {
36461
+ if (UNSAFE_KEYS.has(key))
36462
+ throw new TypeError(`Unsafe configuration key: ${key}`);
36463
+ const next = override[key];
36464
+ if (next === undefined)
36465
+ continue;
36466
+ const current = result[key];
36467
+ result[key] = isPlainObject(current) && isPlainObject(next) ? deepMergeConfig(current, next) : copyConfigValue(next);
36468
+ }
36469
+ return result;
36470
+ }
36471
+
36472
+ // src/core/config/config.ts
36473
+ import fs10 from "node:fs";
36474
+ import os2 from "node:os";
36475
+ import path14 from "node:path";
36476
+ import { isDeepStrictEqual } from "node:util";
36477
+
36478
+ // src/core/config/config-io.ts
36479
+ import fs8 from "node:fs";
36480
+ import path12 from "node:path";
36481
+
36482
+ // src/core/file-lock.ts
36483
+ import { randomUUID } from "node:crypto";
36484
+ import fs7 from "node:fs";
36485
+ function readLockSnapshot(lockPath) {
36486
+ let fd;
36487
+ try {
36488
+ fd = fs7.openSync(lockPath, "r");
36489
+ } catch (err) {
36490
+ if (err.code === "ENOENT")
36491
+ return;
36492
+ throw err;
36493
+ }
36494
+ try {
36495
+ const rawContent = readTextFileDescriptorWithLimit(fd, MAX_LOCK_METADATA_BYTES, "Lock metadata", lockPath);
36496
+ const stat = fs7.fstatSync(fd);
36497
+ return {
36498
+ rawContent,
36499
+ identity: { dev: stat.dev, ino: stat.ino, size: stat.size, mtimeMs: stat.mtimeMs }
36500
+ };
36501
+ } finally {
36502
+ fs7.closeSync(fd);
36503
+ }
36504
+ }
36505
+ function sameIdentity(left, right) {
36506
+ return left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs;
36507
+ }
36508
+ function releaseLockRaw(lockPath) {
36509
+ try {
36510
+ fs7.unlinkSync(lockPath);
36511
+ } catch {}
36512
+ }
36513
+ function tryAcquireLockSync(lockPath, payload) {
36514
+ try {
36515
+ fs7.writeFileSync(lockPath, payload, { flag: "wx" });
36516
+ } catch (err) {
36517
+ if (err.code === "EEXIST")
36518
+ return;
36519
+ throw err;
36520
+ }
36521
+ let snapshot;
36522
+ try {
36523
+ snapshot = readLockSnapshot(lockPath);
36524
+ } catch (error2) {
36525
+ releaseLockRaw(lockPath);
36526
+ throw error2;
36527
+ }
36528
+ if (!snapshot) {
36529
+ releaseLockRaw(lockPath);
36530
+ throw new Error(`Could not read newly acquired lock at ${lockPath}.`);
36531
+ }
36532
+ return { lockPath, ...snapshot };
36533
+ }
36534
+ function launcherPidFromEnv() {
36535
+ const raw = process.env.AKM_LAUNCHER_PID;
36536
+ if (!raw)
36537
+ return;
36538
+ const pid = Number.parseInt(raw, 10);
36539
+ return Number.isInteger(pid) && pid > 0 ? pid : undefined;
36540
+ }
36541
+ function createLockPayload(metadata = {}) {
36542
+ const launcherPid = launcherPidFromEnv();
36543
+ return JSON.stringify({
36544
+ ...metadata,
36545
+ pid: process.pid,
36546
+ ...launcherPid !== undefined ? { launcherPid } : {},
36547
+ lockId: randomUUID()
36548
+ });
36549
+ }
36550
+ function probeLock(lockPath, opts) {
36551
+ let snapshot;
36552
+ try {
36553
+ snapshot = readLockSnapshot(lockPath);
36554
+ } catch (error2) {
36555
+ const code = error2?.code;
36556
+ if (code === "EACCES" || code === "EPERM")
36557
+ return { state: "inaccessible", code };
36558
+ return { state: "stale", reason: "unreadable" };
36559
+ }
36560
+ if (!snapshot)
36561
+ return { state: "absent" };
36562
+ const { rawContent, identity: identity3 } = snapshot;
36563
+ const ageMs = Date.now() - identity3.mtimeMs;
36564
+ const { holderPid, launcherPid } = extractLockIdentity(rawContent);
36565
+ if (holderPid === undefined) {
36566
+ return { state: "stale", reason: "invalid_pid", ageMs, rawContent, identity: identity3 };
36567
+ }
36568
+ if (!isProcessAlive(holderPid)) {
36569
+ return { state: "stale", reason: "pid_dead", holderPid, launcherPid, ageMs, rawContent, identity: identity3 };
36570
+ }
36571
+ if (opts?.staleAfterMs !== undefined && ageMs > opts.staleAfterMs) {
36572
+ return { state: "stale", reason: "age_exceeded", holderPid, launcherPid, ageMs, rawContent, identity: identity3 };
36573
+ }
36574
+ return { state: "held", holderPid, launcherPid, ageMs, rawContent, identity: identity3 };
36575
+ }
36576
+ function reclaimStaleLock(lockPath, probe, options) {
36577
+ if (probe.rawContent === undefined || probe.identity === undefined)
36578
+ return false;
36579
+ const expectedContent = probe.rawContent;
36580
+ const expectedIdentity = probe.identity;
36581
+ let current;
36582
+ try {
36583
+ current = readLockSnapshot(lockPath);
36584
+ } catch {
36585
+ return false;
36586
+ }
36587
+ if (!current || current.rawContent !== expectedContent || !sameIdentity(current.identity, expectedIdentity)) {
36588
+ return false;
36589
+ }
36590
+ const quarantinePath = `${lockPath}.stale-${process.pid}-${randomUUID()}`;
36591
+ try {
36592
+ fs7.renameSync(lockPath, quarantinePath);
36593
+ } catch (err) {
36594
+ if (err.code === "ENOENT")
36595
+ return false;
36596
+ throw err;
36597
+ }
36598
+ let quarantined;
36599
+ try {
36600
+ quarantined = readLockSnapshot(quarantinePath);
36601
+ } catch {
36602
+ quarantined = undefined;
36603
+ }
36604
+ if (!quarantined || quarantined.rawContent !== expectedContent || !sameIdentity(quarantined.identity, expectedIdentity)) {
36605
+ try {
36606
+ fs7.linkSync(quarantinePath, lockPath);
36607
+ } catch (err) {
36608
+ if (err.code !== "EEXIST")
36609
+ throw err;
36610
+ }
36611
+ releaseLockRaw(quarantinePath);
36612
+ return false;
36613
+ }
36614
+ options?.afterQuarantineVerified?.();
36615
+ try {
36616
+ fs7.unlinkSync(quarantinePath);
36617
+ return true;
36618
+ } catch (err) {
36619
+ if (err.code === "ENOENT")
36620
+ return false;
36621
+ throw err;
36622
+ }
36623
+ }
36624
+ function releaseLock(ownership) {
36625
+ const { lockPath } = ownership;
36626
+ let current;
36627
+ try {
36628
+ current = readLockSnapshot(lockPath);
36629
+ } catch {
36630
+ return;
36631
+ }
36632
+ if (current && current.rawContent === ownership.rawContent && sameIdentity(current.identity, ownership.identity)) {
36633
+ releaseLockRaw(lockPath);
36634
+ }
36635
+ }
36636
+ function extractLockIdentity(content) {
36637
+ const trimmed = content.trim();
36638
+ if (!trimmed)
36639
+ return {};
36640
+ if (trimmed.startsWith("{")) {
36641
+ try {
36642
+ const parsed = JSON.parse(trimmed);
36643
+ const pid2 = typeof parsed.pid === "number" ? parsed.pid : Number.NaN;
36644
+ const rawLauncherPid = typeof parsed.launcherPid === "number" ? parsed.launcherPid : Number.NaN;
36645
+ return {
36646
+ holderPid: Number.isInteger(pid2) && pid2 > 0 ? pid2 : undefined,
36647
+ launcherPid: Number.isInteger(rawLauncherPid) && rawLauncherPid > 0 ? rawLauncherPid : undefined
36648
+ };
36649
+ } catch {
36650
+ return {};
36673
36651
  }
36674
36652
  }
36675
- for (const [name, engine] of Object.entries(config.engines ?? {})) {
36676
- if (engine.kind === "agent" && engine.llmEngine) {
36677
- const fallback = config.engines?.[engine.llmEngine];
36678
- if (!fallback || fallback.kind !== "llm") {
36679
- ctx.addIssue({
36680
- code: exports_external.ZodIssueCode.custom,
36681
- path: ["engines", name, "llmEngine"],
36682
- message: "llmEngine must name an LLM engine"
36683
- });
36684
- }
36685
- }
36653
+ const pid = Number.parseInt(trimmed, 10);
36654
+ return { holderPid: Number.isInteger(pid) && pid > 0 ? pid : undefined };
36655
+ }
36656
+
36657
+ // src/core/config/config-io.ts
36658
+ function readConfigText(configPath) {
36659
+ try {
36660
+ return readTextFile(configPath, "Config file");
36661
+ } catch (err) {
36662
+ if (err.code === "ENOENT")
36663
+ return;
36664
+ throw err;
36665
+ }
36666
+ }
36667
+ function parseConfigText(text, sourcePath) {
36668
+ const stripped = stripJsonComments(text);
36669
+ const where = sourcePath ? ` at ${sourcePath}` : "";
36670
+ let parsed;
36671
+ try {
36672
+ parsed = JSON.parse(stripped);
36673
+ } catch (err) {
36674
+ const detail = err instanceof Error ? err.message : String(err);
36675
+ throw new ConfigError(`Failed to parse config JSON${where}: ${detail}`, "INVALID_CONFIG_FILE", "Edit the file to fix the JSON syntax error. Comments (// and /* */) are allowed; trailing commas are not.");
36686
36676
  }
36687
- const defaultEngine = config.defaults?.engine;
36688
- if (defaultEngine && !config.engines?.[defaultEngine]) {
36689
- ctx.addIssue({
36690
- code: exports_external.ZodIssueCode.custom,
36691
- path: ["defaults", "engine"],
36692
- message: "engine does not name a configured engine"
36693
- });
36677
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
36678
+ throw new ConfigError(`Config file${where} must contain a JSON object at the root, got ${describeJsonRoot(parsed)}.`, "INVALID_CONFIG_FILE");
36694
36679
  }
36695
- const defaultLlm = config.defaults?.llmEngine;
36696
- if (defaultLlm && config.engines?.[defaultLlm]?.kind !== "llm") {
36697
- ctx.addIssue({
36698
- code: exports_external.ZodIssueCode.custom,
36699
- path: ["defaults", "llmEngine"],
36700
- message: "llmEngine must name an LLM engine"
36701
- });
36680
+ return parsed;
36681
+ }
36682
+ function describeJsonRoot(value) {
36683
+ if (value === null)
36684
+ return "null";
36685
+ if (Array.isArray(value))
36686
+ return "an array";
36687
+ if (typeof value === "string")
36688
+ return "a string";
36689
+ if (typeof value === "number")
36690
+ return "a number";
36691
+ if (typeof value === "boolean")
36692
+ return "a boolean";
36693
+ return typeof value;
36694
+ }
36695
+ function writeConfigAtomic(configPath, config) {
36696
+ writeFileAtomic(configPath, `${JSON.stringify(config, null, 2)}
36697
+ `);
36698
+ }
36699
+ var MAX_CONFIG_BACKUPS = 5;
36700
+ function backupExistingConfig(configPath, now = new Date) {
36701
+ if (!fs8.existsSync(configPath))
36702
+ return;
36703
+ const backupDir = path12.join(getCacheDir(), "config-backups");
36704
+ fs8.mkdirSync(backupDir, { recursive: true, mode: 448 });
36705
+ fs8.chmodSync(backupDir, 448);
36706
+ const timestamp = now.toISOString().replace(/[.:]/g, "-");
36707
+ let sequence = 0;
36708
+ let timestamped;
36709
+ while (true) {
36710
+ timestamped = path12.join(backupDir, `config-${timestamp}${sequence === 0 ? "" : `-${sequence}`}.json`);
36711
+ try {
36712
+ fs8.copyFileSync(configPath, timestamped, fs8.constants.COPYFILE_EXCL);
36713
+ break;
36714
+ } catch (error2) {
36715
+ if (error2.code !== "EEXIST")
36716
+ throw error2;
36717
+ sequence++;
36718
+ }
36702
36719
  }
36703
- const workflowJudge = config.workflow?.judgeEngine;
36704
- if (workflowJudge && !config.engines?.[workflowJudge]) {
36705
- ctx.addIssue({
36706
- code: exports_external.ZodIssueCode.custom,
36707
- path: ["workflow", "judgeEngine"],
36708
- message: "judgeEngine does not name a configured engine"
36709
- });
36720
+ const latest = path12.join(backupDir, "config.latest.json");
36721
+ fs8.copyFileSync(configPath, latest);
36722
+ fs8.chmodSync(timestamped, 384);
36723
+ fs8.chmodSync(latest, 384);
36724
+ pruneOldBackups(backupDir);
36725
+ return { timestamped, latest };
36726
+ }
36727
+ function pruneOldBackups(backupDir) {
36728
+ pruneToNewest(backupDir, MAX_CONFIG_BACKUPS, (entry) => entry.isFile() && isTimestampedConfigBackup(entry.name));
36729
+ }
36730
+ function isTimestampedConfigBackup(name) {
36731
+ return name.startsWith("config-") && name.endsWith(".json") && name !== "config.latest.json";
36732
+ }
36733
+ function pruneToNewest(dir, keep, select) {
36734
+ let entries;
36735
+ try {
36736
+ entries = fs8.readdirSync(dir, { withFileTypes: true });
36737
+ } catch {
36738
+ return;
36710
36739
  }
36711
- const defaultStrategy = config.defaults?.improveStrategy;
36712
- if (defaultStrategy && !BUILTIN_IMPROVE_STRATEGY_NAMES.includes(defaultStrategy) && !config.improve?.strategies?.[defaultStrategy]) {
36713
- ctx.addIssue({
36714
- code: exports_external.ZodIssueCode.custom,
36715
- path: ["defaults", "improveStrategy"],
36716
- message: "improveStrategy does not name a built-in or configured strategy"
36717
- });
36740
+ const candidates = entries.filter(select).map((entry) => {
36741
+ const full = path12.join(dir, entry.name);
36742
+ let mtime = 0;
36743
+ try {
36744
+ mtime = fs8.statSync(full).mtimeMs;
36745
+ } catch {}
36746
+ return { path: full, mtime };
36747
+ }).sort((a, b) => b.mtime - a.mtime);
36748
+ for (const stale of candidates.slice(keep)) {
36749
+ try {
36750
+ fs8.rmSync(stale.path, { recursive: true, force: true });
36751
+ } catch {}
36718
36752
  }
36719
- for (const [strategyName, strategy] of Object.entries(config.improve?.strategies ?? {})) {
36720
- const strategyEngine = strategy.engine;
36721
- if (strategyEngine) {
36722
- const engine = config.engines?.[strategyEngine];
36723
- if (!engine || engine.kind !== "llm") {
36724
- ctx.addIssue({
36725
- code: exports_external.ZodIssueCode.custom,
36726
- path: ["improve", "strategies", strategyName, "engine"],
36727
- message: engine ? "strategy engine must be an LLM engine" : "engine does not name a configured engine"
36728
- });
36753
+ }
36754
+ function getConfigLockPath() {
36755
+ return path12.join(getConfigDir(), "config.json.lck");
36756
+ }
36757
+ var CONFIG_LOCK_MAX_RETRIES = 40;
36758
+ var CONFIG_LOCK_RETRY_DELAY_MS = 50;
36759
+ function sleepSyncMs(ms) {
36760
+ sleepSync(ms);
36761
+ }
36762
+ function acquireConfigLock() {
36763
+ const lockPath = getConfigLockPath();
36764
+ try {
36765
+ fs8.mkdirSync(path12.dirname(lockPath), { recursive: true });
36766
+ } catch {}
36767
+ for (let attempt = 0;attempt < CONFIG_LOCK_MAX_RETRIES; attempt++) {
36768
+ try {
36769
+ const ownership = tryAcquireLockSync(lockPath, createLockPayload());
36770
+ if (ownership) {
36771
+ return () => releaseLock(ownership);
36729
36772
  }
36773
+ } catch (error2) {
36774
+ throw new ConfigError(`Unable to acquire config lock at ${lockPath}: ${error2 instanceof Error ? error2.message : String(error2)}`, "INVALID_CONFIG_FILE");
36730
36775
  }
36731
- for (const [processName, process2] of Object.entries(strategy.processes ?? {})) {
36732
- const processConfig = process2;
36733
- const capability = IMPROVE_PROCESS_ENGINE_CAPABILITIES[processName];
36734
- if (processConfig.engine && capability === null) {
36735
- ctx.addIssue({
36736
- code: exports_external.ZodIssueCode.custom,
36737
- path: ["improve", "strategies", strategyName, "processes", processName, "engine"],
36738
- message: `${processName} does not dispatch an engine`
36739
- });
36740
- } else {
36741
- const processEngine = processConfig.engine ?? strategyEngine;
36742
- if (processEngine && capability === "llm") {
36743
- const engine = config.engines?.[processEngine];
36744
- if (!engine || engine.kind !== "llm") {
36745
- ctx.addIssue({
36746
- code: exports_external.ZodIssueCode.custom,
36747
- path: ["improve", "strategies", strategyName, "processes", processName, "engine"],
36748
- message: engine ? `${processName} requires an LLM engine` : "engine does not name a configured engine"
36749
- });
36750
- }
36751
- } else if (processConfig.engine && capability === "runner" && !config.engines?.[processConfig.engine]) {
36752
- ctx.addIssue({
36753
- code: exports_external.ZodIssueCode.custom,
36754
- path: ["improve", "strategies", strategyName, "processes", processName, "engine"],
36755
- message: "engine does not name a configured engine"
36756
- });
36757
- }
36758
- }
36759
- const judgmentEngine = processConfig.judgment?.engine;
36760
- if (processConfig.judgment?.enabled === true && judgmentEngine) {
36761
- const engine = config.engines?.[judgmentEngine];
36762
- if (!engine) {
36763
- ctx.addIssue({
36764
- code: exports_external.ZodIssueCode.custom,
36765
- path: ["improve", "strategies", strategyName, "processes", processName, "judgment", "engine"],
36766
- message: "engine does not name a configured engine"
36767
- });
36768
- }
36769
- }
36776
+ const probe = probeLock(lockPath);
36777
+ if (probe.state === "stale" && reclaimStaleLock(lockPath, probe)) {
36778
+ continue;
36770
36779
  }
36771
- }
36772
- if (config.defaultWriteTarget !== undefined) {
36773
- const knownNames = Object.keys(config.bundles ?? {});
36774
- if (knownNames.length === 0) {
36775
- ctx.addIssue({
36776
- code: exports_external.ZodIssueCode.custom,
36777
- path: ["defaultWriteTarget"],
36778
- message: `defaultWriteTarget "${config.defaultWriteTarget}" cannot be resolved: no bundles configured. ` + "Add at least one entry to `bundles` first."
36779
- });
36780
- } else if (!knownNames.includes(config.defaultWriteTarget)) {
36781
- ctx.addIssue({
36782
- code: exports_external.ZodIssueCode.custom,
36783
- path: ["defaultWriteTarget"],
36784
- message: `defaultWriteTarget "${config.defaultWriteTarget}" does not match any configured bundle: ${knownNames.map((n) => `"${n}"`).join(", ")}.`
36785
- });
36780
+ if (attempt < CONFIG_LOCK_MAX_RETRIES - 1) {
36781
+ sleepSyncMs(CONFIG_LOCK_RETRY_DELAY_MS);
36786
36782
  }
36787
36783
  }
36788
- });
36784
+ throw new ConfigError(`Timed out waiting for config lock at ${lockPath}. Another AKM process may be updating config.`, "INVALID_CONFIG_FILE");
36785
+ }
36786
+ function withConfigLock(fn) {
36787
+ const release = acquireConfigLock();
36788
+ try {
36789
+ return fn();
36790
+ } finally {
36791
+ release();
36792
+ }
36793
+ }
36789
36794
 
36790
36795
  // src/core/config/config-sources.ts
36791
36796
  import { createHash } from "node:crypto";
@@ -36920,41 +36925,6 @@ function normalizeInstalledGitRef(source, ref) {
36920
36925
  return requestedRef ? `${cloneUrl}/tree/${requestedRef}` : cloneUrl;
36921
36926
  }
36922
36927
 
36923
- // src/core/config/deep-merge.ts
36924
- var UNSAFE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
36925
- function isPlainObject(value) {
36926
- if (value === null || typeof value !== "object" || Array.isArray(value))
36927
- return false;
36928
- const prototype = Object.getPrototypeOf(value);
36929
- return prototype === Object.prototype || prototype === null;
36930
- }
36931
- function copyConfigValue(value) {
36932
- if (Array.isArray(value))
36933
- return value.map(copyConfigValue);
36934
- if (!isPlainObject(value))
36935
- return value;
36936
- const copy = {};
36937
- for (const key of Object.keys(value)) {
36938
- if (UNSAFE_KEYS.has(key))
36939
- throw new TypeError(`Unsafe configuration key: ${key}`);
36940
- copy[key] = copyConfigValue(value[key]);
36941
- }
36942
- return copy;
36943
- }
36944
- function deepMergeConfig(base, override) {
36945
- const result = copyConfigValue(base);
36946
- for (const key of Object.keys(override)) {
36947
- if (UNSAFE_KEYS.has(key))
36948
- throw new TypeError(`Unsafe configuration key: ${key}`);
36949
- const next = override[key];
36950
- if (next === undefined)
36951
- continue;
36952
- const current = result[key];
36953
- result[key] = isPlainObject(current) && isPlainObject(next) ? deepMergeConfig(current, next) : copyConfigValue(next);
36954
- }
36955
- return result;
36956
- }
36957
-
36958
36928
  // src/core/config/config-walker.ts
36959
36929
  function unwrap(schema) {
36960
36930
  let current = schema;
@@ -37203,11 +37173,12 @@ ${lines}`, "INVALID_CONFIG_FILE");
37203
37173
  assertUniquePhysicalBundleRoots(finalResult.data, sourcePath);
37204
37174
  return finalResult.data;
37205
37175
  }
37176
+ var RETIRED_CATCHALL_KEY_PATHS = new Set(["index.graph", "index.metadataEnhance"]);
37206
37177
  function unknownConfigKeyPaths(root, node = root, prefix = []) {
37207
37178
  const found = [];
37208
37179
  for (const key of Object.keys(node).sort()) {
37209
37180
  const keyPath = [...prefix, key];
37210
- if (resolveSchemaAt(keyPath, root) === undefined) {
37181
+ if (RETIRED_CATCHALL_KEY_PATHS.has(keyPath.join(".")) || resolveSchemaAt(keyPath, root) === undefined) {
37211
37182
  found.push(keyPath);
37212
37183
  continue;
37213
37184
  }
@@ -37498,6 +37469,9 @@ function normalizeConfigFile(configPath, options) {
37498
37469
  const body = withSchedulerOnDisk(configWriteBody(localRaw, current, next), next);
37499
37470
  for (const keyPath of unknownConfigKeyPaths(body))
37500
37471
  deleteConfigPath(body, keyPath);
37472
+ const strategies = body.improve?.strategies;
37473
+ if (strategies && Object.hasOwn(strategies, "graph-refresh"))
37474
+ delete strategies["graph-refresh"];
37501
37475
  const keys = [...new Set([...Object.keys(raw), ...Object.keys(body)])].filter((key) => JSON.stringify(raw[key]) !== JSON.stringify(body[key])).sort();
37502
37476
  if (keys.length === 0 || !options.apply)
37503
37477
  return { keys, changed: keys.length > 0, applied: false };
@@ -37572,7 +37546,6 @@ function resolveSecret(value, resolveFromStore) {
37572
37546
  return resolved ?? "";
37573
37547
  });
37574
37548
  }
37575
- var INDEX_RESERVED_KEYS = new Set(["metadataEnhance"]);
37576
37549
 
37577
37550
  // src/core/redaction.ts
37578
37551
  var ENV_PASSTHROUGH_REDACTION_POLICY = {
@@ -52777,6 +52750,7 @@ var LEDGER_HARD_OUTCOMES = new Set([
52777
52750
  "quality_rejected",
52778
52751
  "expired"
52779
52752
  ]);
52753
+ var hasContentHashColumnCache = new WeakMap;
52780
52754
 
52781
52755
  // src/commands/improve/improve-strategies.ts
52782
52756
  var REF_SCOPED_PROCESSES = new Set(["reflect", "distill", "consolidate"]);
@@ -52784,7 +52758,6 @@ var BUILTIN_STRATEGIES = {
52784
52758
  default: default_default,
52785
52759
  quick: quick_default,
52786
52760
  thorough: thorough_default,
52787
- "graph-refresh": graph_refresh_default,
52788
52761
  consolidate: consolidate_default,
52789
52762
  catchup: catchup_default,
52790
52763
  "reflect-distill": reflect_distill_default,