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

@ -506,7 +506,7 @@
- 生效:`oclaw/app_server/fastapi_main.py`, `oclaw/runtime/operations/main.py`
- `OCLAW_UVICORN_WS_MAX_SIZE`
- 默认:未设置时由 `oclaw.interfaces.http.fastapi_app:main` 使用与 `MAX_PAYLOAD_BYTES`(约 25MB)相同的值传入 uvicorn `ws_max_size`
- 默认:未设置时由 `interfaces.http.fastapi_app:main` 使用与 `MAX_PAYLOAD_BYTES`(约 25MB)相同的值传入 uvicorn `ws_max_size`
- 作用:**uvicorn 对 WebSocket 单帧的字节上限**(与 hello 里 `maxPayload` 应对齐)。uvicorn 自带默认约 **16MB**;两张高清图经 base64 塞进一条 `chat.send` 常超过 16MB,服务端直接断连,浏览器侧表现为 **`ws_closed`** / 请求失败
- 说明:若用命令行 `uvicorn ...` 启动而未走 `fastapi_app.main()`,需自行加 `--ws-max-size` 或设置本变量(取决于你的启动入口是否读取)
- 生效:`oclaw/interfaces/http/fastapi_app.py`

View file

@ -4,8 +4,8 @@ Use this checklist to verify readiness and post-delete safety for `oclaw/app_ser
## Import graph checks
- [x] `rg "src\.app_server\."` has no runtime/code matches (tests excluded or updated).
- [x] CLI/runtime startup paths import from `oclaw.interfaces.*` only.
- [x] WebSocket entrypoint imports resolve through `oclaw.interfaces.ws.*`.
- [x] CLI/runtime startup paths import from `interfaces.*` only.
- [x] WebSocket entrypoint imports resolve through `interfaces.ws.*`.
## Behavior parity checks
- [x] HTTP gateway smoke tests pass (`/health`, `/inbound`, `/gateway/method`, `/ws` handshake).

View file

@ -26,10 +26,10 @@ This repository now uses **repo-root relative** runtime wiring.
## Runtime notes
- Gateway HTTP method adapter: `POST /gateway/method`
- WS dispatch first resolves method handlers from shared dispatcher.
- Inbound payload use-case entrypoint: `oclaw.runtime.application.gateway.process_inbound_payload_usecase`
- HTTP app entrypoint moved to: `oclaw.interfaces.http.fastapi_app`
- WS entrypoint moved to: `oclaw.interfaces.ws.entrypoint`
- WS runtime bridge path: `oclaw.interfaces.ws.runtime`
- Inbound payload use-case entrypoint: `runtime.application.gateway.process_inbound_payload_usecase`
- HTTP app entrypoint moved to: `interfaces.http.fastapi_app`
- WS entrypoint moved to: `interfaces.ws.entrypoint`
- WS runtime bridge path: `interfaces.ws.runtime`
- WS runtime implementation seam:
- `oclaw/interfaces/ws/runtime_impl.py`
- `runtime.py` points to this module as stable import surface.

View file

@ -1,7 +1,7 @@
# Prompt Style Guide
## Goal
- System/builtin model-facing prompt templates live under `runtime/workspaces/_system/`; role-specific copy lives under `runtime/workspaces/<role>/` (e.g. `ROLE_SYSTEM.md`). Load via `oclaw.runtime.prompt_templates`.
- System/builtin model-facing prompt templates live under `runtime/workspaces/_system/`; role-specific copy lives under `runtime/workspaces/<role>/` (e.g. `ROLE_SYSTEM.md`). Load via `runtime.prompt_templates`.
- Business code must inject variables only; no long inline prompt strings.
## Template Contract

View file

@ -11,7 +11,7 @@
## 1. 统一入口(只保留最新)
所有运维命令统一通过 `scripts/`,不要再使用 `python -m oclaw.runtime.operations ...` 或历史 `.bat` 方式。
所有运维命令统一通过 `scripts/`,不要再使用 `python -m runtime.operations ...` 或历史 `.bat` 方式。
补充:工具脚本也统一放在 `scripts/`(例如 `seed_mcp_registry.py`、`ws_probe.py`)。