Metadata-Version: 2.4
Name: wenli
Version: 0.0.1
Summary: Wenli (文理), an AI-Native Programming Language (ANPL) designed for the era of autonomous agents.
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: lark>=1.3.1
Description-Content-Type: text/markdown

<h1 align="center">Wenli (文理)</h1>

<p align="center">
  <em>A strictly typed, AI-native programming language.</em>
</p>

## 📖 The Philosophy: Order + Smart

**Wenli (文理)** is an AI-Native Programming Language (ANPL) designed for the era of autonomous agents and local SLMs.

The name originates from the inherent patterns found in nature:
* **文 (Wen) - The Language:** Code that reads with the fluidity and expressiveness of natural language prose. Highly readable, even for non-programmers.
* **理 (Li) - The Logic:** A strict, unforgiving underlying structure. It compiles into a deterministic Abstract Syntax Tree (AST) with strong semantic typing, explicitly managing control flow and state.

Current AI interaction is stuck in the "machine code" era. Prompt engineering is fragile, expensive, and leads to the **Token Monster**—an ever-expanding context window that drowns small local models in irrelevant history. Wenli stops "prompting" and starts **programming**, decoupling complex reasoning from local execution.

## ✨ Core Features

* **Context Firewall (Heap vs. Stack):** Instead of treating chat history as an endless stack, Wenli treats context as a heap. The runtime only injects explicitly named variables (`> 变量名`) into the SLM's active KV-Cache, purging the rest.
* **Semantic Strong Typing:** Beyond basic strings and integers, Wenli enforces Semantic Types. If an agent hallucinates a response that fails the semantic type check, Wenli triggers a structured Refinement Loop rather than crashing the pipeline.
* **Strict vs. Agent Calls:** Clear lexical separation between deterministic tool execution (calling Python scripts, CLI tools, standard libraries) and probabilistic SLM inference.
* **Static Distillation:** The ultimate endgame. As Wenli monitors execution logs, it may asks cloud frontier models to write permanent, deterministic code (like a Python function) to replace probabilistic SLM steps that have proven to be purely deterministic over time. Your AI agent slowly compiles itself into a zero-token software suite.

## 💻 Language Specification Sneak Peek

Wenli is written in strict, beautifully formatted Markdown with exact punctuation rules.

## ⚙️ How It Works

1.  **The Compiler:** A cloud-based frontier model (or a strict local parser) reads the Wenli `.wl` script and validates the semantic types, variable references, and explicit closures.
2.  **The Runtime Environment:** Executes deterministic commands from the construted AST.
3.  **The Local SLM (Interpreter):** When an Agent Call is reached, the runtime spins up a constrained prompt, injects *only* the explicitly requested variables, and returns the strongly typed output.

## 🚀 Getting Started
Wenli is currently in active development. The initial compiler and runtime engine are being built to support seamless integration with standard command-line tools and local model servers.

## 🤝 Contributing
We believe in the open-source ethos. If you are passionate about compiler design, LLM orchestration, or creating deterministic tools for an unpredictable AI world, PRs and discussions are welcome!
