@neon/skills 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/neon/SKILL.md +1 -1
- package/skills/neon-ai-gateway/SKILL.md +6 -5
- package/skills/neon-functions/SKILL.md +38 -9
- package/skills/neon-postgres/references/hybrid-search.md +1 -1
- package/skills/neon-postgres/references/vector-search.md +1 -1
- package/skills/neon-realtime/SKILL.md +1 -1
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "neon-postgres",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.3",
|
|
5
5
|
"description": "Manage your Neon backend with the Neon agent skills and the Neon MCP Server: Lakebase Postgres, Managed Better Auth, Realtime, Object Storage, Functions, the Data API, and AI Gateway",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Neon",
|
package/skills/neon/SKILL.md
CHANGED
|
@@ -517,6 +517,6 @@ neon feedback --message "Describe what failed, including the command and sanitiz
|
|
|
517
517
|
|
|
518
518
|
If that check fails, inspect the available Neon MCP tools and use `send_feedback` only when it is present and can run without asking the user to authenticate, configure tooling, or approve the request. If neither option is available, skip feedback silently. Do not install, upgrade, authenticate, or configure tooling only to send feedback.
|
|
519
519
|
|
|
520
|
-
|
|
520
|
+
The goal is to improve the user's experience without interrupting or getting in the way of their current work. If submission fails, do not retry. Finish the user's task normally.
|
|
521
521
|
|
|
522
522
|
**Never send secrets or sensitive data.** Remove credentials, tokens, API keys, passwords, personal or customer data, and confidential project details from the report. Send only the issue report described above; do not collect or infer analytics.
|
|
@@ -61,14 +61,15 @@ Check these preconditions before setting anything up:
|
|
|
61
61
|
|
|
62
62
|
The AI Gateway is currently available in `aws-us-east-2`, `aws-us-east-1`, `aws-eu-central-1`, and `aws-ap-southeast-1`. Confirm the user's project is in one of these regions.
|
|
63
63
|
|
|
64
|
-
The AI Gateway is available on
|
|
64
|
+
The AI Gateway is available on every Neon plan, including Free, and draws down prepaid AI Gateway credits. On the Free plan, the user adds a payment card and buys credits on the **Billing** page; the organization stays on Free. Any account with prepaid credits can call every model in the catalog, with no difference in pricing or model access between plans. See https://neon.com/docs/ai-gateway/prepaid-credits.md.
|
|
65
65
|
|
|
66
|
-
### Enabling the gateway:
|
|
66
|
+
### Enabling the gateway: credits and model access
|
|
67
67
|
|
|
68
|
-
The AI Gateway is credential-gated rather than a provisioning step.
|
|
68
|
+
The AI Gateway is credential-gated rather than a provisioning step. `neon config apply` / `deploy`, `neon checkout`, and `neon env pull` mint the branch credential and write `NEON_AI_GATEWAY_BASE_URL` and `NEON_AI_GATEWAY_TOKEN` on every plan. Whether the account can serve a model is decided per request:
|
|
69
69
|
|
|
70
|
-
- **
|
|
71
|
-
- **
|
|
70
|
+
- **No card and credits yet → no model is enabled.** An account that hasn't added a card and bought AI Gateway credits, which includes every new Free account, gets every catalog model from `GET /v1/models` with `enabled: false`, `unavailable_reason: "paid_plan_required"`, and a `recovery_url` pointing at the organization's Billing page, and a request returns `403` with the same `unavailable_reason`. Despite the name, the fix is adding a card and buying credits, not upgrading the plan. `neon env pull` (and the env pull bundled into `apply` / `deploy` / `checkout`) warns when no model is enabled, names the reason, and links the `recovery_url`.
|
|
71
|
+
- **Locked models.** `neon env pull` also warns when some models are enabled but no flagship model (e.g. Anthropic Opus, OpenAI Codex / `*-pro`) is among them, and links to the branch's AI Gateway page in the Neon Console (`https://console.neon.tech/app/projects/<project-id>/branches/<branch-id>/ai-gateway`). That page lists locked models under **Some models are restricted**, grouped by reason, each with its fix: **Add a card** and buy credits, **Add credits** for prepaid credits, or Support for an account restriction or a model not available to the account. After the user buys credits, models unlock once Neon confirms access. No CLI warning does not mean every model is enabled; check the model's `enabled` value. See https://neon.com/docs/ai-gateway/troubleshooting.md.
|
|
72
|
+
- **Older CLI.** `neon` 8.23.3 and earlier refuse `aiGateway` on a Free plan with "isn't available on the Free plan". Update with `npm i -g neon@latest` (8.23.4 or later) and re-run.
|
|
72
73
|
|
|
73
74
|
## Setup
|
|
74
75
|
|
|
@@ -190,18 +190,20 @@ export default defineConfig({
|
|
|
190
190
|
|
|
191
191
|
Neon injects branch-scoped connection strings and service URLs at runtime — you don't declare these or pass them at deploy time:
|
|
192
192
|
|
|
193
|
-
| Variable
|
|
194
|
-
|
|
|
195
|
-
| `NEON_BRANCH`
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
193
|
+
| Variable | Notes |
|
|
194
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
195
|
+
| `NEON_BRANCH` | The branch **name** (e.g. `main`, `preview/foo`). Injected on every branch, including the default. |
|
|
196
|
+
| `NEON_BRANCH_ID` | The branch **id** (`br-…`). Injected on every branch. |
|
|
197
|
+
| `NEON_FUNCTION_HOST_SUFFIX` | The hostname suffix every function on the branch shares (`.compute.c-2.us-east-2.aws.neon.tech`). See [How to get the function URL](#how-to-get-the-function-url). |
|
|
198
|
+
| `DATABASE_URL` | Pooled connection string. Use for most queries. Present only if the branch has Postgres. |
|
|
199
|
+
| `DATABASE_URL_UNPOOLED` | Direct connection. Use for migrations, `LISTEN`/`NOTIFY`, multi-round-trip transactions. |
|
|
200
|
+
| `NEON_AUTH_BASE_URL` | Present when Neon Auth is enabled on the branch. |
|
|
201
|
+
| `NEON_AUTH_JWKS_URL` | Present when Neon Auth is enabled on the branch. JWKS for verifying Managed Auth JWTs. |
|
|
202
|
+
| `NEON_DATA_API_URL` | Present when the Data API is enabled on the branch. |
|
|
201
203
|
|
|
202
204
|
Object storage (`AWS_*`) and AI Gateway (`NEON_AI_GATEWAY_*`) vars are also injected when those services are declared — see the `neon-object-storage` and `neon-ai-gateway` skills.
|
|
203
205
|
|
|
204
|
-
`neon env pull` / `neon-env run` / `neon dev` emit `NEON_BRANCH` (and the connection strings) into your local dev environment too, so local runs mirror the deployed runtime.
|
|
206
|
+
`neon env pull` / `neon-env run` / `neon dev` emit `NEON_BRANCH`, `NEON_BRANCH_ID`, `NEON_FUNCTION_HOST_SUFFIX` (and the connection strings) into your local dev environment too, so local runs mirror the deployed runtime.
|
|
205
207
|
|
|
206
208
|
**Your own secrets** are per-deployment. Preferred path: declare them in `neon.ts` and run `neon deploy --env <file>`. `<file>` is the gitignored file env pull already writes (`.env` if that file exists, otherwise `.env.local`). Env pull writes Neon-managed vars only; add Function secrets to that file. All declared Function env keys must be present. Omit a key from `neon.ts` if you do not want to write it. `undefined` means you asked to write the key and the value is missing (`defineConfig` throws). Never coerce a missing `process.env` value to an empty string: that uploads `""` and deletes the live key. An empty assignment in the file (`KEY=`) is also `""`. If TypeScript needs an assertion, use `process.env.X!` and make sure the file has the value:
|
|
207
209
|
|
|
@@ -219,6 +221,33 @@ functions: {
|
|
|
219
221
|
|
|
220
222
|
Load Function secrets into the same file env pull wrote, then `neon deploy --env <file>`. Pull the branch's Neon-managed vars onto disk for local dev with `neon env pull` (`link`/`checkout` do this automatically; pass `--no-env-pull` to skip and use `neon-env run -- <cmd>` for runtime injection). Limits: ≤1,000 vars, ≤64 KiB total, and the `NEON_` prefix is reserved.
|
|
221
223
|
|
|
224
|
+
## How to get the function URL
|
|
225
|
+
|
|
226
|
+
A function answers at `https://<NEON_BRANCH_ID>-<slug><NEON_FUNCTION_HOST_SUFFIX>`, for example `https://br-cool-lab-a1b2c3d4-todos.compute.c-2.us-east-2.aws.neon.tech`. Each branch has its own URL.
|
|
227
|
+
|
|
228
|
+
**From a terminal:** `neon functions get <slug>` prints it as `invocation_url`. `neon deploy` prints it for each function it deploys.
|
|
229
|
+
|
|
230
|
+
**From code** (another function, a script, or an app after `neon env pull`): call `functionBaseUrl(slug)` from `@neon/env` (2.0.0 or later). It returns the base URL with no trailing slash:
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { functionBaseUrl } from "@neon/env";
|
|
234
|
+
|
|
235
|
+
const res = await fetch(`${functionBaseUrl("todos")}/api/todos`);
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
| Where the code runs | `functionBaseUrl("todos")` returns |
|
|
239
|
+
| ------------------------------------------ | --------------------------------------------------- |
|
|
240
|
+
| A deployed function on the branch | `https://<branch_id>-todos.compute.…` (runtime env) |
|
|
241
|
+
| An app or script after `neon env pull` | the same URL, from the pulled env |
|
|
242
|
+
| `neon dev`, when it serves `todos` | `http://localhost:<port>` |
|
|
243
|
+
| `neon dev`, when it does not serve `todos` | the deployed URL on the linked branch |
|
|
244
|
+
|
|
245
|
+
It reads `process.env` by default. Pass the two variables explicitly when they come from elsewhere: `functionBaseUrl("todos", { NEON_BRANCH_ID, NEON_FUNCTION_HOST_SUFFIX })`. It throws when either variable is missing; run `neon env pull` (or `neon env pull -s functions` for only the branch variables) to fix that locally. The function does not have to be deployed for the URL to resolve, but the request fails until it is.
|
|
246
|
+
|
|
247
|
+
Browser code has no access to these variables. Build the URL on the server with `functionBaseUrl` and pass it to the client.
|
|
248
|
+
|
|
249
|
+
Older releases wrote one `NEON_FUNCTION_<SLUG>_BASE_URL` per function and exposed `env.functions.<slug>.baseUrl`. `neon` 9 and `@neon/env` 2 removed both, and `neon env pull` deletes those lines. Replace them with `functionBaseUrl("<slug>")`.
|
|
250
|
+
|
|
222
251
|
## Connecting to Postgres
|
|
223
252
|
|
|
224
253
|
When the branch has Postgres, Neon **injects the connection strings at runtime** — you don't declare them, pass them at deploy time, or hardcode anything. The two you'll use:
|
|
@@ -81,7 +81,7 @@ Use Neon's provider with the Vercel AI SDK. Requirements:
|
|
|
81
81
|
|
|
82
82
|
- Install the tested versions: `npm install @neon/ai-sdk-provider@1.1.0 ai@7.0.133`. Decision models require AI SDK 7.0.133+; pin versions and retest upgrades while `experimental_decide` is experimental.
|
|
83
83
|
- Load the same `NEON_AI_GATEWAY_TOKEN` and `NEON_AI_GATEWAY_BASE_URL` used for [embeddings](vector-search.md#prepare-embeddings); the provider handles the endpoint and credentials.
|
|
84
|
-
- The AI Gateway, for both Jev and embeddings, requires
|
|
84
|
+
- The AI Gateway, for both Jev and embeddings, requires prepaid AI Gateway credits, available on every Neon plan, including Free. Without them, embed documents and queries with one model from another provider and use [RRF](#rrf-example).
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
87
|
import { neon } from "@neon/ai-sdk-provider";
|
|
@@ -35,7 +35,7 @@ CREATE TABLE documents (
|
|
|
35
35
|
);
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
The AI Gateway is available on
|
|
38
|
+
The AI Gateway is available on every Neon plan, including Free, and draws down prepaid AI Gateway credits. If a model shows `enabled: false` in `GET /v1/models`, the branch's AI Gateway page in the Neon Console lists the reason and the fix. See the `neon-ai-gateway` skill.
|
|
39
39
|
|
|
40
40
|
Enable the AI Gateway on the branch and get `NEON_AI_GATEWAY_TOKEN` and the bare-host `NEON_AI_GATEWAY_BASE_URL`:
|
|
41
41
|
|
|
@@ -155,7 +155,7 @@ Migrating from Electric: Realtime is a drop-in replacement for Electric's role i
|
|
|
155
155
|
|
|
156
156
|
- **New app:** `neon bootstrap my-app --template realtime-react`, then `neon deploy` in `my-app`.
|
|
157
157
|
- **Enable** it on the linked branch with [`neon realtime enable --allowed-origin <app origin>`](https://neon.com/docs/cli/realtime.md), or declare [`preview: { realtime: true }`](https://neon.com/docs/reference/neon-ts.md#realtime) in `neon.ts` (`neon config add realtime`) and run `neon deploy`. Child branches inherit it. It's unavailable on Claimable projects until claimed, or outside the [supported regions](https://neon.com/docs/realtime/overview.md#which-regions-is-it-enabled-in).
|
|
158
|
-
- **Tables** need a [stable replica identity](references/queries.md#table-requirements); a primary key is enough.
|
|
158
|
+
- **Tables** need a [stable replica identity](references/queries.md#table-requirements); a primary key is enough. Leave [row-level security](references/queries.md#why-not-row-level-security) off on every table a live query reads: Realtime rejects those subscriptions with `unsupported query: row security`. For per-user data, authorize in the sealed query instead (see below).
|
|
159
159
|
- **Environment:** `neon env pull --service postgres --service realtime` writes `DATABASE_URL`, `NEON_REALTIME_URL` and `NEON_REALTIME_SECRET`. Expose only the URL to the browser, under your framework's public prefix (like `VITE_`). `url` options take `NEON_REALTIME_URL`; `db` takes the database name from `DATABASE_URL`.
|
|
160
160
|
- **Install** `@neon/realtime` and the packages chosen above. Use these SDKs, not the still-evolving WebSocket protocol.
|
|
161
161
|
|