mirror of
https://github.com/instructkr/claude-code.git
synced 2026-04-03 12:18:47 +03:00
Add a minimal runtime stdio MCP launcher that spawns configured server processes with piped stdin/stdout, applies transport env, and exposes async write/read/terminate/wait helpers for future JSON-RPC integration. The wrapper stays intentionally small: it does not yet implement protocol framing or connection lifecycle management, but it is real process orchestration rather than placeholder scaffolding. Tests use a temporary executable script to prove env propagation and bidirectional stdio round-tripping. Constraint: Keep the slice minimal and testable while using the real tokio process surface Constraint: Runtime verification must pass cleanly under fmt, clippy, and tests Rejected: Add full JSON-RPC framing and session orchestration in the same commit | too much scope for a clean launcher slice Rejected: Fake the process wrapper behind mocks only | would not validate spawning, env injection, or stdio wiring Confidence: high Scope-risk: narrow Reversibility: clean Directive: Layer future MCP protocol framing on top of McpStdioProcess rather than bypassing it with ad hoc process management Tested: cargo fmt --all; cargo clippy -p runtime --all-targets -- -D warnings; cargo test -p runtime Not-tested: live third-party MCP servers; long-running process supervision; stderr capture policy
67 lines
2.6 KiB
Rust
67 lines
2.6 KiB
Rust
mod bash;
|
|
mod bootstrap;
|
|
mod compact;
|
|
mod config;
|
|
mod conversation;
|
|
mod file_ops;
|
|
mod json;
|
|
mod mcp;
|
|
mod mcp_client;
|
|
mod mcp_stdio;
|
|
mod oauth;
|
|
mod permissions;
|
|
mod prompt;
|
|
mod remote;
|
|
mod session;
|
|
mod usage;
|
|
|
|
pub use bash::{execute_bash, BashCommandInput, BashCommandOutput};
|
|
pub use bootstrap::{BootstrapPhase, BootstrapPlan};
|
|
pub use compact::{
|
|
compact_session, estimate_session_tokens, format_compact_summary,
|
|
get_compact_continuation_message, should_compact, CompactionConfig, CompactionResult,
|
|
};
|
|
pub use config::{
|
|
ConfigEntry, ConfigError, ConfigLoader, ConfigSource, McpClaudeAiProxyServerConfig,
|
|
McpConfigCollection, McpOAuthConfig, McpRemoteServerConfig, McpSdkServerConfig,
|
|
McpServerConfig, McpStdioServerConfig, McpTransport, McpWebSocketServerConfig, OAuthConfig,
|
|
RuntimeConfig, RuntimeFeatureConfig, ScopedMcpServerConfig, CLAUDE_CODE_SETTINGS_SCHEMA_NAME,
|
|
};
|
|
pub use conversation::{
|
|
ApiClient, ApiRequest, AssistantEvent, ConversationRuntime, RuntimeError, StaticToolExecutor,
|
|
ToolError, ToolExecutor, TurnSummary,
|
|
};
|
|
pub use file_ops::{
|
|
edit_file, glob_search, grep_search, read_file, write_file, EditFileOutput, GlobSearchOutput,
|
|
GrepSearchInput, GrepSearchOutput, ReadFileOutput, StructuredPatchHunk, TextFilePayload,
|
|
WriteFileOutput,
|
|
};
|
|
pub use mcp::{
|
|
mcp_server_signature, mcp_tool_name, mcp_tool_prefix, normalize_name_for_mcp,
|
|
scoped_mcp_config_hash, unwrap_ccr_proxy_url,
|
|
};
|
|
pub use mcp_client::{
|
|
McpClaudeAiProxyTransport, McpClientAuth, McpClientBootstrap, McpClientTransport,
|
|
McpRemoteTransport, McpSdkTransport, McpStdioTransport,
|
|
};
|
|
pub use oauth::{
|
|
code_challenge_s256, generate_pkce_pair, generate_state, loopback_redirect_uri,
|
|
OAuthAuthorizationRequest, OAuthRefreshRequest, OAuthTokenExchangeRequest, OAuthTokenSet,
|
|
PkceChallengeMethod, PkceCodePair,
|
|
};
|
|
pub use permissions::{
|
|
PermissionMode, PermissionOutcome, PermissionPolicy, PermissionPromptDecision,
|
|
PermissionPrompter, PermissionRequest,
|
|
};
|
|
pub use prompt::{
|
|
load_system_prompt, prepend_bullets, ContextFile, ProjectContext, PromptBuildError,
|
|
SystemPromptBuilder, FRONTIER_MODEL_NAME, SYSTEM_PROMPT_DYNAMIC_BOUNDARY,
|
|
};
|
|
pub use remote::{
|
|
inherited_upstream_proxy_env, no_proxy_list, read_token, upstream_proxy_ws_url,
|
|
RemoteSessionContext, UpstreamProxyBootstrap, UpstreamProxyState, DEFAULT_REMOTE_BASE_URL,
|
|
DEFAULT_SESSION_TOKEN_PATH, DEFAULT_SYSTEM_CA_BUNDLE, NO_PROXY_HOSTS, UPSTREAM_PROXY_ENV_KEYS,
|
|
};
|
|
pub use session::{ContentBlock, ConversationMessage, MessageRole, Session, SessionError};
|
|
pub use usage::{TokenUsage, UsageTracker};
|