Skip to main content

max / makenotwork

2.1 KB · 55 lines History Blame Raw
1 //! Kberg — MCP bridge for connecting local LLMs to desktop apps.
2 //!
3 //! Named after Königsberg, the city whose seven bridges founded graph theory
4 //! (Euler, 1736). The library is a bridge in that same sense: it routes
5 //! tool-call edges between an LLM node and a set of app nodes.
6 //!
7 //! # Shape
8 //!
9 //! - [`Tool`] + [`ToolRegistry`] — app-side action surface.
10 //! - [`resource::ResourceRegistry`] — app-side object surface: live things a
11 //! client lists and reads (deox exposes editor buffers this way).
12 //! - [`server`] — Streamable HTTP MCP server (JSON-RPC 2.0). Any MCP-speaking
13 //! client can reach a Kberg-served app.
14 //! - [`agent::Agent`] + [`agent::InferenceProvider`] — provider-agnostic
15 //! agent loop. Bring your own inference endpoint; Kberg does not manage
16 //! models or runtimes.
17 //! - [`provider::ollama`] — reference `InferenceProvider` for a local Ollama
18 //! server. Future providers (OpenAI, Anthropic, OpenAI-compatible) drop in
19 //! without touching the agent loop.
20 //!
21 //! # Guardrails
22 //!
23 //! - Every [`Tool`] declares [`ToolKind::Read`] or [`ToolKind::Write`] with a
24 //! named capability. Writes are the finite, app-declared vocabulary of
25 //! permissions the LLM can be granted — webhook-style.
26 //! - [`SurfaceProjection::Compact`] exposes only tools the app has annotated
27 //! as small-model safe.
28 //! - Hard refusals ([`Refusal`]) appear in `tools/list` with a stable reason
29 //! so models don't invent plausible names.
30 //!
31 //! # Design
32 //!
33 //! Design rationale and the roadmap for the planned primitives live as notes in
34 //! the maintainer wiki, bridged to this crate.
35 //! <!-- wiki: kberg-overview -->
36
37 pub mod agent;
38 mod error;
39 pub mod resource;
40 pub mod tool;
41
42 pub use agent::{Agent, AgentConfig, InferenceProvider, Message, Role, RunOutcome, ToolCall};
43 pub use error::{Error, Result};
44 pub use resource::{ResourceContents, ResourceDescriptor, ResourceRegistry};
45 pub use tool::{
46 ContentPart, Refusal, SurfaceProjection, Tool, ToolCallResult, ToolKind, ToolRegistry,
47 ToolSpec, WriteCapability,
48 };
49
50 #[cfg(feature = "server")]
51 pub mod server;
52
53 #[cfg(feature = "ollama")]
54 pub mod provider;
55