@vitest-agent/engine 3.1.1 → 3.1.2
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/package.json +16 -16
- package/platform.js +3 -6
- package/stores.js +20 -6
- package/utils/ensure-migrated.js +2 -3
- package/utils/resolve-project-key-from-cwd.js +2 -3
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest-agent/engine",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
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": [
|
|
@@ -42,22 +42,22 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@effect/platform-node": "~4.1.2",
|
|
44
44
|
"@effect/sql-sqlite-node": "~4.1.2",
|
|
45
|
-
"@effected/app": "^0.31.
|
|
46
|
-
"@effected/cli-kit": "^0.
|
|
47
|
-
"@effected/config-file": "^0.
|
|
48
|
-
"@effected/env": "^0.
|
|
45
|
+
"@effected/app": "^0.31.1",
|
|
46
|
+
"@effected/cli-kit": "^0.27.0",
|
|
47
|
+
"@effected/config-file": "^0.25.0",
|
|
48
|
+
"@effected/env": "^0.11.0",
|
|
49
49
|
"@effected/git": "^0.30.0",
|
|
50
|
-
"@effected/glob": "^0.
|
|
51
|
-
"@effected/jsonc": "^0.
|
|
52
|
-
"@effected/kit": "^0.
|
|
53
|
-
"@effected/memfs": "^0.
|
|
54
|
-
"@effected/package-json": "^0.
|
|
55
|
-
"@effected/store": "^0.
|
|
56
|
-
"@effected/toml": "^0.19.
|
|
57
|
-
"@effected/walker": "^0.25.
|
|
58
|
-
"@effected/workspaces": "^0.
|
|
59
|
-
"@effected/xdg": "^0.19.
|
|
60
|
-
"@effected/yaml": "^0.
|
|
50
|
+
"@effected/glob": "^0.19.0",
|
|
51
|
+
"@effected/jsonc": "^0.24.0",
|
|
52
|
+
"@effected/kit": "^0.13.0",
|
|
53
|
+
"@effected/memfs": "^0.24.0",
|
|
54
|
+
"@effected/package-json": "^0.30.0",
|
|
55
|
+
"@effected/store": "^0.24.0",
|
|
56
|
+
"@effected/toml": "^0.19.1",
|
|
57
|
+
"@effected/walker": "^0.25.1",
|
|
58
|
+
"@effected/workspaces": "^0.43.0",
|
|
59
|
+
"@effected/xdg": "^0.19.1",
|
|
60
|
+
"@effected/yaml": "^0.29.0",
|
|
61
61
|
"@vitest-agent/sdk": "9.0.3",
|
|
62
62
|
"effect": "~4.1.2"
|
|
63
63
|
},
|
package/platform.js
CHANGED
|
@@ -5,7 +5,7 @@ import { LoggerLive } from "./layers/LoggerLive.js";
|
|
|
5
5
|
import { OutputPipelineLive } from "./layers/OutputPipelineLive.js";
|
|
6
6
|
import { ProjectDiscoveryLive } from "./layers/ProjectDiscoveryLive.js";
|
|
7
7
|
import { PROJECT_MIGRATIONS } from "./migrations/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { DATA_DB_CONNECTION_OPTIONS, LEDGER_OPTIONS } from "./stores.js";
|
|
9
9
|
import { Context, Effect, Layer } from "effect";
|
|
10
10
|
import { SqlClient } from "effect/sql/SqlClient";
|
|
11
11
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
@@ -34,11 +34,8 @@ const NodePlatformLayer = NodeServices.layer;
|
|
|
34
34
|
const makeSqliteStack = (filename, migrations = PROJECT_MIGRATIONS) => {
|
|
35
35
|
const SqliteLayer = layer({
|
|
36
36
|
filename,
|
|
37
|
-
|
|
38
|
-
}).pipe(Layer.tap((context) =>
|
|
39
|
-
const sql = Context.get(context, SqlClient);
|
|
40
|
-
return Effect.andThen(sql`PRAGMA synchronous = NORMAL`, applyConnectionPragmas(sql));
|
|
41
|
-
}));
|
|
37
|
+
...DATA_DB_CONNECTION_OPTIONS.client
|
|
38
|
+
}).pipe(Layer.tap((context) => DATA_DB_CONNECTION_OPTIONS.onConnect(Context.get(context, SqlClient))));
|
|
42
39
|
return {
|
|
43
40
|
SqliteLayer,
|
|
44
41
|
MigratorLayer: Layer.effectDiscard(Effect.void).pipe(Layer.provide(Store.layer({
|
package/stores.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
1
|
+
import { Context, Effect } from "effect";
|
|
2
2
|
|
|
3
3
|
// src/stores.ts
|
|
4
4
|
/**
|
|
@@ -12,8 +12,6 @@ const LEDGER_OPTIONS = { adoptMigratorLedger: true };
|
|
|
12
12
|
* How long a connection waits on a locked database before `SQLITE_BUSY`:
|
|
13
13
|
* five seconds, the value the 2.x migrations set with `PRAGMA busy_timeout`.
|
|
14
14
|
* Passed as the driver's `busyTimeout`, which applies it on every open.
|
|
15
|
-
*
|
|
16
|
-
* @internal
|
|
17
15
|
*/
|
|
18
16
|
const BUSY_TIMEOUT = "5 seconds";
|
|
19
17
|
/**
|
|
@@ -23,8 +21,6 @@ const BUSY_TIMEOUT = "5 seconds";
|
|
|
23
21
|
* migration can only do for the one connection that runs it; the
|
|
24
22
|
* `node:sqlite` driver happens to default both today, and this pins them
|
|
25
23
|
* so a driver default change cannot silently drop them.
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
24
|
*/
|
|
29
25
|
const applyConnectionPragmas = (sql) => sql`PRAGMA foreign_keys = ON`;
|
|
30
26
|
/**
|
|
@@ -38,6 +34,24 @@ const CONNECTION_OPTIONS = {
|
|
|
38
34
|
onConnect: applyConnectionPragmas
|
|
39
35
|
};
|
|
40
36
|
/**
|
|
37
|
+
* The connection options every `data.db` connection opens with, on both of
|
|
38
|
+
* its open paths (`makeSqliteStack` and `ensureMigrated`): {@link CONNECTION_OPTIONS}
|
|
39
|
+
* plus `synchronous = NORMAL`, set as the connection opens and before any
|
|
40
|
+
* migration.
|
|
41
|
+
*
|
|
42
|
+
* WAL + `synchronous = NORMAL` is SQLite's documented pairing: a commit no
|
|
43
|
+
* longer fsyncs (the WAL is synced at checkpoint), and the database stays
|
|
44
|
+
* consistent across an application crash; only a power loss or OS crash can
|
|
45
|
+
* roll back the most recent commits. `sessions.db` and `registry.db` keep the
|
|
46
|
+
* driver's default.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
const DATA_DB_CONNECTION_OPTIONS = {
|
|
51
|
+
client: CONNECTION_OPTIONS.client,
|
|
52
|
+
onConnect: (sql) => Effect.andThen(sql`PRAGMA synchronous = NORMAL`, CONNECTION_OPTIONS.onConnect(sql))
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
41
55
|
* The global discovery registry (`<XDG data>/vitest-agent/registry.db`).
|
|
42
56
|
* @internal
|
|
43
57
|
*/
|
|
@@ -48,4 +62,4 @@ var RegistryStore = class extends Context.Service()("vitest-agent/RegistryStore"
|
|
|
48
62
|
*/
|
|
49
63
|
var SessionMapStore = class extends Context.Service()("vitest-agent/SessionMapStore") {};
|
|
50
64
|
|
|
51
|
-
export {
|
|
65
|
+
export { CONNECTION_OPTIONS, DATA_DB_CONNECTION_OPTIONS, LEDGER_OPTIONS, RegistryStore, SessionMapStore };
|
package/utils/ensure-migrated.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LoggerLive } from "../layers/LoggerLive.js";
|
|
2
2
|
import { PROJECT_MIGRATIONS } from "../migrations/index.js";
|
|
3
3
|
import { NodePlatformLayer } from "../platform.js";
|
|
4
|
-
import {
|
|
4
|
+
import { DATA_DB_CONNECTION_OPTIONS, LEDGER_OPTIONS } from "../stores.js";
|
|
5
5
|
import { Effect } from "effect";
|
|
6
6
|
import { Store } from "@effected/store";
|
|
7
7
|
|
|
@@ -40,8 +40,7 @@ function ensureMigrated(dbPath, logLevel, logFile, env) {
|
|
|
40
40
|
filename: dbPath,
|
|
41
41
|
migrations: PROJECT_STORE_MIGRATIONS,
|
|
42
42
|
...LEDGER_OPTIONS,
|
|
43
|
-
|
|
44
|
-
onConnect: (sql) => Effect.andThen(sql`PRAGMA synchronous = NORMAL`, applyConnectionPragmas(sql))
|
|
43
|
+
...DATA_DB_CONNECTION_OPTIONS
|
|
45
44
|
}).pipe(Effect.provide(NodePlatformLayer), Effect.provide(LoggerLive(logLevel, logFile, env))));
|
|
46
45
|
}
|
|
47
46
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { repositoryUrlOf } from "./package-manifest.js";
|
|
2
2
|
import { gitUrlToProjectKey } from "@vitest-agent/sdk";
|
|
3
|
-
import { Effect, FileSystem,
|
|
4
|
-
import * as NodePath from "@effect/platform-node/NodePath";
|
|
3
|
+
import { Effect, FileSystem, Option, Path, Result } from "effect";
|
|
5
4
|
import { AppDirs } from "@effected/xdg";
|
|
6
5
|
import { Walker } from "@effected/walker";
|
|
7
6
|
import { LenientManifest } from "@effected/package-json";
|
|
@@ -31,7 +30,7 @@ const basenameKey = (path, cwd) => {
|
|
|
31
30
|
const basename = path.basename(cwd);
|
|
32
31
|
return basename.length === 0 ? "anonymous-project" : Result.getOrElse(AppDirs.segment(basename), () => "anonymous-project");
|
|
33
32
|
};
|
|
34
|
-
const NodeSyncPlatform =
|
|
33
|
+
const NodeSyncPlatform = NodeSyncFileSystem.layerWithPath;
|
|
35
34
|
/**
|
|
36
35
|
* Compute the project key for a workspace by reading `package.json`
|
|
37
36
|
* fields directly. Returns the canonical `host__path` form when a git
|
package/version.js
CHANGED