flash-context 0.3.1__tar.gz → 0.4.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.
Files changed (25) hide show
  1. {flash_context-0.3.1 → flash_context-0.4.0}/.env.example +5 -0
  2. {flash_context-0.3.1 → flash_context-0.4.0}/CHANGELOG.md +64 -0
  3. {flash_context-0.3.1 → flash_context-0.4.0}/PKG-INFO +20 -22
  4. {flash_context-0.3.1 → flash_context-0.4.0}/README.md +17 -21
  5. {flash_context-0.3.1 → flash_context-0.4.0}/config.yaml.example +3 -1
  6. {flash_context-0.3.1 → flash_context-0.4.0}/pyproject.toml +5 -1
  7. flash_context-0.4.0/src/flash_context/agent.py +848 -0
  8. flash_context-0.4.0/src/flash_context/citations.py +439 -0
  9. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/cli.py +5 -13
  10. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/config.py +53 -145
  11. flash_context-0.4.0/src/flash_context/execution.py +373 -0
  12. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/logging.py +2 -1
  13. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/mcp_server.py +0 -2
  14. flash_context-0.4.0/src/flash_context/queries.py +163 -0
  15. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/tools/glob.py +2 -2
  16. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/tools/grep.py +7 -12
  17. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/tools/read.py +2 -2
  18. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/tools/safety.py +6 -6
  19. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/types.py +91 -13
  20. flash_context-0.3.1/src/flash_context/agent.py +0 -1608
  21. {flash_context-0.3.1 → flash_context-0.4.0}/.gitignore +0 -0
  22. {flash_context-0.3.1 → flash_context-0.4.0}/LICENSE +0 -0
  23. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/__init__.py +0 -0
  24. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/llm.py +0 -0
  25. {flash_context-0.3.1 → flash_context-0.4.0}/src/flash_context/tools/__init__.py +0 -0
@@ -15,3 +15,8 @@ FLASH_CONTEXT_MAX_SCAN_BYTES=16777216
15
15
  FLASH_CONTEXT_MAX_SCAN_ENTRIES=10000
16
16
  FLASH_CONTEXT_TOOL_TIMEOUT_SECONDS=5
17
17
  FLASH_CONTEXT_MAX_TOOL_CALLS_PER_TURN=16
18
+
19
+ # Controller-owned citation precision
20
+ FLASH_CONTEXT_MAX_CITATION_LINES=120
21
+ FLASH_CONTEXT_MAX_TOTAL_CITATION_LINES=240
22
+ FLASH_CONTEXT_MAX_PARSE_BYTES=1048576
@@ -4,6 +4,70 @@ User-visible changes and migration instructions for each release.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.4.0] - 2026-11-01
8
+
9
+ ### Added
10
+
11
+ - Bundled parsers for controller-owned symbol and line-anchor boundaries, with
12
+ citation precision metadata and an opt-in pinned quality benchmark.
13
+ - Configurable per-citation, total-line and parser-byte limits (120, 240 and
14
+ 1 MiB by default), supporting the existing configuration precedence.
15
+
16
+ ### Fixed
17
+
18
+ - Keep citation repair feedback local to each model turn; successful repair after
19
+ a tool-only turn no longer reports a precision failure. Preserve overlapping
20
+ anchor mappings, LF/CRLF source lines, and snippet/metadata source snapshots.
21
+ - Report parser input/deadline limits explicitly and use diagnostic identities
22
+ for truncation and CLI exit behavior.
23
+
24
+ ### Changed
25
+
26
+ - Consolidate contracts under `docs/`, remove planning scaffolds and separate
27
+ agent instructions, and keep contributor guidance in `CONTRIBUTING.md`.
28
+ Simplify query routing, configuration, loop finalization, test fixtures,
29
+ live evaluation, and CI jobs.
30
+ - Benchmark against independent reviewed ranges, recording package/parser
31
+ versions and effective settings. Live probes share the same pinned cases.
32
+
33
+ ### Migration
34
+
35
+ - Models must propose symbol or single-line anchors; model-selected ranges receive
36
+ bounded correction feedback. Public line labels remain unchanged. Adjacent
37
+ definitions remain separate, and the final citation cap increases to twelve.
38
+ - Unselected read observations no longer become final citations. Consumers should
39
+ accept the additive precision object. Explicit user ranges retain old behavior.
40
+ - Parser dependencies ship with installation; exploration does not download grammars.
41
+ - CLI `--no-citation` now enables prose; `--citation` remains the default.
42
+ Remove the previously ignored `explorer.citation` YAML key. Python callers
43
+ should stop passing the ignored `load_settings(repo_root=...)` argument or
44
+ the adapter-only `ExploreRequest.format` field. `Citation` now requires both
45
+ line bounds; typed warnings use `Diagnostic` members and serialize as strings.
46
+ - Empty results after parser input/deadline exhaustion exit 6, matching scan
47
+ exhaustion. Ordinary syntax fallback and complete empty results still exit 0.
48
+
49
+ ## [0.3.2] - 2026-11-01
50
+
51
+ ### Fixed
52
+
53
+ - Require whole, case-sensitive query tokens inside exact-symbol citations,
54
+ including read-derived fallback evidence. Reject plausible-home file citations
55
+ without matching source text and retain scoped Python preflight diagnostics.
56
+ - Report `query symbol not found in verified evidence` when symbol lookups finish
57
+ without accepted evidence, rather than relying on generic termination warnings.
58
+
59
+ ### Migration
60
+
61
+ - Exact-symbol queries may now return `NO_CITATIONS_FOUND` with empty citations
62
+ and snippets where previous versions returned unrelated files. Token presence
63
+ is lexical evidence, not proof of a definition or semantic relevance. Public
64
+ schemas, configuration, and CLI exit semantics are unchanged.
65
+
66
+ ### Changed
67
+
68
+ - Condense the README overview and move safety and evidence-validation details
69
+ to the architecture documentation.
70
+
7
71
  ## [0.3.1] - 2026-11-01
8
72
 
9
73
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: flash-context
3
- Version: 0.3.1
3
+ Version: 0.4.0
4
4
  Summary: Read-only context exploration and retrieval for AI agents, starting with codebases and repositories.
5
5
  Project-URL: Repository, https://github.com/zyf0717/flash-context
6
6
  Project-URL: Issues, https://github.com/zyf0717/flash-context/issues
@@ -17,6 +17,8 @@ Requires-Python: >=3.13
17
17
  Requires-Dist: httpx>=0.28.0
18
18
  Requires-Dist: pyyaml>=6.0.0
19
19
  Requires-Dist: regex>=2026.9.29
20
+ Requires-Dist: tree-sitter-language-pack==0.13.0
21
+ Requires-Dist: tree-sitter==0.25.2
20
22
  Provides-Extra: mcp
21
23
  Requires-Dist: mcp<2,>=1.13.0; extra == 'mcp'
22
24
  Description-Content-Type: text/markdown
@@ -28,24 +30,16 @@ Description-Content-Type: text/markdown
28
30
  [![Python versions](https://img.shields.io/pypi/pyversions/flash-context)](https://pypi.org/project/flash-context/)
29
31
  [![License](https://img.shields.io/pypi/l/flash-context)](LICENSE)
30
32
 
31
- A lightweight, model-agnostic repository explorer that combines deterministic
32
- lookup with delegated LLM search to deliver compact, validated source evidence.
33
- Available as a Python CLI and Model Context Protocol (MCP) server.
34
-
35
- Delegate recursive, repetitive file search and reading to a utility model
36
- behind an OpenAI-compatible endpoint. The calling agent receives validated
37
- file-line citations and source snippets to use in its main task.
38
-
39
- Codebases and repositories are the current focus; the same tools explore
40
- documentation, configuration, and other local text files. CLI and MCP share one
41
- exploration core with read-only tools, path safety, and resource limits.
42
- Scans and regex execution are bounded; partial results report truncation.
43
- Citation validation checks safe paths and existing line coverage, not semantic
44
- relevance or minimal ranges. Citation precision depends on the explorer model.
45
- Implementation queries continue past documentation-only citations within the turn budget; documentation-only
46
- fallbacks carry incomplete-result metadata and warnings. Build outputs such as
47
- `dist/` remain excluded; inspect a source checkout for implementation evidence.
48
- Optional metadata-only trajectory logs must stay outside the inspected repository.
33
+ A lightweight, model-agnostic repository explorer for AI agents, available as a
34
+ Python CLI and Model Context Protocol (MCP) server. It combines deterministic
35
+ lookup with search and reading delegated to a utility model through an
36
+ OpenAI-compatible endpoint, returning compact, validated file-line citations and
37
+ source snippets.
38
+
39
+ CLI and MCP share a read-only core for exploring code, documentation,
40
+ configuration, and other local text files with path safety and resource limits.
41
+ See [safety and evidence validation](docs/contracts.md#read-only-tools-and-safety)
42
+ for details and limitations.
49
43
 
50
44
  Inspired by [FastContext](https://arxiv.org/abs/2606.14066), a now-withdrawn paper
51
45
  on separating repository exploration from task solving, using specialized models
@@ -75,10 +69,10 @@ Default output is repository-relative citations:
75
69
  src/api/validation.py:42-88
76
70
  ```
77
71
 
78
- Use `--format json` for structured results with source snippets, or
72
+ Use `--no-citation` for prose, `--format json` for results with snippets, or
79
73
  `--max-turns 6` to set the exploration limit. Exact path and unique symbol
80
74
  lookups can resolve locally without an endpoint. See the
81
- [CLI contract](specs/001-flash-context-explorer/contracts/cli.md) for options,
75
+ [CLI contract](docs/cli.md) for options,
82
76
  output schemas, and exit codes.
83
77
 
84
78
  For example, `--query 'httpx/_client.py'` returns a bounded file preview, while
@@ -89,6 +83,10 @@ Warnings go to stderr in both output formats. An empty result after scan-budget
89
83
  exhaustion exits **6** while preserving stdout; a complete empty search exits
90
84
  **0**. For large repositories, see [scan-budget tuning](docs/configuration.md#large-repositories).
91
85
 
86
+ Models select symbol or line anchors; the controller resolves bounded syntax
87
+ regions and returns structural precision metadata. See the
88
+ [shared contract](docs/contracts.md) for evidence rules and limits.
89
+
92
90
  ## MCP
93
91
 
94
92
  ```bash
@@ -101,7 +99,7 @@ See [MCP integration](docs/mcp.md) for editor configuration and source launches.
101
99
  ## Documentation
102
100
 
103
101
  - [Configuration](docs/configuration.md): endpoint settings, precedence, and limits.
104
- - [Architecture and scope](docs/architecture.md): design, status, specs, and references.
102
+ - [Architecture and scope](docs/architecture.md): shared core and module responsibilities.
105
103
  - [Contributing](CONTRIBUTING.md): development setup, tests, and pull requests.
106
104
  - [Changelog](CHANGELOG.md): release history and migration instructions.
107
105
  - [Releasing](docs/releasing.md): package checks and tag-driven TestPyPI/PyPI publishing.
@@ -5,24 +5,16 @@
5
5
  [![Python versions](https://img.shields.io/pypi/pyversions/flash-context)](https://pypi.org/project/flash-context/)
6
6
  [![License](https://img.shields.io/pypi/l/flash-context)](LICENSE)
7
7
 
8
- A lightweight, model-agnostic repository explorer that combines deterministic
9
- lookup with delegated LLM search to deliver compact, validated source evidence.
10
- Available as a Python CLI and Model Context Protocol (MCP) server.
11
-
12
- Delegate recursive, repetitive file search and reading to a utility model
13
- behind an OpenAI-compatible endpoint. The calling agent receives validated
14
- file-line citations and source snippets to use in its main task.
15
-
16
- Codebases and repositories are the current focus; the same tools explore
17
- documentation, configuration, and other local text files. CLI and MCP share one
18
- exploration core with read-only tools, path safety, and resource limits.
19
- Scans and regex execution are bounded; partial results report truncation.
20
- Citation validation checks safe paths and existing line coverage, not semantic
21
- relevance or minimal ranges. Citation precision depends on the explorer model.
22
- Implementation queries continue past documentation-only citations within the turn budget; documentation-only
23
- fallbacks carry incomplete-result metadata and warnings. Build outputs such as
24
- `dist/` remain excluded; inspect a source checkout for implementation evidence.
25
- Optional metadata-only trajectory logs must stay outside the inspected repository.
8
+ A lightweight, model-agnostic repository explorer for AI agents, available as a
9
+ Python CLI and Model Context Protocol (MCP) server. It combines deterministic
10
+ lookup with search and reading delegated to a utility model through an
11
+ OpenAI-compatible endpoint, returning compact, validated file-line citations and
12
+ source snippets.
13
+
14
+ CLI and MCP share a read-only core for exploring code, documentation,
15
+ configuration, and other local text files with path safety and resource limits.
16
+ See [safety and evidence validation](docs/contracts.md#read-only-tools-and-safety)
17
+ for details and limitations.
26
18
 
27
19
  Inspired by [FastContext](https://arxiv.org/abs/2606.14066), a now-withdrawn paper
28
20
  on separating repository exploration from task solving, using specialized models
@@ -52,10 +44,10 @@ Default output is repository-relative citations:
52
44
  src/api/validation.py:42-88
53
45
  ```
54
46
 
55
- Use `--format json` for structured results with source snippets, or
47
+ Use `--no-citation` for prose, `--format json` for results with snippets, or
56
48
  `--max-turns 6` to set the exploration limit. Exact path and unique symbol
57
49
  lookups can resolve locally without an endpoint. See the
58
- [CLI contract](specs/001-flash-context-explorer/contracts/cli.md) for options,
50
+ [CLI contract](docs/cli.md) for options,
59
51
  output schemas, and exit codes.
60
52
 
61
53
  For example, `--query 'httpx/_client.py'` returns a bounded file preview, while
@@ -66,6 +58,10 @@ Warnings go to stderr in both output formats. An empty result after scan-budget
66
58
  exhaustion exits **6** while preserving stdout; a complete empty search exits
67
59
  **0**. For large repositories, see [scan-budget tuning](docs/configuration.md#large-repositories).
68
60
 
61
+ Models select symbol or line anchors; the controller resolves bounded syntax
62
+ regions and returns structural precision metadata. See the
63
+ [shared contract](docs/contracts.md) for evidence rules and limits.
64
+
69
65
  ## MCP
70
66
 
71
67
  ```bash
@@ -78,7 +74,7 @@ See [MCP integration](docs/mcp.md) for editor configuration and source launches.
78
74
  ## Documentation
79
75
 
80
76
  - [Configuration](docs/configuration.md): endpoint settings, precedence, and limits.
81
- - [Architecture and scope](docs/architecture.md): design, status, specs, and references.
77
+ - [Architecture and scope](docs/architecture.md): shared core and module responsibilities.
82
78
  - [Contributing](CONTRIBUTING.md): development setup, tests, and pull requests.
83
79
  - [Changelog](CHANGELOG.md): release history and migration instructions.
84
80
  - [Releasing](docs/releasing.md): package checks and tag-driven TestPyPI/PyPI publishing.
@@ -1,6 +1,7 @@
1
1
  explorer:
2
2
  max_turns: 6
3
- citation: true
3
+ max_citation_lines: 120
4
+ max_total_citation_lines: 240
4
5
  ignore:
5
6
  - ".git"
6
7
  - ".venv"
@@ -20,6 +21,7 @@ model:
20
21
 
21
22
  tools:
22
23
  max_read_bytes: 12000
24
+ max_parse_bytes: 1048576
23
25
  max_grep_results: 50
24
26
  max_observation_chars: 6000
25
27
  max_read_lines: 120
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flash-context"
3
- version = "0.3.1"
3
+ version = "0.4.0"
4
4
  description = "Read-only context exploration and retrieval for AI agents, starting with codebases and repositories."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -19,6 +19,8 @@ dependencies = [
19
19
  "httpx>=0.28.0",
20
20
  "PyYAML>=6.0.0",
21
21
  "regex>=2026.9.29",
22
+ "tree-sitter==0.25.2",
23
+ "tree-sitter-language-pack==0.13.0",
22
24
  ]
23
25
 
24
26
  [project.urls]
@@ -60,12 +62,14 @@ include = [
60
62
 
61
63
  [tool.pytest.ini_options]
62
64
  testpaths = ["tests"]
65
+ pythonpath = ["."]
63
66
  norecursedirs = ["tests/fixtures"]
64
67
  markers = [
65
68
  "e2e: endpoint-backed opt-in end-to-end tests",
66
69
  ]
67
70
 
68
71
  [tool.ruff]
72
+ extend-exclude = ["tests/fixtures/httpx_0_28_1"]
69
73
  line-length = 88
70
74
  target-version = "py313"
71
75