@vitest-agent/sdk 2.0.3 → 2.0.5

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 CHANGED
@@ -2977,6 +2977,17 @@ declare const DataReader_base: Context.ServiceClass<DataReader, "vitest-agent/Da
2977
2977
  * server's recovered context only ever names the main agent.
2978
2978
  */
2979
2979
  readonly findActiveSubagentSession: (parentSessionId: number) => Effect.Effect<Option.Option<SessionDetail>, DataStoreError>;
2980
+ /**
2981
+ * Resolve the session a TDD task was opened under: the `sessions`
2982
+ * row whose `id` equals `tdd_tasks.session_id` for `tddTaskId`.
2983
+ * Returns `Option.none` when the task — or its session — does not
2984
+ * exist. Lets `hypothesis (action: record)` bind a hypothesis
2985
+ * deterministically from the orchestrator's unambiguous
2986
+ * `tddTaskId` (returned by `tdd_task (action: start)`) instead of
2987
+ * the fragile recovered host context or a caller-guessed
2988
+ * `sessionId`.
2989
+ */
2990
+ readonly getSessionByTddTaskId: (tddTaskId: number) => Effect.Effect<Option.Option<SessionDetail>, DataStoreError>;
2980
2991
  readonly listSessions: (options: {
2981
2992
  readonly project?: string;
2982
2993
  readonly agentKind?: "main" | "subagent";
package/index.js CHANGED
@@ -115,7 +115,7 @@ import { requiredArtifactForTransition, transitionEnforcesBehaviorMatch, validat
115
115
  * substituted yet. Exported for version introspection by downstream tooling.
116
116
  * @public
117
117
  */
118
- const CURRENT_SDK_VERSION = "2.0.3";
118
+ const CURRENT_SDK_VERSION = "2.0.5";
119
119
 
120
120
  //#endregion
121
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, countSuiteFailures, deriveIdempotencyKey, detectPackageManager, detectVitestScripts, determineTier, ensureMigrated, extractSqlReason, findFunctionBoundary, formatConsoleMarkdown, formatFatalError, formatGfm, formatTriageEffect, formatWrapupEffect, getRecentDirection, getRunCommand, getWorstMetric, gitUrlToProjectKey, hashTargets, historyKey, 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 };
@@ -880,6 +880,16 @@ const DataReaderLive = Layer.effect(DataReader, Effect.gen(function* () {
880
880
  table: "sessions",
881
881
  reason: extractSqlReason(e)
882
882
  })));
883
+ const getSessionByTddTaskId = (tddTaskId) => Effect.gen(function* () {
884
+ yield* Effect.logDebug("getSessionByTddTaskId").pipe(Effect.annotateLogs({ tddTaskId }));
885
+ const rows = yield* sql`SELECT id, chat_id, project, cwd, agent_kind, agent_type, parent_session_id, triage_was_non_empty, started_at, ended_at, end_reason FROM sessions WHERE id = (SELECT session_id FROM tdd_tasks WHERE id = ${tddTaskId}) LIMIT 1`;
886
+ if (rows.length === 0) return Option.none();
887
+ return Option.some(sessionRowToDetail(rows[0]));
888
+ }).pipe(Effect.annotateLogs("service", "DataReader"), Effect.mapError((e) => new DataStoreError({
889
+ operation: "read",
890
+ table: "sessions",
891
+ reason: extractSqlReason(e)
892
+ })));
883
893
  const searchTurns = (options) => Effect.gen(function* () {
884
894
  yield* Effect.logDebug("searchTurns").pipe(Effect.annotateLogs({ ...options }));
885
895
  const limit = options.limit ?? 100;
@@ -1631,6 +1641,7 @@ const DataReaderLive = Layer.effect(DataReader, Effect.gen(function* () {
1631
1641
  getSessionByChatId,
1632
1642
  findSessionsByChatPrefix,
1633
1643
  findActiveSubagentSession,
1644
+ getSessionByTddTaskId,
1634
1645
  listSessions,
1635
1646
  searchTurns,
1636
1647
  computeAcceptanceMetrics,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/sdk",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "private": false,
5
5
  "description": "Shared Effect Schema, SQLite migrations, data layer, services, formatters, and utilities for vitest-agent packages.",
6
6
  "keywords": [
@@ -51,7 +51,7 @@
51
51
  "@effected/jsonc": "^0.5.0",
52
52
  "@effected/toml": "^0.3.0",
53
53
  "@effected/walker": "^0.3.1",
54
- "@effected/workspaces": "^0.5.2",
54
+ "@effected/workspaces": "^0.6.0",
55
55
  "@effected/xdg": "^0.1.7",
56
56
  "@effected/yaml": "^0.5.0",
57
57
  "acorn": "^8.17.0",
package/testing.d.ts CHANGED
@@ -1427,6 +1427,17 @@ declare const DataReader_base: Context.ServiceClass<DataReader, "vitest-agent/Da
1427
1427
  * server's recovered context only ever names the main agent.
1428
1428
  */
1429
1429
  readonly findActiveSubagentSession: (parentSessionId: number) => Effect.Effect<Option.Option<SessionDetail>, DataStoreError>;
1430
+ /**
1431
+ * Resolve the session a TDD task was opened under: the `sessions`
1432
+ * row whose `id` equals `tdd_tasks.session_id` for `tddTaskId`.
1433
+ * Returns `Option.none` when the task — or its session — does not
1434
+ * exist. Lets `hypothesis (action: record)` bind a hypothesis
1435
+ * deterministically from the orchestrator's unambiguous
1436
+ * `tddTaskId` (returned by `tdd_task (action: start)`) instead of
1437
+ * the fragile recovered host context or a caller-guessed
1438
+ * `sessionId`.
1439
+ */
1440
+ readonly getSessionByTddTaskId: (tddTaskId: number) => Effect.Effect<Option.Option<SessionDetail>, DataStoreError>;
1430
1441
  readonly listSessions: (options: {
1431
1442
  readonly project?: string;
1432
1443
  readonly agentKind?: "main" | "subagent";