diff --git a/backend/apps/agents/browser/browser_skills.py b/backend/apps/agents/browser/browser_skills.py index c7aff3ef..393d426d 100644 --- a/backend/apps/agents/browser/browser_skills.py +++ b/backend/apps/agents/browser/browser_skills.py @@ -60,7 +60,7 @@ def p_event(kind: str, host: str, sig: str, rev: int = 0, state: str = "", **ext prove the skill layer helps vs. silently thrashes. Lazy + best-effort: this module never hard-depends on metrics, and a metrics failure never propagates.""" try: - from . import browser_metrics + from backend.apps.agents.browser import browser_metrics browser_metrics.record_skill_event(kind, host, sig, rev=rev, state=state, extra=extra or None) except Exception: pass diff --git a/backend/apps/agents/providers/registry.py b/backend/apps/agents/providers/registry.py index df08d293..d5cdb2b9 100644 --- a/backend/apps/agents/providers/registry.py +++ b/backend/apps/agents/providers/registry.py @@ -2,7 +2,7 @@ The model-resolution gate: always go through here, never hardcode a model id. Pricing/tier scoring lives in pricing.py, OpenRouter plumbing in openrouter.py, -thinking-level translation in thinking.py; all re-exported below so external +thinking-level translation in thinking_params_for.py; all re-exported below so external importers keep their single entry point. """ @@ -11,19 +11,19 @@ from __future__ import annotations import logging from typing import Any, TYPE_CHECKING -from .openrouter import ( +from backend.apps.agents.providers.openrouter import ( OPENROUTER_VALUE_PREFIX, fetch_openrouter_models, get_direct_pricing, get_openrouter_pricing, invalidate_openrouter_cache, ) -from .pricing import ( +from backend.apps.agents.providers.pricing import ( compute_billing_kind, compute_tiers, heuristic_tiers, ) -from .thinking_params_for import thinking_params_for +from backend.apps.agents.providers.thinking_params_for import thinking_params_for if TYPE_CHECKING: from backend.apps.settings.models import AppSettings diff --git a/backend/apps/nine_router/__init__.py b/backend/apps/nine_router/__init__.py index 6e27ee33..dfc71195 100644 --- a/backend/apps/nine_router/__init__.py +++ b/backend/apps/nine_router/__init__.py @@ -18,7 +18,7 @@ the re-exports below. import httpx # noqa: F401 patch point: tests stub backend.apps.nine_router.httpx.AsyncClient -from .process import ( +from backend.apps.nine_router.process import ( NINE_ROUTER_API, NINE_ROUTER_NPM_VERSION, NINE_ROUTER_PORT, @@ -33,7 +33,7 @@ from .process import ( is_running, stop, ) -from .sync import ( +from backend.apps.nine_router.sync import ( NINE_ROUTER_CLAUDE_PRO_NAME, NINE_ROUTER_KEYED_NAME, NINE_ROUTER_OPENAI_KEYED_NAME, @@ -43,14 +43,14 @@ from .sync import ( sync_openai_api_key, sync_openrouter_api_key, ) -from .sync_custom import ( +from backend.apps.nine_router.sync_custom import ( NINE_ROUTER_CUSTOM_NAME_SUFFIX, normalize_openai_compat_base_url, sync_custom_providers, sync_openswarm_pro_as_claude, sync_pro_routing, ) -from .oauth import ( +from backend.apps.nine_router.oauth import ( exchange_oauth, get_models, poll_oauth, diff --git a/backend/apps/nine_router/oauth.py b/backend/apps/nine_router/oauth.py index 7a9f914e..cc0e7695 100644 --- a/backend/apps/nine_router/oauth.py +++ b/backend/apps/nine_router/oauth.py @@ -10,7 +10,7 @@ import os import httpx -from .process import NINE_ROUTER_API, NINE_ROUTER_PORT, NINE_ROUTER_V1, cli_auth_headers +from backend.apps.nine_router.process import NINE_ROUTER_API, NINE_ROUTER_PORT, NINE_ROUTER_V1, cli_auth_headers from backend.apps.oauth_state import pending_oauth, mark_oauth_completed logger = logging.getLogger(__name__) diff --git a/backend/apps/nine_router/sync.py b/backend/apps/nine_router/sync.py index a38d829e..7c3ca358 100644 --- a/backend/apps/nine_router/sync.py +++ b/backend/apps/nine_router/sync.py @@ -7,7 +7,7 @@ as OpenSwarm-managed apikey connections. Talks to the already-running import logging -from .process import NINE_ROUTER_API, cli_auth_headers +from backend.apps.nine_router.process import NINE_ROUTER_API, cli_auth_headers logger = logging.getLogger(__name__) @@ -128,7 +128,7 @@ async def sync_openai_api_key(api_key: str | None) -> None: above) so 9Router's translator dispatches to this provider-node instead of the built-in `openai` provider. """ - from .sync_custom import sync_openai_compat_node + from backend.apps.nine_router.sync_custom import sync_openai_compat_node await sync_openai_compat_node(api_key) diff --git a/backend/apps/nine_router/sync_custom.py b/backend/apps/nine_router/sync_custom.py index e82de143..22a8146b 100644 --- a/backend/apps/nine_router/sync_custom.py +++ b/backend/apps/nine_router/sync_custom.py @@ -10,8 +10,8 @@ spawns the subprocess (that's process.py's job). import logging -from .process import NINE_ROUTER_API, cli_auth_headers -from .sync import ( +from backend.apps.nine_router.process import NINE_ROUTER_API, cli_auth_headers +from backend.apps.nine_router.sync import ( NINE_ROUTER_CLAUDE_PRO_NAME, NINE_ROUTER_OPENAI_KEYED_PREFIX, find_keyed_connection, diff --git a/backend/apps/outputs/runtime.py b/backend/apps/outputs/runtime.py index ff99287a..b26eb51b 100644 --- a/backend/apps/outputs/runtime.py +++ b/backend/apps/outputs/runtime.py @@ -25,7 +25,7 @@ def p_resolve_bash() -> str: return candidate return "bash" -from .runtime_proc import ( +from backend.apps.outputs.runtime_proc import ( ERROR_PATTERNS, FRONTEND_BIND_POLL_INTERVAL, FRONTEND_BIND_TIMEOUT_SECONDS, diff --git a/backend/apps/swarm/closure.py b/backend/apps/swarm/closure.py index a3691bd3..61a18f4d 100644 --- a/backend/apps/swarm/closure.py +++ b/backend/apps/swarm/closure.py @@ -13,8 +13,8 @@ import zipfile from datetime import datetime, timezone from uuid import uuid4 -from .exportable import RemapTable -from .models import ( +from backend.apps.swarm.exportable import RemapTable +from backend.apps.swarm.models import ( FORMAT_VERSION, BundlePreview, BundleSummary, @@ -26,9 +26,9 @@ from .models import ( Requirement, RequirementView, ) -from .redact import scrub_payload -from .registry import IMPORT_ORDER, get_exportable -from .ziputil import MANIFEST_NAME, BundleError, has_member, is_zip, pack, read_manifest, unpack, verify_checksum +from backend.apps.swarm.redact import scrub_payload +from backend.apps.swarm.registry import IMPORT_ORDER, get_exportable +from backend.apps.swarm.ziputil import MANIFEST_NAME, BundleError, has_member, is_zip, pack, read_manifest, unpack, verify_checksum def p_now() -> str: @@ -315,8 +315,8 @@ def p_read_files(sandbox: str, ref: EntityRef) -> dict[str, bytes]: def review_bundle(sandbox: str, manifest: Manifest): """Safety read of any app code in the staged bundle. Returns None when the bundle contains no apps (nothing to review).""" - from .models import ReviewSummary - from .scan_app_files import scan_app_files + from backend.apps.swarm.models import ReviewSummary + from backend.apps.swarm.scan_app_files import scan_app_files findings: list[str] = [] scanned: list[str] = [] diff --git a/backend/apps/swarm/entities/SessionExportable.py b/backend/apps/swarm/entities/SessionExportable.py index 1f7f8589..bdc7fa39 100644 --- a/backend/apps/swarm/entities/SessionExportable.py +++ b/backend/apps/swarm/entities/SessionExportable.py @@ -12,8 +12,8 @@ from __future__ import annotations from datetime import datetime, timezone from uuid import uuid4 -from ..exportable import DepRef, ExportContext, RemapTable -from ..models import EntityType, Requirement, RequirementKind +from backend.apps.swarm.exportable import DepRef, ExportContext, RemapTable +from backend.apps.swarm.models import EntityType, Requirement, RequirementKind P_BUILTIN_MODES = {"agent", "ask", "plan", "view-builder", "skill-builder"} # Transcript fields ride along so the shared agent keeps its history; ids inside diff --git a/backend/apps/swarm/entities/apps.py b/backend/apps/swarm/entities/apps.py index defa825c..21c09357 100644 --- a/backend/apps/swarm/entities/apps.py +++ b/backend/apps/swarm/entities/apps.py @@ -15,8 +15,8 @@ from backend.apps.outputs.models import Output from backend.apps.outputs.workspace_io import WALK_SKIP_DIRS, save, load_output from backend.config.paths import OUTPUTS_DIR, OUTPUTS_WORKSPACE_DIR -from ..exportable import DepRef, ExportContext, RemapTable -from ..models import EntityType, Requirement +from backend.apps.swarm.exportable import DepRef, ExportContext, RemapTable +from backend.apps.swarm.models import EntityType, Requirement P_MAX_APP_FILE = 25 * 1024 * 1024 # matches ziputil per-entry cap diff --git a/backend/apps/swarm/entities/dashboards.py b/backend/apps/swarm/entities/dashboards.py index 29357759..b9ef16b0 100644 --- a/backend/apps/swarm/entities/dashboards.py +++ b/backend/apps/swarm/entities/dashboards.py @@ -9,8 +9,8 @@ from __future__ import annotations from datetime import datetime, timezone from uuid import uuid4 -from ..exportable import DepRef, ExportContext, RemapTable -from ..models import EntityType, Requirement +from backend.apps.swarm.exportable import DepRef, ExportContext, RemapTable +from backend.apps.swarm.models import EntityType, Requirement class DashboardExportable: diff --git a/backend/apps/swarm/entities/modes.py b/backend/apps/swarm/entities/modes.py index da62a400..2213f2f2 100644 --- a/backend/apps/swarm/entities/modes.py +++ b/backend/apps/swarm/entities/modes.py @@ -6,8 +6,8 @@ reuses an existing same-slug mode rather than clobbering it (keeps the session's `mode` pointer valid without rewriting it).""" from __future__ import annotations -from ..exportable import DepRef, ExportContext, RemapTable -from ..models import EntityType, Requirement +from backend.apps.swarm.exportable import DepRef, ExportContext, RemapTable +from backend.apps.swarm.models import EntityType, Requirement # Machine-relative or install-owned fields that must not ride along. P_DROP = {"is_builtin", "default_folder"} @@ -49,7 +49,7 @@ class ModeExportable: store = p_store() model = p_model() if store is None or model is None: - from ..ziputil import BundleError + from backend.apps.swarm.ziputil import BundleError raise BundleError("can't import this mode on this build") mid = payload.get("id") or (payload.get("name") or "mode").lower().replace(" ", "-") # Reuse a same-slug mode (incl. built-ins) instead of overwriting it; diff --git a/backend/apps/swarm/entities/skills.py b/backend/apps/swarm/entities/skills.py index fe0f33e0..4c56cb73 100644 --- a/backend/apps/swarm/entities/skills.py +++ b/backend/apps/swarm/entities/skills.py @@ -10,8 +10,8 @@ import os import shutil from backend.apps.skills import skills as store -from ..exportable import DepRef, ExportContext, RemapTable -from ..models import EntityType, Requirement +from backend.apps.swarm.exportable import DepRef, ExportContext, RemapTable +from backend.apps.swarm.models import EntityType, Requirement class SkillExportable: diff --git a/backend/apps/swarm/entities/workflows.py b/backend/apps/swarm/entities/workflows.py index 33b2466d..42a8e92e 100644 --- a/backend/apps/swarm/entities/workflows.py +++ b/backend/apps/swarm/entities/workflows.py @@ -10,8 +10,8 @@ sharer's phone numbers (text/call escalation) are stripped as PII, and run history / session + dashboard linkage are dropped.""" from __future__ import annotations -from ..exportable import DepRef, ExportContext, RemapTable -from ..models import EntityType, Requirement, RequirementKind +from backend.apps.swarm.exportable import DepRef, ExportContext, RemapTable +from backend.apps.swarm.models import EntityType, Requirement, RequirementKind P_BUILTIN_MODES = {"agent", "ask", "plan", "view-builder", "skill-builder"} @@ -95,7 +95,7 @@ class WorkflowExportable: store = p_store() model = p_model() if store is None or model is None: - from ..ziputil import BundleError + from backend.apps.swarm.ziputil import BundleError raise BundleError("this build doesn't support workflows yet; please update OpenSwarm") clean = sanitize_workflow(payload) clean.pop("id", None) # fresh id via the model's default_factory diff --git a/backend/apps/swarm/exportable.py b/backend/apps/swarm/exportable.py index 383a0f55..21e4f7fe 100644 --- a/backend/apps/swarm/exportable.py +++ b/backend/apps/swarm/exportable.py @@ -7,7 +7,7 @@ from __future__ import annotations from dataclasses import dataclass from typing import ClassVar, Protocol, runtime_checkable -from .models import EntityType, Requirement +from backend.apps.swarm.models import EntityType, Requirement @dataclass diff --git a/backend/apps/swarm/registry.py b/backend/apps/swarm/registry.py index e4ccb566..b7453fbb 100644 --- a/backend/apps/swarm/registry.py +++ b/backend/apps/swarm/registry.py @@ -1,12 +1,12 @@ """Maps an EntityType to the Exportable that handles it, and the leaves-first order import walks. Adding a shareable type is one entry here plus its module.""" -from .entities.apps import AppExportable -from .entities.dashboards import DashboardExportable -from .entities.modes import ModeExportable -from .entities.SessionExportable import SessionExportable -from .entities.skills import SkillExportable -from .entities.workflows import WorkflowExportable -from .models import EntityType +from backend.apps.swarm.entities.apps import AppExportable +from backend.apps.swarm.entities.dashboards import DashboardExportable +from backend.apps.swarm.entities.modes import ModeExportable +from backend.apps.swarm.entities.SessionExportable import SessionExportable +from backend.apps.swarm.entities.skills import SkillExportable +from backend.apps.swarm.entities.workflows import WorkflowExportable +from backend.apps.swarm.models import EntityType REGISTRY: dict[EntityType, type] = { EntityType.skill: SkillExportable, diff --git a/backend/apps/swarm/scan_app_files.py b/backend/apps/swarm/scan_app_files.py index b94a6e99..98313fea 100644 --- a/backend/apps/swarm/scan_app_files.py +++ b/backend/apps/swarm/scan_app_files.py @@ -8,7 +8,7 @@ from __future__ import annotations from backend.apps.outputs.executor import get_code_warnings -from .models import ReviewSummary +from backend.apps.swarm.models import ReviewSummary def scan_app_files(files: dict[str, bytes]) -> ReviewSummary: diff --git a/backend/apps/swarm/swarm.py b/backend/apps/swarm/swarm.py index 6e021ee2..57c3a66f 100644 --- a/backend/apps/swarm/swarm.py +++ b/backend/apps/swarm/swarm.py @@ -12,8 +12,8 @@ from fastapi import File, HTTPException, Response, UploadFile from backend.config.Apps import SubApp -from . import closure -from .models import ( +from backend.apps.swarm import closure +from backend.apps.swarm.models import ( ExportPreflightResponse, ExportRequest, ImportCommitRequest, @@ -21,7 +21,7 @@ from .models import ( ImportPreflightResponse, RequirementView, ) -from .ziputil import MAX_TOTAL_BYTES, BundleError +from backend.apps.swarm.ziputil import MAX_TOTAL_BYTES, BundleError logger = logging.getLogger(__name__) diff --git a/backend/apps/swarm/ziputil.py b/backend/apps/swarm/ziputil.py index b16a2f12..4e1e3ceb 100644 --- a/backend/apps/swarm/ziputil.py +++ b/backend/apps/swarm/ziputil.py @@ -12,7 +12,7 @@ import shutil import tempfile import zipfile -from .redact import find_denied_keys, find_secrets_in_files +from backend.apps.swarm.redact import find_denied_keys, find_secrets_in_files MANIFEST_NAME = "manifest.json"