feat: decouple Pi plugin from @loreai/core via gateway /v1/compact endpoint#271
Merged
Conversation
…dpoint
Pi's session_before_compact hook previously imported distillation from
@loreai/core directly, preventing it from working with a remote/hosted
gateway. This was the last direct core dependency.
Changes:
- Add x-lore-session-id to gateway KNOWN_SESSION_HEADERS (Tier 1)
- Pi injects session header via registerProvider({ headers }) and
re-registers on session_start with the real session ID
- Extract generateCompactionSummary() from handleCompaction for reuse
- Add POST /v1/compact gateway endpoint that accepts project_path and
previous_summary, resolves session from headers, and returns a full
LLM-synthesized compaction summary
- Replace Pi's distillation.loadForSession() call with HTTP fetch to
/v1/compact — graceful fallback on error
- Remove @loreai/core from Pi's dependencies, externals, and tsconfig
Pi is now a pure HTTP client. Compaction quality is upgraded from raw
distillation dump to full force-distill + knowledge + compact prompt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes Pi plugin's last direct
@loreai/coredependency by routing compaction through a new gateway HTTP endpoint. Pi is now a pure HTTP client and works with remote/hosted gateways.What changed
Gateway (3 files):
session.ts— Addedx-lore-session-idtoKNOWN_SESSION_HEADERS(Tier 1 identification). Pi requests now get stable session identification instead of falling through to Tier 3 fingerprint matching.pipeline.ts— ExtractedgenerateCompactionSummary()fromhandleCompaction(shared by both HTTP-intercepted compaction and the new endpoint). AddedhandleCompactEndpoint()forPOST /v1/compact.server.ts— AddedPOST /v1/compactroute.Pi plugin (4 files):
src/index.ts— Injectsx-lore-session-idheader viaregisterProvider({ headers }), re-registers onsession_startwith the real session ID. Replaceddistillation.loadForSession()with HTTP fetch to/v1/compact. Graceful fallback on error (returnsundefined→ Pi uses default compaction). Replacedlogimport withconsole.package.json— Removed@loreai/corefrom dependencies.script/build.ts— Removed@loreai/corefrom esbuild externals.tsconfig.json— Removed@loreai/corepath alias.Why
Pi's
session_before_compacthook directly importeddistillationfrom@loreai/core, requiring the full core + SQLite DB locally. This was the last blocker preventing Pi from working with a remote/hosted gateway.Additional benefits
Verification