substrate-ai 0.19.50 → 0.19.52

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
@@ -4,7 +4,7 @@ import { createLogger } from "../logger-KeHncl-f.js";
4
4
  import { createEventBus } from "../helpers-CElYrONe.js";
5
5
  import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createDoltClient, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-sNh9XQ6V.js";
6
6
  import "../adapter-registry-DXLMTmfD.js";
7
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-DI5SzKf5.js";
7
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-BUKozIHS.js";
8
8
  import "../errors-RupuC-ES.js";
9
9
  import "../routing-CcBOCuC9.js";
10
10
  import "../decisions-C0pz9Clx.js";
@@ -5022,7 +5022,7 @@ async function runSupervisorAction(options, deps = {}) {
5022
5022
  await initSchema(expAdapter);
5023
5023
  const { runRunAction: runPipeline } = await import(
5024
5024
  /* @vite-ignore */
5025
- "../run-zENUXBXk.js"
5025
+ "../run-BwMDKH66.js"
5026
5026
  );
5027
5027
  const runStoryFn = async (opts) => {
5028
5028
  const exitCode = await runPipeline({
@@ -6213,6 +6213,29 @@ async function getGitDiffStatSummary(workingDirectory = process.cwd()) {
6213
6213
  ], workingDirectory, "git-diff-stat");
6214
6214
  }
6215
6215
  /**
6216
+ * Capture the diff between two commits (e.g., baseline..HEAD).
6217
+ * Used when the dev-story agent committed its work, making `git diff HEAD`
6218
+ * empty. This shows what was actually changed.
6219
+ *
6220
+ * @param baseCommit - Starting commit SHA
6221
+ * @param endCommit - Ending commit SHA (defaults to 'HEAD')
6222
+ * @param workingDirectory - Directory to run git in
6223
+ * @returns The diff string, or '' on error
6224
+ */
6225
+ async function getGitDiffBetweenCommits(baseCommit, endCommit = "HEAD", workingDirectory = process.cwd()) {
6226
+ return runGitCommand(["diff", `${baseCommit}..${endCommit}`], workingDirectory, "git-diff-commits");
6227
+ }
6228
+ /**
6229
+ * Capture the stat-only diff between two commits.
6230
+ */
6231
+ async function getGitDiffStatBetweenCommits(baseCommit, endCommit = "HEAD", workingDirectory = process.cwd()) {
6232
+ return runGitCommand([
6233
+ "diff",
6234
+ "--stat",
6235
+ `${baseCommit}..${endCommit}`
6236
+ ], workingDirectory, "git-diff-stat-commits");
6237
+ }
6238
+ /**
6216
6239
  * Capture the git diff scoped to specific files.
6217
6240
  *
6218
6241
  * Runs `git diff HEAD -- file1.ts file2.ts ...` to produce a diff
@@ -7738,7 +7761,7 @@ async function countTestMetrics(filesModified, cwd) {
7738
7761
  * @returns Promise resolving to CodeReviewResult
7739
7762
  */
7740
7763
  async function runCodeReview(deps, params) {
7741
- const { storyKey, storyFilePath, workingDirectory, pipelineRunId, filesModified, previousIssues, buildPassed } = params;
7764
+ const { storyKey, storyFilePath, workingDirectory, pipelineRunId, filesModified, previousIssues, buildPassed, baselineCommit } = params;
7742
7765
  const cwd = workingDirectory ?? process.cwd();
7743
7766
  logger$14.debug({
7744
7767
  storyKey,
@@ -7814,6 +7837,22 @@ async function runCodeReview(deps, params) {
7814
7837
  gitDiffContent = await getGitDiffStatSummary(cwd);
7815
7838
  }
7816
7839
  }
7840
+ if (gitDiffContent.trim().length === 0 && baselineCommit) {
7841
+ logger$14.info({
7842
+ storyKey,
7843
+ baselineCommit
7844
+ }, "Working tree diff empty — diffing against baseline commit");
7845
+ const commitDiff = await getGitDiffBetweenCommits(baselineCommit, "HEAD", cwd);
7846
+ const commitTotal = nonDiffTokens + countTokens(commitDiff);
7847
+ if (commitDiff.trim().length > 0) if (commitTotal <= TOKEN_CEILING) gitDiffContent = commitDiff;
7848
+ else {
7849
+ logger$14.warn({
7850
+ estimatedTotal: commitTotal,
7851
+ ceiling: TOKEN_CEILING
7852
+ }, "Baseline..HEAD diff exceeds token ceiling — using stat-only summary");
7853
+ gitDiffContent = await getGitDiffStatBetweenCommits(baselineCommit, "HEAD", cwd);
7854
+ }
7855
+ }
7817
7856
  if (gitDiffContent.trim().length === 0) {
7818
7857
  logger$14.info({ storyKey }, "Empty git diff — skipping review with SHIP_IT");
7819
7858
  return {
@@ -12974,11 +13013,26 @@ function createImplementationOrchestrator(deps) {
12974
13013
  }).trim();
12975
13014
  hasNewCommits = currentHead !== baselineHeadSha;
12976
13015
  } catch {}
12977
- if (hasNewCommits) logger$24.info({
12978
- storyKey,
12979
- baselineHeadSha
12980
- }, "Working tree clean but new commits detected since dispatch — skipping zero-diff escalation");
12981
- else {
13016
+ if (hasNewCommits && baselineHeadSha) {
13017
+ try {
13018
+ const committedFiles = execSync(`git diff --name-only ${baselineHeadSha}..HEAD`, {
13019
+ cwd: projectRoot ?? process.cwd(),
13020
+ encoding: "utf-8",
13021
+ timeout: 5e3,
13022
+ stdio: [
13023
+ "ignore",
13024
+ "pipe",
13025
+ "pipe"
13026
+ ]
13027
+ }).trim();
13028
+ if (committedFiles.length > 0) gitDiffFiles = committedFiles.split("\n").filter(Boolean);
13029
+ } catch {}
13030
+ logger$24.info({
13031
+ storyKey,
13032
+ baselineHeadSha,
13033
+ committedFileCount: gitDiffFiles?.length ?? 0
13034
+ }, "Working tree clean but new commits detected since dispatch — skipping zero-diff escalation");
13035
+ } else {
12982
13036
  logger$24.warn({ storyKey }, "Zero-diff detected after COMPLETE dev-story — no file changes and no new commits");
12983
13037
  eventBus.emit("orchestrator:zero-diff-escalation", {
12984
13038
  storyKey,
@@ -13320,7 +13374,8 @@ function createImplementationOrchestrator(deps) {
13320
13374
  workingDirectory: projectRoot,
13321
13375
  pipelineRunId: config.pipelineRunId,
13322
13376
  filesModified: group.files,
13323
- buildPassed: _buildPassed
13377
+ buildPassed: _buildPassed,
13378
+ ...baselineHeadSha ? { baselineCommit: baselineHeadSha } : {}
13324
13379
  });
13325
13380
  if (batchReview.tokenUsage) {
13326
13381
  aggregateTokens.input += batchReview.tokenUsage.input;
@@ -13367,7 +13422,8 @@ function createImplementationOrchestrator(deps) {
13367
13422
  pipelineRunId: config.pipelineRunId,
13368
13423
  filesModified: devFilesModified,
13369
13424
  buildPassed: _buildPassed,
13370
- ...previousIssueList.length > 0 ? { previousIssues: previousIssueList } : {}
13425
+ ...previousIssueList.length > 0 ? { previousIssues: previousIssueList } : {},
13426
+ ...baselineHeadSha ? { baselineCommit: baselineHeadSha } : {}
13371
13427
  });
13372
13428
  }
13373
13429
  if (config.pipelineRunId !== void 0 && reviewResult.tokenUsage !== void 0) try {
@@ -43021,4 +43077,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
43021
43077
 
43022
43078
  //#endregion
43023
43079
  export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict, wireNdjsonEmitter };
43024
- //# sourceMappingURL=run-DI5SzKf5.js.map
43080
+ //# sourceMappingURL=run-BUKozIHS.js.map
@@ -2,7 +2,7 @@ import "./health-DrZiqv4h.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
4
  import "./dist-sNh9XQ6V.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-DI5SzKf5.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-BUKozIHS.js";
6
6
  import "./routing-CcBOCuC9.js";
7
7
  import "./decisions-C0pz9Clx.js";
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.19.50",
3
+ "version": "0.19.52",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",