mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
f13f8865a8
Add a zodState() helper that attaches a lazy `~standard.jsonSchema.input` to a zod schema so LangGraph's StateSchema.getJsonSchema() emits the field into the graph's output_schema. Without it, zod v4 fields carry `~standard.validate` + `vendor` only, `isStandardJSONSchema` returns false, and the field is silently dropped from output_schema — which in turn causes the AG-UI LangGraphAgent proxy to filter the value out of STATE_SNAPSHOT events on the wire, so the frontend never sees it even though the underlying thread state has the data. Apply zodState to the middleware's own `copilotkit` state field so it surfaces in output_schema and export it for demos to use on custom state fields (todos, documents, etc.). Uses `z.toJSONSchema` when available (zod v4 subpath) and falls back to an empty object, which is sufficient to make langgraph-api include the key in output_schema.
51 lines
943 B
Docker
51 lines
943 B
Docker
# Dockerfile for Next.js App
|
|
FROM node:22-alpine AS base
|
|
|
|
# Install dependencies only when needed
|
|
FROM base AS deps
|
|
RUN apk add --no-cache libc6-compat
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install --ignore-scripts
|
|
|
|
# Build the application
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
|
|
# Copy dependencies from deps stage
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the Next.js app
|
|
RUN npx next build
|
|
|
|
# Production image
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
RUN addgroup --system --gid 1001 nodejs
|
|
RUN adduser --system --uid 1001 nextjs
|
|
|
|
# Copy built application
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
CMD ["node", "server.js"]
|