refactor(agent): compose image tools in application runtimes (#6172)
* refactor(agent): move image configuration ownership into tools * refactor(agent): compose image tools in application runtimes
This commit is contained in:
1 parent
e148296d5c
commit
105b772203
22 files changed
+269
-236
No files matched your search
+9
-12
@@ -44,7 +44,13 @@ from nanobot.agent.turn_delivery import (
|
||||
)
|
||||
from nanobot.agent.turn_delivery import TurnRoute as TurnRoute
|
||||
from nanobot.agent.turn_hooks import AgentTurnHookSpec, build_agent_turn_hook
|
||||
from nanobot.bus.events import INBOUND_META_USER_SHELL, InboundMessage, OutboundMessage
|
||||
from nanobot.bus.events import (
|
||||
INBOUND_META_RUNTIME_CONTROL,
|
||||
INBOUND_META_USER_SHELL,
|
||||
RUNTIME_CONTROL_SESSION_DISCARD,
|
||||
InboundMessage,
|
||||
OutboundMessage,
|
||||
)
|
||||
from nanobot.bus.outbound_events import (
|
||||
StreamDeltaEvent,
|
||||
StreamedResponseEvent,
|
||||
@@ -110,7 +116,6 @@ if TYPE_CHECKING:
|
||||
from nanobot.config.schema import (
|
||||
ChannelsConfig,
|
||||
Config,
|
||||
ProviderConfig,
|
||||
ToolsConfig,
|
||||
)
|
||||
from nanobot.cron.service import CronService
|
||||
@@ -281,8 +286,6 @@ class AgentLoop:
|
||||
unified_session: bool = False,
|
||||
disabled_skills: list[str] | None = None,
|
||||
tools_config: ToolsConfig | None = None,
|
||||
image_generation_provider_config: ProviderConfig | None = None,
|
||||
image_generation_provider_configs: dict[str, ProviderConfig] | None = None,
|
||||
provider_snapshot_loader: Callable[..., ProviderSnapshot] | None = None,
|
||||
provider_signature: tuple[object, ...] | None = None,
|
||||
model_presets: dict[str, ModelPresetConfig] | None = None,
|
||||
@@ -351,12 +354,6 @@ class AgentLoop:
|
||||
self.tools_config = _tc
|
||||
self.web_config = _tc.web
|
||||
self.exec_config = _tc.exec
|
||||
self._image_generation_provider_configs = dict(image_generation_provider_configs or {})
|
||||
if (
|
||||
image_generation_provider_config is not None
|
||||
and "openrouter" not in self._image_generation_provider_configs
|
||||
):
|
||||
self._image_generation_provider_configs["openrouter"] = image_generation_provider_config
|
||||
self.cron_service = cron_service
|
||||
self.local_trigger_store = local_trigger_store
|
||||
self.restrict_to_workspace = restrict_to_workspace
|
||||
@@ -631,7 +628,6 @@ class AgentLoop:
|
||||
exec_session_manager=self._exec_session_manager,
|
||||
sessions=self.sessions,
|
||||
provider_snapshot_loader=provider_snapshot_loader,
|
||||
image_generation_provider_configs=self._image_generation_provider_configs,
|
||||
timezone=self.context.timezone or "UTC",
|
||||
workspace_sandbox=self.workspace_scopes.sandbox_status,
|
||||
runtime_control=runtime_control,
|
||||
@@ -1367,7 +1363,8 @@ class AgentLoop:
|
||||
|
||||
raw = command_text(msg)
|
||||
effective_key = self._effective_session_key(msg)
|
||||
if await agent_context.handle_runtime_control(self, msg, self.tools):
|
||||
if msg.metadata.get(INBOUND_META_RUNTIME_CONTROL) == RUNTIME_CONTROL_SESSION_DISCARD:
|
||||
await self.discard_session(msg.session_key)
|
||||
continue
|
||||
if (
|
||||
msg.require_existing_session
|
||||
|
||||
Reference in new issue
Block a user