The PRD's first acceptance gate now holds: grep -RinE '\bx\.ai\b|grok' crates/ --include='*.rs' → 0 matches (exempt: NOTICE and third-party license archives, README provenance, and the required 'Based on Grok Build Open Source' attribution, now sourced from version_attribution.txt). Wire-visible renames (both sides in this repo, changed in lockstep): - Auth method id 'grok.com' → 'kimi-code' (AuthMethodKind::KimiCode). - Every x.ai/* and _x.ai/* ACP ext method and meta key → kigi/* / _kigi/* (~200 names; grokShell → kigiShell). Session-file replay keeps a read-side alias for the legacy '_x.ai/session/update' method so existing updates.jsonl histories load; writes emit only the new name (both directions test-pinned). - Agent types grok-build* → kigi* with a documented legacy-prefix alias at resolution time so persisted sessions keep resolving. - ToolNamespace/BuiltinAgentName GrokBuild* → Kigi* (wire snake_case kigi/kigi_concise/kigi_hashline; schema regenerated); grok_build implementation dirs renamed to kigi*. - x-grok-* headers → x-kigi-*, __GROK_* sentinels → __KIGI_*, themes grokday/groknight → kigiday/kiginight (old persisted values fall back to the default theme), web_fetch allowlist xAI hosts → kimi.com + moonshot platforms, changelog CDN → this repo, grok-build changelog archives deleted. - BYOK default endpoint removed: [endpoints] api_base_url is now truly optional with NO default — consumers fail fast with the flag name when unset (no silent x.ai egress). Mock harnesses inject it explicitly. - System-prompt identity fixed: 'released by xAI' → 'an unofficial community CLI for Kimi' (template + regenerated encrypted form). Also repaired pre-existing grok-era test debt found by the sweep: the stale trace_classify default-model pin, the grok-pager UA label test, pty-harness stale-binary reuse and non-hermetic moonshot routing (a PTY test could previously reach the real api.moonshot.cn), and the outdated oauth fixture scope key. Gates: §9 grep 0; fmt clean; workspace check/clippy 0/0 (-D warnings); FULL cargo test --workspace: 234 suites, 21,961 passed, 0 failed; deny advisories ok.
42 lines
1.7 KiB
Rust
42 lines
1.7 KiB
Rust
#![allow(
|
|
unused_imports,
|
|
unused_variables,
|
|
unused_mut,
|
|
unreachable_code,
|
|
dead_code
|
|
)]
|
|
//! Shared test utilities for kigi crates: mock inference server, SSE
|
|
//! generators, ACP stdio client, headless runner, env sandbox.
|
|
//!
|
|
//! Provides:
|
|
//! - [`MockInferenceServer`] — Mock /v1/chat/completions + /v1/responses with request logging
|
|
//! - [`KigiStdioClient`] — ACP client that drives `kigi agent stdio` as a subprocess
|
|
//! - [`RawStdioClient`] — raw-wire ACP driver for bytes the typed client can't
|
|
//! produce (Foundation `\/` methods, string UUID ids)
|
|
//! - [`leader::LeaderStdioClient`] — ACP client that drives `kigi agent --leader stdio` (unix)
|
|
//! - [`run_headless`] — Run `kigi -p` against the mock server and capture output
|
|
//! - [`git_workdir`] — Create a temp directory with git repo (forces libgit2 init)
|
|
//! - [`kigi_binary`] — Resolve the kigi binary path (KIGI_BINARY env or cargo_bin)
|
|
//! - [`spawn_counting_server`] — Connection-counting HTTP/1.1 server for wire/pooling tests
|
|
//! - [`uds_proxy::UdsProxy`] — Frame-aware fault-injection proxy for leader IPC sockets (unix)
|
|
pub mod acp_client;
|
|
pub mod counting_server;
|
|
pub mod env;
|
|
pub mod headless;
|
|
#[cfg(unix)]
|
|
pub mod leader;
|
|
pub mod mock_server;
|
|
mod process;
|
|
pub mod scripted;
|
|
pub mod sse;
|
|
#[cfg(unix)]
|
|
pub mod uds_proxy;
|
|
pub use acp_client::{KigiStdioClient, RawStdioClient};
|
|
pub use counting_server::spawn_counting_server;
|
|
pub use env::{EnvGuard, git_workdir, kigi_binary};
|
|
pub use headless::{
|
|
HeadlessResult, assert_headless_success, assert_no_crashes, run_headless,
|
|
run_headless_with_cmd, stderr_tail,
|
|
};
|
|
pub use mock_server::{MockInferenceServer, MockModelEntry, ScriptedResponse, SseEvent};
|