substrate-ai 0.8.4 → 0.8.6

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.
package/dist/cli/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { DoltClient, DoltNotInstalled, FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, checkDoltInstalled, createDatabaseAdapter, createDoltClient, createStateStore, detectCycles, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initSchema, initializeDolt, isSyncAdapter, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot } from "../health-C-VRJruD.js";
3
3
  import { createLogger } from "../logger-D2fS2ccL.js";
4
4
  import { AdapterRegistry } from "../adapter-registry-D2zdMwVu.js";
5
- import { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createConfigSystem, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, registerRunCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-CG1LOXIa.js";
5
+ import { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createConfigSystem, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, registerRunCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-ClxNDHbr.js";
6
6
  import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema } from "../config-migrator-CtGelIsG.js";
7
7
  import { ConfigError, createEventBus } from "../helpers-CpMs8VZX.js";
8
8
  import { RoutingRecommender } from "../routing-BVrxrM6v.js";
@@ -3549,7 +3549,7 @@ async function runSupervisorAction(options, deps = {}) {
3549
3549
  await initSchema(expAdapter);
3550
3550
  const { runRunAction: runPipeline } = await import(
3551
3551
  /* @vite-ignore */
3552
- "../run-CoRKAliC.js"
3552
+ "../run-MAQ3Wuju.js"
3553
3553
  );
3554
3554
  const runStoryFn = async (opts) => {
3555
3555
  const exitCode = await runPipeline({
@@ -4934,7 +4934,7 @@ const MIN_FREE_MEMORY_BYTES = (() => {
4934
4934
  const parsed = parseInt(envMB, 10);
4935
4935
  if (!isNaN(parsed) && parsed >= 0) return parsed * 1024 * 1024;
4936
4936
  }
4937
- return 256 * 1024 * 1024;
4937
+ return 128 * 1024 * 1024;
4938
4938
  })();
4939
4939
  const MEMORY_PRESSURE_POLL_MS = 1e4;
4940
4940
  const MEMORY_PRESSURE_MAX_HOLD_MS = 3e5;
@@ -4955,10 +4955,12 @@ let _lastKnownPressureLevel = 0;
4955
4955
  * Note: level 2 fires frequently on macOS when the compressor is active,
4956
4956
  * even with gigabytes of reclaimable memory. Hard-gating at 2 caused
4957
4957
  * false stalls on 24GB+ machines with >50% free RAM.
4958
- * 2. Use a conservative page calculation: free + purgeable + speculative.
4959
- * These categories are truly reclaimable without I/O or decompression.
4960
- * Inactive pages are excluded because they may require disk I/O,
4961
- * decompression, or may already be backing the compressor.
4958
+ * 2. Use page calculation: free + inactive + purgeable + speculative.
4959
+ * These categories are reclaimable by the OS — matching macOS Activity
4960
+ * Monitor's definition of available memory (Physical - Used).
4961
+ * Inactive pages ("Cached Files") are included because macOS reclaims
4962
+ * them transparently. Excluding them caused substrate to see ~3 GB
4963
+ * available when Activity Monitor showed ~8 GB on a 24 GB machine.
4962
4964
  */
4963
4965
  function getAvailableMemory() {
4964
4966
  if (platform() === "darwin") {
@@ -4981,9 +4983,10 @@ function getAvailableMemory() {
4981
4983
  });
4982
4984
  const pageSize = parseInt(vmstat.match(/page size of (\d+)/)?.[1] ?? "4096", 10);
4983
4985
  const free = parseInt(vmstat.match(/Pages free:\s+(\d+)/)?.[1] ?? "0", 10);
4986
+ const inactive = parseInt(vmstat.match(/Pages inactive:\s+(\d+)/)?.[1] ?? "0", 10);
4984
4987
  const purgeable = parseInt(vmstat.match(/Pages purgeable:\s+(\d+)/)?.[1] ?? "0", 10);
4985
4988
  const speculative = parseInt(vmstat.match(/Pages speculative:\s+(\d+)/)?.[1] ?? "0", 10);
4986
- const available = (free + purgeable + speculative) * pageSize;
4989
+ const available = (free + inactive + purgeable + speculative) * pageSize;
4987
4990
  if (pressureLevel >= 2) logger$22.debug({
4988
4991
  pressureLevel,
4989
4992
  available
@@ -14152,6 +14155,19 @@ function createImplementationOrchestrator(deps) {
14152
14155
  let devFilesModified = [];
14153
14156
  const batchFileGroups = [];
14154
14157
  let devStoryWasSuccess = false;
14158
+ let baselineHeadSha;
14159
+ try {
14160
+ baselineHeadSha = execSync("git rev-parse HEAD", {
14161
+ cwd: projectRoot ?? process.cwd(),
14162
+ encoding: "utf-8",
14163
+ timeout: 3e3,
14164
+ stdio: [
14165
+ "ignore",
14166
+ "pipe",
14167
+ "pipe"
14168
+ ]
14169
+ }).trim();
14170
+ } catch {}
14155
14171
  try {
14156
14172
  let storyContentForAnalysis = "";
14157
14173
  try {
@@ -14525,26 +14541,46 @@ function createImplementationOrchestrator(deps) {
14525
14541
  if (devStoryWasSuccess) {
14526
14542
  gitDiffFiles = checkGitDiffFiles(projectRoot ?? process.cwd());
14527
14543
  if (gitDiffFiles.length === 0) {
14528
- logger$25.warn({ storyKey }, "Zero-diff detected after COMPLETE dev-story — no file changes in git working tree");
14529
- eventBus.emit("orchestrator:zero-diff-escalation", {
14530
- storyKey,
14531
- reason: "zero-diff-on-complete"
14532
- });
14533
- endPhase(storyKey, "dev-story");
14534
- updateStory(storyKey, {
14535
- phase: "ESCALATED",
14536
- error: "zero-diff-on-complete",
14537
- completedAt: new Date().toISOString()
14538
- });
14539
- await writeStoryMetricsBestEffort(storyKey, "escalated", 0);
14540
- await emitEscalation({
14544
+ let hasNewCommits = false;
14545
+ if (baselineHeadSha) try {
14546
+ const currentHead = execSync("git rev-parse HEAD", {
14547
+ cwd: projectRoot ?? process.cwd(),
14548
+ encoding: "utf-8",
14549
+ timeout: 3e3,
14550
+ stdio: [
14551
+ "ignore",
14552
+ "pipe",
14553
+ "pipe"
14554
+ ]
14555
+ }).trim();
14556
+ hasNewCommits = currentHead !== baselineHeadSha;
14557
+ } catch {}
14558
+ if (hasNewCommits) logger$25.info({
14541
14559
  storyKey,
14542
- lastVerdict: "zero-diff-on-complete",
14543
- reviewCycles: 0,
14544
- issues: ["dev-story completed with COMPLETE verdict but no file changes detected in git diff"]
14545
- });
14546
- await persistState();
14547
- return;
14560
+ baselineHeadSha
14561
+ }, "Working tree clean but new commits detected since dispatch — skipping zero-diff escalation");
14562
+ else {
14563
+ logger$25.warn({ storyKey }, "Zero-diff detected after COMPLETE dev-story — no file changes and no new commits");
14564
+ eventBus.emit("orchestrator:zero-diff-escalation", {
14565
+ storyKey,
14566
+ reason: "zero-diff-on-complete"
14567
+ });
14568
+ endPhase(storyKey, "dev-story");
14569
+ updateStory(storyKey, {
14570
+ phase: "ESCALATED",
14571
+ error: "zero-diff-on-complete",
14572
+ completedAt: new Date().toISOString()
14573
+ });
14574
+ await writeStoryMetricsBestEffort(storyKey, "escalated", 0);
14575
+ await emitEscalation({
14576
+ storyKey,
14577
+ lastVerdict: "zero-diff-on-complete",
14578
+ reviewCycles: 0,
14579
+ issues: ["dev-story completed with COMPLETE verdict but no file changes detected in git diff"]
14580
+ });
14581
+ await persistState();
14582
+ return;
14583
+ }
14548
14584
  }
14549
14585
  }
14550
14586
  endPhase(storyKey, "dev-story");
@@ -21395,4 +21431,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
21395
21431
 
21396
21432
  //#endregion
21397
21433
  export { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createConfigSystem, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, registerRunCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
21398
- //# sourceMappingURL=run-CG1LOXIa.js.map
21434
+ //# sourceMappingURL=run-ClxNDHbr.js.map
@@ -1,6 +1,6 @@
1
1
  import "./health-C-VRJruD.js";
2
2
  import "./logger-D2fS2ccL.js";
3
- import { registerRunCommand, runRunAction } from "./run-CG1LOXIa.js";
3
+ import { registerRunCommand, runRunAction } from "./run-ClxNDHbr.js";
4
4
  import "./config-migrator-CtGelIsG.js";
5
5
  import "./helpers-CpMs8VZX.js";
6
6
  import "./routing-BVrxrM6v.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",