docpull 6.9.0__tar.gz → 6.10.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {docpull-6.9.0/src/docpull.egg-info → docpull-6.10.0}/PKG-INFO +1 -1
- {docpull-6.9.0 → docpull-6.10.0}/pyproject.toml +1 -1
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/__init__.py +1 -1
- docpull-6.10.0/src/docpull/_fileutil.py +89 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/basis.py +8 -1
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/cache/manager.py +92 -23
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/change_events.py +47 -16
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/cli.py +5 -2
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/compat_jobs.py +71 -13
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_ci.py +19 -10
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/cli.py +4 -1
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_query.py +44 -22
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/core/fetcher.py +17 -1
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/document_parse.py +7 -2
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/frozen.py +9 -1
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/mcp/server.py +1 -1
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/mcp/tools.py +179 -98
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/models/config.py +8 -1
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/monitor.py +58 -4
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/output_contract.py +26 -12
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pack_reader.py +22 -15
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/save_json.py +12 -4
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/project.py +182 -24
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/redaction.py +28 -18
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/rendering.py +98 -3
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/server.py +9 -1
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/skill_export.py +11 -1
- docpull-6.10.0/src/docpull/state_paths.py +51 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/surface.py +1 -1
- {docpull-6.9.0 → docpull-6.10.0/src/docpull.egg-info}/PKG-INFO +1 -1
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull.egg-info/SOURCES.txt +5 -2
- docpull-6.10.0/tests/test_audit_cache_mcp.py +338 -0
- docpull-6.10.0/tests/test_audit_project.py +202 -0
- docpull-6.10.0/tests/test_audit_runtime.py +309 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_compat_jobs.py +1 -1
- docpull-6.9.0/tests/test_claim_audit_script.py +0 -52
- docpull-6.9.0/tests/test_release_a_plus_check_script.py +0 -149
- {docpull-6.9.0 → docpull-6.10.0}/LICENSE +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/README.md +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/setup.cfg +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/__main__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/_jsonutil.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/accounting.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/acquisition_workflows.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/agent_publish.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/auth_cli.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/cache/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/cache/frontier.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/cache/streaming_dedup.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/compat_api.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_aliases.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/_legacy_cli.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/brand.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/common.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/dataset.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/feed.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/openapi.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/package.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/paper.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/policy_pack.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/product.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/relationship.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/repo.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/standards.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/styleguide.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/transcript.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/typed.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/typed_models.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/visuals.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/website.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/wiki.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/context_packs/workflow_cli.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/contracts.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/contracts_cli.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/article_cleanup.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/chunking.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/ensemble.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/extractor.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/filings.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/markdown.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/protocols.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/special_cases.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/conversion/trafilatura_extractor.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/core/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/_fetch.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/composite.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/crawler.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/filters.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/link_extractors/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/link_extractors/enhanced.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/link_extractors/protocols.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/link_extractors/static.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/protocols.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery/sitemap.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/discovery_index.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/doctor.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/document_worker.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/eval_grade.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/evidence.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/export_formats.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/exports.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/fixtures/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/graph.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/http/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/http/client.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/http/protocols.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/http/rate_limiter.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/integrations/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/integrations/_records.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/integrations/langchain.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/integrations/llamaindex.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/judge.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/local_workflows.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/mcp/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/mcp/sources.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/metadata_extractor.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/models/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/models/document.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/models/events.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/models/profiles.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/models/run.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/models/schema.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pack_tools.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/base.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/manifest.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/chunk.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/convert.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/dedup.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/fetch.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/metadata.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/render.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/save.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/save_ndjson.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/save_okf.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/save_sqlite.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/screen.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/pipeline/steps/validate.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/policy.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/policy_cli.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/provenance.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/py.typed +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/registry.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/research.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/artifact-manifest.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/basis.v2.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/change-event.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/citation-map.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/document.v3.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/intelligence-bundle.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/pack.v3.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/provenance.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/relationship-pack.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/rights.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/run-identity.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/website-snapshot.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/workflow-request.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/schemas/workflow-result.v1.schema.json +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/security/__init__.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/security/download_policy.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/security/injection.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/security/optout.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/security/robots.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/security/url_validator.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/share.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/source_scoring.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/time_utils.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/warc.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/web_search.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull/workflows.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull.egg-info/dependency_links.txt +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull.egg-info/entry_points.txt +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull.egg-info/requires.txt +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/src/docpull.egg-info/top_level.txt +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_accounting.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_acquisition_workflows.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_auth_cli.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_basis.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_cache_conditional_get.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_cache_lock_regressions.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_chunking.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_cli.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_compat_api.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_context_ci.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_context_packs.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_context_query.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_conversion.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_convert_step_new.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_crawl_regressions.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_discovery.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_discovery_index.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_doctor.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_document_parse.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_document_record.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_exports.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_extractor_ensemble.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_feed_pack.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_fetch_lifecycle.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_frontier_resume.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_frozen.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_graph.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_http_efficiency.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_import_efficiency.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_injection_screen.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_integration.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_integrations.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_jsonutil.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_judge.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_link_extractors.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_live_web_smoke.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_local_pack_workflows.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_local_workflows.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_mcp_server.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_mcp_tools.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_metadata_extractor.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_model_cache_lock.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_model_crawl_politeness.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_model_fetch_pipeline.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_model_jobs_monitor.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_monitor.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_monitor_fetch_failures.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_naming.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_openapi_pack.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_optional_extras_installed.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_optout.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_output_contract.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_outputs_e2e.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_pack_server.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_pack_tools.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_parser_dependency_support.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_pipeline.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_policy.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_policy_cli.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_project.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_provenance.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_public_feature_smoke.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_qa_judge.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_rate_limiter.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_real_feature_smoke_script.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_real_site_regressions.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_registry.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_relationship_workflow.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_release_registry_workflows.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_rendering.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_reproducible_release_build.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_research.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_save_ndjson.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_save_sqlite.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_security_hardening.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_share.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_sitemap_lastmod_skip.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_source_scoring.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_special_cases.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_surface_contract.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_time_utils.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_token_metrics.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_trafilatura_extractor.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_typed_knowledge_packs.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_warc.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_web_search.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_website_snapshot.py +0 -0
- {docpull-6.9.0 → docpull-6.10.0}/tests/test_workflow_contracts.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docpull
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.10.0
|
|
4
4
|
Summary: Declare, sync, diff, and lock context dependencies for AI agents
|
|
5
5
|
Author-email: Zachary Roth <support@raintree.technology>
|
|
6
6
|
Maintainer-email: Raintree Technology <support@raintree.technology>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "docpull"
|
|
7
|
-
version = "6.
|
|
7
|
+
version = "6.10.0"
|
|
8
8
|
dynamic = []
|
|
9
9
|
description = "Declare, sync, diff, and lock context dependencies for AI agents"
|
|
10
10
|
readme = {file = "README.md", content-type = "text/markdown"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""Small filesystem helpers: atomic text writes and advisory file locks."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import contextlib
|
|
6
|
+
import os
|
|
7
|
+
import tempfile
|
|
8
|
+
from collections.abc import Iterator
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import IO, Any
|
|
11
|
+
|
|
12
|
+
try: # POSIX
|
|
13
|
+
import fcntl as _fcntl
|
|
14
|
+
except ImportError: # pragma: no cover - Windows
|
|
15
|
+
_fcntl = None # type: ignore[assignment]
|
|
16
|
+
|
|
17
|
+
try: # Windows
|
|
18
|
+
import msvcrt as _msvcrt
|
|
19
|
+
except ImportError:
|
|
20
|
+
_msvcrt = None # type: ignore[assignment]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def atomic_write_text(path: Path | str, text: str, *, encoding: str = "utf-8") -> None:
|
|
24
|
+
"""Write ``text`` to ``path`` via a unique temp file in the same dir + ``os.replace``.
|
|
25
|
+
|
|
26
|
+
Each writer gets its own temp file, so concurrent writers never clobber
|
|
27
|
+
each other's half-written temp; the last ``os.replace`` wins atomically.
|
|
28
|
+
"""
|
|
29
|
+
target = Path(path)
|
|
30
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
31
|
+
tmp_name: str | None = None
|
|
32
|
+
try:
|
|
33
|
+
with tempfile.NamedTemporaryFile(
|
|
34
|
+
"w",
|
|
35
|
+
encoding=encoding,
|
|
36
|
+
dir=target.parent,
|
|
37
|
+
prefix=f".{target.name}.",
|
|
38
|
+
suffix=".tmp",
|
|
39
|
+
delete=False,
|
|
40
|
+
) as handle:
|
|
41
|
+
tmp_name = handle.name
|
|
42
|
+
handle.write(text)
|
|
43
|
+
handle.flush()
|
|
44
|
+
os.fsync(handle.fileno())
|
|
45
|
+
os.replace(tmp_name, target)
|
|
46
|
+
except BaseException:
|
|
47
|
+
if tmp_name is not None:
|
|
48
|
+
with contextlib.suppress(OSError):
|
|
49
|
+
os.unlink(tmp_name)
|
|
50
|
+
raise
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _lock(handle: IO[Any]) -> None:
|
|
54
|
+
if _fcntl is not None:
|
|
55
|
+
_fcntl.flock(handle.fileno(), _fcntl.LOCK_EX)
|
|
56
|
+
elif _msvcrt is not None: # pragma: no cover - Windows
|
|
57
|
+
handle.seek(0)
|
|
58
|
+
while True:
|
|
59
|
+
try:
|
|
60
|
+
_msvcrt.locking(handle.fileno(), _msvcrt.LK_LOCK, 1)
|
|
61
|
+
return
|
|
62
|
+
except OSError:
|
|
63
|
+
continue
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _unlock(handle: IO[Any]) -> None:
|
|
67
|
+
if _fcntl is not None:
|
|
68
|
+
_fcntl.flock(handle.fileno(), _fcntl.LOCK_UN)
|
|
69
|
+
elif _msvcrt is not None: # pragma: no cover - Windows
|
|
70
|
+
handle.seek(0)
|
|
71
|
+
with contextlib.suppress(OSError):
|
|
72
|
+
_msvcrt.locking(handle.fileno(), _msvcrt.LK_UNLCK, 1)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@contextlib.contextmanager
|
|
76
|
+
def file_lock(path: Path | str) -> Iterator[None]:
|
|
77
|
+
"""Exclusive advisory lock on ``path`` (created if missing), blocking.
|
|
78
|
+
|
|
79
|
+
Uses ``fcntl.flock`` on POSIX and ``msvcrt.locking`` on Windows; a no-op
|
|
80
|
+
where neither exists. Advisory only: cooperating writers must all use it.
|
|
81
|
+
"""
|
|
82
|
+
lock_path = Path(path)
|
|
83
|
+
lock_path.parent.mkdir(parents=True, exist_ok=True)
|
|
84
|
+
with open(lock_path, "a+b") as handle:
|
|
85
|
+
_lock(handle)
|
|
86
|
+
try:
|
|
87
|
+
yield
|
|
88
|
+
finally:
|
|
89
|
+
_unlock(handle)
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Evidence basis records: which cited sources support each claim in a pack.
|
|
2
|
+
|
|
3
|
+
A basis record ties one claim path to citation IDs, source URLs, and excerpts,
|
|
4
|
+
with a confidence and an evidence state (supported, partial, insufficient). This
|
|
5
|
+
module builds and normalizes those records, writes and reads ``basis.ndjson``,
|
|
6
|
+
and summarizes them into ``basis.report.json`` and Markdown for eval-grade packs
|
|
7
|
+
and context CI. It is local and offline; "basis" means evidentiary basis.
|
|
8
|
+
"""
|
|
2
9
|
|
|
3
10
|
from __future__ import annotations
|
|
4
11
|
|
|
@@ -5,11 +5,14 @@ from __future__ import annotations
|
|
|
5
5
|
import hashlib
|
|
6
6
|
import json
|
|
7
7
|
import logging
|
|
8
|
+
import os
|
|
8
9
|
import tempfile
|
|
10
|
+
import time
|
|
9
11
|
from datetime import timedelta
|
|
10
12
|
from pathlib import Path
|
|
11
13
|
from typing import Any, TypedDict
|
|
12
14
|
|
|
15
|
+
from .._fileutil import file_lock
|
|
13
16
|
from ..time_utils import parse_persisted_datetime, utc_now, utc_now_iso
|
|
14
17
|
from .frontier import FrontierStore
|
|
15
18
|
|
|
@@ -112,12 +115,31 @@ class CacheManager:
|
|
|
112
115
|
self.frontier_file = self.cache_dir / "frontier.json"
|
|
113
116
|
self.frontier = FrontierStore(self.frontier_file)
|
|
114
117
|
|
|
118
|
+
self.lock_file = self.cache_dir / ".cache.lock"
|
|
119
|
+
|
|
115
120
|
self.manifest: dict[str, ManifestEntry] = self._load_manifest()
|
|
116
121
|
self._state: _InternalState = _InternalState.from_cache_state(self._load_state())
|
|
117
122
|
|
|
118
123
|
# Track if there are unsaved changes (for batched writes)
|
|
119
124
|
self._manifest_dirty = False
|
|
120
125
|
self._state_dirty = False
|
|
126
|
+
# Per-URL deltas since the last flush. flush() re-reads the on-disk
|
|
127
|
+
# files under an advisory lock and applies only these deltas, so
|
|
128
|
+
# concurrent processes sharing a cache dir don't drop each other's
|
|
129
|
+
# entries (last writer no longer wins wholesale).
|
|
130
|
+
self._touched: set[str] = set()
|
|
131
|
+
self._removed: set[str] = set()
|
|
132
|
+
self._state_ops: dict[str, str] = {}
|
|
133
|
+
self._last_run_set = False
|
|
134
|
+
|
|
135
|
+
def _backup_corrupt(self, path: Path, err: Exception) -> None:
|
|
136
|
+
"""Move an unreadable cache file aside instead of silently losing it."""
|
|
137
|
+
backup = path.with_name(f"{path.name}.corrupt-{time.strftime('%Y%m%dT%H%M%S')}-{os.getpid()}")
|
|
138
|
+
try:
|
|
139
|
+
os.replace(path, backup)
|
|
140
|
+
logger.warning("Could not load %s (%s); moved it to %s and starting empty", path, err, backup)
|
|
141
|
+
except OSError as move_err:
|
|
142
|
+
logger.warning("Could not load %s (%s); backup to %s failed: %s", path, err, backup, move_err)
|
|
121
143
|
|
|
122
144
|
def _load_manifest(self) -> dict[str, ManifestEntry]:
|
|
123
145
|
"""Load manifest from disk.
|
|
@@ -162,7 +184,7 @@ class CacheManager:
|
|
|
162
184
|
manifest[url] = entry
|
|
163
185
|
return manifest
|
|
164
186
|
except Exception as e:
|
|
165
|
-
|
|
187
|
+
self._backup_corrupt(self.manifest_file, e)
|
|
166
188
|
|
|
167
189
|
return {}
|
|
168
190
|
|
|
@@ -188,14 +210,24 @@ class CacheManager:
|
|
|
188
210
|
raise
|
|
189
211
|
|
|
190
212
|
def _save_manifest(self) -> None:
|
|
191
|
-
"""
|
|
213
|
+
"""Merge this process's manifest deltas into the on-disk manifest.
|
|
214
|
+
|
|
215
|
+
Called by flush() with the cache lock held. Write errors propagate.
|
|
216
|
+
"""
|
|
192
217
|
if not self._manifest_dirty:
|
|
193
218
|
return
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
219
|
+
merged = self._load_manifest()
|
|
220
|
+
for url in self._removed:
|
|
221
|
+
merged.pop(url, None)
|
|
222
|
+
for url in self._touched:
|
|
223
|
+
entry = self.manifest.get(url)
|
|
224
|
+
if entry is not None:
|
|
225
|
+
merged[url] = entry
|
|
226
|
+
self._write_json(self.manifest_file, merged)
|
|
227
|
+
self.manifest = merged
|
|
228
|
+
self._touched.clear()
|
|
229
|
+
self._removed.clear()
|
|
230
|
+
self._manifest_dirty = False
|
|
199
231
|
|
|
200
232
|
def _load_state(self) -> CacheState:
|
|
201
233
|
"""Load state from disk.
|
|
@@ -217,7 +249,7 @@ class CacheManager:
|
|
|
217
249
|
"last_run": last_run if isinstance(last_run, str) else None,
|
|
218
250
|
}
|
|
219
251
|
except Exception as e:
|
|
220
|
-
|
|
252
|
+
self._backup_corrupt(self.state_file, e)
|
|
221
253
|
|
|
222
254
|
return {
|
|
223
255
|
"fetched_urls": [],
|
|
@@ -229,21 +261,40 @@ class CacheManager:
|
|
|
229
261
|
"""Save state to disk (internal, called by flush)."""
|
|
230
262
|
if not self._state_dirty:
|
|
231
263
|
return
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
264
|
+
merged = _InternalState.from_cache_state(self._load_state())
|
|
265
|
+
for url, op in self._state_ops.items():
|
|
266
|
+
merged.fetched_urls.discard(url)
|
|
267
|
+
merged.failed_urls.discard(url)
|
|
268
|
+
if op == "fetched":
|
|
269
|
+
merged.fetched_urls.add(url)
|
|
270
|
+
elif op == "failed":
|
|
271
|
+
merged.failed_urls.add(url)
|
|
272
|
+
if self._last_run_set:
|
|
273
|
+
merged.last_run = self._state.last_run
|
|
274
|
+
self._write_json(self.state_file, merged.to_cache_state())
|
|
275
|
+
self._state = merged
|
|
276
|
+
self._state_ops.clear()
|
|
277
|
+
self._last_run_set = False
|
|
278
|
+
self._state_dirty = False
|
|
238
279
|
|
|
239
280
|
def flush(self) -> None:
|
|
240
281
|
"""Flush all pending changes to disk.
|
|
241
282
|
|
|
242
283
|
Call this after a batch of operations to persist changes.
|
|
243
284
|
This is more efficient than saving after every operation.
|
|
285
|
+
|
|
286
|
+
Holds an advisory lock on ``.cache.lock`` and merges with what is on
|
|
287
|
+
disk, so concurrent processes sharing the cache dir keep each
|
|
288
|
+
other's entries. Write failures raise (they are not swallowed).
|
|
289
|
+
|
|
290
|
+
Ordering: the manifest is written before state. If the process dies
|
|
291
|
+
between the two, state is merely behind the manifest, which only
|
|
292
|
+
means some URLs are re-fetched (conditional GET) on resume. The
|
|
293
|
+
reverse order could mark a URL fetched with no manifest entry.
|
|
244
294
|
"""
|
|
245
|
-
self.
|
|
246
|
-
|
|
295
|
+
with file_lock(self.lock_file):
|
|
296
|
+
self._save_manifest()
|
|
297
|
+
self._save_state()
|
|
247
298
|
self.frontier.flush()
|
|
248
299
|
|
|
249
300
|
def __enter__(self) -> CacheManager:
|
|
@@ -257,7 +308,14 @@ class CacheManager:
|
|
|
257
308
|
exc_tb: object | None,
|
|
258
309
|
) -> None:
|
|
259
310
|
"""Context manager exit - auto-flush on exit."""
|
|
260
|
-
|
|
311
|
+
if exc_type is None:
|
|
312
|
+
self.flush()
|
|
313
|
+
return
|
|
314
|
+
# Don't mask the in-flight exception with a flush failure.
|
|
315
|
+
try:
|
|
316
|
+
self.flush()
|
|
317
|
+
except Exception:
|
|
318
|
+
logger.exception("Could not flush cache in %s", self.cache_dir)
|
|
261
319
|
|
|
262
320
|
@staticmethod
|
|
263
321
|
def compute_checksum(content: str | bytes) -> str:
|
|
@@ -319,6 +377,8 @@ class CacheManager:
|
|
|
319
377
|
if sitemap_lastmod:
|
|
320
378
|
self.manifest[url]["sitemap_lastmod"] = sitemap_lastmod
|
|
321
379
|
|
|
380
|
+
self._touched.add(url)
|
|
381
|
+
self._removed.discard(url)
|
|
322
382
|
self._manifest_dirty = True
|
|
323
383
|
|
|
324
384
|
def mark_verified(self, url: str, sitemap_lastmod: str | None = None) -> None:
|
|
@@ -329,6 +389,7 @@ class CacheManager:
|
|
|
329
389
|
entry["verified_at"] = utc_now_iso()
|
|
330
390
|
if sitemap_lastmod:
|
|
331
391
|
entry["sitemap_lastmod"] = sitemap_lastmod
|
|
392
|
+
self._touched.add(url)
|
|
332
393
|
self._manifest_dirty = True
|
|
333
394
|
|
|
334
395
|
def forget(self, url: str) -> None:
|
|
@@ -336,6 +397,9 @@ class CacheManager:
|
|
|
336
397
|
self.manifest.pop(url, None)
|
|
337
398
|
self._state.fetched_urls.discard(url)
|
|
338
399
|
self._state.failed_urls.discard(url)
|
|
400
|
+
self._touched.discard(url)
|
|
401
|
+
self._removed.add(url)
|
|
402
|
+
self._state_ops[url] = "forget"
|
|
339
403
|
self._manifest_dirty = True
|
|
340
404
|
self._state_dirty = True
|
|
341
405
|
|
|
@@ -350,6 +414,7 @@ class CacheManager:
|
|
|
350
414
|
"""
|
|
351
415
|
self._state.fetched_urls.add(url)
|
|
352
416
|
self._state.failed_urls.discard(url)
|
|
417
|
+
self._state_ops[url] = "fetched"
|
|
353
418
|
self.frontier.mark_succeeded(url)
|
|
354
419
|
self._state_dirty = True
|
|
355
420
|
|
|
@@ -364,6 +429,7 @@ class CacheManager:
|
|
|
364
429
|
"""
|
|
365
430
|
self._state.failed_urls.add(url)
|
|
366
431
|
self._state.fetched_urls.discard(url)
|
|
432
|
+
self._state_ops[url] = "failed"
|
|
367
433
|
self.frontier.mark_failed(url)
|
|
368
434
|
self._state_dirty = True
|
|
369
435
|
|
|
@@ -382,6 +448,7 @@ class CacheManager:
|
|
|
382
448
|
Changes are batched. Call flush() to persist to disk.
|
|
383
449
|
"""
|
|
384
450
|
self._state.last_run = utc_now_iso()
|
|
451
|
+
self._last_run_set = True
|
|
385
452
|
self._state_dirty = True
|
|
386
453
|
|
|
387
454
|
def evict_expired(self, ttl_days: int | None = None) -> int:
|
|
@@ -417,6 +484,9 @@ class CacheManager:
|
|
|
417
484
|
for url in to_remove:
|
|
418
485
|
self._state.fetched_urls.discard(url)
|
|
419
486
|
self._state.failed_urls.discard(url)
|
|
487
|
+
self._touched.discard(url)
|
|
488
|
+
self._removed.add(url)
|
|
489
|
+
self._state_ops[url] = "forget"
|
|
420
490
|
self._manifest_dirty = True
|
|
421
491
|
self._state_dirty = True
|
|
422
492
|
logger.info(f"Evicted {len(to_remove)} expired cache entries")
|
|
@@ -455,11 +525,10 @@ class CacheManager:
|
|
|
455
525
|
self.frontier.initialize(start_url=start_url, run_fingerprint=config_fingerprint)
|
|
456
526
|
self.frontier.add_many(urls, source="discovery")
|
|
457
527
|
self.frontier.save()
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
logger.error(f"Could not save discovered URLs: {e}")
|
|
528
|
+
# Write errors propagate: a silently missing resume snapshot would
|
|
529
|
+
# make --resume restart from scratch without telling anyone.
|
|
530
|
+
self._write_json(self.discovered_urls_file, data)
|
|
531
|
+
logger.info(f"Saved {len(urls)} discovered URLs for resume capability")
|
|
463
532
|
|
|
464
533
|
def load_discovered_urls(
|
|
465
534
|
self,
|
|
@@ -497,7 +566,7 @@ class CacheManager:
|
|
|
497
566
|
logger.info(f"Loaded {len(urls)} discovered URLs from previous run")
|
|
498
567
|
return urls
|
|
499
568
|
except Exception as e:
|
|
500
|
-
|
|
569
|
+
self._backup_corrupt(self.discovered_urls_file, e)
|
|
501
570
|
return None
|
|
502
571
|
|
|
503
572
|
def get_pending_urls(
|
|
@@ -7,6 +7,7 @@ import json
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import Any, Literal
|
|
9
9
|
|
|
10
|
+
from ._fileutil import atomic_write_text
|
|
10
11
|
from .contracts import ChangeEvent, ReplayConfiguration, canonical_sha256, stable_id
|
|
11
12
|
from .evidence import evidence_span
|
|
12
13
|
|
|
@@ -41,7 +42,9 @@ def build_change_events(
|
|
|
41
42
|
new_primary = new_items[0] if new_items else None
|
|
42
43
|
old_text = _combined_content(old_items)
|
|
43
44
|
new_text = _combined_content(new_items)
|
|
44
|
-
|
|
45
|
+
# One lowercase haystack per event, shared by classification and confidence.
|
|
46
|
+
haystack = f"{url}\n{old_text}\n{new_text}".lower()
|
|
47
|
+
classifications = _classifications(haystack)
|
|
45
48
|
structural = _structural_changes(old_items, new_items)
|
|
46
49
|
textual = _textual_changes(old_text, new_text)
|
|
47
50
|
old_evidence = _record_evidence(old_primary, old_text) if old_primary else []
|
|
@@ -57,7 +60,7 @@ def build_change_events(
|
|
|
57
60
|
{
|
|
58
61
|
"classification": item,
|
|
59
62
|
"status": "candidate",
|
|
60
|
-
"confidence": _classification_confidence(item,
|
|
63
|
+
"confidence": _classification_confidence(item, haystack),
|
|
61
64
|
"requires_review": True,
|
|
62
65
|
}
|
|
63
66
|
for item in classifications
|
|
@@ -90,10 +93,9 @@ def build_change_events(
|
|
|
90
93
|
|
|
91
94
|
|
|
92
95
|
def write_change_events(path: Path, events: list[dict[str, Any]]) -> Path:
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
atomic_write_text(
|
|
97
|
+
path,
|
|
95
98
|
"".join(json.dumps(event, ensure_ascii=False, sort_keys=True) + "\n" for event in events),
|
|
96
|
-
encoding="utf-8",
|
|
97
99
|
)
|
|
98
100
|
return path
|
|
99
101
|
|
|
@@ -140,9 +142,8 @@ def _structural_changes(
|
|
|
140
142
|
def _textual_changes(old_text: str, new_text: str) -> list[dict[str, Any]]:
|
|
141
143
|
old_lines = old_text.splitlines()
|
|
142
144
|
new_lines = new_text.splitlines()
|
|
143
|
-
matcher = difflib.SequenceMatcher(a=old_lines, b=new_lines, autojunk=False)
|
|
144
145
|
changes: list[dict[str, Any]] = []
|
|
145
|
-
for tag, i1, i2, j1, j2 in
|
|
146
|
+
for tag, i1, i2, j1, j2 in _line_opcodes(old_lines, new_lines):
|
|
146
147
|
if tag == "equal":
|
|
147
148
|
continue
|
|
148
149
|
before = "\n".join(old_lines[i1:i2])[:1000]
|
|
@@ -165,8 +166,44 @@ def _textual_changes(old_text: str, new_text: str) -> list[dict[str, Any]]:
|
|
|
165
166
|
return changes
|
|
166
167
|
|
|
167
168
|
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
# SequenceMatcher(autojunk=False) is quadratic in line counts; above this many
|
|
170
|
+
# line-pair comparisons the diff falls back to a bounded prefix/suffix scan.
|
|
171
|
+
_MAX_DIFF_LINE_PRODUCT = 4_000_000
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _line_opcodes(old_lines: list[str], new_lines: list[str]) -> list[tuple[str, int, int, int, int]]:
|
|
175
|
+
if len(old_lines) * len(new_lines) <= _MAX_DIFF_LINE_PRODUCT:
|
|
176
|
+
matcher = difflib.SequenceMatcher(a=old_lines, b=new_lines, autojunk=False)
|
|
177
|
+
return list(matcher.get_opcodes())
|
|
178
|
+
# Large documents: trim the shared head and tail (linear), then diff the middle
|
|
179
|
+
# only if it is small enough, otherwise report it as one replaced block.
|
|
180
|
+
prefix = 0
|
|
181
|
+
limit = min(len(old_lines), len(new_lines))
|
|
182
|
+
while prefix < limit and old_lines[prefix] == new_lines[prefix]:
|
|
183
|
+
prefix += 1
|
|
184
|
+
suffix = 0
|
|
185
|
+
while (
|
|
186
|
+
suffix < limit - prefix
|
|
187
|
+
and old_lines[len(old_lines) - 1 - suffix] == new_lines[len(new_lines) - 1 - suffix]
|
|
188
|
+
):
|
|
189
|
+
suffix += 1
|
|
190
|
+
old_end = len(old_lines) - suffix
|
|
191
|
+
new_end = len(new_lines) - suffix
|
|
192
|
+
old_mid = old_lines[prefix:old_end]
|
|
193
|
+
new_mid = new_lines[prefix:new_end]
|
|
194
|
+
if not old_mid and not new_mid:
|
|
195
|
+
return []
|
|
196
|
+
if old_mid and new_mid and len(old_mid) * len(new_mid) <= _MAX_DIFF_LINE_PRODUCT:
|
|
197
|
+
matcher = difflib.SequenceMatcher(a=old_mid, b=new_mid, autojunk=False)
|
|
198
|
+
return [
|
|
199
|
+
(tag, i1 + prefix, i2 + prefix, j1 + prefix, j2 + prefix)
|
|
200
|
+
for tag, i1, i2, j1, j2 in matcher.get_opcodes()
|
|
201
|
+
]
|
|
202
|
+
tag = "replace" if old_mid and new_mid else ("delete" if old_mid else "insert")
|
|
203
|
+
return [(tag, prefix, old_end, prefix, new_end)]
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def _classifications(haystack: str) -> list[ChangeClassification]:
|
|
170
207
|
output = [
|
|
171
208
|
classification
|
|
172
209
|
for classification, terms in _CLASSIFICATION_TERMS.items()
|
|
@@ -175,14 +212,8 @@ def _classifications(old_text: str, new_text: str, url: str) -> list[ChangeClass
|
|
|
175
212
|
return output or ["other"]
|
|
176
213
|
|
|
177
214
|
|
|
178
|
-
def _classification_confidence(
|
|
179
|
-
classification: ChangeClassification,
|
|
180
|
-
old_text: str,
|
|
181
|
-
new_text: str,
|
|
182
|
-
url: str,
|
|
183
|
-
) -> float:
|
|
215
|
+
def _classification_confidence(classification: ChangeClassification, haystack: str) -> float:
|
|
184
216
|
terms = _CLASSIFICATION_TERMS.get(classification, ())
|
|
185
|
-
haystack = f"{url}\n{old_text}\n{new_text}".lower()
|
|
186
217
|
hits = sum(1 for term in terms if term in haystack)
|
|
187
218
|
return min(0.95, 0.5 + hits * 0.1) if terms else 0.4
|
|
188
219
|
|
|
@@ -704,7 +704,7 @@ def run_fetcher(args: argparse.Namespace) -> int:
|
|
|
704
704
|
)
|
|
705
705
|
from .models.config import DocpullConfig, ProfileName
|
|
706
706
|
from .models.events import EventType, FetchStats, SkipReason
|
|
707
|
-
from .rendering import
|
|
707
|
+
from .rendering import estimate_cloud_run_cost_usd
|
|
708
708
|
from .skill_export import default_skill_root, expand_skill_agents
|
|
709
709
|
from .time_utils import utc_now_iso
|
|
710
710
|
|
|
@@ -937,10 +937,13 @@ def run_fetcher(args: argparse.Namespace) -> int:
|
|
|
937
937
|
budget_limit = config.budget.maximum_paid_cost_usd
|
|
938
938
|
render_is_cloud = config.render.enabled and config.render.backend in {"vercel-sandbox", "e2b-sandbox"}
|
|
939
939
|
render_is_local = config.render.enabled and config.render.backend == "agent-browser"
|
|
940
|
+
# Preflight: a cloud crawl can render every page, so scale the per-render
|
|
941
|
+
# estimate by the page cap. The renderer also enforces cumulative spend.
|
|
940
942
|
render_estimated_cost = (
|
|
941
|
-
|
|
943
|
+
estimate_cloud_run_cost_usd(
|
|
942
944
|
cast(Literal["vercel-sandbox", "e2b-sandbox"], config.render.backend),
|
|
943
945
|
config.render,
|
|
946
|
+
config.crawl.max_pages,
|
|
944
947
|
)
|
|
945
948
|
if render_is_cloud
|
|
946
949
|
else 0.0
|