feat: add @aixyz/next — zero-config Next.js App Router adapter for AixyzApp#285
feat: add @aixyz/next — zero-config Next.js App Router adapter for AixyzApp#285
@aixyz/next — zero-config Next.js App Router adapter for AixyzApp#285Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
…yzApp Co-authored-by: fuxingloh <4266087+fuxingloh@users.noreply.github.com>
@aixyz/next — Next.js App Router adapter for AixyzApp
|
@copilot this is not magical enough. Can you improve the implementation. |
Co-authored-by: fuxingloh <4266087+fuxingloh@users.noreply.github.com>
Updated in 89aa4c0. The package now exposes a high-level // app/api/[[...route]]/route.ts
import { createNextHandler } from "@aixyz/next";
import * as agent from "../../agent";
import * as weatherTool from "../../tools/weather";
export const { GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS } = createNextHandler({
agent,
tools: [{ name: "weather", exports: weatherTool }],
});Internally it auto-creates Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@aixyz/next — Next.js App Router adapter for AixyzApp@aixyz/next — magical Next.js App Router adapter for AixyzApp
|
It should be as simple as this:
|
…ig.ts Co-authored-by: fuxingloh <4266087+fuxingloh@users.noreply.github.com>
…cwd→dir Co-authored-by: fuxingloh <4266087+fuxingloh@users.noreply.github.com>
Done in 402b4b3. The only thing needed in a Next.js project is now: // next.config.ts
import { withAixyzConfig } from "@aixyz/next";
export default withAixyzConfig({});
|
@aixyz/next — magical Next.js App Router adapter for AixyzApp@aixyz/next — zero-config Next.js App Router adapter for AixyzApp
Adds a new
@aixyz/nextpackage that wiresAixyzAppinto Next.js App Router Route Handlers. BecauseAixyzApp.fetchalready speaks web-standardRequest/Response, no request/response conversion is needed.New package:
packages/aixyz-nextZero-config API:
withAixyzConfig(nextConfig)✨The primary entry point. Add it to
next.config.ts— that's the only change needed.withAixyzConfigauto-scans./app/agent.tsand./app/tools/*.ts, wires up all plugins (A2APlugin,MCPPlugin,IndexPagePlugin) and the default x402 facilitator automatically, and generates the route handler on each build. On first run it also auto-createsapp/api/[[...route]]/route.tswith a single stable re-export line (safe to commit).That's it — no route file imports, no plugin wiring, nothing else. The auto-created
app/api/[[...route]]/route.tslooks like this:How it works internally:
options.dir(the real Next.js project root) is used to scan./app/agent.tsand./app/tools/*.ts.next/cache/aixyz/route.mjswith all discovered imports wired intocreateNextHandler@aixyz/next/routeto that generated file_intools/are excluded (mirrors the CLI convention)Mid-level API:
createNextHandler(options)For cases where you want to pass agent/tool modules explicitly rather than relying on filesystem scanning.
Plugins are wired up automatically and the app lazy-initializes on the first request (cold-start friendly for Next.js serverless functions).
Low-level API:
toNextRouteHandler(app)Escape-hatch for users who need full manual control over the
AixyzAppsetup (custom plugins, custom facilitators, etc.).@aixyz/next/routeplaceholderroute.tsis a TypeScript placeholder that provides editor types forimport from "@aixyz/next/route". At build time it is replaced by the webpack alias set up bywithAixyzConfig. WithoutwithAixyzConfigit throws a helpful error pointing to the docs.Package details
aixyz(workspace),next >=14,ai ^6(optional)@aixyz/configadded todevDependenciessomock.moduleresolves correctly across workspace boundaries in tests./routeadded to packageexportsmapwithAixyzConfig,ensureRouteFile,generateAixyzRoute,createNextHandler, andtoNextRouteHandler📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.