substrate-ai 0.20.45 → 0.20.46
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-
|
|
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-BYMVrlGZ.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-
|
|
5207
|
+
"../run-Dwru4oKj.js"
|
|
5208
5208
|
);
|
|
5209
5209
|
const runStoryFn = async (opts) => {
|
|
5210
5210
|
const exitCode = await runPipeline({
|
|
@@ -33422,8 +33422,110 @@ var AnthropicAdapter = class {
|
|
|
33422
33422
|
}
|
|
33423
33423
|
throw new Error("[anthropic] Unexpected end of retry loop");
|
|
33424
33424
|
}
|
|
33425
|
-
async *stream(
|
|
33426
|
-
|
|
33425
|
+
async *stream(request) {
|
|
33426
|
+
const { body, betaHeaders } = this.buildRequestBody(request);
|
|
33427
|
+
body.stream = true;
|
|
33428
|
+
const headers = this.buildHeaders(betaHeaders);
|
|
33429
|
+
const url = `${this.baseUrl}/v1/messages`;
|
|
33430
|
+
const response = await this.fetch(url, {
|
|
33431
|
+
method: "POST",
|
|
33432
|
+
headers,
|
|
33433
|
+
body: JSON.stringify(body)
|
|
33434
|
+
});
|
|
33435
|
+
if (!response.ok) {
|
|
33436
|
+
const errorBody = await response.json().catch(() => ({}));
|
|
33437
|
+
const errorObj = errorBody?.error;
|
|
33438
|
+
const message = typeof errorObj?.message === "string" ? errorObj.message : response.statusText;
|
|
33439
|
+
throw new LLMError(`[anthropic] ${response.status}: ${message}`, response.status, "anthropic");
|
|
33440
|
+
}
|
|
33441
|
+
const text = await response.text();
|
|
33442
|
+
const lines = text.split("\n");
|
|
33443
|
+
let currentEventName = "";
|
|
33444
|
+
const blockTypes = new Map();
|
|
33445
|
+
const blockToolIds = new Map();
|
|
33446
|
+
let inputTokens = 0;
|
|
33447
|
+
let started = false;
|
|
33448
|
+
for (const line of lines) {
|
|
33449
|
+
const trimmed = line.trim();
|
|
33450
|
+
if (trimmed.startsWith("event: ")) currentEventName = trimmed.slice(7).trim();
|
|
33451
|
+
else if (trimmed.startsWith("data: ")) {
|
|
33452
|
+
const dataStr = trimmed.slice(6).trim();
|
|
33453
|
+
if (dataStr === "") continue;
|
|
33454
|
+
let eventData;
|
|
33455
|
+
try {
|
|
33456
|
+
eventData = JSON.parse(dataStr);
|
|
33457
|
+
} catch {
|
|
33458
|
+
continue;
|
|
33459
|
+
}
|
|
33460
|
+
if (currentEventName === "message_start") {
|
|
33461
|
+
if (!started) {
|
|
33462
|
+
started = true;
|
|
33463
|
+
yield { type: "message_start" };
|
|
33464
|
+
}
|
|
33465
|
+
const message = eventData["message"];
|
|
33466
|
+
const usage = message?.["usage"];
|
|
33467
|
+
if (typeof usage?.["input_tokens"] === "number") inputTokens = usage["input_tokens"];
|
|
33468
|
+
} else if (currentEventName === "content_block_start") {
|
|
33469
|
+
const index = eventData["index"];
|
|
33470
|
+
const block = eventData["content_block"];
|
|
33471
|
+
const blockType = block?.["type"];
|
|
33472
|
+
if (blockType === "text") blockTypes.set(index, "text");
|
|
33473
|
+
else if (blockType === "tool_use") {
|
|
33474
|
+
blockTypes.set(index, "tool_use");
|
|
33475
|
+
const toolId = block?.["id"];
|
|
33476
|
+
const toolName = block?.["name"];
|
|
33477
|
+
if (toolId !== void 0) blockToolIds.set(index, toolId);
|
|
33478
|
+
const toolCallHeader = {};
|
|
33479
|
+
if (toolId !== void 0) toolCallHeader.id = toolId;
|
|
33480
|
+
if (toolName !== void 0) toolCallHeader.name = toolName;
|
|
33481
|
+
yield {
|
|
33482
|
+
type: "tool_call_delta",
|
|
33483
|
+
toolCall: toolCallHeader
|
|
33484
|
+
};
|
|
33485
|
+
} else if (blockType === "thinking") blockTypes.set(index, "thinking");
|
|
33486
|
+
} else if (currentEventName === "content_block_delta") {
|
|
33487
|
+
const index = eventData["index"];
|
|
33488
|
+
const delta = eventData["delta"];
|
|
33489
|
+
const deltaType = delta?.["type"];
|
|
33490
|
+
if (deltaType === "text_delta") yield {
|
|
33491
|
+
type: "text_delta",
|
|
33492
|
+
delta: delta?.["text"] ?? ""
|
|
33493
|
+
};
|
|
33494
|
+
else if (deltaType === "input_json_delta") {
|
|
33495
|
+
const toolId = blockToolIds.get(index);
|
|
33496
|
+
const toolCallDelta = { rawArguments: delta?.["partial_json"] ?? "" };
|
|
33497
|
+
if (toolId !== void 0) toolCallDelta.id = toolId;
|
|
33498
|
+
yield {
|
|
33499
|
+
type: "tool_call_delta",
|
|
33500
|
+
toolCall: toolCallDelta
|
|
33501
|
+
};
|
|
33502
|
+
} else if (deltaType === "thinking_delta") yield {
|
|
33503
|
+
type: "reasoning_delta",
|
|
33504
|
+
reasoningDelta: delta?.["thinking"] ?? ""
|
|
33505
|
+
};
|
|
33506
|
+
} else if (currentEventName === "message_delta") {
|
|
33507
|
+
const usage = eventData["usage"];
|
|
33508
|
+
const outputTokens = typeof usage?.["output_tokens"] === "number" ? usage["output_tokens"] : 0;
|
|
33509
|
+
yield {
|
|
33510
|
+
type: "usage",
|
|
33511
|
+
usage: {
|
|
33512
|
+
inputTokens,
|
|
33513
|
+
outputTokens,
|
|
33514
|
+
totalTokens: inputTokens + outputTokens
|
|
33515
|
+
}
|
|
33516
|
+
};
|
|
33517
|
+
const delta = eventData["delta"];
|
|
33518
|
+
const stopReasonRaw = delta?.["stop_reason"];
|
|
33519
|
+
if (stopReasonRaw !== void 0) yield {
|
|
33520
|
+
type: "message_stop",
|
|
33521
|
+
finishReason: {
|
|
33522
|
+
reason: mapStopReason(stopReasonRaw),
|
|
33523
|
+
raw: stopReasonRaw
|
|
33524
|
+
}
|
|
33525
|
+
};
|
|
33526
|
+
} else if (currentEventName === "message_stop") break;
|
|
33527
|
+
}
|
|
33528
|
+
}
|
|
33427
33529
|
}
|
|
33428
33530
|
buildRequestBody(request) {
|
|
33429
33531
|
const betaHeaders = [];
|
|
@@ -45175,4 +45277,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
45175
45277
|
|
|
45176
45278
|
//#endregion
|
|
45177
45279
|
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 };
|
|
45178
|
-
//# sourceMappingURL=run-
|
|
45280
|
+
//# sourceMappingURL=run-BYMVrlGZ.js.map
|
|
@@ -2,7 +2,7 @@ import "./health-BV-rzjf7.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-
|
|
5
|
+
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-BYMVrlGZ.js";
|
|
6
6
|
import "./routing-CcBOCuC9.js";
|
|
7
7
|
import "./decisions-C0pz9Clx.js";
|
|
8
8
|
|