ubl_office/lib.rs
1//! `ubl-office` — The Agent Runtime (Wake · Work · Dream)
2//!
3//! Run agents like reliable services, not fragile notebooks.
4//!
5//! `ubl-office` is the execution environment for LogLine agents. It coordinates
6//! thinking (TDLN), acting (MCP tools), memory, and policy (Gate) under one tight loop.
7//! No root access, no mystery state, no shrug emojis.
8//!
9//! # What it does (in one screen)
10//!
11//! - **Boot**: load identity/constitution, attach transports, warm caches
12//! - **Orient**: build a typed `CognitiveContext` (system directive, recall, constraints)
13//! - **Decide**: call `tdln-brain` to produce a strict `SemanticUnit` (TDLN AST)
14//! - **Gate**: run `tdln-gate` → Permit | Deny | Challenge
15//! - **Act**: execute via `ubl-mcp` (MCP tools)
16//! - **Dream**: consolidate short-term into durable memory; compact context; keep it fresh
17//! - **Repeat**, with backpressure, watchdog timers, exponential backoff on failure
18//!
19//! # Mental Model
20//!
21//! ```text
22//! ┌────────────┐ prepares ┌──────────────┐ thinks ┌──────────────┐ acts ┌──────────────┐
23//! │ Narrator ├────────────▶│ ContextFrame ├──────────▶│ tdln-brain ├──────────▶│ ubl-mcp/tools│
24//! └────┬───────┘ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘
25//! │ │ │ │
26//! │ recall │ handover │ decision │ receipts
27//! ▼ ▼ ▼ ▼
28//! ┌────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
29//! │ Memory │◀─────────────│ UBL Ledger │◀─────────▶│ TDLN Gate │ │ UBL Ledger │
30//! └────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
31//! ```
32//!
33//! # Example
34//!
35//! ```rust,no_run
36//! use ubl_office::{Office, OfficeConfig, OfficeState, SessionType, SessionMode};
37//!
38//! let config = OfficeConfig {
39//! session_type: SessionType::Work,
40//! session_mode: SessionMode::Commitment,
41//! ..Default::default()
42//! };
43//! // Office::new(config, brain) to start
44//! ```
45
46#![forbid(unsafe_code)]
47#![cfg_attr(docsrs, feature(doc_cfg))]
48
49mod runtime;
50mod memory;
51mod narrator;
52mod errors;
53mod hooks;
54
55pub use runtime::*;
56pub use memory::*;
57pub use narrator::*;
58pub use errors::*;
59pub use hooks::*;