Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
332 commits
Select commit Hold shift + click to select a range
8fe7a56
feat: chat modality fixes with side nav
KayTV Oct 9, 2025
c036cb8
edits
KayTV Oct 10, 2025
9d14bd8
fonts and color adjustments
KayTV Oct 10, 2025
49a28d2
overflow fix
KayTV Oct 10, 2025
d50a948
hover color
KayTV Oct 10, 2025
343bd83
Merge pull request #26 from navapbc/kaytv/chat-modality-fixes
KayTV Oct 10, 2025
d33d16a
feat: added in other fixes for chat modality
KayTV Oct 10, 2025
52af5d7
fix: web-automation-model cookie on consent
fg-nava Oct 13, 2025
5ce50f5
Merge pull request #27 from navapbc/kaytv/chat-modality-fixes-2
KayTV Oct 14, 2025
59bb238
Merge labs-asp into feat/browser-streaming-routes
fg-nava Oct 14, 2025
d08989a
chose: remove console
fg-nava Oct 14, 2025
41701a7
Merge pull request #25 from navapbc/feat/browser-streaming-routes
fg-nava Oct 14, 2025
dc4d722
feat: adjustments for font, responsive and dark mode
KayTV Oct 14, 2025
ac7665c
Merge pull request #28 from navapbc/kaytv/chat-modality-fixes-3
KayTV Oct 15, 2025
285b0da
bug: fixing bugs around the artifact closing
KayTV Oct 16, 2025
a5cc8c3
layout fixes
KayTV Oct 16, 2025
d0a1b8b
stop button modification
KayTV Oct 16, 2025
3f9e10b
suggested actions removal
KayTV Oct 16, 2025
1467987
Merge pull request #29 from navapbc/kaytv/bugs
KayTV Oct 16, 2025
b663895
feat: adding in cursor changes and bug fix screen size
KayTV Oct 20, 2025
73bd1b6
fixes
KayTV Oct 20, 2025
314a491
feat: add Google OAuth authentication with custom domain support
fg-nava Oct 21, 2025
b0f9e1d
fix: change toast type from 'info' to 'success' for type compatibility
fg-nava Oct 21, 2025
e5c9369
feat: integrate PostHog analytics tracking
fg-nava Oct 21, 2025
81f7950
fix: wrap useSearchParams in Suspense boundary for Next.js App Router
fg-nava Oct 21, 2025
358dc80
Merge pull request #30 from navapbc/kaytv/cursors-bugs
KayTV Oct 21, 2025
095f062
Merge pull request #32 from navapbc/feat/setup-posthog-client
fg-nava Oct 21, 2025
445cef4
feat: changes to the tool call messages and edit message icon removal
KayTV Oct 21, 2025
5598cf3
Merge pull request #33 from navapbc/kaytv/bug-fixes-3
KayTV Oct 21, 2025
e4c60aa
chore: remove unused cursor.tsx component
fg-nava Oct 22, 2025
fc7f83e
chore: cleanup animate-ui buggy components
fg-nava Oct 22, 2025
8ce723d
Merge pull request #34 from navapbc/fix/pass-forward-ref-cursor
fg-nava Oct 22, 2025
bae151f
feat: browser fail state
KayTV Oct 22, 2025
5c134c2
Merge pull request #31 from navapbc/feat/setup-google-oauth
fg-nava Oct 23, 2025
49c9499
Merge pull request #35 from navapbc/kaytv/bowser-fail-state
KayTV Oct 23, 2025
274759b
feat: small CSS fixes
KayTV Oct 23, 2025
b9c5c98
Merge pull request #36 from navapbc/kaytv/bug-fixes-4
KayTV Oct 23, 2025
c7f7d3e
bug: fixes for stop button and auto scroll space
KayTV Oct 24, 2025
f53dac5
Merge pull request #38 from navapbc/kaytv/stop-button
KayTV Oct 24, 2025
7a11260
bug: auto scroll for new messages
KayTV Oct 24, 2025
7efc0ef
Merge pull request #39 from navapbc/kaytv/scroll-for-new-chat
KayTV Oct 24, 2025
09ba460
bug: replace favicon and title of app
KayTV Oct 30, 2025
9ce4efe
Merge pull request #40 from navapbc/kaytv/favicon
KayTV Oct 30, 2025
47af79a
bug: offical prototype name change
KayTV Oct 31, 2025
cd9c4c9
bug: scroll to top with new message
KayTV Nov 3, 2025
ed35ca0
Merge pull request #41 from navapbc/kaytv/title-change
KayTV Nov 3, 2025
4f3dfa4
Merge pull request #42 from navapbc/kaytv/scroll-fix
KayTV Nov 5, 2025
12e8944
feat: removed need for the consent page
KayTV Nov 5, 2025
5783e31
feat: add toolcalls to trigger browser display
fg-nava Nov 5, 2025
7b4fcc4
fix: add browser_* tool name support to icon mappings
fg-nava Nov 5, 2025
015c5ce
Merge pull request #43 from navapbc/kaytv/hide-consent
KayTV Nov 5, 2025
bf93002
Merge pull request #44 from navapbc/feat/setup-isolated-browser-conte…
fg-nava Nov 5, 2025
b66cf15
feat: adding in a loading state for when the bot is thinking
KayTV Nov 5, 2025
c3169cc
commit
KayTV Nov 5, 2025
7a56931
Merge pull request #45 from navapbc/kaytv/loader
KayTV Nov 6, 2025
86a5d47
bug: small ui changes to match name and preview of app, removed mastr…
KayTV Nov 6, 2025
3bbe68a
landing change
KayTV Nov 7, 2025
2f6e052
build error
KayTV Nov 7, 2025
bc116a7
placeholder
KayTV Nov 10, 2025
28de2f1
Merge pull request #47 from navapbc/kaytv/ui-content-update
KayTV Nov 10, 2025
9f1f76a
fix: content change for the auth page
KayTV Nov 10, 2025
d07accb
memory
KayTV Nov 10, 2025
392dfe5
Merge pull request #48 from navapbc/kaytv/auth-page-edits
KayTV Nov 10, 2025
cbd7dd8
fix: content changes for landing page and take over
KayTV Nov 10, 2025
bb5004b
Merge pull request #49 from navapbc/kaytv/landing-page-edits
KayTV Nov 10, 2025
8d6ce07
fix: resolve ESLint warnings and replace ClockFading icon with Clock
fg-nava Nov 10, 2025
6abc472
fix: update to not show updated working memory tool call
KayTV Nov 12, 2025
977c62b
fix: revert back to ClockFading after pnpm install
fg-nava Nov 12, 2025
9dff1a7
Merge pull request #50 from navapbc/fix/ts-build-errors-warnings
fg-nava Nov 12, 2025
ae5d739
Merge branch 'labs-asp' into kaytv/hide-update-working-memory
KayTV Nov 12, 2025
d277809
Merge pull request #51 from navapbc/kaytv/hide-update-working-memory
KayTV Nov 12, 2025
5c57db6
feat: microsoft-login
KayTV Nov 12, 2025
75d1ae1
revert: remove message.tsx and artifact-messages.tsx changes from pre…
KayTV Nov 12, 2025
9590cc6
fix loading state
KayTV Nov 12, 2025
d4d4cba
Merge pull request #52 from navapbc/kaytv/microsoft-login
KayTV Nov 12, 2025
eee9c97
fix: content changes
KayTV Nov 12, 2025
e484f87
Merge pull request #53 from navapbc/kaytv/content-change-1
KayTV Nov 12, 2025
0d87782
fix: add email scope to Microsoft Entra ID auth
fg-nava Nov 13, 2025
42f42ae
Merge pull request #54 from navapbc/fix/microsoft-entra-email-scope
fg-nava Nov 13, 2025
2740ca5
fix: add logging to debug Microsoft OAuth error
fg-nava Nov 13, 2025
36395d0
Merge pull request #55 from navapbc/fix/add-logging-debug-entra
fg-nava Nov 13, 2025
97f25c9
fix: use preferred_username for email in multi-tenant Microsoft auth
fg-nava Nov 13, 2025
2e0f8eb
Merge pull request #56 from navapbc/fix/try-preferred-username
fg-nava Nov 13, 2025
c640325
fix: add type property to Microsoft profile callback
fg-nava Nov 13, 2025
6605fbe
Merge pull request #57 from navapbc/fix/add-type
fg-nava Nov 13, 2025
9e5fec1
fix: font and size changes with takeover
KayTV Nov 13, 2025
8366d41
Merge pull request #58 from navapbc/kaytv/content-change-2
KayTV Nov 13, 2025
dddb06d
fix: fix for scroll issue on new message
KayTV Nov 13, 2025
5f6ddce
Merge pull request #59 from navapbc/kaytv/scroll-issue
KayTV Nov 13, 2025
92fe13e
fix: disable dark mode (temp)
KayTV Nov 13, 2025
0193bde
Merge pull request #60 from navapbc/fix/content-dark-mode
KayTV Nov 13, 2025
78d3c41
fix: add interal error handling for our proxy service before ChatSDKE…
fg-nava Nov 14, 2025
2a04a6a
Merge pull request #61 from navapbc/fix/internal-error-handler
fg-nava Nov 14, 2025
59370cc
fix: revert incorrect error handling issues in 78d3c41
fg-nava Nov 14, 2025
06206a5
Merge pull request #62 from navapbc/fix/revert-error-handling
fg-nava Nov 14, 2025
31811eb
fix: local host navigation fix
KayTV Nov 14, 2025
8abe6da
Merge pull request #63 from navapbc/fix/demo-fixes
KayTV Nov 15, 2025
6c45c70
fix: Fix stop issue when stop in the UI - stop in the mastra BE
KayTV Nov 18, 2025
a056e7f
feat: add /bot-disclosure documentation page
fg-nava Nov 19, 2025
afd4940
fix: adding more responsive view for tablet and mobile
KayTV Nov 19, 2025
1d9f3a8
Merge pull request #65 from navapbc/feat/add-bot-disclosure-page
fg-nava Nov 20, 2025
b413aa4
browser screen
KayTV Nov 20, 2025
7f96c8e
css test
KayTV Nov 20, 2025
d12a6dc
css test
KayTV Nov 20, 2025
6f61343
responsive height/width
KayTV Nov 21, 2025
4f662a5
test number 3
KayTV Nov 21, 2025
0384752
undo
KayTV Nov 21, 2025
706e92f
feat: add .well-known endpoint for Cloudflare bot verification
fg-nava Nov 21, 2025
ae03c6c
Merge pull request #68 from navapbc/feat/add-well-known-route
fg-nava Nov 21, 2025
2d8ced3
browser changes for takeover/ mobile and tablet responsive
KayTV Nov 21, 2025
dead5b2
testing browser
KayTV Nov 21, 2025
bdc77b4
height adjustment
KayTV Nov 21, 2025
585fb35
changing the scrolls
KayTV Nov 21, 2025
f32f620
test on useEffect
KayTV Nov 24, 2025
32fac3a
responsiveness
KayTV Nov 24, 2025
b6265a4
remove use effect
KayTV Nov 24, 2025
b13d39d
Merge pull request #67 from navapbc/fix/tablet-view
KayTV Nov 25, 2025
a54e0a9
test: testing mobile scroll with touch events (Do not merge)
KayTV Nov 25, 2025
dedf818
fix: remove all remaining dark purples in buttons
KayTV Nov 25, 2025
05d4699
Merge pull request #71 from navapbc/fix/remaining-purple
KayTV Nov 25, 2025
a8c0060
testing scroll and inputs
KayTV Nov 25, 2025
3627c30
Merge pull request #70 from navapbc/test/scroll-on-mobile
KayTV Nov 25, 2025
14738cd
Merge pull request #64 from navapbc/fix/stop-api-call
KayTV Nov 26, 2025
672defd
feat: exit warning modal when leaving the browser
KayTV Nov 26, 2025
56356be
chore: update user-agent device name to indicate Nava
fg-nava Dec 1, 2025
07f9a55
linting
KayTV Dec 1, 2025
294c8bd
text hover color to black
KayTV Dec 1, 2025
35eda72
linting
KayTV Dec 1, 2025
e5cd25d
Merge pull request #72 from navapbc/feat/warning-dialog
KayTV Dec 1, 2025
040db89
feat: demo ready - status for AI, suggested actions, stop when takeover
KayTV Dec 2, 2025
954fd4b
Merge pull request #74 from navapbc/feat/demo-day
KayTV Dec 2, 2025
836f7a9
Merge pull request #73 from navapbc/chore/update-user-agent-docs
fg-nava Dec 2, 2025
a47daaf
feat: add HTTP message signature to key directory for Cloudflare veri…
fg-nava Dec 2, 2025
d9a8c16
Merge pull request #75 from navapbc/feat/signed-key-directory
fg-nava Dec 2, 2025
8a5b22e
fix: forth prompt added and center adjustment for homepage
KayTV Dec 3, 2025
5ed23eb
Merge pull request #76 from navapbc/fix/quick-prompts
KayTV Dec 3, 2025
b2a3924
fix: use Host header for @authority in HTTP message signature
fg-nava Dec 3, 2025
b3bee8a
Merge pull request #77 from navapbc/fix/use-authority-header
fg-nava Dec 3, 2025
f89d1b5
fix: fix for image alignment and javascript toolcall
KayTV Dec 9, 2025
d1f3d5b
Merge pull request #79 from navapbc/fix/small-ui-fixes
KayTV Dec 9, 2025
a76a6ab
fix: resolve key issues causing overflow on mobile viewport
fg-nava Dec 9, 2025
8207105
Merge pull request #80 from navapbc/fg-nava/resvole-overflow-mobile
fg-nava Dec 9, 2025
5ca9a6d
fix: show 'Executed JavaScript' tool calls in message UI
fg-nava Dec 9, 2025
ee9b103
Merge pull request #81 from navapbc/fix/revert-executed-javascript-fi…
fg-nava Dec 9, 2025
9bb3ad1
fix: update react and next to stable versions
KayTV Dec 10, 2025
7d59684
format
KayTV Dec 10, 2025
452fa30
fix
KayTV Dec 10, 2025
44de7e2
fix: fix for input cutoff
KayTV Dec 10, 2025
5add4ae
Merge pull request #83 from navapbc/fix/cutoff-of-input
KayTV Dec 10, 2025
a4db382
fix: remove javascript notification
KayTV Dec 11, 2025
5f39efd
Merge pull request #84 from navapbc/fix/js-notification
KayTV Dec 11, 2025
eadd4d4
Merge pull request #82 from navapbc/fix/react-update
KayTV Dec 12, 2025
3b7d22e
fix: browser session isolation - prevent cross-session visibility
fg-nava Dec 16, 2025
56f3077
fix: remove timestamp parsing from sessionId that breaks with new format
fg-nava Dec 16, 2025
c03fe31
fix: disable cacheComponents to allow runtime env vars in API routes
fg-nava Dec 16, 2025
663da31
Merge pull request #86 from navapbc/fix/disable-cache-components-for-…
fg-nava Dec 16, 2025
48e95d1
Merge pull request #85 from navapbc/fix/browser-session-isolation
fg-nava Dec 16, 2025
0ec9dd2
feat: add shared link API for pre-populating chat via external POST
fg-nava Dec 31, 2025
5c42a11
feat: use encrypted Redis storage for shared links
fg-nava Dec 31, 2025
9551abf
fix: use x-forwarded-host for Cloud Run URL fallback
fg-nava Dec 31, 2025
7f30cd1
fix: re-throw Next.js redirect errors in catch block
fg-nava Dec 31, 2025
7be96d5
fix: skip /home redirect when ?query= param is present
fg-nava Dec 31, 2025
dead571
fix: use cookie instead of query param for shared link content
fg-nava Dec 31, 2025
60b353a
fix: use x-forwarded-host for redirect URL on Cloud Run
fg-nava Jan 2, 2026
a53daba
refactor: remove legacy query param support, use cookie only
fg-nava Jan 2, 2026
271af81
Merge pull request #87 from navapbc/feat/shared-link-api
fg-nava Jan 2, 2026
654e11d
feat: validate and format incoming JSON content from /link
fg-nava Jan 6, 2026
d63b8b4
refactor: use XML tags for partner data context and add collapsible UI
fg-nava Jan 6, 2026
425df75
fix: reorder message/collapsible and strip task from displayed JSON
fg-nava Jan 6, 2026
e0b1282
refactor: extract parsePartnerData helper function
fg-nava Jan 8, 2026
11c8ca4
Merge pull request #89 from navapbc/feat/format-link-content
fg-nava Jan 8, 2026
6c1f20f
fix: use GCS_BUCKET_NAME env var instead of hardcoded bucket name
fg-nava Jan 9, 2026
e6cdef4
Merge pull request #90 from navapbc/fix/gcs-bucket-env-var
fg-nava Jan 9, 2026
548652e
fix: loading state for browser
KayTV Jan 13, 2026
b0ffd84
chore: update DATABASE_URL example for local postgres container
fg-nava Jan 13, 2026
b2408fb
Merge pull request #92 from navapbc/hotfix/local-postgres-env-example
fg-nava Jan 13, 2026
2869266
style fixes
KayTV Jan 13, 2026
62c050f
chore: add dependabot config
fg-nava Jan 13, 2026
479ae37
Merge pull request #93 from navapbc/chore/add-dependabot
fg-nava Jan 13, 2026
bc82644
Update artifacts/browser/client.tsx
KayTV Jan 14, 2026
bcb35a7
Update artifacts/browser/client.tsx
KayTV Jan 14, 2026
04b8e41
reusable component
KayTV Jan 14, 2026
2cd5103
Merge pull request #91 from navapbc/fix/browser-loading
KayTV Jan 14, 2026
301245a
feat: add in a captcha alert to take over the browser
KayTV Jan 14, 2026
a07ddec
fix: prompt changes for apricot data
KayTV Jan 15, 2026
8ba9986
Merge pull request #96 from navapbc/fix/prompt-change
KayTV Jan 15, 2026
b429cef
Update artifacts/browser/client.tsx
KayTV Jan 15, 2026
681df6e
changes
KayTV Jan 16, 2026
05b83e6
changes
KayTV Jan 23, 2026
383914d
fix: comment out calls to vote and documents
KayTV Jan 23, 2026
0a5fc39
Merge pull request #97 from navapbc/fix/remove-vote-call
KayTV Jan 23, 2026
b6abc86
artifact
KayTV Jan 23, 2026
eb8a493
Merge pull request #94 from navapbc/feat/captcha-alert
KayTV Jan 26, 2026
1de0b88
feat: limit the authentication for the google and microsoft logins
KayTV Jan 26, 2026
ebe1412
fix
KayTV Jan 26, 2026
a869a0e
sign out
KayTV Jan 26, 2026
d64d70b
feat: removal of guest access
KayTV Jan 26, 2026
1dbe25f
fix: css fixes to style sheet
KayTV Jan 27, 2026
e260a8c
route file
KayTV Jan 27, 2026
2f64e28
fix
KayTV Jan 27, 2026
e8ff75b
fix
KayTV Jan 27, 2026
583f3aa
amplify
KayTV Jan 27, 2026
096386e
Merge pull request #101 from navapbc/fix/css-update-fix
KayTV Jan 27, 2026
30f3b35
Merge pull request #100 from navapbc/feat/remove-guest-access
KayTV Jan 27, 2026
903e62b
Merge pull request #98 from navapbc/feat/auth-check
KayTV Jan 27, 2026
1047d92
feat: migrate web automation to AI SDK and Kernel.sh
fg-nava Jan 27, 2026
8857980
fix: update test mocks for AI SDK v6
fg-nava Jan 27, 2026
79dfeab
fix: add missing apricot models and update AI SDK types
fg-nava Jan 27, 2026
8c9492e
fix: redis fix for auth
KayTV Jan 28, 2026
fc1e384
feat: upgrade web automation model to gemini-3-pro-preview
fg-nava Jan 28, 2026
eaeef61
Merge pull request #103 from navapbc/fix/redis-auth
KayTV Jan 28, 2026
cd184ca
fix: edits to style based on new style guide
KayTV Jan 29, 2026
55a9a76
Merge pull request #104 from navapbc/fix/color-scheme
KayTV Jan 29, 2026
17ca54a
fix: don't report stderr as error on successful browser commands
fg-nava Jan 29, 2026
7d677b6
fix: improve Kernel browser display — proper sizing, kiosk mode, and …
fg-nava Jan 29, 2026
366a2ac
feat: switch web automation agent to Claude Opus 4.5
fg-nava Jan 29, 2026
237ae5c
fix: improve agent-browser skill doc for better form filling
fg-nava Jan 29, 2026
a60dc87
feat: enable stealth mode, 3s timeout, CAPTCHA/eval guardrails
fg-nava Jan 29, 2026
2beef9c
merge: integrate origin/labs-asp into feat/ai-sdk-kernel-migration
fg-nava Jan 29, 2026
22d1121
fix: add @ai-sdk/anthropic to package.json
fg-nava Jan 29, 2026
85cb050
fix: add optional chaining for session in chat.tsx
fg-nava Jan 29, 2026
9d64592
fix: update hardcoded color to use theme token (text-muted-foreground)
fg-nava Jan 29, 2026
4abb308
Merge pull request #102 from navapbc/feat/ai-sdk-kernel-migration
fg-nava Jan 30, 2026
95a75d8
debug: log actual DB error in saveChat
fg-nava Jan 30, 2026
955ae2c
Merge pull request #106 from navapbc/hotfix/debug-save-chat
fg-nava Jan 30, 2026
570bc4a
fix: use DB user ID in OAuth sign-in instead of provider sub claim
fg-nava Jan 30, 2026
f741ade
Merge pull request #107 from navapbc/hotfix/oauth-user-id
fg-nava Jan 30, 2026
9b43448
fix: remove unsupported --timeout flag from agent-browser CLI
fg-nava Jan 30, 2026
bbfaaa8
Merge pull request #108 from navapbc/hotfix/remove-timeout-flag
fg-nava Jan 30, 2026
8863e99
fix: change button colors for take control
KayTV Jan 30, 2026
a0f903d
Merge pull request #109 from navapbc/fix/style-changes
KayTV Jan 30, 2026
bd85697
feat: create a guest login feature flag
KayTV Feb 2, 2026
3708285
fix
KayTV Feb 2, 2026
ac05caf
auto login
KayTV Feb 2, 2026
8a42782
fix
KayTV Feb 2, 2026
a3a17e2
fix
KayTV Feb 2, 2026
c8ede6f
fix: update apricot api data for the AI SDK
KayTV Feb 2, 2026
502f15b
Merge pull request #111 from navapbc/feat/guest-mode-access
KayTV Feb 2, 2026
e056e7c
Merge branch 'labs-asp' into fix/apricot-data-sdk
KayTV Feb 2, 2026
4f395af
Merge pull request #112 from navapbc/fix/apricot-data-sdk
KayTV Feb 3, 2026
7dae3a6
fix: kernel browser session isolation, ownership validation, and cleanup
fg-nava Jan 30, 2026
cdcc8d2
fix: use lastAccessedAt for TTL to avoid evicting active sessions
fg-nava Feb 3, 2026
6a542f4
fix: changes to prompt (welcome page) and AI SDK env var
KayTV Feb 3, 2026
631d14b
feat: use ENVIRONMENT variable for Apricot API environment detection
fg-nava Feb 3, 2026
8dde892
Merge pull request #114 from navapbc/fix/prompt-edits
KayTV Feb 3, 2026
6085f5b
fix: resolve merge conflict, keep debug logging
fg-nava Feb 3, 2026
287d855
Merge pull request #115 from navapbc/feat/apricot-separate-credentials
fg-nava Feb 3, 2026
e0aea98
feat: refactor agent-browser-skills
fg-nava Feb 3, 2026
294a10c
Merge pull request #110 from navapbc/fix/session-leakage
fg-nava Feb 3, 2026
71aeaa8
fix: stale closure in Take Control button event handler
fg-nava Feb 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 75 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,19 +1,84 @@
# Generate a random secret: https://generate-secret.vercel.app/32 or `openssl rand -base64 32`
AUTH_SECRET=****

# The following keys below are automatically created and
# added to your environment when you deploy on vercel
# Google OAuth (for Google sign-in)
GOOGLE_CLIENT_ID=****
GOOGLE_CLIENT_SECRET=****

# Get your xAI API Key here for chat and image models: https://console.x.ai/
# xAI API Key for chat and image models: https://console.x.ai/
XAI_API_KEY=****

# Instructions to create a Vercel Blob Store here: https://vercel.com/docs/storage/vercel-blob
BLOB_READ_WRITE_TOKEN=****
# PostgreSQL database - used by both client and Mastra
# Client: Chat history, votes, documents, user data
# Mastra: Agent memory, workflows, traces, participants data
# For local development with Docker postgres container:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/labs_asp_dev"
# For Docker-to-Docker communication (used inside containers):
# DATABASE_URL="postgresql://postgres:postgres@postgres:5432/labs_asp_dev"

# Instructions to create a PostgreSQL database here: https://vercel.com/docs/storage/vercel-postgres/quickstart
POSTGRES_URL=****
# OpenAI API Key (primary AI provider)
OPENAI_API_KEY=****

# Alternative API keys (optional)
ANTHROPIC_API_KEY=****
GOOGLE_GENERATIVE_AI_API_KEY=****
EXA_API_KEY=****

# Instructions to create a Redis store here:
# https://vercel.com/docs/redis
REDIS_URL=****
# Google Cloud Configuration
GOOGLE_VERTEX_LOCATION=****
GOOGLE_VERTEX_PROJECT=****
GOOGLE_APPLICATION_CREDENTIALS=./vertex-ai-credentials.json
GOOGLE_CLOUD_PROJECT=****

# Google Cloud Storage for file uploads
GCS_BUCKET_NAME=****

# Mastra Backend API for web automation
# MASTRA_SERVER_URL is used by the client to connect to the Mastra backend
# For local development: http://localhost:4111
# For Docker deployment: http://localhost:4111 (external port mapping)
MASTRA_API_URL=****
MASTRA_JWT_TOKEN=****
MASTRA_SERVER_URL=http://localhost:4111

# NEXT_PUBLIC_MASTRA_SERVER_URL is required for client-side requests to Mastra
# This MUST be set at build time for Next.js to embed it in the client bundle
# For local development: http://localhost:4111
# For Docker deployment: http://localhost:4111 (external port mapping)
NEXT_PUBLIC_MASTRA_SERVER_URL=http://localhost:4111

# Upstash Redis for shared links
# Create a Redis database at https://console.upstash.com/
UPSTASH_REDIS_REST_URL=****
UPSTASH_REDIS_REST_TOKEN=****

# Microsoft login
AUTH_MICROSOFT_ENTRA_ID_ID=***
AUTH_MICROSOFT_ENTRA_ID_SECRET=***
AUTH_MICROSOFT_ENTRA_ID_ISSUER=https://login.microsoftonline.com/common/v2.0

# Cloudflare Verified Bots - Ed25519 private key in PEM format
# Used to sign the /.well-known/http-message-signatures-directory response
CLOUDFLARE_BOT_PRIVATE_KEY=****

# Apricot API Information
# Prod and sandbox require separate credentials (different client_id/secret for each)
# The correct credentials are selected based on ENVIRONMENT variable
APRICOT_API_BASE_URL=https://f5r-api.iws.sidekick.solutions/apricot
APRICOT_ORG_ID_SANDBOX=****
APRICOT_ORG_ID_PROD=****
# For local dev, use sandbox credentials:
APRICOT_CLIENT_ID=****
APRICOT_CLIENT_SECRET=****

# Feature flag for AI SDK agent vs Mastra
USE_AI_SDK_AGENT=false
NEXT_PUBLIC_USE_AI_SDK_AGENT=false
# Kernel.sh API key for remote browser management (used when USE_AI_SDK_AGENT=true)
KERNEL_API_KEY=****

# Feature flag for guest login in preview environments
# When true, enables a guest login form that bypasses OAuth
# Only enabled for preview-pr-* deployments
USE_GUEST_LOGIN=false
NEXT_PUBLIC_USE_GUEST_LOGIN=false
37 changes: 37 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: 2
updates:
# npm dependencies
- package-ecosystem: "npm"
directory: "/"
target-branch: "labs-asp"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 5
groups:
all-dependencies:
patterns:
- "*"
update-types:
- "minor"
- "patch"
labels:
- "dependencies"
commit-message:
prefix: "chore(deps)"

# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "labs-asp"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 3
labels:
- "dependencies"
- "ci"
commit-message:
prefix: "chore(ci)"
29 changes: 29 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Checklist

- [ ] Update PR Title to follow this pattern: `[INTENT]:[MESSAGE]`
> The title will become a one-line commit message in the git log, so be as concise and specific as possible -- refer to [How to Write a Git Commit Message](https://cbea.ms/git-commit/). Prepend [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) intent (`fix:`, `feat:`, `chore:`, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`).

## Ticket

Resolves #{TICKET NUMBER or URL or description} or Adds {new capability or feature}

## Changes

> What was added, updated, or removed in this PR.
> Prefer small PRs; try to limit to 300 lines of code changes
> * https://blog.logrocket.com/using-stacked-pull-requests-in-github/
> * https://opensource.com/article/18/6/anatomy-perfect-pull-request
> * https://developers.google.com/blockly/guides/modify/contribute/write_a_good_pr

## Testing

> What was tested? How did you test it? Add unit tests for new functions, integration tests for API/database interactions, and E2E tests for critical user flows.
> * https://martinfowler.com/articles/practical-test-pyramid.html
> * https://blog.logrocket.com/javascript-testing-best-practices/
> * https://www.testim.io/blog/typescript-unit-testing-101/

## Context for reviewers

> Background context, more in-depth details of the implementation, and anything else you'd like to call out or ask reviewers.
> Add comments to your code under the "Files Changed" tab to explain complex logic or code
> * https://betterprogramming.pub/how-to-make-a-perfect-pull-request-3578fb4c112
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ node_modules

# testing
coverage
artifacts/session_*

# next.js
.next/
Expand Down Expand Up @@ -41,3 +42,5 @@ yarn-error.log*
/playwright-report/
/blob-report/
/playwright/*
.mastra/
vertex-ai-credentials.json
8 changes: 7 additions & 1 deletion app/(auth)/api/auth/guest/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import { NextResponse } from 'next/server';

export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const redirectUrl = searchParams.get('redirectUrl') || '/';
let redirectUrl = searchParams.get('redirectUrl') || '/';

// Fix localhost redirects to use the current host
if (redirectUrl.includes('localhost:3000')) {
const currentUrl = new URL(request.url);
redirectUrl = redirectUrl.replace('http://localhost:3000', `${currentUrl.protocol}//${currentUrl.host}`);
}

const token = await getToken({
req: request,
Expand Down
1 change: 1 addition & 0 deletions app/(auth)/auth.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const authConfig = {
pages: {
signIn: '/login',
newUser: '/',
error: '/login',
},
providers: [
// added later in auth.ts since it requires bcrypt which is only compatible with Node.js
Expand Down
84 changes: 77 additions & 7 deletions app/(auth)/auth.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { compare } from 'bcrypt-ts';
import NextAuth, { type DefaultSession } from 'next-auth';
import Credentials from 'next-auth/providers/credentials';
import { createGuestUser, getUser } from '@/lib/db/queries';
import Google from 'next-auth/providers/google';
import MicrosoftEntraID from "next-auth/providers/microsoft-entra-id";
import { getUser, upsertOAuthUser, ensureUserExists } from '@/lib/db/queries';
import { authConfig } from './auth.config';
import { DUMMY_PASSWORD } from '@/lib/constants';
import type { DefaultJWT } from 'next-auth/jwt';

export type UserType = 'guest' | 'regular';
// Feature flag for guest login in preview environments
const useGuestLogin = process.env.USE_GUEST_LOGIN === 'true';

// Fixed guest user for preview environments (using a valid UUID)
const GUEST_USER_ID = '00000000-0000-0000-0000-000000000001';
const GUEST_USER_EMAIL = 'guest@preview.local';

export type UserType = 'regular';

declare module 'next-auth' {
interface Session extends DefaultSession {
Expand Down Expand Up @@ -37,9 +46,38 @@ export const {
signOut,
} = NextAuth({
...authConfig,
trustHost: true,
providers: [
Google({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
}),
MicrosoftEntraID({
clientId: process.env.AUTH_MICROSOFT_ENTRA_ID_ID,
clientSecret: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET,
issuer: process.env.AUTH_MICROSOFT_ENTRA_ID_ISSUER,
authorization: {
params: {
scope: "openid profile email User.Read"
}
},
profile(profile) {
// Multi-tenant apps don't reliably return email claim, use preferred_username
return {
id: profile.sub,
name: profile.name,
email: profile.preferred_username || profile.email || profile.upn,
image: profile.picture,
type: 'regular' as const,
}
}
}),
Credentials({
credentials: {},
name: 'credentials',
credentials: {
email: { label: 'Email', type: 'email' },
password: { label: 'Password', type: 'password' }
},
async authorize({ email, password }: any) {
const users = await getUser(email);

Expand All @@ -62,20 +100,52 @@ export const {
return { ...user, type: 'regular' };
},
}),
// Guest provider for preview environments - auto-logs in without credentials
Credentials({
id: 'guest',
name: 'guest',
credentials: {},
async authorize() {
const [guestUser] = await createGuestUser();
return { ...guestUser, type: 'guest' };
if (!useGuestLogin) {
return null;
}

// Create or get the guest user
const guestUser = await ensureUserExists({
id: GUEST_USER_ID,
email: GUEST_USER_EMAIL,
});

return { ...guestUser, type: 'regular' as const };
},
}),
],
callbacks: {
async jwt({ token, user }) {
async signIn({ user, account, profile }) {
// Handle OAuth sign-in with domain validation
if (account?.provider === 'google' || account?.provider === 'microsoft-entra-id') {
const email = user.email?.toLowerCase() || '';
const allowedDomains = ['@navapbc.com', '@rivco.org', '@navapbc.onmicrosoft.com', '@amplifi.org'];
const isAllowedDomain = allowedDomains.some(domain => email.endsWith(domain));

if (!isAllowedDomain) {
return false;
}

const dbUser = await upsertOAuthUser({
email: user.email!,
name: user.name,
image: user.image,
});
// Use the DB-generated user ID, not the OAuth provider's sub claim
user.id = dbUser.id;
}
return true;
},
async jwt({ token, user, account }) {
if (user) {
token.id = user.id as string;
token.type = user.type;
token.type = account?.provider === 'google' || account?.provider === 'microsoft-entra-id' ? 'regular' : user.type;
}

return token;
Expand Down
Loading