chore: lint format
This commit is contained in:
@@ -84,7 +84,6 @@ _QUEEN_PLANNING_TOOLS = [
|
||||
"initialize_and_build_agent",
|
||||
# Load existing agent (after user confirms)
|
||||
"load_built_agent",
|
||||
|
||||
]
|
||||
|
||||
# Building phase: full coding + agent construction tools.
|
||||
@@ -93,7 +92,6 @@ _QUEEN_BUILDING_TOOLS = _SHARED_TOOLS + [
|
||||
"list_credentials",
|
||||
"replan_agent",
|
||||
"save_agent_draft", # Re-draft during building → auto-dissolves + updates flowchart
|
||||
|
||||
]
|
||||
|
||||
# Staging phase: agent loaded but not yet running — inspect, configure, launch.
|
||||
@@ -113,7 +111,6 @@ _QUEEN_STAGING_TOOLS = [
|
||||
"set_trigger",
|
||||
"remove_trigger",
|
||||
"list_triggers",
|
||||
|
||||
]
|
||||
|
||||
# Running phase: worker is executing — monitor, control, or switch to editing.
|
||||
@@ -137,7 +134,6 @@ _QUEEN_RUNNING_TOOLS = [
|
||||
"set_trigger",
|
||||
"remove_trigger",
|
||||
"list_triggers",
|
||||
|
||||
]
|
||||
|
||||
# Editing phase: worker done, still loaded — tweak config and re-run.
|
||||
@@ -160,7 +156,6 @@ _QUEEN_EDITING_TOOLS = [
|
||||
"set_trigger",
|
||||
"remove_trigger",
|
||||
"list_triggers",
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ MAX_FILE_SIZE_BYTES: int = 4096 # 4 KB hard limit per memory file
|
||||
|
||||
# How many lines of a memory file to read for header scanning.
|
||||
_HEADER_LINE_LIMIT: int = 30
|
||||
|
||||
|
||||
def global_memory_dir() -> Path:
|
||||
"""Return the queen-global memory directory."""
|
||||
return _HIVE_QUEEN_DIR / "global_memory"
|
||||
|
||||
@@ -85,7 +85,11 @@ async def select_memories(
|
||||
)
|
||||
raw = (resp.content or "").strip()
|
||||
if not raw:
|
||||
logger.warning("recall: LLM returned empty response (model=%s, stop=%s)", resp.model, resp.stop_reason)
|
||||
logger.warning(
|
||||
"recall: LLM returned empty response (model=%s, stop=%s)",
|
||||
resp.model,
|
||||
resp.stop_reason,
|
||||
)
|
||||
return []
|
||||
data = json.loads(raw)
|
||||
selected = data.get("selected_memories", [])
|
||||
|
||||
@@ -22,7 +22,6 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
@@ -250,17 +249,20 @@ async def _reflection_loop(
|
||||
args = json.loads(fn.arguments) if fn.arguments else {}
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
args = {}
|
||||
tool_calls_raw.append({
|
||||
"id": tc.id,
|
||||
"name": fn.name,
|
||||
"input": args,
|
||||
})
|
||||
tool_calls_raw.append(
|
||||
{
|
||||
"id": tc.id,
|
||||
"name": fn.name,
|
||||
"input": args,
|
||||
}
|
||||
)
|
||||
except (AttributeError, IndexError):
|
||||
pass
|
||||
|
||||
logger.info(
|
||||
"reflect: LLM responded, text=%d chars, tool_calls=%d",
|
||||
len(resp.content or ""), len(tool_calls_raw),
|
||||
len(resp.content or ""),
|
||||
len(tool_calls_raw),
|
||||
)
|
||||
|
||||
turn_text = resp.content or ""
|
||||
@@ -510,7 +512,6 @@ async def subscribe_reflection_triggers(
|
||||
logger.warning("reflect: reflection failed", exc_info=True)
|
||||
_write_error("short/long reflection")
|
||||
|
||||
|
||||
async def _do_compaction_reflect() -> None:
|
||||
async with _lock:
|
||||
try:
|
||||
@@ -548,7 +549,9 @@ async def subscribe_reflection_triggers(
|
||||
|
||||
logger.debug(
|
||||
"reflect: triggered (count=%d, interval=%s, stop_reason=%s)",
|
||||
_short_count, is_interval, stop_reason,
|
||||
_short_count,
|
||||
is_interval,
|
||||
stop_reason,
|
||||
)
|
||||
_fire_and_forget(_do_turn_reflect(is_interval, _short_count))
|
||||
|
||||
|
||||
@@ -292,9 +292,7 @@ async def create_queen(
|
||||
|
||||
mem_dir = phase_state.global_memory_dir
|
||||
selected = await select_memories(content, _session_llm, mem_dir)
|
||||
phase_state._cached_global_recall_block = format_recall_injection(
|
||||
selected, mem_dir
|
||||
)
|
||||
phase_state._cached_global_recall_block = format_recall_injection(selected, mem_dir)
|
||||
except Exception:
|
||||
logger.debug("recall: user-turn cache update failed", exc_info=True)
|
||||
|
||||
@@ -306,9 +304,7 @@ async def create_queen(
|
||||
|
||||
async def _persona_hook(ctx: HookContext) -> HookResult | None:
|
||||
trigger = ctx.trigger or ""
|
||||
result = await select_expert_persona(
|
||||
trigger, _session_llm, memory_context=""
|
||||
)
|
||||
result = await select_expert_persona(trigger, _session_llm, memory_context="")
|
||||
if not result:
|
||||
return None
|
||||
# Store on phase_state so persona/style persist across dynamic prompt refreshes
|
||||
@@ -333,9 +329,7 @@ async def create_queen(
|
||||
|
||||
mem_dir = phase_state.global_memory_dir
|
||||
selected = await select_memories(trigger, _session_llm, mem_dir)
|
||||
phase_state._cached_global_recall_block = format_recall_injection(
|
||||
selected, mem_dir
|
||||
)
|
||||
phase_state._cached_global_recall_block = format_recall_injection(selected, mem_dir)
|
||||
except Exception:
|
||||
logger.debug("recall: initial seeding failed", exc_info=True)
|
||||
|
||||
|
||||
@@ -649,7 +649,9 @@ class SessionManager:
|
||||
task.add_done_callback(self._background_tasks.discard)
|
||||
logger.info("Session '%s': shutdown reflection spawned", session_id)
|
||||
except Exception:
|
||||
logger.warning("Session '%s': failed to spawn shutdown reflection", session_id, exc_info=True)
|
||||
logger.warning(
|
||||
"Session '%s': failed to spawn shutdown reflection", session_id, exc_info=True
|
||||
)
|
||||
|
||||
if session.queen_task is not None:
|
||||
session.queen_task.cancel()
|
||||
|
||||
@@ -185,9 +185,7 @@ async def test_select_memories_empty_dir(tmp_path: Path):
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_select_memories_with_files(tmp_path: Path):
|
||||
(tmp_path / "a.md").write_text(
|
||||
"---\nname: a\ndescription: about A\ntype: profile\n---\nbody"
|
||||
)
|
||||
(tmp_path / "a.md").write_text("---\nname: a\ndescription: about A\ntype: profile\n---\nbody")
|
||||
(tmp_path / "b.md").write_text(
|
||||
"---\nname: b\ndescription: about B\ntype: preference\n---\nbody"
|
||||
)
|
||||
|
||||
@@ -196,5 +196,4 @@ async def test_load_worker_core_keeps_explicit_worker_model_override(monkeypatch
|
||||
assert session.runner is runner
|
||||
assert session.runner._llm is None
|
||||
|
||||
|
||||
assert session.worker_path == tmp_path / "worker_agent"
|
||||
|
||||
Reference in New Issue
Block a user