sim-setup 1.0.71-preview.395.1 → 1.0.71-preview.397.1

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
@@ -178,7 +178,6 @@ npx sim-setup add email
178
178
  npx sim-setup add storage
179
179
  npx sim-setup add sandbox
180
180
  npx sim-setup add jobs
181
- npx sim-setup add cache
182
181
  npx sim-setup add knowledge
183
182
  npx sim-setup add knowledge-embeddings
184
183
  npx sim-setup add chat
@@ -120,9 +120,10 @@ services:
120
120
  command: ['bun', 'run', 'db:migrate']
121
121
  restart: 'no'
122
122
 
123
- # Backs pub/sub (live Chat task-status and table events) and the shared caches.
124
- # The app falls back to PostgreSQL for storage when REDIS_URL is unset, but the
125
- # pub/sub channels have no fallback — without Redis, live status never streams.
123
+ # Required: rate limiting, OTPs, pub/sub (live Chat task-status and table
124
+ # events), realtime coordination, and the shared caches all live here, and the
125
+ # app and realtime refuse to start without REDIS_URL. Set REDIS_URL in .env to
126
+ # use a managed Redis instead.
126
127
  # Not published to the host: only the app and realtime containers need it, and
127
128
  # binding 6379 would collide with a Redis already running locally.
128
129
  redis:
package/dist/index.js CHANGED
@@ -1126,25 +1126,22 @@ function validateCapabilityFieldInput(definition, key, value, providerId) {
1126
1126
  return;
1127
1127
  throw new Error(`${definition.label} has no validation definition for ${key}`);
1128
1128
  }
1129
- function validateRedisProvider(values) {
1129
+ function getRedisConfigurationError(values) {
1130
1130
  if (!hasValue(values, "REDIS_URL"))
1131
- return [];
1131
+ return "REDIS_URL is required";
1132
1132
  let redisUrl;
1133
1133
  try {
1134
1134
  redisUrl = new URL(String(readValue(values, "REDIS_URL")));
1135
1135
  } catch {
1136
- return [];
1136
+ return "REDIS_URL must be a valid redis:// or rediss:// URL";
1137
+ }
1138
+ if (!REDIS_URL_PROTOCOLS.includes(redisUrl.protocol)) {
1139
+ return "REDIS_URL must be a valid redis:// or rediss:// URL";
1137
1140
  }
1138
1141
  if (redisUrl.protocol === "rediss:" && /^\d+\.\d+\.\d+\.\d+$/.test(redisUrl.hostname) && !hasValue(values, "REDIS_TLS_SERVERNAME")) {
1139
- return [
1140
- {
1141
- kind: "missing",
1142
- fields: ["REDIS_TLS_SERVERNAME"],
1143
- message: "REDIS_TLS_SERVERNAME is required for rediss:// IP addresses"
1144
- }
1145
- ];
1142
+ return "REDIS_TLS_SERVERNAME is required for rediss:// IP addresses";
1146
1143
  }
1147
- return [];
1144
+ return null;
1148
1145
  }
1149
1146
  function validateEmbeddingModelWidth(values) {
1150
1147
  const model = String(readValue(values, "KB_EMBEDDING_MODEL") ?? "");
@@ -1219,7 +1216,7 @@ function inspectOAuthClientCapability(providerId, values) {
1219
1216
  setupCommand: `npx sim-setup add integration ${providerId}`
1220
1217
  };
1221
1218
  }
1222
- var CORE_CONFIGURATION_KEYS, EnvCapabilityConfigurationError, EMAIL_CAPABILITY, STORAGE_CAPABILITY, SANDBOX_CAPABILITY, ASYNC_JOBS_CAPABILITY, CACHE_CAPABILITY, OCR_CAPABILITY, OLLAMA_EMBEDDING_MODEL_PREFIX = "ollama/", KB_EMBEDDING_MODEL_WIDTHS, GEMINI_KB_EMBEDDING_MODELS, embeddingFamilyIs = (family) => (values) => knowledgeEmbeddingFamily(values) === family, OPENAI_EMBEDDING_WIDTHS, GEMINI_EMBEDDING_WIDTHS, OLLAMA_EMBEDDING_WIDTHS, KNOWLEDGE_EMBEDDINGS_CAPABILITY, OAUTH_CLIENT_CAPABILITIES, ENV_CAPABILITIES, LLM_KEY_POOLS, DEPLOYMENT_CONFIGURATION_KEYS, GOOGLE_OAUTH_SERVICES, MICROSOFT_OAUTH_SERVICES;
1219
+ var CORE_CONFIGURATION_KEYS, EnvCapabilityConfigurationError, EMAIL_CAPABILITY, STORAGE_CAPABILITY, SANDBOX_CAPABILITY, ASYNC_JOBS_CAPABILITY, REDIS_URL_PROTOCOLS, OCR_CAPABILITY, OLLAMA_EMBEDDING_MODEL_PREFIX = "ollama/", KB_EMBEDDING_MODEL_WIDTHS, GEMINI_KB_EMBEDDING_MODELS, embeddingFamilyIs = (family) => (values) => knowledgeEmbeddingFamily(values) === family, OPENAI_EMBEDDING_WIDTHS, GEMINI_EMBEDDING_WIDTHS, OLLAMA_EMBEDDING_WIDTHS, KNOWLEDGE_EMBEDDINGS_CAPABILITY, OAUTH_CLIENT_CAPABILITIES, ENV_CAPABILITIES, LLM_KEY_POOLS, DEPLOYMENT_CONFIGURATION_KEYS, GOOGLE_OAUTH_SERVICES, MICROSOFT_OAUTH_SERVICES;
1223
1220
  var init_env_capabilities = __esm(() => {
1224
1221
  init_sandbox_references();
1225
1222
  CORE_CONFIGURATION_KEYS = [
@@ -1228,7 +1225,8 @@ var init_env_capabilities = __esm(() => {
1228
1225
  "BETTER_AUTH_URL",
1229
1226
  "NEXT_PUBLIC_APP_URL",
1230
1227
  "ENCRYPTION_KEY",
1231
- "INTERNAL_API_SECRET"
1228
+ "INTERNAL_API_SECRET",
1229
+ "REDIS_URL"
1232
1230
  ];
1233
1231
  EnvCapabilityConfigurationError = class EnvCapabilityConfigurationError extends Error {
1234
1232
  capabilityId;
@@ -1391,10 +1389,7 @@ var init_env_capabilities = __esm(() => {
1391
1389
  message: SANDBOX_RELEASE_GENERATION_ERROR
1392
1390
  }
1393
1391
  })),
1394
- optionalFields: [
1395
- envField("NEXT_PUBLIC_E2B_ENABLED"),
1396
- envField("NEXT_PUBLIC_SANDBOXES_ENABLED")
1397
- ]
1392
+ optionalFields: [envField("NEXT_PUBLIC_E2B_ENABLED")]
1398
1393
  },
1399
1394
  {
1400
1395
  id: "daytona",
@@ -1409,10 +1404,7 @@ var init_env_capabilities = __esm(() => {
1409
1404
  message: IMMUTABLE_DAYTONA_SNAPSHOT_REF_ERROR
1410
1405
  }
1411
1406
  })),
1412
- optionalFields: [
1413
- envField("NEXT_PUBLIC_E2B_ENABLED"),
1414
- envField("NEXT_PUBLIC_SANDBOXES_ENABLED")
1415
- ]
1407
+ optionalFields: [envField("NEXT_PUBLIC_E2B_ENABLED")]
1416
1408
  }
1417
1409
  ]
1418
1410
  });
@@ -1435,29 +1427,7 @@ var init_env_capabilities = __esm(() => {
1435
1427
  }
1436
1428
  ]
1437
1429
  });
1438
- CACHE_CAPABILITY = defineCapability({
1439
- strategy: "selected",
1440
- id: "cache",
1441
- label: "Cache",
1442
- whenUnset: "first-ready",
1443
- defaultProvider: { id: "database", kind: "built-in", label: "Postgres" },
1444
- providers: [
1445
- {
1446
- id: "redis",
1447
- label: "Redis",
1448
- activation: { mode: "any-present", keys: ["REDIS_URL"] },
1449
- requires: envField("REDIS_URL", {
1450
- validation: {
1451
- kind: "url",
1452
- protocols: ["redis:", "rediss:"],
1453
- message: "must be a valid redis:// or rediss:// URL"
1454
- }
1455
- }),
1456
- optionalFields: [envField("REDIS_TLS_SERVERNAME")],
1457
- validate: validateRedisProvider
1458
- }
1459
- ]
1460
- });
1430
+ REDIS_URL_PROTOCOLS = ["redis:", "rediss:"];
1461
1431
  OCR_CAPABILITY = defineCapability({
1462
1432
  strategy: "selected",
1463
1433
  id: "knowledge",
@@ -1633,7 +1603,6 @@ var init_env_capabilities = __esm(() => {
1633
1603
  STORAGE_CAPABILITY,
1634
1604
  SANDBOX_CAPABILITY,
1635
1605
  ASYNC_JOBS_CAPABILITY,
1636
- CACHE_CAPABILITY,
1637
1606
  OCR_CAPABILITY,
1638
1607
  KNOWLEDGE_EMBEDDINGS_CAPABILITY
1639
1608
  ];
@@ -1666,11 +1635,11 @@ var init_env_capabilities = __esm(() => {
1666
1635
  ...new Set([
1667
1636
  ...CORE_CONFIGURATION_KEYS,
1668
1637
  ...ENV_CAPABILITIES.flatMap(capabilityKeys),
1638
+ "REDIS_TLS_SERVERNAME",
1669
1639
  "COPILOT_API_KEY",
1670
1640
  "EMAIL_VERIFICATION_ENABLED",
1671
1641
  "NEXT_PUBLIC_CHAT_DISABLED",
1672
1642
  "NEXT_PUBLIC_E2B_ENABLED",
1673
- "NEXT_PUBLIC_SANDBOXES_ENABLED",
1674
1643
  "SIM_AGENT_API_URL",
1675
1644
  ...Object.values(LLM_KEY_POOLS).flatMap((pool) => [
1676
1645
  ...pool.keys,
@@ -2156,7 +2125,7 @@ function matchesSetupCondition(condition, values) {
2156
2125
  }
2157
2126
  return !matchesSetupCondition(condition.condition, values);
2158
2127
  }
2159
- var EMAIL_SETUP, STORAGE_SETUP, SANDBOX_SETUP, JOBS_SETUP, CACHE_SETUP, KNOWLEDGE_SETUP, OPENAI_EMBEDDING_MODEL_PROMPTS, KNOWLEDGE_EMBEDDINGS_SETUP, CAPABILITY_SETUPS, configuredCapabilityIds, missingCapabilitySetups, SETUP_FEATURES, OAUTH_CLIENT_SETUP_FIELDS;
2128
+ var EMAIL_SETUP, STORAGE_SETUP, SANDBOX_SETUP, JOBS_SETUP, KNOWLEDGE_SETUP, OPENAI_EMBEDDING_MODEL_PROMPTS, KNOWLEDGE_EMBEDDINGS_SETUP, CAPABILITY_SETUPS, configuredCapabilityIds, missingCapabilitySetups, SETUP_FEATURES, OAUTH_CLIENT_SETUP_FIELDS;
2160
2129
  var init_capability_config = __esm(() => {
2161
2130
  init_env_capabilities();
2162
2131
  EMAIL_SETUP = defineCapabilitySetup(EMAIL_CAPABILITY, {
@@ -2454,8 +2423,7 @@ var init_capability_config = __esm(() => {
2454
2423
  label: "Disabled",
2455
2424
  hint: "local JavaScript execution only",
2456
2425
  env: {
2457
- NEXT_PUBLIC_E2B_ENABLED: "false",
2458
- NEXT_PUBLIC_SANDBOXES_ENABLED: "false"
2426
+ NEXT_PUBLIC_E2B_ENABLED: "false"
2459
2427
  },
2460
2428
  currentWhen: {
2461
2429
  kind: "all",
@@ -2477,8 +2445,7 @@ var init_capability_config = __esm(() => {
2477
2445
  e2b: {
2478
2446
  hint: "dedicated Function code and CLI sandboxes",
2479
2447
  env: {
2480
- NEXT_PUBLIC_E2B_ENABLED: "true",
2481
- NEXT_PUBLIC_SANDBOXES_ENABLED: "true"
2448
+ NEXT_PUBLIC_E2B_ENABLED: "true"
2482
2449
  },
2483
2450
  prompts: [
2484
2451
  { type: "field", key: "E2B_API_KEY", input: "secret", required: true },
@@ -2504,8 +2471,7 @@ var init_capability_config = __esm(() => {
2504
2471
  daytona: {
2505
2472
  hint: "dedicated Function code and CLI sandboxes",
2506
2473
  env: {
2507
- NEXT_PUBLIC_E2B_ENABLED: "false",
2508
- NEXT_PUBLIC_SANDBOXES_ENABLED: "true"
2474
+ NEXT_PUBLIC_E2B_ENABLED: "false"
2509
2475
  },
2510
2476
  prompts: [
2511
2477
  {
@@ -2553,35 +2519,6 @@ var init_capability_config = __esm(() => {
2553
2519
  },
2554
2520
  optionOrder: ["database", "trigger-dev"]
2555
2521
  });
2556
- CACHE_SETUP = defineCapabilitySetup(CACHE_CAPABILITY, {
2557
- label: "Redis cache",
2558
- message: "Cache and realtime coordination?",
2559
- actions: {},
2560
- defaultOption: { hint: "built-in default" },
2561
- providers: {
2562
- redis: {
2563
- hint: "recommended for multiple replicas",
2564
- prompts: [
2565
- {
2566
- type: "field",
2567
- key: "REDIS_URL",
2568
- input: "text",
2569
- required: true,
2570
- defaultValue: "redis://localhost:6379",
2571
- validate: true
2572
- },
2573
- {
2574
- type: "field",
2575
- key: "REDIS_TLS_SERVERNAME",
2576
- input: "text",
2577
- required: true,
2578
- when: { kind: "provider-missing-field", key: "REDIS_TLS_SERVERNAME" }
2579
- }
2580
- ]
2581
- }
2582
- },
2583
- optionOrder: ["database", "redis"]
2584
- });
2585
2522
  KNOWLEDGE_SETUP = defineCapabilitySetup(OCR_CAPABILITY, {
2586
2523
  label: "Knowledge and OCR",
2587
2524
  message: "PDF OCR provider?",
@@ -2843,7 +2780,6 @@ var init_capability_config = __esm(() => {
2843
2780
  STORAGE_SETUP,
2844
2781
  SANDBOX_SETUP,
2845
2782
  JOBS_SETUP,
2846
- CACHE_SETUP,
2847
2783
  KNOWLEDGE_SETUP,
2848
2784
  KNOWLEDGE_EMBEDDINGS_SETUP
2849
2785
  ];
@@ -3100,10 +3036,6 @@ function inspectSandbox(values) {
3100
3036
  if (isTruthyEnvCapabilityValue(values, "E2B_ENABLED") !== isTruthyEnvCapabilityValue(values, "NEXT_PUBLIC_E2B_ENABLED")) {
3101
3037
  coherenceProblems.push("E2B_ENABLED and NEXT_PUBLIC_E2B_ENABLED disagree");
3102
3038
  }
3103
- const remoteAvailable = providerId !== null && providerId !== "disabled";
3104
- if (remoteAvailable !== isTruthyEnvCapabilityValue(values, "NEXT_PUBLIC_SANDBOXES_ENABLED")) {
3105
- coherenceProblems.push("remote sandbox availability and NEXT_PUBLIC_SANDBOXES_ENABLED disagree");
3106
- }
3107
3039
  if (coherenceProblems.length > 0) {
3108
3040
  return {
3109
3041
  ...featureMetadata("sandbox"),
@@ -3152,27 +3084,6 @@ function inspectJobs(values) {
3152
3084
  issue: issue(state, inspection.error)
3153
3085
  };
3154
3086
  }
3155
- function inspectCache(values) {
3156
- const inspection = inspectCapability(CACHE_CAPABILITY, values);
3157
- if (!inspection.error && inspection.providerId) {
3158
- return {
3159
- ...featureMetadata("cache"),
3160
- state: inspection.providerId === "database" ? "default" : "configured",
3161
- providerId: inspection.providerId
3162
- };
3163
- }
3164
- if (!inspection.error) {
3165
- throw new Error("Cache inspection failed without a configuration error");
3166
- }
3167
- const redis = inspection.providers.find((provider) => provider.id === "redis");
3168
- const state = redis?.state === "invalid" ? "invalid" : "partial";
3169
- return {
3170
- ...featureMetadata("cache"),
3171
- state,
3172
- providerId: "redis",
3173
- issue: issue(state, inspection.error)
3174
- };
3175
- }
3176
3087
  function inspectKnowledge(values) {
3177
3088
  const inspection = inspectCapability(OCR_CAPABILITY, values);
3178
3089
  if (!inspection.error && inspection.providerId) {
@@ -3280,7 +3191,6 @@ function buildEnvCapabilityStatus(values) {
3280
3191
  storage: FEATURE_STATUS_BUILDERS.storage(values),
3281
3192
  sandbox: FEATURE_STATUS_BUILDERS.sandbox(values),
3282
3193
  jobs: FEATURE_STATUS_BUILDERS.jobs(values),
3283
- cache: FEATURE_STATUS_BUILDERS.cache(values),
3284
3194
  knowledge: FEATURE_STATUS_BUILDERS.knowledge(values),
3285
3195
  "knowledge-embeddings": FEATURE_STATUS_BUILDERS["knowledge-embeddings"](values),
3286
3196
  llm: FEATURE_STATUS_BUILDERS.llm(values)
@@ -3297,13 +3207,109 @@ var init_capability_status = __esm(() => {
3297
3207
  storage: inspectStorage,
3298
3208
  sandbox: inspectSandbox,
3299
3209
  jobs: inspectJobs,
3300
- cache: inspectCache,
3301
3210
  knowledge: inspectKnowledge,
3302
3211
  "knowledge-embeddings": inspectKnowledgeEmbeddings,
3303
3212
  llm: inspectLlm
3304
3213
  };
3305
3214
  });
3306
3215
 
3216
+ // ../deployment-config/src/registration.ts
3217
+ function modeFromAxes({ signup, emailAuth }) {
3218
+ if (!emailAuth)
3219
+ return signup === "closed" ? "closed-no-email" : "no-email";
3220
+ return signup;
3221
+ }
3222
+ function mostRestrictive(a, b) {
3223
+ return {
3224
+ signup: SIGNUP_LEVELS[Math.max(SIGNUP_LEVELS.indexOf(a.signup), SIGNUP_LEVELS.indexOf(b.signup))],
3225
+ emailAuth: a.emailAuth && b.emailAuth
3226
+ };
3227
+ }
3228
+ function normalize(value) {
3229
+ return value?.trim().toLowerCase() || undefined;
3230
+ }
3231
+ function isOn(value) {
3232
+ const normalized = normalize(value);
3233
+ return normalized === "true" || normalized === "1";
3234
+ }
3235
+ function isOff(value) {
3236
+ const normalized = normalize(value);
3237
+ return normalized === "false" || normalized === "0";
3238
+ }
3239
+ function isRegistrationMode(value) {
3240
+ return typeof value === "string" && REGISTRATION_MODES.includes(value);
3241
+ }
3242
+ function resolveRegistrationMode(read) {
3243
+ const warnings = [];
3244
+ const legacy = (key) => read(DEPRECATED_REGISTRATION_ENV_VARS[key]);
3245
+ const rawMode = read(REGISTRATION_MODE_ENV_VAR)?.trim() || undefined;
3246
+ const normalizedMode = normalize(rawMode);
3247
+ let configured;
3248
+ if (rawMode !== undefined) {
3249
+ if (isRegistrationMode(normalizedMode)) {
3250
+ configured = normalizedMode;
3251
+ } else {
3252
+ configured = "closed";
3253
+ warnings.push({
3254
+ code: "invalid-mode",
3255
+ severity: "error",
3256
+ message: "REGISTRATION_MODE is not a recognized value, so self-serve registration is closed until it is corrected. Existing accounts can still sign in.",
3257
+ details: { value: rawMode, allowed: REGISTRATION_MODES }
3258
+ });
3259
+ }
3260
+ }
3261
+ const setLegacy = Object.keys(DEPRECATED_REGISTRATION_ENV_VARS).filter((key) => normalize(legacy(key)) !== undefined).map((key) => DEPRECATED_REGISTRATION_ENV_VARS[key]);
3262
+ const legacyAxes = {
3263
+ signup: isOn(legacy("disableRegistration")) ? "closed" : isOn(legacy("disableEmailSignup")) ? "no-email-signup" : "open",
3264
+ emailAuth: !isOff(legacy("emailPasswordSignupEnabled")) && !isOff(legacy("publicEmailPasswordSignupEnabled"))
3265
+ };
3266
+ const legacyMode = modeFromAxes(legacyAxes);
3267
+ if (setLegacy.length > 0) {
3268
+ warnings.push({
3269
+ code: "deprecated-variables",
3270
+ severity: "warn",
3271
+ message: "Deprecated registration variables are set. Replace them with REGISTRATION_MODE; they still apply until removed.",
3272
+ details: { variables: setLegacy, equivalentMode: legacyMode }
3273
+ });
3274
+ }
3275
+ if (configured === undefined)
3276
+ return { mode: legacyMode, warnings };
3277
+ const resolved = modeFromAxes(mostRestrictive(MODE_AXES[configured], legacyAxes));
3278
+ if (resolved !== configured) {
3279
+ warnings.push({
3280
+ code: "conflict",
3281
+ severity: "warn",
3282
+ message: "Deprecated registration variables are more restrictive than REGISTRATION_MODE, so the most restrictive combination applies.",
3283
+ details: { configured, legacy: legacyMode, resolved }
3284
+ });
3285
+ }
3286
+ return { mode: resolved, warnings };
3287
+ }
3288
+ var REGISTRATION_MODE_ENV_VAR = "REGISTRATION_MODE", REGISTRATION_MODES, DEPRECATED_REGISTRATION_ENV_VARS, SIGNUP_LEVELS, MODE_AXES;
3289
+ var init_registration = __esm(() => {
3290
+ REGISTRATION_MODES = [
3291
+ "open",
3292
+ "no-email-signup",
3293
+ "closed",
3294
+ "no-email",
3295
+ "closed-no-email"
3296
+ ];
3297
+ DEPRECATED_REGISTRATION_ENV_VARS = {
3298
+ disableRegistration: "DISABLE_REGISTRATION",
3299
+ disableEmailSignup: "DISABLE_EMAIL_SIGNUP",
3300
+ emailPasswordSignupEnabled: "EMAIL_PASSWORD_SIGNUP_ENABLED",
3301
+ publicEmailPasswordSignupEnabled: "NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED"
3302
+ };
3303
+ SIGNUP_LEVELS = ["open", "no-email-signup", "closed"];
3304
+ MODE_AXES = {
3305
+ open: { signup: "open", emailAuth: true },
3306
+ "no-email-signup": { signup: "no-email-signup", emailAuth: true },
3307
+ closed: { signup: "closed", emailAuth: true },
3308
+ "no-email": { signup: "open", emailAuth: false },
3309
+ "closed-no-email": { signup: "closed", emailAuth: false }
3310
+ };
3311
+ });
3312
+
3307
3313
  // ../utils/src/random.ts
3308
3314
  function generateRandomBytes(length) {
3309
3315
  return crypto.getRandomValues(new Uint8Array(length));
@@ -3614,7 +3620,8 @@ var init_env_files = __esm(() => {
3614
3620
  "BETTER_AUTH_SECRET",
3615
3621
  "INTERNAL_API_SECRET",
3616
3622
  "BETTER_AUTH_URL",
3617
- "NEXT_PUBLIC_APP_URL"
3623
+ "NEXT_PUBLIC_APP_URL",
3624
+ "REDIS_URL"
3618
3625
  ];
3619
3626
  SECRET_KEYS = [
3620
3627
  "BETTER_AUTH_SECRET",
@@ -5892,53 +5899,157 @@ var init_probes = __esm(() => {
5892
5899
  init_env_files();
5893
5900
  });
5894
5901
 
5902
+ // ../deployment-config/src/enterprise-features.ts
5903
+ function defineEnterpriseFeatures(features) {
5904
+ return features;
5905
+ }
5906
+ var ENTERPRISE_FEATURES, ENTERPRISE_MASTER_ENV_VAR = "ENTERPRISE_ENABLED", ENTERPRISE_FEATURE_KEYS;
5907
+ var init_enterprise_features = __esm(() => {
5908
+ ENTERPRISE_FEATURES = defineEnterpriseFeatures({
5909
+ accessControl: {
5910
+ envVar: "ACCESS_CONTROL_ENABLED",
5911
+ selfHostedDefault: false,
5912
+ implies: ["organizations"],
5913
+ label: "Access control",
5914
+ hint: "permission groups (implies organizations)",
5915
+ setupUnlock: true
5916
+ },
5917
+ organizations: {
5918
+ envVar: "ORGANIZATIONS_ENABLED",
5919
+ selfHostedDefault: false,
5920
+ onWithBilling: true,
5921
+ label: "Organizations",
5922
+ hint: "multi-workspace orgs",
5923
+ setupUnlock: true
5924
+ },
5925
+ auditLogs: {
5926
+ envVar: "AUDIT_LOGS_ENABLED",
5927
+ selfHostedDefault: false,
5928
+ label: "Audit logs",
5929
+ setupUnlock: true
5930
+ },
5931
+ customBlocks: {
5932
+ envVar: "CUSTOM_BLOCKS_ENABLED",
5933
+ selfHostedDefault: false,
5934
+ label: "Custom blocks",
5935
+ hint: "reusable org-wide blocks",
5936
+ setupUnlock: true
5937
+ },
5938
+ dataRetention: {
5939
+ envVar: "DATA_RETENTION_ENABLED",
5940
+ selfHostedDefault: false,
5941
+ label: "Data retention",
5942
+ hint: "deletes expired data",
5943
+ setupUnlock: true
5944
+ },
5945
+ sessionPolicies: {
5946
+ envVar: "SESSION_POLICIES_ENABLED",
5947
+ selfHostedDefault: true,
5948
+ label: "Session policies",
5949
+ hint: "session lifetime caps",
5950
+ setupUnlock: true
5951
+ },
5952
+ dataDrains: {
5953
+ envVar: "DATA_DRAINS_ENABLED",
5954
+ selfHostedDefault: false,
5955
+ label: "Data drains",
5956
+ hint: "export streams",
5957
+ setupUnlock: true
5958
+ },
5959
+ forking: {
5960
+ envVar: "FORKING_ENABLED",
5961
+ selfHostedDefault: false,
5962
+ label: "Workflow forking",
5963
+ setupUnlock: true
5964
+ },
5965
+ inbox: {
5966
+ envVar: "INBOX_ENABLED",
5967
+ selfHostedDefault: true,
5968
+ label: "Inbox",
5969
+ setupUnlock: true
5970
+ },
5971
+ usageMonitoring: {
5972
+ envVar: "USAGE_MONITORING_ENABLED",
5973
+ selfHostedDefault: false,
5974
+ label: "Usage monitoring",
5975
+ hint: "org-wide credit usage",
5976
+ setupUnlock: true
5977
+ },
5978
+ sso: {
5979
+ envVar: "SSO_ENABLED",
5980
+ selfHostedDefault: false,
5981
+ label: "Single sign-on",
5982
+ hint: "SAML and OIDC",
5983
+ setupUnlock: false
5984
+ },
5985
+ scim: {
5986
+ envVar: "SCIM_ENABLED",
5987
+ selfHostedDefault: false,
5988
+ hostedDefault: true,
5989
+ label: "Directory provisioning",
5990
+ hint: "SCIM; needs single sign-on",
5991
+ setupUnlock: false
5992
+ },
5993
+ sandboxes: {
5994
+ envVar: "SANDBOXES_ENABLED",
5995
+ selfHostedDefault: false,
5996
+ label: "Custom sandboxes",
5997
+ hint: "needs a remote sandbox provider",
5998
+ setupUnlock: false
5999
+ },
6000
+ credentialGroups: {
6001
+ envVar: "CREDENTIAL_GROUPS",
6002
+ selfHostedDefault: false,
6003
+ label: "Credential groups",
6004
+ hint: "managed connected accounts",
6005
+ setupUnlock: false
6006
+ }
6007
+ });
6008
+ ENTERPRISE_FEATURE_KEYS = Object.keys(ENTERPRISE_FEATURES);
6009
+ });
6010
+
5895
6011
  // src/twins.ts
5896
- var FLAG_TWINS, SELF_HOST_UNLOCKS, LOGIN_PROVIDERS;
6012
+ var FLAG_TWINS, FORMERLY_TWINNED_FEATURES, INERT_BROWSER_FLAGS, SELF_HOST_UNLOCKS, LOGIN_PROVIDERS;
5897
6013
  var init_twins = __esm(() => {
6014
+ init_enterprise_features();
5898
6015
  FLAG_TWINS = [
5899
6016
  { server: "BILLING_ENABLED", client: "NEXT_PUBLIC_BILLING_ENABLED" },
5900
- { server: "ENTERPRISE_ENABLED", client: "NEXT_PUBLIC_ENTERPRISE_ENABLED" },
5901
- { server: "ACCESS_CONTROL_ENABLED", client: "NEXT_PUBLIC_ACCESS_CONTROL_ENABLED" },
5902
- { server: "ORGANIZATIONS_ENABLED", client: "NEXT_PUBLIC_ORGANIZATIONS_ENABLED" },
5903
- { server: "AUDIT_LOGS_ENABLED", client: "NEXT_PUBLIC_AUDIT_LOGS_ENABLED" },
5904
- { server: "CUSTOM_BLOCKS_ENABLED", client: "NEXT_PUBLIC_CUSTOM_BLOCKS_ENABLED" },
5905
- { server: "DATA_RETENTION_ENABLED", client: "NEXT_PUBLIC_DATA_RETENTION_ENABLED" },
5906
- { server: "SESSION_POLICIES_ENABLED", client: "NEXT_PUBLIC_SESSION_POLICIES_ENABLED" },
5907
- { server: "DATA_DRAINS_ENABLED", client: "NEXT_PUBLIC_DATA_DRAINS_ENABLED" },
5908
- { server: "FORKING_ENABLED", client: "NEXT_PUBLIC_FORKING_ENABLED" },
5909
- { server: "INBOX_ENABLED", client: "NEXT_PUBLIC_INBOX_ENABLED" },
5910
6017
  { server: "DISABLE_INVITATIONS", client: "NEXT_PUBLIC_DISABLE_INVITATIONS" },
5911
6018
  { server: "DISABLE_PUBLIC_API", client: "NEXT_PUBLIC_DISABLE_PUBLIC_API" },
5912
- { server: "SSO_ENABLED", client: "NEXT_PUBLIC_SSO_ENABLED" },
5913
- { server: "USAGE_MONITORING_ENABLED", client: "NEXT_PUBLIC_USAGE_MONITORING_ENABLED" },
5914
- { server: "EMAIL_PASSWORD_SIGNUP_ENABLED", client: "NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED" },
5915
6019
  { server: "E2B_ENABLED", client: "NEXT_PUBLIC_E2B_ENABLED" },
5916
6020
  { server: "SLACK_EXTENDED_SCOPES", client: "NEXT_PUBLIC_SLACK_EXTENDED_SCOPES" }
5917
6021
  ];
6022
+ FORMERLY_TWINNED_FEATURES = [
6023
+ "sso",
6024
+ "scim",
6025
+ "accessControl",
6026
+ "auditLogs",
6027
+ "customBlocks",
6028
+ "usageMonitoring",
6029
+ "dataRetention",
6030
+ "dataDrains",
6031
+ "sessionPolicies",
6032
+ "forking",
6033
+ "organizations",
6034
+ "inbox"
6035
+ ];
6036
+ INERT_BROWSER_FLAGS = [
6037
+ ...[
6038
+ ENTERPRISE_MASTER_ENV_VAR,
6039
+ ...FORMERLY_TWINNED_FEATURES.map((key) => ENTERPRISE_FEATURES[key].envVar)
6040
+ ].map((server) => ({ server, client: `NEXT_PUBLIC_${server}` })),
6041
+ { client: "NEXT_PUBLIC_SANDBOXES_ENABLED" }
6042
+ ];
5918
6043
  SELF_HOST_UNLOCKS = [
5919
6044
  {
5920
- server: "ENTERPRISE_ENABLED",
6045
+ server: ENTERPRISE_MASTER_ENV_VAR,
5921
6046
  label: "All enterprise features",
5922
6047
  hint: "enables everything below"
5923
6048
  },
5924
- {
5925
- server: "ACCESS_CONTROL_ENABLED",
5926
- label: "Access control",
5927
- hint: "permission groups (implies organizations)"
5928
- },
5929
- { server: "ORGANIZATIONS_ENABLED", label: "Organizations", hint: "multi-workspace orgs" },
5930
- { server: "AUDIT_LOGS_ENABLED", label: "Audit logs", hint: "" },
5931
- { server: "CUSTOM_BLOCKS_ENABLED", label: "Custom blocks", hint: "reusable org-wide blocks" },
5932
- { server: "DATA_RETENTION_ENABLED", label: "Data retention", hint: "deletes expired data" },
5933
- { server: "SESSION_POLICIES_ENABLED", label: "Session policies", hint: "session lifetime caps" },
5934
- { server: "DATA_DRAINS_ENABLED", label: "Data drains", hint: "export streams" },
5935
- { server: "FORKING_ENABLED", label: "Workflow forking", hint: "" },
5936
- { server: "INBOX_ENABLED", label: "Inbox", hint: "" },
5937
- {
5938
- server: "USAGE_MONITORING_ENABLED",
5939
- label: "Usage monitoring",
5940
- hint: "org-wide credit usage"
5941
- }
6049
+ ...ENTERPRISE_FEATURE_KEYS.filter((key) => ENTERPRISE_FEATURES[key].setupUnlock).map((key) => {
6050
+ const feature = ENTERPRISE_FEATURES[key];
6051
+ return { server: feature.envVar, label: feature.label, hint: feature.hint ?? "" };
6052
+ })
5942
6053
  ];
5943
6054
  LOGIN_PROVIDERS = [
5944
6055
  { id: "google", label: "Google", idKey: "GOOGLE_CLIENT_ID", secretKey: "GOOGLE_CLIENT_SECRET" },
@@ -6101,6 +6212,17 @@ function checkSchema(ctx) {
6101
6212
  });
6102
6213
  }
6103
6214
  }
6215
+ if (key === "REDIS_URL") {
6216
+ const redisError = getRedisConfigurationError(file.vars);
6217
+ if (redisError) {
6218
+ findings.push({
6219
+ group: "schema",
6220
+ status: "fail",
6221
+ message: `${rel(file)}: ${redisError}`,
6222
+ fix: `correct the Redis settings in ${rel(file)}`
6223
+ });
6224
+ }
6225
+ }
6104
6226
  }
6105
6227
  if (missing.length === 0 && findings.every((f) => !f.message.startsWith(rel(file)))) {
6106
6228
  findings.push({
@@ -6175,10 +6297,6 @@ function checkCoherence(ctx) {
6175
6297
  command: getSetupCommand(ASYNC_JOBS_CAPABILITY.id),
6176
6298
  resolve: () => requireCapability(ASYNC_JOBS_CAPABILITY, sim.vars)
6177
6299
  },
6178
- {
6179
- command: getSetupCommand(CACHE_CAPABILITY.id),
6180
- resolve: () => requireCapability(CACHE_CAPABILITY, sim.vars)
6181
- },
6182
6300
  {
6183
6301
  command: getSetupCommand(SANDBOX_CAPABILITY.id),
6184
6302
  resolve: () => {
@@ -6250,26 +6368,17 @@ function checkCoherence(ctx) {
6250
6368
  autofix: () => writeEnvValues(sim.target, { [missingSide]: value })
6251
6369
  });
6252
6370
  }
6253
- const sandboxInspection = inspectCapability(SANDBOX_CAPABILITY, sim.vars);
6254
- const sandboxProvider = sandboxInspection.providerId;
6255
- const selectedSandboxProvider = sandboxInspection.providers.find((provider) => provider.id === sandboxProvider);
6256
- const remoteSandboxAvailable = !sandboxInspection.error && selectedSandboxProvider?.state === "ready";
6257
- const publicSandboxEnabled = isTruthy(sim.vars.get("NEXT_PUBLIC_SANDBOXES_ENABLED"));
6258
- if (remoteSandboxAvailable && !publicSandboxEnabled) {
6259
- findings.push({
6260
- group: "coherence",
6261
- status: "fail",
6262
- message: "remote sandboxes are configured but NEXT_PUBLIC_SANDBOXES_ENABLED is unset — the Function block will hide its language and sandbox controls",
6263
- fix: "doctor --fix sets NEXT_PUBLIC_SANDBOXES_ENABLED=true",
6264
- autofix: () => writeEnvValues(sim.target, { NEXT_PUBLIC_SANDBOXES_ENABLED: "true" })
6265
- });
6266
- } else if (!remoteSandboxAvailable && publicSandboxEnabled) {
6371
+ findings.push(...checkRegistrationMode(sim));
6372
+ for (const { server, client } of INERT_BROWSER_FLAGS) {
6373
+ const clientValue = sim.vars.get(client);
6374
+ if (clientValue === undefined)
6375
+ continue;
6376
+ const needsServer = server !== undefined && isTruthy(clientValue) && sim.vars.get(server) === undefined;
6267
6377
  findings.push({
6268
6378
  group: "coherence",
6269
- status: "fail",
6270
- message: "NEXT_PUBLIC_SANDBOXES_ENABLED is on but the selected provider lacks credentials or a valid immutable Function base — the UI exposes a runtime that will reject execution",
6271
- fix: "doctor --fix sets NEXT_PUBLIC_SANDBOXES_ENABLED=false; finish provider setup before enabling it",
6272
- autofix: () => writeEnvValues(sim.target, { NEXT_PUBLIC_SANDBOXES_ENABLED: "false" })
6379
+ status: "warn",
6380
+ message: `${client} is set but no longer does anything — the browser reads this from the server`,
6381
+ fix: needsServer ? `set ${server}=${clientValue} and remove ${client}` : `remove ${client}`
6273
6382
  });
6274
6383
  }
6275
6384
  const disableAuth = sim.vars.get("DISABLE_AUTH");
@@ -6374,6 +6483,36 @@ function checkCoherence(ctx) {
6374
6483
  }
6375
6484
  return findings;
6376
6485
  }
6486
+ function checkRegistrationMode(sim) {
6487
+ const { mode, warnings } = resolveRegistrationMode((name) => sim.vars.get(name));
6488
+ const findings = [];
6489
+ for (const warning of warnings) {
6490
+ if (warning.code === "invalid-mode") {
6491
+ findings.push({
6492
+ group: "coherence",
6493
+ status: "fail",
6494
+ message: `REGISTRATION_MODE="${warning.details.value}" is not a recognized value — the app closes self-serve registration until it is corrected`,
6495
+ fix: `set REGISTRATION_MODE to one of ${REGISTRATION_MODES.join(", ")}`
6496
+ });
6497
+ } else if (warning.code === "deprecated-variables") {
6498
+ const names = warning.details.variables.join(", ");
6499
+ findings.push({
6500
+ group: "coherence",
6501
+ status: "warn",
6502
+ message: `deprecated registration variables are set (${names}) — REGISTRATION_MODE replaces them`,
6503
+ fix: `set REGISTRATION_MODE=${mode} and remove ${names}`
6504
+ });
6505
+ } else {
6506
+ findings.push({
6507
+ group: "coherence",
6508
+ status: "warn",
6509
+ message: `REGISTRATION_MODE=${warning.details.configured} resolves to ${mode} because deprecated registration variables are more restrictive`,
6510
+ fix: `set REGISTRATION_MODE=${mode} and remove the deprecated variables, or remove them to keep ${warning.details.configured}`
6511
+ });
6512
+ }
6513
+ }
6514
+ return findings;
6515
+ }
6377
6516
  async function checkDatabase(sim) {
6378
6517
  const findings = [];
6379
6518
  const dsn = sim.vars.get("DATABASE_URL");
@@ -6443,19 +6582,30 @@ async function checkDatabase(sim) {
6443
6582
  return findings;
6444
6583
  }
6445
6584
  async function checkRedis(sim) {
6446
- const inspection = inspectCapability(CACHE_CAPABILITY, sim.vars);
6447
- if (inspection.error || inspection.providerId !== "redis")
6448
- return [];
6585
+ if (!sim.exists) {
6586
+ return [{ group: "live", status: "skip", message: "redis: no env file yet" }];
6587
+ }
6449
6588
  const redisUrl = sim.vars.get("REDIS_URL");
6450
- if (!redisUrl)
6451
- throw new Error("Redis resolved as ready without REDIS_URL");
6589
+ if (!redisUrl && sim.target === "root") {
6590
+ return [{ group: "live", status: "skip", message: "redis: REDIS_URL is set by Compose" }];
6591
+ }
6592
+ if (!redisUrl || getRedisConfigurationError(sim.vars)) {
6593
+ return [
6594
+ {
6595
+ group: "live",
6596
+ status: "fail",
6597
+ message: "redis: REDIS_URL is missing or invalid",
6598
+ fix: "set REDIS_URL to a reachable redis:// or rediss:// URL (npx sim-setup can manage a Redis container)"
6599
+ }
6600
+ ];
6601
+ }
6452
6602
  const ping = await redisPing(redisUrl);
6453
6603
  return [
6454
6604
  ping.ok ? { group: "live", status: "pass", message: "redis reachable" } : {
6455
6605
  group: "live",
6456
6606
  status: "fail",
6457
6607
  message: `redis unreachable: ${ping.error}`,
6458
- fix: "fix REDIS_URL or remove it (optional for single-replica)"
6608
+ fix: "start Redis (npx sim-setup can manage a Redis container) or fix REDIS_URL"
6459
6609
  }
6460
6610
  ];
6461
6611
  }
@@ -6525,6 +6675,7 @@ async function runChecks(ctx, groups) {
6525
6675
  var REQUIRED_APP_KEYS, REQUIRED_KEYS, MIN_32_KEYS, URL_KEYS;
6526
6676
  var init_checks = __esm(() => {
6527
6677
  init_env_capabilities();
6678
+ init_registration();
6528
6679
  init_capability_config();
6529
6680
  init_detect();
6530
6681
  init_env_files();
@@ -6538,7 +6689,8 @@ var init_checks = __esm(() => {
6538
6689
  "BETTER_AUTH_URL",
6539
6690
  "BETTER_AUTH_SECRET",
6540
6691
  "INTERNAL_API_SECRET",
6541
- "NEXT_PUBLIC_APP_URL"
6692
+ "NEXT_PUBLIC_APP_URL",
6693
+ "REDIS_URL"
6542
6694
  ],
6543
6695
  db: ["DATABASE_URL"],
6544
6696
  root: ["BETTER_AUTH_SECRET", "ENCRYPTION_KEY", "INTERNAL_API_SECRET"]
@@ -7803,7 +7955,8 @@ var init_configuration_sources = __esm(() => {
7803
7955
  "BETTER_AUTH_URL",
7804
7956
  "BETTER_AUTH_SECRET",
7805
7957
  "INTERNAL_API_SECRET",
7806
- "NEXT_PUBLIC_APP_URL"
7958
+ "NEXT_PUBLIC_APP_URL",
7959
+ "REDIS_URL"
7807
7960
  ],
7808
7961
  db: ["DATABASE_URL"]
7809
7962
  };
@@ -7830,6 +7983,11 @@ function inspectCoreConfiguration(values) {
7830
7983
  } catch {
7831
7984
  issues.push({ key, reason: "invalid URL" });
7832
7985
  }
7986
+ } else if (key === "REDIS_URL") {
7987
+ const redisError = getRedisConfigurationError(values);
7988
+ if (redisError) {
7989
+ issues.push({ key, reason: "invalid Redis configuration", detail: redisError });
7990
+ }
7833
7991
  }
7834
7992
  }
7835
7993
  return issues;
@@ -7853,8 +8011,6 @@ function featureDetail(feature) {
7853
8011
  return feature.providerId ? titleCase(feature.providerId) : "Not configured";
7854
8012
  case "jobs":
7855
8013
  return feature.providerId === "database" ? "Database queue (default)" : "Trigger.dev";
7856
- case "cache":
7857
- return feature.providerId === "database" ? "Postgres (default)" : "Redis";
7858
8014
  case "knowledge":
7859
8015
  if (feature.providerId === "local")
7860
8016
  return "Local parser (default)";
@@ -7980,7 +8136,7 @@ function renderSetupStatusReport(report) {
7980
8136
  lines.push(` ${glyph.pass} All ${REQUIRED_APP_KEYS.length} required app values are present`);
7981
8137
  } else {
7982
8138
  for (const coreIssue of report.coreIssues) {
7983
- lines.push(` ${glyph.fail} ${coreIssue.key}: ${coreIssue.reason}`);
8139
+ lines.push(` ${glyph.fail} ${coreIssue.key}: ${coreIssue.detail ?? coreIssue.reason}`);
7984
8140
  }
7985
8141
  for (const configurationIssue of source.configurationIssues ?? []) {
7986
8142
  lines.push(` ${glyph.fail} ${configurationIssue}`);
@@ -11277,24 +11433,26 @@ async function promptUnlocks(vars) {
11277
11433
  if (selected.length === 0)
11278
11434
  return {};
11279
11435
  const flags = new Set(selected);
11280
- if (flags.has("ENTERPRISE_ENABLED")) {
11436
+ if (flags.has(ENTERPRISE_MASTER_ENV_VAR)) {
11281
11437
  log2.info(theme.muted("The enterprise switch covers every feature below — pick individual ones only to override it."));
11282
11438
  }
11283
- if (flags.has("ACCESS_CONTROL_ENABLED") && !flags.has("ORGANIZATIONS_ENABLED")) {
11284
- flags.add("ORGANIZATIONS_ENABLED");
11285
- log2.info(theme.muted("Access control requires organizations — enabling both."));
11286
- }
11287
- const values = {};
11288
- for (const server of flags) {
11289
- values[server] = "true";
11290
- const twin = FLAG_TWINS.find((pair) => pair.server === server);
11291
- if (twin)
11292
- values[twin.client] = "true";
11439
+ for (const key of ENTERPRISE_FEATURE_KEYS) {
11440
+ const feature = ENTERPRISE_FEATURES[key];
11441
+ if (!flags.has(feature.envVar))
11442
+ continue;
11443
+ for (const implied of feature.implies ?? []) {
11444
+ const required = ENTERPRISE_FEATURES[implied];
11445
+ if (flags.has(required.envVar))
11446
+ continue;
11447
+ flags.add(required.envVar);
11448
+ log2.info(theme.muted(`${feature.label} requires ${required.label.toLowerCase()} — enabling both.`));
11449
+ }
11293
11450
  }
11294
- return values;
11451
+ return Object.fromEntries([...flags].map((server) => [server, "true"]));
11295
11452
  }
11296
11453
  var DEFAULT_CLI_AUTH_ORIGIN = "https://www.sim.ai", PROVIDER_CONSOLES;
11297
11454
  var init_steps = __esm(() => {
11455
+ init_enterprise_features();
11298
11456
  init_egress();
11299
11457
  init_errors();
11300
11458
  init_capability_config();
@@ -13442,6 +13600,11 @@ function managedRedisUrl() {
13442
13600
  `)[0]?.split(":").pop();
13443
13601
  return port ? `redis://${LOOPBACK_HOST}:${port}` : null;
13444
13602
  }
13603
+ async function keepConfiguredUrl(managedUrl, existing) {
13604
+ if (existing && existing !== managedUrl && (await redisPing(existing)).ok)
13605
+ return existing;
13606
+ return managedUrl;
13607
+ }
13445
13608
  async function pingWithSpinner(url, label) {
13446
13609
  const spin = spinner2();
13447
13610
  spin.start(label);
@@ -13485,7 +13648,7 @@ async function promptRedisUrl(existing) {
13485
13648
  });
13486
13649
  if (!await pingWithSpinner(url, "Pinging Redis…")) {
13487
13650
  throw new SetupError(`Redis at ${url} is not answering.`, [
13488
- "fix the URL and re-run, or skip Redis — single-instance runs fine without it"
13651
+ "fix the URL and re-run — Sim requires a reachable Redis"
13489
13652
  ]);
13490
13653
  }
13491
13654
  return url;
@@ -13503,20 +13666,24 @@ async function ensureRedis(detection, existing) {
13503
13666
  const managedUrl = managedRedisUrl();
13504
13667
  if (managedUrl && await waitFor(async () => (await redisPing(managedUrl)).ok, 15000, 500)) {
13505
13668
  log2.step(`Reusing ${REDIS_CONTAINER}`);
13506
- return managedUrl;
13669
+ return keepConfiguredUrl(managedUrl, existing);
13507
13670
  }
13508
13671
  }
13509
13672
  if (!await ensureDocker(false)) {
13510
- log2.warn("Docker is unavailable, so Redis was not configured — live Chat status and table events will not stream.");
13511
- return null;
13673
+ throw new SetupError("Sim requires Redis, and none is reachable.", [
13674
+ "start Docker so the wizard can run a Redis container, then re-run it",
13675
+ `or start Redis yourself and set REDIS_URL in apps/sim/.env (e.g. ${LOCAL_URL})`
13676
+ ]);
13512
13677
  }
13513
13678
  return startManagedRedis(detection);
13514
13679
  }
13515
13680
  async function resolveRedis(detection, existing) {
13681
+ let configured = existing;
13516
13682
  if (existing && existing !== LOCAL_URL && await pingWithSpinner(existing, `Pinging ${existing}…`)) {
13517
13683
  const keep = await confirm2({ message: `Keep using ${existing}?`, initialValue: true });
13518
13684
  if (keep)
13519
13685
  return existing;
13686
+ configured = undefined;
13520
13687
  }
13521
13688
  if (detection.redisPortOpen && await pingWithSpinner(LOCAL_URL, "Redis found on :6379 — pinging…")) {
13522
13689
  const adopt = await confirm2({
@@ -13531,9 +13698,9 @@ async function resolveRedis(detection, existing) {
13531
13698
  docker(["start", REDIS_CONTAINER]);
13532
13699
  const managedUrl = managedRedisUrl();
13533
13700
  if (managedUrl && await pingWithSpinner(managedUrl, `Starting existing ${REDIS_CONTAINER} container…`)) {
13534
- return managedUrl;
13701
+ return keepConfiguredUrl(managedUrl, configured);
13535
13702
  }
13536
- log2.warn(`${REDIS_CONTAINER} exists but is not answering — starting a fresh one will replace it (it holds no data).`);
13703
+ log2.warn(`${REDIS_CONTAINER} exists but is not answering — starting a fresh one will replace it and drop what it held: live OTPs, OAuth state, rate-limit buckets, and idempotency records (so a webhook redelivered afterwards can run again).`);
13537
13704
  }
13538
13705
  const dockerAvailable = await ensureDocker(false);
13539
13706
  const options = [];
@@ -13598,15 +13765,6 @@ ${error}`, [
13598
13765
  throw new Error(`aborted: db:migrate failed:
13599
13766
  ${error}`);
13600
13767
  }
13601
- async function promptRedis(detection, existing) {
13602
- const wants = await confirm2({
13603
- message: "Configure Redis? (powers live Chat status and table events; storage falls back to Postgres)",
13604
- initialValue: true
13605
- });
13606
- if (!wants)
13607
- return null;
13608
- return resolveRedis(detection, existing);
13609
- }
13610
13768
  async function runDevMode(detection, quick) {
13611
13769
  const exposed = exposedManagedContainers(detection);
13612
13770
  if (exposed.length > 0) {
@@ -13640,11 +13798,9 @@ async function runDevMode(detection, quick) {
13640
13798
  values.COPILOT_API_KEY = copilotKey;
13641
13799
  Object.assign(values, chatFlagValues(copilotKey));
13642
13800
  Object.assign(values, await promptLlmKeys(detection, !quick));
13643
- const redisUrl = quick ? await ensureRedis(detection, simAfter.vars.get("REDIS_URL")) : await promptRedis(detection, simAfter.vars.get("REDIS_URL"));
13644
- if (redisUrl) {
13645
- values.REDIS_URL = redisUrl;
13646
- writeEnvValues("realtime", { REDIS_URL: redisUrl });
13647
- }
13801
+ const redisUrl = quick ? await ensureRedis(detection, simAfter.vars.get("REDIS_URL")) : await resolveRedis(detection, simAfter.vars.get("REDIS_URL"));
13802
+ values.REDIS_URL = redisUrl;
13803
+ writeEnvValues("realtime", { REDIS_URL: redisUrl });
13648
13804
  const stagedVars = new Map(simAfter.vars);
13649
13805
  for (const [key, value] of Object.entries(values))
13650
13806
  stagedVars.set(key, value);
@@ -13814,7 +13970,7 @@ async function runWizard(flags) {
13814
13970
  {
13815
13971
  value: "custom",
13816
13972
  label: "Custom",
13817
- hint: "every option: redis, trigger.dev, image variants"
13973
+ hint: "every option: where Redis lives, trigger.dev, image variants"
13818
13974
  }
13819
13975
  ],
13820
13976
  initialValue: "quick"
@@ -14038,7 +14194,7 @@ function parseSetupArguments(rawArgs) {
14038
14194
  init_errors2();
14039
14195
  init_theme();
14040
14196
  init_version();
14041
- var SETUP_FEATURES2 = "email | storage | sandbox | jobs | cache | knowledge | knowledge-embeddings | chat | llm | integration <slug>";
14197
+ var SETUP_FEATURES2 = "email | storage | sandbox | jobs | knowledge | knowledge-embeddings | chat | llm | integration <slug>";
14042
14198
  var USAGE = `Usage:
14043
14199
  sim-setup [--quick] [--dir <path>] [--mode compose|dev|k8s]
14044
14200
  sim-setup config show configured capabilities and integrations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim-setup",
3
- "version": "1.0.71-preview.395.1",
3
+ "version": "1.0.71-preview.397.1",
4
4
  "description": "Set up and manage a self-hosted Sim installation",
5
5
  "type": "module",
6
6
  "bin": {