feat(viewer-server): add /api/pi-hooks alias and memory tool routes - #2
Closed
ZeR020 wants to merge 8 commits into
Closed
feat(viewer-server): add /api/pi-hooks alias and memory tool routes#2ZeR020 wants to merge 8 commits into
ZeR020 wants to merge 8 commits into
Conversation
This was referenced Aug 17, 2026
ZeR020
force-pushed
the
stack/2-pi-hooks-adapter
branch
from
August 23, 2026 15:33
ad96919 to
280dc41
Compare
ZeR020
force-pushed
the
stack/3-viewer-routes
branch
from
August 23, 2026 15:33
d64aa35 to
53722e9
Compare
ZeR020
force-pushed
the
stack/2-pi-hooks-adapter
branch
from
August 29, 2026 07:40
280dc41 to
4e8d194
Compare
ZeR020
force-pushed
the
stack/2-pi-hooks-adapter
branch
from
September 8, 2026 12:53
d4a88c6 to
9bd5747
Compare
kunickiaj
force-pushed
the
stack/2-pi-hooks-adapter
branch
from
September 10, 2026 01:59
d50e991 to
e765ac8
Compare
* feat(core): add pi event adapter for 0.41 ingest Map pi extension events to AdapterEvent envelopes with source "pi" and deterministic ids so later stacked routes can call ingestRawEvents without a parallel writer. * fix(core): hash pi event ids and discriminate shutdowns Raw ingest rejects concatenated session/entry ids that contain slash or plus. Hash identity components like Claude/Codex. session_shutdown fell back to a fixed session_end id, so reload then quit collapsed to one row. Derive idPart from reason when entryId is missing or the generic session_end. * fix(core): distinguish same-reason Pi shutdowns by payload ts Generic session_end identity now includes the payload timestamp so two /reload events insert separately while same-payload retries still skip. Tag stored IDs with PI_EVENT_ID_ALGO=pi/1. * test(core): satisfy biome noUnsafeOptionalChaining in pi-hooks tests Biome 2.5.11 from main flags optional-chain casts followed by property access. Keep the same assertions without that pattern. * fix(core): fall back to generated ts for ts-less Pi shutdown ids A generic-entryId shutdown without a payload ts produced the constant `session_end:<reason>:` discriminator, so same-reason occurrences collapsed to one row — losing the later lifecycle event, the exact failure the identity contract forbids. Fall back to the generated envelope ts (the claude-hooks eventIdTsSeed precedent) so occurrences stay distinct; ts-carrying retries still dedupe because the payload ts remains the discriminator. Adds fake-timer coverage mirroring the claude-hooks generated-timestamp test.
…ickiaj#1676) ## Description Refresh the README and supporting docs around persistent coding memory across sessions, machines, and teammates. - Add npm version/download and MIT badges, theme-aware synthetic screenshots, and a viewer walkthrough. - Clarify automatic context injection, optional sync/sharing, and single-user remote MCP. - Distinguish durable npm/manager installs from cached npx setup; correct Claude marketplace installation to require no separate setup command. - Describe Codex as supported while retaining specific compatibility caveats and current OpenCode version boundaries. - Add a reproducible synthetic viewer fixture with isolated temporary storage/configuration, disabled background services, and screenshot-maintenance instructions. The screenshots contain invented data. The fixture is not a network sandbox, and screenshots do not measure extraction or retrieval quality. Unrelated UI changes and website changes are excluded. ## Type of Change - [ ] 🚀 Feature (new functionality) - [ ] 🐛 Bug fix (fixes an issue) - [x] 📚 Documentation (docs-only change) - [x] 🔧 Maintenance (refactor, chore, CI, etc.) - [ ] 🧪 Testing (test-only changes) ## Testing - [ ] Relevant checks pass locally (`pnpm run tsc`, `pnpm run lint`, `pnpm run test`) - [ ] Added/updated tests for changes - [x] Manually verified changes work as expected Targeted validation rather than the full suite: - Fixture TypeScript check passed with ES2024, NodeNext, and source conditions; its bytes match the previously browser-tested fixture. - Biome checked through an included virtual filename; formatted output matches the script exactly. The normal root lint scope excludes this script. - Synthetic fixture and marker-only invocation rejection exercised before preparing this worktree; screenshots visually reviewed. - Relative links/anchors and both screenshot themes reviewed; badge endpoints resolved successfully. - `git diff --cached --check` passed; independent reviewer found no remaining blockers. ## Checklist - [x] Code follows project style (targeted fixture check; see scope above) - [x] Self-review completed - [x] Documentation updated (if needed) - [x] No new warnings introduced
Pi events enter the 0.41 ingest seam through a dedicated compat route that forces source "pi". Memory-tool POSTs reuse the bounded JSON parser and the shared remember-kind catalog.
POST expand/explain/distill copied raw filter values into store queries.
Objects such as include_scope_ids:{x:1} were coerced to "[object Object]".
Validate scalar or scalar-array types and return 400 before SQLite.
ZeR020
force-pushed
the
stack/3-viewer-routes
branch
from
September 10, 2026 11:44
53722e9 to
4494b1b
Compare
Owner
Author
|
Promoted upstream as kunickiaj/codemem#PR once opened — rebased onto main (layers 1–2 merged: kunickiaj#1473, kunickiaj#1546) with hashed-pi-id test updates. Closing this staging PR. |
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.
Third stacked PR for pi support (kunickiaj#1430). Depends on layer 2 (
stack/2-pi-hooks-adapter, #1) and layer 1 (kunickiaj#1473).Opened on the fork because GitHub cannot use
kunickiaj:stack/2-pi-hooks-adapteras a base.Why
Pi needs a dedicated ingest URL that lands on the 0.41 canonical seam, plus the missing HTTP memory-tool routes thin clients use.
What
POST /api/pi-hooks: bounded parse →buildRawEventEnvelopeFromPiEvent→ forcesource: "pi"→ingestNormalizedEnvelope. NorecordRawEvent/stripPrivateObj.remember,timeline,expand,schema,search_index,explain,distill_candidates).REMEMBER_MEMORY_KINDS; string"false"is false.Deliberate: MCP helper bodies stay copied in this layer (same as 066c03d). Extracting them into core is a follow-up, not this PR. Docs stay on layer 8.
Test plan
vitest run packages/viewer-server/src/routes/memory-tools.test.ts— 22/22Stacked on: #1 / kunickiaj#1473
Related: kunickiaj#1430, kunickiaj#1429