substrate-ai 0.8.3 → 0.8.5

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-CjMXknWq.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";
@@ -1651,9 +1651,11 @@ async function runResumeAction(options) {
1651
1651
  }
1652
1652
  if (outputFormat === "human") process.stdout.write(`Resuming from phase: ${resumePhase}\n`);
1653
1653
  let concept = "";
1654
+ let scopedStories;
1654
1655
  try {
1655
1656
  const config = JSON.parse(run.config_json ?? "{}");
1656
1657
  concept = config.concept ?? "";
1658
+ if (Array.isArray(config.explicitStories) && config.explicitStories.length > 0) scopedStories = config.explicitStories;
1657
1659
  } catch {}
1658
1660
  const dbDir = dbPath.replace("/substrate.db", "");
1659
1661
  return runFullPipelineFromPhase({
@@ -1670,7 +1672,7 @@ async function runResumeAction(options) {
1670
1672
  existingRunId: runId,
1671
1673
  projectRoot,
1672
1674
  registry,
1673
- stories: options.stories
1675
+ stories: options.stories ?? scopedStories
1674
1676
  });
1675
1677
  } catch (err) {
1676
1678
  const msg = err instanceof Error ? err.message : String(err);
@@ -3293,7 +3295,8 @@ async function handleStallRecovery(health, state, config, deps, io) {
3293
3295
  const REVIEW_PHASES = new Set(["IN_REVIEW", "code-review"]);
3294
3296
  const activePhases = Object.values(health.stories.details ?? {}).map((s) => s.phase);
3295
3297
  const inReviewPhase = activePhases.some((p) => REVIEW_PHASES.has(p));
3296
- const effectiveThreshold = inReviewPhase ? stallThreshold * 2 : stallThreshold;
3298
+ const orchestratorIdle = health.process.child_pids.length === 0 && health.stories.active > 0;
3299
+ const effectiveThreshold = inReviewPhase && !orchestratorIdle ? stallThreshold * 2 : stallThreshold;
3297
3300
  if (health.staleness_seconds < effectiveThreshold) return null;
3298
3301
  const directPids = [...health.process.orchestrator_pid !== null ? [health.process.orchestrator_pid] : [], ...health.process.child_pids];
3299
3302
  const descendantPids = getAllDescendants(directPids);
@@ -3546,7 +3549,7 @@ async function runSupervisorAction(options, deps = {}) {
3546
3549
  await initSchema(expAdapter);
3547
3550
  const { runRunAction: runPipeline } = await import(
3548
3551
  /* @vite-ignore */
3549
- "../run-CoRKAliC.js"
3552
+ "../run-5gEwE_sv.js"
3550
3553
  );
3551
3554
  const runStoryFn = async (opts) => {
3552
3555
  const exitCode = await runPipeline({
@@ -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-CjMXknWq.js";
4
4
  import "./config-migrator-CtGelIsG.js";
5
5
  import "./helpers-CpMs8VZX.js";
6
6
  import "./routing-BVrxrM6v.js";
@@ -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
@@ -21395,4 +21398,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
21395
21398
 
21396
21399
  //#endregion
21397
21400
  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
21401
+ //# sourceMappingURL=run-CjMXknWq.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",