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

@ -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: