@melaya/runner 1.0.57 → 1.0.60
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/dist/connection.js +42 -0
- package/dist/modelLoader.js +11 -2
- package/package.json +1 -1
package/dist/connection.js
CHANGED
|
@@ -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
|
|
@@ -670,6 +703,15 @@ export async function connect(opts) {
|
|
|
670
703
|
MEL_MODEL_DISABLE_THINKING: preflight.profile.thinkingDefault === "off" ? "1" : "0",
|
|
671
704
|
}
|
|
672
705
|
: {}),
|
|
706
|
+
// Per-pipeline credentials from agents.credentials. Same
|
|
707
|
+
// delivery channel the regular runner:run path uses at
|
|
708
|
+
// line 384. Without this, Python tools that read
|
|
709
|
+
// os.environ.get("FRED_API_KEY") / "EDGAR_API_KEY" / etc.
|
|
710
|
+
// get None even when the user has the credential connected on
|
|
711
|
+
// the Connectors page. The Node tRPC server fetches the map
|
|
712
|
+
// via the same query agentStudio.credentials.getEnvMap uses
|
|
713
|
+
// and ships it inline on the crew dispatch payload.
|
|
714
|
+
...(cfg.credentials ?? {}),
|
|
673
715
|
};
|
|
674
716
|
const proc = spawn(envResult.pythonPath, ["-u", join(runDir, "main.py")], {
|
|
675
717
|
cwd: runDir,
|
package/dist/modelLoader.js
CHANGED
|
@@ -168,8 +168,17 @@ function _buildProfile(id, tier, paramsBillion, family, thinkingDefault, reason)
|
|
|
168
168
|
const recommendedMaxTokens = tier === "agentic-capable" ? 8192
|
|
169
169
|
: tier === "agentic-marginal" ? 4096
|
|
170
170
|
: 2048;
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
// Crew personas typically wield 8–15 scoped tools. A ReAct loop has
|
|
172
|
+
// to spend one iteration per tool call AND one final iteration on the
|
|
173
|
+
// text summary. 10 was the original ceiling for short pipelines; it
|
|
174
|
+
// leaves zero headroom for crew personas that loop on fred/edgar/
|
|
175
|
+
// funding probes before they can write the regime label, and the
|
|
176
|
+
// persona terminates mid-thinking with no text reply — the downstream
|
|
177
|
+
// persona then sees `Output from agent N:\n` followed by nothing.
|
|
178
|
+
// 25 gives a 27B model enough room to canvass its tool set AND wrap
|
|
179
|
+
// up; smaller capable models cap themselves naturally on context.
|
|
180
|
+
const recommendedMaxIters = tier === "agentic-capable" ? 25
|
|
181
|
+
: tier === "agentic-marginal" ? 8
|
|
173
182
|
: 3;
|
|
174
183
|
return {
|
|
175
184
|
schemaVersion: PROFILE_SCHEMA_VERSION,
|