Merge P2.2 part 2: remove the excluded packages and scrub internal names
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
// CC Sesija A §2.1 Task A4 — shared HTTP helpers for sidecar-proxy commands.
|
||||
//
|
||||
// Extracted from commands/memory.rs at A4 because wiki.rs becomes the second
|
||||
// consumer (rule of two). Future command modules (onboarding A10+, agent.rs
|
||||
// where applicable) should also import from here rather than reimplementing.
|
||||
// Shared HTTP helpers for sidecar-proxy commands. Command modules import
|
||||
// from here rather than reimplementing.
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
// CC Sesija A §2.1 Tasks A1 + A4 — memory + KG + identity Tauri commands.
|
||||
// Memory, knowledge graph and identity Tauri commands.
|
||||
//
|
||||
// Architecture: thin HTTP proxies to local sidecar (Fastify, port from ServiceState).
|
||||
// Tauri Rust shell intentionally has no direct sqlite/sqlite-vec dependencies — all
|
||||
// substrate access goes through the sidecar so that the storage layer (FrameStore,
|
||||
// HybridSearch, KnowledgeGraph, wiki-compiler) lives in one process.
|
||||
// Tauri Rust shell intentionally has no direct SQLite dependencies — all memory
|
||||
// access goes through the sidecar so that the storage layer lives in one process.
|
||||
//
|
||||
// Command surface (4 commands here; wiki commands moved to commands/wiki.rs at A4):
|
||||
// Command surface:
|
||||
// recall_memory → GET /api/memory/search
|
||||
// save_memory → POST /api/memory/frames
|
||||
// search_entities → GET /api/memory/graph
|
||||
// get_identity → GET /api/identity (route not yet in sidecar — graceful 404
|
||||
// → placeholder; A1.1 follow-up adds route)
|
||||
//
|
||||
// Shared HTTP helpers extracted to commands/http.rs at A4 (rule of two — wiki.rs is
|
||||
// the second consumer).
|
||||
// Shared HTTP helpers live in commands/http.rs.
|
||||
|
||||
use serde_json::{json, Value};
|
||||
use tauri::State;
|
||||
|
||||
@@ -5,4 +5,3 @@ pub mod agent;
|
||||
pub mod http;
|
||||
pub mod memory;
|
||||
pub mod onboarding;
|
||||
pub mod wiki;
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
// CC Sesija A §2.1 Task A4 — wiki Tauri commands.
|
||||
//
|
||||
// Brief: briefs/2026-04-30-cc-sesija-A-waggle-apps-web-integration.md §2.1 Task A4
|
||||
//
|
||||
// Read-side wiki commands proxying to the sidecar's /api/wiki/* routes which read
|
||||
// from the per-workspace MindDB (FrameStore + KnowledgeGraph). The compile route
|
||||
// triggers a fresh wiki-compiler pass for the active workspace.
|
||||
//
|
||||
// Brief §2.1 Task A4 says "reads packages/wiki-compiler output direktno iz hive-mind
|
||||
// frame store" — direktno here means "without intermediate cache" not "direct
|
||||
// sqlite from Rust" (Tauri shell intentionally has no sqlite deps; substrate stays
|
||||
// in the sidecar process — see commands/memory.rs header for full rationale).
|
||||
//
|
||||
// Note: compile_wiki_section was previously colocated in commands/memory.rs (A1).
|
||||
// A4 moves it here for cohesion. Tauri command surface is unchanged; lib.rs
|
||||
// invoke_handler entry just rewires from `memory::compile_wiki_section` to
|
||||
// `wiki::compile_wiki_section`.
|
||||
|
||||
use serde_json::{json, Value};
|
||||
use tauri::State;
|
||||
|
||||
use crate::commands::http::{http_get, http_post, parse_json, sidecar_url};
|
||||
use crate::service::ServiceState;
|
||||
|
||||
/// List all compiled wiki pages for the active workspace. Returns the page
|
||||
/// index (slugs + titles + metadata); call get_wiki_page_content for the body.
|
||||
#[tauri::command]
|
||||
pub async fn get_wiki_pages(state: State<'_, ServiceState>) -> Result<Value, String> {
|
||||
let url = sidecar_url(state.verified_port()?, "/api/wiki/pages");
|
||||
let resp = http_get(&url).await?;
|
||||
parse_json(resp).await
|
||||
}
|
||||
|
||||
/// Fetch a single wiki page's metadata (title, type, source frame ids, etc.)
|
||||
/// without the full markdown body. Use get_wiki_page_content for the body.
|
||||
#[tauri::command]
|
||||
pub async fn get_wiki_page(state: State<'_, ServiceState>, slug: String) -> Result<Value, String> {
|
||||
let url = sidecar_url(
|
||||
state.verified_port()?,
|
||||
&format!("/api/wiki/pages/{}", urlencoding::encode(&slug)),
|
||||
);
|
||||
let resp = http_get(&url).await?;
|
||||
parse_json(resp).await
|
||||
}
|
||||
|
||||
/// Fetch the full markdown content for a wiki page by slug. Returns whatever
|
||||
/// the sidecar emits (typically `{ slug, content, ... }`).
|
||||
#[tauri::command]
|
||||
pub async fn get_wiki_page_content(
|
||||
state: State<'_, ServiceState>,
|
||||
slug: String,
|
||||
) -> Result<Value, String> {
|
||||
let url = sidecar_url(
|
||||
state.verified_port()?,
|
||||
&format!("/api/wiki/pages/{}/content", urlencoding::encode(&slug)),
|
||||
);
|
||||
let resp = http_get(&url).await?;
|
||||
parse_json(resp).await
|
||||
}
|
||||
|
||||
/// Trigger wiki compilation for the active or specified workspace. Returns the
|
||||
/// compilation summary (page count, entities, gaps) from packages/wiki-compiler.
|
||||
#[tauri::command]
|
||||
pub async fn compile_wiki_section(
|
||||
state: State<'_, ServiceState>,
|
||||
workspace_id: Option<String>,
|
||||
) -> Result<Value, String> {
|
||||
let mut body = json!({});
|
||||
if let Some(ws) = workspace_id {
|
||||
body["workspace"] = json!(ws);
|
||||
}
|
||||
let url = sidecar_url(state.verified_port()?, "/api/wiki/compile");
|
||||
let resp = http_post(&url, &body).await?;
|
||||
parse_json(resp).await
|
||||
}
|
||||
@@ -49,10 +49,6 @@ pub fn run() {
|
||||
commands::memory::save_memory,
|
||||
commands::memory::search_entities,
|
||||
commands::memory::get_identity,
|
||||
commands::wiki::get_wiki_pages,
|
||||
commands::wiki::get_wiki_page,
|
||||
commands::wiki::get_wiki_page_content,
|
||||
commands::wiki::compile_wiki_section,
|
||||
commands::agent::run_agent_query,
|
||||
commands::onboarding::is_first_launch,
|
||||
commands::onboarding::mark_first_launch_complete,
|
||||
|
||||
@@ -1039,7 +1039,7 @@ mod tests {
|
||||
std::fs::create_dir_all(&resources).expect("creates temp resources");
|
||||
std::fs::write(resources.join("service.js"), "console.log('ok')").expect("writes service");
|
||||
|
||||
let script = resolve_service_script(Some(&root), Path::new("D:/Projects/waggle-os"))
|
||||
let script = resolve_service_script(Some(&root), Path::new("D:/work/waggle-os"))
|
||||
.expect("bundled script resolves");
|
||||
|
||||
assert_eq!(script.kind, ServiceScriptKind::Bundled);
|
||||
|
||||
Reference in New Issue
Block a user