@emseepea/create-database-schema-server 0.0.2 → 0.0.6
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/README.md
CHANGED
|
@@ -109,6 +109,13 @@ The tools never accept SQL, operators, table names, sort expressions, or
|
|
|
109
109
|
destinations from the caller. PostgreSQL statements have a 1.5 second timeout,
|
|
110
110
|
the connection pool is bounded, and provider failures return a generic error.
|
|
111
111
|
|
|
112
|
+
## Add Feedback
|
|
113
|
+
|
|
114
|
+
Install `@emseepea/feedback` when this server needs a detailed one-way
|
|
115
|
+
observation or a durable support conversation. Pass its tools through the
|
|
116
|
+
application factory's `additionalTools` option. Choose PostgreSQL, Firestore,
|
|
117
|
+
GitHub Issues, or Zendesk in the [feedback guide](../../packages/feedback/README.md).
|
|
118
|
+
|
|
112
119
|
## Check This Project
|
|
113
120
|
|
|
114
121
|
Run generation, lint, build, and ordinary integration tests without spending
|
|
@@ -79,6 +79,13 @@ The tools never accept SQL, operators, table names, sort expressions, or
|
|
|
79
79
|
destinations from the caller. PostgreSQL statements have a 1.5 second timeout,
|
|
80
80
|
the connection pool is bounded, and provider failures return a generic error.
|
|
81
81
|
|
|
82
|
+
## Add Feedback
|
|
83
|
+
|
|
84
|
+
Install `@emseepea/feedback` when this server needs a detailed one-way
|
|
85
|
+
observation or a durable support conversation. Pass its tools through the
|
|
86
|
+
application factory's `additionalTools` option. Choose PostgreSQL, Firestore,
|
|
87
|
+
GitHub Issues, or Zendesk in the [feedback guide](../../packages/feedback/README.md).
|
|
88
|
+
|
|
82
89
|
## Check This Project
|
|
83
90
|
|
|
84
91
|
Run generation, lint, build, and ordinary integration tests without spending
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import test from "node:test";
|
|
2
2
|
import {
|
|
3
|
+
assertNoNegativeFeedback,
|
|
3
4
|
assertResponseContains,
|
|
4
5
|
assertResponseMeaning,
|
|
5
|
-
|
|
6
|
+
assertToolCallsWithOptionalFeedback,
|
|
6
7
|
createConversation,
|
|
7
8
|
} from "@emseepea/testing/semantic";
|
|
8
9
|
|
|
10
|
+
const server = new URL(import.meta.resolve("@emseepea/feedback/testing-server"));
|
|
11
|
+
const appModule = new URL("../dist/app.js", import.meta.url).href;
|
|
12
|
+
|
|
9
13
|
const trialDatabaseUrls = [1, 2, 3].map((trial) => {
|
|
10
14
|
const value = process.env[`DATABASE_URL_TRIAL_${trial}`];
|
|
11
15
|
if (!value) throw new Error(`DATABASE_URL_TRIAL_${trial} is required`);
|
|
@@ -14,15 +18,20 @@ const trialDatabaseUrls = [1, 2, 3].map((trial) => {
|
|
|
14
18
|
|
|
15
19
|
test("finds and adds pea varieties through natural requests", async (t) => {
|
|
16
20
|
const chat = await createConversation(t, {
|
|
17
|
-
server
|
|
18
|
-
environment: (trial) => ({
|
|
21
|
+
server,
|
|
22
|
+
environment: (trial) => ({
|
|
23
|
+
DATABASE_URL: trialDatabaseUrls[trial - 1],
|
|
24
|
+
EMSEEPEA_EVAL_APP_MODULE: appModule,
|
|
25
|
+
EMSEEPEA_EVAL_APP_FACTORY: "createDatabaseSchemaExample",
|
|
26
|
+
EMSEEPEA_EVAL_APP_KIND: "postgres",
|
|
27
|
+
}),
|
|
19
28
|
});
|
|
20
29
|
|
|
21
30
|
// One read and one write show both important selection decisions. Procedure
|
|
22
31
|
// selection stays in ordinary tests because a third model turn adds cost but
|
|
23
32
|
// does not teach a meaningfully different MCP interaction.
|
|
24
33
|
const fastest = await chat.send("Which snap pea variety matures fastest?");
|
|
25
|
-
|
|
34
|
+
await assertToolCallsWithOptionalFeedback(fastest, [{
|
|
26
35
|
name: "list-pea-varieties",
|
|
27
36
|
arguments: { pea_type: "snap" },
|
|
28
37
|
}]);
|
|
@@ -34,7 +43,7 @@ test("finds and adds pea varieties through natural requests", async (t) => {
|
|
|
34
43
|
"Add Golden Sweet as a climbing mangetout pea that matures in 70 days. " +
|
|
35
44
|
"Use exactly mangetout as its pea type. Its notes are: Purple flowers and flat edible pods.",
|
|
36
45
|
);
|
|
37
|
-
|
|
46
|
+
await assertToolCallsWithOptionalFeedback(added, [{
|
|
38
47
|
name: "add-pea-variety",
|
|
39
48
|
arguments: {
|
|
40
49
|
name: "Golden Sweet",
|
|
@@ -45,4 +54,5 @@ test("finds and adds pea varieties through natural requests", async (t) => {
|
|
|
45
54
|
},
|
|
46
55
|
}]);
|
|
47
56
|
assertResponseContains(added, ["Golden Sweet", "mangetout", "70"]);
|
|
57
|
+
assertNoNegativeFeedback(fastest, added);
|
|
48
58
|
});
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
"lint": "oxlint src test eval scripts kanel.config.cjs"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
+
"@emseepea/feedback": "0.2.1",
|
|
20
21
|
"kanel": "4.0.4",
|
|
21
22
|
"kanel-zod": "4.0.1",
|
|
22
|
-
"@emseepea/testing": "0.
|
|
23
|
+
"@emseepea/testing": "0.9.4",
|
|
23
24
|
"@modelcontextprotocol/client": "2.0.0",
|
|
24
25
|
"@types/node": "24.13.3",
|
|
25
26
|
"@types/pg": "8.23.1",
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
},
|
|
32
33
|
"private": true,
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@emseepea/server": "0.
|
|
35
|
+
"@emseepea/server": "0.7.0",
|
|
35
36
|
"pg": "8.23.0",
|
|
36
37
|
"zod": "4.4.3"
|
|
37
38
|
}
|
|
@@ -13,11 +13,11 @@ export interface DatabaseSchemaExampleOptions extends EmseepeaExtensions {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export async function createDatabaseSchemaExample(options: DatabaseSchemaExampleOptions) {
|
|
16
|
-
const { access = { access: "public" },
|
|
16
|
+
const { databaseUrl: databaseUrlOption, access = { access: "public" }, ...extensions } = options;
|
|
17
17
|
const databaseUrl = z.string().url().refine(
|
|
18
18
|
(value) => ["postgres:", "postgresql:"].includes(new URL(value).protocol),
|
|
19
19
|
"databaseUrl must use PostgreSQL",
|
|
20
|
-
).parse(
|
|
20
|
+
).parse(databaseUrlOption);
|
|
21
21
|
let database: Pool | undefined = new Pool({
|
|
22
22
|
connectionString: databaseUrl,
|
|
23
23
|
connectionTimeoutMillis: 2_000,
|
|
@@ -50,8 +50,7 @@ export async function createDatabaseSchemaExample(options: DatabaseSchemaExample
|
|
|
50
50
|
database: () => database,
|
|
51
51
|
access,
|
|
52
52
|
}),
|
|
53
|
-
|
|
54
|
-
observability,
|
|
53
|
+
...extensions,
|
|
55
54
|
});
|
|
56
55
|
const closeProvider = async () => {
|
|
57
56
|
const activeDatabase = database;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emseepea/create-database-schema-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Create an Em See Pea server with internal validation generated from a PostgreSQL schema.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
"prepack": "npm run build:initializer"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@emseepea/
|
|
24
|
+
"@emseepea/feedback": "0.2.1",
|
|
25
|
+
"@emseepea/server": "0.7.0",
|
|
25
26
|
"pg": "8.23.0",
|
|
26
27
|
"zod": "4.4.3",
|
|
27
28
|
"kanel": "4.0.4",
|
|
28
29
|
"kanel-zod": "4.0.1",
|
|
29
|
-
"@emseepea/testing": "0.
|
|
30
|
+
"@emseepea/testing": "0.9.4",
|
|
30
31
|
"@modelcontextprotocol/client": "2.0.0",
|
|
31
32
|
"@types/node": "24.13.3",
|
|
32
33
|
"@types/pg": "8.23.1",
|