Commit Graph

37 Commits

Author SHA1 Message Date
Danny White
05dc676d36 feat(studio): incident-aware AI assistant (#41603)
* handling and mock data support

* admonition

* only show in empty state

* rabbit

* mock without local overrides

* remove admonition

* make incident banner more prominent

* remove mock data

* move to tool

* prettier

* fix(studio): get_active_incidents tool

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2026-01-21 13:52:29 +11:00
Ali Waseem
75af928495 feat: added new rules for splinter updates (#41719)
* added new rules for splinter updates

* Use Markdown instead of ReactMarkdown

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-01-06 16:09:54 +00:00
Saxon Fletcher
d2f4e808e5 Filter pattern refactor (#41545)
* filter refactor

* update tests

* prettier

* fix ts

* remove filter preview

* Filter bar in table editor behind flag (#41546)

filter bar in table editor behind flag

* fixes

* ts fix

* filter v1 refactor

* rename helpers

* unmount timeout

* fixes

* fix

* more
2026-01-06 08:04:28 +10:00
Ivan Vasilov
f3af2c3d3c feat: SQL Snippets (#41112)
* Use the .sql suffix when generating ids.

* Fix a bug where a new snippet would not show up in the snippet list until refresh.

* Add API routes which serve file snippets.

* Refactor the renameSnippet and moveSnippet to work with file snippets.

* Change the link to the SQL Editor.

* Minor fixes from CodeRabbit.

* Check the file/folder name for invalid chars.

* More fixes from CodeRabbit review.

* Fix minor issues.

* Use zod to parse the snippet ids when deleting.

* Try to fix snyk issue.

* Add validation to the GET content index route.

* Minor fixes.

* Show create a new folder, it was hidden by mistake.

* Add SNIPPETS_MANAGEMENT_FOLDER env var.

* Add snippets folder in the docker-compose.

* Add error toasts if the env var is not set.

* Add snippets management folder to the generateLocalEnv script.

* Revert the docker-compose changes, will be done in a followup PR.

* Revert also the snippets volume folder.

* Remove unneeded line.
2025-12-23 12:09:37 +01:00
Matt Rossman
072883bcec feat: assistant evals (#41311)
* chore: bump `supabase` CLI

* chore: stricter message types in `generate-v4.ts`

* feat: tutorial eval

https://www.braintrust.dev/docs/evaluation

* feat: project ID for eval

* refactor: `generateAssistantResponse` out of `handlePost`

* refactor: generateAssistantResponse to lib/ai

* feat: factuality eval with assistant response

* chore: upgrade braintrust to v1.0.1

* chore: silence tsconfig warning

* feat: assertion scorer

* fix: aggregate tools across all steps

* refactor: strict tool names, remove need for `as const`

* refactor: generic tool name type in assertions

* feat: transfer mocks from `feature/braintrust`

* feat: LLM criteria assertion

* feat: braintrust evals workflow

* fix: BRAINTRUST_PROJECT_ID

* feat: `sql_similar` assertion

* fix: `OPENAI_API_KEY` in workflow env

* feat: split AssertionScorer into separate scorers

* feat: remove tutorial eval

* feat: 20 minute CI timeout

* feat: category in test case metadata

* feat: score with gpt-5

* refactor: dataset to own file, colocate scorers

* feat: "gpt-5.2-2025-12-11" for llm as a judge

* feat: SQL syntax scorer with `libpg-query`

* feat: `evals:setup` and `evals:run` scripts

* feat: `evals:setup` in CI

* feat: human readable scorer names

* chore: rename to "SQL Validity"

* feat: add 2 "sql_generation" test cases

* feat: update requiredTools in test cases

* chore: ignore Cursor MCP config

* feat: "Conciseness" score

* feat: "Completeness" scorer

* fix: generate-v4 test mocks

* feat: serialize "steps" for scorer inputs

* updated node mem options for typecheck

* updated runner

* remove ram update as actions handle this

* feat: read `BRAINTRUST_PROJECT_ID` from secrets

* feat: score helpfulness, remove old scorers

* feat: separate `evals:run` and `evals:upload` scripts

* feat: passthrough entire classifier result

* feat: use live `search_docs` impl, store docs result in metadata

* feat: reduce classifier options

* feat: filter workflow by `run-evals` PR label or `master` branch

* chore: cleanup stubbed mock tools

* fix: checkout actual branch with `ref:`

* fix: capture search_docs results from all content parts

* feat: simplify sql syntax score calculation

* feat: use AI SDK's UI message validator

* docs: justification for relative `extends`

* fix: cleanup leftover validatedMessages

* doc: note mock token isn't secret for snyk

* fix: mock ui message to pass validation

* feat: revert ignoring Cursor MCP config

Using `.git/info/exclude` instead until we have an opinion on this

* feat: add "tsconfig" as shared-data devDependency, revert relative path in tsconfig

* refactor: tool call parsing into function

* Update apps/studio/evals/assistant.eval.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* refactor: organize mock schemas and tool factories

---------

Co-authored-by: Ali Waseem <waseema393@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-22 23:45:48 -05:00
Danny White
f0acececce feat(studio): incident notice on support ticket creation (#41379)
* callout

* progress

* plural issues

* better handle multiple issues

* refactor

* remove fancy copywriting

* return IncidentAdmonition to support form page

* progress

* cleanup

* rabbit

Potential control flow issue: execution continues after handleError when data is undefined. When a non-401 error occurs, handleError(error) is called but execution continues to line 24 where data is accessed. If handleError doesn't throw, this will cause a runtime error accessing (data as any).is_healthy on undefined. Additionally, the as any cast on line 24 violates the coding guidelines. Consider validating the response shape instead.

* animate in

* fix

* reset

* remove unused dayjs

* rabbit

* rabbit

* fixes from code review

* rabbit

* rabbit

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-12-19 00:28:02 +00:00
Ivan Vasilov
5fb5acc0b9 chore: Refactor the generation of ids for snippets (#41264)
* Add a generateDeterministicUuid function and tests for it.

* Use the new function and generate an id automatically when creating a snippet.

* Clean up extra code.

* Don't pass in id when creating a snippet.

* Add generateSnippetTitle function and use it instead of fixed string.

* When SQL editor is open, generate an id form a generated snippet title.

* Add id override for SQL editor to avoid flash when saving the snippet.

* Merge the two generate functions to happen in the same useMemo block.

* Save the snippet to the API when adding it.

* Minor fixes from CodeRabbit review.

* Hide new folder CTA in sql editor for self-hosted

* Don't add the snippet for saving, just set the value.

* UpsertContentPayload always has an id.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-16 09:43:59 +01:00
Charis
657ca2d97c feat(studio): endpoint to retrieve incident status (#41355)
Incident status banners/alerts should be automatically determined from
the status page, rather than being manually configured.

Adds a new endpoint, /api/incident-status, to return information about
active incidents. This information is fetched from the StatusPage API.
The endpoint is cached to reduce number of third-party API requests.

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-12-15 22:42:37 +00:00
Pedro Rodrigues
9d12f0bc86 chore: bump mcp version to 0.5.9 (#41052)
chore: bump MCP server to 0.5.9 and utils to 0.2.4
2025-12-09 16:31:34 +00:00
Joshen Lim
91209faab1 Remove unused old env var (#41178)
* Remove unused old env var

* Update apps/studio/lib/api/apiHelpers.ts

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>

* Fix

* Add comment

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2025-12-09 13:22:10 +08:00
Joshen Lim
27200aa52a Patch lints (#40783) 2025-11-26 00:16:45 +08:00
Zach Gorton
9bf15f9675 fix(mcp): postgres-meta parameters binding for list_tables (#40499)
* add params to executeQuery

* revert env change

* chore: upgrade "supabase" to v2.58.5

---------

Co-authored-by: Matt Rossman <22670878+mattrossman@users.noreply.github.com>
Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-11-18 16:01:03 +00:00
Ali Waseem
23224301f2 updated to override pg vars (#40093)
Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2025-11-04 16:02:12 +08:00
Joshen Lim
0d44090aac Update lints for self-hosted (#40043)
* Update lints for self-hosted

* update comment

* Update apps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx

Co-authored-by: Ali Waseem <waseema393@gmail.com>

* revert

* Fix

* update comment

---------

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-11-01 01:28:05 +08:00
Joshen Lim
64e3e047eb Final final cleaning up barrel files (#40018)
* Final final cleaning up barrel files

* Fix merge conflict
2025-10-31 14:02:59 +08:00
Matt Rossman
9540428962 fix: supabase_admin user for self-hosted read/write queries (#39946) 2025-10-28 15:55:23 -04:00
Matt Rossman
9f5620c7cd feat: self-hosted MCP debugging tools (#39366)
* feat: stub `getDebuggingOperations`

* fix: logflare variables in `generateLocalEnv.js`

* chore: upgrade `supabase`, `@supabase/mcp-server-supabase`

* feat: shared `retrieveAnalyticsData`, implement `getLogs` for MCP

* feat: shared `getLints`, implement MCP security/performance advisors with filter

* chore: update lockfile

* fix: prefer `??`

Co-authored-by: Greg Richardson <greg.nmr@gmail.com>

* docs: comment origin of `LINT_SQL`

Co-authored-by: Greg Richardson <greg.nmr@gmail.com>

* chore: bump `supabase` devDependency for latest images

Changes rely on fix from loglare v1.23.0

* fix: edge function logs query

Based on https://github.com/supabase/supabase/pull/39388/files#diff-b4e9726d34a406fa1a6133a18bdb972c90be9df0c89598de0695592514e22941R199-R206

---------

Co-authored-by: Greg Richardson <greg.nmr@gmail.com>
2025-10-20 13:11:15 -04:00
Charis
4f0ce0a0e3 fix(support form): create api route to upload attachments (#39543)
* fix(support form): api route to create attachment urls

* clean: remove console log

* fix staging and prod

* Minor clean up

* Shift generation of urls to data folder

* refactor

* Final

* Fix tests

* Nit

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-15 16:29:35 +08:00
Alaister Young
ec6c90bce2 fix: support nimbus project urls for testing edge functions (#39548) 2025-10-15 15:12:35 +08:00
Han Qiao
e5bab8208e fix: set 24h format when converting postgres timestamp (#39494) 2025-10-14 00:42:30 +08:00
Kevin Grüneberg
f0436716f9 perf: use getClaims for API endpoint auth (#39311)
Use getClaims instead of getUser which avoids a network call to GoTrue to validate the user in case of asymmetric keys - this shaves off a good amount of latency for every API call.
2025-10-08 09:59:27 +08:00
Saxon Fletcher
d5bf4ef13b Rate assistant responses (#39224)
* rate assistant responses

* test

* always show
2025-10-06 22:46:30 +00:00
Matt Rossman
31b6368049 feat: read-only mode for self-hosted MCP (#39041)
* feat: add `crypto-js`, `encryptString` with sample key

* feat: include POSTGRES_PASSWORD in generated .env.test

* feat: include POSTGRES_PASSWORD in turbo.json for studio

* feat: read only query support

* feat: configurable `POSTGRES_HOST`, `POSTGRES_DB`, `POSTGRES_PORT`

* chore: rename POSTGRES_USER to clarify write permission

* feat: configurable `PG_META_CRYPTO_KEY`

* chore: add `PG_META_CRYPTO_KEY` to generateLocalEnv

* feat: add 'postgres-meta' to linter dictionary

* feat: restore read-only toggle in local MCP URL builder
2025-10-06 16:14:27 -04:00
Saxon Fletcher
626eb30e77 Assistant action orientated approach (#38806)
* update onboarding

* update model and fix part issue

* action orientated assistant

* fix tool

* lock

* remove unused filter

* fix tests

* fix again

* update package

* update container

* fix tests

* refactor(ai assistant): break out message markdown and profile picture

* wip

* refactor(ai assistant): break up message component

* refactor: break ai assistant message down into multiple files

* refactor: simplify ReportBlock state

* fix: styling of draggable report block header

When the drag handle is showing, it overlaps with the block header.
Decrease the opacity of the header so the handle can be seen and the two
can be distinguished.

* fix: minor tweaks to tool ui

* refactor: simplify DisplayBlockRenderer state

* fix: remove double deploy button in edge function block

When the confirm footer is shown, the deploy button on the top right should be
hidden (not just disabled) to avoid confusion.

* refactor, test: message sanitization by opt-in level

Refactor the message sanitization to have more type safety and be more testable.
Add tests to ensure:

- Message sanitization always runs on generate-v4
- Message sanitization correctly works by opt-in level

* Fix conflicts in pnpm lock

* Couple of nits and refactors

* Revert casing for report block snippet

* adjust sanitised prompt

* Fix tests

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-09-29 03:57:36 +00:00
Matt Rossman
e2960f38ed feat: self-hosted MCP development tools (#39022)
* feat: stub `getDevelopmentOperations`

* feat: `getProjectUrl`

* feat: `getAnonKey`

* feat: `generateTypescriptTypes`

* chore: comment for consistency

* fix: "development" in supported feature group schema

* fix: `ResponseError` checks

* chore: rename `typescript.ts` to `generate-types.ts`

* chore: unused import
2025-09-26 09:02:15 -04:00
Greg Richardson
081a75350e fix(local-mcp): database operations (#38965)
* fix(local-mcp): return values from database operations

* fix(local-mcp): pg-meta status code forwarding
2025-09-23 16:41:36 -06:00
Greg Richardson
9820707d71 feat: local mcp server (#38797)
* feat: local mcp server

* feat(local-mcp): implement migrations

* fix: remove unsupported mcp args

* feat(local-mcp): tests

* fix(local-mcp): packages to adhere to minimumReleaseAge

* fix(mcp): import path for createSupabaseApiPlatform

* fix(local-mcp): move tests out of pages/api dir

* refactor: self-hosted execute sql logic

* fix: deps
2025-09-23 12:00:08 -06:00
Charis
283b125369 fix: failing type errors in build (#38761)
* fix(www): types for awaited params

* fix(docs): no extraneous exports from route page

* fix(studio): api handler types, no non-handlers allowed in pages
2025-09-17 15:55:38 +10:00
Joshen Lim
dbb413beeb Chore/deprecate lib common fetch 03 (#36529)
* Deprecate use of getWithTimeout, refactor BuildingState and RestoringState to use RQ

* Refactor profile-create-mutation to use data/fetchers, and edge-function-status-query to use fetch

* Shift post from lib/common/fetch, refactor bucket-object-download-mutation

* Address feedback

* Minor fix

* Refactor post calls from lib/common/fetch in auth pages to data/fetchers

* Add missing POST users endpoint + small fix when deleting user via context menu

* Remove all use of any imports from lib/common/fetch

* Clean up remaining usage of lib/common/fetch

* Fix fetchHeadWithTimeout

* simplify handleFetchError

* allow handleFetchError to accept unknown

* non-breaking change

* small fixes

* fix query path

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-07-21 16:59:17 +08:00
Jordi Enric
9e72050658 Add regex guard for edge functions test endpoint (#35688)
* Add regex guard for edge functions test endpoint

* Remove conosle log

* add tests

* empty

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-05-15 08:57:06 +00:00
Alaister Young
6c83f97478 fix: local api route fixes (#35642)
* fix: local api route fixes

* fix build

* fix tests

* address feedback

* remove unused debug
2025-05-14 15:26:50 +00:00
Jordi Enric
6e91494b16 Add coveralls integration (#35424)
* update gh action, update vitest config

* debug

* debug cov

* idk try something different

* test2

* test3

* add base path

* rm debug

* add apiAuthenticate tests

* supabaseClient tests

* apiWrappers tests

* add apiHelpers tests

* add configcat tests

* add formatSql tests

* add github tests

* add cloudprovider utils tests

* add helpers tests

* fix typeerr

* add missing readonly err

* fix typeerrrs

* fix type errors in apiWrapper tests

* fix apiHelpers test

* add packages/ui tests

* add coveralls flags

* try coveralls parallel config

* fix coveralls parallel config

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-05-08 12:23:37 +02:00
Terry Sutton
dff6c817ae Chore/assistant in self hosted (#33422)
* Add layoutheader to self-hosted to allow showing assistant

* Fix layout

* Remove debug checks

* Check for key

* Dont load tables

* Fix assistant error handling

* Yeet

* Update turbo.json

* Another one

* god

* Fix

* Add fallback

* last attempt to fix

* Clean up

* take the wheel

* Tiny fix

* Skip enrich query for local, to match prod

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-02-18 17:37:53 +08:00
Ivan Vasilov
92955d5555 chore: Bump sentry to v8+ (#29896)
* Bump sentry to v8.

* Fix all obsolete APIs.

* Fix the sentry configs.

* Add pages for testing sentry.

* Add missing imports to sentry.config file.

* Add base path to the api path.

* Remove extra files.
2024-10-17 11:39:06 +02:00
Kevin Grüneberg
f9a55935f5 chore: use type imports for types/interfaces (#21738) 2024-03-04 20:48:22 +08:00
Kevin Grüneberg
d12332ea5a chore: xmas cleanup (#19938) 2024-01-04 17:27:49 +01:00
Ivan Vasilov
436bdb10ae chore: Move the studio app to apps/studio (#18915)
* Move all studio files from /studio to /apps/studio.

* Move studio specific prettier ignores.

* Fix the ui references from studio.

* Fix the css imports.

* Fix all package.json issues.

* Fix the prettier setup for the studio app.

* Add .turbo folder to prettierignore.

* Fix the github workflows.
2023-11-15 12:38:55 +01:00