Commit Graph

503 Commits

Author SHA1 Message Date
Tobi Lütke
910ca07fd9
fix: keep partial embeddings pending 2026-05-16 17:48:01 +00:00
Tobias Lütke
a35a487af0
Merge pull request #653 from tobi/workoff/t_09301bf8-dev-review
test: cover qmd bin wrapper install layouts
2026-05-16 13:47:44 -04:00
Tobi Lütke
dc49ccff1e
test: cover qmd bin wrapper install layouts 2026-05-16 17:41:43 +00:00
Tobias Lütke
474ac7863d
Merge pull request #652 from tobi/workoff/t_23fce575-dev-review
fix: avoid macOS Metal cleanup abort after JSON query
2026-05-16 13:41:02 -04:00
Tobi Lütke
b59ba6ab1e
test: keep cleanup lifecycle regression portable 2026-05-16 17:35:08 +00:00
Tobias Lütke
9bc316e545
Merge pull request #651 from tobi/workoff/t_0d576ae5-dev-review
fix: keep llama GPU fallback noise off JSON stdout
2026-05-16 13:31:16 -04:00
Tobi Lütke
e4505607f9
Merge remote-tracking branch 'origin/main' into workoff/t_0d576ae5-dev-review
# Conflicts:
#	CHANGELOG.md
2026-05-16 17:26:27 +00:00
Tobi Lütke
60c75cb332
fix: avoid macOS Metal cleanup abort after JSON query 2026-05-16 17:22:46 +00:00
Tobias Lütke
bad20f5565
Merge pull request #644 from Ginja/fix/snippet-absolute-line-numbers
fix: return absolute line numbers from qmd_query
2026-05-16 13:18:35 -04:00
Tobi Lütke
dd5d82d523
fix: keep llama GPU fallback noise off JSON stdout 2026-05-16 17:18:06 +00:00
Tobias Lütke
d0bcdf0cfb
Merge pull request #635 from erlebach/fix/ls-absolute-path-collections
fix(ls): handle collections whose names are absolute paths
2026-05-16 13:13:15 -04:00
Tobi Lütke
2dc8634ac7
fix(ls): preserve qmd:/// collection aliases 2026-05-16 17:12:38 +00:00
Tobias Lütke
7a7c6ed9e2
Merge pull request #643 from woodenriver05/fix-candidate-limit-forwarding
Forward candidateLimit through search APIs
2026-05-16 13:10:44 -04:00
Tobias Lütke
bbd09ff84d
Merge pull request #648 from rubycerebra/mcp/terse-collection-catalogue
perf(mcp): emit terse collection summary in serverInstructions
2026-05-16 13:09:23 -04:00
James Cherry
9cecdc8703 perf(mcp): emit terse collection summary in serverInstructions
Previously buildInstructions emitted one line per collection with name,
doc count, and description, which can run to ~1.5 KB for a dozen
collections and is injected into every session's system prompt at
MCP initialize. Most agents never query qmd in a given session, so the
catalogue lines are a recurring token cost for static info that the
existing 'status' tool already exposes on demand.

Now emit a single comma-joined names line plus a hint that 'status'
returns the rest. listContexts() lookup is dropped since the per-
collection descriptions are no longer rendered.

Refs #647
2026-05-15 23:44:16 +01:00
Riley Shott
aa1818e181
fix: clamp negative fromLine in get to avoid silent tail content
The query tool description tells agents to compute fromLine = line - 20
for context around a hit. For hits in lines 1 through 20 that yields a
negative fromLine, which propagated unchanged through:

  MCP get handler -> store.getDocumentBody -> Array.prototype.slice

A negative slice start offsets from the end of the array rather than
clamping to the beginning, so a top-of-file hit on a long document
returned an empty string and on a short document returned content from
the wrong region (e.g. lines 11-30 of a 30-line file in response to a
request for the head of the document). The lineNumbers branch was the
same shape: addLineNumbers(text, -19) emitted "-19:", "-18:" prefixes.

Same buggy slice lived in the CLI getDocument path independently.

Fix in three layers, plus the docstring:

- src/mcp/server.ts: clamp parsedFromLine to >= 1 after parsing input
  args and the :line suffix, before it reaches getDocumentBody and
  addLineNumbers. Also tighten the query tool's recommendation to
  `fromLine = max(1, line - 20)` so following the docstring literally
  produces a valid value.
- src/cli/qmd.ts: same clamp on the CLI getDocument fromLine after
  the colon-suffix parse.
- src/store.ts: defensive Math.max(0, ...) on the slice start in
  getDocumentBody so SDK callers and any future entry points are
  protected without relying on every caller remembering to clamp.
- test/store.test.ts: regression test on getDocumentBody with
  fromLine = -19 returns the head of the document, not the tail.
- test/cli.test.ts: regression test on `qmd get --from -19` matches
  the no-flag baseline (head of document).
2026-05-13 23:59:33 -07:00
Riley Shott
1f522cffe2
fix: return absolute line numbers from qmd_query
The MCP `query` tool, HTTP `/query` endpoint, and CLI `qmd query`
all returned chunk-local line numbers in their snippet output, so
the line could not be passed back to `qmd_get` as `fromLine`
without an out-of-band lookup. Pass the full document body plus
`bestChunkPos` to `extractSnippet` instead of the chunk text alone
so it can compute absolute line offsets while still scoping the
keyword scan to the reranker-chosen chunk window (preserves #149).

Also restores documented behavior of `qmd query --full`, which was
emitting the best chunk (~3.6KB max) instead of the full document.

extractSnippet now also falls back to a full-body scan when given a
chunkPos but the chunk window contains no positive matches. The
upstream chunk selector leaves bestIdx=0 as its initialization
default whenever scoring fails to find a winner (e.g. queryTerms
filtered to empty by the length>2 guard, or semantic-only matches
with no lex overlap), so an unconditional chunk-scoped scan would
land on chunk 0 instead of where the actual match lives.

- src/mcp/server.ts: SearchResultItem gains `line: number`; both MCP
  and HTTP `/query` handlers populate it
- src/cli/qmd.ts: OutputRow.body now sources from r.body
- src/store.ts: extractSnippet falls back to full-body scan when
  chunk-scoped pass finds no positive match
- test/mcp.test.ts: new fixture asserts absolute line 301 for a
  marker placed past the first chunk boundary
- test/store.test.ts: regression test for the bestScore<=0 fallback
2026-05-13 23:59:32 -07:00
woodenriver05
3b7e065024 fix: forward candidateLimit through search APIs 2026-05-11 20:25:34 -10:00
Tobias Lütke
746beedb48
Merge pull request #636 from tobi/stack/qmd-kanban-fixes-2026-05-09
Integrate QMD fix stack
2026-05-09 16:22:07 -04:00
Tobi Lütke
e36ab96567
fix: allow HTTP query rerank control 2026-05-09 19:03:17 +00:00
Tobi Lütke
669e234d1e
test: index MCP HTTP fixture before query 2026-05-09 18:56:06 +00:00
Tobi Lütke
b32ee4e660
test: make CI fixture invocations portable 2026-05-09 18:45:56 +00:00
Tobi Lütke
4505d8132e
ci(nix): update node module hashes
Refresh fixed-output hashes after moving AST grammar packages into runtime dependencies so Nix CI builds the current locked dependency graph.
2026-05-09 18:31:26 +00:00
Tobi Lütke
e627ca7de6
test: allow slow CPU rerank fixture 2026-05-09 18:20:26 +00:00
Tobi Lütke
ddc969a5f4
fix embed model and qmd home resolution 2026-05-09 18:17:10 +00:00
Tobi Lütke
b775592230
fix mcp --index store selection 2026-05-09 18:16:02 +00:00
Tobi Lütke
e8229d8bfb
Fix Windows CUDA context parallelism 2026-05-09 18:15:39 +00:00
Tobi Lütke
dff6513693
Preserve document IDs across case-only renames 2026-05-09 18:15:15 +00:00
Tobi Lütke
656707c6b4
Fix Node ESM index path normalization 2026-05-09 18:14:33 +00:00
Tobi Lütke
3653f6015c
Fix MCP stdio native log pollution 2026-05-09 18:14:15 +00:00
Tobi Lütke
3f055e705d
Fix AST grammar packaging for Bun installs 2026-05-09 18:13:58 +00:00
Tobi Lütke
004714af48
Fix hybrid RRF weighting by query type 2026-05-09 18:13:38 +00:00
Tobi Lütke
92aaded36e
fix(store): preserve inactive docs during orphan cleanup 2026-05-09 18:13:01 +00:00
Tobi Lütke
5b9f472849
fix(embed): honor collection filter 2026-05-09 18:12:45 +00:00
Tobi Lütke
d045a8bab6
fix(search): support CJK FTS queries 2026-05-09 18:12:45 +00:00
Tobi Lütke
3d991b2a47
fix(cli): keep status from importing llama 2026-05-09 18:12:45 +00:00
erlebach
8fdc4815c5 auto: update src/cli/qmd.ts 2026-05-09 13:35:34 -04:00
Tobias Lütke
d58fedf4b5
Merge pull request #579 from lukeboyett/fix/db-transaction-type
fix(db): declare transaction() on local Database interface
2026-05-02 20:16:33 -04:00
Tobias Lütke
06218b1cc5
Merge pull request #384 from rymalia/fix/semantic-query-hyphen-validation
fix: allow hyphenated words in vec/hyde queries (#383)
2026-05-02 20:16:30 -04:00
Tobias Lütke
a2fcac8225
Merge pull request #602 from fxstein/fix/mcp-production-mode-test-leak
fix(mcp): do not enable production mode at module import time
2026-05-02 20:16:27 -04:00
Pi
a0c460333b fix(cli): do not enable production mode at module import time
src/cli/qmd.ts has the same module-scope enableProductionMode() call that
src/mcp/server.ts had — and the same test-isolation leak. test/cli.test.ts
imports buildEditorUri and termLink from this module, which executes the
top-level enableProductionMode() as a side effect of import, flipping the
global _productionMode flag for every later test file in the Bun process.

This is the actual driver of the Store Creation > createStore throws
without explicit path in test mode failure — test/cli.test.ts runs
alphabetically before test/store.test.ts, so the flag is already true by
the time store.test.ts checks it.

Mirror the fix applied to src/mcp/server.ts in the previous commit: move
enableProductionMode() from module scope into the if (isMain) guard so
the flag is only flipped when qmd is actually invoked as the CLI
entrypoint, not when the module is imported for its exports.
2026-04-23 17:41:10 +00:00
Pi
54262f566c fix(mcp): do not enable production mode at module import time
The top-level enableProductionMode() call added in #537 fixed a real issue
(MCP server resolving the wrong database path at startup) but introduced
test-isolation breakage as a side effect: merely importing src/mcp/server.ts
flipped the global _productionMode flag, which then broke unrelated tests
that depend on the default (development) database path resolution.

This shows up concretely as "Store Creation > createStore throws without
explicit path in test mode" failing on Bun (ubuntu-latest) in CI, because
test/mcp.test.ts imports startMcpHttpServer from this module.

Move the enableProductionMode() call from module scope into the two server
entry points (startMcpServer and startMcpHttpServer). The fix originally
intended by #537 — ensuring production mode is active before getDefaultDbPath
runs — is preserved because both call sites still flip the flag before
createStore / getDefaultDbPath. Importing the module for its exports no longer
mutates global state.

Verified locally against current main: CI failure on Bun (ubuntu-latest)
reproduces on unmodified upstream main (14+ consecutive failed runs since
#537 merged on 2026-04-09) and is resolved by this change.

Refs: #537
2026-04-23 15:57:02 +00:00
Tobias Lütke
e8de7cab02 fix(cli): make status device probe opt-in 2026-04-21 21:45:52 -04:00
Luke Boyett
d231b64617 fix(db): declare transaction() on local Database interface
The narrow cross-runtime Database interface in src/db.ts defines the
subset of better-sqlite3 / bun:sqlite methods used throughout QMD.
Commit fee576b ("fix: migrate legacy lowercase paths on reindex")
introduced a db.transaction(...) call in src/store.ts but did not
extend the interface, breaking `tsc -p tsconfig.build.json`:

  src/store.ts(2142,22): error TS2339: Property 'transaction' does
  not exist on type 'Database'.

Both underlying engines expose transaction(fn), so this just makes
the type reflect reality.
2026-04-14 08:34:20 -04:00
Tobi Lütke
cfd640ed34
fix(test): resolve LLM test timeouts by disabling file parallelism
Parallel test files each cold-load their own LLM model, competing for
CPU and causing timeouts even at 120s. Sequential execution eliminates
contention — tests that timed out at 30s now complete in 1-15s.

Made-with: Cursor
2026-04-11 01:21:22 +00:00
Tobi Lütke
3023ab3c99
fix: bump transitive deps to resolve security alerts
npm: vite 7.3.1→7.3.2, hono 4.12.10→4.12.12,
@hono/node-server 1.19.12→1.19.13

pypi: add uv constraint-dependencies for authlib>=1.6.9,
aiohttp>=3.13.4, cryptography>=46.0.7

Made-with: Cursor
2026-04-11 01:07:09 +00:00
Tobias Lütke
525b9970cd
Merge pull request #546 from junmo-kim/fix/handelize-preserve-case
fix: preserve original case in handelize()
2026-04-10 20:48:24 -04:00
Tobias Lütke
3295294be3
Merge pull request #532 from kuishou68/fix-qmd-uri-index-query
fix: include custom index in qmd:// links
2026-04-10 20:47:55 -04:00
Tobias Lütke
46c4dfdaac
Merge pull request #545 from kuishou68/fix-sqlite-vec-actionable-guidance
fix(store): surface actionable sqlite-vec guidance
2026-04-10 20:47:16 -04:00
Tobias Lütke
89df31142d
Merge pull request #548 from kevinburkesegment/fix-gguf-magic-error
fix: detect and explain non-GGUF model files after download
2026-04-10 20:46:59 -04:00