@melaya/runner 1.0.89 → 1.0.91

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.
@@ -248,7 +248,11 @@ def _build_agent():
248
248
  api_key="", # model.py resolves the provider's own creds (OAuth off disk / localhost)
249
249
  # Phone tasks are many-step (each comment ≈ screen_tree→tap→type→post), so
250
250
  # give them room like the device template (40); read-only Q&A needs few.
251
- max_iters=40 if phone_enabled else 8,
251
+ # Connector WRITE tasks are equally many-step (e.g. "message all my recent
252
+ # LinkedIn connections" = 1 list + N sends, each its own reasoning+HITL
253
+ # round), so they need the same headroom — 8 hit the cap mid-task and
254
+ # forced _summarizing() on a half-finished tool batch.
255
+ max_iters=40 if (phone_enabled or connector_services) else 8,
252
256
  reliability=True,
253
257
  bounded_memory=True,
254
258
  )
@@ -288,12 +292,19 @@ def _register_stream_hooks(agent) -> None:
288
292
  except Exception:
289
293
  return
290
294
 
291
- def _pre_print_hook(_agent, **kwargs) -> None:
295
+ # agentscope hook calling convention (see agent/_agent_meta.py):
296
+ # pre-hook(self, normalized_kwargs_dict)
297
+ # post-hook(self, normalized_kwargs_dict, output)
298
+ # normalized_kwargs_dict is dict(bound.arguments) keyed by the wrapped
299
+ # method's PARAMETER NAMES. So print(self, msg, last) → {"msg":…, "last":…}
300
+ # and _acting(self, tool_call) → {"tool_call":…} (SINGULAR). `*_rest` absorbs
301
+ # the post-hook's trailing `output` arg so ONE shape works for both.
302
+ def _pre_print_hook(_self, kw, *_rest) -> None:
292
303
  try:
293
304
  tid = _stream.get("turnId")
294
- if not tid:
305
+ if not tid or not isinstance(kw, dict):
295
306
  return
296
- msg = kwargs.get("msg") or kwargs.get("message")
307
+ msg = kw.get("msg") or kw.get("message")
297
308
  if msg is None:
298
309
  return
299
310
  mid = str(getattr(msg, "id", "") or id(msg))
@@ -307,12 +318,16 @@ def _register_stream_hooks(agent) -> None:
307
318
  except Exception:
308
319
  pass
309
320
 
310
- def _post_acting_hook(_agent, **kwargs) -> None:
321
+ def _post_acting_hook(_self, kw, *_rest) -> None:
311
322
  try:
312
323
  tid = _stream.get("turnId")
313
- if not tid:
324
+ if not tid or not isinstance(kw, dict):
314
325
  return
315
- for tc in (kwargs.get("tool_calls") or []):
326
+ tcs = kw.get("tool_calls")
327
+ if tcs is None:
328
+ tc = kw.get("tool_call") # this agentscope: one tool_call per _acting
329
+ tcs = [tc] if tc is not None else []
330
+ for tc in tcs:
316
331
  name = tc.get("name", "") if isinstance(tc, dict) else getattr(tc, "name", "")
317
332
  if name:
318
333
  _emit(tid, "tool", name=str(name))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,