@melaya/runner 1.0.101 → 1.0.103

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.
@@ -271,28 +271,29 @@ def _build_agent():
271
271
  # then ALWAYS require the in-chat approval card (fail-safe).
272
272
  if connector_services and not os.environ.get("MEL_ASSISTANT_CONNECTOR_HITL"):
273
273
  os.environ["MEL_ASSISTANT_CONNECTOR_HITL"] = "1"
274
+ # Core primitives (melaya_core): web_search / web_fetch, files, HTTP, data +
275
+ # office utilities, scraping, encoding, SQL, etc. — are ALWAYS discoverable via
276
+ # search_tools/activate_tool. The side-effecting ones run on the USER's OWN
277
+ # machine (this runner) and are HITL-gated by the assistant's safe/payments
278
+ # modes, so exposing them for discovery is safe. They stay in the LAZY pool
279
+ # (not pinned) so the ~73-tool category never explodes the active budget.
280
+ core_categories = ["melaya_core"]
274
281
  try:
275
- if connector_services:
276
- from shared.orchestration.lazy_registry import build_lazy_toolkit
277
- # Phone tools must ALWAYS be fully passed, never scoped: a phone task
278
- # can't afford search_tools/activate_tool round-trips per tap (that is
279
- # the "why did it restrict the tools + it's slow" regression). The lazy
280
- # toolkit pins active_categories only UP TO `budget` (default 25), so
281
- # phone (~23) + melaya_agent got bumped into the deferred pool. When
282
- # phone is enabled, widen the budget so the WHOLE phone + base set stays
283
- # active/pinned; the connectors still lazy-defer beyond that.
284
- _budget = int(os.environ.get("MEL_LAZY_BUDGET", "25"))
285
- if phone_enabled:
286
- _budget = max(_budget, 64)
287
- toolkit = build_lazy_toolkit(
288
- active_categories=categories,
289
- include_categories=categories + connector_services,
290
- budget=_budget,
291
- )
292
- else:
293
- toolkit = build_toolkit(categories=categories)
282
+ from shared.orchestration.lazy_registry import build_lazy_toolkit
283
+ # Base tools (melaya_agent + phone) stay active+pinned; core + any selected
284
+ # connectors are deferred + discoverable. Phone tasks need the WHOLE phone
285
+ # set pinned (no per-tap search_tools round-trips the old "slow" regression),
286
+ # so widen the budget when phone is enabled; core/connectors still lazy-defer.
287
+ _budget = int(os.environ.get("MEL_LAZY_BUDGET", "25"))
288
+ if phone_enabled:
289
+ _budget = max(_budget, 64)
290
+ toolkit = build_lazy_toolkit(
291
+ active_categories=categories,
292
+ include_categories=categories + core_categories + connector_services,
293
+ budget=_budget,
294
+ )
294
295
  except Exception as exc:
295
- _log(f"toolkit build failed (connectors={connector_services}): {exc}; retrying melaya_agent only")
296
+ _log(f"toolkit build failed (connectors={connector_services}, core): {exc}; retrying melaya_agent only")
296
297
  try:
297
298
  toolkit = build_toolkit(categories=["melaya_agent"])
298
299
  except Exception:
@@ -1034,7 +1034,12 @@ export async function connect(opts) {
1034
1034
  }
1035
1035
  });
1036
1036
  proc.on("exit", (code) => {
1037
- activeAssistants.delete(sid);
1037
+ // Only evict if WE are still the registered host. A config-drift reboot
1038
+ // (e.g. the user added a connector) kills this host and spawns a REPLACEMENT
1039
+ // under the same sid; if this late exit deleted the map entry blindly it
1040
+ // would orphan the newcomer and make the next turn "session_not_found".
1041
+ if (activeAssistants.get(sid) === session)
1042
+ activeAssistants.delete(sid);
1038
1043
  const detail = code !== 0 && stderrTail.length ? stderrTail.slice(-12).join("\n") : "";
1039
1044
  socket.emit("runner:assistant_event", { sessionId: sid, turnId: "", kind: "session_closed", code, detail });
1040
1045
  console.log(chalk.gray(` ■ Assistant session ${sid.slice(0, 10)}… closed (exit ${code})`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.0.101",
3
+ "version": "1.0.103",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,