mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:30:48 +08:00
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:
parent
7941b27f58
commit
420abac9f1
405 changed files with 1316 additions and 1345 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from oclaw.runtime.tools.catalog import (
|
||||
from runtime.tools.catalog import (
|
||||
TOOL_FACTORIES,
|
||||
default_registry,
|
||||
materialize_tool_specs,
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ import os
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.interfaces.gateway.python_extensions_loader import build_python_extensions_registry
|
||||
from oclaw.platform.config.paths import PROJECT_ROOT
|
||||
from oclaw.runtime.tools.base import ToolRegistry, ToolSpec
|
||||
from oclaw.runtime.tools.expert_registry import materialize_tools_for_expert
|
||||
from oclaw.runtime.tools.mcp.adapter import materialize_mcp_tools_for_specialist
|
||||
from oclaw.runtime.tools.public_registry import materialize_public_tools
|
||||
from oclaw.runtime.tools.skills_runtime.materialize_skill_tools import materialize_executable_skill_tools
|
||||
from oclaw.runtime.skills import SkillSpec, materialize_skills_from_tool_specs
|
||||
from interfaces.gateway.python_extensions_loader import build_python_extensions_registry
|
||||
from svc.config.paths import PROJECT_ROOT
|
||||
from runtime.tools.base import ToolRegistry, ToolSpec
|
||||
from runtime.tools.expert_registry import materialize_tools_for_expert
|
||||
from runtime.tools.mcp.adapter import materialize_mcp_tools_for_specialist
|
||||
from runtime.tools.public_registry import materialize_public_tools
|
||||
from runtime.tools.skills_runtime.materialize_skill_tools import materialize_executable_skill_tools
|
||||
from runtime.skills import SkillSpec, materialize_skills_from_tool_specs
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
# Tools hidden from model-facing registry to enforce auto-install only policy.
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ from dataclasses import dataclass
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.application.gateway import process_inbound_payload_usecase
|
||||
from oclaw.platform.config.paths import db_path
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from runtime.application.gateway import process_inbound_payload_usecase
|
||||
from svc.config.paths import db_path
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ from pathlib import Path
|
|||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.agents.factory import build_gateway_executor
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from oclaw.runtime.orchestration.evaluation import eval_summary
|
||||
from oclaw.platform.config.paths import db_path
|
||||
from oclaw.runtime.gateway import OclawGateway
|
||||
from oclaw.runtime.types import StandardMessage
|
||||
from runtime.agents.factory import build_gateway_executor
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
from runtime.orchestration.evaluation import eval_summary
|
||||
from svc.config.paths import db_path
|
||||
from runtime.gateway import OclawGateway
|
||||
from runtime.types import StandardMessage
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from collections.abc import Callable
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ def discover_expert_tool_factories() -> dict[str, list[ToolFactory]]:
|
|||
for module_path in sorted(expert_dir.glob("*.py")):
|
||||
if module_path.name == "__init__.py":
|
||||
continue
|
||||
mod_name = f"oclaw.runtime.tools.experts.{expert}.{module_path.stem}"
|
||||
mod_name = f"runtime.tools.experts.{expert}.{module_path.stem}"
|
||||
module = _load_module_from_path(module_path, mod_name)
|
||||
if module is None:
|
||||
continue
|
||||
|
|
@ -145,7 +145,7 @@ def preview_expert_tools(expert: str | None) -> dict[str, Any]:
|
|||
for module_path in sorted(expert_dir.glob("*.py")):
|
||||
if module_path.name == "__init__.py":
|
||||
continue
|
||||
mod_name = f"oclaw.runtime.tools.experts.{ex}.{module_path.stem}"
|
||||
mod_name = f"runtime.tools.experts.{ex}.{module_path.stem}"
|
||||
module = None
|
||||
try:
|
||||
module = _load_module_from_path(module_path, mod_name)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"""通识专家工具清单。"""
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def system_info_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import datetime
|
|||
import time
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def system_info_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from typing import Any
|
|||
|
||||
import httpx
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
_UME_RAW_GROUP_FIELDS = [
|
||||
"alarm_alarm_key",
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ from __future__ import annotations
|
|||
import hashlib
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.config.paths import db_path
|
||||
from oclaw.platform.embeddings.embedding_client import build_default_embedding_client
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from svc.config.paths import db_path
|
||||
from svc.embeddings.embedding_client import build_default_embedding_client
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def _chunk_id(source: str, text: str) -> str:
|
||||
|
|
@ -64,7 +64,7 @@ def kb_search_tool() -> ToolSpec:
|
|||
if not tenant_id or not query:
|
||||
return {"ok": False, "error": "tenant_id and query are required"}
|
||||
store = SqliteStore(db_path())
|
||||
from oclaw.runtime.orchestration.memory import retrieve_context
|
||||
from runtime.orchestration.memory import retrieve_context
|
||||
|
||||
rows = retrieve_context(store, query, limit=max(1, min(limit, 6)))
|
||||
filtered = [r for r in rows if str(r.get("source") or "").startswith(f"builtin:tenant:{tenant_id}:")]
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ 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 oclaw.runtime.tools.base import ToolSpec
|
||||
from svc.config.paths import db_path
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def _require(s: str, name: str) -> str:
|
||||
|
|
|
|||
|
|
@ -4,20 +4,20 @@ import os
|
|||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.llm.tool_schema import default_max_openai_tools_json_bytes
|
||||
from oclaw.platform.llm.tool_wire_policy import (
|
||||
from svc.llm.tool_schema import default_max_openai_tools_json_bytes
|
||||
from svc.llm.tool_wire_policy import (
|
||||
load_merged_admin_config,
|
||||
load_role_mode_for_role,
|
||||
load_tool_policies_dict_for_role,
|
||||
prepare_openai_tools_for_llm_api,
|
||||
wire_graduation_effective,
|
||||
)
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.catalog import _is_truthy
|
||||
from oclaw.runtime.tools.expert_registry import materialize_tools_for_expert, preview_expert_tools
|
||||
from oclaw.runtime.tools.mcp.adapter import materialize_mcp_tools_for_specialist
|
||||
from oclaw.runtime.tools.plugin_loader import materialize_plugin_tools
|
||||
from oclaw.runtime.tools.public_registry import materialize_public_tools, preview_public_tools
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.catalog import _is_truthy
|
||||
from runtime.tools.expert_registry import materialize_tools_for_expert, preview_expert_tools
|
||||
from runtime.tools.mcp.adapter import materialize_mcp_tools_for_specialist
|
||||
from runtime.tools.plugin_loader import materialize_plugin_tools
|
||||
from runtime.tools.public_registry import materialize_public_tools, preview_public_tools
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ import json
|
|||
import os
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.operations.mcp_env import mcp_env_allowlist_keys
|
||||
from oclaw.runtime.skills import SkillSpec, materialize_skills_from_tool_specs
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.mcp.filesystem_argv import build_mcp_process_command
|
||||
from oclaw.runtime.tools.mcp.runtime import McpProcessRuntime
|
||||
from oclaw.runtime.tools.public.bailian_webparser_tool import bailian_webparser_tool
|
||||
from runtime.operations.mcp_env import mcp_env_allowlist_keys
|
||||
from runtime.skills import SkillSpec, materialize_skills_from_tool_specs
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.mcp.filesystem_argv import build_mcp_process_command
|
||||
from runtime.tools.mcp.runtime import McpProcessRuntime
|
||||
from runtime.tools.public.bailian_webparser_tool import bailian_webparser_tool
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
from dataclasses import asdict
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from oclaw.runtime.tools.mcp.manifest import McpServerManifest
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
from runtime.tools.mcp.manifest import McpServerManifest
|
||||
|
||||
|
||||
class McpRegistry:
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class McpProcessRuntime:
|
|||
def _build_runtime_env(env_allowlist: list[str] | None) -> dict[str, str] | None:
|
||||
if env_allowlist is None:
|
||||
return None
|
||||
from oclaw.runtime.operations.mcp_env import mcp_local_env_merged
|
||||
from runtime.operations.mcp_env import mcp_local_env_merged
|
||||
|
||||
keep_keys = {"PATH", "PATHEXT", "SYSTEMROOT", "WINDIR", "COMSPEC", "TEMP", "TMP", "HOME", "USERPROFILE", "APPDATA", "LOCALAPPDATA", "PROGRAMDATA", "PROGRAMFILES", "PROGRAMFILES(X86)", "SYSTEMDRIVE"}
|
||||
env: dict[str, str] = {}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from dataclasses import dataclass
|
|||
from pathlib import Path
|
||||
from typing import Any, Iterator
|
||||
|
||||
from oclaw.platform.config.paths import PROJECT_ROOT
|
||||
from svc.config.paths import PROJECT_ROOT
|
||||
|
||||
_TLS = threading.local()
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from dataclasses import dataclass
|
||||
from typing import Any, Callable
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
import hashlib
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.path_guard import resolve_workspace_path
|
||||
|
||||
|
||||
def apply_patch_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import re
|
|||
from typing import Any
|
||||
from pathlib import Path
|
||||
|
||||
from oclaw.platform.files.attachment_assets import AttachmentAssetStore
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from svc.files.attachment_assets import AttachmentAssetStore
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
_ATTACHMENT_ID_RE = re.compile(r"^[a-f0-9]{64}$")
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import urllib.parse
|
|||
import urllib.request
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
_WEBPARSER_SSE_URL = "https://dashscope.aliyuncs.com/api/v1/mcps/WebParser/sse"
|
||||
_UA = (
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.path_guard import resolve_workspace_path
|
||||
|
||||
|
||||
def bulk_apply_patch_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ from urllib import request as urllib_request
|
|||
|
||||
from PIL import Image
|
||||
|
||||
from oclaw.platform.files.attachment_assets import AttachmentAssetStore
|
||||
from oclaw.runtime.operations.mcp_env import apply_gateway_mcp_env_to_os
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from svc.files.attachment_assets import AttachmentAssetStore
|
||||
from runtime.operations.mcp_env import apply_gateway_mcp_env_to_os
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def _to_image_bytes(resp_body: bytes, content_type: str) -> tuple[bytes, str]:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def delete_file_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def edit_file_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def get_cwd_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def get_env_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
import subprocess
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path, sanitize_git_ref, truncate_text
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.path_guard import resolve_workspace_path, sanitize_git_ref, truncate_text
|
||||
|
||||
|
||||
def _git(command: str, *, cwd: str) -> dict[str, Any]:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.path_guard import resolve_workspace_path
|
||||
|
||||
|
||||
def glob_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ from typing import Any
|
|||
|
||||
from PIL import Image
|
||||
|
||||
from oclaw.platform.files.attachment_assets import AttachmentAssetStore
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from svc.files.attachment_assets import AttachmentAssetStore
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def image_edit_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def index_workspace_tool() -> ToolSpec:
|
||||
def handler(args: dict[str, Any]) -> dict[str, Any]:
|
||||
max_files = int(args.get("max_files") or 120)
|
||||
try:
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from oclaw.platform.config.paths import db_path
|
||||
from oclaw.runtime.tools.workspace_indexer import index_workspace
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
from svc.config.paths import db_path
|
||||
from runtime.tools.workspace_indexer import index_workspace
|
||||
|
||||
store = SqliteStore(db_path())
|
||||
st = index_workspace(store, max_files=max(1, min(max_files, 800)))
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def kill_process_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def list_directory_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def list_processes_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.path_guard import resolve_workspace_path
|
||||
|
||||
|
||||
def list_workspace_tree_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from datetime import datetime, timezone
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path, truncate_text
|
||||
from runtime.tools.path_guard import resolve_workspace_path, truncate_text
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
@ -80,14 +80,14 @@ class LocalAdapter:
|
|||
dbp = str(os.getenv("OPS_ASSISTANT_DB_PATH") or "").strip()
|
||||
try:
|
||||
if not dbp:
|
||||
from oclaw.platform.config.paths import db_path
|
||||
from svc.config.paths import db_path
|
||||
|
||||
dbp = str(db_path() or "").strip()
|
||||
except Exception:
|
||||
dbp = ""
|
||||
if dbp:
|
||||
try:
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
|
||||
store = SqliteStore(dbp)
|
||||
raw_db = str(store.get_setting("AIA_ENABLE_RUN_COMMAND") or "").strip()
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import sys
|
|||
from types import SimpleNamespace
|
||||
from typing import Any, Callable
|
||||
|
||||
from oclaw.platform.config.paths import PROJECT_ROOT
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from svc.config.paths import PROJECT_ROOT
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def _plugin_cfg() -> dict[str, Any]:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def mkdir_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def move_file_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.path_guard import resolve_workspace_path
|
||||
|
||||
|
||||
def multi_edit_file_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.files.attachment_assets import attachment_id_to_data_url
|
||||
from oclaw.platform.llm.image_ocr_client import (
|
||||
from svc.files.attachment_assets import attachment_id_to_data_url
|
||||
from svc.llm.image_ocr_client import (
|
||||
VISION_DESCRIBE_PROMPT_ZH,
|
||||
VISION_OCR_EXTRACT_PROMPT_ZH,
|
||||
send_ocr_image_messages,
|
||||
vision_llm_backend_status,
|
||||
)
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def query_image_attachment_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.files.text_attachment_store import query_text_document
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from svc.files.text_attachment_store import query_text_document
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def query_text_attachment_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ import tempfile
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.files.attachment_assets import AttachmentAssetStore
|
||||
from oclaw.platform.files.text_attachment_store import (
|
||||
from svc.files.attachment_assets import AttachmentAssetStore
|
||||
from svc.files.text_attachment_store import (
|
||||
DEFAULT_TEXT_CHUNK_OVERLAP,
|
||||
DEFAULT_TEXT_CHUNK_SIZE,
|
||||
save_text_document,
|
||||
)
|
||||
from oclaw.runtime.extensions.openai.api import OPENAI_DEFAULT_AUDIO_TRANSCRIPTION_MODEL
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.extensions.openai.api import OPENAI_DEFAULT_AUDIO_TRANSCRIPTION_MODEL
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def _ffmpeg_exists() -> bool:
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
import hashlib
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.path_guard import resolve_workspace_path
|
||||
|
||||
|
||||
def read_file_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def run_command_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import re
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path, truncate_text
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.path_guard import resolve_workspace_path, truncate_text
|
||||
|
||||
|
||||
def search_files_context_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def search_files_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.public.local_sdk import get_local_adapter
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.public.local_sdk import get_local_adapter
|
||||
|
||||
|
||||
def set_env_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@ from __future__ import annotations
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.config.paths import db_path
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from oclaw.runtime.chat.tool_invocation_context import (
|
||||
from svc.config.paths import db_path
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
from runtime.chat.tool_invocation_context import (
|
||||
current_tool_lane_sessions,
|
||||
current_tool_workspace_lane_role,
|
||||
)
|
||||
from oclaw.runtime.skill_installer import auto_install_skill_from_payload, install_skill_from_registry_archive
|
||||
from oclaw.runtime.skills_market import get_market_adapter, normalize_skill_market_provider_setting
|
||||
from oclaw.runtime.skills_workspace_lane import resolve_auto_install_parent
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.skill_installer import auto_install_skill_from_payload, install_skill_from_registry_archive
|
||||
from runtime.skills_market import get_market_adapter, normalize_skill_market_provider_setting
|
||||
from runtime.skills_workspace_lane import resolve_auto_install_parent
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def _store() -> SqliteStore:
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ from __future__ import annotations
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.config.paths import db_path
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from oclaw.runtime.skill_installer import install_skill_from_registry_archive
|
||||
from oclaw.runtime.skills import default_skills_root
|
||||
from oclaw.runtime.skills_market import get_market_adapter, normalize_skill_market_provider_setting
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from svc.config.paths import db_path
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
from runtime.skill_installer import install_skill_from_registry_archive
|
||||
from runtime.skills import default_skills_root
|
||||
from runtime.skills_market import get_market_adapter, normalize_skill_market_provider_setting
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def _store() -> SqliteStore:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def system_time_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.files.tabular_attachment_store import (
|
||||
from svc.files.tabular_attachment_store import (
|
||||
aggregate_table,
|
||||
analyze_table_full_scan,
|
||||
query_table,
|
||||
run_table_sql,
|
||||
)
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def query_tabular_attachment_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import urllib.request
|
|||
from html import unescape
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
_UA = (
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import urllib.request
|
|||
from html import unescape
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
_UA = (
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from oclaw.runtime.tools.path_guard import resolve_workspace_path
|
||||
from runtime.tools.base import ToolSpec
|
||||
from runtime.tools.path_guard import resolve_workspace_path
|
||||
|
||||
|
||||
def write_file_tool() -> ToolSpec:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from collections.abc import Callable
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ def discover_public_tool_factories() -> list[ToolFactory]:
|
|||
for module_path in sorted(_PUBLIC_ROOT.glob("*.py")):
|
||||
if module_path.name == "__init__.py":
|
||||
continue
|
||||
mod_name = f"oclaw.runtime.tools.public.{module_path.stem}"
|
||||
mod_name = f"runtime.tools.public.{module_path.stem}"
|
||||
module = _load_module_from_path(module_path, mod_name)
|
||||
if module is None:
|
||||
continue
|
||||
|
|
@ -92,7 +92,7 @@ def preview_public_tools() -> dict[str, Any]:
|
|||
for module_path in sorted(_PUBLIC_ROOT.glob("*.py")):
|
||||
if module_path.name == "__init__.py":
|
||||
continue
|
||||
mod_name = f"oclaw.runtime.tools.public.{module_path.stem}"
|
||||
mod_name = f"runtime.tools.public.{module_path.stem}"
|
||||
module = None
|
||||
try:
|
||||
module = _load_module_from_path(module_path, mod_name)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.skills import discover_workspace_skill_manifests
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
from runtime.skills import discover_workspace_skill_manifests
|
||||
from runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def materialize_executable_skill_tools(*, store: Any | None = None) -> list[ToolSpec]:
|
||||
|
|
@ -27,7 +27,7 @@ def materialize_executable_skill_tools(*, store: Any | None = None) -> list[Tool
|
|||
continue
|
||||
|
||||
def _handler(args: dict[str, Any], *, _manifest=m, _rt=rt) -> dict[str, Any]:
|
||||
from oclaw.runtime.tools.skills_runtime.subprocess_exec import run_skill_runtime_entry
|
||||
from runtime.tools.skills_runtime.subprocess_exec import run_skill_runtime_entry
|
||||
|
||||
source_meta = {}
|
||||
if isinstance(getattr(_manifest, "metadata_oclaw", None), dict):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from dataclasses import dataclass
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.config.paths import PROJECT_ROOT
|
||||
from svc.config.paths import PROJECT_ROOT
|
||||
|
||||
|
||||
_PATH_KEYS = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
# Backward-compat import path.
|
||||
from oclaw.runtime.tools.public.system_time_tool import system_time_tool
|
||||
from runtime.tools.public.system_time_tool import system_time_tool
|
||||
|
||||
__all__ = ["system_time_tool"]
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ from dataclasses import dataclass
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.embeddings.embedding_client import build_default_embedding_client
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from oclaw.platform.config.paths import PROJECT_ROOT
|
||||
from svc.embeddings.embedding_client import build_default_embedding_client
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
from svc.config.paths import PROJECT_ROOT
|
||||
|
||||
|
||||
def _default_workspace_root() -> Path:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue