Skip to content

feat(memory): wire recall into makeDispatcher + vf plan; fix bun:sqlite bundle leak#506

Merged
magicpro97 merged 2 commits into
mainfrom
fix/memory-dispatcher-wire
Jul 2, 2026
Merged

feat(memory): wire recall into makeDispatcher + vf plan; fix bun:sqlite bundle leak#506
magicpro97 merged 2 commits into
mainfrom
fix/memory-dispatcher-wire

Conversation

@magicpro97

Copy link
Copy Markdown
Owner

Wire memory recall into the two remaining query points and fix the Node.js dist bundle issue.

  • makeDispatcher: resolveMemoryProvider + renderMemoryBlock injected, memBlock passed to buildEnginePrompt
  • plan.ts: buildPlanPrompt gets optional memoryBlock param; wired in plan() entry; ctxDir bug fixed (was passing repo root, now passes .vibeflow dir)
  • commands.ts: re-export buildPlanPrompt (needed by tests)
  • index-db.ts: lazy require("bun:sqlite") via loadSqlite() — fixes ERR_UNSUPPORTED_ESM_URL_SCHEME in Node smoke test (--external bun:sqlite alone insufficient)

Closes #488
Closes #489

…te bundle leak

- dispatch-runtime.ts: wire resolveMemoryProvider+renderMemoryBlock into makeDispatcher
  (passes memBlock as 4th arg to buildEnginePrompt)
- plan.ts: wire recall into buildPlanPrompt (beside §2 Non-negotiables); fix ctxDir bug
  (pass join(base,CTX_DIR) not bare base to resolveMemoryProvider)
- commands.ts: re-export buildPlanPrompt for test access
- index-db.ts: replace static bun:sqlite import with lazy require() to prevent
  ERR_UNSUPPORTED_ESM_URL_SCHEME in Node.js dist bundle; --external bun:sqlite alone
  insufficient (bun bundler still emits static import)

Closes #488
Closes #489

Signed-off-by: magicpro97 <magicpro97@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 2, 2026 11:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes wiring of memory recall into the remaining prompt-construction entry points (vf plan and per-unit dispatch) and adjusts the builtin sqlite-backed memory index to avoid leaking bun:sqlite into the Node-targeted dist bundle.

Changes:

  • Inject recalled “Relevant past decisions” blocks into buildEnginePrompt (dispatch) and buildPlanPrompt (plan).
  • Wire memory provider resolution + recall into makeDispatcher() and plan() using repo settings and .vibeflow context dir.
  • Make bun:sqlite loading lazy in the memory DB implementation to prevent Node dist load failures; add/extend tests for plan prompt behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/commands-plan.test.ts Adds unit tests for buildPlanPrompt memory-block inclusion/omission.
src/memory/index-db.ts Switches from static bun:sqlite import to lazy loading to avoid Node bundle load errors.
src/commands/plan.ts Extends buildPlanPrompt with optional memoryBlock and wires memory recall into plan().
src/commands/dispatch-runtime.ts Wires memory recall into makeDispatcher() and passes memBlock to buildEnginePrompt.
src/commands.ts Re-exports buildPlanPrompt for tests/consumers.

Comment thread src/memory/index-db.ts
Comment thread src/commands/dispatch-runtime.ts
@magicpro97 magicpro97 merged commit 99c10f4 into main Jul 2, 2026
2 checks passed
@magicpro97 magicpro97 deleted the fix/memory-dispatcher-wire branch July 2, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants