fix(omp): render custom context and openviking messages as distinct timeline blocks - #4187
DennysOliveira wants to merge 2 commits into
Conversation
|
| Filename | Overview |
|---|---|
| packages/server/src/server/agent/providers/omp/custom-message.ts | Adds centralized classification and timeline mapping for OpenViking and generic OMP custom messages. |
| packages/server/src/server/agent/providers/omp/agent.ts | Routes streamed custom messages through the shared timeline mapper. |
| packages/server/src/server/agent/providers/omp/history-hooks.ts | Uses the same custom-message mapping behavior during history replay. |
| packages/server/src/server/agent/providers/omp/agent.test.ts | Covers streamed OpenViking context as a distinct synthetic tool-call block. |
| packages/server/src/server/agent/providers/omp/history-mapper.test.ts | Covers replayed OpenViking and generic custom-context timeline blocks. |
Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/omp-custom-..." | Re-trigger Greptile
| import type { AgentTimelineItem, ToolCallTimelineItem } from "../../agent-sdk-types.js"; | ||
| import type { OmpAgentMessage } from "./rpc-types.js"; | ||
| import { mapOmpAdvisorMessageToToolCall } from "./advisor-message.js"; | ||
| import { mapOmpSystemNoticeToToolCall } from "./system-notice.js"; | ||
|
|
There was a problem hiding this comment.
This module imports internal server code through relative paths rather than the required @server/* alias, and buildCustomMessageCallId takes three positional parameters including an optional argument instead of one object parameter. These departures make server imports and call sites less consistent and increase refactoring friction.
Context Used: packages/server/CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
This presentation can live in a timeline plugin. The API is on main for the upcoming 0.8 release: timeline plugins. I prefer that implementation over adding it to core. |
Problem
When using
omp(Oh My Pi) as the backend provider in Paseo, prompt injection hooks and memory layers like OpenViking inject context before the model turns viabefore_agent_start. In OMP, these are emitted and recorded ascustom_messageentries withrole: "custom"andcustomType: "custom-message".Previously, Paseo's OMP provider only recognized
advisormessages andsystem-noticeenvelopes, falling back to mapping any other custom message as anassistant_message:This caused injected contexts (such as
<openviking-context>blocks containing profile and memory indexes) to be rendered directly inside the assistant's speech bubble, visually blending the injected system prompt context with the actual model response.Solution
<openviking-context>,<user-profile>,<available-memories>,<relevant-memories>) into synthetic completedtool_calltimeline items (name: "openviking_context", icon:"brain", labeled accordingly like OpenViking · Profile & Memories or OpenViking · Recalled Context).customType: "custom-message",<system-reminder>, etc.) so they render as distinct collapsible contextual blocks rather than assistant messages.history-mapper.test.tsandagent.test.tsfor both replayed and streamed custom context messages.Verification
npm run build:serverpassednpm run typecheck:serverpassed (all packages: relay, protocol, client, server, cli)npm run lintpassed (0 errors, 0 warnings across 3950 files)npm run format:checkpassednpx vitest run packages/server/src/server/agent/providers/omp/passed (20 test suites, 126 tests)