@skein-js/fastify 0.6.3 → 0.7.0
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 +19 -0
- package/dist/index.js +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -51,6 +51,25 @@ await app.listen({ port: 3000 });
|
|
|
51
51
|
SSE responses take over the raw Node response (`reply.hijack()` + `reply.raw`) and stream the
|
|
52
52
|
pre-serialized frames the engine produced, tearing the run's subscription down on client disconnect.
|
|
53
53
|
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
- **`createFastifyServer(options): Promise<SkeinFastifyServer>`** — a standalone server;
|
|
57
|
+
`SkeinFastifyServer` = `{ app, runtime, listen(port?, host?), close() }`. `listen` defaults to port
|
|
58
|
+
`2024`, host `"localhost"`; `close()` stops the run worker then the HTTP server.
|
|
59
|
+
- **`skeinPlugin`** — a Fastify plugin: `await app.register(skeinPlugin, { prefix, ...options })`
|
|
60
|
+
mounts the protocol under `prefix`. Encapsulated, so skein's routes + CORS stay isolated from the
|
|
61
|
+
host app. Options: `SkeinPluginOptions` (an alias of `SkeinRuntimeOptions`); `prefix` is Fastify's
|
|
62
|
+
own `register` option, not part of the type.
|
|
63
|
+
- **`registerSkeinHandlers(app, handlers, options?)`** — the lower-level registration primitive
|
|
64
|
+
(`handlers` is a `ProtocolHandlers`; `options` is `HandlerRoutesOptions`), for callers wiring routes
|
|
65
|
+
onto their own handler table.
|
|
66
|
+
- **`SkeinRuntimeOptions`** — the shared seam every adapter accepts: common `{ logger?, cors?, warm? }`
|
|
67
|
+
**plus** either `{ config, importModule? }` (in-memory runtime from a `langgraph.json`) **or**
|
|
68
|
+
`{ deps }` (bring-your-own `ProtocolDeps`, e.g. from [`@skein-js/runtime`](../runtime)'s
|
|
69
|
+
`buildRuntime`). `warm: true` eagerly loads graphs at startup.
|
|
70
|
+
- **`skeinRoutes`** — the transport-neutral route table, re-exported for composing your own routing.
|
|
71
|
+
- Low-level mappers: `toProtocolRequest`, `sendProtocolResponse`, `sendErrorResponse`.
|
|
72
|
+
|
|
54
73
|
## Learn more
|
|
55
74
|
|
|
56
75
|
- [`@skein-js/express`](../server-express) — the reference adapter
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import Fastify from "fastify";
|
|
|
4
4
|
|
|
5
5
|
// src/skein-plugin.ts
|
|
6
6
|
import {
|
|
7
|
-
|
|
7
|
+
copyThreadIdIntoBody,
|
|
8
8
|
skeinRoutes
|
|
9
9
|
} from "@skein-js/agent-protocol";
|
|
10
10
|
import {
|
|
@@ -143,7 +143,7 @@ async function registerSkeinHandlers(fastify, handlers, options = {}) {
|
|
|
143
143
|
try {
|
|
144
144
|
const request = toProtocolRequest(req);
|
|
145
145
|
const response = await invoke(
|
|
146
|
-
binding.foldThreadIdIntoBody ?
|
|
146
|
+
binding.foldThreadIdIntoBody ? copyThreadIdIntoBody(request) : request
|
|
147
147
|
);
|
|
148
148
|
await sendProtocolResponse(response, reply);
|
|
149
149
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skein-js/fastify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Fastify adapter for skein-js — mount the Agent Protocol as a Fastify plugin.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Maina Wycliffe <wmmaina7@gmail.com>",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"node": ">=20"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@skein-js/agent-protocol": "0.
|
|
44
|
-
"@skein-js/
|
|
45
|
-
"@skein-js/
|
|
43
|
+
"@skein-js/agent-protocol": "0.7.0",
|
|
44
|
+
"@skein-js/server-kit": "0.7.0",
|
|
45
|
+
"@skein-js/core": "0.7.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@fastify/cors": ">=8.0.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@langchain/core": "^1.2.0",
|
|
60
60
|
"@langchain/langgraph": "^1.4.0",
|
|
61
61
|
"fastify": "^5.2.0",
|
|
62
|
-
"@skein-js/storage-memory": "0.
|
|
62
|
+
"@skein-js/storage-memory": "0.7.0"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|