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:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -148,63 +148,6 @@ export function getIdentity(): Promise<IdentityResponse> {
|
||||
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) ───────────────────────────────────────────
|
||||
// CC Sesija A §2.1 Task A3.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user