@emseepea/create-api-backed-server 0.0.15 → 0.0.18
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
|
@@ -81,6 +81,13 @@ npm start
|
|
|
81
81
|
|
|
82
82
|
The endpoint is `http://127.0.0.1:3000/mcp`.
|
|
83
83
|
|
|
84
|
+
## Add Feedback
|
|
85
|
+
|
|
86
|
+
Install `@emseepea/feedback` when this server needs a detailed one-way
|
|
87
|
+
observation or a durable support conversation. Pass its tools through the
|
|
88
|
+
application factory's `additionalTools` option. Choose PostgreSQL, Firestore,
|
|
89
|
+
GitHub Issues, or Zendesk in the [feedback guide](../../packages/feedback/README.md).
|
|
90
|
+
|
|
84
91
|
## Check This Example
|
|
85
92
|
|
|
86
93
|
[Ordinary tests](test/) live in `test/`.
|
|
@@ -62,6 +62,13 @@ npm start
|
|
|
62
62
|
|
|
63
63
|
The endpoint is `http://127.0.0.1:3000/mcp`.
|
|
64
64
|
|
|
65
|
+
## Add Feedback
|
|
66
|
+
|
|
67
|
+
Install `@emseepea/feedback` when this server needs a detailed one-way
|
|
68
|
+
observation or a durable support conversation. Pass its tools through the
|
|
69
|
+
application factory's `additionalTools` option. Choose PostgreSQL, Firestore,
|
|
70
|
+
GitHub Issues, or Zendesk in the [feedback guide](../../packages/feedback/README.md).
|
|
71
|
+
|
|
65
72
|
## Check This Example
|
|
66
73
|
|
|
67
74
|
[Ordinary tests](test/) live in `test/`.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import test from "node:test";
|
|
2
2
|
import {
|
|
3
3
|
assertNoToolCalls,
|
|
4
|
+
assertNoNegativeFeedback,
|
|
4
5
|
assertResponseContains,
|
|
5
6
|
assertResponseMeaning,
|
|
6
|
-
|
|
7
|
+
assertToolCallsWithOptionalFeedback,
|
|
7
8
|
createConversation,
|
|
8
9
|
} from "@emseepea/testing/semantic";
|
|
9
10
|
|
|
@@ -20,7 +21,7 @@ test("searches once and remembers the common name for a follow-up", async (t) =>
|
|
|
20
21
|
"and does that count estimate the wild population?",
|
|
21
22
|
);
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
await assertToolCallsWithOptionalFeedback(search, [{
|
|
24
25
|
name: "search-pea-taxa",
|
|
25
26
|
arguments: { query: "pea" },
|
|
26
27
|
}]);
|
|
@@ -35,4 +36,5 @@ test("searches once and remembers the common name for a follow-up", async (t) =>
|
|
|
35
36
|
const followUp = await chat.send("What was its common name?");
|
|
36
37
|
assertNoToolCalls(followUp);
|
|
37
38
|
assertResponseContains(followUp, "Common Pea");
|
|
39
|
+
assertNoNegativeFeedback(search, followUp);
|
|
38
40
|
});
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"lint": "oxlint src test eval test-support"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@emseepea/
|
|
17
|
+
"@emseepea/feedback": "0.2.0",
|
|
18
|
+
"@emseepea/testing": "0.9.3",
|
|
18
19
|
"@modelcontextprotocol/client": "2.0.0",
|
|
19
20
|
"@types/node": "24.13.3",
|
|
20
21
|
"typescript": "6.0.3",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
},
|
|
26
27
|
"private": true,
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@emseepea/server": "0.
|
|
29
|
+
"@emseepea/server": "0.6.1",
|
|
29
30
|
"zod": "4.4.3"
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { serveEmseepea } from "@emseepea/server";
|
|
3
|
+
import { defineFeedbackSubmission } from "@emseepea/feedback";
|
|
3
4
|
import { createBackendExample } from "../dist/app.js";
|
|
4
5
|
import { inaturalistFixture } from "./inaturalist-fixture.mjs";
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
+
const client = {
|
|
7
8
|
async get({ pathname, searchParams }) {
|
|
8
9
|
assert.equal(pathname, "/v1/taxa");
|
|
9
10
|
const { q, ...options } = searchParams;
|
|
@@ -11,7 +12,12 @@ const app = await createBackendExample({
|
|
|
11
12
|
assert.deepEqual(options, { rank: "species", per_page: "5" });
|
|
12
13
|
return inaturalistFixture;
|
|
13
14
|
},
|
|
15
|
+
};
|
|
16
|
+
const feedback = defineFeedbackSubmission({
|
|
17
|
+
access: "public",
|
|
18
|
+
backend: { submit: () => ({ id: crypto.randomUUID(), recordedAt: new Date().toISOString() }) },
|
|
14
19
|
});
|
|
20
|
+
const app = await createBackendExample(client, { additionalTools: [feedback] });
|
|
15
21
|
const running = await serveEmseepea(app, { port: 0 });
|
|
16
22
|
|
|
17
23
|
console.log(`Em See Pea API-backed fixture listening at ${running.url}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emseepea/create-api-backed-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "Create an Em See Pea server backed by a public web API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
"prepack": "npm run build:initializer"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@emseepea/
|
|
21
|
+
"@emseepea/feedback": "0.2.0",
|
|
22
|
+
"@emseepea/server": "0.6.1",
|
|
22
23
|
"zod": "4.4.3",
|
|
23
|
-
"@emseepea/testing": "0.
|
|
24
|
+
"@emseepea/testing": "0.9.3",
|
|
24
25
|
"@modelcontextprotocol/client": "2.0.0",
|
|
25
26
|
"@types/node": "24.13.3",
|
|
26
27
|
"typescript": "6.0.3",
|