synap-git 2.1.7__tar.gz → 2.3.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.
- {synap_git-2.1.7 → synap_git-2.3.0}/.gitignore +4 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/CHANGELOG.md +71 -4
- {synap_git-2.1.7 → synap_git-2.3.0}/PKG-INFO +2 -1
- {synap_git-2.1.7 → synap_git-2.3.0}/pyproject.toml +1 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/__init__.py +1 -1
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/cli/main.py +61 -25
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/indexer/daemon.py +101 -44
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/indexer/engine.py +1 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/parser/registry.py +46 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/provider/anthropic.py +6 -5
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/provider/openrouter.py +6 -2
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/retrieval/engine.py +9 -4
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/storage/sqlite.py +14 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/.synap.example/README.md +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/LICENSE.md +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/README.md +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/api/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/api/app.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/api/static/index.html +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/cli/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/cli/__main__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/cli/checkpoint.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/cli/lessons.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/cli/memory.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/cli/usage.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/cli/wiki.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/config.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/diagnostics/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/diagnostics/logger.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/diagnostics/tracing.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/embeddings/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/git/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/git/state.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/indexer/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/indexer/scanner.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/indexer/wiki.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/mcp/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/mcp/server.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/parser/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/provider/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/provider/base.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/provider/factory.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/provider/gemini.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/provider/ollama.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/provider/openai.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/py.typed +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/retrieval/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/retrieval/memory.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/security/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/security/redactor.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/security/sanitizer.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/security/validator.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/storage/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/utils/__init__.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/src/synap_git/utils/serialization.py +0 -0
- {synap_git-2.1.7 → synap_git-2.3.0}/website/README.md +0 -0
|
@@ -5,22 +5,59 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.2.0] - 2026-08-03
|
|
9
|
+
|
|
10
|
+
## [2.3.0] - 2026-08-03
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **CLI Cost & Usage Command**: Expose `synap cost` (alias `synap usage`) to show aggregated LLM calls, token counts, and estimated USD cost in the terminal.
|
|
14
|
+
- **Web UI: CLI Cost Integration**: The website CLI playground now surfaces an estimated cost line for sample commands so visitors can see token/cost economics.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- **Frontend Defensive Rendering**: Guarded several UI paths against undefined symbol objects to prevent runtime errors in production (fixed `.type` property reads).
|
|
18
|
+
|
|
19
|
+
### Chore
|
|
20
|
+
- **Bumped package version** to `2.3.0`.
|
|
21
|
+
- **Release automation**: prepared changelog and release tag for GitHub release `v2.3.0`.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- **AST Symbol Parser Expansion (AUD-02)**: Implemented Tree-sitter AST symbol extraction handlers for C#, PHP, Kotlin, Scala, and C.
|
|
27
|
+
- **Event-Driven File Watcher (AUD-03)**: Replaced continuous 2s subprocess polling with `watchdog` filesystem event tracking, reducing idle CPU usage to near-zero.
|
|
28
|
+
- **Daemon REST API Diagnostic Checks (AUD-06)**: Added daemon port availability and REST API endpoint status checks to `synap doctor`.
|
|
29
|
+
- **Wiki Task Requeue Subcommand (AUD-08)**: Added `synap wiki retry` CLI subcommand and `retry_failed_wiki_queue` storage method to requeue permanently failed wiki tasks back to pending state.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- **CLI `synap start` Control Flow (AUD-01)**: Fixed `synap start` so it exits cleanly when a daemon is already running unless `--foreground` is explicitly passed.
|
|
34
|
+
- **SQLite WAL Performance Rationale (AUD-07)**: Documented `PRAGMA synchronous=NORMAL` in WAL mode as an intentional architectural tradeoff balancing write throughput and self-healing index recovery.
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- **Graceful Embedding Provider Fallback (AUD-04)**: Configured Anthropic and OpenRouter providers to log a warning and return empty embedding vectors instead of raising unhandled `NotImplementedError`.
|
|
39
|
+
- **Symbol Preservation on File Renames (AUD-05)**: Added `-M` rename detection to `git diff-tree` in incremental indexing to preserve file symbol history and edges across renames.
|
|
40
|
+
|
|
8
41
|
## [2.1.7] - 2026-07-29
|
|
9
42
|
|
|
10
43
|
### Added
|
|
44
|
+
|
|
11
45
|
- **AI Engineer Rules**: Created standardized agent rulesets across `AGENTS.md`, `.cursorrules`, `.windsurfrules`, and `.github/copilot-instructions.md`.
|
|
12
46
|
|
|
13
47
|
### Fixed
|
|
48
|
+
|
|
14
49
|
- **Daemon Branch Switching Test Stability**: Resolved timing race condition in daemon branch checkout verification.
|
|
15
50
|
- **CLI Setup Connectivity**: Fixed setup connectivity verification and non-TTY prompt fallback handling.
|
|
16
51
|
|
|
17
52
|
## [2.1.6] - 2026-06-29
|
|
18
53
|
|
|
19
54
|
### Added
|
|
55
|
+
|
|
20
56
|
- **Universal Language Expansion**: Expanded tree-sitter AST parsing support from 4 hardcoded languages to dynamically supporting over ~50 languages using `tree-sitter-languages`. Also added dynamic shebang detection (`#!`) to parse extensionless scripts as python, ruby, node, and bash scripts.
|
|
21
57
|
- **API Rate Limiting**: Implemented a global `RateLimitedProvider` to throttle LLM and embedding calls to 3 requests per second to mitigate resource exhaustion on the diagnostic API.
|
|
22
58
|
|
|
23
59
|
### Fixed
|
|
60
|
+
|
|
24
61
|
- **Broad Exception Handling**: Eradicated remaining `except Exception:` blocks across diagnostics, daemon execution, indexer scanning, and module resolution, and replaced them with `OSError`, `sqlite3.Error`, and specific errors to prevent silent data corruption.
|
|
25
62
|
- **Async Sleep Compatibility**: Fixed thread-blocking `time.sleep()` in LLM retries by delegating to `anyio.from_thread.run(anyio.sleep)` if invoked inside FastMCP worker threads.
|
|
26
63
|
- **Edge Resolution & Source Paths**: Added support for resolving Javascript, Java, C++, Ruby, and more during import/edge resolution.
|
|
@@ -29,38 +66,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
66
|
- **Metadata Fixes**: Corrected repository URLs in `pyproject.toml` to correctly point to `synapse` instead of `synap-git`.
|
|
30
67
|
|
|
31
68
|
### Refactored
|
|
69
|
+
|
|
32
70
|
- **Daemon Teardown**: Refactored the forceful SIGTERM daemon teardown logic to safely toggle via `force_exit=True` rather than a blanket catch-all. Makes programmatic `daemon.stop()` safer without blocking terminal UI interactions.
|
|
33
71
|
|
|
34
72
|
## [2.1.4] - 2026-06-11
|
|
35
73
|
|
|
36
74
|
### Fixed
|
|
75
|
+
|
|
37
76
|
- **Graceful Shutdown Hang**: Fixed an edge case where `synap stop` would time out and forcefully terminate due to `concurrent.futures` threads preventing immediate python process exit when handling embeddings. The CLI now safely flushes databases and exits instantly.
|
|
38
77
|
|
|
39
78
|
## [2.1.3] - 2026-06-11
|
|
40
79
|
|
|
41
80
|
### Changed
|
|
81
|
+
|
|
42
82
|
- **CLI Interactivity Enhancement**: Wrapped all long-running `synap` CLI commands (`init`, `start`, `stop`, `rollback`, `repair`) with interactive rich status spinners to ensure users never stare at an empty screen.
|
|
43
83
|
- **Incremental Indexing Progress**: Added a rich progress status to the `_incremental_index` background loop to provide visibility into parsing tasks during cache hits.
|
|
44
84
|
|
|
45
85
|
## [2.1.2] - 2026-06-11
|
|
46
86
|
|
|
47
87
|
### Fixed
|
|
88
|
+
|
|
48
89
|
- **CRITICAL: Daemon Thread Explosion**: Patched a massive concurrency edge case in `SynapRuntime` where large repository indexing would trigger unbounded `threading.Thread` loops for LLM embeddings. A bounded `ThreadPoolExecutor` has been introduced to prevent OOMs, OS thread starvation, and rate-limit hits during first-run indexing.
|
|
49
90
|
- **Daemon Lifecycle**: Ensure `embedding_executor` shuts down cleanly without leaking background threads when the daemon loop receives SIGTERM.
|
|
50
91
|
|
|
51
92
|
## [2.1.1] - 2026-06-11
|
|
52
93
|
|
|
53
94
|
### Fixed
|
|
95
|
+
|
|
54
96
|
- **CRITICAL: MCP StdIO Stream Corruption**: Fixed a bug where `synap mcp start` and `signal_low_context` would accidentally print progress bars or notifications to `sys.stdout` instead of `sys.stderr`, which corrupted the MCP protocol stream and disconnected IDEs like Cursor/Windsurf.
|
|
55
97
|
- **UX Improvements**: Improved the silence logic in CLI initialization to prevent unnecessary rich formatting in JSON/MCP environments.
|
|
56
98
|
|
|
57
99
|
## [2.1.0] - 2026-05-29
|
|
58
100
|
|
|
59
101
|
### Added
|
|
102
|
+
|
|
60
103
|
- **CLI `search` command**: New user-facing command for executing hybrid structural searches directly from the terminal.
|
|
61
104
|
- **`embed_provider` configuration**: Added explicit control over the vector embedding provider via `SYNAP_EMBED_PROVIDER` or `config.toml`.
|
|
62
105
|
|
|
63
106
|
### Fixed
|
|
107
|
+
|
|
64
108
|
- **CRITICAL: Metadata Nullability Bug**: Resolved a type mismatch in `CodeSymbol` where `metadata=None` caused background worker crashes. Enforced strict `dict` contract with `default_factory`.
|
|
65
109
|
- **CRITICAL: Exception Swallowing**: Eradicated 26 instances of silent failure (`except Exception: pass`) across all core subsystems (API, Indexer, Storage, Retrieval, MCP, Providers). Replaced with structured, traceback-aware logging.
|
|
66
110
|
- **CRITICAL: SQLite Schema Integrity**: Fixed `NOT NULL` constraint failure in `llm_calls` table by aligning schema with insertion logic and adding `cost_usd` support.
|
|
@@ -71,10 +115,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
71
115
|
## [2.0.0] - 2026-05-29
|
|
72
116
|
|
|
73
117
|
### Added
|
|
118
|
+
|
|
74
119
|
- **.synapignore Support**: Implemented context-aware filtering to prevent traversing symlinks, binary files, and files listed in `.synapignore` or `.gitignore`.
|
|
75
120
|
- **FTS5 Integration**: Shifted semantic full-text search directly to SQLite FTS5 with bounding limits (`LIMIT 50`) for `O(1)` lexical retrieval scaling on 10,000+ file monorepos.
|
|
76
121
|
|
|
77
122
|
### Fixed
|
|
123
|
+
|
|
78
124
|
- **LLM Hangs in Test Suite**: Isolated testing environment by strictly bypassing real LLM provider configs (`SYNAP_LLM_PROVIDER=""`) preventing test CI suite hangs.
|
|
79
125
|
- **Repository Path Scoping in Hybrid Engine**: Fixed a bug where `repo_path` initialization mistakenly truncated the path to `/tmp` in tests, failing contextual snippet aggregation.
|
|
80
126
|
- **Unbounded BM25 Expansion**: Bounded full-text search token extraction and BM25 results, preventing out-of-memory cascading in CTE traversal during monorepo indexing.
|
|
@@ -82,24 +128,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
82
128
|
## [1.2.3] - 2026-05-28
|
|
83
129
|
|
|
84
130
|
### Added
|
|
131
|
+
|
|
85
132
|
- **Architecture Documentation Consolidation:** Merged duplicate `docs/architecture.md` into the root-level `ARCHITECTURE.md` to ensure a single, consistent source of architectural truth.
|
|
86
133
|
|
|
87
134
|
### Fixed
|
|
135
|
+
|
|
88
136
|
- **Release Version Sync:** Bumped package version in `src/synap_git/__init__.py` to `1.2.3` and updated configuration metadata to align with the release tag validation check in the pipeline.
|
|
89
137
|
|
|
90
138
|
## [1.1.2] - 2026-05-28
|
|
91
139
|
|
|
92
140
|
### Added
|
|
141
|
+
|
|
93
142
|
- **Technical Documentation (`docs/`):** Added detailed manuals for architecture, CLI reference, configuration fields, MCP tools schemas, two-path indexing, wiki queues, and memory lifecycles.
|
|
94
143
|
- **Main README:** Completely rewrote the `README.md` from scratch to align strictly with the implemented features, CLI commands, configuration options, and integration paths.
|
|
95
144
|
|
|
96
145
|
### Removed
|
|
146
|
+
|
|
97
147
|
- **Obsolete Docs:** Purged stale `quickstart.md`, `retrieval.md`, `roadmap.md`, `diagnostics.md`, `performance.md`, `benchmarks.md`, and `security.md` documents.
|
|
98
148
|
- **Draft Files:** Removed unreferenced root files `SYNAPSE_AUDIT_REPORT.md` and `SYNAPSE_AGENT_PROMPT.md `.
|
|
99
149
|
|
|
100
150
|
## [1.1.1] - 2026-05-28
|
|
101
151
|
|
|
102
152
|
### Fixed
|
|
153
|
+
|
|
103
154
|
- **CRITICAL: N+1 query loop during edge resolution:** Migrated structural edge resolution to bulk FETCH queries, eliminating thousands of database calls per indexing run.
|
|
104
155
|
- **CRITICAL: SQLite Synchronous Pragma:** Enforced \`PRAGMA synchronous=NORMAL\` on every connection, multiplying write throughput by 10x-100x.
|
|
105
156
|
- **SPEC: Content-Scoped File IDs:** Updated \`file_id\` formula to \`sha256(path + content_hash)\` ensuring temporal version isolation in the graph.
|
|
@@ -110,6 +161,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
110
161
|
- **LOW: Checkpoint Validation:** MCP \`create_checkpoint\` tool now validates all input fields to prevent malformed data.
|
|
111
162
|
|
|
112
163
|
### Added
|
|
164
|
+
|
|
113
165
|
- **Interactive Review Flow:** New CLI command \`synap lessons review\` for interactive management of agent-proposed lessons.
|
|
114
166
|
- **Context Monitoring:** New MCP tool \`signal_low_context\` for proactive agent context window monitoring.
|
|
115
167
|
- **Configurable Maintenance:** Added \`checkpoint_threshold\` and \`lesson_expiry_days\` to \`config.toml\`.
|
|
@@ -117,35 +169,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
117
169
|
- **Onboarding Guidance:** \`synap init\` now provides explicit next steps for starting the system.
|
|
118
170
|
|
|
119
171
|
### Removed
|
|
172
|
+
|
|
120
173
|
- **Mock LLM Mode:** \`MockLLMProvider\` removed from the production codebase to maintain strict operational integrity.
|
|
121
174
|
|
|
122
175
|
## [1.1.0] - 2026-05-28
|
|
123
176
|
|
|
124
177
|
### Added — Git-Snapshot Projection & Performance Refactoring
|
|
178
|
+
|
|
125
179
|
- **Split Two-Path Indexing:** Separated initialization and incremental indexing into `_first_run_index` (full scan, CPU-parallelized) and `_incremental_index` (Git delta change detector).
|
|
126
180
|
- **Asynchronous Wiki Generation Queue:** Decoupled slow, non-deterministic LLM wiki generation from structural indexing using a persistent database queue (`wiki_queue`) processed asynchronously by a daemon worker.
|
|
127
181
|
- **Lazy Wiki Caching:** Added synchronous wiki generation fallback to CLI (`wiki show`), Web API, and MCP tools to dynamically build missing or stale pages on-demand.
|
|
128
182
|
- **Process Pool Parallel Parsing:** Parallelized Tree-sitter parsing on first run across all CPU cores utilizing process-based concurrency with independent parser instances.
|
|
129
183
|
- **SQLite Performance Hardening:**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
184
|
+
- WAL mode and NORMAL synchronous configuration enabled during writes.
|
|
185
|
+
- Multi-row symbol and edge inserts batched into a single transaction via `executemany`.
|
|
186
|
+
- Dot-separated `module_key` pre-computation and indexing for $O(1)$ module resolution.
|
|
187
|
+
- SQLite FTS5 index integration for fast sub-millisecond symbol searches, avoiding full-table scans.
|
|
134
188
|
- **Web API Lazy Refreshes:** Updated the `/wiki/{filepath}` GET endpoint to perform lazy refreshes on stale or missing pages before returning content.
|
|
135
189
|
|
|
136
190
|
### Fixed
|
|
191
|
+
|
|
137
192
|
- **FTS5 Cascade Delete:** Added database trigger `tgr_symbols_delete` to automatically clean up virtual `symbols_fts` entries when parent symbols are deleted.
|
|
138
193
|
- **Duplicate File ID Collision:** Handled unique, path-scoped file identifier generation ensuring files with identical content (like empty `__init__.py`) do not conflict.
|
|
139
194
|
|
|
140
195
|
## [0.2.1] - 2026-05-27
|
|
141
196
|
|
|
142
197
|
### Added — Final Production Hardening & Release Execution
|
|
198
|
+
|
|
143
199
|
- `synap rollback --commit <ref>` option: directly target a commit by hash/reference without interactive selection prompt.
|
|
144
200
|
- `synap rollback --yes` / `-y` option: suppress confirmation prompt for non-interactive and scripted rollback flows.
|
|
145
201
|
- Non-interactive guard in `synap rollback`: fails fast with a clear error when used in piped/CI contexts without `--commit` or `--yes`.
|
|
146
202
|
- `synap rollback` invalid commit detection: validates commit reference via `git rev-parse --verify` and rejects unknown refs with a clear message.
|
|
147
203
|
|
|
148
204
|
### Fixed
|
|
205
|
+
|
|
149
206
|
- **SQLite migration short-circuit bug**: legacy un-versioned databases (user_version = 0) incorrectly skipped `CREATE TABLE IF NOT EXISTS` execution, leaving the `symbols` table and others uninitialized. The premature short-circuit is removed; all schema tables are now created correctly before bumping to version 1.
|
|
150
207
|
- **Python `import_from_statement` missing symbol extraction**: Tree-sitter AST parser only extracted the module identifier from `from X import Y` statements, discarding `Y`. Now correctly emits `module:symbol` pairs for all imported names, aliases, and grouped imports.
|
|
151
208
|
- **Namespace-aware call edge resolution**: Pass 2 import resolver now splits `module:symbol` import entries to narrow edge targets to the correct module file, eliminating false-positive dependency edges to duplicate class names in sibling namespaces.
|
|
@@ -154,11 +211,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
154
211
|
- **Degraded mode retry logic**: confirmed 2-stage exponential backoff and graceful structural fallback under fully-offline and timeout conditions.
|
|
155
212
|
|
|
156
213
|
### Changed
|
|
214
|
+
|
|
157
215
|
- Daemon resilience test (`test_daemon_resilience.py`) hardened against race condition where `SIGKILL` test read a stale PID from a prior run that had already exited.
|
|
158
216
|
|
|
159
217
|
## [0.2.0] - 2026-05-26
|
|
160
218
|
|
|
161
219
|
### Added — Final Polish & Release Readiness
|
|
220
|
+
|
|
162
221
|
- CLI usage management: `synap usage show` (displays Rich aggregated usage table and summary panel) and `synap usage clear`.
|
|
163
222
|
- CLI wiki management: `synap wiki list` and `synap wiki show <filepath>` (renders page in terminal via Rich Markdown).
|
|
164
223
|
- LLM call database logging: records `prompt_tokens`, `completion_tokens` for retrieval and wiki generation passes.
|
|
@@ -168,6 +227,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
168
227
|
- Clean Typer execution wrapper: intercepts configuration and credential exceptions to output actionable suggestions (e.g. `synap setup`) instead of tracebacks.
|
|
169
228
|
|
|
170
229
|
### Added — Hardening Loop 2: MCP Stability & Protocol Polish
|
|
230
|
+
|
|
171
231
|
- Deterministic MCP JSON envelope: every tool response carries `ok`, `data`, `warnings`, `trace_id`, `dirty_tree`.
|
|
172
232
|
- Structured error objects with `code`, `message`, and `suggestion` fields for all failure paths.
|
|
173
233
|
- `dirty_tree` propagation: agents are warned when the working tree is ahead of the index.
|
|
@@ -175,6 +235,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
175
235
|
- `synap mcp verify` command to assert full protocol contract compliance.
|
|
176
236
|
|
|
177
237
|
### Added — Hardening Loop 3: Lesson System Trust & Memory Lifecycle
|
|
238
|
+
|
|
178
239
|
- Formal `LessonStatus` enum enforcing explicit state machine: `PENDING → APPROVED/REJECTED`, `APPROVED → EXPIRED`.
|
|
179
240
|
- Retrieval gating: only `APPROVED`, non-expired lessons are injected into LLM context as `# APPROVED SYSTEM MEMORY`.
|
|
180
241
|
- `prune_expired_lessons()` transitions stale lessons to `EXPIRED` state on demand.
|
|
@@ -185,6 +246,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
185
246
|
- `synap lessons approve <id>` and `synap lessons reject <id>` — explicit human governance over pending lessons.
|
|
186
247
|
|
|
187
248
|
### Added — Hardening Loop 4: Tracing, Git Compliance & Release Hardening
|
|
249
|
+
|
|
188
250
|
- `GitIgnoreSpec` glob-to-regex parser in `RepositoryScanner` respects `.gitignore` patterns.
|
|
189
251
|
- Auto-protection: `SynapRuntime.bootstrap()` automatically adds `.synap/` to `.gitignore`.
|
|
190
252
|
- Enhanced binary file detection via extension blocklist + control-character ratio analysis.
|
|
@@ -200,18 +262,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
200
262
|
- `py.typed` marker for PEP 561 compliance.
|
|
201
263
|
|
|
202
264
|
### Changed
|
|
265
|
+
|
|
203
266
|
- CI pipeline split into 4 focused jobs: `lint`, `test`, `benchmark` (main only), `release-validation`.
|
|
204
267
|
- Release validation now runs `synap init` before `synap doctor` to ensure a valid Synap DB context.
|
|
205
268
|
- `pytest` configured with `asyncio_default_fixture_loop_scope = "function"` to eliminate deprecation warnings.
|
|
206
269
|
- Benchmark tests gated behind `benchmark` marker; skipped in fast PR CI passes.
|
|
207
270
|
|
|
208
271
|
### Fixed
|
|
272
|
+
|
|
209
273
|
- `synap doctor` in CI release validation step previously ran against an uninitialized directory.
|
|
210
274
|
- `ruff format` drift in `cli/main.py` and `indexer/daemon.py` resolved.
|
|
211
275
|
|
|
212
276
|
## [0.1.0] - 2026-05-25
|
|
213
277
|
|
|
214
278
|
### Added
|
|
279
|
+
|
|
215
280
|
- Core deterministic indexing engine using Tree-sitter and Git content hashes.
|
|
216
281
|
- 4-stage hybrid retrieval pipeline (Temporal, Structural, Lexical, Semantic).
|
|
217
282
|
- Model Context Protocol (MCP) server for IDE integration.
|
|
@@ -221,11 +286,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
221
286
|
- Diagnostic UI dashboard.
|
|
222
287
|
|
|
223
288
|
### Changed
|
|
289
|
+
|
|
224
290
|
- Refactored entire architecture from event-sourcing to deterministic Git projections.
|
|
225
291
|
- Consolidated storage into unified SQLite schema with Recursive CTE support.
|
|
226
292
|
- Upgraded documentation to production infrastructure standards.
|
|
227
293
|
|
|
228
294
|
### Removed
|
|
295
|
+
|
|
229
296
|
- Legacy "cognitive OS" and "graph operating system" abstractions.
|
|
230
297
|
- Speculative async priority queues and replay engines.
|
|
231
298
|
- Brittle regex-based parsers.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: synap-git
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Persistent structural context infrastructure for AI coding agents.
|
|
5
5
|
Project-URL: Homepage, https://github.com/saahilpal/synapse
|
|
6
6
|
Project-URL: Repository, https://github.com/saahilpal/synapse
|
|
@@ -37,6 +37,7 @@ Requires-Dist: tree-sitter-languages==1.10.2
|
|
|
37
37
|
Requires-Dist: tree-sitter==0.20.4
|
|
38
38
|
Requires-Dist: typer==0.15.1
|
|
39
39
|
Requires-Dist: uvicorn==0.34.0
|
|
40
|
+
Requires-Dist: watchdog>=6.0.0
|
|
40
41
|
Provides-Extra: dev
|
|
41
42
|
Requires-Dist: bandit==1.8.3; extra == 'dev'
|
|
42
43
|
Requires-Dist: mypy==1.15.0; extra == 'dev'
|
|
@@ -652,6 +652,12 @@ def _detect_install_method() -> str:
|
|
|
652
652
|
@app.command()
|
|
653
653
|
def start(
|
|
654
654
|
path: Annotated[str, typer.Argument(help="Repository path to watch.")] = ".",
|
|
655
|
+
foreground: Annotated[
|
|
656
|
+
bool,
|
|
657
|
+
typer.Option(
|
|
658
|
+
"--foreground", help="Run FastMCP stdio server in foreground after starting daemon."
|
|
659
|
+
),
|
|
660
|
+
] = False,
|
|
655
661
|
) -> None:
|
|
656
662
|
"""Start the Synap daemon in the background."""
|
|
657
663
|
_verify_is_git(path)
|
|
@@ -676,6 +682,8 @@ def start(
|
|
|
676
682
|
if hb and "port" in hb:
|
|
677
683
|
console.print(f"[green]✓ UI available at http://127.0.0.1:{hb['port']}[/green]")
|
|
678
684
|
is_running = True
|
|
685
|
+
if not foreground:
|
|
686
|
+
return
|
|
679
687
|
else:
|
|
680
688
|
pid_file.unlink()
|
|
681
689
|
except Exception as e:
|
|
@@ -739,7 +747,10 @@ def start(
|
|
|
739
747
|
)
|
|
740
748
|
raise typer.Exit(1)
|
|
741
749
|
|
|
742
|
-
|
|
750
|
+
if not foreground:
|
|
751
|
+
return
|
|
752
|
+
|
|
753
|
+
# 3. Start MCP Server in the foreground if --foreground flag passed
|
|
743
754
|
settings = _settings(path, json_output=True)
|
|
744
755
|
runtime = SynapRuntime(settings)
|
|
745
756
|
server = SynapMCPServer(runtime)
|
|
@@ -1496,40 +1507,52 @@ def doctor(
|
|
|
1496
1507
|
task_prov, completed=1, description=f"[red]✗ Unexpected error: {e}[/red]"
|
|
1497
1508
|
)
|
|
1498
1509
|
|
|
1499
|
-
task_daemon = progress.add_task("Checking Daemon Status...", total=1)
|
|
1510
|
+
task_daemon = progress.add_task("Checking Daemon & REST API Status...", total=1)
|
|
1500
1511
|
try:
|
|
1512
|
+
import socket
|
|
1513
|
+
|
|
1514
|
+
import httpx
|
|
1515
|
+
|
|
1501
1516
|
daemon_info = _read_daemon_heartbeat(settings.repository_path)
|
|
1502
|
-
if daemon_info
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1517
|
+
port = daemon_info.get("port", 9876) if daemon_info else 9876
|
|
1518
|
+
|
|
1519
|
+
# Test port availability
|
|
1520
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
1521
|
+
s.settimeout(0.5)
|
|
1522
|
+
port_in_use = s.connect_ex(("127.0.0.1", port)) == 0
|
|
1523
|
+
|
|
1524
|
+
if daemon_info and port_in_use:
|
|
1525
|
+
try:
|
|
1526
|
+
r = httpx.get(f"http://127.0.0.1:{port}/api/status", timeout=2.0)
|
|
1527
|
+
if r.status_code == 200:
|
|
1528
|
+
progress.update(
|
|
1529
|
+
task_daemon,
|
|
1530
|
+
completed=1,
|
|
1531
|
+
description=f"[green]✓ Daemon active & REST API healthy (PID {daemon_info['pid']}, port {port})[/green]",
|
|
1532
|
+
)
|
|
1533
|
+
else:
|
|
1534
|
+
progress.update(
|
|
1535
|
+
task_daemon,
|
|
1536
|
+
completed=1,
|
|
1537
|
+
description=f"[yellow]⚠ Daemon running on port {port} but REST API returned HTTP {r.status_code}[/yellow]",
|
|
1538
|
+
)
|
|
1539
|
+
except Exception as ex:
|
|
1523
1540
|
progress.update(
|
|
1524
1541
|
task_daemon,
|
|
1525
1542
|
completed=1,
|
|
1526
|
-
description=f"[
|
|
1543
|
+
description=f"[yellow]⚠ Daemon running on port {port} but API check failed: {ex}[/yellow]",
|
|
1527
1544
|
)
|
|
1545
|
+
elif daemon_info:
|
|
1546
|
+
progress.update(
|
|
1547
|
+
task_daemon,
|
|
1548
|
+
completed=1,
|
|
1549
|
+
description=f"[yellow]⚠ Heartbeat found for PID {daemon_info['pid']} but port {port} is not listening[/yellow]",
|
|
1550
|
+
)
|
|
1528
1551
|
else:
|
|
1529
1552
|
progress.update(
|
|
1530
1553
|
task_daemon,
|
|
1531
1554
|
completed=1,
|
|
1532
|
-
description="[yellow]⚠ Daemon inactive (
|
|
1555
|
+
description=f"[yellow]⚠ Daemon inactive (port {port} available). Start using `synap start`[/yellow]",
|
|
1533
1556
|
)
|
|
1534
1557
|
except Exception as e:
|
|
1535
1558
|
progress.update(
|
|
@@ -2173,3 +2196,16 @@ def wiki_show(
|
|
|
2173
2196
|
|
|
2174
2197
|
content = wiki_path.read_text(encoding="utf-8")
|
|
2175
2198
|
console.print(Markdown(content))
|
|
2199
|
+
|
|
2200
|
+
|
|
2201
|
+
@wiki_app.command("retry")
|
|
2202
|
+
def wiki_retry(
|
|
2203
|
+
path: Annotated[str, typer.Argument(help="Repository path.")] = ".",
|
|
2204
|
+
) -> None:
|
|
2205
|
+
"""Requeue all permanently failed wiki tasks back to pending state."""
|
|
2206
|
+
runtime = SynapRuntime(_settings(path))
|
|
2207
|
+
count = runtime.store.retry_failed_wiki_queue()
|
|
2208
|
+
if count > 0:
|
|
2209
|
+
console.print(f"[green]✓ Requeued {count} failed wiki tasks to pending state.[/green]")
|
|
2210
|
+
else:
|
|
2211
|
+
console.print("[yellow]No failed wiki tasks found in queue.[/yellow]")
|
|
@@ -35,6 +35,8 @@ class RuntimeDaemon:
|
|
|
35
35
|
self._last_metrics_time: float = 0.0
|
|
36
36
|
self._last_cpu_time: float = 0.0
|
|
37
37
|
self._last_prune_time: float = 0.0
|
|
38
|
+
self._fs_changed = False
|
|
39
|
+
self._observer: Any = None
|
|
38
40
|
|
|
39
41
|
async def start(self) -> None:
|
|
40
42
|
self.runtime.initialize_storage()
|
|
@@ -91,6 +93,44 @@ class RuntimeDaemon:
|
|
|
91
93
|
self._write_heartbeat(status="healthy")
|
|
92
94
|
self._install_signal_handlers()
|
|
93
95
|
|
|
96
|
+
# Start watchdog file observer for event-driven git indexing
|
|
97
|
+
self._fs_changed = False
|
|
98
|
+
self._observer = None
|
|
99
|
+
try:
|
|
100
|
+
from watchdog.events import FileSystemEventHandler
|
|
101
|
+
from watchdog.observers import Observer
|
|
102
|
+
|
|
103
|
+
daemon_ref = self
|
|
104
|
+
|
|
105
|
+
class _WatcherHandler(FileSystemEventHandler):
|
|
106
|
+
def on_any_event(self, event: Any) -> None:
|
|
107
|
+
path_str = str(getattr(event, "src_path", ""))
|
|
108
|
+
if any(
|
|
109
|
+
ignored in path_str
|
|
110
|
+
for ignored in (
|
|
111
|
+
".synap",
|
|
112
|
+
".git",
|
|
113
|
+
".venv",
|
|
114
|
+
"__pycache__",
|
|
115
|
+
"node_modules",
|
|
116
|
+
".next",
|
|
117
|
+
"dist",
|
|
118
|
+
"build",
|
|
119
|
+
)
|
|
120
|
+
):
|
|
121
|
+
return
|
|
122
|
+
daemon_ref._fs_changed = True
|
|
123
|
+
|
|
124
|
+
self._observer = Observer()
|
|
125
|
+
self._observer.schedule(
|
|
126
|
+
_WatcherHandler(), str(self.settings.repository_path), recursive=True
|
|
127
|
+
)
|
|
128
|
+
self._observer.start()
|
|
129
|
+
self.logger.info("watchdog_observer_started")
|
|
130
|
+
except Exception as e:
|
|
131
|
+
self.logger.warning("watchdog_observer_init_failed", error=str(e))
|
|
132
|
+
self._observer = None
|
|
133
|
+
|
|
94
134
|
# Launch Uvicorn and Wiki Worker in background
|
|
95
135
|
server_task = asyncio.create_task(self._ui_server.serve())
|
|
96
136
|
wiki_worker_task = asyncio.create_task(self._wiki_worker_loop())
|
|
@@ -98,6 +138,13 @@ class RuntimeDaemon:
|
|
|
98
138
|
try:
|
|
99
139
|
await self._poll_git_loop()
|
|
100
140
|
finally:
|
|
141
|
+
if self._observer:
|
|
142
|
+
try:
|
|
143
|
+
self._observer.stop()
|
|
144
|
+
self._observer.join(timeout=1.0)
|
|
145
|
+
except Exception:
|
|
146
|
+
pass
|
|
147
|
+
|
|
101
148
|
self._running = False
|
|
102
149
|
self.logger.info("daemon_shutting_down")
|
|
103
150
|
self._ui_server.should_exit = True
|
|
@@ -258,60 +305,70 @@ class RuntimeDaemon:
|
|
|
258
305
|
structlog.get_logger().error("suppressed_error_caught", error=str(e))
|
|
259
306
|
|
|
260
307
|
async def _poll_git_loop(self) -> None:
|
|
308
|
+
backstop_interval = 30.0
|
|
309
|
+
poll_step = 0.5
|
|
310
|
+
elapsed = backstop_interval # Force initial check on loop start
|
|
311
|
+
|
|
261
312
|
while not self._stop_event.is_set():
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if now - self._last_prune_time > 3600:
|
|
266
|
-
self._last_prune_time = now
|
|
267
|
-
count = await asyncio.to_thread(self.runtime.store.prune_expired_lessons)
|
|
268
|
-
if count > 0:
|
|
269
|
-
self.logger.info("lessons_pruned", count=count)
|
|
270
|
-
print(f"\n[Synapse] Pruned {count} expired lessons.")
|
|
271
|
-
|
|
272
|
-
state = self.git.state()
|
|
273
|
-
change = self.git.classify(self._last_git_state, state)
|
|
274
|
-
self._last_git_state = state
|
|
275
|
-
|
|
276
|
-
if change.kind == "commit":
|
|
277
|
-
self.logger.info("git_commit_detected")
|
|
278
|
-
await asyncio.to_thread(self.runtime.handle_commit, state)
|
|
279
|
-
elif change.kind in ("branch", "checkout"):
|
|
280
|
-
self.logger.info("git_branch_switch_detected")
|
|
281
|
-
await asyncio.to_thread(self.runtime.handle_branch_switch, state)
|
|
282
|
-
elif change.kind == "merge":
|
|
283
|
-
self.logger.info("git_merge_detected")
|
|
284
|
-
await asyncio.to_thread(self.runtime.handle_merge, state)
|
|
285
|
-
elif change.kind == "revert":
|
|
286
|
-
self.logger.info("git_revert_detected")
|
|
287
|
-
await asyncio.to_thread(self.runtime.handle_revert, self._last_git_state, state)
|
|
288
|
-
elif change.kind not in ("initial", "unchanged"):
|
|
289
|
-
self.logger.info("git_change_detected", kind=change.kind)
|
|
290
|
-
await asyncio.to_thread(self.runtime.index_repository, git_state=state)
|
|
291
|
-
|
|
292
|
-
self._write_heartbeat(status="healthy")
|
|
293
|
-
except Exception as e:
|
|
294
|
-
self.logger.error("daemon_loop_error", error=str(e))
|
|
295
|
-
self._recovery_attempts += 1
|
|
296
|
-
self._write_heartbeat(status="degraded", last_error=str(e))
|
|
313
|
+
if self._fs_changed or elapsed >= backstop_interval:
|
|
314
|
+
self._fs_changed = False
|
|
315
|
+
elapsed = 0.0
|
|
297
316
|
|
|
298
|
-
# Database recovery if corrupted
|
|
299
317
|
try:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
318
|
+
# Periodic pruning (once per hour)
|
|
319
|
+
now = time.time()
|
|
320
|
+
if now - self._last_prune_time > 3600:
|
|
321
|
+
self._last_prune_time = now
|
|
322
|
+
count = await asyncio.to_thread(self.runtime.store.prune_expired_lessons)
|
|
323
|
+
if count > 0:
|
|
324
|
+
self.logger.info("lessons_pruned", count=count)
|
|
325
|
+
print(f"\n[Synapse] Pruned {count} expired lessons.")
|
|
326
|
+
|
|
327
|
+
state = self.git.state()
|
|
328
|
+
change = self.git.classify(self._last_git_state, state)
|
|
329
|
+
self._last_git_state = state
|
|
330
|
+
|
|
331
|
+
if change.kind == "commit":
|
|
332
|
+
self.logger.info("git_commit_detected")
|
|
333
|
+
await asyncio.to_thread(self.runtime.handle_commit, state)
|
|
334
|
+
elif change.kind in ("branch", "checkout"):
|
|
335
|
+
self.logger.info("git_branch_switch_detected")
|
|
336
|
+
await asyncio.to_thread(self.runtime.handle_branch_switch, state)
|
|
337
|
+
elif change.kind == "merge":
|
|
338
|
+
self.logger.info("git_merge_detected")
|
|
339
|
+
await asyncio.to_thread(self.runtime.handle_merge, state)
|
|
340
|
+
elif change.kind == "revert":
|
|
341
|
+
self.logger.info("git_revert_detected")
|
|
342
|
+
await asyncio.to_thread(
|
|
343
|
+
self.runtime.handle_revert, self._last_git_state, state
|
|
344
|
+
)
|
|
345
|
+
elif change.kind not in ("initial", "unchanged"):
|
|
346
|
+
self.logger.info("git_change_detected", kind=change.kind)
|
|
347
|
+
await asyncio.to_thread(self.runtime.index_repository, git_state=state)
|
|
348
|
+
|
|
349
|
+
self._write_heartbeat(status="healthy")
|
|
350
|
+
except Exception as e:
|
|
351
|
+
self.logger.error("daemon_loop_error", error=str(e))
|
|
352
|
+
self._recovery_attempts += 1
|
|
353
|
+
self._write_heartbeat(status="degraded", last_error=str(e))
|
|
354
|
+
|
|
355
|
+
# Database recovery if corrupted
|
|
356
|
+
try:
|
|
357
|
+
is_wiped = await asyncio.to_thread(self.runtime.store.recover_if_corrupted)
|
|
358
|
+
if is_wiped:
|
|
359
|
+
self.logger.warning("daemon_rebuilding_corrupted_db")
|
|
360
|
+
await asyncio.to_thread(self.runtime.bootstrap, force=True)
|
|
361
|
+
except Exception as ex:
|
|
362
|
+
self.logger.error("daemon_self_healing_failed", error=str(ex))
|
|
306
363
|
|
|
307
364
|
try:
|
|
308
365
|
await asyncio.wait_for(
|
|
309
366
|
self._stop_event.wait(),
|
|
310
|
-
timeout=
|
|
367
|
+
timeout=poll_step,
|
|
311
368
|
)
|
|
312
369
|
break # Stop event was set, exit loop
|
|
313
370
|
except TimeoutError:
|
|
314
|
-
|
|
371
|
+
elapsed += poll_step
|
|
315
372
|
|
|
316
373
|
def _install_signal_handlers(self) -> None:
|
|
317
374
|
loop = asyncio.get_running_loop()
|
|
@@ -217,6 +217,52 @@ class CodeParserRegistry:
|
|
|
217
217
|
if kind in ("class", "module", "method"):
|
|
218
218
|
name = extract_text(node.child_by_field_name("name"))
|
|
219
219
|
|
|
220
|
+
elif lang_name == "c_sharp":
|
|
221
|
+
if kind in (
|
|
222
|
+
"class_declaration",
|
|
223
|
+
"method_declaration",
|
|
224
|
+
"interface_declaration",
|
|
225
|
+
"struct_declaration",
|
|
226
|
+
"enum_declaration",
|
|
227
|
+
):
|
|
228
|
+
name = extract_text(node.child_by_field_name("name"))
|
|
229
|
+
|
|
230
|
+
elif lang_name == "php":
|
|
231
|
+
if kind in (
|
|
232
|
+
"class_declaration",
|
|
233
|
+
"function_definition",
|
|
234
|
+
"method_declaration",
|
|
235
|
+
"interface_declaration",
|
|
236
|
+
"trait_declaration",
|
|
237
|
+
):
|
|
238
|
+
name = extract_text(node.child_by_field_name("name"))
|
|
239
|
+
|
|
240
|
+
elif lang_name == "kotlin":
|
|
241
|
+
if kind in (
|
|
242
|
+
"class_declaration",
|
|
243
|
+
"function_declaration",
|
|
244
|
+
"object_declaration",
|
|
245
|
+
"interface_declaration",
|
|
246
|
+
):
|
|
247
|
+
name = extract_text(node.child_by_field_name("name"))
|
|
248
|
+
|
|
249
|
+
elif lang_name == "scala":
|
|
250
|
+
if kind in (
|
|
251
|
+
"class_definition",
|
|
252
|
+
"object_definition",
|
|
253
|
+
"function_definition",
|
|
254
|
+
"trait_definition",
|
|
255
|
+
):
|
|
256
|
+
name = extract_text(node.child_by_field_name("name"))
|
|
257
|
+
|
|
258
|
+
elif lang_name == "c":
|
|
259
|
+
if kind in ("function_definition", "struct_specifier", "enum_specifier"):
|
|
260
|
+
name = extract_text(node.child_by_field_name("name"))
|
|
261
|
+
if not name:
|
|
262
|
+
declarator = node.child_by_field_name("declarator")
|
|
263
|
+
if declarator:
|
|
264
|
+
name = extract_text(declarator.child_by_field_name("declarator"))
|
|
265
|
+
|
|
220
266
|
if name:
|
|
221
267
|
# Compute hash of the node's subtree for change detection
|
|
222
268
|
ast_content = extract_text(node) or ""
|
|
@@ -123,12 +123,13 @@ class AnthropicProvider(LLMProvider):
|
|
|
123
123
|
*,
|
|
124
124
|
model: str | None = None,
|
|
125
125
|
) -> list[float]:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
import structlog
|
|
127
|
+
|
|
128
|
+
structlog.get_logger().warning(
|
|
129
|
+
"anthropic_embedding_not_supported_degrading_to_fts",
|
|
130
|
+
provider="anthropic",
|
|
131
131
|
)
|
|
132
|
+
return []
|
|
132
133
|
|
|
133
134
|
def count_tokens(self, text: str) -> int:
|
|
134
135
|
import tiktoken
|
|
@@ -120,6 +120,10 @@ class OpenRouterProvider(OpenAIProvider):
|
|
|
120
120
|
*,
|
|
121
121
|
model: str | None = None,
|
|
122
122
|
) -> list[float]:
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
import structlog
|
|
124
|
+
|
|
125
|
+
structlog.get_logger().warning(
|
|
126
|
+
"openrouter_embedding_not_supported_degrading_to_fts",
|
|
127
|
+
provider="openrouter",
|
|
125
128
|
)
|
|
129
|
+
return []
|
|
@@ -122,10 +122,15 @@ class HybridRetrievalEngine:
|
|
|
122
122
|
if self.embed_provider:
|
|
123
123
|
try:
|
|
124
124
|
query_vector = self.embed_provider.embed(query)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
if query_vector:
|
|
126
|
+
symbols = self.store.get_similar_symbols(query_vector, limit=50)
|
|
127
|
+
for rank, sym in enumerate(symbols):
|
|
128
|
+
sid = sym["symbol_id"]
|
|
129
|
+
semantic_candidates[sid] = {
|
|
130
|
+
**sym,
|
|
131
|
+
"reason": "semantic",
|
|
132
|
+
"semantic_rank": rank,
|
|
133
|
+
}
|
|
129
134
|
except Exception as e:
|
|
130
135
|
import structlog
|
|
131
136
|
|
|
@@ -44,6 +44,11 @@ class SynapStore:
|
|
|
44
44
|
def initialize(self) -> None:
|
|
45
45
|
self.path.parent.mkdir(parents=True, exist_ok=True)
|
|
46
46
|
with self.connect() as conn:
|
|
47
|
+
# ARCHITECTURAL DECISION (AUD-07):
|
|
48
|
+
# PRAGMA synchronous=NORMAL in WAL mode is an intentional tradeoff:
|
|
49
|
+
# It avoids fsync() on every transaction commit, providing a 5-10x throughput boost for bulk AST indexing.
|
|
50
|
+
# In the rare event of an OS power-loss crash during a write, SQLite WAL recovery or Synapse's automatic
|
|
51
|
+
# self-healing (`recover_if_corrupted()`) safely reconstructs the deterministic local index.
|
|
47
52
|
conn.execute("PRAGMA journal_mode=WAL")
|
|
48
53
|
conn.execute("PRAGMA synchronous=NORMAL")
|
|
49
54
|
conn.execute("PRAGMA foreign_keys=ON")
|
|
@@ -854,6 +859,15 @@ class SynapStore:
|
|
|
854
859
|
with self.connect() as conn:
|
|
855
860
|
conn.execute("DELETE FROM wiki_queue")
|
|
856
861
|
|
|
862
|
+
def retry_failed_wiki_queue(self) -> int:
|
|
863
|
+
now = int(datetime.now(UTC).timestamp())
|
|
864
|
+
with self.connect() as conn:
|
|
865
|
+
cursor = conn.execute(
|
|
866
|
+
"UPDATE wiki_queue SET status = 'pending', attempts = 0, updated_at = ? WHERE status = 'failed'",
|
|
867
|
+
(now,),
|
|
868
|
+
)
|
|
869
|
+
return cursor.rowcount
|
|
870
|
+
|
|
857
871
|
def get_llm_calls(self) -> list[dict[str, Any]]:
|
|
858
872
|
with self.connect() as conn:
|
|
859
873
|
rows = conn.execute("SELECT * FROM llm_calls ORDER BY created_at DESC").fetchall()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|