Skip to content

feat(daemon): extension switchover to daemon-aware store selection (phase 4)#26

Merged
vilosource merged 1 commit into
developfrom
feature/v2-extension-switchover
May 16, 2026
Merged

feat(daemon): extension switchover to daemon-aware store selection (phase 4)#26
vilosource merged 1 commit into
developfrom
feature/v2-extension-switchover

Conversation

@vilosource
Copy link
Copy Markdown
Owner

Phase 4 of the v2 privileged-write-channel (issue #1). The Pi extension
now picks its store at startup based on whether the daemon socket is
present — the in-container switchover the parent DESIGN's Phase 4
requires. Builds on merged Phases 1–3 (#21/#22/#24).

What landed (TDD red→green)

  • store-selection.tsselectKnowledgeStore(brainPath):
    MYKB_STORE=local|rpc forces; else the daemon socket's presence
    auto-selects (contract §2.4 "socket present → use it"). Socket =
    MYKB_SOCKET ?? <brain>/.mykbd.sock (mirrors daemon/main.ts). 5
    unit tests.
  • DIP retype — every extension hook + tool moved from the concrete
    MykbStore to the KnowledgeStore interface (one-line alias import
    per file ×10). index.ts swaps MykbStore.openselectKnowledgeStore.
    RpcKnowledgeStore is now LSP-substitutable with zero call-site
    change
    — the payoff of the sync-bridge decision.
  • Contract-faithful fix surfaced by the retype
    KnowledgeStore.search lacked the excludeZone arg the concrete
    impl + contract §5.3 (exclude_zone) already support. Aligned the
    interface and threaded it through RpcKnowledgeStore.search + the
    dispatcher search verb (not cast away). +1 RPC parity test.

Evidence

Full suite 645/645, zero regressions from the interface retype +
extension store swap (strong LSP evidence). Build + tsc + lint clean.
64/64 daemon tests post-rebase.

Note: in-container the sync bridge blocking the extension's event loop
while the separate-process host daemon serves the call is exactly the
synchronous semantics fs.appendFileSync has today — no behaviour change
for the agent's turn.

…hase 4)

TDD red→green. The extension now selects its KnowledgeStore at startup:
RpcKnowledgeStore when the daemon socket is bind-mounted in (container
topology, contract §2.4), else the local MykbStore (host operator / no
daemon). MYKB_STORE=local|rpc forces; else socket presence auto-detects.

- store-selection.ts: selectKnowledgeStore(brainPath) → {store,mode};
  socket = MYKB_SOCKET ?? <brain>/.mykbd.sock (mirrors daemon/main.ts).
  5 unit tests (local default, socket-present, MYKB_SOCKET, both forces).
- DIP: every extension hook + tool retyped from the concrete MykbStore
  to the KnowledgeStore interface (one-line alias import per file, 10
  files) so RpcKnowledgeStore is LSP-substitutable with zero call-site
  change. index.ts swaps MykbStore.open → selectKnowledgeStore.
- Contract-faithful fix surfaced by the retype: KnowledgeStore.search
  was missing the excludeZone arg the concrete impl + contract §5.3
  (exclude_zone) already support — aligned the interface and threaded it
  through RpcKnowledgeStore.search and the dispatcher search verb (not
  cast away). +1 RPC parity test for exclude_zone over the wire.

Full suite 645/645; zero regressions from the interface retype +
extension swap (LSP evidence). Build + lint clean.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Warning

Rate limit exceeded

@vilosource has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 38 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 17e00395-de19-4bcb-9aff-644191813d49

📥 Commits

Reviewing files that changed from the base of the PR and between 77b7502 and 6439601.

📒 Files selected for processing (17)
  • src/core/types.ts
  • src/daemon/dispatch.ts
  • src/daemon/rpc-store.ts
  • src/daemon/store-selection.ts
  • src/extension/hooks/context.ts
  • src/extension/hooks/kb-command.ts
  • src/extension/hooks/session.ts
  • src/extension/index.ts
  • src/extension/scorer.ts
  • src/tools/index.ts
  • src/tools/kb-add.ts
  • src/tools/kb-list.ts
  • src/tools/kb-load.ts
  • src/tools/kb-search.ts
  • src/tools/kb-verify.ts
  • tests/daemon/rpc-store.test.ts
  • tests/daemon/store-selection.test.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vilosource vilosource merged commit b487726 into develop May 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant