@emseepea/create-mongodb-backed-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
|
@@ -114,6 +114,13 @@ The tools never accept database operators, collection names, sort documents,
|
|
|
114
114
|
or destinations. The pool and database operations are bounded, and provider
|
|
115
115
|
failures return a generic error.
|
|
116
116
|
|
|
117
|
+
## Add Feedback
|
|
118
|
+
|
|
119
|
+
Install `@emseepea/feedback` when this server needs a detailed one-way
|
|
120
|
+
observation or a durable support conversation. Pass its tools through the
|
|
121
|
+
application factory's `additionalTools` option. Choose PostgreSQL, Firestore,
|
|
122
|
+
GitHub Issues, or Zendesk in the [feedback guide](../../packages/feedback/README.md).
|
|
123
|
+
|
|
117
124
|
## Check This Project
|
|
118
125
|
|
|
119
126
|
Run lint, build, and ordinary database integration tests without spending model
|
|
@@ -85,6 +85,13 @@ The tools never accept database operators, collection names, sort documents,
|
|
|
85
85
|
or destinations. The pool and database operations are bounded, and provider
|
|
86
86
|
failures return a generic error.
|
|
87
87
|
|
|
88
|
+
## Add Feedback
|
|
89
|
+
|
|
90
|
+
Install `@emseepea/feedback` when this server needs a detailed one-way
|
|
91
|
+
observation or a durable support conversation. Pass its tools through the
|
|
92
|
+
application factory's `additionalTools` option. Choose PostgreSQL, Firestore,
|
|
93
|
+
GitHub Issues, or Zendesk in the [feedback guide](../../packages/feedback/README.md).
|
|
94
|
+
|
|
88
95
|
## Check This Project
|
|
89
96
|
|
|
90
97
|
Run lint, build, and ordinary database integration tests without spending model
|
|
@@ -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 trialUris = [1, 2, 3].map((trial) => {
|
|
10
14
|
const value = process.env[`MONGODB_URL_TRIAL_${trial}`];
|
|
11
15
|
if (!value) throw new Error(`MONGODB_URL_TRIAL_${trial} is required`);
|
|
@@ -14,14 +18,19 @@ const trialUris = [1, 2, 3].map((trial) => {
|
|
|
14
18
|
|
|
15
19
|
test("finds and adds MongoDB-backed 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
|
+
MONGODB_URL: trialUris[trial - 1],
|
|
24
|
+
EMSEEPEA_EVAL_APP_MODULE: appModule,
|
|
25
|
+
EMSEEPEA_EVAL_APP_FACTORY: "createMongoExample",
|
|
26
|
+
EMSEEPEA_EVAL_APP_KIND: "mongodb",
|
|
27
|
+
}),
|
|
19
28
|
});
|
|
20
29
|
|
|
21
30
|
// The read and write turns cover both public decisions. Storage validation
|
|
22
31
|
// remains in deterministic tests because asking a model cannot prove it.
|
|
23
32
|
const fastest = await chat.send("Among the saved snap pea varieties, which matures fastest?");
|
|
24
|
-
|
|
33
|
+
await assertToolCallsWithOptionalFeedback(fastest, [{
|
|
25
34
|
name: "list-pea-varieties",
|
|
26
35
|
arguments: { pea_type: "snap" },
|
|
27
36
|
}]);
|
|
@@ -33,7 +42,7 @@ test("finds and adds MongoDB-backed pea varieties through natural requests", asy
|
|
|
33
42
|
"Add Golden Sweet as a climbing mangetout pea that matures in 70 days. " +
|
|
34
43
|
"Use exactly mangetout as its pea type. Its notes are: Purple flowers and flat edible pods.",
|
|
35
44
|
);
|
|
36
|
-
|
|
45
|
+
await assertToolCallsWithOptionalFeedback(added, [{
|
|
37
46
|
name: "add-pea-variety",
|
|
38
47
|
arguments: {
|
|
39
48
|
name: "Golden Sweet",
|
|
@@ -51,7 +60,7 @@ test("finds and adds MongoDB-backed pea varieties through natural requests", asy
|
|
|
51
60
|
"Record that Golden Sweet was flowering in the west trellis on 2026-09-08. " +
|
|
52
61
|
"The notes are: First flower opened.",
|
|
53
62
|
);
|
|
54
|
-
|
|
63
|
+
await assertToolCallsWithOptionalFeedback(recorded, [{
|
|
55
64
|
name: "record-pea-observation",
|
|
56
65
|
arguments: {
|
|
57
66
|
variety_name: "Golden Sweet",
|
|
@@ -63,7 +72,7 @@ test("finds and adds MongoDB-backed pea varieties through natural requests", asy
|
|
|
63
72
|
}]);
|
|
64
73
|
|
|
65
74
|
const observations = await chat.send("What have I observed about Golden Sweet?");
|
|
66
|
-
|
|
75
|
+
await assertToolCallsWithOptionalFeedback(observations, [{
|
|
67
76
|
name: "list-pea-observations",
|
|
68
77
|
arguments: { variety_name: "Golden Sweet" },
|
|
69
78
|
}]);
|
|
@@ -72,4 +81,5 @@ test("finds and adds MongoDB-backed pea varieties through natural requests", asy
|
|
|
72
81
|
"Golden Sweet was flowering in the west trellis on 8 September 2026, " +
|
|
73
82
|
"and the first flower had opened.",
|
|
74
83
|
});
|
|
84
|
+
assertNoNegativeFeedback(fastest, added, recorded, observations);
|
|
75
85
|
});
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"lint": "oxlint src test eval"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@emseepea/
|
|
19
|
+
"@emseepea/feedback": "0.2.1",
|
|
20
|
+
"@emseepea/testing": "0.9.4",
|
|
20
21
|
"@types/node": "24.13.3",
|
|
21
22
|
"typescript": "6.0.3",
|
|
22
23
|
"oxlint": "1.80.0"
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
},
|
|
27
28
|
"private": true,
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@emseepea/server": "0.
|
|
30
|
+
"@emseepea/server": "0.7.0",
|
|
30
31
|
"ajv": "8.20.0",
|
|
31
32
|
"json-schema-to-ts": "3.1.1",
|
|
32
33
|
"mongodb": "7.6.0",
|
|
@@ -18,8 +18,7 @@ export interface MongoExampleOptions extends EmseepeaExtensions {
|
|
|
18
18
|
export async function createMongoExample({
|
|
19
19
|
uri,
|
|
20
20
|
access = { access: "public" },
|
|
21
|
-
|
|
22
|
-
observability,
|
|
21
|
+
...extensions
|
|
23
22
|
}: MongoExampleOptions) {
|
|
24
23
|
const parsedUri = z.string().url().refine(
|
|
25
24
|
(value) => ["mongodb:", "mongodb+srv:"].includes(new URL(value).protocol),
|
|
@@ -51,8 +50,7 @@ export async function createMongoExample({
|
|
|
51
50
|
observations: () => observations,
|
|
52
51
|
varieties: () => varieties,
|
|
53
52
|
}),
|
|
54
|
-
|
|
55
|
-
observability,
|
|
53
|
+
...extensions,
|
|
56
54
|
});
|
|
57
55
|
const closeProvider = async () => {
|
|
58
56
|
observations = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emseepea/create-mongodb-backed-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Create an Em See Pea server with schema-enforced and schemaless MongoDB collections.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,12 +20,13 @@
|
|
|
20
20
|
"prepack": "npm run build:initializer"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@emseepea/
|
|
23
|
+
"@emseepea/feedback": "0.2.1",
|
|
24
|
+
"@emseepea/server": "0.7.0",
|
|
24
25
|
"ajv": "8.20.0",
|
|
25
26
|
"json-schema-to-ts": "3.1.1",
|
|
26
27
|
"mongodb": "7.6.0",
|
|
27
28
|
"zod": "4.4.3",
|
|
28
|
-
"@emseepea/testing": "0.
|
|
29
|
+
"@emseepea/testing": "0.9.4",
|
|
29
30
|
"@types/node": "24.13.3",
|
|
30
31
|
"typescript": "6.0.3",
|
|
31
32
|
"oxlint": "1.80.0"
|