fix(v13): V13 审计 6 项修复 — TrajectoryRecorder注册 + industryStore接入 + 知识搜索 + webhook标注 + structured UI + persistent注释

FIX-01: TrajectoryRecorderMiddleware 注册到 create_middleware_chain() (@650优先级)
FIX-02: industryStore 接入 ButlerPanel 行业专长展示 + 自动拉取
FIX-03: 桌面端知识库搜索 saas-knowledge mixin + VikingPanel SaaS KB UI
FIX-04: webhook 迁移标注 deprecated + 添加 down migration 注释
FIX-05: Admin Knowledge 添加结构化数据 Tab (CRUD + 行浏览)
FIX-06: PersistentMemoryStore 精化 dead_code 标注 (完整迁移留后续)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-13 01:34:08 +08:00
parent c048cb215f
commit c167ea4ea5
11 changed files with 383 additions and 3 deletions

View File

@@ -353,6 +353,14 @@ impl Kernel {
chain.register(Arc::new(mw));
}
// Trajectory recorder — record agent loop events for Hermes analysis
{
use std::sync::Arc;
let tstore = zclaw_memory::trajectory_store::TrajectoryStore::new(self.memory.pool());
let mw = zclaw_runtime::middleware::trajectory_recorder::TrajectoryRecorderMiddleware::new(Arc::new(tstore));
chain.register(Arc::new(mw));
}
// Only return Some if we actually registered middleware
if chain.is_empty() {
None

View File

@@ -21,6 +21,14 @@ impl MemoryStore {
Ok(store)
}
/// Get a clone of the underlying SQLite pool.
///
/// Used by subsystems (e.g. `TrajectoryStore`) that need to share the
/// same database connection pool for their own tables.
pub fn pool(&self) -> SqlitePool {
self.pool.clone()
}
/// Ensure the parent directory for the database file exists
fn ensure_database_dir(database_url: &str) -> Result<()> {
// Parse SQLite URL to extract file path

View File

@@ -1,3 +1,7 @@
-- NOTE: DEPRECATED — These tables are defined but NOT consumed by any Rust code.
-- Kept for schema compatibility. Will be removed in a future cleanup pass.
-- See: V13 audit FIX-04
-- Webhook subscriptions: external endpoints that receive event notifications
CREATE TABLE IF NOT EXISTS webhook_subscriptions (
id TEXT PRIMARY KEY,
@@ -26,3 +30,10 @@ CREATE TABLE IF NOT EXISTS webhook_deliveries (
CREATE INDEX IF NOT EXISTS idx_webhook_subscriptions_account ON webhook_subscriptions(account_id);
CREATE INDEX IF NOT EXISTS idx_webhook_subscriptions_events ON webhook_subscriptions USING gin(events);
CREATE INDEX IF NOT EXISTS idx_webhook_deliveries_pending ON webhook_deliveries(subscription_id) WHERE delivered_at IS NULL;
-- === DOWN MIGRATION ===
-- DROP INDEX IF EXISTS idx_webhook_deliveries_pending;
-- DROP INDEX IF EXISTS idx_webhook_subscriptions_events;
-- DROP INDEX IF EXISTS idx_webhook_subscriptions_account;
-- DROP TABLE IF EXISTS webhook_deliveries;
-- DROP TABLE IF EXISTS webhook_subscriptions;