Files
Kigi-CLI/crates/common/kigi-tool-protocol/src/lib.rs
T
ZacharyZhang-NY fa75eb139a M2 audit: excise the Computer Hub stack — Kigi's last remote-cloud surface
Removed root-and-branch for the zero-egress guarantee (the hub was xAI's
remote-workspace/cloud-sandbox service):

- Crates deleted: kigi-computer-hub-core, kigi-computer-hub-sdk,
  kigi-computer-hub-mcp-adapter, kigi-workspace-client (hub-proxied
  workspace RPC client), and kigi-tracing (its sole network path was the
  OTLP gRPC exporter; zero consumers remained). kigi-tracing-macros
  (purely local) stays.
- kigi-workspace: every hub surface deleted — hub server/channel/auth,
  HITL-over-hub permissions, donation/metrics pumps, file upload RPCs,
  hub tool-snapshot merge (resolve pipeline is MCP-only now),
  WorkspaceOps::Proxy. Local worktrees, sessions, leader IPC, MCP, and
  the ACP permission prompt path are untouched; LocalRegistry re-homed
  into kigi-tool-runtime on the existing ToolDyn types so in-process
  tool dispatch is unchanged.
- kigi-shell: leader workspace-exposure control surface (incl. the
  wss://computer-hub... URL), [hub] config, ObservabilityBridge, hub
  WebSocket proxy, dead OTLP config knobs. ClientMode::Headless (never
  constructed) removed.
- kigi-tui/bin: hidden `kigi workspace` command removed (`kigi
  worktree` stays).
- Renames: --xai-api-base-url → --api-base-url / KIGI_API_BASE_URL /
  [endpoints] api_base_url (serde alias keeps old configs working; the
  flag feeds BYOK/custom-endpoint routing, not main inference);
  grok_version → kigi_version in inspect/models-cache/trace metadata
  (old caches self-heal via version-mismatch refetch).
- Dependency tree: dropped fastrace*, opentelemetry-otlp/http/proto,
  tokio-tungstenite from the workspace; fixed the 4 real useless_format
  violations the fastrace lint allowance was masking and removed the
  allowance.
- marketplaceAllowlist kept: it gates the LOCAL plugin-marketplace
  feature, not an xAI service.

Known §9 leftover (deliberate, for the M3 sweep): the BYOK default base
URL string. Gates: workspace check/clippy 0/0, fmt, deny ok; suites
green (workspace 1042, shell 4918, tui 6634, tools 2608, tool-runtime
47, mcp 154).
2026-07-17 22:34:10 -04:00

74 lines
3.2 KiB
Rust

//! Tool wire-protocol types.
//!
//! Identifier newtypes, registration payloads, capabilities, hook events,
//! handshake messages, the JSON-RPC 2.0 envelope and method catalog, the
//! `ToolErrorWire` / `ToolOutputWire` / `WireToolNotification` wire enums,
//! every method's `params` / `result` payload struct, and the numeric ↔
//! string error-code mapping.
#![forbid(unsafe_code)]
mod capabilities;
mod connection;
pub mod envelope;
pub mod error_codes;
pub mod error_wire;
pub mod frames;
mod handshake;
mod hook;
mod ids;
pub mod methods;
pub mod notification_wire;
pub mod output_wire;
mod registration;
mod registry_error;
pub mod session_event;
pub mod turn_hook;
pub use capabilities::{HookKind, NotificationSchemas, StreamingSpec, ToolCapabilities, ToolScope};
pub use connection::{ConnectionKind, ToolDefinitionMode};
pub use envelope::{
JsonRpcError, JsonRpcId, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, JsonRpcVersion,
ResponseOutcome,
};
pub use error_codes::{
ERROR_CODES, WORKSPACE_UNAVAILABLE_JSONRPC_CODE, WORKSPACE_UNAVAILABLE_MESSAGE,
WORKSPACE_UNAVAILABLE_SUBCODE, WorkspaceGonePhase, WorkspaceGoneReason,
WorkspaceUnavailableDetails, workspace_unavailable_wire,
};
pub use error_wire::ToolErrorWire;
pub use frames::{
AttachRoute, HookFrame, HookReplyFrame, LastSeq, LogsDonateParams, MAX_DONATION_BYTES,
MAX_LOG_RECORDS_PER_DONATION, MAX_METRICS_PER_DONATION, MAX_SPANS_PER_DONATION,
MAX_SYSTEM_NOTIFY_PAYLOAD_BYTES, MetricsDonateParams, NotificationFilter, PingFrame, PongFrame,
ServeParams, ServeResult, ServerBindAck, ServerBindOutcome, ServerBindParams, ServerInfo,
ServerUnbindAck, ServerUnbindOutcome, ServerUnbindParams, ServersListParams, ServersListResult,
SessionAttachServerParams, SessionAttachServerResult, SessionBindParams, SessionBindResult,
SessionBindServerParams, SessionBindServerResult, SessionCloseParams, SessionOpenParams,
SessionOpenResult, SessionUnbindParams, SessionUnbindServerParams, SubscribeAck,
SubscribeNotificationsParams, SubscribeOutcome, SystemNotifyParams, ToolCallParams,
ToolCallProgressFrame, ToolCallResult, ToolNotificationFrame, ToolSearchResult,
ToolServerConnectionStatus, ToolServerDisconnectReason, ToolServerEvictParams,
ToolServerGetStatusParams, ToolServerGetStatusResult, ToolServerLifecycleStatus,
ToolServerStatusPayload, ToolsChanged, ToolsListParams, ToolsListResult, ToolsSearchParams,
ToolsSearchResultBody, TracesDonateParams, UnsubscribeAck, UnsubscribeNotificationsParams,
UnsubscribeOutcome,
};
pub use handshake::{HelloAckMsg, HelloMsg, PROTOCOL_VERSION};
pub use hook::HookEvent;
pub use ids::{
ConnectionId, FrameSeq, IdError, RequestId, ServerId, SessionId, ToolCallId, ToolId, UserId,
};
pub use methods::{Method, UNKNOWN_METHOD_MSG_PREFIX};
pub use notification_wire::{
KNOWN_NOTIFICATION_KINDS, KnownVariantCollision, WireCustomNotification, WireToolNotification,
check_custom_kind, known_notification_kinds,
};
pub use output_wire::{McpBlock, ToolOutputWire};
pub use registration::{
RegistrationOutcome, ToolDescriptionWithSchema, ToolRegistration, ToolServerRegistration,
TransportKind,
};
pub use registry_error::RegistryError;
pub use session_event::{SessionEvent, SessionPhase, ToolCallOutcome};