@vitest-agent/engine 0.1.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/LICENSE +21 -0
- package/README.md +32 -0
- package/index.d.ts +2679 -0
- package/index.js +63 -0
- package/layers/ConfigLive.js +46 -0
- package/layers/DataReaderLive.js +1923 -0
- package/layers/DataStoreLive.js +1283 -0
- package/layers/DetailResolverLive.js +9 -0
- package/layers/DiscoveryRegistryLive.js +70 -0
- package/layers/EnvironmentDetectorLive.js +36 -0
- package/layers/EnvironmentDetectorTest.js +13 -0
- package/layers/ExecutorResolverLive.js +9 -0
- package/layers/FormatSelectorLive.js +20 -0
- package/layers/HistoryTrackerLive.js +49 -0
- package/layers/HistoryTrackerTest.js +25 -0
- package/layers/LoggerLive.js +70 -0
- package/layers/OutputPipelineLive.js +20 -0
- package/layers/OutputRendererLive.js +23 -0
- package/layers/PathResolutionLive.js +46 -0
- package/layers/PerClientSessionMapLive.js +145 -0
- package/layers/ProjectDiscoveryLive.js +67 -0
- package/layers/ProjectDiscoveryTest.js +12 -0
- package/layers/ProjectIdentityLive.js +95 -0
- package/layers/RunContextLive.js +82 -0
- package/lib/format-triage.js +103 -0
- package/lib/format-wrapup.js +67 -0
- package/migrations/0001_initial.js +824 -0
- package/migrations/0002_test_artifacts.js +30 -0
- package/migrations/index.js +27 -0
- package/migrations/registry_0001_initial.js +39 -0
- package/migrations/session_map_0001_initial.js +38 -0
- package/package.json +59 -0
- package/platform.js +58 -0
- package/programs/end-agent.js +19 -0
- package/programs/hook-paths.js +115 -0
- package/programs/platform-sidecar.js +37 -0
- package/programs/record-session.js +49 -0
- package/programs/record-tdd-artifact.js +119 -0
- package/programs/record-turn.js +61 -0
- package/programs/record-workspace-changes.js +57 -0
- package/programs/register-agent.js +85 -0
- package/programs/resolve-session-for-recording.js +44 -0
- package/programs/session-env.js +85 -0
- package/project-dir.js +32 -0
- package/services/Config.js +15 -0
- package/services/DataReader.js +8 -0
- package/services/DataStore.js +15 -0
- package/services/DetailResolver.js +8 -0
- package/services/DiscoveryRegistry.js +8 -0
- package/services/EnvironmentDetector.js +8 -0
- package/services/ExecutorResolver.js +8 -0
- package/services/FormatSelector.js +8 -0
- package/services/HistoryTracker.js +20 -0
- package/services/OutputRenderer.js +8 -0
- package/services/PerClientSessionMap.js +22 -0
- package/services/ProjectDiscovery.js +8 -0
- package/services/ProjectIdentity.js +62 -0
- package/services/RunContext.js +53 -0
- package/services/idempotency.js +58 -0
- package/sql/assemblers.js +69 -0
- package/testing/layers.js +16 -0
- package/testing.d.ts +1101 -0
- package/testing.js +243 -0
- package/tsdoc-metadata.json +11 -0
- package/utils/ensure-migrated.js +47 -0
- package/utils/failure-signature.js +34 -0
- package/utils/resolve-data-path.js +64 -0
- package/utils/resolve-project-key-from-cwd.js +52 -0
- package/utils/resolve-workspace-key.js +41 -0
- package/version.js +6 -0
package/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { VitestAgentConfigFile } from "./services/Config.js";
|
|
2
|
+
import { ConfigLive } from "./layers/ConfigLive.js";
|
|
3
|
+
import { DataReader } from "./services/DataReader.js";
|
|
4
|
+
import { HistoryTracker, historyKey } from "./services/HistoryTracker.js";
|
|
5
|
+
import { DataReaderLive } from "./layers/DataReaderLive.js";
|
|
6
|
+
import { DataStore, INLINE_ATTACHMENT_BODY_CAP_BYTES } from "./services/DataStore.js";
|
|
7
|
+
import { DataStoreLive } from "./layers/DataStoreLive.js";
|
|
8
|
+
import { DetailResolver } from "./services/DetailResolver.js";
|
|
9
|
+
import { DetailResolverLive } from "./layers/DetailResolverLive.js";
|
|
10
|
+
import { DiscoveryRegistry } from "./services/DiscoveryRegistry.js";
|
|
11
|
+
import { DiscoveryRegistryLive } from "./layers/DiscoveryRegistryLive.js";
|
|
12
|
+
import { EnvironmentDetector } from "./services/EnvironmentDetector.js";
|
|
13
|
+
import { EnvironmentDetectorLive, classifyEnvironment } from "./layers/EnvironmentDetectorLive.js";
|
|
14
|
+
import { EnvironmentDetectorTest } from "./layers/EnvironmentDetectorTest.js";
|
|
15
|
+
import { ExecutorResolver } from "./services/ExecutorResolver.js";
|
|
16
|
+
import { ExecutorResolverLive } from "./layers/ExecutorResolverLive.js";
|
|
17
|
+
import { FormatSelector } from "./services/FormatSelector.js";
|
|
18
|
+
import { FormatSelectorLive } from "./layers/FormatSelectorLive.js";
|
|
19
|
+
import { HistoryTrackerLive } from "./layers/HistoryTrackerLive.js";
|
|
20
|
+
import { HistoryTrackerTest } from "./layers/HistoryTrackerTest.js";
|
|
21
|
+
import { LoggerLive, resolveLogFile, resolveLogLevel } from "./layers/LoggerLive.js";
|
|
22
|
+
import { OutputRenderer } from "./services/OutputRenderer.js";
|
|
23
|
+
import { OutputRendererLive } from "./layers/OutputRendererLive.js";
|
|
24
|
+
import { OutputPipelineLive } from "./layers/OutputPipelineLive.js";
|
|
25
|
+
import { APP_NAMESPACE, PathResolutionLive } from "./layers/PathResolutionLive.js";
|
|
26
|
+
import { PerClientSessionMapReader, PerClientSessionMapWriter } from "./services/PerClientSessionMap.js";
|
|
27
|
+
import { PerClientSessionMapReaderLive, PerClientSessionMapWriterLive } from "./layers/PerClientSessionMapLive.js";
|
|
28
|
+
import { ProjectDiscovery } from "./services/ProjectDiscovery.js";
|
|
29
|
+
import { ProjectDiscoveryLive } from "./layers/ProjectDiscoveryLive.js";
|
|
30
|
+
import { ProjectDiscoveryTest } from "./layers/ProjectDiscoveryTest.js";
|
|
31
|
+
import { ProjectIdentity, resolveProjectIdentityFromCandidates } from "./services/ProjectIdentity.js";
|
|
32
|
+
import { ProjectIdentityLive, ProjectIdentityTest } from "./layers/ProjectIdentityLive.js";
|
|
33
|
+
import { AgentContext, RunContext, RunContext$, RunContextService } from "./services/RunContext.js";
|
|
34
|
+
import { RunContextLive, RunContextTest } from "./layers/RunContextLive.js";
|
|
35
|
+
import { formatTriageEffect } from "./lib/format-triage.js";
|
|
36
|
+
import { formatWrapupEffect } from "./lib/format-wrapup.js";
|
|
37
|
+
import migration from "./migrations/0001_initial.js";
|
|
38
|
+
import migration$1 from "./migrations/0002_test_artifacts.js";
|
|
39
|
+
import { PROJECT_MIGRATIONS } from "./migrations/index.js";
|
|
40
|
+
import migration$2 from "./migrations/registry_0001_initial.js";
|
|
41
|
+
import migration$3 from "./migrations/session_map_0001_initial.js";
|
|
42
|
+
import { NodePlatformLayer, PlatformLive, makeSqliteStack } from "./platform.js";
|
|
43
|
+
import { endAgentEffect } from "./programs/end-agent.js";
|
|
44
|
+
import { DATA_DB_FILENAME, REGISTRY_DB_FILENAME, SESSIONS_DB_FILENAME, resolveHookPaths, resolveSessionMapPath } from "./programs/hook-paths.js";
|
|
45
|
+
import { SidecarPlatformLive } from "./programs/platform-sidecar.js";
|
|
46
|
+
import { recordSessionEnd, recordSessionStart } from "./programs/record-session.js";
|
|
47
|
+
import { resolveSessionForRecording } from "./programs/resolve-session-for-recording.js";
|
|
48
|
+
import { dispatchRecordTddArtifactEffect, recordTddArtifactByTaskIdEffect, recordTddArtifactEffect } from "./programs/record-tdd-artifact.js";
|
|
49
|
+
import { parseAndValidateTurnPayload, recordTurnEffect } from "./programs/record-turn.js";
|
|
50
|
+
import { recordRunWorkspaceChangesEffect } from "./programs/record-workspace-changes.js";
|
|
51
|
+
import { IDEMPOTENCY_ROOT_SENTINEL, deriveIdempotencyKey } from "./services/idempotency.js";
|
|
52
|
+
import { registerAgentEffect } from "./programs/register-agent.js";
|
|
53
|
+
import { parseSessionEnvExports, recoverSessionContextFromSessionEnv } from "./programs/session-env.js";
|
|
54
|
+
import { resolveProjectDir } from "./project-dir.js";
|
|
55
|
+
import { assembleHistoryRecord, assembleManifest } from "./sql/assemblers.js";
|
|
56
|
+
import { _resetMigrationCacheForTesting, ensureMigrated } from "./utils/ensure-migrated.js";
|
|
57
|
+
import { computeFailureSignature, normalizeAssertionShape } from "./utils/failure-signature.js";
|
|
58
|
+
import { resolveProjectKeyFromCwd } from "./utils/resolve-project-key-from-cwd.js";
|
|
59
|
+
import { DATABASE_FILENAME, resolveDataPath } from "./utils/resolve-data-path.js";
|
|
60
|
+
import { resolveWorkspaceKey } from "./utils/resolve-workspace-key.js";
|
|
61
|
+
import { CURRENT_ENGINE_VERSION } from "./version.js";
|
|
62
|
+
|
|
63
|
+
export { APP_NAMESPACE, AgentContext, CURRENT_ENGINE_VERSION, ConfigLive, DATABASE_FILENAME, DATA_DB_FILENAME, DataReader, DataReaderLive, DataStore, DataStoreLive, DetailResolver, DetailResolverLive, DiscoveryRegistry, DiscoveryRegistryLive, EnvironmentDetector, EnvironmentDetectorLive, EnvironmentDetectorTest, ExecutorResolver, ExecutorResolverLive, FormatSelector, FormatSelectorLive, HistoryTracker, HistoryTrackerLive, HistoryTrackerTest, IDEMPOTENCY_ROOT_SENTINEL, INLINE_ATTACHMENT_BODY_CAP_BYTES, LoggerLive, NodePlatformLayer, OutputPipelineLive, OutputRenderer, OutputRendererLive, PROJECT_MIGRATIONS, PathResolutionLive, PerClientSessionMapReader, PerClientSessionMapReaderLive, PerClientSessionMapWriter, PerClientSessionMapWriterLive, PlatformLive, ProjectDiscovery, ProjectDiscoveryLive, ProjectDiscoveryTest, ProjectIdentity, ProjectIdentityLive, ProjectIdentityTest, REGISTRY_DB_FILENAME, RunContext, RunContext$, RunContextLive, RunContextService, RunContextTest, SESSIONS_DB_FILENAME, SidecarPlatformLive, VitestAgentConfigFile, _resetMigrationCacheForTesting, assembleHistoryRecord, assembleManifest, classifyEnvironment, computeFailureSignature, deriveIdempotencyKey, dispatchRecordTddArtifactEffect, endAgentEffect, ensureMigrated, formatTriageEffect, formatWrapupEffect, historyKey, makeSqliteStack, migration as migration0001, migration$1 as migration0002, normalizeAssertionShape, parseAndValidateTurnPayload, parseSessionEnvExports, recordRunWorkspaceChangesEffect, recordSessionEnd, recordSessionStart, recordTddArtifactByTaskIdEffect, recordTddArtifactEffect, recordTurnEffect, recoverSessionContextFromSessionEnv, registerAgentEffect, migration$2 as registryMigration0001, resolveDataPath, resolveHookPaths, resolveLogFile, resolveLogLevel, resolveProjectDir, resolveProjectIdentityFromCandidates, resolveProjectKeyFromCwd, resolveSessionForRecording, resolveSessionMapPath, resolveWorkspaceKey, migration$3 as sessionMapMigration0001 };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { VitestAgentConfigFile } from "../services/Config.js";
|
|
2
|
+
import { ConfigFile, ConfigResolver, MergeStrategy, TomlCodec } from "@effected/config-file";
|
|
3
|
+
import { VitestAgentConfig } from "@vitest-agent/sdk";
|
|
4
|
+
|
|
5
|
+
//#region src/layers/ConfigLive.ts
|
|
6
|
+
const CONFIG_FILENAME = "vitest-agent.config.toml";
|
|
7
|
+
/**
|
|
8
|
+
* Build the live `ConfigFile` layer for a given project directory.
|
|
9
|
+
*
|
|
10
|
+
* Resolves the optional `vitest-agent.config.toml` from (in order):
|
|
11
|
+
*
|
|
12
|
+
* 1. The workspace root (when `projectDir` is inside a pnpm/npm/yarn workspace).
|
|
13
|
+
* 2. The git repository root (when `projectDir` is inside a git repo).
|
|
14
|
+
* 3. Walking upward from `projectDir`.
|
|
15
|
+
*
|
|
16
|
+
* The first found file wins (`MergeStrategy.firstMatch()`). If no file is
|
|
17
|
+
* present, downstream callers use `loadOrDefault(new VitestAgentConfig({}))`
|
|
18
|
+
* to get an empty config.
|
|
19
|
+
*
|
|
20
|
+
* @param projectDir - Absolute path inside the user's workspace. Resolvers
|
|
21
|
+
* anchor here rather than `process.cwd()` so the plugin-spawned MCP server
|
|
22
|
+
* sees the right config even when invoked from elsewhere.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
const ConfigLive = (projectDir) => ConfigFile.layer(VitestAgentConfigFile, {
|
|
26
|
+
schema: VitestAgentConfig,
|
|
27
|
+
codec: TomlCodec,
|
|
28
|
+
strategy: MergeStrategy.firstMatch(),
|
|
29
|
+
resolvers: [
|
|
30
|
+
ConfigResolver.workspaceRoot({
|
|
31
|
+
filename: CONFIG_FILENAME,
|
|
32
|
+
cwd: projectDir
|
|
33
|
+
}),
|
|
34
|
+
ConfigResolver.gitRoot({
|
|
35
|
+
filename: CONFIG_FILENAME,
|
|
36
|
+
cwd: projectDir
|
|
37
|
+
}),
|
|
38
|
+
ConfigResolver.upwardWalk({
|
|
39
|
+
filename: CONFIG_FILENAME,
|
|
40
|
+
cwd: projectDir
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { ConfigLive };
|