refactor: root-package imports (svc/runtime/interfaces) and fix PYTHONPATH

- Rename platform/ to svc/ to avoid shadowing stdlib platform.
- Replace from oclaw.* with from svc/runtime/interfaces; update -m CLI paths.
- tests/conftest: prepend repo root to sys.path (no parent-folder package name).
- CI: paths and offline_eval script under repo root.
- Ops scripts: PYTHONPATH must be repo root for python -m runtime.* (fixes gateway/WhatsApp sidecar startup).
- Fix default oclaw.json path in tabular/file attachment limits; stabilize attachment test config.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-13 14:51:17 +08:00
parent 7941b27f58
commit 420abac9f1
405 changed files with 1316 additions and 1345 deletions

View file

@ -15,26 +15,26 @@ from pathlib import Path
from fastapi import APIRouter, Body, File, Header, HTTPException, Query, UploadFile
from fastapi.responses import Response, StreamingResponse
from oclaw.runtime.operations.mcp_env import apply_gateway_mcp_env_to_os
from oclaw.runtime.agents.specialists import specialist_ids
from oclaw.runtime.agents.factory import build_gateway_executor
from oclaw.runtime.chat.agent import GenerationInterrupted
from oclaw.platform.config.paths import db_path
from oclaw.platform.files.attachment_assets import AttachmentAssetStore
from oclaw.platform.files.file_attachments import (
from runtime.operations.mcp_env import apply_gateway_mcp_env_to_os
from runtime.agents.specialists import specialist_ids
from runtime.agents.factory import build_gateway_executor
from runtime.chat.agent import GenerationInterrupted
from svc.config.paths import db_path
from svc.files.attachment_assets import AttachmentAssetStore
from svc.files.file_attachments import (
DEFAULT_TABULAR_CELL_CHARS,
DEFAULT_TABULAR_COLUMNS,
DEFAULT_MAX_EXCEL_SHEETS,
DEFAULT_TABULAR_ROWS_READ,
clear_attachment_limits_cache,
)
from oclaw.interfaces.ws.common import normalize_ws_attachments
from oclaw.platform.files.session_export import export_session_json, export_session_markdown
from oclaw.platform.persistence.sqlite_store import SqliteStore
from oclaw.runtime.gateway import OclawGateway
from oclaw.runtime.plan_agent_v2.switch import v2_feature_enabled
from oclaw.runtime.types import StandardMessage, normalize_interaction_mode, normalize_requested_specialist
from oclaw.runtime.chat.history_tool_result_compact import compact_tool_results_in_session_history
from interfaces.ws.common import normalize_ws_attachments
from svc.files.session_export import export_session_json, export_session_markdown
from svc.persistence.sqlite_store import SqliteStore
from runtime.gateway import OclawGateway
from runtime.plan_agent_v2.switch import v2_feature_enabled
from runtime.types import StandardMessage, normalize_interaction_mode, normalize_requested_specialist
from runtime.chat.history_tool_result_compact import compact_tool_results_in_session_history
def _oclaw_config_path() -> Path:

View file

@ -3,8 +3,8 @@ from __future__ import annotations
from typing import Any
from oclaw.runtime.tools.base import ToolRegistry, ToolSpec
from oclaw.runtime.tools.tool_validation import validate_tool_arguments
from runtime.tools.base import ToolRegistry, ToolSpec
from runtime.tools.tool_validation import validate_tool_arguments
def parse_mcp_bound_tool_name(full_name: str) -> tuple[str, str] | None:

View file

@ -12,16 +12,16 @@ from typing import Any
from fastapi import APIRouter, Body, Header, HTTPException, Query
from fastapi.responses import Response
from oclaw.runtime.agents.factory import DEFAULT_OLLAMA_BASE_URL, DEFAULT_OLLAMA_MODEL
from oclaw.runtime.agents.specialists import (
from runtime.agents.factory import DEFAULT_OLLAMA_BASE_URL, DEFAULT_OLLAMA_MODEL
from runtime.agents.specialists import (
AGENT_PROFILE_BINDINGS_KEY,
agent_role_ids,
dump_agent_profile_bindings,
parse_agent_profile_bindings,
)
from oclaw.platform.config.paths import db_path
from oclaw.runtime.orchestration.evaluation import eval_summary
from oclaw.platform.persistence.sqlite_store import (
from svc.config.paths import db_path
from runtime.orchestration.evaluation import eval_summary
from svc.persistence.sqlite_store import (
LLM_BUILTIN_OLLAMA_PROFILE_ID,
SqliteStore,
active_llm_profile_setting_key,

View file

@ -16,12 +16,12 @@ from fastapi import APIRouter, Body, Header, Query
from fastapi import HTTPException
from fastapi.responses import HTMLResponse
from oclaw.runtime.operations.mcp_env import apply_gateway_mcp_env_to_os
from oclaw.runtime.agents.factory import build_gateway_executor
from oclaw.runtime.gateway import OclawGateway
from oclaw.runtime.types import StandardMessage, normalize_interaction_mode, normalize_requested_specialist
from oclaw.runtime.operations.providers.registry import build_channel_registry
from oclaw.runtime.operations.runtime import (
from runtime.operations.mcp_env import apply_gateway_mcp_env_to_os
from runtime.agents.factory import build_gateway_executor
from runtime.gateway import OclawGateway
from runtime.types import StandardMessage, normalize_interaction_mode, normalize_requested_specialist
from runtime.operations.providers.registry import build_channel_registry
from runtime.operations.runtime import (
cleanup_service_processes_by_pid,
detect_orphan_service_processes,
is_pid_running,
@ -29,37 +29,37 @@ from oclaw.runtime.operations.runtime import (
list_service_process_pids,
status_services,
)
from oclaw.runtime.operations.stack import cmd_stack_down, cmd_stack_status, cmd_stack_up
from oclaw.runtime.orchestration.vector_store import read_vector_memory_runtime
from oclaw.platform.config.paths import PROJECT_ROOT, db_path
from oclaw.platform.config.passwords import load_expected_password
from oclaw.platform.persistence.sqlite_store import SqliteStore
from oclaw.runtime.agents.specialists import discover_specialist_ids, parse_agent_profile_bindings
from oclaw.runtime.tools.mcp.installer import (
from runtime.operations.stack import cmd_stack_down, cmd_stack_status, cmd_stack_up
from runtime.orchestration.vector_store import read_vector_memory_runtime
from svc.config.paths import PROJECT_ROOT, db_path
from svc.config.passwords import load_expected_password
from svc.persistence.sqlite_store import SqliteStore
from runtime.agents.specialists import discover_specialist_ids, parse_agent_profile_bindings
from runtime.tools.mcp.installer import (
_safe_server_id,
detect_local_dependencies,
install_mcp_server,
preflight_mcp_server,
uninstall_mcp_server,
)
from oclaw.runtime.tools.mcp.market import search_mcp_market, trending_mcp_market
from oclaw.runtime.tools.mcp.manifest import McpServerManifest
from oclaw.runtime.operations.mcp_registry_export import (
from runtime.tools.mcp.market import search_mcp_market, trending_mcp_market
from runtime.tools.mcp.manifest import McpServerManifest
from runtime.operations.mcp_registry_export import (
build_mcp_install_export_document,
mcp_migrated_json_path,
persist_mcp_migrated_file,
)
from oclaw.runtime.tools.mcp.filesystem_argv import build_mcp_process_command
from oclaw.runtime.tools.mcp.registry import McpRegistry
from oclaw.runtime.tools.mcp.runtime import McpProcessRuntime
from oclaw.interfaces.admin.mcp_e2e_probe import build_mcp_e2e_probe_plans
from oclaw.runtime.tools.catalog import default_registry
from oclaw.runtime.chat.tool_runtime import ToolExecutionContext, ToolExecutor
from oclaw.platform.llm.chat_models import LLMToolCall
from oclaw.runtime.agent_core_attempt import ALL_ATTEMPT_ERROR_CODES
from oclaw.runtime.agent_core_run import DEFAULT_RETRYABLE_ERROR_CODES, resolve_retryable_error_codes
from oclaw.runtime.prompt_prebuild import run_runtime_prewarm, runtime_prewarm_prompts_snapshot, runtime_prewarm_status
from oclaw.runtime.workspaces.experts import (
from runtime.tools.mcp.filesystem_argv import build_mcp_process_command
from runtime.tools.mcp.registry import McpRegistry
from runtime.tools.mcp.runtime import McpProcessRuntime
from interfaces.admin.mcp_e2e_probe import build_mcp_e2e_probe_plans
from runtime.tools.catalog import default_registry
from runtime.chat.tool_runtime import ToolExecutionContext, ToolExecutor
from svc.llm.chat_models import LLMToolCall
from runtime.agent_core_attempt import ALL_ATTEMPT_ERROR_CODES
from runtime.agent_core_run import DEFAULT_RETRYABLE_ERROR_CODES, resolve_retryable_error_codes
from runtime.prompt_prebuild import run_runtime_prewarm, runtime_prewarm_prompts_snapshot, runtime_prewarm_status
from runtime.workspaces.experts import (
create_expert,
delete_expert,
list_experts,
@ -446,8 +446,8 @@ def build_admin_router() -> APIRouter:
ctx = _resolve_auth(store, authorization)
_require_permission(ctx, "admin:tenant:write")
from oclaw.runtime.tools.expert_registry import clear_expert_tool_cache
from oclaw.runtime.tools.public_registry import clear_public_tool_cache
from runtime.tools.expert_registry import clear_expert_tool_cache
from runtime.tools.public_registry import clear_public_tool_cache
clear_public_tool_cache()
clear_expert_tool_cache()
@ -504,7 +504,7 @@ def build_admin_router() -> APIRouter:
store = SqliteStore(db_path())
ctx = _resolve_auth(store, authorization)
_require_permission(ctx, "admin:tenant:write")
from oclaw.runtime.tools.exposure_plan import build_internal_tool_specs
from runtime.tools.exposure_plan import build_internal_tool_specs
r = str(role or "").strip().lower()
available_roles = _ordered_roles()
@ -543,8 +543,8 @@ def build_admin_router() -> APIRouter:
ctx = _resolve_auth(store, authorization)
_require_permission(ctx, "admin:tenant:write")
from oclaw.platform.llm.tool_wire_policy import load_role_mode_for_role, load_tool_policies_dict_for_role
from oclaw.runtime.tools.exposure_plan import build_internal_tool_specs, build_llm_tools_plan
from svc.llm.tool_wire_policy import load_role_mode_for_role, load_tool_policies_dict_for_role
from runtime.tools.exposure_plan import build_internal_tool_specs, build_llm_tools_plan
roles = _ordered_roles()
items: list[dict[str, Any]] = []
@ -607,7 +607,7 @@ def build_admin_router() -> APIRouter:
store = SqliteStore(db_path())
ctx = _resolve_auth(store, authorization)
_require_permission(ctx, "admin:tenant:write")
from oclaw.runtime.tools.exposure_plan import build_llm_tools_plan
from runtime.tools.exposure_plan import build_llm_tools_plan
r = str(role or "").strip().lower()
available_roles = _ordered_roles()
@ -2295,7 +2295,7 @@ def build_admin_router() -> APIRouter:
store = SqliteStore(db_path())
ctx = _resolve_auth(store, authorization)
_require_permission(ctx, "admin:tenant:write")
from oclaw.platform.llm.tool_wire_policy import build_tool_wire_snapshot
from svc.llm.tool_wire_policy import build_tool_wire_snapshot
return build_tool_wire_snapshot(store, role=str(role or "").strip().lower() or None)
@ -2304,7 +2304,7 @@ def build_admin_router() -> APIRouter:
payload: dict[str, Any] | None = Body(default=None),
authorization: str | None = Header(default=None),
) -> dict[str, Any]:
from oclaw.platform.llm.tool_wire_policy import SETTINGS_KEY_ADMIN_CONFIG, load_merged_admin_config
from svc.llm.tool_wire_policy import SETTINGS_KEY_ADMIN_CONFIG, load_merged_admin_config
payload = payload or {}
store = SqliteStore(db_path())
@ -2356,7 +2356,7 @@ def build_admin_router() -> APIRouter:
payload: dict[str, Any] | None = Body(default=None),
authorization: str | None = Header(default=None),
) -> dict[str, Any]:
from oclaw.platform.llm.tool_wire_policy import SETTINGS_KEY_ROLE_MODE_BY_ROLE
from svc.llm.tool_wire_policy import SETTINGS_KEY_ROLE_MODE_BY_ROLE
payload = payload or {}
store = SqliteStore(db_path())
@ -2396,7 +2396,7 @@ def build_admin_router() -> APIRouter:
role: str | None = Query(default=None),
authorization: str | None = Header(default=None),
) -> dict[str, Any]:
from oclaw.platform.llm.tool_wire_policy import SETTINGS_KEY_PENALTY_STATE, SETTINGS_KEY_PENALTY_STATE_BY_ROLE
from svc.llm.tool_wire_policy import SETTINGS_KEY_PENALTY_STATE, SETTINGS_KEY_PENALTY_STATE_BY_ROLE
store = SqliteStore(db_path())
ctx = _resolve_auth(store, authorization)
@ -2433,7 +2433,7 @@ def build_admin_router() -> APIRouter:
payload: dict[str, Any] | None = Body(default=None),
authorization: str | None = Header(default=None),
) -> dict[str, Any]:
from oclaw.platform.llm.tool_wire_policy import (
from svc.llm.tool_wire_policy import (
SETTINGS_KEY_TOOL_POLICIES,
SETTINGS_KEY_TOOL_POLICIES_BY_ROLE,
load_tool_policies_dict_for_role,
@ -2504,7 +2504,7 @@ def build_admin_router() -> APIRouter:
payload: dict[str, Any] | None = Body(default=None),
authorization: str | None = Header(default=None),
) -> dict[str, Any]:
from oclaw.platform.llm.tool_wire_policy import (
from svc.llm.tool_wire_policy import (
SETTINGS_KEY_TOOL_POLICIES,
SETTINGS_KEY_TOOL_POLICIES_BY_ROLE,
load_tool_policies_dict_for_role,
@ -3604,8 +3604,8 @@ def build_admin_router() -> APIRouter:
if tenant_id:
_require_tenant_scope(ctx, tenant_id)
user_id = str(payload.get("user_id") or "").strip() or None
from oclaw.platform.embeddings.embedding_client import build_default_embedding_client
from oclaw.runtime.orchestration.vector_store import build_vector_store, MemoryVectorItem
from svc.embeddings.embedding_client import build_default_embedding_client
from runtime.orchestration.vector_store import build_vector_store, MemoryVectorItem
client = build_default_embedding_client()
vector = build_vector_store(store)
@ -4114,9 +4114,9 @@ def build_admin_router() -> APIRouter:
"offset": int(off),
}
from oclaw.interfaces.admin.chat_api import include_chat_routes
from oclaw.interfaces.admin.models_api import include_model_mgmt_routes
from oclaw.interfaces.admin.skills_api import include_skill_routes
from interfaces.admin.chat_api import include_chat_routes
from interfaces.admin.models_api import include_model_mgmt_routes
from interfaces.admin.skills_api import include_skill_routes
include_chat_routes(router, resolve_auth=_resolve_auth)
include_model_mgmt_routes(router, resolve_auth=_resolve_auth)

View file

@ -7,8 +7,8 @@ from typing import Any
from fastapi import APIRouter, Body, Header, HTTPException
from oclaw.runtime.agents.factory import build_gateway_executor
from oclaw.runtime.skill_installer import (
from runtime.agents.factory import build_gateway_executor
from runtime.skill_installer import (
auto_install_skill_from_payload,
create_skill_from_template,
create_workspace_skill,
@ -19,7 +19,7 @@ from oclaw.runtime.skill_installer import (
set_skill_enabled,
uninstall_skill,
)
from oclaw.runtime.skill_role_binding import (
from runtime.skill_role_binding import (
SKILL_ROLE_BINDING_ENABLED_SETTING,
SKILL_ROLE_BINDING_KEY,
SKILL_ROLE_BINDING_MANAGER_INHERIT_SETTING,
@ -30,12 +30,12 @@ from oclaw.runtime.skill_role_binding import (
skill_role_binding_enabled_env_present,
skill_role_binding_enabled_stored,
)
from oclaw.runtime.skills_prompt import collect_skill_catalog_entries
from oclaw.runtime.skills import _allowed_tool_names_after_wire_policy, discover_workspace_skill_manifests
from oclaw.runtime.skills_market import get_market_adapter, normalize_skill_market_provider_setting
from oclaw.runtime.tools.skills_runtime.subprocess_exec import run_skill_runtime_entry
from oclaw.platform.config.paths import db_path
from oclaw.platform.persistence.sqlite_store import SqliteStore
from runtime.skills_prompt import collect_skill_catalog_entries
from runtime.skills import _allowed_tool_names_after_wire_policy, discover_workspace_skill_manifests
from runtime.skills_market import get_market_adapter, normalize_skill_market_provider_setting
from runtime.tools.skills_runtime.subprocess_exec import run_skill_runtime_entry
from svc.config.paths import db_path
from svc.persistence.sqlite_store import SqliteStore
_SKILL_MARKET_PROVIDER_KEY = "AIA_SKILL_MARKET_PROVIDER"

View file

@ -11,11 +11,11 @@ from collections import deque
from pathlib import Path
from typing import Any
from oclaw.runtime.application.gateway import process_inbound_payload_usecase
from oclaw.interfaces.channels.wecom.normalize import normalize_wecom_event, normalize_wecom_event_batch
from oclaw.platform.config.paths import db_path
from oclaw.platform.integrations.wecom_client import WeComClient
from oclaw.platform.persistence.sqlite_store import SqliteStore
from runtime.application.gateway import process_inbound_payload_usecase
from interfaces.channels.wecom.normalize import normalize_wecom_event, normalize_wecom_event_batch
from svc.config.paths import db_path
from svc.integrations.wecom_client import WeComClient
from svc.persistence.sqlite_store import SqliteStore
def _safe_json(obj: Any) -> str:

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import Any
from oclaw.interfaces.channels.base import ChannelAdapter, InboundMessage, OutboundMessage
from interfaces.channels.base import ChannelAdapter, InboundMessage, OutboundMessage
class WeComAdapter(ChannelAdapter):

View file

@ -2,9 +2,9 @@ from __future__ import annotations
from typing import Any
from oclaw.runtime.skill_installer import install_skill_from_registry_archive
from oclaw.runtime.tools.skills.clawhub_client import get_skill_detail as clawhub_get_skill_detail
from oclaw.runtime.tools.skills.clawhub_client import search_skills as clawhub_search_skills
from runtime.skill_installer import install_skill_from_registry_archive
from runtime.tools.skills.clawhub_client import get_skill_detail as clawhub_get_skill_detail
from runtime.tools.skills.clawhub_client import search_skills as clawhub_search_skills
def build_common_gateway_context(*, store: Any) -> dict[str, Any]:

View file

@ -1,12 +1,12 @@
from __future__ import annotations
from oclaw.interfaces.gateway.server_methods.agent import agent_handlers
from oclaw.interfaces.gateway.server_methods.chat import chat_handlers
from oclaw.interfaces.gateway.server_methods.commands import commands_handlers
from oclaw.interfaces.gateway.server_methods.connect import connect_handlers
from oclaw.interfaces.gateway.server_methods.sessions import sessions_handlers
from oclaw.interfaces.gateway.server_methods.skills import skills_handlers
from oclaw.interfaces.gateway.server_methods.shared_types import GatewayRequestHandlers
from interfaces.gateway.server_methods.agent import agent_handlers
from interfaces.gateway.server_methods.chat import chat_handlers
from interfaces.gateway.server_methods.commands import commands_handlers
from interfaces.gateway.server_methods.connect import connect_handlers
from interfaces.gateway.server_methods.sessions import sessions_handlers
from interfaces.gateway.server_methods.skills import skills_handlers
from interfaces.gateway.server_methods.shared_types import GatewayRequestHandlers
def build_gateway_method_handlers() -> GatewayRequestHandlers:

View file

@ -2,8 +2,8 @@ from __future__ import annotations
from typing import Any
from oclaw.platform.config.paths import db_path
from oclaw.platform.persistence.sqlite_store import SqliteStore
from svc.config.paths import db_path
from svc.persistence.sqlite_store import SqliteStore
from .context_builder import build_common_gateway_context
from .dispatcher import build_gateway_method_handlers

View file

@ -8,8 +8,8 @@ from types import ModuleType
from typing import Any, Iterable
from types import SimpleNamespace
from oclaw.platform.config.runtime_paths import runtime_extensions_root
from oclaw.runtime.extensions.plugin_api import PluginEntry
from svc.config.runtime_paths import runtime_extensions_root
from runtime.extensions.plugin_api import PluginEntry
def _sanitize_module_name(value: str) -> str:

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import Any
from oclaw.runtime.agents.agent_scope import resolve_agent_id_from_session_key, resolve_session_agent_id
from runtime.agents.agent_scope import resolve_agent_id_from_session_key, resolve_session_agent_id
from .shared_types import GatewayRequestHandlers
from .validation import error_shape

View file

@ -1,6 +1,6 @@
"""Compatibility bridge to the new oclaw dispatcher."""
from oclaw.interfaces.gateway.dispatcher import build_gateway_method_handlers, method_names
from interfaces.gateway.dispatcher import build_gateway_method_handlers, method_names
__all__ = ["build_gateway_method_handlers", "method_names"]

View file

@ -4,7 +4,7 @@ import importlib.util
from pathlib import Path
from typing import Any, Callable
from oclaw.platform.config.runtime_paths import runtime_extensions_root
from svc.config.runtime_paths import runtime_extensions_root
from .shared_types import GatewayRequestHandlers
from .validation import error_shape

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import Any
from oclaw.runtime.agents.agent_scope import resolve_default_agent_id
from runtime.agents.agent_scope import resolve_default_agent_id
from .shared_types import GatewayRequestHandlers
from .telegram_send_normalize import normalize_transport_target_for_channel

View file

@ -3,14 +3,14 @@ from __future__ import annotations
import json
from typing import Any
from oclaw.runtime.skill_installer import (
from runtime.skill_installer import (
create_skill_from_template,
install_skill_from_local_dir,
install_skill_from_registry_archive,
list_skills_with_status,
set_skill_enabled,
)
from oclaw.runtime.skills import discover_workspace_skill_manifests, load_skill_manifest
from runtime.skills import discover_workspace_skill_manifests, load_skill_manifest
from .shared_types import GatewayRequestHandlers
from .validation import error_shape

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import Any
from oclaw.runtime.extensions.telegram import (
from runtime.extensions.telegram import (
normalize_telegram_messaging_target,
parse_telegram_reply_to_message_id,
parse_telegram_target,

View file

@ -4,7 +4,7 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Any, Callable
from oclaw.platform.config.runtime_paths import runtime_extensions_root
from svc.config.runtime_paths import runtime_extensions_root
from .python_extensions_loader import build_python_extensions_registry
GatewayHandler = Callable[..., Any]

View file

@ -3,8 +3,8 @@ from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Callable
from oclaw.runtime.agents.agent_scope import resolve_agent_workspace_dir, resolve_default_agent_id
from oclaw.runtime.agents.subagent_registry import init_subagent_registry
from runtime.agents.agent_scope import resolve_agent_workspace_dir, resolve_default_agent_id
from runtime.agents.subagent_registry import init_subagent_registry
from .server_plugins import GatewayPluginLoadResult, load_gateway_plugins

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from oclaw.platform.config.bootstrap_env import load_system_env
from svc.config.bootstrap_env import load_system_env
load_system_env()
@ -17,24 +17,24 @@ from fastapi import Request
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from oclaw.runtime.application.gateway import process_inbound_payload_usecase
from oclaw.interfaces.gateway.http_adapter import dispatch_gateway_http_method
from oclaw.interfaces.ws import ws_gateway_loop
from oclaw.interfaces.ws.common import MAX_PAYLOAD_BYTES
from oclaw.interfaces.admin.routes import admin_static_dir, build_admin_router
from oclaw.runtime.agents.agent_scope import list_agent_ids, resolve_agent_workspace_dir, resolve_default_agent_id
from oclaw.interfaces.gateway.server_startup_plugins import prepare_gateway_plugin_bootstrap
from oclaw.runtime.hooks_runtime import (
from runtime.application.gateway import process_inbound_payload_usecase
from interfaces.gateway.http_adapter import dispatch_gateway_http_method
from interfaces.ws import ws_gateway_loop
from interfaces.ws.common import MAX_PAYLOAD_BYTES
from interfaces.admin.routes import admin_static_dir, build_admin_router
from runtime.agents.agent_scope import list_agent_ids, resolve_agent_workspace_dir, resolve_default_agent_id
from interfaces.gateway.server_startup_plugins import prepare_gateway_plugin_bootstrap
from runtime.hooks_runtime import (
initialize_hooks_runtime,
resolve_runtime_config,
trigger_hook_event,
)
from oclaw.runtime.skills import skill_runtime_diagnostics
from oclaw.runtime.prompt_prebuild import run_runtime_prewarm
from oclaw.platform.config.paths import PROJECT_ROOT, db_path
from oclaw.platform.persistence.sqlite_store import SqliteStore
from oclaw.interfaces.http.weixin_ilink_api import router as weixin_ilink_router
from oclaw.runtime.workspaces.experts import warm_expert_workspace_cache
from runtime.skills import skill_runtime_diagnostics
from runtime.prompt_prebuild import run_runtime_prewarm
from svc.config.paths import PROJECT_ROOT, db_path
from svc.persistence.sqlite_store import SqliteStore
from interfaces.http.weixin_ilink_api import router as weixin_ilink_router
from runtime.workspaces.experts import warm_expert_workspace_cache
def _resolve_startup_workspace_dir(cfg: dict[str, Any]) -> str:
@ -314,7 +314,7 @@ def main() -> int:
ws_max_size = int(MAX_PAYLOAD_BYTES)
ws_max_size = max(1024, min(int(ws_max_size), 200_000_000))
uvicorn.run(
"oclaw.interfaces.http.fastapi_app:create_app",
"interfaces.http.fastapi_app:create_app",
host=host,
port=port,
reload=False,

View file

@ -11,7 +11,7 @@ from fastapi import APIRouter, Header, HTTPException, Request
def _process_inbound_payload_usecase(payload: dict[str, Any]) -> dict[str, Any]:
# Lazy import to avoid circular imports during FastAPI app bootstrap.
from oclaw.runtime.application.gateway import process_inbound_payload_usecase
from runtime.application.gateway import process_inbound_payload_usecase
return process_inbound_payload_usecase(payload)

View file

@ -4,8 +4,8 @@ import hashlib
import os
from typing import Any
from oclaw.platform.config.paths import db_path
from oclaw.platform.persistence.sqlite_store import SqliteStore
from svc.config.paths import db_path
from svc.persistence.sqlite_store import SqliteStore
def build_hello_ok_payload(

View file

@ -5,7 +5,7 @@ import os
import time
from typing import Any
from oclaw.platform.files.file_attachments import process_file_data
from svc.files.file_attachments import process_file_data
PROTOCOL_VERSION = 3
MAX_PAYLOAD_BYTES = 26_214_400

View file

@ -6,7 +6,7 @@ from typing import Any
from starlette.websockets import WebSocketDisconnect
from oclaw.interfaces.ws.common import WS_REQUIRE_AUTH
from interfaces.ws.common import WS_REQUIRE_AUTH
async def recv_frame(

View file

@ -11,9 +11,9 @@ import threading
from fastapi import WebSocket
from oclaw.interfaces.gateway.dispatcher import build_gateway_method_handlers, method_names
from oclaw.interfaces.ws.auth_and_hello import build_hello_ok_payload, resolve_ws_auth as resolve_ws_auth_payload
from oclaw.interfaces.ws.common import (
from interfaces.gateway.dispatcher import build_gateway_method_handlers, method_names
from interfaces.ws.auth_and_hello import build_hello_ok_payload, resolve_ws_auth as resolve_ws_auth_payload
from interfaces.ws.common import (
MAX_BUFFERED_BYTES,
MAX_PAYLOAD_BYTES,
PREAUTH_HANDSHAKE_TIMEOUT_MS,
@ -31,19 +31,19 @@ from oclaw.interfaces.ws.common import (
now_ms as _now_ms,
origin_is_allowed,
)
from oclaw.interfaces.ws.events import (
from interfaces.ws.events import (
emit_agent_event as emit_agent_event_impl,
emit_chat_event as emit_chat_event_impl,
send_event as send_event_impl,
send_res as send_res_impl,
)
from oclaw.interfaces.ws.runtime_dispatch import dispatch_connected as dispatch_connected_impl
from oclaw.interfaces.ws.runtime_helpers import handle_connect as handle_connect_impl, recv_frame as recv_frame_impl
from oclaw.interfaces.ws.runtime_loop import close_ws as close_ws_impl, run_connection_loop
from oclaw.interfaces.ws.server_methods_bridge import build_gateway_context, dispatch_via_server_methods
from oclaw.interfaces.ws.turn_runner import run_agent_turn_via_bridge
from oclaw.interfaces.ws.ws_schema import format_validation_errors, get_ws_schemas, validate_or_errors
from oclaw.runtime.relay_pointer import validate_relay_share_envelope
from interfaces.ws.runtime_dispatch import dispatch_connected as dispatch_connected_impl
from interfaces.ws.runtime_helpers import handle_connect as handle_connect_impl, recv_frame as recv_frame_impl
from interfaces.ws.runtime_loop import close_ws as close_ws_impl, run_connection_loop
from interfaces.ws.server_methods_bridge import build_gateway_context, dispatch_via_server_methods
from interfaces.ws.turn_runner import run_agent_turn_via_bridge
from interfaces.ws.ws_schema import format_validation_errors, get_ws_schemas, validate_or_errors
from runtime.relay_pointer import validate_relay_share_envelope
_LOG = logging.getLogger(__name__)

View file

@ -6,7 +6,7 @@ from typing import Any
from jsonschema import Draft202012Validator
from oclaw.platform.config.runtime_paths import ws_protocol_schemas_root
from svc.config.runtime_paths import ws_protocol_schemas_root
_SCHEMA_DIR = ws_protocol_schemas_root()

View file

@ -4,9 +4,9 @@ import asyncio
import uuid
from typing import Any, Callable
from oclaw.platform.config.paths import db_path
from oclaw.platform.persistence.sqlite_store import SqliteStore
from oclaw.interfaces.gateway.context_builder import build_common_gateway_context
from svc.config.paths import db_path
from svc.persistence.sqlite_store import SqliteStore
from interfaces.gateway.context_builder import build_common_gateway_context
def build_gateway_context(

View file

@ -7,11 +7,11 @@ import uuid
from datetime import datetime
from typing import Any, Callable
from oclaw.runtime.agents.factory import build_gateway_executor
from oclaw.runtime.gateway import OclawGateway
from oclaw.runtime.types import StandardMessage
from oclaw.platform.config.paths import db_path
from oclaw.platform.persistence.sqlite_store import SqliteStore
from runtime.agents.factory import build_gateway_executor
from runtime.gateway import OclawGateway
from runtime.types import StandardMessage
from svc.config.paths import db_path
from svc.persistence.sqlite_store import SqliteStore
def _persisted_chat_attachments_nonempty(raw: Any) -> bool: