sim-setup 1.0.71-preview.396.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 +0 -1
- package/dist/docker-compose.prod.yml +4 -3
- package/dist/index.js +74 -129
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,9 +120,10 @@ services:
|
|
|
120
120
|
command: ['bun', 'run', 'db:migrate']
|
|
121
121
|
restart: 'no'
|
|
122
122
|
|
|
123
|
-
#
|
|
124
|
-
#
|
|
125
|
-
#
|
|
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
|
|
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,
|
|
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
|
-
|
|
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",
|
|
@@ -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,
|
|
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
|
|
@@ -3697,7 +3620,8 @@ var init_env_files = __esm(() => {
|
|
|
3697
3620
|
"BETTER_AUTH_SECRET",
|
|
3698
3621
|
"INTERNAL_API_SECRET",
|
|
3699
3622
|
"BETTER_AUTH_URL",
|
|
3700
|
-
"NEXT_PUBLIC_APP_URL"
|
|
3623
|
+
"NEXT_PUBLIC_APP_URL",
|
|
3624
|
+
"REDIS_URL"
|
|
3701
3625
|
];
|
|
3702
3626
|
SECRET_KEYS = [
|
|
3703
3627
|
"BETTER_AUTH_SECRET",
|
|
@@ -6288,6 +6212,17 @@ function checkSchema(ctx) {
|
|
|
6288
6212
|
});
|
|
6289
6213
|
}
|
|
6290
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
|
+
}
|
|
6291
6226
|
}
|
|
6292
6227
|
if (missing.length === 0 && findings.every((f) => !f.message.startsWith(rel(file)))) {
|
|
6293
6228
|
findings.push({
|
|
@@ -6362,10 +6297,6 @@ function checkCoherence(ctx) {
|
|
|
6362
6297
|
command: getSetupCommand(ASYNC_JOBS_CAPABILITY.id),
|
|
6363
6298
|
resolve: () => requireCapability(ASYNC_JOBS_CAPABILITY, sim.vars)
|
|
6364
6299
|
},
|
|
6365
|
-
{
|
|
6366
|
-
command: getSetupCommand(CACHE_CAPABILITY.id),
|
|
6367
|
-
resolve: () => requireCapability(CACHE_CAPABILITY, sim.vars)
|
|
6368
|
-
},
|
|
6369
6300
|
{
|
|
6370
6301
|
command: getSetupCommand(SANDBOX_CAPABILITY.id),
|
|
6371
6302
|
resolve: () => {
|
|
@@ -6651,19 +6582,30 @@ async function checkDatabase(sim) {
|
|
|
6651
6582
|
return findings;
|
|
6652
6583
|
}
|
|
6653
6584
|
async function checkRedis(sim) {
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6585
|
+
if (!sim.exists) {
|
|
6586
|
+
return [{ group: "live", status: "skip", message: "redis: no env file yet" }];
|
|
6587
|
+
}
|
|
6657
6588
|
const redisUrl = sim.vars.get("REDIS_URL");
|
|
6658
|
-
if (!redisUrl)
|
|
6659
|
-
|
|
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
|
+
}
|
|
6660
6602
|
const ping = await redisPing(redisUrl);
|
|
6661
6603
|
return [
|
|
6662
6604
|
ping.ok ? { group: "live", status: "pass", message: "redis reachable" } : {
|
|
6663
6605
|
group: "live",
|
|
6664
6606
|
status: "fail",
|
|
6665
6607
|
message: `redis unreachable: ${ping.error}`,
|
|
6666
|
-
fix: "
|
|
6608
|
+
fix: "start Redis (npx sim-setup can manage a Redis container) or fix REDIS_URL"
|
|
6667
6609
|
}
|
|
6668
6610
|
];
|
|
6669
6611
|
}
|
|
@@ -6747,7 +6689,8 @@ var init_checks = __esm(() => {
|
|
|
6747
6689
|
"BETTER_AUTH_URL",
|
|
6748
6690
|
"BETTER_AUTH_SECRET",
|
|
6749
6691
|
"INTERNAL_API_SECRET",
|
|
6750
|
-
"NEXT_PUBLIC_APP_URL"
|
|
6692
|
+
"NEXT_PUBLIC_APP_URL",
|
|
6693
|
+
"REDIS_URL"
|
|
6751
6694
|
],
|
|
6752
6695
|
db: ["DATABASE_URL"],
|
|
6753
6696
|
root: ["BETTER_AUTH_SECRET", "ENCRYPTION_KEY", "INTERNAL_API_SECRET"]
|
|
@@ -8012,7 +7955,8 @@ var init_configuration_sources = __esm(() => {
|
|
|
8012
7955
|
"BETTER_AUTH_URL",
|
|
8013
7956
|
"BETTER_AUTH_SECRET",
|
|
8014
7957
|
"INTERNAL_API_SECRET",
|
|
8015
|
-
"NEXT_PUBLIC_APP_URL"
|
|
7958
|
+
"NEXT_PUBLIC_APP_URL",
|
|
7959
|
+
"REDIS_URL"
|
|
8016
7960
|
],
|
|
8017
7961
|
db: ["DATABASE_URL"]
|
|
8018
7962
|
};
|
|
@@ -8039,6 +7983,11 @@ function inspectCoreConfiguration(values) {
|
|
|
8039
7983
|
} catch {
|
|
8040
7984
|
issues.push({ key, reason: "invalid URL" });
|
|
8041
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
|
+
}
|
|
8042
7991
|
}
|
|
8043
7992
|
}
|
|
8044
7993
|
return issues;
|
|
@@ -8062,8 +8011,6 @@ function featureDetail(feature) {
|
|
|
8062
8011
|
return feature.providerId ? titleCase(feature.providerId) : "Not configured";
|
|
8063
8012
|
case "jobs":
|
|
8064
8013
|
return feature.providerId === "database" ? "Database queue (default)" : "Trigger.dev";
|
|
8065
|
-
case "cache":
|
|
8066
|
-
return feature.providerId === "database" ? "Postgres (default)" : "Redis";
|
|
8067
8014
|
case "knowledge":
|
|
8068
8015
|
if (feature.providerId === "local")
|
|
8069
8016
|
return "Local parser (default)";
|
|
@@ -8189,7 +8136,7 @@ function renderSetupStatusReport(report) {
|
|
|
8189
8136
|
lines.push(` ${glyph.pass} All ${REQUIRED_APP_KEYS.length} required app values are present`);
|
|
8190
8137
|
} else {
|
|
8191
8138
|
for (const coreIssue of report.coreIssues) {
|
|
8192
|
-
lines.push(` ${glyph.fail} ${coreIssue.key}: ${coreIssue.reason}`);
|
|
8139
|
+
lines.push(` ${glyph.fail} ${coreIssue.key}: ${coreIssue.detail ?? coreIssue.reason}`);
|
|
8193
8140
|
}
|
|
8194
8141
|
for (const configurationIssue of source.configurationIssues ?? []) {
|
|
8195
8142
|
lines.push(` ${glyph.fail} ${configurationIssue}`);
|
|
@@ -13653,6 +13600,11 @@ function managedRedisUrl() {
|
|
|
13653
13600
|
`)[0]?.split(":").pop();
|
|
13654
13601
|
return port ? `redis://${LOOPBACK_HOST}:${port}` : null;
|
|
13655
13602
|
}
|
|
13603
|
+
async function keepConfiguredUrl(managedUrl, existing) {
|
|
13604
|
+
if (existing && existing !== managedUrl && (await redisPing(existing)).ok)
|
|
13605
|
+
return existing;
|
|
13606
|
+
return managedUrl;
|
|
13607
|
+
}
|
|
13656
13608
|
async function pingWithSpinner(url, label) {
|
|
13657
13609
|
const spin = spinner2();
|
|
13658
13610
|
spin.start(label);
|
|
@@ -13696,7 +13648,7 @@ async function promptRedisUrl(existing) {
|
|
|
13696
13648
|
});
|
|
13697
13649
|
if (!await pingWithSpinner(url, "Pinging Redis…")) {
|
|
13698
13650
|
throw new SetupError(`Redis at ${url} is not answering.`, [
|
|
13699
|
-
"fix the URL and re-run
|
|
13651
|
+
"fix the URL and re-run — Sim requires a reachable Redis"
|
|
13700
13652
|
]);
|
|
13701
13653
|
}
|
|
13702
13654
|
return url;
|
|
@@ -13714,20 +13666,24 @@ async function ensureRedis(detection, existing) {
|
|
|
13714
13666
|
const managedUrl = managedRedisUrl();
|
|
13715
13667
|
if (managedUrl && await waitFor(async () => (await redisPing(managedUrl)).ok, 15000, 500)) {
|
|
13716
13668
|
log2.step(`Reusing ${REDIS_CONTAINER}`);
|
|
13717
|
-
return managedUrl;
|
|
13669
|
+
return keepConfiguredUrl(managedUrl, existing);
|
|
13718
13670
|
}
|
|
13719
13671
|
}
|
|
13720
13672
|
if (!await ensureDocker(false)) {
|
|
13721
|
-
|
|
13722
|
-
|
|
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
|
+
]);
|
|
13723
13677
|
}
|
|
13724
13678
|
return startManagedRedis(detection);
|
|
13725
13679
|
}
|
|
13726
13680
|
async function resolveRedis(detection, existing) {
|
|
13681
|
+
let configured = existing;
|
|
13727
13682
|
if (existing && existing !== LOCAL_URL && await pingWithSpinner(existing, `Pinging ${existing}…`)) {
|
|
13728
13683
|
const keep = await confirm2({ message: `Keep using ${existing}?`, initialValue: true });
|
|
13729
13684
|
if (keep)
|
|
13730
13685
|
return existing;
|
|
13686
|
+
configured = undefined;
|
|
13731
13687
|
}
|
|
13732
13688
|
if (detection.redisPortOpen && await pingWithSpinner(LOCAL_URL, "Redis found on :6379 — pinging…")) {
|
|
13733
13689
|
const adopt = await confirm2({
|
|
@@ -13742,9 +13698,9 @@ async function resolveRedis(detection, existing) {
|
|
|
13742
13698
|
docker(["start", REDIS_CONTAINER]);
|
|
13743
13699
|
const managedUrl = managedRedisUrl();
|
|
13744
13700
|
if (managedUrl && await pingWithSpinner(managedUrl, `Starting existing ${REDIS_CONTAINER} container…`)) {
|
|
13745
|
-
return managedUrl;
|
|
13701
|
+
return keepConfiguredUrl(managedUrl, configured);
|
|
13746
13702
|
}
|
|
13747
|
-
log2.warn(`${REDIS_CONTAINER} exists but is not answering — starting a fresh one will replace it
|
|
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).`);
|
|
13748
13704
|
}
|
|
13749
13705
|
const dockerAvailable = await ensureDocker(false);
|
|
13750
13706
|
const options = [];
|
|
@@ -13809,15 +13765,6 @@ ${error}`, [
|
|
|
13809
13765
|
throw new Error(`aborted: db:migrate failed:
|
|
13810
13766
|
${error}`);
|
|
13811
13767
|
}
|
|
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
13768
|
async function runDevMode(detection, quick) {
|
|
13822
13769
|
const exposed = exposedManagedContainers(detection);
|
|
13823
13770
|
if (exposed.length > 0) {
|
|
@@ -13851,11 +13798,9 @@ async function runDevMode(detection, quick) {
|
|
|
13851
13798
|
values.COPILOT_API_KEY = copilotKey;
|
|
13852
13799
|
Object.assign(values, chatFlagValues(copilotKey));
|
|
13853
13800
|
Object.assign(values, await promptLlmKeys(detection, !quick));
|
|
13854
|
-
const redisUrl = quick ? await ensureRedis(detection, simAfter.vars.get("REDIS_URL")) : await
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
writeEnvValues("realtime", { REDIS_URL: redisUrl });
|
|
13858
|
-
}
|
|
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 });
|
|
13859
13804
|
const stagedVars = new Map(simAfter.vars);
|
|
13860
13805
|
for (const [key, value] of Object.entries(values))
|
|
13861
13806
|
stagedVars.set(key, value);
|
|
@@ -14025,7 +13970,7 @@ async function runWizard(flags) {
|
|
|
14025
13970
|
{
|
|
14026
13971
|
value: "custom",
|
|
14027
13972
|
label: "Custom",
|
|
14028
|
-
hint: "every option:
|
|
13973
|
+
hint: "every option: where Redis lives, trigger.dev, image variants"
|
|
14029
13974
|
}
|
|
14030
13975
|
],
|
|
14031
13976
|
initialValue: "quick"
|
|
@@ -14249,7 +14194,7 @@ function parseSetupArguments(rawArgs) {
|
|
|
14249
14194
|
init_errors2();
|
|
14250
14195
|
init_theme();
|
|
14251
14196
|
init_version();
|
|
14252
|
-
var SETUP_FEATURES2 = "email | storage | sandbox | jobs |
|
|
14197
|
+
var SETUP_FEATURES2 = "email | storage | sandbox | jobs | knowledge | knowledge-embeddings | chat | llm | integration <slug>";
|
|
14253
14198
|
var USAGE = `Usage:
|
|
14254
14199
|
sim-setup [--quick] [--dir <path>] [--mode compose|dev|k8s]
|
|
14255
14200
|
sim-setup config show configured capabilities and integrations
|