Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Single library + binary crate, not a workspace. Stable contract is MCP tools (10
From project root. CI pins Rust 1.89 (`rust-version` in `Cargo.toml`); edition 2021.

```bash
make check # canonical gate (= CI): fmt + clippy + no-default check + all-features tests + hygiene + dependency-policy + packaging-check
make check # canonical gate (= CI): fmt + clippy + no-default check + documents feature-off parity + all-features tests + hygiene + dependency-policy + packaging-check
make release-check # check + docs + release build + publish dry-run
make bench-check # compile-check the Criterion perf harness (characterization only, never a threshold); fuzz: make fuzz-smoke
```

Feature flags: `pdf` and `browser` are enabled by Cargo defaults; `mock` is the test-only engine harness (**required for integration/corpus tests**, and plain `cargo test` misses most of them); `egress` is opt-in and excluded from prebuilt/default binaries; `live-smoke` implies `mock`; `live-mcp-smoke` is the opt-in real MCP/network smoke that retains default `pdf`/`browser` and does not enable `mock`. Both live smoke targets are ignored by default. Tests must pass keyless: CI blanks all credential env vars, so missing credentials are provider-scoped skips, never global failures. Tests must not require network.
Feature flags: `pdf`, `browser`, and `documents` are enabled by Cargo defaults; `mock` is the test-only engine harness (**required for integration/corpus tests**, and plain `cargo test` misses most of them); `egress` is opt-in and excluded from prebuilt/default binaries; `live-smoke` implies `mock`; `live-mcp-smoke` is the opt-in real MCP/network smoke that retains default `pdf`/`browser`/`documents` and does not enable `mock`. Both live smoke targets are ignored by default. Tests must pass keyless: CI blanks all credential env vars, so missing credentials are provider-scoped skips, never global failures. Tests must not require network.

```bash
cargo test --locked --features mock --test web_search_integration # single suite
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Container-document extraction (DOCX, XLSX, PPTX, EPUB, CSV/TSV) is now part of the default feature set of every published binary and the Python wheel. `[fetch].documents_enabled` remains the operator switch; a CSV URL now returns a `document` object instead of the previous table preview.

- The advertised `tools/list` surface is re-pinned: full+full fingerprint `678e2a042ab5b39b` (33,983 bytes) becomes `d7968115e378f708` (34,226 bytes, +243), and the compact profile becomes `4922171e414dc480` (22,405 bytes). The growth is the three selector-honest descriptions that now state the accepted forms for `repo_search`, `repo_map`, and `security_search`, plus the corrected `provider_status` disclaimer; `fetch.items` gained a description too. A byte reduction was not achieved. Hosts cache by fingerprint plus server version, so refresh the cached surface.

- `repo_map` now publishes `next_actions` alongside `suggested_fetches`. Each entry is an executable `fetch` call carrying the repo item the suggestion already resolved, so a caller never reconstructs a locator, and `suggested_fetches` stays populated as a typed convenience.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ name = "eggsearch"
path = "src/main.rs"

[features]
default = ["pdf", "browser"]
default = ["pdf", "browser", "documents"]
mock = []
pdf = ["dep:lopdf", "dep:flate2"]
browser = ["dep:chromiumoxide"]
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: check ci fmt clippy feature-check test hygiene dependency-policy packaging-check producer-drift release-check release-candidate-check docs-check release-build publish-check bench-check fuzz-smoke live-smoke live-mcp-smoke live-release-smoke eval-tool-surface eval-retrieval-quality native-forge-smoke-github native-forge-smoke-gitlab native-forge-smoke-codeberg native-forge-smoke-gitea native-forge-smoke-all
.PHONY: check ci fmt clippy feature-check parity-check test hygiene dependency-policy packaging-check producer-drift release-check release-candidate-check docs-check release-build publish-check bench-check fuzz-smoke live-smoke live-mcp-smoke live-release-smoke eval-tool-surface eval-retrieval-quality native-forge-smoke-github native-forge-smoke-gitlab native-forge-smoke-codeberg native-forge-smoke-gitea native-forge-smoke-all

check: fmt clippy feature-check test hygiene dependency-policy packaging-check
check: fmt clippy feature-check parity-check test hygiene dependency-policy packaging-check

ci: check

Expand All @@ -13,6 +13,11 @@ clippy:
feature-check:
cargo check --locked --no-default-features

# The default feature set is what ships, so the feature-off half of
# tests/documents.rs would otherwise only ever run by hand.
parity-check:
cargo test --locked --no-default-features --test documents

test:
cargo test --locked --all-features

Expand Down
12 changes: 8 additions & 4 deletions architecture/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,19 @@ cargo run -- mcp stdio
cargo run -- mcp serve
```

Feature-scoped runs (default features already include `pdf` and `browser`, so the
flags below are only needed after `--no-default-features` or to be explicit):
Feature-scoped runs (Cargo defaults include `pdf`, `browser`, and `documents`, so a
narrower build starts from `--no-default-features`):

```bash
cargo run --features mock -- search "test query"
cargo run --features pdf -- fetch https://example.com/doc.pdf
cargo run --features browser -- fetch https://example.com
cargo run --no-default-features --features pdf -- fetch https://example.com/doc.pdf
cargo run --no-default-features --features browser -- fetch https://example.com
```

To reproduce the previous artifact posture without container-document
extraction, build with `--no-default-features --features pdf,browser`. This
retains PDF extraction and browser rendering but leaves `documents` out.

Diagnostics:

```bash
Expand Down
65 changes: 51 additions & 14 deletions architecture/fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,13 @@ per-tier byte budgets with exact accounting (drift self-heals in `stats()`).
- `DerivedCacheKey { scope, raw_content_hash, extraction_key }` where the hash
is `xxh3_64(body)` (`build_raw_response_hash`) and `ExtractionCacheKey`
covers `extract_mode`, exact `max_chars`, `include_links`, `pdf_pages`,
`pdf_ocr`, `include_media`, `renderer_version: 5`, and `sanitize_output`.
Version 5 isolates document-scoped extraction; version 4 isolates the
encrypted-PDF refusal behavior; version 3 isolates entries derived before
PDF page classification stopped depending on `include_media`; version 2
isolated entries written before representation negotiation existed.
`pdf_ocr`, `include_media`, `renderer_version: 6`, and `sanitize_output`.
Version 6 covers the extraction-fidelity and bound changes and invalidates
every derived-cache entry class, not only container-document entries. Version
5 isolated document-scoped extraction; version 4 isolates the encrypted-PDF
refusal behavior; version 3 isolates entries derived before PDF page
classification stopped depending on `include_media`; version 2 isolated
entries written before representation negotiation existed.
- `DerivedDocumentCacheEntry` stores the extracted title/description/text,
`raw_text`, links, truncation flags, the structured `FetchDocument` (blocks,
outline, chunks), trust markers, and transport tag.
Expand Down Expand Up @@ -377,23 +379,58 @@ matches every ZIP. ODF, legacy binary Office, and RTF resolve to
resolves to `document_encrypted`.

`FetchClient` mirrors its PDF early return with a document path: the pre-body
gate admits a supported format only when the feature is compiled in, the body is
read under a 16 MiB document cap, and the same extraction runs from a fresh
response and from raw-cache re-derivation. With the feature off, every path
behaves exactly as before.
gate admits a supported format only when the feature is compiled in. The
extractor input ceiling is 16 MiB (`MAX_INPUT_BYTES`), additionally clamped by
`[fetch].max_bytes` (2,000,000 bytes by default); extraction sees only the
admitted body. The same extraction runs from a fresh response and from
raw-cache re-derivation. With the feature off, every path behaves exactly as
before.

Bounds are enforced on real inflated bytes, not on central-directory sizes,
which the archive controls: 64 MiB decompressed, a 100:1 inflation ratio, 4,096
archive entries, 4,096 parts, 200,000 characters before the caller budget, and
XML depth 64. The archive is pre-scanned before `calamine` inflates it. Entries
are never extracted to disk, absolute and parent-traversal names are rejected,
and no DTD, external entity, `XInclude`, or external relationship is resolved.
which the archive controls: `MAX_DECOMPRESSED_BYTES` is 64 MiB, the inflation
ratio is 100:1, and the archive-entry and part bounds are 4,096 each.
`MAX_DOCUMENT_CHARS` caps extracted text at 200,000 characters per document.
The rendered per-part budget defaults to 12,000 characters
(`[fetch].max_chars_default`) and can be addressed up to `[fetch].max_chars_cap`
(50,000 by default); those budget defaults are not the hard extracted-text
ceiling. XML nesting depth is 64. `MAX_XML_TOKENS` is 262,144 for the
token-scanned DOCX body, PPTX slide documents, and EPUB spine documents.

Workbook extraction bounds 200,000 observed cells (`MAX_CELL_COUNT`) across
the workbook. Because the spreadsheet reader allocates a dense rectangle over
observed cells, the bounding rectangle spanned by those cells is bounded too.
The sheet-size scan streams sheet XML and counts observed `<c>` elements
instead of collecting a token vector; declared `<dimension>` and the
column-times-row product are not treated as content. Thus a sheet declaring
`A1:XFD1048576` but populating one cell extracts normally, while a genuinely
over-cap sheet is refused. CSV has the same 200,000-cell bound and enforces it
incrementally during the scan, refusing at the cap rather than after building
a row.

For XML text extraction, the five predefined XML entities (`&amp;`, `&lt;`,
`&gt;`, `&quot;`, `&apos;`) and decimal and hexadecimal character references
are decoded into the surrounding text run. An undeclared named reference such
as `&nbsp;` is preserved as its literal source text, neither dropped nor
expanded; there is deliberately no HTML entity table, so output never depends
on a table version. Adjacent character data, CDATA, and references merge into
one text run, so no separator is inserted inside a word.

A plain `<!DOCTYPE html>` with no internal subset and no `SYSTEM` or `PUBLIC`
identifier is accepted. A doctype body containing `[`, `SYSTEM`, or `PUBLIC`
(case-insensitive) is refused as `document_malformed`. No entity is ever
resolved from a doctype, and no external entity, `XInclude`, or external
relationship is resolved. Entries are never extracted to disk, and absolute
and parent-traversal names are rejected. A malformed container returns
`document_malformed`, never an empty success.

Ordering is fixed and independent of ZIP directory order: DOCX body order, PPTX
`presentation.xml` slide order, workbook sheet order, EPUB spine order, and
fixed 100-row CSV blocks. `FetchDocument` carries `format`, `parts`, and
`parts_total` additively; the response-level `text` remains the bounded
concatenation, so an agent that never reads `parts` still sees the document.
Each part carries its extractor truncation flag: the part that reaches its
character budget is flagged, later parts are not, and `document_truncated` is
true when any part was cut.
The document path is admitted before the ordinary HTML/text/PDF rejection, so a
container format is no longer refused as an unsupported content type when the
feature is compiled in; with the feature off, that rejection is unchanged.
Expand Down
9 changes: 5 additions & 4 deletions architecture/packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ Executable names are stable and carry no version; the tag `vX.Y.Z` is the
version namespace. Windows assets keep the `.exe` suffix, non-Windows assets
never do. Linux GNU builds use pinned Zig/cargo-zigbuild with a glibc 2.17
floor. Default features build every release asset, so each published binary
carries PDF extraction and browser rendering; `egress` stays a non-default
source-build feature and is never a binary product.
carries PDF extraction, browser rendering, and container-document extraction;
`egress` stays a non-default source-build feature and is never a binary product.

The Python wheel is a separate distribution, not a second binary SKU.
`bindings/python/Cargo.toml` builds the crate with
`default-features = false, features = ["pdf"]`, so the wheel carries PDF
extraction but not browser rendering, which still needs a system Chrome/Chromium.
`default-features = false, features = ["pdf", "browser", "documents"]`, so the wheel
carries PDF extraction, browser rendering, and container-document extraction.
Browser rendering still needs a system Chrome/Chromium executable.
Asset names, the seven targets, and the 19-name release inventory are unchanged.

`src/platform.rs` mirrors the same seven rows as `RELEASE_TARGETS` with
Expand Down
9 changes: 5 additions & 4 deletions architecture/python-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ 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`. The binding compiles
`pdf` and `browser` with default features disabled; this is the single feature
set used across Python wheel targets, and `egress` is not compiled. The browser
feature uses a system Chrome/Chromium executable at runtime and never bundles
one. Missing Chrome does not block installation, import, process startup,
`pdf`, `browser`, and `documents` with default features disabled; this is the
single feature set used across Python wheel targets, and `egress` is not compiled.
The wheel includes PDF extraction, browser rendering, and container-document
extraction. The browser feature uses a system Chrome/Chromium executable at
runtime and never bundles one. Missing Chrome does not block installation, import, process startup,
search, or HTTP fetch. For a missing executable, explicit browser requests
raise `EggsearchError` with `code == "browser_unavailable"` and the cause in
`message`; `auto` retains the HTTP outcome and adds a structured
Expand Down
Loading
Loading