@silkweave/nextjs 2.6.1 → 3.1.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 CHANGED
@@ -6,7 +6,7 @@ project them onto Next.js route handlers - **MCP tools** for agents and a
6
6
 
7
7
  This package is action-first and additive: it adds route files to an existing
8
8
  Next.js app, it doesn't restructure anything. Under the hood it wraps
9
- [`@silkweave/vercel`](../vercel) (MCP over Web-Standard Streamable HTTP) and
9
+ [`@silkweave/edge`](../edge) (MCP over Web-Standard Streamable HTTP) and
10
10
  [`@silkweave/trpc`](../trpc) (fetch handler), adding the Next.js glue -
11
11
  catch-all path normalization, ergonomic route factories, and end-to-end tRPC
12
12
  types.
package/build/index.d.mts CHANGED
@@ -98,7 +98,7 @@ declare function defineSilkweave<const Arr extends readonly Action[]>(options: D
98
98
  /**
99
99
  * Build the MCP route handlers for a single catch-all Next.js route file.
100
100
  *
101
- * Wires the actions through `@silkweave/vercel` (stateless MCP over Web Standard
101
+ * Wires the actions through `@silkweave/edge` (stateless MCP over Web Standard
102
102
  * Streamable HTTP) and wraps its handler with a prefix-stripping rewrite so the
103
103
  * transport, OAuth routes and protected-resource metadata all resolve from one
104
104
  * `app/<basePath>/[[...slug]]/route.ts` file.
@@ -123,7 +123,7 @@ declare function buildTrpcRoute(identity: SilkweaveOptions, actions: readonly Ac
123
123
  */
124
124
  declare function normalizeBasePath(basePath: string): string;
125
125
  /**
126
- * Rewrite a Web `Request`'s URL so the inner `@silkweave/vercel` MCP handler -
126
+ * Rewrite a Web `Request`'s URL so the inner `@silkweave/edge` MCP handler -
127
127
  * which matches absolute pathnames (`/mcp`, `/authorize`, `/.well-known/...`) -
128
128
  * sees canonical paths regardless of where the Next.js route is mounted.
129
129
  *
package/build/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { silkweave } from "@silkweave/core";
2
- import { vercel } from "@silkweave/vercel";
2
+ import { edge } from "@silkweave/edge";
3
3
  import { trpcFetch } from "@silkweave/trpc";
4
4
  //#region src/lib/stripPrefix.ts
5
5
  /**
@@ -12,7 +12,7 @@ function normalizeBasePath(basePath) {
12
12
  return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
13
13
  }
14
14
  /**
15
- * Rewrite a Web `Request`'s URL so the inner `@silkweave/vercel` MCP handler -
15
+ * Rewrite a Web `Request`'s URL so the inner `@silkweave/edge` MCP handler -
16
16
  * which matches absolute pathnames (`/mcp`, `/authorize`, `/.well-known/...`) -
17
17
  * sees canonical paths regardless of where the Next.js route is mounted.
18
18
  *
@@ -50,14 +50,14 @@ function rewriteRequestPath(request, basePath, fallback = "/mcp") {
50
50
  /**
51
51
  * Build the MCP route handlers for a single catch-all Next.js route file.
52
52
  *
53
- * Wires the actions through `@silkweave/vercel` (stateless MCP over Web Standard
53
+ * Wires the actions through `@silkweave/edge` (stateless MCP over Web Standard
54
54
  * Streamable HTTP) and wraps its handler with a prefix-stripping rewrite so the
55
55
  * transport, OAuth routes and protected-resource metadata all resolve from one
56
56
  * `app/<basePath>/[[...slug]]/route.ts` file.
57
57
  */
58
58
  function buildMcpRoute(identity, actions, options) {
59
59
  const basePath = normalizeBasePath(options.basePath);
60
- const { adapter, handler } = vercel({
60
+ const { adapter, handler } = edge({
61
61
  auth: options.auth,
62
62
  enableJsonResponse: options.enableJsonResponse
63
63
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/lib/stripPrefix.ts","../src/lib/mcpRoute.ts","../src/lib/trpcRoute.ts","../src/lib/defineSilkweave.ts"],"sourcesContent":["/**\n * Normalize a user-supplied mount path: ensure a single leading slash and no\n * trailing slash. `'api/mcp/'` -> `'/api/mcp'`, `'/'` -> `''`.\n */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/\\/+$/, '')\n if (trimmed === '' || trimmed === '/') { return '' }\n return trimmed.startsWith('/') ? trimmed : `/${trimmed}`\n}\n\n/**\n * Rewrite a Web `Request`'s URL so the inner `@silkweave/vercel` MCP handler -\n * which matches absolute pathnames (`/mcp`, `/authorize`, `/.well-known/...`) -\n * sees canonical paths regardless of where the Next.js route is mounted.\n *\n * Given `basePath = '/api/mcp'`:\n * `/api/mcp` -> `/mcp` (the transport root)\n * `/api/mcp/authorize` -> `/authorize`\n * `/api/mcp/.well-known/oauth-...` -> `/.well-known/oauth-...`\n *\n * The method, headers, body and abort signal are preserved. A streaming body\n * requires `duplex: 'half'` under Node's undici `fetch` implementation.\n */\nexport function rewriteRequestPath(request: Request, basePath: string, fallback = '/mcp'): Request {\n const base = normalizeBasePath(basePath)\n const url = new URL(request.url)\n\n let rest = url.pathname\n if (base !== '') {\n if (rest === base) {\n rest = fallback\n } else if (rest.startsWith(`${base}/`)) {\n rest = rest.slice(base.length)\n }\n }\n if (rest === '' || rest === '/') { rest = fallback }\n url.pathname = rest\n\n const init: RequestInit & { duplex?: 'half' } = {\n method: request.method,\n headers: request.headers,\n signal: request.signal\n }\n if (request.method !== 'GET' && request.method !== 'HEAD') {\n init.body = request.body\n init.duplex = 'half'\n }\n return new Request(url.toString(), init)\n}\n","import { Action, silkweave, SilkweaveOptions } from '@silkweave/core'\nimport { vercel } from '@silkweave/vercel'\nimport { McpRouteHandlers, McpRouteOptions } from '../types.js'\nimport { normalizeBasePath, rewriteRequestPath } from './stripPrefix.js'\n\n/**\n * Build the MCP route handlers for a single catch-all Next.js route file.\n *\n * Wires the actions through `@silkweave/vercel` (stateless MCP over Web Standard\n * Streamable HTTP) and wraps its handler with a prefix-stripping rewrite so the\n * transport, OAuth routes and protected-resource metadata all resolve from one\n * `app/<basePath>/[[...slug]]/route.ts` file.\n */\nexport function buildMcpRoute(\n identity: SilkweaveOptions,\n actions: readonly Action[],\n options: McpRouteOptions\n): McpRouteHandlers {\n const basePath = normalizeBasePath(options.basePath)\n const { adapter, handler } = vercel({\n auth: options.auth,\n enableJsonResponse: options.enableJsonResponse\n })\n\n // Resolve the adapter's `_ready` promise. The handler awaits it internally, so\n // we don't need to await here - a floating start is safe and avoids forcing a\n // top-level `await` into the consumer's route module.\n void silkweave(identity).actions(actions).adapter(adapter).start()\n\n const route = (request: Request): Promise<Response> => handler(rewriteRequestPath(request, basePath))\n\n return { GET: route, POST: route, DELETE: route, OPTIONS: route }\n}\n","import { Action, silkweave, SilkweaveOptions } from '@silkweave/core'\nimport { trpcFetch } from '@silkweave/trpc'\nimport { NextRouteHandler, TrpcRouteHandlers, TrpcRouteOptions } from '../types.js'\n\nconst CORS_HEADERS: Record<string, string> = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',\n 'Access-Control-Allow-Headers': '*',\n 'Access-Control-Max-Age': '86400'\n}\n\nfunction withCors(handler: NextRouteHandler): NextRouteHandler {\n return async (request) => {\n const response = await handler(request)\n const headers = new Headers(response.headers)\n for (const [key, value] of Object.entries(CORS_HEADERS)) { headers.set(key, value) }\n return new Response(response.body, { status: response.status, statusText: response.statusText, headers })\n }\n}\n\n/**\n * Build the tRPC route handlers for a `[trpc]` Next.js route file.\n *\n * Wires the actions through `@silkweave/trpc`'s fetch handler. tRPC strips the\n * `endpoint` prefix itself, so no URL rewriting is needed. CORS is opt-in\n * (`options.cors`) since a Next.js frontend hitting its own `/api/trpc` is\n * same-origin.\n */\nexport function buildTrpcRoute(\n identity: SilkweaveOptions,\n actions: readonly Action[],\n options: TrpcRouteOptions\n): TrpcRouteHandlers {\n const { adapter, GET, POST } = trpcFetch({ endpoint: options.endpoint, auth: options.auth })\n\n void silkweave(identity).actions(actions).adapter(adapter).start()\n\n const optionsHandler: NextRouteHandler = () =>\n Promise.resolve(new Response(null, { status: 204, headers: options.cors ? CORS_HEADERS : {} }))\n\n if (!options.cors) {\n return { GET, POST, OPTIONS: optionsHandler }\n }\n return { GET: withCors(GET), POST: withCors(POST), OPTIONS: optionsHandler }\n}\n","import { Action, Silkweave, SilkweaveOptions } from '@silkweave/core'\nimport type { InferTrpcRouter } from '@silkweave/trpc'\nimport { McpRouteHandlers, McpRouteOptions, TrpcRouteHandlers, TrpcRouteOptions } from '../types.js'\nimport { buildMcpRoute } from './mcpRoute.js'\nimport { buildTrpcRoute } from './trpcRoute.js'\n\n/** Maps the actions tuple into the `Record<name, Action>` shape `Silkweave` carries. */\ntype ActionsRecord<Arr extends readonly Action[]> = {\n [K in Arr[number] as K['name']]: K\n}\n\n/** The typed `Silkweave` instance equivalent to `silkweave(...).actions(arr)`. */\ntype AppServer<Arr extends readonly Action[]> = Silkweave<ActionsRecord<Arr>>\n\n/** Configuration for {@link defineSilkweave}: server identity + the action set. */\nexport type DefineSilkweaveOptions<Arr extends readonly Action[]> = SilkweaveOptions & {\n actions: Arr\n}\n\n/**\n * A Silkweave app projected onto Next.js App Router route handlers. Define it\n * once, then mount the surfaces you need from their respective route files.\n */\nexport interface SilkweaveApp<Arr extends readonly Action[]> {\n /** Build handlers for `app/<basePath>/[[...slug]]/route.ts` (MCP tools). */\n mcp(options: McpRouteOptions): McpRouteHandlers\n /** Build handlers for `app/<endpoint>/[trpc]/route.ts` (tRPC procedures). */\n trpc(options: TrpcRouteOptions): TrpcRouteHandlers\n /**\n * Type-only phantom for the tRPC client. Use as\n * `export type AppRouter = typeof app.Router`. Accessing the value at runtime\n * returns `undefined` - it exists purely to carry the inferred router type.\n */\n readonly Router: InferTrpcRouter<AppServer<Arr>>\n}\n\n/**\n * Define a Silkweave app from a single set of Actions and project it onto\n * Next.js App Router route handlers - MCP (for agents) and tRPC (for your\n * frontend) - from one source of truth.\n *\n * ```ts\n * // silkweave/server.ts\n * export const app = defineSilkweave({\n * name: 'my-app', description: '...', version: '1.0.0',\n * actions: [listUsers, getUser]\n * })\n * export type AppRouter = typeof app.Router\n * ```\n */\nexport function defineSilkweave<const Arr extends readonly Action[]>(\n options: DefineSilkweaveOptions<Arr>\n): SilkweaveApp<Arr> {\n const { actions, ...identity } = options\n\n return {\n mcp: (mcpOptions) => buildMcpRoute(identity, actions, mcpOptions),\n trpc: (trpcOptions) =>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E,MAAM,eAAuC;CAC3C,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CAChC,0BAA0B;CAC3B;AAED,SAAS,SAAS,SAA6C;AAC7D,QAAO,OAAO,YAAY;EACxB,MAAM,WAAW,MAAM,QAAQ,QAAQ;EACvC,MAAM,UAAU,IAAI,QAAQ,SAAS,QAAQ;AAC7C,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,aAAa,CAAI,SAAQ,IAAI,KAAK,MAAM;AAClF,SAAO,IAAI,SAAS,SAAS,MAAM;GAAE,QAAQ,SAAS;GAAQ,YAAY,SAAS;GAAY;GAAS,CAAC;;;;;;;;;;;AAY7G,SAAgB,eACd,UACA,SACA,SACmB;CACnB,MAAM,EAAE,SAAS,KAAK,SAAS,UAAU;EAAE,UAAU,QAAQ;EAAU,MAAM,QAAQ;EAAM,CAAC;AAEvF,WAAU,SAAS,CAAC,QAAQ,QAAQ,CAAC,QAAQ,QAAQ,CAAC,OAAO;CAElE,MAAM,uBACJ,QAAQ,QAAQ,IAAI,SAAS,MAAM;EAAE,QAAQ;EAAK,SAAS,QAAQ,OAAO,eAAe,EAAE;EAAE,CAAC,CAAC;AAEjG,KAAI,CAAC,QAAQ,KACX,QAAO;EAAE;EAAK;EAAM,SAAS;EAAgB;AAE/C,QAAO;EAAE,KAAK,SAAS,IAAI;EAAE,MAAM,SAAS,KAAK;EAAE,SAAS;EAAgB;;;;;;;;;;;;;;;;;;ACO9E,SAAgB,gBACd,SACmB;CACnB,MAAM,EAAE,SAAS,GAAG,aAAa;AAEjC,QAAO;EACL,MAAM,eAAe,cAAc,UAAU,SAAS,WAAW;EACjE,OAAO,gBAAgB,eAAe,UAAU,SAAS,YAAY;EACrE,QAAQ,KAAA;EACT"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/lib/stripPrefix.ts","../src/lib/mcpRoute.ts","../src/lib/trpcRoute.ts","../src/lib/defineSilkweave.ts"],"sourcesContent":["/**\n * Normalize a user-supplied mount path: ensure a single leading slash and no\n * trailing slash. `'api/mcp/'` -> `'/api/mcp'`, `'/'` -> `''`.\n */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/\\/+$/, '')\n if (trimmed === '' || trimmed === '/') { return '' }\n return trimmed.startsWith('/') ? trimmed : `/${trimmed}`\n}\n\n/**\n * Rewrite a Web `Request`'s URL so the inner `@silkweave/edge` MCP handler -\n * which matches absolute pathnames (`/mcp`, `/authorize`, `/.well-known/...`) -\n * sees canonical paths regardless of where the Next.js route is mounted.\n *\n * Given `basePath = '/api/mcp'`:\n * `/api/mcp` -> `/mcp` (the transport root)\n * `/api/mcp/authorize` -> `/authorize`\n * `/api/mcp/.well-known/oauth-...` -> `/.well-known/oauth-...`\n *\n * The method, headers, body and abort signal are preserved. A streaming body\n * requires `duplex: 'half'` under Node's undici `fetch` implementation.\n */\nexport function rewriteRequestPath(request: Request, basePath: string, fallback = '/mcp'): Request {\n const base = normalizeBasePath(basePath)\n const url = new URL(request.url)\n\n let rest = url.pathname\n if (base !== '') {\n if (rest === base) {\n rest = fallback\n } else if (rest.startsWith(`${base}/`)) {\n rest = rest.slice(base.length)\n }\n }\n if (rest === '' || rest === '/') { rest = fallback }\n url.pathname = rest\n\n const init: RequestInit & { duplex?: 'half' } = {\n method: request.method,\n headers: request.headers,\n signal: request.signal\n }\n if (request.method !== 'GET' && request.method !== 'HEAD') {\n init.body = request.body\n init.duplex = 'half'\n }\n return new Request(url.toString(), init)\n}\n","import { Action, silkweave, SilkweaveOptions } from '@silkweave/core'\nimport { edge } from '@silkweave/edge'\nimport { McpRouteHandlers, McpRouteOptions } from '../types.js'\nimport { normalizeBasePath, rewriteRequestPath } from './stripPrefix.js'\n\n/**\n * Build the MCP route handlers for a single catch-all Next.js route file.\n *\n * Wires the actions through `@silkweave/edge` (stateless MCP over Web Standard\n * Streamable HTTP) and wraps its handler with a prefix-stripping rewrite so the\n * transport, OAuth routes and protected-resource metadata all resolve from one\n * `app/<basePath>/[[...slug]]/route.ts` file.\n */\nexport function buildMcpRoute(\n identity: SilkweaveOptions,\n actions: readonly Action[],\n options: McpRouteOptions\n): McpRouteHandlers {\n const basePath = normalizeBasePath(options.basePath)\n const { adapter, handler } = edge({\n auth: options.auth,\n enableJsonResponse: options.enableJsonResponse\n })\n\n // Resolve the adapter's `_ready` promise. The handler awaits it internally, so\n // we don't need to await here - a floating start is safe and avoids forcing a\n // top-level `await` into the consumer's route module.\n void silkweave(identity).actions(actions).adapter(adapter).start()\n\n const route = (request: Request): Promise<Response> => handler(rewriteRequestPath(request, basePath))\n\n return { GET: route, POST: route, DELETE: route, OPTIONS: route }\n}\n","import { Action, silkweave, SilkweaveOptions } from '@silkweave/core'\nimport { trpcFetch } from '@silkweave/trpc'\nimport { NextRouteHandler, TrpcRouteHandlers, TrpcRouteOptions } from '../types.js'\n\nconst CORS_HEADERS: Record<string, string> = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',\n 'Access-Control-Allow-Headers': '*',\n 'Access-Control-Max-Age': '86400'\n}\n\nfunction withCors(handler: NextRouteHandler): NextRouteHandler {\n return async (request) => {\n const response = await handler(request)\n const headers = new Headers(response.headers)\n for (const [key, value] of Object.entries(CORS_HEADERS)) { headers.set(key, value) }\n return new Response(response.body, { status: response.status, statusText: response.statusText, headers })\n }\n}\n\n/**\n * Build the tRPC route handlers for a `[trpc]` Next.js route file.\n *\n * Wires the actions through `@silkweave/trpc`'s fetch handler. tRPC strips the\n * `endpoint` prefix itself, so no URL rewriting is needed. CORS is opt-in\n * (`options.cors`) since a Next.js frontend hitting its own `/api/trpc` is\n * same-origin.\n */\nexport function buildTrpcRoute(\n identity: SilkweaveOptions,\n actions: readonly Action[],\n options: TrpcRouteOptions\n): TrpcRouteHandlers {\n const { adapter, GET, POST } = trpcFetch({ endpoint: options.endpoint, auth: options.auth })\n\n void silkweave(identity).actions(actions).adapter(adapter).start()\n\n const optionsHandler: NextRouteHandler = () =>\n Promise.resolve(new Response(null, { status: 204, headers: options.cors ? CORS_HEADERS : {} }))\n\n if (!options.cors) {\n return { GET, POST, OPTIONS: optionsHandler }\n }\n return { GET: withCors(GET), POST: withCors(POST), OPTIONS: optionsHandler }\n}\n","import { Action, Silkweave, SilkweaveOptions } from '@silkweave/core'\nimport type { InferTrpcRouter } from '@silkweave/trpc'\nimport { McpRouteHandlers, McpRouteOptions, TrpcRouteHandlers, TrpcRouteOptions } from '../types.js'\nimport { buildMcpRoute } from './mcpRoute.js'\nimport { buildTrpcRoute } from './trpcRoute.js'\n\n/** Maps the actions tuple into the `Record<name, Action>` shape `Silkweave` carries. */\ntype ActionsRecord<Arr extends readonly Action[]> = {\n [K in Arr[number] as K['name']]: K\n}\n\n/** The typed `Silkweave` instance equivalent to `silkweave(...).actions(arr)`. */\ntype AppServer<Arr extends readonly Action[]> = Silkweave<ActionsRecord<Arr>>\n\n/** Configuration for {@link defineSilkweave}: server identity + the action set. */\nexport type DefineSilkweaveOptions<Arr extends readonly Action[]> = SilkweaveOptions & {\n actions: Arr\n}\n\n/**\n * A Silkweave app projected onto Next.js App Router route handlers. Define it\n * once, then mount the surfaces you need from their respective route files.\n */\nexport interface SilkweaveApp<Arr extends readonly Action[]> {\n /** Build handlers for `app/<basePath>/[[...slug]]/route.ts` (MCP tools). */\n mcp(options: McpRouteOptions): McpRouteHandlers\n /** Build handlers for `app/<endpoint>/[trpc]/route.ts` (tRPC procedures). */\n trpc(options: TrpcRouteOptions): TrpcRouteHandlers\n /**\n * Type-only phantom for the tRPC client. Use as\n * `export type AppRouter = typeof app.Router`. Accessing the value at runtime\n * returns `undefined` - it exists purely to carry the inferred router type.\n */\n readonly Router: InferTrpcRouter<AppServer<Arr>>\n}\n\n/**\n * Define a Silkweave app from a single set of Actions and project it onto\n * Next.js App Router route handlers - MCP (for agents) and tRPC (for your\n * frontend) - from one source of truth.\n *\n * ```ts\n * // silkweave/server.ts\n * export const app = defineSilkweave({\n * name: 'my-app', description: '...', version: '1.0.0',\n * actions: [listUsers, getUser]\n * })\n * export type AppRouter = typeof app.Router\n * ```\n */\nexport function defineSilkweave<const Arr extends readonly Action[]>(\n options: DefineSilkweaveOptions<Arr>\n): SilkweaveApp<Arr> {\n const { actions, ...identity } = options\n\n return {\n mcp: (mcpOptions) => buildMcpRoute(identity, actions, mcpOptions),\n trpc: (trpcOptions) => buildTrpcRoute(identity, actions, trpcOptions),\n Router: undefined as unknown as InferTrpcRouter<AppServer<Arr>>\n }\n}\n"],"mappings":";;;;;;;;AAIA,SAAgB,kBAAkB,UAA0B;CAC1D,MAAM,UAAU,SAAS,MAAM,CAAC,QAAQ,QAAQ,GAAG;AACnD,KAAI,YAAY,MAAM,YAAY,IAAO,QAAO;AAChD,QAAO,QAAQ,WAAW,IAAI,GAAG,UAAU,IAAI;;;;;;;;;;;;;;;AAgBjD,SAAgB,mBAAmB,SAAkB,UAAkB,WAAW,QAAiB;CACjG,MAAM,OAAO,kBAAkB,SAAS;CACxC,MAAM,MAAM,IAAI,IAAI,QAAQ,IAAI;CAEhC,IAAI,OAAO,IAAI;AACf,KAAI,SAAS;MACP,SAAS,KACX,QAAO;WACE,KAAK,WAAW,GAAG,KAAK,GAAG,CACpC,QAAO,KAAK,MAAM,KAAK,OAAO;;AAGlC,KAAI,SAAS,MAAM,SAAS,IAAO,QAAO;AAC1C,KAAI,WAAW;CAEf,MAAM,OAA0C;EAC9C,QAAQ,QAAQ;EAChB,SAAS,QAAQ;EACjB,QAAQ,QAAQ;EACjB;AACD,KAAI,QAAQ,WAAW,SAAS,QAAQ,WAAW,QAAQ;AACzD,OAAK,OAAO,QAAQ;AACpB,OAAK,SAAS;;AAEhB,QAAO,IAAI,QAAQ,IAAI,UAAU,EAAE,KAAK;;;;;;;;;;;;AClC1C,SAAgB,cACd,UACA,SACA,SACkB;CAClB,MAAM,WAAW,kBAAkB,QAAQ,SAAS;CACpD,MAAM,EAAE,SAAS,YAAY,KAAK;EAChC,MAAM,QAAQ;EACd,oBAAoB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AAS,WAAW;EACjE,OAAO,gBAAgB,eAAe,UAAU,SAAS,YAAY;EACrE,QAAQ,KAAA;EACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silkweave/nextjs",
3
- "version": "2.6.1",
3
+ "version": "3.1.0",
4
4
  "description": "Silkweave Next.js App Router Adapter",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.silkweave.dev",
@@ -28,10 +28,10 @@
28
28
  "dependencies": {
29
29
  "@trpc/server": "^11.7.1",
30
30
  "zod": "^3.25.0",
31
- "@silkweave/core": "2.6.1",
32
- "@silkweave/trpc": "2.6.1",
33
- "@silkweave/auth": "2.6.1",
34
- "@silkweave/vercel": "2.6.1"
31
+ "@silkweave/core": "3.1.0",
32
+ "@silkweave/edge": "3.1.0",
33
+ "@silkweave/auth": "3.1.0",
34
+ "@silkweave/trpc": "3.1.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@eslint/js": "^10.0.1",