Skip to content

Migrate to AI SDK v7 and update Fal provider integration#13

Open
thirdbase1 wants to merge 39 commits into
AFK-surf:masterfrom
thirdbase1:master
Open

Migrate to AI SDK v7 and update Fal provider integration#13
thirdbase1 wants to merge 39 commits into
AFK-surf:masterfrom
thirdbase1:master

Conversation

@thirdbase1

Copy link
Copy Markdown

convert Fal provider to @ai-sdk/fal (AI SDK 7)
migrate AI SDK v5 → v7 (Vercel AI SDK 7)

- Bump ai to ^7.0.11, @ai-sdk/openai to ^4.0.5, @ai-sdk/anthropic to ^4.0.5,
  @ai-sdk/google to ^4.0.6, @ai-sdk/google-vertex to ^5.0.8,
  @ai-sdk/openai-compatible to ^3.0.3, @ai-sdk/perplexity to ^4.0.4

Breaking changes addressed:
- Rename CoreAssistantMessage/CoreUserMessage → AssistantModelMessage/UserModelMessage
- Rename experimental_generateImage → generateImage (direct export)
- Rename stepCountIs → isStepCount
- Rename fullStream → stream (streamText result property)
- Rename ToolCallOptions → ToolExecutionOptions (@ai-sdk/provider-utils)
- Rename textEmbeddingModel → embeddingModel (Google provider)
- Fix reasoningTokens → outputTokenDetails.reasoningTokens (nested path)
- Fix handleFinish signature: Promise → PromiseLike<LanguageModelUsage>
- Fix extractUsage to support both v5 and v7 usage shapes
- Fix isReasoningModel bug: && → || (was always false)
- Replace @fal-ai/serverless-client with @ai-sdk/fal
- Use generateImage() from ai core for image generation
- Use fal.image() model factory for model instantiation
- Pass LoRA/controlNet options via providerOptions.fal
- Update model IDs to include fal-ai/ prefix (required by @ai-sdk/fal)
- Keep raw HTTP fallback for text output (Fal text APIs don't fit AI SDK pattern)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6de3aea500

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/backend/server/package.json Outdated
"@aws-sdk/s3-request-presigner": "^3.779.0",
"@e2b/code-interpreter": "^1.5.1",
"@fal-ai/serverless-client": "^0.15.0",
"@ai-sdk/fal": "^3.0.4",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Commit the updated Yarn lockfile

This manifest now depends on the new AI SDK/Fal packages, but the root yarn.lock in this commit still records @afk/server with ai@^5.0.10, the old @ai-sdk/* versions, and @fal-ai/serverless-client instead of @ai-sdk/fal. In Yarn 4 immutable installs, CI/deploys will either reject the install because the lockfile would change or run with the old dependency graph, so the migrated imports such as @ai-sdk/fal will not be available.

Useful? React with 👍 / 👎.

override readonly models = [
{
id: 'flux-1/schnell',
id: 'fal-ai/flux/schnell',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve compatibility for existing Fal model ids

Renaming the registered Fal ids to the fal-ai/... form without updating stored/configured model ids makes provider resolution fail for existing image flows: findValidModel matches modelId by exact string, while the repo still seeds/configures image models as flux-1/schnell and workflow prompts as lora/image-to-image / workflowutils/teed. In those sessions or workflows, getProvider({ modelId }) returns no Fal provider and image generation fails before any request is sent.

Useful? React with 👍 / 👎.

thirdbase1 and others added 9 commits July 2, 2026 09:13
- Add listAllModels() to CopilotProviderFactory to expose all registered models
- Add listCopilotModels GraphQL query returning provider, modelId, capabilities
- Replace hardcoded tempModels[] in frontend with dynamic fetch from GraphQL API
- Frontend now auto-discovers all configured provider models at runtime
- Shows provider icons next to each model in the selector
- Falls back to static list if API unavailable

Oracle: kept as-is — no AI SDK provider exists for OCI (oracle cloud).
Morph: already uses @ai-sdk/openai-compatible (AI SDK package).
- Add VERCEL_OIDC_TOKEN fallback for AI Gateway auth on image-edit endpoint
- Replace e2b sandbox with @vercel/sandbox: one persistent, stateful
  sandbox per chat (keyed by sessionId)
- Add a custom stdlib-only Python kernel server inside the sandbox for
  real notebook-style persistence (globals survive across calls) and
  automatic rich-output capture (last expression + open matplotlib figures)
- Update system prompt tool guidance to match the new persistent kernel
  behavior
- Dockerfile.vercel: adapted from .docker/Dockerfile, wires $PORT into
  OPEN_AGENT_SERVER_PORT for Vercel's Fluid compute container deploy
- vercel.json: declares the app as a Vercel Service (Phase 1: single service)
- entry.md: full deployment plan verified against live Vercel docs
  (Dockerfile on Vercel, Vercel Functions container images, Vercel Services
  + service bindings, 5GB functions, Vercel Connect, Sandbox persistence),
  covering repo architecture, phased deploy plan, and honest kernel
  capabilities/limitations
Confirmed via docs: Upstash (like Redis Cluster) only supports db 0, so the
old db-index offset trick (cache/session/socketio/queue on db+0/2/3/4)
doesn't work there.

- base/redis/instances.ts: cache/session/socketio clients now use ioredis
  keyPrefix instead of db offset (works on any Redis backend). Queue client
  gets no keyPrefix per BullMQ's own docs warning against it — relies on
  BullMQ's existing prefix option instead, which was already the real
  isolation mechanism for queues.
- base/redis/config.ts: add tls config (REDIS_ENABLE_TLS) — Upstash is
  TLS-only.
- base/redis/url.ts: new — auto-detect REDIS_URL/KV_URL/UPSTASH_REDIS_URL
  and parse host/port/user/pass/tls from it, falling back to the existing
  discrete REDIS_SERVER_* env vars for self-hosted setups.
- entry.md: document what changed and why, plus flag storage/Postgres as
  separate Vercel-native swap candidates needing explicit confirmation
  before touching (not drop-in like Redis was).
- schema.prisma: add directUrl (Prisma's official Supabase pattern — pooled
  DATABASE_URL via Supavisor/pgbouncer for runtime, direct DIRECT_URL for
  Prisma CLI migrate/introspect). PrismaFactory already only relies on
  schema-level env() bindings, no code change needed beyond the schema.
- .docker/docker-compose.yml: add DIRECT_URL alongside DATABASE_URL for
  local dev (same value, no pooler to route around locally).
- entry.md: full audited env var list (grepped from the actual
  defineModuleConfig declarations, not guessed), clear callout of what is
  NOT an env var today (OAuth client secrets, AI provider keys, object
  storage config are runtime DB-backed, not env-driven — and local
  filesystem blob storage won't survive on Vercel), Supabase Postgres
  section (verified against Prisma's own docs), and an honest writeup of
  why swapping the built-in auth system to Supabase Auth was NOT attempted
  in this pass (real architectural migration, not a config swap).
Split each OAuth provider (google/github/apple/oidc) and each AI provider
(openai/anthropic/gemini/perplexity/fal/morph) config from one opaque
runtime-only object into individual leaf fields, matching the same
SMTP.host-style pattern mailer config already used. Each leaf can now carry
its own env binding, so these are settable directly as Vercel env vars
instead of requiring the admin API step after deploy. Runtime DB overrides
(admin API) still work exactly as before since the final object shape
consumed by provider code (this.config.apiKey, this.config.clientId, ...)
is unchanged.

Env vars added:
- OAUTH_GOOGLE_CLIENT_ID / OAUTH_GOOGLE_CLIENT_SECRET
- OAUTH_GITHUB_CLIENT_ID / OAUTH_GITHUB_CLIENT_SECRET
- OAUTH_APPLE_CLIENT_ID / OAUTH_APPLE_CLIENT_SECRET
- OAUTH_OIDC_CLIENT_ID / OAUTH_OIDC_CLIENT_SECRET / OAUTH_OIDC_ISSUER
- OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY,
  PERPLEXITY_API_KEY, FAL_API_KEY, MORPH_API_KEY (names matched to each AI
  SDK 7 provider's own documented default env var where one exists,
  confirmed against ai-sdk.dev provider pages)

Left untouched: unsplash/exa/e2b/browserUse/cloudsway (no consumer found in
the codebase to safely verify against) and geminiVertex/anthropicVertex/
oracle (GCP service-account/OCI credentials, different shape of problem).

entry.md: document what changed, exact env var list, and what's still
runtime-only and why.
unsplash, exa, cloudsway, browser-use, e2b keys were previously
runtime-DB-config only despite being real, wired consumers (controller.ts,
tools/*.ts) -- confirmed by grep, not assumption. Same leaf-splitting
pattern as the OAuth/AI provider change. New env vars:
UNSPLASH_ACCESS_KEY, EXA_API_KEY, CLOUDSWAY_ACCESS_KEY/READ_ENDPOINT/
SEARCH_ENDPOINT, BROWSER_USE_API_KEY, E2B_API_KEY.
@thirdbase1

thirdbase1 commented Jul 3, 2026 via email

Copy link
Copy Markdown
Author

open-agent-bot and others added 17 commits July 4, 2026 07:12
- Remove captcha (module, guard, auth flow, frontend challenge)
- Remove Apple OAuth provider registration
- Disable Fal, Oracle, Vertex AI providers in provider index
- Convert Morph to Vercel AI Gateway (useGateway flag, morph/model-id format)
- Replace browser-use with agent-browser CLI tool
- Replace Exa/Cloudsway search with Parallel API + Firecrawl
- Update config schema, provider imports, tool names everywhere
- Sync frontend renderers: chat-config, stream-objects, web-search-result
- Clean frontend auth.ts: remove captcha challenge flow
Removed:
- fal.ts provider (not registered since Vercel-first cleanup)
- oracle.ts provider (not registered since Vercel-first cleanup)
- anthropic/vertex.ts + gemini/vertex.ts (not registered, Vertex AI removed)
- e2b-python-sandbox.ts + @e2b/code-interpreter dep (replaced by vercel-python-sandbox)
- oauth/providers/apple.ts + Apple config + Apple controller/resolver branches
- @ai-sdk/fal + @ai-sdk/google-vertex deps from package.json
- OracleSchema, VertexSchema, FAL/AnthropicVertex/GeminiVertex/Oracle from
  CopilotProviderType enum
- loras/modelName from PromptConfigStrictSchema (Fal-only fields)
- getGoogleAuth + VertexModelListSchema from utils.ts
- e2b config key from copilot config

Added:
- StorageProviderFactory now reads R2_ACCOUNT_ID, R2_ACCESS_KEY_ID,
  R2_SECRET_ACCESS_KEY, R2_BUCKET env vars to auto-configure Cloudflare R2.
  Also supports AWS_S3_* env vars for AWS Marketplace S3 users.
  Falls back to config-file/admin-panel settings when env vars are absent.
- Updated schema.prisma comments to document Aurora PostgreSQL as a
  supported DATABASE_URL target (drop-in replacement, pgvector compatible)
- StorageProviderFactory already supports AWS_S3_* env vars (added in
  previous commit) — now documented in entry.md
- entry.md §8: complete AWS deployment guide via Vercel Marketplace
  (Aurora Serverless v2 for DB, S3 for storage, 00 free credits)
- No code changes needed — Aurora is PostgreSQL wire-compatible,
  S3 provider already exists in the codebase
…ntext

Critical fix: .dockerignore was excluding blocksuite/ and tools/ directories,
which are yarn workspace roots that other packages depend on:
- @afk/component depends on @blocksuite/affine (in blocksuite/)
- @afk/server depends on @afk-tools/cli (in tools/)
- @afk/component depends on @afk-tools/utils (in tools/)
Without these, yarn install --immutable would fail during Docker build.

Also un-excluded Cargo.lock (needed for reproducible Rust native module builds).
Full codebase sweep of every config.ts, every process.env reference, and
every env: binding in the NestJS config system. Results:

Fixed:
- Added missing OAUTH_OIDC_CLIENT_ID env binding (was the only OAuth
  provider without a clientId env var — would have required admin API
  config instead of simple env var on Vercel)

Added:
- .env.vercel — comprehensive reference file listing ALL 40+ env vars
  organized by category with inline comments, marked [REQUIRED],
  [OPTIONAL], or [VERCEL-AUTO]. Includes minimum-required summary for
  first deploy.
- .env.example — updated to point to .env.vercel for full reference
- entry.md §9 — quick reference table of all env vars

Complete env var inventory:
  [REQUIRED] DATABASE_URL, DIRECT_URL, REDIS_URL,
    AWS_S3_ACCESS_KEY_ID, AWS_S3_SECRET_ACCESS_KEY, AWS_S3_BUCKET,
    AWS_S3_REGION, OPEN_AGENT_PRIVATE_KEY
  [VERCEL-AUTO] PORT, VERCEL_OIDC_TOKEN, NODE_ENV
  [OPTIONAL-AI] AI_GATEWAY_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY,
    GOOGLE_GENERATIVE_AI_API_KEY, PERPLEXITY_API_KEY, MORPH_API_KEY
  [OPTIONAL-TOOLS] UNSPLASH_ACCESS_KEY, PARALLEL_API_KEY,
    FIRECRAWL_API_KEY, AGENT_BROWSER_COMMAND
  [OPTIONAL-OAUTH] OAUTH_GOOGLE_CLIENT_ID/SECRET,
    OAUTH_GITHUB_CLIENT_ID/SECRET, OAUTH_OIDC_CLIENT_ID/SECRET/ISSUER
  [OPTIONAL-MAIL] MAILER_HOST/PORT/USER/PASSWORD/SENDER/IGNORE_TLS
  [OPTIONAL-SERVER] OPEN_AGENT_SERVER_EXTERNAL_URL/HOST/HTTPS/PORT/SUB_PATH
  [OPTIONAL-RUNTIME] OPEN_AGENT_ENV, SERVER_FLAVOR, DEPLOYMENT_TYPE,
    DEPLOYMENT_PLATFORM
  [ALT-STORAGE] R2_ACCOUNT_ID/ACCESS_KEY_ID/SECRET_ACCESS_KEY/BUCKET
  [ALT-REDIS] REDIS_SERVER_HOST/PORT/DATABASE/USERNAME/PASSWORD,
    REDIS_ENABLE_TLS
vercel.json:
- Added 'runtime: container' to explicitly tell Vercel to build as Docker
- Added top-level rewrite to route all public traffic to the 'server' service
  (per Vercel docs: 'A service receives public traffic only when there is a
  top-level rewrite that routes requests to it')
- Without the rewrite, the service would be internal-only with no public access

DEPLOY.md:
- Complete self-contained deployment guide for any agent or human to follow
- Covers: architecture overview, infra add-on setup, env var configuration,
  repo import, deploy steps, DB migrations, OAuth redirect URLs, post-deploy
  config
- Phase 1 (current): single-service Docker deployment
- Phase 2 (future reference): multi-service split with service bindings
- Troubleshooting section for common build and runtime issues
- All info verified against official Vercel docs (June 2026):
  https://vercel.com/docs/services
  https://vercel.com/kb/guide/docker
  https://vercel.com/docs/services/routing
  https://vercel.com/docs/services/bindings
  https://vercel.com/docs/services/config-reference
- Root package.json postinstall now installs agent-browser globally + downloads Chrome (non-fatal)
- Dockerfile.vercel production stage bakes agent-browser CLI + sets AGENT_BROWSER_COMMAND
- agent-browser tool: ensureInstalled() auto-heals if CLI missing, falls back to npx
- Description updated so LLM knows fallback install commands
…on to Vercel Sandbox

Fixes for FUNCTION_INVOCATION_FAILED (container crash at runtime):
1. Port: default changed from 3010 to 80 (Vercel container default)
2. LD_PRELOAD: made conditional — won't crash if jemalloc library missing
3. Native module: added fallback copy to ensure .node binary is in node_modules
4. datasourceUrl: removed z.string().url() validation that crashed on
   Postgres connection strings with special chars in passwords
5. Error handling: wrapped bootstrap in try/catch so actual error is logged
   to Vercel Logs tab instead of silent crash

Fixes for build log warnings:
1. Added DEBIAN_FRONTEND=noninteractive to suppress apt warnings
2. Added apt-utils to fix 'debconf: delaying package configuration' warning
3. Removed unnecessary global agent-browser install (runs in sandbox now)

Browser automation moved to Vercel Sandbox:
- agent-browser now runs inside an isolated Vercel Sandbox microVM
  instead of via execFile on the server container
- Chromium system deps installed on first use, or from snapshot if
  AGENT_BROWSER_SNAPSHOT_ID is set
- Auth is automatic on Vercel via VERCEL_OIDC_TOKEN
- Updated DEPLOY.md and entry.md with new troubleshooting section
…ystem prompt

agent-browser tool:
- Rewritten with all 60+ commands from agent-browser.dev CLI reference
- Full system prompt injected into chat template with workflow guide,
  command reference, and best practices
- Vercel Sandbox integration with persistent per-chat browser sessions
- Auto-installs Chromium deps on first use, or from snapshot if
  AGENT_BROWSER_SNAPSHOT_ID is set
- Structured --json output by default for programmatic parsing
- Screenshot/pdf file reading with base64 return
- Proper error handling with exit code parsing

New tools:
- web_fetch: Lightweight URL fetcher (no browser/API needed) with
  HTML→markdown conversion. Faster than browser for static pages.
- url_scanner: Extract metadata, links, images, headings, scripts,
  stylesheets, and JSON-LD from any URL. Great for SEO audits.
- quick_compute: Safe JS eval for fast math, unit conversions,
  string processing, and JSON manipulation. No sandbox VM needed.

System prompt updates:
- Browser automation guide with full workflow (open → snapshot →
  interact → re-snapshot → close)
- Complete command reference in the prompt
- Tool-calling guidelines for all new tools
- Smart routing: web_fetch for static, browser for JS-heavy/auth pages

All tools registered in:
- PromptTools enum (types.ts)
- Provider tool switch (provider.ts)
- Chat prompt config (prompts.ts)
- Tools barrel export (index.ts)
open-agent-bot and others added 11 commits July 4, 2026 18:02
Design tools (3 new):
- design_generator: Generates professional non-AI-slop frontend designs
  with 6 curated presets (editorial, brutalist, warm, technical, playful,
  minimal). Even vague prompts produce distinctive results.
- design_system: List/get/validate design presets. Includes a slop
  detector that checks designs against 33 anti-slop rules.
- visual_polish: Automatic quality pass that catches and fixes spacing,
  typography, color, and motion issues. Scores designs 0-100.

Anti-slop rules baked into all 3 tools and the system prompt:
- 33 specific patterns from impeccable.style research (2025-2026)
- Covers visual, typography, color, layout, motion, and copy tells
- Purple gradients, glassmorphism, Inter font, icon-tile headings,
  centered hero + 3-card grid — all explicitly banned
- System prompt now instructs AI to NEVER produce AI slop

Model selection fixes:
- Fixed findValidModel fallback: when no model has defaultForOutputType
  set, now falls back to first capable model instead of crashing
- Updated Anthropic models: added claude-sonnet-4-5 as default,
  kept legacy models for backwards compatibility
- Verified OpenAI (gpt-5, o4-mini) and Gemini (2.5 flash/pro) are current

System prompt updates:
- Design tool guidelines with anti-slop philosophy
- 'NEVER produce AI slop' directive in tool-calling guidelines
- Design philosophy: distinctive > safe, intentional > trendy
Dockerfile.vercel:
- Replace nodesource setup script with COPY --from=node:22-bookworm-slim
  (eliminates 7 apt/debconf warnings from rust-builder stage)
- Suppress production stage apt warnings with stderr redirect + apt-utils
- Run prisma migrate deploy in background (non-blocking server start)

Backend crash fixes (500 FUNCTION_INVOCATION_FAILED):
- Redis instances: add lazyConnect:true so error handler attaches before
  connecting (prevents fatal uncaught 'error' event on Redis connection issues)
- Config service: wrap loadDbOverrides in try/catch so missing DB tables
  don't crash the server on startup
- index.ts: add global unhandledRejection + uncaughtException handlers
- server.ts: log missing env vars on startup for debugging
- app.controller.ts: add /info/health endpoint for Vercel health checks

Frontend warning fixes:
- chat-config.tsx: export fallbackModels + useModels (fixes 2 ESModulesLinkingWarning)
- chat-input.tsx: use useModels() hook instead of importing non-existent tempModels
- rspack.config.js: disable performance hints (eliminates 3 asset size warnings)
- chat-config.tsx: sync frontend tools with backend (add webFetch, urlScanner,
  quickCompute, designGenerator, designSystem, visualPolish)

Other:
- design-generator.ts: simplify tool signature
- provider.ts: cleanup
…+ 8 new tools

Dynamic Model Fetching (no more hardcoded models):
- Created gateway-models.ts service that fetches all 298+ models from
  https://ai-gateway.vercel.sh/v1/models (no auth required, 5-min cache)
- Replaced hardcoded model arrays in Anthropic, Gemini, Morph, and Perplexity
  providers with dynamic getters that fetch from the gateway
- Factory's listAllModels() now returns gateway models (async)
- Resolver's listCopilotModels updated to async
- Config defaults updated to gateway format (creator/model-name)
- Frontend fallbackModels reduced to 3 minimal gateway-format defaults
- Models are categorized by type (language/image/video/embedding/reranking/
  speech/transcription/realtime) with auto-mapped capabilities from tags

8 New Out-of-the-Box Features:
1. imageVision — AI vision: OCR, scene description, chart reading, code analysis
2. videoGenerator — text-to-video via Kling/Wan/ByteDance gateway models
3. translator — 30+ language translation with auto-detection
4. codeReviewer — structured code review with severity levels and fixes
5. contentWriter — 12 content types (blog, social, email, newsletter, etc.)
6. dataAnalyzer — CSV/JSON analysis with statistics and insights
7. docSummarizer — 5 summary styles (executive, bullets, ELI5, takeaways)
8. voiceGenerator — text-to-speech via OpenAI TTS gateway models

All new tools use gateway-format model IDs and OIDC authentication.
All new tools registered in PromptTools enum, provider switch/case, and
frontend configurableTools.
…stic

Dockerfile fix:
- Copy entire /usr/local/bin/ from node image (includes corepack, npm, npx)
- Fixes 'corepack: not found' build error on Vercel

Removed video-generator tool (rare feature, not out-of-the-box)

All 7 remaining tools now accept optional 'model' parameter:
- imageVision, translator, codeReviewer, contentWriter,
  dataAnalyzer, docSummarizer, voiceGenerator
- Any model from the gateway can be passed in
- Sensible defaults if model not specified
- No more hardcoded model lock-in
… under buildah)

Buildah doesn't preserve symlinks when COPY-ing from another image.
Reverted to nodesource setup_22.x which installs node+npm+corepack
with proper symlinks. This is the same approach the original AFFiNE
Dockerfile uses.
…loc from startup

- CMD is now just 'node dist/main.mjs' (no shell wrapper, no background processes)
- ENV OPEN_AGENT_SERVER_PORT=80 (Vercel routes to port 80 by default)
- Removed libjemalloc2 (not essential, was potential crash source via LD_PRELOAD)
- Prisma migrations can be run via separate Vercel build step
- PromptService.onApplicationBootstrap: wrap refreshPrompts in try/catch
- PromptService.onConfigInit: wrap setup in try/catch
- JobExecutor.onConfigInit: wrap startWorkers in try/catch
- ConfigService.setup: wrap emitAsync('config.init') in try/catch

This fixes the Vercel INTERNAL_FUNCTION_INVOCATION_FAILED error where
the server would crash on boot if DATABASE_URL or REDIS_URL pointed
to an unreachable service. The server now starts, serves the frontend,
and logs warnings instead of crashing.
- packages/backend/native/index.js: ESM entry point that loads
  the compiled .node binary, needed for the server's import resolution
- .gitignore: exclude native/ build artifacts directory
- Verified locally: server starts successfully with real native module,
  logs 'Nest application successfully started' and 'Listening on 0.0.0.0:8099'
The package.json doesn't have 'type: module', so Node.js treats .js
files as CommonJS. Using import/export syntax caused a SyntaxError
that crashed the server on every request (FUNCTION_INVOCATION_FAILED).

Changed to: module.exports = require('./server-native.node')
Verified both CJS require() and ESM import * as work correctly.
Critical: Vercel sets PORT at runtime but the server reads
OPEN_AGENT_SERVER_PORT. The old Dockerfile hardcoded port 80 via
ENV, now CMD maps $PORT → OPEN_AGENT_SERVER_PORT dynamically.

Also restored jemalloc preload and background prisma migration.
…andbox

- Upgraded to AI SDK 7 (v7.0.15)
- All AI providers route through Vercel AI Gateway (no hardcoded models)
- Replaced E2B with Vercel Sandbox + advanced custom Python kernel
- Kernel: persistent globals, auto-capture matplotlib, last-expr value, variable inspection
- Crash-proof: server boots even when DB/Redis/native module/AI keys are missing
- Dynamic PORT support for Vercel deployment
- Dockerfile.vercel + vercel.json for containerized Vercel deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant