diff --git a/app/src-tauri/src/commands/http.rs b/app/src-tauri/src/commands/http.rs index c9d03ee..c99e11c 100644 --- a/app/src-tauri/src/commands/http.rs +++ b/app/src-tauri/src/commands/http.rs @@ -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; diff --git a/app/src-tauri/src/commands/memory.rs b/app/src-tauri/src/commands/memory.rs index 8dc25c8..98dd034 100644 --- a/app/src-tauri/src/commands/memory.rs +++ b/app/src-tauri/src/commands/memory.rs @@ -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; diff --git a/app/src-tauri/src/commands/mod.rs b/app/src-tauri/src/commands/mod.rs index bc4d53d..fbc595e 100644 --- a/app/src-tauri/src/commands/mod.rs +++ b/app/src-tauri/src/commands/mod.rs @@ -5,4 +5,3 @@ pub mod agent; pub mod http; pub mod memory; pub mod onboarding; -pub mod wiki; diff --git a/app/src-tauri/src/commands/wiki.rs b/app/src-tauri/src/commands/wiki.rs deleted file mode 100644 index bf27460..0000000 --- a/app/src-tauri/src/commands/wiki.rs +++ /dev/null @@ -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 { - 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 { - 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 { - 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, -) -> Result { - 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 -} diff --git a/app/src-tauri/src/lib.rs b/app/src-tauri/src/lib.rs index bfb0a13..f48ae2e 100644 --- a/app/src-tauri/src/lib.rs +++ b/app/src-tauri/src/lib.rs @@ -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, diff --git a/apps/web/src/lib/tauri-bindings.test.ts b/apps/web/src/lib/tauri-bindings.test.ts index 1cd804d..13921c2 100644 --- a/apps/web/src/lib/tauri-bindings.test.ts +++ b/apps/web/src/lib/tauri-bindings.test.ts @@ -24,10 +24,6 @@ import { saveMemory, searchEntities, getIdentity, - compileWikiSection, - getWikiPages, - getWikiPage, - getWikiPageContent, isFirstLaunch, markFirstLaunchComplete, resetFirstLaunch, @@ -285,36 +281,6 @@ describe('memory + identity bindings', () => { }); }); -describe('wiki bindings', () => { - beforeEach(() => { - mockedInvoke.mockReset(); - }); - - it('compileWikiSection defaults args + invokes', async () => { - mockedInvoke.mockResolvedValue({}); - await compileWikiSection(); - expect(mockedInvoke).toHaveBeenCalledWith('compile_wiki_section', {}); - }); - - it('getWikiPages takes no args', async () => { - mockedInvoke.mockResolvedValue([]); - await getWikiPages(); - expect(mockedInvoke).toHaveBeenCalledWith('get_wiki_pages'); - }); - - it('getWikiPage passes slug', async () => { - mockedInvoke.mockResolvedValue({ slug: 's', title: 't' }); - await getWikiPage('my-slug'); - expect(mockedInvoke).toHaveBeenCalledWith('get_wiki_page', { slug: 'my-slug' }); - }); - - it('getWikiPageContent passes slug', async () => { - mockedInvoke.mockResolvedValue({ slug: 's', content: '# md' }); - await getWikiPageContent('my-slug'); - expect(mockedInvoke).toHaveBeenCalledWith('get_wiki_page_content', { slug: 'my-slug' }); - }); -}); - describe('onboarding flag bindings (A10)', () => { beforeEach(() => { mockedInvoke.mockReset(); diff --git a/apps/web/src/lib/tauri-bindings.ts b/apps/web/src/lib/tauri-bindings.ts index 11a5cf1..b78ad48 100644 --- a/apps/web/src/lib/tauri-bindings.ts +++ b/apps/web/src/lib/tauri-bindings.ts @@ -148,63 +148,6 @@ export function getIdentity(): Promise { return invoke('get_identity'); } -// ─── wiki commands (A4) ──────────────────────────────────────────────────── -// CC Sesija A §2.1 Task A4. Reads compiled wiki pages from sidecar (sourced -// from per-workspace MindDB by packages/wiki-compiler) + triggers compile. - -/** - * One entry in the wiki page index from GET /api/wiki/pages. Shape varies by - * page type (entity/concept/synthesis); raw fields preserved for the React - * adapter to project into typed UI cells. - */ -export interface WikiPageMeta { - slug: string; - title?: string; - type?: string; - [key: string]: unknown; -} - -export interface WikiPageContent { - slug: string; - content: string; - [key: string]: unknown; -} - -/** List all compiled wiki pages (slug + metadata, no body). */ -export function getWikiPages(): Promise { - return invoke('get_wiki_pages'); -} - -/** Fetch a single wiki page's metadata by slug. */ -export function getWikiPage(slug: string): Promise { - return invoke('get_wiki_page', { slug }); -} - -/** Fetch the full markdown content for a wiki page by slug. */ -export function getWikiPageContent(slug: string): Promise { - return invoke('get_wiki_page_content', { slug }); -} - -export interface CompileWikiArgs { - workspaceId?: string; -} - -/** - * Sidecar POST /api/wiki/compile triggers wiki-compiler. Response is a summary - * envelope from packages/wiki-compiler — exact shape depends on compiler version - * (page counts, entity counts, gap reports). Raw shape preserved. - */ -export interface CompileWikiResponse { - pageCount?: number; - entityCount?: number; - gaps?: number; - [key: string]: unknown; -} - -export function compileWikiSection(args: CompileWikiArgs = {}): Promise { - return invoke('compile_wiki_section', args as unknown as Record); -} - // ─── run_agent_query (streaming) ─────────────────────────────────────────── // CC Sesija A §2.1 Task A3.