create-ragen-app 0.3.0 → 0.4.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.
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ENCRYPTION_LABELS = void 0;
4
+ exports.resolveEncryptionSelection = resolveEncryptionSelection;
5
+ const secrets_1 = require("./secrets");
6
+ exports.ENCRYPTION_LABELS = {
7
+ local: 'Yes — generate a key for me (recommended)',
8
+ scaleway: 'Yes — Scaleway Key Manager (I have a key id)',
9
+ kms: 'Yes — AWS KMS (I have a key id)',
10
+ none: 'No — store messages and documents in plaintext',
11
+ };
12
+ const NOTHING = {
13
+ envUpdates: {},
14
+ configFields: [],
15
+ };
16
+ function resolveEncryptionSelection(provider, answers) {
17
+ if (provider === 'none') {
18
+ // Deliberately writes nothing rather than `ENCRYPTION_PROVIDER=none`:
19
+ // there is no such provider, and `@ragenai/crypto` decides by looking for
20
+ // credentials. An unset variable is the honest way to say "not
21
+ // configured", and it is what a deployed environment refuses to start on.
22
+ return { provider, ...NOTHING, generatedKey: false };
23
+ }
24
+ if (provider === 'local') {
25
+ return {
26
+ provider,
27
+ envUpdates: {
28
+ ENCRYPTION_PROVIDER: 'local',
29
+ ENCRYPTION_MASTER_KEY: (0, secrets_1.generateSecret)(),
30
+ },
31
+ configFields: [
32
+ { field: 'masterKey', envVar: 'ENCRYPTION_MASTER_KEY', required: true },
33
+ ],
34
+ generatedKey: true,
35
+ };
36
+ }
37
+ const keyId = answers?.keyId.trim() ?? '';
38
+ const apiKey = answers?.apiKey.trim() ?? '';
39
+ if (provider === 'kms') {
40
+ return {
41
+ provider,
42
+ envUpdates: { ENCRYPTION_PROVIDER: 'kms', AWS_KMS_KEY_ID: keyId },
43
+ configFields: [
44
+ { field: 'keyId', envVar: 'AWS_KMS_KEY_ID', required: true },
45
+ ],
46
+ generatedKey: false,
47
+ };
48
+ }
49
+ return {
50
+ provider: 'scaleway',
51
+ envUpdates: {
52
+ ENCRYPTION_PROVIDER: 'scaleway',
53
+ SCW_KEY_MANAGER_KEY_ID: keyId,
54
+ SCW_API_KEY: apiKey,
55
+ },
56
+ configFields: [
57
+ { field: 'keyId', envVar: 'SCW_KEY_MANAGER_KEY_ID', required: true },
58
+ { field: 'apiKey', envVar: 'SCW_API_KEY', required: true },
59
+ ],
60
+ generatedKey: false,
61
+ };
62
+ }
63
+ //# sourceMappingURL=encryption-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption-provider.js","sourceRoot":"","sources":["../src/encryption-provider.ts"],"names":[],"mappings":";;;AAkDA,gEAqDC;AAvGD,uCAA2C;AAuB9B,QAAA,iBAAiB,GAAqC;IACjE,KAAK,EAAE,2CAA2C;IAClD,QAAQ,EAAE,8CAA8C;IACxD,GAAG,EAAE,iCAAiC;IACtC,IAAI,EAAE,gDAAgD;CACvD,CAAC;AAiBF,MAAM,OAAO,GAA6D;IACxE,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,EAAE;CACjB,CAAC;AAEF,SAAgB,0BAA0B,CACxC,QAA0B,EAC1B,OAA2B;IAE3B,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,sEAAsE;QACtE,0EAA0E;QAC1E,+DAA+D;QAC/D,0EAA0E;QAC1E,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IACvD,CAAC;IAED,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO;YACL,QAAQ;YACR,UAAU,EAAE;gBACV,mBAAmB,EAAE,OAAO;gBAC5B,qBAAqB,EAAE,IAAA,wBAAc,GAAE;aACxC;YACD,YAAY,EAAE;gBACZ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,uBAAuB,EAAE,QAAQ,EAAE,IAAI,EAAE;aACxE;YACD,YAAY,EAAE,IAAI;SACnB,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;IAE5C,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;QACvB,OAAO;YACL,QAAQ;YACR,UAAU,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE;YACjE,YAAY,EAAE;gBACZ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE;aAC7D;YACD,YAAY,EAAE,KAAK;SACpB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE;YACV,mBAAmB,EAAE,UAAU;YAC/B,sBAAsB,EAAE,KAAK;YAC7B,WAAW,EAAE,MAAM;SACpB;QACD,YAAY,EAAE;YACZ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE;YACpE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC3D;QACD,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { LiteLLMModelEntry } from './litellm-config';
2
+ import type { RouteTableEntry } from './route-table';
2
3
  /**
3
4
  * The `infra/litellm/config.yaml` shipped in the repo only wires Azure
4
5
  * OpenAI, AWS Bedrock, Google Vertex and Scaleway — none of which a new
@@ -9,6 +10,8 @@ export type LlmProviderChoice = 'openai' | 'anthropic';
9
10
  export interface LlmEmbeddingsConfig {
10
11
  modelName: string;
11
12
  litellmModel: string;
13
+ /** The upstream's own name, for the route table. */
14
+ upstreamModel: string;
12
15
  /** Output dimensionality — must match `VECTOR_SIZE`, see rag-core's vector contract. */
13
16
  vectorSize: number;
14
17
  }
@@ -17,6 +20,15 @@ export interface LlmProviderConfig {
17
20
  apiKeyEnvVar: string;
18
21
  modelName: string;
19
22
  litellmModel: string;
23
+ /**
24
+ * The `@ragenai/llm-gateway` provider that serves this key directly, and the
25
+ * upstream's own name for the model. Both providers the wizard offers have
26
+ * one, so a scaffolded install calls the provider itself — the same default
27
+ * every other deployment gets — rather than routing through a proxy it only
28
+ * runs because the wizard configured one.
29
+ */
30
+ gatewayProvider: string;
31
+ upstreamModel: string;
20
32
  /**
21
33
  * Undefined for a provider with no embeddings API of its own. Chat still
22
34
  * works; the knowledge base does not, because retrieval has nothing to
@@ -30,6 +42,11 @@ export declare const LLM_PROVIDERS: Record<LlmProviderChoice, LlmProviderConfig>
30
42
  export interface LlmProviderChoiceResult {
31
43
  envUpdates: Record<string, string>;
32
44
  liteLLMEntries: LiteLLMModelEntry[];
45
+ /**
46
+ * The route table this installation gets. Written over the one shipped in
47
+ * the repository, which names providers a new install has no keys for.
48
+ */
49
+ routes: RouteTableEntry[];
33
50
  /** False when the picked provider cannot serve embeddings — the caller warns. */
34
51
  embeddingsConfigured: boolean;
35
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"llm-provider.d.ts","sourceRoot":"","sources":["../src/llm-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;OAM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IACtC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,cAAc,EAAE,iBAAiB,EAAE,CAAC;IACpC;;;OAGG;IACH,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,iFAAiF;IACjF,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,MAAM,GACb,uBAAuB,CA+DzB"}
@@ -8,9 +8,12 @@ exports.LLM_PROVIDERS = {
8
8
  apiKeyEnvVar: 'OPENAI_API_KEY',
9
9
  modelName: 'gpt-4o-mini',
10
10
  litellmModel: 'openai/gpt-4o-mini',
11
+ gatewayProvider: 'openai',
12
+ upstreamModel: 'gpt-4o-mini',
11
13
  embeddings: {
12
14
  modelName: 'text-embedding-3-small',
13
15
  litellmModel: 'openai/text-embedding-3-small',
16
+ upstreamModel: 'text-embedding-3-small',
14
17
  vectorSize: 1536,
15
18
  },
16
19
  },
@@ -24,8 +27,13 @@ exports.LLM_PROVIDERS = {
24
27
  // Bedrock traffic under Bedrock's catalog metadata.
25
28
  modelName: 'claude-haiku-4-5-direct',
26
29
  litellmModel: 'anthropic/claude-haiku-4-5-20251001',
30
+ gatewayProvider: 'anthropic',
31
+ upstreamModel: 'claude-haiku-4-5-20251001',
27
32
  // Anthropic ships no embeddings endpoint, so there is nothing to point
28
- // EMBEDDINGS_MODEL at with this key alone.
33
+ // EMBEDDINGS_MODEL at with this key alone. The gateway says the same
34
+ // thing in its own shape: `anthropic` has no entry in
35
+ // EMBEDDING_PROVIDER_FACTORIES, and a route pointing there raises
36
+ // EmbeddingsUnsupportedError rather than failing inside the AI SDK.
29
37
  },
30
38
  };
31
39
  function resolveLlmProviderChoice(choice, apiKey) {
@@ -33,6 +41,12 @@ function resolveLlmProviderChoice(choice, apiKey) {
33
41
  const envUpdates = {
34
42
  [config.apiKeyEnvVar]: apiKey,
35
43
  DEFAULT_MODEL: config.modelName,
44
+ // Overrides the manifest's `litellm`, which is the baseline for the one
45
+ // path that reaches neither branch here: "I'll configure LiteLLM myself".
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
49
+ // that actually served a turn is recorded separately as `servedBy`.
36
50
  DEFAULT_MODEL_PROVIDER: 'litellm',
37
51
  // .env.example ships gemini-2.5-flash here, which needs Vertex
38
52
  // credentials. Multi-query expansion is on by default (ADR-15), so
@@ -47,6 +61,16 @@ function resolveLlmProviderChoice(choice, apiKey) {
47
61
  apiKeyEnvVar: config.apiKeyEnvVar,
48
62
  },
49
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.
67
+ const routes = [
68
+ {
69
+ modelName: config.modelName,
70
+ provider: config.gatewayProvider,
71
+ model: config.upstreamModel,
72
+ },
73
+ ];
50
74
  if (config.embeddings) {
51
75
  envUpdates.EMBEDDINGS_MODEL = config.embeddings.modelName;
52
76
  // VECTOR_SIZE and EMBEDDINGS_MODEL have to agree or Qdrant rejects every
@@ -58,10 +82,16 @@ function resolveLlmProviderChoice(choice, apiKey) {
58
82
  model: config.embeddings.litellmModel,
59
83
  apiKeyEnvVar: config.apiKeyEnvVar,
60
84
  });
85
+ routes.push({
86
+ modelName: config.embeddings.modelName,
87
+ provider: config.gatewayProvider,
88
+ model: config.embeddings.upstreamModel,
89
+ });
61
90
  }
62
91
  return {
63
92
  envUpdates,
64
93
  liteLLMEntries,
94
+ routes,
65
95
  embeddingsConfigured: Boolean(config.embeddings),
66
96
  };
67
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"llm-provider.js","sourceRoot":"","sources":["../src/llm-provider.ts"],"names":[],"mappings":";;;AAkEA,4DA2CC;AA7EY,QAAA,aAAa,GAAiD;IACzE,MAAM,EAAE;QACN,KAAK,E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M;QACN,oBAAoB,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;KACjD,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
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,EAqEnC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,aAAa,EAAE,CAEnE"}
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,EAuFnC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,aAAa,EAAE,CAEnE"}
package/dist/manifest.js CHANGED
@@ -63,6 +63,22 @@ 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
+ },
66
82
  {
67
83
  // Ships commented out, which leaves apps/web sending no Authorization
68
84
  // header while docker-compose.yml starts the proxy *with* a master key
@@ -82,10 +98,12 @@ exports.MANIFEST = [
82
98
  value: 'sk-litellm-dev-key',
83
99
  },
84
100
  {
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.
101
+ // docker-compose.yml maps Postgres to host port 55432. A native or other
102
+ // Postgres on 5432 would otherwise silently answer instead of the
103
+ // container, and report success against the wrong database. The
104
+ // `.env.example` files used to disagree with this value; they no longer
105
+ // do, and `tests/architecture/docs-name-the-published-service-ports.test.ts`
106
+ // keeps it that way. See docs/lessons.md.
89
107
  key: 'DATABASE_URL',
90
108
  strategy: 'local-default',
91
109
  targets: ['root', 'admin'],
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[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"manual-setup.d.ts","sourceRoot":"","sources":["../src/manual-setup.ts"],"names":[],"mappings":"AAsEA,wBAAgB,0BAA0B,IAAI,MAAM,CAkCnD"}
1
+ {"version":3,"file":"manual-setup.d.ts","sourceRoot":"","sources":["../src/manual-setup.ts"],"names":[],"mappings":"AAgJA,wBAAgB,0BAA0B,IAAI,MAAM,CAoCnD"}
@@ -16,10 +16,18 @@ 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
+ // The wizard writes this, so the guide must too — otherwise following it
20
+ // by hand produces a proxy install where the wizard produces a direct one.
21
+ 'LLM_GATEWAY=native',
19
22
  'DEFAULT_MODEL_PROVIDER=litellm',
20
23
  `DEFAULT_MODEL=${config.modelName}`,
21
24
  `REPHRASE_MODEL=${config.modelName}`,
22
25
  ];
26
+ const routeLines = [
27
+ ` ${config.modelName}:`,
28
+ ` provider: ${config.gatewayProvider}`,
29
+ ` model: ${config.upstreamModel}`,
30
+ ];
23
31
  const yamlLines = [
24
32
  ` - model_name: ${config.modelName}`,
25
33
  ' litellm_params:',
@@ -29,6 +37,7 @@ function providerSection(choice) {
29
37
  if (config.embeddings) {
30
38
  envLines.push(`EMBEDDINGS_MODEL=${config.embeddings.modelName}`, `VECTOR_SIZE=${config.embeddings.vectorSize}`);
31
39
  yamlLines.push(` - model_name: ${config.embeddings.modelName}`, ' litellm_params:', ` model: ${config.embeddings.litellmModel}`, ` api_key: os.environ/${config.apiKeyEnvVar}`);
40
+ routeLines.push(` ${config.embeddings.modelName}:`, ` provider: ${config.gatewayProvider}`, ` model: ${config.embeddings.upstreamModel}`);
32
41
  }
33
42
  return [
34
43
  `### ${config.label}`,
@@ -39,20 +48,78 @@ function providerSection(choice) {
39
48
  ...envLines,
40
49
  '```',
41
50
  '',
42
- '`infra/litellm/config.yaml`, under the existing `model_list:` key:',
51
+ '`infra/llm-gateway/routes.yaml` — replace the `routes:` block with:',
52
+ '',
53
+ '```yaml',
54
+ 'routes:',
55
+ ...routeLines,
56
+ '```',
57
+ '',
58
+ 'The table shipped in the repository routes to Azure, Bedrock, Vertex and',
59
+ 'Scaleway. Those entries are not wrong, they are simply not yours.',
60
+ '',
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`:',
43
66
  '',
44
67
  '```yaml',
45
68
  ...yamlLines,
46
69
  '```',
47
- ...(config.embeddings
48
- ? []
49
- : [
50
- '',
51
- `${config.label} has no embeddings API, so the knowledge base needs a`,
52
- 'second provider. Leave `EMBEDDINGS_MODEL` and `VECTOR_SIZE` alone and',
53
- 'add one (OpenAI, Scaleway or Cohere) before uploading documents.',
54
- ]),
55
70
  '',
71
+ 'Then `docker compose restart litellm`.',
72
+ '',
73
+ '</details>',
74
+ ...(config.embeddings ? [] : secondProviderForEmbeddings(config.label)),
75
+ '',
76
+ ];
77
+ }
78
+ /**
79
+ * What to add when the chosen provider serves chat and nothing else.
80
+ *
81
+ * Concrete rather than "add one (OpenAI, Scaleway or Cohere)", because the
82
+ * instructions above replace the whole `routes:` block — so the shipped
83
+ * `EMBEDDINGS_MODEL` default stops being routed at all, and the knowledge base
84
+ * fails on the first upload with a model id nothing serves. Telling someone to
85
+ * leave that variable alone was correct while a proxy served it and is wrong
86
+ * now.
87
+ *
88
+ * OpenAI rather than a choice, for the same reason the wizard picks defaults:
89
+ * one working recipe beats three that each need a decision. Derived from
90
+ * `LLM_PROVIDERS.openai` so the model name and its vector size cannot drift
91
+ * from what the wizard would have written.
92
+ */
93
+ function secondProviderForEmbeddings(label) {
94
+ const openai = llm_provider_1.LLM_PROVIDERS.openai;
95
+ const embeddings = openai.embeddings;
96
+ if (!embeddings) {
97
+ return [];
98
+ }
99
+ return [
100
+ '',
101
+ `${label} publishes no embeddings API, so the knowledge base needs a`,
102
+ 'second provider. Anything else with one will do; this is the shortest',
103
+ 'working version.',
104
+ '',
105
+ 'Add to `.env.local`:',
106
+ '',
107
+ '```',
108
+ `${openai.apiKeyEnvVar}=<your ${openai.label} key>`,
109
+ `EMBEDDINGS_MODEL=${embeddings.modelName}`,
110
+ `VECTOR_SIZE=${embeddings.vectorSize}`,
111
+ '```',
112
+ '',
113
+ 'And a second entry under `routes:`, beside the chat one above:',
114
+ '',
115
+ '```yaml',
116
+ ` ${embeddings.modelName}:`,
117
+ ` provider: ${openai.gatewayProvider}`,
118
+ ` model: ${embeddings.upstreamModel}`,
119
+ '```',
120
+ '',
121
+ 'Without both, uploads fail on a model id nothing serves — the route table',
122
+ 'you wrote above replaced the one that used to carry a default.',
56
123
  ];
57
124
  }
58
125
  function manualLlmSetupInstructions() {
@@ -63,11 +130,9 @@ function manualLlmSetupInstructions() {
63
130
  'base will not work until one is configured. Nothing here needs to go',
64
131
  'through a CLI — edit the two files below yourself.',
65
132
  '',
66
- 'Pick one provider, apply both edits, then restart the proxy:',
67
- '',
68
- '```bash',
69
- 'docker compose restart litellm',
70
- '```',
133
+ 'Ragen calls providers directly by default, so the two files are your',
134
+ '`.env.local` and the route table. Pick one provider, apply both edits,',
135
+ 'and restart the apps.',
71
136
  '',
72
137
  ...providerSection('openai'),
73
138
  ...providerSection('anthropic'),
@@ -80,11 +145,15 @@ function manualLlmSetupInstructions() {
80
145
  '',
81
146
  '## Check it worked',
82
147
  '',
148
+ 'One real call per model this installation is configured to use:',
149
+ '',
83
150
  '```bash',
84
- 'curl -s -H "Authorization: Bearer $LITELLM_MASTER_KEY" \\',
85
- ' http://localhost:4000/v1/models',
151
+ 'npm run gateway:preflight -- --probe',
86
152
  '```',
87
153
  '',
154
+ 'It resolves each model and calls it. "Configured" and "works" are',
155
+ 'different questions, and only the second one matters here.',
156
+ '',
88
157
  `Anything else — S3 storage, encryption at rest, Stripe, email, MCP`,
89
158
  `connectors — is documented at ${SELF_HOSTING_DOCS}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AM,CAAC,UAAU;YACnB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,EAAE;gBACF,GAAG,MAAM,CAAC,KAAK,uDAAuD;gBACtE,uEAAuE;gBACvE,kEAAkE;aACnE,CAAC;QACN,EAAE;KACH,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B;IACxC,OAAO;QACL,0BAA0B;QAC1B,EAAE;QACF,sEAAsE;QACtE,sEAAsE;QACtE,oDAAoD;QACpD,EAAE;QACF,8DAA8D;QAC9D,EAAE;QACF,SAAS;QACT,gCAAgC;QAChC,KAAK;QACL,EAAE;QACF,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,SAAS;QACT,2DAA2D;QAC3D,mCAAmC;QACnC,KAAK;QACL,EAAE;QACF,oEAAoE;QACpE,iCAAiC,iBAAiB,GAAG;QACrD,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"manual-setup.js","sourceRoot":"","sources":["../src/manual-setup.ts"],"names":[],"mappings":";;AAgJA,gEAoCC;AApLD,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,2EAA2E;QAC3E,oBAAoB;QACpB,gCAAgC;QAChC,iBAAiB,MAAM,CAAC,SAAS,EAAE;QACnC,kBAAkB,MAAM,CAAC,SAAS,EAAE;KACrC,CAAC;IAEF,MA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yE;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,31 @@
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
+ /**
12
+ * The route table for a scaffolded installation.
13
+ *
14
+ * Written **over** the table shipped in the repository rather than beside it,
15
+ * which is the same thing this wizard already does to
16
+ * `infra/litellm/config.yaml`. Two reasons, and the second is the one that
17
+ * decides it:
18
+ *
19
+ * - The shipped table names Azure, Bedrock, Vertex and Scaleway. A new
20
+ * installation has credentials for none of them, so every entry in it is a
21
+ * route to a 401.
22
+ * - `LLM_ROUTES_PATH` would be the alternative, and a *relative* one is a
23
+ * trap: `routeTableFromEnv` joins it to `process.cwd()`, which is a
24
+ * different directory for `apps/web`, `apps/api` and `apps/worker`. An
25
+ * absolute path avoids that and then breaks the moment the directory is
26
+ * moved. Writing the file where the default lookup already walks to it
27
+ * needs no variable at all.
28
+ */
29
+ export declare function renderRouteTable(entries: readonly RouteTableEntry[]): string;
30
+ export declare function writeRouteTable(targetDir: string, entries: readonly RouteTableEntry[]): void;
31
+ //# 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;CACf;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,CAyB5E;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
+ * which is the same thing this wizard already does to
15
+ * `infra/litellm/config.yaml`. Two reasons, and the second is the one that
16
+ * decides it:
17
+ *
18
+ * - The shipped table names Azure, Bedrock, Vertex and Scaleway. A new
19
+ * installation has credentials for none of them, so every entry in it is a
20
+ * route to a 401.
21
+ * - `LLM_ROUTES_PATH` would be the alternative, and a *relative* one is a
22
+ * trap: `routeTableFromEnv` joins it to `process.cwd()`, which is a
23
+ * different directory for `apps/web`, `apps/api` and `apps/worker`. An
24
+ * absolute path avoids that and then breaks the moment the directory is
25
+ * moved. Writing the file where the default lookup already walks to it
26
+ * needs no variable at all.
27
+ */
28
+ function renderRouteTable(entries) {
29
+ const routes = entries
30
+ .map(({ modelName, provider, model }) => ` ${modelName}:\n provider: ${provider}\n 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 — LLM_GATEWAY=native — 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":";;;AAiCA,4CAyBC;AAED,0CAKC;AAjED,qCAAwC;AACxC,yCAAiC;AAEjC,iFAAiF;AACpE,QAAA,gBAAgB,GAAG,+BAA+B,CAAC;AAWhE;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,gBAAgB,CAAC,OAAmC;IAClE,MAAM,MAAM,GAAG,OAAO;SACnB,GAAG,CACF,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,CACjC,KAAK,SAAS,oBAAoB,QAAQ,gBAAgB,KAAK,IAAI,CACtE;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"}