@agentnext/next 0.1.2 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +107 -25
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,25 +1,107 @@
1
- # AgentNext Next
2
-
3
- Server-side and App Router integration helpers for AgentNext in Next.js.
4
-
5
- ## Overview
6
- Add AgentNext service integration to Next.js apps with runtime-aware server execution and app-router patterns.
7
-
8
- ## Features
9
- - Next.js runtime helpers
10
- - Server-side execution hooks
11
- - Auth-aware orchestration support
12
-
13
- ## Installation
14
- ```bash
15
- npm install @agentnext/next @agentnext/core
16
- ```
17
-
18
- ## Usage
19
- ```ts
20
- import { withAgentNext } from "@agentnext/next";
21
-
22
- export default withAgentNext(async function Page() {
23
- return <div>AgentNext + Next.js</div>;
24
- });
25
- ```
1
+ # @agentnext/next
2
+
3
+ Next.js integration for AgentNext wrap your `next.config` with AgentKit support for App Router projects.
4
+
5
+ ## Features
6
+
7
+ - `withAgentKit` — a `next.config` wrapper that extends the webpack pipeline for AgentKit compatibility
8
+ - App Router and Pages Router compatible
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @agentnext/next @agentnext/core
14
+ ```
15
+
16
+ > **Peer dependencies:** `next` ≥ 14
17
+
18
+ ## Usage
19
+
20
+ ### Configure `next.config`
21
+
22
+ Wrap your existing Next.js config with `withAgentKit`. It is safe to compose with other wrappers:
23
+
24
+ ```ts
25
+ // next.config.ts
26
+ import { withAgentKit } from "@agentnext/next";
27
+
28
+ const nextConfig = {
29
+ // your existing Next.js options
30
+ };
31
+
32
+ export default withAgentKit(nextConfig);
33
+ ```
34
+
35
+ Or in CommonJS:
36
+
37
+ ```js
38
+ // next.config.js
39
+ const { withAgentKit } = require("@agentnext/next");
40
+
41
+ module.exports = withAgentKit({
42
+ // your existing Next.js options
43
+ });
44
+ ```
45
+
46
+ ### Full Next.js + AgentNext setup
47
+
48
+ Combine `withAgentKit` in config with `@agentnext/react` bindings in your layout:
49
+
50
+ ```tsx
51
+ // app/layout.tsx
52
+ import { AgentProvider } from "@agentnext/react";
53
+
54
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
55
+ return (
56
+ <html lang="en">
57
+ <body>
58
+ <AgentProvider>{children}</AgentProvider>
59
+ </body>
60
+ </html>
61
+ );
62
+ }
63
+ ```
64
+
65
+ ```tsx
66
+ // app/shop/page.tsx
67
+ "use client";
68
+ import { z } from "zod";
69
+ import { action } from "@agentnext/core";
70
+ import { useAgentAction } from "@agentnext/react";
71
+
72
+ const checkout = action({
73
+ name: "checkout",
74
+ description: "Initiates the checkout flow for the current cart.",
75
+ input: z.object({ cartId: z.string() }),
76
+ permissions: { authentication: true, confirmation: true },
77
+ execute: async ({ cartId }) => {
78
+ const order = await api.checkout(cartId);
79
+ return order;
80
+ },
81
+ });
82
+
83
+ export default function ShopPage() {
84
+ useAgentAction(checkout);
85
+ return <div>Shop</div>;
86
+ }
87
+ ```
88
+
89
+ ### Composing with other config wrappers
90
+
91
+ `withAgentKit` forwards any custom `webpack` function from your config, so it composes safely with other wrappers like `next-transpile-modules`:
92
+
93
+ ```ts
94
+ import { withAgentKit } from "@agentnext/next";
95
+
96
+ export default withAgentKit(
97
+ withSomeOtherPlugin({
98
+ // config
99
+ })
100
+ );
101
+ ```
102
+
103
+ ## API Reference
104
+
105
+ | Export | Description |
106
+ | --------------- | -------------------------------------------------------- |
107
+ | `withAgentKit(nextConfig?)` | Wraps a Next.js config object, extending webpack for AgentKit. Returns a new config object. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentnext/next",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Next.js adapter for AgentNext — App Router integration, server execution, auth propagation",
5
5
  "license": "MIT",
6
6
  "author": "AgentNext",
@@ -35,7 +35,7 @@
35
35
  "prepublishOnly": "npm run build"
36
36
  },
37
37
  "dependencies": {
38
- "@agentnext/core": "^0.1.2"
38
+ "@agentnext/core": "^0.1.3"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "next": "^14.0.0 || ^15.0.0"