neon 8.23.3 → 8.23.4

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/README.md CHANGED
@@ -694,7 +694,7 @@ export default defineConfig({
694
694
  ◯ Object Storage
695
695
  S3-compatible blob storage that branches with your projects.
696
696
  ◯ AI Gateway
697
- All models, one API, one bill. Powered by Databricks. Not available on the Neon free plan.
697
+ All models, one API, one bill. Powered by Databricks.
698
698
  ```
699
699
 
700
700
  Postgres cannot be unselected. Selecting nothing else is a valid answer: you get the starter policy, which is also what a non-interactive run (CI, no TTY) writes. Pass `--services` to skip the prompt anywhere:
@@ -11,9 +11,9 @@ import { looksLikeBranchId } from "../utils/formats.js";
11
11
  import { fillSingleProject, listAllProjectBranches } from "../utils/enrichers.js";
12
12
  import { buildCheckoutEvent, readGitContext } from "../utils/git.js";
13
13
  import { buildHookBranch, loadHookConfig, resolveHookEnv, runCheckoutAfterHook, runCheckoutBeforeHook, runCreateAfterHook, runCreateBeforeHook } from "../utils/hooks.js";
14
- import { n as autoPullEnvAfterPin } from "./env-BOt9AZ1j.js";
15
- import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-DZ3cDaOS.js";
16
- import { i as handler$1 } from "./link-VYCSKqU-.js";
14
+ import { n as autoPullEnvAfterPin } from "./env-C4-EYFmE.js";
15
+ import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-DPuP7ywm.js";
16
+ import { i as handler$1 } from "./link-PLk7-vwB.js";
17
17
  import chalk from "chalk";
18
18
  import prompts from "prompts";
19
19
  // src/commands/checkout.ts
@@ -12,7 +12,7 @@ import { projectConfigPath } from "../project.js";
12
12
  import { resolveEnvFilePath } from "../env_file.js";
13
13
  import { writer } from "../writer.js";
14
14
  import { noPassthrough } from "../utils/flags.js";
15
- import { c as pull } from "./env-BOt9AZ1j.js";
15
+ import { c as pull } from "./env-C4-EYFmE.js";
16
16
  import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
17
17
  import open from "open";
18
18
  import prompts from "prompts";
@@ -18,7 +18,6 @@ import { loadEnvFileIntoProcess } from "../env_file.js";
18
18
  import { formatInstallCommand, installArgs, resolvePackageManager, runCommandWithDetail } from "../utils/package_manager.js";
19
19
  import { writer } from "../writer.js";
20
20
  import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
21
- import { assertAiGatewayProvisionable, warnAiGateway } from "../utils/ai_gateway_notice.js";
22
21
  import { announceTargetBranch } from "../utils/branch_notice.js";
23
22
  import { renderAppliedChanges, renderBranchSettingConflicts, renderCustomDomainFollowup } from "../utils/config_diff.js";
24
23
  import { bundleEntry } from "../utils/esbuild.js";
@@ -27,7 +26,7 @@ import { readGitContext } from "../utils/git.js";
27
26
  import { resolveHookEnv, runDeployAfterHook, runDeployBeforeHook } from "../utils/hooks.js";
28
27
  import { pickServicesInteractively } from "../utils/service_picker.js";
29
28
  import { zipBundle } from "../utils/zip.js";
30
- import { n as autoPullEnvAfterPin } from "./env-BOt9AZ1j.js";
29
+ import { n as autoPullEnvAfterPin } from "./env-C4-EYFmE.js";
31
30
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
32
31
  import { dirname, join, relative, resolve } from "node:path";
33
32
  import chalk from "chalk";
@@ -740,11 +739,6 @@ const planCmd = async (props) => {
740
739
  const services = utilizedServices(config);
741
740
  reportPushResult(props, result, "plan", services);
742
741
  if (result.conflicts.some((conflict) => conflict.field === "customDomain" && !reasonAllowsUpdateExisting(conflict.reason))) process.exitCode = 1;
743
- if (services.includes("AI Gateway")) await warnAiGateway({
744
- apiClient: props.apiClient,
745
- projectId: props.projectId,
746
- branchId
747
- });
748
742
  };
749
743
  const warnDeprecatedPreview = (config, target) => {
750
744
  const message = previewGaWarningForConfig(config, target);
@@ -817,10 +811,6 @@ const applyCmd = async (props) => {
817
811
  announceTargetBranch(props, branch, "Applying to branch");
818
812
  warnDeprecatedPreview(config, warningTargetFromResolved(branch));
819
813
  const branchId = branch.branchId;
820
- if (utilizedServices(config).includes("AI Gateway")) await assertAiGatewayProvisionable({
821
- apiClient: props.apiClient,
822
- projectId: props.projectId
823
- });
824
814
  const cwd = process.cwd();
825
815
  const git = readGitContext(cwd);
826
816
  const event = { type: "neon-deploy" };
@@ -994,24 +984,6 @@ const reportConflicts = (props, conflicts) => {
994
984
  for (const conflict of conflicts) if (!reasonAllowsUpdateExisting(conflict.reason)) out.text(` ! ${conflict.field}: ${conflict.reason}\n`);
995
985
  };
996
986
  /**
997
- * Block provisioning the AI Gateway on a Free plan from the `checkout` policy paths, which
998
- * carry raw credentials (`apiKey`/`apiHost`) rather than the CLI's api client. Builds a client
999
- * from them and defers to {@link assertAiGatewayProvisionable}. Skipped when a `runtimeApi` is
1000
- * injected (tests) or no `apiKey` is available; the interactive commands always have a key.
1001
- */
1002
- const assertAiGatewayProvisionableFromCreds = async (props) => {
1003
- if (props.runtimeApi || !props.apiKey) return;
1004
- if (!utilizedServices(props.config).includes("AI Gateway")) return;
1005
- const apiClient = getApiClient({
1006
- apiKey: props.apiKey,
1007
- ...props.apiHost ? { apiHost: props.apiHost } : {}
1008
- });
1009
- await assertAiGatewayProvisionable({
1010
- apiClient,
1011
- projectId: props.projectId
1012
- });
1013
- };
1014
- /**
1015
987
  * Apply a `neon.ts` policy to a **freshly created** branch (used by `neonctl checkout`
1016
988
  * when it creates a branch). No-op when there is no `neon.ts` on the path from cwd up to
1017
989
  * the repo root — checkout still succeeds, it just has no policy to apply.
@@ -1045,13 +1017,6 @@ const applyPolicyOnCreate = async (props) => {
1045
1017
  } catch {
1046
1018
  warnDeprecatedPreview(config);
1047
1019
  }
1048
- await assertAiGatewayProvisionableFromCreds({
1049
- projectId: props.projectId,
1050
- ...props.apiKey ? { apiKey: props.apiKey } : {},
1051
- ...props.apiHost ? { apiHost: props.apiHost } : {},
1052
- ...props.runtimeApi ? { runtimeApi: props.runtimeApi } : {},
1053
- config
1054
- });
1055
1020
  log.info("Applying neon.ts policy to the new branch…");
1056
1021
  const result = await apply(config, {
1057
1022
  projectId: props.projectId,
@@ -1117,13 +1082,6 @@ const createBranchFromPolicyOnCheckout = async (props) => {
1117
1082
  if (/Could not find a Neon config file/i.test(message)) return null;
1118
1083
  throw err;
1119
1084
  }
1120
- await assertAiGatewayProvisionableFromCreds({
1121
- projectId: props.projectId,
1122
- ...props.apiKey ? { apiKey: props.apiKey } : {},
1123
- ...props.apiHost ? { apiHost: props.apiHost } : {},
1124
- ...props.runtimeApi ? { runtimeApi: props.runtimeApi } : {},
1125
- config
1126
- });
1127
1085
  try {
1128
1086
  const { branchId, branchName, result } = await createBranch(config, {
1129
1087
  projectId: props.projectId,
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
2
2
  import { fillSingleProject } from "../utils/enrichers.js";
3
- import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-DZ3cDaOS.js";
3
+ import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-DPuP7ywm.js";
4
4
  import { DEPLOY_COMMANDS_EPILOGUE } from "../commands/deploy_help.js";
5
5
  // src/commands/deploy.ts
6
6
  var deploy_exports = /* @__PURE__ */ __exportAll({
@@ -4,12 +4,12 @@ import { isClaimableEnvTarget } from "../claimable/state.js";
4
4
  import { getCliName } from "../utils/cli_name.js";
5
5
  import { defaultDevEnvFiles, readEnvFile, resolveEnvFilePath } from "../env_file.js";
6
6
  import { l as functionBaseUrlKey } from "./env-JgoSsmyt.js";
7
+ import { branchIdResolve } from "../utils/enrichers.js";
8
+ import { bundleEntry } from "../utils/esbuild.js";
7
9
  import { a as resolveDevEnv } from "./env-CIFMBEon.js";
10
+ import { f as envFlag } from "./config-DPuP7ywm.js";
8
11
  import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
9
12
  import { resolveWatchInputs } from "../dev/inputs.js";
10
- import { branchIdResolve } from "../utils/enrichers.js";
11
- import { bundleEntry } from "../utils/esbuild.js";
12
- import { f as envFlag } from "./config-DZ3cDaOS.js";
13
13
  import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
14
14
  import { basename, dirname, join, relative, resolve } from "node:path";
15
15
  import { fileURLToPath } from "node:url";
@@ -7,8 +7,8 @@ import { deprecatedServiceMessage, parseServices, servicesFlagValue, servicesOpt
7
7
  import { mergeEnvFile, readEnvFile, resolveEnvFilePath } from "../env_file.js";
8
8
  import { t as NEON_ENV_VAR_KEYS, u as isFunctionBaseUrlKey } from "./env-JgoSsmyt.js";
9
9
  import { ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, ownedEnvServiceKeys, parseEnvPullKeys } from "../env_services.js";
10
- import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-CIFMBEon.js";
11
10
  import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
11
+ import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-CIFMBEon.js";
12
12
  import { warnAiGateway } from "../utils/ai_gateway_notice.js";
13
13
  import { formatPulledEnv, pulledBranch } from "../commands/env_output.js";
14
14
  import { existsSync } from "node:fs";
@@ -179,7 +179,6 @@ const pull = async (props, opts = {}) => {
179
179
  const gatewayBaseUrl = neonVars.NEON_AI_GATEWAY_BASE_URL;
180
180
  const gatewayToken = neonVars.NEON_AI_GATEWAY_TOKEN;
181
181
  if (gatewayBaseUrl && gatewayToken) await warnAiGateway({
182
- apiClient: props.apiClient,
183
182
  projectId: props.projectId,
184
183
  branchId,
185
184
  gateway: {
@@ -5,8 +5,8 @@ import { CONTEXT_FILE, contextBranch, gitBranchMap, gitBranchMapping, isUnfollow
5
5
  import { writer } from "../writer.js";
6
6
  import { neonSafeBranchName } from "../utils/branch_name.js";
7
7
  import { currentGitBranch, gitPull, gitRepoRoot, hasUpstream, installPostCheckoutHook, isGitRepo, isManagedHook, localGitBranches, postCheckoutHookPath, readGitContext, removePostCheckoutHook } from "../utils/git.js";
8
- import { o as quoteFlagValue } from "./link-VYCSKqU-.js";
9
- import { o as handler$1 } from "./checkout-Bsfl-B0h.js";
8
+ import { o as quoteFlagValue } from "./link-PLk7-vwB.js";
9
+ import { o as handler$1 } from "./checkout-OEE3GTc_.js";
10
10
  import { existsSync } from "node:fs";
11
11
  import { join } from "node:path";
12
12
  import chalk from "chalk";
@@ -13,8 +13,8 @@ import { writer } from "../writer.js";
13
13
  import { createBranch, pickBranchInteractively } from "../utils/branch_picker.js";
14
14
  import { looksLikeBranchId } from "../utils/formats.js";
15
15
  import { listAllProjectBranches } from "../utils/enrichers.js";
16
- import { n as autoPullEnvAfterPin } from "./env-BOt9AZ1j.js";
17
- import { h as initCmd } from "./config-DZ3cDaOS.js";
16
+ import { n as autoPullEnvAfterPin } from "./env-C4-EYFmE.js";
17
+ import { h as initCmd } from "./config-DPuP7ywm.js";
18
18
  import { formatLinkSummary } from "../commands/link_output.js";
19
19
  import { r as REGIONS } from "./projects-a3X4OFEJ.js";
20
20
  import prompts from "prompts";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
2
2
  import { fillSingleProject } from "../utils/enrichers.js";
3
- import { y as status } from "./config-DZ3cDaOS.js";
3
+ import { y as status } from "./config-DPuP7ywm.js";
4
4
  // src/commands/status.ts
5
5
  var status_exports = /* @__PURE__ */ __exportAll({
6
6
  builder: () => builder,
@@ -1 +1 @@
1
- export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-Bsfl-B0h.js";
1
+ export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-OEE3GTc_.js";
@@ -1 +1 @@
1
- export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-B3tMeMuo.js";
1
+ export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-C-9or54_.js";
@@ -1 +1 @@
1
- export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-DZ3cDaOS.js";
1
+ export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-DPuP7ywm.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-CF4PxuNX.js";
1
+ export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-CpF33Ij-.js";
@@ -1 +1 @@
1
- export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionUrlEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-BnHQENZM.js";
1
+ export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionUrlEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-BE5TL7ZH.js";
@@ -1 +1 @@
1
- export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-BOt9AZ1j.js";
1
+ export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-C4-EYFmE.js";
@@ -8,7 +8,7 @@ import { writer } from "../writer.js";
8
8
  import { formatInitDone, printInitDone } from "../init/chrome.js";
9
9
  import { FUNCTION_SLUG_PATTERN, deriveFunctionSlug } from "../utils/function_slug.js";
10
10
  import { displayPath } from "./env_output.js";
11
- import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-DZ3cDaOS.js";
11
+ import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-DPuP7ywm.js";
12
12
  import { recommendedOperations } from "../functions/registry.js";
13
13
  import { collidingFiles, operationsFromFlags, planConfigRegistration, planEnvExample, planScaffold, writeScaffold } from "../functions/scaffold.js";
14
14
  import { describeRegistrySource, openRegistry } from "../functions/source.js";
@@ -1 +1 @@
1
- export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-CRYW7ku0.js";
1
+ export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-R8RebFpF.js";
@@ -2,29 +2,29 @@ import { r as auth_exports } from "../_chunks/auth-rup6nemJ.js";
2
2
  import { t as api_exports } from "../_chunks/api-1MKsfpY3.js";
3
3
  import { n as api_keys_exports } from "../_chunks/api_keys-CTFHd5m_.js";
4
4
  import { n as ask_exports } from "../_chunks/ask-Xlek1Pxh.js";
5
- import { o as env_exports } from "../_chunks/env-BOt9AZ1j.js";
6
- import { c as config_exports } from "../_chunks/config-DZ3cDaOS.js";
5
+ import { o as env_exports } from "../_chunks/env-C4-EYFmE.js";
6
+ import { c as config_exports } from "../_chunks/config-DPuP7ywm.js";
7
7
  import { u as projects_exports } from "../_chunks/projects-a3X4OFEJ.js";
8
- import { a as link_exports } from "../_chunks/link-VYCSKqU-.js";
8
+ import { a as link_exports } from "../_chunks/link-PLk7-vwB.js";
9
9
  import { o as mcp_exports } from "../_chunks/mcp-SvqWzHnT.js";
10
10
  import { c as plugins_exports } from "../_chunks/plugins-BwUZQ6Ic.js";
11
11
  import { l as skills_exports } from "../_chunks/skills-Bv8oKKwE.js";
12
12
  import { t as bootstrap_exports } from "../_chunks/bootstrap-B73qVB39.js";
13
13
  import { r as branches_exports } from "../_chunks/branches-Bp-5z1lM.js";
14
14
  import { n as bucket_exports } from "../_chunks/bucket-D06bvDSa.js";
15
- import { n as checkout_exports } from "../_chunks/checkout-Bsfl-B0h.js";
16
- import { o as claim_exports } from "../_chunks/claim-B3tMeMuo.js";
15
+ import { n as checkout_exports } from "../_chunks/checkout-OEE3GTc_.js";
16
+ import { o as claim_exports } from "../_chunks/claim-C-9or54_.js";
17
17
  import { o as connection_string_exports } from "../_chunks/connection_string-6WhV4WFx.js";
18
18
  import { a as credentials_exports } from "../_chunks/credentials-BMBNmW0t.js";
19
19
  import { r as data_api_exports } from "../_chunks/data_api-CHDwvMTG.js";
20
20
  import { s as databases_exports } from "../_chunks/databases-B-qY303S.js";
21
- import { r as deploy_exports } from "../_chunks/deploy-CF4PxuNX.js";
22
- import { s as dev_exports } from "../_chunks/dev-BnHQENZM.js";
21
+ import { r as deploy_exports } from "../_chunks/deploy-CpF33Ij-.js";
22
+ import { s as dev_exports } from "../_chunks/dev-BE5TL7ZH.js";
23
23
  import { i as diff_exports } from "../_chunks/diff-dnxneH0u.js";
24
24
  import { c as docs_exports } from "../_chunks/docs-BpLiSTmm.js";
25
25
  import { o as feedback_exports } from "../_chunks/feedback-mQmdTRFn.js";
26
26
  import { o as functions_exports } from "../_chunks/functions-PHaU-kRb.js";
27
- import { o as git_exports } from "../_chunks/git-CRYW7ku0.js";
27
+ import { o as git_exports } from "../_chunks/git-R8RebFpF.js";
28
28
  import { a as init_exports } from "../_chunks/init-D2fClHtC.js";
29
29
  import { o as inspect_exports } from "../_chunks/inspect-yFAb61qo.js";
30
30
  import { a as ip_allow_exports } from "../_chunks/ip_allow-DBdxNEUa.js";
@@ -40,7 +40,7 @@ import { o as profile_exports } from "../_chunks/profile-CArcjyS4.js";
40
40
  import { s as realtime_exports } from "../_chunks/realtime-BwtzYf5a.js";
41
41
  import { a as set_context_exports } from "../_chunks/set_context-ompB6d2D.js";
42
42
  import { s as snapshots_exports } from "../_chunks/snapshots-DxNhjcco.js";
43
- import { a as status_exports } from "../_chunks/status-rt-0bUaQ.js";
43
+ import { a as status_exports } from "../_chunks/status-BjaHpnTV.js";
44
44
  import { d as triggers_exports } from "../_chunks/triggers-BfvyeJUC.js";
45
45
  import { s as user_exports } from "../_chunks/user-D9mC430O.js";
46
46
  import { i as vpc_endpoints_exports } from "../_chunks/vpc_endpoints-C-Y4WK2M.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-VYCSKqU-.js";
1
+ export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-PLk7-vwB.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-rt-0bUaQ.js";
1
+ export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-BjaHpnTV.js";
@@ -1,6 +1,6 @@
1
1
  import { writer } from "../writer.js";
2
- import { o as resolveNeonEnvVars } from "../_chunks/env-CIFMBEon.js";
3
2
  import { branchIdFromProps } from "../utils/enrichers.js";
3
+ import { o as resolveNeonEnvVars } from "../_chunks/env-CIFMBEon.js";
4
4
  import YAML from "yaml";
5
5
  // src/commands/subscribe.ts
6
6
  const builder = (argv) => argv.usage("$0 realtime subscribe \"<query>\" [options]").positional("query", {
package/dist/init/auth.js CHANGED
@@ -4,7 +4,7 @@ import "../config.js";
4
4
  import "../auth.js";
5
5
  import { c as ensureAuth, l as existingApiClient } from "../_chunks/auth-rup6nemJ.js";
6
6
  import { recoverFrom401 } from "../auth_recovery.js";
7
- import { c as pull } from "../_chunks/env-BOt9AZ1j.js";
7
+ import { c as pull } from "../_chunks/env-C4-EYFmE.js";
8
8
  import { c as setupNeonMcp } from "../_chunks/mcp-SvqWzHnT.js";
9
9
  // src/init/auth.ts
10
10
  const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
@@ -4,7 +4,7 @@ import { c as ensureAuth } from "../_chunks/auth-rup6nemJ.js";
4
4
  import { recoverFrom401 } from "../auth_recovery.js";
5
5
  import { loadProjectConfig } from "../project.js";
6
6
  import { loadEnvFileIntoProcess } from "../env_file.js";
7
- import { r as applyCmd } from "../_chunks/config-DZ3cDaOS.js";
7
+ import { r as applyCmd } from "../_chunks/config-DPuP7ywm.js";
8
8
  import { authContext } from "./auth.js";
9
9
  import { existsSync } from "node:fs";
10
10
  // src/init/deploy.ts
package/dist/init/link.js CHANGED
@@ -4,7 +4,7 @@ import "../config.js";
4
4
  import "../auth.js";
5
5
  import { c as ensureAuth } from "../_chunks/auth-rup6nemJ.js";
6
6
  import { recoverFrom401 } from "../auth_recovery.js";
7
- import { s as runLink } from "../_chunks/link-VYCSKqU-.js";
7
+ import { s as runLink } from "../_chunks/link-PLk7-vwB.js";
8
8
  // src/init/link.ts
9
9
  const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
10
10
  const authenticationFailed = () => /* @__PURE__ */ new Error("Authentication failed.");
package/dist/init/run.js CHANGED
@@ -14,8 +14,8 @@ import { getAgentDisplayName } from "../mcp/agents.js";
14
14
  import { missingPluginsCommands, pluginsCommandProblemText, pluginsInstallableAgents, unusablePluginsCommands } from "../plugins/targets.js";
15
15
  import { AGENTS_NOT_INSTALLED, CANCELLED_BODY, CLAIMABLE_ACCOUNT_FLAGS, CLAIMABLE_ALREADY_LINKED, CLAIMABLE_MCP_API_KEY, CLAIMABLE_NO_LINK, MCP_API_KEY_NEEDS_AUTH, MCP_SCOPED_NEEDS_PROJECT, NON_TTY_LINK_NEEDS_AUTH, NO_AGENTS_FALLBACK_STATUS, PROGRESS, PROJECT_PINNED_OFFLINE, claimableNext, claimableThenServicesNext, configInitNext, envPullFailedNext, existingConfigNext, installFailedNext, mcpAfterLinkNext, mcpConfigLocationSkipped, mcpConfigLocationUnavailable, mcpKeyFailedNext, namedAgentsUnavailable, newConfigNext, offlinePinNext, skippedLinkNext, toolingFailedNext, unattendedUnauthedNext } from "./copy.js";
16
16
  import { agentsRowValue, configRowValue, formatInitDone, headingForKind, printInitBanner, printInitDone, printInitProgress, projectRowValue, shouldPrintInitBanner } from "./chrome.js";
17
- import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-DZ3cDaOS.js";
18
- import { o as quoteFlagValue, s as runLink } from "../_chunks/link-VYCSKqU-.js";
17
+ import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-DPuP7ywm.js";
18
+ import { o as quoteFlagValue, s as runLink } from "../_chunks/link-PLk7-vwB.js";
19
19
  import { runAuthenticatedLink } from "./link.js";
20
20
  import { mcpInstallableAgents } from "../mcp/targets.js";
21
21
  import { skillsInstallableAgents } from "../skills/targets.js";
@@ -25,7 +25,7 @@ import { pullInitEnv, resolveInitConfigApi } from "./auth.js";
25
25
  import { InitCancelled, raceSigint, restoreCursor } from "./cancelled.js";
26
26
  import { pickAgentSetupInteractively, pickInitAgentsInteractively, pickInitConfigInteractively, pickInitMcpAuthInteractively, pickInitMcpConfigLocationInteractively, pickInitModeInteractively, pickInitPackageManagerInteractively, pickInitProjectSetupInteractively, pickInitServicesInteractively, pickInitSkillsInteractively } from "./wizard.js";
27
27
  import { runToolingSteps, toolingStepCommandText } from "./tooling.js";
28
- import { l as create } from "../_chunks/claim-B3tMeMuo.js";
28
+ import { l as create } from "../_chunks/claim-C-9or54_.js";
29
29
  import { INIT_CONFIG_SERVICES_CONFLICT, configPlanFromResolution, initEnvPullAfterConfig, resolveInitConfigChoice } from "./choices.js";
30
30
  import { detectInitEnvironment } from "./detect.js";
31
31
  import { createInitFunnel, emitInitStart, finishInitFunnel, initStartProperties, recordInitError, recordInitExit } from "./funnel.js";
@@ -1,41 +1,18 @@
1
1
  import { log } from "../log.js";
2
2
  // src/utils/ai_gateway_notice.ts
3
3
  /**
4
- * Friendly guidance shown when a branch enables the AI Gateway (`aiGateway`).
5
- *
6
- * The gateway is credential-gated, not provisioned: enabling it always mints a working
7
- * branch credential, so `apply` / `checkout` / `env pull` succeed regardless of plan. The
8
- * two things that *do* gate the gateway happen at serving time and are invisible in the
9
- * provisioning result, so we surface them as a courtesy notice instead:
10
- *
11
- * - **Free plan** — credentials provision, but the gateway does not *serve* model requests.
12
- * The account needs to upgrade to a paid plan.
13
- * - **Reduced model set** — on a paid plan, an account still ramping up on the beta gets a
14
- * trimmed model catalog (flagship models are listed but `enabled: false` on `/v1/models`).
15
- * They can request access to more models.
16
- *
17
- * This is deliberately phrased for the user: it never mentions account "verification" or any
18
- * other internal gating mechanism.
4
+ * A minted gateway credential says nothing about whether the account can serve a model:
5
+ * that is decided per request, so the branch's own `/v1/models` is the only source for it.
19
6
  */
7
+ /** Despite the name, adding a card and buying AI Gateway credits clears it on any plan. */
8
+ const CREDITS_REQUIRED_REASON = "paid_plan_required";
9
+ const PREPAID_CREDITS_DOCS_URL = "https://neon.com/docs/ai-gateway/prepaid-credits";
20
10
  /**
21
- * `BillingSubscriptionType` values that mean the account is on a Free plan (the gateway
22
- * won't serve requests). Everything else — `launch`, `scale`, `business`, the `*_v3`
23
- * variants, marketplace plans — is treated as paid.
24
- */
25
- const FREE_SUBSCRIPTION_TYPES = /* @__PURE__ */ new Set(["free_v2", "free_v3"]);
26
- /**
27
- * The Neon Console billing page to upgrade a Free-plan account so the gateway can serve. It's
28
- * org-scoped when the project belongs to an org; projects on a personal account (which is
29
- * where Free plans usually live) have no org id, so we fall back to the account-level page.
30
- */
31
- const aiGatewayUpgradeUrl = (orgId) => orgId ? `https://console.neon.tech/app/${orgId}/billing` : "https://console.neon.tech/app/billing";
32
- /**
33
- * The branch's AI Gateway page in the Neon Console — where a paid user with a reduced model
34
- * set requests access to more models. It's branch-scoped, so it's built from the linked
35
- * project and branch ids.
11
+ * The branch's AI Gateway page in the Neon Console — where a user with a reduced model set
12
+ * requests access to more models. It's branch-scoped, so it's built from the linked project
13
+ * and branch ids.
36
14
  */
37
15
  const aiGatewayModelsUrl = (projectId, branchId) => `https://console.neon.tech/app/projects/${projectId}/branches/${branchId}/ai-gateway`;
38
- const isFreePlan = (subscriptionType) => subscriptionType !== void 0 && FREE_SUBSCRIPTION_TYPES.has(subscriptionType);
39
16
  /**
40
17
  * Whether the model catalog includes at least one flagship model enabled. Flagship models
41
18
  * (Anthropic Opus, OpenAI Codex / `*-pro`) are the first to be held back for an account still
@@ -44,29 +21,18 @@ const isFreePlan = (subscriptionType) => subscriptionType !== void 0 && FREE_SUB
44
21
  * version bumps (e.g. `claude-opus-4-8`).
45
22
  */
46
23
  const hasFlagshipModels = (modelIds) => modelIds.some((id) => id.includes("opus") || id.includes("codex") || id.endsWith("-pro"));
47
- /**
48
- * The message shown when a `neon.ts` that enables the AI Gateway is applied on a Free plan.
49
- * Provisioning is refused up front (see {@link assertAiGatewayProvisionable}) because the
50
- * gateway won't serve model requests until the account is on a paid plan. `upgradeUrl` is the
51
- * org-scoped Console billing page (see {@link aiGatewayUpgradeUrl}).
52
- */
53
- const freePlanBlockMessage = (upgradeUrl) => `This neon.ts enables the AI Gateway, which isn't available on the Free plan — the gateway won't serve model requests. Upgrade to a paid plan and re-run, or remove \`aiGateway\` from neon.ts. Upgrade here: ${upgradeUrl}`;
54
- /**
55
- * Build the AI Gateway courtesy notice for an account's plan and (optionally) its live model
56
- * catalog, or `null` when nothing needs saying.
57
- *
58
- * `modelIds` is `undefined` when the catalog wasn't probed (e.g. a dry-run `plan`, or a probe
59
- * that failed); in that case only the plan-based (Free) notice can be produced — never a
60
- * false "reduced models" warning. `upgradeUrl` is the org-scoped Console billing page
61
- * (Free notice); `moreModelsUrl` is the branch's Console AI Gateway page
62
- * (see {@link aiGatewayModelsUrl}), shown when the catalog is reduced.
63
- */
64
- const buildAiGatewayNotice = ({ subscriptionType, modelIds, upgradeUrl, moreModelsUrl }) => {
65
- if (isFreePlan(subscriptionType)) return {
24
+ const noEnabledModelsMessage = (unavailable) => {
25
+ if (unavailable.reason === CREDITS_REQUIRED_REASON) return `AI Gateway is enabled, but no models are available to this account until it has AI Gateway credits. Credits work on every Neon plan, including Free. Add a card and buy credits on the Billing page: ${unavailable.recoveryUrl ?? PREPAID_CREDITS_DOCS_URL}`;
26
+ return `AI Gateway is enabled, but no models are available to this account yet (${unavailable.reason}). ` + (unavailable.recoveryUrl ? `Resolve it here: ${unavailable.recoveryUrl}` : "See https://neon.com/docs/ai-gateway/troubleshooting");
27
+ };
28
+ /** An unreadable catalog (`undefined`) stays silent rather than risk a false warning. */
29
+ const buildAiGatewayNotice = ({ catalog, moreModelsUrl }) => {
30
+ if (catalog === void 0) return null;
31
+ if (catalog.enabledIds.length === 0) return catalog.unavailable ? {
66
32
  level: "warning",
67
- message: `AI Gateway is enabled, but the gateway does not serve model requests on the Free plan. Upgrade to a paid plan to start making requests: ${upgradeUrl}`
68
- };
69
- if (modelIds !== void 0 && modelIds.length > 0 && !hasFlagshipModels(modelIds)) return {
33
+ message: noEnabledModelsMessage(catalog.unavailable)
34
+ } : null;
35
+ if (!hasFlagshipModels(catalog.enabledIds)) return {
70
36
  level: "warning",
71
37
  message: `Not every model is enabled for your account yet, so some models are missing from the catalog. Request access to more models here: ${moreModelsUrl}`
72
38
  };
@@ -74,76 +40,43 @@ const buildAiGatewayNotice = ({ subscriptionType, modelIds, upgradeUrl, moreMode
74
40
  };
75
41
  const isRecord = (value) => typeof value === "object" && value !== null;
76
42
  /**
77
- * Pull the `id`s of enabled models out of an OpenAI-compatible
78
- * `{ object: "list", data: [{ id, enabled, ... }] }` body. The gateway lists every model in
79
- * the catalog but marks ones the account can't serve yet with `enabled: false`; only the
80
- * enabled set is used to detect a reduced catalog.
43
+ * The gateway lists every catalog model, and marks the ones the account can't serve with
44
+ * `enabled: false`, an `unavailable_reason`, and a `recovery_url`.
81
45
  */
82
- const extractEnabledModelIds = (body) => {
46
+ const parseGatewayCatalog = (body) => {
83
47
  if (!isRecord(body) || !Array.isArray(body.data)) return null;
84
- const ids = [];
85
- for (const entry of body.data) if (isRecord(entry) && typeof entry.id === "string" && entry.enabled === true) ids.push(entry.id);
86
- return ids;
48
+ const enabledIds = [];
49
+ let unavailable;
50
+ for (const entry of body.data) {
51
+ if (!isRecord(entry) || typeof entry.id !== "string") continue;
52
+ if (entry.enabled === true) enabledIds.push(entry.id);
53
+ else if (unavailable === void 0 && typeof entry.unavailable_reason === "string") unavailable = {
54
+ reason: entry.unavailable_reason,
55
+ ...typeof entry.recovery_url === "string" ? { recoveryUrl: entry.recovery_url } : {}
56
+ };
57
+ }
58
+ return unavailable ? {
59
+ enabledIds,
60
+ unavailable
61
+ } : { enabledIds };
87
62
  };
88
- /**
89
- * `GET {baseUrl}/v1/models` → the enabled model ids, or `null` if the catalog can't be read
90
- * (network / HTTP / parse failure). Returning `null` keeps the notice silent rather than
91
- * risking a false "reduced models" warning. `/v1/models` is served only on the unified
92
- * dialect (the `/openai/v1` Responses dialect returns 404).
93
- */
94
- const fetchGatewayModelIds = async (baseUrl, token) => {
63
+ /** `/v1/models` is served only on the unified dialect; `/openai/v1` returns 404. */
64
+ const fetchGatewayCatalog = async (baseUrl, token) => {
95
65
  try {
96
66
  const res = await fetch(`${baseUrl.replace(/\/+$/, "")}/v1/models`, { headers: { Authorization: `Bearer ${token}` } });
97
67
  if (!res.ok) return null;
98
- return extractEnabledModelIds(await res.json());
68
+ return parseGatewayCatalog(await res.json());
99
69
  } catch {
100
70
  return null;
101
71
  }
102
72
  };
103
- /**
104
- * Refuse to provision the AI Gateway on a Free plan. Called before the `neon.ts` lifecycle
105
- * commands provision a branch (`config apply` / `deploy`, `checkout`), so a Free-plan user
106
- * gets a clear "upgrade first" error instead of a credential that can't serve requests.
107
- *
108
- * Best-effort on the plan lookup: if the plan can't be determined (network / API failure) we
109
- * do NOT block, so a transient error never wrongly refuses a paid user's deploy. Only a
110
- * positively-identified Free plan throws.
111
- */
112
- const assertAiGatewayProvisionable = async (params) => {
113
- let subscriptionType;
114
- let orgId;
115
- try {
116
- const { data } = await params.apiClient.getProject(params.projectId);
117
- subscriptionType = data.project.owner?.subscription_type;
118
- orgId = data.project.org_id ?? void 0;
119
- } catch {
120
- return;
121
- }
122
- if (isFreePlan(subscriptionType)) throw new Error(freePlanBlockMessage(aiGatewayUpgradeUrl(orgId)));
123
- };
124
- /**
125
- * Resolve the account's plan (and, when gateway credentials are on hand, its live model
126
- * catalog) and print the AI Gateway courtesy notice — used by the `neon.ts` lifecycle and
127
- * `env pull` whenever a branch has the gateway enabled.
128
- *
129
- * Pass `gateway` (base URL + token) to enable the reduced-model-set check; omit it (e.g. a
130
- * dry-run `plan`) to get only the Free-plan notice. This is best-effort: any failure while
131
- * fetching the plan or catalog is swallowed so it can never break the underlying command.
132
- */
73
+ /** A courtesy notice: no failure here may fail the env pull that called it. */
133
74
  const warnAiGateway = async (params) => {
134
- const modelsRead = params.gateway ? fetchGatewayModelIds(params.gateway.baseUrl, params.gateway.token) : null;
135
- try {
136
- const { data } = await params.apiClient.getProject(params.projectId);
137
- const subscriptionType = data.project.owner?.subscription_type;
138
- const orgId = data.project.org_id ?? void 0;
139
- const modelIds = modelsRead ? await modelsRead ?? void 0 : void 0;
140
- const notice = buildAiGatewayNotice({
141
- subscriptionType,
142
- modelIds,
143
- upgradeUrl: aiGatewayUpgradeUrl(orgId),
144
- moreModelsUrl: aiGatewayModelsUrl(params.projectId, params.branchId)
145
- });
146
- if (notice) log.warning(notice.message);
147
- } catch {}
75
+ const catalog = await fetchGatewayCatalog(params.gateway.baseUrl, params.gateway.token);
76
+ const notice = buildAiGatewayNotice({
77
+ catalog: catalog ?? void 0,
78
+ moreModelsUrl: aiGatewayModelsUrl(params.projectId, params.branchId)
79
+ });
80
+ if (notice) log.warning(notice.message);
148
81
  };
149
- export { aiGatewayModelsUrl, aiGatewayUpgradeUrl, assertAiGatewayProvisionable, buildAiGatewayNotice, extractEnabledModelIds, fetchGatewayModelIds, freePlanBlockMessage, hasFlagshipModels, isFreePlan, warnAiGateway };
82
+ export { aiGatewayModelsUrl, buildAiGatewayNotice, fetchGatewayCatalog, hasFlagshipModels, parseGatewayCatalog, warnAiGateway };
@@ -51,7 +51,7 @@ const CHOICES = [
51
51
  {
52
52
  value: "ai-gateway",
53
53
  title: "AI Gateway",
54
- description: "All models, one API, one bill. Powered by Databricks. Not available on the Neon free plan."
54
+ description: "All models, one API, one bill. Powered by Databricks."
55
55
  }
56
56
  ];
57
57
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neon",
3
- "version": "8.23.3",
3
+ "version": "8.23.4",
4
4
  "description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
5
5
  "keywords": [
6
6
  "neon",
@@ -74,9 +74,9 @@
74
74
  "yargs": "17.7.2",
75
75
  "yoctocolors": "^2.1.2",
76
76
  "@neon/config-runtime": "1.11.7",
77
+ "@neon/realtime": "0.2.0",
77
78
  "@neon/config": "1.11.3",
78
- "@neon/sdk": "7.10.0",
79
- "@neon/realtime": "0.2.0"
79
+ "@neon/sdk": "7.10.0"
80
80
  },
81
81
  "optionalDependencies": {
82
82
  "@napi-rs/keyring": "1.3.0",
@@ -114,8 +114,8 @@
114
114
  "vitest": "^3.0.9",
115
115
  "@neon-internals/cli-core": "0.0.0",
116
116
  "@neon-internals/env-core": "0.0.45",
117
- "@neon/functions": "0.11.0",
118
117
  "@neon/env": "1.6.15",
118
+ "@neon/functions": "0.11.0",
119
119
  "@neon/e2e-harness": "0.0.0"
120
120
  },
121
121
  "publishConfig": {