create-ragen-app 0.3.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 +47 -31
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +347 -30
- package/dist/cli.js.map +1 -1
- package/dist/config-file.d.ts +14 -0
- package/dist/config-file.d.ts.map +1 -0
- package/dist/config-file.js +21 -0
- package/dist/config-file.js.map +1 -0
- package/dist/config-template.d.ts +30 -0
- package/dist/config-template.d.ts.map +1 -0
- package/dist/config-template.js +126 -0
- package/dist/config-template.js.map +1 -0
- package/dist/encryption-provider.d.ts +35 -0
- package/dist/encryption-provider.d.ts.map +1 -0
- package/dist/encryption-provider.js +63 -0
- package/dist/encryption-provider.js.map +1 -0
- package/dist/llm-provider.d.ts +49 -10
- package/dist/llm-provider.d.ts.map +1 -1
- package/dist/llm-provider.js +69 -16
- package/dist/llm-provider.js.map +1 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +6 -22
- package/dist/manifest.js.map +1 -1
- package/dist/manual-setup.d.ts.map +1 -1
- package/dist/manual-setup.js +84 -23
- package/dist/manual-setup.js.map +1 -1
- package/dist/route-table.d.ts +39 -0
- package/dist/route-table.d.ts.map +1 -0
- package/dist/route-table.js +53 -0
- package/dist/route-table.js.map +1 -0
- package/dist/storage-provider.d.ts +49 -0
- package/dist/storage-provider.d.ts.map +1 -0
- package/dist/storage-provider.js +84 -0
- package/dist/storage-provider.js.map +1 -0
- 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 +2 -2
- 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/manifest.js
CHANGED
|
@@ -64,28 +64,12 @@ exports.MANIFEST = [
|
|
|
64
64
|
},
|
|
65
65
|
// --- Local-dev defaults that correct a stale example value ---
|
|
66
66
|
{
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
// This is deliberately the same literal as the compose default rather
|
|
74
|
-
// than a generated secret: Compose interpolates `${LITELLM_MASTER_KEY}`
|
|
75
|
-
// from the shell or a root `.env`, and never from `.env.local`. A
|
|
76
|
-
// generated value here would land in the app and not in the container,
|
|
77
|
-
// which is the 401 again with a harder-to-see cause. It is a local-dev
|
|
78
|
-
// credential on a loopback port; a deployed install sets its own.
|
|
79
|
-
key: 'LITELLM_MASTER_KEY',
|
|
80
|
-
strategy: 'local-default',
|
|
81
|
-
targets: ['root'],
|
|
82
|
-
value: 'sk-litellm-dev-key',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
// docker-compose.yml maps Postgres to host port 55432, not the 5432 that
|
|
86
|
-
// both .env.example files show — a native/other Postgres on 5432 would
|
|
87
|
-
// otherwise silently answer instead of the container. See
|
|
88
|
-
// docs/lessons.md.
|
|
67
|
+
// docker-compose.yml maps Postgres to host port 55432. A native or other
|
|
68
|
+
// Postgres on 5432 would otherwise silently answer instead of the
|
|
69
|
+
// container, and report success against the wrong database. The
|
|
70
|
+
// `.env.example` files used to disagree with this value; they no longer
|
|
71
|
+
// do, and `tests/architecture/docs-name-the-published-service-ports.test.ts`
|
|
72
|
+
// keeps it that way. See docs/lessons.md.
|
|
89
73
|
key: 'DATABASE_URL',
|
|
90
74
|
strategy: 'local-default',
|
|
91
75
|
targets: ['root', 'admin'],
|
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":";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AC,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,19 +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
|
+
// 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.
|
|
19
28
|
'DEFAULT_MODEL_PROVIDER=litellm',
|
|
20
29
|
`DEFAULT_MODEL=${config.modelName}`,
|
|
21
30
|
`REPHRASE_MODEL=${config.modelName}`,
|
|
22
31
|
];
|
|
23
|
-
const
|
|
24
|
-
`
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`
|
|
32
|
+
const connectionLine = config.connection
|
|
33
|
+
? [` connection: ${config.connection}`]
|
|
34
|
+
: [];
|
|
35
|
+
const routeLines = [
|
|
36
|
+
` ${config.modelName}:`,
|
|
37
|
+
` provider: ${config.gatewayProvider}`,
|
|
38
|
+
...connectionLine,
|
|
39
|
+
` model: ${config.upstreamModel}`,
|
|
28
40
|
];
|
|
29
41
|
if (config.embeddings) {
|
|
30
42
|
envLines.push(`EMBEDDINGS_MODEL=${config.embeddings.modelName}`, `VECTOR_SIZE=${config.embeddings.vectorSize}`);
|
|
31
|
-
|
|
43
|
+
routeLines.push(` ${config.embeddings.modelName}:`, ` provider: ${config.gatewayProvider}`, ...connectionLine, ` model: ${config.embeddings.upstreamModel}`);
|
|
32
44
|
}
|
|
33
45
|
return [
|
|
34
46
|
`### ${config.label}`,
|
|
@@ -39,22 +51,67 @@ function providerSection(choice) {
|
|
|
39
51
|
...envLines,
|
|
40
52
|
'```',
|
|
41
53
|
'',
|
|
42
|
-
'`infra/
|
|
54
|
+
'`infra/llm-gateway/routes.yaml` — replace the `routes:` block with:',
|
|
43
55
|
'',
|
|
44
56
|
'```yaml',
|
|
45
|
-
|
|
57
|
+
'routes:',
|
|
58
|
+
...routeLines,
|
|
46
59
|
'```',
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
'second provider. Leave `EMBEDDINGS_MODEL` and `VECTOR_SIZE` alone and',
|
|
53
|
-
'add one (OpenAI, Scaleway or Cohere) before uploading documents.',
|
|
54
|
-
]),
|
|
60
|
+
'',
|
|
61
|
+
'The table shipped in the repository routes to Azure, Bedrock, Vertex and',
|
|
62
|
+
'Scaleway. Those entries are not wrong, they are simply not yours.',
|
|
63
|
+
'',
|
|
64
|
+
...(config.embeddings ? [] : secondProviderForEmbeddings(config.label)),
|
|
55
65
|
'',
|
|
56
66
|
];
|
|
57
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* What to add when the chosen provider serves chat and nothing else.
|
|
70
|
+
*
|
|
71
|
+
* Concrete rather than "add one (OpenAI, Scaleway or Cohere)", because the
|
|
72
|
+
* instructions above replace the whole `routes:` block — so the shipped
|
|
73
|
+
* `EMBEDDINGS_MODEL` default stops being routed at all, and the knowledge base
|
|
74
|
+
* fails on the first upload with a model id nothing serves. Telling someone to
|
|
75
|
+
* leave that variable alone was correct while a proxy served it and is wrong
|
|
76
|
+
* now.
|
|
77
|
+
*
|
|
78
|
+
* OpenAI rather than a choice, for the same reason the wizard picks defaults:
|
|
79
|
+
* one working recipe beats three that each need a decision. Derived from
|
|
80
|
+
* `LLM_PROVIDERS.openai` so the model name and its vector size cannot drift
|
|
81
|
+
* from what the wizard would have written.
|
|
82
|
+
*/
|
|
83
|
+
function secondProviderForEmbeddings(label) {
|
|
84
|
+
const openai = llm_provider_1.LLM_PROVIDERS.openai;
|
|
85
|
+
const embeddings = openai.embeddings;
|
|
86
|
+
if (!embeddings) {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
return [
|
|
90
|
+
'',
|
|
91
|
+
`${label} publishes no embeddings API, so the knowledge base needs a`,
|
|
92
|
+
'second provider. Anything else with one will do; this is the shortest',
|
|
93
|
+
'working version.',
|
|
94
|
+
'',
|
|
95
|
+
'Add to `.env.local`:',
|
|
96
|
+
'',
|
|
97
|
+
'```',
|
|
98
|
+
`${openai.apiKeyEnvVar}=<your ${openai.label} key>`,
|
|
99
|
+
`EMBEDDINGS_MODEL=${embeddings.modelName}`,
|
|
100
|
+
`VECTOR_SIZE=${embeddings.vectorSize}`,
|
|
101
|
+
'```',
|
|
102
|
+
'',
|
|
103
|
+
'And a second entry under `routes:`, beside the chat one above:',
|
|
104
|
+
'',
|
|
105
|
+
'```yaml',
|
|
106
|
+
` ${embeddings.modelName}:`,
|
|
107
|
+
` provider: ${openai.gatewayProvider}`,
|
|
108
|
+
` model: ${embeddings.upstreamModel}`,
|
|
109
|
+
'```',
|
|
110
|
+
'',
|
|
111
|
+
'Without both, uploads fail on a model id nothing serves — the route table',
|
|
112
|
+
'you wrote above replaced the one that used to carry a default.',
|
|
113
|
+
];
|
|
114
|
+
}
|
|
58
115
|
function manualLlmSetupInstructions() {
|
|
59
116
|
return [
|
|
60
117
|
'# Configure a chat model',
|
|
@@ -63,12 +120,12 @@ function manualLlmSetupInstructions() {
|
|
|
63
120
|
'base will not work until one is configured. Nothing here needs to go',
|
|
64
121
|
'through a CLI — edit the two files below yourself.',
|
|
65
122
|
'',
|
|
66
|
-
'
|
|
67
|
-
'',
|
|
68
|
-
'
|
|
69
|
-
'docker compose restart litellm',
|
|
70
|
-
'```',
|
|
123
|
+
'Ragen calls providers directly by default, so the two files are your',
|
|
124
|
+
'`.env.local` and the route table. Pick one provider, apply both edits,',
|
|
125
|
+
'and restart the apps.',
|
|
71
126
|
'',
|
|
127
|
+
...providerSection('openrouter'),
|
|
128
|
+
...providerSection('scaleway'),
|
|
72
129
|
...providerSection('openai'),
|
|
73
130
|
...providerSection('anthropic'),
|
|
74
131
|
'## Before you upload anything',
|
|
@@ -80,11 +137,15 @@ function manualLlmSetupInstructions() {
|
|
|
80
137
|
'',
|
|
81
138
|
'## Check it worked',
|
|
82
139
|
'',
|
|
140
|
+
'One real call per model this installation is configured to use:',
|
|
141
|
+
'',
|
|
83
142
|
'```bash',
|
|
84
|
-
'
|
|
85
|
-
' http://localhost:4000/v1/models',
|
|
143
|
+
'npm run gateway:preflight -- --probe',
|
|
86
144
|
'```',
|
|
87
145
|
'',
|
|
146
|
+
'It resolves each model and calls it. "Configured" and "works" are',
|
|
147
|
+
'different questions, and only the second one matters here.',
|
|
148
|
+
'',
|
|
88
149
|
`Anything else — S3 storage, encryption at rest, Stripe, email, MCP`,
|
|
89
150
|
`connectors — is documented at ${SELF_HOSTING_DOCS}.`,
|
|
90
151
|
'',
|
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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QACtE,sEAAsE;QACtE,oDAAoD;QACpD,EAAE;QACF,sEAAsE;QACtE,wEAAwE;QACxE,uBAAuB;QACvB,EAAE;QACF,GAAG,eAAe,CAAC,YAAY,CAAC;QAChC,GAAG,eAAe,CAAC,UAAU,CAAC;QAC9B,GAAG,eAAe,CAAC,QAAQ,CAAC;QAC5B,GAAG,eAAe,CAAC,WAAW,CAAC;QAC/B,+BAA+B;QAC/B,EAAE;QACF,mEAAmE;QACnE,yEAAyE;QACzE,qEAAqE;QACrE,yBAAyB;QACzB,EAAE;QACF,oBAAoB;QACpB,EAAE;QACF,iEAAiE;QACjE,EAAE;QACF,SAAS;QACT,sCAAsC;QACtC,KAAK;QACL,EAAE;QACF,mEAAmE;QACnE,4DAA4D;QAC5D,EAAE;QACF,oEAAoE;QACpE,iCAAiC,iBAAiB,GAAG;QACrD,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Where every app finds the table: `defaultRouteTablePath()` walks up to it. */
|
|
2
|
+
export declare const ROUTE_TABLE_PATH = "infra/llm-gateway/routes.yaml";
|
|
3
|
+
export interface RouteTableEntry {
|
|
4
|
+
/** The id the application asks for — `DEFAULT_MODEL`, `EMBEDDINGS_MODEL`. */
|
|
5
|
+
modelName: string;
|
|
6
|
+
/** A `@ragenai/llm-gateway` provider id. */
|
|
7
|
+
provider: string;
|
|
8
|
+
/** The upstream's own name for the model, which may differ from the id. */
|
|
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;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The route table for a scaffolded installation.
|
|
23
|
+
*
|
|
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:
|
|
26
|
+
*
|
|
27
|
+
* - The shipped table names Azure, Bedrock, Vertex and Scaleway. A new
|
|
28
|
+
* installation has credentials for none of them, so every entry in it is a
|
|
29
|
+
* route to a 401.
|
|
30
|
+
* - `LLM_ROUTES_PATH` would be the alternative, and a *relative* one is a
|
|
31
|
+
* trap: `routeTableFromEnv` joins it to `process.cwd()`, which is a
|
|
32
|
+
* different directory for `apps/web`, `apps/api` and `apps/worker`. An
|
|
33
|
+
* absolute path avoids that and then breaks the moment the directory is
|
|
34
|
+
* moved. Writing the file where the default lookup already walks to it
|
|
35
|
+
* needs no variable at all.
|
|
36
|
+
*/
|
|
37
|
+
export declare function renderRouteTable(entries: readonly RouteTableEntry[]): string;
|
|
38
|
+
export declare function writeRouteTable(targetDir: string, entries: readonly RouteTableEntry[]): void;
|
|
39
|
+
//# sourceMappingURL=route-table.d.ts.map
|
|
@@ -0,0 +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;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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROUTE_TABLE_PATH = void 0;
|
|
4
|
+
exports.renderRouteTable = renderRouteTable;
|
|
5
|
+
exports.writeRouteTable = writeRouteTable;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
/** Where every app finds the table: `defaultRouteTablePath()` walks up to it. */
|
|
9
|
+
exports.ROUTE_TABLE_PATH = 'infra/llm-gateway/routes.yaml';
|
|
10
|
+
/**
|
|
11
|
+
* The route table for a scaffolded installation.
|
|
12
|
+
*
|
|
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:
|
|
15
|
+
*
|
|
16
|
+
* - The shipped table names Azure, Bedrock, Vertex and Scaleway. A new
|
|
17
|
+
* installation has credentials for none of them, so every entry in it is a
|
|
18
|
+
* route to a 401.
|
|
19
|
+
* - `LLM_ROUTES_PATH` would be the alternative, and a *relative* one is a
|
|
20
|
+
* trap: `routeTableFromEnv` joins it to `process.cwd()`, which is a
|
|
21
|
+
* different directory for `apps/web`, `apps/api` and `apps/worker`. An
|
|
22
|
+
* absolute path avoids that and then breaks the moment the directory is
|
|
23
|
+
* moved. Writing the file where the default lookup already walks to it
|
|
24
|
+
* needs no variable at all.
|
|
25
|
+
*/
|
|
26
|
+
function renderRouteTable(entries) {
|
|
27
|
+
const routes = entries
|
|
28
|
+
.map(({ modelName, provider, model, connection }) => ` ${modelName}:\n provider: ${provider}\n` +
|
|
29
|
+
(connection ? ` connection: ${connection}\n` : '') +
|
|
30
|
+
` model: ${model}\n`)
|
|
31
|
+
.join('');
|
|
32
|
+
return `# Written by create-ragen-app for this installation.
|
|
33
|
+
#
|
|
34
|
+
# Which upstream serves each model id the application asks for. Ragen calls
|
|
35
|
+
# these providers itself, with no proxy in the path.
|
|
36
|
+
#
|
|
37
|
+
# This replaced the table shipped in the repository, which routes to Azure,
|
|
38
|
+
# Bedrock, Vertex and Scaleway. Those entries are not wrong, they are simply
|
|
39
|
+
# not yours: nothing here has credentials for them.
|
|
40
|
+
#
|
|
41
|
+
# To serve another model, add an entry. The key is the id the application asks
|
|
42
|
+
# for (DEFAULT_MODEL, EMBEDDINGS_MODEL, REPHRASE_MODEL); \`model\` is the
|
|
43
|
+
# upstream's own name for it, which is not always the same string. Credentials
|
|
44
|
+
# stay in the environment and never appear here.
|
|
45
|
+
version: 1
|
|
46
|
+
|
|
47
|
+
routes:
|
|
48
|
+
${routes}`;
|
|
49
|
+
}
|
|
50
|
+
function writeRouteTable(targetDir, entries) {
|
|
51
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(targetDir, exports.ROUTE_TABLE_PATH), renderRouteTable(entries));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=route-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where uploaded documents live.
|
|
3
|
+
*
|
|
4
|
+
* The wizard skipped this until now and sent people to a manual guide, which
|
|
5
|
+
* is the one question where getting it wrong is expensive: `STORAGE_PROVIDER=s3`
|
|
6
|
+
* with a missing credential does not fail at boot in every app, it fails at
|
|
7
|
+
* the first upload, as a storage error three layers from the cause.
|
|
8
|
+
*
|
|
9
|
+
* The variable names and the config field names below mirror `STORAGE_SEAM` in
|
|
10
|
+
* `@ragenai/env`. They are copied rather than imported because this package is
|
|
11
|
+
* published to npm and `@ragenai/env` is private, so a dependency on it would
|
|
12
|
+
* make `npm create ragen-app` unresolvable. The copy is held to the original
|
|
13
|
+
* by `tests/architecture/create-ragen-app-knows-the-provider-seams.test.ts` —
|
|
14
|
+
* the same arrangement `manifest.ts` already has with the `.env.example`
|
|
15
|
+
* files.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* One field of a written config, and the variable it resolves from.
|
|
19
|
+
*
|
|
20
|
+
* `required` decides how the installer renders it: a required field is typed
|
|
21
|
+
* `string`, so it needs a fallback to compile, while an optional one takes
|
|
22
|
+
* `process.env.X` as it comes. Carrying it here rather than inferring from the
|
|
23
|
+
* name keeps the renderer from having a fourth opinion about which variables a
|
|
24
|
+
* provider needs.
|
|
25
|
+
*/
|
|
26
|
+
export interface ConfigField {
|
|
27
|
+
field: string;
|
|
28
|
+
envVar: string;
|
|
29
|
+
required: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type StorageChoice = 'local' | 's3';
|
|
32
|
+
export interface S3Answers {
|
|
33
|
+
bucket: string;
|
|
34
|
+
region: string;
|
|
35
|
+
accessKeyId: string;
|
|
36
|
+
secretAccessKey: string;
|
|
37
|
+
/** Blank selects AWS. Set for R2, Scaleway, MinIO or Ceph. */
|
|
38
|
+
endpoint: string;
|
|
39
|
+
}
|
|
40
|
+
export interface StorageSelection {
|
|
41
|
+
provider: StorageChoice;
|
|
42
|
+
/** Written to the root `.env.local` — credentials never go in the config. */
|
|
43
|
+
envUpdates: Record<string, string>;
|
|
44
|
+
/** The config fields, already named as the config names them. */
|
|
45
|
+
configFields: ConfigField[];
|
|
46
|
+
}
|
|
47
|
+
export declare const STORAGE_LABELS: Record<StorageChoice, string>;
|
|
48
|
+
export declare function resolveStorageSelection(provider: StorageChoice, answers?: S3Answers): StorageSelection;
|
|
49
|
+
//# sourceMappingURL=storage-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-provider.d.ts","sourceRoot":"","sources":["../src/storage-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,aAAa,CAAC;IACxB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,iEAAiE;IACjE,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAGxD,CAAC;AAkBF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,SAAS,GAClB,gBAAgB,CAmDlB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Where uploaded documents live.
|
|
4
|
+
*
|
|
5
|
+
* The wizard skipped this until now and sent people to a manual guide, which
|
|
6
|
+
* is the one question where getting it wrong is expensive: `STORAGE_PROVIDER=s3`
|
|
7
|
+
* with a missing credential does not fail at boot in every app, it fails at
|
|
8
|
+
* the first upload, as a storage error three layers from the cause.
|
|
9
|
+
*
|
|
10
|
+
* The variable names and the config field names below mirror `STORAGE_SEAM` in
|
|
11
|
+
* `@ragenai/env`. They are copied rather than imported because this package is
|
|
12
|
+
* published to npm and `@ragenai/env` is private, so a dependency on it would
|
|
13
|
+
* make `npm create ragen-app` unresolvable. The copy is held to the original
|
|
14
|
+
* by `tests/architecture/create-ragen-app-knows-the-provider-seams.test.ts` —
|
|
15
|
+
* the same arrangement `manifest.ts` already has with the `.env.example`
|
|
16
|
+
* files.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.STORAGE_LABELS = void 0;
|
|
20
|
+
exports.resolveStorageSelection = resolveStorageSelection;
|
|
21
|
+
exports.STORAGE_LABELS = {
|
|
22
|
+
local: 'Local filesystem (default — no cloud account needed)',
|
|
23
|
+
s3: 'S3-compatible (AWS, Cloudflare R2, Scaleway, MinIO, Ceph)',
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A path-style endpoint is what Scaleway (dotted bucket names) and MinIO/Ceph
|
|
27
|
+
* need. Guessing it from the endpoint rather than asking keeps the wizard to
|
|
28
|
+
* one question per thing a person actually knows about their own storage.
|
|
29
|
+
*/
|
|
30
|
+
function needsPathStyle(endpoint) {
|
|
31
|
+
const host = endpoint.trim().toLowerCase();
|
|
32
|
+
if (!host) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return (!host.includes('amazonaws.com') &&
|
|
36
|
+
!host.includes('r2.cloudflarestorage.com'));
|
|
37
|
+
}
|
|
38
|
+
function resolveStorageSelection(provider, answers) {
|
|
39
|
+
if (provider === 'local' || !answers) {
|
|
40
|
+
return {
|
|
41
|
+
provider: 'local',
|
|
42
|
+
envUpdates: { STORAGE_PROVIDER: 'local' },
|
|
43
|
+
configFields: [
|
|
44
|
+
{ field: 'path', envVar: 'STORAGE_LOCAL_PATH', required: false },
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const endpoint = answers.endpoint.trim();
|
|
49
|
+
const envUpdates = {
|
|
50
|
+
STORAGE_PROVIDER: 's3',
|
|
51
|
+
S3_BUCKET_NAME: answers.bucket.trim(),
|
|
52
|
+
S3_REGION: answers.region.trim(),
|
|
53
|
+
S3_ACCESS_KEY_ID: answers.accessKeyId.trim(),
|
|
54
|
+
S3_SECRET_ACCESS_KEY: answers.secretAccessKey.trim(),
|
|
55
|
+
};
|
|
56
|
+
const configFields = [
|
|
57
|
+
{ field: 'bucketName', envVar: 'S3_BUCKET_NAME', required: true },
|
|
58
|
+
{ field: 'region', envVar: 'S3_REGION', required: true },
|
|
59
|
+
{ field: 'accessKeyId', envVar: 'S3_ACCESS_KEY_ID', required: true },
|
|
60
|
+
{
|
|
61
|
+
field: 'secretAccessKey',
|
|
62
|
+
envVar: 'S3_SECRET_ACCESS_KEY',
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
if (endpoint) {
|
|
67
|
+
envUpdates.S3_ENDPOINT_URL = endpoint;
|
|
68
|
+
configFields.push({
|
|
69
|
+
field: 'endpoint',
|
|
70
|
+
envVar: 'S3_ENDPOINT_URL',
|
|
71
|
+
required: false,
|
|
72
|
+
});
|
|
73
|
+
if (needsPathStyle(endpoint)) {
|
|
74
|
+
envUpdates.S3_FORCE_PATH_STYLE = 'true';
|
|
75
|
+
configFields.push({
|
|
76
|
+
field: 'forcePathStyle',
|
|
77
|
+
envVar: 'S3_FORCE_PATH_STYLE',
|
|
78
|
+
required: false,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { provider: 's3', envUpdates, configFields };
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=storage-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-provider.js","sourceRoot":"","sources":["../src/storage-provider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAyDH,0DAsDC;AA3EY,QAAA,cAAc,GAAkC;IAC3D,KAAK,EAAE,sDAAsD;IAC7D,EAAE,EAAE,2DAA2D;CAChE,CAAC;AAEF;;;;GAIG;AACH,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC/B,CAAC,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAC3C,CAAC;AACJ,CAAC;AAED,SAAgB,uBAAuB,CACrC,QAAuB,EACvB,OAAmB;IAEnB,IAAI,QAAQ,KAAK,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;QACrC,OAAO;YACL,QAAQ,EAAE,OAAO;YACjB,UAAU,EAAE,EAAE,gBAAgB,EAAE,OAAO,EAAE;YACzC,YAAY,EAAE;gBACZ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,KAAK,EAAE;a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QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AACtD,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"}
|