substrate-ai 0.4.9 → 0.4.10

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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DatabaseWrapper, DoltClient, DoltNotInstalled, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, FileStateStore, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SUBSTRATE_OWNED_SETTINGS_KEYS, SymbolParser, TelemetryPersistence, VALID_PHASES, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDispatcher, createDoltClient, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initializeDolt, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-Dx7bxebF.js";
2
+ import { AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DatabaseWrapper, DoltClient, DoltNotInstalled, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, FileStateStore, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SUBSTRATE_OWNED_SETTINGS_KEYS, SymbolParser, TelemetryPersistence, VALID_PHASES, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDispatcher, createDoltClient, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initializeDolt, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-BErnJT9a.js";
3
3
  import { createLogger } from "../logger-D2fS2ccL.js";
4
4
  import { AdapterRegistry } from "../adapter-registry-Cd-7lG5v.js";
5
5
  import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema } from "../config-migrator-DtZW1maj.js";
@@ -2709,7 +2709,7 @@ async function runSupervisorAction(options, deps = {}) {
2709
2709
  const expDb = expDbWrapper.db;
2710
2710
  const { runRunAction: runPipeline } = await import(
2711
2711
  /* @vite-ignore */
2712
- "../run-c8_Yj6xH.js"
2712
+ "../run-BbdWeKiB.js"
2713
2713
  );
2714
2714
  const runStoryFn = async (opts) => {
2715
2715
  const exitCode = await runPipeline({
@@ -12568,11 +12568,15 @@ var EfficiencyScorer = class {
12568
12568
  return sum / turns.length;
12569
12569
  }
12570
12570
  /**
12571
- * Average I/O ratio: inputTokens / max(outputTokens, 1) per turn.
12571
+ * Average I/O ratio: totalInput / max(outputTokens, 1) per turn.
12572
+ * Total input = inputTokens (fresh) + cacheReadTokens (cached).
12572
12573
  */
12573
12574
  _computeAvgIoRatio(turns) {
12574
12575
  if (turns.length === 0) return 0;
12575
- const sum = turns.reduce((acc, t) => acc + t.inputTokens / Math.max(t.outputTokens, 1), 0);
12576
+ const sum = turns.reduce((acc, t) => {
12577
+ const totalInput = t.inputTokens + (t.cacheReadTokens ?? 0);
12578
+ return acc + totalInput / Math.max(t.outputTokens, 1);
12579
+ }, 0);
12576
12580
  return sum / turns.length;
12577
12581
  }
12578
12582
  /**
@@ -12590,7 +12594,10 @@ var EfficiencyScorer = class {
12590
12594
  const result = [];
12591
12595
  for (const [model, groupTurns] of groups) {
12592
12596
  const cacheHitRate = groupTurns.reduce((acc, t) => acc + t.cacheHitRate, 0) / groupTurns.length;
12593
- const avgIoRatio = groupTurns.reduce((acc, t) => acc + t.inputTokens / Math.max(t.outputTokens, 1), 0) / groupTurns.length;
12597
+ const avgIoRatio = groupTurns.reduce((acc, t) => {
12598
+ const totalInput = t.inputTokens + (t.cacheReadTokens ?? 0);
12599
+ return acc + totalInput / Math.max(t.outputTokens, 1);
12600
+ }, 0) / groupTurns.length;
12594
12601
  const totalCostUsd = groupTurns.reduce((acc, t) => acc + t.costUsd, 0);
12595
12602
  const totalOutputTokens = groupTurns.reduce((acc, t) => acc + t.outputTokens, 0);
12596
12603
  const costPer1KOutputTokens = totalCostUsd / Math.max(totalOutputTokens, 1) * 1e3;
@@ -12637,7 +12644,10 @@ var EfficiencyScorer = class {
12637
12644
  }
12638
12645
  _computeIoRatioSubScoreForGroup(turns) {
12639
12646
  if (turns.length === 0) return 0;
12640
- const avg = turns.reduce((acc, t) => acc + t.inputTokens / Math.max(t.outputTokens, 1), 0) / turns.length;
12647
+ const avg = turns.reduce((acc, t) => {
12648
+ const totalInput = t.inputTokens + (t.cacheReadTokens ?? 0);
12649
+ return acc + totalInput / Math.max(t.outputTokens, 1);
12650
+ }, 0) / turns.length;
12641
12651
  return this._clamp(100 - (avg - 1) * 20, 0, 100);
12642
12652
  }
12643
12653
  _computeContextManagementSubScoreForGroup(turns) {
@@ -12668,7 +12678,9 @@ const EXACT_CATEGORY_MAP = new Map([
12668
12678
  ["list_files", "file_reads"],
12669
12679
  ["run_command", "tool_outputs"],
12670
12680
  ["memory_read", "system_prompts"],
12671
- ["web_fetch", "tool_outputs"]
12681
+ ["web_fetch", "tool_outputs"],
12682
+ ["api_request", "conversation_history"],
12683
+ ["tool_decision", "tool_outputs"]
12672
12684
  ]);
12673
12685
  const PREFIX_PATTERNS = [
12674
12686
  {
@@ -13481,9 +13493,10 @@ var LogTurnAnalyzer = class {
13481
13493
  let runningContext = 0;
13482
13494
  const turns = merged.map(({ representative: log$2, inputTokens, outputTokens, cacheReadTokens, costUsd }, idx) => {
13483
13495
  const prevContext = runningContext;
13484
- runningContext += inputTokens;
13496
+ runningContext += inputTokens + cacheReadTokens;
13485
13497
  const freshTokens = inputTokens - cacheReadTokens;
13486
- const cacheHitRate = inputTokens > 0 ? cacheReadTokens / inputTokens : 0;
13498
+ const totalInput = inputTokens + cacheReadTokens;
13499
+ const cacheHitRate = totalInput > 0 ? cacheReadTokens / totalInput : 0;
13487
13500
  return {
13488
13501
  spanId: log$2.spanId ?? log$2.logId,
13489
13502
  turnNumber: idx + 1,
@@ -21588,4 +21601,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
21588
21601
 
21589
21602
  //#endregion
21590
21603
  export { AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DatabaseWrapper, DoltClient, DoltNotInstalled, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, FileStateStore, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SUBSTRATE_OWNED_SETTINGS_KEYS, SymbolParser, TelemetryPersistence, VALID_PHASES, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDispatcher, createDoltClient, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initializeDolt, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runMigrations, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
21591
- //# sourceMappingURL=run-Dx7bxebF.js.map
21604
+ //# sourceMappingURL=run-BErnJT9a.js.map
@@ -1,4 +1,4 @@
1
- import { registerRunCommand, runRunAction } from "./run-Dx7bxebF.js";
1
+ import { registerRunCommand, runRunAction } from "./run-BErnJT9a.js";
2
2
  import "./logger-D2fS2ccL.js";
3
3
  import "./config-migrator-DtZW1maj.js";
4
4
  import "./helpers-BihqWgVe.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",