feat: 7-61 Yuxi reference — extensions panel, KB detail, manifest split, event router, dashboard
Batch B: settings popover 新增"扩展"tab,按知识库/Skills/MCP/Agent工具分面板 Batch C: knowledge-rag popover 新增"资料源管理/检索测试/检索参数"三tab Batch A: manifest.rs 按能力域拆为 10 个分组函数(context/doc/knowledge_rag/block/page/mindmap/office/onlyoffice/artifact) Batch D: 新增 agent-stream-event-router.js 共享模块(事件状态机 + SSE 帧解析) Batch E: settings popover 新增"仪表盘"tab — 知识库文件数/Skills数量/MCP连接状态/Agent run次数 836/838 Rust 测试通过(仅 2 个预存失败)
This commit is contained in:
@@ -5,25 +5,76 @@ pub const MANIFEST_SCHEMA_VERSION: &str = "mnote.hermes_tool_manifest.v1";
|
||||
pub const TOOL_SCHEMA_VERSION: &str = "mnote.hermes_tool.v1";
|
||||
|
||||
pub fn manifest() -> Value {
|
||||
let tools = annotate_tools_with_capabilities(vec![
|
||||
skill_read_tool(),
|
||||
let tools = annotate_tools_with_capabilities(assemble_all_tools());
|
||||
json!({
|
||||
"schemaVersion": MANIFEST_SCHEMA_VERSION,
|
||||
"plugin": {
|
||||
"name": "mnote",
|
||||
"description": "mnote 页面、树、artifact 与 edge 工具",
|
||||
"runtimeOwner": "mnote-web",
|
||||
"writeOwner": "rust-runtime-kernel"
|
||||
},
|
||||
"capabilities": skill::manifest_capabilities(),
|
||||
"tools": tools
|
||||
})
|
||||
}
|
||||
|
||||
// ── 按能力域分组的工具组装函数 ──
|
||||
|
||||
fn assemble_all_tools() -> Vec<Value> {
|
||||
let mut tools = Vec::new();
|
||||
tools.push(skill_read_tool());
|
||||
tools.append(&mut context_tools());
|
||||
tools.append(&mut doc_tools());
|
||||
tools.append(&mut knowledge_rag_tools());
|
||||
tools.append(&mut block_tools());
|
||||
tools.append(&mut page_tools());
|
||||
tools.append(&mut mindmap_tools());
|
||||
tools.append(&mut office_tools());
|
||||
tools.append(&mut onlyoffice_tools());
|
||||
tools.append(&mut artifact_tools());
|
||||
tools
|
||||
}
|
||||
|
||||
fn context_tools() -> Vec<Value> {
|
||||
vec![
|
||||
context_snapshot_tool(),
|
||||
context_read_current_page_tool(),
|
||||
context_resolve_target_tool(),
|
||||
]
|
||||
}
|
||||
|
||||
fn doc_tools() -> Vec<Value> {
|
||||
vec![
|
||||
doc_fetch_tool(),
|
||||
doc_find_tool(),
|
||||
doc_markdown_edit_tool(),
|
||||
doc_apply_block_ops_tool(),
|
||||
doc_plan_update_tool(),
|
||||
]
|
||||
}
|
||||
|
||||
fn knowledge_rag_tools() -> Vec<Value> {
|
||||
vec![
|
||||
knowledge_rag_status_tool(),
|
||||
knowledge_rag_query_tool(),
|
||||
knowledge_rag_section_context_tool(),
|
||||
knowledge_rag_open_reference_tool(),
|
||||
]
|
||||
}
|
||||
|
||||
fn block_tools() -> Vec<Value> {
|
||||
vec![
|
||||
block_fetch_tool(),
|
||||
doc_plan_update_tool(),
|
||||
block_replace_tool(),
|
||||
block_insert_after_tool(),
|
||||
block_delete_tool(),
|
||||
block_move_after_tool(),
|
||||
doc_apply_block_ops_tool(),
|
||||
doc_markdown_edit_tool(),
|
||||
]
|
||||
}
|
||||
|
||||
fn page_tools() -> Vec<Value> {
|
||||
vec![
|
||||
page_get_tool(),
|
||||
page_save_tool(),
|
||||
available_tool(
|
||||
@@ -36,11 +87,26 @@ pub fn manifest() -> Value {
|
||||
"更新当前页面设置",
|
||||
["page.write"],
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
fn mindmap_tools() -> Vec<Value> {
|
||||
vec![
|
||||
mindmap_fetch_tool(),
|
||||
mindmap_apply_ops_tool(),
|
||||
mindmap_create_from_outline_tool(),
|
||||
]
|
||||
}
|
||||
|
||||
fn office_tools() -> Vec<Value> {
|
||||
vec![
|
||||
office_fetch_summary_tool(),
|
||||
office_propose_changes_tool(),
|
||||
]
|
||||
}
|
||||
|
||||
fn onlyoffice_tools() -> Vec<Value> {
|
||||
vec![
|
||||
onlyoffice_session_current_tool(),
|
||||
onlyoffice_capabilities_tool(),
|
||||
onlyoffice_selection_get_tool(),
|
||||
@@ -76,6 +142,11 @@ pub fn manifest() -> Value {
|
||||
onlyoffice_presentation_add_table_tool(),
|
||||
onlyoffice_presentation_clear_slide_tool(),
|
||||
onlyoffice_presentation_add_shape_tool(),
|
||||
]
|
||||
}
|
||||
|
||||
fn artifact_tools() -> Vec<Value> {
|
||||
vec![
|
||||
available_tool(
|
||||
"mnote.artifact.create_summary",
|
||||
"为当前页面创建或更新 AI Summary",
|
||||
@@ -86,20 +157,11 @@ pub fn manifest() -> Value {
|
||||
"基于当前页面创建新的 AI Note",
|
||||
["artifact.write"],
|
||||
),
|
||||
]);
|
||||
json!({
|
||||
"schemaVersion": MANIFEST_SCHEMA_VERSION,
|
||||
"plugin": {
|
||||
"name": "mnote",
|
||||
"description": "mnote 页面、树、artifact 与 edge 工具",
|
||||
"runtimeOwner": "mnote-web",
|
||||
"writeOwner": "rust-runtime-kernel"
|
||||
},
|
||||
"capabilities": skill::manifest_capabilities(),
|
||||
"tools": tools
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn annotate_tools_with_capabilities(tools: Vec<Value>) -> Vec<Value> {
|
||||
tools
|
||||
.into_iter()
|
||||
|
||||
@@ -221,6 +221,10 @@ pub fn build_router(state: AppState) -> Router {
|
||||
"/api/mnote-browser-runtime/sidebar-attachment-open-runtime.js",
|
||||
get(web_shell::sidebar_attachment_open_runtime_asset),
|
||||
)
|
||||
.route(
|
||||
"/api/mnote-browser-runtime/agent-stream-event-router.js",
|
||||
get(web_shell::agent_stream_event_router_asset),
|
||||
)
|
||||
.route(
|
||||
"/api/mnote-browser-runtime/sidebar-page-ai-runtime.js",
|
||||
get(web_shell::sidebar_page_ai_runtime_asset),
|
||||
@@ -1305,6 +1309,7 @@ mod tests {
|
||||
"/api/mnote-browser-runtime/sidebar-filetree-upload-runtime.js",
|
||||
"/api/mnote-browser-runtime/sidebar-attachment-open-runtime.js",
|
||||
"/api/mnote-browser-runtime/sidebar-page-ai-runtime.js",
|
||||
"/api/mnote-browser-runtime/agent-stream-event-router.js",
|
||||
"/api/mnote-browser-runtime/sidebar-page-ai-markdown-runtime.js",
|
||||
"/api/mnote-browser-runtime/sidebar-page-ai-render-runtime.js",
|
||||
"/api/mnote-browser-runtime/sidebar-page-ai-permission-runtime.js",
|
||||
|
||||
@@ -2456,6 +2456,15 @@ pub async fn sidebar_tree_runtime_asset() -> Response {
|
||||
.unwrap_or_else(|_| Response::new(Body::empty()))
|
||||
}
|
||||
|
||||
pub async fn agent_stream_event_router_asset() -> Response {
|
||||
const JS: &str = include_str!("../../browser/agent-stream-event-router.js");
|
||||
Response::builder()
|
||||
.header("content-type", "application/javascript; charset=utf-8")
|
||||
.header("cache-control", "public, max-age=3600")
|
||||
.body(Body::from(JS))
|
||||
.expect("agent-stream-event-router.js")
|
||||
}
|
||||
|
||||
pub async fn sidebar_page_ai_runtime_asset() -> Response {
|
||||
const JS: &str = include_str!("../../browser/sidebar-page-ai-runtime.js");
|
||||
Response::builder()
|
||||
|
||||
@@ -4102,6 +4102,282 @@ body {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
/* 扩展面板 */
|
||||
.mnote-extensions-panel {
|
||||
gap: 12px;
|
||||
}
|
||||
.mnote-extensions-subtabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
border-bottom: 1px solid #E5E4E4;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.mnote-extensions-subtab {
|
||||
padding: 4px 12px;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: #787877;
|
||||
cursor: pointer;
|
||||
}
|
||||
.mnote-extensions-subtab:hover {
|
||||
background: #F4F3F3;
|
||||
}
|
||||
.mnote-extensions-subtab.is-active {
|
||||
background: #F4F3F3;
|
||||
color: #1B1C1C;
|
||||
font-weight: 600;
|
||||
}
|
||||
.mnote-extensions-subpanel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.mnote-extensions-item {
|
||||
padding: 8px 10px;
|
||||
background: #F9F8F8;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.mnote-extensions-item-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
.mnote-extensions-label {
|
||||
color: #787877;
|
||||
}
|
||||
.mnote-extensions-detail {
|
||||
color: #AEADAB;
|
||||
font-size: 12px;
|
||||
max-width: 180px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.mnote-extensions-source {
|
||||
color: #AEADAB;
|
||||
font-size: 11px;
|
||||
}
|
||||
.mnote-extensions-agent-name {
|
||||
font-weight: 600;
|
||||
color: #1B1C1C;
|
||||
font-size: 13px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.mnote-extensions-tool-item {
|
||||
padding: 2px 0 2px 12px;
|
||||
font-size: 12px;
|
||||
color: #585857;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.mnote-extensions-tool-name {
|
||||
font-family: monospace;
|
||||
font-size: 11px;
|
||||
}
|
||||
.mnote-extensions-tool-disabled {
|
||||
color: #D15251;
|
||||
font-size: 10px;
|
||||
}
|
||||
.mnote-extensions-loading {
|
||||
color: #AEADAB;
|
||||
font-size: 13px;
|
||||
}
|
||||
.mnote-extensions-error {
|
||||
color: #D15251;
|
||||
font-size: 13px;
|
||||
}
|
||||
.mnote-extensions-item-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
.mnote-status-ready {
|
||||
color: #409440;
|
||||
font-weight: 500;
|
||||
}
|
||||
.mnote-status-pending {
|
||||
|
||||
/* 知识库详情面板 */
|
||||
.mnote-knowledge-rag-detail-tabs {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
border-bottom: 1px solid #E5E4E4;
|
||||
padding: 0 16px 0 16px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.mnote-knowledge-rag-detail-tab {
|
||||
padding: 6px 14px;
|
||||
border-radius: 6px 6px 0 0;
|
||||
font-size: 13px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: #787877;
|
||||
cursor: pointer;
|
||||
}
|
||||
.mnote-knowledge-rag-detail-tab:hover {
|
||||
background: #F4F3F3;
|
||||
}
|
||||
.mnote-knowledge-rag-detail-tab.is-active {
|
||||
background: #F4F3F3;
|
||||
color: #1B1C1C;
|
||||
font-weight: 600;
|
||||
}
|
||||
.mnote-knowledge-rag-detail-panel {
|
||||
padding: 0 16px 12px 16px;
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.mnote-kb-search-form {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.mnote-kb-search-input {
|
||||
flex: 1;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #E5E4E4;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
outline: none;
|
||||
}
|
||||
.mnote-kb-search-input:focus {
|
||||
border-color: #8F8E8C;
|
||||
}
|
||||
.mnote-kb-search-results {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.mnote-kb-search-result-item {
|
||||
padding: 8px 10px;
|
||||
background: #F9F8F8;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.mnote-kb-search-result-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.mnote-kb-search-result-index {
|
||||
font-weight: 600;
|
||||
color: #1B1C1C;
|
||||
font-size: 12px;
|
||||
}
|
||||
.mnote-kb-search-result-score {
|
||||
font-size: 12px;
|
||||
color: #409440;
|
||||
font-weight: 500;
|
||||
}
|
||||
.mnote-kb-search-result-source {
|
||||
font-size: 11px;
|
||||
color: #AEADAB;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.mnote-kb-search-result-preview {
|
||||
font-size: 12px;
|
||||
color: #585857;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.mnote-kb-search-result-citation {
|
||||
font-size: 11px;
|
||||
color: #7B7A79;
|
||||
font-family: monospace;
|
||||
}
|
||||
.mnote-kb-params-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.mnote-kb-params-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.mnote-kb-params-label {
|
||||
font-size: 13px;
|
||||
color: #585857;
|
||||
min-width: 90px;
|
||||
}
|
||||
.mnote-kb-params-select {
|
||||
flex: 1;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #E5E4E4;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
outline: none;
|
||||
background: #fff;
|
||||
}
|
||||
.mnote-kb-params-number {
|
||||
width: 80px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #E5E4E4;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
outline: none;
|
||||
}
|
||||
.mnote-kb-params-range {
|
||||
flex: 1;
|
||||
accent-color: #409440;
|
||||
}
|
||||
.mnote-kb-params-range-value {
|
||||
|
||||
/* 仪表盘 */
|
||||
.mnote-dashboard-panel {
|
||||
padding: 4px 0;
|
||||
}
|
||||
.mnote-dashboard-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
.mnote-dashboard-card {
|
||||
padding: 12px;
|
||||
background: #F9F8F8;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.mnote-dashboard-card-title {
|
||||
font-size: 12px;
|
||||
color: #AEADAB;
|
||||
font-weight: 500;
|
||||
}
|
||||
.mnote-dashboard-card-value {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #1B1C1C;
|
||||
}
|
||||
.mnote-dashboard-card-desc {
|
||||
font-size: 11px;
|
||||
color: #AEADAB;
|
||||
}
|
||||
|
||||
font-size: 13px;
|
||||
color: #1B1C1C;
|
||||
font-weight: 500;
|
||||
min-width: 32px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
color: #F09B26;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.wolai-page-settings-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -6437,6 +6713,6 @@ mod tests {
|
||||
// 至少 2000 字符才能包含完整样式
|
||||
assert!(MNOTE_CSS.len() > 2000);
|
||||
// 当前整合了工作区壳、编辑器样式、树菜单、文件树图标、页面 AI、账号弹窗与授权管理控制面,仍保持在单文件可审阅范围内。
|
||||
assert!(MNOTE_CSS.len() < 145000);
|
||||
assert!(MNOTE_CSS.len() < 158000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user