@vitest-agent/engine 1.0.6 → 1.1.1
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 +27 -116
- package/index.js +2 -1
- package/layers/ConfigLive.js +1 -2
- package/layers/DataReaderLive.js +1 -2
- package/layers/DataStoreLive.js +21 -6
- package/layers/DetailResolverLive.js +1 -2
- package/layers/DiscoveryRegistryLive.js +1 -2
- package/layers/EnvironmentDetectorLive.js +1 -2
- package/layers/EnvironmentDetectorTest.js +1 -2
- package/layers/ExecutorResolverLive.js +1 -2
- package/layers/HistoryTrackerLive.js +1 -2
- package/layers/HistoryTrackerTest.js +1 -2
- package/layers/LoggerLive.js +1 -2
- package/layers/OutputPipelineLive.js +1 -2
- package/layers/PathResolutionLive.js +1 -2
- package/layers/PerClientSessionMapLive.js +1 -2
- package/layers/ProjectDiscoveryLive.js +1 -2
- package/layers/ProjectDiscoveryTest.js +1 -2
- package/layers/ProjectIdentityLive.js +1 -2
- package/layers/RunContextLive.js +1 -2
- package/lib/format-triage.js +1 -2
- package/lib/format-wrapup.js +1 -2
- package/migrations/0001_initial.js +1 -2
- package/migrations/0002_test_artifacts.js +1 -2
- package/migrations/index.js +1 -2
- package/migrations/registry_0001_initial.js +1 -2
- package/migrations/session_map_0001_initial.js +1 -2
- package/package.json +18 -18
- package/platform.js +4 -4
- package/programs/end-agent.js +1 -2
- package/programs/hook-paths.js +1 -2
- package/programs/platform-sidecar.js +1 -2
- package/programs/record-session.js +1 -2
- package/programs/record-tdd-artifact.js +1 -2
- package/programs/record-turn.js +1 -2
- package/programs/record-workspace-changes.js +1 -2
- package/programs/register-agent.js +1 -2
- package/programs/resolve-session-for-recording.js +1 -2
- package/programs/session-env.js +1 -2
- package/project-dir.js +1 -2
- package/services/Config.js +1 -2
- package/services/DataReader.js +1 -2
- package/services/DataStore.js +1 -2
- package/services/DetailResolver.js +1 -2
- package/services/DiscoveryRegistry.js +1 -2
- package/services/EnvironmentDetector.js +1 -2
- package/services/ExecutorResolver.js +1 -2
- package/services/HistoryTracker.js +1 -2
- package/services/PerClientSessionMap.js +1 -2
- package/services/ProjectDiscovery.js +1 -2
- package/services/ProjectIdentity.js +1 -2
- package/services/RunContext.js +1 -2
- package/services/idempotency.js +1 -2
- package/sql/assemblers.js +1 -2
- package/stores.js +1 -2
- package/testing/layers.js +1 -2
- package/testing.d.ts +0 -12
- package/testing.js +1 -2
- package/utils/ensure-migrated.js +1 -2
- package/utils/failure-signature.js +1 -2
- package/utils/persist-transaction.js +84 -0
- package/utils/resolve-data-path.js +1 -2
- package/utils/resolve-project-key-from-cwd.js +1 -2
- package/utils/resolve-workspace-key.js +1 -2
- package/version.js +2 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExecutorResolver } from "../services/ExecutorResolver.js";
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/layers/ExecutorResolverLive.ts
|
|
5
5
|
/**
|
|
6
6
|
* The `@effected/env` audience each environment implies. An `Executor` is the
|
|
7
7
|
* same three-way split as an `AudienceKind` (`human` / `agent` / `ci`); typing
|
|
@@ -17,5 +17,4 @@ const AUDIENCE_OF = {
|
|
|
17
17
|
/** @public */
|
|
18
18
|
const ExecutorResolverLive = Layer.succeed(ExecutorResolver, { resolve: (env) => Effect.succeed(AUDIENCE_OF[env]) });
|
|
19
19
|
|
|
20
|
-
//#endregion
|
|
21
20
|
export { ExecutorResolverLive };
|
|
@@ -3,7 +3,7 @@ import { HistoryTracker, historyKey } from "../services/HistoryTracker.js";
|
|
|
3
3
|
import { classifyTest } from "@vitest-agent/sdk";
|
|
4
4
|
import { Effect, Layer } from "effect";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/layers/HistoryTrackerLive.ts
|
|
7
7
|
const WINDOW_SIZE = 10;
|
|
8
8
|
/** @public */
|
|
9
9
|
const HistoryTrackerLive = Layer.effect(HistoryTracker, Effect.gen(function* () {
|
|
@@ -45,5 +45,4 @@ const HistoryTrackerLive = Layer.effect(HistoryTracker, Effect.gen(function* ()
|
|
|
45
45
|
}) };
|
|
46
46
|
}));
|
|
47
47
|
|
|
48
|
-
//#endregion
|
|
49
48
|
export { HistoryTrackerLive };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HistoryTracker } from "../services/HistoryTracker.js";
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/layers/HistoryTrackerTest.ts
|
|
5
5
|
/** @public */
|
|
6
6
|
const HistoryTrackerTest = {
|
|
7
7
|
empty: () => ({ classifyCalls: [] }),
|
|
@@ -21,5 +21,4 @@ const HistoryTrackerTest = {
|
|
|
21
21
|
}) })
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
//#endregion
|
|
25
24
|
export { HistoryTrackerTest };
|
package/layers/LoggerLive.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
|
|
|
4
4
|
import * as NodePath from "@effect/platform-node/NodePath";
|
|
5
5
|
import { CliLog } from "@effected/cli";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/layers/LoggerLive.ts
|
|
8
8
|
/**
|
|
9
9
|
* Create a structured JSON (NDJSON) logger layer for stderr, over
|
|
10
10
|
* `@effected/cli`'s `CliLog` in its diagnostics-only mode
|
|
@@ -81,5 +81,4 @@ function resolveLogFile(env, option) {
|
|
|
81
81
|
return option ?? env.VITEST_REPORTER_LOG_FILE ?? void 0;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
//#endregion
|
|
85
84
|
export { LoggerLive, resolveLogFile, resolveLogLevel };
|
|
@@ -3,7 +3,7 @@ import { EnvironmentDetectorLive } from "./EnvironmentDetectorLive.js";
|
|
|
3
3
|
import { ExecutorResolverLive } from "./ExecutorResolverLive.js";
|
|
4
4
|
import { Layer } from "effect";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/layers/OutputPipelineLive.ts
|
|
7
7
|
/**
|
|
8
8
|
* The output pipeline: environment detection, executor resolution and detail
|
|
9
9
|
* resolution.
|
|
@@ -14,5 +14,4 @@ import { Layer } from "effect";
|
|
|
14
14
|
*/
|
|
15
15
|
const OutputPipelineLive = (env) => Layer.mergeAll(EnvironmentDetectorLive(env), ExecutorResolverLive, DetailResolverLive);
|
|
16
16
|
|
|
17
|
-
//#endregion
|
|
18
17
|
export { OutputPipelineLive };
|
|
@@ -3,7 +3,7 @@ import { Layer } from "effect";
|
|
|
3
3
|
import { WorkspaceDiscovery, WorkspaceRoot } from "@effected/workspaces";
|
|
4
4
|
import { AppDirs, Xdg } from "@effected/xdg";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/layers/PathResolutionLive.ts
|
|
7
7
|
/**
|
|
8
8
|
* The XDG namespace every vitest-agent data directory lives under —
|
|
9
9
|
* `<XDG data>/vitest-agent`. The one place the name exists.
|
|
@@ -54,5 +54,4 @@ const PathResolutionLive = (projectDir) => {
|
|
|
54
54
|
return Layer.mergeAll(AppDirsLive, ConfigLive(projectDir), WorkspaceMinimalLive);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
//#endregion
|
|
58
57
|
export { APP_NAMESPACE, DATA_FALLBACK_DIR, PathResolutionLive };
|
|
@@ -5,7 +5,7 @@ import { SqlClient } from "effect/sql/SqlClient";
|
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
import { basename } from "node:path";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/layers/PerClientSessionMapLive.ts
|
|
9
9
|
const sessionRowToContext = (row) => ({
|
|
10
10
|
hostSessionId: row.host_session_id,
|
|
11
11
|
conversationId: row.conversation_id,
|
|
@@ -141,5 +141,4 @@ const PerClientSessionMapWriterLive = Layer.effect(PerClientSessionMapWriter, Ef
|
|
|
141
141
|
};
|
|
142
142
|
}))));
|
|
143
143
|
|
|
144
|
-
//#endregion
|
|
145
144
|
export { PerClientSessionMapReaderLive, PerClientSessionMapWriterLive };
|
|
@@ -2,7 +2,7 @@ import { ProjectDiscovery } from "../services/ProjectDiscovery.js";
|
|
|
2
2
|
import { DiscoveryError, NON_DISCOVERABLE_DIRS } from "@vitest-agent/sdk";
|
|
3
3
|
import { Effect, FileSystem, Layer } from "effect";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/layers/ProjectDiscoveryLive.ts
|
|
6
6
|
const TEST_FILE_PATTERN = /\.(test|spec)\.(ts|tsx)$/;
|
|
7
7
|
const SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
8
8
|
...NON_DISCOVERABLE_DIRS,
|
|
@@ -63,5 +63,4 @@ const ProjectDiscoveryLive = Layer.effect(ProjectDiscovery, Effect.gen(function*
|
|
|
63
63
|
};
|
|
64
64
|
}));
|
|
65
65
|
|
|
66
|
-
//#endregion
|
|
67
66
|
export { ProjectDiscoveryLive };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { ProjectDiscovery } from "../services/ProjectDiscovery.js";
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/layers/ProjectDiscoveryTest.ts
|
|
5
5
|
/** @public */
|
|
6
6
|
const ProjectDiscoveryTest = { layer: (entries) => Layer.succeed(ProjectDiscovery, {
|
|
7
7
|
discoverTestFiles: () => Effect.succeed(entries),
|
|
8
8
|
mapTestToSource: (testFile) => Effect.succeed(entries.find((e) => e.testFile === testFile)?.sourceFiles ?? [])
|
|
9
9
|
}) };
|
|
10
10
|
|
|
11
|
-
//#endregion
|
|
12
11
|
export { ProjectDiscoveryTest };
|
|
@@ -5,7 +5,7 @@ import { Effect, FileSystem, Layer, Option } from "effect";
|
|
|
5
5
|
import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
6
6
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/layers/ProjectIdentityLive.ts
|
|
9
9
|
const readGitRemote = (cwd) => Effect.gen(function* () {
|
|
10
10
|
const trimmed = (yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
11
11
|
"config",
|
|
@@ -91,5 +91,4 @@ const ProjectIdentityLive = Layer.effect(ProjectIdentity, Effect.gen(function* (
|
|
|
91
91
|
*/
|
|
92
92
|
const ProjectIdentityTest = (result) => Layer.succeed(ProjectIdentity, { resolve: () => result instanceof ProjectIdentityNotResolvableError ? Effect.fail(result) : Effect.succeed(result) });
|
|
93
93
|
|
|
94
|
-
//#endregion
|
|
95
94
|
export { ProjectIdentityLive, ProjectIdentityTest };
|
package/layers/RunContextLive.js
CHANGED
|
@@ -3,7 +3,7 @@ import { probeHostMetadataFromEnv } from "@vitest-agent/sdk";
|
|
|
3
3
|
import { Effect, Layer, Option } from "effect";
|
|
4
4
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/layers/RunContextLive.ts
|
|
7
7
|
const runGit = (spawner, cwd, args) => spawner.string(ChildProcess.make("git", args).pipe(ChildProcess.setCwd(cwd))).pipe(Effect.map((output) => {
|
|
8
8
|
const trimmed = output.trim();
|
|
9
9
|
return trimmed.length > 0 ? Option.some(trimmed) : Option.none();
|
|
@@ -78,5 +78,4 @@ const RunContextTest = (fixture) => Layer.succeed(RunContextService, {
|
|
|
78
78
|
captureAgentContext: () => Effect.succeed(fixture.agentContext)
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
//#endregion
|
|
82
81
|
export { RunContextLive, RunContextTest };
|
package/lib/format-triage.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataReader } from "../services/DataReader.js";
|
|
2
2
|
import { Effect, Option } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/lib/format-triage.ts
|
|
5
5
|
/**
|
|
6
6
|
* Generates an orientation triage markdown string for LLM agents.
|
|
7
7
|
* Summarises recent test runs, active sessions, acceptance metrics,
|
|
@@ -99,5 +99,4 @@ const formatTriageEffect = (options = {}) => Effect.gen(function* () {
|
|
|
99
99
|
return out;
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
//#endregion
|
|
103
102
|
export { formatTriageEffect };
|
package/lib/format-wrapup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataReader } from "../services/DataReader.js";
|
|
2
2
|
import { Effect, Option } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/lib/format-wrapup.ts
|
|
5
5
|
const FAILURE_PROMPT_PATTERN = /\b(?:test fail|fix\b[^.]*\btest|why\b[^.]*\bfail(?:ing)?|broken test)\b/i;
|
|
6
6
|
/** @public */
|
|
7
7
|
const formatWrapupEffect = (options) => Effect.gen(function* () {
|
|
@@ -63,5 +63,4 @@ const formatWrapupEffect = (options) => Effect.gen(function* () {
|
|
|
63
63
|
return [options.kind === "stop" ? "## Before you finish" : "## Session wrap-up", ...lines].join("\n");
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
//#endregion
|
|
67
66
|
export { formatWrapupEffect };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { SqlClient } from "effect/sql/SqlClient";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/migrations/0001_initial.ts
|
|
5
5
|
/** @internal */
|
|
6
6
|
const migration = Effect.gen(function* () {
|
|
7
7
|
const sql = yield* SqlClient;
|
|
@@ -820,5 +820,4 @@ const migration = Effect.gen(function* () {
|
|
|
820
820
|
`;
|
|
821
821
|
});
|
|
822
822
|
|
|
823
|
-
//#endregion
|
|
824
823
|
export { migration as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { SqlClient } from "effect/sql/SqlClient";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/migrations/0002_test_artifacts.ts
|
|
5
5
|
/** @internal */
|
|
6
6
|
const migration = Effect.gen(function* () {
|
|
7
7
|
const sql = yield* SqlClient;
|
|
@@ -26,5 +26,4 @@ const migration = Effect.gen(function* () {
|
|
|
26
26
|
yield* sql`ALTER TABLE attachments ADD COLUMN body_encoding TEXT`;
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
//#endregion
|
|
30
29
|
export { migration as default };
|
package/migrations/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import migration from "./0001_initial.js";
|
|
2
2
|
import migration$1 from "./0002_test_artifacts.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/migrations/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* Every migration that must run against a per-project `data.db`, keyed by
|
|
7
7
|
* migration id in application order.
|
|
@@ -24,5 +24,4 @@ const PROJECT_MIGRATIONS = {
|
|
|
24
24
|
"0002_test_artifacts": migration$1
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
//#endregion
|
|
28
27
|
export { PROJECT_MIGRATIONS };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { SqlClient } from "effect/sql/SqlClient";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/migrations/registry_0001_initial.ts
|
|
5
5
|
/**
|
|
6
6
|
* Migration for the global discovery registry SQLite at
|
|
7
7
|
* `$XDG_DATA_HOME/vitest-agent/registry.db`.
|
|
@@ -35,5 +35,4 @@ const migration = Effect.gen(function* () {
|
|
|
35
35
|
yield* sql`CREATE INDEX idx_known_projects_workspace_root ON known_projects(workspace_root)`;
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
//#endregion
|
|
39
38
|
export { migration as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { SqlClient } from "effect/sql/SqlClient";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/migrations/session_map_0001_initial.ts
|
|
5
5
|
/** @internal */
|
|
6
6
|
const migration = Effect.gen(function* () {
|
|
7
7
|
const sql = yield* SqlClient;
|
|
@@ -34,5 +34,4 @@ const migration = Effect.gen(function* () {
|
|
|
34
34
|
yield* sql`CREATE INDEX idx_session_map_conversation_id ON session_map(conversation_id)`;
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
//#endregion
|
|
38
37
|
export { migration as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest-agent/engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared services, layers, SQLite data layer, migrations and platform resolution for the vitest-agent CLI and MCP server.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,23 +40,23 @@
|
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@effect/platform-node": "^4.0.
|
|
44
|
-
"@effect/sql-sqlite-node": "^4.0.
|
|
45
|
-
"@effected/app": "^0.
|
|
46
|
-
"@effected/cli": "^0.
|
|
47
|
-
"@effected/config-file": "^0.
|
|
48
|
-
"@effected/engine": "^0.
|
|
49
|
-
"@effected/env": "^0.
|
|
50
|
-
"@effected/glob": "^0.
|
|
51
|
-
"@effected/jsonc": "^0.
|
|
52
|
-
"@effected/store": "^0.
|
|
53
|
-
"@effected/toml": "^0.
|
|
54
|
-
"@effected/walker": "^0.
|
|
55
|
-
"@effected/workspaces": "^0.
|
|
56
|
-
"@effected/xdg": "^0.
|
|
57
|
-
"@effected/yaml": "^0.
|
|
58
|
-
"@vitest-agent/sdk": "7.0.
|
|
59
|
-
"effect": "^4.0.
|
|
43
|
+
"@effect/platform-node": "^4.0.6",
|
|
44
|
+
"@effect/sql-sqlite-node": "^4.0.6",
|
|
45
|
+
"@effected/app": "^0.25.0",
|
|
46
|
+
"@effected/cli": "^0.20.0",
|
|
47
|
+
"@effected/config-file": "^0.18.0",
|
|
48
|
+
"@effected/engine": "^0.8.0",
|
|
49
|
+
"@effected/env": "^0.5.0",
|
|
50
|
+
"@effected/glob": "^0.14.0",
|
|
51
|
+
"@effected/jsonc": "^0.19.0",
|
|
52
|
+
"@effected/store": "^0.17.0",
|
|
53
|
+
"@effected/toml": "^0.15.0",
|
|
54
|
+
"@effected/walker": "^0.19.0",
|
|
55
|
+
"@effected/workspaces": "^0.36.1",
|
|
56
|
+
"@effected/xdg": "^0.13.0",
|
|
57
|
+
"@effected/yaml": "^0.23.0",
|
|
58
|
+
"@vitest-agent/sdk": "7.0.5",
|
|
59
|
+
"effect": "^4.0.6"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=24.11.0"
|
package/platform.js
CHANGED
|
@@ -6,12 +6,13 @@ import { OutputPipelineLive } from "./layers/OutputPipelineLive.js";
|
|
|
6
6
|
import { ProjectDiscoveryLive } from "./layers/ProjectDiscoveryLive.js";
|
|
7
7
|
import { PROJECT_MIGRATIONS } from "./migrations/index.js";
|
|
8
8
|
import { LEDGER_OPTIONS, toStoreMigrations } from "./stores.js";
|
|
9
|
-
import { Effect, Layer } from "effect";
|
|
9
|
+
import { Context, Effect, Layer } from "effect";
|
|
10
|
+
import { SqlClient } from "effect/sql/SqlClient";
|
|
10
11
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
11
12
|
import { layer } from "@effect/sql-sqlite-node/SqliteClient";
|
|
12
13
|
import { Store } from "@effected/store";
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
// src/platform.ts
|
|
15
16
|
/**
|
|
16
17
|
* The Node platform services every SQLite stack and every Live layer share.
|
|
17
18
|
* `NodeServices.layer` aggregates FileSystem | Path | ChildProcessSpawner |
|
|
@@ -31,7 +32,7 @@ const NodePlatformLayer = NodeServices.layer;
|
|
|
31
32
|
* @public
|
|
32
33
|
*/
|
|
33
34
|
const makeSqliteStack = (filename, migrations = PROJECT_MIGRATIONS) => {
|
|
34
|
-
const SqliteLayer = layer({ filename });
|
|
35
|
+
const SqliteLayer = layer({ filename }).pipe(Layer.tap((context) => Context.get(context, SqlClient)`PRAGMA synchronous = NORMAL`));
|
|
35
36
|
return {
|
|
36
37
|
SqliteLayer,
|
|
37
38
|
MigratorLayer: Layer.effectDiscard(Effect.void).pipe(Layer.provide(Store.layer({
|
|
@@ -59,5 +60,4 @@ const PlatformLive = (options) => {
|
|
|
59
60
|
return options.logger === false ? platform : platform.pipe(Layer.provideMerge(LoggerLive(options.logLevel, options.logFile, options.env)));
|
|
60
61
|
};
|
|
61
62
|
|
|
62
|
-
//#endregion
|
|
63
63
|
export { NodePlatformLayer, PlatformLive, makeSqliteStack };
|
package/programs/end-agent.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DataStore } from "../services/DataStore.js";
|
|
|
2
2
|
import { PerClientSessionMapWriter } from "../services/PerClientSessionMap.js";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/programs/end-agent.ts
|
|
6
6
|
/**
|
|
7
7
|
* End an agent. Closes the `agents` row, optionally also closes the
|
|
8
8
|
* `session_map` row.
|
|
@@ -15,5 +15,4 @@ const endAgentEffect = (input) => Effect.gen(function* () {
|
|
|
15
15
|
if (input.hostSessionId !== void 0) yield* (yield* PerClientSessionMapWriter).endSession(input.hostSessionId, input.endedAt);
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
//#endregion
|
|
19
18
|
export { endAgentEffect };
|
package/programs/hook-paths.js
CHANGED
|
@@ -6,7 +6,7 @@ import { ConfigProvider, Effect, FileSystem, Layer, Path } from "effect";
|
|
|
6
6
|
import { AppDirs, Xdg } from "@effected/xdg";
|
|
7
7
|
import { AppStore } from "@effected/app";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/programs/hook-paths.ts
|
|
10
10
|
/**
|
|
11
11
|
* Filename of the per-project test-data SQLite database.
|
|
12
12
|
*
|
|
@@ -123,5 +123,4 @@ const resolveHookPaths = (input) => Effect.gen(function* () {
|
|
|
123
123
|
};
|
|
124
124
|
}).pipe(Effect.provide(hookAppDirs(input.env)));
|
|
125
125
|
|
|
126
|
-
//#endregion
|
|
127
126
|
export { DATA_DB_FILENAME, REGISTRY_DB_FILENAME, REGISTRY_STORE_OPTIONS, SESSIONS_DB_FILENAME, resolveHookPaths, resolveSessionMapPath };
|
|
@@ -11,7 +11,7 @@ import { REGISTRY_STORE_OPTIONS } from "./hook-paths.js";
|
|
|
11
11
|
import { Layer } from "effect";
|
|
12
12
|
import { Store } from "@effected/store";
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// src/programs/platform-sidecar.ts
|
|
15
15
|
/**
|
|
16
16
|
* Build the sidecar Live layer for the supplied SQLite paths.
|
|
17
17
|
*
|
|
@@ -41,5 +41,4 @@ const SidecarPlatformLive = (paths, env) => {
|
|
|
41
41
|
return Layer.mergeAll(ProjectStoreLayer, SessionMapLayer, RegistryLayer, RunContextLive(env)).pipe(Layer.provideMerge(NodePlatformLayer), Layer.provideMerge(LoggerLive()));
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
//#endregion
|
|
45
44
|
export { SidecarPlatformLive };
|
|
@@ -2,7 +2,7 @@ import { DataReader } from "../services/DataReader.js";
|
|
|
2
2
|
import { DataStore } from "../services/DataStore.js";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/programs/record-session.ts
|
|
6
6
|
/**
|
|
7
7
|
* Upsert a `sessions` row for a SessionStart / SubagentStart hook, resolving
|
|
8
8
|
* `parentChatId` to the parent's numeric session id when present.
|
|
@@ -45,5 +45,4 @@ const recordSessionEnd = (input) => Effect.gen(function* () {
|
|
|
45
45
|
return { ok: true };
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
//#endregion
|
|
49
48
|
export { recordSessionEnd, recordSessionStart };
|
|
@@ -3,7 +3,7 @@ import { DataStore } from "../services/DataStore.js";
|
|
|
3
3
|
import { resolveSessionForRecording } from "./resolve-session-for-recording.js";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/programs/record-tdd-artifact.ts
|
|
7
7
|
/**
|
|
8
8
|
* Resolve (auto-opening a `spike` phase if needed) the current open
|
|
9
9
|
* phase for `tddTaskId`, then write the artifact under it. Shared by
|
|
@@ -115,5 +115,4 @@ const dispatchRecordTddArtifactEffect = (input) => {
|
|
|
115
115
|
return Effect.fail(/* @__PURE__ */ new Error("record tdd-artifact requires either --chat-id or --tdd-task-id."));
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
//#endregion
|
|
119
118
|
export { dispatchRecordTddArtifactEffect, recordTddArtifactByTaskIdEffect, recordTddArtifactEffect };
|
package/programs/record-turn.js
CHANGED
|
@@ -3,7 +3,7 @@ import { resolveSessionForRecording } from "./resolve-session-for-recording.js";
|
|
|
3
3
|
import { TurnPayload } from "@vitest-agent/sdk";
|
|
4
4
|
import { Effect, Schema } from "effect";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/programs/record-turn.ts
|
|
7
7
|
/**
|
|
8
8
|
* Parse a raw JSON string and validate it against the `TurnPayload` schema
|
|
9
9
|
* without throwing.
|
|
@@ -57,5 +57,4 @@ const recordTurnEffect = (input) => Effect.gen(function* () {
|
|
|
57
57
|
}) };
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
//#endregion
|
|
61
60
|
export { parseAndValidateTurnPayload, recordTurnEffect };
|
|
@@ -2,7 +2,7 @@ import { DataStore } from "../services/DataStore.js";
|
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { SqlClient } from "effect/sql/SqlClient";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/programs/record-workspace-changes.ts
|
|
6
6
|
/**
|
|
7
7
|
* `ProjectRunSummary` doesn't expose `lastRunId`, so we query it directly
|
|
8
8
|
* via SqlClient. This is the run id of the most-recent test run for a
|
|
@@ -53,5 +53,4 @@ const recordRunWorkspaceChangesEffect = (input) => Effect.gen(function* () {
|
|
|
53
53
|
};
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
//#endregion
|
|
57
56
|
export { recordRunWorkspaceChangesEffect };
|
|
@@ -5,7 +5,7 @@ import { RunContextService } from "../services/RunContext.js";
|
|
|
5
5
|
import { deriveIdempotencyKey } from "../services/idempotency.js";
|
|
6
6
|
import { Effect, Option } from "effect";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/programs/register-agent.ts
|
|
9
9
|
const deriveDefaultClientNonce = (input) => {
|
|
10
10
|
const parent = input.parentAgentId ?? "__ROOT__";
|
|
11
11
|
return `${input.hostSessionId}|${input.agentType}|${parent}`;
|
|
@@ -81,5 +81,4 @@ const registerAgentEffect = (input) => Effect.gen(function* () {
|
|
|
81
81
|
};
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
//#endregion
|
|
85
84
|
export { registerAgentEffect };
|
|
@@ -2,7 +2,7 @@ import { DataReader } from "../services/DataReader.js";
|
|
|
2
2
|
import { DataStore } from "../services/DataStore.js";
|
|
3
3
|
import { Effect, FileSystem, Option } from "effect";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/programs/resolve-session-for-recording.ts
|
|
6
6
|
/**
|
|
7
7
|
* Resolve the `sessions` row for a hook-delivered chat id: exact match,
|
|
8
8
|
* then the synthetic `-subagent-` prefix, then an idempotent bootstrap of
|
|
@@ -40,5 +40,4 @@ const resolveSessionForRecording = (input) => Effect.gen(function* () {
|
|
|
40
40
|
*/
|
|
41
41
|
const readPackageName = (fs, cwd) => fs.readFileString(`${cwd}/package.json`).pipe(Effect.flatMap((raw) => Effect.try(() => JSON.parse(raw))), Effect.map((parsed) => typeof parsed.name === "string" ? parsed.name : void 0), Effect.catch(() => Effect.succeed(void 0)));
|
|
42
42
|
|
|
43
|
-
//#endregion
|
|
44
43
|
export { resolveSessionForRecording };
|
package/programs/session-env.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join, resolve } from "node:path";
|
|
2
2
|
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/programs/session-env.ts
|
|
5
5
|
const EXPORT_LINE = /^export ([A-Z_][A-Z0-9_]*)=(.*)$/;
|
|
6
6
|
/**
|
|
7
7
|
* Undo the `printf '%q'` quoting the SessionStart hook applies to export
|
|
@@ -90,5 +90,4 @@ const recoverSessionContextFromSessionEnv = (opts) => {
|
|
|
90
90
|
return best === null ? null : best.ctx;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
//#endregion
|
|
94
93
|
export { parseSessionEnvExports, recoverSessionContextFromSessionEnv };
|
package/project-dir.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LaunchContext } from "@effected/engine";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/project-dir.ts
|
|
4
4
|
/**
|
|
5
5
|
* Environment variables that may override the project directory, in
|
|
6
6
|
* precedence order (highest first).
|
|
@@ -30,5 +30,4 @@ const resolveProjectDir = (input) => LaunchContext.projectDir({
|
|
|
30
30
|
cwd: input.cwd
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
//#endregion
|
|
34
33
|
export { resolveProjectDir };
|
package/services/Config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigFile } from "@effected/config-file";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/services/Config.ts
|
|
4
4
|
/**
|
|
5
5
|
* Typed service class (Context tag) for the vitest-agent config file service.
|
|
6
6
|
*
|
|
@@ -11,5 +11,4 @@ import { ConfigFile } from "@effected/config-file";
|
|
|
11
11
|
*/
|
|
12
12
|
var VitestAgentConfigFile = class extends ConfigFile.Service()("vitest-agent/Config") {};
|
|
13
13
|
|
|
14
|
-
//#endregion
|
|
15
14
|
export { VitestAgentConfigFile };
|
package/services/DataReader.js
CHANGED
package/services/DataStore.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/services/DataStore.ts
|
|
4
4
|
/**
|
|
5
5
|
* Ceiling on an inline attachment body. Vitest has already copied file
|
|
6
6
|
* attachments into `.vitest/attachments/`, so a large body is referenced
|
|
@@ -11,5 +11,4 @@ const INLINE_ATTACHMENT_BODY_CAP_BYTES = 65536;
|
|
|
11
11
|
/** @public */
|
|
12
12
|
var DataStore = class extends Context.Service()("vitest-agent/DataStore") {};
|
|
13
13
|
|
|
14
|
-
//#endregion
|
|
15
14
|
export { DataStore, INLINE_ATTACHMENT_BODY_CAP_BYTES };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/services/DetailResolver.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
var DetailResolver = class extends Context.Service()("vitest-agent/DetailResolver") {};
|
|
6
6
|
|
|
7
|
-
//#endregion
|
|
8
7
|
export { DetailResolver };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/services/DiscoveryRegistry.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
var DiscoveryRegistry = class extends Context.Service()("vitest-agent/DiscoveryRegistry") {};
|
|
6
6
|
|
|
7
|
-
//#endregion
|
|
8
7
|
export { DiscoveryRegistry };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/services/EnvironmentDetector.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
var EnvironmentDetector = class extends Context.Service()("vitest-agent/EnvironmentDetector") {};
|
|
6
6
|
|
|
7
|
-
//#endregion
|
|
8
7
|
export { EnvironmentDetector };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/services/ExecutorResolver.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
var ExecutorResolver = class extends Context.Service()("vitest-agent/ExecutorResolver") {};
|
|
6
6
|
|
|
7
|
-
//#endregion
|
|
8
7
|
export { ExecutorResolver };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/services/HistoryTracker.ts
|
|
4
4
|
/**
|
|
5
5
|
* Builds the composite (modulePath, fullName) key used to key the internal
|
|
6
6
|
* testMap and the returned classifications Map, so identically-named tests
|
|
@@ -16,5 +16,4 @@ const historyKey = (modulePath, fullName) => JSON.stringify([modulePath, fullNam
|
|
|
16
16
|
/** @public */
|
|
17
17
|
var HistoryTracker = class extends Context.Service()("vitest-agent/HistoryTracker") {};
|
|
18
18
|
|
|
19
|
-
//#endregion
|
|
20
19
|
export { HistoryTracker, historyKey };
|