[build]
ignore = "node ./scripts/netlify-ignore-build.mjs analytics"
# The workspace package dist folders are ignored/generated artifacts. Rebuild
# core explicitly here so a cached Netlify install cannot bundle an older agent
# loop into Analytics' server functions (including A2A/MCP final-response
# guards).
command = "export DATABASE_URL=${NETLIFY_DATABASE_URL:-$DATABASE_URL} && pnpm install && pnpm --filter @agent-native/core build && NITRO_PRESET=netlify pnpm --filter analytics build"
publish = "templates/analytics/dist"
functions = "templates/analytics/.netlify/functions-internal"

[build.environment]
GA_MEASUREMENT_ID = "G-ESF7FYXGN9"
GTM_CONTAINER_ID = "GTM-N3WSTXZ"
NITRO_PRESET = "netlify"
NPM_CONFIG_PRODUCTION = "false"
AGENT_PROD_CODE_EXECUTION = "sandboxed"
# Analytics dashboard creation can span multiple model/tool rounds; keep those
# turns on the durable background worker instead of the short foreground wall.
AGENT_CHAT_DURABLE_BACKGROUND = "true"

# A2A delegation calls run a full agent loop (LLM + tool calls + DB queries).
# Hosted agent chat uses a soft timeout before this function timeout so the
# hidden auto-continuation path can hand off before Netlify kills the function.
# If AGENT_RUN_SOFT_TIMEOUT_MS is customized, keep it below this timeout.
[functions."*"]
timeout = 75

[functions.dashboard-report-sweep-background]
timeout = 300
memory = "2gb"

[functions.analytics-alert-sweep-background]
timeout = 120

[functions.uptime-monitor-sweep-background]
timeout = 120
