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

@ -5,10 +5,10 @@ from __future__ import annotations
import os
from typing import Any
from oclaw.runtime.agents.agent_scope import resolve_default_agent_id
from oclaw.runtime.agents.network_ops_agent import NetworkOpsAgent
from oclaw.runtime.agents.specialist_agent import SpecialistProfile
from oclaw.runtime.agents.specialists import (
from runtime.agents.agent_scope import resolve_default_agent_id
from runtime.agents.network_ops_agent import NetworkOpsAgent
from runtime.agents.specialist_agent import SpecialistProfile
from runtime.agents.specialists import (
AGENT_PROFILE_BINDINGS_KEY,
normalize_specialist_id,
agent_role_ids,
@ -20,21 +20,21 @@ from oclaw.runtime.agents.specialists import (
expert_name_for_specialist,
parse_agent_profile_bindings,
)
from oclaw.runtime.chat.agent import Agent
from oclaw.runtime.orchestration.inventory import inventory_snapshot
from oclaw.runtime.orchestration.memory import upsert_knowledge_chunks
from oclaw.platform.llm.chat_models import GoogleGeminiChatModel, OpenAIChatModel, RuleBasedChatModel, StaticTextChatModel
from oclaw.platform.llm.transports.anthropic_messages import AnthropicMessagesModel
from oclaw.platform.llm.transports.openai_responses import OpenAIResponsesModel
from oclaw.platform.persistence.sqlite_store import (
from runtime.chat.agent import Agent
from runtime.orchestration.inventory import inventory_snapshot
from runtime.orchestration.memory import upsert_knowledge_chunks
from svc.llm.chat_models import GoogleGeminiChatModel, OpenAIChatModel, RuleBasedChatModel, StaticTextChatModel
from svc.llm.transports.anthropic_messages import AnthropicMessagesModel
from svc.llm.transports.openai_responses import OpenAIResponsesModel
from svc.persistence.sqlite_store import (
SqliteStore,
active_llm_profile_setting_key,
agent_profile_bindings_setting_key,
is_administrator_model_pool,
)
from oclaw.runtime.prompt_templates import render_prompt
from oclaw.runtime.tools.catalog import default_registry
from oclaw.runtime.tools.plugin_loader import sync_plugin_metadata
from runtime.prompt_templates import render_prompt
from runtime.tools.catalog import default_registry
from runtime.tools.plugin_loader import sync_plugin_metadata
def _openai_missing_key_user_message(lang: str) -> str:

View file

@ -2,10 +2,10 @@ from __future__ import annotations
from typing import Any
from oclaw.runtime.chat.agent import Agent
from oclaw.runtime.agent_context import build_role_system_context
from oclaw.platform.persistence.sqlite_store import SqliteStore
from oclaw.runtime.tools import default_registry
from runtime.chat.agent import Agent
from runtime.agent_context import build_role_system_context
from svc.persistence.sqlite_store import SqliteStore
from runtime.tools import default_registry
# Ops 专家走与 specialists 相同的工作区框架:runtime/workspaces/ops/{SOUL,ROLE_SYSTEM}.md
NETWORK_SYSTEM_PROMPT_ZH = build_role_system_context("ops")

View file

@ -9,11 +9,11 @@ from collections.abc import Callable
from dataclasses import dataclass, field
from typing import Any, Optional
from oclaw.runtime.chat.agent import Agent
from oclaw.runtime.chat.agent import GenerationInterrupted
from oclaw.runtime.agents.network_ops_agent import NetworkOpsAgent
from oclaw.platform.persistence.sqlite_store import SqliteStore
from oclaw.platform.llm.image_legacy_client import (
from runtime.chat.agent import Agent
from runtime.chat.agent import GenerationInterrupted
from runtime.agents.network_ops_agent import NetworkOpsAgent
from svc.persistence.sqlite_store import SqliteStore
from svc.llm.image_legacy_client import (
IMAGE_SPECIALIST_DEFAULT_PROMPT_ZH,
collect_legacy_lane_images_from_attachments,
collect_legacy_lane_images_with_session_fallback,
@ -21,19 +21,19 @@ from oclaw.platform.llm.image_legacy_client import (
legacy_image_turn_bundle,
send_legacy_image_messages,
)
from oclaw.platform.llm.video_generation_client import (
from svc.llm.video_generation_client import (
VIDEO_SPECIALIST_DEFAULT_PROMPT_ZH,
legacy_video_assistant_body_with_placeholder,
legacy_video_turn_bundle,
send_video_generation_request,
)
from oclaw.runtime.tools import default_registry
from oclaw.runtime.agents.specialists import expert_name_for_specialist
from runtime.tools import default_registry
from runtime.agents.specialists import expert_name_for_specialist
from oclaw.runtime.chat.turn_types import TurnRunOutcome
from oclaw.runtime.relay_pointer import build_manifest_from_attachment_refs
from oclaw.runtime.types import RelayShareEnvelope
from oclaw.runtime.orchestration.protocol import (
from runtime.chat.turn_types import TurnRunOutcome
from runtime.relay_pointer import build_manifest_from_attachment_refs
from runtime.types import RelayShareEnvelope
from runtime.orchestration.protocol import (
AgentTask,
PlanStep,
SpecialistDelivery,
@ -361,8 +361,8 @@ class SpecialistAgentRunner:
path_policy_tenant_id=_path_tenant,
path_policy_user_id=_path_user,
)
from oclaw.runtime.gateway import OclawGateway
from oclaw.runtime.types import StandardMessage
from runtime.gateway import OclawGateway
from runtime.types import StandardMessage
gw = OclawGateway(store=self.store)
msg = StandardMessage(

View file

@ -4,8 +4,8 @@ from dataclasses import dataclass
import json
from typing import Any
from oclaw.runtime.agent_context import build_role_system_context
from oclaw.runtime.workspaces.experts import specialist_registry_snapshot
from runtime.agent_context import build_role_system_context
from runtime.workspaces.experts import specialist_registry_snapshot
SpecialistId = str