sim-setup 1.0.71-preview.396.1 → 1.0.71-preview.398.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;
@@ -1429,29 +1427,7 @@ var init_env_capabilities = __esm(() => {
1429
1427
  }
1430
1428
  ]
1431
1429
  });
1432
- CACHE_CAPABILITY = defineCapability({
1433
- strategy: "selected",
1434
- id: "cache",
1435
- label: "Cache",
1436
- whenUnset: "first-ready",
1437
- defaultProvider: { id: "database", kind: "built-in", label: "Postgres" },
1438
- providers: [
1439
- {
1440
- id: "redis",
1441
- label: "Redis",
1442
- activation: { mode: "any-present", keys: ["REDIS_URL"] },
1443
- requires: envField("REDIS_URL", {
1444
- validation: {
1445
- kind: "url",
1446
- protocols: ["redis:", "rediss:"],
1447
- message: "must be a valid redis:// or rediss:// URL"
1448
- }
1449
- }),
1450
- optionalFields: [envField("REDIS_TLS_SERVERNAME")],
1451
- validate: validateRedisProvider
1452
- }
1453
- ]
1454
- });
1430
+ REDIS_URL_PROTOCOLS = ["redis:", "rediss:"];
1455
1431
  OCR_CAPABILITY = defineCapability({
1456
1432
  strategy: "selected",
1457
1433
  id: "knowledge",
@@ -1627,7 +1603,6 @@ var init_env_capabilities = __esm(() => {
1627
1603
  STORAGE_CAPABILITY,
1628
1604
  SANDBOX_CAPABILITY,
1629
1605
  ASYNC_JOBS_CAPABILITY,
1630
- CACHE_CAPABILITY,
1631
1606
  OCR_CAPABILITY,
1632
1607
  KNOWLEDGE_EMBEDDINGS_CAPABILITY
1633
1608
  ];
@@ -1660,6 +1635,7 @@ var init_env_capabilities = __esm(() => {
1660
1635
  ...new Set([
1661
1636
  ...CORE_CONFIGURATION_KEYS,
1662
1637
  ...ENV_CAPABILITIES.flatMap(capabilityKeys),
1638
+ "REDIS_TLS_SERVERNAME",
1663
1639
  "COPILOT_API_KEY",
1664
1640
  "EMAIL_VERIFICATION_ENABLED",
1665
1641
  "NEXT_PUBLIC_CHAT_DISABLED",
@@ -2032,7 +2008,7 @@ function promptKeys(prompts = []) {
2032
2008
  function conditionKeys(condition) {
2033
2009
  if (!condition)
2034
2010
  return [];
2035
- if (condition.kind === "present" || condition.kind === "truthy" || condition.kind === "equals" || condition.kind === "provider-missing-field") {
2011
+ if (condition.kind === "present" || condition.kind === "truthy" || condition.kind === "equals") {
2036
2012
  return [condition.key];
2037
2013
  }
2038
2014
  if (condition.kind === "all" || condition.kind === "any") {
@@ -2149,7 +2125,7 @@ function matchesSetupCondition(condition, values) {
2149
2125
  }
2150
2126
  return !matchesSetupCondition(condition.condition, values);
2151
2127
  }
2152
- 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;
2153
2129
  var init_capability_config = __esm(() => {
2154
2130
  init_env_capabilities();
2155
2131
  EMAIL_SETUP = defineCapabilitySetup(EMAIL_CAPABILITY, {
@@ -2543,35 +2519,6 @@ var init_capability_config = __esm(() => {
2543
2519
  },
2544
2520
  optionOrder: ["database", "trigger-dev"]
2545
2521
  });
2546
- CACHE_SETUP = defineCapabilitySetup(CACHE_CAPABILITY, {
2547
- label: "Redis cache",
2548
- message: "Cache and realtime coordination?",
2549
- actions: {},
2550
- defaultOption: { hint: "built-in default" },
2551
- providers: {
2552
- redis: {
2553
- hint: "recommended for multiple replicas",
2554
- prompts: [
2555
- {
2556
- type: "field",
2557
- key: "REDIS_URL",
2558
- input: "text",
2559
- required: true,
2560
- defaultValue: "redis://localhost:6379",
2561
- validate: true
2562
- },
2563
- {
2564
- type: "field",
2565
- key: "REDIS_TLS_SERVERNAME",
2566
- input: "text",
2567
- required: true,
2568
- when: { kind: "provider-missing-field", key: "REDIS_TLS_SERVERNAME" }
2569
- }
2570
- ]
2571
- }
2572
- },
2573
- optionOrder: ["database", "redis"]
2574
- });
2575
2522
  KNOWLEDGE_SETUP = defineCapabilitySetup(OCR_CAPABILITY, {
2576
2523
  label: "Knowledge and OCR",
2577
2524
  message: "PDF OCR provider?",
@@ -2833,7 +2780,6 @@ var init_capability_config = __esm(() => {
2833
2780
  STORAGE_SETUP,
2834
2781
  SANDBOX_SETUP,
2835
2782
  JOBS_SETUP,
2836
- CACHE_SETUP,
2837
2783
  KNOWLEDGE_SETUP,
2838
2784
  KNOWLEDGE_EMBEDDINGS_SETUP
2839
2785
  ];
@@ -3138,27 +3084,6 @@ function inspectJobs(values) {
3138
3084
  issue: issue(state, inspection.error)
3139
3085
  };
3140
3086
  }
3141
- function inspectCache(values) {
3142
- const inspection = inspectCapability(CACHE_CAPABILITY, values);
3143
- if (!inspection.error && inspection.providerId) {
3144
- return {
3145
- ...featureMetadata("cache"),
3146
- state: inspection.providerId === "database" ? "default" : "configured",
3147
- providerId: inspection.providerId
3148
- };
3149
- }
3150
- if (!inspection.error) {
3151
- throw new Error("Cache inspection failed without a configuration error");
3152
- }
3153
- const redis = inspection.providers.find((provider) => provider.id === "redis");
3154
- const state = redis?.state === "invalid" ? "invalid" : "partial";
3155
- return {
3156
- ...featureMetadata("cache"),
3157
- state,
3158
- providerId: "redis",
3159
- issue: issue(state, inspection.error)
3160
- };
3161
- }
3162
3087
  function inspectKnowledge(values) {
3163
3088
  const inspection = inspectCapability(OCR_CAPABILITY, values);
3164
3089
  if (!inspection.error && inspection.providerId) {
@@ -3266,7 +3191,6 @@ function buildEnvCapabilityStatus(values) {
3266
3191
  storage: FEATURE_STATUS_BUILDERS.storage(values),
3267
3192
  sandbox: FEATURE_STATUS_BUILDERS.sandbox(values),
3268
3193
  jobs: FEATURE_STATUS_BUILDERS.jobs(values),
3269
- cache: FEATURE_STATUS_BUILDERS.cache(values),
3270
3194
  knowledge: FEATURE_STATUS_BUILDERS.knowledge(values),
3271
3195
  "knowledge-embeddings": FEATURE_STATUS_BUILDERS["knowledge-embeddings"](values),
3272
3196
  llm: FEATURE_STATUS_BUILDERS.llm(values)
@@ -3283,7 +3207,6 @@ var init_capability_status = __esm(() => {
3283
3207
  storage: inspectStorage,
3284
3208
  sandbox: inspectSandbox,
3285
3209
  jobs: inspectJobs,
3286
- cache: inspectCache,
3287
3210
  knowledge: inspectKnowledge,
3288
3211
  "knowledge-embeddings": inspectKnowledgeEmbeddings,
3289
3212
  llm: inspectLlm
@@ -3329,7 +3252,6 @@ function resolveRegistrationMode(read) {
3329
3252
  configured = "closed";
3330
3253
  warnings.push({
3331
3254
  code: "invalid-mode",
3332
- severity: "error",
3333
3255
  message: "REGISTRATION_MODE is not a recognized value, so self-serve registration is closed until it is corrected. Existing accounts can still sign in.",
3334
3256
  details: { value: rawMode, allowed: REGISTRATION_MODES }
3335
3257
  });
@@ -3344,7 +3266,6 @@ function resolveRegistrationMode(read) {
3344
3266
  if (setLegacy.length > 0) {
3345
3267
  warnings.push({
3346
3268
  code: "deprecated-variables",
3347
- severity: "warn",
3348
3269
  message: "Deprecated registration variables are set. Replace them with REGISTRATION_MODE; they still apply until removed.",
3349
3270
  details: { variables: setLegacy, equivalentMode: legacyMode }
3350
3271
  });
@@ -3355,7 +3276,6 @@ function resolveRegistrationMode(read) {
3355
3276
  if (resolved !== configured) {
3356
3277
  warnings.push({
3357
3278
  code: "conflict",
3358
- severity: "warn",
3359
3279
  message: "Deprecated registration variables are more restrictive than REGISTRATION_MODE, so the most restrictive combination applies.",
3360
3280
  details: { configured, legacy: legacyMode, resolved }
3361
3281
  });
@@ -3697,7 +3617,8 @@ var init_env_files = __esm(() => {
3697
3617
  "BETTER_AUTH_SECRET",
3698
3618
  "INTERNAL_API_SECRET",
3699
3619
  "BETTER_AUTH_URL",
3700
- "NEXT_PUBLIC_APP_URL"
3620
+ "NEXT_PUBLIC_APP_URL",
3621
+ "REDIS_URL"
3701
3622
  ];
3702
3623
  SECRET_KEYS = [
3703
3624
  "BETTER_AUTH_SECRET",
@@ -6124,7 +6045,7 @@ var init_twins = __esm(() => {
6124
6045
  },
6125
6046
  ...ENTERPRISE_FEATURE_KEYS.filter((key) => ENTERPRISE_FEATURES[key].setupUnlock).map((key) => {
6126
6047
  const feature = ENTERPRISE_FEATURES[key];
6127
- return { server: feature.envVar, label: feature.label, hint: feature.hint ?? "" };
6048
+ return { server: feature.envVar, label: feature.label, hint: feature.hint };
6128
6049
  })
6129
6050
  ];
6130
6051
  LOGIN_PROVIDERS = [
@@ -6288,6 +6209,17 @@ function checkSchema(ctx) {
6288
6209
  });
6289
6210
  }
6290
6211
  }
6212
+ if (key === "REDIS_URL") {
6213
+ const redisError = getRedisConfigurationError(file.vars);
6214
+ if (redisError) {
6215
+ findings.push({
6216
+ group: "schema",
6217
+ status: "fail",
6218
+ message: `${rel(file)}: ${redisError}`,
6219
+ fix: `correct the Redis settings in ${rel(file)}`
6220
+ });
6221
+ }
6222
+ }
6291
6223
  }
6292
6224
  if (missing.length === 0 && findings.every((f) => !f.message.startsWith(rel(file)))) {
6293
6225
  findings.push({
@@ -6362,10 +6294,6 @@ function checkCoherence(ctx) {
6362
6294
  command: getSetupCommand(ASYNC_JOBS_CAPABILITY.id),
6363
6295
  resolve: () => requireCapability(ASYNC_JOBS_CAPABILITY, sim.vars)
6364
6296
  },
6365
- {
6366
- command: getSetupCommand(CACHE_CAPABILITY.id),
6367
- resolve: () => requireCapability(CACHE_CAPABILITY, sim.vars)
6368
- },
6369
6297
  {
6370
6298
  command: getSetupCommand(SANDBOX_CAPABILITY.id),
6371
6299
  resolve: () => {
@@ -6651,19 +6579,30 @@ async function checkDatabase(sim) {
6651
6579
  return findings;
6652
6580
  }
6653
6581
  async function checkRedis(sim) {
6654
- const inspection = inspectCapability(CACHE_CAPABILITY, sim.vars);
6655
- if (inspection.error || inspection.providerId !== "redis")
6656
- return [];
6582
+ if (!sim.exists) {
6583
+ return [{ group: "live", status: "skip", message: "redis: no env file yet" }];
6584
+ }
6657
6585
  const redisUrl = sim.vars.get("REDIS_URL");
6658
- if (!redisUrl)
6659
- throw new Error("Redis resolved as ready without REDIS_URL");
6586
+ if (!redisUrl && sim.target === "root") {
6587
+ return [{ group: "live", status: "skip", message: "redis: REDIS_URL is set by Compose" }];
6588
+ }
6589
+ if (!redisUrl || getRedisConfigurationError(sim.vars)) {
6590
+ return [
6591
+ {
6592
+ group: "live",
6593
+ status: "fail",
6594
+ message: "redis: REDIS_URL is missing or invalid",
6595
+ fix: "set REDIS_URL to a reachable redis:// or rediss:// URL (npx sim-setup can manage a Redis container)"
6596
+ }
6597
+ ];
6598
+ }
6660
6599
  const ping = await redisPing(redisUrl);
6661
6600
  return [
6662
6601
  ping.ok ? { group: "live", status: "pass", message: "redis reachable" } : {
6663
6602
  group: "live",
6664
6603
  status: "fail",
6665
6604
  message: `redis unreachable: ${ping.error}`,
6666
- fix: "fix REDIS_URL or remove it (optional for single-replica)"
6605
+ fix: "start Redis (npx sim-setup can manage a Redis container) or fix REDIS_URL"
6667
6606
  }
6668
6607
  ];
6669
6608
  }
@@ -6747,7 +6686,8 @@ var init_checks = __esm(() => {
6747
6686
  "BETTER_AUTH_URL",
6748
6687
  "BETTER_AUTH_SECRET",
6749
6688
  "INTERNAL_API_SECRET",
6750
- "NEXT_PUBLIC_APP_URL"
6689
+ "NEXT_PUBLIC_APP_URL",
6690
+ "REDIS_URL"
6751
6691
  ],
6752
6692
  db: ["DATABASE_URL"],
6753
6693
  root: ["BETTER_AUTH_SECRET", "ENCRYPTION_KEY", "INTERNAL_API_SECRET"]
@@ -8012,7 +7952,8 @@ var init_configuration_sources = __esm(() => {
8012
7952
  "BETTER_AUTH_URL",
8013
7953
  "BETTER_AUTH_SECRET",
8014
7954
  "INTERNAL_API_SECRET",
8015
- "NEXT_PUBLIC_APP_URL"
7955
+ "NEXT_PUBLIC_APP_URL",
7956
+ "REDIS_URL"
8016
7957
  ],
8017
7958
  db: ["DATABASE_URL"]
8018
7959
  };
@@ -8039,6 +7980,11 @@ function inspectCoreConfiguration(values) {
8039
7980
  } catch {
8040
7981
  issues.push({ key, reason: "invalid URL" });
8041
7982
  }
7983
+ } else if (key === "REDIS_URL") {
7984
+ const redisError = getRedisConfigurationError(values);
7985
+ if (redisError) {
7986
+ issues.push({ key, reason: "invalid Redis configuration", detail: redisError });
7987
+ }
8042
7988
  }
8043
7989
  }
8044
7990
  return issues;
@@ -8062,8 +8008,6 @@ function featureDetail(feature) {
8062
8008
  return feature.providerId ? titleCase(feature.providerId) : "Not configured";
8063
8009
  case "jobs":
8064
8010
  return feature.providerId === "database" ? "Database queue (default)" : "Trigger.dev";
8065
- case "cache":
8066
- return feature.providerId === "database" ? "Postgres (default)" : "Redis";
8067
8011
  case "knowledge":
8068
8012
  if (feature.providerId === "local")
8069
8013
  return "Local parser (default)";
@@ -8189,7 +8133,7 @@ function renderSetupStatusReport(report) {
8189
8133
  lines.push(` ${glyph.pass} All ${REQUIRED_APP_KEYS.length} required app values are present`);
8190
8134
  } else {
8191
8135
  for (const coreIssue of report.coreIssues) {
8192
- lines.push(` ${glyph.fail} ${coreIssue.key}: ${coreIssue.reason}`);
8136
+ lines.push(` ${glyph.fail} ${coreIssue.key}: ${coreIssue.detail ?? coreIssue.reason}`);
8193
8137
  }
8194
8138
  for (const configurationIssue of source.configurationIssues ?? []) {
8195
8139
  lines.push(` ${glyph.fail} ${configurationIssue}`);
@@ -9913,14 +9857,6 @@ function proposedCapabilitySetupValues(setup, option, values, currentValues) {
9913
9857
  Object.assign(proposed, values);
9914
9858
  return proposed;
9915
9859
  }
9916
- function getCapabilitySetupProviderMissingFields(setup, optionId, promptedValues, currentValues) {
9917
- const option = getCapabilitySetupOptions(setup).find((candidate) => candidate.id === optionId);
9918
- if (!option?.providerId)
9919
- return [];
9920
- const values = getCapabilitySetupDraftValues(setup, optionId, promptedValues);
9921
- const inspection = inspectCapability(setup.definition, proposedCapabilitySetupValues(setup, option, values, currentValues));
9922
- return inspection.providers.find((provider) => provider.id === option.providerId)?.missingFields ?? [];
9923
- }
9924
9860
  function buildCapabilitySetupTransition(setup, optionId, promptedValues, currentValues) {
9925
9861
  const definition = setup.definition;
9926
9862
  const option = getCapabilitySetupOptions(setup).find((candidate) => candidate.id === optionId);
@@ -9964,9 +9900,6 @@ function proposedPromptValues(state) {
9964
9900
  function shouldRenderPrompt(prompt, state) {
9965
9901
  if (!prompt.when)
9966
9902
  return true;
9967
- if (prompt.when.kind === "provider-missing-field") {
9968
- return getCapabilitySetupProviderMissingFields(state.setup, state.optionId, state.values, state.currentValues).includes(prompt.when.key);
9969
- }
9970
9903
  return matchesSetupCondition(prompt.when, proposedPromptValues(state));
9971
9904
  }
9972
9905
  function formatCapabilitySetupFieldMessage(prompt, current, keepExisting = false) {
@@ -11479,7 +11412,7 @@ async function promptUnlocks(vars) {
11479
11412
  options: SELF_HOST_UNLOCKS.map((unlock) => ({
11480
11413
  value: unlock.server,
11481
11414
  label: unlock.label,
11482
- hint: unlock.hint || undefined
11415
+ hint: unlock.hint
11483
11416
  })),
11484
11417
  initialValues: SELF_HOST_UNLOCKS.filter((u) => isTruthy(vars.get(u.server))).map((u) => u.server)
11485
11418
  });
@@ -13653,6 +13586,11 @@ function managedRedisUrl() {
13653
13586
  `)[0]?.split(":").pop();
13654
13587
  return port ? `redis://${LOOPBACK_HOST}:${port}` : null;
13655
13588
  }
13589
+ async function keepConfiguredUrl(managedUrl, existing) {
13590
+ if (existing && existing !== managedUrl && (await redisPing(existing)).ok)
13591
+ return existing;
13592
+ return managedUrl;
13593
+ }
13656
13594
  async function pingWithSpinner(url, label) {
13657
13595
  const spin = spinner2();
13658
13596
  spin.start(label);
@@ -13696,7 +13634,7 @@ async function promptRedisUrl(existing) {
13696
13634
  });
13697
13635
  if (!await pingWithSpinner(url, "Pinging Redis…")) {
13698
13636
  throw new SetupError(`Redis at ${url} is not answering.`, [
13699
- "fix the URL and re-run, or skip Redis — single-instance runs fine without it"
13637
+ "fix the URL and re-run — Sim requires a reachable Redis"
13700
13638
  ]);
13701
13639
  }
13702
13640
  return url;
@@ -13714,20 +13652,24 @@ async function ensureRedis(detection, existing) {
13714
13652
  const managedUrl = managedRedisUrl();
13715
13653
  if (managedUrl && await waitFor(async () => (await redisPing(managedUrl)).ok, 15000, 500)) {
13716
13654
  log2.step(`Reusing ${REDIS_CONTAINER}`);
13717
- return managedUrl;
13655
+ return keepConfiguredUrl(managedUrl, existing);
13718
13656
  }
13719
13657
  }
13720
13658
  if (!await ensureDocker(false)) {
13721
- log2.warn("Docker is unavailable, so Redis was not configured — live Chat status and table events will not stream.");
13722
- return null;
13659
+ throw new SetupError("Sim requires Redis, and none is reachable.", [
13660
+ "start Docker so the wizard can run a Redis container, then re-run it",
13661
+ `or start Redis yourself and set REDIS_URL in apps/sim/.env (e.g. ${LOCAL_URL})`
13662
+ ]);
13723
13663
  }
13724
13664
  return startManagedRedis(detection);
13725
13665
  }
13726
13666
  async function resolveRedis(detection, existing) {
13667
+ let configured = existing;
13727
13668
  if (existing && existing !== LOCAL_URL && await pingWithSpinner(existing, `Pinging ${existing}…`)) {
13728
13669
  const keep = await confirm2({ message: `Keep using ${existing}?`, initialValue: true });
13729
13670
  if (keep)
13730
13671
  return existing;
13672
+ configured = undefined;
13731
13673
  }
13732
13674
  if (detection.redisPortOpen && await pingWithSpinner(LOCAL_URL, "Redis found on :6379 — pinging…")) {
13733
13675
  const adopt = await confirm2({
@@ -13742,9 +13684,9 @@ async function resolveRedis(detection, existing) {
13742
13684
  docker(["start", REDIS_CONTAINER]);
13743
13685
  const managedUrl = managedRedisUrl();
13744
13686
  if (managedUrl && await pingWithSpinner(managedUrl, `Starting existing ${REDIS_CONTAINER} container…`)) {
13745
- return managedUrl;
13687
+ return keepConfiguredUrl(managedUrl, configured);
13746
13688
  }
13747
- log2.warn(`${REDIS_CONTAINER} exists but is not answering — starting a fresh one will replace it (it holds no data).`);
13689
+ 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).`);
13748
13690
  }
13749
13691
  const dockerAvailable = await ensureDocker(false);
13750
13692
  const options = [];
@@ -13809,15 +13751,6 @@ ${error}`, [
13809
13751
  throw new Error(`aborted: db:migrate failed:
13810
13752
  ${error}`);
13811
13753
  }
13812
- async function promptRedis(detection, existing) {
13813
- const wants = await confirm2({
13814
- message: "Configure Redis? (powers live Chat status and table events; storage falls back to Postgres)",
13815
- initialValue: true
13816
- });
13817
- if (!wants)
13818
- return null;
13819
- return resolveRedis(detection, existing);
13820
- }
13821
13754
  async function runDevMode(detection, quick) {
13822
13755
  const exposed = exposedManagedContainers(detection);
13823
13756
  if (exposed.length > 0) {
@@ -13851,11 +13784,9 @@ async function runDevMode(detection, quick) {
13851
13784
  values.COPILOT_API_KEY = copilotKey;
13852
13785
  Object.assign(values, chatFlagValues(copilotKey));
13853
13786
  Object.assign(values, await promptLlmKeys(detection, !quick));
13854
- const redisUrl = quick ? await ensureRedis(detection, simAfter.vars.get("REDIS_URL")) : await promptRedis(detection, simAfter.vars.get("REDIS_URL"));
13855
- if (redisUrl) {
13856
- values.REDIS_URL = redisUrl;
13857
- writeEnvValues("realtime", { REDIS_URL: redisUrl });
13858
- }
13787
+ const redisUrl = quick ? await ensureRedis(detection, simAfter.vars.get("REDIS_URL")) : await resolveRedis(detection, simAfter.vars.get("REDIS_URL"));
13788
+ values.REDIS_URL = redisUrl;
13789
+ writeEnvValues("realtime", { REDIS_URL: redisUrl });
13859
13790
  const stagedVars = new Map(simAfter.vars);
13860
13791
  for (const [key, value] of Object.entries(values))
13861
13792
  stagedVars.set(key, value);
@@ -14025,7 +13956,7 @@ async function runWizard(flags) {
14025
13956
  {
14026
13957
  value: "custom",
14027
13958
  label: "Custom",
14028
- hint: "every option: redis, trigger.dev, image variants"
13959
+ hint: "every option: where Redis lives, trigger.dev, image variants"
14029
13960
  }
14030
13961
  ],
14031
13962
  initialValue: "quick"
@@ -14249,7 +14180,7 @@ function parseSetupArguments(rawArgs) {
14249
14180
  init_errors2();
14250
14181
  init_theme();
14251
14182
  init_version();
14252
- var SETUP_FEATURES2 = "email | storage | sandbox | jobs | cache | knowledge | knowledge-embeddings | chat | llm | integration <slug>";
14183
+ var SETUP_FEATURES2 = "email | storage | sandbox | jobs | knowledge | knowledge-embeddings | chat | llm | integration <slug>";
14253
14184
  var USAGE = `Usage:
14254
14185
  sim-setup [--quick] [--dir <path>] [--mode compose|dev|k8s]
14255
14186
  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.396.1",
3
+ "version": "1.0.71-preview.398.1",
4
4
  "description": "Set up and manage a self-hosted Sim installation",
5
5
  "type": "module",
6
6
  "bin": {