substrate-ai 0.20.94 → 0.20.95
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
|
@@ -3,7 +3,7 @@ import { FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipel
|
|
|
3
3
|
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, swallowDebug, tagRunAsBaseline, updatePipelineRun } from "../dist-C_NE40jY.js";
|
|
6
|
-
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-
|
|
6
|
+
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-COnbF6By.js";
|
|
7
7
|
import "../adapter-registry-DIcrxjH8.js";
|
|
8
8
|
import { RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-BSsjVG96.js";
|
|
9
9
|
import "../errors-D531Z8FW.js";
|
|
@@ -8416,7 +8416,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
8416
8416
|
await initSchema(expAdapter);
|
|
8417
8417
|
const { runRunAction: runPipeline } = await import(
|
|
8418
8418
|
/* @vite-ignore */
|
|
8419
|
-
"../run-
|
|
8419
|
+
"../run-Bmrjp1QI.js"
|
|
8420
8420
|
);
|
|
8421
8421
|
const runStoryFn = async (opts) => {
|
|
8422
8422
|
const exitCode = await runPipeline({
|
|
@@ -2,7 +2,7 @@ import "./health-CzZ2Ki-b.js";
|
|
|
2
2
|
import "./logger-KeHncl-f.js";
|
|
3
3
|
import "./helpers-CElYrONe.js";
|
|
4
4
|
import "./dist-C_NE40jY.js";
|
|
5
|
-
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-
|
|
5
|
+
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-COnbF6By.js";
|
|
6
6
|
import "./manifest-read-BSsjVG96.js";
|
|
7
7
|
import "./routing-DFxoKHDt.js";
|
|
8
8
|
import "./work-graph-repository-DZyJv5pV.js";
|
|
@@ -11679,127 +11679,6 @@ var AdapterTelemetryPersistence = class {
|
|
|
11679
11679
|
constructor(adapter) {
|
|
11680
11680
|
this._adapter = adapter;
|
|
11681
11681
|
}
|
|
11682
|
-
/**
|
|
11683
|
-
* Apply the telemetry schema DDL to the database.
|
|
11684
|
-
* Idempotent — uses CREATE TABLE IF NOT EXISTS.
|
|
11685
|
-
*/
|
|
11686
|
-
async initSchema() {
|
|
11687
|
-
await this._adapter.exec(`
|
|
11688
|
-
CREATE TABLE IF NOT EXISTS turn_analysis (
|
|
11689
|
-
story_key VARCHAR(64) NOT NULL,
|
|
11690
|
-
span_id VARCHAR(128) NOT NULL,
|
|
11691
|
-
turn_number INTEGER NOT NULL,
|
|
11692
|
-
name VARCHAR(255) NOT NULL DEFAULT '',
|
|
11693
|
-
timestamp BIGINT NOT NULL DEFAULT 0,
|
|
11694
|
-
source VARCHAR(32) NOT NULL DEFAULT '',
|
|
11695
|
-
model VARCHAR(64),
|
|
11696
|
-
input_tokens INTEGER NOT NULL DEFAULT 0,
|
|
11697
|
-
output_tokens INTEGER NOT NULL DEFAULT 0,
|
|
11698
|
-
cache_read_tokens INTEGER NOT NULL DEFAULT 0,
|
|
11699
|
-
fresh_tokens INTEGER NOT NULL DEFAULT 0,
|
|
11700
|
-
cache_hit_rate DOUBLE NOT NULL DEFAULT 0,
|
|
11701
|
-
cost_usd DOUBLE NOT NULL DEFAULT 0,
|
|
11702
|
-
duration_ms INTEGER NOT NULL DEFAULT 0,
|
|
11703
|
-
context_size INTEGER NOT NULL DEFAULT 0,
|
|
11704
|
-
context_delta INTEGER NOT NULL DEFAULT 0,
|
|
11705
|
-
tool_name VARCHAR(128),
|
|
11706
|
-
is_context_spike BOOLEAN NOT NULL DEFAULT 0,
|
|
11707
|
-
child_spans_json TEXT NOT NULL DEFAULT '[]',
|
|
11708
|
-
task_type VARCHAR(64),
|
|
11709
|
-
phase VARCHAR(64),
|
|
11710
|
-
dispatch_id VARCHAR(64),
|
|
11711
|
-
PRIMARY KEY (story_key, span_id)
|
|
11712
|
-
)
|
|
11713
|
-
`);
|
|
11714
|
-
await this._adapter.exec(`
|
|
11715
|
-
CREATE INDEX IF NOT EXISTS idx_turn_analysis_story
|
|
11716
|
-
ON turn_analysis (story_key, turn_number)
|
|
11717
|
-
`);
|
|
11718
|
-
await this._adapter.exec(`
|
|
11719
|
-
CREATE TABLE IF NOT EXISTS efficiency_scores (
|
|
11720
|
-
story_key VARCHAR(64) NOT NULL,
|
|
11721
|
-
timestamp BIGINT NOT NULL,
|
|
11722
|
-
composite_score INTEGER NOT NULL DEFAULT 0,
|
|
11723
|
-
cache_hit_sub_score DOUBLE NOT NULL DEFAULT 0,
|
|
11724
|
-
io_ratio_sub_score DOUBLE NOT NULL DEFAULT 0,
|
|
11725
|
-
context_management_sub_score DOUBLE NOT NULL DEFAULT 0,
|
|
11726
|
-
avg_cache_hit_rate DOUBLE NOT NULL DEFAULT 0,
|
|
11727
|
-
avg_io_ratio DOUBLE NOT NULL DEFAULT 0,
|
|
11728
|
-
context_spike_count INTEGER NOT NULL DEFAULT 0,
|
|
11729
|
-
total_turns INTEGER NOT NULL DEFAULT 0,
|
|
11730
|
-
per_model_json TEXT NOT NULL DEFAULT '[]',
|
|
11731
|
-
per_source_json TEXT NOT NULL DEFAULT '[]',
|
|
11732
|
-
token_density_sub_score DOUBLE NOT NULL DEFAULT 0,
|
|
11733
|
-
cold_start_turns_excluded INTEGER NOT NULL DEFAULT 0,
|
|
11734
|
-
dispatch_id TEXT,
|
|
11735
|
-
task_type TEXT,
|
|
11736
|
-
phase TEXT,
|
|
11737
|
-
PRIMARY KEY (story_key, timestamp)
|
|
11738
|
-
)
|
|
11739
|
-
`);
|
|
11740
|
-
await this._adapter.exec(`
|
|
11741
|
-
CREATE INDEX IF NOT EXISTS idx_efficiency_story
|
|
11742
|
-
ON efficiency_scores (story_key, timestamp DESC)
|
|
11743
|
-
`);
|
|
11744
|
-
try {
|
|
11745
|
-
await this._adapter.exec(`ALTER TABLE efficiency_scores ADD COLUMN token_density_sub_score DOUBLE NOT NULL DEFAULT 0`);
|
|
11746
|
-
} catch {}
|
|
11747
|
-
try {
|
|
11748
|
-
await this._adapter.exec(`ALTER TABLE efficiency_scores ADD COLUMN cold_start_turns_excluded INTEGER NOT NULL DEFAULT 0`);
|
|
11749
|
-
} catch {}
|
|
11750
|
-
await this._adapter.exec(`
|
|
11751
|
-
CREATE TABLE IF NOT EXISTS recommendations (
|
|
11752
|
-
id VARCHAR(16) NOT NULL,
|
|
11753
|
-
story_key VARCHAR(64) NOT NULL,
|
|
11754
|
-
sprint_id VARCHAR(64),
|
|
11755
|
-
rule_id VARCHAR(64) NOT NULL,
|
|
11756
|
-
severity VARCHAR(16) NOT NULL,
|
|
11757
|
-
title TEXT NOT NULL,
|
|
11758
|
-
description TEXT NOT NULL,
|
|
11759
|
-
potential_savings_tokens INTEGER,
|
|
11760
|
-
potential_savings_usd DOUBLE,
|
|
11761
|
-
action_target TEXT,
|
|
11762
|
-
generated_at VARCHAR(32) NOT NULL,
|
|
11763
|
-
PRIMARY KEY (id)
|
|
11764
|
-
)
|
|
11765
|
-
`);
|
|
11766
|
-
await this._adapter.exec(`
|
|
11767
|
-
CREATE INDEX IF NOT EXISTS idx_recommendations_story
|
|
11768
|
-
ON recommendations (story_key, severity)
|
|
11769
|
-
`);
|
|
11770
|
-
await this._adapter.exec(`
|
|
11771
|
-
CREATE TABLE IF NOT EXISTS category_stats (
|
|
11772
|
-
story_key VARCHAR(100) NOT NULL,
|
|
11773
|
-
category VARCHAR(30) NOT NULL,
|
|
11774
|
-
total_tokens BIGINT NOT NULL DEFAULT 0,
|
|
11775
|
-
percentage DECIMAL(6,3) NOT NULL DEFAULT 0,
|
|
11776
|
-
event_count INTEGER NOT NULL DEFAULT 0,
|
|
11777
|
-
avg_tokens_per_event DECIMAL(12,2) NOT NULL DEFAULT 0,
|
|
11778
|
-
trend VARCHAR(10) NOT NULL DEFAULT 'stable',
|
|
11779
|
-
PRIMARY KEY (story_key, category)
|
|
11780
|
-
)
|
|
11781
|
-
`);
|
|
11782
|
-
await this._adapter.exec(`
|
|
11783
|
-
CREATE INDEX IF NOT EXISTS idx_category_stats_story
|
|
11784
|
-
ON category_stats (story_key, total_tokens)
|
|
11785
|
-
`);
|
|
11786
|
-
await this._adapter.exec(`
|
|
11787
|
-
CREATE TABLE IF NOT EXISTS consumer_stats (
|
|
11788
|
-
story_key VARCHAR(100) NOT NULL,
|
|
11789
|
-
consumer_key VARCHAR(300) NOT NULL,
|
|
11790
|
-
category VARCHAR(30) NOT NULL,
|
|
11791
|
-
total_tokens BIGINT NOT NULL DEFAULT 0,
|
|
11792
|
-
percentage DECIMAL(6,3) NOT NULL DEFAULT 0,
|
|
11793
|
-
event_count INTEGER NOT NULL DEFAULT 0,
|
|
11794
|
-
top_invocations_json TEXT,
|
|
11795
|
-
PRIMARY KEY (story_key, consumer_key)
|
|
11796
|
-
)
|
|
11797
|
-
`);
|
|
11798
|
-
await this._adapter.exec(`
|
|
11799
|
-
CREATE INDEX IF NOT EXISTS idx_consumer_stats_story
|
|
11800
|
-
ON consumer_stats (story_key, total_tokens)
|
|
11801
|
-
`);
|
|
11802
|
-
}
|
|
11803
11682
|
async storeTurnAnalysis(storyKey, turns) {
|
|
11804
11683
|
if (turns.length === 0) return;
|
|
11805
11684
|
await this._adapter.transaction(async (adapter) => {
|
|
@@ -12152,22 +12031,18 @@ var AdapterTelemetryPersistence = class {
|
|
|
12152
12031
|
* Concrete DatabaseAdapter-backed telemetry persistence.
|
|
12153
12032
|
*
|
|
12154
12033
|
* Accepts a DatabaseAdapter and delegates all operations to
|
|
12155
|
-
* AdapterTelemetryPersistence.
|
|
12034
|
+
* AdapterTelemetryPersistence.
|
|
12156
12035
|
*
|
|
12157
|
-
*
|
|
12036
|
+
* Schema initialization is the responsibility of the main `initSchema()` in
|
|
12037
|
+
* packages/core/src/persistence/schema.ts. Callers MUST call it before
|
|
12038
|
+
* constructing TelemetryPersistence (Ship 4 / v0.20.95: removed the redundant
|
|
12039
|
+
* telemetry-only DDL that lived here).
|
|
12158
12040
|
*/
|
|
12159
12041
|
var TelemetryPersistence = class {
|
|
12160
12042
|
_impl;
|
|
12161
12043
|
constructor(adapter) {
|
|
12162
12044
|
this._impl = new AdapterTelemetryPersistence(adapter);
|
|
12163
12045
|
}
|
|
12164
|
-
/**
|
|
12165
|
-
* Apply the telemetry schema DDL to the database.
|
|
12166
|
-
* Idempotent — uses CREATE TABLE IF NOT EXISTS.
|
|
12167
|
-
*/
|
|
12168
|
-
async initSchema() {
|
|
12169
|
-
await this._impl.initSchema();
|
|
12170
|
-
}
|
|
12171
12046
|
async storeTurnAnalysis(storyKey, turns) {
|
|
12172
12047
|
return this._impl.storeTurnAnalysis(storyKey, turns);
|
|
12173
12048
|
}
|
|
@@ -46038,7 +45913,6 @@ async function runRunAction(options) {
|
|
|
46038
45913
|
return 1;
|
|
46039
45914
|
}
|
|
46040
45915
|
const telemetryPersistence = telemetryEnabled ? new AdapterTelemetryPersistence(adapter) : void 0;
|
|
46041
|
-
if (telemetryPersistence !== void 0) await telemetryPersistence.initSchema();
|
|
46042
45916
|
const packLoader = createPackLoader();
|
|
46043
45917
|
let pack;
|
|
46044
45918
|
try {
|
|
@@ -47078,7 +46952,6 @@ async function runFullPipeline(options) {
|
|
|
47078
46952
|
});
|
|
47079
46953
|
}
|
|
47080
46954
|
const fpTelemetryPersistence = fullTelemetryEnabled ? new AdapterTelemetryPersistence(adapter) : void 0;
|
|
47081
|
-
if (fpTelemetryPersistence !== void 0) await fpTelemetryPersistence.initSchema();
|
|
47082
46955
|
const orchestrator = createImplementationOrchestrator({
|
|
47083
46956
|
db: adapter,
|
|
47084
46957
|
pack,
|
|
@@ -47361,4 +47234,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
|
|
|
47361
47234
|
|
|
47362
47235
|
//#endregion
|
|
47363
47236
|
export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR$1 as GLOBSTAR, GitClient, GrammarLoader, Minimatch$1 as Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape$1 as escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runRunAction, runSolutioningPhase, unescape$1 as unescape, validateStopAfterFromConflict, wireNdjsonEmitter };
|
|
47364
|
-
//# sourceMappingURL=run-
|
|
47237
|
+
//# sourceMappingURL=run-COnbF6By.js.map
|