create-ragen-app 0.4.0 → 0.5.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.
- package/README.md +39 -31
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +151 -37
- package/dist/cli.js.map +1 -1
- package/dist/config-template.js +3 -3
- package/dist/llm-provider.d.ts +32 -10
- package/dist/llm-provider.d.ts.map +1 -1
- package/dist/llm-provider.js +52 -29
- package/dist/llm-provider.js.map +1 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +0 -34
- package/dist/manifest.js.map +1 -1
- package/dist/manual-setup.d.ts.map +1 -1
- package/dist/manual-setup.js +16 -24
- package/dist/manual-setup.js.map +1 -1
- package/dist/route-table.d.ts +12 -4
- package/dist/route-table.d.ts.map +1 -1
- package/dist/route-table.js +6 -6
- package/dist/route-table.js.map +1 -1
- package/dist/worker-runtime.d.ts +101 -0
- package/dist/worker-runtime.d.ts.map +1 -0
- package/dist/worker-runtime.js +118 -0
- package/dist/worker-runtime.js.map +1 -0
- package/package.json +1 -1
- package/dist/litellm-config.d.ts +0 -17
- package/dist/litellm-config.d.ts.map +0 -1
- package/dist/litellm-config.js +0 -28
- package/dist/litellm-config.js.map +0 -1
package/dist/llm-provider.js
CHANGED
|
@@ -3,16 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LLM_PROVIDERS = void 0;
|
|
4
4
|
exports.resolveLlmProviderChoice = resolveLlmProviderChoice;
|
|
5
5
|
exports.LLM_PROVIDERS = {
|
|
6
|
+
openrouter: {
|
|
7
|
+
label: 'OpenRouter (one key, most models)',
|
|
8
|
+
apiKeyEnvVar: 'OPENROUTER_API_KEY',
|
|
9
|
+
// Namespaced upstream, plain here: the model id is what the application
|
|
10
|
+
// and the catalogue use, and `model` is the upstream's own name. Keeping
|
|
11
|
+
// the slash out of the key also keeps it out of URLs and log lines.
|
|
12
|
+
modelName: 'claude-haiku-4-5-openrouter',
|
|
13
|
+
gatewayProvider: 'openrouter',
|
|
14
|
+
upstreamModel: 'anthropic/claude-haiku-4.5',
|
|
15
|
+
embeddings: {
|
|
16
|
+
modelName: 'text-embedding-3-small-openrouter',
|
|
17
|
+
upstreamModel: 'openai/text-embedding-3-small',
|
|
18
|
+
vectorSize: 1536,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
scaleway: {
|
|
22
|
+
label: 'Scaleway (EU infrastructure)',
|
|
23
|
+
apiKeyEnvVar: 'SCW_API_KEY',
|
|
24
|
+
baseUrl: {
|
|
25
|
+
envVar: 'SCW_API_BASE',
|
|
26
|
+
prompt: 'Paste your Scaleway Generative APIs base URL (https://api.scaleway.ai/<project-id>/v1)',
|
|
27
|
+
},
|
|
28
|
+
// The set Ragen's own demo runs. Both ids already exist in the shipped
|
|
29
|
+
// route table under `connection: scaleway`, so this writes the same routes
|
|
30
|
+
// the repository ships rather than inventing names.
|
|
31
|
+
modelName: 'mistral-small-3.2',
|
|
32
|
+
gatewayProvider: 'openai-compatible',
|
|
33
|
+
connection: 'scaleway',
|
|
34
|
+
upstreamModel: 'mistral-small-3.2-24b-instruct-2506',
|
|
35
|
+
embeddings: {
|
|
36
|
+
modelName: 'bge-multilingual-gemma2',
|
|
37
|
+
upstreamModel: 'bge-multilingual-gemma2',
|
|
38
|
+
// 3584 is `DEFAULT_VECTOR_SIZE` in rag-core, and it is this model's.
|
|
39
|
+
// The one Scaleway choice that needs no VECTOR_SIZE override — every
|
|
40
|
+
// other provider here does, and getting it wrong makes Qdrant reject
|
|
41
|
+
// every upsert rather than degrade.
|
|
42
|
+
vectorSize: 3584,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
6
45
|
openai: {
|
|
7
46
|
label: 'OpenAI',
|
|
8
47
|
apiKeyEnvVar: 'OPENAI_API_KEY',
|
|
9
48
|
modelName: 'gpt-4o-mini',
|
|
10
|
-
litellmModel: 'openai/gpt-4o-mini',
|
|
11
49
|
gatewayProvider: 'openai',
|
|
12
50
|
upstreamModel: 'gpt-4o-mini',
|
|
13
51
|
embeddings: {
|
|
14
52
|
modelName: 'text-embedding-3-small',
|
|
15
|
-
litellmModel: 'openai/text-embedding-3-small',
|
|
16
53
|
upstreamModel: 'text-embedding-3-small',
|
|
17
54
|
vectorSize: 1536,
|
|
18
55
|
},
|
|
@@ -21,12 +58,11 @@ exports.LLM_PROVIDERS = {
|
|
|
21
58
|
label: 'Anthropic',
|
|
22
59
|
apiKeyEnvVar: 'ANTHROPIC_API_KEY',
|
|
23
60
|
// Not "claude-haiku-4-5" — packages/platform-contracts/src/llm/model-catalog.ts
|
|
24
|
-
// already uses that name for the
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
61
|
+
// already uses that name for the Bedrock deployment of the same model, and
|
|
62
|
+
// the route table is a map: a second entry under that key would silently
|
|
63
|
+
// replace the first, so a scaffolded install would take over a catalogue
|
|
64
|
+
// name it does not own and serve it from a different account.
|
|
28
65
|
modelName: 'claude-haiku-4-5-direct',
|
|
29
|
-
litellmModel: 'anthropic/claude-haiku-4-5-20251001',
|
|
30
66
|
gatewayProvider: 'anthropic',
|
|
31
67
|
upstreamModel: 'claude-haiku-4-5-20251001',
|
|
32
68
|
// Anthropic ships no embeddings endpoint, so there is nothing to point
|
|
@@ -36,16 +72,14 @@ exports.LLM_PROVIDERS = {
|
|
|
36
72
|
// EmbeddingsUnsupportedError rather than failing inside the AI SDK.
|
|
37
73
|
},
|
|
38
74
|
};
|
|
39
|
-
function resolveLlmProviderChoice(choice, apiKey) {
|
|
75
|
+
function resolveLlmProviderChoice(choice, apiKey, baseUrl) {
|
|
40
76
|
const config = exports.LLM_PROVIDERS[choice];
|
|
41
77
|
const envUpdates = {
|
|
42
78
|
[config.apiKeyEnvVar]: apiKey,
|
|
79
|
+
...(config.baseUrl && baseUrl ? { [config.baseUrl.envVar]: baseUrl } : {}),
|
|
43
80
|
DEFAULT_MODEL: config.modelName,
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
LLM_GATEWAY: 'native',
|
|
47
|
-
// Not the gateway. This names the pricing namespace `AiUsage` writes
|
|
48
|
-
// against, where the whole catalogue lives under `litellm`; the provider
|
|
81
|
+
// The pricing namespace `AiUsage` writes against, where the whole
|
|
82
|
+
// catalogue lives under `litellm` — not a gateway any more. The provider
|
|
49
83
|
// that actually served a turn is recorded separately as `servedBy`.
|
|
50
84
|
DEFAULT_MODEL_PROVIDER: 'litellm',
|
|
51
85
|
// .env.example ships gemini-2.5-flash here, which needs Vertex
|
|
@@ -54,21 +88,15 @@ function resolveLlmProviderChoice(choice, apiKey) {
|
|
|
54
88
|
// model the user just configured is ever reached.
|
|
55
89
|
REPHRASE_MODEL: config.modelName,
|
|
56
90
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
model: config.litellmModel,
|
|
61
|
-
apiKeyEnvVar: config.apiKeyEnvVar,
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
// Written as well as the route table, and deliberately: `docker compose up`
|
|
65
|
-
// starts LiteLLM whatever `LLM_GATEWAY` says, so configuring both makes
|
|
66
|
-
// `LLM_GATEWAY=litellm` a working rollback rather than a broken one.
|
|
91
|
+
// The route table is the whole configuration now. There is no second place
|
|
92
|
+
// to keep in step and no flag to roll back to — #1194 removed the proxy path
|
|
93
|
+
// and the variable that chose it.
|
|
67
94
|
const routes = [
|
|
68
95
|
{
|
|
69
96
|
modelName: config.modelName,
|
|
70
97
|
provider: config.gatewayProvider,
|
|
71
98
|
model: config.upstreamModel,
|
|
99
|
+
...(config.connection ? { connection: config.connection } : {}),
|
|
72
100
|
},
|
|
73
101
|
];
|
|
74
102
|
if (config.embeddings) {
|
|
@@ -77,20 +105,15 @@ function resolveLlmProviderChoice(choice, apiKey) {
|
|
|
77
105
|
// upsert — rag-core's vector contract says so, and its default (3584)
|
|
78
106
|
// belongs to the Scaleway model being replaced here.
|
|
79
107
|
envUpdates.VECTOR_SIZE = String(config.embeddings.vectorSize);
|
|
80
|
-
liteLLMEntries.push({
|
|
81
|
-
modelName: config.embeddings.modelName,
|
|
82
|
-
model: config.embeddings.litellmModel,
|
|
83
|
-
apiKeyEnvVar: config.apiKeyEnvVar,
|
|
84
|
-
});
|
|
85
108
|
routes.push({
|
|
86
109
|
modelName: config.embeddings.modelName,
|
|
87
110
|
provider: config.gatewayProvider,
|
|
88
111
|
model: config.embeddings.upstreamModel,
|
|
112
|
+
...(config.connection ? { connection: config.connection } : {}),
|
|
89
113
|
});
|
|
90
114
|
}
|
|
91
115
|
return {
|
|
92
116
|
envUpdates,
|
|
93
|
-
liteLLMEntries,
|
|
94
117
|
routes,
|
|
95
118
|
embeddingsConfigured: Boolean(config.embeddings),
|
|
96
119
|
};
|
package/dist/llm-provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-provider.js","sourceRoot":"","sources":["../src/llm-provider.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"llm-provider.js","sourceRoot":"","sources":["../src/llm-provider.ts"],"names":[],"mappings":";;;AAoJA,4DAqDC;AAxIY,QAAA,aAAa,GAAiD;IACzE,UAAU,EAAE;QACV,KAAK,EAAE,mCAAmC;QAC1C,YAAY,EAAE,oBAAoB;QAClC,wEAAwE;QACxE,yEAAyE;QACzE,oEAAoE;QACpE,SAAS,EAAE,6BAA6B;QACxC,eAAe,EAAE,YAAY;QAC7B,aAAa,EAAE,4BAA4B;QAC3C,UAAU,EAAE;YACV,SAAS,EAAE,mCAAmC;YAC9C,aAAa,EAAE,+BAA+B;YAC9C,UAAU,EAAE,IAAI;SACjB;KACF;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,8BAA8B;QACrC,YAAY,EAAE,aAAa;QAC3B,OAAO,EAAE;YACP,MAAM,EAAE,cAAc;YACtB,MAAM,EACJ,wFAAwF;SAC3F;QACD,uEAAuE;QACvE,2EAA2E;QAC3E,oDAAoD;QACpD,SAAS,EAAE,mBAAmB;QAC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src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzC,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAEpE,eAAO,MAAM,QAAQ,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzC,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAEpE,eAAO,MAAM,QAAQ,EAAE,aAAa,EAqDnC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,aAAa,EAAE,CAEnE"}
|
package/dist/manifest.js
CHANGED
|
@@ -63,40 +63,6 @@ exports.MANIFEST = [
|
|
|
63
63
|
targets: ['root', 'admin'],
|
|
64
64
|
},
|
|
65
65
|
// --- Local-dev defaults that correct a stale example value ---
|
|
66
|
-
{
|
|
67
|
-
// The baseline, and `resolveLlmProviderChoice` overrides it with `native`
|
|
68
|
-
// whenever a provider key is actually configured — which is both branches
|
|
69
|
-
// the wizard offers.
|
|
70
|
-
//
|
|
71
|
-
// What is left is the third path: "I'll configure LiteLLM myself". That
|
|
72
|
-
// one writes no route table, and the table shipped in the repository names
|
|
73
|
-
// Azure, Bedrock, Vertex and Scaleway — providers a fresh install has no
|
|
74
|
-
// credentials for. Inheriting the `native` default there would make every
|
|
75
|
-
// model call fail on the first question, so this pins the proxy the manual
|
|
76
|
-
// guide then tells them to configure.
|
|
77
|
-
key: 'LLM_GATEWAY',
|
|
78
|
-
strategy: 'local-default',
|
|
79
|
-
targets: ['root'],
|
|
80
|
-
value: 'litellm',
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
// Ships commented out, which leaves apps/web sending no Authorization
|
|
84
|
-
// header while docker-compose.yml starts the proxy *with* a master key
|
|
85
|
-
// (`${LITELLM_MASTER_KEY:-sk-litellm-dev-key}`) — so every call to the
|
|
86
|
-
// proxy came back 401 and the model picker silently fell back to a
|
|
87
|
-
// static list.
|
|
88
|
-
//
|
|
89
|
-
// This is deliberately the same literal as the compose default rather
|
|
90
|
-
// than a generated secret: Compose interpolates `${LITELLM_MASTER_KEY}`
|
|
91
|
-
// from the shell or a root `.env`, and never from `.env.local`. A
|
|
92
|
-
// generated value here would land in the app and not in the container,
|
|
93
|
-
// which is the 401 again with a harder-to-see cause. It is a local-dev
|
|
94
|
-
// credential on a loopback port; a deployed install sets its own.
|
|
95
|
-
key: 'LITELLM_MASTER_KEY',
|
|
96
|
-
strategy: 'local-default',
|
|
97
|
-
targets: ['root'],
|
|
98
|
-
value: 'sk-litellm-dev-key',
|
|
99
|
-
},
|
|
100
66
|
{
|
|
101
67
|
// docker-compose.yml maps Postgres to host port 55432. A native or other
|
|
102
68
|
// Postgres on 5432 would otherwise silently answer instead of the
|
package/dist/manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AA0EH,4CAEC;AAzDY,QAAA,QAAQ,GAAoB;IACvC,oDAAoD;IACpD,EAAE,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE;IACrE,EAAE,GAAG,EAAE,oBAAoB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE;IAC7E;QACE,GAAG,EAAE,0BAA0B;QAC/B,QAAQ,EAAE,iBAAiB;QAC3B,OAAO,EAAE,CAAC,MAAM,CAAC;KAClB;IACD;QACE,GAAG,EAAE,qBAAqB;QAC1B,QAAQ,EAAE,iBAAiB;QAC3B,OAAO,EAAE,CAAC,MAAM,CAAC;KAClB;IACD;QACE,6DAA6D;QAC7D,sEAAsE;QACtE,0DAA0D;QAC1D,GAAG,EAAE,mBAAmB;QACxB,QAAQ,EAAE,iBAAiB;QAC3B,OAAO,EAAE,CAAC,MAAM,CAAC;KAClB;IACD;QACE,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,iBAAiB;QAC3B,OAAO,EAAE,CAAC,OAAO,CAAC;KACnB;IAED,yDAAyD;IACzD;QACE,yEAAyE;QACzE,mDAAmD;QACnD,oEAAoE;QACpE,0EAA0E;QAC1E,0BAA0B;QAC1B,GAAG,EAAE,qBAAqB;QAC1B,QAAQ,EAAE,iBAAiB;QAC3B,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;KAC3B;IAED,gEAAgE;IAChE;QACE,yEAAyE;QACzE,kEAAkE;QAClE,gEAAgE;QAChE,wEAAwE;QACxE,6EAA6E;QAC7E,0CAA0C;QAC1C,GAAG,EAAE,cAAc;QACnB,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QAC1B,KAAK,EAAE,qDAAqD;KAC7D;CACF,CAAC;AAEF,SAAgB,gBAAgB,CAAC,MAAiB;IAChD,OAAO,gBAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manual-setup.d.ts","sourceRoot":"","sources":["../src/manual-setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manual-setup.d.ts","sourceRoot":"","sources":["../src/manual-setup.ts"],"names":[],"mappings":"AAkIA,wBAAgB,0BAA0B,IAAI,MAAM,CAsCnD"}
|
package/dist/manual-setup.js
CHANGED
|
@@ -16,28 +16,31 @@ function providerSection(choice) {
|
|
|
16
16
|
const config = llm_provider_1.LLM_PROVIDERS[choice];
|
|
17
17
|
const envLines = [
|
|
18
18
|
`${config.apiKeyEnvVar}=<your ${config.label} key>`,
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
|
|
19
|
+
// A provider whose endpoint is per-project needs its base URL named here
|
|
20
|
+
// too, or the key reaches nothing. Scaleway is the one that does.
|
|
21
|
+
...(config.baseUrl
|
|
22
|
+
? [`${config.baseUrl.envVar}=<https://api.scaleway.ai/<project-id>/v1>`]
|
|
23
|
+
: []),
|
|
24
|
+
// Not a gateway selector: `litellm` is the pricing namespace `AiUsage`
|
|
25
|
+
// writes against, and the provider that actually served a turn is recorded
|
|
26
|
+
// separately as `servedBy`. The flag that used to sit here went with the
|
|
27
|
+
// proxy in #1194.
|
|
22
28
|
'DEFAULT_MODEL_PROVIDER=litellm',
|
|
23
29
|
`DEFAULT_MODEL=${config.modelName}`,
|
|
24
30
|
`REPHRASE_MODEL=${config.modelName}`,
|
|
25
31
|
];
|
|
32
|
+
const connectionLine = config.connection
|
|
33
|
+
? [` connection: ${config.connection}`]
|
|
34
|
+
: [];
|
|
26
35
|
const routeLines = [
|
|
27
36
|
` ${config.modelName}:`,
|
|
28
37
|
` provider: ${config.gatewayProvider}`,
|
|
38
|
+
...connectionLine,
|
|
29
39
|
` model: ${config.upstreamModel}`,
|
|
30
40
|
];
|
|
31
|
-
const yamlLines = [
|
|
32
|
-
` - model_name: ${config.modelName}`,
|
|
33
|
-
' litellm_params:',
|
|
34
|
-
` model: ${config.litellmModel}`,
|
|
35
|
-
` api_key: os.environ/${config.apiKeyEnvVar}`,
|
|
36
|
-
];
|
|
37
41
|
if (config.embeddings) {
|
|
38
42
|
envLines.push(`EMBEDDINGS_MODEL=${config.embeddings.modelName}`, `VECTOR_SIZE=${config.embeddings.vectorSize}`);
|
|
39
|
-
|
|
40
|
-
routeLines.push(` ${config.embeddings.modelName}:`, ` provider: ${config.gatewayProvider}`, ` model: ${config.embeddings.upstreamModel}`);
|
|
43
|
+
routeLines.push(` ${config.embeddings.modelName}:`, ` provider: ${config.gatewayProvider}`, ...connectionLine, ` model: ${config.embeddings.upstreamModel}`);
|
|
41
44
|
}
|
|
42
45
|
return [
|
|
43
46
|
`### ${config.label}`,
|
|
@@ -58,19 +61,6 @@ function providerSection(choice) {
|
|
|
58
61
|
'The table shipped in the repository routes to Azure, Bedrock, Vertex and',
|
|
59
62
|
'Scaleway. Those entries are not wrong, they are simply not yours.',
|
|
60
63
|
'',
|
|
61
|
-
`<details><summary>Prefer to run a proxy instead?</summary>`,
|
|
62
|
-
'',
|
|
63
|
-
'Set `LLM_GATEWAY=litellm` rather than `native`, leave the route table',
|
|
64
|
-
'alone, and add this under the existing `model_list:` key in',
|
|
65
|
-
'`infra/litellm/config.yaml`:',
|
|
66
|
-
'',
|
|
67
|
-
'```yaml',
|
|
68
|
-
...yamlLines,
|
|
69
|
-
'```',
|
|
70
|
-
'',
|
|
71
|
-
'Then `docker compose restart litellm`.',
|
|
72
|
-
'',
|
|
73
|
-
'</details>',
|
|
74
64
|
...(config.embeddings ? [] : secondProviderForEmbeddings(config.label)),
|
|
75
65
|
'',
|
|
76
66
|
];
|
|
@@ -134,6 +124,8 @@ function manualLlmSetupInstructions() {
|
|
|
134
124
|
'`.env.local` and the route table. Pick one provider, apply both edits,',
|
|
135
125
|
'and restart the apps.',
|
|
136
126
|
'',
|
|
127
|
+
...providerSection('openrouter'),
|
|
128
|
+
...providerSection('scaleway'),
|
|
137
129
|
...providerSection('openai'),
|
|
138
130
|
...providerSection('anthropic'),
|
|
139
131
|
'## Before you upload anything',
|
package/dist/manual-setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manual-setup.js","sourceRoot":"","sources":["../src/manual-setup.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"manual-setup.js","sourceRoot":"","sources":["../src/manual-setup.ts"],"names":[],"mappings":";;AAkIA,gEAsCC;AAxKD,iDAAuE;AAEvE;;;;;;;;GAQG;AAEH,MAAM,iBAAiB,GAAG,yCAAyC,CAAC;AAEpE,SAAS,eAAe,CAAC,MAAyB;IAChD,MAAM,MAAM,GAAG,4BAAa,CAAC,MAAM,CAAC,CAAC;IAErC,MAAM,QAAQ,GAAG;QACf,GAAG,MAAM,CAAC,YAAY,UAAU,MAAM,CAAC,KAAK,OAAO;QACnD,yEAAyE;QACzE,kEAAkE;QAClE,GAAG,CAAC,MAAM,CAAC,OAAO;YAChB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,4CAA4C,CAAC;YACxE,CAAC,CAAC,EAAE,CAAC;QACP,uEAAuE;QACvE,2EAA2E;QAC3E,yEAAyE;QACzE,kBAAkB;QAClB,gCAAgC;QAChC,iBAAiB,MAAM,CAAC,SAAS,EAAE;QACnC,k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D,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/route-table.d.ts
CHANGED
|
@@ -7,14 +7,22 @@ export interface RouteTableEntry {
|
|
|
7
7
|
provider: string;
|
|
8
8
|
/** The upstream's own name for the model, which may differ from the id. */
|
|
9
9
|
model: string;
|
|
10
|
+
/**
|
|
11
|
+
* Which credentials an `openai-compatible` route uses, and therefore which
|
|
12
|
+
* `LLM_<NAME>_*` variables it reads. Omitted for providers with one upstream.
|
|
13
|
+
* An `openai-compatible` route is not optional about it: resolving one with
|
|
14
|
+
* no connection throws `MissingCredentialsError` naming "a `connection` on
|
|
15
|
+
* the route", before any `LLM_*` variable is read. So omitting it scaffolds
|
|
16
|
+
* an install that refuses to serve the model at all, rather than one that
|
|
17
|
+
* reaches the wrong upstream.
|
|
18
|
+
*/
|
|
19
|
+
connection?: string;
|
|
10
20
|
}
|
|
11
21
|
/**
|
|
12
22
|
* The route table for a scaffolded installation.
|
|
13
23
|
*
|
|
14
|
-
* Written **over** the table shipped in the repository rather than beside it
|
|
15
|
-
*
|
|
16
|
-
* `infra/litellm/config.yaml`. Two reasons, and the second is the one that
|
|
17
|
-
* decides it:
|
|
24
|
+
* Written **over** the table shipped in the repository rather than beside it.
|
|
25
|
+
* Two reasons, and the second is the one that decides it:
|
|
18
26
|
*
|
|
19
27
|
* - The shipped table names Azure, Bedrock, Vertex and Scaleway. A new
|
|
20
28
|
* installation has credentials for none of them, so every entry in it is a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-table.d.ts","sourceRoot":"","sources":["../src/route-table.ts"],"names":[],"mappings":"AAGA,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,kCAAkC,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"route-table.d.ts","sourceRoot":"","sources":["../src/route-table.ts"],"names":[],"mappings":"AAGA,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,kCAAkC,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,CA2B5E;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,SAAS,eAAe,EAAE,GAClC,IAAI,CAEN"}
|
package/dist/route-table.js
CHANGED
|
@@ -10,10 +10,8 @@ exports.ROUTE_TABLE_PATH = 'infra/llm-gateway/routes.yaml';
|
|
|
10
10
|
/**
|
|
11
11
|
* The route table for a scaffolded installation.
|
|
12
12
|
*
|
|
13
|
-
* Written **over** the table shipped in the repository rather than beside it
|
|
14
|
-
*
|
|
15
|
-
* `infra/litellm/config.yaml`. Two reasons, and the second is the one that
|
|
16
|
-
* decides it:
|
|
13
|
+
* Written **over** the table shipped in the repository rather than beside it.
|
|
14
|
+
* Two reasons, and the second is the one that decides it:
|
|
17
15
|
*
|
|
18
16
|
* - The shipped table names Azure, Bedrock, Vertex and Scaleway. A new
|
|
19
17
|
* installation has credentials for none of them, so every entry in it is a
|
|
@@ -27,12 +25,14 @@ exports.ROUTE_TABLE_PATH = 'infra/llm-gateway/routes.yaml';
|
|
|
27
25
|
*/
|
|
28
26
|
function renderRouteTable(entries) {
|
|
29
27
|
const routes = entries
|
|
30
|
-
.map(({ modelName, provider, model }) => ` ${modelName}:\n provider: ${provider}\n
|
|
28
|
+
.map(({ modelName, provider, model, connection }) => ` ${modelName}:\n provider: ${provider}\n` +
|
|
29
|
+
(connection ? ` connection: ${connection}\n` : '') +
|
|
30
|
+
` model: ${model}\n`)
|
|
31
31
|
.join('');
|
|
32
32
|
return `# Written by create-ragen-app for this installation.
|
|
33
33
|
#
|
|
34
34
|
# Which upstream serves each model id the application asks for. Ragen calls
|
|
35
|
-
# these providers itself
|
|
35
|
+
# these providers itself, with no proxy in the path.
|
|
36
36
|
#
|
|
37
37
|
# This replaced the table shipped in the repository, which routes to Azure,
|
|
38
38
|
# Bedrock, Vertex and Scaleway. Those entries are not wrong, they are simply
|
package/dist/route-table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-table.js","sourceRoot":"","sources":["../src/route-table.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"route-table.js","sourceRoot":"","sources":["../src/route-table.ts"],"names":[],"mappings":";;;AAyCA,4CA2BC;AAED,0CAKC;AA3ED,qCAAwC;AACxC,yCAAiC;AAEjC,iFAAiF;AACpE,QAAA,gBAAgB,GAAG,+BAA+B,CAAC;AAqBhE;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,gBAAgB,CAAC,OAAmC;IAClE,MAAM,MAAM,GAAG,OAAO;SACnB,GAAG,CACF,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAC7C,KAAK,SAAS,oBAAoB,QAAQ,IAAI;QAC9C,CAAC,UAAU,CAAC,CAAC,CAAC,mBAAmB,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,cAAc,KAAK,IAAI,CAC1B;SACA,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO;;;;;;;;;;;;;;;;EAgBP,MAAM,EAAE,CAAC;AACX,CAAC;AAED,SAAgB,eAAe,CAC7B,SAAiB,EACjB,OAAmC;IAEnC,IAAA,uBAAa,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,wBAAgB,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which engine runs background jobs, and what choosing BullMQ configures.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `WORKER_RUNTIME_SEAM` in `@ragenai/env`. Copied rather than imported
|
|
5
|
+
* for the reason `storage-provider.ts` gives: this package is published to npm
|
|
6
|
+
* and `@ragenai/env` is private, so depending on it would make
|
|
7
|
+
* `npm create ragen-app` unresolvable.
|
|
8
|
+
*/
|
|
9
|
+
export type WorkerRuntimeChoice = 'temporal' | 'bullmq';
|
|
10
|
+
export declare const WORKER_RUNTIME_LABELS: Record<WorkerRuntimeChoice, string>;
|
|
11
|
+
/**
|
|
12
|
+
* The published Redis port, not the standard one.
|
|
13
|
+
*
|
|
14
|
+
* `docker-compose.yml` maps Redis to 56379 for the reason Postgres is on
|
|
15
|
+
* 55432: a native Redis on 6379 answers instead of the container, and nothing
|
|
16
|
+
* about the resulting failure names a port.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_REDIS_URL = "redis://localhost:56379";
|
|
19
|
+
/**
|
|
20
|
+
* What the address prompt starts from — the adapter's own fallback, and what
|
|
21
|
+
* `.env.example` ships.
|
|
22
|
+
*
|
|
23
|
+
* Offered as a prefilled answer rather than written silently: right on a
|
|
24
|
+
* laptop, wrong everywhere else, and a deployed worker pointing at its own
|
|
25
|
+
* container connects to nothing and processes nothing with no error to read.
|
|
26
|
+
* Temporal left the compose file with ADR-44, so this address now names a
|
|
27
|
+
* server the operator runs — which makes it exactly the value they should see
|
|
28
|
+
* before it is written.
|
|
29
|
+
*/
|
|
30
|
+
export declare const DEFAULT_TEMPORAL_SERVER_ADDRESS = "localhost:7233";
|
|
31
|
+
/**
|
|
32
|
+
* A password the operator never has to invent, and that is never the same
|
|
33
|
+
* twice.
|
|
34
|
+
*
|
|
35
|
+
* The dashboard is off unless both credentials are set, so an installer that
|
|
36
|
+
* left them blank would ship the runtime with no way to see the queues — which
|
|
37
|
+
* is the thing the Temporal UI used to provide for free. Writing them is the
|
|
38
|
+
* point.
|
|
39
|
+
*
|
|
40
|
+
* **Generated rather than a fixed default.** A password shipped in this
|
|
41
|
+
* repository is the same password on every install, on a port that exposes
|
|
42
|
+
* every job's payload; the first person to read the source has it everywhere.
|
|
43
|
+
* Generating costs the operator nothing — they type nothing either way — and
|
|
44
|
+
* the value is printed once so it can be put in a password manager.
|
|
45
|
+
*
|
|
46
|
+
* Short enough to retype by hand, unlike `generateSecret()`'s 64 hex
|
|
47
|
+
* characters: this one is read off a terminal and typed into a browser prompt.
|
|
48
|
+
*/
|
|
49
|
+
export declare function generateAdminPassword(): string;
|
|
50
|
+
export declare const DEFAULT_ADMIN_USER = "admin";
|
|
51
|
+
/**
|
|
52
|
+
* How many documents the worker ingests at once, written explicitly rather
|
|
53
|
+
* than left to the code's default.
|
|
54
|
+
*
|
|
55
|
+
* It matches `DEFAULT_CONCURRENCY` in `@ragenai/jobs-bullmq`, which D2 raised
|
|
56
|
+
* from 10 to 20 on the strength of the same measurement: twenty documents
|
|
57
|
+
* uploaded at once took a median of 24.9s each at 10 and 12.3s at 20, the
|
|
58
|
+
* difference sitting entirely before parsing began rather than in the work.
|
|
59
|
+
*
|
|
60
|
+
* **Written anyway, even though it now equals the default.** The number the
|
|
61
|
+
* operator has to revisit is this one — it is the first thing to lower when a
|
|
62
|
+
* provider starts rate-limiting — and a default they never see is not a knob
|
|
63
|
+
* they can find. If the two ever diverge, this line is the install's answer and
|
|
64
|
+
* the code's is the fallback for everyone else.
|
|
65
|
+
*
|
|
66
|
+
* **A constant, not a guess from the machine.** `os.cpus().length` is the
|
|
67
|
+
* tempting input and it measures the wrong thing: an ingest is almost entirely
|
|
68
|
+
* waiting — on storage, on the parser, on the embedding provider — so cores
|
|
69
|
+
* predict nothing about how many can be in flight. A number derived from
|
|
70
|
+
* hardware would look principled and mean less than this one.
|
|
71
|
+
*
|
|
72
|
+
* Written into `.env` rather than applied silently, because the ceiling that
|
|
73
|
+
* really binds is the model provider's rate limit, and the operator is the
|
|
74
|
+
* only one who knows it. A value they can see is a value they can raise.
|
|
75
|
+
*/
|
|
76
|
+
export declare const DEFAULT_WORKER_CONCURRENCY = "20";
|
|
77
|
+
export interface WorkerRuntimeAnswers {
|
|
78
|
+
/** Blank takes `DEFAULT_TEMPORAL_SERVER_ADDRESS`. */
|
|
79
|
+
temporalServerAddress: string;
|
|
80
|
+
}
|
|
81
|
+
export interface WorkerRuntimeSelection {
|
|
82
|
+
choice: WorkerRuntimeChoice;
|
|
83
|
+
envUpdates: Record<string, string>;
|
|
84
|
+
/** Shown once after the install, when there is something to show. */
|
|
85
|
+
dashboard?: {
|
|
86
|
+
user: string;
|
|
87
|
+
password: string;
|
|
88
|
+
port: string;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* **The runtime each variant cannot work without is written here**, not left to
|
|
93
|
+
* whatever `.env.example` happens to ship. `REDIS_URL` is required under
|
|
94
|
+
* BullMQ and `TEMPORAL_SERVER_ADDRESS` under Temporal, and since #1224 the
|
|
95
|
+
* producers refuse to boot without the one their runtime names — so a wizard
|
|
96
|
+
* that picks the runtime and not its address configures an install that stops
|
|
97
|
+
* at startup. `create-ragen-app-knows-the-provider-seams.test.ts` holds this to
|
|
98
|
+
* the seam.
|
|
99
|
+
*/
|
|
100
|
+
export declare function resolveWorkerRuntimeSelection(choice: WorkerRuntimeChoice, answers?: WorkerRuntimeAnswers): WorkerRuntimeSelection;
|
|
101
|
+
//# sourceMappingURL=worker-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-runtime.d.ts","sourceRoot":"","sources":["../src/worker-runtime.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAExD,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAIrE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,4BAA4B,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,mBAAmB,CAAC;AAEhE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,MAAM,WAAW,oBAAoB;IACnC,qDAAqD;IACrD,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,qEAAqE;IACrE,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,sBAAsB,CAgCxB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_WORKER_CONCURRENCY = exports.DEFAULT_ADMIN_USER = exports.DEFAULT_TEMPORAL_SERVER_ADDRESS = exports.DEFAULT_REDIS_URL = exports.WORKER_RUNTIME_LABELS = void 0;
|
|
4
|
+
exports.generateAdminPassword = generateAdminPassword;
|
|
5
|
+
exports.resolveWorkerRuntimeSelection = resolveWorkerRuntimeSelection;
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
exports.WORKER_RUNTIME_LABELS = {
|
|
8
|
+
bullmq: 'BullMQ — the default. Runs on the Redis this install already has.',
|
|
9
|
+
temporal: 'Temporal — durable execution, on a server you run yourself (ADR-44).',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The published Redis port, not the standard one.
|
|
13
|
+
*
|
|
14
|
+
* `docker-compose.yml` maps Redis to 56379 for the reason Postgres is on
|
|
15
|
+
* 55432: a native Redis on 6379 answers instead of the container, and nothing
|
|
16
|
+
* about the resulting failure names a port.
|
|
17
|
+
*/
|
|
18
|
+
exports.DEFAULT_REDIS_URL = 'redis://localhost:56379';
|
|
19
|
+
/**
|
|
20
|
+
* What the address prompt starts from — the adapter's own fallback, and what
|
|
21
|
+
* `.env.example` ships.
|
|
22
|
+
*
|
|
23
|
+
* Offered as a prefilled answer rather than written silently: right on a
|
|
24
|
+
* laptop, wrong everywhere else, and a deployed worker pointing at its own
|
|
25
|
+
* container connects to nothing and processes nothing with no error to read.
|
|
26
|
+
* Temporal left the compose file with ADR-44, so this address now names a
|
|
27
|
+
* server the operator runs — which makes it exactly the value they should see
|
|
28
|
+
* before it is written.
|
|
29
|
+
*/
|
|
30
|
+
exports.DEFAULT_TEMPORAL_SERVER_ADDRESS = 'localhost:7233';
|
|
31
|
+
/**
|
|
32
|
+
* A password the operator never has to invent, and that is never the same
|
|
33
|
+
* twice.
|
|
34
|
+
*
|
|
35
|
+
* The dashboard is off unless both credentials are set, so an installer that
|
|
36
|
+
* left them blank would ship the runtime with no way to see the queues — which
|
|
37
|
+
* is the thing the Temporal UI used to provide for free. Writing them is the
|
|
38
|
+
* point.
|
|
39
|
+
*
|
|
40
|
+
* **Generated rather than a fixed default.** A password shipped in this
|
|
41
|
+
* repository is the same password on every install, on a port that exposes
|
|
42
|
+
* every job's payload; the first person to read the source has it everywhere.
|
|
43
|
+
* Generating costs the operator nothing — they type nothing either way — and
|
|
44
|
+
* the value is printed once so it can be put in a password manager.
|
|
45
|
+
*
|
|
46
|
+
* Short enough to retype by hand, unlike `generateSecret()`'s 64 hex
|
|
47
|
+
* characters: this one is read off a terminal and typed into a browser prompt.
|
|
48
|
+
*/
|
|
49
|
+
function generateAdminPassword() {
|
|
50
|
+
return (0, node_crypto_1.randomBytes)(12).toString('base64url');
|
|
51
|
+
}
|
|
52
|
+
exports.DEFAULT_ADMIN_USER = 'admin';
|
|
53
|
+
/**
|
|
54
|
+
* How many documents the worker ingests at once, written explicitly rather
|
|
55
|
+
* than left to the code's default.
|
|
56
|
+
*
|
|
57
|
+
* It matches `DEFAULT_CONCURRENCY` in `@ragenai/jobs-bullmq`, which D2 raised
|
|
58
|
+
* from 10 to 20 on the strength of the same measurement: twenty documents
|
|
59
|
+
* uploaded at once took a median of 24.9s each at 10 and 12.3s at 20, the
|
|
60
|
+
* difference sitting entirely before parsing began rather than in the work.
|
|
61
|
+
*
|
|
62
|
+
* **Written anyway, even though it now equals the default.** The number the
|
|
63
|
+
* operator has to revisit is this one — it is the first thing to lower when a
|
|
64
|
+
* provider starts rate-limiting — and a default they never see is not a knob
|
|
65
|
+
* they can find. If the two ever diverge, this line is the install's answer and
|
|
66
|
+
* the code's is the fallback for everyone else.
|
|
67
|
+
*
|
|
68
|
+
* **A constant, not a guess from the machine.** `os.cpus().length` is the
|
|
69
|
+
* tempting input and it measures the wrong thing: an ingest is almost entirely
|
|
70
|
+
* waiting — on storage, on the parser, on the embedding provider — so cores
|
|
71
|
+
* predict nothing about how many can be in flight. A number derived from
|
|
72
|
+
* hardware would look principled and mean less than this one.
|
|
73
|
+
*
|
|
74
|
+
* Written into `.env` rather than applied silently, because the ceiling that
|
|
75
|
+
* really binds is the model provider's rate limit, and the operator is the
|
|
76
|
+
* only one who knows it. A value they can see is a value they can raise.
|
|
77
|
+
*/
|
|
78
|
+
exports.DEFAULT_WORKER_CONCURRENCY = '20';
|
|
79
|
+
/**
|
|
80
|
+
* **The runtime each variant cannot work without is written here**, not left to
|
|
81
|
+
* whatever `.env.example` happens to ship. `REDIS_URL` is required under
|
|
82
|
+
* BullMQ and `TEMPORAL_SERVER_ADDRESS` under Temporal, and since #1224 the
|
|
83
|
+
* producers refuse to boot without the one their runtime names — so a wizard
|
|
84
|
+
* that picks the runtime and not its address configures an install that stops
|
|
85
|
+
* at startup. `create-ragen-app-knows-the-provider-seams.test.ts` holds this to
|
|
86
|
+
* the seam.
|
|
87
|
+
*/
|
|
88
|
+
function resolveWorkerRuntimeSelection(choice, answers) {
|
|
89
|
+
// Only an explicit `temporal` leaves the default. The fallback used to point
|
|
90
|
+
// the other way, when Temporal was what the compose file ran; now an
|
|
91
|
+
// unexpected value — a future variant, a mistyped flag — lands on the runtime
|
|
92
|
+
// this install actually ships, rather than on one that is no longer there.
|
|
93
|
+
if (choice === 'temporal') {
|
|
94
|
+
return {
|
|
95
|
+
choice: 'temporal',
|
|
96
|
+
envUpdates: {
|
|
97
|
+
WORKER_RUNTIME: 'temporal',
|
|
98
|
+
TEMPORAL_SERVER_ADDRESS: answers?.temporalServerAddress.trim() ||
|
|
99
|
+
exports.DEFAULT_TEMPORAL_SERVER_ADDRESS,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const password = generateAdminPassword();
|
|
104
|
+
const port = '8090';
|
|
105
|
+
return {
|
|
106
|
+
choice: 'bullmq',
|
|
107
|
+
envUpdates: {
|
|
108
|
+
WORKER_RUNTIME: 'bullmq',
|
|
109
|
+
REDIS_URL: exports.DEFAULT_REDIS_URL,
|
|
110
|
+
WORKER_CONCURRENCY: exports.DEFAULT_WORKER_CONCURRENCY,
|
|
111
|
+
WORKER_ADMIN_USER: exports.DEFAULT_ADMIN_USER,
|
|
112
|
+
WORKER_ADMIN_PASSWORD: password,
|
|
113
|
+
WORKER_ADMIN_PORT: port,
|
|
114
|
+
},
|
|
115
|
+
dashboard: { user: exports.DEFAULT_ADMIN_USER, password, port },
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=worker-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