fix(运行时): 将插件路径匹配移到宿主

新增宿主侧精确路径匹配和插件级 match.paths 配置。\n按请求路径固定插件会话链,移除 Lua 插件内的路径判断与 bypass 状态,并迁移现有插件配置和测试。
This commit is contained in:
starrrLight committed 2026-10-15 15:49:05 +08:00
1 parent f905aa22cc
commit d1f5f69454
12 files changed
+126 -200

No files matched your search

+8 -4
View File
@@ -21,6 +21,8 @@ llm:
plugins:
- id: network-review
file: plugins/network_review.lua
match:
paths: [/chat/stream]
network:
allow:
- domain: review.example.com # 本地联调改 mock-review.local
@@ -32,28 +34,30 @@ plugins:
url: https://review.example.com/check # 本地联调改 http://mock-review.local:8001/check
fields: [messages]
headers: {x-api-key: "injected-by-admin"}
paths: [/chat/stream]
- id: response-guard
file: plugins/response_guard.lua
match:
paths: [/chat/stream]
llm: {allow: [guard_model]}
config:
model: guard_model # 必须与 llm 注册的 id 一致
content_path: content
paths: [/chat/stream]
- id: request-rewrite
file: plugins/request_rewrite.lua
match:
paths: [/chat/stream]
config:
prefix: "[checked] "
paths: [/chat/stream]
- id: stream-redact
file: plugins/stream_redact.lua
match:
paths: [/chat/stream]
config:
text_event: text_delta
content_path: content
terminal_error_events: [run_error]
control_event_names: [heartbeat, run_started, run_finished, run_error, run_completed]
max_buffer_bytes: 262144
paths: [/chat/stream]