feat(ci): consolidate ci, make db migrations dependent on ecr success, remove turbopack for staging/prod builds (#1449)

* Remove turbopack

* Fix ci errors

* Sim agent import fix

* Lint

* Ci orchestration

* Lint

* Ci updates

* Tdz fix for generate

* Remove logger

* Fix imports

* Lint
This commit is contained in:
Siddharth Ganesan
2025-09-25 12:26:25 -07:00
committed by GitHub
parent 928581f387
commit d381a69c9f
21 changed files with 315 additions and 40 deletions

View File

@@ -3,6 +3,7 @@ name: Build and Push to ECR
on: on:
push: push:
branches: [main, staging] branches: [main, staging]
workflow_call:
permissions: permissions:
id-token: write id-token: write

83
.github/workflows/build-ghcr-build.yml vendored Normal file
View File

@@ -0,0 +1,83 @@
name: Build GHCR Images (Build Only)
on:
workflow_call:
permissions:
contents: read
packages: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# AMD64 builds on x86 runners
- dockerfile: ./docker/app.Dockerfile
image: ghcr.io/simstudioai/simstudio
platform: linux/amd64
arch: amd64
runner: linux-x64-8-core
- dockerfile: ./docker/db.Dockerfile
image: ghcr.io/simstudioai/migrations
platform: linux/amd64
arch: amd64
runner: linux-x64-8-core
- dockerfile: ./docker/realtime.Dockerfile
image: ghcr.io/simstudioai/realtime
platform: linux/amd64
arch: amd64
runner: linux-x64-8-core
# ARM64 builds on native ARM64 runners
- dockerfile: ./docker/app.Dockerfile
image: ghcr.io/simstudioai/simstudio
platform: linux/arm64
arch: arm64
runner: linux-arm64-8-core
- dockerfile: ./docker/db.Dockerfile
image: ghcr.io/simstudioai/migrations
platform: linux/arm64
arch: arm64
runner: linux-arm64-8-core
- dockerfile: ./docker/realtime.Dockerfile
image: ghcr.io/simstudioai/realtime
platform: linux/arm64
arch: arm64
runner: linux-arm64-8-core
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=raw,value=latest-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=staging-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
type=raw,value=staging-${{ github.sha }}-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
type=sha,format=long,suffix=-${{ matrix.arch }}
- name: Build Docker image (no push)
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=build-v3
cache-to: type=gha,mode=max,scope=build-v3
provenance: false
sbom: false

148
.github/workflows/build-ghcr-push.yml vendored Normal file
View File

@@ -0,0 +1,148 @@
name: Push GHCR Images
on:
workflow_call:
permissions:
contents: read
packages: write
jobs:
push:
strategy:
fail-fast: false
matrix:
include:
# AMD64 builds
- dockerfile: ./docker/app.Dockerfile
image: ghcr.io/simstudioai/simstudio
platform: linux/amd64
arch: amd64
- dockerfile: ./docker/db.Dockerfile
image: ghcr.io/simstudioai/migrations
platform: linux/amd64
arch: amd64
- dockerfile: ./docker/realtime.Dockerfile
image: ghcr.io/simstudioai/realtime
platform: linux/amd64
arch: amd64
# ARM64 builds
- dockerfile: ./docker/app.Dockerfile
image: ghcr.io/simstudioai/simstudio
platform: linux/arm64
arch: arm64
- dockerfile: ./docker/db.Dockerfile
image: ghcr.io/simstudioai/migrations
platform: linux/arm64
arch: arm64
- dockerfile: ./docker/realtime.Dockerfile
image: ghcr.io/simstudioai/realtime
platform: linux/arm64
arch: arm64
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=raw,value=latest-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=staging-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
type=raw,value=staging-${{ github.sha }}-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
type=sha,format=long,suffix=-${{ matrix.arch }}
- name: Push Docker image from cache
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=build-v3
cache-to: type=gha,mode=max,scope=build-v3
provenance: false
sbom: false
create-manifests:
runs-on: ubuntu-latest
needs: push
strategy:
matrix:
include:
- image: ghcr.io/simstudioai/simstudio
- image: ghcr.io/simstudioai/migrations
- image: ghcr.io/simstudioai/realtime
permissions:
contents: read
packages: write
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for manifest
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=staging,enable=${{ github.ref == 'refs/heads/staging' }}
type=sha,format=long
- name: Create and push manifest
run: |
# Extract the tags from metadata (these are the final manifest tags we want)
MANIFEST_TAGS="${{ steps.meta.outputs.tags }}"
# Create manifest for each tag
for manifest_tag in $MANIFEST_TAGS; do
echo "Creating manifest for $manifest_tag"
# The architecture-specific images have -amd64 and -arm64 suffixes
amd64_image="${manifest_tag}-amd64"
arm64_image="${manifest_tag}-arm64"
echo "Looking for images: $amd64_image and $arm64_image"
# Check if both architecture images exist
if docker manifest inspect "$amd64_image" >/dev/null 2>&1 && docker manifest inspect "$arm64_image" >/dev/null 2>&1; then
echo "Both images found, creating manifest..."
docker manifest create "$manifest_tag" \
"$amd64_image" \
"$arm64_image"
docker manifest push "$manifest_tag"
echo "Successfully created and pushed manifest for $manifest_tag"
else
echo "Error: One or both architecture images not found"
echo "Checking AMD64 image: $amd64_image"
docker manifest inspect "$amd64_image" || echo "AMD64 image not found"
echo "Checking ARM64 image: $arm64_image"
docker manifest inspect "$arm64_image" || echo "ARM64 image not found"
exit 1
fi
done

View File

@@ -3,6 +3,11 @@ name: Build and Publish Docker Image
on: on:
push: push:
branches: [main, staging] branches: [main, staging]
workflow_call:
permissions:
contents: read
packages: write
jobs: jobs:
build-and-push: build-and-push:

View File

@@ -55,11 +55,54 @@ jobs:
fail_ci_if_error: false fail_ci_if_error: false
verbose: true verbose: true
# Call GHCR build workflow (runs in parallel with ECR)
build-ghcr:
name: Build GHCR Images
needs: test
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
uses: ./.github/workflows/build-ghcr-build.yml
secrets: inherit
permissions:
contents: read
packages: write
# Call ECR build workflow (runs in parallel with GHCR build)
build-ecr-deploy:
name: Build ECR and Deploy
needs: test
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
uses: ./.github/workflows/build-ecr.yml
secrets: inherit
permissions:
id-token: write
contents: read
# Call Trigger.dev deploy workflow (runs in parallel)
trigger-deploy:
name: Deploy Trigger.dev
needs: test
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
uses: ./.github/workflows/trigger-deploy.yml
secrets: inherit
# Push GHCR images after ECR/ECS deployment is complete
push-ghcr:
name: Push GHCR Images
needs: [build-ghcr, build-ecr-deploy]
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
uses: ./.github/workflows/build-ghcr-push.yml
secrets: inherit
permissions:
contents: read
packages: write
# Run database migrations (depends on GHCR push and trigger deployment)
migrations: migrations:
name: Apply Database Migrations name: Apply Database Migrations
needs: [push-ghcr, trigger-deploy]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
needs: test
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -77,3 +120,11 @@ jobs:
env: env:
DATABASE_URL: ${{ github.ref == 'refs/heads/main' && secrets.DATABASE_URL || secrets.STAGING_DATABASE_URL }} DATABASE_URL: ${{ github.ref == 'refs/heads/main' && secrets.DATABASE_URL || secrets.STAGING_DATABASE_URL }}
run: bunx drizzle-kit migrate --config=./drizzle.config.ts run: bunx drizzle-kit migrate --config=./drizzle.config.ts
# Process docs embeddings if needed
process-docs:
name: Process Docs
needs: migrations
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
uses: ./.github/workflows/docs-embeddings.yml
secrets: inherit

View File

@@ -6,6 +6,7 @@ on:
paths: paths:
- 'apps/docs/**' - 'apps/docs/**'
workflow_dispatch: # Allow manual triggering workflow_dispatch: # Allow manual triggering
workflow_call:
jobs: jobs:
process-docs-embeddings: process-docs-embeddings:

View File

@@ -5,6 +5,7 @@ on:
branches: branches:
- main - main
- staging - staging
workflow_call:
jobs: jobs:
deploy: deploy:

View File

@@ -1,12 +1,7 @@
import { type NextRequest, NextResponse } from 'next/server' import { type NextRequest, NextResponse } from 'next/server'
import { getSession } from '@/lib/auth' import { getSession } from '@/lib/auth'
import { env } from '@/lib/env' import { env } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger' import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent/constants'
import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent'
const logger = createLogger('CopilotApiKeysGenerate')
const SIM_AGENT_API_URL = env.SIM_AGENT_API_URL || SIM_AGENT_API_URL_DEFAULT
export async function POST(req: NextRequest) { export async function POST(req: NextRequest) {
try { try {
@@ -17,6 +12,9 @@ export async function POST(req: NextRequest) {
const userId = session.user.id const userId = session.user.id
// Move environment variable access inside the function
const SIM_AGENT_API_URL = env.SIM_AGENT_API_URL || SIM_AGENT_API_URL_DEFAULT
const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/generate`, { const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/generate`, {
method: 'POST', method: 'POST',
headers: { headers: {
@@ -27,8 +25,6 @@ export async function POST(req: NextRequest) {
}) })
if (!res.ok) { if (!res.ok) {
const errorBody = await res.text().catch(() => '')
logger.error('Sim Agent generate key error', { status: res.status, error: errorBody })
return NextResponse.json( return NextResponse.json(
{ error: 'Failed to generate copilot API key' }, { error: 'Failed to generate copilot API key' },
{ status: res.status || 500 } { status: res.status || 500 }
@@ -38,7 +34,6 @@ export async function POST(req: NextRequest) {
const data = (await res.json().catch(() => null)) as { apiKey?: string } | null const data = (await res.json().catch(() => null)) as { apiKey?: string } | null
if (!data?.apiKey) { if (!data?.apiKey) {
logger.error('Sim Agent generate key returned invalid payload')
return NextResponse.json({ error: 'Invalid response from Sim Agent' }, { status: 500 }) return NextResponse.json({ error: 'Invalid response from Sim Agent' }, { status: 500 })
} }
@@ -47,7 +42,6 @@ export async function POST(req: NextRequest) {
{ status: 201 } { status: 201 }
) )
} catch (error) { } catch (error) {
logger.error('Failed to proxy generate copilot API key', { error })
return NextResponse.json({ error: 'Failed to generate copilot API key' }, { status: 500 }) return NextResponse.json({ error: 'Failed to generate copilot API key' }, { status: 500 })
} }
} }

View File

@@ -1,12 +1,7 @@
import { type NextRequest, NextResponse } from 'next/server' import { type NextRequest, NextResponse } from 'next/server'
import { getSession } from '@/lib/auth' import { getSession } from '@/lib/auth'
import { env } from '@/lib/env' import { env } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger' import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent/constants'
import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent'
const logger = createLogger('CopilotApiKeys')
const SIM_AGENT_API_URL = env.SIM_AGENT_API_URL || SIM_AGENT_API_URL_DEFAULT
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
try { try {
@@ -17,6 +12,8 @@ export async function GET(request: NextRequest) {
const userId = session.user.id const userId = session.user.id
const SIM_AGENT_API_URL = env.SIM_AGENT_API_URL || SIM_AGENT_API_URL_DEFAULT
const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/get-api-keys`, { const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/get-api-keys`, {
method: 'POST', method: 'POST',
headers: { headers: {
@@ -27,15 +24,12 @@ export async function GET(request: NextRequest) {
}) })
if (!res.ok) { if (!res.ok) {
const errorBody = await res.text().catch(() => '')
logger.error('Sim Agent get-api-keys error', { status: res.status, error: errorBody })
return NextResponse.json({ error: 'Failed to get keys' }, { status: res.status || 500 }) return NextResponse.json({ error: 'Failed to get keys' }, { status: res.status || 500 })
} }
const apiKeys = (await res.json().catch(() => null)) as { id: string; apiKey: string }[] | null const apiKeys = (await res.json().catch(() => null)) as { id: string; apiKey: string }[] | null
if (!Array.isArray(apiKeys)) { if (!Array.isArray(apiKeys)) {
logger.error('Sim Agent get-api-keys returned invalid payload')
return NextResponse.json({ error: 'Invalid response from Sim Agent' }, { status: 500 }) return NextResponse.json({ error: 'Invalid response from Sim Agent' }, { status: 500 })
} }
@@ -43,7 +37,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json({ keys }, { status: 200 }) return NextResponse.json({ keys }, { status: 200 })
} catch (error) { } catch (error) {
logger.error('Failed to get copilot API keys', { error })
return NextResponse.json({ error: 'Failed to get keys' }, { status: 500 }) return NextResponse.json({ error: 'Failed to get keys' }, { status: 500 })
} }
} }
@@ -62,6 +55,8 @@ export async function DELETE(request: NextRequest) {
return NextResponse.json({ error: 'id is required' }, { status: 400 }) return NextResponse.json({ error: 'id is required' }, { status: 400 })
} }
const SIM_AGENT_API_URL = env.SIM_AGENT_API_URL || SIM_AGENT_API_URL_DEFAULT
const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/delete`, { const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/delete`, {
method: 'POST', method: 'POST',
headers: { headers: {
@@ -72,20 +67,16 @@ export async function DELETE(request: NextRequest) {
}) })
if (!res.ok) { if (!res.ok) {
const errorBody = await res.text().catch(() => '')
logger.error('Sim Agent delete key error', { status: res.status, error: errorBody })
return NextResponse.json({ error: 'Failed to delete key' }, { status: res.status || 500 }) return NextResponse.json({ error: 'Failed to delete key' }, { status: res.status || 500 })
} }
const data = (await res.json().catch(() => null)) as { success?: boolean } | null const data = (await res.json().catch(() => null)) as { success?: boolean } | null
if (!data?.success) { if (!data?.success) {
logger.error('Sim Agent delete key returned invalid payload')
return NextResponse.json({ error: 'Invalid response from Sim Agent' }, { status: 500 }) return NextResponse.json({ error: 'Invalid response from Sim Agent' }, { status: 500 })
} }
return NextResponse.json({ success: true }, { status: 200 }) return NextResponse.json({ success: true }, { status: 200 })
} catch (error) { } catch (error) {
logger.error('Failed to delete copilot API key', { error })
return NextResponse.json({ error: 'Failed to delete key' }, { status: 500 }) return NextResponse.json({ error: 'Failed to delete key' }, { status: 500 })
} }
} }

View File

@@ -15,7 +15,7 @@ import { getCopilotModel } from '@/lib/copilot/config'
import type { CopilotProviderConfig } from '@/lib/copilot/types' import type { CopilotProviderConfig } from '@/lib/copilot/types'
import { env } from '@/lib/env' import { env } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger' import { createLogger } from '@/lib/logs/console/logger'
import { SIM_AGENT_API_URL_DEFAULT, SIM_AGENT_VERSION } from '@/lib/sim-agent' import { SIM_AGENT_API_URL_DEFAULT, SIM_AGENT_VERSION } from '@/lib/sim-agent/constants'
import { generateChatTitle } from '@/lib/sim-agent/utils' import { generateChatTitle } from '@/lib/sim-agent/utils'
import { createFileContent, isSupportedFileType } from '@/lib/uploads/file-utils' import { createFileContent, isSupportedFileType } from '@/lib/uploads/file-utils'
import { S3_COPILOT_CONFIG } from '@/lib/uploads/setup' import { S3_COPILOT_CONFIG } from '@/lib/uploads/setup'

View File

@@ -8,7 +8,7 @@ import {
createUnauthorizedResponse, createUnauthorizedResponse,
} from '@/lib/copilot/auth' } from '@/lib/copilot/auth'
import { env } from '@/lib/env' import { env } from '@/lib/env'
import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent' import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent/constants'
const SIM_AGENT_API_URL = env.SIM_AGENT_API_URL || SIM_AGENT_API_URL_DEFAULT const SIM_AGENT_API_URL = env.SIM_AGENT_API_URL || SIM_AGENT_API_URL_DEFAULT

View File

@@ -9,7 +9,7 @@ import {
} from '@/lib/copilot/auth' } from '@/lib/copilot/auth'
import { env } from '@/lib/env' import { env } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger' import { createLogger } from '@/lib/logs/console/logger'
import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent' import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent/constants'
const logger = createLogger('CopilotMarkToolCompleteAPI') const logger = createLogger('CopilotMarkToolCompleteAPI')

View File

@@ -6,7 +6,7 @@ import { z } from 'zod'
import { getSession } from '@/lib/auth' import { getSession } from '@/lib/auth'
import { createLogger } from '@/lib/logs/console/logger' import { createLogger } from '@/lib/logs/console/logger'
import { getUserEntityPermissions } from '@/lib/permissions/utils' import { getUserEntityPermissions } from '@/lib/permissions/utils'
import { simAgentClient } from '@/lib/sim-agent' import { simAgentClient } from '@/lib/sim-agent/client'
import { generateRequestId } from '@/lib/utils' import { generateRequestId } from '@/lib/utils'
import { loadWorkflowFromNormalizedTables } from '@/lib/workflows/db-helpers' import { loadWorkflowFromNormalizedTables } from '@/lib/workflows/db-helpers'
import { getAllBlocks } from '@/blocks/registry' import { getAllBlocks } from '@/blocks/registry'

View File

@@ -6,7 +6,8 @@ import { type NextRequest, NextResponse } from 'next/server'
import { z } from 'zod' import { z } from 'zod'
import { env } from '@/lib/env' import { env } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger' import { createLogger } from '@/lib/logs/console/logger'
import { SIM_AGENT_API_URL_DEFAULT, simAgentClient } from '@/lib/sim-agent' import { simAgentClient } from '@/lib/sim-agent/client'
import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent/constants'
import { generateRequestId } from '@/lib/utils' import { generateRequestId } from '@/lib/utils'
import { import {
loadWorkflowFromNormalizedTables, loadWorkflowFromNormalizedTables,

View File

@@ -1,6 +1,6 @@
import { type NextRequest, NextResponse } from 'next/server' import { type NextRequest, NextResponse } from 'next/server'
import { createLogger } from '@/lib/logs/console/logger' import { createLogger } from '@/lib/logs/console/logger'
import { simAgentClient } from '@/lib/sim-agent' import { simAgentClient } from '@/lib/sim-agent/client'
import { generateRequestId } from '@/lib/utils' import { generateRequestId } from '@/lib/utils'
import { getAllBlocks } from '@/blocks/registry' import { getAllBlocks } from '@/blocks/registry'
import type { BlockConfig } from '@/blocks/types' import type { BlockConfig } from '@/blocks/types'

View File

@@ -5,7 +5,7 @@ import { type NextRequest, NextResponse } from 'next/server'
import { getSession } from '@/lib/auth' import { getSession } from '@/lib/auth'
import { createLogger } from '@/lib/logs/console/logger' import { createLogger } from '@/lib/logs/console/logger'
import { getUserEntityPermissions } from '@/lib/permissions/utils' import { getUserEntityPermissions } from '@/lib/permissions/utils'
import { simAgentClient } from '@/lib/sim-agent' import { simAgentClient } from '@/lib/sim-agent/client'
import { generateRequestId } from '@/lib/utils' import { generateRequestId } from '@/lib/utils'
import { loadWorkflowFromNormalizedTables } from '@/lib/workflows/db-helpers' import { loadWorkflowFromNormalizedTables } from '@/lib/workflows/db-helpers'
import { getAllBlocks } from '@/blocks/registry' import { getAllBlocks } from '@/blocks/registry'

View File

@@ -2,7 +2,7 @@ import type { BaseServerTool } from '@/lib/copilot/tools/server/base-tool'
import type { BuildWorkflowInput, BuildWorkflowResult } from '@/lib/copilot/tools/shared/schemas' import type { BuildWorkflowInput, BuildWorkflowResult } from '@/lib/copilot/tools/shared/schemas'
import { env } from '@/lib/env' import { env } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger' import { createLogger } from '@/lib/logs/console/logger'
import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent' import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent/constants'
import { validateWorkflowState } from '@/lib/workflows/validation' import { validateWorkflowState } from '@/lib/workflows/validation'
import { getAllBlocks } from '@/blocks/registry' import { getAllBlocks } from '@/blocks/registry'
import type { BlockConfig } from '@/blocks/types' import type { BlockConfig } from '@/blocks/types'

View File

@@ -4,7 +4,7 @@ import { eq } from 'drizzle-orm'
import type { BaseServerTool } from '@/lib/copilot/tools/server/base-tool' import type { BaseServerTool } from '@/lib/copilot/tools/server/base-tool'
import { env } from '@/lib/env' import { env } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger' import { createLogger } from '@/lib/logs/console/logger'
import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent' import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent/constants'
import { loadWorkflowFromNormalizedTables } from '@/lib/workflows/db-helpers' import { loadWorkflowFromNormalizedTables } from '@/lib/workflows/db-helpers'
import { validateWorkflowState } from '@/lib/workflows/validation' import { validateWorkflowState } from '@/lib/workflows/validation'
import { getAllBlocks } from '@/blocks/registry' import { getAllBlocks } from '@/blocks/registry'

View File

@@ -1,12 +1,10 @@
import { env } from '@/lib/env' import { env } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger' import { createLogger } from '@/lib/logs/console/logger'
import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent' import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/sim-agent/constants'
import { generateRequestId } from '@/lib/utils' import { generateRequestId } from '@/lib/utils'
const logger = createLogger('SimAgentClient') const logger = createLogger('SimAgentClient')
const SIM_AGENT_BASE_URL = env.SIM_AGENT_API_URL || SIM_AGENT_API_URL_DEFAULT
export interface SimAgentRequest { export interface SimAgentRequest {
workflowId: string workflowId: string
userId?: string userId?: string
@@ -24,7 +22,8 @@ class SimAgentClient {
private baseUrl: string private baseUrl: string
constructor() { constructor() {
this.baseUrl = SIM_AGENT_BASE_URL // Move environment variable access inside the constructor
this.baseUrl = env.SIM_AGENT_API_URL || SIM_AGENT_API_URL_DEFAULT
} }
/** /**

View File

@@ -84,7 +84,7 @@ const nextConfig: NextConfig = {
turbopack: { turbopack: {
resolveExtensions: ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'], resolveExtensions: ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'],
}, },
serverExternalPackages: ['pdf-parse'], serverExternalPackages: ['pdf-parse', '@azure/storage-blob'],
experimental: { experimental: {
optimizeCss: true, optimizeCss: true,
turbopackSourceMaps: false, turbopackSourceMaps: false,

View File

@@ -12,7 +12,7 @@
"dev:classic": "next dev", "dev:classic": "next dev",
"dev:sockets": "bun run socket-server/index.ts", "dev:sockets": "bun run socket-server/index.ts",
"dev:full": "concurrently -n \"NextJS,Realtime\" -c \"cyan,magenta\" \"bun run dev\" \"bun run dev:sockets\"", "dev:full": "concurrently -n \"NextJS,Realtime\" -c \"cyan,magenta\" \"bun run dev\" \"bun run dev:sockets\"",
"build": "next build --turbopack", "build": "next build",
"start": "next start", "start": "next start",
"prepare": "cd ../.. && bun husky", "prepare": "cd ../.. && bun husky",
"test": "vitest run", "test": "vitest run",