@melaya/runner 1.0.104 → 1.0.105
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/assistantHost.py +32 -7
- package/package.json +1 -1
package/dist/assistantHost.py
CHANGED
|
@@ -271,13 +271,25 @@ 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
|
|
275
|
-
#
|
|
276
|
-
#
|
|
277
|
-
#
|
|
278
|
-
#
|
|
279
|
-
#
|
|
280
|
-
|
|
274
|
+
# Core primitives: web_search / web_fetch, files, HTTP, data + office utilities,
|
|
275
|
+
# scraping, encoding, SQL, etc. — ALWAYS discoverable via search_tools/
|
|
276
|
+
# activate_tool. The side-effecting ones run on the USER's OWN machine (this
|
|
277
|
+
# runner) and are HITL-gated by the assistant's safe/payments modes, so exposing
|
|
278
|
+
# them for discovery is safe. They stay in the LAZY pool (not pinned) so the
|
|
279
|
+
# ~73-tool family never explodes the active budget.
|
|
280
|
+
#
|
|
281
|
+
# IMPORTANT: `melaya_core` is a CLIENT-SIDE DISPLAY bucket (toolServiceMap.ts),
|
|
282
|
+
# NOT a runtime registry category — the primitives actually live under `tools`,
|
|
283
|
+
# `scraping`, `msoffice`, `database`, … So we include the AUTHORITATIVE runtime
|
|
284
|
+
# category list (CORE_TOOL_CATEGORIES). Passing "melaya_core" matched NOTHING,
|
|
285
|
+
# which is why web_search/web_fetch never appeared in search_tools.
|
|
286
|
+
try:
|
|
287
|
+
from shared.runtime.registry import CORE_TOOL_CATEGORIES as core_categories
|
|
288
|
+
except Exception:
|
|
289
|
+
# Fallback if an older shared bundle predates the constant — hardcode the set.
|
|
290
|
+
core_categories = ["tools", "scraping", "data_utils", "msoffice", "aiml",
|
|
291
|
+
"media", "knowledge", "netutil_tools", "qr_tools",
|
|
292
|
+
"ics_tools"] # excluded (need a connector): video_pipeline, database, devops
|
|
281
293
|
try:
|
|
282
294
|
from shared.orchestration.lazy_registry import build_lazy_toolkit
|
|
283
295
|
# Base tools (melaya_agent + phone) stay active+pinned; core + any selected
|
|
@@ -339,6 +351,18 @@ def _build_agent():
|
|
|
339
351
|
"data — read it from the connector.\n"
|
|
340
352
|
if connector_services else ""
|
|
341
353
|
)
|
|
354
|
+
# Core primitives are ALWAYS in the lazy pool now, so the model must be told
|
|
355
|
+
# they exist (they are not pinned/loaded upfront) — otherwise it concludes "no
|
|
356
|
+
# web-search tool is available" and refuses, exactly the reported failure.
|
|
357
|
+
core_rule = (
|
|
358
|
+
"- You have built-in CORE tools that are NOT loaded upfront: web_search "
|
|
359
|
+
"(live web search) and web_fetch (fetch a URL's content), plus file read/"
|
|
360
|
+
"write, HTTP requests, scraping, data/CSV/Excel utilities, SQL, QR and media. "
|
|
361
|
+
"To use any of them, call search_tools(query=...) (e.g. search_tools(\"web "
|
|
362
|
+
"search\")), then activate_tool(name=\"web_search\"), then call it. Whenever a "
|
|
363
|
+
"question needs live/current web data or a page's contents, use web_search / "
|
|
364
|
+
"web_fetch — do NOT claim you lack a web tool.\n"
|
|
365
|
+
)
|
|
342
366
|
sys_prompt = (
|
|
343
367
|
"You are the Melaya Assistant, the in-app copilot of the Melaya "
|
|
344
368
|
"agent-orchestration platform. You have READ-ONLY tools over the data "
|
|
@@ -351,6 +375,7 @@ def _build_agent():
|
|
|
351
375
|
"supports dimension='pipeline' to find which pipeline cost the most.\n"
|
|
352
376
|
+ phone_rule
|
|
353
377
|
+ connector_rule
|
|
378
|
+
+ core_rule
|
|
354
379
|
+ "- Be concise and concrete; format small tables or bullet lists when comparing items.\n"
|
|
355
380
|
"- If a question is outside the platform, answer normally without tools.\n"
|
|
356
381
|
+ (f"- Answer in the user's language: {language}.\n" if language and language != "en" else "")
|