@skein-js/nextjs 0.6.3 → 0.8.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.
Files changed (3) hide show
  1. package/README.md +18 -0
  2. package/dist/index.js +10 -4
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -57,6 +57,24 @@ The background run worker and the in-memory driver need a **long-lived Node proc
57
57
  [Redis queue](../runtime-redis) + [Postgres store](../storage-postgres) (pass `{ deps }` from
58
58
  [`@skein-js/runtime`](../runtime)'s `buildRuntime`) so state and runs don't depend on one process.
59
59
 
60
+ ## API
61
+
62
+ - **`createSkeinRouteHandlers(options): SkeinRouteHandlers`** — App Router (recommended); returns
63
+ `{ GET, POST, PUT, PATCH, DELETE, OPTIONS }` to re-export from `app/<base>/[...path]/route.ts`.
64
+ - **`createSkeinPagesHandler(options): SkeinPagesHandler`** — Pages Router; the default export for
65
+ `pages/api/[...path].ts`.
66
+ - Both accept `SkeinRouteHandlerOptions` / `SkeinPagesHandlerOptions`: the shared
67
+ `{ config, importModule? } | { deps }` seam **plus** an optional `cors` (off by default) and a
68
+ `basePath` (defaults to `/api`, matching the mount). `deps` comes from
69
+ [`@skein-js/runtime`](../runtime)'s `buildRuntime` for production Postgres/Redis.
70
+ - **`getSkeinRuntime(options): Promise<ResolvedProtocolRuntime>`** — the memoized runtime accessor
71
+ shared by both routers (survives dev module reloads); its `.runtime` is the `ProtocolRuntime`
72
+ (assistants, handlers, worker).
73
+ - **`SkeinRuntimeOptions`** — the shared runtime-resolution option shape, re-exported for typing your
74
+ own wrappers.
75
+ - Low-level serializers: `toWebResponse` / `webErrorResponse` (Web `Response`), plus
76
+ `sendNodeResponse` / `sendNodeError` (re-exported from [`@skein-js/server-kit`](../server-kit)).
77
+
60
78
  ## Learn more
61
79
 
62
80
  - [`@skein-js/express`](../server-express) — the reference adapter
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  // src/create-route-handlers.ts
2
- import { foldThreadId, matchSkeinRoute } from "@skein-js/agent-protocol";
2
+ import {
3
+ copyThreadIdIntoBody,
4
+ matchSkeinRoute
5
+ } from "@skein-js/agent-protocol";
3
6
  import { SkeinHttpError } from "@skein-js/core";
4
7
 
5
8
  // src/runtime-singleton.ts
@@ -175,7 +178,7 @@ function createSkeinRouteHandlers(options) {
175
178
  const request_ = await toProtocolRequest(request, url, skeinPathname, match.params);
176
179
  const invoke = resolved.runtime.handlers[match.binding.handler];
177
180
  const response = await invoke(
178
- match.binding.foldThreadIdIntoBody ? foldThreadId(request_) : request_
181
+ match.binding.foldThreadIdIntoBody ? copyThreadIdIntoBody(request_) : request_
179
182
  );
180
183
  return toWebResponse(response, extraHeaders);
181
184
  } catch (error) {
@@ -193,7 +196,10 @@ function createSkeinRouteHandlers(options) {
193
196
  }
194
197
 
195
198
  // src/create-pages-handler.ts
196
- import { foldThreadId as foldThreadId2, matchSkeinRoute as matchSkeinRoute2 } from "@skein-js/agent-protocol";
199
+ import {
200
+ copyThreadIdIntoBody as copyThreadIdIntoBody2,
201
+ matchSkeinRoute as matchSkeinRoute2
202
+ } from "@skein-js/agent-protocol";
197
203
  import {
198
204
  applyNodeCors,
199
205
  sendNodeError,
@@ -269,7 +275,7 @@ function createSkeinPagesHandler(options) {
269
275
  };
270
276
  const invoke = resolved.runtime.handlers[match.binding.handler];
271
277
  const response = await invoke(
272
- match.binding.foldThreadIdIntoBody ? foldThreadId2(request) : request
278
+ match.binding.foldThreadIdIntoBody ? copyThreadIdIntoBody2(request) : request
273
279
  );
274
280
  await sendNodeResponse(response, res);
275
281
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skein-js/nextjs",
3
- "version": "0.6.3",
3
+ "version": "0.8.0",
4
4
  "description": "Next.js adapter for skein-js — serve the Agent Protocol from App Router or Pages Router API routes.",
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.6.3",
44
- "@skein-js/core": "0.6.3",
45
- "@skein-js/server-kit": "0.6.3"
43
+ "@skein-js/agent-protocol": "0.8.0",
44
+ "@skein-js/server-kit": "0.8.0",
45
+ "@skein-js/core": "0.8.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@langchain/langgraph": "^1.4.0",
@@ -51,7 +51,7 @@
51
51
  "devDependencies": {
52
52
  "@langchain/core": "^1.2.0",
53
53
  "@langchain/langgraph": "^1.4.0",
54
- "@skein-js/storage-memory": "0.6.3"
54
+ "@skein-js/storage-memory": "0.8.0"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"