feat(kb): chunk_index in /kb/search hits + section-window in /source/{id}/chunks

Two minimal additions for the upcoming v0.1.11 client work:

- /kb/search hits now include chunk_index, so the client can call
  /source/{id}/chunks?around=N&ctx=K to fetch the matched chunk plus K
  chunks before/after as context. Required by the new search-preview
  layout for text sources, which until now duplicated the matched chunk
  in both panes.
- /source/{id}/chunks accepts around (chunk_index) + ctx (window radius
  clamped to 0..10). When around is given, returns only the windowed
  range; otherwise unchanged (returns all chunks of the source).

Refs Task Master #1
This commit is contained in:
2026-04-25 12:25:27 +00:00
parent 1441a41d45
commit b127cafb01
9 changed files with 797 additions and 11 deletions
+24
View File
@@ -7,3 +7,27 @@ venv/
.env
*.log
.pytest_cache/
# Logs
logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
dev-debug.log
# Dependency directories
node_modules/
# Environment variables
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# OS specific
.DS_Store
# Task files
# tasks.json
# tasks/