Skip to main content

Crate yapi_core

Crate yapi_core 

Source
Expand description

Coding agent core: sessions, compaction, settings, resources, built-in tools, system prompt, packages, extension runner and MCP. An internal library of yapi, with no stable API.

Modules§

agent_session
A conversation: the agent loop bound to a session file, tools, the system prompt and the model registry.
auth_guidance
What to tell the user when no model or credential is usable.
bash_executor
User ! commands: run in the shell, stream sanitized output, keep the tail.
bug_report
Bug reports for /bug: what a report holds, its redaction, the zip archive, the summary the current model writes and the GitHub issue.
cache_stats
Prompt cache misses: prompt tokens that were in the previous request’s prompt but were billed again instead of read from the cache.
chest
chest, a project package manager for skills, subagents and extensions: the chest.toml manifest, the chest.lock, content hashes, the placement of installed items, and the engine that installs them. It has no pi counterpart.
clipboard
Copying text to the system clipboard, and reading what the paste key inserts.
compaction
Compaction: summarize older context so a long session fits the model.
config
Where yapi keeps its state. Same layout as pi, under yapi’s own directories.
docs
The documentation the model reads about yapi: the yapi book and pi’s README, docs and examples, as each release’s yapi-docs.tar.gz packs them. install.sh unpacks the release’s copy into <agent dir>/docs, and yapi downloads it on its first run when installed another way.
extensions
Extensions: code that registers tools and commands with a session and handles its events, as pi’s extension runner (core/extensions in pi v1.0.0) runs them.
glob
Glob matching with the defaults of minimatch, which pi uses for package resource patterns and model scopes.
images
pi’s image pipeline: what an image becomes before it enters the conversation. Formats models do not accept become PNG, and with images.autoResize images are fitted to the model’s limits.
import
yapi import pi: copies pi’s state into yapi’s directories. yapi reads pi’s formats unchanged, so files are copied as they are, except pi’s lastChangelogVersion and sign-ins. Files yapi already has are kept.
language
pi’s getLanguageFromPath in modes/interactive/theme/theme.ts of pi v1.0.0: the language name pi gives a file’s code, for code renderers.
llama
pi’s built-in llama.cpp extension: the /llama command, which lists a llama.cpp router’s models, loads and unloads them, and downloads new ones from Hugging Face. The provider itself lives in yapi_ai::llama.
mcp
Model Context Protocol: a client for stdio and streamable HTTP servers (pi-mcp), and the built-in extension that exposes their tools.
messages
Session message roles beyond the provider’s four, and their conversion.
model_resolver
Choosing a model from --model, settings and available credentials.
packages
Packages: npm, git and local sources that bring extensions, skills, prompt templates and themes. Port of pi’s package manager (core/package-manager.ts in pi v1.0.0), with a built-in npm client.
resources
Context files, skills, prompt templates and system prompt files.
session
Session files: a JSONL tree of entries with a movable leaf.
settings
Settings: global settings.json merged with the trusted project’s.
system_prompt
The system prompt: named sections the transcript holds and later patches.
time
Timestamps as pi writes them: Unix milliseconds and ISO 8601 UTC with milliseconds, and ids.
tools
Built-in tools: read, bash, edit, write, and the optional grep, find and ls.
trust
Project trust: whether yapi may load a project’s .yapi settings and resources.
zone
The local time zone, chosen as Node chooses it: the zone TZ names when it is set, else the system’s zone.