refactor(app): remove the wiki Tauri commands (P2.2)

get_wiki_pages, get_wiki_page, get_wiki_page_content and
compile_wiki_section proxied to the sidecar's /api/wiki routes, which
served the wiki-compiler package and left with the old memory engine in
P1.5. No screen called them. Remove the commands, their TypeScript
bindings and tests. cargo check and the 32 Rust tests pass.
This commit is contained in:
shumeiko.it
2026-11-01 00:42:39 +01:00
parent 2edfd01e6e
commit 4c1b404339
7 changed files with 7 additions and 183 deletions

View File

@@ -1,8 +1,5 @@
// CC Sesija A §2.1 Task A4 — shared HTTP helpers for sidecar-proxy commands. // Shared HTTP helpers for sidecar-proxy commands. Command modules import
// // from here rather than reimplementing.
// 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.
use serde_json::Value; use serde_json::Value;

View File

@@ -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). // Architecture: thin HTTP proxies to local sidecar (Fastify, port from ServiceState).
// Tauri Rust shell intentionally has no direct sqlite/sqlite-vec dependencies — all // Tauri Rust shell intentionally has no direct SQLite dependencies — all memory
// substrate access goes through the sidecar so that the storage layer (FrameStore, // access goes through the sidecar so that the storage layer lives in one process.
// HybridSearch, KnowledgeGraph, wiki-compiler) 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 // recall_memory → GET /api/memory/search
// save_memory → POST /api/memory/frames // save_memory → POST /api/memory/frames
// search_entities → GET /api/memory/graph // search_entities → GET /api/memory/graph
// get_identity → GET /api/identity (route not yet in sidecar — graceful 404 // get_identity → GET /api/identity (route not yet in sidecar — graceful 404
// → placeholder; A1.1 follow-up adds route) // → placeholder; A1.1 follow-up adds route)
// //
// Shared HTTP helpers extracted to commands/http.rs at A4 (rule of two — wiki.rs is // Shared HTTP helpers live in commands/http.rs.
// the second consumer).
use serde_json::{json, Value}; use serde_json::{json, Value};
use tauri::State; use tauri::State;

View File

@@ -5,4 +5,3 @@ pub mod agent;
pub mod http; pub mod http;
pub mod memory; pub mod memory;
pub mod onboarding; pub mod onboarding;
pub mod wiki;

View File

@@ -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
}

View File

@@ -49,10 +49,6 @@ pub fn run() {
commands::memory::save_memory, commands::memory::save_memory,
commands::memory::search_entities, commands::memory::search_entities,
commands::memory::get_identity, 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::agent::run_agent_query,
commands::onboarding::is_first_launch, commands::onboarding::is_first_launch,
commands::onboarding::mark_first_launch_complete, commands::onboarding::mark_first_launch_complete,

View File

@@ -24,10 +24,6 @@ import {
saveMemory, saveMemory,
searchEntities, searchEntities,
getIdentity, getIdentity,
compileWikiSection,
getWikiPages,
getWikiPage,
getWikiPageContent,
isFirstLaunch, isFirstLaunch,
markFirstLaunchComplete, markFirstLaunchComplete,
resetFirstLaunch, 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)', () => { describe('onboarding flag bindings (A10)', () => {
beforeEach(() => { beforeEach(() => {
mockedInvoke.mockReset(); mockedInvoke.mockReset();

View File

@@ -148,63 +148,6 @@ export function getIdentity(): Promise<IdentityResponse> {
return invoke<IdentityResponse>('get_identity'); return invoke<IdentityResponse>('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<WikiPageMeta[] | { pages: WikiPageMeta[] }> {
return invoke<WikiPageMeta[] | { pages: WikiPageMeta[] }>('get_wiki_pages');
}
/** Fetch a single wiki page's metadata by slug. */
export function getWikiPage(slug: string): Promise<WikiPageMeta> {
return invoke<WikiPageMeta>('get_wiki_page', { slug });
}
/** Fetch the full markdown content for a wiki page by slug. */
export function getWikiPageContent(slug: string): Promise<WikiPageContent> {
return invoke<WikiPageContent>('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<CompileWikiResponse> {
return invoke<CompileWikiResponse>('compile_wiki_section', args as unknown as Record<string, unknown>);
}
// ─── run_agent_query (streaming) ─────────────────────────────────────────── // ─── run_agent_query (streaming) ───────────────────────────────────────────
// CC Sesija A §2.1 Task A3. // CC Sesija A §2.1 Task A3.