@vitest-agent/sdk 1.0.1 → 1.2.0
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/index.d.ts +2051 -141
- package/index.js +6 -5
- package/package.json +1 -1
- package/schemas/AgentReport.js +3 -1
- package/schemas/ConsoleLeaks.js +28 -0
- package/schemas/RunEvent.js +1 -1
- package/schemas/turns/index.js +1 -1
- package/testing.d.ts +1523 -10
- package/testing.js +11 -1
- package/utils/console-leaks.js +77 -0
- package/utils/validate-phase-transition.js +23 -3
- package/DataReader-2kJ9I9Hh.d.ts +0 -1809
package/index.js
CHANGED
|
@@ -63,6 +63,7 @@ import migration from "./migrations/0001_initial.js";
|
|
|
63
63
|
import migration$1 from "./migrations/registry_0001_initial.js";
|
|
64
64
|
import migration$2 from "./migrations/session_map_0001_initial.js";
|
|
65
65
|
import { AgentConsoleMode, CiConsoleMode, ConsoleMode, ConsoleOutputMode, DetailLevel, Environment, Executor, HumanConsoleMode, OutputFormat, PackageManager, ReportError, TestClassification, TestRunReason, TestState } from "./schemas/Common.js";
|
|
66
|
+
import { ConsoleLeakFile, ConsoleLeaks } from "./schemas/ConsoleLeaks.js";
|
|
66
67
|
import { MetricThresholds, PatternThresholds, ResolvedThresholds } from "./schemas/Thresholds.js";
|
|
67
68
|
import { CoverageReport, CoverageTotals, FileCoverageReport } from "./schemas/Coverage.js";
|
|
68
69
|
import { AgentReport, ModuleReport, ReportSummary, TagCountEntry, TestReport } from "./schemas/AgentReport.js";
|
|
@@ -90,6 +91,7 @@ import { IDEMPOTENCY_ROOT_SENTINEL, deriveIdempotencyKey } from "./services/idem
|
|
|
90
91
|
import { assembleHistoryRecord, assembleManifest } from "./sql/assemblers.js";
|
|
91
92
|
import { buildAgentReport } from "./utils/build-report.js";
|
|
92
93
|
import { computeTrend, getRecentDirection, hashTargets } from "./utils/compute-trend.js";
|
|
94
|
+
import { buildConsoleLeaks, collectConsoleLeakEntries } from "./utils/console-leaks.js";
|
|
93
95
|
import { detectPackageManager, getRunCommand } from "./utils/detect-pm.js";
|
|
94
96
|
import { isTimeoutError } from "./utils/detect-timeout.js";
|
|
95
97
|
import { _resetMigrationCacheForTesting, ensureMigrated } from "./utils/ensure-migrated.js";
|
|
@@ -102,7 +104,7 @@ import { DATABASE_FILENAME, resolveDataPath } from "./utils/resolve-data-path.js
|
|
|
102
104
|
import { resolveWorkspaceKey } from "./utils/resolve-workspace-key.js";
|
|
103
105
|
import { safeFilename } from "./utils/safe-filename.js";
|
|
104
106
|
import { validateCoverageTargetsShape } from "./utils/validate-coverage-targets-shape.js";
|
|
105
|
-
import { requiredArtifactForTransition, validatePhaseTransition } from "./utils/validate-phase-transition.js";
|
|
107
|
+
import { requiredArtifactForTransition, transitionEnforcesBehaviorMatch, validatePhaseTransition } from "./utils/validate-phase-transition.js";
|
|
106
108
|
|
|
107
109
|
//#region src/index.ts
|
|
108
110
|
/**
|
|
@@ -110,11 +112,10 @@ import { requiredArtifactForTransition, validatePhaseTransition } from "./utils/
|
|
|
110
112
|
* package.json#version via rslib-builder's __PACKAGE_VERSION__ substitution.
|
|
111
113
|
* Source-level reads (workspace `exports: "./src/index.ts"` during dev)
|
|
112
114
|
* see the `"0.0.0"` fallback — a clear signal the build pipeline has not
|
|
113
|
-
* substituted yet.
|
|
114
|
-
* See the root CLAUDE.md "Cross-package version drift" section.
|
|
115
|
+
* substituted yet. Exported for version introspection by downstream tooling.
|
|
115
116
|
* @public
|
|
116
117
|
*/
|
|
117
|
-
const CURRENT_SDK_VERSION = "1.0
|
|
118
|
+
const CURRENT_SDK_VERSION = "1.2.0";
|
|
118
119
|
|
|
119
120
|
//#endregion
|
|
120
|
-
export { ActionSeverity, ActorType, Agent, AgentConsoleMode, AgentContext, AgentId, AgentNotFoundError, AgentPluginOptions, AgentReport, AgentReporterOptions, BehaviorAbandonedEvent, BehaviorAddedEvent, BehaviorCompletedEvent, BehaviorDetail, BehaviorNotFoundError, BehaviorRow, BehaviorScopedEventTypes, BehaviorStartedEvent, BehaviorStatus, BehaviorsReadyEvent, BlockedEvent, CURRENT_SDK_VERSION, CacheManifest, CacheManifestEntry, ChannelEvent, ChatId, CiConsoleMode, ConfigLive, ConsoleLogLevel, ConsoleMode, ConsoleOutputMode, ConsoleOutputs, ConversationId, ConversationNotFoundError, CoverageBaselines, FileCoverageReport as CoverageFile, CoverageGap, CoverageLevel, CoverageMetric, CoverageRenderState, CoverageReport, CoverageTargets, CoverageTargetsMetrics, CoverageTotals, DATABASE_FILENAME, DataReader, DataReaderLive, DataStore, DataStoreError, DataStoreLive, DetailLevel, DetailResolver, DetailResolverLive, DiscoveryError, DiscoveryRegistry, DiscoveryRegistryLive, Environment, EnvironmentDetector, EnvironmentDetectorLive, EnvironmentDetectorTest, Executor, ExecutorResolver, ExecutorResolverLive, FailureRecord, FileCoverageReport, FileEditPayload, FormatSelector, FormatSelectorLive, GfmFormatter, GitCommandError, GoalAbandonedEvent, GoalAddedEvent, GoalCompletedEvent, GoalDetail, GoalNotFoundError, GoalRow, GoalStartedEvent, GoalStatus, GoalsReadyEvent, HistoryRecord, HistoryTracker, HistoryTrackerLive, HistoryTrackerTest, HookFirePayload, HookStatus, HookType, HostKind, HostMetadataParseError, HumanConsoleMode, HypothesisPayload, IDEMPOTENCY_ROOT_SENTINEL, IdempotencyHit, IllegalStatusTransitionError, JsonFormatter, LoggerLive, MarkdownFormatter, MetricThresholds, ModuleRecord, ModuleReport, NotePayload, OutputFormat, OutputPipelineLive, OutputRenderer, OutputRendererLive, PackageManager, PathResolutionError, PathResolutionLive, PatternThresholds, PerClientSessionMapReader, PerClientSessionMapReaderLive, PerClientSessionMapWriter, PerClientSessionMapWriterLive, PhaseTransitionEvent, ProbeMissError, ProjectDiscovery, ProjectDiscoveryLive, ProjectDiscoveryTest, ProjectIdentity, ProjectIdentityLive, ProjectIdentityNotResolvableError, ProjectIdentityTest, ProjectKey, RegistrationConflictError, RenderState, RenderTotals, ReportError, ReportSummary, ResolvedThresholds, RunContext, RunContext$, RunContextLive, RunContextService, RunContextTest, RunEvent, SessionCompleteEvent, SessionNotFoundError, SessionOutcome, SidecarTimeoutError, SilentFormatter, SuggestedActionRecord, TagCountEntry, TddTaskAlreadyEndedError, TddTaskId, TddTaskNotFoundError, TerminalFormatter, TestClassification, TestHistory, TestRecord, TestReport, TestRun, TestRunReason, TestState, ToolCallPayload, ToolResultPayload, Transport, TrendEntry, TrendRecord, TurnPayload, UserPromptPayload, VitestAgentConfig, VitestAgentConfigFile, _resetMigrationCacheForTesting, ansi, assembleHistoryRecord, assembleManifest, buildAgentReport, buildEnvPrefix, canonicalizeGitUrl, ciAnnotationsFormatter, classifyTest, compressLines, computeFailureSignature, computeTrend, deriveIdempotencyKey, detectPackageManager, detectVitestScripts, determineTier, ensureMigrated, extractSqlReason, findFunctionBoundary, formatConsoleMarkdown, formatFatalError, formatGfm, formatTriageEffect, formatWrapupEffect, getRecentDirection, getRunCommand, getWorstMetric, gitUrlToProjectKey, hashTargets, initialRenderState, isTimeoutError, isVitestInvocation, migration as migration0001, normalizeAssertionShape, normalizeWorkspaceKey, osc8, probeHostMetadataFromEnv, migration$1 as registryMigration0001, relativePath, requiredArtifactForTransition, resolveCoverageInput, resolveDataPath, resolveLogFile, resolveLogLevel, resolveProjectIdentityFromCandidates, resolveProjectKeyFromCwd, resolveWorkspaceKey, rewriteBashCommand, safeFilename, migration$2 as sessionMapMigration0001, stripAnsi, validateCoverageConfig, validateCoverageTargetsShape, validatePhaseTransition };
|
|
121
|
+
export { ActionSeverity, ActorType, Agent, AgentConsoleMode, AgentContext, AgentId, AgentNotFoundError, AgentPluginOptions, AgentReport, AgentReporterOptions, BehaviorAbandonedEvent, BehaviorAddedEvent, BehaviorCompletedEvent, BehaviorDetail, BehaviorNotFoundError, BehaviorRow, BehaviorScopedEventTypes, BehaviorStartedEvent, BehaviorStatus, BehaviorsReadyEvent, BlockedEvent, CURRENT_SDK_VERSION, CacheManifest, CacheManifestEntry, ChannelEvent, ChatId, CiConsoleMode, ConfigLive, ConsoleLeakFile, ConsoleLeaks, ConsoleLogLevel, ConsoleMode, ConsoleOutputMode, ConsoleOutputs, ConversationId, ConversationNotFoundError, CoverageBaselines, FileCoverageReport as CoverageFile, CoverageGap, CoverageLevel, CoverageMetric, CoverageRenderState, CoverageReport, CoverageTargets, CoverageTargetsMetrics, CoverageTotals, DATABASE_FILENAME, DataReader, DataReaderLive, DataStore, DataStoreError, DataStoreLive, DetailLevel, DetailResolver, DetailResolverLive, DiscoveryError, DiscoveryRegistry, DiscoveryRegistryLive, Environment, EnvironmentDetector, EnvironmentDetectorLive, EnvironmentDetectorTest, Executor, ExecutorResolver, ExecutorResolverLive, FailureRecord, FileCoverageReport, FileEditPayload, FormatSelector, FormatSelectorLive, GfmFormatter, GitCommandError, GoalAbandonedEvent, GoalAddedEvent, GoalCompletedEvent, GoalDetail, GoalNotFoundError, GoalRow, GoalStartedEvent, GoalStatus, GoalsReadyEvent, HistoryRecord, HistoryTracker, HistoryTrackerLive, HistoryTrackerTest, HookFirePayload, HookStatus, HookType, HostKind, HostMetadataParseError, HumanConsoleMode, HypothesisPayload, IDEMPOTENCY_ROOT_SENTINEL, IdempotencyHit, IllegalStatusTransitionError, JsonFormatter, LoggerLive, MarkdownFormatter, MetricThresholds, ModuleRecord, ModuleReport, NotePayload, OutputFormat, OutputPipelineLive, OutputRenderer, OutputRendererLive, PackageManager, PathResolutionError, PathResolutionLive, PatternThresholds, PerClientSessionMapReader, PerClientSessionMapReaderLive, PerClientSessionMapWriter, PerClientSessionMapWriterLive, PhaseTransitionEvent, ProbeMissError, ProjectDiscovery, ProjectDiscoveryLive, ProjectDiscoveryTest, ProjectIdentity, ProjectIdentityLive, ProjectIdentityNotResolvableError, ProjectIdentityTest, ProjectKey, RegistrationConflictError, RenderState, RenderTotals, ReportError, ReportSummary, ResolvedThresholds, RunContext, RunContext$, RunContextLive, RunContextService, RunContextTest, RunEvent, SessionCompleteEvent, SessionNotFoundError, SessionOutcome, SidecarTimeoutError, SilentFormatter, SuggestedActionRecord, TagCountEntry, TddTaskAlreadyEndedError, TddTaskId, TddTaskNotFoundError, TerminalFormatter, TestClassification, TestHistory, TestRecord, TestReport, TestRun, TestRunReason, TestState, ToolCallPayload, ToolResultPayload, Transport, TrendEntry, TrendRecord, TurnPayload, UserPromptPayload, VitestAgentConfig, VitestAgentConfigFile, _resetMigrationCacheForTesting, ansi, assembleHistoryRecord, assembleManifest, buildAgentReport, buildConsoleLeaks, buildEnvPrefix, canonicalizeGitUrl, ciAnnotationsFormatter, classifyTest, collectConsoleLeakEntries, compressLines, computeFailureSignature, computeTrend, deriveIdempotencyKey, detectPackageManager, detectVitestScripts, determineTier, ensureMigrated, extractSqlReason, findFunctionBoundary, formatConsoleMarkdown, formatFatalError, formatGfm, formatTriageEffect, formatWrapupEffect, getRecentDirection, getRunCommand, getWorstMetric, gitUrlToProjectKey, hashTargets, initialRenderState, isTimeoutError, isVitestInvocation, migration as migration0001, normalizeAssertionShape, normalizeWorkspaceKey, osc8, probeHostMetadataFromEnv, migration$1 as registryMigration0001, relativePath, requiredArtifactForTransition, resolveCoverageInput, resolveDataPath, resolveLogFile, resolveLogLevel, resolveProjectIdentityFromCandidates, resolveProjectKeyFromCwd, resolveWorkspaceKey, rewriteBashCommand, safeFilename, migration$2 as sessionMapMigration0001, stripAnsi, transitionEnforcesBehaviorMatch, validateCoverageConfig, validateCoverageTargetsShape, validatePhaseTransition };
|
package/package.json
CHANGED
package/schemas/AgentReport.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReportError, TestClassification, TestRunReason, TestState } from "./Common.js";
|
|
2
|
+
import { ConsoleLeaks } from "./ConsoleLeaks.js";
|
|
2
3
|
import { CoverageReport } from "./Coverage.js";
|
|
3
4
|
import { Schema } from "effect";
|
|
4
5
|
|
|
@@ -64,7 +65,8 @@ const AgentReport = Schema.Struct({
|
|
|
64
65
|
tagCounts: Schema.optional(Schema.Record({
|
|
65
66
|
key: Schema.String,
|
|
66
67
|
value: TagCountEntry
|
|
67
|
-
}))
|
|
68
|
+
})),
|
|
69
|
+
consoleLeaks: Schema.optional(ConsoleLeaks)
|
|
68
70
|
}).annotations({ identifier: "AgentReport" });
|
|
69
71
|
|
|
70
72
|
//#endregion
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/schemas/ConsoleLeaks.ts
|
|
4
|
+
/**
|
|
5
|
+
* Per-file stray-console-output detail. Counts are of console writes
|
|
6
|
+
* (one `console.*` call), not lines.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
const ConsoleLeakFile = Schema.Struct({
|
|
10
|
+
file: Schema.String,
|
|
11
|
+
stdout: Schema.Number,
|
|
12
|
+
stderr: Schema.Number,
|
|
13
|
+
tests: Schema.optional(Schema.Array(Schema.String)),
|
|
14
|
+
sample: Schema.optional(Schema.String)
|
|
15
|
+
}).annotations({ identifier: "ConsoleLeakFile" });
|
|
16
|
+
/**
|
|
17
|
+
* Aggregate stray-console-output signal for a single test run. Omitted from
|
|
18
|
+
* a report entirely when the run produced no user console output.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
const ConsoleLeaks = Schema.Struct({
|
|
22
|
+
total: Schema.Number,
|
|
23
|
+
byFile: Schema.Array(ConsoleLeakFile),
|
|
24
|
+
truncated: Schema.optional(Schema.Boolean)
|
|
25
|
+
}).annotations({ identifier: "ConsoleLeaks" });
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ConsoleLeakFile, ConsoleLeaks };
|
package/schemas/RunEvent.js
CHANGED
|
@@ -160,4 +160,4 @@ const RunEvent = Schema.Union(Schema.TaggedStruct("RunStarted", {
|
|
|
160
160
|
})).annotations({ identifier: "RunEvent" });
|
|
161
161
|
|
|
162
162
|
//#endregion
|
|
163
|
-
export { ActionSeverity, ConsoleLogLevel, CoverageGap, CoverageMetric, HookStatus, HookType, RunEvent };
|
|
163
|
+
export { ActionSeverity, ConsoleLogLevel, FileCoverageReport as CoverageFile, CoverageGap, CoverageMetric, HookStatus, HookType, RunEvent };
|
package/schemas/turns/index.js
CHANGED
|
@@ -12,4 +12,4 @@ import { Schema } from "effect";
|
|
|
12
12
|
const TurnPayload = Schema.Union(UserPromptPayload, ToolCallPayload, ToolResultPayload, FileEditPayload, HookFirePayload, NotePayload, HypothesisPayload);
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
|
-
export { TurnPayload };
|
|
15
|
+
export { FileEditPayload, HookFirePayload, HypothesisPayload, NotePayload, ToolCallPayload, ToolResultPayload, TurnPayload, UserPromptPayload };
|