convex 1.47.0 → 1.48.0

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.
Files changed (190) hide show
  1. package/CHANGELOG.md +28 -4
  2. package/README.md +1 -1
  3. package/dist/browser.bundle.js +1 -1
  4. package/dist/browser.bundle.js.map +1 -1
  5. package/dist/cjs/cli/aiFiles.js +26 -4
  6. package/dist/cjs/cli/aiFiles.js.map +2 -2
  7. package/dist/cjs/cli/env.js +6 -3
  8. package/dist/cjs/cli/env.js.map +2 -2
  9. package/dist/cjs/cli/envDefault.js +5 -2
  10. package/dist/cjs/cli/envDefault.js.map +2 -2
  11. package/dist/cjs/cli/lib/aiFiles/guidelinesmd.js +2 -1
  12. package/dist/cjs/cli/lib/aiFiles/guidelinesmd.js.map +2 -2
  13. package/dist/cjs/cli/lib/aiFiles/index.js +13 -2
  14. package/dist/cjs/cli/lib/aiFiles/index.js.map +2 -2
  15. package/dist/cjs/cli/lib/aiFiles/skills.js +6 -5
  16. package/dist/cjs/cli/lib/aiFiles/skills.js.map +2 -2
  17. package/dist/cjs/cli/lib/aiFiles/state.js +1 -1
  18. package/dist/cjs/cli/lib/aiFiles/state.js.map +1 -1
  19. package/dist/cjs/cli/lib/components.js +12 -2
  20. package/dist/cjs/cli/lib/components.js.map +2 -2
  21. package/dist/cjs/cli/lib/deployApi/startPush.js +42 -1
  22. package/dist/cjs/cli/lib/deployApi/startPush.js.map +2 -2
  23. package/dist/cjs/cli/lib/env.js +9 -1
  24. package/dist/cjs/cli/lib/env.js.map +2 -2
  25. package/dist/cjs/cli/lib/localDeployment/dashboard.js +11 -1
  26. package/dist/cjs/cli/lib/localDeployment/dashboard.js.map +2 -2
  27. package/dist/cjs/cli/lib/localDeployment/download.js +16 -1
  28. package/dist/cjs/cli/lib/localDeployment/download.js.map +2 -2
  29. package/dist/cjs/cli/lib/localDeployment/utils.js +4 -0
  30. package/dist/cjs/cli/lib/localDeployment/utils.js.map +2 -2
  31. package/dist/cjs/cli/lib/utils/aiAgent.js +32 -0
  32. package/dist/cjs/cli/lib/utils/aiAgent.js.map +7 -0
  33. package/dist/cjs/index.js +1 -1
  34. package/dist/cjs/index.js.map +1 -1
  35. package/dist/cjs/server/authentication.js.map +1 -1
  36. package/dist/cjs/server/components/index.js.map +2 -2
  37. package/dist/cjs/server/impl/authentication_impl.js +15 -1
  38. package/dist/cjs/server/impl/authentication_impl.js.map +2 -2
  39. package/dist/cjs/server/impl/registration_impl.js +1 -1
  40. package/dist/cjs/server/impl/registration_impl.js.map +2 -2
  41. package/dist/cjs/server/index.js.map +2 -2
  42. package/dist/cjs/server/meta.js.map +1 -1
  43. package/dist/cjs/server/registration.js.map +1 -1
  44. package/dist/cjs/server/schema.js +0 -2
  45. package/dist/cjs/server/schema.js.map +2 -2
  46. package/dist/cjs/server/storage.js.map +1 -1
  47. package/dist/cjs-types/cli/aiFiles.d.ts.map +1 -1
  48. package/dist/cjs-types/cli/env.d.ts.map +1 -1
  49. package/dist/cjs-types/cli/envDefault.d.ts.map +1 -1
  50. package/dist/cjs-types/cli/lib/aiFiles/guidelinesmd.d.ts +3 -1
  51. package/dist/cjs-types/cli/lib/aiFiles/guidelinesmd.d.ts.map +1 -1
  52. package/dist/cjs-types/cli/lib/aiFiles/index.d.ts +11 -1
  53. package/dist/cjs-types/cli/lib/aiFiles/index.d.ts.map +1 -1
  54. package/dist/cjs-types/cli/lib/aiFiles/skills.d.ts +4 -1
  55. package/dist/cjs-types/cli/lib/aiFiles/skills.d.ts.map +1 -1
  56. package/dist/cjs-types/cli/lib/components.d.ts.map +1 -1
  57. package/dist/cjs-types/cli/lib/deployApi/startPush.d.ts +13 -0
  58. package/dist/cjs-types/cli/lib/deployApi/startPush.d.ts.map +1 -1
  59. package/dist/cjs-types/cli/lib/env.d.ts +1 -0
  60. package/dist/cjs-types/cli/lib/env.d.ts.map +1 -1
  61. package/dist/cjs-types/cli/lib/localDeployment/dashboard.d.ts +6 -0
  62. package/dist/cjs-types/cli/lib/localDeployment/dashboard.d.ts.map +1 -1
  63. package/dist/cjs-types/cli/lib/localDeployment/download.d.ts.map +1 -1
  64. package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts +1 -0
  65. package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
  66. package/dist/cjs-types/cli/lib/utils/aiAgent.d.ts +8 -0
  67. package/dist/cjs-types/cli/lib/utils/aiAgent.d.ts.map +1 -0
  68. package/dist/cjs-types/index.d.ts +1 -1
  69. package/dist/cjs-types/server/authentication.d.ts +65 -0
  70. package/dist/cjs-types/server/authentication.d.ts.map +1 -1
  71. package/dist/cjs-types/server/components/index.d.ts +6 -0
  72. package/dist/cjs-types/server/components/index.d.ts.map +1 -1
  73. package/dist/cjs-types/server/impl/authentication_impl.d.ts +2 -1
  74. package/dist/cjs-types/server/impl/authentication_impl.d.ts.map +1 -1
  75. package/dist/cjs-types/server/index.d.ts +2 -2
  76. package/dist/cjs-types/server/index.d.ts.map +1 -1
  77. package/dist/cjs-types/server/meta.d.ts +8 -0
  78. package/dist/cjs-types/server/meta.d.ts.map +1 -1
  79. package/dist/cjs-types/server/registration.d.ts +5 -3
  80. package/dist/cjs-types/server/registration.d.ts.map +1 -1
  81. package/dist/cjs-types/server/schema.d.ts +0 -2
  82. package/dist/cjs-types/server/schema.d.ts.map +1 -1
  83. package/dist/cjs-types/server/storage.d.ts +28 -25
  84. package/dist/cjs-types/server/storage.d.ts.map +1 -1
  85. package/dist/cli.bundle.cjs +284 -25
  86. package/dist/cli.bundle.cjs.map +4 -4
  87. package/dist/esm/cli/aiFiles.js +26 -4
  88. package/dist/esm/cli/aiFiles.js.map +2 -2
  89. package/dist/esm/cli/env.js +6 -3
  90. package/dist/esm/cli/env.js.map +2 -2
  91. package/dist/esm/cli/envDefault.js +5 -2
  92. package/dist/esm/cli/envDefault.js.map +2 -2
  93. package/dist/esm/cli/lib/aiFiles/guidelinesmd.js +2 -1
  94. package/dist/esm/cli/lib/aiFiles/guidelinesmd.js.map +2 -2
  95. package/dist/esm/cli/lib/aiFiles/index.js +13 -2
  96. package/dist/esm/cli/lib/aiFiles/index.js.map +2 -2
  97. package/dist/esm/cli/lib/aiFiles/skills.js +6 -5
  98. package/dist/esm/cli/lib/aiFiles/skills.js.map +2 -2
  99. package/dist/esm/cli/lib/aiFiles/state.js +1 -1
  100. package/dist/esm/cli/lib/aiFiles/state.js.map +1 -1
  101. package/dist/esm/cli/lib/components.js +15 -2
  102. package/dist/esm/cli/lib/components.js.map +2 -2
  103. package/dist/esm/cli/lib/deployApi/startPush.js +39 -0
  104. package/dist/esm/cli/lib/deployApi/startPush.js.map +2 -2
  105. package/dist/esm/cli/lib/env.js +9 -1
  106. package/dist/esm/cli/lib/env.js.map +2 -2
  107. package/dist/esm/cli/lib/localDeployment/dashboard.js +9 -0
  108. package/dist/esm/cli/lib/localDeployment/dashboard.js.map +2 -2
  109. package/dist/esm/cli/lib/localDeployment/download.js +16 -1
  110. package/dist/esm/cli/lib/localDeployment/download.js.map +2 -2
  111. package/dist/esm/cli/lib/localDeployment/utils.js +3 -0
  112. package/dist/esm/cli/lib/localDeployment/utils.js.map +2 -2
  113. package/dist/esm/cli/lib/utils/aiAgent.js +10 -0
  114. package/dist/esm/cli/lib/utils/aiAgent.js.map +7 -0
  115. package/dist/esm/index.js +1 -1
  116. package/dist/esm/index.js.map +1 -1
  117. package/dist/esm/server/components/index.js.map +2 -2
  118. package/dist/esm/server/impl/authentication_impl.js +13 -0
  119. package/dist/esm/server/impl/authentication_impl.js.map +2 -2
  120. package/dist/esm/server/impl/registration_impl.js +2 -2
  121. package/dist/esm/server/impl/registration_impl.js.map +2 -2
  122. package/dist/esm/server/index.js.map +2 -2
  123. package/dist/esm/server/schema.js +0 -2
  124. package/dist/esm/server/schema.js.map +2 -2
  125. package/dist/esm-types/cli/aiFiles.d.ts.map +1 -1
  126. package/dist/esm-types/cli/env.d.ts.map +1 -1
  127. package/dist/esm-types/cli/envDefault.d.ts.map +1 -1
  128. package/dist/esm-types/cli/lib/aiFiles/guidelinesmd.d.ts +3 -1
  129. package/dist/esm-types/cli/lib/aiFiles/guidelinesmd.d.ts.map +1 -1
  130. package/dist/esm-types/cli/lib/aiFiles/index.d.ts +11 -1
  131. package/dist/esm-types/cli/lib/aiFiles/index.d.ts.map +1 -1
  132. package/dist/esm-types/cli/lib/aiFiles/skills.d.ts +4 -1
  133. package/dist/esm-types/cli/lib/aiFiles/skills.d.ts.map +1 -1
  134. package/dist/esm-types/cli/lib/components.d.ts.map +1 -1
  135. package/dist/esm-types/cli/lib/deployApi/startPush.d.ts +13 -0
  136. package/dist/esm-types/cli/lib/deployApi/startPush.d.ts.map +1 -1
  137. package/dist/esm-types/cli/lib/env.d.ts +1 -0
  138. package/dist/esm-types/cli/lib/env.d.ts.map +1 -1
  139. package/dist/esm-types/cli/lib/localDeployment/dashboard.d.ts +6 -0
  140. package/dist/esm-types/cli/lib/localDeployment/dashboard.d.ts.map +1 -1
  141. package/dist/esm-types/cli/lib/localDeployment/download.d.ts.map +1 -1
  142. package/dist/esm-types/cli/lib/localDeployment/utils.d.ts +1 -0
  143. package/dist/esm-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
  144. package/dist/esm-types/cli/lib/utils/aiAgent.d.ts +8 -0
  145. package/dist/esm-types/cli/lib/utils/aiAgent.d.ts.map +1 -0
  146. package/dist/esm-types/index.d.ts +1 -1
  147. package/dist/esm-types/server/authentication.d.ts +65 -0
  148. package/dist/esm-types/server/authentication.d.ts.map +1 -1
  149. package/dist/esm-types/server/components/index.d.ts +6 -0
  150. package/dist/esm-types/server/components/index.d.ts.map +1 -1
  151. package/dist/esm-types/server/impl/authentication_impl.d.ts +2 -1
  152. package/dist/esm-types/server/impl/authentication_impl.d.ts.map +1 -1
  153. package/dist/esm-types/server/index.d.ts +2 -2
  154. package/dist/esm-types/server/index.d.ts.map +1 -1
  155. package/dist/esm-types/server/meta.d.ts +8 -0
  156. package/dist/esm-types/server/meta.d.ts.map +1 -1
  157. package/dist/esm-types/server/registration.d.ts +5 -3
  158. package/dist/esm-types/server/registration.d.ts.map +1 -1
  159. package/dist/esm-types/server/schema.d.ts +0 -2
  160. package/dist/esm-types/server/schema.d.ts.map +1 -1
  161. package/dist/esm-types/server/storage.d.ts +28 -25
  162. package/dist/esm-types/server/storage.d.ts.map +1 -1
  163. package/dist/react.bundle.js +1 -1
  164. package/dist/react.bundle.js.map +1 -1
  165. package/package.json +3 -2
  166. package/schemas/convex.schema.json +1 -2
  167. package/src/cli/aiFiles.ts +30 -4
  168. package/src/cli/env.ts +4 -1
  169. package/src/cli/envDefault.ts +4 -1
  170. package/src/cli/lib/aiFiles/guidelinesmd.ts +7 -2
  171. package/src/cli/lib/aiFiles/index.ts +23 -3
  172. package/src/cli/lib/aiFiles/skills.ts +11 -7
  173. package/src/cli/lib/aiFiles/state.ts +1 -1
  174. package/src/cli/lib/components.ts +18 -3
  175. package/src/cli/lib/deployApi/startPush.ts +64 -0
  176. package/src/cli/lib/env.ts +13 -2
  177. package/src/cli/lib/localDeployment/dashboard.ts +19 -0
  178. package/src/cli/lib/localDeployment/download.ts +17 -1
  179. package/src/cli/lib/localDeployment/utils.ts +4 -0
  180. package/src/cli/lib/utils/aiAgent.ts +15 -0
  181. package/src/index.ts +1 -1
  182. package/src/server/authentication.ts +79 -0
  183. package/src/server/components/index.ts +11 -0
  184. package/src/server/impl/authentication_impl.ts +15 -1
  185. package/src/server/impl/registration_impl.ts +2 -2
  186. package/src/server/index.ts +6 -0
  187. package/src/server/meta.ts +0 -8
  188. package/src/server/registration.ts +5 -2
  189. package/src/server/schema.ts +0 -2
  190. package/src/server/storage.ts +29 -42
@@ -47456,7 +47456,7 @@ var version;
47456
47456
  var init_index = __esm({
47457
47457
  "src/index.ts"() {
47458
47458
  "use strict";
47459
- version = "1.47.0";
47459
+ version = "1.48.0";
47460
47460
  }
47461
47461
  });
47462
47462
 
@@ -50786,6 +50786,9 @@ function printLocalDeploymentWelcomeMessage() {
50786
50786
  function releaseDate(version4) {
50787
50787
  return /^precompiled-(\d{4}-\d{2}-\d{2})-/.exec(version4)?.[1] ?? null;
50788
50788
  }
50789
+ function isValidBackendVersion(version4) {
50790
+ return /^precompiled-\d{4}-\d{2}-\d{2}-[\w.-]+$/.test(version4);
50791
+ }
50789
50792
  var LOCAL_BACKEND_INSTANCE_SECRET;
50790
50793
  var init_utils2 = __esm({
50791
50794
  "src/cli/lib/localDeployment/utils.ts"() {
@@ -53713,6 +53716,7 @@ async function ensureBackendBinaryDownloaded(ctx, version4) {
53713
53716
  return _ensureBackendBinaryDownloaded(ctx, latestVersionWithBinary);
53714
53717
  }
53715
53718
  async function _ensureBackendBinaryDownloaded(ctx, version4) {
53719
+ await assertValidBackendVersion(ctx, version4);
53716
53720
  logVerbose(`Ensuring backend binary downloaded for version ${version4}`);
53717
53721
  const existingDownload = await checkForExistingDownload(ctx, version4);
53718
53722
  if (existingDownload !== null) {
@@ -53725,6 +53729,18 @@ async function _ensureBackendBinaryDownloaded(ctx, version4) {
53725
53729
  const binaryPath = await downloadBackendBinary(ctx, version4);
53726
53730
  return { version: version4, binaryPath };
53727
53731
  }
53732
+ async function assertValidBackendVersion(ctx, version4) {
53733
+ if (!isValidBackendVersion(version4)) {
53734
+ return await ctx.crash({
53735
+ exitCode: 1,
53736
+ errorType: "fatal",
53737
+ printedMessage: "Invalid local backend version",
53738
+ errForSentry: new LocalDeploymentError(
53739
+ `Invalid local backend version: ${JSON.stringify(version4)}`
53740
+ )
53741
+ });
53742
+ }
53743
+ }
53728
53744
  async function findLatestVersionWithBinary(ctx, requireSuccess) {
53729
53745
  if (cachedLatestVersion !== null) {
53730
53746
  return cachedLatestVersion;
@@ -53847,7 +53863,7 @@ function getDownloadPath() {
53847
53863
  return null;
53848
53864
  }
53849
53865
  function getGithubDownloadUrl(version4, filename) {
53850
- return `https://github.com/get-convex/convex-backend/releases/download/${version4}/${filename}`;
53866
+ return `https://github.com/convex/convex-backend/releases/download/${version4}/${filename}`;
53851
53867
  }
53852
53868
  async function downloadZipFile(ctx, args) {
53853
53869
  const { version: version4, filename, nameForLogging } = args;
@@ -53902,6 +53918,7 @@ async function downloadZipFile(ctx, args) {
53902
53918
  return executablePath(version4);
53903
53919
  }
53904
53920
  async function ensureDashboardDownloaded(ctx, version4) {
53921
+ await assertValidBackendVersion(ctx, version4);
53905
53922
  const config3 = loadGlobalDashboardConfig(ctx);
53906
53923
  if (config3 !== null && config3.version === version4) {
53907
53924
  return;
@@ -53942,6 +53959,7 @@ var init_download = __esm({
53942
53959
  init_fsUtils();
53943
53960
  init_errors3();
53944
53961
  import_path5 = __toESM(require("path"), 1);
53962
+ init_utils2();
53945
53963
  cachedLatestVersion = null;
53946
53964
  }
53947
53965
  });
@@ -63774,6 +63792,11 @@ async function handleDashboard(ctx, deployment2, options) {
63774
63792
  ctx,
63775
63793
  dashboardPort,
63776
63794
  async (request, response) => {
63795
+ if (!isLoopbackHost(request.headers.host, dashboardPort)) {
63796
+ response.statusCode = 403;
63797
+ response.end();
63798
+ return;
63799
+ }
63777
63800
  const pathname = new URL(
63778
63801
  request.url ?? "/",
63779
63802
  // We only want to extract the pathname so the base doesn’t matter
@@ -63810,6 +63833,10 @@ async function handleDashboard(ctx, deployment2, options) {
63810
63833
  cleanupHandle
63811
63834
  };
63812
63835
  }
63836
+ function isLoopbackHost(host, port) {
63837
+ const normalizedHost = host?.toLowerCase();
63838
+ return normalizedHost === `127.0.0.1:${port}` || normalizedHost === `localhost:${port}`;
63839
+ }
63813
63840
  async function reportSelfHostedEvent(ctx, {
63814
63841
  anonymousId,
63815
63842
  eventName,
@@ -101547,6 +101574,130 @@ var require_chokidar = __commonJS({
101547
101574
  }
101548
101575
  });
101549
101576
 
101577
+ // ../node_modules/.pnpm/@vercel+detect-agent@1.2.5/node_modules/@vercel/detect-agent/dist/index.js
101578
+ var require_dist = __commonJS({
101579
+ "../node_modules/.pnpm/@vercel+detect-agent@1.2.5/node_modules/@vercel/detect-agent/dist/index.js"(exports2, module2) {
101580
+ "use strict";
101581
+ var __defProp3 = Object.defineProperty;
101582
+ var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
101583
+ var __getOwnPropNames3 = Object.getOwnPropertyNames;
101584
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
101585
+ var __export2 = (target3, all) => {
101586
+ for (var name in all)
101587
+ __defProp3(target3, name, { get: all[name], enumerable: true });
101588
+ };
101589
+ var __copyProps3 = (to, from, except, desc) => {
101590
+ if (from && typeof from === "object" || typeof from === "function") {
101591
+ for (let key of __getOwnPropNames3(from))
101592
+ if (!__hasOwnProp3.call(to, key) && key !== except)
101593
+ __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc3(from, key)) || desc.enumerable });
101594
+ }
101595
+ return to;
101596
+ };
101597
+ var __toCommonJS = (mod2) => __copyProps3(__defProp3({}, "__esModule", { value: true }), mod2);
101598
+ var src_exports = {};
101599
+ __export2(src_exports, {
101600
+ KNOWN_AGENTS: () => KNOWN_AGENTS,
101601
+ determineAgent: () => determineAgent2
101602
+ });
101603
+ module2.exports = __toCommonJS(src_exports);
101604
+ var import_promises3 = require("node:fs/promises");
101605
+ var import_node_fs5 = require("node:fs");
101606
+ var DEVIN_LOCAL_PATH = "/opt/.devin";
101607
+ var CURSOR = "cursor";
101608
+ var CURSOR_CLI = "cursor-cli";
101609
+ var CLAUDE = "claude";
101610
+ var COWORK = "cowork";
101611
+ var DEVIN = "devin";
101612
+ var REPLIT = "replit";
101613
+ var GEMINI = "gemini";
101614
+ var CODEX = "codex";
101615
+ var ANTIGRAVITY = "antigravity";
101616
+ var AUGMENT_CLI = "augment-cli";
101617
+ var OPENCODE = "opencode";
101618
+ var GITHUB_COPILOT = "github-copilot";
101619
+ var GITHUB_COPILOT_CLI = "github-copilot-cli";
101620
+ var V0 = "v0";
101621
+ var KNOWN_AGENTS = {
101622
+ CURSOR,
101623
+ CURSOR_CLI,
101624
+ CLAUDE,
101625
+ COWORK,
101626
+ DEVIN,
101627
+ REPLIT,
101628
+ GEMINI,
101629
+ CODEX,
101630
+ ANTIGRAVITY,
101631
+ AUGMENT_CLI,
101632
+ OPENCODE,
101633
+ GITHUB_COPILOT,
101634
+ V0
101635
+ };
101636
+ async function determineAgent2() {
101637
+ if (process.env.AI_AGENT) {
101638
+ const name = process.env.AI_AGENT.trim();
101639
+ if (name) {
101640
+ if (name === GITHUB_COPILOT || name === GITHUB_COPILOT_CLI) {
101641
+ return {
101642
+ isAgent: true,
101643
+ agent: { name: GITHUB_COPILOT }
101644
+ };
101645
+ }
101646
+ if (name === V0) {
101647
+ return {
101648
+ isAgent: true,
101649
+ agent: { name: V0 }
101650
+ };
101651
+ }
101652
+ return {
101653
+ isAgent: true,
101654
+ agent: { name }
101655
+ };
101656
+ }
101657
+ }
101658
+ if (process.env.CURSOR_TRACE_ID) {
101659
+ return { isAgent: true, agent: { name: CURSOR } };
101660
+ }
101661
+ if (process.env.CURSOR_AGENT || process.env.CURSOR_EXTENSION_HOST_ROLE === "agent-exec") {
101662
+ return { isAgent: true, agent: { name: CURSOR_CLI } };
101663
+ }
101664
+ if (process.env.GEMINI_CLI) {
101665
+ return { isAgent: true, agent: { name: GEMINI } };
101666
+ }
101667
+ if (process.env.CODEX_SANDBOX || process.env.CODEX_CI || process.env.CODEX_THREAD_ID) {
101668
+ return { isAgent: true, agent: { name: CODEX } };
101669
+ }
101670
+ if (process.env.ANTIGRAVITY_AGENT) {
101671
+ return { isAgent: true, agent: { name: ANTIGRAVITY } };
101672
+ }
101673
+ if (process.env.AUGMENT_AGENT) {
101674
+ return { isAgent: true, agent: { name: AUGMENT_CLI } };
101675
+ }
101676
+ if (process.env.OPENCODE_CLIENT) {
101677
+ return { isAgent: true, agent: { name: OPENCODE } };
101678
+ }
101679
+ if (process.env.CLAUDECODE || process.env.CLAUDE_CODE) {
101680
+ if (process.env.CLAUDE_CODE_IS_COWORK) {
101681
+ return { isAgent: true, agent: { name: COWORK } };
101682
+ }
101683
+ return { isAgent: true, agent: { name: CLAUDE } };
101684
+ }
101685
+ if (process.env.REPL_ID) {
101686
+ return { isAgent: true, agent: { name: REPLIT } };
101687
+ }
101688
+ if (process.env.COPILOT_MODEL || process.env.COPILOT_ALLOW_ALL || process.env.COPILOT_GITHUB_TOKEN) {
101689
+ return { isAgent: true, agent: { name: GITHUB_COPILOT } };
101690
+ }
101691
+ try {
101692
+ await (0, import_promises3.access)(DEVIN_LOCAL_PATH, import_node_fs5.constants.F_OK);
101693
+ return { isAgent: true, agent: { name: DEVIN } };
101694
+ } catch (_error) {
101695
+ }
101696
+ return { isAgent: false, agent: void 0 };
101697
+ }
101698
+ }
101699
+ });
101700
+
101550
101701
  // ../node_modules/.pnpm/openid-client@5.7.1/node_modules/openid-client/lib/errors.js
101551
101702
  var require_errors4 = __commonJS({
101552
101703
  "../node_modules/.pnpm/openid-client@5.7.1/node_modules/openid-client/lib/errors.js"(exports2, module2) {
@@ -115138,6 +115289,45 @@ var startPushResponse = looseObject({
115138
115289
  app: checkedComponent,
115139
115290
  schemaChange
115140
115291
  });
115292
+ var MIN_SCRUBBED_VALUE_LENGTH = 8;
115293
+ function redactEnvironmentVariableValues(node, environmentVariables) {
115294
+ const values = Object.values(environmentVariables).filter((value) => value.length >= MIN_SCRUBBED_VALUE_LENGTH).flatMap((value) => {
115295
+ const escaped = JSON.stringify(value).slice(1, -1);
115296
+ return escaped === value ? [value] : [value, escaped];
115297
+ }).sort((a, b) => b.length - a.length);
115298
+ const scrub = (child) => {
115299
+ if (typeof child === "string") {
115300
+ return values.reduce(
115301
+ (scrubbed, value) => scrubbed.split(value).join("<redacted>"),
115302
+ child
115303
+ );
115304
+ }
115305
+ if (Array.isArray(child)) {
115306
+ return child.map(scrub);
115307
+ }
115308
+ if (child !== null && typeof child === "object") {
115309
+ return Object.fromEntries(
115310
+ Object.entries(child).map(([key, grandchild]) => [
115311
+ key,
115312
+ scrub(grandchild)
115313
+ ])
115314
+ );
115315
+ }
115316
+ return child;
115317
+ };
115318
+ return scrub(node);
115319
+ }
115320
+ function startPushResponseForLogging(response) {
115321
+ return {
115322
+ ...redactEnvironmentVariableValues(response, response.environmentVariables),
115323
+ environmentVariables: Object.fromEntries(
115324
+ Object.keys(response.environmentVariables).map((name) => [
115325
+ name,
115326
+ "<redacted>"
115327
+ ])
115328
+ )
115329
+ };
115330
+ }
115141
115331
  var evaluatePushResponse = looseObject({
115142
115332
  schemaChange
115143
115333
  });
@@ -121107,7 +121297,9 @@ async function startComponentsPushAndCodegen(ctx, parentSpan, projectConfig, con
121107
121297
  (span) => startPush(ctx, span, startPushRequest2, options)
121108
121298
  );
121109
121299
  if (options.verbose) {
121110
- logMessage("startPush: " + JSON.stringify(startPushResponse2, null, 2));
121300
+ logMessage(
121301
+ "startPush: " + JSON.stringify(startPushResponseForLogging(startPushResponse2), null, 2)
121302
+ );
121111
121303
  }
121112
121304
  if (options.codegen) {
121113
121305
  changeSpinner("Generating TypeScript bindings...");
@@ -121255,7 +121447,14 @@ async function runComponentsPush(ctx, options, configPath, projectConfig) {
121255
121447
  }
121256
121448
  function printDiff(startPushResponse2, finishPushResponse, opts) {
121257
121449
  if (opts.verbose) {
121258
- const diffString = JSON.stringify(finishPushResponse, null, 2);
121450
+ const diffString = JSON.stringify(
121451
+ redactEnvironmentVariableValues(
121452
+ finishPushResponse,
121453
+ startPushResponse2.environmentVariables
121454
+ ),
121455
+ null,
121456
+ 2
121457
+ );
121259
121458
  logMessage(diffString);
121260
121459
  return;
121261
121460
  }
@@ -122424,6 +122623,18 @@ async function readFromStdin() {
122424
122623
 
122425
122624
  // src/cli/lib/env.ts
122426
122625
  init_prompts();
122626
+
122627
+ // src/cli/lib/utils/aiAgent.ts
122628
+ var import_detect_agent = __toESM(require_dist(), 1);
122629
+ async function detectAiAgent() {
122630
+ if (process.env.CONVEX_AGENT_MODE) {
122631
+ return "CONVEX_AGENT_MODE";
122632
+ }
122633
+ const result = await (0, import_detect_agent.determineAgent)();
122634
+ return result.isAgent ? result.agent.name : null;
122635
+ }
122636
+
122637
+ // src/cli/lib/env.ts
122427
122638
  init_envvars();
122428
122639
 
122429
122640
  // src/cli/lib/formatEnvValueForDotfile.ts
@@ -122570,8 +122781,10 @@ async function envList(ctx, backend, options) {
122570
122781
  logMessage(`No environment variables set${backend.notice}`);
122571
122782
  return;
122572
122783
  }
122784
+ const agent = options?.namesOnly || options?.includeValues ? null : await detectAiAgent();
122785
+ const namesOnly = options?.namesOnly || agent !== null;
122573
122786
  for (const { name, value } of envs) {
122574
- if (options?.namesOnly) {
122787
+ if (namesOnly) {
122575
122788
  logOutput(name);
122576
122789
  continue;
122577
122790
  }
@@ -122581,6 +122794,11 @@ async function envList(ctx, backend, options) {
122581
122794
  }
122582
122795
  logOutput(`${name}=${formatted}`);
122583
122796
  }
122797
+ if (agent !== null) {
122798
+ logMessage(
122799
+ `Listed names only because an AI agent (${agent}) appears to be running this command. Pass --include-values to print the values too.`
122800
+ );
122801
+ }
122584
122802
  }
122585
122803
  async function getFileContents(ctx, filePath) {
122586
122804
  if (!ctx.fs.exists(filePath)) {
@@ -123237,7 +123455,7 @@ async function installGuidelinesFile({
123237
123455
  "Could not download Convex AI guidelines right now. You can retry with: npx convex ai-files install"
123238
123456
  )
123239
123457
  );
123240
- return;
123458
+ return false;
123241
123459
  }
123242
123460
  await import_fs10.promises.mkdir(aiDirForConvexDir(convexDir), { recursive: true });
123243
123461
  await import_fs10.promises.writeFile(guidelinesPathForConvexDir(convexDir), guidelines, "utf8");
@@ -123245,6 +123463,7 @@ async function installGuidelinesFile({
123245
123463
  logMessage(
123246
123464
  `${chalkStderr.green("\u2714")} ${guidelinesPathForConvexDir(convexDir)} written`
123247
123465
  );
123466
+ return true;
123248
123467
  }
123249
123468
 
123250
123469
  // src/cli/lib/aiFiles/state.ts
@@ -123255,7 +123474,7 @@ var aiFilesStateSchema = external_exports.object({
123255
123474
  guidelinesHash: external_exports.string().nullable(),
123256
123475
  agentsMdSectionHash: external_exports.string().nullable(),
123257
123476
  claudeMdHash: external_exports.string().nullable(),
123258
- // Commit SHA from get-convex/agent-skills that was current when skills were
123477
+ // Commit SHA from convex/agent-skills that was current when skills were
123259
123478
  // last installed. Used to detect when newer skills are available.
123260
123479
  agentSkillsSha: external_exports.string().nullable()
123261
123480
  });
@@ -123434,7 +123653,7 @@ function configuredSkillAgents(aiFilesConfig) {
123434
123653
  return aiFilesConfig?.skills?.agents ?? defaultAgents;
123435
123654
  }
123436
123655
  function runSkillsAdd(cwd2, agents) {
123437
- const args = ["add", "get-convex/agent-skills", "--yes", "--copy"];
123656
+ const args = ["add", "convex/agent-skills", "--yes", "--copy"];
123438
123657
  for (const agent of agents) {
123439
123658
  args.push("--agent", agent);
123440
123659
  }
@@ -123490,21 +123709,22 @@ async function installSkills({
123490
123709
  aiFilesConfig
123491
123710
  }) {
123492
123711
  const agents = configuredSkillAgents(aiFilesConfig);
123493
- if (agents.length === 0) return;
123494
- if (!await shouldRunSkillsCli()) return;
123712
+ if (agents.length === 0) return true;
123713
+ if (!await shouldRunSkillsCli()) return true;
123495
123714
  logMessage("Installing Convex agent skills...");
123496
123715
  const skillsOk = await runSkillsAdd(projectDir, agents);
123497
123716
  if (!skillsOk) {
123498
123717
  logMessage(
123499
123718
  chalkStderr.yellow(
123500
- "Could not install agent skills. You can retry manually with: npx skills add get-convex/agent-skills --copy"
123719
+ "Could not install agent skills. You can retry manually with: npx skills add convex/agent-skills --copy"
123501
123720
  )
123502
123721
  );
123503
- return;
123722
+ return false;
123504
123723
  }
123505
123724
  const sha = await fetchAgentSkillsSha();
123506
123725
  if (sha) state.agentSkillsSha = sha;
123507
123726
  logMessage(`${chalkStderr.green("\u2714")} Skills installed`);
123727
+ return true;
123508
123728
  }
123509
123729
  async function removeInstalledSkills({
123510
123730
  projectDir,
@@ -123591,12 +123811,23 @@ async function installAiFiles({
123591
123811
  }) {
123592
123812
  const convexDirName = import_path25.default.relative(projectDir, convexDir);
123593
123813
  const state = await readAiStateOrDefault(convexDir);
123594
- await installGuidelinesFile({ convexDir, state });
123814
+ const guidelinesInstalled = await installGuidelinesFile({ convexDir, state });
123595
123815
  await applyAgentsMdSection({ projectDir, state, convexDirName });
123596
123816
  await applyClaudeMdSection({ projectDir, state, convexDirName });
123597
- await installSkills({ projectDir, state, aiFilesConfig });
123817
+ const skillsInstalled = await installSkills({
123818
+ projectDir,
123819
+ state,
123820
+ aiFilesConfig
123821
+ });
123598
123822
  await removeLegacyCursorRulesFile(projectDir);
123599
123823
  await writeAiState({ state, convexDir });
123824
+ if (!guidelinesInstalled || !skillsInstalled) {
123825
+ return {
123826
+ kind: "error",
123827
+ message: "Some Convex AI files could not be installed. See the messages above."
123828
+ };
123829
+ }
123830
+ return { kind: "success" };
123600
123831
  }
123601
123832
  async function attemptToInstallAiFiles(opts) {
123602
123833
  try {
@@ -125925,8 +126156,19 @@ async function resolveProjectPaths() {
125925
126156
  var aiInstall = new Command2("install").summary("Install or refresh Convex AI files").description(
125926
126157
  "Installs the following (or refreshes them if already present):\n - convex/_generated/ai/guidelines.md\n - AGENTS.md (Convex section only)\n - CLAUDE.md (Convex section only)\n - Agent skills (installed to each coding agent's native path, configured via convex.json)"
125927
126158
  ).allowExcessArguments(false).action(async () => {
125928
- const { projectDir, convexDir, aiFilesConfig } = await resolveProjectPaths();
125929
- await installAiFiles({ projectDir, convexDir, aiFilesConfig });
126159
+ const { ctx, projectDir, convexDir, aiFilesConfig } = await resolveProjectPaths();
126160
+ const result = await installAiFiles({
126161
+ projectDir,
126162
+ convexDir,
126163
+ aiFilesConfig
126164
+ });
126165
+ if (result.kind === "error") {
126166
+ return await ctx.crash({
126167
+ exitCode: 1,
126168
+ errorType: "fatal",
126169
+ printedMessage: result.message
126170
+ });
126171
+ }
125930
126172
  logMessage(`${chalkStderr.green("\u2714")} Convex AI files installed.`);
125931
126173
  });
125932
126174
  var aiEnable = new Command2("enable").summary("Enable Convex AI files").description(
@@ -125943,8 +126185,19 @@ var aiEnable = new Command2("enable").summary("Enable Convex AI files").descript
125943
126185
  var aiUpdate = new Command2("update").summary("Update Convex AI files to the latest version").description(
125944
126186
  "Updates the following to their latest versions:\n - convex/_generated/ai/guidelines.md\n - AGENTS.md (Convex section only)\n - CLAUDE.md (Convex section only)\n - Agent skills (installed to each coding agent's native path, configured via convex.json)"
125945
126187
  ).allowExcessArguments(false).action(async () => {
125946
- const { projectDir, convexDir, aiFilesConfig } = await resolveProjectPaths();
125947
- await installAiFiles({ projectDir, convexDir, aiFilesConfig });
126188
+ const { ctx, projectDir, convexDir, aiFilesConfig } = await resolveProjectPaths();
126189
+ const result = await installAiFiles({
126190
+ projectDir,
126191
+ convexDir,
126192
+ aiFilesConfig
126193
+ });
126194
+ if (result.kind === "error") {
126195
+ return await ctx.crash({
126196
+ exitCode: 1,
126197
+ errorType: "fatal",
126198
+ printedMessage: result.message
126199
+ });
126200
+ }
125948
126201
  logMessage(`${chalkStderr.green("\u2714")} Convex AI files updated.`);
125949
126202
  });
125950
126203
  var aiDisable = new Command2("disable").summary("Disable Convex AI files without removing them").description(
@@ -130846,6 +131099,8 @@ var envDefaultList = addEnvDefaultOptions(
130846
131099
  "\u2022 List only default variable names (no values): `npx convex env default list --names-only`",
130847
131100
  "\u2022 List all default variables and their values: `npx convex env default list --include-values`",
130848
131101
  "",
131102
+ "When an AI agent runs this command (detected from environment variables like AI_AGENT or CLAUDECODE), only names are listed unless --include-values is passed.",
131103
+ "",
130849
131104
  "The deployment type is determined by the current deployment (local maps to dev), or by --type if provided."
130850
131105
  ].join("\n")
130851
131106
  ).option(
@@ -130854,7 +131109,7 @@ var envDefaultList = addEnvDefaultOptions(
130854
131109
  ).addOption(
130855
131110
  new Option2(
130856
131111
  "--include-values",
130857
- "Print each variable's value alongside its name, in .env format (the default). Pass it explicitly in scripts that rely on the values."
131112
+ "Print each variable's value alongside its name, in .env format. This is the default unless an AI agent is detected, so pass it explicitly in scripts that rely on the values."
130858
131113
  ).conflicts("namesOnly")
130859
131114
  ).configureHelp({ showGlobalOptions: true }).allowExcessArguments(false)
130860
131115
  ).action(async (cmdOptions, cmd) => {
@@ -130862,7 +131117,8 @@ var envDefaultList = addEnvDefaultOptions(
130862
131117
  const { ctx, backend } = await resolveEnvDefaultBackend(options);
130863
131118
  await ensureHasConvexDependency(ctx, "env default list");
130864
131119
  await envList(ctx, backend, {
130865
- namesOnly: cmdOptions.namesOnly ?? false
131120
+ namesOnly: cmdOptions.namesOnly ?? false,
131121
+ includeValues: cmdOptions.includeValues ?? false
130866
131122
  });
130867
131123
  });
130868
131124
  var envDefault = new Command2("default").summary("Manage project-level default environment variables").description(
@@ -131090,7 +131346,9 @@ var envListCmd = new Command2("list").summary("List all environment variables an
131090
131346
  "\u2022 List only variable names (no values): `npx convex env list --names-only`",
131091
131347
  "\u2022 List all variables and their values: `npx convex env list --include-values`",
131092
131348
  "\u2022 Save all variables to a file: `npx convex env list --include-values > .env.convex`",
131093
- "\u2022 Append to a file: `npx convex env list --include-values >> .env.convex`"
131349
+ "\u2022 Append to a file: `npx convex env list --include-values >> .env.convex`",
131350
+ "",
131351
+ "When an AI agent runs this command (detected from environment variables like AI_AGENT or CLAUDECODE), only names are listed unless --include-values is passed."
131094
131352
  ].join("\n")
131095
131353
  ).option(
131096
131354
  "--names-only",
@@ -131098,7 +131356,7 @@ var envListCmd = new Command2("list").summary("List all environment variables an
131098
131356
  ).addOption(
131099
131357
  new Option2(
131100
131358
  "--include-values",
131101
- "Print each variable's value alongside its name, in .env format (the default). Pass it explicitly in scripts that rely on the values."
131359
+ "Print each variable's value alongside its name, in .env format. This is the default unless an AI agent is detected, so pass it explicitly in scripts that rely on the values."
131102
131360
  ).conflicts("namesOnly")
131103
131361
  ).configureHelp({ showGlobalOptions: true }).allowExcessArguments(false).action(async (cmdOptions, cmd) => {
131104
131362
  const options = cmd.optsWithGlobals();
@@ -131110,7 +131368,8 @@ var envListCmd = new Command2("list").summary("List all environment variables an
131110
131368
  action: async () => {
131111
131369
  const backend = deploymentEnvBackend(ctx, deployment2);
131112
131370
  await envList(ctx, backend, {
131113
- namesOnly: cmdOptions.namesOnly ?? false
131371
+ namesOnly: cmdOptions.namesOnly ?? false,
131372
+ includeValues: cmdOptions.includeValues ?? false
131114
131373
  });
131115
131374
  }
131116
131375
  });
@@ -151150,7 +151409,7 @@ var require_limit = /* @__PURE__ */ __commonJSMin(((exports2) => {
151150
151409
  };
151151
151410
  exports2.default = formatLimitPlugin;
151152
151411
  }));
151153
- var require_dist = /* @__PURE__ */ __commonJSMin(((exports2, module2) => {
151412
+ var require_dist2 = /* @__PURE__ */ __commonJSMin(((exports2, module2) => {
151154
151413
  Object.defineProperty(exports2, "__esModule", { value: true });
151155
151414
  const formats_1 = require_formats();
151156
151415
  const limit_1 = require_limit();
@@ -151185,7 +151444,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports2, module2) => {
151185
151444
  var import_ajv = require_ajv();
151186
151445
  var import__2019 = require__2019();
151187
151446
  var import__2020 = require__2020();
151188
- var import_dist = /* @__PURE__ */ __toESM2(require_dist(), 1);
151447
+ var import_dist = /* @__PURE__ */ __toESM2(require_dist2(), 1);
151189
151448
  var addFormats = import_dist.default;
151190
151449
  function createDefaultAjvInstance(engineClass) {
151191
151450
  const ajv = new engineClass({