substrate-ai 0.20.51 → 0.20.53

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, InMemoryDatabaseAdapter, 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-VcMmfo2w.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, runProbeAuthor, runSolutioningPhase, validateStopAfterFromConflict } from "../run-Bxj9qu4z.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, runProbeAuthor, runSolutioningPhase, validateStopAfterFromConflict } from "../run-BxDi30CG.js";
8
8
  import "../errors-CogpxBUg.js";
9
9
  import "../routing-CcBOCuC9.js";
10
10
  import "../decisions-C0pz9Clx.js";
@@ -5204,7 +5204,7 @@ async function runSupervisorAction(options, deps = {}) {
5204
5204
  await initSchema(expAdapter);
5205
5205
  const { runRunAction: runPipeline } = await import(
5206
5206
  /* @vite-ignore */
5207
- "../run-CH2HXCRz.js"
5207
+ "../run-7s_WEIAe.js"
5208
5208
  );
5209
5209
  const runStoryFn = async (opts) => {
5210
5210
  const exitCode = await runPipeline({
@@ -2,7 +2,7 @@ import "./health-sQ1X_5_6.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
4
  import "./dist-VcMmfo2w.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-Bxj9qu4z.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-BxDi30CG.js";
6
6
  import "./routing-CcBOCuC9.js";
7
7
  import "./decisions-C0pz9Clx.js";
8
8
 
@@ -8405,9 +8405,19 @@ async function getArchConstraints$1(deps) {
8405
8405
  //#endregion
8406
8406
  //#region src/modules/implementation-orchestrator/probe-author-integration.ts
8407
8407
  const logger$14 = createLogger("implementation-orchestrator:probe-author");
8408
- /** Default timeout for probe-author dispatches (5 min) */
8409
- const DEFAULT_TIMEOUT_MS = 3e5;
8410
- /** Timeout multiplier for the single retry after a timeout failure */
8408
+ /**
8409
+ * Default timeout for probe-author dispatches (10 min).
8410
+ * obs_2026-05-04_023 layer 2: raised from 300_000 600_000 after Story
8411
+ * 65-3 eval surfaced 2/8 cases timing out at 600s wall-clock (300s + 450s
8412
+ * retry). Configurable via SUBSTRATE_PROBE_AUTHOR_TIMEOUT_MS env var.
8413
+ *
8414
+ * Story 65-7's initial fix exposed `INITIAL_TIMEOUT_MS` from
8415
+ * compiled-workflows/probe-author.ts but the dispatch path actually lives
8416
+ * here (probe-author-integration.ts). The env-var read MUST be at this
8417
+ * site to take effect in production. This patch closes the AC4 gap.
8418
+ */
8419
+ const DEFAULT_TIMEOUT_MS = process.env.SUBSTRATE_PROBE_AUTHOR_TIMEOUT_MS ? parseInt(process.env.SUBSTRATE_PROBE_AUTHOR_TIMEOUT_MS, 10) : 6e5;
8420
+ /** Timeout multiplier for the single retry after a timeout failure (1.5x). */
8411
8421
  const TIMEOUT_RETRY_MULTIPLIER = 1.5;
8412
8422
  /**
8413
8423
  * Execute the probe-author integration phase.
@@ -45380,4 +45390,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
45380
45390
 
45381
45391
  //#endregion
45382
45392
  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, runProbeAuthor, runRunAction, runSolutioningPhase, validateStopAfterFromConflict, wireNdjsonEmitter };
45383
- //# sourceMappingURL=run-Bxj9qu4z.js.map
45393
+ //# sourceMappingURL=run-BxDi30CG.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.20.51",
3
+ "version": "0.20.53",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -162,6 +162,156 @@ Strata Story 2-4 ("morning briefing generator", v0.20.41) shipped two architectu
162
162
 
163
163
  A one-repo variant of this probe would pass against the (broken) v0.20.41 implementation; the two-repo variant catches the wrong-cwd defect because the parent-cwd `git log --all` returns BOTH commits but substring-match attribution mis-routes them.
164
164
 
165
+ ## State-integration probe shapes
166
+
167
+ State-integration probes exercise code that reads from or writes to external state: the filesystem, subprocesses, git repositories, databases, network endpoints, and registries. Four principles govern probe design in this category:
168
+
169
+ 1. **Real-state context, not synthesized**: populate a tmpdir with a structure matching the production layout (e.g., for fleet-scanning logic, N subdirs each containing a `.git` directory). Do not pass artificial in-memory structures or bypass the I/O layer.
170
+ 2. **Sandbox choice leans `twin` more often**: any probe that touches the user's home directory, writes to the filesystem outside the project, or exercises a running service MUST use `sandbox: twin`. Reserve `sandbox: host` exclusively for read-only registry / config-shape probes that cannot mutate host state.
171
+ 3. **Multi-resource fixtures MUST contain ≥2 distinct, non-overlapping resources**: a single-resource fixture silently passes when the defect only surfaces under multiplicity. Create two or more distinct instances and assert each one independently.
172
+ 4. **External-binary availability assertions**: if the probe invokes `git`, `dolt`, `podman`, or any other binary that may not be installed, either add a sibling availability probe or put an inline `command -v <binary> || { echo "NOT_FOUND"; exit 1; }` check at the top of the `command:` block.
173
+
174
+ ### Filesystem shape
175
+
176
+ Populate a tmpdir with a production-layout directory structure and assert file contents or directory invariants. Use `sandbox: twin` — the probe writes to the filesystem.
177
+
178
+ ```yaml
179
+ - name: fleet-config-files-written-per-project
180
+ sandbox: twin
181
+ command: |
182
+ set -e
183
+ FLEET=$(mktemp -d)
184
+ mkdir -p "$FLEET/alpha" "$FLEET/beta"
185
+ node <REPO_ROOT>/dist/cli.mjs scan-fleet --root "$FLEET"
186
+ test -f "$FLEET/alpha/config.json" && echo "ALPHA_CONFIG_FOUND"
187
+ test -f "$FLEET/beta/config.json" && echo "BETA_CONFIG_FOUND"
188
+ expect_stdout_regex:
189
+ - ALPHA_CONFIG_FOUND
190
+ - BETA_CONFIG_FOUND
191
+ description: fleet scanner writes per-project config files to production-layout tmpdir with ≥2 dirs
192
+ ```
193
+
194
+ ### Subprocess shape
195
+
196
+ Assert binary availability first via `command -v`, then exercise the subprocess via its production invocation path. Use `sandbox: twin` — the probe may mutate host state.
197
+
198
+ ```yaml
199
+ - name: git-binary-available
200
+ sandbox: host
201
+ command: |
202
+ command -v git && echo "GIT_FOUND" || { echo "GIT_NOT_FOUND"; exit 1; }
203
+ expect_stdout_regex:
204
+ - GIT_FOUND
205
+ description: git binary must be on PATH before subprocess probes run
206
+ - name: subprocess-production-path-invoked
207
+ sandbox: twin
208
+ command: |
209
+ set -e
210
+ TMPOUT=$(mktemp)
211
+ node <REPO_ROOT>/dist/cli.mjs run-task --output "$TMPOUT"
212
+ grep -q '"status":"ok"' "$TMPOUT" && echo "TASK_COMPLETED"
213
+ expect_stdout_regex:
214
+ - TASK_COMPLETED
215
+ description: subprocess invocation via production CLI path produces expected output shape
216
+ ```
217
+
218
+ ### Git shape (canonical obs_017 pattern)
219
+
220
+ Create a ≥2-repo fleet in a tmpdir with non-overlapping commit messages, set `cwd` per-repo (NOT fleet root), and assert each repo's commits are attributed correctly. This is the canonical obs_017 pattern: the cwd-as-parent defect produces plausible output against a one-repo fleet but fails with two repos because `git log` at fleet root aggregates all repos' commits into one undifferentiated blob, making per-project attribution impossible.
221
+
222
+ ```yaml
223
+ - name: git-per-repo-commit-attribution
224
+ sandbox: twin
225
+ command: |
226
+ set -e
227
+ FLEET=$(mktemp -d)
228
+ for proj in alpha beta; do
229
+ mkdir -p "$FLEET/$proj"
230
+ git -C "$FLEET/$proj" init -q
231
+ git -C "$FLEET/$proj" config user.email t@example.com
232
+ git -C "$FLEET/$proj" config user.name test
233
+ echo "$proj content" > "$FLEET/$proj/a.md"
234
+ git -C "$FLEET/$proj" add .
235
+ git -C "$FLEET/$proj" commit -qm "$proj-only commit"
236
+ done
237
+ ALPHA_LOG=$(git -C "$FLEET/alpha" log --oneline)
238
+ BETA_LOG=$(git -C "$FLEET/beta" log --oneline)
239
+ echo "alpha: $ALPHA_LOG"
240
+ echo "beta: $BETA_LOG"
241
+ expect_stdout_regex:
242
+ - 'alpha:.*alpha-only commit'
243
+ - 'beta:.*beta-only commit'
244
+ expect_stdout_no_regex:
245
+ - 'alpha:.*beta-only commit'
246
+ - 'beta:.*alpha-only commit'
247
+ description: >-
248
+ per-repo cwd correctly isolates each project's commits — catches the cwd-as-parent
249
+ defect (obs_017) where git log at fleet root aggregates all repos into one blob
250
+ ```
251
+
252
+ ### Database shape
253
+
254
+ Exercise a Dolt or SQLite database in a twin sandbox, seeding ≥2 rows and asserting per-row behavior. Use `sandbox: twin`.
255
+
256
+ ```yaml
257
+ - name: database-per-row-attribution
258
+ sandbox: twin
259
+ command: |
260
+ set -e
261
+ DBDIR=$(mktemp -d)
262
+ sqlite3 "$DBDIR/test.db" "CREATE TABLE items (id INTEGER, name TEXT);"
263
+ sqlite3 "$DBDIR/test.db" "INSERT INTO items VALUES (1, 'alpha-item');"
264
+ sqlite3 "$DBDIR/test.db" "INSERT INTO items VALUES (2, 'beta-item');"
265
+ node <REPO_ROOT>/dist/cli.mjs query-items --db "$DBDIR/test.db"
266
+ expect_stdout_regex:
267
+ - alpha-item
268
+ - beta-item
269
+ description: database probe seeds ≥2 rows and asserts per-row output is correctly attributed
270
+ ```
271
+
272
+ ### Network shape
273
+
274
+ Exercise an HTTP endpoint with `expect_stdout_no_regex` error-envelope guards. Use `sandbox: twin` for endpoints that mutate state; `sandbox: host` for strictly read-only checks that cannot affect the host.
275
+
276
+ ```yaml
277
+ - name: api-endpoint-returns-success-shape
278
+ sandbox: twin
279
+ command: |
280
+ set -e
281
+ curl -sf http://localhost:3000/health
282
+ expect_stdout_no_regex:
283
+ - '"isError"\s*:\s*true'
284
+ - '"status"\s*:\s*"error"'
285
+ - '"error"\s*:'
286
+ expect_stdout_regex:
287
+ - '"status"\s*:\s*"ok"'
288
+ description: health endpoint returns success-shaped JSON without error envelope
289
+ ```
290
+
291
+ ### Registry shape
292
+
293
+ Read from an npm/package registry or fleet-config source. Precede the registry probe with a binary-availability sibling probe. Use `sandbox: host` — registry reads are strictly read-only and cannot mutate host state.
294
+
295
+ ```yaml
296
+ - name: npm-binary-available
297
+ sandbox: host
298
+ command: |
299
+ command -v npm && echo "NPM_FOUND" || { echo "NPM_NOT_FOUND"; exit 1; }
300
+ expect_stdout_regex:
301
+ - NPM_FOUND
302
+ description: npm binary must be on PATH before registry probe runs
303
+ - name: package-registry-version-resolves
304
+ sandbox: host
305
+ command: |
306
+ npm view @substrate-ai/sdlc version 2>&1
307
+ expect_stdout_no_regex:
308
+ - 'Not found'
309
+ - 'npm ERR!'
310
+ expect_stdout_regex:
311
+ - '\d+\.\d+\.\d+'
312
+ description: npm registry resolves @substrate-ai/sdlc and returns a semver version string
313
+ ```
314
+
165
315
  ## Mission
166
316
 
167
317
  Author runtime probes for the story described above. Use the AC sections provided: