@melaya/runner 1.0.57 → 1.0.58

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 (2) hide show
  1. package/dist/connection.js +33 -0
  2. package/package.json +1 -1
@@ -578,6 +578,39 @@ export async function connect(opts) {
578
578
  mkdirSync(runDir, { recursive: true });
579
579
  writeFileSync(join(runDir, "main.py"), mainPyContent, "utf-8");
580
580
  writeFileSync(join(runDir, "config.json"), JSON.stringify(cfg, null, 2), "utf-8");
581
+ // Materialise static-context bag from the cfg into <runDir>/rag/.
582
+ // The Node server collected these via POST/PUT /pipelines (which
583
+ // ran _materialise_inline_rag_docs on the builder box) and shipped
584
+ // them inline so the runner doesn't need a second HTTP fetch.
585
+ // Without this the spawned crew worker logs "RAG_DIR missing" and
586
+ // _load_rag_context() returns empty — every wizard Context card
587
+ // is silently lost.
588
+ const ragFilesFromCfg = cfg.rag_files;
589
+ if (ragFilesFromCfg && typeof ragFilesFromCfg === "object") {
590
+ const ragDir = join(runDir, "rag");
591
+ mkdirSync(ragDir, { recursive: true });
592
+ let wrote = 0;
593
+ for (const [fname, b64] of Object.entries(ragFilesFromCfg)) {
594
+ if (typeof b64 !== "string" || !fname)
595
+ continue;
596
+ // Filename traversal guard — server-side helper already
597
+ // sanitises but defense in depth: drop any name containing a
598
+ // slash or starting with a dot.
599
+ const safe = fname.replace(/[\\/]/g, "").replace(/^\.+/, "");
600
+ if (!safe)
601
+ continue;
602
+ try {
603
+ writeFileSync(join(ragDir, safe), Buffer.from(b64, "base64"));
604
+ wrote++;
605
+ }
606
+ catch (e) {
607
+ console.log(chalk.yellow(` ! could not write rag/${safe}: ${e.message}`));
608
+ }
609
+ }
610
+ if (wrote > 0) {
611
+ console.log(chalk.gray(` [rag] wrote ${wrote} static-context file(s) to ${ragDir}`));
612
+ }
613
+ }
581
614
  // Preflight the first persona's model so we surface an early
582
615
  // failure if (e.g.) LM Studio hasn't loaded the requested
583
616
  // qwen3.6-27b. Same flow as pipelines — it just reads the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.0.57",
3
+ "version": "1.0.58",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,