@emseepea/create-progress-streaming-server 0.0.1 → 0.0.3
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 +46 -11
- package/{dist → initializer-dist}/template/package.json +6 -5
- package/{dist/template/src/server.ts → initializer-dist/template/src/capabilities/tool.roast-sample-batch.ts} +3 -20
- package/initializer-dist/template/src/server.ts +18 -0
- package/package.json +28 -13
- /package/{dist → initializer-dist}/LICENSE +0 -0
- /package/{dist → initializer-dist}/create.mjs +0 -0
- /package/{dist → initializer-dist}/template/README.md +0 -0
- /package/{dist → initializer-dist}/template/eval/meaning.test.mjs +0 -0
- /package/{dist → initializer-dist}/template/test/server.test.mjs +0 -0
- /package/{dist → initializer-dist}/template/tsconfig.json +0 -0
package/README.md
CHANGED
|
@@ -1,22 +1,57 @@
|
|
|
1
1
|
# `@emseepea/create-progress-streaming-server`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
The package builds its starter from the maintained
|
|
5
|
-
[progress streaming example](https://github.com/emseepea/emseepea/tree/main/examples/streaming-progress).
|
|
6
|
-
|
|
7
|
-
## Create the Project
|
|
8
|
-
|
|
9
|
-
This initializer is queued for the next pre-alpha release and is not yet
|
|
10
|
-
available from npm.
|
|
3
|
+
This directory is both the maintained example and its public npm initializer.
|
|
11
4
|
|
|
12
5
|
```sh
|
|
13
6
|
npm init @emseepea/progress-streaming-server@next -- my-server
|
|
14
7
|
```
|
|
15
8
|
|
|
9
|
+
<!-- generated-project-readme -->
|
|
10
|
+
|
|
11
|
+
## Streaming Progress Example
|
|
12
|
+
|
|
13
|
+
Choose this example when a tool takes long enough that people benefit from
|
|
14
|
+
seeing progress before the final answer.
|
|
15
|
+
|
|
16
|
+
The public tool reports progress during its request. A client can ask for
|
|
17
|
+
server-sent events (SSE), which carry progress over the same `POST` request.
|
|
18
|
+
Without that request, the tool returns one JSON response when it finishes.
|
|
19
|
+
|
|
20
|
+
## Run
|
|
21
|
+
|
|
22
|
+
From this directory:
|
|
23
|
+
|
|
16
24
|
```sh
|
|
17
|
-
cd my-server
|
|
18
25
|
npm install
|
|
19
|
-
npm
|
|
20
|
-
npm run lint
|
|
26
|
+
npm run build
|
|
21
27
|
npm start
|
|
22
28
|
```
|
|
29
|
+
|
|
30
|
+
The server listens on `http://127.0.0.1:3000/mcp` by default. Set `PORT` to
|
|
31
|
+
choose another port. This example starts locally and does not configure a proxy.
|
|
32
|
+
|
|
33
|
+
To adapt it for a public server, see
|
|
34
|
+
[Use Progress Behind a Proxy](https://github.com/emseepea/emseepea/blob/main/packages/framework/README.md#use-progress-behind-a-proxy).
|
|
35
|
+
That option is available in the current source, not yet in a published npm
|
|
36
|
+
release. It does not add saved sessions, replay, subscriptions, or recovery
|
|
37
|
+
after reconnecting.
|
|
38
|
+
|
|
39
|
+
## Check This Example
|
|
40
|
+
|
|
41
|
+
[Ordinary tests](test/) live in `test/`.
|
|
42
|
+
The [AI tool-choice and understanding test](eval/meaning.test.mjs) lives separately in `eval/`.
|
|
43
|
+
The commands below run each suite independently.
|
|
44
|
+
|
|
45
|
+
Run its build and progress-stream checks:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npm test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Check that Claude chooses the roast tool and keeps progress separate from the result:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
npm run test:llm
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
If Claude is not already signed in, run `claude auth login` first.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emseepea-starter",
|
|
3
3
|
"version": "0.0.0",
|
|
4
|
-
"
|
|
4
|
+
"description": "Create an Em See Pea server that streams tool progress.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
"test:llm:built": "emseepea-test eval",
|
|
14
14
|
"lint": "oxlint src test eval"
|
|
15
15
|
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@emseepea/server": "0.0.4",
|
|
18
|
-
"zod": "4.4.3"
|
|
19
|
-
},
|
|
20
16
|
"devDependencies": {
|
|
21
17
|
"@emseepea/testing": "0.2.1",
|
|
22
18
|
"@types/node": "24.13.3",
|
|
@@ -25,5 +21,10 @@
|
|
|
25
21
|
},
|
|
26
22
|
"engines": {
|
|
27
23
|
"node": ">=22"
|
|
24
|
+
},
|
|
25
|
+
"private": true,
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@emseepea/server": "0.2.1",
|
|
28
|
+
"zod": "4.4.3"
|
|
28
29
|
}
|
|
29
30
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { setTimeout as delay } from "node:timers/promises";
|
|
2
|
-
import {
|
|
2
|
+
import { defineStreamingTool, type CapabilityModuleFactory } from "@emseepea/server";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export default (() => defineStreamingTool({
|
|
6
6
|
name: "roast-sample-batch",
|
|
7
7
|
access: "public",
|
|
8
8
|
description: "Run a sample coffee-roasting batch with bounded progress.",
|
|
@@ -22,21 +22,4 @@ const roastBatch = defineStreamingTool({
|
|
|
22
22
|
const data = { batch, status: "complete" as const, roastedGrams: 820 as const, stages };
|
|
23
23
|
return { text: `${batch} completed at 820 roasted grams`, data };
|
|
24
24
|
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const running = await serveEmseepea(createEmseepea({
|
|
28
|
-
name: "emseepea-streaming-progress",
|
|
29
|
-
version: "0.0.0",
|
|
30
|
-
instructions: "Use roast-sample-batch for the sample roast run.",
|
|
31
|
-
tools: [roastBatch],
|
|
32
|
-
}), { port: Number.parseInt(process.env.PORT ?? "3000", 10) });
|
|
33
|
-
|
|
34
|
-
console.log(`Em See Pea streaming-progress example listening at ${running.url}`);
|
|
35
|
-
|
|
36
|
-
async function shutdown(): Promise<void> {
|
|
37
|
-
await running.close();
|
|
38
|
-
process.exitCode = 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
process.once("SIGINT", () => void shutdown());
|
|
42
|
-
process.once("SIGTERM", () => void shutdown());
|
|
25
|
+
})) satisfies CapabilityModuleFactory;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createEmseepea, discoverCapabilities, serveEmseepea } from "@emseepea/server";
|
|
2
|
+
|
|
3
|
+
const running = await serveEmseepea(createEmseepea({
|
|
4
|
+
name: "emseepea-streaming-progress",
|
|
5
|
+
version: "0.0.0",
|
|
6
|
+
instructions: "Use roast-sample-batch for the sample roast run.",
|
|
7
|
+
...await discoverCapabilities(new URL("./capabilities/", import.meta.url)),
|
|
8
|
+
}), { port: Number.parseInt(process.env.PORT ?? "3000", 10) });
|
|
9
|
+
|
|
10
|
+
console.log(`Em See Pea streaming-progress example listening at ${running.url}`);
|
|
11
|
+
|
|
12
|
+
async function shutdown(): Promise<void> {
|
|
13
|
+
await running.close();
|
|
14
|
+
process.exitCode = 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
process.once("SIGINT", () => void shutdown());
|
|
18
|
+
process.once("SIGTERM", () => void shutdown());
|
package/package.json
CHANGED
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emseepea/create-progress-streaming-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Create an Em See Pea server that streams tool progress.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"starterDependencies": ["@emseepea/server", "zod"],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "npm run build:example && npm run build:initializer",
|
|
10
|
+
"build:example": "tsc -p tsconfig.json",
|
|
11
|
+
"build:initializer": "node ../../scripts/build-initializer.mjs",
|
|
12
|
+
"start": "node dist/server.js",
|
|
13
|
+
"test": "npm run build && npm run test:built",
|
|
14
|
+
"test:built": "node --test test/*.test.mjs",
|
|
15
|
+
"test:llm": "npm run build && npm run test:llm:built",
|
|
16
|
+
"test:llm:built": "emseepea-test eval",
|
|
17
|
+
"lint": "oxlint src test eval",
|
|
18
|
+
"prepack": "npm run build:initializer"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@emseepea/server": "0.2.1",
|
|
22
|
+
"zod": "4.4.3",
|
|
23
|
+
"@emseepea/testing": "0.2.1",
|
|
24
|
+
"@types/node": "24.13.3",
|
|
25
|
+
"typescript": "6.0.3",
|
|
26
|
+
"oxlint": "1.80.0"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22"
|
|
10
30
|
},
|
|
31
|
+
"repository": { "type": "git", "url": "git+https://github.com/emseepea/emseepea.git", "directory": "examples/streaming-progress" },
|
|
11
32
|
"homepage": "https://emseepea.github.io/emseepea/examples/",
|
|
12
33
|
"bugs": "https://github.com/emseepea/emseepea/issues",
|
|
13
34
|
"publishConfig": { "access": "public", "provenance": true, "tag": "next" },
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"files": ["dist"],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "node ../../scripts/build-initializer.mjs",
|
|
19
|
-
"prepack": "npm run build"
|
|
20
|
-
},
|
|
21
|
-
"engines": { "node": ">=22" }
|
|
35
|
+
"bin": { "create-progress-streaming-server": "./initializer-dist/create.mjs" },
|
|
36
|
+
"files": ["initializer-dist"]
|
|
22
37
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|