chore: checkpoint turso and ai runtime work

This commit is contained in:
Agent Board
2026-07-03 23:20:16 +08:00
parent a75b3d11f9
commit 36d027a4a1
67 changed files with 4224 additions and 914 deletions
@@ -57,10 +57,6 @@ fn doc_tools() -> Vec<Value> {
fn knowledge_rag_tools() -> Vec<Value> {
vec![
knowledge_rag_status_tool(),
weknora_search_tool(),
weknora_list_sources_tool(),
weknora_get_source_status_tool(),
weknora_open_reference_tool(),
knowledge_rag_query_tool(),
knowledge_rag_section_context_tool(),
knowledge_rag_open_reference_tool(),
@@ -359,7 +355,7 @@ fn knowledge_rag_status_tool() -> Value {
}
json!({
"name": "mnote.knowledge_rag.status",
"description": "查看当前资料库 provider 状态、dashboard 地址、source registry 和同步状态。默认 provider 是 WeKnoraLightRAG 仅作为 legacy fallback。",
"description": "查看当前知识库 provider 状态、dashboard 地址、source registry 和同步状态。默认 provider 是 RAGFlowWeKnora/LightRAG 仅作为 legacy fallback。",
"schemaVersion": TOOL_SCHEMA_VERSION,
"capabilityScope": ["knowledge_rag.read", "evidence.read"],
"status": "available",
@@ -371,114 +367,6 @@ fn knowledge_rag_status_tool() -> Value {
})
}
fn weknora_scope_properties() -> Value {
let mut properties = base_identity_properties();
if let Value::Object(map) = &mut properties {
map.insert("rootUri".into(), json!({ "type": "string" }));
map.insert("scope".into(), json!({ "type": "object" }));
map.insert(
"allowlist".into(),
json!({ "type": "array", "items": { "type": "string" } }),
);
map.insert("allowedRoots".into(), json!({ "type": "array" }));
map.insert("aiAccessScope".into(), json!({ "type": "object" }));
map.insert(
"sourcePaths".into(),
json!({ "type": "array", "items": { "type": "string" } }),
);
}
properties
}
fn weknora_search_tool() -> Value {
let mut properties = weknora_scope_properties();
if let Value::Object(map) = &mut properties {
map.insert("query".into(), json!({ "type": "string" }));
map.insert("topK".into(), json!({ "type": "integer", "default": 10 }));
map.insert(
"includeChunkContent".into(),
json!({ "type": "boolean", "default": true }),
);
}
json!({
"name": "mnote.weknora.search",
"description": "只读调用 WeKnora 检索。必须带 rootUri 和 scope/allowlist,返回 provider ids、MNote source registry 映射以及 locatorDegraded;不要把 WeKnora filename/chunk id 当成本地 path。",
"schemaVersion": TOOL_SCHEMA_VERSION,
"capabilityScope": ["knowledge_rag.read", "evidence.read"],
"status": "available",
"annotations": tool_annotations(true, false, true, false),
"inputSchema": {
"type": "object",
"required": ["workspaceId", "rootUri", "query"],
"properties": properties
}
})
}
fn weknora_list_sources_tool() -> Value {
json!({
"name": "mnote.weknora.list_sources",
"description": "只读列出 MNote source registry 与 WeKnora provider 状态。必须带 rootUri 和 scope/allowlist。",
"schemaVersion": TOOL_SCHEMA_VERSION,
"capabilityScope": ["knowledge_rag.read", "evidence.read"],
"status": "available",
"annotations": tool_annotations(true, false, true, false),
"inputSchema": {
"type": "object",
"required": ["workspaceId", "rootUri"],
"properties": weknora_scope_properties()
}
})
}
fn weknora_get_source_status_tool() -> Value {
let mut properties = weknora_scope_properties();
if let Value::Object(map) = &mut properties {
map.insert("sourcePath".into(), json!({ "type": "string" }));
map.insert("providerKnowledgeId".into(), json!({ "type": "string" }));
map.insert("providerSourceId".into(), json!({ "type": "string" }));
}
json!({
"name": "mnote.weknora.get_source_status",
"description": "只读查询某个 MNote source 或 WeKnora provider knowledge id 的映射状态。必须带 rootUri 和 scope/allowlist。",
"schemaVersion": TOOL_SCHEMA_VERSION,
"capabilityScope": ["knowledge_rag.read", "evidence.read"],
"status": "available",
"annotations": tool_annotations(true, false, true, false),
"inputSchema": {
"type": "object",
"required": ["workspaceId", "rootUri"],
"properties": properties
}
})
}
fn weknora_open_reference_tool() -> Value {
let mut properties = weknora_scope_properties();
if let Value::Object(map) = &mut properties {
map.insert("reference".into(), json!({ "type": "object" }));
map.insert(
"providerKnowledgeBaseId".into(),
json!({ "type": "string" }),
);
map.insert("providerKnowledgeId".into(), json!({ "type": "string" }));
map.insert("providerChunkId".into(), json!({ "type": "string" }));
}
json!({
"name": "mnote.weknora.open_reference",
"description": "只读把 WeKnora reference 映射为 MNote open action。provider ids 独立返回;未命中 source registry 时必须视为 locatorDegraded。",
"schemaVersion": TOOL_SCHEMA_VERSION,
"capabilityScope": ["knowledge_rag.read", "evidence.read"],
"status": "available",
"annotations": tool_annotations(true, false, true, false),
"inputSchema": {
"type": "object",
"required": ["workspaceId", "rootUri", "reference"],
"properties": properties
}
})
}
fn knowledge_rag_query_tool() -> Value {
let mut properties = base_identity_properties();
if let Value::Object(map) = &mut properties {
@@ -517,7 +405,7 @@ fn knowledge_rag_query_tool() -> Value {
}
json!({
"name": "mnote.knowledge_rag.query",
"description": "向当前资料库 provider 提问,返回 provider 原始结果和经 MNote registry 映射、sourcePaths 后过滤的 references/citations。默认 provider 是 WeKnoraLightRAG 仅 legacy fallback。用户要求链接、来源、引用或证据时优先调用;返回的 citationMarkdown 由 MNote 前端自动追加成可点击来源定位,agent 不应在最终回答中手写 /documents、mnote:// 或搜索引擎包装链接。",
"description": "向当前知识库 provider 提问,返回 provider 原始结果和经 MNote registry 映射、sourcePaths 后过滤的 references/citations。默认 provider 是 RAGFlowWeKnora/LightRAG 仅 legacy fallback。用户要求链接、来源、引用或证据时优先调用;返回的 citationMarkdown 由 MNote 前端自动追加成可点击来源定位,agent 不应在最终回答中手写 /documents、mnote:// 或搜索引擎包装链接。",
"schemaVersion": TOOL_SCHEMA_VERSION,
"capabilityScope": ["knowledge_rag.read", "evidence.read"],
"status": "available",