mirror of
https://github.com/earendil-works/pi.git
synced 2026-10-02 08:44:38 +08:00
This adds codemode and MCP support to pi. Codemode (packages/codemode) runs model-written JavaScript in a QuickJS wasm VM inside a worker. From there the script calls pi's tools as async functions, uses a per-session store, and can read the model catalog and run classifiers. The codemode tool in coding-agent is compatible with Codex's exec tool, and codemode.mode works like Codex's tool modes (on or only). Large results are written to a JSON temp file. MCP (packages/mcp) is a standalone client for stdio and streamable HTTP servers, with OAuth. The core only gets general mechanisms; codemode, tool_search and MCP are built-in extensions that use them. Other extensions can replace these built-ins. Tools declare an exposure: direct, model-only, codemode, deferred or hidden. prepareLoadout() lets an orchestrating tool change which tool declarations the model sees. ctx.executeTool() runs nested calls through validation and the tool_call/tool_result hooks. Those calls emit events with parentToolCallId and are recorded as bounded nestedCalls on the parent result, which compaction and HTML export use. Tools can also return structuredContent with an outputSchema, and can report errors with isError instead of throwing. MCP servers come from mcp.json (global, or per project after the project is trusted) or from pi.registerMcpServer(). They are managed with /mcp and pi mcp list|login|logout, and their runtimes load on first use. Closes #10040
209 lines
4.7 KiB
JSON
209 lines
4.7 KiB
JSON
{
|
|
"navigation": [
|
|
{
|
|
"title": "Get Started",
|
|
"items": [
|
|
{
|
|
"title": "Overview",
|
|
"path": "index.md"
|
|
},
|
|
{
|
|
"title": "Quickstart",
|
|
"path": "quickstart.md"
|
|
},
|
|
{
|
|
"title": "How Pi Works",
|
|
"path": "how-pi-works.md"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"title": "Guides",
|
|
"items": [
|
|
{
|
|
"title": "Run Pi",
|
|
"items": [
|
|
{
|
|
"title": "Use Pi in the Terminal",
|
|
"path": "usage.md"
|
|
},
|
|
{
|
|
"title": "Choose a Model",
|
|
"path": "models.md"
|
|
},
|
|
{
|
|
"title": "Manage Sessions and Context",
|
|
"path": "sessions.md"
|
|
},
|
|
{
|
|
"title": "Run Pi Safely",
|
|
"path": "security.md"
|
|
},
|
|
{
|
|
"title": "Isolate Pi",
|
|
"path": "containerization.md"
|
|
},
|
|
{
|
|
"title": "Run Local Models",
|
|
"path": "llama-cpp.md"
|
|
},
|
|
{
|
|
"title": "Configure Your Terminal",
|
|
"path": "terminal-setup.md"
|
|
},
|
|
{
|
|
"title": "Configure Shell Commands",
|
|
"path": "shell-aliases.md"
|
|
},
|
|
{
|
|
"title": "Run Pi in tmux",
|
|
"path": "tmux.md"
|
|
},
|
|
{
|
|
"title": "Run Pi on Windows",
|
|
"path": "windows.md"
|
|
},
|
|
{
|
|
"title": "Run Pi on Android",
|
|
"path": "termux.md"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"title": "Customize Pi",
|
|
"items": [
|
|
{
|
|
"title": "Configure Pi",
|
|
"path": "configuration.md"
|
|
},
|
|
{
|
|
"title": "Create Prompt Templates",
|
|
"path": "prompt-templates.md"
|
|
},
|
|
{
|
|
"title": "Add Skills",
|
|
"path": "skills.md"
|
|
},
|
|
{
|
|
"title": "Create Themes",
|
|
"path": "themes.md"
|
|
},
|
|
{
|
|
"title": "Use Pi Packages",
|
|
"path": "packages.md"
|
|
},
|
|
{
|
|
"title": "Connect MCP Servers",
|
|
"path": "mcp.md"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"title": "Build on Pi",
|
|
"items": [
|
|
{
|
|
"title": "Build Extensions",
|
|
"path": "extensions.md"
|
|
},
|
|
{
|
|
"title": "Add Custom Providers",
|
|
"path": "custom-provider.md"
|
|
},
|
|
{
|
|
"title": "Route with Virtual Models",
|
|
"path": "virtual-models.md"
|
|
},
|
|
{
|
|
"title": "Build Terminal UI Components",
|
|
"path": "tui.md"
|
|
},
|
|
{
|
|
"title": "Integrate with the CLI",
|
|
"path": "cli-integration.md"
|
|
},
|
|
{
|
|
"title": "Use the SDK",
|
|
"path": "sdk.md"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"title": "Reference",
|
|
"items": [
|
|
{
|
|
"title": "CLI",
|
|
"path": "cli.md"
|
|
},
|
|
{
|
|
"title": "Slash Commands",
|
|
"path": "slash-commands.md"
|
|
},
|
|
{
|
|
"title": "Settings",
|
|
"path": "settings.md"
|
|
},
|
|
{
|
|
"title": "Environment Variables",
|
|
"path": "environment-variables.md"
|
|
},
|
|
{
|
|
"title": "Keybindings",
|
|
"path": "keybindings.md"
|
|
},
|
|
{
|
|
"title": "Provider Authentication",
|
|
"path": "providers.md"
|
|
},
|
|
{
|
|
"title": "Session File Format",
|
|
"path": "session-format.md"
|
|
},
|
|
{
|
|
"title": "Compaction and Branch Summaries",
|
|
"path": "compaction.md"
|
|
},
|
|
{
|
|
"title": "JSON Event Stream",
|
|
"path": "json.md"
|
|
},
|
|
{
|
|
"title": "RPC Protocol",
|
|
"path": "rpc.md"
|
|
},
|
|
{
|
|
"title": "RPC Commands",
|
|
"path": "rpc-commands.md"
|
|
},
|
|
{
|
|
"title": "RPC Extension UI",
|
|
"path": "rpc-extension-ui.md"
|
|
},
|
|
{
|
|
"title": "Message Types",
|
|
"path": "message-types.md"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"redirects": [
|
|
{
|
|
"from": "development.md",
|
|
"to": "index.md"
|
|
},
|
|
{
|
|
"from": "session.md",
|
|
"to": "session-format.md"
|
|
},
|
|
{
|
|
"from": "tree.md",
|
|
"to": "sessions.md"
|
|
},
|
|
{
|
|
"from": "process-integration.md",
|
|
"to": "cli-integration.md"
|
|
}
|
|
]
|
|
}
|