- MockHostAdapter (tests/mock_host): in-memory editing model with opaque entity ids, id invalidation, token-bucket rate limiting, snapshot/restore with cap, event subscription, and a stdlib-zlib PNG encoder producing time-varying non-black frames - HostToolExecutor: all 26 tool handlers mapped to HostAdapter calls, snapshot orchestration for mutating batches, concurrent scan_timeline frame pipeline with token bucket and RateLimited backoff, undo_session() restoring per-batch snapshots in reverse, get_params min/max/choices reflection - Web UI (core[webui] extra): FastAPI + single-page vanilla JS, chat log, pending-confirmation list with approve/reject endpoints (timeout defaults to reject), progress, undo-session, snapshot management; SSE push + POST, bound to 127.0.0.1 - Host error types (HostError/EntityNotFound/RateLimited) and shared TokenBucket - P2 acceptance chain: import -> place -> split -> ripple delete -> effect + param -> frame verification (non-black, pixel changes at cut and after effect) -> undo_session restores original state Tests: 129 passed via uv run pytest (no network)
42 lines
1022 B
Python
42 lines
1022 B
Python
"""Mock 宿主(tests/mock_host,可 import 包)。
|
|
|
|
MockHostAdapter 是未来 Oak / Resolve / Premiere 适配层的验收替身
|
|
(计划文档 §3.3 / §7):内存时间线模型 + 快照补偿 + 限流模拟 + 真实 PNG 取帧。
|
|
"""
|
|
from quercus_core.host.errors import EntityNotFound, HostError, RateLimited
|
|
|
|
from mock_host.effects import MOCK_EFFECT_TYPES
|
|
from mock_host.frames import decode_png, frame_is_black, render_footage_frame
|
|
from mock_host.host import MockHostAdapter
|
|
from mock_host.model import (
|
|
MockClip,
|
|
MockEffect,
|
|
MockFootage,
|
|
MockMarker,
|
|
MockProject,
|
|
MockSequence,
|
|
MockSnapshot,
|
|
MockState,
|
|
MockTrack,
|
|
)
|
|
|
|
__all__ = [
|
|
"MockHostAdapter",
|
|
"MOCK_EFFECT_TYPES",
|
|
"MockClip",
|
|
"MockEffect",
|
|
"MockFootage",
|
|
"MockMarker",
|
|
"MockProject",
|
|
"MockSequence",
|
|
"MockSnapshot",
|
|
"MockState",
|
|
"MockTrack",
|
|
"render_footage_frame",
|
|
"frame_is_black",
|
|
"decode_png",
|
|
"EntityNotFound",
|
|
"HostError",
|
|
"RateLimited",
|
|
]
|