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.
Files changed (43) hide show
  1. package/README.md +47 -31
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +347 -30
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config-file.d.ts +14 -0
  6. package/dist/config-file.d.ts.map +1 -0
  7. package/dist/config-file.js +21 -0
  8. package/dist/config-file.js.map +1 -0
  9. package/dist/config-template.d.ts +30 -0
  10. package/dist/config-template.d.ts.map +1 -0
  11. package/dist/config-template.js +126 -0
  12. package/dist/config-template.js.map +1 -0
  13. package/dist/encryption-provider.d.ts +35 -0
  14. package/dist/encryption-provider.d.ts.map +1 -0
  15. package/dist/encryption-provider.js +63 -0
  16. package/dist/encryption-provider.js.map +1 -0
  17. package/dist/llm-provider.d.ts +49 -10
  18. package/dist/llm-provider.d.ts.map +1 -1
  19. package/dist/llm-provider.js +69 -16
  20. package/dist/llm-provider.js.map +1 -1
  21. package/dist/manifest.d.ts.map +1 -1
  22. package/dist/manifest.js +6 -22
  23. package/dist/manifest.js.map +1 -1
  24. package/dist/manual-setup.d.ts.map +1 -1
  25. package/dist/manual-setup.js +84 -23
  26. package/dist/manual-setup.js.map +1 -1
  27. package/dist/route-table.d.ts +39 -0
  28. package/dist/route-table.d.ts.map +1 -0
  29. package/dist/route-table.js +53 -0
  30. package/dist/route-table.js.map +1 -0
  31. package/dist/storage-provider.d.ts +49 -0
  32. package/dist/storage-provider.d.ts.map +1 -0
  33. package/dist/storage-provider.js +84 -0
  34. package/dist/storage-provider.js.map +1 -0
  35. package/dist/worker-runtime.d.ts +101 -0
  36. package/dist/worker-runtime.d.ts.map +1 -0
  37. package/dist/worker-runtime.js +118 -0
  38. package/dist/worker-runtime.js.map +1 -0
  39. package/package.json +2 -2
  40. package/dist/litellm-config.d.ts +0 -17
  41. package/dist/litellm-config.d.ts.map +0 -1
  42. package/dist/litellm-config.js +0 -28
  43. package/dist/litellm-config.js.map +0 -1
@@ -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-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-runtime.js","sourceRoot":"","sources":["../src/worker-runtime.ts"],"names":[],"mappings":";;;AA2DA,sDAEC;AAoDD,sEAmCC;AApJD,6CAA0C;AAa7B,QAAA,qBAAqB,GAAwC;IACxE,MAAM,EAAE,mEAAmE;IAC3E,QAAQ,EACN,sEAAsE;CACzE,CAAC;AAEF;;;;;;GAMG;AACU,QAAA,iBAAiB,GAAG,yBAAyB,CAAC;AAE3D;;;;;;;;;;GAUG;AACU,QAAA,+BAA+B,GAAG,gBAAgB,CAAC;AAEhE;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,qBAAqB;IACnC,OAAO,IAAA,yBAAW,EAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC/C,CAAC;AAEY,QAAA,kBAAkB,GAAG,OAAO,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,0BAA0B,GAAG,IAAI,CAAC;AAc/C;;;;;;;;GAQG;AACH,SAAgB,6BAA6B,CAC3C,MAA2B,EAC3B,OAA8B;IAE9B,6EAA6E;IAC7E,qEAAqE;IACrE,8EAA8E;IAC9E,2EAA2E;IAC3E,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;QAC1B,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE;gBACV,cAAc,EAAE,UAAU;gBAC1B,uBAAuB,EACrB,OAAO,EAAE,qBAAqB,CAAC,IAAI,EAAE;oBACrC,uCAA+B;aAClC;SACF,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,qBAAqB,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,MAAM,CAAC;IAEpB,OAAO;QACL,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE;YACV,cAAc,EAAE,QAAQ;YACxB,SAAS,EAAE,yBAAiB;YAC5B,kBAAkB,EAAE,kCAA0B;YAC9C,iBAAiB,EAAE,0BAAkB;YACrC,qBAAqB,EAAE,QAAQ;YAC/B,iBAAiB,EAAE,IAAI;SACxB;QACD,SAAS,EAAE,EAAE,IAAI,EAAE,0BAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE;KACxD,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ragen-app",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "description": "Scaffold a self-hosted Ragen AI installation with one command",
6
6
  "license": "Apache-2.0",
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "build": "tsc -p tsconfig.json",
24
24
  "clean": "rm -rf dist",
25
- "prepare": "npm run clean && npm run build",
25
+ "prepack": "npm run clean && npm run build",
26
26
  "lint": "eslint",
27
27
  "typecheck": "tsc --noEmit --incremental --tsBuildInfoFile ./typecheck.tsbuildinfo"
28
28
  },
@@ -1,17 +0,0 @@
1
- /**
2
- * Wires a plain OpenAI or Anthropic API key into `infra/litellm/config.yaml`
3
- * by inserting a new `model_list` entry as text, not by parsing and
4
- * re-serializing the YAML. The shipped config is heavily hand-commented
5
- * (rationale for every model, dated notes, links) and a round-trip through a
6
- * YAML library would collapse or reorder all of that — a text splice right
7
- * after the `model_list:` key preserves everything else byte-for-byte.
8
- */
9
- export interface LiteLLMModelEntry {
10
- modelName: string;
11
- /** LiteLLM provider-prefixed model id, e.g. "openai/gpt-4o-mini". */
12
- model: string;
13
- /** Name of the env var holding the API key, e.g. "OPENAI_API_KEY". */
14
- apiKeyEnvVar: string;
15
- }
16
- export declare function addLiteLLMModel(configText: string, entry: LiteLLMModelEntry): string;
17
- //# sourceMappingURL=litellm-config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"litellm-config.d.ts","sourceRoot":"","sources":["../src/litellm-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,iBAAiB,GACvB,MAAM,CAoBR"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- /**
3
- * Wires a plain OpenAI or Anthropic API key into `infra/litellm/config.yaml`
4
- * by inserting a new `model_list` entry as text, not by parsing and
5
- * re-serializing the YAML. The shipped config is heavily hand-commented
6
- * (rationale for every model, dated notes, links) and a round-trip through a
7
- * YAML library would collapse or reorder all of that — a text splice right
8
- * after the `model_list:` key preserves everything else byte-for-byte.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.addLiteLLMModel = addLiteLLMModel;
12
- function addLiteLLMModel(configText, entry) {
13
- const lines = configText.split('\n');
14
- const anchorIndex = lines.findIndex((line) => line.trim() === 'model_list:');
15
- if (anchorIndex === -1) {
16
- throw new Error('infra/litellm/config.yaml has no `model_list:` key — cannot insert a model entry.');
17
- }
18
- const entryLines = [
19
- ` - model_name: ${entry.modelName}`,
20
- ' litellm_params:',
21
- ` model: ${entry.model}`,
22
- ` api_key: os.environ/${entry.apiKeyEnvVar}`,
23
- '',
24
- ];
25
- lines.splice(anchorIndex + 1, 0, ...entryLines);
26
- return lines.join('\n');
27
- }
28
- //# sourceMappingURL=litellm-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"litellm-config.js","sourceRoot":"","sources":["../src/litellm-config.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAUH,0CAuBC;AAvBD,SAAgB,eAAe,CAC7B,UAAkB,EAClB,KAAwB;IAExB,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,aAAa,CAAC,CAAC;IAE7E,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG;QACjB,mBAAmB,KAAK,CAAC,SAAS,EAAE;QACpC,qBAAqB;QACrB,gBAAgB,KAAK,CAAC,KAAK,EAAE;QAC7B,6BAA6B,KAAK,CAAC,YAAY,EAAE;QACjD,EAAE;KACH,CAAC;IAEF,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC;IAChD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}