The bin launchers now import dist/src/mcp-protocol.js, so the two fixtures
that copy a launcher into a stub tree transpile it from source (as the
policy fixture already does for policy-enforcer). The dispatch-contract
regex accepts the forwarded trace context.
Co-Authored-By: RuFlo <ruv@ruv.net>
All three stdio MCP servers (bin/cli.js, bin/mcp-server.js, MCPServerManager)
answered initialize with a hardcoded 2024-11-05 and knew nothing of the
2026-07-28 revision. They are now dual-era through one shared module,
src/mcp-protocol.ts:
- initialize echoes a supported legacy version (else 2025-11-25) and reports
the real package version
- server/discover answered with or without _meta (stdio probe)
- per-request _meta version: -32022 for unknown, -32602 when a modern request
lacks clientCapabilities
- modern results carry resultType and serverInfo; list results carry
ttlMs/cacheScope; legacy responses are unchanged
- tools/list sorted by name in both eras (stable prompt caches)
- resources/read uses -32602 for modern, -32002 for legacy
- validated W3C traceparent/tracestate forwarded into the tool-call context
Tasks extension, subscriptions/listen and the HTTP package are Phase 2.
Co-Authored-By: RuFlo <ruv@ruv.net>
The root CI job has no built aidefence, so aidefence_has_pii fell through to
the auto-install path and failed. The test covers the MCP wrapper, not the
detector.
Co-Authored-By: RuFlo <ruv@ruv.net>
The start command now reads the camelCase key the parser produces (#4814),
and the root vitest runs from v3/, where tsx is not hoisted (#4821).
Co-Authored-By: RuFlo <ruv@ruv.net>
pre-bash now blocks when it gets no command (#4743), so a host that delivers
hook input after 500 ms would have every Bash command blocked. The read ends
at EOF, so a prompt host waits no longer.
Co-Authored-By: RuFlo <ruv@ruv.net>
pre-bash exited 0 on every failure path, so a command passed whenever the
hook input arrived after the 500 ms stdin window, failed to parse, or
raised an exception, and when the 5 s safety timer fired.
pre-bash now exits 2 with a [BLOCKED] reason when no command string was
obtained, when stdin is not valid JSON, in the handler and main catch
paths, and from the safety timer. Every other hook keeps exiting 0.
Fixes#4743
Unset keeps the current options exactly. true/false or a comma list of pack
names is passed to createAIDefence in every load and retry branch; any other
value is refused with a clear error.
Closes#4785
Co-Authored-By: RuFlo <ruv@ruv.net>
vitest resolves 'fs' and 'node:fs' to one module, so the second mock
(existsSync: () => false) won and 8 tests failed on Linux.
Co-Authored-By: RuFlo <ruv@ruv.net>
Polling a corrupt store made a new .corrupt-<ts> copy on every read (#4779
review). A backup with identical bytes is now reused.
Co-Authored-By: RuFlo <ruv@ruv.net>
Adds success and missing-argument tests for task_retry, session_delete, system_reset, policy_approve, policy_revoke, policy_budget_set, guidance_quickref and aidefence_has_pii, and success tests for aidefence_stats, progress_sync and memory_compress, which take no arguments.
LocalReasoningBank.flushToDisk() wrote its whole in-memory list. A long-lived daemon/MCP process therefore erased patterns added by hooks or another process, and a corrupt patterns.json was silently replaced with an empty bank on the next flush (#4735).\n\nRe-read patterns.json under withStatsFileLock, merge only locally dirty IDs, carry deleted IDs as tombstones (and clear() as a full reset), then write temp+rename. Corrupt files are renamed aside and preserved before any replacement. Pattern store/update/eviction/delete/clear track dirty/tombstone state.\n\nThree regressions cover cross-process additions, no resurrection of a local delete, and corrupt-file preservation; all fail on baseline and pass on candidate. Existing confidence/dedup/flush tests pass; tsc reports no errors in the changed source. The #4217 stats barrier timeout reproduces identically on baseline (local Windows spawn issue).