From 5f686d02e15daa2c5db7ad6d889c06eaff3ceeee Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 00:23:19 +0000 Subject: [PATCH 01/13] feat: add shared Rust SDK facade --- AGENTS.md | 2 +- architecture/maintenance.md | 3 +- architecture/overview.md | 1 + architecture/python-library.md | 35 +++ plans/000-long-term-specification.md | 6 +- src/lib.rs | 13 +- src/sdk.rs | 432 +++++++++++++++++++++++++++ 7 files changed, 482 insertions(+), 10 deletions(-) create mode 100644 architecture/python-library.md create mode 100644 src/sdk.rs diff --git a/AGENTS.md b/AGENTS.md index 003b4c01..29a94418 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ eggsearch is a lightweight MCP search/fetch server for AI agents (live metasearch with RRF dedup, bounded fetch, deterministic evidence bundles). Transports: client-owned `mcp stdio` or explicit loopback-only `mcp serve`. -Single library + binary crate, not a workspace. Stable contract is MCP tools (10) plus CLI; the Rust module tree is an implementation detail with no semver library guarantee (see `src/lib.rs`). Dependency flow: `core <- meta <- mcp <- commands`; `fetch` is independent of `meta`. Start with `src/lib.rs` (module map) and `architecture/overview.md` (component index); operator docs live in `docs/`. +Single library + binary crate, not a workspace. Stable contract is MCP tools (10) plus CLI, with a narrow native operation facade in `src/sdk.rs`; the remaining Rust module tree has no general semver library guarantee (see `src/lib.rs` and `architecture/python-library.md`). Dependency flow: `core <- meta <- mcp <- commands`; `fetch` is independent of `meta`. Start with `src/lib.rs` (module map) and `architecture/overview.md` (component index); operator docs live in `docs/`. ## Build & verification diff --git a/architecture/maintenance.md b/architecture/maintenance.md index d6296554..301b8b81 100644 --- a/architecture/maintenance.md +++ b/architecture/maintenance.md @@ -2,7 +2,7 @@ **Purpose:** Keep the post-consolidation repository from re-concentrating into new monoliths. Contributor contract for adding tools, providers, workflows, parsers, and tests. -The crate is application-first: the stable contract is MCP tools (10) plus CLI. The Rust module tree is an implementation detail for the binary, integration tests, and fuzz harnesses. Dependency flow: `core <- meta <- mcp <- commands`; `fetch` is independent of `meta`. Factual claims about tools and providers must agree with the code; inventories below are guard-enforced, the rest is kept in sync by discipline. +The crate is application-first: the stable contract is MCP tools (10) plus CLI, with the narrow `src/sdk.rs` application facade for native consumers. The remaining Rust module tree is an implementation detail for the binary, integration tests, and fuzz harnesses. Dependency flow: `core <- meta <- mcp <- commands`; `fetch` is independent of `meta`. Factual claims about tools and providers must agree with the code; inventories below are guard-enforced, the rest is kept in sync by discipline. --- @@ -26,6 +26,7 @@ Guard-enforced by `tests/static_guards.rs` (fail-closed). Transports call tool s | Fetch execution | `src/fetch/` (client, limits, cache, origin, browser) | Search ranking, evidence roles | | Outbound HTTP transport | `eggfetch-core` (transport, pooling, TLS, decompression, deadlines, bounded reads, pinned routing, redirect mechanics, typed failures); optional `src/fetch/egress.rs` (`EggressDialer` beneath the eggfetch `Dialer` seam, provider-only, fail-closed, credential-indirected); rmcp transitively owns only its Streamable HTTP client transport | eggsearch-local reqwest clients or facades; SSRF/retry/truncation policy stays in eggsearch; dynamic `FetchClient` targets never use egress | | Release/deploy surface | `src/platform.rs`, `src/update.rs`, `src/startup.rs`, `packaging/` | Search/fetch policy | +| Native SDK facade | `src/sdk.rs` delegates to the ten `src/mcp/tools/` handlers and owns only dispatch, config-backed shared state, and structured errors | Provider selection, validation, policy, projection, and tool semantics | Overlap ratchets (each a named guard): diff --git a/architecture/overview.md b/architecture/overview.md index 4f04071d..23a4eb57 100644 --- a/architecture/overview.md +++ b/architecture/overview.md @@ -81,6 +81,7 @@ fetch ↗ | Browser rendering & profiles | `src/fetch/browser/` (8 files) | Optional headless Chrome/Chromium via CDP; persistent origin-scoped login profiles | [fetch.md](fetch.md#9-browser-rendering-browser-8-files-feature-browser) | | HTML rendering | `src/fetch/render/` (8 files) | Structural rendering: blocks, text, markdown, code, CSV, notebooks | [fetch.md](fetch.md#6-render-subsystem-render-8-files) | | MCP server & tools | `src/mcp/` (7 modules + `tools/` with 10 tool modules plus `mod`/`common`/`canonical`/`tests`) | rmcp ServerHandler with 10 tools, stdio and loopback Streamable HTTP | [mcp.md](mcp.md) | +| Native SDK facade | `src/sdk.rs` | Narrow direct Rust operation API delegating to the same ten MCP handlers | [python-library.md](python-library.md) | | CLI commands | `src/commands/` (binary-only, `mod` + 9 modules) | Subcommand wiring: doctor, search, fetch, providers, update, integrate, startup, restart, croncheck, mcp stdio/serve, browser-login/profiles | [commands.md](commands.md) | | Agent/IDE integrations | `src/integrations/` (10 files, 7 clients) | Client-specific render/apply adapters with atomic JSON edits and protocol verification | [integrations.md](integrations.md) | | Startup supervision | `src/startup.rs`, `packaging/systemd/`, `packaging/launchd/`, `packaging/windows/` | Canonical persistent runtime, manager detection/rendering, cron watchdog, identity-safe restart, and service state | [startup.md](startup.md) | diff --git a/architecture/python-library.md b/architecture/python-library.md new file mode 100644 index 00000000..960fdece --- /dev/null +++ b/architecture/python-library.md @@ -0,0 +1,35 @@ +# Python Native Library + +The Python library is an additive native consumer of the ten existing tool +operations. Its ownership boundary is registered in +`plans/adrs/ADR-0005-python-native-library-boundary.md` and sequenced by +`plans/subsystems/python-native-library-roadmap.md`. + +## Rust operation facade + +`src/sdk.rs` owns the narrow `EggsearchClient`, canonical `ToolName` mapping, +shared `ServerState` lifetime, and structured `SdkError` conversion. It +delegates every operation to the matching function under `src/mcp/tools/`. +Those handlers remain the only owner of argument semantics, provider and +fetch policy, sanitization, evidence identity, warnings, and result shape. +The facade returns tool JSON payloads without MCP envelopes. Cloned clients +share one state; the caller supplies the Tokio runtime. + +The facade does not make the rest of the crate's module tree a stable general +Rust library. It introduces no Python dependency, runtime, process, listener, +or background task into the root crate. `ToolName` stays aligned with the +code-derived `tool_contract::ALL_CONTRACTS` inventory. + +## Python binding and distribution boundary + +The Python package lives in an independent `bindings/python` Cargo package. +PyO3 and Python packaging dependencies must not enter the root crate's +default dependency graph or change its binary artifact inventory. Python +import is side-effect-free. The binding owns Python types and lifecycle +adaptation; all execution delegates through `src/sdk.rs`. + +Milestone status and exact-candidate evidence live in +`plans/registry.md` and `plans/closure/python-native-library/`. A compiled +extension alone is not evidence of a supported Python consumer. Wheel support +is limited to targets with native install and runtime qualification, and +publication requires separate authorization. diff --git a/plans/000-long-term-specification.md b/plans/000-long-term-specification.md index f8c53134..13f7be54 100644 --- a/plans/000-long-term-specification.md +++ b/plans/000-long-term-specification.md @@ -15,8 +15,10 @@ Eggsearch is a lightweight MCP search/fetch server for AI agents: live metasearch with RRF dedup, bounded fetch, and deterministic evidence bundles. - Single library + binary crate, not a workspace. -- Stable contract is 10 MCP tools plus CLI; the Rust module tree is an - implementation detail with no semver library guarantee (see `src/lib.rs`). +- Stable contract is 10 MCP tools plus CLI. The narrow `src/sdk.rs` facade + is an additional application interface for native consumers; the remaining + Rust module tree is an implementation detail with no general semver library + guarantee (see `src/lib.rs` and `architecture/python-library.md`). - Transports: client-owned `mcp stdio` or explicit loopback-only `mcp serve`. Non-loopback/LAN/public MCP exposure is a non-goal. - Dependency flow: `core <- meta <- mcp <- commands`; `fetch` is independent diff --git a/src/lib.rs b/src/lib.rs index 0b3a72d3..a0fc14b1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,9 +2,9 @@ //! server for AI agents. //! //! This crate is application-first. The stable contract is the MCP tool -//! surface and the CLI; the Rust module tree is an implementation detail -//! for the binary, integration tests, and fuzz harnesses. It carries no -//! semver stability guarantee as a general-purpose library. +//! surface and the CLI. The narrow [`sdk`] module is an additional +//! application facade for supported native consumers; it does not make +//! the remaining Rust module tree a general semver-stable library. //! //! Intentionally reusable domain types live in [`core`] (request, response, //! config, and identity types such as [`core::WebSearchRequest`]). The @@ -12,9 +12,9 @@ //! `platform`, `startup`, `update`) are internal implementation details //! that remain `pub` only so the binary, integration tests, and fuzz //! targets can link against them. They may change without a major version -//! bump. Downstream Rust consumers should depend only on `core` types and -//! the MCP/CLI contract, not on engines, adapters, tool internals, or -//! deployment/update machinery. +//! bump. Downstream Rust consumers should use [`sdk`] for direct tool +//! execution, or depend only on `core` types and the MCP/CLI contract, not +//! on engines, adapters, tool internals, or deployment/update machinery. //! //! - [`core`]: source card model, config, error, query types. //! - [`meta`]: metasearch adapter with vendored search engines. @@ -53,6 +53,7 @@ pub mod mcp; pub mod meta; pub mod platform; pub(crate) mod process; +pub mod sdk; pub mod startup; pub mod update; diff --git a/src/sdk.rs b/src/sdk.rs new file mode 100644 index 00000000..b6f7de64 --- /dev/null +++ b/src/sdk.rs @@ -0,0 +1,432 @@ +#![allow(missing_docs)] + +use std::str::FromStr; +use std::sync::Arc; + +use crate::core::config::AppConfig; +use crate::mcp::state::ServerState; +use crate::mcp::tools::{ + run_batch_fetch, run_build_evidence_bundle, run_provider_status_async, run_repo_fetch, + run_repo_map, run_repo_search, run_research_search, run_security_search, run_web_fetch, + run_web_search, ToolError, +}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum ToolName { + BatchFetch, + BuildEvidenceBundle, + ProviderStatus, + RepoFetch, + RepoMap, + RepoSearch, + ResearchSearch, + SecuritySearch, + WebFetch, + WebSearch, +} + +impl ToolName { + pub const ALL: [Self; 10] = [ + Self::BatchFetch, + Self::BuildEvidenceBundle, + Self::ProviderStatus, + Self::RepoFetch, + Self::RepoMap, + Self::RepoSearch, + Self::ResearchSearch, + Self::SecuritySearch, + Self::WebFetch, + Self::WebSearch, + ]; + + pub const fn as_str(self) -> &'static str { + match self { + Self::BatchFetch => "batch_fetch", + Self::BuildEvidenceBundle => "build_evidence_bundle", + Self::ProviderStatus => "provider_status", + Self::RepoFetch => "repo_fetch", + Self::RepoMap => "repo_map", + Self::RepoSearch => "repo_search", + Self::ResearchSearch => "research_search", + Self::SecuritySearch => "security_search", + Self::WebFetch => "web_fetch", + Self::WebSearch => "web_search", + } + } +} + +impl FromStr for ToolName { + type Err = SdkError; + + fn from_str(value: &str) -> Result { + if !crate::mcp::tool_contract::is_known_tool(value) { + return Err(SdkError::new( + "invalid_request", + format!("unknown tool '{value}'"), + None, + None, + )); + } + Self::ALL + .into_iter() + .find(|tool| tool.as_str() == value) + .ok_or_else(|| { + SdkError::new( + "internal", + "tool contract mapping is incomplete", + None, + None, + ) + }) + } +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct SdkError { + pub code: String, + pub message: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repair: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, +} + +impl SdkError { + fn new( + code: impl Into, + message: impl Into, + repair: Option, + data: Option, + ) -> Self { + Self { + code: code.into(), + message: message.into(), + repair, + data, + } + } +} + +impl From for SdkError { + fn from(error: ToolError) -> Self { + let payload = error.error_payload(); + Self { + code: payload + .get("code") + .and_then(serde_json::Value::as_str) + .unwrap_or("internal") + .to_owned(), + message: payload + .get("message") + .and_then(serde_json::Value::as_str) + .unwrap_or("tool execution failed") + .to_owned(), + repair: payload.get("repair").cloned(), + data: payload.get("data").cloned(), + } + } +} + +#[derive(Clone)] +pub struct EggsearchClient { + state: Arc, +} + +impl EggsearchClient { + pub fn new(config: AppConfig) -> anyhow::Result { + Ok(Self { + state: Arc::new(ServerState::build(config)?), + }) + } + + pub fn tool_names() -> impl ExactSizeIterator { + crate::mcp::tool_contract::ALL_CONTRACTS + .iter() + .map(|contract| contract.name) + } + + pub async fn execute( + &self, + tool: impl AsRef, + arguments: serde_json::Value, + ) -> Result { + let tool = ToolName::from_str(tool.as_ref())?; + if !arguments.is_object() { + return Err(SdkError::new( + "invalid_request", + "tool arguments must be a JSON object", + None, + None, + )); + } + let result = match tool { + ToolName::BatchFetch => run_batch_fetch(self.state.clone(), decode(arguments)?).await, + ToolName::BuildEvidenceBundle => run_build_evidence_bundle(decode(arguments)?), + ToolName::ProviderStatus => { + run_provider_status_async(self.state.clone(), decode(arguments)?).await + } + ToolName::RepoFetch => run_repo_fetch(self.state.clone(), decode(arguments)?).await, + ToolName::RepoMap => run_repo_map(self.state.clone(), decode(arguments)?).await, + ToolName::RepoSearch => run_repo_search(self.state.clone(), decode(arguments)?).await, + ToolName::ResearchSearch => { + run_research_search(self.state.clone(), decode(arguments)?).await + } + ToolName::SecuritySearch => { + run_security_search(self.state.clone(), decode(arguments)?).await + } + ToolName::WebFetch => run_web_fetch(self.state.clone(), decode(arguments)?).await, + ToolName::WebSearch => run_web_search(self.state.clone(), decode(arguments)?).await, + }; + result.map_err(SdkError::from) + } +} + +fn decode(value: serde_json::Value) -> Result { + serde_json::from_value(value).map_err(|_| { + SdkError::new( + "invalid_request", + "tool arguments do not match the operation input shape", + None, + None, + ) + }) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::core::config::Mode; + use crate::mcp::tools::{ + run_batch_fetch, run_build_evidence_bundle, run_provider_status_async, run_repo_fetch, + run_repo_map, run_repo_search, run_research_search, run_security_search, run_web_fetch, + run_web_search, + }; + use crate::meta::engines::error::EngineError; + use crate::meta::engines::models::SearchResult; + use crate::meta::engines::{BoxFuture, EngineSearchRequest, SearchEngine}; + use crate::meta::MetadataSearchAdapter; + use std::future::Future; + use std::sync::atomic::{AtomicUsize, Ordering}; + use std::time::Duration; + use tempfile::TempDir; + + struct CountingEngine { + calls: Arc, + } + + impl SearchEngine for CountingEngine { + fn name(&self) -> &'static str { + "sdk_counting_engine" + } + + fn search<'a>( + &'a self, + _request: &'a EngineSearchRequest, + ) -> BoxFuture<'a, Result, EngineError>> { + self.calls.fetch_add(1, Ordering::SeqCst); + Box::pin(async { Ok(Vec::new()) }) + } + } + + async fn assert_parity( + client: &EggsearchClient, + name: &str, + args: serde_json::Value, + direct: F, + ) where + F: Future>, + { + let sdk_result = client.execute(name, args).await; + let direct_result = direct.await.map_err(SdkError::from); + assert_eq!(sdk_result, direct_result, "parity for {name}"); + } + + #[test] + fn names_are_exactly_the_canonical_tool_inventory() { + let facade = ToolName::ALL.map(ToolName::as_str); + let canonical: Vec<_> = EggsearchClient::tool_names().collect(); + assert_eq!(facade.len(), canonical.len()); + for name in facade { + assert!(canonical.contains(&name)); + assert_eq!(ToolName::from_str(name).unwrap().as_str(), name); + } + } + + #[tokio::test] + async fn unknown_name_and_non_object_arguments_are_request_errors() { + assert_eq!( + ToolName::from_str("local_search").unwrap_err().code, + "invalid_request" + ); + let client = EggsearchClient::new(AppConfig::default()).unwrap(); + let err = client + .execute("web_search", serde_json::json!("not an object")) + .await + .unwrap_err(); + assert_eq!(err.code, "invalid_request"); + } + + #[tokio::test] + async fn all_operations_match_their_existing_handler_results() { + let mut config = AppConfig::default(); + config.search.mode = Mode::Off; + config.local.enabled = false; + let client = EggsearchClient::new(config).unwrap(); + let state = client.state.clone(); + + let args = serde_json::json!({"query": "sdk parity"}); + assert_parity( + &client, + "web_search", + args.clone(), + run_web_search(state.clone(), decode(args).unwrap()), + ) + .await; + + let args = serde_json::json!({"url": "file:///etc/passwd"}); + assert_parity( + &client, + "web_fetch", + args.clone(), + run_web_fetch(state.clone(), decode(args).unwrap()), + ) + .await; + + let args = serde_json::json!({"items": []}); + assert_parity( + &client, + "batch_fetch", + args.clone(), + run_batch_fetch(state.clone(), decode(args).unwrap()), + ) + .await; + + let args = serde_json::json!({}); + assert_parity( + &client, + "provider_status", + args.clone(), + run_provider_status_async(state.clone(), decode(args).unwrap()), + ) + .await; + + let args = serde_json::json!({"query": "sdk parity"}); + assert_parity( + &client, + "repo_search", + args.clone(), + run_repo_search(state.clone(), decode(args).unwrap()), + ) + .await; + + let args = + serde_json::json!({"owner": "invalid owner", "repo": "bad", "path": "README.md"}); + assert_parity( + &client, + "repo_fetch", + args.clone(), + run_repo_fetch(state.clone(), decode(args).unwrap()), + ) + .await; + + let args = serde_json::json!({"owner": "invalid owner", "repo": "bad"}); + assert_parity( + &client, + "repo_map", + args.clone(), + run_repo_map(state.clone(), decode(args).unwrap()), + ) + .await; + + let args = serde_json::json!({"query": "CVE-2024-1234"}); + assert_parity( + &client, + "security_search", + args.clone(), + run_security_search(state.clone(), decode(args).unwrap()), + ) + .await; + + let args = serde_json::json!({"query": "sdk parity"}); + assert_parity( + &client, + "research_search", + args.clone(), + run_research_search(state, decode(args).unwrap()), + ) + .await; + + let args = serde_json::json!({}); + assert_parity( + &client, + "build_evidence_bundle", + args.clone(), + std::future::ready(run_build_evidence_bundle(decode(args).unwrap())), + ) + .await; + } + + #[tokio::test] + async fn mode_off_repo_search_through_sdk_keeps_remote_dispatch_at_zero() { + let root = TempDir::new().unwrap(); + std::fs::create_dir_all(root.path().join("src")).unwrap(); + std::fs::write( + root.path().join("src/lib.rs"), + "pub fn sdk_locality_fixture() -> i32 { 42 }", + ) + .unwrap(); + + let calls = Arc::new(AtomicUsize::new(0)); + let mut config = AppConfig::default(); + config.search.mode = Mode::Off; + config + .search + .providers + .insert("sdk_counting_engine".into(), true); + config.local.enabled = true; + config.local.roots = vec![root.path().to_path_buf()]; + config.local.respect_gitignore = false; + let adapter = MetadataSearchAdapter::from_engines( + vec![Arc::new(CountingEngine { + calls: calls.clone(), + })], + Duration::from_secs(2), + ); + let mut state = ServerState::with_adapter(config.clone(), Arc::new(adapter)); + state.local_backend = Some(Arc::new( + crate::meta::local_backend::LocalWorkspaceBackend::new(config.local).unwrap(), + )); + let client = EggsearchClient { + state: Arc::new(state), + }; + + let result = client + .execute( + "repo_search", + serde_json::json!({ + "query": "sdk_locality_fixture", + "providers": ["sdk_counting_engine"], + "include_local": true + }), + ) + .await + .unwrap(); + + assert_eq!(calls.load(Ordering::SeqCst), 0); + assert_eq!( + result["providers_queried"], + serde_json::json!(["local_workspace"]) + ); + assert!(result["groups"].as_array().is_some_and(|groups| { + groups.iter().any(|group| { + group["results"].as_array().is_some_and(|results| { + results.iter().any(|entry| { + entry["snippet"] + .as_str() + .is_some_and(|text| text.contains("sdk_locality_fixture")) + }) + }) + }) + })); + } +} From 910692da21b2fa30e7a802dee866180fe6c07491 Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 00:24:19 +0000 Subject: [PATCH 02/13] plans: close Python native library M001 --- architecture/python-library.md | 4 + .../python-native-library/001-status.md | 104 ++++++++++++++++++ .../001-shared-sdk-facade-and-parity.md | 2 +- .../002-pyo3-async-execution-and-lifecycle.md | 4 +- plans/registry.md | 10 +- .../python-native-library-roadmap.md | 8 +- 6 files changed, 120 insertions(+), 12 deletions(-) create mode 100644 plans/closure/python-native-library/001-status.md diff --git a/architecture/python-library.md b/architecture/python-library.md index 960fdece..d62ac4e7 100644 --- a/architecture/python-library.md +++ b/architecture/python-library.md @@ -5,6 +5,10 @@ operations. Its ownership boundary is registered in `plans/adrs/ADR-0005-python-native-library-boundary.md` and sequenced by `plans/subsystems/python-native-library-roadmap.md`. +Current handoff: M001's shared Rust facade and ten-operation parity are +closed at `plans/closure/python-native-library/001-status.md`; M002's native +asyncio bridge is ready. + ## Rust operation facade `src/sdk.rs` owns the narrow `EggsearchClient`, canonical `ToolName` mapping, diff --git a/plans/closure/python-native-library/001-status.md b/plans/closure/python-native-library/001-status.md new file mode 100644 index 00000000..cdea811f --- /dev/null +++ b/plans/closure/python-native-library/001-status.md @@ -0,0 +1,104 @@ +# Python Native Library M001 — Shared SDK Facade and Parity Closure Status + +Status: closed + +Source implementation plan: + +- `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` + +Source subsystem roadmap: + +- `plans/subsystems/python-native-library-roadmap.md` + +Applicable decisions: + +- `plans/adrs/ADR-0001-ten-tool-surface-and-adapter-ownership.md` +- `plans/adrs/ADR-0005-python-native-library-boundary.md` + +Implementation candidate: `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`. +Planning closure commit updates this record, the implementation plan, +roadmap, and registry together. + +## 1. Delivered facade + +`src/sdk.rs` adds `EggsearchClient`, `ToolName`, and structured `SdkError`. +The client builds one shared `ServerState` from validated `AppConfig`, clones +cheaply through `Arc`, accepts caller-supplied Tokio execution, and returns +tool JSON payloads without MCP envelopes. Dispatch is exhaustive and calls +the existing ten `src/mcp/tools/` handlers. Canonical names are checked +against `tool_contract::is_known_tool()` and enumerated by +`tool_contract::ALL_CONTRACTS`; malformed top-level values and typed argument +shape failures are `invalid_request`. Existing handler failures retain their +machine-readable code, message, repair hint, and data through +`ToolError::error_payload()`. + +The facade introduces no PyO3 dependency, owned runtime, process, listener, +background task, provider policy, fetch policy, or new MCP operation. Root +Cargo metadata, features, package inventory, and default dependency graph are +unchanged. `src/lib.rs`, the normative specification, the maintenance +ownership map, the architecture index, and `AGENTS.md` now describe this +narrow native interface without granting general module-tree stability or +claiming that a Python package has shipped. + +## 2. Ten-operation parity cases + +The unit fixture `all_operations_match_their_existing_handler_results` +executes each facade operation and compares its complete `Result` to the same existing handler result using the same arguments and +shared state. All ten comparisons passed: + +| Canonical operation | Fixture path | Result comparison | +|---|---|---| +| `web_search` | Mode-Off request | Exact JSON/error equality | +| `web_fetch` | Unsupported local-file URL | Exact JSON/error equality; no HTTP request | +| `batch_fetch` | Empty item list | Exact JSON/error equality | +| `provider_status` | Default, non-probing status request | Exact JSON equality | +| `repo_search` | Mode-Off request with local workspace disabled | Exact JSON/error equality | +| `repo_fetch` | Invalid owner locator | Exact JSON/error equality | +| `repo_map` | Invalid owner locator | Exact JSON/error equality | +| `security_search` | Mode-Off advisory request | Exact JSON/error equality | +| `research_search` | Mode-Off request | Exact JSON/error equality | +| `build_evidence_bundle` | Empty evidence input | Exact JSON equality | + +The separate +`mode_off_repo_search_through_sdk_keeps_remote_dispatch_at_zero` fixture +installs a counting remote engine, indexes a local source file, then searches +through `EggsearchClient`. The local result is present, the reported provider +is `local_workspace`, and the remote call counter remains **0**. This covers +the native facade route through the same Mode-Off handler policy. + +## 3. Verification + +All gates below passed on candidate +`5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`: + +| Gate | Result | +|---|---| +| `cargo test --locked --all-features --lib sdk` | Pass; 4 SDK tests | +| `make check` | Pass; fmt, clippy, no-default-features check, all-features tests (3,478 tests), hygiene, dependency policy, packaging check | +| `RUSTDOCFLAGS="-D warnings" cargo doc --locked --all-features --no-deps` | Pass | +| `git diff --check` | Pass | + +The all-features root gate includes `mcp_tools`, `evidence_contract`, +`provider_capability_contract`, and `static_guards`; it also exercises the +repository's pre-existing provider failure, projection, evidence identity, +warning, and local workspace contracts. The SDK-specific ten-operation test +uses deterministic local/Mode-Off inputs and makes no live network request. + +## 4. Compatibility, security, and residuals + +MCP tool registration and schemas, CLI behavior, Rust dependencies, release +assets, and Cargo package layout are unchanged. Every execution branch +delegates to the matching handler, so argument defaults, policy, budgets, +sanitization, stable IDs, warnings, partial results, and evidence semantics +remain owned by existing code. Mode-Off local repository search retains local +results and proves zero remote provider dispatch. The client creates no +Tokio runtime and no process or listener. + +No high or medium residual finding was identified. PyO3 lifecycle, Python +types, cancellation, package metadata, wheel targets, sdist completeness, +and native Python consumer evidence remain explicitly outside M001 and are +gated by M002-M004. + +Recommendation: **closed**. M001 acceptance criteria are met on the exact +candidate above. M002 is ready; M003 and M004 remain predecessor-gated. diff --git a/plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md b/plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md index 73219a17..e87facdd 100644 --- a/plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md +++ b/plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md @@ -1,6 +1,6 @@ # M001 — Shared SDK Facade and Ten-Tool Parity -Status: ready +Status: closed Primary class: infrastructure Source: `plans/subsystems/python-native-library-roadmap.md` M001 Baseline: `main` `f386b07d7adaa06bbb4a51a9d7e2eecf971c238b` (2026-10-13, Cargo 0.4.3) diff --git a/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md b/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md index 2ec6f0ed..0aba6a50 100644 --- a/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md +++ b/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md @@ -1,9 +1,9 @@ # M002 — PyO3 Asyncio Execution and Lifecycle -Status: blocked (hard dependency: M001 closed) +Status: ready Primary class: capability Source: `plans/subsystems/python-native-library-roadmap.md` M002 -Planning baseline: `main` `f386b07d7adaa06bbb4a51a9d7e2eecf971c238b`; rebase implementation evidence after M001 closure. +Planning baseline: M001 SDK candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; M001 closure evidence is `plans/closure/python-native-library/001-status.md`. ADRs: `ADR-0001`, `ADR-0005`; long-term sections 1-4, 6-9 of `plans/000-long-term-specification.md`. ## Objective, readiness, non-goals diff --git a/plans/registry.md b/plans/registry.md index a2f862b4..eb74aee1 100644 --- a/plans/registry.md +++ b/plans/registry.md @@ -42,7 +42,7 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | MCP tool-surface consolidation | closed | `plans/subsystems/tool-surface-consolidation-roadmap.md` | M001-M007 closed | M001-M007 closed. Current control points `plans/closure/mcp-tool-surface-consolidation/001-status.md` through `007-status.md`. | | Dependency evidence hardening | closed | `plans/subsystems/dependency-evidence-hardening-roadmap.md` | M010 corrective closed | M001-M010 closed. Current control point `plans/closure/dependency-evidence-hardening/010-status.md`; implementation `23676cc`, CI `36253474005`. | | Repository security, supply-chain, and maintenance hardening | active | `plans/subsystems/repository-hardening-roadmap.md` | M001/M002/M007/M008/M009/M010 closed; M006 blocked | Scheduled dependency-security run `38290328560` succeeded; M010 records M001/M007 closure. M002 closed by M009; M006 remains externally blocked on chromiumoxide. | -| Python native library for agents | active (M001 ready; M002-M004 blocked) | `plans/subsystems/python-native-library-roadmap.md` | M001 Rust SDK facade and parity ready; M002 asyncio binding, M003 Python agent API, M004 wheel release qualification gated | ADR-0005 accepted; Python-only in-process SDK workstream. M002 hard-gated by M001 closure, M003 by M002, M004 by M003 and release qualification. | +| Python native library for agents | active (M001 closed; M002 ready; M003-M004 blocked) | `plans/subsystems/python-native-library-roadmap.md` | M001 closed at `plans/closure/python-native-library/001-status.md`; M002 PyO3 asyncio binding ready | ADR-0005 accepted; Python-only in-process SDK workstream. M003 is hard-gated by M002; M004 by M003 and release qualification. | ## Dependency-ready implementation plans @@ -84,8 +84,8 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | Repository hardening | M008 Windows startup + cross-target release portability | closed | `plans/implementation/repository-hardening/008-windows-startup-cross-target-portability-corrective.md` | Closed at `44f38ab`; closure `plans/closure/repository-hardening/008-status.md`. CI `37036453017`, egress `37036467646`, release qualify `37036489273` all green on the exact candidate. | | Repository hardening | M009 first tagged-release provenance reconciliation | closed | `plans/closure/repository-hardening/009-status.md` | Implementation `cf1e26a`; M002 closed after auditing v0.4.1 release run `37072825644` and its attestation/immutability evidence. | | Repository hardening | M010 scheduled dependency-security evidence reconciliation | closed | `plans/closure/repository-hardening/010-status.md` | Closed at `31175e2`; first schedule-event run `38290328560` completed successfully on `90e996ef6c83c969e30c30a36bc9d968a85dc00f`. | -| Python native library | M001 shared Rust SDK facade/parity | **ready** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | No outstanding hard dependencies; preserve all ten tool semantics and Mode-Off zero dispatch. | -| Python native library | M002 PyO3 asyncio binding/lifecycle | **blocked** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | Hard dependency: M001 closure; no per-call Tokio runtime or MCP subprocess. | +| Python native library | M001 shared Rust SDK facade/parity | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; closure `plans/closure/python-native-library/001-status.md`. | +| Python native library | M002 PyO3 asyncio binding/lifecycle | **ready** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | M001 hard dependency closed; preserve bounded JSON conversion and no per-call Tokio runtime or MCP subprocess. | | Python native library | M003 Python agent API, types, parity | **blocked** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Hard dependency: M002 closure; all ten native methods and trusted semantics. | | Python native library | M004 wheels, sdist and release qualification | **blocked** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Hard dependency: M003 closure; operational gate: target qualification and separate publish approval. | @@ -100,7 +100,7 @@ Corrective closure sequence: `plans/implementation/dependency-evidence-hardening ## Current execution order and dependency gates -**Python native library gate:** ADR-0005 authorizes a narrow direct Rust SDK facade and Python PyO3 native package without broad Rust module stability. M001 is ready; M002-M004 must not be handed off before prior milestone closure records and registry updates. Python package publication is separately authorized and does not alter Eggpack binary assets. +**Python native library gate:** ADR-0005 authorizes a narrow direct Rust SDK facade and Python PyO3 native package without broad Rust module stability. M001 is closed with exact-candidate parity evidence; M002 is ready; M003-M004 remain gated by predecessor closure. Python package publication is separately authorized and does not alter Eggpack binary assets. **Tool-surface gate:** M001-M007 closed. Do not run evaluation against pre-consolidation bytes and present it as consolidation @@ -172,7 +172,7 @@ release that makes HTTP discovery / reqwest optional without regressing | Repository hardening | active; M008 closed, M007 conditional, M002 conditional, M006 blocked | M008 closed at `44f38ab` (`008-status.md`); M007 remains conditional evidence control point. Historical closure records `001-status.md` through `008-status.md`. | | CodeGG legacy search parity | closed; M001 through M005 closed | `plans/closure/codegg-legacy-search-parity/005-status.md`; prior control points `plans/closure/codegg-legacy-search-parity/004-status.md` and `003-status.md`; implementations `e9103b4` (M001), `5233315` (M002), `8e5ec75` (M003), `81a2e49` (M004 release-prep), `32769d6` (M005 fix-prep); historical provider-parity closure retained, new Mode-Off locality issue separately registered | | Mode-Off local repository dispatch corrective | active; M001 closed; M002 and M003 blocked | M001 closure `plans/closure/mode-off-repository-locality-corrective/001-status.md` at `cc0c9c7`; M002 blocked pending M003 and immutable release evidence; M003 implementation `fcb1fb5`, blocked pending default-branch hosted qualification, closure `plans/closure/mode-off-repository-locality-corrective/003-status.md`. CodeGG paired requalification remains consumer-owned. | -| Python native library | active; M001 ready, M002-M004 blocked | `plans/subsystems/python-native-library-roadmap.md`; forthcoming `plans/closure/python-native-library/001-status.md` through `004-status.md` only upon executed evidence | +| Python native library | active; M001 closed, M002 ready, M003-M004 blocked | `plans/subsystems/python-native-library-roadmap.md`; M001 control point `plans/closure/python-native-library/001-status.md` | ## Closure rule diff --git a/plans/subsystems/python-native-library-roadmap.md b/plans/subsystems/python-native-library-roadmap.md index b9ddd903..db0e65a7 100644 --- a/plans/subsystems/python-native-library-roadmap.md +++ b/plans/subsystems/python-native-library-roadmap.md @@ -1,6 +1,6 @@ # Python Native Library Roadmap -Status: active (M001 ready; M002-M004 blocked by predecessor closure) +Status: active (M001 closed; M002 ready; M003-M004 blocked by predecessor closure) Planning baseline: `eggstack/eggsearch` `main` at `f386b07d7adaa06bbb4a51a9d7e2eecf971c238b` (2026-10-13, Cargo package version 0.4.3) Primary outcome: in-process async Python library consumable by coding and research agents. @@ -44,8 +44,8 @@ Interfaces after M001 may inform parallel exploratory packaging, but the officia | Milestone | Class | Status | Plan | User-facing exit | |---|---|---|---|---| -| M001 direct execution facade | infrastructure | **ready** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Ten canonical operations callable in-process by Rust; zero policy drift; no Python packaging claim | -| M002 native asyncio bridge | capability | **blocked (hard: M001 closure)** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | Python asyncio client invokes ten tools concurrently without MCP process, honors typed errors and shutdown | +| M001 direct execution facade | infrastructure | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Closure `plans/closure/python-native-library/001-status.md`; candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; ten handler parity cases, Mode-Off zero-dispatch counter, and `make check` passed | +| M002 native asyncio bridge | capability | **ready** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | M001 hard dependency closed; Python asyncio client invokes ten tools concurrently without MCP process, honors typed errors and shutdown | | M003 Python agent ergonomics and safety | capability | **blocked (hard: M002 closure)** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Typed, documented Python tool wrappers and representative working agent workflow | | M004 Python distribution and qualification | infrastructure | **blocked (hard: M003 closure; operational: publisher approval/platform qualification)** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Clean wheel/sdist installation and reproducible native consumer smoke on qualified targets | @@ -67,6 +67,6 @@ Interfaces after M001 may inform parallel exploratory packaging, but the officia ## Verification and closure -Each milestone adds deterministic no-network fixtures and the `make check` root gate; package milestones additionally use Python pytest/type checks and clean installation. Track contract parity for all ten tools plus failure/warning/Mode-Off cases, not only `web_search` happy-path. Run `cargo package --list`/`cargo publish --dry-run --locked` for root after packaging changes. Every milestone creates `plans/closure/python-native-library/NNN-status.md` with source SHA, completed evidence matrix, tests and outcomes, open findings, compatibility/security evidence and final status, and updates this roadmap + registry in the same closure commit. +Each milestone adds deterministic no-network fixtures and the `make check` root gate; package milestones additionally use Python pytest/type checks and clean installation. Track contract parity for all ten tools plus failure/warning/Mode-Off cases, not only `web_search` happy-path. Run `cargo package --list`/`cargo publish --dry-run --locked` for root after packaging changes. Every milestone creates `plans/closure/python-native-library/NNN-status.md` with source SHA, completed evidence matrix, tests and outcomes, open findings, compatibility/security evidence and final status, and updates this roadmap + registry in the same closure commit. M001 is closed by `plans/closure/python-native-library/001-status.md`; M002 is now dependency-ready. Do not declare Python availability merely because a PyO3 extension compiled; user-visible capability requires a real Python consumer smoke. Do not publish wheels until exact-SHA qualification and separate publisher approval. Branch and PR handoff is acceptable; do not merge planning into unrelated repository-hardening or Mode-Off release work. From 2392e72178aa249445a64bd629caac8219353499 Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 01:02:55 +0000 Subject: [PATCH 03/13] feat: add native Python async binding --- architecture/python-library.md | 9 +- architecture/testing.md | 4 +- bindings/python/Cargo.lock | 3084 +++++++++++++++++ bindings/python/Cargo.toml | 19 + bindings/python/README.md | 5 + bindings/python/pyproject.toml | 27 + bindings/python/python/eggsearch/__init__.py | 3 + bindings/python/python/eggsearch/py.typed | 1 + bindings/python/src/lib.rs | 396 +++ bindings/python/tests/test_native.py | 153 + docs/test-inventory.md | 15 + .../002-pyo3-async-execution-and-lifecycle.md | 2 +- plans/registry.md | 4 +- .../python-native-library-roadmap.md | 4 +- skills/eggsearch-dev/SKILL.md | 10 + 15 files changed, 3728 insertions(+), 8 deletions(-) create mode 100644 bindings/python/Cargo.lock create mode 100644 bindings/python/Cargo.toml create mode 100644 bindings/python/README.md create mode 100644 bindings/python/pyproject.toml create mode 100644 bindings/python/python/eggsearch/__init__.py create mode 100644 bindings/python/python/eggsearch/py.typed create mode 100644 bindings/python/src/lib.rs create mode 100644 bindings/python/tests/test_native.py diff --git a/architecture/python-library.md b/architecture/python-library.md index d62ac4e7..7dec1033 100644 --- a/architecture/python-library.md +++ b/architecture/python-library.md @@ -7,7 +7,7 @@ operations. Its ownership boundary is registered in Current handoff: M001's shared Rust facade and ten-operation parity are closed at `plans/closure/python-native-library/001-status.md`; M002's native -asyncio bridge is ready. +asyncio bridge is active. ## Rust operation facade @@ -30,7 +30,12 @@ The Python package lives in an independent `bindings/python` Cargo package. PyO3 and Python packaging dependencies must not enter the root crate's default dependency graph or change its binary artifact inventory. Python import is side-effect-free. The binding owns Python types and lifecycle -adaptation; all execution delegates through `src/sdk.rs`. +adaptation; all execution delegates through `src/sdk.rs`. The PyO3 layer +initializes one process-scoped Tokio runtime on first operation, caps shared +in-flight calls at 32, and bounds JSON conversion to 1 MiB, 64 levels, and +10,000 values. `aclose()` rejects new work, cancels active operations, and +waits for their Rust futures to drop; Python task cancellation drops its +corresponding future. The runtime intentionally remains process-scoped. Milestone status and exact-candidate evidence live in `plans/registry.md` and `plans/closure/python-native-library/`. A compiled diff --git a/architecture/testing.md b/architecture/testing.md index 68300f6e..1988fed6 100644 --- a/architecture/testing.md +++ b/architecture/testing.md @@ -1,6 +1,6 @@ # Testing -**Location:** `tests/` (78 `*.rs` suites), `src/**/tests` (module unit tests), `benches/perf.rs`, `fuzz/fuzz_targets/` (23 targets) +**Location:** `tests/` (78 `*.rs` suites), `src/**/tests` (module unit tests), `bindings/python/tests/`, `benches/perf.rs`, `fuzz/fuzz_targets/` (23 targets) **Purpose:** Behavioral contracts first, property tests for pure functions, fault injection for dispatch, corpus regression for multi-step workflows, fuzz for adversarial input, Criterion for characterization. Per-suite counts live in `docs/test-inventory.md`; suite placement rules live in `skills/eggsearch-dev/SKILL.md` and the table below is the placement authority. This document explains how the layers fit together and which commands are canonical. @@ -24,6 +24,7 @@ Per-suite counts live in `docs/test-inventory.md`; suite placement rules live in | `tests/mcp_http.rs` | Loopback Streamable HTTP lifecycle and transport hardening | | `packaging/test-install.sh`, `packaging/test-install.ps1` | Installer behavior (not `tests/`) | | `src/**/mod.rs` unit tests | Private-function coverage at the bottom of the source file | +| `bindings/python/tests/test_native.py` | PyO3 asyncio consumer behavior, bounded input conversion, cancellation and close lifecycle | --- @@ -73,6 +74,7 @@ Use behavioral suite names. Historical phase-suite names are retired; do not int - Provider failure modes go in `dispatch_fault_injection.rs`, not scattered across workflow suites. - Packaging behavior belongs under `packaging/test-install.sh` and `packaging/test-install.ps1`, never under `tests/`. - Multi-step regressions go in `corpus_runner.rs`; single-step edge cases stay in the owning behavioral suite. +- Python binding behavior belongs in `bindings/python/tests/`; run it after building the extension with the package's pinned maturin version. Keep its inventory in `docs/test-inventory.md`. --- diff --git a/bindings/python/Cargo.lock b/bindings/python/Cargo.lock new file mode 100644 index 00000000..8feb83e3 --- /dev/null +++ b/bindings/python/Cargo.lock @@ -0,0 +1,3084 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e76a019e91224d279006ff972f1e984179a6e9feb050adba6ce8274aef23195" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "async-compression" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3976abdc8fe7d1133d43d304afd42abdf5bc3e1319d263d223bde07b5efc4be8" +dependencies = [ + "compression-codecs", + "compression-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "axum" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" +dependencies = [ + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", +] + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bitflags" +version = "2.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "brotli" +version = "8.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc91aac060a7a1e25823bdccbfb6af1875b88f17c6daac97894eed8207166b3" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "5.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a32acac15fe1967bc3986b2a6347dffc965602354ea6f450ad07e8bfd253583" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cc" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "509591b7bcd67f4ef775afad7662703b4935daaa6ec0e5605cfb1090b32a2b6d" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "compression-codecs" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2548391e9c1929c21bf6aa2680af86fe4c1b33e6cea9ac1cfeec0bd11218cf" +dependencies = [ + "brotli", + "compression-core", + "flate2", + "memchr", +] + +[[package]] +name = "compression-core" +version = "0.4.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc14f565cf027a105f7a44ccf9e5b424348421a1d8952a8fc9d499d313107789" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "cssparser" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3df4f93e5fbbe73ec01ec8d3f68bba73107993a5b1e7519273c32db9b0d5be" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.11.3", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.3", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "derive_more" +version = "0.99.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "eggfetch-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cd254b82aa20d1becb6e3e90a5103e8bcc2d7057bb13532096326e43cd98904" +dependencies = [ + "async-compression", + "brotli", + "bytes", + "flate2", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "pem-rfc7468", + "percent-encoding", + "pin-project-lite", + "rustls", + "serde", + "serde_json", + "thiserror 2.0.20", + "tokio", + "tokio-rustls", + "tokio-util", + "tower-service", + "url", + "webpki-roots 0.26.11", +] + +[[package]] +name = "eggsearch" +version = "0.4.3" +dependencies = [ + "anyhow", + "axum", + "chrono", + "clap", + "dirs", + "eggfetch-core", + "ego-tree", + "futures", + "http", + "libc", + "lru", + "pulldown-cmark", + "quick-xml", + "regex", + "rmcp", + "schemars", + "scraper", + "self-replace", + "semver", + "serde", + "serde_json", + "sha2", + "tempfile", + "thiserror 1.0.69", + "tokio", + "tokio-util", + "toml", + "tracing", + "tracing-subscriber", + "url", + "urlencoding", + "windows-service", + "xxhash-rust", +] + +[[package]] +name = "eggsearch-python" +version = "0.4.3" +dependencies = [ + "eggsearch", + "futures", + "pyo3", + "pyo3-async-runtimes", + "serde_json", + "tokio", + "tokio-util", +] + +[[package]] +name = "ego-tree" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12a0bb14ac04a9fcf170d0bbbef949b44cc492f4452bd20c095636956f653642" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "find-msvc-tools" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide", + "zlib-rs", +] + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getopts" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "html5ever" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "log", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92a7ed671a6aad807a8651a2e1782a6598fda9ce5185dd8158549e95a91c6428" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown", + "serde", + "serde_core", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "libredox" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d0a00925a9f930d679b6789b721e3a7f9ed110f41b86d2497caa780c3a070a" +dependencies = [ + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" + +[[package]] +name = "lru" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d2f2f9b4ba7e6b24d95e7e899329d35be83bcded72c8540cdd5368932d1d90a" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "markup5ever" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" +dependencies = [ + "log", + "phf 0.11.3", + "phf_codegen 0.11.3", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "pastey" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" + +[[package]] +name = "pem-rfc7468" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801ef81ab8a21fdd738a9de457509b5c0aef72efa93ffdfc80f3329a1588405b" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared 0.10.0", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.7", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared 0.11.3", + "rand 0.8.7", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher 0.3.11", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher 1.0.3", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "process-wrap" +version = "9.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e842efad9119158434d193c6682e2ebee4b44d6ad801d7b349623b3f57cdf55" +dependencies = [ + "futures", + "indexmap", + "nix", + "tokio", + "tracing", + "windows", +] + +[[package]] +name = "pulldown-cmark" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14" +dependencies = [ + "bitflags", + "getopts", + "memchr", + "pulldown-cmark-escape", + "unicase", +] + +[[package]] +name = "pulldown-cmark-escape" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" + +[[package]] +name = "pyo3" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "700d18fa267b73b9b521fd7e13580e2f446916f176cacee1ab63fcc8191f1655" +dependencies = [ + "libc", + "once_cell", + "portable-atomic", + "pyo3-build-config", + "pyo3-ffi", + "pyo3-macros", +] + +[[package]] +name = "pyo3-async-runtimes" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ef68daa7316a3fac65e5e18b2203f010346de1c1c53456811a2624673ab046" +dependencies = [ + "futures-channel", + "futures-util", + "once_cell", + "pin-project-lite", + "pyo3", + "tokio", +] + +[[package]] +name = "pyo3-build-config" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b3fc0c4d08f6bb10e71fe39dfb9e2f59c6eb6854e22ec8092f50c69a4499adb" +dependencies = [ + "target-lexicon", +] + +[[package]] +name = "pyo3-ffi" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc0b8e19df29aad7086cf977bb0c2a2f143e30567eb113e9cf72b62ca698330" +dependencies = [ + "libc", + "pyo3-build-config", +] + +[[package]] +name = "pyo3-macros" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6100e8a4b5eba53afaa5ed078364851a0b2499c553a44c31026b929049b49dc6" +dependencies = [ + "proc-macro2", + "pyo3-macros-backend", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pyo3-macros-backend" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6143877a16e82b5a727b7127ff4cd86858a24a28d745d72f43e6f227c7b1bdb3" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a" +dependencies = [ + "libc", + "rand_chacha", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 1.0.69", +] + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rmcp" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42b6914fac0be956fe704a38239c3f44a9f841d1b06a5713d2f638065593f5b5" +dependencies = [ + "async-trait", + "base64", + "bytes", + "chrono", + "futures", + "http", + "http-body", + "http-body-util", + "indexmap", + "pastey", + "pin-project-lite", + "process-wrap", + "rand 0.10.2", + "rmcp-macros", + "schemars", + "serde", + "serde_json", + "sse-stream", + "thiserror 2.0.20", + "tokio", + "tokio-stream", + "tokio-util", + "tower-service", + "tracing", + "uuid", +] + +[[package]] +name = "rmcp-macros" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf1c49bd4d52014b94db0877410db273c2008f01628b0252a2e9460ad9b7fda" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "serde_json", + "syn 3.0.3", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0527518605e68109d875e248ea259b6758801cf165e4b2c2733ae3b51f12535a" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "schemars" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "687274d293b6cdc6e73e0fee520bf2049650090d7164f87672d212a3c530cf4a" +dependencies = [ + "chrono", + "dyn-clone", + "ref-cast", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98c67716b46af2f0b8cf752abc930f6f9aecfbf671ecfb531db8a31dbe4e2ba" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 3.0.3", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scraper" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b90460b31bfe1fc07be8262e42c665ad97118d4585869de9345a84d501a9eaf0" +dependencies = [ + "ahash", + "cssparser", + "ego-tree", + "getopts", + "html5ever", + "once_cell", + "selectors", + "tendril", +] + +[[package]] +name = "selectors" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb30575f3638fc8f6815f448d50cb1a2e255b0897985c8c59f4d37b72a07b06" +dependencies = [ + "bitflags", + "cssparser", + "derive_more", + "fxhash", + "log", + "new_debug_unreachable", + "phf 0.10.1", + "phf_codegen 0.10.0", + "precomputed-hash", + "servo_arc", + "smallvec", +] + +[[package]] +name = "self-replace" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ec815b5eab420ab893f63393878d89c90fdd94c0bcc44c07abb8ad95552fb7" +dependencies = [ + "fastrand", + "tempfile", + "windows-sys 0.52.0", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "serde_derive_internals" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "servo_arc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d036d71a959e00c77a63538b90a6c2390969f9772b096ea837205c6bd0491a44" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "siphasher" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "sse-stream" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c25ac7aff0abd1dbc474536e40416e1102c7dd9bfba0b9861c6d357f835dcfb4" +dependencies = [ + "bytes", + "futures-util", + "http-body", + "http-body-util", + "pin-project-lite", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "string_cache" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.11.3", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "target-lexicon" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" +dependencies = [ + "thiserror-impl 2.0.20", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5772d71c9be8a8a6ac2117d949c5b224c1b72241bb611d9a3012edcf8af7812" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.119", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.9", +] + +[[package]] +name = "webpki-roots" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-service" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "857224b3b211c6f3616921f081ee54721ee3ad2ace2fac6a6337e032f7b4dcf2" +dependencies = [ + "bitflags", + "widestring", + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "xxhash-rust" +version = "0.8.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aee1b19627c7c60102ab80d3a9cbe18de90bfe03bfa6c3715447681f0e8c8af6" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94b5c6b5976d66c1d703c4fd17d3f5e43c8cedaacf604961b171adc7130896d8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f212a141d820099d57ffafb9569be9617a6f27d3dc881fbee8fb56642f917a9" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml new file mode 100644 index 00000000..4e7a011e --- /dev/null +++ b/bindings/python/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "eggsearch-python" +version = "0.4.3" +edition = "2021" +rust-version = "1.89" +publish = false + +[lib] +name = "_native" +crate-type = ["cdylib"] + +[dependencies] +eggsearch = { path = "../..", version = "=0.4.3" } +futures = "0.3" +pyo3 = { version = "=0.29.3", features = ["extension-module", "macros"] } +pyo3-async-runtimes = { version = "=0.29.0", features = ["tokio-runtime"] } +serde_json = "1" +tokio = { version = "1", features = ["fs", "io-util", "macros", "net", "rt-multi-thread", "sync", "time"] } +tokio-util = "0.7" diff --git a/bindings/python/README.md b/bindings/python/README.md new file mode 100644 index 00000000..133337ee --- /dev/null +++ b/bindings/python/README.md @@ -0,0 +1,5 @@ +# Eggsearch native Python binding + +This is the isolated PyO3 extension package for the Eggsearch Python library. +It is built independently from the root binary package and is not published +by this project yet. diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml new file mode 100644 index 00000000..49dcc628 --- /dev/null +++ b/bindings/python/pyproject.toml @@ -0,0 +1,27 @@ +[build-system] +requires = ["maturin==1.9.5"] +build-backend = "maturin" + +[project] +name = "eggsearch-native" +version = "0.4.3" +description = "Native asyncio bindings for the Eggsearch evidence engine" +requires-python = ">=3.11,<3.15" +license = "MIT" +readme = "README.md" +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Rust", + "Operating System :: OS Independent", +] + +[tool.maturin] +manifest-path = "Cargo.toml" +python-source = "python" +module-name = "eggsearch._native" +bindings = "pyo3" +features = [] diff --git a/bindings/python/python/eggsearch/__init__.py b/bindings/python/python/eggsearch/__init__.py new file mode 100644 index 00000000..44b4866b --- /dev/null +++ b/bindings/python/python/eggsearch/__init__.py @@ -0,0 +1,3 @@ +from ._native import AsyncEggsearch, EggsearchError, tool_names + +__all__ = ["AsyncEggsearch", "EggsearchError", "tool_names"] diff --git a/bindings/python/python/eggsearch/py.typed b/bindings/python/python/eggsearch/py.typed new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/bindings/python/python/eggsearch/py.typed @@ -0,0 +1 @@ + diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs new file mode 100644 index 00000000..9025f4fc --- /dev/null +++ b/bindings/python/src/lib.rs @@ -0,0 +1,396 @@ +use std::collections::HashSet; +use std::path::PathBuf; +use std::sync::{Arc, LazyLock, Mutex, OnceLock}; + +use eggsearch::core::config::AppConfig; +use eggsearch::sdk::{EggsearchClient, SdkError}; +use futures::FutureExt; +use pyo3::create_exception; +use pyo3::exceptions::{PyTypeError, PyValueError}; +use pyo3::prelude::*; +use pyo3::types::{PyBool, PyDict, PyFloat, PyInt, PyList, PyString, PyTuple}; +use serde_json::{Number, Value}; +use tokio::sync::{Notify, OwnedSemaphorePermit, Semaphore}; +use tokio_util::sync::CancellationToken; + +const MAX_JSON_BYTES: usize = 1_048_576; +const MAX_DEPTH: usize = 64; +const MAX_NODES: usize = 10_000; +const MAX_IN_FLIGHT: usize = 32; + +create_exception!(_native, EggsearchError, pyo3::exceptions::PyException); + +static RUNTIME_INIT: OnceLock<()> = OnceLock::new(); +static IN_FLIGHT: LazyLock> = + LazyLock::new(|| Arc::new(Semaphore::new(MAX_IN_FLIGHT))); + +fn initialize_runtime() { + RUNTIME_INIT.get_or_init(|| { + let mut builder = tokio::runtime::Builder::new_multi_thread(); + builder + .worker_threads(4) + .max_blocking_threads(8) + .enable_all(); + pyo3_async_runtimes::tokio::init(builder); + }); +} + +#[derive(Default)] +struct Lifecycle { + closed: bool, + active: usize, +} + +struct ClientState { + client: EggsearchClient, + lifecycle: Mutex, + cancelled: CancellationToken, + drained: Notify, +} + +impl ClientState { + fn register(self: &Arc) -> Result { + let mut lifecycle = self + .lifecycle + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner); + if lifecycle.closed { + return Err(SdkError { + code: "client_closed".into(), + message: "Eggsearch client is closed".into(), + repair: None, + data: None, + }); + } + lifecycle.active += 1; + Ok(ActiveCall { + state: self.clone(), + }) + } + + fn close(&self) { + let mut lifecycle = self + .lifecycle + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner); + lifecycle.closed = true; + drop(lifecycle); + self.cancelled.cancel(); + } + + async fn wait_drained(&self) { + loop { + let notified = self.drained.notified(); + tokio::pin!(notified); + notified.as_mut().enable(); + let active = self + .lifecycle + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .active; + if active == 0 { + return; + } + notified.await; + } + } +} + +struct ActiveCall { + state: Arc, +} + +impl Drop for ActiveCall { + fn drop(&mut self) { + let mut lifecycle = self + .state + .lifecycle + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner); + lifecycle.active = lifecycle.active.saturating_sub(1); + let drained = lifecycle.active == 0; + drop(lifecycle); + if drained { + self.state.drained.notify_waiters(); + } + } +} + +#[pyclass(name = "AsyncEggsearch")] +struct PyAsyncEggsearch { + state: Arc, +} + +#[pymethods] +impl PyAsyncEggsearch { + #[new] + #[pyo3(signature = (config_path=None))] + fn new(config_path: Option) -> PyResult { + let config = match config_path { + Some(path) => AppConfig::load(&path).map_err(|error| { + PyValueError::new_err(format!("invalid Eggsearch configuration: {error}")) + })?, + None => AppConfig::default(), + }; + let client = EggsearchClient::new(config).map_err(|error| { + PyValueError::new_err(format!("invalid Eggsearch configuration: {error}")) + })?; + Ok(Self { + state: Arc::new(ClientState { + client, + lifecycle: Mutex::new(Lifecycle::default()), + cancelled: CancellationToken::new(), + drained: Notify::new(), + }), + }) + } + + fn execute<'py>( + &self, + py: Python<'py>, + tool: String, + arguments: &Bound<'py, PyAny>, + ) -> PyResult> { + initialize_runtime(); + let active_call = self + .state + .register() + .map_err(|error| sdk_error(py, error))?; + let arguments = python_to_json(py, arguments)?; + let permit = IN_FLIGHT.clone().try_acquire_owned().map_err(|_| { + sdk_error( + py, + SdkError { + code: "budget_invalid".into(), + message: "native execution concurrency limit reached".into(), + repair: None, + data: None, + }, + ) + })?; + let state = self.state.clone(); + pyo3_async_runtimes::tokio::future_into_py(py, async move { + let _active_call = active_call; + let _permit: OwnedSemaphorePermit = permit; + let result = std::panic::AssertUnwindSafe(async { + tokio::select! { + _ = state.cancelled.cancelled() => Err(SdkError { + code: "client_closed".into(), + message: "Eggsearch client closed while the operation was running".into(), + repair: None, + data: None, + }), + result = state.client.execute(tool, arguments) => result, + } + }) + .catch_unwind() + .await + .unwrap_or_else(|_| { + Err(SdkError { + code: "internal".into(), + message: "internal native operation failure".into(), + repair: None, + data: None, + }) + }); + Python::attach(|py| match result { + Ok(value) => json_to_python(py, &value).map(Bound::unbind), + Err(error) => Err(sdk_error(py, error)), + }) + }) + } + + fn aclose<'py>(&self, py: Python<'py>) -> PyResult> { + initialize_runtime(); + self.state.close(); + let state = self.state.clone(); + pyo3_async_runtimes::tokio::future_into_py(py, async move { + state.wait_drained().await; + Python::attach(|py| Ok(py.None())) + }) + } +} + +#[pyfunction] +fn tool_names() -> Vec<&'static str> { + EggsearchClient::tool_names().collect() +} + +#[pymodule] +fn _native(module: &Bound<'_, PyModule>) -> PyResult<()> { + module.add_class::()?; + module.add("EggsearchError", module.py().get_type::())?; + module.add_function(wrap_pyfunction!(tool_names, module)?)?; + Ok(()) +} + +fn python_to_json(py: Python<'_>, object: &Bound<'_, PyAny>) -> PyResult { + if !object.is_instance_of::() { + return Err(PyTypeError::new_err("tool arguments must be a dict")); + } + let mut seen = HashSet::new(); + let mut nodes = 0; + let value = python_value_to_json(object, 0, &mut nodes, &mut seen)?; + let encoded = serde_json::to_vec(&value) + .map_err(|_| PyValueError::new_err("tool arguments are not valid JSON values"))?; + if encoded.len() > MAX_JSON_BYTES { + return Err(PyValueError::new_err( + "tool arguments exceed the 1 MiB limit", + )); + } + let _ = py; + Ok(value) +} + +fn python_value_to_json( + object: &Bound<'_, PyAny>, + depth: usize, + nodes: &mut usize, + seen: &mut HashSet, +) -> PyResult { + *nodes += 1; + if depth > MAX_DEPTH || *nodes > MAX_NODES { + return Err(PyValueError::new_err( + "tool arguments exceed structural limits", + )); + } + if object.is_none() { + return Ok(Value::Null); + } + if object.is_instance_of::() { + return object.extract::().map(Value::Bool); + } + if object.is_instance_of::() { + if let Ok(value) = object.extract::() { + return Ok(Value::Number(Number::from(value))); + } + if let Ok(value) = object.extract::() { + return Ok(Value::Number(Number::from(value))); + } + return Err(PyValueError::new_err( + "integer is outside the JSON numeric range", + )); + } + if object.is_instance_of::() { + let value = object.extract::()?; + let number = Number::from_f64(value) + .ok_or_else(|| PyValueError::new_err("non-finite numbers are not valid JSON"))?; + return Ok(Value::Number(number)); + } + if object.is_instance_of::() { + return object.extract::().map(Value::String); + } + + let identity = object.as_ptr() as usize; + if !seen.insert(identity) { + return Err(PyValueError::new_err( + "cyclic tool arguments are not supported", + )); + } + let converted = if let Ok(dict) = object.cast::() { + if dict.len() > MAX_NODES { + Err(PyValueError::new_err( + "tool arguments exceed structural limits", + )) + } else { + let mut result = serde_json::Map::new(); + for (key, value) in dict.iter() { + let key = key.extract::().map_err(|_| { + PyTypeError::new_err("tool argument object keys must be strings") + })?; + let value = python_value_to_json(&value, depth + 1, nodes, seen)?; + result.insert(key, value); + } + Ok(Value::Object(result)) + } + } else if let Ok(list) = object.cast::() { + if list.len() > MAX_NODES { + Err(PyValueError::new_err( + "tool arguments exceed structural limits", + )) + } else { + let mut result = Vec::with_capacity(list.len()); + for value in list.iter() { + result.push(python_value_to_json(&value, depth + 1, nodes, seen)?); + } + Ok(Value::Array(result)) + } + } else if let Ok(tuple) = object.cast::() { + if tuple.len() > MAX_NODES { + Err(PyValueError::new_err( + "tool arguments exceed structural limits", + )) + } else { + let mut result = Vec::with_capacity(tuple.len()); + for value in tuple.iter() { + result.push(python_value_to_json(&value, depth + 1, nodes, seen)?); + } + Ok(Value::Array(result)) + } + } else { + Err(PyTypeError::new_err( + "tool arguments must contain only JSON-compatible values", + )) + }; + seen.remove(&identity); + converted +} + +fn json_to_python<'py>(py: Python<'py>, value: &Value) -> PyResult> { + match value { + Value::Null => Ok(py.None().into_bound(py)), + Value::Bool(value) => Ok(value.into_pyobject(py)?.to_owned().into_any()), + Value::Number(value) => { + if let Some(value) = value.as_i64() { + Ok(value.into_pyobject(py)?.into_any()) + } else if let Some(value) = value.as_u64() { + Ok(value.into_pyobject(py)?.into_any()) + } else { + Ok(value + .as_f64() + .unwrap_or_default() + .into_pyobject(py)? + .into_any()) + } + } + Value::String(value) => Ok(value.into_pyobject(py)?.into_any()), + Value::Array(values) => { + let list = PyList::empty(py); + for value in values { + list.append(json_to_python(py, value)?)?; + } + Ok(list.into_any()) + } + Value::Object(values) => { + let dict = PyDict::new(py); + for (key, value) in values { + dict.set_item(key, json_to_python(py, value)?)?; + } + Ok(dict.into_any()) + } + } +} + +fn sdk_error(py: Python<'_>, error: SdkError) -> PyErr { + let exception = PyErr::new::(error.message.clone()); + let value = exception.value(py); + let _ = value.setattr("code", error.code); + let _ = value.setattr("message", error.message); + let repair = error + .repair + .as_ref() + .map(|value| json_to_python(py, value)) + .transpose(); + let data = error + .data + .as_ref() + .map(|value| json_to_python(py, value)) + .transpose(); + if let Ok(repair) = repair { + let _ = value.setattr("repair", repair); + } + if let Ok(data) = data { + let _ = value.setattr("data", data); + } + exception +} diff --git a/bindings/python/tests/test_native.py b/bindings/python/tests/test_native.py new file mode 100644 index 00000000..eba8b466 --- /dev/null +++ b/bindings/python/tests/test_native.py @@ -0,0 +1,153 @@ +import asyncio +import math + +import pytest + +from eggsearch import AsyncEggsearch, EggsearchError, tool_names + + +EXPECTED_TOOLS = { + "web_search", + "web_fetch", + "batch_fetch", + "provider_status", + "repo_search", + "repo_fetch", + "repo_map", + "security_search", + "research_search", + "build_evidence_bundle", +} + + +@pytest.fixture +def config_path(tmp_path): + path = tmp_path / "eggsearch.toml" + path.write_text( + "[search]\n" + "mode = 'off'\n" + "default_max_results = 10\n" + "max_results_cap = 50\n" + "max_query_chars = 512\n" + "timeout_ms = 8000\n" + "default_providers = ['duckduckgo']\n" + "sanitize_output = true\n\n" + "[search.providers]\nduckduckgo = true\n\n" + "[fetch]\n" + "enabled = false\n" + "timeout_ms = 8000\n" + "max_bytes = 2000000\n" + "max_chars_default = 12000\n" + "max_chars_cap = 50000\n" + "redirect_limit = 5\n" + "allow_private_network = false\n" + "allow_localhost = false\n" + "sanitize_output = true\n\n" + "[local]\nenabled = false\nroots = []\n", + encoding="utf-8", + ) + return path + + +def test_native_module_import_and_tool_inventory(): + names = tool_names() + assert len(names) == 10 + assert set(names) == EXPECTED_TOOLS + assert len(set(names)) == len(names) + + +def test_native_client_executes_all_operations_without_an_mcp_process(config_path): + arguments = { + "web_search": {"query": "native parity"}, + "web_fetch": {"url": "file:///etc/passwd"}, + "batch_fetch": {"items": []}, + "provider_status": {}, + "repo_search": {"query": "native parity"}, + "repo_fetch": {"owner": "invalid owner", "repo": "bad", "path": "README.md"}, + "repo_map": {"owner": "invalid owner", "repo": "bad"}, + "security_search": {"query": "CVE-2024-1234"}, + "research_search": {"query": "native parity"}, + "build_evidence_bundle": {"sources": [{}]}, + } + + async def run(): + client = AsyncEggsearch(str(config_path)) + outcomes = await asyncio.gather( + *(client.execute(name, value) for name, value in arguments.items()), + return_exceptions=True, + ) + assert len(outcomes) == 10 + assert all(isinstance(value, (dict, EggsearchError)) for value in outcomes) + assert isinstance(outcomes[3], dict) + assert isinstance(outcomes[9], dict) + assert isinstance(outcomes[0], EggsearchError) + assert outcomes[0].code + assert outcomes[0].message + await client.aclose() + await client.aclose() + with pytest.raises(EggsearchError) as closed: + client.execute("provider_status", {}) + assert closed.value.code == "client_closed" + + asyncio.run(run()) + + +@pytest.mark.parametrize( + "arguments", + [ + [], + {1: "not a string key"}, + {"value": object()}, + {"value": math.inf}, + {"value": 10**100}, + {"value": "x" * 1_100_000}, + {"value": "\ud800"}, + ], +) +def test_native_boundary_rejects_invalid_or_oversized_inputs(config_path, arguments): + client = AsyncEggsearch(str(config_path)) + with pytest.raises((TypeError, ValueError)): + client.execute("web_search", arguments) + + async def close(): + await client.aclose() + + asyncio.run(close()) + + +def test_native_boundary_rejects_cycles(config_path): + value = [] + value.append(value) + client = AsyncEggsearch(str(config_path)) + with pytest.raises(ValueError, match="cyclic"): + client.execute("web_search", {"value": value}) + + async def close(): + await client.aclose() + + asyncio.run(close()) + + +def test_native_futures_cancel_and_client_close_is_bounded(config_path): + async def run(): + client = AsyncEggsearch(str(config_path)) + pending = client.execute("provider_status", {}) + pending.cancel() + with pytest.raises(asyncio.CancelledError): + await pending + await client.aclose() + with pytest.raises(EggsearchError): + client.execute("provider_status", {}) + + asyncio.run(run()) + + +def test_native_runtime_supports_sequential_python_event_loops(config_path): + async def run_once(): + client = AsyncEggsearch(str(config_path)) + status = await client.execute("provider_status", {}) + assert isinstance(status, dict) + await client.aclose() + + asyncio.run(run_once()) + asyncio.run(run_once()) diff --git a/docs/test-inventory.md b/docs/test-inventory.md index e3123e5f..bc718f6e 100644 --- a/docs/test-inventory.md +++ b/docs/test-inventory.md @@ -215,3 +215,18 @@ Deterministic `packaging/check-repo-hygiene.sh` runs in `make check` (`make hygi |-----|----------|----------------| | `ci` | ~3min | fmt + clippy + no-default-features check + all-features tests + hygiene + packaging-check | | `windows-portability` | ~4min | `cargo check --locked --all-features --target x86_64-pc-windows-msvc` on `windows-latest` with pinned Rust 1.89; routine PR/main sentinel so Windows cfg breakage cannot hide behind Linux-green CI | + +## Python Native Binding + +| Suite | Runtime | Tests | Focus | +|-------|---------|-------|-------| +| `bindings/python/tests/test_native.py` | CPython 3.11–3.14; PyO3 extension | 12 | Ten-operation asyncio smoke, bounded JSON conversion and invalid inputs, cycles, cancellation/close, and sequential event-loop lifecycle | + +Run from the repository root after installing the extension into an active +virtual environment: + +```bash +maturin develop --manifest-path bindings/python/Cargo.toml --locked +python -m pytest -q bindings/python/tests +python -m compileall bindings/python/python/eggsearch +``` diff --git a/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md b/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md index 0aba6a50..f394cdf6 100644 --- a/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md +++ b/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md @@ -1,6 +1,6 @@ # M002 — PyO3 Asyncio Execution and Lifecycle -Status: ready +Status: active Primary class: capability Source: `plans/subsystems/python-native-library-roadmap.md` M002 Planning baseline: M001 SDK candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; M001 closure evidence is `plans/closure/python-native-library/001-status.md`. diff --git a/plans/registry.md b/plans/registry.md index eb74aee1..20ff5f65 100644 --- a/plans/registry.md +++ b/plans/registry.md @@ -42,7 +42,7 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | MCP tool-surface consolidation | closed | `plans/subsystems/tool-surface-consolidation-roadmap.md` | M001-M007 closed | M001-M007 closed. Current control points `plans/closure/mcp-tool-surface-consolidation/001-status.md` through `007-status.md`. | | Dependency evidence hardening | closed | `plans/subsystems/dependency-evidence-hardening-roadmap.md` | M010 corrective closed | M001-M010 closed. Current control point `plans/closure/dependency-evidence-hardening/010-status.md`; implementation `23676cc`, CI `36253474005`. | | Repository security, supply-chain, and maintenance hardening | active | `plans/subsystems/repository-hardening-roadmap.md` | M001/M002/M007/M008/M009/M010 closed; M006 blocked | Scheduled dependency-security run `38290328560` succeeded; M010 records M001/M007 closure. M002 closed by M009; M006 remains externally blocked on chromiumoxide. | -| Python native library for agents | active (M001 closed; M002 ready; M003-M004 blocked) | `plans/subsystems/python-native-library-roadmap.md` | M001 closed at `plans/closure/python-native-library/001-status.md`; M002 PyO3 asyncio binding ready | ADR-0005 accepted; Python-only in-process SDK workstream. M003 is hard-gated by M002; M004 by M003 and release qualification. | +| Python native library for agents | active (M001 closed; M002 active; M003-M004 blocked) | `plans/subsystems/python-native-library-roadmap.md` | M001 closed at `plans/closure/python-native-library/001-status.md`; M002 PyO3 asyncio bridge in progress | ADR-0005 accepted; Python-only in-process SDK workstream. M003 is hard-gated by M002; M004 by M003 and release qualification. | ## Dependency-ready implementation plans @@ -85,7 +85,7 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | Repository hardening | M009 first tagged-release provenance reconciliation | closed | `plans/closure/repository-hardening/009-status.md` | Implementation `cf1e26a`; M002 closed after auditing v0.4.1 release run `37072825644` and its attestation/immutability evidence. | | Repository hardening | M010 scheduled dependency-security evidence reconciliation | closed | `plans/closure/repository-hardening/010-status.md` | Closed at `31175e2`; first schedule-event run `38290328560` completed successfully on `90e996ef6c83c969e30c30a36bc9d968a85dc00f`. | | Python native library | M001 shared Rust SDK facade/parity | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; closure `plans/closure/python-native-library/001-status.md`. | -| Python native library | M002 PyO3 asyncio binding/lifecycle | **ready** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | M001 hard dependency closed; preserve bounded JSON conversion and no per-call Tokio runtime or MCP subprocess. | +| Python native library | M002 PyO3 asyncio binding/lifecycle | **active** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | M001 hard dependency closed; preserve bounded JSON conversion and no per-call Tokio runtime or MCP subprocess. | | Python native library | M003 Python agent API, types, parity | **blocked** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Hard dependency: M002 closure; all ten native methods and trusted semantics. | | Python native library | M004 wheels, sdist and release qualification | **blocked** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Hard dependency: M003 closure; operational gate: target qualification and separate publish approval. | diff --git a/plans/subsystems/python-native-library-roadmap.md b/plans/subsystems/python-native-library-roadmap.md index db0e65a7..34b6741b 100644 --- a/plans/subsystems/python-native-library-roadmap.md +++ b/plans/subsystems/python-native-library-roadmap.md @@ -1,6 +1,6 @@ # Python Native Library Roadmap -Status: active (M001 closed; M002 ready; M003-M004 blocked by predecessor closure) +Status: active (M001 closed; M002 active; M003-M004 blocked by predecessor closure) Planning baseline: `eggstack/eggsearch` `main` at `f386b07d7adaa06bbb4a51a9d7e2eecf971c238b` (2026-10-13, Cargo package version 0.4.3) Primary outcome: in-process async Python library consumable by coding and research agents. @@ -45,7 +45,7 @@ Interfaces after M001 may inform parallel exploratory packaging, but the officia | Milestone | Class | Status | Plan | User-facing exit | |---|---|---|---|---| | M001 direct execution facade | infrastructure | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Closure `plans/closure/python-native-library/001-status.md`; candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; ten handler parity cases, Mode-Off zero-dispatch counter, and `make check` passed | -| M002 native asyncio bridge | capability | **ready** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | M001 hard dependency closed; Python asyncio client invokes ten tools concurrently without MCP process, honors typed errors and shutdown | +| M002 native asyncio bridge | capability | **active** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | M001 hard dependency closed; Python asyncio client invokes ten tools concurrently without MCP process, honors typed errors and shutdown | | M003 Python agent ergonomics and safety | capability | **blocked (hard: M002 closure)** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Typed, documented Python tool wrappers and representative working agent workflow | | M004 Python distribution and qualification | infrastructure | **blocked (hard: M003 closure; operational: publisher approval/platform qualification)** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Clean wheel/sdist installation and reproducible native consumer smoke on qualified targets | diff --git a/skills/eggsearch-dev/SKILL.md b/skills/eggsearch-dev/SKILL.md index 96e0aadd..9c649202 100644 --- a/skills/eggsearch-dev/SKILL.md +++ b/skills/eggsearch-dev/SKILL.md @@ -66,6 +66,7 @@ cargo bench --locked --all-features --bench perf --no-run # characterization on | `tests/browser_profiles.rs` | `browser` | Browser profile management | | `tests/browser_transport.rs` | `browser` | Browser transport orchestration | | `tests/mcp_http.rs` | `all-features` | Loopback Streamable HTTP lifecycle, bounds, identity, and shutdown | +| `bindings/python/tests/test_native.py` | CPython 3.11–3.14 | Native asyncio bridge, input bounds, cancellation and close lifecycle | This table is representative, not exhaustive — 78 test suites exist. Full per-suite inventory lives in `docs/test-inventory.md`. @@ -89,6 +90,15 @@ For the persistent MCP transport: cargo test --locked --all-features --test mcp_http ``` +For the Python native package, build in an active virtual environment and run +its package-local tests: + +```bash +maturin develop --manifest-path bindings/python/Cargo.toml --locked +python -m pytest -q bindings/python/tests +python -m compileall bindings/python/python/eggsearch +``` + For startup supervision rendering and policy: ```bash From 08b996db8c0927a73601f5961c9eb418e22bd4b5 Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 01:06:42 +0000 Subject: [PATCH 04/13] plans: close Python native library M002 --- architecture/python-library.md | 3 +- .../python-native-library/002-status.md | 56 +++++++++++++++++++ .../002-pyo3-async-execution-and-lifecycle.md | 3 +- .../003-agent-api-types-and-compatibility.md | 4 +- plans/registry.md | 10 ++-- .../python-native-library-roadmap.md | 16 +++--- 6 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 plans/closure/python-native-library/002-status.md diff --git a/architecture/python-library.md b/architecture/python-library.md index 7dec1033..aa0abc1b 100644 --- a/architecture/python-library.md +++ b/architecture/python-library.md @@ -7,7 +7,8 @@ operations. Its ownership boundary is registered in Current handoff: M001's shared Rust facade and ten-operation parity are closed at `plans/closure/python-native-library/001-status.md`; M002's native -asyncio bridge is active. +asyncio bridge is closed at `plans/closure/python-native-library/002-status.md`; +M003's Python API, types, and semantic parity work is active. ## Rust operation facade diff --git a/plans/closure/python-native-library/002-status.md b/plans/closure/python-native-library/002-status.md new file mode 100644 index 00000000..6d602236 --- /dev/null +++ b/plans/closure/python-native-library/002-status.md @@ -0,0 +1,56 @@ +# Python Native Library M002 — PyO3 Asyncio Execution and Lifecycle Closure + +Status: closed +Candidate: `2392e72178aa249445a64bd629caac8219353499` +Implementation plan: `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` +Predecessor: `plans/closure/python-native-library/001-status.md` + +## Delivered + +- Added an independent, unpublished `bindings/python` PyO3 cdylib package with a mixed maturin layout. Root crate defaults and release artifact inventory remain unchanged. +- Bound `AsyncEggsearch.execute` to the shared Rust SDK facade and canonical ten-tool inventory. Imports do not initialize the runtime or execute work; the runtime starts lazily on the first operation. +- Reused one process-scoped Tokio runtime, with a shared 32-operation concurrency cap. Per-client close rejects new operations, cancels active Rust futures, drains them, and is idempotent. Python task cancellation drops the operation future. +- Bounded Python-to-JSON conversion to 1 MiB, depth 64, and 10,000 values; rejected non-dict roots, non-string keys, cycles, unsupported objects, non-finite values, out-of-range integers, invalid Unicode, and oversized values. +- Preserved structured SDK error fields and sanitized panics at the native boundary. No Python reference is held across the asynchronous Rust operation. +- Added package-local tests and synchronized `docs/test-inventory.md`, `architecture/testing.md`, `architecture/python-library.md`, and `skills/eggsearch-dev/SKILL.md`. + +## Verification on the exact candidate + +| Check | Result | +|---|---| +| Rust 1.89 locked extension check: `rustup run 1.89.0 cargo check --locked --manifest-path bindings/python/Cargo.toml` | Passed | +| CPython 3.14.2 editable native build with maturin 1.9.5 | Passed | +| Python package suite: `python -m pytest -q bindings/python/tests` | 12 passed | +| Python source compilation: `python -m compileall -q bindings/python/python/eggsearch` | Passed | +| Root `make check` | Passed, including formatting, Clippy, no-default check, all-feature tests, hygiene, dependency policy, and packaging contract | +| Rust SDK/MCP parity and Mode-Off zero-dispatch counter | Inherited exact-candidate evidence from M001 closure; Python Mode-Off consumer calls also passed without remote providers | + +The first root gate attempt had one failure in the existing +`meta::local_backend::tests::multiple_roots_share_global_cap` assertion. That +test passed alone, and the complete `make check` rerun passed. No source change +was made for that transient result. + +## Compatibility and remaining limits + +The extension was built and exercised locally on CPython 3.14.2, macOS x86_64, +Rust 1.89.0, PyO3 0.29.3, `pyo3-async-runtimes` 0.29.0, and maturin 1.9.5. +CPython 3.11–3.13 and other wheel platforms are not yet runtime-qualified; +M004 owns that matrix. The distribution name is a temporary unpublished +`eggsearch-native` pending M004's PyPI name and metadata preflight. No wheel or +sdist was published. The process-scoped Tokio runtime intentionally remains +alive until process exit. + +## Security and behavior evidence + +The fixture suite covers all ten tool names in concurrent asyncio calls, +invalid and oversized Python inputs, cyclic containers, task cancellation, +idempotent close, rejection after close, and sequential Python event loops. +The Rust bridge applies the SDK's existing request validation and policy. The +root all-feature suite and dependency-policy checks passed on this candidate. + +## Handoff + +M002 is closed. M003 may add Python async context management, named typed +methods, `TypedDict` contracts, examples, and semantic parity coverage while +continuing to delegate every operation through `execute` and the Rust SDK. +M004 remains gated by M003 closure and platform/distribution qualification. diff --git a/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md b/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md index f394cdf6..b601a0f1 100644 --- a/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md +++ b/plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md @@ -1,9 +1,10 @@ # M002 — PyO3 Asyncio Execution and Lifecycle -Status: active +Status: closed Primary class: capability Source: `plans/subsystems/python-native-library-roadmap.md` M002 Planning baseline: M001 SDK candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; M001 closure evidence is `plans/closure/python-native-library/001-status.md`. +Closure: `plans/closure/python-native-library/002-status.md`; candidate `2392e72178aa249445a64bd629caac8219353499`. ADRs: `ADR-0001`, `ADR-0005`; long-term sections 1-4, 6-9 of `plans/000-long-term-specification.md`. ## Objective, readiness, non-goals diff --git a/plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md b/plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md index 6214b2bb..548b30a0 100644 --- a/plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md +++ b/plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md @@ -1,9 +1,9 @@ # M003 — Python Agent API, Types and Semantic Compatibility -Status: blocked (hard dependency: M002 closed) +Status: active Primary class: capability Source: `plans/subsystems/python-native-library-roadmap.md` M003 -Planning baseline: `main` `f386b07d7adaa06bbb4a51a9d7e2eecf971c238b`; refresh after M002. +Planning baseline: M002 candidate `2392e72178aa249445a64bd629caac8219353499`; M002 closure evidence is `plans/closure/python-native-library/002-status.md`. ADRs `ADR-0001`, `ADR-0005`; relevant long-term sections 1-5, 7-9 of `plans/000-long-term-specification.md`. ## Objective and non-goals diff --git a/plans/registry.md b/plans/registry.md index 20ff5f65..e7280199 100644 --- a/plans/registry.md +++ b/plans/registry.md @@ -42,7 +42,7 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | MCP tool-surface consolidation | closed | `plans/subsystems/tool-surface-consolidation-roadmap.md` | M001-M007 closed | M001-M007 closed. Current control points `plans/closure/mcp-tool-surface-consolidation/001-status.md` through `007-status.md`. | | Dependency evidence hardening | closed | `plans/subsystems/dependency-evidence-hardening-roadmap.md` | M010 corrective closed | M001-M010 closed. Current control point `plans/closure/dependency-evidence-hardening/010-status.md`; implementation `23676cc`, CI `36253474005`. | | Repository security, supply-chain, and maintenance hardening | active | `plans/subsystems/repository-hardening-roadmap.md` | M001/M002/M007/M008/M009/M010 closed; M006 blocked | Scheduled dependency-security run `38290328560` succeeded; M010 records M001/M007 closure. M002 closed by M009; M006 remains externally blocked on chromiumoxide. | -| Python native library for agents | active (M001 closed; M002 active; M003-M004 blocked) | `plans/subsystems/python-native-library-roadmap.md` | M001 closed at `plans/closure/python-native-library/001-status.md`; M002 PyO3 asyncio bridge in progress | ADR-0005 accepted; Python-only in-process SDK workstream. M003 is hard-gated by M002; M004 by M003 and release qualification. | +| Python native library for agents | active (M001-M002 closed; M003 active; M004 blocked) | `plans/subsystems/python-native-library-roadmap.md` | M002 closed at `plans/closure/python-native-library/002-status.md`; M003 Python API/types/parity in progress | ADR-0005 accepted; Python-only in-process SDK workstream. M004 is hard-gated by M003 and operational wheel qualification. | ## Dependency-ready implementation plans @@ -85,8 +85,8 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | Repository hardening | M009 first tagged-release provenance reconciliation | closed | `plans/closure/repository-hardening/009-status.md` | Implementation `cf1e26a`; M002 closed after auditing v0.4.1 release run `37072825644` and its attestation/immutability evidence. | | Repository hardening | M010 scheduled dependency-security evidence reconciliation | closed | `plans/closure/repository-hardening/010-status.md` | Closed at `31175e2`; first schedule-event run `38290328560` completed successfully on `90e996ef6c83c969e30c30a36bc9d968a85dc00f`. | | Python native library | M001 shared Rust SDK facade/parity | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; closure `plans/closure/python-native-library/001-status.md`. | -| Python native library | M002 PyO3 asyncio binding/lifecycle | **active** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | M001 hard dependency closed; preserve bounded JSON conversion and no per-call Tokio runtime or MCP subprocess. | -| Python native library | M003 Python agent API, types, parity | **blocked** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Hard dependency: M002 closure; all ten native methods and trusted semantics. | +| Python native library | M002 PyO3 asyncio binding/lifecycle | **closed** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | Candidate `2392e72`; closure `plans/closure/python-native-library/002-status.md`; bounded conversion, cancellation/close, and ten-operation consumer smoke. | +| Python native library | M003 Python agent API, types, parity | **active** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | M002 closed; add typed named methods and examples while preserving SDK semantics. | | Python native library | M004 wheels, sdist and release qualification | **blocked** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Hard dependency: M003 closure; operational gate: target qualification and separate publish approval. | Sequencing overview: `plans/implementation/mcp-tool-surface-consolidation/000-overview-and-sequencing.md`. @@ -100,7 +100,7 @@ Corrective closure sequence: `plans/implementation/dependency-evidence-hardening ## Current execution order and dependency gates -**Python native library gate:** ADR-0005 authorizes a narrow direct Rust SDK facade and Python PyO3 native package without broad Rust module stability. M001 is closed with exact-candidate parity evidence; M002 is ready; M003-M004 remain gated by predecessor closure. Python package publication is separately authorized and does not alter Eggpack binary assets. +**Python native library gate:** ADR-0005 authorizes a narrow direct Rust SDK facade and Python PyO3 native package without broad Rust module stability. M001-M002 are closed with exact-candidate evidence; M003 is active and M004 remains gated by M003 and platform qualification. Python package publication is separately authorized and does not alter Eggpack binary assets. **Tool-surface gate:** M001-M007 closed. Do not run evaluation against pre-consolidation bytes and present it as consolidation @@ -172,7 +172,7 @@ release that makes HTTP discovery / reqwest optional without regressing | Repository hardening | active; M008 closed, M007 conditional, M002 conditional, M006 blocked | M008 closed at `44f38ab` (`008-status.md`); M007 remains conditional evidence control point. Historical closure records `001-status.md` through `008-status.md`. | | CodeGG legacy search parity | closed; M001 through M005 closed | `plans/closure/codegg-legacy-search-parity/005-status.md`; prior control points `plans/closure/codegg-legacy-search-parity/004-status.md` and `003-status.md`; implementations `e9103b4` (M001), `5233315` (M002), `8e5ec75` (M003), `81a2e49` (M004 release-prep), `32769d6` (M005 fix-prep); historical provider-parity closure retained, new Mode-Off locality issue separately registered | | Mode-Off local repository dispatch corrective | active; M001 closed; M002 and M003 blocked | M001 closure `plans/closure/mode-off-repository-locality-corrective/001-status.md` at `cc0c9c7`; M002 blocked pending M003 and immutable release evidence; M003 implementation `fcb1fb5`, blocked pending default-branch hosted qualification, closure `plans/closure/mode-off-repository-locality-corrective/003-status.md`. CodeGG paired requalification remains consumer-owned. | -| Python native library | active; M001 closed, M002 ready, M003-M004 blocked | `plans/subsystems/python-native-library-roadmap.md`; M001 control point `plans/closure/python-native-library/001-status.md` | +| Python native library | active; M001-M002 closed, M003 active, M004 blocked | `plans/subsystems/python-native-library-roadmap.md`; M002 control point `plans/closure/python-native-library/002-status.md` | ## Closure rule diff --git a/plans/subsystems/python-native-library-roadmap.md b/plans/subsystems/python-native-library-roadmap.md index 34b6741b..a409d9ba 100644 --- a/plans/subsystems/python-native-library-roadmap.md +++ b/plans/subsystems/python-native-library-roadmap.md @@ -1,6 +1,6 @@ # Python Native Library Roadmap -Status: active (M001 closed; M002 active; M003-M004 blocked by predecessor closure) +Status: active (M001-M002 closed; M003 active; M004 blocked by M003 and platform qualification) Planning baseline: `eggstack/eggsearch` `main` at `f386b07d7adaa06bbb4a51a9d7e2eecf971c238b` (2026-10-13, Cargo package version 0.4.3) Primary outcome: in-process async Python library consumable by coding and research agents. @@ -28,25 +28,25 @@ TypeScript, Node, C ABI, standalone C shim, WASM, universal CPython/PyPy support ## Baseline evidence -`src/lib.rs` promises only MCP/CLI stability. `src/mcp/tools/mod.rs` exports the ten `run_*` functions; tools accept typed args and return structured `serde_json::Value` with `ToolError`, alongside one synchronous evidence bundler. `src/mcp/state.rs` constructs shared adapter/fetch/cache/local state from `AppConfig`. `src/mcp/projection.rs` has compact/standard/diagnostic projections. `Cargo.toml` describes one root library+binary with no PyO3 or maturin and no existing `bindings/python` package. `plans/registry.md` currently has no Python library workstream. Current `Cargo.toml` version 0.4.3 is source baseline, not proof of PyPI availability or publication. +At the planning baseline, `src/lib.rs` promised only MCP/CLI stability, `src/mcp/tools/mod.rs` exported the ten `run_*` functions, `src/mcp/state.rs` constructed shared adapter/fetch/cache/local state from `AppConfig`, and `src/mcp/projection.rs` owned compact/standard/diagnostic projections. The baseline `Cargo.toml` had no PyO3 or maturin and no `bindings/python` package. Its version 0.4.3 is a source baseline, not proof of PyPI availability or publication. ## Dependency graph and milestones `M001 (infrastructure: shared SDK contract and parity)` -> hard closed `M002 (capability: native PyO3 asyncio execution and lifecycle)` - -> hard closed + -> closed at `plans/closure/python-native-library/002-status.md` `M003 (capability: ergonomic Python agent API, types, examples, semantic parity)` - -> hard closed + -> active `M004 (infrastructure + operational: wheel/sdist/release qualification)` -Interfaces after M001 may inform parallel exploratory packaging, but the official M002-M004 handoff remains blocked until predecessor closure. No cross-repository or Mode-Off release blocker is waived: develop against current main and re-run the exact Mode-Off regressions, with separate operational gating for publication if existing immutable-release qualification remains blocked. +M002 is closed and M003 is active. M004 remains gated by M003 closure and platform qualification. No cross-repository or Mode-Off release blocker is waived: re-run the exact Mode-Off regressions, with separate operational gating for publication if existing immutable-release qualification remains blocked. | Milestone | Class | Status | Plan | User-facing exit | |---|---|---|---|---| | M001 direct execution facade | infrastructure | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Closure `plans/closure/python-native-library/001-status.md`; candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; ten handler parity cases, Mode-Off zero-dispatch counter, and `make check` passed | -| M002 native asyncio bridge | capability | **active** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | M001 hard dependency closed; Python asyncio client invokes ten tools concurrently without MCP process, honors typed errors and shutdown | -| M003 Python agent ergonomics and safety | capability | **blocked (hard: M002 closure)** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Typed, documented Python tool wrappers and representative working agent workflow | +| M002 native asyncio bridge | capability | **closed** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | Closure `plans/closure/python-native-library/002-status.md`; candidate `2392e72178aa249445a64bd629caac8219353499`; ten-operation asyncio smoke, bounded conversion, cancellation and close | +| M003 Python agent ergonomics and safety | capability | **active** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Typed, documented Python tool wrappers and representative working agent workflow | | M004 Python distribution and qualification | infrastructure | **blocked (hard: M003 closure; operational: publisher approval/platform qualification)** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Clean wheel/sdist installation and reproducible native consumer smoke on qualified targets | ## Cross-cutting design requirements @@ -67,6 +67,6 @@ Interfaces after M001 may inform parallel exploratory packaging, but the officia ## Verification and closure -Each milestone adds deterministic no-network fixtures and the `make check` root gate; package milestones additionally use Python pytest/type checks and clean installation. Track contract parity for all ten tools plus failure/warning/Mode-Off cases, not only `web_search` happy-path. Run `cargo package --list`/`cargo publish --dry-run --locked` for root after packaging changes. Every milestone creates `plans/closure/python-native-library/NNN-status.md` with source SHA, completed evidence matrix, tests and outcomes, open findings, compatibility/security evidence and final status, and updates this roadmap + registry in the same closure commit. M001 is closed by `plans/closure/python-native-library/001-status.md`; M002 is now dependency-ready. +Each milestone adds deterministic no-network fixtures and the `make check` root gate; package milestones additionally use Python pytest/type checks and clean installation. Track contract parity for all ten tools plus failure/warning/Mode-Off cases, not only `web_search` happy-path. Run `cargo package --list`/`cargo publish --dry-run --locked` for root after packaging changes. Every milestone creates `plans/closure/python-native-library/NNN-status.md` with source SHA, completed evidence matrix, tests and outcomes, open findings, compatibility/security evidence and final status, and updates this roadmap + registry in the same closure commit. M001 and M002 are closed by their corresponding closure records; M003 is active. Do not declare Python availability merely because a PyO3 extension compiled; user-visible capability requires a real Python consumer smoke. Do not publish wheels until exact-SHA qualification and separate publisher approval. Branch and PR handoff is acceptable; do not merge planning into unrelated repository-hardening or Mode-Off release work. From 4ada521e6e126f1db63a836f5687147e23bcf37f Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 01:24:38 +0000 Subject: [PATCH 05/13] feat: add typed Python agent API --- README.md | 4 + architecture/overview.md | 1 + architecture/python-library.md | 10 +- architecture/testing.md | 4 +- bindings/python/README.md | 38 +- bindings/python/examples/research_flow.py | 58 +++ bindings/python/pyproject.toml | 8 +- bindings/python/python/eggsearch/__init__.py | 137 ++++++- bindings/python/python/eggsearch/_native.pyi | 17 + bindings/python/python/eggsearch/types.py | 384 +++++++++++++++++++ bindings/python/tests/test_native.py | 103 ++++- docs/python-library.md | 104 +++++ docs/test-inventory.md | 3 +- skills/eggsearch-dev/SKILL.md | 1 + 14 files changed, 856 insertions(+), 16 deletions(-) create mode 100644 bindings/python/examples/research_flow.py create mode 100644 bindings/python/python/eggsearch/_native.pyi create mode 100644 bindings/python/python/eggsearch/types.py create mode 100644 docs/python-library.md diff --git a/README.md b/README.md index 568b7d92..b201ee05 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,10 @@ See [Safety](docs/safety.md) and [Threat model](docs/threat-model.md). [CodeGG harness integration](docs/codegg-integration.md) · [Test inventory](docs/test-inventory.md) +The in-process asyncio Python package is under `bindings/python` and is not +published yet. See the [Python library guide](docs/python-library.md) for +local build instructions and current support limits. + ## Build ```bash diff --git a/architecture/overview.md b/architecture/overview.md index 23a4eb57..c446d99c 100644 --- a/architecture/overview.md +++ b/architecture/overview.md @@ -82,6 +82,7 @@ fetch ↗ | HTML rendering | `src/fetch/render/` (8 files) | Structural rendering: blocks, text, markdown, code, CSV, notebooks | [fetch.md](fetch.md#6-render-subsystem-render-8-files) | | MCP server & tools | `src/mcp/` (7 modules + `tools/` with 10 tool modules plus `mod`/`common`/`canonical`/`tests`) | rmcp ServerHandler with 10 tools, stdio and loopback Streamable HTTP | [mcp.md](mcp.md) | | Native SDK facade | `src/sdk.rs` | Narrow direct Rust operation API delegating to the same ten MCP handlers | [python-library.md](python-library.md) | +| Python native package | `bindings/python/` | PyO3 asyncio client, named Python methods, and typed agent-facing JSON contracts | [python-library.md](python-library.md) | | CLI commands | `src/commands/` (binary-only, `mod` + 9 modules) | Subcommand wiring: doctor, search, fetch, providers, update, integrate, startup, restart, croncheck, mcp stdio/serve, browser-login/profiles | [commands.md](commands.md) | | Agent/IDE integrations | `src/integrations/` (10 files, 7 clients) | Client-specific render/apply adapters with atomic JSON edits and protocol verification | [integrations.md](integrations.md) | | Startup supervision | `src/startup.rs`, `packaging/systemd/`, `packaging/launchd/`, `packaging/windows/` | Canonical persistent runtime, manager detection/rendering, cron watchdog, identity-safe restart, and service state | [startup.md](startup.md) | diff --git a/architecture/python-library.md b/architecture/python-library.md index aa0abc1b..6479ee27 100644 --- a/architecture/python-library.md +++ b/architecture/python-library.md @@ -8,7 +8,7 @@ operations. Its ownership boundary is registered in Current handoff: M001's shared Rust facade and ten-operation parity are closed at `plans/closure/python-native-library/001-status.md`; M002's native asyncio bridge is closed at `plans/closure/python-native-library/002-status.md`; -M003's Python API, types, and semantic parity work is active. +M003's Python API, types, examples, and semantic parity work is active. ## Rust operation facade @@ -43,3 +43,11 @@ Milestone status and exact-candidate evidence live in extension alone is not evidence of a supported Python consumer. Wheel support is limited to targets with native install and runtime qualification, and publication requires separate authorization. + +The public Python `AsyncEggsearch` wrapper adds `async with`, `aclose()`, and +the ten named keyword methods over the generic native `execute` call. Request +and response `TypedDict` definitions live in `bindings/python/python/eggsearch/types.py`; +they describe common JSON fields while runtime dictionaries retain additive +keys. The `py.typed` marker and native extension stub make the package +discoverable to type checkers. `tool_names()` comes from the Rust SDK's +code-derived canonical inventory. diff --git a/architecture/testing.md b/architecture/testing.md index 1988fed6..563a5520 100644 --- a/architecture/testing.md +++ b/architecture/testing.md @@ -24,7 +24,7 @@ Per-suite counts live in `docs/test-inventory.md`; suite placement rules live in | `tests/mcp_http.rs` | Loopback Streamable HTTP lifecycle and transport hardening | | `packaging/test-install.sh`, `packaging/test-install.ps1` | Installer behavior (not `tests/`) | | `src/**/mod.rs` unit tests | Private-function coverage at the bottom of the source file | -| `bindings/python/tests/test_native.py` | PyO3 asyncio consumer behavior, bounded input conversion, cancellation and close lifecycle | +| `bindings/python/tests/test_native.py` | PyO3 asyncio consumer behavior, typed method delegation, bounded input conversion, cancellation and close lifecycle | --- @@ -74,7 +74,7 @@ Use behavioral suite names. Historical phase-suite names are retired; do not int - Provider failure modes go in `dispatch_fault_injection.rs`, not scattered across workflow suites. - Packaging behavior belongs under `packaging/test-install.sh` and `packaging/test-install.ps1`, never under `tests/`. - Multi-step regressions go in `corpus_runner.rs`; single-step edge cases stay in the owning behavioral suite. -- Python binding behavior belongs in `bindings/python/tests/`; run it after building the extension with the package's pinned maturin version. Keep its inventory in `docs/test-inventory.md`. +- Python binding behavior belongs in `bindings/python/tests/`; run it after building the extension with the package's pinned maturin version. Run the pinned Pyright dev extra on package code and examples. Keep its inventory in `docs/test-inventory.md`. --- diff --git a/bindings/python/README.md b/bindings/python/README.md index 133337ee..20ad7671 100644 --- a/bindings/python/README.md +++ b/bindings/python/README.md @@ -1,5 +1,35 @@ -# Eggsearch native Python binding +# Eggsearch native Python library -This is the isolated PyO3 extension package for the Eggsearch Python library. -It is built independently from the root binary package and is not published -by this project yet. +The native package exposes an asyncio client for Eggsearch's ten search, +fetch, repository, security, research, diagnostic, and evidence operations. +It calls the shared Rust SDK in-process and does not start the MCP server. + +This package is not published to PyPI. To build and install it locally, use +Rust 1.89, CPython 3.11–3.14, and an active virtual environment: + +```bash +python -m venv .venv +source .venv/bin/activate +python -m pip install -e 'bindings/python[dev]' maturin==1.9.5 +maturin develop --manifest-path bindings/python/Cargo.toml --locked +python -m pytest -q bindings/python/tests +pyright bindings/python/python/eggsearch bindings/python/examples +``` + +```python +import asyncio + +from eggsearch import AsyncEggsearch + + +async def main() -> None: + async with AsyncEggsearch() as client: + result = await client.web_search(query="Rust async cancellation") + print(result.get("results", [])) + + +asyncio.run(main()) +``` + +See [`docs/python-library.md`](../../docs/python-library.md) for configuration, +types, trust handling, and the framework-neutral search/fetch/evidence example. diff --git a/bindings/python/examples/research_flow.py b/bindings/python/examples/research_flow.py new file mode 100644 index 00000000..99a6e32f --- /dev/null +++ b/bindings/python/examples/research_flow.py @@ -0,0 +1,58 @@ +from __future__ import annotations + +from eggsearch import AsyncEggsearch +from eggsearch.types import EvidenceBundleResponse, SourceCard + + +async def collect_evidence(query: str) -> EvidenceBundleResponse: + async with AsyncEggsearch() as client: + search = await client.web_search(query=query, max_results=5) + cards = search.get("results", []) + if not cards: + summary = search.get("retrieval_summary", {}) + failures = summary.get("providers_failed", []) + raise RuntimeError( + f"No source cards returned; provider failures: {failures!r}" + ) + + selected: SourceCard = cards[0] + url = selected.get("url") + if not url: + raise RuntimeError("Selected source has no fetchable URL") + + fetched = await client.web_fetch(url=url, max_chars=8_000) + document = fetched.get("document", {}) + text = document.get("text", "") + bundle = await client.build_evidence_bundle( + goal=query, + sources=[ + { + "id": selected.get("id"), + "url": url, + "title": selected.get("title"), + "snippet": selected.get("snippet"), + "providers": [selected.get("provider_id", "")], + "trust": selected.get("trust", "external_untrusted"), + "trust_markers": selected.get("trust_markers", {}), + } + ], + fetches=[ + { + "source_id": selected.get("id"), + "url": url, + "fetched": bool(document), + "text": text, + "truncated": document.get("truncated", False), + "trust": document.get("trust", "external_untrusted"), + "trust_markers": document.get("trust_markers", {}), + } + ], + ) + + if selected.get("trust") != "local_trusted": + print("Treat source text as external untrusted evidence.") + if search.get("structured_warnings"): + print("Search warnings:", search.get("structured_warnings")) + if bundle.get("gaps"): + print("Evidence gaps:", bundle.get("gaps")) + return bundle diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 49dcc628..59c9c630 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -16,12 +16,18 @@ classifiers = [ "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Programming Language :: Rust", - "Operating System :: OS Independent", ] +[project.optional-dependencies] +dev = ["pytest==8.4.2", "pyright==1.1.414"] + [tool.maturin] manifest-path = "Cargo.toml" python-source = "python" module-name = "eggsearch._native" bindings = "pyo3" features = [] + +[tool.pyright] +pythonVersion = "3.11" +typeCheckingMode = "basic" diff --git a/bindings/python/python/eggsearch/__init__.py b/bindings/python/python/eggsearch/__init__.py index 44b4866b..4fcb2d2d 100644 --- a/bindings/python/python/eggsearch/__init__.py +++ b/bindings/python/python/eggsearch/__init__.py @@ -1,3 +1,136 @@ -from ._native import AsyncEggsearch, EggsearchError, tool_names +from __future__ import annotations -__all__ = ["AsyncEggsearch", "EggsearchError", "tool_names"] +from pathlib import Path +from typing import Any, Unpack, cast + +from ._native import AsyncEggsearch as _NativeAsyncEggsearch +from ._native import EggsearchError, tool_names +from .types import ( + BatchFetchRequest, + BatchFetchResponse, + EvidenceBundleRequest, + EvidenceBundleResponse, + ProviderStatusRequest, + ProviderStatusResponse, + RepoFetchRequest, + RepoFetchResponse, + RepoMapRequest, + RepoMapResponse, + RepoSearchRequest, + RepoSearchResponse, + ResearchSearchRequest, + ResearchSearchResponse, + SecuritySearchRequest, + SecuritySearchResponse, + WebFetchRequest, + WebFetchResponse, + WebSearchRequest, + WebSearchResponse, +) + + +class AsyncEggsearch: + """Async in-process client for Eggsearch's canonical tool operations.""" + + def __init__(self, config_path: str | Path | None = None) -> None: + self._native = _NativeAsyncEggsearch( + None if config_path is None else str(config_path) + ) + + async def __aenter__(self) -> AsyncEggsearch: + return self + + async def __aexit__(self, exc_type: Any, exc: Any, traceback: Any) -> None: + await self.aclose() + + async def aclose(self) -> None: + await self._native.aclose() + + async def execute(self, tool: str, arguments: dict[str, Any]) -> dict[str, Any]: + return await self._native.execute(tool, arguments) + + async def web_search( + self, **kwargs: Unpack[WebSearchRequest] + ) -> WebSearchResponse: + return cast( + WebSearchResponse, + await self.execute("web_search", cast(dict[str, Any], kwargs)), + ) + + async def web_fetch(self, **kwargs: Unpack[WebFetchRequest]) -> WebFetchResponse: + return cast( + WebFetchResponse, + await self.execute("web_fetch", cast(dict[str, Any], kwargs)), + ) + + async def batch_fetch( + self, **kwargs: Unpack[BatchFetchRequest] + ) -> BatchFetchResponse: + return cast( + BatchFetchResponse, + await self.execute("batch_fetch", cast(dict[str, Any], kwargs)), + ) + + async def provider_status( + self, **kwargs: Unpack[ProviderStatusRequest] + ) -> ProviderStatusResponse: + return cast( + ProviderStatusResponse, + await self.execute("provider_status", cast(dict[str, Any], kwargs)), + ) + + async def repo_search( + self, **kwargs: Unpack[RepoSearchRequest] + ) -> RepoSearchResponse: + return cast( + RepoSearchResponse, + await self.execute("repo_search", cast(dict[str, Any], kwargs)), + ) + + async def repo_fetch( + self, **kwargs: Unpack[RepoFetchRequest] + ) -> RepoFetchResponse: + return cast( + RepoFetchResponse, + await self.execute("repo_fetch", cast(dict[str, Any], kwargs)), + ) + + async def repo_map(self, **kwargs: Unpack[RepoMapRequest]) -> RepoMapResponse: + return cast( + RepoMapResponse, + await self.execute("repo_map", cast(dict[str, Any], kwargs)), + ) + + async def security_search( + self, **kwargs: Unpack[SecuritySearchRequest] + ) -> SecuritySearchResponse: + return cast( + SecuritySearchResponse, + await self.execute("security_search", cast(dict[str, Any], kwargs)), + ) + + async def research_search( + self, **kwargs: Unpack[ResearchSearchRequest] + ) -> ResearchSearchResponse: + return cast( + ResearchSearchResponse, + await self.execute("research_search", cast(dict[str, Any], kwargs)), + ) + + async def build_evidence_bundle( + self, **kwargs: Unpack[EvidenceBundleRequest] + ) -> EvidenceBundleResponse: + return cast( + EvidenceBundleResponse, + await self.execute( + "build_evidence_bundle", + cast(dict[str, Any], kwargs), + ), + ) + + +__all__ = [ + "AsyncEggsearch", + "EggsearchError", + "tool_names", +] diff --git a/bindings/python/python/eggsearch/_native.pyi b/bindings/python/python/eggsearch/_native.pyi new file mode 100644 index 00000000..a2092b62 --- /dev/null +++ b/bindings/python/python/eggsearch/_native.pyi @@ -0,0 +1,17 @@ +from typing import Any + + +class EggsearchError(Exception): + code: str + message: str + repair: Any | None + data: Any | None + + +class AsyncEggsearch: + def __init__(self, config_path: str | None = ...) -> None: ... + def execute(self, tool: str, arguments: dict[str, Any]) -> Any: ... + def aclose(self) -> Any: ... + + +def tool_names() -> list[str]: ... diff --git a/bindings/python/python/eggsearch/types.py b/bindings/python/python/eggsearch/types.py new file mode 100644 index 00000000..bdef1fb0 --- /dev/null +++ b/bindings/python/python/eggsearch/types.py @@ -0,0 +1,384 @@ +from __future__ import annotations + +from typing import Any, Literal, Required, TypedDict + + +JSONValue = str | int | float | bool | None | list["JSONValue"] | dict[str, "JSONValue"] +ResponseDetail = Literal["compact", "standard", "diagnostic"] +TrustLabel = Literal["external_untrusted", "local_trusted"] + + +class TrustMarkers(TypedDict, total=False): + stripped_control_chars: bool + framed: bool + injection_markers: list[str] + + +class AgentWarning(TypedDict, total=False): + code: str + message: str + provider_id: str + source_id: str + repair: dict[str, JSONValue] + + +class RepairHint(TypedDict, total=False): + code: str + message: str + arguments: dict[str, JSONValue] + + +class ProviderFailure(TypedDict, total=False): + provider_id: str + failure_class: str + message: str + retryable: bool + http_status: int + + +class SourceCard(TypedDict, total=False): + id: str + title: str + url: str + snippet: str + provider_id: str + score: float + rank: int + trust: TrustLabel + trust_markers: TrustMarkers + evidence_role: str + metadata: dict[str, JSONValue] + excerpts: list[dict[str, JSONValue]] + next_actions: list[dict[str, JSONValue]] + + +class RetrievalSummary(TypedDict, total=False): + status: str + providers_failed: list[ProviderFailure] + has_failures: bool + has_absences: bool + has_truncation: bool + attempts: list[dict[str, JSONValue]] + + +class FetchDocument(TypedDict, total=False): + title: str + text: str + content_type: str + truncated: bool + total_chars: int + trust: TrustLabel + trust_markers: TrustMarkers + + +class FetchResult(TypedDict, total=False): + fetch_id: str + source_id: str + url: str + fetched: bool + document: FetchDocument + error: dict[str, JSONValue] + + +class EvidenceBundle(TypedDict, total=False): + bundle_id: str + goal: str + sources: list[dict[str, JSONValue]] + fetches: list[dict[str, JSONValue]] + gaps: list[dict[str, JSONValue]] + warnings: list[AgentWarning] + trust: TrustLabel + + +class EvidenceSourceInput(TypedDict, total=False): + id: Any + url: Any + title: Any + snippet: Any + providers: Any + score: Any + trust: Any + trust_markers: Any + metadata: Any + quality: Any + + +class EvidenceFetchInput(TypedDict, total=False): + source_id: Any + url: Any + locator: Any + fetched: Any + content_type: Any + language: Any + selected_span: Any + code_span_id: Any + line_start: Any + line_end: Any + text: Any + truncated: Any + trust: Any + trust_markers: Any + warnings: Any + + +class WebSearchRequest(TypedDict, total=False): + query: Required[str] + max_results: int | None + providers: list[str] + safe_search: str | None + timeout_ms: int | None + intent: str | None + freshness: str | None + date_range: dict[str, str] | None + include_domains: list[str] + exclude_domains: list[str] + language: str | None + region: str | None + excerpt_count: int | None + response_detail: ResponseDetail | None + + +class WebFetchRequest(TypedDict, total=False): + url: Required[str] + max_chars: int | None + timeout_ms: int | None + extract_mode: str | None + include_links: bool | None + pdf: dict[str, JSONValue] | None + cache_policy: str | None + max_cache_age_seconds: int | None + focus: str | None + focus_max_chunks: int | None + focus_max_chars: int | None + render: str | None + browser_profile: str | None + response_detail: ResponseDetail | None + + +class BatchFetchRequest(TypedDict, total=False): + items: Required[list[dict[str, JSONValue]]] + max_items: int | None + max_chars_per_item: int | None + max_total_chars: int | None + timeout_ms: int | None + continue_on_error: bool | None + response_detail: ResponseDetail | None + + +class ProviderStatusRequest(TypedDict, total=False): + probe: bool + recipe_detail: Literal["none", "summary", "full"] | None + + +class RepoSearchRequest(TypedDict, total=False): + query: str + host: str | None + owner: str | None + repo: str | None + org: str | None + path: str | None + file: str | None + language: str | None + symbol: str | None + goal: str | None + sources: list[str] + include_docs: bool | None + include_registry: bool | None + include_issues: bool | None + include_releases: bool | None + include_examples: bool | None + include_pull_requests: bool | None + max_results: int | None + max_per_group: int | None + freshness: str | None + timeout_ms: int | None + providers: list[str] + profile: str | None + ecosystem: str | None + package: str | None + version: str | None + version_requirement: str | None + package_namespace: str | None + compare_version: str | None + include_security_context: bool | None + include_changelog: bool | None + include_migration_guides: bool | None + include_local: bool | None + mode: str | None + workflow: str | None + response_detail: ResponseDetail | None + + +class RepoFetchRequest(TypedDict, total=False): + owner: Required[str] + repo: Required[str] + path: Required[str] + host: str | None + ref_name: str | None + commit_sha: str | None + line_start: int | None + line_end: int | None + context_before: int | None + context_after: int | None + max_chars: int | None + timeout_ms: int | None + test_fetch_url: str | None + symbol: str | None + symbol_kind: str | None + match_text: str | None + expand_to_block: bool | None + max_block_lines: int | None + prefer_local: bool | None + response_detail: ResponseDetail | None + + +class RepoMapRequest(TypedDict, total=False): + owner: Required[str] + repo: Required[str] + host: str | None + ref_name: str | None + commit_sha: str | None + max_entries: int | None + max_depth: int | None + include_files: bool | None + include_directories: bool | None + include_ci: bool | None + include_security: bool | None + timeout_ms: int | None + providers: list[str] + response_detail: ResponseDetail | None + + +class SecuritySearchRequest(TypedDict, total=False): + query: str | None + ecosystem: str | None + package: str | None + version: str | None + cve_id: str | None + ghsa_id: str | None + osv_id: str | None + rustsec_id: str | None + severity_min: str | None + include_kev: bool | None + include_exploit_context: bool | None + include_defensive_guidance: bool | None + include_vendor_advisories: bool | None + include: list[str] + max_results: int | None + max_per_group: int | None + freshness: str | None + timeout_ms: int | None + providers: list[str] + assess_applicability: bool | None + dependency_files: list[str] + goal: str | None + workflow: str | None + response_detail: ResponseDetail | None + + +class ResearchSearchRequest(TypedDict, total=False): + query: Required[str] + research_domain: str | None + desired_source_types: list[str] + include_counterpoints: bool | None + include_primary_sources: bool | None + include_recent_discussion: bool | None + include_security_considerations: bool | None + include: list[str] + max_results: int | None + max_groups: int | None + max_per_group: int | None + freshness: str | None + timeout_ms: int | None + providers: list[str] + goal: str | None + workflow: str | None + depth: str | None + compare_targets: list[str] + constraints: list[str] + known_context: str | None + response_detail: ResponseDetail | None + + +class EvidenceBundleRequest(TypedDict, total=False): + goal: str | None + sources: list[EvidenceSourceInput] + fetches: list[EvidenceFetchInput] + include_unfetched_sources: bool | None + max_sources: int | None + max_fetched_items: int | None + max_total_chars: int | None + response_detail: ResponseDetail | None + + +class ToolResponse(TypedDict, total=False): + results: list[SourceCard] + sources: list[SourceCard] + fetches: list[FetchResult] + items: list[FetchResult] + document: FetchDocument + next_actions: list[dict[str, JSONValue]] + structured_warnings: list[AgentWarning] + providers_failed: list[ProviderFailure] + retrieval_summary: RetrievalSummary + trust: TrustLabel + trust_markers: TrustMarkers + workflow_coverage: dict[str, JSONValue] + conflict_metadata: list[dict[str, JSONValue]] + quality_metadata: dict[str, JSONValue] + errors: list[dict[str, JSONValue]] + warnings: list[AgentWarning] + bundle: EvidenceBundle + bundle_id: str + gaps: list[dict[str, JSONValue]] + + +WebSearchResponse = ToolResponse +WebFetchResponse = ToolResponse +BatchFetchResponse = ToolResponse +ProviderStatusResponse = ToolResponse +RepoSearchResponse = ToolResponse +RepoFetchResponse = ToolResponse +RepoMapResponse = ToolResponse +SecuritySearchResponse = ToolResponse +ResearchSearchResponse = ToolResponse +EvidenceBundleResponse = ToolResponse + + +__all__ = [ + "AgentWarning", + "BatchFetchRequest", + "BatchFetchResponse", + "EvidenceBundle", + "EvidenceFetchInput", + "EvidenceBundleRequest", + "EvidenceBundleResponse", + "EvidenceSourceInput", + "FetchDocument", + "FetchResult", + "JSONValue", + "ProviderFailure", + "ProviderStatusRequest", + "ProviderStatusResponse", + "RepairHint", + "RepoFetchRequest", + "RepoFetchResponse", + "RepoMapRequest", + "RepoMapResponse", + "RepoSearchRequest", + "RepoSearchResponse", + "ResearchSearchRequest", + "ResearchSearchResponse", + "RetrievalSummary", + "ResponseDetail", + "SecuritySearchRequest", + "SecuritySearchResponse", + "SourceCard", + "ToolResponse", + "TrustLabel", + "TrustMarkers", + "WebFetchRequest", + "WebFetchResponse", + "WebSearchRequest", + "WebSearchResponse", +] diff --git a/bindings/python/tests/test_native.py b/bindings/python/tests/test_native.py index eba8b466..82169de9 100644 --- a/bindings/python/tests/test_native.py +++ b/bindings/python/tests/test_native.py @@ -86,7 +86,7 @@ async def run(): await client.aclose() await client.aclose() with pytest.raises(EggsearchError) as closed: - client.execute("provider_status", {}) + await client.provider_status() assert closed.value.code == "client_closed" asyncio.run(run()) @@ -107,7 +107,7 @@ async def run(): def test_native_boundary_rejects_invalid_or_oversized_inputs(config_path, arguments): client = AsyncEggsearch(str(config_path)) with pytest.raises((TypeError, ValueError)): - client.execute("web_search", arguments) + client._native.execute("web_search", arguments) async def close(): await client.aclose() @@ -120,7 +120,7 @@ def test_native_boundary_rejects_cycles(config_path): value.append(value) client = AsyncEggsearch(str(config_path)) with pytest.raises(ValueError, match="cyclic"): - client.execute("web_search", {"value": value}) + client._native.execute("web_search", {"value": value}) async def close(): await client.aclose() @@ -131,13 +131,13 @@ async def close(): def test_native_futures_cancel_and_client_close_is_bounded(config_path): async def run(): client = AsyncEggsearch(str(config_path)) - pending = client.execute("provider_status", {}) + pending = client._native.execute("provider_status", {}) pending.cancel() with pytest.raises(asyncio.CancelledError): await pending await client.aclose() with pytest.raises(EggsearchError): - client.execute("provider_status", {}) + await client.provider_status() asyncio.run(run()) @@ -151,3 +151,96 @@ async def run_once(): asyncio.run(run_once()) asyncio.run(run_once()) + + +def test_named_methods_delegate_without_rewriting_arguments(): + methods = { + "web_search": { + "query": "parity", + "providers": [], + "max_results": 0, + "safe_search": None, + }, + "web_fetch": {"url": "https://example.invalid", "include_links": False}, + "batch_fetch": {"items": [], "continue_on_error": False}, + "provider_status": {"probe": False, "recipe_detail": "none"}, + "repo_search": {"query": "local", "include_local": True}, + "repo_fetch": {"owner": "acme", "repo": "widget", "path": "README.md"}, + "repo_map": {"owner": "acme", "repo": "widget", "include_files": False}, + "security_search": {"cve_id": "CVE-2024-1234", "providers": []}, + "research_search": {"query": "parity", "constraints": []}, + "build_evidence_bundle": {"sources": [], "fetches": []}, + } + + async def run(): + client = AsyncEggsearch() + calls = [] + + async def execute(tool, arguments): + calls.append((tool, arguments)) + return {"tool": tool, "arguments": arguments} + + client.execute = execute + for name, arguments in methods.items(): + assert await getattr(client, name)(**arguments) == { + "tool": name, + "arguments": arguments, + } + assert calls == list(methods.items()) + + asyncio.run(run()) + + +def test_async_context_manager_closes_native_client(config_path): + async def run(): + async with AsyncEggsearch(str(config_path)) as client: + assert isinstance(await client.provider_status(), dict) + with pytest.raises(EggsearchError) as closed: + await client.provider_status() + assert closed.value.code == "client_closed" + + asyncio.run(run()) + + +def test_public_error_exposes_structured_fields(config_path): + async def run(): + async with AsyncEggsearch(str(config_path)) as client: + with pytest.raises(EggsearchError) as failure: + await client.web_search(query="") + assert failure.value.code + assert failure.value.message + assert failure.value.repair is None or isinstance(failure.value.repair, dict) + assert failure.value.data is None or isinstance(failure.value.data, dict) + + asyncio.run(run()) + + +def test_mode_off_repo_search_returns_local_trusted_results(config_path, tmp_path): + workspace = tmp_path / "workspace" + workspace.mkdir() + (workspace / "README.md").write_text( + "Distinctive local retry-policy fixture for native Python search.", + encoding="utf-8", + ) + config = config_path.read_text(encoding="utf-8") + config = config.replace( + "enabled = false\nroots = []", + f'enabled = true\nroots = ["{workspace}"]', + ) + config_path.write_text(config, encoding="utf-8") + + async def run(): + async with AsyncEggsearch(str(config_path)) as client: + result = await client.repo_search( + query="retry", + include_local=True, + ) + cards = [ + card + for group in result.get("groups", []) + for card in group.get("results", []) + ] + assert cards + assert any(card.get("trust") == "local_trusted" for card in cards) + + asyncio.run(run()) diff --git a/docs/python-library.md b/docs/python-library.md new file mode 100644 index 00000000..3a5a0108 --- /dev/null +++ b/docs/python-library.md @@ -0,0 +1,104 @@ +# Native Python library + +The native Python package wraps the same Rust SDK operations used by Eggsearch's +MCP tools. It runs in-process and does not launch an Eggsearch executable, MCP +server, or listener. The package is an independent PyO3 extension under +`bindings/python`; it is not published to PyPI yet. + +## Build and use locally + +Use Rust 1.89, CPython 3.11–3.14, and a virtual environment. From the +repository root: + +```bash +python -m venv .venv +source .venv/bin/activate +python -m pip install -e 'bindings/python[dev]' maturin==1.9.5 +maturin develop --manifest-path bindings/python/Cargo.toml --locked +python -m pytest -q bindings/python/tests +pyright bindings/python/python/eggsearch bindings/python/examples +``` + +No Python runtime dependencies are required. The package uses `eggsearch` as +its import name; install from a locally built wheel or editable source build. +The distribution name is a temporary unpublished name pending M004's PyPI +name and release preflight. + +## Client API + +`AsyncEggsearch(config_path=None)` loads the standard Eggsearch config file +when a path is supplied, or uses `AppConfig` defaults. Context management calls +`aclose()` on exit. Closing is idempotent, cancels active operation futures, +waits for them to drop, and rejects later calls with `EggsearchError` whose +`code` is `client_closed`. + +The generic `execute(tool, arguments)` method and these named async methods use +the canonical tool names and pass accepted arguments to the Rust SDK: + +- `web_search`, `web_fetch`, and `batch_fetch` +- `provider_status` +- `repo_search`, `repo_fetch`, and `repo_map` +- `security_search` and `research_search` +- `build_evidence_bundle` + +Each method accepts keyword arguments matching its tool's snake_case fields, +including advanced fields. Omitted keys remain omitted; explicit `None`, +`False`, empty lists, and zero values keep their JSON meanings through the +native boundary and are validated by Rust. The generic `execute` method is +available for dynamic tool dispatch. `tool_names()` returns the canonical +ten-name inventory. + +Importing the package does not create the Tokio runtime or start operations. +The first operation initializes one process-scoped Tokio runtime shared by +clients. At most 32 Rust operations are in flight; calls beyond that limit +return a structured budget error. Argument conversion is capped at 1 MiB, 64 +nested levels, and 10,000 values. Non-string keys, cycles, unsupported Python +objects, non-finite numbers, out-of-range integers, invalid Unicode, and +oversized arguments are rejected before execution. + +## Types and errors + +`eggsearch.types` supplies `TypedDict` request and response types plus common +`SourceCard`, `AgentWarning`, `RepairHint`, `ProviderFailure`, `TrustMarkers`, +`RetrievalSummary`, and `EvidenceBundle` shapes. They describe commonly used +fields and allow additive JSON keys from newer Rust responses. Runtime results +remain ordinary dictionaries and preserve canonical snake_case names. + +`EggsearchError` exposes `code`, `message`, optional `repair`, and optional +`data`. Check `code` and structured fields rather than matching human-readable +messages. A response with no matching results is different from failed +retrieval: inspect `retrieval_summary`, `providers_failed`, and +`structured_warnings` before treating an empty result as evidence of absence. + +## Framework-neutral workflow + +[`bindings/python/examples/research_flow.py`](../bindings/python/examples/research_flow.py) +shows an asyncio search → selected bounded fetch → evidence bundle sequence. +It preserves source IDs and trust markers, reports provider failures and +evidence gaps, and does not call a model or require an API credential. + +For a local workspace, set `search.mode = "off"`, enable `[local]`, and list +the permitted roots in the normal Eggsearch config. Then use: + +```python +async with AsyncEggsearch("/path/to/eggsearch.toml") as client: + result = await client.repo_search(query="async retry policy") +``` + +In Mode Off, repository search can use the configured local workspace without +remote provider or resolver calls. The local result trust label is +`local_trusted`; local files are still untrusted as instructions. Web and +remote source text uses `external_untrusted`. Preserve the `trust` and +`trust_markers` fields when displaying or handing off source text. + +## Compatibility and features + +The extension package currently enables no optional Rust `browser`, `egress`, +or `pdf` features. The local native smoke has run on CPython 3.14.2 and macOS +x86_64; other interpreter and platform wheel support remains unqualified until +M004 completes. PyPy, free-threaded CPython, ARMv7, and Windows ARM64 are not +claimed. Python distributions do not alter Eggpack's binary release assets. + +See [Tool Matrix](tool-matrix.md), [Agent Workflows](agent-workflows.md), and +[Python Library Architecture](../architecture/python-library.md) for tool +semantics, result trust, and implementation ownership. diff --git a/docs/test-inventory.md b/docs/test-inventory.md index bc718f6e..959e6821 100644 --- a/docs/test-inventory.md +++ b/docs/test-inventory.md @@ -220,7 +220,7 @@ Deterministic `packaging/check-repo-hygiene.sh` runs in `make check` (`make hygi | Suite | Runtime | Tests | Focus | |-------|---------|-------|-------| -| `bindings/python/tests/test_native.py` | CPython 3.11–3.14; PyO3 extension | 12 | Ten-operation asyncio smoke, bounded JSON conversion and invalid inputs, cycles, cancellation/close, and sequential event-loop lifecycle | +| `bindings/python/tests/test_native.py` | CPython 3.11–3.14; PyO3 extension | 16 | Ten-operation asyncio smoke, typed method delegation and explicit null/false/empty preservation, async context manager, structured errors, Mode-Off local trust, bounded JSON conversion and invalid inputs, cycles, cancellation/close, and sequential event-loop lifecycle | Run from the repository root after installing the extension into an active virtual environment: @@ -229,4 +229,5 @@ virtual environment: maturin develop --manifest-path bindings/python/Cargo.toml --locked python -m pytest -q bindings/python/tests python -m compileall bindings/python/python/eggsearch +pyright bindings/python/python/eggsearch bindings/python/examples ``` diff --git a/skills/eggsearch-dev/SKILL.md b/skills/eggsearch-dev/SKILL.md index 9c649202..1807b5b5 100644 --- a/skills/eggsearch-dev/SKILL.md +++ b/skills/eggsearch-dev/SKILL.md @@ -97,6 +97,7 @@ its package-local tests: maturin develop --manifest-path bindings/python/Cargo.toml --locked python -m pytest -q bindings/python/tests python -m compileall bindings/python/python/eggsearch +pyright bindings/python/python/eggsearch bindings/python/examples ``` For startup supervision rendering and policy: From 3099c31b927bbd3902ef4000509d82d51f291029 Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 01:36:02 +0000 Subject: [PATCH 06/13] feat: expose canonical tool schemas to Python --- architecture/python-library.md | 5 +++- bindings/python/python/eggsearch/__init__.py | 5 ++++ bindings/python/python/eggsearch/_native.pyi | 1 + bindings/python/python/eggsearch/types.py | 13 +++++++++ bindings/python/src/lib.rs | 5 ++++ bindings/python/tests/test_native.py | 29 ++++++++++++++++++++ docs/python-library.md | 5 +++- docs/test-inventory.md | 2 +- src/sdk.rs | 19 +++++++++++++ 9 files changed, 81 insertions(+), 3 deletions(-) diff --git a/architecture/python-library.md b/architecture/python-library.md index 6479ee27..752c7132 100644 --- a/architecture/python-library.md +++ b/architecture/python-library.md @@ -50,4 +50,7 @@ and response `TypedDict` definitions live in `bindings/python/python/eggsearch/t they describe common JSON fields while runtime dictionaries retain additive keys. The `py.typed` marker and native extension stub make the package discoverable to type checkers. `tool_names()` comes from the Rust SDK's -code-derived canonical inventory. +code-derived canonical inventory. `tool_contracts()` returns input/output +schemas and the MCP contract fingerprint from the existing server definitions; +the Python test suite checks request type coverage against advertised schema +properties. diff --git a/bindings/python/python/eggsearch/__init__.py b/bindings/python/python/eggsearch/__init__.py index 4fcb2d2d..56f807c9 100644 --- a/bindings/python/python/eggsearch/__init__.py +++ b/bindings/python/python/eggsearch/__init__.py @@ -22,6 +22,7 @@ ResearchSearchResponse, SecuritySearchRequest, SecuritySearchResponse, + ToolContractSet, WebFetchRequest, WebFetchResponse, WebSearchRequest, @@ -49,6 +50,10 @@ async def aclose(self) -> None: async def execute(self, tool: str, arguments: dict[str, Any]) -> dict[str, Any]: return await self._native.execute(tool, arguments) + def tool_contracts(self) -> ToolContractSet: + """Return the fingerprint and canonical Rust input/output schemas.""" + return cast(ToolContractSet, self._native.tool_contracts()) + async def web_search( self, **kwargs: Unpack[WebSearchRequest] ) -> WebSearchResponse: diff --git a/bindings/python/python/eggsearch/_native.pyi b/bindings/python/python/eggsearch/_native.pyi index a2092b62..1bc8e892 100644 --- a/bindings/python/python/eggsearch/_native.pyi +++ b/bindings/python/python/eggsearch/_native.pyi @@ -12,6 +12,7 @@ class AsyncEggsearch: def __init__(self, config_path: str | None = ...) -> None: ... def execute(self, tool: str, arguments: dict[str, Any]) -> Any: ... def aclose(self) -> Any: ... + def tool_contracts(self) -> Any: ... def tool_names() -> list[str]: ... diff --git a/bindings/python/python/eggsearch/types.py b/bindings/python/python/eggsearch/types.py index bdef1fb0..b6e571d1 100644 --- a/bindings/python/python/eggsearch/types.py +++ b/bindings/python/python/eggsearch/types.py @@ -333,6 +333,17 @@ class ToolResponse(TypedDict, total=False): gaps: list[dict[str, JSONValue]] +class ToolContract(TypedDict): + name: str + input_schema: dict[str, JSONValue] + output_schema: dict[str, JSONValue] | None + + +class ToolContractSet(TypedDict): + fingerprint: str + tools: list[ToolContract] + + WebSearchResponse = ToolResponse WebFetchResponse = ToolResponse BatchFetchResponse = ToolResponse @@ -375,6 +386,8 @@ class ToolResponse(TypedDict, total=False): "SecuritySearchResponse", "SourceCard", "ToolResponse", + "ToolContract", + "ToolContractSet", "TrustLabel", "TrustMarkers", "WebFetchRequest", diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index 9025f4fc..40824fa1 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -209,6 +209,11 @@ impl PyAsyncEggsearch { Python::attach(|py| Ok(py.None())) }) } + + fn tool_contracts(&self, py: Python<'_>) -> PyResult> { + let contracts = self.state.client.tool_contracts(); + json_to_python(py, &contracts).map(Bound::unbind) + } } #[pyfunction] diff --git a/bindings/python/tests/test_native.py b/bindings/python/tests/test_native.py index 82169de9..99e03ff2 100644 --- a/bindings/python/tests/test_native.py +++ b/bindings/python/tests/test_native.py @@ -4,6 +4,7 @@ import pytest from eggsearch import AsyncEggsearch, EggsearchError, tool_names +from eggsearch import types as eggsearch_types EXPECTED_TOOLS = { @@ -19,6 +20,19 @@ "build_evidence_bundle", } +REQUEST_TYPES = { + "web_search": eggsearch_types.WebSearchRequest, + "web_fetch": eggsearch_types.WebFetchRequest, + "batch_fetch": eggsearch_types.BatchFetchRequest, + "provider_status": eggsearch_types.ProviderStatusRequest, + "repo_search": eggsearch_types.RepoSearchRequest, + "repo_fetch": eggsearch_types.RepoFetchRequest, + "repo_map": eggsearch_types.RepoMapRequest, + "security_search": eggsearch_types.SecuritySearchRequest, + "research_search": eggsearch_types.ResearchSearchRequest, + "build_evidence_bundle": eggsearch_types.EvidenceBundleRequest, +} + @pytest.fixture def config_path(tmp_path): @@ -56,6 +70,21 @@ def test_native_module_import_and_tool_inventory(): assert len(set(names)) == len(names) +def test_typed_requests_cover_canonical_rust_input_schemas(): + client = AsyncEggsearch() + contracts = client.tool_contracts() + schemas = { + contract["name"]: contract["input_schema"] + for contract in contracts["tools"] + } + + assert len(contracts["fingerprint"]) > 0 + assert set(schemas) == EXPECTED_TOOLS + for name, request_type in REQUEST_TYPES.items(): + properties = schemas[name].get("properties", {}) + assert set(properties).issubset(request_type.__annotations__) + + def test_native_client_executes_all_operations_without_an_mcp_process(config_path): arguments = { "web_search": {"query": "native parity"}, diff --git a/docs/python-library.md b/docs/python-library.md index 3a5a0108..0d5f1807 100644 --- a/docs/python-library.md +++ b/docs/python-library.md @@ -46,7 +46,10 @@ including advanced fields. Omitted keys remain omitted; explicit `None`, `False`, empty lists, and zero values keep their JSON meanings through the native boundary and are validated by Rust. The generic `execute` method is available for dynamic tool dispatch. `tool_names()` returns the canonical -ten-name inventory. +ten-name inventory. `client.tool_contracts()` returns the MCP input/output +schemas and their content fingerprint directly from Rust's server +definitions. The package tests check that each Python request `TypedDict` +covers every advertised input property. Importing the package does not create the Tokio runtime or start operations. The first operation initializes one process-scoped Tokio runtime shared by diff --git a/docs/test-inventory.md b/docs/test-inventory.md index 959e6821..b0c529ce 100644 --- a/docs/test-inventory.md +++ b/docs/test-inventory.md @@ -220,7 +220,7 @@ Deterministic `packaging/check-repo-hygiene.sh` runs in `make check` (`make hygi | Suite | Runtime | Tests | Focus | |-------|---------|-------|-------| -| `bindings/python/tests/test_native.py` | CPython 3.11–3.14; PyO3 extension | 16 | Ten-operation asyncio smoke, typed method delegation and explicit null/false/empty preservation, async context manager, structured errors, Mode-Off local trust, bounded JSON conversion and invalid inputs, cycles, cancellation/close, and sequential event-loop lifecycle | +| `bindings/python/tests/test_native.py` | CPython 3.11–3.14; PyO3 extension | 17 | Ten-operation asyncio smoke, canonical schema/type coverage, typed method delegation and explicit null/false/empty preservation, async context manager, structured errors, Mode-Off local trust, bounded JSON conversion and invalid inputs, cycles, cancellation/close, and sequential event-loop lifecycle | Run from the repository root after installing the extension into an active virtual environment: diff --git a/src/sdk.rs b/src/sdk.rs index b6f7de64..e18ebde3 100644 --- a/src/sdk.rs +++ b/src/sdk.rs @@ -145,6 +145,25 @@ impl EggsearchClient { .map(|contract| contract.name) } + pub fn tool_contracts(&self) -> serde_json::Value { + let server = crate::mcp::server::EggsearchServer::new(self.state.clone()); + let tools = server + .tool_definitions() + .into_iter() + .map(|tool| { + serde_json::json!({ + "name": tool.name.as_ref(), + "input_schema": tool.input_schema, + "output_schema": tool.output_schema, + }) + }) + .collect::>(); + serde_json::json!({ + "fingerprint": server.tool_fingerprint(), + "tools": tools, + }) + } + pub async fn execute( &self, tool: impl AsRef, From ca4d0d614f0b66f6f8ee73728d5c6f6b5100c816 Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 01:36:41 +0000 Subject: [PATCH 07/13] test: validate local Python evidence bundle --- bindings/python/tests/test_native.py | 33 ++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/bindings/python/tests/test_native.py b/bindings/python/tests/test_native.py index 99e03ff2..8aaf1918 100644 --- a/bindings/python/tests/test_native.py +++ b/bindings/python/tests/test_native.py @@ -264,12 +264,31 @@ async def run(): query="retry", include_local=True, ) - cards = [ - card - for group in result.get("groups", []) - for card in group.get("results", []) - ] - assert cards - assert any(card.get("trust") == "local_trusted" for card in cards) + cards = [ + card + for group in result.get("groups", []) + for card in group.get("results", []) + ] + assert cards + selected = next( + card for card in cards if card.get("trust") == "local_trusted" + ) + bundle = await client.build_evidence_bundle( + goal="Review local retry policy", + sources=[ + { + "id": selected.get("id"), + "url": selected.get("url"), + "title": selected.get("title"), + "snippet": selected.get("snippet"), + "providers": [selected.get("provider_id", "local_workspace")], + "trust": selected.get("trust"), + "trust_markers": selected.get("trust_markers", {}), + } + ], + ) + assert bundle.get("bundle_id") + assert bundle.get("sources") + assert bundle["sources"][0].get("trust") == "local_trusted" asyncio.run(run()) From 26ba2fee6389c0160a7ce75ec19f57b239cbed6f Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 01:42:59 +0000 Subject: [PATCH 08/13] plans: close Python native library M003 --- architecture/python-library.md | 4 +- .../python-native-library/003-status.md | 50 +++++++++++++++++++ .../003-agent-api-types-and-compatibility.md | 3 +- ...4-wheel-sdist-and-release-qualification.md | 4 +- plans/registry.md | 10 ++-- .../python-native-library-roadmap.md | 13 ++--- 6 files changed, 69 insertions(+), 15 deletions(-) create mode 100644 plans/closure/python-native-library/003-status.md diff --git a/architecture/python-library.md b/architecture/python-library.md index 752c7132..1968017d 100644 --- a/architecture/python-library.md +++ b/architecture/python-library.md @@ -8,7 +8,9 @@ operations. Its ownership boundary is registered in Current handoff: M001's shared Rust facade and ten-operation parity are closed at `plans/closure/python-native-library/001-status.md`; M002's native asyncio bridge is closed at `plans/closure/python-native-library/002-status.md`; -M003's Python API, types, examples, and semantic parity work is active. +M003's Python API, types, examples, and semantic parity work is closed at +`plans/closure/python-native-library/003-status.md`; M004 distribution +qualification is ready. ## Rust operation facade diff --git a/plans/closure/python-native-library/003-status.md b/plans/closure/python-native-library/003-status.md new file mode 100644 index 00000000..b01f72a2 --- /dev/null +++ b/plans/closure/python-native-library/003-status.md @@ -0,0 +1,50 @@ +# Python Native Library M003 — Agent API, Types and Semantic Compatibility Closure + +Status: closed +Candidate: `ca4d0d6` +Implementation plan: `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` +Predecessor: `plans/closure/python-native-library/002-status.md` + +## Delivered + +- Added async context management, `aclose()`, generic `execute()`, and all ten canonical named keyword methods to `AsyncEggsearch`. +- Added `TypedDict` request and response shapes, trust/warning/failure/evidence types, an extension `.pyi` stub, and the `py.typed` marker. Explicit `None`, false, empty-list, and zero values pass through unchanged; runtime dictionaries retain additive response keys. +- Added `tool_contracts()` to expose input/output schemas and the MCP contract fingerprint from the Rust server tool definitions. A Python contract test verifies that all ten method names match and each request type covers all advertised input properties. +- Added a framework-neutral search/fetch/evidence bundle example, package README instructions, and `docs/python-library.md` covering trust, partial failure, Mode Off, config, and feature limits. +- Added a no-network Python consumer journey that searches a configured local workspace in Mode Off, preserves `local_trusted` trust markers, and packages the selected source into an evidence bundle. +- Updated the root README, architecture index, test inventory, testing guide, contributor skill, and Python architecture handoff. + +## Compatibility and parity evidence + +| Capability | Evidence | +|---|---| +| Ten named operations | Python delegation test covers the exact ten canonical names; the Python smoke invokes all ten through the native SDK | +| Typed request parity | Python test reads the live Rust MCP input schemas and asserts every schema property is present on the corresponding request `TypedDict` | +| Semantic execution parity | M001's exact-candidate SDK tests compare all ten SDK results/errors against their existing handlers; M003 named methods only forward unchanged kwargs to generic `execute()` | +| Trust and local policy | No-network Mode-Off Python journey returns `local_trusted` workspace evidence and preserves that label in the evidence bundle; M001's counted Rust fixture proves zero remote dispatch | +| Structured failures | Public error test checks `EggsearchError.code`, `.message`, `.repair`, and `.data` | +| Response details and unknown keys | Generic JSON dictionaries are returned without projection or key filtering; named wrappers do not transform SDK results | + +## Verification on the exact candidate + +| Check | Result | +|---|---| +| Rust 1.89 locked binding check | Passed | +| CPython 3.14.2 macOS x86_64 maturin editable build | Passed | +| `python -m pytest -q bindings/python/tests` | 17 passed | +| `python -m compileall -q bindings/python/python/eggsearch bindings/python/examples` | Passed | +| Pyright 1.1.414 on package API and examples | 0 errors, 0 warnings | +| Root `make check` | Passed, including all-feature tests, static guards, hygiene, dependency policy, and packaging contract | + +## Compatibility limits and handoff + +The native wheel was exercised only on CPython 3.14.2, macOS x86_64, and Rust +1.89.0. CPython 3.11–3.13 and other targets remain unqualified. The package +still uses the unpublished temporary distribution name `eggsearch-native`; +M004 owns PyPI name preflight and source/wheel qualification. No package was +published. Optional `browser`, `egress`, and PDF features remain excluded. + +M003 is closed. M004 is ready to qualify local wheel and sdist builds, verify +clean extraction and native smoke, add the supported platform/interpreter CI +matrix, and document exact artifact provenance. Publication remains outside +this plan and requires separate authorization. diff --git a/plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md b/plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md index 548b30a0..716895bc 100644 --- a/plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md +++ b/plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md @@ -1,9 +1,10 @@ # M003 — Python Agent API, Types and Semantic Compatibility -Status: active +Status: closed Primary class: capability Source: `plans/subsystems/python-native-library-roadmap.md` M003 Planning baseline: M002 candidate `2392e72178aa249445a64bd629caac8219353499`; M002 closure evidence is `plans/closure/python-native-library/002-status.md`. +Closure: `plans/closure/python-native-library/003-status.md`; candidate `ca4d0d6`. ADRs `ADR-0001`, `ADR-0005`; relevant long-term sections 1-5, 7-9 of `plans/000-long-term-specification.md`. ## Objective and non-goals diff --git a/plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md b/plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md index a8c9ceb5..8855f50f 100644 --- a/plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md +++ b/plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md @@ -1,9 +1,9 @@ # M004 — Python Wheel, Sdist and Release Qualification -Status: blocked (hard dependency: M003 closed; operational: platform qualification and explicit publishing approval) +Status: ready Primary class: infrastructure Source: `plans/subsystems/python-native-library-roadmap.md` M004 -Planning baseline: `main` `f386b07d7adaa06bbb4a51a9d7e2eecf971c238b`; re-qualify actual candidate after M003. +Planning baseline: M003 candidate `ca4d0d6`; M003 closure evidence is `plans/closure/python-native-library/003-status.md`. ADRs: `ADR-0005`; long-term `plans/000-long-term-specification.md` sections 6, 7, 9. ## Objective, scope, gates diff --git a/plans/registry.md b/plans/registry.md index e7280199..778e0d74 100644 --- a/plans/registry.md +++ b/plans/registry.md @@ -42,7 +42,7 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | MCP tool-surface consolidation | closed | `plans/subsystems/tool-surface-consolidation-roadmap.md` | M001-M007 closed | M001-M007 closed. Current control points `plans/closure/mcp-tool-surface-consolidation/001-status.md` through `007-status.md`. | | Dependency evidence hardening | closed | `plans/subsystems/dependency-evidence-hardening-roadmap.md` | M010 corrective closed | M001-M010 closed. Current control point `plans/closure/dependency-evidence-hardening/010-status.md`; implementation `23676cc`, CI `36253474005`. | | Repository security, supply-chain, and maintenance hardening | active | `plans/subsystems/repository-hardening-roadmap.md` | M001/M002/M007/M008/M009/M010 closed; M006 blocked | Scheduled dependency-security run `38290328560` succeeded; M010 records M001/M007 closure. M002 closed by M009; M006 remains externally blocked on chromiumoxide. | -| Python native library for agents | active (M001-M002 closed; M003 active; M004 blocked) | `plans/subsystems/python-native-library-roadmap.md` | M002 closed at `plans/closure/python-native-library/002-status.md`; M003 Python API/types/parity in progress | ADR-0005 accepted; Python-only in-process SDK workstream. M004 is hard-gated by M003 and operational wheel qualification. | +| Python native library for agents | active (M001-M003 closed; M004 ready) | `plans/subsystems/python-native-library-roadmap.md` | M003 closed at `plans/closure/python-native-library/003-status.md`; M004 is dependency-ready | ADR-0005 accepted; Python-only in-process SDK workstream. Publication remains separately authorized. | ## Dependency-ready implementation plans @@ -86,8 +86,8 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | Repository hardening | M010 scheduled dependency-security evidence reconciliation | closed | `plans/closure/repository-hardening/010-status.md` | Closed at `31175e2`; first schedule-event run `38290328560` completed successfully on `90e996ef6c83c969e30c30a36bc9d968a85dc00f`. | | Python native library | M001 shared Rust SDK facade/parity | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; closure `plans/closure/python-native-library/001-status.md`. | | Python native library | M002 PyO3 asyncio binding/lifecycle | **closed** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | Candidate `2392e72`; closure `plans/closure/python-native-library/002-status.md`; bounded conversion, cancellation/close, and ten-operation consumer smoke. | -| Python native library | M003 Python agent API, types, parity | **active** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | M002 closed; add typed named methods and examples while preserving SDK semantics. | -| Python native library | M004 wheels, sdist and release qualification | **blocked** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Hard dependency: M003 closure; operational gate: target qualification and separate publish approval. | +| Python native library | M003 Python agent API, types, parity | **closed** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Candidate `ca4d0d6`; closure `plans/closure/python-native-library/003-status.md`; typed ten-method API, schema coverage, Mode-Off agent flow. | +| Python native library | M004 wheels, sdist and release qualification | **ready** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | M003 closed; qualify clean wheel/sdist installs and exact native artifacts. No publication. | Sequencing overview: `plans/implementation/mcp-tool-surface-consolidation/000-overview-and-sequencing.md`. Handoff checklist: `plans/implementation/mcp-tool-surface-consolidation/008-implementation-handoff-checklist.md`. @@ -100,7 +100,7 @@ Corrective closure sequence: `plans/implementation/dependency-evidence-hardening ## Current execution order and dependency gates -**Python native library gate:** ADR-0005 authorizes a narrow direct Rust SDK facade and Python PyO3 native package without broad Rust module stability. M001-M002 are closed with exact-candidate evidence; M003 is active and M004 remains gated by M003 and platform qualification. Python package publication is separately authorized and does not alter Eggpack binary assets. +**Python native library gate:** ADR-0005 authorizes a narrow direct Rust SDK facade and Python PyO3 native package without broad Rust module stability. M001-M003 are closed with exact-candidate evidence; M004 is ready for distribution qualification. Python package publication requires separate authorization and does not alter Eggpack binary assets. **Tool-surface gate:** M001-M007 closed. Do not run evaluation against pre-consolidation bytes and present it as consolidation @@ -172,7 +172,7 @@ release that makes HTTP discovery / reqwest optional without regressing | Repository hardening | active; M008 closed, M007 conditional, M002 conditional, M006 blocked | M008 closed at `44f38ab` (`008-status.md`); M007 remains conditional evidence control point. Historical closure records `001-status.md` through `008-status.md`. | | CodeGG legacy search parity | closed; M001 through M005 closed | `plans/closure/codegg-legacy-search-parity/005-status.md`; prior control points `plans/closure/codegg-legacy-search-parity/004-status.md` and `003-status.md`; implementations `e9103b4` (M001), `5233315` (M002), `8e5ec75` (M003), `81a2e49` (M004 release-prep), `32769d6` (M005 fix-prep); historical provider-parity closure retained, new Mode-Off locality issue separately registered | | Mode-Off local repository dispatch corrective | active; M001 closed; M002 and M003 blocked | M001 closure `plans/closure/mode-off-repository-locality-corrective/001-status.md` at `cc0c9c7`; M002 blocked pending M003 and immutable release evidence; M003 implementation `fcb1fb5`, blocked pending default-branch hosted qualification, closure `plans/closure/mode-off-repository-locality-corrective/003-status.md`. CodeGG paired requalification remains consumer-owned. | -| Python native library | active; M001-M002 closed, M003 active, M004 blocked | `plans/subsystems/python-native-library-roadmap.md`; M002 control point `plans/closure/python-native-library/002-status.md` | +| Python native library | active; M001-M003 closed, M004 ready | `plans/subsystems/python-native-library-roadmap.md`; M003 control point `plans/closure/python-native-library/003-status.md` | ## Closure rule diff --git a/plans/subsystems/python-native-library-roadmap.md b/plans/subsystems/python-native-library-roadmap.md index a409d9ba..06e61aff 100644 --- a/plans/subsystems/python-native-library-roadmap.md +++ b/plans/subsystems/python-native-library-roadmap.md @@ -1,6 +1,6 @@ # Python Native Library Roadmap -Status: active (M001-M002 closed; M003 active; M004 blocked by M003 and platform qualification) +Status: active (M001-M003 closed; M004 active for distribution qualification) Planning baseline: `eggstack/eggsearch` `main` at `f386b07d7adaa06bbb4a51a9d7e2eecf971c238b` (2026-10-13, Cargo package version 0.4.3) Primary outcome: in-process async Python library consumable by coding and research agents. @@ -37,17 +37,18 @@ At the planning baseline, `src/lib.rs` promised only MCP/CLI stability, `src/mcp `M002 (capability: native PyO3 asyncio execution and lifecycle)` -> closed at `plans/closure/python-native-library/002-status.md` `M003 (capability: ergonomic Python agent API, types, examples, semantic parity)` - -> active + -> closed at `plans/closure/python-native-library/003-status.md` `M004 (infrastructure + operational: wheel/sdist/release qualification)` + -> active -M002 is closed and M003 is active. M004 remains gated by M003 closure and platform qualification. No cross-repository or Mode-Off release blocker is waived: re-run the exact Mode-Off regressions, with separate operational gating for publication if existing immutable-release qualification remains blocked. +M001-M003 are closed and M004 is dependency-ready. Platform qualification remains required; no cross-repository or Mode-Off release blocker is waived. Re-run the exact Mode-Off regressions, with separate operational gating for publication if existing immutable-release qualification remains blocked. | Milestone | Class | Status | Plan | User-facing exit | |---|---|---|---|---| | M001 direct execution facade | infrastructure | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Closure `plans/closure/python-native-library/001-status.md`; candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; ten handler parity cases, Mode-Off zero-dispatch counter, and `make check` passed | | M002 native asyncio bridge | capability | **closed** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | Closure `plans/closure/python-native-library/002-status.md`; candidate `2392e72178aa249445a64bd629caac8219353499`; ten-operation asyncio smoke, bounded conversion, cancellation and close | -| M003 Python agent ergonomics and safety | capability | **active** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Typed, documented Python tool wrappers and representative working agent workflow | -| M004 Python distribution and qualification | infrastructure | **blocked (hard: M003 closure; operational: publisher approval/platform qualification)** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Clean wheel/sdist installation and reproducible native consumer smoke on qualified targets | +| M003 Python agent ergonomics and safety | capability | **closed** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Closure `plans/closure/python-native-library/003-status.md`; candidate `ca4d0d6`; typed methods, schema coverage, no-network Mode-Off agent flow | +| M004 Python distribution and qualification | infrastructure | **ready** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Clean wheel/sdist installation and reproducible native consumer smoke on qualified targets | ## Cross-cutting design requirements @@ -67,6 +68,6 @@ M002 is closed and M003 is active. M004 remains gated by M003 closure and platfo ## Verification and closure -Each milestone adds deterministic no-network fixtures and the `make check` root gate; package milestones additionally use Python pytest/type checks and clean installation. Track contract parity for all ten tools plus failure/warning/Mode-Off cases, not only `web_search` happy-path. Run `cargo package --list`/`cargo publish --dry-run --locked` for root after packaging changes. Every milestone creates `plans/closure/python-native-library/NNN-status.md` with source SHA, completed evidence matrix, tests and outcomes, open findings, compatibility/security evidence and final status, and updates this roadmap + registry in the same closure commit. M001 and M002 are closed by their corresponding closure records; M003 is active. +Each milestone adds deterministic no-network fixtures and the `make check` root gate; package milestones additionally use Python pytest/type checks and clean installation. Track contract parity for all ten tools plus failure/warning/Mode-Off cases, not only `web_search` happy-path. Run `cargo package --list`/`cargo publish --dry-run --locked` for root after packaging changes. Every milestone creates `plans/closure/python-native-library/NNN-status.md` with source SHA, completed evidence matrix, tests and outcomes, open findings, compatibility/security evidence and final status, and updates this roadmap + registry in the same closure commit. M001-M003 are closed by their corresponding closure records; M004 is dependency-ready. Do not declare Python availability merely because a PyO3 extension compiled; user-visible capability requires a real Python consumer smoke. Do not publish wheels until exact-SHA qualification and separate publisher approval. Branch and PR handoff is acceptable; do not merge planning into unrelated repository-hardening or Mode-Off release work. From fe0f444e35525a367581e23bb9eb3c9b1ad409de Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 01:43:25 +0000 Subject: [PATCH 09/13] plans: start Python native library M004 --- architecture/python-library.md | 2 +- .../004-wheel-sdist-and-release-qualification.md | 2 +- plans/registry.md | 8 ++++---- plans/subsystems/python-native-library-roadmap.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/architecture/python-library.md b/architecture/python-library.md index 1968017d..6b8fb8f6 100644 --- a/architecture/python-library.md +++ b/architecture/python-library.md @@ -10,7 +10,7 @@ closed at `plans/closure/python-native-library/001-status.md`; M002's native asyncio bridge is closed at `plans/closure/python-native-library/002-status.md`; M003's Python API, types, examples, and semantic parity work is closed at `plans/closure/python-native-library/003-status.md`; M004 distribution -qualification is ready. +qualification is active. ## Rust operation facade diff --git a/plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md b/plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md index 8855f50f..ff758c7c 100644 --- a/plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md +++ b/plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md @@ -1,6 +1,6 @@ # M004 — Python Wheel, Sdist and Release Qualification -Status: ready +Status: active Primary class: infrastructure Source: `plans/subsystems/python-native-library-roadmap.md` M004 Planning baseline: M003 candidate `ca4d0d6`; M003 closure evidence is `plans/closure/python-native-library/003-status.md`. diff --git a/plans/registry.md b/plans/registry.md index 778e0d74..f504db6b 100644 --- a/plans/registry.md +++ b/plans/registry.md @@ -42,7 +42,7 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | MCP tool-surface consolidation | closed | `plans/subsystems/tool-surface-consolidation-roadmap.md` | M001-M007 closed | M001-M007 closed. Current control points `plans/closure/mcp-tool-surface-consolidation/001-status.md` through `007-status.md`. | | Dependency evidence hardening | closed | `plans/subsystems/dependency-evidence-hardening-roadmap.md` | M010 corrective closed | M001-M010 closed. Current control point `plans/closure/dependency-evidence-hardening/010-status.md`; implementation `23676cc`, CI `36253474005`. | | Repository security, supply-chain, and maintenance hardening | active | `plans/subsystems/repository-hardening-roadmap.md` | M001/M002/M007/M008/M009/M010 closed; M006 blocked | Scheduled dependency-security run `38290328560` succeeded; M010 records M001/M007 closure. M002 closed by M009; M006 remains externally blocked on chromiumoxide. | -| Python native library for agents | active (M001-M003 closed; M004 ready) | `plans/subsystems/python-native-library-roadmap.md` | M003 closed at `plans/closure/python-native-library/003-status.md`; M004 is dependency-ready | ADR-0005 accepted; Python-only in-process SDK workstream. Publication remains separately authorized. | +| Python native library for agents | active (M001-M003 closed; M004 active) | `plans/subsystems/python-native-library-roadmap.md` | M003 closed at `plans/closure/python-native-library/003-status.md`; M004 qualification work is active | ADR-0005 accepted; Python-only in-process SDK workstream. Publication remains separately authorized. | ## Dependency-ready implementation plans @@ -87,7 +87,7 @@ Historical `phase-*.md` plans and pre-migration roadmaps are archived under | Python native library | M001 shared Rust SDK facade/parity | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; closure `plans/closure/python-native-library/001-status.md`. | | Python native library | M002 PyO3 asyncio binding/lifecycle | **closed** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | Candidate `2392e72`; closure `plans/closure/python-native-library/002-status.md`; bounded conversion, cancellation/close, and ten-operation consumer smoke. | | Python native library | M003 Python agent API, types, parity | **closed** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Candidate `ca4d0d6`; closure `plans/closure/python-native-library/003-status.md`; typed ten-method API, schema coverage, Mode-Off agent flow. | -| Python native library | M004 wheels, sdist and release qualification | **ready** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | M003 closed; qualify clean wheel/sdist installs and exact native artifacts. No publication. | +| Python native library | M004 wheels, sdist and release qualification | **active** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | M003 closed; qualify clean wheel/sdist installs and exact native artifacts. No publication. | Sequencing overview: `plans/implementation/mcp-tool-surface-consolidation/000-overview-and-sequencing.md`. Handoff checklist: `plans/implementation/mcp-tool-surface-consolidation/008-implementation-handoff-checklist.md`. @@ -100,7 +100,7 @@ Corrective closure sequence: `plans/implementation/dependency-evidence-hardening ## Current execution order and dependency gates -**Python native library gate:** ADR-0005 authorizes a narrow direct Rust SDK facade and Python PyO3 native package without broad Rust module stability. M001-M003 are closed with exact-candidate evidence; M004 is ready for distribution qualification. Python package publication requires separate authorization and does not alter Eggpack binary assets. +**Python native library gate:** ADR-0005 authorizes a narrow direct Rust SDK facade and Python PyO3 native package without broad Rust module stability. M001-M003 are closed with exact-candidate evidence; M004 distribution qualification is active. Python package publication requires separate authorization and does not alter Eggpack binary assets. **Tool-surface gate:** M001-M007 closed. Do not run evaluation against pre-consolidation bytes and present it as consolidation @@ -172,7 +172,7 @@ release that makes HTTP discovery / reqwest optional without regressing | Repository hardening | active; M008 closed, M007 conditional, M002 conditional, M006 blocked | M008 closed at `44f38ab` (`008-status.md`); M007 remains conditional evidence control point. Historical closure records `001-status.md` through `008-status.md`. | | CodeGG legacy search parity | closed; M001 through M005 closed | `plans/closure/codegg-legacy-search-parity/005-status.md`; prior control points `plans/closure/codegg-legacy-search-parity/004-status.md` and `003-status.md`; implementations `e9103b4` (M001), `5233315` (M002), `8e5ec75` (M003), `81a2e49` (M004 release-prep), `32769d6` (M005 fix-prep); historical provider-parity closure retained, new Mode-Off locality issue separately registered | | Mode-Off local repository dispatch corrective | active; M001 closed; M002 and M003 blocked | M001 closure `plans/closure/mode-off-repository-locality-corrective/001-status.md` at `cc0c9c7`; M002 blocked pending M003 and immutable release evidence; M003 implementation `fcb1fb5`, blocked pending default-branch hosted qualification, closure `plans/closure/mode-off-repository-locality-corrective/003-status.md`. CodeGG paired requalification remains consumer-owned. | -| Python native library | active; M001-M003 closed, M004 ready | `plans/subsystems/python-native-library-roadmap.md`; M003 control point `plans/closure/python-native-library/003-status.md` | +| Python native library | active; M001-M003 closed, M004 active | `plans/subsystems/python-native-library-roadmap.md`; M003 control point `plans/closure/python-native-library/003-status.md` | ## Closure rule diff --git a/plans/subsystems/python-native-library-roadmap.md b/plans/subsystems/python-native-library-roadmap.md index 06e61aff..46fd8bcd 100644 --- a/plans/subsystems/python-native-library-roadmap.md +++ b/plans/subsystems/python-native-library-roadmap.md @@ -48,7 +48,7 @@ M001-M003 are closed and M004 is dependency-ready. Platform qualification remain | M001 direct execution facade | infrastructure | **closed** | `plans/implementation/python-native-library/001-shared-sdk-facade-and-parity.md` | Closure `plans/closure/python-native-library/001-status.md`; candidate `5f686d02e15daa2c5db7ad6d889c06eaff3ceeee`; ten handler parity cases, Mode-Off zero-dispatch counter, and `make check` passed | | M002 native asyncio bridge | capability | **closed** | `plans/implementation/python-native-library/002-pyo3-async-execution-and-lifecycle.md` | Closure `plans/closure/python-native-library/002-status.md`; candidate `2392e72178aa249445a64bd629caac8219353499`; ten-operation asyncio smoke, bounded conversion, cancellation and close | | M003 Python agent ergonomics and safety | capability | **closed** | `plans/implementation/python-native-library/003-agent-api-types-and-compatibility.md` | Closure `plans/closure/python-native-library/003-status.md`; candidate `ca4d0d6`; typed methods, schema coverage, no-network Mode-Off agent flow | -| M004 Python distribution and qualification | infrastructure | **ready** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Clean wheel/sdist installation and reproducible native consumer smoke on qualified targets | +| M004 Python distribution and qualification | infrastructure | **active** | `plans/implementation/python-native-library/004-wheel-sdist-and-release-qualification.md` | Clean wheel/sdist installation and reproducible native consumer smoke on qualified targets | ## Cross-cutting design requirements @@ -68,6 +68,6 @@ M001-M003 are closed and M004 is dependency-ready. Platform qualification remain ## Verification and closure -Each milestone adds deterministic no-network fixtures and the `make check` root gate; package milestones additionally use Python pytest/type checks and clean installation. Track contract parity for all ten tools plus failure/warning/Mode-Off cases, not only `web_search` happy-path. Run `cargo package --list`/`cargo publish --dry-run --locked` for root after packaging changes. Every milestone creates `plans/closure/python-native-library/NNN-status.md` with source SHA, completed evidence matrix, tests and outcomes, open findings, compatibility/security evidence and final status, and updates this roadmap + registry in the same closure commit. M001-M003 are closed by their corresponding closure records; M004 is dependency-ready. +Each milestone adds deterministic no-network fixtures and the `make check` root gate; package milestones additionally use Python pytest/type checks and clean installation. Track contract parity for all ten tools plus failure/warning/Mode-Off cases, not only `web_search` happy-path. Run `cargo package --list`/`cargo publish --dry-run --locked` for root after packaging changes. Every milestone creates `plans/closure/python-native-library/NNN-status.md` with source SHA, completed evidence matrix, tests and outcomes, open findings, compatibility/security evidence and final status, and updates this roadmap + registry in the same closure commit. M001-M003 are closed by their corresponding closure records; M004 is active. Do not declare Python availability merely because a PyO3 extension compiled; user-visible capability requires a real Python consumer smoke. Do not publish wheels until exact-SHA qualification and separate publisher approval. Branch and PR handoff is acceptable; do not merge planning into unrelated repository-hardening or Mode-Off release work. From ebb617e2af413850ee09cefef737d5f826329371 Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 02:02:45 +0000 Subject: [PATCH 10/13] feat: qualify Python native distributions --- .../workflows/python-native-qualification.yml | 193 ++++++++++++++++++ architecture/python-library.md | 10 + architecture/testing.md | 1 + bindings/python/Cargo.toml | 5 +- .../python/{README.md => PYTHON_README.md} | 0 bindings/python/pyproject.toml | 10 +- deny.toml | 1 + docs/python-library.md | 37 +++- docs/test-inventory.md | 1 + 9 files changed, 246 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/python-native-qualification.yml rename bindings/python/{README.md => PYTHON_README.md} (100%) diff --git a/.github/workflows/python-native-qualification.yml b/.github/workflows/python-native-qualification.yml new file mode 100644 index 00000000..2e686c93 --- /dev/null +++ b/.github/workflows/python-native-qualification.yml @@ -0,0 +1,193 @@ +name: Python native qualification + +on: + workflow_dispatch: + pull_request: + paths: + - "bindings/python/**" + - "src/**" + - "Cargo.toml" + - "Cargo.lock" + - "deny.toml" + - ".github/workflows/python-native-qualification.yml" + push: + branches: + - main + - plan/python-native-library + paths: + - "bindings/python/**" + - "src/**" + - "Cargo.toml" + - "Cargo.lock" + - "deny.toml" + - ".github/workflows/python-native-qualification.yml" + +permissions: + contents: read + +jobs: + build-wheel: + name: Build ${{ matrix.target }} CPython ${{ matrix.python }} + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + - { id: linux-x86_64, runner: ubuntu-24.04, target: x86_64-unknown-linux-gnu, python: "3.11", linux: true } + - { id: linux-aarch64, runner: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu, python: "3.11", linux: true } + - { id: macos-x86_64, runner: macos-15-intel, target: x86_64-apple-darwin, python: "3.11", linux: false } + - { id: macos-arm64, runner: macos-15, target: aarch64-apple-darwin, python: "3.11", linux: false } + - { id: windows-x86_64, runner: windows-2022, target: x86_64-pc-windows-msvc, python: "3.11", linux: false } + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: ${{ matrix.python }} + - name: Check candidate package metadata + run: | + python -c "import tomllib; from pathlib import Path; project=tomllib.loads(Path('bindings/python/pyproject.toml').read_text())['project']; binding=tomllib.loads(Path('bindings/python/Cargo.toml').read_text())['package']; root=tomllib.loads(Path('Cargo.toml').read_text())['package']; assert project['name'] == 'eggsearch'; assert project['license'] == 'MIT'; assert project['version'] == binding['version'] == root['version']; print(project['name'], project['version'], project['license'])" + - if: matrix.linux + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b + with: + maturin-version: v1.9.5 + rust-toolchain: 1.89.0 + manylinux: "2014" + args: --manifest-path bindings/python/Cargo.toml --release --locked --out dist -i python${{ matrix.python }} + - if: ${{ !matrix.linux }} + uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 + with: + toolchain: 1.89.0 + targets: ${{ matrix.target }} + - if: ${{ !matrix.linux }} + run: python -m pip install maturin==1.9.5 + - if: ${{ !matrix.linux }} + run: maturin build --manifest-path bindings/python/Cargo.toml --release --locked --out dist --interpreter python + - name: Record wheel metadata and digest + shell: bash + run: | + python -m pip install --no-index --no-deps --only-binary=:all: dist/*.whl + python -c "from importlib.metadata import distribution; d=distribution('eggsearch'); print(d.metadata['Name'], d.version); print(*d.files, sep='\\n')" > dist/metadata.txt + sha256sum dist/*.whl | tee dist/SHA256SUMS + cat dist/SHA256SUMS >> "$GITHUB_STEP_SUMMARY" + - id: upload + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + with: + name: wheel-${{ matrix.id }} + path: dist/ + if-no-files-found: error + retention-days: 14 + - env: + ARTIFACT_DIGEST: ${{ steps.upload.outputs.artifact-digest }} + run: | + python -c "import os; open(os.environ['GITHUB_STEP_SUMMARY'], 'a').write('GitHub artifact digest: ' + os.environ['ARTIFACT_DIGEST'] + '\\n')" + + wheel-smoke: + name: Smoke ${{ matrix.target }} CPython ${{ matrix.python }} + needs: build-wheel + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + - { id: linux-x86_64, runner: ubuntu-24.04, target: x86_64-unknown-linux-gnu, python: "3.11" } + - { id: linux-x86_64, runner: ubuntu-24.04, target: x86_64-unknown-linux-gnu, python: "3.12" } + - { id: linux-x86_64, runner: ubuntu-24.04, target: x86_64-unknown-linux-gnu, python: "3.13" } + - { id: linux-x86_64, runner: ubuntu-24.04, target: x86_64-unknown-linux-gnu, python: "3.14" } + - { id: linux-aarch64, runner: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu, python: "3.11" } + - { id: linux-aarch64, runner: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu, python: "3.12" } + - { id: linux-aarch64, runner: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu, python: "3.13" } + - { id: linux-aarch64, runner: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu, python: "3.14" } + - { id: macos-x86_64, runner: macos-15-intel, target: x86_64-apple-darwin, python: "3.11" } + - { id: macos-x86_64, runner: macos-15-intel, target: x86_64-apple-darwin, python: "3.12" } + - { id: macos-x86_64, runner: macos-15-intel, target: x86_64-apple-darwin, python: "3.13" } + - { id: macos-x86_64, runner: macos-15-intel, target: x86_64-apple-darwin, python: "3.14" } + - { id: macos-arm64, runner: macos-15, target: aarch64-apple-darwin, python: "3.11" } + - { id: macos-arm64, runner: macos-15, target: aarch64-apple-darwin, python: "3.12" } + - { id: macos-arm64, runner: macos-15, target: aarch64-apple-darwin, python: "3.13" } + - { id: macos-arm64, runner: macos-15, target: aarch64-apple-darwin, python: "3.14" } + - { id: windows-x86_64, runner: windows-2022, target: x86_64-pc-windows-msvc, python: "3.11" } + - { id: windows-x86_64, runner: windows-2022, target: x86_64-pc-windows-msvc, python: "3.12" } + - { id: windows-x86_64, runner: windows-2022, target: x86_64-pc-windows-msvc, python: "3.13" } + - { id: windows-x86_64, runner: windows-2022, target: x86_64-pc-windows-msvc, python: "3.14" } + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: ${{ matrix.python }} + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 + with: + name: wheel-${{ matrix.id }} + path: ${{ runner.temp }}/wheelhouse + - name: Create a clean consumer environment + run: python -m venv .venv + shell: bash + - name: Test installed wheel outside checkout + run: | + if [ "$RUNNER_OS" = "Windows" ]; then + python_bin="./.venv/Scripts/python.exe" + else + python_bin="./.venv/bin/python" + fi + "$python_bin" -m pip install --no-index --no-deps --only-binary=:all: wheelhouse/*.whl + "$python_bin" -m pip install pytest==8.4.2 + "$python_bin" -m pytest -q "$GITHUB_WORKSPACE/bindings/python/tests" + shell: bash + working-directory: ${{ runner.temp }} + + source-distribution: + name: Rebuild and smoke extracted sdist + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 + with: + toolchain: 1.89.0 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: "3.14" + - run: python -m pip install maturin==1.9.5 + - name: Build sdist, prefetch locked crates, and rebuild offline + shell: bash + run: | + maturin build --manifest-path bindings/python/Cargo.toml --release --sdist --locked --out dist + cargo fetch --locked --manifest-path bindings/python/Cargo.toml + mkdir extracted + tar -xzf dist/*.tar.gz -C extracted + source_dir="$(find extracted -mindepth 1 -maxdepth 1 -type d)" + source_dir="$(cd "$source_dir" && pwd)" + (cd "$source_dir" && CARGO_NET_OFFLINE=true maturin build --release --locked --out "$GITHUB_WORKSPACE/extracted-wheel") + python -m venv "$RUNNER_TEMP/runtime-venv" + "$RUNNER_TEMP/runtime-venv/bin/python" -m pip install --no-index --no-deps extracted-wheel/*.whl + "$RUNNER_TEMP/runtime-venv/bin/python" -m pip install pytest==8.4.2 + cd "$RUNNER_TEMP" + "$RUNNER_TEMP/runtime-venv/bin/python" -m pytest -q "$source_dir/bindings/python/tests" + "$RUNNER_TEMP/runtime-venv/bin/python" -c "import eggsearch; from importlib.metadata import distribution; assert len(eggsearch.tool_names()) == 10; assert distribution('eggsearch').version == '0.4.3'" + sha256sum "$GITHUB_WORKSPACE"/dist/* "$GITHUB_WORKSPACE"/extracted-wheel/* | tee "$GITHUB_WORKSPACE/dist/SHA256SUMS" + cat "$GITHUB_WORKSPACE/dist/SHA256SUMS" >> "$GITHUB_STEP_SUMMARY" + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + with: + name: python-sdist-and-extracted-wheel + path: | + dist/*.tar.gz + dist/SHA256SUMS + extracted-wheel/*.whl + if-no-files-found: error + retention-days: 14 + + dependency-audit: + name: Audit binding dependency graph + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 + with: + toolchain: 1.89.0 + - run: cargo install cargo-deny --version 0.20.2 --locked + - run: cargo deny check + working-directory: bindings/python + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: "3.14" + - run: python -m pip install --upgrade pip==26.2.1 + - run: python -m pip install pip-audit==2.10.1 maturin==1.9.5 + - run: pip-audit --local --progress-spinner off diff --git a/architecture/python-library.md b/architecture/python-library.md index 6b8fb8f6..adef198e 100644 --- a/architecture/python-library.md +++ b/architecture/python-library.md @@ -46,6 +46,16 @@ extension alone is not evidence of a supported Python consumer. Wheel support is limited to targets with native install and runtime qualification, and publication requires separate authorization. +M004's candidate binding uses PyO3's `abi3-py311` stable ABI. Its release +matrix builds a manylinux2014 Linux x86_64/aarch64 wheel, macOS x86_64/arm64 +wheels, and a Windows x86_64 wheel, then installs each exact artifact on +CPython 3.11–3.14 in separate consumer jobs. These platform claims remain +conditional on the matching exact-candidate matrix jobs passing. An sdist +rebuild uses the binding and root Cargo manifests from clean extraction; it can +build offline with locked crates already cached, otherwise Cargo registry +access is required. PyPy, free-threaded CPython, ARMv7, and Windows ARM64 are +outside the support matrix. + The public Python `AsyncEggsearch` wrapper adds `async with`, `aclose()`, and the ten named keyword methods over the generic native `execute` call. Request and response `TypedDict` definitions live in `bindings/python/python/eggsearch/types.py`; diff --git a/architecture/testing.md b/architecture/testing.md index 563a5520..4e4a7b6c 100644 --- a/architecture/testing.md +++ b/architecture/testing.md @@ -75,6 +75,7 @@ Use behavioral suite names. Historical phase-suite names are retired; do not int - Packaging behavior belongs under `packaging/test-install.sh` and `packaging/test-install.ps1`, never under `tests/`. - Multi-step regressions go in `corpus_runner.rs`; single-step edge cases stay in the owning behavioral suite. - Python binding behavior belongs in `bindings/python/tests/`; run it after building the extension with the package's pinned maturin version. Run the pinned Pyright dev extra on package code and examples. Keep its inventory in `docs/test-inventory.md`. +- Native wheel and sdist release qualification lives in `.github/workflows/python-native-qualification.yml`; it builds native platform wheels, smokes each stable-ABI wheel on the supported CPython matrix, and rebuilds an extracted sdist with cached dependencies while Cargo networking is disabled. --- diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index 4e7a011e..f4dce7c2 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -4,6 +4,9 @@ version = "0.4.3" edition = "2021" rust-version = "1.89" publish = false +description = "Native asyncio bindings for the Eggsearch evidence engine" +license = "MIT" +repository = "https://github.com/eggstack/eggsearch" [lib] name = "_native" @@ -12,7 +15,7 @@ crate-type = ["cdylib"] [dependencies] eggsearch = { path = "../..", version = "=0.4.3" } futures = "0.3" -pyo3 = { version = "=0.29.3", features = ["extension-module", "macros"] } +pyo3 = { version = "=0.29.3", features = ["abi3-py311", "extension-module", "macros"] } pyo3-async-runtimes = { version = "=0.29.0", features = ["tokio-runtime"] } serde_json = "1" tokio = { version = "1", features = ["fs", "io-util", "macros", "net", "rt-multi-thread", "sync", "time"] } diff --git a/bindings/python/README.md b/bindings/python/PYTHON_README.md similarity index 100% rename from bindings/python/README.md rename to bindings/python/PYTHON_README.md diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 59c9c630..8f412716 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -3,12 +3,12 @@ requires = ["maturin==1.9.5"] build-backend = "maturin" [project] -name = "eggsearch-native" +name = "eggsearch" version = "0.4.3" description = "Native asyncio bindings for the Eggsearch evidence engine" requires-python = ">=3.11,<3.15" license = "MIT" -readme = "README.md" +readme = "PYTHON_README.md" classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.11", @@ -21,12 +21,18 @@ classifiers = [ [project.optional-dependencies] dev = ["pytest==8.4.2", "pyright==1.1.414"] +[project.urls] +Homepage = "https://github.com/eggstack/eggsearch" +Repository = "https://github.com/eggstack/eggsearch" +Documentation = "https://github.com/eggstack/eggsearch/blob/main/docs/python-library.md" + [tool.maturin] manifest-path = "Cargo.toml" python-source = "python" module-name = "eggsearch._native" bindings = "pyo3" features = [] +exclude = ["**/__pycache__/**", "**/*.pyc"] [tool.pyright] pythonVersion = "3.11" diff --git a/deny.toml b/deny.toml index 41f0f18a..bc6558e5 100644 --- a/deny.toml +++ b/deny.toml @@ -16,6 +16,7 @@ confidence-threshold = 0.8 allow = [ "0BSD", "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", "BSD-2-Clause", "BSD-3-Clause", "BSL-1.0", diff --git a/docs/python-library.md b/docs/python-library.md index 0d5f1807..4b94304a 100644 --- a/docs/python-library.md +++ b/docs/python-library.md @@ -19,10 +19,12 @@ python -m pytest -q bindings/python/tests pyright bindings/python/python/eggsearch bindings/python/examples ``` -No Python runtime dependencies are required. The package uses `eggsearch` as -its import name; install from a locally built wheel or editable source build. -The distribution name is a temporary unpublished name pending M004's PyPI -name and release preflight. +No Python runtime dependencies are required. The candidate distribution and +import name are both `eggsearch`, and the Python package version tracks the root +Eggsearch version as a starting point for synchronized candidate artifacts. +PyPI's project JSON endpoint returned 404 for `eggsearch` on 2026-10-14. The +package remains unpublished, and name availability must be rechecked +immediately before any separately authorized publication. ## Client API @@ -96,11 +98,28 @@ remote source text uses `external_untrusted`. Preserve the `trust` and ## Compatibility and features -The extension package currently enables no optional Rust `browser`, `egress`, -or `pdf` features. The local native smoke has run on CPython 3.14.2 and macOS -x86_64; other interpreter and platform wheel support remains unqualified until -M004 completes. PyPy, free-threaded CPython, ARMv7, and Windows ARM64 are not -claimed. Python distributions do not alter Eggpack's binary release assets. +The binding enables PyO3's `abi3-py311` stable ABI, targeting CPython 3.11 and +newer. M004 qualifies the same platform wheel on CPython 3.11, 3.12, 3.13, and +3.14. Linux wheels use the manylinux2014 baseline; native targets are Linux +x86_64 and aarch64, macOS x86_64 and arm64, and Windows x86_64. CI builds on +each target and installs each exact wheel on all four interpreters without +installing Rust in the consumer job. This support statement is conditional on +the corresponding M004 workflow jobs passing for the released candidate. + +PyPy, free-threaded CPython, ARMv7, and Windows ARM64 are not claimed. The +extension package enables no optional Rust `browser`, `egress`, or `pdf` +features. The native library uses the same Eggsearch configuration, provider +credential environment variables, bounded operations, sanitization, and trust +labels as the Rust engine. It does not probe credentials during import. +Python distributions do not alter Eggpack's binary release assets. + +An sdist build requires Rust 1.89, a C toolchain, and the Cargo dependencies in +`bindings/python/Cargo.lock`. It can build offline when those locked crate +sources are already in Cargo's local cache; a fresh build must be able to fetch +them from Cargo registries. Native wheels avoid those build requirements at +install and runtime. After a separately authorized publication, +upgrade with `python -m pip install --upgrade eggsearch` and remove with +`python -m pip uninstall eggsearch`. See [Tool Matrix](tool-matrix.md), [Agent Workflows](agent-workflows.md), and [Python Library Architecture](../architecture/python-library.md) for tool diff --git a/docs/test-inventory.md b/docs/test-inventory.md index b0c529ce..0dd015f5 100644 --- a/docs/test-inventory.md +++ b/docs/test-inventory.md @@ -215,6 +215,7 @@ Deterministic `packaging/check-repo-hygiene.sh` runs in `make check` (`make hygi |-----|----------|----------------| | `ci` | ~3min | fmt + clippy + no-default-features check + all-features tests + hygiene + packaging-check | | `windows-portability` | ~4min | `cargo check --locked --all-features --target x86_64-pc-windows-msvc` on `windows-latest` with pinned Rust 1.89; routine PR/main sentinel so Windows cfg breakage cannot hide behind Linux-green CI | +| `python-native-qualification` | varies | Native wheel builds for five targets; each exact abi3 wheel runs the 17-test suite on CPython 3.11–3.14; extracted sdist offline rebuild and smoke; Cargo and Python dependency audits | ## Python Native Binding From 7bfdd435243e5b6d676d5c2f882dcf34220cde12 Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 02:17:30 +0000 Subject: [PATCH 11/13] Fix Python wheel smoke environment path --- .github/workflows/python-native-qualification.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-native-qualification.yml b/.github/workflows/python-native-qualification.yml index 2e686c93..075838fa 100644 --- a/.github/workflows/python-native-qualification.yml +++ b/.github/workflows/python-native-qualification.yml @@ -119,14 +119,14 @@ jobs: name: wheel-${{ matrix.id }} path: ${{ runner.temp }}/wheelhouse - name: Create a clean consumer environment - run: python -m venv .venv + run: python -m venv "$RUNNER_TEMP/.venv" shell: bash - name: Test installed wheel outside checkout run: | if [ "$RUNNER_OS" = "Windows" ]; then - python_bin="./.venv/Scripts/python.exe" + python_bin="$RUNNER_TEMP/.venv/Scripts/python.exe" else - python_bin="./.venv/bin/python" + python_bin="$RUNNER_TEMP/.venv/bin/python" fi "$python_bin" -m pip install --no-index --no-deps --only-binary=:all: wheelhouse/*.whl "$python_bin" -m pip install pytest==8.4.2 From bf1ac2e9d905d4f5378ffab8dc4ca5c70acd37ce Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 02:33:15 +0000 Subject: [PATCH 12/13] Fix Windows Python smoke interpreter path --- .github/workflows/python-native-qualification.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-native-qualification.yml b/.github/workflows/python-native-qualification.yml index 075838fa..fd94a36e 100644 --- a/.github/workflows/python-native-qualification.yml +++ b/.github/workflows/python-native-qualification.yml @@ -124,7 +124,7 @@ jobs: - name: Test installed wheel outside checkout run: | if [ "$RUNNER_OS" = "Windows" ]; then - python_bin="$RUNNER_TEMP/.venv/Scripts/python.exe" + python_bin="$(cygpath -u "$RUNNER_TEMP")/.venv/Scripts/python.exe" else python_bin="$RUNNER_TEMP/.venv/bin/python" fi From cd7c75b5211dd6045a3527af6c83a5853e064cf4 Mon Sep 17 00:00:00 2001 From: eggsearch Date: Wed, 14 Oct 2026 02:33:49 +0000 Subject: [PATCH 13/13] Make Python native smoke config portable to Windows --- bindings/python/tests/test_native.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/tests/test_native.py b/bindings/python/tests/test_native.py index 8aaf1918..1006b291 100644 --- a/bindings/python/tests/test_native.py +++ b/bindings/python/tests/test_native.py @@ -254,7 +254,7 @@ def test_mode_off_repo_search_returns_local_trusted_results(config_path, tmp_pat config = config_path.read_text(encoding="utf-8") config = config.replace( "enabled = false\nroots = []", - f'enabled = true\nroots = ["{workspace}"]', + f'enabled = true\nroots = ["{workspace.as_posix()}"]', ) config_path.write_text(config, encoding="utf-8")