mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 11:50:45 +08:00
重构仓库目录为统一的 runtime 分层并清理历史 openclaw 残留。
本次迁移将网关/通道/工具/技能/脚本与协议资源集中到新结构,统一路径常量与脚本转发机制,减少顶层噪音并保证运行与测试行为一致。 Made-with: Cursor
This commit is contained in:
parent
ba3836f00f
commit
4a23b715a2
498 changed files with 2760 additions and 2200 deletions
26
runtime/extensions/webhooks/index.py
Normal file
26
runtime/extensions/webhooks/index.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from .config import resolve_webhooks_plugin_config
|
||||
from .http import TaskFlowWebhookTarget, create_taskflow_webhook_request_handler
|
||||
|
||||
|
||||
def register_webhook_routes(api) -> None:
|
||||
routes = resolve_webhooks_plugin_config(plugin_config=getattr(api, "plugin_config", {}) or {})
|
||||
if not routes:
|
||||
return
|
||||
targets_by_path: dict[str, list[TaskFlowWebhookTarget]] = {}
|
||||
handler = create_taskflow_webhook_request_handler(cfg=getattr(api, "config", {}) or {}, targets_by_path=targets_by_path)
|
||||
for route in routes:
|
||||
task_flow = api.runtime.task_flow.bind_session(session_key=route.session_key)
|
||||
target = TaskFlowWebhookTarget(
|
||||
route_id=route.route_id,
|
||||
path=route.path,
|
||||
secret_input=route.secret,
|
||||
secret_config_path=f"plugins.entries.webhooks.routes.{route.route_id}.secret",
|
||||
default_controller_id=route.controller_id,
|
||||
task_flow=task_flow,
|
||||
)
|
||||
targets_by_path.setdefault(target.path, []).append(target)
|
||||
api.register_http_route(path=target.path, auth="plugin", match="exact", replace_existing=True, handler=handler)
|
||||
api.logger.info(f"[webhooks] registered route {route.route_id} on {route.path} for session {route.session_key}")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue