@melaya/runner 1.0.58 → 1.0.61

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.
@@ -496,6 +496,13 @@ export async function connect(opts) {
496
496
  // to whatever it first downloaded, so every server-side persona
497
497
  // fix sits unused. Updated servers always pass this.
498
498
  const sharedVersion = String(payload.shared_version ?? "latest");
499
+ // Pipeline name + project mirror what the Node server's POST
500
+ // /pipelines call just created — required so the Monitoring page
501
+ // can tie the live run to its tile (registerRun + every event we
502
+ // emit during this run). Falls back to the synthesised crew-<sid>
503
+ // slug only for the legacy spawn path that didn't ship these.
504
+ const project = String(cfg.project_name ?? "") || `crew-${sid.slice(-12)}`;
505
+ const pipelineName = String(cfg.pipeline_name ?? "") || project;
499
506
  console.log(chalk.hex("#10b981")(`\n ▶ Trading crew: ${sid.slice(0, 16)}… (run ${runId.slice(0, 10)}…)`));
500
507
  try {
501
508
  const mainPyContent = String(cfg.generated_code ?? "").trim();
@@ -536,7 +543,7 @@ export async function connect(opts) {
536
543
  socket.emit("runner:event", {
537
544
  run_id: runId,
538
545
  event_type: "pipeline_phase",
539
- project: `crew-${sid.slice(-12)}`,
546
+ project,
540
547
  step: 1,
541
548
  total: 5,
542
549
  label: `venv: ${msg}`,
@@ -548,7 +555,7 @@ export async function connect(opts) {
548
555
  socket.emit("runner:event", {
549
556
  run_id: runId,
550
557
  event_type: "agent_message",
551
- project: `crew-${sid.slice(-12)}`,
558
+ project,
552
559
  replyId: `venv-${runId}`,
553
560
  replyName: "Runner",
554
561
  replyRole: "system",
@@ -564,14 +571,14 @@ export async function connect(opts) {
564
571
  socket.emit("runner:runComplete", { runId, status: "failed" });
565
572
  return;
566
573
  }
567
- // Register run + set relay project so agent_message → relay →
568
- // server FE join-by-runId works the same as for a pipeline.
569
- const project = `crew-${sid.slice(-12)}`;
574
+ // Register run + set relay project (project + pipelineName
575
+ // hoisted to the top of the handler so the early-exit failure
576
+ // emits above use the SAME values).
570
577
  setActiveProject(project);
571
578
  socket.emit("runner:registerRun", {
572
579
  runId,
573
580
  project,
574
- pipelineName: project,
581
+ pipelineName,
575
582
  });
576
583
  // Write main.py + config.json to a per-run scratch dir.
577
584
  const runDir = join(tmpdir(), `melaya-crew-${runId}`);
@@ -703,6 +710,15 @@ export async function connect(opts) {
703
710
  MEL_MODEL_DISABLE_THINKING: preflight.profile.thinkingDefault === "off" ? "1" : "0",
704
711
  }
705
712
  : {}),
713
+ // Per-pipeline credentials from agents.credentials. Same
714
+ // delivery channel the regular runner:run path uses at
715
+ // line 384. Without this, Python tools that read
716
+ // os.environ.get("FRED_API_KEY") / "EDGAR_API_KEY" / etc.
717
+ // get None even when the user has the credential connected on
718
+ // the Connectors page. The Node tRPC server fetches the map
719
+ // via the same query agentStudio.credentials.getEnvMap uses
720
+ // and ships it inline on the crew dispatch payload.
721
+ ...(cfg.credentials ?? {}),
706
722
  };
707
723
  const proc = spawn(envResult.pythonPath, ["-u", join(runDir, "main.py")], {
708
724
  cwd: runDir,
@@ -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
- const recommendedMaxIters = tier === "agentic-capable" ? 10
172
- : tier === "agentic-marginal" ? 5
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.0.58",
3
+ "version": "1.0.61",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,